UNPKG

@scalar/api-client

Version:

the open source API testing client

101 lines (100 loc) 4.09 kB
import { defineComponent as g, createElementBlock as s, openBlock as o, createElementVNode as i, createVNode as a, unref as r, createBlock as u, createCommentVNode as l } 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" }, h = { 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" }, S = /* @__PURE__ */ g({ __name: "Header", props: { path: {}, method: {}, layout: {}, hideClientButton: { type: Boolean, default: !1 }, integration: {}, documentUrl: {}, source: {}, server: {}, servers: {}, history: {}, eventBus: {}, environments: {}, activeEnvironment: {}, environment: {}, serverMeta: {} }, emits: ["execute", "select:history:item", "add:environment"], setup(e, { emit: c }) { const m = c, f = (v) => { e.eventBus.emit("workspace:update:active-environment", v); }, y = () => { e.eventBus.emit("ui:navigate", { page: "workspace", path: "environment" }); }; return (v, t) => (o(), s("div", b, [ t[7] || (t[7] = 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(r(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, serverMeta: e.serverMeta, servers: e.servers, "onAdd:environment": t[0] || (t[0] = (n) => m("add:environment")), onExecute: t[1] || (t[1] = (n) => m("execute")), "onSelect:history:item": t[2] || (t[2] = (n) => m("select:history:item", n)) }, null, 8, ["activeEnvironment", "environment", "environments", "eventBus", "history", "layout", "method", "path", "server", "serverMeta", "servers"]), i("div", h, [ e.layout !== "modal" ? (o(), u(x, { key: 0, activeEnvironment: e.activeEnvironment, environments: e.environments, "onAdd:environment": y, "onSelect:environment": f }, null, 8, ["activeEnvironment", "environments"])) : l("", !0), e.layout === "modal" && e.documentUrl && !e.hideClientButton ? (o(), u(r(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"])) : l("", !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[3] || (t[3] = (n) => e.eventBus.emit("ui:close:client-modal")) }, [ a(r(d), { icon: "Close", size: "lg", thickness: "2" }), t[5] || (t[5] = i("span", { class: "sr-only" }, "Close Client", -1)) ])) : l("", !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[4] || (t[4] = (n) => e.eventBus.emit("ui:close:client-modal")) }, [ a(r(d), { icon: "Close", size: "md", thickness: "1.75" }), t[6] || (t[6] = i("span", { class: "sr-only" }, "Close Client", -1)) ])) : l("", !0) ]) ])); } }); export { S as default };