@docusaurus/theme-common 2.0.0-beta.12faed89d → 2.0.0-beta.13

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.
Files changed (89) hide show
  1. package/copyUntypedFiles.js +20 -0
  2. package/lib/.tsbuildinfo +1 -1
  3. package/lib/{utils/useCollapsible.d.ts → components/Collapsible/index.d.ts} +9 -3
  4. package/lib/{utils/useCollapsible.js → components/Collapsible/index.js} +36 -14
  5. package/lib/components/Details/index.d.ts +12 -0
  6. package/lib/components/Details/index.js +64 -0
  7. package/lib/components/Details/styles.module.css +58 -0
  8. package/lib/index.d.ts +19 -5
  9. package/lib/index.js +14 -3
  10. package/lib/utils/ThemeClassNames.d.ts +36 -12
  11. package/lib/utils/ThemeClassNames.js +36 -3
  12. package/lib/utils/announcementBarUtils.d.ts +3 -3
  13. package/lib/utils/announcementBarUtils.js +14 -18
  14. package/lib/utils/codeBlockUtils.d.ts +10 -0
  15. package/lib/utils/codeBlockUtils.js +119 -0
  16. package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.d.ts +2 -2
  17. package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.js +2 -2
  18. package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.js +1 -3
  19. package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.d.ts +11 -3
  20. package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.js +1 -2
  21. package/lib/utils/docsUtils.d.ts +20 -0
  22. package/lib/utils/docsUtils.js +106 -0
  23. package/lib/utils/generalUtils.d.ts +6 -0
  24. package/lib/utils/generalUtils.js +2 -2
  25. package/lib/utils/historyUtils.d.ts +11 -0
  26. package/lib/utils/historyUtils.js +39 -0
  27. package/lib/utils/jsUtils.d.ts +19 -0
  28. package/lib/utils/jsUtils.js +25 -0
  29. package/lib/utils/mobileSecondaryMenu.d.ts +2 -2
  30. package/lib/utils/mobileSecondaryMenu.js +3 -4
  31. package/lib/utils/pathUtils.js +1 -3
  32. package/lib/utils/reactUtils.d.ts +9 -0
  33. package/lib/utils/reactUtils.js +26 -0
  34. package/lib/utils/regexpUtils.d.ts +10 -0
  35. package/lib/utils/regexpUtils.js +16 -0
  36. package/lib/utils/scrollUtils.d.ts +52 -0
  37. package/lib/utils/scrollUtils.js +135 -0
  38. package/lib/utils/storageUtils.d.ts +4 -0
  39. package/lib/utils/storageUtils.js +29 -3
  40. package/lib/utils/tagsUtils.d.ts +18 -0
  41. package/lib/utils/tagsUtils.js +33 -0
  42. package/lib/utils/tocUtils.d.ts +15 -0
  43. package/lib/utils/tocUtils.js +34 -0
  44. package/lib/utils/useContextualSearchFilters.d.ts +11 -0
  45. package/lib/utils/useContextualSearchFilters.js +36 -0
  46. package/{src/utils/docsUtils.ts → lib/utils/useLocalPathname.d.ts} +1 -5
  47. package/lib/utils/useLocalPathname.js +16 -0
  48. package/lib/utils/useLocationChange.js +9 -11
  49. package/lib/utils/usePluralForm.js +1 -3
  50. package/lib/utils/usePrevious.js +3 -2
  51. package/lib/utils/useTOCHighlight.d.ts +14 -0
  52. package/lib/utils/useTOCHighlight.js +124 -0
  53. package/lib/utils/useThemeConfig.d.ts +20 -3
  54. package/package.json +18 -12
  55. package/src/{utils/useCollapsible.tsx → components/Collapsible/index.tsx} +70 -25
  56. package/src/components/Details/index.tsx +94 -0
  57. package/src/components/Details/styles.module.css +58 -0
  58. package/src/index.ts +54 -4
  59. package/src/types.d.ts +0 -2
  60. package/src/utils/ThemeClassNames.ts +42 -4
  61. package/src/utils/__tests__/codeBlockUtils.test.ts +2 -2
  62. package/src/utils/__tests__/docsUtils.test.tsx +331 -0
  63. package/src/utils/__tests__/jsUtils.test.ts +33 -0
  64. package/src/utils/__tests__/tagUtils.test.ts +66 -0
  65. package/src/utils/__tests__/tocUtils.test.ts +197 -0
  66. package/src/utils/announcementBarUtils.tsx +20 -15
  67. package/src/utils/codeBlockUtils.ts +151 -0
  68. package/src/utils/docsPreferredVersion/DocsPreferredVersionProvider.tsx +7 -6
  69. package/src/utils/docsPreferredVersion/DocsPreferredVersionStorage.ts +2 -3
  70. package/src/utils/docsPreferredVersion/useDocsPreferredVersion.ts +14 -14
  71. package/src/utils/docsUtils.tsx +185 -0
  72. package/src/utils/generalUtils.ts +3 -2
  73. package/src/utils/historyUtils.ts +50 -0
  74. package/src/utils/jsUtils.ts +33 -0
  75. package/src/utils/mobileSecondaryMenu.tsx +9 -6
  76. package/src/utils/pathUtils.ts +2 -3
  77. package/src/utils/reactUtils.tsx +34 -0
  78. package/src/utils/regexpUtils.ts +23 -0
  79. package/src/utils/scrollUtils.tsx +237 -0
  80. package/src/utils/storageUtils.ts +27 -4
  81. package/src/utils/tagsUtils.ts +48 -0
  82. package/src/utils/tocUtils.ts +55 -0
  83. package/src/utils/useContextualSearchFilters.ts +50 -0
  84. package/src/utils/useLocalPathname.ts +20 -0
  85. package/src/utils/useLocationChange.ts +10 -12
  86. package/src/utils/usePluralForm.ts +2 -3
  87. package/src/utils/usePrevious.ts +3 -2
  88. package/src/utils/useTOCHighlight.ts +179 -0
  89. package/src/utils/useThemeConfig.ts +19 -3
