@scalar/api-client
Version:
the open source API testing client
31 lines (30 loc) • 1.34 kB
JavaScript
import { defineComponent as d, watch as a, onMounted as i, onBeforeUnmount as s, createBlock as c, openBlock as f, unref as m, withCtx as u, createVNode as p } from "vue";
import { RouterView as w } from "vue-router";
import { useActiveEntities as y } from "../../store/active-entities.js";
import h from "../../v2/components/modals/ModalClientContainer.vue.js";
import { useWorkspace as v } from "../../store/store.js";
import { handleHotKeyDown as _ } from "../../libs/hot-keys.js";
const S = /* @__PURE__ */ d({
__name: "ApiClientModal",
setup(k) {
const { activeWorkspace: l } = y(), { modalState: o, events: t } = v(), n = (e) => _(e, t.hotKeys, l.value?.hotKeyConfig);
a(
() => o.open,
(e) => {
e ? (window.addEventListener("keydown", n), document.documentElement.style.overflow = "hidden") : (window.removeEventListener("keydown", n), document.documentElement.style.removeProperty("overflow"));
}
);
const r = (e) => e?.closeModal && o.open && o.hide();
return i(() => t.hotKeys.on(r)), s(() => {
document.documentElement.style.removeProperty("overflow"), t.hotKeys.off(r);
}), (e, C) => (f(), c(h, { modalState: m(o) }, {
default: u(() => [
p(m(w), { key: "$route.fullPath" })
]),
_: 1
}, 8, ["modalState"]));
}
});
export {
S as default
};