@redocly/reference-docs 2.11.0 → 2.11.4

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 (326) hide show
  1. package/bin/cli/commands/redocly-docs-cli.min.js +41 -42
  2. package/bin/cli/commands/redocly-docs-cli.min.js.LICENSE.txt +1 -1
  3. package/dist/console.redocly-reference-docs.min.js +119 -120
  4. package/dist/oauth2-redirect.js +1 -1
  5. package/dist/redocly-reference-docs.min.js +561 -561
  6. package/lib/components/Endpoint/CopyLink.d.ts +1 -1
  7. package/lib/components/Endpoint/Path.d.ts +2 -2
  8. package/lib/components/Endpoint/ServerItem.d.ts +1 -1
  9. package/lib/components/Endpoint/ServerUrl.d.ts +1 -1
  10. package/lib/components/NextSectionButton.d.ts +2 -2
  11. package/lib/components/Panel/CallbackPanel.d.ts +1 -1
  12. package/lib/components/Panel/CallbackPanel.js +1 -1
  13. package/lib/components/Panel/CodeHeader.d.ts +1 -1
  14. package/lib/components/Panel/CodePanel.d.ts +1 -1
  15. package/lib/components/Panel/ContentPanel.d.ts +1 -1
  16. package/lib/components/Panel/DarkHeader.d.ts +1 -1
  17. package/lib/components/Panel/Header.d.ts +1 -1
  18. package/lib/components/Panel/Panel.d.ts +1 -1
  19. package/lib/components/Panel/PanelBody.d.ts +1 -1
  20. package/lib/components/Panel/ResponsePanel.d.ts +1 -1
  21. package/lib/components/Panel/ScrollableContentPanel.d.ts +1 -1
  22. package/lib/components/Panel/Title.d.ts +1 -1
  23. package/lib/components/Panel/Trigger.d.ts +1 -1
  24. package/lib/components/RedoclyReferenceDocs.d.ts +1 -1
  25. package/lib/components/Samples/LoadingWrapper.d.ts +1 -1
  26. package/lib/components/Search/styled.d.ts +10 -10
  27. package/lib/components/Tabs/CollapsingTabs/CollapsingDropdown.d.ts +1 -1
  28. package/lib/components/Tabs/CollapsingTabs/CollapsingTab.d.ts +1 -1
  29. package/lib/components/Tabs/CollapsingTabs/CollapsingTabList.d.ts +1 -1
  30. package/lib/components/Tabs/SmallTab.d.ts +1 -1
  31. package/lib/components/Tabs/Tab.d.ts +1 -1
  32. package/lib/components/Tabs/TabList.d.ts +1 -1
  33. package/lib/components/Tabs/TabPanel.d.ts +1 -1
  34. package/lib/components/common/Checkbox.d.ts +1 -1
  35. package/lib/components/common/CheckboxList.d.ts +2 -2
  36. package/lib/components/common/CheckboxList.js +1 -1
  37. package/lib/components/common/FileUpload/FileUpload.d.ts +2 -2
  38. package/lib/components/common/FileUpload/FileUpload.js +1 -1
  39. package/lib/components/common/FileUpload/helper.d.ts +5 -5
  40. package/lib/components/common/FileUpload/helper.js +1 -1
  41. package/lib/components/common/LinearProgress.js +1 -1
  42. package/lib/components/common/TextField.d.ts +2 -2
  43. package/lib/components/common/form.d.ts +12 -12
  44. package/lib/components/console/ActionPanel.d.ts +6 -4
  45. package/lib/components/console/ActionPanel.js +1 -1
  46. package/lib/components/console/AuthPanel.d.ts +6 -5
  47. package/lib/components/console/CodemirrorInput.d.ts +4 -1
  48. package/lib/components/console/Console.d.ts +10 -12
  49. package/lib/components/console/Console.js +1 -1
  50. package/lib/components/console/OAuth2Flow.d.ts +1 -1
  51. package/lib/components/console/OAuth2TokenInput.d.ts +2 -2
  52. package/lib/components/console/OAuth2TokenInput.js +1 -1
  53. package/lib/components/console/ParameterDropdown.js +1 -1
  54. package/lib/components/console/RequestBody.d.ts +1 -1
  55. package/lib/components/console/RequestBody.js +1 -1
  56. package/lib/components/console/RequestBodyForm.d.ts +3 -4
  57. package/lib/components/console/RequestBodyForm.js +1 -1
  58. package/lib/components/console/RequestMimeLabel.d.ts +1 -1
  59. package/lib/components/console/ResponsePanel.d.ts +3 -3
  60. package/lib/components/console/ResponsePanel.js +1 -1
  61. package/lib/components/console/ServerDropdown.d.ts +8 -6
  62. package/lib/components/console/ServerDropdown.js +1 -1
  63. package/lib/components/console/styled.components.d.ts +4 -4
  64. package/lib/components/console/utils.d.ts +5 -19
  65. package/lib/components/console/utils.js +1 -1
  66. package/lib/components/pluggable/RedocResponse.js +1 -1
  67. package/lib/components/pluggable/styled.components.d.ts +4 -3
  68. package/lib/components/shared/Button.d.ts +3 -4
  69. package/lib/components/shared/CopyButton.js +1 -1
  70. package/lib/components/shared/HttpVerb.d.ts +1 -1
  71. package/lib/components/shared/MimeLabel.d.ts +1 -1
  72. package/lib/components/shared/NoSampleLabel.d.ts +2 -2
  73. package/lib/components/styled.elements.d.ts +10 -9
  74. package/lib/hooks/index.d.ts +2 -0
  75. package/lib/hooks/index.js +2 -0
  76. package/lib/hooks/useMount.d.ts +1 -0
  77. package/lib/hooks/useMount.js +2 -0
  78. package/lib/hooks/useUnmount.d.ts +1 -0
  79. package/lib/hooks/useUnmount.js +2 -0
  80. package/lib/redoc-lib/src/common-elements/CopyButtonWrapper.d.ts +5 -5
  81. package/lib/redoc-lib/src/common-elements/LinkToField.d.ts +3 -4
  82. package/lib/redoc-lib/src/common-elements/LinkToField.js +1 -1
  83. package/lib/redoc-lib/src/common-elements/PrismDiv.d.ts +1 -1
  84. package/lib/redoc-lib/src/common-elements/Tooltip.d.ts +2 -2
  85. package/lib/redoc-lib/src/common-elements/Tooltip.js +1 -1
  86. package/lib/redoc-lib/src/common-elements/dropdown.d.ts +4 -4
  87. package/lib/redoc-lib/src/common-elements/fields-layout.d.ts +9 -9
  88. package/lib/redoc-lib/src/common-elements/fields.d.ts +13 -13
  89. package/lib/redoc-lib/src/common-elements/headers.d.ts +6 -6
  90. package/lib/redoc-lib/src/common-elements/icons.d.ts +5 -5
  91. package/lib/redoc-lib/src/common-elements/linkify.d.ts +5 -5
  92. package/lib/redoc-lib/src/common-elements/linkify.js +1 -1
  93. package/lib/redoc-lib/src/common-elements/panels.d.ts +5 -5
  94. package/lib/redoc-lib/src/common-elements/perfect-scrollbar.d.ts +3 -5
  95. package/lib/redoc-lib/src/common-elements/perfect-scrollbar.js +1 -1
  96. package/lib/redoc-lib/src/common-elements/samples.d.ts +4 -4
  97. package/lib/redoc-lib/src/common-elements/schema.d.ts +5 -5
  98. package/lib/redoc-lib/src/common-elements/shelfs.d.ts +1 -1
  99. package/lib/redoc-lib/src/components/ApiInfo/styled.elements.d.ts +5 -5
  100. package/lib/redoc-lib/src/components/ApiLogo/styled.elements.d.ts +2 -2
  101. package/lib/redoc-lib/src/components/CallbackSamples/CallbackReqSamples.d.ts +1 -1
  102. package/lib/redoc-lib/src/components/CallbackSamples/CallbackSamples.d.ts +1 -1
  103. package/lib/redoc-lib/src/components/Callbacks/CallbackSummary.js +1 -1
  104. package/lib/redoc-lib/src/components/Callbacks/CallbackTitle.d.ts +1 -1
  105. package/lib/redoc-lib/src/components/DownloadButton/DownloadButton.d.ts +1 -1
  106. package/lib/redoc-lib/src/components/DownloadButton/DownloadButton.js +1 -1
  107. package/lib/redoc-lib/src/components/ErrorBoundary.d.ts +4 -4
  108. package/lib/redoc-lib/src/components/ErrorBoundary.js +1 -1
  109. package/lib/redoc-lib/src/components/Fields/EnumValues.d.ts +1 -1
  110. package/lib/redoc-lib/src/components/Fields/Field.d.ts +1 -1
  111. package/lib/redoc-lib/src/components/GenericChildrenSwitcher/GenericChildrenSwitcher.d.ts +2 -4
  112. package/lib/redoc-lib/src/components/GenericChildrenSwitcher/GenericChildrenSwitcher.js +1 -1
  113. package/lib/redoc-lib/src/components/JsonViewer/JsonViewer.d.ts +2 -2
  114. package/lib/redoc-lib/src/components/JsonViewer/JsonViewer.js +1 -1
  115. package/lib/redoc-lib/src/components/JsonViewer/style.d.ts +1 -1
  116. package/lib/redoc-lib/src/components/Loading/Spinner.svg.d.ts +1 -1
  117. package/lib/redoc-lib/src/components/Markdown/AdvancedMarkdown.d.ts +3 -1
  118. package/lib/redoc-lib/src/components/Markdown/styled.elements.d.ts +4 -5
  119. package/lib/redoc-lib/src/components/Parameters/Parameters.js +1 -1
  120. package/lib/redoc-lib/src/components/Parameters/ParametersGroup.d.ts +1 -1
  121. package/lib/redoc-lib/src/components/PayloadSamples/PayloadSamples.d.ts +1 -1
  122. package/lib/redoc-lib/src/components/PayloadSamples/PayloadSamples.js +1 -1
  123. package/lib/redoc-lib/src/components/PayloadSamples/styled.elements.d.ts +3 -3
  124. package/lib/redoc-lib/src/components/RequestSamples/useCodeSamples.d.ts +7 -3
  125. package/lib/redoc-lib/src/components/ResponseSamples/ResponseSamples.d.ts +1 -1
  126. package/lib/redoc-lib/src/components/ResponseSamples/ResponseSamples.js +1 -1
  127. package/lib/redoc-lib/src/components/Responses/ResponseSummary.d.ts +1 -1
  128. package/lib/redoc-lib/src/components/Responses/styled.elements.d.ts +1 -1
  129. package/lib/redoc-lib/src/components/Schema/ObjectSchema.d.ts +3 -2
  130. package/lib/redoc-lib/src/components/Schema/ObjectSchema.js +1 -1
  131. package/lib/redoc-lib/src/components/Schema/OneOfSchema.js +1 -1
  132. package/lib/redoc-lib/src/components/SearchBox/SearchBox.d.ts +1 -1
  133. package/lib/redoc-lib/src/components/SearchBox/SearchBox.js +1 -1
  134. package/lib/redoc-lib/src/components/SearchBox/styled.elements.d.ts +5 -5
  135. package/lib/redoc-lib/src/components/SecuritySchemes/SecuritySchemes.js +1 -1
  136. package/lib/redoc-lib/src/components/SideMenu/MenuItem.d.ts +3 -5
  137. package/lib/redoc-lib/src/components/SideMenu/styled.elements.d.ts +7 -7
  138. package/lib/redoc-lib/src/services/OpenAPIParser.d.ts +3 -3
  139. package/lib/redoc-lib/src/services/OpenAPIParser.js +1 -1
  140. package/lib/redoc-lib/src/services/ScrollService.js +1 -1
  141. package/lib/redoc-lib/src/services/SearchWorker.worker.d.ts +1 -1
  142. package/lib/redoc-lib/src/services/models/Operation.d.ts +2 -2
  143. package/lib/redoc-lib/src/styled-components.d.ts +3 -2
  144. package/lib/redoc-lib/src/utils/decorators.d.ts +1 -1
  145. package/lib/redoc-lib/src/utils/helpers.d.ts +2 -2
  146. package/lib/redoc-lib/src/utils/loadAndBundleSpec.d.ts +1 -1
  147. package/lib/redoc-lib/src/utils/media-css.d.ts +1 -1
  148. package/lib/redoc-lib/src/utils/openapi.d.ts +3 -3
  149. package/lib/services/ProMenu.d.ts +4 -3
  150. package/lib/services/ProMenu.js +1 -1
  151. package/lib/services/ProStore.d.ts +7 -7
  152. package/lib/services/ProStore.js +1 -1
  153. package/lib/services/code-samples/httpsnippet/helpers/code-helpers.d.ts +1 -1
  154. package/lib/services/code-samples/httpsnippet/index.d.ts +9 -3
  155. package/lib/services/code-samples/httpsnippet/targets/index.d.ts +1 -1
  156. package/lib/services/code-samples/httpsnippet/targets/javascript/index.d.ts +1 -1
  157. package/lib/services/code-samples/httpsnippet/targets/php/curl.js +1 -1
  158. package/lib/services/code-samples/httpsnippet/targets/php/types.d.ts +11 -0
  159. package/lib/services/code-samples/httpsnippet/targets/php/types.js +2 -0
  160. package/lib/services/code-samples/httpsnippet/targets/php/utils.d.ts +2 -12
  161. package/lib/services/extendTheme.d.ts +1 -1
  162. package/lib/services/extendTheme.js +1 -1
  163. package/lib/standalone.d.ts +3 -1
  164. package/lib/standalone.js +1 -1
  165. package/lib/utils.d.ts +1 -1
  166. package/lib-esm/components/Endpoint/CopyLink.d.ts +1 -1
  167. package/lib-esm/components/Endpoint/Path.d.ts +2 -2
  168. package/lib-esm/components/Endpoint/ServerItem.d.ts +1 -1
  169. package/lib-esm/components/Endpoint/ServerUrl.d.ts +1 -1
  170. package/lib-esm/components/NextSectionButton.d.ts +2 -2
  171. package/lib-esm/components/Panel/CallbackPanel.d.ts +1 -1
  172. package/lib-esm/components/Panel/CallbackPanel.js +1 -1
  173. package/lib-esm/components/Panel/CodeHeader.d.ts +1 -1
  174. package/lib-esm/components/Panel/CodePanel.d.ts +1 -1
  175. package/lib-esm/components/Panel/ContentPanel.d.ts +1 -1
  176. package/lib-esm/components/Panel/DarkHeader.d.ts +1 -1
  177. package/lib-esm/components/Panel/Header.d.ts +1 -1
  178. package/lib-esm/components/Panel/Panel.d.ts +1 -1
  179. package/lib-esm/components/Panel/PanelBody.d.ts +1 -1
  180. package/lib-esm/components/Panel/ResponsePanel.d.ts +1 -1
  181. package/lib-esm/components/Panel/ScrollableContentPanel.d.ts +1 -1
  182. package/lib-esm/components/Panel/Title.d.ts +1 -1
  183. package/lib-esm/components/Panel/Trigger.d.ts +1 -1
  184. package/lib-esm/components/RedoclyReferenceDocs.d.ts +1 -1
  185. package/lib-esm/components/Samples/LoadingWrapper.d.ts +1 -1
  186. package/lib-esm/components/Search/styled.d.ts +10 -10
  187. package/lib-esm/components/Tabs/CollapsingTabs/CollapsingDropdown.d.ts +1 -1
  188. package/lib-esm/components/Tabs/CollapsingTabs/CollapsingTab.d.ts +1 -1
  189. package/lib-esm/components/Tabs/CollapsingTabs/CollapsingTabList.d.ts +1 -1
  190. package/lib-esm/components/Tabs/SmallTab.d.ts +1 -1
  191. package/lib-esm/components/Tabs/Tab.d.ts +1 -1
  192. package/lib-esm/components/Tabs/TabList.d.ts +1 -1
  193. package/lib-esm/components/Tabs/TabPanel.d.ts +1 -1
  194. package/lib-esm/components/common/Checkbox.d.ts +1 -1
  195. package/lib-esm/components/common/CheckboxList.d.ts +2 -2
  196. package/lib-esm/components/common/CheckboxList.js +1 -1
  197. package/lib-esm/components/common/FileUpload/FileUpload.d.ts +2 -2
  198. package/lib-esm/components/common/FileUpload/FileUpload.js +1 -1
  199. package/lib-esm/components/common/FileUpload/helper.d.ts +5 -5
  200. package/lib-esm/components/common/FileUpload/helper.js +1 -1
  201. package/lib-esm/components/common/LinearProgress.js +1 -1
  202. package/lib-esm/components/common/TextField.d.ts +2 -2
  203. package/lib-esm/components/common/form.d.ts +12 -12
  204. package/lib-esm/components/console/ActionPanel.d.ts +6 -4
  205. package/lib-esm/components/console/ActionPanel.js +1 -1
  206. package/lib-esm/components/console/AuthPanel.d.ts +6 -5
  207. package/lib-esm/components/console/CodemirrorInput.d.ts +4 -1
  208. package/lib-esm/components/console/Console.d.ts +10 -12
  209. package/lib-esm/components/console/Console.js +1 -1
  210. package/lib-esm/components/console/OAuth2Flow.d.ts +1 -1
  211. package/lib-esm/components/console/OAuth2TokenInput.d.ts +2 -2
  212. package/lib-esm/components/console/OAuth2TokenInput.js +1 -1
  213. package/lib-esm/components/console/ParameterDropdown.js +1 -1
  214. package/lib-esm/components/console/RequestBody.d.ts +1 -1
  215. package/lib-esm/components/console/RequestBody.js +1 -1
  216. package/lib-esm/components/console/RequestBodyForm.d.ts +3 -4
  217. package/lib-esm/components/console/RequestBodyForm.js +1 -1
  218. package/lib-esm/components/console/RequestMimeLabel.d.ts +1 -1
  219. package/lib-esm/components/console/ResponsePanel.d.ts +3 -3
  220. package/lib-esm/components/console/ResponsePanel.js +1 -1
  221. package/lib-esm/components/console/ServerDropdown.d.ts +8 -6
  222. package/lib-esm/components/console/ServerDropdown.js +1 -1
  223. package/lib-esm/components/console/styled.components.d.ts +4 -4
  224. package/lib-esm/components/console/utils.d.ts +5 -19
  225. package/lib-esm/components/console/utils.js +1 -1
  226. package/lib-esm/components/pluggable/RedocResponse.js +1 -1
  227. package/lib-esm/components/pluggable/styled.components.d.ts +4 -3
  228. package/lib-esm/components/shared/Button.d.ts +3 -4
  229. package/lib-esm/components/shared/CopyButton.js +1 -1
  230. package/lib-esm/components/shared/HttpVerb.d.ts +1 -1
  231. package/lib-esm/components/shared/MimeLabel.d.ts +1 -1
  232. package/lib-esm/components/shared/NoSampleLabel.d.ts +2 -2
  233. package/lib-esm/components/styled.elements.d.ts +10 -9
  234. package/lib-esm/hooks/index.d.ts +2 -0
  235. package/lib-esm/hooks/index.js +2 -0
  236. package/lib-esm/hooks/useMount.d.ts +1 -0
  237. package/lib-esm/hooks/useMount.js +2 -0
  238. package/lib-esm/hooks/useUnmount.d.ts +1 -0
  239. package/lib-esm/hooks/useUnmount.js +2 -0
  240. package/lib-esm/redoc-lib/src/common-elements/CopyButtonWrapper.d.ts +5 -5
  241. package/lib-esm/redoc-lib/src/common-elements/LinkToField.d.ts +3 -4
  242. package/lib-esm/redoc-lib/src/common-elements/LinkToField.js +1 -1
  243. package/lib-esm/redoc-lib/src/common-elements/PrismDiv.d.ts +1 -1
  244. package/lib-esm/redoc-lib/src/common-elements/Tooltip.d.ts +2 -2
  245. package/lib-esm/redoc-lib/src/common-elements/Tooltip.js +1 -1
  246. package/lib-esm/redoc-lib/src/common-elements/dropdown.d.ts +4 -4
  247. package/lib-esm/redoc-lib/src/common-elements/fields-layout.d.ts +9 -9
  248. package/lib-esm/redoc-lib/src/common-elements/fields.d.ts +13 -13
  249. package/lib-esm/redoc-lib/src/common-elements/headers.d.ts +6 -6
  250. package/lib-esm/redoc-lib/src/common-elements/icons.d.ts +5 -5
  251. package/lib-esm/redoc-lib/src/common-elements/linkify.d.ts +5 -5
  252. package/lib-esm/redoc-lib/src/common-elements/linkify.js +1 -1
  253. package/lib-esm/redoc-lib/src/common-elements/panels.d.ts +5 -5
  254. package/lib-esm/redoc-lib/src/common-elements/perfect-scrollbar.d.ts +3 -5
  255. package/lib-esm/redoc-lib/src/common-elements/perfect-scrollbar.js +1 -1
  256. package/lib-esm/redoc-lib/src/common-elements/samples.d.ts +4 -4
  257. package/lib-esm/redoc-lib/src/common-elements/schema.d.ts +5 -5
  258. package/lib-esm/redoc-lib/src/common-elements/shelfs.d.ts +1 -1
  259. package/lib-esm/redoc-lib/src/components/ApiInfo/styled.elements.d.ts +5 -5
  260. package/lib-esm/redoc-lib/src/components/ApiLogo/styled.elements.d.ts +2 -2
  261. package/lib-esm/redoc-lib/src/components/CallbackSamples/CallbackReqSamples.d.ts +1 -1
  262. package/lib-esm/redoc-lib/src/components/CallbackSamples/CallbackSamples.d.ts +1 -1
  263. package/lib-esm/redoc-lib/src/components/Callbacks/CallbackSummary.js +1 -1
  264. package/lib-esm/redoc-lib/src/components/Callbacks/CallbackTitle.d.ts +1 -1
  265. package/lib-esm/redoc-lib/src/components/DownloadButton/DownloadButton.d.ts +1 -1
  266. package/lib-esm/redoc-lib/src/components/DownloadButton/DownloadButton.js +1 -1
  267. package/lib-esm/redoc-lib/src/components/ErrorBoundary.d.ts +4 -4
  268. package/lib-esm/redoc-lib/src/components/ErrorBoundary.js +1 -1
  269. package/lib-esm/redoc-lib/src/components/Fields/EnumValues.d.ts +1 -1
  270. package/lib-esm/redoc-lib/src/components/Fields/Field.d.ts +1 -1
  271. package/lib-esm/redoc-lib/src/components/GenericChildrenSwitcher/GenericChildrenSwitcher.d.ts +2 -4
  272. package/lib-esm/redoc-lib/src/components/GenericChildrenSwitcher/GenericChildrenSwitcher.js +1 -1
  273. package/lib-esm/redoc-lib/src/components/JsonViewer/JsonViewer.d.ts +2 -2
  274. package/lib-esm/redoc-lib/src/components/JsonViewer/JsonViewer.js +1 -1
  275. package/lib-esm/redoc-lib/src/components/JsonViewer/style.d.ts +1 -1
  276. package/lib-esm/redoc-lib/src/components/Loading/Spinner.svg.d.ts +1 -1
  277. package/lib-esm/redoc-lib/src/components/Markdown/AdvancedMarkdown.d.ts +3 -1
  278. package/lib-esm/redoc-lib/src/components/Markdown/styled.elements.d.ts +4 -5
  279. package/lib-esm/redoc-lib/src/components/Parameters/Parameters.js +1 -1
  280. package/lib-esm/redoc-lib/src/components/Parameters/ParametersGroup.d.ts +1 -1
  281. package/lib-esm/redoc-lib/src/components/PayloadSamples/PayloadSamples.d.ts +1 -1
  282. package/lib-esm/redoc-lib/src/components/PayloadSamples/PayloadSamples.js +1 -1
  283. package/lib-esm/redoc-lib/src/components/PayloadSamples/styled.elements.d.ts +3 -3
  284. package/lib-esm/redoc-lib/src/components/RequestSamples/useCodeSamples.d.ts +7 -3
  285. package/lib-esm/redoc-lib/src/components/ResponseSamples/ResponseSamples.d.ts +1 -1
  286. package/lib-esm/redoc-lib/src/components/ResponseSamples/ResponseSamples.js +1 -1
  287. package/lib-esm/redoc-lib/src/components/Responses/ResponseSummary.d.ts +1 -1
  288. package/lib-esm/redoc-lib/src/components/Responses/styled.elements.d.ts +1 -1
  289. package/lib-esm/redoc-lib/src/components/Schema/ObjectSchema.d.ts +3 -2
  290. package/lib-esm/redoc-lib/src/components/Schema/ObjectSchema.js +1 -1
  291. package/lib-esm/redoc-lib/src/components/Schema/OneOfSchema.js +1 -1
  292. package/lib-esm/redoc-lib/src/components/SearchBox/SearchBox.d.ts +1 -1
  293. package/lib-esm/redoc-lib/src/components/SearchBox/SearchBox.js +1 -1
  294. package/lib-esm/redoc-lib/src/components/SearchBox/styled.elements.d.ts +5 -5
  295. package/lib-esm/redoc-lib/src/components/SecuritySchemes/SecuritySchemes.js +1 -1
  296. package/lib-esm/redoc-lib/src/components/SideMenu/MenuItem.d.ts +3 -5
  297. package/lib-esm/redoc-lib/src/components/SideMenu/styled.elements.d.ts +7 -7
  298. package/lib-esm/redoc-lib/src/services/OpenAPIParser.d.ts +3 -3
  299. package/lib-esm/redoc-lib/src/services/OpenAPIParser.js +1 -1
  300. package/lib-esm/redoc-lib/src/services/ScrollService.js +1 -1
  301. package/lib-esm/redoc-lib/src/services/SearchWorker.worker.d.ts +1 -1
  302. package/lib-esm/redoc-lib/src/services/models/Operation.d.ts +2 -2
  303. package/lib-esm/redoc-lib/src/styled-components.d.ts +3 -2
  304. package/lib-esm/redoc-lib/src/utils/decorators.d.ts +1 -1
  305. package/lib-esm/redoc-lib/src/utils/helpers.d.ts +2 -2
  306. package/lib-esm/redoc-lib/src/utils/loadAndBundleSpec.d.ts +1 -1
  307. package/lib-esm/redoc-lib/src/utils/media-css.d.ts +1 -1
  308. package/lib-esm/redoc-lib/src/utils/openapi.d.ts +3 -3
  309. package/lib-esm/services/ProMenu.d.ts +4 -3
  310. package/lib-esm/services/ProMenu.js +1 -1
  311. package/lib-esm/services/ProStore.d.ts +7 -7
  312. package/lib-esm/services/ProStore.js +1 -1
  313. package/lib-esm/services/code-samples/httpsnippet/helpers/code-helpers.d.ts +1 -1
  314. package/lib-esm/services/code-samples/httpsnippet/index.d.ts +9 -3
  315. package/lib-esm/services/code-samples/httpsnippet/targets/index.d.ts +1 -1
  316. package/lib-esm/services/code-samples/httpsnippet/targets/javascript/index.d.ts +1 -1
  317. package/lib-esm/services/code-samples/httpsnippet/targets/php/curl.js +1 -1
  318. package/lib-esm/services/code-samples/httpsnippet/targets/php/types.d.ts +11 -0
  319. package/lib-esm/services/code-samples/httpsnippet/targets/php/types.js +2 -0
  320. package/lib-esm/services/code-samples/httpsnippet/targets/php/utils.d.ts +2 -12
  321. package/lib-esm/services/extendTheme.d.ts +1 -1
  322. package/lib-esm/services/extendTheme.js +1 -1
  323. package/lib-esm/standalone.d.ts +3 -1
  324. package/lib-esm/standalone.js +1 -1
  325. package/lib-esm/utils.d.ts +1 -1
  326. package/package.json +3 -7
