@scalar/blocks 0.7.2 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/_virtual/_plugin-vue_export-helper.js +1 -2
  3. package/dist/code-example/components/AsyncApiCodeExample.vue.js +1 -2
  4. package/dist/code-example/components/AsyncApiCodeExample.vue.js.map +1 -1
  5. package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js +1 -2
  6. package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js.map +1 -1
  7. package/dist/code-example/components/CodeExample.vue.d.ts +2 -0
  8. package/dist/code-example/components/CodeExample.vue.d.ts.map +1 -1
  9. package/dist/code-example/components/CodeExample.vue.js +4 -5
  10. package/dist/code-example/components/CodeExample.vue.js.map +1 -1
  11. package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js +85 -83
  12. package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js.map +1 -1
  13. package/dist/code-example/components/ExamplePicker.vue.d.ts.map +1 -1
  14. package/dist/code-example/components/ExamplePicker.vue.js +1 -2
  15. package/dist/code-example/components/ExamplePicker.vue.js.map +1 -1
  16. package/dist/code-example/components/ExamplePicker.vue_vue_type_script_setup_true_lang.js +20 -21
  17. package/dist/code-example/components/ExamplePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  18. package/dist/code-example/components/HttpMethod.vue.js +1 -2
  19. package/dist/code-example/components/HttpMethod.vue.js.map +1 -1
  20. package/dist/code-example/components/HttpMethod.vue_vue_type_script_setup_true_lang.js +1 -2
  21. package/dist/code-example/helpers/filter-clients-by-query.js +1 -2
  22. package/dist/code-example/helpers/find-client.js +1 -2
  23. package/dist/code-example/helpers/format-language.js +1 -2
  24. package/dist/code-example/helpers/generate-client-options.js +1 -2
  25. package/dist/code-example/helpers/generate-code-snippet.d.ts +2 -1
  26. package/dist/code-example/helpers/generate-code-snippet.d.ts.map +1 -1
  27. package/dist/code-example/helpers/generate-code-snippet.js +11 -11
  28. package/dist/code-example/helpers/generate-code-snippet.js.map +1 -1
  29. package/dist/code-example/helpers/get-asyncapi-example-context.js +1 -2
  30. package/dist/code-example/helpers/get-clients.js +8 -9
  31. package/dist/code-example/helpers/get-custom-code-samples.js +1 -2
  32. package/dist/code-example/helpers/get-generated-payload-example.js +1 -2
  33. package/dist/code-example/helpers/get-message-example-content.js +1 -2
  34. package/dist/code-example/helpers/get-secrets.js +1 -2
  35. package/dist/code-example/helpers/get-snippet.js +1 -2
  36. package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts +2 -1
  37. package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
  38. package/dist/code-example/helpers/operation-to-har/operation-to-har.js +32 -31
  39. package/dist/code-example/helpers/operation-to-har/operation-to-har.js.map +1 -1
  40. package/dist/code-example/helpers/operation-to-har/process-body.d.ts +2 -2
  41. package/dist/code-example/helpers/operation-to-har/process-body.d.ts.map +1 -1
  42. package/dist/code-example/helpers/operation-to-har/process-body.js +80 -52
  43. package/dist/code-example/helpers/operation-to-har/process-body.js.map +1 -1
  44. package/dist/code-example/helpers/operation-to-har/process-parameters.d.ts +2 -1
  45. package/dist/code-example/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
  46. package/dist/code-example/helpers/operation-to-har/process-parameters.js +65 -58
  47. package/dist/code-example/helpers/operation-to-har/process-parameters.js.map +1 -1
  48. package/dist/code-example/helpers/operation-to-har/process-security-schemes.js +1 -2
  49. package/dist/code-example/helpers/operation-to-har/process-server-url.js +1 -2
  50. package/dist/code-example/index.js +10 -10
  51. package/dist/code-example/mount-asyncapi.js +7 -8
  52. package/dist/code-example/mount.d.ts.map +1 -1
  53. package/dist/code-example/mount.js +33 -33
  54. package/dist/code-example/mount.js.map +1 -1
  55. package/dist/constants.js +2 -3
  56. package/dist/schema/LinkButton.vue.js +1 -2
  57. package/dist/schema/RenderString.vue.js +1 -2
  58. package/dist/schema/RenderString.vue.js.map +1 -1
  59. package/dist/schema/RenderString.vue_vue_type_script_setup_true_lang.js +1 -2
  60. package/dist/schema/Schema.vue.js +4 -5
  61. package/dist/schema/Schema.vue.js.map +1 -1
  62. package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js +67 -68
  63. package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js.map +1 -1
  64. package/dist/schema/SchemaCollapsedPreview.vue.js +1 -2
  65. package/dist/schema/SchemaCollapsedPreview.vue.js.map +1 -1
  66. package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js +1 -2
  67. package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js.map +1 -1
  68. package/dist/schema/SchemaComposition.vue.js +4 -5
  69. package/dist/schema/SchemaComposition.vue.js.map +1 -1
  70. package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js +26 -27
  71. package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js.map +1 -1
  72. package/dist/schema/SchemaEnumPropertyItem.vue.js +1 -2
  73. package/dist/schema/SchemaEnumPropertyItem.vue.js.map +1 -1
  74. package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js +1 -2
  75. package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  76. package/dist/schema/SchemaEnums.vue.js +4 -5
  77. package/dist/schema/SchemaEnums.vue.js.map +1 -1
  78. package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js +12 -13
  79. package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js.map +1 -1
  80. package/dist/schema/SchemaGlyphPuck.vue.js +1 -2
  81. package/dist/schema/SchemaGlyphPuck.vue.js.map +1 -1
  82. package/dist/schema/SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js +1 -2
  83. package/dist/schema/SchemaGutterToggle.vue.js +1 -2
  84. package/dist/schema/SchemaGutterToggle.vue.js.map +1 -1
  85. package/dist/schema/SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js +1 -2
  86. package/dist/schema/SchemaHeading.vue.js +4 -5
  87. package/dist/schema/SchemaHeading.vue.js.map +1 -1
  88. package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js +1 -2
  89. package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js.map +1 -1
  90. package/dist/schema/SchemaObjectExampleCodeBlock.vue.js +1 -2
  91. package/dist/schema/SchemaObjectExampleCodeBlock.vue.js.map +1 -1
  92. package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js +1 -2
  93. package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js.map +1 -1
  94. package/dist/schema/SchemaObjectProperties.vue.js +1 -2
  95. package/dist/schema/SchemaObjectProperties.vue.js.map +1 -1
  96. package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js +1 -2
  97. package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js.map +1 -1
  98. package/dist/schema/SchemaProperty.vue.js +4 -5
  99. package/dist/schema/SchemaProperty.vue.js.map +1 -1
  100. package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js +48 -49
  101. package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js.map +1 -1
  102. package/dist/schema/SchemaPropertyDefault.vue.js +4 -5
  103. package/dist/schema/SchemaPropertyDefault.vue.js.map +1 -1
  104. package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js +9 -10
  105. package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js.map +1 -1
  106. package/dist/schema/SchemaPropertyDetail.vue.js +4 -5
  107. package/dist/schema/SchemaPropertyDetail.vue.js.map +1 -1
  108. package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js +1 -2
  109. package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js.map +1 -1
  110. package/dist/schema/SchemaPropertyExamples.vue.js +4 -5
  111. package/dist/schema/SchemaPropertyExamples.vue.js.map +1 -1
  112. package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js +18 -19
  113. package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js.map +1 -1
  114. package/dist/schema/SchemaPropertyHeading.vue.js +4 -5
  115. package/dist/schema/SchemaPropertyHeading.vue.js.map +1 -1
  116. package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js +101 -102
  117. package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js.map +1 -1
  118. package/dist/schema/SchemaPropertyPattern.vue.js +4 -5
  119. package/dist/schema/SchemaPropertyPattern.vue.js.map +1 -1
  120. package/dist/schema/SchemaPropertyPattern.vue_vue_type_script_setup_true_lang.js +1 -2
  121. package/dist/schema/SchemaRailPanel.vue.js +1 -2
  122. package/dist/schema/SchemaRailPanel.vue.js.map +1 -1
  123. package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js +1 -2
  124. package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  125. package/dist/schema/components/CopyLinkButton.vue.js +1 -2
  126. package/dist/schema/components/CopyLinkButton.vue.js.map +1 -1
  127. package/dist/schema/components/CopyLinkButton.vue_vue_type_script_setup_true_lang.js +1 -2
  128. package/dist/schema/components/WithBreadcrumb.vue.js +1 -2
  129. package/dist/schema/components/WithBreadcrumb.vue.js.map +1 -1
  130. package/dist/schema/components/WithBreadcrumb.vue_vue_type_script_setup_true_lang.js +1 -2
  131. package/dist/schema/discriminator-metadata.js +1 -2
  132. package/dist/schema/helpers/dynamic-scope.js +1 -2
  133. package/dist/schema/helpers/format-example.js +1 -2
  134. package/dist/schema/helpers/format-value.js +1 -2
  135. package/dist/schema/helpers/get-compositions-to-render.js +19 -20
  136. package/dist/schema/helpers/get-discriminator-values.js +1 -2
  137. package/dist/schema/helpers/get-enum-values.js +1 -2
  138. package/dist/schema/helpers/get-property-description.js +1 -2
  139. package/dist/schema/helpers/get-ref-name.js +1 -2
  140. package/dist/schema/helpers/get-rendered-example.js +1 -2
  141. package/dist/schema/helpers/get-schema-type.js +1 -2
  142. package/dist/schema/helpers/get-type-signature-tokens.d.ts +2 -2
  143. package/dist/schema/helpers/get-type-signature-tokens.d.ts.map +1 -1
  144. package/dist/schema/helpers/get-type-signature-tokens.js +3 -4
  145. package/dist/schema/helpers/get-type-signature-tokens.js.map +1 -1
  146. package/dist/schema/helpers/has-complex-array-items.js +1 -2
  147. package/dist/schema/helpers/index.js +13 -13
  148. package/dist/schema/helpers/is-empty-schema-object.js +1 -2
  149. package/dist/schema/helpers/is-model-linkable.js +1 -2
  150. package/dist/schema/helpers/is-on-schema-target-path.js +1 -2
  151. package/dist/schema/helpers/is-type-object.js +1 -2
  152. package/dist/schema/helpers/merge-all-of-schemas.js +1 -2
  153. package/dist/schema/helpers/normalize-object-composition.js +1 -2
  154. package/dist/schema/helpers/optimize-value-for-display.js +1 -2
  155. package/dist/schema/helpers/partition-all-of-compositions.js +1 -2
  156. package/dist/schema/helpers/schema-composition.js +1 -2
  157. package/dist/schema/helpers/schema-cycle.js +1 -2
  158. package/dist/schema/helpers/schema-expansion.js +1 -2
  159. package/dist/schema/helpers/schema-keyboard-nav.js +1 -2
  160. package/dist/schema/helpers/schema-name.js +2 -3
  161. package/dist/schema/helpers/schema-name.js.map +1 -1
  162. package/dist/schema/helpers/should-display-description.js +1 -2
  163. package/dist/schema/helpers/should-display-heading.js +1 -2
  164. package/dist/schema/helpers/should-render-array-item-composition.js +1 -2
  165. package/dist/schema/helpers/sort-property-names.js +1 -2
  166. package/dist/schema/helpers/unwrap-for-read.js +1 -2
  167. package/dist/schema/index.js +8 -8
  168. package/dist/schema/localization/index.js +1 -2
  169. package/dist/schema/localization/locales/ar.js +1 -2
  170. package/dist/schema/localization/locales/de.js +1 -2
  171. package/dist/schema/localization/locales/en.js +1 -2
  172. package/dist/schema/localization/locales/es.js +1 -2
  173. package/dist/schema/localization/locales/fr.js +1 -2
  174. package/dist/schema/localization/locales/pt.js +1 -2
  175. package/dist/schema/localization/locales/ru.js +1 -2
  176. package/dist/schema/localization/locales/zh-cn.js +1 -2
  177. package/dist/schema/localization/locales/zh-tw.js +1 -2
  178. package/dist/schema/localization/translations.js +1 -2
  179. package/dist/schema/protobuf-metadata.js +1 -2
  180. package/dist/schema/recursive-metadata.js +1 -2
  181. package/dist/schema/request-body-composition-index.js +1 -2
  182. package/dist/shared/Badge.vue.d.ts.map +1 -1
  183. package/dist/shared/Badge.vue.js +4 -5
  184. package/dist/shared/Badge.vue.js.map +1 -1
  185. package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js +2 -3
  186. package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js.map +1 -1
  187. package/dist/shared/ExternalDocs.vue.js +1 -2
  188. package/dist/shared/ExternalDocs.vue.js.map +1 -1
  189. package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js +1 -2
  190. package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js.map +1 -1
  191. package/dist/shared/ScreenReader.vue.js +1 -2
  192. package/dist/shared/ScreenReader.vue.js.map +1 -1
  193. package/dist/shared/ScreenReader.vue_vue_type_script_setup_true_lang.js +1 -2
  194. package/dist/shared/index.js +4 -4
  195. package/dist/specification-extensions/ExtensionValue.vue.js +1 -2
  196. package/dist/specification-extensions/ExtensionValue.vue.js.map +1 -1
  197. package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js +5 -6
  198. package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js.map +1 -1
  199. package/dist/specification-extensions/SpecificationExtensions.vue.js +1 -2
  200. package/dist/specification-extensions/SpecificationExtensions.vue.js.map +1 -1
  201. package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js +1 -2
  202. package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js.map +1 -1
  203. package/dist/style.css +48 -24
  204. package/dist/vue-styles.css +1 -1
  205. package/package.json +24 -24
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaEnums.vue.js","names":["_sfc_main","_plugin_vue_export_helper_default","SchemaEnums_vue_vue_type_script_setup_true_lang_default","SchemaEnums_default"],"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":""}
1
+ {"version":3,"file":"SchemaEnums.vue.js","names":["SchemaEnums_vue_vue_type_script_setup_true_lang_default","_plugin_vue_export_helper_default","SchemaEnums_default"],"sources":[],"mappings":""}
@@ -1,10 +1,10 @@
1
1
  import { useLocalization as e } from "./localization/index.js";
