@scalar/blocks 0.5.3 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +13 -29
  3. package/dist/code-example/components/AsyncApiCodeExample.vue.d.ts +19 -0
  4. package/dist/code-example/components/AsyncApiCodeExample.vue.d.ts.map +1 -0
  5. package/dist/code-example/components/AsyncApiCodeExample.vue.js +9 -0
  6. package/dist/code-example/components/AsyncApiCodeExample.vue.js.map +1 -0
  7. package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js +114 -0
  8. package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js.map +1 -0
  9. package/dist/code-example/components/CodeExample.vue.js +4 -4
  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 +258 -0
  12. package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js.map +1 -0
  13. package/dist/code-example/components/ExamplePicker.vue.js +1 -1
  14. package/dist/code-example/components/ExamplePicker.vue.js.map +1 -1
  15. package/dist/code-example/components/{ExamplePicker.vue.script.js → ExamplePicker.vue_vue_type_script_setup_true_lang.js} +5 -5
  16. package/dist/code-example/components/ExamplePicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
  17. package/dist/code-example/components/HttpMethod.vue.js +1 -1
  18. package/dist/code-example/components/HttpMethod.vue.js.map +1 -1
  19. package/dist/code-example/components/{HttpMethod.vue.script.js → HttpMethod.vue_vue_type_script_setup_true_lang.js} +1 -1
  20. package/dist/code-example/components/HttpMethod.vue_vue_type_script_setup_true_lang.js.map +1 -0
  21. package/dist/code-example/helpers/filter-clients-by-query.js.map +1 -1
  22. package/dist/code-example/helpers/find-client.js.map +1 -1
  23. package/dist/code-example/helpers/format-language.js.map +1 -1
  24. package/dist/code-example/helpers/generate-client-options.js.map +1 -1
  25. package/dist/code-example/helpers/generate-code-snippet.js.map +1 -1
  26. package/dist/code-example/helpers/get-asyncapi-example-context.d.ts +12 -0
  27. package/dist/code-example/helpers/get-asyncapi-example-context.d.ts.map +1 -0
  28. package/dist/code-example/helpers/get-asyncapi-example-context.js +33 -0
  29. package/dist/code-example/helpers/get-asyncapi-example-context.js.map +1 -0
  30. package/dist/code-example/helpers/get-clients.js.map +1 -1
  31. package/dist/code-example/helpers/get-custom-code-samples.js.map +1 -1
  32. package/dist/code-example/helpers/get-generated-payload-example.d.ts +4 -0
  33. package/dist/code-example/helpers/get-generated-payload-example.d.ts.map +1 -0
  34. package/dist/code-example/helpers/get-generated-payload-example.js +25 -0
  35. package/dist/code-example/helpers/get-generated-payload-example.js.map +1 -0
  36. package/dist/code-example/helpers/get-message-example-content.d.ts +10 -0
  37. package/dist/code-example/helpers/get-message-example-content.d.ts.map +1 -0
  38. package/dist/code-example/helpers/get-message-example-content.js +29 -0
  39. package/dist/code-example/helpers/get-message-example-content.js.map +1 -0
  40. package/dist/code-example/helpers/get-secrets.js.map +1 -1
  41. package/dist/code-example/helpers/get-snippet.js.map +1 -1
  42. package/dist/code-example/helpers/operation-to-har/operation-to-har.js +32 -32
  43. package/dist/code-example/helpers/operation-to-har/operation-to-har.js.map +1 -1
  44. package/dist/code-example/helpers/operation-to-har/process-body.js +41 -47
  45. package/dist/code-example/helpers/operation-to-har/process-body.js.map +1 -1
  46. package/dist/code-example/helpers/operation-to-har/process-parameters.js +51 -55
  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 +30 -38
  49. package/dist/code-example/helpers/operation-to-har/process-security-schemes.js.map +1 -1
  50. package/dist/code-example/helpers/operation-to-har/process-server-url.js +5 -1
  51. package/dist/code-example/helpers/operation-to-har/process-server-url.js.map +1 -1
  52. package/dist/code-example/index.d.ts +4 -0
  53. package/dist/code-example/index.d.ts.map +1 -1
  54. package/dist/code-example/index.js +17 -14
  55. package/dist/code-example/mount-asyncapi.d.ts +14 -0
  56. package/dist/code-example/mount-asyncapi.d.ts.map +1 -0
  57. package/dist/code-example/mount-asyncapi.js +27 -0
  58. package/dist/code-example/mount-asyncapi.js.map +1 -0
  59. package/dist/code-example/mount.d.ts +4 -2
  60. package/dist/code-example/mount.d.ts.map +1 -1
  61. package/dist/code-example/mount.js +39 -36
  62. package/dist/code-example/mount.js.map +1 -1
  63. package/dist/constants.js +1 -1
  64. package/dist/constants.js.map +1 -1
  65. package/dist/schema/LinkButton.vue.js.map +1 -1
  66. package/dist/schema/RenderString.vue.js +1 -1
  67. package/dist/schema/RenderString.vue.js.map +1 -1
  68. package/dist/schema/{RenderString.vue.script.js → RenderString.vue_vue_type_script_setup_true_lang.js} +1 -1
  69. package/dist/schema/RenderString.vue_vue_type_script_setup_true_lang.js.map +1 -0
  70. package/dist/schema/Schema.vue.js +2 -2
  71. package/dist/schema/Schema.vue.js.map +1 -1
  72. package/dist/schema/{Schema.vue.script.js → Schema.vue_vue_type_script_setup_true_lang.js} +1 -1
  73. package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js.map +1 -0
  74. package/dist/schema/SchemaCollapsedPreview.vue.js +1 -1
  75. package/dist/schema/SchemaCollapsedPreview.vue.js.map +1 -1
  76. package/dist/schema/{SchemaCollapsedPreview.vue.script.js → SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js} +1 -1
  77. package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js.map +1 -0
  78. package/dist/schema/SchemaComposition.vue.js +2 -2
  79. package/dist/schema/SchemaComposition.vue.js.map +1 -1
  80. package/dist/schema/{SchemaComposition.vue.script.js → SchemaComposition.vue_vue_type_script_setup_true_lang.js} +5 -5
  81. package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js.map +1 -0
  82. package/dist/schema/SchemaEnumPropertyItem.vue.js +1 -1
  83. package/dist/schema/SchemaEnumPropertyItem.vue.js.map +1 -1
  84. package/dist/schema/{SchemaEnumPropertyItem.vue.script.js → SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js} +5 -5
  85. package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js.map +1 -0
  86. package/dist/schema/SchemaEnums.vue.js +2 -2
  87. package/dist/schema/SchemaEnums.vue.js.map +1 -1
  88. package/dist/schema/{SchemaEnums.vue.script.js → SchemaEnums.vue_vue_type_script_setup_true_lang.js} +1 -1
  89. package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js.map +1 -0
  90. package/dist/schema/SchemaGlyphPuck.vue.js +1 -1
  91. package/dist/schema/SchemaGlyphPuck.vue.js.map +1 -1
  92. package/dist/schema/{SchemaGlyphPuck.vue.script.js → SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js} +1 -1
  93. package/dist/schema/SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js.map +1 -0
  94. package/dist/schema/SchemaGutterToggle.vue.js +1 -1
  95. package/dist/schema/SchemaGutterToggle.vue.js.map +1 -1
  96. package/dist/schema/{SchemaGutterToggle.vue.script.js → SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js} +1 -1
  97. package/dist/schema/SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js.map +1 -0
  98. package/dist/schema/SchemaHeading.vue.js +2 -2
  99. package/dist/schema/SchemaHeading.vue.js.map +1 -1
  100. package/dist/schema/{SchemaHeading.vue.script.js → SchemaHeading.vue_vue_type_script_setup_true_lang.js} +6 -6
  101. package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js.map +1 -0
  102. package/dist/schema/SchemaObjectExampleCodeBlock.vue.js +1 -1
  103. package/dist/schema/SchemaObjectExampleCodeBlock.vue.js.map +1 -1
  104. package/dist/schema/{SchemaObjectExampleCodeBlock.vue.script.js → SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js} +1 -1
  105. package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js.map +1 -0
  106. package/dist/schema/SchemaObjectProperties.vue.js +1 -1
  107. package/dist/schema/SchemaObjectProperties.vue.js.map +1 -1
  108. package/dist/schema/{SchemaObjectProperties.vue.script.js → SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js} +3 -3
  109. package/dist/schema/{SchemaObjectProperties.vue.script.js.map → SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js.map} +1 -1
  110. package/dist/schema/SchemaProperty.vue.js +2 -2
  111. package/dist/schema/SchemaProperty.vue.js.map +1 -1
  112. package/dist/schema/{SchemaProperty.vue.script.js → SchemaProperty.vue_vue_type_script_setup_true_lang.js} +14 -18
  113. package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js.map +1 -0
  114. package/dist/schema/SchemaPropertyDefault.vue.js +2 -2
  115. package/dist/schema/SchemaPropertyDefault.vue.js.map +1 -1
  116. package/dist/schema/{SchemaPropertyDefault.vue.script.js → SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js} +1 -1
  117. package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js.map +1 -0
  118. package/dist/schema/SchemaPropertyDetail.vue.js +2 -2
  119. package/dist/schema/SchemaPropertyDetail.vue.js.map +1 -1
  120. package/dist/schema/{SchemaPropertyDetail.vue.script.js → SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js} +1 -1
  121. package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js.map +1 -0
  122. package/dist/schema/SchemaPropertyExamples.vue.d.ts +2 -0
  123. package/dist/schema/SchemaPropertyExamples.vue.d.ts.map +1 -1
  124. package/dist/schema/SchemaPropertyExamples.vue.js +3 -3
  125. package/dist/schema/SchemaPropertyExamples.vue.js.map +1 -1
  126. package/dist/schema/{SchemaPropertyExamples.vue.script.js → SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js} +10 -3
  127. package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js.map +1 -0
  128. package/dist/schema/SchemaPropertyHeading.vue.js +2 -2
  129. package/dist/schema/SchemaPropertyHeading.vue.js.map +1 -1
  130. package/dist/schema/{SchemaPropertyHeading.vue.script.js → SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js} +1 -1
  131. package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js.map +1 -0
  132. package/dist/schema/SchemaPropertyPattern.vue.js +2 -2
  133. package/dist/schema/SchemaPropertyPattern.vue.js.map +1 -1
  134. package/dist/schema/{SchemaPropertyPattern.vue.script.js → SchemaPropertyPattern.vue_vue_type_script_setup_true_lang.js} +1 -1
  135. package/dist/schema/SchemaPropertyPattern.vue_vue_type_script_setup_true_lang.js.map +1 -0
  136. package/dist/schema/SchemaRailPanel.vue.js +1 -1
  137. package/dist/schema/SchemaRailPanel.vue.js.map +1 -1
  138. package/dist/schema/{SchemaRailPanel.vue.script.js → SchemaRailPanel.vue_vue_type_script_setup_true_lang.js} +1 -1
  139. package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js.map +1 -0
  140. package/dist/schema/components/CopyLinkButton.vue.js +1 -1
  141. package/dist/schema/components/CopyLinkButton.vue.js.map +1 -1
  142. package/dist/schema/components/{CopyLinkButton.vue.script.js → CopyLinkButton.vue_vue_type_script_setup_true_lang.js} +1 -1
  143. package/dist/schema/components/CopyLinkButton.vue_vue_type_script_setup_true_lang.js.map +1 -0
  144. package/dist/schema/components/WithBreadcrumb.vue.js +1 -1
  145. package/dist/schema/components/WithBreadcrumb.vue.js.map +1 -1
  146. package/dist/schema/components/{WithBreadcrumb.vue.script.js → WithBreadcrumb.vue_vue_type_script_setup_true_lang.js} +1 -1
  147. package/dist/schema/components/WithBreadcrumb.vue_vue_type_script_setup_true_lang.js.map +1 -0
  148. package/dist/schema/discriminator-metadata.js.map +1 -1
  149. package/dist/schema/expansion/index.js +1 -2
  150. package/dist/schema/helpers/dynamic-scope.js.map +1 -1
  151. package/dist/schema/helpers/format-example.js.map +1 -1
  152. package/dist/schema/helpers/format-value.js.map +1 -1
  153. package/dist/schema/helpers/get-compositions-to-render.js.map +1 -1
  154. package/dist/schema/helpers/get-discriminator-values.js.map +1 -1
  155. package/dist/schema/helpers/get-enum-values.js.map +1 -1
  156. package/dist/schema/helpers/get-property-description.js.map +1 -1
  157. package/dist/schema/helpers/get-ref-name.js.map +1 -1
  158. package/dist/schema/helpers/get-schema-type.js.map +1 -1
  159. package/dist/schema/helpers/get-type-signature-tokens.js.map +1 -1
  160. package/dist/schema/helpers/has-complex-array-items.js.map +1 -1
  161. package/dist/schema/helpers/is-empty-schema-object.js.map +1 -1
  162. package/dist/schema/helpers/is-model-linkable.js.map +1 -1
  163. package/dist/schema/helpers/is-on-schema-target-path.js.map +1 -1
  164. package/dist/schema/helpers/is-type-object.js.map +1 -1
  165. package/dist/schema/helpers/merge-all-of-schemas.js +24 -25
  166. package/dist/schema/helpers/merge-all-of-schemas.js.map +1 -1
  167. package/dist/schema/helpers/normalize-object-composition.js.map +1 -1
  168. package/dist/schema/helpers/optimize-value-for-display.js +5 -12
  169. package/dist/schema/helpers/optimize-value-for-display.js.map +1 -1
  170. package/dist/schema/helpers/partition-all-of-compositions.js.map +1 -1
  171. package/dist/schema/helpers/schema-composition.js.map +1 -1
  172. package/dist/schema/helpers/schema-cycle.js.map +1 -1
  173. package/dist/schema/helpers/schema-expansion.js +4 -5
  174. package/dist/schema/helpers/schema-expansion.js.map +1 -1
  175. package/dist/schema/helpers/schema-keyboard-nav.js.map +1 -1
  176. package/dist/schema/helpers/schema-name.js.map +1 -1
  177. package/dist/schema/helpers/should-display-description.js.map +1 -1
  178. package/dist/schema/helpers/should-display-heading.js.map +1 -1
  179. package/dist/schema/helpers/should-render-array-item-composition.js.map +1 -1
  180. package/dist/schema/helpers/sort-property-names.js.map +1 -1
  181. package/dist/schema/helpers/unwrap-for-read.js.map +1 -1
  182. package/dist/schema/index.d.ts +1 -0
  183. package/dist/schema/index.d.ts.map +1 -1
  184. package/dist/schema/index.js +6 -5
  185. package/dist/schema/localization/index.d.ts +1 -1
  186. package/dist/schema/localization/index.js.map +1 -1
  187. package/dist/schema/localization/locales/ar.js.map +1 -1
  188. package/dist/schema/localization/locales/de.js.map +1 -1
  189. package/dist/schema/localization/locales/en.js.map +1 -1
  190. package/dist/schema/localization/locales/es.js.map +1 -1
  191. package/dist/schema/localization/locales/fr.js.map +1 -1
  192. package/dist/schema/localization/locales/pt.js.map +1 -1
  193. package/dist/schema/localization/locales/ru.js.map +1 -1
  194. package/dist/schema/localization/locales/zh-cn.js.map +1 -1
  195. package/dist/schema/localization/locales/zh-tw.js.map +1 -1
  196. package/dist/schema/localization/translations.js.map +1 -1
  197. package/dist/schema/request-body-composition-index.js.map +1 -1
  198. package/dist/shared/Badge.vue.js +2 -2
  199. package/dist/shared/Badge.vue.js.map +1 -1
  200. package/dist/shared/{Badge.vue.script.js → Badge.vue_vue_type_script_setup_true_lang.js} +1 -1
  201. package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js.map +1 -0
  202. package/dist/shared/ExternalDocs.vue.js +1 -1
  203. package/dist/shared/ExternalDocs.vue.js.map +1 -1
  204. package/dist/shared/{ExternalDocs.vue.script.js → ExternalDocs.vue_vue_type_script_setup_true_lang.js} +1 -1
  205. package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js.map +1 -0
  206. package/dist/shared/ScreenReader.vue.js +1 -1
  207. package/dist/shared/ScreenReader.vue.js.map +1 -1
  208. package/dist/shared/{ScreenReader.vue.script.js → ScreenReader.vue_vue_type_script_setup_true_lang.js} +1 -1
  209. package/dist/shared/ScreenReader.vue_vue_type_script_setup_true_lang.js.map +1 -0
  210. package/dist/specification-extensions/ExtensionValue.vue.js +1 -1
  211. package/dist/specification-extensions/ExtensionValue.vue.js.map +1 -1
  212. package/dist/specification-extensions/{ExtensionValue.vue.script.js → ExtensionValue.vue_vue_type_script_setup_true_lang.js} +1 -1
  213. package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js.map +1 -0
  214. package/dist/specification-extensions/SpecificationExtensions.vue.js +1 -1
  215. package/dist/specification-extensions/SpecificationExtensions.vue.js.map +1 -1
  216. package/dist/specification-extensions/{SpecificationExtensions.vue.script.js → SpecificationExtensions.vue_vue_type_script_setup_true_lang.js} +1 -1
  217. package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js.map +1 -0
  218. package/dist/specification-extensions/index.js +1 -2
  219. package/dist/style.css +76 -31
  220. package/dist/vue-styles.css +1 -1
  221. package/package.json +23 -23
  222. package/dist/code-example/components/CodeExample.vue.script.js +0 -258
  223. package/dist/code-example/components/CodeExample.vue.script.js.map +0 -1
  224. package/dist/code-example/components/ExamplePicker.vue.script.js.map +0 -1
  225. package/dist/code-example/components/HttpMethod.vue.script.js.map +0 -1
  226. package/dist/schema/RenderString.vue.script.js.map +0 -1
  227. package/dist/schema/Schema.vue.script.js.map +0 -1
  228. package/dist/schema/SchemaCollapsedPreview.vue.script.js.map +0 -1
  229. package/dist/schema/SchemaComposition.vue.script.js.map +0 -1
  230. package/dist/schema/SchemaEnumPropertyItem.vue.script.js.map +0 -1
  231. package/dist/schema/SchemaEnums.vue.script.js.map +0 -1
  232. package/dist/schema/SchemaGlyphPuck.vue.script.js.map +0 -1
  233. package/dist/schema/SchemaGutterToggle.vue.script.js.map +0 -1
  234. package/dist/schema/SchemaHeading.vue.script.js.map +0 -1
  235. package/dist/schema/SchemaObjectExampleCodeBlock.vue.script.js.map +0 -1
  236. package/dist/schema/SchemaProperty.vue.script.js.map +0 -1
  237. package/dist/schema/SchemaPropertyDefault.vue.script.js.map +0 -1
  238. package/dist/schema/SchemaPropertyDetail.vue.script.js.map +0 -1
  239. package/dist/schema/SchemaPropertyExamples.vue.script.js.map +0 -1
  240. package/dist/schema/SchemaPropertyHeading.vue.script.js.map +0 -1
  241. package/dist/schema/SchemaPropertyPattern.vue.script.js.map +0 -1
  242. package/dist/schema/SchemaRailPanel.vue.script.js.map +0 -1
  243. package/dist/schema/components/CopyLinkButton.vue.script.js.map +0 -1
  244. package/dist/schema/components/WithBreadcrumb.vue.script.js.map +0 -1
  245. package/dist/shared/Badge.vue.script.js.map +0 -1
  246. package/dist/shared/ExternalDocs.vue.script.js.map +0 -1
  247. package/dist/shared/ScreenReader.vue.script.js.map +0 -1
  248. package/dist/specification-extensions/ExtensionValue.vue.script.js.map +0 -1
  249. package/dist/specification-extensions/SpecificationExtensions.vue.script.js.map +0 -1
