@docusaurus/theme-common 2.0.0-beta.15d451942 → 2.0.0-beta.16
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 +36 -0
- package/lib/components/Collapsible/index.d.ts.map +1 -0
- package/lib/components/Collapsible/index.js +144 -0
- package/lib/components/Collapsible/index.js.map +1 -0
- package/lib/components/Details/index.d.ts +12 -0
- package/lib/components/Details/index.d.ts.map +1 -0
- package/lib/components/Details/index.js +66 -0
- package/lib/components/Details/index.js.map +1 -0
- package/lib/components/Details/styles.module.css +58 -0
- package/lib/{utils/useChangeRoute.d.ts → hooks/styles.css} +4 -1
- package/lib/hooks/useHideableNavbar.d.ts +13 -0
- package/lib/hooks/useHideableNavbar.d.ts.map +1 -0
- package/lib/hooks/useHideableNavbar.js +59 -0
- package/lib/hooks/useHideableNavbar.js.map +1 -0
- package/lib/hooks/useKeyboardNavigation.d.ts +10 -0
- package/lib/hooks/useKeyboardNavigation.d.ts.map +1 -0
- package/lib/hooks/useKeyboardNavigation.js +31 -0
- package/lib/hooks/useKeyboardNavigation.js.map +1 -0
- package/{src/utils/docsUtils.ts → lib/hooks/useLockBodyScroll.d.ts} +2 -5
- package/lib/hooks/useLockBodyScroll.d.ts.map +1 -0
- package/lib/hooks/useLockBodyScroll.js +16 -0
- package/lib/hooks/useLockBodyScroll.js.map +1 -0
- package/lib/hooks/usePrismTheme.d.ts +9 -0
- package/lib/hooks/usePrismTheme.d.ts.map +1 -0
- package/lib/hooks/usePrismTheme.js +18 -0
- package/lib/hooks/usePrismTheme.js.map +1 -0
- package/lib/hooks/useSearchPage.d.ts +14 -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/useWindowSize.d.ts +15 -0
- package/lib/hooks/useWindowSize.d.ts.map +1 -0
- package/lib/hooks/useWindowSize.js +56 -0
- package/lib/hooks/useWindowSize.js.map +1 -0
- package/lib/index.d.ts +35 -4
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +29 -3
- package/lib/index.js.map +1 -0
- package/lib/utils/ThemeClassNames.d.ts +40 -12
- package/lib/utils/ThemeClassNames.d.ts.map +1 -0
- package/lib/utils/ThemeClassNames.js +41 -3
- package/lib/utils/ThemeClassNames.js.map +1 -0
- package/lib/utils/announcementBarUtils.d.ts +18 -0
- package/lib/utils/announcementBarUtils.d.ts.map +1 -0
- package/lib/utils/announcementBarUtils.js +71 -0
- package/lib/utils/announcementBarUtils.js.map +1 -0
- package/lib/utils/codeBlockUtils.d.ts +10 -0
- package/lib/utils/codeBlockUtils.d.ts.map +1 -0
- package/lib/utils/codeBlockUtils.js +125 -2
- package/lib/utils/codeBlockUtils.js.map +1 -0
- package/lib/utils/colorModeUtils.d.ts +18 -0
- package/lib/utils/colorModeUtils.d.ts.map +1 -0
- package/lib/utils/colorModeUtils.js +106 -0
- package/lib/utils/colorModeUtils.js.map +1 -0
- package/lib/utils/docSidebarItemsExpandedState.d.ts +17 -0
- package/lib/utils/docSidebarItemsExpandedState.d.ts.map +1 -0
- package/lib/utils/docSidebarItemsExpandedState.js +22 -0
- package/lib/utils/docSidebarItemsExpandedState.js.map +1 -0
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.d.ts +3 -2
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.d.ts.map +1 -0
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.js +8 -11
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.js.map +1 -0
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.d.ts +2 -1
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.d.ts.map +1 -0
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.js +2 -3
- package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.js.map +1 -0
- package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.d.ts +12 -3
- package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.d.ts.map +1 -0
- package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.js +3 -3
- package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.js.map +1 -0
- package/lib/utils/docsUtils.d.ts +26 -0
- package/lib/utils/docsUtils.d.ts.map +1 -0
- package/lib/utils/docsUtils.js +136 -1
- package/lib/utils/docsUtils.js.map +1 -0
- package/lib/utils/generalUtils.d.ts +7 -0
- package/lib/utils/generalUtils.d.ts.map +1 -0
- package/lib/utils/generalUtils.js +3 -2
- package/lib/utils/generalUtils.js.map +1 -0
- package/lib/utils/historyUtils.d.ts +23 -0
- package/lib/utils/historyUtils.d.ts.map +1 -0
- package/lib/utils/historyUtils.js +41 -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/mobileSecondaryMenu.d.ts +21 -0
- package/lib/utils/mobileSecondaryMenu.d.ts.map +1 -0
- package/lib/utils/mobileSecondaryMenu.js +50 -0
- package/lib/utils/mobileSecondaryMenu.js.map +1 -0
- package/lib/utils/pathUtils.d.ts +1 -0
- package/lib/utils/pathUtils.d.ts.map +1 -0
- package/lib/utils/pathUtils.js +6 -2
- package/lib/utils/pathUtils.js.map +1 -0
- package/lib/utils/reactUtils.d.ts +28 -0
- package/lib/utils/reactUtils.d.ts.map +1 -0
- package/lib/utils/reactUtils.js +36 -0
- package/lib/utils/reactUtils.js.map +1 -0
- package/lib/utils/regexpUtils.d.ts +11 -0
- package/lib/utils/regexpUtils.d.ts.map +1 -0
- package/lib/utils/regexpUtils.js +17 -0
- package/lib/utils/regexpUtils.js.map +1 -0
- package/lib/utils/routesUtils.d.ts +11 -0
- package/lib/utils/routesUtils.d.ts.map +1 -0
- package/lib/utils/routesUtils.js +33 -0
- package/lib/utils/routesUtils.js.map +1 -0
- package/lib/utils/scrollUtils.d.ts +53 -0
- package/lib/utils/scrollUtils.d.ts.map +1 -0
- package/lib/utils/scrollUtils.js +136 -0
- package/lib/utils/scrollUtils.js.map +1 -0
- package/lib/utils/searchUtils.d.ts +1 -0
- package/lib/utils/searchUtils.d.ts.map +1 -0
- package/lib/utils/searchUtils.js +1 -0
- package/lib/utils/searchUtils.js.map +1 -0
- package/lib/utils/storageUtils.d.ts +5 -0
- package/lib/utils/storageUtils.d.ts.map +1 -0
- package/lib/utils/storageUtils.js +41 -16
- package/lib/utils/storageUtils.js.map +1 -0
- package/lib/utils/tabGroupChoiceUtils.d.ts +19 -0
- package/lib/utils/tabGroupChoiceUtils.d.ts.map +1 -0
- package/lib/utils/tabGroupChoiceUtils.js +54 -0
- package/lib/utils/tabGroupChoiceUtils.js.map +1 -0
- package/lib/utils/tagsUtils.d.ts +19 -0
- package/lib/utils/tagsUtils.d.ts.map +1 -0
- package/lib/utils/tagsUtils.js +34 -0
- package/lib/utils/tagsUtils.js.map +1 -0
- package/lib/utils/tocUtils.d.ts +20 -0
- package/lib/utils/tocUtils.d.ts.map +1 -0
- package/lib/utils/tocUtils.js +73 -0
- package/lib/utils/tocUtils.js.map +1 -0
- package/lib/utils/useAlternatePageUtils.d.ts +1 -0
- package/lib/utils/useAlternatePageUtils.d.ts.map +1 -0
- package/lib/utils/useAlternatePageUtils.js +3 -1
- package/lib/utils/useAlternatePageUtils.js.map +1 -0
- package/lib/utils/useContextualSearchFilters.d.ts +12 -0
- package/lib/utils/useContextualSearchFilters.d.ts.map +1 -0
- package/lib/utils/useContextualSearchFilters.js +37 -0
- package/lib/utils/useContextualSearchFilters.js.map +1 -0
- package/lib/utils/useLocalPathname.d.ts +8 -0
- package/lib/utils/useLocalPathname.d.ts.map +1 -0
- package/lib/utils/useLocalPathname.js +17 -0
- package/lib/utils/useLocalPathname.js.map +1 -0
- package/lib/utils/useLocationChange.d.ts +15 -0
- package/lib/utils/useLocationChange.d.ts.map +1 -0
- package/lib/utils/useLocationChange.js +27 -0
- package/lib/utils/useLocationChange.js.map +1 -0
- package/lib/utils/usePluralForm.d.ts +1 -0
- package/lib/utils/usePluralForm.d.ts.map +1 -0
- package/lib/utils/usePluralForm.js +29 -25
- package/lib/utils/usePluralForm.js.map +1 -0
- package/lib/utils/usePrevious.d.ts +8 -0
- package/lib/utils/usePrevious.d.ts.map +1 -0
- package/lib/utils/usePrevious.js +16 -0
- package/lib/utils/usePrevious.js.map +1 -0
- package/lib/utils/useTOCHighlight.d.ts +14 -0
- package/lib/utils/useTOCHighlight.d.ts.map +1 -0
- package/lib/utils/useTOCHighlight.js +128 -0
- package/lib/utils/useTOCHighlight.js.map +1 -0
- package/lib/utils/useThemeConfig.d.ts +36 -11
- package/lib/utils/useThemeConfig.d.ts.map +1 -0
- package/lib/utils/useThemeConfig.js +1 -0
- package/lib/utils/useThemeConfig.js.map +1 -0
- package/package.json +19 -13
- package/src/components/Collapsible/index.tsx +247 -0
- package/src/components/Details/index.tsx +102 -0
- package/src/components/Details/styles.module.css +58 -0
- package/src/hooks/styles.css +10 -0
- package/src/hooks/useHideableNavbar.ts +77 -0
- package/src/hooks/useKeyboardNavigation.ts +37 -0
- package/src/hooks/useLockBodyScroll.ts +18 -0
- package/src/hooks/usePrismTheme.ts +20 -0
- package/src/hooks/useSearchPage.ts +66 -0
- package/src/hooks/useWindowSize.ts +70 -0
- package/src/index.ts +102 -4
- package/src/types.d.ts +0 -2
- package/src/utils/ThemeClassNames.ts +46 -4
- package/src/utils/announcementBarUtils.tsx +121 -0
- package/src/utils/codeBlockUtils.ts +153 -2
- package/src/utils/colorModeUtils.tsx +156 -0
- package/src/utils/docSidebarItemsExpandedState.tsx +41 -0
- package/src/utils/docsPreferredVersion/DocsPreferredVersionProvider.tsx +16 -14
- package/src/utils/docsPreferredVersion/DocsPreferredVersionStorage.ts +3 -4
- package/src/utils/docsPreferredVersion/useDocsPreferredVersion.ts +18 -14
- package/src/utils/docsUtils.tsx +230 -0
- package/src/utils/generalUtils.ts +3 -2
- package/src/utils/historyUtils.ts +51 -0
- package/src/utils/jsUtils.ts +36 -0
- package/src/utils/mobileSecondaryMenu.tsx +115 -0
- package/src/utils/pathUtils.ts +6 -4
- package/src/utils/reactUtils.tsx +43 -0
- package/src/utils/regexpUtils.ts +23 -0
- package/src/utils/routesUtils.ts +39 -0
- package/src/utils/scrollUtils.tsx +237 -0
- package/src/utils/storageUtils.ts +40 -15
- package/src/utils/tabGroupChoiceUtils.tsx +90 -0
- package/src/utils/tagsUtils.ts +48 -0
- package/src/utils/tocUtils.ts +108 -0
- package/src/utils/useAlternatePageUtils.ts +13 -4
- package/src/utils/useContextualSearchFilters.ts +53 -0
- package/src/utils/useLocalPathname.ts +20 -0
- package/src/utils/useLocationChange.ts +39 -0
- package/src/utils/usePluralForm.ts +35 -28
- package/src/utils/usePrevious.ts +19 -0
- package/src/utils/useTOCHighlight.ts +183 -0
- package/src/utils/useThemeConfig.ts +38 -11
- package/lib/.tsbuildinfo +0 -4159
- 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/useChangeRoute.ts +0 -21
- package/tsconfig.json +0 -10
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
declare const windowSizes: {
|
|
8
|
+
readonly desktop: "desktop";
|
|
9
|
+
readonly mobile: "mobile";
|
|
10
|
+
readonly ssr: "ssr";
|
|
11
|
+
};
|
|
12
|
+
declare type WindowSize = keyof typeof windowSizes;
|
|
13
|
+
export default function useWindowSize(): WindowSize;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=useWindowSize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWindowSize.d.ts","sourceRoot":"","sources":["../../src/hooks/useWindowSize.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,QAAA,MAAM,WAAW;;;;CAUP,CAAC;AAEX,aAAK,UAAU,GAAG,MAAM,OAAO,WAAW,CAAC;AAoB3C,MAAM,CAAC,OAAO,UAAU,aAAa,IAAI,UAAU,CA0BlD"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
// 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
|
+
ssr: 'ssr',
|
|
18
|
+
};
|
|
19
|
+
const DesktopThresholdWidth = 996;
|
|
20
|
+
function getWindowSize() {
|
|
21
|
+
if (!ExecutionEnvironment.canUseDOM) {
|
|
22
|
+
return windowSizes.ssr;
|
|
23
|
+
}
|
|
24
|
+
return window.innerWidth > DesktopThresholdWidth
|
|
25
|
+
? windowSizes.desktop
|
|
26
|
+
: windowSizes.mobile;
|
|
27
|
+
}
|
|
28
|
+
// Simulate the SSR window size in dev, so that potential hydration FOUC/layout
|
|
29
|
+
// shift problems can be seen in dev too!
|
|
30
|
+
const DevSimulateSSR = process.env.NODE_ENV === 'development' && true;
|
|
31
|
+
// This hook returns an enum value on purpose!
|
|
32
|
+
// We don't want it to return the actual width value, for resize perf reasons
|
|
33
|
+
// We only want to re-render once a breakpoint is crossed
|
|
34
|
+
export default function useWindowSize() {
|
|
35
|
+
const [windowSize, setWindowSize] = useState(() => {
|
|
36
|
+
if (DevSimulateSSR) {
|
|
37
|
+
return 'ssr';
|
|
38
|
+
}
|
|
39
|
+
return getWindowSize();
|
|
40
|
+
});
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
function updateWindowSize() {
|
|
43
|
+
setWindowSize(getWindowSize());
|
|
44
|
+
}
|
|
45
|
+
const timeout = DevSimulateSSR
|
|
46
|
+
? window.setTimeout(updateWindowSize, 1000)
|
|
47
|
+
: undefined;
|
|
48
|
+
window.addEventListener('resize', updateWindowSize);
|
|
49
|
+
return () => {
|
|
50
|
+
window.removeEventListener('resize', updateWindowSize);
|
|
51
|
+
clearTimeout(timeout);
|
|
52
|
+
};
|
|
53
|
+
}, []);
|
|
54
|
+
return windowSize;
|
|
55
|
+
}
|
|
56
|
+
//# 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;IAEhB,8EAA8E;IAC9E,kEAAkE;IAClE,8EAA8E;IAC9E,oCAAoC;IACpC,mEAAmE;IACnE,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,+EAA+E;AAC/E,yCAAyC;AACzC,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,IAAI,IAAI,CAAC;AAEtE,8CAA8C;AAC9C,6EAA6E;AAC7E,yDAAyD;AACzD,MAAM,CAAC,OAAO,UAAU,aAAa;IACnC,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
|
@@ -5,16 +5,47 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
export { useThemeConfig } from './utils/useThemeConfig';
|
|
8
|
-
export
|
|
8
|
+
export { DocSidebarItemsExpandedStateProvider, useDocSidebarItemsExpandedState, } from './utils/docSidebarItemsExpandedState';
|
|
9
|
+
export type { ThemeConfig, UserThemeConfig, Navbar, NavbarItem, NavbarLogo, MultiColumnFooter, SimpleFooter, Footer, FooterLinkItem, ColorModeConfig, } from './utils/useThemeConfig';
|
|
9
10
|
export { createStorageSlot, listStorageKeys } from './utils/storageUtils';
|
|
10
11
|
export { useAlternatePageUtils } from './utils/useAlternatePageUtils';
|
|
11
|
-
export {
|
|
12
|
+
export { useContextualSearchFilters } from './utils/useContextualSearchFilters';
|
|
13
|
+
export { parseCodeBlockTitle, parseLanguage, parseLines, } from './utils/codeBlockUtils';
|
|
12
14
|
export { docVersionSearchTag, DEFAULT_SEARCH_TAG } from './utils/searchUtils';
|
|
13
|
-
export { isDocsPluginEnabled } from './utils/docsUtils';
|
|
15
|
+
export { isDocsPluginEnabled, DocsVersionProvider, useDocsVersion, useDocById, DocsSidebarProvider, useDocsSidebar, findSidebarCategory, findFirstCategoryLink, useCurrentSidebarCategory, isActiveSidebarItem, useSidebarBreadcrumbs, } from './utils/docsUtils';
|
|
14
16
|
export { isSamePath } from './utils/pathUtils';
|
|
15
17
|
export { useTitleFormatter } from './utils/generalUtils';
|
|
16
18
|
export { usePluralForm } from './utils/usePluralForm';
|
|
17
|
-
export {
|
|
19
|
+
export { useLocationChange } from './utils/useLocationChange';
|
|
20
|
+
export { usePrevious } from './utils/usePrevious';
|
|
21
|
+
export { useCollapsible, Collapsible } from './components/Collapsible';
|
|
22
|
+
export type { UseCollapsibleConfig, UseCollapsibleReturns, } from './components/Collapsible';
|
|
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';
|
|
18
27
|
export { useDocsPreferredVersion, useDocsPreferredVersionByPluginId, } from './utils/docsPreferredVersion/useDocsPreferredVersion';
|
|
28
|
+
export { duplicates, uniq } from './utils/jsUtils';
|
|
19
29
|
export { DocsPreferredVersionContextProvider } from './utils/docsPreferredVersion/DocsPreferredVersionProvider';
|
|
20
30
|
export { ThemeClassNames } from './utils/ThemeClassNames';
|
|
31
|
+
export { AnnouncementBarProvider, useAnnouncementBar, } from './utils/announcementBarUtils';
|
|
32
|
+
export { useLocalPathname } from './utils/useLocalPathname';
|
|
33
|
+
export { translateTagsPageTitle, listTagsByLetters } from './utils/tagsUtils';
|
|
34
|
+
export type { TagLetterEntry } from './utils/tagsUtils';
|
|
35
|
+
export { useHistoryPopHandler } from './utils/historyUtils';
|
|
36
|
+
export { default as useTOCHighlight } from './utils/useTOCHighlight';
|
|
37
|
+
export type { TOCHighlightConfig } from './utils/useTOCHighlight';
|
|
38
|
+
export { useFilteredAndTreeifiedTOC, useTreeifiedTOC, type TOCTreeNode, } from './utils/tocUtils';
|
|
39
|
+
export { ScrollControllerProvider, useScrollController, useScrollPosition, useScrollPositionBlocker, } from './utils/scrollUtils';
|
|
40
|
+
export { useIsomorphicLayoutEffect, useDynamicCallback, } from './utils/reactUtils';
|
|
41
|
+
export { isRegexpStringMatch } from './utils/regexpUtils';
|
|
42
|
+
export { useHomePageRoute } from './utils/routesUtils';
|
|
43
|
+
export { useColorMode, ColorModeProvider } from './utils/colorModeUtils';
|
|
44
|
+
export { useTabGroupChoice, TabGroupChoiceProvider, } from './utils/tabGroupChoiceUtils';
|
|
45
|
+
export { default as useHideableNavbar } from './hooks/useHideableNavbar';
|
|
46
|
+
export { default as useKeyboardNavigation, keyboardFocusedClassName, } from './hooks/useKeyboardNavigation';
|
|
47
|
+
export { default as usePrismTheme } from './hooks/usePrismTheme';
|
|
48
|
+
export { default as useLockBodyScroll } from './hooks/useLockBodyScroll';
|
|
49
|
+
export { default as useWindowSize } from './hooks/useWindowSize';
|
|
50
|
+
export { default as useSearchPage } from './hooks/useSearchPage';
|
|
51
|
+
//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C,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAC,YAAY,EAAE,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AACvE,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AACvE,OAAO,EACL,OAAO,IAAI,qBAAqB,EAChC,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,uBAAuB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -5,15 +5,41 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
export { useThemeConfig } from './utils/useThemeConfig';
|
|
8
|
+
export { DocSidebarItemsExpandedStateProvider, useDocSidebarItemsExpandedState, } from './utils/docSidebarItemsExpandedState';
|
|
8
9
|
export { createStorageSlot, listStorageKeys } from './utils/storageUtils';
|
|
9
10
|
export { useAlternatePageUtils } from './utils/useAlternatePageUtils';
|
|
10
|
-
export {
|
|
11
|
+
export { useContextualSearchFilters } from './utils/useContextualSearchFilters';
|
|
12
|
+
export { parseCodeBlockTitle, parseLanguage, parseLines, } from './utils/codeBlockUtils';
|
|
11
13
|
export { docVersionSearchTag, DEFAULT_SEARCH_TAG } from './utils/searchUtils';
|
|
12
|
-
export { isDocsPluginEnabled } from './utils/docsUtils';
|
|
14
|
+
export { isDocsPluginEnabled, DocsVersionProvider, useDocsVersion, useDocById, DocsSidebarProvider, useDocsSidebar, findSidebarCategory, findFirstCategoryLink, useCurrentSidebarCategory, isActiveSidebarItem, useSidebarBreadcrumbs, } from './utils/docsUtils';
|
|
13
15
|
export { isSamePath } from './utils/pathUtils';
|
|
14
16
|
export { useTitleFormatter } from './utils/generalUtils';
|
|
15
17
|
export { usePluralForm } from './utils/usePluralForm';
|
|
16
|
-
export {
|
|
18
|
+
export { useLocationChange } from './utils/useLocationChange';
|
|
19
|
+
export { usePrevious } from './utils/usePrevious';
|
|
20
|
+
export { useCollapsible, Collapsible } from './components/Collapsible';
|
|
21
|
+
export { default as Details } from './components/Details';
|
|
22
|
+
export { MobileSecondaryMenuProvider, MobileSecondaryMenuFiller, useMobileSecondaryMenuRenderer, } from './utils/mobileSecondaryMenu';
|
|
17
23
|
export { useDocsPreferredVersion, useDocsPreferredVersionByPluginId, } from './utils/docsPreferredVersion/useDocsPreferredVersion';
|
|
24
|
+
export { duplicates, uniq } from './utils/jsUtils';
|
|
18
25
|
export { DocsPreferredVersionContextProvider } from './utils/docsPreferredVersion/DocsPreferredVersionProvider';
|
|
19
26
|
export { ThemeClassNames } from './utils/ThemeClassNames';
|
|
27
|
+
export { AnnouncementBarProvider, useAnnouncementBar, } from './utils/announcementBarUtils';
|
|
28
|
+
export { useLocalPathname } from './utils/useLocalPathname';
|
|
29
|
+
export { translateTagsPageTitle, listTagsByLetters } from './utils/tagsUtils';
|
|
30
|
+
export { useHistoryPopHandler } from './utils/historyUtils';
|
|
31
|
+
export { default as useTOCHighlight } from './utils/useTOCHighlight';
|
|
32
|
+
export { useFilteredAndTreeifiedTOC, useTreeifiedTOC, } from './utils/tocUtils';
|
|
33
|
+
export { ScrollControllerProvider, useScrollController, useScrollPosition, useScrollPositionBlocker, } from './utils/scrollUtils';
|
|
34
|
+
export { useIsomorphicLayoutEffect, useDynamicCallback, } from './utils/reactUtils';
|
|
35
|
+
export { isRegexpStringMatch } from './utils/regexpUtils';
|
|
36
|
+
export { useHomePageRoute } from './utils/routesUtils';
|
|
37
|
+
export { useColorMode, ColorModeProvider } from './utils/colorModeUtils';
|
|
38
|
+
export { useTabGroupChoice, TabGroupChoiceProvider, } from './utils/tabGroupChoiceUtils';
|
|
39
|
+
export { default as useHideableNavbar } from './hooks/useHideableNavbar';
|
|
40
|
+
export { default as useKeyboardNavigation, keyboardFocusedClassName, } from './hooks/useKeyboardNavigation';
|
|
41
|
+
export { default as usePrismTheme } from './hooks/usePrismTheme';
|
|
42
|
+
export { default as useLockBodyScroll } from './hooks/useLockBodyScroll';
|
|
43
|
+
export { default as useWindowSize } from './hooks/useWindowSize';
|
|
44
|
+
export { default as useSearchPage } from './hooks/useSearchPage';
|
|
45
|
+
//# 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,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AACtD,OAAO,EACL,oCAAoC,EACpC,+BAA+B,GAChC,MAAM,sCAAsC,CAAC;AAe9C,OAAO,EAAC,iBAAiB,EAAE,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAExE,OAAO,EAAC,qBAAqB,EAAC,MAAM,+BAA+B,CAAC;AAEpE,OAAO,EAAC,0BAA0B,EAAC,MAAM,oCAAoC,CAAC;AAE9E,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,UAAU,GACX,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAC,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAC,UAAU,EAAC,MAAM,mBA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AmB,EAAC,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAC,YAAY,EAAE,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AACvE,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AACvE,OAAO,EACL,OAAO,IAAI,qBAAqB,EAChC,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,uBAAuB,CAAC"}
|
|
@@ -5,18 +5,46 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
export declare const ThemeClassNames: {
|
|
8
|
-
page: {
|
|
9
|
-
blogListPage:
|
|
10
|
-
blogPostPage:
|
|
11
|
-
blogTagsListPage:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
readonly page: {
|
|
9
|
+
readonly blogListPage: "blog-list-page";
|
|
10
|
+
readonly blogPostPage: "blog-post-page";
|
|
11
|
+
readonly blogTagsListPage: "blog-tags-list-page";
|
|
12
|
+
readonly blogTagPostListPage: "blog-tags-post-list-page";
|
|
13
|
+
readonly docsDocPage: "docs-doc-page";
|
|
14
|
+
readonly docsTagsListPage: "docs-tags-list-page";
|
|
15
|
+
readonly docsTagDocListPage: "docs-tags-doc-list-page";
|
|
16
|
+
readonly mdxPage: "mdx-page";
|
|
15
17
|
};
|
|
16
|
-
wrapper: {
|
|
17
|
-
main:
|
|
18
|
-
blogPages:
|
|
19
|
-
|
|
20
|
-
mdxPages:
|
|
18
|
+
readonly wrapper: {
|
|
19
|
+
readonly main: "main-wrapper";
|
|
20
|
+
readonly blogPages: "blog-wrapper";
|
|
21
|
+
readonly docsPages: "docs-wrapper";
|
|
22
|
+
readonly mdxPages: "mdx-wrapper";
|
|
21
23
|
};
|
|
24
|
+
readonly common: {
|
|
25
|
+
readonly editThisPage: "theme-edit-this-page";
|
|
26
|
+
readonly lastUpdated: "theme-last-updated";
|
|
27
|
+
readonly backToTopButton: "theme-back-to-top-button";
|
|
28
|
+
readonly codeBlock: "theme-code-block";
|
|
29
|
+
};
|
|
30
|
+
readonly layout: {};
|
|
31
|
+
readonly docs: {
|
|
32
|
+
readonly docVersionBanner: "theme-doc-version-banner";
|
|
33
|
+
readonly docVersionBadge: "theme-doc-version-badge";
|
|
34
|
+
readonly docBreadcrumbs: "theme-doc-breadcrumbs";
|
|
35
|
+
readonly docMarkdown: "theme-doc-markdown";
|
|
36
|
+
readonly docTocMobile: "theme-doc-toc-mobile";
|
|
37
|
+
readonly docTocDesktop: "theme-doc-toc-desktop";
|
|
38
|
+
readonly docFooter: "theme-doc-footer";
|
|
39
|
+
readonly docFooterTagsRow: "theme-doc-footer-tags-row";
|
|
40
|
+
readonly docFooterEditMetaRow: "theme-doc-footer-edit-meta-row";
|
|
41
|
+
readonly docSidebarContainer: "theme-doc-sidebar-container";
|
|
42
|
+
readonly docSidebarMenu: "theme-doc-sidebar-menu";
|
|
43
|
+
readonly docSidebarItemCategory: "theme-doc-sidebar-item-category";
|
|
44
|
+
readonly docSidebarItemLink: "theme-doc-sidebar-item-link";
|
|
45
|
+
readonly docSidebarItemCategoryLevel: (level: number) => `theme-doc-sidebar-item-category-level-${number}`;
|
|
46
|
+
readonly docSidebarItemLinkLevel: (level: number) => `theme-doc-sidebar-item-link-level-${number}`;
|
|
47
|
+
};
|
|
48
|
+
readonly blog: {};
|
|
22
49
|
};
|
|
50
|
+
//# 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;AAMH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sDA6Ca,MAAM;kDAEV,MAAM;;;CAOjC,CAAC"}
|
|
@@ -5,19 +5,57 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
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
|
+
// Please do not modify the classnames! This is a breaking change, and annoying
|
|
10
|
+
// for users!
|
|
8
11
|
export const ThemeClassNames = {
|
|
9
12
|
page: {
|
|
10
13
|
blogListPage: 'blog-list-page',
|
|
11
14
|
blogPostPage: 'blog-post-page',
|
|
12
15
|
blogTagsListPage: 'blog-tags-list-page',
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
blogTagPostListPage: 'blog-tags-post-list-page',
|
|
17
|
+
docsDocPage: 'docs-doc-page',
|
|
18
|
+
docsTagsListPage: 'docs-tags-list-page',
|
|
19
|
+
docsTagDocListPage: 'docs-tags-doc-list-page',
|
|
15
20
|
mdxPage: 'mdx-page',
|
|
16
21
|
},
|
|
17
22
|
wrapper: {
|
|
18
23
|
main: 'main-wrapper',
|
|
19
24
|
blogPages: 'blog-wrapper',
|
|
20
|
-
|
|
25
|
+
docsPages: 'docs-wrapper',
|
|
21
26
|
mdxPages: 'mdx-wrapper',
|
|
22
27
|
},
|
|
28
|
+
// /!\ Please keep the naming convention consistent!
|
|
29
|
+
// Something like: "theme-{blog,doc,version,page}?-<suffix>"
|
|
30
|
+
common: {
|
|
31
|
+
editThisPage: 'theme-edit-this-page',
|
|
32
|
+
lastUpdated: 'theme-last-updated',
|
|
33
|
+
backToTopButton: 'theme-back-to-top-button',
|
|
34
|
+
codeBlock: 'theme-code-block',
|
|
35
|
+
},
|
|
36
|
+
layout: {
|
|
37
|
+
// TODO add other stable classNames here
|
|
38
|
+
},
|
|
39
|
+
docs: {
|
|
40
|
+
docVersionBanner: 'theme-doc-version-banner',
|
|
41
|
+
docVersionBadge: 'theme-doc-version-badge',
|
|
42
|
+
docBreadcrumbs: 'theme-doc-breadcrumbs',
|
|
43
|
+
docMarkdown: 'theme-doc-markdown',
|
|
44
|
+
docTocMobile: 'theme-doc-toc-mobile',
|
|
45
|
+
docTocDesktop: 'theme-doc-toc-desktop',
|
|
46
|
+
docFooter: 'theme-doc-footer',
|
|
47
|
+
docFooterTagsRow: 'theme-doc-footer-tags-row',
|
|
48
|
+
docFooterEditMetaRow: 'theme-doc-footer-edit-meta-row',
|
|
49
|
+
docSidebarContainer: 'theme-doc-sidebar-container',
|
|
50
|
+
docSidebarMenu: 'theme-doc-sidebar-menu',
|
|
51
|
+
docSidebarItemCategory: 'theme-doc-sidebar-item-category',
|
|
52
|
+
docSidebarItemLink: 'theme-doc-sidebar-item-link',
|
|
53
|
+
docSidebarItemCategoryLevel: (level) => `theme-doc-sidebar-item-category-level-${level}`,
|
|
54
|
+
docSidebarItemLinkLevel: (level) => `theme-doc-sidebar-item-link-level-${level}`,
|
|
55
|
+
// TODO add other stable classNames here
|
|
56
|
+
},
|
|
57
|
+
blog: {
|
|
58
|
+
// TODO add other stable classNames here
|
|
59
|
+
},
|
|
23
60
|
};
|
|
61
|
+
//# sourceMappingURL=ThemeClassNames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeClassNames.js","sourceRoot":"","sources":["../../src/utils/ThemeClassNames.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,iEAAiE;AACjE,uEAAuE;AACvE,+EAA+E;AAC/E,aAAa;AACb,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,oDAAoD;IACpD,4DAA4D;IAC5D,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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 { type ReactNode } from 'react';
|
|
8
|
+
export declare const AnnouncementBarDismissStorageKey = "docusaurus.announcement.dismiss";
|
|
9
|
+
declare type AnnouncementBarAPI = {
|
|
10
|
+
readonly isActive: boolean;
|
|
11
|
+
readonly close: () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare function AnnouncementBarProvider({ children, }: {
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
}): JSX.Element;
|
|
16
|
+
export declare const useAnnouncementBar: () => AnnouncementBarAPI;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=announcementBarUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"announcementBarUtils.d.ts","sourceRoot":"","sources":["../../src/utils/announcementBarUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAKZ,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAKf,eAAO,MAAM,gCAAgC,oCACV,CAAC;AAapC,aAAK,kBAAkB,GAAG;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AA8DF,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAOd;AAED,eAAO,MAAM,kBAAkB,QAAO,kBAQrC,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
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 React, { useState, useEffect, useCallback, useMemo, useContext, createContext, } from 'react';
|
|
8
|
+
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
9
|
+
import { createStorageSlot } from './storageUtils';
|
|
10
|
+
import { useThemeConfig } from './useThemeConfig';
|
|
11
|
+
export const AnnouncementBarDismissStorageKey = 'docusaurus.announcement.dismiss';
|
|
12
|
+
const AnnouncementBarIdStorageKey = 'docusaurus.announcement.id';
|
|
13
|
+
const AnnouncementBarDismissStorage = createStorageSlot(AnnouncementBarDismissStorageKey);
|
|
14
|
+
const IdStorage = createStorageSlot(AnnouncementBarIdStorageKey);
|
|
15
|
+
const isDismissedInStorage = () => AnnouncementBarDismissStorage.get() === 'true';
|
|
16
|
+
const setDismissedInStorage = (bool) => AnnouncementBarDismissStorage.set(String(bool));
|
|
17
|
+
const useAnnouncementBarContextValue = () => {
|
|
18
|
+
const { announcementBar } = useThemeConfig();
|
|
19
|
+
const isBrowser = useIsBrowser();
|
|
20
|
+
const [isClosed, setClosed] = useState(() => isBrowser
|
|
21
|
+
? // On client navigation: init with local storage value
|
|
22
|
+
isDismissedInStorage()
|
|
23
|
+
: // On server/hydration: always visible to prevent layout shifts (will be hidden with css if needed)
|
|
24
|
+
false);
|
|
25
|
+
// Update state after hydration
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
setClosed(isDismissedInStorage());
|
|
28
|
+
}, []);
|
|
29
|
+
const handleClose = useCallback(() => {
|
|
30
|
+
setDismissedInStorage(true);
|
|
31
|
+
setClosed(true);
|
|
32
|
+
}, []);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!announcementBar) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const { id } = announcementBar;
|
|
38
|
+
let viewedId = IdStorage.get();
|
|
39
|
+
// retrocompatibility due to spelling mistake of default id
|
|
40
|
+
// see https://github.com/facebook/docusaurus/issues/3338
|
|
41
|
+
// cSpell:ignore annoucement
|
|
42
|
+
if (viewedId === 'annoucement-bar') {
|
|
43
|
+
viewedId = 'announcement-bar';
|
|
44
|
+
}
|
|
45
|
+
const isNewAnnouncement = id !== viewedId;
|
|
46
|
+
IdStorage.set(id);
|
|
47
|
+
if (isNewAnnouncement) {
|
|
48
|
+
setDismissedInStorage(false);
|
|
49
|
+
}
|
|
50
|
+
if (isNewAnnouncement || !isDismissedInStorage()) {
|
|
51
|
+
setClosed(false);
|
|
52
|
+
}
|
|
53
|
+
}, [announcementBar]);
|
|
54
|
+
return useMemo(() => ({
|
|
55
|
+
isActive: !!announcementBar && !isClosed,
|
|
56
|
+
close: handleClose,
|
|
57
|
+
}), [announcementBar, isClosed, handleClose]);
|
|
58
|
+
};
|
|
59
|
+
const AnnouncementBarContext = createContext(null);
|
|
60
|
+
export function AnnouncementBarProvider({ children, }) {
|
|
61
|
+
const value = useAnnouncementBarContextValue();
|
|
62
|
+
return (React.createElement(AnnouncementBarContext.Provider, { value: value }, children));
|
|
63
|
+
}
|
|
64
|
+
export const useAnnouncementBar = () => {
|
|
65
|
+
const api = useContext(AnnouncementBarContext);
|
|
66
|
+
if (!api) {
|
|
67
|
+
throw new Error('useAnnouncementBar(): AnnouncementBar not found in React context: make sure to use the AnnouncementBarProvider on top of the tree');
|
|
68
|
+
}
|
|
69
|
+
return api;
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=announcementBarUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"announcementBarUtils.js","sourceRoot":"","sources":["../../src/utils/announcementBarUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EACZ,QAAQ,EACR,SAAS,EACT,WAAW,EACX,OAAO,EAEP,UAAU,EACV,aAAa,GACd,MAAM,OAAO,CAAC;AACf,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEhD,MAAM,CAAC,MAAM,gCAAgC,GAC3C,iCAAiC,CAAC;AACpC,MAAM,2BAA2B,GAAG,4B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AG,kBAAkB,CAAC;SAC/B;QAED,MAAM,iBAAiB,GAAG,EAAE,KAAK,QAAQ,CAAC;QAE1C,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAElB,IAAI,iBAAiB,EAAE;YACrB,qBAAqB,CAAC,KAAK,CAAC,CAAC;SAC9B;QAED,IAAI,iBAAiB,IAAI,CAAC,oBAAoB,EAAE,EAAE;YAChD,SAAS,CAAC,KAAK,CAAC,CAAC;SAClB;IACH,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IAEtB,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE,CAAC,CAAC,eAAe,IAAI,CAAC,QAAQ;QACxC,KAAK,EAAE,WAAW;KACnB,CAAC,EACF,CAAC,eAAe,EAAE,QAAQ,EAAE,WAAW,CAAC,CACzC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,aAAa,CAA4B,IAAI,CAAC,CAAC;AAE9E,MAAM,UAAU,uBAAuB,CAAC,EACtC,QAAQ,GAGT;IACC,MAAM,KAAK,GAAG,8BAA8B,EAAE,CAAC;IAC/C,OAAO,CACL,oBAAC,sBAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAC1C,QAAQ,CACuB,CACnC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAuB,EAAE;IACzD,MAAM,GAAG,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;IAC/C,IAAI,CAAC,GAAG,EAAE;QACR,MAAM,IAAI,KAAK,CACb,mIAAmI,CACpI,CAAC;KACH;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -5,3 +5,13 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
export declare function parseCodeBlockTitle(metastring?: string): string;
|
|
8
|
+
export declare function parseLanguage(className: string): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* @param metastring The highlight range declared here starts at 1
|
|
11
|
+
* @returns Note: all line numbers start at 0, not 1
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseLines(content: string, metastring?: string, language?: string): {
|
|
14
|
+
highlightLines: number[];
|
|
15
|
+
code: string;
|
|
16
|
+
};
|
|
17
|
+
//# 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;AAqFH,wBAAgB,mBAAmB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKnE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB;IACD,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,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
|
+
const commentTypes = ['js', 'jsBlock', 'jsx', 'python', 'html'];
|
|
11
|
+
// Supported types of highlight comments
|
|
12
|
+
const commentPatterns = {
|
|
13
|
+
js: {
|
|
14
|
+
start: '\\/\\/',
|
|
15
|
+
end: '',
|
|
16
|
+
},
|
|
17
|
+
jsBlock: {
|
|
18
|
+
start: '\\/\\*',
|
|
19
|
+
end: '\\*\\/',
|
|
20
|
+
},
|
|
21
|
+
jsx: {
|
|
22
|
+
start: '\\{\\s*\\/\\*',
|
|
23
|
+
end: '\\*\\/\\s*\\}',
|
|
24
|
+
},
|
|
25
|
+
python: {
|
|
26
|
+
start: '#',
|
|
27
|
+
end: '',
|
|
28
|
+
},
|
|
29
|
+
html: {
|
|
30
|
+
start: '<!--',
|
|
31
|
+
end: '-->',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
const magicCommentDirectives = [
|
|
35
|
+
'highlight-next-line',
|
|
36
|
+
'highlight-start',
|
|
37
|
+
'highlight-end',
|
|
38
|
+
];
|
|
39
|
+
const getMagicCommentDirectiveRegex = (languages = commentTypes) => {
|
|
40
|
+
// to be more reliable, the opening and closing comment must match
|
|
41
|
+
const commentPattern = languages
|
|
42
|
+
.map((lang) => {
|
|
43
|
+
const { start, end } = commentPatterns[lang];
|
|
44
|
+
return `(?:${start}\\s*(${magicCommentDirectives.join('|')})\\s*${end})`;
|
|
45
|
+
})
|
|
46
|
+
.join('|');
|
|
47
|
+
// white space is allowed, but otherwise it should be on it's own line
|
|
48
|
+
return new RegExp(`^\\s*(?:${commentPattern})\\s*$`);
|
|
49
|
+
};
|
|
50
|
+
// select comment styles based on language
|
|
51
|
+
const magicCommentDirectiveRegex = (lang) => {
|
|
52
|
+
switch (lang) {
|
|
53
|
+
case 'js':
|
|
54
|
+
case 'javascript':
|
|
55
|
+
case 'ts':
|
|
56
|
+
case 'typescript':
|
|
57
|
+
return getMagicCommentDirectiveRegex(['js', 'jsBlock']);
|
|
58
|
+
case 'jsx':
|
|
59
|
+
case 'tsx':
|
|
60
|
+
return getMagicCommentDirectiveRegex(['js', 'jsBlock', 'jsx']);
|
|
61
|
+
case 'html':
|
|
62
|
+
return getMagicCommentDirectiveRegex(['js', 'jsBlock', 'html']);
|
|
63
|
+
case 'python':
|
|
64
|
+
case 'py':
|
|
65
|
+
return getMagicCommentDirectiveRegex(['python']);
|
|
66
|
+
default:
|
|
67
|
+
// all comment types
|
|
68
|
+
return getMagicCommentDirectiveRegex();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
8
71
|
export function parseCodeBlockTitle(metastring) {
|
|
9
72
|
var _a, _b;
|
|
10
|
-
return (_b = (_a = metastring === null || metastring === void 0 ? void 0 : metastring.match(codeBlockTitleRegex)) === null || _a === void 0 ? void 0 : _a
|
|
73
|
+
return (_b = (_a = metastring === null || metastring === void 0 ? void 0 : metastring.match(codeBlockTitleRegex)) === null || _a === void 0 ? void 0 : _a.groups.title) !== null && _b !== void 0 ? _b : '';
|
|
11
74
|
}
|
|
75
|
+
export function parseLanguage(className) {
|
|
76
|
+
const languageClassName = className
|
|
77
|
+
.split(' ')
|
|
78
|
+
.find((str) => str.startsWith('language-'));
|
|
79
|
+
return languageClassName === null || languageClassName === void 0 ? void 0 : languageClassName.replace(/language-/, '');
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* @param metastring The highlight range declared here starts at 1
|
|
83
|
+
* @returns Note: all line numbers start at 0, not 1
|
|
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 = magicCommentDirectiveRegex(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 };
|
|
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,qBAAqB,CAAC;AAEvD,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;AAQzE,wCAAwC;AACxC,MAAM,eAAe,GAAwC;IAC3D,EAAE,EAAE;QACF,KAAK,EAAE,QAAQ;QACf,GAAG,EAAE,EAAE;KACR;IACD,OAAO,EAAE;QAC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,CAAC,CAAC;IACnD,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,OAAO,EAAC,cAAc,EAAE,IAAI,EAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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 type { ReactNode } from 'react';
|
|
8
|
+
declare type ColorModeContextValue = {
|
|
9
|
+
readonly isDarkTheme: boolean;
|
|
10
|
+
readonly setLightTheme: () => void;
|
|
11
|
+
readonly setDarkTheme: () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare function ColorModeProvider({ children, }: {
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
}): JSX.Element;
|
|
16
|
+
export declare function useColorMode(): ColorModeContextValue;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=colorModeUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorModeUtils.d.ts","sourceRoot":"","sources":["../../src/utils/colorModeUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAarC,aAAK,qBAAqB,GAAG;IAC3B,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,IAAI,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,IAAI,CAAC;CACnC,CAAC;AAwGF,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAWd;AAED,wBAAgB,YAAY,IAAI,qBAAqB,CAUpD"}
|