@redocly/openapi-docs 3.12.0-rc.7 → 3.12.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 (390) hide show
  1. package/dist/redocly-openapi-docs.min.js +2153 -1963
  2. package/lib/components/ApiInfo/ApiInfo.js +29 -1
  3. package/lib/components/ApiInfo/Metadata.js +29 -1
  4. package/lib/components/ApiInfo/index.js +2 -1
  5. package/lib/components/ApiInfo/styled.js +17 -8
  6. package/lib/components/CallbackSamples/CallbackSamples.js +25 -4
  7. package/lib/components/CallbackSamples/index.js +2 -1
  8. package/lib/components/Callbacks/CallbackDetails.js +17 -3
  9. package/lib/components/Callbacks/CallbackOperation.js +24 -3
  10. package/lib/components/Callbacks/CallbackSummary.js +19 -3
  11. package/lib/components/Callbacks/CallbacksList.js +16 -1
  12. package/lib/components/Callbacks/index.js +4 -1
  13. package/lib/components/Callbacks/styled.js +6 -3
  14. package/lib/components/Content/Content.js +10 -1
  15. package/lib/components/Content/index.js +2 -1
  16. package/lib/components/Content/useAutoScroll.js +50 -1
  17. package/lib/components/ContentItem/ContentItem.js +31 -1
  18. package/lib/components/ContentItem/index.js +2 -1
  19. package/lib/components/ContentItem/useIsExpanded.js +33 -1
  20. package/lib/components/ContentItems/ContentItems.js +19 -1
  21. package/lib/components/ContentItems/Items.js +13 -1
  22. package/lib/components/ContentItems/VirtualList.js +35 -1
  23. package/lib/components/ContentItems/helpers.js +49 -1
  24. package/lib/components/ContentItems/index.js +2 -1
  25. package/lib/components/ContentItems/useScrollOnRender.js +26 -1
  26. package/lib/components/Discriminator/Discriminator.js +27 -2
  27. package/lib/components/Discriminator/index.js +2 -1
  28. package/lib/components/Download/DownloadSpecification.js +46 -4
  29. package/lib/components/Download/index.js +2 -1
  30. package/lib/components/Download/types.js +2 -0
  31. package/lib/components/Download/useDownloadInfo.js +42 -1
  32. package/lib/components/ErrorBoundary/ErrorBoundary.js +22 -2
  33. package/lib/components/ErrorBoundary/index.js +2 -1
  34. package/lib/components/ExpandAllButton/ExpandAllButton.js +31 -2
  35. package/lib/components/ExpandAllButton/index.js +2 -1
  36. package/lib/components/ExternalDocumentation/ExternalDocumentation.js +18 -4
  37. package/lib/components/ExternalDocumentation/index.js +2 -1
  38. package/lib/components/Language/LanguageDropdown.js +21 -1
  39. package/lib/components/Language/LanguageItem.js +33 -1
  40. package/lib/components/Language/LanguageList.js +93 -1
  41. package/lib/components/Language/_tests_/LanguageDropdown.test.js +23 -1
  42. package/lib/components/Language/constants.js +3 -1
  43. package/lib/components/Language/index.js +4 -1
  44. package/lib/components/Language/styled.js +29 -15
  45. package/lib/components/Markdown/Markdown.js +64 -1
  46. package/lib/components/Markdown/index.js +3 -1
  47. package/lib/components/Markdown/types.js +2 -0
  48. package/lib/components/MediaTypeSwitch/MediaTypesSwitch.js +51 -1
  49. package/lib/components/MediaTypeSwitch/index.js +2 -1
  50. package/lib/components/OperationItem/Description.d.ts +1 -4
  51. package/lib/components/OperationItem/Description.js +9 -1
  52. package/lib/components/OperationItem/OperationItem.js +70 -5
  53. package/lib/components/OperationItem/_tests_/OperationItem.test.js +70 -1
  54. package/lib/components/OperationItem/_tests_/__mocks__/mock-intersection-observer.js +40 -1
  55. package/lib/components/OperationItem/index.js +2 -1
  56. package/lib/components/OperationItem/types.js +2 -0
  57. package/lib/components/Overlay.js +48 -3
  58. package/lib/components/Overview/Overview.js +20 -1
  59. package/lib/components/Overview/index.js +2 -1
  60. package/lib/components/PageFooter/PageFooter.js +19 -1
  61. package/lib/components/PageFooter/index.js +2 -1
  62. package/lib/components/Panel/ResponsePanel.js +12 -6
  63. package/lib/components/Panel/Trigger.js +4 -2
  64. package/lib/components/Panel/index.js +3 -1
  65. package/lib/components/PanelItem/PanelItem.js +6 -1
  66. package/lib/components/PanelItem/index.js +3 -1
  67. package/lib/components/PanelItem/styled.js +20 -10
  68. package/lib/components/PayloadSamples/Example.js +6 -1
  69. package/lib/components/PayloadSamples/ExampleValue.js +30 -1
  70. package/lib/components/PayloadSamples/MediaTypeSamples.js +36 -2
  71. package/lib/components/PayloadSamples/PayloadSamples.js +26 -1
  72. package/lib/components/PayloadSamples/index.js +7 -1
  73. package/lib/components/PayloadSamples/styled.js +9 -4
  74. package/lib/components/PayloadSamples/types.js +2 -0
  75. package/lib/components/PropertyDetails/DescriptionEnums.js +19 -3
  76. package/lib/components/PropertyDetails/EnumValues.js +37 -1
  77. package/lib/components/PropertyDetails/Examples.js +26 -1
  78. package/lib/components/PropertyDetails/Extensions.js +17 -2
  79. package/lib/components/PropertyDetails/FieldDetail.js +15 -2
  80. package/lib/components/PropertyDetails/FieldDetails.js +51 -6
  81. package/lib/components/PropertyDetails/Pattern.js +21 -1
  82. package/lib/components/PropertyDetails/PlusCircleIcon.js +10 -4
  83. package/lib/components/PropertyDetails/PropertyDetails.js +22 -5
  84. package/lib/components/PropertyDetails/SchemaTypeInfo.js +10 -2
  85. package/lib/components/PropertyDetails/SimpleEnums.js +13 -2
  86. package/lib/components/PropertyDetails/cycleColorsByLevel.js +18 -1
  87. package/lib/components/PropertyDetails/index.js +4 -1
  88. package/lib/components/PropertyDetails/styled.js +15 -7
  89. package/lib/components/PropertyDetails/types.js +2 -0
  90. package/lib/components/RedoclyOpenAPIDocs/Providers.js +114 -1
  91. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +57 -1
  92. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js +86 -1
  93. package/lib/components/RedoclyOpenAPIDocs/index.js +5 -1
  94. package/lib/components/RedoclyOpenAPIDocs/styled.js +4 -2
  95. package/lib/components/RedoclyOpenAPIDocs/types.js +2 -0
  96. package/lib/components/RedoclyOpenAPIDocs/utils.js +33 -1
  97. package/lib/components/RenderHook/RenderHook.js +17 -1
  98. package/lib/components/RenderHook/index.js +2 -1
  99. package/lib/components/Replay/EmbeddedReplay.js +41 -3
  100. package/lib/components/Replay/Replay.js +99 -1
  101. package/lib/components/Replay/index.js +3 -1
  102. package/lib/components/Replay/utils.js +208 -1
  103. package/lib/components/Request/RequestDetails.js +33 -2
  104. package/lib/components/Request/types.js +2 -0
  105. package/lib/components/RequestParameters/Body.js +8 -1
  106. package/lib/components/RequestParameters/ParametersGroup.js +19 -4
  107. package/lib/components/RequestParameters/RequestParameters.js +40 -1
  108. package/lib/components/RequestParameters/index.js +4 -1
  109. package/lib/components/RequestSamples/CodeSample.js +55 -2
  110. package/lib/components/RequestSamples/Example.js +37 -1
  111. package/lib/components/RequestSamples/RequestSamples.js +89 -5
  112. package/lib/components/RequestSamples/index.js +3 -1
  113. package/lib/components/RequestSamples/useCodeSamples.js +92 -1
  114. package/lib/components/ResponseSamples/ResponseSamples.js +47 -1
  115. package/lib/components/ResponseSamples/Summary.js +9 -1
  116. package/lib/components/ResponseSamples/index.js +2 -1
  117. package/lib/components/Responses/OperationResponseList.js +42 -2
  118. package/lib/components/Responses/ResponseDetails.js +18 -1
  119. package/lib/components/Responses/ResponseHeaders.js +15 -1
  120. package/lib/components/Responses/index.js +6 -1
  121. package/lib/components/Responses/styled.js +14 -6
  122. package/lib/components/Responses/types.js +2 -0
  123. package/lib/components/RightPanel/RightPanel.js +21 -1
  124. package/lib/components/RightPanel/index.js +2 -1
  125. package/lib/components/Samples/ExampleSwitch.js +33 -1
  126. package/lib/components/Samples/index.js +3 -1
  127. package/lib/components/Samples/use-example-key.js +12 -1
  128. package/lib/components/Schema/ArraySchema.js +45 -1
  129. package/lib/components/Schema/ObjectSchema.js +29 -1
  130. package/lib/components/Schema/OneOfSchema.js +47 -3
  131. package/lib/components/Schema/RecursiveSchema.js +10 -1
  132. package/lib/components/Schema/Schema.js +63 -2
  133. package/lib/components/Schema/SubSchema.js +20 -1
  134. package/lib/components/Schema/helpers.js +16 -1
  135. package/lib/components/Schema/index.js +5 -1
  136. package/lib/components/Schema/types.js +2 -0
  137. package/lib/components/Schema/useOneOfLocationIdx.js +11 -1
  138. package/lib/components/SchemaDefinition/SchemaDefinition.js +65 -2
  139. package/lib/components/SchemaDefinition/index.js +2 -1
  140. package/lib/components/SectionContent/SectionContent.js +49 -6
  141. package/lib/components/SectionContent/index.js +2 -1
  142. package/lib/components/SectionItem/SectionItem.js +14 -1
  143. package/lib/components/SectionItem/index.js +2 -1
  144. package/lib/components/Security/Divider.js +9 -2
  145. package/lib/components/Security/OAuthFlow.js +11 -1
  146. package/lib/components/Security/OAuthScopes.js +59 -9
  147. package/lib/components/Security/Security.js +15 -1
  148. package/lib/components/Security/SecurityButton.js +31 -7
  149. package/lib/components/Security/SecurityFlow.js +28 -4
  150. package/lib/components/Security/SecurityModal.js +34 -5
  151. package/lib/components/Security/SecuritySchemeItem.js +15 -4
  152. package/lib/components/Security/helper.js +16 -1
  153. package/lib/components/Security/index.js +11 -1
  154. package/lib/components/Security/styled.js +6 -3
  155. package/lib/components/SelectOrLabel/SelectOrLabel.js +12 -2
  156. package/lib/components/SelectOrLabel/index.js +2 -1
  157. package/lib/components/ServerList/ServerList.js +36 -10
  158. package/lib/components/ServerList/index.js +2 -1
  159. package/lib/components/ServerList/types.js +2 -0
  160. package/lib/components/ServerListDropdown/ServerListDropdown.js +54 -1
  161. package/lib/components/ServerListDropdown/index.js +2 -1
  162. package/lib/components/ServerListDropdown/styled.js +15 -6
  163. package/lib/components/SideMenu/SideMenu.js +13 -2
  164. package/lib/components/SideMenu/hooks/useMenuItems.js +110 -1
  165. package/lib/components/SideMenu/index.js +2 -1
  166. package/lib/components/SideMenu/types.js +2 -0
  167. package/lib/components/StickySidebar/SidebarActions.js +14 -2
  168. package/lib/components/StickySidebar/StickyResponsiveSidebar.js +37 -7
  169. package/lib/components/StickySidebar/index.js +2 -1
  170. package/lib/components/Tabs/Tabs.js +16 -5
  171. package/lib/components/Tabs/index.js +3 -1
  172. package/lib/components/Tabs/useTabsState.js +22 -1
  173. package/lib/components/TagItem/OperationNavigationItems.js +18 -4
  174. package/lib/components/TagItem/OperationsNavigation.js +46 -2
  175. package/lib/components/TagItem/TagItem.js +41 -8
  176. package/lib/components/TagItem/index.js +2 -1
  177. package/lib/components/TagItem/styled.js +5 -2
  178. package/lib/components/TagItem/types.js +2 -0
  179. package/lib/components/ViewNested/ViewNested.js +42 -9
  180. package/lib/components/ViewNested/index.js +2 -1
  181. package/lib/components/common/Badges.js +21 -5
  182. package/lib/components/common/BodyContent/BodyContent.js +31 -4
  183. package/lib/components/common/BodyContent/index.js +2 -1
  184. package/lib/components/common/ClearButton/ClearButton.js +5 -1
  185. package/lib/components/common/ClearButton/index.js +3 -1
  186. package/lib/components/common/ClearButton/styled.js +5 -2
  187. package/lib/components/common/ClearButton/types.js +2 -0
  188. package/lib/components/common/CodeBlockPanel.js +7 -3
  189. package/lib/components/common/ConstraintsView.js +14 -2
  190. package/lib/components/common/Dropdown/Dropdown.js +22 -4
  191. package/lib/components/common/Dropdown/index.js +2 -1
  192. package/lib/components/common/ExpandableExample/ExpandableExample.js +24 -3
  193. package/lib/components/common/ExpandableExample/index.js +2 -1
  194. package/lib/components/common/Extensions.js +17 -2
  195. package/lib/components/common/Fields/fields-layout.js +76 -51
  196. package/lib/components/common/Fields/fields.js +39 -17
  197. package/lib/components/common/Fields/index.js +3 -1
  198. package/lib/components/common/LinkToField.js +33 -6
  199. package/lib/components/common/OperationItemTitle.d.ts +1 -0
  200. package/lib/components/common/OperationItemTitle.js +16 -5
  201. package/lib/components/common/SchemaSelection/SchemaSelection.js +51 -1
  202. package/lib/components/common/SchemaSelection/index.js +2 -1
  203. package/lib/components/common/Select/Select.js +21 -1
  204. package/lib/components/common/Select/index.js +3 -1
  205. package/lib/components/common/Select/styled.js +17 -9
  206. package/lib/components/common/Select/types.js +2 -0
  207. package/lib/components/common/Skeleton/LanguageListSkeleton.js +16 -6
  208. package/lib/components/common/Skeleton/Skeleton.js +15 -5
  209. package/lib/components/common/Skeleton/index.js +3 -1
  210. package/lib/components/common/headers.js +4 -2
  211. package/lib/components/common/index.js +14 -1
  212. package/lib/components/common/linkify.js +28 -4
  213. package/lib/components/common/mixins.js +4 -2
  214. package/lib/components/common/panels.js +58 -33
  215. package/lib/components/common/schema.js +16 -8
  216. package/lib/components/common/styled.js +15 -7
  217. package/lib/components/index.js +25 -1
  218. package/lib/components/pluggable/RedocExample.js +20 -1
  219. package/lib/components/pluggable/RedocSchema.js +22 -1
  220. package/lib/components/pluggable/index.js +3 -1
  221. package/lib/components/pluggable/styled.components.js +9 -4
  222. package/lib/constants.js +30 -1
  223. package/lib/empty.js +7 -1
  224. package/lib/events/codeSampleCopy.js +19 -1
  225. package/lib/events/creator.js +5 -1
  226. package/lib/events/index.js +8 -1
  227. package/lib/events/languageSwitch.js +18 -1
  228. package/lib/events/panelToggle.js +16 -1
  229. package/lib/events/serverSwitch.js +13 -1
  230. package/lib/events/tryItOpen.js +12 -1
  231. package/lib/events/tryItSent.js +12 -1
  232. package/lib/events/types.js +11 -1
  233. package/lib/hoc/types.js +2 -0
  234. package/lib/hoc/utils.js +4 -1
  235. package/lib/hoc/withRouter.js +17 -1
  236. package/lib/hoc/withStore.js +28 -1
  237. package/lib/hooks/index.js +9 -1
  238. package/lib/hooks/useActivateExample.js +35 -1
  239. package/lib/hooks/useActiveWithFallback.js +12 -1
  240. package/lib/hooks/useContentItems.js +10 -1
  241. package/lib/hooks/useLicense.js +17 -1
  242. package/lib/hooks/usePerformanceMetrics.js +26 -1
  243. package/lib/hooks/useRouter.js +17 -1
  244. package/lib/hooks/useTelemetry.js +5 -1
  245. package/lib/hooks/useTranslate.js +6 -1
  246. package/lib/hooks/useUppercase2LowercaseRedirect.js +12 -1
  247. package/lib/icons/CSharpIcon/CSharpIcon.js +7 -1
  248. package/lib/icons/CSharpIcon/index.js +2 -1
  249. package/lib/icons/CurlIcon/CurlIcon.js +8 -2
  250. package/lib/icons/CurlIcon/index.js +2 -1
  251. package/lib/icons/GOIcon/GOIcon.js +7 -1
  252. package/lib/icons/GOIcon/index.js +2 -1
  253. package/lib/icons/JavaIcon/JavaIcon.js +7 -1
  254. package/lib/icons/JavaIcon/index.js +2 -1
  255. package/lib/icons/JavaScriptIcon/JavaScriptIcon.js +7 -1
  256. package/lib/icons/JavaScriptIcon/index.js +2 -1
  257. package/lib/icons/NodeJSIcon/NodeJSIcon.js +7 -1
  258. package/lib/icons/NodeJSIcon/index.js +2 -1
  259. package/lib/icons/PHPIcon/PHPIcon.js +7 -1
  260. package/lib/icons/PHPIcon/index.js +2 -1
  261. package/lib/icons/PayloadIcon/PayloadIcon.js +7 -1
  262. package/lib/icons/PayloadIcon/index.js +2 -1
  263. package/lib/icons/PythonIcon/PythonIcon.js +7 -1
  264. package/lib/icons/PythonIcon/index.js +2 -1
  265. package/lib/icons/RIcon/RIcon.js +7 -1
  266. package/lib/icons/RIcon/index.js +2 -1
  267. package/lib/icons/RubyIcon/RubyIcon.js +7 -1
  268. package/lib/icons/RubyIcon/index.js +2 -1
  269. package/lib/index.js +49 -1
  270. package/lib/jotai/app.js +113 -1
  271. package/lib/jotai/operation.js +28 -1
  272. package/lib/jotai/replay.js +5 -1
  273. package/lib/jotai/store.js +8 -1
  274. package/lib/jotai/use-write-atom.js +9 -1
  275. package/lib/models/callback.js +28 -1
  276. package/lib/models/code-sample-options.js +2 -0
  277. package/lib/models/example.js +17 -1
  278. package/lib/models/field.js +109 -1
  279. package/lib/models/group.js +38 -1
  280. package/lib/models/index.js +14 -1
  281. package/lib/models/mediaContent.js +26 -1
  282. package/lib/models/mediaType.js +153 -1
  283. package/lib/models/operation.js +166 -1
  284. package/lib/models/request.js +25 -1
  285. package/lib/models/response.js +46 -1
  286. package/lib/models/schema.js +474 -2
  287. package/lib/models/security.js +84 -1
  288. package/lib/models/tab.js +2 -0
  289. package/lib/models/types.js +2 -0
  290. package/lib/services/OpenAPIParser.js +321 -1
  291. package/lib/services/check.js +104 -1
  292. package/lib/services/code-samples/constants.js +16 -1
  293. package/lib/services/code-samples/generator.js +540 -1
  294. package/lib/services/code-samples/httpsnippet/helpers/code-builder.d.ts +5 -1
  295. package/lib/services/code-samples/httpsnippet/helpers/code-builder.js +252 -3
  296. package/lib/services/code-samples/httpsnippet/helpers/code-helpers.d.ts +2 -2
  297. package/lib/services/code-samples/httpsnippet/helpers/code-helpers.js +90 -2
  298. package/lib/services/code-samples/httpsnippet/helpers/constants.js +28 -1
  299. package/lib/services/code-samples/httpsnippet/helpers/lodash-int.js +173 -1
  300. package/lib/services/code-samples/httpsnippet/helpers/mocks/code-helpers-mock.js +76 -37
  301. package/lib/services/code-samples/httpsnippet/helpers/reducer.js +16 -1
  302. package/lib/services/code-samples/httpsnippet/helpers/shell.js +20 -1
  303. package/lib/services/code-samples/httpsnippet/helpers/string-utility.js +19 -1
  304. package/lib/services/code-samples/httpsnippet/index.js +166 -1
  305. package/lib/services/code-samples/httpsnippet/targets/__mocks__/mock.js +2340 -146
  306. package/lib/services/code-samples/httpsnippet/targets/csharp/httpclient.js +227 -2
  307. package/lib/services/code-samples/httpsnippet/targets/csharp/index.js +11 -1
  308. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/httpclient.js +185 -2
  309. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/index.js +11 -1
  310. package/lib/services/code-samples/httpsnippet/targets/go/index.js +11 -1
  311. package/lib/services/code-samples/httpsnippet/targets/go/native.js +222 -3
  312. package/lib/services/code-samples/httpsnippet/targets/index.js +28 -1
  313. package/lib/services/code-samples/httpsnippet/targets/java/httpclient.js +184 -3
  314. package/lib/services/code-samples/httpsnippet/targets/java/index.js +11 -1
  315. package/lib/services/code-samples/httpsnippet/targets/java8/apachehttp.js +223 -2
  316. package/lib/services/code-samples/httpsnippet/targets/java8/index.js +11 -1
  317. package/lib/services/code-samples/httpsnippet/targets/javascript/fetch.js +147 -1
  318. package/lib/services/code-samples/httpsnippet/targets/javascript/index.js +11 -1
  319. package/lib/services/code-samples/httpsnippet/targets/node/fetch.js +199 -1
  320. package/lib/services/code-samples/httpsnippet/targets/node/index.js +11 -1
  321. package/lib/services/code-samples/httpsnippet/targets/php/curl.js +203 -5
  322. package/lib/services/code-samples/httpsnippet/targets/php/index.js +11 -1
  323. package/lib/services/code-samples/httpsnippet/targets/php/types.js +2 -0
  324. package/lib/services/code-samples/httpsnippet/targets/php/utils.js +106 -5
  325. package/lib/services/code-samples/httpsnippet/targets/python/index.js +11 -1
  326. package/lib/services/code-samples/httpsnippet/targets/python/requests.js +185 -6
  327. package/lib/services/code-samples/httpsnippet/targets/r/httr.js +111 -1
  328. package/lib/services/code-samples/httpsnippet/targets/r/index.js +11 -1
  329. package/lib/services/code-samples/httpsnippet/targets/r/utils.js +18 -6
  330. package/lib/services/code-samples/httpsnippet/targets/ruby/index.js +11 -1
  331. package/lib/services/code-samples/httpsnippet/targets/ruby/native.js +169 -1
  332. package/lib/services/code-samples/httpsnippet/targets/shell/curl.js +94 -6
  333. package/lib/services/code-samples/httpsnippet/targets/shell/index.js +11 -1
  334. package/lib/services/code-samples/index.js +3 -1
  335. package/lib/services/code-samples/types.js +2 -0
  336. package/lib/services/config-options/helpers.js +49 -1
  337. package/lib/services/config-options/index.js +3 -1
  338. package/lib/services/config-options/normalizeOptions.js +83 -1
  339. package/lib/services/config-options/types.js +2 -0
  340. package/lib/services/history/helpers.js +63 -1
  341. package/lib/services/history/index.js +2 -1
  342. package/lib/services/index.js +9 -1
  343. package/lib/services/menu/builder.js +47 -1
  344. package/lib/services/menu/index.js +2 -1
  345. package/lib/services/menu/markdown.js +93 -1
  346. package/lib/services/menu/operation.js +50 -1
  347. package/lib/services/menu/tags.js +166 -1
  348. package/lib/services/types.d.ts +0 -3
  349. package/lib/services/types.js +2 -0
  350. package/lib/services/utils.js +83 -1
  351. package/lib/standalone.js +68 -1
  352. package/lib/styled-components.js +6 -1
  353. package/lib/types/app.js +2 -0
  354. package/lib/types/index.js +4 -1
  355. package/lib/types/open-api.d.ts +1 -0
  356. package/lib/types/open-api.js +2 -0
  357. package/lib/types/security.js +2 -0
  358. package/lib/utils/JsonPointer.js +84 -1
  359. package/lib/utils/areArraysEqual.js +4 -1
  360. package/lib/utils/argValuesHelpers.js +35 -1
  361. package/lib/utils/compose.js +2 -1
  362. package/lib/utils/configure-helpers.js +223 -1
  363. package/lib/utils/convertSwagger2OpenAPI.js +14 -1
  364. package/lib/utils/cookies.js +73 -1
  365. package/lib/utils/debounce.js +22 -1
  366. package/lib/utils/debug.js +11 -1
  367. package/lib/utils/dom.js +65 -1
  368. package/lib/utils/environments.js +13 -1
  369. package/lib/utils/helpers.js +222 -12
  370. package/lib/utils/index.js +25 -1
  371. package/lib/utils/isMobile.js +13 -1
  372. package/lib/utils/loadAndBundleSpec.js +32 -1
  373. package/lib/utils/local-storage.js +12 -1
  374. package/lib/utils/object.js +31 -1
  375. package/lib/utils/openapi.js +592 -1
  376. package/lib/utils/parameters.js +13 -1
  377. package/lib/utils/path.js +22 -1
  378. package/lib/utils/queryString.js +60 -1
  379. package/lib/utils/replaceVariables.js +14 -1
  380. package/lib/utils/saveTextBeforeHeading.js +35 -1
  381. package/lib/utils/security-details.js +49 -1
  382. package/lib/utils/session-storage.js +12 -1
  383. package/lib/utils/simplifyAstStructure.js +22 -1
  384. package/lib/utils/sort.js +21 -1
  385. package/lib/utils/string.js +65 -1
  386. package/lib/utils/telemetry.js +7 -1
  387. package/lib/utils/test-utils.js +26 -1
  388. package/lib/utils/theme-helpers.js +24 -3
  389. package/lib/utils/url.js +38 -1
  390. package/package.json +5 -5