2
- import t from "./SchemaGlyphPuck.vue.js";
3
- import n from "./SchemaEnumPropertyItem.vue.js";
2
+ import t from "./SchemaEnumPropertyItem.vue.js";
3
+ import n from "./SchemaGlyphPuck.vue.js";
4
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
5
  import { resolve as _ } from "@scalar/workspace-store/resolve";
6
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
7
+ // src/schema/SchemaEnums.vue?vue&type=script&setup=true&lang.ts
8
8
  var y = {
9
9
  key: 0,
10
10
  class: "property-enum property-enum--tree mt-2 rounded-(--scalar-radius-lg) border"
@@ -51,28 +51,27 @@ var y = {
51
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
52
  role: "listitem"
53
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)
54
+ (f(!0), s(r, null, m(I.value, (e, n) => (f(), a(t, {
55
+ key: n,
56
+ description: R(e, n),
57
+ label: z(e, n)
58
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)
59
+ M.value && B.value ? (f(!0), s(r, { key: 0 }, m(L.value, (e, n) => (f(), a(t, {
60
+ key: N.value + n,
61
+ description: R(e, N.value + n),
62
+ label: z(e, N.value + n)
63
63
  }, null, 8, ["description", "label"]))), 128)) : o("", !0),
64
64
  M.value ? (f(), s("li", w, [c("button", {
65
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
66
  type: "button",
67
67
  onClick: V
68
- }, [u(t, {
68
+ }, [u(n, {
69
69
  floating: !1,
70
70
  open: B.value
71
71
  }, null, 8, ["open"]), l(" " + h(B.value ? g(k)("schema.hideValues") : g(k)("schema.showAllValues")), 1)])])) : o("", !0)
72
72
  ]))]));
73
73
  }
74
74
  });
75
- //#endregion
76
75
  export { k as default };
77
76
 
78
77
  //# sourceMappingURL=SchemaEnums.vue_vue_type_script_setup_true_lang.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaEnums.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_createElementVNode","_toDisplayString","_unref","_Fragment","_renderList","_createBlock","SchemaEnumPropertyItem","_createCommentVNode","_createVNode","SchemaGlyphPuck","_createTextVNode","SchemaGlyphPuck_default","SchemaEnumPropertyItem_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","ENUM_DISPLAY_THRESHOLD","INITIAL_VISIBLE_COUNT","CHIP_MAX_LENGTH","THIN_SPACE","SchemaEnums_vue_vue_type_script_setup_true_lang_default","useLocalization","enumSchema","computed","__props","isArraySchema","resolve","enumValues","shouldUseLongListDisplay","initialVisibleCount","shouldRenderAsChips","formatEnumValueWithName","entry","index","hasAnyDescription","getEnumValueDescription","visibleEnumValues","hiddenEnumValues","schema","descriptions","enumValue","varNames","varName","isExpanded","ref","toggleExpanded","createCommentVNode","openBlock","createElementBlock","createElementVNode","toDisplayString","unref","translate","Fragment","renderList","createBlock","createVNode","createTextVNode"],"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":";;;;;;;;;;;;;;;;;;;;;;;;A,GAsBMqB,IAAyB,IACzBC,IAAwB,GAExBC,IAAkB,IAClBC,IAAa,K;;;;;;;;;;EAVnB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AoBF,EAAwBS,GAAWX,EAAA,QAAsBI,CAAK;;GAM/EL,EAAA,SADRjC,EAAA,GAAAC,EAkBK,MAlBLmB,GAkBK,CAbHlB,EAYS,UAAA;IAXP,OAAM;IACN,MAAK;IACJ,SAAOgD;G,IACRxC,EAEuBC,GAAA;IADpB,UAAU;IACV,MAAMqC,EAAA;G,uBAAcpC,EAAA,MACvBT,EACE6C,EAAA,QAA2B5C,EAAAqD,CAAA,CAAS,CAAA,mBAAA,IAAsCrD,EAAAqD,CAAA,CAAS,CAAA,sBAAA,CAAA,GAAA,CAAA,C"}
1
+ {"version":3,"file":"SchemaEnums.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_createElementVNode","_toDisplayString","_unref","_Fragment","_renderList","_createBlock","SchemaEnumPropertyItem","_createVNode","SchemaGlyphPuck","_createTextVNode","SchemaEnumPropertyItem_default","SchemaGlyphPuck_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","ENUM_DISPLAY_THRESHOLD","INITIAL_VISIBLE_COUNT","CHIP_MAX_LENGTH","THIN_SPACE","SchemaEnums_vue_vue_type_script_setup_true_lang_default","useLocalization","enumSchema","computed","__props","isArraySchema","resolve","enumValues","shouldUseLongListDisplay","initialVisibleCount","shouldRenderAsChips","formatEnumValueWithName","entry","index","hasAnyDescription","getEnumValueDescription","visibleEnumValues","hiddenEnumValues","schema","descriptions","enumValue","varNames","varName","isExpanded","ref","toggleExpanded","createCommentVNode","openBlock","createElementBlock","createElementVNode","toDisplayString","unref","translate","Fragment","renderList","createBlock","createVNode","createTextVNode"],"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":";;;;;;;;;;;;;;;;;;;;;;;;A,GAsBMoB,IAAyB,IACzBC,IAAwB,GAExBC,IAAkB,IAClBC,IAAa,K;;;;;;;;;;EAVnB,IAAM,EAAE,iBAAcE,EAAgB,GAiBhCC,IAAaC,QAAe;GAChC,IAAKC,EAAA,OAML,OAHIA,EAAA,MAAM,OACDA,EAAA,QAEFC,EAAcD,EAAA,KAAK,IAAIE,EAAQ,OAAOF,EAAA,MAAM,KAAK,IAAI,KAAA;EAC9D,CAAC,GAMKG,IAAaJ,QAAeD,EAAW,OAAO,QAAQ,CAAC,CAAC,GAMxDM,IAA2BL,QACzBI,EAAW,MAAM,SAASX,CAClC,GAEMa,IAAsBN,QAC1BK,EAAyB,QACrBX,IACAU,EAAW,MAAM,MACvB,GAYMG,IAAsBP,QAExB,CAACC,EAAA,iBACDG,EAAW,MAAM,SAAS,KAC1B,CAACC,EAAyB,SAC1BD,EAAW,MAAM,OAGd,GAAO,MACNI,EAAwBC,GAAOC,CAAK,CAAC,CAAC,UAAUf,CACpD,KACA,CAACgB,EAAkB,KACvB,GAGMA,IAAoBX,QACxBI,EAAW,MAAM,MACd,GAAO,MAAUQ,EAAwBH,GAAOC,CAAK,MAAM,KAAA,CAC9D,CACF,GAEMG,IAAoBb,QACxBI,EAAW,MAAM,MAAM,GAAGE,EAAoB,KAAK,CACrD,GAEMQ,IAAmBd,QACvBI,EAAW,MAAM,MAAME,EAAoB,KAAK,CAClD,GAMMM,KACJ,GACA,MACuB;GACvB,IAAMG,IAAShB,EAAW,OACpBiB,IACJD,IAAS,yBAAyBA,IAAS;GAE7C,IAAKC,GAIL;QAAI,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AAA;IAFpD,KAAK6B;IACL,aAAaE,EAAwBK,GAAWP,CAAK;IACrD,OAAOF,EAAwBS,GAAWP,CAAK;;GAElCL,EAAA,SAA4Be,EAAA,SAC1C/C,EAAA,EAAA,GAAAC,EAQMI,GAAA,EAAA,KAAA,EAAA,GAAAC,EAPyBmC,EAAA,QAArB,GAAW,OADrBzC,EAAA,GAAAO,EAQMC,GAAA;IANH,KAAKyB,EAAA,QAAsBI;IAC3B,aAA0BE,EAAwBK,GAAWX,EAAA,QAAsBI,CAAK;IAGxF,OAAoBF,EAAwBS,GAAWX,EAAA,QAAsBI,CAAK;;GAM/EL,EAAA,SADRhC,EAAA,GAAAC,EAkBK,MAlBLkB,GAkBK,CAbHjB,EAYS,UAAA;IAXP,OAAM;IACN,MAAK;IACJ,SAAO+C;G,IACRxC,EAEuBC,GAAA;IADpB,UAAU;IACV,MAAMqC,EAAA;G,uBAAcpC,EAAA,MACvBR,EACE4C,EAAA,QAA2B3C,EAAAoD,CAAA,CAAS,CAAA,mBAAA,IAAsCpD,EAAAoD,CAAA,CAAS,CAAA,sBAAA,CAAA,GAAA,CAAA,C"}
@@ -1,7 +1,6 @@
1
1
  import e from "./SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js";
