@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
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type NavigationTabMenuEntry = {
|
|
2
|
+
tabId: string;
|
|
3
|
+
label: string;
|
|
4
|
+
labelTranslationKey?: string;
|
|
5
|
+
link: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
srcSet?: string;
|
|
8
|
+
external?: boolean;
|
|
9
|
+
target?: '_self' | '_blank';
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type NavigationTab = {
|
|
13
|
+
tabId: string;
|
|
14
|
+
label: string;
|
|
15
|
+
labelTranslationKey?: string;
|
|
16
|
+
link?: string;
|
|
17
|
+
icon?: string;
|
|
18
|
+
srcSet?: string;
|
|
19
|
+
menu?: NavigationTabMenuEntry[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type NavigationTabsState = {
|
|
23
|
+
tabs: NavigationTab[];
|
|
24
|
+
activeTab?: NavigationTab;
|
|
25
|
+
activeMenuEntry?: NavigationTabMenuEntry;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type NavigationTabItem = {
|
|
29
|
+
type: 'link';
|
|
30
|
+
label: string;
|
|
31
|
+
labelTranslationKey?: string;
|
|
32
|
+
link: string;
|
|
33
|
+
icon?: string;
|
|
34
|
+
srcSet?: string;
|
|
35
|
+
external?: boolean;
|
|
36
|
+
target?: '_self' | '_blank';
|
|
37
|
+
active?: boolean;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
type NavigationTabGroupItem = {
|
|
41
|
+
type: 'group';
|
|
42
|
+
label: string;
|
|
43
|
+
labelTranslationKey?: string;
|
|
44
|
+
icon?: string;
|
|
45
|
+
srcSet?: string;
|
|
46
|
+
items: NavigationTabItem[];
|
|
47
|
+
active?: boolean;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type NavigationTabRowItem = NavigationTabItem | NavigationTabGroupItem;
|
|
51
|
+
|
|
52
|
+
export type NavigationTabsConfig = {
|
|
53
|
+
items: NavigationTabRowItem[];
|
|
54
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AI_PROMPT_TARGETS } from '../constants/prompt';
|
|
2
|
+
import type { TranslationKey } from './l10n';
|
|
3
|
+
|
|
4
|
+
export type AiPromptTarget = (typeof AI_PROMPT_TARGETS)[keyof typeof AI_PROMPT_TARGETS];
|
|
5
|
+
|
|
6
|
+
export type AiPromptActionOption = {
|
|
7
|
+
titleTranslationKey: TranslationKey;
|
|
8
|
+
titleDefault: string;
|
|
9
|
+
descriptionTranslationKey: TranslationKey;
|
|
10
|
+
descriptionDefault: string;
|
|
11
|
+
};
|
package/src/core/types/search.ts
CHANGED
|
@@ -45,6 +45,8 @@ export type ParameterHighlight = {
|
|
|
45
45
|
description: string;
|
|
46
46
|
place: string;
|
|
47
47
|
path: string[];
|
|
48
|
+
enum?: string;
|
|
49
|
+
example?: string;
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
export type SearchItemData = {
|
|
@@ -115,6 +117,27 @@ export type ToolCall = {
|
|
|
115
117
|
|
|
116
118
|
export type ContentSegment = { type: 'text'; text: string } | { type: 'tool'; toolCall: ToolCall };
|
|
117
119
|
|
|
120
|
+
export type GroupedContentSegment =
|
|
121
|
+
| { type: 'text'; text: string }
|
|
122
|
+
/** `isActive`: the assistant still works on this group, with nothing written after it yet. */
|
|
123
|
+
| { type: 'tools'; toolCalls: ToolCall[]; isActive: boolean };
|
|
124
|
+
|
|
125
|
+
export type SearchAiActivityKind = 'thinking' | 'search' | 'code' | 'support';
|
|
126
|
+
|
|
127
|
+
export type SearchAiActivityStatus = {
|
|
128
|
+
label: string;
|
|
129
|
+
detail?: string;
|
|
130
|
+
kind: SearchAiActivityKind;
|
|
131
|
+
isRunning: boolean;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export type SearchAiActivityStep = {
|
|
135
|
+
id: string;
|
|
136
|
+
label: string;
|
|
137
|
+
kind: SearchAiActivityKind;
|
|
138
|
+
isRunning: boolean;
|
|
139
|
+
};
|
|
140
|
+
|
|
118
141
|
export type AiSearchConversationItem = {
|
|
119
142
|
role: AiSearchConversationRole;
|
|
120
143
|
content: string;
|
|
@@ -5,60 +5,86 @@ interface DynamicOptions<TProps extends Record<string, unknown>> {
|
|
|
5
5
|
loading?: React.ComponentType<TProps>;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A component from `dynamic()`. After `preload()` resolves, the component renders without a
|
|
10
|
+
* loading state. On the server, `preload()` does not load a client-only component (`ssr: false`).
|
|
11
|
+
*/
|
|
12
|
+
export type DynamicComponent<TProps> = React.ComponentType<TProps> & {
|
|
13
|
+
preload(): Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
|
|
8
16
|
export function dynamic<TProps extends Record<string, unknown>>(
|
|
9
17
|
factory: () => Promise<
|
|
10
18
|
React.ComponentType<TProps> | { default: React.ComponentType<TProps> } | Record<string, unknown>
|
|
11
19
|
>,
|
|
12
20
|
{ ssr = true, loading }: DynamicOptions<TProps> = {},
|
|
13
|
-
):
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (mod && typeof mod === 'object' && 'default' in mod) {
|
|
25
|
-
const defaultExport = mod.default;
|
|
26
|
-
|
|
27
|
-
// Handle both function components and React component objects (e.g., memo/forwardRef)
|
|
28
|
-
if (typeof defaultExport === 'function') {
|
|
29
|
-
return { default: defaultExport as React.ComponentType<TProps> };
|
|
21
|
+
): DynamicComponent<TProps> {
|
|
22
|
+
let loaded: React.ComponentType<TProps> | undefined;
|
|
23
|
+
let pending: Promise<{ default: React.ComponentType<TProps> }> | undefined;
|
|
24
|
+
|
|
25
|
+
const load = () =>
|
|
26
|
+
(pending ??= factory()
|
|
27
|
+
.then((mod) => {
|
|
28
|
+
// Case 1: factory() => import('./SomeModule') - direct import
|
|
29
|
+
// Case 2: factory() => import('./SomeModule').then(mod => mod.default) - extract default
|
|
30
|
+
if (typeof mod === 'function') {
|
|
31
|
+
return { default: mod };
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
// Case 3: factory() => import('./SomeModule').then(mod => ({ default: mod.default })) - manual wrap
|
|
35
|
+
// Case 4: factory() => import('./SomeModule').then(mod => ({ default: mod.Named })) - manual wrap named
|
|
36
|
+
if (mod && typeof mod === 'object' && 'default' in mod) {
|
|
37
|
+
const defaultExport = mod.default;
|
|
38
|
+
|
|
39
|
+
// Handle both function components and React component objects (e.g., memo/forwardRef)
|
|
40
|
+
if (typeof defaultExport === 'function') {
|
|
41
|
+
return { default: defaultExport as React.ComponentType<TProps> };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (defaultExport && typeof defaultExport === 'object' && '$$typeof' in defaultExport) {
|
|
45
|
+
return { default: defaultExport as React.ComponentType<TProps> };
|
|
46
|
+
}
|
|
34
47
|
}
|
|
35
|
-
}
|
|
36
48
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
// Case 5: factory() => import('./SomeModule').then(mod => mod.Named) - find named export
|
|
50
|
+
if (mod && typeof mod === 'object') {
|
|
51
|
+
const modObj = mod as Record<string, unknown>;
|
|
40
52
|
|
|
41
|
-
|
|
42
|
-
|
|
53
|
+
for (const key in modObj) {
|
|
54
|
+
const value = modObj[key];
|
|
43
55
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
56
|
+
if (typeof value === 'function') {
|
|
57
|
+
return { default: value as React.ComponentType<TProps> };
|
|
58
|
+
}
|
|
47
59
|
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
if (value && typeof value === 'object' && '$$typeof' in value) {
|
|
61
|
+
return { default: value as React.ComponentType<TProps> };
|
|
62
|
+
}
|
|
50
63
|
}
|
|
51
64
|
}
|
|
52
|
-
}
|
|
53
65
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
66
|
+
throw new Error('Dynamic import did not return a valid React component');
|
|
67
|
+
})
|
|
68
|
+
.then(
|
|
69
|
+
(module) => {
|
|
70
|
+
loaded = module.default;
|
|
71
|
+
return module;
|
|
72
|
+
},
|
|
73
|
+
(error: unknown) => {
|
|
74
|
+
// A failed load is not kept, so the next preload tries again.
|
|
75
|
+
pending = undefined;
|
|
76
|
+
throw error;
|
|
77
|
+
},
|
|
78
|
+
));
|
|
79
|
+
|
|
80
|
+
const LazyComponent = React.lazy(load);
|
|
57
81
|
|
|
58
82
|
const LoadingComponent: React.ComponentType<TProps> = loading || (() => null);
|
|
59
83
|
|
|
60
|
-
|
|
84
|
+
const DynamicComponent = (props: TProps) => {
|
|
61
85
|
const [hasMounted, setHasMounted] = React.useState(false);
|
|
86
|
+
// Fixed per instance: a change of the element type would remount the component.
|
|
87
|
+
const [Component] = React.useState(() => loaded ?? LazyComponent);
|
|
62
88
|
|
|
63
89
|
React.useEffect(() => {
|
|
64
90
|
setHasMounted(true);
|
|
@@ -82,4 +108,10 @@ export function dynamic<TProps extends Record<string, unknown>>(
|
|
|
82
108
|
</React.Suspense>
|
|
83
109
|
);
|
|
84
110
|
};
|
|
111
|
+
|
|
112
|
+
return Object.assign(DynamicComponent, {
|
|
113
|
+
async preload() {
|
|
114
|
+
if (ssr || typeof window !== 'undefined') await load();
|
|
115
|
+
},
|
|
116
|
+
});
|
|
85
117
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ConsentConfig, RedoclyConfig } from '@redocly/config';
|
|
2
|
+
|
|
3
|
+
export type SettingsLinkPlacement = 'footer' | 'none';
|
|
4
|
+
|
|
5
|
+
export function resolveSettingsLinkPlacement(
|
|
6
|
+
consent: ConsentConfig | undefined,
|
|
7
|
+
footer: RedoclyConfig['footer'] | undefined,
|
|
8
|
+
): SettingsLinkPlacement {
|
|
9
|
+
const choice = consent?.settingsLink ?? 'auto';
|
|
10
|
+
if (choice !== 'auto') {
|
|
11
|
+
return choice;
|
|
12
|
+
}
|
|
13
|
+
const footerShown =
|
|
14
|
+
Boolean(footer) &&
|
|
15
|
+
!footer?.hide &&
|
|
16
|
+
(Boolean(footer?.copyrightText) || (Array.isArray(footer?.items) && footer.items.length > 0));
|
|
17
|
+
return footerShown ? 'footer' : 'none';
|
|
18
|
+
}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import type { ToolCall, ContentSegment } from '../types/search';
|
|
1
|
+
import type { ToolCall, ContentSegment, GroupedContentSegment } from '../types/search';
|
|
2
2
|
|
|
3
|
+
const SENTENCE_END_MARKS = '.!?:;';
|
|
4
|
+
const CLOSING_MARKS = `"')]*_\``;
|
|
5
|
+
const CODE_FENCE = /^[ \t]*(```|~~~)/gm;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Splits an answer at its tool calls. A call made in the middle of a sentence or a code block is
|
|
9
|
+
* placed at the end of that paragraph, so the sentence reads as one piece.
|
|
10
|
+
*/
|
|
3
11
|
export function splitContentByToolCalls(
|
|
4
12
|
content: string | undefined,
|
|
5
13
|
toolCalls: ToolCall[] | undefined,
|
|
@@ -8,20 +16,104 @@ export function splitContentByToolCalls(
|
|
|
8
16
|
return [{ type: 'text', text: content || '' }];
|
|
9
17
|
}
|
|
10
18
|
|
|
19
|
+
const text = content ?? '';
|
|
20
|
+
const fences = Array.from(text.matchAll(CODE_FENCE), (match) => match.index);
|
|
11
21
|
const segments: ContentSegment[] = [];
|
|
12
22
|
let lastPos = 0;
|
|
13
23
|
|
|
14
24
|
for (const toolCall of toolCalls) {
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
const position = Math.max(lastPos, getBlockBoundary(text, toolCall.position, fences));
|
|
26
|
+
if (position > lastPos) {
|
|
27
|
+
segments.push({ type: 'text', text: text.substring(lastPos, position) });
|
|
17
28
|
}
|
|
18
29
|
segments.push({ type: 'tool', toolCall });
|
|
19
|
-
lastPos =
|
|
30
|
+
lastPos = position;
|
|
20
31
|
}
|
|
21
32
|
|
|
22
|
-
if (
|
|
23
|
-
segments.push({ type: 'text', text:
|
|
33
|
+
if (lastPos < text.length) {
|
|
34
|
+
segments.push({ type: 'text', text: text.substring(lastPos) });
|
|
24
35
|
}
|
|
25
36
|
|
|
26
37
|
return segments;
|
|
27
38
|
}
|
|
39
|
+
|
|
40
|
+
function getBlockBoundary(content: string, position: number, fences: number[]): number {
|
|
41
|
+
if (position <= 0 || position >= content.length) {
|
|
42
|
+
return position;
|
|
43
|
+
}
|
|
44
|
+
const isInsideCodeFence = (index: number) => {
|
|
45
|
+
let count = 0;
|
|
46
|
+
while (count < fences.length && fences[count] < index) count++;
|
|
47
|
+
return count % 2 === 1;
|
|
48
|
+
};
|
|
49
|
+
if (!isInsideCodeFence(position) && endsBlockOrSentence(content, position)) {
|
|
50
|
+
return position;
|
|
51
|
+
}
|
|
52
|
+
for (
|
|
53
|
+
let boundary = content.indexOf('\n\n', position);
|
|
54
|
+
boundary !== -1;
|
|
55
|
+
boundary = content.indexOf('\n\n', boundary + 2)
|
|
56
|
+
) {
|
|
57
|
+
if (!isInsideCodeFence(boundary)) {
|
|
58
|
+
return boundary;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return content.length;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function endsBlockOrSentence(content: string, position: number): boolean {
|
|
65
|
+
let index = position - 1;
|
|
66
|
+
while (index >= 0 && /\s/.test(content[index])) {
|
|
67
|
+
if (content[index] === '\n') return true;
|
|
68
|
+
index--;
|
|
69
|
+
}
|
|
70
|
+
while (index >= 0 && CLOSING_MARKS.includes(content[index])) index--;
|
|
71
|
+
return index >= 0 && SENTENCE_END_MARKS.includes(content[index]);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Groups consecutive tool calls and drops text that is only whitespace. While the answer is
|
|
76
|
+
* generated, an answer with nothing to show yet is one empty active group (the thinking status),
|
|
77
|
+
* and the last group is active until text that is not whitespace follows it.
|
|
78
|
+
*/
|
|
79
|
+
export function groupToolCallSegments(
|
|
80
|
+
segments: ContentSegment[],
|
|
81
|
+
isGenerating?: boolean,
|
|
82
|
+
): GroupedContentSegment[] {
|
|
83
|
+
const grouped: GroupedContentSegment[] = [];
|
|
84
|
+
let text = '';
|
|
85
|
+
|
|
86
|
+
for (const segment of segments) {
|
|
87
|
+
if (segment.type === 'text') {
|
|
88
|
+
text += segment.text;
|
|
89
|
+
if (segment.text.trim()) {
|
|
90
|
+
grouped.push(segment);
|
|
91
|
+
}
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const previous = grouped.at(-1);
|
|
95
|
+
if (previous?.type === 'tools') {
|
|
96
|
+
previous.toolCalls.push(segment.toolCall);
|
|
97
|
+
} else {
|
|
98
|
+
grouped.push({ type: 'tools', toolCalls: [segment.toolCall], isActive: false });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (!isGenerating) {
|
|
103
|
+
return grouped;
|
|
104
|
+
}
|
|
105
|
+
const last = grouped.at(-1);
|
|
106
|
+
if (last?.type === 'tools') {
|
|
107
|
+
last.isActive = !text.slice(last.toolCalls.at(-1)?.position ?? 0).trim();
|
|
108
|
+
} else if (grouped.length === 0) {
|
|
109
|
+
return [{ type: 'tools', toolCalls: [], isActive: true }];
|
|
110
|
+
}
|
|
111
|
+
return grouped;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function hasToolCallsAndText(segments: ContentSegment[]): boolean {
|
|
115
|
+
return (
|
|
116
|
+
segments.some((segment) => segment.type === 'tool') &&
|
|
117
|
+
segments.some((segment) => segment.type === 'text' && segment.text.trim().length > 0)
|
|
118
|
+
);
|
|
119
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { saveAs } from 'file-saver';
|
|
2
2
|
|
|
3
|
-
import type { CodeWalkthroughFile } from '@redocly/
|
|
3
|
+
import type { CodeWalkthroughFile } from '@redocly/theme/core/types';
|
|
4
4
|
|
|
5
5
|
import { removeLeadingSlash } from './urls';
|
|
6
6
|
import { findClosestCommonDirectory } from './find-closest-common-directory';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DropdownAlignment } from '../types/dropdown';
|
|
2
|
+
|
|
3
|
+
export function fitDropdownAlignment(
|
|
4
|
+
anchor: DOMRect,
|
|
5
|
+
menuWidth: number,
|
|
6
|
+
alignment: DropdownAlignment = 'start',
|
|
7
|
+
): DropdownAlignment {
|
|
8
|
+
const fits: Record<DropdownAlignment, boolean> = {
|
|
9
|
+
start: anchor.left + menuWidth <= window.innerWidth,
|
|
10
|
+
end: anchor.right - menuWidth >= 0,
|
|
11
|
+
};
|
|
12
|
+
const other: DropdownAlignment = alignment === 'end' ? 'start' : 'end';
|
|
13
|
+
return fits[alignment] || !fits[other] ? alignment : other;
|
|
14
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AiPromptTarget } from '../types/prompt';
|
|
2
|
+
|
|
3
|
+
type AiPromptEndpoint = { baseUrl: string; queryParam: string };
|
|
4
|
+
|
|
5
|
+
const AI_PROMPT_ENDPOINTS: Record<AiPromptTarget, AiPromptEndpoint> = {
|
|
6
|
+
chatgpt: { baseUrl: 'https://chat.openai.com', queryParam: 'q' },
|
|
7
|
+
claude: { baseUrl: 'https://claude.ai/new', queryParam: 'q' },
|
|
8
|
+
// Encoding: https://cursor.com/docs/integrations/deeplinks
|
|
9
|
+
cursor: { baseUrl: 'https://cursor.com/link/prompt', queryParam: 'text' },
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Builds a link that opens an AI tool with the prompt prefilled.
|
|
14
|
+
*
|
|
15
|
+
* @param target - The AI tool to open.
|
|
16
|
+
* @param prompt - The plain-text prompt to prefill.
|
|
17
|
+
* @returns The absolute URL with the encoded prompt in the query string.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* getAiPromptLink('claude', 'Summarize this page');
|
|
22
|
+
* // 'https://claude.ai/new?q=Summarize+this+page'
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export function getAiPromptLink(target: AiPromptTarget, prompt: string): string {
|
|
26
|
+
const { baseUrl, queryParam } = AI_PROMPT_ENDPOINTS[target];
|
|
27
|
+
const url = new URL(baseUrl);
|
|
28
|
+
url.searchParams.set(queryParam, prompt);
|
|
29
|
+
return url.toString();
|
|
30
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CodeWalkthroughFile, CodeWalkthroughNode } from '@redocly/
|
|
1
|
+
import type { CodeWalkthroughFile, CodeWalkthroughNode } from '@redocly/theme/core/types';
|
|
2
2
|
|
|
3
3
|
import { matchCodeWalkthroughConditions } from './match-code-walkthrough-conditions';
|
|
4
4
|
import { replaceInputsWithValue } from './replace-inputs-with-value';
|
package/src/core/utils/index.ts
CHANGED
|
@@ -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';
|
package/src/core/utils/mcp.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type { MCPClientType, McpConnectionParams } from '../types';
|
|
1
|
+
import type { MCPClientType, McpConnectionParams, MCPOption } from '../types';
|
|
2
|
+
|
|
3
|
+
import { MCP_OPTIONS } from '../constants/mcp';
|
|
4
|
+
|
|
5
|
+
export function isMCPOption(value: unknown): value is MCPOption {
|
|
6
|
+
return (MCP_OPTIONS as readonly unknown[]).includes(value);
|
|
7
|
+
}
|
|
2
8
|
|
|
3
9
|
function generateCursorMCPDeepLink(config: McpConnectionParams): string {
|
|
4
10
|
const cursorConfig = {
|
|
@@ -19,6 +25,12 @@ function generateVSCodeMCPDeepLink(config: McpConnectionParams): string {
|
|
|
19
25
|
return `vscode:mcp/install?${encodedConfig}`;
|
|
20
26
|
}
|
|
21
27
|
|
|
28
|
+
function generateClaudeConnectorLink(config: McpConnectionParams): string {
|
|
29
|
+
const connectorName = encodeURIComponent(config.serverName);
|
|
30
|
+
const connectorUrl = encodeURIComponent(config.url);
|
|
31
|
+
return `https://claude.ai/customize/connectors?modal=add-custom-connector&connectorName=${connectorName}&connectorUrl=${connectorUrl}`;
|
|
32
|
+
}
|
|
33
|
+
|
|
22
34
|
export function generateMCPDeepLink(
|
|
23
35
|
clientType: MCPClientType,
|
|
24
36
|
config: McpConnectionParams,
|
|
@@ -28,8 +40,8 @@ export function generateMCPDeepLink(
|
|
|
28
40
|
return generateCursorMCPDeepLink(config);
|
|
29
41
|
case 'vscode':
|
|
30
42
|
return generateVSCodeMCPDeepLink(config);
|
|
31
|
-
|
|
32
|
-
return
|
|
43
|
+
case 'claude':
|
|
44
|
+
return generateClaudeConnectorLink(config);
|
|
33
45
|
}
|
|
34
46
|
}
|
|
35
47
|
|
|
@@ -39,7 +51,7 @@ export function slugifyMcpServerName(name: string): string {
|
|
|
39
51
|
return name
|
|
40
52
|
.toLowerCase()
|
|
41
53
|
.replace(/[^a-z0-9_-]+/g, '-')
|
|
42
|
-
.replace(
|
|
54
|
+
.replace(/^-+|(?<!-)-+$/g, '');
|
|
43
55
|
}
|
|
44
56
|
|
|
45
57
|
export function generateClaudeCodeCommand(config: McpConnectionParams): string {
|
package/src/core/utils/menu.ts
CHANGED
|
@@ -3,8 +3,10 @@ import type { Location } from 'react-router';
|
|
|
3
3
|
|
|
4
4
|
import type { Locale, TFunction } from '../types/l10n';
|
|
5
5
|
import type { ItemState } from '../types/sidebar';
|
|
6
|
+
import type { NavigationTabRowItem, NavigationTabsState } from '../types/navigation-tabs';
|
|
6
7
|
import { MenuItemType } from '../constants/common';
|
|
7
|
-
import { getPathnameForLocale, withoutPathPrefix, withPathPrefix } from './urls';
|
|
8
|
+
import { addLeadingSlash, getPathnameForLocale, withoutPathPrefix, withPathPrefix } from './urls';
|
|
9
|
+
import { toNavigationTabsConfig } from './navigation-tabs';
|
|
8
10
|
|
|
9
11
|
const TRANSLATION_KEYS = {
|
|
10
12
|
version: 'mobileMenu.version',
|
|
@@ -24,10 +26,7 @@ export const mapNavbarItems = (
|
|
|
24
26
|
...(navItem.items && {
|
|
25
27
|
items: mapNavbarItems(navItem.items, defaultLocale, currentLocale, locales, location),
|
|
26
28
|
}),
|
|
27
|
-
|
|
28
|
-
active:
|
|
29
|
-
'link' in navItem &&
|
|
30
|
-
isItemActive(navItem, defaultLocale, currentLocale, locales, location),
|
|
29
|
+
active: isItemActive(navItem, defaultLocale, currentLocale, locales, location),
|
|
31
30
|
hasActiveSubItem: !!navItem.items?.find((item) =>
|
|
32
31
|
isItemActive(item, defaultLocale, currentLocale, locales, location),
|
|
33
32
|
),
|
|
@@ -42,10 +41,12 @@ export const isItemActive = (
|
|
|
42
41
|
locales: Locale[],
|
|
43
42
|
location: Location,
|
|
44
43
|
): boolean => {
|
|
44
|
+
if (!item.link) return false;
|
|
45
|
+
|
|
45
46
|
const pathHash = location.pathname + location.hash;
|
|
46
47
|
const link = item.languageInsensitive
|
|
47
|
-
? item.link
|
|
48
|
-
: getPathnameForLocale(item.link
|
|
48
|
+
? item.link
|
|
49
|
+
: getPathnameForLocale(item.link, defaultLocale, currentLocale, locales);
|
|
49
50
|
|
|
50
51
|
return pathHash === withPathPrefix(link);
|
|
51
52
|
};
|
|
@@ -71,7 +72,7 @@ export const buildLanguagesGroup = (
|
|
|
71
72
|
locale.code,
|
|
72
73
|
locales,
|
|
73
74
|
);
|
|
74
|
-
const newUrlWithLanguage = `${newLangPathname}${location.search}${location.hash}`;
|
|
75
|
+
const newUrlWithLanguage = `${addLeadingSlash(newLangPathname)}${location.search}${location.hash}`;
|
|
75
76
|
return {
|
|
76
77
|
type: 'link',
|
|
77
78
|
label: locale.name || locale.code || '',
|
|
@@ -112,8 +113,33 @@ export const buildVersionSection = (
|
|
|
112
113
|
];
|
|
113
114
|
};
|
|
114
115
|
|
|
116
|
+
export const buildNavigationTabsSelect = ({
|
|
117
|
+
navigationTabs,
|
|
118
|
+
}: {
|
|
119
|
+
navigationTabs: NavigationTabsState | undefined;
|
|
120
|
+
}): ItemState | undefined => {
|
|
121
|
+
const tabs = toNavigationTabsConfig({ state: navigationTabs })?.items;
|
|
122
|
+
|
|
123
|
+
if (!tabs) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const activeTab = tabs.find((tab) => tab.active);
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
type: MenuItemType.Select,
|
|
131
|
+
label: activeTab?.label ?? 'Navigation tabs',
|
|
132
|
+
labelTranslationKey: activeTab ? activeTab.labelTranslationKey : 'navigationTabs.label',
|
|
133
|
+
items: tabs.map(toNavigationTabOption),
|
|
134
|
+
active: false,
|
|
135
|
+
hasActiveSubItem: !!activeTab,
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
|
|
115
139
|
export function getMenuItemType(item: ItemState): MenuItemType {
|
|
116
|
-
if (item.type === MenuItemType.
|
|
140
|
+
if (item.type === MenuItemType.Select) {
|
|
141
|
+
return MenuItemType.Select;
|
|
142
|
+
} else if (item.type === MenuItemType.Separator) {
|
|
117
143
|
return MenuItemType.Separator;
|
|
118
144
|
} else if (item.menuStyle === 'drilldown') {
|
|
119
145
|
return MenuItemType.DrillDown;
|
|
@@ -123,3 +149,22 @@ export function getMenuItemType(item: ItemState): MenuItemType {
|
|
|
123
149
|
return MenuItemType.Operation;
|
|
124
150
|
} else return MenuItemType.Default;
|
|
125
151
|
}
|
|
152
|
+
|
|
153
|
+
function toNavigationTabOption(tab: NavigationTabRowItem): ItemState {
|
|
154
|
+
const landing =
|
|
155
|
+
tab.type === 'group' ? (tab.items.find((entry) => entry.active) ?? tab.items[0]) : tab;
|
|
156
|
+
|
|
157
|
+
return {
|
|
158
|
+
type: tab.type,
|
|
159
|
+
label: tab.label,
|
|
160
|
+
labelTranslationKey: tab.labelTranslationKey,
|
|
161
|
+
icon: tab.icon,
|
|
162
|
+
srcSet: tab.srcSet,
|
|
163
|
+
link: landing?.link,
|
|
164
|
+
external: landing?.external,
|
|
165
|
+
target: landing?.target,
|
|
166
|
+
items: [],
|
|
167
|
+
active: !!tab.active,
|
|
168
|
+
hasActiveSubItem: false,
|
|
169
|
+
};
|
|
170
|
+
}
|