@@ -1,14 +1,17 @@
1
- import { filterClientsByQuery as e } from "./helpers/filter-clients-by-query.js";
2
- import { DEFAULT_CLIENT as t, findClient as n, isClient as r, isSelectedClient as i } from "./helpers/find-client.js";
3
- import { generateClientOptions as a, getCustomClientIds as o } from "./helpers/generate-client-options.js";
4
- import { operationToHar as s } from "./helpers/operation-to-har/operation-to-har.js";
5
- import { generateCodeSnippet as c } from "./helpers/generate-code-snippet.js";
6
- import { getCustomCodeSamples as l } from "./helpers/get-custom-code-samples.js";
7
- import { getClients as u } from "./helpers/get-clients.js";
8
- import { getSecrets as d } from "./helpers/get-secrets.js";
9
- import f from "./components/ExamplePicker.vue.js";
10
- import p from "./components/HttpMethod.vue.js";
11
- import m from "./components/CodeExample.vue.js";
12
- import { createCodeExample as h } from "./mount.js";
13
- import { getResolvedRefDeep as g } from "@scalar/workspace-store/helpers/get-resolved-ref-deep";
14
- export { m as CodeExample, t as DEFAULT_CLIENT, f as ExamplePicker, p as HttpMethod, h as createCodeExample, e as filterClientsByQuery, n as findClient, a as generateClientOptions, c as generateCodeSnippet, u as getClients, o as getCustomClientIds, l as getCustomCodeSamples, g as getResolvedRefDeep, d as getSecrets, r as isClient, i as isSelectedClient, s as operationToHar };
1
+ import { getGeneratedPayloadExample as e } from "./helpers/get-generated-payload-example.js";
2
+ import { getMessageExampleContent as t } from "./helpers/get-message-example-content.js";
3
+ import n from "./components/ExamplePicker.vue.js";
4
+ import r from "./components/AsyncApiCodeExample.vue.js";
5
+ import { filterClientsByQuery as i } from "./helpers/filter-clients-by-query.js";
6
+ import { DEFAULT_CLIENT as a, findClient as o, isClient as s, isSelectedClient as c } from "./helpers/find-client.js";
7
+ import { generateClientOptions as l, getCustomClientIds as u } from "./helpers/generate-client-options.js";
8
+ import { operationToHar as d } from "./helpers/operation-to-har/operation-to-har.js";
9
+ import { generateCodeSnippet as f } from "./helpers/generate-code-snippet.js";
10
+ import { getCustomCodeSamples as p } from "./helpers/get-custom-code-samples.js";
11
+ import { getClients as m } from "./helpers/get-clients.js";
12
+ import { getSecrets as h } from "./helpers/get-secrets.js";
13
+ import g from "./components/HttpMethod.vue.js";
14
+ import _ from "./components/CodeExample.vue.js";
15
+ import { createCodeExample as v } from "./mount.js";
16
+ import { getResolvedRefDeep as y } from "@scalar/workspace-store/helpers/get-resolved-ref-deep";
17
+ export { r as AsyncApiCodeExample, _ as CodeExample, a as DEFAULT_CLIENT, n as ExamplePicker, g as HttpMethod, v as createCodeExample, i as filterClientsByQuery, o as findClient, l as generateClientOptions, f as generateCodeSnippet, m as getClients, u as getCustomClientIds, p as getCustomCodeSamples, e as getGeneratedPayloadExample, t as getMessageExampleContent, y as getResolvedRefDeep, h as getSecrets, s as isClient, c as isSelectedClient, d as operationToHar };
@@ -0,0 +1,14 @@
1
+ import type { WorkspaceStore } from '@scalar/workspace-store/client';
2
+ import { type App } from 'vue';
3
+ /** Mount an operation-level AsyncAPI code example from the active workspace document. */
4
+ export type CreateAsyncApiCodeExampleOptions = {
5
+ store: WorkspaceStore;
6
+ operationName: string;
7
+ darkMode?: boolean;
8
+ };
9
+ /** AsyncAPI branch of createCodeExample; no HTTP path or method is required. */
10
+ export declare const createAsyncApiCodeExample: (el: HTMLElement | string, options: CreateAsyncApiCodeExampleOptions) => {
11
+ app: App;
12
+ destroy: () => void;
13
+ };
14
+ //# sourceMappingURL=mount-asyncapi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mount-asyncapi.d.ts","sourceRoot":"","sources":["../../src/code-example/mount-asyncapi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAEpE,OAAO,EAAE,KAAK,GAAG,EAAgB,MAAM,KAAK,CAAA;AAK5C,yFAAyF;AACzF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,KAAK,EAAE,cAAc,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,gFAAgF;AAChF,eAAO,MAAM,yBAAyB,GACpC,IAAI,WAAW,GAAG,MAAM,EACxB,SAAS,gCAAgC,KACxC;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CA6BjC,CAAA"}
@@ -0,0 +1,27 @@
1
+ import { getAsyncApiExampleContext as e } from "./helpers/get-asyncapi-example-context.js";
2
+ import t from "./components/AsyncApiCodeExample.vue.js";
3
+ import { createApp as n, h as r } from "vue";
4
+ import { ScalarTeleportRoot as i } from "@scalar/components/teleport";
5
+ import { isAsyncApiDocument as a } from "@scalar/workspace-store/schemas/type-guards";
6
+ //#region src/code-example/mount-asyncapi.ts
7
+ var o = (o, s) => {
8
+ let c = typeof o == "string" ? document.querySelector(o) : o;
9
+ if (!c) throw Error(`Element not found: ${o}`);
10
+ let l = s.store.workspace.activeDocument;
11
+ if (!a(l) || !e(l, s.operationName)) throw Error(`AsyncAPI operation not found: ${s.operationName}`);
12
+ let u = n(() => {
13
+ let e = s.store.workspace.activeDocument;
14
+ return r("div", { class: ["scalar-app", s.darkMode === !0 ? "dark-mode" : s.darkMode === !1 ? "light-mode" : ""] }, [r(i, null, { default: () => a(e) ? r(t, {
15
+ document: e,
16
+ operationName: s.operationName
17
+ }) : r("p", { role: "status" }, "No AsyncAPI document selected.") })]);
18
+ });
19
+ return u.mount(c), {
20
+ app: u,
21
+ destroy: () => u.unmount()
22
+ };
23
+ };
24
+ //#endregion
25
+ export { o as createAsyncApiCodeExample };
26
+
27
+ //# sourceMappingURL=mount-asyncapi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mount-asyncapi.js","names":["AsyncApiCodeExample","AsyncApiCodeExample_default","createAsyncApiCodeExample","element","el","initialDocument","options","isAsyncApiDocument","getAsyncApiExampleContext","app","createApp","activeDocument","h","ScalarTeleportRoot"],"sources":["../../src/code-example/mount-asyncapi.ts"],"sourcesContent":["import { ScalarTeleportRoot } from '@scalar/components/teleport'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport { isAsyncApiDocument } from '@scalar/workspace-store/schemas/type-guards'\nimport { type App, createApp, h } from 'vue'\n\nimport AsyncApiCodeExample from './components/AsyncApiCodeExample.vue'\nimport { getAsyncApiExampleContext } from './helpers/get-asyncapi-example-context'\n\n/** Mount an operation-level AsyncAPI code example from the active workspace document. */\nexport type CreateAsyncApiCodeExampleOptions = {\n store: WorkspaceStore\n operationName: string\n darkMode?: boolean\n}\n\n/** AsyncAPI branch of createCodeExample; no HTTP path or method is required. */\nexport const createAsyncApiCodeExample = (\n el: HTMLElement | string,\n options: CreateAsyncApiCodeExampleOptions,\n): { app: App; destroy: () => void } => {\n const element = typeof el === 'string' ? document.querySelector(el) : el\n if (!element) throw new Error(`Element not found: ${el}`)\n const initialDocument = options.store.workspace.activeDocument\n if (!isAsyncApiDocument(initialDocument) || !getAsyncApiExampleContext(initialDocument, options.operationName)) {\n throw new Error(`AsyncAPI operation not found: ${options.operationName}`)\n }\n const app = createApp(() => {\n const activeDocument = options.store.workspace.activeDocument\n return h(\n 'div',\n {\n class: ['scalar-app', options.darkMode === true ? 'dark-mode' : options.darkMode === false ? 'light-mode' : ''],\n },\n [\n h(ScalarTeleportRoot, null, {\n default: () =>\n isAsyncApiDocument(activeDocument)\n ? h(AsyncApiCodeExample, {\n document: activeDocument,\n operationName: options.operationName,\n })\n : h('p', { role: 'status' }, 'No AsyncAPI document selected.'),\n }),\n ],\n )\n })\n app.mount(element)\n return { app, destroy: () => app.unmount() }\n}\n"],"mappings":";;;;;;AAgBA,IAAaE,KACX,GACA,MACsC;CACtC,IAAMC,IAAU,OAAOC,KAAO,WAAW,SAAS,cAAcA,CAAE,IAAIA;CACtE,IAAI,CAACD,GAAS,MAAU,MAAM,sBAAsBC,GAAI;CACxD,IAAMC,IAAkBC,EAAQ,MAAM,UAAU;CAChD,IAAI,CAACC,EAAmBF,CAAe,KAAK,CAACG,EAA0BH,GAAiBC,EAAQ,aAAa,GAC3G,MAAU,MAAM,iCAAiCA,EAAQ,eAAe;CAE1E,IAAMG,IAAMC,QAAgB;EAC1B,IAAMC,IAAiBL,EAAQ,MAAM,UAAU;EAC/C,OAAOM,EACL,OACA,EACE,OAAO,CAAC,cAAcN,EAAQ,aAAa,KAAO,cAAcA,EAAQ,aAAa,KAAQ,eAAe,EAAE,EAChH,GACA,CACEM,EAAEC,GAAoB,MAAM,EAC1B,eACEN,EAAmBI,CAAc,IAC7BC,EAAEZ,GAAqB;GACrB,UAAUW;GACV,eAAeL,EAAQ;EACzB,CAAC,IACDM,EAAE,KAAK,EAAE,MAAM,SAAS,GAAG,gCAAgC,EACnE,CAAC,CACH,CACF;CACF,CAAC;CAED,OADAH,EAAI,MAAMN,CAAO,GACV;EAAE;EAAK,eAAeM,EAAI,QAAQ;CAAE;AAC7C"}
@@ -2,6 +2,8 @@ import type { AvailableClients } from '@scalar/snippetz';
2
2
  import type { WorkspaceStore } from '@scalar/workspace-store/client';
3
3
  import type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example';
4
4
  import type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
