@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
|
@@ -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';
|
package/lib/core/hooks/index.js
CHANGED
|
@@ -37,12 +37,17 @@ __exportStar(require("./menu/use-mobile-menu-levels"), exports);
|
|
|
37
37
|
__exportStar(require("./menu/use-collapse"), exports);
|
|
38
38
|
__exportStar(require("./feedback/use-report-dialog"), exports);
|
|
39
39
|
__exportStar(require("./use-tabs"), exports);
|
|
40
|
+
__exportStar(require("./use-tab-list"), exports);
|
|
40
41
|
__exportStar(require("./use-focus-trap"), exports);
|
|
42
|
+
__exportStar(require("./use-consent-dialog"), exports);
|
|
43
|
+
__exportStar(require("./use-consent-telemetry"), exports);
|
|
41
44
|
__exportStar(require("./use-language-picker"), exports);
|
|
42
45
|
__exportStar(require("./use-product-picker"), exports);
|
|
43
46
|
__exportStar(require("./search/use-search-dialog"), exports);
|
|
44
47
|
__exportStar(require("./search/use-search-filter"), exports);
|
|
45
48
|
__exportStar(require("./search/use-feedback-tooltip"), exports);
|
|
49
|
+
__exportStar(require("./search/use-search-ai-activity"), exports);
|
|
50
|
+
__exportStar(require("./search/use-persisted-quick-filter"), exports);
|
|
46
51
|
__exportStar(require("./use-controlled-state"), exports);
|
|
47
52
|
__exportStar(require("./use-codeblock-tabs-controls"), exports);
|
|
48
53
|
__exportStar(require("./code-walkthrough/use-code-walkthrough"), exports);
|
|
@@ -72,4 +77,8 @@ __exportStar(require("./use-toast-logic"), exports);
|
|
|
72
77
|
__exportStar(require("./use-banner-telemetry"), exports);
|
|
73
78
|
__exportStar(require("./use-tooltip-fallback-placement"), exports);
|
|
74
79
|
__exportStar(require("./use-anchor-positioning"), exports);
|
|
80
|
+
__exportStar(require("./use-scroll-item-into-view"), exports);
|
|
81
|
+
__exportStar(require("./use-pointer-border-highlight"), exports);
|
|
82
|
+
__exportStar(require("./prompt/use-prompt-text-limit"), exports);
|
|
83
|
+
__exportStar(require("./prompt/use-prompt-actions"), exports);
|
|
75
84
|
//# sourceMappingURL=index.js.map
|
|
@@ -169,6 +169,6 @@ function useEvent(callback) {
|
|
|
169
169
|
(0, react_1.useEffect)(() => {
|
|
170
170
|
ref.current = callback;
|
|
171
171
|
});
|
|
172
|
-
return (0, react_1.useCallback)((
|
|
172
|
+
return (0, react_1.useCallback)((...args) => { var _a; return (_a = ref.current) === null || _a === void 0 ? void 0 : _a.call(ref, ...args); }, []);
|
|
173
173
|
}
|
|
174
174
|
//# sourceMappingURL=use-collapse.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMobileMenuItems = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
4
5
|
const react_router_1 = require("react-router");
|
|
5
6
|
const use_theme_hooks_1 = require("../use-theme-hooks");
|
|
6
7
|
const use_theme_config_1 = require("../use-theme-config");
|
|
@@ -10,73 +11,96 @@ const MENU_SEPARATOR = {
|
|
|
10
11
|
type: 'separator',
|
|
11
12
|
separatorLine: true,
|
|
12
13
|
};
|
|
14
|
+
const NO_VERSIONS = [];
|
|
15
|
+
const NO_NAV_ITEMS = [];
|
|
13
16
|
const useMobileMenuItems = (menuType) => {
|
|
14
|
-
var _a, _b, _c;
|
|
15
|
-
|
|
16
|
-
const {
|
|
17
|
+
var _a, _b, _c, _d;
|
|
18
|
+
var _e, _f, _g;
|
|
19
|
+
const { useTranslate, useL10nConfig, useCurrentProduct, usePageVersions, useSidebarItems, useNavigationTabs, } = (0, use_theme_hooks_1.useThemeHooks)();
|
|
20
|
+
const versions = (_e = (_a = usePageVersions()) === null || _a === void 0 ? void 0 : _a.versions) !== null && _e !== void 0 ? _e : NO_VERSIONS;
|
|
17
21
|
const { defaultLocale, currentLocale, locales } = useL10nConfig();
|
|
18
22
|
const { translate } = useTranslate();
|
|
19
23
|
const activeVersion = versions.find((version) => version.active);
|
|
20
24
|
const { currentItems: sidebarItems, pushDrilldownState, popDrilldownState, backLink, } = useSidebarItems(activeVersion);
|
|
25
|
+
const navigationTabs = useNavigationTabs();
|
|
21
26
|
const location = (0, react_router_1.useLocation)();
|
|
22
27
|
const currentProduct = useCurrentProduct();
|
|
23
|
-
const hasProductNavbarOverride = (
|
|
28
|
+
const hasProductNavbarOverride = (_b = currentProduct === null || currentProduct === void 0 ? void 0 : currentProduct.configOverride) === null || _b === void 0 ? void 0 : _b.navbar;
|
|
24
29
|
const productThemeConfig = (0, use_theme_config_1.useThemeConfig)();
|
|
25
30
|
const baseThemeConfig = (0, use_theme_config_1.useThemeConfig)(false);
|
|
26
|
-
const baseNavItems = (((
|
|
27
|
-
const productNavItems = (hasProductNavbarOverride ? ((
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const baseNavItems = ((_f = (_c = baseThemeConfig.navbar) === null || _c === void 0 ? void 0 : _c.items) !== null && _f !== void 0 ? _f : NO_NAV_ITEMS);
|
|
32
|
+
const productNavItems = (hasProductNavbarOverride ? ((_g = (_d = productThemeConfig.navbar) === null || _d === void 0 ? void 0 : _d.items) !== null && _g !== void 0 ? _g : NO_NAV_ITEMS) : NO_NAV_ITEMS);
|
|
33
|
+
const products = baseThemeConfig.products;
|
|
34
|
+
const items = (0, react_1.useMemo)(() => {
|
|
35
|
+
const menuItems = [];
|
|
36
|
+
const navigationTabsSelect = menuType === common_1.MobileMenuType.PAGE ? (0, menu_1.buildNavigationTabsSelect)({ navigationTabs }) : undefined;
|
|
37
|
+
if (menuType === common_1.MobileMenuType.PAGE) {
|
|
38
|
+
if (activeVersion) {
|
|
39
|
+
menuItems.push(...(0, menu_1.buildVersionSection)(translate, versions, activeVersion));
|
|
40
|
+
}
|
|
41
|
+
if (menuItems.length && sidebarItems.length) {
|
|
42
|
+
menuItems.push(MENU_SEPARATOR);
|
|
43
|
+
}
|
|
44
|
+
menuItems.push(...sidebarItems);
|
|
35
45
|
}
|
|
36
|
-
if (
|
|
37
|
-
menuItems.push(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
menuItems.push(MENU_SEPARATOR);
|
|
45
|
-
}
|
|
46
|
-
if (baseNavItems.length) {
|
|
47
|
-
menuItems.push(...baseNavItems);
|
|
46
|
+
else if (menuType === common_1.MobileMenuType.PRODUCT) {
|
|
47
|
+
menuItems.push(...productNavItems);
|
|
48
|
+
if (menuItems.length && baseNavItems.length) {
|
|
49
|
+
menuItems.push(MENU_SEPARATOR);
|
|
50
|
+
}
|
|
51
|
+
if (baseNavItems.length) {
|
|
52
|
+
menuItems.push(...baseNavItems);
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
else if (menuType === common_1.MobileMenuType.MAIN_MENU) {
|
|
56
|
+
const productMenuItems = Object.values(products || {}).map((product) => ({
|
|
57
|
+
label: product.name,
|
|
58
|
+
link: product.link,
|
|
59
|
+
icon: product.icon,
|
|
60
|
+
type: 'link',
|
|
61
|
+
}));
|
|
62
|
+
if (productMenuItems.length) {
|
|
63
|
+
menuItems.push({
|
|
64
|
+
type: 'separator',
|
|
65
|
+
label: translate('mobileMenu.products', 'Products'),
|
|
66
|
+
});
|
|
67
|
+
menuItems.push(...productMenuItems);
|
|
68
|
+
}
|
|
69
|
+
if (menuItems.length && baseNavItems.length) {
|
|
70
|
+
menuItems.push(MENU_SEPARATOR);
|
|
71
|
+
}
|
|
72
|
+
if (baseNavItems.length) {
|
|
73
|
+
menuItems.push(...baseNavItems);
|
|
74
|
+
}
|
|
63
75
|
}
|
|
64
|
-
|
|
76
|
+
const languagesMenu = (0, menu_1.buildLanguagesGroup)(locales, defaultLocale, currentLocale);
|
|
77
|
+
if (menuItems.length && languagesMenu) {
|
|
65
78
|
menuItems.push(MENU_SEPARATOR);
|
|
66
79
|
}
|
|
67
|
-
if (
|
|
68
|
-
menuItems.push(
|
|
80
|
+
if (languagesMenu) {
|
|
81
|
+
menuItems.push(languagesMenu);
|
|
69
82
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
83
|
+
return [
|
|
84
|
+
...(navigationTabsSelect ? [navigationTabsSelect] : []),
|
|
85
|
+
...(0, menu_1.mapNavbarItems)(menuItems, defaultLocale, currentLocale, locales, location),
|
|
86
|
+
];
|
|
87
|
+
}, [
|
|
88
|
+
menuType,
|
|
89
|
+
navigationTabs,
|
|
90
|
+
activeVersion,
|
|
91
|
+
versions,
|
|
92
|
+
sidebarItems,
|
|
93
|
+
productNavItems,
|
|
94
|
+
baseNavItems,
|
|
95
|
+
products,
|
|
96
|
+
translate,
|
|
97
|
+
locales,
|
|
98
|
+
defaultLocale,
|
|
99
|
+
currentLocale,
|
|
100
|
+
location,
|
|
101
|
+
]);
|
|
78
102
|
return {
|
|
79
|
-
items
|
|
103
|
+
items,
|
|
80
104
|
popDrilldownState,
|
|
81
105
|
pushDrilldownState,
|
|
82
106
|
backLink,
|
|
@@ -7,31 +7,36 @@ const use_theme_hooks_1 = require("../use-theme-hooks");
|
|
|
7
7
|
const use_theme_config_1 = require("../use-theme-config");
|
|
8
8
|
const common_1 = require("../../constants/common");
|
|
9
9
|
const useMobileMenuLevels = () => {
|
|
10
|
-
var _a, _b;
|
|
11
|
-
const { useTranslate, useCurrentProduct, usePageVersions, useSidebarItems } = (0, use_theme_hooks_1.useThemeHooks)();
|
|
10
|
+
var _a, _b, _c;
|
|
11
|
+
const { useTranslate, useCurrentProduct, usePageVersions, useSidebarItems, useNavigationTabs } = (0, use_theme_hooks_1.useThemeHooks)();
|
|
12
12
|
const { versions = [] } = usePageVersions() || {};
|
|
13
13
|
const activeVersion = versions.find((version) => version === null || version === void 0 ? void 0 : version.active);
|
|
14
14
|
const { currentItems: sidebarItems } = useSidebarItems(activeVersion);
|
|
15
|
+
const navigationTabs = useNavigationTabs();
|
|
15
16
|
const { translate } = useTranslate();
|
|
16
17
|
const currentProduct = useCurrentProduct();
|
|
17
18
|
const productThemeConfig = (0, use_theme_config_1.useThemeConfig)();
|
|
19
|
+
const baseThemeConfig = (0, use_theme_config_1.useThemeConfig)(false);
|
|
18
20
|
const location = (0, react_router_1.useLocation)();
|
|
19
21
|
const hasProductNavbarOverride = (_a = currentProduct === null || currentProduct === void 0 ? void 0 : currentProduct.configOverride) === null || _a === void 0 ? void 0 : _a.navbar;
|
|
20
22
|
const productNavItems = (hasProductNavbarOverride ? ((_b = productThemeConfig.navbar) === null || _b === void 0 ? void 0 : _b.items) || [] : []);
|
|
23
|
+
const hasMainMenuItems = Object.values(baseThemeConfig.products || {}).length > 0 ||
|
|
24
|
+
(((_c = baseThemeConfig.navbar) === null || _c === void 0 ? void 0 : _c.items) || []).length > 0;
|
|
21
25
|
const menuLevels = (0, react_1.useMemo)(() => {
|
|
22
|
-
const menuLevels = [
|
|
23
|
-
|
|
26
|
+
const menuLevels = [];
|
|
27
|
+
if (hasMainMenuItems) {
|
|
28
|
+
menuLevels.push({
|
|
24
29
|
label: translate('mobileMenu.mainMenu', 'Main menu'),
|
|
25
30
|
type: common_1.MobileMenuType.MAIN_MENU,
|
|
26
|
-
}
|
|
27
|
-
|
|
31
|
+
});
|
|
32
|
+
}
|
|
28
33
|
if (currentProduct && productNavItems.length) {
|
|
29
34
|
menuLevels.push({
|
|
30
35
|
label: currentProduct.name,
|
|
31
36
|
type: common_1.MobileMenuType.PRODUCT,
|
|
32
37
|
});
|
|
33
38
|
}
|
|
34
|
-
if (sidebarItems.length || activeVersion) {
|
|
39
|
+
if (sidebarItems.length || activeVersion || (navigationTabs === null || navigationTabs === void 0 ? void 0 : navigationTabs.tabs.length)) {
|
|
35
40
|
menuLevels.push({
|
|
36
41
|
label: translate('mobileMenu.previous', 'Previous'),
|
|
37
42
|
type: common_1.MobileMenuType.PAGE,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AiPromptTarget } from '../../types/prompt';
|
|
2
|
+
export type PromptActionHandlers = {
|
|
3
|
+
reportCopy: () => void;
|
|
4
|
+
/** Opens the prompt in the AI tool and reports it. */
|
|
5
|
+
openIn: (target: AiPromptTarget) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function usePromptActions(prompt: string): PromptActionHandlers;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePromptActions = usePromptActions;
|
|
4
|
+
const use_theme_hooks_1 = require("../use-theme-hooks");
|
|
5
|
+
const get_ai_prompt_link_1 = require("../../utils/get-ai-prompt-link");
|
|
6
|
+
const get_base_data_attributes_1 = require("../../utils/telemetry/get-base-data-attributes");
|
|
7
|
+
function usePromptActions(prompt) {
|
|
8
|
+
const { useTelemetry } = (0, use_theme_hooks_1.useThemeHooks)();
|
|
9
|
+
const telemetry = useTelemetry();
|
|
10
|
+
const tagData = (0, get_base_data_attributes_1.getBaseDataAttributes)('prompt', 'markdocTag');
|
|
11
|
+
return {
|
|
12
|
+
reportCopy: () => telemetry.sendPromptTagCopiedMessage([tagData]),
|
|
13
|
+
openIn: (target) => {
|
|
14
|
+
telemetry.sendPromptTagOpenedMessage([Object.assign(Object.assign({}, tagData), { target })]);
|
|
15
|
+
window.open((0, get_ai_prompt_link_1.getAiPromptLink)(target, prompt), '_blank', 'noopener,noreferrer');
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=use-prompt-actions.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
export type PromptTextLimit = 'none' | 'oneLine' | 'maxLines';
|
|
3
|
+
export type UsePromptTextLimitParams = {
|
|
4
|
+
prompt: string;
|
|
5
|
+
singleLine: boolean;
|
|
6
|
+
isPromptVisible: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type PromptTextLimitState = {
|
|
9
|
+
textRef: RefObject<HTMLDivElement | null>;
|
|
10
|
+
textLimit: PromptTextLimit;
|
|
11
|
+
isExpanded: boolean;
|
|
12
|
+
hasHiddenText: boolean;
|
|
13
|
+
toggleExpanded: () => void;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Tracks the line limit of the prompt text (one line or the maximum lines) and whether the
|
|
17
|
+
* reader expanded it. `hasHiddenText` is true only when the limit hides some text.
|
|
18
|
+
*/
|
|
19
|
+
export declare function usePromptTextLimit({ prompt, singleLine, isPromptVisible, }: UsePromptTextLimitParams): PromptTextLimitState;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePromptTextLimit = usePromptTextLimit;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
/**
|
|
6
|
+
* Tracks the line limit of the prompt text (one line or the maximum lines) and whether the
|
|
7
|
+
* reader expanded it. `hasHiddenText` is true only when the limit hides some text.
|
|
8
|
+
*/
|
|
9
|
+
function usePromptTextLimit({ prompt, singleLine, isPromptVisible, }) {
|
|
10
|
+
const textRef = (0, react_1.useRef)(null);
|
|
11
|
+
const [isExpanded, setIsExpanded] = (0, react_1.useState)(false);
|
|
12
|
+
const [hasHiddenText, setHasHiddenText] = (0, react_1.useState)(false);
|
|
13
|
+
/* The text mounts late with hidePrompt and re-wraps on resize, so the observer is
|
|
14
|
+
attached each time the text (re)appears. */
|
|
15
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
16
|
+
const text = textRef.current;
|
|
17
|
+
if (!text || isExpanded)
|
|
18
|
+
return;
|
|
19
|
+
const measure = () => setHasHiddenText(text.scrollHeight > text.clientHeight || text.scrollWidth > text.clientWidth);
|
|
20
|
+
measure();
|
|
21
|
+
if (typeof ResizeObserver === 'undefined')
|
|
22
|
+
return;
|
|
23
|
+
const observer = new ResizeObserver(measure);
|
|
24
|
+
observer.observe(text);
|
|
25
|
+
return () => observer.disconnect();
|
|
26
|
+
}, [prompt, singleLine, isExpanded, isPromptVisible]);
|
|
27
|
+
return {
|
|
28
|
+
textRef,
|
|
29
|
+
textLimit: isExpanded ? 'none' : singleLine ? 'oneLine' : 'maxLines',
|
|
30
|
+
isExpanded,
|
|
31
|
+
hasHiddenText,
|
|
32
|
+
toggleExpanded: () => setIsExpanded((expanded) => !expanded),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=use-prompt-text-limit.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import type { SearchFacet, SearchFilterItem } from '../../types/search';
|
|
3
|
+
type UsePersistedQuickFilterOptions = {
|
|
4
|
+
filter: SearchFilterItem[];
|
|
5
|
+
setFilter: Dispatch<SetStateAction<SearchFilterItem[]>>;
|
|
6
|
+
facets: SearchFacet[];
|
|
7
|
+
groupField: string;
|
|
8
|
+
query: string;
|
|
9
|
+
isSearchLoading: boolean;
|
|
10
|
+
searchError: string | null;
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Remembers the quick filter on `groupField` for the browser tab and restores it on mount unless
|
|
15
|
+
* one is already selected. Restored values are dropped once known not to exist: absent from the
|
|
16
|
+
* full value list, or from the `groupField` facet left by the first search that finishes without
|
|
17
|
+
* error on an empty query (the restored value is that search's filter, so a value without
|
|
18
|
+
* documents is not counted). Does nothing while `enabled` is false.
|
|
19
|
+
*/
|
|
20
|
+
export declare function usePersistedQuickFilter({ filter, setFilter, facets, groupField, query, isSearchLoading, searchError, enabled, }: UsePersistedQuickFilterOptions): void;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePersistedQuickFilter = usePersistedQuickFilter;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const use_store_1 = require("../use-store");
|
|
6
|
+
const quickFilterStore = (0, use_store_1.createStore)({
|
|
7
|
+
storageKey: 'searchQuickFilter',
|
|
8
|
+
storageType: 'sessionStorage',
|
|
9
|
+
});
|
|
10
|
+
const findQuickFilter = (filter) => filter.find((item) => item.isQuickFilter);
|
|
11
|
+
const withQuickFilter = (filter, quickFilter) => [
|
|
12
|
+
...filter.filter((item) => !item.isQuickFilter),
|
|
13
|
+
...(quickFilter.values.length ? [Object.assign(Object.assign({}, quickFilter), { isQuickFilter: true })] : []),
|
|
14
|
+
];
|
|
15
|
+
const groupFacetValues = (facets, field) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const facet = facets.find((item) => item.field === field);
|
|
18
|
+
const values = (_a = facet === null || facet === void 0 ? void 0 : facet.values) !== null && _a !== void 0 ? _a : [];
|
|
19
|
+
return {
|
|
20
|
+
present: facet !== undefined,
|
|
21
|
+
values: values.map((item) => (typeof item === 'string' ? item : item.value)),
|
|
22
|
+
counted: values.some((item) => typeof item !== 'string' && item.isCounterVisible),
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
const isRestorable = (stored, groupField) => !!stored &&
|
|
26
|
+
stored.field === groupField &&
|
|
27
|
+
Array.isArray(stored.values) &&
|
|
28
|
+
stored.values.length > 0 &&
|
|
29
|
+
stored.values.every((value) => typeof value === 'string');
|
|
30
|
+
/**
|
|
31
|
+
* Remembers the quick filter on `groupField` for the browser tab and restores it on mount unless
|
|
32
|
+
* one is already selected. Restored values are dropped once known not to exist: absent from the
|
|
33
|
+
* full value list, or from the `groupField` facet left by the first search that finishes without
|
|
34
|
+
* error on an empty query (the restored value is that search's filter, so a value without
|
|
35
|
+
* documents is not counted). Does nothing while `enabled` is false.
|
|
36
|
+
*/
|
|
37
|
+
function usePersistedQuickFilter({ filter, setFilter, facets, groupField, query, isSearchLoading, searchError, enabled = true, }) {
|
|
38
|
+
const [stored, setStored] = (0, use_store_1.useStore)(quickFilterStore, null);
|
|
39
|
+
const [initial] = (0, react_1.useState)(() => enabled && isRestorable(stored, groupField) && !findQuickFilter(filter) ? stored.values : null);
|
|
40
|
+
const phaseRef = (0, react_1.useRef)(initial ? 'restoring' : 'done');
|
|
41
|
+
const searchedRef = (0, react_1.useRef)(false);
|
|
42
|
+
(0, react_1.useEffect)(() => {
|
|
43
|
+
if (!initial)
|
|
44
|
+
return;
|
|
45
|
+
// oxlint-disable-next-line react-you-might-not-need-an-effect/no-pass-data-to-parent -- the filter state belongs to the product's `useSearch` and starts empty on every mount
|
|
46
|
+
setFilter((current) => withQuickFilter(current, { field: groupField, values: initial }));
|
|
47
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- applies only to the initial state
|
|
48
|
+
}, []);
|
|
49
|
+
(0, react_1.useEffect)(() => {
|
|
50
|
+
if (!enabled)
|
|
51
|
+
return;
|
|
52
|
+
const quickFilter = findQuickFilter(filter);
|
|
53
|
+
// The commit that starts the restore still sees the empty initial filter.
|
|
54
|
+
if (phaseRef.current === 'restoring') {
|
|
55
|
+
if (!quickFilter)
|
|
56
|
+
return;
|
|
57
|
+
phaseRef.current = 'validating';
|
|
58
|
+
}
|
|
59
|
+
if (phaseRef.current === 'validating' && initial) {
|
|
60
|
+
if (isSearchLoading)
|
|
61
|
+
searchedRef.current = true;
|
|
62
|
+
const settled = searchedRef.current && !isSearchLoading && !searchError && !query.trim();
|
|
63
|
+
const { present, values: known, counted } = groupFacetValues(facets, groupField);
|
|
64
|
+
if ((known.length && !counted) || (settled && present)) {
|
|
65
|
+
phaseRef.current = 'done';
|
|
66
|
+
const values = quickFilter === null || quickFilter === void 0 ? void 0 : quickFilter.values.filter((value) => known.includes(value) || !initial.includes(value));
|
|
67
|
+
if (quickFilter && values && values.length !== quickFilter.values.length) {
|
|
68
|
+
// oxlint-disable-next-line react-you-might-not-need-an-effect/no-pass-data-to-parent -- the facets arrive after the restore
|
|
69
|
+
setFilter((current) => withQuickFilter(current, { field: groupField, values }));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const next = quickFilter ? { field: quickFilter.field, values: quickFilter.values } : null;
|
|
75
|
+
if (JSON.stringify(next) !== JSON.stringify(stored)) {
|
|
76
|
+
setStored(next);
|
|
77
|
+
}
|
|
78
|
+
}, [
|
|
79
|
+
enabled,
|
|
80
|
+
filter,
|
|
81
|
+
facets,
|
|
82
|
+
groupField,
|
|
83
|
+
query,
|
|
84
|
+
isSearchLoading,
|
|
85
|
+
searchError,
|
|
86
|
+
initial,
|
|
87
|
+
stored,
|
|
88
|
+
setFilter,
|
|
89
|
+
setStored,
|
|
90
|
+
]);
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=use-persisted-quick-filter.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SearchAiActivityStatus, SearchAiActivityStep, ToolCall } from '../../types/search';
|
|
2
|
+
type UseSearchAiActivityParams = {
|
|
3
|
+
toolCalls: ToolCall[];
|
|
4
|
+
isActive: boolean;
|
|
5
|
+
};
|
|
6
|
+
type UseSearchAiActivityReturn = {
|
|
7
|
+
status: SearchAiActivityStatus;
|
|
8
|
+
steps: SearchAiActivityStep[];
|
|
9
|
+
};
|
|
10
|
+
export declare function useSearchAiActivity({ toolCalls, isActive, }: UseSearchAiActivityParams): UseSearchAiActivityReturn;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSearchAiActivity = useSearchAiActivity;
|
|
4
|
+
const use_theme_hooks_1 = require("../use-theme-hooks");
|
|
5
|
+
const search_ai_activity_1 = require("../../utils/search-ai-activity");
|
|
6
|
+
function useSearchAiActivity({ toolCalls, isActive, }) {
|
|
7
|
+
const { useTranslate } = (0, use_theme_hooks_1.useThemeHooks)();
|
|
8
|
+
const { translate } = useTranslate();
|
|
9
|
+
const runningToolCall = isActive ? toolCalls.find((toolCall) => !toolCall.result) : undefined;
|
|
10
|
+
return {
|
|
11
|
+
status: (0, search_ai_activity_1.getSearchAiActivityStatus)(toolCalls, isActive, runningToolCall, translate),
|
|
12
|
+
steps: toolCalls.map((toolCall) => (0, search_ai_activity_1.getSearchAiActivityStep)(toolCall, isActive && !toolCall.result, translate)),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=use-search-ai-activity.js.map
|
|
@@ -41,11 +41,13 @@ function useConnectMCPButton({ options = mcp_1.DEFAULT_MCP_OPTIONS, } = {}) {
|
|
|
41
41
|
const urlMap = {
|
|
42
42
|
cursor: cursorUrl,
|
|
43
43
|
vscode: vscodeUrl,
|
|
44
|
+
claude: (0, mcp_2.generateMCPDeepLink)('claude', connection),
|
|
44
45
|
};
|
|
45
46
|
window.open(urlMap[action], '_blank');
|
|
46
47
|
}, [cursorUrl, vscodeUrl, serverUrl, serverName, resetCopied, telemetry]);
|
|
47
48
|
const triggerButtonText = (0, react_1.useMemo)(() => translate('page.actions.connectMcp', 'Connect MCP'), [translate]);
|
|
48
|
-
|
|
49
|
+
// Markdoc reports attribute errors but still renders the tag, so `options` can be any value.
|
|
50
|
+
const visibleOptions = (0, react_1.useMemo)(() => Array.isArray(options) ? [...new Set(options.filter(mcp_2.isMCPOption))] : [...mcp_1.DEFAULT_MCP_OPTIONS], [options]);
|
|
49
51
|
return {
|
|
50
52
|
copiedOption,
|
|
51
53
|
cursorUrl,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import type { ConsentCategory, ConsentCategoryId, UseConsentResult } from '../types/consent';
|
|
3
|
+
export type ConsentDraft = Record<Exclude<ConsentCategoryId, 'necessary'>, boolean>;
|
|
4
|
+
export type UseConsentDialogResult = {
|
|
5
|
+
draft: ConsentDraft;
|
|
6
|
+
setCategory: (id: keyof ConsentDraft, value: boolean) => void;
|
|
7
|
+
dialogRef: RefObject<HTMLDivElement | null>;
|
|
8
|
+
close: () => void;
|
|
9
|
+
save: () => void;
|
|
10
|
+
categories: readonly ConsentCategory[];
|
|
11
|
+
};
|
|
12
|
+
export declare function useConsentDialog(consent: UseConsentResult): UseConsentDialogResult;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useConsentDialog = useConsentDialog;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const consent_1 = require("../constants/consent");
|
|
6
|
+
const use_focus_trap_1 = require("./use-focus-trap");
|
|
7
|
+
function useConsentDialog(consent) {
|
|
8
|
+
const [draft, setDraft] = (0, react_1.useState)(() => { var _a, _b; var _c, _d; return ({
|
|
9
|
+
analytics: (_c = (_a = consent.state) === null || _a === void 0 ? void 0 : _a.analytics) !== null && _c !== void 0 ? _c : consent.mode === 'opt-out',
|
|
10
|
+
marketing: ((_d = (_b = consent.state) === null || _b === void 0 ? void 0 : _b.marketing) !== null && _d !== void 0 ? _d : consent.mode === 'opt-out') && !consent.gpc,
|
|
11
|
+
}); });
|
|
12
|
+
const dialogRef = (0, react_1.useRef)(null);
|
|
13
|
+
const close = consent.closeDialog;
|
|
14
|
+
const closeRef = (0, react_1.useRef)(close);
|
|
15
|
+
closeRef.current = close;
|
|
16
|
+
(0, react_1.useEffect)(() => {
|
|
17
|
+
const previous = document.activeElement;
|
|
18
|
+
const onKeyDown = (event) => {
|
|
19
|
+
if (event.key === 'Escape')
|
|
20
|
+
closeRef.current();
|
|
21
|
+
};
|
|
22
|
+
document.addEventListener('keydown', onKeyDown);
|
|
23
|
+
return () => {
|
|
24
|
+
var _a;
|
|
25
|
+
document.removeEventListener('keydown', onKeyDown);
|
|
26
|
+
(_a = previous === null || previous === void 0 ? void 0 : previous.focus) === null || _a === void 0 ? void 0 : _a.call(previous);
|
|
27
|
+
};
|
|
28
|
+
}, []);
|
|
29
|
+
(0, use_focus_trap_1.useFocusTrap)(dialogRef);
|
|
30
|
+
const setCategory = (id, value) => {
|
|
31
|
+
setDraft((current) => (Object.assign(Object.assign({}, current), { [id]: value })));
|
|
32
|
+
};
|
|
33
|
+
const save = () => consent.save(draft);
|
|
34
|
+
return { draft, setCategory, dialogRef, close, save, categories: consent_1.CONSENT_CATEGORIES };
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=use-consent-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useConsentTelemetry(): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useConsentTelemetry = useConsentTelemetry;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const use_theme_hooks_1 = require("./use-theme-hooks");
|
|
6
|
+
const get_base_data_attributes_1 = require("../utils/telemetry/get-base-data-attributes");
|
|
7
|
+
function isRealmOwned(runtime) {
|
|
8
|
+
return runtime.region.source !== 'provider';
|
|
9
|
+
}
|
|
10
|
+
function getConsentRuntime() {
|
|
11
|
+
var _a;
|
|
12
|
+
if (typeof window === 'undefined')
|
|
13
|
+
return undefined;
|
|
14
|
+
return (_a = window.redocly) === null || _a === void 0 ? void 0 : _a.consent;
|
|
15
|
+
}
|
|
16
|
+
// Sends one consent.changed event per visitor choice in the modes Realm owns.
|
|
17
|
+
function useConsentTelemetry() {
|
|
18
|
+
const { useTelemetry } = (0, use_theme_hooks_1.useThemeHooks)();
|
|
19
|
+
const telemetry = useTelemetry();
|
|
20
|
+
const telemetryRef = (0, react_1.useRef)(telemetry);
|
|
21
|
+
telemetryRef.current = telemetry;
|
|
22
|
+
(0, react_1.useEffect)(() => {
|
|
23
|
+
const found = getConsentRuntime();
|
|
24
|
+
const runtime = found && isRealmOwned(found) ? found : null;
|
|
25
|
+
if (!runtime)
|
|
26
|
+
return;
|
|
27
|
+
return runtime.on('change', (state) => {
|
|
28
|
+
const choice = state.analytics && state.marketing
|
|
29
|
+
? 'accept'
|
|
30
|
+
: !state.analytics && !state.marketing
|
|
31
|
+
? 'reject'
|
|
32
|
+
: 'partial';
|
|
33
|
+
const { origin, pathname, search, hash } = window.location;
|
|
34
|
+
const uri = `${origin}${pathname}${search}${hash}`;
|
|
35
|
+
telemetryRef.current.sendConsentChangedMessage([
|
|
36
|
+
Object.assign(Object.assign({}, (0, get_base_data_attributes_1.getBaseDataAttributes)('consent', 'consent')), { choice, mode: runtime.mode, configuredMode: runtime.configuredMode, regionSource: runtime.region.source, gpc: runtime.gpc }),
|
|
37
|
+
(0, get_base_data_attributes_1.getBaseDataAttributes)(uri, 'page', uri),
|
|
38
|
+
]);
|
|
39
|
+
});
|
|
40
|
+
}, []);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=use-consent-telemetry.js.map
|
|
@@ -23,8 +23,10 @@ function useDialogHotKeys(ref, onClose) {
|
|
|
23
23
|
};
|
|
24
24
|
const onFocusableElementsHandler = () => {
|
|
25
25
|
var _a;
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
var _b;
|
|
27
|
+
const focusableElements = Array.from((_b = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('input, textarea, select, button, [href], [tabindex]:not([tabindex="-1"])')) !== null && _b !== void 0 ? _b : []).filter((element) => !element.hasAttribute('disabled') &&
|
|
28
|
+
(typeof element.checkVisibility !== 'function' || element.checkVisibility()));
|
|
29
|
+
if (focusableElements.length > 0) {
|
|
28
30
|
firstFocusableRef.current = focusableElements[0];
|
|
29
31
|
lastFocusableRef.current = focusableElements[focusableElements.length - 1];
|
|
30
32
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
|
-
export declare function useFullHeight(
|
|
2
|
+
export declare function useFullHeight(elementRef: RefObject<HTMLElement | null>): void;
|