@scalar/api-client
Version:
the open source API testing client
39 lines (38 loc) • 1.4 kB
JavaScript
import { defineComponent as u, ref as c, createBlock as d, openBlock as l, Transition as m, withCtx as r, createElementBlock as f, createCommentVNode as p, unref as e, createVNode as i, createTextVNode as g } from "vue";
import { useLoadingState as v, ScalarLoading as x, ScalarButton as _ } from "@scalar/components";
import { useWorkspace as k } from "../../../store/store.js";
const L = {
key: 0,
class: "bg-b-1 z-overlay absolute inset-0 flex flex-col items-center justify-center gap-6"
}, b = /* @__PURE__ */ u({
__name: "ResponseLoadingOverlay",
setup(S) {
const { events: n } = k(), t = v(), a = c();
return n.requestStatus.on((s) => {
s === "start" ? a.value = setTimeout(() => t.startLoading(), 1e3) : (clearTimeout(a.value), a.value = void 0, t.stopLoading());
}), (s, o) => (l(), d(m, null, {
default: r(() => [
e(t).isLoading ? (l(), f("div", L, [
i(e(x), {
class: "text-c-3",
loadingState: e(t),
size: "3xl"
}, null, 8, ["loadingState"]),
i(e(_), {
variant: "ghost",
onClick: o[0] || (o[0] = (C) => e(n).cancelRequest.emit())
}, {
default: r(() => [...o[1] || (o[1] = [
g(" Cancel ", -1)
])]),
_: 1
})
])) : p("", !0)
]),
_: 1
}));
}
});
export {
b as default
};