UNPKG

@scalar/api-client

Version:

the open source API testing client

50 lines (49 loc) 1.72 kB
import { defineComponent as v, computed as m, createElementBlock as c, openBlock as n, createElementVNode as h, Fragment as d, renderList as T, createBlock as p, createVNode as k, unref as C } from "vue"; import { ScalarIcon as g } from "@scalar/components"; import S from "./DesktopTab.vue.js"; const f = { class: "flex h-10 items-center gap-2 px-2" }, O = /* @__PURE__ */ v({ __name: "DesktopTabs", props: { tabsState: {}, eventBus: {} }, setup(a) { const s = m(() => a.tabsState.tabs.value.length === 1), l = () => { a.eventBus.emit("tabs:add:tab", void 0); }, b = (e) => { a.eventBus.emit("tabs:focus:tab", { index: e }); }, r = (e) => { a.eventBus.emit("tabs:close:tab", { index: e }); }, i = (e) => { a.eventBus.emit("tabs:close:other-tabs", { index: e }); }; return (e, B) => (n(), c("nav", f, [ (n(!0), c(d, null, T(e.tabsState.tabs.value, (u, t) => (n(), p(S, { key: t, active: t === e.tabsState.activeTabIndex.value, hotkey: !s.value && t < 9 ? String(t + 1) : void 0, isSingleTab: s.value, tab: u, onClick: (o) => b(t), onClose: (o) => r(t), onCloseOtherTabs: (o) => i(t), onCopyUrl: (o) => e.tabsState.copyTabUrl(t), onNewTab: l }, 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: l }, [ k(C(g), { icon: "Add", size: "sm", thickness: "2.5" }) ]) ])); } }); export { O as default };