@scalar/blocks 0.11.1 → 0.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (325) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/code-example/components/AsyncApiCodeExample.vue.js +111 -6
  3. package/dist/code-example/components/AsyncApiCodeExample.vue.js.map +1 -1
  4. package/dist/code-example/components/AsyncApiCodeExample3.vue.js +8 -0
  5. package/dist/code-example/components/AsyncApiCodeExample3.vue.js.map +1 -0
  6. package/dist/code-example/components/CodeExample.vue.d.ts +10 -0
  7. package/dist/code-example/components/CodeExample.vue.d.ts.map +1 -1
  8. package/dist/code-example/components/CodeExample.vue.js +297 -6
  9. package/dist/code-example/components/CodeExample.vue.js.map +1 -1
  10. package/dist/code-example/components/CodeExample3.vue.js +8 -0
  11. package/dist/code-example/components/CodeExample3.vue.js.map +1 -0
  12. package/dist/code-example/components/ExamplePicker.vue.d.ts +2 -0
  13. package/dist/code-example/components/ExamplePicker.vue.d.ts.map +1 -1
  14. package/dist/code-example/components/ExamplePicker.vue.js +50 -4
  15. package/dist/code-example/components/ExamplePicker.vue.js.map +1 -1
  16. package/dist/code-example/components/ExamplePicker2.vue.js +6 -0
  17. package/dist/code-example/components/ExamplePicker2.vue.js.map +1 -0
  18. package/dist/code-example/components/HttpMethod.vue.js +32 -4
  19. package/dist/code-example/components/HttpMethod.vue.js.map +1 -1
  20. package/dist/code-example/components/HttpMethod2.vue.js +6 -0
  21. package/dist/code-example/components/HttpMethod2.vue.js.map +1 -0
  22. package/dist/code-example/helpers/filter-clients-by-query.js.map +1 -1
  23. package/dist/code-example/helpers/find-client.js.map +1 -1
  24. package/dist/code-example/helpers/format-language.js.map +1 -1
  25. package/dist/code-example/helpers/generate-client-options.js.map +1 -1
  26. package/dist/code-example/helpers/generate-code-snippet.d.ts +8 -2
  27. package/dist/code-example/helpers/generate-code-snippet.d.ts.map +1 -1
  28. package/dist/code-example/helpers/generate-code-snippet.js +57 -27
  29. package/dist/code-example/helpers/generate-code-snippet.js.map +1 -1
  30. package/dist/code-example/helpers/get-asyncapi-example-context.js.map +1 -1
  31. package/dist/code-example/helpers/get-clients.js.map +1 -1
  32. package/dist/code-example/helpers/get-custom-code-samples.js.map +1 -1
  33. package/dist/code-example/helpers/get-generated-payload-example.js.map +1 -1
  34. package/dist/code-example/helpers/get-message-example-content.js.map +1 -1
  35. package/dist/code-example/helpers/get-secrets.js.map +1 -1
  36. package/dist/code-example/helpers/get-snippet.d.ts +2 -2
  37. package/dist/code-example/helpers/get-snippet.d.ts.map +1 -1
  38. package/dist/code-example/helpers/get-snippet.js +7 -9
  39. package/dist/code-example/helpers/get-snippet.js.map +1 -1
  40. package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts +1 -1
  41. package/dist/code-example/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
  42. package/dist/code-example/helpers/operation-to-har/operation-to-har.js +1 -1
  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.d.ts +2 -2
  45. package/dist/code-example/helpers/operation-to-har/process-body.d.ts.map +1 -1
  46. package/dist/code-example/helpers/operation-to-har/process-body.js +102 -81
  47. package/dist/code-example/helpers/operation-to-har/process-body.js.map +1 -1
  48. package/dist/code-example/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
  49. package/dist/code-example/helpers/operation-to-har/process-parameters.js +110 -108
  50. package/dist/code-example/helpers/operation-to-har/process-parameters.js.map +1 -1
  51. package/dist/code-example/helpers/operation-to-har/process-security-schemes.js +6 -6
  52. package/dist/code-example/helpers/operation-to-har/process-security-schemes.js.map +1 -1
  53. package/dist/code-example/helpers/operation-to-har/process-server-url.js.map +1 -1
  54. package/dist/code-example/index.d.ts +1 -1
  55. package/dist/code-example/index.d.ts.map +1 -1
  56. package/dist/code-example/index.js +14 -14
  57. package/dist/code-example/mount-asyncapi.js +1 -1
  58. package/dist/code-example/mount-asyncapi.js.map +1 -1
  59. package/dist/code-example/mount.js +1 -1
  60. package/dist/code-example/mount.js.map +1 -1
  61. package/dist/constants.js +1 -1
  62. package/dist/schema/LinkButton.vue.js.map +1 -1
  63. package/dist/schema/RenderString.vue.js +11 -4
  64. package/dist/schema/RenderString.vue.js.map +1 -1
  65. package/dist/schema/RenderString2.vue.js +6 -0
  66. package/dist/schema/RenderString2.vue.js.map +1 -0
  67. package/dist/schema/Schema.vue.js +235 -6
  68. package/dist/schema/Schema.vue.js.map +1 -1
  69. package/dist/schema/Schema3.vue.js +8 -0
  70. package/dist/schema/Schema3.vue.js.map +1 -0
  71. package/dist/schema/SchemaCollapsedPreview.vue.js +25 -4
  72. package/dist/schema/SchemaCollapsedPreview.vue.js.map +1 -1
  73. package/dist/schema/SchemaCollapsedPreview2.vue.js +6 -0
  74. package/dist/schema/SchemaCollapsedPreview2.vue.js.map +1 -0
  75. package/dist/schema/SchemaComposition.vue.js +232 -6
  76. package/dist/schema/SchemaComposition.vue.js.map +1 -1
  77. package/dist/schema/SchemaComposition3.vue.js +8 -0
  78. package/dist/schema/SchemaComposition3.vue.js.map +1 -0
  79. package/dist/schema/SchemaEnumPropertyItem.vue.d.ts +1 -0
  80. package/dist/schema/SchemaEnumPropertyItem.vue.d.ts.map +1 -1
  81. package/dist/schema/SchemaEnumPropertyItem.vue.js +23 -4
  82. package/dist/schema/SchemaEnumPropertyItem.vue.js.map +1 -1
  83. package/dist/schema/SchemaEnumPropertyItem2.vue.js +6 -0
  84. package/dist/schema/SchemaEnumPropertyItem2.vue.js.map +1 -0
  85. package/dist/schema/SchemaEnums.vue.d.ts.map +1 -1
  86. package/dist/schema/SchemaEnums.vue.js +74 -6
  87. package/dist/schema/SchemaEnums.vue.js.map +1 -1
  88. package/dist/schema/SchemaEnums3.vue.js +8 -0
  89. package/dist/schema/SchemaEnums3.vue.js.map +1 -0
  90. package/dist/schema/SchemaGlyphPuck.vue.js +27 -4
  91. package/dist/schema/SchemaGlyphPuck.vue.js.map +1 -1
  92. package/dist/schema/SchemaGlyphPuck2.vue.js +6 -0
  93. package/dist/schema/SchemaGlyphPuck2.vue.js.map +1 -0
  94. package/dist/schema/SchemaGutterToggle.vue.js +40 -4
  95. package/dist/schema/SchemaGutterToggle.vue.js.map +1 -1
  96. package/dist/schema/SchemaGutterToggle2.vue.js +6 -0
  97. package/dist/schema/SchemaGutterToggle2.vue.js.map +1 -0
  98. package/dist/schema/SchemaHeading.vue.js +32 -6
  99. package/dist/schema/SchemaHeading.vue.js.map +1 -1
  100. package/dist/schema/SchemaHeading3.vue.js +8 -0
  101. package/dist/schema/SchemaHeading3.vue.js.map +1 -0
  102. package/dist/schema/SchemaObjectExampleCodeBlock.vue.js +42 -4
  103. package/dist/schema/SchemaObjectExampleCodeBlock.vue.js.map +1 -1
  104. package/dist/schema/SchemaObjectExampleCodeBlock2.vue.js +6 -0
  105. package/dist/schema/SchemaObjectExampleCodeBlock2.vue.js.map +1 -0
  106. package/dist/schema/SchemaObjectProperties.vue.js +213 -4
  107. package/dist/schema/SchemaObjectProperties.vue.js.map +1 -1
  108. package/dist/schema/SchemaObjectProperties2.vue.js +6 -0
  109. package/dist/schema/SchemaObjectProperties2.vue.js.map +1 -0
  110. package/dist/schema/SchemaProperty.vue.d.ts +1 -1
  111. package/dist/schema/SchemaProperty.vue.d.ts.map +1 -1
  112. package/dist/schema/SchemaProperty.vue.js +472 -6
  113. package/dist/schema/SchemaProperty.vue.js.map +1 -1
  114. package/dist/schema/SchemaProperty3.vue.js +8 -0
  115. package/dist/schema/SchemaProperty3.vue.js.map +1 -0
  116. package/dist/schema/SchemaPropertyDefault.vue.js +61 -6
  117. package/dist/schema/SchemaPropertyDefault.vue.js.map +1 -1
  118. package/dist/schema/SchemaPropertyDefault3.vue.js +8 -0
  119. package/dist/schema/SchemaPropertyDefault3.vue.js.map +1 -0
  120. package/dist/schema/SchemaPropertyDetail.vue.js +22 -6
  121. package/dist/schema/SchemaPropertyDetail.vue.js.map +1 -1
  122. package/dist/schema/SchemaPropertyDetail3.vue.js +8 -0
  123. package/dist/schema/SchemaPropertyDetail3.vue.js.map +1 -0
  124. package/dist/schema/SchemaPropertyExamples.vue.js +133 -6
  125. package/dist/schema/SchemaPropertyExamples.vue.js.map +1 -1
  126. package/dist/schema/SchemaPropertyExamples3.vue.js +8 -0
  127. package/dist/schema/SchemaPropertyExamples3.vue.js.map +1 -0
  128. package/dist/schema/SchemaPropertyHeading.vue.d.ts +1 -1
  129. package/dist/schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
  130. package/dist/schema/SchemaPropertyHeading.vue.js +312 -6
  131. package/dist/schema/SchemaPropertyHeading.vue.js.map +1 -1
  132. package/dist/schema/SchemaPropertyHeading3.vue.js +8 -0
  133. package/dist/schema/SchemaPropertyHeading3.vue.js.map +1 -0
  134. package/dist/schema/SchemaPropertyPattern.vue.js +42 -6
  135. package/dist/schema/SchemaPropertyPattern.vue.js.map +1 -1
  136. package/dist/schema/SchemaPropertyPattern3.vue.js +8 -0
  137. package/dist/schema/SchemaPropertyPattern3.vue.js.map +1 -0
  138. package/dist/schema/SchemaRailPanel.vue.js +53 -4
  139. package/dist/schema/SchemaRailPanel.vue.js.map +1 -1
  140. package/dist/schema/SchemaRailPanel2.vue.js +6 -0
  141. package/dist/schema/SchemaRailPanel2.vue.js.map +1 -0
  142. package/dist/schema/components/CopyLinkButton.vue.d.ts +5 -0
  143. package/dist/schema/components/CopyLinkButton.vue.d.ts.map +1 -1
  144. package/dist/schema/components/CopyLinkButton.vue.js +24 -4
  145. package/dist/schema/components/CopyLinkButton.vue.js.map +1 -1
  146. package/dist/schema/components/CopyLinkButton2.vue.js +6 -0
  147. package/dist/schema/components/CopyLinkButton2.vue.js.map +1 -0
  148. package/dist/schema/components/WithBreadcrumb.vue.js +15 -4
  149. package/dist/schema/components/WithBreadcrumb.vue.js.map +1 -1
  150. package/dist/schema/components/WithBreadcrumb2.vue.js +6 -0
  151. package/dist/schema/components/WithBreadcrumb2.vue.js.map +1 -0
  152. package/dist/schema/helpers/dynamic-scope.js.map +1 -1
  153. package/dist/schema/helpers/format-example.js.map +1 -1
  154. package/dist/schema/helpers/format-structured-value.d.ts +3 -0
  155. package/dist/schema/helpers/format-structured-value.d.ts.map +1 -0
  156. package/dist/schema/helpers/format-structured-value.js +6 -0
  157. package/dist/schema/helpers/format-structured-value.js.map +1 -0
  158. package/dist/schema/helpers/format-value.js.map +1 -1
  159. package/dist/schema/helpers/get-compositions-to-render.js.map +1 -1
  160. package/dist/schema/helpers/get-discriminator-values.js.map +1 -1
  161. package/dist/schema/helpers/get-enum-values.js.map +1 -1
  162. package/dist/schema/helpers/get-property-description.js.map +1 -1
  163. package/dist/schema/helpers/get-ref-name.js.map +1 -1
  164. package/dist/schema/helpers/get-rendered-example.js.map +1 -1
  165. package/dist/schema/helpers/get-schema-type.js.map +1 -1
  166. package/dist/schema/helpers/get-type-signature-tokens.d.ts.map +1 -1
  167. package/dist/schema/helpers/get-type-signature-tokens.js +37 -36
  168. package/dist/schema/helpers/get-type-signature-tokens.js.map +1 -1
  169. package/dist/schema/helpers/has-complex-array-items.js.map +1 -1
  170. package/dist/schema/helpers/is-empty-schema-object.js.map +1 -1
  171. package/dist/schema/helpers/is-model-linkable.js.map +1 -1
  172. package/dist/schema/helpers/is-on-schema-target-path.js.map +1 -1
  173. package/dist/schema/helpers/is-type-object.js.map +1 -1
  174. package/dist/schema/helpers/merge-all-of-schemas.js.map +1 -1
  175. package/dist/schema/helpers/normalize-object-composition.js.map +1 -1
  176. package/dist/schema/helpers/optimize-value-for-display.js.map +1 -1
  177. package/dist/schema/helpers/partition-all-of-compositions.js.map +1 -1
  178. package/dist/schema/helpers/schema-cycle.js.map +1 -1
  179. package/dist/schema/helpers/schema-expansion.js.map +1 -1
  180. package/dist/schema/helpers/schema-keyboard-nav.js.map +1 -1
  181. package/dist/schema/helpers/schema-name.js.map +1 -1
  182. package/dist/schema/helpers/should-display-description.js.map +1 -1
  183. package/dist/schema/helpers/should-display-heading.js.map +1 -1
  184. package/dist/schema/helpers/should-render-array-item-composition.js.map +1 -1
  185. package/dist/schema/helpers/sort-property-names.js.map +1 -1
  186. package/dist/schema/helpers/unwrap-for-read.js.map +1 -1
  187. package/dist/schema/index.js +8 -8
  188. package/dist/schema/localization/index.d.ts +1 -1
  189. package/dist/schema/localization/index.js.map +1 -1
  190. package/dist/schema/localization/translations.js.map +1 -1
  191. package/dist/shared/Badge.vue.js +13 -6
  192. package/dist/shared/Badge.vue.js.map +1 -1
  193. package/dist/shared/Badge3.vue.js +8 -0
  194. package/dist/shared/Badge3.vue.js.map +1 -0
  195. package/dist/shared/ExternalDocs.vue.js +43 -4
  196. package/dist/shared/ExternalDocs.vue.js.map +1 -1
  197. package/dist/shared/ExternalDocs2.vue.js +6 -0
  198. package/dist/shared/ExternalDocs2.vue.js.map +1 -0
  199. package/dist/shared/ExternalExampleStatus.vue.d.ts +12 -0
  200. package/dist/shared/ExternalExampleStatus.vue.d.ts.map +1 -0
  201. package/dist/shared/ExternalExampleStatus.vue.js +26 -0
  202. package/dist/shared/ExternalExampleStatus.vue.js.map +1 -0
  203. package/dist/shared/ExternalExampleStatus2.vue.js +6 -0
  204. package/dist/shared/ExternalExampleStatus2.vue.js.map +1 -0
  205. package/dist/shared/ScreenReader.vue.js +16 -4
  206. package/dist/shared/ScreenReader.vue.js.map +1 -1
  207. package/dist/shared/ScreenReader2.vue.js +6 -0
  208. package/dist/shared/ScreenReader2.vue.js.map +1 -0
  209. package/dist/shared/external-example-localization/index.d.ts +4 -0
  210. package/dist/shared/external-example-localization/index.d.ts.map +1 -0
  211. package/dist/shared/external-example-localization/index.js +17 -0
  212. package/dist/shared/external-example-localization/index.js.map +1 -0
  213. package/dist/shared/external-example-localization/locales/ar.d.ts +8 -0
  214. package/dist/shared/external-example-localization/locales/ar.d.ts.map +1 -0
  215. package/dist/shared/external-example-localization/locales/ar.js +9 -0
  216. package/dist/shared/external-example-localization/locales/ar.js.map +1 -0
  217. package/dist/shared/external-example-localization/locales/de.d.ts +8 -0
  218. package/dist/shared/external-example-localization/locales/de.d.ts.map +1 -0
  219. package/dist/shared/external-example-localization/locales/de.js +9 -0
  220. package/dist/shared/external-example-localization/locales/de.js.map +1 -0
  221. package/dist/shared/external-example-localization/locales/en.d.ts +8 -0
  222. package/dist/shared/external-example-localization/locales/en.d.ts.map +1 -0
  223. package/dist/shared/external-example-localization/locales/en.js +9 -0
  224. package/dist/shared/external-example-localization/locales/en.js.map +1 -0
  225. package/dist/shared/external-example-localization/locales/es.d.ts +8 -0
  226. package/dist/shared/external-example-localization/locales/es.d.ts.map +1 -0
  227. package/dist/shared/external-example-localization/locales/es.js +9 -0
  228. package/dist/shared/external-example-localization/locales/es.js.map +1 -0
  229. package/dist/shared/external-example-localization/locales/fr.d.ts +8 -0
  230. package/dist/shared/external-example-localization/locales/fr.d.ts.map +1 -0
  231. package/dist/shared/external-example-localization/locales/fr.js +9 -0
  232. package/dist/shared/external-example-localization/locales/fr.js.map +1 -0
  233. package/dist/shared/external-example-localization/locales/pt.d.ts +8 -0
  234. package/dist/shared/external-example-localization/locales/pt.d.ts.map +1 -0
  235. package/dist/shared/external-example-localization/locales/pt.js +9 -0
  236. package/dist/shared/external-example-localization/locales/pt.js.map +1 -0
  237. package/dist/shared/external-example-localization/locales/ru.d.ts +8 -0
  238. package/dist/shared/external-example-localization/locales/ru.d.ts.map +1 -0
  239. package/dist/shared/external-example-localization/locales/ru.js +9 -0
  240. package/dist/shared/external-example-localization/locales/ru.js.map +1 -0
  241. package/dist/shared/external-example-localization/locales/zh-cn.d.ts +8 -0
  242. package/dist/shared/external-example-localization/locales/zh-cn.d.ts.map +1 -0
  243. package/dist/shared/external-example-localization/locales/zh-cn.js +9 -0
  244. package/dist/shared/external-example-localization/locales/zh-cn.js.map +1 -0
  245. package/dist/shared/external-example-localization/locales/zh-tw.d.ts +8 -0
  246. package/dist/shared/external-example-localization/locales/zh-tw.d.ts.map +1 -0
  247. package/dist/shared/external-example-localization/locales/zh-tw.js +9 -0
  248. package/dist/shared/external-example-localization/locales/zh-tw.js.map +1 -0
  249. package/dist/shared/external-example-localization/translations.d.ts +67 -0
  250. package/dist/shared/external-example-localization/translations.d.ts.map +1 -0
  251. package/dist/shared/external-example-localization/translations.js +24 -0
  252. package/dist/shared/external-example-localization/translations.js.map +1 -0
  253. package/dist/shared/index.d.ts +3 -0
  254. package/dist/shared/index.d.ts.map +1 -1
  255. package/dist/shared/index.js +6 -4
  256. package/dist/specification-extensions/ExtensionValue.vue.js +89 -4
  257. package/dist/specification-extensions/ExtensionValue.vue.js.map +1 -1
  258. package/dist/specification-extensions/ExtensionValue2.vue.js +6 -0
  259. package/dist/specification-extensions/ExtensionValue2.vue.js.map +1 -0
  260. package/dist/specification-extensions/SpecificationExtensions.vue.js +76 -4
  261. package/dist/specification-extensions/SpecificationExtensions.vue.js.map +1 -1
  262. package/dist/specification-extensions/SpecificationExtensions2.vue.js +6 -0
  263. package/dist/specification-extensions/SpecificationExtensions2.vue.js.map +1 -0
  264. package/dist/specification-extensions/index.js +1 -1
  265. package/dist/style.css +13 -9
  266. package/dist/vue-styles.css +1 -1
  267. package/package.json +18 -18
  268. package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js +0 -113
  269. package/dist/code-example/components/AsyncApiCodeExample.vue_vue_type_script_setup_true_lang.js.map +0 -1
  270. package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js +0 -275
  271. package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js.map +0 -1
  272. package/dist/code-example/components/ExamplePicker.vue_vue_type_script_setup_true_lang.js +0 -48
  273. package/dist/code-example/components/ExamplePicker.vue_vue_type_script_setup_true_lang.js.map +0 -1
  274. package/dist/code-example/components/HttpMethod.vue_vue_type_script_setup_true_lang.js +0 -34
  275. package/dist/code-example/components/HttpMethod.vue_vue_type_script_setup_true_lang.js.map +0 -1
  276. package/dist/schema/RenderString.vue_vue_type_script_setup_true_lang.js +0 -13
  277. package/dist/schema/RenderString.vue_vue_type_script_setup_true_lang.js.map +0 -1
  278. package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js +0 -237
  279. package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js.map +0 -1
  280. package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js +0 -27
  281. package/dist/schema/SchemaCollapsedPreview.vue_vue_type_script_setup_true_lang.js.map +0 -1
  282. package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js +0 -234
  283. package/dist/schema/SchemaComposition.vue_vue_type_script_setup_true_lang.js.map +0 -1
  284. package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js +0 -23
  285. package/dist/schema/SchemaEnumPropertyItem.vue_vue_type_script_setup_true_lang.js.map +0 -1
  286. package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js +0 -77
  287. package/dist/schema/SchemaEnums.vue_vue_type_script_setup_true_lang.js.map +0 -1
  288. package/dist/schema/SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js +0 -29
  289. package/dist/schema/SchemaGlyphPuck.vue_vue_type_script_setup_true_lang.js.map +0 -1
  290. package/dist/schema/SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js +0 -42
  291. package/dist/schema/SchemaGutterToggle.vue_vue_type_script_setup_true_lang.js.map +0 -1
  292. package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js +0 -34
  293. package/dist/schema/SchemaHeading.vue_vue_type_script_setup_true_lang.js.map +0 -1
  294. package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js +0 -44
  295. package/dist/schema/SchemaObjectExampleCodeBlock.vue_vue_type_script_setup_true_lang.js.map +0 -1
  296. package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js +0 -215
  297. package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js.map +0 -1
  298. package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js +0 -469
  299. package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js.map +0 -1
  300. package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js +0 -63
  301. package/dist/schema/SchemaPropertyDefault.vue_vue_type_script_setup_true_lang.js.map +0 -1
  302. package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js +0 -24
  303. package/dist/schema/SchemaPropertyDetail.vue_vue_type_script_setup_true_lang.js.map +0 -1
  304. package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js +0 -135
  305. package/dist/schema/SchemaPropertyExamples.vue_vue_type_script_setup_true_lang.js.map +0 -1
  306. package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js +0 -314
  307. package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js.map +0 -1
  308. package/dist/schema/SchemaPropertyPattern.vue_vue_type_script_setup_true_lang.js +0 -44
  309. package/dist/schema/SchemaPropertyPattern.vue_vue_type_script_setup_true_lang.js.map +0 -1
  310. package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js +0 -55
  311. package/dist/schema/SchemaRailPanel.vue_vue_type_script_setup_true_lang.js.map +0 -1
  312. package/dist/schema/components/CopyLinkButton.vue_vue_type_script_setup_true_lang.js +0 -25
  313. package/dist/schema/components/CopyLinkButton.vue_vue_type_script_setup_true_lang.js.map +0 -1
  314. package/dist/schema/components/WithBreadcrumb.vue_vue_type_script_setup_true_lang.js +0 -17
  315. package/dist/schema/components/WithBreadcrumb.vue_vue_type_script_setup_true_lang.js.map +0 -1
  316. package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js +0 -15
  317. package/dist/shared/Badge.vue_vue_type_script_setup_true_lang.js.map +0 -1
  318. package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js +0 -45
  319. package/dist/shared/ExternalDocs.vue_vue_type_script_setup_true_lang.js.map +0 -1
  320. package/dist/shared/ScreenReader.vue_vue_type_script_setup_true_lang.js +0 -18
  321. package/dist/shared/ScreenReader.vue_vue_type_script_setup_true_lang.js.map +0 -1
  322. package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js +0 -91
  323. package/dist/specification-extensions/ExtensionValue.vue_vue_type_script_setup_true_lang.js.map +0 -1
  324. package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js +0 -78
  325. package/dist/specification-extensions/SpecificationExtensions.vue_vue_type_script_setup_true_lang.js.map +0 -1