@@ -1,2 +1,2 @@
1
- import{__decorate}from"tslib";import{bind}from"decko";import EventEmitter from"eventemitter3";import{IS_BROWSER,querySelector,Throttle}from"../utils";var EVENT="scroll",ScrollService=function(){function e(e){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_scrollParent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_prevOffsetY",{enumerable:!0,configurable:!0,writable:!0,value:0}),this._scrollParent=IS_BROWSER?window:void 0,this._emitter=new EventEmitter,this.bind()}return Object.defineProperty(e.prototype,"prevOffsetY",{set:function(e){this._prevOffsetY=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bind",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._prevOffsetY=this.scrollY(),this._scrollParent&&this._scrollParent.addEventListener(EVENT,this.handleScroll)}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._scrollParent&&this._scrollParent.removeEventListener(EVENT,this.handleScroll),this._emitter.removeAllListeners(EVENT)}}),Object.defineProperty(e.prototype,"scrollY",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"undefined"!=typeof HTMLElement&&this._scrollParent instanceof HTMLElement?this._scrollParent.scrollTop:void 0!==this._scrollParent?this._scrollParent.pageYOffset:0}}),Object.defineProperty(e.prototype,"isElementBellow",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(null!==e)return e.getBoundingClientRect().top>this.options.scrollYOffset()}}),Object.defineProperty(e.prototype,"isElementAbove",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(null!==e){var t=e.getBoundingClientRect().top;return(t>0?Math.floor(t):Math.ceil(t))<=this.options.scrollYOffset()}}}),Object.defineProperty(e.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._emitter.addListener(EVENT,e);return function(){return t.removeListener(EVENT,e)}}}),Object.defineProperty(e.prototype,"scrollIntoView",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,l;if(null!==e){var o=Math.floor(this.options.scrollYOffset());e.style.scrollMarginTop=o+"px",e.scrollIntoView(t),(null===(r=e.parentElement)||void 0===r?void 0:r.childNodes[0])===e&&"div"===e.tagName&&(null===(l=this._scrollParent)||void 0===l||l.scrollBy(0,-o))}}}),Object.defineProperty(e.prototype,"scrollIntoViewBySelector",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=querySelector(e);this.scrollIntoView(r,t)}}),Object.defineProperty(e.prototype,"handleScroll",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.scrollY()-this._prevOffsetY>0;this._prevOffsetY=this.scrollY(),this._emitter.emit(EVENT,e)}}),__decorate([bind,Throttle(100)],e.prototype,"handleScroll",null),e}();export{ScrollService};
1
+ import{__decorate}from"tslib";import{bind}from"decko";import EventEmitter from"eventemitter3";import{IS_BROWSER,querySelector,Throttle}from"../utils";var EVENT="scroll",ScrollService=function(){function e(e){Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_scrollParent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_prevOffsetY",{enumerable:!0,configurable:!0,writable:!0,value:0}),this._scrollParent=IS_BROWSER?window:void 0,this._emitter=new EventEmitter,this.bind()}return Object.defineProperty(e.prototype,"prevOffsetY",{set:function(e){this._prevOffsetY=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bind",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._prevOffsetY=this.scrollY(),this._scrollParent&&this._scrollParent.addEventListener(EVENT,this.handleScroll)}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._scrollParent&&this._scrollParent.removeEventListener(EVENT,this.handleScroll),this._emitter.removeAllListeners(EVENT)}}),Object.defineProperty(e.prototype,"scrollY",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"undefined"!=typeof HTMLElement&&this._scrollParent instanceof HTMLElement?this._scrollParent.scrollTop:void 0!==this._scrollParent?this._scrollParent.pageYOffset:0}}),Object.defineProperty(e.prototype,"isElementBellow",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(null!==e)return e.getBoundingClientRect().top>this.options.scrollYOffset()}}),Object.defineProperty(e.prototype,"isElementAbove",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(null!==e){var t=e.getBoundingClientRect().top;return(t>0?Math.floor(t):Math.ceil(t))<=this.options.scrollYOffset()}}}),Object.defineProperty(e.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._emitter.addListener(EVENT,e);return function(){return t.removeListener(EVENT,e)}}}),Object.defineProperty(e.prototype,"scrollIntoView",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(null!==e&&(e.scrollIntoView(t),this._scrollParent&&this._scrollParent.scrollBy)){var r=[0,-Math.floor(this.options.scrollYOffset())],l=r[0],o=r[1];this._scrollParent.scrollBy(l,o)}}}),Object.defineProperty(e.prototype,"scrollIntoViewBySelector",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=querySelector(e);this.scrollIntoView(r,t)}}),Object.defineProperty(e.prototype,"handleScroll",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.scrollY()-this._prevOffsetY>0;this._prevOffsetY=this.scrollY(),this._emitter.emit(EVENT,e)}}),__decorate([bind,Throttle(100)],e.prototype,"handleScroll",null),e}();export{ScrollService};
2
2
  //# sourceMappingURL=ScrollService.js.map
@@ -20,6 +20,6 @@ export declare function add<T>(title: string, description: string, meta?: T): vo
20
20
  export declare function done(): Promise<void>;
21
21
  export declare function toJS(): Promise<any>;
22
22
  export declare function fromExternalJS(path: string, exportName: string): Promise<void>;
23
- export declare function load(state: any): Promise<void>;
23
+ export declare function load(state: GenericObject): Promise<void>;
24
24
  export declare function dispose(): Promise<void>;
25
25
  export declare function search<Meta = string>(q: string, limit?: number): Promise<Array<SearchResult<Meta>>>;