@@ -0,0 +1,48 @@
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
+
8
+ import {translate} from '@docusaurus/Translate';
9
+
10
+ export const translateTagsPageTitle = (): string =>
11
+ translate({
12
+ id: 'theme.tags.tagsPageTitle',
13
+ message: 'Tags',
14
+ description: 'The title of the tag list page',
15
+ });
16
+
17
+ type TagsListItem = Readonly<{name: string; permalink: string; count: number}>; // TODO remove duplicated type :s
18
+
19
+ export type TagLetterEntry = Readonly<{letter: string; tags: TagsListItem[]}>;
20
+
21
+ function getTagLetter(tag: string): string {
22
+ return tag[0].toUpperCase();
23
+ }
24
+
25
+ export function listTagsByLetters(
26
+ tags: readonly TagsListItem[],
27
+ ): TagLetterEntry[] {
28
+ // Group by letters
29
+ const groups: Record<string, TagsListItem[]> = {};
30
+ Object.values(tags).forEach((tag) => {
31
+ const letter = getTagLetter(tag.name);
32
+ groups[letter] = groups[letter] ?? [];
33
+ groups[letter].push(tag);
34
+ });
35
+
36
+ return (
37
+ Object.entries(groups)
38
+ // Sort letters
39
+ .sort(([letter1], [letter2]) => letter1.localeCompare(letter2))
40
+ .map(([letter, letterTags]) => {
41
+ // Sort tags inside a letter
42
+ const sortedTags = letterTags.sort((tag1, tag2) =>
43
+ tag1.name.localeCompare(tag2.name),
44
+ );
45
+ return {letter, tags: sortedTags};
46
+ })
47
+ );
48
+ }
@@ -0,0 +1,55 @@
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
+
8
+ import {useMemo} from 'react';
9
+ import {TOCItem} from '@docusaurus/types';
10
+
11
+ type FilterTOCParam = {
12
+ toc: readonly TOCItem[];
13
+ minHeadingLevel: number;
14
+ maxHeadingLevel: number;
15
+ };
16
+
17
+ export function filterTOC({
18
+ toc,
19
+ minHeadingLevel,
20
+ maxHeadingLevel,
21
+ }: FilterTOCParam): TOCItem[] {
22
+ function isValid(item: TOCItem) {
23
+ return item.level >= minHeadingLevel && item.level <= maxHeadingLevel;
24
+ }
25
+
26
+ return toc.flatMap((item) => {
27
+ const filteredChildren = filterTOC({
28
+ toc: item.children,
29
+ minHeadingLevel,
30
+ maxHeadingLevel,
31
+ });
32
+ if (isValid(item)) {
33
+ return [
34
+ {
35
+ ...item,
36
+ children: filteredChildren,
37
+ },
38
+ ];
39
+ } else {
40
+ return filteredChildren;
41
+ }
42
+ });
43
+ }
44
+
45
+ // Memoize potentially expensive filtering logic
46
+ export function useTOCFilter({
47
+ toc,
48
+ minHeadingLevel,
49
+ maxHeadingLevel,
50
+ }: FilterTOCParam): readonly TOCItem[] {
51
+ return useMemo(
52
+ () => filterTOC({toc, minHeadingLevel, maxHeadingLevel}),
53
+ [toc, minHeadingLevel, maxHeadingLevel],
54
+ );
55
+ }
@@ -0,0 +1,50 @@
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
+
8
+ import {useAllDocsData, useActivePluginAndVersion} from '@theme/hooks/useDocs';
9
+ import {useDocsPreferredVersionByPluginId} from './docsPreferredVersion/useDocsPreferredVersion';
10
+ import {docVersionSearchTag, DEFAULT_SEARCH_TAG} from './searchUtils';
11
+ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
12
+
13
+ export type useContextualSearchFiltersReturns = {
14
+ locale: string;
15
+ tags: string[];
16
+ };
17
+
18
+ // We may want to support multiple search engines, don't couple that to Algolia/DocSearch
19
+ // Maybe users will want to use its own search engine solution
20
+ export function useContextualSearchFilters(): useContextualSearchFiltersReturns {
21
+ const {i18n} = useDocusaurusContext();
22
+ const allDocsData = useAllDocsData();
23
+ const activePluginAndVersion = useActivePluginAndVersion();
24
+ const docsPreferredVersionByPluginId = useDocsPreferredVersionByPluginId();
25
+
26
+ function getDocPluginTags(pluginId: string) {
27
+ const activeVersion =
28
+ activePluginAndVersion?.activePlugin?.pluginId === pluginId
29
+ ? activePluginAndVersion.activeVersion
30
+ : undefined;
31
+
32
+ const preferredVersion = docsPreferredVersionByPluginId[pluginId];
33
+
34
+ const latestVersion = allDocsData[pluginId].versions.find((v) => v.isLast)!;
35
+
36
+ const version = activeVersion ?? preferredVersion ?? latestVersion;
37
+
38
+ return docVersionSearchTag(pluginId, version.name);
39
+ }
40
+
41
+ const tags = [
42
+ DEFAULT_SEARCH_TAG,
43
+ ...Object.keys(allDocsData).map(getDocPluginTags),
44
+ ];
45
+
46
+ return {
47
+ locale: i18n.currentLocale,
48
+ tags,
49
+ };
50
+ }
@@ -0,0 +1,20 @@
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
+
8
+ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
9
+ import {useLocation} from '@docusaurus/router';
10
+
11
+ // Get the pathname of current route, without the optional site baseUrl
12
+ // - /docs/myDoc => /docs/myDoc
13
+ // - /baseUrl/docs/myDoc => /docs/myDoc
14
+ export function useLocalPathname(): string {
15
+ const {
16
+ siteConfig: {baseUrl},
17
+ } = useDocusaurusContext();
18
+ const {pathname} = useLocation();
19
+ return pathname.replace(baseUrl, '/');
20
+ }
@@ -5,10 +5,11 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import {useEffect, useRef} from 'react';
8
+ import {useEffect} from 'react';
9
9
  import {useLocation} from '@docusaurus/router';
