@scalar/api-reference
Version:
Generate beautiful API references from OpenAPI documents
103 lines (102 loc) • 3.79 kB
JavaScript
import { defineComponent as b, useId as y, computed as c, createBlock as s, createCommentVNode as p, openBlock as a, unref as e, withCtx as o, createVNode as l, createElementVNode as w, createTextVNode as B, normalizeClass as N, createElementBlock as g, Fragment as k, renderList as C } from "vue";
import { ScalarErrorBoundary as I } from "@scalar/components";
import A from "../../ShowMoreButton.vue.js";
import { useSidebar as H } from "../../../v2/blocks/scalar-sidebar-block/hooks/useSidebar.js";
import L from "../../Section/SectionContainer.vue.js";
import _ from "../../Section/Section.vue.js";
import E from "../../Section/SectionHeader.vue.js";
import f from "../../Section/SectionHeaderTag.vue.js";
import O from "../../Section/CompactSection.vue.js";
import P from "../Schema/Schema.vue.js";
import V from "../Schema/SchemaHeading.vue.js";
const S = 10, G = /* @__PURE__ */ b({
__name: "ModernLayout",
props: {
options: {},
schemas: { default: () => [] }
},
setup(r) {
const m = y(), { collapsedSidebarItems: h } = H(), n = c(
() => r.options.expandAllModelSections || r.schemas.length <= S || h.models
), M = c(() => n.value ? r.schemas : r.schemas.slice(0, S));
return (t, u) => t.schemas ? (a(), s(e(L), {
key: 0,
id: "models"
}, {
default: o(() => [
l(e(_), { "aria-labelledby": e(m) }, {
default: o(() => [
l(e(E), null, {
default: o(() => [
l(e(f), {
id: e(m),
level: 2
}, {
default: o(() => u[0] || (u[0] = [
B(" Models ")
])),
_: 1,
__: [0]
}, 8, ["id"])
]),
_: 1
}),
w("div", {
class: N(["models-list", { "models-list-truncated": !n.value }])
}, [
(a(!0), g(k, null, C(M.value, ({ id: v, name: d, schema: i }) => (a(), s(e(O), {
id: v,
key: d,
class: "models-list-item",
defaultOpen: t.options.expandAllModelSections,
label: d
}, {
heading: o(() => [
l(e(f), { level: 3 }, {
default: o(() => [
l(e(V), {
name: i.title ?? d,
value: i
}, null, 8, ["name", "value"])
]),
_: 2
}, 1024)
]),
default: o(() => [
l(e(I), null, {
default: o(() => [
l(e(P), {
hideHeading: "",
hideModelNames: "",
level: 1,
noncollapsible: "",
options: {
orderRequiredPropertiesFirst: t.options.orderRequiredPropertiesFirst,
orderSchemaPropertiesBy: t.options.orderSchemaPropertiesBy
},
schema: i
}, null, 8, ["options", "schema"])
]),
_: 2
}, 1024)
]),
_: 2
}, 1032, ["id", "defaultOpen", "label"]))), 128))
], 2),
n.value ? p("", !0) : (a(), s(A, {
key: 0,
id: "models",
class: "show-more-models",
onShowMore: t.options.onShowMore
}, null, 8, ["onShowMore"]))
]),
_: 1
}, 8, ["aria-labelledby"])
]),
_: 1
})) : p("", !0);
}
});
export {
G as default
};