@redocly/theme 0.70.0-next.1 → 0.70.0-next.11

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 (378) hide show
  1. package/lib/components/Buttons/ConnectMCPButton.js +19 -14
  2. package/lib/components/Buttons/variables.d.ts +1 -0
  3. package/lib/components/Buttons/variables.js +4 -1
  4. package/lib/components/Catalog/Catalog.js +3 -3
  5. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.d.ts +1 -1
  6. package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.js +1 -1
  7. package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +2 -2
  8. package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +1 -1
  9. package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.js +30 -11
  10. package/lib/components/Catalog/CatalogFilter/CatalogFilterDateRange.js +2 -1
  11. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.js +1 -1
  12. package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.js +2 -2
  13. package/lib/components/CodeBlock/CodeBlockControls.js +3 -5
  14. package/lib/components/Consent/Consent.d.ts +2 -0
  15. package/lib/components/Consent/Consent.js +17 -0
  16. package/lib/components/Consent/ConsentBanner.d.ts +2 -0
  17. package/lib/components/Consent/ConsentBanner.js +120 -0
  18. package/lib/components/Consent/ConsentDialog.d.ts +2 -0
  19. package/lib/components/Consent/ConsentDialog.js +128 -0
  20. package/lib/components/Consent/ConsentSettingsLink.d.ts +2 -0
  21. package/lib/components/Consent/ConsentSettingsLink.js +35 -0
  22. package/lib/components/Consent/variables.d.ts +1 -0
  23. package/lib/components/Consent/variables.js +31 -0
  24. package/lib/components/Dropdown/Dropdown.d.ts +4 -2
  25. package/lib/components/Dropdown/Dropdown.js +31 -9
  26. package/lib/components/Dropdown/DropdownMenu.d.ts +1 -0
  27. package/lib/components/Dropdown/DropdownMenu.js +1 -1
  28. package/lib/components/Feedback/Reasons.js +3 -2
  29. package/lib/components/Filter/FilterCheckboxes.js +30 -11
  30. package/lib/components/Filter/FilterDateRange.js +36 -2
  31. package/lib/components/Footer/Footer.js +4 -1
  32. package/lib/components/Image/Image.js +24 -4
  33. package/lib/components/JsonViewer/Helpers.d.ts +10 -2
  34. package/lib/components/JsonViewer/Helpers.js +32 -36
  35. package/lib/components/JsonViewer/JsonViewer.js +15 -18
  36. package/lib/components/LoadProgressBar/LoadProgressBar.d.ts +8 -0
  37. package/lib/components/LoadProgressBar/LoadProgressBar.js +122 -0
  38. package/lib/components/MCP/McpConnectionTabs.js +9 -2
  39. package/lib/components/Markdown/Markdown.js +3 -2
  40. package/lib/components/Markdown/styles/base-table.js +14 -1
  41. package/lib/components/Markdown/variables.js +1 -0
  42. package/lib/components/Menu/Menu.js +4 -0
  43. package/lib/components/Menu/MenuSelect.d.ts +7 -0
  44. package/lib/components/Menu/MenuSelect.js +129 -0
  45. package/lib/components/Menu/variables.js +43 -4
  46. package/lib/components/Navbar/Navbar.js +44 -5
  47. package/lib/components/Navbar/variables.js +3 -0
  48. package/lib/components/NavigationTabs/NavigationTab.d.ts +7 -0
  49. package/lib/components/NavigationTabs/NavigationTab.js +93 -0
  50. package/lib/components/NavigationTabs/NavigationTabContent.d.ts +7 -0
  51. package/lib/components/NavigationTabs/NavigationTabContent.js +50 -0
  52. package/lib/components/NavigationTabs/NavigationTabMenu.d.ts +7 -0
  53. package/lib/components/NavigationTabs/NavigationTabMenu.js +18 -0
  54. package/lib/components/NavigationTabs/NavigationTabs.d.ts +7 -0
  55. package/lib/components/NavigationTabs/NavigationTabs.js +97 -0
  56. package/lib/components/NavigationTabs/variables.d.ts +1 -0
  57. package/lib/components/NavigationTabs/variables.js +37 -0
  58. package/lib/components/Portal/Portal.js +37 -5
  59. package/lib/components/Product/utils.js +1 -1
  60. package/lib/components/Search/SearchAiActionButtons.js +8 -3
  61. package/lib/components/Search/SearchAiActivity.d.ts +10 -0
  62. package/lib/components/Search/SearchAiActivity.js +278 -0
  63. package/lib/components/Search/SearchAiConversationInput.js +10 -6
  64. package/lib/components/Search/SearchAiDialog.js +13 -2
  65. package/lib/components/Search/SearchAiMessage.d.ts +2 -1
  66. package/lib/components/Search/SearchAiMessage.js +21 -109
  67. package/lib/components/Search/SearchAiResponse.js +1 -0
  68. package/lib/components/Search/SearchDialog.js +10 -0
  69. package/lib/components/Search/SearchItem.js +11 -10
  70. package/lib/components/Search/SearchTrigger.js +37 -6
  71. package/lib/components/Search/variables.js +17 -2
  72. package/lib/components/Segmented/Segmented.js +23 -3
  73. package/lib/components/Select/Select.js +10 -3
  74. package/lib/components/Select/SelectInput.d.ts +1 -0
  75. package/lib/components/Select/SelectInput.js +5 -11
  76. package/lib/components/Sidebar/Sidebar.js +2 -2
  77. package/lib/components/SplitButton/SplitButton.js +37 -3
  78. package/lib/components/TableOfContent/TableOfContent.js +2 -2
  79. package/lib/core/constants/common.d.ts +1 -0
  80. package/lib/core/constants/common.js +1 -0
  81. package/lib/core/constants/consent.d.ts +2 -0
  82. package/lib/core/constants/consent.js +30 -0
  83. package/lib/core/constants/index.d.ts +2 -0
  84. package/lib/core/constants/index.js +2 -0
  85. package/lib/core/constants/mcp.d.ts +2 -2
  86. package/lib/core/constants/mcp.js +3 -8
  87. package/lib/core/constants/prompt.d.ts +9 -0
  88. package/lib/core/constants/prompt.js +33 -0
  89. package/lib/core/constants/search.d.ts +1 -1
  90. package/lib/core/constants/search.js +6 -2
  91. package/lib/core/contexts/PortalContainerContext.d.ts +2 -0
  92. package/lib/core/contexts/PortalContainerContext.js +7 -0
  93. package/lib/core/hooks/code-walkthrough/use-code-panel.d.ts +1 -1
  94. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.d.ts +1 -1
  95. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +1 -1
  96. package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.d.ts +1 -1
  97. package/lib/core/hooks/code-walkthrough/use-code-walkthrough.d.ts +1 -2
  98. package/lib/core/hooks/code-walkthrough/use-renderable-files.d.ts +1 -1
  99. package/lib/core/hooks/index.d.ts +9 -0
  100. package/lib/core/hooks/index.js +9 -0
  101. package/lib/core/hooks/menu/use-collapse.js +1 -1
  102. package/lib/core/hooks/menu/use-mobile-menu-items.js +75 -51
  103. package/lib/core/hooks/menu/use-mobile-menu-levels.js +12 -7
  104. package/lib/core/hooks/prompt/use-prompt-actions.d.ts +7 -0
  105. package/lib/core/hooks/prompt/use-prompt-actions.js +19 -0
  106. package/lib/core/hooks/prompt/use-prompt-text-limit.d.ts +19 -0
  107. package/lib/core/hooks/prompt/use-prompt-text-limit.js +35 -0
  108. package/lib/core/hooks/search/use-persisted-quick-filter.d.ts +21 -0
  109. package/lib/core/hooks/search/use-persisted-quick-filter.js +92 -0
  110. package/lib/core/hooks/search/use-search-ai-activity.d.ts +11 -0
  111. package/lib/core/hooks/search/use-search-ai-activity.js +15 -0
  112. package/lib/core/hooks/use-connect-mcp-button.js +3 -1
  113. package/lib/core/hooks/use-consent-dialog.d.ts +12 -0
  114. package/lib/core/hooks/use-consent-dialog.js +36 -0
  115. package/lib/core/hooks/use-consent-telemetry.d.ts +1 -0
  116. package/lib/core/hooks/use-consent-telemetry.js +42 -0
  117. package/lib/core/hooks/use-dialog-hotkeys.js +4 -2
  118. package/lib/core/hooks/use-full-height.d.ts +1 -1
  119. package/lib/core/hooks/use-full-height.js +8 -8
  120. package/lib/core/hooks/use-page-actions.d.ts +1 -1
  121. package/lib/core/hooks/use-page-actions.js +10 -8
  122. package/lib/core/hooks/use-pointer-border-highlight.d.ts +7 -0
  123. package/lib/core/hooks/use-pointer-border-highlight.js +29 -0
  124. package/lib/core/hooks/use-scroll-item-into-view.d.ts +2 -0
  125. package/lib/core/hooks/use-scroll-item-into-view.js +16 -0
  126. package/lib/core/hooks/use-tab-list.d.ts +31 -0
  127. package/lib/core/hooks/use-tab-list.js +49 -0
  128. package/lib/core/hooks/use-telemetry-fallback.d.ts +2 -0
  129. package/lib/core/hooks/use-telemetry-fallback.js +2 -0
  130. package/lib/core/hooks/use-theme-hooks.js +16 -0
  131. package/lib/core/styles/dark.js +14 -12
  132. package/lib/core/styles/global.d.ts +2 -0
  133. package/lib/core/styles/global.js +115 -136
  134. package/lib/core/styles/index.d.ts +1 -0
  135. package/lib/core/styles/index.js +3 -1
  136. package/lib/core/styles/search-ai-appear.d.ts +1 -0
  137. package/lib/core/styles/search-ai-appear.js +18 -0
  138. package/lib/core/types/code-walkthrough.d.ts +84 -0
  139. package/lib/core/types/consent.d.ts +54 -0
  140. package/lib/core/types/consent.js +3 -0
  141. package/lib/core/types/dropdown.d.ts +1 -0
  142. package/lib/core/types/dropdown.js +3 -0
  143. package/lib/core/types/hooks.d.ts +8 -1
  144. package/lib/core/types/index.d.ts +4 -0
  145. package/lib/core/types/l10n.d.ts +1 -1
  146. package/lib/core/types/mcp.d.ts +3 -2
  147. package/lib/core/types/navigation-tabs.d.ts +49 -0
  148. package/lib/core/types/navigation-tabs.js +3 -0
  149. package/lib/core/types/prompt.d.ts +9 -0
  150. package/lib/core/types/prompt.js +3 -0
  151. package/lib/core/types/search.d.ts +25 -0
  152. package/lib/core/utils/Dynamic.d.ts +8 -1
  153. package/lib/core/utils/Dynamic.js +34 -3
  154. package/lib/core/utils/assign-ref.d.ts +2 -0
  155. package/lib/core/utils/assign-ref.js +12 -0
  156. package/lib/core/utils/consent-settings-link-placement.d.ts +3 -0
  157. package/lib/core/utils/consent-settings-link-placement.js +15 -0
  158. package/lib/core/utils/content-segments.d.ts +12 -1
  159. package/lib/core/utils/content-segments.js +90 -5
  160. package/lib/core/utils/download-code-walkthrough.d.ts +1 -1
  161. package/lib/core/utils/dropdown.d.ts +2 -0
  162. package/lib/core/utils/dropdown.js +12 -0
  163. package/lib/core/utils/get-ai-prompt-link.d.ts +15 -0
  164. package/lib/core/utils/get-ai-prompt-link.js +29 -0
  165. package/lib/core/utils/get-code-walkthrough-file-text.d.ts +1 -1
  166. package/lib/core/utils/index.d.ts +5 -0
  167. package/lib/core/utils/index.js +5 -0
  168. package/lib/core/utils/match-code-walkthrough-conditions.d.ts +1 -1
  169. package/lib/core/utils/mcp.d.ts +2 -1
  170. package/lib/core/utils/mcp.js +13 -3
  171. package/lib/core/utils/menu.d.ts +4 -0
  172. package/lib/core/utils/menu.js +48 -8
  173. package/lib/core/utils/navigation-tabs.d.ts +8 -0
  174. package/lib/core/utils/navigation-tabs.js +71 -0
  175. package/lib/core/utils/search-ai-activity.d.ts +4 -0
  176. package/lib/core/utils/search-ai-activity.js +83 -0
  177. package/lib/core/utils/urls.js +3 -1
  178. package/lib/core/utils/with-load-progress.d.ts +3 -0
  179. package/lib/core/utils/with-load-progress.js +24 -19
  180. package/lib/ext/configure.d.ts +1 -1
  181. package/lib/ext/configure.js +0 -1
  182. package/lib/icons/ExpandCollapseIcon/ExpandCollapseIcon.d.ts +29 -0
  183. package/lib/icons/ExpandCollapseIcon/ExpandCollapseIcon.js +81 -0
  184. package/lib/icons/LinkIcon/LinkIconSymbol.d.ts +12 -0
  185. package/lib/icons/LinkIcon/LinkIconSymbol.js +41 -0
  186. package/lib/index.d.ts +7 -0
  187. package/lib/index.js +9 -1
  188. package/lib/layouts/PageLayout.js +1 -1
  189. package/lib/layouts/RootLayout.js +2 -2
  190. package/lib/markdoc/components/CodeWalkthrough/CodeFilters.d.ts +1 -1
  191. package/lib/markdoc/components/CodeWalkthrough/CodeFilters.js +1 -1
  192. package/lib/markdoc/components/CodeWalkthrough/CodePanel.d.ts +1 -1
  193. package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +3 -3
  194. package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.d.ts +1 -1
  195. package/lib/markdoc/components/CodeWalkthrough/CodePanelToolbar.d.ts +1 -1
  196. package/lib/markdoc/components/CodeWalkthrough/CodeStep.d.ts +1 -1
  197. package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.d.ts +1 -1
  198. package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +1 -1
  199. package/lib/markdoc/components/Prompt/Prompt.d.ts +15 -0
  200. package/lib/markdoc/components/Prompt/Prompt.js +163 -0
  201. package/lib/markdoc/components/Prompt/PromptActions.d.ts +13 -0
  202. package/lib/markdoc/components/Prompt/PromptActions.js +43 -0
  203. package/lib/markdoc/components/Prompt/PromptBody.d.ts +14 -0
  204. package/lib/markdoc/components/Prompt/PromptBody.js +99 -0
  205. package/lib/markdoc/components/Prompt/PromptCopyButton.d.ts +10 -0
  206. package/lib/markdoc/components/Prompt/PromptCopyButton.js +28 -0
  207. package/lib/markdoc/components/Prompt/PromptHeader.d.ts +9 -0
  208. package/lib/markdoc/components/Prompt/PromptHeader.js +57 -0
  209. package/lib/markdoc/components/Prompt/PromptShowHideButton.d.ts +7 -0
  210. package/lib/markdoc/components/Prompt/PromptShowHideButton.js +21 -0
  211. package/lib/markdoc/components/Prompt/PromptToggleLabel.d.ts +7 -0
  212. package/lib/markdoc/components/Prompt/PromptToggleLabel.js +28 -0
  213. package/lib/markdoc/components/Prompt/variables.d.ts +1 -0
  214. package/lib/markdoc/components/Prompt/variables.dark.d.ts +1 -0
  215. package/lib/markdoc/components/Prompt/variables.dark.js +8 -0
  216. package/lib/markdoc/components/Prompt/variables.js +44 -0
  217. package/lib/markdoc/components/Tabs/TabList.js +8 -6
  218. package/lib/markdoc/components/default.d.ts +1 -0
  219. package/lib/markdoc/components/default.js +1 -0
  220. package/lib/markdoc/default.d.ts +2 -0
  221. package/lib/markdoc/default.js +2 -0
  222. package/lib/markdoc/tags/code-walkthrough.d.ts +1 -1
  223. package/lib/markdoc/tags/connect-mcp.js +15 -0
  224. package/lib/markdoc/tags/prompt.d.ts +2 -0
  225. package/lib/markdoc/tags/prompt.js +56 -0
  226. package/package.json +4 -8
  227. package/src/components/Buttons/ConnectMCPButton.tsx +21 -16
  228. package/src/components/Buttons/variables.ts +4 -0
  229. package/src/components/Catalog/Catalog.tsx +6 -4
  230. package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.tsx +3 -1
  231. package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +2 -2
  232. package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +1 -1
  233. package/src/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.tsx +37 -22
  234. package/src/components/Catalog/CatalogFilter/CatalogFilterDateRange.tsx +3 -2
  235. package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.tsx +1 -1
  236. package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.tsx +2 -2
  237. package/src/components/CodeBlock/CodeBlockControls.tsx +4 -7
  238. package/src/components/Consent/Consent.tsx +18 -0
  239. package/src/components/Consent/ConsentBanner.tsx +110 -0
  240. package/src/components/Consent/ConsentDialog.tsx +210 -0
  241. package/src/components/Consent/ConsentSettingsLink.tsx +44 -0
  242. package/src/components/Consent/variables.ts +28 -0
  243. package/src/components/Dropdown/Dropdown.tsx +32 -7
  244. package/src/components/Dropdown/DropdownMenu.tsx +7 -1
  245. package/src/components/Feedback/Reasons.tsx +3 -2
  246. package/src/components/Filter/FilterCheckboxes.tsx +33 -18
  247. package/src/components/Filter/FilterDateRange.tsx +3 -2
  248. package/src/components/Footer/Footer.tsx +2 -0
  249. package/src/components/Image/Image.tsx +26 -5
  250. package/src/components/JsonViewer/Helpers.tsx +51 -54
  251. package/src/components/JsonViewer/JsonViewer.tsx +23 -25
  252. package/src/components/LoadProgressBar/LoadProgressBar.tsx +113 -0
  253. package/src/components/MCP/McpConnectionTabs.tsx +22 -5
  254. package/src/components/Markdown/Markdown.tsx +3 -2
  255. package/src/components/Markdown/styles/base-table.ts +14 -1
  256. package/src/components/Markdown/variables.ts +1 -0
  257. package/src/components/Menu/Menu.tsx +5 -0
  258. package/src/components/Menu/MenuSelect.tsx +198 -0
  259. package/src/components/Menu/variables.ts +43 -4
  260. package/src/components/Navbar/Navbar.tsx +22 -5
  261. package/src/components/Navbar/variables.ts +3 -0
  262. package/src/components/NavigationTabs/NavigationTab.tsx +148 -0
  263. package/src/components/NavigationTabs/NavigationTabContent.tsx +66 -0
  264. package/src/components/NavigationTabs/NavigationTabMenu.tsx +40 -0
  265. package/src/components/NavigationTabs/NavigationTabs.tsx +83 -0
  266. package/src/components/NavigationTabs/variables.ts +34 -0
  267. package/src/components/Portal/Portal.tsx +4 -2
  268. package/src/components/Product/utils.ts +1 -1
  269. package/src/components/Search/SearchAiActionButtons.tsx +31 -19
  270. package/src/components/Search/SearchAiActivity.tsx +318 -0
  271. package/src/components/Search/SearchAiConversationInput.tsx +13 -7
  272. package/src/components/Search/SearchAiDialog.tsx +20 -4
  273. package/src/components/Search/SearchAiMessage.tsx +28 -136
  274. package/src/components/Search/SearchAiResponse.tsx +1 -0
  275. package/src/components/Search/SearchDialog.tsx +11 -0
  276. package/src/components/Search/SearchItem.tsx +19 -10
  277. package/src/components/Search/SearchTrigger.tsx +47 -3
  278. package/src/components/Search/variables.ts +17 -2
  279. package/src/components/Segmented/Segmented.tsx +25 -16
  280. package/src/components/Select/Select.tsx +12 -6
  281. package/src/components/Select/SelectInput.tsx +10 -18
  282. package/src/components/Sidebar/Sidebar.tsx +2 -2
  283. package/src/components/SplitButton/SplitButton.tsx +8 -2
  284. package/src/components/TableOfContent/TableOfContent.tsx +2 -2
  285. package/src/core/constants/common.ts +1 -0
  286. package/src/core/constants/consent.ts +29 -0
  287. package/src/core/constants/index.ts +2 -0
  288. package/src/core/constants/mcp.ts +3 -9
  289. package/src/core/constants/prompt.ts +34 -0
  290. package/src/core/constants/search.ts +6 -2
  291. package/src/core/contexts/PortalContainerContext.tsx +4 -0
  292. package/src/core/hooks/__mocks__/index.ts +5 -0
  293. package/src/core/hooks/__mocks__/use-theme-hooks.ts +20 -0
  294. package/src/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.ts +1 -2
  295. package/src/core/hooks/code-walkthrough/__mocks__/mock-intersection-observer.ts +1 -2
  296. package/src/core/hooks/code-walkthrough/use-code-panel.ts +1 -1
  297. package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +2 -2
  298. package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +1 -1
  299. package/src/core/hooks/code-walkthrough/use-code-walkthrough.ts +3 -3
  300. package/src/core/hooks/code-walkthrough/use-renderable-files.ts +1 -1
  301. package/src/core/hooks/index.ts +9 -0
  302. package/src/core/hooks/menu/use-collapse.ts +1 -1
  303. package/src/core/hooks/menu/use-mobile-menu-items.ts +91 -56
  304. package/src/core/hooks/menu/use-mobile-menu-levels.ts +14 -6
  305. package/src/core/hooks/prompt/use-prompt-actions.ts +28 -0
  306. package/src/core/hooks/prompt/use-prompt-text-limit.ts +59 -0
  307. package/src/core/hooks/search/use-persisted-quick-filter.ts +125 -0
  308. package/src/core/hooks/search/use-search-ai-activity.ts +31 -0
  309. package/src/core/hooks/use-connect-mcp-button.ts +13 -2
  310. package/src/core/hooks/use-consent-dialog.ts +51 -0
  311. package/src/core/hooks/use-consent-telemetry.ts +56 -0
  312. package/src/core/hooks/use-dialog-hotkeys.ts +11 -5
  313. package/src/core/hooks/use-full-height.ts +8 -8
  314. package/src/core/hooks/use-page-actions.ts +21 -9
  315. package/src/core/hooks/use-pointer-border-highlight.ts +46 -0
  316. package/src/core/hooks/use-scroll-item-into-view.ts +18 -0
  317. package/src/core/hooks/use-tab-list.ts +63 -0
  318. package/src/core/hooks/use-telemetry-fallback.ts +2 -0
  319. package/src/core/hooks/use-theme-hooks.ts +16 -0
  320. package/src/core/styles/dark.ts +2 -0
  321. package/src/core/styles/global.ts +96 -116
  322. package/src/core/styles/index.ts +2 -1
  323. package/src/core/styles/search-ai-appear.ts +16 -0
  324. package/src/core/types/code-walkthrough.ts +103 -0
  325. package/src/core/types/consent.ts +51 -0
  326. package/src/core/types/dropdown.ts +1 -0
  327. package/src/core/types/hooks.ts +8 -0
  328. package/src/core/types/index.ts +4 -0
  329. package/src/core/types/l10n.ts +46 -2
  330. package/src/core/types/mcp.ts +4 -2
  331. package/src/core/types/navigation-tabs.ts +54 -0
  332. package/src/core/types/prompt.ts +11 -0
  333. package/src/core/types/search.ts +23 -0
  334. package/src/core/utils/Dynamic.tsx +67 -35
  335. package/src/core/utils/assign-ref.ts +9 -0
  336. package/src/core/utils/consent-settings-link-placement.ts +18 -0
  337. package/src/core/utils/content-segments.ts +98 -6
  338. package/src/core/utils/download-code-walkthrough.ts +1 -1
  339. package/src/core/utils/dropdown.ts +14 -0
  340. package/src/core/utils/get-ai-prompt-link.ts +30 -0
  341. package/src/core/utils/get-code-walkthrough-file-text.ts +1 -1
  342. package/src/core/utils/index.ts +5 -0
  343. package/src/core/utils/match-code-walkthrough-conditions.ts +1 -1
  344. package/src/core/utils/mcp.ts +16 -4
  345. package/src/core/utils/menu.ts +54 -9
  346. package/src/core/utils/navigation-tabs.ts +99 -0
  347. package/src/core/utils/search-ai-activity.ts +110 -0
  348. package/src/core/utils/urls.ts +3 -1
  349. package/src/core/utils/with-load-progress.ts +23 -18
  350. package/src/ext/configure.ts +1 -1
  351. package/src/icons/CheckboxIcon/CheckboxIcon.tsx +1 -0
  352. package/src/icons/ChevronSortIcon/ChevronSortIcon.tsx +1 -0
  353. package/src/icons/ExpandCollapseIcon/ExpandCollapseIcon.tsx +56 -0
  354. package/src/icons/LinkIcon/LinkIconSymbol.tsx +51 -0
  355. package/src/index.ts +8 -0
  356. package/src/layouts/PageLayout.tsx +1 -1
  357. package/src/layouts/RootLayout.tsx +2 -2
  358. package/src/markdoc/components/CodeWalkthrough/CodeFilters.tsx +2 -2
  359. package/src/markdoc/components/CodeWalkthrough/CodePanel.tsx +4 -4
  360. package/src/markdoc/components/CodeWalkthrough/CodePanelHeader.tsx +1 -1
  361. package/src/markdoc/components/CodeWalkthrough/CodePanelToolbar.tsx +1 -1
  362. package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +1 -1
  363. package/src/markdoc/components/CodeWalkthrough/CodeWalkthrough.tsx +2 -2
  364. package/src/markdoc/components/Prompt/Prompt.tsx +219 -0
  365. package/src/markdoc/components/Prompt/PromptActions.tsx +104 -0
  366. package/src/markdoc/components/Prompt/PromptBody.tsx +107 -0
  367. package/src/markdoc/components/Prompt/PromptCopyButton.tsx +73 -0
  368. package/src/markdoc/components/Prompt/PromptHeader.tsx +81 -0
  369. package/src/markdoc/components/Prompt/PromptShowHideButton.tsx +43 -0
  370. package/src/markdoc/components/Prompt/PromptToggleLabel.tsx +41 -0
  371. package/src/markdoc/components/Prompt/variables.dark.ts +5 -0
  372. package/src/markdoc/components/Prompt/variables.ts +41 -0
  373. package/src/markdoc/components/Tabs/TabList.tsx +9 -12
  374. package/src/markdoc/components/default.ts +1 -0
  375. package/src/markdoc/default.ts +2 -0
  376. package/src/markdoc/tags/code-walkthrough.ts +1 -1
  377. package/src/markdoc/tags/connect-mcp.ts +16 -1
  378. package/src/markdoc/tags/prompt.ts +58 -0
