@docusaurus/theme-common 2.0.0-beta.15d451942 → 2.0.0-beta.18
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/Collapsible/index.d.ts +64 -0
- package/lib/components/Collapsible/index.d.ts.map +1 -0
- package/lib/components/Collapsible/index.js +152 -0
- package/lib/components/Collapsible/index.js.map +1 -0
- package/lib/components/Details/index.d.ts +17 -0
- package/lib/components/Details/index.d.ts.map +1 -0
- package/lib/components/Details/index.js +70 -0
- package/lib/components/Details/index.js.map +1 -0
- package/lib/components/Details/styles.module.css +58 -0
- package/lib/contexts/announcementBar.d.ts +22 -0
- package/lib/contexts/announcementBar.d.ts.map +1 -0
- package/lib/contexts/announcementBar.js +72 -0
- 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 +114 -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/contexts/docSidebarItemsExpandedState.js +28 -0
- package/lib/contexts/docSidebarItemsExpandedState.js.map +1 -0
- package/lib/contexts/docsPreferredVersion.d.ts +28 -0
- package/lib/contexts/docsPreferredVersion.d.ts.map +1 -0
- package/lib/contexts/docsPreferredVersion.js +125 -0
- package/lib/contexts/docsPreferredVersion.js.map +1 -0
- package/lib/contexts/docsSidebar.d.ts +20 -0
- package/lib/contexts/docsSidebar.d.ts.map +1 -0
- package/lib/contexts/docsSidebar.js +29 -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.d.ts +38 -0
- package/lib/contexts/navbarSecondaryMenu.d.ts.map +1 -0
- package/lib/contexts/navbarSecondaryMenu.js +93 -0
- package/lib/contexts/navbarSecondaryMenu.js.map +1 -0
- package/lib/contexts/tabGroupChoice.d.ts +21 -0
- package/lib/contexts/tabGroupChoice.d.ts.map +1 -0
- package/lib/contexts/tabGroupChoice.js +49 -0
- package/lib/contexts/tabGroupChoice.js.map +1 -0
- package/lib/{utils/useChangeRoute.d.ts → hooks/styles.css} +4 -1
- package/lib/hooks/useHideableNavbar.d.ts +17 -0
- package/lib/hooks/useHideableNavbar.d.ts.map +1 -0
- package/lib/hooks/useHideableNavbar.js +61 -0
- package/lib/hooks/useHideableNavbar.js.map +1 -0
- package/lib/hooks/useKeyboardNavigation.d.ts +20 -0
- package/lib/hooks/useKeyboardNavigation.d.ts.map +1 -0
- package/lib/hooks/useKeyboardNavigation.js +39 -0
- package/lib/hooks/useKeyboardNavigation.js.map +1 -0
- package/lib/hooks/useLockBodyScroll.d.ts +12 -0
- package/lib/hooks/useLockBodyScroll.d.ts.map +1 -0
- package/lib/hooks/useLockBodyScroll.js +20 -0
- package/lib/hooks/useLockBodyScroll.js.map +1 -0
- package/lib/hooks/usePrismTheme.d.ts +13 -0
- package/lib/hooks/usePrismTheme.d.ts.map +1 -0
- package/lib/hooks/usePrismTheme.js +22 -0
- package/lib/hooks/usePrismTheme.js.map +1 -0
- package/lib/hooks/useSearchPage.d.ts +25 -0
- package/lib/hooks/useSearchPage.d.ts.map +1 -0
- package/lib/hooks/useSearchPage.js +43 -0
- package/lib/hooks/useSearchPage.js.map +1 -0
- package/lib/hooks/useTOCHighlight.d.ts +25 -0
- package/lib/hooks/useTOCHighlight.d.ts.map +1 -0
- package/lib/hooks/useTOCHighlight.js +130 -0
- package/lib/hooks/useTOCHighlight.js.map +1 -0
- package/lib/hooks/useWindowSize.d.ts +28 -0
- package/lib/hooks/useWindowSize.d.ts.map +1 -0
- package/lib/hooks/useWindowSize.js +59 -0
- package/lib/hooks/useWindowSize.js.map +1 -0
- package/lib/index.d.ts +36 -9
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +36 -8
- package/lib/index.js.map +1 -0
- package/lib/utils/ThemeClassNames.d.ts +47 -12
- package/lib/utils/ThemeClassNames.d.ts.map +1 -0
- package/lib/utils/ThemeClassNames.js +45 -4
- package/lib/utils/ThemeClassNames.js.map +1 -0
- package/lib/utils/codeBlockUtils.d.ts +33 -0
- package/lib/utils/codeBlockUtils.d.ts.map +1 -0
- package/lib/utils/codeBlockUtils.js +126 -3
- package/lib/utils/codeBlockUtils.js.map +1 -0
- package/lib/utils/docsUtils.d.ts +33 -0
- package/lib/utils/docsUtils.d.ts.map +1 -0
- package/lib/utils/docsUtils.js +118 -1
- package/lib/utils/docsUtils.js.map +1 -0
- 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 +11 -1
- package/lib/utils/generalUtils.d.ts.map +1 -0
- package/lib/utils/generalUtils.js +9 -5
- package/lib/utils/generalUtils.js.map +1 -0
- package/lib/utils/historyUtils.d.ts +17 -0
- package/lib/utils/historyUtils.d.ts.map +1 -0
- package/lib/utils/historyUtils.js +38 -0
- package/lib/utils/historyUtils.js.map +1 -0
- package/lib/utils/jsUtils.d.ts +23 -0
- package/lib/utils/jsUtils.d.ts.map +1 -0
- package/lib/utils/jsUtils.js +29 -0
- package/lib/utils/jsUtils.js.map +1 -0
- 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 +30 -0
- package/lib/utils/navbarUtils.js.map +1 -0
- package/lib/utils/reactUtils.d.ts +42 -0
- package/lib/utils/reactUtils.d.ts.map +1 -0
- package/lib/utils/reactUtils.js +64 -0
- package/lib/utils/reactUtils.js.map +1 -0
- package/lib/utils/regexpUtils.d.ts +12 -0
- package/lib/utils/regexpUtils.d.ts.map +1 -0
- package/lib/utils/regexpUtils.js +18 -0
- package/lib/utils/regexpUtils.js.map +1 -0
- package/lib/utils/routesUtils.d.ts +26 -0
- package/lib/utils/routesUtils.d.ts.map +1 -0
- package/lib/utils/routesUtils.js +54 -0
- package/lib/utils/routesUtils.js.map +1 -0
- package/lib/utils/scrollUtils.d.ts +59 -0
- package/lib/utils/scrollUtils.d.ts.map +1 -0
- package/lib/utils/scrollUtils.js +148 -0
- package/lib/utils/scrollUtils.js.map +1 -0
- package/lib/utils/searchUtils.d.ts +13 -0
- package/lib/utils/searchUtils.d.ts.map +1 -0
- package/lib/utils/searchUtils.js +35 -0
- package/lib/utils/searchUtils.js.map +1 -0
- package/lib/utils/storageUtils.d.ts +13 -5
- package/lib/utils/storageUtils.d.ts.map +1 -0
- package/lib/utils/storageUtils.js +58 -25
- package/lib/utils/storageUtils.js.map +1 -0
- package/lib/utils/tagsUtils.d.ts +22 -0
- package/lib/utils/tagsUtils.d.ts.map +1 -0
- package/lib/utils/tagsUtils.js +36 -0
- package/lib/utils/tagsUtils.js.map +1 -0
- package/lib/utils/tocUtils.d.ts +36 -0
- package/lib/utils/tocUtils.d.ts.map +1 -0
- package/lib/utils/tocUtils.js +84 -0
- package/lib/utils/tocUtils.js.map +1 -0
- package/lib/utils/useAlternatePageUtils.d.ts +21 -1
- package/lib/utils/useAlternatePageUtils.d.ts.map +1 -0
- package/lib/utils/useAlternatePageUtils.js +9 -4
- package/lib/utils/useAlternatePageUtils.js.map +1 -0
- package/lib/utils/useLocalPathname.d.ts +13 -0
- package/lib/utils/useLocalPathname.d.ts.map +1 -0
- package/lib/utils/useLocalPathname.js +19 -0
- package/lib/utils/useLocalPathname.js.map +1 -0
- package/lib/utils/useLocationChange.d.ts +17 -0
- package/lib/utils/useLocationChange.d.ts.map +1 -0
- package/lib/utils/useLocationChange.js +31 -0
- package/lib/utils/useLocationChange.js.map +1 -0
- package/lib/utils/usePluralForm.d.ts +12 -0
- package/lib/utils/usePluralForm.d.ts.map +1 -0
- package/lib/utils/usePluralForm.js +36 -37
- package/lib/utils/usePluralForm.js.map +1 -0
- package/lib/utils/useThemeConfig.d.ts +50 -22
- package/lib/utils/useThemeConfig.d.ts.map +1 -0
- package/lib/utils/useThemeConfig.js +4 -0
- package/lib/utils/useThemeConfig.js.map +1 -0
- package/package.json +18 -13
- package/src/components/Collapsible/index.tsx +265 -0
- package/src/components/Details/index.tsx +107 -0
- package/src/components/Details/styles.module.css +58 -0
- package/src/contexts/announcementBar.tsx +119 -0
- package/src/contexts/colorMode.tsx +176 -0
- package/src/contexts/docSidebarItemsExpandedState.tsx +55 -0
- package/src/contexts/docsPreferredVersion.tsx +250 -0
- package/src/contexts/docsSidebar.tsx +42 -0
- package/src/contexts/docsVersion.tsx +36 -0
- package/src/contexts/navbarMobileSidebar.tsx +99 -0
- package/src/contexts/navbarSecondaryMenu.tsx +170 -0
- package/src/contexts/tabGroupChoice.tsx +82 -0
- package/{lib/utils/pathUtils.d.ts → src/hooks/styles.css} +4 -1
- package/src/hooks/useHideableNavbar.ts +77 -0
- package/src/hooks/useKeyboardNavigation.ts +45 -0
- package/src/hooks/useLockBodyScroll.ts +21 -0
- package/src/hooks/usePrismTheme.ts +24 -0
- package/src/hooks/useSearchPage.ts +79 -0
- package/src/hooks/useTOCHighlight.ts +192 -0
- package/src/hooks/useWindowSize.ts +72 -0
- package/src/index.ts +129 -18
- package/src/types.d.ts +0 -2
- package/src/utils/ThemeClassNames.ts +51 -5
- package/src/utils/codeBlockUtils.ts +155 -2
- package/src/utils/docsUtils.tsx +180 -0
- package/src/utils/footerUtils.ts +18 -0
- package/src/utils/generalUtils.ts +9 -5
- package/src/utils/historyUtils.ts +45 -0
- package/src/utils/jsUtils.ts +36 -0
- package/src/utils/metadataUtils.tsx +115 -0
- package/src/utils/navbarUtils.tsx +40 -0
- package/src/utils/reactUtils.tsx +76 -0
- package/src/utils/regexpUtils.ts +24 -0
- package/src/utils/routesUtils.ts +75 -0
- package/src/utils/scrollUtils.tsx +234 -0
- package/src/utils/searchUtils.ts +49 -0
- package/src/utils/storageUtils.ts +57 -24
- package/src/utils/tagsUtils.ts +55 -0
- package/src/utils/tocUtils.ts +119 -0
- package/src/utils/useAlternatePageUtils.ts +28 -7
- package/src/utils/useLocalPathname.ts +22 -0
- package/src/utils/useLocationChange.ts +41 -0
- package/src/utils/usePluralForm.ts +49 -39
- package/src/utils/useThemeConfig.ts +49 -24
- package/lib/.tsbuildinfo +0 -4159
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.d.ts +0 -21
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.js +0 -94
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.d.ts +0 -13
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.js +0 -20
- package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.d.ts +0 -5
- package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.js +0 -41
- package/lib/utils/pathUtils.js +0 -13
- package/lib/utils/useChangeRoute.js +0 -18
- package/src/utils/__tests__/codeBlockUtils.test.ts +0 -54
- package/src/utils/__tests__/pathUtils.test.ts +0 -32
- package/src/utils/docsPreferredVersion/DocsPreferredVersionProvider.tsx +0 -165
- package/src/utils/docsPreferredVersion/DocsPreferredVersionStorage.ts +0 -34
- package/src/utils/docsPreferredVersion/useDocsPreferredVersion.ts +0 -66
- package/src/utils/docsUtils.ts +0 -11
- package/src/utils/pathUtils.ts +0 -17
- package/src/utils/useChangeRoute.ts +0 -21
- package/tsconfig.json +0 -10
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { useEffect, useState } from 'react';
|
|
8
|
+
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
|
|
9
|
+
const windowSizes = {
|
|
10
|
+
desktop: 'desktop',
|
|
11
|
+
mobile: 'mobile',
|
|
12
|
+
ssr: 'ssr',
|
|
13
|
+
};
|
|
14
|
+
const DesktopThresholdWidth = 996;
|
|
15
|
+
function getWindowSize() {
|
|
16
|
+
if (!ExecutionEnvironment.canUseDOM) {
|
|
17
|
+
return windowSizes.ssr;
|
|
18
|
+
}
|
|
19
|
+
return window.innerWidth > DesktopThresholdWidth
|
|
20
|
+
? windowSizes.desktop
|
|
21
|
+
: windowSizes.mobile;
|
|
22
|
+
}
|
|
23
|
+
const DevSimulateSSR = process.env.NODE_ENV === 'development' && true;
|
|
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() {
|
|
38
|
+
const [windowSize, setWindowSize] = useState(() => {
|
|
39
|
+
if (DevSimulateSSR) {
|
|
40
|
+
return 'ssr';
|
|
41
|
+
}
|
|
42
|
+
return getWindowSize();
|
|
43
|
+
});
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
function updateWindowSize() {
|
|
46
|
+
setWindowSize(getWindowSize());
|
|
47
|
+
}
|
|
48
|
+
const timeout = DevSimulateSSR
|
|
49
|
+
? window.setTimeout(updateWindowSize, 1000)
|
|
50
|
+
: undefined;
|
|
51
|
+
window.addEventListener('resize', updateWindowSize);
|
|
52
|
+
return () => {
|
|
53
|
+
window.removeEventListener('resize', updateWindowSize);
|
|
54
|
+
clearTimeout(timeout);
|
|
55
|
+
};
|
|
56
|
+
}, []);
|
|
57
|
+
return windowSize;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=useWindowSize.js.map
|
|
@@ -0,0 +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;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,17 +4,44 @@
|
|
|
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
|
|
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';
|
|
9
11
|
export { createStorageSlot, listStorageKeys } from './utils/storageUtils';
|
|
10
12
|
export { useAlternatePageUtils } from './utils/useAlternatePageUtils';
|
|
11
|
-
export { parseCodeBlockTitle } from './utils/codeBlockUtils';
|
|
12
|
-
export { docVersionSearchTag, DEFAULT_SEARCH_TAG } from './utils/searchUtils';
|
|
13
|
-
export { isDocsPluginEnabled } from './utils/docsUtils';
|
|
14
|
-
export { isSamePath } from './utils/pathUtils';
|
|
13
|
+
export { parseCodeBlockTitle, parseLanguage, parseLines, } from './utils/codeBlockUtils';
|
|
14
|
+
export { docVersionSearchTag, DEFAULT_SEARCH_TAG, useContextualSearchFilters, } from './utils/searchUtils';
|
|
15
|
+
export { isDocsPluginEnabled, useDocById, findSidebarCategory, findFirstCategoryLink, useCurrentSidebarCategory, isActiveSidebarItem, useSidebarBreadcrumbs, } from './utils/docsUtils';
|
|
15
16
|
export { useTitleFormatter } from './utils/generalUtils';
|
|
16
17
|
export { usePluralForm } from './utils/usePluralForm';
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
18
|
+
export { useLocationChange } from './utils/useLocationChange';
|
|
19
|
+
export { useCollapsible, Collapsible } from './components/Collapsible';
|
|
20
|
+
export { Details, type DetailsProps } from './components/Details';
|
|
21
|
+
export { useDocsPreferredVersion, useDocsPreferredVersionByPluginId, DocsPreferredVersionContextProvider, } from './contexts/docsPreferredVersion';
|
|
22
|
+
export { duplicates, uniq } from './utils/jsUtils';
|
|
20
23
|
export { ThemeClassNames } from './utils/ThemeClassNames';
|
|
24
|
+
export { AnnouncementBarProvider, useAnnouncementBar, } from './contexts/announcementBar';
|
|
25
|
+
export { useLocalPathname } from './utils/useLocalPathname';
|
|
26
|
+
export { translateTagsPageTitle, listTagsByLetters, type TagLetterEntry, type TagsListItem, } from './utils/tagsUtils';
|
|
27
|
+
export { useHistoryPopHandler } from './utils/historyUtils';
|
|
28
|
+
export { useTOCHighlight, type TOCHighlightConfig, } from './hooks/useTOCHighlight';
|
|
29
|
+
export { useFilteredAndTreeifiedTOC, useTreeifiedTOC, type TOCTreeNode, } from './utils/tocUtils';
|
|
30
|
+
export { isMultiColumnFooterLinks } from './utils/footerUtils';
|
|
31
|
+
export { ScrollControllerProvider, useScrollController, useScrollPosition, useScrollPositionBlocker, } from './utils/scrollUtils';
|
|
32
|
+
export { useIsomorphicLayoutEffect, useDynamicCallback, usePrevious, ReactContextError, } from './utils/reactUtils';
|
|
33
|
+
export { isRegexpStringMatch } from './utils/regexpUtils';
|
|
34
|
+
export { useHomePageRoute, isSamePath } from './utils/routesUtils';
|
|
35
|
+
export { PageMetadata, HtmlClassNameProvider, PluginHtmlClassNameProvider, } from './utils/metadataUtils';
|
|
36
|
+
export { useColorMode, ColorModeProvider, type ColorMode, } from './contexts/colorMode';
|
|
37
|
+
export { splitNavbarItems, NavbarProvider } from './utils/navbarUtils';
|
|
38
|
+
export { useTabGroupChoice, TabGroupChoiceProvider, } from './contexts/tabGroupChoice';
|
|
39
|
+
export { useNavbarMobileSidebar } from './contexts/navbarMobileSidebar';
|
|
40
|
+
export { useNavbarSecondaryMenu, NavbarSecondaryMenuFiller, type NavbarSecondaryMenuComponent, } from './contexts/navbarSecondaryMenu';
|
|
41
|
+
export { useHideableNavbar } from './hooks/useHideableNavbar';
|
|
42
|
+
export { useKeyboardNavigation, keyboardFocusedClassName, } from './hooks/useKeyboardNavigation';
|
|
43
|
+
export { usePrismTheme } from './hooks/usePrismTheme';
|
|
44
|
+
export { useLockBodyScroll } from './hooks/useLockBodyScroll';
|
|
45
|
+
export { useWindowSize } from './hooks/useWindowSize';
|
|
46
|
+
export { useSearchPage } from './hooks/useSearchPage';
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,KAAK,UAAU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,gCAAgC,CAAC;AAExC,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"}
|
package/lib/index.js
CHANGED
|
@@ -4,16 +4,44 @@
|
|
|
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';
|
|
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';
|
|
8
11
|
export { createStorageSlot, listStorageKeys } from './utils/storageUtils';
|
|
9
12
|
export { useAlternatePageUtils } from './utils/useAlternatePageUtils';
|
|
10
|
-
export { parseCodeBlockTitle } from './utils/codeBlockUtils';
|
|
11
|
-
export { docVersionSearchTag, DEFAULT_SEARCH_TAG } from './utils/searchUtils';
|
|
12
|
-
export { isDocsPluginEnabled } from './utils/docsUtils';
|
|
13
|
-
export { isSamePath } from './utils/pathUtils';
|
|
13
|
+
export { parseCodeBlockTitle, parseLanguage, parseLines, } from './utils/codeBlockUtils';
|
|
14
|
+
export { docVersionSearchTag, DEFAULT_SEARCH_TAG, useContextualSearchFilters, } from './utils/searchUtils';
|
|
15
|
+
export { isDocsPluginEnabled, useDocById, findSidebarCategory, findFirstCategoryLink, useCurrentSidebarCategory, isActiveSidebarItem, useSidebarBreadcrumbs, } from './utils/docsUtils';
|
|
14
16
|
export { useTitleFormatter } from './utils/generalUtils';
|
|
15
17
|
export { usePluralForm } from './utils/usePluralForm';
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
18
|
+
export { useLocationChange } from './utils/useLocationChange';
|
|
19
|
+
export { useCollapsible, Collapsible } from './components/Collapsible';
|
|
20
|
+
export { Details } from './components/Details';
|
|
21
|
+
export { useDocsPreferredVersion, useDocsPreferredVersionByPluginId, DocsPreferredVersionContextProvider, } from './contexts/docsPreferredVersion';
|
|
22
|
+
export { duplicates, uniq } from './utils/jsUtils';
|
|
19
23
|
export { ThemeClassNames } from './utils/ThemeClassNames';
|
|
24
|
+
export { AnnouncementBarProvider, useAnnouncementBar, } from './contexts/announcementBar';
|
|
25
|
+
export { useLocalPathname } from './utils/useLocalPathname';
|
|
26
|
+
export { translateTagsPageTitle, listTagsByLetters, } from './utils/tagsUtils';
|
|
27
|
+
export { useHistoryPopHandler } from './utils/historyUtils';
|
|
28
|
+
export { useTOCHighlight, } from './hooks/useTOCHighlight';
|
|
29
|
+
export { useFilteredAndTreeifiedTOC, useTreeifiedTOC, } from './utils/tocUtils';
|
|
30
|
+
export { isMultiColumnFooterLinks } from './utils/footerUtils';
|
|
31
|
+
export { ScrollControllerProvider, useScrollController, useScrollPosition, useScrollPositionBlocker, } from './utils/scrollUtils';
|
|
32
|
+
export { useIsomorphicLayoutEffect, useDynamicCallback, usePrevious, ReactContextError, } from './utils/reactUtils';
|
|
33
|
+
export { isRegexpStringMatch } from './utils/regexpUtils';
|
|
34
|
+
export { useHomePageRoute, isSamePath } from './utils/routesUtils';
|
|
35
|
+
export { PageMetadata, HtmlClassNameProvider, PluginHtmlClassNameProvider, } from './utils/metadataUtils';
|
|
36
|
+
export { useColorMode, ColorModeProvider, } from './contexts/colorMode';
|
|
37
|
+
export { splitNavbarItems, NavbarProvider } from './utils/navbarUtils';
|
|
38
|
+
export { useTabGroupChoice, TabGroupChoiceProvider, } from './contexts/tabGroupChoice';
|
|
39
|
+
export { useNavbarMobileSidebar } from './contexts/navbarMobileSidebar';
|
|
40
|
+
export { useNavbarSecondaryMenu, NavbarSecondaryMenuFiller, } from './contexts/navbarSecondaryMenu';
|
|
41
|
+
export { useHideableNavbar } from './hooks/useHideableNavbar';
|
|
42
|
+
export { useKeyboardNavigation, keyboardFocusedClassName, } from './hooks/useKeyboardNavigation';
|
|
43
|
+
export { usePrismTheme } from './hooks/usePrismTheme';
|
|
44
|
+
export { useLockBodyScroll } from './hooks/useLockBodyScroll';
|
|
45
|
+
export { useWindowSize } from './hooks/useWindowSize';
|
|
46
|
+
export { useSearchPage } from './hooks/useSearchPage';
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
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,GACX,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB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,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,sBAAsB,EACtB,yBAAyB,GAE1B,MAAM,gCAAgC,CAAC;AAExC,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"}
|
|
@@ -4,19 +4,54 @@
|
|
|
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
|
-
page: {
|
|
9
|
-
blogListPage:
|
|
10
|
-
blogPostPage:
|
|
11
|
-
blogTagsListPage:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
readonly page: {
|
|
13
|
+
readonly blogListPage: "blog-list-page";
|
|
14
|
+
readonly blogPostPage: "blog-post-page";
|
|
15
|
+
readonly blogTagsListPage: "blog-tags-list-page";
|
|
16
|
+
readonly blogTagPostListPage: "blog-tags-post-list-page";
|
|
17
|
+
readonly docsDocPage: "docs-doc-page";
|
|
18
|
+
readonly docsTagsListPage: "docs-tags-list-page";
|
|
19
|
+
readonly docsTagDocListPage: "docs-tags-doc-list-page";
|
|
20
|
+
readonly mdxPage: "mdx-page";
|
|
21
|
+
};
|
|
22
|
+
readonly wrapper: {
|
|
23
|
+
readonly main: "main-wrapper";
|
|
24
|
+
readonly blogPages: "blog-wrapper";
|
|
25
|
+
readonly docsPages: "docs-wrapper";
|
|
26
|
+
readonly mdxPages: "mdx-wrapper";
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Follows the naming convention "theme-{blog,doc,version,page}?-<suffix>"
|
|
30
|
+
*/
|
|
31
|
+
readonly common: {
|
|
32
|
+
readonly editThisPage: "theme-edit-this-page";
|
|
33
|
+
readonly lastUpdated: "theme-last-updated";
|
|
34
|
+
readonly backToTopButton: "theme-back-to-top-button";
|
|
35
|
+
readonly codeBlock: "theme-code-block";
|
|
15
36
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
37
|
+
readonly layout: {};
|
|
38
|
+
readonly docs: {
|
|
39
|
+
readonly docVersionBanner: "theme-doc-version-banner";
|
|
40
|
+
readonly docVersionBadge: "theme-doc-version-badge";
|
|
41
|
+
readonly docBreadcrumbs: "theme-doc-breadcrumbs";
|
|
42
|
+
readonly docMarkdown: "theme-doc-markdown";
|
|
43
|
+
readonly docTocMobile: "theme-doc-toc-mobile";
|
|
44
|
+
readonly docTocDesktop: "theme-doc-toc-desktop";
|
|
45
|
+
readonly docFooter: "theme-doc-footer";
|
|
46
|
+
readonly docFooterTagsRow: "theme-doc-footer-tags-row";
|
|
47
|
+
readonly docFooterEditMetaRow: "theme-doc-footer-edit-meta-row";
|
|
48
|
+
readonly docSidebarContainer: "theme-doc-sidebar-container";
|
|
49
|
+
readonly docSidebarMenu: "theme-doc-sidebar-menu";
|
|
50
|
+
readonly docSidebarItemCategory: "theme-doc-sidebar-item-category";
|
|
51
|
+
readonly docSidebarItemLink: "theme-doc-sidebar-item-link";
|
|
52
|
+
readonly docSidebarItemCategoryLevel: (level: number) => `theme-doc-sidebar-item-category-level-${number}`;
|
|
53
|
+
readonly docSidebarItemLinkLevel: (level: number) => `theme-doc-sidebar-item-link-level-${number}`;
|
|
21
54
|
};
|
|
55
|
+
readonly blog: {};
|
|
22
56
|
};
|
|
57
|
+
//# sourceMappingURL=ThemeClassNames.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,20 +4,61 @@
|
|
|
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
|
-
//
|
|
7
|
+
// Please do not modify the classnames! This is a breaking change, and annoying
|
|
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
|
+
*/
|
|
8
13
|
export const ThemeClassNames = {
|
|
9
14
|
page: {
|
|
10
15
|
blogListPage: 'blog-list-page',
|
|
11
16
|
blogPostPage: 'blog-post-page',
|
|
12
17
|
blogTagsListPage: 'blog-tags-list-page',
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
blogTagPostListPage: 'blog-tags-post-list-page',
|
|
19
|
+
docsDocPage: 'docs-doc-page',
|
|
20
|
+
docsTagsListPage: 'docs-tags-list-page',
|
|
21
|
+
docsTagDocListPage: 'docs-tags-doc-list-page',
|
|
15
22
|
mdxPage: 'mdx-page',
|
|
16
23
|
},
|
|
17
24
|
wrapper: {
|
|
18
25
|
main: 'main-wrapper',
|
|
19
26
|
blogPages: 'blog-wrapper',
|
|
20
|
-
|
|
27
|
+
docsPages: 'docs-wrapper',
|
|
21
28
|
mdxPages: 'mdx-wrapper',
|
|
22
29
|
},
|
|
30
|
+
/**
|
|
31
|
+
* Follows the naming convention "theme-{blog,doc,version,page}?-<suffix>"
|
|
32
|
+
*/
|
|
33
|
+
common: {
|
|
34
|
+
editThisPage: 'theme-edit-this-page',
|
|
35
|
+
lastUpdated: 'theme-last-updated',
|
|
36
|
+
backToTopButton: 'theme-back-to-top-button',
|
|
37
|
+
codeBlock: 'theme-code-block',
|
|
38
|
+
},
|
|
39
|
+
layout: {
|
|
40
|
+
// TODO add other stable classNames here
|
|
41
|
+
},
|
|
42
|
+
docs: {
|
|
43
|
+
docVersionBanner: 'theme-doc-version-banner',
|
|
44
|
+
docVersionBadge: 'theme-doc-version-badge',
|
|
45
|
+
docBreadcrumbs: 'theme-doc-breadcrumbs',
|
|
46
|
+
docMarkdown: 'theme-doc-markdown',
|
|
47
|
+
docTocMobile: 'theme-doc-toc-mobile',
|
|
48
|
+
docTocDesktop: 'theme-doc-toc-desktop',
|
|
49
|
+
docFooter: 'theme-doc-footer',
|
|
50
|
+
docFooterTagsRow: 'theme-doc-footer-tags-row',
|
|
51
|
+
docFooterEditMetaRow: 'theme-doc-footer-edit-meta-row',
|
|
52
|
+
docSidebarContainer: 'theme-doc-sidebar-container',
|
|
53
|
+
docSidebarMenu: 'theme-doc-sidebar-menu',
|
|
54
|
+
docSidebarItemCategory: 'theme-doc-sidebar-item-category',
|
|
55
|
+
docSidebarItemLink: 'theme-doc-sidebar-item-link',
|
|
56
|
+
docSidebarItemCategoryLevel: (level) => `theme-doc-sidebar-item-category-level-${level}`,
|
|
57
|
+
docSidebarItemLinkLevel: (level) => `theme-doc-sidebar-item-link-level-${level}`,
|
|
58
|
+
// TODO add other stable classNames here
|
|
59
|
+
},
|
|
60
|
+
blog: {
|
|
61
|
+
// TODO add other stable classNames here
|
|
62
|
+
},
|
|
23
63
|
};
|
|
64
|
+
//# sourceMappingURL=ThemeClassNames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -5,3 +5,36 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
export declare function parseCodeBlockTitle(metastring?: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Gets the language name from the class name (set by MDX).
|
|
10
|
+
* e.g. `"language-javascript"` => `"javascript"`.
|
|
11
|
+
* Returns undefined if there is no language class name.
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseLanguage(className: string): string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Parses the code content, strips away any magic comments, and returns the
|
|
16
|
+
* clean content and the highlighted lines marked by the comments or metastring.
|
|
17
|
+
*
|
|
18
|
+
* If the metastring contains highlight range, the `content` will be returned
|
|
19
|
+
* as-is without any parsing.
|
|
20
|
+
*
|
|
21
|
+
* @param content The raw code with magic comments. Trailing newline will be
|
|
22
|
+
* trimmed upfront.
|
|
23
|
+
* @param metastring The full metastring, as received from MDX. Highlight range
|
|
24
|
+
* declared here starts at 1.
|
|
25
|
+
* @param language Language of the code block, used to determine which kinds of
|
|
26
|
+
* magic comment styles to enable.
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseLines(content: string, metastring?: string, language?: string): {
|
|
29
|
+
/**
|
|
30
|
+
* The highlighted lines, 0-indexed. e.g. `[0, 1, 4]` means the 1st, 2nd, and
|
|
31
|
+
* 5th lines are highlighted.
|
|
32
|
+
*/
|
|
33
|
+
highlightLines: number[];
|
|
34
|
+
/**
|
|
35
|
+
* The clean code without any magic comments (only if highlight range isn't
|
|
36
|
+
* present in the metastring).
|
|
37
|
+
*/
|
|
38
|
+
code: string;
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=codeBlockUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeBlockUtils.d.ts","sourceRoot":"","sources":["../../src/utils/codeBlockUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgEH,wBAAgB,mBAAmB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKnE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB;IACD;;;OAGG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;CACd,CAkDA"}
|
|
@@ -4,8 +4,131 @@
|
|
|
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
|
-
|
|
7
|
+
import rangeParser from 'parse-numeric-range';
|
|
8
|
+
const codeBlockTitleRegex = /title=(?<quote>["'])(?<title>.*?)\1/;
|
|
9
|
+
const highlightLinesRangeRegex = /\{(?<range>[\d,-]+)\}/;
|
|
10
|
+
// Supported types of highlight comments
|
|
11
|
+
const commentPatterns = {
|
|
12
|
+
js: { start: '\\/\\/', end: '' },
|
|
13
|
+
jsBlock: { start: '\\/\\*', end: '\\*\\/' },
|
|
14
|
+
jsx: { start: '\\{\\s*\\/\\*', end: '\\*\\/\\s*\\}' },
|
|
15
|
+
python: { start: '#', end: '' },
|
|
16
|
+
html: { start: '<!--', end: '-->' },
|
|
17
|
+
};
|
|
18
|
+
const magicCommentDirectives = [
|
|
19
|
+
'highlight-next-line',
|
|
20
|
+
'highlight-start',
|
|
21
|
+
'highlight-end',
|
|
22
|
+
];
|
|
23
|
+
function getCommentPattern(languages) {
|
|
24
|
+
// to be more reliable, the opening and closing comment must match
|
|
25
|
+
const commentPattern = languages
|
|
26
|
+
.map((lang) => {
|
|
27
|
+
const { start, end } = commentPatterns[lang];
|
|
28
|
+
return `(?:${start}\\s*(${magicCommentDirectives.join('|')})\\s*${end})`;
|
|
29
|
+
})
|
|
30
|
+
.join('|');
|
|
31
|
+
// white space is allowed, but otherwise it should be on it's own line
|
|
32
|
+
return new RegExp(`^\\s*(?:${commentPattern})\\s*$`);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Select comment styles based on language
|
|
36
|
+
*/
|
|
37
|
+
function getAllMagicCommentDirectiveStyles(lang) {
|
|
38
|
+
switch (lang) {
|
|
39
|
+
case 'js':
|
|
40
|
+
case 'javascript':
|
|
41
|
+
case 'ts':
|
|
42
|
+
case 'typescript':
|
|
43
|
+
return getCommentPattern(['js', 'jsBlock']);
|
|
44
|
+
case 'jsx':
|
|
45
|
+
case 'tsx':
|
|
46
|
+
return getCommentPattern(['js', 'jsBlock', 'jsx']);
|
|
47
|
+
case 'html':
|
|
48
|
+
return getCommentPattern(['js', 'jsBlock', 'html']);
|
|
49
|
+
case 'python':
|
|
50
|
+
case 'py':
|
|
51
|
+
return getCommentPattern(['python']);
|
|
52
|
+
default:
|
|
53
|
+
// all comment types
|
|
54
|
+
return getCommentPattern(Object.keys(commentPatterns));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
8
57
|
export function parseCodeBlockTitle(metastring) {
|
|
9
|
-
|
|
10
|
-
|
|
58
|
+
return metastring?.match(codeBlockTitleRegex)?.groups.title ?? '';
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Gets the language name from the class name (set by MDX).
|
|
62
|
+
* e.g. `"language-javascript"` => `"javascript"`.
|
|
63
|
+
* Returns undefined if there is no language class name.
|
|
64
|
+
*/
|
|
65
|
+
export function parseLanguage(className) {
|
|
66
|
+
const languageClassName = className
|
|
67
|
+
.split(' ')
|
|
68
|
+
.find((str) => str.startsWith('language-'));
|
|
69
|
+
return languageClassName?.replace(/language-/, '');
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Parses the code content, strips away any magic comments, and returns the
|
|
73
|
+
* clean content and the highlighted lines marked by the comments or metastring.
|
|
74
|
+
*
|
|
75
|
+
* If the metastring contains highlight range, the `content` will be returned
|
|
76
|
+
* as-is without any parsing.
|
|
77
|
+
*
|
|
78
|
+
* @param content The raw code with magic comments. Trailing newline will be
|
|
79
|
+
* trimmed upfront.
|
|
80
|
+
* @param metastring The full metastring, as received from MDX. Highlight range
|
|
81
|
+
* declared here starts at 1.
|
|
82
|
+
* @param language Language of the code block, used to determine which kinds of
|
|
83
|
+
* magic comment styles to enable.
|
|
84
|
+
*/
|
|
85
|
+
export function parseLines(content, metastring, language) {
|
|
86
|
+
let code = content.replace(/\n$/, '');
|
|
87
|
+
// Highlighted lines specified in props: don't parse the content
|
|
88
|
+
if (metastring && highlightLinesRangeRegex.test(metastring)) {
|
|
89
|
+
const highlightLinesRange = metastring.match(highlightLinesRangeRegex)
|
|
90
|
+
.groups.range;
|
|
91
|
+
const highlightLines = rangeParser(highlightLinesRange)
|
|
92
|
+
.filter((n) => n > 0)
|
|
93
|
+
.map((n) => n - 1);
|
|
94
|
+
return { highlightLines, code };
|
|
95
|
+
}
|
|
96
|
+
if (language === undefined) {
|
|
97
|
+
return { highlightLines: [], code };
|
|
98
|
+
}
|
|
99
|
+
const directiveRegex = getAllMagicCommentDirectiveStyles(language);
|
|
100
|
+
// go through line by line
|
|
101
|
+
const lines = code.split('\n');
|
|
102
|
+
let highlightBlockStart;
|
|
103
|
+
let highlightRange = '';
|
|
104
|
+
// loop through lines
|
|
105
|
+
for (let lineNumber = 0; lineNumber < lines.length;) {
|
|
106
|
+
const line = lines[lineNumber];
|
|
107
|
+
const match = line.match(directiveRegex);
|
|
108
|
+
if (match !== null) {
|
|
109
|
+
const directive = match.slice(1).find((item) => item !== undefined);
|
|
110
|
+
switch (directive) {
|
|
111
|
+
case 'highlight-next-line':
|
|
112
|
+
highlightRange += `${lineNumber},`;
|
|
113
|
+
break;
|
|
114
|
+
case 'highlight-start':
|
|
115
|
+
highlightBlockStart = lineNumber;
|
|
116
|
+
break;
|
|
117
|
+
case 'highlight-end':
|
|
118
|
+
highlightRange += `${highlightBlockStart}-${lineNumber - 1},`;
|
|
119
|
+
break;
|
|
120
|
+
default:
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
lines.splice(lineNumber, 1);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
// lines without directives are unchanged
|
|
127
|
+
lineNumber += 1;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const highlightLines = rangeParser(highlightRange);
|
|
131
|
+
code = lines.join('\n');
|
|
132
|
+
return { highlightLines, code };
|
|
11
133
|
}
|
|
134
|
+
//# sourceMappingURL=codeBlockUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeBlockUtils.js","sourceRoot":"","sources":["../../src/utils/codeBlockUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAE9C,MAAM,mBAAmB,GAAG,qCAAqC,CAAC;AAClE,MAAM,wBAAwB,GAAG,uBAAuB,CAAC;AAEzD,wCAAwC;AACxC,MAAM,eAAe,GAAG;IACtB,EAAE,EAAE,EAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,EAAC;IAC9B,OAAO,EAAE,EAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAC;IACzC,GAAG,EAAE,EAAC,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,eAAe,EAAC;IACnD,MAAM,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAC;IAC7B,IAAI,E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M,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,mBAA2B,CAAC;IAChC,IAAI,cAAc,GAAG,EAAE,CAAC;IACxB,qBAAqB;IACrB,KAAK,IAAI,UAAU,GAAG,CAAC,EAAE,UAAU,GAAG,KAAK,CAAC,MAAM,GAAI;QACpD,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAE,CAAC;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACzC,IAAI,KAAK,KAAK,IAAI,EAAE;YAClB,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;YACpE,QAAQ,SAAS,EAAE;gBACjB,KAAK,qBAAqB;oBACxB,cAAc,IAAI,GAAG,UAAU,GAAG,CAAC;oBACnC,MAAM;gBAER,KAAK,iBAAiB;oBACpB,mBAAmB,GAAG,UAAU,CAAC;oBACjC,MAAM;gBAER,KAAK,eAAe;oBAClB,cAAc,IAAI,GAAG,mBAAoB,IAAI,UAAU,GAAG,CAAC,GAAG,CAAC;oBAC/D,MAAM;gBAER;oBACE,MAAM;aACT;YACD,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;SAC7B;aAAM;YACL,yCAAyC;YACzC,UAAU,IAAI,CAAC,CAAC;SACjB;KACF;IACD,MAAM,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC,CAAC;IACnD,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,OAAO,EAAC,cAAc,EAAE,IAAI,EAAC,CAAC;AAChC,CAAC"}
|
package/lib/utils/docsUtils.d.ts
CHANGED
|
@@ -4,4 +4,37 @@
|
|
|
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 { PropSidebar, PropSidebarItem, PropSidebarItemCategory, PropVersionDoc, PropSidebarBreadcrumbsItem } from '@docusaurus/plugin-content-docs';
|
|
7
8
|
export declare const isDocsPluginEnabled: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* A null-safe way to access a doc's data by ID in the active version.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useDocById(id: string): PropVersionDoc;
|
|
13
|
+
/**
|
|
14
|
+
* A null-safe way to access a doc's data by ID in the active version.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useDocById(id: string | undefined): PropVersionDoc | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Pure function, similar to `Array#find`, but works on the sidebar tree.
|
|
19
|
+
*/
|
|
20
|
+
export declare function findSidebarCategory(sidebar: PropSidebar, predicate: (category: PropSidebarItemCategory) => boolean): PropSidebarItemCategory | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Best effort to assign a link to a sidebar category. If the category doesn't
|
|
23
|
+
* have a link itself, we link to the first sub item with a link.
|
|
24
|
+
*/
|
|
25
|
+
export declare function findFirstCategoryLink(item: PropSidebarItemCategory): string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Gets the category associated with the current location. Should only be used
|
|
28
|
+
* on category index pages.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useCurrentSidebarCategory(): PropSidebarItemCategory;
|
|
31
|
+
/**
|
|
32
|
+
* Checks if a sidebar item should be active, based on the active path.
|
|
33
|
+
*/
|
|
34
|
+
export declare function isActiveSidebarItem(item: PropSidebarItem, activePath: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Gets the breadcrumbs of the current doc page, based on its sidebar location.
|
|
37
|
+
* Returns `null` if there's no sidebar or breadcrumbs are disabled.
|
|
38
|
+
*/
|
|
39
|
+
export declare function useSidebarBreadcrumbs(): PropSidebarBreadcrumbsItem[] | null;
|
|
40
|
+
//# sourceMappingURL=docsUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docsUtils.d.ts","sourceRoot":"","sources":["../../src/utils/docsUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,uBAAuB,EACvB,cAAc,EACd,0BAA0B,EAC3B,MAAM,iCAAiC,CAAC;AAOzC,eAAO,MAAM,mBAAmB,EAAE,OAA0B,CAAC;AAE7D;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,CAAC;AACvD;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,CAAC;AAa/E;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,CAAC,QAAQ,EAAE,uBAAuB,KAAK,OAAO,GACxD,uBAAuB,GAAG,SAAS,CAarC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,uBAAuB,GAC5B,MAAM,GAAG,SAAS,CAsBpB;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,uBAAuB,CAenE;AASD;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,eAAe,EACrB,UAAU,EAAE,MAAM,GACjB,OAAO,CAaT;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,0BAA0B,EAAE,GAAG,IAAI,CA6B3E"}
|