@scalar/api-client
Version:
the open source API testing client
91 lines (90 loc) • 3.67 kB
JavaScript
import { defineComponent as m, createElementBlock as s, openBlock as n, createElementVNode as l, createVNode as u, createCommentVNode as i, normalizeClass as v, unref as a, createBlock as g } from "vue";
import { ScalarIcon as d } from "@scalar/components";
import f from "../../scalar-address-bar-block/components/AddressBar.vue.js";
import y 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 border-b p-2 pt-2 lg:p-1 lg:pt-1" }, h = { class: "mb-2 flex w-1/2 flex-row items-center gap-1 lg:mb-0 lg:flex-1 lg:px-1" }, B = { 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" }, U = /* @__PURE__ */ m({
__name: "Header",
props: {
path: {},
method: {},
layout: {},
isSidebarOpen: { type: Boolean },
showSidebar: { type: Boolean, default: !0 },
hideClientButton: { type: Boolean, default: !1 },
integration: {},
documentUrl: {},
source: {},
server: {},
servers: {},
history: {},
requestLoadingPercentage: {},
eventBus: {},
environment: {}
},
emits: ["execute", "update:path", "update:method", "update:servers"],
setup(C, { emit: p }) {
const r = p;
return (e, t) => (n(), s("div", b, [
l("div", h, [
e.showSidebar ? (n(), s("div", {
key: 0,
class: v(["size-8", { hidden: e.layout === "modal" && !e.isSidebarOpen }])
}, null, 2)) : i("", !0)
]),
u(a(f), {
environment: e.environment,
eventBus: e.eventBus,
history: e.history,
layout: e.layout,
method: e.method,
path: e.path,
percentage: e.requestLoadingPercentage,
server: e.server,
servers: e.servers,
onExecute: t[0] || (t[0] = (o) => r("execute")),
"onUpdate:method": t[1] || (t[1] = (o) => r("update:method", o)),
"onUpdate:path": t[2] || (t[2] = (o) => r("update:path", o)),
"onUpdate:servers": t[3] || (t[3] = (o) => r("update:servers"))
}, null, 8, ["environment", "eventBus", "history", "layout", "method", "path", "percentage", "server", "servers"]),
l("div", B, [
e.layout === "modal" && e.documentUrl && !e.hideClientButton ? (n(), g(a(y), {
key: 0,
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"])) : i("", !0),
e.layout === "modal" && e.source !== "gitbook" ? (n(), s("button", {
key: 1,
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] = (o) => e.eventBus.emit("hide:modal"))
}, [
u(a(d), {
icon: "Close",
size: "lg",
thickness: "2"
}),
t[6] || (t[6] = l("span", { class: "sr-only" }, "Close Client", -1))
])) : i("", !0),
e.layout === "modal" && e.source === "gitbook" ? (n(), s("button", {
key: 2,
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] = (o) => e.eventBus.emit("hide:modal"))
}, [
u(a(d), {
icon: "Close",
size: "md",
thickness: "1.75"
}),
t[7] || (t[7] = l("span", { class: "sr-only" }, "Close Client", -1))
])) : i("", !0)
])
]));
}
});
export {
U as default
};