@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.
- package/lib/components/Buttons/ConnectMCPButton.js +19 -14
- package/lib/components/Buttons/variables.d.ts +1 -0
- package/lib/components/Buttons/variables.js +4 -1
- package/lib/components/Catalog/Catalog.js +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.d.ts +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +1 -1
- package/lib/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.js +30 -11
- package/lib/components/Catalog/CatalogFilter/CatalogFilterDateRange.js +2 -1
- package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.js +1 -1
- package/lib/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.js +2 -2
- package/lib/components/CodeBlock/CodeBlockControls.js +3 -5
- package/lib/components/Consent/Consent.d.ts +2 -0
- package/lib/components/Consent/Consent.js +17 -0
- package/lib/components/Consent/ConsentBanner.d.ts +2 -0
- package/lib/components/Consent/ConsentBanner.js +120 -0
- package/lib/components/Consent/ConsentDialog.d.ts +2 -0
- package/lib/components/Consent/ConsentDialog.js +128 -0
- package/lib/components/Consent/ConsentSettingsLink.d.ts +2 -0
- package/lib/components/Consent/ConsentSettingsLink.js +35 -0
- package/lib/components/Consent/variables.d.ts +1 -0
- package/lib/components/Consent/variables.js +31 -0
- package/lib/components/Dropdown/Dropdown.d.ts +4 -2
- package/lib/components/Dropdown/Dropdown.js +31 -9
- package/lib/components/Dropdown/DropdownMenu.d.ts +1 -0
- package/lib/components/Dropdown/DropdownMenu.js +1 -1
- package/lib/components/Feedback/Reasons.js +3 -2
- package/lib/components/Filter/FilterCheckboxes.js +30 -11
- package/lib/components/Filter/FilterDateRange.js +36 -2
- package/lib/components/Footer/Footer.js +4 -1
- package/lib/components/Image/Image.js +24 -4
- package/lib/components/JsonViewer/Helpers.d.ts +10 -2
- package/lib/components/JsonViewer/Helpers.js +32 -36
- package/lib/components/JsonViewer/JsonViewer.js +15 -18
- package/lib/components/LoadProgressBar/LoadProgressBar.d.ts +8 -0
- package/lib/components/LoadProgressBar/LoadProgressBar.js +122 -0
- package/lib/components/MCP/McpConnectionTabs.js +9 -2
- package/lib/components/Markdown/Markdown.js +3 -2
- package/lib/components/Markdown/styles/base-table.js +14 -1
- package/lib/components/Markdown/variables.js +1 -0
- package/lib/components/Menu/Menu.js +4 -0
- package/lib/components/Menu/MenuSelect.d.ts +7 -0
- package/lib/components/Menu/MenuSelect.js +129 -0
- package/lib/components/Menu/variables.js +43 -4
- package/lib/components/Navbar/Navbar.js +44 -5
- package/lib/components/Navbar/variables.js +3 -0
- package/lib/components/NavigationTabs/NavigationTab.d.ts +7 -0
- package/lib/components/NavigationTabs/NavigationTab.js +93 -0
- package/lib/components/NavigationTabs/NavigationTabContent.d.ts +7 -0
- package/lib/components/NavigationTabs/NavigationTabContent.js +50 -0
- package/lib/components/NavigationTabs/NavigationTabMenu.d.ts +7 -0
- package/lib/components/NavigationTabs/NavigationTabMenu.js +18 -0
- package/lib/components/NavigationTabs/NavigationTabs.d.ts +7 -0
- package/lib/components/NavigationTabs/NavigationTabs.js +97 -0
- package/lib/components/NavigationTabs/variables.d.ts +1 -0
- package/lib/components/NavigationTabs/variables.js +37 -0
- package/lib/components/Portal/Portal.js +37 -5
- package/lib/components/Product/utils.js +1 -1
- package/lib/components/Search/SearchAiActionButtons.js +8 -3
- package/lib/components/Search/SearchAiActivity.d.ts +10 -0
- package/lib/components/Search/SearchAiActivity.js +278 -0
- package/lib/components/Search/SearchAiConversationInput.js +10 -6
- package/lib/components/Search/SearchAiDialog.js +13 -2
- package/lib/components/Search/SearchAiMessage.d.ts +2 -1
- package/lib/components/Search/SearchAiMessage.js +21 -109
- package/lib/components/Search/SearchAiResponse.js +1 -0
- package/lib/components/Search/SearchDialog.js +10 -0
- package/lib/components/Search/SearchItem.js +11 -10
- package/lib/components/Search/SearchTrigger.js +37 -6
- package/lib/components/Search/variables.js +17 -2
- package/lib/components/Segmented/Segmented.js +23 -3
- package/lib/components/Select/Select.js +10 -3
- package/lib/components/Select/SelectInput.d.ts +1 -0
- package/lib/components/Select/SelectInput.js +5 -11
- package/lib/components/Sidebar/Sidebar.js +2 -2
- package/lib/components/SplitButton/SplitButton.js +37 -3
- package/lib/components/TableOfContent/TableOfContent.js +2 -2
- package/lib/core/constants/common.d.ts +1 -0
- package/lib/core/constants/common.js +1 -0
- package/lib/core/constants/consent.d.ts +2 -0
- package/lib/core/constants/consent.js +30 -0
- package/lib/core/constants/index.d.ts +2 -0
- package/lib/core/constants/index.js +2 -0
- package/lib/core/constants/mcp.d.ts +2 -2
- package/lib/core/constants/mcp.js +3 -8
- package/lib/core/constants/prompt.d.ts +9 -0
- package/lib/core/constants/prompt.js +33 -0
- package/lib/core/constants/search.d.ts +1 -1
- package/lib/core/constants/search.js +6 -2
- package/lib/core/contexts/PortalContainerContext.d.ts +2 -0
- package/lib/core/contexts/PortalContainerContext.js +7 -0
- package/lib/core/hooks/code-walkthrough/use-code-panel.d.ts +1 -1
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.d.ts +1 -1
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +1 -1
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.d.ts +1 -1
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough.d.ts +1 -2
- package/lib/core/hooks/code-walkthrough/use-renderable-files.d.ts +1 -1
- package/lib/core/hooks/index.d.ts +9 -0
- package/lib/core/hooks/index.js +9 -0
- package/lib/core/hooks/menu/use-collapse.js +1 -1
- package/lib/core/hooks/menu/use-mobile-menu-items.js +75 -51
- package/lib/core/hooks/menu/use-mobile-menu-levels.js +12 -7
- package/lib/core/hooks/prompt/use-prompt-actions.d.ts +7 -0
- package/lib/core/hooks/prompt/use-prompt-actions.js +19 -0
- package/lib/core/hooks/prompt/use-prompt-text-limit.d.ts +19 -0
- package/lib/core/hooks/prompt/use-prompt-text-limit.js +35 -0
- package/lib/core/hooks/search/use-persisted-quick-filter.d.ts +21 -0
- package/lib/core/hooks/search/use-persisted-quick-filter.js +92 -0
- package/lib/core/hooks/search/use-search-ai-activity.d.ts +11 -0
- package/lib/core/hooks/search/use-search-ai-activity.js +15 -0
- package/lib/core/hooks/use-connect-mcp-button.js +3 -1
- package/lib/core/hooks/use-consent-dialog.d.ts +12 -0
- package/lib/core/hooks/use-consent-dialog.js +36 -0
- package/lib/core/hooks/use-consent-telemetry.d.ts +1 -0
- package/lib/core/hooks/use-consent-telemetry.js +42 -0
- package/lib/core/hooks/use-dialog-hotkeys.js +4 -2
- package/lib/core/hooks/use-full-height.d.ts +1 -1
- package/lib/core/hooks/use-full-height.js +8 -8
- package/lib/core/hooks/use-page-actions.d.ts +1 -1
- package/lib/core/hooks/use-page-actions.js +10 -8
- package/lib/core/hooks/use-pointer-border-highlight.d.ts +7 -0
- package/lib/core/hooks/use-pointer-border-highlight.js +29 -0
- package/lib/core/hooks/use-scroll-item-into-view.d.ts +2 -0
- package/lib/core/hooks/use-scroll-item-into-view.js +16 -0
- package/lib/core/hooks/use-tab-list.d.ts +31 -0
- package/lib/core/hooks/use-tab-list.js +49 -0
- package/lib/core/hooks/use-telemetry-fallback.d.ts +2 -0
- package/lib/core/hooks/use-telemetry-fallback.js +2 -0
- package/lib/core/hooks/use-theme-hooks.js +16 -0
- package/lib/core/styles/dark.js +14 -12
- package/lib/core/styles/global.d.ts +2 -0
- package/lib/core/styles/global.js +115 -136
- package/lib/core/styles/index.d.ts +1 -0
- package/lib/core/styles/index.js +3 -1
- package/lib/core/styles/search-ai-appear.d.ts +1 -0
- package/lib/core/styles/search-ai-appear.js +18 -0
- package/lib/core/types/code-walkthrough.d.ts +84 -0
- package/lib/core/types/consent.d.ts +54 -0
- package/lib/core/types/consent.js +3 -0
- package/lib/core/types/dropdown.d.ts +1 -0
- package/lib/core/types/dropdown.js +3 -0
- package/lib/core/types/hooks.d.ts +8 -1
- package/lib/core/types/index.d.ts +4 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/mcp.d.ts +3 -2
- package/lib/core/types/navigation-tabs.d.ts +49 -0
- package/lib/core/types/navigation-tabs.js +3 -0
- package/lib/core/types/prompt.d.ts +9 -0
- package/lib/core/types/prompt.js +3 -0
- package/lib/core/types/search.d.ts +25 -0
- package/lib/core/utils/Dynamic.d.ts +8 -1
- package/lib/core/utils/Dynamic.js +34 -3
- package/lib/core/utils/assign-ref.d.ts +2 -0
- package/lib/core/utils/assign-ref.js +12 -0
- package/lib/core/utils/consent-settings-link-placement.d.ts +3 -0
- package/lib/core/utils/consent-settings-link-placement.js +15 -0
- package/lib/core/utils/content-segments.d.ts +12 -1
- package/lib/core/utils/content-segments.js +90 -5
- package/lib/core/utils/download-code-walkthrough.d.ts +1 -1
- package/lib/core/utils/dropdown.d.ts +2 -0
- package/lib/core/utils/dropdown.js +12 -0
- package/lib/core/utils/get-ai-prompt-link.d.ts +15 -0
- package/lib/core/utils/get-ai-prompt-link.js +29 -0
- package/lib/core/utils/get-code-walkthrough-file-text.d.ts +1 -1
- package/lib/core/utils/index.d.ts +5 -0
- package/lib/core/utils/index.js +5 -0
- package/lib/core/utils/match-code-walkthrough-conditions.d.ts +1 -1
- package/lib/core/utils/mcp.d.ts +2 -1
- package/lib/core/utils/mcp.js +13 -3
- package/lib/core/utils/menu.d.ts +4 -0
- package/lib/core/utils/menu.js +48 -8
- package/lib/core/utils/navigation-tabs.d.ts +8 -0
- package/lib/core/utils/navigation-tabs.js +71 -0
- package/lib/core/utils/search-ai-activity.d.ts +4 -0
- package/lib/core/utils/search-ai-activity.js +83 -0
- package/lib/core/utils/urls.js +3 -1
- package/lib/core/utils/with-load-progress.d.ts +3 -0
- package/lib/core/utils/with-load-progress.js +24 -19
- package/lib/ext/configure.d.ts +1 -1
- package/lib/ext/configure.js +0 -1
- package/lib/icons/ExpandCollapseIcon/ExpandCollapseIcon.d.ts +29 -0
- package/lib/icons/ExpandCollapseIcon/ExpandCollapseIcon.js +81 -0
- package/lib/icons/LinkIcon/LinkIconSymbol.d.ts +12 -0
- package/lib/icons/LinkIcon/LinkIconSymbol.js +41 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +9 -1
- package/lib/layouts/PageLayout.js +1 -1
- package/lib/layouts/RootLayout.js +2 -2
- package/lib/markdoc/components/CodeWalkthrough/CodeFilters.d.ts +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodeFilters.js +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodePanel.d.ts +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +3 -3
- package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.d.ts +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodePanelToolbar.d.ts +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.d.ts +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.d.ts +1 -1
- package/lib/markdoc/components/CodeWalkthrough/CodeWalkthrough.js +1 -1
- package/lib/markdoc/components/Prompt/Prompt.d.ts +15 -0
- package/lib/markdoc/components/Prompt/Prompt.js +163 -0
- package/lib/markdoc/components/Prompt/PromptActions.d.ts +13 -0
- package/lib/markdoc/components/Prompt/PromptActions.js +43 -0
- package/lib/markdoc/components/Prompt/PromptBody.d.ts +14 -0
- package/lib/markdoc/components/Prompt/PromptBody.js +99 -0
- package/lib/markdoc/components/Prompt/PromptCopyButton.d.ts +10 -0
- package/lib/markdoc/components/Prompt/PromptCopyButton.js +28 -0
- package/lib/markdoc/components/Prompt/PromptHeader.d.ts +9 -0
- package/lib/markdoc/components/Prompt/PromptHeader.js +57 -0
- package/lib/markdoc/components/Prompt/PromptShowHideButton.d.ts +7 -0
- package/lib/markdoc/components/Prompt/PromptShowHideButton.js +21 -0
- package/lib/markdoc/components/Prompt/PromptToggleLabel.d.ts +7 -0
- package/lib/markdoc/components/Prompt/PromptToggleLabel.js +28 -0
- package/lib/markdoc/components/Prompt/variables.d.ts +1 -0
- package/lib/markdoc/components/Prompt/variables.dark.d.ts +1 -0
- package/lib/markdoc/components/Prompt/variables.dark.js +8 -0
- package/lib/markdoc/components/Prompt/variables.js +44 -0
- package/lib/markdoc/components/Tabs/TabList.js +8 -6
- package/lib/markdoc/components/default.d.ts +1 -0
- package/lib/markdoc/components/default.js +1 -0
- package/lib/markdoc/default.d.ts +2 -0
- package/lib/markdoc/default.js +2 -0
- package/lib/markdoc/tags/code-walkthrough.d.ts +1 -1
- package/lib/markdoc/tags/connect-mcp.js +15 -0
- package/lib/markdoc/tags/prompt.d.ts +2 -0
- package/lib/markdoc/tags/prompt.js +56 -0
- package/package.json +4 -8
- package/src/components/Buttons/ConnectMCPButton.tsx +21 -16
- package/src/components/Buttons/variables.ts +4 -0
- package/src/components/Catalog/Catalog.tsx +6 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.lazy.tsx +3 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityHistory/CatalogEntityHistorySidebar.tsx +2 -2
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +1 -1
- package/src/components/Catalog/CatalogFilter/CatalogFilterCheckboxes.tsx +37 -22
- package/src/components/Catalog/CatalogFilter/CatalogFilterDateRange.tsx +3 -2
- package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanel.tsx +1 -1
- package/src/components/Catalog/CatalogMobileFiltersPanel/CatalogMobileFiltersPanelOverlay.tsx +2 -2
- package/src/components/CodeBlock/CodeBlockControls.tsx +4 -7
- package/src/components/Consent/Consent.tsx +18 -0
- package/src/components/Consent/ConsentBanner.tsx +110 -0
- package/src/components/Consent/ConsentDialog.tsx +210 -0
- package/src/components/Consent/ConsentSettingsLink.tsx +44 -0
- package/src/components/Consent/variables.ts +28 -0
- package/src/components/Dropdown/Dropdown.tsx +32 -7
- package/src/components/Dropdown/DropdownMenu.tsx +7 -1
- package/src/components/Feedback/Reasons.tsx +3 -2
- package/src/components/Filter/FilterCheckboxes.tsx +33 -18
- package/src/components/Filter/FilterDateRange.tsx +3 -2
- package/src/components/Footer/Footer.tsx +2 -0
- package/src/components/Image/Image.tsx +26 -5
- package/src/components/JsonViewer/Helpers.tsx +51 -54
- package/src/components/JsonViewer/JsonViewer.tsx +23 -25
- package/src/components/LoadProgressBar/LoadProgressBar.tsx +113 -0
- package/src/components/MCP/McpConnectionTabs.tsx +22 -5
- package/src/components/Markdown/Markdown.tsx +3 -2
- package/src/components/Markdown/styles/base-table.ts +14 -1
- package/src/components/Markdown/variables.ts +1 -0
- package/src/components/Menu/Menu.tsx +5 -0
- package/src/components/Menu/MenuSelect.tsx +198 -0
- package/src/components/Menu/variables.ts +43 -4
- package/src/components/Navbar/Navbar.tsx +22 -5
- package/src/components/Navbar/variables.ts +3 -0
- package/src/components/NavigationTabs/NavigationTab.tsx +148 -0
- package/src/components/NavigationTabs/NavigationTabContent.tsx +66 -0
- package/src/components/NavigationTabs/NavigationTabMenu.tsx +40 -0
- package/src/components/NavigationTabs/NavigationTabs.tsx +83 -0
- package/src/components/NavigationTabs/variables.ts +34 -0
- package/src/components/Portal/Portal.tsx +4 -2
- package/src/components/Product/utils.ts +1 -1
- package/src/components/Search/SearchAiActionButtons.tsx +31 -19
- package/src/components/Search/SearchAiActivity.tsx +318 -0
- package/src/components/Search/SearchAiConversationInput.tsx +13 -7
- package/src/components/Search/SearchAiDialog.tsx +20 -4
- package/src/components/Search/SearchAiMessage.tsx +28 -136
- package/src/components/Search/SearchAiResponse.tsx +1 -0
- package/src/components/Search/SearchDialog.tsx +11 -0
- package/src/components/Search/SearchItem.tsx +19 -10
- package/src/components/Search/SearchTrigger.tsx +47 -3
- package/src/components/Search/variables.ts +17 -2
- package/src/components/Segmented/Segmented.tsx +25 -16
- package/src/components/Select/Select.tsx +12 -6
- package/src/components/Select/SelectInput.tsx +10 -18
- package/src/components/Sidebar/Sidebar.tsx +2 -2
- package/src/components/SplitButton/SplitButton.tsx +8 -2
- package/src/components/TableOfContent/TableOfContent.tsx +2 -2
- package/src/core/constants/common.ts +1 -0
- package/src/core/constants/consent.ts +29 -0
- package/src/core/constants/index.ts +2 -0
- package/src/core/constants/mcp.ts +3 -9
- package/src/core/constants/prompt.ts +34 -0
- package/src/core/constants/search.ts +6 -2
- package/src/core/contexts/PortalContainerContext.tsx +4 -0
- package/src/core/hooks/__mocks__/index.ts +5 -0
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +20 -0
- package/src/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.ts +1 -2
- package/src/core/hooks/code-walkthrough/__mocks__/mock-intersection-observer.ts +1 -2
- package/src/core/hooks/code-walkthrough/use-code-panel.ts +1 -1
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +2 -2
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +1 -1
- package/src/core/hooks/code-walkthrough/use-code-walkthrough.ts +3 -3
- package/src/core/hooks/code-walkthrough/use-renderable-files.ts +1 -1
- package/src/core/hooks/index.ts +9 -0
- package/src/core/hooks/menu/use-collapse.ts +1 -1
- package/src/core/hooks/menu/use-mobile-menu-items.ts +91 -56
- package/src/core/hooks/menu/use-mobile-menu-levels.ts +14 -6
- package/src/core/hooks/prompt/use-prompt-actions.ts +28 -0
- package/src/core/hooks/prompt/use-prompt-text-limit.ts +59 -0
- package/src/core/hooks/search/use-persisted-quick-filter.ts +125 -0
- package/src/core/hooks/search/use-search-ai-activity.ts +31 -0
- package/src/core/hooks/use-connect-mcp-button.ts +13 -2
- package/src/core/hooks/use-consent-dialog.ts +51 -0
- package/src/core/hooks/use-consent-telemetry.ts +56 -0
- package/src/core/hooks/use-dialog-hotkeys.ts +11 -5
- package/src/core/hooks/use-full-height.ts +8 -8
- package/src/core/hooks/use-page-actions.ts +21 -9
- package/src/core/hooks/use-pointer-border-highlight.ts +46 -0
- package/src/core/hooks/use-scroll-item-into-view.ts +18 -0
- package/src/core/hooks/use-tab-list.ts +63 -0
- package/src/core/hooks/use-telemetry-fallback.ts +2 -0
- package/src/core/hooks/use-theme-hooks.ts +16 -0
- package/src/core/styles/dark.ts +2 -0
- package/src/core/styles/global.ts +96 -116
- package/src/core/styles/index.ts +2 -1
- package/src/core/styles/search-ai-appear.ts +16 -0
- package/src/core/types/code-walkthrough.ts +103 -0
- package/src/core/types/consent.ts +51 -0
- package/src/core/types/dropdown.ts +1 -0
- package/src/core/types/hooks.ts +8 -0
- package/src/core/types/index.ts +4 -0
- package/src/core/types/l10n.ts +46 -2
- package/src/core/types/mcp.ts +4 -2
- package/src/core/types/navigation-tabs.ts +54 -0
- package/src/core/types/prompt.ts +11 -0
- package/src/core/types/search.ts +23 -0
- package/src/core/utils/Dynamic.tsx +67 -35
- package/src/core/utils/assign-ref.ts +9 -0
- package/src/core/utils/consent-settings-link-placement.ts +18 -0
- package/src/core/utils/content-segments.ts +98 -6
- package/src/core/utils/download-code-walkthrough.ts +1 -1
- package/src/core/utils/dropdown.ts +14 -0
- package/src/core/utils/get-ai-prompt-link.ts +30 -0
- package/src/core/utils/get-code-walkthrough-file-text.ts +1 -1
- package/src/core/utils/index.ts +5 -0
- package/src/core/utils/match-code-walkthrough-conditions.ts +1 -1
- package/src/core/utils/mcp.ts +16 -4
- package/src/core/utils/menu.ts +54 -9
- package/src/core/utils/navigation-tabs.ts +99 -0
- package/src/core/utils/search-ai-activity.ts +110 -0
- package/src/core/utils/urls.ts +3 -1
- package/src/core/utils/with-load-progress.ts +23 -18
- package/src/ext/configure.ts +1 -1
- package/src/icons/CheckboxIcon/CheckboxIcon.tsx +1 -0
- package/src/icons/ChevronSortIcon/ChevronSortIcon.tsx +1 -0
- package/src/icons/ExpandCollapseIcon/ExpandCollapseIcon.tsx +56 -0
- package/src/icons/LinkIcon/LinkIconSymbol.tsx +51 -0
- package/src/index.ts +8 -0
- package/src/layouts/PageLayout.tsx +1 -1
- package/src/layouts/RootLayout.tsx +2 -2
- package/src/markdoc/components/CodeWalkthrough/CodeFilters.tsx +2 -2
- package/src/markdoc/components/CodeWalkthrough/CodePanel.tsx +4 -4
- package/src/markdoc/components/CodeWalkthrough/CodePanelHeader.tsx +1 -1
- package/src/markdoc/components/CodeWalkthrough/CodePanelToolbar.tsx +1 -1
- package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +1 -1
- package/src/markdoc/components/CodeWalkthrough/CodeWalkthrough.tsx +2 -2
- package/src/markdoc/components/Prompt/Prompt.tsx +219 -0
- package/src/markdoc/components/Prompt/PromptActions.tsx +104 -0
- package/src/markdoc/components/Prompt/PromptBody.tsx +107 -0
- package/src/markdoc/components/Prompt/PromptCopyButton.tsx +73 -0
- package/src/markdoc/components/Prompt/PromptHeader.tsx +81 -0
- package/src/markdoc/components/Prompt/PromptShowHideButton.tsx +43 -0
- package/src/markdoc/components/Prompt/PromptToggleLabel.tsx +41 -0
- package/src/markdoc/components/Prompt/variables.dark.ts +5 -0
- package/src/markdoc/components/Prompt/variables.ts +41 -0
- package/src/markdoc/components/Tabs/TabList.tsx +9 -12
- package/src/markdoc/components/default.ts +1 -0
- package/src/markdoc/default.ts +2 -0
- package/src/markdoc/tags/code-walkthrough.ts +1 -1
- package/src/markdoc/tags/connect-mcp.ts +16 -1
- package/src/markdoc/tags/prompt.ts +58 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { ComponentProps, JSX } from 'react';
|
|
@@ -45,9 +45,14 @@ export function SplitButton(props: SplitButtonProps): JSX.Element {
|
|
|
45
45
|
} = props;
|
|
46
46
|
|
|
47
47
|
const hasMenu = typeof children === 'function' || React.Children.toArray(children).length > 0;
|
|
48
|
+
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
48
49
|
|
|
49
50
|
return (
|
|
50
|
-
<SplitButtonWrapper
|
|
51
|
+
<SplitButtonWrapper
|
|
52
|
+
data-component-name="SplitButton/SplitButton"
|
|
53
|
+
className={className}
|
|
54
|
+
ref={wrapperRef}
|
|
55
|
+
>
|
|
51
56
|
<ButtonGroup variant={variant} size={size}>
|
|
52
57
|
{button}
|
|
53
58
|
{hasMenu ? (
|
|
@@ -56,6 +61,7 @@ export function SplitButton(props: SplitButtonProps): JSX.Element {
|
|
|
56
61
|
placement={placement}
|
|
57
62
|
alignment={alignment}
|
|
58
63
|
portalled={portalled}
|
|
64
|
+
alignmentAnchorRef={wrapperRef}
|
|
59
65
|
withArrow
|
|
60
66
|
onOpen={onOpen}
|
|
61
67
|
onClose={onClose}
|
|
@@ -101,8 +101,8 @@ const TableOfContentHeader = styled.div`
|
|
|
101
101
|
|
|
102
102
|
const TableOfContentItems = styled.div`
|
|
103
103
|
position: sticky;
|
|
104
|
-
top: calc(var(--navbar-height) + var(--toc-offset-top));
|
|
105
|
-
max-height: calc(100vh - var(--navbar-height) - var(--toc-offset-top));
|
|
104
|
+
top: calc(var(--navbar-stack-height) + var(--toc-offset-top));
|
|
105
|
+
max-height: calc(100vh - var(--navbar-stack-height) - var(--toc-offset-top));
|
|
106
106
|
overflow-y: auto;
|
|
107
107
|
width: var(--toc-width);
|
|
108
108
|
border-left: solid 1px var(--toc-border-color);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ConsentCategory } from '../types/consent';
|
|
2
|
+
|
|
3
|
+
export const CONSENT_CATEGORIES: readonly ConsentCategory[] = [
|
|
4
|
+
{
|
|
5
|
+
id: 'necessary',
|
|
6
|
+
locked: true,
|
|
7
|
+
titleTranslationKey: 'consent.category.necessary.title',
|
|
8
|
+
descriptionTranslationKey: 'consent.category.necessary.description',
|
|
9
|
+
titleDefault: 'Necessary',
|
|
10
|
+
descriptionDefault:
|
|
11
|
+
'Needed for the site to work: your consent choice, your color mode, and anonymous usage data.',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: 'analytics',
|
|
15
|
+
locked: false,
|
|
16
|
+
titleTranslationKey: 'consent.category.analytics.title',
|
|
17
|
+
descriptionTranslationKey: 'consent.category.analytics.description',
|
|
18
|
+
titleDefault: 'Analytics',
|
|
19
|
+
descriptionDefault: 'Helps us understand which pages are useful.',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'marketing',
|
|
23
|
+
locked: false,
|
|
24
|
+
titleTranslationKey: 'consent.category.marketing.title',
|
|
25
|
+
descriptionTranslationKey: 'consent.category.marketing.description',
|
|
26
|
+
titleDefault: 'Marketing',
|
|
27
|
+
descriptionDefault: 'Lets us measure which campaigns bring visitors to this site.',
|
|
28
|
+
},
|
|
29
|
+
];
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import type { MCPOption } from '../types/mcp';
|
|
2
|
-
|
|
3
1
|
export const DEFAULT_MCP_SERVER_NAME = 'mcp-server';
|
|
4
2
|
|
|
5
3
|
export const MCP_ROUTE = '/mcp';
|
|
6
4
|
|
|
7
5
|
export const PUBLIC_MCP_ROUTE = '/mcp-public';
|
|
8
6
|
|
|
9
|
-
export const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
'claude-code',
|
|
13
|
-
'codex',
|
|
14
|
-
'copy',
|
|
15
|
-
];
|
|
7
|
+
export const MCP_OPTIONS = ['cursor', 'vscode', 'claude', 'claude-code', 'codex', 'copy'] as const;
|
|
8
|
+
|
|
9
|
+
export const DEFAULT_MCP_OPTIONS = [...MCP_OPTIONS];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AiPromptActionOption, AiPromptTarget } from '../types/prompt';
|
|
2
|
+
|
|
3
|
+
export const PROMPT_TAG = 'prompt';
|
|
4
|
+
|
|
5
|
+
export const AI_PROMPT_TARGETS = Object.freeze({
|
|
6
|
+
CURSOR: 'cursor',
|
|
7
|
+
CLAUDE: 'claude',
|
|
8
|
+
CHATGPT: 'chatgpt',
|
|
9
|
+
} as const);
|
|
10
|
+
|
|
11
|
+
/* Block width, not viewport width: a prompt in a narrow desktop column stacks like one on a
|
|
12
|
+
phone. The viewport `breakpoints` in core/utils/media-css.ts do not apply here. */
|
|
13
|
+
export const PROMPT_NARROW_BLOCK_MAX_WIDTH = '440px';
|
|
14
|
+
|
|
15
|
+
export const AI_PROMPT_ACTION_OPTIONS: Record<AiPromptTarget, AiPromptActionOption> = {
|
|
16
|
+
cursor: {
|
|
17
|
+
titleTranslationKey: 'promptTag.openIn.cursor',
|
|
18
|
+
titleDefault: 'Open in Cursor',
|
|
19
|
+
descriptionTranslationKey: 'promptTag.openIn.cursorDescription',
|
|
20
|
+
descriptionDefault: 'Send this prompt to Cursor',
|
|
21
|
+
},
|
|
22
|
+
claude: {
|
|
23
|
+
titleTranslationKey: 'promptTag.openIn.claude',
|
|
24
|
+
titleDefault: 'Open in Claude',
|
|
25
|
+
descriptionTranslationKey: 'promptTag.openIn.claudeDescription',
|
|
26
|
+
descriptionDefault: 'Send this prompt to Claude',
|
|
27
|
+
},
|
|
28
|
+
chatgpt: {
|
|
29
|
+
titleTranslationKey: 'promptTag.openIn.chatgpt',
|
|
30
|
+
titleDefault: 'Open in ChatGPT',
|
|
31
|
+
descriptionTranslationKey: 'promptTag.openIn.chatgptDescription',
|
|
32
|
+
descriptionDefault: 'Send this prompt to ChatGPT',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -44,7 +44,7 @@ export const AI_SEARCH_ERROR_CONFIG: Record<AiSearchError, AiSearchErrorConfig>
|
|
|
44
44
|
|
|
45
45
|
export const AI_SEARCH_MAX_MESSAGE_LENGTH = 45000;
|
|
46
46
|
|
|
47
|
-
export const SEARCH_DEBOUNCE_TIME_MS =
|
|
47
|
+
export const SEARCH_DEBOUNCE_TIME_MS = 500;
|
|
48
48
|
|
|
49
49
|
export const DEFAULT_KEYBOARD_SHORTCUTS = '⌘+K,CTRL+K';
|
|
50
50
|
|
|
@@ -53,7 +53,7 @@ export const TOOL_CALL_DISPLAY_TEXT: Partial<
|
|
|
53
53
|
> = {
|
|
54
54
|
[ToolCallName.SearchDocumentation]: {
|
|
55
55
|
inProgressText: 'Searching documentation...',
|
|
56
|
-
completedText: '
|
|
56
|
+
completedText: 'Searched the documentation',
|
|
57
57
|
},
|
|
58
58
|
[ToolCallName.ListApis]: {
|
|
59
59
|
inProgressText: 'Browsing APIs...',
|
|
@@ -75,6 +75,10 @@ export const TOOL_CALL_DISPLAY_TEXT: Partial<
|
|
|
75
75
|
inProgressText: 'Reading API description...',
|
|
76
76
|
completedText: 'Read API description',
|
|
77
77
|
},
|
|
78
|
+
[ToolCallName.Execute]: {
|
|
79
|
+
inProgressText: 'Running code...',
|
|
80
|
+
completedText: 'Ran code',
|
|
81
|
+
},
|
|
78
82
|
[ToolCallName.DescribeTools]: {
|
|
79
83
|
inProgressText: 'Discovering available tools...',
|
|
80
84
|
completedText: 'Discovered available tools',
|
|
@@ -23,8 +23,13 @@ export * from '../menu/use-mobile-menu-levels';
|
|
|
23
23
|
export * from '../feedback/use-report-dialog';
|
|
24
24
|
export * from '../use-product-picker';
|
|
25
25
|
export * from '../search/use-search-dialog';
|
|
26
|
+
export * from '../search/use-search-ai-activity';
|
|
27
|
+
export * from '../search/use-persisted-quick-filter';
|
|
26
28
|
export * from '../use-language-picker';
|
|
27
29
|
export * from './use-element-size';
|
|
28
30
|
export * from './use-time-ago';
|
|
29
31
|
export * from './use-input-key-commands';
|
|
30
32
|
export * from '../use-tooltip-fallback-placement';
|
|
33
|
+
export * from '../use-pointer-border-highlight';
|
|
34
|
+
export * from '../prompt/use-prompt-text-limit';
|
|
35
|
+
export * from '../prompt/use-prompt-actions';
|
|
@@ -17,14 +17,32 @@ export const useThemeHooks = vi.fn(() => ({
|
|
|
17
17
|
sendCodeSnippetReportedMessage: vi.fn(),
|
|
18
18
|
sendConnectMcpClickedMessage: vi.fn(),
|
|
19
19
|
sendMcpConnectionSnippetCopiedMessage: vi.fn(),
|
|
20
|
+
sendPromptTagCopiedMessage: vi.fn(),
|
|
21
|
+
sendPromptTagOpenedMessage: vi.fn(),
|
|
20
22
|
sendPageActionsButtonClickedMessage: vi.fn(),
|
|
21
23
|
sendColorModeSwitchedMessage: vi.fn(),
|
|
24
|
+
sendConsentChangedMessage: vi.fn(),
|
|
25
|
+
sendFilterCheckboxToggledMessage: vi.fn(),
|
|
22
26
|
})),
|
|
23
27
|
useBreadcrumbs: vi.fn().mockReturnValue({ breadcrumbs: [], siblings: undefined }),
|
|
24
28
|
useBanner: vi.fn(() => ({
|
|
25
29
|
banner: undefined,
|
|
26
30
|
dismissBanner: vi.fn(),
|
|
27
31
|
})),
|
|
32
|
+
useConsent: vi.fn(() => ({
|
|
33
|
+
enabled: false,
|
|
34
|
+
config: undefined,
|
|
35
|
+
mode: undefined,
|
|
36
|
+
state: undefined,
|
|
37
|
+
decided: false,
|
|
38
|
+
gpc: false,
|
|
39
|
+
isDialogOpen: false,
|
|
40
|
+
openDialog: vi.fn(),
|
|
41
|
+
closeDialog: vi.fn(),
|
|
42
|
+
accept: vi.fn(),
|
|
43
|
+
reject: vi.fn(),
|
|
44
|
+
save: vi.fn(),
|
|
45
|
+
})),
|
|
28
46
|
usePageSharedData: vi.fn().mockReturnValue({}),
|
|
29
47
|
useCatalogClassic: vi.fn(() => ({
|
|
30
48
|
groups: [],
|
|
@@ -55,6 +73,7 @@ export const useThemeHooks = vi.fn(() => ({
|
|
|
55
73
|
items: [],
|
|
56
74
|
isLoading: false,
|
|
57
75
|
})),
|
|
76
|
+
useSearchFeatures: vi.fn(() => ({ askAi: false })),
|
|
58
77
|
useAiSearch: vi.fn(() => ({
|
|
59
78
|
askQuestion: vi.fn(),
|
|
60
79
|
isGeneratingResponse: false,
|
|
@@ -102,6 +121,7 @@ export const useThemeHooks = vi.fn(() => ({
|
|
|
102
121
|
pushDrilldownState: vi.fn(),
|
|
103
122
|
}),
|
|
104
123
|
useSidebarSiblingsData: vi.fn(),
|
|
124
|
+
useNavigationTabs: vi.fn(),
|
|
105
125
|
useSubmitFeedback: vi.fn(() => ({
|
|
106
126
|
submitFeedback: vi.fn(),
|
|
107
127
|
})),
|
|
@@ -8,8 +8,7 @@ export class MockIntersectionObserver {
|
|
|
8
8
|
unobserve: (target: HTMLElement) => void;
|
|
9
9
|
disconnect: () => void;
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
constructor(callback: IntersectionObserverCallback, options?: IntersectionObserverInit) {
|
|
11
|
+
constructor(_callback: IntersectionObserverCallback, _options?: IntersectionObserverInit) {
|
|
13
12
|
this.root = null;
|
|
14
13
|
this.rootMargin = '0px';
|
|
15
14
|
this.thresholds = [1];
|
|
@@ -9,8 +9,7 @@ export class MockIntersectionObserver {
|
|
|
9
9
|
unobserve: (target: HTMLElement) => void;
|
|
10
10
|
disconnect: () => void;
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
constructor(callback: IntersectionObserverCallback, options?: IntersectionObserverInit) {
|
|
12
|
+
constructor(_callback: IntersectionObserverCallback, _options?: IntersectionObserverInit) {
|
|
14
13
|
this.root = null;
|
|
15
14
|
this.rootMargin = '0px';
|
|
16
15
|
this.scrollMargin = '';
|
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
CodeWalkthroughFile,
|
|
5
5
|
CodeWalkthroughNode,
|
|
6
6
|
CodeWalkthroughConditionsObject,
|
|
7
|
-
} from '@redocly/
|
|
7
|
+
} from '@redocly/theme/core/types';
|
|
8
8
|
|
|
9
9
|
import { CodeWalkthroughControlsStateContext } from '../../contexts/CodeWalkthrough/CodeWalkthroughControlsContext';
|
|
10
10
|
import { CodeWalkthroughStepsContext } from '../../contexts/CodeWalkthrough/CodeWalkthroughStepsContext';
|
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
CodeWalkthroughFilterItem,
|
|
11
11
|
CodeWalkthroughConditionsObject,
|
|
12
12
|
CodeWalkthroughControlsState,
|
|
13
|
-
} from '@redocly/
|
|
13
|
+
} from '@redocly/theme/core/types';
|
|
14
14
|
|
|
15
15
|
import { downloadCodeWalkthrough } from '../../utils/download-code-walkthrough';
|
|
16
16
|
import { matchCodeWalkthroughConditions } from '../../utils/match-code-walkthrough-conditions';
|
|
@@ -98,7 +98,7 @@ export function useCodeWalkthroughControls(
|
|
|
98
98
|
Object.entries(newState).forEach(([id, control]) => {
|
|
99
99
|
const existingControl = controlsState[id];
|
|
100
100
|
if (existingControl && existingControl.type === control.type) {
|
|
101
|
-
// @ts-expect-error
|
|
101
|
+
// @ts-expect-error: TS2322 - the spread loses the link between `type` and `value` in the control union
|
|
102
102
|
newState[id] = {
|
|
103
103
|
...control,
|
|
104
104
|
value: existingControl.value,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState, useMemo } from 'react';
|
|
2
2
|
import { useLocation, useNavigate } from 'react-router';
|
|
3
3
|
|
|
4
|
-
import type { CodeWalkthroughStepAttr } from '@redocly/
|
|
4
|
+
import type { CodeWalkthroughStepAttr } from '@redocly/theme/core/types';
|
|
5
5
|
import type { ActiveStep, WalkthroughStepsState } from '../../types/code-walkthrough';
|
|
6
6
|
import type { MarkerArea } from '../../types/marker';
|
|
7
7
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
CodeWalkthroughAttr,
|
|
2
3
|
CodeWalkthroughFile,
|
|
3
4
|
CodeWalkthroughStepAttr,
|
|
4
|
-
|
|
5
|
-
} from '
|
|
6
|
-
import type { WalkthroughStepsState } from '../../types/code-walkthrough';
|
|
5
|
+
WalkthroughStepsState,
|
|
6
|
+
} from '../../types/code-walkthrough';
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
useCodeWalkthroughControls,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
|
|
3
|
-
import type { CodeWalkthroughFile } from '@redocly/
|
|
3
|
+
import type { CodeWalkthroughFile } from '@redocly/theme/core/types';
|
|
4
4
|
|
|
5
5
|
import { findClosestCommonDirectory } from '../../utils/find-closest-common-directory';
|
|
6
6
|
import { getFileIconByExt } from '../../utils/GetFileIcon';
|
package/src/core/hooks/index.ts
CHANGED
|
@@ -21,12 +21,17 @@ export * from './menu/use-mobile-menu-levels';
|
|
|
21
21
|
export * from './menu/use-collapse';
|
|
22
22
|
export * from './feedback/use-report-dialog';
|
|
23
23
|
export * from './use-tabs';
|
|
24
|
+
export * from './use-tab-list';
|
|
24
25
|
export * from './use-focus-trap';
|
|
26
|
+
export * from './use-consent-dialog';
|
|
27
|
+
export * from './use-consent-telemetry';
|
|
25
28
|
export * from './use-language-picker';
|
|
26
29
|
export * from './use-product-picker';
|
|
27
30
|
export * from './search/use-search-dialog';
|
|
28
31
|
export * from './search/use-search-filter';
|
|
29
32
|
export * from './search/use-feedback-tooltip';
|
|
33
|
+
export * from './search/use-search-ai-activity';
|
|
34
|
+
export * from './search/use-persisted-quick-filter';
|
|
30
35
|
export * from './use-controlled-state';
|
|
31
36
|
export * from './use-codeblock-tabs-controls';
|
|
32
37
|
export * from './code-walkthrough/use-code-walkthrough';
|
|
@@ -56,3 +61,7 @@ export * from './use-toast-logic';
|
|
|
56
61
|
export * from './use-banner-telemetry';
|
|
57
62
|
export * from './use-tooltip-fallback-placement';
|
|
58
63
|
export * from './use-anchor-positioning';
|
|
64
|
+
export * from './use-scroll-item-into-view';
|
|
65
|
+
export * from './use-pointer-border-highlight';
|
|
66
|
+
export * from './prompt/use-prompt-text-limit';
|
|
67
|
+
export * from './prompt/use-prompt-actions';
|
|
@@ -207,5 +207,5 @@ export function useEvent<T extends (...args: any[]) => any>(callback?: T): T {
|
|
|
207
207
|
ref.current = callback;
|
|
208
208
|
});
|
|
209
209
|
|
|
210
|
-
return useCallback((
|
|
210
|
+
return useCallback((...args: Parameters<T>) => ref.current?.(...args), []) as T;
|
|
211
211
|
}
|
|
@@ -1,21 +1,36 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
1
2
|
import { useLocation } from 'react-router';
|
|
2
3
|
|
|
3
|
-
import type { ResolvedNavItem } from '@redocly/config';
|
|
4
|
+
import type { ResolvedNavItem, Version } from '@redocly/config';
|
|
4
5
|
|
|
5
6
|
import { useThemeHooks } from '../use-theme-hooks';
|
|
6
7
|
import { useThemeConfig } from '../use-theme-config';
|
|
7
8
|
import { MobileMenuType } from '../../constants/common';
|
|
8
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
buildLanguagesGroup,
|
|
11
|
+
buildNavigationTabsSelect,
|
|
12
|
+
buildVersionSection,
|
|
13
|
+
mapNavbarItems,
|
|
14
|
+
} from '../../utils/menu';
|
|
9
15
|
|
|
10
16
|
const MENU_SEPARATOR: ResolvedNavItem = {
|
|
11
17
|
type: 'separator',
|
|
12
18
|
separatorLine: true,
|
|
13
19
|
};
|
|
14
20
|
|
|
21
|
+
const NO_VERSIONS: Version[] = [];
|
|
22
|
+
const NO_NAV_ITEMS: ResolvedNavItem[] = [];
|
|
23
|
+
|
|
15
24
|
export const useMobileMenuItems = (menuType: MobileMenuType) => {
|
|
16
|
-
const {
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
const {
|
|
26
|
+
useTranslate,
|
|
27
|
+
useL10nConfig,
|
|
28
|
+
useCurrentProduct,
|
|
29
|
+
usePageVersions,
|
|
30
|
+
useSidebarItems,
|
|
31
|
+
useNavigationTabs,
|
|
32
|
+
} = useThemeHooks();
|
|
33
|
+
const versions = usePageVersions()?.versions ?? NO_VERSIONS;
|
|
19
34
|
const { defaultLocale, currentLocale, locales } = useL10nConfig();
|
|
20
35
|
const { translate } = useTranslate();
|
|
21
36
|
const activeVersion = versions.find((version) => version.active);
|
|
@@ -25,6 +40,7 @@ export const useMobileMenuItems = (menuType: MobileMenuType) => {
|
|
|
25
40
|
popDrilldownState,
|
|
26
41
|
backLink,
|
|
27
42
|
} = useSidebarItems(activeVersion);
|
|
43
|
+
const navigationTabs = useNavigationTabs();
|
|
28
44
|
const location = useLocation();
|
|
29
45
|
|
|
30
46
|
const currentProduct = useCurrentProduct();
|
|
@@ -33,74 +49,93 @@ export const useMobileMenuItems = (menuType: MobileMenuType) => {
|
|
|
33
49
|
const productThemeConfig = useThemeConfig();
|
|
34
50
|
const baseThemeConfig = useThemeConfig(false);
|
|
35
51
|
|
|
36
|
-
const baseNavItems = (baseThemeConfig.navbar?.items
|
|
52
|
+
const baseNavItems = (baseThemeConfig.navbar?.items ?? NO_NAV_ITEMS) as ResolvedNavItem[];
|
|
37
53
|
const productNavItems = (
|
|
38
|
-
hasProductNavbarOverride ? productThemeConfig.navbar?.items
|
|
54
|
+
hasProductNavbarOverride ? (productThemeConfig.navbar?.items ?? NO_NAV_ITEMS) : NO_NAV_ITEMS
|
|
39
55
|
) as ResolvedNavItem[];
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
menuItems.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
menuItems.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
(product) => ({
|
|
56
|
+
const products = baseThemeConfig.products;
|
|
57
|
+
|
|
58
|
+
const items = useMemo(() => {
|
|
59
|
+
const menuItems: ResolvedNavItem[] = [];
|
|
60
|
+
const navigationTabsSelect =
|
|
61
|
+
menuType === MobileMenuType.PAGE ? buildNavigationTabsSelect({ navigationTabs }) : undefined;
|
|
62
|
+
|
|
63
|
+
if (menuType === MobileMenuType.PAGE) {
|
|
64
|
+
if (activeVersion) {
|
|
65
|
+
menuItems.push(...buildVersionSection(translate, versions, activeVersion));
|
|
66
|
+
}
|
|
67
|
+
if (menuItems.length && sidebarItems.length) {
|
|
68
|
+
menuItems.push(MENU_SEPARATOR);
|
|
69
|
+
}
|
|
70
|
+
menuItems.push(...(sidebarItems as ResolvedNavItem[]));
|
|
71
|
+
} else if (menuType === MobileMenuType.PRODUCT) {
|
|
72
|
+
menuItems.push(...productNavItems);
|
|
73
|
+
|
|
74
|
+
if (menuItems.length && baseNavItems.length) {
|
|
75
|
+
menuItems.push(MENU_SEPARATOR);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (baseNavItems.length) {
|
|
79
|
+
menuItems.push(...baseNavItems);
|
|
80
|
+
}
|
|
81
|
+
} else if (menuType === MobileMenuType.MAIN_MENU) {
|
|
82
|
+
const productMenuItems: ResolvedNavItem[] = Object.values(products || {}).map((product) => ({
|
|
67
83
|
label: product.name,
|
|
68
84
|
link: product.link,
|
|
69
85
|
icon: product.icon,
|
|
70
86
|
type: 'link',
|
|
71
|
-
})
|
|
72
|
-
|
|
87
|
+
}));
|
|
88
|
+
|
|
89
|
+
if (productMenuItems.length) {
|
|
90
|
+
menuItems.push({
|
|
91
|
+
type: 'separator',
|
|
92
|
+
label: translate('mobileMenu.products', 'Products'),
|
|
93
|
+
});
|
|
73
94
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
type: 'separator',
|
|
77
|
-
label: translate('mobileMenu.products', 'Products'),
|
|
78
|
-
});
|
|
95
|
+
menuItems.push(...productMenuItems);
|
|
96
|
+
}
|
|
79
97
|
|
|
80
|
-
menuItems.
|
|
98
|
+
if (menuItems.length && baseNavItems.length) {
|
|
99
|
+
menuItems.push(MENU_SEPARATOR);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (baseNavItems.length) {
|
|
103
|
+
menuItems.push(...baseNavItems);
|
|
104
|
+
}
|
|
81
105
|
}
|
|
82
106
|
|
|
83
|
-
|
|
107
|
+
const languagesMenu = buildLanguagesGroup(locales, defaultLocale, currentLocale);
|
|
108
|
+
|
|
109
|
+
if (menuItems.length && languagesMenu) {
|
|
84
110
|
menuItems.push(MENU_SEPARATOR);
|
|
85
111
|
}
|
|
86
112
|
|
|
87
|
-
if (
|
|
88
|
-
menuItems.push(
|
|
113
|
+
if (languagesMenu) {
|
|
114
|
+
menuItems.push(languagesMenu);
|
|
89
115
|
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const languagesMenu = buildLanguagesGroup(locales, defaultLocale, currentLocale);
|
|
93
|
-
|
|
94
|
-
if (menuItems.length && languagesMenu) {
|
|
95
|
-
menuItems.push(MENU_SEPARATOR);
|
|
96
|
-
}
|
|
97
116
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
117
|
+
return [
|
|
118
|
+
...(navigationTabsSelect ? [navigationTabsSelect] : []),
|
|
119
|
+
...mapNavbarItems(menuItems, defaultLocale, currentLocale, locales, location),
|
|
120
|
+
];
|
|
121
|
+
}, [
|
|
122
|
+
menuType,
|
|
123
|
+
navigationTabs,
|
|
124
|
+
activeVersion,
|
|
125
|
+
versions,
|
|
126
|
+
sidebarItems,
|
|
127
|
+
productNavItems,
|
|
128
|
+
baseNavItems,
|
|
129
|
+
products,
|
|
130
|
+
translate,
|
|
131
|
+
locales,
|
|
132
|
+
defaultLocale,
|
|
133
|
+
currentLocale,
|
|
134
|
+
location,
|
|
135
|
+
]);
|
|
101
136
|
|
|
102
137
|
return {
|
|
103
|
-
items
|
|
138
|
+
items,
|
|
104
139
|
popDrilldownState,
|
|
105
140
|
pushDrilldownState,
|
|
106
141
|
backLink,
|
|
@@ -8,27 +8,35 @@ import { useThemeConfig } from '../use-theme-config';
|
|
|
8
8
|
import { MobileMenuType } from '../../constants/common';
|
|
9
9
|
|
|
10
10
|
export const useMobileMenuLevels = () => {
|
|
11
|
-
const { useTranslate, useCurrentProduct, usePageVersions, useSidebarItems } =
|
|
11
|
+
const { useTranslate, useCurrentProduct, usePageVersions, useSidebarItems, useNavigationTabs } =
|
|
12
|
+
useThemeHooks();
|
|
12
13
|
const { versions = [] } = usePageVersions() || {};
|
|
13
14
|
const activeVersion = versions.find((version) => version?.active);
|
|
14
15
|
const { currentItems: sidebarItems } = useSidebarItems(activeVersion);
|
|
16
|
+
const navigationTabs = useNavigationTabs();
|
|
15
17
|
const { translate } = useTranslate();
|
|
16
18
|
const currentProduct = useCurrentProduct();
|
|
17
19
|
const productThemeConfig = useThemeConfig();
|
|
20
|
+
const baseThemeConfig = useThemeConfig(false);
|
|
18
21
|
const location = useLocation();
|
|
19
22
|
|
|
20
23
|
const hasProductNavbarOverride = currentProduct?.configOverride?.navbar;
|
|
21
24
|
const productNavItems = (
|
|
22
25
|
hasProductNavbarOverride ? productThemeConfig.navbar?.items || [] : []
|
|
23
26
|
) as ResolvedNavItem[];
|
|
27
|
+
const hasMainMenuItems =
|
|
28
|
+
Object.values(baseThemeConfig.products || {}).length > 0 ||
|
|
29
|
+
(baseThemeConfig.navbar?.items || []).length > 0;
|
|
24
30
|
|
|
25
31
|
const menuLevels = useMemo(() => {
|
|
26
|
-
const menuLevels = [
|
|
27
|
-
|
|
32
|
+
const menuLevels: Array<{ label: string; type: MobileMenuType }> = [];
|
|
33
|
+
|
|
34
|
+
if (hasMainMenuItems) {
|
|
35
|
+
menuLevels.push({
|
|
28
36
|
label: translate('mobileMenu.mainMenu', 'Main menu'),
|
|
29
37
|
type: MobileMenuType.MAIN_MENU,
|
|
30
|
-
}
|
|
31
|
-
|
|
38
|
+
});
|
|
39
|
+
}
|
|
32
40
|
|
|
33
41
|
if (currentProduct && productNavItems.length) {
|
|
34
42
|
menuLevels.push({
|
|
@@ -37,7 +45,7 @@ export const useMobileMenuLevels = () => {
|
|
|
37
45
|
});
|
|
38
46
|
}
|
|
39
47
|
|
|
40
|
-
if (sidebarItems.length || activeVersion) {
|
|
48
|
+
if (sidebarItems.length || activeVersion || navigationTabs?.tabs.length) {
|
|
41
49
|
menuLevels.push({
|
|
42
50
|
label: translate('mobileMenu.previous', 'Previous'),
|
|
43
51
|
type: MobileMenuType.PAGE,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AsyncApiRealmUI } from '@redocly/realm-asyncapi-sdk';
|
|
2
|
+
import type { AiPromptTarget } from '../../types/prompt';
|
|
3
|
+
|
|
4
|
+
import { useThemeHooks } from '../use-theme-hooks';
|
|
5
|
+
import { getAiPromptLink } from '../../utils/get-ai-prompt-link';
|
|
6
|
+
import { getBaseDataAttributes } from '../../utils/telemetry/get-base-data-attributes';
|
|
7
|
+
|
|
8
|
+
type PromptTagData = Parameters<AsyncApiRealmUI.Telemetry['sendPromptTagCopiedMessage']>[0][0];
|
|
9
|
+
|
|
10
|
+
export type PromptActionHandlers = {
|
|
11
|
+
reportCopy: () => void;
|
|
12
|
+
/** Opens the prompt in the AI tool and reports it. */
|
|
13
|
+
openIn: (target: AiPromptTarget) => void;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function usePromptActions(prompt: string): PromptActionHandlers {
|
|
17
|
+
const { useTelemetry } = useThemeHooks();
|
|
18
|
+
const telemetry = useTelemetry();
|
|
19
|
+
const tagData: PromptTagData = getBaseDataAttributes('prompt', 'markdocTag');
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
reportCopy: () => telemetry.sendPromptTagCopiedMessage([tagData]),
|
|
23
|
+
openIn: (target) => {
|
|
24
|
+
telemetry.sendPromptTagOpenedMessage([{ ...tagData, target }]);
|
|
25
|
+
window.open(getAiPromptLink(target, prompt), '_blank', 'noopener,noreferrer');
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|