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