UNPKG

@scalar/api-client

Version:

the open source API testing client

143 lines (142 loc) 5.13 kB
import { defineComponent as h, computed as p, createElementBlock as c, openBlock as u, createElementVNode as t, createVNode as o, createBlock as f, createCommentVNode as y, withCtx as l, unref as s, resolveDynamicComponent as g, mergeProps as k } from "vue"; import { ScalarButton as i } from "@scalar/components"; import { ScalarIconFloppyDisk as b } from "@scalar/icons"; import { LibraryIcon as w } from "@scalar/icons/library"; import { RouterView as _ } from "vue-router"; import C from "../../../components/IconSelector.vue.js"; import S from "../../components/callout/Callout.vue.js"; import V from "./components/LabelInput.vue.js"; import B from "./components/Tabs.vue.js"; const D = { class: "custom-scroll h-full" }, N = { key: 0, class: "w-full md:mx-auto md:max-w-180" }, z = ["aria-label"], I = { class: "flex flex-row items-center gap-2" }, U = { class: "group relative ml-1.25" }, T = { class: "px-1.5 py-8" }, $ = { key: 1, class: "flex w-full flex-1 items-center justify-center" }, j = { name: "DocumentCollection" }, H = /* @__PURE__ */ h({ ...j, props: { documentSlug: {}, document: {}, eventBus: {}, layout: {}, path: {}, method: {}, exampleName: {}, environment: {}, securitySchemes: {}, workspaceStore: {}, activeWorkspace: {}, plugins: {}, customThemes: {} }, setup(a) { const n = a, m = p(() => n.document?.info?.title || "Untitled Document"), d = p( () => n.document?.["x-scalar-icon"] || "interface-content-folder" ), v = () => { n.workspaceStore.revertDocumentChanges(n.documentSlug); }, x = () => { n.workspaceStore.saveDocument(n.documentSlug); }; return (E, e) => (u(), c("div", D, [ a.document ? (u(), c("div", N, [ t("div", { "aria-label": `title: ${m.value}`, class: "mx-auto flex h-fit w-full flex-col gap-2 pt-6 pb-3 md:max-w-180" }, [ a.document?.["x-scalar-is-dirty"] ? (u(), f(S, { key: 0, class: "mb-5", type: "warning" }, { actions: l(() => [ o(s(i), { class: "text-c-2 hover:text-c-1 flex items-center gap-2", size: "xs", type: "button", variant: "outlined", onClick: v }, { default: l(() => [...e[2] || (e[2] = [ t("span", null, "Undo", -1) ])]), _: 1 }), o(s(i), { class: "text-c-btn flex items-center gap-2", size: "xs", type: "button", variant: "solid", onClick: x }, { default: l(() => [ o(s(b), { size: "sm", thickness: "1.5" }), e[3] || (e[3] = t("span", null, "Save", -1)) ]), _: 1 }) ]), default: l(() => [ e[4] || (e[4] = t("p", null, " You have unsaved changes. Save your work to keep your changes, or undo to revert them. ", -1)) ]), _: 1 })) : y("", !0), t("div", I, [ o(C, { modelValue: d.value, placement: "bottom-start", "onUpdate:modelValue": e[0] || (e[0] = (r) => a.eventBus.emit("document:update:icon", r)) }, { default: l(() => [ o(s(i), { class: "hover:bg-b-2 aspect-square h-7 w-7 cursor-pointer rounded border border-transparent p-0 hover:border-inherit", variant: "ghost" }, { default: l(() => [ o(s(w), { class: "text-c-2 size-5", src: d.value, "stroke-width": "2" }, null, 8, ["src"]) ]), _: 1 }) ]), _: 1 }, 8, ["modelValue"]), t("div", U, [ o(V, { class: "text-xl font-bold", inputId: "documentName", modelValue: m.value, "onUpdate:modelValue": e[1] || (e[1] = (r) => a.eventBus.emit("document:update:info", { title: r })) }, null, 8, ["modelValue"]) ]) ]) ], 8, z), o(B, { type: "document" }), t("div", T, [ o(s(_), null, { default: l(({ Component: r }) => [ (u(), f(g(r), k(n, { collectionType: "document" }), null, 16)) ]), _: 1 }) ]) ])) : (u(), c("div", $, [...e[5] || (e[5] = [ t("div", { class: "flex h-full flex-col items-center justify-center" }, [ t("h1", { class: "text-2xl font-bold" }, "Document not found"), t("p", { class: "text-gray-500" }, " The document you are looking for does not exist. ") ], -1) ])])) ])); } }); export { H as default };