@@ -77,8 +77,8 @@ export declare class OperationModel implements IMenuItem {
77
77
  get requestBody(): RequestBodyModel | undefined;
78
78
  get payload(): XPayloadSample | undefined;
79
79
  get hasSamples(): boolean;
80
- get definitionSamples(): any[];
81
- get allCodeSamples(): any[];
80
+ get definitionSamples(): Array<OpenAPIXCodeSample | Unstable_ExternalCodeSample>;
81
+ get allCodeSamples(): Array<Unstable_ExternalCodeSample | OpenAPIXCodeSample>;
82
82
  get parameters(): FieldModel[];
83
83
  get responses(): ResponseModel[];
84
84
  get callbacks(): CallbackModel[];
@@ -1,8 +1,9 @@
1
1
  import * as styledComponents from 'styled-components';
2
2
  import { ResolvedThemeInterface, MediaValue } from './theme';
3
+ import { ProTheme } from '../../services/extendTheme';
3
4
  export type { ResolvedThemeInterface, MediaValue };
4
- declare const styled: styledComponents.ThemedStyledInterface<ResolvedThemeInterface>, css: styledComponents.ThemedCssFunction<ResolvedThemeInterface>, createGlobalStyle: <P extends object = {}>(first: TemplateStringsArray | styledComponents.CSSObject | styledComponents.InterpolationFunction<styledComponents.ThemedStyledProps<P, ResolvedThemeInterface>>, ...interpolations: styledComponents.Interpolation<styledComponents.ThemedStyledProps<P, ResolvedThemeInterface>>[]) => styledComponents.GlobalStyleComponent<P, ResolvedThemeInterface>, keyframes: (strings: TemplateStringsArray | styledComponents.CSSKeyframes, ...interpolations: styledComponents.SimpleInterpolation[]) => styledComponents.Keyframes, ThemeProvider: styledComponents.ThemeProviderComponent<ResolvedThemeInterface, ResolvedThemeInterface>;
5
+ declare const styled: styledComponents.ThemedStyledInterface<ProTheme>, css: styledComponents.ThemedCssFunction<ProTheme>, createGlobalStyle: <P extends object = {}>(first: TemplateStringsArray | styledComponents.CSSObject | styledComponents.InterpolationFunction<styledComponents.ThemedStyledProps<P, ProTheme>>, ...interpolations: styledComponents.Interpolation<styledComponents.ThemedStyledProps<P, ProTheme>>[]) => styledComponents.GlobalStyleComponent<P, ProTheme>, keyframes: (strings: TemplateStringsArray | styledComponents.CSSKeyframes, ...interpolations: styledComponents.SimpleInterpolation[]) => styledComponents.Keyframes, ThemeProvider: styledComponents.ThemeProviderComponent<ProTheme, ProTheme>;
5
6
  export { css, createGlobalStyle, keyframes, ThemeProvider };
6
7
  export default styled;
7
- export declare function extensionsHook(styledName: string): (props: any) => any;
8
+ export declare function extensionsHook(styledName: string): any;
8
9
  export { mediaCSS, mediaMap, ZERO_BREAKPOINT } from './utils/media-css';
@@ -1 +1 @@
1
- export declare function Throttle(delay: number): (_: any, _2: any, desc: PropertyDescriptor) => void;
1
+ export declare function Throttle(delay: number): (_: unknown, _2: unknown, desc: PropertyDescriptor) => void;
@@ -18,9 +18,9 @@ export declare function mapValues<T, P>(object: Record<string, T>, iteratee: (va
18
18
  */
19
19
  export declare function flattenByProp<T extends GenericObject, P extends keyof T>(collectionItems: T[], prop: P): T[];
20
20
  export declare function stripTrailingSlash(path: string): string;
21
- export declare function isNumeric(n: any): n is number;
21
+ export declare function isNumeric(value: unknown): value is number;
22
22
  export declare function appendToMdHeading(md: string, heading: string, content: string): string;
23
- export declare const mergeObjects: (target: any, ...sources: any[]) => any;
23
+ export declare const mergeObjects: (target: GenericObject, ...sources: GenericObject[]) => any;
24
24
  /**
25
25
  * slugify() returns empty string when failed to slugify.
26
26
  * so try to return minimum slugified-string with failed one which keeps original value
@@ -2,4 +2,4 @@ import { Document } from '@redocly/openapi-core';
2
2
  import type { OpenAPIDefinition } from '../types';
3
3
  export declare function loadAndBundleDefinition(specUrlOrObject: GenericObject | string): Promise<OpenAPIDefinition>;
4
4
  export declare function createParsedDocument(specUrlOrObject: GenericObject | string): Document;
5
- export declare function convertSwagger2OpenAPI(spec: any): Promise<OpenAPIDefinition>;
5
+ export declare function convertSwagger2OpenAPI(spec: GenericObject): Promise<OpenAPIDefinition>;
@@ -3,4 +3,4 @@ export declare const ZERO_BREAKPOINT = "_";
3
3
  export declare function mediaMap<T extends string | number>(breakpoints: {
4
4
  [size: string]: string;
5
5
  }, values: MediaValue<T>[], mediaMapper: MediaValue<(...values: T[]) => T>): MediaValue<T>;
6
- export declare const mediaCSS: (args: any) => (props?: any) => GenericObject;
6
+ export declare const mediaCSS: (args: GenericObject) => (props?: GenericObject) => GenericObject;
@@ -12,11 +12,11 @@ export declare function isFormUrlEncoded(contentType: string): boolean;
12
12
  export declare function urlFormEncodePayload(payload: GenericObject, encoding?: {
13
13
  [field: string]: OpenAPIEncoding;
14
14
  }): string;
15
- export declare function serializeQueryParameter(name: string, style: OpenAPIParameterStyle | undefined, explode: boolean, value: any): string;
16
- export declare function serializeParameterValueWithMime(value: any, mime: string): string;
15
+ export declare function serializeQueryParameter(name: string, style: OpenAPIParameterStyle | undefined, explode: boolean, value: unknown): string;
16
+ export declare function serializeParameterValueWithMime(value: unknown, mime: string): string;
17
17
  export declare function serializeParameterValue(parameter: OpenAPIParameter & {
18
18
  serializationMime?: string;
19
- }, value: any): string;
19
+ }, value: unknown): string;
20
20
  export declare function langFromMime(contentType: string): string;
21
21
  export declare function isNamedDefinition(pointer?: string): boolean;
22
22
  export declare function getDefinitionName(pointer?: string): string | undefined;
@@ -1,5 +1,6 @@
1
- import { IMenuItem, ScrollService, HistoryService, MenuItemType, SchemaModel } from '../redoc-lib';
1
+ import { IMenuItem, ScrollService, HistoryService, MenuItemType, SchemaModel, SpecStore } from '../redoc-lib';
2
2
  import { RedocProNormalizedOptions } from './ProStore';
3
+ import { VersionedSpecStore } from './VersionedSpecStore';
3
4
  export declare type ExtendedMenuItem = Omit<IMenuItem, 'type'> & {
4
5
  type: MenuItemType | 'spec';
5
6
  linkable?: boolean;
@@ -9,7 +10,7 @@ export declare type ExtendedMenuItem = Omit<IMenuItem, 'type'> & {
9
10
  * Stores all side-menu related information
10
11
  */
11
12
  export declare class ProMenu {
12
- definition: any;
13
+ definition: SpecStore | VersionedSpecStore;
13
14
  scroll: ScrollService;
14
15
  options: RedocProNormalizedOptions;
15
16
  history: HistoryService;
@@ -39,7 +40,7 @@ export declare class ProMenu {
39
40
  * @param options normalized options
40
41
  * @param history
41
42
  */
42
- constructor(definition: any, scroll: ScrollService, options: RedocProNormalizedOptions, history: HistoryService);
43
+ constructor(definition: SpecStore | VersionedSpecStore, scroll: ScrollService, options: RedocProNormalizedOptions, history: HistoryService);
43
44
  subscribe(): void;
44
45
  toggleSidebar(): void;
45
46
  closeSidebar(): void;
@@ -1,2 +1,2 @@
1
- import{__assign,__decorate}from"tslib";import{flattenByProp,SECURITY_SCHEMES_SECTION_PREFIX,querySelector,GROUP_DEPTH}from"../redoc-lib";import{action,observable,makeObservable}from"mobx";import{VersionedSpecStore}from"./VersionedSpecStore";import{SECTION_ATTR}from"../redoc-lib/src/services/constants";import{history as historyInst}from"../redoc-lib/src/services/HistoryService";var ProMenu=function(){function e(e,t,i,r){var n=this;Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"history",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"flatItems",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeRenderItemIdx",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"renderItems",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"activeItemIdx",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"sideBarOpened",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_unsubscribe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_hashUnsubscribe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"getItemById",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return n.flatItems.find((function(t){return t.id===e}))}}),Object.defineProperty(this,"initOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=n.history.currentId);var t,i=e.split(n.options.deepLinkPrefix)[0];i&&((t=n.flatItems.find((function(e){return e.id===i})))?(n.activate(t,!1,!1,!1,e),t.active=!1):i.startsWith(SECURITY_SCHEMES_SECTION_PREFIX)&&(t=n.flatItems.find((function(e){return SECURITY_SCHEMES_SECTION_PREFIX.startsWith(e.id)})),n.activate(t,!1,!1,!1,e),t&&(t.active=!1)))}}),Object.defineProperty(this,"updateOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=n.history.currentId);var t=e.split(n.options.deepLinkPrefix)[0];if(t){var i=n.flatItems.find(t.includes(SECURITY_SCHEMES_SECTION_PREFIX)?function(e){return SECURITY_SCHEMES_SECTION_PREFIX.startsWith(e.id)}:function(e){return e.id===t});i?n.activateAndScroll(i,!1,void 0,e):(n.scroll.prevOffsetY=0,n.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+t+'"]'))}}}),Object.defineProperty(this,"updateVersionOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=e.split("/")[0],i=n.definition.versionsInfo.findIndex((function(e){return e.id===t}));i<0&&(i=n.definition.versionsInfo.findIndex((function(e){return e.isDefault}))),n.definition.activeVersionIdx!==i&&(n.definition.changeVersion(i<0?0:i),n.updateItemsByVersionChange(!1,e));var r=t+"/"+SECURITY_SCHEMES_SECTION_PREFIX;if(e.startsWith(r)){var o=n.flatItems.find((function(e){return r.startsWith(e.id)}));n.activate(o,!1,!0),setTimeout((function(){return n.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}),0)}}}),Object.defineProperty(this,"updateOnScroll",{enumerable:!0,configurable:!0,writable:!0,value:function(e){for(var t=e?1:-1,i=n.activeItemIdx;(-1!==i||e)&&!(i>=n.flatItems.length-1&&e);){if(e){var r=!1,o=n.flatItems[i+1];switch(n.options.pagination){case"section":r=o&&("spec"===o.type||"group"===o.type||"tag"===o.type);break;case"item":r="section"!==(null==o?void 0:o.type)}var a=n.getElementAt(i+1);if(-1===i&&"tag"===n.flatItems[0].type&&(r=!1),n.scroll.isElementBellow(a)||r)break}else{var s=n.flatItems[i]&&n.flatItems[i].type;r="section"===n.options.pagination&&("spec"===s||"group"===s||"tag"===s)||"item"===n.options.pagination&&"section"!==s,a=n.getElementAt(i);if(n.scroll.isElementAbove(a)||r)break}i+=t}var l=n.flatItems[i];"none"===n.options.pagination||"section"===n.options.pagination?l&&l.active||n.activate(l,!0,!0,!1):l&&"section"===l.type&&(l.active||n.activate(l,!0,!0,!1))}}),makeObservable(this),this.items=e.contentItems,this.flatItems=flattenByProp(this.items||[],"items"),this.flatItems.forEach((function(e,t){return e.absoluteIdx=t})),i.disableSidebar||this.subscribe(),this.flatItems.forEach((function(e,t){return normalizeItem(e,t,i.pagination,n.definition instanceof VersionedSpecStore,n.history)})),this.renderItems=this.buildRenderItems(0),this.activeItemIdx=-1,this.activeRenderItemIdx=-1,this.definition instanceof VersionedSpecStore&&this.history.subscribe(this.updateVersionOnHistory)}return Object.defineProperty(e,"updateOnHistory",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===e&&(e=historyInst.currentId),e&&t.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}}),Object.defineProperty(e.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._unsubscribe=this.scroll.subscribe(this.updateOnScroll),this._hashUnsubscribe=this.history.subscribe(this.updateOnHistory)}}),Object.defineProperty(e.prototype,"toggleSidebar",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sideBarOpened=!this.sideBarOpened}}),Object.defineProperty(e.prototype,"closeSidebar",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sideBarOpened=!1}}),Object.defineProperty(e.prototype,"getElementAt",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.flatItems[e];return t&&querySelector("["+SECTION_ATTR+'="'+t.id+'"]')||null}}),Object.defineProperty(e.prototype,"getElementAtOrFirstChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.flatItems[e];return t&&"group"===t.type&&(t=t.items[0]),t&&querySelector("["+SECTION_ATTR+'="'+t.id+'"]')||null}}),Object.defineProperty(e.prototype,"activeItem",{get:function(){return this.flatItems[this.activeItemIdx]||void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateItemsByVersionChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this,r=this.activeItem&&this.activeItem.active?this.activeItem.absoluteIdx:-1;t=t&&withoutVersion(t)||this.activeItem&&this.activeItem.active&&withoutVersion(this.activeItem.id)||"",this.deactivate(this.activeItem),this.items=this.definition.contentItems,this.flatItems=flattenByProp(this.items||[],"items"),this.flatItems.forEach((function(e,t){return normalizeItem(e,t,i.options.pagination,i.definition instanceof VersionedSpecStore,i.history)}));var n=t?(this.flatItems.find((function(e){return withoutVersion(e.id)===t}))||{absoluteIdx:-1}).absoluteIdx:-1;if(-1!==n&&"none"!==this.options.pagination||(this.renderItems=this.buildRenderItems(0)),this.activeItemIdx=-1,-1!==n)this.activate(this.flatItems[n],e);else if(-1!==r)this.activateAndScroll(this.flatItems[0],e);else if(e){var o=this.definition.versionsInfo[this.definition.activeVersionIdx];if(!this.history.currentId&&o.isDefault)return;this.history.replace(o.id)}}}),Object.defineProperty(e.prototype,"buildRenderItems",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if("none"===this.options.pagination)return this.items;var t=this.flatItems[e];if(t||(t=this.flatItems[0]),"spec"===t.type)return this.buildRenderItems(e+1);if("section"===t.type){var i=[],r=getParentOfType(t,"tag");if("section"===this.options.pagination&&r)return[r];if("item"===this.options.pagination&&r)return[__assign(__assign({},r),{items:getLeadingSectionItems(r)})];for(var n=getParentSpecItem(t),o=(null==n?void 0:n.items)||this.items,a=0;a<o.length&&"section"===o[a].type;a++)i.push(o[a]);return i}switch(this.options.pagination){case"section":if("operation"===t.type&&t.parent)return[t.parent];if("group"!==t.type)return[t];case"item":return"operation"===t.type?[t]:[__assign(__assign({},t),{items:getLeadingSectionItems(t)})];default:return[]}}}),Object.defineProperty(e.prototype,"activateBase",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r){var n,o,a,s,l,c=this;if(void 0===t&&(t=!0),void 0===i&&(i=!1),(null===(n=this.activeItem)||void 0===n?void 0:n.id)===(null==e?void 0:e.id)&&!r)return t&&e&&this.history.replace(e.id,i),void(e&&!e.active&&e.activate());if(!e||"group"!==e.type)if(this.deactivate(this.activeItem),e){if(!(e.depth<=GROUP_DEPTH)){this.activeItemIdx=e.absoluteIdx,t&&this.history.replace(e.id,i),e.activate(),e.expand();var u=new URLSearchParams(r),d="request"===u.get("t"),f="response"===u.get("t"),p=u.get("c"),v=u.get("ct"),b=u.get("in"),h=u.get("path"),m=(null==h?void 0:h.split(this.options.deepLinkSeparator))||[],I=e;if(b)for(var y=I.parameters,g=function(e){var t=null==y?void 0:y.find((function(t){return t.name===e}));null==t||t.expand(),y=null===(o=null==t?void 0:t.schema)||void 0===o?void 0:o.fields},O=0,S=m;O<S.length;O++){g(S[O])}else if(d){var _=null===(a=I.requestBody)||void 0===a?void 0:a.content;null===(s=I.activateMimeName)||void 0===s||s.call(I,v||I.activeMimeName),setTimeout((function(){var e;return c.activateField(m,null===(e=null==_?void 0:_.active)||void 0===e?void 0:e.schema)}),0)}else if(f){var P=I.responses.find((function(e){return e.code===p}));(null==P?void 0:P.expanded)||null==P||P.expand(),null===(l=I.activateMimeName)||void 0===l||l.call(I,v||I.activeMimeName),setTimeout((function(){var e,t;return c.activateField(m,null===(t=null===(e=null==P?void 0:P.content)||void 0===e?void 0:e.active)||void 0===t?void 0:t.schema)}),0)}}}else this.history.replace("",i)}}),Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r,n){var o=this;if(void 0===t&&(t=!0),void 0===i&&(i=!1),void 0===r&&(r=!0),"none"===this.options.pagination)return this.activateBase(e,t,i,n),void(!e&&this.definition instanceof VersionedSpecStore&&this.history.replace(this.definition.currentVersionId,!0));if("group"!==(null==e?void 0:e.type)){if(e&&"item"===this.options.pagination&&"tag"===e.type&&!e.description){if(e.expanded)return void e.collapse();e.expand(),e=this.flatItems[e.absoluteIdx+1]}if(this.activateBase(e,e&&t,i,n),this.activeRenderItemIdx=e?e.absoluteIdx:this.activeRenderItemIdx,this.activeRenderItemIdx>=0){var a=this.buildRenderItems(this.activeRenderItemIdx);a.some((function(e,t){return e.id!==o.renderItems[t].id}))&&(this.renderItems=a),this.renderItems[0]&&(this.activeRenderItemIdx=this.renderItems[0].absoluteIdx)}r&&setTimeout((function(){return o.scrollToActive()})),!e&&this.definition instanceof VersionedSpecStore&&this.history.replace(this.definition.currentVersionId,!0)}}}),Object.defineProperty(e.prototype,"activateField",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){for(var i,r=function(r){var n=e[r],o=r===e.length-1;if((null==t?void 0:t.hasType("array"))&&(null==t?void 0:t.items)&&(t=null==t?void 0:t.items),null==t?void 0:t.oneOf){var a=Number(n);return null==t||t.activateOneOf(a),t=null==t?void 0:t.oneOf[a],"continue"}(null==t?void 0:t.hasType("array"))&&(null==t?void 0:t.items)&&(t=null==t?void 0:t.items);var s=null===(i=null==t?void 0:t.fields)||void 0===i?void 0:i.find((function(e){return e.name===n}));o||null==s||s.expand(),t=null==s?void 0:s.schema},n=0;n<e.length-1;n++)r(n)}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0!==e)for(e.deactivate();void 0!==e;)e.collapse(),e=e.parent}}),Object.defineProperty(e.prototype,"activateAndScroll",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r){void 0===r&&(r="");var n=r.split(this.options.deepLinkPrefix)[1],o=e&&this.getItemById(e.id)||e;this.activate(o,t,i,!1,n),this.scrollToActive(n?r:""),o&&o.items.length||this.closeSidebar()}}),Object.defineProperty(e.prototype,"scrollToActive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e?setTimeout((function(){return t.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}),0):this.scroll.scrollIntoView(this.getElementAt(this.activeItemIdx))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;null===(e=this._unsubscribe)||void 0===e||e.call(this),null===(t=this._hashUnsubscribe)||void 0===t||t.call(this)}}),__decorate([observable],e.prototype,"flatItems",void 0),__decorate([observable],e.prototype,"items",void 0),__decorate([observable],e.prototype,"activeRenderItemIdx",void 0),__decorate([observable.ref],e.prototype,"renderItems",void 0),__decorate([observable],e.prototype,"activeItemIdx",void 0),__decorate([observable],e.prototype,"sideBarOpened",void 0),__decorate([action],e.prototype,"toggleSidebar",null),__decorate([action],e.prototype,"closeSidebar",null),__decorate([action],e.prototype,"activateBase",null),__decorate([action],e.prototype,"activate",null),__decorate([action.bound],e.prototype,"activateAndScroll",null),e}();export{ProMenu};function withoutVersion(e){return e.split("/").slice(1).join("/")}function getParentSpecItem(e){for(;e;){if("spec"===e.type)return e;e=e.parent}}function getParentOfType(e,t){if(e&&e.parent)return e.parent.type===t?e.parent:getParentOfType(e.parent,t)}function getLeadingSectionItems(e){for(var t=[],i=0,r=e.items;i<r.length;i++){var n=r[i];if("section"!==n.type)break;t.push(n)}return t}function normalizeItem(e,t,i,r,n){if(e.absoluteIdx=t,"none"!==i){var o=getParentOfType(e,"tag");if(e.parent&&o&&!("_id_normalized"in e)){if(r){var a=e.id.split("/"),s=a[0],l=a[1],c=withoutVersion(e.id);if("operation"===e.type&&!l.startsWith("operation"))return;e.id=s+"/"+withoutVersion(o.id)+"/"+c}else{if("operation"===e.type&&!e.id.startsWith("operation"))return;e.id=o.id+"/"+e.id}e._id_normalized=!0}}"group"!==e.type&&(e.href=n.linkForId(e.id))}
1
+ import{__assign,__decorate}from"tslib";import{flattenByProp,SECURITY_SCHEMES_SECTION_PREFIX,querySelector,GROUP_DEPTH}from"../redoc-lib";import{action,observable,makeObservable}from"mobx";import{VersionedSpecStore}from"./VersionedSpecStore";import{SECTION_ATTR}from"../redoc-lib/src/services/constants";import{history as historyInst}from"../redoc-lib/src/services/HistoryService";var ProMenu=function(){function e(e,t,i,r){var n=this;Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"history",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"flatItems",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeRenderItemIdx",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"renderItems",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"activeItemIdx",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"sideBarOpened",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_unsubscribe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_hashUnsubscribe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"getItemById",{enumerable:!0,configurable:!0,writable:!0,value:function(e){return n.flatItems.find((function(t){return t.id===e}))}}),Object.defineProperty(this,"initOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=n.history.currentId);var t,i=e.split(n.options.deepLinkPrefix)[0];i&&((t=n.flatItems.find((function(e){return e.id===i})))?(n.activate(t,!1,!1,!1,e),t.active=!1):i.startsWith(SECURITY_SCHEMES_SECTION_PREFIX)&&(t=n.flatItems.find((function(e){return SECURITY_SCHEMES_SECTION_PREFIX.startsWith(e.id)})),n.activate(t,!1,!1,!1,e),t&&(t.active=!1)))}}),Object.defineProperty(this,"updateOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=n.history.currentId);var t=e.split(n.options.deepLinkPrefix)[0];if(t){var i=n.flatItems.find(t.includes(SECURITY_SCHEMES_SECTION_PREFIX)?function(e){return SECURITY_SCHEMES_SECTION_PREFIX.startsWith(e.id)}:function(e){return e.id===t});i?n.activateAndScroll(i,!1,void 0,e):(n.scroll.prevOffsetY=0,n.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+t+'"]'))}}}),Object.defineProperty(this,"updateVersionOnHistory",{enumerable:!0,configurable:!0,writable:!0,value:function(e){if("versionsInfo"in n.definition){var t=e.split("/")[0],i=n.definition.versionsInfo.findIndex((function(e){return e.id===t}));i<0&&(i=n.definition.versionsInfo.findIndex((function(e){return e.isDefault}))),n.definition.activeVersionIdx!==i&&(n.definition.changeVersion(i<0?0:i),n.updateItemsByVersionChange(!1,e));var r=t+"/"+SECURITY_SCHEMES_SECTION_PREFIX;if(e.startsWith(r)){var o=n.flatItems.find((function(e){return r.startsWith(e.id)}));n.activate(o,!1,!0),setTimeout((function(){return n.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}),0)}}}}),Object.defineProperty(this,"updateOnScroll",{enumerable:!0,configurable:!0,writable:!0,value:function(e){for(var t=e?1:-1,i=n.activeItemIdx;(-1!==i||e)&&!(i>=n.flatItems.length-1&&e);){if(e){var r=!1,o=n.flatItems[i+1];switch(n.options.pagination){case"section":r=o&&("spec"===o.type||"group"===o.type||"tag"===o.type);break;case"item":r="section"!==(null==o?void 0:o.type)}var a=n.getElementAt(i+1);if(-1===i&&"tag"===n.flatItems[0].type&&(r=!1),n.scroll.isElementBellow(a)||r)break}else{var s=n.flatItems[i]&&n.flatItems[i].type;r="section"===n.options.pagination&&("spec"===s||"group"===s||"tag"===s)||"item"===n.options.pagination&&"section"!==s,a=n.getElementAt(i);if(n.scroll.isElementAbove(a)||r)break}i+=t}var l=n.flatItems[i];"none"===n.options.pagination||"section"===n.options.pagination?l&&l.active||n.activate(l,!0,!0,!1):l&&"section"===l.type&&(l.active||n.activate(l,!0,!0,!1))}}),makeObservable(this),this.items=e.contentItems,this.flatItems=flattenByProp(this.items||[],"items"),this.flatItems.forEach((function(e,t){return e.absoluteIdx=t})),i.disableSidebar||this.subscribe(),this.flatItems.forEach((function(e,t){return normalizeItem(e,t,i.pagination,n.definition instanceof VersionedSpecStore,n.history)})),this.renderItems=this.buildRenderItems(0),this.activeItemIdx=-1,this.activeRenderItemIdx=-1,this.definition instanceof VersionedSpecStore&&this.history.subscribe(this.updateVersionOnHistory)}return Object.defineProperty(e,"updateOnHistory",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===e&&(e=historyInst.currentId),e&&t.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}}),Object.defineProperty(e.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._unsubscribe=this.scroll.subscribe(this.updateOnScroll),this._hashUnsubscribe=this.history.subscribe(this.updateOnHistory)}}),Object.defineProperty(e.prototype,"toggleSidebar",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sideBarOpened=!this.sideBarOpened}}),Object.defineProperty(e.prototype,"closeSidebar",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sideBarOpened=!1}}),Object.defineProperty(e.prototype,"getElementAt",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.flatItems[e];return t&&querySelector("["+SECTION_ATTR+'="'+t.id+'"]')||null}}),Object.defineProperty(e.prototype,"getElementAtOrFirstChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.flatItems[e];return t&&"group"===t.type&&(t=t.items[0]),t&&querySelector("["+SECTION_ATTR+'="'+t.id+'"]')||null}}),Object.defineProperty(e.prototype,"activeItem",{get:function(){return this.flatItems[this.activeItemIdx]||void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateItemsByVersionChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;if("versionsInfo"in this.definition){var r=this.activeItem&&this.activeItem.active?this.activeItem.absoluteIdx:-1;t=t&&withoutVersion(t)||this.activeItem&&this.activeItem.active&&withoutVersion(this.activeItem.id)||"",this.deactivate(this.activeItem),this.items=this.definition.contentItems,this.flatItems=flattenByProp(this.items||[],"items"),this.flatItems.forEach((function(e,t){return normalizeItem(e,t,i.options.pagination,i.definition instanceof VersionedSpecStore,i.history)}));var n=t?(this.flatItems.find((function(e){return withoutVersion(e.id)===t}))||{absoluteIdx:-1}).absoluteIdx:-1;if(-1!==n&&"none"!==this.options.pagination||(this.renderItems=this.buildRenderItems(0)),this.activeItemIdx=-1,-1!==n)this.activate(this.flatItems[n],e);else if(-1!==r)this.activateAndScroll(this.flatItems[0],e);else if(e){var o=this.definition.versionsInfo[this.definition.activeVersionIdx];if(!this.history.currentId&&o.isDefault)return;this.history.replace(o.id)}}}}),Object.defineProperty(e.prototype,"buildRenderItems",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if("none"===this.options.pagination)return this.items;var t=this.flatItems[e];if(t||(t=this.flatItems[0]),"spec"===t.type)return this.buildRenderItems(e+1);if("section"===t.type){var i=[],r=getParentOfType(t,"tag");if("section"===this.options.pagination&&r)return[r];if("item"===this.options.pagination&&r)return[__assign(__assign({},r),{items:getLeadingSectionItems(r)})];for(var n=getParentSpecItem(t),o=(null==n?void 0:n.items)||this.items,a=0;a<o.length&&"section"===o[a].type;a++)i.push(o[a]);return i}switch(this.options.pagination){case"section":if("operation"===t.type&&t.parent)return[t.parent];if("group"!==t.type)return[t];case"item":return"operation"===t.type?[t]:[__assign(__assign({},t),{items:getLeadingSectionItems(t)})];default:return[]}}}),Object.defineProperty(e.prototype,"activateBase",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r){var n,o,a,s,l,c=this;if(void 0===t&&(t=!0),void 0===i&&(i=!1),(null===(n=this.activeItem)||void 0===n?void 0:n.id)===(null==e?void 0:e.id)&&!r)return t&&e&&this.history.replace(e.id,i),void(e&&!e.active&&e.activate());if(!e||"group"!==e.type)if(this.deactivate(this.activeItem),e){if(!(e.depth<=GROUP_DEPTH)){this.activeItemIdx=e.absoluteIdx,t&&this.history.replace(e.id,i),e.activate(),e.expand();var u=new URLSearchParams(r),d="request"===u.get("t"),f="response"===u.get("t"),p=u.get("c"),v=u.get("ct"),b=u.get("in"),h=u.get("path"),m=(null==h?void 0:h.split(this.options.deepLinkSeparator))||[],I=e;if(b)for(var y=I.parameters,g=function(e){var t=null==y?void 0:y.find((function(t){return t.name===e}));null==t||t.expand(),y=null===(o=null==t?void 0:t.schema)||void 0===o?void 0:o.fields},O=0,S=m;O<S.length;O++){g(S[O])}else if(d){var _=null===(a=I.requestBody)||void 0===a?void 0:a.content;null===(s=I.activateMimeName)||void 0===s||s.call(I,v||I.activeMimeName),setTimeout((function(){var e;return c.activateField(m,null===(e=null==_?void 0:_.active)||void 0===e?void 0:e.schema)}),0)}else if(f){var P=I.responses.find((function(e){return e.code===p}));(null==P?void 0:P.expanded)||null==P||P.expand(),null===(l=I.activateMimeName)||void 0===l||l.call(I,v||I.activeMimeName),setTimeout((function(){var e,t;return c.activateField(m,null===(t=null===(e=null==P?void 0:P.content)||void 0===e?void 0:e.active)||void 0===t?void 0:t.schema)}),0)}}}else this.history.replace("",i)}}),Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r,n){var o=this;if(void 0===t&&(t=!0),void 0===i&&(i=!1),void 0===r&&(r=!0),"none"===this.options.pagination)return this.activateBase(e,t,i,n),void(!e&&this.definition instanceof VersionedSpecStore&&this.history.replace(this.definition.currentVersionId,!0));if("group"!==(null==e?void 0:e.type)){if(e&&"item"===this.options.pagination&&"tag"===e.type&&!e.description){if(e.expanded)return void e.collapse();e.expand(),e=this.flatItems[e.absoluteIdx+1]}if(this.activateBase(e,e&&t,i,n),this.activeRenderItemIdx=e?e.absoluteIdx:this.activeRenderItemIdx,this.activeRenderItemIdx>=0){var a=this.buildRenderItems(this.activeRenderItemIdx);a.some((function(e,t){return e.id!==o.renderItems[t].id}))&&(this.renderItems=a),this.renderItems[0]&&(this.activeRenderItemIdx=this.renderItems[0].absoluteIdx)}r&&setTimeout((function(){return o.scrollToActive()})),!e&&this.definition instanceof VersionedSpecStore&&this.history.replace(this.definition.currentVersionId,!0)}}}),Object.defineProperty(e.prototype,"activateField",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){for(var i,r=function(r){var n=e[r],o=r===e.length-1;if((null==t?void 0:t.hasType("array"))&&(null==t?void 0:t.items)&&(t=null==t?void 0:t.items),null==t?void 0:t.oneOf){var a=Number(n);return null==t||t.activateOneOf(a),t=null==t?void 0:t.oneOf[a],"continue"}(null==t?void 0:t.hasType("array"))&&(null==t?void 0:t.items)&&(t=null==t?void 0:t.items);var s=null===(i=null==t?void 0:t.fields)||void 0===i?void 0:i.find((function(e){return e.name===n}));o||null==s||s.expand(),t=null==s?void 0:s.schema},n=0;n<e.length-1;n++)r(n)}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0!==e)for(e.deactivate();void 0!==e;)e.collapse(),e=e.parent}}),Object.defineProperty(e.prototype,"activateAndScroll",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,r){void 0===r&&(r="");var n=r.split(this.options.deepLinkPrefix)[1],o=e&&this.getItemById(e.id)||e;this.activate(o,t,i,!1,n),this.scrollToActive(n?r:""),o&&o.items.length||this.closeSidebar()}}),Object.defineProperty(e.prototype,"scrollToActive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e?setTimeout((function(){return t.scroll.scrollIntoViewBySelector("["+SECTION_ATTR+'="'+e+'"]')}),0):this.scroll.scrollIntoView(this.getElementAt(this.activeItemIdx))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;null===(e=this._unsubscribe)||void 0===e||e.call(this),null===(t=this._hashUnsubscribe)||void 0===t||t.call(this)}}),__decorate([observable],e.prototype,"flatItems",void 0),__decorate([observable],e.prototype,"items",void 0),__decorate([observable],e.prototype,"activeRenderItemIdx",void 0),__decorate([observable.ref],e.prototype,"renderItems",void 0),__decorate([observable],e.prototype,"activeItemIdx",void 0),__decorate([observable],e.prototype,"sideBarOpened",void 0),__decorate([action],e.prototype,"toggleSidebar",null),__decorate([action],e.prototype,"closeSidebar",null),__decorate([action],e.prototype,"activateBase",null),__decorate([action],e.prototype,"activate",null),__decorate([action.bound],e.prototype,"activateAndScroll",null),e}();export{ProMenu};function withoutVersion(e){return e.split("/").slice(1).join("/")}function getParentSpecItem(e){for(;e;){if("spec"===e.type)return e;e=e.parent}}function getParentOfType(e,t){if(e&&e.parent)return e.parent.type===t?e.parent:getParentOfType(e.parent,t)}function getLeadingSectionItems(e){for(var t=[],i=0,r=e.items;i<r.length;i++){var n=r[i];if("section"!==n.type)break;t.push(n)}return t}function normalizeItem(e,t,i,r,n){if(e.absoluteIdx=t,"none"!==i){var o=getParentOfType(e,"tag");if(e.parent&&o&&!("_id_normalized"in e)){if(r){var a=e.id.split("/"),s=a[0],l=a[1],c=withoutVersion(e.id);if("operation"===e.type&&!l.startsWith("operation"))return;e.id=s+"/"+withoutVersion(o.id)+"/"+c}else{if("operation"===e.type&&!e.id.startsWith("operation"))return;e.id=o.id+"/"+e.id}e._id_normalized=!0}}"group"!==e.type&&(e.href=n.linkForId(e.id))}
2
2
  //# sourceMappingURL=ProMenu.js.map
