@scalar/api-client
Version:
the open source API testing client
100 lines (99 loc) • 4.12 kB
JavaScript
import { defineComponent as g, createElementBlock as s, openBlock as o, createElementVNode as i, createVNode as a, unref as l, createBlock as v, createCommentVNode as m } from "vue";
import { ScalarIcon as d } from "@scalar/components";
import x from "../../scalar-address-bar-block/components/EnvironmentSelector.vue.js";
import B from "../../scalar-address-bar-block/components/AddressBar.vue.js";
import k from "../../../../components/OpenApiClientButton.vue.js";
const b = { class: "lg:min-h-header t-app__top-container flex w-full flex-wrap items-center justify-center p-2 pt-2 lg:p-1 lg:pt-1" }, C = { class: "mb-2 flex w-1/2 flex-row items-center justify-end gap-2 lg:mb-0 lg:flex-1 lg:px-2.5" }, A = /* @__PURE__ */ g({
__name: "Header",
props: {
path: {},
method: {},
layout: {},
hideClientButton: { type: Boolean, default: !1 },
integration: {},
documentUrl: {},
source: {},
server: {},
servers: {},
history: {},
eventBus: {},
environments: {},
activeEnvironment: {},
environment: {}
},
emits: ["execute", "update:servers", "select:history:item", "add:environment"],
setup(e, { emit: c }) {
const r = c, f = (u) => {
e.eventBus.emit("workspace:update:active-environment", u);
}, y = () => {
e.eventBus.emit("ui:navigate", { page: "workspace", path: "environment" });
};
return (u, t) => (o(), s("div", b, [
t[8] || (t[8] = i("div", { class: "mb-2 flex w-1/2 flex-row items-center gap-1 lg:mb-0 lg:flex-1 lg:px-1" }, [
i("div", { class: "size-8" })
], -1)),
a(l(B), {
activeEnvironment: e.activeEnvironment,
environment: e.environment,
environments: e.environments,
eventBus: e.eventBus,
history: e.history,
layout: e.layout,
method: e.method,
path: e.path,
server: e.server,
servers: e.servers,
"onAdd:environment": t[0] || (t[0] = (n) => r("add:environment")),
onExecute: t[1] || (t[1] = (n) => r("execute")),
"onSelect:history:item": t[2] || (t[2] = (n) => r("select:history:item", n)),
"onUpdate:servers": t[3] || (t[3] = (n) => r("update:servers"))
}, null, 8, ["activeEnvironment", "environment", "environments", "eventBus", "history", "layout", "method", "path", "server", "servers"]),
i("div", C, [
e.layout !== "modal" ? (o(), v(x, {
key: 0,
activeEnvironment: e.activeEnvironment,
environments: e.environments,
"onAdd:environment": y,
"onSelect:environment": f
}, null, 8, ["activeEnvironment", "environments"])) : m("", !0),
e.layout === "modal" && e.documentUrl && !e.hideClientButton ? (o(), v(l(k), {
key: 1,
buttonSource: "modal",
class: "!w-fit lg:-mr-1",
integration: e.integration ?? null,
source: e.source ?? "api-reference",
url: e.documentUrl
}, null, 8, ["integration", "source", "url"])) : m("", !0),
e.layout === "modal" && e.source !== "gitbook" ? (o(), s("button", {
key: 2,
class: "app-exit-button zoomed:static zoomed:p-1 fixed top-2 right-2 rounded-full p-2",
type: "button",
onClick: t[4] || (t[4] = (n) => e.eventBus.emit("ui:close:client-modal"))
}, [
a(l(d), {
icon: "Close",
size: "lg",
thickness: "2"
}),
t[6] || (t[6] = i("span", { class: "sr-only" }, "Close Client", -1))
])) : m("", !0),
e.layout === "modal" && e.source === "gitbook" ? (o(), s("button", {
key: 3,
class: "text-c-1 hover:bg-b-2 active:text-c-1 -mr-1.5 rounded p-2",
type: "button",
onClick: t[5] || (t[5] = (n) => e.eventBus.emit("ui:close:client-modal"))
}, [
a(l(d), {
icon: "Close",
size: "md",
thickness: "1.75"
}),
t[7] || (t[7] = i("span", { class: "sr-only" }, "Close Client", -1))
])) : m("", !0)
])
]));
}
});
export {
A as default
};