2
- //#region src/schema/SchemaGlyphPuck.vue
2
+ // src/schema/SchemaGlyphPuck.vue
3
3
  var t = e;
4
- //#endregion
5
4
  export { t as default };
6
5
 
7
6
  //# sourceMappingURL=SchemaGlyphPuck.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaGlyphPuck.vue.js","names":["_sfc_main","SchemaGlyphPuck_vue_vue_type_script_setup_true_lang_default","SchemaGlyphPuck_default"],"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":""}
1
+ {"version":3,"file":"SchemaGlyphPuck.vue.js","names":["SchemaGlyphPuck_vue_vue_type_script_setup_true_lang_default","SchemaGlyphPuck_default"],"sources":[],"mappings":""}
@@ -1,6 +1,6 @@
1
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
2
  import { ScalarIconMinus as s, ScalarIconPlus as c } from "@scalar/icons";
3
- //#region src/schema/SchemaGlyphPuck.vue?vue&type=script&setup=true&lang.ts
3
+ // src/schema/SchemaGlyphPuck.vue?vue&type=script&setup=true&lang.ts
4
4
  var l = /*@__PURE__*/ n({
5
5
  __name: "SchemaGlyphPuck",
6
6
  props: {
@@ -24,7 +24,6 @@ var l = /*@__PURE__*/ n({
24
24
  }))])], 2));
25
25
  }
26
26
  });
27
- //#endregion
28
27
  export { l as default };
29
28
 
30
29
  //# sourceMappingURL=SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js.map
@@ -1,7 +1,6 @@
1
1
  import e from "./SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js";
2
- //#region src/schema/SchemaGutterToggle.vue
2
+ // src/schema/SchemaGutterToggle.vue
3
3
  var t = e;
4
- //#endregion
5
4
  export { t as default };
6
5
 
7
6
  //# sourceMappingURL=SchemaGutterToggle.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaGutterToggle.vue.js","names":["_sfc_main","SchemaGutterToggle_vue_vue_type_script_setup_true_lang_default","SchemaGutterToggle_default"],"sources":["../../src/schema/SchemaGutterToggle.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport SchemaGlyphPuck from './SchemaGlyphPuck.vue'\n\n/**\n * A property row's disclosure control: a content-free button in the property's\n * gutter. Its accessible name is the property name via `aria-labelledby`, and the\n * child count rides `aria-describedby` so screen-reader verbosity settings apply.\n * The 24px hit box (WCAG 2.5.8) and the 18px glyph puck inside it are sized\n * independently.\n */\nconst { open, panelId, panelRendered, nameId, fallbackLabel, countId } =\n defineProps<{\n /** Whether the controlled panel is expanded */\n open: boolean\n /** id of the panel this toggle controls */\n panelId: string\n /** Only reference the panel while it is actually in the DOM */\n panelRendered: boolean\n /** id of the visible property name that labels this control, absent on nameless rows */\n nameId?: string\n /**\n * Accessible name when there is no visible name to reference: pointing\n * `aria-labelledby` at an id that never renders leaves the button unnamed.\n */\n fallbackLabel: string\n /** id of the visually hidden child count that describes this control */\n countId?: string\n }>()\n\nconst emit = defineEmits<{\n (e: 'toggle'): void\n}>()\n</script>\n<template>\n <button\n :aria-controls=\"panelRendered ? panelId : undefined\"\n :aria-describedby=\"countId\"\n :aria-expanded=\"open\"\n :aria-label=\"nameId ? undefined : fallbackLabel\"\n :aria-labelledby=\"nameId\"\n class=\"property-toggle group/tree-control flex size-[var(--schema-toggle-size,24px)] shrink-0 cursor-pointer items-center justify-center rounded-[999px] border-none bg-transparent p-0 text-[color:var(--schema-glyph-color,var(--scalar-color-2))]\"\n data-schema-toggle\n type=\"button\"\n @click=\"emit('toggle')\">\n <!-- Inline, not floating: the button is already the box the puck centres in -->\n <SchemaGlyphPuck\n class=\"property-glyph\"\n :floating=\"false\"\n :open=\"open\" />\n </button>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"SchemaGutterToggle.vue.js","names":["SchemaGutterToggle_vue_vue_type_script_setup_true_lang_default","SchemaGutterToggle_default"],"sources":[],"mappings":""}
@@ -1,6 +1,6 @@
1
1
  import e from "./SchemaGlyphPuck.vue.js";
2
2
  import { createElementBlock as t, createVNode as n, defineComponent as r, openBlock as i } from "vue";
3
- //#region src/schema/SchemaGutterToggle.vue?vue&type=script&setup=true&lang.ts
3
+ // src/schema/SchemaGutterToggle.vue?vue&type=script&setup=true&lang.ts
4
4
  var a = [
5
5
  "aria-controls",
6
6
  "aria-describedby",
@@ -37,7 +37,6 @@ var a = [
37
37
  }, null, 8, ["open"])], 8, a));
38
38
  }
39
39
  });
40
- //#endregion
41
40
  export { o as default };
42
41
 
43
42
  //# sourceMappingURL=SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js.map
@@ -1,9 +1,8 @@
1
- import e from "../_virtual/_plugin-vue_export-helper.js";
2
- import t from "./SchemaHeading.vue_vue_type_script_setup_true_lang.js";
1
+ import e from "./SchemaHeading.vue_vue_type_script_setup_true_lang.js";
3
2
  /* empty css */
4
- //#region src/schema/SchemaHeading.vue
5
- var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-39d4fd7f"]]);
6
- //#endregion
3
+ import t from "../_virtual/_plugin-vue_export-helper.js";
4
+ // src/schema/SchemaHeading.vue
5
+ var n = /*#__PURE__*/ t(e, [["__scopeId", "data-v-39d4fd7f"]]);
7
6
  export { n as default };
8
7
 
9
8
  //# sourceMappingURL=SchemaHeading.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaHeading.vue.js","names":["_sfc_main","_plugin_vue_export_helper_default","SchemaHeading_vue_vue_type_script_setup_true_lang_default","SchemaHeading_default"],"sources":["../../src/schema/SchemaHeading.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarWrappingText } from '@scalar/components/wrapping-text'\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 } from 'vue'\n\nimport { isTypeObject } from './helpers/is-type-object'\nimport { useLocalization } from './localization'\n\nconst { value } = defineProps<{\n value: SchemaObject\n name?: string\n}>()\nconst { translate } = useLocalization()\n\n/** Generate a failsafe type from the properties when we don't have one */\nconst failsafeType = computed(() => {\n if ('type' in value) {\n return value.type\n }\n\n if (value.enum) {\n return 'enum'\n }\n\n if (isArraySchema(value) && value.items) {\n return 'array'\n }\n\n if (isTypeObject(value) && (value.properties || value.additionalProperties)) {\n return 'object'\n }\n\n return 'unknown'\n})\n</script>\n\n<template>\n <span\n v-if=\"typeof value === 'object'\"\n class=\"schema-type\">\n <span\n class=\"schema-type-icon\"\n :title=\"\n 'type' in value && typeof value.type === 'string'\n ? value.type\n : 'type' in value && Array.isArray(value.type)\n ? value.type.join(' | ')\n : translate('schema.unknownType')\n \">\n <template v-if=\"isTypeObject(value)\"> {} </template>\n <template v-if=\"isArraySchema(value)\"> [] </template>\n <template v-if=\"value.enum\"> enum </template>\n </span>\n <template v-if=\"name\">\n <ScalarWrappingText\n preset=\"property\"\n :text=\"name\" />\n </template>\n <template v-else>\n {{ failsafeType }}\n </template>\n </span>\n</template>\n<style scoped>\n/* Style the \"icon\" */\n.schema-type-icon {\n color: var(--scalar-color-1);\n display: none;\n}\n.schema-type {\n font-family: var(--scalar-font-code);\n color: var(--scalar-color-1);\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"SchemaHeading.vue.js","names":["SchemaHeading_vue_vue_type_script_setup_true_lang_default","_plugin_vue_export_helper_default","SchemaHeading_default"],"sources":[],"mappings":""}
@@ -3,7 +3,7 @@ import { useLocalization as t } from "./localization/index.js";
3
3
  import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, defineComponent as l, openBlock as u, toDisplayString as d, unref as f } from "vue";
4
4
  import { ScalarWrappingText as p } from "@scalar/components/wrapping-text";
5
5
  import { isArraySchema as m } from "@scalar/workspace-store/schemas/v3.2/strict/type-guards";
