@redocly/theme 0.69.0-next.9 → 0.70.0-next.0

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 (226) hide show
  1. package/lib/components/Buttons/DownloadButton.js +13 -3
  2. package/lib/components/Catalog/Catalog.d.ts +2 -2
  3. package/lib/components/Catalog/CatalogActionsRow.d.ts +3 -2
  4. package/lib/components/Catalog/CatalogCardView/CatalogCard.d.ts +2 -2
  5. package/lib/components/Catalog/CatalogEntities.d.ts +2 -2
  6. package/lib/components/Catalog/CatalogEntities.js +1 -0
  7. package/lib/components/Catalog/CatalogEntitiesEmptyState.d.ts +1 -1
  8. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.d.ts +2 -2
  9. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js +1 -2
  10. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.d.ts +3 -1
  11. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.js +45 -23
  12. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +67 -33
  13. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.d.ts +3 -1
  14. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.js +15 -3
  15. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.d.ts +3 -1
  16. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.js +48 -57
  17. package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.d.ts +1 -1
  18. package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.d.ts +1 -1
  19. package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.d.ts +1 -1
  20. package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.d.ts +1 -1
  21. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.d.ts +2 -2
  22. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.d.ts +1 -1
  23. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.d.ts +2 -2
  24. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.d.ts +2 -2
  25. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.d.ts +2 -2
  26. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.d.ts +2 -2
  27. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.d.ts +2 -2
  28. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.d.ts +2 -2
  29. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.js +1 -2
  30. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.d.ts +2 -2
  31. package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.d.ts +2 -2
  32. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.d.ts +1 -1
  33. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.d.ts +2 -3
  34. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.d.ts +1 -1
  35. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts +3 -4
  36. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.d.ts +3 -4
  37. package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.d.ts +1 -1
  38. package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +1 -2
  39. package/lib/components/Catalog/CatalogEntityIcon.d.ts +1 -1
  40. package/lib/components/Catalog/CatalogEntityTypeTag.d.ts +2 -2
  41. package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.d.ts +1 -1
  42. package/lib/components/Catalog/CatalogFilter/CatalogFilterContent.js +1 -2
  43. package/lib/components/Catalog/CatalogHighlight.d.ts +2 -1
  44. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.d.ts +2 -1
  45. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelHeader.d.ts +1 -1
  46. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.d.ts +2 -1
  47. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.d.ts +2 -2
  48. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.d.ts +2 -2
  49. package/lib/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarFiltersButton.d.ts +1 -1
  50. package/lib/components/Catalog/CatalogSelector.d.ts +3 -2
  51. package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.d.ts +1 -1
  52. package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.d.ts +1 -1
  53. package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +2 -1
  54. package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.d.ts +2 -1
  55. package/lib/components/Catalog/CatalogTableView/CatalogTagsCell.d.ts +1 -1
  56. package/lib/components/Catalog/CatalogTags.d.ts +2 -2
  57. package/lib/components/Catalog/CatalogViewModeToggle.d.ts +1 -1
  58. package/lib/components/Catalog/variables.js +24 -33
  59. package/lib/components/CatalogClassic/CatalogClassicInfoBlock.d.ts +1 -1
  60. package/lib/components/CatalogClassic/CatalogClassicInfoBlock.js +1 -2
  61. package/lib/components/CatalogClassic/CatalogClassicVirtualizedGroups.d.ts +1 -1
  62. package/lib/components/CodeBlock/CodeBlockControls.d.ts +1 -1
  63. package/lib/components/Dropdown/Dropdown.js +7 -1
  64. package/lib/components/Filter/FilterOptionLabel.d.ts +1 -1
  65. package/lib/components/LoadMore/LoadMore.d.ts +1 -1
  66. package/lib/components/MCP/McpConnectionTabs.js +22 -12
  67. package/lib/components/Markdown/Markdown.js +1 -3
  68. package/lib/components/Markdown/styles/base-table.js +8 -0
  69. package/lib/components/Markdown/variables.js +1 -2
  70. package/lib/components/PageActions/PageActions.d.ts +1 -1
  71. package/lib/components/Search/SearchAiDialog.d.ts +1 -1
  72. package/lib/components/Search/SearchAiDialog.js +3 -0
  73. package/lib/components/Search/SearchAiMessage.d.ts +1 -2
  74. package/lib/components/Search/SearchAiMessage.js +8 -10
  75. package/lib/components/Search/SearchAiResponse.d.ts +1 -1
  76. package/lib/components/Search/SearchGroups.d.ts +1 -1
  77. package/lib/core/constants/markdown.d.ts +2 -0
  78. package/lib/core/constants/markdown.js +3 -1
  79. package/lib/core/contexts/AccordionGroupContext.d.ts +1 -0
  80. package/lib/core/contexts/AccordionGroupContext.js +6 -0
  81. package/lib/core/contexts/PageActionsContext.d.ts +5 -0
  82. package/lib/core/contexts/PageActionsContext.js +10 -0
  83. package/lib/core/contexts/index.d.ts +2 -0
  84. package/lib/core/contexts/index.js +2 -0
  85. package/lib/core/hooks/catalog/use-catalog-entity-schema.d.ts +1 -1
  86. package/lib/core/hooks/catalog/use-catalog-table-header-cell-actions.d.ts +1 -1
  87. package/lib/core/hooks/catalog/use-graph.d.ts +3 -3
  88. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.js +1 -0
  89. package/lib/core/hooks/use-active-heading.js +4 -0
  90. package/lib/core/hooks/use-active-section-id.js +6 -0
  91. package/lib/core/hooks/use-connect-mcp-button.js +7 -2
  92. package/lib/core/hooks/use-element-size.d.ts +1 -1
  93. package/lib/core/hooks/use-product-picker.js +1 -1
  94. package/lib/core/hooks/use-tabs.js +4 -2
  95. package/lib/core/hooks/use-telemetry-fallback.d.ts +2 -0
  96. package/lib/core/hooks/use-telemetry-fallback.js +2 -0
  97. package/lib/core/styles/global.js +1 -0
  98. package/lib/core/types/catalog.d.ts +2 -3
  99. package/lib/core/types/common.d.ts +1 -1
  100. package/lib/core/types/hooks.d.ts +4 -7
  101. package/lib/core/utils/class-names.d.ts +1 -0
  102. package/lib/core/utils/class-names.js +7 -0
  103. package/lib/core/utils/mcp.d.ts +0 -1
  104. package/lib/core/utils/mcp.js +0 -13
  105. package/lib/core/utils/menu.d.ts +2 -2
  106. package/lib/core/utils/urls.js +1 -3
  107. package/lib/ext/use-configure-replay.d.ts +1 -1
  108. package/lib/layouts/OIDCForbidden.js +1 -1
  109. package/lib/markdoc/components/Accordion/Accordion.js +6 -6
  110. package/lib/markdoc/components/Accordion/AccordionGroup.d.ts +2 -1
  111. package/lib/markdoc/components/Accordion/AccordionGroup.js +39 -3
  112. package/lib/markdoc/components/CodeWalkthrough/CodePanelPreview.d.ts +1 -2
  113. package/lib/markdoc/components/Diagram/Diagram.d.ts +1 -1
  114. package/lib/markdoc/components/Diagram/Diagram.js +1 -2
  115. package/lib/markdoc/components/Heading/Heading.js +5 -2
  116. package/lib/markdoc/components/Tabs/Tab.d.ts +1 -1
  117. package/lib/markdoc/components/Tabs/TabList.d.ts +1 -1
  118. package/lib/markdoc/tags/accordion-group.js +3 -0
  119. package/lib/markdoc/tags/code-walkthrough.d.ts +1 -1
  120. package/lib/markdoc/tags/markdoc-example.js +34 -22
  121. package/package.json +2 -2
  122. package/src/components/Buttons/DownloadButton.tsx +16 -8
  123. package/src/components/Catalog/Catalog.tsx +4 -4
  124. package/src/components/Catalog/CatalogActionsRow.tsx +3 -2
  125. package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +3 -2
  126. package/src/components/Catalog/CatalogEntities.tsx +4 -2
  127. package/src/components/Catalog/CatalogEntitiesEmptyState.tsx +2 -1
  128. package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +6 -2
  129. package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.tsx +4 -5
  130. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistoryButton.tsx +56 -35
  131. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +80 -42
  132. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityRevisionItem.tsx +18 -2
  133. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityVersionItem.tsx +61 -75
  134. package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +2 -1
  135. package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +1 -1
  136. package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +1 -1
  137. package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +1 -1
  138. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +3 -2
  139. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +2 -1
  140. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.tsx +3 -2
  141. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +3 -2
  142. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.tsx +3 -2
  143. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.tsx +3 -2
  144. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.tsx +3 -2
  145. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.tsx +3 -4
  146. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +3 -2
  147. package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.tsx +3 -2
  148. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +2 -1
  149. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +7 -4
  150. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +2 -1
  151. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +7 -4
  152. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTableContent.tsx +3 -4
  153. package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +3 -2
  154. package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +1 -2
  155. package/src/components/Catalog/CatalogEntityIcon.tsx +3 -2
  156. package/src/components/Catalog/CatalogEntityTypeTag.tsx +3 -2
  157. package/src/components/Catalog/CatalogFilter/CatalogFilterContent.tsx +2 -4
  158. package/src/components/Catalog/CatalogHighlight.tsx +2 -1
  159. package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.tsx +2 -1
  160. package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelHeader.tsx +2 -1
  161. package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.tsx +2 -1
  162. package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBar.tsx +3 -2
  163. package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarControls.tsx +3 -2
  164. package/src/components/Catalog/CatalogMobileTopBar/CatalogMobileTopBarFiltersButton.tsx +2 -1
  165. package/src/components/Catalog/CatalogSelector.tsx +3 -2
  166. package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +1 -1
  167. package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +1 -1
  168. package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +2 -1
  169. package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +2 -1
  170. package/src/components/Catalog/CatalogTableView/CatalogTagsCell.tsx +1 -1
  171. package/src/components/Catalog/CatalogTags.tsx +4 -2
  172. package/src/components/Catalog/CatalogViewModeToggle.tsx +1 -1
  173. package/src/components/Catalog/variables.ts +24 -33
  174. package/src/components/CatalogClassic/CatalogClassicInfoBlock.tsx +2 -5
  175. package/src/components/CatalogClassic/CatalogClassicVirtualizedGroups.tsx +1 -1
  176. package/src/components/CodeBlock/CodeBlockControls.tsx +2 -1
  177. package/src/components/Dropdown/Dropdown.tsx +5 -1
  178. package/src/components/Filter/FilterOptionLabel.tsx +1 -1
  179. package/src/components/LoadMore/LoadMore.tsx +2 -1
  180. package/src/components/MCP/McpConnectionTabs.tsx +35 -14
  181. package/src/components/Markdown/Markdown.tsx +1 -3
  182. package/src/components/Markdown/styles/base-table.ts +8 -0
  183. package/src/components/Markdown/variables.ts +1 -2
  184. package/src/components/PageActions/PageActions.tsx +2 -1
  185. package/src/components/Search/SearchAiDialog.tsx +4 -1
  186. package/src/components/Search/SearchAiMessage.tsx +3 -6
  187. package/src/components/Search/SearchAiResponse.tsx +2 -4
  188. package/src/components/Search/SearchGroups.tsx +1 -5
  189. package/src/core/constants/markdown.ts +4 -0
  190. package/src/core/contexts/AccordionGroupContext.tsx +3 -0
  191. package/src/core/contexts/PageActionsContext.tsx +7 -0
  192. package/src/core/contexts/index.ts +2 -0
  193. package/src/core/hooks/__mocks__/use-theme-hooks.ts +2 -0
  194. package/src/core/hooks/catalog/use-catalog-entity-schema.ts +1 -1
  195. package/src/core/hooks/catalog/use-catalog-table-header-cell-actions.ts +1 -1
  196. package/src/core/hooks/catalog/use-graph.ts +4 -4
  197. package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +1 -0
  198. package/src/core/hooks/menu/__mocks__/use-mobile-menu-items.ts +1 -1
  199. package/src/core/hooks/use-active-heading.ts +4 -0
  200. package/src/core/hooks/use-active-section-id.ts +8 -0
  201. package/src/core/hooks/use-connect-mcp-button.ts +8 -2
  202. package/src/core/hooks/use-element-size.ts +2 -1
  203. package/src/core/hooks/use-product-picker.ts +2 -2
  204. package/src/core/hooks/use-tabs.ts +4 -2
  205. package/src/core/hooks/use-telemetry-fallback.ts +2 -0
  206. package/src/core/styles/global.ts +1 -0
  207. package/src/core/types/catalog.ts +7 -3
  208. package/src/core/types/common.ts +1 -1
  209. package/src/core/types/hooks.ts +15 -13
  210. package/src/core/utils/class-names.ts +8 -0
  211. package/src/core/utils/mcp.ts +0 -17
  212. package/src/core/utils/menu.ts +2 -2
  213. package/src/core/utils/urls.ts +1 -3
  214. package/src/ext/use-configure-replay.ts +3 -3
  215. package/src/layouts/OIDCForbidden.tsx +1 -1
  216. package/src/markdoc/components/Accordion/Accordion.tsx +8 -2
  217. package/src/markdoc/components/Accordion/AccordionGroup.tsx +9 -2
  218. package/src/markdoc/components/CodeWalkthrough/CodePanelPreview.tsx +2 -2
  219. package/src/markdoc/components/CodeWalkthrough/CodeWalkthrough.tsx +2 -4
  220. package/src/markdoc/components/Diagram/Diagram.tsx +2 -5
  221. package/src/markdoc/components/Heading/Heading.tsx +7 -4
  222. package/src/markdoc/components/Tabs/Tab.tsx +1 -1
  223. package/src/markdoc/components/Tabs/TabList.tsx +1 -1
  224. package/src/markdoc/tags/accordion-group.ts +3 -0
  225. package/src/markdoc/tags/code-walkthrough.ts +2 -1
  226. package/src/markdoc/tags/markdoc-example.ts +45 -28