@@ -1,6 +1,26 @@
1
- import e from "./CopyLinkButton.vue_vue_type_script_setup_true_lang.js";
2
- // src/schema/components/CopyLinkButton.vue
3
- var t = e;
4
- export { t as default };
1
+ import { useLocalization as e } from "../localization/index.js";
2
+ import { computed as t, createElementBlock as n, createElementVNode as r, createTextVNode as i, createVNode as a, defineComponent as o, openBlock as s, renderSlot as c, toDisplayString as l, unref as u } from "vue";
3
+ import { ScalarIconHash as d } from "@scalar/icons";
4
+ // src/schema/components/CopyLinkButton.vue?vue&type=script&setup=true&lang.ts
5
+ var f = { class: "sr-only" }, p = /*@__PURE__*/ o({
6
+ __name: "CopyLinkButton",
7
+ props: {
8
+ anchorId: {},
9
+ propertyName: {},
10
+ eventBus: {}
11
+ },
12
+ setup(o) {
13
+ let { translate: p } = e(), m = t(() => p("actions.copyLinkTo", { name: o.propertyName }));
14
+ return (e, t) => (s(), n("button", {
15
+ class: "copy-link-trailing text-c-3 hover:text-c-1 -my-1.25 ms-1.25! -me-1.25! flex shrink-0 cursor-pointer items-center justify-center self-center p-1.25 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 pointer-coarse:hidden",
16
+ type: "button",
17
+ onClick: t[0] ||= () => o.eventBus?.emit("copy-url:nav-item", { id: o.anchorId })
18
+ }, [a(u(d), {
19
+ "aria-hidden": "true",
20
+ class: "size-3.5"
21
+ }), r("span", f, [c(e.$slots, "sr-label", {}, () => [i(l(m.value), 1)])])]));
22
+ }
23
+ });
24
+ export { p as default };
5
25
 
6
26
  //# sourceMappingURL=CopyLinkButton.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CopyLinkButton.vue.js","names":["CopyLinkButton_vue_vue_type_script_setup_true_lang_default","CopyLinkButton_default"],"sources":[],"mappings":""}
1
+ {"version":3,"file":"CopyLinkButton.vue.js","names":["_openBlock","_createElementBlock","_createVNode","_unref","_createElementVNode","_renderSlot","_createTextVNode","_toDisplayString","useLocalization","computed","createElementBlock","createElementVNode","createTextVNode","createVNode","defineComponent","openBlock","renderSlot","toDisplayString","unref","ScalarIconHash","_hoisted_1","CopyLinkButton_vue_vue_type_script_setup_true_lang_default","__props","translate","copyLinkLabel","_ctx","_cache"],"sources":["../../../src/schema/components/CopyLinkButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconHash } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { computed } from 'vue'\n\nimport { useLocalization } from '../localization'\n\n/**\n * A property row's deep-link affordance: the same hash the section headings\n * and the models list show, trailing the row's text in the flow of the heading\n * and revealed on hover or focus. It is a separate component so it can render\n * as the LAST child of the heading: inside `WithBreadcrumb`, which wraps the\n * name, it would come before the type in the tab order (WCAG 2.4.3).\n */\nconst { anchorId, propertyName } = defineProps<{\n /** The anchor this button copies a link to */\n anchorId: string\n /**\n * Full property name used in the accessible label.\n * Names can contain dots, which also separate segments in the anchor ID.\n */\n propertyName: string\n eventBus: WorkspaceEventBus | null\n}>()\n\nconst { translate } = useLocalization()\n\n/** Screen-reader label for the copy-link button, naming the deep-linked item. */\nconst copyLinkLabel = computed(() =>\n translate('actions.copyLinkTo', {\n name: propertyName,\n }),\n)\n</script>\n\n<template>\n <!-- A flex item of the heading, so it wraps with the text. Negative margins\n cancel the padding of the 24px hit area WCAG 2.5.8 asks for, so the box\n overhangs the line instead of taking room from it: vertically it never\n changes the line height, and horizontally the row gives up only the 10px\n gap and the 14px icon (5 + 24 - 5), which is what a collapsed preview\n before it truncates against.\n\n Both inline margins carry `!`: the heading's scoped `.property-heading > *`\n sets a 9px right margin, which is the end margin in LTR and the start\n margin in RTL, at the same specificity as the utility. Which one wins\n depends on whether the consumer's stylesheet puts the utilities before or\n after `vue-styles.css`.\n\n pointer-coarse drops it entirely rather than leaving it transparent: a\n touch pointer has no hover, so a still-laid-out button would be an\n invisible tap target AND would keep pushing long signature lines onto a\n second line just to show a control nobody can see. A deep link stays\n reachable there through the address bar. -->\n <button\n class=\"copy-link-trailing text-c-3 hover:text-c-1 -my-1.25 ms-1.25! -me-1.25! flex shrink-0 cursor-pointer items-center justify-center self-center p-1.25 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 pointer-coarse:hidden\"\n type=\"button\"\n @click=\"() => eventBus?.emit('copy-url:nav-item', { id: anchorId })\">\n <ScalarIconHash\n aria-hidden=\"true\"\n class=\"size-3.5\" />\n <span class=\"sr-only\">\n <slot name=\"sr-label\">{{ copyLinkLabel }}</slot>\n </span>\n </button>\n</template>\n"],"mappings":";;;;;;;;;;;;EAyBA,IAAM,EAAEuB,iBAAcf,EAAgB,GAGhCgB,IAAgBf,QACpBc,EAAU,sBAAsB,EAC9B,MAAMD,EAAA,aACR,CAAC,CACH;E,kBAsBEtB,EAAA,GAAAC,EAUS,UAAA;GATP,OAAM;GACN,MAAK;GACJ,SAAKyB,EAAA,aAAQJ,EAAA,UAAU,KAAI,qBAAA,EAAA,IAA4BA,EAAA,SAAQ,CAAA;E,IAChEpB,EAEqBC,EAAAgB,CAAA,GAAA;GADnB,eAAY;GACZ,OAAM;E,IACRf,EAEO,QAFPgB,GAEO,CADLf,EAAgDoB,EAAA,QAAA,YAAA,CAAA,SAAA,CAAvBnB,EAAAC,EAAAiB,EAAA,KAAa,GAAA,CAAA,C"}
@@ -0,0 +1,6 @@
1
+ import e from "./CopyLinkButton.vue.js";
2
+ // src/schema/components/CopyLinkButton.vue
3
+ var t = e;
4
+ export { t as default };
5
+
6
+ //# sourceMappingURL=CopyLinkButton2.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CopyLinkButton2.vue.js","names":["CopyLinkButton_vue_vue_type_script_setup_true_lang_default","CopyLinkButton_default"],"sources":[],"mappings":""}
@@ -1,6 +1,17 @@
1
- import e from "./WithBreadcrumb.vue_vue_type_script_setup_true_lang.js";
2
- // src/schema/components/WithBreadcrumb.vue
3
- var t = e;
4
- export { t as default };
1
+ import { createElementBlock as e, defineComponent as t, openBlock as n, renderSlot as r } from "vue";
2
+ // src/schema/components/WithBreadcrumb.vue?vue&type=script&setup=true&lang.ts
3
+ var i = ["id"], a = /*@__PURE__*/ t({
4
+ __name: "WithBreadcrumb",
5
+ props: { breadcrumb: {} },
6
+ setup(t) {
7
+ return (a, o) => t.breadcrumb && t.breadcrumb.length > 0 ? (n(), e("div", {
8
+ key: 0,
9
+ id: t.breadcrumb.join("."),
10
+ class: "static scroll-mt-24",
11
+ tabindex: "-1"
12
+ }, [r(a.$slots, "default")], 8, i)) : r(a.$slots, "default", {}, void 0, void 0, 1);
13
+ }
14
+ });
15
+ export { a as default };
5
16
 
6
17
  //# sourceMappingURL=WithBreadcrumb.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WithBreadcrumb.vue.js","names":["WithBreadcrumb_vue_vue_type_script_setup_true_lang_default","WithBreadcrumb_default"],"sources":[],"mappings":""}
