@scalar/blocks 0.4.3 → 0.5.0
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 +20 -0
- package/README.md +45 -0
- 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 -0
- 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.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-body.js +51 -45
- package/dist/code-example/helpers/operation-to-har/process-body.js.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/schema/LinkButton.vue.d.ts +14 -0
- package/dist/schema/LinkButton.vue.d.ts.map +1 -0
- package/dist/schema/LinkButton.vue.js +15 -0
- package/dist/schema/LinkButton.vue.js.map +1 -0
- package/dist/schema/RenderString.vue.d.ts +7 -0
- package/dist/schema/RenderString.vue.d.ts.map +1 -0
- package/dist/schema/RenderString.vue.js +7 -0
- package/dist/schema/RenderString.vue.js.map +1 -0
- package/dist/schema/RenderString.vue.script.js +14 -0
- package/dist/schema/RenderString.vue.script.js.map +1 -0
- package/dist/schema/Schema.vue.d.ts +50 -0
- package/dist/schema/Schema.vue.d.ts.map +1 -0
- package/dist/schema/Schema.vue.js +9 -0
- package/dist/schema/Schema.vue.js.map +1 -0
- package/dist/schema/Schema.vue.script.js +234 -0
- package/dist/schema/Schema.vue.script.js.map +1 -0
- package/dist/schema/SchemaCollapsedPreview.vue.d.ts +17 -0
- package/dist/schema/SchemaCollapsedPreview.vue.d.ts.map +1 -0
- package/dist/schema/SchemaCollapsedPreview.vue.js +7 -0
- package/dist/schema/SchemaCollapsedPreview.vue.js.map +1 -0
- package/dist/schema/SchemaCollapsedPreview.vue.script.js +28 -0
- package/dist/schema/SchemaCollapsedPreview.vue.script.js.map +1 -0
- package/dist/schema/SchemaComposition.vue.d.ts +42 -0
- package/dist/schema/SchemaComposition.vue.d.ts.map +1 -0
- package/dist/schema/SchemaComposition.vue.js +9 -0
- package/dist/schema/SchemaComposition.vue.js.map +1 -0
- package/dist/schema/SchemaComposition.vue.script.js +231 -0
- package/dist/schema/SchemaComposition.vue.script.js.map +1 -0
- package/dist/schema/SchemaEnumPropertyItem.vue.d.ts +8 -0
- package/dist/schema/SchemaEnumPropertyItem.vue.d.ts.map +1 -0
- package/dist/schema/SchemaEnumPropertyItem.vue.js +7 -0
- package/dist/schema/SchemaEnumPropertyItem.vue.js.map +1 -0
- package/dist/schema/SchemaEnumPropertyItem.vue.script.js +24 -0
- package/dist/schema/SchemaEnumPropertyItem.vue.script.js.map +1 -0
- package/dist/schema/SchemaEnums.vue.d.ts +11 -0
- package/dist/schema/SchemaEnums.vue.d.ts.map +1 -0
- package/dist/schema/SchemaEnums.vue.js +9 -0
- package/dist/schema/SchemaEnums.vue.js.map +1 -0
- package/dist/schema/SchemaEnums.vue.script.js +78 -0
- package/dist/schema/SchemaEnums.vue.script.js.map +1 -0
- package/dist/schema/SchemaGlyphPuck.vue.d.ts +33 -0
- package/dist/schema/SchemaGlyphPuck.vue.d.ts.map +1 -0
- package/dist/schema/SchemaGlyphPuck.vue.js +7 -0
- package/dist/schema/SchemaGlyphPuck.vue.js.map +1 -0
- package/dist/schema/SchemaGlyphPuck.vue.script.js +30 -0
- package/dist/schema/SchemaGlyphPuck.vue.script.js.map +1 -0
- package/dist/schema/SchemaGutterToggle.vue.d.ts +32 -0
- package/dist/schema/SchemaGutterToggle.vue.d.ts.map +1 -0
- package/dist/schema/SchemaGutterToggle.vue.js +7 -0
- package/dist/schema/SchemaGutterToggle.vue.js.map +1 -0
- package/dist/schema/SchemaGutterToggle.vue.script.js +43 -0
- package/dist/schema/SchemaGutterToggle.vue.script.js.map +1 -0
- package/dist/schema/SchemaHeading.vue.d.ts +9 -0
- package/dist/schema/SchemaHeading.vue.d.ts.map +1 -0
- package/dist/schema/SchemaHeading.vue.js +9 -0
- package/dist/schema/SchemaHeading.vue.js.map +1 -0
- package/dist/schema/SchemaHeading.vue.script.js +35 -0
- package/dist/schema/SchemaHeading.vue.script.js.map +1 -0
- package/dist/schema/SchemaObjectExampleCodeBlock.vue.d.ts +8 -0
- package/dist/schema/SchemaObjectExampleCodeBlock.vue.d.ts.map +1 -0
- package/dist/schema/SchemaObjectExampleCodeBlock.vue.js +7 -0
- package/dist/schema/SchemaObjectExampleCodeBlock.vue.js.map +1 -0
- package/dist/schema/SchemaObjectExampleCodeBlock.vue.script.js +48 -0
- package/dist/schema/SchemaObjectExampleCodeBlock.vue.script.js.map +1 -0
- package/dist/schema/SchemaObjectProperties.vue.d.ts +22 -0
- package/dist/schema/SchemaObjectProperties.vue.d.ts.map +1 -0
- package/dist/schema/SchemaObjectProperties.vue.js +7 -0
- package/dist/schema/SchemaObjectProperties.vue.js.map +1 -0
- package/dist/schema/SchemaObjectProperties.vue.script.js +207 -0
- package/dist/schema/SchemaObjectProperties.vue.script.js.map +1 -0
- package/dist/schema/SchemaProperty.vue.d.ts +88 -0
- package/dist/schema/SchemaProperty.vue.d.ts.map +1 -0
- package/dist/schema/SchemaProperty.vue.js +9 -0
- package/dist/schema/SchemaProperty.vue.js.map +1 -0
- package/dist/schema/SchemaProperty.vue.script.js +456 -0
- package/dist/schema/SchemaProperty.vue.script.js.map +1 -0
- package/dist/schema/SchemaPropertyDefault.vue.d.ts +7 -0
- package/dist/schema/SchemaPropertyDefault.vue.d.ts.map +1 -0
- package/dist/schema/SchemaPropertyDefault.vue.js +9 -0
- package/dist/schema/SchemaPropertyDefault.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyDefault.vue.script.js +64 -0
- package/dist/schema/SchemaPropertyDefault.vue.script.js.map +1 -0
- package/dist/schema/SchemaPropertyDetail.vue.d.ts +22 -0
- package/dist/schema/SchemaPropertyDetail.vue.d.ts.map +1 -0
- package/dist/schema/SchemaPropertyDetail.vue.js +9 -0
- package/dist/schema/SchemaPropertyDetail.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyDetail.vue.script.js +25 -0
- package/dist/schema/SchemaPropertyDetail.vue.script.js.map +1 -0
- package/dist/schema/SchemaPropertyExamples.vue.d.ts +8 -0
- package/dist/schema/SchemaPropertyExamples.vue.d.ts.map +1 -0
- package/dist/schema/SchemaPropertyExamples.vue.js +9 -0
- package/dist/schema/SchemaPropertyExamples.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyExamples.vue.script.js +125 -0
- package/dist/schema/SchemaPropertyExamples.vue.script.js.map +1 -0
- package/dist/schema/SchemaPropertyHeading.vue.d.ts +59 -0
- package/dist/schema/SchemaPropertyHeading.vue.d.ts.map +1 -0
- package/dist/schema/SchemaPropertyHeading.vue.js +9 -0
- package/dist/schema/SchemaPropertyHeading.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyHeading.vue.script.js +270 -0
- package/dist/schema/SchemaPropertyHeading.vue.script.js.map +1 -0
- package/dist/schema/SchemaPropertyPattern.vue.d.ts +7 -0
- package/dist/schema/SchemaPropertyPattern.vue.d.ts.map +1 -0
- package/dist/schema/SchemaPropertyPattern.vue.js +9 -0
- package/dist/schema/SchemaPropertyPattern.vue.js.map +1 -0
- package/dist/schema/SchemaPropertyPattern.vue.script.js +45 -0
- package/dist/schema/SchemaPropertyPattern.vue.script.js.map +1 -0
- package/dist/schema/SchemaRailPanel.vue.d.ts +35 -0
- package/dist/schema/SchemaRailPanel.vue.d.ts.map +1 -0
- package/dist/schema/SchemaRailPanel.vue.js +7 -0
- package/dist/schema/SchemaRailPanel.vue.js.map +1 -0
- package/dist/schema/SchemaRailPanel.vue.script.js +49 -0
- package/dist/schema/SchemaRailPanel.vue.script.js.map +1 -0
- package/dist/schema/components/CopyLinkButton.vue.d.ts +27 -0
- package/dist/schema/components/CopyLinkButton.vue.d.ts.map +1 -0
- package/dist/schema/components/CopyLinkButton.vue.js +7 -0
- package/dist/schema/components/CopyLinkButton.vue.js.map +1 -0
- package/dist/schema/components/CopyLinkButton.vue.script.js +26 -0
- package/dist/schema/components/CopyLinkButton.vue.script.js.map +1 -0
- package/dist/schema/components/WithBreadcrumb.vue.d.ts +19 -0
- package/dist/schema/components/WithBreadcrumb.vue.d.ts.map +1 -0
- package/dist/schema/components/WithBreadcrumb.vue.js +7 -0
- package/dist/schema/components/WithBreadcrumb.vue.js.map +1 -0
- package/dist/schema/components/WithBreadcrumb.vue.script.js +18 -0
- package/dist/schema/components/WithBreadcrumb.vue.script.js.map +1 -0
- package/dist/schema/expansion/index.d.ts +2 -0
- package/dist/schema/expansion/index.d.ts.map +1 -0
- package/dist/schema/expansion/index.js +2 -0
- package/dist/schema/helpers/dynamic-scope.d.ts +27 -0
- package/dist/schema/helpers/dynamic-scope.d.ts.map +1 -0
- package/dist/schema/helpers/dynamic-scope.js +8 -0
- package/dist/schema/helpers/dynamic-scope.js.map +1 -0
- package/dist/schema/helpers/format-example.d.ts +5 -0
- package/dist/schema/helpers/format-example.d.ts.map +1 -0
- package/dist/schema/helpers/format-example.js +12 -0
- package/dist/schema/helpers/format-example.js.map +1 -0
- package/dist/schema/helpers/format-value.d.ts +5 -0
- package/dist/schema/helpers/format-value.d.ts.map +1 -0
- package/dist/schema/helpers/format-value.js +8 -0
- package/dist/schema/helpers/format-value.js.map +1 -0
- package/dist/schema/helpers/get-compositions-to-render.d.ts +33 -0
- package/dist/schema/helpers/get-compositions-to-render.d.ts.map +1 -0
- package/dist/schema/helpers/get-compositions-to-render.js +39 -0
- package/dist/schema/helpers/get-compositions-to-render.js.map +1 -0
- package/dist/schema/helpers/get-discriminator-values.d.ts +4 -0
- package/dist/schema/helpers/get-discriminator-values.d.ts.map +1 -0
- package/dist/schema/helpers/get-discriminator-values.js +6 -0
- package/dist/schema/helpers/get-discriminator-values.js.map +1 -0
- package/dist/schema/helpers/get-enum-values.d.ts +9 -0
- package/dist/schema/helpers/get-enum-values.d.ts.map +1 -0
- package/dist/schema/helpers/get-enum-values.js +16 -0
- package/dist/schema/helpers/get-enum-values.js.map +1 -0
- package/dist/schema/helpers/get-property-description.d.ts +9 -0
- package/dist/schema/helpers/get-property-description.d.ts.map +1 -0
- package/dist/schema/helpers/get-property-description.js +27 -0
- package/dist/schema/helpers/get-property-description.js.map +1 -0
- package/dist/schema/helpers/get-ref-name.d.ts +24 -0
- package/dist/schema/helpers/get-ref-name.d.ts.map +1 -0
- package/dist/schema/helpers/get-ref-name.js +15 -0
- package/dist/schema/helpers/get-ref-name.js.map +1 -0
- package/dist/schema/helpers/get-schema-type.d.ts +13 -0
- package/dist/schema/helpers/get-schema-type.d.ts.map +1 -0
- package/dist/schema/helpers/get-schema-type.js +24 -0
- package/dist/schema/helpers/get-schema-type.js.map +1 -0
- package/dist/schema/helpers/get-type-signature-tokens.d.ts +48 -0
- package/dist/schema/helpers/get-type-signature-tokens.d.ts.map +1 -0
- package/dist/schema/helpers/get-type-signature-tokens.js +62 -0
- package/dist/schema/helpers/get-type-signature-tokens.js.map +1 -0
- package/dist/schema/helpers/has-complex-array-items.d.ts +10 -0
- package/dist/schema/helpers/has-complex-array-items.d.ts.map +1 -0
- package/dist/schema/helpers/has-complex-array-items.js +22 -0
- package/dist/schema/helpers/has-complex-array-items.js.map +1 -0
- package/dist/schema/helpers/index.d.ts +12 -0
- package/dist/schema/helpers/index.d.ts.map +1 -0
- package/dist/schema/helpers/index.js +12 -0
- package/dist/schema/helpers/is-empty-schema-object.d.ts +8 -0
- package/dist/schema/helpers/is-empty-schema-object.d.ts.map +1 -0
- package/dist/schema/helpers/is-empty-schema-object.js +11 -0
- package/dist/schema/helpers/is-empty-schema-object.js.map +1 -0
- package/dist/schema/helpers/is-model-linkable.d.ts +15 -0
- package/dist/schema/helpers/is-model-linkable.d.ts.map +1 -0
- package/dist/schema/helpers/is-model-linkable.js +13 -0
- package/dist/schema/helpers/is-model-linkable.js.map +1 -0
- package/dist/schema/helpers/is-on-schema-target-path.d.ts +3 -0
- package/dist/schema/helpers/is-on-schema-target-path.d.ts.map +1 -0
- package/dist/schema/helpers/is-on-schema-target-path.js +6 -0
- package/dist/schema/helpers/is-on-schema-target-path.js.map +1 -0
- package/dist/schema/helpers/is-type-object.d.ts +5 -0
- package/dist/schema/helpers/is-type-object.d.ts.map +1 -0
- package/dist/schema/helpers/is-type-object.js +15 -0
- package/dist/schema/helpers/is-type-object.js.map +1 -0
- package/dist/schema/helpers/merge-all-of-schemas.d.ts +12 -0
- package/dist/schema/helpers/merge-all-of-schemas.d.ts.map +1 -0
- package/dist/schema/helpers/merge-all-of-schemas.js +151 -0
- package/dist/schema/helpers/merge-all-of-schemas.js.map +1 -0
- package/dist/schema/helpers/normalize-object-composition.d.ts +9 -0
- package/dist/schema/helpers/normalize-object-composition.d.ts.map +1 -0
- package/dist/schema/helpers/normalize-object-composition.js +29 -0
- package/dist/schema/helpers/normalize-object-composition.js.map +1 -0
- package/dist/schema/helpers/optimize-value-for-display.d.ts +13 -0
- package/dist/schema/helpers/optimize-value-for-display.d.ts.map +1 -0
- package/dist/schema/helpers/optimize-value-for-display.js +64 -0
- package/dist/schema/helpers/optimize-value-for-display.js.map +1 -0
- package/dist/schema/helpers/partition-all-of-compositions.d.ts +32 -0
- package/dist/schema/helpers/partition-all-of-compositions.d.ts.map +1 -0
- package/dist/schema/helpers/partition-all-of-compositions.js +67 -0
- package/dist/schema/helpers/partition-all-of-compositions.js.map +1 -0
- package/dist/schema/helpers/schema-composition.d.ts +4 -0
- package/dist/schema/helpers/schema-composition.d.ts.map +1 -0
- package/dist/schema/helpers/schema-composition.js +11 -0
- package/dist/schema/helpers/schema-composition.js.map +1 -0
- package/dist/schema/helpers/schema-cycle.d.ts +31 -0
- package/dist/schema/helpers/schema-cycle.d.ts.map +1 -0
- package/dist/schema/helpers/schema-cycle.js +8 -0
- package/dist/schema/helpers/schema-cycle.js.map +1 -0
- package/dist/schema/helpers/schema-expansion.d.ts +89 -0
- package/dist/schema/helpers/schema-expansion.d.ts.map +1 -0
- package/dist/schema/helpers/schema-expansion.js +93 -0
- package/dist/schema/helpers/schema-expansion.js.map +1 -0
- package/dist/schema/helpers/schema-keyboard-nav.d.ts +23 -0
- package/dist/schema/helpers/schema-keyboard-nav.d.ts.map +1 -0
- package/dist/schema/helpers/schema-keyboard-nav.js +36 -0
- package/dist/schema/helpers/schema-keyboard-nav.js.map +1 -0
- package/dist/schema/helpers/schema-name.d.ts +27 -0
- package/dist/schema/helpers/schema-name.d.ts.map +1 -0
- package/dist/schema/helpers/schema-name.js +40 -0
- package/dist/schema/helpers/schema-name.js.map +1 -0
- package/dist/schema/helpers/should-display-description.d.ts +10 -0
- package/dist/schema/helpers/should-display-description.d.ts.map +1 -0
- package/dist/schema/helpers/should-display-description.js +6 -0
- package/dist/schema/helpers/should-display-description.js.map +1 -0
- package/dist/schema/helpers/should-display-heading.d.ts +11 -0
- package/dist/schema/helpers/should-display-heading.d.ts.map +1 -0
- package/dist/schema/helpers/should-display-heading.js +6 -0
- package/dist/schema/helpers/should-display-heading.js.map +1 -0
- package/dist/schema/helpers/should-render-array-item-composition.d.ts +10 -0
- package/dist/schema/helpers/should-render-array-item-composition.d.ts.map +1 -0
- package/dist/schema/helpers/should-render-array-item-composition.js +12 -0
- package/dist/schema/helpers/should-render-array-item-composition.js.map +1 -0
- package/dist/schema/helpers/sort-property-names.d.ts +23 -0
- package/dist/schema/helpers/sort-property-names.d.ts.map +1 -0
- package/dist/schema/helpers/sort-property-names.js +55 -0
- package/dist/schema/helpers/sort-property-names.js.map +1 -0
- package/dist/schema/helpers/unwrap-for-read.d.ts +48 -0
- package/dist/schema/helpers/unwrap-for-read.d.ts.map +1 -0
- package/dist/schema/helpers/unwrap-for-read.js +8 -0
- package/dist/schema/helpers/unwrap-for-read.js.map +1 -0
- package/dist/schema/index.d.ts +12 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +11 -0
- package/dist/schema/localization/index.d.ts +59 -0
- package/dist/schema/localization/index.d.ts.map +1 -0
- package/dist/schema/localization/index.js +18 -0
- package/dist/schema/localization/index.js.map +1 -0
- package/dist/schema/localization/locales/ar.d.ts +58 -0
- package/dist/schema/localization/locales/ar.d.ts.map +1 -0
- package/dist/schema/localization/locales/ar.js +60 -0
- package/dist/schema/localization/locales/ar.js.map +1 -0
- package/dist/schema/localization/locales/de.d.ts +58 -0
- package/dist/schema/localization/locales/de.d.ts.map +1 -0
- package/dist/schema/localization/locales/de.js +60 -0
- package/dist/schema/localization/locales/de.js.map +1 -0
- package/dist/schema/localization/locales/en.d.ts +58 -0
- package/dist/schema/localization/locales/en.d.ts.map +1 -0
- package/dist/schema/localization/locales/en.js +60 -0
- package/dist/schema/localization/locales/en.js.map +1 -0
- package/dist/schema/localization/locales/es.d.ts +58 -0
- package/dist/schema/localization/locales/es.d.ts.map +1 -0
- package/dist/schema/localization/locales/es.js +60 -0
- package/dist/schema/localization/locales/es.js.map +1 -0
- package/dist/schema/localization/locales/fr.d.ts +58 -0
- package/dist/schema/localization/locales/fr.d.ts.map +1 -0
- package/dist/schema/localization/locales/fr.js +60 -0
- package/dist/schema/localization/locales/fr.js.map +1 -0
- package/dist/schema/localization/locales/pt.d.ts +58 -0
- package/dist/schema/localization/locales/pt.d.ts.map +1 -0
- package/dist/schema/localization/locales/pt.js +60 -0
- package/dist/schema/localization/locales/pt.js.map +1 -0
- package/dist/schema/localization/locales/ru.d.ts +58 -0
- package/dist/schema/localization/locales/ru.d.ts.map +1 -0
- package/dist/schema/localization/locales/ru.js +60 -0
- package/dist/schema/localization/locales/ru.js.map +1 -0
- package/dist/schema/localization/locales/zh-cn.d.ts +58 -0
- package/dist/schema/localization/locales/zh-cn.d.ts.map +1 -0
- package/dist/schema/localization/locales/zh-cn.js +60 -0
- package/dist/schema/localization/locales/zh-cn.js.map +1 -0
- package/dist/schema/localization/translations.d.ts +460 -0
- package/dist/schema/localization/translations.d.ts.map +1 -0
- package/dist/schema/localization/translations.js +23 -0
- package/dist/schema/localization/translations.js.map +1 -0
- package/dist/schema/request-body-composition-index.d.ts +8 -0
- package/dist/schema/request-body-composition-index.d.ts.map +1 -0
- package/dist/schema/request-body-composition-index.js +6 -0
- package/dist/schema/request-body-composition-index.js.map +1 -0
- package/dist/schema/schema-tree.bench.d.ts +2 -0
- package/dist/schema/schema-tree.bench.d.ts.map +1 -0
- package/dist/schema/types.d.ts +51 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/shared/Badge.vue.d.ts +17 -0
- package/dist/shared/Badge.vue.d.ts.map +1 -0
- package/dist/shared/Badge.vue.js +9 -0
- package/dist/shared/Badge.vue.js.map +1 -0
- package/dist/shared/Badge.vue.script.js +16 -0
- package/dist/shared/Badge.vue.script.js.map +1 -0
- package/dist/shared/ScreenReader.vue.d.ts +21 -0
- package/dist/shared/ScreenReader.vue.d.ts.map +1 -0
- package/dist/shared/ScreenReader.vue.js +7 -0
- package/dist/shared/ScreenReader.vue.js.map +1 -0
- package/dist/shared/ScreenReader.vue.script.js +19 -0
- package/dist/shared/ScreenReader.vue.script.js.map +1 -0
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +3 -0
- package/dist/specification-extensions/ExtensionValue.vue.d.ts +13 -0
- package/dist/specification-extensions/ExtensionValue.vue.d.ts.map +1 -0
- package/dist/specification-extensions/ExtensionValue.vue.js +7 -0
- package/dist/specification-extensions/ExtensionValue.vue.js.map +1 -0
- package/dist/specification-extensions/ExtensionValue.vue.script.js +84 -0
- package/dist/specification-extensions/ExtensionValue.vue.script.js.map +1 -0
- package/dist/specification-extensions/SpecificationExtensions.vue.d.ts +9 -0
- package/dist/specification-extensions/SpecificationExtensions.vue.d.ts.map +1 -0
- package/dist/specification-extensions/SpecificationExtensions.vue.js +7 -0
- package/dist/specification-extensions/SpecificationExtensions.vue.js.map +1 -0
- package/dist/specification-extensions/SpecificationExtensions.vue.script.js +21 -0
- package/dist/specification-extensions/SpecificationExtensions.vue.script.js.map +1 -0
- package/dist/specification-extensions/index.d.ts +2 -0
- package/dist/specification-extensions/index.d.ts.map +1 -0
- package/dist/specification-extensions/index.js +2 -0
- package/dist/style.css +576 -15
- package/dist/styles/schema-tree.css +91 -0
- package/dist/styles/tailwind.config.css +22 -0
- package/dist/vue-styles.css +1 -1
- package/package.json +45 -7
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { REQUEST_BODY_COMPOSITION_INDEX_SYMBOL as e } from "./request-body-composition-index.js";
|
|
2
|
+
import { partitionAllOfCompositions as t } from "./helpers/partition-all-of-compositions.js";
|
|
3
|
+
import { getCycleKey as n } from "./helpers/schema-cycle.js";
|
|
4
|
+
import { useLocalization as r } from "./localization/index.js";
|
|
5
|
+
import { getDiscriminatorValues as i } from "./helpers/get-discriminator-values.js";
|
|
6
|
+
import { getSchemaType as a } from "./helpers/get-schema-type.js";
|
|
7
|
+
import { getModelNameWithArray as o } from "./helpers/schema-name.js";
|
|
8
|
+
import s from "./SchemaGlyphPuck.vue.js";
|
|
9
|
+
import c from "./SchemaRailPanel.vue.js";
|
|
10
|
+
import l from "./Schema.vue.js";
|
|
11
|
+
import { Fragment as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createTextVNode as g, createVNode as _, defineComponent as v, inject as y, normalizeClass as b, openBlock as x, ref as S, renderList as C, resolveComponent as w, toDisplayString as T, unref as E, watch as D, withCtx as O } from "vue";
|
|
12
|
+
import { ScalarIconCaretUpDown as k } from "@scalar/icons";
|
|
13
|
+
import { ScalarListbox as A } from "@scalar/components/listbox";
|
|
14
|
+
import { resolve as j } from "@scalar/workspace-store/resolve";
|
|
15
|
+
import { isDefined as M } from "@scalar/helpers/array/is-defined";
|
|
16
|
+
//#region src/schema/SchemaComposition.vue?vue&type=script&setup=true&lang.ts
|
|
17
|
+
var N = { class: "property-rule [.children+&]:mt-1.5!" }, P = {
|
|
18
|
+
class: "composition-selector composition-selector--tree group/tree-control font-code relative flex w-fit max-w-full cursor-pointer items-start gap-1.5 py-1 text-sm",
|
|
19
|
+
type: "button"
|
|
20
|
+
}, F = { class: "text-c-1 shrink-0 [font-weight:var(--scalar-bold)] whitespace-nowrap" }, I = ["title"], L = {
|
|
21
|
+
key: 0,
|
|
22
|
+
class: "text-red"
|
|
23
|
+
}, R = /*@__PURE__*/ v({
|
|
24
|
+
__name: "SchemaComposition",
|
|
25
|
+
props: {
|
|
26
|
+
composition: {},
|
|
27
|
+
discriminator: {},
|
|
28
|
+
name: {},
|
|
29
|
+
schema: {},
|
|
30
|
+
level: {},
|
|
31
|
+
depth: { default: 0 },
|
|
32
|
+
compact: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: !1
|
|
35
|
+
},
|
|
36
|
+
hideHeading: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: !1
|
|
39
|
+
},
|
|
40
|
+
hideModelNames: { type: Boolean },
|
|
41
|
+
breadcrumb: {},
|
|
42
|
+
eventBus: {},
|
|
43
|
+
options: {},
|
|
44
|
+
schemaContext: {},
|
|
45
|
+
compositionPath: {},
|
|
46
|
+
scrollTargetId: {},
|
|
47
|
+
specificationExtension: {},
|
|
48
|
+
expansion: {}
|
|
49
|
+
},
|
|
50
|
+
setup(v) {
|
|
51
|
+
let R = v, { translate: z } = r(), B = d(() => R.composition === "allOf" ? t(R.schema).segments : []), V = d(() => [R.schema[R.composition]].flat().map((e) => ({
|
|
52
|
+
value: j.schema(e),
|
|
53
|
+
original: e
|
|
54
|
+
})).filter((e) => M(e.value))), H = d(() => V.value.map((e, t) => {
|
|
55
|
+
let n = j.schema(e.original), r = (o(n)?.label ?? a(n)) || z("schema.schema"), s = (R.schema.discriminator ?? R.discriminator)?.mapping, c = i(n.$ref, s);
|
|
56
|
+
return {
|
|
57
|
+
id: String(t),
|
|
58
|
+
label: c.length ? `${c.join(", ")} · ${r}` : r
|
|
59
|
+
};
|
|
60
|
+
})), U = d(() => R.compositionPath?.length ? [...R.compositionPath, R.composition].join(".") : ""), W = y(e, void 0), G = d(() => {
|
|
61
|
+
if (R.schemaContext !== "requestBody" || !W?.value || !U.value) return 0;
|
|
62
|
+
let e = W.value[U.value];
|
|
63
|
+
return typeof e != "number" || Number.isNaN(e) ? 0 : Math.max(0, Math.min(e, H.value.length - 1));
|
|
64
|
+
}), K = S();
|
|
65
|
+
D([H, G], ([e, t]) => {
|
|
66
|
+
(!K.value || !e.some((e) => e.id === K.value?.id)) && (K.value = e[t] ?? e[0]);
|
|
67
|
+
}, { immediate: !0 });
|
|
68
|
+
let q = (e) => z(`schema.${e}`), J = d(() => V.value[Number(K.value?.id ?? "0")]?.value), Y = d(() => R.schemaContext === "requestBody" && R.compositionPath?.length === 1), X = d(() => n(V.value[Number(K.value?.id ?? "0")]?.original)), Z = S(!!R.options.expandAllSchemaProperties);
|
|
69
|
+
return W && R.schemaContext === "requestBody" && U.value && D(K, (e) => {
|
|
70
|
+
let t = e ? Number(e.id) : 0;
|
|
71
|
+
Number.isNaN(t) || (W.value = {
|
|
72
|
+
...W.value,
|
|
73
|
+
[U.value]: t
|
|
74
|
+
});
|
|
75
|
+
}, { immediate: !0 }), (e, t) => {
|
|
76
|
+
let n = w("SchemaComposition", !0);
|
|
77
|
+
return x(), m("div", N, [R.composition === "allOf" ? (x(!0), m(u, { key: 0 }, C(B.value, (e, t) => (x(), m(u, { key: t }, [e.kind === "object" ? (x(), f(l, {
|
|
78
|
+
key: 0,
|
|
79
|
+
breadcrumb: v.breadcrumb,
|
|
80
|
+
compact: v.compact,
|
|
81
|
+
compositionPath: v.compositionPath,
|
|
82
|
+
depth: v.depth,
|
|
83
|
+
discriminator: v.discriminator,
|
|
84
|
+
eventBus: v.eventBus,
|
|
85
|
+
expansion: v.expansion,
|
|
86
|
+
hideDescription: Y.value,
|
|
87
|
+
hideHeading: v.hideHeading,
|
|
88
|
+
hideModelNames: v.hideModelNames,
|
|
89
|
+
level: v.level + 1,
|
|
90
|
+
name: v.name,
|
|
91
|
+
noncollapsible: !0,
|
|
92
|
+
options: v.options,
|
|
93
|
+
schema: e.schema,
|
|
94
|
+
schemaContext: v.schemaContext,
|
|
95
|
+
scrollTargetId: v.scrollTargetId,
|
|
96
|
+
specificationExtension: v.specificationExtension
|
|
97
|
+
}, null, 8, [
|
|
98
|
+
"breadcrumb",
|
|
99
|
+
"compact",
|
|
100
|
+
"compositionPath",
|
|
101
|
+
"depth",
|
|
102
|
+
"discriminator",
|
|
103
|
+
"eventBus",
|
|
104
|
+
"expansion",
|
|
105
|
+
"hideDescription",
|
|
106
|
+
"hideHeading",
|
|
107
|
+
"hideModelNames",
|
|
108
|
+
"level",
|
|
109
|
+
"name",
|
|
110
|
+
"options",
|
|
111
|
+
"schema",
|
|
112
|
+
"schemaContext",
|
|
113
|
+
"scrollTargetId",
|
|
114
|
+
"specificationExtension"
|
|
115
|
+
])) : (x(), f(n, {
|
|
116
|
+
key: 1,
|
|
117
|
+
breadcrumb: v.breadcrumb,
|
|
118
|
+
compact: v.compact,
|
|
119
|
+
composition: e.composition,
|
|
120
|
+
compositionPath: [...v.compositionPath ?? [], String(e.choiceIndex)],
|
|
121
|
+
depth: v.depth,
|
|
122
|
+
eventBus: v.eventBus,
|
|
123
|
+
expansion: v.expansion,
|
|
124
|
+
hideHeading: v.hideHeading,
|
|
125
|
+
hideModelNames: v.hideModelNames,
|
|
126
|
+
level: v.level,
|
|
127
|
+
options: v.options,
|
|
128
|
+
schema: e.value,
|
|
129
|
+
schemaContext: v.schemaContext,
|
|
130
|
+
scrollTargetId: v.scrollTargetId,
|
|
131
|
+
specificationExtension: v.specificationExtension
|
|
132
|
+
}, null, 8, [
|
|
133
|
+
"breadcrumb",
|
|
134
|
+
"compact",
|
|
135
|
+
"composition",
|
|
136
|
+
"compositionPath",
|
|
137
|
+
"depth",
|
|
138
|
+
"eventBus",
|
|
139
|
+
"expansion",
|
|
140
|
+
"hideHeading",
|
|
141
|
+
"hideModelNames",
|
|
142
|
+
"level",
|
|
143
|
+
"options",
|
|
144
|
+
"schema",
|
|
145
|
+
"schemaContext",
|
|
146
|
+
"scrollTargetId",
|
|
147
|
+
"specificationExtension"
|
|
148
|
+
]))], 64))), 128)) : (x(), f(c, {
|
|
149
|
+
key: 1,
|
|
150
|
+
class: "composition-panel composition-panel--tree mt-1 mb-0.5",
|
|
151
|
+
depth: v.depth + 1
|
|
152
|
+
}, {
|
|
153
|
+
default: O(() => [_(E(A), {
|
|
154
|
+
modelValue: K.value,
|
|
155
|
+
"onUpdate:modelValue": t[0] ||= (e) => K.value = e,
|
|
156
|
+
class: "w-fit max-w-full min-w-40",
|
|
157
|
+
options: H.value
|
|
158
|
+
}, {
|
|
159
|
+
default: O(() => [h("button", P, [
|
|
160
|
+
_(s, {
|
|
161
|
+
anchor: "line",
|
|
162
|
+
class: "composition-selector-icon mt-1"
|
|
163
|
+
}, {
|
|
164
|
+
default: O(() => [_(E(k))]),
|
|
165
|
+
_: 1
|
|
166
|
+
}),
|
|
167
|
+
h("span", F, T(q(R.composition)), 1),
|
|
168
|
+
t[2] ||= h("span", {
|
|
169
|
+
"aria-hidden": "true",
|
|
170
|
+
class: "text-c-3 shrink-0"
|
|
171
|
+
}, "·", -1),
|
|
172
|
+
h("span", {
|
|
173
|
+
class: b(["composition-selector-label text-c-1 min-w-0 truncate [font-weight:var(--scalar-bold)]", { "line-through": J.value?.deprecated }]),
|
|
174
|
+
title: K.value?.label || E(z)("schema.schema")
|
|
175
|
+
}, T(K.value?.label || E(z)("schema.schema")), 11, I),
|
|
176
|
+
J.value?.deprecated ? (x(), m("div", L, T(E(z)("schema.deprecated")), 1)) : p("", !0)
|
|
177
|
+
])]),
|
|
178
|
+
_: 1
|
|
179
|
+
}, 8, ["modelValue", "options"]), !Z.value && v.level > 2 ? (x(), m("button", {
|
|
180
|
+
key: 0,
|
|
181
|
+
class: "composition-details-toggle group/tree-control font-code text-c-1 relative flex w-fit cursor-pointer items-center py-1.5 text-sm font-normal",
|
|
182
|
+
type: "button",
|
|
183
|
+
onClick: t[1] ||= (e) => Z.value = !0
|
|
184
|
+
}, [_(s), g(" " + T(E(z)("schema.showSchemaDetails")), 1)])) : (x(), f(l, {
|
|
185
|
+
key: K.value?.id ?? "0",
|
|
186
|
+
breadcrumb: v.breadcrumb,
|
|
187
|
+
compact: v.compact,
|
|
188
|
+
compositionPath: v.compositionPath,
|
|
189
|
+
cycleKey: X.value,
|
|
190
|
+
depth: v.depth + 1,
|
|
191
|
+
discriminator: v.discriminator,
|
|
192
|
+
eventBus: v.eventBus,
|
|
193
|
+
expansion: v.expansion,
|
|
194
|
+
hideHeading: v.hideHeading,
|
|
195
|
+
hideModelNames: v.hideModelNames,
|
|
196
|
+
level: v.level + 1,
|
|
197
|
+
name: v.name,
|
|
198
|
+
noncollapsible: !0,
|
|
199
|
+
options: v.options,
|
|
200
|
+
schema: J.value,
|
|
201
|
+
schemaContext: v.schemaContext,
|
|
202
|
+
scrollTargetId: v.scrollTargetId,
|
|
203
|
+
specificationExtension: v.specificationExtension
|
|
204
|
+
}, null, 8, [
|
|
205
|
+
"breadcrumb",
|
|
206
|
+
"compact",
|
|
207
|
+
"compositionPath",
|
|
208
|
+
"cycleKey",
|
|
209
|
+
"depth",
|
|
210
|
+
"discriminator",
|
|
211
|
+
"eventBus",
|
|
212
|
+
"expansion",
|
|
213
|
+
"hideHeading",
|
|
214
|
+
"hideModelNames",
|
|
215
|
+
"level",
|
|
216
|
+
"name",
|
|
217
|
+
"options",
|
|
218
|
+
"schema",
|
|
219
|
+
"schemaContext",
|
|
220
|
+
"scrollTargetId",
|
|
221
|
+
"specificationExtension"
|
|
222
|
+
]))]),
|
|
223
|
+
_: 1
|
|
224
|
+
}, 8, ["depth"]))]);
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
//#endregion
|
|
229
|
+
export { R as default };
|
|
230
|
+
|
|
231
|
+
//# sourceMappingURL=SchemaComposition.vue.script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaComposition.vue.script.js","names":[],"sources":["../../src/schema/SchemaComposition.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport {\n ScalarListbox,\n type ScalarListboxOption,\n} from '@scalar/components/listbox'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport { ScalarIconCaretUpDown } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, inject, ref, watch } from 'vue'\n\nimport { getDiscriminatorValues } from './helpers/get-discriminator-values'\nimport { getSchemaType } from './helpers/get-schema-type'\nimport { partitionAllOfCompositions } from './helpers/partition-all-of-compositions'\nimport { type CompositionKeyword } from './helpers/schema-composition'\nimport { getCycleKey } from './helpers/schema-cycle'\nimport { getModelNameWithArray } from './helpers/schema-name'\nimport { useLocalization } from './localization'\nimport {\n REQUEST_BODY_COMPOSITION_INDEX_SYMBOL,\n type RequestBodyCompositionSelection,\n} from './request-body-composition-index'\nimport Schema from './Schema.vue'\nimport SchemaGlyphPuck from './SchemaGlyphPuck.vue'\nimport SchemaRailPanel from './SchemaRailPanel.vue'\nimport type { SchemaOptions, SchemaRenderingProps } from './types'\n\nconst props = withDefaults(\n defineProps<\n {\n /** The composition keyword (oneOf, anyOf, allOf) */\n composition: CompositionKeyword\n /** Optional discriminator object for polymorphic schemas */\n discriminator?: DiscriminatorObject\n /** Optional name for the schema */\n name?: string\n /** The schema value containing the composition */\n schema: SchemaObject\n /** Nesting level for proper indentation */\n level: number\n /** Real nesting depth (see SchemaProperty) */\n depth?: number\n /** Whether to use compact layout */\n compact?: boolean\n /** Whether to hide the heading */\n hideHeading?: boolean\n /** Hide model names in type display */\n hideModelNames?: boolean\n /** Breadcrumb for navigation */\n breadcrumb?: string[]\n /** Event bus emitting actions */\n eventBus: WorkspaceEventBus | null\n /** Move the options into single prop so they are easy to pass around */\n options: SchemaOptions\n /** When \"requestBody\", sync selected index with the example snippet */\n schemaContext?: string\n /** Internal path used to sync nested request body compositions with the code sample */\n compositionPath?: string[]\n } & SchemaRenderingProps\n >(),\n {\n depth: 0,\n compact: false,\n hideHeading: false,\n },\n)\nconst { translate } = useLocalization()\n\n/**\n * Split an `allOf` into an ordered list of segments (object chunks + choice\n * pickers) so multiple mutually-exclusive selections each render their own\n * picker, in the position they were declared, instead of all but the first\n * being dropped and the rest bubbling to the end.\n */\nconst allOfSegments = computed(() =>\n props.composition === 'allOf'\n ? partitionAllOfCompositions(props.schema).segments\n : [],\n)\n\n/** The current composition */\nconst composition = computed(() =>\n [props.schema[props.composition]]\n .flat()\n .map((schema) => ({ value: resolve.schema(schema), original: schema }))\n .filter((it) => isDefined(it.value)),\n)\n\n/**\n * Generate listbox options for the composition selector.\n * Each option represents a schema in the composition with a human-readable label.\n * Prefers schema title/name (including array item models, e.g. `Model[]`) over\n * structural type when present.\n */\nconst listboxOptions = computed((): ScalarListboxOption[] =>\n composition.value.map((schema, index: number) => {\n const resolved = resolve.schema(schema.original!)\n const label =\n (getModelNameWithArray(resolved)?.label ?? getSchemaType(resolved)) ||\n translate('schema.schema')\n const mapping = (props.schema.discriminator ?? props.discriminator)?.mapping\n const values = getDiscriminatorValues(resolved.$ref, mapping)\n return {\n id: String(index),\n label: values.length ? `${values.join(', ')} · ${label}` : label,\n }\n }),\n)\n\nconst compositionSelectionKey = computed(() =>\n props.compositionPath?.length\n ? [...props.compositionPath, props.composition].join('.')\n : '',\n)\n\n/** When this composition is in the request body, sync selection with the example snippet */\nconst requestBodyCompositionSelectionRef = inject(\n REQUEST_BODY_COMPOSITION_INDEX_SYMBOL,\n undefined,\n)\n\nconst initialSelectedIndex = computed(() => {\n if (\n props.schemaContext !== 'requestBody' ||\n !requestBodyCompositionSelectionRef?.value ||\n !compositionSelectionKey.value\n ) {\n return 0\n }\n\n const selectedIndex =\n requestBodyCompositionSelectionRef.value[compositionSelectionKey.value]\n\n if (typeof selectedIndex !== 'number' || Number.isNaN(selectedIndex)) {\n return 0\n }\n\n return Math.max(0, Math.min(selectedIndex, listboxOptions.value.length - 1))\n})\n\n/**\n * Two-way computed property for the selected option.\n * Handles conversion between the selected index and the listbox option format.\n */\nconst selectedOption = ref<ScalarListboxOption | undefined>()\n\nwatch(\n [listboxOptions, initialSelectedIndex],\n ([options, selectedIndex]) => {\n if (\n !selectedOption.value ||\n !options.some((option) => option.id === selectedOption.value?.id)\n ) {\n selectedOption.value = options[selectedIndex] ?? options[0]\n }\n },\n { immediate: true },\n)\n\nconst compositionLabel = (type: CompositionKeyword): string =>\n translate(`schema.${type}`)\n\n/** Inside the currently selected composition */\nconst selectedComposition = computed(\n () => composition.value[Number(selectedOption.value?.id ?? '0')]?.value,\n)\n\n/**\n * The request body card renders the merged `allOf` description on its outer card\n * (see `Schema.vue`), but only for the top-level request body schema. For that\n * single composition we hide the nested merged `Schema`'s description so the text\n * is not shown twice. Nested request-body compositions (deeper properties) are\n * not shown on the outer card and would otherwise lose their description\n * entirely, because the property row already skips it when `allOf` is present.\n *\n * The top-level request body composition is the one whose `compositionPath` is\n * still the request body root (`['requestBody']`); nested compositions append\n * property segments and therefore have a longer path.\n */\nconst isRequestBodyRootComposition = computed(\n () =>\n props.schemaContext === 'requestBody' &&\n props.compositionPath?.length === 1,\n)\n\n/**\n * Cycle key for the selected composition member, derived from its raw\n * (unresolved) value so a member that references an ancestor is detected as a\n * cycle.\n */\nconst selectedCompositionCycleKey = computed(() =>\n getCycleKey(\n composition.value[Number(selectedOption.value?.id ?? '0')]?.original,\n ),\n)\n\n/**\n * Controls whether the nested schema is displayed. When expanding all schema\n * properties we open it by default; the nested Schema handles cycle detection,\n * so finite compositions render fully while recursive ones still stop.\n */\nconst showNestedSchema = ref(!!props.options.expandAllSchemaProperties)\n\nif (\n requestBodyCompositionSelectionRef &&\n props.schemaContext === 'requestBody' &&\n compositionSelectionKey.value\n) {\n watch(\n selectedOption,\n (option) => {\n const index = option ? Number(option.id) : 0\n if (!Number.isNaN(index)) {\n requestBodyCompositionSelectionRef.value = {\n ...requestBodyCompositionSelectionRef.value,\n [compositionSelectionKey.value]: index,\n } satisfies RequestBodyCompositionSelection\n }\n },\n { immediate: true },\n )\n}\n</script>\n\n<template>\n <!-- 6px after a container's children keeps the 12px row rhythm -->\n <div class=\"property-rule [.children+&]:mt-1.5!\">\n <!--\n allOf: render the members in source order — object chunks as fields, each\n oneOf/anyOf group as its own picker in place. Keeps every mutually-exclusive\n selection (mergeAllOfSchemas alone drops all but the first) and preserves the\n position of each choice group among the surrounding fields, flowing inline\n with them as one continuous list (no extra spacing or card).\n -->\n <template v-if=\"props.composition === 'allOf'\">\n <template\n v-for=\"(segment, segmentIndex) in allOfSegments\"\n :key=\"segmentIndex\">\n <Schema\n v-if=\"segment.kind === 'object'\"\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :compositionPath=\"compositionPath\"\n :depth=\"depth\"\n :discriminator=\"discriminator\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideDescription=\"isRequestBodyRootComposition\"\n :hideHeading=\"hideHeading\"\n :hideModelNames\n :level=\"level + 1\"\n :name=\"name\"\n :noncollapsible=\"true\"\n :options=\"options\"\n :schema=\"segment.schema\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n <SchemaComposition\n v-else\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :composition=\"segment.composition\"\n :compositionPath=\"[\n ...(compositionPath ?? []),\n String(segment.choiceIndex),\n ]\"\n :depth=\"depth\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading=\"hideHeading\"\n :hideModelNames\n :level=\"level\"\n :options=\"options\"\n :schema=\"segment.value\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n </template>\n\n <!-- The picker sits on the rail behind a circled icon, like the toggle\n pucks; the chosen variant hangs below in the same panel -->\n <SchemaRailPanel\n v-else\n class=\"composition-panel composition-panel--tree mt-1 mb-0.5\"\n :depth=\"depth + 1\">\n <!-- No `resize`: it would pin the popup to this compact trigger's width.\n The listbox slot must hold exactly ONE node: Headless UI renders its\n button as a fragment and passes props through to the slot root, so\n even an HTML comment in here breaks the picker. The puck is the\n picker's whole affordance: an up/down caret on the rail, like the\n plus on a row, so no trailing caret. -->\n <ScalarListbox\n v-model=\"selectedOption\"\n class=\"w-fit max-w-full min-w-40\"\n :options=\"listboxOptions\">\n <button\n class=\"composition-selector composition-selector--tree group/tree-control font-code relative flex w-fit max-w-full cursor-pointer items-start gap-1.5 py-1 text-sm\"\n type=\"button\">\n <SchemaGlyphPuck\n anchor=\"line\"\n class=\"composition-selector-icon mt-1\">\n <!-- No size of its own: the puck sizes the icons it holds, so this\n one shrinks with the others in a narrow container -->\n <ScalarIconCaretUpDown />\n </SchemaGlyphPuck>\n <!-- Keyword and choice read as one bold name, split by the same `·`\n the tree uses between details -->\n <span\n class=\"text-c-1 shrink-0 [font-weight:var(--scalar-bold)] whitespace-nowrap\"\n >{{ compositionLabel(props.composition) }}</span\n >\n <span\n aria-hidden=\"true\"\n class=\"text-c-3 shrink-0\"\n >·</span\n >\n <span\n class=\"composition-selector-label text-c-1 min-w-0 truncate [font-weight:var(--scalar-bold)]\"\n :class=\"{\n 'line-through': selectedComposition?.deprecated,\n }\"\n :title=\"selectedOption?.label || translate('schema.schema')\">\n {{ selectedOption?.label || translate('schema.schema') }}\n </span>\n <div\n v-if=\"selectedComposition?.deprecated\"\n class=\"text-red\">\n {{ translate('schema.deprecated') }}\n </div>\n </button>\n </ScalarListbox>\n\n <!-- The reveal is one more row of the tree: a plus puck on the rail -->\n <button\n v-if=\"!showNestedSchema && level > 2\"\n class=\"composition-details-toggle group/tree-control font-code text-c-1 relative flex w-fit cursor-pointer items-center py-1.5 text-sm font-normal\"\n type=\"button\"\n @click=\"showNestedSchema = true\">\n <SchemaGlyphPuck />\n {{ translate('schema.showSchemaDetails') }}\n </button>\n\n <!-- Render the selected schema if it has content to display -->\n <Schema\n v-else\n :key=\"selectedOption?.id ?? '0'\"\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :compositionPath=\"compositionPath\"\n :cycleKey=\"selectedCompositionCycleKey\"\n :depth=\"depth + 1\"\n :discriminator=\"discriminator\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading=\"hideHeading\"\n :hideModelNames\n :level=\"level + 1\"\n :name=\"name\"\n :noncollapsible=\"true\"\n :options=\"options\"\n :schema=\"selectedComposition\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </SchemaRailPanel>\n </div>\n</template>\n\n<style scoped>\n/*\n * A `oneOf`/`anyOf` whose chosen variant `allOf`s back to a shared base — most\n * commonly a discriminator-inferred `oneOf` sitting directly on the request body\n * — renders the merged variant one level deeper than a plain object variant:\n * `Schema.vue` cannot flatten the `allOf`, so it hands the merged object to\n * `SchemaProperty`, which wraps it in a headless passthrough row\n * (`.property--tree-container`). That wrapper carries a row's own\n * `--schema-row-pad`, opening a gap between the selector and the first field\n * that a plain `oneOf` does not have, so the variant reads as detached from its\n * picker. Drop that leading row pad for the panel's own variant card so the\n * field sits flush under the selector, matching a plain `oneOf`. Only the top\n * pad goes: the wrapper's trailing pad is what closes the card under the last\n * field, exactly as a plain variant's last row does.\n *\n * The rule lives here rather than in `SchemaProperty` because a body-level\n * discriminator `oneOf` is rendered straight from `Schema.vue` and never passes\n * through `SchemaProperty`, so a rule scoped there would never reach it.\n * See https://github.com/scalar/scalar/issues/9861\n */\n.property-rule\n :deep(\n .composition-panel\n > .schema-card\n > .schema-properties\n > ul\n > li.property.property--tree-container\n ) {\n padding-top: 0 !important;\n}\n</style>\n"],"mappings":"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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
label: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=SchemaEnumPropertyItem.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaEnumPropertyItem.vue.d.ts","sourceRoot":"","sources":["../../src/schema/SchemaEnumPropertyItem.vue"],"names":[],"mappings":"AA8BA,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAC;AAyEF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaEnumPropertyItem.vue.js","names":[],"sources":["../../src/schema/SchemaEnumPropertyItem.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport { ScalarWrappingText } from '@scalar/components/wrapping-text'\n\ndefineProps<{\n label: string\n description?: string\n}>()\n</script>\n\n<template>\n <li class=\"property-enum-row flex flex-col gap-0.5 border-t px-3 py-2\">\n <span class=\"property-enum-row-label font-code text-c-1 text-sm\">\n <ScalarWrappingText\n :text=\"label\"\n preset=\"property\" />\n </span>\n <span\n v-if=\"description\"\n class=\"property-enum-row-description text-c-2 text-(length:--scalar-small) [&_.markdown]:-mb-0.5\">\n <ScalarMarkdown :value=\"description\" />\n </span>\n </li>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createCommentVNode as e, createElementBlock as t, createElementVNode as n, createVNode as r, defineComponent as i, openBlock as a, unref as o } from "vue";
|
|
2
|
+
import { ScalarMarkdown as s } from "@scalar/components/markdown";
|
|
3
|
+
import { ScalarWrappingText as c } from "@scalar/components/wrapping-text";
|
|
4
|
+
//#region src/schema/SchemaEnumPropertyItem.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var l = { class: "property-enum-row flex flex-col gap-0.5 border-t px-3 py-2" }, u = { class: "property-enum-row-label font-code text-c-1 text-sm" }, d = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "property-enum-row-description text-c-2 text-(length:--scalar-small) [&_.markdown]:-mb-0.5"
|
|
8
|
+
}, f = /*@__PURE__*/ i({
|
|
9
|
+
__name: "SchemaEnumPropertyItem",
|
|
10
|
+
props: {
|
|
11
|
+
label: {},
|
|
12
|
+
description: {}
|
|
13
|
+
},
|
|
14
|
+
setup(i) {
|
|
15
|
+
return (f, p) => (a(), t("li", l, [n("span", u, [r(o(c), {
|
|
16
|
+
text: i.label,
|
|
17
|
+
preset: "property"
|
|
18
|
+
}, null, 8, ["text"])]), i.description ? (a(), t("span", d, [r(o(s), { value: i.description }, null, 8, ["value"])])) : e("", !0)]));
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
//#endregion
|
|
22
|
+
export { f as default };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=SchemaEnumPropertyItem.vue.script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaEnumPropertyItem.vue.script.js","names":[],"sources":["../../src/schema/SchemaEnumPropertyItem.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport { ScalarWrappingText } from '@scalar/components/wrapping-text'\n\ndefineProps<{\n label: string\n description?: string\n}>()\n</script>\n\n<template>\n <li class=\"property-enum-row flex flex-col gap-0.5 border-t px-3 py-2\">\n <span class=\"property-enum-row-label font-code text-c-1 text-sm\">\n <ScalarWrappingText\n :text=\"label\"\n preset=\"property\" />\n </span>\n <span\n v-if=\"description\"\n class=\"property-enum-row-description text-c-2 text-(length:--scalar-small) [&_.markdown]:-mb-0.5\">\n <ScalarMarkdown :value=\"description\" />\n </span>\n </li>\n</template>\n"],"mappings":";;;;;;;;;;;;;;yBAWE,EAWK,MAXL,GAWK,CAVH,EAIO,QAJP,GAIO,CAHL,EAEsB,EAAA,CAAA,GAAA;GADnB,MAAM,EAAA;GACP,QAAO;2BAGH,EAAA,eAAA,EAAA,GADR,EAIO,QAJP,GAIO,CADL,EAAuC,EAAA,CAAA,GAAA,EAAtB,OAAO,EAAA,YAAW,GAAA,MAAA,GAAA,CAAA,OAAA,CAAA,CAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** The schema object containing enum values and metadata */
|
|
4
|
+
value: SchemaObject | undefined;
|
|
5
|
+
/** Whether to display the enum for property names */
|
|
6
|
+
propertyNames?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=SchemaEnums.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaEnums.vue.d.ts","sourceRoot":"","sources":["../../src/schema/SchemaEnums.vue"],"names":[],"mappings":"AA2PA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAQhG,KAAK,WAAW,GAAG;IACjB,4DAA4D;IAC5D,KAAK,EAAE,YAAY,GAAG,SAAS,CAAA;IAC/B,qDAAqD;IACrD,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,CAAC;AA2UF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import e from "../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./SchemaEnums.vue.script.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region src/schema/SchemaEnums.vue
|
|
5
|
+
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-1b21ab2e"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=SchemaEnums.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaEnums.vue.js","names":[],"sources":["../../src/schema/SchemaEnums.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { 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'\nimport { computed, ref } from 'vue'\n\nimport { useLocalization } from './localization'\nimport SchemaEnumPropertyItem from './SchemaEnumPropertyItem.vue'\nimport SchemaGlyphPuck from './SchemaGlyphPuck.vue'\n\nconst { value, propertyNames = false } = defineProps<{\n /** The schema object containing enum values and metadata */\n value: SchemaObject | undefined\n /** Whether to display the enum for property names */\n propertyNames?: boolean\n}>()\nconst { translate } = useLocalization()\n\n/**\n * Past this many values the list collapses behind a reveal. 12/8 rather than a\n * tighter pair: with 9/5 a 10-value enum hides half its values.\n */\nconst ENUM_DISPLAY_THRESHOLD = 12\nconst INITIAL_VISIBLE_COUNT = 8\n/** Values at or under this length can render as wrapped chips */\nconst CHIP_MAX_LENGTH = 24\nconst THIN_SPACE = '\\u2009'\n\n/**\n * Resolves the schema that carries the enum values.\n * For arrays, the enum and its x-enum-* metadata live on the items schema, so\n * both the values and their varnames/descriptions have to be read from there.\n */\nconst enumSchema = computed(() => {\n if (!value) {\n return undefined\n }\n if (value.enum) {\n return value\n }\n return isArraySchema(value) ? resolve.schema(value.items) : undefined\n})\n\n/**\n * Extracts enum values from the schema object.\n * Handles both direct enum values and nested enum arrays.\n */\nconst enumValues = computed(() => enumSchema.value?.enum ?? [])\n\n/**\n * Determines if we should show the long enum list UI.\n * When there are many enum values, we initially show only a subset.\n */\nconst shouldUseLongListDisplay = computed(\n () => enumValues.value.length > ENUM_DISPLAY_THRESHOLD,\n)\n\nconst initialVisibleCount = computed(() =>\n shouldUseLongListDisplay.value\n ? INITIAL_VISIBLE_COUNT\n : enumValues.value.length,\n)\n\n/**\n * Short flat enums render as wrapped chips: three lines instead of a 40-row\n * wall. Values with descriptions keep the rows instead.\n *\n * `!shouldUseLongListDisplay` is what bounds the COUNT. Chips have no reveal of\n * their own — the \"show all values\" control is a row of the list below — so a\n * long enum of short values (currency or country codes, hundreds of them)\n * would otherwise render every value at once with no way to collapse it.\n * Past the threshold the rows take over and bring their toggle with them.\n */\nconst shouldRenderAsChips = computed(\n () =>\n !propertyNames &&\n enumValues.value.length > 0 &&\n !shouldUseLongListDisplay.value &&\n enumValues.value.every(\n // Measure the text the chip actually renders (value plus any varname), not\n // the bare value, so a short value with a long x-enum-varname still wraps.\n (entry, index) =>\n formatEnumValueWithName(entry, index).length <= CHIP_MAX_LENGTH,\n ) &&\n !hasAnyDescription.value,\n)\n\n/** Whether any value carries an x-enum description (chips have nowhere to put one) */\nconst hasAnyDescription = computed(() =>\n enumValues.value.some(\n (entry, index) => getEnumValueDescription(entry, index) !== undefined,\n ),\n)\n\nconst visibleEnumValues = computed(() =>\n enumValues.value.slice(0, initialVisibleCount.value),\n)\n\nconst hiddenEnumValues = computed(() =>\n enumValues.value.slice(initialVisibleCount.value),\n)\n\n/**\n * Gets the description for an enum value.\n * Supports both array and object formats for x-enumDescriptions.\n */\nconst getEnumValueDescription = (\n enumValue: any,\n index: number,\n): string | undefined => {\n const schema = enumSchema.value\n const descriptions =\n schema?.['x-enumDescriptions'] ?? schema?.['x-enum-descriptions']\n\n if (!descriptions) {\n return undefined\n }\n\n if (Array.isArray(descriptions)) {\n return descriptions[index] || undefined\n }\n\n if (typeof descriptions === 'object' && descriptions !== null) {\n return descriptions[String(enumValue)] || undefined\n }\n\n return undefined\n}\n\n/**\n * Formats an enum value with its variable name if available.\n * This supports both x-enum-varnames and x-enumNames extensions.\n */\nconst formatEnumValueWithName = (enumValue: any, index: number): string => {\n const varNames =\n enumSchema.value?.['x-enum-varnames'] ?? enumSchema.value?.['x-enumNames']\n const varName = Array.isArray(varNames) ? varNames[index] : undefined\n return varName\n ? `${enumValue}${THIN_SPACE}=${THIN_SPACE}${varName}`\n : String(enumValue)\n}\n\n/**\n * Controls whether the hidden enum values are visible.\n */\nconst isExpanded = ref(false)\n\nconst toggleExpanded = () => {\n isExpanded.value = !isExpanded.value\n}\n</script>\n\n<template>\n <div\n v-if=\"enumSchema?.enum !== undefined\"\n class=\"property-enum property-enum--tree mt-2 rounded-(--scalar-radius-lg) border\">\n <!-- A bordered card with a muted header row and one hairline row per\n value; the chips and the long-list toggle are rows of it too -->\n <div class=\"property-enum-header text-c-2 px-3 py-2 text-sm capitalize\">\n {{\n propertyNames\n ? translate('schema.propertyNames')\n : translate('schema.values')\n }}\n </div>\n <p\n v-if=\"enumValues.length === 0\"\n class=\"text-c-2 border-t px-3 py-2 text-sm\">\n {{ translate('schema.noAllowedValues') }}\n </p>\n <div\n v-else-if=\"shouldRenderAsChips\"\n class=\"property-enum-chip-list flex flex-wrap gap-1 border-t px-3 py-2\"\n role=\"list\">\n <span\n v-for=\"(enumValue, index) in enumValues\"\n :key=\"index\"\n class=\"property-enum-chip font-code text-c-2 rounded-(--scalar-radius-lg) border px-1.5 py-px text-(length:--scalar-mini)\"\n role=\"listitem\">\n {{ formatEnumValueWithName(enumValue, index) }}\n </span>\n </div>\n <ul\n v-else\n class=\"property-enum-values-card\"\n role=\"list\">\n <SchemaEnumPropertyItem\n v-for=\"(enumValue, index) in visibleEnumValues\"\n :key=\"index\"\n :description=\"getEnumValueDescription(enumValue, index)\"\n :label=\"formatEnumValueWithName(enumValue, index)\" />\n\n <template v-if=\"shouldUseLongListDisplay && isExpanded\">\n <SchemaEnumPropertyItem\n v-for=\"(enumValue, index) in hiddenEnumValues\"\n :key=\"initialVisibleCount + index\"\n :description=\"\n getEnumValueDescription(enumValue, initialVisibleCount + index)\n \"\n :label=\"\n formatEnumValueWithName(enumValue, initialVisibleCount + index)\n \" />\n </template>\n\n <li\n v-if=\"shouldUseLongListDisplay\"\n class=\"border-t\">\n <!-- The reveal is a tree control like the row toggles, so it draws the\n same puck and lights it the same way when the row is hovered -->\n <button\n class=\"enum-toggle-button group/tree-control text-c-2 hover:text-c-1 flex w-full cursor-pointer items-center gap-1.5 px-3 py-2 text-sm\"\n type=\"button\"\n @click=\"toggleExpanded\">\n <SchemaGlyphPuck\n :floating=\"false\"\n :open=\"isExpanded\" />\n {{\n isExpanded\n ? translate('schema.hideValues')\n : translate('schema.showAllValues')\n }}\n </button>\n </li>\n </ul>\n </div>\n</template>\n\n<style scoped>\n.property-heading:empty + .property-description:last-of-type,\n.property-description:first-of-type:last-of-type {\n margin-top: 0;\n}\n\n.property-list {\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius);\n margin-top: 10px;\n}\n\n.property-list .property:last-of-type {\n padding-bottom: 10px;\n}\n\n.enum-toggle-button:hover {\n color: var(--scalar-color-1);\n}\n</style>\n"],"mappings":""}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { useLocalization as e } from "./localization/index.js";
|
|
2
|
+
import t from "./SchemaGlyphPuck.vue.js";
|
|
3
|
+
import n from "./SchemaEnumPropertyItem.vue.js";
|
|
4
|
+
import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, openBlock as f, ref as p, renderList as m, toDisplayString as h, unref as g } from "vue";
|
|
5
|
+
import { resolve as _ } from "@scalar/workspace-store/resolve";
|
|
6
|
+
import { isArraySchema as v } from "@scalar/workspace-store/schemas/v3.2/strict/type-guards";
|
|
7
|
+
//#region src/schema/SchemaEnums.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
+
var y = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "property-enum property-enum--tree mt-2 rounded-(--scalar-radius-lg) border"
|
|
11
|
+
}, b = { class: "property-enum-header text-c-2 px-3 py-2 text-sm capitalize" }, x = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "text-c-2 border-t px-3 py-2 text-sm"
|
|
14
|
+
}, S = {
|
|
15
|
+
key: 1,
|
|
16
|
+
class: "property-enum-chip-list flex flex-wrap gap-1 border-t px-3 py-2",
|
|
17
|
+
role: "list"
|
|
18
|
+
}, C = {
|
|
19
|
+
key: 2,
|
|
20
|
+
class: "property-enum-values-card",
|
|
21
|
+
role: "list"
|
|
22
|
+
}, w = {
|
|
23
|
+
key: 1,
|
|
24
|
+
class: "border-t"
|
|
25
|
+
}, T = 12, E = 8, D = 24, O = " ", k = /*@__PURE__*/ d({
|
|
26
|
+
__name: "SchemaEnums",
|
|
27
|
+
props: {
|
|
28
|
+
value: {},
|
|
29
|
+
propertyNames: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: !1
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
setup(d) {
|
|
35
|
+
let { translate: k } = e(), A = i(() => {
|
|
36
|
+
if (d.value) return d.value.enum ? d.value : v(d.value) ? _.schema(d.value.items) : void 0;
|
|
37
|
+
}), j = i(() => A.value?.enum ?? []), M = i(() => j.value.length > T), N = i(() => M.value ? E : j.value.length), P = i(() => !d.propertyNames && j.value.length > 0 && !M.value && j.value.every((e, t) => z(e, t).length <= D) && !F.value), F = i(() => j.value.some((e, t) => R(e, t) !== void 0)), I = i(() => j.value.slice(0, N.value)), L = i(() => j.value.slice(N.value)), R = (e, t) => {
|
|
38
|
+
let n = A.value, r = n?.["x-enumDescriptions"] ?? n?.["x-enum-descriptions"];
|
|
39
|
+
if (r) {
|
|
40
|
+
if (Array.isArray(r)) return r[t] || void 0;
|
|
41
|
+
if (typeof r == "object" && r) return r[String(e)] || void 0;
|
|
42
|
+
}
|
|
43
|
+
}, z = (e, t) => {
|
|
44
|
+
let n = A.value?.["x-enum-varnames"] ?? A.value?.["x-enumNames"], r = Array.isArray(n) ? n[t] : void 0;
|
|
45
|
+
return r ? `${e}${O}=${O}${r}` : String(e);
|
|
46
|
+
}, B = p(!1), V = () => {
|
|
47
|
+
B.value = !B.value;
|
|
48
|
+
};
|
|
49
|
+
return (e, i) => A.value?.enum === void 0 ? o("", !0) : (f(), s("div", y, [c("div", b, h(d.propertyNames ? g(k)("schema.propertyNames") : g(k)("schema.values")), 1), j.value.length === 0 ? (f(), s("p", x, h(g(k)("schema.noAllowedValues")), 1)) : P.value ? (f(), s("div", S, [(f(!0), s(r, null, m(j.value, (e, t) => (f(), s("span", {
|
|
50
|
+
key: t,
|
|
51
|
+
class: "property-enum-chip font-code text-c-2 rounded-(--scalar-radius-lg) border px-1.5 py-px text-(length:--scalar-mini)",
|
|
52
|
+
role: "listitem"
|
|
53
|
+
}, h(z(e, t)), 1))), 128))])) : (f(), s("ul", C, [
|
|
54
|
+
(f(!0), s(r, null, m(I.value, (e, t) => (f(), a(n, {
|
|
55
|
+
key: t,
|
|
56
|
+
description: R(e, t),
|
|
57
|
+
label: z(e, t)
|
|
58
|
+
}, null, 8, ["description", "label"]))), 128)),
|
|
59
|
+
M.value && B.value ? (f(!0), s(r, { key: 0 }, m(L.value, (e, t) => (f(), a(n, {
|
|
60
|
+
key: N.value + t,
|
|
61
|
+
description: R(e, N.value + t),
|
|
62
|
+
label: z(e, N.value + t)
|
|
63
|
+
}, null, 8, ["description", "label"]))), 128)) : o("", !0),
|
|
64
|
+
M.value ? (f(), s("li", w, [c("button", {
|
|
65
|
+
class: "enum-toggle-button group/tree-control text-c-2 hover:text-c-1 flex w-full cursor-pointer items-center gap-1.5 px-3 py-2 text-sm",
|
|
66
|
+
type: "button",
|
|
67
|
+
onClick: V
|
|
68
|
+
}, [u(t, {
|
|
69
|
+
floating: !1,
|
|
70
|
+
open: B.value
|
|
71
|
+
}, null, 8, ["open"]), l(" " + h(B.value ? g(k)("schema.hideValues") : g(k)("schema.showAllValues")), 1)])])) : o("", !0)
|
|
72
|
+
]))]));
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
//#endregion
|
|
76
|
+
export { k as default };
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=SchemaEnums.vue.script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaEnums.vue.script.js","names":[],"sources":["../../src/schema/SchemaEnums.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { 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'\nimport { computed, ref } from 'vue'\n\nimport { useLocalization } from './localization'\nimport SchemaEnumPropertyItem from './SchemaEnumPropertyItem.vue'\nimport SchemaGlyphPuck from './SchemaGlyphPuck.vue'\n\nconst { value, propertyNames = false } = defineProps<{\n /** The schema object containing enum values and metadata */\n value: SchemaObject | undefined\n /** Whether to display the enum for property names */\n propertyNames?: boolean\n}>()\nconst { translate } = useLocalization()\n\n/**\n * Past this many values the list collapses behind a reveal. 12/8 rather than a\n * tighter pair: with 9/5 a 10-value enum hides half its values.\n */\nconst ENUM_DISPLAY_THRESHOLD = 12\nconst INITIAL_VISIBLE_COUNT = 8\n/** Values at or under this length can render as wrapped chips */\nconst CHIP_MAX_LENGTH = 24\nconst THIN_SPACE = '\\u2009'\n\n/**\n * Resolves the schema that carries the enum values.\n * For arrays, the enum and its x-enum-* metadata live on the items schema, so\n * both the values and their varnames/descriptions have to be read from there.\n */\nconst enumSchema = computed(() => {\n if (!value) {\n return undefined\n }\n if (value.enum) {\n return value\n }\n return isArraySchema(value) ? resolve.schema(value.items) : undefined\n})\n\n/**\n * Extracts enum values from the schema object.\n * Handles both direct enum values and nested enum arrays.\n */\nconst enumValues = computed(() => enumSchema.value?.enum ?? [])\n\n/**\n * Determines if we should show the long enum list UI.\n * When there are many enum values, we initially show only a subset.\n */\nconst shouldUseLongListDisplay = computed(\n () => enumValues.value.length > ENUM_DISPLAY_THRESHOLD,\n)\n\nconst initialVisibleCount = computed(() =>\n shouldUseLongListDisplay.value\n ? INITIAL_VISIBLE_COUNT\n : enumValues.value.length,\n)\n\n/**\n * Short flat enums render as wrapped chips: three lines instead of a 40-row\n * wall. Values with descriptions keep the rows instead.\n *\n * `!shouldUseLongListDisplay` is what bounds the COUNT. Chips have no reveal of\n * their own — the \"show all values\" control is a row of the list below — so a\n * long enum of short values (currency or country codes, hundreds of them)\n * would otherwise render every value at once with no way to collapse it.\n * Past the threshold the rows take over and bring their toggle with them.\n */\nconst shouldRenderAsChips = computed(\n () =>\n !propertyNames &&\n enumValues.value.length > 0 &&\n !shouldUseLongListDisplay.value &&\n enumValues.value.every(\n // Measure the text the chip actually renders (value plus any varname), not\n // the bare value, so a short value with a long x-enum-varname still wraps.\n (entry, index) =>\n formatEnumValueWithName(entry, index).length <= CHIP_MAX_LENGTH,\n ) &&\n !hasAnyDescription.value,\n)\n\n/** Whether any value carries an x-enum description (chips have nowhere to put one) */\nconst hasAnyDescription = computed(() =>\n enumValues.value.some(\n (entry, index) => getEnumValueDescription(entry, index) !== undefined,\n ),\n)\n\nconst visibleEnumValues = computed(() =>\n enumValues.value.slice(0, initialVisibleCount.value),\n)\n\nconst hiddenEnumValues = computed(() =>\n enumValues.value.slice(initialVisibleCount.value),\n)\n\n/**\n * Gets the description for an enum value.\n * Supports both array and object formats for x-enumDescriptions.\n */\nconst getEnumValueDescription = (\n enumValue: any,\n index: number,\n): string | undefined => {\n const schema = enumSchema.value\n const descriptions =\n schema?.['x-enumDescriptions'] ?? schema?.['x-enum-descriptions']\n\n if (!descriptions) {\n return undefined\n }\n\n if (Array.isArray(descriptions)) {\n return descriptions[index] || undefined\n }\n\n if (typeof descriptions === 'object' && descriptions !== null) {\n return descriptions[String(enumValue)] || undefined\n }\n\n return undefined\n}\n\n/**\n * Formats an enum value with its variable name if available.\n * This supports both x-enum-varnames and x-enumNames extensions.\n */\nconst formatEnumValueWithName = (enumValue: any, index: number): string => {\n const varNames =\n enumSchema.value?.['x-enum-varnames'] ?? enumSchema.value?.['x-enumNames']\n const varName = Array.isArray(varNames) ? varNames[index] : undefined\n return varName\n ? `${enumValue}${THIN_SPACE}=${THIN_SPACE}${varName}`\n : String(enumValue)\n}\n\n/**\n * Controls whether the hidden enum values are visible.\n */\nconst isExpanded = ref(false)\n\nconst toggleExpanded = () => {\n isExpanded.value = !isExpanded.value\n}\n</script>\n\n<template>\n <div\n v-if=\"enumSchema?.enum !== undefined\"\n class=\"property-enum property-enum--tree mt-2 rounded-(--scalar-radius-lg) border\">\n <!-- A bordered card with a muted header row and one hairline row per\n value; the chips and the long-list toggle are rows of it too -->\n <div class=\"property-enum-header text-c-2 px-3 py-2 text-sm capitalize\">\n {{\n propertyNames\n ? translate('schema.propertyNames')\n : translate('schema.values')\n }}\n </div>\n <p\n v-if=\"enumValues.length === 0\"\n class=\"text-c-2 border-t px-3 py-2 text-sm\">\n {{ translate('schema.noAllowedValues') }}\n </p>\n <div\n v-else-if=\"shouldRenderAsChips\"\n class=\"property-enum-chip-list flex flex-wrap gap-1 border-t px-3 py-2\"\n role=\"list\">\n <span\n v-for=\"(enumValue, index) in enumValues\"\n :key=\"index\"\n class=\"property-enum-chip font-code text-c-2 rounded-(--scalar-radius-lg) border px-1.5 py-px text-(length:--scalar-mini)\"\n role=\"listitem\">\n {{ formatEnumValueWithName(enumValue, index) }}\n </span>\n </div>\n <ul\n v-else\n class=\"property-enum-values-card\"\n role=\"list\">\n <SchemaEnumPropertyItem\n v-for=\"(enumValue, index) in visibleEnumValues\"\n :key=\"index\"\n :description=\"getEnumValueDescription(enumValue, index)\"\n :label=\"formatEnumValueWithName(enumValue, index)\" />\n\n <template v-if=\"shouldUseLongListDisplay && isExpanded\">\n <SchemaEnumPropertyItem\n v-for=\"(enumValue, index) in hiddenEnumValues\"\n :key=\"initialVisibleCount + index\"\n :description=\"\n getEnumValueDescription(enumValue, initialVisibleCount + index)\n \"\n :label=\"\n formatEnumValueWithName(enumValue, initialVisibleCount + index)\n \" />\n </template>\n\n <li\n v-if=\"shouldUseLongListDisplay\"\n class=\"border-t\">\n <!-- The reveal is a tree control like the row toggles, so it draws the\n same puck and lights it the same way when the row is hovered -->\n <button\n class=\"enum-toggle-button group/tree-control text-c-2 hover:text-c-1 flex w-full cursor-pointer items-center gap-1.5 px-3 py-2 text-sm\"\n type=\"button\"\n @click=\"toggleExpanded\">\n <SchemaGlyphPuck\n :floating=\"false\"\n :open=\"isExpanded\" />\n {{\n isExpanded\n ? translate('schema.hideValues')\n : translate('schema.showAllValues')\n }}\n </button>\n </li>\n </ul>\n </div>\n</template>\n\n<style scoped>\n.property-heading:empty + .property-description:last-of-type,\n.property-description:first-of-type:last-of-type {\n margin-top: 0;\n}\n\n.property-list {\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius);\n margin-top: 10px;\n}\n\n.property-list .property:last-of-type {\n padding-bottom: 10px;\n}\n\n.enum-toggle-button:hover {\n color: var(--scalar-color-1);\n}\n</style>\n"],"mappings":"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"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The 18px glyph puck every tree control shows: an opaque knockout around a
|
|
3
|
+
* 16px icon, so a rail reads as passing behind it. Hover is the
|
|
4
|
+
* `tree-control-hover` variant (see tailwind.config.css): a parent carrying
|
|
5
|
+
* the Tailwind group `group/tree-control`, the row heading beside a gutter
|
|
6
|
+
* toggle, or the open panel's rail, so whichever element is the real pointer
|
|
7
|
+
* target lights the puck the same way — a hairline ring on the page colour.
|
|
8
|
+
*
|
|
9
|
+
* Floating pucks hang in the row's margin (see the indentation model in
|
|
10
|
+
* SchemaProperty.vue); the line anchor keeps the glyph beside a heading that wraps.
|
|
11
|
+
*/
|
|
12
|
+
type __VLS_Props = {
|
|
13
|
+
/** Whether the controlled panel is open; picks the minus glyph over plus when the slot is empty */
|
|
14
|
+
open?: boolean;
|
|
15
|
+
/** Position the puck absolutely in the row's margin rather than inline */
|
|
16
|
+
floating?: boolean;
|
|
17
|
+
/** Where a floating puck centres: the row's middle, or its first text line */
|
|
18
|
+
anchor?: 'middle' | 'line';
|
|
19
|
+
};
|
|
20
|
+
declare var __VLS_1: {};
|
|
21
|
+
type __VLS_Slots = {} & {
|
|
22
|
+
default?: (props: typeof __VLS_1) => any;
|
|
23
|
+
};
|
|
24
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
26
|
+
declare const _default: typeof __VLS_export;
|
|
27
|
+
export default _default;
|
|
28
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
29
|
+
new (): {
|
|
30
|
+
$slots: S;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=SchemaGlyphPuck.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaGlyphPuck.vue.d.ts","sourceRoot":"","sources":["../../src/schema/SchemaGlyphPuck.vue"],"names":[],"mappings":"AAyDA;;;;;;;;;;GAUG;AACH,KAAK,WAAW,GAAG;IACjB,mGAAmG;IACnG,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAA;CAC3B,CAAC;AAuEF,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAG/C,QAAA,MAAM,UAAU,kSAEd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaGlyphPuck.vue.js","names":[],"sources":["../../src/schema/SchemaGlyphPuck.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconMinus, ScalarIconPlus } from '@scalar/icons'\n\n/**\n * The 18px glyph puck every tree control shows: an opaque knockout around a\n * 16px icon, so a rail reads as passing behind it. Hover is the\n * `tree-control-hover` variant (see tailwind.config.css): a parent carrying\n * the Tailwind group `group/tree-control`, the row heading beside a gutter\n * toggle, or the open panel's rail, so whichever element is the real pointer\n * target lights the puck the same way — a hairline ring on the page colour.\n *\n * Floating pucks hang in the row's margin (see the indentation model in\n * SchemaProperty.vue); the line anchor keeps the glyph beside a heading that wraps.\n */\nconst {\n open,\n floating = true,\n anchor = 'middle',\n} = defineProps<{\n /** Whether the controlled panel is open; picks the minus glyph over plus when the slot is empty */\n open?: boolean\n /** Position the puck absolutely in the row's margin rather than inline */\n floating?: boolean\n /** Where a floating puck centres: the row's middle, or its first text line */\n anchor?: 'middle' | 'line'\n}>()\n</script>\n<template>\n <span\n aria-hidden=\"true\"\n class=\"schema-glyph tree-control-hover:bg-b-1 tree-control-hover:text-c-1 tree-control-hover:border-(--scalar-border-color) print:bg-transparent [&_svg]:size-[var(--schema-glyph-icon,16px)]\"\n :class=\"\n floating\n ? [\n 'absolute start-[calc(0px_-_var(--schema-glyph-half,9px)_-_var(--schema-gutter,16px))] -translate-y-1/2',\n anchor === 'line' ? 'top-[0.5lh]' : 'top-1/2',\n ]\n : undefined\n \">\n <!-- print: paper strips background paint but still prints the rail, so the\n knockout goes transparent. This comment stays inside the span: beside\n the root it would make the template a fragment and break fallthrough. -->\n <slot>\n <ScalarIconMinus\n v-if=\"open\"\n weight=\"light\" />\n <ScalarIconPlus\n v-else\n weight=\"light\" />\n </slot>\n </span>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createBlock as e, createElementBlock as t, defineComponent as n, normalizeClass as r, openBlock as i, renderSlot as a, unref as o } from "vue";
|
|
2
|
+
import { ScalarIconMinus as s, ScalarIconPlus as c } from "@scalar/icons";
|
|
3
|
+
//#region src/schema/SchemaGlyphPuck.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var l = /*@__PURE__*/ n({
|
|
5
|
+
__name: "SchemaGlyphPuck",
|
|
6
|
+
props: {
|
|
7
|
+
open: { type: Boolean },
|
|
8
|
+
floating: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: !0
|
|
11
|
+
},
|
|
12
|
+
anchor: { default: "middle" }
|
|
13
|
+
},
|
|
14
|
+
setup(n) {
|
|
15
|
+
return (l, u) => (i(), t("span", {
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
class: r(["schema-glyph tree-control-hover:bg-b-1 tree-control-hover:text-c-1 tree-control-hover:border-(--scalar-border-color) print:bg-transparent [&_svg]:size-[var(--schema-glyph-icon,16px)]", n.floating ? ["absolute start-[calc(0px_-_var(--schema-glyph-half,9px)_-_var(--schema-gutter,16px))] -translate-y-1/2", n.anchor === "line" ? "top-[0.5lh]" : "top-1/2"] : void 0])
|
|
18
|
+
}, [a(l.$slots, "default", {}, () => [n.open ? (i(), e(o(s), {
|
|
19
|
+
key: 0,
|
|
20
|
+
weight: "light"
|
|
21
|
+
})) : (i(), e(o(c), {
|
|
22
|
+
key: 1,
|
|
23
|
+
weight: "light"
|
|
24
|
+
}))])], 2));
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
//#endregion
|
|
28
|
+
export { l as default };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=SchemaGlyphPuck.vue.script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaGlyphPuck.vue.script.js","names":[],"sources":["../../src/schema/SchemaGlyphPuck.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconMinus, ScalarIconPlus } from '@scalar/icons'\n\n/**\n * The 18px glyph puck every tree control shows: an opaque knockout around a\n * 16px icon, so a rail reads as passing behind it. Hover is the\n * `tree-control-hover` variant (see tailwind.config.css): a parent carrying\n * the Tailwind group `group/tree-control`, the row heading beside a gutter\n * toggle, or the open panel's rail, so whichever element is the real pointer\n * target lights the puck the same way — a hairline ring on the page colour.\n *\n * Floating pucks hang in the row's margin (see the indentation model in\n * SchemaProperty.vue); the line anchor keeps the glyph beside a heading that wraps.\n */\nconst {\n open,\n floating = true,\n anchor = 'middle',\n} = defineProps<{\n /** Whether the controlled panel is open; picks the minus glyph over plus when the slot is empty */\n open?: boolean\n /** Position the puck absolutely in the row's margin rather than inline */\n floating?: boolean\n /** Where a floating puck centres: the row's middle, or its first text line */\n anchor?: 'middle' | 'line'\n}>()\n</script>\n<template>\n <span\n aria-hidden=\"true\"\n class=\"schema-glyph tree-control-hover:bg-b-1 tree-control-hover:text-c-1 tree-control-hover:border-(--scalar-border-color) print:bg-transparent [&_svg]:size-[var(--schema-glyph-icon,16px)]\"\n :class=\"\n floating\n ? [\n 'absolute start-[calc(0px_-_var(--schema-glyph-half,9px)_-_var(--schema-gutter,16px))] -translate-y-1/2',\n anchor === 'line' ? 'top-[0.5lh]' : 'top-1/2',\n ]\n : undefined\n \">\n <!-- print: paper strips background paint but still prints the rail, so the\n knockout goes transparent. This comment stays inside the span: beside\n the root it would make the template a fragment and break fallthrough. -->\n <slot>\n <ScalarIconMinus\n v-if=\"open\"\n weight=\"light\" />\n <ScalarIconPlus\n v-else\n weight=\"light\" />\n </slot>\n </span>\n</template>\n"],"mappings":";;;;;;;;;;;;;;yBA4BE,EAsBO,QAAA;GArBL,eAAY;GACZ,OAAK,EAAA,CAAC,0LACS,EAAA,WAAA,CAAA,0GAAuJ,EAAA,WAAM,SAAA,gBAAA,SAAA,IAA+D,KAAA,CAAA,CAAA;MAW3O,EAOO,EAAA,QAAA,WAAA,CAAA,SAAA,CALG,EAAA,QAAA,EAAA,GADR,EAEmB,EAAA,CAAA,GAAA;;GAAjB,QAAO;cACT,EAEmB,EAAA,CAAA,GAAA;;GAAjB,QAAO"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A property row's disclosure control: a content-free button in the property's
|
|
3
|
+
* gutter. Its accessible name is the property name via `aria-labelledby`, and the
|
|
4
|
+
* child count rides `aria-describedby` so screen-reader verbosity settings apply.
|
|
5
|
+
* The 24px hit box (WCAG 2.5.8) and the 18px glyph puck inside it are sized
|
|
6
|
+
* independently.
|
|
7
|
+
*/
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
/** Whether the controlled panel is expanded */
|
|
10
|
+
open: boolean;
|
|
11
|
+
/** id of the panel this toggle controls */
|
|
12
|
+
panelId: string;
|
|
13
|
+
/** Only reference the panel while it is actually in the DOM */
|
|
14
|
+
panelRendered: boolean;
|
|
15
|
+
/** id of the visible property name that labels this control, absent on nameless rows */
|
|
16
|
+
nameId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Accessible name when there is no visible name to reference: pointing
|
|
19
|
+
* `aria-labelledby` at an id that never renders leaves the button unnamed.
|
|
20
|
+
*/
|
|
21
|
+
fallbackLabel: string;
|
|
22
|
+
/** id of the visually hidden child count that describes this control */
|
|
23
|
+
countId?: string;
|
|
24
|
+
};
|
|
25
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
26
|
+
toggle: () => any;
|
|
27
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
28
|
+
onToggle?: (() => any) | undefined;
|
|
29
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
|
+
declare const _default: typeof __VLS_export;
|
|
31
|
+
export default _default;
|
|
32
|
+
//# sourceMappingURL=SchemaGutterToggle.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaGutterToggle.vue.d.ts","sourceRoot":"","sources":["../../src/schema/SchemaGutterToggle.vue"],"names":[],"mappings":"AAwDA;;;;;;GAMG;AACH,KAAK,WAAW,GAAG;IACf,+CAA+C;IAC/C,IAAI,EAAE,OAAO,CAAA;IACb,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAA;IACf,+DAA+D;IAC/D,aAAa,EAAE,OAAO,CAAA;IACtB,wFAAwF;IACxF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAA;IACrB,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAC;AA0EJ,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|