@scalar/api-reference
Version:
Generate beautiful API references from OpenAPI documents
73 lines (72 loc) • 2.16 kB
JavaScript
import { defineComponent as I, computed as y, createElementBlock as i, createCommentVNode as H, openBlock as n, Fragment as l, renderList as S, createBlock as c, unref as o, withCtx as w, createVNode as C } from "vue";
import { splitContent as B, getHeadings as N } from "@scalar/code-highlight/markdown";
import { ScalarMarkdown as u } from "@scalar/components";
import d from "github-slugger";
import b from "../../../../components/IntersectionObserver.vue.js";
import { useNavState as x } from "../../../../hooks/useNavState.js";
const E = {
key: 0,
class: "introduction-description"
}, T = /* @__PURE__ */ I({
__name: "InfoDescription",
props: {
description: {}
},
setup(a) {
const m = y(() => {
if (!a.description)
return [];
const e = new d();
return B(a.description).map((t) => {
const [r] = N(t);
return {
id: r ? s({
...r,
slug: e.slug(r.value)
}) : void 0,
content: t
};
});
}), { getHeadingId: s, getFullHash: p, isIntersectionEnabled: g, replaceUrlState: f } = x();
function h(e = "") {
g.value && f(e);
}
const v = new d(), _ = (e) => (e.data = {
hProperties: {
id: s({
depth: e.depth,
value: e.children[0].value,
slug: v.slug(e.children[0].value)
})
}
}, e);
return (e, k) => e.description ? (n(), i("div", E, [
(n(!0), i(l, null, S(m.value, (t) => (n(), i(l, {
key: t.id
}, [
t.id ? (n(), c(b, {
key: 0,
id: o(p)(t.id),
class: "introduction-description-heading",
onIntersecting: () => h(t.id)
}, {
default: w(() => [
C(o(u), {
transform: _,
transformType: "heading",
value: t.content
}, null, 8, ["value"])
]),
_: 2
}, 1032, ["id", "onIntersecting"])) : (n(), c(o(u), {
key: 1,
value: t.content,
withImages: ""
}, null, 8, ["value"]))
], 64))), 128))
])) : H("", !0);
}
});
export {
T as default
};