UNPKG

@scalar/api-client

Version:

the open source API testing client

139 lines (138 loc) 4.92 kB
import { defineComponent as f, createBlock as p, openBlock as k, unref as t, withCtx as n, createVNode as o, createTextVNode as r, createElementVNode as c, normalizeClass as u, toDisplayString as b } from "vue"; import { ScalarContextMenu as v, ScalarFloating as C, ScalarDropdownMenu as y, ScalarDropdownButton as m, ScalarIcon as i, ScalarHotkey as d, ScalarDropdownDivider as g, ScalarTooltip as T } from "@scalar/components"; import { isMacOS as $ } from "@scalar/helpers/general/is-mac-os"; import { LibraryIcon as w } from "@scalar/icons/library"; const S = { class: "nav-item-icon-copy flex flex-1 items-center justify-center gap-1.5" }, x = { class: "custom-scroll nav-item-copy text-sm" }, O = /* @__PURE__ */ f({ __name: "TopNavItem", props: { hotkey: {}, active: { type: Boolean }, label: {}, icon: {}, isCollection: { type: Boolean } }, emits: ["click", "close", "newTab", "copyUrl", "closeOtherTabs"], setup(s) { return (l, e) => (k(), p(t(v), { triggerClass: "overflow-hidden w-full" }, { trigger: n(() => [ o(t(T), { content: `${t($)() ? "⌘" : "^"}${s.hotkey}`, placement: "bottom" }, { default: n(() => [ c("div", { class: u(["nav-item app-no-drag-region", { "nav-item__active": s.active }]), onClick: e[1] || (e[1] = (a) => l.$emit("click")) }, [ c("div", S, [ s.isCollection ? (k(), p(t(w), { key: 0, class: "size-3.5 min-w-3.5 stroke-2", src: s.icon }, null, 8, ["src"])) : (k(), p(t(i), { key: 1, icon: s.icon, size: "xs", thickness: "2.5" }, null, 8, ["icon"])), c("span", x, b(s.label), 1) ]), c("button", { class: "nav-item-close", type: "button", onClick: e[0] || (e[0] = (a) => l.$emit("close")) }, [ o(t(i), { icon: "Close", thickness: "1.75" }) ]) ], 2) ]), _: 1 }, 8, ["content"]) ]), content: n(() => [ o(t(C), { placement: "right-start" }, { floating: n(() => [ o(t(y), { class: "scalar-app scalar-client" }, { default: n(() => [ o(t(m), { class: "flex items-center gap-1.5", onClick: e[2] || (e[2] = (a) => l.$emit("newTab")) }, { default: n(() => [ o(t(i), { icon: "AddTab", size: "sm", thickness: "1.5" }), e[6] || (e[6] = r(" New Tab ", -1)), o(t(d), { class: "bg-b-2 ml-auto", hotkey: "T" }) ]), _: 1 }), o(t(m), { class: "flex items-center gap-1.5", onClick: e[3] || (e[3] = (a) => l.$emit("copyUrl")) }, { default: n(() => [ o(t(i), { icon: "Link", size: "sm", thickness: "1.5" }), e[7] || (e[7] = r(" Copy URL ", -1)) ]), _: 1 }), o(t(g)), o(t(m), { class: "flex items-center gap-1.5", onClick: e[4] || (e[4] = (a) => l.$emit("close")) }, { default: n(() => [ o(t(i), { icon: "CloseTab", size: "sm", thickness: "1.5" }), e[8] || (e[8] = r(" Close Tab ", -1)), o(t(d), { class: "bg-b-2 ml-auto", hotkey: "W" }) ]), _: 1 }), o(t(m), { class: "flex items-center gap-1.5", onClick: e[5] || (e[5] = (a) => l.$emit("closeOtherTabs")) }, { default: n(() => [ o(t(i), { icon: "CloseTabs", size: "sm", thickness: "1.5" }), e[9] || (e[9] = r(" Close Other Tabs ", -1)) ]), _: 1 }) ]), _: 1 }) ]), _: 1 }) ]), _: 1 })); } }); export { O as default };