@scalar/blocks 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +1 -2
- package/dist/code-example/components/AsyncApiCodeExample.vue.js +1 -2
- package/dist/code-example/components/AsyncApiCodeExample.vue.js.map +1 -1
- package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/code-example/components/CodeExample.vue.d.ts +2 -0
- package/dist/code-example/components/CodeExample.vue.d.ts.map +1 -1
- package/dist/code-example/components/CodeExample.vue.js +4 -5
- package/dist/code-example/components/CodeExample.vue.js.map +1 -1
- package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js +102 -100
- package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/code-example/components/ExamplePicker.vue.js +1 -2
- package/dist/code-example/components/ExamplePicker.vue.js.map +1 -1
- package/dist/code-example/components/ExamplePicker.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/code-example/components/HttpMethod.vue.js +1 -2
- package/dist/code-example/components/HttpMethod.vue.js.map +1 -1
- package/dist/code-example/components/HttpMethod.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/code-example/helpers/filter-clients-by-query.js +1 -2
- package/dist/code-example/helpers/find-client.js +1 -2
- package/dist/code-example/helpers/format-language.js +1 -2
- package/dist/code-example/helpers/generate-client-options.js +1 -2
- package/dist/code-example/helpers/generate-code-snippet.d.ts +2 -1
- package/dist/code-example/helpers/generate-code-snippet.d.ts.map +1 -1
- package/dist/code-example/helpers/generate-code-snippet.js +11 -11
- package/dist/code-example/helpers/generate-code-snippet.js.map +1 -1
- package/dist/code-example/helpers/get-asyncapi-example-context.js +1 -2
- package/dist/code-example/helpers/get-clients.js +8 -9
- package/dist/code-example/helpers/get-custom-code-samples.js +1 -2
- package/dist/code-example/helpers/get-generated-payload-example.js +1 -2
- package/dist/code-example/helpers/get-message-example-content.js +1 -2
- package/dist/code-example/helpers/get-secrets.js +1 -2
- package/dist/code-example/helpers/get-snippet.js +1 -2
- package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts +2 -1
- package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/operation-to-har.js +32 -31
- package/dist/code-example/helpers/operation-to-har/operation-to-har.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-body.d.ts +2 -2
- package/dist/code-example/helpers/operation-to-har/process-body.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-body.js +80 -52
- package/dist/code-example/helpers/operation-to-har/process-body.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-parameters.d.ts +2 -1
- package/dist/code-example/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-parameters.js +65 -58
- package/dist/code-example/helpers/operation-to-har/process-parameters.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-security-schemes.js +1 -2
- package/dist/code-example/helpers/operation-to-har/process-server-url.js +1 -2
- package/dist/code-example/index.js +10 -10
- package/dist/code-example/mount-asyncapi.js +7 -8
- package/dist/code-example/mount.js +5 -6
- package/dist/constants.js +2 -3
- package/dist/schema/LinkButton.vue.js +1 -2
- package/dist/schema/RenderString.vue.js +1 -2
- package/dist/schema/RenderString.vue.js.map +1 -1
- package/dist/schema/RenderString.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/Schema.vue.js +4 -5
- package/dist/schema/Schema.vue.js.map +1 -1
- package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js +67 -68
- package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaCollapsedPreview.vue.js +1 -2
- package/dist/schema/SchemaCollapsedPreview.vue.js.map +1 -1
- package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaComposition.vue.js +4 -5
- package/dist/schema/SchemaComposition.vue.js.map +1 -1
- package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js +26 -27
- package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaEnumPropertyItem.vue.js +1 -2
- package/dist/schema/SchemaEnumPropertyItem.vue.js.map +1 -1
- package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaEnums.vue.js +4 -5
- package/dist/schema/SchemaEnums.vue.js.map +1 -1
- package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js +12 -13
- package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaGlyphPuck.vue.js +1 -2
- package/dist/schema/SchemaGlyphPuck.vue.js.map +1 -1
- package/dist/schema/SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaGutterToggle.vue.js +1 -2
- package/dist/schema/SchemaGutterToggle.vue.js.map +1 -1
- package/dist/schema/SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaHeading.vue.js +4 -5
- package/dist/schema/SchemaHeading.vue.js.map +1 -1
- package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaObjectExampleCodeBlock.vue.js +1 -2
- package/dist/schema/SchemaObjectExampleCodeBlock.vue.js.map +1 -1
- package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaObjectProperties.vue.js +1 -2
- package/dist/schema/SchemaObjectProperties.vue.js.map +1 -1
- package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaProperty.vue.js +4 -5
- package/dist/schema/SchemaProperty.vue.js.map +1 -1
- package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js +48 -49
- package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaPropertyDefault.vue.js +4 -5
- package/dist/schema/SchemaPropertyDefault.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js +9 -10
- package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaPropertyDetail.vue.js +4 -5
- package/dist/schema/SchemaPropertyDetail.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaPropertyExamples.vue.js +4 -5
- package/dist/schema/SchemaPropertyExamples.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js +18 -19
- package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaPropertyHeading.vue.js +4 -5
- package/dist/schema/SchemaPropertyHeading.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js +101 -102
- package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaPropertyPattern.vue.js +4 -5
- package/dist/schema/SchemaPropertyPattern.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyPattern.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaRailPanel.vue.js +1 -2
- package/dist/schema/SchemaRailPanel.vue.js.map +1 -1
- package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/components/CopyLinkButton.vue.js +1 -2
- package/dist/schema/components/CopyLinkButton.vue.js.map +1 -1
- package/dist/schema/components/CopyLinkButton.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/components/WithBreadcrumb.vue.js +1 -2
- package/dist/schema/components/WithBreadcrumb.vue.js.map +1 -1
- package/dist/schema/components/WithBreadcrumb.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/schema/discriminator-metadata.js +1 -2
- package/dist/schema/helpers/dynamic-scope.js +1 -2
- package/dist/schema/helpers/format-example.js +1 -2
- package/dist/schema/helpers/format-value.js +1 -2
- package/dist/schema/helpers/get-compositions-to-render.js +19 -20
- package/dist/schema/helpers/get-discriminator-values.js +1 -2
- package/dist/schema/helpers/get-enum-values.js +1 -2
- package/dist/schema/helpers/get-property-description.js +1 -2
- package/dist/schema/helpers/get-ref-name.js +1 -2
- package/dist/schema/helpers/get-rendered-example.js +1 -2
- package/dist/schema/helpers/get-schema-type.js +1 -2
- package/dist/schema/helpers/get-type-signature-tokens.d.ts +2 -2
- package/dist/schema/helpers/get-type-signature-tokens.d.ts.map +1 -1
- package/dist/schema/helpers/get-type-signature-tokens.js +3 -4
- package/dist/schema/helpers/get-type-signature-tokens.js.map +1 -1
- package/dist/schema/helpers/has-complex-array-items.js +1 -2
- package/dist/schema/helpers/index.js +13 -13
- package/dist/schema/helpers/is-empty-schema-object.js +1 -2
- package/dist/schema/helpers/is-model-linkable.js +1 -2
- package/dist/schema/helpers/is-on-schema-target-path.js +1 -2
- package/dist/schema/helpers/is-type-object.js +1 -2
- package/dist/schema/helpers/merge-all-of-schemas.js +1 -2
- package/dist/schema/helpers/normalize-object-composition.js +1 -2
- package/dist/schema/helpers/optimize-value-for-display.js +1 -2
- package/dist/schema/helpers/partition-all-of-compositions.js +1 -2
- package/dist/schema/helpers/schema-composition.js +1 -2
- package/dist/schema/helpers/schema-cycle.js +1 -2
- package/dist/schema/helpers/schema-expansion.js +1 -2
- package/dist/schema/helpers/schema-keyboard-nav.js +1 -2
- package/dist/schema/helpers/schema-name.js +2 -3
- package/dist/schema/helpers/schema-name.js.map +1 -1
- package/dist/schema/helpers/should-display-description.js +1 -2
- package/dist/schema/helpers/should-display-heading.js +1 -2
- package/dist/schema/helpers/should-render-array-item-composition.js +1 -2
- package/dist/schema/helpers/sort-property-names.js +1 -2
- package/dist/schema/helpers/unwrap-for-read.js +1 -2
- package/dist/schema/index.js +8 -8
- package/dist/schema/localization/index.js +1 -2
- package/dist/schema/localization/locales/ar.js +1 -2
- package/dist/schema/localization/locales/de.js +1 -2
- package/dist/schema/localization/locales/en.js +1 -2
- package/dist/schema/localization/locales/es.js +1 -2
- package/dist/schema/localization/locales/fr.js +1 -2
- package/dist/schema/localization/locales/pt.js +1 -2
- package/dist/schema/localization/locales/ru.js +1 -2
- package/dist/schema/localization/locales/zh-cn.js +1 -2
- package/dist/schema/localization/locales/zh-tw.js +1 -2
- package/dist/schema/localization/translations.js +1 -2
- package/dist/schema/protobuf-metadata.js +1 -2
- package/dist/schema/recursive-metadata.js +1 -2
- package/dist/schema/request-body-composition-index.js +1 -2
- package/dist/shared/Badge.vue.d.ts.map +1 -1
- package/dist/shared/Badge.vue.js +4 -5
- package/dist/shared/Badge.vue.js.map +1 -1
- package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js +2 -3
- package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/shared/ExternalDocs.vue.js +1 -2
- package/dist/shared/ExternalDocs.vue.js.map +1 -1
- package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/shared/ScreenReader.vue.js +1 -2
- package/dist/shared/ScreenReader.vue.js.map +1 -1
- package/dist/shared/ScreenReader.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/shared/index.js +4 -4
- package/dist/specification-extensions/ExtensionValue.vue.js +1 -2
- package/dist/specification-extensions/ExtensionValue.vue.js.map +1 -1
- package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js +5 -6
- package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/specification-extensions/SpecificationExtensions.vue.js +1 -2
- package/dist/specification-extensions/SpecificationExtensions.vue.js.map +1 -1
- package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/style.css +40 -20
- package/dist/vue-styles.css +1 -1
- package/package.json +22 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaRailPanel.vue.js","names":["
|
|
1
|
+
{"version":3,"file":"SchemaRailPanel.vue.js","names":["SchemaRailPanel_vue_vue_type_script_setup_true_lang_default","SchemaRailPanel_default"],"sources":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createBlock as e, createCommentVNode as t, createElementBlock as n, defineComponent as r, normalizeStyle as i, onBeforeUnmount as a, openBlock as o, renderSlot as s, resolveDynamicComponent as c, withCtx as l, withModifiers as u } from "vue";
|
|
2
|
-
|
|
2
|
+
// src/schema/SchemaRailPanel.vue?vue&type=script&setup=true&lang.ts
|
|
3
3
|
var d = /*@__PURE__*/ r({
|
|
4
4
|
__name: "SchemaRailPanel",
|
|
5
5
|
props: {
|
|
@@ -43,7 +43,6 @@ var d = /*@__PURE__*/ r({
|
|
|
43
43
|
}, 8, ["style"]));
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
|
-
//#endregion
|
|
47
46
|
export { d as default };
|
|
48
47
|
|
|
49
48
|
//# sourceMappingURL=SchemaRailPanel.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaRailPanel.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_resolveDynamicComponent","_normalizeStyle","_withCtx","_createElementBlock","_withModifiers","
|
|
1
|
+
{"version":3,"file":"SchemaRailPanel.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_resolveDynamicComponent","_normalizeStyle","_withCtx","_createElementBlock","_withModifiers","_renderSlot","SchemaRailPanel_vue_vue_type_script_setup_true_lang_default","__emit","emit","hovered","clearRailHover","setRailHover","on","panel","event","row","onStripClick","onBeforeUnmount","openBlock","createBlock","resolveDynamicComponent","__props","normalizeStyle","withCtx","createElementBlock","withModifiers","_cache","$event","createCommentVNode","renderSlot","_ctx"],"sources":["../../src/schema/SchemaRailPanel.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { onBeforeUnmount, type Component } from 'vue'\n\n/**\n * The railed panel of the schema tree: an expanded row's children behind a rail\n * that fades with depth. See the indentation model in SchemaProperty.vue.\n *\n * `--schema-depth` must stay inline on the element itself: the `schema-rail`\n * utility reads it for the fade. No margins of its own, because each surface\n * that joins the tree spaces its panel differently.\n */\nconst {\n depth,\n closeOnRail = false,\n as = 'div',\n} = defineProps<{\n /** Nesting depth of the panel, driving how far the rail fades */\n depth: number\n /** Render the pointer strip over the rail that closes the panel on click */\n closeOnRail?: boolean\n /** Panel root element or component, so a headless-ui DisclosurePanel can keep the rail recipe */\n as?: string | Component\n}>()\n\nconst emit = defineEmits<{\n (e: 'close'): void\n}>()\n\n/**\n * A hovered strip colours this panel's rail and lights the puck of the control\n * that owns the panel. Both used to be `:has(... :hover)` selectors, which made\n * every railed row a `:has()` invalidation anchor, so each element inserted\n * under an open row restyled its whole subtree. The strip's pointer events now\n * write the same state as attributes that exist only while it is hovered:\n * `data-rail-hovered` on the panel root and `data-child-rail-hovered` on the\n * panel's parent, the element the tailwind.config.css variants look through to\n * the control. Read off DOM adjacency exactly like the selectors they replace,\n * so every surface that rails a panel is covered without wiring.\n */\nlet hovered: { panel: HTMLElement; row: HTMLElement | null } | null = null\n\nconst clearRailHover = (): void => {\n hovered?.panel.removeAttribute('data-rail-hovered')\n hovered?.row?.removeAttribute('data-child-rail-hovered')\n hovered = null\n}\n\nconst setRailHover = (event: Event, on: boolean): void => {\n clearRailHover()\n\n if (!on) {\n return\n }\n\n const panel =\n event.currentTarget instanceof HTMLElement\n ? event.currentTarget.parentElement\n : null\n\n if (!panel) {\n return\n }\n\n const row = panel.parentElement\n panel.setAttribute('data-rail-hovered', '')\n row?.setAttribute('data-child-rail-hovered', '')\n hovered = { panel, row }\n}\n\n/**\n * Folding the panel hides the strip under the pointer, so no pointerleave ever\n * follows the click: the marks go before the close, or the puck stays lit.\n */\nconst onStripClick = (): void => {\n clearRailHover()\n emit('close')\n}\n\n/* The strip also disappears without a pointerleave when the panel unmounts,\n and the parent row it marked outlives it. */\nonBeforeUnmount(clearRailHover)\n</script>\n<template>\n <component\n :is=\"as\"\n class=\"schema-rail-panel schema-rail rail-hover:border-s-c-1 relative ps-[var(--schema-gutter,16px)]\"\n :style=\"{ '--schema-depth': depth }\">\n <!-- Pointer-only strip along the rail that folds the panel; hidden from\n assistive tech because the row's own toggle is the accessible control. -->\n <div\n v-if=\"closeOnRail\"\n aria-hidden=\"true\"\n class=\"rail-hit z-[1]\"\n data-rail-hit\n @click.stop=\"onStripClick\"\n @pointerenter=\"setRailHover($event, true)\"\n @pointerleave=\"setRailHover($event, false)\" />\n <slot />\n </component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;EAwBA,IAAMU,IAAOD,GAeTE,IAAkE,MAEhEC,UAA6B;GAGjC,AAFAD,GAAS,MAAM,gBAAgB,mBAAmB,GAClDA,GAAS,KAAK,gBAAgB,yBAAyB,GACvD,IAAU;EACZ,GAEME,KAAgB,GAAc,MAAsB;GAGxD,IAFAD,EAAe,GAEX,CAACE,GACH;GAGF,IAAMC,IACJC,EAAM,yBAAyB,cAC3BA,EAAM,cAAc,gBACpB;GAEN,IAAI,CAACD,GACH;GAGF,IAAME,IAAMF,EAAM;GAGlB,AAFAA,EAAM,aAAa,qBAAqB,EAAE,GAC1CE,GAAK,aAAa,2BAA2B,EAAE,GAC/C,IAAU;IAAE;IAAO;GAAI;EACzB,GAMMC,UAA2B;GAE/B,AADAN,EAAe,GACfF,EAAK,OAAO;EACd;E,OAIAS,EAAgBP,CAAc,I,UAG5BZ,EAAA,GAAAC,EAeYC,EAdLqB,EAAA,EAAE,GAAA;GACP,OAAM;GACL,OAAKpB,EAAA,EAAA,kBAAsBoB,EAAA,MAAK,CAAA;;GAGjC,SAAAnB,QAOgD,CANxCmB,EAAA,eADRvB,EAAA,GAAAK,EAOgD,OAAA;;IAL9C,eAAY;IACZ,OAAM;IACN,iBAAA;IACC,SAAKC,EAAOY,GAAY,CAAA,MAAA,CAAA;IACxB,gBAAY,AAAAU,EAAA,QAAA,MAAEf,EAAagB,GAAM,EAAA;IACjC,gBAAY,AAAAD,EAAA,QAAA,MAAEf,EAAagB,GAAM,EAAA;G,2BACpCtB,EAAQyB,EAAA,QAAA,SAAA,C"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import e from "./CopyLinkButton.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
-
|
|
2
|
+
// src/schema/components/CopyLinkButton.vue
|
|
3
3
|
var t = e;
|
|
4
|
-
//#endregion
|
|
5
4
|
export { t as default };
|
|
6
5
|
|
|
7
6
|
//# sourceMappingURL=CopyLinkButton.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyLinkButton.vue.js","names":["
|
|
1
|
+
{"version":3,"file":"CopyLinkButton.vue.js","names":["CopyLinkButton_vue_vue_type_script_setup_true_lang_default","CopyLinkButton_default"],"sources":[],"mappings":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useLocalization as e } from "../localization/index.js";
|
|
2
2
|
import { computed as t, createElementBlock as n, createElementVNode as r, createTextVNode as i, createVNode as a, defineComponent as o, openBlock as s, renderSlot as c, toDisplayString as l, unref as u } from "vue";
|
|
3
3
|
import { ScalarIconHash as d } from "@scalar/icons";
|
|
4
|
-
|
|
4
|
+
// src/schema/components/CopyLinkButton.vue?vue&type=script&setup=true&lang.ts
|
|
5
5
|
var f = { class: "sr-only" }, p = /*@__PURE__*/ o({
|
|
6
6
|
__name: "CopyLinkButton",
|
|
7
7
|
props: {
|
|
@@ -20,7 +20,6 @@ var f = { class: "sr-only" }, p = /*@__PURE__*/ o({
|
|
|
20
20
|
}), r("span", f, [c(e.$slots, "sr-label", {}, () => [i(l(m.value), 1)])])]));
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
|
-
//#endregion
|
|
24
23
|
export { p as default };
|
|
25
24
|
|
|
26
25
|
//# sourceMappingURL=CopyLinkButton.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import e from "./WithBreadcrumb.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
-
|
|
2
|
+
// src/schema/components/WithBreadcrumb.vue
|
|
3
3
|
var t = e;
|
|
4
|
-
//#endregion
|
|
5
4
|
export { t as default };
|
|
6
5
|
|
|
7
6
|
//# sourceMappingURL=WithBreadcrumb.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithBreadcrumb.vue.js","names":["
|
|
1
|
+
{"version":3,"file":"WithBreadcrumb.vue.js","names":["WithBreadcrumb_vue_vue_type_script_setup_true_lang_default","WithBreadcrumb_default"],"sources":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createElementBlock as e, defineComponent as t, openBlock as n, renderSlot as r } from "vue";
|
|
2
|
-
|
|
2
|
+
// src/schema/components/WithBreadcrumb.vue?vue&type=script&setup=true&lang.ts
|
|
3
3
|
var i = ["id"], a = /*@__PURE__*/ t({
|
|
4
4
|
__name: "WithBreadcrumb",
|
|
5
5
|
props: { breadcrumb: {} },
|
|
@@ -12,7 +12,6 @@ var i = ["id"], a = /*@__PURE__*/ t({
|
|
|
12
12
|
}, [r(a.$slots, "default")], 8, i)) : r(a.$slots, "default", {}, void 0, void 0, 1);
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
-
//#endregion
|
|
16
15
|
export { a as default };
|
|
17
16
|
|
|
18
17
|
//# sourceMappingURL=WithBreadcrumb.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { inject as e } from "vue";
|
|
2
2
|
import { isDynamicRef as t, resolveDynamicRef as n } from "@scalar/workspace-store/helpers/dynamic-ref";
|
|
3
|
-
|
|
3
|
+
// src/schema/helpers/dynamic-scope.ts
|
|
4
4
|
var r = Symbol("schema-dynamic-scope"), i = [], a = () => e(r, i), o = (e, r) => t(e) ? n(e.$dynamicRef, r) ?? e : e;
|
|
5
|
-
//#endregion
|
|
6
5
|
export { r as SCHEMA_DYNAMIC_SCOPE_SYMBOL, o as resolveDynamicSchema, a as useDynamicScope };
|
|
7
6
|
|
|
8
7
|
//# sourceMappingURL=dynamic-scope.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/schema/helpers/format-example.ts
|
|
2
2
|
function e(e) {
|
|
3
3
|
let t = e.trim();
|
|
4
4
|
return t === "" ? e : t;
|
|
@@ -6,7 +6,6 @@ function e(e) {
|
|
|
6
6
|
function t(t) {
|
|
7
7
|
return Array.isArray(t) ? `[${t.map((t) => typeof t == "string" ? `"${e(t)}"` : typeof t == "object" ? JSON.stringify(t) : t === void 0 ? "undefined" : t === null ? "null" : t).join(", ")}]` : t === null ? "null" : typeof t == "object" ? JSON.stringify(t) : t === void 0 ? "undefined" : e(typeof t == "string" ? t : t.toString());
|
|
8
8
|
}
|
|
9
|
-
//#endregion
|
|
10
9
|
export { t as formatExample };
|
|
11
10
|
|
|
12
11
|
//# sourceMappingURL=format-example.js.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// src/schema/helpers/format-value.ts
|
|
2
2
|
function e(e) {
|
|
3
3
|
return Array.isArray(e) ? `[${e.map((e) => typeof e == "string" ? `"${e.toString().trim()}"` : typeof e == "object" ? JSON.stringify(e) : e === void 0 ? "undefined" : e === null ? "null" : e).join(", ")}]` : e === null ? "null" : typeof e == "object" ? JSON.stringify(e) : e === void 0 ? "undefined" : typeof e == "string" ? e.trim() : e.toString().trim();
|
|
4
4
|
}
|
|
5
|
-
//#endregion
|
|
6
5
|
export { e as formatValue };
|
|
7
6
|
|
|
8
7
|
//# sourceMappingURL=format-value.js.map
|
|
@@ -2,39 +2,38 @@ import { getRefName as e } from "./get-ref-name.js";
|
|
|
2
2
|
import { compositions as t } from "./schema-composition.js";
|
|
3
3
|
import { shouldRenderArrayItemComposition as n } from "./should-render-array-item-composition.js";
|
|
4
4
|
import { unwrapForRead as r } from "./unwrap-for-read.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
var c = (e) => e.startsWith("#/") || e.includes("/") ? e : `#/components/schemas/${e}`, l = (t, n,
|
|
5
|
+
import { resolve as i } from "@scalar/workspace-store/resolve";
|
|
6
|
+
import { isArraySchema as a } from "@scalar/workspace-store/schemas/v3.2/strict/type-guards";
|
|
7
|
+
import { isDefined as o } from "@scalar/helpers/array/is-defined";
|
|
8
|
+
import { unescapeJsonPointerSegment as s } from "@scalar/helpers/json/unescape-json-pointer-segment";
|
|
9
|
+
// src/schema/helpers/get-compositions-to-render.ts
|
|
10
|
+
var c = (e) => e.startsWith("#/") || e.includes("/") ? e : `#/components/schemas/${e}`, l = (t, n, a) => {
|
|
11
11
|
if (t.oneOf || t.anyOf) return null;
|
|
12
12
|
let l = t.discriminator?.mapping;
|
|
13
13
|
if (!l) return null;
|
|
14
14
|
let u = r(n);
|
|
15
15
|
if (!u?.components?.schemas) return null;
|
|
16
|
-
let d = (
|
|
17
|
-
let n = c(t), r = e(n),
|
|
18
|
-
if (
|
|
16
|
+
let d = (a ?? Object.values(l)).filter((e) => typeof e == "string").map((t) => {
|
|
17
|
+
let n = c(t), r = e(n), a = r ? i.schema(u.components?.schemas?.[s(r)]) : void 0;
|
|
18
|
+
if (a) return {
|
|
19
19
|
$ref: n,
|
|
20
|
-
"$ref-value":
|
|
20
|
+
"$ref-value": a
|
|
21
21
|
};
|
|
22
|
-
}).filter(
|
|
22
|
+
}).filter(o);
|
|
23
23
|
return d.length === 0 ? null : {
|
|
24
|
-
...
|
|
24
|
+
...i.schema(t),
|
|
25
25
|
oneOf: d
|
|
26
26
|
};
|
|
27
|
-
}, u = (e, r,
|
|
27
|
+
}, u = (e, r, s = e ? l(e, r) : null) => e ? t.map((t) => t === "oneOf" && s ? {
|
|
28
28
|
composition: t,
|
|
29
|
-
value:
|
|
30
|
-
} : n(e, t) &&
|
|
29
|
+
value: s
|
|
30
|
+
} : n(e, t) && a(e) && e.items ? {
|
|
31
31
|
composition: t,
|
|
32
|
-
value:
|
|
33
|
-
} : e[t] && !(
|
|
32
|
+
value: i.schema(e.items)
|
|
33
|
+
} : e[t] && !(a(e) && e.items && typeof e.items == "object" && t in e.items) ? {
|
|
34
34
|
composition: t,
|
|
35
|
-
value:
|
|
36
|
-
} : null).filter(
|
|
37
|
-
//#endregion
|
|
35
|
+
value: i.schema(e)
|
|
36
|
+
} : null).filter(o) : [];
|
|
38
37
|
export { u as getCompositionsToRender, l as inferDiscriminatorMappingComposition };
|
|
39
38
|
|
|
40
39
|
//# sourceMappingURL=get-compositions-to-render.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// src/schema/helpers/get-discriminator-values.ts
|
|
2
2
|
var e = (e, t) => !e || !t ? [] : Object.entries(t).filter(([, t]) => t === e || `#/components/schemas/${t}` === e).map(([e]) => e);
|
|
3
|
-
//#endregion
|
|
4
3
|
export { e as getDiscriminatorValues };
|
|
5
4
|
|
|
6
5
|
//# sourceMappingURL=get-discriminator-values.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolve as e } from "@scalar/workspace-store/resolve";
|
|
2
2
|
import { isArraySchema as t } from "@scalar/workspace-store/schemas/v3.2/strict/type-guards";
|
|
3
|
-
|
|
3
|
+
// src/schema/helpers/get-enum-values.ts
|
|
4
4
|
var n = (n) => {
|
|
5
5
|
if (!n) return [];
|
|
6
6
|
if (n.enum) return n.enum;
|
|
@@ -10,7 +10,6 @@ var n = (n) => {
|
|
|
10
10
|
}
|
|
11
11
|
return [];
|
|
12
12
|
};
|
|
13
|
-
//#endregion
|
|
14
13
|
export { n as getEnumValues };
|
|
15
14
|
|
|
16
15
|
//# sourceMappingURL=get-enum-values.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isSchema as e } from "@scalar/workspace-store/schemas/v3.2/strict/type-guards";
|
|
2
|
-
|
|
2
|
+
// src/schema/helpers/get-property-description.ts
|
|
3
3
|
var t = {
|
|
4
4
|
integer: {
|
|
5
5
|
_default: "schema.typeInteger",
|
|
@@ -21,7 +21,6 @@ var t = {
|
|
|
21
21
|
let i = t[r];
|
|
22
22
|
return i ? i["format" in n && n.format || "contentEncoding" in n && n.contentEncoding || "_default"] ?? null : null;
|
|
23
23
|
};
|
|
24
|
-
//#endregion
|
|
25
24
|
export { n as getPropertyDescriptionKey };
|
|
26
25
|
|
|
27
26
|
//# sourceMappingURL=get-property-description.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { REGEX as e } from "@scalar/helpers/regex/regex-helpers";
|
|
2
|
-
|
|
2
|
+
// src/schema/helpers/get-ref-name.ts
|
|
3
3
|
var t = (t) => {
|
|
4
4
|
if (!t) return null;
|
|
5
5
|
let n = t.match(e.REF_NAME);
|
|
@@ -9,7 +9,6 @@ var t = (t) => {
|
|
|
9
9
|
let t = e.match(n);
|
|
10
10
|
return t?.[1] ? decodeURIComponent(t[1]) : null;
|
|
11
11
|
};
|
|
12
|
-
//#endregion
|
|
13
12
|
export { t as getRefName, r as getSchemaRefName };
|
|
14
13
|
|
|
15
14
|
//# sourceMappingURL=get-ref-name.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isObjectLike as e } from "@scalar/helpers/object/is-object";
|
|
2
2
|
import { getExampleValue as t } from "@scalar/workspace-store/helpers/get-example-value";
|
|
3
3
|
import { getResolvedRef as n } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
4
|
-
|
|
4
|
+
// src/schema/helpers/get-rendered-example.ts
|
|
5
5
|
var r = Symbol("rendered-example"), i = (t) => {
|
|
6
6
|
let r = /* @__PURE__ */ new Set(), i = t;
|
|
7
7
|
for (; e(i) && !r.has(i);) {
|
|
@@ -39,7 +39,6 @@ var r = Symbol("rendered-example"), i = (t) => {
|
|
|
39
39
|
value: i
|
|
40
40
|
}] : [];
|
|
41
41
|
}) : [];
|
|
42
|
-
//#endregion
|
|
43
42
|
export { i as getExampleSummary, a as getRenderedExample, o as normalizeRenderedExamples };
|
|
44
43
|
|
|
45
44
|
//# sourceMappingURL=get-rendered-example.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolve as e } from "@scalar/workspace-store/resolve";
|
|
2
2
|
import { isArraySchema as t } from "@scalar/workspace-store/schemas/v3.2/strict/type-guards";
|
|
3
|
-
|
|
3
|
+
// src/schema/helpers/get-schema-type.ts
|
|
4
4
|
var n = (e) => e ? `array ${e.includes(" | ") ? `(${e})` : e}[]` : "array", r = (t, r = !1) => {
|
|
5
5
|
if (!t.items) return "array";
|
|
6
6
|
let a = n(i(e.schema(t.items)));
|
|
@@ -18,7 +18,6 @@ var n = (e) => e ? `array ${e.includes(" | ") ? `(${e})` : e}[]` : "array", r =
|
|
|
18
18
|
}
|
|
19
19
|
return t(i) ? r(i, !1) : "type" in i && i.type && i.contentEncoding ? `${i.type} • ${i.contentEncoding}` : "type" in i ? i.type : "";
|
|
20
20
|
};
|
|
21
|
-
//#endregion
|
|
22
21
|
export { i as getSchemaType };
|
|
23
22
|
|
|
24
23
|
//# sourceMappingURL=get-schema-type.js.map
|
|
@@ -37,8 +37,8 @@ export declare const getTypeSignatureTokens: (valueOrRef: SchemaObject | Referen
|
|
|
37
37
|
*
|
|
38
38
|
* A `$ref` renders as the raw component key while the heading link and the
|
|
39
39
|
* models section show the target's `title`; the caller's name keeps them in
|
|
40
|
-
* agreement.
|
|
41
|
-
*
|
|
40
|
+
* agreement. Inline object titles can name array items too; inline primitive
|
|
41
|
+
* tokens keep their real type (`integer`), rather than their `title`.
|
|
42
42
|
*/
|
|
43
43
|
export declare const getDisplayTypeSignatureTokens: (valueOrRef: SchemaObject | ReferenceType<SchemaObject> | undefined, options?: {
|
|
44
44
|
hideModelNames?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-type-signature-tokens.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/get-type-signature-tokens.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAI/G;;;;;GAKG;AACH,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,CAAA;IAClD,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AA+BD;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GACnC,YAAY,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG,SAAS,EAClE,UAAS;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO;AAC1C,mFAAmF;AACnF,iBAAe,KACd,OA2DF,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GACjC,YAAY,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG,SAAS,EAClE,UAAS;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,EAC1C,cAAS,KACR,kBAAkB,EA8DpB,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B,GACxC,YAAY,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG,SAAS,EAClE,UAAS;IAAE,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,KACpE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"get-type-signature-tokens.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/get-type-signature-tokens.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAI/G;;;;;GAKG;AACH,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,CAAA;IAClD,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AA+BD;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GACnC,YAAY,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG,SAAS,EAClE,UAAS;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO;AAC1C,mFAAmF;AACnF,iBAAe,KACd,OA2DF,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GACjC,YAAY,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG,SAAS,EAClE,UAAS;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,EAC1C,cAAS,KACR,kBAAkB,EA8DpB,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B,GACxC,YAAY,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG,SAAS,EAClE,UAAS;IAAE,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,KACpE,kBAAkB,EA2DpB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getRefName as e } from "./get-ref-name.js";
|
|
2
2
|
import { getResolvedRef as t } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
3
3
|
import { resolve as n } from "@scalar/workspace-store/resolve";
|
|
4
|
-
|
|
4
|
+
// src/schema/helpers/get-type-signature-tokens.ts
|
|
5
5
|
var r = 3, i = [
|
|
6
6
|
"x-enumDescriptions",
|
|
7
7
|
"x-enum-descriptions",
|
|
@@ -44,8 +44,8 @@ var r = 3, i = [
|
|
|
44
44
|
if (t.hideModelNames || !r) return n;
|
|
45
45
|
let i = (e) => !!e && typeof e == "object" && "$ref" in e;
|
|
46
46
|
if (n.length === 0 || n.length === 1 && n[0]?.text === "object" || i(e) && n.length === 1 && n[0]?.kind === "ident" && n[0]?.text !== r) return [s(r)];
|
|
47
|
-
let a = e && typeof e == "object" && "items" in e ? e.items : void 0, o = n[0], c = n[1];
|
|
48
|
-
if (i(a) && n.length === 2 && o?.kind === "word" && c?.kind === "ident" && r.endsWith("[]")) {
|
|
47
|
+
let a = e && typeof e == "object" && "items" in e ? e.items : void 0, o = n[0], c = n[1], l = a && typeof a == "object" && "type" in a && a.type === "object" && "title" in a && typeof a.title == "string";
|
|
48
|
+
if ((i(a) || l) && n.length === 2 && o?.kind === "word" && c?.kind === "ident" && r.endsWith("[]")) {
|
|
49
49
|
let e = r.slice(0, -2);
|
|
50
50
|
if (e && e !== c.text) return [o, s(e)];
|
|
51
51
|
}
|
|
@@ -56,7 +56,6 @@ var r = 3, i = [
|
|
|
56
56
|
let i = f(r, t, n + 1);
|
|
57
57
|
return i.length === 0 ? [s("array")] : [o("array of"), ...i];
|
|
58
58
|
};
|
|
59
|
-
//#endregion
|
|
60
59
|
export { p as getDisplayTypeSignatureTokens, f as getTypeSignatureTokens, d as typeSignatureInlinesEnum };
|
|
61
60
|
|
|
62
61
|
//# sourceMappingURL=get-type-signature-tokens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-type-signature-tokens.js","names":["INLINE_ENUM_LIMIT","ENUM_ANNOTATION_KEYS","formatLiteral","value","word","ident","literal","pipe","joinTokens","lists","index","tokens","separator","typeSignatureInlinesEnum","valueOrRef","options","getRefName","resolve","getResolvedRef","key","isItems","type","isArrayType","items","getTypeSignatureTokens","refName","entry","arrayTokens","depth","getDisplayTypeSignatureTokens","computedTokens","modelName","isRef","arrayWord","itemToken","itemName","MAX_ARRAY_DEPTH","itemTokens"],"sources":["../../../src/schema/helpers/get-type-signature-tokens.ts"],"sourcesContent":["import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { ReferenceType, SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport { getRefName } from './get-ref-name'\n\n/**\n * One run of a type signature. `word` is English describing a shape (`array of`,\n * `or`) in the sans face; `ident` is something the reader would type (a model\n * name, a type keyword) in the code face; `literal` is an enum or const value\n * quoted as JSON; `punctuation` is the muted `|` between union members.\n */\ntype TypeSignatureToken = {\n kind: 'word' | 'ident' | 'literal' | 'punctuation'\n text: string\n}\n\n/** Enums up to this many values render inline in the type position. */\nconst INLINE_ENUM_LIMIT = 3\n\n/** Extensions that attach meaning to individual enum values. */\nconst ENUM_ANNOTATION_KEYS = ['x-enumDescriptions', 'x-enum-descriptions', 'x-enum-varnames', 'x-enumNames'] as const\n\n/** Quote an enum or const value the way JSON would. */\nconst formatLiteral = (value: unknown): string => {\n // Objects and arrays have no meaningful String() form (`[object Object]`), so\n // serialize them the way JSON would; primitives keep their existing rendering.\n if (value !== null && typeof value === 'object') {\n return JSON.stringify(value)\n }\n\n return typeof value === 'string' ? `\"${value}\"` : String(value)\n}\n\nconst word = (text: string): TypeSignatureToken => ({ kind: 'word', text })\nconst ident = (text: string): TypeSignatureToken => ({ kind: 'ident', text })\nconst literal = (text: string): TypeSignatureToken => ({\n kind: 'literal',\n text,\n})\nconst pipe = (): TypeSignatureToken => ({ kind: 'punctuation', text: '|' })\n\n/** Join token lists with a separator token, like Array.prototype.join. */\nconst joinTokens = (lists: TypeSignatureToken[][], separator: () => TypeSignatureToken[]): TypeSignatureToken[] =>\n lists.flatMap((tokens, index) => (index === 0 ? tokens : [...separator(), ...tokens]))\n\n/**\n * Whether the signature will actually render this schema's enum values inline.\n * SchemaProperty drops the separate value list for short enums on that\n * assumption, so it must be checked: a `$ref` renders as the model name before\n * reaching the enum branch, and a schema with no `type` renders no type detail,\n * so in both cases the values would otherwise be shown nowhere.\n */\nexport const typeSignatureInlinesEnum = (\n valueOrRef: SchemaObject | ReferenceType<SchemaObject> | undefined,\n options: { hideModelNames?: boolean } = {},\n /** Set when recursing into an array's items, which need no `type` of their own. */\n isItems = false,\n): boolean => {\n if (!valueOrRef || typeof valueOrRef !== 'object') {\n return false\n }\n\n // A named $ref returns the model name before ever reaching the enum branch.\n if (\n '$ref' in valueOrRef &&\n typeof valueOrRef.$ref === 'string' &&\n !options.hideModelNames &&\n getRefName(valueOrRef.$ref)\n ) {\n return false\n }\n\n // Display normalization can retain $ref alongside its resolved fields without\n // $ref-value. The structural view keeps those fields when names are hidden.\n const value = options.hideModelNames ? resolve.schema(valueOrRef) : getResolvedRef(valueOrRef)\n\n if (!value || typeof value !== 'object' || value.const !== undefined) {\n return false\n }\n\n // Bare literals cannot carry `x-enumDescriptions` or `x-enum-varnames`, so an\n // annotated enum keeps its value list (SchemaEnums' chip branch does the same).\n const annotated = ENUM_ANNOTATION_KEYS.some((key) => value[key])\n\n // getTypeSignatureTokens checks the schema's own enum right after const —\n // before any `type` handling — so a short, unannotated enum inlines whether or\n // not the schema has a `type`, and even when the type is `array` (e.g. a\n // schema carrying both `enum` and `type: array`). Mirror that order here, or\n // the value list renders a second copy of the same values.\n if (!annotated && Array.isArray(value.enum) && value.enum.length > 0 && value.enum.length <= INLINE_ENUM_LIMIT) {\n return true\n }\n\n // Past the enum branch, a schema with no `type` renders no signature to carry\n // the values. Items are exempt: the array signature's enum branch needs no\n // `type` of its own.\n if (!isItems && !('type' in value)) {\n return false\n }\n\n const type = 'type' in value ? value.type : undefined\n\n // `type: ['array', 'null']` takes the union branch, which still recurses into\n // items, so it inlines the item enum exactly like a plain array.\n const isArrayType = type === 'array' || (Array.isArray(type) && type.includes('array'))\n\n // An array with no own enum inlines its ITEMS' enum, resolved the same way\n // getEnumValues does, so the items must be tested here or the values render\n // twice.\n const items = 'items' in value ? value.items : undefined\n\n if (isArrayType && items && typeof items === 'object') {\n return typeSignatureInlinesEnum(items as SchemaObject, options, true)\n }\n\n return false\n}\n\n/**\n * Compute the type signature of a schema as token runs: `array Planet[]` becomes\n * `array of Planet`, where \"array of\" is English and `Planet` stays an\n * identifier. Short enums render inline (`\"standard\" or \"enterprise\"`) because\n * two values are a type, not a list worth its own rows. A `$ref` to a named\n * model renders as the model name itself.\n */\nexport const getTypeSignatureTokens = (\n valueOrRef: SchemaObject | ReferenceType<SchemaObject> | undefined,\n options: { hideModelNames?: boolean } = {},\n depth = 0,\n): TypeSignatureToken[] => {\n if (!valueOrRef || typeof valueOrRef !== 'object') {\n return []\n }\n\n // A $ref to a named model: the name is the type.\n if ('$ref' in valueOrRef && typeof valueOrRef.$ref === 'string') {\n const refName = options.hideModelNames ? null : getRefName(valueOrRef.$ref)\n\n if (refName) {\n return [ident(refName)]\n }\n }\n\n // Display normalization can retain $ref alongside its resolved fields without\n // $ref-value. The structural view keeps those fields when names are hidden.\n const value = options.hideModelNames ? resolve.schema(valueOrRef) : getResolvedRef(valueOrRef)\n\n if (!value || typeof value !== 'object') {\n return []\n }\n\n // const renders as its value, not as the word \"const\".\n if (value.const !== undefined) {\n return [literal(formatLiteral(value.const))]\n }\n\n // A short enum is the type, inline, unless its values carry descriptions or\n // names, which only the value list can show.\n if (\n Array.isArray(value.enum) &&\n value.enum.length > 0 &&\n value.enum.length <= INLINE_ENUM_LIMIT &&\n !ENUM_ANNOTATION_KEYS.some((key) => value[key])\n ) {\n return joinTokens(\n value.enum.map((entry) => [literal(formatLiteral(entry))]),\n () => [word('or')],\n )\n }\n\n // Union types: string | null with the pipe muted.\n if ('type' in value && Array.isArray(value.type)) {\n return joinTokens(\n value.type.map((entry) => (entry === 'array' ? arrayTokens(value, options, depth) : [ident(String(entry))])),\n () => [pipe()],\n )\n }\n\n if ('type' in value && value.type === 'array') {\n return arrayTokens(value, options, depth)\n }\n\n if ('type' in value && value.type && value.contentEncoding) {\n return [ident(String(value.type)), word('•'), ident(value.contentEncoding)]\n }\n\n if ('type' in value && value.type) {\n return [ident(String(value.type))]\n }\n\n return []\n}\n\n/**\n * The tokens a row shows: the raw signature, renamed to the caller's resolved\n * model name where the two would disagree.\n *\n * A `$ref` renders as the raw component key while the heading link and the\n * models section show the target's `title`; the caller's name keeps them in\n * agreement. Only a `$ref` may be renamed: an inline schema's\n * single token is its real type (`integer`), not its `title`.\n */\nexport const getDisplayTypeSignatureTokens = (\n valueOrRef: SchemaObject | ReferenceType<SchemaObject> | undefined,\n options: { hideModelNames?: boolean; modelName?: string | null } = {},\n): TypeSignatureToken[] => {\n const computedTokens = getTypeSignatureTokens(valueOrRef, { hideModelNames: options.hideModelNames })\n const modelName = options.modelName\n\n if (options.hideModelNames || !modelName) {\n return computedTokens\n }\n\n const isRef = (value: unknown): boolean => !!value && typeof value === 'object' && '$ref' in value\n\n // Nothing to render, or a bare `object` that the name describes better.\n if (computedTokens.length === 0 || (computedTokens.length === 1 && computedTokens[0]?.text === 'object')) {\n return [ident(modelName)]\n }\n\n // A direct `$ref`: the single identifier IS the raw key.\n if (\n isRef(valueOrRef) &&\n computedTokens.length === 1 &&\n computedTokens[0]?.kind === 'ident' &&\n computedTokens[0]?.text !== modelName\n ) {\n return [ident(modelName)]\n }\n\n /*\n * An array of a `$ref` keeps its \"array of\" word and renames only the item.\n * Only a caller name with a trailing `[]` describes the ITEM; the caller also\n * reports the array's OWN name here (a `$ref` to `FilterList`, an inline\n * `title` of `Planets`), and using that would claim each element is one.\n */\n const items = valueOrRef && typeof valueOrRef === 'object' && 'items' in valueOrRef ? valueOrRef.items : undefined\n\n const arrayWord = computedTokens[0]\n const itemToken = computedTokens[1]\n\n if (isRef(items) && computedTokens.length === 2 && arrayWord?.kind === 'word' && itemToken?.kind === 'ident') {\n if (modelName.endsWith('[]')) {\n const itemName = modelName.slice(0, -2)\n\n if (itemName && itemName !== itemToken.text) {\n return [arrayWord, ident(itemName)]\n }\n }\n }\n\n return computedTokens\n}\n\n/** Guard against a pathological items chain; deeper than this reads as noise anyway. */\nconst MAX_ARRAY_DEPTH = 8\n\nconst arrayTokens = (\n value: SchemaObject,\n options: { hideModelNames?: boolean },\n depth: number,\n): TypeSignatureToken[] => {\n const items = 'items' in value ? value.items : undefined\n\n if (!items || depth >= MAX_ARRAY_DEPTH) {\n return [ident('array')]\n }\n\n const itemTokens = getTypeSignatureTokens(items as SchemaObject | ReferenceType<SchemaObject>, options, depth + 1)\n\n if (itemTokens.length === 0) {\n return [ident('array')]\n }\n\n return [word('array of'), ...itemTokens]\n}\n"],"mappings":";;;;AAkBA,IAAMA,IAAoB,GAGpBC,IAAuB;CAAC;CAAsB;CAAuB;CAAmB;AAAa,GAGrGC,KAAiB,MAGC,OAAOC,KAAU,YAAnCA,IACK,KAAK,UAAUA,CAAK,IAGtB,OAAOA,KAAU,WAAW,IAAIA,EAAM,KAAK,OAAOA,CAAK,GAG1DC,KAAQ,OAAsC;CAAE,MAAM;CAAQ;AAAK,IACnEC,KAAS,OAAsC;CAAE,MAAM;CAAS;AAAK,IACrEC,KAAW,OAAsC;CACrD,MAAM;CACN;AACF,IACMC,WAAkC;CAAE,MAAM;CAAe,MAAM;AAAI,IAGnEC,KAAc,GAA+B,MACjDC,EAAM,SAAS,GAAQ,MAAWC,MAAU,IAAIC,IAAS,CAAC,GAAGC,EAAU,GAAG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AC1BA,EAAe,EAAE,EAAE,SAAS,WAC5BA,EAAe,EAAE,EAAE,SAASC,GAE5B,OAAO,CAAC1B,EAAM0B,CAAS,CAAC;CAS1B,IAAMR,IAAQT,KAAc,OAAOA,KAAe,YAAY,WAAWA,IAAaA,EAAW,QAAQ,KAAA,GAEnGmB,IAAYH,EAAe,IAC3BI,IAAYJ,EAAe;CAEjC,IAAIE,EAAMT,CAAK,KAAKO,EAAe,WAAW,KAAKG,GAAW,SAAS,UAAUC,GAAW,SAAS,WAC/FH,EAAU,SAAS,IAAI,GAAG;EAC5B,IAAMI,IAAWJ,EAAU,MAAM,GAAG,EAAE;EAEtC,IAAII,KAAYA,MAAaD,EAAU,MACrC,OAAO,CAACD,GAAW5B,EAAM8B,CAAQ,CAAC;CAEtC;CAGF,OAAOL;AACT,GAGMM,IAAkB,GAElBT,KACJ,GACA,GACA,MACyB;CACzB,IAAMJ,IAAQ,WAAWpB,IAAQA,EAAM,QAAQ,KAAA;CAE/C,IAAI,CAACoB,KAASK,KAASQ,GACrB,OAAO,CAAC/B,EAAM,OAAO,CAAC;CAGxB,IAAMgC,IAAab,EAAuBD,GAAqDR,GAASa,IAAQ,CAAC;CAMjH,OAJIS,EAAW,WAAW,IACjB,CAAChC,EAAM,OAAO,CAAC,IAGjB,CAACD,EAAK,UAAU,GAAG,GAAGiC,CAAU;AACzC"}
|
|
1
|
+
{"version":3,"file":"get-type-signature-tokens.js","names":["INLINE_ENUM_LIMIT","ENUM_ANNOTATION_KEYS","formatLiteral","value","word","ident","literal","pipe","joinTokens","lists","index","tokens","separator","typeSignatureInlinesEnum","valueOrRef","options","getRefName","resolve","getResolvedRef","key","isItems","type","isArrayType","items","getTypeSignatureTokens","refName","entry","arrayTokens","depth","getDisplayTypeSignatureTokens","computedTokens","modelName","isRef","arrayWord","itemToken","namedObjectItems","itemName","MAX_ARRAY_DEPTH","itemTokens"],"sources":["../../../src/schema/helpers/get-type-signature-tokens.ts"],"sourcesContent":["import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { ReferenceType, SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport { getRefName } from './get-ref-name'\n\n/**\n * One run of a type signature. `word` is English describing a shape (`array of`,\n * `or`) in the sans face; `ident` is something the reader would type (a model\n * name, a type keyword) in the code face; `literal` is an enum or const value\n * quoted as JSON; `punctuation` is the muted `|` between union members.\n */\ntype TypeSignatureToken = {\n kind: 'word' | 'ident' | 'literal' | 'punctuation'\n text: string\n}\n\n/** Enums up to this many values render inline in the type position. */\nconst INLINE_ENUM_LIMIT = 3\n\n/** Extensions that attach meaning to individual enum values. */\nconst ENUM_ANNOTATION_KEYS = ['x-enumDescriptions', 'x-enum-descriptions', 'x-enum-varnames', 'x-enumNames'] as const\n\n/** Quote an enum or const value the way JSON would. */\nconst formatLiteral = (value: unknown): string => {\n // Objects and arrays have no meaningful String() form (`[object Object]`), so\n // serialize them the way JSON would; primitives keep their existing rendering.\n if (value !== null && typeof value === 'object') {\n return JSON.stringify(value)\n }\n\n return typeof value === 'string' ? `\"${value}\"` : String(value)\n}\n\nconst word = (text: string): TypeSignatureToken => ({ kind: 'word', text })\nconst ident = (text: string): TypeSignatureToken => ({ kind: 'ident', text })\nconst literal = (text: string): TypeSignatureToken => ({\n kind: 'literal',\n text,\n})\nconst pipe = (): TypeSignatureToken => ({ kind: 'punctuation', text: '|' })\n\n/** Join token lists with a separator token, like Array.prototype.join. */\nconst joinTokens = (lists: TypeSignatureToken[][], separator: () => TypeSignatureToken[]): TypeSignatureToken[] =>\n lists.flatMap((tokens, index) => (index === 0 ? tokens : [...separator(), ...tokens]))\n\n/**\n * Whether the signature will actually render this schema's enum values inline.\n * SchemaProperty drops the separate value list for short enums on that\n * assumption, so it must be checked: a `$ref` renders as the model name before\n * reaching the enum branch, and a schema with no `type` renders no type detail,\n * so in both cases the values would otherwise be shown nowhere.\n */\nexport const typeSignatureInlinesEnum = (\n valueOrRef: SchemaObject | ReferenceType<SchemaObject> | undefined,\n options: { hideModelNames?: boolean } = {},\n /** Set when recursing into an array's items, which need no `type` of their own. */\n isItems = false,\n): boolean => {\n if (!valueOrRef || typeof valueOrRef !== 'object') {\n return false\n }\n\n // A named $ref returns the model name before ever reaching the enum branch.\n if (\n '$ref' in valueOrRef &&\n typeof valueOrRef.$ref === 'string' &&\n !options.hideModelNames &&\n getRefName(valueOrRef.$ref)\n ) {\n return false\n }\n\n // Display normalization can retain $ref alongside its resolved fields without\n // $ref-value. The structural view keeps those fields when names are hidden.\n const value = options.hideModelNames ? resolve.schema(valueOrRef) : getResolvedRef(valueOrRef)\n\n if (!value || typeof value !== 'object' || value.const !== undefined) {\n return false\n }\n\n // Bare literals cannot carry `x-enumDescriptions` or `x-enum-varnames`, so an\n // annotated enum keeps its value list (SchemaEnums' chip branch does the same).\n const annotated = ENUM_ANNOTATION_KEYS.some((key) => value[key])\n\n // getTypeSignatureTokens checks the schema's own enum right after const —\n // before any `type` handling — so a short, unannotated enum inlines whether or\n // not the schema has a `type`, and even when the type is `array` (e.g. a\n // schema carrying both `enum` and `type: array`). Mirror that order here, or\n // the value list renders a second copy of the same values.\n if (!annotated && Array.isArray(value.enum) && value.enum.length > 0 && value.enum.length <= INLINE_ENUM_LIMIT) {\n return true\n }\n\n // Past the enum branch, a schema with no `type` renders no signature to carry\n // the values. Items are exempt: the array signature's enum branch needs no\n // `type` of its own.\n if (!isItems && !('type' in value)) {\n return false\n }\n\n const type = 'type' in value ? value.type : undefined\n\n // `type: ['array', 'null']` takes the union branch, which still recurses into\n // items, so it inlines the item enum exactly like a plain array.\n const isArrayType = type === 'array' || (Array.isArray(type) && type.includes('array'))\n\n // An array with no own enum inlines its ITEMS' enum, resolved the same way\n // getEnumValues does, so the items must be tested here or the values render\n // twice.\n const items = 'items' in value ? value.items : undefined\n\n if (isArrayType && items && typeof items === 'object') {\n return typeSignatureInlinesEnum(items as SchemaObject, options, true)\n }\n\n return false\n}\n\n/**\n * Compute the type signature of a schema as token runs: `array Planet[]` becomes\n * `array of Planet`, where \"array of\" is English and `Planet` stays an\n * identifier. Short enums render inline (`\"standard\" or \"enterprise\"`) because\n * two values are a type, not a list worth its own rows. A `$ref` to a named\n * model renders as the model name itself.\n */\nexport const getTypeSignatureTokens = (\n valueOrRef: SchemaObject | ReferenceType<SchemaObject> | undefined,\n options: { hideModelNames?: boolean } = {},\n depth = 0,\n): TypeSignatureToken[] => {\n if (!valueOrRef || typeof valueOrRef !== 'object') {\n return []\n }\n\n // A $ref to a named model: the name is the type.\n if ('$ref' in valueOrRef && typeof valueOrRef.$ref === 'string') {\n const refName = options.hideModelNames ? null : getRefName(valueOrRef.$ref)\n\n if (refName) {\n return [ident(refName)]\n }\n }\n\n // Display normalization can retain $ref alongside its resolved fields without\n // $ref-value. The structural view keeps those fields when names are hidden.\n const value = options.hideModelNames ? resolve.schema(valueOrRef) : getResolvedRef(valueOrRef)\n\n if (!value || typeof value !== 'object') {\n return []\n }\n\n // const renders as its value, not as the word \"const\".\n if (value.const !== undefined) {\n return [literal(formatLiteral(value.const))]\n }\n\n // A short enum is the type, inline, unless its values carry descriptions or\n // names, which only the value list can show.\n if (\n Array.isArray(value.enum) &&\n value.enum.length > 0 &&\n value.enum.length <= INLINE_ENUM_LIMIT &&\n !ENUM_ANNOTATION_KEYS.some((key) => value[key])\n ) {\n return joinTokens(\n value.enum.map((entry) => [literal(formatLiteral(entry))]),\n () => [word('or')],\n )\n }\n\n // Union types: string | null with the pipe muted.\n if ('type' in value && Array.isArray(value.type)) {\n return joinTokens(\n value.type.map((entry) => (entry === 'array' ? arrayTokens(value, options, depth) : [ident(String(entry))])),\n () => [pipe()],\n )\n }\n\n if ('type' in value && value.type === 'array') {\n return arrayTokens(value, options, depth)\n }\n\n if ('type' in value && value.type && value.contentEncoding) {\n return [ident(String(value.type)), word('•'), ident(value.contentEncoding)]\n }\n\n if ('type' in value && value.type) {\n return [ident(String(value.type))]\n }\n\n return []\n}\n\n/**\n * The tokens a row shows: the raw signature, renamed to the caller's resolved\n * model name where the two would disagree.\n *\n * A `$ref` renders as the raw component key while the heading link and the\n * models section show the target's `title`; the caller's name keeps them in\n * agreement. Inline object titles can name array items too; inline primitive\n * tokens keep their real type (`integer`), rather than their `title`.\n */\nexport const getDisplayTypeSignatureTokens = (\n valueOrRef: SchemaObject | ReferenceType<SchemaObject> | undefined,\n options: { hideModelNames?: boolean; modelName?: string | null } = {},\n): TypeSignatureToken[] => {\n const computedTokens = getTypeSignatureTokens(valueOrRef, { hideModelNames: options.hideModelNames })\n const modelName = options.modelName\n\n if (options.hideModelNames || !modelName) {\n return computedTokens\n }\n\n const isRef = (value: unknown): boolean => !!value && typeof value === 'object' && '$ref' in value\n\n // Nothing to render, or a bare `object` that the name describes better.\n if (computedTokens.length === 0 || (computedTokens.length === 1 && computedTokens[0]?.text === 'object')) {\n return [ident(modelName)]\n }\n\n // A direct `$ref`: the single identifier IS the raw key.\n if (\n isRef(valueOrRef) &&\n computedTokens.length === 1 &&\n computedTokens[0]?.kind === 'ident' &&\n computedTokens[0]?.text !== modelName\n ) {\n return [ident(modelName)]\n }\n\n /*\n * An array of a named object keeps its \"array of\" word and renames only the item.\n * Only a caller name with a trailing `[]` describes the ITEM; the caller also\n * reports the array's OWN name here (a `$ref` to `FilterList`, an inline\n * `title` of `Planets`), and using that would claim each element is one.\n */\n const items = valueOrRef && typeof valueOrRef === 'object' && 'items' in valueOrRef ? valueOrRef.items : undefined\n\n const arrayWord = computedTokens[0]\n const itemToken = computedTokens[1]\n\n const namedObjectItems =\n items &&\n typeof items === 'object' &&\n 'type' in items &&\n items.type === 'object' &&\n 'title' in items &&\n typeof items.title === 'string'\n if (\n (isRef(items) || namedObjectItems) &&\n computedTokens.length === 2 &&\n arrayWord?.kind === 'word' &&\n itemToken?.kind === 'ident'\n ) {\n if (modelName.endsWith('[]')) {\n const itemName = modelName.slice(0, -2)\n\n if (itemName && itemName !== itemToken.text) {\n return [arrayWord, ident(itemName)]\n }\n }\n }\n\n return computedTokens\n}\n\n/** Guard against a pathological items chain; deeper than this reads as noise anyway. */\nconst MAX_ARRAY_DEPTH = 8\n\nconst arrayTokens = (\n value: SchemaObject,\n options: { hideModelNames?: boolean },\n depth: number,\n): TypeSignatureToken[] => {\n const items = 'items' in value ? value.items : undefined\n\n if (!items || depth >= MAX_ARRAY_DEPTH) {\n return [ident('array')]\n }\n\n const itemTokens = getTypeSignatureTokens(items as SchemaObject | ReferenceType<SchemaObject>, options, depth + 1)\n\n if (itemTokens.length === 0) {\n return [ident('array')]\n }\n\n return [word('array of'), ...itemTokens]\n}\n"],"mappings":";;;;AAkBA,IAAMA,IAAoB,GAGpBC,IAAuB;CAAC;CAAsB;CAAuB;CAAmB;AAAa,GAGrGC,KAAiB,MAGC,OAAOC,KAAU,YAAnCA,IACK,KAAK,UAAUA,CAAK,IAGtB,OAAOA,KAAU,WAAW,IAAIA,EAAM,KAAK,OAAOA,CAAK,GAG1DC,KAAQ,OAAsC;CAAE,MAAM;CAAQ;AAAK,IACnEC,KAAS,OAAsC;CAAE,MAAM;CAAS;AAAK,IACrEC,KAAW,OAAsC;CACrD,MAAM;CACN;AACF,IACMC,WAAkC;CAAE,MAAM;CAAe,MAAM;AAAI,IAGnEC,KAAc,GAA+B,MACjDC,EAAM,SAAS,GAAQ,MAAWC,MAAU,IAAIC,IAAS,CAAC,GAAGC,EAAU,GAAG,GAAGD,CAAM,CAAE,GAS1EE,KACX,GACA,IAAwC,CAAC,GAEzC,IAAU,OACE;CAMZ,IALI,CAACC,KAAc,OAAOA,KAAe,YAMvC,UAAUA,KACV,OAAOA,EAAW,QAAS,YAC3B,CAACC,EAAQ,kBACTC,EAAWF,EAAW,IAAI,GAE1B,OAAO;CAKT,IAAMX,IAAQY,EAAQ,iBAAiBE,EAAQ,OAAOH,CAAU,IAAII,EAAeJ,CAAU;CAE7F,IAAI,CAACX,KAAS,OAAOA,KAAU,YAAYA,EAAM,UAAU,KAAA,GACzD,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AAK,KAAKY,MACjBL,EAAe,WAAW,KAC1BG,GAAW,SAAS,UACpBC,GAAW,SAAS,WAEhBH,EAAU,SAAS,IAAI,GAAG;EAC5B,IAAMK,IAAWL,EAAU,MAAM,GAAG,EAAE;EAEtC,IAAIK,KAAYA,MAAaF,EAAU,MACrC,OAAO,CAACD,GAAW5B,EAAM+B,CAAQ,CAAC;CAEtC;CAGF,OAAON;AACT,GAGMO,IAAkB,GAElBV,KACJ,GACA,GACA,MACyB;CACzB,IAAMJ,IAAQ,WAAWpB,IAAQA,EAAM,QAAQ,KAAA;CAE/C,IAAI,CAACoB,KAASK,KAASS,GACrB,OAAO,CAAChC,EAAM,OAAO,CAAC;CAGxB,IAAMiC,IAAad,EAAuBD,GAAqDR,GAASa,IAAQ,CAAC;CAMjH,OAJIU,EAAW,WAAW,IACjB,CAACjC,EAAM,OAAO,CAAC,IAGjB,CAACD,EAAK,UAAU,GAAG,GAAGkC,CAAU;AACzC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getResolvedRef as e } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
2
2
|
import { isArraySchema as t } from "@scalar/workspace-store/schemas/v3.2/strict/type-guards";
|
|
3
|
-
|
|
3
|
+
// src/schema/helpers/has-complex-array-items.ts
|
|
4
4
|
var n = [
|
|
5
5
|
"allOf",
|
|
6
6
|
"oneOf",
|
|
@@ -20,7 +20,6 @@ var n = [
|
|
|
20
20
|
let o = e(n.items);
|
|
21
21
|
return o ? i(o) || r(o) ? !0 : a(o) : !1;
|
|
22
22
|
};
|
|
23
|
-
//#endregion
|
|
24
23
|
export { o as hasComplexArrayItems };
|
|
25
24
|
|
|
26
25
|
//# sourceMappingURL=has-complex-array-items.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getRefName as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
export {
|
|
1
|
+
import { inferDiscriminatorMappingComposition as e } from "./get-compositions-to-render.js";
|
|
2
|
+
import { getRefName as t } from "./get-ref-name.js";
|
|
3
|
+
import { getRenderedExample as n, normalizeRenderedExamples as r } from "./get-rendered-example.js";
|
|
4
|
+
import { getSchemaType as i } from "./get-schema-type.js";
|
|
5
|
+
import { getTypeSignatureTokens as a } from "./get-type-signature-tokens.js";
|
|
6
|
+
import { hasComplexArrayItems as o } from "./has-complex-array-items.js";
|
|
7
|
+
import { isModelLinkable as s } from "./is-model-linkable.js";
|
|
8
|
+
import { isTypeObject as c } from "./is-type-object.js";
|
|
9
|
+
import { optimizeValueForDisplay as l } from "./optimize-value-for-display.js";
|
|
10
|
+
import { handleTreeKeydown as u } from "./schema-keyboard-nav.js";
|
|
11
|
+
import { getModelNameFromSchema as d, getModelNameWithArray as f } from "./schema-name.js";
|
|
12
|
+
import { reduceNamesToObject as p, sortPropertyNames as m } from "./sort-property-names.js";
|
|
13
|
+
export { d as getModelNameFromSchema, f as getModelNameWithArray, t as getRefName, n as getRenderedExample, i as getSchemaType, a as getTypeSignatureTokens, u as handleTreeKeydown, o as hasComplexArrayItems, e as inferDiscriminatorMappingComposition, s as isModelLinkable, c as isTypeObject, r as normalizeRenderedExamples, l as optimizeValueForDisplay, p as reduceNamesToObject, m as sortPropertyNames };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { isTypeObject as e } from "./is-type-object.js";
|
|
2
|
-
|
|
2
|
+
// src/schema/helpers/is-empty-schema-object.ts
|
|
3
3
|
var t = (t) => {
|
|
4
4
|
if (!e(t)) return !1;
|
|
5
5
|
let n = Object.keys(t.properties ?? {}).length === 0, r = t.additionalProperties === void 0 || t.additionalProperties === !1, i = Object.keys(t.patternProperties ?? {}).length === 0;
|
|
6
6
|
return n && r && i;
|
|
7
7
|
};
|
|
8
|
-
//#endregion
|
|
9
8
|
export { t as isEmptySchemaObject };
|
|
10
9
|
|
|
11
10
|
//# sourceMappingURL=is-empty-schema-object.js.map
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { unwrapForRead as e } from "./unwrap-for-read.js";
|
|
2
2
|
import { getResolvedRef as t, mergeSiblingReferences as n } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
3
3
|
import { isHidden as r } from "@scalar/workspace-store/helpers/is-hidden";
|
|
4
|
-
|
|
4
|
+
// src/schema/helpers/is-model-linkable.ts
|
|
5
5
|
var i = (i, { hideModels: a, document: o }) => {
|
|
6
6
|
if (!i || a) return !1;
|
|
7
7
|
let s = e(o)?.components?.schemas?.[i];
|
|
8
8
|
return !r(t(s, n));
|
|
9
9
|
};
|
|
10
|
-
//#endregion
|
|
11
10
|
export { i as isModelLinkable };
|
|
12
11
|
|
|
13
12
|
//# sourceMappingURL=is-model-linkable.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// src/schema/helpers/is-on-schema-target-path.ts
|
|
2
2
|
var e = (e, t) => !!(e && t && (t === e || t.startsWith(`${e}.`)));
|
|
3
|
-
//#endregion
|
|
4
3
|
export { e as isOnSchemaTargetPath };
|
|
5
4
|
|
|
6
5
|
//# sourceMappingURL=is-on-schema-target-path.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/schema/helpers/is-type-object.ts
|
|
2
2
|
var e = (e) => {
|
|
3
3
|
if (typeof e != "object" || !e || Array.isArray(e) || "oneOf" in e || "anyOf" in e || "allOf" in e || "not" in e) return !1;
|
|
4
4
|
let t = "type" in e;
|
|
@@ -9,7 +9,6 @@ var e = (e) => {
|
|
|
9
9
|
let r = "properties" in e, i = "additionalProperties" in e, a = "patternProperties" in e;
|
|
10
10
|
return r || i || a;
|
|
11
11
|
};
|
|
12
|
-
//#endregion
|
|
13
12
|
export { e as isTypeObject };
|
|
14
13
|
|
|
15
14
|
//# sourceMappingURL=is-type-object.js.map
|
|
@@ -3,7 +3,7 @@ import { resolve as t } from "@scalar/workspace-store/resolve";
|
|
|
3
3
|
import { isArraySchema as n } from "@scalar/workspace-store/schemas/v3.2/strict/type-guards";
|
|
4
4
|
import { isObjectEqual as r } from "@scalar/helpers/object/is-object-equal";
|
|
5
5
|
import { objectKeys as i } from "@scalar/helpers/object/object-keys";
|
|
6
|
-
|
|
6
|
+
// src/schema/helpers/merge-all-of-schemas.ts
|
|
7
7
|
var a = /* @__PURE__ */ new Set(["description", "title"]), o = [
|
|
8
8
|
"x-enum-varnames",
|
|
9
9
|
"x-enumNames",
|
|
@@ -144,7 +144,6 @@ var a = /* @__PURE__ */ new Set(["description", "title"]), o = [
|
|
|
144
144
|
...n
|
|
145
145
|
};
|
|
146
146
|
};
|
|
147
|
-
//#endregion
|
|
148
147
|
export { c as mergeAllOfSchemas };
|
|
149
148
|
|
|
150
149
|
//# sourceMappingURL=merge-all-of-schemas.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isTypeObject as e } from "./is-type-object.js";
|
|
2
2
|
import { partitionAllOfCompositions as t } from "./partition-all-of-compositions.js";
|
|
3
|
-
|
|
3
|
+
// src/schema/helpers/normalize-object-composition.ts
|
|
4
4
|
var n = (n, r) => {
|
|
5
5
|
if (!r || !n?.allOf || n.oneOf || n.anyOf || n.not) return n;
|
|
6
6
|
let { segments: i } = t(n), a = i[0];
|
|
@@ -23,7 +23,6 @@ var n = (n, r) => {
|
|
|
23
23
|
..."$ref" in n && typeof n.$ref == "string" ? { $ref: n.$ref } : {}
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
//#endregion
|
|
27
26
|
export { n as normalizeObjectComposition };
|
|
28
27
|
|
|
29
28
|
//# sourceMappingURL=normalize-object-composition.js.map
|