UNPKG

@scalar/api-client

Version:

the open source API testing client

81 lines (80 loc) 2.97 kB
import { defineComponent as c, createBlock as y, openBlock as n, unref as m, createSlots as f, withCtx as i, createElementVNode as t, createElementBlock as a, createCommentVNode as l, toDisplayString as o, normalizeClass as g, createTextVNode as r, Fragment as p, createVNode as h } from "vue"; import { ScalarSearchResultItem as S } from "@scalar/components"; import { ScalarIconTag as N, ScalarIconTerminalWindow as T, ScalarIconTextAlignLeft as k } from "@scalar/icons"; import { HttpMethod as B } from "@scalar/sidebar"; const C = { class: "flex min-w-0 flex-col gap-0.5" }, D = { key: 0, class: "text-c-3 truncate text-xs font-medium" }, E = { class: "sr-only" }, I = { class: "inline-flex items-center gap-1" }, R = { class: "sr-only" }, A = /* @__PURE__ */ c({ __name: "SearchResult", props: { id: {}, isSelected: { type: Boolean }, result: {} }, setup(V) { const d = { heading: k, operation: T, tag: N }, u = { heading: "Heading", operation: "Operation", tag: "Tag" }; return (e, s) => (n(), y(m(S), { id: e.id, icon: d[e.result.item.type], selected: e.isSelected }, f({ default: i(() => [ t("div", C, [ e.result.item.documentName ? (n(), a("span", D, o(e.result.item.documentName), 1)) : l("", !0), t("span", { class: g({ "text-decoration-line": e.result.item.entry.type === "operation" && e.result.item.entry.isDeprecated }) }, [ t("span", E, [ r(o(u[e.result.item.type]) + ":  ", 1), e.result.item.entry.type === "operation" && e.result.item.entry.isDeprecated ? (n(), a(p, { key: 0 }, [ r(" (Deprecated)  ") ], 64)) : l("", !0) ]), r(" " + o(e.result.item.title) + " ", 1), s[0] || (s[0] = t("span", { class: "sr-only" }, ",", -1)) ], 2) ]) ]), _: 2 }, [ e.result.item.type === "operation" ? { name: "description", fn: i(() => [ t("span", I, [ e.result.item.type === "operation" ? (n(), a(p, { key: 0 }, [ h(m(B), { "aria-hidden": "true", method: e.result.item.method ?? "get" }, null, 8, ["method"]), t("span", R, " HTTP Method: " + o(e.result.item.method ?? "get"), 1) ], 64)) : l("", !0), s[1] || (s[1] = t("span", { class: "sr-only" }, "Path: ", -1)), r(" " + o(e.result.item.path), 1) ]) ]), key: "0" } : e.result.item.description ? { name: "description", fn: i(() => [ s[2] || (s[2] = t("span", { class: "sr-only" }, "Description: ", -1)), r(" " + o(e.result.item.description), 1) ]), key: "1" } : void 0 ]), 1032, ["id", "icon", "selected"])); } }); export { A as default };