UNPKG

@scalar/api-reference

Version:

Generate beautiful API references from OpenAPI documents

42 lines (41 loc) 1.7 kB
import { computed, createBlock, defineComponent, openBlock, unref } from "vue"; import { ScalarCodeBlock, ScalarVirtualText } from "@scalar/components"; import { getResolvedRefDeep } from "@scalar/api-client/blocks/operation-code-sample"; import { prettyPrintJson } from "@scalar/helpers/json/pretty-print-json"; //#region src/features/example-responses/ExampleSchema.vue?vue&type=script&setup=true&lang.ts var VIRTUALIZATION_THRESHOLD = 2e4; var ExampleSchema_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({ __name: "ExampleSchema", props: { id: {}, schema: {} }, setup(__props) { const schemaContent = computed(() => { if (!__props.schema) return; return prettyPrintJson(getResolvedRefDeep(__props.schema)); }); const shouldVirtualizeSchema = computed(() => { return (schemaContent.value?.length ?? 0) > VIRTUALIZATION_THRESHOLD; }); return (_ctx, _cache) => { return !shouldVirtualizeSchema.value ? (openBlock(), createBlock(unref(ScalarCodeBlock), { key: 0, id: __props.id, class: "bg-b-2", lang: "json", prettyPrintedContent: schemaContent.value ?? "" }, null, 8, ["id", "prettyPrintedContent"])) : (openBlock(), createBlock(unref(ScalarVirtualText), { key: 1, id: __props.id, containerClass: "custom-scroll scalar-code-block border rounded-b flex flex-1 max-h-screen", contentClass: "language-plaintext whitespace-pre font-code text-base", lineHeight: 20, text: schemaContent.value ?? "" }, null, 8, ["id", "text"])); }; } }); //#endregion export { ExampleSchema_vue_vue_type_script_setup_true_lang_default as default }; //# sourceMappingURL=ExampleSchema.vue.script.js.map