@@ -1,22 +1,107 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.splitContentByToolCalls = splitContentByToolCalls;
4
+ exports.groupToolCallSegments = groupToolCallSegments;
5
+ exports.hasToolCallsAndText = hasToolCallsAndText;
6
+ const SENTENCE_END_MARKS = '.!?:;';
7
+ const CLOSING_MARKS = `"')]*_\``;
8
+ const CODE_FENCE = /^[ \t]*(```|~~~)/gm;
9
+ /**
10
+ * Splits an answer at its tool calls. A call made in the middle of a sentence or a code block is
11
+ * placed at the end of that paragraph, so the sentence reads as one piece.
12
+ */
4
13
  function splitContentByToolCalls(content, toolCalls) {
5
14
  if (!toolCalls || toolCalls.length === 0) {
6
15
  return [{ type: 'text', text: content || '' }];
7
16
  }
17
+ const text = content !== null && content !== void 0 ? content : '';
18
+ const fences = Array.from(text.matchAll(CODE_FENCE), (match) => match.index);
8
19
  const segments = [];
9
20
  let lastPos = 0;
10
21
  for (const toolCall of toolCalls) {
11
- if (content && toolCall.position > lastPos) {
12
- segments.push({ type: 'text', text: content.substring(lastPos, toolCall.position) });
22
+ const position = Math.max(lastPos, getBlockBoundary(text, toolCall.position, fences));
23
+ if (position > lastPos) {
24
+ segments.push({ type: 'text', text: text.substring(lastPos, position) });
13
25
  }
14
26
  segments.push({ type: 'tool', toolCall });
15
- lastPos = toolCall.position;
27
+ lastPos = position;
16
28
  }
17
- if (content && lastPos < content.length) {
18
- segments.push({ type: 'text', text: content.substring(lastPos) });
29
+ if (lastPos < text.length) {
30
+ segments.push({ type: 'text', text: text.substring(lastPos) });
19
31
  }
20
32
  return segments;
21
33
  }
34
+ function getBlockBoundary(content, position, fences) {
35
+ if (position <= 0 || position >= content.length) {
36
+ return position;
37
+ }
38
+ const isInsideCodeFence = (index) => {
39
+ let count = 0;
40
+ while (count < fences.length && fences[count] < index)
41
+ count++;
42
+ return count % 2 === 1;
43
+ };
44
+ if (!isInsideCodeFence(position) && endsBlockOrSentence(content, position)) {
45
+ return position;
46
+ }
47
+ for (let boundary = content.indexOf('\n\n', position); boundary !== -1; boundary = content.indexOf('\n\n', boundary + 2)) {
48
+ if (!isInsideCodeFence(boundary)) {
49
+ return boundary;
50
+ }
51
+ }
52
+ return content.length;
53
+ }
54
+ function endsBlockOrSentence(content, position) {
55
+ let index = position - 1;
56
+ while (index >= 0 && /\s/.test(content[index])) {
57
+ if (content[index] === '\n')
58
+ return true;
59
+ index--;
60
+ }
61
+ while (index >= 0 && CLOSING_MARKS.includes(content[index]))
62
+ index--;
63
+ return index >= 0 && SENTENCE_END_MARKS.includes(content[index]);
64
+ }
65
+ /**
66
+ * Groups consecutive tool calls and drops text that is only whitespace. While the answer is
67
+ * generated, an answer with nothing to show yet is one empty active group (the thinking status),
68
+ * and the last group is active until text that is not whitespace follows it.
69
+ */
70
+ function groupToolCallSegments(segments, isGenerating) {
71
+ var _a;
72
+ var _b;
73
+ const grouped = [];
74
+ let text = '';
75
+ for (const segment of segments) {
76
+ if (segment.type === 'text') {
77
+ text += segment.text;
78
+ if (segment.text.trim()) {
79
+ grouped.push(segment);
80
+ }
81
+ continue;
82
+ }
83
+ const previous = grouped.at(-1);
84
+ if ((previous === null || previous === void 0 ? void 0 : previous.type) === 'tools') {
85
+ previous.toolCalls.push(segment.toolCall);
86
+ }
87
+ else {
88
+ grouped.push({ type: 'tools', toolCalls: [segment.toolCall], isActive: false });
89
+ }
90
+ }
91
+ if (!isGenerating) {
92
+ return grouped;
93
+ }
94
+ const last = grouped.at(-1);
95
+ if ((last === null || last === void 0 ? void 0 : last.type) === 'tools') {
96
+ last.isActive = !text.slice((_b = (_a = last.toolCalls.at(-1)) === null || _a === void 0 ? void 0 : _a.position) !== null && _b !== void 0 ? _b : 0).trim();
97
+ }
98
+ else if (grouped.length === 0) {
99
+ return [{ type: 'tools', toolCalls: [], isActive: true }];
100
+ }
101
+ return grouped;
102
+ }
103
+ function hasToolCallsAndText(segments) {
104
+ return (segments.some((segment) => segment.type === 'tool') &&
105
+ segments.some((segment) => segment.type === 'text' && segment.text.trim().length > 0));
106
+ }
22
107
  //# sourceMappingURL=content-segments.js.map
@@ -1,4 +1,4 @@
1
- import type { CodeWalkthroughFile } from '@redocly/config';
1
+ import type { CodeWalkthroughFile } from '../../core/types';
2
2
  export declare function downloadCodeWalkthrough(files: CodeWalkthroughFile[], state: Record<string, {
3
3
  value: string | boolean;
4
4
  }>, inputsState: Record<string, {
@@ -0,0 +1,2 @@
1
+ import type { DropdownAlignment } from '../types/dropdown';
2
+ export declare function fitDropdownAlignment(anchor: DOMRect, menuWidth: number, alignment?: DropdownAlignment): DropdownAlignment;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fitDropdownAlignment = fitDropdownAlignment;
4
+ function fitDropdownAlignment(anchor, menuWidth, alignment = 'start') {
5
+ const fits = {
6
+ start: anchor.left + menuWidth <= window.innerWidth,
7
+ end: anchor.right - menuWidth >= 0,
8
+ };
9
+ const other = alignment === 'end' ? 'start' : 'end';
10
+ return fits[alignment] || !fits[other] ? alignment : other;
11
+ }
12
+ //# sourceMappingURL=dropdown.js.map
@@ -0,0 +1,15 @@
1
+ import type { AiPromptTarget } from '../types/prompt';
2
+ /**
3
+ * Builds a link that opens an AI tool with the prompt prefilled.
4
+ *
5
+ * @param target - The AI tool to open.
6
+ * @param prompt - The plain-text prompt to prefill.
7
+ * @returns The absolute URL with the encoded prompt in the query string.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * getAiPromptLink('claude', 'Summarize this page');
12
+ * // 'https://claude.ai/new?q=Summarize+this+page'
13
+ * ```
14
+ */
15
+ export declare function getAiPromptLink(target: AiPromptTarget, prompt: string): string;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAiPromptLink = getAiPromptLink;
4
+ const AI_PROMPT_ENDPOINTS = {
5
+ chatgpt: { baseUrl: 'https://chat.openai.com', queryParam: 'q' },
6
+ claude: { baseUrl: 'https://claude.ai/new', queryParam: 'q' },
7
+ // Encoding: https://cursor.com/docs/integrations/deeplinks
8
+ cursor: { baseUrl: 'https://cursor.com/link/prompt', queryParam: 'text' },
9
+ };
10
+ /**
11
+ * Builds a link that opens an AI tool with the prompt prefilled.
12
+ *
13
+ * @param target - The AI tool to open.
14
+ * @param prompt - The plain-text prompt to prefill.
15
+ * @returns The absolute URL with the encoded prompt in the query string.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * getAiPromptLink('claude', 'Summarize this page');
20
+ * // 'https://claude.ai/new?q=Summarize+this+page'
21
+ * ```
22
+ */
23
+ function getAiPromptLink(target, prompt) {
24
+ const { baseUrl, queryParam } = AI_PROMPT_ENDPOINTS[target];
25
+ const url = new URL(baseUrl);
26
+ url.searchParams.set(queryParam, prompt);
27
+ return url.toString();
28
+ }
29
+ //# sourceMappingURL=get-ai-prompt-link.js.map
@@ -1,4 +1,4 @@
1
- import type { CodeWalkthroughFile } from '@redocly/config';
1
+ import type { CodeWalkthroughFile } from '../../core/types';
2
2
  export declare function getCodeWalkthroughFileText(file: CodeWalkthroughFile, state: Record<string, {
3
3
  value: string | boolean;
4
4
  }>, inputsState: Record<string, {
@@ -17,6 +17,7 @@ export * from './type-guards';
17
17
  export * from './dom';
18
18
  export * from './toc';
19
19
  export * from './menu';
20
+ export * from './navigation-tabs';
20
21
  export * from './load-and-navigate';
21
22
  export * from './get-scorecard-color-variable';
22
23
  export * from './change-text-casing';
@@ -49,3 +50,7 @@ export * from './tooltip-placement';
49
50
  export * from './telemetry/get-base-data-attributes';
50
51
  export * from './telemetry/generate-before-after-context';
51
52
  export * from './RenderWithLink';
53
+ export * from './consent-settings-link-placement';
54
+ export * from './assign-ref';
55
+ export * from './dropdown';
56
+ export * from './get-ai-prompt-link';
@@ -33,6 +33,7 @@ __exportStar(require("./type-guards"), exports);
33
33
  __exportStar(require("./dom"), exports);
34
34
  __exportStar(require("./toc"), exports);
35
35
  __exportStar(require("./menu"), exports);
36
+ __exportStar(require("./navigation-tabs"), exports);
36
37
  __exportStar(require("./load-and-navigate"), exports);
37
38
  __exportStar(require("./get-scorecard-color-variable"), exports);
38
39
  __exportStar(require("./change-text-casing"), exports);
@@ -65,4 +66,8 @@ __exportStar(require("./tooltip-placement"), exports);
65
66
  __exportStar(require("./telemetry/get-base-data-attributes"), exports);
66
67
  __exportStar(require("./telemetry/generate-before-after-context"), exports);
67
68
  __exportStar(require("./RenderWithLink"), exports);
69
+ __exportStar(require("./consent-settings-link-placement"), exports);
70
+ __exportStar(require("./assign-ref"), exports);
71
+ __exportStar(require("./dropdown"), exports);
72
+ __exportStar(require("./get-ai-prompt-link"), exports);
68
73
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import type { CodeWalkthroughConditionsObject } from '@redocly/config';
1
+ import type { CodeWalkthroughConditionsObject } from '../../core/types';
2
2
  export declare function matchCodeWalkthroughConditions(conditions: CodeWalkthroughConditionsObject | undefined, state: Record<string, {
3
3
  value: string | boolean;
4
4
  }>): boolean;
@@ -1,4 +1,5 @@
1
- import type { MCPClientType, McpConnectionParams } from '../types';
1
+ import type { MCPClientType, McpConnectionParams, MCPOption } from '../types';
2
+ export declare function isMCPOption(value: unknown): value is MCPOption;
2
3
  export declare function generateMCPDeepLink(clientType: MCPClientType, config: McpConnectionParams): string;
3
4
  export declare function slugifyMcpServerName(name: string): string;
4
5
  export declare function generateClaudeCodeCommand(config: McpConnectionParams): string;
@@ -1,10 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isMCPOption = isMCPOption;
3
4
  exports.generateMCPDeepLink = generateMCPDeepLink;
4
5
  exports.slugifyMcpServerName = slugifyMcpServerName;
5
6
  exports.generateClaudeCodeCommand = generateClaudeCodeCommand;
6
7
  exports.generateCodexCommand = generateCodexCommand;
7
8
  exports.generateMcpInstallPrompt = generateMcpInstallPrompt;
9
+ const mcp_1 = require("../constants/mcp");
10
+ function isMCPOption(value) {
11
+ return mcp_1.MCP_OPTIONS.includes(value);
12
+ }
8
13
  function generateCursorMCPDeepLink(config) {
9
14
  const cursorConfig = {
10
15
  url: config.url,
@@ -22,14 +27,19 @@ function generateVSCodeMCPDeepLink(config) {
22
27
  const encodedConfig = encodeURIComponent(JSON.stringify(vscodeConfig));
23
28
  return `vscode:mcp/install?${encodedConfig}`;
24
29
  }
30
+ function generateClaudeConnectorLink(config) {
31
+ const connectorName = encodeURIComponent(config.serverName);
32
+ const connectorUrl = encodeURIComponent(config.url);
33
+ return `https://claude.ai/customize/connectors?modal=add-custom-connector&connectorName=${connectorName}&connectorUrl=${connectorUrl}`;
34
+ }
25
35
  function generateMCPDeepLink(clientType, config) {
26
36
  switch (clientType) {
27
37
  case 'cursor':
28
38
  return generateCursorMCPDeepLink(config);
29
39
  case 'vscode':
30
40
  return generateVSCodeMCPDeepLink(config);
31
- default:
32
- return generateCursorMCPDeepLink(config);
41
+ case 'claude':
42
+ return generateClaudeConnectorLink(config);
33
43
  }
34
44
  }
35
45
  // Server names can contain spaces (e.g. "Docs MCP server") which break bare CLI
@@ -38,7 +48,7 @@ function slugifyMcpServerName(name) {
38
48
  return name
39
49
  .toLowerCase()
40
50
  .replace(/[^a-z0-9_-]+/g, '-')
41
- .replace(/^-+|-+$/g, '');
51
+ .replace(/^-+|(?<!-)-+$/g, '');
42
52
  }
43
53
  function generateClaudeCodeCommand(config) {
44
54
  return `claude mcp add --transport http ${slugifyMcpServerName(config.serverName)} ${config.url}`;
@@ -2,9 +2,13 @@ import type { ResolvedNavItem, Version } from '@redocly/config';
2
2
  import type { Location } from 'react-router';
3
3
  import type { Locale, TFunction } from '../types/l10n';
4
4
  import type { ItemState } from '../types/sidebar';
5
+ import type { NavigationTabsState } from '../types/navigation-tabs';
5
6
  import { MenuItemType } from '../constants/common';
6
7
  export declare const mapNavbarItems: (items: ResolvedNavItem[], defaultLocale: string, currentLocale: string, locales: Locale[], location: Location) => ItemState[];
7
8
  export declare const isItemActive: (item: ResolvedNavItem, defaultLocale: string, currentLocale: string, locales: Locale[], location: Location) => boolean;
8
9
  export declare const buildLanguagesGroup: (locales: Locale[], defaultLocale: string, currentLocale: string) => ResolvedNavItem | undefined;
9
10
  export declare const buildVersionSection: (translate: TFunction, versions: Version[], activeVersion?: Version) => ResolvedNavItem[];
11
+ export declare const buildNavigationTabsSelect: ({ navigationTabs, }: {
12
+ navigationTabs: NavigationTabsState | undefined;
13
+ }) => ItemState | undefined;
10
14
  export declare function getMenuItemType(item: ItemState): MenuItemType;
@@ -1,24 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildVersionSection = exports.buildLanguagesGroup = exports.isItemActive = exports.mapNavbarItems = void 0;
3
+ exports.buildNavigationTabsSelect = exports.buildVersionSection = exports.buildLanguagesGroup = exports.isItemActive = exports.mapNavbarItems = void 0;
4
4
  exports.getMenuItemType = getMenuItemType;
5
5
  const common_1 = require("../constants/common");
6
6
  const urls_1 = require("./urls");
7
+ const navigation_tabs_1 = require("./navigation-tabs");
7
8
  const TRANSLATION_KEYS = {
8
9
  version: 'mobileMenu.version',
9
10
  };
10
11
  const mapNavbarItems = (items, defaultLocale, currentLocale, locales, location) => {
11
- return items.map((navItem) => { var _a; return (Object.assign(Object.assign(Object.assign(Object.assign({}, navItem), (navItem.items && {
12
+ return items.map((navItem) => { var _a; return (Object.assign(Object.assign(Object.assign({}, navItem), (navItem.items && {
12
13
  items: (0, exports.mapNavbarItems)(navItem.items, defaultLocale, currentLocale, locales, location),
13
- })), ('link' in navItem && { link: navItem.link || '/' })), { active: 'link' in navItem &&
14
- (0, exports.isItemActive)(navItem, defaultLocale, currentLocale, locales, location), hasActiveSubItem: !!((_a = navItem.items) === null || _a === void 0 ? void 0 : _a.find((item) => (0, exports.isItemActive)(item, defaultLocale, currentLocale, locales, location))) })); });
14
+ })), { active: (0, exports.isItemActive)(navItem, defaultLocale, currentLocale, locales, location), hasActiveSubItem: !!((_a = navItem.items) === null || _a === void 0 ? void 0 : _a.find((item) => (0, exports.isItemActive)(item, defaultLocale, currentLocale, locales, location))) })); });
15
15
  };
16
16
  exports.mapNavbarItems = mapNavbarItems;
17
17
  const isItemActive = (item, defaultLocale, currentLocale, locales, location) => {
18
+ if (!item.link)
19
+ return false;
18
20
  const pathHash = location.pathname + location.hash;
19
21
  const link = item.languageInsensitive
20
- ? item.link || ''
21
- : (0, urls_1.getPathnameForLocale)(item.link || '/', defaultLocale, currentLocale, locales);
22
+ ? item.link
23
+ : (0, urls_1.getPathnameForLocale)(item.link, defaultLocale, currentLocale, locales);
22
24
  return pathHash === (0, urls_1.withPathPrefix)(link);
23
25
  };
24
26
  exports.isItemActive = isItemActive;
@@ -34,7 +36,7 @@ const buildLanguagesGroup = (locales, defaultLocale, currentLocale) => {
34
36
  .filter((locale) => locale.code !== currentLocale)
35
37
  .map((locale) => {
36
38
  const newLangPathname = (0, urls_1.getPathnameForLocale)((0, urls_1.withoutPathPrefix)(location.pathname), defaultLocale, locale.code, locales);
37
- const newUrlWithLanguage = `${newLangPathname}${location.search}${location.hash}`;
39
+ const newUrlWithLanguage = `${(0, urls_1.addLeadingSlash)(newLangPathname)}${location.search}${location.hash}`;
38
40
  return {
39
41
  type: 'link',
40
42
  label: locale.name || locale.code || '',
@@ -71,9 +73,30 @@ const buildVersionSection = (translate, versions, activeVersion) => {
71
73
  ];
72
74
  };
73
75
  exports.buildVersionSection = buildVersionSection;
76
+ const buildNavigationTabsSelect = ({ navigationTabs, }) => {
77
+ var _a;
78
+ var _b;
79
+ const tabs = (_a = (0, navigation_tabs_1.toNavigationTabsConfig)({ state: navigationTabs })) === null || _a === void 0 ? void 0 : _a.items;
80
+ if (!tabs) {
81
+ return;
82
+ }
83
+ const activeTab = tabs.find((tab) => tab.active);
84
+ return {
85
+ type: common_1.MenuItemType.Select,
86
+ label: (_b = activeTab === null || activeTab === void 0 ? void 0 : activeTab.label) !== null && _b !== void 0 ? _b : 'Navigation tabs',
87
+ labelTranslationKey: activeTab ? activeTab.labelTranslationKey : 'navigationTabs.label',
88
+ items: tabs.map(toNavigationTabOption),
89
+ active: false,
90
+ hasActiveSubItem: !!activeTab,
91
+ };
92
+ };
93
+ exports.buildNavigationTabsSelect = buildNavigationTabsSelect;
74
94
  function getMenuItemType(item) {
75
95
  var _a, _b;
76
- if (item.type === common_1.MenuItemType.Separator) {
96
+ if (item.type === common_1.MenuItemType.Select) {
97
+ return common_1.MenuItemType.Select;
98
+ }
99
+ else if (item.type === common_1.MenuItemType.Separator) {
77
100
  return common_1.MenuItemType.Separator;
78
101
  }
79
102
  else if (item.menuStyle === 'drilldown') {
@@ -88,4 +111,21 @@ function getMenuItemType(item) {
88
111
  else
89
112
  return common_1.MenuItemType.Default;
90
113
  }
114
+ function toNavigationTabOption(tab) {
115
+ var _a;
116
+ const landing = tab.type === 'group' ? ((_a = tab.items.find((entry) => entry.active)) !== null && _a !== void 0 ? _a : tab.items[0]) : tab;
117
+ return {
118
+ type: tab.type,
119
+ label: tab.label,
120
+ labelTranslationKey: tab.labelTranslationKey,
121
+ icon: tab.icon,
122
+ srcSet: tab.srcSet,
123
+ link: landing === null || landing === void 0 ? void 0 : landing.link,
124
+ external: landing === null || landing === void 0 ? void 0 : landing.external,
125
+ target: landing === null || landing === void 0 ? void 0 : landing.target,
126
+ items: [],
127
+ active: !!tab.active,
128
+ hasActiveSubItem: false,
129
+ };
130
+ }
91
131
  //# sourceMappingURL=menu.js.map
@@ -0,0 +1,8 @@
1
+ import type { ThemeHooks } from '../types/hooks';
2
+ import type { NavigationTabsConfig, NavigationTabsState } from '../types/navigation-tabs';
3
+ type NavbarItemClickedPayload = Parameters<ReturnType<ThemeHooks['useTelemetry']>['sendNavbarMenuItemClickedMessage']>[0];
4
+ export declare function toNavigationTabsConfig({ state, }: {
5
+ state: NavigationTabsState | undefined;
6
+ }): NavigationTabsConfig | undefined;
7
+ export declare function getNavbarItemClickedPayload(type: 'link' | 'group'): NavbarItemClickedPayload;
8
+ export {};
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.toNavigationTabsConfig = toNavigationTabsConfig;
15
+ exports.getNavbarItemClickedPayload = getNavbarItemClickedPayload;
16
+ const get_base_data_attributes_1 = require("./telemetry/get-base-data-attributes");
17
+ function toNavigationTabsConfig({ state, }) {
18
+ const items = toNavigationTabEntries(state).map((entry) => entry.kind === 'menu'
19
+ ? {
20
+ type: 'group',
21
+ label: entry.tab.label,
22
+ labelTranslationKey: entry.tab.labelTranslationKey,
23
+ icon: entry.tab.icon,
24
+ srcSet: entry.tab.srcSet,
25
+ items: entry.entries.map((_a) => {
26
+ var { active } = _a, link = __rest(_a, ["active"]);
27
+ return toRowLink(link, active);
28
+ }),
29
+ active: entry.active,
30
+ }
31
+ : toRowLink(entry.link, entry.active));
32
+ return items.length ? { items } : undefined;
33
+ }
34
+ function getNavbarItemClickedPayload(type) {
35
+ return [
36
+ Object.assign(Object.assign({}, (0, get_base_data_attributes_1.getBaseDataAttributes)('navbarItem', 'navbar')), { type }),
37
+ ];
38
+ }
39
+ function toNavigationTabEntries(state) {
40
+ if (!(state === null || state === void 0 ? void 0 : state.tabs.length))
41
+ return [];
42
+ return state.tabs.flatMap((tab) => {
43
+ var _a;
44
+ const active = ((_a = state.activeTab) === null || _a === void 0 ? void 0 : _a.tabId) === tab.tabId;
45
+ if (tab.menu) {
46
+ const entries = tab.menu
47
+ .filter((menuEntry) => !!menuEntry.link)
48
+ .map((_a) => { var _b; var { tabId } = _a, link = __rest(_a, ["tabId"]); return (Object.assign(Object.assign({}, link), { active: active && tabId === ((_b = state.activeMenuEntry) === null || _b === void 0 ? void 0 : _b.tabId) })); });
49
+ return entries.length ? [{ kind: 'menu', tab, entries, active }] : [];
50
+ }
51
+ if (!tab.link)
52
+ return [];
53
+ return [
54
+ {
55
+ kind: 'link',
56
+ link: {
57
+ label: tab.label,
58
+ labelTranslationKey: tab.labelTranslationKey,
59
+ link: tab.link,
60
+ icon: tab.icon,
61
+ srcSet: tab.srcSet,
62
+ },
63
+ active,
64
+ },
65
+ ];
66
+ });
67
+ }
68
+ function toRowLink(link, active) {
69
+ return Object.assign(Object.assign({ type: 'link' }, link), { active });
70
+ }
71
+ //# sourceMappingURL=navigation-tabs.js.map
@@ -0,0 +1,4 @@
1
+ import type { TFunction } from '../types/l10n';
2
+ import { type SearchAiActivityStatus, type SearchAiActivityStep, type ToolCall } from '../types/search';
3
+ export declare function getSearchAiActivityStatus(toolCalls: ToolCall[], isActive: boolean, runningToolCall: ToolCall | undefined, translate: TFunction): SearchAiActivityStatus;
4
+ export declare function getSearchAiActivityStep(toolCall: ToolCall, isRunning: boolean, translate: TFunction): SearchAiActivityStep;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSearchAiActivityStatus = getSearchAiActivityStatus;
4
+ exports.getSearchAiActivityStep = getSearchAiActivityStep;
5
+ const search_1 = require("../types/search");
6
+ const search_2 = require("../constants/search");
7
+ const type_guards_1 = require("./type-guards");
8
+ function getSearchAiActivityStatus(toolCalls, isActive, runningToolCall, translate) {
9
+ var _a;
10
+ const latestToolCall = toolCalls.at(-1);
11
+ if (!latestToolCall) {
12
+ return {
13
+ label: translate('search.ai.thinkingText', 'Thinking...'),
14
+ kind: 'thinking',
15
+ isRunning: true,
16
+ };
17
+ }
18
+ if (isActive || toolCalls.length === 1) {
19
+ const toolCall = runningToolCall !== null && runningToolCall !== void 0 ? runningToolCall : latestToolCall;
20
+ return Object.assign(Object.assign({}, getToolCallLabel(toolCall, !isActive, translate)), { kind: getSearchAiActivityKind(toolCall.name), isRunning: isActive });
21
+ }
22
+ const isSameTool = toolCalls.every((toolCall) => toolCall.name === latestToolCall.name);
23
+ const sharedText = isSameTool
24
+ ? (_a = search_2.TOOL_CALL_DISPLAY_TEXT[latestToolCall.name]) === null || _a === void 0 ? void 0 : _a.completedText
25
+ : undefined;
26
+ return {
27
+ label: sharedText !== null && sharedText !== void 0 ? sharedText : translate('search.ai.toolCall.usedTools', 'Used tools'),
28
+ kind: isSameTool ? getSearchAiActivityKind(latestToolCall.name) : 'code',
29
+ isRunning: false,
30
+ };
31
+ }
32
+ function getSearchAiActivityStep(toolCall, isRunning, translate) {
33
+ const detail = getToolCallDetail(toolCall);
34
+ const kind = getSearchAiActivityKind(toolCall.name);
35
+ if (toolCall.name === search_1.ToolCallName.SearchDocumentation && detail) {
36
+ return { id: toolCall.id, label: `“${detail}”`, kind, isRunning };
37
+ }
38
+ const { label } = getToolCallLabel(toolCall, !isRunning, translate);
39
+ return { id: toolCall.id, label: detail ? label : stripEllipsis(label), kind, isRunning };
40
+ }
41
+ function getToolCallLabel(toolCall, isCompleted, translate) {
42
+ const detail = getToolCallDetail(toolCall);
43
+ if (toolCall.name === search_1.ToolCallName.Execute && detail) {
44
+ return { label: detail };
45
+ }
46
+ const builtInText = search_2.TOOL_CALL_DISPLAY_TEXT[toolCall.name];
47
+ if (builtInText) {
48
+ const text = isCompleted ? builtInText.completedText : builtInText.inProgressText;
49
+ return detail ? { label: stripEllipsis(text), detail } : { label: text };
50
+ }
51
+ const prefix = isCompleted
52
+ ? translate('search.ai.toolCall.executed', 'Executed')
53
+ : translate('search.ai.toolCall.executing', 'Executing');
54
+ return { label: `${prefix} ${toolCall.name}` };
55
+ }
56
+ function getSearchAiActivityKind(name) {
57
+ if (name === search_1.ToolCallName.SearchDocumentation)
58
+ return 'search';
59
+ if (name === search_1.ToolCallName.ContactSupport)
60
+ return 'support';
61
+ return 'code';
62
+ }
63
+ function getToolCallDetail(toolCall) {
64
+ switch (toolCall.name) {
65
+ case search_1.ToolCallName.SearchDocumentation:
66
+ return getStringArg(toolCall.args, 'query');
67
+ case search_1.ToolCallName.Execute:
68
+ return getStringArg(toolCall.args, 'description');
69
+ default:
70
+ return undefined;
71
+ }
72
+ }
73
+ function getStringArg(args, name) {
74
+ if (!(0, type_guards_1.isObject)(args) || !(name in args)) {
75
+ return undefined;
76
+ }
77
+ const value = Reflect.get(args, name);
78
+ return typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined;
79
+ }
80
+ function stripEllipsis(text) {
81
+ return text.replace(/(\.{3}|…)$/, '');
82
+ }
83
+ //# sourceMappingURL=search-ai-activity.js.map
@@ -18,7 +18,9 @@ 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 ? res.replace(/[/\\]+$/, '') + '/' + relativeURL.replace(/^[/\\]+/, '') : res;
21
+ res = relativeURL
22
+ ? res.replace(/(?<![/\\])[/\\]+$/, '') + '/' + relativeURL.replace(/^[/\\]+/, '')
23
+ : res;
22
24
  }
23
25
  return res;
24
26
  }
@@ -1 +1,4 @@
1
+ /** Shows the load progress bar until the most recent `withLoadProgress` load settles. */
1
2
  export declare function withLoadProgress<T>(loadTarget: Promise<T>): Promise<T>;
3
+ export declare function subscribeToLoadProgress(listener: () => void): () => void;
4
+ export declare function isLoadInProgress(): boolean;
@@ -8,31 +8,36 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.withLoadProgress = withLoadProgress;
16
- const nprogress_1 = __importDefault(require("nprogress"));
17
- nprogress_1.default.configure({
18
- trickleSpeed: 100,
19
- template: '<div class="bar" role="bar"><div class="peg"></div></div>',
20
- });
21
- // Only the last caller should be able to call nprogress.done()
22
- let lastCalledBy;
13
+ exports.subscribeToLoadProgress = subscribeToLoadProgress;
14
+ exports.isLoadInProgress = isLoadInProgress;
15
+ let latestLoad = null;
16
+ const listeners = new Set();
17
+ function setLatestLoad(load) {
18
+ latestLoad = load;
19
+ // e2e suites wait for this class, named after the progress library it replaced, to clear.
20
+ document.documentElement.classList.toggle('nprogress-busy', load !== null);
21
+ listeners.forEach((listener) => listener());
22
+ }
23
+ /** Shows the load progress bar until the most recent `withLoadProgress` load settles. */
23
24
  function withLoadProgress(loadTarget) {
24
25
  return __awaiter(this, void 0, void 0, function* () {
25
- const callIdentifier = Symbol();
26
- lastCalledBy = callIdentifier;
27
- // Cancel any existing progress and restart
28
- nprogress_1.default.done();
29
- nprogress_1.default.start();
26
+ const load = Symbol();
27
+ setLatestLoad(load);
30
28
  return loadTarget.finally(() => {
31
- if (lastCalledBy === callIdentifier) {
32
- nprogress_1.default.done();
33
- nprogress_1.default.remove();
34
- }
29
+ if (latestLoad === load)
30
+ setLatestLoad(null);
35
31
  });
36
32
  });
37
33
  }
34
+ function subscribeToLoadProgress(listener) {
35
+ listeners.add(listener);
36
+ return () => {
37
+ listeners.delete(listener);
38
+ };
39
+ }
40
+ function isLoadInProgress() {
41
+ return latestLoad !== null;
42
+ }
38
43
  //# sourceMappingURL=with-load-progress.js.map
@@ -1,5 +1,5 @@
1
1
  import type { UserClaims, OpenAPIServer } from '../core/types';
2
- export * from '../ext/configure-helpers';
2
+ export type * from '../ext/configure-helpers';
3
3
  export * from '../ext/helpers/is-direct-configure-request-values';
4
4
  import type { ConfigureRequestValues, ConfigureServerRequestValues } from '../ext/configure-helpers';
5
5
  type Configure = {