@scalar/api-client
Version:
the open source API testing client
57 lines (56 loc) • 1.97 kB
JavaScript
import { defineComponent as m, computed as h, createElementBlock as r, openBlock as o, createElementVNode as n, Fragment as T, renderList as p, createBlock as C, createVNode as g, unref as k } from "vue";
import { ScalarIcon as f } from "@scalar/components";
import B from "./DesktopTab.vue.js";
const y = { class: "t-app__top-nav" }, S = { class: "mac:app-drag-region" }, I = { class: "z-1 flex h-10 items-center gap-2 px-2" }, w = /* @__PURE__ */ m({
__name: "DesktopTabs",
props: {
tabs: {},
activeTabIndex: {},
eventBus: {}
},
setup(e) {
const s = h(() => e.tabs.length === 1), c = () => {
e.eventBus.emit("tabs:add:tab", void 0);
}, b = (t) => {
e.eventBus.emit("tabs:focus:tab", { index: t });
}, i = (t) => {
e.eventBus.emit("tabs:close:tab", { index: t });
}, u = (t) => {
e.eventBus.emit("tabs:close:other-tabs", { index: t });
}, d = (t) => {
e.eventBus.emit("tabs:copy:url", { index: t });
};
return (t, N) => (o(), r("nav", y, [
n("div", S, [
n("div", I, [
(o(!0), r(T, null, p(e.tabs, (v, a) => (o(), C(B, {
key: a,
active: a === e.activeTabIndex,
hotkey: !s.value && a < 9 ? String(a + 1) : void 0,
isSingleTab: s.value,
tab: v,
onClick: (l) => b(a),
onClose: (l) => i(a),
onCloseOtherTabs: (l) => u(a),
onCopyUrl: () => d(a),
onNewTab: c
}, null, 8, ["active", "hotkey", "isSingleTab", "tab", "onClick", "onClose", "onCloseOtherTabs", "onCopyUrl"]))), 128)),
n("button", {
class: "text-c-3 hover:bg-b-3 app-no-drag-region rounded p-1.5",
type: "button",
onClick: c
}, [
g(k(f), {
icon: "Add",
size: "sm",
thickness: "2.5"
})
])
])
])
]));
}
});
export {
w as default
};