UNPKG

@scalar/api-client

Version:

the open source API testing client

107 lines (106 loc) 4.61 kB
import { defineComponent as w, createElementBlock as a, openBlock as d, Fragment as i, createElementVNode as e, createVNode as n, unref as o, createTextVNode as u, toDisplayString as x, withCtx as m } from "vue"; import { useModal as v, ScalarToggle as D, ScalarIcon as f, ScalarButton as y, ScalarModal as k } from "@scalar/components"; import M from "../../../components/Sidebar/Actions/DeleteSidebarListElement.vue.js"; const U = { class: "flex flex-col gap-12" }, C = { class: "flex flex-col gap-2" }, N = { class: "bg-b-2 rounded-lg border text-sm" }, S = { class: "bg-b-1 flex items-center justify-between gap-4 rounded-t-lg p-3" }, B = { class: "text-c-1 flex items-center overflow-x-auto border-t py-1.5 whitespace-nowrap" }, V = { class: "flex items-center" }, T = ["href"], A = { class: "flex flex-col gap-4" }, E = { class: "flex items-center justify-between rounded-lg border p-3 text-sm" }, _ = /* @__PURE__ */ w({ __name: "DocumentSettings", props: { documentUrl: {}, watchMode: { type: Boolean }, title: {}, isDraftDocument: { type: Boolean, default: !1 } }, emits: ["delete:document", "update:watchMode"], setup(p, { emit: g }) { const r = g, s = v(), b = () => { p.isDraftDocument || s.show(); }, h = () => { r("delete:document"), s.hide(); }; return (l, t) => (d(), a(i, null, [ e("div", U, [ e("div", C, [ t[5] || (t[5] = e("div", { class: "flex h-8 items-center" }, [ e("h3", { class: "font-bold" }, "Features") ], -1)), e("div", N, [ e("div", S, [ t[2] || (t[2] = e("div", null, [ e("h4", null, "Watch Mode"), e("p", { class: "text-c-2 mt-1" }, " When enabled, the OpenAPI document will be polled for changes. The collection will be updated automatically. ") ], -1)), n(o(D), { class: "w-4", disabled: !l.documentUrl, modelValue: l.watchMode ?? !1, "onUpdate:modelValue": t[0] || (t[0] = (c) => r("update:watchMode", c)) }, null, 8, ["disabled", "modelValue"]) ]), e("div", B, [ e("div", V, [ l.documentUrl ? (d(), a(i, { key: 0 }, [ t[3] || (t[3] = e("span", { class: "bg-b-2 sticky left-0 pr-2 pl-3" }, "Source", -1)), e("a", { class: "text-c-2 group rounded pr-3 no-underline hover:underline", href: l.documentUrl, target: "_blank" }, [ u(x(l.documentUrl) + " ", 1), n(o(f), { class: "ml-1 hidden w-2.5 group-hover:inline", icon: "ExternalLink" }) ], 8, T) ], 64)) : (d(), a(i, { key: 1 }, [ n(o(f), { class: "text-c-2 mr-2 ml-3 w-4", icon: "NotAllowed", size: "sm" }), t[4] || (t[4] = e("span", { class: "text-c-2 pr-3" }, " No URL configured. Try importing an OpenAPI document from an URL. ", -1)) ], 64)) ]) ]) ]) ]), e("div", A, [ t[8] || (t[8] = e("h3", { class: "font-bold" }, "Danger Zone", -1)), e("div", E, [ t[7] || (t[7] = e("div", null, [ e("h4", null, "Delete Collection"), e("p", { class: "text-c-2 mt-1" }, " Be careful, my friend. Once deleted, there is no way to recover the collection. ") ], -1)), n(o(y), { class: "custom-scroll h-8 gap-1.5 px-2.5 font-medium whitespace-nowrap shadow-none focus:outline-none", variant: "danger", disabled: l.isDraftDocument, onClick: b }, { default: m(() => [...t[6] || (t[6] = [ u(" Delete Collection ", -1) ])]), _: 1 }, 8, ["disabled"]) ]) ]) ]), n(o(k), { size: "xxs", state: o(s), title: `Delete ${l.title}` }, { default: m(() => [ n(M, { variableName: l.title ?? "", warningMessage: "This action cannot be undone.", onClose: t[1] || (t[1] = (c) => o(s).hide()), onDelete: h }, null, 8, ["variableName"]) ]), _: 1 }, 8, ["state", "title"]) ], 64)); } }); export { _ as default };