@redocly/api-docs 0.2.0-next.0 → 0.2.0-next.10

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 (302) hide show
  1. package/lib/RedocStandalone.d.ts +38 -0
  2. package/lib/RedocStandalone.js +1 -0
  3. package/lib/RedoclyApiDocs.js +1 -1
  4. package/lib/RedoclyApiDocsStandalone.d.ts +2 -0
  5. package/lib/RedoclyApiDocsStandalone.js +3 -3
  6. package/lib/adapters/asyncapi/build/navigation.js +1 -1
  7. package/lib/adapters/asyncapi/items/channel/content.js +1 -1
  8. package/lib/adapters/asyncapi/items/channel/item.js +1 -1
  9. package/lib/adapters/asyncapi/items/operation/item.js +1 -1
  10. package/lib/adapters/asyncapi/items/overview/content.js +1 -1
  11. package/lib/adapters/graphql/group/utils.js +1 -1
  12. package/lib/adapters/graphql/utils/createApiItem.js +1 -1
  13. package/lib/adapters/helpers.d.ts +3 -10
  14. package/lib/adapters/helpers.js +1 -1
  15. package/lib/adapters/openapi/build/context.js +1 -1
  16. package/lib/adapters/openapi/build-code-sample-source.d.ts +1 -1
  17. package/lib/adapters/openapi/build-code-sample-source.js +1 -1
  18. package/lib/adapters/openapi/configure/merge-utils.d.ts +1 -1
  19. package/lib/adapters/openapi/configure/resolve-request-values.js +1 -1
  20. package/lib/adapters/openapi/group/item.d.ts +0 -3
  21. package/lib/adapters/openapi/group/item.js +1 -1
  22. package/lib/adapters/openapi/index.js +1 -1
  23. package/lib/adapters/openapi/items/operation/content.js +1 -1
  24. package/lib/adapters/openapi/items/operation/item.d.ts +2 -2
  25. package/lib/adapters/openapi/items/operation/item.js +1 -1
  26. package/lib/adapters/openapi/items/overview/content.js +1 -1
  27. package/lib/adapters/openapi/items/schema/item.js +1 -1
  28. package/lib/adapters/openapi/store.js +1 -1
  29. package/lib/adapters/openapi/utils/merge-mock-server.d.ts +2 -2
  30. package/lib/adapters/rbac.d.ts +14 -0
  31. package/lib/adapters/rbac.js +1 -0
  32. package/lib/adapters/utils/descriptionToMarkdown.d.ts +6 -0
  33. package/lib/adapters/utils/descriptionToMarkdown.js +11 -0
  34. package/lib/adapters/utils/markdoc.d.ts +8 -1
  35. package/lib/adapters/utils/markdoc.js +1 -1
  36. package/lib/components/ErrorBoundary.d.ts +4 -2
  37. package/lib/components/ErrorBoundary.js +55 -1
  38. package/lib/components/Header/HeaderItem.js +5 -5
  39. package/lib/components/Header/HeaderPageActions.d.ts +4 -0
  40. package/lib/components/Header/HeaderPageActions.js +1 -0
  41. package/lib/components/Header/PageActions.d.ts +4 -0
  42. package/lib/components/Header/PageActions.js +11 -0
  43. package/lib/components/ItemContent/hooks.d.ts +12 -1
  44. package/lib/components/ItemContent/hooks.js +1 -1
  45. package/lib/components/ItemContent/sections/BodySection.js +3 -3
  46. package/lib/components/ItemContent/sections/CallbacksSection.js +4 -4
  47. package/lib/components/ItemContent/sections/MessagesSection.js +17 -17
  48. package/lib/components/ItemContent/sections/ResponsesSection.js +7 -7
  49. package/lib/components/Mcp/McpPrompt.js +1 -1
  50. package/lib/components/Mcp/McpTool.js +1 -1
  51. package/lib/components/Mcp/utils.d.ts +1 -1
  52. package/lib/components/Mcp/utils.js +1 -1
  53. package/lib/components/Schema/SchemaDescription.js +1 -1
  54. package/lib/components/Schema/styled.js +5 -5
  55. package/lib/components/Schema/views/ArrayRenderer.js +1 -1
  56. package/lib/components/Schema/views/CollapsibleNestedFields.js +1 -1
  57. package/lib/components/Schema/views/DiscriminatorPropertyRow.js +1 -1
  58. package/lib/components/Schema/views/Examples.js +1 -1
  59. package/lib/components/Schema/views/SwitcherRenderer.js +1 -1
  60. package/lib/components/Search/index.d.ts +15 -0
  61. package/lib/components/Search/index.js +1 -0
  62. package/lib/components/Security/SecurityFlowDetail.js +1 -1
  63. package/lib/components/Security/styled.js +7 -7
  64. package/lib/components/StickySidebar/FloatingButton.d.ts +1 -0
  65. package/lib/components/StickySidebar/FloatingButton.js +32 -0
  66. package/lib/components/StickySidebar/RedoclyAttributionLogo.d.ts +5 -0
  67. package/lib/components/StickySidebar/RedoclyAttributionLogo.js +1 -0
  68. package/lib/components/StickySidebar/StickySidebar.js +33 -9
  69. package/lib/components/common/Breadcrumbs.js +2 -2
  70. package/lib/components/common/DeepLinkAnchor.js +9 -9
  71. package/lib/components/common/PanelItem.js +5 -5
  72. package/lib/components/common/ResponseCodeTabs.js +1 -1
  73. package/lib/components/common/Tag.js +1 -1
  74. package/lib/components/common/VendorExtensions.js +1 -1
  75. package/lib/components/common/ViewNested.js +2 -2
  76. package/lib/components/graphql/GraphQLFieldView.js +1 -1
  77. package/lib/components/graphql/RequiresScopesModal.js +3 -3
  78. package/lib/components/graphql/sections/GraphQLArgsSection.js +1 -1
  79. package/lib/components/markdoc/SchemaDefinition.js +1 -1
  80. package/lib/components/markdoc/html/html-jsx-attribute-mapping.d.ts +5 -0
  81. package/lib/components/markdoc/html/html-jsx-attribute-mapping.js +1 -0
  82. package/lib/components/markdoc/html/process-html-tokens.d.ts +1 -0
  83. package/lib/components/markdoc/html/process-html-tokens.js +1 -0
  84. package/lib/components/markdoc/markdocParser.d.ts +2 -0
  85. package/lib/components/markdoc/markdocParser.js +1 -1
  86. package/lib/components/panels/ExampleItem/CallbackPayloadItem.js +2 -2
  87. package/lib/components/panels/ExampleItem/CodeSampleItem.js +1 -1
  88. package/lib/components/panels/ExampleItem/PayloadExampleItem.js +2 -2
  89. package/lib/components/panels/ExampleItem/ResponseExampleItem.js +1 -1
  90. package/lib/components/panels/ExampleItem/SecuritySchemeSelector.d.ts +9 -0
  91. package/lib/components/panels/ExampleItem/SecuritySchemeSelector.js +1 -0
  92. package/lib/components/panels/ExampleItem/ServerDropdown.js +2 -2
  93. package/lib/components/panels/ExampleItem/generate-request-sample.d.ts +28 -0
  94. package/lib/components/panels/ExampleItem/generate-request-sample.js +1 -0
  95. package/lib/components/panels/ExampleItem/selectors.d.ts +5 -2
  96. package/lib/components/panels/ExampleItem/selectors.js +1 -1
  97. package/lib/components/panels/ExampleItem/styled.d.ts +2 -49
  98. package/lib/components/panels/ExampleItem/styled.js +11 -5
  99. package/lib/components/panels/ExampleItem/useActiveServer.d.ts +17 -0
  100. package/lib/components/panels/ExampleItem/useActiveServer.js +1 -0
  101. package/lib/components/panels/ExampleItem/useCodeSampleLanguages.d.ts +23 -0
  102. package/lib/components/panels/ExampleItem/useCodeSampleLanguages.js +1 -0
  103. package/lib/components/panels/ExampleItem/useReplayRequestState.d.ts +18 -0
  104. package/lib/components/panels/ExampleItem/useReplayRequestState.js +1 -0
  105. package/lib/components/panels/ExampleItem/useTryItFooter.d.ts +3 -0
  106. package/lib/components/panels/ExampleItem/useTryItFooter.js +7 -0
  107. package/lib/components/panels/GroupPanelItem.js +1 -1
  108. package/lib/components/panels/LanguageItem/LanguagePanelItem.js +5 -1
  109. package/lib/components/panels/LanguageItem/styled.js +17 -14
  110. package/lib/components/panels/McpExamplePanelItem.js +2 -2
  111. package/lib/components/panels/McpPanelItem.js +2 -2
  112. package/lib/components/panels/ServerItem/ServerItem.js +1 -1
  113. package/lib/components/panels/asyncapi/BrokerItem/BrokerModal.js +1 -1
  114. package/lib/components/panels/asyncapi/BrokerItem/BrokerPanelItem.js +1 -1
  115. package/lib/components/panels/asyncapi/MessageBindingItem/MessageBindingItem.js +1 -1
  116. package/lib/components/panels/shared-panel-styles.js +1 -1
  117. package/lib/components/panels/styled.js +1 -1
  118. package/lib/components/pluggable/RedocExample.js +5 -2
  119. package/lib/components/pluggable/RedocResponseSamples.js +1 -1
  120. package/lib/hoc/withLicenseGate.d.ts +5 -0
  121. package/lib/hoc/withLicenseGate.js +1 -0
  122. package/lib/hoc/withRouter.js +1 -1
  123. package/lib/hoc/withStoreProvider.d.ts +2 -0
  124. package/lib/hoc/withStoreProvider.js +1 -1
  125. package/lib/hooks/deepLinkHash.d.ts +5 -0
  126. package/lib/hooks/deepLinkHash.js +1 -0
  127. package/lib/hooks/useApiDocsScroll.js +1 -1
  128. package/lib/hooks/useCopySpecSlice.d.ts +9 -0
  129. package/lib/hooks/useCopySpecSlice.js +1 -0
  130. package/lib/hooks/useDeepLinkSection.js +1 -1
  131. package/lib/hooks/useInitialTelemetry.d.ts +2 -0
  132. package/lib/hooks/useInitialTelemetry.js +1 -0
  133. package/lib/hooks/useLicense.js +1 -1
  134. package/lib/hooks/useLicenseGate.d.ts +6 -0
  135. package/lib/hooks/useLicenseGate.js +1 -0
  136. package/lib/hooks/useRouterHashBridge.d.ts +4 -0
  137. package/lib/hooks/useRouterHashBridge.js +1 -1
  138. package/lib/hooks/useScrollSpyUrlSync.js +1 -1
  139. package/lib/hooks/useUrlHash.d.ts +3 -2
  140. package/lib/hooks/useUrlHash.js +1 -1
  141. package/lib/hooks/useUrlHashReassert.d.ts +2 -0
  142. package/lib/hooks/useUrlHashReassert.js +1 -0
  143. package/lib/index.d.ts +5 -1
  144. package/lib/index.js +1 -1
  145. package/lib/jotai/app.d.ts +6 -0
  146. package/lib/jotai/app.js +1 -1
  147. package/lib/jotai/examples.js +1 -1
  148. package/lib/jotai/itemStore.d.ts +1 -0
  149. package/lib/jotai/itemStore.js +1 -1
  150. package/lib/jotai/store.d.ts +4 -0
  151. package/lib/jotai/store.js +1 -1
  152. package/lib/options/editionOverrides.d.ts +3 -0
  153. package/lib/options/editionOverrides.js +1 -0
  154. package/lib/options/helpers.d.ts +1 -2
  155. package/lib/options/helpers.js +1 -1
  156. package/lib/options/normalizeOptions.d.ts +1 -1
  157. package/lib/options/normalizeOptions.js +1 -1
  158. package/lib/options/standaloneLayoutVars.d.ts +3 -0
  159. package/lib/options/standaloneLayoutVars.js +1 -0
  160. package/lib/otel-semantic-conventions.d.ts +10 -0
  161. package/lib/otel-semantic-conventions.js +1 -0
  162. package/lib/pages/ItemPage.js +4 -2
  163. package/lib/pages/NotFoundPage.js +40 -1
  164. package/lib/services/code-samples/apply-env-variables.d.ts +8 -0
  165. package/lib/services/code-samples/apply-env-variables.js +1 -0
  166. package/lib/services/code-samples/builder.d.ts +8 -5
  167. package/lib/services/code-samples/builder.js +1 -1
  168. package/lib/services/code-samples/discriminator.d.ts +16 -10
  169. package/lib/services/code-samples/discriminator.js +1 -1
  170. package/lib/services/code-samples/generators/java8.js +2 -2
  171. package/lib/services/code-samples/language-availability.d.ts +4 -0
  172. package/lib/services/code-samples/language-availability.js +1 -0
  173. package/lib/services/code-samples/{replay/normalize-servers.d.ts → normalize-servers.d.ts} +1 -1
  174. package/lib/services/code-samples/normalize-servers.js +1 -0
  175. package/lib/services/code-samples/replay/embedded-replay-converter.d.ts +1 -1
  176. package/lib/services/code-samples/replay/embedded-replay-converter.js +1 -1
  177. package/lib/services/code-samples/replay/find-operation.d.ts +17 -0
  178. package/lib/services/code-samples/replay/find-operation.js +1 -0
  179. package/lib/services/code-samples/replay/from-openapi-document.d.ts +12 -2
  180. package/lib/services/code-samples/replay/from-openapi-document.js +1 -1
  181. package/lib/services/code-samples/replay/index.d.ts +1 -1
  182. package/lib/services/code-samples/replay/index.js +1 -1
  183. package/lib/services/code-samples/replay/overlay-converter.js +1 -1
  184. package/lib/services/code-samples/replay/parameter-descriptions.d.ts +7 -0
  185. package/lib/services/code-samples/replay/parameter-descriptions.js +1 -0
  186. package/lib/services/code-samples/replay/replay-adapter.d.ts +1 -1
  187. package/lib/services/code-samples/replay/replay-adapter.js +1 -1
  188. package/lib/services/code-samples/replay/replay-handler.js +1 -1
  189. package/lib/services/code-samples/replay/replay-predefined-env.d.ts +1 -2
  190. package/lib/services/code-samples/replay/replay-predefined-env.js +1 -1
  191. package/lib/services/code-samples/replay/schema-declared-value.d.ts +2 -0
  192. package/lib/services/code-samples/replay/schema-declared-value.js +1 -0
  193. package/lib/services/code-samples/resolvers.js +1 -1
  194. package/lib/services/code-samples/server-env.d.ts +3 -0
  195. package/lib/services/code-samples/server-env.js +1 -0
  196. package/lib/services/code-samples/source.d.ts +3 -3
  197. package/lib/services/license/check.d.ts +1 -0
  198. package/lib/services/license/check.js +1 -1
  199. package/lib/services/operation-samples/index.js +1 -1
  200. package/lib/services/schema/dialects/jsonSchema.d.ts +5 -1
  201. package/lib/services/schema/dialects/jsonSchema.js +1 -1
  202. package/lib/services/schema/propertyTreeBuilder.js +1 -1
  203. package/lib/services/search/index.d.ts +2 -0
  204. package/lib/services/search/index.js +1 -0
  205. package/lib/services/search/indexer/context.d.ts +8 -0
  206. package/lib/services/search/indexer/context.js +0 -0
  207. package/lib/services/search/indexer/deep-links.d.ts +12 -0
  208. package/lib/services/search/indexer/deep-links.js +1 -0
  209. package/lib/services/search/indexer/extractors/asyncapi.d.ts +8 -0
  210. package/lib/services/search/indexer/extractors/asyncapi.js +1 -0
  211. package/lib/services/search/indexer/extractors/body.d.ts +2 -0
  212. package/lib/services/search/indexer/extractors/body.js +1 -0
  213. package/lib/services/search/indexer/extractors/callbacks.d.ts +4 -0
  214. package/lib/services/search/indexer/extractors/callbacks.js +1 -0
  215. package/lib/services/search/indexer/extractors/context.d.ts +25 -0
  216. package/lib/services/search/indexer/extractors/context.js +1 -0
  217. package/lib/services/search/indexer/extractors/examples.d.ts +3 -0
  218. package/lib/services/search/indexer/extractors/examples.js +1 -0
  219. package/lib/services/search/indexer/extractors/graphql.d.ts +2 -0
  220. package/lib/services/search/indexer/extractors/graphql.js +1 -0
  221. package/lib/services/search/indexer/extractors/heading-sections.d.ts +3 -0
  222. package/lib/services/search/indexer/extractors/heading-sections.js +1 -0
  223. package/lib/services/search/indexer/extractors/index.d.ts +12 -0
  224. package/lib/services/search/indexer/extractors/index.js +1 -0
  225. package/lib/services/search/indexer/extractors/mcp.d.ts +9 -0
  226. package/lib/services/search/indexer/extractors/mcp.js +1 -0
  227. package/lib/services/search/indexer/extractors/named-rows.d.ts +9 -0
  228. package/lib/services/search/indexer/extractors/named-rows.js +1 -0
  229. package/lib/services/search/indexer/extractors/panels.d.ts +10 -0
  230. package/lib/services/search/indexer/extractors/panels.js +1 -0
  231. package/lib/services/search/indexer/extractors/parameters.d.ts +2 -0
  232. package/lib/services/search/indexer/extractors/parameters.js +1 -0
  233. package/lib/services/search/indexer/extractors/responses.d.ts +2 -0
  234. package/lib/services/search/indexer/extractors/responses.js +1 -0
  235. package/lib/services/search/indexer/extractors/schema-page.d.ts +9 -0
  236. package/lib/services/search/indexer/extractors/schema-page.js +1 -0
  237. package/lib/services/search/indexer/extractors/security.d.ts +4 -0
  238. package/lib/services/search/indexer/extractors/security.js +1 -0
  239. package/lib/services/search/indexer/index.d.ts +14 -0
  240. package/lib/services/search/indexer/index.js +1 -0
  241. package/lib/services/search/indexer/param.d.ts +7 -0
  242. package/lib/services/search/indexer/param.js +1 -0
  243. package/lib/services/search/indexer/places.d.ts +40 -0
  244. package/lib/services/search/indexer/places.js +1 -0
  245. package/lib/services/search/indexer/schema-walker.d.ts +29 -0
  246. package/lib/services/search/indexer/schema-walker.js +1 -0
  247. package/lib/services/search/indexer/text.d.ts +2 -0
  248. package/lib/services/search/indexer/text.js +1 -0
  249. package/lib/services/search/types.d.ts +28 -0
  250. package/lib/services/search/types.js +0 -0
  251. package/lib/services/spec-slice/assistant-links.d.ts +9 -0
  252. package/lib/services/spec-slice/assistant-links.js +5 -0
  253. package/lib/services/spec-slice/asyncapi-slice.d.ts +5 -0
  254. package/lib/services/spec-slice/asyncapi-slice.js +1 -0
  255. package/lib/services/spec-slice/clone-strip.d.ts +1 -0
  256. package/lib/services/spec-slice/clone-strip.js +1 -0
  257. package/lib/services/spec-slice/component-closure.d.ts +6 -0
  258. package/lib/services/spec-slice/component-closure.js +1 -0
  259. package/lib/services/spec-slice/graphql-slice.d.ts +2 -0
  260. package/lib/services/spec-slice/graphql-slice.js +1 -0
  261. package/lib/services/spec-slice/index.d.ts +6 -0
  262. package/lib/services/spec-slice/index.js +1 -0
  263. package/lib/services/spec-slice/openapi-slice.d.ts +6 -0
  264. package/lib/services/spec-slice/openapi-slice.js +1 -0
  265. package/lib/services/spec-slice/resolve-scope.d.ts +4 -0
  266. package/lib/services/spec-slice/resolve-scope.js +1 -0
  267. package/lib/services/spec-slice/types.d.ts +37 -0
  268. package/lib/services/spec-slice/types.js +0 -0
  269. package/lib/standalone.d.ts +19 -0
  270. package/lib/standalone.js +2 -0
  271. package/lib/standaloneThemeConfig.d.ts +3 -0
  272. package/lib/standaloneThemeConfig.js +1 -0
  273. package/lib/telemetry/RedocTelemetry.d.ts +3 -0
  274. package/lib/telemetry/RedocTelemetry.js +1 -1
  275. package/lib/telemetry/defaults.d.ts +2 -0
  276. package/lib/telemetry/defaults.js +1 -0
  277. package/lib/types/asyncapi.d.ts +2 -1
  278. package/lib/types/code-samples-config.d.ts +68 -0
  279. package/lib/types/code-samples-config.js +0 -0
  280. package/lib/types/common.d.ts +1 -2
  281. package/lib/types/content.d.ts +6 -4
  282. package/lib/types/edition-config.d.ts +4 -0
  283. package/lib/types/edition-config.js +0 -0
  284. package/lib/types/events.d.ts +2 -2
  285. package/lib/types/openapi.d.ts +3 -3
  286. package/lib/types/options.d.ts +24 -88
  287. package/lib/types/store.d.ts +3 -2
  288. package/lib/url-compat.d.ts +22 -0
  289. package/lib/url-compat.js +1 -0
  290. package/lib/utils/compose.d.ts +1 -0
  291. package/lib/utils/deep-link.d.ts +2 -1
  292. package/lib/utils/deep-link.js +1 -1
  293. package/lib/utils/extract-extensions.js +1 -1
  294. package/lib/utils/graphql-parse.d.ts +1 -0
  295. package/lib/utils/graphql-parse.js +1 -0
  296. package/lib/utils/scroll-anchoring.d.ts +2 -1
  297. package/lib/utils/x-logo.d.ts +13 -0
  298. package/lib/utils/x-logo.js +1 -0
  299. package/lib/yaml-compat.d.ts +7 -0
  300. package/lib/yaml-compat.js +1 -0
  301. package/package.json +36 -15
  302. package/lib/services/code-samples/replay/normalize-servers.js +0 -1