@@ -1,9 +1,9 @@
1
1
  import { IValueDidChange } from 'mobx';
2
- import { ContentItemModel, IMenuItem, MarkerService, OperationModel, RedocNormalizedOptions, RedocRawOptions, SearchStore, SpecStore, OpenAPIExternalDocumentation } from '../redoc-lib';
2
+ import { ContentItemModel, IMenuItem, MarkerService, OperationModel, RedocNormalizedOptions, RedocRawOptions, SearchStore, SpecStore, OpenAPIExternalDocumentation, OpenAPIDefinition } from '../redoc-lib';
3
3
  import { ProMenu } from './ProMenu';
4
4
  import { SearchResultMeta } from './SearchStore';
5
5
  import { ThemeExtension } from './extendTheme';
6
- import { VersionedSpecStore } from './VersionedSpecStore';
6
+ import { SpecVersions, VersionedSpecStore } from './VersionedSpecStore';
7
7
  import { LicenseInfo } from './check';
8
8
  import { CodeSamplesConfig, Languages } from './code-samples/';
9
9
  import { Events, LayoutVariant } from './store-types';
@@ -51,7 +51,7 @@ export declare type RedocProUserOptionsExt = {
51
51
  linkForId?: ((id: string) => string) | null;
52
52
  generateDeepLink?: ((fieldFragment: string, operationLink: any) => string) | undefined | null;
53
53
  onDeepLinkClick?: ((link: string) => void) | undefined | null;
54
- requestInterceptor?: ((req: any, operation: OperationModel) => any) | undefined | null;
54
+ requestInterceptor?: ((req: Request, operation: OperationModel) => void) | undefined | null;
55
55
  oAuth2RedirectURI?: string | null;
56
56
  corsProxyUrl?: string | null;
57
57
  authCorsProxyUrl?: string | null;
@@ -83,10 +83,10 @@ export interface ProStoreState {
83
83
  };
84
84
  definition: {
85
85
  url?: string;
86
- data: any;
86
+ data: GenericObject;
87
87
  activeVersionIdx?: number;
88
88
  };
89
- searchIndex: any;
89
+ searchIndex?: number;
90
90
  tryItOperationId?: string;
91
91
  options: RedocProRawOptions;
92
92
  searchIndexPath?: string;
@@ -127,10 +127,10 @@ export declare class ProStore {
127
127
  activeSampleLanguage: string;
128
128
  isLoading: boolean;
129
129
  l: Promise<LicenseInfo>;
130
- constructor(spec: any | Array<{
130
+ constructor(spec: OpenAPIDefinition | SpecVersions | Array<{
131
131
  title: string;
132
132
  url: string;
133
- }>, specUrl?: string, options?: RedocProRawOptions, createIndex?: boolean);
133
+ }> | string, specUrl?: string, options?: RedocProRawOptions, createIndex?: boolean);
134
134
  initProOptions(options: RedocProRawOptions): void;
135
135
  initSearch(options: RedocProNormalizedOptions, createIndex: boolean): void;
136
136
  onDidMount(): void;
@@ -1,2 +1,2 @@
1
- var _a;import{__assign,__awaiter,__decorate,__generator}from"tslib";import{action,makeObservable,observable,observe}from"mobx";import{bundle,Config}from"@redocly/openapi-core";import{bind,debounce}from"decko";import{IS_BROWSER,MarkerService,RedocNormalizedOptions,ScrollService,SecurityDefs,SpecStore,SECURITY_DEFINITIONS_COMPONENT_NAME,SECURITY_DEFINITIONS_JSX_NAME,SCHEMA_DEFINITION_JSX_NAME,SchemaDefinition,createParsedDocument}from"../redoc-lib";import{FakeHistoryService,ProHashHistoryService,PushStateHistoryService}from"./history";import{ProMenu}from"./ProMenu";import{DeepSearchStore,RemoteSearch,DEFAULT_SEARCH_MAX_DEPTH}from"./SearchStore";import{extendTheme}from"./extendTheme";import{RedocResponse,PullRight}from"../components/pluggable";import{VersionedSpecStore}from"./VersionedSpecStore";import parseToken from"./check";import{normalizePath}from"./utils";import{fromSessionStorage,toSessionStorage,toLocalStorage,fromLocalStorage,setGlobalStore}from"../utils";import{LayoutVariant}from"./store-types";var global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,NestingGroup=function(){function e(e,t,i,o){var n=this;Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"absoluteIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"linkable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"expanded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"level",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.id="section/"+e,this.type="nesting-group",this.name=i||"",this.level=1,this.depth=1,this.description="",this.parent=void 0,this.expanded=!1,this.items=t,this.linkable=!!o,t.forEach((function(e){return e.parent=n})),increaseDepthDeep(t)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!0,this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!1}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),__decorate([observable],e.prototype,"active",void 0),__decorate([observable],e.prototype,"expanded",void 0),__decorate([action],e.prototype,"activate",null),__decorate([action],e.prototype,"expand",null),__decorate([action],e.prototype,"collapse",null),__decorate([action],e.prototype,"deactivate",null),e}();export{NestingGroup};function increaseDepthDeep(e){Array.isArray(e)&&e.forEach((function(e){e.depth++,e.parent&&"group"===e.parent.type&&(e.depth=e.parent.depth),increaseDepthDeep(e.items)}))}var ProStore=function(){function e(e,t,i,o){var n=this;void 0===i&&(i={}),void 0===o&&(o=!0),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.initProOptions(i),IS_BROWSER&&(this.l=parseToken(i.licenseKey),this.l.then((function(e){e.valid&&e.allowed&&!e.expired||e.local||(n.menu.items=[],n.menu.flatItems=n.menu.flatItems.slice(0,1),n.menu.renderItems=[])})));var r=e&&Array.isArray(e.versions),a=this.options.disableSidebar?new FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new PushStateHistoryService(this.options,r):new ProHashHistoryService(this.options,r);this.definition=r?new VersionedSpecStore(e,this.options,a.currentId.split("/")[0]):new SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadFileName=""),this.scroll=new ScrollService(this.options),this.options.disableSidebar||ProMenu.updateOnHistory(a.currentId,this.scroll),this.menu=new ProMenu(this.definition,this.scroll,this.options,a),this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,o),this.disposer=observe(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),setGlobalStore(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r;e=deepClone(e),this.rawOptions=extendTheme(e),this.options=new RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),this.options.showConsole=null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(n=this.rawOptions.showChangeLayoutButton)||void 0===n||n,this.options.layout=this.rawOptions.layout||LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||"summary-only",this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var a="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy="none"===this.options.pagination?"hash":"browser",!(null===(r=this.rawOptions)||void 0===r?void 0:r.pagination)&&(null==a?void 0:a.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==a?void 0:a.scope){case"all":default:this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser"}this.options.markdownItemsPagination="none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&normalizePath(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.showConsole,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]},this.options.searchMaxDepth=this.rawOptions.searchMaxDepth||DEFAULT_SEARCH_MAX_DEPTH}}),Object.defineProperty(e.prototype,"initSearch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;global.__REDOCLY_SEARCH_URL?this.search=new RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new DeepSearchStore(e),t&&setTimeout((function(){var e;return null===(e=i.search)||void 0===e?void 0:e.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore&&observe(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(IS_BROWSER&&a){var s=r.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(n=i.search)||void 0===n||n.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=fromLocalStorage("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=fromLocalStorage("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=fromSessionStorage("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,toSessionStorage("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=LayoutVariant.THREE_PANEL),this.layout=e,toLocalStorage("layoutVariant",e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,toLocalStorage("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"activateSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.setActiveSampleLanguage(e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n;return __awaiter(this,void 0,void 0,(function(){var r,a,s,l,p,u,c;return __generator(this,(function(h){switch(h.label){case 0:return r=this.definition.parser.definition,a=JSON.parse(JSON.stringify(r)),s=__assign(__assign({},getSpecVersionObj(a)),{components:a.components,paths:(u={},u[e.path]=(c={},c[e.httpVerb]=null===(i=null===(t=a.paths)||void 0===t?void 0:t[e.path])||void 0===i?void 0:i[e.httpVerb],c.parameters=null===(n=null===(o=a.paths)||void 0===o?void 0:o[e.path])||void 0===n?void 0:n.parameters,c),u)}),l=new Config({}),p=createParsedDocument(s),[4,bundle({config:l,doc:p,dereference:!0})];case 1:return h.sent(),[2,a]}}))}))}}),Object.defineProperty(e.prototype,"observeAllAndRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(i){for(var o=0,n=i;o<n.length;o++){var r=n[o];if("operation"===r.type)for(var a=0,s=r.responses;a<s.length;a++){var l=s[a];observe(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&observe(this.menu,"renderItems",(function(){return t(e.menu.renderItems)}))}}),Object.defineProperty(e.prototype,"remark",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.newValue&&setTimeout((function(){return t.marker.mark()}),0)}}),Object.defineProperty(e,"fromJS",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var i,o=new e(t.definition.data,t.definition.url,t.options,!1);setGlobalStore(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore&&t.definition.activeVersionIdx&&(o.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var n=o.menu.flatItems[o.menu.activeItemIdx];if(n&&o.menu.activate(n,!1),!o.options.disableSearch){var r=new URL(window.location.href);r.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:r.pathname+(r.pathname.endsWith("/")?"":"/")+t.searchIndexPath,null===(i=o.search)||void 0===i||i.fromExternalJS(r.toString(),t.searchIndexExport)}return t.tryItOperationId&&(o.tryItOperation=o.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return o.observeAllAndRemark()}),0),o}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return t=o.sent(),[3,3];case 2:t=void 0,o.label=3;case 3:return[2,(i.searchIndex=t,i.options=this.rawOptions,i.tryItOperationId=null===(e=this.tryItOperation)||void 0===e?void 0:e.id,i)]}}))}))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.scroll.dispose(),this.menu.dispose(),this.search&&this.search.dispose(),this.disposer()}}),Object.defineProperty(e.prototype,"updateMarkOnMenu",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=Math.max(0,e),i=Math.min(this.menu.flatItems.length,t+5),o=[],n=t;n<i;n++){(r=this.menu.getElementAt(n))&&(r&&o.push(r))}if("item"===this.options.pagination){var r,a=(this.menu.flatItems[e]||{}).parent;if(null==a?void 0:a.absoluteIdx)(r=this.menu.getElementAt(a.absoluteIdx))&&o.push(r)}this.marker.addOnly(o),this.marker.mark()}}),__decorate([observable],e.prototype,"search",void 0),__decorate([observable],e.prototype,"tryItOperation",void 0),__decorate([observable],e.prototype,"showRightPanel",void 0),__decorate([observable],e.prototype,"layout",void 0),__decorate([observable],e.prototype,"activeSampleLanguage",void 0),__decorate([observable],e.prototype,"isLoading",void 0),__decorate([action],e.prototype,"onDidMount",null),__decorate([action],e.prototype,"toggleRightPanel",null),__decorate([action],e.prototype,"toggleLayout",null),__decorate([action],e.prototype,"disableConsole",null),__decorate([action],e.prototype,"enableConsole",null),__decorate([action],e.prototype,"tryItOut",null),__decorate([action],e.prototype,"setActiveSampleLanguage",null),__decorate([bind,debounce(500)],e.prototype,"activateSampleLanguage",null),__decorate([action],e.prototype,"startLoader",null),__decorate([action],e.prototype,"stopLoader",null),e}();export{ProStore};var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:PullRight,propsSelector:function(){return{}}}},_a[SECURITY_DEFINITIONS_COMPONENT_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SECURITY_DEFINITIONS_JSX_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SCHEMA_DEFINITION_JSX_NAME]={component:SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a)};function joinURLs(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")&&(t=t.substring(1)),e+"/"+t}function addTrailingSlash(e){return e.endsWith("/")?e:e+"/"}function getSpecVersionObj(e){return e.openapi?{openapi:e.openapi}:e.swagger?{swagger:e.swagger}:void 0}function deepClone(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var i in e){var o=e[i];t[i]=deepClone(o)}return t}
1
+ var _a;import{__assign,__awaiter,__decorate,__generator}from"tslib";import{action,makeObservable,observable,observe}from"mobx";import{bundle,Config}from"@redocly/openapi-core";import{bind,debounce}from"decko";import{IS_BROWSER,MarkerService,RedocNormalizedOptions,ScrollService,SecurityDefs,SpecStore,SECURITY_DEFINITIONS_COMPONENT_NAME,SECURITY_DEFINITIONS_JSX_NAME,SCHEMA_DEFINITION_JSX_NAME,SchemaDefinition,createParsedDocument}from"../redoc-lib";import{FakeHistoryService,ProHashHistoryService,PushStateHistoryService}from"./history";import{ProMenu}from"./ProMenu";import{DeepSearchStore,RemoteSearch,DEFAULT_SEARCH_MAX_DEPTH}from"./SearchStore";import{extendTheme}from"./extendTheme";import{RedocResponse,PullRight}from"../components/pluggable";import{VersionedSpecStore}from"./VersionedSpecStore";import parseToken from"./check";import{normalizePath}from"./utils";import{fromSessionStorage,toSessionStorage,toLocalStorage,fromLocalStorage,setGlobalStore}from"../utils";import{LayoutVariant}from"./store-types";var global="undefined"==typeof window?{__REDOCLY_SEARCH_URL:void 0}:window,NestingGroup=function(){function e(e,t,i,o){var n=this;Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"absoluteIdx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"linkable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"expanded",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"depth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"level",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.id="section/"+e,this.type="nesting-group",this.name=i||"",this.level=1,this.depth=1,this.description="",this.parent=void 0,this.expanded=!1,this.items=t,this.linkable=!!o,t.forEach((function(e){return e.parent=n})),increaseDepthDeep(t)}return Object.defineProperty(e.prototype,"activate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!0}}),Object.defineProperty(e.prototype,"expand",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!0,this.parent&&this.parent.expand()}}),Object.defineProperty(e.prototype,"collapse",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.expanded=!1}}),Object.defineProperty(e.prototype,"deactivate",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.active=!1}}),__decorate([observable],e.prototype,"active",void 0),__decorate([observable],e.prototype,"expanded",void 0),__decorate([action],e.prototype,"activate",null),__decorate([action],e.prototype,"expand",null),__decorate([action],e.prototype,"collapse",null),__decorate([action],e.prototype,"deactivate",null),e}();export{NestingGroup};function increaseDepthDeep(e){Array.isArray(e)&&e.forEach((function(e){e.depth++,e.parent&&"group"===e.parent.type&&(e.depth=e.parent.depth),increaseDepthDeep(e.items)}))}var ProStore=function(){function e(e,t,i,o){var n=this;void 0===i&&(i={}),void 0===o&&(o=!0),Object.defineProperty(this,"rawOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"menu",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"marker",{enumerable:!0,configurable:!0,writable:!0,value:new MarkerService}),Object.defineProperty(this,"scroll",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"disposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"search",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tryItOperation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showRightPanel",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"layout",{enumerable:!0,configurable:!0,writable:!0,value:LayoutVariant.THREE_PANEL}),Object.defineProperty(this,"activeSampleLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isLoading",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"l",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.initProOptions(i),IS_BROWSER&&(this.l=parseToken(i.licenseKey),this.l.then((function(e){e.valid&&e.allowed&&!e.expired||e.local||(n.menu.items=[],n.menu.flatItems=n.menu.flatItems.slice(0,1),n.menu.renderItems=[])})));var r="object"==typeof e&&"versions"in e,a=this.options.disableSidebar?new FakeHistoryService(this.options):"browser"===this.options.routingStrategy?new PushStateHistoryService(this.options,r):new ProHashHistoryService(this.options,r);this.definition=r?new VersionedSpecStore(e,this.options,a.currentId.split("/")[0]):new SpecStore(e,t,this.options),i.downloadDefinitionUrl&&(this.definition.info.downloadFileName=""),this.scroll=new ScrollService(this.options),this.options.disableSidebar||ProMenu.updateOnHistory(a.currentId,this.scroll),this.menu=new ProMenu(this.definition,this.scroll,this.options,a),this.menu.initOnHistory(),this.options.disableSearch||this.initSearch(this.options,o),this.disposer=observe(this.menu,"none"===this.options.pagination?"activeItemIdx":"activeRenderItemIdx",(function(e){setTimeout((function(){return n.updateMarkOnMenu(e.newValue)}))})),setGlobalStore(this)}return Object.defineProperty(e.prototype,"initProOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n,r;e=deepClone(e),this.rawOptions=extendTheme(e),this.options=new RedocNormalizedOptions(this.rawOptions,DEFAULT_OPTIONS),this.options.showConsole=null===(t=this.rawOptions.showConsole)||void 0===t||t,this.options.hideRightPanel=null!==(i=this.rawOptions.hideRightPanel)&&void 0!==i&&i,this.showRightPanel=!this.options.hideRightPanel,this.options.showRightPanelToggle=null===(o=this.rawOptions.showRightPanelToggle)||void 0===o||o,this.options.showChangeLayoutButton=null===(n=this.rawOptions.showChangeLayoutButton)||void 0===n||n,this.options.layout=this.rawOptions.layout||LayoutVariant.THREE_PANEL,this.options.defaultSampleLanguage=this.rawOptions.defaultSampleLanguage||"",this.options.deepLinkSeparator=this.rawOptions.deepLinkSeparator||"/",this.options.deepLinkPrefix=this.rawOptions.deepLinkPrefix||"!",this.options.disableDeepLinks=this.rawOptions.disableDeepLinks||!1,this.options.sideNavStyle=this.rawOptions.sideNavStyle||"summary-only",this.options.whiteLabel=!!this.rawOptions.whiteLabel,this.options.hideLogo=!!this.rawOptions.hideLogo,this.options.hideInfoSection=!!this.rawOptions.hideInfoSection,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.oAuth2RedirectURI=this.rawOptions.oAuth2RedirectURI||null,this.options.events=this.rawOptions.events||{},this.options.corsProxyUrl=this.rawOptions.corsProxyUrl?addTrailingSlash(this.rawOptions.corsProxyUrl):null,this.options.authCorsProxyUrl=this.rawOptions.authCorsProxyUrl?addTrailingSlash(this.rawOptions.authCorsProxyUrl):null,this.options.theme.scrollYOffset=this.options.scrollYOffset,this.options.linkForId=this.rawOptions.linkForId||null,this.options.generateDeepLink=this.rawOptions.generateDeepLink||null,this.options.onDeepLinkClick=this.rawOptions.onDeepLinkClick||null,this.options.requestInterceptor=this.rawOptions.requestInterceptor||null,this.options.sidebarLinks=this.rawOptions.sidebarLinks||{};var a="object"==typeof this.rawOptions.layout?this.rawOptions.layout:null;if(this.options.pagination=this.rawOptions.pagination||"none",this.options.routingStrategy="none"===this.options.pagination?"hash":"browser",!(null===(r=this.rawOptions)||void 0===r?void 0:r.pagination)&&(null==a?void 0:a.scope))switch(console.warn('"layout.scope" and "routingStrategy" settings are deprecated. Please, use "pagination" instead.'),null==a?void 0:a.scope){case"all":default:this.options.pagination="none",this.options.routingStrategy="hash";break;case"section":this.options.pagination="section",this.options.routingStrategy="browser";break;case"item":this.options.pagination="item",this.options.routingStrategy="browser"}this.options.markdownItemsPagination="none",!1!==this.rawOptions.showNextButton&&(this.options.showNextButton=!0),this.options.disableSidebar=!!e.disableSidebar,this.options.disableSidebar&&(this.options.theme.sidebar.width="0px"),this.options.skipBundleAndConvert=!!e.skipBundleAndConvert,this.options.routingBasePath=e.routingBasePath&&normalizePath(e.routingBasePath)||"",this.options.searchAutoExpand=!1!==e.searchAutoExpand,this.options.searchMode=e.searchMode||"default",this.options.ctrlFHijack=void 0===e.ctrlFHijack||e.ctrlFHijack,this.options.disablePaginationLoadingAnimation=!!e.disablePaginationLoadingAnimation||"none"===this.options.pagination,this.options.showConsole,this.options.generateCodeSamples=e.generateCodeSamples||{languages:[]},this.options.searchMaxDepth=this.rawOptions.searchMaxDepth||DEFAULT_SEARCH_MAX_DEPTH}}),Object.defineProperty(e.prototype,"initSearch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i=this;global.__REDOCLY_SEARCH_URL?this.search=new RemoteSearch(global.__REDOCLY_SEARCH_URL):this.search=new DeepSearchStore(e),t&&setTimeout((function(){var e;return null===(e=i.search)||void 0===e?void 0:e.indexItems(i.menu.items)}),50),this.definition instanceof VersionedSpecStore&&observe(this.definition,"activeVersionIdx",(function(t){var o,n,r=i.definition;null===(o=i.search)||void 0===o||o.dispose(),i.search=new DeepSearchStore(e);var a=r.versions[t.newValue]._searchIndexName;if(IS_BROWSER&&a){var s=r.versions[t.newValue]._searchIndexName,l=new URL(window.location.href);l.pathname=joinURLs(i.options.routingBasePath,s),null===(n=i.search)||void 0===n||n.fromExternalJS(l.toString(),__redoc_state.searchIndexExport),i.observeAllAndRemark()}else setTimeout((function(){var e;null===(e=i.search)||void 0===e||e.indexItems(i.menu.items)}),0)})),IS_BROWSER&&this.observeAllAndRemark()}}),Object.defineProperty(e.prototype,"onDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.menu.updateOnHistory(),this.updateMarkOnMenu(this.menu.activeItemIdx),this.layout=fromLocalStorage("layoutVariant")||this.options.layout||this.layout,this.activeSampleLanguage=fromLocalStorage("activeSampleLanguage")||this.options.defaultSampleLanguage,this.options.showRightPanelToggle){var e=fromSessionStorage("showRightPanelToggleState");e&&(this.showRightPanel="true"===e)}}}),Object.defineProperty(e.prototype,"toggleRightPanel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.showRightPanel=null!=e?e:!this.showRightPanel,toSessionStorage("showRightPanelToggleState",JSON.stringify(this.showRightPanel))}}),Object.defineProperty(e.prototype,"toggleLayout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=LayoutVariant.THREE_PANEL),this.layout=e,toLocalStorage("layoutVariant",e)}}),Object.defineProperty(e.prototype,"disableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!1}}),Object.defineProperty(e.prototype,"enableConsole",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.options.showConsole=!0}}),Object.defineProperty(e.prototype,"tryItOut",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.tryItOperation=e}}),Object.defineProperty(e.prototype,"setActiveSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.activeSampleLanguage===e)return this.stopLoader();this.activeSampleLanguage=e,toLocalStorage("activeSampleLanguage",e)}}),Object.defineProperty(e.prototype,"activateSampleLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.setActiveSampleLanguage(e)}}),Object.defineProperty(e.prototype,"startLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading||(this.isLoading=!0)}}),Object.defineProperty(e.prototype,"stopLoader",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isLoading&&(this.isLoading=!1)}}),Object.defineProperty(e.prototype,"dereferenceSpecForTryIt",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,i,o,n;return __awaiter(this,void 0,void 0,(function(){var r,a,s,l,p,u,c;return __generator(this,(function(h){switch(h.label){case 0:return r=this.definition.parser.definition,a=JSON.parse(JSON.stringify(r)),s=__assign(__assign({},getSpecVersionObj(a)),{components:a.components,paths:(u={},u[e.path]=(c={},c[e.httpVerb]=null===(i=null===(t=a.paths)||void 0===t?void 0:t[e.path])||void 0===i?void 0:i[e.httpVerb],c.parameters=null===(n=null===(o=a.paths)||void 0===o?void 0:o[e.path])||void 0===n?void 0:n.parameters,c),u)}),l=new Config({}),p=createParsedDocument(s),[4,bundle({config:l,doc:p,dereference:!0})];case 1:return h.sent(),[2,a]}}))}))}}),Object.defineProperty(e.prototype,"observeAllAndRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(i){for(var o=0,n=i;o<n.length;o++){var r=n[o];if("operation"===r.type)for(var a=0,s=r.responses;a<s.length;a++){var l=s[a];observe(l,"expanded",(function(t){return e.remark(t)}))}else"tag"===r.type&&t(r.items||[])}};t(this.menu.renderItems),"none"!==this.options.pagination&&observe(this.menu,"renderItems",(function(){return t(e.menu.renderItems)}))}}),Object.defineProperty(e.prototype,"remark",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.newValue&&setTimeout((function(){return t.marker.mark()}),0)}}),Object.defineProperty(e,"fromJS",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var i,o=new e(t.definition.data,t.definition.url,t.options,!1);setGlobalStore(o),o.menu.activeItemIdx=void 0!==t.menu.activeItemIdx?t.menu.activeItemIdx:-1,o.definition instanceof VersionedSpecStore&&t.definition.activeVersionIdx&&(o.definition.activeVersionIdx=t.definition.activeVersionIdx||0);var n=o.menu.flatItems[o.menu.activeItemIdx];if(n&&o.menu.activate(n,!1),!o.options.disableSearch){var r=new URL(window.location.href);r.pathname=t.searchIndexPath&&t.searchIndexPath.startsWith("/")?t.searchIndexPath:r.pathname+(r.pathname.endsWith("/")?"":"/")+t.searchIndexPath,null===(i=o.search)||void 0===i||i.fromExternalJS(r.toString(),t.searchIndexExport)}return t.tryItOperationId&&(o.tryItOperation=o.menu.flatItems.find((function(e){return e.id===t.tryItOperationId}))),setTimeout((function(){return o.observeAllAndRemark()}),0),o}}),Object.defineProperty(e.prototype,"toJS",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return __awaiter(this,void 0,void 0,(function(){var t,i;return __generator(this,(function(o){switch(o.label){case 0:return i={menu:{activeItemIdx:this.menu.activeItemIdx},definition:this.definition instanceof VersionedSpecStore?{url:void 0,data:this.definition.toJS()}:{url:this.definition.parser.definitionUrl,data:this.definition.parser.definition}},this.search?[4,this.search.toJS()]:[3,2];case 1:return t=o.sent(),[3,3];case 2:t=void 0,o.label=3;case 3:return[2,(i.searchIndex=t,i.options=this.rawOptions,i.tryItOperationId=null===(e=this.tryItOperation)||void 0===e?void 0:e.id,i)]}}))}))}}),Object.defineProperty(e.prototype,"dispose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.scroll.dispose(),this.menu.dispose(),this.search&&this.search.dispose(),this.disposer()}}),Object.defineProperty(e.prototype,"updateMarkOnMenu",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=Math.max(0,e),i=Math.min(this.menu.flatItems.length,t+5),o=[],n=t;n<i;n++){(r=this.menu.getElementAt(n))&&(r&&o.push(r))}if("item"===this.options.pagination){var r,a=(this.menu.flatItems[e]||{}).parent;if(null==a?void 0:a.absoluteIdx)(r=this.menu.getElementAt(a.absoluteIdx))&&o.push(r)}this.marker.addOnly(o),this.marker.mark()}}),__decorate([observable],e.prototype,"search",void 0),__decorate([observable],e.prototype,"tryItOperation",void 0),__decorate([observable],e.prototype,"showRightPanel",void 0),__decorate([observable],e.prototype,"layout",void 0),__decorate([observable],e.prototype,"activeSampleLanguage",void 0),__decorate([observable],e.prototype,"isLoading",void 0),__decorate([action],e.prototype,"onDidMount",null),__decorate([action],e.prototype,"toggleRightPanel",null),__decorate([action],e.prototype,"toggleLayout",null),__decorate([action],e.prototype,"disableConsole",null),__decorate([action],e.prototype,"enableConsole",null),__decorate([action],e.prototype,"tryItOut",null),__decorate([action],e.prototype,"setActiveSampleLanguage",null),__decorate([bind,debounce(500)],e.prototype,"activateSampleLanguage",null),__decorate([action],e.prototype,"startLoader",null),__decorate([action],e.prototype,"stopLoader",null),e}();export{ProStore};var DEFAULT_OPTIONS={ignoreNamedSchemas:["java.io.ObjectStreamField"],allowedMdComponents:(_a={RedocResponse:{component:RedocResponse,propsSelector:function(e){return{store:e}}},PullRight:{component:PullRight,propsSelector:function(){return{}}}},_a[SECURITY_DEFINITIONS_COMPONENT_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SECURITY_DEFINITIONS_JSX_NAME]={component:SecurityDefs,propsSelector:function(e){return{securitySchemes:e.definition.securitySchemes}}},_a[SCHEMA_DEFINITION_JSX_NAME]={component:SchemaDefinition,propsSelector:function(e){return{parser:e.definition.parser,options:e.options,layout:e.layout,showRightPanel:e.showRightPanel}}},_a)};function joinURLs(e,t){return e.endsWith("/")&&(e=e.slice(0,-1)),t.startsWith("/")&&(t=t.substring(1)),e+"/"+t}function addTrailingSlash(e){return e.endsWith("/")?e:e+"/"}function getSpecVersionObj(e){return e.openapi?{openapi:e.openapi}:e.swagger?{swagger:e.swagger}:void 0}function deepClone(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var i in e){var o=e[i];t[i]=deepClone(o)}return t}
2
2
  //# sourceMappingURL=ProStore.js.map
