UNPKG

@scalar/api-client

Version:

the open source API testing client

86 lines (85 loc) 2.94 kB
import { defineComponent as f, computed as m, ref as h, watch as v, createElementBlock as i, openBlock as p, createElementVNode as o, createVNode as s, unref as x, mergeProps as _ } from "vue"; import { isHttpMethod as y } from "@scalar/helpers/http/is-http-method"; import { getResolvedRef as w } from "@scalar/workspace-store/helpers/get-resolved-ref"; import { RouterView as g } from "vue-router"; import k from "./components/LabelInput.vue.js"; import b from "./components/Tabs.vue.js"; const B = { key: 0, class: "custom-scroll h-full" }, S = { class: "w-full px-3 md:mx-auto md:max-w-180" }, V = ["aria-label"], T = { class: "group relative ml-1.25" }, U = { class: "px-1.5 py-8" }, $ = { key: 1, class: "flex w-full flex-1 items-center justify-center" }, C = {}, M = /* @__PURE__ */ f({ ...C, __name: "OperationCollection", props: { documentSlug: {}, document: {}, eventBus: {}, layout: {}, path: {}, method: {}, exampleName: {}, environment: {}, securitySchemes: {}, workspaceStore: {}, activeWorkspace: {}, plugins: {}, customThemes: {}, currentTheme: {}, isDarkMode: { type: Boolean } }, setup(u) { const e = u, n = m(() => { if (!(!e.path || !e.method)) return w(e.document?.paths?.[e.path]?.[e.method]); }), l = h(n.value?.summary ?? ""); v( () => n.value?.summary, (r) => { l.value = r ?? ""; } ); const d = (r) => { const { path: t, method: a } = e; !t || !a || !y(a) || e.eventBus.emit("operation:update:meta", { meta: { path: t, method: a }, payload: { summary: r.trim() } }); }, c = m(() => !e.path || !e.method ? "Untitled Operation" : `${e.method.toUpperCase()} ${e.path}`); return (r, t) => n.value !== void 0 ? (p(), i("div", B, [ o("div", S, [ o("div", { "aria-label": `title: ${l.value}`, class: "mx-auto flex h-fit w-full flex-row items-center gap-2 pt-14 pb-3 md:max-w-180 md:pt-8" }, [ o("div", T, [ s(k, { modelValue: l.value, "onUpdate:modelValue": t[0] || (t[0] = (a) => l.value = a), class: "text-xl font-bold", inputId: "operationSummary", placeholder: c.value, onBlur: d }, null, 8, ["modelValue", "placeholder"]) ]) ], 8, V), s(b, { type: "operation" }), o("div", U, [ s(x(g), _(e, { collectionType: "operation" }), null, 16) ]) ]) ])) : (p(), i("div", $, [...t[1] || (t[1] = [ o("div", { class: "flex h-full flex-col items-center justify-center" }, [ o("h1", { class: "text-2xl font-bold" }, "Operation not found"), o("p", { class: "text-gray-500" }, " The operation you are looking for does not exist. ") ], -1) ])])); } }); export { M as default };