@@ -1 +1 @@
1
- import{REDOCLY_TEAMS_RBAC as T}from"@redocly/config";import{encodeBackSlashes as x,safeSlugify as R}from"../../../../utils/string.js";import{joinWithSeparator as k,normalizePath as g,toRelativePath as w}from"../../../../utils/url.js";import{readRbacScope as S,rbacProp as d}from"../../../helpers.js";import{buildSchemaDefinitionContent as N}from"./content.js";import{openApiContext as P}from"../../buildContext.js";function A(r,i,a){const c=i.components?.schemas;if(!c)return[];const o=a?[a]:[],s=[];for(const[e,n]of Object.entries(c)){if(e===T)continue;const m=n["x-tags"];(m?.length?m:o).includes(r)&&s.push(e)}return s.sort((e,n)=>e.localeCompare(n))}function O({tagName:r,tagSlug:i,result:a,groupItems:c}){const{document:o,options:s,processContent:e,basePath:n}=P.get(),l=A(r,o,s.schemaDefinitionsTagName),m=S(o.components?.schemas);for(const t of l){const f=o.components?.schemas?.[t],h=f?.title??t,b=x(R(t).toLowerCase()||t.toLowerCase()),p=g(k(i,b)),u=S(f)??m,C={type:"link",label:h,link:p,routeSlug:p,httpVerb:"schema",content:e?N(t,h,s):null,...d(u)};a.push(C),c?.push({title:h,link:g(w(p,n)),deprecated:!1,...d(u)})}}export{O as addSchemaDefinitionItems,A as getSchemaNamesForTag};
1
+ import{isRbacKey as C}from"../../../rbac.js";import{encodeBackSlashes as T,safeSlugify as k}from"../../../../utils/string.js";import{joinWithSeparator as w,normalizePath as g,toRelativePath as N}from"../../../../utils/url.js";import{readRbacScope as b,rbacProp as d}from"../../../helpers.js";import{buildSchemaDefinitionContent as P}from"./content.js";import{openApiContext as R}from"../../buildContext.js";function y(m,r,s){const n=r.components?.schemas;if(!n)return[];const t=s?[s]:[],o=[];for(const[c,i]of Object.entries(n)){if(C(c))continue;const a=i["x-tags"];(a?.length?a:t).includes(m)&&o.push(c)}return o}function B({tagName:m,tagSlug:r,result:s,groupItems:n}){const{document:t,options:o,processContent:c,basePath:i}=R.get(),f=y(m,t,o.schemaDefinitionsTagName),a=b(t.components?.schemas);for(const e of f){const l=t.components?.schemas?.[e],h=l?.title??e,S=T(k(e).toLowerCase()||e.toLowerCase()),p=g(w(r,S)),u=b(l)??a,x={type:"link",label:h,link:p,routeSlug:p,httpVerb:"schema",content:c?P(e,h,o):null,...d(u)};s.push(x),n?.push({title:h,link:g(N(p,i)),deprecated:!1,...d(u)})}}export{B as addSchemaDefinitionItems,y as getSchemaNamesForTag};
@@ -1 +1 @@
1
- import{schemaKind as w}from"../../types/common.js";import{registerSchema as v,registerExample as E,registerSecurityScheme as V,resolveRef as S,isRecord as y,readRbacScope as l,rbacProp as b,splitRbacSection as g}from"../helpers.js";import{applyIgnoreNamedSchemasDeep as k}from"./utils/applyIgnoreNamedSchemasDeep.js";import{parseMarkdown as A}from"../utils/parseMarkdown.js";import{resolveOpenApiExampleValue as C}from"./resolve-openapi-example-value.js";const I=["x-defaultClientId","x-defaultAccessToken","x-defaultTokenType","x-defaultClientSecret","x-defaultUsername","x-defaultPassword"];function M(d){const c={},r=d;for(const n of I)r[n]&&(c[n]=r[n]);return r["x-serverValues"]&&(c.serverValues=r["x-serverValues"]),c}function j(d,c,r){const{schemaStore:n,exampleStore:f,securitySchemeStore:u,hashIndex:R}=c,{ignoreNamedSchemas:p}=r,x=c.document,a=d.components,h=d["x-root"];if(y(h)){const s=k(h,p),o=y(s)?s:h;v(n,R,{id:"x-root",kind:w.JSON_SCHEMA,title:typeof o.title=="string"?o.title:"Root",data:o})}if(!a)return{schemaStore:n,exampleStore:f,securitySchemeStore:u};if(a.schemas){const{sectionRbac:s,entries:o}=g(a.schemas);for(const[i,t]of o){const e=S(x,t,p)??t,m=k(e,p);y(m)&&v(n,R,{id:`components/schemas/${i}`,kind:w.JSON_SCHEMA,title:typeof m.title=="string"?m.title:i,data:m,...b(s)})}}if(a.examples){const{sectionRbac:s,entries:o}=g(a.examples);for(const[i,t]of o){const e=S(x,t,p)??t;!e||typeof e!="object"||E(f,{id:`components/examples/${i}`,value:C(e),summary:typeof e.summary=="string"?e.summary:void 0,description:typeof e.description=="string"?e.description:void 0,externalValue:e.externalValue,...b(l(t)??l(e)??s)})}}if(a.securitySchemes){const{sectionRbac:s,entries:o}=g(a.securitySchemes);for(const[i,t]of o){if(!t||typeof t!="object")continue;const e=S(x,t,p)??t;if(!e)continue;const m={id:i,type:e.type,scheme:e.scheme,bearerFormat:e.bearerFormat,description:e.description?A(e.description,r):void 0,in:e.in,paramName:e.name,openIdConnectUrl:e.openIdConnectUrl,oauth2MetadataUrl:e.oauth2MetadataUrl,deprecated:e.deprecated,flows:e.flows,...M(e),...b(l(t)??l(e)??s)};V(u,m)}}return{schemaStore:n,exampleStore:f,securitySchemeStore:u}}export{j as populateOpenApiStore};
1
+ import{schemaKind as w}from"../../types/common.js";import{encodeJsonPointerSegment as O}from"../../utils/refPointer.js";import{getImplicitDiscriminatorChildren as k}from"../../services/schema/dialects/jsonSchema.js";import{registerSchema as A,registerExample as C,pickRenderableDescription as I,registerSecurityScheme as E,resolveRef as g,isRecord as y,readRbacScope as S,rbacProp as b,splitRbacSection as R}from"../helpers.js";import{applyIgnoreNamedSchemasDeep as v}from"./utils/applyIgnoreNamedSchemasDeep.js";import{parseMarkdown as M}from"../utils/parseMarkdown.js";import{resolveOpenApiExampleValue as N}from"./resolve-openapi-example-value.js";const V=["x-defaultClientId","x-defaultAccessToken","x-defaultTokenType","x-defaultClientSecret","x-defaultUsername","x-defaultPassword"];function U(c){const o={},r=c;for(const n of V)r[n]&&(o[n]=r[n]);return r["x-serverValues"]&&(o.serverValues=r["x-serverValues"]),o}function j(c){const o=c.components?.schemas;if(!o||typeof o!="object")return;const r=k(c);for(const[n,l]of Object.entries(o)){if(!y(l))continue;const a=l,{discriminator:f}=a;if(!f?.propertyName||f.mapping||f["x-explicitMappingOnly"]||Array.isArray(a.oneOf)||Array.isArray(a.anyOf))continue;const m=r[`#/components/schemas/${O(n)}`];if(!m?.length)continue;const d={};for(const{ref:s,value:x}of m)d[x]=s;o[n]={...a,discriminator:{...f,mapping:d}}}}function K(c,o,r){const{schemaStore:n,exampleStore:l,securitySchemeStore:a,hashIndex:f}=o,{ignoreNamedSchemas:m}=r,d=o.document;j(c);const s=c.components,x=c["x-root"];if(y(x)){const p=v(x,m),i=y(p)?p:x;A(n,f,{id:"x-root",kind:w.JSON_SCHEMA,title:typeof i.title=="string"?i.title:"Root",data:i})}if(!s)return{schemaStore:n,exampleStore:l,securitySchemeStore:a};if(s.schemas){const{sectionRbac:p,entries:i}=R(s.schemas);for(const[u,t]of i){const e=g(d,t,m)??t,h=v(e,m);y(h)&&A(n,f,{id:`components/schemas/${u}`,kind:w.JSON_SCHEMA,title:typeof h.title=="string"?h.title:u,data:h,...b(p)})}}if(s.examples){const{sectionRbac:p,entries:i}=R(s.examples);for(const[u,t]of i){const e=g(d,t,m)??t;!e||typeof e!="object"||C(l,{id:`components/examples/${u}`,value:N(e),summary:typeof e.summary=="string"?e.summary:void 0,description:I(e.description),externalValue:e.externalValue,...b(S(t)??S(e)??p)})}}if(s.securitySchemes){const{sectionRbac:p,entries:i}=R(s.securitySchemes);for(const[u,t]of i){if(!t||typeof t!="object")continue;const e=g(d,t,m)??t;if(!e)continue;const h={id:u,type:e.type,scheme:e.scheme,bearerFormat:e.bearerFormat,description:e.description?M(e.description,r):void 0,in:e.in,paramName:e.name,openIdConnectUrl:e.openIdConnectUrl,oauth2MetadataUrl:e.oauth2MetadataUrl,deprecated:e.deprecated,flows:e.flows,...U(e),...b(S(t)??S(e)??p)};E(a,h)}}return{schemaStore:n,exampleStore:l,securitySchemeStore:a}}export{K as populateOpenApiStore};
@@ -8,8 +8,8 @@ export declare function mergeInMockServer(servers: OpenAPIServer[], mockServerOp
8
8
  /** Operation servers win when non-empty; an empty array falls through to the
9
9
  * document servers (see the empty-array test — a `??` fallback would not). */
10
10
  export declare function pickOperationServers<T>(operationServers: T[] | undefined, documentServers: T[] | undefined): T[];
11
- /** Strips servers injected by {@link mergeInMockServer}. Returns the same
12
- * reference when nothing is flagged. */
11
+ /** Strips servers flagged as mock servers. Returns the same reference when
12
+ * nothing is flagged. */
13
13
  export declare function excludeMockServers<T extends {
14
14
  isMockServer?: boolean;
15
15
  }>(servers: T[]): T[];
@@ -0,0 +1,14 @@
1
+ import { REDOCLY_TEAMS_RBAC } from '@redocly/config';
2
+ export type RbacScope = Record<string, string>;
3
+ export declare function readRbacScope(source: unknown): RbacScope | undefined;
4
+ export declare function hasRbacScope(source: unknown): boolean;
5
+ export type RbacProp = {
6
+ [REDOCLY_TEAMS_RBAC]?: RbacScope;
7
+ };
8
+ export declare function rbacProp(scope: RbacScope | undefined): RbacProp;
9
+ /** True for the `redocly::teams-rbac` marker key injected into records by the platform. */
10
+ export declare function isRbacKey(key: string): boolean;
11
+ export declare function splitRbacSection<T>(map: Record<string, T> | undefined): {
12
+ sectionRbac: RbacScope | undefined;
13
+ entries: [string, T][];
14
+ };
@@ -0,0 +1 @@
1
+ import{REDOCLY_TEAMS_RBAC as r}from"@redocly/config";function t(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function i(e){if(!t(e))return;const n=e[r];return t(n)?n:void 0}function u(e){return i(e)!==void 0}function f(e){return e?{[r]:e}:{}}function o(e){return e===r}function d(e){return e?{sectionRbac:i(e),entries:Object.entries(e).filter(([n])=>!o(n))}:{sectionRbac:void 0,entries:[]}}export{u as hasRbacScope,o as isRbacKey,f as rbacProp,i as readRbacScope,d as splitRbacSection};
@@ -0,0 +1,6 @@
1
+ import type { Node } from '@markdoc/markdoc';
2
+ /**
3
+ * Serializes a Markdoc AST back into markdown source. Node types outside the registries below
4
+ * fall back to their text content. See `brain/markdown-parser-and-adapter.md`.
5
+ */
6
+ export declare function descriptionToMarkdown(description: string | Node | Node[] | undefined | null): string | undefined;
@@ -0,0 +1,11 @@
1
+ import{collectTextContent as s}from"./markdoc.js";function j(t){if(!t)return;if(typeof t=="string")return t||void 0;const n=Array.isArray(t)?t:[t];return a(n)||void 0}function f(t){return Object.assign(Object.create(null),t)}const b=f({document:t=>a(t.children??[]),paragraph:t=>i(t.children??[]),heading:t=>{const n=typeof t.attributes?.level=="number"?t.attributes.level:1;return`${"#".repeat(n)} ${i(t.children??[])}`},fence:t=>{const n=String(t.attributes?.content??"").replace(/\n$/,"");return`\`\`\`${typeof t.attributes?.language=="string"?t.attributes.language:""}
2
+ ${n}
3
+ \`\`\``},list:m,blockquote:t=>h(a(t.children??[]),"> "),table:$,hr:()=>"---"}),d=f({text:t=>String(t.attributes?.content??""),softbreak:()=>`
4
+ `,hardbreak:()=>`
5
+ `,inline:t=>i(t.children??[]),code:t=>`\`${String(t.attributes?.content??"")}\``,link:t=>{const n=String(t.attributes?.href??""),r=t.attributes?.title,e=typeof r=="string"&&r?` "${r}"`:"";return`[${i(t.children??[])}](${n}${e})`},image:t=>{const n=String(t.attributes?.src??"");return`![${typeof t.attributes?.alt=="string"?t.attributes.alt:""}](${n})`},strong:t=>o(t.children??[],l(t,"**")),em:t=>o(t.children??[],l(t,"_")),s:t=>o(t.children??[],l(t,"~~"))});function a(t){return t.map(p).filter(n=>n.length>0).join(`
6
+
7
+ `)}function p(t){const n=b[t.type];return n?n(t):i(t.children??[])||s(t)}function m(t){const n=t.attributes?.ordered===!0;return(t.children??[]).map((r,e)=>{const u=n?`${e+1}. `:"- ",c=a(r.children??[]);return h(c,u," ".repeat(u.length))}).join(`
8
+ `)}function $(t){const n=[];let r=0;for(const e of t.children??[])for(const u of e.children??[]){const c=(u.children??[]).map(g=>i(g.children??[]));r=Math.max(r,c.length),n.push(c),e.type==="thead"&&n.push([])}return n.map(e=>e.length===0?`| ${Array.from({length:r},()=>"---").join(" | ")} |`:`| ${e.join(" | ")} |`).join(`
9
+ `)}function i(t){return t.map(y).join("")}function y(t){const n=d[t.type];if(n)return n(t);const r=t.children??[];return r.length>0?i(r):s(t)}function l(t,n){return typeof t.attributes?.marker=="string"?t.attributes.marker:n}function o(t,n){return`${n}${i(t)}${n}`}function h(t,n,r=n){return t.split(`
10
+ `).map((e,u)=>{const c=u===0?n:r;return e?`${c}${e}`:c.trimEnd()}).join(`
11
+ `)}export{j as descriptionToMarkdown};
@@ -5,7 +5,10 @@ import type { ApiDocsOptions } from '../../types/options.js';
5
5
  import type { MarkdownHeading } from '../../types/openapi.js';
6
6
  import type { ParseMarkdownOptions } from './parseMarkdown.js';
7
7
  export type { MarkdownHeading };
8
- export type MarkdownSanitizeOptions = Partial<Pick<ApiDocsOptions, 'sanitize' | 'unstable_hooks'>>;
8
+ export type MarkdownSanitizeOptions = {
9
+ sanitize?: ApiDocsOptions['sanitize'];
10
+ unstable_hooks?: ApiDocsOptions['unstable_hooks'];
11
+ };
9
12
  export type DescriptionSegment = {
10
13
  kind: 'markdoc';
11
14
  node: ContentNode;
@@ -29,10 +32,14 @@ export declare function collectMarkdownSections(description: Node | Node[] | str
29
32
  sectionItems: ApiItem[];
30
33
  sectionChildren: ContentNode[];
31
34
  };
35
+ export declare function stripMarkdown(text: string): string;
32
36
  export declare function extractFullText(ast: Node | Node[] | string): string;
33
37
  export declare function extractFirstParagraphText(ast: Node | Node[] | string, maxLength?: number): string | undefined;
34
38
  export declare function extractSummaryText(description: string | Node | Node[] | undefined | null, options?: ParseMarkdownOptions): string | undefined;
35
39
  export declare function extractSeoDescriptionText(description: string | Node | Node[] | undefined | null, options?: ParseMarkdownOptions): string | undefined;
40
+ /** One Markdoc node, or a non-empty list of them. */
41
+ export declare function isMarkdocAst(value: unknown): value is Node | Node[];
42
+ export declare function collectTextContent(node: Node): string;
36
43
  export declare function collectMarkdownPlainText(ast: Node | Node[] | string): string;
37
44
  export declare function unescapeHTMLChars(str: string): string;
38
45
  export declare function sanitizeMarkdownSource(source: string, options?: MarkdownSanitizeOptions): string;
@@ -1 +1 @@
1
- import{contentType as D,itemVariant as R,nodeTypes as l}from"../../types/common.js";import{safeSlugify as x}from"../../utils/string.js";import{parseMarkdown as p}from"./parseMarkdown.js";import{isPlainText as k}from"./isPlainText.js";import{joinWithSeparator as a}from"../../utils/url.js";import{buildDeepLinkUrl as v}from"../../utils/deep-link.js";import{getDOMPurify as N}from"./dompurify.js";function O(t){return t.type==="tag"&&t.tag==="schemaDefinition"}const E=/^[ \t]{0,3}#{1,6}[ \t]/m;function b(t){const r=t.search(E);return r===-1?t:t.slice(0,r)}function X(t,r){if(typeof t=="string"){const n=b(t).trim();if(k(n))return n}const e=p(t,r);if(!e)return;if(typeof e=="string")return e;if(Array.isArray(e)){const n=e.findIndex(o=>o.type==="heading");return n===-1?e:e.slice(0,n)}if(!e.children||!Array.isArray(e.children))return;const i=e.children.findIndex(n=>n.type==="heading");return i===-1?[e]:(e.children=e.children.slice(0,i),[e])}function Y(t,r,{sliceAtFirstHeading:e=!1}={}){if(typeof t=="string"&&e){const f=b(t).trim();if(k(f))return[{kind:"markdoc",node:{nodeType:l.MARKDOC,content:f}}]}const i=p(t,r);if(!i)return[];if(typeof i=="string")return[{kind:"markdoc",node:{nodeType:l.MARKDOC,content:i}}];let n=Array.isArray(i)?i:i.children??[];if(e){const f=n.findIndex(d=>d.type==="heading");f!==-1&&(n=n.slice(0,f))}const o=[];let c=[];const u=()=>{c.length>0&&(o.push({kind:"markdoc",node:{nodeType:l.MARKDOC,content:c}}),c=[])};for(const f of n)O(f)?(u(),o.push({kind:"schemaDefinition",node:{nodeType:l.MARKDOC,content:[f]}})):c.push(f);return u(),o}function L(t,r,e){const i=t.toLowerCase(),n=i.startsWith("section/")?i.slice(8):i,o=r.toLowerCase();let c=n!==o?n:"";return e&&(c=a(e,c)),c}function $(t,r,e){if(typeof t=="string")return;const i=n=>{if(n.type==="heading"&&n.attributes?.level){const o=n.attributes.id?n.attributes.id.toLowerCase():x(m(n).trim()).toLowerCase();if(o){const c=L(o,r,e);n.attributes.id=a(r,c).toLowerCase(),n.attributes.deepLinkHash=v("",r,c)}}for(const o of n.children??[])i(o)};if(Array.isArray(t))for(const n of t)i(n);else i(t)}function _(t,r,e,i){const n=p(t,r);if(!n)return[];if(typeof n=="string")return[];const o=[];let c;const u=(s,h,w=o,y,A)=>{s=K(s);const I=A!==void 0;let g;y.attributes.id?g=y.attributes.id:I||i?g=x(s):g=`section/${x(s)}`;const T=a(I?A:e,g).toLowerCase();y.attributes.id=T;const C={id:T,name:s,level:h,items:[],ast:[y]};return w.push(C),C},f=s=>{if(typeof s?.attributes?.content=="string")return s.attributes.content;if(s?.children)return f(s.children[0])},d=s=>{const h=f(s)||"";s.type==="heading"&&s.attributes?.level===1?c=u(h,s.attributes.level,void 0,s):s.attributes?.level?u(h,s.attributes.level,c?.items,s,c?.id):c?.items?.length?c.items[c.items.length-1]?.ast?.push(s):o.length&&o[o.length-1]?.ast?.push(s)};if(Array.isArray(n))for(const s of n)d(s);else if(n.children)for(const s of n.children)d(s);return o}function H({heading:t,basePath:r}){const e=t.items.length>0,i=a(r,t.id).toLowerCase(),n=e?t.items.map(o=>H({heading:o,basePath:r})):[];return{type:e?"group":"link",label:t.name,link:i,routeSlug:i,items:e?n:void 0,content:W(t)}}function J(t,r,e){const i=[],n=[];for(const o of _(t,e,"")){const{item:c,children:u}=M(o,r);i.push(c),n.push(...u)}return{sectionItems:i,sectionChildren:n}}function M(t,r){const e=a(r,t.id),i=t.items.length>0,n=t.ast?.length?[z(t.ast,a(r,t.id))]:[],o=[];for(const u of t.items){const{item:f,children:d}=M(u,r);o.push(f);const s=a(r,u.id);n.push({nodeType:l.OVERVIEW_SECTION_WRAPPER,children:d,sectionId:s})}return{item:{type:i?"group":"link",label:t.name,link:e,routeSlug:e,items:i?o:void 0,content:null},children:n}}function Q(t){return typeof t=="string"?t.trim():Array.isArray(t)?t.map(r=>m(r)).filter(Boolean).join(" ").trim():m(t).trim()}function S(t,r=50){if(typeof t=="string"){const o=t.split(/\n[ \t]*\n/)[0].replace(/\s+/g," ").trim();return o?o.substring(0,r):void 0}const i=(Array.isArray(t)?t:t.children??[t])[0];if(!i)return;const n=m(i);return n?n.substring(0,r):void 0}function Z(t,r){if(!t)return;const e=p(t,r);if(!e)return;const i=S(e);return i?i.length===50?i+"\u2026":i:void 0}function tt(t,r){if(!t)return;const e=p(t,r);if(e)return S(e,Number.POSITIVE_INFINITY)}function m(t){const r=[];function e(i){typeof i.attributes?.content=="string"&&r.push(i.attributes.content);for(const n of i.children??[])e(n)}return e(t),r.join("")}function et(t){return typeof t=="string"?t.trim():(Array.isArray(t)?t:[t]).map(e=>m(e)).join("").trim()}function K(t){return t.replace(/&#(\d+);/g,(r,e)=>String.fromCharCode(parseInt(e,10))).replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function nt(t,r){const{unstable_hooks:e,sanitize:i}=r??{};return e?.sanitize?e.sanitize(t):i?N().sanitize(t):t}function W(t){const r=[];return t.ast&&t.ast.length>0&&r.push({nodeType:l.MARKDOC,content:t.ast}),{contentType:D.ITEM,itemVariant:R.MARKDOWN,meta:{name:t.name},children:[{nodeType:l.CONTAINER,children:r,panels:[]}]}}function z(t,r){return{nodeType:l.OVERVIEW_SECTION_WRAPPER,children:[{nodeType:l.MARKDOC,content:t}],sectionId:r}}export{H as buildMarkdownSectionItem,et as collectMarkdownPlainText,J as collectMarkdownSections,X as extractContentUntilFirstHeading,Y as extractDescriptionSegments,S as extractFirstParagraphText,Q as extractFullText,_ as extractMarkdownSections,tt as extractSeoDescriptionText,Z as extractSummaryText,L as resolveMarkdocHeadingDeepSuffix,$ as resolveMarkdocHeadingIds,nt as sanitizeMarkdownSource,K as unescapeHTMLChars};
1
+ import{contentType as E,itemVariant as L,nodeTypes as u}from"../../types/common.js";import{safeSlugify as x}from"../../utils/string.js";import{parseMarkdown as p}from"./parseMarkdown.js";import{isPlainText as I}from"./isPlainText.js";import{joinWithSeparator as a}from"../../utils/url.js";import{buildDeepLinkUrl as $}from"../../utils/deep-link.js";import{getDOMPurify as v}from"./dompurify.js";function _(t){return t.type==="tag"&&t.tag==="schemaDefinition"}const H=/^[ \t]{0,3}#{1,6}[ \t]/m;function M(t){const r=t.search(H);return r===-1?t:t.slice(0,r)}function Q(t,r){if(typeof t=="string"){const n=M(t).trim();if(I(n))return n}const e=p(t,r);if(!e)return;if(typeof e=="string")return e;if(Array.isArray(e)){const n=e.findIndex(o=>o.type==="heading");return n===-1?e:e.slice(0,n)}if(!e.children||!Array.isArray(e.children))return;const i=e.children.findIndex(n=>n.type==="heading");return i===-1?[e]:(e.children=e.children.slice(0,i),[e])}function Z(t,r,{sliceAtFirstHeading:e=!1}={}){if(typeof t=="string"&&e){const l=M(t).trim();if(I(l))return[{kind:"markdoc",node:{nodeType:u.MARKDOC,content:l}}]}const i=p(t,r);if(!i)return[];if(typeof i=="string")return[{kind:"markdoc",node:{nodeType:u.MARKDOC,content:i}}];let n=Array.isArray(i)?i:i.children??[];if(e){const l=n.findIndex(d=>d.type==="heading");l!==-1&&(n=n.slice(0,l))}const o=[];let c=[];const f=()=>{c.length>0&&(o.push({kind:"markdoc",node:{nodeType:u.MARKDOC,content:c}}),c=[])};for(const l of n)_(l)?(f(),o.push({kind:"schemaDefinition",node:{nodeType:u.MARKDOC,content:[l]}})):c.push(l);return f(),o}function W(t,r,e){const i=t.toLowerCase(),n=i.startsWith("section/")?i.slice(8):i,o=r.toLowerCase();let c=n!==o?n:"";return e&&(c=a(e,c)),c}function S(t,...r){let e=t.toLowerCase();for(const i of r){const n=i?`${i.toLowerCase()}/`:"";n&&`${e}/`.startsWith(n)&&(e=e.slice(n.length))}return e}function tt(t,r,e){if(typeof t=="string")return;const i=n=>{if(n.type==="heading"&&n.attributes?.level){const o=n.attributes.id?S(n.attributes.id,r,e):x(m(n).trim()).toLowerCase();if(o){const c=W(o,r,e);n.attributes.id=a(r,c).toLowerCase(),n.attributes.deepLinkHash=$("",r,c)}}for(const o of n.children??[])i(o)};if(Array.isArray(t))for(const n of t)i(n);else i(t)}function K(t,r,e,i){const n=p(t,r);if(!n)return[];if(typeof n=="string")return[];const o=[];let c;const f=(s,h,O=o,g,A)=>{s=V(s);const b=A!==void 0,T=b?A:e;let y;g.attributes.id?y=S(g.attributes.id,T):b||i?y=x(s):y=`section/${x(s)}`;const k=a(T,y).toLowerCase();g.attributes.id=k;const C={id:k,name:s,level:h,items:[],ast:[g]};return O.push(C),C},l=s=>{if(typeof s?.attributes?.content=="string")return s.attributes.content;if(s?.children)return l(s.children[0])},d=s=>{const h=l(s)||"";s.type==="heading"&&s.attributes?.level===1?c=f(h,s.attributes.level,void 0,s):s.attributes?.level?f(h,s.attributes.level,c?.items,s,c?.id):c?.items?.length?c.items[c.items.length-1]?.ast?.push(s):o.length&&o[o.length-1]?.ast?.push(s)};if(Array.isArray(n))for(const s of n)d(s);else if(n.children)for(const s of n.children)d(s);return o}function z({heading:t,basePath:r}){const e=t.items.length>0,i=a(r,t.id).toLowerCase(),n=e?t.items.map(o=>z({heading:o,basePath:r})):[];return{type:e?"group":"link",label:t.name,link:i,routeSlug:i,items:e?n:void 0,content:j(t)}}function et(t,r,e){const i=[],n=[];for(const o of K(t,e,"")){const{item:c,children:f}=w(o,r);i.push(c),n.push(...f)}return{sectionItems:i,sectionChildren:n}}function w(t,r){const e=a(r,t.id),i=t.items.length>0,n=t.ast?.length?[F(t.ast,a(r,t.id))]:[],o=[];for(const f of t.items){const{item:l,children:d}=w(f,r);o.push(l);const s=a(r,f.id);n.push({nodeType:u.OVERVIEW_SECTION_WRAPPER,children:d,sectionId:s})}return{item:{type:i?"group":"link",label:t.name,link:e,routeSlug:e,items:i?o:void 0,content:null},children:n}}const P=/<\/?(?:a|b|i|em|strong|code|pre|br|hr|p|span|div|small|sup|sub|img|ul|ol|li|dl|dt|dd|table|thead|tbody|tr|td|th|blockquote|h[1-6])(?:\s[^>]*)?\/?>/gi;function D(t){return t.replace(/```[^\n]*\n?([\s\S]*?)```/g,"$1").replace(P,"").replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^[ \t]*(?:[-*+]|\d+[.)])[ \t]+/gm,"").replace(/^[ \t]*#{1,6}[ \t]+/gm,"").replace(/^[ \t]*>[ \t]?/gm,"").replace(/^[ \t]*(?:[-*][ \t]*){3,}$/gm,"").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(?=\S)(.*?\S)\*/g,"$1").replace(/`+([^`]*)`+/g,"$1").replace(/\\([\\`*_{}[\]()#+\-.!>])/g,"$1").replace(/\s+/g," ").trim()}function nt(t){return typeof t=="string"?D(t):Array.isArray(t)?t.map(r=>m(r)).filter(Boolean).join(" ").trim():m(t).trim()}function N(t,r=50){if(typeof t=="string"){const o=t.split(/\n[ \t]*\n/)[0].replace(/\s+/g," ").trim();return o?o.substring(0,r):void 0}const i=(Array.isArray(t)?t:t.children??[t])[0];if(!i)return;const n=m(i);return n?n.substring(0,r):void 0}function rt(t,r){if(!t)return;const e=p(t,r);if(!e)return;const i=N(e);return i?i.length===50?i+"\u2026":i:void 0}function it(t,r){if(!t)return;const e=p(t,r);if(e)return N(e,Number.POSITIVE_INFINITY)}function R(t){return!!t&&typeof t=="object"&&"$$mdtype"in t}function ot(t){return Array.isArray(t)?t.length>0&&t.every(R):R(t)}function m(t){const r=[];function e(i){typeof i.attributes?.content=="string"&&r.push(i.attributes.content);for(const n of i.children??[])e(n)}return e(t),r.join("")}function st(t){return typeof t=="string"?D(t):(Array.isArray(t)?t:[t]).map(e=>m(e)).join("").trim()}function V(t){return t.replace(/&#(\d+);/g,(r,e)=>String.fromCharCode(parseInt(e,10))).replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function ct(t,r){const{sanitize:e}=r??{},{unstable_hooks:i}=r??{};return i?.sanitize?i.sanitize(t):e?v().sanitize(t):t}function j(t){const r=[];return t.ast&&t.ast.length>0&&r.push({nodeType:u.MARKDOC,content:t.ast}),{contentType:E.ITEM,itemVariant:L.MARKDOWN,meta:{name:t.name},children:[{nodeType:u.CONTAINER,children:r,panels:[]}]}}function F(t,r){return{nodeType:u.OVERVIEW_SECTION_WRAPPER,children:[{nodeType:u.MARKDOC,content:t}],sectionId:r}}export{z as buildMarkdownSectionItem,st as collectMarkdownPlainText,et as collectMarkdownSections,m as collectTextContent,Q as extractContentUntilFirstHeading,Z as extractDescriptionSegments,N as extractFirstParagraphText,nt as extractFullText,K as extractMarkdownSections,it as extractSeoDescriptionText,rt as extractSummaryText,ot as isMarkdocAst,W as resolveMarkdocHeadingDeepSuffix,tt as resolveMarkdocHeadingIds,ct as sanitizeMarkdownSource,D as stripMarkdown,V as unescapeHTMLChars};
@@ -1,15 +1,17 @@
1
1
  import { Component } from 'react';
2
- import type { ReactNode, ErrorInfo } from 'react';
2
+ import type { ReactNode, ErrorInfo, ContextType } from 'react';
3
+ import { TelemetryContext } from '../contexts/telemetry.js';
3
4
  type ErrorBoundaryProps = {
4
5
  children: ReactNode;
5
6
  fallback?: ReactNode;
6
- onError?: (error: Error, errorInfo: ErrorInfo) => void;
7
7
  };
8
8
  type ErrorBoundaryState = {
9
9
  hasError: boolean;
10
10
  error: Error | null;
11
11
  };
12
12
  export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
13
+ static contextType: import("react").Context<import("../index.js").RedocTelemetry>;
14
+ context: ContextType<typeof TelemetryContext>;
13
15
  constructor(props: ErrorBoundaryProps);
14
16
  static getDerivedStateFromError(error: Error): ErrorBoundaryState;
15
17
  componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
@@ -1 +1,55 @@
1
- import{jsx as t,jsxs as o}from"react/jsx-runtime";import{Component as n}from"react";class l extends n{constructor(r){super(r),this.state={hasError:!1,error:null}}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,e){console.error("[api-docs] Rendering error:",r,e.componentStack);try{this.props.onError?.(r,e)}catch(s){console.error("[api-docs] onError handler threw:",s)}}render(){return this.state.hasError?this.props.fallback?this.props.fallback:o("div",{role:"alert",style:{padding:"20px",color:"#c00"},children:[t("h2",{children:"Something went wrong rendering the API documentation."}),o("details",{style:{whiteSpace:"pre-wrap",marginTop:"10px"},children:[t("summary",{children:"Error details"}),this.state.error?.message]})]}):this.props.children}}export{l as ErrorBoundary};
1
+ import{jsx as t,jsxs as a}from"react/jsx-runtime";import{Component as s}from"react";import{styled as r}from"styled-components";import{breakpoints as c}from"@redocly/theme/core/openapi";import{Accordion as l}from"@redocly/theme/markdoc/components/Accordion/Accordion";import{TelemetryContext as p}from"../contexts/telemetry.js";class j extends s{static contextType=p;constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,i){console.error("[api-docs] Rendering error:",e,i.componentStack);const o=this.context;try{o.sendErrorMessage([{id:"errorBoundaryCatch",object:"error",uri:typeof window<"u"?window.location.href:"",...o.typeOfUsage?{typeOfUsage:o.typeOfUsage}:{},details:{message:e.message,stack:i.componentStack??void 0}}])}catch(n){console.error("[api-docs] error telemetry failed:",n)}}render(){return this.state.hasError?this.props.fallback?this.props.fallback:t(d,{role:"alert",className:"api-docs-error-page",children:a(h,{children:[t(f,{children:"Something went wrong rendering the API documentation."}),t(g,{title:"Error details",expanded:!1,children:t(m,{children:this.state.error?.message})}),t(x,{children:t(v,{type:"button",onClick:()=>window.location.reload(),children:"Reload page"})})]})}):this.props.children}}const d=r.div`
2
+ box-sizing: border-box;
3
+ min-height: calc(100vh - var(--navbar-height, 0px) - var(--banner-height, 0px));
4
+ min-height: calc(100dvh - var(--navbar-height, 0px) - var(--banner-height, 0px));
5
+ background: var(--bg-color, #ffffff);
6
+ font-family: var(--font-family-base, system-ui, sans-serif);
7
+ color: var(--text-color-primary, #1a1c21);
8
+ `,h=r.div`
9
+ display: flex;
10
+ flex-direction: column;
11
+ justify-content: center;
12
+ box-sizing: border-box;
13
+ min-height: inherit;
14
+ max-width: 620px;
15
+ margin: 0 calc(var(--spacing-xxl, 48px) * 2);
16
+ padding: var(--spacing-xl, 32px) 0;
17
+
18
+ @media screen and (max-width: ${c.small}) {
19
+ margin: 0 var(--spacing-lg, 24px);
20
+ }
21
+ `,f=r.h1`
22
+ margin: 0;
23
+ color: var(--text-color-primary, #1a1c21);
24
+ font-size: 32px;
25
+ line-height: 40px;
26
+ font-weight: var(--font-weight-bold, 700);
27
+ `,g=r(l)`
28
+ margin: var(--spacing-lg, 24px) 0 0;
29
+ `,m=r.div`
30
+ color: var(--text-color-secondary, #3b3c45);
31
+ font-family: var(--font-family-monospaced, monospace);
32
+ font-size: var(--font-size-lg, 16px);
33
+ line-height: var(--line-height-lg, 24px);
34
+ white-space: pre-wrap;
35
+ overflow-wrap: anywhere;
36
+ `,x=r.div`
37
+ margin-top: var(--spacing-xl, 32px);
38
+ `,v=r.button`
39
+ display: inline-flex;
40
+ align-items: center;
41
+ padding: 5px var(--spacing-base, 16px);
42
+ border: none;
43
+ border-radius: var(--border-radius-lg, 8px);
44
+ background: var(--button-bg-color-primary, #3e63dd);
45
+ color: #ffffff;
46
+ font-family: inherit;
47
+ font-size: var(--font-size-base, 14px);
48
+ line-height: var(--line-height-base, 22px);
49
+ font-weight: var(--font-weight-semibold, 600);
50
+ cursor: pointer;
51
+
52
+ &:hover {
53
+ filter: brightness(1.08);
54
+ }
55
+ `;export{j as ErrorBoundary};
@@ -1,11 +1,11 @@
1
- import{Fragment as B,jsx as r,jsxs as l}from"react/jsx-runtime";import{useMemo as d,memo as Q,useContext as U}from"react";import{useAtomValue as E}from"jotai";import{styled as t,css as c}from"styled-components";import{apiSpecType as I}from"../../types/common.js";import{H1 as V}from"@redocly/theme/components/Typography/H1";import{H2 as Y}from"@redocly/theme/components/Typography/H2";import{H3 as J}from"@redocly/theme/components/Typography/H3";import{H4 as X}from"@redocly/theme/components/Typography/H4";import{PageActions as Z}from"@redocly/theme/components/PageActions/PageActions";import{breakpoints as ee}from"@redocly/theme/core/utils";import{useSpecTranslate as re}from"../../hooks/useTranslate.js";import{resolveText as te}from"../../utils/resolveText.js";import{routingBasePathAtom as oe,specTypeAtom as ae}from"../../jotai/store.js";import{GraphQLHeaderExtras as ne}from"../graphql/GraphQLHeaderExtras.js";import{StyledBadge as D,TextBadge as ie,renderPropertyBadge as W}from"../common/Badge.js";import{DeepLinkAnchor as se,deepLinkHoverReveal as le}from"../common/DeepLinkAnchor.js";import{joinWithSeparator as pe,toRelativePath as de}from"../../utils/url.js";import{encodeBackSlashes as ce}from"../../utils/string.js";import{buildDeepLinkUrl as me,getDeepLinkId as ge}from"../../utils/deep-link.js";import{useNavigationUrlNormalizer as he}from"../../hooks/useNormalizeUrl.js";import{ItemIdContext as fe}from"../../hooks/useDeepLinkSection.js";import{ArgsCollapsed as be}from"../graphql/styled.js";import{ResponsesDeepLinkAnchor as ue}from"./ResponseDeepLinkAnchor.js";import{HeaderResponseCodeTabs as xe}from"./HeaderResponseCodeTabs.js";import{ExpandAllButton as ve}from"../common/ExpandAllButton.js";import{useHeaderExpandableKeys as He,useResponseCodes as we,useHeaderHasRenderedCollapsibles as ke}from"./hooks.js";function ye({node:e,path:m,parentNode:_}){const{level:g,label:q,badges:u,deprecated:z,graphqlReturnType:j,graphqlArgs:x,graphqlDeprecated:G,graphqlOperationType:N,showPageActions:F=!1,deepLinkSuffix:a,protocolTag:w,isWebhook:y}=e,$=E(ae),v=re(),o=$===I.GRAPHQL,A=z||o&&G,i=E(oe),k=he(),h=U(fe),s=we(_,a),K=s?.[0]||"",f=te(v,e.labelTranslationKey,e.label),p=d(()=>m?de(m,i):"",[m,i]),H=d(()=>p?k(a?me(i,p,a):pe(i,ce(p.toLowerCase()))):"",[p,i,a,k]),R=a==="responses"&&!!s&&s.length>0&&!!m,T=He(a),M=ke(a),C=d(()=>u?.filter(n=>n.position==="before")??[],[u]),L=d(()=>u?.filter(n=>n.position!=="before")??[],[u]),P=d(()=>!H||g<=1?null:R?r(ue,{routingBasePath:i,relativePath:p,itemId:h??"",label:`link to ${f}`}):r(se,{to:H,label:`link to ${f}`}),[H,g,R,i,p,h,f]),S=d(()=>{const n=l(B,{children:[P,C.map(W),f,L.map(W)]});switch(g){case 1:return r(Be,{$inline:o,children:n});case 2:return l(Ee,{$inline:o,children:[n,A&&r(D,{$deprecated:!0,children:v("badges.deprecated","deprecated")}),y&&r(D,{webhook:!0,children:v("badges.webhook","Webhook")})]});case 3:return r(Ie,{$inline:o,children:n});case 4:return r(De,{$inline:o,children:n});case 5:return r(We,{$inline:o,children:n});default:return null}},[P,C,f,L,g,A,v,y,o]),O=!o&&g===4&&a==="responses";return l(B,{children:[w&&r(Pe,{color:w.color,borderless:!0,children:w.label}),l($e,{id:a?ge(H):void 0,$spacingBeforeResponses:O,$isAsyncApi:$===I.ASYNCAPI,children:[l(Te,{$badgeCount:s?.length??0,children:[o?l(Se,{children:[S,x&&x.length>0&&l(Ce,{"data-testid":"collapsed-args",$size:"lg",children:["(",x.length===1?x[0].name:"...args",")"]})]}):S,s&&s.length>0&&r(xe,{codes:s,itemId:h??"",firstCode:K}),T.length>0&&M&&h&&r(ve,{itemId:h,deepLinkKeys:T})]}),F&&r(Le,{children:r(Z,{pageSlug:m||i})})]}),o&&r(ne,{returnType:j,operationName:q,operationType:N})]})}const $e=t.div`
1
+ import{Fragment as B,jsx as r,jsxs as l}from"react/jsx-runtime";import{useMemo as d,memo as Q,useContext as U}from"react";import{useAtomValue as E}from"jotai";import{styled as t,css as c}from"styled-components";import{apiSpecType as I}from"../../types/common.js";import{H1 as V}from"@redocly/theme/components/Typography/H1";import{H2 as Y}from"@redocly/theme/components/Typography/H2";import{H3 as J}from"@redocly/theme/components/Typography/H3";import{H4 as X}from"@redocly/theme/components/Typography/H4";import{breakpoints as Z}from"@redocly/theme/core/openapi";import{useSpecTranslate as ee}from"../../hooks/useTranslate.js";import{resolveText as re}from"../../utils/resolveText.js";import{routingBasePathAtom as te,specTypeAtom as oe}from"../../jotai/store.js";import{GraphQLHeaderExtras as ae}from"../graphql/GraphQLHeaderExtras.js";import{StyledBadge as D,TextBadge as ne,renderPropertyBadge as W}from"../common/Badge.js";import{DeepLinkAnchor as ie,deepLinkHoverReveal as se}from"../common/DeepLinkAnchor.js";import{joinWithSeparator as le,toRelativePath as pe}from"../../utils/url.js";import{encodeBackSlashes as de}from"../../utils/string.js";import{buildDeepLinkUrl as ce,getDeepLinkId as me}from"../../utils/deep-link.js";import{useNavigationUrlNormalizer as ge}from"../../hooks/useNormalizeUrl.js";import{ItemIdContext as he}from"../../hooks/useDeepLinkSection.js";import{ArgsCollapsed as fe}from"../graphql/styled.js";import{ResponsesDeepLinkAnchor as be}from"./ResponseDeepLinkAnchor.js";import{HeaderResponseCodeTabs as ue}from"./HeaderResponseCodeTabs.js";import{HeaderPageActions as xe}from"./HeaderPageActions.js";import{ExpandAllButton as ve}from"../common/ExpandAllButton.js";import{useHeaderExpandableKeys as He,useResponseCodes as we,useHeaderHasRenderedCollapsibles as ke}from"./hooks.js";function ye({node:e,path:m,parentNode:_}){const{level:g,label:q,badges:u,deprecated:z,graphqlReturnType:j,graphqlArgs:x,graphqlDeprecated:G,graphqlOperationType:N,showPageActions:F=!1,deepLinkSuffix:a,protocolTag:w,isWebhook:y}=e,$=E(oe),v=ee(),o=$===I.GRAPHQL,A=z||o&&G,i=E(te),k=ge(),h=U(he),s=we(_,a),K=s?.[0]||"",f=re(v,e.labelTranslationKey,e.label),p=d(()=>m?pe(m,i):"",[m,i]),H=d(()=>p?k(a?ce(i,p,a):le(i,de(p.toLowerCase()))):"",[p,i,a,k]),R=a==="responses"&&!!s&&s.length>0&&!!m,T=He(a),M=ke(a),C=d(()=>u?.filter(n=>n.position==="before")??[],[u]),L=d(()=>u?.filter(n=>n.position!=="before")??[],[u]),P=d(()=>!H||g<=1?null:R?r(be,{routingBasePath:i,relativePath:p,itemId:h??"",label:`link to ${f}`}):r(ie,{to:H,label:`link to ${f}`}),[H,g,R,i,p,h,f]),S=d(()=>{const n=l(B,{children:[P,C.map(W),f,L.map(W)]});switch(g){case 1:return r(Be,{$inline:o,children:n});case 2:return l(Ee,{$inline:o,children:[n,A&&r(D,{$deprecated:!0,children:v("badges.deprecated","deprecated")}),y&&r(D,{webhook:!0,children:v("badges.webhook","Webhook")})]});case 3:return r(Ie,{$inline:o,children:n});case 4:return r(De,{$inline:o,children:n});case 5:return r(We,{$inline:o,children:n});default:return null}},[P,C,f,L,g,A,v,y,o]),O=!o&&g===4&&a==="responses";return l(B,{children:[w&&r(Pe,{color:w.color,borderless:!0,children:w.label}),l($e,{id:a?me(H):void 0,$spacingBeforeResponses:O,$isAsyncApi:$===I.ASYNCAPI,children:[l(Te,{$badgeCount:s?.length??0,children:[o?l(Se,{children:[S,x&&x.length>0&&l(Ce,{"data-testid":"collapsed-args",$size:"lg",children:["(",x.length===1?x[0].name:"...args",")"]})]}):S,s&&s.length>0&&r(ue,{codes:s,itemId:h??"",firstCode:K}),T.length>0&&M&&h&&r(ve,{itemId:h,deepLinkKeys:T})]}),F&&r(Le,{children:r(xe,{pageSlug:m||i})})]}),o&&r(ae,{returnType:j,operationName:q,operationType:N})]})}const $e=t.div`
2
2
  container-type: inline-size;
3
3
  container-name: api-docs-heading;
4
4
  position: relative;
5
5
  display: flex;
6
6
  align-items: flex-start;
7
7
  gap: var(--spacing-base);
8
- ${le}
8
+ ${se}
9
9
  margin-bottom: var(--spacing-base);
10
10
  flex-wrap: nowrap;
11
11
  gap: var(--spacing-xs);
@@ -29,7 +29,7 @@ import{Fragment as B,jsx as r,jsxs as l}from"react/jsx-runtime";import{useMemo a
29
29
  margin-top: var(--spacing-xl);
30
30
  `}
31
31
 
32
- @media screen and (max-width: ${ee.small}) {
32
+ @media screen and (max-width: ${Z.small}) {
33
33
  gap: 0;
34
34
  }
35
35
  `,Ae=250,Re=64,Te=t.div`
@@ -51,12 +51,12 @@ import{Fragment as B,jsx as r,jsxs as l}from"react/jsx-runtime";import{useMemo a
51
51
  }
52
52
  }
53
53
  `}
54
- `,Ce=t(be)`
54
+ `,Ce=t(fe)`
55
55
  margin-left: var(--spacing-xs);
56
56
  `,Le=t.div`
57
57
  flex-shrink: 0;
58
58
  margin-left: auto;
59
- `,Pe=t(ie)`
59
+ `,Pe=t(ne)`
60
60
  display: block;
61
61
  align-self: flex-start;
62
62
  margin-top: var(--spacing-md);
@@ -0,0 +1,4 @@
1
+ import type { JSX } from 'react';
2
+ export declare function HeaderPageActions({ pageSlug }: {
3
+ pageSlug: string;
4
+ }): JSX.Element | null;
@@ -0,0 +1 @@
1
+ import{jsx as r}from"react/jsx-runtime";import{PageActions as e}from"@redocly/theme/components/PageActions/PageActions";function i({pageSlug:o}){return r(e,{pageSlug:o})}export{i as HeaderPageActions};
@@ -0,0 +1,4 @@
1
+ import type { JSX } from 'react';
2
+ export declare function PageActions({ pageSlug }: {
3
+ pageSlug: string;
4
+ }): JSX.Element | null;
@@ -0,0 +1,11 @@
1
+ import{jsx as e}from"react/jsx-runtime";import{useEffect as b,useRef as x,useState as A}from"react";import{styled as h}from"styled-components";import{Button as I}from"@redocly/theme/components/Button/Button";import{SplitButton as L}from"@redocly/theme/components/SplitButton/SplitButton";import{DropdownMenu as w}from"@redocly/theme/components/Dropdown/DropdownMenu";import{DropdownMenuItem as k}from"@redocly/theme/components/Dropdown/DropdownMenuItem";import{PageActionsMenuItem as v}from"@redocly/theme/components/PageActions/PageActionsMenuItem";import{CopyIcon as C}from"@redocly/theme/icons/CopyIcon/CopyIcon";import{ChatGptIcon as D}from"@redocly/theme/icons/ChatGptIcon/ChatGptIcon";import{ClaudeIcon as G}from"@redocly/theme/icons/ClaudeIcon/ClaudeIcon";import{Spinner as M}from"@redocly/theme/icons/Spinner/Spinner";import{CheckmarkFilledIcon as P}from"@redocly/theme/icons/CheckmarkFilledIcon/CheckmarkFilledIcon";import{ClipboardService as B}from"@redocly/theme/core/openapi";import{useSpecTranslate as _}from"../../hooks/useTranslate.js";import{useCopySpecSlice as O}from"../../hooks/useCopySpecSlice.js";import{ASSISTANT_LINK_BASES as T,buildInlinePromptLink as R,buildFetchSpecPromptLink as U}from"../../services/spec-slice/index.js";const N=1e3;function z(i){if(i)try{return new URL(i,document.baseURI).toString()}catch{return}}function ct({pageSlug:i}){const o=_(),n=O(i),[l,c]=A("idle"),a=x(void 0);if(b(()=>()=>clearTimeout(a.current),[]),!n)return null;const u=async()=>{if(l!=="processing"){c("processing");try{const t=await n.getText();B.copyCustom(t),c("done"),clearTimeout(a.current),a.current=setTimeout(()=>c("idle"),N)}catch(t){console.error(t),c("idle")}}},d=async t=>{const r=window.open("","_blank");try{const s=await n.getText(),g=z(n.specUrl),p=R(t,s,n.contentKind)??(g?U(t,g,n.scope):void 0);if(!p){r?.close();return}r?r.location.href=p:window.open(p,"_blank")}catch(s){r?.close(),console.error(s)}},m={buttonText:o("page.actions.copyButtonText","Copy"),title:o("page.actions.copyTitle","Copy for LLM"),description:o("page.actions.copyDescription",n.contentKind==="graphql"?"Copy page as GraphQL SDL for LLMs":"Copy page as YAML for LLMs"),iconComponent:C,onClick:u},f=e(I,{variant:"outlined",icon:E(l),onClick:u,children:m.buttonText});if(!n.specUrl)return e(y,{"data-testid":"page-actions",children:f});const S=[m,{buttonText:o("page.actions.claudeButtonText","Open in Claude"),title:o("page.actions.claudeTitle","Open in Claude"),description:o("page.actions.claudeDescription","Get insights from Claude"),iconComponent:G,onClick:()=>d(T.claude)},{buttonText:o("page.actions.chatGptButtonText","Open in ChatGPT"),title:o("page.actions.chatGptTitle","Open in ChatGPT"),description:o("page.actions.chatGptDescription","Get insights from ChatGPT"),iconComponent:D,onClick:()=>d(T.chatgpt)}].map((t,r)=>e(k,{onAction:()=>"onClick"in t?t.onClick():void 0,children:e(v,{pageAction:t})},`${t.title}-${r}`));return e(y,{"data-testid":"page-actions",children:e(L,{portalled:!0,variant:"outlined",size:"medium",toggleAriaLabel:o("page.actions.moreActions","More actions"),button:f,children:e(K,{children:S})})})}function E(i){switch(i){case"processing":return e(M,{color:"var(--page-actions-processing-icon-color)"});case"done":return e(P,{color:"var(--page-actions-done-icon-color)"});default:return e(C,{})}}const y=h.div`
2
+ margin-left: auto;
3
+ padding-left: var(--page-actions-padding-left);
4
+ --button-color: var(--page-actions-button-text-color);
5
+
6
+ .button-group-size-medium .button.button-size-medium {
7
+ --button-icon-left-padding: var(--page-actions-button-padding);
8
+ }
9
+ `,K=h(w)`
10
+ --dropdown-menu-max-height: var(--page-actions-dropdown-max-height);
11
+ `;export{ct as PageActions};
@@ -2,4 +2,15 @@ import type { ExampleEntry } from '../../types/store.js';
2
2
  export declare function useExampleEntries(exampleIds: string[] | undefined): ExampleEntry[];
3
3
  export declare function useResolvedExamples(schemaId: string | undefined, exampleIds: string[] | undefined, context?: 'request' | 'response', mediaType?: string): unknown[];
4
4
  export declare function useResponseSectionDeepLink(activeCode: string, subSection: 'body' | 'headers'): string;
5
- export declare function useKeyFromHash(itemId: string | undefined, keys: string[] | undefined, key: 'c' | 'm'): string | undefined;
5
+ export declare function useKeyFromHash(itemId: string | undefined, keys: string[] | undefined, key: 'c' | 'm' | 'ct' | 'ex'): string | undefined;
6
+ /**
7
+ * A `ct=` deep link selects the media type it targets; a later genuine user
8
+ * pick clears the override (see `activeMediaTypeAtom`'s write). Leaving the
9
+ * item clears it too, so the next page shows the reader's own preference.
10
+ */
11
+ export declare function useMediaTypeFromHash(itemId: string | undefined, mediaTypes: string[] | undefined): void;
12
+ /**
13
+ * An `ex=` deep link selects the example it names in every panel of the item (they share
14
+ * `activeExampleKey`); a later genuine pick replaces it. Keys are the spec's example map keys.
15
+ */
16
+ export declare function useExampleKeyFromHash(itemId: string | undefined, exampleIds: string[] | undefined): void;
@@ -1 +1 @@
1
- import{useContext as d,useMemo as l}from"react";import{useAtomValue as p}from"jotai";import{exampleStoreAtom as h,generatedExampleAtom as x,buildExampleAtomKey as S}from"../../jotai/examples.js";import{convertSampleToString as g}from"../../services/code-samples/index.js";import{isSequentialMediaType as A}from"../../utils/media-type.js";import{schemaStoreAtom as C}from"../../jotai/schema.js";import{buildOpenApiSectionSuffix as E,extractDeepLinkParamFromHash as L,hashIsForItem as b,hashIsInsideCallback as k,hashIsOutsideCallbacks as v,hashToElementId as I}from"../../utils/deep-link.js";import{ItemIdContext as D,useCallbackScope as P}from"../../hooks/useDeepLinkSection.js";import{useUrlHash as w}from"../../hooks/useUrlHash.js";import{routingBasePathAtom as y}from"../../jotai/store.js";import{useDeepLinkUrl as B}from"../../hooks/useDeepLinkSection.js";import{toRelativePath as F}from"../../utils/url.js";function H(e){const t=p(h);return!e||e.length===0?[]:e.map(o=>t[o]).filter(Boolean)}function N(e,t,o,n){const i=H(t),a=d(D)??"",r=n?.toLowerCase(),s=e?S(e,o,n,a):"",f=p(x(s)),u=p(C);if(i.length>0){if(r&&A(r)){const m=e?u[e]?.data:void 0;return i.map(c=>typeof c.value=="string"?c.value:g(c.value,r,m))}return i.map(m=>m.value)}return f!==void 0?[f]:[]}function Q(e,t){const o=l(()=>e?E("response",t,e):"",[e,t]);return B(o)}function W(e,t,o){const n=w(),i=p(y),a=P();return l(()=>{if(!e)return;const r=I(n),s=F(e,i).toLowerCase();if(!b(r,s)||!(a?k(r,s,a):v(r,s)))return;const u=L(n,o);if(u)return t?.find(m=>m.toLowerCase()===u)},[n,e,t,o,i,a])}export{H as useExampleEntries,W as useKeyFromHash,N as useResolvedExamples,Q as useResponseSectionDeepLink};
1
+ import{useContext as A,useEffect as l,useMemo as d,useRef as E}from"react";import{useAtomValue as u,useSetAtom as h}from"jotai";import{exampleStoreAtom as x,generatedExampleAtom as g,buildExampleAtomKey as k}from"../../jotai/examples.js";import{convertSampleToString as v}from"../../services/code-samples/index.js";import{isSequentialMediaType as F}from"../../utils/media-type.js";import{schemaStoreAtom as C}from"../../jotai/schema.js";import{mediaTypeOverrideAtom as H}from"../../jotai/app.js";import{itemStoreAtom as L}from"../../jotai/itemStore.js";import{buildOpenApiSectionSuffix as T,extractDeepLinkParamFromHash as b,hashIsForItem as I,hashIsInsideCallback as K,hashIsOutsideCallbacks as M,hashToElementId as R}from"../../utils/deep-link.js";import{ItemIdContext as U,useCallbackScope as D}from"../../hooks/useDeepLinkSection.js";import{useUrlHash as O}from"../../hooks/useUrlHash.js";import{useUrlHashReassert as S}from"../../hooks/useUrlHashReassert.js";import{routingBasePathAtom as w}from"../../jotai/store.js";import{useDeepLinkUrl as B}from"../../hooks/useDeepLinkSection.js";import{toElementId as P}from"../../utils/url.js";function z(e){const o=u(x);return!e||e.length===0?[]:e.map(t=>o[t]).filter(Boolean)}function oe(e,o,t,r){const a=z(o),n=A(U)??"",s=r?.toLowerCase(),i=e?k(e,t,r,n):"",f=u(g(i)),p=u(C);if(a.length>0){if(s&&F(s)){const m=e?p[e]?.data:void 0;return a.map(c=>typeof c.value=="string"?c.value:v(c.value,s,m))}return a.map(m=>m.value)}return f!==void 0?[f]:[]}function re(e,o){const t=d(()=>e?T("response",o,e):"",[e,o]);return B(t)}function y(e,o,t){const r=O(),a=u(w),n=D();return d(()=>{if(!e)return;const s=R(r),i=(P(e,a)??"").toLowerCase();if(!I(s,i)||!(n?K(s,i,n):M(s,i)))return;const p=b(r,t);if(p)return o?.find(m=>m.toLowerCase()===p)},[r,e,o,t,a,n])}function ne(e,o){const t=h(H),r=y(e,o,"ct"),a=S(),n=E(void 0);l(()=>{r&&(t(r),n.current=r)},[r,a,t]),l(()=>()=>{const s=n.current;s&&t(i=>i===s?void 0:i)},[t])}function se(e,o){const t=u(x),r=h(L(e??"")),a=d(()=>(o??[]).map(i=>t[i]?.key).filter(i=>!!i),[o,t]),n=y(e,a,"ex"),s=S();l(()=>{n&&r({activeExampleKey:n})},[n,s,r])}export{z as useExampleEntries,se as useExampleKeyFromHash,y as useKeyFromHash,ne as useMediaTypeFromHash,oe as useResolvedExamples,re as useResponseSectionDeepLink};
@@ -1,7 +1,7 @@
1
- import{jsx as t,jsxs as v}from"react/jsx-runtime";import{useMemo as p,memo as x}from"react";import{styled as d}from"styled-components";import{useAtom as T,useAtomValue as S}from"jotai";import{Markdown as b}from"../../common/Markdown.js";import{schemaEntryAtom as k}from"../../../jotai/schema.js";import{activeMediaTypeAtom as g}from"../../../jotai/app.js";import{SchemaView as M}from"../../Schema/SchemaView.js";import{buildOpenApiSectionSuffix as q,getDeepLinkId as A}from"../../../utils/deep-link.js";import{DeepLinkSectionContext as B,useCallbackScope as D,useDeepLinkUrl as j}from"../../../hooks/useDeepLinkSection.js";import{BodyMimeTypeField as I}from"./BodyMimeTypeField.js";function L({node:e}){const i=e.mediaTypeSchemas?Object.keys(e.mediaTypeSchemas):e.mediaTypes,[r,l]=T(g),o=r&&i?.includes(r)?r:i?.[0],s=e.mediaTypeSchemas?.[o??""]?.schemaId??e.schemaId,y=S(k(s??"")),u=i&&i.length>0,a=i&&i.length>1,n=e.variant==="body"||e.variant==="querystring-body",f=p(()=>q("request","body"),[]),c=j(f),m=D(),h=p(()=>({t:"request",cb:m,ct:a?o:void 0}),[m,a,o]);return v(C,{id:A(c),children:[u&&i&&t(I,{mediaTypes:i,value:o,onChange:l,deepLink:c,required:e.required}),e.description?t(E,{children:t(b,{source:e.description})}):null,y&&t(B.Provider,{value:h,children:t(M,{schemaId:s,expandByDefault:!0,level:1,skipReadOnly:n,skipWriteOnly:!n})})]})}const C=d.div`
1
+ import{jsx as i,jsxs as x}from"react/jsx-runtime";import{useContext as T,useMemo as p,memo as S}from"react";import{styled as d}from"styled-components";import{useAtom as b,useAtomValue as k}from"jotai";import{Markdown as g}from"../../common/Markdown.js";import{schemaEntryAtom as M}from"../../../jotai/schema.js";import{activeMediaTypeAtom as I}from"../../../jotai/app.js";import{SchemaView as q}from"../../Schema/SchemaView.js";import{buildOpenApiSectionSuffix as A,getDeepLinkId as B}from"../../../utils/deep-link.js";import{DeepLinkSectionContext as C,ItemIdContext as D,useCallbackScope as j,useDeepLinkUrl as L}from"../../../hooks/useDeepLinkSection.js";import{BodyMimeTypeField as E}from"./BodyMimeTypeField.js";import{useMediaTypeFromHash as O}from"../hooks.js";function V({node:e}){const t=e.mediaTypeSchemas?Object.keys(e.mediaTypeSchemas):e.mediaTypes,[s,y]=b(I),l=T(D);O(l??void 0,t);const o=s&&t?.includes(s)?s:t?.[0],r=e.mediaTypeSchemas?.[o??""]?.schemaId??e.schemaId,u=k(M(r??"")),f=t&&t.length>0,n=t&&t.length>1,a=e.variant==="body"||e.variant==="querystring-body",h=p(()=>A("request","body"),[]),c=L(h),m=j(),v=p(()=>({t:"request",cb:m,ct:n?o:void 0}),[m,n,o]);return x(w,{id:B(c),children:[f&&t&&i(E,{mediaTypes:t,value:o,onChange:y,deepLink:c,required:e.required}),e.description?i(z,{children:i(g,{source:e.description})}):null,u&&i(C.Provider,{value:v,children:i(q,{schemaId:r,expandByDefault:!0,level:1,skipReadOnly:a,skipWriteOnly:!a})})]})}const w=d.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
- `,E=d.div`
4
+ `,z=d.div`
5
5
  font-size: var(--font-size-base);
6
6
  line-height: var(--line-height-base);
7
7
  color: var(--text-color-description);
@@ -10,4 +10,4 @@ import{jsx as t,jsxs as v}from"react/jsx-runtime";import{useMemo as p,memo as x}
10
10
  margin-top: var(--spacing-xxs);
11
11
  margin-bottom: 0;
12
12
  }
13
- `,J=x(L);export{J as BodySection};
13
+ `,Y=S(V);export{Y as BodySection};
@@ -1,4 +1,4 @@
1
- import{Fragment as O,jsx as e,jsxs as n}from"react/jsx-runtime";import{useCallback as H,useContext as P,useEffect as j,useRef as B}from"react";import{styled as r}from"styled-components";import{useAtomValue as W,useSetAtom as q}from"jotai";import{Panel as K}from"@redocly/theme/components/Panel/Panel";import{PanelHeader as M}from"@redocly/theme/components/Panel/PanelHeader";import{PanelHeaderTitle as V}from"@redocly/theme/components/Panel/PanelHeaderTitle";import{TextBadge as F,StyledBadge as U}from"../../common/Badge.js";import{DeepLinkAnchor as T,deepLinkHoverReveal as $,DEEP_LINK_ANCHOR_ATTR as J}from"../../common/DeepLinkAnchor.js";import{ItemContentRenderer as A}from"../ItemContentRenderer.js";import{nodeTypes as D}from"../../../types/common.js";import{itemStoreAtom as Q,itemStoreFieldAtom as G}from"../../../jotai/itemStore.js";import{CallbackScopeContext as X,ItemIdContext as Y,useDeepLinkUrl as S,useHashItemId as Z}from"../../../hooks/useDeepLinkSection.js";import{useSpecTranslate as ee}from"../../../hooks/useTranslate.js";import{useUrlHash as te}from"../../../hooks/useUrlHash.js";import{buildOpenApiSectionSuffix as re,CALLBACKS_SECTION as oe,CALLBACK_REQUEST_SECTION as ae,CALLBACK_RESPONSE_SECTION as ne,getDeepLinkId as L,hashTargetsCallback as ie}from"../../../utils/deep-link.js";import{Markdown as le}from"../../common/Markdown.js";import{collectMarkdownPlainText as se}from"../../../adapters/utils/markdoc.js";function ce(o){return{delete:"del",options:"opts"}[o]||o}function de(o){return o.target instanceof Element&&o.target.closest("a")!==null}function pe({operation:o,callbackId:a,isExpanded:p,onToggle:h}){const{httpVerb:s,pathName:g,summary:f,operationId:m,description:l,deprecated:b,contentChildren:c,externalDocs:d,extensions:u}=o,v=f||m||l&&se(l).substring(0,50)||g||"<no summary>",x=re(oe,a),k=S(x),z=B(null),C=S(`${x}/${ae}`),y=S(`${x}/${ne}`),I=ee(),E=I("callbackRequest","Callback Request"),w=I("callbackResponse","Callback Response"),N=I("badges.deprecated","deprecated");return e(he,{header:({expanded:t,toggle:i})=>n(ge,{ref:z,expanded:t,toggle:R=>{de(R)||(i?.(R),h(a))},id:L(k),children:[k&&e(T,{to:k,label:`link to ${v}`}),n(me,{children:[e(fe,{type:"button","aria-expanded":t,"aria-label":v,children:e(ue,{$expanded:t,"aria-hidden":"true"})}),n(be,{children:[e(ve,{$deprecated:b,children:v}),e(xe,{color:s,children:ce(s)}),b?e(U,{$deprecated:!0,children:N}):null]})]})]}),expanded:p,className:"panel-response-callback",children:n(ke,{children:[l&&e(ye,{children:e(le,{source:l})}),d&&e(Ie,{href:d.url,target:"_blank",rel:"noopener noreferrer",children:d.description||d.url}),u&&Object.keys(u).length>0&&e(Te,{children:Object.entries(u).map(([t,i])=>n(Se,{children:[n("strong",{children:[t,":"]})," ",typeof i=="string"?i:JSON.stringify(i)]},t))}),c&&c.length>0&&n(X.Provider,{value:a,children:[n(_,{id:L(C),children:[C&&e(T,{to:C,label:`link to ${E}`}),E]}),c.filter(t=>t.nodeType===D.ITEM&&t.variant!=="responses").map((t,i)=>e(A,{node:t},i)),c.filter(t=>t.nodeType===D.ITEM&&t.variant==="responses").map((t,i)=>n("div",{children:[n(_,{id:L(y),children:[y&&e(T,{to:y,label:`link to ${w}`}),w]}),e(A,{node:t})]},`resp-${i}`))]}),e(Ce,{})]})})}function Me({node:o}){const a=o.callback,p=P(Y)??"",h=W(G({itemId:p,key:"selectedCallback"})),s=q(Q(p)),g=te(),f=Z(),m=a?.callbackId,l=ie(g,f,m)?m:void 0;j(()=>{l&&s({selectedCallback:l})},[l,s]);const b=H(c=>{s(d=>({selectedCallback:d.selectedCallback===c?"":c}))},[s]);return a?e("div",{children:e(pe,{operation:a,callbackId:a.callbackId,isExpanded:h===a.callbackId,onToggle:b},a.callbackId)}):e(O,{})}const me=r.div`
1
+ import{Fragment as O,jsx as e,jsxs as n}from"react/jsx-runtime";import{useCallback as H,useContext as P,useEffect as j,useRef as B}from"react";import{styled as r}from"styled-components";import{useAtomValue as W,useSetAtom as q}from"jotai";import{Panel as K}from"@redocly/theme/components/Panel/Panel";import{PanelHeader as M}from"@redocly/theme/components/Panel/PanelHeader";import{PanelHeaderTitle as V}from"@redocly/theme/components/Panel/PanelHeaderTitle";import{TextBadge as F,StyledBadge as U}from"../../common/Badge.js";import{DeepLinkAnchor as T,deepLinkHoverReveal as $,DEEP_LINK_ANCHOR_ATTR as J}from"../../common/DeepLinkAnchor.js";import{ItemContentRenderer as A}from"../ItemContentRenderer.js";import{nodeTypes as D}from"../../../types/common.js";import{itemStoreAtom as Q,itemStoreFieldAtom as G}from"../../../jotai/itemStore.js";import{CallbackScopeContext as X,ItemIdContext as Y,useDeepLinkUrl as S,useHashItemId as Z}from"../../../hooks/useDeepLinkSection.js";import{useSpecTranslate as ee}from"../../../hooks/useTranslate.js";import{useUrlHash as te}from"../../../hooks/useUrlHash.js";import{buildOpenApiSectionSuffix as re,CALLBACKS_SECTION as oe,CALLBACK_REQUEST_SECTION as ae,CALLBACK_RESPONSE_SECTION as ne,getDeepLinkId as L,hashTargetsCallback as ie}from"../../../utils/deep-link.js";import{Markdown as le}from"../../common/Markdown.js";import{collectMarkdownPlainText as se}from"../../../adapters/utils/markdoc.js";function ce(o){return{delete:"del",options:"opts"}[o]||o}function de(o){return o.target instanceof Element&&o.target.closest("a")!==null}function pe({operation:o,callbackId:a,isExpanded:p,onToggle:h}){const{httpVerb:s,pathName:g,summary:f,operationId:m,description:l,deprecated:b,contentChildren:c,externalDocs:d,extensions:u}=o,v=f||m||l&&se(l).substring(0,50)||g||"<no summary>",k=re(oe,a),x=S(k),z=B(null),C=S(`${k}/${ae}`),y=S(`${k}/${ne}`),I=ee(),E=I("callbackRequest","Callback Request"),w=I("callbackResponse","Callback Response"),N=I("badges.deprecated","deprecated");return e(he,{header:({expanded:t,toggle:i})=>n(ge,{ref:z,expanded:t,toggle:R=>{de(R)||(i?.(R),h(a))},id:L(x),children:[x&&e(T,{to:x,label:`link to ${v}`}),n(me,{children:[e(fe,{type:"button","aria-expanded":t,"aria-label":v,children:e(ue,{$expanded:t,"aria-hidden":"true"})}),n(be,{children:[e(ve,{$deprecated:b,children:v}),e(ke,{color:s,children:ce(s)}),b?e(U,{$deprecated:!0,children:N}):null]})]})]}),expanded:p,className:"panel-response-callback",children:n(xe,{children:[l&&e(ye,{children:e(le,{source:l})}),d&&e(Ie,{href:d.url,target:"_blank",rel:"noopener noreferrer",children:d.description||d.url}),u&&Object.keys(u).length>0&&e(Te,{children:Object.entries(u).map(([t,i])=>n(Se,{children:[n("strong",{children:[t,":"]})," ",typeof i=="string"?i:JSON.stringify(i)]},t))}),c&&c.length>0&&n(X.Provider,{value:a,children:[n(_,{id:L(C),children:[C&&e(T,{to:C,label:`link to ${E}`}),E]}),c.filter(t=>t.nodeType===D.ITEM&&t.variant!=="responses").map((t,i)=>e(A,{node:t},i)),c.filter(t=>t.nodeType===D.ITEM&&t.variant==="responses").map((t,i)=>n("div",{children:[n(_,{id:L(y),children:[y&&e(T,{to:y,label:`link to ${w}`}),w]}),e(A,{node:t})]},`resp-${i}`))]}),e(Ce,{})]})})}function Me({node:o}){const a=o.callback,p=P(Y)??"",h=W(G({itemId:p,key:"selectedCallback"})),s=q(Q(p)),g=te(),f=Z(),m=a?.callbackId,l=ie(g,f,m)?m:void 0;j(()=>{l&&s({selectedCallback:l})},[l,s]);const b=H(c=>{s(d=>({selectedCallback:d.selectedCallback===c?"":c}))},[s]);return a?e("div",{children:e(pe,{operation:a,callbackId:a.callbackId,isExpanded:h===a.callbackId,onToggle:b},a.callbackId)}):e(O,{})}const me=r.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  gap: var(--spacing-xs);
@@ -79,10 +79,10 @@ import{Fragment as O,jsx as e,jsxs as n}from"react/jsx-runtime";import{useCallba
79
79
  color: var(--panel-response-callback-heading-text-color);
80
80
  font-weight: var(--font-weight-medium);
81
81
  word-break: break-all;
82
- `,xe=r(F)`
82
+ `,ke=r(F)`
83
83
  white-space: nowrap;
84
84
  vertical-align: middle;
85
- `,ke=r.div`
85
+ `,xe=r.div`
86
86
  position: relative;
87
87
  .property:last-child {
88
88
  border-bottom: none;
@@ -110,7 +110,7 @@ import{Fragment as O,jsx as e,jsxs as n}from"react/jsx-runtime";import{useCallba
110
110
  `,Ie=r.a`
111
111
  display: inline-block;
112
112
  font-size: var(--font-size-sm);
113
- color: var(--link-text-color);
113
+ color: var(--link-color-primary);
114
114
  margin-bottom: var(--spacing-sm);
115
115
  `,Te=r.div`
116
116
  font-size: var(--font-size-sm);
@@ -1,58 +1,58 @@
1
- import{Fragment as g,jsx as n,jsxs as l}from"react/jsx-runtime";import{styled as a}from"styled-components";import{useCallback as N,useContext as W,useEffect as K,useMemo as r,useRef as z,useState as q}from"react";import{useAtomValue as G,useSetAtom as U}from"jotai";import{Segmented as Q}from"@redocly/theme/components/Segmented/Segmented";import{breakpoints as S}from"@redocly/theme/core/utils";import{collectMarkdownPlainText as X}from"../../../adapters/utils/markdoc.js";import{SECTION_ATTR as Y}from"../../../constants/openapi.js";import{SchemaView as f}from"../../Schema/SchemaView.js";import{VariantDropdown as Z}from"../../Schema/views/VariantDropdown.js";import{Markdown as ee}from"../../common/Markdown.js";import{ExternalDocumentation as ne}from"../../common/ExternalDocumentation.js";import{DeepLinkAnchor as D,deepLinkHoverReveal as C}from"../../common/DeepLinkAnchor.js";import{buildAsyncApiSuffix as b,getDeepLinkId as w}from"../../../utils/deep-link.js";import{DeepLinkSectionContext as E,ItemIdContext as te,useDeepLinkUrl as M}from"../../../hooks/useDeepLinkSection.js";import{isRecord as $}from"../../../adapters/helpers.js";import{itemStoreAtom as oe,itemStoreFieldAtom as ae}from"../../../jotai/itemStore.js";import{useSpecTranslate as re}from"../../../hooks/useTranslate.js";import{useTelemetry as ie}from"../../../hooks/useTelemetry.js";import{useKeyFromHash as se}from"../hooks.js";const ce=3;function je({node:e}){const o=e.messages;return!o||o.length===0?n(g,{}):n(le,{messages:o})}function le({messages:e}){const o=W(te),d=U(oe(o??"")),h=G(r(()=>ae({itemId:o??"",key:"activeMessageKey"}),[o])),y=r(()=>e.map(t=>t.name),[e]),i=se(o??void 0,y,"m"),m=z(void 0),s=i!==void 0&&i!==m.current?i:h||e[0].name,c=r(()=>e.find(t=>t.name===s)??e[0],[e,s]);K(()=>{i&&d({activeMessageKey:i}),m.current=i},[i,d]);const u=ie(),v=r(()=>e.map(t=>({value:t.name,label:t.label||t.name})),[e]),I=z(null),[P,R]=q(!1);K(()=>{const t=()=>{const A=I.current;if(!A)return;const O=A.querySelectorAll('[role="tab"]'),V=Array.from(O).some(J=>{const T=J;return T.offsetWidth<T.scrollWidth});R(V)};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[v]);const _=e.length>ce||e.length>1&&P,k=N(t=>{u.sendSwitchMessageClickedMessage([{id:"switchMessageButton",object:"button",uri:"urn:redocly:redoc:ui:button:switchMessageButton",message:t}]),d({activeMessageKey:t})},[u,d]),j=r(()=>c?.name?b({section:"messages",messageKey:c.name}):"",[c?.name]),x=M(j),L=r(()=>o?`${o}/messages`:void 0,[o]),H=L?{[Y]:L}:{};return l("div",{...H,children:[n(me,{children:e.length>1?l(g,{children:["Accepts ",n(pe,{children:"one of"})," the following messages:"]}):n(g,{children:"Accepts the following message:"})}),l(ue,{id:w(x),children:[x&&n(fe,{children:n(D,{to:x,label:"link to Message selector"})}),_?n(Z,{value:s,options:v,onChange:t=>{t.value!==void 0&&k(t.value)}}):n(Q,{ref:I,size:"small",value:s,options:v,onChange:t=>{t.value!==void 0&&k(t.value)}})]}),c&&n(de,{message:c})]})}function de({message:e}){const o=re(),d=o("header","Headers"),h=r(()=>e.name?{asyncSection:"messages",messageKey:e.name,t:"headers"}:null,[e.name]),y=r(()=>e.name?{asyncSection:"messages",messageKey:e.name,t:"payload"}:null,[e.name]),i=r(()=>e.name?b({section:"messages",messageKey:e.name,subsection:"headers"}):"",[e.name]),m=r(()=>e.name?b({section:"messages",messageKey:e.name,subsection:"payload"}):"",[e.name]),p=M(i),s=M(m),c=e.payloadLabel??o("payload","Payload"),u=e.externalDocs?.description!=null?X(e.externalDocs.description):void 0;return l(he,{children:[e.summary&&n(ye,{children:e.summary}),e.description&&n(ve,{children:n(ee,{source:e.description})}),e.externalDocs?.url&&n(xe,{children:n(ne,{externalDocs:{url:e.externalDocs.url,description:u||void 0},compact:!0})}),(e.headerSchemaId||$(e.headers))&&l(B,{id:w(p),children:[l(F,{children:[p&&n(D,{to:p,label:`link to ${d}`}),d]}),n(E.Provider,{value:h,children:e.headerSchemaId?n(f,{schemaId:e.headerSchemaId,expandByDefault:!0}):n(f,{schema:e.headers,expandByDefault:!0})})]}),(e.schemaId||$(e.payload))&&l(B,{id:w(s),children:[l(F,{children:[s&&n(D,{to:s,label:`link to ${c}`}),c,e.contentType&&n(ge,{children:e.contentType})]}),n(E.Provider,{value:y,children:e.schemaId?n(f,{schemaId:e.schemaId,expandByDefault:!0}):n(f,{schema:e.payload,expandByDefault:!0})})]})]})}const me=a.p`
1
+ import{Fragment as S,jsx as n,jsxs as s}from"react/jsx-runtime";import{styled as r}from"styled-components";import{useCallback as W,useContext as q,useEffect as E,useMemo as a,useRef as D,useState as G}from"react";import{useAtomValue as Q,useSetAtom as X}from"jotai";import{Segmented as Y}from"@redocly/theme/components/Segmented/Segmented";import{breakpoints as b}from"@redocly/theme/core/openapi";import{collectMarkdownPlainText as Z}from"../../../adapters/utils/markdoc.js";import{SECTION_ATTR as ee}from"../../../constants/openapi.js";import{SchemaView as f}from"../../Schema/SchemaView.js";import{VariantDropdown as ne}from"../../Schema/views/VariantDropdown.js";import{Markdown as te}from"../../common/Markdown.js";import{ExternalDocumentation as oe}from"../../common/ExternalDocumentation.js";import{DeepLinkAnchor as w,deepLinkHoverReveal as R}from"../../common/DeepLinkAnchor.js";import{buildAsyncApiSuffix as M,getDeepLinkId as I}from"../../../utils/deep-link.js";import{DeepLinkSectionContext as $,ItemIdContext as re,useDeepLinkUrl as k}from"../../../hooks/useDeepLinkSection.js";import{isRecord as B}from"../../../adapters/helpers.js";import{itemStoreAtom as ae,itemStoreFieldAtom as ie}from"../../../jotai/itemStore.js";import{useSpecTranslate as se}from"../../../hooks/useTranslate.js";import{useTelemetry as ce}from"../../../hooks/useTelemetry.js";import{useKeyFromHash as le}from"../hooks.js";import{useUrlHashReassert as de}from"../../../hooks/useUrlHashReassert.js";const me=3;function Je({node:e}){const o=e.messages;return!o||o.length===0?n(S,{}):n(pe,{messages:o})}function pe({messages:e}){const o=q(re),c=X(ae(o??"")),h=Q(a(()=>ie({itemId:o??"",key:"activeMessageKey"}),[o])),v=a(()=>e.map(t=>t.name),[e]),i=le(o??void 0,v,"m"),l=de(),d=D(void 0),m=D(l),p=i!==void 0&&(i!==d.current||l!==m.current)?i:h||e[0].name,u=a(()=>e.find(t=>t.name===p)??e[0],[e,p]);E(()=>{i&&c({activeMessageKey:i}),d.current=i,m.current=l},[i,l,c]);const L=ce(),x=a(()=>e.map(t=>({value:t.name,label:t.label||t.name})),[e]),A=D(null),[P,_]=G(!1);E(()=>{const t=()=>{const z=A.current;if(!z)return;const J=z.querySelectorAll('[role="tab"]'),N=Array.from(J).some(U=>{const C=U;return C.offsetWidth<C.scrollWidth});_(N)};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[x]);const j=e.length>me||e.length>1&&P,T=W(t=>{L.sendSwitchMessageClickedMessage([{id:"switchMessageButton",object:"button",uri:"urn:redocly:redoc:ui:button:switchMessageButton",message:t}]),c({activeMessageKey:t})},[L,c]),O=a(()=>u?.name?M({section:"messages",messageKey:u.name}):"",[u?.name]),g=k(O),K=a(()=>o?`${o}/messages`:void 0,[o]),V=K?{[ee]:K}:{};return s("div",{...V,children:[n(fe,{children:e.length>1?s(S,{children:["Accepts ",n(he,{children:"one of"})," the following messages:"]}):n(S,{children:"Accepts the following message:"})}),s(ve,{id:I(g),children:[g&&n(ye,{children:n(w,{to:g,label:"link to Message selector"})}),j?n(ne,{value:p,options:x,onChange:t=>{t.value!==void 0&&T(t.value)}}):n(Y,{ref:A,size:"small",value:p,options:x,onChange:t=>{t.value!==void 0&&T(t.value)}})]}),u&&n(ue,{message:u})]})}function ue({message:e}){const o=se(),c=o("header","Headers"),h=a(()=>e.name?{asyncSection:"messages",messageKey:e.name,t:"headers"}:null,[e.name]),v=a(()=>e.name?{asyncSection:"messages",messageKey:e.name,t:"payload"}:null,[e.name]),i=a(()=>e.name?M({section:"messages",messageKey:e.name,subsection:"headers"}):"",[e.name]),l=a(()=>e.name?M({section:"messages",messageKey:e.name,subsection:"payload"}):"",[e.name]),d=k(i),m=k(l),y=e.payloadLabel??o("payload","Payload"),p=e.externalDocs?.description!=null?Z(e.externalDocs.description):void 0;return s(xe,{children:[e.summary&&n(ge,{children:e.summary}),e.description&&n(Se,{children:n(te,{source:e.description})}),e.externalDocs?.url&&n(De,{children:n(oe,{externalDocs:{url:e.externalDocs.url,description:p||void 0},compact:!0})}),(e.headerSchemaId||B(e.headers))&&s(F,{id:I(d),children:[s(H,{children:[d&&n(w,{to:d,label:`link to ${c}`}),c]}),n($.Provider,{value:h,children:e.headerSchemaId?n(f,{schemaId:e.headerSchemaId,expandByDefault:!0}):n(f,{schema:e.headers,expandByDefault:!0})})]}),(e.schemaId||B(e.payload))&&s(F,{id:I(m),children:[s(H,{children:[m&&n(w,{to:m,label:`link to ${y}`}),y,e.contentType&&n(be,{children:e.contentType})]}),n($.Provider,{value:v,children:e.schemaId?n(f,{schemaId:e.schemaId,expandByDefault:!0}):n(f,{schema:e.payload,expandByDefault:!0})})]})]})}const fe=r.p`
2
2
  margin: 0 0 var(--spacing-sm, 12px);
3
3
  color: var(--text-color-secondary, #666);
4
4
  font-size: var(--font-size-base, 14px);
5
5
 
6
- @media screen and (max-width: ${S.small}) {
6
+ @media screen and (max-width: ${b.small}) {
7
7
  margin-top: var(--spacing-xs);
8
8
  }
9
- `,pe=a.span`
9
+ `,he=r.span`
10
10
  font-weight: var(--font-weight-bold, 700);
11
- `,ue=a.div`
11
+ `,ve=r.div`
12
12
  position: relative;
13
13
  display: flex;
14
14
  align-items: center;
15
15
  margin-bottom: var(--spacing-xs);
16
- ${C}
16
+ ${R}
17
17
 
18
- @media screen and (max-width: ${S.small}) {
18
+ @media screen and (max-width: ${b.small}) {
19
19
  margin-top: var(--spacing-xl);
20
20
  }
21
- `,fe=a.span`
21
+ `,ye=r.span`
22
22
  position: relative;
23
23
  display: inline-flex;
24
24
  align-items: center;
25
- `,he=a.div`
25
+ `,xe=r.div`
26
26
  padding: var(--spacing-xs, 8px) 0;
27
- `,ye=a.div`
27
+ `,ge=r.div`
28
28
  font-size: var(--font-size-base, 14px);
29
29
  color: var(--text-color-secondary, #666);
30
- `,ve=a.div`
30
+ `,Se=r.div`
31
31
  margin-top: var(--spacing-xxs, 4px);
32
32
  font-size: var(--font-size-base, 14px);
33
33
  color: var(--text-color-secondary, #666);
34
- `,xe=a.div`
34
+ `,De=r.div`
35
35
  display: flex;
36
36
  flex-direction: column;
37
37
  gap: var(--spacing-xxs);
38
- `,B=a.div`
38
+ `,F=r.div`
39
39
  margin-top: var(--spacing-lg);
40
- `,F=a.h4`
40
+ `,H=r.h4`
41
41
  font-size: var(--font-size-md, 16px);
42
42
  font-weight: var(--font-weight-bold, 700);
43
43
  color: var(--text-color-primary, #333);
44
44
  margin: 0;
45
45
 
46
- @media screen and (max-width: ${S.small}) {
46
+ @media screen and (max-width: ${b.small}) {
47
47
  margin-top: var(--spacing-xl);
48
48
  margin-bottom: var(--spacing-xs);
49
49
  }
50
- ${C}
51
- `,ge=a.span`
50
+ ${R}
51
+ `,be=r.span`
52
52
  margin: 0px var(--spacing-xs);
53
53
  color: var(--text-color-primary);
54
54
  line-height: var(--line-height-lg);
55
55
  font-family: var(--font-family-base);
56
56
  font-weight: var(--font-weight-regular);
57
57
  font-size: var(--font-size-lg);
58
- `;export{je as MessagesSection};
58
+ `;export{Je as MessagesSection};
@@ -1,28 +1,28 @@
1
- import{Fragment as z,jsx as e,jsxs as a}from"react/jsx-runtime";import{useContext as W,useEffect as _,useMemo as C}from"react";import{styled as s}from"styled-components";import{useAtom as O,useAtomValue as V,useSetAtom as $}from"jotai";import{SchemaView as f}from"../../Schema/SchemaView.js";import{Markdown as T}from"../../common/Markdown.js";import{DeepLinkAnchor as E,deepLinkHoverReveal as K}from"../../common/DeepLinkAnchor.js";import{getDeepLinkId as D}from"../../../utils/deep-link.js";import{BodyMimeTypeField as P}from"./BodyMimeTypeField.js";import{activeMediaTypeAtom as U}from"../../../jotai/app.js";import{itemStoreAtom as q,itemStoreFieldAtom as G}from"../../../jotai/itemStore.js";import{DeepLinkSectionContext as J,ItemIdContext as N,useCallbackScope as Q}from"../../../hooks/useDeepLinkSection.js";import{useSpecTranslate as X}from"../../../hooks/useTranslate.js";import{isRecord as Y}from"../../../adapters/helpers.js";import{useKeyFromHash as Z,useResponseSectionDeepLink as L}from"../hooks.js";function ke({node:A}){const o=A.responses,u=X(),c=W(N),M=V(G({itemId:c??"",key:"activeResponseCode"})),v=$(q(c??"")),B=C(()=>o?.map(h=>h.code),[o]),i=Z(c??void 0,B,"c"),n=M||i||o?.[0]?.code||"";_(()=>{i&&v({activeResponseCode:i})},[i,v]);const y=L(n,"body"),d=L(n,"headers"),{mediaTypes:F,mediaType:g,mediaTypeContent:p,schemaId:H,summary:x,description:k,headers:I,headerSchemaId:m}=o?.find(h=>h.code===n)??o?.[0]??{},t=p?Object.keys(p):F??(g?[g]:[]),[l,j]=O(U),r=l&&t.includes(l)?l:t[0],S=p?.[r]?.schemaId??H,b=Q(),w=C(()=>({t:"response",c:n,cb:b,ct:t.length>1?r:void 0}),[n,b,t.length,r]);return!o||o.length===0?e(z,{}):e(ee,{children:a(oe,{children:[x&&e(R,{children:e(T,{source:x})}),k&&e(R,{children:e(T,{source:k})}),a(J.Provider,{value:w,children:[(m||Y(I))&&a(ne,{children:[a(te,{id:D(d),children:[d&&e(E,{to:d,label:`link to ${u("header","Headers")}`}),e(se,{children:u("header","Headers")})]}),m?e(f,{schemaId:m,expandByDefault:!0,level:1}):e(f,{schema:I,expandByDefault:!0,level:1})]}),t.length>0&&e(P,{headingId:D(y),mediaTypes:t,value:r,onChange:j,deepLink:y}),S&&e(f,{schemaId:S,expandByDefault:!0,level:1,skipWriteOnly:!0})]})]})})}const ee=s.div`
1
+ import{Fragment as W,jsx as e,jsxs as d}from"react/jsx-runtime";import{useContext as _,useEffect as O,useMemo as b}from"react";import{styled as s}from"styled-components";import{useAtom as U,useAtomValue as V,useSetAtom as $}from"jotai";import{SchemaView as f}from"../../Schema/SchemaView.js";import{Markdown as C}from"../../common/Markdown.js";import{DeepLinkAnchor as E,deepLinkHoverReveal as K}from"../../common/DeepLinkAnchor.js";import{getDeepLinkId as D}from"../../../utils/deep-link.js";import{BodyMimeTypeField as P}from"./BodyMimeTypeField.js";import{activeMediaTypeAtom as q}from"../../../jotai/app.js";import{itemStoreAtom as G,itemStoreFieldAtom as J}from"../../../jotai/itemStore.js";import{DeepLinkSectionContext as N,ItemIdContext as Q,useCallbackScope as X}from"../../../hooks/useDeepLinkSection.js";import{useSpecTranslate as Y}from"../../../hooks/useTranslate.js";import{isRecord as Z}from"../../../adapters/helpers.js";import{useKeyFromHash as ee,useMediaTypeFromHash as oe,useResponseSectionDeepLink as R}from"../hooks.js";import{useUrlHashReassert as te}from"../../../hooks/useUrlHashReassert.js";function be({node:M}){const o=M.responses,u=Y(),i=_(Q),A=V(J({itemId:i??"",key:"activeResponseCode"})),v=$(G(i??"")),H=b(()=>o?.map(h=>h.code),[o]),r=ee(i??void 0,H,"c"),F=te(),n=A||r||o?.[0]?.code||"";O(()=>{r&&v({activeResponseCode:r})},[r,v,F]);const y=R(n,"body"),c=R(n,"headers"),{mediaTypes:B,mediaType:g,mediaTypeContent:p,schemaId:j,summary:x,description:k,headers:I,headerSchemaId:m}=o?.find(h=>h.code===n)??o?.[0]??{},t=p?Object.keys(p):B??(g?[g]:[]),[l,w]=U(q);oe(i??void 0,t);const a=l&&t.includes(l)?l:t[0],S=p?.[a]?.schemaId??j,T=X(),z=b(()=>({t:"response",c:n,cb:T,ct:t.length>1?a:void 0}),[n,T,t.length,a]);return!o||o.length===0?e(W,{}):e(se,{children:d(ne,{children:[x&&e(L,{children:e(C,{source:x})}),k&&e(L,{children:e(C,{source:k})}),d(N.Provider,{value:z,children:[(m||Z(I))&&d(ae,{children:[d(ie,{id:D(c),children:[c&&e(E,{to:c,label:`link to ${u("header","Headers")}`}),e(re,{children:u("header","Headers")})]}),m?e(f,{schemaId:m,expandByDefault:!0,level:1}):e(f,{schema:I,expandByDefault:!0,level:1})]}),t.length>0&&e(P,{headingId:D(y),mediaTypes:t,value:a,onChange:w,deepLink:y}),S&&e(f,{schemaId:S,expandByDefault:!0,level:1,skipWriteOnly:!0})]})]})})}const se=s.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: var(--spacing-xs);
5
- `,oe=s.div`
5
+ `,ne=s.div`
6
6
  display: flex;
7
7
  flex-direction: column;
8
- `,R=s.div`
8
+ `,L=s.div`
9
9
  font-size: var(--font-size-base);
10
10
  line-height: var(--line-height-base);
11
11
  color: var(--text-color-description);
12
- `,te=s.span`
12
+ `,ie=s.span`
13
13
  position: relative;
14
14
  display: flex;
15
15
  align-items: center;
16
16
  margin-top: var(--spacing-md);
17
17
  padding: var(--spacing-xxs) 0;
18
18
  ${K}
19
- `,se=s.span`
19
+ `,re=s.span`
20
20
  font-weight: var(--font-weight-semibold);
21
21
  font-size: 18px;
22
22
  line-height: var(--line-height-lg);
23
23
  color: var(--text-color-primary);
24
- `,ne=s.div`
24
+ `,ae=s.div`
25
25
  &:not(:last-child) {
26
26
  margin-bottom: var(--spacing-lg);
27
27
  }
28
- `;export{ke as ResponsesSection};
28
+ `;export{be as ResponsesSection};