@@ -3,7 +3,7 @@ import { CodeBuilder } from './code-builder';
3
3
  export declare function getPreserveTransformer({ body, authorizationHeader, }: {
4
4
  body?: boolean;
5
5
  authorizationHeader?: boolean;
6
- }): (input: any, prop: string, originalResult: string) => string;
6
+ }): (input: GenericObject, prop: string, originalResult: string) => string;
7
7
  export declare function addIndentation(str: string, { level, indent, firstLine }?: {
8
8
  level?: number | undefined;
9
9
  indent?: string | undefined;
@@ -23,14 +23,20 @@ export interface SnippetRequest extends CustomHAR {
23
23
  fullUrl?: string;
24
24
  }
25
25
  export declare class HTTPSnippet {
26
- private request;
26
+ private readonly request;
27
27
  constructor(data: CustomHAR);
28
28
  prepare(request: SnippetRequest): SnippetRequest;
29
- convert(target: any, client: any, opts: any): string;
30
- _matchTarget(target: any, client: any): any;
29
+ convert(target: string, client: string, opts: PrivateOptions): string;
30
+ _matchTarget<T>(target: string, client: Maybe<string>): T | false;
31
31
  }
32
32
  export interface PrivateOptions {
33
33
  variablesPrefix?: string;
34
+ showBoilerplate?: boolean;
35
+ withImports?: boolean;
36
+ withComments?: boolean;
37
+ withWrapper?: boolean;
38
+ printBody?: boolean;
39
+ level?: number;
34
40
  }
35
41
  export interface LanguageHandler<LanguageOptions> {
36
42
  (request: SnippetRequest, opts: LanguageOptions & PrivateOptions, { target, client }: {
@@ -7,7 +7,7 @@ declare const targets: {
7
7
  default: string;
8
8
  };
9
9
  fetch: import("..").LanguageHandler<(import("../..").BasicLanguageOptions & {
10
- credentials?: "same-origin" | "omit" | "include" | undefined;
10
+ credentials?: "omit" | "same-origin" | "include" | undefined;
11
11
  }) | undefined>;
12
12
  };
13
13
  node: {
@@ -6,7 +6,7 @@ declare const _default: {
6
6
  default: string;
7
7
  };
8
8
  fetch: import("../..").LanguageHandler<(import("../../..").BasicLanguageOptions & {
9
- credentials?: "same-origin" | "omit" | "include" | undefined;
9
+ credentials?: "omit" | "same-origin" | "include" | undefined;
10
10
  }) | undefined>;
11
11
  };
12
12
  export default _default;
@@ -1,2 +1,2 @@
1
- import{__assign}from"tslib";import{format}from"util";import{CodeBuilder}from"../../helpers/code-builder";import{HTTPSnippet}from"../..";import{Lang}from"../../helpers/constants";import{buildUrlExpression,printUrlVariablesDeclarations}from"../../helpers/code-helpers";import{startCase}from"../../helpers/lodash-int";import{normalizeMimeType}from"../../../../utils";import{objectToPhpArray}from"./utils";function getVariableName(e,a){return a?"$"+a+startCase(e):"$"+e}var handler=function(e,a,r){var n,t,i=r.target,s=r.client,o=__assign({showBoilerplate:!0,checkErrors:!1,printBody:!0,indent:" ",noTags:!0,shortTags:!1,maxRedirects:10,namedErrors:!1,closingTag:!1},a),l=!1,p=new CodeBuilder({indentation:o.indent,capitalize:!0,lang:Lang.PHP}),u=null===(n=e.securityOAuth2ExtraCalls)||void 0===n?void 0:n[0],c=getVariableName("curl",o.variablesPrefix),h=getVariableName("response",o.variablesPrefix),d=getVariableName("error",o.variablesPrefix);if(o.noTags||p.push(o.shortTags?"<?":"<?php").blank(),u){var m="oAuth2",b=new HTTPSnippet(u).convert(i,s,__assign(__assign({},o),{showBoilerplate:!1,variablesPrefix:m}));p.push(b),p.blank(),e.allHeaders.Authorization='Bearer " . '+getVariableName("response",m)+".access_token"}var f=Object.keys(e.headersObj).sort().map((function(a){return"Authorization"===a&&u?format('"%s: %s',a,e.allHeaders.Authorization):format('"%s: %s"',a,e.headersObj[a])}));if(e.basicAuth){var v=e.basicAuth,T=v.username,_=v.password;f.push('"Authorization: Basic " . base64_encode("'+T+":"+_+'")')}o.showBoilerplate&&p.push("/**").push(" * Requires libcurl").push(" */").blank(),printUrlVariablesDeclarations(e,p);var g="";if(Object.keys(e.queryObj||{}).length){var P=objectToPhpArray(e.queryObj,{indent:o.indent});g="$query",p.push(g+" = "+P+";").blank()}if(p.push(c+" = curl_init();"),p.blank(),e.postData)switch(normalizeMimeType(e.postData.mimeType)){case"application/json":var y=objectToPhpArray(e.postData.jsonObj,{indent:o.indent});l=!0,t="json_encode($payload)",p.push("$payload = "+y+";").blank();break;case"multipart/form-data":var k=e.postData.params.map((function(e){var a=e.name,r=e.value;return o.indent+'"'+a+'" => "'+r+'",\n'})).join("");l=!0,t="$payload",p.push("$payload = array(\n"+k+");").blank();break;case"application/x-www-form-urlencoded":var O=e.postData.params.map((function(e){return e.name+"="+e.value})).join("&");l=!0,t="$payload",p.push('$payload = "'+O+'";').blank();break;default:t=e.postData.text}var R=buildUrlExpression(e,p);g&&(R.endsWith('"')?R=R.slice(0,-1)+'?" . http_build_query('+g+")":R+=' . "?" . http_build_query('+g+")");var j=[{escape:!l,name:"CURLOPT_POSTFIELDS",value:t},{escape:!0,name:"CURLOPT_PORT",value:e.uriObj.port},{escape:!1,name:"CURLOPT_URL",value:R},{escape:!1,name:"CURLOPT_RETURNTRANSFER",value:"true"},{escape:!0,name:"CURLOPT_CUSTOMREQUEST",value:e.method.toUpperCase()}];p.push("curl_setopt_array("+c+", [");var U=new CodeBuilder({indentation:o.indent,lineJoin:"\n"+o.indent,variablesPrefix:o.variablesPrefix,capitalize:!0,lang:Lang.PHP});f.length&&U.push("CURLOPT_HTTPHEADER => [").push(1,f.join(",\n"+o.indent+o.indent)).push("],"),j.forEach((function(e){[null,void 0].includes(e.value)||U.push(format("%s => %s,",e.name,e.escape?JSON.stringify(e.value):e.value))}));var C=e.cookies.map((function(e){return encodeURIComponent(e.name)+"="+encodeURIComponent(e.value)}));return C.length&&U.push(format('CURLOPT_COOKIE => "%s",',C.join("; "))),p.push(1,U.join()).push("]);").blank().push(h+" = curl_exec("+c+");").push(d+" = curl_error("+c+");").blank().push("curl_close("+c+");").blank().push("if ("+d+") {"),o.namedErrors?p.push(1,'echo array_flip(get_defined_constants(true)["curl"])['+d+"];"):p.push(1,'echo "cURL Error #:" . '+d+";"),p.push("} else {").push(1,"echo "+h+";").push("}"),!o.noTags&&o.closingTag&&p.blank().push("?>"),p.join()};export var info={key:"curl",title:"cURL",link:"http://php.net/manual/en/book.curl.php",description:"PHP with ext-curl"};export default handler;
1
+ import{__assign}from"tslib";import{format}from"util";import{CodeBuilder}from"../../helpers/code-builder";import{HTTPSnippet}from"../..";import{Lang}from"../../helpers/constants";import{buildUrlExpression,printUrlVariablesDeclarations}from"../../helpers/code-helpers";import{startCase}from"../../helpers/lodash-int";import{normalizeMimeType}from"../../../../utils";import{objectToPhpArray}from"./utils";function getVariableName(e,a){return a?"$"+a+startCase(e):"$"+e}var handler=function(e,a,r){var n,t,i=r.target,s=r.client,o=__assign({showBoilerplate:!0,checkErrors:!1,printBody:!0,indent:" ",noTags:!0,shortTags:!1,maxRedirects:10,namedErrors:!1,closingTag:!1},a),l=!1,p=new CodeBuilder({indentation:o.indent,capitalize:!0,lang:Lang.PHP}),u=null===(n=e.securityOAuth2ExtraCalls)||void 0===n?void 0:n[0],c=getVariableName("curl",o.variablesPrefix),h=getVariableName("response",o.variablesPrefix),d=getVariableName("error",o.variablesPrefix);if(o.noTags||p.push(o.shortTags?"<?":"<?php").blank(),u){var m="oAuth2",b=new HTTPSnippet(u).convert(i,s,__assign(__assign({},o),{showBoilerplate:!1,variablesPrefix:m}));p.push(b),p.blank(),e.allHeaders.Authorization='Bearer " . '+getVariableName("response",m)+".access_token"}var f=Object.keys(e.headersObj).sort().map((function(a){return"Authorization"===a&&u?format('"%s: %s',a,e.allHeaders.Authorization):format('"%s: %s"',a,e.headersObj[a])}));if(e.basicAuth){var v=e.basicAuth,T=v.username,_=v.password;f.push('"Authorization: Basic " . base64_encode("'+T+":"+_+'")')}o.showBoilerplate&&p.push("/**").push(" * Requires libcurl").push(" */").blank(),printUrlVariablesDeclarations(e,p);var g="";if(Object.keys(e.queryObj||{}).length){var P=objectToPhpArray(e.queryObj||{},{indent:o.indent});g="$query",p.push(g+" = "+P+";").blank()}if(p.push(c+" = curl_init();"),p.blank(),e.postData)switch(normalizeMimeType(e.postData.mimeType)){case"application/json":var y=objectToPhpArray(e.postData.jsonObj||{},{indent:o.indent});l=!0,t="json_encode($payload)",p.push("$payload = "+y+";").blank();break;case"multipart/form-data":var k=e.postData.params.map((function(e){var a=e.name,r=e.value;return o.indent+'"'+a+'" => "'+r+'",\n'})).join("");l=!0,t="$payload",p.push("$payload = array(\n"+k+");").blank();break;case"application/x-www-form-urlencoded":var O=e.postData.params.map((function(e){return e.name+"="+e.value})).join("&");l=!0,t="$payload",p.push('$payload = "'+O+'";').blank();break;default:t=e.postData.text}var R=buildUrlExpression(e,p);g&&(R.endsWith('"')?R=R.slice(0,-1)+'?" . http_build_query('+g+")":R+=' . "?" . http_build_query('+g+")");var j=[{escape:!l,name:"CURLOPT_POSTFIELDS",value:t},{escape:!0,name:"CURLOPT_PORT",value:e.uriObj.port},{escape:!1,name:"CURLOPT_URL",value:R},{escape:!1,name:"CURLOPT_RETURNTRANSFER",value:"true"},{escape:!0,name:"CURLOPT_CUSTOMREQUEST",value:e.method.toUpperCase()}];p.push("curl_setopt_array("+c+", [");var U=new CodeBuilder({indentation:o.indent,lineJoin:"\n"+o.indent,variablesPrefix:o.variablesPrefix,capitalize:!0,lang:Lang.PHP});f.length&&U.push("CURLOPT_HTTPHEADER => [").push(1,f.join(",\n"+o.indent+o.indent)).push("],"),j.forEach((function(e){[null,void 0].includes(e.value)||U.push(format("%s => %s,",e.name,e.escape?JSON.stringify(e.value):e.value))}));var C=e.cookies.map((function(e){return encodeURIComponent(e.name)+"="+encodeURIComponent(e.value)}));return C.length&&U.push(format('CURLOPT_COOKIE => "%s",',C.join("; "))),p.push(1,U.join()).push("]);").blank().push(h+" = curl_exec("+c+");").push(d+" = curl_error("+c+");").blank().push("curl_close("+c+");").blank().push("if ("+d+") {"),o.namedErrors?p.push(1,'echo array_flip(get_defined_constants(true)["curl"])['+d+"];"):p.push(1,'echo "cURL Error #:" . '+d+";"),p.push("} else {").push(1,"echo "+h+";").push("}"),!o.noTags&&o.closingTag&&p.blank().push("?>"),p.join()};export var info={key:"curl",title:"cURL",link:"http://php.net/manual/en/book.curl.php",description:"PHP with ext-curl"};export default handler;
2
2
  //# sourceMappingURL=curl.js.map
@@ -0,0 +1,11 @@
1
+ export declare type Input = GenericObject | string;
2
+ export declare type ObjectToPhpArrayOptions = {
3
+ newLine?: string;
4
+ newLineOrSpace?: string;
5
+ pad?: string;
6
+ indent?: string;
7
+ inlineCharacterLimit?: number;
8
+ transform?: (input: Input, i: number | string, result: string) => string;
9
+ singleQuotes?: boolean;
10
+ filter?: (obj: Input | string, el: string) => boolean;
11
+ };
@@ -0,0 +1,2 @@
1
+ export{};
2
+ //# sourceMappingURL=types.js.map
@@ -1,12 +1,2 @@
1
- declare type objectToPhpArrayOptions = {
2
- newLine?: string;
3
- newLineOrSpace?: string;
4
- pad?: string;
5
- indent?: string;
6
- inlineCharacterLimit?: number;
7
- transform?: (input: any, i: number | string, result: string) => string;
8
- singleQuotes?: boolean;
9
- filter?: (obj: GenericObject, el: string) => boolean;
10
- };
11
- export declare function objectToPhpArray(input: any, options: objectToPhpArrayOptions, pad?: string): string;
12
- export {};
1
+ import { Input, ObjectToPhpArrayOptions } from './types';
2
+ export declare function objectToPhpArray(input: Input, options: ObjectToPhpArrayOptions, pad?: string): string;
@@ -31,7 +31,7 @@ export interface ThemeExtension {
31
31
  };
32
32
  };
33
33
  codeBlock?: {
34
- borderRadius?: string | ((theme: any) => string);
34
+ borderRadius?: string | ((theme: GenericObject) => string);
35
35
  tokens?: Tokens;
36
36
  };
37
37
  typography?: {
@@ -1,2 +1,2 @@
1
- import{__makeTemplateObject}from"tslib";import{mediaCSS,css}from"../redoc-lib";import merge from"deepmerge";export function extendTheme(e){var n,t,o,a,r,l,i,d,p,c,m,h;return e.theme?(e.theme=merge(defaultProTheme,e.theme),e.theme.extensionsHook=extensionsHook,(null===(n=e.theme)||void 0===n?void 0:n.menu)&&!(null===(t=e.theme)||void 0===t?void 0:t.sidebar)&&(console.warn('Theme setting "menu" is deprecated. Rename to "sidebar"'),e.theme.sidebar=e.theme.menu),(null===(o=e.theme)||void 0===o?void 0:o.codeSample)&&(console.warn('Theme setting "codeSample" is deprecated. Rename to "codeBlock"'),Object.assign(null===(a=e.theme)||void 0===a?void 0:a.codeBlock,e.theme.codeSample)),(null===(i=null===(l=null===(r=e.theme)||void 0===r?void 0:r.typography)||void 0===l?void 0:l.code)||void 0===i?void 0:i.tokens)&&(console.warn('Theme setting "typography.code.tokens" is deprecated. Move to "codeBlock.tokens"'),e.theme.codeBlock=(null===(d=e.theme)||void 0===d?void 0:d.codeBlock)||{},Object.assign(null===(c=null===(p=e.theme)||void 0===p?void 0:p.codeBlock)||void 0===c?void 0:c.tokens,(null===(h=null===(m=e.theme)||void 0===m?void 0:m.typography)||void 0===h?void 0:h.code).tokens)),e):(e.theme=defaultProTheme,e)}var defaultProTheme={overrides:{DownloadButton:{custom:""},NextSectionButton:{custom:""}},codeBlock:{borderRadius:function(e){return e.components.panels.borderRadius},tokens:{}},schema:{constraints:{},examples:{}},rightPanel:{textColor:"#eeeeee"},typography:{heading1:{},heading2:{},heading3:{},rightPanelHeading:{}}};function optional(e,n){return n?e+": "+n+";":""}function typography(e){return e?css(templateObject_1||(templateObject_1=__makeTemplateObject(["\n ","\n "],["\n ","\n "])),mediaCSS({fontSize:e.fontSize||"",fontWeight:e.fontWeight||"",fontFamily:e.fontFamily||"",lineHeight:e.lineHeight||"",color:e.color||"",textTransform:e.transform||""})):""}function genTokens(e){if(!e)return"";for(var n="",t=0,o=Object.keys(e);t<o.length;t++){var a=o[t];"default"!==a&&(n+=".token."+a+" { color: "+e[a].color+"; }\n")}return e.default?css(templateObject_2||(templateObject_2=__makeTemplateObject(["\n pre& {\n ","\n }\n ","\n "],["\n pre& {\n ","\n }\n ","\n "])),typography(e.default),n):n}var templateObject_1,templateObject_2,templateObject_3,templateObject_4,templateObject_5,templateObject_6,templateObject_7,EXTENSIONS={DownloadButton:function(e){var n=e.theme;return void 0!==n.overrides&&n.overrides.DownloadButton&&n.overrides.DownloadButton.custom||""},H1:function(e){return typography(e.theme.typography.heading1)},H2:function(e){return typography(e.theme.typography.heading2)},H3:function(e){return typography(e.theme.typography.heading3)},RightPanelHeader:function(e){return typography(e.theme.typography.rightPanelHeading)},PropertyNameCell:function(e){var n=e.theme;return n.schema.breakFieldNames?css(templateObject_3||(templateObject_3=__makeTemplateObject(["\n ","\n ","\n "],["\n ","\n ","\n "])),typography(n.typography.fieldName),"\n && span:last-child {\n white-space: normal;\n word-break: break-word;\n vertical-align: top;\n max-width: calc(100% - 21px);\n display: inline-flex;\n }\n "):typography(n.typography.fieldName)},ClickablePropertyNameCell:function(e){var n=e.theme;return n.schema.breakFieldNames?css(templateObject_4||(templateObject_4=__makeTemplateObject(["\n ","\n ","\n "],["\n ","\n ","\n "])),typography(n.typography.fieldName),"\n && button {\n max-width: calc(100% - 21px); /* left padding + toggle button width: 16px/2 + 13px */\n text-align: left;\n span {\n white-space: normal;\n word-break: break-word;\n vertical-align: top;\n display: inline-flex;\n }\n }\n "):typography(n.typography.fieldName)},Markdown:function(e){var n,t,o,a,r=e.theme;return css(templateObject_5||(templateObject_5=__makeTemplateObject(["\n h1 {\n ","\n clear: both;\n }\n h2 {\n ","\n clear: both;\n }\n h3 {\n ","\n clear: both;\n }\n\n pre {\n border-radius: ",";\n }\n\n code {\n ","\n }\n "],["\n h1 {\n ","\n clear: both;\n }\n h2 {\n ","\n clear: both;\n }\n h3 {\n ","\n clear: both;\n }\n\n pre {\n border-radius: ",";\n }\n\n code {\n ","\n }\n "])),typography(r.typography.heading1),typography(r.typography.heading2),typography(r.typography.heading3),null!==(t=null===(n=r.codeBlock)||void 0===n?void 0:n.borderRadius)&&void 0!==t?t:0,optional("word-break",null===(a=null===(o=r.typography)||void 0===o?void 0:o.code)||void 0===a?void 0:a.wordBreak))},ConstraintItem:function(e){var n,t,o,a,r=e.theme;return css(templateObject_6||(templateObject_6=__makeTemplateObject(["\n ",";\n ",";\n ","\n ","\n "],["\n ",";\n ",";\n ","\n ","\n "])),typography(r.schema.constraints),optional("background-color",null===(n=r.schema.constraints)||void 0===n?void 0:n.backgroundColor),optional("border",null===(t=r.schema.constraints)||void 0===t?void 0:t.border),optional("word-break",null===(a=null===(o=r.typography)||void 0===o?void 0:o.code)||void 0===a?void 0:a.wordBreak))},ExampleValue:function(e){var n,t,o,a,r=e.theme;return css(templateObject_7||(templateObject_7=__makeTemplateObject(["\n ",";\n ",";\n ","\n ","\n "],["\n ",";\n ",";\n ","\n ","\n "])),typography(r.schema.examples),optional("background-color",null===(n=r.schema.examples)||void 0===n?void 0:n.backgroundColor),optional("border",null===(t=r.schema.examples)||void 0===t?void 0:t.border),optional("word-break",null===(a=null===(o=r.typography)||void 0===o?void 0:o.code)||void 0===a?void 0:a.wordBreak))},Prism:function(e){var n,t,o,a=e.theme;return genTokens(null===(n=null==a?void 0:a.codeBlock)||void 0===n?void 0:n.tokens)+optional("word-break",null===(o=null===(t=a.typography)||void 0===t?void 0:t.code)||void 0===o?void 0:o.wordBreak)}};function extensionsHook(e,n){return EXTENSIONS[e]&&EXTENSIONS[e](n)}
1
+ import{__makeTemplateObject}from"tslib";import merge from"deepmerge";import{mediaCSS,css}from"../redoc-lib";export function extendTheme(e){var n,t,o,a,r,l,i,d,p,c,m,h;return e.theme?(e.theme=merge(defaultProTheme,e.theme),e.theme.extensionsHook=extensionsHook,(null===(n=e.theme)||void 0===n?void 0:n.menu)&&!(null===(t=e.theme)||void 0===t?void 0:t.sidebar)&&(console.warn('Theme setting "menu" is deprecated. Rename to "sidebar"'),e.theme.sidebar=e.theme.menu),(null===(o=e.theme)||void 0===o?void 0:o.codeSample)&&(console.warn('Theme setting "codeSample" is deprecated. Rename to "codeBlock"'),Object.assign(null===(a=e.theme)||void 0===a?void 0:a.codeBlock,e.theme.codeSample)),(null===(i=null===(l=null===(r=e.theme)||void 0===r?void 0:r.typography)||void 0===l?void 0:l.code)||void 0===i?void 0:i.tokens)&&(console.warn('Theme setting "typography.code.tokens" is deprecated. Move to "codeBlock.tokens"'),e.theme.codeBlock=(null===(d=e.theme)||void 0===d?void 0:d.codeBlock)||{},Object.assign(null===(c=null===(p=e.theme)||void 0===p?void 0:p.codeBlock)||void 0===c?void 0:c.tokens,(null===(h=null===(m=e.theme)||void 0===m?void 0:m.typography)||void 0===h?void 0:h.code).tokens)),e):(e.theme=defaultProTheme,e)}var defaultProTheme={overrides:{DownloadButton:{custom:""},NextSectionButton:{custom:""}},codeBlock:{borderRadius:function(e){return e.components.panels.borderRadius},tokens:{}},schema:{constraints:{},examples:{}},rightPanel:{textColor:"#eeeeee"},typography:{heading1:{},heading2:{},heading3:{},rightPanelHeading:{}}};function optional(e,n){return n?e+": "+n+";":""}function typography(e){return e?css(templateObject_1||(templateObject_1=__makeTemplateObject(["\n ","\n "],["\n ","\n "])),mediaCSS({fontSize:e.fontSize||"",fontWeight:e.fontWeight||"",fontFamily:e.fontFamily||"",lineHeight:e.lineHeight||"",color:e.color||"",textTransform:e.transform||""})):""}function genTokens(e){if(!e)return"";for(var n="",t=0,o=Object.keys(e);t<o.length;t++){var a=o[t];"default"!==a&&(n+=".token."+a+" { color: "+e[a].color+"; }\n")}return e.default?css(templateObject_2||(templateObject_2=__makeTemplateObject(["\n pre& {\n ","\n }\n ","\n "],["\n pre& {\n ","\n }\n ","\n "])),typography(e.default),n):n}var templateObject_1,templateObject_2,templateObject_3,templateObject_4,templateObject_5,templateObject_6,templateObject_7,EXTENSIONS={DownloadButton:function(e){var n=e.theme;return void 0!==n.overrides&&n.overrides.DownloadButton&&n.overrides.DownloadButton.custom||""},H1:function(e){return typography(e.theme.typography.heading1)},H2:function(e){return typography(e.theme.typography.heading2)},H3:function(e){return typography(e.theme.typography.heading3)},RightPanelHeader:function(e){return typography(e.theme.typography.rightPanelHeading)},PropertyNameCell:function(e){var n=e.theme;return n.schema.breakFieldNames?css(templateObject_3||(templateObject_3=__makeTemplateObject(["\n ","\n ","\n "],["\n ","\n ","\n "])),typography(n.typography.fieldName),"\n && span:last-child {\n white-space: normal;\n word-break: break-word;\n vertical-align: top;\n max-width: calc(100% - 21px);\n display: inline-flex;\n }\n "):typography(n.typography.fieldName)},ClickablePropertyNameCell:function(e){var n=e.theme;return n.schema.breakFieldNames?css(templateObject_4||(templateObject_4=__makeTemplateObject(["\n ","\n ","\n "],["\n ","\n ","\n "])),typography(n.typography.fieldName),"\n && button {\n max-width: calc(100% - 21px); /* left padding + toggle button width: 16px/2 + 13px */\n text-align: left;\n span {\n white-space: normal;\n word-break: break-word;\n vertical-align: top;\n display: inline-flex;\n }\n }\n "):typography(n.typography.fieldName)},Markdown:function(e){var n,t,o,a,r=e.theme;return css(templateObject_5||(templateObject_5=__makeTemplateObject(["\n h1 {\n ","\n clear: both;\n }\n h2 {\n ","\n clear: both;\n }\n h3 {\n ","\n clear: both;\n }\n\n pre {\n border-radius: ",";\n }\n\n code {\n ","\n }\n "],["\n h1 {\n ","\n clear: both;\n }\n h2 {\n ","\n clear: both;\n }\n h3 {\n ","\n clear: both;\n }\n\n pre {\n border-radius: ",";\n }\n\n code {\n ","\n }\n "])),typography(r.typography.heading1),typography(r.typography.heading2),typography(r.typography.heading3),null!==(t=null===(n=r.codeBlock)||void 0===n?void 0:n.borderRadius)&&void 0!==t?t:0,optional("word-break",null===(a=null===(o=r.typography)||void 0===o?void 0:o.code)||void 0===a?void 0:a.wordBreak))},ConstraintItem:function(e){var n,t,o,a,r=e.theme;return css(templateObject_6||(templateObject_6=__makeTemplateObject(["\n ",";\n ",";\n ","\n ","\n "],["\n ",";\n ",";\n ","\n ","\n "])),typography(r.schema.constraints),optional("background-color",null===(n=r.schema.constraints)||void 0===n?void 0:n.backgroundColor),optional("border",null===(t=r.schema.constraints)||void 0===t?void 0:t.border),optional("word-break",null===(a=null===(o=r.typography)||void 0===o?void 0:o.code)||void 0===a?void 0:a.wordBreak))},ExampleValue:function(e){var n,t,o,a,r=e.theme;return css(templateObject_7||(templateObject_7=__makeTemplateObject(["\n ",";\n ",";\n ","\n ","\n "],["\n ",";\n ",";\n ","\n ","\n "])),typography(r.schema.examples),optional("background-color",null===(n=r.schema.examples)||void 0===n?void 0:n.backgroundColor),optional("border",null===(t=r.schema.examples)||void 0===t?void 0:t.border),optional("word-break",null===(a=null===(o=r.typography)||void 0===o?void 0:o.code)||void 0===a?void 0:a.wordBreak))},Prism:function(e){var n,t,o,a=e.theme;return genTokens(null===(n=null==a?void 0:a.codeBlock)||void 0===n?void 0:n.tokens)+optional("word-break",null===(o=null===(t=a.typography)||void 0===t?void 0:t.code)||void 0===o?void 0:o.wordBreak)}};function extensionsHook(e,n){return EXTENSIONS[e]&&EXTENSIONS[e](n)}
2
2
  //# sourceMappingURL=extendTheme.js.map
@@ -13,13 +13,15 @@ import 'core-js/es/string/starts-with';
13
13
  import 'core-js/es/symbol';
14
14
  import 'unfetch/polyfill/index';
15
15
  import 'url-polyfill';
16
+ import { OpenAPIDefinition } from './redoc-lib';
16
17
  import { ProStoreState, RedocProRawOptions } from './services/ProStore';
17
18
  import { LayoutVariant } from './services/store-types';
19
+ import { SpecVersions } from './services/VersionedSpecStore';
18
20
  export { setSecurityDetails, setParameterValue, setSecurityDetailsVariants } from './utils';
19
21
  export declare function toggleLayout(layout?: LayoutVariant): void;
20
22
  export declare function toggleRightPanel(value?: boolean): void;
21
23
  export declare function hydrate(state: ProStoreState, element?: Element | null): void;
22
- export declare function init(definitionOrDefinitionUrl: string | any, options?: RedocProRawOptions, element?: Element | null, callback?: () => void): void;
24
+ export declare function init(definitionOrDefinitionUrl: string | OpenAPIDefinition | SpecVersions, options?: RedocProRawOptions, element?: Element | null, callback?: () => void): void;
23
25
  export declare function setPublicPath(path: string): void;
24
26
  export declare const version: string;
25
27
  export declare const revision: string;
@@ -1,2 +1,2 @@
1
- import{__assign}from"tslib";import"core-js/es/array/find-index";import"core-js/es/array/find";import"core-js/es/array/includes";import"core-js/es/map";import"core-js/es/number/is-integer";import"core-js/es/object/assign";import"core-js/es/object/entries";import"core-js/es/object/is";import"core-js/es/object/values";import"core-js/es/promise";import"core-js/es/string/ends-with";import"core-js/es/string/starts-with";import"core-js/es/symbol";import"unfetch/polyfill/index";import"url-polyfill";import{dirname}from"path";import*as React from"react";import{hydrate as hydrateComponent,render}from"react-dom";import{querySelector,IS_BROWSER}from"./redoc-lib";import{ProStore}from"./services/ProStore";import{LayoutVariant}from"./services/store-types";import{RedoclyReferenceDocs,RedoclyReferenceDocsStandalone,RedoclyReferenceDocsMultiStandalone}from"./components/RedoclyReferenceDocs";import{getGlobalStore}from"./utils";export{setSecurityDetails,setParameterValue,setSecurityDetailsVariants}from"./utils";export function toggleLayout(e){var r=getGlobalStore();r&&r.toggleLayout((null!=e?e:r.layout===LayoutVariant.STACKED)?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED)}export function toggleRightPanel(e){var r=getGlobalStore();r&&r.toggleRightPanel(e)}var url=getJsUrl(),__dirname=url?dirname(url)+"/":"";function attributesMap(e){for(var r={},t=e.attributes,o=0;o<t.length;o++){var i=t[o];r[i.name]=i.value}return r}function parseOptionsFromElement(e){var r=attributesMap(e),t={};for(var o in r){t[o.replace(/-(.)/g,(function(e,r){return r.toUpperCase()}))]=r[o]}return t}export function hydrate(e,r){void 0===r&&(r=document.querySelector("redoc"));var t=ProStore.fromJS(e);hydrateComponent(React.createElement(RedoclyReferenceDocs,{store:t}),r)}export function init(e,r,t,o){if(void 0===r&&(r={}),void 0===t&&(t=querySelector("redoc")),null===t)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');var i,n;Array.isArray(e)||e&&e.versions?render(React.createElement(RedoclyReferenceDocsMultiStandalone,{definitions:e,options:__assign(__assign({},r),parseOptionsFromElement(t))},["Loading..."]),t,o):("string"==typeof e?i=e:"object"==typeof e&&(n=e),render(React.createElement(RedoclyReferenceDocsStandalone,{definition:n,definitionUrl:i,options:__assign(__assign({},r),parseOptionsFromElement(t))},["Loading..."]),t,o))}export function setPublicPath(e){__webpack_public_path__=e}export var version=__REDOCLY_API_REFERENCE_VERSION__;export var revision=__REDOCLY_API_REFERENCE_REVISION__;function autoInit(){var e=querySelector("redoc");if(e){var r=e.getAttribute("spec-url");r&&init(r,{},e)}}function getJsUrl(){var e;if(!IS_BROWSER)return"";var r=+new Date+Math.random();try{return document.currentScript&&(document.currentScript.async||document.currentScript.defer)||document.write('<script id="dummy'+r+'"><\/script>'),(null===(e=document.getElementById("dummy"+r))||void 0===e?void 0:e.previousSibling).src}catch(e){return""}}IS_BROWSER&&setPublicPath(__dirname),autoInit();
1
+ import{__assign}from"tslib";import"core-js/es/array/find-index";import"core-js/es/array/find";import"core-js/es/array/includes";import"core-js/es/map";import"core-js/es/number/is-integer";import"core-js/es/object/assign";import"core-js/es/object/entries";import"core-js/es/object/is";import"core-js/es/object/values";import"core-js/es/promise";import"core-js/es/string/ends-with";import"core-js/es/string/starts-with";import"core-js/es/symbol";import"unfetch/polyfill/index";import"url-polyfill";import{dirname}from"path";import*as React from"react";import{hydrate as hydrateComponent,render}from"react-dom";import{querySelector,IS_BROWSER}from"./redoc-lib";import{ProStore}from"./services/ProStore";import{LayoutVariant}from"./services/store-types";import{RedoclyReferenceDocs,RedoclyReferenceDocsStandalone,RedoclyReferenceDocsMultiStandalone}from"./components/RedoclyReferenceDocs";import{getGlobalStore}from"./utils";export{setSecurityDetails,setParameterValue,setSecurityDetailsVariants}from"./utils";export function toggleLayout(e){var r=getGlobalStore();r&&r.toggleLayout((null!=e?e:r.layout===LayoutVariant.STACKED)?LayoutVariant.THREE_PANEL:LayoutVariant.STACKED)}export function toggleRightPanel(e){var r=getGlobalStore();r&&r.toggleRightPanel(e)}var url=getJsUrl(),__dirname=url?dirname(url)+"/":"";function attributesMap(e){for(var r={},t=e.attributes,o=0;o<t.length;o++){var i=t[o];r[i.name]=i.value}return r}function parseOptionsFromElement(e){var r=attributesMap(e),t={};for(var o in r){t[o.replace(/-(.)/g,(function(e,r){return r.toUpperCase()}))]=r[o]}return t}export function hydrate(e,r){void 0===r&&(r=document.querySelector("redoc"));var t=ProStore.fromJS(e);hydrateComponent(React.createElement(RedoclyReferenceDocs,{store:t}),r)}export function init(e,r,t,o){if(void 0===r&&(r={}),void 0===t&&(t=querySelector("redoc")),null===t)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');var i,n;"object"==typeof e&&"versions"in e?render(React.createElement(RedoclyReferenceDocsMultiStandalone,{definitions:e,options:__assign(__assign({},r),parseOptionsFromElement(t))},["Loading..."]),t,o):("string"==typeof e?i=e:"object"==typeof e&&(n=e),render(React.createElement(RedoclyReferenceDocsStandalone,{definition:n,definitionUrl:i,options:__assign(__assign({},r),parseOptionsFromElement(t))},["Loading..."]),t,o))}export function setPublicPath(e){__webpack_public_path__=e}export var version=__REDOCLY_API_REFERENCE_VERSION__;export var revision=__REDOCLY_API_REFERENCE_REVISION__;function autoInit(){var e=querySelector("redoc");if(e){var r=e.getAttribute("spec-url");r&&init(r,{},e)}}function getJsUrl(){var e;if(!IS_BROWSER)return"";var r=+new Date+Math.random();try{return document.currentScript&&(document.currentScript.async||document.currentScript.defer)||document.write('<script id="dummy'+r+'"><\/script>'),(null===(e=document.getElementById("dummy"+r))||void 0===e?void 0:e.previousSibling).src}catch(e){return""}}IS_BROWSER&&setPublicPath(__dirname),autoInit();
2
2
  //# sourceMappingURL=standalone.js.map
@@ -34,6 +34,6 @@ export declare function getSecurityDetailsOptions(name: string, fieldName: strin
34
34
  label: string;
35
35
  value: string;
36
36
  }> | null;
37
- export declare function get<T>(object: GenericObject, path: string | Array<string>, defval?: T): any;
37
+ export declare function get<T>(object: GenericObject, path: string | Array<string>, defval?: T): GenericObject;
38
38
  export declare function joinStringFactory(separator: string): (...args: (string | undefined)[]) => string;
39
39
  export declare const dottedString: (...args: (string | undefined)[]) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/reference-docs",
3
- "version": "2.11.0",
3
+ "version": "2.11.4",
4
4
  "description": "Redocly Reference Docs",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -128,8 +128,10 @@
128
128
  "enzyme-to-json": "^3.6.2",
129
129
  "esbuild-loader": "^2.16.0",
130
130
  "eslint": "^7.30.0",
131
+ "eslint-config-prettier": "^8.3.0",
131
132
  "eslint-import-resolver-typescript": "^2.4.0",
132
133
  "eslint-plugin-import": "^2.23.4",
134
+ "eslint-plugin-prettier": "^4.0.0",
133
135
  "eslint-plugin-react": "^7.25.1",
134
136
  "eslint-plugin-react-hooks": "^4.2.0",
135
137
  "fork-ts-checker-webpack-plugin": "^6.5.0",
@@ -202,11 +204,5 @@
202
204
  "moduleNameMapper": {
203
205
  "\\.(css|less)$": "<rootDir>/src/empty.js"
204
206
  }
205
- },
206
- "prettier": {
207
- "singleQuote": true,
208
- "trailingComma": "all",
209
- "printWidth": 100,
210
- "arrowParens": "avoid"
211
207
  }
212
208
  }