@scalar/api-client
Version:
the open source API testing client
65 lines (64 loc) • 2.48 kB
JavaScript
import { defineComponent as f, onBeforeMount as _, onMounted as y, onBeforeUnmount as h, watch as v, computed as w, createBlock as n, openBlock as r, unref as o, withCtx as m, createVNode as i, createElementVNode as C, createCommentVNode as k, KeepAlive as K, resolveDynamicComponent as S } from "vue";
import { addScalarClassesToHeadless as T, ScalarTeleportRoot as B } from "@scalar/components";
import { getThemeStyles as H } from "@scalar/themes";
import { useBreakpoints as M } from "@scalar/use-hooks/useBreakpoints";
import { useColorMode as x } from "@scalar/use-hooks/useColorMode";
import { ScalarToasts as D } from "@scalar/use-toasts";
import { RouterView as E } from "vue-router";
import { useSidebar as L } from "../../hooks/useSidebar.js";
import V from "../App/MainLayout.vue.js";
import { useActiveEntities as b } from "../../store/active-entities.js";
import A from "../../components/ImportCollection/ImportCollectionListener.vue.js";
import { useWorkspace as N } from "../../store/store.js";
import { handleHotKeyDown as P } from "../../libs/hot-keys.js";
const W = ["innerHTML"], Z = /* @__PURE__ */ f({
__name: "ApiClientWeb",
setup($) {
x();
const { activeWorkspace: a } = b(), { events: t } = N();
_(() => T());
const s = (e) => P(e, t.hotKeys), l = (e) => {
e && e.openCommandPalette && (e.openCommandPalette.preventDefault(), t.commandPalette.emit());
};
y(() => {
window.addEventListener("keydown", s), t.hotKeys.on(l);
}), h(() => {
window.removeEventListener("keydown", s), t.hotKeys.off(l);
});
const { mediaQueries: d } = M(), { setSidebarOpen: u } = L();
v(d.xl, u, {
immediate: !0
});
const c = w(
() => a.value && `<style>${H(a.value?.themeId)}</style>`
);
return (e, g) => (r(), n(o(B), null, {
default: m(() => [
i(o(A), null, {
default: m(() => [
C("div", { innerHTML: c.value }, null, 8, W),
o(a)?.uid ? (r(), n(V, { key: 0 }, {
default: m(() => [
i(o(E), null, {
default: m(({ Component: p }) => [
(r(), n(K, null, [
(r(), n(S(p)))
], 1024))
]),
_: 1
})
]),
_: 1
})) : k("", !0),
i(o(D))
]),
_: 1
})
]),
_: 1
}));
}
});
export {
Z as default
};