6
- //#region src/schema/SchemaHeading.vue?vue&type=script&setup=true&lang.ts
6
+ // src/schema/SchemaHeading.vue?vue&type=script&setup=true&lang.ts
7
7
  var h = {
8
8
  key: 0,
9
9
  class: "schema-type"
@@ -29,7 +29,6 @@ var h = {
29
29
  }, null, 8, ["text"])) : (u(), o(n, { key: 1 }, [c(d(v.value), 1)], 64))])) : a("", !0);
30
30
  }
31
31
  });
32
- //#endregion
33
32
  export { _ as default };
34
33
 
35
34
  //# sourceMappingURL=SchemaHeading.vue_vue_type_script_setup_true_lang.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaHeading.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_createElementVNode","_unref","_Fragment","_createTextVNode","_createCommentVNode","_createBlock","_toDisplayString","_hoisted_1","_hoisted_2","SchemaHeading_vue_vue_type_script_setup_true_lang_default","useLocalization","failsafeType","computed","__props","isArraySchema","isTypeObject","openBlock","createElementBlock","createElementVNode","unref","translate","Fragment","createTextVNode","createCommentVNode","createBlock","ScalarWrappingText","toDisplayString"],"sources":["../../src/schema/SchemaHeading.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarWrappingText } from '@scalar/components/wrapping-text'\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 } from 'vue'\n\nimport { isTypeObject } from './helpers/is-type-object'\nimport { useLocalization } from './localization'\n\nconst { value } = defineProps<{\n value: SchemaObject\n name?: string\n}>()\nconst { translate } = useLocalization()\n\n/** Generate a failsafe type from the properties when we don't have one */\nconst failsafeType = computed(() => {\n if ('type' in value) {\n return value.type\n }\n\n if (value.enum) {\n return 'enum'\n }\n\n if (isArraySchema(value) && value.items) {\n return 'array'\n }\n\n if (isTypeObject(value) && (value.properties || value.additionalProperties)) {\n return 'object'\n }\n\n return 'unknown'\n})\n</script>\n\n<template>\n <span\n v-if=\"typeof value === 'object'\"\n class=\"schema-type\">\n <span\n class=\"schema-type-icon\"\n :title=\"\n 'type' in value && typeof value.type === 'string'\n ? value.type\n : 'type' in value && Array.isArray(value.type)\n ? value.type.join(' | ')\n : translate('schema.unknownType')\n \">\n <template v-if=\"isTypeObject(value)\"> {} </template>\n <template v-if=\"isArraySchema(value)\"> [] </template>\n <template v-if=\"value.enum\"> enum </template>\n </span>\n <template v-if=\"name\">\n <ScalarWrappingText\n preset=\"property\"\n :text=\"name\" />\n </template>\n <template v-else>\n {{ failsafeType }}\n </template>\n </span>\n</template>\n<style scoped>\n/* Style the \"icon\" */\n.schema-type-icon {\n color: var(--scalar-color-1);\n display: none;\n}\n.schema-type {\n font-family: var(--scalar-font-code);\n color: var(--scalar-color-1);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;EAaA,IAAM,EAAE,iBAAcY,EAAgB,GAGhCC,IAAeC,QACf,UAAUC,EAAA,QACLA,EAAA,MAAM,OAGXA,EAAA,MAAM,OACD,SAGLC,EAAcD,EAAA,KAAK,KAAKA,EAAA,MAAM,QACzB,UAGLE,EAAaF,EAAA,KAAK,MAAMA,EAAA,MAAM,cAAcA,EAAA,MAAM,wBAC7C,WAGF,SACR;E,iBAKgB,OAAAA,EAAA,SAAK,YADpBf,EAAA,GAAAC,EAwBO,QAxBPQ,GAwBO,CArBLP,EAYO,QAAA;GAXL,OAAM;GACL,OAA0B,UAAAa,EAAA,SAAK,OAAWA,EAAA,MAAM,QAAI,WAA0BA,EAAA,MAAM,OAA2B,UAAAA,EAAA,SAAS,MAAM,QAAQA,EAAA,MAAM,IAAI,IAAgBA,EAAA,MAAM,KAAK,KAAI,KAAA,IAAsBZ,EAAAmB,CAAA,CAAS,CAAA,oBAAA;;GAO/LnB,EAAAc,CAAA,CAAY,CAACF,EAAA,KAAK,KAAlCf,EAAA,GAAAC,EAAoDG,GAAA,EAAA,KAAA,EAAA,GAAA,CAAfC,EAAA,MAAI,C;GACzBF,EAAAa,CAAA,CAAa,CAACD,EAAA,KAAK,KAAnCf,EAAA,GAAAC,EAAqDG,GAAA,EAAA,KAAA,EAAA,GAAA,CAAfC,EAAA,MAAI,C;GAC1BU,EAAA,MAAM,QAAtBf,EAAA,GAAAC,EAA6CG,GAAA,EAAA,KAAA,EAAA,GAAA,CAAjBC,EAAA,QAAM,C;E,UAEpBU,EAAA,QACdf,EAAA,GAAAO,EAEiBJ,EAAAwB,CAAA,GAAA;;GADf,QAAO;GACN,MAAMZ,EAAA;E,0BAEXf,EAAA,GAAAC,EAEWG,GAAA,EAAA,KAAA,EAAA,GAAA,CADNC,EAAAG,EAAAK,EAAA,KAAY,GAAA,CAAA,C"}
1
+ {"version":3,"file":"SchemaHeading.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_createElementVNode","_unref","_Fragment","_createTextVNode","_createBlock","_toDisplayString","_hoisted_1","_hoisted_2","SchemaHeading_vue_vue_type_script_setup_true_lang_default","useLocalization","failsafeType","computed","__props","isArraySchema","isTypeObject","openBlock","createElementBlock","createElementVNode","unref","translate","Fragment","createTextVNode","createCommentVNode","createBlock","ScalarWrappingText","toDisplayString"],"sources":["../../src/schema/SchemaHeading.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarWrappingText } from '@scalar/components/wrapping-text'\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 } from 'vue'\n\nimport { isTypeObject } from './helpers/is-type-object'\nimport { useLocalization } from './localization'\n\nconst { value } = defineProps<{\n value: SchemaObject\n name?: string\n}>()\nconst { translate } = useLocalization()\n\n/** Generate a failsafe type from the properties when we don't have one */\nconst failsafeType = computed(() => {\n if ('type' in value) {\n return value.type\n }\n\n if (value.enum) {\n return 'enum'\n }\n\n if (isArraySchema(value) && value.items) {\n return 'array'\n }\n\n if (isTypeObject(value) && (value.properties || value.additionalProperties)) {\n return 'object'\n }\n\n return 'unknown'\n})\n</script>\n\n<template>\n <span\n v-if=\"typeof value === 'object'\"\n class=\"schema-type\">\n <span\n class=\"schema-type-icon\"\n :title=\"\n 'type' in value && typeof value.type === 'string'\n ? value.type\n : 'type' in value && Array.isArray(value.type)\n ? value.type.join(' | ')\n : translate('schema.unknownType')\n \">\n <template v-if=\"isTypeObject(value)\"> {} </template>\n <template v-if=\"isArraySchema(value)\"> [] </template>\n <template v-if=\"value.enum\"> enum </template>\n </span>\n <template v-if=\"name\">\n <ScalarWrappingText\n preset=\"property\"\n :text=\"name\" />\n </template>\n <template v-else>\n {{ failsafeType }}\n </template>\n </span>\n</template>\n<style scoped>\n/* Style the \"icon\" */\n.schema-type-icon {\n color: var(--scalar-color-1);\n display: none;\n}\n.schema-type {\n font-family: var(--scalar-font-code);\n color: var(--scalar-color-1);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;EAaA,IAAM,EAAE,iBAAcW,EAAgB,GAGhCC,IAAeC,QACf,UAAUC,EAAA,QACLA,EAAA,MAAM,OAGXA,EAAA,MAAM,OACD,SAGLC,EAAcD,EAAA,KAAK,KAAKA,EAAA,MAAM,QACzB,UAGLE,EAAaF,EAAA,KAAK,MAAMA,EAAA,MAAM,cAAcA,EAAA,MAAM,wBAC7C,WAGF,SACR;E,iBAKgB,OAAAA,EAAA,SAAK,YADpBd,EAAA,GAAAC,EAwBO,QAxBPO,GAwBO,CArBLN,EAYO,QAAA;GAXL,OAAM;GACL,OAA0B,UAAAY,EAAA,SAAK,OAAWA,EAAA,MAAM,QAAI,WAA0BA,EAAA,MAAM,OAA2B,UAAAA,EAAA,SAAS,MAAM,QAAQA,EAAA,MAAM,IAAI,IAAgBA,EAAA,MAAM,KAAK,KAAI,KAAA,IAAsBX,EAAAkB,CAAA,CAAS,CAAA,oBAAA;;GAO/LlB,EAAAa,CAAA,CAAY,CAACF,EAAA,KAAK,KAAlCd,EAAA,GAAAC,EAAoDG,GAAA,EAAA,KAAA,EAAA,GAAA,CAAfC,EAAA,MAAI,C;GACzBF,EAAAY,CAAA,CAAa,CAACD,EAAA,KAAK,KAAnCd,EAAA,GAAAC,EAAqDG,GAAA,EAAA,KAAA,EAAA,GAAA,CAAfC,EAAA,MAAI,C;GAC1BS,EAAA,MAAM,QAAtBd,EAAA,GAAAC,EAA6CG,GAAA,EAAA,KAAA,EAAA,GAAA,CAAjBC,EAAA,QAAM,C;E,UAEpBS,EAAA,QACdd,EAAA,GAAAM,EAEiBH,EAAAuB,CAAA,GAAA;;GADf,QAAO;GACN,MAAMZ,EAAA;E,0BAEXd,EAAA,GAAAC,EAEWG,GAAA,EAAA,KAAA,EAAA,GAAA,CADNC,EAAAE,EAAAK,EAAA,KAAY,GAAA,CAAA,C"}
@@ -1,7 +1,6 @@
1
1
  import e from "./SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js";
2
- //#region src/schema/SchemaObjectExampleCodeBlock.vue
2
+ // src/schema/SchemaObjectExampleCodeBlock.vue
3
3
  var t = e;
4
- //#endregion
5
4
  export { t as default };
6
5
 
