@docusaurus/theme-common 2.0.0-beta.16 → 2.0.0-beta.19
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/Details.d.ts +14 -0
- package/lib/components/Collapsible/index.d.ts +32 -4
- package/lib/components/Collapsible/index.d.ts.map +1 -1
- package/lib/components/Collapsible/index.js +18 -10
- package/lib/components/Collapsible/index.js.map +1 -1
- package/lib/components/Details/index.d.ts +6 -1
- package/lib/components/Details/index.d.ts.map +1 -1
- package/lib/components/Details/index.js +11 -6
- package/lib/components/Details/index.js.map +1 -1
- package/lib/components/Details/styles.module.css +4 -0
- package/lib/{utils/announcementBarUtils.d.ts → contexts/announcementBar.d.ts} +7 -3
- package/lib/contexts/announcementBar.d.ts.map +1 -0
- package/lib/{utils/announcementBarUtils.js → contexts/announcementBar.js} +15 -14
- package/lib/contexts/announcementBar.js.map +1 -0
- package/lib/contexts/colorMode.d.ts +27 -0
- package/lib/contexts/colorMode.d.ts.map +1 -0
- package/lib/contexts/colorMode.js +132 -0
- package/lib/contexts/colorMode.js.map +1 -0
- package/lib/contexts/docSidebarItemsExpandedState.d.ts +31 -0
- package/lib/contexts/docSidebarItemsExpandedState.d.ts.map +1 -0
- package/lib/{utils → contexts}/docSidebarItemsExpandedState.js +10 -4
- package/lib/contexts/docSidebarItemsExpandedState.js.map +1 -0
- package/lib/contexts/docsPreferredVersion.d.ts +31 -0
- package/lib/contexts/docsPreferredVersion.d.ts.map +1 -0
- package/lib/contexts/docsPreferredVersion.js +128 -0
- package/lib/contexts/docsPreferredVersion.js.map +1 -0
- package/lib/contexts/docsSidebar.d.ts +26 -0
- package/lib/contexts/docsSidebar.d.ts.map +1 -0
- package/lib/contexts/docsSidebar.js +30 -0
- package/lib/contexts/docsSidebar.js.map +1 -0
- package/lib/contexts/docsVersion.d.ts +20 -0
- package/lib/contexts/docsVersion.d.ts.map +1 -0
- package/lib/contexts/docsVersion.js +26 -0
- package/lib/contexts/docsVersion.js.map +1 -0
- package/lib/contexts/navbarMobileSidebar.d.ts +31 -0
- package/lib/contexts/navbarMobileSidebar.d.ts.map +1 -0
- package/lib/contexts/navbarMobileSidebar.js +56 -0
- package/lib/contexts/navbarMobileSidebar.js.map +1 -0
- package/lib/contexts/navbarSecondaryMenu/content.d.ts +37 -0
- package/lib/contexts/navbarSecondaryMenu/content.d.ts.map +1 -0
- package/lib/contexts/navbarSecondaryMenu/content.js +56 -0
- package/lib/contexts/navbarSecondaryMenu/content.js.map +1 -0
- package/lib/contexts/navbarSecondaryMenu/display.d.ts +24 -0
- package/lib/contexts/navbarSecondaryMenu/display.d.ts.map +1 -0
- package/lib/contexts/navbarSecondaryMenu/display.js +62 -0
- package/lib/contexts/navbarSecondaryMenu/display.js.map +1 -0
- package/lib/{utils/tabGroupChoiceUtils.d.ts → contexts/tabGroupChoice.d.ts} +5 -3
- package/lib/contexts/tabGroupChoice.d.ts.map +1 -0
- package/lib/{utils/tabGroupChoiceUtils.js → contexts/tabGroupChoice.js} +15 -20
- package/lib/contexts/tabGroupChoice.js.map +1 -0
- package/lib/hooks/useBackToTopButton.d.ts +27 -0
- package/lib/hooks/useBackToTopButton.d.ts.map +1 -0
- package/lib/hooks/useBackToTopButton.js +50 -0
- package/lib/hooks/useBackToTopButton.js.map +1 -0
- package/lib/hooks/useCodeWordWrap.d.ts +14 -0
- package/lib/hooks/useCodeWordWrap.d.ts.map +1 -0
- package/lib/hooks/useCodeWordWrap.js +41 -0
- package/lib/hooks/useCodeWordWrap.js.map +1 -0
- package/lib/hooks/useHideableNavbar.d.ts +7 -3
- package/lib/hooks/useHideableNavbar.d.ts.map +1 -1
- package/lib/hooks/useHideableNavbar.js +10 -9
- package/lib/hooks/useHideableNavbar.js.map +1 -1
- package/lib/hooks/useKeyboardNavigation.d.ts +11 -1
- package/lib/hooks/useKeyboardNavigation.d.ts.map +1 -1
- package/lib/hooks/useKeyboardNavigation.js +11 -3
- package/lib/hooks/useKeyboardNavigation.js.map +1 -1
- package/lib/hooks/useLockBodyScroll.d.ts +5 -1
- package/lib/hooks/useLockBodyScroll.d.ts.map +1 -1
- package/lib/hooks/useLockBodyScroll.js +5 -1
- package/lib/hooks/useLockBodyScroll.js.map +1 -1
- package/lib/hooks/usePrismTheme.d.ts +6 -2
- package/lib/hooks/usePrismTheme.d.ts.map +1 -1
- package/lib/hooks/usePrismTheme.js +9 -6
- package/lib/hooks/usePrismTheme.js.map +1 -1
- package/lib/hooks/useSearchPage.d.ts +15 -4
- package/lib/hooks/useSearchPage.d.ts.map +1 -1
- package/lib/hooks/useSearchPage.js +4 -4
- package/lib/hooks/useSearchPage.js.map +1 -1
- package/lib/hooks/useSkipToContent.d.ts +25 -0
- package/lib/hooks/useSkipToContent.d.ts.map +1 -0
- package/lib/hooks/useSkipToContent.js +35 -0
- package/lib/hooks/useSkipToContent.js.map +1 -0
- package/lib/hooks/useTOCHighlight.d.ts +25 -0
- package/lib/hooks/useTOCHighlight.d.ts.map +1 -0
- package/lib/{utils → hooks}/useTOCHighlight.js +18 -16
- package/lib/hooks/useTOCHighlight.js.map +1 -0
- package/lib/hooks/useWindowSize.d.ts +14 -1
- package/lib/hooks/useWindowSize.d.ts.map +1 -1
- package/lib/hooks/useWindowSize.js +14 -11
- package/lib/hooks/useWindowSize.js.map +1 -1
- package/lib/index.d.ts +31 -32
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +31 -26
- package/lib/index.js.map +1 -1
- package/lib/utils/ThemeClassNames.d.ts +7 -0
- package/lib/utils/ThemeClassNames.d.ts.map +1 -1
- package/lib/utils/ThemeClassNames.js +7 -4
- package/lib/utils/ThemeClassNames.js.map +1 -1
- package/lib/utils/codeBlockUtils.d.ts +57 -4
- package/lib/utils/codeBlockUtils.d.ts.map +1 -1
- package/lib/utils/codeBlockUtils.js +111 -80
- package/lib/utils/codeBlockUtils.js.map +1 -1
- package/lib/utils/docsUtils.d.ts +83 -18
- package/lib/utils/docsUtils.d.ts.map +1 -1
- package/lib/utils/docsUtils.js +143 -62
- package/lib/utils/docsUtils.js.map +1 -1
- package/lib/utils/footerUtils.d.ts +13 -0
- package/lib/utils/footerUtils.d.ts.map +1 -0
- package/lib/utils/footerUtils.js +14 -0
- package/lib/utils/footerUtils.js.map +1 -0
- package/lib/utils/generalUtils.d.ts +4 -1
- package/lib/utils/generalUtils.d.ts.map +1 -1
- package/lib/utils/generalUtils.js +6 -3
- package/lib/utils/generalUtils.js.map +1 -1
- package/lib/utils/historyUtils.d.ts +1 -7
- package/lib/utils/historyUtils.d.ts.map +1 -1
- package/lib/utils/historyUtils.js +10 -13
- package/lib/utils/historyUtils.js.map +1 -1
- package/lib/utils/jsUtils.d.ts +1 -1
- package/lib/utils/jsUtils.js +1 -1
- package/lib/utils/metadataUtils.d.ts +38 -0
- package/lib/utils/metadataUtils.d.ts.map +1 -0
- package/lib/utils/metadataUtils.js +61 -0
- package/lib/utils/metadataUtils.js.map +1 -0
- package/lib/utils/navbarUtils.d.ts +21 -0
- package/lib/utils/navbarUtils.d.ts.map +1 -0
- package/lib/utils/navbarUtils.js +32 -0
- package/lib/utils/navbarUtils.js.map +1 -0
- package/lib/utils/reactUtils.d.ts +21 -7
- package/lib/utils/reactUtils.d.ts.map +1 -1
- package/lib/utils/reactUtils.js +34 -6
- package/lib/utils/reactUtils.js.map +1 -1
- package/lib/utils/regexpUtils.d.ts +2 -1
- package/lib/utils/regexpUtils.d.ts.map +1 -1
- package/lib/utils/regexpUtils.js +2 -1
- package/lib/utils/regexpUtils.js.map +1 -1
- package/lib/utils/routesUtils.d.ts +19 -4
- package/lib/utils/routesUtils.d.ts.map +1 -1
- package/lib/utils/routesUtils.js +40 -19
- package/lib/utils/routesUtils.js.map +1 -1
- package/lib/utils/scrollUtils.d.ts +55 -25
- package/lib/utils/scrollUtils.d.ts.map +1 -1
- package/lib/utils/scrollUtils.js +85 -21
- package/lib/utils/scrollUtils.js.map +1 -1
- package/lib/utils/searchUtils.d.ts +12 -0
- package/lib/utils/searchUtils.d.ts.map +1 -1
- package/lib/utils/searchUtils.js +36 -0
- package/lib/utils/searchUtils.js.map +1 -1
- package/lib/utils/storageUtils.d.ts +12 -9
- package/lib/utils/storageUtils.d.ts.map +1 -1
- package/lib/utils/storageUtils.js +21 -13
- package/lib/utils/storageUtils.js.map +1 -1
- package/lib/utils/tagsUtils.d.ts +7 -8
- package/lib/utils/tagsUtils.d.ts.map +1 -1
- package/lib/utils/tagsUtils.js +8 -6
- package/lib/utils/tagsUtils.js.map +1 -1
- package/lib/utils/tocUtils.d.ts +17 -1
- package/lib/utils/tocUtils.d.ts.map +1 -1
- package/lib/utils/tocUtils.js +20 -9
- package/lib/utils/tocUtils.js.map +1 -1
- package/lib/utils/useAlternatePageUtils.d.ts +20 -1
- package/lib/utils/useAlternatePageUtils.d.ts.map +1 -1
- package/lib/utils/useAlternatePageUtils.js +6 -3
- package/lib/utils/useAlternatePageUtils.js.map +1 -1
- package/lib/utils/useLocalPathname.d.ts +5 -0
- package/lib/utils/useLocalPathname.d.ts.map +1 -1
- package/lib/utils/useLocalPathname.js +6 -4
- package/lib/utils/useLocalPathname.js.map +1 -1
- package/lib/utils/useLocationChange.d.ts +7 -5
- package/lib/utils/useLocationChange.d.ts.map +1 -1
- package/lib/utils/useLocationChange.js +6 -2
- package/lib/utils/useLocationChange.js.map +1 -1
- package/lib/utils/usePluralForm.d.ts +11 -0
- package/lib/utils/usePluralForm.d.ts.map +1 -1
- package/lib/utils/usePluralForm.js +19 -24
- package/lib/utils/usePluralForm.js.map +1 -1
- package/lib/utils/useThemeConfig.d.ts +28 -22
- package/lib/utils/useThemeConfig.d.ts.map +1 -1
- package/lib/utils/useThemeConfig.js +3 -0
- package/lib/utils/useThemeConfig.js.map +1 -1
- package/package.json +18 -11
- package/src/components/Collapsible/index.tsx +42 -24
- package/src/components/Details/index.tsx +15 -8
- package/src/components/Details/styles.module.css +4 -0
- package/src/{utils/announcementBarUtils.tsx → contexts/announcementBar.tsx} +20 -22
- package/src/contexts/colorMode.tsx +199 -0
- package/src/contexts/docSidebarItemsExpandedState.tsx +55 -0
- package/src/contexts/docsPreferredVersion.tsx +253 -0
- package/src/contexts/docsSidebar.tsx +50 -0
- package/src/contexts/docsVersion.tsx +36 -0
- package/src/contexts/navbarMobileSidebar.tsx +99 -0
- package/src/contexts/navbarSecondaryMenu/content.tsx +110 -0
- package/src/contexts/navbarSecondaryMenu/display.tsx +102 -0
- package/src/{utils/tabGroupChoiceUtils.tsx → contexts/tabGroupChoice.tsx} +28 -33
- package/src/hooks/useBackToTopButton.ts +73 -0
- package/src/hooks/useCodeWordWrap.ts +56 -0
- package/src/hooks/useHideableNavbar.ts +12 -14
- package/src/hooks/useKeyboardNavigation.ts +11 -3
- package/src/hooks/useLockBodyScroll.ts +5 -2
- package/src/hooks/usePrismTheme.ts +10 -6
- package/src/hooks/useSearchPage.ts +18 -5
- package/src/hooks/useSkipToContent.ts +58 -0
- package/src/{utils → hooks}/useTOCHighlight.ts +24 -15
- package/src/hooks/useWindowSize.ts +14 -12
- package/src/index.ts +77 -57
- package/src/utils/ThemeClassNames.ts +10 -6
- package/src/utils/codeBlockUtils.ts +178 -92
- package/src/utils/docsUtils.tsx +205 -101
- package/src/utils/footerUtils.ts +18 -0
- package/src/utils/generalUtils.ts +6 -3
- package/src/utils/historyUtils.ts +11 -17
- package/src/utils/jsUtils.ts +1 -1
- package/src/utils/metadataUtils.tsx +115 -0
- package/src/utils/navbarUtils.tsx +45 -0
- package/src/utils/reactUtils.tsx +40 -7
- package/src/utils/regexpUtils.ts +2 -1
- package/src/utils/routesUtils.ts +58 -22
- package/src/utils/scrollUtils.tsx +120 -49
- package/src/utils/searchUtils.ts +51 -0
- package/src/utils/storageUtils.ts +23 -15
- package/src/utils/tagsUtils.ts +12 -10
- package/src/utils/tocUtils.ts +22 -11
- package/src/utils/useAlternatePageUtils.ts +17 -5
- package/src/utils/useLocalPathname.ts +6 -4
- package/src/utils/useLocationChange.ts +12 -10
- package/src/utils/usePluralForm.ts +27 -24
- package/src/utils/useThemeConfig.ts +23 -22
- package/yarn-error.log +20199 -0
- package/lib/utils/announcementBarUtils.d.ts.map +0 -1
- package/lib/utils/announcementBarUtils.js.map +0 -1
- package/lib/utils/colorModeUtils.d.ts +0 -18
- package/lib/utils/colorModeUtils.d.ts.map +0 -1
- package/lib/utils/colorModeUtils.js +0 -106
- package/lib/utils/colorModeUtils.js.map +0 -1
- package/lib/utils/docSidebarItemsExpandedState.d.ts +0 -17
- package/lib/utils/docSidebarItemsExpandedState.d.ts.map +0 -1
- package/lib/utils/docSidebarItemsExpandedState.js.map +0 -1
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.d.ts +0 -22
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.d.ts.map +0 -1
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.js +0 -91
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.js.map +0 -1
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.d.ts +0 -14
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.d.ts.map +0 -1
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.js +0 -19
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.js.map +0 -1
- package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.d.ts +0 -14
- package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.d.ts.map +0 -1
- package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.js +0 -41
- package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.js.map +0 -1
- package/lib/utils/mobileSecondaryMenu.d.ts +0 -21
- package/lib/utils/mobileSecondaryMenu.d.ts.map +0 -1
- package/lib/utils/mobileSecondaryMenu.js +0 -50
- package/lib/utils/mobileSecondaryMenu.js.map +0 -1
- package/lib/utils/pathUtils.d.ts +0 -8
- package/lib/utils/pathUtils.d.ts.map +0 -1
- package/lib/utils/pathUtils.js +0 -17
- package/lib/utils/pathUtils.js.map +0 -1
- package/lib/utils/tabGroupChoiceUtils.d.ts.map +0 -1
- package/lib/utils/tabGroupChoiceUtils.js.map +0 -1
- package/lib/utils/useContextualSearchFilters.d.ts +0 -12
- package/lib/utils/useContextualSearchFilters.d.ts.map +0 -1
- package/lib/utils/useContextualSearchFilters.js +0 -37
- package/lib/utils/useContextualSearchFilters.js.map +0 -1
- package/lib/utils/usePrevious.d.ts +0 -8
- package/lib/utils/usePrevious.d.ts.map +0 -1
- package/lib/utils/usePrevious.js +0 -16
- package/lib/utils/usePrevious.js.map +0 -1
- package/lib/utils/useTOCHighlight.d.ts +0 -14
- package/lib/utils/useTOCHighlight.d.ts.map +0 -1
- package/lib/utils/useTOCHighlight.js.map +0 -1
- package/src/utils/colorModeUtils.tsx +0 -156
- package/src/utils/docSidebarItemsExpandedState.tsx +0 -41
- package/src/utils/docsPreferredVersion/DocsPreferredVersionProvider.tsx +0 -167
- package/src/utils/docsPreferredVersion/DocsPreferredVersionStorage.ts +0 -33
- package/src/utils/docsPreferredVersion/useDocsPreferredVersion.ts +0 -70
- package/src/utils/mobileSecondaryMenu.tsx +0 -115
- package/src/utils/pathUtils.ts +0 -19
- package/src/utils/useContextualSearchFilters.ts +0 -53
- package/src/utils/usePrevious.ts +0 -19
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { useEffect, useRef } from 'react';
|
|
8
|
-
import { useThemeConfig } from '
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import { useThemeConfig } from '../utils/useThemeConfig';
|
|
9
|
+
// TODO make the hardcoded theme-classic classnames configurable (or add them
|
|
10
|
+
// to ThemeClassNames?)
|
|
11
|
+
/**
|
|
12
|
+
* If the anchor has no height and is just a "marker" in the DOM; we'll use the
|
|
13
|
+
* parent (normally the link text) rect boundaries instead
|
|
12
14
|
*/
|
|
13
|
-
// If the anchor has no height and is just a "marker" in the dom; we'll use the
|
|
14
|
-
// parent (normally the link text) rect boundaries instead
|
|
15
15
|
function getVisibleBoundingClientRect(element) {
|
|
16
16
|
const rect = element.getBoundingClientRect();
|
|
17
17
|
const hasNoHeight = rect.top === rect.bottom;
|
|
@@ -22,7 +22,7 @@ function getVisibleBoundingClientRect(element) {
|
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Considering we divide viewport into 2 zones of each 50vh, this returns true
|
|
25
|
-
* if an element is in the first zone (
|
|
25
|
+
* if an element is in the first zone (i.e., appear in viewport, near the top)
|
|
26
26
|
*/
|
|
27
27
|
function isInViewportTopHalf(boundingRect) {
|
|
28
28
|
return boundingRect.top > 0 && boundingRect.bottom < window.innerHeight / 2;
|
|
@@ -35,7 +35,6 @@ function getAnchors({ minHeadingLevel, maxHeadingLevel, }) {
|
|
|
35
35
|
return Array.from(document.querySelectorAll(selectors.join()));
|
|
36
36
|
}
|
|
37
37
|
function getActiveAnchor(anchors, { anchorTopOffset, }) {
|
|
38
|
-
var _a;
|
|
39
38
|
// Naming is hard: The "nextVisibleAnchor" is the first anchor that appear
|
|
40
39
|
// under the viewport top boundary. It does not mean this anchor is visible
|
|
41
40
|
// yet, but if user continues scrolling down, it will be the first to become
|
|
@@ -57,11 +56,11 @@ function getActiveAnchor(anchors, { anchorTopOffset, }) {
|
|
|
57
56
|
// main text appearing in the user screen mostly belong to the previous
|
|
58
57
|
// anchor. Returns null for the first anchor, see
|
|
59
58
|
// https://github.com/facebook/docusaurus/issues/5318
|
|
60
|
-
return
|
|
59
|
+
return anchors[anchors.indexOf(nextVisibleAnchor) - 1] ?? null;
|
|
61
60
|
}
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
return anchors[anchors.length - 1];
|
|
61
|
+
// No anchor under viewport top (i.e. we are at the bottom of the page),
|
|
62
|
+
// highlight the last anchor found
|
|
63
|
+
return anchors[anchors.length - 1] ?? null;
|
|
65
64
|
}
|
|
66
65
|
function getLinkAnchorValue(link) {
|
|
67
66
|
return decodeURIComponent(link.href.substring(link.href.indexOf('#') + 1));
|
|
@@ -82,20 +81,23 @@ function useAnchorTopOffsetRef() {
|
|
|
82
81
|
}, [hideOnScroll]);
|
|
83
82
|
return anchorTopOffsetRef;
|
|
84
83
|
}
|
|
85
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Side-effect that applies the active class name to the TOC heading that the
|
|
86
|
+
* user is currently viewing. Disabled when `config` is undefined.
|
|
87
|
+
*/
|
|
88
|
+
export function useTOCHighlight(config) {
|
|
86
89
|
const lastActiveLinkRef = useRef(undefined);
|
|
87
90
|
const anchorTopOffsetRef = useAnchorTopOffsetRef();
|
|
88
91
|
useEffect(() => {
|
|
89
92
|
if (!config) {
|
|
90
|
-
//
|
|
93
|
+
// No-op, highlighting is disabled
|
|
91
94
|
return () => { };
|
|
92
95
|
}
|
|
93
96
|
const { linkClassName, linkActiveClassName, minHeadingLevel, maxHeadingLevel, } = config;
|
|
94
97
|
function updateLinkActiveClass(link, active) {
|
|
95
|
-
var _a;
|
|
96
98
|
if (active) {
|
|
97
99
|
if (lastActiveLinkRef.current && lastActiveLinkRef.current !== link) {
|
|
98
|
-
|
|
100
|
+
lastActiveLinkRef.current?.classList.remove(linkActiveClassName);
|
|
99
101
|
}
|
|
100
102
|
link.classList.add(linkActiveClassName);
|
|
101
103
|
lastActiveLinkRef.current = link;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTOCHighlight.js","sourceRoot":"","sources":["../../src/hooks/useTOCHighlight.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAEvD,6EAA6E;AAC7E,uBAAuB;AAEvB;;;GAGG;AACH,SAAS,4BAA4B,CAAC,OAAoB;IACxD,MAAM,IAAI,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAC7C,MAAM,WAAW,GAAG,IAAI,C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AAC;QACL,CAAC;QAED,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QACtD,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QAEtD,gBAAgB,EAAE,CAAC;QAEnB,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;YACzD,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QAC3D,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -10,6 +10,19 @@ declare const windowSizes: {
|
|
|
10
10
|
readonly ssr: "ssr";
|
|
11
11
|
};
|
|
12
12
|
declare type WindowSize = keyof typeof windowSizes;
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Gets the current window size as an enum value. We don't want it to return the
|
|
15
|
+
* actual width value, so that it only re-renders once a breakpoint is crossed.
|
|
16
|
+
*
|
|
17
|
+
* It may return `"ssr"`, which is very important to handle hydration FOUC or
|
|
18
|
+
* layout shifts. You have to handle it explicitly upfront. On the server, you
|
|
19
|
+
* may need to render BOTH the mobile/desktop elements (and hide one of them
|
|
20
|
+
* with mediaquery). We don't return `undefined` on purpose, to make it more
|
|
21
|
+
* explicit.
|
|
22
|
+
*
|
|
23
|
+
* In development mode, this hook will still return `"ssr"` for one second, to
|
|
24
|
+
* catch potential layout shifts, similar to strict mode calling effects twice.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useWindowSize(): WindowSize;
|
|
14
27
|
export {};
|
|
15
28
|
//# sourceMappingURL=useWindowSize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWindowSize.d.ts","sourceRoot":"","sources":["../../src/hooks/useWindowSize.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,QAAA,MAAM,WAAW;;;;
|
|
1
|
+
{"version":3,"file":"useWindowSize.d.ts","sourceRoot":"","sources":["../../src/hooks/useWindowSize.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,QAAA,MAAM,WAAW;;;;CAIP,CAAC;AAEX,aAAK,UAAU,GAAG,MAAM,OAAO,WAAW,CAAC;AAe3C;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,IAAI,UAAU,CA0B1C"}
|
|
@@ -9,11 +9,6 @@ import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
|
|
|
9
9
|
const windowSizes = {
|
|
10
10
|
desktop: 'desktop',
|
|
11
11
|
mobile: 'mobile',
|
|
12
|
-
// This "ssr" value is very important to handle hydration FOUC / layout shifts
|
|
13
|
-
// You have to handle server-rendering explicitly on the call-site
|
|
14
|
-
// On the server, you may need to render BOTH the mobile/desktop elements (and
|
|
15
|
-
// hide one of them with mediaquery)
|
|
16
|
-
// We don't return "undefined" on purpose, to make it more explicit
|
|
17
12
|
ssr: 'ssr',
|
|
18
13
|
};
|
|
19
14
|
const DesktopThresholdWidth = 996;
|
|
@@ -25,13 +20,21 @@ function getWindowSize() {
|
|
|
25
20
|
? windowSizes.desktop
|
|
26
21
|
: windowSizes.mobile;
|
|
27
22
|
}
|
|
28
|
-
// Simulate the SSR window size in dev, so that potential hydration FOUC/layout
|
|
29
|
-
// shift problems can be seen in dev too!
|
|
30
23
|
const DevSimulateSSR = process.env.NODE_ENV === 'development' && true;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Gets the current window size as an enum value. We don't want it to return the
|
|
26
|
+
* actual width value, so that it only re-renders once a breakpoint is crossed.
|
|
27
|
+
*
|
|
28
|
+
* It may return `"ssr"`, which is very important to handle hydration FOUC or
|
|
29
|
+
* layout shifts. You have to handle it explicitly upfront. On the server, you
|
|
30
|
+
* may need to render BOTH the mobile/desktop elements (and hide one of them
|
|
31
|
+
* with mediaquery). We don't return `undefined` on purpose, to make it more
|
|
32
|
+
* explicit.
|
|
33
|
+
*
|
|
34
|
+
* In development mode, this hook will still return `"ssr"` for one second, to
|
|
35
|
+
* catch potential layout shifts, similar to strict mode calling effects twice.
|
|
36
|
+
*/
|
|
37
|
+
export function useWindowSize() {
|
|
35
38
|
const [windowSize, setWindowSize] = useState(() => {
|
|
36
39
|
if (DevSimulateSSR) {
|
|
37
40
|
return 'ssr';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWindowSize.js","sourceRoot":"","sources":["../../src/hooks/useWindowSize.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE1C,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AAEpE,MAAM,WAAW,GAAG;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;
|
|
1
|
+
{"version":3,"file":"useWindowSize.js","sourceRoot":"","sources":["../../src/hooks/useWindowSize.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE1C,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AAEpE,MAAM,WAAW,GAAG;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;CACF,CAAC;AAIX,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC,SAAS,aAAa;IACpB,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE;QACnC,OAAO,WAAW,CAAC,GAAG,CAAC;KACxB;IACD,OAAO,MAAM,CAAC,UAAU,GAAG,qBAAqB;QAC9C,CAAC,CAAC,WAAW,CAAC,OAAO;QACrB,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC;AACzB,CAAC;AAED,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,IAAI,IAAI,CAAC;AAEtE;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAa,GAAG,EAAE;QAC5D,IAAI,cAAc,EAAE;YAClB,OAAO,KAAK,CAAC;SACd;QACD,OAAO,aAAa,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,gBAAgB;YACvB,aAAa,CAAC,aAAa,EAAE,CAAC,CAAC;QACjC,CAAC;QAED,MAAM,OAAO,GAAG,cAAc;YAC5B,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,gBAAgB,EAAE,IAAI,CAAC;YAC3C,CAAC,CAAC,SAAS,CAAC;QAEd,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QAEpD,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;YACvD,YAAY,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -4,48 +4,47 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
export { useThemeConfig } from './utils/useThemeConfig';
|
|
8
|
-
export { DocSidebarItemsExpandedStateProvider, useDocSidebarItemsExpandedState, } from './
|
|
9
|
-
export
|
|
7
|
+
export { useThemeConfig, type ThemeConfig, type UserThemeConfig, type Navbar, type NavbarItem, type NavbarLogo, type MultiColumnFooter, type SimpleFooter, type Footer, type FooterLogo, type FooterLinkItem, type ColorModeConfig, } from './utils/useThemeConfig';
|
|
8
|
+
export { DocSidebarItemsExpandedStateProvider, useDocSidebarItemsExpandedState, } from './contexts/docSidebarItemsExpandedState';
|
|
9
|
+
export { DocsVersionProvider, useDocsVersion } from './contexts/docsVersion';
|
|
10
|
+
export { DocsSidebarProvider, useDocsSidebar } from './contexts/docsSidebar';
|
|
10
11
|
export { createStorageSlot, listStorageKeys } from './utils/storageUtils';
|
|
11
12
|
export { useAlternatePageUtils } from './utils/useAlternatePageUtils';
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export { isDocsPluginEnabled, DocsVersionProvider, useDocsVersion, useDocById, DocsSidebarProvider, useDocsSidebar, findSidebarCategory, findFirstCategoryLink, useCurrentSidebarCategory, isActiveSidebarItem, useSidebarBreadcrumbs, } from './utils/docsUtils';
|
|
16
|
-
export { isSamePath } from './utils/pathUtils';
|
|
13
|
+
export { parseCodeBlockTitle, parseLanguage, parseLines, containsLineNumbers, getPrismCssVariables, } from './utils/codeBlockUtils';
|
|
14
|
+
export { docVersionSearchTag, DEFAULT_SEARCH_TAG, useContextualSearchFilters, } from './utils/searchUtils';
|
|
15
|
+
export { isDocsPluginEnabled, useDocById, findSidebarCategory, findFirstCategoryLink, useCurrentSidebarCategory, isActiveSidebarItem, useSidebarBreadcrumbs, useDocsVersionCandidates, useLayoutDoc, useLayoutDocsSidebar, useDocRouteMetadata, } from './utils/docsUtils';
|
|
17
16
|
export { useTitleFormatter } from './utils/generalUtils';
|
|
18
17
|
export { usePluralForm } from './utils/usePluralForm';
|
|
19
18
|
export { useLocationChange } from './utils/useLocationChange';
|
|
20
|
-
export { usePrevious } from './utils/usePrevious';
|
|
21
19
|
export { useCollapsible, Collapsible } from './components/Collapsible';
|
|
22
|
-
export
|
|
23
|
-
export { default as Details } from './components/Details';
|
|
24
|
-
export type { DetailsProps } from './components/Details';
|
|
25
|
-
export { MobileSecondaryMenuProvider, MobileSecondaryMenuFiller, useMobileSecondaryMenuRenderer, } from './utils/mobileSecondaryMenu';
|
|
26
|
-
export type { MobileSecondaryMenuComponent } from './utils/mobileSecondaryMenu';
|
|
27
|
-
export { useDocsPreferredVersion, useDocsPreferredVersionByPluginId, } from './utils/docsPreferredVersion/useDocsPreferredVersion';
|
|
20
|
+
export { useDocsPreferredVersion, useDocsPreferredVersionByPluginId, DocsPreferredVersionContextProvider, } from './contexts/docsPreferredVersion';
|
|
28
21
|
export { duplicates, uniq } from './utils/jsUtils';
|
|
29
|
-
export { DocsPreferredVersionContextProvider } from './utils/docsPreferredVersion/DocsPreferredVersionProvider';
|
|
30
22
|
export { ThemeClassNames } from './utils/ThemeClassNames';
|
|
31
|
-
export { AnnouncementBarProvider, useAnnouncementBar, } from './
|
|
23
|
+
export { AnnouncementBarProvider, useAnnouncementBar, } from './contexts/announcementBar';
|
|
32
24
|
export { useLocalPathname } from './utils/useLocalPathname';
|
|
33
|
-
export { translateTagsPageTitle, listTagsByLetters } from './utils/tagsUtils';
|
|
34
|
-
export type { TagLetterEntry } from './utils/tagsUtils';
|
|
25
|
+
export { translateTagsPageTitle, listTagsByLetters, type TagLetterEntry, } from './utils/tagsUtils';
|
|
35
26
|
export { useHistoryPopHandler } from './utils/historyUtils';
|
|
36
|
-
export {
|
|
37
|
-
export type { TOCHighlightConfig } from './utils/useTOCHighlight';
|
|
27
|
+
export { useTOCHighlight, type TOCHighlightConfig, } from './hooks/useTOCHighlight';
|
|
38
28
|
export { useFilteredAndTreeifiedTOC, useTreeifiedTOC, type TOCTreeNode, } from './utils/tocUtils';
|
|
39
|
-
export {
|
|
40
|
-
export {
|
|
29
|
+
export { isMultiColumnFooterLinks } from './utils/footerUtils';
|
|
30
|
+
export { ScrollControllerProvider, useScrollController, useScrollPosition, useScrollPositionBlocker, useSmoothScrollTo, } from './utils/scrollUtils';
|
|
31
|
+
export { useIsomorphicLayoutEffect, useDynamicCallback, usePrevious, ReactContextError, } from './utils/reactUtils';
|
|
41
32
|
export { isRegexpStringMatch } from './utils/regexpUtils';
|
|
42
|
-
export { useHomePageRoute } from './utils/routesUtils';
|
|
43
|
-
export {
|
|
44
|
-
export {
|
|
45
|
-
export {
|
|
46
|
-
export {
|
|
47
|
-
export {
|
|
48
|
-
export {
|
|
49
|
-
export {
|
|
50
|
-
export {
|
|
33
|
+
export { useHomePageRoute, isSamePath } from './utils/routesUtils';
|
|
34
|
+
export { PageMetadata, HtmlClassNameProvider, PluginHtmlClassNameProvider, } from './utils/metadataUtils';
|
|
35
|
+
export { useColorMode, ColorModeProvider, type ColorMode, } from './contexts/colorMode';
|
|
36
|
+
export { splitNavbarItems, NavbarProvider } from './utils/navbarUtils';
|
|
37
|
+
export { useTabGroupChoice, TabGroupChoiceProvider, } from './contexts/tabGroupChoice';
|
|
38
|
+
export { useNavbarMobileSidebar } from './contexts/navbarMobileSidebar';
|
|
39
|
+
export { NavbarSecondaryMenuFiller, type NavbarSecondaryMenuComponent, } from './contexts/navbarSecondaryMenu/content';
|
|
40
|
+
export { useNavbarSecondaryMenu } from './contexts/navbarSecondaryMenu/display';
|
|
41
|
+
export { useBackToTopButton } from './hooks/useBackToTopButton';
|
|
42
|
+
export { useHideableNavbar } from './hooks/useHideableNavbar';
|
|
43
|
+
export { useKeyboardNavigation, keyboardFocusedClassName, } from './hooks/useKeyboardNavigation';
|
|
44
|
+
export { usePrismTheme } from './hooks/usePrismTheme';
|
|
45
|
+
export { useLockBodyScroll } from './hooks/useLockBodyScroll';
|
|
46
|
+
export { useWindowSize } from './hooks/useWindowSize';
|
|
47
|
+
export { useSearchPage } from './hooks/useSearchPage';
|
|
48
|
+
export { useCodeWordWrap } from './hooks/useCodeWordWrap';
|
|
49
|
+
export { useSkipToContent } from './hooks/useSkipToContent';
|
|
51
50
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts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2B,CAAC;AAEnC,OAAO,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAC;AACtE,OAAO,EACL,yBAAyB,EACzB,KAAK,4BAA4B,GAClC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAC,sBAAsB,EAAC,MAAM,wCAAwC,CAAC;AAE9E,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EACL,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -4,42 +4,47 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
export { useThemeConfig } from './utils/useThemeConfig';
|
|
8
|
-
export { DocSidebarItemsExpandedStateProvider, useDocSidebarItemsExpandedState, } from './
|
|
7
|
+
export { useThemeConfig, } from './utils/useThemeConfig';
|
|
8
|
+
export { DocSidebarItemsExpandedStateProvider, useDocSidebarItemsExpandedState, } from './contexts/docSidebarItemsExpandedState';
|
|
9
|
+
export { DocsVersionProvider, useDocsVersion } from './contexts/docsVersion';
|
|
10
|
+
export { DocsSidebarProvider, useDocsSidebar } from './contexts/docsSidebar';
|
|
9
11
|
export { createStorageSlot, listStorageKeys } from './utils/storageUtils';
|
|
10
12
|
export { useAlternatePageUtils } from './utils/useAlternatePageUtils';
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export { isDocsPluginEnabled, DocsVersionProvider, useDocsVersion, useDocById, DocsSidebarProvider, useDocsSidebar, findSidebarCategory, findFirstCategoryLink, useCurrentSidebarCategory, isActiveSidebarItem, useSidebarBreadcrumbs, } from './utils/docsUtils';
|
|
15
|
-
export { isSamePath } from './utils/pathUtils';
|
|
13
|
+
export { parseCodeBlockTitle, parseLanguage, parseLines, containsLineNumbers, getPrismCssVariables, } from './utils/codeBlockUtils';
|
|
14
|
+
export { docVersionSearchTag, DEFAULT_SEARCH_TAG, useContextualSearchFilters, } from './utils/searchUtils';
|
|
15
|
+
export { isDocsPluginEnabled, useDocById, findSidebarCategory, findFirstCategoryLink, useCurrentSidebarCategory, isActiveSidebarItem, useSidebarBreadcrumbs, useDocsVersionCandidates, useLayoutDoc, useLayoutDocsSidebar, useDocRouteMetadata, } from './utils/docsUtils';
|
|
16
16
|
export { useTitleFormatter } from './utils/generalUtils';
|
|
17
17
|
export { usePluralForm } from './utils/usePluralForm';
|
|
18
18
|
export { useLocationChange } from './utils/useLocationChange';
|
|
19
|
-
export { usePrevious } from './utils/usePrevious';
|
|
20
19
|
export { useCollapsible, Collapsible } from './components/Collapsible';
|
|
21
|
-
export {
|
|
22
|
-
export { MobileSecondaryMenuProvider, MobileSecondaryMenuFiller, useMobileSecondaryMenuRenderer, } from './utils/mobileSecondaryMenu';
|
|
23
|
-
export { useDocsPreferredVersion, useDocsPreferredVersionByPluginId, } from './utils/docsPreferredVersion/useDocsPreferredVersion';
|
|
20
|
+
export { useDocsPreferredVersion, useDocsPreferredVersionByPluginId, DocsPreferredVersionContextProvider, } from './contexts/docsPreferredVersion';
|
|
24
21
|
export { duplicates, uniq } from './utils/jsUtils';
|
|
25
|
-
export { DocsPreferredVersionContextProvider } from './utils/docsPreferredVersion/DocsPreferredVersionProvider';
|
|
26
22
|
export { ThemeClassNames } from './utils/ThemeClassNames';
|
|
27
|
-
export { AnnouncementBarProvider, useAnnouncementBar, } from './
|
|
23
|
+
export { AnnouncementBarProvider, useAnnouncementBar, } from './contexts/announcementBar';
|
|
28
24
|
export { useLocalPathname } from './utils/useLocalPathname';
|
|
29
|
-
export { translateTagsPageTitle, listTagsByLetters } from './utils/tagsUtils';
|
|
25
|
+
export { translateTagsPageTitle, listTagsByLetters, } from './utils/tagsUtils';
|
|
30
26
|
export { useHistoryPopHandler } from './utils/historyUtils';
|
|
31
|
-
export {
|
|
27
|
+
export { useTOCHighlight, } from './hooks/useTOCHighlight';
|
|
32
28
|
export { useFilteredAndTreeifiedTOC, useTreeifiedTOC, } from './utils/tocUtils';
|
|
33
|
-
export {
|
|
34
|
-
export {
|
|
29
|
+
export { isMultiColumnFooterLinks } from './utils/footerUtils';
|
|
30
|
+
export { ScrollControllerProvider, useScrollController, useScrollPosition, useScrollPositionBlocker, useSmoothScrollTo, } from './utils/scrollUtils';
|
|
31
|
+
export { useIsomorphicLayoutEffect, useDynamicCallback, usePrevious, ReactContextError, } from './utils/reactUtils';
|
|
35
32
|
export { isRegexpStringMatch } from './utils/regexpUtils';
|
|
36
|
-
export { useHomePageRoute } from './utils/routesUtils';
|
|
37
|
-
export {
|
|
38
|
-
export {
|
|
39
|
-
export {
|
|
40
|
-
export {
|
|
41
|
-
export {
|
|
42
|
-
export {
|
|
43
|
-
export {
|
|
44
|
-
export {
|
|
33
|
+
export { useHomePageRoute, isSamePath } from './utils/routesUtils';
|
|
34
|
+
export { PageMetadata, HtmlClassNameProvider, PluginHtmlClassNameProvider, } from './utils/metadataUtils';
|
|
35
|
+
export { useColorMode, ColorModeProvider, } from './contexts/colorMode';
|
|
36
|
+
export { splitNavbarItems, NavbarProvider } from './utils/navbarUtils';
|
|
37
|
+
export { useTabGroupChoice, TabGroupChoiceProvider, } from './contexts/tabGroupChoice';
|
|
38
|
+
export { useNavbarMobileSidebar } from './contexts/navbarMobileSidebar';
|
|
39
|
+
export { NavbarSecondaryMenuFiller, } from './contexts/navbarSecondaryMenu/content';
|
|
40
|
+
export { useNavbarSecondaryMenu } from './contexts/navbarSecondaryMenu/display';
|
|
41
|
+
export { useBackToTopButton } from './hooks/useBackToTopButton';
|
|
42
|
+
export { useHideableNavbar } from './hooks/useHideableNavbar';
|
|
43
|
+
export { useKeyboardNavigation, keyboardFocusedClassName, } from './hooks/useKeyboardNavigation';
|
|
44
|
+
export { usePrismTheme } from './hooks/usePrismTheme';
|
|
45
|
+
export { useLockBodyScroll } from './hooks/useLockBodyScroll';
|
|
46
|
+
export { useWindowSize } from './hooks/useWindowSize';
|
|
47
|
+
export { useSearchPage } from './hooks/useSearchPage';
|
|
48
|
+
export { useCodeWordWrap } from './hooks/useCodeWordWrap';
|
|
49
|
+
export { useSkipToContent } from './hooks/useSkipToContent';
|
|
45
50
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,cAAc,GAYf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,oCAAoC,EACpC,+BAA+B,GAChC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAC,mBAAmB,EAAE,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAC,mBAAmB,EAAE,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAE3E,OAAO,EAAC,iBAAiB,EAAE,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAExE,OAAO,EAAC,qBAAqB,EAAC,MAAM,+BAA+B,CAAC;AAEpE,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL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zB,kBAAkB,EAClB,WAAW,EACX,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAC,gBAAgB,EAAE,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,YAAY,EACZ,iBAAiB,GAElB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,gBAAgB,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAErE,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAC;AACtE,OAAO,EACL,yBAAyB,GAE1B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAC,sBAAsB,EAAC,MAAM,wCAAwC,CAAC;AAE9E,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EACL,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAC"}
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* These class names are used to style page layouts in Docusaurus, meant to be
|
|
9
|
+
* targeted by user-provided custom CSS selectors.
|
|
10
|
+
*/
|
|
7
11
|
export declare const ThemeClassNames: {
|
|
8
12
|
readonly page: {
|
|
9
13
|
readonly blogListPage: "blog-list-page";
|
|
@@ -21,6 +25,9 @@ export declare const ThemeClassNames: {
|
|
|
21
25
|
readonly docsPages: "docs-wrapper";
|
|
22
26
|
readonly mdxPages: "mdx-wrapper";
|
|
23
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Follows the naming convention "theme-{blog,doc,version,page}?-<suffix>"
|
|
30
|
+
*/
|
|
24
31
|
readonly common: {
|
|
25
32
|
readonly editThisPage: "theme-edit-this-page";
|
|
26
33
|
readonly lastUpdated: "theme-last-updated";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeClassNames.d.ts","sourceRoot":"","sources":["../../src/utils/ThemeClassNames.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"ThemeClassNames.d.ts","sourceRoot":"","sources":["../../src/utils/ThemeClassNames.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;IAoB1B;;OAEG;;;;;;;;;;;;;;;;;;;;;;sDAwBoC,MAAM;kDAEV,MAAM;;;CAOjC,CAAC"}
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
// These class names are used to style page layouts in Docusaurus
|
|
8
|
-
// Those are meant to be targeted by user-provided custom CSS selectors
|
|
9
7
|
// Please do not modify the classnames! This is a breaking change, and annoying
|
|
10
8
|
// for users!
|
|
9
|
+
/**
|
|
10
|
+
* These class names are used to style page layouts in Docusaurus, meant to be
|
|
11
|
+
* targeted by user-provided custom CSS selectors.
|
|
12
|
+
*/
|
|
11
13
|
export const ThemeClassNames = {
|
|
12
14
|
page: {
|
|
13
15
|
blogListPage: 'blog-list-page',
|
|
@@ -25,8 +27,9 @@ export const ThemeClassNames = {
|
|
|
25
27
|
docsPages: 'docs-wrapper',
|
|
26
28
|
mdxPages: 'mdx-wrapper',
|
|
27
29
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Follows the naming convention "theme-{blog,doc,version,page}?-<suffix>"
|
|
32
|
+
*/
|
|
30
33
|
common: {
|
|
31
34
|
editThisPage: 'theme-edit-this-page',
|
|
32
35
|
lastUpdated: 'theme-last-updated',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeClassNames.js","sourceRoot":"","sources":["../../src/utils/ThemeClassNames.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH
|
|
1
|
+
{"version":3,"file":"ThemeClassNames.js","sourceRoot":"","sources":["../../src/utils/ThemeClassNames.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,+EAA+E;AAC/E,aAAa;AAEb;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE;QACJ,YAAY,EAAE,gBAAgB;QAC9B,YAAY,EAAE,gBAAgB;QAC9B,gBAAgB,EAAE,qBAAqB;QACvC,mBAAmB,EAAE,0BAA0B;QAE/C,WAAW,EAAE,eAAe;QAC5B,gBAAgB,EAAE,qBAAqB;QACvC,kBAAkB,EAAE,yBAAyB;QAE7C,OAAO,EAAE,UAAU;KACpB;IACD,OAAO,EAAE;QACP,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,cAAc;QACzB,SAAS,EAAE,cAAc;QACzB,QAAQ,EAAE,aAAa;KACxB;IAED;;OAEG;IACH,MAAM,EAAE;QACN,YAAY,EAAE,sBAAsB;QACpC,WAAW,EAAE,oBAAoB;QACjC,eAAe,EAAE,0BAA0B;QAC3C,SAAS,EAAE,kBAAkB;KAC9B;IACD,MAAM,EAAE;IACN,wCAAwC;KACzC;IACD,IAAI,EAAE;QACJ,gBAAgB,EAAE,0BAA0B;QAC5C,eAAe,EAAE,yBAAyB;QAC1C,cAAc,EAAE,uBAAuB;QACvC,WAAW,EAAE,oBAAoB;QACjC,YAAY,EAAE,sBAAsB;QACpC,aAAa,EAAE,uBAAuB;QACtC,SAAS,EAAE,kBAAkB;QAC7B,gBAAgB,EAAE,2BAA2B;QAC7C,oBAAoB,EAAE,gCAAgC;QACtD,mBAAmB,EAAE,6BAA6B;QAClD,cAAc,EAAE,wBAAwB;QACxC,sBAAsB,EAAE,iCAAiC;QACzD,kBAAkB,EAAE,6BAA6B;QACjD,2BAA2B,EAAE,CAAC,KAAa,EAAE,EAAE,CAC7C,yCAAyC,KAAK,EAAW;QAC3D,uBAAuB,EAAE,CAAC,KAAa,EAAE,EAAE,CACzC,qCAAqC,KAAK,EAAW;QACvD,wCAAwC;KACzC;IACD,IAAI,EAAE;IACJ,wCAAwC;KACzC;CACO,CAAC"}
|
|
@@ -4,14 +4,67 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
import type { PrismTheme } from 'prism-react-renderer';
|
|
8
|
+
import type { CSSProperties } from 'react';
|
|
9
|
+
export declare type MagicCommentConfig = {
|
|
10
|
+
className: string;
|
|
11
|
+
line?: string;
|
|
12
|
+
block?: {
|
|
13
|
+
start: string;
|
|
14
|
+
end: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
7
17
|
export declare function parseCodeBlockTitle(metastring?: string): string;
|
|
18
|
+
export declare function containsLineNumbers(metastring?: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Gets the language name from the class name (set by MDX).
|
|
21
|
+
* e.g. `"language-javascript"` => `"javascript"`.
|
|
22
|
+
* Returns undefined if there is no language class name.
|
|
23
|
+
*/
|
|
8
24
|
export declare function parseLanguage(className: string): string | undefined;
|
|
9
25
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
26
|
+
* Parses the code content, strips away any magic comments, and returns the
|
|
27
|
+
* clean content and the highlighted lines marked by the comments or metastring.
|
|
28
|
+
*
|
|
29
|
+
* If the metastring contains a range, the `content` will be returned as-is
|
|
30
|
+
* without any parsing. The returned `lineClassNames` will be a map from that
|
|
31
|
+
* number range to the first magic comment config entry (which _should_ be for
|
|
32
|
+
* line highlight directives.)
|
|
33
|
+
*
|
|
34
|
+
* @param content The raw code with magic comments. Trailing newline will be
|
|
35
|
+
* trimmed upfront.
|
|
36
|
+
* @param options Options for parsing behavior.
|
|
12
37
|
*/
|
|
13
|
-
export declare function parseLines(content: string,
|
|
14
|
-
|
|
38
|
+
export declare function parseLines(content: string, options: {
|
|
39
|
+
/**
|
|
40
|
+
* The full metastring, as received from MDX. Line ranges declared here
|
|
41
|
+
* start at 1.
|
|
42
|
+
*/
|
|
43
|
+
metastring: string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Language of the code block, used to determine which kinds of magic
|
|
46
|
+
* comment styles to enable.
|
|
47
|
+
*/
|
|
48
|
+
language: string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Magic comment types that we should try to parse. Each entry would
|
|
51
|
+
* correspond to one class name to apply to each line.
|
|
52
|
+
*/
|
|
53
|
+
magicComments: MagicCommentConfig[];
|
|
54
|
+
}): {
|
|
55
|
+
/**
|
|
56
|
+
* The highlighted lines, 0-indexed. e.g. `{ 0: ["highlight", "sample"] }`
|
|
57
|
+
* means the 1st line should have `highlight` and `sample` as class names.
|
|
58
|
+
*/
|
|
59
|
+
lineClassNames: {
|
|
60
|
+
[lineIndex: number]: string[];
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* If there's number range declared in the metastring, the code block is
|
|
64
|
+
* returned as-is (no parsing); otherwise, this is the clean code with all
|
|
65
|
+
* magic comments stripped away.
|
|
66
|
+
*/
|
|
15
67
|
code: string;
|
|
16
68
|
};
|
|
69
|
+
export declare function getPrismCssVariables(prismTheme: PrismTheme): CSSProperties;
|
|
17
70
|
//# sourceMappingURL=codeBlockUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeBlockUtils.d.ts","sourceRoot":"","sources":["../../src/utils/codeBlockUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"codeBlockUtils.d.ts","sourceRoot":"","sources":["../../src/utils/codeBlockUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAgBzC,oBAAY,kBAAkB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAC,CAAC;CACtC,CAAC;AAiEF,wBAAgB,mBAAmB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,wBAAgB,mBAAmB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKnE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IACP;;;OAGG;IACH,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B;;;OAGG;IACH,aAAa,EAAE,kBAAkB,EAAE,CAAC;CACrC,GACA;IACD;;;OAGG;IACH,cAAc,EAAE;QAAC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAC,CAAC;IAChD;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;CACd,CA0EA;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,aAAa,CAc1E"}
|