UNPKG

@scalar/api-reference

Version:

Generate beautiful API references from OpenAPI documents

44 lines (43 loc) 1.69 kB
import { defineComponent, createElementBlock, createCommentVNode, unref, openBlock, Fragment, renderList, createBlock, withCtx, resolveDynamicComponent, mergeProps } from "vue"; import { ScalarErrorBoundary } from "@scalar/components"; import { usePluginManager } from "../../plugins/hooks/usePluginManager.js"; const _hoisted_1 = { key: 0, class: "plugin-view" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "RenderPlugins", props: { viewName: {}, options: {} }, setup(__props) { const { getViewComponents } = usePluginManager(); const components = getViewComponents(__props.viewName); return (_ctx, _cache) => { return unref(components).length ? (openBlock(), createElementBlock("div", _hoisted_1, [ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(components), (item, _index) => { return openBlock(), createBlock(unref(ScalarErrorBoundary), { key: _index }, { default: withCtx(() => [ item.renderer ? (openBlock(), createBlock(resolveDynamicComponent(item.renderer), mergeProps({ key: 0, ref_for: true }, { component: item.component, options: __props.options, ...item.props }), null, 16)) : (openBlock(), createBlock(resolveDynamicComponent(item.component), mergeProps({ key: 1, ref_for: true }, { options: __props.options, ...item.props }), null, 16)) ]), _: 2 }, 1024); }), 128)) ])) : createCommentVNode("", true); }; } }); export { _sfc_main as default };