10
10
  import {Location} from '@docusaurus/history';
11
11
  import {usePrevious} from './usePrevious';
12
+ import {useDynamicCallback} from './reactUtils';
12
13
 
13
14
  type LocationChangeEvent = {
14
15
  location: Location;
@@ -20,18 +21,15 @@ type OnLocationChange = (locationChangeEvent: LocationChangeEvent) => void;
20
21
  export function useLocationChange(onLocationChange: OnLocationChange): void {
21
22
  const location = useLocation();
22
23
  const previousLocation = usePrevious(location);
23
- const isFirst = useRef<boolean>(true);
24
+
25
+ const onLocationChangeDynamic = useDynamicCallback(onLocationChange);
24
26
 
25
27
  useEffect(() => {
26
- // Prevent first effect to trigger the listener on mount
27
- if (isFirst.current) {
28
- isFirst.current = false;
29
- return;
28
+ if (location !== previousLocation) {
29
+ onLocationChangeDynamic({
30
+ location,
31
+ previousLocation,
32
+ });
30
33
  }
31
-
32
- onLocationChange({
33
- location,
34
- previousLocation,
35
- });
36
- }, [location]);
34
+ }, [onLocationChangeDynamic, location, previousLocation]);
37
35
  }
@@ -112,8 +112,7 @@ export function usePluralForm(): {
112
112
  } {
113
113
  const localePluralForm = useLocalePluralForms();
114
114
  return {
115
- selectMessage: (count: number, pluralMessages: string): string => {
116
- return selectPluralMessage(pluralMessages, count, localePluralForm);
117
- },
115
+ selectMessage: (count: number, pluralMessages: string): string =>
116
+ selectPluralMessage(pluralMessages, count, localePluralForm),
118
117
  };
119
118
  }
