@scalar/blocks 0.11.2 → 0.11.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 +28 -0
- package/dist/code-example/components/AsyncApiCodeExample.vue.js +111 -6
- package/dist/code-example/components/AsyncApiCodeExample.vue.js.map +1 -1
- package/dist/code-example/components/AsyncApiCodeExample3.vue.js +8 -0
- package/dist/code-example/components/AsyncApiCodeExample3.vue.js.map +1 -0
- package/dist/code-example/components/CodeExample.vue.d.ts +10 -0
- package/dist/code-example/components/CodeExample.vue.d.ts.map +1 -1
- package/dist/code-example/components/CodeExample.vue.js +297 -6
- package/dist/code-example/components/CodeExample.vue.js.map +1 -1
- package/dist/code-example/components/CodeExample3.vue.js +8 -0
- package/dist/code-example/components/CodeExample3.vue.js.map +1 -0
- package/dist/code-example/components/ExamplePicker.vue.d.ts +2 -0
- package/dist/code-example/components/ExamplePicker.vue.d.ts.map +1 -1
- package/dist/code-example/components/ExamplePicker.vue.js +50 -4
- package/dist/code-example/components/ExamplePicker.vue.js.map +1 -1
- package/dist/code-example/components/ExamplePicker2.vue.js +6 -0
- package/dist/code-example/components/ExamplePicker2.vue.js.map +1 -0
- package/dist/code-example/components/HttpMethod.vue.js +32 -4
- package/dist/code-example/components/HttpMethod.vue.js.map +1 -1
- package/dist/code-example/components/HttpMethod2.vue.js +6 -0
- package/dist/code-example/components/HttpMethod2.vue.js.map +1 -0
- package/dist/code-example/helpers/filter-clients-by-query.js.map +1 -1
- package/dist/code-example/helpers/find-client.js.map +1 -1
- package/dist/code-example/helpers/format-language.js.map +1 -1
- package/dist/code-example/helpers/generate-client-options.js.map +1 -1
- package/dist/code-example/helpers/generate-code-snippet.d.ts +8 -2
- package/dist/code-example/helpers/generate-code-snippet.d.ts.map +1 -1
- package/dist/code-example/helpers/generate-code-snippet.js +57 -27
- package/dist/code-example/helpers/generate-code-snippet.js.map +1 -1
- package/dist/code-example/helpers/get-asyncapi-example-context.js.map +1 -1
- package/dist/code-example/helpers/get-clients.js.map +1 -1
- package/dist/code-example/helpers/get-custom-code-samples.js.map +1 -1
- package/dist/code-example/helpers/get-generated-payload-example.js.map +1 -1
- package/dist/code-example/helpers/get-message-example-content.js.map +1 -1
- package/dist/code-example/helpers/get-secrets.js.map +1 -1
- package/dist/code-example/helpers/get-snippet.d.ts +2 -2
- package/dist/code-example/helpers/get-snippet.d.ts.map +1 -1
- package/dist/code-example/helpers/get-snippet.js +7 -9
- package/dist/code-example/helpers/get-snippet.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts +1 -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 +1 -1
- 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 +102 -81
- 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.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-parameters.js +49 -47
- 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 +6 -6
- package/dist/code-example/helpers/operation-to-har/process-security-schemes.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-server-url.js.map +1 -1
- package/dist/code-example/index.d.ts +1 -1
- package/dist/code-example/index.d.ts.map +1 -1
- package/dist/code-example/index.js +14 -14
- package/dist/code-example/mount-asyncapi.js +1 -1
- package/dist/code-example/mount-asyncapi.js.map +1 -1
- package/dist/code-example/mount.js +1 -1
- package/dist/code-example/mount.js.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/schema/LinkButton.vue.js.map +1 -1
- package/dist/schema/RenderString.vue.js +11 -4
- package/dist/schema/RenderString.vue.js.map +1 -1
- package/dist/schema/RenderString2.vue.js +6 -0
- package/dist/schema/RenderString2.vue.js.map +1 -0
- package/dist/schema/Schema.vue.d.ts.map +1 -1
- package/dist/schema/Schema.vue.js +235 -6
- package/dist/schema/Schema.vue.js.map +1 -1
- package/dist/schema/Schema3.vue.js +8 -0
- package/dist/schema/Schema3.vue.js.map +1 -0
- package/dist/schema/SchemaCollapsedPreview.vue.js +25 -4
- package/dist/schema/SchemaCollapsedPreview.vue.js.map +1 -1
- package/dist/schema/SchemaCollapsedPreview2.vue.js +6 -0
- package/dist/schema/SchemaCollapsedPreview2.vue.js.map +1 -0
- package/dist/schema/SchemaComposition.vue.js +232 -6
- package/dist/schema/SchemaComposition.vue.js.map +1 -1
- package/dist/schema/SchemaComposition3.vue.js +8 -0
- package/dist/schema/SchemaComposition3.vue.js.map +1 -0
- package/dist/schema/SchemaEnumPropertyItem.vue.d.ts +1 -0
- package/dist/schema/SchemaEnumPropertyItem.vue.d.ts.map +1 -1
- package/dist/schema/SchemaEnumPropertyItem.vue.js +23 -4
- package/dist/schema/SchemaEnumPropertyItem.vue.js.map +1 -1
- package/dist/schema/SchemaEnumPropertyItem2.vue.js +6 -0
- package/dist/schema/SchemaEnumPropertyItem2.vue.js.map +1 -0
- package/dist/schema/SchemaEnums.vue.d.ts.map +1 -1
- package/dist/schema/SchemaEnums.vue.js +74 -6
- package/dist/schema/SchemaEnums.vue.js.map +1 -1
- package/dist/schema/SchemaEnums3.vue.js +8 -0
- package/dist/schema/SchemaEnums3.vue.js.map +1 -0
- package/dist/schema/SchemaGlyphPuck.vue.js +27 -4
- package/dist/schema/SchemaGlyphPuck.vue.js.map +1 -1
- package/dist/schema/SchemaGlyphPuck2.vue.js +6 -0
- package/dist/schema/SchemaGlyphPuck2.vue.js.map +1 -0
- package/dist/schema/SchemaGutterToggle.vue.js +40 -4
- package/dist/schema/SchemaGutterToggle.vue.js.map +1 -1
- package/dist/schema/SchemaGutterToggle2.vue.js +6 -0
- package/dist/schema/SchemaGutterToggle2.vue.js.map +1 -0
- package/dist/schema/SchemaHeading.vue.js +32 -6
- package/dist/schema/SchemaHeading.vue.js.map +1 -1
- package/dist/schema/SchemaHeading3.vue.js +8 -0
- package/dist/schema/SchemaHeading3.vue.js.map +1 -0
- package/dist/schema/SchemaObjectExampleCodeBlock.vue.js +42 -4
- package/dist/schema/SchemaObjectExampleCodeBlock.vue.js.map +1 -1
- package/dist/schema/SchemaObjectExampleCodeBlock2.vue.js +6 -0
- package/dist/schema/SchemaObjectExampleCodeBlock2.vue.js.map +1 -0
- package/dist/schema/SchemaObjectProperties.vue.js +213 -4
- package/dist/schema/SchemaObjectProperties.vue.js.map +1 -1
- package/dist/schema/SchemaObjectProperties2.vue.js +6 -0
- package/dist/schema/SchemaObjectProperties2.vue.js.map +1 -0
- package/dist/schema/SchemaProperty.vue.d.ts +7 -2
- package/dist/schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/schema/SchemaProperty.vue.js +494 -6
- package/dist/schema/SchemaProperty.vue.js.map +1 -1
- package/dist/schema/SchemaProperty3.vue.js +8 -0
- package/dist/schema/SchemaProperty3.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyDefault.vue.js +61 -6
- package/dist/schema/SchemaPropertyDefault.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyDefault3.vue.js +8 -0
- package/dist/schema/SchemaPropertyDefault3.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyDetail.vue.js +22 -6
- package/dist/schema/SchemaPropertyDetail.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyDetail3.vue.js +8 -0
- package/dist/schema/SchemaPropertyDetail3.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyExamples.vue.js +133 -6
- package/dist/schema/SchemaPropertyExamples.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyExamples3.vue.js +8 -0
- package/dist/schema/SchemaPropertyExamples3.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyHeading.vue.d.ts +4 -1
- package/dist/schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
- package/dist/schema/SchemaPropertyHeading.vue.js +313 -6
- package/dist/schema/SchemaPropertyHeading.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyHeading3.vue.js +8 -0
- package/dist/schema/SchemaPropertyHeading3.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyPattern.vue.js +42 -6
- package/dist/schema/SchemaPropertyPattern.vue.js.map +1 -1
- package/dist/schema/SchemaPropertyPattern3.vue.js +8 -0
- package/dist/schema/SchemaPropertyPattern3.vue.js.map +1 -0
- package/dist/schema/SchemaRailPanel.vue.js +53 -4
- package/dist/schema/SchemaRailPanel.vue.js.map +1 -1
- package/dist/schema/SchemaRailPanel2.vue.js +6 -0
- package/dist/schema/SchemaRailPanel2.vue.js.map +1 -0
- package/dist/schema/components/CopyLinkButton.vue.js +24 -4
- package/dist/schema/components/CopyLinkButton.vue.js.map +1 -1
- package/dist/schema/components/CopyLinkButton2.vue.js +6 -0
- package/dist/schema/components/CopyLinkButton2.vue.js.map +1 -0
- package/dist/schema/components/WithBreadcrumb.vue.js +15 -4
- package/dist/schema/components/WithBreadcrumb.vue.js.map +1 -1
- package/dist/schema/components/WithBreadcrumb2.vue.js +6 -0
- package/dist/schema/components/WithBreadcrumb2.vue.js.map +1 -0
- package/dist/schema/helpers/dynamic-scope.js.map +1 -1
- package/dist/schema/helpers/format-example.js.map +1 -1
- package/dist/schema/helpers/format-structured-value.d.ts +3 -0
- package/dist/schema/helpers/format-structured-value.d.ts.map +1 -0
- package/dist/schema/helpers/format-structured-value.js +6 -0
- package/dist/schema/helpers/format-structured-value.js.map +1 -0
- package/dist/schema/helpers/format-value.js.map +1 -1
- package/dist/schema/helpers/get-compositions-to-render.d.ts.map +1 -1
- package/dist/schema/helpers/get-compositions-to-render.js +34 -31
- package/dist/schema/helpers/get-compositions-to-render.js.map +1 -1
- package/dist/schema/helpers/get-discriminator-values.js.map +1 -1
- package/dist/schema/helpers/get-enum-values.js.map +1 -1
- package/dist/schema/helpers/get-property-description.js.map +1 -1
- package/dist/schema/helpers/get-ref-name.d.ts +14 -5
- package/dist/schema/helpers/get-ref-name.d.ts.map +1 -1
- package/dist/schema/helpers/get-ref-name.js +8 -11
- package/dist/schema/helpers/get-ref-name.js.map +1 -1
- package/dist/schema/helpers/get-rendered-example.js.map +1 -1
- package/dist/schema/helpers/get-schema-type.js.map +1 -1
- package/dist/schema/helpers/get-type-signature-tokens.d.ts.map +1 -1
- package/dist/schema/helpers/get-type-signature-tokens.js +37 -36
- package/dist/schema/helpers/get-type-signature-tokens.js.map +1 -1
- package/dist/schema/helpers/has-complex-array-items.js.map +1 -1
- package/dist/schema/helpers/index.d.ts +1 -1
- package/dist/schema/helpers/index.d.ts.map +1 -1
- package/dist/schema/helpers/index.js +3 -3
- package/dist/schema/helpers/is-empty-schema-object.js.map +1 -1
- package/dist/schema/helpers/is-model-linkable.js.map +1 -1
- package/dist/schema/helpers/is-on-schema-target-path.js.map +1 -1
- package/dist/schema/helpers/is-type-object.js.map +1 -1
- package/dist/schema/helpers/merge-all-of-schemas.js.map +1 -1
- package/dist/schema/helpers/normalize-object-composition.js.map +1 -1
- package/dist/schema/helpers/optimize-value-for-display.js.map +1 -1
- package/dist/schema/helpers/partition-all-of-compositions.js.map +1 -1
- package/dist/schema/helpers/schema-cycle.js.map +1 -1
- package/dist/schema/helpers/schema-expansion.js.map +1 -1
- package/dist/schema/helpers/schema-keyboard-nav.js.map +1 -1
- package/dist/schema/helpers/schema-name.d.ts +7 -3
- package/dist/schema/helpers/schema-name.d.ts.map +1 -1
- package/dist/schema/helpers/schema-name.js +36 -26
- package/dist/schema/helpers/schema-name.js.map +1 -1
- package/dist/schema/helpers/should-display-description.js.map +1 -1
- package/dist/schema/helpers/should-display-heading.js.map +1 -1
- package/dist/schema/helpers/should-render-array-item-composition.js.map +1 -1
- package/dist/schema/helpers/sort-property-names.js.map +1 -1
- package/dist/schema/helpers/unwrap-for-read.js.map +1 -1
- package/dist/schema/index.js +8 -8
- package/dist/schema/localization/index.js.map +1 -1
- package/dist/schema/localization/translations.js.map +1 -1
- package/dist/shared/Badge.vue.js +13 -6
- package/dist/shared/Badge.vue.js.map +1 -1
- package/dist/shared/Badge3.vue.js +8 -0
- package/dist/shared/Badge3.vue.js.map +1 -0
- package/dist/shared/ExternalDocs.vue.d.ts +2 -0
- package/dist/shared/ExternalDocs.vue.d.ts.map +1 -1
- package/dist/shared/ExternalDocs.vue.js +50 -4
- package/dist/shared/ExternalDocs.vue.js.map +1 -1
- package/dist/shared/ExternalDocs2.vue.js +6 -0
- package/dist/shared/ExternalDocs2.vue.js.map +1 -0
- package/dist/shared/ExternalExampleStatus.vue.js +24 -4
- package/dist/shared/ExternalExampleStatus.vue.js.map +1 -1
- package/dist/shared/ExternalExampleStatus2.vue.js +6 -0
- package/dist/shared/ExternalExampleStatus2.vue.js.map +1 -0
- package/dist/shared/ScreenReader.vue.js +16 -4
- package/dist/shared/ScreenReader.vue.js.map +1 -1
- package/dist/shared/ScreenReader2.vue.js +6 -0
- package/dist/shared/ScreenReader2.vue.js.map +1 -0
- package/dist/shared/external-example-localization/index.js.map +1 -1
- package/dist/shared/external-example-localization/translations.js.map +1 -1
- package/dist/shared/index.js +4 -4
- package/dist/specification-extensions/ExtensionValue.vue.js +89 -4
- package/dist/specification-extensions/ExtensionValue.vue.js.map +1 -1
- package/dist/specification-extensions/ExtensionValue2.vue.js +6 -0
- package/dist/specification-extensions/ExtensionValue2.vue.js.map +1 -0
- package/dist/specification-extensions/SpecificationExtensions.vue.js +76 -4
- package/dist/specification-extensions/SpecificationExtensions.vue.js.map +1 -1
- package/dist/specification-extensions/SpecificationExtensions2.vue.js +6 -0
- package/dist/specification-extensions/SpecificationExtensions2.vue.js.map +1 -0
- package/dist/specification-extensions/index.js +1 -1
- package/dist/style.css +23 -19
- package/dist/vue-styles.css +1 -1
- package/package.json +19 -19
- package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js +0 -113
- package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js +0 -269
- package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/code-example/components/ExamplePicker.vue_vue_type_script_setup_true_lang.js +0 -48
- package/dist/code-example/components/ExamplePicker.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/code-example/components/HttpMethod.vue_vue_type_script_setup_true_lang.js +0 -34
- package/dist/code-example/components/HttpMethod.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/RenderString.vue_vue_type_script_setup_true_lang.js +0 -13
- package/dist/schema/RenderString.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js +0 -237
- package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js +0 -27
- package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js +0 -234
- package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js +0 -23
- package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js +0 -77
- package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js +0 -29
- package/dist/schema/SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js +0 -42
- package/dist/schema/SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js +0 -34
- package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js +0 -44
- package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js +0 -215
- package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js +0 -474
- package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js +0 -63
- package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js +0 -24
- package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js +0 -135
- package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js +0 -314
- package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaPropertyPattern.vue_vue_type_script_setup_true_lang.js +0 -44
- package/dist/schema/SchemaPropertyPattern.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js +0 -55
- package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/components/CopyLinkButton.vue_vue_type_script_setup_true_lang.js +0 -26
- package/dist/schema/components/CopyLinkButton.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/schema/components/WithBreadcrumb.vue_vue_type_script_setup_true_lang.js +0 -17
- package/dist/schema/components/WithBreadcrumb.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js +0 -15
- package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js +0 -45
- package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/shared/ExternalExampleStatus.vue_vue_type_script_setup_true_lang.js +0 -26
- package/dist/shared/ExternalExampleStatus.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/shared/ScreenReader.vue_vue_type_script_setup_true_lang.js +0 -18
- package/dist/shared/ScreenReader.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js +0 -91
- package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js.map +0 -1
- package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js +0 -78
- package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyLinkButton.vue.js","names":["CopyLinkButton_vue_vue_type_script_setup_true_lang_default","
|
|
1
|
+
{"version":3,"file":"CopyLinkButton.vue.js","names":["_openBlock","_createElementBlock","_createVNode","_unref","_createElementVNode","_renderSlot","_createTextVNode","_toDisplayString","useLocalization","computed","createElementBlock","createElementVNode","createTextVNode","createVNode","defineComponent","openBlock","renderSlot","toDisplayString","unref","ScalarIconHash","_hoisted_1","CopyLinkButton_vue_vue_type_script_setup_true_lang_default","__props","translate","copyLinkLabel","_ctx","_cache"],"sources":["../../../src/schema/components/CopyLinkButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconHash } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { computed } from 'vue'\n\nimport { useLocalization } from '../localization'\n\n/**\n * A property row's deep-link affordance: the same hash the section headings\n * and the models list show, trailing the row's text in the flow of the heading\n * and revealed on hover or focus. It is a separate component so it can render\n * as the LAST child of the heading: inside `WithBreadcrumb`, which wraps the\n * name, it would come before the type in the tab order (WCAG 2.4.3).\n */\nconst { anchorId, propertyName } = defineProps<{\n /** The anchor this button copies a link to */\n anchorId: string\n /**\n * Full property name used in the accessible label.\n * Names can contain dots, which also separate segments in the anchor ID.\n */\n propertyName: string\n eventBus: WorkspaceEventBus | null\n}>()\n\nconst { translate } = useLocalization()\n\n/** Screen-reader label for the copy-link button, naming the deep-linked item. */\nconst copyLinkLabel = computed(() =>\n translate('actions.copyLinkTo', {\n name: propertyName,\n }),\n)\n</script>\n\n<template>\n <!-- A flex item of the heading, so it wraps with the text. Negative margins\n cancel the padding of the 24px hit area WCAG 2.5.8 asks for, so the box\n overhangs the line instead of taking room from it: vertically it never\n changes the line height, and horizontally the row gives up only the 10px\n gap and the 14px icon (5 + 24 - 5), which is what a collapsed preview\n before it truncates against.\n\n Both inline margins carry `!`: the heading's scoped `.property-heading > *`\n sets a 9px right margin, which is the end margin in LTR and the start\n margin in RTL, at the same specificity as the utility. Which one wins\n depends on whether the consumer's stylesheet puts the utilities before or\n after `vue-styles.css`.\n\n pointer-coarse drops it entirely rather than leaving it transparent: a\n touch pointer has no hover, so a still-laid-out button would be an\n invisible tap target AND would keep pushing long signature lines onto a\n second line just to show a control nobody can see. A deep link stays\n reachable there through the address bar. -->\n <button\n class=\"copy-link-trailing text-c-3 hover:text-c-1 -my-1.25 ms-1.25! -me-1.25! flex shrink-0 cursor-pointer items-center justify-center self-center p-1.25 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 pointer-coarse:hidden\"\n type=\"button\"\n @click=\"() => eventBus?.emit('copy-url:nav-item', { id: anchorId })\">\n <ScalarIconHash\n aria-hidden=\"true\"\n class=\"size-3.5\" />\n <span class=\"sr-only\">\n <slot name=\"sr-label\">{{ copyLinkLabel }}</slot>\n </span>\n </button>\n</template>\n"],"mappings":";;;;;;;;;;;;EAyBA,IAAM,EAAEuB,iBAAcf,EAAgB,GAGhCgB,IAAgBf,QACpBc,EAAU,sBAAsB,EAC9B,MAAMD,EAAA,aACR,CAAC,CACH;E,kBAsBEtB,EAAA,GAAAC,EAUS,UAAA;GATP,OAAM;GACN,MAAK;GACJ,SAAKyB,EAAA,aAAQJ,EAAA,UAAU,KAAI,qBAAA,EAAA,IAA4BA,EAAA,SAAQ,CAAA;E,IAChEpB,EAEqBC,EAAAgB,CAAA,GAAA;GADnB,eAAY;GACZ,OAAM;E,IACRf,EAEO,QAFPgB,GAEO,CADLf,EAAgDoB,EAAA,QAAA,YAAA,CAAA,SAAA,CAAvBnB,EAAAC,EAAAiB,EAAA,KAAa,GAAA,CAAA,C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyLinkButton2.vue.js","names":["CopyLinkButton_vue_vue_type_script_setup_true_lang_default","CopyLinkButton_default"],"sources":[],"mappings":""}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
// src/schema/components/WithBreadcrumb.vue
|
|
3
|
-
var
|
|
4
|
-
|
|
1
|
+
import { createElementBlock as e, defineComponent as t, openBlock as n, renderSlot as r } from "vue";
|
|
2
|
+
// src/schema/components/WithBreadcrumb.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var i = ["id"], a = /*@__PURE__*/ t({
|
|
4
|
+
__name: "WithBreadcrumb",
|
|
5
|
+
props: { breadcrumb: {} },
|
|
6
|
+
setup(t) {
|
|
7
|
+
return (a, o) => t.breadcrumb && t.breadcrumb.length > 0 ? (n(), e("div", {
|
|
8
|
+
key: 0,
|
|
9
|
+
id: t.breadcrumb.join("."),
|
|
10
|
+
class: "static scroll-mt-24",
|
|
11
|
+
tabindex: "-1"
|
|
12
|
+
}, [r(a.$slots, "default")], 8, i)) : r(a.$slots, "default", {}, void 0, void 0, 1);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
export { a as default };
|
|
5
16
|
|
|
6
17
|
//# sourceMappingURL=WithBreadcrumb.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithBreadcrumb.vue.js","names":["WithBreadcrumb_vue_vue_type_script_setup_true_lang_default","
|
|
1
|
+
{"version":3,"file":"WithBreadcrumb.vue.js","names":["_openBlock","_createElementBlock","_renderSlot","createElementBlock","defineComponent","openBlock","renderSlot","_hoisted_1","WithBreadcrumb_vue_vue_type_script_setup_true_lang_default","__props","_ctx","_cache"],"sources":["../../../src/schema/components/WithBreadcrumb.vue"],"sourcesContent":["<script setup lang=\"ts\">\nconst { breadcrumb } = defineProps<{\n breadcrumb?: string[]\n}>()\n</script>\n\n<template>\n <template v-if=\"breadcrumb && breadcrumb.length > 0\">\n <!-- `tabindex=\"-1\"`: focusable programmatically but out of the tab order,\n so a deep link can move focus to its target instead of leaving keyboard\n and screen-reader users at the top of the document -->\n <div\n :id=\"breadcrumb.join('.')\"\n class=\"static scroll-mt-24\"\n tabindex=\"-1\">\n <!-- Content -->\n <slot />\n <!-- No copy button here: the row's heading renders it as its last child\n so tab order matches visual order. See CopyLinkButton.vue -->\n </div>\n </template>\n <template v-else>\n <slot />\n </template>\n</template>\n"],"mappings":";;;;;;E,iBAOkBS,EAAA,cAAcA,EAAA,WAAW,SAAM,KAI7CT,EAAA,GAAAC,EAQM,OAAA;;GAPH,IAAIQ,EAAA,WAAW,KAAI,GAAA;GACpB,OAAM;GACN,UAAS;E,IAETP,EAAQQ,EAAA,QAAA,SAAA,C,YAMVR,EAAQQ,EAAA,QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,KAAA,GAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WithBreadcrumb2.vue.js","names":["WithBreadcrumb_vue_vue_type_script_setup_true_lang_default","WithBreadcrumb_default"],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-scope.js","names":["
|
|
1
|
+
{"version":3,"file":"dynamic-scope.js","names":["getResolvedRef","DYNAMIC_REF_VALUE","resolve","isDynamicRef","normalizeDynamicRefTarget","resolveDynamicSchema","schema","seen","current","target","resolveDisplaySchema","source"],"sources":["../../../src/schema/helpers/dynamic-scope.ts"],"sourcesContent":["import { isDynamicRef, normalizeDynamicRefTarget } from '@scalar/workspace-store/helpers/dynamic-ref'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { DYNAMIC_REF_VALUE, resolve } from '@scalar/workspace-store/resolve'\nimport type {\n ReferenceType,\n SchemaObject,\n SchemaReferenceType,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\n/**\n * Resolving JSON Schema 2020-12 `$dynamicRef` while rendering a schema.\n *\n * Unlike `$ref`, a `$dynamicRef` does not resolve to a fixed location: it binds to the active\n * `$dynamicAnchor` in the chain of schema resources entered to reach it, so the same\n * `{ \"$dynamicRef\": \"#itemType\" }` inside a shared generic template resolves to a different concrete\n * type depending on the path taken (e.g. `User` via a user page, `Group` via a group page).\n *\n * Resolution is owned by the workspace-store magic proxy, not by these components: the proxy threads the\n * dynamic scope as the document is walked and exposes the bound schema through the virtual\n * `$dynamicRef-value` property (mirroring `$ref-value`). Rendering simply reads that property, so the\n * scope never has to be assembled here. See https://github.com/scalar/scalar/issues/9414.\n */\n\n/**\n * Resolve a schema that may be a `$dynamicRef` to its bound concrete type.\n *\n * Returns the schema the proxy binds through `$dynamicRef-value`. When the reference cannot be resolved\n * — the schema is not a `$dynamicRef`, or has been detached from the proxy — the input is returned\n * unchanged, so rendering falls back to its prior behavior with no regression.\n */\nexport const resolveDynamicSchema = <T extends SchemaReferenceType<SchemaObject> | undefined>(schema: T): T => {\n if (!isDynamicRef(schema)) {\n return schema\n }\n\n const seen = new Set<object>()\n let current: unknown = schema\n while (isDynamicRef(current) && !seen.has(current)) {\n seen.add(current)\n const target = normalizeDynamicRefTarget(Reflect.get(current, DYNAMIC_REF_VALUE))\n if (!target) {\n break\n }\n current = target\n }\n return current as T\n}\n\n/** Read a media or parameter schema while preserving the scopes of its referenced properties. */\nexport const resolveDisplaySchema = (\n source: ReferenceType<SchemaObject> | null | undefined,\n): SchemaObject | undefined => {\n if (!source) {\n return undefined\n }\n const target = getResolvedRef<SchemaObject>(source)\n const schema = target && typeof target === 'object' && '$ref' in target ? resolve.schema(source) : target\n return resolveDynamicSchema(schema)\n}\n"],"mappings":";;;;AA8BA,IAAaK,KAAiFC,MAAiB;CAC7G,IAAI,CAACH,EAAaG,CAAM,GACtB,OAAOA;CAGT,IAAMC,oBAAO,IAAI,IAAY,GACzBC,IAAmBF;CACvB,OAAOH,EAAaK,CAAO,KAAK,CAACD,EAAK,IAAIC,CAAO,IAAG;EAClDD,EAAK,IAAIC,CAAO;EAChB,IAAMC,IAASL,EAA0B,QAAQ,IAAII,GAASP,CAAiB,CAAC;EAChF,IAAI,CAACQ,GACH;EAEFD,IAAUC;CACZ;CACA,OAAOD;AACT,GAGaE,KACXC,MAC6B;CAC7B,IAAI,CAACA,GACH;CAEF,IAAMF,IAAST,EAA6BW,CAAM;CAElD,OAAON,EADQI,KAAU,OAAOA,KAAW,YAAY,UAAUA,IAASP,EAAQ,OAAOS,CAAM,IAAIF,CACjE;AACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-example.js","names":["preserveOrTrim","
|
|
1
|
+
{"version":3,"file":"format-example.js","names":["preserveOrTrim","value","trimmed","formatExample","example","item"],"sources":["../../../src/schema/helpers/format-example.ts"],"sourcesContent":["/**\n * Trims surrounding whitespace, but keeps the original string when trimming would empty it\n * (so an intentional \" \" example is not silently turned into \"\").\n */\nfunction preserveOrTrim(value: string): string {\n const trimmed = value.trim()\n return trimmed === '' ? value : trimmed\n}\n\n/**\n * Converts an example value to a string that can be displayed in the UI.\n */\nexport function formatExample(example: unknown): string | number {\n if (Array.isArray(example)) {\n return `[${example\n .map((item) => {\n if (typeof item === 'string') {\n return `\"${preserveOrTrim(item)}\"`\n }\n\n if (typeof item === 'object') {\n return JSON.stringify(item)\n }\n\n if (item === undefined) {\n return 'undefined'\n }\n\n if (item === null) {\n return 'null'\n }\n\n return item\n })\n .join(', ')}]`\n }\n\n if (example === null) {\n return 'null'\n }\n\n if (typeof example === 'object') {\n return JSON.stringify(example)\n }\n\n if (example === undefined) {\n return 'undefined'\n }\n\n if (typeof example === 'string') {\n return preserveOrTrim(example)\n }\n\n return preserveOrTrim(example.toString())\n}\n"],"mappings":";AAIA,SAASA,EAAeC,GAAuB;CAC7C,IAAMC,IAAUD,EAAM,KAAK;CAC3B,OAAOC,MAAY,KAAKD,IAAQC;AAClC;AAKA,SAAgBC,EAAcC,GAAmC;CAyC/D,OAxCI,MAAM,QAAQA,CAAO,IAChB,IAAIA,EACR,KAAKC,MACA,OAAOA,KAAS,WACX,IAAIL,EAAeK,CAAI,EAAE,KAG9B,OAAOA,KAAS,WACX,KAAK,UAAUA,CAAI,IAGxBA,MAAS,KAAA,IACJ,cAGLA,MAAS,OACJ,SAGFA,CACR,CAAC,CACD,KAAK,IAAI,EAAE,KAGZD,MAAY,OACP,SAGL,OAAOA,KAAY,WACd,KAAK,UAAUA,CAAO,IAG3BA,MAAY,KAAA,IACP,cAIAJ,EADL,OAAOI,KAAY,WACCA,IAGFA,EAAQ,SAAS,CAHR;AAIjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-structured-value.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/format-structured-value.ts"],"names":[],"mappings":"AAEA,uFAAuF;AACvF,eAAO,MAAM,qBAAqB,GAAI,OAAO,OAAO,KAAG,MAAM,GAAG,SACP,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-structured-value.js","names":["isObjectLike","formatStructuredValue","value"],"sources":["../../../src/schema/helpers/format-structured-value.ts"],"sourcesContent":["import { isObjectLike } from '@scalar/helpers/object/is-object'\n\n/** Use compact JSON for structured schema literals and their enum description keys. */\nexport const formatStructuredValue = (value: unknown): string | undefined =>\n isObjectLike(value) ? JSON.stringify(value) : undefined\n"],"mappings":";;AAGA,IAAaC,KAAyBC,MACpCF,EAAaE,CAAK,IAAI,KAAK,UAAUA,CAAK,IAAI,KAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-value.js","names":["formatValue","value","item"],"sources":["../../../src/schema/helpers/format-value.ts"],"sourcesContent":["/**\n * Converts a value to a string that can be displayed in the UI.\n */\nexport function formatValue(value: unknown): string | number {\n if (Array.isArray(value)) {\n return `[${value\n .map((item) => {\n if (typeof item === 'string') {\n return `\"${item.toString().trim()}\"`\n }\n\n if (typeof item === 'object') {\n return JSON.stringify(item)\n }\n\n if (item === undefined) {\n return 'undefined'\n }\n\n if (item === null) {\n return 'null'\n }\n\n return item\n })\n .join(', ')}]`\n }\n\n if (value === null) {\n return 'null'\n }\n\n if (typeof value === 'object') {\n return JSON.stringify(value)\n }\n\n if (value === undefined) {\n return 'undefined'\n }\n\n if (typeof value === 'string') {\n return value.trim()\n }\n\n return value.toString().trim()\n}\n"],"mappings":";AAGA,SAAgBA,
|
|
1
|
+
{"version":3,"file":"format-value.js","names":["formatValue","value","item"],"sources":["../../../src/schema/helpers/format-value.ts"],"sourcesContent":["/**\n * Converts a value to a string that can be displayed in the UI.\n */\nexport function formatValue(value: unknown): string | number {\n if (Array.isArray(value)) {\n return `[${value\n .map((item) => {\n if (typeof item === 'string') {\n return `\"${item.toString().trim()}\"`\n }\n\n if (typeof item === 'object') {\n return JSON.stringify(item)\n }\n\n if (item === undefined) {\n return 'undefined'\n }\n\n if (item === null) {\n return 'null'\n }\n\n return item\n })\n .join(', ')}]`\n }\n\n if (value === null) {\n return 'null'\n }\n\n if (typeof value === 'object') {\n return JSON.stringify(value)\n }\n\n if (value === undefined) {\n return 'undefined'\n }\n\n if (typeof value === 'string') {\n return value.trim()\n }\n\n return value.toString().trim()\n}\n"],"mappings":";AAGA,SAAgBA,EAAYC,GAAiC;CAyC3D,OAxCI,MAAM,QAAQA,CAAK,IACd,IAAIA,EACR,KAAKC,MACA,OAAOA,KAAS,WACX,IAAIA,EAAK,SAAS,CAAC,CAAC,KAAK,EAAE,KAGhC,OAAOA,KAAS,WACX,KAAK,UAAUA,CAAI,IAGxBA,MAAS,KAAA,IACJ,cAGLA,MAAS,OACJ,SAGFA,CACR,CAAC,CACD,KAAK,IAAI,EAAE,KAGZD,MAAU,OACL,SAGL,OAAOA,KAAU,WACZ,KAAK,UAAUA,CAAK,IAGzBA,MAAU,KAAA,IACL,cAGL,OAAOA,KAAU,WACZA,EAAM,KAAK,IAGbA,EAAM,SAAS,CAAC,CAAC,KAAK;AAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-compositions-to-render.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/get-compositions-to-render.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAIjH,OAAO,EAAE,KAAK,kBAAkB,EAAgB,MAAM,sBAAsB,CAAA;AAI5E,KAAK,mBAAmB,GAAG;IACzB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,KAAK,EAAE,YAAY,CAAA;CACpB,CAAA;AAED,KAAK,oBAAoB,GAAG,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,CAAA;AAK/D;;;;;;;;GAQG;AACH,eAAO,MAAM,oCAAoC,GAC/C,OAAO,YAAY,EACnB,eAAe,oBAAoB;AACnC,4FAA4F;AAC5F,cAAc,SAAS,MAAM,EAAE,KAC9B,YAAY,GAAG,
|
|
1
|
+
{"version":3,"file":"get-compositions-to-render.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/get-compositions-to-render.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAIjH,OAAO,EAAE,KAAK,kBAAkB,EAAgB,MAAM,sBAAsB,CAAA;AAI5E,KAAK,mBAAmB,GAAG;IACzB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,KAAK,EAAE,YAAY,CAAA;CACpB,CAAA;AAED,KAAK,oBAAoB,GAAG,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,CAAA;AAK/D;;;;;;;;GAQG;AACH,eAAO,MAAM,oCAAoC,GAC/C,OAAO,YAAY,EACnB,eAAe,oBAAoB;AACnC,4FAA4F;AAC5F,cAAc,SAAS,MAAM,EAAE,KAC9B,YAAY,GAAG,IAsDjB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAClC,OAAO,YAAY,GAAG,SAAS,EAC/B,WAAW,oBAAoB;AAC/B;;;;;GAKG;AACH,mCAAkC,YAAY,GAAG,IAEzC,KACP,mBAAmB,EAiCrB,CAAA"}
|
|
@@ -1,39 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { compositions as
|
|
3
|
-
import { hasArrayItemComposition as
|
|
4
|
-
import { unwrapForRead as
|
|
5
|
-
import { resolve as
|
|
6
|
-
import { isArraySchema as
|
|
7
|
-
import { isDefined as
|
|
8
|
-
import { unescapeJsonPointerSegment as
|
|
1
|
+
import { getRawRefName as e, getRefName as t } from "./get-ref-name.js";
|
|
2
|
+
import { compositions as n } from "./schema-composition.js";
|
|
3
|
+
import { hasArrayItemComposition as r, shouldRenderArrayItemComposition as i } from "./should-render-array-item-composition.js";
|
|
4
|
+
import { unwrapForRead as a } from "./unwrap-for-read.js";
|
|
5
|
+
import { resolve as o } from "@scalar/workspace-store/resolve";
|
|
6
|
+
import { isArraySchema as s } from "@scalar/workspace-store/schemas/v3.2/strict/type-guards";
|
|
7
|
+
import { isDefined as c } from "@scalar/helpers/array/is-defined";
|
|
8
|
+
import { unescapeJsonPointerSegment as l } from "@scalar/helpers/json/unescape-json-pointer-segment";
|
|
9
9
|
// src/schema/helpers/get-compositions-to-render.ts
|
|
10
|
-
var
|
|
11
|
-
if (
|
|
12
|
-
let
|
|
13
|
-
if (!
|
|
14
|
-
let
|
|
15
|
-
if (!
|
|
16
|
-
let
|
|
17
|
-
let
|
|
18
|
-
if (i) return
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
var u = (e) => e.startsWith("#/") || e.includes("/") ? e : `#/components/schemas/${e}`, d = (n, r, i) => {
|
|
11
|
+
if (n.oneOf || n.anyOf) return null;
|
|
12
|
+
let s = n.discriminator?.mapping;
|
|
13
|
+
if (!s) return null;
|
|
14
|
+
let d = a(r);
|
|
15
|
+
if (!d?.components?.schemas) return null;
|
|
16
|
+
let f = (i ?? Object.values(s)).filter((e) => typeof e == "string").map((n) => {
|
|
17
|
+
let r = u(n), i = e(r);
|
|
18
|
+
if (!i) return;
|
|
19
|
+
let a = l(i), s = o.schema(d.components?.schemas?.[a]);
|
|
20
|
+
if (s) return {
|
|
21
|
+
$ref: r,
|
|
22
|
+
"$ref-value": s,
|
|
23
|
+
...!s.title && !s.name && a !== t(r) ? { name: a } : {}
|
|
21
24
|
};
|
|
22
|
-
}).filter(
|
|
23
|
-
return
|
|
24
|
-
...
|
|
25
|
-
oneOf:
|
|
25
|
+
}).filter(c);
|
|
26
|
+
return f.length === 0 ? null : {
|
|
27
|
+
...o.schema(n),
|
|
28
|
+
oneOf: f
|
|
26
29
|
};
|
|
27
|
-
},
|
|
30
|
+
}, f = (e, t, a = e ? d(e, t) : null) => e ? n.map((t) => t === "oneOf" && a ? {
|
|
28
31
|
composition: t,
|
|
29
|
-
value:
|
|
30
|
-
} :
|
|
32
|
+
value: a
|
|
33
|
+
} : i(e, t) && s(e) && e.items ? {
|
|
31
34
|
composition: t,
|
|
32
|
-
value:
|
|
33
|
-
} : e[t] && !
|
|
35
|
+
value: o.schema(e.items)
|
|
36
|
+
} : e[t] && !r(e, t) ? {
|
|
34
37
|
composition: t,
|
|
35
|
-
value:
|
|
36
|
-
} : null).filter(
|
|
37
|
-
export {
|
|
38
|
+
value: o.schema(e)
|
|
39
|
+
} : null).filter(c) : [];
|
|
40
|
+
export { f as getCompositionsToRender, d as inferDiscriminatorMappingComposition };
|
|
38
41
|
|
|
39
42
|
//# sourceMappingURL=get-compositions-to-render.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-compositions-to-render.js","names":["
|
|
1
|
+
{"version":3,"file":"get-compositions-to-render.js","names":["getRawRefName","getRefName","compositions","hasArrayItemComposition","shouldRenderArrayItemComposition","unwrapForRead","resolve","isArraySchema","isDefined","unescapeJsonPointerSegment","normalizeDiscriminatorMappingRef","value","inferDiscriminatorMappingComposition","documentProp","variantRefs","mapping","document","refs","mappingValue","ref","refName","schemaKey","refValue","getCompositionsToRender","inferredDiscriminatorComposition","composition"],"sources":["../../../src/schema/helpers/get-compositions-to-render.ts"],"sourcesContent":["import { isDefined } from '@scalar/helpers/array/is-defined'\nimport { unescapeJsonPointerSegment } from '@scalar/helpers/json/unescape-json-pointer-segment'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { OpenApiDocument, SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\n\nimport { getRawRefName, getRefName } from './get-ref-name'\nimport { type CompositionKeyword, compositions } from './schema-composition'\nimport { hasArrayItemComposition, shouldRenderArrayItemComposition } from './should-render-array-item-composition'\nimport { unwrapForRead } from './unwrap-for-read'\n\ntype CompositionToRender = {\n composition: CompositionKeyword\n value: SchemaObject\n}\n\ntype DocumentSchemaLookup = Pick<OpenApiDocument, 'components'>\n\nconst normalizeDiscriminatorMappingRef = (value: string) =>\n value.startsWith('#/') || value.includes('/') ? value : `#/components/schemas/${value}`\n\n/**\n * Builds a synthetic `oneOf` composition from a `discriminator.mapping` when the\n * schema declares a mapping but no explicit `oneOf`/`anyOf`. This is the shape\n * NSwag emits for polymorphic types, where the base type is a plain object with\n * a discriminator mapping pointing at the concrete variants.\n *\n * Returns `null` when there is nothing to infer (an explicit composition is\n * already present, no document to resolve refs against, or no resolvable refs).\n */\nexport const inferDiscriminatorMappingComposition = (\n value: SchemaObject,\n documentProp?: DocumentSchemaLookup,\n /** Inheritance can supply ordered variants, including schemas that share a mapped value. */\n variantRefs?: readonly string[],\n): SchemaObject | null => {\n if (value.oneOf || value.anyOf) {\n return null\n }\n\n // A schema without a mapping can never infer anything, so it is checked before the document is\n // touched at all: the document read below is by far the more expensive of the two.\n const mapping = value.discriminator?.mapping\n\n if (!mapping) {\n return null\n }\n\n // Reading `components.schemas` per row through the reactive and detect-changes layers is the\n // dominant cost of this helper, so the document is unwrapped once here. See `unwrapForRead`.\n const document = unwrapForRead(documentProp)\n\n if (!document?.components?.schemas) {\n return null\n }\n\n const refs = (variantRefs ?? Object.values(mapping))\n .filter((mappingValue): mappingValue is string => typeof mappingValue === 'string')\n .map((mappingValue) => {\n const ref = normalizeDiscriminatorMappingRef(mappingValue)\n const refName = getRawRefName(ref)\n if (!refName) {\n return undefined\n }\n\n const schemaKey = unescapeJsonPointerSegment(refName)\n const refValue = resolve.schema(document.components?.schemas?.[schemaKey])\n\n if (!refValue) {\n return undefined\n }\n\n return {\n $ref: ref,\n '$ref-value': refValue,\n // Keep the selected component's name when decoding a literal percent sequence would change it.\n ...(!refValue.title && !refValue.name && schemaKey !== getRefName(ref) ? { name: schemaKey } : {}),\n }\n })\n .filter(isDefined)\n\n if (refs.length === 0) {\n return null\n }\n\n return {\n ...resolve.schema(value),\n oneOf: refs,\n }\n}\n\n/**\n * Computes which compositions should be rendered and with which values\n *\n * @param value - The schema object to check for compositions\n * @returns Array of compositions to render with their values\n */\nexport const getCompositionsToRender = (\n value: SchemaObject | undefined,\n document?: DocumentSchemaLookup,\n /**\n * The `oneOf` inferred from a bare `discriminator.mapping`, when the caller has\n * already computed it. `SchemaProperty` needs the same value to decide whether\n * to suppress the duplicate base object block, so it passes it here to avoid\n * inferring twice. Omit it and it is inferred from `value`.\n */\n inferredDiscriminatorComposition: SchemaObject | null = value\n ? inferDiscriminatorMappingComposition(value, document)\n : null,\n): CompositionToRender[] => {\n if (!value) {\n return []\n }\n\n return compositions\n .map((composition) => {\n if (composition === 'oneOf' && inferredDiscriminatorComposition) {\n return {\n composition,\n value: inferredDiscriminatorComposition,\n }\n }\n\n // Check for array item-level composition first (more specific case)\n if (shouldRenderArrayItemComposition(value, composition) && isArraySchema(value) && value.items) {\n return {\n composition,\n value: resolve.schema(value.items),\n }\n }\n\n // Check for property-level composition\n if (value[composition] && !hasArrayItemComposition(value, composition)) {\n return {\n composition,\n value: resolve.schema(value),\n }\n }\n\n return null\n })\n .filter(isDefined)\n}\n"],"mappings":";;;;;;;;;AAkBA,IAAMU,KAAoCC,MACxCA,EAAM,WAAW,IAAI,KAAKA,EAAM,SAAS,GAAG,IAAIA,IAAQ,wBAAwBA,KAWrEC,KACXD,GACAE,GAEAC,MACwB;CACxB,IAAIH,EAAM,SAASA,EAAM,OACvB,OAAO;CAKT,IAAMI,IAAUJ,EAAM,eAAe;CAErC,IAAI,CAACI,GACH,OAAO;CAKT,IAAMC,IAAWX,EAAcQ,CAAY;CAE3C,IAAI,CAACG,GAAU,YAAY,SACzB,OAAO;CAGT,IAAMC,KAAQH,KAAe,OAAO,OAAOC,CAAO,EAAA,CAC/C,QAAQG,MAAyC,OAAOA,KAAiB,QAAQ,CAAC,CAClF,KAAKA,MAAiB;EACrB,IAAMC,IAAMT,EAAiCQ,CAAY,GACnDE,IAAUpB,EAAcmB,CAAG;EACjC,IAAI,CAACC,GACH;EAGF,IAAMC,IAAYZ,EAA2BW,CAAO,GAC9CE,IAAWhB,EAAQ,OAAOU,EAAS,YAAY,UAAUK,EAAU;EAEzE,IAAKC,GAIL,OAAO;GACL,MAAMH;GACN,cAAcG;GAEd,GAAI,CAACA,EAAS,SAAS,CAACA,EAAS,QAAQD,MAAcpB,EAAWkB,CAAG,IAAI,EAAE,MAAME,EAAU,IAAI,CAAC;EAClG;CACF,CAAC,CAAC,CACD,OAAOb,CAAS;CAMnB,OAJIS,EAAK,WAAW,IACX,OAGF;EACL,GAAGX,EAAQ,OAAOK,CAAK;EACvB,OAAOM;CACT;AACF,GAQaM,KACXZ,GACAK,GAOAQ,IAAwDb,IACpDC,EAAqCD,GAAOK,CAAQ,IACpD,SAECL,IAIET,EACJ,KAAKuB,MACAA,MAAgB,WAAWD,IACtB;CACLC;CACA,OAAOD;AACT,IAIEpB,EAAiCO,GAAOc,CAAW,KAAKlB,EAAcI,CAAK,KAAKA,EAAM,QACjF;CACLc;CACA,OAAOnB,EAAQ,OAAOK,EAAM,KAAK;AACnC,IAIEA,EAAMc,MAAgB,CAACtB,EAAwBQ,GAAOc,CAAW,IAC5D;CACLA;CACA,OAAOnB,EAAQ,OAAOK,CAAK;AAC7B,IAGK,IACR,CAAC,CACD,OAAOH,CAAS,IA9BV,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-discriminator-values.js","names":["getDiscriminatorValues","ref","mapping","target","value"],"sources":["../../../src/schema/helpers/get-discriminator-values.ts"],"sourcesContent":["import type { DiscriminatorObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\n/** Finds the payload values explicitly mapped to a referenced composition member. */\nexport const getDiscriminatorValues = (ref: string | undefined, mapping: DiscriminatorObject['mapping']): string[] => {\n if (!ref || !mapping) {\n return []\n }\n\n // A mapping can use either a URI reference or a local component name. Match\n // the whole reference so external schemas with the same name stay distinct.\n return Object.entries(mapping)\n .filter(([, target]) => target === ref || `#/components/schemas/${target}` === ref)\n .map(([value]) => value)\n}\n"],"mappings":";AAGA,IAAaA,
|
|
1
|
+
{"version":3,"file":"get-discriminator-values.js","names":["getDiscriminatorValues","ref","mapping","target","value"],"sources":["../../../src/schema/helpers/get-discriminator-values.ts"],"sourcesContent":["import type { DiscriminatorObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\n/** Finds the payload values explicitly mapped to a referenced composition member. */\nexport const getDiscriminatorValues = (ref: string | undefined, mapping: DiscriminatorObject['mapping']): string[] => {\n if (!ref || !mapping) {\n return []\n }\n\n // A mapping can use either a URI reference or a local component name. Match\n // the whole reference so external schemas with the same name stay distinct.\n return Object.entries(mapping)\n .filter(([, target]) => target === ref || `#/components/schemas/${target}` === ref)\n .map(([value]) => value)\n}\n"],"mappings":";AAGA,IAAaA,KAA0BC,GAAyBC,MAC1D,CAACD,KAAO,CAACC,IACJ,CAAC,IAKH,OAAO,QAAQA,CAAO,CAAC,CAC3B,QAAQ,GAAGC,OAAYA,MAAWF,KAAO,wBAAwBE,QAAaF,CAAG,CAAC,CAClF,KAAK,CAACG,OAAWA,CAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-enum-values.js","names":["
|
|
1
|
+
{"version":3,"file":"get-enum-values.js","names":["resolve","isArraySchema","getEnumValues","value","resolvedItems"],"sources":["../../../src/schema/helpers/get-enum-values.ts"],"sourcesContent":["import { resolve } from '@scalar/workspace-store/resolve'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\n\n/**\n * Extract enum values from schema or array items\n *\n * @param value - The schema object to extract enum values from\n * @returns Array of enum values, or empty array if no enum found\n */\nexport const getEnumValues = (value: SchemaObject | undefined): unknown[] => {\n if (!value) {\n return []\n }\n\n // Check for enum directly on the schema\n if (value.enum) {\n return value.enum\n }\n\n // Check for enum in array items (resolving $ref if present)\n if (isArraySchema(value) && typeof value.items === 'object') {\n const resolvedItems = resolve.schema(value.items)\n if (resolvedItems && 'enum' in resolvedItems && resolvedItems.enum) {\n return resolvedItems.enum\n }\n }\n\n return []\n}\n"],"mappings":";;;AAUA,IAAaE,KAAiBC,MAA+C;CAC3E,IAAI,CAACA,GACH,OAAO,CAAC;CAIV,IAAIA,EAAM,MACR,OAAOA,EAAM;CAIf,IAAIF,EAAcE,CAAK,KAAK,OAAOA,EAAM,SAAU,UAAU;EAC3D,IAAMC,IAAgBJ,EAAQ,OAAOG,EAAM,KAAK;EAChD,IAAIC,KAAiB,UAAUA,KAAiBA,EAAc,MAC5D,OAAOA,EAAc;CAEzB;CAEA,OAAO,CAAC;AACV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-property-description.js","names":["TYPE_DESCRIPTIONS","\"date\"","\"password\"","\"base64\"","\"byte\"","\"binary\"","getPropertyDescriptionKey","
|
|
1
|
+
{"version":3,"file":"get-property-description.js","names":["isSchema","TYPE_DESCRIPTIONS","\"date\"","\"password\"","\"base64\"","\"byte\"","\"binary\"","getPropertyDescriptionKey","value","type","typeDescriptions"],"sources":["../../../src/schema/helpers/get-property-description.ts"],"sourcesContent":["import type { ApiReferenceTranslationKey } from '@scalar/types/api-reference'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isSchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\n\ntype SchemaTranslationKey = Extract<ApiReferenceTranslationKey, `schema.${string}`>\n\n// Type descriptions for built-in types\nconst TYPE_DESCRIPTIONS: Record<string, Record<string, SchemaTranslationKey>> = {\n integer: {\n _default: 'schema.typeInteger',\n int32: 'schema.formatInt32',\n int64: 'schema.formatInt64',\n },\n string: {\n 'date': 'schema.formatDate',\n 'date-time': 'schema.formatDateTime',\n 'password': 'schema.formatPassword',\n 'base64': 'schema.formatBase64',\n 'byte': 'schema.formatBase64',\n 'binary': 'schema.formatBinary',\n },\n} as const\n\n/**\n * Get the translation key of the property description from type/format\n *\n * @param value - The schema object to generate description from\n * @returns Translation key or null if no description available\n */\nexport const getPropertyDescriptionKey = (value: SchemaObject | undefined): SchemaTranslationKey | null => {\n if (!isSchema(value)) {\n return null\n }\n /** Just grab the first type from the array if it's an array */\n const type = Array.isArray(value.type) ? value.type[0] : value.type\n if (!type) {\n return null\n }\n\n const typeDescriptions = TYPE_DESCRIPTIONS[type]\n if (!typeDescriptions) {\n return null\n }\n\n const format =\n ('format' in value && value.format) || ('contentEncoding' in value && value.contentEncoding) || '_default'\n return typeDescriptions[format] ?? null\n}\n"],"mappings":";;AAOA,IAAMC,IAA0E;CAC9E,SAAS;EACP,UAAU;EACV,OAAO;EACP,OAAO;CACT;CACA,QAAQ;EACNC,MAAQ;EACR,aAAa;EACbC,UAAY;EACZC,QAAU;EACVC,MAAQ;EACRC,QAAU;CACZ;AACF,GAQaC,KAA6BC,MAAiE;CACzG,IAAI,CAACR,EAASQ,CAAK,GACjB,OAAO;CAGT,IAAMC,IAAO,MAAM,QAAQD,EAAM,IAAI,IAAIA,EAAM,KAAK,KAAKA,EAAM;CAC/D,IAAI,CAACC,GACH,OAAO;CAGT,IAAMC,IAAmBT,EAAkBQ;CAO3C,OANKC,IAMEA,EADJ,YAAYF,KAASA,EAAM,UAAY,qBAAqBA,KAASA,EAAM,mBAAoB,eAC/D,OAL1B;AAMX"}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
+
export declare const COMPONENT_SCHEMAS_REF_PREFIX = "#/components/schemas/";
|
|
2
|
+
/** Decode a reference fragment and read its JSON Pointer segments. */
|
|
3
|
+
export declare const getRefPointer: (ref: string) => string[] | undefined;
|
|
4
|
+
/** Read the final reference segment as written in the original reference. */
|
|
5
|
+
export declare const getRawRefName: (ref: string) => string | null;
|
|
6
|
+
/** Read the display name from a reference with an already parsed pointer. */
|
|
7
|
+
export declare const getRefNameFromPointer: (ref: string, pointer: string[] | undefined) => string | null;
|
|
1
8
|
/**
|
|
2
9
|
* Gets the final reference segment for display, including external references.
|
|
3
|
-
* Use getSchemaRefName when the name must link to a local model.
|
|
4
10
|
*
|
|
5
|
-
* @example
|
|
11
|
+
* @example
|
|
12
|
+
* getRefName('#/components/schemas/Result%601') // 'Result`1'
|
|
6
13
|
*/
|
|
7
|
-
export declare const getRefName: (ref: string) => string | null
|
|
14
|
+
export declare const getRefName: (ref: string) => string | null;
|
|
15
|
+
/** Read the model key from a direct components.schemas pointer. */
|
|
16
|
+
export declare const getSchemaNameFromPointer: (pointer: string[] | undefined) => string | null;
|
|
8
17
|
/**
|
|
9
|
-
* Gets the models-section key for a
|
|
10
|
-
*
|
|
18
|
+
* Gets the models-section key for a direct `#/components/schemas/` reference.
|
|
19
|
+
* The key is percent-decoded and JSON Pointer escapes `~0` and `~1` are unescaped.
|
|
11
20
|
*
|
|
12
21
|
* The models index used for navigation is built exclusively from
|
|
13
22
|
* `components.schemas`, so a ref into any other bucket (`parameters`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-ref-name.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/get-ref-name.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-ref-name.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/get-ref-name.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,4BAA4B,0BAA0B,CAAA;AAEnE,sEAAsE;AACtE,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,KAAG,MAAM,EAAE,GAAG,SAGtD,CAAA;AAED,6EAA6E;AAC7E,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,IAA8C,CAAA;AAEnG,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,KAAG,MAAM,GAAG,IAK3F,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,IAAsD,CAAA;AAExG,mEAAmE;AACnE,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,EAAE,GAAG,SAAS,KAAG,MAAM,GAAG,IAKjF,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,IAC4C,CAAA"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { decodeUriFragment as e } from "@scalar/helpers/json/decode-uri-fragment";
|
|
2
|
+
import { parseDecodedJsonPointer as t } from "@scalar/helpers/json/parse-decoded-json-pointer";
|
|
3
|
+
import { REGEX as n } from "@scalar/helpers/regex/regex-helpers";
|
|
2
4
|
// src/schema/helpers/get-ref-name.ts
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (!e) return null;
|
|
9
|
-
let t = e.match(n);
|
|
10
|
-
return t?.[1] ? decodeURIComponent(t[1]) : null;
|
|
11
|
-
};
|
|
12
|
-
export { t as getRefName, r as getSchemaRefName };
|
|
5
|
+
var r = "#/components/schemas/", i = (n) => {
|
|
6
|
+
let r = n.indexOf("#");
|
|
7
|
+
return r === -1 ? void 0 : t(e(n.slice(r + 1)));
|
|
8
|
+
}, a = (e) => e.match(n.REF_NAME)?.[1] ?? null, o = (e, t) => t?.length ? t.at(-1) || null : a(e), s = (e) => o(e, i(e)), c = (e) => e?.length === 3 && e[0] === "components" && e[1] === "schemas" && e[2] || null, l = (e) => e.startsWith("#/components/schemas/") ? c(i(e)) : null;
|
|
9
|
+
export { r as COMPONENT_SCHEMAS_REF_PREFIX, a as getRawRefName, s as getRefName, o as getRefNameFromPointer, i as getRefPointer, c as getSchemaNameFromPointer, l as getSchemaRefName };
|
|
13
10
|
|
|
14
11
|
//# sourceMappingURL=get-ref-name.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-ref-name.js","names":["
|
|
1
|
+
{"version":3,"file":"get-ref-name.js","names":["decodeUriFragment","parseDecodedJsonPointer","REGEX","COMPONENT_SCHEMAS_REF_PREFIX","getRefPointer","ref","fragmentStart","getRawRefName","getRefNameFromPointer","pointer","getRefName","getSchemaNameFromPointer","getSchemaRefName"],"sources":["../../../src/schema/helpers/get-ref-name.ts"],"sourcesContent":["import { decodeUriFragment } from '@scalar/helpers/json/decode-uri-fragment'\nimport { parseDecodedJsonPointer } from '@scalar/helpers/json/parse-decoded-json-pointer'\nimport { REGEX } from '@scalar/helpers/regex/regex-helpers'\n\nexport const COMPONENT_SCHEMAS_REF_PREFIX = '#/components/schemas/'\n\n/** Decode a reference fragment and read its JSON Pointer segments. */\nexport const getRefPointer = (ref: string): string[] | undefined => {\n const fragmentStart = ref.indexOf('#')\n return fragmentStart === -1 ? undefined : parseDecodedJsonPointer(decodeUriFragment(ref.slice(fragmentStart + 1)))\n}\n\n/** Read the final reference segment as written in the original reference. */\nexport const getRawRefName = (ref: string): string | null => ref.match(REGEX.REF_NAME)?.[1] ?? null\n\n/** Read the display name from a reference with an already parsed pointer. */\nexport const getRefNameFromPointer = (ref: string, pointer: string[] | undefined): string | null => {\n if (pointer?.length) {\n return pointer.at(-1) || null\n }\n return getRawRefName(ref)\n}\n\n/**\n * Gets the final reference segment for display, including external references.\n *\n * @example\n * getRefName('#/components/schemas/Result%601') // 'Result`1'\n */\nexport const getRefName = (ref: string): string | null => getRefNameFromPointer(ref, getRefPointer(ref))\n\n/** Read the model key from a direct components.schemas pointer. */\nexport const getSchemaNameFromPointer = (pointer: string[] | undefined): string | null => {\n if (pointer?.length === 3 && pointer[0] === 'components' && pointer[1] === 'schemas') {\n return pointer[2] || null\n }\n return null\n}\n\n/**\n * Gets the models-section key for a direct `#/components/schemas/` reference.\n * The key is percent-decoded and JSON Pointer escapes `~0` and `~1` are unescaped.\n *\n * The models index used for navigation is built exclusively from\n * `components.schemas`, so a ref into any other bucket (`parameters`,\n * `responses`, ...) or an external file (`./other.yaml#/Foo`) has no navigable\n * target. Returning `null` for those keeps the name visible as plain text while\n * avoiding a dead link.\n *\n * @example\n * getSchemaRefName('#/components/schemas/Planet') // 'Planet'\n * getSchemaRefName('#/components/parameters/Planet') // null\n * getSchemaRefName('./planets.yaml#/Planet') // null\n */\nexport const getSchemaRefName = (ref: string): string | null =>\n ref.startsWith(COMPONENT_SCHEMAS_REF_PREFIX) ? getSchemaNameFromPointer(getRefPointer(ref)) : null\n"],"mappings":";;;;AAIA,IAAaG,IAA+B,yBAG/BC,KAAiBC,MAAsC;CAClE,IAAMC,IAAgBD,EAAI,QAAQ,GAAG;CACrC,OAAOC,MAAkB,KAAK,KAAA,IAAYL,EAAwBD,EAAkBK,EAAI,MAAMC,IAAgB,CAAC,CAAC,CAAC;AACnH,GAGaC,KAAiBF,MAA+BA,EAAI,MAAMH,EAAM,QAAQ,CAAC,GAAG,MAAM,MAGlFM,KAAyBH,GAAaI,MAC7CA,GAAS,SACJA,EAAQ,GAAG,EAAE,KAAK,OAEpBF,EAAcF,CAAG,GASbK,KAAcL,MAA+BG,EAAsBH,GAAKD,EAAcC,CAAG,CAAC,GAG1FM,KAA4BF,MACnCA,GAAS,WAAW,KAAKA,EAAQ,OAAO,gBAAgBA,EAAQ,OAAO,aAClEA,EAAQ,MAAM,MAoBZG,KAAoBP,MAC/BA,EAAI,WAAA,uBAAuC,IAAIM,EAAyBP,EAAcC,CAAG,CAAC,IAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-rendered-example.js","names":["
|
|
1
|
+
{"version":3,"file":"get-rendered-example.js","names":["isObjectLike","getExampleValue","getResolvedRef","renderedExample","getExampleSummary","entry","seen","current","getRenderedExample","name","preferData","example","selected","value","normalizeRenderedExamples","examples","allowRawObjects","key"],"sources":["../../../src/schema/helpers/get-rendered-example.ts"],"sourcesContent":["import { isObjectLike } from '@scalar/helpers/object/is-object'\nimport { getExampleValue } from '@scalar/workspace-store/helpers/get-example-value'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\n\n/** Only renderer-created wrappers carry this marker; JSON payload fields remain ordinary data. */\nconst renderedExample = Symbol('rendered-example')\n\n/** Display metadata stays separate from the selected payload, including payloads with a `value` field. */\nexport type RenderedExample = {\n [renderedExample]: true\n name?: string\n summary?: string\n value: unknown\n}\n\n/** Find the nearest summary annotation, including overrides on a chain of references. */\nexport const getExampleSummary = (entry: unknown): string | undefined => {\n const seen = new Set<unknown>()\n let current = entry\n while (isObjectLike(current) && !seen.has(current)) {\n if (typeof current.summary === 'string') {\n return current.summary\n }\n seen.add(current)\n current = getResolvedRef(current)\n }\n return undefined\n}\n\n/** Resolve a named Example Object once, preserving its label and the existing value preference. */\nexport const getRenderedExample = (entry: unknown, name?: string, preferData = false): RenderedExample | undefined => {\n const example = getResolvedRef(entry)\n if (!isObjectLike(example)) {\n return example === undefined ? undefined : { [renderedExample]: true, name, value: example }\n }\n const selected =\n preferData && example.dataValue !== undefined ? { value: example.dataValue } : getExampleValue(example)\n // Display the URL until the bundler has loaded an external example's payload.\n const value = selected ? selected.value : example.externalValue\n return value === undefined\n ? undefined\n : {\n [renderedExample]: true,\n name,\n summary: getExampleSummary(entry),\n value,\n }\n}\n\n/** Schema arrays contain raw payloads; legacy schema maps may also contain raw objects beside Example Objects. */\nexport const normalizeRenderedExamples = (\n examples: unknown,\n { allowRawObjects = false }: { allowRawObjects?: boolean } = {},\n): RenderedExample[] => {\n if (Array.isArray(examples)) {\n return examples\n .filter((value) => value !== undefined)\n .map((value: unknown) => {\n if (isObjectLike(value) && renderedExample in value && value[renderedExample] === true) {\n return value as RenderedExample\n }\n return { [renderedExample]: true, value }\n })\n }\n if (isObjectLike(examples)) {\n return Object.entries(examples).flatMap(([name, entry]) => {\n const example = getRenderedExample(entry, name)\n if (example) {\n return [example]\n }\n // Keep legacy schema maps readable without turning unresolved references or empty value fields into payloads.\n if (\n allowRawObjects &&\n isObjectLike(entry) &&\n !['$ref', 'value', 'externalValue', 'dataValue', 'serializedValue'].some((key) => key in entry)\n ) {\n return [{ [renderedExample]: true, name, value: entry }]\n }\n return []\n })\n }\n return []\n}\n"],"mappings":";;;;AAKA,IAAMG,IAAkB,OAAO,kBAAkB,GAWpCC,KAAqBC,MAAuC;CACvE,IAAMC,oBAAO,IAAI,IAAa,GAC1BC,IAAUF;CACd,OAAOL,EAAaO,CAAO,KAAK,CAACD,EAAK,IAAIC,CAAO,IAAG;EAClD,IAAI,OAAOA,EAAQ,WAAY,UAC7B,OAAOA,EAAQ;EAEjBD,EAAK,IAAIC,CAAO,GAChBA,IAAUL,EAAeK,CAAO;CAClC;AAEF,GAGaC,KAAsBH,GAAgBI,GAAeC,IAAa,OAAuC;CACpH,IAAMC,IAAUT,EAAeG,CAAK;CACpC,IAAI,CAACL,EAAaW,CAAO,GACvB,OAAOA,MAAY,KAAA,IAAY,KAAA,IAAY;GAAGR,IAAkB;EAAMM;EAAM,OAAOE;CAAQ;CAE7F,IAAMC,IACJF,KAAcC,EAAQ,cAAc,KAAA,IAAY,EAAE,OAAOA,EAAQ,UAAU,IAAIV,EAAgBU,CAAO,GAElGE,IAAQD,IAAWA,EAAS,QAAQD,EAAQ;CAClD,OAAOE,MAAU,KAAA,IACb,KAAA,IACA;GACGV,IAAkB;EACnBM;EACA,SAASL,EAAkBC,CAAK;EAChCQ;CACF;AACN,GAGaC,KACXC,GACA,EAAEC,qBAAkB,OAAyC,CAAC,MAE1D,MAAM,QAAQD,CAAQ,IACjBA,EACJ,QAAQF,MAAUA,MAAU,KAAA,CAAS,CAAC,CACtC,KAAKA,MACAb,EAAaa,CAAK,KAAKV,KAAmBU,KAASA,EAAMV,OAAqB,KACzEU,IAEF;EAAGV,IAAkB;CAAMU;AAAM,CACzC,IAEDb,EAAae,CAAQ,IAChB,OAAO,QAAQA,CAAQ,CAAC,CAAC,SAAS,CAACN,GAAMJ,OAAW;CACzD,IAAMM,IAAUH,EAAmBH,GAAOI,CAAI;CAY9C,OAXIE,IACK,CAACA,CAAO,IAIfK,KACAhB,EAAaK,CAAK,KAClB,CAAC;EAAC;EAAQ;EAAS;EAAiB;EAAa;CAAiB,CAAC,CAAC,MAAMY,MAAQA,KAAOZ,CAAK,IAEvF,CAAC;GAAGF,IAAkB;EAAMM;EAAM,OAAOJ;CAAM,CAAC,IAElD,CAAC;AACV,CAAC,IAEI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-schema-type.js","names":["formatArrayType","itemType","processArrayType","value","
|
|
1
|
+
{"version":3,"file":"get-schema-type.js","names":["resolve","isArraySchema","formatArrayType","itemType","processArrayType","value","isUnionType","baseType","getSchemaType","valueOrRef","arrayType","otherTypes","t"],"sources":["../../../src/schema/helpers/get-schema-type.ts"],"sourcesContent":["import { resolve } from '@scalar/workspace-store/resolve'\nimport type { ReferenceType, SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\n\n/**\n * Formats an array type string with proper wrapping for union types.\n */\nconst formatArrayType = (itemType: string): string => {\n if (!itemType) {\n return 'array'\n }\n\n const wrappedItemType = itemType.includes(' | ') ? `(${itemType})` : itemType\n return `array ${wrappedItemType}[]`\n}\n\n/**\n * Handles array type processing for both single array types and union types containing array.\n */\nconst processArrayType = (\n value: Extract<SchemaObject, { type: 'array' | string[] }>,\n isUnionType: boolean = false,\n): string => {\n if (!value.items) {\n return 'array'\n }\n\n const itemType = getSchemaType(resolve.schema(value.items))\n const baseType = formatArrayType(itemType)\n\n if (isUnionType) {\n return baseType\n }\n\n // Handle nullable arrays for non-union types\n return (value as any).nullable ? `${baseType} | null` : baseType\n}\n\n/**\n * Computes the structural type for a schema.\n * This helper always returns type information, never schema titles or ref names.\n *\n * Priority order:\n * 1. const values\n * 2. Array types (with special handling for items)\n * 3. type with contentEncoding\n * 4. raw type\n */\nexport const getSchemaType = (valueOrRef: SchemaObject | ReferenceType<SchemaObject>): string => {\n // Early return for falsy values\n if (!valueOrRef) {\n return ''\n }\n\n const value = resolve.schema(valueOrRef)\n\n // Handle const values first (highest priority)\n if (value.const !== undefined) {\n return 'const'\n }\n\n // Handle union types (array of types)\n if ('type' in value && Array.isArray(value.type)) {\n // Special case: union types containing 'array'\n if (value.type.includes('array') && 'items' in value && value.items) {\n const arrayType = processArrayType(value, true)\n const otherTypes = value.type.filter((t) => t !== 'array')\n\n return otherTypes.length > 0 ? `${arrayType} | ${otherTypes.join(' | ')}` : arrayType\n }\n\n // Regular union types\n return value.type.join(' | ')\n }\n\n // Handle single array type\n if (isArraySchema(value)) {\n return processArrayType(value, false)\n }\n\n // Handle type with content encoding\n if ('type' in value && value.type && value.contentEncoding) {\n return `${value.type} • ${value.contentEncoding}`\n }\n\n // Fallback to raw type\n return 'type' in value ? (value.type as string) : ''\n}\n"],"mappings":";;;AAOA,IAAME,KAAmBC,MAClBA,IAKE,SADiBA,EAAS,SAAS,KAAK,IAAI,IAAIA,EAAS,KAAKA,EACrC,MAJvB,SAULC,KACJC,GACAC,IAAuB,OACZ;CACX,IAAI,CAACD,EAAM,OACT,OAAO;CAIT,IAAME,IAAWL,EADAM,EAAcR,EAAQ,OAAOK,EAAM,KAAK,CACxB,CAAQ;CAOzC,OALIC,IACKC,IAIDF,EAAc,WAAW,GAAGE,EAAS,WAAWA;AAC1D,GAYaC,KAAiBC,MAAmE;CAE/F,IAAI,CAACA,GACH,OAAO;CAGT,IAAMJ,IAAQL,EAAQ,OAAOS,CAAU;CAGvC,IAAIJ,EAAM,UAAU,KAAA,GAClB,OAAO;CAIT,IAAI,UAAUA,KAAS,MAAM,QAAQA,EAAM,IAAI,GAAG;EAEhD,IAAIA,EAAM,KAAK,SAAS,OAAO,KAAK,WAAWA,KAASA,EAAM,OAAO;GACnE,IAAMK,IAAYN,EAAiBC,GAAO,EAAI,GACxCM,IAAaN,EAAM,KAAK,QAAQO,MAAMA,MAAM,OAAO;GAEzD,OAAOD,EAAW,SAAS,IAAI,GAAGD,EAAU,KAAKC,EAAW,KAAK,KAAK,MAAMD;EAC9E;EAGA,OAAOL,EAAM,KAAK,KAAK,KAAK;CAC9B;CAaA,OAVIJ,EAAcI,CAAK,IACdD,EAAiBC,GAAO,EAAK,IAIlC,UAAUA,KAASA,EAAM,QAAQA,EAAM,kBAClC,GAAGA,EAAM,KAAK,KAAKA,EAAM,oBAI3B,UAAUA,IAASA,EAAM,OAAkB;AACpD"}
|
|
@@ -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;
|
|
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;AAK/G;;;;;GAKG;AACH,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,CAAA;IAClD,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAwBD;;;;;;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,61 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { formatStructuredValue as e } from "./format-structured-value.js";
|
|
2
|
+
import { getRefName as t } from "./get-ref-name.js";
|
|
3
|
+
import { getResolvedRef as n } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
4
|
+
import { resolve as r } from "@scalar/workspace-store/resolve";
|
|
4
5
|
// src/schema/helpers/get-type-signature-tokens.ts
|
|
5
|
-
var
|
|
6
|
+
var i = 3, a = [
|
|
6
7
|
"x-enumDescriptions",
|
|
7
8
|
"x-enum-descriptions",
|
|
8
9
|
"x-enum-varnames",
|
|
9
10
|
"x-enumNames"
|
|
10
|
-
],
|
|
11
|
+
], o = (t) => typeof t == "string" ? `"${t}"` : e(t) ?? String(t), s = (e) => ({
|
|
11
12
|
kind: "word",
|
|
12
13
|
text: e
|
|
13
|
-
}),
|
|
14
|
+
}), c = (e) => ({
|
|
14
15
|
kind: "ident",
|
|
15
16
|
text: e
|
|
16
|
-
}),
|
|
17
|
+
}), l = (e) => ({
|
|
17
18
|
kind: "literal",
|
|
18
19
|
text: e
|
|
19
|
-
}),
|
|
20
|
+
}), u = () => ({
|
|
20
21
|
kind: "punctuation",
|
|
21
22
|
text: "|"
|
|
22
|
-
}),
|
|
23
|
-
if (!
|
|
24
|
-
let c = o.hideModelNames ?
|
|
23
|
+
}), d = (e, t) => e.flatMap((e, n) => n === 0 ? e : [...t(), ...e]), f = (e, o = {}, s = !1) => {
|
|
24
|
+
if (!e || typeof e != "object" || "$ref" in e && typeof e.$ref == "string" && !o.hideModelNames && t(e.$ref)) return !1;
|
|
25
|
+
let c = o.hideModelNames ? r.schema(e) : n(e);
|
|
25
26
|
if (!c || typeof c != "object" || c.const !== void 0) return !1;
|
|
26
|
-
if (!
|
|
27
|
+
if (!a.some((e) => c[e]) && Array.isArray(c.enum) && c.enum.length > 0 && c.enum.length <= i) return !0;
|
|
27
28
|
if (!s && !("type" in c)) return !1;
|
|
28
|
-
let l = "type" in c ? c.type : void 0, u = l === "array" || Array.isArray(l) && l.includes("array"),
|
|
29
|
-
return u &&
|
|
30
|
-
},
|
|
31
|
-
if (!
|
|
32
|
-
if ("$ref" in
|
|
33
|
-
let
|
|
34
|
-
if (
|
|
29
|
+
let l = "type" in c ? c.type : void 0, u = l === "array" || Array.isArray(l) && l.includes("array"), d = "items" in c ? c.items : void 0;
|
|
30
|
+
return u && d && typeof d == "object" ? f(d, o, !0) : !1;
|
|
31
|
+
}, p = (e, f = {}, p = 0) => {
|
|
32
|
+
if (!e || typeof e != "object") return [];
|
|
33
|
+
if ("$ref" in e && typeof e.$ref == "string") {
|
|
34
|
+
let n = f.hideModelNames ? null : t(e.$ref);
|
|
35
|
+
if (n) return [c(n)];
|
|
35
36
|
}
|
|
36
|
-
let m = f.hideModelNames ?
|
|
37
|
-
return !m || typeof m != "object" ? [] : m.const === void 0 ? Array.isArray(m.enum) && m.enum.length > 0 && m.enum.length <=
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
] : "type" in m && m.type ? [
|
|
42
|
-
},
|
|
43
|
-
let n =
|
|
37
|
+
let m = f.hideModelNames ? r.schema(e) : n(e);
|
|
38
|
+
return !m || typeof m != "object" ? [] : m.const === void 0 ? Array.isArray(m.enum) && m.enum.length > 0 && m.enum.length <= i && !a.some((e) => m[e]) ? d(m.enum.map((e) => [l(o(e))]), () => [s("or")]) : "type" in m && Array.isArray(m.type) ? d(m.type.map((e) => e === "array" ? g(m, f, p) : [c(String(e))]), () => [u()]) : "type" in m && m.type === "array" ? g(m, f, p) : "type" in m && m.type && m.contentEncoding ? [
|
|
39
|
+
c(String(m.type)),
|
|
40
|
+
s("•"),
|
|
41
|
+
c(m.contentEncoding)
|
|
42
|
+
] : "type" in m && m.type ? [c(String(m.type))] : [] : [l(o(m.const))];
|
|
43
|
+
}, m = (e, t = {}) => {
|
|
44
|
+
let n = p(e, { hideModelNames: t.hideModelNames }), r = t.modelName;
|
|
44
45
|
if (t.hideModelNames || !r) return n;
|
|
45
46
|
let i = (e) => !!e && typeof e == "object" && "$ref" in e;
|
|
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 [
|
|
47
|
-
let a = e && typeof e == "object" && "items" in e ? e.items : void 0, o = n[0],
|
|
48
|
-
if ((i(a) || l) && n.length === 2 && o?.kind === "word" &&
|
|
47
|
+
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 [c(r)];
|
|
48
|
+
let a = e && typeof e == "object" && "items" in e ? e.items : void 0, o = n[0], s = n[1], l = a && typeof a == "object" && "type" in a && a.type === "object" && "title" in a && typeof a.title == "string";
|
|
49
|
+
if ((i(a) || l) && n.length === 2 && o?.kind === "word" && s?.kind === "ident" && r.endsWith("[]")) {
|
|
49
50
|
let e = r.slice(0, -2);
|
|
50
|
-
if (e && e !==
|
|
51
|
+
if (e && e !== s.text) return [o, c(e)];
|
|
51
52
|
}
|
|
52
53
|
return n;
|
|
53
|
-
},
|
|
54
|
+
}, h = 8, g = (e, t, n) => {
|
|
54
55
|
let r = "items" in e ? e.items : void 0;
|
|
55
|
-
if (!r || n >=
|
|
56
|
-
let i =
|
|
57
|
-
return i.length === 0 ? [
|
|
56
|
+
if (!r || n >= h) return [c("array")];
|
|
57
|
+
let i = p(r, t, n + 1);
|
|
58
|
+
return i.length === 0 ? [c("array")] : [s("array of"), ...i];
|
|
58
59
|
};
|
|
59
|
-
export {
|
|
60
|
+
export { m as getDisplayTypeSignatureTokens, p as getTypeSignatureTokens, f as typeSignatureInlinesEnum };
|
|
60
61
|
|
|
61
62
|
//# sourceMappingURL=get-type-signature-tokens.js.map
|