@redocly/openapi-docs 3.24.0-next.9 → 3.24.1

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 (314) hide show
  1. package/dist/{redocly-openapi-docs.min.AiChatProvider-DcsGB2gP.js → redocly-openapi-docs.min.AiChatProvider-j-VDfFJ9.js} +3 -3
  2. package/dist/{redocly-openapi-docs.min.AiChatSqliteDBStorage-wCZA4usG.js → redocly-openapi-docs.min.AiChatSqliteDBStorage-BBRBmffc.js} +1 -1
  3. package/dist/{redocly-openapi-docs.min.AiPanel-jo7fqtSt.js → redocly-openapi-docs.min.AiPanel-DTzHqAiI.js} +116 -116
  4. package/dist/redocly-openapi-docs.min.FileWatcher-DDoyaS7A.js +1 -0
  5. package/dist/redocly-openapi-docs.min.Observable-D6wKbFwB.js +1 -0
  6. package/dist/redocly-openapi-docs.min.SemanticSearchService-DNFOPBZK.js +1 -0
  7. package/dist/{redocly-openapi-docs.min.SqliteDBStorage-B_f6WR8o.js → redocly-openapi-docs.min.SqliteDBStorage-Dy40Vq04.js} +1 -1
  8. package/dist/redocly-openapi-docs.min.TauriFileSystemAdapter-CpViFqJQ.js +1 -0
  9. package/dist/redocly-openapi-docs.min.TauriRootStorage-TCUrp2uB.js +1 -0
  10. package/dist/redocly-openapi-docs.min.ai-chat-mappers-CmX-8902.js +1 -0
  11. package/dist/redocly-openapi-docs.min.core-BYyFOtMX.js +1 -0
  12. package/dist/redocly-openapi-docs.min.external-resolver-BkceRyB4.js +2 -0
  13. package/dist/redocly-openapi-docs.min.index-BCcol5vU.js +1 -0
  14. package/dist/redocly-openapi-docs.min.index-C6uU_v-b.js +1 -0
  15. package/dist/redocly-openapi-docs.min.index-CmXZfuiZ.js +7730 -0
  16. package/dist/redocly-openapi-docs.min.index-DVWw0ICA.js +1 -0
  17. package/dist/redocly-openapi-docs.min.index-YnvLQkG_.js +1 -0
  18. package/dist/redocly-openapi-docs.min.index-xl_tBaHD.js +1 -0
  19. package/dist/redocly-openapi-docs.min.js +1 -1
  20. package/dist/{redocly-openapi-docs.min.lint-C-zlwxhp.js → redocly-openapi-docs.min.lint-2YpbCz3r.js} +69 -69
  21. package/dist/{redocly-openapi-docs.min.lint-graphql-qEh9cZHx.js → redocly-openapi-docs.min.lint-graphql-Bgfcu2tP.js} +1 -1
  22. package/dist/redocly-openapi-docs.min.periodic-revalidation-Dsp-n7ui.js +1 -0
  23. package/dist/redocly-openapi-docs.min.promise-map-limit-Db_42GvV.js +1 -0
  24. package/dist/{redocly-openapi-docs.min.respect-run-hfNPYQ9x.js → redocly-openapi-docs.min.respect-run-Ct8taisL.js} +1 -1
  25. package/dist/redocly-openapi-docs.min.standalone-BPCdJgtH.js +11995 -0
  26. package/dist/redocly-openapi-docs.min.tauri-path-CmqBCxGb.js +1 -0
  27. package/dist/{redocly-openapi-docs.min.useAiChatQueries-DgSsCKMW.js → redocly-openapi-docs.min.useAiChatQueries-t8oy8jik.js} +80 -80
  28. package/lib/components/ApiInfo/__tests__/ApiInfo.test.d.ts +1 -0
  29. package/lib/components/ApiInfo/__tests__/ApiInfo.test.js +46 -0
  30. package/lib/components/Callbacks/CallbackOperation.js +1 -1
  31. package/lib/components/Callbacks/__tests__/Callbacks.test.d.ts +1 -0
  32. package/lib/components/Callbacks/__tests__/Callbacks.test.js +46 -0
  33. package/lib/components/Content/__tests__/useAutoScroll.test.d.ts +1 -0
  34. package/lib/components/Content/__tests__/useAutoScroll.test.js +88 -0
  35. package/lib/components/Content/useAutoScroll.js +1 -1
  36. package/lib/components/ContentItem/__tests__/useIsExpanded.test.d.ts +1 -0
  37. package/lib/components/ContentItem/__tests__/useIsExpanded.test.js +123 -0
  38. package/lib/components/ContentItem/useIsExpanded.js +1 -1
  39. package/lib/components/ContentItems/ContentItems.js +1 -1
  40. package/lib/components/ContentItems/VirtualList.js +1 -1
  41. package/lib/components/ContentItems/__tests__/Items.test.d.ts +1 -0
  42. package/lib/components/ContentItems/__tests__/Items.test.js +66 -0
  43. package/lib/components/ContentItems/__tests__/VirtualList.test.d.ts +1 -0
  44. package/lib/components/ContentItems/__tests__/VirtualList.test.js +135 -0
  45. package/lib/components/ContentItems/useScrollOnRender.js +1 -1
  46. package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.d.ts +1 -0
  47. package/lib/components/Discriminator/__tests__/DiscriminatorDropdown.test.js +63 -0
  48. package/lib/components/Download/__tests__/DownloadSpecification.test.d.ts +1 -0
  49. package/lib/components/Download/__tests__/DownloadSpecification.test.js +52 -0
  50. package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.d.ts +1 -0
  51. package/lib/components/ExpandAllButton/__tests__/ExpandAllButton.test.js +60 -0
  52. package/lib/components/ExpandAllButton/__tests__/helpers.test.d.ts +1 -0
  53. package/lib/components/ExpandAllButton/__tests__/helpers.test.js +133 -0
  54. package/lib/components/Language/__tests__/LanguageDropdown.test.d.ts +1 -0
  55. package/lib/components/Language/__tests__/LanguageDropdown.test.js +23 -0
  56. package/lib/components/Markdown/__tests__/Markdown.test.d.ts +1 -0
  57. package/lib/components/Markdown/__tests__/Markdown.test.js +34 -0
  58. package/lib/components/McpOverview/__tests__/McpOverview.test.d.ts +1 -0
  59. package/lib/components/McpOverview/__tests__/McpOverview.test.js +66 -0
  60. package/lib/components/McpTool/__tests__/McpPrompt.test.d.ts +1 -0
  61. package/lib/components/McpTool/__tests__/McpPrompt.test.js +57 -0
  62. package/lib/components/McpTool/__tests__/McpResource.test.d.ts +1 -0
  63. package/lib/components/McpTool/__tests__/McpResource.test.js +81 -0
  64. package/lib/components/McpTool/__tests__/McpTool.test.d.ts +1 -0
  65. package/lib/components/McpTool/__tests__/McpTool.test.js +82 -0
  66. package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.d.ts +1 -0
  67. package/lib/components/MediaTypeSwitch/__tests__/MediaTypesSwitch.test.js +79 -0
  68. package/lib/components/OperationItem/__tests__/OperationItem.test.d.ts +1 -0
  69. package/lib/components/OperationItem/__tests__/OperationItem.test.js +70 -0
  70. package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.d.ts +16 -0
  71. package/lib/components/OperationItem/__tests__/__mocks__/mock-intersection-observer.js +42 -0
  72. package/lib/components/Overview/__tests__/Overview.test.d.ts +1 -0
  73. package/lib/components/Overview/__tests__/Overview.test.js +59 -0
  74. package/lib/components/PayloadSamples/__tests__/Example.test.d.ts +1 -0
  75. package/lib/components/PayloadSamples/__tests__/Example.test.js +36 -0
  76. package/lib/components/PayloadSamples/__tests__/ExampleValue.test.d.ts +1 -0
  77. package/lib/components/PayloadSamples/__tests__/ExampleValue.test.js +197 -0
  78. package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.d.ts +1 -0
  79. package/lib/components/PayloadSamples/__tests__/PayloadSamples.test.js +38 -0
  80. package/lib/components/PropertyDetails/__tests__/Extensions.test.d.ts +1 -0
  81. package/lib/components/PropertyDetails/__tests__/Extensions.test.js +21 -0
  82. package/lib/components/PropertyDetails/__tests__/FieldDetail.test.d.ts +1 -0
  83. package/lib/components/PropertyDetails/__tests__/FieldDetail.test.js +52 -0
  84. package/lib/components/PropertyDetails/__tests__/FieldDetails.test.d.ts +1 -0
  85. package/lib/components/PropertyDetails/__tests__/FieldDetails.test.js +191 -0
  86. package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.d.ts +1 -0
  87. package/lib/components/PropertyDetails/__tests__/PropertyDetails.test.js +365 -0
  88. package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.d.ts +1 -0
  89. package/lib/components/PropertyDetails/__tests__/cycleColorsByLevel.test.js +23 -0
  90. package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.d.ts +1 -0
  91. package/lib/components/RedoclyOpenAPIDocs/__tests__/AppProvider.test.js +16 -0
  92. package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.d.ts +1 -0
  93. package/lib/components/RedoclyOpenAPIDocs/__tests__/RedoclyOpenAPIDocs.test.js +104 -0
  94. package/lib/components/RenderHook/__tests__/RenderHook.test.d.ts +1 -0
  95. package/lib/components/RenderHook/__tests__/RenderHook.test.js +15 -0
  96. package/lib/components/Replay/__tests__/utils.test.d.ts +1 -0
  97. package/lib/components/Replay/__tests__/utils.test.js +526 -0
  98. package/lib/components/Request/__tests__/RequestDetails.test.d.ts +1 -0
  99. package/lib/components/Request/__tests__/RequestDetails.test.js +98 -0
  100. package/lib/components/RequestSamples/__tests__/Example.test.d.ts +1 -0
  101. package/lib/components/RequestSamples/__tests__/Example.test.js +384 -0
  102. package/lib/components/RequestSamples/__tests__/RequestSamples.test.d.ts +1 -0
  103. package/lib/components/RequestSamples/__tests__/RequestSamples.test.js +226 -0
  104. package/lib/components/RequestSamples/__tests__/useCodeSamples.test.d.ts +1 -0
  105. package/lib/components/RequestSamples/__tests__/useCodeSamples.test.js +64 -0
  106. package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.d.ts +1 -0
  107. package/lib/components/ResponseSamples/__tests__/ResponseSamples.test.js +29 -0
  108. package/lib/components/Responses/OperationResponseList.js +1 -1
  109. package/lib/components/Responses/__tests__/OperationResponseList.test.d.ts +1 -0
  110. package/lib/components/Responses/__tests__/OperationResponseList.test.js +89 -0
  111. package/lib/components/Responses/__tests__/ResponseDetails.test.d.ts +1 -0
  112. package/lib/components/Responses/__tests__/ResponseDetails.test.js +111 -0
  113. package/lib/components/Responses/__tests__/ResponsesHeaders.test.d.ts +1 -0
  114. package/lib/components/Responses/__tests__/ResponsesHeaders.test.js +26 -0
  115. package/lib/components/Schema/Schema.js +1 -1
  116. package/lib/components/Schema/SubSchema.js +1 -1
  117. package/lib/components/Schema/__tests__/ArraySchema.test.d.ts +1 -0
  118. package/lib/components/Schema/__tests__/ArraySchema.test.js +93 -0
  119. package/lib/components/Schema/__tests__/ObjectSchema.test.d.ts +1 -0
  120. package/lib/components/Schema/__tests__/ObjectSchema.test.js +115 -0
  121. package/lib/components/Schema/__tests__/OneOfSchema.test.d.ts +1 -0
  122. package/lib/components/Schema/__tests__/OneOfSchema.test.js +33 -0
  123. package/lib/components/Schema/__tests__/Schema.test.d.ts +1 -0
  124. package/lib/components/Schema/__tests__/Schema.test.js +67 -0
  125. package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.d.ts +1 -0
  126. package/lib/components/Schema/__tests__/useOneOfLocationIdx.test.js +22 -0
  127. package/lib/components/Schema/useOneOfLocationIdx.js +1 -1
  128. package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.d.ts +1 -0
  129. package/lib/components/SchemaCatalogLink/__tests__/SchemaCatalogLink.test.js +95 -0
  130. package/lib/components/Security/__tests__/Security.test.d.ts +1 -0
  131. package/lib/components/Security/__tests__/Security.test.js +38 -0
  132. package/lib/components/Security/__tests__/SecurityButton.test.d.ts +1 -0
  133. package/lib/components/Security/__tests__/SecurityButton.test.js +92 -0
  134. package/lib/components/Security/__tests__/SecurityModal.test.d.ts +1 -0
  135. package/lib/components/Security/__tests__/SecurityModal.test.js +172 -0
  136. package/lib/components/ServerList/__tests__/ServerList.test.d.ts +1 -0
  137. package/lib/components/ServerList/__tests__/ServerList.test.js +83 -0
  138. package/lib/components/SideMenu/hooks/useMenuItems.js +1 -1
  139. package/lib/components/StickySidebar/StickyResponsiveSidebar.js +1 -1
  140. package/lib/components/Tabs/__tests__/Tabs.test.d.ts +1 -0
  141. package/lib/components/Tabs/__tests__/Tabs.test.js +27 -0
  142. package/lib/components/TagItem/OperationsNavigation.js +1 -1
  143. package/lib/components/TagItem/TagItem.js +1 -1
  144. package/lib/components/ViewNested/__tests__/ViewNested.test.d.ts +1 -0
  145. package/lib/components/ViewNested/__tests__/ViewNested.test.js +42 -0
  146. package/lib/components/__tests__/Samples/ExampleSwitch.test.d.ts +1 -0
  147. package/lib/components/__tests__/Samples/ExampleSwitch.test.js +45 -0
  148. package/lib/components/__tests__/Samples/use-example-key.test.d.ts +1 -0
  149. package/lib/components/__tests__/Samples/use-example-key.test.js +28 -0
  150. package/lib/components/__tests__/common/ClearButton.test.d.ts +1 -0
  151. package/lib/components/__tests__/common/ClearButton.test.js +18 -0
  152. package/lib/components/__tests__/common/Dropdown.test.d.ts +1 -0
  153. package/lib/components/__tests__/common/Dropdown.test.js +52 -0
  154. package/lib/components/__tests__/mocks/examples.d.ts +4 -0
  155. package/lib/components/__tests__/mocks/examples.js +115 -0
  156. package/lib/components/common/LinkToField.js +1 -1
  157. package/lib/components/common/__tests__/Dropdown.test.d.ts +1 -0
  158. package/lib/components/common/__tests__/Dropdown.test.js +129 -0
  159. package/lib/components/common/__tests__/LinkToField.test.d.ts +1 -0
  160. package/lib/components/common/__tests__/LinkToField.test.js +39 -0
  161. package/lib/components/common/linkify.js +1 -1
  162. package/lib/hooks/useRouter.js +1 -1
  163. package/lib/hooks/useUppercase2LowercaseRedirect.js +1 -1
  164. package/lib/jotai/__tests__/app.test.d.ts +1 -0
  165. package/lib/jotai/__tests__/app.test.js +53 -0
  166. package/lib/models/__tests__/Callback.test.d.ts +1 -0
  167. package/lib/models/__tests__/Callback.test.js +15 -0
  168. package/lib/models/__tests__/FieldModel.test.d.ts +1 -0
  169. package/lib/models/__tests__/FieldModel.test.js +117 -0
  170. package/lib/models/__tests__/MediaContent.test.d.ts +1 -0
  171. package/lib/models/__tests__/MediaContent.test.js +105 -0
  172. package/lib/models/__tests__/Operation.test.d.ts +1 -0
  173. package/lib/models/__tests__/Operation.test.js +459 -0
  174. package/lib/models/__tests__/Response.test.d.ts +1 -0
  175. package/lib/models/__tests__/Response.test.js +221 -0
  176. package/lib/models/__tests__/Schema.circular.test.d.ts +1 -0
  177. package/lib/models/__tests__/Schema.circular.test.js +694 -0
  178. package/lib/models/__tests__/Schema.test.d.ts +1 -0
  179. package/lib/models/__tests__/Schema.test.js +1395 -0
  180. package/lib/models/__tests__/example.test.d.ts +1 -0
  181. package/lib/models/__tests__/example.test.js +90 -0
  182. package/lib/models/__tests__/group.test.d.ts +1 -0
  183. package/lib/models/__tests__/group.test.js +52 -0
  184. package/lib/models/__tests__/helpers.d.ts +5 -0
  185. package/lib/models/__tests__/helpers.js +62 -0
  186. package/lib/models/__tests__/request.test.d.ts +1 -0
  187. package/lib/models/__tests__/request.test.js +119 -0
  188. package/lib/services/__tests__/OpenAPIParser.test.d.ts +1 -0
  189. package/lib/services/__tests__/OpenAPIParser.test.js +80 -0
  190. package/lib/services/__tests__/check.test.d.ts +1 -0
  191. package/lib/services/__tests__/check.test.js +22 -0
  192. package/lib/services/__tests__/utils.test.d.ts +1 -0
  193. package/lib/services/__tests__/utils.test.js +42 -0
  194. package/lib/services/code-samples/__tests__/apply-environments.test.d.ts +1 -0
  195. package/lib/services/code-samples/__tests__/apply-environments.test.js +64 -0
  196. package/lib/services/code-samples/__tests__/build-code-samples.test.d.ts +1 -0
  197. package/lib/services/code-samples/__tests__/build-code-samples.test.js +70 -0
  198. package/lib/services/code-samples/__tests__/convertSampleToString.test.d.ts +1 -0
  199. package/lib/services/code-samples/__tests__/convertSampleToString.test.js +116 -0
  200. package/lib/services/code-samples/__tests__/generator-data-value.test.d.ts +1 -0
  201. package/lib/services/code-samples/__tests__/generator-data-value.test.js +277 -0
  202. package/lib/services/code-samples/__tests__/generator-serialized-value.test.d.ts +1 -0
  203. package/lib/services/code-samples/__tests__/generator-serialized-value.test.js +258 -0
  204. package/lib/services/code-samples/__tests__/generator-value.test.d.ts +1 -0
  205. package/lib/services/code-samples/__tests__/generator-value.test.js +273 -0
  206. package/lib/services/code-samples/__tests__/generator.test.d.ts +249 -0
  207. package/lib/services/code-samples/__tests__/generator.test.js +1201 -0
  208. package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.d.ts +1 -0
  209. package/lib/services/code-samples/__tests__/get-example-value-by-mime-type.test.js +31 -0
  210. package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.d.ts +1 -0
  211. package/lib/services/code-samples/httpsnippet/__tests__/device-authorization.test.js +222 -0
  212. package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.d.ts +1 -0
  213. package/lib/services/code-samples/httpsnippet/helpers/__tests__/code-helpers.test.js +129 -0
  214. package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.d.ts +1 -0
  215. package/lib/services/code-samples/httpsnippet/helpers/__tests__/string-utility.test.js +49 -0
  216. package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.d.ts +1 -0
  217. package/lib/services/code-samples/httpsnippet/targets/csharp/__tests__/httpclient.test.js +172 -0
  218. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.d.ts +1 -0
  219. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/__tests__/httpclient.test.js +172 -0
  220. package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.d.ts +1 -0
  221. package/lib/services/code-samples/httpsnippet/targets/go/__tests__/native.test.js +130 -0
  222. package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.d.ts +1 -0
  223. package/lib/services/code-samples/httpsnippet/targets/java/__tests__/httpclient.test.js +191 -0
  224. package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.d.ts +1 -0
  225. package/lib/services/code-samples/httpsnippet/targets/java8/__tests__/apachehttp.test.js +172 -0
  226. package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.d.ts +1 -0
  227. package/lib/services/code-samples/httpsnippet/targets/javascript/__tests__/fetch.test.js +85 -0
  228. package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.d.ts +1 -0
  229. package/lib/services/code-samples/httpsnippet/targets/node/__tests__/fetch.test.js +85 -0
  230. package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.d.ts +1 -0
  231. package/lib/services/code-samples/httpsnippet/targets/php/__tests__/curl.test.js +126 -0
  232. package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.d.ts +1 -0
  233. package/lib/services/code-samples/httpsnippet/targets/python/__tests__/requests.test.js +105 -0
  234. package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.d.ts +1 -0
  235. package/lib/services/code-samples/httpsnippet/targets/r/__tests__/httr.test.js +126 -0
  236. package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.d.ts +1 -0
  237. package/lib/services/code-samples/httpsnippet/targets/ruby/__tests__/native.test.js +129 -0
  238. package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.d.ts +1 -0
  239. package/lib/services/code-samples/httpsnippet/targets/shell/__tests__/curl.test.js +129 -0
  240. package/lib/services/config-options/__tests__/helpers.test.d.ts +1 -0
  241. package/lib/services/config-options/__tests__/helpers.test.js +234 -0
  242. package/lib/services/history/__tests__/helpers.test.d.ts +1 -0
  243. package/lib/services/history/__tests__/helpers.test.js +19 -0
  244. package/lib/services/menu/__tests__/buildNestedTagsItems.test.d.ts +1 -0
  245. package/lib/services/menu/__tests__/buildNestedTagsItems.test.js +109 -0
  246. package/lib/services/menu/__tests__/builder.test.d.ts +1 -0
  247. package/lib/services/menu/__tests__/builder.test.js +307 -0
  248. package/lib/services/menu/__tests__/operation.test.d.ts +1 -0
  249. package/lib/services/menu/__tests__/operation.test.js +240 -0
  250. package/lib/services/menu/__tests__/tags.test.d.ts +1 -0
  251. package/lib/services/menu/__tests__/tags.test.js +71 -0
  252. package/lib/telemetry/RedocTelemetry.js +31 -1
  253. package/lib/telemetry/__tests__/RedocTelemetry.test.d.ts +1 -0
  254. package/lib/telemetry/__tests__/RedocTelemetry.test.js +107 -0
  255. package/lib/testProviders.d.ts +6 -0
  256. package/lib/testProviders.js +14 -0
  257. package/lib/utils/__tests__/areArraysEqual.test.d.ts +1 -0
  258. package/lib/utils/__tests__/areArraysEqual.test.js +33 -0
  259. package/lib/utils/__tests__/argValuesHelpers.d.ts +1 -0
  260. package/lib/utils/__tests__/argValuesHelpers.js +56 -0
  261. package/lib/utils/__tests__/calculateMaxLength.test.d.ts +1 -0
  262. package/lib/utils/__tests__/calculateMaxLength.test.js +119 -0
  263. package/lib/utils/__tests__/configure-helpers.test.d.ts +1 -0
  264. package/lib/utils/__tests__/configure-helpers.test.js +356 -0
  265. package/lib/utils/__tests__/convertSwagger2OpenAPI.test.d.ts +1 -0
  266. package/lib/utils/__tests__/convertSwagger2OpenAPI.test.js +392 -0
  267. package/lib/utils/__tests__/debounce.test.d.ts +1 -0
  268. package/lib/utils/__tests__/debounce.test.js +54 -0
  269. package/lib/utils/__tests__/debug.test.d.ts +1 -0
  270. package/lib/utils/__tests__/debug.test.js +23 -0
  271. package/lib/utils/__tests__/dom.test.d.ts +1 -0
  272. package/lib/utils/__tests__/dom.test.js +108 -0
  273. package/lib/utils/__tests__/getBreadcrumbs.test.d.ts +1 -0
  274. package/lib/utils/__tests__/getBreadcrumbs.test.js +98 -0
  275. package/lib/utils/__tests__/hasNestedFields.test.d.ts +1 -0
  276. package/lib/utils/__tests__/hasNestedFields.test.js +147 -0
  277. package/lib/utils/__tests__/helpers.test.d.ts +1 -0
  278. package/lib/utils/__tests__/helpers.test.js +174 -0
  279. package/lib/utils/__tests__/isMobile.test.d.ts +1 -0
  280. package/lib/utils/__tests__/isMobile.test.js +28 -0
  281. package/lib/utils/__tests__/loadAndBundleSpec.test.d.ts +1 -0
  282. package/lib/utils/__tests__/loadAndBundleSpec.test.js +22 -0
  283. package/lib/utils/__tests__/local-storage.test.d.ts +1 -0
  284. package/lib/utils/__tests__/local-storage.test.js +48 -0
  285. package/lib/utils/__tests__/object.test.d.ts +1 -0
  286. package/lib/utils/__tests__/object.test.js +45 -0
  287. package/lib/utils/__tests__/openapi.test.d.ts +1 -0
  288. package/lib/utils/__tests__/openapi.test.js +1378 -0
  289. package/lib/utils/__tests__/path.test.d.ts +1 -0
  290. package/lib/utils/__tests__/path.test.js +16 -0
  291. package/lib/utils/__tests__/queryString.test.d.ts +1 -0
  292. package/lib/utils/__tests__/queryString.test.js +60 -0
  293. package/lib/utils/__tests__/replaceVariables.test.d.ts +1 -0
  294. package/lib/utils/__tests__/replaceVariables.test.js +46 -0
  295. package/lib/utils/__tests__/simplifyAstStructure.test.d.ts +1 -0
  296. package/lib/utils/__tests__/simplifyAstStructure.test.js +26 -0
  297. package/lib/utils/__tests__/sort.test.d.ts +1 -0
  298. package/lib/utils/__tests__/sort.test.js +16 -0
  299. package/lib/utils/__tests__/string.test.d.ts +1 -0
  300. package/lib/utils/__tests__/string.test.js +16 -0
  301. package/lib/utils/__tests__/theme-helpers.test.d.ts +1 -0
  302. package/lib/utils/__tests__/theme-helpers.test.js +24 -0
  303. package/lib/utils/__tests__/url.test.d.ts +1 -0
  304. package/lib/utils/__tests__/url.test.js +134 -0
  305. package/lib/utils/path.d.ts +1 -1
  306. package/package.json +12 -12
  307. package/dist/redocly-openapi-docs.min.ai-chat-mappers-MY79QAeW.js +0 -1
  308. package/dist/redocly-openapi-docs.min.external-resolver-3KMJv7SC.js +0 -2
  309. package/dist/redocly-openapi-docs.min.index-BYVMr_la.js +0 -1
  310. package/dist/redocly-openapi-docs.min.index-CsqzTi3Z.js +0 -7586
  311. package/dist/redocly-openapi-docs.min.index-D8F7x0S6.js +0 -1
  312. package/dist/redocly-openapi-docs.min.index-qqKTpI_q.js +0 -1
  313. package/dist/redocly-openapi-docs.min.standalone-Ci6886Cr.js +0 -12114
  314. package/dist/redocly-openapi-docs.min.tauri-path-Bs1-AQjc.js +0 -1
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import util from 'util';
3
+ import { render } from '@testing-library/react';
4
+ import * as Jotai from 'jotai';
5
+ import { LayoutVariant } from '@redocly/config';
6
+ import { ApiInfo } from '../ApiInfo.js';
7
+ import { TestBrowserRouter } from '../../../testProviders.js';
8
+ Object.defineProperty(global, 'TextEncoder', {
9
+ value: util.TextEncoder,
10
+ });
11
+ vi.mock('jotai', async () => ({
12
+ ...(await vi.importActual('jotai')),
13
+ useAtomValue: vi.fn(),
14
+ }));
15
+ describe('ApiInfo', () => {
16
+ it('ApiInfo renders correctly', () => {
17
+ vi.spyOn(Jotai, 'useAtomValue').mockReturnValue({
18
+ parser: {
19
+ definition: {
20
+ info: {
21
+ downloadFileName: 'downloadFileNameValue',
22
+ summary: ' ',
23
+ description: 'This is a sample server Petstore server.',
24
+ },
25
+ },
26
+ },
27
+ options: {
28
+ downloadDefinitionUrl: 'downloadDefinitionUrlValue',
29
+ expandDefaultServerVariables: true,
30
+ },
31
+ });
32
+ const result = render(_jsx(ApiInfo, { layout: LayoutVariant.THREE_PANEL, item: {
33
+ infoDefinition: {
34
+ info: {
35
+ downloadFileName: 'downloadFileNameValue',
36
+ summary: 'Some summary',
37
+ description: 'This is a sample server Petstore server.',
38
+ },
39
+ },
40
+ } }), {
41
+ wrapper: TestBrowserRouter,
42
+ });
43
+ expect(result).toMatchSnapshot();
44
+ });
45
+ });
46
+ //# sourceMappingURL=ApiInfo.test.js.map
@@ -1,4 +1,4 @@
1
- import{jsx as r,jsxs as c}from"react/jsx-runtime";import{useLocation as d}from"react-router-dom";import{useTranslate as b}from"../../hooks/index.js";import{CallbackPanel as f}from"../Panel/index.js";import{CallbackDetails as x}from"./CallbackDetails.js";import{CallbackSummary as u}from"./CallbackSummary.js";import{pathIncludesLink as k}from"../../utils/index.js";import{styled as l}from"../../styled-components.js";const B=({operation:o,operation:{callbackId:a},onExpand:s,selectedCallback:n})=>{const t=b(),i=d();return r(f,{header:({expanded:e,toggle:m})=>r(u,{callback:o,toggle:p=>{m?.(p),s?.(e?null:o)},expanded:e,translate:t}),expanded:n?.callbackId===a||k(i,a),className:"panel-response-callback",children:c(h,{children:[r(x,{operation:o,translate:t}),r(y,{})]})})},h=l.div`
1
+ import{jsx as r,jsxs as c}from"react/jsx-runtime";import{useLocation as d}from"react-router";import{useTranslate as b}from"../../hooks/index.js";import{CallbackPanel as f}from"../Panel/index.js";import{CallbackDetails as x}from"./CallbackDetails.js";import{CallbackSummary as u}from"./CallbackSummary.js";import{pathIncludesLink as k}from"../../utils/index.js";import{styled as l}from"../../styled-components.js";const B=({operation:o,operation:{callbackId:a},onExpand:s,selectedCallback:n})=>{const t=b(),i=d();return r(f,{header:({expanded:e,toggle:m})=>r(u,{callback:o,toggle:p=>{m?.(p),s?.(e?null:o)},expanded:e,translate:t}),expanded:n?.callbackId===a||k(i,a),className:"panel-response-callback",children:c(h,{children:[r(x,{operation:o,translate:t}),r(y,{})]})})},h=l.div`
2
2
  position: relative;
