@scalar/blocks 0.11.1 → 0.11.3
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 +110 -108
- 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.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 +1 -1
- package/dist/schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/schema/SchemaProperty.vue.js +472 -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 +1 -1
- package/dist/schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
- package/dist/schema/SchemaPropertyHeading.vue.js +312 -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.d.ts +5 -0
- package/dist/schema/components/CopyLinkButton.vue.d.ts.map +1 -1
- 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.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.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/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.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.d.ts +1 -1
- 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.js +43 -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.d.ts +12 -0
- package/dist/shared/ExternalExampleStatus.vue.d.ts.map +1 -0
- package/dist/shared/ExternalExampleStatus.vue.js +26 -0
- package/dist/shared/ExternalExampleStatus.vue.js.map +1 -0
- 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.d.ts +4 -0
- package/dist/shared/external-example-localization/index.d.ts.map +1 -0
- package/dist/shared/external-example-localization/index.js +17 -0
- package/dist/shared/external-example-localization/index.js.map +1 -0
- package/dist/shared/external-example-localization/locales/ar.d.ts +8 -0
- package/dist/shared/external-example-localization/locales/ar.d.ts.map +1 -0
- package/dist/shared/external-example-localization/locales/ar.js +9 -0
- package/dist/shared/external-example-localization/locales/ar.js.map +1 -0
- package/dist/shared/external-example-localization/locales/de.d.ts +8 -0
- package/dist/shared/external-example-localization/locales/de.d.ts.map +1 -0
- package/dist/shared/external-example-localization/locales/de.js +9 -0
- package/dist/shared/external-example-localization/locales/de.js.map +1 -0
- package/dist/shared/external-example-localization/locales/en.d.ts +8 -0
- package/dist/shared/external-example-localization/locales/en.d.ts.map +1 -0
- package/dist/shared/external-example-localization/locales/en.js +9 -0
- package/dist/shared/external-example-localization/locales/en.js.map +1 -0
- package/dist/shared/external-example-localization/locales/es.d.ts +8 -0
- package/dist/shared/external-example-localization/locales/es.d.ts.map +1 -0
- package/dist/shared/external-example-localization/locales/es.js +9 -0
- package/dist/shared/external-example-localization/locales/es.js.map +1 -0
- package/dist/shared/external-example-localization/locales/fr.d.ts +8 -0
- package/dist/shared/external-example-localization/locales/fr.d.ts.map +1 -0
- package/dist/shared/external-example-localization/locales/fr.js +9 -0
- package/dist/shared/external-example-localization/locales/fr.js.map +1 -0
- package/dist/shared/external-example-localization/locales/pt.d.ts +8 -0
- package/dist/shared/external-example-localization/locales/pt.d.ts.map +1 -0
- package/dist/shared/external-example-localization/locales/pt.js +9 -0
- package/dist/shared/external-example-localization/locales/pt.js.map +1 -0
- package/dist/shared/external-example-localization/locales/ru.d.ts +8 -0
- package/dist/shared/external-example-localization/locales/ru.d.ts.map +1 -0
- package/dist/shared/external-example-localization/locales/ru.js +9 -0
- package/dist/shared/external-example-localization/locales/ru.js.map +1 -0
- package/dist/shared/external-example-localization/locales/zh-cn.d.ts +8 -0
- package/dist/shared/external-example-localization/locales/zh-cn.d.ts.map +1 -0
- package/dist/shared/external-example-localization/locales/zh-cn.js +9 -0
- package/dist/shared/external-example-localization/locales/zh-cn.js.map +1 -0
- package/dist/shared/external-example-localization/locales/zh-tw.d.ts +8 -0
- package/dist/shared/external-example-localization/locales/zh-tw.d.ts.map +1 -0
- package/dist/shared/external-example-localization/locales/zh-tw.js +9 -0
- package/dist/shared/external-example-localization/locales/zh-tw.js.map +1 -0
- package/dist/shared/external-example-localization/translations.d.ts +67 -0
- package/dist/shared/external-example-localization/translations.d.ts.map +1 -0
- package/dist/shared/external-example-localization/translations.js +24 -0
- package/dist/shared/external-example-localization/translations.js.map +1 -0
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +6 -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 +13 -9
- package/dist/vue-styles.css +1 -1
- package/package.json +18 -18
- 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 -275
- 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 -469
- 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 -25
- 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/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
package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { getAsyncApiExampleContext as e } from "../helpers/get-asyncapi-example-context.js";
|
|
2
|
-
import { getGeneratedPayloadExample as t } from "../helpers/get-generated-payload-example.js";
|
|
3
|
-
import { getMessageExampleContent as n } from "../helpers/get-message-example-content.js";
|
|
4
|
-
import r from "./ExamplePicker.vue.js";
|
|
5
|
-
import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, mergeModels as f, normalizeClass as p, openBlock as m, ref as h, renderList as g, toDisplayString as _, unref as v, useModel as y, watch as b, withCtx as x } from "vue";
|
|
6
|
-
import { ScalarCard as S, ScalarCardFooter as C, ScalarCardHeader as w, ScalarCardSection as T } from "@scalar/components/card";
|
|
7
|
-
import { ScalarCodeBlock as E } from "@scalar/components/code-block";
|
|
8
|
-
import { ScalarWrappingText as D } from "@scalar/components/wrapping-text";
|
|
9
|
-
import { getResolvedAsyncApiRef as O } from "@scalar/workspace-store/helpers/get-resolved-async-api-ref";
|
|
10
|
-
// src/code-example/components/AsyncApiCodeExample.vue?vue&type=script&setup=true&lang.ts
|
|
11
|
-
var k = { class: "text-c-2 font-code min-w-0 font-semibold break-words" }, A = {
|
|
12
|
-
key: 0,
|
|
13
|
-
class: "text-c-1 whitespace-nowrap"
|
|
14
|
-
}, j = { class: "flex w-full flex-col" }, M = {
|
|
15
|
-
key: 0,
|
|
16
|
-
class: "text-c-2 px-3 py-2 text-sm"
|
|
17
|
-
}, N = {
|
|
18
|
-
key: 2,
|
|
19
|
-
class: "text-c-2 p-4",
|
|
20
|
-
role: "status"
|
|
21
|
-
}, P = { class: "flex min-w-0 flex-1 flex-wrap items-center gap-2" }, F = {
|
|
22
|
-
key: 1,
|
|
23
|
-
class: "text-c-2 min-w-0 truncate px-1.5 py-0.75 text-base"
|
|
24
|
-
}, I = { class: "ml-auto flex min-w-0 items-center" }, L = {
|
|
25
|
-
key: 1,
|
|
26
|
-
class: "text-c-2 min-w-0 truncate px-1.5 py-0.75 text-base"
|
|
27
|
-
}, R = /*@__PURE__*/ d({
|
|
28
|
-
__name: "AsyncApiCodeExample",
|
|
29
|
-
props: /*@__PURE__*/ f({
|
|
30
|
-
document: {},
|
|
31
|
-
operationName: {}
|
|
32
|
-
}, {
|
|
33
|
-
selectedMessage: { default: "" },
|
|
34
|
-
selectedMessageModifiers: {}
|
|
35
|
-
}),
|
|
36
|
-
emits: ["update:selectedMessage"],
|
|
37
|
-
setup(d) {
|
|
38
|
-
let f = a(() => e(d.document, d.operationName)), R = a(() => (f.value?.channel?.address ?? d.operationName).split(/({[^}]+})/)), z = y(d, "selectedMessage"), B = h(""), V = a(() => Object.fromEntries((f.value?.messages ?? []).map(({ name: e, message: t }) => [e, { summary: t.title || t.name || e }]))), H = a(() => f.value?.messages.find(({ name: e }) => e === z.value)?.message), U = a(() => (H.value?.examples ?? []).flatMap((e, t) => {
|
|
39
|
-
let n = O(e);
|
|
40
|
-
return n?.payload === void 0 ? [] : [{
|
|
41
|
-
key: String(t),
|
|
42
|
-
...n
|
|
43
|
-
}];
|
|
44
|
-
})), W = a(() => Object.fromEntries(U.value.map((e, t) => [e.key, { summary: e.name || e.summary || `Example ${t + 1}` }]))), G = a(() => U.value.find(({ key: e }) => e === B.value)), K = a(() => `Message: ${V.value[z.value]?.summary ?? "Select a message"}`), q = a(() => `Message example: ${W.value[B.value]?.summary ?? "Select an example"}`);
|
|
45
|
-
b(V, (e) => {
|
|
46
|
-
Object.hasOwn(e, z.value) || (z.value = Object.keys(e)[0] ?? "");
|
|
47
|
-
}, { immediate: !0 }), b([z, () => d.operationName], () => {
|
|
48
|
-
B.value = Object.keys(W.value)[0] ?? "";
|
|
49
|
-
}), b(W, (e) => {
|
|
50
|
-
Object.hasOwn(e, B.value) || (B.value = Object.keys(e)[0] ?? "");
|
|
51
|
-
}, { immediate: !0 });
|
|
52
|
-
let J = a(() => n(G.value ? G.value.payload : H.value ? t(H.value) : void 0, H.value?.contentType ?? d.document.defaultContentType));
|
|
53
|
-
return (e, t) => (m(), o(v(S), {
|
|
54
|
-
class: "request-card dark-mode min-w-0",
|
|
55
|
-
label: "Message example"
|
|
56
|
-
}, {
|
|
57
|
-
default: x(() => [
|
|
58
|
-
u(v(w), { class: "flex-nowrap items-start gap-3 pr-2.5 [&_.scalar-card-header-title]:flex-1 [&_.scalar-card-header-title]:whitespace-normal [&>div:last-child]:shrink-0" }, {
|
|
59
|
-
default: x(() => [
|
|
60
|
-
t[2] ||= l("span", { class: "sr-only" }, "Message example for", -1),
|
|
61
|
-
l("span", { class: p(["font-code mr-1.5 uppercase", f.value?.operation.action === "send" ? "text-blue" : "text-green"]) }, _(f.value?.operation.action), 3),
|
|
62
|
-
l("span", k, [(m(!0), c(i, null, g(R.value, (e, t) => (m(), c(i, { key: t }, [e.startsWith("{") && e.endsWith("}") ? (m(), c("span", A, _(e), 1)) : (m(), o(v(D), {
|
|
63
|
-
key: 1,
|
|
64
|
-
text: e
|
|
65
|
-
}, null, 8, ["text"]))], 64))), 128))])
|
|
66
|
-
]),
|
|
67
|
-
_: 1
|
|
68
|
-
}),
|
|
69
|
-
u(v(T), { class: "custom-scroll flex flex-1 p-0" }, {
|
|
70
|
-
default: x(() => [l("div", j, [J.value?.structural ? (m(), c("p", M, " Structure only; not encoded ")) : s("", !0), J.value ? (m(), o(v(E), {
|
|
71
|
-
key: 1,
|
|
72
|
-
class: "h-full bg-transparent",
|
|
73
|
-
content: J.value.content,
|
|
74
|
-
lang: J.value.lang,
|
|
75
|
-
lineNumbers: ""
|
|
76
|
-
}, null, 8, ["content", "lang"])) : (m(), c("p", N, " No message payload example available. "))])]),
|
|
77
|
-
_: 1
|
|
78
|
-
}),
|
|
79
|
-
Object.keys(V.value).length || U.value.length ? (m(), o(v(C), {
|
|
80
|
-
key: 0,
|
|
81
|
-
class: "relative flex shrink-0 flex-wrap items-center justify-end gap-2 p-1.5"
|
|
82
|
-
}, {
|
|
83
|
-
default: x(() => [l("div", P, [U.value.length > 1 ? (m(), o(r, {
|
|
84
|
-
key: 0,
|
|
85
|
-
modelValue: B.value,
|
|
86
|
-
"onUpdate:modelValue": t[0] ||= (e) => B.value = e,
|
|
87
|
-
"aria-label": q.value,
|
|
88
|
-
examples: W.value
|
|
89
|
-
}, null, 8, [
|
|
90
|
-
"modelValue",
|
|
91
|
-
"aria-label",
|
|
92
|
-
"examples"
|
|
93
|
-
])) : U.value.length === 1 ? (m(), c("span", F, _(W.value[B.value]?.summary), 1)) : s("", !0), l("div", I, [Object.keys(V.value).length > 1 ? (m(), o(r, {
|
|
94
|
-
key: 0,
|
|
95
|
-
modelValue: z.value,
|
|
96
|
-
"onUpdate:modelValue": t[1] ||= (e) => z.value = e,
|
|
97
|
-
"aria-label": K.value,
|
|
98
|
-
examples: V.value
|
|
99
|
-
}, null, 8, [
|
|
100
|
-
"modelValue",
|
|
101
|
-
"aria-label",
|
|
102
|
-
"examples"
|
|
103
|
-
])) : Object.keys(V.value).length === 1 ? (m(), c("span", L, _(V.value[z.value]?.summary), 1)) : s("", !0)])])]),
|
|
104
|
-
_: 1
|
|
105
|
-
})) : s("", !0)
|
|
106
|
-
]),
|
|
107
|
-
_: 1
|
|
108
|
-
}));
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
export { R as default };
|
|
112
|
-
|
|
113
|
-
//# sourceMappingURL=AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js.map
|
package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createBlock","_unref","_withCtx","_createVNode","_createElementVNode","_normalizeClass","_toDisplayString","_createElementBlock","_Fragment","_renderList","ExamplePicker","ExamplePicker_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","AsyncApiCodeExample_vue_vue_type_script_setup_true_lang_default","\"selectedMessage\"","\"selectedMessageModifiers\"","context","computed","getAsyncApiExampleContext","__props","channelPathParts","selectedMessage","useModel","selectedExample","ref","messages","name","message","examples","example","getResolvedAsyncApiRef","node","index","exampleOptions","key","messageLabel","exampleLabel","watch","options","content","getMessageExampleContent","getGeneratedPayloadExample","openBlock","createBlock","unref","ScalarCard","withCtx","createVNode","ScalarCardHeader","_cache","createElementVNode","normalizeClass","toDisplayString","createElementBlock","Fragment","renderList","part","ScalarWrappingText","ScalarCardSection","createCommentVNode","ScalarCodeBlock","ScalarCardFooter","$event"],"sources":["../../../src/code-example/components/AsyncApiCodeExample.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n ScalarCard,\n ScalarCardFooter,\n ScalarCardHeader,\n ScalarCardSection,\n} from '@scalar/components/card'\nimport { ScalarCodeBlock } from '@scalar/components/code-block'\nimport { ScalarWrappingText } from '@scalar/components/wrapping-text'\nimport type {\n AsyncApiDocument,\n AsyncApiMessageObject,\n} from '@scalar/types/asyncapi/3.1'\nimport { getResolvedAsyncApiRef } from '@scalar/workspace-store/helpers/get-resolved-async-api-ref'\nimport { computed, ref, watch } from 'vue'\n\nimport { getAsyncApiExampleContext } from '../helpers/get-asyncapi-example-context'\nimport { getGeneratedPayloadExample } from '../helpers/get-generated-payload-example'\nimport { getMessageExampleContent } from '../helpers/get-message-example-content'\nimport ExamplePicker from './ExamplePicker.vue'\n\nconst { document, operationName } = defineProps<{\n /** A workspace-resolved AsyncAPI 3.x document. */\n document: AsyncApiDocument\n /** Key in document.operations. */\n operationName: string\n}>()\n\ntype PickerOptions = Record<string, { summary: string }>\ntype MessageExample = Exclude<\n NonNullable<AsyncApiMessageObject['examples']>[number],\n { $ref: string }\n> & { key: string }\nconst context = computed<ReturnType<typeof getAsyncApiExampleContext>>(() =>\n getAsyncApiExampleContext(document, operationName),\n)\nconst channelPathParts = computed(() =>\n (context.value?.channel?.address ?? operationName).split(/({[^}]+})/),\n)\n\nconst selectedMessage = defineModel<string>('selectedMessage', { default: '' })\nconst selectedExample = ref<string>('')\nconst messages = computed<PickerOptions>(() =>\n Object.fromEntries(\n (context.value?.messages ?? []).map(({ name, message }) => [\n name,\n { summary: message.title || message.name || name },\n ]),\n ),\n)\nconst message = computed<AsyncApiMessageObject | undefined>(\n () =>\n context.value?.messages.find(({ name }) => name === selectedMessage.value)\n ?.message,\n)\nconst examples = computed<MessageExample[]>(() =>\n (message.value?.examples ?? []).flatMap((node, index) => {\n const example = getResolvedAsyncApiRef(node)\n return example?.payload !== undefined\n ? [{ key: String(index), ...example }]\n : []\n }),\n)\nconst exampleOptions = computed<PickerOptions>(() =>\n Object.fromEntries(\n examples.value.map((example, index) => [\n example.key,\n { summary: example.name || example.summary || `Example ${index + 1}` },\n ]),\n ),\n)\nconst example = computed<MessageExample | undefined>(() =>\n examples.value.find(({ key }) => key === selectedExample.value),\n)\nconst messageLabel = computed<string>(\n () =>\n `Message: ${messages.value[selectedMessage.value]?.summary ?? 'Select a message'}`,\n)\nconst exampleLabel = computed<string>(\n () =>\n `Message example: ${exampleOptions.value[selectedExample.value]?.summary ?? 'Select an example'}`,\n)\n\n// Keep selections valid when operations, messages, or the active document change.\nwatch(\n messages,\n (options) => {\n if (!Object.hasOwn(options, selectedMessage.value))\n selectedMessage.value = Object.keys(options)[0] ?? ''\n },\n { immediate: true },\n)\nwatch([selectedMessage, () => operationName], () => {\n selectedExample.value = Object.keys(exampleOptions.value)[0] ?? ''\n})\nwatch(\n exampleOptions,\n (options) => {\n if (!Object.hasOwn(options, selectedExample.value))\n selectedExample.value = Object.keys(options)[0] ?? ''\n },\n { immediate: true },\n)\nconst content = computed(() =>\n getMessageExampleContent(\n example.value\n ? example.value.payload\n : message.value\n ? getGeneratedPayloadExample(message.value)\n : undefined,\n message.value?.contentType ?? document.defaultContentType,\n ),\n)\n</script>\n\n<template>\n <ScalarCard\n class=\"request-card dark-mode min-w-0\"\n label=\"Message example\">\n <ScalarCardHeader\n class=\"flex-nowrap items-start gap-3 pr-2.5 [&_.scalar-card-header-title]:flex-1 [&_.scalar-card-header-title]:whitespace-normal [&>div:last-child]:shrink-0\">\n <span class=\"sr-only\">Message example for</span>\n <span\n class=\"font-code mr-1.5 uppercase\"\n :class=\"\n context?.operation.action === 'send' ? 'text-blue' : 'text-green'\n \"\n >{{ context?.operation.action }}</span\n >\n <span class=\"text-c-2 font-code min-w-0 font-semibold break-words\">\n <template\n v-for=\"(part, index) in channelPathParts\"\n :key=\"index\">\n <span\n v-if=\"part.startsWith('{') && part.endsWith('}')\"\n class=\"text-c-1 whitespace-nowrap\"\n >{{ part }}</span\n >\n <ScalarWrappingText\n v-else\n :text=\"part\" />\n </template>\n </span>\n </ScalarCardHeader>\n <ScalarCardSection class=\"custom-scroll flex flex-1 p-0\">\n <div class=\"flex w-full flex-col\">\n <p\n v-if=\"content?.structural\"\n class=\"text-c-2 px-3 py-2 text-sm\">\n Structure only; not encoded\n </p>\n <ScalarCodeBlock\n v-if=\"content\"\n class=\"h-full bg-transparent\"\n :content=\"content.content\"\n :lang=\"content.lang\"\n lineNumbers />\n <p\n v-else\n class=\"text-c-2 p-4\"\n role=\"status\">\n No message payload example available.\n </p>\n </div>\n </ScalarCardSection>\n <ScalarCardFooter\n v-if=\"Object.keys(messages).length || examples.length\"\n class=\"relative flex shrink-0 flex-wrap items-center justify-end gap-2 p-1.5\">\n <div class=\"flex min-w-0 flex-1 flex-wrap items-center gap-2\">\n <ExamplePicker\n v-if=\"examples.length > 1\"\n v-model=\"selectedExample\"\n :aria-label=\"exampleLabel\"\n :examples=\"exampleOptions\" />\n <span\n v-else-if=\"examples.length === 1\"\n class=\"text-c-2 min-w-0 truncate px-1.5 py-0.75 text-base\">\n {{ exampleOptions[selectedExample]?.summary }}\n </span>\n <div class=\"ml-auto flex min-w-0 items-center\">\n <ExamplePicker\n v-if=\"Object.keys(messages).length > 1\"\n v-model=\"selectedMessage\"\n :aria-label=\"messageLabel\"\n :examples=\"messages\" />\n <span\n v-else-if=\"Object.keys(messages).length === 1\"\n class=\"text-c-2 min-w-0 truncate px-1.5 py-0.75 text-base\">\n {{ messages[selectedMessage]?.summary }}\n </span>\n </div>\n </div>\n </ScalarCardFooter>\n </ScalarCard>\n</template>\n\n<style scoped>\n.request-card {\n color: var(--scalar-color-1);\n font-size: var(--scalar-font-size-3);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCA,IAAM0B,IAAUC,QACdC,EAA0BC,EAAA,UAAUA,EAAA,aAAa,CACnD,GACMC,IAAmBH,SACtBD,EAAQ,OAAO,SAAS,WAAWG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0 @@
|
|
|
1
|
-
import { filterClientsByQuery as e } from "../helpers/filter-clients-by-query.js";
|
|
2
|
-
import { findClient as t } from "../helpers/find-client.js";
|
|
3
|
-
import { generateCodeSnippet as n } from "../helpers/generate-code-snippet.js";
|
|
4
|
-
import { getClients as ee } from "../helpers/get-clients.js";
|
|
5
|
-
import { getCustomCodeSamples as te } from "../helpers/get-custom-code-samples.js";
|
|
6
|
-
import { getSecrets as ne } from "../helpers/get-secrets.js";
|
|
7
|
-
import { operationToHar as re } from "../helpers/operation-to-har/operation-to-har.js";
|
|
8
|
-
import ie from "./ExamplePicker.vue.js";
|
|
9
|
-
import r from "./HttpMethod.vue.js";
|
|
10
|
-
import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createSlots as ae, createTextVNode as u, createVNode as d, defineComponent as f, normalizeClass as p, openBlock as m, ref as h, renderSlot as g, toDisplayString as _, unref as v, useId as oe, watch as y, watchEffect as se, withCtx as b } from "vue";
|
|
11
|
-
import { ScalarCard as x, ScalarCardFooter as ce, ScalarCardHeader as le, ScalarCardSection as S } from "@scalar/components/card";
|
|
12
|
-
import { ScalarCodeBlock as ue, ScalarCodeBlockCopy as de } from "@scalar/components/code-block";
|
|
13
|
-
import { resolveCredentialPlaceholders as fe } from "@scalar/workspace-store/request-example";
|
|
14
|
-
import { ScalarButton as C } from "@scalar/components/button";
|
|
15
|
-
import { ScalarIconCaretDown as pe } from "@scalar/icons";
|
|
16
|
-
import { getResolvedRef as me } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
17
|
-
import { ScalarCombobox as he } from "@scalar/components/combobox";
|
|
18
|
-
import { ScalarVirtualText as ge } from "@scalar/components/virtual-text";
|
|
19
|
-
import { freezeElement as _e } from "@scalar/helpers/dom/freeze-element";
|
|
20
|
-
import { getOperationExamples as ve, resolveOperationExamples as ye } from "@scalar/workspace-store/helpers/operation-examples";
|
|
21
|
-
import { useExampleVisibility as w, useExternalExamples as T } from "@scalar/workspace-store/helpers/use-external-examples";
|
|
22
|
-
// src/code-example/components/CodeExample.vue?vue&type=script&setup=true&lang.ts
|
|
23
|
-
var E = ["innerHTML"], D = {
|
|
24
|
-
key: 1,
|
|
25
|
-
class: "text-c-2 flex h-full w-fit items-center px-0.5 py-0 text-base font-normal",
|
|
26
|
-
"data-testid": "client-picker"
|
|
27
|
-
}, O = {
|
|
28
|
-
key: 0,
|
|
29
|
-
class: "text-c-2 p-4",
|
|
30
|
-
role: "status"
|
|
31
|
-
}, k = {
|
|
32
|
-
key: 1,
|
|
33
|
-
class: "text-c-2 p-4",
|
|
34
|
-
role: "status"
|
|
35
|
-
}, A = ["id"], j = {
|
|
36
|
-
key: 0,
|
|
37
|
-
class: "request-card-footer-addon"
|
|
38
|
-
}, M = {
|
|
39
|
-
key: 1,
|
|
40
|
-
class: "request-card-footer-start"
|
|
41
|
-
}, N = { class: "request-header" }, P = {
|
|
42
|
-
key: 0,
|
|
43
|
-
class: "request-card-actions relative max-w-full"
|
|
44
|
-
}, F = /*@__PURE__*/ f({
|
|
45
|
-
__name: "CodeExample",
|
|
46
|
-
props: {
|
|
47
|
-
codeSampleUnavailable: { default: "No code sample available for this example." },
|
|
48
|
-
clientPickerLabel: { default: "Change code sample language" },
|
|
49
|
-
clientSearchLabel: { default: "Search clients" },
|
|
50
|
-
codeSampleLabel: { default: "Code sample" },
|
|
51
|
-
integration: {},
|
|
52
|
-
clientOptions: {},
|
|
53
|
-
selectedClient: {},
|
|
54
|
-
selectedServer: { default: null },
|
|
55
|
-
selectedContentType: {},
|
|
56
|
-
selectedExample: {},
|
|
57
|
-
eventBus: {},
|
|
58
|
-
securitySchemes: { default: () => [] },
|
|
59
|
-
method: {},
|
|
60
|
-
path: {},
|
|
61
|
-
operation: {},
|
|
62
|
-
fallback: { type: Boolean },
|
|
63
|
-
generateLabel: { type: Function },
|
|
64
|
-
isWebhook: { type: Boolean },
|
|
65
|
-
globalCookies: {},
|
|
66
|
-
openapiVersion: {},
|
|
67
|
-
jsonSchemaDialect: {},
|
|
68
|
-
multipartNaming: {},
|
|
69
|
-
requestBodyCompositionSelection: {}
|
|
70
|
-
},
|
|
71
|
-
emits: ["update:exampleKey"],
|
|
72
|
-
setup(f, { emit: F }) {
|
|
73
|
-
let be = F, I = a(() => {
|
|
74
|
-
let e = me(f.operation.requestBody)?.content ?? {}, t = f.selectedContentType || Object.keys(e)[0];
|
|
75
|
-
return t ? e[t]?.examples ?? {} : {};
|
|
76
|
-
}), L = h(""), R = (e) => {
|
|
77
|
-
let t = Object.keys(I.value);
|
|
78
|
-
return e && t.includes(e) ? e : L.value && t.includes(L.value) ? L.value : t[0] ?? "";
|
|
79
|
-
};
|
|
80
|
-
L.value = R(f.selectedExample), y(() => f.selectedExample, (e) => {
|
|
81
|
-
L.value = R(e);
|
|
82
|
-
}), y(() => f.selectedContentType, () => {
|
|
83
|
-
Object.keys(I.value).includes(L.value) || (L.value = R(f.selectedExample));
|
|
84
|
-
}), se(() => {
|
|
85
|
-
be("update:exampleKey", L.value);
|
|
86
|
-
});
|
|
87
|
-
let xe = (e) => {
|
|
88
|
-
L.value = e, f.eventBus.emit("workspace:update:selected-example", e);
|
|
89
|
-
}, z = a(() => te(f.operation)), B = a(() => ee(z.value.samples, f.clientOptions, z.value.label)), V = a(() => B.value.reduce((e, t) => e + t.options.length, 0)), H = h(t(B.value, f.selectedClient));
|
|
90
|
-
y([() => f.selectedClient, B], ([e]) => {
|
|
91
|
-
H.value = t(B.value, e);
|
|
92
|
-
});
|
|
93
|
-
let Se = a(() => [f.clientPickerLabel, H.value?.title].filter(Boolean).join(": ")), Ce = a(() => [f.codeSampleLabel, H.value?.title].filter(Boolean).join(": ")), U = h(null), we = w(U), W = T(() => ve(f.operation, L.value, f.selectedContentType), () => we.value), G = a(() => ye(f.operation, L.value, f.selectedContentType, W.resolve)), K = a(() => Object.keys(I.value).length > 1), q = a(() => {
|
|
94
|
-
if (!f.isWebhook) return null;
|
|
95
|
-
try {
|
|
96
|
-
return re({
|
|
97
|
-
operation: G.value,
|
|
98
|
-
method: f.method,
|
|
99
|
-
path: f.path,
|
|
100
|
-
example: L.value,
|
|
101
|
-
openapiVersion: f.openapiVersion,
|
|
102
|
-
jsonSchemaDialect: f.jsonSchemaDialect,
|
|
103
|
-
multipartNaming: f.multipartNaming,
|
|
104
|
-
requestBodyCompositionSelection: f.requestBodyCompositionSelection,
|
|
105
|
-
defaultDisabledParameters: !0
|
|
106
|
-
});
|
|
107
|
-
} catch (e) {
|
|
108
|
-
return console.error("[webhookHar]", e), null;
|
|
109
|
-
}
|
|
110
|
-
}), J = a(() => f.isWebhook ? q.value?.postData?.text ?? "" : n({
|
|
111
|
-
defaultDisabledParameters: !0,
|
|
112
|
-
includeDefaultHeaders: f.integration === "client",
|
|
113
|
-
clientId: H.value?.id,
|
|
114
|
-
customCodeSamples: z.value.samples,
|
|
115
|
-
operation: G.value,
|
|
116
|
-
method: f.method,
|
|
117
|
-
path: f.path,
|
|
118
|
-
contentType: f.selectedContentType,
|
|
119
|
-
server: f.selectedServer,
|
|
120
|
-
securitySchemes: f.securitySchemes,
|
|
121
|
-
example: L.value,
|
|
122
|
-
globalCookies: f.globalCookies,
|
|
123
|
-
openapiVersion: f.openapiVersion,
|
|
124
|
-
jsonSchemaDialect: f.jsonSchemaDialect,
|
|
125
|
-
multipartNaming: f.multipartNaming,
|
|
126
|
-
requestBodyCompositionSelection: f.requestBodyCompositionSelection
|
|
127
|
-
})), Y = a(() => !f.isWebhook && H.value?.id.startsWith("custom/") && J.value !== null && f.securitySchemes.some((e) => "x-scalar-credential-placeholders" in e) ? fe(J.value, f.securitySchemes) : void 0), X = a(() => Y.value?.content ?? J.value), Z = a(() => Y.value?.displayContent ?? X.value), Q = a(() => f.isWebhook ? Te.value : H.value?.lang), Te = a(() => {
|
|
128
|
-
if (!q.value?.postData) return "json";
|
|
129
|
-
let e = q.value.postData.mimeType;
|
|
130
|
-
return e?.includes("json") ? "json" : e?.includes("xml") ? "xml" : e?.includes("yaml") || e?.includes("yml") ? "yaml" : e?.includes("text/plain") ? "text" : "json";
|
|
131
|
-
}), Ee = a(() => Y.value ? [] : ne(f.securitySchemes)), De = (e) => {
|
|
132
|
-
if (U.value) {
|
|
133
|
-
let e = _e(U.value.$el);
|
|
134
|
-
setTimeout(() => {
|
|
135
|
-
e();
|
|
136
|
-
}, 300);
|
|
137
|
-
}
|
|
138
|
-
H.value = e, e && f.eventBus.emit("workspace:update:selected-client", e.id);
|
|
139
|
-
}, Oe = a(() => (X.value?.length ?? 0) > 2e4), $ = oe();
|
|
140
|
-
return (t, n) => X.value === null || X.value || v(W).pending.value ? (m(), o(v(x), {
|
|
141
|
-
key: 0,
|
|
142
|
-
ref_key: "elem",
|
|
143
|
-
ref: U,
|
|
144
|
-
class: "request-card dark-mode"
|
|
145
|
-
}, {
|
|
146
|
-
default: b(() => [
|
|
147
|
-
d(v(le), { class: "pr-2.5" }, ae({
|
|
148
|
-
default: b(() => [
|
|
149
|
-
n[1] ||= l("span", { class: "sr-only" }, "Request Example for", -1),
|
|
150
|
-
d(r, {
|
|
151
|
-
as: "span",
|
|
152
|
-
class: "request-method",
|
|
153
|
-
method: f.method
|
|
154
|
-
}, null, 8, ["method"]),
|
|
155
|
-
f.generateLabel ? (m(), c("span", {
|
|
156
|
-
key: 0,
|
|
157
|
-
innerHTML: f.generateLabel()
|
|
158
|
-
}, null, 8, E)) : s("", !0),
|
|
159
|
-
g(t.$slots, "header", {}, void 0, !0)
|
|
160
|
-
]),
|
|
161
|
-
_: 2
|
|
162
|
-
}, [!f.isWebhook && V.value ? {
|
|
163
|
-
name: "actions",
|
|
164
|
-
fn: b(() => [V.value > 1 ? (m(), o(v(he), {
|
|
165
|
-
key: 0,
|
|
166
|
-
class: "max-h-80",
|
|
167
|
-
filterFn: v(e),
|
|
168
|
-
inputLabel: f.clientSearchLabel,
|
|
169
|
-
modelValue: H.value,
|
|
170
|
-
options: B.value,
|
|
171
|
-
placement: "bottom-end",
|
|
172
|
-
teleport: "",
|
|
173
|
-
"onUpdate:modelValue": n[0] ||= (e) => De(e)
|
|
174
|
-
}, {
|
|
175
|
-
default: b(({ open: e }) => [d(v(C), {
|
|
176
|
-
"aria-label": Se.value,
|
|
177
|
-
class: "text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-0.5 py-0 text-base font-normal",
|
|
178
|
-
"data-testid": "client-picker",
|
|
179
|
-
variant: "ghost"
|
|
180
|
-
}, {
|
|
181
|
-
default: b(() => [u(_(H.value?.title) + " ", 1), d(v(pe), {
|
|
182
|
-
class: p(["mt-px size-3 transition-transform duration-100", { "rotate-180": e }]),
|
|
183
|
-
weight: "bold"
|
|
184
|
-
}, null, 8, ["class"])]),
|
|
185
|
-
_: 2
|
|
186
|
-
}, 1032, ["aria-label"])]),
|
|
187
|
-
_: 1
|
|
188
|
-
}, 8, [
|
|
189
|
-
"filterFn",
|
|
190
|
-
"inputLabel",
|
|
191
|
-
"modelValue",
|
|
192
|
-
"options"
|
|
193
|
-
])) : (m(), c("span", D, _(H.value?.title), 1))]),
|
|
194
|
-
key: "0"
|
|
195
|
-
} : void 0]), 1024),
|
|
196
|
-
d(v(S), { class: "request-editor-section custom-scroll p-0" }, {
|
|
197
|
-
default: b(() => [v(W).pending.value ? (m(), c("div", O, [v(W).failed.value ? (m(), c(i, { key: 0 }, [n[3] ||= u(" Could not load this example. ", -1), d(v(C), {
|
|
198
|
-
size: "sm",
|
|
199
|
-
variant: "ghost",
|
|
200
|
-
onClick: v(W).retry
|
|
201
|
-
}, {
|
|
202
|
-
default: b(() => [...n[2] ||= [u(" Retry ", -1)]]),
|
|
203
|
-
_: 1
|
|
204
|
-
}, 8, ["onClick"])], 64)) : (m(), c(i, { key: 1 }, [u("Loading example…")], 64))])) : X.value === null ? (m(), c("div", k, _(f.codeSampleUnavailable), 1)) : (m(), c("div", {
|
|
205
|
-
key: 2,
|
|
206
|
-
id: `${v($)}-example`,
|
|
207
|
-
class: "code-snippet group/code-block relative"
|
|
208
|
-
}, [Oe.value ? (m(), c(i, { key: 1 }, [d(v(de), {
|
|
209
|
-
"aria-controls": `${v($)}-virtual-code`,
|
|
210
|
-
class: "scalar-code-copy absolute top-2.5 right-2.5 z-1",
|
|
211
|
-
content: X.value,
|
|
212
|
-
lang: Q.value
|
|
213
|
-
}, null, 8, [
|
|
214
|
-
"aria-controls",
|
|
215
|
-
"content",
|
|
216
|
-
"lang"
|
|
217
|
-
]), d(v(ge), {
|
|
218
|
-
id: `${v($)}-virtual-code`,
|
|
219
|
-
"aria-label": "Request code sample",
|
|
220
|
-
containerClass: "custom-scroll scalar-code-block flex flex-1 max-h-screen",
|
|
221
|
-
contentClass: "language-plaintext whitespace-pre font-code text-base p-2",
|
|
222
|
-
lineHeight: 20,
|
|
223
|
-
role: "region",
|
|
224
|
-
text: Z.value ?? ""
|
|
225
|
-
}, null, 8, ["id", "text"])], 64)) : (m(), o(v(ue), {
|
|
226
|
-
key: 0,
|
|
227
|
-
class: "h-full bg-transparent",
|
|
228
|
-
content: Z.value ?? "",
|
|
229
|
-
copyContent: Y.value ? X.value ?? "" : void 0,
|
|
230
|
-
hideCredentials: Ee.value,
|
|
231
|
-
label: Ce.value,
|
|
232
|
-
lang: Q.value,
|
|
233
|
-
lineNumbers: ""
|
|
234
|
-
}, null, 8, [
|
|
235
|
-
"content",
|
|
236
|
-
"copyContent",
|
|
237
|
-
"hideCredentials",
|
|
238
|
-
"label",
|
|
239
|
-
"lang"
|
|
240
|
-
]))], 8, A))]),
|
|
241
|
-
_: 1
|
|
242
|
-
}),
|
|
243
|
-
K.value || t.$slots.footer || t.$slots["footer-start"] ? (m(), o(v(ce), {
|
|
244
|
-
key: 0,
|
|
245
|
-
class: p(["request-card-footer", { "request-card-footer--wraps": K.value || t.$slots["footer-start"] }])
|
|
246
|
-
}, {
|
|
247
|
-
default: b(() => [K.value ? (m(), c("div", j, [Object.keys(I.value).length ? (m(), o(ie, {
|
|
248
|
-
key: 0,
|
|
249
|
-
examples: I.value,
|
|
250
|
-
modelValue: L.value,
|
|
251
|
-
"onUpdate:modelValue": xe
|
|
252
|
-
}, null, 8, ["examples", "modelValue"])) : s("", !0)])) : t.$slots["footer-start"] ? (m(), c("div", M, [g(t.$slots, "footer-start", {}, void 0, !0)])) : s("", !0), g(t.$slots, "footer", { exampleName: L.value }, void 0, !0)]),
|
|
253
|
-
_: 3
|
|
254
|
-
}, 8, ["class"])) : s("", !0)
|
|
255
|
-
]),
|
|
256
|
-
_: 3
|
|
257
|
-
}, 512)) : f.fallback ? (m(), o(v(x), {
|
|
258
|
-
key: 1,
|
|
259
|
-
class: "request-card dark-mode"
|
|
260
|
-
}, {
|
|
261
|
-
default: b(() => [d(v(S), { class: "request-card-simple bg-transparent shadow-none" }, {
|
|
262
|
-
default: b(() => [l("div", N, [d(r, {
|
|
263
|
-
as: "span",
|
|
264
|
-
class: "request-method",
|
|
265
|
-
method: f.method
|
|
266
|
-
}, null, 8, ["method"]), g(t.$slots, "header", {}, void 0, !0)]), t.$slots.footer ? (m(), c("div", P, [g(t.$slots, "footer", { exampleName: L.value }, void 0, !0)])) : s("", !0)]),
|
|
267
|
-
_: 3
|
|
268
|
-
})]),
|
|
269
|
-
_: 3
|
|
270
|
-
})) : s("", !0);
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
export { F as default };
|
|
274
|
-
|
|
275
|
-
//# sourceMappingURL=CodeExample.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CodeExample.vue_vue_type_script_setup_true_lang.js","names":["$slots","_unref","_openBlock","_createBlock","_withCtx","_createVNode","_createSlots","_createElementVNode","HttpMethod","_createElementBlock","_renderSlot","_createTextVNode","_toDisplayString","_normalizeClass","_Fragment","ExamplePicker","ExamplePicker_default","HttpMethod_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","CodeExample_vue_vue_type_script_setup_true_lang_default","__emit","emit","requestBodyExamples","computed","content","getResolvedRef","__props","contentType","localExampleKey","ref","resolveExampleKey","keys","preferred","watch","watchEffect","selectExample","key","customCodeSamples","getCustomCodeSamples","clients","getClients","clientCount","total","group","localSelectedClient","findClient","newClient","clientPickerAriaLabel","codeSampleAriaLabel","elem","visible","useExampleVisibility","externalExamples","useExternalExamples","getOperationExamples","resolvedOperation","resolveOperationExamples","showExamplePicker","webhookHar","operationToHar","error","generatedTemplate","generateCodeSnippet","resolvedCredentials","scheme","resolveCredentialPlaceholders","generatedCode","displayCode","codeBlockLanguage","webhookLanguage","secretCredentials","getSecrets","selectClient","unfreeze","freezeElement","option","shouldVirtualize","id","useId","unref","openBlock","createBlock","ScalarCard","withCtx","createVNode","ScalarCardHeader","createSlots","_cache","createElementVNode","createElementBlock","createCommentVNode","renderSlot","_ctx","ScalarCombobox","filterClientsByQuery","$event","ScalarButton","createTextVNode","toDisplayString","ScalarIconCaretDown","normalizeClass","open","ScalarCardSection","Fragment","ScalarCodeBlockCopy","ScalarVirtualText","ScalarCodeBlock","ScalarCardFooter"],"sources":["../../../src/code-example/components/CodeExample.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { MultipartNaming } from '@scalar/types/api-reference'\n\nexport type CodeExampleProps = {\n /** Localized status text shown when the selected example has no linked code sample. */\n codeSampleUnavailable?: string\n /**\n * Localized purpose of the client picker. It opens the button's accessible name and the\n * selected client's title is appended, so the name still contains the visible label.\n */\n clientPickerLabel?: string\n /** Localized accessible name for the search field inside the client picker. */\n clientSearchLabel?: string\n /**\n * Localized accessible name for the focusable code sample. The selected client's title is\n * appended so the announcement also says which language the sample is in.\n */\n codeSampleLabel?: string\n /**\n * Integration type: determines if the code sample is displayed in a client environment\n * or in an API reference environment.\n */\n integration?: 'client' | 'reference'\n /**\n * List of all http clients formatted into option groups for the client selector\n */\n clientOptions: ClientOptionGroup[]\n /**\n * Pre-selected client, this will determine which client is initially selected in the dropdown.\n * Either a built-in client id (e.g. `js/fetch`) or a custom sample id (e.g. `custom/python`).\n *\n * Typed as a plain string: unioning the (large) client-id union with the `custom/...`\n * ids overflows TypeScript's union-complexity limit inside this component's `defineProps`.\n *\n * @defaults to a custom sample if one is available, otherwise shell/curl\n */\n selectedClient?: string\n /**\n * Which server from the spec to use for the code example\n */\n selectedServer?: ServerObject | null\n /**\n * The selected content type from the requestBody.content, this will determine which examples are available\n * as well as the content type of the code example\n *\n * @defaults to the first content type if not provided\n */\n selectedContentType?: string\n /**\n * Example name to use for resolving example values for parameters AND requestBody.\n *\n * This is the document-wide selection: it is honored only when this operation defines an example\n * with the same key, so picking an example on one operation syncs the rest without blanking out\n * operations that do not share that key.\n *\n * @example \"limited\"\n * ```ts\n * parameters: {\n * name: 'foobar',\n * in: 'query',\n * examples: {\n * limited: {\n * dataValue: 10,\n * }\n * }\n * },\n * body: {\n * content: {\n * 'application/json': {\n * examples: {\n * limited: {\n * dataValue: { foo: 'bar' },\n * }\n * }\n * }\n * }\n * }\n *\n * ```\n */\n selectedExample?: string\n /**\n * Event bus\n */\n eventBus: WorkspaceEventBus\n /**\n * The security schemes which are applicable to this operation\n */\n securitySchemes: SecuritySchemeObjectSecret[]\n /**\n * HTTP method of the operation\n */\n method: string\n /**\n * Path of the operation\n */\n path: string\n /**\n * De-referenced OpenAPI Operation object\n */\n operation: OperationObject\n /**\n * If true and there's no example, we will display a small card with the method and path only\n */\n fallback?: boolean\n /**\n * A method to generate the label of the block, should return an html string\n */\n generateLabel?: () => string\n /**\n * If true, render this as a webhook request example\n */\n isWebhook?: boolean\n /**\n * Workspace + document cookies\n */\n globalCookies?: XScalarCookie[]\n /**\n * When the request body schema uses oneOf/anyOf, use these selected variants\n * for the example snippet (e.g. from the schema dropdowns in the API reference).\n */\n /** Originating OpenAPI version, used for XML mapping rules. */\n openapiVersion?: string\n /** Document-level JSON Schema dialect used when generating array `contains` examples. */\n jsonSchemaDialect?: string\n multipartNaming?: MultipartNaming\n requestBodyCompositionSelection?: Record<string, number>\n}\n\n/**\n * Request Example\n *\n * The core component for rendering a request example block,\n * this component does not have much of its own state but operates on props and custom events\n *\n * @event workspace:update:selected-client - Emitted when the selected client changes\n * @event workspace:update:selected-example - Emitted when the selected example changes, so other operations can sync\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport {\n ScalarCard,\n ScalarCardFooter,\n ScalarCardHeader,\n ScalarCardSection,\n} from '@scalar/components/card'\nimport {\n ScalarCodeBlock,\n ScalarCodeBlockCopy,\n} from '@scalar/components/code-block'\nimport { ScalarCombobox } from '@scalar/components/combobox'\nimport { ScalarVirtualText } from '@scalar/components/virtual-text'\nimport { freezeElement } from '@scalar/helpers/dom/freeze-element'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n getOperationExamples,\n resolveOperationExamples,\n} from '@scalar/workspace-store/helpers/operation-examples'\nimport {\n useExampleVisibility,\n useExternalExamples,\n} from '@scalar/workspace-store/helpers/use-external-examples'\nimport {\n resolveCredentialPlaceholders,\n type SecuritySchemeObjectSecret,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type {\n OperationObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport {\n computed,\n ref,\n useId,\n watch,\n watchEffect,\n type ComponentPublicInstance,\n} from 'vue'\n\nimport { filterClientsByQuery } from '../helpers/filter-clients-by-query'\nimport { findClient } from '../helpers/find-client'\nimport { generateCodeSnippet } from '../helpers/generate-code-snippet'\nimport { getClients } from '../helpers/get-clients'\nimport { getCustomCodeSamples } from '../helpers/get-custom-code-samples'\nimport { getSecrets } from '../helpers/get-secrets'\nimport { operationToHar } from '../helpers/operation-to-har/operation-to-har'\nimport type {\n ClientOption,\n ClientOptionGroup,\n CustomClientOption,\n} from '../types'\nimport ExamplePicker from './ExamplePicker.vue'\nimport HttpMethod from './HttpMethod.vue'\n\nconst {\n integration,\n codeSampleUnavailable = 'No code sample available for this example.',\n clientPickerLabel = 'Change code sample language',\n clientSearchLabel = 'Search clients',\n codeSampleLabel = 'Code sample',\n clientOptions,\n selectedClient,\n selectedServer = null,\n selectedContentType,\n selectedExample,\n securitySchemes = [],\n method,\n eventBus,\n path,\n operation,\n isWebhook,\n generateLabel,\n globalCookies,\n openapiVersion,\n jsonSchemaDialect,\n multipartNaming,\n requestBodyCompositionSelection,\n} = defineProps<CodeExampleProps>()\n\nconst emit = defineEmits<{\n /**\n * Emitted whenever the example key actually shown for this operation changes.\n *\n * This is the resolved local key (not the raw document-wide selection), so layouts that render\n * the test-request button outside this component can open the client with the same example the\n * snippet displays.\n */\n (e: 'update:exampleKey', value: string): void\n}>()\n\ndefineSlots<{\n 'header': () => unknown\n /** Rendered at the start of the footer, only while the example picker does not need that space */\n 'footer-start'?: () => unknown\n 'footer': ({ exampleName }: { exampleName: string }) => unknown\n}>()\n\n/** Grab the examples for the given content type */\nconst requestBodyExamples = computed(() => {\n const content = getResolvedRef(operation.requestBody)?.content ?? {}\n const contentType = selectedContentType || Object.keys(content)[0]\n if (!contentType) return {}\n\n const examples = content[contentType]?.examples ?? {}\n\n return examples\n})\n\n/**\n * The example key actually shown for this operation.\n *\n * `selectedExample` is the document-wide selection that syncs across operations. We honor it only\n * when this operation actually defines that key, otherwise we keep the local example: a selection\n * on one operation should never blank out an operation that does not share the same example.\n */\nconst localExampleKey = ref('')\n\n/** Resolve the key to display, preferring the document-wide selection when this operation has it */\nconst resolveExampleKey = (preferred: string | undefined): string => {\n const keys = Object.keys(requestBodyExamples.value)\n if (preferred && keys.includes(preferred)) {\n return preferred\n }\n // Keep the current local example when it is still valid, otherwise fall back to the first one\n if (localExampleKey.value && keys.includes(localExampleKey.value)) {\n return localExampleKey.value\n }\n return keys[0] ?? ''\n}\n\n// Set the initial example from the document-wide selection, falling back to the first example.\n// This runs during setup so the server renders the same example as the browser.\nlocalExampleKey.value = resolveExampleKey(selectedExample)\n\n// Follow the document-wide selection when it changes and this operation has that example\nwatch(\n () => selectedExample,\n (preferred) => {\n localExampleKey.value = resolveExampleKey(preferred)\n },\n)\n\n/** Reset the selected example key if the content type changes and the new content type doesn't have the previously selected example */\nwatch(\n () => selectedContentType,\n () => {\n if (\n !Object.keys(requestBodyExamples.value).includes(localExampleKey.value)\n ) {\n // Re-resolve so the new content type still follows the document-wide selection when it has\n // that key, instead of always snapping back to the first example\n localExampleKey.value = resolveExampleKey(selectedExample)\n }\n },\n)\n\n// Keep the parent informed of the resolved key so a test-request button rendered outside this\n// component (e.g. the classic layout header) opens the client with the example the snippet shows\nwatchEffect(() => {\n emit('update:exampleKey', localExampleKey.value)\n})\n\n/** Select an example locally and sync the choice across the document */\nconst selectExample = (key: string) => {\n localExampleKey.value = key\n eventBus.emit('workspace:update:selected-example', key)\n}\n\n/** Grab any custom code samples from the operation */\nconst customCodeSamples = computed(() => getCustomCodeSamples(operation))\n\n/** Merge custom code samples with the client options */\nconst clients = computed(() =>\n getClients(\n customCodeSamples.value.samples,\n clientOptions,\n customCodeSamples.value.label,\n ),\n)\n\n/** Total number of available clients across all option groups */\nconst clientCount = computed(() =>\n clients.value.reduce((total, group) => total + group.options.length, 0),\n)\n\n/** The locally selected client which would include code samples from this operation only */\nconst localSelectedClient = ref<ClientOption | CustomClientOption | undefined>(\n findClient(clients.value, selectedClient),\n)\n\n/**\n * Re-resolve the local client whenever the global selection or the available\n * clients change. Watching `clients` matters when navigating between operations:\n * the stored id stays the same, but the matching option (e.g. a custom sample)\n * differs per operation, so without this the snippet could go stale.\n */\nwatch([() => selectedClient, clients], ([newClient]) => {\n localSelectedClient.value = findClient(clients.value, newClient)\n})\n\n/**\n * Accessible name for the client picker.\n *\n * On its own the button reads as its current value (\"C Libcurl\"), which never\n * says what activating it does. The visible title stays part of the name so it\n * still matches what is on screen.\n */\nconst clientPickerAriaLabel = computed(() =>\n [clientPickerLabel, localSelectedClient.value?.title]\n .filter(Boolean)\n .join(': '),\n)\n\n/**\n * Accessible name for the focusable code sample, e.g. \"Code sample: Shell cURL\".\n *\n * Screen readers announce only the name and role when focus lands on the scroller, so the\n * name tells the user both what the region is and which client it is generated for.\n */\nconst codeSampleAriaLabel = computed(() =>\n [codeSampleLabel, localSelectedClient.value?.title]\n .filter(Boolean)\n .join(': '),\n)\n\nconst elem = ref<ComponentPublicInstance | null>(null)\nconst visible = useExampleVisibility(elem)\nconst externalExamples = useExternalExamples(\n () =>\n getOperationExamples(operation, localExampleKey.value, selectedContentType),\n () => visible.value,\n)\nconst resolvedOperation = computed(() =>\n resolveOperationExamples(\n operation,\n localExampleKey.value,\n selectedContentType,\n externalExamples.resolve,\n ),\n)\n\n/** Keep the picker available because it also selects the example opened by Test Request. */\nconst showExamplePicker = computed(\n () => Object.keys(requestBodyExamples.value).length > 1,\n)\n\n/** Generate HAR data for webhook requests */\nconst webhookHar = computed(() => {\n if (!isWebhook) return null\n\n try {\n return operationToHar({\n operation: resolvedOperation.value,\n method,\n path,\n example: localExampleKey.value,\n openapiVersion,\n jsonSchemaDialect,\n multipartNaming,\n requestBodyCompositionSelection,\n // Only required parameters are shown in code examples; optional parameters\n // are omitted unless explicitly enabled via `x-disabled: false`.\n defaultDisabledParameters: true,\n })\n } catch (error) {\n console.error('[webhookHar]', error)\n return null\n }\n})\n\n/** Generate the code snippet for the selected example */\nconst generatedTemplate = computed<string | null>(() => {\n if (isWebhook) {\n return webhookHar.value?.postData?.text ?? ''\n }\n\n return generateCodeSnippet({\n // Only required parameters are shown in code examples; optional parameters\n // are omitted unless explicitly enabled via `x-disabled: false`.\n defaultDisabledParameters: true,\n includeDefaultHeaders: integration === 'client',\n clientId: localSelectedClient.value?.id,\n customCodeSamples: customCodeSamples.value.samples,\n operation: resolvedOperation.value,\n method,\n path,\n contentType: selectedContentType,\n server: selectedServer,\n securitySchemes,\n example: localExampleKey.value,\n globalCookies,\n openapiVersion,\n jsonSchemaDialect,\n multipartNaming,\n requestBodyCompositionSelection,\n })\n})\n\n/** Resolve custom templates at render time so auth changes never mutate the document. */\nconst resolvedCredentials = computed(() =>\n !isWebhook &&\n localSelectedClient.value?.id.startsWith('custom/') &&\n generatedTemplate.value !== null &&\n securitySchemes.some((scheme) => 'x-scalar-credential-placeholders' in scheme)\n ? resolveCredentialPlaceholders(generatedTemplate.value, securitySchemes)\n : undefined,\n)\n\nconst generatedCode = computed(\n () => resolvedCredentials.value?.content ?? generatedTemplate.value,\n)\n\n/** Mask inserted secrets before escaping or syntax tokenization can split their values. */\nconst displayCode = computed(\n () => resolvedCredentials.value?.displayContent ?? generatedCode.value,\n)\n\n/** The language for the code block, used for syntax highlighting */\nconst codeBlockLanguage = computed(() => {\n if (isWebhook) {\n return webhookLanguage.value\n }\n\n return localSelectedClient.value?.lang\n})\n\n/** Determine the language for webhook content based on MIME type */\nconst webhookLanguage = computed<string>(() => {\n if (!webhookHar.value?.postData) return 'json'\n\n const contentType = webhookHar.value.postData.mimeType\n if (contentType?.includes('json')) return 'json'\n if (contentType?.includes('xml')) return 'xml'\n if (contentType?.includes('yaml') || contentType?.includes('yml'))\n return 'yaml'\n if (contentType?.includes('text/plain')) return 'text'\n\n return 'json'\n})\n\n/** Block secrets from being shown in the code block */\nconst secretCredentials = computed(() =>\n resolvedCredentials.value ? [] : getSecrets(securitySchemes),\n)\n\n/** Set custom example, or update the selected HTTP client globally */\nconst selectClient = (option: ClientOption) => {\n // We need to freeze the ui to prevent scrolling as the clients change\n if (elem.value) {\n const unfreeze = freezeElement(elem.value.$el)\n setTimeout(() => {\n unfreeze()\n }, 300)\n }\n // Update to the local example\n localSelectedClient.value = option\n\n // Sync the selection globally so other operations follow along. Custom samples\n // sync too (keyed by language), so picking e.g. the Python SDK example here\n // shows the Python example on every operation that ships one.\n if (option) {\n eventBus.emit('workspace:update:selected-client', option.id)\n }\n}\n\n// Virtualize the code block if it's too large\n// This prevents the entire app from freezing up if there's a massive example\n// We set a lower threshold here as code examples can get quite large\nconst VIRTUALIZATION_THRESHOLD = 20_000\n\nconst shouldVirtualize = computed(\n () => (generatedCode.value?.length ?? 0) > VIRTUALIZATION_THRESHOLD,\n)\n\nconst id = useId()\n</script>\n<template>\n <ScalarCard\n v-if=\"\n generatedCode === null || generatedCode || externalExamples.pending.value\n \"\n ref=\"elem\"\n class=\"request-card dark-mode\">\n <!-- Header -->\n <ScalarCardHeader class=\"pr-2.5\">\n <span class=\"sr-only\">Request Example for</span>\n <HttpMethod\n as=\"span\"\n class=\"request-method\"\n :method=\"method\" />\n <span\n v-if=\"generateLabel\"\n v-html=\"generateLabel()\" />\n <slot name=\"header\" />\n <!-- Client picker -->\n <template\n v-if=\"!isWebhook && clientCount\"\n #actions>\n <!-- Multiple clients: render a dropdown to switch between them -->\n <ScalarCombobox\n v-if=\"clientCount > 1\"\n v-slot=\"{ open }\"\n class=\"max-h-80\"\n :filterFn=\"filterClientsByQuery\"\n :inputLabel=\"clientSearchLabel\"\n :modelValue=\"localSelectedClient\"\n :options=\"clients\"\n placement=\"bottom-end\"\n teleport\n @update:modelValue=\"selectClient($event as ClientOption)\">\n <ScalarButton\n :aria-label=\"clientPickerAriaLabel\"\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-0.5 py-0 text-base font-normal\"\n data-testid=\"client-picker\"\n variant=\"ghost\">\n {{ localSelectedClient?.title }}\n <!--\n Follow this picker's own state. The `ui-open:` variant also matches any open\n Headless UI ancestor, such as an expanded operation in the classic layout.\n -->\n <ScalarIconCaretDown\n class=\"mt-px size-3 transition-transform duration-100\"\n :class=\"{ 'rotate-180': open }\"\n weight=\"bold\" />\n </ScalarButton>\n </ScalarCombobox>\n <!-- Single client: just show its label, no need for a dropdown -->\n <span\n v-else\n class=\"text-c-2 flex h-full w-fit items-center px-0.5 py-0 text-base font-normal\"\n data-testid=\"client-picker\">\n {{ localSelectedClient?.title }}\n </span>\n </template>\n </ScalarCardHeader>\n\n <!-- Code snippet -->\n <ScalarCardSection class=\"request-editor-section custom-scroll p-0\">\n <div\n v-if=\"externalExamples.pending.value\"\n class=\"text-c-2 p-4\"\n role=\"status\">\n <template v-if=\"externalExamples.failed.value\">\n Could not load this example.\n <ScalarButton\n size=\"sm\"\n variant=\"ghost\"\n @click=\"externalExamples.retry\">\n Retry\n </ScalarButton>\n </template>\n <template v-else>Loading example…</template>\n </div>\n <div\n v-else-if=\"generatedCode === null\"\n class=\"text-c-2 p-4\"\n role=\"status\">\n {{ codeSampleUnavailable }}\n </div>\n <div\n v-else\n :id=\"`${id}-example`\"\n class=\"code-snippet group/code-block relative\">\n <ScalarCodeBlock\n v-if=\"!shouldVirtualize\"\n class=\"h-full bg-transparent\"\n :content=\"displayCode ?? ''\"\n :copyContent=\"resolvedCredentials ? (generatedCode ?? '') : undefined\"\n :hideCredentials=\"secretCredentials\"\n :label=\"codeSampleAriaLabel\"\n :lang=\"codeBlockLanguage\"\n lineNumbers />\n <template v-else>\n <ScalarCodeBlockCopy\n :aria-controls=\"`${id}-virtual-code`\"\n class=\"scalar-code-copy absolute top-2.5 right-2.5 z-1\"\n :content=\"generatedCode\"\n :lang=\"codeBlockLanguage\" />\n <ScalarVirtualText\n :id=\"`${id}-virtual-code`\"\n aria-label=\"Request code sample\"\n containerClass=\"custom-scroll scalar-code-block flex flex-1 max-h-screen\"\n contentClass=\"language-plaintext whitespace-pre font-code text-base p-2\"\n :lineHeight=\"20\"\n role=\"region\"\n :text=\"displayCode ?? ''\" />\n </template>\n </div>\n </ScalarCardSection>\n\n <!-- Footer -->\n <ScalarCardFooter\n v-if=\"showExamplePicker || $slots.footer || $slots['footer-start']\"\n class=\"request-card-footer\"\n :class=\"{\n 'request-card-footer--wraps':\n showExamplePicker || $slots['footer-start'],\n }\">\n <!-- Example picker -->\n <div\n v-if=\"showExamplePicker\"\n class=\"request-card-footer-addon\">\n <template v-if=\"Object.keys(requestBodyExamples).length\">\n <ExamplePicker\n :examples=\"requestBodyExamples\"\n :modelValue=\"localExampleKey\"\n @update:modelValue=\"selectExample\" />\n </template>\n </div>\n <!-- Otherwise the start of the footer is free for the caller -->\n <div\n v-else-if=\"$slots['footer-start']\"\n class=\"request-card-footer-start\">\n <slot name=\"footer-start\" />\n </div>\n\n <!-- Footer -->\n <slot\n :exampleName=\"localExampleKey\"\n name=\"footer\" />\n </ScalarCardFooter>\n </ScalarCard>\n\n <!-- Fallback card with just method and path in the case of no examples -->\n <ScalarCard\n v-else-if=\"fallback\"\n class=\"request-card dark-mode\">\n <!-- A single row of method, path and actions reads as a header, so it stays on the card -->\n <ScalarCardSection class=\"request-card-simple bg-transparent shadow-none\">\n <div class=\"request-header\">\n <HttpMethod\n as=\"span\"\n class=\"request-method\"\n :method=\"method\" />\n <slot name=\"header\" />\n </div>\n <div\n v-if=\"$slots.footer\"\n class=\"request-card-actions relative max-w-full\">\n <slot\n :exampleName=\"localExampleKey\"\n name=\"footer\" />\n </div>\n </ScalarCardSection>\n </ScalarCard>\n</template>\n<style scoped>\n.request-card {\n color: var(--scalar-color-1);\n font-size: var(--scalar-font-size-3);\n}\n.request-method {\n font-family: var(--scalar-font-code);\n margin-right: 6px;\n}\n.request-card-footer {\n display: flex;\n justify-content: flex-end;\n padding: 6px;\n flex-shrink: 0;\n position: relative;\n}\n/*\n * The example picker or footer-start content keeps room for itself; when the footer is too narrow\n * for everything, the end controls wrap onto a second line instead of squeezing or covering it.\n */\n.request-card-footer--wraps {\n flex-wrap: wrap;\n row-gap: 4px;\n}\n.request-card-footer-start {\n display: flex;\n align-items: center;\n flex: 1 0 auto;\n}\n/*\n * The picker asks for its example name's width, capped at 7em (about eight characters), so on a\n * narrow card the end controls wrap rather than squeeze the name out of view. The cap keeps a long\n * name truncating beside them on wider cards, as before. The picker never grows past its name, and\n * the end margin holds it at the start of the line.\n */\n.request-card-footer-addon {\n display: flex;\n align-items: center;\n\n flex: 1 1 7em;\n min-width: 0;\n max-width: max-content;\n margin-inline-end: auto;\n}\n.request-editor-section {\n display: flex;\n flex: 1;\n}\n/*\n * A long sample is drawn as virtual text with its own copy button rather than a code block, so\n * that button gets the same raised fill a code block gives its button on a card's surface.\n */\n.code-snippet > .scalar-code-copy {\n background: var(--scalar-card-surface-raised, var(--scalar-background-2));\n}\n.request-card-simple {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n\n padding: 8px 8px 8px 12px;\n\n font-size: var(--scalar-small);\n}\n.request-header {\n /* Give spare inline space to the path, while actions fill their own row after wrapping. */\n flex: 999 1 auto;\n min-width: 0;\n overflow-wrap: anywhere;\n}\n.request-card-actions {\n flex: 1 0 auto;\n}\n.code-snippet {\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiOA,IAAM6B,KAAOD,GAmBPE,IAAsBC,QAAe;GACzC,IAAMC,IAAUC,GAAeC,EAAA,UAAU,WAAW,CAAC,EAAE,WAAW,CAAC,GAC7DC,IAAcD,EAAA,uBAAuB,OAAO,KAAKF,CAAO,CAAC,CAAC;GAKhE,OAJKG,IAEYH,EAAQG,EAAY,EAAE,YAAY,CAAC,IAF3B,CAAC;EAK5B,CAAC,GASKC,IAAkBC,EAAI,EAAE,GAGxBC,KAAqB,MAA0C;GACnE,IAAMC,IAAO,OAAO,KAAKT,EAAoB,KAAK;GAQlD,OAPIU,KAAaD,EAAK,SAASC,CAAS,IAC/BA,IAGLJ,EAAgB,SAASG,EAAK,SAASH,EAAgB,KAAK,IACvDA,EAAgB,QAElBG,EAAK,MAAM;EACpB;EA8BA,AA1BA,EAAgB,QAAQD,EAAkBJ,EAAA,eAAe,GAGzDO,QACQP,EAAA,kBACL,MAAc;GACb,EAAgB,QAAQI,EAAkBE,CAAS;EACrD,CACF,GAGAC,QACQP,EAAA,2BACA;GACJ,AACG,OAAO,KAAKJ,EAAoB,KAAK,CA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GuCY,IAAA;;MAFpC,UAAUe,EAAA;MACV,YAAYM,EAAA;MACZ,uBAAmBO;K,0DAKb3C,EAAAA,OAAM,mBADnBE,EAAA,GAAAO,EAIM,OAJNe,GAIM,CADJd,EAA4B0F,EAAA,QAAA,gBAAA,CAAA,GAAA,KAAA,GAAA,EAAA,C,iBAI9B1F,EAEkB0F,EAAA,QAAA,UAAA,EADf,aAAahE,EAAA,MAAe,GAAA,KAAA,GAAA,EAAA,C;;;;;E,WAOtBF,EAAA,YADbhC,EAAA,GAAAC,EAoBaF,EAAAyF,CAAA,GAAA;;GAlBX,OAAM;;GAEN,SAAAtF,QAeoB,CAfpBC,EAeoBJ,EAAA6G,CAAA,GAAA,EAfD,OAAM,iDAAgD,GAAA;IACvE,SAAA1G,QAMM,CANNG,EAMM,OANNkB,GAMM,CALJpB,EAGqBG,GAAA;KAFnB,IAAG;KACH,OAAM;KACL,QAAQ0B,EAAA;I,yBACXxB,EAAsB0F,EAAA,QAAA,UAAA,CAAA,GAAA,KAAA,GAAA,EAAA,C,IAGhBpG,EAAAA,OAAO,UADfE,EAAA,GAAAO,EAMM,OANNiB,GAMM,CAHJhB,EAEkB0F,EAAA,QAAA,UAAA,EADf,aAAahE,EAAA,MAAe,GAAA,KAAA,GAAA,EAAA,C"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { getExampleSummary as e } from "../../schema/helpers/get-rendered-example.js";
|
|
2
|
-
import { computed as t, createBlock as n, createElementVNode as r, createVNode as i, defineComponent as a, mergeModels as o, mergeProps as s, normalizeClass as c, openBlock as l, toDisplayString as u, unref as d, useModel as f, withCtx as p } from "vue";
|
|
3
|
-
import { ScalarButton as m } from "@scalar/components/button";
|
|
4
|
-
import { ScalarListbox as h } from "@scalar/components/listbox";
|
|
5
|
-
import { ScalarIconCaretDown as g } from "@scalar/icons";
|
|
6
|
-
// src/code-example/components/ExamplePicker.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
-
var _ = { class: "min-w-0 flex-1 truncate" }, v = /*@__PURE__*/ a({
|
|
8
|
-
inheritAttrs: !1,
|
|
9
|
-
__name: "ExamplePicker",
|
|
10
|
-
props: /*@__PURE__*/ o({ examples: { default: () => ({}) } }, {
|
|
11
|
-
modelValue: { required: !0 },
|
|
12
|
-
modelModifiers: {}
|
|
13
|
-
}),
|
|
14
|
-
emits: ["update:modelValue"],
|
|
15
|
-
setup(a) {
|
|
16
|
-
let o = f(a, "modelValue"), v = t(() => Object.entries(a.examples).map(([t, n]) => ({
|
|
17
|
-
id: t,
|
|
18
|
-
label: e(n) || t
|
|
19
|
-
}))), y = t({
|
|
20
|
-
get: () => v.value.find(({ id: e }) => e === o.value),
|
|
21
|
-
set: (e) => o.value = e?.id ?? ""
|
|
22
|
-
});
|
|
23
|
-
return (e, t) => (l(), n(d(h), {
|
|
24
|
-
modelValue: y.value,
|
|
25
|
-
"onUpdate:modelValue": t[0] ||= (e) => y.value = e,
|
|
26
|
-
class: "w-fit min-w-32",
|
|
27
|
-
options: v.value,
|
|
28
|
-
placement: "bottom-start",
|
|
29
|
-
teleport: ""
|
|
30
|
-
}, {
|
|
31
|
-
default: p(({ open: t }) => [i(d(m), s({
|
|
32
|
-
class: "text-c-2 hover:text-c-1 flex h-full w-fit min-w-0 gap-1.5 px-1.5 py-0.75 text-base font-normal",
|
|
33
|
-
"data-testid": "example-picker",
|
|
34
|
-
variant: "ghost"
|
|
35
|
-
}, e.$attrs), {
|
|
36
|
-
default: p(() => [r("div", _, u(y.value?.label ?? "Select an example"), 1), i(d(g), {
|
|
37
|
-
class: c(["mt-0.25 size-3 transition-transform duration-100", { "rotate-180": t }]),
|
|
38
|
-
weight: "bold"
|
|
39
|
-
}, null, 8, ["class"])]),
|
|
40
|
-
_: 2
|
|
41
|
-
}, 1040)]),
|
|
42
|
-
_: 1
|
|
43
|
-
}, 8, ["modelValue", "options"]));
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
export { v as default };
|
|
47
|
-
|
|
48
|
-
//# sourceMappingURL=ExamplePicker.vue_vue_type_script_setup_true_lang.js.map
|
package/dist/code-example/components/ExamplePicker.vue_vue_type_script_setup_true_lang.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExamplePicker.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_useModel","_openBlock","_createBlock","_unref","_withCtx","_createVNode","_mergeProps","_createElementVNode","_toDisplayString","_normalizeClass","_hoisted_1","ExamplePicker_vue_vue_type_script_setup_true_lang_default","\"modelValue\"","\"modelModifiers\"","selectedExampleKey","useModel","__props","exampleOptions","computed","key","example","getExampleSummary","selectedExample","id","v","openBlock","createBlock","unref","ScalarListbox","_cache","$event","withCtx","createVNode","ScalarButton","mergeProps","_ctx","createElementVNode","toDisplayString","ScalarIconCaretDown","normalizeClass","open"],"sources":["../../../src/code-example/components/ExamplePicker.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport {\n ScalarListbox,\n type ScalarListboxOption,\n} from '@scalar/components/listbox'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport type { MediaTypeObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { getExampleSummary } from '../../schema/helpers/get-rendered-example'\n\nconst { examples = {} } = defineProps<{\n examples?: MediaTypeObject['examples'] | Record<string, string>\n}>()\n\nconst selectedExampleKey = defineModel<string>({\n required: true,\n})\n\ndefineOptions({ inheritAttrs: false })\n\nconst exampleOptions = computed<ScalarListboxOption[]>(() =>\n Object.entries(examples).map(([key, example]) => ({\n id: key,\n label: getExampleSummary(example) || key,\n })),\n)\n\nconst selectedExample = computed<ScalarListboxOption | undefined>({\n get: () =>\n exampleOptions.value.find(({ id }) => id === selectedExampleKey.value),\n set: (v) => (selectedExampleKey.value = v?.id ?? ''),\n})\n</script>\n\n<template>\n <ScalarListbox\n v-slot=\"{ open }\"\n v-model=\"selectedExample\"\n class=\"w-fit min-w-32\"\n :options=\"exampleOptions\"\n placement=\"bottom-start\"\n teleport>\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit min-w-0 gap-1.5 px-1.5 py-0.75 text-base font-normal\"\n data-testid=\"example-picker\"\n variant=\"ghost\"\n v-bind=\"$attrs\">\n <div class=\"min-w-0 flex-1 truncate\">\n {{ selectedExample?.label ?? 'Select an example' }}\n </div>\n <!--\n Follow this listbox's own state. The `ui-open:` variant also matches any open\n Headless UI ancestor, such as an expanded operation in the classic layout.\n -->\n <ScalarIconCaretDown\n class=\"mt-0.25 size-3 transition-transform duration-100\"\n :class=\"{ 'rotate-180': open }\"\n weight=\"bold\" />\n </ScalarButton>\n </ScalarListbox>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;EAgBA,IAAMe,IAAqBd,EAAmBgB,GAAA,YAE7C,GAIKC,IAAiBC,QACrB,OAAO,QAAQF,EAAA,QAAQ,CAAC,CAAC,KAAK,CAACG,GAAKC,QAAc;GAChD,IAAID;GACJ,OAAOE,EAAkBD,CAAO,KAAKD;EACvC,EAAE,CACJ,GAEMG,IAAkBJ,EAA0C;GAChE,WACED,EAAe,MAAM,MAAM,EAAE,YAASM,MAAOT,EAAmB,KAAK;GACvE,MAAM,MAAO,EAAmB,QAAQU,GAAG,MAAM;EACnD,CAAC;E,kBAICvB,EAAA,GAAAC,EAwBgBC,EAAAyB,CAAA,GAAA;GAtBL,YAAAN,EAAA;GAAA,uBAAA,AAAAO,EAAA,QAAA,MAAA,EAAe,QAAAC;GACxB,OAAM;GACL,SAASb,EAAA;GACV,WAAU;GACV,UAAA;;GACA,SAAAb,GAgBe,EAtBL,cAAI,CAMdC,EAgBeF,EAAA8B,CAAA,GAhBf3B,EAgBe;IAfb,OAAM;IACN,eAAY;IACZ,SAAQ;GACAP,GAAAA,EAAAA,MAAM,GAAA;IACd,SAAAK,QAEM,CAFNG,EAEM,OAFNG,GAEMF,EADDc,EAAA,OAAiB,SAAK,mBAAA,GAAA,CAAA,GAM3BjB,EAGkBF,EAAAmC,CAAA,GAAA;KAFhB,OAAK7B,EAAA,CAAC,oDAAkD,EAAA,cAChC+B,EAAI,CAAA,CAAA;KAC5B,QAAO"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { computed as e, createBlock as t, createTextVNode as n, defineComponent as r, normalizeClass as i, normalizeStyle as a, openBlock as o, renderSlot as s, resolveDynamicComponent as c, toDisplayString as l, unref as u, withCtx as d } from "vue";
|
|
2
|
-
import { getHttpMethodInfo as f } from "@scalar/helpers/http/http-info";
|
|
3
|
-
import { isHttpMethod as p } from "@scalar/helpers/http/is-http-method";
|
|
4
|
-
// src/code-example/components/HttpMethod.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var m = /*@__PURE__*/ r({
|
|
6
|
-
__name: "HttpMethod",
|
|
7
|
-
props: {
|
|
8
|
-
as: { type: [
|
|
9
|
-
Object,
|
|
10
|
-
Function,
|
|
11
|
-
String
|
|
12
|
-
] },
|
|
13
|
-
property: {},
|
|
14
|
-
short: { type: Boolean },
|
|
15
|
-
method: {}
|
|
16
|
-
},
|
|
17
|
-
setup(r) {
|
|
18
|
-
let m = r, h = e(() => f(String(m.method || ""))), g = e(() => {
|
|
19
|
-
if (typeof m.method != "string" || !m.method.trim()) return "get";
|
|
20
|
-
let e = m.method.trim();
|
|
21
|
-
return p(e.toLowerCase()) ? e.toLowerCase() : e;
|
|
22
|
-
});
|
|
23
|
-
return (e, f) => (o(), t(c(r.as ?? "span"), {
|
|
24
|
-
class: i({ uppercase: u(p)(g.value) }),
|
|
25
|
-
style: a({ [r.property || "color"]: h.value.colorVar })
|
|
26
|
-
}, {
|
|
27
|
-
default: d(() => [s(e.$slots, "default"), n(" " + l(r.short ? h.value.short : g.value), 1)]),
|
|
28
|
-
_: 3
|
|
29
|
-
}, 8, ["class", "style"]));
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
export { m as default };
|
|
33
|
-
|
|
34
|
-
//# sourceMappingURL=HttpMethod.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HttpMethod.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_resolveDynamicComponent","_normalizeClass","_unref","_normalizeStyle","_withCtx","_renderSlot","_createTextVNode","_toDisplayString","HttpMethod_vue_vue_type_script_setup_true_lang_default","props","__props","httpMethodInfo","computed","getHttpMethodInfo","normalized","method","isHttpMethod","openBlock","createBlock","resolveDynamicComponent","normalizeClass","unref","normalizeStyle","withCtx","renderSlot","_ctx","createTextVNode","toDisplayString"],"sources":["../../../src/code-example/components/HttpMethod.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { getHttpMethodInfo } from '@scalar/helpers/http/http-info'\nimport { isHttpMethod } from '@scalar/helpers/http/is-http-method'\nimport { computed, type Component } from 'vue'\n\nconst props = defineProps<{\n /** The type of element to render as, defaults to `span` */\n as?: Component | string\n /** The css style property or variable that will be set to the request method color, defaults to `color` */\n property?: string\n /** Whether or not to abbreviated the slot content */\n short?: boolean\n /** The HTTP method to show */\n method: string\n}>()\n\n/** Grabs the method info object which contains abbreviation, color, and background color etc */\nconst httpMethodInfo = computed(() =>\n getHttpMethodInfo(String(props.method || '')),\n)\n\n/** Full method name */\nconst normalized = computed(() => {\n if (typeof props.method !== 'string' || !props.method.trim()) {\n return 'get'\n }\n const method = props.method.trim()\n return isHttpMethod(method.toLowerCase()) ? method.toLowerCase() : method\n})\n</script>\n\n<template>\n <component\n :is=\"as ?? 'span'\"\n :class=\"{ uppercase: isHttpMethod(normalized) }\"\n :style=\"{ [property || 'color']: httpMethodInfo.colorVar }\">\n <slot />\n {{ short ? httpMethodInfo.short : normalized }}\n </component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;EAKA,IAAMW,IAAQC,GAYRC,IAAiBC,QACrBC,EAAkB,OAAOJ,EAAM,UAAU,EAAE,CAAC,CAC9C,GAGMK,IAAaF,QAAe;GAChC,IAAI,OAAOH,EAAM,UAAW,YAAY,CAACA,EAAM,OAAO,KAAK,GACzD,OAAO;GAET,IAAMM,IAASN,EAAM,OAAO,KAAK;GACjC,OAAOO,EAAaD,EAAO,YAAY,CAAC,IAAIA,EAAO,YAAY,IAAIA;EACrE,CAAC;E,kBAICjB,EAAA,GAAAC,EAMYC,EALLU,EAAA,MAAE,MAAA,GAAA;GACN,OAAKT,EAAA,EAAA,WAAeC,EAAAc,CAAA,CAAY,CAACF,EAAA,KAAU,EAAA,CAAA;GAC3C,OAAKX,EAAA,GAAKO,EAAA,YAAQ,UAAcC,EAAA,MAAe,SAAQ,CAAA;;GACxD,SAAAP,QAAQ,CAARC,EAAQoB,EAAA,QAAA,SAAA,GAAAnB,EAAA,MACRC,EAAGG,EAAA,QAAQC,EAAA,MAAe,QAAQG,EAAA,KAAU,GAAA,CAAA,C"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { computed as e, defineComponent as t, toDisplayString as n } from "vue";
|
|
2
|
-
// src/schema/RenderString.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
-
var r = /*@__PURE__*/ t({
|
|
4
|
-
__name: "RenderString",
|
|
5
|
-
props: { value: {} },
|
|
6
|
-
setup(t) {
|
|
7
|
-
let r = e(() => t.value === "" ? "''" : t.value === null ? "null" : t.value === void 0 ? "undefined" : t.value);
|
|
8
|
-
return (e, t) => n(r.value);
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
export { r as default };
|
|
12
|
-
|
|
13
|
-
//# sourceMappingURL=RenderString.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RenderString.vue_vue_type_script_setup_true_lang.js","names":["_toDisplayString","RenderString_vue_vue_type_script_setup_true_lang_default","valueAsString","computed","__props","toDisplayString"],"sources":["../../src/schema/RenderString.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Give this component any data, and it tries to render a meaningful string.\n *\n * @example\n * <RenderString :value=\"1\" /> => \"1\"\n * <RenderString :value=\"true\" /> => \"true\"\n * <RenderString :value=\"false\" /> => \"false\"\n * <RenderString :value=\"null\" /> => \"null\"\n * <RenderString :value=\"undefined\" /> => \"undefined\"\n * <RenderString :value=\"{}\" /> => \"{}\"\n * <RenderString :value=\"[]\" /> => \"[]\"\n * <RenderString :value=\"['a', 'b', 'c']\" /> => \"['a', 'b', 'c']\"\n * <RenderString :value=\"() => 'hello'\" /> => \"() => 'hello'\"\n * <RenderString :value=\"Symbol('test')\" /> => \"Symbol(test)\"\n **/\nimport { computed } from 'vue'\n\nconst { value } = defineProps<{\n value: any\n}>()\n\nconst valueAsString = computed(() => {\n if (value === '') {\n return `''`\n }\n\n if (value === null) {\n return 'null'\n }\n\n if (value === undefined) {\n return 'undefined'\n }\n\n // We don't need to cover all cases, Vue does a good job of rendering objects, arrays and functions.\n return value\n})\n</script>\n\n<template>\n {{ valueAsString }}\n</template>\n"],"mappings":";;;;;;EAsBA,IAAME,IAAgBC,QAChBC,EAAA,UAAU,KACL,OAGLA,EAAA,UAAU,OACL,SAGLA,EAAA,UAAU,KAAA,IACL,cAIFA,EAAA,KACR;E,iBAIIJ,EAAAE,EAAA,KAAa"}
|