@redocly/theme 0.69.0-next.0 → 0.69.0-next.10
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/Accordion/Accordion.js +5 -1
- package/lib/components/Accordion/variables.js +1 -1
- package/lib/components/Admonition/Admonition.d.ts +1 -1
- package/lib/components/Admonition/Admonition.js +1 -1
- package/lib/components/Admonition/variables.dark.js +2 -2
- package/lib/components/Admonition/variables.js +10 -10
- package/lib/components/Badge/Badge.d.ts +3 -1
- package/lib/components/Badge/Badge.js +7 -2
- package/lib/components/Banner/variables.dark.js +2 -0
- package/lib/components/Banner/variables.js +3 -1
- package/lib/components/Breadcrumbs/Breadcrumb.js +1 -1
- package/lib/components/Breadcrumbs/variables.js +1 -1
- package/lib/components/Button/ButtonGroup.d.ts +3 -5
- package/lib/components/Button/ButtonGroup.js +25 -5
- package/lib/components/Button/variables.js +27 -4
- package/lib/components/Buttons/ConnectMCPButton.js +39 -123
- package/lib/components/Buttons/CopyButton.js +12 -1
- package/lib/components/Buttons/variables.d.ts +0 -1
- package/lib/components/Buttons/variables.js +3 -44
- package/lib/components/Catalog/CatalogEntities.js +1 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.js +1 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +5 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +1 -1
- package/lib/components/Catalog/CatalogFilter/CatalogFilterSelect.js +1 -0
- package/lib/components/Catalog/CatalogViewModeToggle.d.ts +1 -1
- package/lib/components/Catalog/CatalogViewModeToggle.js +2 -43
- package/lib/components/Catalog/variables.js +5 -5
- package/lib/components/CatalogClassic/variables.js +2 -2
- package/lib/components/CodeBlock/CodeBlock.js +2 -1
- package/lib/components/CodeBlock/CodeBlockContainer.js +1 -0
- package/lib/components/Dropdown/Dropdown.d.ts +10 -20
- package/lib/components/Dropdown/Dropdown.js +13 -2
- package/lib/components/Dropdown/DropdownMenuItemContent.d.ts +9 -0
- package/lib/components/Dropdown/DropdownMenuItemContent.js +56 -0
- package/lib/components/Dropdown/variables.js +19 -2
- package/lib/components/Feedback/Mood.js +18 -14
- package/lib/components/Feedback/Rating.js +18 -13
- package/lib/components/Feedback/Scale.js +27 -22
- package/lib/components/Feedback/Sentiment.js +17 -13
- package/lib/components/Filter/FilterInput.js +4 -2
- package/lib/components/Filter/FilterSelect.js +1 -0
- package/lib/components/Filter/variables.js +2 -2
- package/lib/components/Image/variables.js +5 -3
- package/lib/components/JsonViewer/Helpers.js +12 -42
- package/lib/components/LanguagePicker/variables.js +1 -1
- package/lib/components/MCP/McpConnectionTabs.d.ts +7 -0
- package/lib/components/MCP/McpConnectionTabs.js +151 -0
- package/lib/components/Markdown/Markdown.js +1 -1
- package/lib/components/Markdown/styles/base-table.js +8 -0
- package/lib/components/Markdown/variables.js +1 -1
- package/lib/components/Menu/MenuItem.js +1 -1
- package/lib/components/Menu/variables.js +1 -1
- package/lib/components/Navbar/variables.js +1 -1
- package/lib/components/PageActions/PageActions.js +4 -6
- package/lib/components/PageActions/PageActionsMenuItem.d.ts +4 -4
- package/lib/components/PageActions/PageActionsMenuItem.js +27 -43
- package/lib/components/Panel/Panel.js +5 -1
- package/lib/components/Panel/variables.js +1 -1
- package/lib/components/Product/variables.js +2 -1
- package/lib/components/ReplayGate/ReplayGate.d.ts +1 -0
- package/lib/components/Search/FilterFields/SearchFilterFieldSelect.js +22 -32
- package/lib/components/Search/SearchAiDialog.js +4 -1
- package/lib/components/Search/SearchAiMessage.js +1 -1
- package/lib/components/Search/SearchAiNegativeFeedbackForm.js +2 -2
- package/lib/components/Search/SearchDialog.js +2 -2
- package/lib/components/Search/SearchItem.js +6 -3
- package/lib/components/Search/SearchRecent.js +1 -0
- package/lib/components/Search/SearchSuggestedPages.js +1 -0
- package/lib/components/Search/variables.js +9 -5
- package/lib/components/Segmented/Segmented.js +3 -3
- package/lib/components/Select/Select.js +30 -23
- package/lib/components/Select/variables.js +3 -3
- package/lib/components/Sidebar/Sidebar.js +2 -38
- package/lib/components/SplitButton/SplitButton.d.ts +21 -0
- package/lib/components/SplitButton/SplitButton.js +37 -0
- package/lib/components/Switch/variables.dark.js +2 -2
- package/lib/components/Switch/variables.js +2 -2
- package/lib/components/Tag/variables.js +2 -2
- package/lib/components/Tags/variables.js +1 -1
- package/lib/components/Toast/variables.js +1 -1
- package/lib/components/Tooltip/AnchorTooltip.js +2 -2
- package/lib/components/Tooltip/JsTooltip.js +2 -2
- package/lib/components/UserMenu/variables.js +1 -1
- package/lib/core/constants/accordion.d.ts +3 -0
- package/lib/core/constants/accordion.js +7 -0
- package/lib/core/constants/index.d.ts +1 -0
- package/lib/core/constants/index.js +1 -0
- package/lib/core/constants/mcp.d.ts +4 -0
- package/lib/core/constants/mcp.js +10 -1
- package/lib/core/constants/search.js +2 -2
- package/lib/core/contexts/PageActionsContext.d.ts +5 -0
- package/lib/core/contexts/PageActionsContext.js +10 -0
- package/lib/core/contexts/index.d.ts +1 -0
- package/lib/core/contexts/index.js +1 -0
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-controls.js +5 -17
- package/lib/core/hooks/code-walkthrough/use-code-walkthrough-steps.js +1 -0
- package/lib/core/hooks/menu/use-menu-item-expanded.js +1 -0
- package/lib/core/hooks/use-active-heading.js +59 -15
- package/lib/core/hooks/use-active-section-id.js +3 -1
- package/lib/core/hooks/use-connect-mcp-button.d.ts +1 -1
- package/lib/core/hooks/use-connect-mcp-button.js +16 -13
- package/lib/core/hooks/use-control.js +3 -0
- package/lib/core/hooks/use-local-state.js +1 -0
- package/lib/core/hooks/use-mcp-config.d.ts +2 -0
- package/lib/core/hooks/use-mcp-config.js +14 -4
- package/lib/core/hooks/use-mobile-menu.js +10 -2
- package/lib/core/styles/global.js +56 -49
- package/lib/core/styles/palette.js +2 -0
- package/lib/core/types/button-group.d.ts +2 -0
- package/lib/core/types/button-group.js +3 -0
- package/lib/core/types/catalog.d.ts +2 -4
- package/lib/core/types/common.d.ts +2 -0
- package/lib/core/types/hooks.d.ts +1 -0
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/mcp.d.ts +1 -1
- package/lib/core/utils/RenderWithLink.d.ts +2 -0
- package/lib/core/utils/RenderWithLink.js +20 -0
- package/lib/core/utils/index.d.ts +1 -0
- package/lib/core/utils/index.js +1 -0
- package/lib/core/utils/mcp.d.ts +5 -0
- package/lib/core/utils/mcp.js +35 -0
- package/lib/icons/CodexIcon/CodexIcon.d.ts +25 -0
- package/lib/icons/CodexIcon/CodexIcon.js +22 -0
- package/lib/icons/LinkIcon/LinkIcon.js +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/layouts/McpNotAllowed.js +10 -10
- package/lib/markdoc/components/Accordion/Accordion.d.ts +9 -0
- package/lib/markdoc/components/Accordion/Accordion.js +132 -0
- package/lib/markdoc/components/Accordion/AccordionGroup.d.ts +5 -0
- package/lib/markdoc/components/Accordion/AccordionGroup.js +29 -0
- package/lib/markdoc/components/Accordion/variables.d.ts +1 -0
- package/lib/markdoc/components/Accordion/variables.js +40 -0
- package/lib/markdoc/components/Cards/Card.d.ts +8 -1
- package/lib/markdoc/components/Cards/Card.js +55 -16
- package/lib/markdoc/components/Cards/CardBadge.d.ts +9 -0
- package/lib/markdoc/components/Cards/CardBadge.js +30 -0
- package/lib/markdoc/components/Cards/CardIcon.d.ts +5 -4
- package/lib/markdoc/components/Cards/CardIcon.js +6 -3
- package/lib/markdoc/components/Cards/variables.dark.js +32 -0
- package/lib/markdoc/components/Cards/variables.js +81 -7
- package/lib/markdoc/components/CodeWalkthrough/CodePanel.js +1 -0
- package/lib/markdoc/components/CodeWalkthrough/CodeStep.js +1 -1
- package/lib/markdoc/components/CodeWalkthrough/variables.js +2 -1
- package/lib/markdoc/components/Heading/Heading.js +5 -2
- package/lib/markdoc/components/Tabs/TabList.js +6 -2
- package/lib/markdoc/components/Tabs/Tabs.js +4 -2
- package/lib/markdoc/components/Tabs/variables.js +4 -4
- package/lib/markdoc/components/default.d.ts +2 -0
- package/lib/markdoc/components/default.js +2 -0
- package/lib/markdoc/default.d.ts +4 -0
- package/lib/markdoc/default.js +4 -0
- package/lib/markdoc/tags/accordion-group.d.ts +2 -0
- package/lib/markdoc/tags/accordion-group.js +10 -0
- package/lib/markdoc/tags/accordion.d.ts +2 -0
- package/lib/markdoc/tags/accordion.js +14 -0
- package/lib/markdoc/tags/admonition.js +1 -1
- package/lib/markdoc/tags/card.js +14 -0
- package/lib/markdoc/tags/connect-mcp.js +2 -1
- package/package.json +19 -10
- package/src/components/Accordion/Accordion.tsx +7 -3
- package/src/components/Accordion/variables.ts +1 -1
- package/src/components/Admonition/Admonition.tsx +2 -2
- package/src/components/Admonition/variables.dark.ts +2 -2
- package/src/components/Admonition/variables.ts +10 -10
- package/src/components/Badge/Badge.tsx +16 -2
- package/src/components/Banner/variables.dark.ts +2 -0
- package/src/components/Banner/variables.ts +3 -1
- package/src/components/Breadcrumbs/Breadcrumb.tsx +1 -1
- package/src/components/Breadcrumbs/variables.ts +1 -1
- package/src/components/Button/ButtonGroup.tsx +28 -10
- package/src/components/Button/variables.ts +27 -4
- package/src/components/Buttons/ConnectMCPButton.tsx +88 -145
- package/src/components/Buttons/CopyButton.tsx +14 -2
- package/src/components/Buttons/variables.ts +2 -44
- package/src/components/Catalog/CatalogEntities.tsx +1 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityMethodAndPath.tsx +1 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +6 -4
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +1 -1
- package/src/components/Catalog/CatalogFilter/CatalogFilterSelect.tsx +1 -0
- package/src/components/Catalog/CatalogViewModeToggle.tsx +2 -17
- package/src/components/Catalog/variables.ts +5 -5
- package/src/components/CatalogClassic/variables.ts +2 -2
- package/src/components/CodeBlock/CodeBlock.tsx +2 -1
- package/src/components/CodeBlock/CodeBlockContainer.tsx +1 -0
- package/src/components/Dropdown/Dropdown.tsx +25 -4
- package/src/components/Dropdown/DropdownMenuItemContent.tsx +72 -0
- package/src/components/Dropdown/variables.ts +19 -2
- package/src/components/Feedback/Mood.tsx +22 -15
- package/src/components/Feedback/Rating.tsx +22 -14
- package/src/components/Feedback/Scale.tsx +40 -32
- package/src/components/Feedback/Sentiment.tsx +21 -14
- package/src/components/Filter/FilterInput.tsx +5 -3
- package/src/components/Filter/FilterSelect.tsx +1 -0
- package/src/components/Filter/variables.ts +2 -2
- package/src/components/Image/variables.ts +5 -3
- package/src/components/JsonViewer/Helpers.tsx +13 -9
- package/src/components/LanguagePicker/variables.ts +1 -1
- package/src/components/MCP/McpConnectionTabs.tsx +263 -0
- package/src/components/Markdown/Markdown.tsx +2 -1
- package/src/components/Markdown/styles/base-table.ts +8 -0
- package/src/components/Markdown/variables.ts +1 -1
- package/src/components/Menu/MenuItem.tsx +2 -2
- package/src/components/Menu/variables.ts +1 -1
- package/src/components/Navbar/variables.ts +1 -1
- package/src/components/PageActions/PageActions.tsx +22 -23
- package/src/components/PageActions/PageActionsMenuItem.tsx +41 -55
- package/src/components/Panel/Panel.tsx +7 -3
- package/src/components/Panel/variables.ts +1 -1
- package/src/components/Product/variables.ts +2 -1
- package/src/components/ReplayGate/ReplayGate.tsx +3 -0
- package/src/components/Search/FilterFields/SearchFilterFieldSelect.tsx +32 -40
- package/src/components/Search/SearchAiDialog.tsx +4 -1
- package/src/components/Search/SearchAiMessage.tsx +1 -1
- package/src/components/Search/SearchAiNegativeFeedbackForm.tsx +2 -2
- package/src/components/Search/SearchDialog.tsx +2 -2
- package/src/components/Search/SearchItem.tsx +7 -1
- package/src/components/Search/SearchRecent.tsx +1 -0
- package/src/components/Search/SearchSuggestedPages.tsx +1 -0
- package/src/components/Search/variables.ts +9 -5
- package/src/components/Segmented/Segmented.tsx +6 -3
- package/src/components/Select/Select.tsx +36 -22
- package/src/components/Select/variables.ts +3 -3
- package/src/components/Sidebar/Sidebar.tsx +2 -6
- package/src/components/SplitButton/SplitButton.tsx +95 -0
- package/src/components/Switch/variables.dark.ts +2 -2
- package/src/components/Switch/variables.ts +2 -2
- package/src/components/Tag/variables.ts +2 -2
- package/src/components/Tags/variables.ts +1 -1
- package/src/components/Toast/variables.ts +1 -1
- package/src/components/Tooltip/AnchorTooltip.tsx +2 -2
- package/src/components/Tooltip/JsTooltip.tsx +2 -2
- package/src/components/UserMenu/variables.ts +1 -1
- package/src/core/constants/accordion.ts +4 -0
- package/src/core/constants/index.ts +1 -0
- package/src/core/constants/mcp.ts +14 -0
- package/src/core/constants/search.ts +2 -2
- package/src/core/contexts/PageActionsContext.tsx +7 -0
- package/src/core/contexts/index.ts +1 -0
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-controls.ts +6 -20
- package/src/core/hooks/code-walkthrough/use-code-walkthrough-steps.ts +1 -0
- package/src/core/hooks/menu/use-menu-item-expanded.ts +1 -0
- package/src/core/hooks/use-active-heading.ts +79 -15
- package/src/core/hooks/use-active-section-id.ts +3 -1
- package/src/core/hooks/use-connect-mcp-button.ts +23 -15
- package/src/core/hooks/use-control.ts +5 -1
- package/src/core/hooks/use-local-state.ts +1 -0
- package/src/core/hooks/use-mcp-config.ts +15 -4
- package/src/core/hooks/use-mobile-menu.ts +11 -3
- package/src/core/openapi/index.ts +1 -1
- package/src/core/styles/global.ts +19 -12
- package/src/core/styles/palette.ts +2 -0
- package/src/core/types/button-group.ts +2 -0
- package/src/core/types/catalog.ts +2 -4
- package/src/core/types/common.ts +3 -0
- package/src/core/types/hooks.ts +1 -0
- package/src/core/types/index.ts +1 -0
- package/src/core/types/l10n.ts +29 -1
- package/src/core/types/mcp.ts +1 -1
- package/src/core/utils/RenderWithLink.tsx +19 -0
- package/src/core/utils/index.ts +1 -0
- package/src/core/utils/mcp.ts +39 -0
- package/src/icons/CodexIcon/CodexIcon.tsx +23 -0
- package/src/icons/LinkIcon/LinkIcon.tsx +1 -1
- package/src/index.ts +2 -0
- package/src/layouts/McpNotAllowed.tsx +37 -11
- package/src/markdoc/components/Accordion/Accordion.tsx +128 -0
- package/src/markdoc/components/Accordion/AccordionGroup.tsx +41 -0
- package/src/markdoc/components/Accordion/variables.ts +37 -0
- package/src/markdoc/components/Cards/Card.tsx +79 -14
- package/src/markdoc/components/Cards/CardBadge.tsx +39 -0
- package/src/markdoc/components/Cards/CardIcon.tsx +16 -5
- package/src/markdoc/components/Cards/variables.dark.ts +32 -0
- package/src/markdoc/components/Cards/variables.ts +81 -7
- package/src/markdoc/components/CodeWalkthrough/CodePanel.tsx +1 -0
- package/src/markdoc/components/CodeWalkthrough/CodeStep.tsx +1 -1
- package/src/markdoc/components/CodeWalkthrough/variables.ts +2 -1
- package/src/markdoc/components/Heading/Heading.tsx +7 -4
- package/src/markdoc/components/Tabs/TabList.tsx +6 -2
- package/src/markdoc/components/Tabs/Tabs.tsx +4 -2
- package/src/markdoc/components/Tabs/variables.ts +4 -4
- package/src/markdoc/components/default.ts +2 -0
- package/src/markdoc/default.ts +4 -0
- package/src/markdoc/tags/accordion-group.ts +8 -0
- package/src/markdoc/tags/accordion.ts +12 -0
- package/src/markdoc/tags/admonition.ts +1 -1
- package/src/markdoc/tags/card.ts +14 -0
- package/src/markdoc/tags/connect-mcp.ts +3 -1
|
@@ -18,7 +18,7 @@ exports.toast = (0, styled_components_1.css) `
|
|
|
18
18
|
--toast-max-width: 360px;
|
|
19
19
|
--toast-bg-color: var(--layer-color); // @presenter Color
|
|
20
20
|
--toast-border: var(--border-width) var(--border-style) var(--border-color-secondary); // @presenter Border
|
|
21
|
-
--toast-border-radius: var(--border-radius-
|
|
21
|
+
--toast-border-radius: var(--border-radius-lg); // @presenter BorderRadius
|
|
22
22
|
--toast-font-family: var(--font-family-base); // @presenter FontFamily
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -209,7 +209,7 @@ const TooltipBody = styled_components_1.default.span.attrs(({ $anchorName }) =>
|
|
|
209
209
|
overflow-wrap: break-word;
|
|
210
210
|
text-align: left;
|
|
211
211
|
|
|
212
|
-
border-radius: var(--border-radius-
|
|
212
|
+
border-radius: var(--border-radius-lg);
|
|
213
213
|
transition: opacity 0.3s ease-out;
|
|
214
214
|
|
|
215
215
|
font-size: var(--font-size-base);
|
|
@@ -229,7 +229,7 @@ const TooltipBody = styled_components_1.default.span.attrs(({ $anchorName }) =>
|
|
|
229
229
|
|
|
230
230
|
background: var(--tooltip-bg-color);
|
|
231
231
|
color: var(--tooltip-text-color);
|
|
232
|
-
border: var(--tooltip-border-width,
|
|
232
|
+
border: var(--tooltip-border-width, 2px) var(--tooltip-border-style, solid)
|
|
233
233
|
var(--tooltip-border-color, transparent);
|
|
234
234
|
box-shadow: var(--bg-raised-shadow);
|
|
235
235
|
|
|
@@ -227,7 +227,7 @@ const TooltipBody = styled_components_1.default.span `
|
|
|
227
227
|
word-break: normal;
|
|
228
228
|
overflow-wrap: break-word;
|
|
229
229
|
|
|
230
|
-
border-radius: var(--border-radius-
|
|
230
|
+
border-radius: var(--border-radius-lg);
|
|
231
231
|
transition: opacity 0.3s ease-out;
|
|
232
232
|
|
|
233
233
|
font-size: var(--font-size-base);
|
|
@@ -247,7 +247,7 @@ const TooltipBody = styled_components_1.default.span `
|
|
|
247
247
|
|
|
248
248
|
background: var(--tooltip-bg-color);
|
|
249
249
|
color: var(--tooltip-text-color);
|
|
250
|
-
border: var(--tooltip-border-width,
|
|
250
|
+
border: var(--tooltip-border-width, 2px) var(--tooltip-border-style, solid)
|
|
251
251
|
var(--tooltip-border-color, transparent);
|
|
252
252
|
box-shadow: var(--bg-raised-shadow);
|
|
253
253
|
|
|
@@ -51,7 +51,7 @@ exports.userMenu = (0, styled_components_1.css) `
|
|
|
51
51
|
--user-menu-dropdown-item-padding-vertical: var(--dropdown-menu-item-padding-vertical); // @presenter Spacing
|
|
52
52
|
--user-menu-dropdown-item-separator-padding-top: var(--dropdown-menu-item-separator-padding-top ); // @presenter Spacing
|
|
53
53
|
--user-menu-dropdown-item-separator-padding-bottom: var(--dropdown-menu-item-separator-padding-bottom ); // @presenter Spacing
|
|
54
|
-
--user-menu-dropdown-item-border-radius: var(--dropdown-menu-item-border-radius
|
|
54
|
+
--user-menu-dropdown-item-border-radius: var(--dropdown-menu-item-border-radius); // @presenter BorderRadius
|
|
55
55
|
--user-menu-dropdown-item-bg-color-active: var(--dropdown-menu-item-bg-color-active); // @presenter Color
|
|
56
56
|
--user-menu-dropdown-item-bg-color-hover: var(--dropdown-menu-item-bg-color-hover); // @presenter Color
|
|
57
57
|
--user-menu-dropdown-item-bg-color-disabled: var(--dropdown-menu-item-bg-color-disabled); // @presenter Color
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ACCORDION_SELECTOR = exports.ACCORDION_GROUP_COMPONENT_NAME = exports.ACCORDION_COMPONENT_NAME = void 0;
|
|
4
|
+
exports.ACCORDION_COMPONENT_NAME = 'Markdoc/Accordion/Accordion';
|
|
5
|
+
exports.ACCORDION_GROUP_COMPONENT_NAME = 'Markdoc/Accordion/AccordionGroup';
|
|
6
|
+
exports.ACCORDION_SELECTOR = `[data-component-name='${exports.ACCORDION_COMPONENT_NAME}']`;
|
|
7
|
+
//# sourceMappingURL=accordion.js.map
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./accordion"), exports);
|
|
17
18
|
__exportStar(require("./common"), exports);
|
|
18
19
|
__exportStar(require("./environments"), exports);
|
|
19
20
|
__exportStar(require("./code-walkthrough"), exports);
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_MCP_SERVER_NAME = void 0;
|
|
3
|
+
exports.DEFAULT_MCP_OPTIONS = exports.PUBLIC_MCP_ROUTE = exports.MCP_ROUTE = exports.DEFAULT_MCP_SERVER_NAME = void 0;
|
|
4
4
|
exports.DEFAULT_MCP_SERVER_NAME = 'mcp-server';
|
|
5
|
+
exports.MCP_ROUTE = '/mcp';
|
|
6
|
+
exports.PUBLIC_MCP_ROUTE = '/mcp-public';
|
|
7
|
+
exports.DEFAULT_MCP_OPTIONS = [
|
|
8
|
+
'cursor',
|
|
9
|
+
'vscode',
|
|
10
|
+
'claude-code',
|
|
11
|
+
'codex',
|
|
12
|
+
'copy',
|
|
13
|
+
];
|
|
5
14
|
//# sourceMappingURL=mcp.js.map
|
|
@@ -25,13 +25,13 @@ exports.AI_SEARCH_ERROR_CONFIG = {
|
|
|
25
25
|
headerKey: 'search.ai.error.header.forbidden',
|
|
26
26
|
headerDefault: 'Feature Unavailable',
|
|
27
27
|
messageKey: 'search.ai.error.description.forbidden',
|
|
28
|
-
messageDefault: 'AI
|
|
28
|
+
messageDefault: 'AI assistant is currently unavailable.',
|
|
29
29
|
},
|
|
30
30
|
[AiSearchError.Unauthorized]: {
|
|
31
31
|
headerKey: 'search.ai.error.header.unauthorized',
|
|
32
32
|
headerDefault: 'Authentication Required',
|
|
33
33
|
messageKey: 'search.ai.error.description.unauthorized',
|
|
34
|
-
messageDefault: 'You are not authorized to use AI
|
|
34
|
+
messageDefault: 'You are not authorized to use AI assistant.',
|
|
35
35
|
},
|
|
36
36
|
[AiSearchError.HttpRequestFailed]: defaultErrorConfig,
|
|
37
37
|
[AiSearchError.EmptyResponse]: defaultErrorConfig,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PageActionsContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
/**
|
|
6
|
+
* Whether the first heading inside the enclosing `Markdown` mounts the page actions.
|
|
7
|
+
* Without a provider `Heading` falls back to the page type in the page metadata.
|
|
8
|
+
*/
|
|
9
|
+
exports.PageActionsContext = (0, react_1.createContext)(null);
|
|
10
|
+
//# sourceMappingURL=PageActionsContext.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './ThemeDataContext';
|
|
2
2
|
export * from './MarkdownLinkContext';
|
|
3
|
+
export * from './PageActionsContext';
|
|
3
4
|
export * from './CodeWalkthrough/CodeWalkthroughControlsContext';
|
|
4
5
|
export * from './CodeWalkthrough/CodeWalkthroughStepsContext';
|
|
5
6
|
export * from './CodeSnippetContext';
|
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./ThemeDataContext"), exports);
|
|
18
18
|
__exportStar(require("./MarkdownLinkContext"), exports);
|
|
19
|
+
__exportStar(require("./PageActionsContext"), exports);
|
|
19
20
|
__exportStar(require("./CodeWalkthrough/CodeWalkthroughControlsContext"), exports);
|
|
20
21
|
__exportStar(require("./CodeWalkthrough/CodeWalkthroughStepsContext"), exports);
|
|
21
22
|
__exportStar(require("./CodeSnippetContext"), exports);
|
|
@@ -16,9 +16,6 @@ function useCodeWalkthroughControls(filters, inputs, toggles, enableDeepLink) {
|
|
|
16
16
|
const location = (0, react_router_1.useLocation)();
|
|
17
17
|
const navigate = (0, react_router_1.useNavigate)();
|
|
18
18
|
const searchParams = (0, react_1.useMemo)(() => new URLSearchParams(location.search), [location.search]);
|
|
19
|
-
const filtersRef = (0, react_1.useRef)(filters);
|
|
20
|
-
const inputsRef = (0, react_1.useRef)(inputs);
|
|
21
|
-
const togglesRef = (0, react_1.useRef)(toggles);
|
|
22
19
|
const getInitialState = () => {
|
|
23
20
|
var _a, _b;
|
|
24
21
|
var _c, _d;
|
|
@@ -36,18 +33,10 @@ function useCodeWalkthroughControls(filters, inputs, toggles, enableDeepLink) {
|
|
|
36
33
|
return state;
|
|
37
34
|
};
|
|
38
35
|
const [controlsState, setControlsState] = (0, react_1.useState)(getInitialState);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
JSON.stringify(toggles) === JSON.stringify(togglesRef.current),
|
|
44
|
-
];
|
|
45
|
-
if (sameProps.every(Boolean)) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
filtersRef.current = filters;
|
|
49
|
-
inputsRef.current = inputs;
|
|
50
|
-
togglesRef.current = toggles;
|
|
36
|
+
const controlsKey = JSON.stringify([filters, inputs, toggles]);
|
|
37
|
+
const [prevControlsKey, setPrevControlsKey] = (0, react_1.useState)(controlsKey);
|
|
38
|
+
if (prevControlsKey !== controlsKey) {
|
|
39
|
+
setPrevControlsKey(controlsKey);
|
|
51
40
|
const newState = getInitialState();
|
|
52
41
|
// Preserve existing values where control type hasn't changed
|
|
53
42
|
Object.entries(newState).forEach(([id, control]) => {
|
|
@@ -58,8 +47,7 @@ function useCodeWalkthroughControls(filters, inputs, toggles, enableDeepLink) {
|
|
|
58
47
|
}
|
|
59
48
|
});
|
|
60
49
|
setControlsState(newState);
|
|
61
|
-
|
|
62
|
-
}, [filters, inputs, toggles, enableDeepLink]);
|
|
50
|
+
}
|
|
63
51
|
const changeControlState = (id, value) => {
|
|
64
52
|
setControlsState((prev) => {
|
|
65
53
|
const control = prev[id];
|
|
@@ -171,6 +171,7 @@ function useCodeWalkthroughSteps({ steps, enableDeepLink, root, }) {
|
|
|
171
171
|
}
|
|
172
172
|
const rootTopOffset = (_c = (_a = root.current) === null || _a === void 0 ? void 0 : _a.offsetTop) !== null && _c !== void 0 ? _c : 0;
|
|
173
173
|
if (!activeStep && rootTopOffset <= options.navbarHeight) {
|
|
174
|
+
// oxlint-disable-next-line react-you-might-not-need-an-effect/no-derived-state -- seeded from root.current.offsetTop, a post-layout measurement
|
|
174
175
|
setActiveStep(((_b = visibleSteps[0]) === null || _b === void 0 ? void 0 : _b.id) || null);
|
|
175
176
|
}
|
|
176
177
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -11,6 +11,7 @@ function useMenuItemExpanded(item) {
|
|
|
11
11
|
// it's important for transitions
|
|
12
12
|
const [controlledValue, setControlledValue] = (0, react_1.useState)(isItemExpanded(item));
|
|
13
13
|
(0, react_1.useEffect)(() => {
|
|
14
|
+
// oxlint-disable-next-line react-you-might-not-need-an-effect/no-derived-state -- deferred a commit on purpose so CSS transitions still run
|
|
14
15
|
setIsExpanded(controlledValue);
|
|
15
16
|
}, [controlledValue]);
|
|
16
17
|
(0, react_1.useEffect)(() => {
|
|
@@ -5,16 +5,20 @@ const react_1 = require("react");
|
|
|
5
5
|
const react_router_1 = require("react-router");
|
|
6
6
|
const utils_1 = require("../utils");
|
|
7
7
|
const constants_1 = require("../constants");
|
|
8
|
+
const TARGET_TOLERANCE = 2;
|
|
8
9
|
function useActiveHeading(contentElement, displayedHeadings) {
|
|
9
10
|
const [heading, setHeading] = (0, react_1.useState)(undefined);
|
|
10
11
|
const [headingElements, setHeadingElements] = (0, react_1.useState)([]);
|
|
11
12
|
const headingElementsRef = (0, react_1.useRef)({});
|
|
12
13
|
const displayedHeadingsRef = (0, react_1.useRef)(displayedHeadings);
|
|
13
14
|
const lockObserver = (0, react_1.useRef)(false);
|
|
15
|
+
const clickScroll = (0, react_1.useRef)(null);
|
|
14
16
|
const location = (0, react_router_1.useLocation)();
|
|
15
17
|
(0, react_1.useEffect)(() => {
|
|
16
18
|
setHeading(undefined);
|
|
17
19
|
headingElementsRef.current = {};
|
|
20
|
+
clickScroll.current = null;
|
|
21
|
+
lockObserver.current = false;
|
|
18
22
|
}, [location.pathname]);
|
|
19
23
|
(0, react_1.useEffect)(() => {
|
|
20
24
|
displayedHeadingsRef.current = displayedHeadings;
|
|
@@ -98,13 +102,13 @@ function useActiveHeading(contentElement, displayedHeadings) {
|
|
|
98
102
|
}, [calculateVirtualPositions]);
|
|
99
103
|
const intersectionCallback = (0, react_1.useCallback)((entries) => {
|
|
100
104
|
var _a, _b, _c;
|
|
101
|
-
if (lockObserver.current) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
105
|
headingElementsRef.current = entries.reduce((map, entry) => {
|
|
105
106
|
map[entry.target.id] = entry;
|
|
106
107
|
return map;
|
|
107
108
|
}, headingElementsRef.current);
|
|
109
|
+
if (lockObserver.current) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
108
112
|
if (isTopOfPage()) {
|
|
109
113
|
const newHeading = ((_a = headingElements[0]) === null || _a === void 0 ? void 0 : _a.id) || undefined;
|
|
110
114
|
setHeading(newHeading);
|
|
@@ -145,18 +149,56 @@ function useActiveHeading(contentElement, displayedHeadings) {
|
|
|
145
149
|
}
|
|
146
150
|
setHeading(visibleHeadings[0].target.id);
|
|
147
151
|
}, [getIndexFromId, headingElements, getTriggerOffset, findActiveHeaderByVirtualPosition]);
|
|
152
|
+
const releaseClickScroll = (0, react_1.useCallback)(() => {
|
|
153
|
+
clickScroll.current = null;
|
|
154
|
+
lockObserver.current = false;
|
|
155
|
+
}, []);
|
|
156
|
+
const trackClickScroll = (0, react_1.useCallback)(() => {
|
|
157
|
+
const clickScrollState = clickScroll.current;
|
|
158
|
+
if (!clickScrollState) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const { top } = clickScrollState.target.getBoundingClientRect();
|
|
162
|
+
if (clickScrollState.reached) {
|
|
163
|
+
if (top >= 0 && top <= getTriggerOffset()) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
const distance = Math.abs(top - clickScrollState.scrollMargin);
|
|
169
|
+
if (distance <= TARGET_TOLERANCE) {
|
|
170
|
+
clickScrollState.reached = true;
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (distance <= clickScrollState.closestDistance + TARGET_TOLERANCE) {
|
|
174
|
+
clickScrollState.closestDistance = Math.min(clickScrollState.closestDistance, distance);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
releaseClickScroll();
|
|
179
|
+
intersectionCallback([]);
|
|
180
|
+
}, [releaseClickScroll, intersectionCallback, getTriggerOffset]);
|
|
148
181
|
const handleHeadingClick = (0, react_1.useCallback)((headingId) => {
|
|
149
|
-
|
|
182
|
+
releaseClickScroll();
|
|
150
183
|
setHeading(headingId);
|
|
151
|
-
const
|
|
152
|
-
if (
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
184
|
+
const target = document.getElementById(headingId) || headingElements.find((el) => el.id === headingId);
|
|
185
|
+
if (!(target === null || target === void 0 ? void 0 : target.scrollIntoView)) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
189
|
+
if (!target.getClientRects().length) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const scrollMargin = parseFloat(getComputedStyle(target).scrollMarginTop) || 0;
|
|
193
|
+
const distance = Math.abs(target.getBoundingClientRect().top - scrollMargin);
|
|
194
|
+
lockObserver.current = true;
|
|
195
|
+
clickScroll.current = {
|
|
196
|
+
target,
|
|
197
|
+
scrollMargin,
|
|
198
|
+
closestDistance: distance,
|
|
199
|
+
reached: distance <= TARGET_TOLERANCE,
|
|
200
|
+
};
|
|
201
|
+
}, [headingElements, releaseClickScroll]);
|
|
160
202
|
(0, react_1.useEffect)(() => {
|
|
161
203
|
var _a;
|
|
162
204
|
if (!contentElement) {
|
|
@@ -203,8 +245,10 @@ function useActiveHeading(contentElement, displayedHeadings) {
|
|
|
203
245
|
});
|
|
204
246
|
const handleScroll = () => {
|
|
205
247
|
var _a;
|
|
206
|
-
if (
|
|
248
|
+
if (clickScroll.current) {
|
|
249
|
+
trackClickScroll();
|
|
207
250
|
return;
|
|
251
|
+
}
|
|
208
252
|
if (isTopOfPage()) {
|
|
209
253
|
setHeading(((_a = headingElements[0]) === null || _a === void 0 ? void 0 : _a.id) || undefined);
|
|
210
254
|
}
|
|
@@ -214,7 +258,7 @@ function useActiveHeading(contentElement, displayedHeadings) {
|
|
|
214
258
|
observer.disconnect();
|
|
215
259
|
window.removeEventListener('scroll', handleScroll);
|
|
216
260
|
};
|
|
217
|
-
}, [headingElements, intersectionCallback, getTriggerOffset]);
|
|
261
|
+
}, [headingElements, intersectionCallback, getTriggerOffset, trackClickScroll]);
|
|
218
262
|
return { heading, handleHeadingClick };
|
|
219
263
|
}
|
|
220
264
|
//# sourceMappingURL=use-active-heading.js.map
|
|
@@ -45,10 +45,12 @@ function useActiveSectionId(location, hasOverviewPage = false, withNavbar = true
|
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
window.addEventListener('scroll', scrollListener, { capture: false });
|
|
48
|
-
setTimeout(() => {
|
|
48
|
+
const initialRead = setTimeout(() => {
|
|
49
49
|
scrollListener();
|
|
50
50
|
}, 10);
|
|
51
51
|
return () => {
|
|
52
|
+
clearTimeout(initialRead);
|
|
53
|
+
scrollListener.cancel();
|
|
52
54
|
window.removeEventListener('scroll', scrollListener);
|
|
53
55
|
};
|
|
54
56
|
}, [location, heightOffset, scrollListener]);
|
|
@@ -9,24 +9,27 @@ const lodash_debounce_1 = __importDefault(require("lodash.debounce"));
|
|
|
9
9
|
const use_theme_hooks_1 = require("./use-theme-hooks");
|
|
10
10
|
const use_mcp_config_1 = require("./use-mcp-config");
|
|
11
11
|
const clipboard_service_1 = require("../utils/clipboard-service");
|
|
12
|
+
const mcp_1 = require("../constants/mcp");
|
|
13
|
+
const mcp_2 = require("../utils/mcp");
|
|
12
14
|
const COPIED_RESET_TIMEOUT = 1000;
|
|
13
|
-
function useConnectMCPButton({ options =
|
|
15
|
+
function useConnectMCPButton({ options = mcp_1.DEFAULT_MCP_OPTIONS, } = {}) {
|
|
14
16
|
const { useTranslate } = (0, use_theme_hooks_1.useThemeHooks)();
|
|
15
17
|
const { translate } = useTranslate();
|
|
16
18
|
const { serverName, serverUrl, cursorUrl, vscodeUrl } = (0, use_mcp_config_1.useMCPConfig)();
|
|
17
|
-
const [
|
|
19
|
+
const [copiedOption, setCopiedOption] = (0, react_1.useState)(null);
|
|
18
20
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19
|
-
const resetCopied = (0, react_1.useCallback)((0, lodash_debounce_1.default)(() =>
|
|
21
|
+
const resetCopied = (0, react_1.useCallback)((0, lodash_debounce_1.default)(() => setCopiedOption(null), COPIED_RESET_TIMEOUT), []);
|
|
20
22
|
const handleAction = (0, react_1.useCallback)((action) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
const connection = { serverName, url: serverUrl };
|
|
24
|
+
const copyTextMap = {
|
|
25
|
+
copy: JSON.stringify({ [serverName]: { url: serverUrl, description: 'MCP Server' } }, null, 2),
|
|
26
|
+
'claude-code': (0, mcp_2.generateClaudeCodeCommand)(connection),
|
|
27
|
+
codex: (0, mcp_2.generateCodexCommand)(connection),
|
|
28
|
+
};
|
|
29
|
+
const copyText = copyTextMap[action];
|
|
30
|
+
if (copyText !== undefined) {
|
|
31
|
+
clipboard_service_1.ClipboardService.copyCustom(copyText);
|
|
32
|
+
setCopiedOption(action);
|
|
30
33
|
resetCopied();
|
|
31
34
|
return;
|
|
32
35
|
}
|
|
@@ -39,7 +42,7 @@ function useConnectMCPButton({ options = ['cursor', 'vscode', 'copy'], } = {}) {
|
|
|
39
42
|
const triggerButtonText = (0, react_1.useMemo)(() => translate('page.actions.connectMcp', 'Connect MCP'), [translate]);
|
|
40
43
|
const visibleOptions = (0, react_1.useMemo)(() => options.filter(Boolean), [options]);
|
|
41
44
|
return {
|
|
42
|
-
|
|
45
|
+
copiedOption,
|
|
43
46
|
cursorUrl,
|
|
44
47
|
vscodeUrl,
|
|
45
48
|
triggerButtonText,
|
|
@@ -11,6 +11,9 @@ const useControl = (initialVal = false) => {
|
|
|
11
11
|
clearTimeout(timeoutRef.current);
|
|
12
12
|
}
|
|
13
13
|
}, []);
|
|
14
|
+
(0, react_1.useEffect)(() => {
|
|
15
|
+
return clearOpenTimer;
|
|
16
|
+
}, [clearOpenTimer]);
|
|
14
17
|
const handleOpen = (0, react_1.useCallback)(() => {
|
|
15
18
|
clearOpenTimer();
|
|
16
19
|
timeoutRef.current = setTimeout(() => {
|
|
@@ -22,6 +22,7 @@ function useLocalState(key, initialValue) {
|
|
|
22
22
|
(0, react_1.useEffect)(() => {
|
|
23
23
|
if (!(0, js_utils_1.isBrowser)())
|
|
24
24
|
return;
|
|
25
|
+
// oxlint-disable-next-line react-you-might-not-need-an-effect/no-derived-state -- localStorage is read after mount so SSR and client hydrate from the same value
|
|
25
26
|
setValue(getStoredValue(key, initialValue));
|
|
26
27
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
27
28
|
}, [key]);
|
|
@@ -9,13 +9,21 @@ const mcp_1 = require("../utils/mcp");
|
|
|
9
9
|
const urls_1 = require("../utils/urls");
|
|
10
10
|
function useMCPConfig() {
|
|
11
11
|
var _a;
|
|
12
|
-
|
|
13
|
-
const {
|
|
12
|
+
var _b;
|
|
13
|
+
const { useMcpData, usePageData } = (0, use_theme_hooks_1.useThemeHooks)();
|
|
14
|
+
const { docs: { enabled, name, publicEndpoint }, } = useMcpData();
|
|
15
|
+
const pageSlug = (_a = usePageData()) === null || _a === void 0 ? void 0 : _a.slug;
|
|
14
16
|
const origin = dom_1.IS_BROWSER
|
|
15
17
|
? window.location.origin
|
|
16
|
-
: ((
|
|
18
|
+
: ((_b = globalThis['SSR_HOSTNAME']) !== null && _b !== void 0 ? _b : '');
|
|
17
19
|
const serverName = name || constants_1.DEFAULT_MCP_SERVER_NAME;
|
|
18
|
-
const
|
|
20
|
+
const isPublicEndpointPage = pageSlug === (0, urls_1.withPathPrefix)(constants_1.PUBLIC_MCP_ROUTE);
|
|
21
|
+
const serverUrl = `${origin}${(0, urls_1.withPathPrefix)(isPublicEndpointPage ? constants_1.PUBLIC_MCP_ROUTE : constants_1.MCP_ROUTE)}`;
|
|
22
|
+
const alternateServerUrl = isPublicEndpointPage
|
|
23
|
+
? `${origin}${(0, urls_1.withPathPrefix)(constants_1.MCP_ROUTE)}`
|
|
24
|
+
: publicEndpoint
|
|
25
|
+
? `${origin}${(0, urls_1.withPathPrefix)(constants_1.PUBLIC_MCP_ROUTE)}`
|
|
26
|
+
: undefined;
|
|
19
27
|
const isMcpDisabled = !enabled || false;
|
|
20
28
|
const cursorUrl = (0, react_1.useMemo)(() => (0, mcp_1.generateMCPDeepLink)('cursor', { serverName, url: serverUrl }), [serverName, serverUrl]);
|
|
21
29
|
const vscodeUrl = (0, react_1.useMemo)(() => (0, mcp_1.generateMCPDeepLink)('vscode', { serverName, url: serverUrl }), [serverName, serverUrl]);
|
|
@@ -26,6 +34,8 @@ function useMCPConfig() {
|
|
|
26
34
|
cursorUrl,
|
|
27
35
|
vscodeUrl,
|
|
28
36
|
isMcpDisabled,
|
|
37
|
+
isPublicEndpointPage,
|
|
38
|
+
alternateServerUrl,
|
|
29
39
|
};
|
|
30
40
|
}
|
|
31
41
|
//# sourceMappingURL=use-mcp-config.js.map
|
|
@@ -7,9 +7,17 @@ const use_modal_scroll_lock_1 = require("./use-modal-scroll-lock");
|
|
|
7
7
|
function useMobileMenu(initialState = false) {
|
|
8
8
|
const location = (0, react_router_1.useLocation)();
|
|
9
9
|
const [isOpen, setIsOpen] = (0, react_1.useState)(initialState);
|
|
10
|
-
|
|
10
|
+
const locationKey = `${location.pathname}${location.hash}`;
|
|
11
|
+
const [prevLocationKey, setPrevLocationKey] = (0, react_1.useState)(locationKey);
|
|
12
|
+
if (isOpen && prevLocationKey !== locationKey) {
|
|
13
|
+
setPrevLocationKey(locationKey);
|
|
14
|
+
setIsOpen(false);
|
|
15
|
+
}
|
|
11
16
|
(0, use_modal_scroll_lock_1.useModalScrollLock)(isOpen);
|
|
12
|
-
const openMobileMenu = () =>
|
|
17
|
+
const openMobileMenu = () => {
|
|
18
|
+
setPrevLocationKey(locationKey);
|
|
19
|
+
setIsOpen(true);
|
|
20
|
+
};
|
|
13
21
|
const closeMobileMenu = () => setIsOpen(false);
|
|
14
22
|
return { isOpen, openMobileMenu, closeMobileMenu };
|
|
15
23
|
}
|