@redocly/openapi-docs 3.12.0 → 3.12.2

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 (384) hide show
  1. package/dist/redocly-openapi-docs.min.js +753 -750
  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 +16 -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.js +9 -1
  51. package/lib/components/OperationItem/OperationItem.js +70 -5
  52. package/lib/components/OperationItem/_tests_/OperationItem.test.js +70 -1
  53. package/lib/components/OperationItem/_tests_/__mocks__/mock-intersection-observer.js +40 -1
  54. package/lib/components/OperationItem/index.js +2 -1
  55. package/lib/components/OperationItem/types.js +2 -0
  56. package/lib/components/Overlay.js +48 -3
  57. package/lib/components/Overview/Overview.js +20 -1
  58. package/lib/components/Overview/index.js +2 -1
  59. package/lib/components/PageFooter/PageFooter.js +19 -1
  60. package/lib/components/PageFooter/index.js +2 -1
  61. package/lib/components/Panel/ResponsePanel.js +12 -6
  62. package/lib/components/Panel/Trigger.js +4 -2
  63. package/lib/components/Panel/index.js +3 -1
  64. package/lib/components/PanelItem/PanelItem.js +6 -1
  65. package/lib/components/PanelItem/index.js +3 -1
  66. package/lib/components/PanelItem/styled.js +20 -10
  67. package/lib/components/PayloadSamples/Example.js +6 -1
  68. package/lib/components/PayloadSamples/ExampleValue.js +30 -1
  69. package/lib/components/PayloadSamples/MediaTypeSamples.js +36 -2
  70. package/lib/components/PayloadSamples/PayloadSamples.js +26 -1
  71. package/lib/components/PayloadSamples/index.js +7 -1
  72. package/lib/components/PayloadSamples/styled.js +9 -4
  73. package/lib/components/PayloadSamples/types.js +2 -0
  74. package/lib/components/PropertyDetails/DescriptionEnums.js +19 -3
  75. package/lib/components/PropertyDetails/EnumValues.js +37 -1
  76. package/lib/components/PropertyDetails/Examples.js +26 -1
  77. package/lib/components/PropertyDetails/Extensions.js +17 -2
  78. package/lib/components/PropertyDetails/FieldDetail.js +15 -2
  79. package/lib/components/PropertyDetails/FieldDetails.js +51 -6
  80. package/lib/components/PropertyDetails/Pattern.js +21 -1
  81. package/lib/components/PropertyDetails/PlusCircleIcon.js +10 -4
  82. package/lib/components/PropertyDetails/PropertyDetails.js +22 -5
  83. package/lib/components/PropertyDetails/SchemaTypeInfo.js +10 -2
  84. package/lib/components/PropertyDetails/SimpleEnums.js +13 -2
  85. package/lib/components/PropertyDetails/cycleColorsByLevel.js +18 -1
  86. package/lib/components/PropertyDetails/index.js +4 -1
  87. package/lib/components/PropertyDetails/styled.js +15 -7
  88. package/lib/components/PropertyDetails/types.js +2 -0
  89. package/lib/components/RedoclyOpenAPIDocs/Providers.js +114 -1
  90. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocs.js +57 -1
  91. package/lib/components/RedoclyOpenAPIDocs/RedoclyOpenAPIDocsStandalone.js +86 -1
  92. package/lib/components/RedoclyOpenAPIDocs/index.js +5 -1
  93. package/lib/components/RedoclyOpenAPIDocs/styled.js +4 -2
  94. package/lib/components/RedoclyOpenAPIDocs/types.js +2 -0
  95. package/lib/components/RedoclyOpenAPIDocs/utils.js +33 -1
  96. package/lib/components/RenderHook/RenderHook.js +17 -1
  97. package/lib/components/RenderHook/index.js +2 -1
  98. package/lib/components/Replay/EmbeddedReplay.js +41 -3
  99. package/lib/components/Replay/Replay.js +99 -1
  100. package/lib/components/Replay/index.js +3 -1
  101. package/lib/components/Replay/utils.js +208 -1
  102. package/lib/components/Request/RequestDetails.js +33 -2
  103. package/lib/components/Request/types.js +2 -0
  104. package/lib/components/RequestParameters/Body.js +8 -1
  105. package/lib/components/RequestParameters/ParametersGroup.js +19 -4
  106. package/lib/components/RequestParameters/RequestParameters.js +40 -1
  107. package/lib/components/RequestParameters/index.js +4 -1
  108. package/lib/components/RequestSamples/CodeSample.js +55 -2
  109. package/lib/components/RequestSamples/Example.js +37 -1
  110. package/lib/components/RequestSamples/RequestSamples.js +89 -5
  111. package/lib/components/RequestSamples/index.js +3 -1
  112. package/lib/components/RequestSamples/useCodeSamples.js +92 -1
  113. package/lib/components/ResponseSamples/ResponseSamples.js +47 -1
  114. package/lib/components/ResponseSamples/Summary.js +9 -1
  115. package/lib/components/ResponseSamples/index.js +2 -1
  116. package/lib/components/Responses/OperationResponseList.js +42 -2
  117. package/lib/components/Responses/ResponseDetails.js +18 -1
  118. package/lib/components/Responses/ResponseHeaders.js +15 -1
  119. package/lib/components/Responses/index.js +6 -1
  120. package/lib/components/Responses/styled.js +14 -6
  121. package/lib/components/Responses/types.js +2 -0
  122. package/lib/components/RightPanel/RightPanel.js +21 -1
  123. package/lib/components/RightPanel/index.js +2 -1
  124. package/lib/components/Samples/ExampleSwitch.js +33 -1
  125. package/lib/components/Samples/index.js +3 -1
  126. package/lib/components/Samples/use-example-key.js +12 -1
  127. package/lib/components/Schema/ArraySchema.js +45 -1
  128. package/lib/components/Schema/ObjectSchema.js +29 -1
  129. package/lib/components/Schema/OneOfSchema.js +47 -3
  130. package/lib/components/Schema/RecursiveSchema.js +10 -1
  131. package/lib/components/Schema/Schema.js +63 -2
  132. package/lib/components/Schema/SubSchema.js +20 -1
  133. package/lib/components/Schema/helpers.js +16 -1
  134. package/lib/components/Schema/index.js +5 -1
  135. package/lib/components/Schema/types.js +2 -0
  136. package/lib/components/Schema/useOneOfLocationIdx.js +11 -1
  137. package/lib/components/SchemaDefinition/SchemaDefinition.js +65 -2
  138. package/lib/components/SchemaDefinition/index.js +2 -1
  139. package/lib/components/SectionContent/SectionContent.js +49 -6
  140. package/lib/components/SectionContent/index.js +2 -1
  141. package/lib/components/SectionItem/SectionItem.js +14 -1
  142. package/lib/components/SectionItem/index.js +2 -1
  143. package/lib/components/Security/Divider.js +9 -2
  144. package/lib/components/Security/OAuthFlow.js +11 -1
  145. package/lib/components/Security/OAuthScopes.js +59 -9
  146. package/lib/components/Security/Security.js +15 -1
  147. package/lib/components/Security/SecurityButton.js +31 -7
  148. package/lib/components/Security/SecurityFlow.js +28 -4
  149. package/lib/components/Security/SecurityModal.js +34 -5
  150. package/lib/components/Security/SecuritySchemeItem.js +15 -4
  151. package/lib/components/Security/helper.js +16 -1
  152. package/lib/components/Security/index.js +11 -1
  153. package/lib/components/Security/styled.js +6 -3
  154. package/lib/components/SelectOrLabel/SelectOrLabel.js +12 -2
  155. package/lib/components/SelectOrLabel/index.js +2 -1
  156. package/lib/components/ServerList/ServerList.js +36 -10
  157. package/lib/components/ServerList/index.js +2 -1
  158. package/lib/components/ServerList/types.js +2 -0
  159. package/lib/components/ServerListDropdown/ServerListDropdown.js +54 -1
  160. package/lib/components/ServerListDropdown/index.js +2 -1
  161. package/lib/components/ServerListDropdown/styled.js +15 -6
  162. package/lib/components/SideMenu/SideMenu.js +13 -2
  163. package/lib/components/SideMenu/hooks/useMenuItems.js +110 -1
  164. package/lib/components/SideMenu/index.js +2 -1
  165. package/lib/components/SideMenu/types.js +2 -0
  166. package/lib/components/StickySidebar/SidebarActions.js +14 -2
  167. package/lib/components/StickySidebar/StickyResponsiveSidebar.js +37 -7
  168. package/lib/components/StickySidebar/index.js +2 -1
  169. package/lib/components/Tabs/Tabs.js +16 -5
  170. package/lib/components/Tabs/index.js +3 -1
  171. package/lib/components/Tabs/useTabsState.js +22 -1
  172. package/lib/components/TagItem/OperationNavigationItems.js +18 -4
  173. package/lib/components/TagItem/OperationsNavigation.js +46 -2
  174. package/lib/components/TagItem/TagItem.js +40 -7
  175. package/lib/components/TagItem/index.js +2 -1
  176. package/lib/components/TagItem/styled.js +5 -2
  177. package/lib/components/TagItem/types.js +2 -0
  178. package/lib/components/ViewNested/ViewNested.js +42 -9
  179. package/lib/components/ViewNested/index.js +2 -1
  180. package/lib/components/common/Badges.js +21 -5
  181. package/lib/components/common/BodyContent/BodyContent.js +31 -4
  182. package/lib/components/common/BodyContent/index.js +2 -1
  183. package/lib/components/common/ClearButton/ClearButton.js +5 -1
  184. package/lib/components/common/ClearButton/index.js +3 -1
  185. package/lib/components/common/ClearButton/styled.js +5 -2
  186. package/lib/components/common/ClearButton/types.js +2 -0
  187. package/lib/components/common/CodeBlockPanel.js +7 -3
  188. package/lib/components/common/ConstraintsView.js +14 -2
  189. package/lib/components/common/Dropdown/Dropdown.js +22 -4
  190. package/lib/components/common/Dropdown/index.js +2 -1
  191. package/lib/components/common/ExpandableExample/ExpandableExample.js +24 -3
  192. package/lib/components/common/ExpandableExample/index.js +2 -1
  193. package/lib/components/common/Extensions.js +17 -2
  194. package/lib/components/common/Fields/fields-layout.js +76 -51
  195. package/lib/components/common/Fields/fields.js +39 -17
  196. package/lib/components/common/Fields/index.js +3 -1
  197. package/lib/components/common/LinkToField.js +33 -6
  198. package/lib/components/common/OperationItemTitle.js +12 -6
  199. package/lib/components/common/SchemaSelection/SchemaSelection.js +51 -1
  200. package/lib/components/common/SchemaSelection/index.js +2 -1
  201. package/lib/components/common/Select/Select.js +21 -1
  202. package/lib/components/common/Select/index.js +3 -1
  203. package/lib/components/common/Select/styled.js +17 -9
  204. package/lib/components/common/Select/types.js +2 -0
  205. package/lib/components/common/Skeleton/LanguageListSkeleton.js +16 -6
  206. package/lib/components/common/Skeleton/Skeleton.js +15 -5
  207. package/lib/components/common/Skeleton/index.js +3 -1
  208. package/lib/components/common/headers.js +4 -2
  209. package/lib/components/common/index.js +14 -1
  210. package/lib/components/common/linkify.js +28 -4
  211. package/lib/components/common/mixins.js +4 -2
  212. package/lib/components/common/panels.js +52 -29
  213. package/lib/components/common/schema.js +16 -8
  214. package/lib/components/common/styled.js +15 -7
  215. package/lib/components/index.js +25 -1
  216. package/lib/components/pluggable/RedocExample.js +20 -1
  217. package/lib/components/pluggable/RedocSchema.js +22 -1
  218. package/lib/components/pluggable/index.js +3 -1
  219. package/lib/components/pluggable/styled.components.js +9 -4
  220. package/lib/constants.js +30 -1
  221. package/lib/empty.js +7 -1
  222. package/lib/events/codeSampleCopy.js +19 -1
  223. package/lib/events/creator.js +5 -1
  224. package/lib/events/index.js +8 -1
  225. package/lib/events/languageSwitch.js +18 -1
  226. package/lib/events/panelToggle.js +16 -1
  227. package/lib/events/serverSwitch.js +13 -1
  228. package/lib/events/tryItOpen.js +12 -1
  229. package/lib/events/tryItSent.js +12 -1
  230. package/lib/events/types.js +11 -1
  231. package/lib/hoc/types.js +2 -0
  232. package/lib/hoc/utils.js +4 -1
  233. package/lib/hoc/withRouter.js +17 -1
  234. package/lib/hoc/withStore.js +28 -1
  235. package/lib/hooks/index.js +9 -1
  236. package/lib/hooks/useActivateExample.js +35 -1
  237. package/lib/hooks/useActiveWithFallback.js +12 -1
  238. package/lib/hooks/useContentItems.js +10 -1
  239. package/lib/hooks/useLicense.js +17 -1
  240. package/lib/hooks/usePerformanceMetrics.js +26 -1
  241. package/lib/hooks/useRouter.js +17 -1
  242. package/lib/hooks/useTelemetry.js +5 -1
  243. package/lib/hooks/useTranslate.js +6 -1
  244. package/lib/hooks/useUppercase2LowercaseRedirect.js +12 -1
  245. package/lib/icons/CSharpIcon/CSharpIcon.js +7 -1
  246. package/lib/icons/CSharpIcon/index.js +2 -1
  247. package/lib/icons/CurlIcon/CurlIcon.js +8 -2
  248. package/lib/icons/CurlIcon/index.js +2 -1
  249. package/lib/icons/GOIcon/GOIcon.js +7 -1
  250. package/lib/icons/GOIcon/index.js +2 -1
  251. package/lib/icons/JavaIcon/JavaIcon.js +7 -1
  252. package/lib/icons/JavaIcon/index.js +2 -1
  253. package/lib/icons/JavaScriptIcon/JavaScriptIcon.js +7 -1
  254. package/lib/icons/JavaScriptIcon/index.js +2 -1
  255. package/lib/icons/NodeJSIcon/NodeJSIcon.js +7 -1
  256. package/lib/icons/NodeJSIcon/index.js +2 -1
  257. package/lib/icons/PHPIcon/PHPIcon.js +7 -1
  258. package/lib/icons/PHPIcon/index.js +2 -1
  259. package/lib/icons/PayloadIcon/PayloadIcon.js +7 -1
  260. package/lib/icons/PayloadIcon/index.js +2 -1
  261. package/lib/icons/PythonIcon/PythonIcon.js +7 -1
  262. package/lib/icons/PythonIcon/index.js +2 -1
  263. package/lib/icons/RIcon/RIcon.js +7 -1
  264. package/lib/icons/RIcon/index.js +2 -1
  265. package/lib/icons/RubyIcon/RubyIcon.js +7 -1
  266. package/lib/icons/RubyIcon/index.js +2 -1
  267. package/lib/index.js +49 -1
  268. package/lib/jotai/app.js +113 -1
  269. package/lib/jotai/operation.js +28 -1
  270. package/lib/jotai/replay.js +5 -1
  271. package/lib/jotai/store.js +8 -1
  272. package/lib/jotai/use-write-atom.js +9 -1
  273. package/lib/models/callback.js +28 -1
  274. package/lib/models/code-sample-options.js +2 -0
  275. package/lib/models/example.js +17 -1
  276. package/lib/models/field.js +109 -1
  277. package/lib/models/group.js +38 -1
  278. package/lib/models/index.js +14 -1
  279. package/lib/models/mediaContent.js +26 -1
  280. package/lib/models/mediaType.js +153 -1
  281. package/lib/models/operation.js +166 -1
  282. package/lib/models/request.js +25 -1
  283. package/lib/models/response.js +46 -1
  284. package/lib/models/schema.js +474 -2
  285. package/lib/models/security.js +84 -1
  286. package/lib/models/tab.js +2 -0
  287. package/lib/models/types.js +2 -0
  288. package/lib/services/OpenAPIParser.js +321 -1
  289. package/lib/services/check.js +104 -1
  290. package/lib/services/code-samples/constants.js +16 -1
  291. package/lib/services/code-samples/generator.js +540 -1
  292. package/lib/services/code-samples/httpsnippet/helpers/code-builder.js +252 -3
  293. package/lib/services/code-samples/httpsnippet/helpers/code-helpers.js +90 -2
  294. package/lib/services/code-samples/httpsnippet/helpers/constants.js +28 -1
  295. package/lib/services/code-samples/httpsnippet/helpers/lodash-int.js +173 -1
  296. package/lib/services/code-samples/httpsnippet/helpers/mocks/code-helpers-mock.js +76 -37
  297. package/lib/services/code-samples/httpsnippet/helpers/reducer.js +16 -1
  298. package/lib/services/code-samples/httpsnippet/helpers/shell.js +20 -1
  299. package/lib/services/code-samples/httpsnippet/helpers/string-utility.js +19 -1
  300. package/lib/services/code-samples/httpsnippet/index.js +166 -1
  301. package/lib/services/code-samples/httpsnippet/targets/__mocks__/mock.js +2340 -146
  302. package/lib/services/code-samples/httpsnippet/targets/csharp/httpclient.js +227 -2
  303. package/lib/services/code-samples/httpsnippet/targets/csharp/index.js +11 -1
  304. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/httpclient.js +185 -2
  305. package/lib/services/code-samples/httpsnippet/targets/csharpNewtonsoft/index.js +11 -1
  306. package/lib/services/code-samples/httpsnippet/targets/go/index.js +11 -1
  307. package/lib/services/code-samples/httpsnippet/targets/go/native.js +222 -3
  308. package/lib/services/code-samples/httpsnippet/targets/index.js +28 -1
  309. package/lib/services/code-samples/httpsnippet/targets/java/httpclient.js +184 -3
  310. package/lib/services/code-samples/httpsnippet/targets/java/index.js +11 -1
  311. package/lib/services/code-samples/httpsnippet/targets/java8/apachehttp.js +223 -2
  312. package/lib/services/code-samples/httpsnippet/targets/java8/index.js +11 -1
  313. package/lib/services/code-samples/httpsnippet/targets/javascript/fetch.js +147 -1
  314. package/lib/services/code-samples/httpsnippet/targets/javascript/index.js +11 -1
  315. package/lib/services/code-samples/httpsnippet/targets/node/fetch.js +199 -1
  316. package/lib/services/code-samples/httpsnippet/targets/node/index.js +11 -1
  317. package/lib/services/code-samples/httpsnippet/targets/php/curl.js +203 -5
  318. package/lib/services/code-samples/httpsnippet/targets/php/index.js +11 -1
  319. package/lib/services/code-samples/httpsnippet/targets/php/types.js +2 -0
  320. package/lib/services/code-samples/httpsnippet/targets/php/utils.js +106 -5
  321. package/lib/services/code-samples/httpsnippet/targets/python/index.js +11 -1
  322. package/lib/services/code-samples/httpsnippet/targets/python/requests.js +185 -6
  323. package/lib/services/code-samples/httpsnippet/targets/r/httr.js +111 -1
  324. package/lib/services/code-samples/httpsnippet/targets/r/index.js +11 -1
  325. package/lib/services/code-samples/httpsnippet/targets/r/utils.js +18 -6
  326. package/lib/services/code-samples/httpsnippet/targets/ruby/index.js +11 -1
  327. package/lib/services/code-samples/httpsnippet/targets/ruby/native.js +169 -1
  328. package/lib/services/code-samples/httpsnippet/targets/shell/curl.js +94 -6
  329. package/lib/services/code-samples/httpsnippet/targets/shell/index.js +11 -1
  330. package/lib/services/code-samples/index.js +3 -1
  331. package/lib/services/code-samples/types.js +2 -0
  332. package/lib/services/config-options/helpers.js +49 -1
  333. package/lib/services/config-options/index.js +3 -1
  334. package/lib/services/config-options/normalizeOptions.js +83 -1
  335. package/lib/services/config-options/types.js +2 -0
  336. package/lib/services/history/helpers.js +63 -1
  337. package/lib/services/history/index.js +2 -1
  338. package/lib/services/index.js +9 -1
  339. package/lib/services/menu/builder.js +47 -1
  340. package/lib/services/menu/index.js +2 -1
  341. package/lib/services/menu/markdown.js +93 -1
  342. package/lib/services/menu/operation.js +50 -1
  343. package/lib/services/menu/tags.js +166 -1
  344. package/lib/services/types.js +2 -0
  345. package/lib/services/utils.js +83 -1
  346. package/lib/standalone.js +68 -1
  347. package/lib/styled-components.js +6 -1
  348. package/lib/types/app.js +2 -0
  349. package/lib/types/index.js +4 -1
  350. package/lib/types/open-api.js +2 -0
  351. package/lib/types/security.js +2 -0
  352. package/lib/utils/JsonPointer.js +84 -1
  353. package/lib/utils/areArraysEqual.js +4 -1
  354. package/lib/utils/argValuesHelpers.js +35 -1
  355. package/lib/utils/compose.js +2 -1
  356. package/lib/utils/configure-helpers.js +223 -1
  357. package/lib/utils/convertSwagger2OpenAPI.js +14 -1
  358. package/lib/utils/cookies.js +73 -1
  359. package/lib/utils/debounce.js +22 -1
  360. package/lib/utils/debug.js +11 -1
  361. package/lib/utils/dom.js +65 -1
  362. package/lib/utils/environments.js +13 -1
  363. package/lib/utils/helpers.js +222 -12
  364. package/lib/utils/index.js +25 -1
  365. package/lib/utils/isMobile.js +13 -1
  366. package/lib/utils/loadAndBundleSpec.js +32 -1
  367. package/lib/utils/local-storage.js +12 -1
  368. package/lib/utils/object.js +31 -1
  369. package/lib/utils/openapi.js +592 -1
  370. package/lib/utils/parameters.js +13 -1
  371. package/lib/utils/path.js +22 -1
  372. package/lib/utils/queryString.js +60 -1
  373. package/lib/utils/replaceVariables.js +14 -1
  374. package/lib/utils/saveTextBeforeHeading.js +35 -1
  375. package/lib/utils/security-details.js +49 -1
  376. package/lib/utils/session-storage.js +12 -1
  377. package/lib/utils/simplifyAstStructure.js +22 -1
  378. package/lib/utils/sort.js +21 -1
  379. package/lib/utils/string.js +65 -1
  380. package/lib/utils/telemetry.js +7 -1
  381. package/lib/utils/test-utils.js +26 -1
  382. package/lib/utils/theme-helpers.js +24 -3
  383. package/lib/utils/url.js +38 -1
  384. package/package.json +4 -4
