@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,258 +0,0 @@
1
- import { filterClientsByQuery as e } from "../helpers/filter-clients-by-query.js";
2
- import { findClient as t } from "../helpers/find-client.js";
3
- import { operationToHar as n } from "../helpers/operation-to-har/operation-to-har.js";
4
- import { generateCodeSnippet as ee } from "../helpers/generate-code-snippet.js";
5
- import { getCustomCodeSamples as te } from "../helpers/get-custom-code-samples.js";
6
- import { getClients as r } from "../helpers/get-clients.js";
7
- import { getSecrets as ne } from "../helpers/get-secrets.js";
8
- import re from "./ExamplePicker.vue.js";
9
- import i from "./HttpMethod.vue.js";
10
- import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createSlots as d, createTextVNode as f, createVNode as p, defineComponent as m, normalizeClass as ie, onBeforeMount as ae, openBlock as h, ref as g, renderSlot as _, toDisplayString as v, unref as y, useId as oe, watch as b, watchEffect as se, withCtx as x } from "vue";
11
- import { ScalarButton as S } from "@scalar/components/button";
12
- import { ScalarCard as C, ScalarCardFooter as ce, ScalarCardHeader as le, ScalarCardSection as w } from "@scalar/components/card";
13
- import { ScalarCodeBlock as ue } from "@scalar/components/code-block";
14
- import { ScalarCombobox as de } from "@scalar/components/combobox";
15
- import { ScalarVirtualText as fe } from "@scalar/components/virtual-text";
16
- import { freezeElement as pe } from "@scalar/helpers/dom/freeze-element";
17
- import { ScalarIconCaretDown as T } from "@scalar/icons";
18
- import { getResolvedRef as E } from "@scalar/workspace-store/helpers/get-resolved-ref";
19
- import { getOperationExamples as D, resolveOperationExamples as O } from "@scalar/workspace-store/helpers/operation-examples";
20
- import { useExampleVisibility as k, useExternalExamples as A } from "@scalar/workspace-store/helpers/use-external-examples";
21
- //#region src/code-example/components/CodeExample.vue?vue&type=script&setup=true&lang.ts
22
- var j = ["innerHTML"], M = {
23
- key: 1,
24
- class: "text-c-2 flex h-full w-fit items-center px-0.5 py-0 text-base font-normal",
25
- "data-testid": "client-picker"
26
- }, N = {
27
- key: 0,
28
- class: "text-c-2 p-4",
29
- role: "status"
30
- }, P = {
31
- key: 1,
32
- class: "text-c-2 p-4",
33
- role: "status"
34
- }, F = ["id"], I = {
35
- key: 0,
36
- class: "request-card-footer-addon"
37
- }, L = {
38
- key: 1,
39
- class: "request-card-footer-start"
40
- }, R = { class: "request-header" }, z = /*@__PURE__*/ m({
41
- __name: "CodeExample",
42
- props: {
43
- codeSampleUnavailable: { default: "No code sample available for this example." },
44
- clientPickerLabel: { default: "Change code sample language" },
45
- clientSearchLabel: { default: "Search clients" },
46
- codeSampleLabel: { default: "Code sample" },
47
- integration: {},
48
- clientOptions: {},
49
- selectedClient: {},
50
- selectedServer: { default: null },
51
- selectedContentType: {},
52
- selectedExample: {},
53
- eventBus: {},
54
- securitySchemes: { default: () => [] },
55
- method: {},
56
- path: {},
57
- operation: {},
58
- fallback: { type: Boolean },
59
- generateLabel: { type: Function },
60
- isWebhook: { type: Boolean },
61
- globalCookies: {},
62
- openapiVersion: {},
63
- requestBodyCompositionSelection: {}
64
- },
65
- emits: ["update:exampleKey"],
66
- setup(m, { emit: z }) {
67
- let B = z, V = o(() => {
68
- let e = E(m.operation.requestBody)?.content ?? {}, t = m.selectedContentType || Object.keys(e)[0];
69
- return t ? e[t]?.examples ?? {} : {};
70
- }), H = g(""), U = (e) => {
71
- let t = Object.keys(V.value);
72
- return e && t.includes(e) ? e : H.value && t.includes(H.value) ? H.value : t[0] ?? "";
73
- };
74
- ae(() => {
75
- H.value = U(m.selectedExample);
76
- }), b(() => m.selectedExample, (e) => {
77
- H.value = U(e);
78
- }), b(() => m.selectedContentType, () => {
79
- Object.keys(V.value).includes(H.value) || (H.value = U(m.selectedExample));
80
- }), se(() => {
81
- B("update:exampleKey", H.value);
82
- });
83
- let me = (e) => {
84
- H.value = e, m.eventBus.emit("workspace:update:selected-example", e);
85
- }, W = o(() => te(m.operation)), G = o(() => r(W.value.samples, m.clientOptions, W.value.label)), K = o(() => G.value.reduce((e, t) => e + t.options.length, 0)), q = g(t(G.value, m.selectedClient));
86
- b([() => m.selectedClient, G], ([e]) => {
87
- let n = t(G.value, e);
88
- n && (q.value = n);
89
- });
90
- let he = o(() => [m.clientPickerLabel, q.value?.title].filter(Boolean).join(": ")), ge = o(() => [m.codeSampleLabel, q.value?.title].filter(Boolean).join(": ")), J = g(null), _e = k(J), Y = A(() => D(m.operation, H.value, m.selectedContentType), () => _e.value), X = o(() => O(m.operation, H.value, m.selectedContentType, Y.resolve)), Z = o(() => Object.keys(V.value).length > 1), Q = o(() => {
91
- if (!m.isWebhook) return null;
92
- try {
93
- return n({
94
- operation: X.value,
95
- method: m.method,
96
- path: m.path,
97
- example: H.value,
98
- openapiVersion: m.openapiVersion,
99
- requestBodyCompositionSelection: m.requestBodyCompositionSelection,
100
- defaultDisabledParameters: !0
101
- });
102
- } catch (e) {
103
- return console.error("[webhookHar]", e), null;
104
- }
105
- }), $ = o(() => m.isWebhook ? Q.value?.postData?.text ?? "" : ee({
106
- defaultDisabledParameters: !0,
107
- includeDefaultHeaders: m.integration === "client",
108
- clientId: q.value?.id,
109
- customCodeSamples: W.value.samples,
110
- operation: X.value,
111
- method: m.method,
112
- path: m.path,
113
- contentType: m.selectedContentType,
114
- server: m.selectedServer,
115
- securitySchemes: m.securitySchemes,
116
- example: H.value,
117
- globalCookies: m.globalCookies,
118
- openapiVersion: m.openapiVersion,
119
- requestBodyCompositionSelection: m.requestBodyCompositionSelection
120
- })), ve = o(() => m.isWebhook ? ye.value : q.value?.lang), ye = o(() => {
121
- if (!Q.value?.postData) return "json";
122
- let e = Q.value.postData.mimeType;
123
- return e?.includes("json") ? "json" : e?.includes("xml") ? "xml" : e?.includes("yaml") || e?.includes("yml") ? "yaml" : e?.includes("text/plain") ? "text" : "json";
124
- }), be = o(() => ne(m.securitySchemes)), xe = (e) => {
125
- if (J.value) {
126
- let e = pe(J.value.$el);
127
- setTimeout(() => {
128
- e();
129
- }, 300);
130
- }
131
- q.value = e, e && m.eventBus.emit("workspace:update:selected-client", e.id);
132
- }, Se = o(() => ($.value?.length ?? 0) > 2e4), Ce = oe();
133
- return (t, n) => $.value === null || $.value || y(Y).pending.value ? (h(), s(y(C), {
134
- key: 0,
135
- ref_key: "elem",
136
- ref: J,
137
- class: "request-card dark-mode"
138
- }, {
139
- default: x(() => [
140
- p(y(le), { class: "pr-2.5" }, d({
141
- default: x(() => [
142
- n[1] ||= u("span", { class: "sr-only" }, "Request Example for", -1),
143
- p(i, {
144
- as: "span",
145
- class: "request-method",
146
- method: m.method
147
- }, null, 8, ["method"]),
148
- m.generateLabel ? (h(), l("span", {
149
- key: 0,
150
- innerHTML: m.generateLabel()
151
- }, null, 8, j)) : c("", !0),
152
- _(t.$slots, "header", {}, void 0, !0)
153
- ]),
154
- _: 2
155
- }, [!m.isWebhook && K.value ? {
156
- name: "actions",
157
- fn: x(() => [K.value > 1 ? (h(), s(y(de), {
158
- key: 0,
159
- class: "max-h-80",
160
- filterFn: y(e),
161
- inputLabel: m.clientSearchLabel,
162
- modelValue: q.value,
163
- options: G.value,
164
- placement: "bottom-end",
165
- teleport: "",
166
- "onUpdate:modelValue": n[0] ||= (e) => xe(e)
167
- }, {
168
- default: x(() => [p(y(S), {
169
- "aria-label": he.value,
170
- class: "text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-0.5 py-0 text-base font-normal",
171
- "data-testid": "client-picker",
172
- variant: "ghost"
173
- }, {
174
- default: x(() => [f(v(q.value?.title) + " ", 1), p(y(T), {
175
- class: "ui-open:rotate-180 mt-px size-3 transition-transform duration-100",
176
- weight: "bold"
177
- })]),
178
- _: 1
179
- }, 8, ["aria-label"])]),
180
- _: 1
181
- }, 8, [
182
- "filterFn",
183
- "inputLabel",
184
- "modelValue",
185
- "options"
186
- ])) : (h(), l("span", M, v(q.value?.title), 1))]),
187
- key: "0"
188
- } : void 0]), 1024),
189
- p(y(w), { class: "request-editor-section custom-scroll p-0" }, {
190
- default: x(() => [y(Y).pending.value ? (h(), l("div", N, [y(Y).failed.value ? (h(), l(a, { key: 0 }, [n[3] ||= f(" Could not load this example. ", -1), p(y(S), {
191
- size: "sm",
192
- variant: "ghost",
193
- onClick: y(Y).retry
194
- }, {
195
- default: x(() => [...n[2] ||= [f(" Retry ", -1)]]),
196
- _: 1
197
- }, 8, ["onClick"])], 64)) : (h(), l(a, { key: 1 }, [f("Loading example…")], 64))])) : $.value === null ? (h(), l("div", P, v(m.codeSampleUnavailable), 1)) : (h(), l("div", {
198
- key: 2,
199
- id: `${y(Ce)}-example`,
200
- class: "code-snippet"
201
- }, [Se.value ? (h(), s(y(fe), {
202
- key: 1,
203
- "aria-label": "Request code sample",
204
- containerClass: "custom-scroll scalar-code-block border rounded-b flex flex-1 max-h-screen",
205
- contentClass: "language-plaintext whitespace-pre font-code text-base p-2",
206
- lineHeight: 20,
207
- role: "region",
208
- text: $.value
209
- }, null, 8, ["text"])) : (h(), s(y(ue), {
210
- key: 0,
211
- class: "bg-b-2 h-full",
212
- content: $.value,
213
- hideCredentials: be.value,
214
- label: ge.value,
215
- lang: ve.value,
216
- lineNumbers: ""
217
- }, null, 8, [
218
- "content",
219
- "hideCredentials",
220
- "label",
221
- "lang"
222
- ]))], 8, F))]),
223
- _: 1
224
- }),
225
- Z.value || t.$slots.footer || t.$slots["footer-start"] ? (h(), s(y(ce), {
226
- key: 0,
227
- class: ie(["request-card-footer bg-b-3", { "request-card-footer--wraps": !Z.value && t.$slots["footer-start"] }])
228
- }, {
229
- default: x(() => [Z.value ? (h(), l("div", I, [Object.keys(V.value).length ? (h(), s(re, {
230
- key: 0,
231
- examples: V.value,
232
- modelValue: H.value,
233
- "onUpdate:modelValue": me
234
- }, null, 8, ["examples", "modelValue"])) : c("", !0)])) : t.$slots["footer-start"] ? (h(), l("div", L, [_(t.$slots, "footer-start", {}, void 0, !0)])) : c("", !0), _(t.$slots, "footer", { exampleName: H.value }, void 0, !0)]),
235
- _: 3
236
- }, 8, ["class"])) : c("", !0)
237
- ]),
238
- _: 3
239
- }, 512)) : m.fallback ? (h(), s(y(C), {
240
- key: 1,
241
- class: "request-card dark-mode"
242
- }, {
243
- default: x(() => [p(y(w), { class: "request-card-simple" }, {
244
- default: x(() => [u("div", R, [p(i, {
245
- as: "span",
246
- class: "request-method",
247
- method: m.method
248
- }, null, 8, ["method"]), _(t.$slots, "header", {}, void 0, !0)]), _(t.$slots, "footer", { exampleName: H.value }, void 0, !0)]),
249
- _: 3
250
- })]),
251
- _: 3
252
- })) : c("", !0);
253
- }
254
- });
255
- //#endregion
256
- export { z as default };
257
-
258
- //# sourceMappingURL=CodeExample.vue.script.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CodeExample.vue.script.js","names":["$slots"],"sources":["../../../src/code-example/components/CodeExample.vue"],"sourcesContent":["<script lang=\"ts\">\nexport type CodeExampleProps = {\n /** Localized status text shown when the selected example has no linked code sample. */\n codeSampleUnavailable?: string\n /**\n * Localized purpose of the client picker. It opens the button's accessible name and the\n * selected client's title is appended, so the name still contains the visible label.\n */\n clientPickerLabel?: string\n /** Localized accessible name for the search field inside the client picker. */\n clientSearchLabel?: string\n /**\n * Localized accessible name for the focusable code sample. The selected client's title is\n * appended so the announcement also says which language the sample is in.\n */\n codeSampleLabel?: string\n /**\n * Integration type: determines if the code sample is displayed in a client environment\n * or in an API reference environment.\n */\n integration?: 'client' | 'reference'\n /**\n * List of all http clients formatted into option groups for the client selector\n */\n clientOptions: ClientOptionGroup[]\n /**\n * Pre-selected client, this will determine which client is initially selected in the dropdown.\n * Either a built-in client id (e.g. `js/fetch`) or a custom sample id (e.g. `custom/python`).\n *\n * Typed as a plain string: unioning the (large) client-id union with the `custom/...`\n * ids overflows TypeScript's union-complexity limit inside this component's `defineProps`.\n *\n * @defaults to a custom sample if one is available, otherwise shell/curl\n */\n selectedClient?: string\n /**\n * Which server from the spec to use for the code example\n */\n selectedServer?: ServerObject | null\n /**\n * The selected content type from the requestBody.content, this will determine which examples are available\n * as well as the content type of the code example\n *\n * @defaults to the first content type if not provided\n */\n selectedContentType?: string\n /**\n * Example name to use for resolving example values for parameters AND requestBody.\n *\n * This is the document-wide selection: it is honored only when this operation defines an example\n * with the same key, so picking an example on one operation syncs the rest without blanking out\n * operations that do not share that key.\n *\n * @example \"limited\"\n * ```ts\n * parameters: {\n * name: 'foobar',\n * in: 'query',\n * examples: {\n * limited: {\n * dataValue: 10,\n * }\n * }\n * },\n * body: {\n * content: {\n * 'application/json': {\n * examples: {\n * limited: {\n * dataValue: { foo: 'bar' },\n * }\n * }\n * }\n * }\n * }\n *\n * ```\n */\n selectedExample?: string\n /**\n * Event bus\n */\n eventBus: WorkspaceEventBus\n /**\n * The security schemes which are applicable to this operation\n */\n securitySchemes: SecuritySchemeObjectSecret[]\n /**\n * HTTP method of the operation\n */\n method: string\n /**\n * Path of the operation\n */\n path: string\n /**\n * De-referenced OpenAPI Operation object\n */\n operation: OperationObject\n /**\n * If true and there's no example, we will display a small card with the method and path only\n */\n fallback?: boolean\n /**\n * A method to generate the label of the block, should return an html string\n */\n generateLabel?: () => string\n /**\n * If true, render this as a webhook request example\n */\n isWebhook?: boolean\n /**\n * Workspace + document cookies\n */\n globalCookies?: XScalarCookie[]\n /**\n * When the request body schema uses oneOf/anyOf, use these selected variants\n * for the example snippet (e.g. from the schema dropdowns in the API reference).\n */\n /** Originating OpenAPI version, used for XML mapping rules. */\n openapiVersion?: string\n requestBodyCompositionSelection?: Record<string, number>\n}\n\n/**\n * Request Example\n *\n * The core component for rendering a request example block,\n * this component does not have much of its own state but operates on props and custom events\n *\n * @event workspace:update:selected-client - Emitted when the selected client changes\n * @event workspace:update:selected-example - Emitted when the selected example changes, so other operations can sync\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport {\n ScalarCard,\n ScalarCardFooter,\n ScalarCardHeader,\n ScalarCardSection,\n} from '@scalar/components/card'\nimport { ScalarCodeBlock } from '@scalar/components/code-block'\nimport { ScalarCombobox } from '@scalar/components/combobox'\nimport { ScalarVirtualText } from '@scalar/components/virtual-text'\nimport { freezeElement } from '@scalar/helpers/dom/freeze-element'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n getOperationExamples,\n resolveOperationExamples,\n} from '@scalar/workspace-store/helpers/operation-examples'\nimport {\n useExampleVisibility,\n useExternalExamples,\n} from '@scalar/workspace-store/helpers/use-external-examples'\nimport type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type {\n OperationObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport {\n computed,\n onBeforeMount,\n ref,\n useId,\n watch,\n watchEffect,\n type ComponentPublicInstance,\n} from 'vue'\n\nimport { filterClientsByQuery } from '../helpers/filter-clients-by-query'\nimport { findClient } from '../helpers/find-client'\nimport { generateCodeSnippet } from '../helpers/generate-code-snippet'\nimport { getClients } from '../helpers/get-clients'\nimport { getCustomCodeSamples } from '../helpers/get-custom-code-samples'\nimport { getSecrets } from '../helpers/get-secrets'\nimport { operationToHar } from '../helpers/operation-to-har/operation-to-har'\nimport type {\n ClientOption,\n ClientOptionGroup,\n CustomClientOption,\n} from '../types'\nimport ExamplePicker from './ExamplePicker.vue'\nimport HttpMethod from './HttpMethod.vue'\n\nconst {\n integration,\n codeSampleUnavailable = 'No code sample available for this example.',\n clientPickerLabel = 'Change code sample language',\n clientSearchLabel = 'Search clients',\n codeSampleLabel = 'Code sample',\n clientOptions,\n selectedClient,\n selectedServer = null,\n selectedContentType,\n selectedExample,\n securitySchemes = [],\n method,\n eventBus,\n path,\n operation,\n isWebhook,\n generateLabel,\n globalCookies,\n openapiVersion,\n requestBodyCompositionSelection,\n} = defineProps<CodeExampleProps>()\n\nconst emit = defineEmits<{\n /**\n * Emitted whenever the example key actually shown for this operation changes.\n *\n * This is the resolved local key (not the raw document-wide selection), so layouts that render\n * the test-request button outside this component can open the client with the same example the\n * snippet displays.\n */\n (e: 'update:exampleKey', value: string): void\n}>()\n\ndefineSlots<{\n 'header': () => unknown\n /** Rendered at the start of the footer, only while the example picker does not need that space */\n 'footer-start'?: () => unknown\n 'footer': ({ exampleName }: { exampleName: string }) => unknown\n}>()\n\n/** Grab the examples for the given content type */\nconst requestBodyExamples = computed(() => {\n const content = getResolvedRef(operation.requestBody)?.content ?? {}\n const contentType = selectedContentType || Object.keys(content)[0]\n if (!contentType) return {}\n\n const examples = content[contentType]?.examples ?? {}\n\n return examples\n})\n\n/**\n * The example key actually shown for this operation.\n *\n * `selectedExample` is the document-wide selection that syncs across operations. We honor it only\n * when this operation actually defines that key, otherwise we keep the local example: a selection\n * on one operation should never blank out an operation that does not share the same example.\n */\nconst localExampleKey = ref('')\n\n/** Resolve the key to display, preferring the document-wide selection when this operation has it */\nconst resolveExampleKey = (preferred: string | undefined): string => {\n const keys = Object.keys(requestBodyExamples.value)\n if (preferred && keys.includes(preferred)) {\n return preferred\n }\n // Keep the current local example when it is still valid, otherwise fall back to the first one\n if (localExampleKey.value && keys.includes(localExampleKey.value)) {\n return localExampleKey.value\n }\n return keys[0] ?? ''\n}\n\n// Set the initial example from the document-wide selection, falling back to the first example\nonBeforeMount(() => {\n localExampleKey.value = resolveExampleKey(selectedExample)\n})\n\n// Follow the document-wide selection when it changes and this operation has that example\nwatch(\n () => selectedExample,\n (preferred) => {\n localExampleKey.value = resolveExampleKey(preferred)\n },\n)\n\n/** Reset the selected example key if the content type changes and the new content type doesn't have the previously selected example */\nwatch(\n () => selectedContentType,\n () => {\n if (\n !Object.keys(requestBodyExamples.value).includes(localExampleKey.value)\n ) {\n // Re-resolve so the new content type still follows the document-wide selection when it has\n // that key, instead of always snapping back to the first example\n localExampleKey.value = resolveExampleKey(selectedExample)\n }\n },\n)\n\n// Keep the parent informed of the resolved key so a test-request button rendered outside this\n// component (e.g. the classic layout header) opens the client with the example the snippet shows\nwatchEffect(() => {\n emit('update:exampleKey', localExampleKey.value)\n})\n\n/** Select an example locally and sync the choice across the document */\nconst selectExample = (key: string) => {\n localExampleKey.value = key\n eventBus.emit('workspace:update:selected-example', key)\n}\n\n/** Grab any custom code samples from the operation */\nconst customCodeSamples = computed(() => getCustomCodeSamples(operation))\n\n/** Merge custom code samples with the client options */\nconst clients = computed(() =>\n getClients(\n customCodeSamples.value.samples,\n clientOptions,\n customCodeSamples.value.label,\n ),\n)\n\n/** Total number of available clients across all option groups */\nconst clientCount = computed(() =>\n clients.value.reduce((total, group) => total + group.options.length, 0),\n)\n\n/** The locally selected client which would include code samples from this operation only */\nconst localSelectedClient = ref<ClientOption | CustomClientOption | undefined>(\n findClient(clients.value, selectedClient),\n)\n\n/**\n * Re-resolve the local client whenever the global selection or the available\n * clients change. Watching `clients` matters when navigating between operations:\n * the stored id stays the same, but the matching option (e.g. a custom sample)\n * differs per operation, so without this the snippet could go stale.\n */\nwatch([() => selectedClient, clients], ([newClient]) => {\n const client = findClient(clients.value, newClient)\n if (client) {\n localSelectedClient.value = client\n }\n})\n\n/**\n * Accessible name for the client picker.\n *\n * On its own the button reads as its current value (\"C Libcurl\"), which never\n * says what activating it does. The visible title stays part of the name so it\n * still matches what is on screen.\n */\nconst clientPickerAriaLabel = computed(() =>\n [clientPickerLabel, localSelectedClient.value?.title]\n .filter(Boolean)\n .join(': '),\n)\n\n/**\n * Accessible name for the focusable code sample, e.g. \"Code sample: Shell cURL\".\n *\n * Screen readers announce only the name and role when focus lands on the scroller, so the\n * name tells the user both what the region is and which client it is generated for.\n */\nconst codeSampleAriaLabel = computed(() =>\n [codeSampleLabel, localSelectedClient.value?.title]\n .filter(Boolean)\n .join(': '),\n)\n\nconst elem = ref<ComponentPublicInstance | null>(null)\nconst visible = useExampleVisibility(elem)\nconst externalExamples = useExternalExamples(\n () =>\n getOperationExamples(operation, localExampleKey.value, selectedContentType),\n () => visible.value,\n)\nconst resolvedOperation = computed(() =>\n resolveOperationExamples(\n operation,\n localExampleKey.value,\n selectedContentType,\n externalExamples.resolve,\n ),\n)\n\n/** Keep the picker available because it also selects the example opened by Test Request. */\nconst showExamplePicker = computed(\n () => Object.keys(requestBodyExamples.value).length > 1,\n)\n\n/** Generate HAR data for webhook requests */\nconst webhookHar = computed(() => {\n if (!isWebhook) return null\n\n try {\n return operationToHar({\n operation: resolvedOperation.value,\n method,\n path,\n example: localExampleKey.value,\n openapiVersion,\n requestBodyCompositionSelection,\n // Only required parameters are shown in code examples; optional parameters\n // are omitted unless explicitly enabled via `x-disabled: false`.\n defaultDisabledParameters: true,\n })\n } catch (error) {\n console.error('[webhookHar]', error)\n return null\n }\n})\n\n/** Generate the code snippet for the selected example */\nconst generatedCode = computed<string | null>(() => {\n if (isWebhook) {\n return webhookHar.value?.postData?.text ?? ''\n }\n\n return generateCodeSnippet({\n // Only required parameters are shown in code examples; optional parameters\n // are omitted unless explicitly enabled via `x-disabled: false`.\n defaultDisabledParameters: true,\n includeDefaultHeaders: integration === 'client',\n clientId: localSelectedClient.value?.id,\n customCodeSamples: customCodeSamples.value.samples,\n operation: resolvedOperation.value,\n method,\n path,\n contentType: selectedContentType,\n server: selectedServer,\n securitySchemes,\n example: localExampleKey.value,\n globalCookies,\n openapiVersion,\n requestBodyCompositionSelection,\n })\n})\n\n/** The language for the code block, used for syntax highlighting */\nconst codeBlockLanguage = computed(() => {\n if (isWebhook) {\n return webhookLanguage.value\n }\n\n return localSelectedClient.value?.lang\n})\n\n/** Determine the language for webhook content based on MIME type */\nconst webhookLanguage = computed<string>(() => {\n if (!webhookHar.value?.postData) return 'json'\n\n const contentType = webhookHar.value.postData.mimeType\n if (contentType?.includes('json')) return 'json'\n if (contentType?.includes('xml')) return 'xml'\n if (contentType?.includes('yaml') || contentType?.includes('yml'))\n return 'yaml'\n if (contentType?.includes('text/plain')) return 'text'\n\n return 'json'\n})\n\n/** Block secrets from being shown in the code block */\nconst secretCredentials = computed(() => getSecrets(securitySchemes))\n\n/** Set custom example, or update the selected HTTP client globally */\nconst selectClient = (option: ClientOption) => {\n // We need to freeze the ui to prevent scrolling as the clients change\n if (elem.value) {\n const unfreeze = freezeElement(elem.value.$el)\n setTimeout(() => {\n unfreeze()\n }, 300)\n }\n // Update to the local example\n localSelectedClient.value = option\n\n // Sync the selection globally so other operations follow along. Custom samples\n // sync too (keyed by language), so picking e.g. the Python SDK example here\n // shows the Python example on every operation that ships one.\n if (option) {\n eventBus.emit('workspace:update:selected-client', option.id)\n }\n}\n\n// Virtualize the code block if it's too large\n// This prevents the entire app from freezing up if there's a massive example\n// We set a lower threshold here as code examples can get quite large\nconst VIRTUALIZATION_THRESHOLD = 20_000\n\nconst shouldVirtualize = computed(\n () => (generatedCode.value?.length ?? 0) > VIRTUALIZATION_THRESHOLD,\n)\n\nconst id = useId()\n</script>\n<template>\n <ScalarCard\n v-if=\"\n generatedCode === null || generatedCode || externalExamples.pending.value\n \"\n ref=\"elem\"\n class=\"request-card dark-mode\">\n <!-- Header -->\n <ScalarCardHeader class=\"pr-2.5\">\n <span class=\"sr-only\">Request Example for</span>\n <HttpMethod\n as=\"span\"\n class=\"request-method\"\n :method=\"method\" />\n <span\n v-if=\"generateLabel\"\n v-html=\"generateLabel()\" />\n <slot name=\"header\" />\n <!-- Client picker -->\n <template\n v-if=\"!isWebhook && clientCount\"\n #actions>\n <!-- Multiple clients: render a dropdown to switch between them -->\n <ScalarCombobox\n v-if=\"clientCount > 1\"\n class=\"max-h-80\"\n :filterFn=\"filterClientsByQuery\"\n :inputLabel=\"clientSearchLabel\"\n :modelValue=\"localSelectedClient\"\n :options=\"clients\"\n placement=\"bottom-end\"\n teleport\n @update:modelValue=\"selectClient($event as ClientOption)\">\n <ScalarButton\n :aria-label=\"clientPickerAriaLabel\"\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-0.5 py-0 text-base font-normal\"\n data-testid=\"client-picker\"\n variant=\"ghost\">\n {{ localSelectedClient?.title }}\n <ScalarIconCaretDown\n class=\"ui-open:rotate-180 mt-px size-3 transition-transform duration-100\"\n weight=\"bold\" />\n </ScalarButton>\n </ScalarCombobox>\n <!-- Single client: just show its label, no need for a dropdown -->\n <span\n v-else\n class=\"text-c-2 flex h-full w-fit items-center px-0.5 py-0 text-base font-normal\"\n data-testid=\"client-picker\">\n {{ localSelectedClient?.title }}\n </span>\n </template>\n </ScalarCardHeader>\n\n <!-- Code snippet -->\n <ScalarCardSection class=\"request-editor-section custom-scroll p-0\">\n <div\n v-if=\"externalExamples.pending.value\"\n class=\"text-c-2 p-4\"\n role=\"status\">\n <template v-if=\"externalExamples.failed.value\">\n Could not load this example.\n <ScalarButton\n size=\"sm\"\n variant=\"ghost\"\n @click=\"externalExamples.retry\">\n Retry\n </ScalarButton>\n </template>\n <template v-else>Loading example…</template>\n </div>\n <div\n v-else-if=\"generatedCode === null\"\n class=\"text-c-2 p-4\"\n role=\"status\">\n {{ codeSampleUnavailable }}\n </div>\n <div\n v-else\n :id=\"`${id}-example`\"\n class=\"code-snippet\">\n <ScalarCodeBlock\n v-if=\"!shouldVirtualize\"\n class=\"bg-b-2 h-full\"\n :content=\"generatedCode\"\n :hideCredentials=\"secretCredentials\"\n :label=\"codeSampleAriaLabel\"\n :lang=\"codeBlockLanguage\"\n lineNumbers />\n <ScalarVirtualText\n v-else\n aria-label=\"Request code sample\"\n containerClass=\"custom-scroll scalar-code-block border rounded-b flex flex-1 max-h-screen\"\n contentClass=\"language-plaintext whitespace-pre font-code text-base p-2\"\n :lineHeight=\"20\"\n role=\"region\"\n :text=\"generatedCode\" />\n </div>\n </ScalarCardSection>\n\n <!-- Footer -->\n <ScalarCardFooter\n v-if=\"showExamplePicker || $slots.footer || $slots['footer-start']\"\n class=\"request-card-footer bg-b-3\"\n :class=\"{\n 'request-card-footer--wraps':\n !showExamplePicker && $slots['footer-start'],\n }\">\n <!-- Example picker -->\n <div\n v-if=\"showExamplePicker\"\n class=\"request-card-footer-addon\">\n <template v-if=\"Object.keys(requestBodyExamples).length\">\n <ExamplePicker\n :examples=\"requestBodyExamples\"\n :modelValue=\"localExampleKey\"\n @update:modelValue=\"selectExample\" />\n </template>\n </div>\n <!-- Otherwise the start of the footer is free for the caller -->\n <div\n v-else-if=\"$slots['footer-start']\"\n class=\"request-card-footer-start\">\n <slot name=\"footer-start\" />\n </div>\n\n <!-- Footer -->\n <slot\n :exampleName=\"localExampleKey\"\n name=\"footer\" />\n </ScalarCardFooter>\n </ScalarCard>\n\n <!-- Fallback card with just method and path in the case of no examples -->\n <ScalarCard\n v-else-if=\"fallback\"\n class=\"request-card dark-mode\">\n <ScalarCardSection class=\"request-card-simple\">\n <div class=\"request-header\">\n <HttpMethod\n as=\"span\"\n class=\"request-method\"\n :method=\"method\" />\n <slot name=\"header\" />\n </div>\n <slot\n :exampleName=\"localExampleKey\"\n name=\"footer\" />\n </ScalarCardSection>\n </ScalarCard>\n</template>\n<style scoped>\n.request-card {\n color: var(--scalar-color-1);\n font-size: var(--scalar-font-size-3);\n}\n.request-method {\n font-family: var(--scalar-font-code);\n margin-right: 6px;\n}\n.request-card-footer {\n display: flex;\n justify-content: flex-end;\n padding: 6px;\n flex-shrink: 0;\n position: relative;\n}\n/*\n * Footer-start content keeps its full width; when the footer is too narrow for everything,\n * the end controls wrap onto a second line instead of squeezing or covering it.\n */\n.request-card-footer--wraps {\n flex-wrap: wrap;\n row-gap: 4px;\n}\n.request-card-footer-start {\n display: flex;\n align-items: center;\n flex: 1 0 auto;\n}\n.request-card-footer-addon {\n display: flex;\n align-items: center;\n\n flex: 1;\n min-width: 0;\n}\n.request-editor-section {\n display: flex;\n flex: 1;\n}\n.request-card-simple {\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n padding: 8px 8px 8px 12px;\n\n font-size: var(--scalar-small);\n}\n.code-snippet {\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqNA,IAAM,IAAO,GAmBP,IAAsB,QAAe;GACzC,IAAM,IAAU,EAAe,EAAA,UAAU,WAAW,CAAC,EAAE,WAAW,CAAC,GAC7D,IAAc,EAAA,uBAAuB,OAAO,KAAK,CAAO,CAAC,CAAC;GAKhE,OAJK,IAEY,EAAQ,EAAY,EAAE,YAAY,CAAC,IAF3B,CAAC;EAK5B,CAAC,GASK,IAAkB,EAAI,EAAE,GAGxB,KAAqB,MAA0C;GACnE,IAAM,IAAO,OAAO,KAAK,EAAoB,KAAK;GAQlD,OAPI,KAAa,EAAK,SAAS,CAAS,IAC/B,IAGL,EAAgB,SAAS,EAAK,SAAS,EAAgB,KAAK,IACvD,EAAgB,QAElB,EAAK,MAAM;EACpB;EA+BA,AA5BA,SAAoB;GAClB,EAAgB,QAAQ,EAAkB,EAAA,eAAe;EAC3D,CAAC,GAGD,QACQ,EAAA,kBACL,MAAc;GACb,EAAgB,QAAQ,EAAkB,CAAS;EACrD,CACF,GAGA,QACQ,EAAA,2BACA;GACJ,AACG,OAAO,KAAK,EAAoB,KAAK,CAAC,CAAC,SAAS,EAAgB,KAAK,MAItE,EAAgB,QAAQ,EAAkB,EAAA,eAAe;EAE7D,CACF,GAIA,SAAkB;GAChB,EAAK,qBAAqB,EAAgB,KAAK;EACjD,CAAC;EAGD,IAAM,MAAiB,MAAgB;GAErC,AADA,EAAgB,QAAQ,GACxB,EAAA,SAAS,KAAK,qCAAqC,CAAG;EACxD,GAGM,IAAoB,QAAe,GAAqB,EAAA,SAAS,CAAC,GAGlE,IA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CAAA,GAAA;;GAbX,OAAM;;oBAYc,CAXpB,EAWoB,EAAA,CAAA,GAAA,EAXD,OAAM,sBAAqB,GAAA;qBAOtC,CANN,EAMM,OANN,GAMM,CALJ,EAGqB,GAAA;KAFnB,IAAG;KACH,OAAM;KACL,QAAQ,EAAA;6BACX,EAAsB,EAAA,QAAA,UAAA,CAAA,GAAA,KAAA,GAAA,EAAA,CAAA,CAAA,GAExB,EAEkB,EAAA,QAAA,UAAA,EADf,aAAa,EAAA,MAAe,GAAA,KAAA,GAAA,EAAA,CAAA,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExamplePicker.vue.script.js","names":["$attrs"],"sources":["../../../src/code-example/components/ExamplePicker.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport {\n ScalarListbox,\n type ScalarListboxOption,\n} from '@scalar/components/listbox'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport type { MediaTypeObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nconst { examples = {} } = defineProps<{\n examples?: MediaTypeObject['examples'] | Record<string, string>\n}>()\n\nconst selectedExampleKey = defineModel<string>({\n required: true,\n})\n\ndefineOptions({ inheritAttrs: false })\n\nconst exampleOptions = computed<ScalarListboxOption[]>(() =>\n Object.entries(examples).map(([key, example]) => ({\n id: key,\n label: example?.summary ?? key,\n })),\n)\n\nconst selectedExample = computed<ScalarListboxOption | undefined>({\n get: () =>\n exampleOptions.value.find(({ id }) => id === selectedExampleKey.value),\n set: (v) => (selectedExampleKey.value = v?.id ?? ''),\n})\n</script>\n\n<template>\n <ScalarListbox\n v-model=\"selectedExample\"\n class=\"w-fit min-w-32\"\n :options=\"exampleOptions\"\n placement=\"bottom-start\"\n teleport>\n <ScalarButton\n class=\"text-c-2 hover:text-c-1 flex h-full w-fit min-w-0 gap-1.5 px-1.5 py-0.75 text-base font-normal\"\n data-testid=\"example-picker\"\n variant=\"ghost\"\n v-bind=\"$attrs\">\n <div class=\"min-w-0 flex-1 truncate\">\n {{ selectedExample?.label ?? 'Select an example' }}\n </div>\n <ScalarIconCaretDown\n class=\"ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100\"\n weight=\"bold\" />\n </ScalarButton>\n </ScalarListbox>\n</template>\n"],"mappings":";;;;;;;;;;;;;;EAcA,IAAM,IAAqB,EAAmB,GAAA,YAE7C,GAIK,IAAiB,QACrB,OAAO,QAAQ,EAAA,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAK,QAAc;GAChD,IAAI;GACJ,OAAO,GAAS,WAAW;EAC7B,EAAE,CACJ,GAEM,IAAkB,EAA0C;GAChE,WACE,EAAe,MAAM,MAAM,EAAE,YAAS,MAAO,EAAmB,KAAK;GACvE,MAAM,MAAO,EAAmB,QAAQ,GAAG,MAAM;EACnD,CAAC;yBAIC,EAkBgB,EAAA,CAAA,GAAA;eAjBL,EAAA;4CAAe,QAAA;GACxB,OAAM;GACL,SAAS,EAAA;GACV,WAAU;GACV,UAAA;;oBAYe,CAXf,EAWe,EAAA,CAAA,GAXf,EAWe;IAVb,OAAM;IACN,eAAY;IACZ,SAAQ;MACAA,EAAAA,MAAM,GAAA;qBAGR,CAFN,EAEM,OAFN,GAEM,EADD,EAAA,OAAiB,SAAK,mBAAA,GAAA,CAAA,GAE3B,EAEkB,EAAA,CAAA,GAAA;KADhB,OAAM;KACN,QAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"HttpMethod.vue.script.js","names":[],"sources":["../../../src/code-example/components/HttpMethod.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { getHttpMethodInfo } from '@scalar/helpers/http/http-info'\nimport { isHttpMethod } from '@scalar/helpers/http/is-http-method'\nimport { computed, type Component } from 'vue'\n\nconst props = defineProps<{\n /** The type of element to render as, defaults to `span` */\n as?: Component | string\n /** The css style property or variable that will be set to the request method color, defaults to `color` */\n property?: string\n /** Whether or not to abbreviated the slot content */\n short?: boolean\n /** The HTTP method to show */\n method: string\n}>()\n\n/** Grabs the method info object which contains abbreviation, color, and background color etc */\nconst httpMethodInfo = computed(() =>\n getHttpMethodInfo(String(props.method || '')),\n)\n\n/** Full method name */\nconst normalized = computed(() => {\n if (typeof props.method !== 'string' || !props.method.trim()) {\n return 'get'\n }\n const method = props.method.trim()\n return isHttpMethod(method.toLowerCase()) ? method.toLowerCase() : method\n})\n</script>\n\n<template>\n <component\n :is=\"as ?? 'span'\"\n :class=\"{ uppercase: isHttpMethod(normalized) }\"\n :style=\"{ [property || 'color']: httpMethodInfo.colorVar }\">\n <slot />\n {{ short ? httpMethodInfo.short : normalized }}\n </component>\n</template>\n"],"mappings":";;;;;;;;;;;;;EAKA,IAAM,IAAQ,GAYR,IAAiB,QACrB,EAAkB,OAAO,EAAM,UAAU,EAAE,CAAC,CAC9C,GAGM,IAAa,QAAe;GAChC,IAAI,OAAO,EAAM,UAAW,YAAY,CAAC,EAAM,OAAO,KAAK,GACzD,OAAO;GAET,IAAM,IAAS,EAAM,OAAO,KAAK;GACjC,OAAO,EAAa,EAAO,YAAY,CAAC,IAAI,EAAO,YAAY,IAAI;EACrE,CAAC;yBAIC,EAMY,EALL,EAAA,MAAE,MAAA,GAAA;GACN,OAAK,EAAA,EAAA,WAAe,EAAA,CAAA,CAAY,CAAC,EAAA,KAAU,EAAA,CAAA;GAC3C,OAAK,EAAA,GAAK,EAAA,YAAQ,UAAc,EAAA,MAAe,SAAQ,CAAA;;oBAChD,CAAR,EAAQ,EAAA,QAAA,SAAA,GAAA,EAAA,MACR,EAAG,EAAA,QAAQ,EAAA,MAAe,QAAQ,EAAA,KAAU,GAAA,CAAA,CAAA,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"RenderString.vue.script.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":";;;;;;EAsBA,IAAM,IAAgB,QAChB,EAAA,UAAU,KACL,OAGL,EAAA,UAAU,OACL,SAGL,EAAA,UAAU,KAAA,IACL,cAIF,EAAA,KACR;qBAII,EAAA,KAAa"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Schema.vue.script.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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyGA,IAAM,EAAE,iBAAc,GAAgB,GAEhC,IAA4B,QAC5B,EAAA,4BAA4B,KAAA,IACvB,EAAU,iCAAiC,IAE7C,EACL,EAAA,4BAA4B,IACxB,+BACA,6BACJ,EAAE,OAAO,EAAA,wBAAwB,CACnC,CACD,GAEK,IAAiB,QACN,EAAA,kBAAsB,CAAC,CAAC,EAAA,QAAQ,cACjD,GAQM,IAAe,GAAgB,GAW/B,IAAS,QACb,EAAc,EAAA,MAAU,CAC1B,GAUM,IAAiB,QAAyC;GAC9D,IAAM,IAAQ,EAAO;GAErB,IAAI,CAAC,KAAS,OAAO,KAAU,UAC7B,OAAO;GAGT,IAAM,IAAQ,EAAqB,GAAO,CAAY;GACtD,OAAO,UAAU,IAAQ,EAAQ,OAAO,CAAK,IAAI;EACnD,CAAC,GAYK,IAAc,EAAO,QACvB,EAAqB,EAAO,OAAO,CAAY,IAC/C,KAAA;EACJ,EACE,IACA,IAAc,EAAiB,GAAc,CAAW,IAAI,CAC9D;EAYA,IAAM,I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;;;;;SAGd,EAAA,CAAA,CAAY,CAAC,EAAA,KAAc,KAAA,EAAA,GADxC,EAgBqD,IAAA;;IAdlD,YAAA,EAAA;IACA,SAAA,EAAA;IACA,iBAAiB,EAAA;IACjB,OAAO,EAAA;IACP,eAAe,EAAA,iBAAiB,EAAA,OAAgB;IAChD,UAAU,EAAA;IACV,WAAW,EAAA,CAAA;IACX,aAAA,EAAA;IACA,gBAAA,EAAA;IACA,OAAO,EAAA,QAAK;IACZ,SAAA,EAAA;IACA,QAAQ,EAAA;IACR,eAAe,EAAA;IACf,gBAAgB,EAAA;IAChB,wBAAwB,EAAA;;;;;;;;;;;;;;;;;eAE3B,EAkBW,GAAA,EAAA,KAAA,EAAA,GAAA,CAhBD,EAAA,SAAA,EAAA,GADR,EAgBqD,IAAA;;IAdlD,YAAA,EAAA;IACA,SAAA,EAAA;IACA,iBAAiB,EAAA;IACjB,OAAO,EAAA;IACP,eAAA,EAAA;IACA,UAAU,EAAA;IACV,WAAW,EAAA,CAAA;IACX,aAAA,EAAA;IACA,gBAAA,EAAA;IACA,OAAA,EAAA;IACA,SAAA,EAAA;IACA,QAAQ,EAAA;IACR,eAAe,EAAA;IACf,gBAAgB,EAAA;IAChB,wBAAwB,EAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaCollapsedPreview.vue.script.js","names":[],"sources":["../../src/schema/SchemaCollapsedPreview.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\n/**\n * A hint at what a collapsed object holds: `{ code, message, source, +1 }`.\n * Marked `aria-hidden` by the parent: the child count already rides the\n * toggle's `aria-describedby`, and reading names before every row is noise.\n */\nconst {\n schema,\n propertyNames,\n limit = 3,\n} = defineProps<{\n schema?: SchemaObject\n /** The names the panel will render, already filtered; defaults to the schema's keys */\n propertyNames?: readonly string[]\n /** How many property names to show before eliding the rest */\n limit?: number\n}>()\n\nconst preview = computed((): string | null => {\n if (!schema || typeof schema !== 'object') {\n return null\n }\n\n /*\n * The caller passes the names the panel will render, filtered by\n * hideReadOnly / hideWriteOnly; deriving them here let the preview advertise\n * fields the panel drops. The fallback (stories, tests) reads `properties`\n * directly: `resolve.schema` keeps `$ref` but drops `$ref-value`, so resolving\n * again returned undefined for a `$ref` property and nothing rendered.\n */\n const resolved =\n 'properties' in schema ? schema : (getResolvedRef(schema) ?? schema)\n const properties =\n propertyNames ??\n (resolved && 'properties' in resolved && resolved.properties\n ? Object.keys(resolved.properties)\n : [])\n\n if (properties.length === 0) {\n return null\n }\n\n const shown = properties.slice(0, limit)\n const rest = properties.length - shown.length\n const parts = rest > 0 ? [...shown, `+${rest}`] : shown\n\n return `{ ${parts.join(', ')} }`\n})\n</script>\n<template>\n <span\n v-if=\"preview\"\n class=\"property-collapsed-preview font-code text-c-1 max-w-max min-w-0 flex-1 basis-0 truncate text-(length:--scalar-mini)\"\n >{{ preview }}</span\n >\n</template>\n"],"mappings":";;;;;;;;;;;;;;EAsBA,IAAM,IAAU,QAA8B;GAC5C,IAAI,CAAC,EAAA,UAAU,OAAO,EAAA,UAAW,UAC/B,OAAO;GAUT,IAAM,IACJ,gBAAgB,EAAA,SAAS,EAAA,SAAU,EAAe,EAAA,MAAM,KAAK,EAAA,QACzD,IACJ,EAAA,kBACC,KAAY,gBAAgB,KAAY,EAAS,aAC9C,OAAO,KAAK,EAAS,UAAU,IAC/B,CAAC;GAEP,IAAI,EAAW,WAAW,GACxB,OAAO;GAGT,IAAM,IAAQ,EAAW,MAAM,GAAG,EAAA,KAAK,GACjC,IAAO,EAAW,SAAS,EAAM;GAGvC,OAAO,MAFO,IAAO,IAAI,CAAC,GAAG,GAAO,IAAI,GAAM,IAAI,EAAA,CAEhC,KAAK,IAAI,EAAE;EAC/B,CAAC;mBAIS,EAAA,SAAA,EAAA,GADR,EAIC,QAJD,GAIC,EADK,EAAA,KAAO,GAAA,CAAA,KAAA,EAAA,IAAA,EAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaComposition.vue.script.js","names":[],"sources":["../../src/schema/SchemaComposition.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport {\n ScalarListbox,\n type ScalarListboxOption,\n} from '@scalar/components/listbox'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport { ScalarIconCaretUpDown } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, inject, ref, watch } from 'vue'\n\nimport {\n schemaDiscriminator,\n type DiscriminatorMetadata,\n type DiscriminatorSchema,\n} from './discriminator-metadata'\nimport { getDiscriminatorValues } from './helpers/get-discriminator-values'\nimport { getSchemaType } from './helpers/get-schema-type'\nimport { partitionAllOfCompositions } from './helpers/partition-all-of-compositions'\nimport { type CompositionKeyword } from './helpers/schema-composition'\nimport { getCycleKey } from './helpers/schema-cycle'\nimport { getModelNameWithArray } from './helpers/schema-name'\nimport { useLocalization } from './localization'\nimport {\n REQUEST_BODY_COMPOSITION_INDEX_SYMBOL,\n type RequestBodyCompositionSelection,\n} from './request-body-composition-index'\nimport Schema from './Schema.vue'\nimport SchemaGlyphPuck from './SchemaGlyphPuck.vue'\nimport SchemaRailPanel from './SchemaRailPanel.vue'\nimport type { SchemaOptions, SchemaRenderingProps } from './types'\n\nconst props = withDefaults(\n defineProps<\n {\n /** The composition keyword (oneOf, anyOf, allOf) */\n composition: CompositionKeyword\n /** Optional discriminator object for polymorphic schemas */\n discriminator?: DiscriminatorObject\n /** Optional name for the schema */\n name?: string\n /** The schema value containing the composition */\n schema: SchemaObject\n /** Nesting level for proper indentation */\n level: number\n /** Real nesting depth (see SchemaProperty) */\n depth?: number\n /** Whether to use compact layout */\n compact?: boolean\n /** Whether to hide the heading */\n hideHeading?: boolean\n /** Hide model names in type display */\n hideModelNames?: boolean\n /** Breadcrumb for navigation */\n breadcrumb?: string[]\n /** Event bus emitting actions */\n eventBus: WorkspaceEventBus | null\n /** Move the options into single prop so they are easy to pass around */\n options: SchemaOptions\n /** When \"requestBody\", sync selected index with the example snippet */\n schemaContext?: string\n /** Internal path used to sync nested request body compositions with the code sample */\n compositionPath?: string[]\n } & SchemaRenderingProps\n >(),\n {\n depth: 0,\n compact: false,\n hideHeading: false,\n },\n)\nconst { translate } = useLocalization()\n\n/**\n * Split an `allOf` into an ordered list of segments (object chunks + choice\n * pickers) so multiple mutually-exclusive selections each render their own\n * picker, in the position they were declared, instead of all but the first\n * being dropped and the rest bubbling to the end.\n */\nconst allOfSegments = computed(() =>\n props.composition === 'allOf'\n ? partitionAllOfCompositions(props.schema).segments\n : [],\n)\n\n/** The current composition */\nconst composition = computed(() =>\n [props.schema[props.composition]]\n .flat()\n .map((schema) => ({ value: resolve.schema(schema), original: schema }))\n .filter((it) => isDefined(it.value)),\n)\n\n/**\n * Generate listbox options for the composition selector.\n * Each option represents a schema in the composition with a human-readable label.\n * Prefers schema title/name (including array item models, e.g. `Model[]`) over\n * structural type when present.\n */\nconst listboxOptions = computed((): ScalarListboxOption[] =>\n composition.value.map((schema, index: number) => {\n const resolved = resolve.schema(schema.original!)\n const label =\n (getModelNameWithArray(resolved)?.label ?? getSchemaType(resolved)) ||\n translate('schema.schema')\n const mapping = (props.schema.discriminator ?? props.discriminator)?.mapping\n const mappedValues = getDiscriminatorValues(resolved.$ref, mapping)\n // Multiple inherited schemas can share a value that a mapping can only store once.\n const inheritedValue = (resolved.discriminator as DiscriminatorMetadata)?.[\n schemaDiscriminator\n ]?.value\n const values = mappedValues.length\n ? mappedValues\n : inheritedValue === undefined\n ? []\n : [inheritedValue]\n return {\n id: String(index),\n label:\n values.length && values.join(', ') !== label\n ? `${values.join(', ')} · ${label}`\n : label,\n }\n }),\n)\n\nconst compositionSelectionKey = computed(() =>\n props.compositionPath?.length\n ? [...props.compositionPath, props.composition].join('.')\n : '',\n)\n\n/** When this composition is in the request body, sync selection with the example snippet */\nconst requestBodyCompositionSelectionRef = inject(\n REQUEST_BODY_COMPOSITION_INDEX_SYMBOL,\n undefined,\n)\n\nconst initialSelectedIndex = computed(() => {\n if (\n props.schemaContext !== 'requestBody' ||\n !requestBodyCompositionSelectionRef?.value ||\n !compositionSelectionKey.value\n ) {\n return 0\n }\n\n const selectedIndex =\n requestBodyCompositionSelectionRef.value[compositionSelectionKey.value]\n\n if (typeof selectedIndex !== 'number' || Number.isNaN(selectedIndex)) {\n return 0\n }\n\n return Math.max(0, Math.min(selectedIndex, listboxOptions.value.length - 1))\n})\n\n/**\n * Two-way computed property for the selected option.\n * Handles conversion between the selected index and the listbox option format.\n */\nconst selectedOption = ref<ScalarListboxOption | undefined>()\n\nwatch(\n [listboxOptions, initialSelectedIndex],\n ([options, selectedIndex]) => {\n if (\n !selectedOption.value ||\n !options.some((option) => option.id === selectedOption.value?.id)\n ) {\n selectedOption.value = options[selectedIndex] ?? options[0]\n }\n },\n { immediate: true },\n)\n\nconst compositionLabel = (type: CompositionKeyword): string =>\n (props.schema as DiscriminatorSchema)[schemaDiscriminator]?.inheritedVariants\n ? translate('schema.variants')\n : translate(`schema.${type}`)\n\n/** Inside the currently selected composition */\nconst selectedComposition = computed(\n () => composition.value[Number(selectedOption.value?.id ?? '0')]?.value,\n)\n\n/** AsyncAPI variants carry their own effective value; OpenAPI keeps its existing inference context. */\nconst selectedDiscriminator = computed((): DiscriminatorObject | undefined => {\n const own = selectedComposition.value?.discriminator\n return (own as DiscriminatorMetadata)?.[schemaDiscriminator]\n ? own\n : props.discriminator\n})\n\n/**\n * The request body card renders the merged `allOf` description on its outer card\n * (see `Schema.vue`), but only for the top-level request body schema. For that\n * single composition we hide the nested merged `Schema`'s description so the text\n * is not shown twice. Nested request-body compositions (deeper properties) are\n * not shown on the outer card and would otherwise lose their description\n * entirely, because the property row already skips it when `allOf` is present.\n *\n * The top-level request body composition is the one whose `compositionPath` is\n * still the request body root (`['requestBody']`); nested compositions append\n * property segments and therefore have a longer path.\n */\nconst isRequestBodyRootComposition = computed(\n () =>\n props.schemaContext === 'requestBody' &&\n props.compositionPath?.length === 1,\n)\n\n/**\n * Cycle key for the selected composition member, derived from its raw\n * (unresolved) value so a member that references an ancestor is detected as a\n * cycle.\n */\nconst selectedCompositionCycleKey = computed(() =>\n getCycleKey(\n composition.value[Number(selectedOption.value?.id ?? '0')]?.original,\n ),\n)\n\n/**\n * Controls whether the nested schema is displayed. When expanding all schema\n * properties we open it by default; the nested Schema handles cycle detection,\n * so finite compositions render fully while recursive ones still stop.\n */\nconst showNestedSchema = ref(!!props.options.expandAllSchemaProperties)\n\nif (\n requestBodyCompositionSelectionRef &&\n props.schemaContext === 'requestBody' &&\n compositionSelectionKey.value\n) {\n watch(\n selectedOption,\n (option) => {\n const index = option ? Number(option.id) : 0\n if (!Number.isNaN(index)) {\n requestBodyCompositionSelectionRef.value = {\n ...requestBodyCompositionSelectionRef.value,\n [compositionSelectionKey.value]: index,\n } satisfies RequestBodyCompositionSelection\n }\n },\n { immediate: true },\n )\n}\n</script>\n\n<template>\n <!-- 6px after a container's children keeps the 12px row rhythm -->\n <div class=\"property-rule [.children+&]:mt-1.5!\">\n <!--\n allOf: render the members in source order — object chunks as fields, each\n oneOf/anyOf group as its own picker in place. Keeps every mutually-exclusive\n selection (mergeAllOfSchemas alone drops all but the first) and preserves the\n position of each choice group among the surrounding fields, flowing inline\n with them as one continuous list (no extra spacing or card).\n -->\n <template v-if=\"props.composition === 'allOf'\">\n <template\n v-for=\"(segment, segmentIndex) in allOfSegments\"\n :key=\"segmentIndex\">\n <Schema\n v-if=\"segment.kind === 'object'\"\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :compositionPath=\"compositionPath\"\n :depth=\"depth\"\n :discriminator=\"schema.discriminator ?? discriminator\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideDescription=\"isRequestBodyRootComposition\"\n :hideHeading=\"hideHeading\"\n :hideModelNames\n :level=\"level + 1\"\n :name=\"name\"\n :noncollapsible=\"true\"\n :options=\"options\"\n :schema=\"segment.schema\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n <SchemaComposition\n v-else\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :composition=\"segment.composition\"\n :compositionPath=\"[\n ...(compositionPath ?? []),\n String(segment.choiceIndex),\n ]\"\n :depth=\"depth\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading=\"hideHeading\"\n :hideModelNames\n :level=\"level\"\n :options=\"options\"\n :schema=\"segment.value\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </template>\n </template>\n\n <!-- The picker sits on the rail behind a circled icon, like the toggle\n pucks; the chosen variant hangs below in the same panel -->\n <SchemaRailPanel\n v-else\n class=\"composition-panel composition-panel--tree mt-1 mb-0.5\"\n :depth=\"depth + 1\">\n <!-- No `resize`: it would pin the popup to this compact trigger's width.\n The listbox slot must hold exactly ONE node: Headless UI renders its\n button as a fragment and passes props through to the slot root, so\n even an HTML comment in here breaks the picker. The puck is the\n picker's whole affordance: an up/down caret on the rail, like the\n plus on a row, so no trailing caret. -->\n <ScalarListbox\n v-model=\"selectedOption\"\n class=\"w-fit max-w-full min-w-40\"\n :options=\"listboxOptions\">\n <button\n class=\"composition-selector composition-selector--tree group/tree-control font-code relative flex w-fit max-w-full cursor-pointer items-start gap-1.5 py-1 text-sm\"\n type=\"button\">\n <SchemaGlyphPuck\n anchor=\"line\"\n class=\"composition-selector-icon mt-1\">\n <!-- No size of its own: the puck sizes the icons it holds, so this\n one shrinks with the others in a narrow container -->\n <ScalarIconCaretUpDown />\n </SchemaGlyphPuck>\n <!-- Keyword and choice read as one bold name, split by the same `·`\n the tree uses between details -->\n <span\n class=\"text-c-1 shrink-0 [font-weight:var(--scalar-bold)] whitespace-nowrap\"\n >{{ compositionLabel(props.composition) }}</span\n >\n <span\n aria-hidden=\"true\"\n class=\"text-c-3 shrink-0\"\n >·</span\n >\n <span\n class=\"composition-selector-label text-c-1 min-w-0 truncate [font-weight:var(--scalar-bold)]\"\n :class=\"{\n 'line-through': selectedComposition?.deprecated,\n }\"\n :title=\"selectedOption?.label || translate('schema.schema')\">\n {{ selectedOption?.label || translate('schema.schema') }}\n </span>\n <div\n v-if=\"selectedComposition?.deprecated\"\n class=\"text-red\">\n {{ translate('schema.deprecated') }}\n </div>\n </button>\n </ScalarListbox>\n\n <!-- The reveal is one more row of the tree: a plus puck on the rail -->\n <button\n v-if=\"!showNestedSchema && level > 2\"\n class=\"composition-details-toggle group/tree-control font-code text-c-1 relative flex w-fit cursor-pointer items-center py-1.5 text-sm font-normal\"\n type=\"button\"\n @click=\"showNestedSchema = true\">\n <SchemaGlyphPuck />\n {{ translate('schema.showSchemaDetails') }}\n </button>\n\n <!-- Render the selected schema if it has content to display -->\n <Schema\n v-else\n :key=\"selectedOption?.id ?? '0'\"\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :compositionPath=\"compositionPath\"\n :cycleKey=\"selectedCompositionCycleKey\"\n :depth=\"depth + 1\"\n :discriminator=\"selectedDiscriminator\"\n :eventBus=\"eventBus\"\n :expansion=\"expansion\"\n :hideHeading=\"hideHeading\"\n :hideModelNames\n :level=\"level + 1\"\n :name=\"name\"\n :noncollapsible=\"true\"\n :options=\"options\"\n :schema=\"selectedComposition\"\n :schemaContext=\"schemaContext\"\n :scrollTargetId=\"scrollTargetId\"\n :specificationExtension=\"specificationExtension\" />\n </SchemaRailPanel>\n </div>\n</template>\n\n<style scoped>\n/*\n * A `oneOf`/`anyOf` whose chosen variant `allOf`s back to a shared base — most\n * commonly a discriminator-inferred `oneOf` sitting directly on the request body\n * — renders the merged variant one level deeper than a plain object variant:\n * `Schema.vue` cannot flatten the `allOf`, so it hands the merged object to\n * `SchemaProperty`, which wraps it in a headless passthrough row\n * (`.property--tree-container`). That wrapper carries a row's own\n * `--schema-row-pad`, opening a gap between the selector and the first field\n * that a plain `oneOf` does not have, so the variant reads as detached from its\n * picker. Drop that leading row pad for the panel's own variant card so the\n * field sits flush under the selector, matching a plain `oneOf`. Only the top\n * pad goes: the wrapper's trailing pad is what closes the card under the last\n * field, exactly as a plain variant's last row does.\n *\n * The rule lives here rather than in `SchemaProperty` because a body-level\n * discriminator `oneOf` is rendered straight from `Schema.vue` and never passes\n * through `SchemaProperty`, so a rule scoped there would never reach it.\n * See https://github.com/scalar/scalar/issues/9861\n */\n.property-rule\n :deep(\n .composition-panel\n > .schema-card\n > .schema-properties\n > ul\n > li.property.property--tree-container\n ) {\n padding-top: 0 !important;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCA,IAAM,IAAQ,GAuCR,EAAE,iBAAc,EAAgB,GAQhC,IAAgB,QACpB,EAAM,gBAAgB,UAClB,EAA2B,EAAM,MAAM,CAAC,CAAC,WACzC,CAAC,CACP,GAGM,IAAc,QAClB,CAAC,EAAM,OAAO,EAAM,YAAY,CAAA,CAC7B,KAAK,CAAA,CACL,KAAK,OAAY;GAAE,OAAO,EAAQ,OAAO,CAAM;GAAG,UAAU;EAAO,EAAE,CAAA,CACrE,QAAQ,MAAO,EAAU,EAAG,KAAK,CAAC,CACvC,GAQM,IAAiB,QACrB,EAAY,MAAM,KAAK,GAAQ,MAAkB;GAC/C,IAAM,IAAW,EAAQ,OAAO,EAAO,QAAS,GAC1C,KACH,EAAsB,CAAQ,CAAC,EAAE,SAAS,EAAc,CAAQ,MACjE,EAAU,eAAe,GACrB,KAAW,EAAM,OAAO,iBAAiB,EAAM,cAAA,EAAgB,SAC/D,IAAe,EAAuB,EAAS,MAAM,CAAO,GAE5D,IAAkB,EAAS,gBAC/B,EACD,EAAE,OACG,IAAS,EAAa,S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ACZ,SAAS,EAAA;KACT,iBAAiB,EAAA;KACjB,UAAU,EAAA;KACV,OAAO,EAAA,QAAK;KACZ,eAAe,EAAA;KACf,UAAU,EAAA;KACV,WAAW,EAAA;KACX,aAAa,EAAA;KACb,gBAAA,EAAA;KACA,OAAO,EAAA,QAAK;KACZ,MAAM,EAAA;KACN,gBAAgB;KAChB,SAAS,EAAA;KACT,QAAQ,EAAA;KACR,eAAe,EAAA;KACf,gBAAgB,EAAA;KAChB,wBAAwB,EAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaEnumPropertyItem.vue.script.js","names":[],"sources":["../../src/schema/SchemaEnumPropertyItem.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport { ScalarWrappingText } from '@scalar/components/wrapping-text'\n\ndefineProps<{\n label: string\n description?: string\n}>()\n</script>\n\n<template>\n <li class=\"property-enum-row flex flex-col gap-0.5 border-t px-3 py-2\">\n <span class=\"property-enum-row-label font-code text-c-1 text-sm\">\n <ScalarWrappingText\n preset=\"property\"\n :text=\"label\" />\n </span>\n <span\n v-if=\"description\"\n class=\"property-enum-row-description text-c-2 text-(length:--scalar-small) [&_.markdown]:-mb-0.5\">\n <ScalarMarkdown :value=\"description\" />\n </span>\n </li>\n</template>\n"],"mappings":";;;;;;;;;;;;;;yBAWE,EAWK,MAXL,GAWK,CAVH,EAIO,QAJP,GAIO,CAHL,EAEkB,EAAA,CAAA,GAAA;GADhB,QAAO;GACN,MAAM,EAAA;2BAGH,EAAA,eAAA,EAAA,GADR,EAIO,QAJP,GAIO,CADL,EAAuC,EAAA,CAAA,GAAA,EAAtB,OAAO,EAAA,YAAW,GAAA,MAAA,GAAA,CAAA,OAAA,CAAA,CAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaEnums.vue.script.js","names":[],"sources":["../../src/schema/SchemaEnums.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\nimport { computed, ref } from 'vue'\n\nimport { useLocalization } from './localization'\nimport SchemaEnumPropertyItem from './SchemaEnumPropertyItem.vue'\nimport SchemaGlyphPuck from './SchemaGlyphPuck.vue'\n\nconst { value, propertyNames = false } = defineProps<{\n /** The schema object containing enum values and metadata */\n value: SchemaObject | undefined\n /** Whether to display the enum for property names */\n propertyNames?: boolean\n}>()\nconst { translate } = useLocalization()\n\n/**\n * Past this many values the list collapses behind a reveal. 12/8 rather than a\n * tighter pair: with 9/5 a 10-value enum hides half its values.\n */\nconst ENUM_DISPLAY_THRESHOLD = 12\nconst INITIAL_VISIBLE_COUNT = 8\n/** Values at or under this length can render as wrapped chips */\nconst CHIP_MAX_LENGTH = 24\nconst THIN_SPACE = '\\u2009'\n\n/**\n * Resolves the schema that carries the enum values.\n * For arrays, the enum and its x-enum-* metadata live on the items schema, so\n * both the values and their varnames/descriptions have to be read from there.\n */\nconst enumSchema = computed(() => {\n if (!value) {\n return undefined\n }\n if (value.enum) {\n return value\n }\n return isArraySchema(value) ? resolve.schema(value.items) : undefined\n})\n\n/**\n * Extracts enum values from the schema object.\n * Handles both direct enum values and nested enum arrays.\n */\nconst enumValues = computed(() => enumSchema.value?.enum ?? [])\n\n/**\n * Determines if we should show the long enum list UI.\n * When there are many enum values, we initially show only a subset.\n */\nconst shouldUseLongListDisplay = computed(\n () => enumValues.value.length > ENUM_DISPLAY_THRESHOLD,\n)\n\nconst initialVisibleCount = computed(() =>\n shouldUseLongListDisplay.value\n ? INITIAL_VISIBLE_COUNT\n : enumValues.value.length,\n)\n\n/**\n * Short flat enums render as wrapped chips: three lines instead of a 40-row\n * wall. Values with descriptions keep the rows instead.\n *\n * `!shouldUseLongListDisplay` is what bounds the COUNT. Chips have no reveal of\n * their own — the \"show all values\" control is a row of the list below — so a\n * long enum of short values (currency or country codes, hundreds of them)\n * would otherwise render every value at once with no way to collapse it.\n * Past the threshold the rows take over and bring their toggle with them.\n */\nconst shouldRenderAsChips = computed(\n () =>\n !propertyNames &&\n enumValues.value.length > 0 &&\n !shouldUseLongListDisplay.value &&\n enumValues.value.every(\n // Measure the text the chip actually renders (value plus any varname), not\n // the bare value, so a short value with a long x-enum-varname still wraps.\n (entry, index) =>\n formatEnumValueWithName(entry, index).length <= CHIP_MAX_LENGTH,\n ) &&\n !hasAnyDescription.value,\n)\n\n/** Whether any value carries an x-enum description (chips have nowhere to put one) */\nconst hasAnyDescription = computed(() =>\n enumValues.value.some(\n (entry, index) => getEnumValueDescription(entry, index) !== undefined,\n ),\n)\n\nconst visibleEnumValues = computed(() =>\n enumValues.value.slice(0, initialVisibleCount.value),\n)\n\nconst hiddenEnumValues = computed(() =>\n enumValues.value.slice(initialVisibleCount.value),\n)\n\n/**\n * Gets the description for an enum value.\n * Supports both array and object formats for x-enumDescriptions.\n */\nconst getEnumValueDescription = (\n enumValue: any,\n index: number,\n): string | undefined => {\n const schema = enumSchema.value\n const descriptions =\n schema?.['x-enumDescriptions'] ?? schema?.['x-enum-descriptions']\n\n if (!descriptions) {\n return undefined\n }\n\n if (Array.isArray(descriptions)) {\n return descriptions[index] || undefined\n }\n\n if (typeof descriptions === 'object' && descriptions !== null) {\n return descriptions[String(enumValue)] || undefined\n }\n\n return undefined\n}\n\n/**\n * Formats an enum value with its variable name if available.\n * This supports both x-enum-varnames and x-enumNames extensions.\n */\nconst formatEnumValueWithName = (enumValue: any, index: number): string => {\n const varNames =\n enumSchema.value?.['x-enum-varnames'] ?? enumSchema.value?.['x-enumNames']\n const varName = Array.isArray(varNames) ? varNames[index] : undefined\n return varName\n ? `${enumValue}${THIN_SPACE}=${THIN_SPACE}${varName}`\n : String(enumValue)\n}\n\n/**\n * Controls whether the hidden enum values are visible.\n */\nconst isExpanded = ref(false)\n\nconst toggleExpanded = () => {\n isExpanded.value = !isExpanded.value\n}\n</script>\n\n<template>\n <div\n v-if=\"enumSchema?.enum !== undefined\"\n class=\"property-enum property-enum--tree mt-2 rounded-(--scalar-radius-lg) border\">\n <!-- A bordered card with a muted header row and one hairline row per\n value; the chips and the long-list toggle are rows of it too -->\n <div class=\"property-enum-header text-c-2 px-3 py-2 text-sm capitalize\">\n {{\n propertyNames\n ? translate('schema.propertyNames')\n : translate('schema.values')\n }}\n </div>\n <p\n v-if=\"enumValues.length === 0\"\n class=\"text-c-2 border-t px-3 py-2 text-sm\">\n {{ translate('schema.noAllowedValues') }}\n </p>\n <div\n v-else-if=\"shouldRenderAsChips\"\n class=\"property-enum-chip-list flex flex-wrap gap-1 border-t px-3 py-2\"\n role=\"list\">\n <span\n v-for=\"(enumValue, index) in enumValues\"\n :key=\"index\"\n class=\"property-enum-chip font-code text-c-2 rounded-(--scalar-radius-lg) border px-1.5 py-px text-(length:--scalar-mini)\"\n role=\"listitem\">\n {{ formatEnumValueWithName(enumValue, index) }}\n </span>\n </div>\n <ul\n v-else\n class=\"property-enum-values-card\"\n role=\"list\">\n <SchemaEnumPropertyItem\n v-for=\"(enumValue, index) in visibleEnumValues\"\n :key=\"index\"\n :description=\"getEnumValueDescription(enumValue, index)\"\n :label=\"formatEnumValueWithName(enumValue, index)\" />\n\n <template v-if=\"shouldUseLongListDisplay && isExpanded\">\n <SchemaEnumPropertyItem\n v-for=\"(enumValue, index) in hiddenEnumValues\"\n :key=\"initialVisibleCount + index\"\n :description=\"\n getEnumValueDescription(enumValue, initialVisibleCount + index)\n \"\n :label=\"\n formatEnumValueWithName(enumValue, initialVisibleCount + index)\n \" />\n </template>\n\n <li\n v-if=\"shouldUseLongListDisplay\"\n class=\"border-t\">\n <!-- The reveal is a tree control like the row toggles, so it draws the\n same puck and lights it the same way when the row is hovered -->\n <button\n class=\"enum-toggle-button group/tree-control text-c-2 hover:text-c-1 flex w-full cursor-pointer items-center gap-1.5 px-3 py-2 text-sm\"\n type=\"button\"\n @click=\"toggleExpanded\">\n <SchemaGlyphPuck\n :floating=\"false\"\n :open=\"isExpanded\" />\n {{\n isExpanded\n ? translate('schema.hideValues')\n : translate('schema.showAllValues')\n }}\n </button>\n </li>\n </ul>\n </div>\n</template>\n\n<style scoped>\n.property-heading:empty + .property-description:last-of-type,\n.property-description:first-of-type:last-of-type {\n margin-top: 0;\n}\n\n.property-list {\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius);\n margin-top: 10px;\n}\n\n.property-list .property:last-of-type {\n padding-bottom: 10px;\n}\n\n.enum-toggle-button:hover {\n color: var(--scalar-color-1);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;GAsBM,IAAyB,IACzB,IAAwB,GAExB,IAAkB,IAClB,IAAa;;;;;;;;;;EAVnB,IAAM,EAAE,iBAAc,EAAgB,GAiBhC,IAAa,QAAe;GAC3B,MAAA,OAML,OAHI,EAAA,MAAM,OACD,EAAA,QAEF,EAAc,EAAA,KAAK,IAAI,EAAQ,OAAO,EAAA,MAAM,KAAK,IAAI,KAAA;EAC9D,CAAC,GAMK,IAAa,QAAe,EAAW,OAAO,QAAQ,CAAC,CAAC,GAMxD,IAA2B,QACzB,EAAW,MAAM,SAAS,CAClC,GAEM,IAAsB,QAC1B,EAAyB,QACrB,IACA,EAAW,MAAM,MACvB,GAYM,IAAsB,QAExB,CAAC,EAAA,iBACD,EAAW,MAAM,SAAS,KAC1B,CAAC,EAAyB,SAC1B,EAAW,MAAM,OAGd,GAAO,MACN,EAAwB,GAAO,CAAK,CAAC,CAAC,UAAU,CACpD,KACA,CAAC,EAAkB,KACvB,GAGM,IAAoB,QACxB,EAAW,MAAM,MACd,GAAO,MAAU,EAAwB,GAAO,CAAK,MAAM,KAAA,CAC9D,CACF,GAEM,IAAoB,QACxB,EAAW,MAAM,MAAM,GAAG,EAAoB,KAAK,CACrD,GAEM,IAAmB,QACvB,EAAW,MAAM,MAAM,EAAoB,KAAK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AAK;;GAElC,EAAA,SAA4B,EAAA,SAAA,EAAA,EAAA,GAC1C,EAQM,GAAA,EAAA,KAAA,EAAA,GAAA,EAPyB,EAAA,QAArB,GAAW,YADrB,EAQM,GAAA;IANH,KAAK,EAAA,QAAsB;IAC3B,aAA0B,EAAwB,GAAW,EAAA,QAAsB,CAAK;IAGxF,OAAoB,EAAwB,GAAW,EAAA,QAAsB,CAAK;;GAM/E,EAAA,SAAA,EAAA,GADR,EAkBK,MAlBL,GAkBK,CAbH,EAYS,UAAA;IAXP,OAAM;IACN,MAAK;IACJ,SAAO;OACR,EAEuB,GAAA;IADpB,UAAU;IACV,MAAM,EAAA;4BAAc,MACvB,EACE,EAAA,QAA2B,EAAA,CAAA,CAAS,CAAA,mBAAA,IAAsC,EAAA,CAAA,CAAS,CAAA,sBAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,KAAA,EAAA,IAAA,EAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaGlyphPuck.vue.script.js","names":[],"sources":["../../src/schema/SchemaGlyphPuck.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconMinus, ScalarIconPlus } from '@scalar/icons'\n\n/**\n * The 18px glyph puck every tree control shows: an opaque knockout around a\n * 16px icon, so a rail reads as passing behind it. Hover is the\n * `tree-control-hover` variant (see tailwind.config.css): a parent carrying\n * the Tailwind group `group/tree-control`, the row heading beside a gutter\n * toggle, or the open panel's rail, so whichever element is the real pointer\n * target lights the puck the same way — a hairline ring on the page colour.\n *\n * Floating pucks hang in the row's margin (see the indentation model in\n * SchemaProperty.vue); the line anchor keeps the glyph beside a heading that wraps.\n */\nconst {\n open,\n floating = true,\n anchor = 'middle',\n} = defineProps<{\n /** Whether the controlled panel is open; picks the minus glyph over plus when the slot is empty */\n open?: boolean\n /** Position the puck absolutely in the row's margin rather than inline */\n floating?: boolean\n /** Where a floating puck centres: the row's middle, or its first text line */\n anchor?: 'middle' | 'line'\n}>()\n</script>\n<template>\n <span\n aria-hidden=\"true\"\n class=\"schema-glyph tree-control-hover:bg-b-1 tree-control-hover:text-c-1 tree-control-hover:border-(--scalar-border-color) print:bg-transparent [&_svg]:size-[var(--schema-glyph-icon,16px)]\"\n :class=\"\n floating\n ? [\n 'absolute start-[calc(0px_-_var(--schema-glyph-half,9px)_-_var(--schema-gutter,16px))] -translate-y-1/2',\n anchor === 'line' ? 'top-[0.5lh]' : 'top-1/2',\n ]\n : undefined\n \">\n <!-- print: paper strips background paint but still prints the rail, so the\n knockout goes transparent. This comment stays inside the span: beside\n the root it would make the template a fragment and break fallthrough. -->\n <slot>\n <ScalarIconMinus\n v-if=\"open\"\n weight=\"light\" />\n <ScalarIconPlus\n v-else\n weight=\"light\" />\n </slot>\n </span>\n</template>\n"],"mappings":";;;;;;;;;;;;;;yBA4BE,EAsBO,QAAA;GArBL,eAAY;GACZ,OAAK,EAAA,CAAC,0LACS,EAAA,WAAA,CAAA,0GAAuJ,EAAA,WAAM,SAAA,gBAAA,SAAA,IAA+D,KAAA,CAAA,CAAA;MAW3O,EAOO,EAAA,QAAA,WAAA,CAAA,SAAA,CALG,EAAA,QAAA,EAAA,GADR,EAEmB,EAAA,CAAA,GAAA;;GAAjB,QAAO;cACT,EAEmB,EAAA,CAAA,GAAA;;GAAjB,QAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaGutterToggle.vue.script.js","names":[],"sources":["../../src/schema/SchemaGutterToggle.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport SchemaGlyphPuck from './SchemaGlyphPuck.vue'\n\n/**\n * A property row's disclosure control: a content-free button in the property's\n * gutter. Its accessible name is the property name via `aria-labelledby`, and the\n * child count rides `aria-describedby` so screen-reader verbosity settings apply.\n * The 24px hit box (WCAG 2.5.8) and the 18px glyph puck inside it are sized\n * independently.\n */\nconst { open, panelId, panelRendered, nameId, fallbackLabel, countId } =\n defineProps<{\n /** Whether the controlled panel is expanded */\n open: boolean\n /** id of the panel this toggle controls */\n panelId: string\n /** Only reference the panel while it is actually in the DOM */\n panelRendered: boolean\n /** id of the visible property name that labels this control, absent on nameless rows */\n nameId?: string\n /**\n * Accessible name when there is no visible name to reference: pointing\n * `aria-labelledby` at an id that never renders leaves the button unnamed.\n */\n fallbackLabel: string\n /** id of the visually hidden child count that describes this control */\n countId?: string\n }>()\n\nconst emit = defineEmits<{\n (e: 'toggle'): void\n}>()\n</script>\n<template>\n <button\n :aria-controls=\"panelRendered ? panelId : undefined\"\n :aria-describedby=\"countId\"\n :aria-expanded=\"open\"\n :aria-label=\"nameId ? undefined : fallbackLabel\"\n :aria-labelledby=\"nameId\"\n class=\"property-toggle group/tree-control flex size-[var(--schema-toggle-size,24px)] shrink-0 cursor-pointer items-center justify-center rounded-[999px] border-none bg-transparent p-0 text-[color:var(--schema-glyph-color,var(--scalar-color-2))]\"\n data-schema-toggle\n type=\"button\"\n @click=\"emit('toggle')\">\n <!-- Inline, not floating: the button is already the box the puck centres in -->\n <SchemaGlyphPuck\n class=\"property-glyph\"\n :floating=\"false\"\n :open=\"open\" />\n </button>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EA6BA,IAAM,IAAO;yBAKX,EAeS,UAAA;GAdN,iBAAe,EAAA,gBAAgB,EAAA,UAAU,KAAA;GACzC,oBAAkB,EAAA;GAClB,iBAAe,EAAA;GACf,cAAY,EAAA,SAAS,KAAA,IAAY,EAAA;GACjC,mBAAiB,EAAA;GAClB,OAAM;GACN,sBAAA;GACA,MAAK;GACJ,SAAK,AAAA,EAAA,QAAA,MAAE,EAAI,QAAA;MAEZ,EAGiB,GAAA;GAFf,OAAM;GACL,UAAU;GACV,MAAM,EAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaHeading.vue.script.js","names":[],"sources":["../../src/schema/SchemaHeading.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarWrappingText } from '@scalar/components/wrapping-text'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\nimport { computed } from 'vue'\n\nimport { isTypeObject } from './helpers/is-type-object'\nimport { useLocalization } from './localization'\n\nconst { value } = defineProps<{\n value: SchemaObject\n name?: string\n}>()\nconst { translate } = useLocalization()\n\n/** Generate a failsafe type from the properties when we don't have one */\nconst failsafeType = computed(() => {\n if ('type' in value) {\n return value.type\n }\n\n if (value.enum) {\n return 'enum'\n }\n\n if (isArraySchema(value) && value.items) {\n return 'array'\n }\n\n if (isTypeObject(value) && (value.properties || value.additionalProperties)) {\n return 'object'\n }\n\n return 'unknown'\n})\n</script>\n\n<template>\n <span\n v-if=\"typeof value === 'object'\"\n class=\"schema-type\">\n <span\n class=\"schema-type-icon\"\n :title=\"\n 'type' in value && typeof value.type === 'string'\n ? value.type\n : 'type' in value && Array.isArray(value.type)\n ? value.type.join(' | ')\n : translate('schema.unknownType')\n \">\n <template v-if=\"isTypeObject(value)\"> {} </template>\n <template v-if=\"isArraySchema(value)\"> [] </template>\n <template v-if=\"value.enum\"> enum </template>\n </span>\n <template v-if=\"name\">\n <ScalarWrappingText\n preset=\"property\"\n :text=\"name\" />\n </template>\n <template v-else>\n {{ failsafeType }}\n </template>\n </span>\n</template>\n<style scoped>\n/* Style the \"icon\" */\n.schema-type-icon {\n color: var(--scalar-color-1);\n display: none;\n}\n.schema-type {\n font-family: var(--scalar-font-code);\n color: var(--scalar-color-1);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;EAaA,IAAM,EAAE,iBAAc,EAAgB,GAGhC,IAAe,QACf,UAAU,EAAA,QACL,EAAA,MAAM,OAGX,EAAA,MAAM,OACD,SAGL,EAAc,EAAA,KAAK,KAAK,EAAA,MAAM,QACzB,UAGL,EAAa,EAAA,KAAK,MAAM,EAAA,MAAM,cAAc,EAAA,MAAM,wBAC7C,WAGF,SACR;0BAKgB,EAAA,SAAK,YAAA,EAAA,GADpB,EAwBO,QAxBP,GAwBO,CArBL,EAYO,QAAA;GAXL,OAAM;GACL,OAAA,UAA0B,EAAA,SAAK,OAAW,EAAA,MAAM,QAAI,WAA0B,EAAA,MAAM,OAAA,UAA2B,EAAA,SAAS,MAAM,QAAQ,EAAA,MAAM,IAAI,IAAgB,EAAA,MAAM,KAAK,KAAI,KAAA,IAAsB,EAAA,CAAA,CAAS,CAAA,oBAAA;;GAO/L,EAAA,CAAA,CAAY,CAAC,EAAA,KAAK,KAAA,EAAA,GAAlC,EAAoD,GAAA,EAAA,KAAA,EAAA,GAAA,CAAA,EAAf,MAAI,CAAA,GAAA,EAAA,KAAA,EAAA,IAAA,EAAA;GACzB,EAAA,CAAA,CAAa,CAAC,EAAA,KAAK,KAAA,EAAA,GAAnC,EAAqD,GAAA,EAAA,KAAA,EAAA,GAAA,CAAA,EAAf,MAAI,CAAA,GAAA,EAAA,KAAA,EAAA,IAAA,EAAA;GAC1B,EAAA,MAAM,QAAA,EAAA,GAAtB,EAA6C,GAAA,EAAA,KAAA,EAAA,GAAA,CAAA,EAAjB,QAAM,CAAA,GAAA,EAAA,KAAA,EAAA,IAAA,EAAA;YAEpB,EAAA,QAAA,EAAA,GACd,EAEiB,EAAA,CAAA,GAAA;;GADf,QAAO;GACN,MAAM,EAAA;iCAEX,EAEW,GAAA,EAAA,KAAA,EAAA,GAAA,CAAA,EAAA,EADN,EAAA,KAAY,GAAA,CAAA,CAAA,GAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaObjectExampleCodeBlock.vue.script.js","names":[],"sources":["../../src/schema/SchemaObjectExampleCodeBlock.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n ScalarCard,\n ScalarCardFooter,\n ScalarCardSection,\n} from '@scalar/components/card'\nimport { ScalarCodeBlock } from '@scalar/components/code-block'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport { ExamplePicker } from '../code-example'\n\nconst { schema } = defineProps<{ schema: SchemaObject }>()\n\n/** Grab the examples for the schema object */\nconst examples = computed<Record<string, string>>(() => {\n const base: Record<string, string> = {}\n\n // x-examples extension\n if (schema['x-examples']) {\n Object.entries(schema['x-examples']).forEach(([key, value]) => {\n base[key] =\n typeof value === 'object'\n ? JSON.stringify(value, null, 2)\n : String(value)\n })\n }\n\n // Regular schema examples array\n if (schema.examples) {\n schema.examples.forEach((value, index) => {\n base[`Example ${index + 1}`] =\n typeof value === 'object'\n ? JSON.stringify(value, null, 2)\n : String(value)\n })\n }\n\n return base\n})\n\n/** The currently selected example key */\nconst selectedExampleKey = ref<string>(Object.keys(examples.value)[0] ?? '')\n</script>\n<template>\n <ScalarCard\n v-if=\"Object.keys(examples).length > 0\"\n class=\"dark-mode\">\n <!-- Code snippet -->\n <ScalarCardSection>\n <div class=\"code-snippet\">\n <ScalarCodeBlock\n class=\"bg-b-2\"\n lang=\"json\"\n lineNumbers\n :prettyPrintedContent=\"\n examples[selectedExampleKey] ??\n 'There was an error loading the example'\n \" />\n </div>\n </ScalarCardSection>\n\n <!-- Example picker -->\n <ScalarCardFooter\n v-if=\"Object.keys(examples).length > 1\"\n class=\"bg-b-3\">\n <ExamplePicker\n v-model=\"selectedExampleKey\"\n :examples />\n </ScalarCardFooter>\n </ScalarCard>\n</template>\n"],"mappings":";;;;;;;;;EAeA,IAAM,IAAW,QAAuC;GACtD,IAAM,IAA+B,CAAC;GAsBtC,OAnBI,EAAA,OAAO,iBACT,OAAO,QAAQ,EAAA,OAAO,aAAa,CAAC,CAAC,SAAS,CAAC,GAAK,OAAW;IAC7D,EAAK,KACH,OAAO,KAAU,WACb,KAAK,UAAU,GAAO,MAAM,CAAC,IAC7B,OAAO,CAAK;GACpB,CAAC,GAIC,EAAA,OAAO,YACT,EAAA,OAAO,SAAS,SAAS,GAAO,MAAU;IACxC,EAAK,WAAW,IAAQ,OACtB,OAAO,KAAU,WACb,KAAK,UAAU,GAAO,MAAM,CAAC,IAC7B,OAAO,CAAK;GACpB,CAAC,GAGI;EACT,CAAC,GAGK,IAAqB,EAAY,OAAO,KAAK,EAAS,KAAK,CAAC,CAAC,MAAM,EAAE;mBAIjE,OAAO,KAAK,EAAA,KAAQ,CAAA,CAAE,SAAM,KAAA,EAAA,GADpC,EAyBa,EAAA,CAAA,GAAA;;GAvBX,OAAM;;oBAac,CAXpB,EAWoB,EAAA,CAAA,GAAA,MAAA;qBADZ,CATN,EASM,OATN,GASM,CARJ,EAOM,EAAA,CAAA,GAAA;KANJ,OAAM;KACN,MAAK;KACL,aAAA;KACC,sBAAmC,EAAA,MAAS,EAAA,UAAA;;;OAS3C,OAAO,KAAK,EAAA,KAAQ,CAAA,CAAE,SAAM,KAAA,EAAA,GADpC,EAMmB,EAAA,CAAA,GAAA;;IAJjB,OAAM;;qBAGQ,CAFd,EAEc,EAAA,CAAA,GAAA;iBADH,EAAA;8CAAkB,QAAA;KAC1B,UAAA,EAAA"}