7
6
  //# sourceMappingURL=SchemaObjectExampleCodeBlock.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaObjectExampleCodeBlock.vue.js","names":["_sfc_main","SchemaObjectExampleCodeBlock_vue_vue_type_script_setup_true_lang_default","SchemaObjectExampleCodeBlock_default"],"sources":["../../src/schema/SchemaObjectExampleCodeBlock.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n ScalarCard,\n ScalarCardFooter,\n ScalarCardSection,\n} from '@scalar/components/card'\nimport { ScalarCodeBlock } from '@scalar/components/code-block'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport { ExamplePicker } from '../code-example'\n\nconst { schema } = defineProps<{ schema: SchemaObject }>()\n\n/** Grab the examples for the schema object */\nconst examples = computed<Record<string, string>>(() => {\n const base: Record<string, string> = {}\n\n // x-examples extension\n if (schema['x-examples']) {\n Object.entries(schema['x-examples']).forEach(([key, value]) => {\n base[key] =\n typeof value === 'object'\n ? JSON.stringify(value, null, 2)\n : String(value)\n })\n }\n\n // Regular schema examples array\n if (schema.examples) {\n schema.examples.forEach((value, index) => {\n base[`Example ${index + 1}`] =\n typeof value === 'object'\n ? JSON.stringify(value, null, 2)\n : String(value)\n })\n }\n\n return base\n})\n\n/** The currently selected example key */\nconst selectedExampleKey = ref<string>(Object.keys(examples.value)[0] ?? '')\n</script>\n<template>\n <ScalarCard\n v-if=\"Object.keys(examples).length > 0\"\n class=\"dark-mode\">\n <!-- Code snippet -->\n <ScalarCardSection>\n <div class=\"code-snippet\">\n <ScalarCodeBlock\n class=\"bg-transparent\"\n lang=\"json\"\n lineNumbers\n :prettyPrintedContent=\"\n examples[selectedExampleKey] ??\n 'There was an error loading the example'\n \" />\n </div>\n </ScalarCardSection>\n\n <!-- Example picker -->\n <ScalarCardFooter v-if=\"Object.keys(examples).length > 1\">\n <ExamplePicker\n v-model=\"selectedExampleKey\"\n :examples />\n </ScalarCardFooter>\n </ScalarCard>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"SchemaObjectExampleCodeBlock.vue.js","names":["SchemaObjectExampleCodeBlock_vue_vue_type_script_setup_true_lang_default","SchemaObjectExampleCodeBlock_default"],"sources":[],"mappings":""}
@@ -2,7 +2,7 @@ import e from "../code-example/components/ExamplePicker.vue.js";
2
2
  import { computed as t, createBlock as n, createCommentVNode as r, createElementVNode as i, createVNode as a, defineComponent as o, openBlock as s, ref as c, unref as l, withCtx as u } from "vue";
3
3
  import { ScalarCard as d, ScalarCardFooter as f, ScalarCardSection as p } from "@scalar/components/card";
4
4
  import { ScalarCodeBlock as m } from "@scalar/components/code-block";
5
- //#region src/schema/SchemaObjectExampleCodeBlock.vue?vue&type=script&setup=true&lang.ts
5
+ // src/schema/SchemaObjectExampleCodeBlock.vue?vue&type=script&setup=true&lang.ts
6
6
  var h = { class: "code-snippet" }, g = /*@__PURE__*/ o({
7
7
  __name: "SchemaObjectExampleCodeBlock",
8
8
  props: { schema: {} },
@@ -39,7 +39,6 @@ var h = { class: "code-snippet" }, g = /*@__PURE__*/ o({
39
39
  })) : r("", !0);
40
40
  }
41
41
  });
42
- //#endregion
43
42
  export { g as default };
44
43
 
45
44
  //# sourceMappingURL=SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_withCtx","_createVNode","_createElementVNode","ExamplePicker","_createCommentVNode","ExamplePicker_default","_hoisted_1","SchemaObjectExampleCodeBlock_vue_vue_type_script_setup_true_lang_default","examples","computed","base","__props","key","value","index","selectedExampleKey","ref","openBlock","createBlock","unref","ScalarCard","withCtx","createVNode","ScalarCardSection","createElementVNode","ScalarCodeBlock","ScalarCardFooter","_cache","$event","createCommentVNode"],"sources":["../../src/schema/SchemaObjectExampleCodeBlock.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n ScalarCard,\n ScalarCardFooter,\n ScalarCardSection,\n} from '@scalar/components/card'\nimport { ScalarCodeBlock } from '@scalar/components/code-block'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport { ExamplePicker } from '../code-example'\n\nconst { schema } = defineProps<{ schema: SchemaObject }>()\n\n/** Grab the examples for the schema object */\nconst examples = computed<Record<string, string>>(() => {\n const base: Record<string, string> = {}\n\n // x-examples extension\n if (schema['x-examples']) {\n Object.entries(schema['x-examples']).forEach(([key, value]) => {\n base[key] =\n typeof value === 'object'\n ? JSON.stringify(value, null, 2)\n : String(value)\n })\n }\n\n // Regular schema examples array\n if (schema.examples) {\n schema.examples.forEach((value, index) => {\n base[`Example ${index + 1}`] =\n typeof value === 'object'\n ? JSON.stringify(value, null, 2)\n : String(value)\n })\n }\n\n return base\n})\n\n/** The currently selected example key */\nconst selectedExampleKey = ref<string>(Object.keys(examples.value)[0] ?? '')\n</script>\n<template>\n <ScalarCard\n v-if=\"Object.keys(examples).length > 0\"\n class=\"dark-mode\">\n <!-- Code snippet -->\n <ScalarCardSection>\n <div class=\"code-snippet\">\n <ScalarCodeBlock\n class=\"bg-transparent\"\n lang=\"json\"\n lineNumbers\n :prettyPrintedContent=\"\n examples[selectedExampleKey] ??\n 'There was an error loading the example'\n \" />\n </div>\n </ScalarCardSection>\n\n <!-- Example picker -->\n <ScalarCardFooter v-if=\"Object.keys(examples).length > 1\">\n <ExamplePicker\n v-model=\"selectedExampleKey\"\n :examples />\n </ScalarCardFooter>\n </ScalarCard>\n</template>\n"],"mappings":";;;;;;;;;EAeA,IAAMW,IAAWC,QAAuC;GACtD,IAAMC,IAA+B,CAAC;GAsBtC,OAnBIC,EAAA,OAAO,iBACT,OAAO,QAAQA,EAAA,OAAO,aAAa,CAAC,CAAC,SAAS,CAACC,GAAKC,OAAW;IAC7D,EAAKD,KACH,OAAOC,KAAU,WACb,KAAK,UAAUA,GAAO,MAAM,CAAC,IAC7B,OAAOA,CAAK;GACpB,CAAC,GAICF,EAAA,OAAO,YACTA,EAAA,OAAO,SAAS,SAAS,GAAO,MAAU;IACxC,EAAK,WAAWG,IAAQ,OACtB,OAAOD,KAAU,WACb,KAAK,UAAUA,GAAO,MAAM,CAAC,IAC7B,OAAOA,CAAK;GACpB,CAAC,GAGIH;EACT,CAAC,GAGKK,IAAqBC,EAAY,OAAO,KAAKR,EAAS,KAAK,CAAC,CAAC,MAAM,EAAE;E,iBAIjE,OAAO,KAAKA,EAAA,KAAQ,CAAA,CAAE,SAAM,KADpCX,EAAA,GAAAC,EAuBaC,EAAAqB,CAAA,GAAA;;GArBX,OAAM;;GAEN,SAAApB,QAWoB,CAXpBC,EAWoBF,EAAAwB,CAAA,GAAA,MAAA;IAVlB,SAAAvB,QASM,CATNE,EASM,OATNI,GASM,CARJL,EAOMF,EAAA0B,CAAA,GAAA;KANJ,OAAM;KACN,MAAK;KACL,aAAA;KACC,sBAAmCjB,EAAA,MAASO,EAAA,U;;;G,IAQ3B,OAAO,KAAKP,EAAA,KAAQ,CAAA,CAAE,SAAM,KAApDX,EAAA,GAAAC,EAImBC,EAAA2B,CAAA,GAAA,EAAA,KAAA,EAAA,GAAA;IAHjB,SAAA1B,QAEc,CAFdC,EAEcF,EAAAI,CAAA,GAAA;KADH,YAAAY,EAAA;KAAA,uBAAA,AAAAY,EAAA,QAAA,MAAA,EAAkB,QAAAC;KAC1B,UAAApB,EAAA"}