5
+ import { type App } from 'vue';
6
+ import { type CreateAsyncApiCodeExampleOptions } from './mount-asyncapi';
5
7
  export type CreateCodeExampleOptions = {
6
8
  /** Localized status text shown when the selected example has no linked code sample. */
7
9
  codeSampleUnavailable?: string;
@@ -47,8 +49,8 @@ export type CreateCodeExampleOptions = {
47
49
  * The consumer creates and controls their own workspace store,
48
50
  * then passes it in along with the path and method to render.
49
51
  */
50
- export declare const createCodeExample: (el: HTMLElement | string, options: CreateCodeExampleOptions) => {
51
- app: import("vue").App<Element>;
52
+ export declare const createCodeExample: (el: HTMLElement | string, options: CreateCodeExampleOptions | CreateAsyncApiCodeExampleOptions) => {
53
+ app: App;
52
54
  destroy: () => void;
53
55
  };
54
56
  //# sourceMappingURL=mount.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/code-example/mount.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAOpE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAA;AACzF,OAAO,KAAK,EAAmB,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAMjH,MAAM,MAAM,wBAAwB,GAAG;IACrC,uFAAuF;IACvF,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,wEAAwE;IACxE,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,yEAAyE;IACzE,KAAK,EAAE,cAAc,CAAA;IACrB,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAA;IACZ,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAA;IACd,iDAAiD;IACjD,cAAc,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACzC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IACpC;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,oDAAoD;IACpD,eAAe,CAAC,EAAE,0BAA0B,EAAE,CAAA;IAC9C;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAkBD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,IAAI,WAAW,GAAG,MAAM,EAAE,SAAS,wBAAwB;;;C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 +1,72 @@
1
1
  import { generateClientOptions as e } from "./helpers/generate-client-options.js";
2
2
  import t from "./components/CodeExample.vue.js";
3
- import { createApp as n, h as r, reactive as i } from "vue";
4
- import { createWorkspaceEventBus as a } from "@scalar/workspace-store/events";
5
- import { getResolvedRef as o } from "@scalar/workspace-store/helpers/get-resolved-ref";
6
- import { EXTERNAL_EXAMPLES as s } from "@scalar/workspace-store/helpers/use-external-examples";
7
- import { ScalarTeleportRoot as c } from "@scalar/components/teleport";
8
- import { getPathItemOperation as l } from "@scalar/workspace-store/helpers/for-each-path-item-operation";
9
- import { getFirstServer as u } from "@scalar/workspace-store/helpers/get-first-server";
10
- import { generateClientMutators as d } from "@scalar/workspace-store/mutators";
3
+ import { createAsyncApiCodeExample as n } from "./mount-asyncapi.js";
4
+ import { createApp as r, h as i, reactive as a } from "vue";
5
+ import { ScalarWrappingText as o } from "@scalar/components/wrapping-text";
6
+ import { createWorkspaceEventBus as s } from "@scalar/workspace-store/events";
7
+ import { getResolvedRef as c } from "@scalar/workspace-store/helpers/get-resolved-ref";
8
+ import { EXTERNAL_EXAMPLES as l } from "@scalar/workspace-store/helpers/use-external-examples";
9
+ import { ScalarTeleportRoot as u } from "@scalar/components/teleport";
10
+ import { getPathItemOperation as d } from "@scalar/workspace-store/helpers/for-each-path-item-operation";
11
+ import { getFirstServer as f } from "@scalar/workspace-store/helpers/get-first-server";
12
+ import { generateClientMutators as p } from "@scalar/workspace-store/mutators";
11
13
  //#region src/code-example/mount.ts
12
- var f = (e) => e === !0 ? "scalar-app dark-mode" : e === !1 ? "scalar-app light-mode" : "scalar-app", p = (p, m) => {
13
- let h = typeof p == "string" ? document.querySelector(p) : p;
14
- if (!h) throw Error(`Element not found: ${p}`);
15
- let g = a(), _ = e(), v = d(m.store), y = g.on("workspace:update:selected-client", (e) => v.workspace().workspace.updateSelectedClient(e)), b = g.on("workspace:update:selected-example", (e) => v.workspace().workspace.updateSelectedExample(e)), x = () => {
16
- let e = m.store.workspace.activeDocument;
14
+ var m = (e) => e === !0 ? "scalar-app dark-mode" : e === !1 ? "scalar-app light-mode" : "scalar-app", h = (h, g) => {
15
+ if ("operationName" in g) return n(h, g);
16
+ let _ = typeof h == "string" ? document.querySelector(h) : h;
17
+ if (!_) throw Error(`Element not found: ${h}`);
18
+ let v = s(), y = e(), b = p(g.store), x = v.on("workspace:update:selected-client", (e) => b.workspace().workspace.updateSelectedClient(e)), S = v.on("workspace:update:selected-example", (e) => b.workspace().workspace.updateSelectedExample(e)), C = () => {
19
+ let e = g.store.workspace.activeDocument;
17
20
  if (!e || !("paths" in e)) return;
18
- let t = o(e.paths?.[m.path]), n = o(l(t, m.method));
21
+ let t = c(e.paths?.[g.path]), n = c(d(t, g.method));
19
22
  if (n) return {
20
23
  operation: n,
21
- server: u(n.servers ?? null, t?.servers ?? null, e.servers ?? null)
24
+ server: f(n.servers ?? null, t?.servers ?? null, e.servers ?? null)
22
25
  };
23
26
  };
24
- if (!x()) throw Error(`Operation not found: ${m.method.toUpperCase()} ${m.path}`);
25
- let S, C = () => {
26
- let e = x();
27
- return e && (S = e), e ?? S;
28
- }, w = i({
27
+ if (!C()) throw Error(`Operation not found: ${g.method.toUpperCase()} ${g.path}`);
28
+ let w, T = () => {
29
+ let e = C();
30
+ return e && (w = e), e ?? w;
31
+ }, E = a({
29
32
  get codeSampleUnavailable() {
30
- return m.codeSampleUnavailable;
33
+ return g.codeSampleUnavailable;
31
34
  },
32
35
  get codeSampleLabel() {
33
- return m.codeSampleLabel;
36
+ return g.codeSampleLabel;
34
37
  },
35
38
  get operation() {
36
- return C().operation;
39
+ return T().operation;
37
40
  },
38
41
  get method() {
39
- return m.method;
42
+ return g.method;
40
43
  },
41
44
  get path() {
42
- return m.path;
45
+ return g.path;
43
46
  },
44
- clientOptions: _,
45
- eventBus: g,
47
+ clientOptions: y,
48
+ eventBus: v,
46
49
  get securitySchemes() {
47
- return m.securitySchemes ?? [];
50
+ return g.securitySchemes ?? [];
48
51
  },
49
52
  get selectedClient() {
50
- return m.store.workspace["x-scalar-default-client"] ?? m.selectedClient;
53
+ return g.store.workspace["x-scalar-default-client"] ?? g.selectedClient;
51
54
  },
52
55
  get selectedExample() {
53
- return m.store.workspace["x-scalar-default-example"] ?? m.selectedExample;
56
+ return g.store.workspace["x-scalar-default-example"] ?? g.selectedExample;
54
57
  },
55
58
  get selectedServer() {
56
- return m.selectedServer === void 0 ? C().server : m.selectedServer;
59
+ return g.selectedServer === void 0 ? T().server : g.selectedServer;
57
60
  }
58
- }), T = () => r("span", { class: "font-code text-c-2 min-w-0 truncate" }, m.path), E = n(() => r("div", { class: f(m.darkMode) }, [r(c, null, { default: () => r(t, w, { header: T }) })]));
59
- return E.provide(s, () => m.store.externalExamples()), E.mount(h), {
60
- app: E,
61
+ }), D = () => i("span", { class: "font-code text-c-2 min-w-0" }, i(o, { text: g.path })), O = r(() => i("div", { class: m(g.darkMode) }, [i(u, null, { default: () => i(t, E, { header: D }) })]));
62
+ return O.provide(l, () => g.store.externalExamples()), O.mount(_), {
63
+ app: O,
61
64
  destroy: () => {
62
- y(), b(), E.unmount();
65
+ x(), S(), O.unmount();
63
66
  }
64
67
  };
65
68
  };
66
69
  //#endregion
67
- export { p as createCodeExample };
70
+ export { h as createCodeExample };
68
71
 
69
72
  //# sourceMappingURL=mount.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mount.js","names":[],"sources":["../../src/code-example/mount.ts"],"sourcesContent":["import { ScalarTeleportRoot } from '@scalar/components/teleport'\nimport type { AvailableClients } from '@scalar/snippetz'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport { createWorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getPathItemOperation } from '@scalar/workspace-store/helpers/for-each-path-item-operation'\nimport { getFirstServer } from '@scalar/workspace-store/helpers/get-first-server'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { EXTERNAL_EXAMPLES } from '@scalar/workspace-store/helpers/use-external-examples'\nimport { generateClientMutators } from '@scalar/workspace-store/mutators'\nimport type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example'\nimport type { OperationObject, ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { createApp, h, reactive } from 'vue'\n\nimport CodeExample, { type CodeExampleProps } from './components/CodeExample.vue'\nimport { generateClientOptions } from './helpers/generate-client-options'\n\nexport type CreateCodeExampleOptions = {\n /** Localized status text shown when the selected example has no linked code sample. */\n codeSampleUnavailable?: string\n /** Localized accessible name for the focusable code sample scroller. */\n codeSampleLabel?: string\n /** Workspace store that holds the OpenAPI document(s) to render from. */\n store: WorkspaceStore\n /** Path of the operation to render, e.g. '/users/{id}'. */\n path: string\n /** HTTP method of the operation to render. */\n method: string\n /** Pre-selected client ID, e.g. 'shell/curl'. */\n selectedClient?: AvailableClients[number]\n /**\n * Server object override used to build the example request.\n *\n * When omitted, the server is derived from the active document (operation,\n * then path item, then document level), mirroring the API reference. Pass\n * `null` to force \"no server\".\n */\n selectedServer?: ServerObject | null\n /**\n * Pre-selected example key for parameters and the request body.\n *\n * The store is the source of truth once an example is picked, so\n * `x-scalar-default-example` wins over this initial seed and the selection\n * round-trips through the store like the client selection does.\n */\n selectedExample?: string\n /** Security schemes applicable to the operation. */\n securitySchemes?: SecuritySchemeObjectSecret[]\n /**\n * Force a color mode on the rendered block.\n *\n * When omitted, the block inherits the ambient theme of the host page.\n * Pass `true` for dark mode or `false` for light mode.\n */\n darkMode?: boolean\n}\n\n/**\n * Builds the wrapper classes for the mounted block.\n *\n * The `.scalar-app` class scopes the Tailwind utilities, and the optional\n * color-mode class lets consumers pin the block to dark or light.\n */\nconst getWrapperClass = (darkMode: boolean | undefined): string => {\n if (darkMode === true) {\n return 'scalar-app dark-mode'\n }\n if (darkMode === false) {\n return 'scalar-app light-mode'\n }\n return 'scalar-app'\n}\n\n/**\n * Mount the CodeExample block to a DOM element without Vue.\n *\n * The consumer creates and controls their own workspace store,\n * then passes it in along with the path and method to render.\n */\nexport const createCodeExample = (el: HTMLElement | string, options: CreateCodeExampleOptions) => {\n const element = typeof el === 'string' ? document.querySelector(el) : el\n if (!element) {\n throw new Error(`Element not found: ${el}`)\n }\n\n const eventBus = createWorkspaceEventBus()\n const clientOptions = generateClientOptions()\n\n // Persist client changes back to the store. The block emits\n // `workspace:update:selected-client` on its private bus when the user picks a\n // client; without this subscription the choice would never reach the store\n // and `x-scalar-default-client` (the source of truth read below) would stay\n // stale, so the selection would not survive a re-render or be shared with\n // other blocks reading from the same store.\n const mutators = generateClientMutators(options.store)\n const unsubscribeClient = eventBus.on('workspace:update:selected-client', (payload) =>\n mutators.workspace().workspace.updateSelectedClient(payload),\n )\n\n // Persist example changes back to the store as well, mirroring the client\n // round-trip above. The block emits `workspace:update:selected-example` when\n // the user picks an example; without this the choice would never reach\n // `x-scalar-default-example` (read below) and would neither survive a\n // re-render nor sync to other blocks reading from the same store.\n const unsubscribeExample = eventBus.on('workspace:update:selected-example', (payload) =>\n mutators.workspace().workspace.updateSelectedExample(payload),\n )\n\n type OperationContext = { operation: OperationObject; server: ServerObject | null }\n\n /**\n * Resolve the operation and its effective server from the active document.\n *\n * The server is resolved from the same document the operation came from\n * (operation, then path item, then document level), so a snippet never pairs\n * an operation with a server URL from a different spec.\n */\n const resolveContext = (): OperationContext | undefined => {\n // The active document may be an AsyncAPI document, which has no `paths`.\n const activeDocument = options.store.workspace.activeDocument\n if (!activeDocument || !('paths' in activeDocument)) {\n return undefined\n }\n const pathItem = getResolvedRef(activeDocument.paths?.[options.path])\n const operation = getResolvedRef(getPathItemOperation(pathItem, options.method))\n if (!operation) {\n return undefined\n }\n const server = getFirstServer(operation.servers ?? null, pathItem?.servers ?? null, activeDocument.servers ?? null)\n return { operation, server }\n }\n\n // Fail loudly if the path and method do not point at an operation in the store,\n // mirroring the \"element not found\" guard above.\n if (!resolveContext()) {\n throw new Error(`Operation not found: ${options.method.toUpperCase()} ${options.path}`)\n }\n\n // Remember the last context that resolved so a transient miss (e.g. the active\n // document is swapped to one without this path or method after mount) keeps\n // rendering the previous operation, paired with the server it actually came\n // from, instead of feeding `undefined` to the block.\n let lastContext: OperationContext | undefined\n\n /** Current operation + server, falling back to the last good resolution on a transient miss. */\n const currentContext = (): OperationContext => {\n const context = resolveContext()\n if (context) {\n lastContext = context\n }\n return (context ?? lastContext) as OperationContext\n }\n\n // Props are getters so the block tracks the reactive store (active document,\n // `x-scalar-default-client`, `x-scalar-default-example`) live. Change the\n // client, example, or server through the store to drive re-renders.\n const props = reactive<CodeExampleProps>({\n get codeSampleUnavailable() {\n return options.codeSampleUnavailable\n },\n get codeSampleLabel() {\n return options.codeSampleLabel\n },\n get operation(): OperationObject {\n return currentContext().operation\n },\n get method() {\n return options.method\n },\n get path() {\n return options.path\n },\n clientOptions,\n eventBus,\n get securitySchemes() {\n return options.securitySchemes ?? []\n },\n get selectedClient() {\n // The store is the source of truth once the user picks a client, so it\n // wins over the initial `options.selectedClient` seed and the selection\n // round-trips through the subscription above.\n return options.store.workspace['x-scalar-default-client'] ?? options.selectedClient\n },\n get selectedExample() {\n // Same as the client: the store wins over the initial seed so the example\n // selection survives re-renders and syncs across blocks.\n return options.store.workspace['x-scalar-default-example'] ?? options.selectedExample\n },\n get selectedServer() {\n // An explicit option wins (including an explicit `null` for \"no server\");\n // otherwise derive it from the same document the operation resolved from.\n return options.selectedServer !== undefined ? options.selectedServer : currentContext().server\n },\n })\n\n // Render the operation path in the header by default. The reference renders\n // this via the `#header` slot too, so the standalone block matches its look.\n const renderHeader = () => h('span', { class: 'font-code text-c-2 min-w-0 truncate' }, options.path)\n\n // Wrap the block in its own teleport root so floating UI (the client picker\n // popover) renders inside the themed `.scalar-app` wrapper instead of escaping\n // to `body`, where it would miss the color-mode variables and lose its styling.\n const app = createApp(() =>\n h('div', { class: getWrapperClass(options.darkMode) }, [\n h(ScalarTeleportRoot, null, { default: () => h(CodeExample, props, { header: renderHeader }) }),\n ]),\n )\n\n app.provide(EXTERNAL_EXAMPLES, () => options.store.externalExamples())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1B;EACA,IAAI,SAAS;GACX,OAAO,EAAQ;EACjB;EACA,IAAI,OAAO;GACT,OAAO,EAAQ;EACjB;EACA;EACA;EACA,IAAI,kBAAkB;GACpB,OAAO,EAAQ,mBAAmB,CAAC;EACrC;EACA,IAAI,iBAAiB;GAInB,OAAO,EAAQ,MAAM,UAAU,8BAA8B,EAAQ;EACvE;EACA,IAAI,kBAAkB;GAGpB,OAAO,EAAQ,MAAM,UAAU,+BAA+B,EAAQ;EACxE;EACA,IAAI,iBAAiB;GAGnB,OAAO,EAAQ,mBAAmB,KAAA,IAAqC,EAAe,CAAC,CAAC,SAA1C,EAAQ;EACxD;CACF,CAAC,GAIK,UAAqB,EAAE,QAAQ,EAAE,OAAO,sCAAsC,GAAG,EAAQ,IAAI,GAK7F,IAAM,QACV,EAAE,OAAO,EAAE,OAAO,EAAgB,EAAQ,QAAQ,EAAE,GAAG,CACrD,EAAE,GAAoB,MAAM,EAAE,eAAe,EAAE,GAAa,GAAO,EAAE,QAAQ,EAAa,CAAC,EAAE,CAAC,CAChG,CAAC,CACH;CAKA,OAHA,EAAI,QAAQ,SAAyB,EAAQ,MAAM,iBAAiB,CAAC,GACrE,EAAI,MAAM,CAAO,GAEV;EACL;EACA,eAAe;GAGb,AAFA,EAAkB,GAClB,EAAmB,GACnB,EAAI,QAAQ;EACd;CACF;AACF"}
1
+ {"version":3,"file":"mount.js","names":["CodeExample","CodeExample_default","getWrapperClass","darkMode","createCodeExample","options","createAsyncApiCodeExample","el","element","eventBus","createWorkspaceEventBus","clientOptions","generateClientOptions","mutators","generateClientMutators","unsubscribeClient","payload","unsubscribeExample","resolveContext","activeDocument","pathItem","getResolvedRef","operation","getPathItemOperation","getFirstServer","lastContext","currentContext","context","props","reactive","renderHeader","h","ScalarWrappingText","app","createApp","ScalarTeleportRoot","EXTERNAL_EXAMPLES"],"sources":["../../src/code-example/mount.ts"],"sourcesContent":["import { ScalarTeleportRoot } from '@scalar/components/teleport'\nimport { ScalarWrappingText } from '@scalar/components/wrapping-text'\nimport type { AvailableClients } from '@scalar/snippetz'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport { createWorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getPathItemOperation } from '@scalar/workspace-store/helpers/for-each-path-item-operation'\nimport { getFirstServer } from '@scalar/workspace-store/helpers/get-first-server'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { EXTERNAL_EXAMPLES } from '@scalar/workspace-store/helpers/use-external-examples'\nimport { generateClientMutators } from '@scalar/workspace-store/mutators'\nimport type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example'\nimport type { OperationObject, ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { type App, createApp, h, reactive } from 'vue'\n\nimport CodeExample, { type CodeExampleProps } from './components/CodeExample.vue'\nimport { generateClientOptions } from './helpers/generate-client-options'\nimport { type CreateAsyncApiCodeExampleOptions, createAsyncApiCodeExample } from './mount-asyncapi'\n\nexport type CreateCodeExampleOptions = {\n /** Localized status text shown when the selected example has no linked code sample. */\n codeSampleUnavailable?: string\n /** Localized accessible name for the focusable code sample scroller. */\n codeSampleLabel?: string\n /** Workspace store that holds the OpenAPI document(s) to render from. */\n store: WorkspaceStore\n /** Path of the operation to render, e.g. '/users/{id}'. */\n path: string\n /** HTTP method of the operation to render. */\n method: string\n /** Pre-selected client ID, e.g. 'shell/curl'. */\n selectedClient?: AvailableClients[number]\n /**\n * Server object override used to build the example request.\n *\n * When omitted, the server is derived from the active document (operation,\n * then path item, then document level), mirroring the API reference. Pass\n * `null` to force \"no server\".\n */\n selectedServer?: ServerObject | null\n /**\n * Pre-selected example key for parameters and the request body.\n *\n * The store is the source of truth once an example is picked, so\n * `x-scalar-default-example` wins over this initial seed and the selection\n * round-trips through the store like the client selection does.\n */\n selectedExample?: string\n /** Security schemes applicable to the operation. */\n securitySchemes?: SecuritySchemeObjectSecret[]\n /**\n * Force a color mode on the rendered block.\n *\n * When omitted, the block inherits the ambient theme of the host page.\n * Pass `true` for dark mode or `false` for light mode.\n */\n darkMode?: boolean\n}\n\n/**\n * Builds the wrapper classes for the mounted block.\n *\n * The `.scalar-app` class scopes the Tailwind utilities, and the optional\n * color-mode class lets consumers pin the block to dark or light.\n */\nconst getWrapperClass = (darkMode: boolean | undefined): string => {\n if (darkMode === true) {\n return 'scalar-app dark-mode'\n }\n if (darkMode === false) {\n return 'scalar-app light-mode'\n }\n return 'scalar-app'\n}\n\n/**\n * Mount the CodeExample block to a DOM element without Vue.\n *\n * The consumer creates and controls their own workspace store,\n * then passes it in along with the path and method to render.\n */\nexport const createCodeExample = (\n el: HTMLElement | string,\n options: CreateCodeExampleOptions | CreateAsyncApiCodeExampleOptions,\n): { app: App; destroy: () => void } => {\n if ('operationName' in options) return createAsyncApiCodeExample(el, options)\n\n const element = typeof el === 'string' ? document.querySelector(el) : el\n if (!element) {\n throw new Error(`Element not found: ${el}`)\n }\n\n const eventBus = createWorkspaceEventBus()\n const clientOptions = generateClientOptions()\n\n // Persist client changes back to the store. The block emits\n // `workspace:update:selected-client` on its private bus when the user picks a\n // client; without this subscription the choice would never reach the store\n // and `x-scalar-default-client` (the source of truth read below) would stay\n // stale, so the selection would not survive a re-render or be shared with\n // other blocks reading from the same store.\n const mutators = generateClientMutators(options.store)\n const unsubscribeClient = eventBus.on('workspace:update:selected-client', (payload) =>\n mutators.workspace().workspace.updateSelectedClient(payload),\n )\n\n // Persist example changes back to the store as well, mirroring the client\n // round-trip above. The block emits `workspace:update:selected-example` when\n // the user picks an example; without this the choice would never reach\n // `x-scalar-default-example` (read below) and would neither survive a\n // re-render nor sync to other blocks reading from the same store.\n const unsubscribeExample = eventBus.on('workspace:update:selected-example', (payload) =>\n mutators.workspace().workspace.updateSelectedExample(payload),\n )\n\n type OperationContext = { operation: OperationObject; server: ServerObject | null }\n\n /**\n * Resolve the operation and its effective server from the active document.\n *\n * The server is resolved from the same document the operation came from\n * (operation, then path item, then document level), so a snippet never pairs\n * an operation with a server URL from a different spec.\n */\n const resolveContext = (): OperationContext | undefined => {\n // The active document may be an AsyncAPI document, which has no `paths`.\n const activeDocument = options.store.workspace.activeDocument\n if (!activeDocument || !('paths' in activeDocument)) {\n return undefined\n }\n const pathItem = getResolvedRef(activeDocument.paths?.[options.path])\n const operation = getResolvedRef(getPathItemOperation(pathItem, options.method))\n if (!operation) {\n return undefined\n }\n const server = getFirstServer(operation.servers ?? null, pathItem?.servers ?? null, activeDocument.servers ?? null)\n return { operation, server }\n }\n\n // Fail loudly if the path and method do not point at an operation in the store,\n // mirroring the \"element not found\" guard above.\n if (!resolveContext()) {\n throw new Error(`Operation not found: ${options.method.toUpperCase()} ${options.path}`)\n }\n\n // Remember the last context that resolved so a transient miss (e.g. the active\n // document is swapped to one without this path or method after mount) keeps\n // rendering the previous operation, paired with the server it actually came\n // from, instead of feeding `undefined` to the block.\n let lastContext: OperationContext | undefined\n\n /** Current operation + server, falling back to the last good resolution on a transient miss. */\n const currentContext = (): OperationContext => {\n const context = resolveContext()\n if (context) {\n lastContext = context\n }\n return (context ?? lastContext) as OperationContext\n }\n\n // Props are getters so the block tracks the reactive store (active document,\n // `x-scalar-default-client`, `x-scalar-default-example`) live. Change the\n // client, example, or server through the store to drive re-renders.\n const props = reactive<CodeExampleProps>({\n get codeSampleUnavailable() {\n return options.codeSampleUnavailable\n },\n get codeSampleLabel() {\n return options.codeSampleLabel\n },\n get operation(): OperationObject {\n return currentContext().operation\n },\n get method() {\n return options.method\n },\n get path() {\n return options.path\n },\n clientOptions,\n eventBus,\n get securitySchemes() {\n return options.securitySchemes ?? []\n },\n get selectedClient() {\n // The store is the source of truth once the user picks a client, so it\n // wins over the initial `options.selectedClient` seed and the selection\n // round-trips through the subscription above.\n return options.store.workspace['x-scalar-default-client'] ?? options.selectedClient\n },\n get selectedExample() {\n // Same as the client: the store wins over the initial seed so the example\n // selection survives re-renders and syncs across blocks.\n return options.store.workspace['x-scalar-default-example'] ?? options.selectedExample\n },\n get selectedServer() {\n // An explicit option wins (including an explicit `null` for \"no server\");\n // otherwise derive it from the same document the operation resolved from.\n return options.selectedServer !== undefined ? options.selectedServer : currentContext().server\n },\n })\n\n // Render the operation path in the header by default. The reference renders\n // this via the `#header` slot too, so the standalone block matches its look.\n const renderHeader = () =>\n h('span', { class: 'font-code text-c-2 min-w-0' }, h(ScalarWrappingText, { text: options.path }))\n\n // Wrap the block in its own teleport root so floating UI (the client picker\n // popover) renders inside the themed `.scalar-app` wrapper instead of escaping\n // to `body`, where it would miss the color-mode variables and lose its styling.\n const app = createApp(() =>\n h('div', { class: getWrapperClass(options.darkMode) }, [\n h(ScalarTeleportRoot, null, { default: () => h(CodeExample, props, { header: renderHeader }) }),\n ]),\n )\n\n app.provide(EXTERNAL_EXAMPLES, () => options.store.externalExamples())\n app.mount(element)\n\n return {\n app,\n destroy: () => {\n unsubscribeClient()\n unsubscribeExample()\n app.unmount()\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAgEA,IAAME,KAAmB,MACnBC,MAAa,KACR,yBAELA,MAAa,KACR,0BAEF,cASIC,KACX,GACA,MACsC;CACtC,IAAI,mBAAmBC,GAAS,OAAOC,EAA0BC,GAAIF,CAAO;CAE5E,IAAMG,IAAU,OAAOD,KAAO,WAAW,SAAS,cAAcA,CAAE,IAAIA;CACtE,IAAI,CAACC,GACH,MAAU,MAAM,sBAAsBD,GAAI;CAG5C,IAAME,IAAWC,EAAwB,GACnCC,IAAgBC,EAAsB,GAQtCC,IAAWC,EAAuBT,EAAQ,KAAK,GAC/CU,IAAoBN,EAAS,GAAG,qCAAqC,MACzEI,EAAS,UAAU,CAAC,CAAC,UAAU,qBAAqBG,CAAO,CAC7D,GAOMC,IAAqBR,EAAS,GAAG,sCAAsC,MAC3EI,EAAS,UAAU,CAAC,CAAC,UAAU,sBAAsBG,CAAO,CAC9D,GAWME,UAAqD;EAEzD,IAAMC,IAAiBd,EAAQ,MAAM,UAAU;EAC/C,IAAI,CAACc,KAAkB,EAAE,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AAE,GAAG,CACrD0B,EAAEI,GAAoB,MAAM,EAAE,eAAeJ,EAAE/B,GAAa4B,GAAO,EAAE,QAAQE,EAAa,CAAC,EAAE,CAAC,CAChG,CAAC,CACH;CAKA,OAHAG,EAAI,QAAQG,SAAyB/B,EAAQ,MAAM,iBAAiB,CAAC,GACrE4B,EAAI,MAAMzB,CAAO,GAEV;EACL;EACA,eAAe;GAGb,AAFAO,EAAkB,GAClBE,EAAmB,GACnBgB,EAAI,QAAQ;EACd;CACF;AACF"}
package/dist/constants.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region src/constants.ts
2
- var e = typeof OVERRIDE_PACKAGE_VERSION < "u" ? OVERRIDE_PACKAGE_VERSION : "0.5.3";
2
+ var e = typeof OVERRIDE_PACKAGE_VERSION < "u" ? OVERRIDE_PACKAGE_VERSION : "0.6.0";
3
3
  //#endregion
4
4
  export { e as APP_VERSION };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/** The version number taken from the package.json. Consumers can override at build time via define (e.g. OVERRIDE_PACKAGE_VERSION: JSON.stringify('1.2.3')). */\nexport const APP_VERSION = typeof OVERRIDE_PACKAGE_VERSION !== 'undefined' ? OVERRIDE_PACKAGE_VERSION : PACKAGE_VERSION\n"],"mappings":";AACA,IAAa,IAAc,OAAO,2BAA6B,MAAc,2BAAA"}
1
+ {"version":3,"file":"constants.js","names":["APP_VERSION"],"sources":["../src/constants.ts"],"sourcesContent":["/** The version number taken from the package.json. Consumers can override at build time via define (e.g. OVERRIDE_PACKAGE_VERSION: JSON.stringify('1.2.3')). */\nexport const APP_VERSION = typeof OVERRIDE_PACKAGE_VERSION !== 'undefined' ? OVERRIDE_PACKAGE_VERSION : PACKAGE_VERSION\n"],"mappings":";AACA,IAAaA,IAAc,OAAO,2BAA6B,MAAc,2BAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"LinkButton.vue.js","names":[],"sources":["../../src/schema/LinkButton.vue"],"sourcesContent":["<template>\n <button\n class=\"text-c-2 hover:text-c-1 underline\"\n type=\"button\">\n <slot />\n </button>\n</template>\n"],"mappings":";;;;CAEI,OAAM;CACN,MAAK;;;aAFP,EAIS,UAJT,GAIS,CADP,EAAQ,EAAA,QAAA,SAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"LinkButton.vue.js","names":["_openBlock","_createElementBlock","_renderSlot","_plugin_vue_export_helper_default","_sfc_main","_hoisted_1","_sfc_render","openBlock","createElementBlock","renderSlot","_ctx","LinkButton_default"],"sources":["../../src/schema/LinkButton.vue"],"sourcesContent":["<template>\n <button\n class=\"text-c-2 hover:text-c-1 underline\"\n type=\"button\">\n <slot />\n </button>\n</template>\n"],"mappings":";;;;CAEI,OAAM;CACN,MAAK;;;CAFP,OAAAA,EAAA,GAAAC,EAIS,UAJTI,GAIS,CADPH,EAAQQ,EAAA,QAAA,SAAA,C"}
@@ -1,4 +1,4 @@
1
- import e from "./RenderString.vue.script.js";
1
+ import e from "./RenderString.vue_vue_type_script_setup_true_lang.js";
2
2
  //#region src/schema/RenderString.vue
3
3
  var t = e;
4
4
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"RenderString.vue.js","names":[],"sources":["../../src/schema/RenderString.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Give this component any data, and it tries to render a meaningful string.\n *\n * @example\n * <RenderString :value=\"1\" /> => \"1\"\n * <RenderString :value=\"true\" /> => \"true\"\n * <RenderString :value=\"false\" /> => \"false\"\n * <RenderString :value=\"null\" /> => \"null\"\n * <RenderString :value=\"undefined\" /> => \"undefined\"\n * <RenderString :value=\"{}\" /> => \"{}\"\n * <RenderString :value=\"[]\" /> => \"[]\"\n * <RenderString :value=\"['a', 'b', 'c']\" /> => \"['a', 'b', 'c']\"\n * <RenderString :value=\"() => 'hello'\" /> => \"() => 'hello'\"\n * <RenderString :value=\"Symbol('test')\" /> => \"Symbol(test)\"\n **/\nimport { computed } from 'vue'\n\nconst { value } = defineProps<{\n value: any\n}>()\n\nconst valueAsString = computed(() => {\n if (value === '') {\n return `''`\n }\n\n if (value === null) {\n return 'null'\n }\n\n if (value === undefined) {\n return 'undefined'\n }\n\n // We don't need to cover all cases, Vue does a good job of rendering objects, arrays and functions.\n return value\n})\n</script>\n\n<template>\n {{ valueAsString }}\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"RenderString.vue.js","names":["_sfc_main","RenderString_vue_vue_type_script_setup_true_lang_default","RenderString_default"],"sources":["../../src/schema/RenderString.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Give this component any data, and it tries to render a meaningful string.\n *\n * @example\n * <RenderString :value=\"1\" /> => \"1\"\n * <RenderString :value=\"true\" /> => \"true\"\n * <RenderString :value=\"false\" /> => \"false\"\n * <RenderString :value=\"null\" /> => \"null\"\n * <RenderString :value=\"undefined\" /> => \"undefined\"\n * <RenderString :value=\"{}\" /> => \"{}\"\n * <RenderString :value=\"[]\" /> => \"[]\"\n * <RenderString :value=\"['a', 'b', 'c']\" /> => \"['a', 'b', 'c']\"\n * <RenderString :value=\"() => 'hello'\" /> => \"() => 'hello'\"\n * <RenderString :value=\"Symbol('test')\" /> => \"Symbol(test)\"\n **/\nimport { computed } from 'vue'\n\nconst { value } = defineProps<{\n value: any\n}>()\n\nconst valueAsString = computed(() => {\n if (value === '') {\n return `''`\n }\n\n if (value === null) {\n return 'null'\n }\n\n if (value === undefined) {\n return 'undefined'\n }\n\n // We don't need to cover all cases, Vue does a good job of rendering objects, arrays and functions.\n return value\n})\n</script>\n\n<template>\n {{ valueAsString }}\n</template>\n"],"mappings":""}
@@ -11,4 +11,4 @@ var r = /*@__PURE__*/ t({
11
11
  //#endregion
12
12
  export { r as default };
13
13
 
14
- //# sourceMappingURL=RenderString.vue.script.js.map
14
+ //# sourceMappingURL=RenderString.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderString.vue_vue_type_script_setup_true_lang.js","names":["_toDisplayString","RenderString_vue_vue_type_script_setup_true_lang_default","valueAsString","computed","__props","toDisplayString"],"sources":["../../src/schema/RenderString.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Give this component any data, and it tries to render a meaningful string.\n *\n * @example\n * <RenderString :value=\"1\" /> => \"1\"\n * <RenderString :value=\"true\" /> => \"true\"\n * <RenderString :value=\"false\" /> => \"false\"\n * <RenderString :value=\"null\" /> => \"null\"\n * <RenderString :value=\"undefined\" /> => \"undefined\"\n * <RenderString :value=\"{}\" /> => \"{}\"\n * <RenderString :value=\"[]\" /> => \"[]\"\n * <RenderString :value=\"['a', 'b', 'c']\" /> => \"['a', 'b', 'c']\"\n * <RenderString :value=\"() => 'hello'\" /> => \"() => 'hello'\"\n * <RenderString :value=\"Symbol('test')\" /> => \"Symbol(test)\"\n **/\nimport { computed } from 'vue'\n\nconst { value } = defineProps<{\n value: any\n}>()\n\nconst valueAsString = computed(() => {\n if (value === '') {\n return `''`\n }\n\n if (value === null) {\n return 'null'\n }\n\n if (value === undefined) {\n return 'undefined'\n }\n\n // We don't need to cover all cases, Vue does a good job of rendering objects, arrays and functions.\n return value\n})\n</script>\n\n<template>\n {{ valueAsString }}\n</template>\n"],"mappings":";;;;;;EAsBA,IAAME,IAAgBC,QAChBC,EAAA,UAAU,KACL,OAGLA,EAAA,UAAU,OACL,SAGLA,EAAA,UAAU,KAAA,IACL,cAIFA,EAAA,KACR;E,iBAIIJ,EAAAE,EAAA,KAAa"}
@@ -1,6 +1,6 @@
1
1
  import e from "../_virtual/_plugin-vue_export-helper.js";
2
- import t from "./Schema.vue.script.js";
3
- /* empty css */
2
+ import t from "./Schema.vue_vue_type_script_setup_true_lang.js";
3
+ /* empty css */
4
4
  //#region src/schema/Schema.vue
5
5
  var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-86862f28"]]);
6
6
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"Schema.vue.js","names":[],"sources":["../../src/schema/Schema.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { pushDynamicScope } from '@scalar/workspace-store/helpers/dynamic-ref'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, inject, provide, toRef, useId } from 'vue'\n\nimport ExternalDocs from '../shared/ExternalDocs.vue'\nimport ScreenReader from '../shared/ScreenReader.vue'\nimport {\n resolveDynamicSchema,\n SCHEMA_DYNAMIC_SCOPE_SYMBOL,\n useDynamicScope,\n} from './helpers/dynamic-scope'\nimport { inferDiscriminatorMappingComposition } from './helpers/get-compositions-to-render'\nimport { isEmptySchemaObject } from './helpers/is-empty-schema-object'\nimport { isOnSchemaTargetPath } from './helpers/is-on-schema-target-path'\nimport { isTypeObject } from './helpers/is-type-object'\nimport { mergeAllOfSchemas } from './helpers/merge-all-of-schemas'\nimport { partitionAllOfCompositions } from './helpers/partition-all-of-compositions'\nimport { SCHEMA_ANCESTORS_SYMBOL } from './helpers/schema-cycle'\nimport {\n SCHEMA_TREE_ROOT_SYMBOL,\n toNodeKey,\n useSchemaExpansion,\n} from './helpers/schema-expansion'\nimport { handleTreeKeydown } from './helpers/schema-keyboard-nav'\nimport { unwrapForRead } from './helpers/unwrap-for-read'\nimport { useLocalization } from './localization'\nimport SchemaComposition from './SchemaComposition.vue'\nimport SchemaGlyphPuck from './SchemaGlyphPuck.vue'\nimport SchemaObjectProperties from './SchemaObjectProperties.vue'\nimport SchemaProperty from './SchemaProperty.vue'\nimport type { SchemaOptions, SchemaRenderingProps } from './types'\n\nconst {\n scrollTargetId,\n expansion: expansionProp,\n schema: schemaProp,\n level = 0,\n depth = 0,\n name,\n compact,\n noncollapsible = false,\n hideHeading,\n hideDescription = false,\n additionalProperties,\n additionalPropertyCount,\n discriminator,\n breadcrumb,\n hideModelNames: hideModelNamesProp = false,\n options,\n schemaContext,\n compositionPath,\n cycleKey,\n} = defineProps<\n {\n schema?: SchemaObject\n /** Track how deep we've gone */\n level?: number\n /**\n * Real nesting depth. Not derived from `level`, whose stride differs per\n * edge (object +2, composition +1, non-object root +0).\n */\n depth?: number\n /* Show as a heading */\n name?: string\n /** A tighter layout with less borders and without a heading */\n compact?: boolean\n /** Shows a toggle to hide/show children */\n noncollapsible?: boolean\n /** Hide the heading */\n hideHeading?: boolean\n /** Hide the schema description */\n hideDescription?: boolean\n /** Show a special one way toggle for additional properties, also has a top border when open */\n additionalProperties?: boolean\n /** Number of request body properties hidden behind the overflow control. */\n additionalPropertyCount?: number\n /** Hide model names in type display */\n hideModelNames?: boolean\n /** Discriminator object */\n discriminator?: DiscriminatorObject\n /** Breadcrumb for the schema */\n breadcrumb?: string[]\n /** Event bus emitting actions */\n eventBus: WorkspaceEventBus | null\n /** Move the options into a single prop so they are easy to pass around */\n options: SchemaOptions\n /** When \"requestBody\", composition dropdown selection is synced with the example snippet */\n schemaContext?: string\n /** Internal path used to sync nested request body compositions with the code sample */\n compositionPath?: string[]\n /**\n * Stable identity of this schema node, derived from its raw (unresolved)\n * value by the parent. Used to detect self-referential cycles. See\n * {@link getCycleKey}.\n */\n cycleKey?: unknown\n } & SchemaRenderingProps\n>()\nconst { translate } = useLocalization()\n\nconst additionalPropertiesLabel = computed((): string => {\n if (additionalPropertyCount === undefined) {\n return translate('schema.showAdditionalProperties')\n }\n return translate(\n additionalPropertyCount === 1\n ? 'schema.showOneMoreProperty'\n : 'schema.showMoreProperties',\n { count: additionalPropertyCount },\n )\n})\n\nconst hideModelNames = computed(\n (): boolean => hideModelNamesProp || !!options.hideModelNames,\n)\n\n/**\n * The dynamic scope inherited from ancestor schema resources.\n *\n * Used to bind JSON Schema 2020-12 `$dynamicRef`s to the active `$dynamicAnchor` while walking the\n * tree. Empty at the root. See {@link useDynamicScope}.\n */\nconst dynamicScope = useDynamicScope()\n\n/**\n * The schema subtree, read through the magic and overrides proxies only.\n *\n * Everything below this point walks the subtree read-only, so the Vue reactive and\n * detect-changes layers are peeled off once here instead of being paid for on every nested\n * property access. See {@link unwrapForRead} for why that is safe and why the other two\n * layers stay. Reactivity on the prop itself is kept: the computed tracks the `schema` prop,\n * so replacing or switching the document still re-renders.\n */\nconst schema = computed((): SchemaObject | undefined =>\n unwrapForRead(schemaProp),\n)\n\n/**\n * The schema this node actually renders.\n *\n * Two normalizations happen here, both no-ops for ordinary schemas:\n * - A top-level `$dynamicRef` is bound to its concrete type via the inherited dynamic scope.\n * - A resource that extends a template through a root `$ref` (JSON Schema 2020-12 `$ref` alongside\n * `$defs`, e.g. a `PaginatedResponse` binding) is merged so its inherited properties render.\n */\nconst resolvedSchema = computed((): SchemaObject | undefined => {\n const value = schema.value\n\n if (!value || typeof value !== 'object') {\n return value\n }\n\n const bound = resolveDynamicSchema(value, dynamicScope)\n return '$ref' in bound ? resolve.schema(bound) : bound\n})\n\n/**\n * Re-provide the dynamic scope grown with this resource so nested `$dynamicRef`s bind here.\n *\n * Built once at setup from the resource's stable identity (like the ancestor set below);\n * `pushDynamicScope` only grows the scope for schemas that can carry a `$dynamicAnchor`.\n *\n * The raw schema is pushed, not the merged {@link resolvedSchema}: merging through `resolve.schema`\n * coerces the node and drops the resolved `$ref-value` from entries inside `$defs`, which\n * `$dynamicAnchor` resolution relies on to dereference the bound type (e.g. `User`).\n */\nconst scopeSchema = schema.value\n ? resolveDynamicSchema(schema.value, dynamicScope)\n : undefined\nprovide(\n SCHEMA_DYNAMIC_SCOPE_SYMBOL,\n scopeSchema ? pushDynamicScope(dynamicScope, scopeSchema) : dynamicScope,\n)\n\n/**\n * Cycle-safe `expandAllSchemaProperties`.\n *\n * We track ancestor schema keys along the current render path. A node is\n * treated as cyclic when its key is already present in the ancestor set, which\n * indicates that rendering has looped back onto a self-referential schema.\n *\n * This lets us default-expand finite branches while stopping automatic\n * expansion only at cycle boundaries, preventing infinite recursion.\n */\nconst ancestors = inject(SCHEMA_ANCESTORS_SYMBOL, undefined)\n\nconst isCyclic = computed(\n (): boolean => cycleKey != null && !!ancestors?.has(cycleKey),\n)\n\n// Re-provide the ancestor set augmented with this node so descendants can\n// detect cycles back to it. Built once at setup; a node's key is stable.\nconst childAncestors = new Set<unknown>(ancestors ?? [])\nif (cycleKey != null) {\n childAncestors.add(cycleKey)\n}\nprovide(SCHEMA_ANCESTORS_SYMBOL, childAncestors)\n\nconst shouldForceExpand = computed(\n (): boolean => !!options.expandAllSchemaProperties && !isCyclic.value,\n)\n\n/**\n * Whether this schema sits on the path to the current anchor/scroll target.\n *\n * Property anchors are dot-joined breadcrumbs, so every disclosure that wraps\n * the target has a breadcrumb that is a prefix of the target id. Opening those\n * disclosures is what makes deep links to collapsed (hidden) properties work\n * without forcing every schema open via `expandAllSchemaProperties`.\n */\nconst isOnTargetPath = computed((): boolean =>\n isOnSchemaTargetPath(toNodeKey(breadcrumb), scrollTargetId ?? ''),\n)\n\n/**\n * Whether the disclosure starts expanded. Non-collapsible schemas are always\n * open. When `expandAllSchemaProperties` is enabled, finite branches start\n * expanded by default while cyclic branches remain collapsed to avoid recursion\n * loops. We also open any disclosure on the path to the current scroll target so\n * deep links resolve even when the property is collapsed.\n *\n * This is only the last step of the store's resolution order: it applies when\n * nobody has touched this node and no bulk action or baseline covers it.\n */\nconst defaultOpen = computed(\n (): boolean =>\n noncollapsible || shouldForceExpand.value || isOnTargetPath.value,\n)\n\n/** Gets the description to show for the schema */\nconst schemaDescription = computed(() => {\n const value = resolvedSchema.value\n\n if (hideDescription) {\n return null\n }\n\n const rawSchema = schema.value\n\n // For the request body we want to show the description of the merged allOf schema.\n // Merging keeps the base description (when set) and otherwise lets the last allOf\n // member win, matching how the merged composition is rendered below. The nested\n // merged Schema in `SchemaComposition` hides its own description in this case so\n // the text is not rendered twice.\n if (\n rawSchema?.allOf &&\n rawSchema.allOf.length > 0 &&\n name === 'Request Body'\n ) {\n return mergeAllOfSchemas(rawSchema)?.description || null\n }\n\n // Don't show description if there's no description or it's not a string\n if (!value?.description || typeof value.description !== 'string') {\n return null\n }\n\n // Don't show description for enum schemas (they have special handling)\n if (value.enum) {\n return null\n }\n\n // Will be shown in the properties anyway. A composed schema is the exception:\n // its members render as their own cards with their own descriptions, so the\n // schema's own description has nowhere else to go.\n if (\n !('properties' in value) &&\n !('patternProperties' in value) &&\n !('additionalProperties' in value) &&\n !('allOf' in value)\n ) {\n return null\n }\n\n // An allOf object segment already displays the merged description. Keep a\n // distinct outer description, but do not repeat text carried by that segment.\n if (\n rawSchema?.allOf &&\n partitionAllOfCompositions(rawSchema).segments.some(\n (segment) =>\n segment.kind === 'object' &&\n segment.schema.description === value.description &&\n ('properties' in segment.schema ||\n 'patternProperties' in segment.schema ||\n 'additionalProperties' in segment.schema) &&\n !segment.schema.enum,\n )\n ) {\n return null\n }\n\n // Return the schema's own description\n return value.description\n})\n\n/**\n * Infer a selector for mapped discriminators that do not declare `oneOf`.\n * Threaded discriminators skip inference to avoid recursive allOf variants.\n */\nconst inferredDiscriminatorComposition = computed(() =>\n schema.value && !discriminator && isTypeObject(schema.value)\n ? inferDiscriminatorMappingComposition(schema.value, options.document)\n : null,\n)\n\n/**\n * Whether the panel holds the schema's property rows. Mirrors the branches in\n * the panel below: any other root (a composition, a primitive, an array)\n * renders a single nameless passthrough row that carries the real property\n * list inside it, and a list of one row is structure the eye never sees.\n * Announcing it makes assistive tech read \"list with 1 item\" before the list\n * the reader actually wanted, so that wrapper is presentational instead.\n */\nconst rendersPropertyRows = computed(\n (): boolean =>\n !inferredDiscriminatorComposition.value &&\n isTypeObject(resolvedSchema.value),\n)\n\n/**\n * Whether an enclosing Schema already established a tree root. `depth === 0`\n * alone is not enough: a nested Schema can mount at depth 0 (an `allOf`\n * member, or a caller that omits `depth`), and a second root would mount a\n * second sticky strip and keydown root, firing every arrow key twice.\n */\nconst hasTreeRootAbove = inject(SCHEMA_TREE_ROOT_SYMBOL, false)\n\n/** The root-only features (glyph tokens, keyboard navigation) live on the outermost tree root only */\nconst isTreeRoot = computed((): boolean => depth === 0 && !hasTreeRootAbove)\n\n// Descendants must know a root exists above them, whatever depth they mount at.\nprovide(SCHEMA_TREE_ROOT_SYMBOL, true)\n\n/** Delegated arrow-key navigation, active only when the flag is on */\nconst onTreeKeydown = (event: KeyboardEvent): void => {\n if (isTreeRoot.value && options.schemaKeyboardNav) {\n handleTreeKeydown(event)\n }\n}\n\nconst expansion =\n expansionProp ?? useSchemaExpansion(toRef(() => scrollTargetId ?? ''))\n\n/**\n * Fallback identity for nodes mounted without a breadcrumb (models, AsyncAPI\n * messages, the classic layouts). Until those surfaces pass real breadcrumbs,\n * this keeps them from all resolving to the empty key and toggling as one node.\n */\nconst anonymousKey = useId()\n\nconst nodeKey = computed(\n (): string => toNodeKey(breadcrumb) || `~anonymous-${anonymousKey}`,\n)\n\n/**\n * Whether this disclosure is open. Resolved from the store on every read, not\n * latched at mount, so a second deep link into an already-rendered operation\n * works and expansion survives the composition variant remount.\n */\nconst open = computed(\n (): boolean =>\n noncollapsible ||\n expansion.isExpanded(nodeKey.value, {\n cyclic: isCyclic.value,\n defaultOpen: defaultOpen.value,\n }),\n)\n\n/** Additional-property panels hide until opened; every other panel always renders */\nconst panelRendered = computed(\n (): boolean => !additionalProperties || open.value,\n)\n\nconst toggleId = useId()\nconst panelId = useId()\n\n/**\n * The reveal is one-way: its button hides once the panel opens, so nothing\n * here can collapse a subtree that holds focus. The rows inside handle that\n * themselves (see `toggleTree` in SchemaProperty.vue).\n */\nconst toggle = (): void => {\n if (noncollapsible) {\n return\n }\n\n expansion.setExpanded(nodeKey.value, !open.value)\n}\n</script>\n<template>\n <!--\n Not a Headless UI `<Disclosure>`: it has no controlled mode, and expansion\n is driven from the store, so the button and the panel are owned directly.\n -->\n <div\n v-if=\"resolvedSchema && Object.keys(resolvedSchema).length\"\n class=\"schema-card\"\n :class=\"[\n `schema-card--level-${level}`,\n { 'schema-card--compact': compact, 'schema-card--open': open },\n /*\n * No margin of its own: the row above already ends with its own 6px pad,\n * so the reveal keeps the tree's row-to-row rhythm exactly.\n */\n { 'additional-card--tree': additionalProperties },\n 'schema-card--tree',\n /*\n * Tree-local tokens, namespaced --schema-* so no preset or user theme\n * breaks. WCAG 1.4.11 wants 3:1 for the glyph; --scalar-color-3 measures\n * 3.28:1 only before opacity, so the glyph reads color-2. The narrow\n * container tightens the indent and the control sizes, but that lives at\n * app scope (styles/tailwind.config.css) with the other rail tokens: the\n * surfaces above a tree root draw rails too, and they must tighten with\n * it or their glyphs land on a different line.\n */\n {\n 'schema-tree [--schema-glyph-background:var(--scalar-background-1)] [--schema-glyph-color:var(--scalar-color-2)]':\n isTreeRoot,\n },\n ]\"\n @keydown=\"onTreeKeydown\">\n <ExternalDocs\n v-if=\"isTypeObject(resolvedSchema)\"\n class=\"my-2\"\n :value=\"resolvedSchema.externalDocs\" />\n <!-- Schema description -->\n <!-- Without a card box the level-0 divider (and its negative-margin tuck)\n would be a stray line, so the whole treatment is switched off -->\n <div\n v-if=\"schemaDescription\"\n class=\"schema-card-description [.schema-card--level-0:nth-of-type(1)>&]:has-[+.schema-properties]:mb-0! [.schema-card--level-0:nth-of-type(1)>&]:has-[+.schema-properties]:border-b-0! [.schema-card--level-0:nth-of-type(1)>&]:has-[+.schema-properties]:pb-0!\">\n <ScalarMarkdown :value=\"schemaDescription\" />\n </div>\n <div\n v-if=\"isEmptySchemaObject(resolvedSchema)\"\n class=\"text-c-2 py-1.5\">\n {{ translate('schema.emptyObject') }}\n </div>\n <!-- A rail per depth instead of a bordered box per level, so the card\n chrome is switched off. 6px under a description keeps the 12px row\n rhythm; at level 0 the divider is gone, so even that 6px would double\n up with the first row's own padding. -->\n <div\n class=\"schema-properties\"\n :class=\"[\n { 'schema-properties-open': open },\n 'w-full! rounded-none! border-0! [.schema-card--level-0:nth-of-type(1)>.schema-card-description+&]:mt-0! [.schema-card-description+&]:mt-1.5!',\n ]\">\n <!-- Toggle to collapse/expand long lists of properties -->\n <div\n v-if=\"additionalProperties\"\n v-show=\"!open\"\n class=\"schema-properties w-full! rounded-none! border-0!\">\n <!-- The reveal reads as one more row — mono label flush with the\n sibling rows' text, a plus puck centred on the sibling toggles'\n line. `min-h-8` is the row's own 32px: the label then centres in\n the same 20px slot a heading gets, so the first revealed property\n lands exactly where the label was instead of 2.5px below it. -->\n <button\n :id=\"toggleId\"\n :aria-controls=\"panelRendered ? panelId : undefined\"\n :aria-expanded=\"open\"\n class=\"schema-card-title schema-card-title--compact group/tree-control additional-toggle--tree font-code text-c-1! relative flex h-auto min-h-8 items-center gap-0! px-0! py-[var(--schema-row-pad,6px)]! text-sm! font-bold!\"\n type=\"button\"\n @click=\"toggle\">\n <!-- The reveal is one more row of the tree, so its plus is the same\n puck the row toggles draw, on the same gutter line -->\n <SchemaGlyphPuck class=\"additional-toggle-glyph\" />\n <span class=\"additional-toggle-label\">\n {{ additionalPropertiesLabel }}\n <ScreenReader v-if=\"name\">\n {{ translate('schema.forName', { name }) }}\n </ScreenReader>\n </span>\n </button>\n </div>\n\n <!-- The theme reset strips list-style, which makes Safari and VoiceOver\n drop list semantics; an explicit role restores them. When the panel\n holds a single passthrough row instead of property rows, the wrapper\n is presentational so only the real list nested inside it is\n announced. -->\n <ul\n v-if=\"panelRendered\"\n :id=\"panelId\"\n :role=\"rendersPropertyRows ? 'list' : 'presentation'\">\n <!-- Variant selector inferred from a discriminator mapping -->\n <SchemaComposition\n v-if=\"inferredDiscriminatorComposition\"\n :breadcrumb\n :compact\n composition=\"oneOf\"\n :compositionPath=\"compositionPath\"\n :depth=\"depth\"\n :discriminator=\"schema?.discriminator\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level=\"level\"\n :name=\"name\"\n :options\n :schema=\"inferredDiscriminatorComposition\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n <!-- Object properties -->\n <SchemaObjectProperties\n v-else-if=\"isTypeObject(resolvedSchema)\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :depth=\"depth\"\n :discriminator=\"discriminator ?? resolvedSchema?.discriminator\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level=\"level + 1\"\n :options\n :schema=\"resolvedSchema\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n <!-- Not an object -->\n <template v-else>\n <SchemaProperty\n v-if=\"resolvedSchema\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :depth=\"depth\"\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level\n :options\n :schema=\"resolvedSchema\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n </ul>\n </div>\n </div>\n</template>\n<style scoped>\n.error {\n background-color: var(--scalar-color-red);\n}\n.schema-card {\n font-size: var(--scalar-font-size-4);\n color: var(--scalar-color-1);\n}\n.schema-card-title {\n height: var(--schema-title-height);\n\n padding: 6px 8px;\n\n display: flex;\n align-items: center;\n gap: 4px;\n\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n font-size: var(--scalar-mini);\n border-bottom: var(--scalar-border-width) solid transparent;\n}\nbutton.schema-card-title {\n cursor: pointer;\n}\nbutton.schema-card-title:hover {\n color: var(--scalar-color-1);\n}\n.schema-properties-open > .schema-card-title {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.schema-properties-open > .schema-properties {\n width: fit-content;\n}\n.schema-card-description {\n color: var(--scalar-color-2);\n}\n.schema-card-description + .schema-properties {\n width: fit-content;\n}\n.schema-card-description + .schema-properties {\n margin-top: 8px;\n}\n.schema-card--level-0:nth-of-type(1)\n > .schema-card-description:has(+ .schema-properties) {\n margin-bottom: -8px;\n padding-bottom: 8px;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.schema-card--level-0\n ~ .schema-card--level-0\n > .schema-card-description:has(+ .schema-properties) {\n padding-top: 8px;\n}\n\n.schema-properties-open.schema-properties,\n.schema-properties-open > .schema-card--open {\n width: 100%;\n}\n.schema-properties {\n display: flex;\n flex-direction: column;\n\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius-lg);\n width: fit-content;\n}\n.schema-properties-name {\n width: 100%;\n}\n.schema-properties .schema-properties {\n border-radius: 13.5px;\n}\n.schema-properties .schema-properties.schema-properties-open {\n border-radius: var(--scalar-radius-lg);\n}\n.schema-properties-open {\n width: 100%;\n}\n.schema-card--compact {\n align-self: flex-start;\n}\n.schema-card--compact.schema-card--open {\n align-self: initial;\n}\n.schema-card-title--compact {\n color: var(--scalar-color-2);\n padding: 6px 10px 6px 8px;\n height: auto;\n border-bottom: none;\n}\n.schema-properties-open > .schema-card-title--compact {\n position: static;\n}\n.property--level-0\n > .schema-properties\n > .schema-card--level-0\n > .schema-properties {\n border: none;\n}\n.property--level-0\n .schema-card--level-0:not(.schema-card--compact)\n .property--level-1 {\n padding: 0 0 8px;\n}\n:not(.composition-panel)\n > .schema-card--compact.schema-card--level-0\n > .schema-properties {\n border: none;\n}\n:deep(.schema-card-description) p {\n font-size: var(--scalar-small, var(--scalar-paragraph));\n color: var(--scalar-color-2);\n margin-bottom: 0;\n display: block;\n margin-bottom: 6px;\n}\n.children .schema-card-description:first-of-type {\n padding-top: 0;\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"Schema.vue.js","names":["_sfc_main","_plugin_vue_export_helper_default","Schema_vue_vue_type_script_setup_true_lang_default","Schema_default"],"sources":["../../src/schema/Schema.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { pushDynamicScope } from '@scalar/workspace-store/helpers/dynamic-ref'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, inject, provide, toRef, useId } from 'vue'\n\nimport ExternalDocs from '../shared/ExternalDocs.vue'\nimport ScreenReader from '../shared/ScreenReader.vue'\nimport {\n resolveDynamicSchema,\n SCHEMA_DYNAMIC_SCOPE_SYMBOL,\n useDynamicScope,\n} from './helpers/dynamic-scope'\nimport { inferDiscriminatorMappingComposition } from './helpers/get-compositions-to-render'\nimport { isEmptySchemaObject } from './helpers/is-empty-schema-object'\nimport { isOnSchemaTargetPath } from './helpers/is-on-schema-target-path'\nimport { isTypeObject } from './helpers/is-type-object'\nimport { mergeAllOfSchemas } from './helpers/merge-all-of-schemas'\nimport { partitionAllOfCompositions } from './helpers/partition-all-of-compositions'\nimport { SCHEMA_ANCESTORS_SYMBOL } from './helpers/schema-cycle'\nimport {\n SCHEMA_TREE_ROOT_SYMBOL,\n toNodeKey,\n useSchemaExpansion,\n} from './helpers/schema-expansion'\nimport { handleTreeKeydown } from './helpers/schema-keyboard-nav'\nimport { unwrapForRead } from './helpers/unwrap-for-read'\nimport { useLocalization } from './localization'\nimport SchemaComposition from './SchemaComposition.vue'\nimport SchemaGlyphPuck from './SchemaGlyphPuck.vue'\nimport SchemaObjectProperties from './SchemaObjectProperties.vue'\nimport SchemaProperty from './SchemaProperty.vue'\nimport type { SchemaOptions, SchemaRenderingProps } from './types'\n\nconst {\n scrollTargetId,\n expansion: expansionProp,\n schema: schemaProp,\n level = 0,\n depth = 0,\n name,\n compact,\n noncollapsible = false,\n hideHeading,\n hideDescription = false,\n additionalProperties,\n additionalPropertyCount,\n discriminator,\n breadcrumb,\n hideModelNames: hideModelNamesProp = false,\n options,\n schemaContext,\n compositionPath,\n cycleKey,\n} = defineProps<\n {\n schema?: SchemaObject\n /** Track how deep we've gone */\n level?: number\n /**\n * Real nesting depth. Not derived from `level`, whose stride differs per\n * edge (object +2, composition +1, non-object root +0).\n */\n depth?: number\n /* Show as a heading */\n name?: string\n /** A tighter layout with less borders and without a heading */\n compact?: boolean\n /** Shows a toggle to hide/show children */\n noncollapsible?: boolean\n /** Hide the heading */\n hideHeading?: boolean\n /** Hide the schema description */\n hideDescription?: boolean\n /** Show a special one way toggle for additional properties, also has a top border when open */\n additionalProperties?: boolean\n /** Number of request body properties hidden behind the overflow control. */\n additionalPropertyCount?: number\n /** Hide model names in type display */\n hideModelNames?: boolean\n /** Discriminator object */\n discriminator?: DiscriminatorObject\n /** Breadcrumb for the schema */\n breadcrumb?: string[]\n /** Event bus emitting actions */\n eventBus: WorkspaceEventBus | null\n /** Move the options into a single prop so they are easy to pass around */\n options: SchemaOptions\n /** When \"requestBody\", composition dropdown selection is synced with the example snippet */\n schemaContext?: string\n /** Internal path used to sync nested request body compositions with the code sample */\n compositionPath?: string[]\n /**\n * Stable identity of this schema node, derived from its raw (unresolved)\n * value by the parent. Used to detect self-referential cycles. See\n * {@link getCycleKey}.\n */\n cycleKey?: unknown\n } & SchemaRenderingProps\n>()\nconst { translate } = useLocalization()\n\nconst additionalPropertiesLabel = computed((): string => {\n if (additionalPropertyCount === undefined) {\n return translate('schema.showAdditionalProperties')\n }\n return translate(\n additionalPropertyCount === 1\n ? 'schema.showOneMoreProperty'\n : 'schema.showMoreProperties',\n { count: additionalPropertyCount },\n )\n})\n\nconst hideModelNames = computed(\n (): boolean => hideModelNamesProp || !!options.hideModelNames,\n)\n\n/**\n * The dynamic scope inherited from ancestor schema resources.\n *\n * Used to bind JSON Schema 2020-12 `$dynamicRef`s to the active `$dynamicAnchor` while walking the\n * tree. Empty at the root. See {@link useDynamicScope}.\n */\nconst dynamicScope = useDynamicScope()\n\n/**\n * The schema subtree, read through the magic and overrides proxies only.\n *\n * Everything below this point walks the subtree read-only, so the Vue reactive and\n * detect-changes layers are peeled off once here instead of being paid for on every nested\n * property access. See {@link unwrapForRead} for why that is safe and why the other two\n * layers stay. Reactivity on the prop itself is kept: the computed tracks the `schema` prop,\n * so replacing or switching the document still re-renders.\n */\nconst schema = computed((): SchemaObject | undefined =>\n unwrapForRead(schemaProp),\n)\n\n/**\n * The schema this node actually renders.\n *\n * Two normalizations happen here, both no-ops for ordinary schemas:\n * - A top-level `$dynamicRef` is bound to its concrete type via the inherited dynamic scope.\n * - A resource that extends a template through a root `$ref` (JSON Schema 2020-12 `$ref` alongside\n * `$defs`, e.g. a `PaginatedResponse` binding) is merged so its inherited properties render.\n */\nconst resolvedSchema = computed((): SchemaObject | undefined => {\n const value = schema.value\n\n if (!value || typeof value !== 'object') {\n return value\n }\n\n const bound = resolveDynamicSchema(value, dynamicScope)\n return '$ref' in bound ? resolve.schema(bound) : bound\n})\n\n/**\n * Re-provide the dynamic scope grown with this resource so nested `$dynamicRef`s bind here.\n *\n * Built once at setup from the resource's stable identity (like the ancestor set below);\n * `pushDynamicScope` only grows the scope for schemas that can carry a `$dynamicAnchor`.\n *\n * The raw schema is pushed, not the merged {@link resolvedSchema}: merging through `resolve.schema`\n * coerces the node and drops the resolved `$ref-value` from entries inside `$defs`, which\n * `$dynamicAnchor` resolution relies on to dereference the bound type (e.g. `User`).\n */\nconst scopeSchema = schema.value\n ? resolveDynamicSchema(schema.value, dynamicScope)\n : undefined\nprovide(\n SCHEMA_DYNAMIC_SCOPE_SYMBOL,\n scopeSchema ? pushDynamicScope(dynamicScope, scopeSchema) : dynamicScope,\n)\n\n/**\n * Cycle-safe `expandAllSchemaProperties`.\n *\n * We track ancestor schema keys along the current render path. A node is\n * treated as cyclic when its key is already present in the ancestor set, which\n * indicates that rendering has looped back onto a self-referential schema.\n *\n * This lets us default-expand finite branches while stopping automatic\n * expansion only at cycle boundaries, preventing infinite recursion.\n */\nconst ancestors = inject(SCHEMA_ANCESTORS_SYMBOL, undefined)\n\nconst isCyclic = computed(\n (): boolean => cycleKey != null && !!ancestors?.has(cycleKey),\n)\n\n// Re-provide the ancestor set augmented with this node so descendants can\n// detect cycles back to it. Built once at setup; a node's key is stable.\nconst childAncestors = new Set<unknown>(ancestors ?? [])\nif (cycleKey != null) {\n childAncestors.add(cycleKey)\n}\nprovide(SCHEMA_ANCESTORS_SYMBOL, childAncestors)\n\nconst shouldForceExpand = computed(\n (): boolean => !!options.expandAllSchemaProperties && !isCyclic.value,\n)\n\n/**\n * Whether this schema sits on the path to the current anchor/scroll target.\n *\n * Property anchors are dot-joined breadcrumbs, so every disclosure that wraps\n * the target has a breadcrumb that is a prefix of the target id. Opening those\n * disclosures is what makes deep links to collapsed (hidden) properties work\n * without forcing every schema open via `expandAllSchemaProperties`.\n */\nconst isOnTargetPath = computed((): boolean =>\n isOnSchemaTargetPath(toNodeKey(breadcrumb), scrollTargetId ?? ''),\n)\n\n/**\n * Whether the disclosure starts expanded. Non-collapsible schemas are always\n * open. When `expandAllSchemaProperties` is enabled, finite branches start\n * expanded by default while cyclic branches remain collapsed to avoid recursion\n * loops. We also open any disclosure on the path to the current scroll target so\n * deep links resolve even when the property is collapsed.\n *\n * This is only the last step of the store's resolution order: it applies when\n * nobody has touched this node and no bulk action or baseline covers it.\n */\nconst defaultOpen = computed(\n (): boolean =>\n noncollapsible || shouldForceExpand.value || isOnTargetPath.value,\n)\n\n/** Gets the description to show for the schema */\nconst schemaDescription = computed(() => {\n const value = resolvedSchema.value\n\n if (hideDescription) {\n return null\n }\n\n const rawSchema = schema.value\n\n // For the request body we want to show the description of the merged allOf schema.\n // Merging keeps the base description (when set) and otherwise lets the last allOf\n // member win, matching how the merged composition is rendered below. The nested\n // merged Schema in `SchemaComposition` hides its own description in this case so\n // the text is not rendered twice.\n if (\n rawSchema?.allOf &&\n rawSchema.allOf.length > 0 &&\n name === 'Request Body'\n ) {\n return mergeAllOfSchemas(rawSchema)?.description || null\n }\n\n // Don't show description if there's no description or it's not a string\n if (!value?.description || typeof value.description !== 'string') {\n return null\n }\n\n // Don't show description for enum schemas (they have special handling)\n if (value.enum) {\n return null\n }\n\n // Will be shown in the properties anyway. A composed schema is the exception:\n // its members render as their own cards with their own descriptions, so the\n // schema's own description has nowhere else to go.\n if (\n !('properties' in value) &&\n !('patternProperties' in value) &&\n !('additionalProperties' in value) &&\n !('allOf' in value)\n ) {\n return null\n }\n\n // An allOf object segment already displays the merged description. Keep a\n // distinct outer description, but do not repeat text carried by that segment.\n if (\n rawSchema?.allOf &&\n partitionAllOfCompositions(rawSchema).segments.some(\n (segment) =>\n segment.kind === 'object' &&\n segment.schema.description === value.description &&\n ('properties' in segment.schema ||\n 'patternProperties' in segment.schema ||\n 'additionalProperties' in segment.schema) &&\n !segment.schema.enum,\n )\n ) {\n return null\n }\n\n // Return the schema's own description\n return value.description\n})\n\n/**\n * Infer a selector for mapped discriminators that do not declare `oneOf`.\n * Threaded discriminators skip inference to avoid recursive allOf variants.\n */\nconst inferredDiscriminatorComposition = computed(() =>\n schema.value && !discriminator && isTypeObject(schema.value)\n ? inferDiscriminatorMappingComposition(schema.value, options.document)\n : null,\n)\n\n/**\n * Whether the panel holds the schema's property rows. Mirrors the branches in\n * the panel below: any other root (a composition, a primitive, an array)\n * renders a single nameless passthrough row that carries the real property\n * list inside it, and a list of one row is structure the eye never sees.\n * Announcing it makes assistive tech read \"list with 1 item\" before the list\n * the reader actually wanted, so that wrapper is presentational instead.\n */\nconst rendersPropertyRows = computed(\n (): boolean =>\n !inferredDiscriminatorComposition.value &&\n isTypeObject(resolvedSchema.value),\n)\n\n/**\n * Whether an enclosing Schema already established a tree root. `depth === 0`\n * alone is not enough: a nested Schema can mount at depth 0 (an `allOf`\n * member, or a caller that omits `depth`), and a second root would mount a\n * second sticky strip and keydown root, firing every arrow key twice.\n */\nconst hasTreeRootAbove = inject(SCHEMA_TREE_ROOT_SYMBOL, false)\n\n/** The root-only features (glyph tokens, keyboard navigation) live on the outermost tree root only */\nconst isTreeRoot = computed((): boolean => depth === 0 && !hasTreeRootAbove)\n\n// Descendants must know a root exists above them, whatever depth they mount at.\nprovide(SCHEMA_TREE_ROOT_SYMBOL, true)\n\n/** Delegated arrow-key navigation, active only when the flag is on */\nconst onTreeKeydown = (event: KeyboardEvent): void => {\n if (isTreeRoot.value && options.schemaKeyboardNav) {\n handleTreeKeydown(event)\n }\n}\n\nconst expansion =\n expansionProp ?? useSchemaExpansion(toRef(() => scrollTargetId ?? ''))\n\n/**\n * Fallback identity for nodes mounted without a breadcrumb (models, AsyncAPI\n * messages, the classic layouts). Until those surfaces pass real breadcrumbs,\n * this keeps them from all resolving to the empty key and toggling as one node.\n */\nconst anonymousKey = useId()\n\nconst nodeKey = computed(\n (): string => toNodeKey(breadcrumb) || `~anonymous-${anonymousKey}`,\n)\n\n/**\n * Whether this disclosure is open. Resolved from the store on every read, not\n * latched at mount, so a second deep link into an already-rendered operation\n * works and expansion survives the composition variant remount.\n */\nconst open = computed(\n (): boolean =>\n noncollapsible ||\n expansion.isExpanded(nodeKey.value, {\n cyclic: isCyclic.value,\n defaultOpen: defaultOpen.value,\n }),\n)\n\n/** Additional-property panels hide until opened; every other panel always renders */\nconst panelRendered = computed(\n (): boolean => !additionalProperties || open.value,\n)\n\nconst toggleId = useId()\nconst panelId = useId()\n\n/**\n * The reveal is one-way: its button hides once the panel opens, so nothing\n * here can collapse a subtree that holds focus. The rows inside handle that\n * themselves (see `toggleTree` in SchemaProperty.vue).\n */\nconst toggle = (): void => {\n if (noncollapsible) {\n return\n }\n\n expansion.setExpanded(nodeKey.value, !open.value)\n}\n</script>\n<template>\n <!--\n Not a Headless UI `<Disclosure>`: it has no controlled mode, and expansion\n is driven from the store, so the button and the panel are owned directly.\n -->\n <div\n v-if=\"resolvedSchema && Object.keys(resolvedSchema).length\"\n class=\"schema-card\"\n :class=\"[\n `schema-card--level-${level}`,\n { 'schema-card--compact': compact, 'schema-card--open': open },\n /*\n * No margin of its own: the row above already ends with its own 6px pad,\n * so the reveal keeps the tree's row-to-row rhythm exactly.\n */\n { 'additional-card--tree': additionalProperties },\n 'schema-card--tree',\n /*\n * Tree-local tokens, namespaced --schema-* so no preset or user theme\n * breaks. WCAG 1.4.11 wants 3:1 for the glyph; --scalar-color-3 measures\n * 3.28:1 only before opacity, so the glyph reads color-2. The narrow\n * container tightens the indent and the control sizes, but that lives at\n * app scope (styles/tailwind.config.css) with the other rail tokens: the\n * surfaces above a tree root draw rails too, and they must tighten with\n * it or their glyphs land on a different line.\n */\n {\n 'schema-tree [--schema-glyph-background:var(--scalar-background-1)] [--schema-glyph-color:var(--scalar-color-2)]':\n isTreeRoot,\n },\n ]\"\n @keydown=\"onTreeKeydown\">\n <ExternalDocs\n v-if=\"isTypeObject(resolvedSchema)\"\n class=\"my-2\"\n :value=\"resolvedSchema.externalDocs\" />\n <!-- Schema description -->\n <!-- Without a card box the level-0 divider (and its negative-margin tuck)\n would be a stray line, so the whole treatment is switched off -->\n <div\n v-if=\"schemaDescription\"\n class=\"schema-card-description [.schema-card--level-0:nth-of-type(1)>&]:has-[+.schema-properties]:mb-0! [.schema-card--level-0:nth-of-type(1)>&]:has-[+.schema-properties]:border-b-0! [.schema-card--level-0:nth-of-type(1)>&]:has-[+.schema-properties]:pb-0!\">\n <ScalarMarkdown :value=\"schemaDescription\" />\n </div>\n <div\n v-if=\"isEmptySchemaObject(resolvedSchema)\"\n class=\"text-c-2 py-1.5\">\n {{ translate('schema.emptyObject') }}\n </div>\n <!-- A rail per depth instead of a bordered box per level, so the card\n chrome is switched off. 6px under a description keeps the 12px row\n rhythm; at level 0 the divider is gone, so even that 6px would double\n up with the first row's own padding. -->\n <div\n class=\"schema-properties\"\n :class=\"[\n { 'schema-properties-open': open },\n 'w-full! rounded-none! border-0! [.schema-card--level-0:nth-of-type(1)>.schema-card-description+&]:mt-0! [.schema-card-description+&]:mt-1.5!',\n ]\">\n <!-- Toggle to collapse/expand long lists of properties -->\n <div\n v-if=\"additionalProperties\"\n v-show=\"!open\"\n class=\"schema-properties w-full! rounded-none! border-0!\">\n <!-- The reveal reads as one more row — mono label flush with the\n sibling rows' text, a plus puck centred on the sibling toggles'\n line. `min-h-8` is the row's own 32px: the label then centres in\n the same 20px slot a heading gets, so the first revealed property\n lands exactly where the label was instead of 2.5px below it. -->\n <button\n :id=\"toggleId\"\n :aria-controls=\"panelRendered ? panelId : undefined\"\n :aria-expanded=\"open\"\n class=\"schema-card-title schema-card-title--compact group/tree-control additional-toggle--tree font-code text-c-1! relative flex h-auto min-h-8 items-center gap-0! px-0! py-[var(--schema-row-pad,6px)]! text-sm! font-bold!\"\n type=\"button\"\n @click=\"toggle\">\n <!-- The reveal is one more row of the tree, so its plus is the same\n puck the row toggles draw, on the same gutter line -->\n <SchemaGlyphPuck class=\"additional-toggle-glyph\" />\n <span class=\"additional-toggle-label\">\n {{ additionalPropertiesLabel }}\n <ScreenReader v-if=\"name\">\n {{ translate('schema.forName', { name }) }}\n </ScreenReader>\n </span>\n </button>\n </div>\n\n <!-- The theme reset strips list-style, which makes Safari and VoiceOver\n drop list semantics; an explicit role restores them. When the panel\n holds a single passthrough row instead of property rows, the wrapper\n is presentational so only the real list nested inside it is\n announced. -->\n <ul\n v-if=\"panelRendered\"\n :id=\"panelId\"\n :role=\"rendersPropertyRows ? 'list' : 'presentation'\">\n <!-- Variant selector inferred from a discriminator mapping -->\n <SchemaComposition\n v-if=\"inferredDiscriminatorComposition\"\n :breadcrumb\n :compact\n composition=\"oneOf\"\n :compositionPath=\"compositionPath\"\n :depth=\"depth\"\n :discriminator=\"schema?.discriminator\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level=\"level\"\n :name=\"name\"\n :options\n :schema=\"inferredDiscriminatorComposition\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n <!-- Object properties -->\n <SchemaObjectProperties\n v-else-if=\"isTypeObject(resolvedSchema)\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :depth=\"depth\"\n :discriminator=\"discriminator ?? resolvedSchema?.discriminator\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level=\"level + 1\"\n :options\n :schema=\"resolvedSchema\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n <!-- Not an object -->\n <template v-else>\n <SchemaProperty\n v-if=\"resolvedSchema\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :depth=\"depth\"\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level\n :options\n :schema=\"resolvedSchema\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n </ul>\n </div>\n </div>\n</template>\n<style scoped>\n.error {\n background-color: var(--scalar-color-red);\n}\n.schema-card {\n font-size: var(--scalar-font-size-4);\n color: var(--scalar-color-1);\n}\n.schema-card-title {\n height: var(--schema-title-height);\n\n padding: 6px 8px;\n\n display: flex;\n align-items: center;\n gap: 4px;\n\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n font-size: var(--scalar-mini);\n border-bottom: var(--scalar-border-width) solid transparent;\n}\nbutton.schema-card-title {\n cursor: pointer;\n}\nbutton.schema-card-title:hover {\n color: var(--scalar-color-1);\n}\n.schema-properties-open > .schema-card-title {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.schema-properties-open > .schema-properties {\n width: fit-content;\n}\n.schema-card-description {\n color: var(--scalar-color-2);\n}\n.schema-card-description + .schema-properties {\n width: fit-content;\n}\n.schema-card-description + .schema-properties {\n margin-top: 8px;\n}\n.schema-card--level-0:nth-of-type(1)\n > .schema-card-description:has(+ .schema-properties) {\n margin-bottom: -8px;\n padding-bottom: 8px;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.schema-card--level-0\n ~ .schema-card--level-0\n > .schema-card-description:has(+ .schema-properties) {\n padding-top: 8px;\n}\n\n.schema-properties-open.schema-properties,\n.schema-properties-open > .schema-card--open {\n width: 100%;\n}\n.schema-properties {\n display: flex;\n flex-direction: column;\n\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius-lg);\n width: fit-content;\n}\n.schema-properties-name {\n width: 100%;\n}\n.schema-properties .schema-properties {\n border-radius: 13.5px;\n}\n.schema-properties .schema-properties.schema-properties-open {\n border-radius: var(--scalar-radius-lg);\n}\n.schema-properties-open {\n width: 100%;\n}\n.schema-card--compact {\n align-self: flex-start;\n}\n.schema-card--compact.schema-card--open {\n align-self: initial;\n}\n.schema-card-title--compact {\n color: var(--scalar-color-2);\n padding: 6px 10px 6px 8px;\n height: auto;\n border-bottom: none;\n}\n.schema-properties-open > .schema-card-title--compact {\n position: static;\n}\n.property--level-0\n > .schema-properties\n > .schema-card--level-0\n > .schema-properties {\n border: none;\n}\n.property--level-0\n .schema-card--level-0:not(.schema-card--compact)\n .property--level-1 {\n padding: 0 0 8px;\n}\n:not(.composition-panel)\n > .schema-card--compact.schema-card--level-0\n > .schema-properties {\n border: none;\n}\n:deep(.schema-card-description) p {\n font-size: var(--scalar-small, var(--scalar-paragraph));\n color: var(--scalar-color-2);\n margin-bottom: 0;\n display: block;\n margin-bottom: 6px;\n}\n.children .schema-card-description:first-of-type {\n padding-top: 0;\n}\n</style>\n"],"mappings":""}
@@ -237,4 +237,4 @@ var k = {
237
237
  //#endregion
238
238
  export { F as default };
239
239
 
240
- //# sourceMappingURL=Schema.vue.script.js.map
240
+ //# sourceMappingURL=Schema.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Schema.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref","_createBlock","ExternalDocs","_createCommentVNode","_createVNode","_toDisplayString","_createElementVNode","_withDirectives","SchemaGlyphPuck","_createTextVNode","ScreenReader","_withCtx","_vShow","SchemaComposition","SchemaObjectProperties","_Fragment","SchemaProperty","ExternalDocs_default","ScreenReader_default","SchemaGlyphPuck_default","SchemaComposition_default","SchemaProperty_default","SchemaObjectProperties_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","Schema_vue_vue_type_script_setup_true_lang_default","useLocalization","additionalPropertiesLabel","computed","__props","translate","hideModelNames","dynamicScope","useDynamicScope","schema","unwrapForRead","resolvedSchema","value","bound","resolveDynamicSchema","resolve","scopeSchema","SCHEMA_DYNAMIC_SCOPE_SYMBOL","pushDynamicScope","ancestors","inject","SCHEMA_ANCESTORS_SYMBOL","isCyclic","childAncestors","provide","shouldForceExpand","isOnTargetPath","isOnSchemaTargetPath","toNodeKey","defaultOpen","schemaDescription","rawSchema","mergeAllOfSchemas","partitionAllOfCompositions","segment","inferredDiscriminatorComposition","isTypeObject","inferDiscriminatorMappingComposition","rendersPropertyRows","hasTreeRootAbove","SCHEMA_TREE_ROOT_SYMBOL","isTreeRoot","onTreeKeydown","handleTreeKeydown","event","expansion","useSchemaExpansion","toRef","anonymousKey","useId","nodeKey","open","panelRendered","toggleId","panelId","toggle","openBlock","createElementBlock","normalizeClass","unref","createBlock","createCommentVNode","createVNode","ScalarMarkdown","isEmptySchemaObject","toDisplayString","createElementVNode","withDirectives","createTextVNode","withCtx","vShow","Fragment"],"sources":["../../src/schema/Schema.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { pushDynamicScope } from '@scalar/workspace-store/helpers/dynamic-ref'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, inject, provide, toRef, useId } from 'vue'\n\nimport ExternalDocs from '../shared/ExternalDocs.vue'\nimport ScreenReader from '../shared/ScreenReader.vue'\nimport {\n resolveDynamicSchema,\n SCHEMA_DYNAMIC_SCOPE_SYMBOL,\n useDynamicScope,\n} from './helpers/dynamic-scope'\nimport { inferDiscriminatorMappingComposition } from './helpers/get-compositions-to-render'\nimport { isEmptySchemaObject } from './helpers/is-empty-schema-object'\nimport { isOnSchemaTargetPath } from './helpers/is-on-schema-target-path'\nimport { isTypeObject } from './helpers/is-type-object'\nimport { mergeAllOfSchemas } from './helpers/merge-all-of-schemas'\nimport { partitionAllOfCompositions } from './helpers/partition-all-of-compositions'\nimport { SCHEMA_ANCESTORS_SYMBOL } from './helpers/schema-cycle'\nimport {\n SCHEMA_TREE_ROOT_SYMBOL,\n toNodeKey,\n useSchemaExpansion,\n} from './helpers/schema-expansion'\nimport { handleTreeKeydown } from './helpers/schema-keyboard-nav'\nimport { unwrapForRead } from './helpers/unwrap-for-read'\nimport { useLocalization } from './localization'\nimport SchemaComposition from './SchemaComposition.vue'\nimport SchemaGlyphPuck from './SchemaGlyphPuck.vue'\nimport SchemaObjectProperties from './SchemaObjectProperties.vue'\nimport SchemaProperty from './SchemaProperty.vue'\nimport type { SchemaOptions, SchemaRenderingProps } from './types'\n\nconst {\n scrollTargetId,\n expansion: expansionProp,\n schema: schemaProp,\n level = 0,\n depth = 0,\n name,\n compact,\n noncollapsible = false,\n hideHeading,\n hideDescription = false,\n additionalProperties,\n additionalPropertyCount,\n discriminator,\n breadcrumb,\n hideModelNames: hideModelNamesProp = false,\n options,\n schemaContext,\n compositionPath,\n cycleKey,\n} = defineProps<\n {\n schema?: SchemaObject\n /** Track how deep we've gone */\n level?: number\n /**\n * Real nesting depth. Not derived from `level`, whose stride differs per\n * edge (object +2, composition +1, non-object root +0).\n */\n depth?: number\n /* Show as a heading */\n name?: string\n /** A tighter layout with less borders and without a heading */\n compact?: boolean\n /** Shows a toggle to hide/show children */\n noncollapsible?: boolean\n /** Hide the heading */\n hideHeading?: boolean\n /** Hide the schema description */\n hideDescription?: boolean\n /** Show a special one way toggle for additional properties, also has a top border when open */\n additionalProperties?: boolean\n /** Number of request body properties hidden behind the overflow control. */\n additionalPropertyCount?: number\n /** Hide model names in type display */\n hideModelNames?: boolean\n /** Discriminator object */\n discriminator?: DiscriminatorObject\n /** Breadcrumb for the schema */\n breadcrumb?: string[]\n /** Event bus emitting actions */\n eventBus: WorkspaceEventBus | null\n /** Move the options into a single prop so they are easy to pass around */\n options: SchemaOptions\n /** When \"requestBody\", composition dropdown selection is synced with the example snippet */\n schemaContext?: string\n /** Internal path used to sync nested request body compositions with the code sample */\n compositionPath?: string[]\n /**\n * Stable identity of this schema node, derived from its raw (unresolved)\n * value by the parent. Used to detect self-referential cycles. See\n * {@link getCycleKey}.\n */\n cycleKey?: unknown\n } & SchemaRenderingProps\n>()\nconst { translate } = useLocalization()\n\nconst additionalPropertiesLabel = computed((): string => {\n if (additionalPropertyCount === undefined) {\n return translate('schema.showAdditionalProperties')\n }\n return translate(\n additionalPropertyCount === 1\n ? 'schema.showOneMoreProperty'\n : 'schema.showMoreProperties',\n { count: additionalPropertyCount },\n )\n})\n\nconst hideModelNames = computed(\n (): boolean => hideModelNamesProp || !!options.hideModelNames,\n)\n\n/**\n * The dynamic scope inherited from ancestor schema resources.\n *\n * Used to bind JSON Schema 2020-12 `$dynamicRef`s to the active `$dynamicAnchor` while walking the\n * tree. Empty at the root. See {@link useDynamicScope}.\n */\nconst dynamicScope = useDynamicScope()\n\n/**\n * The schema subtree, read through the magic and overrides proxies only.\n *\n * Everything below this point walks the subtree read-only, so the Vue reactive and\n * detect-changes layers are peeled off once here instead of being paid for on every nested\n * property access. See {@link unwrapForRead} for why that is safe and why the other two\n * layers stay. Reactivity on the prop itself is kept: the computed tracks the `schema` prop,\n * so replacing or switching the document still re-renders.\n */\nconst schema = computed((): SchemaObject | undefined =>\n unwrapForRead(schemaProp),\n)\n\n/**\n * The schema this node actually renders.\n *\n * Two normalizations happen here, both no-ops for ordinary schemas:\n * - A top-level `$dynamicRef` is bound to its concrete type via the inherited dynamic scope.\n * - A resource that extends a template through a root `$ref` (JSON Schema 2020-12 `$ref` alongside\n * `$defs`, e.g. a `PaginatedResponse` binding) is merged so its inherited properties render.\n */\nconst resolvedSchema = computed((): SchemaObject | undefined => {\n const value = schema.value\n\n if (!value || typeof value !== 'object') {\n return value\n }\n\n const bound = resolveDynamicSchema(value, dynamicScope)\n return '$ref' in bound ? resolve.schema(bound) : bound\n})\n\n/**\n * Re-provide the dynamic scope grown with this resource so nested `$dynamicRef`s bind here.\n *\n * Built once at setup from the resource's stable identity (like the ancestor set below);\n * `pushDynamicScope` only grows the scope for schemas that can carry a `$dynamicAnchor`.\n *\n * The raw schema is pushed, not the merged {@link resolvedSchema}: merging through `resolve.schema`\n * coerces the node and drops the resolved `$ref-value` from entries inside `$defs`, which\n * `$dynamicAnchor` resolution relies on to dereference the bound type (e.g. `User`).\n */\nconst scopeSchema = schema.value\n ? resolveDynamicSchema(schema.value, dynamicScope)\n : undefined\nprovide(\n SCHEMA_DYNAMIC_SCOPE_SYMBOL,\n scopeSchema ? pushDynamicScope(dynamicScope, scopeSchema) : dynamicScope,\n)\n\n/**\n * Cycle-safe `expandAllSchemaProperties`.\n *\n * We track ancestor schema keys along the current render path. A node is\n * treated as cyclic when its key is already present in the ancestor set, which\n * indicates that rendering has looped back onto a self-referential schema.\n *\n * This lets us default-expand finite branches while stopping automatic\n * expansion only at cycle boundaries, preventing infinite recursion.\n */\nconst ancestors = inject(SCHEMA_ANCESTORS_SYMBOL, undefined)\n\nconst isCyclic = computed(\n (): boolean => cycleKey != null && !!ancestors?.has(cycleKey),\n)\n\n// Re-provide the ancestor set augmented with this node so descendants can\n// detect cycles back to it. Built once at setup; a node's key is stable.\nconst childAncestors = new Set<unknown>(ancestors ?? [])\nif (cycleKey != null) {\n childAncestors.add(cycleKey)\n}\nprovide(SCHEMA_ANCESTORS_SYMBOL, childAncestors)\n\nconst shouldForceExpand = computed(\n (): boolean => !!options.expandAllSchemaProperties && !isCyclic.value,\n)\n\n/**\n * Whether this schema sits on the path to the current anchor/scroll target.\n *\n * Property anchors are dot-joined breadcrumbs, so every disclosure that wraps\n * the target has a breadcrumb that is a prefix of the target id. Opening those\n * disclosures is what makes deep links to collapsed (hidden) properties work\n * without forcing every schema open via `expandAllSchemaProperties`.\n */\nconst isOnTargetPath = computed((): boolean =>\n isOnSchemaTargetPath(toNodeKey(breadcrumb), scrollTargetId ?? ''),\n)\n\n/**\n * Whether the disclosure starts expanded. Non-collapsible schemas are always\n * open. When `expandAllSchemaProperties` is enabled, finite branches start\n * expanded by default while cyclic branches remain collapsed to avoid recursion\n * loops. We also open any disclosure on the path to the current scroll target so\n * deep links resolve even when the property is collapsed.\n *\n * This is only the last step of the store's resolution order: it applies when\n * nobody has touched this node and no bulk action or baseline covers it.\n */\nconst defaultOpen = computed(\n (): boolean =>\n noncollapsible || shouldForceExpand.value || isOnTargetPath.value,\n)\n\n/** Gets the description to show for the schema */\nconst schemaDescription = computed(() => {\n const value = resolvedSchema.value\n\n if (hideDescription) {\n return null\n }\n\n const rawSchema = schema.value\n\n // For the request body we want to show the description of the merged allOf schema.\n // Merging keeps the base description (when set) and otherwise lets the last allOf\n // member win, matching how the merged composition is rendered below. The nested\n // merged Schema in `SchemaComposition` hides its own description in this case so\n // the text is not rendered twice.\n if (\n rawSchema?.allOf &&\n rawSchema.allOf.length > 0 &&\n name === 'Request Body'\n ) {\n return mergeAllOfSchemas(rawSchema)?.description || null\n }\n\n // Don't show description if there's no description or it's not a string\n if (!value?.description || typeof value.description !== 'string') {\n return null\n }\n\n // Don't show description for enum schemas (they have special handling)\n if (value.enum) {\n return null\n }\n\n // Will be shown in the properties anyway. A composed schema is the exception:\n // its members render as their own cards with their own descriptions, so the\n // schema's own description has nowhere else to go.\n if (\n !('properties' in value) &&\n !('patternProperties' in value) &&\n !('additionalProperties' in value) &&\n !('allOf' in value)\n ) {\n return null\n }\n\n // An allOf object segment already displays the merged description. Keep a\n // distinct outer description, but do not repeat text carried by that segment.\n if (\n rawSchema?.allOf &&\n partitionAllOfCompositions(rawSchema).segments.some(\n (segment) =>\n segment.kind === 'object' &&\n segment.schema.description === value.description &&\n ('properties' in segment.schema ||\n 'patternProperties' in segment.schema ||\n 'additionalProperties' in segment.schema) &&\n !segment.schema.enum,\n )\n ) {\n return null\n }\n\n // Return the schema's own description\n return value.description\n})\n\n/**\n * Infer a selector for mapped discriminators that do not declare `oneOf`.\n * Threaded discriminators skip inference to avoid recursive allOf variants.\n */\nconst inferredDiscriminatorComposition = computed(() =>\n schema.value && !discriminator && isTypeObject(schema.value)\n ? inferDiscriminatorMappingComposition(schema.value, options.document)\n : null,\n)\n\n/**\n * Whether the panel holds the schema's property rows. Mirrors the branches in\n * the panel below: any other root (a composition, a primitive, an array)\n * renders a single nameless passthrough row that carries the real property\n * list inside it, and a list of one row is structure the eye never sees.\n * Announcing it makes assistive tech read \"list with 1 item\" before the list\n * the reader actually wanted, so that wrapper is presentational instead.\n */\nconst rendersPropertyRows = computed(\n (): boolean =>\n !inferredDiscriminatorComposition.value &&\n isTypeObject(resolvedSchema.value),\n)\n\n/**\n * Whether an enclosing Schema already established a tree root. `depth === 0`\n * alone is not enough: a nested Schema can mount at depth 0 (an `allOf`\n * member, or a caller that omits `depth`), and a second root would mount a\n * second sticky strip and keydown root, firing every arrow key twice.\n */\nconst hasTreeRootAbove = inject(SCHEMA_TREE_ROOT_SYMBOL, false)\n\n/** The root-only features (glyph tokens, keyboard navigation) live on the outermost tree root only */\nconst isTreeRoot = computed((): boolean => depth === 0 && !hasTreeRootAbove)\n\n// Descendants must know a root exists above them, whatever depth they mount at.\nprovide(SCHEMA_TREE_ROOT_SYMBOL, true)\n\n/** Delegated arrow-key navigation, active only when the flag is on */\nconst onTreeKeydown = (event: KeyboardEvent): void => {\n if (isTreeRoot.value && options.schemaKeyboardNav) {\n handleTreeKeydown(event)\n }\n}\n\nconst expansion =\n expansionProp ?? useSchemaExpansion(toRef(() => scrollTargetId ?? ''))\n\n/**\n * Fallback identity for nodes mounted without a breadcrumb (models, AsyncAPI\n * messages, the classic layouts). Until those surfaces pass real breadcrumbs,\n * this keeps them from all resolving to the empty key and toggling as one node.\n */\nconst anonymousKey = useId()\n\nconst nodeKey = computed(\n (): string => toNodeKey(breadcrumb) || `~anonymous-${anonymousKey}`,\n)\n\n/**\n * Whether this disclosure is open. Resolved from the store on every read, not\n * latched at mount, so a second deep link into an already-rendered operation\n * works and expansion survives the composition variant remount.\n */\nconst open = computed(\n (): boolean =>\n noncollapsible ||\n expansion.isExpanded(nodeKey.value, {\n cyclic: isCyclic.value,\n defaultOpen: defaultOpen.value,\n }),\n)\n\n/** Additional-property panels hide until opened; every other panel always renders */\nconst panelRendered = computed(\n (): boolean => !additionalProperties || open.value,\n)\n\nconst toggleId = useId()\nconst panelId = useId()\n\n/**\n * The reveal is one-way: its button hides once the panel opens, so nothing\n * here can collapse a subtree that holds focus. The rows inside handle that\n * themselves (see `toggleTree` in SchemaProperty.vue).\n */\nconst toggle = (): void => {\n if (noncollapsible) {\n return\n }\n\n expansion.setExpanded(nodeKey.value, !open.value)\n}\n</script>\n<template>\n <!--\n Not a Headless UI `<Disclosure>`: it has no controlled mode, and expansion\n is driven from the store, so the button and the panel are owned directly.\n -->\n <div\n v-if=\"resolvedSchema && Object.keys(resolvedSchema).length\"\n class=\"schema-card\"\n :class=\"[\n `schema-card--level-${level}`,\n { 'schema-card--compact': compact, 'schema-card--open': open },\n /*\n * No margin of its own: the row above already ends with its own 6px pad,\n * so the reveal keeps the tree's row-to-row rhythm exactly.\n */\n { 'additional-card--tree': additionalProperties },\n 'schema-card--tree',\n /*\n * Tree-local tokens, namespaced --schema-* so no preset or user theme\n * breaks. WCAG 1.4.11 wants 3:1 for the glyph; --scalar-color-3 measures\n * 3.28:1 only before opacity, so the glyph reads color-2. The narrow\n * container tightens the indent and the control sizes, but that lives at\n * app scope (styles/tailwind.config.css) with the other rail tokens: the\n * surfaces above a tree root draw rails too, and they must tighten with\n * it or their glyphs land on a different line.\n */\n {\n 'schema-tree [--schema-glyph-background:var(--scalar-background-1)] [--schema-glyph-color:var(--scalar-color-2)]':\n isTreeRoot,\n },\n ]\"\n @keydown=\"onTreeKeydown\">\n <ExternalDocs\n v-if=\"isTypeObject(resolvedSchema)\"\n class=\"my-2\"\n :value=\"resolvedSchema.externalDocs\" />\n <!-- Schema description -->\n <!-- Without a card box the level-0 divider (and its negative-margin tuck)\n would be a stray line, so the whole treatment is switched off -->\n <div\n v-if=\"schemaDescription\"\n class=\"schema-card-description [.schema-card--level-0:nth-of-type(1)>&]:has-[+.schema-properties]:mb-0! [.schema-card--level-0:nth-of-type(1)>&]:has-[+.schema-properties]:border-b-0! [.schema-card--level-0:nth-of-type(1)>&]:has-[+.schema-properties]:pb-0!\">\n <ScalarMarkdown :value=\"schemaDescription\" />\n </div>\n <div\n v-if=\"isEmptySchemaObject(resolvedSchema)\"\n class=\"text-c-2 py-1.5\">\n {{ translate('schema.emptyObject') }}\n </div>\n <!-- A rail per depth instead of a bordered box per level, so the card\n chrome is switched off. 6px under a description keeps the 12px row\n rhythm; at level 0 the divider is gone, so even that 6px would double\n up with the first row's own padding. -->\n <div\n class=\"schema-properties\"\n :class=\"[\n { 'schema-properties-open': open },\n 'w-full! rounded-none! border-0! [.schema-card--level-0:nth-of-type(1)>.schema-card-description+&]:mt-0! [.schema-card-description+&]:mt-1.5!',\n ]\">\n <!-- Toggle to collapse/expand long lists of properties -->\n <div\n v-if=\"additionalProperties\"\n v-show=\"!open\"\n class=\"schema-properties w-full! rounded-none! border-0!\">\n <!-- The reveal reads as one more row — mono label flush with the\n sibling rows' text, a plus puck centred on the sibling toggles'\n line. `min-h-8` is the row's own 32px: the label then centres in\n the same 20px slot a heading gets, so the first revealed property\n lands exactly where the label was instead of 2.5px below it. -->\n <button\n :id=\"toggleId\"\n :aria-controls=\"panelRendered ? panelId : undefined\"\n :aria-expanded=\"open\"\n class=\"schema-card-title schema-card-title--compact group/tree-control additional-toggle--tree font-code text-c-1! relative flex h-auto min-h-8 items-center gap-0! px-0! py-[var(--schema-row-pad,6px)]! text-sm! font-bold!\"\n type=\"button\"\n @click=\"toggle\">\n <!-- The reveal is one more row of the tree, so its plus is the same\n puck the row toggles draw, on the same gutter line -->\n <SchemaGlyphPuck class=\"additional-toggle-glyph\" />\n <span class=\"additional-toggle-label\">\n {{ additionalPropertiesLabel }}\n <ScreenReader v-if=\"name\">\n {{ translate('schema.forName', { name }) }}\n </ScreenReader>\n </span>\n </button>\n </div>\n\n <!-- The theme reset strips list-style, which makes Safari and VoiceOver\n drop list semantics; an explicit role restores them. When the panel\n holds a single passthrough row instead of property rows, the wrapper\n is presentational so only the real list nested inside it is\n announced. -->\n <ul\n v-if=\"panelRendered\"\n :id=\"panelId\"\n :role=\"rendersPropertyRows ? 'list' : 'presentation'\">\n <!-- Variant selector inferred from a discriminator mapping -->\n <SchemaComposition\n v-if=\"inferredDiscriminatorComposition\"\n :breadcrumb\n :compact\n composition=\"oneOf\"\n :compositionPath=\"compositionPath\"\n :depth=\"depth\"\n :discriminator=\"schema?.discriminator\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level=\"level\"\n :name=\"name\"\n :options\n :schema=\"inferredDiscriminatorComposition\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n <!-- Object properties -->\n <SchemaObjectProperties\n v-else-if=\"isTypeObject(resolvedSchema)\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :depth=\"depth\"\n :discriminator=\"discriminator ?? resolvedSchema?.discriminator\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level=\"level + 1\"\n :options\n :schema=\"resolvedSchema\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n <!-- Not an object -->\n <template v-else>\n <SchemaProperty\n v-if=\"resolvedSchema\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :depth=\"depth\"\n :discriminator\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading\n :hideModelNames\n :level\n :options\n :schema=\"resolvedSchema\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n </ul>\n </div>\n </div>\n</template>\n<style scoped>\n.error {\n background-color: var(--scalar-color-red);\n}\n.schema-card {\n font-size: var(--scalar-font-size-4);\n color: var(--scalar-color-1);\n}\n.schema-card-title {\n height: var(--schema-title-height);\n\n padding: 6px 8px;\n\n display: flex;\n align-items: center;\n gap: 4px;\n\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n font-size: var(--scalar-mini);\n border-bottom: var(--scalar-border-width) solid transparent;\n}\nbutton.schema-card-title {\n cursor: pointer;\n}\nbutton.schema-card-title:hover {\n color: var(--scalar-color-1);\n}\n.schema-properties-open > .schema-card-title {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.schema-properties-open > .schema-properties {\n width: fit-content;\n}\n.schema-card-description {\n color: var(--scalar-color-2);\n}\n.schema-card-description + .schema-properties {\n width: fit-content;\n}\n.schema-card-description + .schema-properties {\n margin-top: 8px;\n}\n.schema-card--level-0:nth-of-type(1)\n > .schema-card-description:has(+ .schema-properties) {\n margin-bottom: -8px;\n padding-bottom: 8px;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.schema-card--level-0\n ~ .schema-card--level-0\n > .schema-card-description:has(+ .schema-properties) {\n padding-top: 8px;\n}\n\n.schema-properties-open.schema-properties,\n.schema-properties-open > .schema-card--open {\n width: 100%;\n}\n.schema-properties {\n display: flex;\n flex-direction: column;\n\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius-lg);\n width: fit-content;\n}\n.schema-properties-name {\n width: 100%;\n}\n.schema-properties .schema-properties {\n border-radius: 13.5px;\n}\n.schema-properties .schema-properties.schema-properties-open {\n border-radius: var(--scalar-radius-lg);\n}\n.schema-properties-open {\n width: 100%;\n}\n.schema-card--compact {\n align-self: flex-start;\n}\n.schema-card--compact.schema-card--open {\n align-self: initial;\n}\n.schema-card-title--compact {\n color: var(--scalar-color-2);\n padding: 6px 10px 6px 8px;\n height: auto;\n border-bottom: none;\n}\n.schema-properties-open > .schema-card-title--compact {\n position: static;\n}\n.property--level-0\n > .schema-properties\n > .schema-card--level-0\n > .schema-properties {\n border: none;\n}\n.property--level-0\n .schema-card--level-0:not(.schema-card--compact)\n .property--level-1 {\n padding: 0 0 8px;\n}\n:not(.composition-panel)\n > .schema-card--compact.schema-card--level-0\n > .schema-properties {\n border: none;\n}\n:deep(.schema-card-description) p {\n font-size: var(--scalar-small, var(--scalar-paragraph));\n color: var(--scalar-color-2);\n margin-bottom: 0;\n display: block;\n margin-bottom: 6px;\n}\n.children .schema-card-description:first-of-type {\n padding-top: 0;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyGA,IAAM,EAAE,iBAAciC,GAAgB,GAEhCC,IAA4BC,QAC5BC,EAAA,4BAA4B,KAAA,IACvBC,EAAU,iCAAiC,IAE7CA,EACLD,EAAA,4BAA4B,IACxB,+BACA,6BACJ,EAAE,OAAOA,EAAA,wBAAwB,CACnC,CACD,GAEKE,IAAiBH,QACNC,EAAA,kBAAsB,CAAC,CAACA,EAAA,QAAQ,cACjD,GAQMG,IAAeC,GAAgB,GAW/BC,IAASN,QACbO,EAAcN,EAAA,MAAU,CAC1B,GAUMO,IAAiBR,QAAyC;GAC9D,IAAMS,IAAQH,EAAO;GAErB,IAAI,CAACG,KAAS,OAAOA,KAAU,UAC7B,OAAOA;GAGT,IAAMC,IAAQC,EAAqBF,GAAOL,CAAY;GACtD,OAAO,UAAUM,IAAQE,EAAQ,OAAOF,CAAK,IAAIA;EACnD,CAAC,GAYKG,IAAcP,EAAO,QACvBK,EAAqBL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A,EAAA;IAChB,wBAAwBA,EAAA"}
@@ -1,4 +1,4 @@
1
- import e from "./SchemaCollapsedPreview.vue.script.js";
1
+ import e from "./SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js";
2
2
  //#region src/schema/SchemaCollapsedPreview.vue
3
3
  var t = e;
4
4
  //#endregion