@@ -1 +1,29 @@
1
- import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useAtomValue as D}from"jotai";import{LayoutVariant as h}from"@redocly/config";import{AfterOpenApiTitle as k}from"@redocly/theme/components/OpenApiDocs/hooks/AfterOpenApiTitle";import{AfterOpenApiDescription as H}from"@redocly/theme/components/OpenApiDocs/hooks/AfterOpenApiDescription";import{SamplesMiddlePanel as M,Row as S}from"../common/index.js";import{ExternalDocumentation as T}from"../ExternalDocumentation/index.js";import{Markdown as m}from"../Markdown/index.js";import{ApiHeader as j}from"./styled.js";import{globalStoreAtom as v}from"../../jotai/store.js";import{saveTextBeforeHeading as y}from"../../utils/saveTextBeforeHeading.js";import{getValueFromMdParsedExtension as p}from"../../utils/helpers.js";import{RenderHook as l}from"../RenderHook/index.js";import{Metadata as g}from"./Metadata.js";import{useTranslate as E}from"../../hooks/index.js";function q({item:f,layout:t}){const c=E(),{options:{unstable_hooks:i,hideInfoMetadata:d},parser:{definition:u}}=D(v),o=f.infoDefinition;if(!o)return null;const n=y(p(o,"description")||""),a=p(o,"summary")||void 0,s=u?.externalDocs||o?.externalDocs,x=o.version&&e("span",{children:["(",o.version,")"]})||null,A=t===h.STACKED;return r(S,{layout:t,children:e(M,{fullWidth:!0,className:"api-info",isStacked:A,children:[e(j,{children:[o.title," ",x]}),r(l,{Hook:k||i?.AfterApiTitle,props:{info:o}}),a&&r(m,{source:a,"data-role":"redoc-summary"}),n&&r(m,{source:n,"data-role":"redoc-description"}),r(l,{Hook:H||i?.AfterOpenApiDescription,props:{info:o}}),s&&r(T,{externalDocs:s}),!d&&r(g,{metadata:o["x-metadata"],translate:c})]})})}export{q as ApiInfo};
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useAtomValue } from 'jotai';
3
+ import { LayoutVariant } from '@redocly/config';
4
+ import { AfterOpenApiTitle } from '@redocly/theme/components/OpenApiDocs/hooks/AfterOpenApiTitle';
5
+ import { PageActions } from '@redocly/theme/components/PageActions/PageActions';
6
+ import { SamplesMiddlePanel, Row } from '../common/index.js';
7
+ import { ExternalDocumentation } from '../ExternalDocumentation/index.js';
8
+ import { Markdown } from '../Markdown/index.js';
9
+ import { ApiHeader } from './styled.js';
10
+ import { globalStoreAtom } from '../../jotai/store.js';
11
+ import { saveTextBeforeHeading } from '../../utils/saveTextBeforeHeading.js';
12
+ import { getValueFromMdParsedExtension } from '../../utils/helpers.js';
13
+ import { RenderHook } from '../RenderHook/index.js';
14
+ import { Metadata } from './Metadata.js';
15
+ import { useTranslate } from '../../hooks/index.js';
16
+ export function ApiInfo({ item, layout, }) {
17
+ const translate = useTranslate();
18
+ const { options: { unstable_hooks, hideInfoMetadata, routingBasePath }, parser: { definition }, } = useAtomValue(globalStoreAtom);
19
+ const info = item.infoDefinition;
20
+ if (!info) {
21
+ return null;
22
+ }
23
+ const description = saveTextBeforeHeading(getValueFromMdParsedExtension(info, 'description') || '');
24
+ const summary = getValueFromMdParsedExtension(info, 'summary') || undefined;
25
+ const externalDocs = definition?.externalDocs || info?.externalDocs;
26
+ const isStacked = layout === LayoutVariant.STACKED;
27
+ return (_jsx(Row, { layout: layout, children: _jsxs(SamplesMiddlePanel, { fullWidth: true, className: "api-info", isStacked: isStacked, children: [_jsxs(ApiHeader, { children: [(info.title || '') + (info.version ? ` (${info.version})` : ''), _jsx(PageActions, { pageSlug: routingBasePath })] }), _jsx(RenderHook, { Hook: AfterOpenApiTitle || unstable_hooks?.AfterApiTitle, props: { info } }), summary && _jsx(Markdown, { source: summary, "data-role": "redoc-summary" }), description && _jsx(Markdown, { source: description, "data-role": "redoc-description" }), externalDocs && _jsx(ExternalDocumentation, { externalDocs: externalDocs }), !hideInfoMetadata && _jsx(Metadata, { metadata: info['x-metadata'], translate: translate })] }) }));
28
+ }
29
+ //# sourceMappingURL=ApiInfo.js.map
@@ -1 +1,29 @@
1
- import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useMemo as c}from"react";import{Markdown as d}from"@redocly/theme/components/Markdown/Markdown";import{H3 as p}from"@redocly/theme/components/Typography/H3";import{isNotNull as a}from"@redocly/theme/core/openapi";import{isAbsoluteUrl as s}from"../../utils/helpers.js";const f=["title","description"];function m([t,r]){return f.includes(t)?null:Array.isArray(r)?{key:t,value:r.filter(o=>typeof o!="object").join(", ")}:typeof r=="object"?null:{key:t,value:r}}function y({metadata:t,translate:r}){const o=c(()=>Object.entries(t||{}).map(m).filter(a),[t]);return t?n(d,{children:[e(p,{children:r("openapi.info.metadata.title","Metadata")}),n("table",{className:"md",children:[e("thead",{children:n("tr",{children:[e("th",{scope:"col",children:r("openapi.key","Key")}),e("th",{scope:"col",children:r("openapi.value","Value")})]})}),e("tbody",{children:o.map(({key:l,value:i})=>n("tr",{children:[e("td",{children:l}),e("td",{children:typeof i=="string"&&s(i)?e("a",{href:i,target:"_blank",rel:"noreferrer",children:i}):String(i)})]},l))})]})]}):null}export{y as Metadata};
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import { Markdown as MarkdownWrapper } from '@redocly/theme/components/Markdown/Markdown';
4
+ import { H3 } from '@redocly/theme/components/Typography/H3';
5
+ import { isNotNull } from '@redocly/theme/core/openapi';
6
+ const FILTER_OUT_KEYS = ['title', 'description']; // We don't want to show these keys
7
+ function metadataMap([key, value]) {
8
+ if (FILTER_OUT_KEYS.includes(key)) {
9
+ return null;
10
+ }
11
+ if (Array.isArray(value)) {
12
+ return { key, value: value.filter((val) => typeof val !== 'object').join(', ') };
13
+ }
14
+ // We don't want to show objects
15
+ if (typeof value === 'object') {
16
+ return null;
17
+ }
18
+ return { key, value };
19
+ }
20
+ export function Metadata({ metadata, translate }) {
21
+ const filteredMetadata = useMemo(() => Object.entries(metadata || {})
22
+ .map(metadataMap)
23
+ .filter(isNotNull), [metadata]);
24
+ if (!metadata) {
25
+ return null;
26
+ }
27
+ return (_jsxs(MarkdownWrapper, { children: [_jsx(H3, { children: translate('openapi.info.metadata.title', 'Metadata') }), _jsxs("table", { className: "md", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: translate('openapi.key', 'Key') }), _jsx("th", { scope: "col", children: translate('openapi.value', 'Value') })] }) }), _jsx("tbody", { children: filteredMetadata.map(({ key, value }) => (_jsxs("tr", { children: [_jsx("td", { children: key }), _jsx("td", { children: `${value}` })] }, key))) })] })] }));
28
+ }
29
+ //# sourceMappingURL=Metadata.js.map
@@ -1 +1,2 @@
1
- import{ApiInfo as p}from"./ApiInfo.js";export{p as ApiInfo};
1
+ export { ApiInfo } from './ApiInfo.js';
2
+ //# sourceMappingURL=index.js.map
@@ -1,26 +1,35 @@
1
- import{H1 as n}from"@redocly/theme/components/Typography/H1";import{Markdown as r}from"@redocly/theme/components/Markdown/Markdown";import{styled as o}from"../../styled-components.js";const t=15,p=o(n)`
1
+ import { H1 } from '@redocly/theme/components/Typography/H1';
2
+ import { Markdown } from '@redocly/theme/components/Markdown/Markdown';
3
+ import { styled } from '../../styled-components.js';
4
+ const delimiterWidth = 15;
5
+ export const ApiHeader = styled(H1) `
6
+ display: flex;
2
7
  margin-top: 0;