1
+ {"version":3,"file":"SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref","_withCtx","_createVNode","_createElementVNode","ExamplePicker","ExamplePicker_default","_hoisted_1","SchemaObjectExampleCodeBlock_vue_vue_type_script_setup_true_lang_default","examples","computed","base","__props","key","value","index","selectedExampleKey","ref","openBlock","createBlock","unref","ScalarCard","withCtx","createVNode","ScalarCardSection","createElementVNode","ScalarCodeBlock","ScalarCardFooter","_cache","$event","createCommentVNode"],"sources":["../../src/schema/SchemaObjectExampleCodeBlock.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n ScalarCard,\n ScalarCardFooter,\n ScalarCardSection,\n} from '@scalar/components/card'\nimport { ScalarCodeBlock } from '@scalar/components/code-block'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport { ExamplePicker } from '../code-example'\n\nconst { schema } = defineProps<{ schema: SchemaObject }>()\n\n/** Grab the examples for the schema object */\nconst examples = computed<Record<string, string>>(() => {\n const base: Record<string, string> = {}\n\n // x-examples extension\n if (schema['x-examples']) {\n Object.entries(schema['x-examples']).forEach(([key, value]) => {\n base[key] =\n typeof value === 'object'\n ? JSON.stringify(value, null, 2)\n : String(value)\n })\n }\n\n // Regular schema examples array\n if (schema.examples) {\n schema.examples.forEach((value, index) => {\n base[`Example ${index + 1}`] =\n typeof value === 'object'\n ? JSON.stringify(value, null, 2)\n : String(value)\n })\n }\n\n return base\n})\n\n/** The currently selected example key */\nconst selectedExampleKey = ref<string>(Object.keys(examples.value)[0] ?? '')\n</script>\n<template>\n <ScalarCard\n v-if=\"Object.keys(examples).length > 0\"\n class=\"dark-mode\">\n <!-- Code snippet -->\n <ScalarCardSection>\n <div class=\"code-snippet\">\n <ScalarCodeBlock\n class=\"bg-transparent\"\n lang=\"json\"\n lineNumbers\n :prettyPrintedContent=\"\n examples[selectedExampleKey] ??\n 'There was an error loading the example'\n \" />\n </div>\n </ScalarCardSection>\n\n <!-- Example picker -->\n <ScalarCardFooter v-if=\"Object.keys(examples).length > 1\">\n <ExamplePicker\n v-model=\"selectedExampleKey\"\n :examples />\n </ScalarCardFooter>\n </ScalarCard>\n</template>\n"],"mappings":";;;;;;;;;EAeA,IAAMU,IAAWC,QAAuC;GACtD,IAAMC,IAA+B,CAAC;GAsBtC,OAnBIC,EAAA,OAAO,iBACT,OAAO,QAAQA,EAAA,OAAO,aAAa,CAAC,CAAC,SAAS,CAACC,GAAKC,OAAW;IAC7D,EAAKD,KACH,OAAOC,KAAU,WACb,KAAK,UAAUA,GAAO,MAAM,CAAC,IAC7B,OAAOA,CAAK;GACpB,CAAC,GAICF,EAAA,OAAO,YACTA,EAAA,OAAO,SAAS,SAAS,GAAO,MAAU;IACxC,EAAK,WAAWG,IAAQ,OACtB,OAAOD,KAAU,WACb,KAAK,UAAUA,GAAO,MAAM,CAAC,IAC7B,OAAOA,CAAK;GACpB,CAAC,GAGIH;EACT,CAAC,GAGKK,IAAqBC,EAAY,OAAO,KAAKR,EAAS,KAAK,CAAC,CAAC,MAAM,EAAE;E,iBAIjE,OAAO,KAAKA,EAAA,KAAQ,CAAA,CAAE,SAAM,KADpCV,EAAA,GAAAC,EAuBaC,EAAAoB,CAAA,GAAA;;GArBX,OAAM;;GAEN,SAAAnB,QAWoB,CAXpBC,EAWoBF,EAAAuB,CAAA,GAAA,MAAA;IAVlB,SAAAtB,QASM,CATNE,EASM,OATNG,GASM,CARJJ,EAOMF,EAAAyB,CAAA,GAAA;KANJ,OAAM;KACN,MAAK;KACL,aAAA;KACC,sBAAmCjB,EAAA,MAASO,EAAA,U;;;G,IAQ3B,OAAO,KAAKP,EAAA,KAAQ,CAAA,CAAE,SAAM,KAApDV,EAAA,GAAAC,EAImBC,EAAA0B,CAAA,GAAA,EAAA,KAAA,EAAA,GAAA;IAHjB,SAAAzB,QAEc,CAFdC,EAEcF,EAAAI,CAAA,GAAA;KADH,YAAAW,EAAA;KAAA,uBAAA,AAAAY,EAAA,QAAA,MAAA,EAAkB,QAAAC;KAC1B,UAAApB,EAAA"}
@@ -1,7 +1,6 @@
1
1
  import e from "./SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js";
2
- //#region src/schema/SchemaObjectProperties.vue
2
+ // src/schema/SchemaObjectProperties.vue
3
3
  var t = e;
4
- //#endregion
5
4
  export { t as default };
6
5
 
7
6
  //# sourceMappingURL=SchemaObjectProperties.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaObjectProperties.vue.js","names":["_sfc_main","SchemaObjectProperties_vue_vue_type_script_setup_true_lang_default","SchemaObjectProperties_default"],"sources":["../../src/schema/SchemaObjectProperties.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n SchemaReferenceType,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { isTypeObject } from './helpers/is-type-object'\nimport { getCycleKey } from './helpers/schema-cycle'\nimport { sortPropertyNames } from './helpers/sort-property-names'\nimport SchemaProperty from './SchemaProperty.vue'\nimport type { SchemaOptions, SchemaRenderingProps } from './types'\n\nconst { schema, discriminator, options, schemaContext, compositionPath } =\n defineProps<\n {\n schema: SchemaObject\n discriminator?: DiscriminatorObject\n compact?: boolean\n hideHeading?: boolean\n level?: number\n /** Real nesting depth (see SchemaProperty) */\n depth?: number\n hideModelNames?: boolean\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n options: SchemaOptions\n schemaContext?: string\n compositionPath?: string[]\n } & SchemaRenderingProps\n >()\n\n/**\n * Sorts properties by required status first, then alphabetically.\n * Required properties appear first, followed by optional properties.\n */\nconst sortedProperties = computed(() =>\n sortPropertyNames(schema, discriminator, options),\n)\n\n/**\n * Get the display name for additional properties.\n *\n * Checks x-additionalPropertiesName extension first, then falls back to the\n * propertyNames schema title if available.\n */\nconst getAdditionalPropertiesName = (\n _additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n) => {\n const additionalProperties =\n typeof _additionalProperties === 'boolean'\n ? _additionalProperties\n : resolve.schema(_additionalProperties)\n\n if (\n typeof additionalProperties === 'object' &&\n typeof additionalProperties['x-additionalPropertiesName'] === 'string' &&\n additionalProperties['x-additionalPropertiesName'].trim().length > 0\n ) {\n return `${additionalProperties['x-additionalPropertiesName'].trim()}`\n }\n\n // Fall back to the propertyNames title when available\n if (_propertyNames) {\n const resolved = resolve.schema(_propertyNames)\n if (resolved?.title) {\n return resolved.title\n }\n }\n\n return 'propertyName'\n}\n\n/**\n * Extract enum values from the propertyNames schema.\n *\n * JSON Schema's propertyNames keyword constrains which keys are valid\n * in an object with additionalProperties. When it contains an enum,\n * these are the allowed key names.\n */\nconst getPropertyNamesEnum = (\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n): string[] | undefined => {\n if (!_propertyNames) {\n return undefined\n }\n\n const resolved = resolve.schema(_propertyNames)\n if (\n resolved &&\n 'enum' in resolved &&\n Array.isArray(resolved.enum) &&\n resolved.enum.length > 0\n ) {\n return resolved.enum as string[]\n }\n\n return undefined\n}\n\n/** Enum values for the property keys, derived from propertyNames if present. */\nconst additionalPropertiesEnum = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return getPropertyNamesEnum(schema.propertyNames)\n})\n\n/**\n * The resolved propertyNames schema for the property keys.\n *\n * Surfaces key constraints such as `format` (for example `uuid`) so they are\n * not lost when rendering a map of additional properties.\n */\nconst additionalPropertiesKeySchema = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return schema.propertyNames ? resolve.schema(schema.propertyNames) : undefined\n})\n\n/**\n * Keep sibling property descriptions separate from the referenced schema.\n *\n * This allows us to render both:\n * - the property-specific description written next to the $ref, and\n * - the referenced schema's own description (for example discriminator parent docs)\n */\nconst getPropertySchema = (\n property: SchemaReferenceType<SchemaObject> | undefined,\n): SchemaObject | undefined => {\n if (property === undefined) {\n return undefined\n }\n return resolve.schema(property)\n}\n\nconst getPropertyDescription = (\n property: SchemaReferenceType<SchemaObject> | undefined,\n): string | undefined => {\n if (!property) {\n return undefined\n }\n\n return typeof property.description === 'string'\n ? property.description\n : undefined\n}\n\ntype PropertyRow = {\n name: string\n cycleKey: unknown\n description: string | undefined\n required: boolean\n schema: SchemaObject | undefined\n}\n\n/**\n * Each child read once, in panel order.\n *\n * The template used to fetch `schema.properties[name]` three times per row\n * (cycle key, description, schema) and walk the `required` array with\n * `includes` for every row. Through the document's proxy stack those reads\n * were the panel's largest per-row JS cost, and none of them can change while\n * the panel is up. `false` for a name outside `required` lands on the same\n * `required: false` default in SchemaProperty that `undefined` did.\n */\nconst rows = computed((): PropertyRow[] => {\n if (!isTypeObject(schema) || !schema.properties) {\n return []\n }\n\n const { properties } = schema\n const requiredSet = new Set(schema.required ?? [])\n\n return sortedProperties.value.map((name): PropertyRow => {\n const property = properties[name]\n\n return {\n name,\n cycleKey: getCycleKey(property),\n description: getPropertyDescription(property),\n required: requiredSet.has(name),\n schema: getPropertySchema(property),\n }\n })\n})\n\n/**\n * Get the value for additional properties.\n *\n * When additionalProperties is true or an empty object, it should render as { type: 'anything' }.\n * $ref values are resolved before the type check so the referenced schema is rendered correctly.\n */\nconst getAdditionalPropertiesValue = (\n additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n): SchemaObject => {\n // Resolve $ref first so the type check below works on the actual schema\n const resolved =\n typeof additionalProperties === 'boolean'\n ? additionalProperties\n : resolve.schema(additionalProperties)\n\n if (\n resolved === true ||\n (typeof resolved === 'object' && Object.keys(resolved).length === 0) ||\n typeof resolved !== 'object' ||\n !('type' in resolved)\n ) {\n return {\n // @ts-expect-error - ask hans\n type: 'anything',\n ...(typeof resolved === 'object' ? resolved : {}),\n }\n }\n\n return resolved\n}\n</script>\n\n<template>\n <!-- Properties -->\n <template v-if=\"isTypeObject(schema) && schema.properties\">\n <SchemaProperty\n v-for=\"row in rows\"\n :key=\"row.name\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"row.name\"\n :cycleKey=\"row.cycleKey\"\n :depth\n :description=\"row.description\"\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"row.name\"\n :options=\"options\"\n :required=\"row.required\"\n :schema=\"row.schema\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n\n <!-- patternProperties -->\n <template v-if=\"isTypeObject(schema) && schema.patternProperties\">\n <SchemaProperty\n v-for=\"[key, property] in Object.entries(schema.patternProperties)\"\n :key=\"key\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"key\"\n :cycleKey=\"getCycleKey(property)\"\n :depth\n :description=\"getPropertyDescription(property)\"\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames=\"hideModelNames\"\n :level\n :name=\"key\"\n :options=\"options\"\n :schema=\"getPropertySchema(property)\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n\n <!-- additionalProperties -->\n <template v-if=\"isTypeObject(schema) && schema.additionalProperties\">\n <SchemaProperty\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n :cycleKey=\"getCycleKey(schema.additionalProperties)\"\n :depth\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n noncollapsible\n :options=\"options\"\n :propertyNamesEnum=\"additionalPropertiesEnum\"\n :propertyNamesSchema=\"additionalPropertiesKeySchema\"\n :schema=\"getAdditionalPropertiesValue(schema.additionalProperties)\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\"\n variant=\"additionalProperties\" />\n </template>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"SchemaObjectProperties.vue.js","names":["SchemaObjectProperties_vue_vue_type_script_setup_true_lang_default","SchemaObjectProperties_default"],"sources":[],"mappings":""}
