@redocly/theme 0.59.0-rc.3 → 0.60.0-custom.2
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/LICENSE +7 -1
- package/lib/components/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription.js +1 -0
- package/lib/components/Buttons/AIAssistantButton.js +6 -2
- package/lib/components/Buttons/ConnectMCPButton.d.ts +8 -0
- package/lib/components/Buttons/ConnectMCPButton.js +145 -0
- package/lib/components/Buttons/variables.d.ts +1 -0
- package/lib/components/Buttons/variables.js +44 -2
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +4 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +5 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.js +2 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.js +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.js +4 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +2 -2
- package/lib/components/Catalog/CatalogEntityIcon.js +2 -1
- package/lib/components/Catalog/CatalogFilter/CatalogFilter.js +4 -0
- package/lib/components/Catalog/CatalogFilter/CatalogFilterDateRange.js +2 -2
- package/lib/components/Catalog/CatalogSelector.js +1 -1
- package/lib/components/Catalog/CatalogSortButton.js +4 -1
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +2 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +2 -2
- package/lib/components/Catalog/CatalogTagsWithTooltip.js +5 -1
- package/lib/components/Catalog/variables.dark.js +1 -1
- package/lib/components/Catalog/variables.js +6 -4
- package/lib/components/CatalogClassic/variables.js +1 -1
- package/lib/components/CodeBlock/CodeBlock.js +3 -1
- package/lib/components/CodeBlock/CodeBlockTabs.js +3 -3
- package/lib/components/DatePicker/variables.js +2 -0
- package/lib/components/Dropdown/Dropdown.d.ts +16 -2
- package/lib/components/Dropdown/Dropdown.js +5 -5
- package/lib/components/Feedback/Mood.js +2 -2
- package/lib/components/Feedback/Rating.js +2 -2
- package/lib/components/Filter/FilterDateRange.js +2 -2
- package/lib/components/Filter/FilterSelect.js +5 -1
- package/lib/components/Link/Link.d.ts +1 -0
- package/lib/components/Loaders/Loading.js +4 -1
- package/lib/components/Markdown/Markdown.js +9 -9
- package/lib/components/Markdown/styles/{baseTable.js → base-table.js} +1 -1
- package/lib/components/Markdown/styles/{headingAnchor.js → heading-anchor.js} +1 -1
- package/lib/components/Menu/MenuItem.js +6 -2
- package/lib/components/Navbar/NavbarItem.js +3 -3
- package/lib/components/OpenApiDocs/hooks/AdditionalOverviewInfo.js +1 -0
- package/lib/components/OpenApiDocs/hooks/AfterOpenApiDescription.js +1 -0
- package/lib/components/OpenApiDocs/hooks/AfterOpenApiOperation.js +1 -0
- package/lib/components/OpenApiDocs/hooks/AfterOpenApiTitle.js +1 -0
- package/lib/components/OpenApiDocs/hooks/BeforeOpenApiOperation.js +1 -0
- package/lib/components/OpenApiDocs/hooks/OpenApiFooter.js +3 -2
- package/lib/components/OpenApiDocs/hooks/OpenApiHeader.js +3 -2
- package/lib/components/PageActions/PageActions.js +4 -1
- package/lib/components/PageActions/variables.js +2 -0
- package/lib/components/Search/FilterFields/SearchFilterFieldSelect.js +2 -1
- package/lib/components/Search/FilterFields/SearchFilterFieldTags.js +8 -3
- package/lib/components/Search/SearchAiActionButtons.d.ts +10 -0
- package/lib/components/Search/SearchAiActionButtons.js +43 -0
- package/lib/components/Search/SearchAiConversationInput.d.ts +3 -1
- package/lib/components/Search/SearchAiConversationInput.js +39 -7
- package/lib/components/Search/SearchAiDialog.d.ts +3 -6
- package/lib/components/Search/SearchAiDialog.js +20 -9
- package/lib/components/Search/SearchAiMessage.d.ts +9 -5
- package/lib/components/Search/SearchAiMessage.js +147 -21
- package/lib/components/Search/SearchAiNegativeFeedbackForm.d.ts +10 -0
- package/lib/components/Search/SearchAiNegativeFeedbackForm.js +170 -0
- package/lib/components/Search/SearchDialog.js +36 -5
- package/lib/components/Search/SearchGroups.js +5 -2
- package/lib/components/Search/SearchHighlight.js +1 -0
- package/lib/components/Search/SearchItem.js +9 -2
- package/lib/components/Search/variables.js +38 -64
- package/lib/components/Segmented/Segmented.d.ts +1 -8
- package/lib/components/Segmented/Segmented.js +5 -3
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/Select/Select.js +4 -2
- package/lib/components/Select/SelectInput.d.ts +1 -1
- package/lib/components/Select/SelectInput.js +3 -1
- package/lib/components/SidebarActions/styled.d.ts +5 -4
- package/lib/components/SidebarActions/styled.js +9 -5
- package/lib/components/Tag/Tag.d.ts +3 -2
- package/lib/components/Tag/Tag.js +65 -16
- package/lib/components/Tag/variables.dark.js +143 -36
- package/lib/components/Tag/variables.js +85 -60
- package/lib/components/Tooltip/Tooltip.js +2 -0
- package/lib/components/VersionPicker/VersionPicker.d.ts +1 -1
- package/lib/config.d.ts +2 -2
- package/lib/core/constants/index.d.ts +2 -0
- package/lib/core/constants/index.js +2 -0
- package/lib/core/constants/mcp.d.ts +1 -0
- package/lib/core/constants/mcp.js +5 -0
- package/lib/core/constants/request-methods.d.ts +1 -0
- package/lib/core/constants/request-methods.js +14 -0
- package/lib/core/constants/search.d.ts +5 -4
- package/lib/core/constants/search.js +4 -5
- package/lib/core/hoc/index.d.ts +1 -1
- package/lib/core/hoc/index.js +1 -1
- package/lib/core/hoc/{typedMemo.js → typed-memo.js} +1 -1
- package/lib/core/hooks/__tests__/mocks/mock-intersection-observer.d.ts +1 -1
- package/lib/core/hooks/__tests__/mocks/mock-intersection-observer.js +1 -3
- package/lib/core/hooks/catalog/{useCatalogEntities.js → use-catalog-entities.js} +1 -1
- package/lib/core/hooks/catalog/{useCatalogEntitySchema.d.ts → use-catalog-entity-schema.d.ts} +1 -1
- package/lib/core/hooks/catalog/{useCatalogEntitySchema.js → use-catalog-entity-schema.js} +1 -1
- package/lib/core/hooks/catalog/{useCatalogTableHeaderCellActions.js → use-catalog-table-header-cell-actions.js} +1 -1
- package/lib/core/hooks/catalog/{useCatalogTableViewRow.js → use-catalog-table-view-row.js} +1 -1
- package/lib/core/hooks/catalog/{useGraph.js → use-graph.js} +2 -2
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +1 -0
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.d.ts +1 -0
- package/lib/core/hooks/code-walkthrough/use-renderable-files.js +2 -2
- package/lib/core/hooks/index.d.ts +8 -2
- package/lib/core/hooks/index.js +8 -2
- package/lib/core/hooks/menu/use-collapse.js +1 -0
- package/lib/core/hooks/menu/use-mobile-menu-items.js +1 -0
- package/lib/core/hooks/menu/use-nested-menu.js +1 -1
- package/lib/core/hooks/search/use-feedback-tooltip.d.ts +6 -0
- package/lib/core/hooks/search/use-feedback-tooltip.js +26 -0
- package/lib/core/hooks/use-connect-mcp-button.d.ts +13 -0
- package/lib/core/hooks/use-connect-mcp-button.js +50 -0
- package/lib/core/hooks/use-mcp-config.d.ts +9 -0
- package/lib/core/hooks/use-mcp-config.js +30 -0
- package/lib/core/hooks/use-page-actions.d.ts +1 -1
- package/lib/core/hooks/use-page-actions.js +120 -120
- package/lib/core/hooks/use-product-picker.js +2 -1
- package/lib/core/hooks/use-tabs.d.ts +3 -2
- package/lib/core/hooks/use-tabs.js +115 -57
- package/lib/core/hooks/use-telemetry-fallback.d.ts +10 -8
- package/lib/core/hooks/use-telemetry-fallback.js +11 -8
- package/lib/core/hooks/use-theme-config.js +1 -0
- package/lib/core/hooks/use-theme-hooks.js +1 -0
- package/lib/core/openapi/index.d.ts +3 -1
- package/lib/core/openapi/index.js +5 -3
- package/lib/core/styles/dark.js +4 -0
- package/lib/core/styles/global.js +5 -0
- package/lib/core/templates/Markdown.js +1 -0
- package/lib/core/types/hooks.d.ts +8 -2
- package/lib/core/types/index.d.ts +20 -18
- package/lib/core/types/index.js +0 -18
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/mcp.d.ts +6 -0
- package/lib/core/types/mcp.js +3 -0
- package/lib/core/types/search.d.ts +12 -4
- package/lib/core/types/search.js +6 -0
- package/lib/core/types/segmented.d.ts +12 -0
- package/lib/core/types/segmented.js +3 -0
- package/lib/core/types/sidebar.d.ts +1 -0
- package/lib/core/utils/{dynamic.js → Dynamic.js} +1 -1
- package/lib/core/utils/{get-file-icon.js → GetFileIcon.js} +1 -1
- package/lib/core/utils/args-typecheck.d.ts +2 -2
- package/lib/core/utils/clipboard-service.js +2 -0
- package/lib/core/utils/frontmatter-translate.d.ts +6 -0
- package/lib/core/utils/frontmatter-translate.js +14 -0
- package/lib/core/utils/get-operation-color.d.ts +7 -0
- package/lib/core/utils/get-operation-color.js +13 -0
- package/lib/core/utils/get-user-agent.js +1 -0
- package/lib/core/utils/index.d.ts +5 -2
- package/lib/core/utils/index.js +5 -2
- package/lib/core/utils/js-utils.d.ts +1 -1
- package/lib/core/utils/load-and-navigate.js +1 -0
- package/lib/core/utils/markdoc.js +1 -0
- package/lib/core/utils/mcp.d.ts +2 -0
- package/lib/core/utils/mcp.js +31 -0
- package/lib/core/utils/parse-style-string.js +1 -0
- package/lib/ext/configure.d.ts +2 -2
- package/lib/ext/configure.js +12 -6
- package/lib/ext/{useConfigureReplay.js → use-configure-replay.js} +5 -4
- package/lib/icons/AiStarsGradientIcon/AiStarsGradientIcon.js +44 -4
- package/lib/icons/AiStarsIcon/AiStarsIcon.js +11 -2
- package/lib/icons/ConnectIcon/ConnectIcon.d.ts +9 -0
- package/lib/icons/ConnectIcon/ConnectIcon.js +17 -0
- package/lib/icons/CubeIcon/CubeIcon.d.ts +9 -0
- package/lib/icons/CubeIcon/CubeIcon.js +17 -0
- package/lib/icons/HashtagIcon/HashtagIcon.d.ts +9 -0
- package/lib/icons/HashtagIcon/HashtagIcon.js +22 -0
- package/lib/icons/RedoclyIcon/RedoclyIcon.js +4 -7
- package/lib/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.d.ts +9 -0
- package/lib/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.js +34 -0
- package/lib/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.d.ts +9 -0
- package/lib/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.js +34 -0
- package/lib/icons/VSCodeIcon/VSCodeIcon.d.ts +9 -0
- package/lib/icons/VSCodeIcon/VSCodeIcon.js +17 -0
- package/lib/index.d.ts +4 -3
- package/lib/index.js +3 -3
- package/lib/layouts/ThreePanelLayout.js +4 -4
- package/lib/markdoc/components/Cards/Card.js +1 -28
- package/lib/markdoc/components/Cards/variables.dark.js +2 -0
- package/lib/markdoc/components/Cards/variables.js +2 -0
- package/lib/markdoc/components/CodeWalkthrough/CodePanelHeader.js +1 -0
- package/lib/markdoc/components/ConnectMCP/ConnectMCP.d.ts +8 -0
- package/lib/markdoc/components/ConnectMCP/ConnectMCP.js +19 -0
- package/lib/markdoc/components/Tabs/TabList.d.ts +3 -1
- package/lib/markdoc/components/Tabs/TabList.js +197 -47
- package/lib/markdoc/components/Tabs/Tabs.d.ts +2 -1
- package/lib/markdoc/components/Tabs/Tabs.js +57 -12
- package/lib/markdoc/components/default.d.ts +1 -0
- package/lib/markdoc/components/default.js +1 -0
- package/lib/markdoc/default.d.ts +6 -0
- package/lib/markdoc/default.js +2 -0
- package/lib/markdoc/tags/card.js +0 -1
- package/lib/markdoc/tags/code-walkthrough.js +1 -0
- package/lib/markdoc/tags/connect-mcp.d.ts +2 -0
- package/lib/markdoc/tags/connect-mcp.js +27 -0
- package/lib/markdoc/tags/html.js +1 -0
- package/package.json +6 -6
- package/src/components/AsyncApiDocs/hooks/AfterAsyncApiChannelDescription.tsx +1 -0
- package/src/components/Button/Button.tsx +1 -0
- package/src/components/Buttons/AIAssistantButton.tsx +6 -2
- package/src/components/Buttons/ConnectMCPButton.tsx +180 -0
- package/src/components/Buttons/variables.ts +44 -1
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +4 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +4 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityGraph/CatalogEntityRelationsGraph.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.tsx +5 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityApiDescriptionRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +3 -1
- package/src/components/Catalog/CatalogEntityIcon.tsx +2 -1
- package/src/components/Catalog/CatalogFilter/CatalogFilter.tsx +5 -0
- package/src/components/Catalog/CatalogFilter/CatalogFilterDateRange.tsx +2 -2
- package/src/components/Catalog/CatalogSelector.tsx +2 -2
- package/src/components/Catalog/CatalogSortButton.tsx +5 -1
- package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +1 -1
- package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +1 -1
- package/src/components/Catalog/CatalogTagsWithTooltip.tsx +8 -1
- package/src/components/Catalog/variables.dark.ts +1 -1
- package/src/components/Catalog/variables.ts +6 -4
- package/src/components/CatalogClassic/CatalogClassicInfoBlock.tsx +1 -0
- package/src/components/CatalogClassic/variables.ts +1 -1
- package/src/components/CodeBlock/CodeBlock.tsx +4 -0
- package/src/components/CodeBlock/CodeBlockControls.tsx +1 -0
- package/src/components/CodeBlock/CodeBlockTabs.tsx +1 -1
- package/src/components/DatePicker/variables.ts +3 -1
- package/src/components/Dropdown/Dropdown.tsx +84 -79
- package/src/components/Feedback/Mood.tsx +2 -2
- package/src/components/Feedback/Rating.tsx +2 -2
- package/src/components/Filter/FilterDateRange.tsx +2 -2
- package/src/components/Filter/FilterSelect.tsx +1 -0
- package/src/components/JsonViewer/JsonViewer.tsx +1 -0
- package/src/components/JsonViewer/helpers.tsx +3 -0
- package/src/components/LastUpdated/LastUpdated.tsx +1 -0
- package/src/components/Link/Link.tsx +1 -0
- package/src/components/Loaders/Loading.tsx +5 -1
- package/src/components/Markdown/Markdown.tsx +2 -2
- package/src/components/Menu/MenuItem.tsx +7 -2
- package/src/components/Navbar/NavbarItem.tsx +6 -5
- package/src/components/OpenApiDocs/hooks/AdditionalOverviewInfo.tsx +1 -0
- package/src/components/OpenApiDocs/hooks/AfterOpenApiDescription.tsx +1 -0
- package/src/components/OpenApiDocs/hooks/AfterOpenApiOperation.tsx +1 -1
- package/src/components/OpenApiDocs/hooks/AfterOpenApiTitle.tsx +1 -1
- package/src/components/OpenApiDocs/hooks/BeforeOpenApiOperation.tsx +1 -1
- package/src/components/OpenApiDocs/hooks/OpenApiFooter.tsx +1 -1
- package/src/components/OpenApiDocs/hooks/OpenApiHeader.tsx +1 -1
- package/src/components/PageActions/PageActions.tsx +5 -1
- package/src/components/PageActions/variables.ts +2 -0
- package/src/components/Search/FilterFields/SearchFilterFieldSelect.tsx +4 -1
- package/src/components/Search/FilterFields/SearchFilterFieldTags.tsx +10 -4
- package/src/components/Search/SearchAiActionButtons.tsx +76 -0
- package/src/components/Search/SearchAiConversationInput.tsx +61 -18
- package/src/components/Search/SearchAiDialog.tsx +52 -23
- package/src/components/Search/SearchAiMessage.tsx +173 -39
- package/src/components/Search/SearchAiNegativeFeedbackForm.tsx +212 -0
- package/src/components/Search/SearchDialog.tsx +49 -13
- package/src/components/Search/SearchGroups.tsx +6 -1
- package/src/components/Search/SearchHighlight.tsx +1 -0
- package/src/components/Search/SearchItem.tsx +15 -3
- package/src/components/Search/variables.ts +38 -64
- package/src/components/Segmented/Segmented.tsx +16 -21
- package/src/components/Select/Select.tsx +8 -4
- package/src/components/Select/SelectInput.tsx +11 -1
- package/src/components/SidebarActions/{styled.tsx → styled.ts} +11 -4
- package/src/components/Tag/Tag.tsx +36 -18
- package/src/components/Tag/variables.dark.ts +143 -36
- package/src/components/Tag/variables.ts +85 -60
- package/src/components/Tooltip/Tooltip.tsx +2 -1
- package/src/components/VersionPicker/VersionPicker.tsx +2 -1
- package/src/config.ts +2 -0
- package/src/core/constants/index.ts +2 -0
- package/src/core/constants/mcp.ts +1 -0
- package/src/core/constants/request-methods.ts +10 -0
- package/src/core/constants/search.ts +8 -4
- package/src/core/hoc/index.ts +1 -1
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +2 -2
- package/src/core/hooks/__tests__/mocks/mock-intersection-observer.ts +9 -8
- package/src/core/hooks/catalog/{useCatalogEntitySchema.ts → use-catalog-entity-schema.ts} +3 -3
- package/src/core/hooks/catalog/{useGraph.ts → use-graph.ts} +1 -1
- package/src/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.ts +1 -1
- package/src/core/hooks/code-walkthrough/__mocks__/mock-intersection-observer.ts +24 -0
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +1 -0
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +2 -2
- package/src/core/hooks/code-walkthrough/use-renderable-files.ts +1 -1
- package/src/core/hooks/index.ts +8 -2
- package/src/core/hooks/menu/use-collapse.ts +3 -3
- package/src/core/hooks/menu/use-mobile-menu-items.ts +1 -0
- package/src/core/hooks/menu/use-nested-menu.ts +2 -2
- package/src/core/hooks/search/use-feedback-tooltip.ts +32 -0
- package/src/core/hooks/use-connect-mcp-button.ts +79 -0
- package/src/core/hooks/use-mcp-config.ts +49 -0
- package/src/core/hooks/use-page-actions.ts +164 -146
- package/src/core/hooks/use-product-picker.ts +2 -1
- package/src/core/hooks/use-tabs.ts +168 -86
- package/src/core/hooks/use-telemetry-fallback.ts +11 -8
- package/src/core/hooks/use-theme-config.ts +1 -0
- package/src/core/hooks/use-theme-hooks.ts +2 -1
- package/src/core/openapi/index.ts +3 -1
- package/src/core/styles/dark.ts +4 -0
- package/src/core/styles/global.ts +6 -1
- package/src/core/templates/Markdown.tsx +1 -0
- package/src/core/types/catalog.ts +3 -1
- package/src/core/types/filter.ts +1 -0
- package/src/core/types/hooks.ts +11 -1
- package/src/core/types/index.ts +20 -18
- package/src/core/types/l10n.ts +37 -1
- package/src/core/types/mcp.ts +8 -0
- package/src/core/types/search.ts +15 -5
- package/src/core/types/segmented.ts +15 -0
- package/src/core/types/select.ts +1 -0
- package/src/core/types/sidebar.ts +1 -0
- package/src/core/utils/args-typecheck.ts +2 -2
- package/src/core/utils/clipboard-service.ts +2 -0
- package/src/core/utils/frontmatter-translate.ts +9 -0
- package/src/core/utils/get-operation-color.ts +18 -0
- package/src/core/utils/get-user-agent.ts +1 -0
- package/src/core/utils/index.ts +5 -2
- package/src/core/utils/js-utils.ts +1 -1
- package/src/core/utils/load-and-navigate.ts +1 -0
- package/src/core/utils/markdoc.ts +1 -0
- package/src/core/utils/mcp.ts +34 -0
- package/src/core/utils/parse-style-string.ts +1 -0
- package/src/ext/configure.ts +15 -8
- package/src/ext/process-scorecard.ts +1 -0
- package/src/ext/{useConfigureReplay.ts → use-configure-replay.ts} +5 -3
- package/src/icons/AiStarsGradientIcon/AiStarsGradientIcon.tsx +13 -4
- package/src/icons/AiStarsIcon/AiStarsIcon.tsx +11 -2
- package/src/icons/ConnectIcon/ConnectIcon.tsx +27 -0
- package/src/icons/CubeIcon/CubeIcon.tsx +27 -0
- package/src/icons/HashtagIcon/HashtagIcon.tsx +23 -0
- package/src/icons/RedoclyIcon/RedoclyIcon.tsx +4 -22
- package/src/icons/ThumbDownFilledIcon/ThumbDownFilledIcon.tsx +38 -0
- package/src/icons/ThumbUpFilledIcon/ThumbUpFilledIcon.tsx +35 -0
- package/src/icons/VSCodeIcon/VSCodeIcon.tsx +29 -0
- package/src/index.ts +4 -3
- package/src/layouts/ThreePanelLayout.tsx +1 -1
- package/src/markdoc/components/Cards/Card.tsx +1 -28
- package/src/markdoc/components/Cards/variables.dark.ts +2 -0
- package/src/markdoc/components/Cards/variables.ts +3 -1
- package/src/markdoc/components/CodeWalkthrough/CodePanelHeader.tsx +1 -1
- package/src/markdoc/components/ConnectMCP/ConnectMCP.tsx +28 -0
- package/src/markdoc/components/Tabs/TabList.tsx +312 -105
- package/src/markdoc/components/Tabs/Tabs.tsx +136 -11
- package/src/markdoc/components/default.ts +1 -0
- package/src/markdoc/default.ts +2 -0
- package/src/markdoc/tags/card.ts +0 -1
- package/src/markdoc/tags/code-walkthrough.ts +2 -0
- package/src/markdoc/tags/connect-mcp.ts +25 -0
- package/src/markdoc/tags/html.ts +1 -0
- package/lib/core/hooks/__mocks__/index.d.ts +0 -28
- package/lib/core/hooks/__mocks__/index.js +0 -45
- package/lib/core/hooks/__mocks__/search/use-recent-searches.d.ts +0 -5
- package/lib/core/hooks/__mocks__/search/use-recent-searches.js +0 -13
- package/lib/core/hooks/__mocks__/search/use-search-filter.d.ts +0 -8
- package/lib/core/hooks/__mocks__/search/use-search-filter.js +0 -15
- package/lib/core/hooks/__mocks__/search/use-suggested-pages.d.ts +0 -4
- package/lib/core/hooks/__mocks__/search/use-suggested-pages.js +0 -13
- package/lib/core/hooks/__mocks__/use-controlled-state.d.ts +0 -1
- package/lib/core/hooks/__mocks__/use-controlled-state.js +0 -7
- package/lib/core/hooks/__mocks__/use-element-size.d.ts +0 -4
- package/lib/core/hooks/__mocks__/use-element-size.js +0 -9
- package/lib/core/hooks/__mocks__/use-input-key-commands.d.ts +0 -3
- package/lib/core/hooks/__mocks__/use-input-key-commands.js +0 -8
- package/lib/core/hooks/__mocks__/use-mobile-menu.d.ts +0 -1
- package/lib/core/hooks/__mocks__/use-mobile-menu.js +0 -7
- package/lib/core/hooks/__mocks__/use-theme-config.d.ts +0 -8
- package/lib/core/hooks/__mocks__/use-theme-config.js +0 -13
- package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +0 -69
- package/lib/core/hooks/__mocks__/use-theme-hooks.js +0 -94
- package/lib/core/hooks/__mocks__/use-time-ago.d.ts +0 -3
- package/lib/core/hooks/__mocks__/use-time-ago.js +0 -8
- package/lib/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.d.ts +0 -10
- package/lib/core/hooks/code-walkthrough/__mocks__/MockIntersectionObserver.js +0 -56
- package/lib/core/hooks/menu/__mocks__/use-mobile-menu-items.d.ts +0 -1
- package/lib/core/hooks/menu/__mocks__/use-mobile-menu-items.js +0 -35
- /package/lib/components/Markdown/styles/{baseTable.d.ts → base-table.d.ts} +0 -0
- /package/lib/components/Markdown/styles/{headingAnchor.d.ts → heading-anchor.d.ts} +0 -0
- /package/lib/core/hoc/{typedMemo.d.ts → typed-memo.d.ts} +0 -0
- /package/lib/core/hooks/catalog/{useCatalogEntities.d.ts → use-catalog-entities.d.ts} +0 -0
- /package/lib/core/hooks/catalog/{useCatalogTableHeaderCellActions.d.ts → use-catalog-table-header-cell-actions.d.ts} +0 -0
- /package/lib/core/hooks/catalog/{useCatalogTableViewRow.d.ts → use-catalog-table-view-row.d.ts} +0 -0
- /package/lib/core/hooks/catalog/{useGraph.d.ts → use-graph.d.ts} +0 -0
- /package/lib/core/utils/{dynamic.d.ts → Dynamic.d.ts} +0 -0
- /package/lib/core/utils/{get-file-icon.d.ts → GetFileIcon.d.ts} +0 -0
- /package/lib/ext/{useConfigureReplay.d.ts → use-configure-replay.d.ts} +0 -0
- /package/src/components/Markdown/styles/{baseTable.ts → base-table.ts} +0 -0
- /package/src/components/Markdown/styles/{headingAnchor.ts → heading-anchor.ts} +0 -0
- /package/src/components/Panel/{PanelBody.ts → PanelBody.tsx} +0 -0
- /package/src/components/Panel/{PanelHeader.ts → PanelHeader.tsx} +0 -0
- /package/src/components/Panel/{PanelHeaderTitle.ts → PanelHeaderTitle.tsx} +0 -0
- /package/src/components/StatusCode/{StatusCode.ts → StatusCode.tsx} +0 -0
- /package/src/components/Typography/{CompactTypography.ts → CompactTypography.tsx} +0 -0
- /package/src/components/Typography/{Emphasis.ts → Emphasis.tsx} +0 -0
- /package/src/components/Typography/{H1.ts → H1.tsx} +0 -0
- /package/src/components/Typography/{H2.ts → H2.tsx} +0 -0
- /package/src/components/Typography/{H3.ts → H3.tsx} +0 -0
- /package/src/components/Typography/{H4.ts → H4.tsx} +0 -0
- /package/src/components/Typography/{SectionHeader.ts → SectionHeader.tsx} +0 -0
- /package/src/components/Typography/{Typography.ts → Typography.tsx} +0 -0
- /package/src/core/hoc/{typedMemo.ts → typed-memo.ts} +0 -0
- /package/src/core/hooks/catalog/{useCatalogEntities.ts → use-catalog-entities.ts} +0 -0
- /package/src/core/hooks/catalog/{useCatalogTableHeaderCellActions.ts → use-catalog-table-header-cell-actions.ts} +0 -0
- /package/src/core/hooks/catalog/{useCatalogTableViewRow.ts → use-catalog-table-view-row.ts} +0 -0
- /package/src/core/utils/{dynamic.tsx → Dynamic.tsx} +0 -0
- /package/src/core/utils/{get-file-icon.tsx → GetFileIcon.tsx} +0 -0
|
@@ -13,39 +13,75 @@ type Tabs = {
|
|
|
13
13
|
overflow: number[];
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
type UseTabsReturn = {
|
|
17
|
+
setTabRef: (element: HTMLButtonElement | null, index: number) => void;
|
|
18
|
+
onTabClick: (labelOrIndex: string | number) => void;
|
|
19
|
+
handleKeyboard: (event: React.KeyboardEvent, index: number) => void;
|
|
20
|
+
visibleTabs: number[];
|
|
21
|
+
overflowTabs: number[];
|
|
22
|
+
isReady: boolean;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
type UseActiveTabProps = {
|
|
26
|
+
initialTab: string;
|
|
27
|
+
tabsId?: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
16
30
|
const MORE_BUTTON_WIDTH = 80;
|
|
17
31
|
const TABS_GAP = 8;
|
|
18
32
|
|
|
19
|
-
export function useTabs({
|
|
33
|
+
export function useTabs({
|
|
34
|
+
activeTab,
|
|
35
|
+
onTabChange,
|
|
36
|
+
totalTabs,
|
|
37
|
+
containerRef,
|
|
38
|
+
}: UseTabsProps): UseTabsReturn {
|
|
20
39
|
const [tabs, setTabs] = useState<Tabs>({
|
|
21
40
|
visible: Array.from({ length: totalTabs }, (_, i) => i),
|
|
22
41
|
overflow: [],
|
|
23
42
|
});
|
|
24
|
-
|
|
43
|
+
const [isReady, setIsReady] = useState(false);
|
|
44
|
+
const isFirstCalculation = useRef(true);
|
|
25
45
|
const tabRefs = useRef<(HTMLButtonElement | null)[]>([]);
|
|
26
46
|
const tabWidthsRef = useRef<number[]>([]);
|
|
27
47
|
const tabLabelsRef = useRef<string[]>([]);
|
|
48
|
+
const activeTabRef = useRef(activeTab);
|
|
49
|
+
const calculateVisibleTabsRef = useRef<(() => void) | null>(null);
|
|
28
50
|
|
|
29
|
-
|
|
51
|
+
// Synchronously update ref before any callbacks or effects run
|
|
52
|
+
activeTabRef.current = activeTab;
|
|
30
53
|
|
|
31
|
-
const setTabRef = useCallback(
|
|
32
|
-
|
|
54
|
+
const setTabRef = useCallback(
|
|
55
|
+
(element: HTMLButtonElement | null, index: number) => {
|
|
56
|
+
tabRefs.current[index] = element;
|
|
33
57
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
58
|
+
const width = element?.offsetWidth;
|
|
59
|
+
if (width) {
|
|
60
|
+
tabWidthsRef.current[index] = width;
|
|
61
|
+
}
|
|
38
62
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}, []);
|
|
63
|
+
const label = element?.getAttribute('data-label');
|
|
64
|
+
if (label) {
|
|
65
|
+
tabLabelsRef.current[index] = label;
|
|
66
|
+
}
|
|
44
67
|
|
|
45
|
-
|
|
68
|
+
// Trigger calculation once all tabs are registered
|
|
69
|
+
if (
|
|
70
|
+
isFirstCalculation.current &&
|
|
71
|
+
tabWidthsRef.current.length >= totalTabs &&
|
|
72
|
+
tabLabelsRef.current.length >= totalTabs &&
|
|
73
|
+
calculateVisibleTabsRef.current
|
|
74
|
+
) {
|
|
75
|
+
requestAnimationFrame(calculateVisibleTabsRef.current);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
[totalTabs],
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const focusTab = useCallback((index: number) => {
|
|
46
82
|
const currentElement = tabRefs.current[index];
|
|
47
83
|
currentElement?.focus();
|
|
48
|
-
};
|
|
84
|
+
}, []);
|
|
49
85
|
|
|
50
86
|
const onTabSelect = useCallback(
|
|
51
87
|
(index: number) => {
|
|
@@ -53,7 +89,7 @@ export function useTabs({ activeTab, onTabChange, totalTabs, containerRef }: Use
|
|
|
53
89
|
const label = tabRefs.current[index]?.getAttribute('data-label');
|
|
54
90
|
if (label) onTabChange(label);
|
|
55
91
|
},
|
|
56
|
-
[onTabChange],
|
|
92
|
+
[onTabChange, focusTab],
|
|
57
93
|
);
|
|
58
94
|
|
|
59
95
|
const handleKeyboard = useCallback(
|
|
@@ -77,30 +113,19 @@ export function useTabs({ activeTab, onTabChange, totalTabs, containerRef }: Use
|
|
|
77
113
|
[totalTabs, onTabSelect],
|
|
78
114
|
);
|
|
79
115
|
|
|
80
|
-
const replaceLastVisibleTabWithClickedOverflowTab = useCallback(
|
|
81
|
-
(
|
|
82
|
-
const { visible: visibleTabs, overflow: overflowTabs } =
|
|
83
|
-
|
|
84
|
-
// Indexes of visible tabs should be sorted(asc), to replace the last visible tab with the clicked tab
|
|
85
|
-
const newVisibleTabs = [...visibleTabs].sort((a, b) => a - b);
|
|
86
|
-
const newOverflowTabs = [...overflowTabs];
|
|
87
|
-
|
|
88
|
-
const clickedIdxInOverflow = newOverflowTabs.indexOf(clickedIndex);
|
|
89
|
-
if (clickedIdxInOverflow !== -1) {
|
|
90
|
-
const lastVisible = newVisibleTabs[newVisibleTabs.length - 1];
|
|
91
|
-
newOverflowTabs.splice(clickedIdxInOverflow, 1);
|
|
92
|
-
newOverflowTabs.unshift(lastVisible);
|
|
93
|
-
newVisibleTabs.splice(newVisibleTabs.length - 1, 1);
|
|
94
|
-
newVisibleTabs.unshift(clickedIndex);
|
|
95
|
-
}
|
|
116
|
+
const replaceLastVisibleTabWithClickedOverflowTab = useCallback((clickedIndex: number) => {
|
|
117
|
+
setTabs((prevTabs) => {
|
|
118
|
+
const { visible: visibleTabs, overflow: overflowTabs } = prevTabs;
|
|
96
119
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
120
|
+
const sortedVisible = [...visibleTabs].sort((a, b) => a - b);
|
|
121
|
+
const lastVisible = sortedVisible[sortedVisible.length - 1];
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
visible: visibleTabs.map((idx) => (idx === lastVisible ? clickedIndex : idx)),
|
|
125
|
+
overflow: overflowTabs.map((idx) => (idx === clickedIndex ? lastVisible : idx)),
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
}, []);
|
|
104
129
|
|
|
105
130
|
const onTabClick = useCallback(
|
|
106
131
|
(labelOrIndex: string | number) => {
|
|
@@ -111,18 +136,18 @@ export function useTabs({ activeTab, onTabChange, totalTabs, containerRef }: Use
|
|
|
111
136
|
|
|
112
137
|
if (clickedIndex === -1) return;
|
|
113
138
|
|
|
114
|
-
const
|
|
115
|
-
if (
|
|
139
|
+
const label = tabLabelsRef.current[clickedIndex];
|
|
140
|
+
if (!label) return;
|
|
141
|
+
|
|
142
|
+
// If this is an overflow tab, replace it with a visible one
|
|
143
|
+
if (tabs.overflow.includes(clickedIndex)) {
|
|
116
144
|
replaceLastVisibleTabWithClickedOverflowTab(clickedIndex);
|
|
117
145
|
}
|
|
118
146
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
onTabChange(label);
|
|
122
|
-
focusTab(clickedIndex);
|
|
123
|
-
}
|
|
147
|
+
onTabChange(label);
|
|
148
|
+
focusTab(clickedIndex);
|
|
124
149
|
},
|
|
125
|
-
[
|
|
150
|
+
[tabs.overflow, onTabChange, replaceLastVisibleTabWithClickedOverflowTab, focusTab],
|
|
126
151
|
);
|
|
127
152
|
|
|
128
153
|
const calculateVisibleTabs = useCallback(() => {
|
|
@@ -131,87 +156,141 @@ export function useTabs({ activeTab, onTabChange, totalTabs, containerRef }: Use
|
|
|
131
156
|
|
|
132
157
|
const containerWidth = container.offsetWidth;
|
|
133
158
|
const tabWidths = tabWidthsRef.current;
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
159
|
+
const tabLabels = tabLabelsRef.current;
|
|
160
|
+
|
|
161
|
+
// Wait until all tabs are registered before calculating
|
|
162
|
+
if (tabWidths.length < totalTabs || tabLabels.length < totalTabs) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Check if container has proper width (not zero)
|
|
167
|
+
if (containerWidth === 0) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Find active tab index by label in tabLabelsRef, not by DOM element
|
|
172
|
+
// because tab might not be rendered if it's in overflow
|
|
173
|
+
const activeTabIndex = tabLabels.findIndex((label) => label === activeTabRef.current);
|
|
137
174
|
|
|
138
|
-
// Active tab should always be visible, so we include it at the beginning of the array
|
|
139
175
|
let tabsWidth = activeTabIndex !== -1 ? tabWidths[activeTabIndex] : 0;
|
|
140
|
-
const
|
|
141
|
-
const
|
|
176
|
+
const visibleTabs = activeTabIndex !== -1 ? [activeTabIndex] : [];
|
|
177
|
+
const overflowTabs = [];
|
|
142
178
|
|
|
143
179
|
for (let i = 0; i < tabWidths.length; i++) {
|
|
144
|
-
|
|
145
|
-
if (i === activeTabIndex) {
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
180
|
+
if (i === activeTabIndex) continue;
|
|
148
181
|
|
|
149
182
|
const tabWidthWithGap = tabWidths[i] + TABS_GAP;
|
|
150
183
|
const projectedWidth = tabsWidth + tabWidthWithGap;
|
|
151
184
|
|
|
152
185
|
if (projectedWidth <= containerWidth) {
|
|
153
|
-
|
|
186
|
+
visibleTabs.push(i);
|
|
154
187
|
tabsWidth += tabWidthWithGap;
|
|
155
188
|
} else {
|
|
156
|
-
|
|
189
|
+
overflowTabs.push(i);
|
|
157
190
|
}
|
|
158
191
|
}
|
|
159
192
|
|
|
160
|
-
if (
|
|
193
|
+
if (overflowTabs.length > 0) {
|
|
161
194
|
tabsWidth += MORE_BUTTON_WIDTH;
|
|
162
195
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
if (removed !== undefined) {
|
|
167
|
-
|
|
196
|
+
while (tabsWidth > containerWidth && visibleTabs.length > 1) {
|
|
197
|
+
const removed = visibleTabs.pop();
|
|
198
|
+
// Never remove the active tab - it should always stay visible or be the last one
|
|
199
|
+
if (removed !== undefined && removed !== activeTabIndex) {
|
|
200
|
+
overflowTabs.unshift(removed);
|
|
168
201
|
tabsWidth -= tabWidths[removed];
|
|
202
|
+
} else if (removed === activeTabIndex) {
|
|
203
|
+
// Put it back if we accidentally removed the active tab
|
|
204
|
+
visibleTabs.push(removed);
|
|
205
|
+
break;
|
|
169
206
|
}
|
|
170
207
|
}
|
|
208
|
+
|
|
209
|
+
// If even with only the active tab visible, it doesn't fit with More button,
|
|
210
|
+
// move all tabs to overflow (show only dropdown)
|
|
211
|
+
if (tabsWidth > containerWidth && visibleTabs.length === 1) {
|
|
212
|
+
overflowTabs.unshift(...visibleTabs);
|
|
213
|
+
visibleTabs.length = 0;
|
|
214
|
+
}
|
|
171
215
|
}
|
|
172
216
|
|
|
173
217
|
setTabs({
|
|
174
|
-
visible,
|
|
175
|
-
overflow,
|
|
218
|
+
visible: visibleTabs,
|
|
219
|
+
overflow: overflowTabs,
|
|
176
220
|
});
|
|
177
|
-
}, [containerRef, activeTab]);
|
|
178
221
|
|
|
222
|
+
// Set ready state on first calculation
|
|
223
|
+
if (isFirstCalculation.current) {
|
|
224
|
+
isFirstCalculation.current = false;
|
|
225
|
+
setIsReady(true);
|
|
226
|
+
}
|
|
227
|
+
}, [containerRef, totalTabs]);
|
|
228
|
+
|
|
229
|
+
// Store calculateVisibleTabs in ref for use in setTabRef
|
|
230
|
+
calculateVisibleTabsRef.current = calculateVisibleTabs;
|
|
231
|
+
|
|
232
|
+
// Reset isFirstCalculation when totalTabs changes (new page/tabs)
|
|
233
|
+
useEffect(() => {
|
|
234
|
+
isFirstCalculation.current = true;
|
|
235
|
+
setIsReady(false);
|
|
236
|
+
// Clear refs so we wait for new tabs to register
|
|
237
|
+
tabWidthsRef.current = [];
|
|
238
|
+
tabLabelsRef.current = [];
|
|
239
|
+
}, [totalTabs]);
|
|
240
|
+
|
|
241
|
+
// Call calculateVisibleTabs on first render and resize
|
|
179
242
|
useEffect(() => {
|
|
180
|
-
|
|
243
|
+
const container = containerRef?.current;
|
|
244
|
+
if (!container) return;
|
|
245
|
+
|
|
246
|
+
let resizeTimeout: number | null = null;
|
|
247
|
+
|
|
248
|
+
// Use ResizeObserver to wait until container has proper size
|
|
249
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
250
|
+
if (resizeTimeout) cancelAnimationFrame(resizeTimeout);
|
|
251
|
+
resizeTimeout = requestAnimationFrame(calculateVisibleTabs);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
resizeObserver.observe(container);
|
|
181
255
|
|
|
182
|
-
let resizeTimeout = requestAnimationFrame(calculateVisibleTabs);
|
|
183
256
|
const handleResize = () => {
|
|
184
|
-
if (resizeTimeout)
|
|
185
|
-
cancelAnimationFrame(resizeTimeout);
|
|
186
|
-
}
|
|
257
|
+
if (resizeTimeout) cancelAnimationFrame(resizeTimeout);
|
|
187
258
|
resizeTimeout = requestAnimationFrame(calculateVisibleTabs);
|
|
188
259
|
};
|
|
189
260
|
|
|
190
261
|
window.addEventListener('resize', handleResize);
|
|
262
|
+
|
|
191
263
|
return () => {
|
|
264
|
+
resizeObserver.disconnect();
|
|
192
265
|
window.removeEventListener('resize', handleResize);
|
|
193
|
-
cancelAnimationFrame(resizeTimeout);
|
|
266
|
+
if (resizeTimeout) cancelAnimationFrame(resizeTimeout);
|
|
194
267
|
};
|
|
195
268
|
}, [containerRef, totalTabs, calculateVisibleTabs]);
|
|
196
269
|
|
|
270
|
+
// Recalculate when activeTab changes to ensure it's visible
|
|
271
|
+
useEffect(() => {
|
|
272
|
+
if (!containerRef?.current || isFirstCalculation.current) return;
|
|
273
|
+
requestAnimationFrame(calculateVisibleTabs);
|
|
274
|
+
}, [activeTab, containerRef, calculateVisibleTabs]);
|
|
275
|
+
|
|
197
276
|
return {
|
|
198
277
|
setTabRef,
|
|
199
278
|
onTabClick,
|
|
200
279
|
handleKeyboard,
|
|
201
280
|
visibleTabs: tabs.visible,
|
|
202
281
|
overflowTabs: tabs.overflow,
|
|
203
|
-
|
|
282
|
+
isReady,
|
|
204
283
|
};
|
|
205
284
|
}
|
|
206
285
|
|
|
207
|
-
type UseActiveTabProps = {
|
|
208
|
-
initialTab: string;
|
|
209
|
-
tabsId?: string;
|
|
210
|
-
};
|
|
211
|
-
|
|
212
286
|
export const useActiveTab = ({ initialTab, tabsId }: UseActiveTabProps) => {
|
|
213
287
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
214
|
-
const
|
|
288
|
+
const initialTabValue = useMemo(
|
|
289
|
+
() => getInitialTab({ initialTab, searchParams, tabsId }),
|
|
290
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
291
|
+
[],
|
|
292
|
+
);
|
|
293
|
+
const [activeTab, setActiveTab] = useState(initialTabValue);
|
|
215
294
|
const prevActiveTabRef = useRef(activeTab);
|
|
216
295
|
|
|
217
296
|
useEffect(() => {
|
|
@@ -228,10 +307,13 @@ export const useActiveTab = ({ initialTab, tabsId }: UseActiveTabProps) => {
|
|
|
228
307
|
});
|
|
229
308
|
}, [activeTab, setSearchParams, tabsId]);
|
|
230
309
|
|
|
231
|
-
return
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
310
|
+
return useMemo(
|
|
311
|
+
() => ({
|
|
312
|
+
activeTab,
|
|
313
|
+
setActiveTab,
|
|
314
|
+
}),
|
|
315
|
+
[activeTab],
|
|
316
|
+
);
|
|
235
317
|
};
|
|
236
318
|
|
|
237
319
|
type GetInitialTabProps = {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// eslint-disable-next-line no-warning-comments
|
|
1
2
|
// TODO we need to create some common way to do this.
|
|
2
3
|
export const useTelemetryFallback = () => ({
|
|
3
4
|
send: () => {},
|
|
@@ -37,20 +38,22 @@ export const useTelemetryFallback = () => ({
|
|
|
37
38
|
sendLanguagePickerLocaleChangedMessage: () => {},
|
|
38
39
|
sendSearchOpenedMessage: () => {},
|
|
39
40
|
sendSearchQueryMessage: () => {},
|
|
41
|
+
sendSearchAiOpenedMessage: () => {},
|
|
40
42
|
sendSearchAIQueryMessage: () => {},
|
|
43
|
+
sendSearchAIFeedbackMessage: () => {},
|
|
41
44
|
sendFeedbackMessage: () => {},
|
|
42
45
|
sendSearchResultClickedMessage: () => {},
|
|
43
46
|
sendRedirectMessage: () => {},
|
|
44
47
|
sendOpenapiDocsMessage: () => {},
|
|
45
48
|
sendCopyCodeSnippetClickedMessage: () => {},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
sendViewedMessage: () => {},
|
|
50
|
+
sendPerformanceMetricsMessage: () => {},
|
|
51
|
+
sendDownloadDefinitionClickedMessage: () => {},
|
|
52
|
+
sendSelectLanguageClickedMessage: () => {},
|
|
53
|
+
sendExpandCollapseAllClickedMessage: () => {},
|
|
54
|
+
sendSwitchServersClickedMessage: () => {},
|
|
55
|
+
sendExamplesSwitcherClickedMessage: () => {},
|
|
56
|
+
sendTryItOpenedMessage: () => {},
|
|
54
57
|
sendAsyncapiDocsViewedMessage: () => {},
|
|
55
58
|
sendAsyncapiDocsPerformanceMetricsMessage: () => {},
|
|
56
59
|
sendAsyncapiDocsSwitchMessageClickedMessage: () => {},
|
|
@@ -4,6 +4,7 @@ import type { UiAccessibleConfig } from '../../config';
|
|
|
4
4
|
|
|
5
5
|
import { ThemeDataContext } from '../contexts/ThemeDataContext';
|
|
6
6
|
|
|
7
|
+
// eslint-disable-next-line no-warning-comments
|
|
7
8
|
// TODO: rename and additionally export as alias for backward compatibility
|
|
8
9
|
export function useThemeConfig<T extends Record<string, unknown>>(
|
|
9
10
|
useProductConfig: boolean = true,
|
|
@@ -22,6 +22,7 @@ const fallbacks = {
|
|
|
22
22
|
usePageData: () => null,
|
|
23
23
|
usePageProps: () => ({}),
|
|
24
24
|
usePageSharedData: () => null,
|
|
25
|
+
useMcpData: () => ({ docs: { enabled: false } }),
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
export const useThemeHooks = () => {
|
|
@@ -30,7 +31,7 @@ export const useThemeHooks = () => {
|
|
|
30
31
|
return new Proxy({} as ThemeHooks, {
|
|
31
32
|
get(_, prop) {
|
|
32
33
|
if (context && prop in context.hooks) {
|
|
33
|
-
return (context.hooks as
|
|
34
|
+
return (context.hooks as Record<string, unknown>)[prop as string];
|
|
34
35
|
} else if (prop in fallbacks) {
|
|
35
36
|
return fallbacks[prop as keyof typeof fallbacks];
|
|
36
37
|
} else {
|
|
@@ -8,6 +8,7 @@ export type { UserClaims } from '../types/user-claims';
|
|
|
8
8
|
export type { OperationParameter, ParameterHighlight } from '../types/search';
|
|
9
9
|
export type { TFunction, TOptions } from '../types/l10n';
|
|
10
10
|
export type { SelectOption, SelectProps } from '../types/select';
|
|
11
|
+
export type { SegmentedOption, SegmentedProps } from '../types/segmented';
|
|
11
12
|
export { IS_BROWSER } from '../utils/dom';
|
|
12
13
|
export {
|
|
13
14
|
addLeadingSlash,
|
|
@@ -18,11 +19,12 @@ export {
|
|
|
18
19
|
withPathPrefix,
|
|
19
20
|
} from '../utils/urls';
|
|
20
21
|
export { capitalize } from '../utils/string';
|
|
21
|
-
export { typedMemo } from '../hoc/
|
|
22
|
+
export { typedMemo } from '../hoc/typed-memo';
|
|
22
23
|
export { useMount } from '../hooks/use-mount';
|
|
23
24
|
export { GlobalStyle } from '../styles/global';
|
|
24
25
|
export { breakpoints } from '../utils/media-css';
|
|
25
26
|
export { isPrimitive } from '../utils/args-typecheck';
|
|
27
|
+
export { getOperationColor } from '../utils/get-operation-color';
|
|
26
28
|
export { ClipboardService } from '../utils/clipboard-service';
|
|
27
29
|
export { getUserAgent } from '../utils/get-user-agent';
|
|
28
30
|
export { useFocusTrap } from '../hooks/use-focus-trap';
|
package/src/core/styles/dark.ts
CHANGED
|
@@ -36,6 +36,10 @@ const replayDarkMode = css`
|
|
|
36
36
|
--replay-server-variable-bg-color-hover: rgba(31, 10, 144, 0.4); // @presenter Color
|
|
37
37
|
--replay-path-parameter-bg-color-hover: rgba(5, 88, 99, 0.4); // @presenter Color
|
|
38
38
|
|
|
39
|
+
--replay-runtime-expression-color: rgba(147, 166, 249, 1); // @presenter Color
|
|
40
|
+
--replay-runtime-expression-bg-color: rgba(147, 166, 249, 0.16); // @presenter Color
|
|
41
|
+
--replay-operators-color: rgba(168, 143, 88, 1); // @presenter Color
|
|
42
|
+
|
|
39
43
|
// @tokens End
|
|
40
44
|
`;
|
|
41
45
|
|
|
@@ -19,7 +19,7 @@ import { checkbox } from '@redocly/theme/icons/CheckboxIcon/variables';
|
|
|
19
19
|
import { admonition } from '@redocly/theme/components/Admonition/variables';
|
|
20
20
|
import { footer } from '@redocly/theme/components/Footer/variables';
|
|
21
21
|
import { button } from '@redocly/theme/components/Button/variables';
|
|
22
|
-
import { aiAssistantButton } from '@redocly/theme/components/Buttons/variables';
|
|
22
|
+
import { aiAssistantButton, connectMCPButton } from '@redocly/theme/components/Buttons/variables';
|
|
23
23
|
import { navbar } from '@redocly/theme/components/Navbar/variables';
|
|
24
24
|
import { search } from '@redocly/theme/components/Search/variables';
|
|
25
25
|
import { menu, mobileMenu } from '@redocly/theme/components/Menu/variables';
|
|
@@ -1224,6 +1224,10 @@ const replay = css`
|
|
|
1224
1224
|
--replay-server-variable-bg-color-hover: rgba(119, 45, 240, 0.16); // @presenter Color
|
|
1225
1225
|
--replay-path-parameter-bg-color-hover: rgba(4, 117, 161, 0.16); // @presenter Color
|
|
1226
1226
|
|
|
1227
|
+
--replay-runtime-expression-color: rgba(54, 90, 249, 1); // @presenter Color
|
|
1228
|
+
--replay-runtime-expression-bg-color: rgba(54, 90, 249, 0.08); // @presenter Color
|
|
1229
|
+
--replay-operators-color: rgba(193, 142, 31, 1); // @presenter Color
|
|
1230
|
+
|
|
1227
1231
|
// @tokens End
|
|
1228
1232
|
`;
|
|
1229
1233
|
|
|
@@ -1239,6 +1243,7 @@ export const styles = css`
|
|
|
1239
1243
|
${breadcrumbs}
|
|
1240
1244
|
${button}
|
|
1241
1245
|
${aiAssistantButton}
|
|
1246
|
+
${connectMCPButton}
|
|
1242
1247
|
${cards}
|
|
1243
1248
|
${catalog}
|
|
1244
1249
|
${catalogClassic}
|
|
@@ -43,6 +43,7 @@ export default function ({ pageProps, children }: React.PropsWithChildren<Markdo
|
|
|
43
43
|
}
|
|
44
44
|
setWrapperElement(node);
|
|
45
45
|
},
|
|
46
|
+
// eslint-disable-next-line no-warning-comments
|
|
46
47
|
// TODO: is this correct?
|
|
47
48
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
49
|
[pageProps.headings],
|
|
@@ -130,7 +130,7 @@ export type CatalogSwitcherItem = {
|
|
|
130
130
|
slug: string;
|
|
131
131
|
selected: boolean;
|
|
132
132
|
};
|
|
133
|
-
|
|
133
|
+
/* eslint-disable-next-line no-warning-comments */
|
|
134
134
|
// TODO: remove this types after we make api-sdk package public and will be able import them from there
|
|
135
135
|
export type BffCatalogRelatedEntity = {
|
|
136
136
|
readonly id: string;
|
|
@@ -142,6 +142,7 @@ export type BffCatalogRelatedEntity = {
|
|
|
142
142
|
relationRole: 'source' | 'target';
|
|
143
143
|
relationType: EntityRelationType;
|
|
144
144
|
sourceFile?: string | null;
|
|
145
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
145
146
|
metadata?: Record<string, any>;
|
|
146
147
|
readonly createdAt: string | null;
|
|
147
148
|
readonly updatedAt: string | null;
|
|
@@ -159,6 +160,7 @@ export type BffCatalogEntity = {
|
|
|
159
160
|
owners?: Array<BffCatalogRelatedEntity>;
|
|
160
161
|
summary?: string | null;
|
|
161
162
|
tags?: Array<string>;
|
|
163
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
162
164
|
metadata?: Record<string, any>;
|
|
163
165
|
git?: Array<string>;
|
|
164
166
|
contact?: {
|
package/src/core/types/filter.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { ResolvedFilter } from './catalog';
|
|
|
2
2
|
import type { RedoclyConfig } from '@redocly/config';
|
|
3
3
|
|
|
4
4
|
export type FilterProps = {
|
|
5
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
5
6
|
filter: ResolvedFilter & { selectedOptions: any };
|
|
6
7
|
filterValuesCasing?:
|
|
7
8
|
| NonNullable<RedoclyConfig['catalog']>[string]['filterValuesCasing']
|
package/src/core/types/hooks.ts
CHANGED
|
@@ -86,6 +86,7 @@ export type ThemeHooks = {
|
|
|
86
86
|
useSearch: (
|
|
87
87
|
product?: string,
|
|
88
88
|
autoSearchDisabled?: boolean,
|
|
89
|
+
searchSessionId?: string,
|
|
89
90
|
) => {
|
|
90
91
|
query: string;
|
|
91
92
|
setQuery: React.Dispatch<React.SetStateAction<string>>;
|
|
@@ -107,7 +108,10 @@ export type ThemeHooks = {
|
|
|
107
108
|
advancedSearch?: boolean;
|
|
108
109
|
askAi?: boolean;
|
|
109
110
|
};
|
|
110
|
-
useAiSearch: (
|
|
111
|
+
useAiSearch: (
|
|
112
|
+
options?: { filter?: SearchFilterItem[] },
|
|
113
|
+
searchSessionId?: string,
|
|
114
|
+
) => {
|
|
111
115
|
askQuestion: (question: string, history?: AiSearchConversationItem[]) => void;
|
|
112
116
|
isGeneratingResponse: boolean;
|
|
113
117
|
question: string;
|
|
@@ -127,6 +131,12 @@ export type ThemeHooks = {
|
|
|
127
131
|
setSearchFacet: React.Dispatch<React.SetStateAction<SearchFacet | null>>;
|
|
128
132
|
setSearchFacetQuery: React.Dispatch<React.SetStateAction<SearchFacetQuery | null>>;
|
|
129
133
|
};
|
|
134
|
+
useMcpData: () => {
|
|
135
|
+
docs: {
|
|
136
|
+
enabled: boolean;
|
|
137
|
+
name?: string;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
130
140
|
useSidebarItems: (activeVersion?: Version | null) => {
|
|
131
141
|
currentItems: ItemState[];
|
|
132
142
|
allSidebarItems: ItemState[];
|
package/src/core/types/index.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
export * from './breadcrumb';
|
|
2
|
-
export * from './catalog';
|
|
3
|
-
export * from './l10n';
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
1
|
+
export type * from './breadcrumb';
|
|
2
|
+
export type * from './catalog';
|
|
3
|
+
export type * from './l10n';
|
|
4
|
+
export type * from './mcp';
|
|
5
|
+
export type * from './feedback';
|
|
6
|
+
export type * from './hooks';
|
|
7
|
+
export type * from './markdown';
|
|
8
|
+
export type * from './navbar';
|
|
8
9
|
export * from './search';
|
|
9
|
-
export * from './select';
|
|
10
|
-
export * from './sidebar';
|
|
11
|
-
export * from './filter';
|
|
12
|
-
export * from './user-menu';
|
|
13
|
-
export * from './user-claims';
|
|
14
|
-
export * from './common';
|
|
15
|
-
export * from './open-api-server';
|
|
16
|
-
export * from './marker';
|
|
17
|
-
export * from './code-walkthrough';
|
|
18
|
-
export * from './page-actions';
|
|
19
|
-
export * from './open-api-info';
|
|
10
|
+
export type * from './select';
|
|
11
|
+
export type * from './sidebar';
|
|
12
|
+
export type * from './filter';
|
|
13
|
+
export type * from './user-menu';
|
|
14
|
+
export type * from './user-claims';
|
|
15
|
+
export type * from './common';
|
|
16
|
+
export type * from './open-api-server';
|
|
17
|
+
export type * from './marker';
|
|
18
|
+
export type * from './code-walkthrough';
|
|
19
|
+
export type * from './page-actions';
|
|
20
|
+
export type * from './open-api-info';
|
|
21
|
+
export type * from './segmented';
|