3
8
  margin-bottom: 0;
4
- & + ${r} {
9
+ & + ${Markdown} {
5
10
  margin-top: var(--h1-margin-bottom);
6
11
  }
7
- `,d=o.span`
12
+ `;
13
+ export const InfoSpan = styled.span `
8
14
  &::before {
9
15
  content: '|';
10
16
  display: inline-block;
11
17
  opacity: 0.5;
12
- width: ${t}px;
18
+ width: ${delimiterWidth}px;
13
19
  text-align: center;
14
20
  }
15
21
 
16
22
  &:last-child::after {
17
23
  display: none;
18
24
  }
19
- `,l=o.div`
25
+ `;
26
+ export const InfoSpanBoxWrap = styled.div `
20
27
  overflow: hidden;
21
- `,m=o.div`
28
+ `;
29
+ export const InfoSpanBox = styled.div `
22
30
  display: flex;
23
31
  flex-wrap: wrap;
24
32
  // hide separator on new lines: idea from https://stackoverflow.com/a/31732902/1749888
25
- margin-left: -${t}px;
26
- `;export{p as ApiHeader,d as InfoSpan,m as InfoSpanBox,l as InfoSpanBoxWrap};
33
+ margin-left: -${delimiterWidth}px;
34
+ `;
35
+ //# sourceMappingURL=styled.js.map
@@ -1,4 +1,22 @@
1
- import{jsx as r,jsxs as n}from"react/jsx-runtime";import{memo as t}from"react";import{PanelHeader as s}from"@redocly/theme/components/Panel/PanelHeader";import{PayloadSamples as l}from"../PayloadSamples/index.js";import{ServerListDropdown as d}from"../ServerListDropdown/index.js";import{CodeBlockPanel as i}from"../common/index.js";import{styled as o}from"../../styled-components.js";function p({callback:e,translate:a}){return e?.hasSamples?r(i,{className:"panel-callback-samples",header:()=>n(c,{isExpandable:!1,children:[r(f,{operation:e}),r(m,{children:a("openapi.payload","Payload")})]}),isExpandable:!1,children:e?.payload?.requestBodyContent&&r(l,{content:e.payload.requestBodyContent})}):null}const C=t(p),m=o.div`
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { PanelHeader } from '@redocly/theme/components/Panel/PanelHeader';
4
+ import { PayloadSamples } from '../PayloadSamples/index.js';
5
+ import { ServerListDropdown } from '../ServerListDropdown/index.js';
6
+ import { CodeBlockPanel } from '../common/index.js';
7
+ import { styled } from '../../styled-components.js';
8
+ function CallbackSamplesComponent({ callback, translate, }) {
9
+ const hasSamples = callback?.hasSamples;
10
+ if (!hasSamples) {
11
+ return null;
12
+ }
13
+ const renderSummary = () => {
14
+ return (_jsxs(StyledPanelHeader, { isExpandable: false, children: [_jsx(StyledServerListDropdown, { operation: callback }), _jsx(PayloadTitle, { children: translate('openapi.payload', 'Payload') })] }));
15
+ };
16
+ return (_jsx(CodeBlockPanel, { className: "panel-callback-samples", header: renderSummary, isExpandable: false, children: callback?.payload?.requestBodyContent && (_jsx(PayloadSamples, { content: callback.payload.requestBodyContent })) }));
17
+ }
18
+ export const CallbackSamples = memo(CallbackSamplesComponent);
19
+ const PayloadTitle = styled.div `
2
20
  font-size: var(--font-size-sm);
3
21
  font-style: normal;
4
22
  font-weight: var(--font-weight-regular);
@@ -7,9 +25,12 @@ import{jsx as r,jsxs as n}from"react/jsx-runtime";import{memo as t}from"react";i
7
25
  border-radius: var(--border-radius);
8
26
  background: var(--dropdown-bg-color);
9
27
  color: var(--dropdown-text-color);
10
- `,c=o(s)`
28
+ `;
29
+ const StyledPanelHeader = styled(PanelHeader) `
11
30
  flex-wrap: nowrap;
12
- `,f=o(d)`
31
+ `;
32
+ const StyledServerListDropdown = styled(ServerListDropdown) `
13
33
  padding-right: var(--spacing-base);
14
34
  min-width: 0;
15
- `;export{C as CallbackSamples};
35
+ `;
36
+ //# sourceMappingURL=CallbackSamples.js.map
@@ -1 +1,2 @@
1
- import{CallbackSamples as e}from"./CallbackSamples.js";export{e as CallbackSamples};
1
+ export { CallbackSamples } from './CallbackSamples.js';
2
+ //# sourceMappingURL=index.js.map
@@ -1,4 +1,17 @@
1
- import{jsx as l,jsxs as s,Fragment as t}from"react/jsx-runtime";import{memo as r,useCallback as m}from"react";import{LinkIcon as p}from"@redocly/theme/icons/LinkIcon/LinkIcon";import{OperationResponseList as d}from"../Responses/index.js";import{RequestDetails as k}from"../Request/RequestDetails.js";import{LinkToField as a}from"../common/LinkToField.js";import{makeDeepLink as c}from"../../services/index.js";import{styled as b}from"../../styled-components.js";function f({operation:e,translate:i}){const n=m(o=>s(h,{children:[l(a,{to:c(e.id,`${e.callbackId}/callback-response&c=${o.key}`)}),i("openapi.callbackResponse","Callback Response")]}),[e.callbackId,e.id,i]);return s(t,{children:[l(k,{operation:e,title:s(t,{children:[l(a,{to:c(e.id,`${e.callbackId}/callback-request`)}),i("openapi.callbackRequest","Callback Request")]})}),e.responses?.length?l(d,{responses:e.responses,operationId:e.id,operationPointer:e.pointer,callbackId:e.callbackId,renderTitle:n}):null]})}const j=r(f),h=b.h4`
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { memo, useCallback } from 'react';
3
+ import { LinkIcon } from '@redocly/theme/icons/LinkIcon/LinkIcon';
4
+ import { OperationResponseList } from '../Responses/index.js';
5
+ import { RequestDetails } from '../Request/RequestDetails.js';
6
+ import { LinkToField } from '../common/LinkToField.js';
7
+ import { makeDeepLink } from '../../services/index.js';
8
+ import { styled } from '../../styled-components.js';
9
+ function CallbackDetailsComponent({ operation, translate }) {
10
+ const renderResponseTitle = useCallback((tab) => (_jsxs(Title, { children: [_jsx(LinkToField, { to: makeDeepLink(operation.id, `${operation.callbackId}/callback-response&c=${tab.key}`) }), translate('openapi.callbackResponse', 'Callback Response')] })), [operation.callbackId, operation.id, translate]);
11
+ return (_jsxs(_Fragment, { children: [_jsx(RequestDetails, { operation: operation, title: _jsxs(_Fragment, { children: [_jsx(LinkToField, { to: makeDeepLink(operation.id, `${operation.callbackId}/callback-request`) }), translate('openapi.callbackRequest', 'Callback Request')] }) }), operation.responses?.length ? (_jsx(OperationResponseList, { responses: operation.responses, operationId: operation.id, operationPointer: operation.pointer, callbackId: operation.callbackId, renderTitle: renderResponseTitle })) : null] }));
12
+ }
13
+ export const CallbackDetails = memo(CallbackDetailsComponent);
14
+ const Title = styled.h4 `
2
15
  position: relative;
3
16
  font-size: var(--font-size-lg);
4
17
  font-weight: var(--h4-font-weight);
@@ -11,9 +24,10 @@ import{jsx as l,jsxs as s,Fragment as t}from"react/jsx-runtime";import{memo as r
11
24
  margin: 0 var(--spacing-sm) 0 0;
12
25
 
13
26
  :hover {
14
- ${p} {
27
+ ${LinkIcon} {
15
28
  opacity: 1;
16
29
  visibility: visible;
17
30
  }
18
31
  }
19
- `;export{j as CallbackDetails};
32
+ `;
33
+ //# sourceMappingURL=CallbackDetails.js.map
@@ -1,14 +1,35 @@
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 _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useLocation } from 'react-router-dom';
3
+ import { useTranslate } from '../../hooks/index.js';
4
+ import { CallbackPanel } from '../Panel/index.js';
5
+ import { CallbackDetails } from './CallbackDetails.js';
6
+ import { CallbackSummary } from './CallbackSummary.js';
7
+ import { pathIncludesLink } from '../../utils/index.js';
8
+ import { styled } from '../../styled-components.js';
9
+ export const CallbackOperation = ({ operation, operation: { callbackId }, onExpand, selectedCallback, }) => {
10
+ const translate = useTranslate();
11
+ const location = useLocation();
12
+ const renderSummary = ({ expanded, toggle }) => {
13
+ return (_jsx(CallbackSummary, { callback: operation, toggle: (params) => {
14
+ toggle?.(params);
15
+ onExpand?.(expanded ? null : operation);
16
+ }, expanded: expanded, translate: translate }));
17
+ };
18
+ return (_jsx(CallbackPanel, { header: renderSummary, expanded: selectedCallback?.callbackId === callbackId || pathIncludesLink(location, callbackId), className: "panel-response-callback", children: _jsxs(CallbackDetailsWrap, { children: [_jsx(CallbackDetails, { operation: operation, translate: translate }), _jsx(LeftBorder, {})] }) }));
19
+ };
20
+ const CallbackDetailsWrap = styled.div `
2
21
  position: relative;
3
22
  .property:last-child {
4
23
  border-bottom: none;
5
24
  padding-bottom: 0;
6
25
  }
7
- `,y=l.div`
26
+ `;
27
+ const LeftBorder = styled.div `
8
28
  position: absolute;
9
29
  height: calc(100% + 14px);
10
30
  border-left: 1px solid var(--border-color-primary);
11
31
  top: -14px;
12
32
  left: -12px;
13
33
  z-index: 0;
14
- `;export{B as CallbackOperation};
34
+ `;
35
+ //# sourceMappingURL=CallbackOperation.js.map
@@ -1,9 +1,24 @@
1
- import{jsx as r,jsxs as o}from"react/jsx-runtime";import{PanelHeader as p}from"@redocly/theme/components/Panel/PanelHeader";import{Badge as d}from"@redocly/theme/components/Badge/Badge";import{Trigger as f}from"../Panel/index.js";import{HttpVerb as g}from"../common/index.js";import{makeDeepLink as b}from"../../services/index.js";import{shortenHTTPVerb as h}from"../../utils/index.js";import{CallbackTitle as k}from"./styled.js";import{CircleIcon as v}from"../PropertyDetails/PlusCircleIcon.js";import{LinkToField as u}from"../common/LinkToField.js";import{styled as n}from"../../styled-components.js";function F({expanded:e=!1,toggle:t,callback:{name:l,httpVerb:i,deprecated:a,callbackId:c,id:s},translate:m}){return o(x,{expanded:e,onClick:t,children:[r(u,{to:b(s,`callbacks/${c}`)}),o(f,{children:[r(y,{children:r(v,{sign:e?"-":"+"})}),r(k,{deprecated:a,children:l}),r(g,{color:i,children:h(i)}),a?r(d,{deprecated:!0,children:m("openapi.badges.deprecated","Deprecated")}):null]})]})}const x=n(p)`
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { PanelHeader } from '@redocly/theme/components/Panel/PanelHeader';
3
+ import { Badge } from '@redocly/theme/components/Badge/Badge';
4
+ import { Trigger } from '../Panel/index.js';
5
+ import { HttpVerb } from '../common/index.js';
6
+ import { makeDeepLink } from '../../services/index.js';
7
+ import { shortenHTTPVerb } from '../../utils/index.js';
8
+ import { CallbackTitle } from './styled.js';
9
+ import { CircleIcon } from '../PropertyDetails/PlusCircleIcon.js';
10
+ import { LinkToField } from '../common/LinkToField.js';
11
+ import { styled } from '../../styled-components.js';
12
+ export function CallbackSummary({ expanded = false, toggle, callback: { name, httpVerb, deprecated, callbackId, id }, translate, }) {
13
+ return (_jsxs(CallbackHeader, { expanded: expanded, onClick: toggle, children: [_jsx(LinkToField, { to: makeDeepLink(id, `callbacks/${callbackId}`) }), _jsxs(Trigger, { children: [_jsx(CircleIconWrap, { children: _jsx(CircleIcon, { sign: expanded ? '-' : '+' }) }), _jsx(CallbackTitle, { deprecated: deprecated, children: name }), _jsx(HttpVerb, { color: httpVerb, children: shortenHTTPVerb(httpVerb) }), deprecated ? (_jsx(Badge, { deprecated: true, children: translate('openapi.badges.deprecated', 'Deprecated') })) : null] })] }));
14
+ }
15
+ const CallbackHeader = styled(PanelHeader) `
2
16
  padding: var(--spacing-sm) 0 var(--spacing-sm) calc(var(--spacing-unit) / 2);
3
17
  margin: 0;
4
18
  line-height: var(--line-height-base);
5
19
  position: relative;
6
- `,y=n.button`
20
+ `;
21
+ const CircleIconWrap = styled.button `
7
22
  background: none;
8
23
  border: none;
9
24
  cursor: pointer;
@@ -15,4 +30,5 @@ import{jsx as r,jsxs as o}from"react/jsx-runtime";import{PanelHeader as p}from"@
15
30
  font-size: var(--font-size-base);
16
31
  font-family: var(--font-family-base);
17
32
  line-height: var(--line-height-base);
18
- `;export{F as CallbackSummary};
33
+ `;
34
+ //# sourceMappingURL=CallbackSummary.js.map
@@ -1 +1,16 @@
1
- import{jsx as o}from"react/jsx-runtime";import{memo as m}from"react";import{CallbackOperation as i}from"./CallbackOperation.js";function p({callbacks:n,selectedCallback:r,onExpand:a}){if(!n||n.length===0)return null;const l=t=>{a(t)};return o("div",{children:n.map(t=>t.operations.map(e=>o(i,{operation:e,selectedCallback:r,onExpand:l},e.name)))})}const d=m(p);export{d as CallbacksList};
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { CallbackOperation } from './CallbackOperation.js';
4
+ function CallbacksListComponent({ callbacks, selectedCallback, onExpand, }) {
5
+ if (!callbacks || callbacks.length === 0) {
6
+ return null;
7
+ }
8
+ const handleSelectCallback = (callbackId) => {
9
+ onExpand(callbackId);
10
+ };
11
+ return (_jsx("div", { children: callbacks.map((callback) => callback.operations.map((operation) => {
12
+ return (_jsx(CallbackOperation, { operation: operation, selectedCallback: selectedCallback, onExpand: handleSelectCallback }, operation.name));
13
+ })) }));
14
+ }
15
+ export const CallbacksList = memo(CallbacksListComponent);
16
+ //# sourceMappingURL=CallbacksList.js.map
@@ -1 +1,4 @@
1
- export*from"./CallbackOperation.js";export*from"./CallbackSummary.js";export*from"./CallbacksList.js";
1
+ export * from './CallbackOperation.js';
2
+ export * from './CallbackSummary.js';
3
+ export * from './CallbacksList.js';
4
+ //# sourceMappingURL=index.js.map
@@ -1,7 +1,10 @@
1
- import{PanelHeaderTitle as t}from"@redocly/theme/components/Panel/PanelHeaderTitle";import{styled as o}from"../../styled-components.js";const a=o(t)`
2
- text-decoration: ${({deprecated:e})=>e?"line-through":"none"};
1
+ import { PanelHeaderTitle } from '@redocly/theme/components/Panel/PanelHeaderTitle';
2
+ import { styled } from '../../styled-components.js';
3
+ export const CallbackTitle = styled(PanelHeaderTitle) `
4
+ text-decoration: ${({ deprecated }) => (deprecated ? 'line-through' : 'none')};
3
5
  margin: 0 4px;
4
6
  vertical-align: middle;
5
7
  color: var(--panel-response-callback-heading-text-color);
6
8
  font-weight: var(--font-weight-medium);
7
- `;export{a as CallbackTitle};
9
+ `;
10
+ //# sourceMappingURL=styled.js.map
@@ -1 +1,10 @@
1
- import{jsx as r}from"react/jsx-runtime";import{memo as m}from"react";import{useAutoScroll as n}from"./useAutoScroll.js";import{ContentItems as e}from"../ContentItems/index.js";function s({routingBasePath:o,items:t}){return n(o),r(e,{root:!0,items:t,routingBasePath:o})}const C=m(s);export{C as Content};
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { useAutoScroll } from './useAutoScroll.js';
4
+ import { ContentItems } from '../ContentItems/index.js';
5
+ function ContentComponent({ routingBasePath, items }) {
6
+ useAutoScroll(routingBasePath);
7
+ return _jsx(ContentItems, { root: true, items: items, routingBasePath: routingBasePath });
8
+ }
9
+ export const Content = memo(ContentComponent);
10
+ //# sourceMappingURL=Content.js.map
@@ -1 +1,2 @@
1
- import{Content as e}from"./Content.js";export{e as Content};
1
+ export { Content } from './Content.js';
2
+ //# sourceMappingURL=index.js.map
@@ -1 +1,50 @@
1
- import{useLocation as p}from"react-router-dom";import{useEffect as i}from"react";import{addLeadingSlash as u,removeLeadingSlash as l,useActiveSectionId as m,IS_BROWSER as f}from"@redocly/theme/core/openapi";import{compose as h,encodeBackSlashes as w,tryDecodeURIComponent as S}from"../../utils/index.js";let d=!0;function E(t){const e=p(),o=t||"/";i(()=>{if(e.pathname===o&&e.hash===""){window.scrollTo(0,0);return}const a=l(e.pathname.replace(o,"")),r=g(e.hash),s=r?c(a+r)||document.querySelector(`[id$="${l(r)}"]`):c(e.hash.replace("#","").toLowerCase())||c(a);s&&s.scrollIntoView()},[e,o]);const n=m(e,!1,!1);i(()=>{if(n&&d){d=!1;return}if(f&&!window.location.pathname.includes(n)&&!window.location.hash.includes(n)){const a=h(u,w)(n);window.history.replaceState({},"",a)}},[n])}function c(t){return document.getElementById(S(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,E as useAutoScroll};
1
+ import { useLocation } from 'react-router-dom';
2
+ import { useEffect } from 'react';
3
+ import { addLeadingSlash, removeLeadingSlash, useActiveSectionId, IS_BROWSER, } from '@redocly/theme/core/openapi';
4
+ import { compose, encodeBackSlashes, tryDecodeURIComponent } from '../../utils/index.js';
5
+ let initialPageLoad = true;
6
+ export function useAutoScroll(routingBasePath) {
7
+ const location = useLocation();
8
+ const basePath = routingBasePath || '/';
9
+ useEffect(() => {
10
+ if (location.pathname === basePath && location.hash === '') {
11
+ window.scrollTo(0, 0);
12
+ return;
13
+ }
14
+ const pathname = removeLeadingSlash(location.pathname.replace(basePath, ''));
15
+ const legacyHash = getLegacyHash(location.hash);
16
+ const element = legacyHash
17
+ ? getElementById(pathname + legacyHash) ||
18
+ document.querySelector(`[id$="${removeLeadingSlash(legacyHash)}"]`) // handle scroll to operation by legacy hash route
19
+ : getElementById(location.hash.replace('#', '')) || getElementById(pathname);
20
+ if (element) {
21
+ element.scrollIntoView();
22
+ }
23
+ }, [location, basePath]);
24
+ const activeSectionId = useActiveSectionId(location, false, false);
25
+ useEffect(() => {
26
+ if (activeSectionId && initialPageLoad) {
27
+ initialPageLoad = false;
28
+ return;
29
+ }
30
+ if (IS_BROWSER &&
31
+ !window.location.pathname.includes(activeSectionId) &&
32
+ !window.location.hash.includes(activeSectionId)) {
33
+ const url = compose(addLeadingSlash, encodeBackSlashes)(activeSectionId);
34
+ window.history.replaceState({}, '', url);
35
+ }
36
+ }, [activeSectionId]);
37
+ }
38
+ export function getElementById(id) {
39
+ return document.getElementById(tryDecodeURIComponent(id));
40
+ }
41
+ export function getLegacyHash(hash) {
42
+ const patterns = ['#tag', '#operation', '#paths'];
43
+ for (const pattern of patterns) {
44
+ if (hash.includes(pattern)) {
45
+ return hash.replace(pattern, '').toLowerCase();
46
+ }
47
+ }
48
+ return '';
49
+ }
50
+ //# sourceMappingURL=useAutoScroll.js.map
@@ -1 +1,31 @@
1
- import{jsx as e,Fragment as m,jsxs as c}from"react/jsx-runtime";import{memo as f}from"react";import{useAtomValue as u}from"jotai";import{joinWithSeparator as x}from"../../services/index.js";import{TagItem as p}from"../TagItem/index.js";import{OperationItem as y}from"../OperationItem/index.js";import{Section as I}from"../common/index.js";import{useIsExpanded as g}from"./useIsExpanded.js";import{SectionItem as C}from"../SectionItem/index.js";import h from"../ContentItems/useScrollOnRender.js";import{isRootItem as j}from"../ContentItems/helpers.js";import{ApiInfo as S}from"../ApiInfo/index.js";import{layoutAtom as A}from"../../jotai/app.js";const E={group:null,tag:p,section:C,schema:p,operation:y,root:S};function _({item:o,routingBasePath:t,children:s,layout:a}){const r=E[j(o)?"root":o.type],i=o.type==="tag"&&o.items.length>0,n=g({item:o,routingBasePath:t});let d=h(o,t);const l=u(A);return c(m,{children:[r&&e(I,{id:o.id,ref:d,sectionId:x(t,o.id),underlined:o.type==="operation"||o.type==="schema",expanded:i&&!n,children:e(r,{item:o,routingBasePath:t,isExpanded:n,layout:a||l})}),(n||o.type!=="tag")&&!!o.items?.length&&e(m,{children:s})]})}const D=f(_);export{D as ContentItem};
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { useAtomValue } from 'jotai';
4
+ import { joinWithSeparator } from '../../services/index.js';
5
+ import { TagItem } from '../TagItem/index.js';
6
+ import { OperationItem } from '../OperationItem/index.js';
7
+ import { Section } from '../common/index.js';
8
+ import { useIsExpanded } from './useIsExpanded.js';
9
+ import { SectionItem } from '../SectionItem/index.js';
10
+ import useScrollOnRender from '../ContentItems/useScrollOnRender.js';
11
+ import { isRootItem } from '../ContentItems/helpers.js';
12
+ import { ApiInfo } from '../ApiInfo/index.js';
13
+ import { layoutAtom } from '../../jotai/app.js';
14
+ const ContentComponentMap = {
15
+ group: null,
16
+ tag: TagItem,
17
+ section: SectionItem,
18
+ schema: TagItem,
19
+ operation: OperationItem,
20
+ root: ApiInfo,
21
+ };
22
+ function ContentItemComponent({ item, routingBasePath, children, layout: contentLayout, }) {
23
+ const ContentComponent = ContentComponentMap[isRootItem(item) ? 'root' : item.type];
24
+ const expandable = item.type === 'tag' && item.items.length > 0;
25
+ const isExpanded = useIsExpanded({ item, routingBasePath });
26
+ let ref = useScrollOnRender(item, routingBasePath);
27
+ const layout = useAtomValue(layoutAtom);
28
+ return (_jsxs(_Fragment, { children: [ContentComponent && (_jsx(Section, { id: item.id, ref: ref, sectionId: joinWithSeparator(routingBasePath, item.id), underlined: item.type === 'operation' || item.type === 'schema', expanded: expandable && !isExpanded, children: _jsx(ContentComponent, { item: item, routingBasePath: routingBasePath, isExpanded: isExpanded, layout: contentLayout || layout }) })), (isExpanded || item.type !== 'tag') && Boolean(item.items?.length) && _jsx(_Fragment, { children: children })] }));
29
+ }
30
+ export const ContentItem = memo(ContentItemComponent);
31
+ //# sourceMappingURL=ContentItem.js.map
@@ -1 +1,2 @@
1
- import{ContentItem as o}from"./ContentItem.js";export{o as ContentItem};
1
+ export { ContentItem } from './ContentItem.js';
2
+ //# sourceMappingURL=index.js.map
@@ -1 +1,33 @@
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 } from 'react';
2
+ import { useLocation } from 'react-router-dom';
3
+ import { removeLeadingSlash } from '@redocly/theme/core/openapi';
4
+ import { tryDecodeURIComponent, normalizePath } from '../../utils/index.js';
5
+ import { getLegacyHash } from '../Content/useAutoScroll.js';
6
+ export function useIsExpanded({ item, routingBasePath, }) {
7
+ const location = useLocation();
8
+ const decodedPathname = useMemo(() => tryDecodeURIComponent(normalizePath(location.pathname.replace(routingBasePath, ''))), [location.pathname, routingBasePath]);
9
+ const flatItems = useMemo(() => {
10
+ const flat = [];
11
+ const traverse = (items) => {
12
+ items.forEach((item) => {
13
+ flat.push(item);
14
+ if (item.items?.length) {
15
+ traverse(item.items);
16
+ }
17
+ });
18
+ };
19
+ traverse([item]);
20
+ return flat;
21
+ }, [item]);
22
+ if (item.type !== 'tag') {
23
+ return false;
24
+ }
25
+ const itemHrefs = flatItems.map((item) => item.href);
26
+ return itemHrefs.some((href) => {
27
+ const legacyHash = getLegacyHash(location.hash);
28
+ return ([href, tryDecodeURIComponent(href)].includes(decodedPathname) ||
29
+ // handle expand tag by legacy hash route
30
+ (legacyHash && (href.endsWith(legacyHash) || href === removeLeadingSlash(legacyHash))));
31
+ });
32
+ }
33
+ //# sourceMappingURL=useIsExpanded.js.map
@@ -1 +1,19 @@
1
- import{jsx as e,jsxs as f,Fragment as p}from"react/jsx-runtime";import{memo as c,useMemo as u}from"react";import{Navigate as g,Route as r,Routes as a}from"react-router-dom";import{getFirstPageLink as h,getItemsByType as d}from"./helpers.js";import{SectionContent as i}from"../SectionContent/index.js";function x({items:t,root:m=!1}){const n="/",{rootItem:o}=d(t),s=!m||o?n:h(t,n),l=u(()=>f(a,{children:[o&&e(r,{path:`${o.href||n}*`,element:e(i,{items:t})}),e(r,{path:"*",element:e(g,{to:s,replace:!0})})]}),[o,n,t,s]);return m&&!t.length?e(a,{children:e(r,{path:"*",element:e(i,{items:t})})}):t.length?e(p,{children:l}):null}const F=c(x);export{F as ContentItems};
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { memo, useMemo } from 'react';
3
+ import { Navigate, Route, Routes } from 'react-router-dom';
4
+ import { getFirstPageLink, getItemsByType } from './helpers.js';
5
+ import { SectionContent } from '../SectionContent/index.js';
6
+ function ContentItemsComponent({ items, root = false }) {
7
+ const defaultRootLink = '/';
8
+ const { rootItem } = getItemsByType(items);
9
+ const firstPageLink = !root || rootItem ? defaultRootLink : getFirstPageLink(items, defaultRootLink);
10
+ const renderRoutes = useMemo(() => (_jsxs(Routes, { children: [rootItem && (_jsx(Route, { path: `${rootItem.href || defaultRootLink}*`, element: _jsx(SectionContent, { items: items }) })), _jsx(Route, { path: "*", element: _jsx(Navigate, { to: firstPageLink, replace: true }) })] })), [rootItem, defaultRootLink, items, firstPageLink]);
11
+ if (root && !items.length) {
12
+ return (_jsx(Routes, { children: _jsx(Route, { path: "*", element: _jsx(SectionContent, { items: items }) }) }));
13
+ }
14
+ if (!items.length)
15
+ return null;
16
+ return _jsx(_Fragment, { children: renderRoutes });
17
+ }
18
+ export const ContentItems = memo(ContentItemsComponent);
19
+ //# sourceMappingURL=ContentItems.js.map
@@ -1 +1,13 @@
1
- import{jsx as r,Fragment as m}from"react/jsx-runtime";import{memo as i,useCallback as a}from"react";import{ContentItem as p}from"../ContentItem/index.js";import{VirtualList as s}from"./VirtualList.js";function c({items:t,routingBasePath:n}){const o=a(e=>r(p,{item:e,routingBasePath:n,children:e.items.length>0&&r(s,{items:e.items,renderItem:o,routingBasePath:n})},e.id),[n]);if(!t.length)return null;const l=t.length>15&&t.every(e=>e.type==="operation"||e.type==="schema");return r(m,{children:l?r(s,{items:t,renderItem:o,routingBasePath:n}):r(m,{children:t.map(o)})})}const I=i(c);export{I as Items};
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { memo, useCallback } from 'react';
3
+ import { ContentItem } from '../ContentItem/index.js';
4
+ import { VirtualList } from './VirtualList.js';
5
+ function ItemsComponent({ items, routingBasePath }) {
6
+ const renderItem = useCallback((item) => (_jsx(ContentItem, { item: item, routingBasePath: routingBasePath, children: item.items.length > 0 && (_jsx(VirtualList, { items: item.items, renderItem: renderItem, routingBasePath: routingBasePath })) }, item.id)), [routingBasePath]);
7
+ if (!items.length)
8
+ return null;
9
+ const shouldUseVirtualList = items.length > 15 && items.every((item) => item.type === 'operation' || item.type === 'schema');
10
+ return (_jsx(_Fragment, { children: shouldUseVirtualList ? (_jsx(VirtualList, { items: items, renderItem: renderItem, routingBasePath: routingBasePath })) : (_jsx(_Fragment, { children: items.map(renderItem) })) }));
11
+ }
12
+ export const Items = memo(ItemsComponent);
13
+ //# sourceMappingURL=Items.js.map
@@ -1 +1,35 @@
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 _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, memo, useEffect, useState, useMemo } from 'react';
3
+ import { useLocation } from 'react-router-dom';
4
+ import { removeLeadingSlash } from '@redocly/theme/core/openapi';
5
+ const INITIAL_VISIBLE_ITEMS = 3;
6
+ const BUFFER_ITEMS = 1;
7
+ const FULL_LIST_DELAY = 1000;
8
+ const VirtualListComponent = ({ items = [], renderItem, routingBasePath, }) => {
9
+ const basePath = routingBasePath || '/';
10
+ const location = useLocation();
11
+ const pathname = removeLeadingSlash(location.pathname.replace(basePath, ''));
12
+ const findActiveItemIndex = useMemo(() => {
13
+ const itemMap = new Map(items.map((item, index) => [removeLeadingSlash(item.href), index]));
14
+ return (pathname) => (pathname ? itemMap.get(pathname) : undefined);
15
+ }, [items]);
16
+ const getVisibleRange = useCallback((pathname) => {
17
+ const currentIndex = findActiveItemIndex(pathname);
18
+ const start = Math.max(0, currentIndex ? currentIndex - BUFFER_ITEMS : 0);
19
+ const end = Math.min(items.length, currentIndex ? currentIndex + BUFFER_ITEMS + 1 : INITIAL_VISIBLE_ITEMS);
20
+ return { start, end };
21
+ }, [findActiveItemIndex, items.length]);
22
+ const [visibleItems, setVisibleItems] = useState(() => {
23
+ const { start, end } = getVisibleRange(pathname);
24
+ return items.slice(start, end);
25
+ });
26
+ useEffect(() => {
27
+ const timeoutId = setTimeout(() => {
28
+ setVisibleItems(items);
29
+ }, FULL_LIST_DELAY);
30
+ return () => clearTimeout(timeoutId);
31
+ }, [items]);
32
+ return _jsx(_Fragment, { children: visibleItems.map(renderItem) });
33
+ };
34
+ export const VirtualList = memo(VirtualListComponent);
35
+ //# sourceMappingURL=VirtualList.js.map
@@ -1 +1,49 @@
1
- import{normalizePath as s}from"../../utils/index.js";function c(t){return t.type==="section"&&t.id===""}function f(t){const r=[],e=[],n=[];let i;for(const o of t)switch(o.type){case"group":r.push(o);break;case"tag":e.push(o);break;case"operation":n.push(o);break;case"section":c(o)&&(i=o);break}return{groupItems:r,tagItems:e,operationItems:n,rootItem:i}}function p(t,r){for(const e of t){if(e.type==="group")return p(e.items,r);if(e.type==="tag"){if(!e.description)return s(p(e.items,r));if(e.href)return s(e.href)}else if(e.type==="operation"||e.type==="schema")return s(e.href)}return r}export{p as getFirstPageLink,f as getItemsByType,c as isRootItem};
1
+ import { normalizePath } from '../../utils/index.js';
2
+ export function isRootItem(item) {
3
+ return item.type === 'section' && item.id === '';
4
+ }
5
+ export function getItemsByType(items) {
6
+ const groupItems = [];
7
+ const tagItems = [];
8
+ const operationItems = [];
9
+ let rootItem = undefined;
10
+ for (const item of items) {
11
+ switch (item.type) {
12
+ case 'group':
13
+ groupItems.push(item);
14
+ break;
15
+ case 'tag':
16
+ tagItems.push(item);
17
+ break;
18
+ case 'operation':
19
+ operationItems.push(item);
20
+ break;
21
+ case 'section':
22
+ if (isRootItem(item)) {
23
+ rootItem = item;
24
+ }
25
+ break;
26
+ }
27
+ }
28
+ return { groupItems, tagItems, operationItems, rootItem };
29
+ }
30
+ export function getFirstPageLink(items, defaultRootLink) {
31
+ for (const item of items) {
32
+ if (item.type === 'group') {
33
+ return getFirstPageLink(item.items, defaultRootLink);
34
+ }
35
+ else if (item.type === 'tag') {
36
+ if (!item.description) {
37
+ return normalizePath(getFirstPageLink(item.items, defaultRootLink));
38
+ }
39
+ if (item.href) {
40
+ return normalizePath(item.href);
41
+ }
42
+ }
43
+ else if (item.type === 'operation' || item.type === 'schema') {
44
+ return normalizePath(item.href);
45
+ }
46
+ }
47
+ return defaultRootLink;
48
+ }
49
+ //# sourceMappingURL=helpers.js.map
@@ -1 +1,2 @@
1
- import{ContentItems as o}from"./ContentItems.js";export{o as ContentItems};
1
+ export { ContentItems } from './ContentItems.js';
2
+ //# sourceMappingURL=index.js.map