@@ -11,15 +11,20 @@ const use_mcp_config_1 = require("./use-mcp-config");
11
11
  const clipboard_service_1 = require("../utils/clipboard-service");
12
12
  const mcp_1 = require("../constants/mcp");
13
13
  const mcp_2 = require("../utils/mcp");
14
+ const get_base_data_attributes_1 = require("../utils/telemetry/get-base-data-attributes");
14
15
  const COPIED_RESET_TIMEOUT = 1000;
15
16
  function useConnectMCPButton({ options = mcp_1.DEFAULT_MCP_OPTIONS, } = {}) {
16
- const { useTranslate } = (0, use_theme_hooks_1.useThemeHooks)();
17
+ const { useTranslate, useTelemetry } = (0, use_theme_hooks_1.useThemeHooks)();
17
18
  const { translate } = useTranslate();
19
+ const telemetry = useTelemetry();
18
20
  const { serverName, serverUrl, cursorUrl, vscodeUrl } = (0, use_mcp_config_1.useMCPConfig)();
19
21
  const [copiedOption, setCopiedOption] = (0, react_1.useState)(null);
20
22
  // eslint-disable-next-line react-hooks/exhaustive-deps
21
23
  const resetCopied = (0, react_1.useCallback)((0, lodash_debounce_1.default)(() => setCopiedOption(null), COPIED_RESET_TIMEOUT), []);
22
24
  const handleAction = (0, react_1.useCallback)((action) => {
25
+ telemetry.sendConnectMcpClickedMessage([
26
+ Object.assign(Object.assign({}, (0, get_base_data_attributes_1.getBaseDataAttributes)('connectMcp', 'button')), { option: action }),
27
+ ]);
23
28
  const connection = { serverName, url: serverUrl };
24
29
  const copyTextMap = {
25
30
  copy: JSON.stringify({ [serverName]: { url: serverUrl, description: 'MCP Server' } }, null, 2),
@@ -38,7 +43,7 @@ function useConnectMCPButton({ options = mcp_1.DEFAULT_MCP_OPTIONS, } = {}) {
38
43
  vscode: vscodeUrl,
39
44
  };
40
45
  window.open(urlMap[action], '_blank');
41
- }, [cursorUrl, vscodeUrl, serverUrl, serverName, resetCopied]);
46
+ }, [cursorUrl, vscodeUrl, serverUrl, serverName, resetCopied, telemetry]);
42
47
  const triggerButtonText = (0, react_1.useMemo)(() => translate('page.actions.connectMcp', 'Connect MCP'), [translate]);