@@ -4,7 +4,7 @@ import { sortPropertyNames as n } from "./helpers/sort-property-names.js";
4
4
  import r from "./SchemaProperty.vue.js";
5
5
  import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, defineComponent as l, openBlock as u, renderList as d, unref as f } from "vue";
6
6
  import { resolve as p } from "@scalar/workspace-store/resolve";
7
- //#region src/schema/SchemaObjectProperties.vue?vue&type=script&setup=true&lang.ts
7
+ // src/schema/SchemaObjectProperties.vue?vue&type=script&setup=true&lang.ts
8
8
  var m = /*@__PURE__*/ l({
9
9
  __name: "SchemaObjectProperties",
10
10
  props: {
@@ -201,7 +201,6 @@ var m = /*@__PURE__*/ l({
201
201
  ], 64));
202
202
  }
203
203
  });
204
- //#endregion
205
204
  export { m as default };
206
205
 
207
206
  //# sourceMappingURL=SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_Fragment","_unref","_renderList","_createBlock","SchemaProperty","_createCommentVNode","SchemaProperty_default","SchemaObjectProperties_vue_vue_type_script_setup_true_lang_default","sortedProperties","computed","sortPropertyNames","__props","getAdditionalPropertiesName","additionalProperties","_additionalProperties","resolve","_propertyNames","resolved","getPropertyNamesEnum","additionalPropertiesEnum","isTypeObject","additionalPropertiesKeySchema","getPropertySchema","property","getPropertyDescription","rows","requiredSet","properties","name","getCycleKey","getAdditionalPropertiesValue","openBlock","createElementBlock","Fragment","unref","renderList","createBlock","row","createCommentVNode","key"],"sources":["../../src/schema/SchemaObjectProperties.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n SchemaReferenceType,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { isTypeObject } from './helpers/is-type-object'\nimport { getCycleKey } from './helpers/schema-cycle'\nimport { sortPropertyNames } from './helpers/sort-property-names'\nimport SchemaProperty from './SchemaProperty.vue'\nimport type { SchemaOptions, SchemaRenderingProps } from './types'\n\nconst { schema, discriminator, options, schemaContext, compositionPath } =\n defineProps<\n {\n schema: SchemaObject\n discriminator?: DiscriminatorObject\n compact?: boolean\n hideHeading?: boolean\n level?: number\n /** Real nesting depth (see SchemaProperty) */\n depth?: number\n hideModelNames?: boolean\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n options: SchemaOptions\n schemaContext?: string\n compositionPath?: string[]\n } & SchemaRenderingProps\n >()\n\n/**\n * Sorts properties by required status first, then alphabetically.\n * Required properties appear first, followed by optional properties.\n */\nconst sortedProperties = computed(() =>\n sortPropertyNames(schema, discriminator, options),\n)\n\n/**\n * Get the display name for additional properties.\n *\n * Checks x-additionalPropertiesName extension first, then falls back to the\n * propertyNames schema title if available.\n */\nconst getAdditionalPropertiesName = (\n _additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n) => {\n const additionalProperties =\n typeof _additionalProperties === 'boolean'\n ? _additionalProperties\n : resolve.schema(_additionalProperties)\n\n if (\n typeof additionalProperties === 'object' &&\n typeof additionalProperties['x-additionalPropertiesName'] === 'string' &&\n additionalProperties['x-additionalPropertiesName'].trim().length > 0\n ) {\n return `${additionalProperties['x-additionalPropertiesName'].trim()}`\n }\n\n // Fall back to the propertyNames title when available\n if (_propertyNames) {\n const resolved = resolve.schema(_propertyNames)\n if (resolved?.title) {\n return resolved.title\n }\n }\n\n return 'propertyName'\n}\n\n/**\n * Extract enum values from the propertyNames schema.\n *\n * JSON Schema's propertyNames keyword constrains which keys are valid\n * in an object with additionalProperties. When it contains an enum,\n * these are the allowed key names.\n */\nconst getPropertyNamesEnum = (\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n): string[] | undefined => {\n if (!_propertyNames) {\n return undefined\n }\n\n const resolved = resolve.schema(_propertyNames)\n if (\n resolved &&\n 'enum' in resolved &&\n Array.isArray(resolved.enum) &&\n resolved.enum.length > 0\n ) {\n return resolved.enum as string[]\n }\n\n return undefined\n}\n\n/** Enum values for the property keys, derived from propertyNames if present. */\nconst additionalPropertiesEnum = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return getPropertyNamesEnum(schema.propertyNames)\n})\n\n/**\n * The resolved propertyNames schema for the property keys.\n *\n * Surfaces key constraints such as `format` (for example `uuid`) so they are\n * not lost when rendering a map of additional properties.\n */\nconst additionalPropertiesKeySchema = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return schema.propertyNames ? resolve.schema(schema.propertyNames) : undefined\n})\n\n/**\n * Keep sibling property descriptions separate from the referenced schema.\n *\n * This allows us to render both:\n * - the property-specific description written next to the $ref, and\n * - the referenced schema's own description (for example discriminator parent docs)\n */\nconst getPropertySchema = (\n property: SchemaReferenceType<SchemaObject> | undefined,\n): SchemaObject | undefined => {\n if (property === undefined) {\n return undefined\n }\n return resolve.schema(property)\n}\n\nconst getPropertyDescription = (\n property: SchemaReferenceType<SchemaObject> | undefined,\n): string | undefined => {\n if (!property) {\n return undefined\n }\n\n return typeof property.description === 'string'\n ? property.description\n : undefined\n}\n\ntype PropertyRow = {\n name: string\n cycleKey: unknown\n description: string | undefined\n required: boolean\n schema: SchemaObject | undefined\n}\n\n/**\n * Each child read once, in panel order.\n *\n * The template used to fetch `schema.properties[name]` three times per row\n * (cycle key, description, schema) and walk the `required` array with\n * `includes` for every row. Through the document's proxy stack those reads\n * were the panel's largest per-row JS cost, and none of them can change while\n * the panel is up. `false` for a name outside `required` lands on the same\n * `required: false` default in SchemaProperty that `undefined` did.\n */\nconst rows = computed((): PropertyRow[] => {\n if (!isTypeObject(schema) || !schema.properties) {\n return []\n }\n\n const { properties } = schema\n const requiredSet = new Set(schema.required ?? [])\n\n return sortedProperties.value.map((name): PropertyRow => {\n const property = properties[name]\n\n return {\n name,\n cycleKey: getCycleKey(property),\n description: getPropertyDescription(property),\n required: requiredSet.has(name),\n schema: getPropertySchema(property),\n }\n })\n})\n\n/**\n * Get the value for additional properties.\n *\n * When additionalProperties is true or an empty object, it should render as { type: 'anything' }.\n * $ref values are resolved before the type check so the referenced schema is rendered correctly.\n */\nconst getAdditionalPropertiesValue = (\n additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n): SchemaObject => {\n // Resolve $ref first so the type check below works on the actual schema\n const resolved =\n typeof additionalProperties === 'boolean'\n ? additionalProperties\n : resolve.schema(additionalProperties)\n\n if (\n resolved === true ||\n (typeof resolved === 'object' && Object.keys(resolved).length === 0) ||\n typeof resolved !== 'object' ||\n !('type' in resolved)\n ) {\n return {\n // @ts-expect-error - ask hans\n type: 'anything',\n ...(typeof resolved === 'object' ? resolved : {}),\n }\n }\n\n return resolved\n}\n</script>\n\n<template>\n <!-- Properties -->\n <template v-if=\"isTypeObject(schema) && schema.properties\">\n <SchemaProperty\n v-for=\"row in rows\"\n :key=\"row.name\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"row.name\"\n :cycleKey=\"row.cycleKey\"\n :depth\n :description=\"row.description\"\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"row.name\"\n :options=\"options\"\n :required=\"row.required\"\n :schema=\"row.schema\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n\n <!-- patternProperties -->\n <template v-if=\"isTypeObject(schema) && schema.patternProperties\">\n <SchemaProperty\n v-for=\"[key, property] in Object.entries(schema.patternProperties)\"\n :key=\"key\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"key\"\n :cycleKey=\"getCycleKey(property)\"\n :depth\n :description=\"getPropertyDescription(property)\"\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames=\"hideModelNames\"\n :level\n :name=\"key\"\n :options=\"options\"\n :schema=\"getPropertySchema(property)\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n\n <!-- additionalProperties -->\n <template v-if=\"isTypeObject(schema) && schema.additionalProperties\">\n <SchemaProperty\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n :cycleKey=\"getCycleKey(schema.additionalProperties)\"\n :depth\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n noncollapsible\n :options=\"options\"\n :propertyNamesEnum=\"additionalPropertiesEnum\"\n :propertyNamesSchema=\"additionalPropertiesKeySchema\"\n :schema=\"getAdditionalPropertiesValue(schema.additionalProperties)\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\"\n variant=\"additionalProperties\" />\n </template>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCA,IAAMU,IAAmBC,QACvBC,EAAkBC,EAAA,QAAQA,EAAA,eAAeA,EAAA,OAAO,CAClD,GAQMC,KACJ,GAIA,MACG;GACH,IAAMC,IACJ,OAAOC,KAA0B,YAC7BA,IACAC,EAAQ,OAAOD,CAAqB;GAE1C,IACE,OAAOD,KAAyB,YAChC,OAAOA,EAAqB,iCAAkC,YAC9DA,EAAqB,6BAA6B,CAAC,KAAK,CAAC,CAAC,SAAS,GAEnE,OAAO,GAAGA,EAAqB,6BAA6B,CAAC,KAAK;GAIpE,IAAIG,GAAgB;IAClB,IAAMC,IAAWF,EAAQ,OAAOC,CAAc;IAC9C,IAAIC,GAAU,OACZ,OAAOA,EAAS;GAE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C5C,eAAAZ,EAAA;IACA,UAAUA,EAAA;IACV,WAAWA,EAAA;IACX,aAAAA,EAAA;IACA,gBAAgBA,EAAA;IAChB,OAAAA,EAAA;IACA,MAAM4B;IACN,SAAS5B,EAAA;IACT,QAAQW,EAAkBC,CAAQ;IAClC,eAAeZ,EAAA;IACf,gBAAgBA,EAAA;IAChB,wBAAwBA,EAAA;;;;;;;;;;;;;;;;;;;;;;GAIbV,EAAAmB,CAAA,CAAY,CAACT,EAAA,MAAM,KAAKA,EAAA,OAAO,wBAC7Cb,EAAA,GAAAK,EAgCmCC,GAAA;;IA/BhC,YAAAO,EAAA;IACA,SAAAA,EAAA;IACA,iBAAiBA,EAAA;IACjB,wBAAiCC,EAAuCD,EAAA,OAAO,sBAAgCA,EAAA,OAAO,a;IAMtH,UAAUV,EAAA4B,CAAA,CAAW,CAAClB,EAAA,OAAO,oBAAoB;IACjD,OAAAA,EAAA;IACA,eAAAA,EAAA;IACA,UAAUA,EAAA;IACV,WAAWA,EAAA;IACX,aAAAA,EAAA;IACA,gBAAAA,EAAA;IACA,OAAAA,EAAA;IACA,MAAeC,EAAuCD,EAAA,OAAO,sBAAgCA,EAAA,OAAO,a;IAMrG,gBAAA;IACC,SAASA,EAAA;IACT,mBAAmBQ,EAAA;IACnB,qBAAqBE,EAAA;IACrB,QAAQS,EAA6BnB,EAAA,OAAO,oBAAoB;IAChE,eAAeA,EAAA;IACf,gBAAgBA,EAAA;IAChB,wBAAwBA,EAAA;IACzB,SAAQ"}
