@scalar/api-client
Version:
the open source API testing client
80 lines (79 loc) • 3.4 kB
JavaScript
import { defineComponent as g, createElementBlock as l, openBlock as r, createElementVNode as i, createVNode as m, createCommentVNode as s, unref as o, normalizeClass as k, createBlock as v } from "vue";
import { ScalarIcon as p } from "@scalar/components";
import { useRouter as C } from "vue-router";
import w from "../../components/AddressBar/AddressBar.vue.js";
import { useLayout as y } from "../../hooks/useLayout.js";
import { useSidebar as h } from "../../hooks/useSidebar.js";
import V from "../../components/OpenApiClientButton.vue.js";
import { useWorkspace as z } from "../../store/store.js";
const B = { class: "lg:min-h-header t-app__top-container flex w-full flex-wrap items-center justify-center border-b p-2 pt-2 lg:p-1 lg:pt-1" }, S = { class: "mb-2 flex w-1/2 flex-row items-center gap-1 lg:mb-0 lg:flex-1 lg:px-1" }, $ = { class: "mb-2 flex w-1/2 flex-row items-center justify-end gap-1 lg:mb-0 lg:flex-1 lg:px-2.5" }, O = /* @__PURE__ */ g({
__name: "RequestSubpageHeader",
props: {
collection: {},
operation: {},
server: {},
environment: {},
envVariables: {},
workspace: {}
},
emits: ["hideModal", "importCurl"],
setup(x) {
const { hideClientButton: u, showSidebar: d, integration: c } = z(), { isSidebarOpen: f } = h(), { layout: n } = y(), { currentRoute: b } = C();
return (e, t) => (r(), l("div", B, [
i("div", S, [
o(d) ? (r(), l("div", {
key: 0,
class: k(["size-8", { hidden: o(n) === "modal" && !o(f) }])
}, null, 2)) : s("", !0)
]),
m(w, {
collection: e.collection,
envVariables: e.envVariables,
environment: e.environment,
operation: e.operation,
server: e.server,
workspace: e.workspace,
onImportCurl: t[0] || (t[0] = (a) => e.$emit("importCurl", a))
}, null, 8, ["collection", "envVariables", "environment", "operation", "server", "workspace"]),
i("div", $, [
o(n) === "modal" && e.collection.documentUrl && !o(u) ? (r(), v(o(V), {
key: 0,
buttonSource: "modal",
class: "!w-fit lg:-mr-1",
integration: o(c) ?? e.collection.integration ?? null,
source: o(b).query.source === "gitbook" ? "gitbook" : "api-reference",
url: e.collection.documentUrl
}, null, 8, ["integration", "source", "url"])) : s("", !0),
o(n) === "modal" ? (r(), l("button", {
key: 1,
class: "app-exit-button gitbook-hidden zoomed:static zoomed:p-1 fixed top-2 right-2 rounded-full p-2",
type: "button",
onClick: t[1] || (t[1] = (a) => e.$emit("hideModal"))
}, [
m(o(p), {
icon: "Close",
size: "lg",
thickness: "2"
}),
t[3] || (t[3] = i("span", { class: "sr-only" }, "Close Client", -1))
])) : s("", !0),
o(n) === "modal" ? (r(), l("button", {
key: 2,
class: "text-c-1 hover:bg-b-2 active:text-c-1 gitbook-show -mr-1.5 rounded p-2",
type: "button",
onClick: t[2] || (t[2] = (a) => e.$emit("hideModal"))
}, [
m(o(p), {
icon: "Close",
size: "md",
thickness: "1.75"
}),
t[4] || (t[4] = i("span", { class: "sr-only" }, "Close Client", -1))
])) : s("", !0)
])
]));
}
});
export {
O as default
};