@docusaurus/theme-common 0.0.0-6001 → 0.0.0-6004
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/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +16 -3
- package/lib/index.js.map +1 -1
- package/lib/internal.d.ts +1 -7
- package/lib/internal.d.ts.map +1 -1
- package/lib/internal.js +1 -7
- package/lib/internal.js.map +1 -1
- package/lib/utils/searchUtils.d.ts +0 -13
- package/lib/utils/searchUtils.d.ts.map +1 -1
- package/lib/utils/searchUtils.js +0 -39
- package/lib/utils/searchUtils.js.map +1 -1
- package/package.json +9 -10
- package/src/index.ts +23 -9
- package/src/internal.ts +1 -30
- package/src/types.d.ts +0 -1
- package/src/utils/searchUtils.ts +0 -58
- package/lib/contexts/doc.d.ts +0 -30
- package/lib/contexts/doc.d.ts.map +0 -1
- package/lib/contexts/doc.js +0 -48
- package/lib/contexts/doc.js.map +0 -1
- package/lib/contexts/docSidebarItemsExpandedState.d.ts +0 -31
- package/lib/contexts/docSidebarItemsExpandedState.d.ts.map +0 -1
- package/lib/contexts/docSidebarItemsExpandedState.js +0 -28
- package/lib/contexts/docSidebarItemsExpandedState.js.map +0 -1
- package/lib/contexts/docsPreferredVersion.d.ts +0 -30
- package/lib/contexts/docsPreferredVersion.d.ts.map +0 -1
- package/lib/contexts/docsPreferredVersion.js +0 -130
- package/lib/contexts/docsPreferredVersion.js.map +0 -1
- package/lib/contexts/docsSidebar.d.ts +0 -26
- package/lib/contexts/docsSidebar.d.ts.map +0 -1
- package/lib/contexts/docsSidebar.js +0 -30
- package/lib/contexts/docsSidebar.js.map +0 -1
- package/lib/contexts/docsVersion.d.ts +0 -20
- package/lib/contexts/docsVersion.d.ts.map +0 -1
- package/lib/contexts/docsVersion.js +0 -26
- package/lib/contexts/docsVersion.js.map +0 -1
- package/lib/utils/docsUtils.d.ts +0 -108
- package/lib/utils/docsUtils.d.ts.map +0 -1
- package/lib/utils/docsUtils.js +0 -276
- package/lib/utils/docsUtils.js.map +0 -1
- package/src/contexts/doc.tsx +0 -71
- package/src/contexts/docSidebarItemsExpandedState.tsx +0 -55
- package/src/contexts/docsPreferredVersion.tsx +0 -251
- package/src/contexts/docsSidebar.tsx +0 -50
- package/src/contexts/docsVersion.tsx +0 -36
- package/src/utils/docsUtils.tsx +0 -418
package/lib/index.d.ts
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
export declare function useCurrentSidebarCategory(...args: unknown[]): unknown;
|
|
8
|
+
export declare function filterDocCardListItems(...args: unknown[]): unknown;
|
|
9
|
+
export declare function useDocsPreferredVersion(...args: unknown[]): unknown;
|
|
7
10
|
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
11
|
export { default as ThemedComponent } from './components/ThemedComponent';
|
|
9
12
|
export { createStorageSlot, useStorageSlot, listStorageKeys, } from './utils/storageUtils';
|
|
10
|
-
export { useContextualSearchFilters } from './utils/searchUtils';
|
|
11
|
-
export { useCurrentSidebarCategory, filterDocCardListItems, } from './utils/docsUtils';
|
|
12
13
|
export { usePluralForm } from './utils/usePluralForm';
|
|
13
14
|
export { useCollapsible, Collapsible } from './components/Collapsible';
|
|
14
15
|
export { ThemeClassNames } from './utils/ThemeClassNames';
|
|
@@ -24,7 +25,6 @@ export { isMultiColumnFooterLinks } from './utils/footerUtils';
|
|
|
24
25
|
export { isRegexpStringMatch } from './utils/regexpUtils';
|
|
25
26
|
export { duplicates, uniq, groupBy } from './utils/jsUtils';
|
|
26
27
|
export { usePrismTheme } from './hooks/usePrismTheme';
|
|
27
|
-
export { useDocsPreferredVersion } from './contexts/docsPreferredVersion';
|
|
28
28
|
export { processAdmonitionProps } from './utils/admonitionUtils';
|
|
29
29
|
export { useHistorySelector, useQueryString, useQueryStringList, useClearQueryString, } from './utils/historyUtils';
|
|
30
30
|
export { SkipToContentFallbackId, SkipToContentLink, } from './utils/skipToContentUtils';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EACL,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAExE,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,wBAAgB,yBAAyB,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAKrE;AACD,wBAAgB,sBAAsB,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAKlE;AACD,wBAAgB,uBAAuB,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAKnE;AAMD,OAAO,EACL,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,cAAc,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EACd,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,iCAAiC,EACjC,kBAAkB,GACnB,MAAM,4BAA4B,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -4,14 +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
|
+
// TODO Docusaurus v4: remove these workarounds as a breaking change
|
|
8
|
+
// and remove docs plugin peerDeps in theme-common/package.json
|
|
9
|
+
// This is public API surface that we need to keep for v3
|
|
10
|
+
// See https://github.com/facebook/docusaurus/pull/10316
|
|
11
|
+
export function useCurrentSidebarCategory(...args) {
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
13
|
+
return require('@docusaurus/plugin-content-docs/client').useCurrentSidebarCategory(...args);
|
|
14
|
+
}
|
|
15
|
+
export function filterDocCardListItems(...args) {
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
17
|
+
return require('@docusaurus/plugin-content-docs/client').filterDocCardListItems(...args);
|
|
18
|
+
}
|
|
19
|
+
export function useDocsPreferredVersion(...args) {
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
21
|
+
return require('@docusaurus/plugin-content-docs/client').useDocsPreferredVersion(...args);
|
|
22
|
+
}
|
|
7
23
|
/*
|
|
8
24
|
* APIs to document
|
|
9
25
|
*/
|
|
10
26
|
export { useThemeConfig, } from './utils/useThemeConfig';
|
|
11
27
|
export { default as ThemedComponent } from './components/ThemedComponent';
|
|
12
28
|
export { createStorageSlot, useStorageSlot, listStorageKeys, } from './utils/storageUtils';
|
|
13
|
-
export { useContextualSearchFilters } from './utils/searchUtils';
|
|
14
|
-
export { useCurrentSidebarCategory, filterDocCardListItems, } from './utils/docsUtils';
|
|
15
29
|
export { usePluralForm } from './utils/usePluralForm';
|
|
16
30
|
export { useCollapsible, Collapsible } from './components/Collapsible';
|
|
17
31
|
export { ThemeClassNames } from './utils/ThemeClassNames';
|
|
@@ -31,7 +45,6 @@ export { isMultiColumnFooterLinks } from './utils/footerUtils';
|
|
|
31
45
|
export { isRegexpStringMatch } from './utils/regexpUtils';
|
|
32
46
|
export { duplicates, uniq, groupBy } from './utils/jsUtils';
|
|
33
47
|
export { usePrismTheme } from './hooks/usePrismTheme';
|
|
34
|
-
export { useDocsPreferredVersion } from './contexts/docsPreferredVersion';
|
|
35
48
|
export { processAdmonitionProps } from './utils/admonitionUtils';
|
|
36
49
|
export { useHistorySelector, useQueryString, useQueryStringList, useClearQueryString, } from './utils/historyUtils';
|
|
37
50
|
export { SkipToContentFallbackId, SkipToContentLink, } from './utils/skipToContentUtils';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,oEAAoE;AACpE,gEAAgE;AAChE,0DAA0D;AAC1D,yDAAyD;AACzD,MAAM,UAAU,yBAAyB,CAAC,GAAG,IAAe;IAC1D,8DAA8D;IAC9D,OAAO,OAAO,CAAC,wCAAwC,CAAC,CAAC,yBAAyB,CAChF,GAAG,IAAI,CACR,CAAC;AACJ,CAAC;AACD,MAAM,UAAU,sBAAsB,CAAC,GAAG,IAAe;IACvD,8DAA8D;IAC9D,OAAO,OAAO,CAAC,wCAAwC,CAAC,CAAC,sBAAsB,CAC7E,GAAG,IAAI,CACR,CAAC;AACJ,CAAC;AACD,MAA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Aa,EAAC,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAC,sBAAsB,EAAC,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,iCAAiC,EACjC,kBAAkB,GACnB,MAAM,4BAA4B,CAAC"}
|
package/lib/internal.d.ts
CHANGED
|
@@ -5,11 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
export * from './index';
|
|
8
|
-
export { DocSidebarItemsExpandedStateProvider, useDocSidebarItemsExpandedState, } from './contexts/docSidebarItemsExpandedState';
|
|
9
|
-
export { DocsVersionProvider, useDocsVersion } from './contexts/docsVersion';
|
|
10
|
-
export { DocsSidebarProvider, useDocsSidebar } from './contexts/docsSidebar';
|
|
11
|
-
export { DocProvider, useDoc, type DocContextValue } from './contexts/doc';
|
|
12
|
-
export { useDocsPreferredVersionByPluginId, DocsPreferredVersionContextProvider, } from './contexts/docsPreferredVersion';
|
|
13
8
|
export { AnnouncementBarProvider, useAnnouncementBar, } from './contexts/announcementBar';
|
|
14
9
|
export { useTabs, sanitizeTabsChildren } from './utils/tabsUtils';
|
|
15
10
|
export type { TabValue, TabsProps, TabItemProps } from './utils/tabsUtils';
|
|
@@ -18,8 +13,7 @@ export { useNavbarSecondaryMenu } from './contexts/navbarSecondaryMenu/display';
|
|
|
18
13
|
export { ColorModeProvider } from './contexts/colorMode';
|
|
19
14
|
export { useAlternatePageUtils } from './utils/useAlternatePageUtils';
|
|
20
15
|
export { parseCodeBlockTitle, parseLanguage, parseLines, containsLineNumbers, } from './utils/codeBlockUtils';
|
|
21
|
-
export {
|
|
22
|
-
export { isDocsPluginEnabled, useDocById, findSidebarCategory, findFirstSidebarItemLink, isActiveSidebarItem, isVisibleSidebarItem, useVisibleSidebarItems, useSidebarBreadcrumbs, useDocsVersionCandidates, useLayoutDoc, useLayoutDocsSidebar, useDocRootMetadata, } from './utils/docsUtils';
|
|
16
|
+
export { DEFAULT_SEARCH_TAG } from './utils/searchUtils';
|
|
23
17
|
export { useTitleFormatter } from './utils/generalUtils';
|
|
24
18
|
export { useLocationChange } from './utils/useLocationChange';
|
|
25
19
|
export { useLocalPathname } from './utils/useLocalPathname';
|
package/lib/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAC,OAAO,EAAE,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AAChE,YAAY,EAAC,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAEzE,OAAO,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAC,sBAAsB,EAAC,MAAM,wCAAwC,CAAC;AAE9E,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAC,qBAAqB,EAAC,MAAM,+BAA+B,CAAC;AAEpE,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAC,kBAAkB,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
|
-
export { DocSidebarItemsExpandedStateProvider, useDocSidebarItemsExpandedState, } from './contexts/docSidebarItemsExpandedState';
|
|
20
|
-
export { DocsVersionProvider, useDocsVersion } from './contexts/docsVersion';
|
|
21
|
-
export { DocsSidebarProvider, useDocsSidebar } from './contexts/docsSidebar';
|
|
22
|
-
export { DocProvider, useDoc } from './contexts/doc';
|
|
23
|
-
export { useDocsPreferredVersionByPluginId, DocsPreferredVersionContextProvider, } from './contexts/docsPreferredVersion';
|
|
24
19
|
export { AnnouncementBarProvider, useAnnouncementBar, } from './contexts/announcementBar';
|
|
25
20
|
export { useTabs, sanitizeTabsChildren } from './utils/tabsUtils';
|
|
26
21
|
export { useNavbarMobileSidebar } from './contexts/navbarMobileSidebar';
|
|
@@ -28,8 +23,7 @@ export { useNavbarSecondaryMenu } from './contexts/navbarSecondaryMenu/display';
|
|
|
28
23
|
export { ColorModeProvider } from './contexts/colorMode';
|
|
29
24
|
export { useAlternatePageUtils } from './utils/useAlternatePageUtils';
|
|
30
25
|
export { parseCodeBlockTitle, parseLanguage, parseLines, containsLineNumbers, } from './utils/codeBlockUtils';
|
|
31
|
-
export {
|
|
32
|
-
export { isDocsPluginEnabled, useDocById, findSidebarCategory, findFirstSidebarItemLink, isActiveSidebarItem, isVisibleSidebarItem, useVisibleSidebarItems, useSidebarBreadcrumbs, useDocsVersionCandidates, useLayoutDoc, useLayoutDocsSidebar, useDocRootMetadata, } from './utils/docsUtils';
|
|
26
|
+
export { DEFAULT_SEARCH_TAG } from './utils/searchUtils';
|
|
33
27
|
export { useTitleFormatter } from './utils/generalUtils';
|
|
34
28
|
export { useLocationChange } from './utils/useLocationChange';
|
|
35
29
|
export { useLocalPathname } from './utils/useLocalPathname';
|
package/lib/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,4EAA4E;AAC5E,6EAA6E;AAC7E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;AAE1B,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAC,gBAAgB,EAAE,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EAAC,2BAA2B,EAAC,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAC,gBAAgB,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAErE,OAAO,EACL,eAAe,GAEhB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EACL,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC"}
|
|
@@ -5,17 +5,4 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
export declare const DEFAULT_SEARCH_TAG = "default";
|
|
8
|
-
/** The search tag to append as each doc's metadata. */
|
|
9
|
-
export declare function docVersionSearchTag(pluginId: string, versionName: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* Gets the relevant context information for contextual search.
|
|
12
|
-
*
|
|
13
|
-
* The value is generic and not coupled to Algolia/DocSearch, since we may want
|
|
14
|
-
* to support multiple search engines, or allowing users to use their own search
|
|
15
|
-
* engine solution.
|
|
16
|
-
*/
|
|
17
|
-
export declare function useContextualSearchFilters(): {
|
|
18
|
-
locale: string;
|
|
19
|
-
tags: string[];
|
|
20
|
-
};
|
|
21
8
|
//# sourceMappingURL=searchUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchUtils.d.ts","sourceRoot":"","sources":["../../src/utils/searchUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"searchUtils.d.ts","sourceRoot":"","sources":["../../src/utils/searchUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,kBAAkB,YAAY,CAAC"}
|
package/lib/utils/searchUtils.js
CHANGED
|
@@ -4,44 +4,5 @@
|
|
|
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 { useAllDocsData, useActivePluginAndVersion, } from '@docusaurus/plugin-content-docs/client';
|
|
8
|
-
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
9
|
-
import { useDocsPreferredVersionByPluginId } from '../contexts/docsPreferredVersion';
|
|
10
7
|
export const DEFAULT_SEARCH_TAG = 'default';
|
|
11
|
-
/** The search tag to append as each doc's metadata. */
|
|
12
|
-
export function docVersionSearchTag(pluginId, versionName) {
|
|
13
|
-
return `docs-${pluginId}-${versionName}`;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Gets the relevant context information for contextual search.
|
|
17
|
-
*
|
|
18
|
-
* The value is generic and not coupled to Algolia/DocSearch, since we may want
|
|
19
|
-
* to support multiple search engines, or allowing users to use their own search
|
|
20
|
-
* engine solution.
|
|
21
|
-
*/
|
|
22
|
-
export function useContextualSearchFilters() {
|
|
23
|
-
const { i18n } = useDocusaurusContext();
|
|
24
|
-
const allDocsData = useAllDocsData();
|
|
25
|
-
const activePluginAndVersion = useActivePluginAndVersion();
|
|
26
|
-
const docsPreferredVersionByPluginId = useDocsPreferredVersionByPluginId();
|
|
27
|
-
// This can't use more specialized hooks because we are mapping over all
|
|
28
|
-
// plugin instances.
|
|
29
|
-
function getDocPluginTags(pluginId) {
|
|
30
|
-
const activeVersion = activePluginAndVersion?.activePlugin.pluginId === pluginId
|
|
31
|
-
? activePluginAndVersion.activeVersion
|
|
32
|
-
: undefined;
|
|
33
|
-
const preferredVersion = docsPreferredVersionByPluginId[pluginId];
|
|
34
|
-
const latestVersion = allDocsData[pluginId].versions.find((v) => v.isLast);
|
|
35
|
-
const version = activeVersion ?? preferredVersion ?? latestVersion;
|
|
36
|
-
return docVersionSearchTag(pluginId, version.name);
|
|
37
|
-
}
|
|
38
|
-
const tags = [
|
|
39
|
-
DEFAULT_SEARCH_TAG,
|
|
40
|
-
...Object.keys(allDocsData).map(getDocPluginTags),
|
|
41
|
-
];
|
|
42
|
-
return {
|
|
43
|
-
locale: i18n.currentLocale,
|
|
44
|
-
tags,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
8
|
//# sourceMappingURL=searchUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchUtils.js","sourceRoot":"","sources":["../../src/utils/searchUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,
|
|
1
|
+
{"version":3,"file":"searchUtils.js","sourceRoot":"","sources":["../../src/utils/searchUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-common",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-6004",
|
|
4
4
|
"description": "Common code for Docusaurus themes.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -30,12 +30,10 @@
|
|
|
30
30
|
},
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
34
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
35
|
-
"@docusaurus/
|
|
36
|
-
"@docusaurus/
|
|
37
|
-
"@docusaurus/utils": "0.0.0-6001",
|
|
38
|
-
"@docusaurus/utils-common": "0.0.0-6001",
|
|
33
|
+
"@docusaurus/mdx-loader": "0.0.0-6004",
|
|
34
|
+
"@docusaurus/module-type-aliases": "0.0.0-6004",
|
|
35
|
+
"@docusaurus/utils": "0.0.0-6004",
|
|
36
|
+
"@docusaurus/utils-common": "0.0.0-6004",
|
|
39
37
|
"@types/history": "^4.7.11",
|
|
40
38
|
"@types/react": "*",
|
|
41
39
|
"@types/react-router-config": "*",
|
|
@@ -46,18 +44,19 @@
|
|
|
46
44
|
"utility-types": "^3.10.0"
|
|
47
45
|
},
|
|
48
46
|
"devDependencies": {
|
|
49
|
-
"@docusaurus/core": "0.0.0-
|
|
50
|
-
"@docusaurus/types": "0.0.0-
|
|
47
|
+
"@docusaurus/core": "0.0.0-6004",
|
|
48
|
+
"@docusaurus/types": "0.0.0-6004",
|
|
51
49
|
"fs-extra": "^11.1.1",
|
|
52
50
|
"lodash": "^4.17.21",
|
|
53
51
|
"schema-dts": "^1.1.2"
|
|
54
52
|
},
|
|
55
53
|
"peerDependencies": {
|
|
54
|
+
"@docusaurus/plugin-content-docs": "*",
|
|
56
55
|
"react": "^18.0.0",
|
|
57
56
|
"react-dom": "^18.0.0"
|
|
58
57
|
},
|
|
59
58
|
"engines": {
|
|
60
59
|
"node": ">=18.0"
|
|
61
60
|
},
|
|
62
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "70e1069f65cbb7416b20d8e828293b3d537cc3de"
|
|
63
62
|
}
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,29 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
// TODO Docusaurus v4: remove these workarounds as a breaking change
|
|
9
|
+
// and remove docs plugin peerDeps in theme-common/package.json
|
|
10
|
+
// This is public API surface that we need to keep for v3
|
|
11
|
+
// See https://github.com/facebook/docusaurus/pull/10316
|
|
12
|
+
export function useCurrentSidebarCategory(...args: unknown[]): unknown {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
14
|
+
return require('@docusaurus/plugin-content-docs/client').useCurrentSidebarCategory(
|
|
15
|
+
...args,
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
export function filterDocCardListItems(...args: unknown[]): unknown {
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
20
|
+
return require('@docusaurus/plugin-content-docs/client').filterDocCardListItems(
|
|
21
|
+
...args,
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
export function useDocsPreferredVersion(...args: unknown[]): unknown {
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
26
|
+
return require('@docusaurus/plugin-content-docs/client').useDocsPreferredVersion(
|
|
27
|
+
...args,
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
8
31
|
/*
|
|
9
32
|
* APIs to document
|
|
10
33
|
*/
|
|
@@ -32,13 +55,6 @@ export {
|
|
|
32
55
|
listStorageKeys,
|
|
33
56
|
} from './utils/storageUtils';
|
|
34
57
|
|
|
35
|
-
export {useContextualSearchFilters} from './utils/searchUtils';
|
|
36
|
-
|
|
37
|
-
export {
|
|
38
|
-
useCurrentSidebarCategory,
|
|
39
|
-
filterDocCardListItems,
|
|
40
|
-
} from './utils/docsUtils';
|
|
41
|
-
|
|
42
58
|
export {usePluralForm} from './utils/usePluralForm';
|
|
43
59
|
|
|
44
60
|
export {useCollapsible, Collapsible} from './components/Collapsible';
|
|
@@ -89,8 +105,6 @@ export {duplicates, uniq, groupBy} from './utils/jsUtils';
|
|
|
89
105
|
|
|
90
106
|
export {usePrismTheme} from './hooks/usePrismTheme';
|
|
91
107
|
|
|
92
|
-
export {useDocsPreferredVersion} from './contexts/docsPreferredVersion';
|
|
93
|
-
|
|
94
108
|
export {processAdmonitionProps} from './utils/admonitionUtils';
|
|
95
109
|
|
|
96
110
|
export {
|
package/src/internal.ts
CHANGED
|
@@ -18,20 +18,6 @@
|
|
|
18
18
|
// eslint-disable-next-line no-restricted-syntax
|
|
19
19
|
export * from './index';
|
|
20
20
|
|
|
21
|
-
export {
|
|
22
|
-
DocSidebarItemsExpandedStateProvider,
|
|
23
|
-
useDocSidebarItemsExpandedState,
|
|
24
|
-
} from './contexts/docSidebarItemsExpandedState';
|
|
25
|
-
export {DocsVersionProvider, useDocsVersion} from './contexts/docsVersion';
|
|
26
|
-
export {DocsSidebarProvider, useDocsSidebar} from './contexts/docsSidebar';
|
|
27
|
-
|
|
28
|
-
export {DocProvider, useDoc, type DocContextValue} from './contexts/doc';
|
|
29
|
-
|
|
30
|
-
export {
|
|
31
|
-
useDocsPreferredVersionByPluginId,
|
|
32
|
-
DocsPreferredVersionContextProvider,
|
|
33
|
-
} from './contexts/docsPreferredVersion';
|
|
34
|
-
|
|
35
21
|
export {
|
|
36
22
|
AnnouncementBarProvider,
|
|
37
23
|
useAnnouncementBar,
|
|
@@ -54,22 +40,7 @@ export {
|
|
|
54
40
|
containsLineNumbers,
|
|
55
41
|
} from './utils/codeBlockUtils';
|
|
56
42
|
|
|
57
|
-
export {
|
|
58
|
-
|
|
59
|
-
export {
|
|
60
|
-
isDocsPluginEnabled,
|
|
61
|
-
useDocById,
|
|
62
|
-
findSidebarCategory,
|
|
63
|
-
findFirstSidebarItemLink,
|
|
64
|
-
isActiveSidebarItem,
|
|
65
|
-
isVisibleSidebarItem,
|
|
66
|
-
useVisibleSidebarItems,
|
|
67
|
-
useSidebarBreadcrumbs,
|
|
68
|
-
useDocsVersionCandidates,
|
|
69
|
-
useLayoutDoc,
|
|
70
|
-
useLayoutDocsSidebar,
|
|
71
|
-
useDocRootMetadata,
|
|
72
|
-
} from './utils/docsUtils';
|
|
43
|
+
export {DEFAULT_SEARCH_TAG} from './utils/searchUtils';
|
|
73
44
|
|
|
74
45
|
export {useTitleFormatter} from './utils/generalUtils';
|
|
75
46
|
|
package/src/types.d.ts
CHANGED
package/src/utils/searchUtils.ts
CHANGED
|
@@ -5,62 +5,4 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
useAllDocsData,
|
|
10
|
-
useActivePluginAndVersion,
|
|
11
|
-
} from '@docusaurus/plugin-content-docs/client';
|
|
12
|
-
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
13
|
-
import {useDocsPreferredVersionByPluginId} from '../contexts/docsPreferredVersion';
|
|
14
|
-
|
|
15
8
|
export const DEFAULT_SEARCH_TAG = 'default';
|
|
16
|
-
|
|
17
|
-
/** The search tag to append as each doc's metadata. */
|
|
18
|
-
export function docVersionSearchTag(
|
|
19
|
-
pluginId: string,
|
|
20
|
-
versionName: string,
|
|
21
|
-
): string {
|
|
22
|
-
return `docs-${pluginId}-${versionName}`;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Gets the relevant context information for contextual search.
|
|
27
|
-
*
|
|
28
|
-
* The value is generic and not coupled to Algolia/DocSearch, since we may want
|
|
29
|
-
* to support multiple search engines, or allowing users to use their own search
|
|
30
|
-
* engine solution.
|
|
31
|
-
*/
|
|
32
|
-
export function useContextualSearchFilters(): {locale: string; tags: string[]} {
|
|
33
|
-
const {i18n} = useDocusaurusContext();
|
|
34
|
-
const allDocsData = useAllDocsData();
|
|
35
|
-
const activePluginAndVersion = useActivePluginAndVersion();
|
|
36
|
-
const docsPreferredVersionByPluginId = useDocsPreferredVersionByPluginId();
|
|
37
|
-
|
|
38
|
-
// This can't use more specialized hooks because we are mapping over all
|
|
39
|
-
// plugin instances.
|
|
40
|
-
function getDocPluginTags(pluginId: string) {
|
|
41
|
-
const activeVersion =
|
|
42
|
-
activePluginAndVersion?.activePlugin.pluginId === pluginId
|
|
43
|
-
? activePluginAndVersion.activeVersion
|
|
44
|
-
: undefined;
|
|
45
|
-
|
|
46
|
-
const preferredVersion = docsPreferredVersionByPluginId[pluginId];
|
|
47
|
-
|
|
48
|
-
const latestVersion = allDocsData[pluginId]!.versions.find(
|
|
49
|
-
(v) => v.isLast,
|
|
50
|
-
)!;
|
|
51
|
-
|
|
52
|
-
const version = activeVersion ?? preferredVersion ?? latestVersion;
|
|
53
|
-
|
|
54
|
-
return docVersionSearchTag(pluginId, version.name);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const tags = [
|
|
58
|
-
DEFAULT_SEARCH_TAG,
|
|
59
|
-
...Object.keys(allDocsData).map(getDocPluginTags),
|
|
60
|
-
];
|
|
61
|
-
|
|
62
|
-
return {
|
|
63
|
-
locale: i18n.currentLocale,
|
|
64
|
-
tags,
|
|
65
|
-
};
|
|
66
|
-
}
|
package/lib/contexts/doc.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
import type { PropDocContent } from '@docusaurus/plugin-content-docs';
|
|
9
|
-
/**
|
|
10
|
-
* The React context value returned by the `useDoc()` hook.
|
|
11
|
-
* It contains useful data related to the currently browsed doc.
|
|
12
|
-
*/
|
|
13
|
-
export type DocContextValue = Pick<PropDocContent, 'metadata' | 'frontMatter' | 'toc' | 'assets' | 'contentTitle'>;
|
|
14
|
-
/**
|
|
15
|
-
* This is a very thin layer around the `content` received from the MDX loader.
|
|
16
|
-
* It provides metadata about the doc to the children tree.
|
|
17
|
-
*/
|
|
18
|
-
export declare function DocProvider({ children, content, }: {
|
|
19
|
-
children: ReactNode;
|
|
20
|
-
content: PropDocContent;
|
|
21
|
-
}): JSX.Element;
|
|
22
|
-
/**
|
|
23
|
-
* Returns the data of the currently browsed doc. Gives access to the doc's MDX
|
|
24
|
-
* Component, front matter, metadata, TOC, etc. When swizzling a low-level
|
|
25
|
-
* component (e.g. the "Edit this page" link) and you need some extra metadata,
|
|
26
|
-
* you don't have to drill the props all the way through the component tree:
|
|
27
|
-
* simply use this hook instead.
|
|
28
|
-
*/
|
|
29
|
-
export declare function useDoc(): DocContextValue;
|
|
30
|
-
//# sourceMappingURL=doc.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"doc.d.ts","sourceRoot":"","sources":["../../src/contexts/doc.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAU,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAEjE,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAC;AAEpE;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,cAAc,EACd,UAAU,GAAG,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,cAAc,CAC/D,CAAC;AAwBF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,cAAc,CAAC;CACzB,GAAG,GAAG,CAAC,OAAO,CAGd;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,IAAI,eAAe,CAMxC"}
|
package/lib/contexts/doc.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
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, { useMemo, useContext } from 'react';
|
|
8
|
-
import { ReactContextError } from '../utils/reactUtils';
|
|
9
|
-
const Context = React.createContext(null);
|
|
10
|
-
/**
|
|
11
|
-
* Note: we don't use `PropDoc` as context value on purpose. Metadata is
|
|
12
|
-
* currently stored inside the MDX component, but we may want to change that in
|
|
13
|
-
* the future. This layer is a good opportunity to decouple storage from
|
|
14
|
-
* consuming API, potentially allowing us to provide metadata as both props and
|
|
15
|
-
* route context without duplicating the chunks in the future.
|
|
16
|
-
*/
|
|
17
|
-
function useContextValue(content) {
|
|
18
|
-
return useMemo(() => ({
|
|
19
|
-
metadata: content.metadata,
|
|
20
|
-
frontMatter: content.frontMatter,
|
|
21
|
-
assets: content.assets,
|
|
22
|
-
contentTitle: content.contentTitle,
|
|
23
|
-
toc: content.toc,
|
|
24
|
-
}), [content]);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* This is a very thin layer around the `content` received from the MDX loader.
|
|
28
|
-
* It provides metadata about the doc to the children tree.
|
|
29
|
-
*/
|
|
30
|
-
export function DocProvider({ children, content, }) {
|
|
31
|
-
const contextValue = useContextValue(content);
|
|
32
|
-
return <Context.Provider value={contextValue}>{children}</Context.Provider>;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Returns the data of the currently browsed doc. Gives access to the doc's MDX
|
|
36
|
-
* Component, front matter, metadata, TOC, etc. When swizzling a low-level
|
|
37
|
-
* component (e.g. the "Edit this page" link) and you need some extra metadata,
|
|
38
|
-
* you don't have to drill the props all the way through the component tree:
|
|
39
|
-
* simply use this hook instead.
|
|
40
|
-
*/
|
|
41
|
-
export function useDoc() {
|
|
42
|
-
const doc = useContext(Context);
|
|
43
|
-
if (doc === null) {
|
|
44
|
-
throw new ReactContextError('DocProvider');
|
|
45
|
-
}
|
|
46
|
-
return doc;
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=doc.js.map
|
package/lib/contexts/doc.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"doc.js","sourceRoot":"","sources":["../../src/contexts/doc.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAkB,UAAU,EAAC,MAAM,OAAO,CAAC;AACjE,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAYtD,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAAyB,IAAI,CAAC,CAAC;AAElE;;;;;;GAMG;AACH,SAAS,eAAe,CAAC,OAAuB;IAC9C,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC,EACF,CAAC,OAAO,CAAC,CACV,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,EAC1B,QAAQ,EACR,OAAO,GAIR;IACC,MAAM,YAAY,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAC9C,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,MAAM;IACpB,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAChC,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACjB,MAAM,IAAI,iBAAiB,CAAC,aAAa,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
type ContextValue = {
|
|
9
|
-
/**
|
|
10
|
-
* The item that the user last opened, `null` when there's none open. On
|
|
11
|
-
* initial render, it will always be `null`, which doesn't necessarily mean
|
|
12
|
-
* there's no category open (can have 0, 1, or many being initially open).
|
|
13
|
-
*/
|
|
14
|
-
expandedItem: number | null;
|
|
15
|
-
/**
|
|
16
|
-
* Set the currently expanded item, when the user opens one. Set the value to
|
|
17
|
-
* `null` when the user closes an open category.
|
|
18
|
-
*/
|
|
19
|
-
setExpandedItem: (a: number | null) => void;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Should be used to wrap one sidebar category level. This provider syncs the
|
|
23
|
-
* expanded states of all sibling categories, and categories can choose to
|
|
24
|
-
* collapse itself if another one is expanded.
|
|
25
|
-
*/
|
|
26
|
-
export declare function DocSidebarItemsExpandedStateProvider({ children, }: {
|
|
27
|
-
children: ReactNode;
|
|
28
|
-
}): JSX.Element;
|
|
29
|
-
export declare function useDocSidebarItemsExpandedState(): ContextValue;
|
|
30
|
-
export {};
|
|
31
|
-
//# sourceMappingURL=docSidebarItemsExpandedState.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docSidebarItemsExpandedState.d.ts","sourceRoot":"","sources":["../../src/contexts/docSidebarItemsExpandedState.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAC,KAAK,SAAS,EAAgC,MAAM,OAAO,CAAC;AAG3E,KAAK,YAAY,GAAG;IAClB;;;;OAIG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;OAGG;IACH,eAAe,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC7C,CAAC;AAOF;;;;GAIG;AACH,wBAAgB,oCAAoC,CAAC,EACnD,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAQd;AAED,wBAAgB,+BAA+B,IAAI,YAAY,CAM9D"}
|
|
@@ -1,28 +0,0 @@
|
|
|
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, { useMemo, useState, useContext } from 'react';
|
|
8
|
-
import { ReactContextError } from '../utils/reactUtils';
|
|
9
|
-
const EmptyContext = Symbol('EmptyContext');
|
|
10
|
-
const Context = React.createContext(EmptyContext);
|
|
11
|
-
/**
|
|
12
|
-
* Should be used to wrap one sidebar category level. This provider syncs the
|
|
13
|
-
* expanded states of all sibling categories, and categories can choose to
|
|
14
|
-
* collapse itself if another one is expanded.
|
|
15
|
-
*/
|
|
16
|
-
export function DocSidebarItemsExpandedStateProvider({ children, }) {
|
|
17
|
-
const [expandedItem, setExpandedItem] = useState(null);
|
|
18
|
-
const contextValue = useMemo(() => ({ expandedItem, setExpandedItem }), [expandedItem]);
|
|
19
|
-
return <Context.Provider value={contextValue}>{children}</Context.Provider>;
|
|
20
|
-
}
|
|
21
|
-
export function useDocSidebarItemsExpandedState() {
|
|
22
|
-
const value = useContext(Context);
|
|
23
|
-
if (value === EmptyContext) {
|
|
24
|
-
throw new ReactContextError('DocSidebarItemsExpandedStateProvider');
|
|
25
|
-
}
|
|
26
|
-
return value;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=docSidebarItemsExpandedState.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docSidebarItemsExpandedState.js","sourceRoot":"","sources":["../../src/contexts/docSidebarItemsExpandedState.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAiB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,OAAO,CAAC;AAC3E,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAgBtD,MAAM,YAAY,GAAkB,MAAM,CAAC,cAAc,CAAC,CAAC;AAC3D,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CACjC,YAAY,CACb,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,oCAAoC,CAAC,EACnD,QAAQ,GAGT;IACC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACtE,MAAM,YAAY,GAAG,OAAO,CAC1B,GAAG,EAAE,CAAC,CAAC,EAAC,YAAY,EAAE,eAAe,EAAC,CAAC,EACvC,CAAC,YAAY,CAAC,CACf,CAAC;IAEF,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,+BAA+B;IAC7C,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,IAAI,KAAK,KAAK,YAAY,EAAE,CAAC;QAC3B,MAAM,IAAI,iBAAiB,CAAC,sCAAsC,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
import { type GlobalVersion } from '@docusaurus/plugin-content-docs/client';
|
|
9
|
-
/**
|
|
10
|
-
* This is a maybe-layer. If the docs plugin is not enabled, this provider is a
|
|
11
|
-
* simple pass-through.
|
|
12
|
-
*/
|
|
13
|
-
export declare function DocsPreferredVersionContextProvider({ children, }: {
|
|
14
|
-
children: ReactNode;
|
|
15
|
-
}): JSX.Element;
|
|
16
|
-
/**
|
|
17
|
-
* Returns a read-write interface to a plugin's preferred version. The
|
|
18
|
-
* "preferred version" is defined as the last version that the user visited.
|
|
19
|
-
* For example, if a user is using v3, even when v4 is later published, the user
|
|
20
|
-
* would still be browsing v3 docs when she opens the website next time. Note,
|
|
21
|
-
* the `preferredVersion` attribute will always be `null` before mount.
|
|
22
|
-
*/
|
|
23
|
-
export declare function useDocsPreferredVersion(pluginId?: string | undefined): {
|
|
24
|
-
preferredVersion: GlobalVersion | null;
|
|
25
|
-
savePreferredVersionName: (versionName: string) => void;
|
|
26
|
-
};
|
|
27
|
-
export declare function useDocsPreferredVersionByPluginId(): {
|
|
28
|
-
[pluginId: string]: GlobalVersion | null;
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=docsPreferredVersion.d.ts.map
|