UNPKG

@scalar/api-client

Version:

the open source API testing client

80 lines (79 loc) 3.4 kB
import { defineComponent as k, createElementBlock as l, openBlock as n, createElementVNode as i, createVNode as c, createCommentVNode as s, unref as e, normalizeClass as v, createBlock as C } from "vue"; import { ScalarIcon as u } from "@scalar/components"; import { useRouter as w } from "vue-router"; import x from "../../components/AddressBar/AddressBar.vue.js"; import { useLayout as y } from "../../hooks/useLayout.js"; import { useSidebar as h } from "../../hooks/useSidebar.js"; import { useWorkspace as V } from "../../store/store.js"; import z 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" }, 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__ */ k({ __name: "RequestSubpageHeader", props: { collection: {}, operation: {}, server: {}, environment: {}, envVariables: {}, workspace: {} }, emits: ["hideModal", "importCurl"], setup(t) { const { hideClientButton: d, showSidebar: p, integration: f } = V(), { isSidebarOpen: b } = h(), { layout: r } = y(), { currentRoute: g } = w(); return (a, o) => (n(), l("div", B, [ i("div", S, [ e(p) ? (n(), l("div", { key: 0, class: v(["size-8", { hidden: e(r) === "modal" && !e(b) }]) }, null, 2)) : s("", !0) ]), c(x, { collection: t.collection, envVariables: t.envVariables, environment: t.environment, operation: t.operation, server: t.server, workspace: t.workspace, onImportCurl: o[0] || (o[0] = (m) => a.$emit("importCurl", m)) }, null, 8, ["collection", "envVariables", "environment", "operation", "server", "workspace"]), i("div", $, [ e(r) === "modal" && t.collection.documentUrl && !e(d) ? (n(), C(e(z), { key: 0, buttonSource: "modal", class: "!w-fit lg:-mr-1", integration: e(f) ?? t.collection.integration ?? null, source: e(g).query.source === "gitbook" ? "gitbook" : "api-reference", url: t.collection.documentUrl }, null, 8, ["integration", "source", "url"])) : s("", !0), e(r) === "modal" ? (n(), 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: o[1] || (o[1] = (m) => a.$emit("hideModal")) }, [ c(e(u), { icon: "Close", size: "lg", thickness: "2" }), o[3] || (o[3] = i("span", { class: "sr-only" }, "Close Client", -1)) ])) : s("", !0), e(r) === "modal" ? (n(), 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: o[2] || (o[2] = (m) => a.$emit("hideModal")) }, [ c(e(u), { icon: "Close", size: "md", thickness: "1.75" }), o[4] || (o[4] = i("span", { class: "sr-only" }, "Close Client", -1)) ])) : s("", !0) ]) ])); } }); export { O as default };