@@ -1 +1,64 @@
1
- import{jsx as l,Fragment as A}from"react/jsx-runtime";import g,{Fragment as h}from"react";import e from"@markdoc/markdoc";import{useAtomValue as b}from"jotai";import y from"dompurify";import{isString as _}from"@redocly/theme/core/openapi";import{Markdown as z}from"@redocly/theme/components/Markdown/Markdown";import{globalOptionsAtom as R}from"../../jotai/store.js";const S=["OpenApiResponse","OpenApiRequestBody"],W=({source:n,ast:m,htmlWrap:f,markdocOptions:c,...d})=>{const i=b(R);if(!n&&!m)return null;const s=Object.keys(i?.markdocOptions||{}).length?i?.markdocOptions:c,a=s&&{tags:s?.tags,nodes:s?.nodes,partials:s?.partials,variables:s?.variables,functions:s?.functions},u=s&&{components:s?.components};let r;if(n)if(_(n)){const t=i?.unstable_hooks?.sanitize?i.unstable_hooks?.sanitize?.(n):i?.sanitize?y.sanitize(n):n,o=e.parse(t);r=e.transform(o,a)}else{const t=e.Ast.fromJSON(typeof n.result=="object"?JSON.stringify(n.result):n.result);Array.isArray(t)?r=e.transform(t,a):r=e.transform(t,a)}else m&&(r=e.transform(m,a));const p=t=>{const o=e.renderers.react(t,g,u);return l(z,{...d,children:o,as:"div"})};if(!f)return p(r);const O=t=>t.attributes?.htmlWrap!==!1&&!S.includes(t?.name),k=(t,o)=>t?f(p(o)):p(o);return r=Array.isArray(r)?r:r.children,l(A,{children:r.map((t,o)=>l(h,{children:k(O(t),t)},t?.attributes?.id||o))})};export{W as Markdown};
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import React, { Fragment } from 'react';
3
+ import markdoc from '@markdoc/markdoc';
4
+ import { useAtomValue } from 'jotai';
5
+ import DOMPurify from 'dompurify';
6
+ import { isString } from '@redocly/theme/core/openapi';
7
+ import { Markdown as MarkdownWrapper } from '@redocly/theme/components/Markdown/Markdown';
8
+ import { globalOptionsAtom } from '../../jotai/store.js';
9
+ const TAGS_NOT_TO_WRAP = ['OpenApiResponse', 'OpenApiRequestBody'];
10
+ export const Markdown = ({ source, ast, htmlWrap, markdocOptions: markdocOptionsProps, ...props }) => {
11
+ const options = useAtomValue(globalOptionsAtom);
12
+ if (!source && !ast) {
13
+ return null;
14
+ }
15
+ const markdocOptions = Object.keys(options?.markdocOptions || {}).length
16
+ ? options?.markdocOptions
17
+ : markdocOptionsProps;
18
+ const config = markdocOptions && {
19
+ tags: markdocOptions?.tags,
20
+ nodes: markdocOptions?.nodes,
21
+ partials: markdocOptions?.partials,
22
+ variables: markdocOptions?.variables,
23
+ functions: markdocOptions?.functions,
24
+ };
25
+ const components = markdocOptions && {
26
+ components: markdocOptions?.components,
27
+ };
28
+ let nodes;
29
+ if (source) {
30
+ if (isString(source)) {
31
+ const sanitizeSource = options?.unstable_hooks?.sanitize
32
+ ? options.unstable_hooks?.sanitize?.(source)
33
+ : options?.sanitize
34
+ ? DOMPurify.sanitize(source)
35
+ : source;
36
+ const ast = markdoc.parse(sanitizeSource);
37
+ nodes = markdoc.transform(ast, config);
38
+ }
39
+ else {
40
+ const ast = markdoc.Ast.fromJSON(typeof source.result === 'object' ? JSON.stringify(source.result) : source.result);
41
+ if (Array.isArray(ast)) {
42
+ nodes = markdoc.transform(ast, config);
43
+ }
44
+ else {
45
+ nodes = markdoc.transform(ast, config);
46
+ }
47
+ }
48
+ }
49
+ else if (ast) {
50
+ nodes = markdoc.transform(ast, config);
51
+ }
52
+ const htmlRender = (content) => {
53
+ const html = markdoc.renderers.react(content, React, components);
54
+ return _jsx(MarkdownWrapper, { ...props, children: html, as: "div" });
55
+ };
56
+ if (!htmlWrap) {
57
+ return htmlRender(nodes);
58
+ }
59
+ const shouldWrap = (node) => node.attributes?.htmlWrap !== false && !TAGS_NOT_TO_WRAP.includes(node?.name);
60
+ const render = (wrap, content) => (wrap ? htmlWrap(htmlRender(content)) : htmlRender(content));
61
+ nodes = Array.isArray(nodes) ? nodes : nodes.children;
62
+ return (_jsx(_Fragment, { children: nodes.map((item, index) => (_jsx(Fragment, { children: render(shouldWrap(item), item) }, item?.attributes?.id || index))) }));
63
+ };
64
+ //# sourceMappingURL=Markdown.js.map
@@ -1 +1,3 @@
1
- import{Markdown as e}from"./Markdown.js";export*from"./types.js";export{e as Markdown};
1
+ export { Markdown } from './Markdown.js';
2
+ export * from './types.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -1 +1,51 @@
1
- import{jsx as m,jsxs as p,Fragment as g}from"react/jsx-runtime";import{memo as h,useCallback as C,useRef as T}from"react";import{useAtom as v}from"jotai";import{SelectLabel as M,SelectWrapper as w}from"../PayloadSamples/index.js";import{Container as x}from"../common/index.js";import{activeMimeNameAtom as A}from"../../jotai/app.js";import{getActiveMediaType as b}from"../../models/index.js";import{useTranslate as j}from"../../hooks/index.js";function S({children:e,withLabel:i,innerRef:r,translate:a}){return e?i?p(w,{ref:r,children:[m(M,{children:a("openapi.contentType","Content type")}),e]}):m(x,{ref:r,children:e}):null}function B({content:e,withLabel:i,renderSelect:r,children:a}){const u=j(),[c,s]=v(A),f=C(({value:o})=>{if(!e||!t.current)return null;const n=t.current.getBoundingClientRect().y;s(o),requestAnimationFrame(()=>{if(!t.current||n==null)return;const y=t.current.getBoundingClientRect().y;window.scrollBy(0,y-n)})},[e,s]),t=T(null);if(!e||!e.mediaTypes||!e.mediaTypes.length)return null;const d=e.mediaTypes.map((o,n)=>({value:o.name,idx:n})),l=b(e,c);return p(g,{children:[m(S,{innerRef:t,withLabel:i,translate:u,children:r({value:l.name,options:d,onChange:f,ariaLabel:"Content type"})}),a(l)]})}const q=h(B);export{q as MediaTypesSwitch};
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { memo, useCallback, useRef } from 'react';
3
+ import { useAtom } from 'jotai';
4
+ import { SelectLabel, SelectWrapper } from '../PayloadSamples/index.js';
5
+ import { Container } from '../common/index.js';
6
+ import { activeMimeNameAtom } from '../../jotai/app.js';
7
+ import { getActiveMediaType } from '../../models/index.js';
8
+ import { useTranslate } from '../../hooks/index.js';
9
+ function Wrapper({ children, withLabel, innerRef, translate, }) {
10
+ if (!children) {
11
+ return null;
12
+ }
13
+ return withLabel ? (_jsxs(SelectWrapper, { ref: innerRef, children: [_jsx(SelectLabel, { children: translate('openapi.contentType', 'Content type') }), children] })) : (_jsx(Container, { ref: innerRef, children: children }));
14
+ }
15
+ function MediaTypesSwitchComponent({ content, withLabel, renderSelect, children, }) {
16
+ const translate = useTranslate();
17
+ const [activeMimeName, setActiveMimeName] = useAtom(activeMimeNameAtom);
18
+ const switchMedia = useCallback(({ value }) => {
19
+ /* istanbul ignore next (this can never happen, just to make ts happy, this is callback) */
20
+ if (!content || !ref.current)
21
+ return null;
22
+ const initialOffset = ref.current.getBoundingClientRect().y;
23
+ setActiveMimeName(value);
24
+ requestAnimationFrame(() => {
25
+ /* istanbul ignore next (this can never happen, just to make ts happy, this is callback) */
26
+ if (!ref.current || initialOffset == null)
27
+ return;
28
+ const updatedOffset = ref.current.getBoundingClientRect().y;
29
+ window.scrollBy(0, updatedOffset - initialOffset); // TODO: refactor to use ScrollService (make it singleton)
30
+ });
31
+ }, [content, setActiveMimeName]);
32
+ const ref = useRef(null);
33
+ if (!content || !content.mediaTypes || !content.mediaTypes.length) {
34
+ return null;
35
+ }
36
+ const options = content.mediaTypes.map((mime, idx) => {
37
+ return {
38
+ value: mime.name,
39
+ idx,
40
+ };
41
+ });
42
+ const active = getActiveMediaType(content, activeMimeName);
43
+ return (_jsxs(_Fragment, { children: [_jsx(Wrapper, { innerRef: ref, withLabel: withLabel, translate: translate, children: renderSelect({
44
+ value: active.name,
45
+ options,
46
+ onChange: switchMedia,
47
+ ariaLabel: 'Content type',
48
+ }) }), children(active)] }));
49
+ }
50
+ export const MediaTypesSwitch = memo(MediaTypesSwitchComponent);
51
+ //# sourceMappingURL=MediaTypesSwitch.js.map
@@ -1 +1,2 @@
1
- import{MediaTypesSwitch as o}from"./MediaTypesSwitch.js";export{o as MediaTypesSwitch};
1
+ export { MediaTypesSwitch } from './MediaTypesSwitch.js';
2
+ //# sourceMappingURL=index.js.map
@@ -1 +1,9 @@
1
- import{jsx as o,Fragment as t,jsxs as s}from"react/jsx-runtime";import{Markdown as e}from"../Markdown/index.js";import{ExternalDocumentation as m}from"../ExternalDocumentation/index.js";function x({description:r,externalDocs:n}){return r?s(t,{children:[o(e,{source:r}),n&&o(m,{externalDocs:n})]}):null}export{x as Description};
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Markdown } from '../Markdown/index.js';
3
+ import { ExternalDocumentation } from '../ExternalDocumentation/index.js';
4
+ export function Description({ description, externalDocs }) {
5
+ if (!description)
6
+ return null;
7
+ return (_jsxs(_Fragment, { children: [_jsx(Markdown, { source: description }), externalDocs && _jsx(ExternalDocumentation, { externalDocs: externalDocs })] }));
8
+ }
9
+ //# sourceMappingURL=Description.js.map
@@ -1,7 +1,69 @@
1
- import{jsx as e,jsxs as t,Fragment as V}from"react/jsx-runtime";import{memo as K,useState as F,useCallback as j,useMemo as L}from"react";import{useAtomValue as g}from"jotai";import{LayoutVariant as $}from"@redocly/config";import{AfterOpenApiOperation as z}from"@redocly/theme/components/OpenApiDocs/hooks/AfterOpenApiOperation";import{BeforeOpenApiOperation as G}from"@redocly/theme/components/OpenApiDocs/hooks/BeforeOpenApiOperation";import{PageActions as J}from"@redocly/theme/components/PageActions/PageActions";import{Feedback as Q}from"@redocly/theme/components/Feedback/Feedback";import{SamplesMiddlePanel as r,SamplesPanel as U,ShareLink as X,Row as W,CustomBadges as Y}from"../common/index.js";import{CallbacksList as Z}from"../Callbacks/index.js";import{CallbackSamples as ee}from"../CallbackSamples/index.js";import{RequestSamples as ae}from"../RequestSamples/index.js";import{OperationResponseList as te}from"../Responses/index.js";import{ResponseSamples as oe}from"../ResponseSamples/index.js";import{makeDeepLink as ne,joinWithSeparator as se}from"../../services/index.js";import{layoutAtom as re,userClaimsAtom as ie}from"../../jotai/app.js";import{globalOptionsAtom as le,globalStoreAtom as ce}from"../../jotai/store.js";import{getOperation as pe}from"../../models/operation.js";import{RenderHook as B}from"../RenderHook/index.js";import{Heading as de,HeadingWrapper as me,Title as ge}from"../common/OperationItemTitle.js";import{LinkToField as ke}from"../common/LinkToField.js";import{RequestDetails as ue}from"../Request/RequestDetails.js";import{StyledBadge as H}from"../common/Badges.js";import{useTranslate as be}from"../../hooks/index.js";import{styled as k}from"../../styled-components.js";import{createPanelToggleEvent as fe}from"../../events/index.js";function he({item:{operationDefinition:S,parent:v,href:u}}){const s=be(),{parser:y,options:l}=g(ce),{events:x}=g(le),T=g(ie),n=g(re),[c,I]=F(),{unstable_hooks:C,feedback:p}=l,a=L(()=>pe(y,S,v,l,u,void 0,T),[u,S,l,v,y,T]),{name:O,deprecated:_,isWebhook:q,badges:D}=a||{},o=n===$.STACKED,A=p?.type||"sentiment",R=p?.hide!==!0,b=se(l.routingBasePath,a.href),[f,E]=F(null),P=j(m=>{c!==m&&I(m)},[c]),d=j((m,w)=>{if(!w)return;const N=fe({operation:a,isExpanded:m,panelType:w});x?.panelToggle?.(N)},[x,a]),M=L(()=>R?e(Se,{children:e(Q,{type:A,settings:p.settings,path:b})}):null,[R,A,p.settings,b]);return t(ve,{layout:n,children:[e(i,{layout:n,children:t(r,{isStacked:o,children:[e(B,{Hook:G||C?.BeforeOperation,props:{operation:a}}),t(me,{children:[t(de,{"data-testid":"operation-item-header",children:[e(X,{to:u,"aria-label":`link to ${O}`}),e(Y,{badges:D,children:O}),_&&e(H,{deprecated:!0,children:s("openapi.badges.deprecated","Deprecated")}),q&&e(H,{children:s("openapi.badges.webhook","Webhook")})]}),e(J,{pageSlug:b})]})]})}),t(i,{layout:n,children:[e(r,{isStacked:o,children:e(ue,{operation:a,translate:s,onPanelToggle:d})}),e(h,{isStacked:o,"data-testid":"samples-block",className:"panel-container-request-samples",children:e(ae,{operation:a,onPanelToggle:d})})]}),t(i,{layout:n,children:[e(r,{isStacked:o,children:a.responses?.length?e(te,{responses:a.responses,operationId:a.id,operationPointer:a.pointer,callbackId:a.callbackId,activeResponseTab:c,onTabChange:P,onPanelToggle:d}):null}),e(h,{isStacked:o,"data-testid":"samples-block",className:"panel-container-response-samples",children:e(oe,{operation:a,activeResponseTab:c,onTabChange:P,onPanelToggle:d})})]}),t(i,{layout:n,children:[t(r,{isStacked:o,children:[a.callbacks?.length?t(V,{children:[t(ge,{children:[e(ke,{to:ne(a.id,"callbacks")}),s("openapi.callbacks","Callbacks")]}),e(Z,{callbacks:a.callbacks,onExpand:E,selectedCallback:f})]}):null,e(B,{Hook:z||C?.AfterOperation,props:{operation:a}})]}),f?e(h,{isStacked:o,"data-testid":"samples-block",children:e(ee,{callback:f,translate:s})}):null]}),e(i,{layout:n,children:e(r,{isStacked:o,fullWidth:!0,children:M})})]})}const Ge=K(he),h=k(U)`
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { memo, useState, useCallback, useMemo } from 'react';
3
+ import { useAtomValue } from 'jotai';
4
+ import { LayoutVariant } from '@redocly/config';
5
+ import { AfterOpenApiOperation } from '@redocly/theme/components/OpenApiDocs/hooks/AfterOpenApiOperation';
6
+ import { BeforeOpenApiOperation } from '@redocly/theme/components/OpenApiDocs/hooks/BeforeOpenApiOperation';
7
+ import { PageActions } from '@redocly/theme/components/PageActions/PageActions';
8
+ import { Feedback } from '@redocly/theme/components/Feedback/Feedback';
9
+ import { SamplesMiddlePanel, SamplesPanel, ShareLink, Row, CustomBadges } from '../common/index.js';
10
+ import { CallbacksList } from '../Callbacks/index.js';
11
+ import { CallbackSamples } from '../CallbackSamples/index.js';
12
+ import { RequestSamples } from '../RequestSamples/index.js';
13
+ import { OperationResponseList } from '../Responses/index.js';
14
+ import { ResponseSamples } from '../ResponseSamples/index.js';
15
+ import { makeDeepLink, joinWithSeparator } from '../../services/index.js';
16
+ import { layoutAtom, userClaimsAtom } from '../../jotai/app.js';
17
+ import { globalOptionsAtom, globalStoreAtom } from '../../jotai/store.js';
18
+ import { getOperation } from '../../models/operation.js';
19
+ import { RenderHook } from '../RenderHook/index.js';
20
+ import { Heading, HeadingWrapper, Title } from '../common/OperationItemTitle.js';
21
+ import { LinkToField } from '../common/LinkToField.js';
22
+ import { RequestDetails } from '../Request/RequestDetails.js';
23
+ import { StyledBadge } from '../common/Badges.js';
24
+ import { useTranslate } from '../../hooks/index.js';
25
+ import { styled } from '../../styled-components.js';
26
+ import { createPanelToggleEvent } from '../../events/index.js';
27
+ function OperationItemComponent({ item: { operationDefinition, parent, href }, }) {
28
+ const translate = useTranslate();
29
+ const { parser, options } = useAtomValue(globalStoreAtom);
30
+ const { events } = useAtomValue(globalOptionsAtom);
31
+ const userClaims = useAtomValue(userClaimsAtom);
32
+ const layout = useAtomValue(layoutAtom);
33
+ const [activeResponseTab, setActiveResponseTab] = useState();
34
+ const { unstable_hooks, feedback } = options;
35
+ const operation = useMemo(() => getOperation(parser, operationDefinition, parent, options, href, undefined, userClaims), [href, operationDefinition, options, parent, parser, userClaims]);
36
+ const { name: summary, deprecated, isWebhook, badges } = operation || {};
37
+ const isStacked = layout === LayoutVariant.STACKED;
38
+ const feedbackType = feedback?.type || 'sentiment';
39
+ const displayFeedback = feedback?.hide !== true;
40
+ const operationSlug = joinWithSeparator(options.routingBasePath, operation.href);
41
+ const [selectedCallback, setSelectedCallback] = useState(null);
42
+ const handleActiveResponseChange = useCallback((tab) => {
43
+ if (activeResponseTab !== tab) {
44
+ setActiveResponseTab(tab);
45
+ }
46
+ }, [activeResponseTab]);
47
+ const handlePanelToggle = useCallback((isExpanded, panelType) => {
48
+ if (!panelType) {
49
+ return;
50
+ }
51
+ const event = createPanelToggleEvent({
52
+ operation,
53
+ isExpanded,
54
+ panelType,
55
+ });
56
+ events?.panelToggle?.(event);
57
+ }, [events, operation]);
58
+ const renderFeedback = useMemo(() => displayFeedback ? (_jsx(FeedbackWrapper, { children: _jsx(Feedback, { type: feedbackType, settings: feedback.settings, path: operationSlug }) })) : null, [displayFeedback, feedbackType, feedback.settings, operationSlug]);
59
+ return (_jsxs(OperationRow, { layout: layout, children: [_jsx(OperationSubRowStyled, { layout: layout, children: _jsxs(SamplesMiddlePanel, { isStacked: isStacked, children: [_jsx(RenderHook, { Hook: BeforeOpenApiOperation || unstable_hooks?.BeforeOperation, props: { operation } }), _jsxs(HeadingWrapper, { children: [_jsxs(Heading, { "data-testid": "operation-item-header", children: [_jsx(ShareLink, { to: href, "aria-label": `link to ${summary}` }), _jsx(CustomBadges, { badges: badges, children: summary }), deprecated && (_jsx(StyledBadge, { deprecated: true, children: translate('openapi.badges.deprecated', 'Deprecated') })), isWebhook && (_jsx(StyledBadge, { children: translate('openapi.badges.webhook', 'Webhook') }))] }), _jsx(PageActions, { pageSlug: operationSlug })] })] }) }), _jsxs(OperationSubRowStyled, { layout: layout, children: [_jsx(SamplesMiddlePanel, { isStacked: isStacked, children: _jsx(RequestDetails, { operation: operation, translate: translate, onPanelToggle: handlePanelToggle }) }), _jsx(OperationSamplesPanel, { isStacked: isStacked, "data-testid": "samples-block", className: "panel-container-request-samples", children: _jsx(RequestSamples, { operation: operation, onPanelToggle: handlePanelToggle }) })] }), _jsxs(OperationSubRowStyled, { layout: layout, children: [_jsx(SamplesMiddlePanel, { isStacked: isStacked, children: operation.responses?.length ? (_jsx(OperationResponseList, { responses: operation.responses, operationId: operation.id, operationPointer: operation.pointer, callbackId: operation.callbackId, activeResponseTab: activeResponseTab, onTabChange: handleActiveResponseChange, onPanelToggle: handlePanelToggle })) : null }), _jsx(OperationSamplesPanel, { isStacked: isStacked, "data-testid": "samples-block", className: "panel-container-response-samples", children: _jsx(ResponseSamples, { operation: operation, activeResponseTab: activeResponseTab, onTabChange: handleActiveResponseChange, onPanelToggle: handlePanelToggle }) })] }), _jsxs(OperationSubRowStyled, { layout: layout, children: [_jsxs(SamplesMiddlePanel, { isStacked: isStacked, children: [operation.callbacks?.length ? (_jsxs(_Fragment, { children: [_jsxs(Title, { children: [_jsx(LinkToField, { to: makeDeepLink(operation.id, 'callbacks') }), translate('openapi.callbacks', 'Callbacks')] }), _jsx(CallbacksList, { callbacks: operation.callbacks, onExpand: setSelectedCallback, selectedCallback: selectedCallback })] })) : null, _jsx(RenderHook, { Hook: AfterOpenApiOperation || unstable_hooks?.AfterOperation, props: { operation } })] }), selectedCallback ? (_jsx(OperationSamplesPanel, { isStacked: isStacked, "data-testid": "samples-block", children: _jsx(CallbackSamples, { callback: selectedCallback, translate: translate }) })) : null] }), _jsx(OperationSubRowStyled, { layout: layout, children: _jsx(SamplesMiddlePanel, { isStacked: isStacked, fullWidth: true, children: renderFeedback }) })] }));
60
+ }
61
+ export const OperationItem = memo(OperationItemComponent);
62
+ export const OperationSamplesPanel = styled(SamplesPanel) `
2
63
  margin-left: auto;
