@docusaurus/theme-common 2.0.0-beta.fc64c12e4 → 2.0.0
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 +35 -6
- package/lib/components/Collapsible/index.d.ts.map +1 -0
- package/lib/components/Collapsible/index.js +33 -30
- package/lib/components/Collapsible/index.js.map +1 -0
- package/lib/components/Details/index.d.ts +8 -3
- package/lib/components/Details/index.d.ts.map +1 -0
- package/lib/components/Details/index.js +31 -19
- package/lib/components/Details/index.js.map +1 -0
- package/lib/components/Details/styles.module.css +14 -11
- package/lib/contexts/announcementBar.d.ts +22 -0
- package/lib/contexts/announcementBar.d.ts.map +1 -0
- package/lib/{utils/announcementBarUtils.js → contexts/announcementBar.js} +30 -31
- package/lib/contexts/announcementBar.js.map +1 -0
- package/lib/contexts/blogPost.d.ts +33 -0
- package/lib/contexts/blogPost.d.ts.map +1 -0
- package/lib/contexts/blogPost.js +46 -0
- package/lib/contexts/blogPost.js.map +1 -0
- package/lib/contexts/colorMode.d.ts +27 -0
- package/lib/contexts/colorMode.d.ts.map +1 -0
- package/lib/contexts/colorMode.js +132 -0
- package/lib/contexts/colorMode.js.map +1 -0
- package/lib/contexts/doc.d.ts +30 -0
- package/lib/contexts/doc.d.ts.map +1 -0
- package/lib/contexts/doc.js +48 -0
- package/lib/contexts/doc.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 +30 -0
- package/lib/contexts/docsPreferredVersion.d.ts.map +1 -0
- package/lib/contexts/docsPreferredVersion.js +130 -0
- package/lib/contexts/docsPreferredVersion.js.map +1 -0
- package/lib/contexts/docsSidebar.d.ts +26 -0
- package/lib/contexts/docsSidebar.d.ts.map +1 -0
- package/lib/contexts/docsSidebar.js +30 -0
- package/lib/contexts/docsSidebar.js.map +1 -0
- package/lib/contexts/docsVersion.d.ts +20 -0
- package/lib/contexts/docsVersion.d.ts.map +1 -0
- package/lib/contexts/docsVersion.js +26 -0
- package/lib/contexts/docsVersion.js.map +1 -0
- package/lib/contexts/navbarMobileSidebar.d.ts +31 -0
- package/lib/contexts/navbarMobileSidebar.d.ts.map +1 -0
- package/lib/contexts/navbarMobileSidebar.js +56 -0
- package/lib/contexts/navbarMobileSidebar.js.map +1 -0
- package/lib/contexts/navbarSecondaryMenu/content.d.ts +37 -0
- package/lib/contexts/navbarSecondaryMenu/content.d.ts.map +1 -0
- package/lib/contexts/navbarSecondaryMenu/content.js +50 -0
- package/lib/contexts/navbarSecondaryMenu/content.js.map +1 -0
- package/lib/contexts/navbarSecondaryMenu/display.d.ts +24 -0
- package/lib/contexts/navbarSecondaryMenu/display.d.ts.map +1 -0
- package/lib/contexts/navbarSecondaryMenu/display.js +62 -0
- package/lib/contexts/navbarSecondaryMenu/display.js.map +1 -0
- package/lib/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/usePrevious.d.ts → hooks/styles.css} +4 -1
- package/lib/hooks/useBackToTopButton.d.ts +27 -0
- package/lib/hooks/useBackToTopButton.d.ts.map +1 -0
- package/lib/hooks/useBackToTopButton.js +50 -0
- package/lib/hooks/useBackToTopButton.js.map +1 -0
- package/lib/hooks/useCodeWordWrap.d.ts +14 -0
- package/lib/hooks/useCodeWordWrap.d.ts.map +1 -0
- package/lib/hooks/useCodeWordWrap.js +67 -0
- package/lib/hooks/useCodeWordWrap.js.map +1 -0
- package/lib/hooks/useHideableNavbar.d.ts +17 -0
- package/lib/hooks/useHideableNavbar.d.ts.map +1 -0
- package/lib/hooks/useHideableNavbar.js +60 -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/useMutationObserver.d.ts +4 -0
- package/lib/hooks/useMutationObserver.d.ts.map +1 -0
- package/lib/hooks/useMutationObserver.js +29 -0
- package/lib/hooks/useMutationObserver.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 +21 -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/useSkipToContent.d.ts +25 -0
- package/lib/hooks/useSkipToContent.d.ts.map +1 -0
- package/lib/hooks/useSkipToContent.js +35 -0
- package/lib/hooks/useSkipToContent.js.map +1 -0
- package/lib/hooks/useTOCHighlight.d.ts +25 -0
- package/lib/hooks/useTOCHighlight.d.ts.map +1 -0
- package/lib/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 +15 -19
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +22 -15
- package/lib/index.js.map +1 -0
- package/lib/internal.d.ts +41 -0
- package/lib/internal.d.ts.map +1 -0
- package/lib/internal.js +52 -0
- package/lib/internal.js.map +1 -0
- package/lib/utils/ThemeClassNames.d.ts +49 -12
- package/lib/utils/ThemeClassNames.d.ts.map +1 -0
- package/lib/utils/ThemeClassNames.js +47 -4
- package/lib/utils/ThemeClassNames.js.map +1 -0
- package/lib/utils/codeBlockUtils.d.ts +63 -0
- package/lib/utils/codeBlockUtils.d.ts.map +1 -0
- package/lib/utils/codeBlockUtils.js +159 -3
- package/lib/utils/codeBlockUtils.js.map +1 -0
- package/lib/utils/docsUtils.d.ts +91 -0
- package/lib/utils/docsUtils.d.ts.map +1 -0
- package/lib/utils/docsUtils.js +217 -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 +70 -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 +36 -0
- package/lib/utils/navbarUtils.js.map +1 -0
- package/lib/utils/reactUtils.d.ts +69 -0
- package/lib/utils/reactUtils.d.ts.map +1 -0
- package/lib/utils/reactUtils.js +98 -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 +83 -0
- package/lib/utils/scrollUtils.d.ts.map +1 -0
- package/lib/utils/scrollUtils.js +200 -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 +37 -0
- package/lib/utils/searchUtils.js.map +1 -0
- package/lib/utils/storageUtils.d.ts +15 -7
- package/lib/utils/storageUtils.d.ts.map +1 -0
- package/lib/utils/storageUtils.js +55 -22
- package/lib/utils/storageUtils.js.map +1 -0
- package/lib/utils/tagsUtils.d.ts +18 -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 +6 -0
- package/lib/utils/useLocalPathname.d.ts.map +1 -0
- package/lib/utils/useLocalPathname.js +7 -4
- package/lib/utils/useLocalPathname.js.map +1 -0
- package/lib/utils/useLocationChange.d.ts +9 -6
- package/lib/utils/useLocationChange.d.ts.map +1 -0
- package/lib/utils/useLocationChange.js +17 -11
- 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 +56 -29
- 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 +35 -15
- package/src/components/Collapsible/index.tsx +57 -48
- package/src/components/Details/index.tsx +27 -12
- package/src/components/Details/styles.module.css +14 -11
- package/src/{utils/announcementBarUtils.tsx → contexts/announcementBar.tsx} +43 -39
- package/src/contexts/blogPost.tsx +80 -0
- package/src/contexts/colorMode.tsx +198 -0
- package/src/contexts/doc.tsx +71 -0
- package/src/contexts/docSidebarItemsExpandedState.tsx +55 -0
- package/src/contexts/docsPreferredVersion.tsx +251 -0
- package/src/contexts/docsSidebar.tsx +50 -0
- package/src/contexts/docsVersion.tsx +36 -0
- package/src/contexts/navbarMobileSidebar.tsx +99 -0
- package/src/contexts/navbarSecondaryMenu/content.tsx +100 -0
- package/src/contexts/navbarSecondaryMenu/display.tsx +102 -0
- package/src/contexts/tabGroupChoice.tsx +85 -0
- package/{lib/utils/pathUtils.d.ts → src/hooks/styles.css} +4 -1
- package/src/hooks/useBackToTopButton.ts +73 -0
- package/src/hooks/useCodeWordWrap.ts +105 -0
- package/src/hooks/useHideableNavbar.ts +75 -0
- package/src/hooks/useKeyboardNavigation.ts +45 -0
- package/src/hooks/useLockBodyScroll.ts +21 -0
- package/src/hooks/useMutationObserver.ts +38 -0
- package/src/hooks/usePrismTheme.ts +24 -0
- package/src/hooks/useSearchPage.ts +79 -0
- package/src/hooks/useSkipToContent.ts +58 -0
- package/src/hooks/useTOCHighlight.ts +189 -0
- package/src/hooks/useWindowSize.ts +72 -0
- package/src/index.ts +49 -42
- package/src/internal.ts +122 -0
- package/src/types.d.ts +0 -2
- package/src/utils/ThemeClassNames.ts +54 -5
- package/src/utils/codeBlockUtils.ts +241 -2
- package/src/utils/docsUtils.tsx +334 -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 +45 -0
- package/src/utils/reactUtils.tsx +129 -0
- package/src/utils/regexpUtils.ts +24 -0
- package/src/utils/routesUtils.ts +75 -0
- package/src/utils/scrollUtils.tsx +304 -0
- package/src/utils/searchUtils.ts +51 -0
- package/src/utils/storageUtils.ts +56 -23
- package/src/utils/tagsUtils.ts +50 -0
- package/src/utils/tocUtils.ts +119 -0
- package/src/utils/useAlternatePageUtils.ts +19 -6
- package/src/utils/useLocalPathname.ts +6 -4
- package/src/utils/useLocationChange.ts +24 -20
- package/src/utils/usePluralForm.ts +50 -38
- package/src/utils/useThemeConfig.ts +55 -31
- package/copyUntypedFiles.js +0 -20
- package/lib/.tsbuildinfo +0 -1
- package/lib/utils/announcementBarUtils.d.ts +0 -17
- 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/mobileSecondaryMenu.d.ts +0 -20
- package/lib/utils/mobileSecondaryMenu.js +0 -50
- package/lib/utils/pathUtils.js +0 -13
- package/lib/utils/usePrevious.js +0 -14
- 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/mobileSecondaryMenu.tsx +0 -115
- package/src/utils/pathUtils.ts +0 -17
- package/src/utils/usePrevious.ts +0 -18
- package/tsconfig.json +0 -10
|
@@ -4,9 +4,29 @@
|
|
|
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
|
+
* Permits to obtain the url of the current page in another locale, useful to
|
|
9
|
+
* generate hreflang meta headers etc...
|
|
10
|
+
*
|
|
11
|
+
* @see https://developers.google.com/search/docs/advanced/crawling/localized-versions
|
|
12
|
+
*/
|
|
7
13
|
export declare function useAlternatePageUtils(): {
|
|
8
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Everything (pathname, base URL, etc.) is read from the context. Just tell
|
|
16
|
+
* it which locale to link to and it will give you the alternate link for the
|
|
17
|
+
* current page.
|
|
18
|
+
*/
|
|
19
|
+
createUrl: ({
|
|
20
|
+
/** The locale name to link to. */
|
|
21
|
+
locale,
|
|
22
|
+
/**
|
|
23
|
+
* For hreflang SEO headers, we need it to be fully qualified (full
|
|
24
|
+
* protocol/domain/path...); but for locale dropdowns, using a pathname is
|
|
25
|
+
* good enough.
|
|
26
|
+
*/
|
|
27
|
+
fullyQualified, }: {
|
|
9
28
|
locale: string;
|
|
10
29
|
fullyQualified: boolean;
|
|
11
30
|
}) => string;
|
|
12
31
|
};
|
|
32
|
+
//# sourceMappingURL=useAlternatePageUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAlternatePageUtils.d.ts","sourceRoot":"","sources":["../../src/utils/useAlternatePageUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;;GAKG;AACH,wBAAgB,qBAAqB,IAAI;IACvC;;;;OAIG;IACH,SAAS,EAAE,CAAC;IACV,kCAAkC;IAClC,MAAM;IACN;;;;OAIG;IACH,cAAc,GACf,EAAE;QACD,MAAM,EAAE,MAAM,CAAC;QACf,cAAc,EAAE,OAAO,CAAC;KACzB,KAAK,MAAM,CAAC;CACd,CAmCA"}
|
|
@@ -6,9 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
8
8
|
import { useLocation } from '@docusaurus/router';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Permits to obtain the url of the current page in another locale, useful to
|
|
11
|
+
* generate hreflang meta headers etc...
|
|
12
|
+
*
|
|
13
|
+
* @see https://developers.google.com/search/docs/advanced/crawling/localized-versions
|
|
14
|
+
*/
|
|
12
15
|
export function useAlternatePageUtils() {
|
|
13
16
|
const { siteConfig: { baseUrl, url }, i18n: { defaultLocale, currentLocale }, } = useDocusaurusContext();
|
|
14
17
|
const { pathname } = useLocation();
|
|
@@ -21,9 +24,11 @@ export function useAlternatePageUtils() {
|
|
|
21
24
|
? `${baseUrlUnlocalized}`
|
|
22
25
|
: `${baseUrlUnlocalized}${locale}/`;
|
|
23
26
|
}
|
|
24
|
-
// TODO support correct alternate url when localized site is deployed on
|
|
27
|
+
// TODO support correct alternate url when localized site is deployed on
|
|
28
|
+
// another domain
|
|
25
29
|
function createUrl({ locale, fullyQualified, }) {
|
|
26
30
|
return `${fullyQualified ? url : ''}${getLocalizedBaseUrl(locale)}${pathnameSuffix}`;
|
|
27
31
|
}
|
|
28
32
|
return { createUrl };
|
|
29
33
|
}
|
|
34
|
+
//# sourceMappingURL=useAlternatePageUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAlternatePageUtils.js","sourceRoot":"","sources":["../../src/utils/useAlternatePageUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB;IAoBnC,MAAM,EACJ,UAAU,EAAE,EAAC,OAAO,EAAE,GAAG,EAAC,EAC1B,IAAI,EAAE,EAAC,aAAa,EAAE,aAAa,EAAC,GACrC,GAAG,oBAAoB,EAAE,CAAC;IAC3B,MAAM,EAAC,QAAQ,EAAC,GAAG,WAAW,EAAE,CAAC;IAEjC,MAAM,kBAAkB,GACtB,aAAa,KAAK,aAAa;QAC7B,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,aAAa,GAAG,EAAE,GAAG,CAAC,CAAC;IAEjD,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAErD,SAAS,mBAAmB,CAAC,MAAc;QACzC,OAAO,MAAM,KAAK,aAAa;YAC7B,CAAC,CAAC,GAAG,kBAAkB,EAAE;YACzB,CAAC,CAAC,GAAG,kBAAkB,GAAG,MAAM,GAAG,CAAC;IACxC,CAAC;IAED,wEAAwE;IACxE,iBAAiB;IACjB,SAAS,SAAS,CAAC,EACjB,MAAM,EACN,cAAc,GAIf;QACC,OAAO,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,mBAAmB,CACvD,MAAM,CACP,GAAG,cAAc,EAAE,CAAC;IACvB,CAAC;IAED,OAAO,EAAC,SAAS,EAAC,CAAC;AACrB,CAAC"}
|
|
@@ -4,4 +4,10 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* Get the pathname of current route, without the optional site baseUrl.
|
|
9
|
+
* - `/docs/myDoc` => `/docs/myDoc`
|
|
10
|
+
* - `/baseUrl/docs/myDoc` => `/docs/myDoc`
|
|
11
|
+
*/
|
|
7
12
|
export declare function useLocalPathname(): string;
|
|
13
|
+
//# sourceMappingURL=useLocalPathname.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocalPathname.d.ts","sourceRoot":"","sources":["../../src/utils/useLocalPathname.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAMzC"}
|
|
@@ -4,13 +4,16 @@
|
|
|
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 useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
8
7
|
import { useLocation } from '@docusaurus/router';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
9
|
+
/**
|
|
10
|
+
* Get the pathname of current route, without the optional site baseUrl.
|
|
11
|
+
* - `/docs/myDoc` => `/docs/myDoc`
|
|
12
|
+
* - `/baseUrl/docs/myDoc` => `/docs/myDoc`
|
|
13
|
+
*/
|
|
12
14
|
export function useLocalPathname() {
|
|
13
15
|
const { siteConfig: { baseUrl }, } = useDocusaurusContext();
|
|
14
16
|
const { pathname } = useLocation();
|
|
15
17
|
return pathname.replace(baseUrl, '/');
|
|
16
18
|
}
|
|
19
|
+
//# sourceMappingURL=useLocalPathname.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocalPathname.js","sourceRoot":"","sources":["../../src/utils/useLocalPathname.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAC/C,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,EACJ,UAAU,EAAE,EAAC,OAAO,EAAC,GACtB,GAAG,oBAAoB,EAAE,CAAC;IAC3B,MAAM,EAAC,QAAQ,EAAC,GAAG,WAAW,EAAE,CAAC;IACjC,OAAO,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -4,11 +4,14 @@
|
|
|
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 { Location } from '
|
|
8
|
-
|
|
7
|
+
import type { Location } from 'history';
|
|
8
|
+
/**
|
|
9
|
+
* Fires an effect when the location changes (which includes hash, query, etc.).
|
|
10
|
+
* Importantly, doesn't fire when there's no previous location: see
|
|
11
|
+
* https://github.com/facebook/docusaurus/pull/6696
|
|
12
|
+
*/
|
|
13
|
+
export declare function useLocationChange(onLocationChange: (locationChangeEvent: {
|
|
9
14
|
location: Location;
|
|
10
15
|
previousLocation: Location | undefined;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export declare function useLocationChange(onLocationChange: OnLocationChange): void;
|
|
14
|
-
export {};
|
|
16
|
+
}) => void): void;
|
|
17
|
+
//# sourceMappingURL=useLocationChange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocationChange.d.ts","sourceRoot":"","sources":["../../src/utils/useLocationChange.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEtC;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,gBAAgB,EAAE,CAAC,mBAAmB,EAAE;IACtC,QAAQ,EAAE,QAAQ,CAAC;IACnB,gBAAgB,EAAE,QAAQ,GAAG,SAAS,CAAC;CACxC,KAAK,IAAI,GACT,IAAI,CAkBN"}
|
|
@@ -4,22 +4,28 @@
|
|
|
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 { useEffect
|
|
7
|
+
import { useEffect } from 'react';
|
|
8
8
|
import { useLocation } from '@docusaurus/router';
|
|
9
|
-
import { usePrevious } from './
|
|
9
|
+
import { useEvent, usePrevious } from './reactUtils';
|
|
10
|
+
/**
|
|
11
|
+
* Fires an effect when the location changes (which includes hash, query, etc.).
|
|
12
|
+
* Importantly, doesn't fire when there's no previous location: see
|
|
13
|
+
* https://github.com/facebook/docusaurus/pull/6696
|
|
14
|
+
*/
|
|
10
15
|
export function useLocationChange(onLocationChange) {
|
|
11
16
|
const location = useLocation();
|
|
12
17
|
const previousLocation = usePrevious(location);
|
|
13
|
-
const
|
|
18
|
+
const onLocationChangeDynamic = useEvent(onLocationChange);
|
|
14
19
|
useEffect(() => {
|
|
15
|
-
|
|
16
|
-
if (isFirst.current) {
|
|
17
|
-
isFirst.current = false;
|
|
20
|
+
if (!previousLocation) {
|
|
18
21
|
return;
|
|
19
22
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
if (location !== previousLocation) {
|
|
24
|
+
onLocationChangeDynamic({
|
|
25
|
+
location,
|
|
26
|
+
previousLocation,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}, [onLocationChangeDynamic, location, previousLocation]);
|
|
25
30
|
}
|
|
31
|
+
//# sourceMappingURL=useLocationChange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocationChange.js","sourceRoot":"","sources":["../../src/utils/useLocationChange.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAChC,OAAO,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AAGnD;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,gBAGU;IAEV,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,gBAAgB,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IAE/C,MAAM,uBAAuB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAE3D,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,gBAAgB,EAAE;YACrB,OAAO;SACR;QAED,IAAI,QAAQ,KAAK,gBAAgB,EAAE;YACjC,uBAAuB,CAAC;gBACtB,QAAQ;gBACR,gBAAgB;aACjB,CAAC,CAAC;SACJ;IACH,CAAC,EAAE,CAAC,uBAAuB,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -4,6 +4,18 @@
|
|
|
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
|
+
* Reads the current locale and returns an interface very similar to
|
|
9
|
+
* `Intl.PluralRules`.
|
|
10
|
+
*/
|
|
7
11
|
export declare function usePluralForm(): {
|
|
12
|
+
/**
|
|
13
|
+
* Give it a `count` and it will select the relevant message from
|
|
14
|
+
* `pluralMessages`. `pluralMessages` should be separated by `|`, and in the
|
|
15
|
+
* order of "zero", "one", "two", "few", "many", "other". The actual selection
|
|
16
|
+
* is done by `Intl.PluralRules`, which tells us all plurals the locale has
|
|
17
|
+
* and which plural we should use for `count`.
|
|
18
|
+
*/
|
|
8
19
|
selectMessage: (count: number, pluralMessages: string) => string;
|
|
9
20
|
};
|
|
21
|
+
//# sourceMappingURL=usePluralForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePluralForm.d.ts","sourceRoot":"","sources":["../../src/utils/usePluralForm.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA0GH;;;GAGG;AACH,wBAAgB,aAAa,IAAI;IAC/B;;;;;;OAMG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,MAAM,CAAC;CAClE,CAMA"}
|
|
@@ -34,36 +34,33 @@ function createLocalePluralForms(locale) {
|
|
|
34
34
|
select: (count) => pluralRules.select(count),
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Poor man's `PluralSelector` implementation, using an English fallback. We
|
|
39
|
+
* want a lightweight, future-proof and good-enough solution. We don't want a
|
|
40
|
+
* perfect and heavy solution.
|
|
41
|
+
*
|
|
42
|
+
* Docusaurus classic theme has only 2 deeply nested labels requiring complex
|
|
43
|
+
* plural rules. We don't want to use `Intl` + `PluralRules` polyfills + full
|
|
44
|
+
* ICU syntax (react-intl) just for that.
|
|
45
|
+
*
|
|
46
|
+
* Notes:
|
|
47
|
+
* - 2021: 92+% Browsers support `Intl.PluralRules`, and support will increase
|
|
48
|
+
* in the future
|
|
49
|
+
* - NodeJS >= 13 has full ICU support by default
|
|
50
|
+
* - In case of "mismatch" between SSR and Browser ICU support, React keeps
|
|
51
|
+
* working!
|
|
52
|
+
*/
|
|
48
53
|
function useLocalePluralForms() {
|
|
49
54
|
const { i18n: { currentLocale }, } = useDocusaurusContext();
|
|
50
55
|
return useMemo(() => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
try {
|
|
54
|
-
return createLocalePluralForms(currentLocale);
|
|
55
|
-
}
|
|
56
|
-
catch (e) {
|
|
57
|
-
console.error(`Failed to use Intl.PluralRules for locale "${currentLocale}".
|
|
58
|
-
Docusaurus will fallback to a default/fallback (English) Intl.PluralRules implementation.
|
|
59
|
-
`);
|
|
60
|
-
return EnglishPluralForms;
|
|
61
|
-
}
|
|
56
|
+
try {
|
|
57
|
+
return createLocalePluralForms(currentLocale);
|
|
62
58
|
}
|
|
63
|
-
|
|
64
|
-
console.error(`Intl.PluralRules
|
|
65
|
-
Docusaurus will fallback to
|
|
66
|
-
|
|
59
|
+
catch (err) {
|
|
60
|
+
console.error(`Failed to use Intl.PluralRules for locale "${currentLocale}".
|
|
61
|
+
Docusaurus will fallback to the default (English) implementation.
|
|
62
|
+
Error: ${err.message}
|
|
63
|
+
`);
|
|
67
64
|
return EnglishPluralForms;
|
|
68
65
|
}
|
|
69
66
|
}, [currentLocale]);
|
|
@@ -74,21 +71,23 @@ function selectPluralMessage(pluralMessages, count, localePluralForms) {
|
|
|
74
71
|
if (parts.length === 1) {
|
|
75
72
|
return parts[0];
|
|
76
73
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
console.error(`For locale=${localePluralForms.locale}, a maximum of ${localePluralForms.pluralForms.length} plural forms are expected (${localePluralForms.pluralForms}), but the message contains ${parts.length} plural forms: ${pluralMessages} `);
|
|
80
|
-
}
|
|
81
|
-
const pluralForm = localePluralForms.select(count);
|
|
82
|
-
const pluralFormIndex = localePluralForms.pluralForms.indexOf(pluralForm);
|
|
83
|
-
// In case of not enough plural form messages, we take the last one (other) instead of returning undefined
|
|
84
|
-
return parts[Math.min(pluralFormIndex, parts.length - 1)];
|
|
74
|
+
if (parts.length > localePluralForms.pluralForms.length) {
|
|
75
|
+
console.error(`For locale=${localePluralForms.locale}, a maximum of ${localePluralForms.pluralForms.length} plural forms are expected (${localePluralForms.pluralForms.join(',')}), but the message contains ${parts.length}: ${pluralMessages}`);
|
|
85
76
|
}
|
|
77
|
+
const pluralForm = localePluralForms.select(count);
|
|
78
|
+
const pluralFormIndex = localePluralForms.pluralForms.indexOf(pluralForm);
|
|
79
|
+
// In case of not enough plural form messages, we take the last one (other)
|
|
80
|
+
// instead of returning undefined
|
|
81
|
+
return parts[Math.min(pluralFormIndex, parts.length - 1)];
|
|
86
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Reads the current locale and returns an interface very similar to
|
|
85
|
+
* `Intl.PluralRules`.
|
|
86
|
+
*/
|
|
87
87
|
export function usePluralForm() {
|
|
88
88
|
const localePluralForm = useLocalePluralForms();
|
|
89
89
|
return {
|
|
90
|
-
selectMessage: (count, pluralMessages) =>
|
|
91
|
-
return selectPluralMessage(pluralMessages, count, localePluralForm);
|
|
92
|
-
},
|
|
90
|
+
selectMessage: (count, pluralMessages) => selectPluralMessage(pluralMessages, count, localePluralForm),
|
|
93
91
|
};
|
|
94
92
|
}
|
|
93
|
+
//# sourceMappingURL=usePluralForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePluralForm.js","sourceRoot":"","sources":["../../src/utils/usePluralForm.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,21 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 { PrismTheme } from 'prism-react-renderer';
|
|
8
|
+
import type { DeepPartial } from 'utility-types';
|
|
9
|
+
import type { MagicCommentConfig } from './codeBlockUtils';
|
|
3
10
|
export declare type DocsVersionPersistence = 'localStorage' | 'none';
|
|
4
11
|
export declare type NavbarItem = {
|
|
5
12
|
type?: string | undefined;
|
|
6
13
|
items?: NavbarItem[];
|
|
7
14
|
label?: string;
|
|
8
15
|
position?: 'left' | 'right';
|
|
16
|
+
} & {
|
|
17
|
+
[key: string]: unknown;
|
|
9
18
|
};
|
|
10
|
-
|
|
19
|
+
declare type BaseLogo = {
|
|
20
|
+
alt?: string;
|
|
11
21
|
src: string;
|
|
12
22
|
srcDark?: string;
|
|
13
23
|
href?: string;
|
|
24
|
+
width?: string | number;
|
|
25
|
+
height?: string | number;
|
|
14
26
|
target?: string;
|
|
15
|
-
|
|
27
|
+
style?: object;
|
|
28
|
+
className?: string;
|
|
16
29
|
};
|
|
30
|
+
export declare type NavbarLogo = BaseLogo;
|
|
17
31
|
export declare type Navbar = {
|
|
18
|
-
style
|
|
32
|
+
style?: 'dark' | 'primary';
|
|
19
33
|
hideOnScroll: boolean;
|
|
20
34
|
title?: string;
|
|
21
35
|
items: NavbarItem[];
|
|
@@ -25,12 +39,6 @@ export declare type ColorModeConfig = {
|
|
|
25
39
|
defaultMode: 'light' | 'dark';
|
|
26
40
|
disableSwitch: boolean;
|
|
27
41
|
respectPrefersColorScheme: boolean;
|
|
28
|
-
switchConfig: {
|
|
29
|
-
darkIcon: string;
|
|
30
|
-
darkIconStyle: CSSProperties;
|
|
31
|
-
lightIcon: string;
|
|
32
|
-
lightIconStyle: CSSProperties;
|
|
33
|
-
};
|
|
34
42
|
};
|
|
35
43
|
export declare type AnnouncementBarConfig = {
|
|
36
44
|
id: string;
|
|
@@ -40,10 +48,11 @@ export declare type AnnouncementBarConfig = {
|
|
|
40
48
|
isCloseable: boolean;
|
|
41
49
|
};
|
|
42
50
|
export declare type PrismConfig = {
|
|
43
|
-
theme
|
|
51
|
+
theme: PrismTheme;
|
|
44
52
|
darkTheme?: PrismTheme;
|
|
45
53
|
defaultLanguage?: string;
|
|
46
|
-
additionalLanguages
|
|
54
|
+
additionalLanguages: string[];
|
|
55
|
+
magicComments: MagicCommentConfig[];
|
|
47
56
|
};
|
|
48
57
|
export declare type FooterLinkItem = {
|
|
49
58
|
label?: string;
|
|
@@ -51,34 +60,52 @@ export declare type FooterLinkItem = {
|
|
|
51
60
|
href?: string;
|
|
52
61
|
html?: string;
|
|
53
62
|
prependBaseUrlToHref?: string;
|
|
63
|
+
} & {
|
|
64
|
+
[key: string]: unknown;
|
|
54
65
|
};
|
|
55
|
-
export declare type
|
|
56
|
-
|
|
57
|
-
items: FooterLinkItem[];
|
|
58
|
-
};
|
|
59
|
-
export declare type Footer = {
|
|
66
|
+
export declare type FooterLogo = BaseLogo;
|
|
67
|
+
export declare type FooterBase = {
|
|
60
68
|
style: 'light' | 'dark';
|
|
61
|
-
logo?:
|
|
62
|
-
alt?: string;
|
|
63
|
-
src?: string;
|
|
64
|
-
srcDark?: string;
|
|
65
|
-
href?: string;
|
|
66
|
-
};
|
|
69
|
+
logo?: FooterLogo;
|
|
67
70
|
copyright?: string;
|
|
68
|
-
|
|
71
|
+
};
|
|
72
|
+
export declare type MultiColumnFooter = FooterBase & {
|
|
73
|
+
links: {
|
|
74
|
+
title: string | null;
|
|
75
|
+
items: FooterLinkItem[];
|
|
76
|
+
}[];
|
|
77
|
+
};
|
|
78
|
+
export declare type SimpleFooter = FooterBase & {
|
|
79
|
+
links: FooterLinkItem[];
|
|
80
|
+
};
|
|
81
|
+
export declare type Footer = MultiColumnFooter | SimpleFooter;
|
|
82
|
+
export declare type TableOfContents = {
|
|
83
|
+
minHeadingLevel: number;
|
|
84
|
+
maxHeadingLevel: number;
|
|
69
85
|
};
|
|
70
86
|
export declare type ThemeConfig = {
|
|
71
87
|
docs: {
|
|
72
88
|
versionPersistence: DocsVersionPersistence;
|
|
89
|
+
sidebar: {
|
|
90
|
+
hideable: boolean;
|
|
91
|
+
autoCollapseCategories: boolean;
|
|
92
|
+
};
|
|
73
93
|
};
|
|
74
94
|
navbar: Navbar;
|
|
75
95
|
colorMode: ColorModeConfig;
|
|
76
96
|
announcementBar?: AnnouncementBarConfig;
|
|
77
97
|
prism: PrismConfig;
|
|
78
98
|
footer?: Footer;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
99
|
+
image?: string;
|
|
100
|
+
metadata: {
|
|
101
|
+
[key: string]: string;
|
|
102
|
+
}[];
|
|
103
|
+
tableOfContents: TableOfContents;
|
|
83
104
|
};
|
|
105
|
+
export declare type UserThemeConfig = DeepPartial<ThemeConfig>;
|
|
106
|
+
/**
|
|
107
|
+
* A convenient/more semantic way to get theme config from context.
|
|
108
|
+
*/
|
|
84
109
|
export declare function useThemeConfig(): ThemeConfig;
|
|
110
|
+
export {};
|
|
111
|
+
//# sourceMappingURL=useThemeConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useThemeConfig.d.ts","sourceRoot":"","sources":["../../src/utils/useThemeConfig.ts"],"names":[],"mappings":"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"}
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
8
|
+
/**
|
|
9
|
+
* A convenient/more semantic way to get theme config from context.
|
|
10
|
+
*/
|
|
8
11
|
export function useThemeConfig() {
|
|
9
12
|
return useDocusaurusContext().siteConfig.themeConfig;
|
|
10
13
|
}
|
|
14
|
+
//# sourceMappingURL=useThemeConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useThemeConfig.js","sourceRoot":"","sources":["../../src/utils/useThemeConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AA0HpE;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,oBAAoB,EAAE,CAAC,UAAU,CAAC,WAA0B,CAAC;AACtE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-common",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Common code for Docusaurus themes.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
|
+
"sideEffects": [
|
|
8
|
+
"lib/components/Details/*",
|
|
9
|
+
"*.css"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": "./lib/index.js",
|
|
13
|
+
"./internal": "./lib/internal.js",
|
|
14
|
+
"./Details": "./lib/components/Details/index.js"
|
|
15
|
+
},
|
|
7
16
|
"scripts": {
|
|
8
|
-
"build": "node copyUntypedFiles.js
|
|
9
|
-
"watch": "
|
|
17
|
+
"build": "tsc && node ../../admin/scripts/copyUntypedFiles.js",
|
|
18
|
+
"watch": "run-p -c copy:watch build:watch",
|
|
19
|
+
"build:watch": "tsc --watch",
|
|
20
|
+
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch",
|
|
21
|
+
"removeThemeInternalReexport": "node removeThemeInternalReexport.mjs"
|
|
10
22
|
},
|
|
11
23
|
"publishConfig": {
|
|
12
24
|
"access": "public"
|
|
@@ -18,25 +30,33 @@
|
|
|
18
30
|
},
|
|
19
31
|
"license": "MIT",
|
|
20
32
|
"dependencies": {
|
|
21
|
-
"@docusaurus/
|
|
22
|
-
"@docusaurus/
|
|
23
|
-
"@docusaurus/plugin-content-
|
|
24
|
-
"@docusaurus/plugin-content-
|
|
25
|
-
"@docusaurus/
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
33
|
+
"@docusaurus/mdx-loader": "2.0.0",
|
|
34
|
+
"@docusaurus/module-type-aliases": "2.0.0",
|
|
35
|
+
"@docusaurus/plugin-content-blog": "2.0.0",
|
|
36
|
+
"@docusaurus/plugin-content-docs": "2.0.0",
|
|
37
|
+
"@docusaurus/plugin-content-pages": "2.0.0",
|
|
38
|
+
"@docusaurus/utils": "2.0.0",
|
|
39
|
+
"@types/history": "^4.7.11",
|
|
40
|
+
"@types/react": "*",
|
|
41
|
+
"@types/react-router-config": "*",
|
|
42
|
+
"clsx": "^1.2.1",
|
|
43
|
+
"parse-numeric-range": "^1.3.0",
|
|
44
|
+
"prism-react-renderer": "^1.3.5",
|
|
45
|
+
"tslib": "^2.4.0",
|
|
46
|
+
"utility-types": "^3.10.0"
|
|
29
47
|
},
|
|
30
48
|
"devDependencies": {
|
|
31
|
-
"@docusaurus/
|
|
49
|
+
"@docusaurus/core": "2.0.0",
|
|
50
|
+
"@docusaurus/types": "2.0.0",
|
|
51
|
+
"fs-extra": "^10.1.0",
|
|
52
|
+
"lodash": "^4.17.21"
|
|
32
53
|
},
|
|
33
54
|
"peerDependencies": {
|
|
34
|
-
"prism-react-renderer": "^1.2.1",
|
|
35
55
|
"react": "^16.8.4 || ^17.0.0",
|
|
36
56
|
"react-dom": "^16.8.4 || ^17.0.0"
|
|
37
57
|
},
|
|
38
58
|
"engines": {
|
|
39
|
-
"node": ">=
|
|
59
|
+
"node": ">=16.14"
|
|
40
60
|
},
|
|
41
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "2a9e8f5ec807e49a973fc72326f1ef26092e977e"
|
|
42
62
|
}
|