1
+ {"version":3,"file":"WithBreadcrumb.vue.js","names":["_openBlock","_createElementBlock","_renderSlot","createElementBlock","defineComponent","openBlock","renderSlot","_hoisted_1","WithBreadcrumb_vue_vue_type_script_setup_true_lang_default","__props","_ctx","_cache"],"sources":["../../../src/schema/components/WithBreadcrumb.vue"],"sourcesContent":["<script setup lang=\"ts\">\nconst { breadcrumb } = defineProps<{\n breadcrumb?: string[]\n}>()\n</script>\n\n<template>\n <template v-if=\"breadcrumb && breadcrumb.length > 0\">\n <!-- `tabindex=\"-1\"`: focusable programmatically but out of the tab order,\n so a deep link can move focus to its target instead of leaving keyboard\n and screen-reader users at the top of the document -->\n <div\n :id=\"breadcrumb.join('.')\"\n class=\"static scroll-mt-24\"\n tabindex=\"-1\">\n <!-- Content -->\n <slot />\n <!-- No copy button here: the row's heading renders it as its last child\n so tab order matches visual order. See CopyLinkButton.vue -->\n </div>\n </template>\n <template v-else>\n <slot />\n </template>\n</template>\n"],"mappings":";;;;;;E,iBAOkBS,EAAA,cAAcA,EAAA,WAAW,SAAM,KAI7CT,EAAA,GAAAC,EAQM,OAAA;;GAPH,IAAIQ,EAAA,WAAW,KAAI,GAAA;GACpB,OAAM;GACN,UAAS;E,IAETP,EAAQQ,EAAA,QAAA,SAAA,C,YAMVR,EAAQQ,EAAA,QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,KAAA,GAAA,CAAA"}
@@ -0,0 +1,6 @@
1
+ import e from "./WithBreadcrumb.vue.js";
2
+ // src/schema/components/WithBreadcrumb.vue
3
+ var t = e;
4
+ export { t as default };
5
+
6
+ //# sourceMappingURL=WithBreadcrumb2.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WithBreadcrumb2.vue.js","names":["WithBreadcrumb_vue_vue_type_script_setup_true_lang_default","WithBreadcrumb_default"],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"dynamic-scope.js","names":["resolveDynamicSchema","isDynamicRef","schema","seen","current","target","normalizeDynamicRefTarget","DYNAMIC_REF_VALUE","resolveDisplaySchema","source","getResolvedRef","resolve"],"sources":["../../../src/schema/helpers/dynamic-scope.ts"],"sourcesContent":["import { isDynamicRef, normalizeDynamicRefTarget } from '@scalar/workspace-store/helpers/dynamic-ref'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { DYNAMIC_REF_VALUE, resolve } from '@scalar/workspace-store/resolve'\nimport type {\n ReferenceType,\n SchemaObject,\n SchemaReferenceType,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\n/**\n * Resolving JSON Schema 2020-12 `$dynamicRef` while rendering a schema.\n *\n * Unlike `$ref`, a `$dynamicRef` does not resolve to a fixed location: it binds to the active\n * `$dynamicAnchor` in the chain of schema resources entered to reach it, so the same\n * `{ \"$dynamicRef\": \"#itemType\" }` inside a shared generic template resolves to a different concrete\n * type depending on the path taken (e.g. `User` via a user page, `Group` via a group page).\n *\n * Resolution is owned by the workspace-store magic proxy, not by these components: the proxy threads the\n * dynamic scope as the document is walked and exposes the bound schema through the virtual\n * `$dynamicRef-value` property (mirroring `$ref-value`). Rendering simply reads that property, so the\n * scope never has to be assembled here. See https://github.com/scalar/scalar/issues/9414.\n */\n\n/**\n * Resolve a schema that may be a `$dynamicRef` to its bound concrete type.\n *\n * Returns the schema the proxy binds through `$dynamicRef-value`. When the reference cannot be resolved\n * — the schema is not a `$dynamicRef`, or has been detached from the proxy — the input is returned\n * unchanged, so rendering falls back to its prior behavior with no regression.\n */\nexport const resolveDynamicSchema = <T extends SchemaReferenceType<SchemaObject> | undefined>(schema: T): T => {\n if (!isDynamicRef(schema)) {\n return schema\n }\n\n const seen = new Set<object>()\n let current: unknown = schema\n while (isDynamicRef(current) && !seen.has(current)) {\n seen.add(current)\n const target = normalizeDynamicRefTarget(Reflect.get(current, DYNAMIC_REF_VALUE))\n if (!target) {\n break\n }\n current = target\n }\n return current as T\n}\n\n/** Read a media or parameter schema while preserving the scopes of its referenced properties. */\nexport const resolveDisplaySchema = (\n source: ReferenceType<SchemaObject> | null | undefined,\n): SchemaObject | undefined => {\n if (!source) {\n return undefined\n }\n const target = getResolvedRef<SchemaObject>(source)\n const schema = target && typeof target === 'object' && '$ref' in target ? resolve.schema(source) : target\n return resolveDynamicSchema(schema)\n}\n"],"mappings":";;;;AA8BA,IAAaA,KAAiF,MAAiB;CAC7G,IAAI,CAACC,EAAaC,CAAM,GACtB,OAAOA;CAGT,IAAMC,oBAAO,IAAI,IAAY,GACzBC,IAAmBF;CACvB,OAAOD,EAAaG,CAAO,KAAK,CAACD,EAAK,IAAIC,CAAO,IAAG;EAClD,EAAK,IAAIA,CAAO;EAChB,IAAMC,IAASC,EAA0B,QAAQ,IAAIF,GAASG,CAAiB,CAAC;EAChF,IAAI,CAACF,GACH;EAEF,IAAUA;CACZ;CACA,OAAOD;AACT,GAGaI,KACX,MAC6B;CAC7B,IAAI,CAACC,GACH;CAEF,IAAMJ,IAASK,EAA6BD,CAAM;CAElD,OAAOT,EADQK,KAAU,OAAOA,KAAW,YAAY,UAAUA,IAASM,EAAQ,OAAOF,CAAM,IAAIJ,CACjE;AACpC"}
1
+ {"version":3,"file":"dynamic-scope.js","names":["getResolvedRef","DYNAMIC_REF_VALUE","resolve","isDynamicRef","normalizeDynamicRefTarget","resolveDynamicSchema","schema","seen","current","target","resolveDisplaySchema","source"],"sources":["../../../src/schema/helpers/dynamic-scope.ts"],"sourcesContent":["import { isDynamicRef, normalizeDynamicRefTarget } from '@scalar/workspace-store/helpers/dynamic-ref'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { DYNAMIC_REF_VALUE, resolve } from '@scalar/workspace-store/resolve'\nimport type {\n ReferenceType,\n SchemaObject,\n SchemaReferenceType,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\n/**\n * Resolving JSON Schema 2020-12 `$dynamicRef` while rendering a schema.\n *\n * Unlike `$ref`, a `$dynamicRef` does not resolve to a fixed location: it binds to the active\n * `$dynamicAnchor` in the chain of schema resources entered to reach it, so the same\n * `{ \"$dynamicRef\": \"#itemType\" }` inside a shared generic template resolves to a different concrete\n * type depending on the path taken (e.g. `User` via a user page, `Group` via a group page).\n *\n * Resolution is owned by the workspace-store magic proxy, not by these components: the proxy threads the\n * dynamic scope as the document is walked and exposes the bound schema through the virtual\n * `$dynamicRef-value` property (mirroring `$ref-value`). Rendering simply reads that property, so the\n * scope never has to be assembled here. See https://github.com/scalar/scalar/issues/9414.\n */\n\n/**\n * Resolve a schema that may be a `$dynamicRef` to its bound concrete type.\n *\n * Returns the schema the proxy binds through `$dynamicRef-value`. When the reference cannot be resolved\n * — the schema is not a `$dynamicRef`, or has been detached from the proxy — the input is returned\n * unchanged, so rendering falls back to its prior behavior with no regression.\n */\nexport const resolveDynamicSchema = <T extends SchemaReferenceType<SchemaObject> | undefined>(schema: T): T => {\n if (!isDynamicRef(schema)) {\n return schema\n }\n\n const seen = new Set<object>()\n let current: unknown = schema\n while (isDynamicRef(current) && !seen.has(current)) {\n seen.add(current)\n const target = normalizeDynamicRefTarget(Reflect.get(current, DYNAMIC_REF_VALUE))\n if (!target) {\n break\n }\n current = target\n }\n return current as T\n}\n\n/** Read a media or parameter schema while preserving the scopes of its referenced properties. */\nexport const resolveDisplaySchema = (\n source: ReferenceType<SchemaObject> | null | undefined,\n): SchemaObject | undefined => {\n if (!source) {\n return undefined\n }\n const target = getResolvedRef<SchemaObject>(source)\n const schema = target && typeof target === 'object' && '$ref' in target ? resolve.schema(source) : target\n return resolveDynamicSchema(schema)\n}\n"],"mappings":";;;;AA8BA,IAAaK,KAAiFC,MAAiB;CAC7G,IAAI,CAACH,EAAaG,CAAM,GACtB,OAAOA;CAGT,IAAMC,oBAAO,IAAI,IAAY,GACzBC,IAAmBF;CACvB,OAAOH,EAAaK,CAAO,KAAK,CAACD,EAAK,IAAIC,CAAO,IAAG;EAClDD,EAAK,IAAIC,CAAO;EAChB,IAAMC,IAASL,EAA0B,QAAQ,IAAII,GAASP,CAAiB,CAAC;EAChF,IAAI,CAACQ,GACH;EAEFD,IAAUC;CACZ;CACA,OAAOD;AACT,GAGaE,KACXC,MAC6B;CAC7B,IAAI,CAACA,GACH;CAEF,IAAMF,IAAST,EAA6BW,CAAM;CAElD,OAAON,EADQI,KAAU,OAAOA,KAAW,YAAY,UAAUA,IAASP,EAAQ,OAAOS,CAAM,IAAIF,CACjE;AACpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"format-example.js","names":["preserveOrTrim","trimmed","value","formatExample","example","item"],"sources":["../../../src/schema/helpers/format-example.ts"],"sourcesContent":["/**\n * Trims surrounding whitespace, but keeps the original string when trimming would empty it\n * (so an intentional \" \" example is not silently turned into \"\").\n */\nfunction preserveOrTrim(value: string): string {\n const trimmed = value.trim()\n return trimmed === '' ? value : trimmed\n}\n\n/**\n * Converts an example value to a string that can be displayed in the UI.\n */\nexport function formatExample(example: unknown): string | number {\n if (Array.isArray(example)) {\n return `[${example\n .map((item) => {\n if (typeof item === 'string') {\n return `\"${preserveOrTrim(item)}\"`\n }\n\n if (typeof item === 'object') {\n return JSON.stringify(item)\n }\n\n if (item === undefined) {\n return 'undefined'\n }\n\n if (item === null) {\n return 'null'\n }\n\n return item\n })\n .join(', ')}]`\n }\n\n if (example === null) {\n return 'null'\n }\n\n if (typeof example === 'object') {\n return JSON.stringify(example)\n }\n\n if (example === undefined) {\n return 'undefined'\n }\n\n if (typeof example === 'string') {\n return preserveOrTrim(example)\n }\n\n return preserveOrTrim(example.toString())\n}\n"],"mappings":";AAIA,SAASA,EAAe,GAAuB;CAC7C,IAAMC,IAAUC,EAAM,KAAK;CAC3B,OAAOD,MAAY,KAAKC,IAAQD;AAClC;AAKA,SAAgBE,EAAc,GAAmC;CAyC/D,OAxCI,MAAM,QAAQC,CAAO,IAChB,IAAIA,EACR,KAAK,MACA,OAAOC,KAAS,WACX,IAAIL,EAAeK,CAAI,EAAE,KAG9B,OAAOA,KAAS,WACX,KAAK,UAAUA,CAAI,IAGxBA,MAAS,KAAA,IACJ,cAGLA,MAAS,OACJ,SAGFA,CACR,CAAC,CACD,KAAK,IAAI,EAAE,KAGZD,MAAY,OACP,SAGL,OAAOA,KAAY,WACd,KAAK,UAAUA,CAAO,IAG3BA,MAAY,KAAA,IACP,cAIAJ,EADL,OAAOI,KAAY,WACCA,IAGFA,EAAQ,SAAS,CAHR;AAIjC"}
1
+ {"version":3,"file":"format-example.js","names":["preserveOrTrim","value","trimmed","formatExample","example","item"],"sources":["../../../src/schema/helpers/format-example.ts"],"sourcesContent":["/**\n * Trims surrounding whitespace, but keeps the original string when trimming would empty it\n * (so an intentional \" \" example is not silently turned into \"\").\n */\nfunction preserveOrTrim(value: string): string {\n const trimmed = value.trim()\n return trimmed === '' ? value : trimmed\n}\n\n/**\n * Converts an example value to a string that can be displayed in the UI.\n */\nexport function formatExample(example: unknown): string | number {\n if (Array.isArray(example)) {\n return `[${example\n .map((item) => {\n if (typeof item === 'string') {\n return `\"${preserveOrTrim(item)}\"`\n }\n\n if (typeof item === 'object') {\n return JSON.stringify(item)\n }\n\n if (item === undefined) {\n return 'undefined'\n }\n\n if (item === null) {\n return 'null'\n }\n\n return item\n })\n .join(', ')}]`\n }\n\n if (example === null) {\n return 'null'\n }\n\n if (typeof example === 'object') {\n return JSON.stringify(example)\n }\n\n if (example === undefined) {\n return 'undefined'\n }\n\n if (typeof example === 'string') {\n return preserveOrTrim(example)\n }\n\n return preserveOrTrim(example.toString())\n}\n"],"mappings":";AAIA,SAASA,EAAeC,GAAuB;CAC7C,IAAMC,IAAUD,EAAM,KAAK;CAC3B,OAAOC,MAAY,KAAKD,IAAQC;AAClC;AAKA,SAAgBC,EAAcC,GAAmC;CAyC/D,OAxCI,MAAM,QAAQA,CAAO,IAChB,IAAIA,EACR,KAAKC,MACA,OAAOA,KAAS,WACX,IAAIL,EAAeK,CAAI,EAAE,KAG9B,OAAOA,KAAS,WACX,KAAK,UAAUA,CAAI,IAGxBA,MAAS,KAAA,IACJ,cAGLA,MAAS,OACJ,SAGFA,CACR,CAAC,CACD,KAAK,IAAI,EAAE,KAGZD,MAAY,OACP,SAGL,OAAOA,KAAY,WACd,KAAK,UAAUA,CAAO,IAG3BA,MAAY,KAAA,IACP,cAIAJ,EADL,OAAOI,KAAY,WACCA,IAGFA,EAAQ,SAAS,CAHR;AAIjC"}
@@ -0,0 +1,3 @@
1
+ /** Use compact JSON for structured schema literals and their enum description keys. */
2
+ export declare const formatStructuredValue: (value: unknown) => string | undefined;
3
+ //# sourceMappingURL=format-structured-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-structured-value.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/format-structured-value.ts"],"names":[],"mappings":"AAEA,uFAAuF;AACvF,eAAO,MAAM,qBAAqB,GAAI,OAAO,OAAO,KAAG,MAAM,GAAG,SACP,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { isObjectLike as e } from "@scalar/helpers/object/is-object";
2
+ // src/schema/helpers/format-structured-value.ts
3
+ var t = (t) => e(t) ? JSON.stringify(t) : void 0;
4
+ export { t as formatStructuredValue };
5
+
6
+ //# sourceMappingURL=format-structured-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-structured-value.js","names":["isObjectLike","formatStructuredValue","value"],"sources":["../../../src/schema/helpers/format-structured-value.ts"],"sourcesContent":["import { isObjectLike } from '@scalar/helpers/object/is-object'\n\n/** Use compact JSON for structured schema literals and their enum description keys. */\nexport const formatStructuredValue = (value: unknown): string | undefined =>\n isObjectLike(value) ? JSON.stringify(value) : undefined\n"],"mappings":";;AAGA,IAAaC,KAAyBC,MACpCF,EAAaE,CAAK,IAAI,KAAK,UAAUA,CAAK,IAAI,KAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"format-value.js","names":["formatValue","value","item"],"sources":["../../../src/schema/helpers/format-value.ts"],"sourcesContent":["/**\n * Converts a value to a string that can be displayed in the UI.\n */\nexport function formatValue(value: unknown): string | number {\n if (Array.isArray(value)) {\n return `[${value\n .map((item) => {\n if (typeof item === 'string') {\n return `\"${item.toString().trim()}\"`\n }\n\n if (typeof item === 'object') {\n return JSON.stringify(item)\n }\n\n if (item === undefined) {\n return 'undefined'\n }\n\n if (item === null) {\n return 'null'\n }\n\n return item\n })\n .join(', ')}]`\n }\n\n if (value === null) {\n return 'null'\n }\n\n if (typeof value === 'object') {\n return JSON.stringify(value)\n }\n\n if (value === undefined) {\n return 'undefined'\n }\n\n if (typeof value === 'string') {\n return value.trim()\n }\n\n return value.toString().trim()\n}\n"],"mappings":";AAGA,SAAgBA,EAAY,GAAiC;CAyC3D,OAxCI,MAAM,QAAQC,CAAK,IACd,IAAIA,EACR,KAAK,MACA,OAAOC,KAAS,WACX,IAAIA,EAAK,SAAS,CAAC,CAAC,KAAK,EAAE,KAGhC,OAAOA,KAAS,WACX,KAAK,UAAUA,CAAI,IAGxBA,MAAS,KAAA,IACJ,cAGLA,MAAS,OACJ,SAGFA,CACR,CAAC,CACD,KAAK,IAAI,EAAE,KAGZD,MAAU,OACL,SAGL,OAAOA,KAAU,WACZ,KAAK,UAAUA,CAAK,IAGzBA,MAAU,KAAA,IACL,cAGL,OAAOA,KAAU,WACZA,EAAM,KAAK,IAGbA,EAAM,SAAS,CAAC,CAAC,KAAK;AAC/B"}
1
+ {"version":3,"file":"format-value.js","names":["formatValue","value","item"],"sources":["../../../src/schema/helpers/format-value.ts"],"sourcesContent":["/**\n * Converts a value to a string that can be displayed in the UI.\n */\nexport function formatValue(value: unknown): string | number {\n if (Array.isArray(value)) {\n return `[${value\n .map((item) => {\n if (typeof item === 'string') {\n return `\"${item.toString().trim()}\"`\n }\n\n if (typeof item === 'object') {\n return JSON.stringify(item)\n }\n\n if (item === undefined) {\n return 'undefined'\n }\n\n if (item === null) {\n return 'null'\n }\n\n return item\n })\n .join(', ')}]`\n }\n\n if (value === null) {\n return 'null'\n }\n\n if (typeof value === 'object') {\n return JSON.stringify(value)\n }\n\n if (value === undefined) {\n return 'undefined'\n }\n\n if (typeof value === 'string') {\n return value.trim()\n }\n\n return value.toString().trim()\n}\n"],"mappings":";AAGA,SAAgBA,EAAYC,GAAiC;CAyC3D,OAxCI,MAAM,QAAQA,CAAK,IACd,IAAIA,EACR,KAAKC,MACA,OAAOA,KAAS,WACX,IAAIA,EAAK,SAAS,CAAC,CAAC,KAAK,EAAE,KAGhC,OAAOA,KAAS,WACX,KAAK,UAAUA,CAAI,IAGxBA,MAAS,KAAA,IACJ,cAGLA,MAAS,OACJ,SAGFA,CACR,CAAC,CACD,KAAK,IAAI,EAAE,KAGZD,MAAU,OACL,SAGL,OAAOA,KAAU,WACZ,KAAK,UAAUA,CAAK,IAGzBA,MAAU,KAAA,IACL,cAGL,OAAOA,KAAU,WACZA,EAAM,KAAK,IAGbA,EAAM,SAAS,CAAC,CAAC,KAAK;AAC/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-compositions-to-render.js","names":["normalizeDiscriminatorMappingRef","value","inferDiscriminatorMappingComposition","mapping","document","unwrapForRead","documentProp","refs","variantRefs","mappingValue","ref","refName","getRefName","refValue","resolve","unescapeJsonPointerSegment","isDefined","getCompositionsToRender","compositions","composition","inferredDiscriminatorComposition","shouldRenderArrayItemComposition","isArraySchema","hasArrayItemComposition"],"sources":["../../../src/schema/helpers/get-compositions-to-render.ts"],"sourcesContent":["import { isDefined } from '@scalar/helpers/array/is-defined'\nimport { unescapeJsonPointerSegment } from '@scalar/helpers/json/unescape-json-pointer-segment'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { OpenApiDocument, SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\n\nimport { getRefName } from './get-ref-name'\nimport { type CompositionKeyword, compositions } from './schema-composition'\nimport { hasArrayItemComposition, shouldRenderArrayItemComposition } from './should-render-array-item-composition'\nimport { unwrapForRead } from './unwrap-for-read'\n\ntype CompositionToRender = {\n composition: CompositionKeyword\n value: SchemaObject\n}\n\ntype DocumentSchemaLookup = Pick<OpenApiDocument, 'components'>\n\nconst normalizeDiscriminatorMappingRef = (value: string) =>\n value.startsWith('#/') || value.includes('/') ? value : `#/components/schemas/${value}`\n\n/**\n * Builds a synthetic `oneOf` composition from a `discriminator.mapping` when the\n * schema declares a mapping but no explicit `oneOf`/`anyOf`. This is the shape\n * NSwag emits for polymorphic types, where the base type is a plain object with\n * a discriminator mapping pointing at the concrete variants.\n *\n * Returns `null` when there is nothing to infer (an explicit composition is\n * already present, no document to resolve refs against, or no resolvable refs).\n */\nexport const inferDiscriminatorMappingComposition = (\n value: SchemaObject,\n documentProp?: DocumentSchemaLookup,\n /** Inheritance can supply ordered variants, including schemas that share a mapped value. */\n variantRefs?: readonly string[],\n): SchemaObject | null => {\n if (value.oneOf || value.anyOf) {\n return null\n }\n\n // A schema without a mapping can never infer anything, so it is checked before the document is\n // touched at all: the document read below is by far the more expensive of the two.\n const mapping = value.discriminator?.mapping\n\n if (!mapping) {\n return null\n }\n\n // Reading `components.schemas` per row through the reactive and detect-changes layers is the\n // dominant cost of this helper, so the document is unwrapped once here. See `unwrapForRead`.\n const document = unwrapForRead(documentProp)\n\n if (!document?.components?.schemas) {\n return null\n }\n\n const refs = (variantRefs ?? Object.values(mapping))\n .filter((mappingValue): mappingValue is string => typeof mappingValue === 'string')\n .map((mappingValue) => {\n const ref = normalizeDiscriminatorMappingRef(mappingValue)\n const refName = getRefName(ref)\n const refValue = refName\n ? resolve.schema(document.components?.schemas?.[unescapeJsonPointerSegment(refName)])\n : undefined\n\n if (!refValue) {\n return undefined\n }\n\n return {\n $ref: ref,\n '$ref-value': refValue,\n }\n })\n .filter(isDefined)\n\n if (refs.length === 0) {\n return null\n }\n\n return {\n ...resolve.schema(value),\n oneOf: refs,\n }\n}\n\n/**\n * Computes which compositions should be rendered and with which values\n *\n * @param value - The schema object to check for compositions\n * @returns Array of compositions to render with their values\n */\nexport const getCompositionsToRender = (\n value: SchemaObject | undefined,\n document?: DocumentSchemaLookup,\n /**\n * The `oneOf` inferred from a bare `discriminator.mapping`, when the caller has\n * already computed it. `SchemaProperty` needs the same value to decide whether\n * to suppress the duplicate base object block, so it passes it here to avoid\n * inferring twice. Omit it and it is inferred from `value`.\n */\n inferredDiscriminatorComposition: SchemaObject | null = value\n ? inferDiscriminatorMappingComposition(value, document)\n : null,\n): CompositionToRender[] => {\n if (!value) {\n return []\n }\n\n return compositions\n .map((composition) => {\n if (composition === 'oneOf' && inferredDiscriminatorComposition) {\n return {\n composition,\n value: inferredDiscriminatorComposition,\n }\n }\n\n // Check for array item-level composition first (more specific case)\n if (shouldRenderArrayItemComposition(value, composition) && isArraySchema(value) && value.items) {\n return {\n composition,\n value: resolve.schema(value.items),\n }\n }\n\n // Check for property-level composition\n if (value[composition] && !hasArrayItemComposition(value, composition)) {\n return {\n composition,\n value: resolve.schema(value),\n }\n }\n\n return null\n })\n .filter(isDefined)\n}\n"],"mappings":";;;;;;;;;AAkBA,IAAMA,KAAoC,MACxCC,EAAM,WAAW,IAAI,KAAKA,EAAM,SAAS,GAAG,IAAIA,IAAQ,wBAAwBA,KAWrEC,KACX,GACA,GAEA,MACwB;CACxB,IAAID,EAAM,SAASA,EAAM,OACvB,OAAO;CAKT,IAAME,IAAUF,EAAM,eAAe;CAErC,IAAI,CAACE,GACH,OAAO;CAKT,IAAMC,IAAWC,EAAcC,CAAY;CAE3C,IAAI,CAACF,GAAU,YAAY,SACzB,OAAO;CAGT,IAAMG,KAAQC,KAAe,OAAO,OAAOL,CAAO,EAAA,CAC/C,QAAQ,MAAyC,OAAOM,KAAiB,QAAQ,CAAC,CAClF,KAAK,MAAiB;EACrB,IAAMC,IAAMV,EAAiCS,CAAY,GACnDE,IAAUC,EAAWF,CAAG,GACxBG,IAAWF,IACbG,EAAQ,OAAOV,EAAS,YAAY,UAAUW,EAA2BJ,CAAO,EAAE,IAClF,KAAA;EAEJ,IAAKE,GAIL,OAAO;GACL,MAAMH;GACN,cAAcG;EAChB;CACF,CAAC,CAAC,CACD,OAAOG,CAAS;CAMnB,OAJIT,EAAK,WAAW,IACX,OAGF;EACL,GAAGO,EAAQ,OAAOb,CAAK;EACvB,OAAOM;CACT;AACF,GAQaU,KACX,GACA,GAOA,IAAwDhB,IACpDC,EAAqCD,GAAOG,CAAQ,IACpD,SAECH,IAIEiB,EACJ,KAAK,MACAC,MAAgB,WAAWC,IACtB;CACL;CACA,OAAOA;AACT,IAIEC,EAAiCpB,GAAOkB,CAAW,KAAKG,EAAcrB,CAAK,KAAKA,EAAM,QACjF;CACL;CACA,OAAOa,EAAQ,OAAOb,EAAM,KAAK;AACnC,IAIEA,EAAMkB,MAAgB,CAACI,EAAwBtB,GAAOkB,CAAW,IAC5D;CACL;CACA,OAAOL,EAAQ,OAAOb,CAAK;AAC7B,IAGK,IACR,CAAC,CACD,OAAOe,CAAS,IA9BV,CAAC"}
1
+ {"version":3,"file":"get-compositions-to-render.js","names":["getRefName","compositions","hasArrayItemComposition","shouldRenderArrayItemComposition","unwrapForRead","resolve","isArraySchema","isDefined","unescapeJsonPointerSegment","normalizeDiscriminatorMappingRef","value","inferDiscriminatorMappingComposition","documentProp","variantRefs","mapping","document","refs","mappingValue","ref","refName","refValue","getCompositionsToRender","inferredDiscriminatorComposition","composition"],"sources":["../../../src/schema/helpers/get-compositions-to-render.ts"],"sourcesContent":["import { isDefined } from '@scalar/helpers/array/is-defined'\nimport { unescapeJsonPointerSegment } from '@scalar/helpers/json/unescape-json-pointer-segment'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { OpenApiDocument, SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\n\nimport { getRefName } from './get-ref-name'\nimport { type CompositionKeyword, compositions } from './schema-composition'\nimport { hasArrayItemComposition, shouldRenderArrayItemComposition } from './should-render-array-item-composition'\nimport { unwrapForRead } from './unwrap-for-read'\n\ntype CompositionToRender = {\n composition: CompositionKeyword\n value: SchemaObject\n}\n\ntype DocumentSchemaLookup = Pick<OpenApiDocument, 'components'>\n\nconst normalizeDiscriminatorMappingRef = (value: string) =>\n value.startsWith('#/') || value.includes('/') ? value : `#/components/schemas/${value}`\n\n/**\n * Builds a synthetic `oneOf` composition from a `discriminator.mapping` when the\n * schema declares a mapping but no explicit `oneOf`/`anyOf`. This is the shape\n * NSwag emits for polymorphic types, where the base type is a plain object with\n * a discriminator mapping pointing at the concrete variants.\n *\n * Returns `null` when there is nothing to infer (an explicit composition is\n * already present, no document to resolve refs against, or no resolvable refs).\n */\nexport const inferDiscriminatorMappingComposition = (\n value: SchemaObject,\n documentProp?: DocumentSchemaLookup,\n /** Inheritance can supply ordered variants, including schemas that share a mapped value. */\n variantRefs?: readonly string[],\n): SchemaObject | null => {\n if (value.oneOf || value.anyOf) {\n return null\n }\n\n // A schema without a mapping can never infer anything, so it is checked before the document is\n // touched at all: the document read below is by far the more expensive of the two.\n const mapping = value.discriminator?.mapping\n\n if (!mapping) {\n return null\n }\n\n // Reading `components.schemas` per row through the reactive and detect-changes layers is the\n // dominant cost of this helper, so the document is unwrapped once here. See `unwrapForRead`.\n const document = unwrapForRead(documentProp)\n\n if (!document?.components?.schemas) {\n return null\n }\n\n const refs = (variantRefs ?? Object.values(mapping))\n .filter((mappingValue): mappingValue is string => typeof mappingValue === 'string')\n .map((mappingValue) => {\n const ref = normalizeDiscriminatorMappingRef(mappingValue)\n const refName = getRefName(ref)\n const refValue = refName\n ? resolve.schema(document.components?.schemas?.[unescapeJsonPointerSegment(refName)])\n : undefined\n\n if (!refValue) {\n return undefined\n }\n\n return {\n $ref: ref,\n '$ref-value': refValue,\n }\n })\n .filter(isDefined)\n\n if (refs.length === 0) {\n return null\n }\n\n return {\n ...resolve.schema(value),\n oneOf: refs,\n }\n}\n\n/**\n * Computes which compositions should be rendered and with which values\n *\n * @param value - The schema object to check for compositions\n * @returns Array of compositions to render with their values\n */\nexport const getCompositionsToRender = (\n value: SchemaObject | undefined,\n document?: DocumentSchemaLookup,\n /**\n * The `oneOf` inferred from a bare `discriminator.mapping`, when the caller has\n * already computed it. `SchemaProperty` needs the same value to decide whether\n * to suppress the duplicate base object block, so it passes it here to avoid\n * inferring twice. Omit it and it is inferred from `value`.\n */\n inferredDiscriminatorComposition: SchemaObject | null = value\n ? inferDiscriminatorMappingComposition(value, document)\n : null,\n): CompositionToRender[] => {\n if (!value) {\n return []\n }\n\n return compositions\n .map((composition) => {\n if (composition === 'oneOf' && inferredDiscriminatorComposition) {\n return {\n composition,\n value: inferredDiscriminatorComposition,\n }\n }\n\n // Check for array item-level composition first (more specific case)\n if (shouldRenderArrayItemComposition(value, composition) && isArraySchema(value) && value.items) {\n return {\n composition,\n value: resolve.schema(value.items),\n }\n }\n\n // Check for property-level composition\n if (value[composition] && !hasArrayItemComposition(value, composition)) {\n return {\n composition,\n value: resolve.schema(value),\n }\n }\n\n return null\n })\n .filter(isDefined)\n}\n"],"mappings":";;;;;;;;;AAkBA,IAAMS,KAAoCC,MACxCA,EAAM,WAAW,IAAI,KAAKA,EAAM,SAAS,GAAG,IAAIA,IAAQ,wBAAwBA,KAWrEC,KACXD,GACAE,GAEAC,MACwB;CACxB,IAAIH,EAAM,SAASA,EAAM,OACvB,OAAO;CAKT,IAAMI,IAAUJ,EAAM,eAAe;CAErC,IAAI,CAACI,GACH,OAAO;CAKT,IAAMC,IAAWX,EAAcQ,CAAY;CAE3C,IAAI,CAACG,GAAU,YAAY,SACzB,OAAO;CAGT,IAAMC,KAAQH,KAAe,OAAO,OAAOC,CAAO,EAAA,CAC/C,QAAQG,MAAyC,OAAOA,KAAiB,QAAQ,CAAC,CAClF,KAAKA,MAAiB;EACrB,IAAMC,IAAMT,EAAiCQ,CAAY,GACnDE,IAAUnB,EAAWkB,CAAG,GACxBE,IAAWD,IACbd,EAAQ,OAAOU,EAAS,YAAY,UAAUP,EAA2BW,CAAO,EAAE,IAClF,KAAA;EAEJ,IAAKC,GAIL,OAAO;GACL,MAAMF;GACN,cAAcE;EAChB;CACF,CAAC,CAAC,CACD,OAAOb,CAAS;CAMnB,OAJIS,EAAK,WAAW,IACX,OAGF;EACL,GAAGX,EAAQ,OAAOK,CAAK;EACvB,OAAOM;CACT;AACF,GAQaK,KACXX,GACAK,GAOAO,IAAwDZ,IACpDC,EAAqCD,GAAOK,CAAQ,IACpD,SAECL,IAIET,EACJ,KAAKsB,MACAA,MAAgB,WAAWD,IACtB;CACLC;CACA,OAAOD;AACT,IAIEnB,EAAiCO,GAAOa,CAAW,KAAKjB,EAAcI,CAAK,KAAKA,EAAM,QACjF;CACLa;CACA,OAAOlB,EAAQ,OAAOK,EAAM,KAAK;AACnC,IAIEA,EAAMa,MAAgB,CAACrB,EAAwBQ,GAAOa,CAAW,IAC5D;CACLA;CACA,OAAOlB,EAAQ,OAAOK,CAAK;AAC7B,IAGK,IACR,CAAC,CACD,OAAOH,CAAS,IA9BV,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-discriminator-values.js","names":["getDiscriminatorValues","ref","mapping","target","value"],"sources":["../../../src/schema/helpers/get-discriminator-values.ts"],"sourcesContent":["import type { DiscriminatorObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\n/** Finds the payload values explicitly mapped to a referenced composition member. */\nexport const getDiscriminatorValues = (ref: string | undefined, mapping: DiscriminatorObject['mapping']): string[] => {\n if (!ref || !mapping) {\n return []\n }\n\n // A mapping can use either a URI reference or a local component name. Match\n // the whole reference so external schemas with the same name stay distinct.\n return Object.entries(mapping)\n .filter(([, target]) => target === ref || `#/components/schemas/${target}` === ref)\n .map(([value]) => value)\n}\n"],"mappings":";AAGA,IAAaA,KAA0B,GAAyB,MAC1D,CAACC,KAAO,CAACC,IACJ,CAAC,IAKH,OAAO,QAAQA,CAAO,CAAC,CAC3B,QAAQ,GAAGC,OAAYA,MAAWF,KAAO,wBAAwBE,QAAaF,CAAG,CAAC,CAClF,KAAK,CAACG,OAAWA,CAAK"}
1
+ {"version":3,"file":"get-discriminator-values.js","names":["getDiscriminatorValues","ref","mapping","target","value"],"sources":["../../../src/schema/helpers/get-discriminator-values.ts"],"sourcesContent":["import type { DiscriminatorObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\n/** Finds the payload values explicitly mapped to a referenced composition member. */\nexport const getDiscriminatorValues = (ref: string | undefined, mapping: DiscriminatorObject['mapping']): string[] => {\n if (!ref || !mapping) {\n return []\n }\n\n // A mapping can use either a URI reference or a local component name. Match\n // the whole reference so external schemas with the same name stay distinct.\n return Object.entries(mapping)\n .filter(([, target]) => target === ref || `#/components/schemas/${target}` === ref)\n .map(([value]) => value)\n}\n"],"mappings":";AAGA,IAAaA,KAA0BC,GAAyBC,MAC1D,CAACD,KAAO,CAACC,IACJ,CAAC,IAKH,OAAO,QAAQA,CAAO,CAAC,CAC3B,QAAQ,GAAGC,OAAYA,MAAWF,KAAO,wBAAwBE,QAAaF,CAAG,CAAC,CAClF,KAAK,CAACG,OAAWA,CAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-enum-values.js","names":["getEnumValues","value","isArraySchema","resolvedItems","resolve"],"sources":["../../../src/schema/helpers/get-enum-values.ts"],"sourcesContent":["import { 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'\n\n/**\n * Extract enum values from schema or array items\n *\n * @param value - The schema object to extract enum values from\n * @returns Array of enum values, or empty array if no enum found\n */\nexport const getEnumValues = (value: SchemaObject | undefined): unknown[] => {\n if (!value) {\n return []\n }\n\n // Check for enum directly on the schema\n if (value.enum) {\n return value.enum\n }\n\n // Check for enum in array items (resolving $ref if present)\n if (isArraySchema(value) && typeof value.items === 'object') {\n const resolvedItems = resolve.schema(value.items)\n if (resolvedItems && 'enum' in resolvedItems && resolvedItems.enum) {\n return resolvedItems.enum\n }\n }\n\n return []\n}\n"],"mappings":";;;AAUA,IAAaA,KAAiB,MAA+C;CAC3E,IAAI,CAACC,GACH,OAAO,CAAC;CAIV,IAAIA,EAAM,MACR,OAAOA,EAAM;CAIf,IAAIC,EAAcD,CAAK,KAAK,OAAOA,EAAM,SAAU,UAAU;EAC3D,IAAME,IAAgBC,EAAQ,OAAOH,EAAM,KAAK;EAChD,IAAIE,KAAiB,UAAUA,KAAiBA,EAAc,MAC5D,OAAOA,EAAc;CAEzB;CAEA,OAAO,CAAC;AACV"}
1
+ {"version":3,"file":"get-enum-values.js","names":["resolve","isArraySchema","getEnumValues","value","resolvedItems"],"sources":["../../../src/schema/helpers/get-enum-values.ts"],"sourcesContent":["import { 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'\n\n/**\n * Extract enum values from schema or array items\n *\n * @param value - The schema object to extract enum values from\n * @returns Array of enum values, or empty array if no enum found\n */\nexport const getEnumValues = (value: SchemaObject | undefined): unknown[] => {\n if (!value) {\n return []\n }\n\n // Check for enum directly on the schema\n if (value.enum) {\n return value.enum\n }\n\n // Check for enum in array items (resolving $ref if present)\n if (isArraySchema(value) && typeof value.items === 'object') {\n const resolvedItems = resolve.schema(value.items)\n if (resolvedItems && 'enum' in resolvedItems && resolvedItems.enum) {\n return resolvedItems.enum\n }\n }\n\n return []\n}\n"],"mappings":";;;AAUA,IAAaE,KAAiBC,MAA+C;CAC3E,IAAI,CAACA,GACH,OAAO,CAAC;CAIV,IAAIA,EAAM,MACR,OAAOA,EAAM;CAIf,IAAIF,EAAcE,CAAK,KAAK,OAAOA,EAAM,SAAU,UAAU;EAC3D,IAAMC,IAAgBJ,EAAQ,OAAOG,EAAM,KAAK;EAChD,IAAIC,KAAiB,UAAUA,KAAiBA,EAAc,MAC5D,OAAOA,EAAc;CAEzB;CAEA,OAAO,CAAC;AACV"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-property-description.js","names":["TYPE_DESCRIPTIONS","\"date\"","\"password\"","\"base64\"","\"byte\"","\"binary\"","getPropertyDescriptionKey","isSchema","value","type","typeDescriptions"],"sources":["../../../src/schema/helpers/get-property-description.ts"],"sourcesContent":["import type { ApiReferenceTranslationKey } from '@scalar/types/api-reference'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isSchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\n\ntype SchemaTranslationKey = Extract<ApiReferenceTranslationKey, `schema.${string}`>\n\n// Type descriptions for built-in types\nconst TYPE_DESCRIPTIONS: Record<string, Record<string, SchemaTranslationKey>> = {\n integer: {\n _default: 'schema.typeInteger',\n int32: 'schema.formatInt32',\n int64: 'schema.formatInt64',\n },\n string: {\n 'date': 'schema.formatDate',\n 'date-time': 'schema.formatDateTime',\n 'password': 'schema.formatPassword',\n 'base64': 'schema.formatBase64',\n 'byte': 'schema.formatBase64',\n 'binary': 'schema.formatBinary',\n },\n} as const\n\n/**\n * Get the translation key of the property description from type/format\n *\n * @param value - The schema object to generate description from\n * @returns Translation key or null if no description available\n */\nexport const getPropertyDescriptionKey = (value: SchemaObject | undefined): SchemaTranslationKey | null => {\n if (!isSchema(value)) {\n return null\n }\n /** Just grab the first type from the array if it's an array */\n const type = Array.isArray(value.type) ? value.type[0] : value.type\n if (!type) {\n return null\n }\n\n const typeDescriptions = TYPE_DESCRIPTIONS[type]\n if (!typeDescriptions) {\n return null\n }\n\n const format =\n ('format' in value && value.format) || ('contentEncoding' in value && value.contentEncoding) || '_default'\n return typeDescriptions[format] ?? null\n}\n"],"mappings":";;AAOA,IAAMA,IAA0E;CAC9E,SAAS;EACP,UAAU;EACV,OAAO;EACP,OAAO;CACT;CACA,QAAQ;EACNC,MAAQ;EACR,aAAa;EACbC,UAAY;EACZC,QAAU;EACVC,MAAQ;EACRC,QAAU;CACZ;AACF,GAQaC,KAA6B,MAAiE;CACzG,IAAI,CAACC,EAASC,CAAK,GACjB,OAAO;CAGT,IAAMC,IAAO,MAAM,QAAQD,EAAM,IAAI,IAAIA,EAAM,KAAK,KAAKA,EAAM;CAC/D,IAAI,CAACC,GACH,OAAO;CAGT,IAAMC,IAAmBV,EAAkBS;CAO3C,OANKC,IAMEA,EADJ,YAAYF,KAASA,EAAM,UAAY,qBAAqBA,KAASA,EAAM,mBAAoB,eAC/D,OAL1B;AAMX"}
1
+ {"version":3,"file":"get-property-description.js","names":["isSchema","TYPE_DESCRIPTIONS","\"date\"","\"password\"","\"base64\"","\"byte\"","\"binary\"","getPropertyDescriptionKey","value","type","typeDescriptions"],"sources":["../../../src/schema/helpers/get-property-description.ts"],"sourcesContent":["import type { ApiReferenceTranslationKey } from '@scalar/types/api-reference'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isSchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\n\ntype SchemaTranslationKey = Extract<ApiReferenceTranslationKey, `schema.${string}`>\n\n// Type descriptions for built-in types\nconst TYPE_DESCRIPTIONS: Record<string, Record<string, SchemaTranslationKey>> = {\n integer: {\n _default: 'schema.typeInteger',\n int32: 'schema.formatInt32',\n int64: 'schema.formatInt64',\n },\n string: {\n 'date': 'schema.formatDate',\n 'date-time': 'schema.formatDateTime',\n 'password': 'schema.formatPassword',\n 'base64': 'schema.formatBase64',\n 'byte': 'schema.formatBase64',\n 'binary': 'schema.formatBinary',\n },\n} as const\n\n/**\n * Get the translation key of the property description from type/format\n *\n * @param value - The schema object to generate description from\n * @returns Translation key or null if no description available\n */\nexport const getPropertyDescriptionKey = (value: SchemaObject | undefined): SchemaTranslationKey | null => {\n if (!isSchema(value)) {\n return null\n }\n /** Just grab the first type from the array if it's an array */\n const type = Array.isArray(value.type) ? value.type[0] : value.type\n if (!type) {\n return null\n }\n\n const typeDescriptions = TYPE_DESCRIPTIONS[type]\n if (!typeDescriptions) {\n return null\n }\n\n const format =\n ('format' in value && value.format) || ('contentEncoding' in value && value.contentEncoding) || '_default'\n return typeDescriptions[format] ?? null\n}\n"],"mappings":";;AAOA,IAAMC,IAA0E;CAC9E,SAAS;EACP,UAAU;EACV,OAAO;EACP,OAAO;CACT;CACA,QAAQ;EACNC,MAAQ;EACR,aAAa;EACbC,UAAY;EACZC,QAAU;EACVC,MAAQ;EACRC,QAAU;CACZ;AACF,GAQaC,KAA6BC,MAAiE;CACzG,IAAI,CAACR,EAASQ,CAAK,GACjB,OAAO;CAGT,IAAMC,IAAO,MAAM,QAAQD,EAAM,IAAI,IAAIA,EAAM,KAAK,KAAKA,EAAM;CAC/D,IAAI,CAACC,GACH,OAAO;CAGT,IAAMC,IAAmBT,EAAkBQ;CAO3C,OANKC,IAMEA,EADJ,YAAYF,KAASA,EAAM,UAAY,qBAAqBA,KAASA,EAAM,mBAAoB,eAC/D,OAL1B;AAMX"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-ref-name.js","names":["getRefName","ref","match","REGEX","COMPONENTS_SCHEMAS_REF","getSchemaRefName"],"sources":["../../../src/schema/helpers/get-ref-name.ts"],"sourcesContent":["import { REGEX } from '@scalar/helpers/regex/regex-helpers'\n\n/**\n * Gets the final reference segment for display, including external references.\n * Use getSchemaRefName when the name must link to a local model.\n *\n * @example SchemaName from #/components/schemas/SchemaName\n */\nexport const getRefName = (ref: string) => {\n if (!ref) {\n return null\n }\n\n const match = ref.match(REGEX.REF_NAME)\n if (match) {\n return match[1]\n }\n\n return null\n}\n\n/**\n * Matches a local reference that points at `#/components/schemas/<name>` and\n * captures the schema name. Intentionally strict: only refs that resolve to a\n * navigable model in `components.schemas` should be linkable.\n */\nconst COMPONENTS_SCHEMAS_REF = /^#\\/components\\/schemas\\/([^/]+)$/\n\n/**\n * Gets the models-section key for a `$ref`, but only when the ref actually\n * targets `#/components/schemas/`.\n *\n * The models index used for navigation is built exclusively from\n * `components.schemas`, so a ref into any other bucket (`parameters`,\n * `responses`, ...) or an external file (`./other.yaml#/Foo`) has no navigable\n * target. Returning `null` for those keeps the name visible as plain text while\n * avoiding a dead link.\n *\n * @example\n * getSchemaRefName('#/components/schemas/Planet') // 'Planet'\n * getSchemaRefName('#/components/parameters/Planet') // null\n * getSchemaRefName('./planets.yaml#/Planet') // null\n */\nexport const getSchemaRefName = (ref: string): string | null => {\n if (!ref) {\n return null\n }\n\n const match = ref.match(COMPONENTS_SCHEMAS_REF)\n if (match?.[1]) {\n return decodeURIComponent(match[1])\n }\n\n return null\n}\n"],"mappings":";;AAQA,IAAaA,KAAc,MAAgB;CACzC,IAAI,CAACC,GACH,OAAO;CAGT,IAAMC,IAAQD,EAAI,MAAME,EAAM,QAAQ;CAKtC,OAJID,IACKA,EAAM,KAGR;AACT,GAOME,IAAyB,qCAiBlBC,KAAoB,MAA+B;CAC9D,IAAI,CAACJ,GACH,OAAO;CAGT,IAAMC,IAAQD,EAAI,MAAMG,CAAsB;CAK9C,OAJIF,IAAQ,KACH,mBAAmBA,EAAM,EAAE,IAG7B;AACT"}
1
+ {"version":3,"file":"get-ref-name.js","names":["REGEX","getRefName","ref","match","COMPONENTS_SCHEMAS_REF","getSchemaRefName"],"sources":["../../../src/schema/helpers/get-ref-name.ts"],"sourcesContent":["import { REGEX } from '@scalar/helpers/regex/regex-helpers'\n\n/**\n * Gets the final reference segment for display, including external references.\n * Use getSchemaRefName when the name must link to a local model.\n *\n * @example SchemaName from #/components/schemas/SchemaName\n */\nexport const getRefName = (ref: string) => {\n if (!ref) {\n return null\n }\n\n const match = ref.match(REGEX.REF_NAME)\n if (match) {\n return match[1]\n }\n\n return null\n}\n\n/**\n * Matches a local reference that points at `#/components/schemas/<name>` and\n * captures the schema name. Intentionally strict: only refs that resolve to a\n * navigable model in `components.schemas` should be linkable.\n */\nconst COMPONENTS_SCHEMAS_REF = /^#\\/components\\/schemas\\/([^/]+)$/\n\n/**\n * Gets the models-section key for a `$ref`, but only when the ref actually\n * targets `#/components/schemas/`.\n *\n * The models index used for navigation is built exclusively from\n * `components.schemas`, so a ref into any other bucket (`parameters`,\n * `responses`, ...) or an external file (`./other.yaml#/Foo`) has no navigable\n * target. Returning `null` for those keeps the name visible as plain text while\n * avoiding a dead link.\n *\n * @example\n * getSchemaRefName('#/components/schemas/Planet') // 'Planet'\n * getSchemaRefName('#/components/parameters/Planet') // null\n * getSchemaRefName('./planets.yaml#/Planet') // null\n */\nexport const getSchemaRefName = (ref: string): string | null => {\n if (!ref) {\n return null\n }\n\n const match = ref.match(COMPONENTS_SCHEMAS_REF)\n if (match?.[1]) {\n return decodeURIComponent(match[1])\n }\n\n return null\n}\n"],"mappings":";;AAQA,IAAaC,KAAcC,MAAgB;CACzC,IAAI,CAACA,GACH,OAAO;CAGT,IAAMC,IAAQD,EAAI,MAAMF,EAAM,QAAQ;CAKtC,OAJIG,IACKA,EAAM,KAGR;AACT,GAOMC,IAAyB,qCAiBlBC,KAAoBH,MAA+B;CAC9D,IAAI,CAACA,GACH,OAAO;CAGT,IAAMC,IAAQD,EAAI,MAAME,CAAsB;CAK9C,OAJID,IAAQ,KACH,mBAAmBA,EAAM,EAAE,IAG7B;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-rendered-example.js","names":["renderedExample","getExampleSummary","seen","current","entry","isObjectLike","getResolvedRef","getRenderedExample","example","selected","preferData","getExampleValue","value","normalizeRenderedExamples","examples","name","allowRawObjects","key"],"sources":["../../../src/schema/helpers/get-rendered-example.ts"],"sourcesContent":["import { isObjectLike } from '@scalar/helpers/object/is-object'\nimport { getExampleValue } from '@scalar/workspace-store/helpers/get-example-value'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\n\n/** Only renderer-created wrappers carry this marker; JSON payload fields remain ordinary data. */\nconst renderedExample = Symbol('rendered-example')\n\n/** Display metadata stays separate from the selected payload, including payloads with a `value` field. */\nexport type RenderedExample = {\n [renderedExample]: true\n name?: string\n summary?: string\n value: unknown\n}\n\n/** Find the nearest summary annotation, including overrides on a chain of references. */\nexport const getExampleSummary = (entry: unknown): string | undefined => {\n const seen = new Set<unknown>()\n let current = entry\n while (isObjectLike(current) && !seen.has(current)) {\n if (typeof current.summary === 'string') {\n return current.summary\n }\n seen.add(current)\n current = getResolvedRef(current)\n }\n return undefined\n}\n\n/** Resolve a named Example Object once, preserving its label and the existing value preference. */\nexport const getRenderedExample = (entry: unknown, name?: string, preferData = false): RenderedExample | undefined => {\n const example = getResolvedRef(entry)\n if (!isObjectLike(example)) {\n return example === undefined ? undefined : { [renderedExample]: true, name, value: example }\n }\n const selected =\n preferData && example.dataValue !== undefined ? { value: example.dataValue } : getExampleValue(example)\n // Display the URL until the bundler has loaded an external example's payload.\n const value = selected ? selected.value : example.externalValue\n return value === undefined\n ? undefined\n : {\n [renderedExample]: true,\n name,\n summary: getExampleSummary(entry),\n value,\n }\n}\n\n/** Schema arrays contain raw payloads; legacy schema maps may also contain raw objects beside Example Objects. */\nexport const normalizeRenderedExamples = (\n examples: unknown,\n { allowRawObjects = false }: { allowRawObjects?: boolean } = {},\n): RenderedExample[] => {\n if (Array.isArray(examples)) {\n return examples\n .filter((value) => value !== undefined)\n .map((value: unknown) => {\n if (isObjectLike(value) && renderedExample in value && value[renderedExample] === true) {\n return value as RenderedExample\n }\n return { [renderedExample]: true, value }\n })\n }\n if (isObjectLike(examples)) {\n return Object.entries(examples).flatMap(([name, entry]) => {\n const example = getRenderedExample(entry, name)\n if (example) {\n return [example]\n }\n // Keep legacy schema maps readable without turning unresolved references or empty value fields into payloads.\n if (\n allowRawObjects &&\n isObjectLike(entry) &&\n !['$ref', 'value', 'externalValue', 'dataValue', 'serializedValue'].some((key) => key in entry)\n ) {\n return [{ [renderedExample]: true, name, value: entry }]\n }\n return []\n })\n }\n return []\n}\n"],"mappings":";;;;AAKA,IAAMA,IAAkB,OAAO,kBAAkB,GAWpCC,KAAqB,MAAuC;CACvE,IAAMC,oBAAO,IAAI,IAAa,GAC1BC,IAAUC;CACd,OAAOC,EAAaF,CAAO,KAAK,CAACD,EAAK,IAAIC,CAAO,IAAG;EAClD,IAAI,OAAOA,EAAQ,WAAY,UAC7B,OAAOA,EAAQ;EAGjB,AADAD,EAAK,IAAIC,CAAO,GAChB,IAAUG,EAAeH,CAAO;CAClC;AAEF,GAGaI,KAAsB,GAAgB,GAAe,IAAa,OAAuC;CACpH,IAAMC,IAAUF,EAAeF,CAAK;CACpC,IAAI,CAACC,EAAaG,CAAO,GACvB,OAAOA,MAAY,KAAA,IAAY,KAAA,IAAY;GAAGR,IAAkB;EAAM;EAAM,OAAOQ;CAAQ;CAE7F,IAAMC,IACJC,KAAcF,EAAQ,cAAc,KAAA,IAAY,EAAE,OAAOA,EAAQ,UAAU,IAAIG,EAAgBH,CAAO,GAElGI,IAAQH,IAAWA,EAAS,QAAQD,EAAQ;CAClD,OAAOI,MAAU,KAAA,IACb,KAAA,IACA;GACGZ,IAAkB;EACnB;EACA,SAASC,EAAkBG,CAAK;EAChC;CACF;AACN,GAGaS,KACX,GACA,EAAE,qBAAkB,OAAyC,CAAC,MAE1D,MAAM,QAAQC,CAAQ,IACjBA,EACJ,QAAQ,MAAUF,MAAU,KAAA,CAAS,CAAC,CACtC,KAAK,MACAP,EAAaO,CAAK,KAAKZ,KAAmBY,KAASA,EAAMZ,OAAqB,KACzEY,IAEF;EAAGZ,IAAkB;CAAM;AAAM,CACzC,IAEDK,EAAaS,CAAQ,IAChB,OAAO,QAAQA,CAAQ,CAAC,CAAC,SAAS,CAACC,GAAMX,OAAW;CACzD,IAAMI,IAAUD,EAAmBH,GAAOW,CAAI;CAY9C,OAXIP,IACK,CAACA,CAAO,IAIfQ,KACAX,EAAaD,CAAK,KAClB,CAAC;EAAC;EAAQ;EAAS;EAAiB;EAAa;CAAiB,CAAC,CAAC,MAAM,MAAQa,KAAOb,CAAK,IAEvF,CAAC;GAAGJ,IAAkB;EAAM;EAAM,OAAOI;CAAM,CAAC,IAElD,CAAC;AACV,CAAC,IAEI,CAAC"}
1
+ {"version":3,"file":"get-rendered-example.js","names":["isObjectLike","getExampleValue","getResolvedRef","renderedExample","getExampleSummary","entry","seen","current","getRenderedExample","name","preferData","example","selected","value","normalizeRenderedExamples","examples","allowRawObjects","key"],"sources":["../../../src/schema/helpers/get-rendered-example.ts"],"sourcesContent":["import { isObjectLike } from '@scalar/helpers/object/is-object'\nimport { getExampleValue } from '@scalar/workspace-store/helpers/get-example-value'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\n\n/** Only renderer-created wrappers carry this marker; JSON payload fields remain ordinary data. */\nconst renderedExample = Symbol('rendered-example')\n\n/** Display metadata stays separate from the selected payload, including payloads with a `value` field. */\nexport type RenderedExample = {\n [renderedExample]: true\n name?: string\n summary?: string\n value: unknown\n}\n\n/** Find the nearest summary annotation, including overrides on a chain of references. */\nexport const getExampleSummary = (entry: unknown): string | undefined => {\n const seen = new Set<unknown>()\n let current = entry\n while (isObjectLike(current) && !seen.has(current)) {\n if (typeof current.summary === 'string') {\n return current.summary\n }\n seen.add(current)\n current = getResolvedRef(current)\n }\n return undefined\n}\n\n/** Resolve a named Example Object once, preserving its label and the existing value preference. */\nexport const getRenderedExample = (entry: unknown, name?: string, preferData = false): RenderedExample | undefined => {\n const example = getResolvedRef(entry)\n if (!isObjectLike(example)) {\n return example === undefined ? undefined : { [renderedExample]: true, name, value: example }\n }\n const selected =\n preferData && example.dataValue !== undefined ? { value: example.dataValue } : getExampleValue(example)\n // Display the URL until the bundler has loaded an external example's payload.\n const value = selected ? selected.value : example.externalValue\n return value === undefined\n ? undefined\n : {\n [renderedExample]: true,\n name,\n summary: getExampleSummary(entry),\n value,\n }\n}\n\n/** Schema arrays contain raw payloads; legacy schema maps may also contain raw objects beside Example Objects. */\nexport const normalizeRenderedExamples = (\n examples: unknown,\n { allowRawObjects = false }: { allowRawObjects?: boolean } = {},\n): RenderedExample[] => {\n if (Array.isArray(examples)) {\n return examples\n .filter((value) => value !== undefined)\n .map((value: unknown) => {\n if (isObjectLike(value) && renderedExample in value && value[renderedExample] === true) {\n return value as RenderedExample\n }\n return { [renderedExample]: true, value }\n })\n }\n if (isObjectLike(examples)) {\n return Object.entries(examples).flatMap(([name, entry]) => {\n const example = getRenderedExample(entry, name)\n if (example) {\n return [example]\n }\n // Keep legacy schema maps readable without turning unresolved references or empty value fields into payloads.\n if (\n allowRawObjects &&\n isObjectLike(entry) &&\n !['$ref', 'value', 'externalValue', 'dataValue', 'serializedValue'].some((key) => key in entry)\n ) {\n return [{ [renderedExample]: true, name, value: entry }]\n }\n return []\n })\n }\n return []\n}\n"],"mappings":";;;;AAKA,IAAMG,IAAkB,OAAO,kBAAkB,GAWpCC,KAAqBC,MAAuC;CACvE,IAAMC,oBAAO,IAAI,IAAa,GAC1BC,IAAUF;CACd,OAAOL,EAAaO,CAAO,KAAK,CAACD,EAAK,IAAIC,CAAO,IAAG;EAClD,IAAI,OAAOA,EAAQ,WAAY,UAC7B,OAAOA,EAAQ;EAEjBD,EAAK,IAAIC,CAAO,GAChBA,IAAUL,EAAeK,CAAO;CAClC;AAEF,GAGaC,KAAsBH,GAAgBI,GAAeC,IAAa,OAAuC;CACpH,IAAMC,IAAUT,EAAeG,CAAK;CACpC,IAAI,CAACL,EAAaW,CAAO,GACvB,OAAOA,MAAY,KAAA,IAAY,KAAA,IAAY;GAAGR,IAAkB;EAAMM;EAAM,OAAOE;CAAQ;CAE7F,IAAMC,IACJF,KAAcC,EAAQ,cAAc,KAAA,IAAY,EAAE,OAAOA,EAAQ,UAAU,IAAIV,EAAgBU,CAAO,GAElGE,IAAQD,IAAWA,EAAS,QAAQD,EAAQ;CAClD,OAAOE,MAAU,KAAA,IACb,KAAA,IACA;GACGV,IAAkB;EACnBM;EACA,SAASL,EAAkBC,CAAK;EAChCQ;CACF;AACN,GAGaC,KACXC,GACA,EAAEC,qBAAkB,OAAyC,CAAC,MAE1D,MAAM,QAAQD,CAAQ,IACjBA,EACJ,QAAQF,MAAUA,MAAU,KAAA,CAAS,CAAC,CACtC,KAAKA,MACAb,EAAaa,CAAK,KAAKV,KAAmBU,KAASA,EAAMV,OAAqB,KACzEU,IAEF;EAAGV,IAAkB;CAAMU;AAAM,CACzC,IAEDb,EAAae,CAAQ,IAChB,OAAO,QAAQA,CAAQ,CAAC,CAAC,SAAS,CAACN,GAAMJ,OAAW;CACzD,IAAMM,IAAUH,EAAmBH,GAAOI,CAAI;CAY9C,OAXIE,IACK,CAACA,CAAO,IAIfK,KACAhB,EAAaK,CAAK,KAClB,CAAC;EAAC;EAAQ;EAAS;EAAiB;EAAa;CAAiB,CAAC,CAAC,MAAMY,MAAQA,KAAOZ,CAAK,IAEvF,CAAC;GAAGF,IAAkB;EAAMM;EAAM,OAAOJ;CAAM,CAAC,IAElD,CAAC;AACV,CAAC,IAEI,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-schema-type.js","names":["formatArrayType","itemType","processArrayType","value","baseType","getSchemaType","resolve","isUnionType","valueOrRef","arrayType","otherTypes","t","isArraySchema"],"sources":["../../../src/schema/helpers/get-schema-type.ts"],"sourcesContent":["import { resolve } from '@scalar/workspace-store/resolve'\nimport type { ReferenceType, SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\n\n/**\n * Formats an array type string with proper wrapping for union types.\n */\nconst formatArrayType = (itemType: string): string => {\n if (!itemType) {\n return 'array'\n }\n\n const wrappedItemType = itemType.includes(' | ') ? `(${itemType})` : itemType\n return `array ${wrappedItemType}[]`\n}\n\n/**\n * Handles array type processing for both single array types and union types containing array.\n */\nconst processArrayType = (\n value: Extract<SchemaObject, { type: 'array' | string[] }>,\n isUnionType: boolean = false,\n): string => {\n if (!value.items) {\n return 'array'\n }\n\n const itemType = getSchemaType(resolve.schema(value.items))\n const baseType = formatArrayType(itemType)\n\n if (isUnionType) {\n return baseType\n }\n\n // Handle nullable arrays for non-union types\n return (value as any).nullable ? `${baseType} | null` : baseType\n}\n\n/**\n * Computes the structural type for a schema.\n * This helper always returns type information, never schema titles or ref names.\n *\n * Priority order:\n * 1. const values\n * 2. Array types (with special handling for items)\n * 3. type with contentEncoding\n * 4. raw type\n */\nexport const getSchemaType = (valueOrRef: SchemaObject | ReferenceType<SchemaObject>): string => {\n // Early return for falsy values\n if (!valueOrRef) {\n return ''\n }\n\n const value = resolve.schema(valueOrRef)\n\n // Handle const values first (highest priority)\n if (value.const !== undefined) {\n return 'const'\n }\n\n // Handle union types (array of types)\n if ('type' in value && Array.isArray(value.type)) {\n // Special case: union types containing 'array'\n if (value.type.includes('array') && 'items' in value && value.items) {\n const arrayType = processArrayType(value, true)\n const otherTypes = value.type.filter((t) => t !== 'array')\n\n return otherTypes.length > 0 ? `${arrayType} | ${otherTypes.join(' | ')}` : arrayType\n }\n\n // Regular union types\n return value.type.join(' | ')\n }\n\n // Handle single array type\n if (isArraySchema(value)) {\n return processArrayType(value, false)\n }\n\n // Handle type with content encoding\n if ('type' in value && value.type && value.contentEncoding) {\n return `${value.type} • ${value.contentEncoding}`\n }\n\n // Fallback to raw type\n return 'type' in value ? (value.type as string) : ''\n}\n"],"mappings":";;;AAOA,IAAMA,KAAmB,MAClBC,IAKE,SADiBA,EAAS,SAAS,KAAK,IAAI,IAAIA,EAAS,KAAKA,EACrC,MAJvB,SAULC,KACJ,GACA,IAAuB,OACZ;CACX,IAAI,CAACC,EAAM,OACT,OAAO;CAIT,IAAMC,IAAWJ,EADAK,EAAcC,EAAQ,OAAOH,EAAM,KAAK,CACxB,CAAQ;CAOzC,OALII,IACKH,IAIDD,EAAc,WAAW,GAAGC,EAAS,WAAWA;AAC1D,GAYaC,KAAiB,MAAmE;CAE/F,IAAI,CAACG,GACH,OAAO;CAGT,IAAML,IAAQG,EAAQ,OAAOE,CAAU;CAGvC,IAAIL,EAAM,UAAU,KAAA,GAClB,OAAO;CAIT,IAAI,UAAUA,KAAS,MAAM,QAAQA,EAAM,IAAI,GAAG;EAEhD,IAAIA,EAAM,KAAK,SAAS,OAAO,KAAK,WAAWA,KAASA,EAAM,OAAO;GACnE,IAAMM,IAAYP,EAAiBC,GAAO,EAAI,GACxCO,IAAaP,EAAM,KAAK,QAAQ,MAAMQ,MAAM,OAAO;GAEzD,OAAOD,EAAW,SAAS,IAAI,GAAGD,EAAU,KAAKC,EAAW,KAAK,KAAK,MAAMD;EAC9E;EAGA,OAAON,EAAM,KAAK,KAAK,KAAK;CAC9B;CAaA,OAVIS,EAAcT,CAAK,IACdD,EAAiBC,GAAO,EAAK,IAIlC,UAAUA,KAASA,EAAM,QAAQA,EAAM,kBAClC,GAAGA,EAAM,KAAK,KAAKA,EAAM,oBAI3B,UAAUA,IAASA,EAAM,OAAkB;AACpD"}
1
+ {"version":3,"file":"get-schema-type.js","names":["resolve","isArraySchema","formatArrayType","itemType","processArrayType","value","isUnionType","baseType","getSchemaType","valueOrRef","arrayType","otherTypes","t"],"sources":["../../../src/schema/helpers/get-schema-type.ts"],"sourcesContent":["import { resolve } from '@scalar/workspace-store/resolve'\nimport type { ReferenceType, SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\n\n/**\n * Formats an array type string with proper wrapping for union types.\n */\nconst formatArrayType = (itemType: string): string => {\n if (!itemType) {\n return 'array'\n }\n\n const wrappedItemType = itemType.includes(' | ') ? `(${itemType})` : itemType\n return `array ${wrappedItemType}[]`\n}\n\n/**\n * Handles array type processing for both single array types and union types containing array.\n */\nconst processArrayType = (\n value: Extract<SchemaObject, { type: 'array' | string[] }>,\n isUnionType: boolean = false,\n): string => {\n if (!value.items) {\n return 'array'\n }\n\n const itemType = getSchemaType(resolve.schema(value.items))\n const baseType = formatArrayType(itemType)\n\n if (isUnionType) {\n return baseType\n }\n\n // Handle nullable arrays for non-union types\n return (value as any).nullable ? `${baseType} | null` : baseType\n}\n\n/**\n * Computes the structural type for a schema.\n * This helper always returns type information, never schema titles or ref names.\n *\n * Priority order:\n * 1. const values\n * 2. Array types (with special handling for items)\n * 3. type with contentEncoding\n * 4. raw type\n */\nexport const getSchemaType = (valueOrRef: SchemaObject | ReferenceType<SchemaObject>): string => {\n // Early return for falsy values\n if (!valueOrRef) {\n return ''\n }\n\n const value = resolve.schema(valueOrRef)\n\n // Handle const values first (highest priority)\n if (value.const !== undefined) {\n return 'const'\n }\n\n // Handle union types (array of types)\n if ('type' in value && Array.isArray(value.type)) {\n // Special case: union types containing 'array'\n if (value.type.includes('array') && 'items' in value && value.items) {\n const arrayType = processArrayType(value, true)\n const otherTypes = value.type.filter((t) => t !== 'array')\n\n return otherTypes.length > 0 ? `${arrayType} | ${otherTypes.join(' | ')}` : arrayType\n }\n\n // Regular union types\n return value.type.join(' | ')\n }\n\n // Handle single array type\n if (isArraySchema(value)) {\n return processArrayType(value, false)\n }\n\n // Handle type with content encoding\n if ('type' in value && value.type && value.contentEncoding) {\n return `${value.type} • ${value.contentEncoding}`\n }\n\n // Fallback to raw type\n return 'type' in value ? (value.type as string) : ''\n}\n"],"mappings":";;;AAOA,IAAME,KAAmBC,MAClBA,IAKE,SADiBA,EAAS,SAAS,KAAK,IAAI,IAAIA,EAAS,KAAKA,EACrC,MAJvB,SAULC,KACJC,GACAC,IAAuB,OACZ;CACX,IAAI,CAACD,EAAM,OACT,OAAO;CAIT,IAAME,IAAWL,EADAM,EAAcR,EAAQ,OAAOK,EAAM,KAAK,CACxB,CAAQ;CAOzC,OALIC,IACKC,IAIDF,EAAc,WAAW,GAAGE,EAAS,WAAWA;AAC1D,GAYaC,KAAiBC,MAAmE;CAE/F,IAAI,CAACA,GACH,OAAO;CAGT,IAAMJ,IAAQL,EAAQ,OAAOS,CAAU;CAGvC,IAAIJ,EAAM,UAAU,KAAA,GAClB,OAAO;CAIT,IAAI,UAAUA,KAAS,MAAM,QAAQA,EAAM,IAAI,GAAG;EAEhD,IAAIA,EAAM,KAAK,SAAS,OAAO,KAAK,WAAWA,KAASA,EAAM,OAAO;GACnE,IAAMK,IAAYN,EAAiBC,GAAO,EAAI,GACxCM,IAAaN,EAAM,KAAK,QAAQO,MAAMA,MAAM,OAAO;GAEzD,OAAOD,EAAW,SAAS,IAAI,GAAGD,EAAU,KAAKC,EAAW,KAAK,KAAK,MAAMD;EAC9E;EAGA,OAAOL,EAAM,KAAK,KAAK,KAAK;CAC9B;CAaA,OAVIJ,EAAcI,CAAK,IACdD,EAAiBC,GAAO,EAAK,IAIlC,UAAUA,KAASA,EAAM,QAAQA,EAAM,kBAClC,GAAGA,EAAM,KAAK,KAAKA,EAAM,oBAI3B,UAAUA,IAASA,EAAM,OAAkB;AACpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-type-signature-tokens.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/get-type-signature-tokens.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAI/G;;;;;GAKG;AACH,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,CAAA;IAClD,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AA+BD;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GACnC,YAAY,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG,SAAS,EAClE,UAAS;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO;AAC1C,mFAAmF;AACnF,iBAAe,KACd,OA2DF,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GACjC,YAAY,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG,SAAS,EAClE,UAAS;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,EAC1C,cAAS,KACR,kBAAkB,EA8DpB,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B,GACxC,YAAY,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG,SAAS,EAClE,UAAS;IAAE,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,KACpE,kBAAkB,EA2DpB,CAAA"}
1
+ {"version":3,"file":"get-type-signature-tokens.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/get-type-signature-tokens.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAK/G;;;;;GAKG;AACH,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,CAAA;IAClD,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAwBD;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GACnC,YAAY,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG,SAAS,EAClE,UAAS;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO;AAC1C,mFAAmF;AACnF,iBAAe,KACd,OA2DF,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GACjC,YAAY,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG,SAAS,EAClE,UAAS;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,EAC1C,cAAS,KACR,kBAAkB,EA8DpB,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B,GACxC,YAAY,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,GAAG,SAAS,EAClE,UAAS;IAAE,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,KACpE,kBAAkB,EA2DpB,CAAA"}
@@ -1,61 +1,62 @@
1
- import { getRefName as e } from "./get-ref-name.js";
2
- import { getResolvedRef as t } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
- import { resolve as n } from "@scalar/workspace-store/resolve";
1
+ import { formatStructuredValue as e } from "./format-structured-value.js";
2
+ import { getRefName as t } from "./get-ref-name.js";
3
+ import { getResolvedRef as n } from "@scalar/workspace-store/helpers/get-resolved-ref";
4
+ import { resolve as r } from "@scalar/workspace-store/resolve";
4
5
  // src/schema/helpers/get-type-signature-tokens.ts
5
- var r = 3, i = [
6
+ var i = 3, a = [
6
7
  "x-enumDescriptions",
7
8
  "x-enum-descriptions",
8
9
  "x-enum-varnames",
9
10
  "x-enumNames"
10
- ], a = (e) => typeof e == "object" && e ? JSON.stringify(e) : typeof e == "string" ? `"${e}"` : String(e), o = (e) => ({
11
+ ], o = (t) => typeof t == "string" ? `"${t}"` : e(t) ?? String(t), s = (e) => ({
11
12
  kind: "word",
12
13
  text: e
13
- }), s = (e) => ({
14
+ }), c = (e) => ({
14
15
  kind: "ident",
15
16
  text: e
16
- }), c = (e) => ({
17
+ }), l = (e) => ({
17
18
  kind: "literal",
18
19
  text: e
19
- }), l = () => ({
20
+ }), u = () => ({
20
21
  kind: "punctuation",
21
22
  text: "|"
22
- }), u = (e, t) => e.flatMap((e, n) => n === 0 ? e : [...t(), ...e]), d = (a, o = {}, s = !1) => {
23
- if (!a || typeof a != "object" || "$ref" in a && typeof a.$ref == "string" && !o.hideModelNames && e(a.$ref)) return !1;
24
- let c = o.hideModelNames ? n.schema(a) : t(a);
23
+ }), d = (e, t) => e.flatMap((e, n) => n === 0 ? e : [...t(), ...e]), f = (e, o = {}, s = !1) => {
24
+ if (!e || typeof e != "object" || "$ref" in e && typeof e.$ref == "string" && !o.hideModelNames && t(e.$ref)) return !1;
25
+ let c = o.hideModelNames ? r.schema(e) : n(e);
25
26
  if (!c || typeof c != "object" || c.const !== void 0) return !1;
26
- if (!i.some((e) => c[e]) && Array.isArray(c.enum) && c.enum.length > 0 && c.enum.length <= r) return !0;
27
+ if (!a.some((e) => c[e]) && Array.isArray(c.enum) && c.enum.length > 0 && c.enum.length <= i) return !0;
27
28
  if (!s && !("type" in c)) return !1;
28
- let l = "type" in c ? c.type : void 0, u = l === "array" || Array.isArray(l) && l.includes("array"), f = "items" in c ? c.items : void 0;
29
- return u && f && typeof f == "object" ? d(f, o, !0) : !1;
30
- }, f = (d, f = {}, p = 0) => {
31
- if (!d || typeof d != "object") return [];
32
- if ("$ref" in d && typeof d.$ref == "string") {
33
- let t = f.hideModelNames ? null : e(d.$ref);
34
- if (t) return [s(t)];
29
+ let l = "type" in c ? c.type : void 0, u = l === "array" || Array.isArray(l) && l.includes("array"), d = "items" in c ? c.items : void 0;
30
+ return u && d && typeof d == "object" ? f(d, o, !0) : !1;
31
+ }, p = (e, f = {}, p = 0) => {
32
+ if (!e || typeof e != "object") return [];
33
+ if ("$ref" in e && typeof e.$ref == "string") {
34
+ let n = f.hideModelNames ? null : t(e.$ref);
35
+ if (n) return [c(n)];
35
36
  }
36
- let m = f.hideModelNames ? n.schema(d) : t(d);
37
- return !m || typeof m != "object" ? [] : m.const === void 0 ? Array.isArray(m.enum) && m.enum.length > 0 && m.enum.length <= r && !i.some((e) => m[e]) ? u(m.enum.map((e) => [c(a(e))]), () => [o("or")]) : "type" in m && Array.isArray(m.type) ? u(m.type.map((e) => e === "array" ? h(m, f, p) : [s(String(e))]), () => [l()]) : "type" in m && m.type === "array" ? h(m, f, p) : "type" in m && m.type && m.contentEncoding ? [
38
- s(String(m.type)),
39
- o("•"),
40
- s(m.contentEncoding)
41
- ] : "type" in m && m.type ? [s(String(m.type))] : [] : [c(a(m.const))];
42
- }, p = (e, t = {}) => {
43
- let n = f(e, { hideModelNames: t.hideModelNames }), r = t.modelName;
37
+ let m = f.hideModelNames ? r.schema(e) : n(e);
38
+ return !m || typeof m != "object" ? [] : m.const === void 0 ? Array.isArray(m.enum) && m.enum.length > 0 && m.enum.length <= i && !a.some((e) => m[e]) ? d(m.enum.map((e) => [l(o(e))]), () => [s("or")]) : "type" in m && Array.isArray(m.type) ? d(m.type.map((e) => e === "array" ? g(m, f, p) : [c(String(e))]), () => [u()]) : "type" in m && m.type === "array" ? g(m, f, p) : "type" in m && m.type && m.contentEncoding ? [
39
+ c(String(m.type)),
40
+ s("•"),
41
+ c(m.contentEncoding)
42
+ ] : "type" in m && m.type ? [c(String(m.type))] : [] : [l(o(m.const))];
43
+ }, m = (e, t = {}) => {
44
+ let n = p(e, { hideModelNames: t.hideModelNames }), r = t.modelName;
44
45
  if (t.hideModelNames || !r) return n;
45
46
  let i = (e) => !!e && typeof e == "object" && "$ref" in e;
46
- if (n.length === 0 || n.length === 1 && n[0]?.text === "object" || i(e) && n.length === 1 && n[0]?.kind === "ident" && n[0]?.text !== r) return [s(r)];
47
- let a = e && typeof e == "object" && "items" in e ? e.items : void 0, o = n[0], c = n[1], l = a && typeof a == "object" && "type" in a && a.type === "object" && "title" in a && typeof a.title == "string";
48
- if ((i(a) || l) && n.length === 2 && o?.kind === "word" && c?.kind === "ident" && r.endsWith("[]")) {
47
+ if (n.length === 0 || n.length === 1 && n[0]?.text === "object" || i(e) && n.length === 1 && n[0]?.kind === "ident" && n[0]?.text !== r) return [c(r)];
48
+ let a = e && typeof e == "object" && "items" in e ? e.items : void 0, o = n[0], s = n[1], l = a && typeof a == "object" && "type" in a && a.type === "object" && "title" in a && typeof a.title == "string";
49
+ if ((i(a) || l) && n.length === 2 && o?.kind === "word" && s?.kind === "ident" && r.endsWith("[]")) {
49
50
  let e = r.slice(0, -2);
50
- if (e && e !== c.text) return [o, s(e)];
51
+ if (e && e !== s.text) return [o, c(e)];
51
52
  }
52
53
  return n;
53
- }, m = 8, h = (e, t, n) => {
54
+ }, h = 8, g = (e, t, n) => {
54
55
  let r = "items" in e ? e.items : void 0;
55
- if (!r || n >= m) return [s("array")];
56
- let i = f(r, t, n + 1);
57
- return i.length === 0 ? [s("array")] : [o("array of"), ...i];
56
+ if (!r || n >= h) return [c("array")];
57
+ let i = p(r, t, n + 1);
58
+ return i.length === 0 ? [c("array")] : [s("array of"), ...i];
58
59
  };
59
- export { p as getDisplayTypeSignatureTokens, f as getTypeSignatureTokens, d as typeSignatureInlinesEnum };
60
+ export { m as getDisplayTypeSignatureTokens, p as getTypeSignatureTokens, f as typeSignatureInlinesEnum };
60
61
 
61
62
  //# sourceMappingURL=get-type-signature-tokens.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-type-signature-tokens.js","names":["INLINE_ENUM_LIMIT","ENUM_ANNOTATION_KEYS","formatLiteral","value","word","ident","literal","pipe","joinTokens","lists","index","tokens","separator","typeSignatureInlinesEnum","valueOrRef","options","getRefName","resolve","getResolvedRef","key","isItems","type","isArrayType","items","getTypeSignatureTokens","refName","entry","arrayTokens","depth","getDisplayTypeSignatureTokens","computedTokens","modelName","isRef","arrayWord","itemToken","namedObjectItems","itemName","MAX_ARRAY_DEPTH","itemTokens"],"sources":["../../../src/schema/helpers/get-type-signature-tokens.ts"],"sourcesContent":["import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { ReferenceType, SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport { getRefName } from './get-ref-name'\n\n/**\n * One run of a type signature. `word` is English describing a shape (`array of`,\n * `or`) in the sans face; `ident` is something the reader would type (a model\n * name, a type keyword) in the code face; `literal` is an enum or const value\n * quoted as JSON; `punctuation` is the muted `|` between union members.\n */\ntype TypeSignatureToken = {\n kind: 'word' | 'ident' | 'literal' | 'punctuation'\n text: string\n}\n\n/** Enums up to this many values render inline in the type position. */\nconst INLINE_ENUM_LIMIT = 3\n\n/** Extensions that attach meaning to individual enum values. */\nconst ENUM_ANNOTATION_KEYS = ['x-enumDescriptions', 'x-enum-descriptions', 'x-enum-varnames', 'x-enumNames'] as const\n\n/** Quote an enum or const value the way JSON would. */\nconst formatLiteral = (value: unknown): string => {\n // Objects and arrays have no meaningful String() form (`[object Object]`), so\n // serialize them the way JSON would; primitives keep their existing rendering.\n if (value !== null && typeof value === 'object') {\n return JSON.stringify(value)\n }\n\n return typeof value === 'string' ? `\"${value}\"` : String(value)\n}\n\nconst word = (text: string): TypeSignatureToken => ({ kind: 'word', text })\nconst ident = (text: string): TypeSignatureToken => ({ kind: 'ident', text })\nconst literal = (text: string): TypeSignatureToken => ({\n kind: 'literal',\n text,\n})\nconst pipe = (): TypeSignatureToken => ({ kind: 'punctuation', text: '|' })\n\n/** Join token lists with a separator token, like Array.prototype.join. */\nconst joinTokens = (lists: TypeSignatureToken[][], separator: () => TypeSignatureToken[]): TypeSignatureToken[] =>\n lists.flatMap((tokens, index) => (index === 0 ? tokens : [...separator(), ...tokens]))\n\n/**\n * Whether the signature will actually render this schema's enum values inline.\n * SchemaProperty drops the separate value list for short enums on that\n * assumption, so it must be checked: a `$ref` renders as the model name before\n * reaching the enum branch, and a schema with no `type` renders no type detail,\n * so in both cases the values would otherwise be shown nowhere.\n */\nexport const typeSignatureInlinesEnum = (\n valueOrRef: SchemaObject | ReferenceType<SchemaObject> | undefined,\n options: { hideModelNames?: boolean } = {},\n /** Set when recursing into an array's items, which need no `type` of their own. */\n isItems = false,\n): boolean => {\n if (!valueOrRef || typeof valueOrRef !== 'object') {\n return false\n }\n\n // A named $ref returns the model name before ever reaching the enum branch.\n if (\n '$ref' in valueOrRef &&\n typeof valueOrRef.$ref === 'string' &&\n !options.hideModelNames &&\n getRefName(valueOrRef.$ref)\n ) {\n return false\n }\n\n // Display normalization can retain $ref alongside its resolved fields without\n // $ref-value. The structural view keeps those fields when names are hidden.\n const value = options.hideModelNames ? resolve.schema(valueOrRef) : getResolvedRef(valueOrRef)\n\n if (!value || typeof value !== 'object' || value.const !== undefined) {\n return false\n }\n\n // Bare literals cannot carry `x-enumDescriptions` or `x-enum-varnames`, so an\n // annotated enum keeps its value list (SchemaEnums' chip branch does the same).\n const annotated = ENUM_ANNOTATION_KEYS.some((key) => value[key])\n\n // getTypeSignatureTokens checks the schema's own enum right after const —\n // before any `type` handling — so a short, unannotated enum inlines whether or\n // not the schema has a `type`, and even when the type is `array` (e.g. a\n // schema carrying both `enum` and `type: array`). Mirror that order here, or\n // the value list renders a second copy of the same values.\n if (!annotated && Array.isArray(value.enum) && value.enum.length > 0 && value.enum.length <= INLINE_ENUM_LIMIT) {\n return true\n }\n\n // Past the enum branch, a schema with no `type` renders no signature to carry\n // the values. Items are exempt: the array signature's enum branch needs no\n // `type` of its own.\n if (!isItems && !('type' in value)) {\n return false\n }\n\n const type = 'type' in value ? value.type : undefined\n\n // `type: ['array', 'null']` takes the union branch, which still recurses into\n // items, so it inlines the item enum exactly like a plain array.\n const isArrayType = type === 'array' || (Array.isArray(type) && type.includes('array'))\n\n // An array with no own enum inlines its ITEMS' enum, resolved the same way\n // getEnumValues does, so the items must be tested here or the values render\n // twice.\n const items = 'items' in value ? value.items : undefined\n\n if (isArrayType && items && typeof items === 'object') {\n return typeSignatureInlinesEnum(items as SchemaObject, options, true)\n }\n\n return false\n}\n\n/**\n * Compute the type signature of a schema as token runs: `array Planet[]` becomes\n * `array of Planet`, where \"array of\" is English and `Planet` stays an\n * identifier. Short enums render inline (`\"standard\" or \"enterprise\"`) because\n * two values are a type, not a list worth its own rows. A `$ref` to a named\n * model renders as the model name itself.\n */\nexport const getTypeSignatureTokens = (\n valueOrRef: SchemaObject | ReferenceType<SchemaObject> | undefined,\n options: { hideModelNames?: boolean } = {},\n depth = 0,\n): TypeSignatureToken[] => {\n if (!valueOrRef || typeof valueOrRef !== 'object') {\n return []\n }\n\n // A $ref to a named model: the name is the type.\n if ('$ref' in valueOrRef && typeof valueOrRef.$ref === 'string') {\n const refName = options.hideModelNames ? null : getRefName(valueOrRef.$ref)\n\n if (refName) {\n return [ident(refName)]\n }\n }\n\n // Display normalization can retain $ref alongside its resolved fields without\n // $ref-value. The structural view keeps those fields when names are hidden.\n const value = options.hideModelNames ? resolve.schema(valueOrRef) : getResolvedRef(valueOrRef)\n\n if (!value || typeof value !== 'object') {\n return []\n }\n\n // const renders as its value, not as the word \"const\".\n if (value.const !== undefined) {\n return [literal(formatLiteral(value.const))]\n }\n\n // A short enum is the type, inline, unless its values carry descriptions or\n // names, which only the value list can show.\n if (\n Array.isArray(value.enum) &&\n value.enum.length > 0 &&\n value.enum.length <= INLINE_ENUM_LIMIT &&\n !ENUM_ANNOTATION_KEYS.some((key) => value[key])\n ) {\n return joinTokens(\n value.enum.map((entry) => [literal(formatLiteral(entry))]),\n () => [word('or')],\n )\n }\n\n // Union types: string | null with the pipe muted.\n if ('type' in value && Array.isArray(value.type)) {\n return joinTokens(\n value.type.map((entry) => (entry === 'array' ? arrayTokens(value, options, depth) : [ident(String(entry))])),\n () => [pipe()],\n )\n }\n\n if ('type' in value && value.type === 'array') {\n return arrayTokens(value, options, depth)\n }\n\n if ('type' in value && value.type && value.contentEncoding) {\n return [ident(String(value.type)), word('•'), ident(value.contentEncoding)]\n }\n\n if ('type' in value && value.type) {\n return [ident(String(value.type))]\n }\n\n return []\n}\n\n/**\n * The tokens a row shows: the raw signature, renamed to the caller's resolved\n * model name where the two would disagree.\n *\n * A `$ref` renders as the raw component key while the heading link and the\n * models section show the target's `title`; the caller's name keeps them in\n * agreement. Inline object titles can name array items too; inline primitive\n * tokens keep their real type (`integer`), rather than their `title`.\n */\nexport const getDisplayTypeSignatureTokens = (\n valueOrRef: SchemaObject | ReferenceType<SchemaObject> | undefined,\n options: { hideModelNames?: boolean; modelName?: string | null } = {},\n): TypeSignatureToken[] => {\n const computedTokens = getTypeSignatureTokens(valueOrRef, { hideModelNames: options.hideModelNames })\n const modelName = options.modelName\n\n if (options.hideModelNames || !modelName) {\n return computedTokens\n }\n\n const isRef = (value: unknown): boolean => !!value && typeof value === 'object' && '$ref' in value\n\n // Nothing to render, or a bare `object` that the name describes better.\n if (computedTokens.length === 0 || (computedTokens.length === 1 && computedTokens[0]?.text === 'object')) {\n return [ident(modelName)]\n }\n\n // A direct `$ref`: the single identifier IS the raw key.\n if (\n isRef(valueOrRef) &&\n computedTokens.length === 1 &&\n computedTokens[0]?.kind === 'ident' &&\n computedTokens[0]?.text !== modelName\n ) {\n return [ident(modelName)]\n }\n\n /*\n * An array of a named object keeps its \"array of\" word and renames only the item.\n * Only a caller name with a trailing `[]` describes the ITEM; the caller also\n * reports the array's OWN name here (a `$ref` to `FilterList`, an inline\n * `title` of `Planets`), and using that would claim each element is one.\n */\n const items = valueOrRef && typeof valueOrRef === 'object' && 'items' in valueOrRef ? valueOrRef.items : undefined\n\n const arrayWord = computedTokens[0]\n const itemToken = computedTokens[1]\n\n const namedObjectItems =\n items &&\n typeof items === 'object' &&\n 'type' in items &&\n items.type === 'object' &&\n 'title' in items &&\n typeof items.title === 'string'\n if (\n (isRef(items) || namedObjectItems) &&\n computedTokens.length === 2 &&\n arrayWord?.kind === 'word' &&\n itemToken?.kind === 'ident'\n ) {\n if (modelName.endsWith('[]')) {\n const itemName = modelName.slice(0, -2)\n\n if (itemName && itemName !== itemToken.text) {\n return [arrayWord, ident(itemName)]\n }\n }\n }\n\n return computedTokens\n}\n\n/** Guard against a pathological items chain; deeper than this reads as noise anyway. */\nconst MAX_ARRAY_DEPTH = 8\n\nconst arrayTokens = (\n value: SchemaObject,\n options: { hideModelNames?: boolean },\n depth: number,\n): TypeSignatureToken[] => {\n const items = 'items' in value ? value.items : undefined\n\n if (!items || depth >= MAX_ARRAY_DEPTH) {\n return [ident('array')]\n }\n\n const itemTokens = getTypeSignatureTokens(items as SchemaObject | ReferenceType<SchemaObject>, options, depth + 1)\n\n if (itemTokens.length === 0) {\n return [ident('array')]\n }\n\n return [word('array of'), ...itemTokens]\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"get-type-signature-tokens.js","names":["formatStructuredValue","getRefName","getResolvedRef","resolve","INLINE_ENUM_LIMIT","ENUM_ANNOTATION_KEYS","formatLiteral","value","word","text","ident","literal","pipe","joinTokens","lists","separator","tokens","index","typeSignatureInlinesEnum","valueOrRef","options","isItems","key","type","isArrayType","items","getTypeSignatureTokens","depth","refName","entry","arrayTokens","getDisplayTypeSignatureTokens","computedTokens","modelName","isRef","arrayWord","itemToken","namedObjectItems","itemName","MAX_ARRAY_DEPTH","itemTokens"],"sources":["../../../src/schema/helpers/get-type-signature-tokens.ts"],"sourcesContent":["import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { ReferenceType, SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport { formatStructuredValue } from './format-structured-value'\nimport { getRefName } from './get-ref-name'\n\n/**\n * One run of a type signature. `word` is English describing a shape (`array of`,\n * `or`) in the sans face; `ident` is something the reader would type (a model\n * name, a type keyword) in the code face; `literal` is an enum or const value\n * quoted as JSON; `punctuation` is the muted `|` between union members.\n */\ntype TypeSignatureToken = {\n kind: 'word' | 'ident' | 'literal' | 'punctuation'\n text: string\n}\n\n/** Enums up to this many values render inline in the type position. */\nconst INLINE_ENUM_LIMIT = 3\n\n/** Extensions that attach meaning to individual enum values. */\nconst ENUM_ANNOTATION_KEYS = ['x-enumDescriptions', 'x-enum-descriptions', 'x-enum-varnames', 'x-enumNames'] as const\n\n/** Quote an enum or const value the way JSON would. */\nconst formatLiteral = (value: unknown): string =>\n typeof value === 'string' ? `\"${value}\"` : (formatStructuredValue(value) ?? String(value))\n\nconst word = (text: string): TypeSignatureToken => ({ kind: 'word', text })\nconst ident = (text: string): TypeSignatureToken => ({ kind: 'ident', text })\nconst literal = (text: string): TypeSignatureToken => ({\n kind: 'literal',\n text,\n})\nconst pipe = (): TypeSignatureToken => ({ kind: 'punctuation', text: '|' })\n\n/** Join token lists with a separator token, like Array.prototype.join. */\nconst joinTokens = (lists: TypeSignatureToken[][], separator: () => TypeSignatureToken[]): TypeSignatureToken[] =>\n lists.flatMap((tokens, index) => (index === 0 ? tokens : [...separator(), ...tokens]))\n\n/**\n * Whether the signature will actually render this schema's enum values inline.\n * SchemaProperty drops the separate value list for short enums on that\n * assumption, so it must be checked: a `$ref` renders as the model name before\n * reaching the enum branch, and a schema with no `type` renders no type detail,\n * so in both cases the values would otherwise be shown nowhere.\n */\nexport const typeSignatureInlinesEnum = (\n valueOrRef: SchemaObject | ReferenceType<SchemaObject> | undefined,\n options: { hideModelNames?: boolean } = {},\n /** Set when recursing into an array's items, which need no `type` of their own. */\n isItems = false,\n): boolean => {\n if (!valueOrRef || typeof valueOrRef !== 'object') {\n return false\n }\n\n // A named $ref returns the model name before ever reaching the enum branch.\n if (\n '$ref' in valueOrRef &&\n typeof valueOrRef.$ref === 'string' &&\n !options.hideModelNames &&\n getRefName(valueOrRef.$ref)\n ) {\n return false\n }\n\n // Display normalization can retain $ref alongside its resolved fields without\n // $ref-value. The structural view keeps those fields when names are hidden.\n const value = options.hideModelNames ? resolve.schema(valueOrRef) : getResolvedRef(valueOrRef)\n\n if (!value || typeof value !== 'object' || value.const !== undefined) {\n return false\n }\n\n // Bare literals cannot carry `x-enumDescriptions` or `x-enum-varnames`, so an\n // annotated enum keeps its value list (SchemaEnums' chip branch does the same).\n const annotated = ENUM_ANNOTATION_KEYS.some((key) => value[key])\n\n // getTypeSignatureTokens checks the schema's own enum right after const —\n // before any `type` handling — so a short, unannotated enum inlines whether or\n // not the schema has a `type`, and even when the type is `array` (e.g. a\n // schema carrying both `enum` and `type: array`). Mirror that order here, or\n // the value list renders a second copy of the same values.\n if (!annotated && Array.isArray(value.enum) && value.enum.length > 0 && value.enum.length <= INLINE_ENUM_LIMIT) {\n return true\n }\n\n // Past the enum branch, a schema with no `type` renders no signature to carry\n // the values. Items are exempt: the array signature's enum branch needs no\n // `type` of its own.\n if (!isItems && !('type' in value)) {\n return false\n }\n\n const type = 'type' in value ? value.type : undefined\n\n // `type: ['array', 'null']` takes the union branch, which still recurses into\n // items, so it inlines the item enum exactly like a plain array.\n const isArrayType = type === 'array' || (Array.isArray(type) && type.includes('array'))\n\n // An array with no own enum inlines its ITEMS' enum, resolved the same way\n // getEnumValues does, so the items must be tested here or the values render\n // twice.\n const items = 'items' in value ? value.items : undefined\n\n if (isArrayType && items && typeof items === 'object') {\n return typeSignatureInlinesEnum(items as SchemaObject, options, true)\n }\n\n return false\n}\n\n/**\n * Compute the type signature of a schema as token runs: `array Planet[]` becomes\n * `array of Planet`, where \"array of\" is English and `Planet` stays an\n * identifier. Short enums render inline (`\"standard\" or \"enterprise\"`) because\n * two values are a type, not a list worth its own rows. A `$ref` to a named\n * model renders as the model name itself.\n */\nexport const getTypeSignatureTokens = (\n valueOrRef: SchemaObject | ReferenceType<SchemaObject> | undefined,\n options: { hideModelNames?: boolean } = {},\n depth = 0,\n): TypeSignatureToken[] => {\n if (!valueOrRef || typeof valueOrRef !== 'object') {\n return []\n }\n\n // A $ref to a named model: the name is the type.\n if ('$ref' in valueOrRef && typeof valueOrRef.$ref === 'string') {\n const refName = options.hideModelNames ? null : getRefName(valueOrRef.$ref)\n\n if (refName) {\n return [ident(refName)]\n }\n }\n\n // Display normalization can retain $ref alongside its resolved fields without\n // $ref-value. The structural view keeps those fields when names are hidden.\n const value = options.hideModelNames ? resolve.schema(valueOrRef) : getResolvedRef(valueOrRef)\n\n if (!value || typeof value !== 'object') {\n return []\n }\n\n // const renders as its value, not as the word \"const\".\n if (value.const !== undefined) {\n return [literal(formatLiteral(value.const))]\n }\n\n // A short enum is the type, inline, unless its values carry descriptions or\n // names, which only the value list can show.\n if (\n Array.isArray(value.enum) &&\n value.enum.length > 0 &&\n value.enum.length <= INLINE_ENUM_LIMIT &&\n !ENUM_ANNOTATION_KEYS.some((key) => value[key])\n ) {\n return joinTokens(\n value.enum.map((entry) => [literal(formatLiteral(entry))]),\n () => [word('or')],\n )\n }\n\n // Union types: string | null with the pipe muted.\n if ('type' in value && Array.isArray(value.type)) {\n return joinTokens(\n value.type.map((entry) => (entry === 'array' ? arrayTokens(value, options, depth) : [ident(String(entry))])),\n () => [pipe()],\n )\n }\n\n if ('type' in value && value.type === 'array') {\n return arrayTokens(value, options, depth)\n }\n\n if ('type' in value && value.type && value.contentEncoding) {\n return [ident(String(value.type)), word('•'), ident(value.contentEncoding)]\n }\n\n if ('type' in value && value.type) {\n return [ident(String(value.type))]\n }\n\n return []\n}\n\n/**\n * The tokens a row shows: the raw signature, renamed to the caller's resolved\n * model name where the two would disagree.\n *\n * A `$ref` renders as the raw component key while the heading link and the\n * models section show the target's `title`; the caller's name keeps them in\n * agreement. Inline object titles can name array items too; inline primitive\n * tokens keep their real type (`integer`), rather than their `title`.\n */\nexport const getDisplayTypeSignatureTokens = (\n valueOrRef: SchemaObject | ReferenceType<SchemaObject> | undefined,\n options: { hideModelNames?: boolean; modelName?: string | null } = {},\n): TypeSignatureToken[] => {\n const computedTokens = getTypeSignatureTokens(valueOrRef, { hideModelNames: options.hideModelNames })\n const modelName = options.modelName\n\n if (options.hideModelNames || !modelName) {\n return computedTokens\n }\n\n const isRef = (value: unknown): boolean => !!value && typeof value === 'object' && '$ref' in value\n\n // Nothing to render, or a bare `object` that the name describes better.\n if (computedTokens.length === 0 || (computedTokens.length === 1 && computedTokens[0]?.text === 'object')) {\n return [ident(modelName)]\n }\n\n // A direct `$ref`: the single identifier IS the raw key.\n if (\n isRef(valueOrRef) &&\n computedTokens.length === 1 &&\n computedTokens[0]?.kind === 'ident' &&\n computedTokens[0]?.text !== modelName\n ) {\n return [ident(modelName)]\n }\n\n /*\n * An array of a named object keeps its \"array of\" word and renames only the item.\n * Only a caller name with a trailing `[]` describes the ITEM; the caller also\n * reports the array's OWN name here (a `$ref` to `FilterList`, an inline\n * `title` of `Planets`), and using that would claim each element is one.\n */\n const items = valueOrRef && typeof valueOrRef === 'object' && 'items' in valueOrRef ? valueOrRef.items : undefined\n\n const arrayWord = computedTokens[0]\n const itemToken = computedTokens[1]\n\n const namedObjectItems =\n items &&\n typeof items === 'object' &&\n 'type' in items &&\n items.type === 'object' &&\n 'title' in items &&\n typeof items.title === 'string'\n if (\n (isRef(items) || namedObjectItems) &&\n computedTokens.length === 2 &&\n arrayWord?.kind === 'word' &&\n itemToken?.kind === 'ident'\n ) {\n if (modelName.endsWith('[]')) {\n const itemName = modelName.slice(0, -2)\n\n if (itemName && itemName !== itemToken.text) {\n return [arrayWord, ident(itemName)]\n }\n }\n }\n\n return computedTokens\n}\n\n/** Guard against a pathological items chain; deeper than this reads as noise anyway. */\nconst MAX_ARRAY_DEPTH = 8\n\nconst arrayTokens = (\n value: SchemaObject,\n options: { hideModelNames?: boolean },\n depth: number,\n): TypeSignatureToken[] => {\n const items = 'items' in value ? value.items : undefined\n\n if (!items || depth >= MAX_ARRAY_DEPTH) {\n return [ident('array')]\n }\n\n const itemTokens = getTypeSignatureTokens(items as SchemaObject | ReferenceType<SchemaObject>, options, depth + 1)\n\n if (itemTokens.length === 0) {\n return [ident('array')]\n }\n\n return [word('array of'), ...itemTokens]\n}\n"],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"has-complex-array-items.js","names":["COMPOSITION_KEYWORDS","isObjectType","schema","hasComplexFeatures","keyword","hasComplexNestedArrayItems","isArraySchema","items","nestedItems","getResolvedRef","hasComplexArrayItems","value"],"sources":["../../../src/schema/helpers/has-complex-array-items.ts"],"sourcesContent":["import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\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'\n\n/** Composition keywords that indicate complex schema structure */\nconst COMPOSITION_KEYWORDS = ['allOf', 'oneOf', 'anyOf'] as const\n\n/**\n * Checks if a schema has object type (either explicit type: 'object' or has properties)\n */\nconst isObjectType = (schema: SchemaObject): boolean => {\n // Check for explicit object type\n if ('type' in schema && schema.type) {\n if (Array.isArray(schema.type)) {\n return schema.type.includes('object')\n }\n return schema.type === 'object'\n }\n\n // Check for properties (implicit object type)\n return 'properties' in schema\n}\n\n/**\n * Checks if a schema has complex features (refs, compositions, discriminators)\n */\nconst hasComplexFeatures = (schema: SchemaObject): boolean =>\n '$ref' in schema || 'discriminator' in schema || COMPOSITION_KEYWORDS.some((keyword) => keyword in schema)\n\n/**\n * Checks if nested array items are complex\n */\nconst hasComplexNestedArrayItems = (items: SchemaObject): boolean => {\n if (!isArraySchema(items)) {\n return false\n }\n\n if (typeof items.items === 'boolean') {\n return true\n }\n\n if (typeof items.items !== 'object') {\n return false\n }\n\n // Check for $ref in original nested items before resolving\n if ('$ref' in items.items) {\n return true\n }\n\n const nestedItems = getResolvedRef(items.items)\n if (!nestedItems) {\n return false\n }\n\n // Check if nested items are complex (objects, refs, compositions, or further nested arrays)\n return isObjectType(nestedItems) || hasComplexFeatures(nestedItems) || isArraySchema(nestedItems)\n}\n\n/**\n * Checks if array items have complex structure\n * like: objects, references, discriminators, compositions, or nested arrays with complex items\n *\n * @param value - The schema object to check\n * @returns true if the array has complex items, false otherwise\n */\nexport const hasComplexArrayItems = (value: SchemaObject | undefined): boolean => {\n // Early return for invalid inputs\n if (!value || !isArraySchema(value)) {\n return false\n }\n\n // Boolean item constraints need a child row to explain their validation meaning.\n if (typeof value.items === 'boolean') {\n return true\n }\n\n if (typeof value.items !== 'object') {\n return false\n }\n\n // Check for $ref in original items before resolving (in case ref can't be resolved)\n if ('$ref' in value.items) {\n return true\n }\n\n const items = getResolvedRef(value.items)\n if (!items) {\n return false\n }\n\n // Check for complex features (refs, compositions, discriminators)\n if (hasComplexFeatures(items)) {\n return true\n }\n\n // Check if items are objects\n if (isObjectType(items)) {\n return true\n }\n\n // Check if items are nested arrays with complex items\n return hasComplexNestedArrayItems(items)\n}\n"],"mappings":";;;AAKA,IAAMA,IAAuB;CAAC;CAAS;CAAS;AAAO,GAKjDC,KAAgB,MAEhB,UAAUC,KAAUA,EAAO,OACzB,MAAM,QAAQA,EAAO,IAAI,IACpBA,EAAO,KAAK,SAAS,QAAQ,IAE/BA,EAAO,SAAS,WAIlB,gBAAgBA,GAMnBC,KAAsB,MAC1B,UAAUD,KAAU,mBAAmBA,KAAUF,EAAqB,MAAM,MAAYI,KAAWF,CAAM,GAKrGG,KAA8B,MAAiC;CACnE,IAAI,CAACC,EAAcC,CAAK,GACtB,OAAO;CAGT,IAAI,OAAOA,EAAM,SAAU,WACzB,OAAO;CAGT,IAAI,OAAOA,EAAM,SAAU,UACzB,OAAO;CAIT,IAAI,UAAUA,EAAM,OAClB,OAAO;CAGT,IAAMC,IAAcC,EAAeF,EAAM,KAAK;CAM9C,OALKC,IAKEP,EAAaO,CAAW,KAAKL,EAAmBK,CAAW,KAAKF,EAAcE,CAAW,IAJvF;AAKX,GASaE,KAAwB,MAA6C;CAEhF,IAAI,CAACC,KAAS,CAACL,EAAcK,CAAK,GAChC,OAAO;CAIT,IAAI,OAAOA,EAAM,SAAU,WACzB,OAAO;CAGT,IAAI,OAAOA,EAAM,SAAU,UACzB,OAAO;CAIT,IAAI,UAAUA,EAAM,OAClB,OAAO;CAGT,IAAMJ,IAAQE,EAAeE,EAAM,KAAK;CAgBxC,OAfKJ,IAKDJ,EAAmBI,CAAK,KAKxBN,EAAaM,CAAK,IACb,KAIFF,EAA2BE,CAAK,IAd9B;AAeX"}
1
+ {"version":3,"file":"has-complex-array-items.js","names":["getResolvedRef","isArraySchema","COMPOSITION_KEYWORDS","isObjectType","schema","hasComplexFeatures","keyword","hasComplexNestedArrayItems","items","nestedItems","hasComplexArrayItems","value"],"sources":["../../../src/schema/helpers/has-complex-array-items.ts"],"sourcesContent":["import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\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'\n\n/** Composition keywords that indicate complex schema structure */\nconst COMPOSITION_KEYWORDS = ['allOf', 'oneOf', 'anyOf'] as const\n\n/**\n * Checks if a schema has object type (either explicit type: 'object' or has properties)\n */\nconst isObjectType = (schema: SchemaObject): boolean => {\n // Check for explicit object type\n if ('type' in schema && schema.type) {\n if (Array.isArray(schema.type)) {\n return schema.type.includes('object')\n }\n return schema.type === 'object'\n }\n\n // Check for properties (implicit object type)\n return 'properties' in schema\n}\n\n/**\n * Checks if a schema has complex features (refs, compositions, discriminators)\n */\nconst hasComplexFeatures = (schema: SchemaObject): boolean =>\n '$ref' in schema || 'discriminator' in schema || COMPOSITION_KEYWORDS.some((keyword) => keyword in schema)\n\n/**\n * Checks if nested array items are complex\n */\nconst hasComplexNestedArrayItems = (items: SchemaObject): boolean => {\n if (!isArraySchema(items)) {\n return false\n }\n\n if (typeof items.items === 'boolean') {\n return true\n }\n\n if (typeof items.items !== 'object') {\n return false\n }\n\n // Check for $ref in original nested items before resolving\n if ('$ref' in items.items) {\n return true\n }\n\n const nestedItems = getResolvedRef(items.items)\n if (!nestedItems) {\n return false\n }\n\n // Check if nested items are complex (objects, refs, compositions, or further nested arrays)\n return isObjectType(nestedItems) || hasComplexFeatures(nestedItems) || isArraySchema(nestedItems)\n}\n\n/**\n * Checks if array items have complex structure\n * like: objects, references, discriminators, compositions, or nested arrays with complex items\n *\n * @param value - The schema object to check\n * @returns true if the array has complex items, false otherwise\n */\nexport const hasComplexArrayItems = (value: SchemaObject | undefined): boolean => {\n // Early return for invalid inputs\n if (!value || !isArraySchema(value)) {\n return false\n }\n\n // Boolean item constraints need a child row to explain their validation meaning.\n if (typeof value.items === 'boolean') {\n return true\n }\n\n if (typeof value.items !== 'object') {\n return false\n }\n\n // Check for $ref in original items before resolving (in case ref can't be resolved)\n if ('$ref' in value.items) {\n return true\n }\n\n const items = getResolvedRef(value.items)\n if (!items) {\n return false\n }\n\n // Check for complex features (refs, compositions, discriminators)\n if (hasComplexFeatures(items)) {\n return true\n }\n\n // Check if items are objects\n if (isObjectType(items)) {\n return true\n }\n\n // Check if items are nested arrays with complex items\n return hasComplexNestedArrayItems(items)\n}\n"],"mappings":";;;AAKA,IAAME,IAAuB;CAAC;CAAS;CAAS;AAAO,GAKjDC,KAAgBC,MAEhB,UAAUA,KAAUA,EAAO,OACzB,MAAM,QAAQA,EAAO,IAAI,IACpBA,EAAO,KAAK,SAAS,QAAQ,IAE/BA,EAAO,SAAS,WAIlB,gBAAgBA,GAMnBC,KAAsBD,MAC1B,UAAUA,KAAU,mBAAmBA,KAAUF,EAAqB,MAAMI,MAAYA,KAAWF,CAAM,GAKrGG,KAA8BC,MAAiC;CACnE,IAAI,CAACP,EAAcO,CAAK,GACtB,OAAO;CAGT,IAAI,OAAOA,EAAM,SAAU,WACzB,OAAO;CAGT,IAAI,OAAOA,EAAM,SAAU,UACzB,OAAO;CAIT,IAAI,UAAUA,EAAM,OAClB,OAAO;CAGT,IAAMC,IAAcT,EAAeQ,EAAM,KAAK;CAM9C,OALKC,IAKEN,EAAaM,CAAW,KAAKJ,EAAmBI,CAAW,KAAKR,EAAcQ,CAAW,IAJvF;AAKX,GASaC,KAAwBC,MAA6C;CAEhF,IAAI,CAACA,KAAS,CAACV,EAAcU,CAAK,GAChC,OAAO;CAIT,IAAI,OAAOA,EAAM,SAAU,WACzB,OAAO;CAGT,IAAI,OAAOA,EAAM,SAAU,UACzB,OAAO;CAIT,IAAI,UAAUA,EAAM,OAClB,OAAO;CAGT,IAAMH,IAAQR,EAAeW,EAAM,KAAK;CAgBxC,OAfKH,IAKDH,EAAmBG,CAAK,KAKxBL,EAAaK,CAAK,IACb,KAIFD,EAA2BC,CAAK,IAd9B;AAeX"}
@@ -1 +1 @@
1
- {"version":3,"file":"is-empty-schema-object.js","names":["isEmptySchemaObject","isTypeObject","schema","hasNoProperties","hasNoAdditionalProperties","hasNoPatternProperties"],"sources":["../../../src/schema/helpers/is-empty-schema-object.ts"],"sourcesContent":["import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport { isTypeObject } from './is-type-object'\n\n/**\n * Determines if the given schema is an empty object schema.\n * An empty object schema is defined as a schema with type 'object'\n * and no defined properties, no additionalProperties (or set to false), and no patternProperties.\n */\nexport const isEmptySchemaObject = (schema: SchemaObject | undefined): boolean => {\n if (!isTypeObject(schema)) {\n return false\n }\n\n const hasNoProperties = Object.keys(schema.properties ?? {}).length === 0\n const hasNoAdditionalProperties = schema.additionalProperties === undefined || schema.additionalProperties === false\n const hasNoPatternProperties = Object.keys(schema.patternProperties ?? {}).length === 0\n\n return hasNoProperties && hasNoAdditionalProperties && hasNoPatternProperties\n}\n"],"mappings":";;AASA,IAAaA,KAAuB,MAA8C;CAChF,IAAI,CAACC,EAAaC,CAAM,GACtB,OAAO;CAGT,IAAMC,IAAkB,OAAO,KAAKD,EAAO,cAAc,CAAC,CAAC,CAAC,CAAC,WAAW,GAClEE,IAA4BF,EAAO,yBAAyB,KAAA,KAAaA,EAAO,yBAAyB,IACzGG,IAAyB,OAAO,KAAKH,EAAO,qBAAqB,CAAC,CAAC,CAAC,CAAC,WAAW;CAEtF,OAAOC,KAAmBC,KAA6BC;AACzD"}
1
+ {"version":3,"file":"is-empty-schema-object.js","names":["isTypeObject","isEmptySchemaObject","schema","hasNoProperties","hasNoAdditionalProperties","hasNoPatternProperties"],"sources":["../../../src/schema/helpers/is-empty-schema-object.ts"],"sourcesContent":["import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport { isTypeObject } from './is-type-object'\n\n/**\n * Determines if the given schema is an empty object schema.\n * An empty object schema is defined as a schema with type 'object'\n * and no defined properties, no additionalProperties (or set to false), and no patternProperties.\n */\nexport const isEmptySchemaObject = (schema: SchemaObject | undefined): boolean => {\n if (!isTypeObject(schema)) {\n return false\n }\n\n const hasNoProperties = Object.keys(schema.properties ?? {}).length === 0\n const hasNoAdditionalProperties = schema.additionalProperties === undefined || schema.additionalProperties === false\n const hasNoPatternProperties = Object.keys(schema.patternProperties ?? {}).length === 0\n\n return hasNoProperties && hasNoAdditionalProperties && hasNoPatternProperties\n}\n"],"mappings":";;AASA,IAAaC,KAAuBC,MAA8C;CAChF,IAAI,CAACF,EAAaE,CAAM,GACtB,OAAO;CAGT,IAAMC,IAAkB,OAAO,KAAKD,EAAO,cAAc,CAAC,CAAC,CAAC,CAAC,WAAW,GAClEE,IAA4BF,EAAO,yBAAyB,KAAA,KAAaA,EAAO,yBAAyB,IACzGG,IAAyB,OAAO,KAAKH,EAAO,qBAAqB,CAAC,CAAC,CAAC,CAAC,WAAW;CAEtF,OAAOC,KAAmBC,KAA6BC;AACzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"is-model-linkable.js","names":["isModelLinkable","schemaKey","hideModels","schema","unwrapForRead","document","isHidden","getResolvedRef","mergeSiblingReferences"],"sources":["../../../src/schema/helpers/is-model-linkable.ts"],"sourcesContent":["import { getResolvedRef, mergeSiblingReferences } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { isHidden } from '@scalar/workspace-store/helpers/is-hidden'\n\nimport type { SchemaOptions } from '../types'\nimport { unwrapForRead } from './unwrap-for-read'\n\n/** The slice of schema options needed to decide whether a model name renders as a link. */\nexport type ModelLinkOptions = Pick<SchemaOptions, 'hideModels' | 'document'>\n\n/**\n * A model name normally links to its entry in the models section. It should render as plain\n * text when there is nothing to scroll to:\n *\n * - the whole models section is hidden via `hideModels`, or\n * - the referenced schema itself is hidden via `x-internal` / `x-scalar-ignore`.\n *\n * The hidden check mirrors how the sidebar decides which schemas to drop (see `traverseSchemas`),\n * so the link only shows when the model actually exists in the models section.\n */\nexport const isModelLinkable = (\n schemaKey: string | null | undefined,\n { hideModels, document }: ModelLinkOptions,\n): boolean => {\n if (!schemaKey || hideModels) {\n return false\n }\n\n // Walking down to a single component schema costs three proxied reads per row, so the\n // document is taken off the reactive and detect-changes layers first. See `unwrapForRead`.\n const schema = unwrapForRead(document)?.components?.schemas?.[schemaKey]\n\n return !isHidden(getResolvedRef(schema, mergeSiblingReferences))\n}\n"],"mappings":";;;;AAmBA,IAAaA,KACX,GACA,EAAE,eAAY,kBACF;CACZ,IAAI,CAACC,KAAaC,GAChB,OAAO;CAKT,IAAMC,IAASC,EAAcC,CAAQ,CAAC,EAAE,YAAY,UAAUJ;CAE9D,OAAO,CAACK,EAASC,EAAeJ,GAAQK,CAAsB,CAAC;AACjE"}
1
+ {"version":3,"file":"is-model-linkable.js","names":["unwrapForRead","getResolvedRef","mergeSiblingReferences","isHidden","isModelLinkable","schemaKey","hideModels","document","schema"],"sources":["../../../src/schema/helpers/is-model-linkable.ts"],"sourcesContent":["import { getResolvedRef, mergeSiblingReferences } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { isHidden } from '@scalar/workspace-store/helpers/is-hidden'\n\nimport type { SchemaOptions } from '../types'\nimport { unwrapForRead } from './unwrap-for-read'\n\n/** The slice of schema options needed to decide whether a model name renders as a link. */\nexport type ModelLinkOptions = Pick<SchemaOptions, 'hideModels' | 'document'>\n\n/**\n * A model name normally links to its entry in the models section. It should render as plain\n * text when there is nothing to scroll to:\n *\n * - the whole models section is hidden via `hideModels`, or\n * - the referenced schema itself is hidden via `x-internal` / `x-scalar-ignore`.\n *\n * The hidden check mirrors how the sidebar decides which schemas to drop (see `traverseSchemas`),\n * so the link only shows when the model actually exists in the models section.\n */\nexport const isModelLinkable = (\n schemaKey: string | null | undefined,\n { hideModels, document }: ModelLinkOptions,\n): boolean => {\n if (!schemaKey || hideModels) {\n return false\n }\n\n // Walking down to a single component schema costs three proxied reads per row, so the\n // document is taken off the reactive and detect-changes layers first. See `unwrapForRead`.\n const schema = unwrapForRead(document)?.components?.schemas?.[schemaKey]\n\n return !isHidden(getResolvedRef(schema, mergeSiblingReferences))\n}\n"],"mappings":";;;;AAmBA,IAAaI,KACXC,GACA,EAAEC,eAAYC,kBACF;CACZ,IAAI,CAACF,KAAaC,GAChB,OAAO;CAKT,IAAME,IAASR,EAAcO,CAAQ,CAAC,EAAE,YAAY,UAAUF;CAE9D,OAAO,CAACF,EAASF,EAAeO,GAAQN,CAAsB,CAAC;AACjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"is-on-schema-target-path.js","names":["isOnSchemaTargetPath","path","target"],"sources":["../../../src/schema/helpers/is-on-schema-target-path.ts"],"sourcesContent":["/** Match complete breadcrumb segments so `user` does not match `username`. */\nexport const isOnSchemaTargetPath = (path: string | undefined, target: string): boolean =>\n Boolean(path && target && (target === path || target.startsWith(`${path}.`)))\n"],"mappings":";AACA,IAAaA,KAAwB,GAA0B,MAC7D,GAAQC,KAAQC,MAAWA,MAAWD,KAAQC,EAAO,WAAW,GAAGD,EAAK,EAAE"}
1
+ {"version":3,"file":"is-on-schema-target-path.js","names":["isOnSchemaTargetPath","path","target"],"sources":["../../../src/schema/helpers/is-on-schema-target-path.ts"],"sourcesContent":["/** Match complete breadcrumb segments so `user` does not match `username`. */\nexport const isOnSchemaTargetPath = (path: string | undefined, target: string): boolean =>\n Boolean(path && target && (target === path || target.startsWith(`${path}.`)))\n"],"mappings":";AACA,IAAaA,KAAwBC,GAA0BC,MAC7D,GAAQD,KAAQC,MAAWA,MAAWD,KAAQC,EAAO,WAAW,GAAGD,EAAK,EAAE"}