@scalar/api-reference
Version:
Generate beautiful API references from OpenAPI documents
62 lines (61 loc) • 2.43 kB
JavaScript
import { defineComponent, computed, createBlock, createCommentVNode, openBlock, unref, withCtx, createVNode, createTextVNode, toDisplayString, createElementVNode, createElementBlock, Fragment, renderList } from "vue";
import { ScalarCard, ScalarCardHeader, ScalarCardSection } from "@scalar/components";
import ScreenReader from "../ScreenReader.vue.js";
import OperationsListItem from "./OperationsListItem.vue.js";
const _hoisted_1 = ["aria-label"];
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "OperationsList",
props: {
tag: {},
eventBus: {}
},
setup(__props) {
const operationsAndWebhooks = computed(() => {
return __props.tag.children?.filter(
(child) => child.type === "operation" || child.type === "webhook"
) ?? [];
});
return (_ctx, _cache) => {
return __props.tag.children && __props.tag.children?.length > 0 ? (openBlock(), createBlock(unref(ScalarCard), {
key: 0,
class: "endpoints-card"
}, {
default: withCtx(() => [
createVNode(unref(ScalarCardHeader), { muted: "" }, {
default: withCtx(() => [
createVNode(ScreenReader, null, {
default: withCtx(() => [
createTextVNode(toDisplayString(__props.tag.title), 1)
]),
_: 1
}),
createTextVNode(" " + toDisplayString(__props.tag.isWebhooks ? "Webhooks" : "Operations"), 1)
]),
_: 1
}),
createVNode(unref(ScalarCardSection), { class: "custom-scroll max-h-[60vh]" }, {
default: withCtx(() => [
createElementVNode("ul", {
"aria-label": `${__props.tag.title} endpoints`,
class: "endpoints"
}, [
(openBlock(true), createElementBlock(Fragment, null, renderList(operationsAndWebhooks.value, (operationOrWebhook) => {
return openBlock(), createBlock(OperationsListItem, {
key: operationOrWebhook.id,
eventBus: __props.eventBus,
operation: operationOrWebhook
}, null, 8, ["eventBus", "operation"]);
}), 128))
], 8, _hoisted_1)
]),
_: 1
})
]),
_: 1
})) : createCommentVNode("", true);
};
}
});
export {
_sfc_main as default
};