@@ -5,12 +5,13 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import {useRef, useEffect} from 'react';
8
+ import {useRef} from 'react';
9
+ import {useIsomorphicLayoutEffect} from './reactUtils';
9
10
 
10
11
  export function usePrevious<T>(value: T): T | undefined {
11
12
  const ref = useRef<T>();
12
13
 
13
- useEffect(() => {
14
+ useIsomorphicLayoutEffect(() => {
14
15
  ref.current = value;
15
16
  });
16
17
 
@@ -0,0 +1,179 @@
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
+
8
+ import {useEffect, useRef} from 'react';
9
+ import {useThemeConfig} from './useThemeConfig';
10
+
11
+ /*
12
+ TODO make the hardcoded theme-classic classnames configurable
13
+ (or add them to ThemeClassNames?)
14
+ */
15
+
16
+ // If the anchor has no height and is just a "marker" in the dom; we'll use the parent (normally the link text) rect boundaries instead
17
+ function getVisibleBoundingClientRect(element: HTMLElement): DOMRect {
18
+ const rect = element.getBoundingClientRect();
19
+ const hasNoHeight = rect.top === rect.bottom;
20
+ if (hasNoHeight) {
21
+ return getVisibleBoundingClientRect(element.parentNode as HTMLElement);
22
+ }
23
+ return rect;
24
+ }
25
+
26
+ // Considering we divide viewport into 2 zones of each 50vh
27
+ // This returns true if an element is in the first zone (ie, appear in viewport, near the top)
28
+ function isInViewportTopHalf(boundingRect: DOMRect) {
29
+ return boundingRect.top > 0 && boundingRect.bottom < window.innerHeight / 2;
30
+ }
31
+
32
+ function getAnchors({
33
+ minHeadingLevel,
34
+ maxHeadingLevel,
35
+ }: {
36
+ minHeadingLevel: number;
37
+ maxHeadingLevel: number;
38
+ }) {
39
+ const selectors = [];
40
+ for (let i = minHeadingLevel; i <= maxHeadingLevel; i += 1) {
41
+ selectors.push(`h${i}.anchor`);
42
+ }
43
+
44
+ return Array.from(
45
+ document.querySelectorAll(selectors.join()),
46
+ ) as HTMLElement[];
47
+ }
48
+
49
+ function getActiveAnchor(
50
+ anchors: HTMLElement[],
51
+ {
52
+ anchorTopOffset,
53
+ }: {
54
+ anchorTopOffset: number;
55
+ },
56
+ ): Element | null {
57
+ // Naming is hard
58
+ // The "nextVisibleAnchor" is the first anchor that appear under the viewport top boundary
59
+ // Note: it does not mean this anchor is visible yet, but if user continues scrolling down, it will be the first to become visible
60
+ const nextVisibleAnchor = anchors.find((anchor) => {
61
+ const boundingRect = getVisibleBoundingClientRect(anchor);
62
+ return boundingRect.top >= anchorTopOffset;
63
+ });
64
+
65
+ if (nextVisibleAnchor) {
66
+ const boundingRect = getVisibleBoundingClientRect(nextVisibleAnchor);
67
+ // If anchor is in the top half of the viewport: it is the one we consider "active"
68
+ // (unless it's too close to the top and and soon to be scrolled outside viewport)
69
+ if (isInViewportTopHalf(boundingRect)) {
70
+ return nextVisibleAnchor;
71
+ }
72
+ // If anchor is in the bottom half of the viewport, or under the viewport, we consider the active anchor is the previous one
73
+ // This is because the main text appearing in the user screen mostly belong to the previous anchor
74
+ else {
75
+ // Returns null for the first anchor, see https://github.com/facebook/docusaurus/issues/5318
76
+ return anchors[anchors.indexOf(nextVisibleAnchor) - 1] ?? null;
77
+ }
78
+ }
79
+ // no anchor under viewport top? (ie we are at the bottom of the page)
80
+ // => highlight the last anchor found
81
+ else {
82
+ return anchors[anchors.length - 1];
83
+ }
84
+ }
85
+
86
+ function getLinkAnchorValue(link: HTMLAnchorElement): string {
87
+ return decodeURIComponent(link.href.substring(link.href.indexOf('#') + 1));
88
+ }
89
+
90
+ function getLinks(linkClassName: string) {
91
+ return Array.from(
92
+ document.getElementsByClassName(linkClassName),
93
+ ) as HTMLAnchorElement[];
94
+ }
95
+
96
+ function getNavbarHeight(): number {
97
+ // Not ideal to obtain actual height this way
98
+ // Using TS ! (not ?) because otherwise a bad selector would be un-noticed
99
+ return document.querySelector('.navbar')!.clientHeight;
100
+ }
101
+
102
+ function useAnchorTopOffsetRef() {
103
+ const anchorTopOffsetRef = useRef<number>(0);
104
+ const {
105
+ navbar: {hideOnScroll},
106
+ } = useThemeConfig();
107
+
108
+ useEffect(() => {
109
+ anchorTopOffsetRef.current = hideOnScroll ? 0 : getNavbarHeight();
110
+ }, [hideOnScroll]);
111
+
112
+ return anchorTopOffsetRef;
113
+ }
114
+
115
+ export type TOCHighlightConfig = {
116
+ linkClassName: string;
117
+ linkActiveClassName: string;
118
+ minHeadingLevel: number;
119
+ maxHeadingLevel: number;
120
+ };
121
+
122
+ function useTOCHighlight(config: TOCHighlightConfig | undefined): void {
123
+ const lastActiveLinkRef = useRef<HTMLAnchorElement | undefined>(undefined);
124
+
125
+ const anchorTopOffsetRef = useAnchorTopOffsetRef();
126
+
127
+ useEffect(() => {
128
+ if (!config) {
129
+ // no-op, highlighting is disabled
130
+ return () => {};
131
+ }
132
+
133
+ const {
134
+ linkClassName,
135
+ linkActiveClassName,
136
+ minHeadingLevel,
137
+ maxHeadingLevel,
138
+ } = config;
139
+
140
+ function updateLinkActiveClass(link: HTMLAnchorElement, active: boolean) {
141
+ if (active) {
142
+ if (lastActiveLinkRef.current && lastActiveLinkRef.current !== link) {
143
+ lastActiveLinkRef.current?.classList.remove(linkActiveClassName);
144
+ }
145
+ link.classList.add(linkActiveClassName);
146
+ lastActiveLinkRef.current = link;
147
+ } else {
148
+ link.classList.remove(linkActiveClassName);
149
+ }
150
+ }
151
+
152
+ function updateActiveLink() {
153
+ const links = getLinks(linkClassName);
154
+ const anchors = getAnchors({minHeadingLevel, maxHeadingLevel});
155
+ const activeAnchor = getActiveAnchor(anchors, {
156
+ anchorTopOffset: anchorTopOffsetRef.current,
157
+ });
158
+ const activeLink = links.find(
159
+ (link) => activeAnchor && activeAnchor.id === getLinkAnchorValue(link),
160
+ );
161
+
162
+ links.forEach((link) => {
163
+ updateLinkActiveClass(link, link === activeLink);
164
+ });
165
+ }
166
+
167
+ document.addEventListener('scroll', updateActiveLink);
168
+ document.addEventListener('resize', updateActiveLink);
169
+
170
+ updateActiveLink();
171
+
172
+ return () => {
173
+ document.removeEventListener('scroll', updateActiveLink);
174
+ document.removeEventListener('resize', updateActiveLink);
175
+ };
176
+ }, [config, anchorTopOffsetRef]);
177
+ }
178
+
179
+ export default useTOCHighlight;
@@ -4,9 +4,11 @@
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
8
  import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
8
9
  import {PrismTheme} from 'prism-react-renderer';
9
10
  import {CSSProperties} from 'react';
11
+ import {DeepPartial} from 'utility-types';
10
12
 
11
13
  export type DocsVersionPersistence = 'localStorage' | 'none';
12
14
 
@@ -16,11 +18,13 @@ export type NavbarItem = {
16
18
  items?: NavbarItem[];
17
19
  label?: string;
18
20
  position?: 'left' | 'right';
19
- };
21
+ } & Record<string, unknown>;
20
22
 
21
23
  export type NavbarLogo = {
22
24
  src: string;
23
25
  srcDark?: string;
26
+ width?: string | number;
27
+ height?: string | number;
24
28
  href?: string;
25
29
  target?: string;
26
30
  alt?: string;
@@ -79,12 +83,20 @@ export type Footer = {
79
83
  alt?: string;
80
84
  src?: string;
81
85
  srcDark?: string;
86
+ width?: string | number;
87
+ height?: string | number;
82
88
  href?: string;
83
89
  };
84
90
  copyright?: string;
85
91
  links: FooterLinks[];
86
92
  };
87
93
 
94
+ export type TableOfContents = {
95
+ minHeadingLevel: number;
96
+ maxHeadingLevel: number;
97
+ };
98
+
99
+ // Theme config after validation/normalization
88
100
  export type ThemeConfig = {
89
101
  docs: {
90
102
  versionPersistence: DocsVersionPersistence;
@@ -101,11 +113,15 @@ export type ThemeConfig = {
101
113
  prism: PrismConfig;
102
114
  footer?: Footer;
103
115
  hideableSidebar: boolean;
104
- image: string;
105
- metadatas: Array<Record<string, string>>;
116
+ image?: string;
117
+ metadata: Array<Record<string, string>>;
106
118
  sidebarCollapsible: boolean;
119
+ tableOfContents: TableOfContents;
107
120
  };
108
121
 
122
+ // User-provided theme config, unnormalized
123
+ export type UserThemeConfig = DeepPartial<ThemeConfig>;
124
+
109
125
  export function useThemeConfig(): ThemeConfig {
110
126
  return useDocusaurusContext().siteConfig.themeConfig as ThemeConfig;
111
127
  }