@scalar/api-reference
Version:
Generate beautiful API references from OpenAPI documents
61 lines (60 loc) • 2.14 kB
JavaScript
import { defineComponent as h, computed as u, createElementBlock as y, openBlock as r, createBlock as a, createCommentVNode as i, createElementVNode as s, unref as o, withCtx as l, createTextVNode as k, toDisplayString as p, withModifiers as C, createVNode as g, normalizeStyle as S, normalizeClass as V } from "vue";
import { getHttpMethodInfo as b } from "@scalar/helpers/http/http-info";
import { ScalarIconWebhooksLogo as v } from "@scalar/icons";
import { useSidebar as B } from "../../v2/blocks/scalar-sidebar-block/hooks/useSidebar.js";
import H from "../Section/SectionHeaderTag.vue.js";
import N from "../HttpMethod/HttpMethod.vue.js";
const T = ["href"], L = /* @__PURE__ */ h({
__name: "OperationsListItem",
props: {
operation: {},
isCollapsed: { type: Boolean }
},
setup(t) {
const { scrollToOperation: d } = B(), m = async (e) => {
d(e.id, !0);
}, c = u(() => "path" in t.operation ? t.operation.path : t.operation.title), f = (e) => e.type === "webhook";
return (e, n) => (r(), y("li", {
key: e.operation.id,
class: "contents"
}, [
e.isCollapsed ? (r(), a(o(H), {
key: 0,
class: "sr-only",
level: 3
}, {
default: l(() => [
k(p(e.operation.title) + " (Hidden) ", 1)
]),
_: 1
})) : i("", !0),
s("a", {
class: "endpoint",
href: `#${e.operation.id}`,
onClick: n[0] || (n[0] = C((w) => m(e.operation), ["prevent"]))
}, [
g(o(N), {
class: "endpoint-method items-center justify-end gap-2",
method: e.operation.method
}, {
default: l(() => [
f(e.operation) ? (r(), a(o(v), {
key: 0,
class: "size-3.5",
style: S({
color: o(b)(e.operation.method).colorVar
})
}, null, 8, ["style"])) : i("", !0)
]),
_: 1
}, 8, ["method"]),
s("span", {
class: V(["endpoint-path", { deprecated: e.operation.isDeprecated }])
}, p(c.value), 3)
], 8, T)
]));
}
});
export {
L as default
};