43
48
  const visibleOptions = (0, react_1.useMemo)(() => options.filter(Boolean), [options]);
44
49
  return {
@@ -1,4 +1,4 @@
1
- import { RefObject } from 'react';
1
+ import type { RefObject } from 'react';
2
2
  type Size = {
3
3
  width: number;
4
4
  height: number;
@@ -33,7 +33,7 @@ function useProductPicker() {
33
33
  Array.from(root.classList)
34
34
  .filter((c) => c.startsWith('product-'))
35
35
  .forEach((c) => root.classList.remove(c));
36
- root.classList.add((0, utils_1.getProductClassName)(freshProduct.name));
36
+ root.classList.add((0, utils_2.getSafeClassName)((0, utils_1.getProductClassName)(freshProduct.name)));
37
37
  }
38
38
  loadAndNavigate({ navigate, to: (0, utils_2.withPathPrefix)(freshProduct.link) });
39
39
  }
@@ -220,12 +220,14 @@ const useActiveTab = ({ initialTab, tabsId }) => {
220
220
  const [activeTab, setActiveTab] = (0, react_1.useState)(undefined);
221
221
  const resolvedActiveTab = activeTab !== null && activeTab !== void 0 ? activeTab : initialTab;
222
222
  const prevActiveTabRef = (0, react_1.useRef)(resolvedActiveTab);
223
+ const isTabResolvedFromHashRef = (0, react_1.useRef)(false);
223
224
  (0, react_1.useEffect)(() => {
224
- if (activeTab !== undefined) {
225
+ if (isTabResolvedFromHashRef.current) {
225
226
  return;
226
227
  }
228
+ isTabResolvedFromHashRef.current = true;
227
229
  setActiveTab(getInitialTab({ initialTab, hash: location.hash, tabsId }));
228
- }, [activeTab, initialTab, location.hash, tabsId]);
230
+ }, [initialTab, location.hash, tabsId]);
229
231
  (0, react_1.useEffect)(() => {
230
232
  const hasActiveTabChanged = prevActiveTabRef.current !== resolvedActiveTab;
231
233
  if (!tabsId || !hasActiveTabChanged) {
@@ -34,6 +34,8 @@ export declare const useTelemetryFallback: () => {
34
34
  sendProductPickerChangedMessage: () => void;
35
35
  sendLogoClickedMessage: () => void;
36
36
  sendCodeSnippetReportedMessage: () => void;
37
+ sendConnectMcpClickedMessage: () => void;
38
+ sendMcpConnectionSnippetCopiedMessage: () => void;
37
39
  sendMobileMenuClosedMessage: () => void;
38
40
  sendMobileMenuOpenedMessage: () => void;
39
41
  sendPageViewedMessage: () => void;
@@ -39,6 +39,8 @@ const useTelemetryFallback = () => ({
39
39
  sendProductPickerChangedMessage: () => { },
40
40
  sendLogoClickedMessage: () => { },
41
41
  sendCodeSnippetReportedMessage: () => { },
42
+ sendConnectMcpClickedMessage: () => { },
43
+ sendMcpConnectionSnippetCopiedMessage: () => { },
42
44
  sendMobileMenuClosedMessage: () => { },
43
45
  sendMobileMenuOpenedMessage: () => { },
44
46
  sendPageViewedMessage: () => { },
@@ -592,6 +592,7 @@ const links = (0, styled_components_1.css) `
592
592
 
593
593
  // @tokens End
594
594
  `;
595
+ // oxlint-disable-next-line theme/css-variable-pattern -- `--schema-labels--text-color` is a documented public variable
595
596
  const apiReferenceDocs = (0, styled_components_1.css) `
596
597
  /* === ref docs and graphql docs specific === */
597
598
 
@@ -1,6 +1,5 @@
1
- import { InfiniteData, UseInfiniteQueryResult } from '@tanstack/react-query';
2
- import { ENTITY_RELATION_TYPES } from '@redocly/config';
3
- import type { CatalogEntityConfig, EntitiesCatalogConfig, LayoutVariant } from '@redocly/config';
1
+ import type { InfiniteData, UseInfiniteQueryResult } from '@tanstack/react-query';
2
+ import type { ENTITY_RELATION_TYPES, CatalogEntityConfig, EntitiesCatalogConfig, LayoutVariant } from '@redocly/config';
4
3
  import type { CatalogFilterConfig } from '../../config';
5
4
  export type FilterResult = {
6
5
  value: string;
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import { DEFAULT_COLOR_MODES } from '../constants';
2
+ import type { DEFAULT_COLOR_MODES } from '../constants';
3
3
  export type Plural<T extends string> = `${T}s`;
4
4
  export type ColorMode = (typeof DEFAULT_COLOR_MODES)[keyof typeof DEFAULT_COLOR_MODES];
5
5
  export type RenderableChildren<Context> = React.ReactNode | ((context: Context) => React.ReactNode);
@@ -1,21 +1,18 @@
1
- import type { ResolvedBannerConfig } from '@redocly/config';
1
+ import type { ResolvedBannerConfig, PageData, PageProps, ResolvedNavItemWithLink, Version } from '@redocly/config';
2
2
  import type { AsyncApiRealmUI } from '@redocly/realm-asyncapi-sdk';
3
- import type { PageData, PageProps, ResolvedNavItemWithLink, Version } from '@redocly/config';
4
3
  import type { ShikiTransformer } from '@shikijs/types';
5
4
  import type { Callback, TFunction as TFunc } from 'i18next';
6
5
  import type { To, Location, NavigateFunction } from 'react-router';
7
6
  import type { UseQueryResult } from '@tanstack/react-query';
8
7
  import type { CatalogConfig, ProductUiConfig } from '../../config';
9
- import type { UseCatalogResponse, FilteredCatalog, UseCatalogSortResponse, UseCatalogSearchResponse, UseCatalogProps, CatalogApiParams, CatalogApiResults } from './catalog';
8
+ import type { UseCatalogResponse, FilteredCatalog, UseCatalogSortResponse, UseCatalogSearchResponse, UseCatalogProps, CatalogApiParams, CatalogApiResults, BffCatalogEntity, BffCatalogEntityList, BffCatalogRelatedEntity, BffCatalogRelatedEntityList, BffCatalogEntityRevision, BffCatalogEntityRevisionList } from './catalog';
10
9
  import type { UserMenuData } from './user-menu';
11
- import type { ItemState } from './sidebar';
10
+ import type { ItemState, DrilldownMenuItemDetails } from './sidebar';
12
11
  import type { SearchItemData, SearchFacet, SearchFilterItem, SearchFacetQuery, AiSearchConversationItem, ContentSegment, ToolCall } from './search';
13
12
  import type { SubmitFeedbackParams } from './feedback';
14
13
  import type { TFunction } from './l10n';
15
14
  import type { BreadcrumbItem } from './breadcrumb';
16
- import type { DrilldownMenuItemDetails } from './sidebar';
17
- import { BffCatalogEntity, BffCatalogEntityList, BffCatalogRelatedEntity, BffCatalogRelatedEntityList, BffCatalogEntityRevision, BffCatalogEntityRevisionList } from './catalog';
18
- import { AiSearchError } from '../constants/search';
15
+ import type { AiSearchError } from '../constants/search';
19
16
  export type ThemeHooks = {
20
17
  useAnchorPositioning: () => {
21
18
  isSupported: boolean;
@@ -1 +1,2 @@
1
+ export declare function getSafeClassName(className: string): string;
1
2
  export declare function concatClassNames(...args: Array<string | undefined>): string;
@@ -1,7 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSafeClassName = getSafeClassName;
3
4
  exports.concatClassNames = concatClassNames;
4
5
  const SPACE_DELIMITER = ' ';
6
+ // EasyList/AdGuard ship generic cosmetic rules that hide these exact class tokens on every
7
+ // site; the trailing underscore keeps the class usable without matching the filter lists.
8
+ const ADBLOCK_HIDDEN_CLASS_NAMES = new Set(['product-ad', 'product-ads', 'product-inlist-ad']);
9
+ function getSafeClassName(className) {
10
+ return ADBLOCK_HIDDEN_CLASS_NAMES.has(className) ? `${className}_` : className;
11
+ }
5
12
  function concatClassNames(...args) {
6
13
  return args
7
14
  .map((className) => (className ? className.trim() : className))
@@ -1,7 +1,6 @@
1
1
  import type { MCPClientType, McpConnectionParams } from '../types';
2
2
  export declare function generateMCPDeepLink(clientType: MCPClientType, config: McpConnectionParams): string;
3
3
  export declare function slugifyMcpServerName(name: string): string;
4
- export declare function generateClaudeDesktopConfig(config: McpConnectionParams): string;
5
4
  export declare function generateClaudeCodeCommand(config: McpConnectionParams): string;
6
5
  export declare function generateCodexCommand(config: McpConnectionParams): string;
7
6
  export declare function generateMcpInstallPrompt(config: McpConnectionParams): string;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateMCPDeepLink = generateMCPDeepLink;
4
4
  exports.slugifyMcpServerName = slugifyMcpServerName;
5
- exports.generateClaudeDesktopConfig = generateClaudeDesktopConfig;
6
5
  exports.generateClaudeCodeCommand = generateClaudeCodeCommand;
7
6
  exports.generateCodexCommand = generateCodexCommand;
8
7
  exports.generateMcpInstallPrompt = generateMcpInstallPrompt;
@@ -41,18 +40,6 @@ function slugifyMcpServerName(name) {
41
40
  .replace(/[^a-z0-9_-]+/g, '-')
42
41
  .replace(/^-+|-+$/g, '');
43
42
  }
44
- // Claude Desktop's config file only launches stdio commands, so remote servers
45
- // connect through the mcp-remote bridge.
46
- function generateClaudeDesktopConfig(config) {
47
- return JSON.stringify({
48
- mcpServers: {
49
- [slugifyMcpServerName(config.serverName)]: {
50
- command: 'npx',
51
- args: ['-y', 'mcp-remote', config.url],
52
- },
53
- },
54
- }, null, 2);
55
- }
56
43
  function generateClaudeCodeCommand(config) {
57
44
  return `claude mcp add --transport http ${slugifyMcpServerName(config.serverName)} ${config.url}`;
58
45
  }
@@ -1,7 +1,7 @@
1
1
  import type { ResolvedNavItem, Version } from '@redocly/config';
2
2
  import type { Location } from 'react-router';
3
- import { type Locale, type TFunction } from '../types/l10n';
4
- import { type ItemState } from '../types/sidebar';
3
+ import type { Locale, TFunction } from '../types/l10n';
4
+ import type { ItemState } from '../types/sidebar';
5
5
  import { MenuItemType } from '../constants/common';
6
6
  export declare const mapNavbarItems: (items: ResolvedNavItem[], defaultLocale: string, currentLocale: string, locales: Locale[], location: Location) => ItemState[];
7
7
  export declare const isItemActive: (item: ResolvedNavItem, defaultLocale: string, currentLocale: string, locales: Locale[], location: Location) => boolean;
@@ -18,9 +18,7 @@ const common_1 = require("../constants/common");
18
18
  function combineUrls(baseURL, ...relativeURLs) {
19
19
  let res = baseURL;
20
20
  for (let relativeURL of relativeURLs) {
21
- res = relativeURL
22
- ? res.replace(/[\/\\]+$/, '') + '/' + relativeURL.replace(/^[\/\\]+/, '')
23
- : res;
21
+ res = relativeURL ? res.replace(/[/\\]+$/, '') + '/' + relativeURL.replace(/^[/\\]+/, '') : res;
24
22
  }
25
23
  return res;
26
24
  }
@@ -1,4 +1,4 @@
1
- import { type ConfigureRequestValues, type ConfigureServerRequestValues } from '../ext/configure';
1
+ import type { ConfigureRequestValues, ConfigureServerRequestValues } from '../ext/configure';
2
2
  import type { UserClaims, OpenAPIServer, OpenAPIInfo } from '../core/types';
3
3
  type ContextProps = {
4
4
  operation: {
@@ -47,7 +47,7 @@ function OIDCForbidden() {
47
47
  const [searchParams, setSearchParams] = (0, react_router_1.useSearchParams)();
48
48
  const [errorDescription, setErrorDescription] = (0, react_1.useState)('');
49
49
  // use whatever you want here
50
- const URL_REGEX = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/;
50
+ const URL_REGEX = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
51
51
  const renderText = (text) => text.split(' ').map((part) => URL_REGEX.test(part) ? (react_1.default.createElement(ErrorDescriptionLink, { key: part, href: part },
52
52
  part,
53
53
  ' ')) : (part + ' '));
@@ -32,21 +32,21 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
36
  exports.Accordion = Accordion;
40
- const react_1 = __importDefault(require("react"));
37
+ const react_1 = __importStar(require("react"));
41
38
  const styled_components_1 = __importStar(require("styled-components"));
42
39
  const ChevronRightIcon_1 = require("../../../icons/ChevronRightIcon/ChevronRightIcon");
43
40
  const constants_1 = require("../../../core/constants");
41
+ const contexts_1 = require("../../../core/contexts");
44
42
  function Accordion({ title, expanded = false, className, children, 'data-source': dataSource, 'data-hash': dataHash, }) {
45
- return (react_1.default.createElement(AccordionWrapper, { className: className, open: expanded, "data-component-name": constants_1.ACCORDION_COMPONENT_NAME, "data-source": dataSource, "data-hash": dataHash },
43
+ const groupName = (0, react_1.useContext)(contexts_1.AccordionGroupContext);
44
+ return (react_1.default.createElement(AccordionWrapper, { className: className, open: expanded, name: groupName !== null && groupName !== void 0 ? groupName : undefined, "data-component-name": constants_1.ACCORDION_COMPONENT_NAME, "data-source": dataSource, "data-hash": dataHash },
46
45
  react_1.default.createElement(AccordionSummary, null,
47
46
  react_1.default.createElement(ChevronRightIcon_1.ChevronRightIcon, { color: "--md-accordion-chevron-icon-color", size: "var(--md-accordion-chevron-icon-size)" }),
48
47
  title),
49
- react_1.default.createElement(AccordionBody, null, children)));
48
+ react_1.default.createElement(AccordionBody, null,
49
+ react_1.default.createElement(contexts_1.AccordionGroupContext.Provider, { value: null }, children))));
50
50
  }
51
51
  const AccordionWrapper = styled_components_1.default.details `
52
52
  margin: var(--md-accordion-margin);
@@ -1,5 +1,6 @@
1
1
  import type { JSX, PropsWithChildren } from 'react';
2
2
  export type AccordionGroupProps = {
3
+ singleExpanded?: boolean;
3
4
  className?: string;
4
5
  };
5
- export declare function AccordionGroup({ className, children, }: PropsWithChildren<AccordionGroupProps>): JSX.Element;
6
+ export declare function AccordionGroup({ singleExpanded, className, children, }: PropsWithChildren<AccordionGroupProps>): JSX.Element;
@@ -1,14 +1,50 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  exports.AccordionGroup = AccordionGroup;
7
- const react_1 = __importDefault(require("react"));
40
+ const react_1 = __importStar(require("react"));
8
41
  const styled_components_1 = __importDefault(require("styled-components"));
9
42
  const constants_1 = require("../../../core/constants");
10
- function AccordionGroup({ className, children, }) {
11
- return (react_1.default.createElement(AccordionGroupWrapper, { className: className, "data-component-name": constants_1.ACCORDION_GROUP_COMPONENT_NAME }, children));
43
+ const contexts_1 = require("../../../core/contexts");
44
+ function AccordionGroup({ singleExpanded = false, className, children, }) {
45
+ const groupName = (0, react_1.useId)();
46
+ return (react_1.default.createElement(AccordionGroupWrapper, { className: className, "data-component-name": constants_1.ACCORDION_GROUP_COMPONENT_NAME },
47
+ react_1.default.createElement(contexts_1.AccordionGroupContext.Provider, { value: singleExpanded ? groupName : null }, children)));
12
48
  }
13
49
  const AccordionGroupWrapper = styled_components_1.default.div `
14
50
  margin: var(--md-accordion-group-margin);
@@ -1,3 +1,2 @@
1
- import { PropsWithChildren } from 'react';
2
- import type { JSX } from 'react';
1
+ import type { JSX, PropsWithChildren } from 'react';
3
2
  export declare function CodePanelPreview({ children }: PropsWithChildren): JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { JSX } from 'react';
1
+ import { type JSX } from 'react';
2
2
  type DiagramProps = {
3
3
  id?: string;
4
4
  diagramHtml: string;
@@ -41,10 +41,9 @@ const react_1 = __importStar(require("react"));
41
41
  const styled_components_1 = __importDefault(require("styled-components"));
42
42
  const utils_1 = require("../../../core/utils");
43
43
  const hooks_1 = require("../../../core/hooks");
44
- const hooks_2 = require("../../../core/hooks");
45
44
  const SvgViewer_1 = require("../../../components/SvgViewer/SvgViewer");
46
45
  function Diagram({ id, diagramHtml, diagramHtmlDark, diagramError, diagramType, align, width, 'data-source': dataSource, 'data-hash': dataHash, className, }) {
47
- const { useTranslate } = (0, hooks_2.useThemeHooks)();
46
+ const { useTranslate } = (0, hooks_1.useThemeHooks)();
48
47
  const { translate } = useTranslate();
49
48
  const { activeColorMode } = (0, hooks_1.useColorSwitcher)();
50
49
  const [isOpen, setIsOpen] = (0, react_1.useState)(false);
@@ -45,6 +45,7 @@ const utils_1 = require("../../../core/utils");
45
45
  const LinkIcon_1 = require("../../../icons/LinkIcon/LinkIcon");
46
46
  const PageActions_1 = require("../../../components/PageActions/PageActions");
47
47
  const hooks_1 = require("../../../core/hooks");
48
+ const contexts_1 = require("../../../core/contexts");
48
49
  const constants_1 = require("../../../core/constants");
49
50
  function renderWithSpanWrapper(children) {
50
51
  const childrenArray = react_1.default.Children.toArray(children);
@@ -68,10 +69,12 @@ function renderWithSpanWrapper(children) {
68
69
  }
69
70
  function Heading({ level, id, children, 'data-source': dataSource, 'data-hash': dataHash, className, __idx, }) {
70
71
  var _a, _b;
72
+ var _c;
71
73
  const { pathname } = (0, react_router_1.useLocation)();
72
74
  const { usePageProps } = (0, hooks_1.useThemeHooks)();
73
75
  const pageProps = usePageProps();
74
- const isMarkdownPage = ((_a = pageProps === null || pageProps === void 0 ? void 0 : pageProps.metadata) === null || _a === void 0 ? void 0 : _a.type) === 'markdown' || ((_b = pageProps === null || pageProps === void 0 ? void 0 : pageProps.metadata) === null || _b === void 0 ? void 0 : _b.type) === 'asciidoc';
76
+ // The page-type fallback is only for backward compatibility; templates set the scope.
77
+ const withPageActions = (_c = (0, react_1.useContext)(contexts_1.PageActionsContext)) !== null && _c !== void 0 ? _c : (((_a = pageProps === null || pageProps === void 0 ? void 0 : pageProps.metadata) === null || _a === void 0 ? void 0 : _a.type) === 'markdown' || ((_b = pageProps === null || pageProps === void 0 ? void 0 : pageProps.metadata) === null || _b === void 0 ? void 0 : _b.type) === 'asciidoc');
75
78
  const headingTextId = `${id}-heading-text`;
76
79
  const linkEl = (react_1.default.createElement("a", { "aria-labelledby": headingTextId, href: `#${id}`, className: (0, utils_1.concatClassNames)(constants_1.ANCHOR_CLASS, 'before') },
77
80
  react_1.default.createElement(LinkIcon_1.LinkIcon, { "aria-hidden": "true", focusable: "false", color: "--heading-anchor-color" })));
@@ -80,7 +83,7 @@ function Heading({ level, id, children, 'data-source': dataSource, 'data-hash':
80
83
  react_1.default.createElement(HeadingContentWrapper, null,
81
84
  linkEl,
82
85
  headingText,
83
- isMarkdownPage && __idx === 0 ? react_1.default.createElement(PageActions_1.PageActions, { pageSlug: pathname }) : null)));
86
+ withPageActions && __idx === 0 ? react_1.default.createElement(PageActions_1.PageActions, { pageSlug: pathname }) : null)));
84
87
  }
85
88
  const HeadingContentWrapper = styled_components_1.default.div `
86
89
  display: flex;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { JSX } from 'react';
3
- import { TabsSize } from '../../../markdoc/components/Tabs/Tabs';
3
+ import type { TabsSize } from '../../../markdoc/components/Tabs/Tabs';
4
4
  export type TabProps = {
5
5
  tabId: string;
6
6
  label: string;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { JSX } from 'react';
3
3
  import type { TabItemProps } from '../../../markdoc/components/Tabs/TabItemFragment';
4
- import { TabsSize } from '../../../markdoc/components/Tabs/Tabs';
4
+ import type { TabsSize } from '../../../markdoc/components/Tabs/Tabs';
5
5
  type TabListProps = {
6
6
  childrenArray: React.ReactElement<TabItemProps>[];
7
7
  size: TabsSize;
@@ -4,6 +4,9 @@ exports.accordionGroup = void 0;
4
4
  exports.accordionGroup = {
5
5
  schema: {
6
6
  render: 'AccordionGroup',
7
+ attributes: {
8
+ singleExpanded: { type: Boolean, default: false },
9
+ },
7
10
  },
8
11
  tagName: 'accordion-group',
9
12
  };
@@ -1,4 +1,4 @@
1
- import { Node, RenderableTreeNode } from '@markdoc/markdoc';
1
+ import type { Node, RenderableTreeNode } from '@markdoc/markdoc';
2
2
  import type { MarkdocSchemaWrapper } from '../../markdoc/tags/types';
3
3
  import type { CodeWalkthroughConditions, CodeWalkthroughFilter, TogglesMarkdocAttr, InputsMarkdocAttr } from '@redocly/config';
4
4
  export declare const codeWalkthrough: MarkdocSchemaWrapper;
@@ -5,21 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.markdocExample = void 0;
7
7
  const markdoc_1 = __importDefault(require("@markdoc/markdoc"));
8
- // Walk through AST and look for raw markdown to parse
9
- function parseInlineMarkdown(ast, config) {
10
- if (Array.isArray(ast)) {
11
- return ast.flatMap((child) => parseInlineMarkdown(child, config));
12
- }
13
- if (typeof ast === 'string') {
14
- const parsed = markdoc_1.default.parse(ast);
15
- return markdoc_1.default.transform(parsed, config);
16
- }
17
- if (ast && typeof ast === 'object' && ast.$$mdtype === 'Tag') {
18
- const children = parseInlineMarkdown(ast.children, config);
19
- return Object.assign(Object.assign({}, ast), { children });
20
- }
21
- return ast;
22
- }
8
+ const constants_1 = require("../../core/constants");
23
9
  // This custom tag prevents evaluating any children markdoc tags (no children) so we can
24
10
  // have markdoc examples in code fences
25
11
  // approach copied from: https://github.com/markdoc/docs/blob/main/markdoc/tags/markdoc-example.markdoc.js
@@ -33,24 +19,50 @@ exports.markdocExample = {
33
19
  },
34
20
  children: ['fence'],
35
21
  transform(node, config) {
36
- var _a;
37
22
  const attributes = node.transformAttributes(config);
38
- const { content } = ((_a = node.children[0]) === null || _a === void 0 ? void 0 : _a.attributes) || {};
23
+ const fenceNode = node.children[0];
24
+ const { content } = (fenceNode === null || fenceNode === void 0 ? void 0 : fenceNode.attributes) || {};
39
25
  if (!content)
40
26
  return null;
41
27
  const language = 'markdoc';
42
- const annotations = node.children[0].annotations;
28
+ const annotations = fenceNode.annotations;
43
29
  let title = null;
44
30
  if (annotations.length > 0) {
45
31
  const fenceWithTitle = annotations.find((annotation) => annotation.name === 'title');
46
32
  title = fenceWithTitle === null || fenceWithTitle === void 0 ? void 0 : fenceWithTitle.value;
47
33
  }
48
- const demoContent = node.children[0].transformChildren(config);
49
- const parsedDemoContent = parseInlineMarkdown(demoContent, config);
50
34
  return new markdoc_1.default.Tag('MarkdocExample', Object.assign(Object.assign({}, attributes), { title,
51
- language, demoContent: parsedDemoContent, rawContent: content }), []);
35
+ language, demoContent: transformDemoContent(fenceNode, content, config), rawContent: content }), []);
52
36
  },
53
37
  },
54
- tagName: 'markdoc-example',
38
+ tagName: constants_1.MARKDOC_EXAMPLE_TAG,
55
39
  };
40
+ // Walk through AST and look for raw markdown to parse
41
+ function parseRawMarkdown(ast, config) {
42
+ if (Array.isArray(ast)) {
43
+ return ast.flatMap((child) => parseRawMarkdown(child, config));
44
+ }
45
+ if (typeof ast === 'string') {
46
+ const parsed = markdoc_1.default.parse(ast);
47
+ return markdoc_1.default.transform(parsed, config);
48
+ }
49
+ if (ast && typeof ast === 'object' && ast.$$mdtype === 'Tag') {
50
+ const children = parseRawMarkdown(ast.children, config);
51
+ return Object.assign(Object.assign({}, ast), { children });
52
+ }
53
+ return ast;
54
+ }
55
+ function toRenderableArray(node) {
56
+ return Array.isArray(node) ? node : [node];
57
+ }
58
+ function transformDemoContent(fenceNode, content, config) {
59
+ const parsedBody = fenceNode.attributes[constants_1.EXAMPLE_CONTENT_ATTRIBUTE];
60
+ if (parsedBody) {
61
+ return toRenderableArray(markdoc_1.default.transform(parsedBody.children, config));
62
+ }
63
+ if (!fenceNode.children.length) {
64
+ return toRenderableArray(markdoc_1.default.transform(markdoc_1.default.parse(content).children, config));
65
+ }
66
+ return toRenderableArray(parseRawMarkdown(fenceNode.transformChildren(config), config));
67
+ }
56
68
  //# sourceMappingURL=markdoc-example.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.69.0-next.9",
3
+ "version": "0.70.0-next.0",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -42,7 +42,7 @@
42
42
  "devDependencies": {
43
43
  "@babel/core": "7.29.7",
44
44
  "@markdoc/markdoc": "0.5.2",
45
- "@redocly/realm-asyncapi-sdk": "0.15.0-next.3",
45
+ "@redocly/realm-asyncapi-sdk": "0.16.0-next.0",
46
46
  "@shikijs/types": "3.21.0",
47
47
  "@testing-library/react": "16.3.0",
48
48
  "@testing-library/user-event": "14.6.1",
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import styled from 'styled-components';
2
3
 
3
4
  import type { JSX } from 'react';
4
5
 
@@ -18,24 +19,31 @@ export function DownloadButton({
18
19
  }: DownloadButtonProps): JSX.Element {
19
20
  const { useTranslate } = useThemeHooks();
20
21
  const { translate } = useTranslate();
22
+ const label = translate('button.download.tooltipText', 'Download description');
21
23
 
22
24
  return (
23
25
  <div data-component-name="Buttons/DownloadButton">
24
- <Tooltip
25
- tip={translate('button.download.tooltipText', 'Download description')}
26
- placement="top"
27
- arrowPosition="right"
28
- >
29
- <a href={data} target="_blank" download rel="noreferrer">
26
+ <Tooltip tip={label} placement="top" arrowPosition="right">
27
+ <DownloadLink href={data} target="_blank" download rel="noreferrer" aria-label={label}>
30
28
  <Button
31
29
  variant="text"
32
30
  size="small"
33
- aria-label="Download"
31
+ aria-hidden={true}
32
+ tabIndex={-1}
34
33
  icon={<DownloadIcon />}
35
34
  data-testid={dataTestId}
36
35
  />
37
- </a>
36
+ </DownloadLink>
38
37
  </Tooltip>
39
38
  </div>
40
39
  );
41
40
  }
41
+
42
+ const DownloadLink = styled.a`
43
+ text-decoration: none;
44
+ border-radius: var(--button-border-radius);
45
+
46
+ &:focus-visible {
47
+ outline: 1px solid var(--button-border-color-focused);
48
+ }
49
+ `;
@@ -1,14 +1,14 @@
1
- import React, { useState, useMemo, JSX } from 'react';
1
+ import React, { type JSX, useState, useMemo } from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
4
  import type { CatalogEntityConfig } from '@redocly/config';
5
- import type { ResolvedFilter } from '@redocly/theme/core/types';
6
-
7
- import {
5
+ import type {
6
+ ResolvedFilter,
8
7
  BffCatalogEntityList,
9
8
  CatalogSwitcherItem,
10
9
  CatalogViewMode,
11
10
  } from '@redocly/theme/core/types';
11
+
12
12
  import {
13
13
  breakpoints,
14
14
  customCatalogOptionsCasing,
@@ -1,7 +1,8 @@
1
- import React, { JSX } from 'react';
1
+ import type { JSX } from 'react';
2
+ import React from 'react';
2
3
  import styled, { css } from 'styled-components';
3
4
 
4
- import { CatalogViewMode } from '@redocly/theme/core/types';
5
+ import type { CatalogViewMode } from '@redocly/theme/core/types';
5
6
  import { FilterInput } from '@redocly/theme/components/Filter/FilterInput';
6
7
  import { CatalogSortButton } from '@redocly/theme/components/Catalog/CatalogSortButton';
7
8
  import { CatalogViewModeToggle } from '@redocly/theme/components/Catalog/CatalogViewModeToggle';
@@ -1,9 +1,10 @@
1
- import React, { JSX } from 'react';
1
+ import type { JSX } from 'react';
2
+ import React from 'react';
2
3
  import styled from 'styled-components';
3
4
 
4
5
  import type { CatalogEntityConfig } from '@redocly/config';
5
6
 
6
- import { BffCatalogEntity } from '@redocly/theme/core/types';
7
+ import type { BffCatalogEntity } from '@redocly/theme/core/types';
7
8
  import { useThemeHooks } from '@redocly/theme/core/hooks';
8
9
  import { CatalogHighlight } from '@redocly/theme/components/Catalog/CatalogHighlight';
9
10
  import { GraphIcon } from '@redocly/theme/icons/GraphIcon/GraphIcon';