@scalar/api-client
Version:
the open source API testing client
79 lines (78 loc) • 2.42 kB
JavaScript
import { defineComponent as k, ref as i, computed as d, createBlock as V, openBlock as x, withCtx as t, createVNode as n, createTextVNode as B, unref as f } from "vue";
import { ScalarButton as D } from "@scalar/components";
import { LibraryIcon as N } from "@scalar/icons/library";
import { useRouter as S } from "vue-router";
import w from "../../../../components/IconSelector.vue.js";
import C from "./CommandActionForm.vue.js";
import $ from "./CommandActionInput.vue.js";
const y = {}, L = /* @__PURE__ */ k({
...y,
__name: "CommandPaletteDocument",
props: {
workspaceStore: {},
eventBus: {}
},
emits: ["close", "back"],
setup(l, { emit: p }) {
const c = p, v = S(), m = i(""), o = d(() => m.value.trim()), a = i("interface-content-folder"), s = d(() => !o.value || l.workspaceStore.workspace.documents[o.value] !== void 0), b = () => {
s.value || (l.eventBus.emit("document:create:empty-document", {
name: o.value,
icon: a.value,
callback: (u) => {
u && v.push({
name: "document.overview",
params: {
documentSlug: o.value
}
});
}
}), c("close"));
}, _ = (u) => {
c("back", u);
};
return (u, e) => (x(), V(C, {
disabled: s.value,
onSubmit: b
}, {
options: t(() => [
n(w, {
modelValue: a.value,
"onUpdate:modelValue": e[1] || (e[1] = (r) => a.value = r),
placement: "bottom-start"
}, {
default: t(() => [
n(f(D), {
class: "aspect-square h-auto px-0",
variant: "outlined"
}, {
default: t(() => [
n(f(N), {
class: "text-c-2 size-4 stroke-[1.75]",
src: a.value
}, null, 8, ["src"])
]),
_: 1
})
]),
_: 1
}, 8, ["modelValue"])
]),
submit: t(() => [...e[2] || (e[2] = [
B("Create Document", -1)
])]),
default: t(() => [
n($, {
modelValue: m.value,
"onUpdate:modelValue": e[0] || (e[0] = (r) => m.value = r),
label: "Document Name",
placeholder: "Document Name",
onDelete: _
}, null, 8, ["modelValue"])
]),
_: 1
}, 8, ["disabled"]));
}
});
export {
L as default
};