1
+ {"version":3,"file":"SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_Fragment","_unref","_renderList","_createBlock","SchemaProperty","SchemaProperty_default","SchemaObjectProperties_vue_vue_type_script_setup_true_lang_default","sortedProperties","computed","sortPropertyNames","__props","getAdditionalPropertiesName","additionalProperties","_additionalProperties","resolve","_propertyNames","resolved","getPropertyNamesEnum","additionalPropertiesEnum","isTypeObject","additionalPropertiesKeySchema","getPropertySchema","property","getPropertyDescription","rows","requiredSet","properties","name","getCycleKey","getAdditionalPropertiesValue","openBlock","createElementBlock","Fragment","unref","renderList","createBlock","row","createCommentVNode","key"],"sources":["../../src/schema/SchemaObjectProperties.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n SchemaReferenceType,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { isTypeObject } from './helpers/is-type-object'\nimport { getCycleKey } from './helpers/schema-cycle'\nimport { sortPropertyNames } from './helpers/sort-property-names'\nimport SchemaProperty from './SchemaProperty.vue'\nimport type { SchemaOptions, SchemaRenderingProps } from './types'\n\nconst { schema, discriminator, options, schemaContext, compositionPath } =\n defineProps<\n {\n schema: SchemaObject\n discriminator?: DiscriminatorObject\n compact?: boolean\n hideHeading?: boolean\n level?: number\n /** Real nesting depth (see SchemaProperty) */\n depth?: number\n hideModelNames?: boolean\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n options: SchemaOptions\n schemaContext?: string\n compositionPath?: string[]\n } & SchemaRenderingProps\n >()\n\n/**\n * Sorts properties by required status first, then alphabetically.\n * Required properties appear first, followed by optional properties.\n */\nconst sortedProperties = computed(() =>\n sortPropertyNames(schema, discriminator, options),\n)\n\n/**\n * Get the display name for additional properties.\n *\n * Checks x-additionalPropertiesName extension first, then falls back to the\n * propertyNames schema title if available.\n */\nconst getAdditionalPropertiesName = (\n _additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n) => {\n const additionalProperties =\n typeof _additionalProperties === 'boolean'\n ? _additionalProperties\n : resolve.schema(_additionalProperties)\n\n if (\n typeof additionalProperties === 'object' &&\n typeof additionalProperties['x-additionalPropertiesName'] === 'string' &&\n additionalProperties['x-additionalPropertiesName'].trim().length > 0\n ) {\n return `${additionalProperties['x-additionalPropertiesName'].trim()}`\n }\n\n // Fall back to the propertyNames title when available\n if (_propertyNames) {\n const resolved = resolve.schema(_propertyNames)\n if (resolved?.title) {\n return resolved.title\n }\n }\n\n return 'propertyName'\n}\n\n/**\n * Extract enum values from the propertyNames schema.\n *\n * JSON Schema's propertyNames keyword constrains which keys are valid\n * in an object with additionalProperties. When it contains an enum,\n * these are the allowed key names.\n */\nconst getPropertyNamesEnum = (\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n): string[] | undefined => {\n if (!_propertyNames) {\n return undefined\n }\n\n const resolved = resolve.schema(_propertyNames)\n if (\n resolved &&\n 'enum' in resolved &&\n Array.isArray(resolved.enum) &&\n resolved.enum.length > 0\n ) {\n return resolved.enum as string[]\n }\n\n return undefined\n}\n\n/** Enum values for the property keys, derived from propertyNames if present. */\nconst additionalPropertiesEnum = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return getPropertyNamesEnum(schema.propertyNames)\n})\n\n/**\n * The resolved propertyNames schema for the property keys.\n *\n * Surfaces key constraints such as `format` (for example `uuid`) so they are\n * not lost when rendering a map of additional properties.\n */\nconst additionalPropertiesKeySchema = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return schema.propertyNames ? resolve.schema(schema.propertyNames) : undefined\n})\n\n/**\n * Keep sibling property descriptions separate from the referenced schema.\n *\n * This allows us to render both:\n * - the property-specific description written next to the $ref, and\n * - the referenced schema's own description (for example discriminator parent docs)\n */\nconst getPropertySchema = (\n property: SchemaReferenceType<SchemaObject> | undefined,\n): SchemaObject | undefined => {\n if (property === undefined) {\n return undefined\n }\n return resolve.schema(property)\n}\n\nconst getPropertyDescription = (\n property: SchemaReferenceType<SchemaObject> | undefined,\n): string | undefined => {\n if (!property) {\n return undefined\n }\n\n return typeof property.description === 'string'\n ? property.description\n : undefined\n}\n\ntype PropertyRow = {\n name: string\n cycleKey: unknown\n description: string | undefined\n required: boolean\n schema: SchemaObject | undefined\n}\n\n/**\n * Each child read once, in panel order.\n *\n * The template used to fetch `schema.properties[name]` three times per row\n * (cycle key, description, schema) and walk the `required` array with\n * `includes` for every row. Through the document's proxy stack those reads\n * were the panel's largest per-row JS cost, and none of them can change while\n * the panel is up. `false` for a name outside `required` lands on the same\n * `required: false` default in SchemaProperty that `undefined` did.\n */\nconst rows = computed((): PropertyRow[] => {\n if (!isTypeObject(schema) || !schema.properties) {\n return []\n }\n\n const { properties } = schema\n const requiredSet = new Set(schema.required ?? [])\n\n return sortedProperties.value.map((name): PropertyRow => {\n const property = properties[name]\n\n return {\n name,\n cycleKey: getCycleKey(property),\n description: getPropertyDescription(property),\n required: requiredSet.has(name),\n schema: getPropertySchema(property),\n }\n })\n})\n\n/**\n * Get the value for additional properties.\n *\n * When additionalProperties is true or an empty object, it should render as { type: 'anything' }.\n * $ref values are resolved before the type check so the referenced schema is rendered correctly.\n */\nconst getAdditionalPropertiesValue = (\n additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n): SchemaObject => {\n // Resolve $ref first so the type check below works on the actual schema\n const resolved =\n typeof additionalProperties === 'boolean'\n ? additionalProperties\n : resolve.schema(additionalProperties)\n\n if (\n resolved === true ||\n (typeof resolved === 'object' && Object.keys(resolved).length === 0) ||\n typeof resolved !== 'object' ||\n !('type' in resolved)\n ) {\n return {\n // @ts-expect-error - ask hans\n type: 'anything',\n ...(typeof resolved === 'object' ? resolved : {}),\n }\n }\n\n return resolved\n}\n</script>\n\n<template>\n <!-- Properties -->\n <template v-if=\"isTypeObject(schema) && schema.properties\">\n <SchemaProperty\n v-for=\"row in rows\"\n :key=\"row.name\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"row.name\"\n :cycleKey=\"row.cycleKey\"\n :depth\n :description=\"row.description\"\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"row.name\"\n :options=\"options\"\n :required=\"row.required\"\n :schema=\"row.schema\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n\n <!-- patternProperties -->\n <template v-if=\"isTypeObject(schema) && schema.patternProperties\">\n <SchemaProperty\n v-for=\"[key, property] in Object.entries(schema.patternProperties)\"\n :key=\"key\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"key\"\n :cycleKey=\"getCycleKey(property)\"\n :depth\n :description=\"getPropertyDescription(property)\"\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames=\"hideModelNames\"\n :level\n :name=\"key\"\n :options=\"options\"\n :schema=\"getPropertySchema(property)\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n\n <!-- additionalProperties -->\n <template v-if=\"isTypeObject(schema) && schema.additionalProperties\">\n <SchemaProperty\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n :cycleKey=\"getCycleKey(schema.additionalProperties)\"\n :depth\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n noncollapsible\n :options=\"options\"\n :propertyNamesEnum=\"additionalPropertiesEnum\"\n :propertyNamesSchema=\"additionalPropertiesKeySchema\"\n :schema=\"getAdditionalPropertiesValue(schema.additionalProperties)\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\"\n variant=\"additionalProperties\" />\n </template>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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,qBAAqBE,EAAA;IACrB,QAAQS,EAA6BnB,EAAA,OAAO,oBAAoB;IAChE,eAAeA,EAAA;IACf,gBAAgBA,EAAA;IAChB,wBAAwBA,EAAA;IACzB,SAAQ"}
@@ -1,9 +1,8 @@
1
- import e from "../_virtual/_plugin-vue_export-helper.js";
2
- import t from "./SchemaProperty.vue_vue_type_script_setup_true_lang.js";
1
+ import e from "./SchemaProperty.vue_vue_type_script_setup_true_lang.js";
3
2
  /* empty css */
4
- //#region src/schema/SchemaProperty.vue
5
- var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-00f22f7c"]]);
6
- //#endregion
3
+ import t from "../_virtual/_plugin-vue_export-helper.js";
4
+ // src/schema/SchemaProperty.vue
5
+ var n = /*#__PURE__*/ t(e, [["__scopeId", "data-v-00f22f7c"]]);
7
6
  export { n as default };
8
7
 
9
8
  //# sourceMappingURL=SchemaProperty.vue.js.map