3
64
  --code-block-padding: var(--spacing-xs) 0 var(--spacing-xs) 20px;
4
- `,Se=k.div`
65
+ `;
66
+ const FeedbackWrapper = styled.div `
5
67
  & > div {
6
68
  flex: 1 1 auto;
7
69
  display: flex;
@@ -12,10 +74,13 @@ import{jsx as e,jsxs as t,Fragment as V}from"react/jsx-runtime";import{memo as K
12
74
  width: 100%;
13
75
  max-width: var(--feedback-width);
14
76
  }
15
- `,ve=k(W)`
77
+ `;
78
+ const OperationRow = styled(Row) `
16
79
  flex-direction: column;
17
80
  align-items: flex-start;
18
81
  padding: var(--spacing-base) 0 calc(var(--spacing-xl) + var(--spacing-xs));
19
- `,i=k(W)`
82
+ `;
83
+ const OperationSubRowStyled = styled(Row) `
20
84
  margin: calc(var(--spacing-unit) * 2) 0;
21
- `;export{Ge as OperationItem,h as OperationSamplesPanel};
85
+ `;
86
+ //# sourceMappingURL=OperationItem.js.map
@@ -1 +1,70 @@
1
- import{jsx as o}from"react/jsx-runtime";import{render as n}from"@testing-library/react";import{BrowserRouter as i}from"react-router-dom";import{OperationItem as s}from"../OperationItem";import{normalizeOptions as m}from"../../../services";import p from"./fixtures/petstore.json";import a from"./fixtures/operationDefinition.json";import{environmentAtom as r}from"../../../jotai/app";import{globalStoreAtom as f}from"../../../jotai/store";import{allOperationsAtom as l}from"../../../jotai/replay";import{MockIntersectionObserver as c}from"./__mocks__/mock-intersection-observer";jest.mock("jotai",()=>({...jest.requireActual("jotai"),useAtomValue:jest.fn(e=>e===f?{parser:{definition:p},options:m({codeSamples:{languages:[{lang:"curl",label:"curl"}]}})}:e===r?[{},""]:e===l?[]:{}),useAtom:jest.fn(e=>e===r?[[{server:{}}],jest.fn()]:[{activeOneOf:{"/paths/~1pet/post":0},requestValues:{},request:{expandedFields:{}},response:{expandedFields:{}},activeLanguage:"curl"},jest.fn()])})),describe("OperationItem",()=>{beforeAll(()=>{window.IntersectionObserver=c}),it("should render badges with correct position",()=>{const{getByTestId:e}=n(o(s,{item:{operationDefinition:a,parent:void 0,href:"test"}}),{wrapper:i}),t=e("operation-item-header").childNodes;expect(t[1].textContent).toBe("Alpha"),expect(t[3].textContent).toBe("Beta"),expect(t[4].textContent).toBe("Gamma")})});
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render } from '@testing-library/react';
3
+ import { BrowserRouter } from 'react-router-dom';
4
+ import { OperationItem } from '../OperationItem';
5
+ import { normalizeOptions } from '../../../services';
6
+ import spec from './fixtures/petstore.json';
7
+ import definition from './fixtures/operationDefinition.json';
8
+ import { environmentAtom } from '../../../jotai/app';
9
+ import { globalStoreAtom } from '../../../jotai/store';
10
+ import { allOperationsAtom } from '../../../jotai/replay';
11
+ import { MockIntersectionObserver } from './__mocks__/mock-intersection-observer';
12
+ jest.mock('jotai', () => ({
13
+ ...jest.requireActual('jotai'),
14
+ useAtomValue: jest.fn((a) => {
15
+ if (a === globalStoreAtom) {
16
+ return {
17
+ parser: {
18
+ definition: spec,
19
+ },
20
+ options: normalizeOptions({
21
+ codeSamples: {
22
+ languages: [{ lang: 'curl', label: 'curl' }],
23
+ },
24
+ }),
25
+ };
26
+ }
27
+ if (a === environmentAtom) {
28
+ return [{}, ''];
29
+ }
30
+ if (a === allOperationsAtom) {
31
+ return [];
32
+ }
33
+ return {};
34
+ }),
35
+ useAtom: jest.fn((a) => {
36
+ if (a === environmentAtom) {
37
+ return [[{ server: {} }], jest.fn()];
38
+ }
39
+ return [
40
+ {
41
+ activeOneOf: { '/paths/~1pet/post': 0 },
42
+ requestValues: {},
43
+ request: { expandedFields: {} },
44
+ response: { expandedFields: {} },
45
+ activeLanguage: 'curl',
46
+ },
47
+ jest.fn(),
48
+ ];
49
+ }),
50
+ }));
51
+ describe('OperationItem', () => {
52
+ beforeAll(() => {
53
+ window.IntersectionObserver = MockIntersectionObserver;
54
+ });
55
+ it('should render badges with correct position', () => {
56
+ const { getByTestId } = render(_jsx(OperationItem, { item: {
57
+ operationDefinition: definition,
58
+ parent: undefined,
59
+ href: 'test',
60
+ } }), {
61
+ wrapper: BrowserRouter,
62
+ });
63
+ const parentElement = getByTestId('operation-item-header');
64
+ const childNodes = parentElement.childNodes;
65
+ expect(childNodes[1].textContent).toBe('Alpha');
66
+ expect(childNodes[3].textContent).toBe('Beta');
67
+ expect(childNodes[4].textContent).toBe('Gamma');
68
+ });
69
+ });
70
+ //# sourceMappingURL=OperationItem.test.js.map
@@ -1 +1,40 @@
1
- class i{root;rootMargin;thresholds;viewPort;entries;callback;constructor(t,e){this.viewPort=e?.root?e.root:window,this.entries=[],this.root=null,this.rootMargin="0px",this.thresholds=[1],this.callback=t,this.viewPort.addEventListener("scroll",this.intersect)}intersect=()=>{this.entries.map(t=>{t.isIntersecting=this.isInViewPort(t.target)}),this.callback(this.entries,this)};isInViewPort(t){return t.id!=="toc-0"}observe(t){this.entries.push({isIntersecting:!1,target:t})}unobserve(t){this.entries=this.entries.filter(e=>e.target!==t)}disconnect(){this.viewPort.removeEventListener("scroll",this.intersect),this.entries=[]}takeRecords(){return this.entries}}export{i as MockIntersectionObserver};
1
+ export class MockIntersectionObserver {
2
+ root;
3
+ rootMargin;
4
+ thresholds;
5
+ viewPort;
6
+ entries;
7
+ callback;
8
+ constructor(callback, options) {
9
+ this.viewPort = options?.root ? options.root : window;
10
+ this.entries = [];
11
+ this.root = null;
12
+ this.rootMargin = '0px';
13
+ this.thresholds = [1];
14
+ this.callback = callback;
15
+ this.viewPort.addEventListener('scroll', this.intersect);
16
+ }
17
+ intersect = () => {
18
+ this.entries.map((entry) => {
19
+ entry.isIntersecting = this.isInViewPort(entry.target);
20
+ });
21
+ this.callback(this.entries, this);
22
+ };
23
+ isInViewPort(target) {
24
+ return target.id !== 'toc-0';
25
+ }
26
+ observe(target) {
27
+ this.entries.push({ isIntersecting: false, target });
28
+ }
29
+ unobserve(target) {
30
+ this.entries = this.entries.filter((ob) => ob.target !== target);
31
+ }
32
+ disconnect() {
33
+ this.viewPort.removeEventListener('scroll', this.intersect);
34
+ this.entries = [];
35
+ }
36
+ takeRecords() {
37
+ return this.entries;
38
+ }
39
+ }
40
+ //# sourceMappingURL=mock-intersection-observer.js.map
@@ -1 +1,2 @@
1
- import{OperationItem as r}from"./OperationItem.js";export{r as OperationItem};
1
+ export { OperationItem } from './OperationItem.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -1,4 +1,47 @@
1
- import{jsx as i,jsxs as t}from"react/jsx-runtime";import{useState as o,useEffect as m}from"react";import{styled as s}from"../styled-components.js";const n="Invalid license key",g=n+": missing key",d="Invalid license key: expired",y=d,v="Invalid license key: host not allowed",E=({licenseInfo:e})=>{const[r,a]=o(null),[l,h]=o(-1),[p,x]=o(!1);return m(()=>{if(e.local){x(!0);return}e.valid?e.allowed?e.expired&&a(e.t?d:y):a(v):a(e.valid===!1?n+(e.cryptoMissing?": works only with https":""):g),e.t&&h(Math.ceil(((e?.e??0)-Date.now()/1e3)/60/60/24))},[e]),p?t(c,{children:[i("a",{href:"https://redoc.ly",children:"Redocly API reference docs"})," preview"]}):!r&&l>-1?t(c,{children:[" Trial version: ",l," days remaining "]}):r?i(f,{children:t("span",{children:[r," ",i("br",{}),t("small",{children:["Please contact ",i("a",{href:"mailto:team@redoc.ly",children:"team@redoc.ly"})," to remedy the problem."," "]})]})}):null},c=s.div`
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, useEffect } from 'react';
3
+ import { styled } from '../styled-components.js';
4
+ const INVALID_KEY = 'Invalid license key';
5
+ const INVALID_KEY_MISSING = INVALID_KEY + ': missing key';
6
+ const EXPIRED = 'Invalid license key: expired';
7
+ const TRIAL_EXPIRED = EXPIRED;
8
+ const INVALID_HOST = 'Invalid license key: host not allowed';
9
+ export const Overlay = ({ licenseInfo }) => {
10
+ const [m, setM] = useState(null); // error message
11
+ const [exp, setExp] = useState(-1); // expires in
12
+ const [local, setLocal] = useState(false); // local preview?
13
+ useEffect(() => {
14
+ if (licenseInfo.local) {
15
+ setLocal(true);
16
+ return;
17
+ }
18
+ if (!licenseInfo.valid) {
19
+ setM(licenseInfo.valid === false
20
+ ? INVALID_KEY + (licenseInfo.cryptoMissing ? ': works only with https' : '')
21
+ : INVALID_KEY_MISSING);
22
+ }
23
+ else if (!licenseInfo.allowed) {
24
+ setM(INVALID_HOST);
25
+ }
26
+ else if (licenseInfo.expired) {
27
+ setM(licenseInfo.t ? EXPIRED : TRIAL_EXPIRED);
28
+ }
29
+ if (licenseInfo.t) {
30
+ setExp(Math.ceil(((licenseInfo?.e ?? 0) - Date.now() / 1000) / 60 / 60 / 24));
31
+ }
32
+ }, [licenseInfo]);
33
+ if (local) {
34
+ return (_jsxs(TrialWrap, { children: [_jsx("a", { href: "https://redoc.ly", children: "Redocly API reference docs" }), " preview"] }));
35
+ }
36
+ if (!m && exp > -1) {
37
+ return _jsxs(TrialWrap, { children: [" Trial version: ", exp, " days remaining "] });
38
+ }
39
+ if (m) {
40
+ return (_jsx(Flash, { children: _jsxs("span", { children: [m, " ", _jsx("br", {}), _jsxs("small", { children: ["Please contact ", _jsx("a", { href: "mailto:team@redoc.ly", children: "team@redoc.ly" }), " to remedy the problem.", ' '] })] }) }));
41
+ }
42
+ return null;
43
+ };
44
+ const TrialWrap = styled.div `
2
45
  padding: 10px 40px;
