UNPKG

@scalar/api-client

Version:

the open source API testing client

134 lines (133 loc) 4.3 kB
import { defineComponent as x, computed as v, createElementBlock as s, openBlock as o, createVNode as m, createElementVNode as i, normalizeClass as a, createCommentVNode as h, unref as t, toDisplayString as d, Fragment as y, renderList as w, createBlock as b, withCtx as k } from "vue"; import { LibraryIcon as _ } from "@scalar/icons/library"; import { useRouter as g, RouterLink as C } from "vue-router"; import { PathId as n } from "../../routes.js"; import N from "./CollectionInfoForm.vue.js"; import { useActiveEntities as S } from "../../store/active-entities.js"; const B = { class: "bg-b-1 sticky -top-[104px] z-10 mx-auto w-full" }, E = { key: 0, class: "flex max-w-40 items-center" }, z = { class: "text-c-1 mr-[6.25px] hidden overflow-hidden px-2 font-medium text-ellipsis whitespace-nowrap md:block" }, P = /* @__PURE__ */ x({ __name: "CollectionNavigation", props: { isSticky: { type: Boolean } }, setup(I) { const { currentRoute: c } = g(), { activeCollection: e } = S(), p = v(() => [ { displayName: "Overview", // icon: 'Collection', to: { name: "collection.overview", params: { [n.Collection]: e.value?.uid } } }, { displayName: "Servers", // icon: 'Server', to: { name: "collection.servers", params: { [n.Collection]: e.value?.uid } } }, { displayName: "Authentication", // icon: 'Lock', to: { name: "collection.authentication", params: { [n.Collection]: e.value?.uid } } }, { displayName: "Environment", // icon: 'Brackets', to: { name: "collection.environment", params: { [n.Collection]: e.value?.uid } } }, // { // displayName: 'Cookies', // // icon: 'Cookie', // to: { // name: 'collection.cookies', // params: { // [PathId.Collection]: activeCollection.value?.uid, // }, // }, // }, // { // displayName: 'Scripts', // // icon: 'CodeFolder', // to: { // name: 'collection.scripts', // params: { // [PathId.Collection]: activeCollection.value?.uid, // }, // }, // }, // { // displayName: 'Sync', // // icon: 'Download', // to: { // name: 'collection.sync', // }, // }, { displayName: "Settings", // icon: 'Settings', to: { name: "collection.settings" } } ]); return (r, L) => (o(), s("div", B, [ m(N), i("div", { class: a([ "items-center text-sm font-medium", r.isSticky ? "h-fit border-b md:grid md:grid-cols-[1fr_720px_1fr] md:px-4" : "flex md:mx-auto md:max-w-[720px]" ]) }, [ r.isSticky ? (o(), s("div", E, [ m(t(_), { class: "text-c-2 hidden size-3.5 md:block", src: t(e)?.["x-scalar-icon"] || "interface-content-folder", "stroke-width": "2" }, null, 8, ["src"]), i("span", z, d(t(e)?.info?.title), 1) ])) : h("", !0), i("div", { class: a(["flex w-full max-w-[720px] gap-2 pl-1.5 md:ml-1.5 md:pl-0", !r.isSticky && "border-b"]) }, [ (o(!0), s(y, null, w(p.value, ({ to: l, displayName: u }, f) => (o(), b(t(C), { key: f, class: "-ml-2 flex h-10 cursor-pointer items-center px-2 text-center text-sm font-medium whitespace-nowrap no-underline -outline-offset-1 has-[:focus-visible]:outline", to: l }, { default: k(() => [ i("span", { class: a([ "flex-center h-full w-full border-b", typeof l.name == "string" && typeof t(c).name == "string" && t(c).name?.startsWith(l.name) ? "text-c-1 border-c-1" : "text-c-2 hover:text-c-1 border-transparent" ]) }, d(u), 3) ]), _: 2 }, 1032, ["to"]))), 128)) ], 2) ], 2) ])); } }); export { P as default };