3
3
  .property:last-child {
4
4
  border-bottom: none;
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render } from '@testing-library/react';
3
+ import userEvent from '@testing-library/user-event';
4
+ import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
5
+ import { getCallback } from '../../../models/index.js';
6
+ import { CallbackOperation } from '../CallbackOperation.js';
7
+ import { CallbacksList } from '../CallbacksList.js';
8
+ import { CallbackSummary } from '../CallbackSummary.js';
9
+ import * as simpleCallbackFixture from './fixtures/simple-callback.json';
10
+ import { TestBrowserRouter } from '../../../testProviders.js';
11
+ const options = normalizeOptions({});
12
+ describe('Components', () => {
13
+ describe('Callbacks', () => {
14
+ const parser = new OpenAPIParser(simpleCallbackFixture, undefined, options);
15
+ const callback = getCallback(parser, 'Test.Callback', { $ref: '#/components/callbacks/Test' }, '', options, '');
16
+ const renderCallbackOperation = (props = {}) => render(_jsx(CallbackOperation, { operation: callback.operations[0], onExpand: () => { }, selectedCallback: null, ...props }), {
17
+ wrapper: TestBrowserRouter,
18
+ });
19
+ it('should correctly render CallbackView', () => {
20
+ const { getByText } = renderCallbackOperation();
21
+ expect(getByText('testCallback')).toBeInTheDocument();
22
+ });
23
+ it('should correctly render CallbackTitle', () => {
24
+ const { getByText } = render(_jsx(CallbackSummary, { toggle: () => { }, callback: callback.operations[0], translate: () => '' }), {
25
+ wrapper: TestBrowserRouter,
26
+ });
27
+ expect(getByText('testCallback')).toBeInTheDocument();
28
+ });
29
+ it('should expand the callback when the summary is clicked', async () => {
30
+ const user = userEvent.setup();
31
+ const onExpand = vi.fn();
32
+ const { getByText, getByTestId, queryByTestId } = renderCallbackOperation({ onExpand });
33
+ expect(queryByTestId('panel-body')).not.toBeInTheDocument();
34
+ await user.click(getByText('testCallback'));
35
+ expect(onExpand).toHaveBeenCalledWith(callback.operations[0]);
36
+ expect(getByTestId('panel-body')).toBeInTheDocument();
37
+ });
38
+ it('should correctly render CallbacksList', () => {
39
+ const { getByText } = render(_jsx(CallbacksList, { callbacks: [callback], onExpand: () => { }, selectedCallback: null }), {
40
+ wrapper: TestBrowserRouter,
41
+ });
42
+ expect(getByText('testCallback')).toBeInTheDocument();
43
+ });
44
+ });
45
+ });
46
+ //# sourceMappingURL=Callbacks.test.js.map
@@ -0,0 +1,88 @@
1
+ import { renderHook } from '@testing-library/react';
2
+ import { useLocation } from 'react-router';
3
+ import { vi } from 'vitest';
4
+ import { useAutoScroll } from '../useAutoScroll.js';
5
+ vi.mock('react-router', () => ({
6
+ useLocation: vi.fn(),
7
+ }));
8
+ vi.mock('lodash.throttle', () => ({
9
+ default: (fn) => fn,
10
+ }));
11
+ vi.mock('@redocly/theme', async () => {
12
+ const actual = await vi.importActual('@redocly/theme');
13
+ return {
14
+ ...actual,
15
+ IS_BROWSER: true,
16
+ useActiveSectionId: vi.fn(() => '/test'),
17
+ };
18
+ });
19
+ describe('useAutoScroll', () => {
20
+ beforeEach(() => {
21
+ vi.useFakeTimers();
22
+ vi.clearAllMocks();
23
+ useAutoScroll.initialPageLoad = true;
24
+ window.history.replaceState = vi.fn();
25
+ window.scrollTo = vi.fn();
26
+ document.getElementById = vi.fn();
27
+ document.querySelector = vi.fn();
28
+ Object.defineProperty(window, 'location', {
29
+ value: { pathname: '', hash: '' },
30
+ writable: true,
31
+ });
32
+ });
33
+ afterEach(() => {
34
+ vi.useRealTimers();
35
+ vi.restoreAllMocks();
36
+ });
37
+ test('should processing without toLowerCase', () => {
38
+ const mockLocation = {
39
+ pathname: '/test',
40
+ hash: '#TestHash',
41
+ state: null,
42
+ key: '',
43
+ search: '',
44
+ };
45
+ useLocation.mockReturnValue(mockLocation);
46
+ renderHook(() => useAutoScroll('/'));
47
+ expect(document.getElementById).toHaveBeenCalledWith('TestHash');
48
+ });
49
+ test('should extract and process legacy hash patterns', () => {
50
+ const mockLocation = {
51
+ pathname: '/test',
52
+ hash: '#tag/TestTag',
53
+ state: null,
54
+ key: '',
55
+ search: '',
56
+ };
57
+ useLocation.mockReturnValue(mockLocation);
58
+ renderHook(() => useAutoScroll('/'));
59
+ expect(document.getElementById).toHaveBeenCalledWith('test/testtag');
60
+ });
61
+ test('should scroll to top when on base path without hash', () => {
62
+ const mockLocation = {
63
+ pathname: '/',
64
+ hash: '',
65
+ state: null,
66
+ key: '',
67
+ search: '',
68
+ };
69
+ useLocation.mockReturnValue(mockLocation);
70
+ renderHook(() => useAutoScroll('/'));
71
+ expect(window.scrollTo).toHaveBeenCalledWith(0, 0);
72
+ });
73
+ test('should scroll element into view when found', () => {
74
+ const mockElement = { scrollIntoView: vi.fn() };
75
+ const mockLocation = {
76
+ pathname: '/test',
77
+ hash: '#TestHash',
78
+ state: null,
79
+ key: '',
80
+ search: '',
81
+ };
82
+ useLocation.mockReturnValue(mockLocation);
83
+ document.getElementById.mockReturnValue(mockElement);
84
+ renderHook(() => useAutoScroll('/'));
85
+ expect(mockElement.scrollIntoView).toHaveBeenCalled();
86
+ });
87
+ });
88
+ //# sourceMappingURL=useAutoScroll.test.js.map
@@ -1 +1 @@
1
- import{useLocation as p}from"react-router-dom";import{useEffect as s}from"react";import{addLeadingSlash as d,removeLeadingSlash as l,useActiveSectionId as u}from"@redocly/theme/core/openapi";import{compose as f,encodeBackSlashes as h,tryDecodeURIComponent as w}from"../../utils/index.js";import{IS_BROWSER as S}from"../../utils/dom.js";let m=!0;function v(t){const e=p(),o=t||"/";s(()=>{if(e.pathname===o&&e.hash===""){window.scrollTo(0,0);return}const a=l(e.pathname.replace(o,"")),r=g(e.hash),i=r?c(a+r)||document.querySelector(`[id$="${l(r)}"]`):c(e.hash.replace("#",""))||c(a);i&&i.scrollIntoView()},[e,o]);const n=u(e,!1,!1);s(()=>{if(n&&m){m=!1;return}if(S&&!window.location.pathname.includes(n)&&!window.location.hash.includes(n)){const a=f(d,h)(n);window.history.replaceState({},"",a)}},[n])}function c(t){return document.getElementById(w(t))}function g(t){const e=["#tag","#operation","#paths"];for(const o of e)if(t.includes(o))return t.replace(o,"").toLowerCase();return""}export{c as getElementById,g as getLegacyHash,v as useAutoScroll};
1
+ import{useLocation as p}from"react-router";import{useEffect as s}from"react";import{addLeadingSlash as d,removeLeadingSlash as l,useActiveSectionId as u}from"@redocly/theme/core/openapi";import{compose as f,encodeBackSlashes as h,tryDecodeURIComponent as w}from"../../utils/index.js";import{IS_BROWSER as S}from"../../utils/dom.js";let m=!0;function v(t){const e=p(),o=t||"/";s(()=>{if(e.pathname===o&&e.hash===""){window.scrollTo(0,0);return}const a=l(e.pathname.replace(o,"")),r=g(e.hash),i=r?c(a+r)||document.querySelector(`[id$="${l(r)}"]`):c(e.hash.replace("#",""))||c(a);i&&i.scrollIntoView()},[e,o]);const n=u(e,!1,!1);s(()=>{if(n&&m){m=!1;return}if(S&&!window.location.pathname.includes(n)&&!window.location.hash.includes(n)){const a=f(d,h)(n);window.history.replaceState({},"",a)}},[n])}function c(t){return document.getElementById(w(t))}function g(t){const e=["#tag","#operation","#paths"];for(const o of e)if(t.includes(o))return t.replace(o,"").toLowerCase();return""}export{c as getElementById,g as getLegacyHash,v as useAutoScroll};
@@ -0,0 +1,123 @@
1
+ import { renderHook } from '@testing-library/react';
2
+ import { useLocation } from 'react-router';
3
+ import { useIsExpanded } from '../useIsExpanded.js';
4
+ // Mock react-router
5
+ vi.mock('react-router', () => ({
6
+ useLocation: vi.fn(),
7
+ }));
8
+ const mockUseLocation = useLocation;
9
+ describe('useIsExpanded', () => {
10
+ const mockRoutingBasePath = '/docs';
11
+ beforeEach(() => {
12
+ mockUseLocation.mockReset();
13
+ });
14
+ it('should return false for non-tag items', () => {
15
+ mockUseLocation.mockReturnValue({
16
+ pathname: '/docs/pets',
17
+ hash: '',
18
+ state: undefined,
19
+ key: '',
20
+ search: '',
21
+ });
22
+ const item = {
23
+ type: 'operation',
24
+ href: '/pets',
25
+ items: [],
26
+ };
27
+ const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
28
+ expect(result.current).toBe(false);
29
+ });
30
+ it('should return true when current path matches item href', () => {
31
+ mockUseLocation.mockReturnValue({
32
+ pathname: '/docs/pets',
33
+ hash: '',
34
+ state: undefined,
35
+ key: '',
36
+ search: '',
37
+ });
38
+ const item = {
39
+ type: 'tag',
40
+ href: '/pets',
41
+ items: [{ type: 'operation', href: '/pets/get', items: [] }],
42
+ };
43
+ const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
44
+ expect(result.current).toBe(true);
45
+ });
46
+ it('should return true when legacy hash matches item href', () => {
47
+ mockUseLocation.mockReturnValue({
48
+ pathname: '/docs',
49
+ hash: '#tag/pets',
50
+ state: undefined,
51
+ key: '',
52
+ search: '',
53
+ });
54
+ const item = {
55
+ type: 'tag',
56
+ href: '/pets',
57
+ items: [],
58
+ };
59
+ const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
60
+ expect(result.current).toBe(true);
61
+ });
62
+ it('should handle nested items', () => {
63
+ mockUseLocation.mockReturnValue({
64
+ pathname: '/docs/pets/create',
65
+ hash: '',
66
+ state: undefined,
67
+ key: '',
68
+ search: '',
69
+ });
70
+ const item = {
71
+ type: 'tag',
72
+ href: '/pets',
73
+ items: [
74
+ {
75
+ type: 'section',
76
+ href: '/pets',
77
+ items: [
78
+ {
79
+ type: 'section',
80
+ href: '/pets/create',
81
+ items: [],
82
+ },
83
+ ],
84
+ },
85
+ ],
86
+ };
87
+ const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
88
+ expect(result.current).toBe(true);
89
+ });
90
+ it('should handle encoded URLs', () => {
91
+ mockUseLocation.mockReturnValue({
92
+ pathname: '/docs/user%20profile',
93
+ hash: '',
94
+ state: undefined,
95
+ key: '',
96
+ search: '',
97
+ });
98
+ const item = {
99
+ type: 'tag',
100
+ href: '/user profile',
101
+ items: [],
102
+ };
103
+ const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
104
+ expect(result.current).toBe(true);
105
+ });
106
+ it('should return false when no matches found', () => {
107
+ mockUseLocation.mockReturnValue({
108
+ pathname: '/docs/users',
109
+ hash: '',
110
+ state: undefined,
111
+ key: '',
112
+ search: '',
113
+ });
114
+ const item = {
115
+ type: 'tag',
116
+ href: '/pets',
117
+ items: [{ type: 'operation', href: '/pets/list', items: [] }],
118
+ };
119
+ const { result } = renderHook(() => useIsExpanded({ item, routingBasePath: mockRoutingBasePath }));
120
+ expect(result.current).toBe(false);
121
+ });
122
+ });
123
+ //# sourceMappingURL=useIsExpanded.test.js.map
@@ -1 +1 @@
1
- import{useMemo as a}from"react";import{useLocation as f}from"react-router-dom";import{removeLeadingSlash as h}from"@redocly/theme/core/openapi";import{tryDecodeURIComponent as m,normalizePath as l}from"../../utils/index.js";import{getLegacyHash as d}from"../Content/useAutoScroll.js";function v({item:o,routingBasePath:s}){const n=f(),c=a(()=>m(l(n.pathname.replace(s,""))),[n.pathname,s]),p=a(()=>{const e=[],t=i=>{i.forEach(r=>{e.push(r),r.items?.length&&t(r.items)})};return t([o]),e},[o]);return o.type!=="tag"?!1:p.map(e=>e.href).some(e=>{const t=d(n.hash);return[e,m(e)].includes(c)||t&&(e.endsWith(t)||e===h(t))})}export{v as useIsExpanded};
1
+ import{useMemo as a}from"react";import{useLocation as f}from"react-router";import{removeLeadingSlash as h}from"@redocly/theme/core/openapi";import{tryDecodeURIComponent as m,normalizePath as l}from"../../utils/index.js";import{getLegacyHash as d}from"../Content/useAutoScroll.js";function v({item:o,routingBasePath:s}){const n=f(),c=a(()=>m(l(n.pathname.replace(s,""))),[n.pathname,s]),p=a(()=>{const e=[],t=i=>{i.forEach(r=>{e.push(r),r.items?.length&&t(r.items)})};return t([o]),e},[o]);return o.type!=="tag"?!1:p.map(e=>e.href).some(e=>{const t=d(n.hash);return[e,m(e)].includes(c)||t&&(e.endsWith(t)||e===h(t))})}export{v as useIsExpanded};
@@ -1 +1 @@
1
- import{Fragment as l,jsx as t,jsxs as f}from"react/jsx-runtime";import{memo as u,useMemo as p}from"react";import{Navigate as c,Route as n,Routes as m}from"react-router-dom";import{getFirstPageLink as d,getItemsByType as g}from"./helpers.js";import{SectionContent as s}from"../SectionContent/index.js";function h({items:e,root:r=!1}){const{rootItem:o}=g(e),a=!r||o?"/":d(e,"/"),i=p(()=>f(m,{children:[o&&t(n,{path:`${o.href||"/"}*`,element:t(s,{items:e})}),t(n,{path:"*",element:t(c,{to:a,replace:!0})})]}),[o,"/",e,a]);return r&&!e.length?t(m,{children:t(n,{path:"*",element:t(s,{items:e})})}):e.length?t(l,{children:i}):null}const I=u(h);export{I as ContentItems};
1
+ import{Fragment as l,jsx as t,jsxs as f}from"react/jsx-runtime";import{memo as u,useMemo as p}from"react";import{Navigate as c,Route as n,Routes as m}from"react-router";import{getFirstPageLink as d,getItemsByType as g}from"./helpers.js";import{SectionContent as s}from"../SectionContent/index.js";function h({items:e,root:r=!1}){const{rootItem:o}=g(e),a=!r||o?"/":d(e,"/"),i=p(()=>f(m,{children:[o&&t(n,{path:`${o.href||"/"}*`,element:t(s,{items:e})}),t(n,{path:"*",element:t(c,{to:a,replace:!0})})]}),[o,"/",e,a]);return r&&!e.length?t(m,{children:t(n,{path:"*",element:t(s,{items:e})})}):e.length?t(l,{children:i}):null}const I=u(h);export{I as ContentItems};
@@ -1 +1 @@
1
- import{Fragment as f,jsx as h}from"react/jsx-runtime";import{useCallback as g,memo as M,useEffect as _,useState as x,useMemo as E}from"react";import{useLocation as S}from"react-router-dom";import{removeLeadingSlash as r}from"@redocly/theme/core/openapi";const T=3,a=1,b=1e3,F=({items:e=[],renderItem:c,routingBasePath:i})=>{const m=i||"/",u=S(),l=r(u.pathname.replace(m,"")),s=E(()=>{const n=new Map(e.map((t,o)=>[r(t.href),o]));return t=>t?n.get(t):void 0},[e]),I=g(n=>{const t=s(n),o=Math.max(0,t?t-a:0),L=Math.min(e.length,t?t+a+1:T);return{start:o,end:L}},[s,e.length]),[p,d]=x(()=>{const{start:n,end:t}=I(l);return e.slice(n,t)});return _(()=>{const n=setTimeout(()=>{d(e)},b);return()=>clearTimeout(n)},[e]),h(f,{children:p.map(c)})},B=M(F);export{B as VirtualList};
1
+ import{Fragment as f,jsx as h}from"react/jsx-runtime";import{useCallback as g,memo as M,useEffect as _,useState as x,useMemo as E}from"react";import{useLocation as S}from"react-router";import{removeLeadingSlash as r}from"@redocly/theme/core/openapi";const T=3,a=1,b=1e3,F=({items:e=[],renderItem:c,routingBasePath:i})=>{const m=i||"/",u=S(),l=r(u.pathname.replace(m,"")),s=E(()=>{const n=new Map(e.map((t,o)=>[r(t.href),o]));return t=>t?n.get(t):void 0},[e]),I=g(n=>{const t=s(n),o=Math.max(0,t?t-a:0),L=Math.min(e.length,t?t+a+1:T);return{start:o,end:L}},[s,e.length]),[p,d]=x(()=>{const{start:n,end:t}=I(l);return e.slice(n,t)});return _(()=>{const n=setTimeout(()=>{d(e)},b);return()=>clearTimeout(n)},[e]),h(f,{children:p.map(c)})},B=M(F);export{B as VirtualList};
@@ -0,0 +1,66 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { render, screen } from '@testing-library/react';
3
+ import { Items } from '../Items.js';
4
+ import { TestMemoryRouter } from '../../../testProviders.js';
5
+ vi.mock('../../ContentItem', () => ({
6
+ ContentItem: ({ children, item }) => (_jsxs("div", { "data-testid": `content-item-${item.id}`, children: [item.title, children] })),
7
+ }));
8
+ vi.mock('../VirtualList', () => ({
9
+ VirtualList: ({ items }) => (_jsx("div", { "data-testid": "virtual-list", children: items.map((item) => (_jsx("div", { children: item.title }, item.id))) })),
10
+ }));
11
+ const mockItems = [
12
+ { id: '1', title: 'Item 1', type: 'group', items: [] },
13
+ { id: '2', title: 'Item 2', type: 'group', items: [] },
14
+ ];
15
+ const mockMixedTypeItems = Array.from({ length: 16 }, (_, i) => ({
16
+ id: `mixed-${i}`,
17
+ title: `Item ${i}`,
18
+ type: i % 2 === 0 ? 'operation' : 'schema',
19
+ items: [],
20
+ }));
21
+ const mockOperationItems = Array.from({ length: 16 }, (_, i) => ({
22
+ id: `op-${i}`,
23
+ title: `Operation ${i}`,
24
+ type: 'operation',
25
+ items: [],
26
+ }));
27
+ describe('Items', () => {
28
+ const renderWithRouter = (component) => {
29
+ return render(_jsx(TestMemoryRouter, { children: component }));
30
+ };
31
+ it('renders null when items array is empty', () => {
32
+ const { container } = renderWithRouter(_jsx(Items, { items: [], routingBasePath: "/docs" }));
33
+ expect(container.firstChild).toBeNull();
34
+ });
35
+ it('renders regular list for less than 10 items', () => {
36
+ renderWithRouter(_jsx(Items, { items: mockItems, routingBasePath: "/docs" }));
37
+ expect(screen.getByTestId('content-item-1')).toBeInTheDocument();
38
+ expect(screen.getByTestId('content-item-2')).toBeInTheDocument();
39
+ expect(screen.queryByTestId('virtual-list')).not.toBeInTheDocument();
40
+ });
41
+ it('renders VirtualList for more than 15 operation items', () => {
42
+ renderWithRouter(_jsx(Items, { items: mockOperationItems, routingBasePath: "/docs" }));
43
+ expect(screen.getByTestId('virtual-list')).toBeInTheDocument();
44
+ expect(screen.queryByTestId('content-item-1')).not.toBeInTheDocument();
45
+ });
46
+ it('renders VirtualList for more than 15 mixed operation and schema items', () => {
47
+ renderWithRouter(_jsx(Items, { items: mockMixedTypeItems, routingBasePath: "/docs" }));
48
+ expect(screen.getByTestId('virtual-list')).toBeInTheDocument();
49
+ expect(screen.queryByTestId('content-item-mixed-0')).not.toBeInTheDocument();
50
+ });
51
+ it('renders nested items correctly', () => {
52
+ const nestedItems = [
53
+ {
54
+ id: '1',
55
+ title: 'Parent',
56
+ type: 'group',
57
+ items: [{ id: '1-1', title: 'Child', type: 'group', items: [] }],
58
+ },
59
+ ];
60
+ renderWithRouter(_jsx(Items, { items: nestedItems, routingBasePath: "/docs" }));
61
+ expect(screen.getByTestId('content-item-1')).toBeInTheDocument();
62
+ expect(screen.getByText('Parent')).toBeInTheDocument();
63
+ expect(screen.getByText('Child')).toBeInTheDocument();
64
+ });
65
+ });
66
+ //# sourceMappingURL=Items.test.js.map
@@ -0,0 +1,135 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, screen } from '@testing-library/react';
3
+ import { Routes, Route } from 'react-router';
4
+ import { act } from 'react';
5
+ import { VirtualList } from '../VirtualList.js';
6
+ import { TestMemoryRouter } from '../../../testProviders.js';
7
+ const mockItems = [
8
+ { href: '/item1', title: 'Item 1' },
9
+ { href: '/item2', title: 'Item 2' },
10
+ { href: '/item3', title: 'Item 3' },
11
+ { href: '/item4', title: 'Item 4' },
12
+ { href: '/item5', title: 'Item 5' },
13
+ ];
14
+ const renderItem = (item) => (_jsx("div", { "data-testid": item.href.replace('/', ''), children: typeof item.title === 'string'
15
+ ? String(item.title)
16
+ : String(item.name) }, item.href));
17
+ const renderWithRouter = (initialPath, props) => {
18
+ return render(_jsx(TestMemoryRouter, { initialEntries: [initialPath], children: _jsx(Routes, { children: _jsx(Route, { path: "*", element: _jsx(VirtualList, { ...props }) }) }) }));
19
+ };
20
+ describe('VirtualList', () => {
21
+ beforeEach(() => {
22
+ vi.useFakeTimers();
23
+ });
24
+ afterEach(() => {
25
+ vi.clearAllTimers();
26
+ vi.useRealTimers();
27
+ });
28
+ it('should render empty list when no items provided', () => {
29
+ renderWithRouter('/', {
30
+ items: [],
31
+ renderItem,
32
+ routingBasePath: '/',
33
+ });
34
+ expect(screen.queryByTestId(/item/)).not.toBeInTheDocument();
35
+ });
36
+ it('should initially render first three items when no active item', () => {
37
+ renderWithRouter('/non-existing', {
38
+ items: mockItems,
39
+ renderItem,
40
+ routingBasePath: '/',
41
+ });
42
+ expect(screen.getByTestId('item1')).toBeInTheDocument();
43
+ expect(screen.getByTestId('item2')).toBeInTheDocument();
44
+ expect(screen.getByTestId('item3')).toBeInTheDocument();
45
+ expect(screen.queryByTestId('item4')).not.toBeInTheDocument();
46
+ expect(screen.queryByTestId('item5')).not.toBeInTheDocument();
47
+ });
48
+ it('should render items around active item', () => {
49
+ renderWithRouter('/item3', {
50
+ items: mockItems,
51
+ renderItem,
52
+ routingBasePath: '/',
53
+ });
54
+ expect(screen.getByTestId('item2')).toBeInTheDocument();
55
+ expect(screen.getByTestId('item3')).toBeInTheDocument();
56
+ expect(screen.getByTestId('item4')).toBeInTheDocument();
57
+ });
58
+ it('should handle first item selection', () => {
59
+ renderWithRouter('/item1', {
60
+ items: mockItems,
61
+ renderItem,
62
+ routingBasePath: '/',
63
+ });
64
+ expect(screen.getByTestId('item1')).toBeInTheDocument();
65
+ expect(screen.getByTestId('item2')).toBeInTheDocument();
66
+ expect(screen.queryByTestId('item3')).toBeInTheDocument();
67
+ });
68
+ it('should handle last item selection', () => {
69
+ renderWithRouter('/item5', {
70
+ items: mockItems,
71
+ renderItem,
72
+ routingBasePath: '/',
73
+ });
74
+ expect(screen.queryByTestId('item1')).not.toBeInTheDocument();
75
+ expect(screen.queryByTestId('item2')).not.toBeInTheDocument();
76
+ expect(screen.queryByTestId('item3')).not.toBeInTheDocument();
77
+ expect(screen.getByTestId('item4')).toBeInTheDocument();
78
+ expect(screen.getByTestId('item5')).toBeInTheDocument();
79
+ });
80
+ it('should eventually render all items after timeout', () => {
81
+ renderWithRouter('/item3', {
82
+ items: mockItems,
83
+ renderItem,
84
+ routingBasePath: '/',
85
+ });
86
+ expect(screen.getByTestId('item2')).toBeInTheDocument();
87
+ expect(screen.getByTestId('item3')).toBeInTheDocument();
88
+ expect(screen.getByTestId('item4')).toBeInTheDocument();
89
+ act(() => {
90
+ vi.advanceTimersByTime(1000);
91
+ });
92
+ expect(screen.getByTestId('item1')).toBeInTheDocument();
93
+ expect(screen.getByTestId('item2')).toBeInTheDocument();
94
+ expect(screen.getByTestId('item3')).toBeInTheDocument();
95
+ expect(screen.getByTestId('item4')).toBeInTheDocument();
96
+ expect(screen.getByTestId('item5')).toBeInTheDocument();
97
+ });
98
+ it('should handle custom routing base path', () => {
99
+ renderWithRouter('/docs/item1', {
100
+ items: mockItems,
101
+ renderItem,
102
+ routingBasePath: '/docs',
103
+ });
104
+ expect(screen.getByTestId('item1')).toBeInTheDocument();
105
+ expect(screen.getByTestId('item2')).toBeInTheDocument();
106
+ expect(screen.queryByTestId('item3')).toBeInTheDocument();
107
+ });
108
+ it('should not re-render if all items are already visible', () => {
109
+ const { rerender } = renderWithRouter('/item1', {
110
+ items: mockItems,
111
+ renderItem,
112
+ routingBasePath: '/',
113
+ });
114
+ act(() => {
115
+ vi.advanceTimersByTime(1000);
116
+ });
117
+ const initialRenderCount = screen.getAllByTestId(/item/).length;
118
+ rerender(_jsx(TestMemoryRouter, { initialEntries: ['/item3'], children: _jsx(Routes, { children: _jsx(Route, { path: "*", element: _jsx(VirtualList, { items: mockItems, renderItem: renderItem, routingBasePath: "/" }) }) }) }));
119
+ expect(screen.getAllByTestId(/item/).length).toBe(initialRenderCount);
120
+ });
121
+ it('should cleanup on unmount', () => {
122
+ const { unmount } = renderWithRouter('/item1', {
123
+ items: mockItems,
124
+ renderItem,
125
+ routingBasePath: '/',
126
+ });
127
+ unmount();
128
+ expect(() => {
129
+ act(() => {
130
+ vi.runAllTimers();
131
+ });
132
+ }).not.toThrow();
133
+ });
134
+ });
135
+ //# sourceMappingURL=VirtualList.test.js.map
@@ -1 +1 @@
1
- import{useEffect as l,useRef as i}from"react";import{useLocation as s}from"react-router-dom";import{removeLeadingSlash as n}from"@redocly/theme/core/openapi";import{getElementById as a}from"../Content/useAutoScroll.js";function m(r,c){const e=i(null),o=s(),f=n(o.pathname.replace(c,""));return l(()=>{if(e.current&&r.href&&n(r.href)===f&&(typeof e?.current?.scrollIntoView=="function"&&e.current.scrollIntoView(),o.hash)){const t=a(o.hash.replace("#","").toLowerCase());t&&t.scrollIntoView()}},[]),e}var w=m;export{w as default};
1
+ import{useEffect as l,useRef as i}from"react";import{useLocation as s}from"react-router";import{removeLeadingSlash as n}from"@redocly/theme/core/openapi";import{getElementById as a}from"../Content/useAutoScroll.js";function m(r,c){const e=i(null),o=s(),f=n(o.pathname.replace(c,""));return l(()=>{if(e.current&&r.href&&n(r.href)===f&&(typeof e?.current?.scrollIntoView=="function"&&e.current.scrollIntoView(),o.hash)){const t=a(o.hash.replace("#","").toLowerCase());t&&t.scrollIntoView()}},[]),e}var w=m;export{w as default};
@@ -0,0 +1,63 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render } from '@testing-library/react';
3
+ import * as Jotai from 'jotai';
4
+ import { normalizeOptions, OpenAPIParser } from '../../../services/index.js';
5
+ import { getSchema } from '../../../models/index.js';
6
+ import { Schema } from '../../Schema/index.js';
7
+ import * as simpleDiscriminatorFixture from './fixtures/simple-discriminator.json';
8
+ import * as discriminatorWithDefaultFixture from '../../../models/__tests__/fixtures/discriminator-with-default-mapping.json';
9
+ import { TestBrowserRouter } from '../../../testProviders.js';
10
+ const options = normalizeOptions({});
11
+ vi.mock('jotai', async () => ({
12
+ ...(await vi.importActual('jotai')),
13
+ useAtomValue: vi.fn(),
14
+ }));
15
+ describe('DiscriminatorDropdown', () => {
16
+ vi.spyOn(Jotai, 'useAtomValue').mockReturnValue(options);
17
+ const parser = new OpenAPIParser(simpleDiscriminatorFixture, undefined, options);
18
+ const schema = getSchema({
19
+ parser,
20
+ schemaOrRef: { $ref: '#/components/schemas/Pet' },
21
+ pointer: '#/components/schemas/Pet',
22
+ options,
23
+ deps: { operation: { pointer: 'defaultPointer' } },
24
+ });
25
+ describe('discriminator', () => {
26
+ vi.spyOn(Jotai, 'useAtomValue').mockReturnValue({
27
+ activeOneOf: {
28
+ '#/components/schemas/Pet': 0,
29
+ },
30
+ });
31
+ it('should correctly render SchemaView', () => {
32
+ const { getByText } = render(_jsx(Schema, { schema: schema }), {
33
+ wrapper: TestBrowserRouter,
34
+ });
35
+ expect(getByText('type')).toBeInTheDocument();
36
+ expect(getByText('C̵a̵t̵ (deprecated)')).toBeInTheDocument();
37
+ });
38
+ });
39
+ describe('discriminator with defaultMapping', () => {
40
+ const parserWithDefault = new OpenAPIParser(discriminatorWithDefaultFixture, undefined, options);
41
+ const schemaWithDefault = getSchema({
42
+ parser: parserWithDefault,
43
+ schemaOrRef: { $ref: '#/components/schemas/Pet' },
44
+ pointer: '#/components/schemas/Pet',
45
+ options,
46
+ deps: { operation: { pointer: 'defaultPointer' } },
47
+ });
48
+ it('schema has correct oneOf structure with defaultMapping', () => {
49
+ expect(schemaWithDefault.oneOf).toHaveLength(3);
50
+ expect(schemaWithDefault.oneOf?.[0].title).toBe('cat');
51
+ expect(schemaWithDefault.oneOf?.[0].isDefaultMapping).toBe(false);
52
+ expect(schemaWithDefault.oneOf?.[1].title).toBe('dog');
53
+ expect(schemaWithDefault.oneOf?.[1].isDefaultMapping).toBe(false);
54
+ expect(schemaWithDefault.oneOf?.[2].title).toBe('Default mapping');
55
+ expect(schemaWithDefault.oneOf?.[2].isDefaultMapping).toBe(true);
56
+ });
57
+ it('finds correct defaultMappingIdx', () => {
58
+ const defaultMappingIdx = schemaWithDefault.oneOf?.findIndex((subSchema) => subSchema.isDefaultMapping);
59
+ expect(defaultMappingIdx).toBe(2);
60
+ });
61
+ });
62
+ });
63
+ //# sourceMappingURL=DiscriminatorDropdown.test.js.map