3
46
  position: fixed;
4
47
  text-align: right;
@@ -12,7 +55,8 @@ import{jsx as i,jsxs as t}from"react/jsx-runtime";import{useState as o,useEffect
12
55
  a:visited {
13
56
  color: orange;
14
57
  }
15
- `,f=s.div`
58
+ `;
59
+ const Flash = styled.div `
16
60
  font-size: 1.5em;
17
61
  position: fixed;
18
62
  z-index: var(--z-index-raised);
@@ -39,4 +83,5 @@ import{jsx as i,jsxs as t}from"react/jsx-runtime";import{useState as o,useEffect
39
83
  a:visited {
40
84
  color: white;
41
85
  }
42
- `;export{E as Overlay};
86
+ `;
87
+ //# sourceMappingURL=Overlay.js.map
@@ -1 +1,20 @@
1
- import{jsx as t,jsxs as s,Fragment as u}from"react/jsx-runtime";import{CopyButton as d}from"@redocly/theme/components/Buttons/CopyButton";import{NewTabButton as c}from"@redocly/theme/components/Buttons/NewTabButton";import{EmailButton as p}from"@redocly/theme/components/Buttons/EmailButton";import{PanelItem as a,PanelItemDescription as n,PanelItemsList as h}from"../PanelItem/index.js";function _({info:e,translate:r}){const l=e.contact&&e.contact.url&&t(a,{header:t(n,{children:r("openapi.info.contact.url","URL")}),title:t("a",{href:e.contact.url,target:"_blank",rel:"noreferrer",children:e.contact.url}),actions:[t(c,{data:e.contact.url},"NewTabButton")]})||null,i=e.contact&&e.contact.email&&t(a,{header:t(n,{children:e.contact.name||r("openapi.info.contact.name","E-mail")}),title:t("a",{href:"mailto:"+e.contact.email,children:e.contact.email}),actions:[t(d,{data:e.contact.email},"CopyButton"),t(p,{data:e.contact.email},"EmailButton")]})||null,o=e.license&&t(a,{header:t(n,{children:r("openapi.info.license","License")}),title:e.license.identifier?e.license.identifier:t("a",{href:e.license.url,target:"_blank",rel:"noreferrer",children:e.license.name}),actions:[t(c,{data:e.license.url||""},"NewTabButton")]})||null,m=e.termsOfService&&t(a,{title:t("a",{href:e.termsOfService,target:"_blank",rel:"noreferrer",children:r("openapi.info.termsOfService","Terms of Service")}),actions:[t(c,{data:e.termsOfService},e.termsOfService)]})||null;return t(u,{children:s(h,{children:[l,i,o,m]})})}export{_ as Overview};
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { CopyButton } from '@redocly/theme/components/Buttons/CopyButton';
3
+ import { NewTabButton } from '@redocly/theme/components/Buttons/NewTabButton';
4
+ import { EmailButton } from '@redocly/theme/components/Buttons/EmailButton';
5
+ import { PanelItem, PanelItemDescription, PanelItemsList } from '../PanelItem/index.js';
6
+ export function Overview({ info, translate }) {
7
+ const website = (info.contact && info.contact.url && (_jsx(PanelItem, { header: _jsx(PanelItemDescription, { children: translate('openapi.info.contact.url', 'URL') }), title: _jsx("a", { href: info.contact.url, target: "_blank", rel: "noreferrer", children: info.contact.url }), actions: [_jsx(NewTabButton, { data: info.contact.url }, "NewTabButton")] }))) ||
8
+ null;
9
+ const email = (info.contact && info.contact.email && (_jsx(PanelItem, { header: _jsx(PanelItemDescription, { children: info.contact.name || translate('openapi.info.contact.name', 'E-mail') }), title: _jsx("a", { href: 'mailto:' + info.contact.email, children: info.contact.email }), actions: [
10
+ _jsx(CopyButton, { data: info.contact.email }, "CopyButton"),
11
+ _jsx(EmailButton, { data: info.contact.email }, "EmailButton"),
12
+ ] }))) ||
13
+ null;
14
+ const license = (info.license && (_jsx(PanelItem, { header: _jsx(PanelItemDescription, { children: translate('openapi.info.license', 'License') }), title: info.license.identifier ? (info.license.identifier) : (_jsx("a", { href: info.license.url, target: "_blank", rel: "noreferrer", children: info.license.name })), actions: [_jsx(NewTabButton, { data: info.license.url || '' }, "NewTabButton")] }))) ||
15
+ null;
16
+ const terms = (info.termsOfService && (_jsx(PanelItem, { title: _jsx("a", { href: info.termsOfService, target: "_blank", rel: "noreferrer", children: translate('openapi.info.termsOfService', 'Terms of Service') }), actions: [_jsx(NewTabButton, { data: info.termsOfService }, info.termsOfService)] }))) ||
17
+ null;
18
+ return (_jsx(_Fragment, { children: _jsxs(PanelItemsList, { children: [website, email, license, terms] }) }));
19
+ }
20
+ //# sourceMappingURL=Overview.js.map
@@ -1 +1,2 @@
1
- import{Overview as o}from"./Overview.js";export{o as Overview};
1
+ export { Overview } from './Overview.js';
2
+ //# sourceMappingURL=index.js.map
@@ -1 +1,19 @@
1
- import{jsx as e}from"react/jsx-runtime";import{memo as t}from"react";import{useAtomValue as n}from"jotai";import{OpenApiFooter as r}from"@redocly/theme/components/OpenApiDocs/hooks/OpenApiFooter";import{globalOptionsAtom as m}from"../../jotai/store.js";import{RenderHook as p}from"../RenderHook/index.js";function s(){const{unstable_hooks:{MiddlePanelFooter:o}}=n(m);switch(!0){case!!o:return e(p,{Hook:o,props:void 0});case!!r:return e(r,{});default:return null}}const d=t(s);export{d as PageFooter,s as PageFooterComponent};
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { useAtomValue } from 'jotai';
4
+ import { OpenApiFooter } from '@redocly/theme/components/OpenApiDocs/hooks/OpenApiFooter';
5
+ import { globalOptionsAtom } from '../../jotai/store.js';
6
+ import { RenderHook } from '../RenderHook/index.js';
7
+ export function PageFooterComponent() {
8
+ const { unstable_hooks: { MiddlePanelFooter }, } = useAtomValue(globalOptionsAtom);
9
+ switch (true) {
10
+ case Boolean(MiddlePanelFooter):
11
+ return _jsx(RenderHook, { Hook: MiddlePanelFooter, props: undefined });
12
+ case Boolean(OpenApiFooter):
13
+ return _jsx(OpenApiFooter, {});
14
+ default:
15
+ return null;
16
+ }
17
+ }
18
+ export const PageFooter = memo(PageFooterComponent);
19
+ //# sourceMappingURL=PageFooter.js.map
@@ -1 +1,2 @@
1
- import{PageFooter as r}from"./PageFooter.js";export{r as PageFooter};
1
+ export { PageFooter } from './PageFooter.js';
2
+ //# sourceMappingURL=index.js.map
@@ -1,24 +1,30 @@
1
- import{Panel as o}from"@redocly/theme/components/Panel/Panel";import{FieldsGroupHeader as e}from"../common/headers.js";import{Trigger as r}from"./Trigger.js";import{styled as t}from"../../styled-components.js";const i=t(o)`
2
- ${e} {
1
+ import { Panel } from '@redocly/theme/components/Panel/Panel';
2
+ import { FieldsGroupHeader } from '../common/headers.js';
3
+ import { Trigger } from './Trigger.js';
4
+ import { styled } from '../../styled-components.js';
5
+ export const StyledResponsePanel = styled(Panel) `
6
+ ${FieldsGroupHeader} {
3
7
  &:first-child {
4
8
  margin-top: 0;
5
9
  }
6
10
  }
7
11
 
8
- ${r} {
12
+ ${Trigger} {
9
13
  flex: 1;
10
14
  max-width: 100%;
11
15
  justify-content: space-between;
12
16
  }
13
- `,d=t(i)`
17
+ `;
18
+ export const CallbackPanel = styled(StyledResponsePanel) `
14
19
  border-bottom: 1px solid var(--border-color-primary);
15
20
  &:not(:last-child) {
16
21
  margin-bottom: 0;
17
22
  border-radius: 0;
18
23
  }
19
24
 
20
- ${r} {
25
+ ${Trigger} {
21
26
  max-width: calc(100% - 9px - var(--spacing-unit)); /* shelf icon size and small padding */
22
27
  justify-content: flex-start;
23
28
  }
24
- `;export{d as CallbackPanel,i as StyledResponsePanel};
29
+ `;
30
+ //# sourceMappingURL=ResponsePanel.js.map
@@ -1,7 +1,9 @@
1
- import{styled as e}from"../../styled-components.js";const l=e.div`
1
+ import { styled } from '../../styled-components.js';
2
+ export const Trigger = styled.div `
2
3
  display: inline-flex;
3
4
  align-items: center;
4
5
  white-space: nowrap;
5
6
  overflow: hidden;
6
7
  text-overflow: ellipsis;
7
- `;export{l as Trigger};
8
+ `;
9
+ //# sourceMappingURL=Trigger.js.map
@@ -1 +1,3 @@
1
- export*from"./Trigger.js";export*from"./ResponsePanel.js";
1
+ export * from './Trigger.js';
2
+ export * from './ResponsePanel.js';
3
+ //# sourceMappingURL=index.js.map
@@ -1 +1,6 @@
1
- import{jsx as n,jsxs as t}from"react/jsx-runtime";import{PanelItemWrap as l,Item as m,Header as p,Title as a,ActionsWrap as d,StyledCheckmarkIcon as x}from"./styled.js";const f=({header:r,title:s,actions:i,active:e,withCheckmark:o})=>t(l,{children:[t(m,{children:[r&&(typeof r=="string"?n(p,{children:r}):r),t(a,{active:e,suppressHydrationWarning:!0,children:[o&&e&&n(x,{})," ",s]})]}),n(d,{children:i?.map(c=>c)})]});export{f as PanelItem};
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { PanelItemWrap, Item, Header, Title, ActionsWrap, StyledCheckmarkIcon } from './styled.js';
3
+ export const PanelItem = ({ header, title, actions, active, withCheckmark }) => {
4
+ return (_jsxs(PanelItemWrap, { children: [_jsxs(Item, { children: [header && (typeof header === 'string' ? _jsx(Header, { children: header }) : header), _jsxs(Title, { active: active, suppressHydrationWarning: true, children: [withCheckmark && active && _jsx(StyledCheckmarkIcon, {}), " ", title] })] }), _jsx(ActionsWrap, { children: actions?.map((action) => action) })] }));
5
+ };
6
+ //# sourceMappingURL=PanelItem.js.map
@@ -1 +1,3 @@
1
- import{PanelItem as r}from"./PanelItem.js";export*from"./styled.js";export{r as PanelItem};
1
+ export { PanelItem } from './PanelItem.js';
2
+ export * from './styled.js';
3
+ //# sourceMappingURL=index.js.map