@docusaurus/theme-common 2.0.0-beta.15d451942 → 2.0.0-beta.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/lib/components/Collapsible/index.d.ts +64 -0
  2. package/lib/components/Collapsible/index.d.ts.map +1 -0
  3. package/lib/components/Collapsible/index.js +152 -0
  4. package/lib/components/Collapsible/index.js.map +1 -0
  5. package/lib/components/Details/index.d.ts +17 -0
  6. package/lib/components/Details/index.d.ts.map +1 -0
  7. package/lib/components/Details/index.js +70 -0
  8. package/lib/components/Details/index.js.map +1 -0
  9. package/lib/components/Details/styles.module.css +58 -0
  10. package/lib/contexts/announcementBar.d.ts +22 -0
  11. package/lib/contexts/announcementBar.d.ts.map +1 -0
  12. package/lib/contexts/announcementBar.js +72 -0
  13. package/lib/contexts/announcementBar.js.map +1 -0
  14. package/lib/contexts/colorMode.d.ts +27 -0
  15. package/lib/contexts/colorMode.d.ts.map +1 -0
  16. package/lib/contexts/colorMode.js +114 -0
  17. package/lib/contexts/colorMode.js.map +1 -0
  18. package/lib/contexts/docSidebarItemsExpandedState.d.ts +31 -0
  19. package/lib/contexts/docSidebarItemsExpandedState.d.ts.map +1 -0
  20. package/lib/contexts/docSidebarItemsExpandedState.js +28 -0
  21. package/lib/contexts/docSidebarItemsExpandedState.js.map +1 -0
  22. package/lib/contexts/docsPreferredVersion.d.ts +28 -0
  23. package/lib/contexts/docsPreferredVersion.d.ts.map +1 -0
  24. package/lib/contexts/docsPreferredVersion.js +125 -0
  25. package/lib/contexts/docsPreferredVersion.js.map +1 -0
  26. package/lib/contexts/docsSidebar.d.ts +20 -0
  27. package/lib/contexts/docsSidebar.d.ts.map +1 -0
  28. package/lib/contexts/docsSidebar.js +29 -0
  29. package/lib/contexts/docsSidebar.js.map +1 -0
  30. package/lib/contexts/docsVersion.d.ts +20 -0
  31. package/lib/contexts/docsVersion.d.ts.map +1 -0
  32. package/lib/contexts/docsVersion.js +26 -0
  33. package/lib/contexts/docsVersion.js.map +1 -0
  34. package/lib/contexts/navbarMobileSidebar.d.ts +31 -0
  35. package/lib/contexts/navbarMobileSidebar.d.ts.map +1 -0
  36. package/lib/contexts/navbarMobileSidebar.js +56 -0
  37. package/lib/contexts/navbarMobileSidebar.js.map +1 -0
  38. package/lib/contexts/navbarSecondaryMenu.d.ts +38 -0
  39. package/lib/contexts/navbarSecondaryMenu.d.ts.map +1 -0
  40. package/lib/contexts/navbarSecondaryMenu.js +93 -0
  41. package/lib/contexts/navbarSecondaryMenu.js.map +1 -0
  42. package/lib/contexts/tabGroupChoice.d.ts +21 -0
  43. package/lib/contexts/tabGroupChoice.d.ts.map +1 -0
  44. package/lib/contexts/tabGroupChoice.js +49 -0
  45. package/lib/contexts/tabGroupChoice.js.map +1 -0
  46. package/lib/{utils/useChangeRoute.d.ts → hooks/styles.css} +4 -1
  47. package/lib/hooks/useHideableNavbar.d.ts +17 -0
  48. package/lib/hooks/useHideableNavbar.d.ts.map +1 -0
  49. package/lib/hooks/useHideableNavbar.js +61 -0
  50. package/lib/hooks/useHideableNavbar.js.map +1 -0
  51. package/lib/hooks/useKeyboardNavigation.d.ts +20 -0
  52. package/lib/hooks/useKeyboardNavigation.d.ts.map +1 -0
  53. package/lib/hooks/useKeyboardNavigation.js +39 -0
  54. package/lib/hooks/useKeyboardNavigation.js.map +1 -0
  55. package/lib/hooks/useLockBodyScroll.d.ts +12 -0
  56. package/lib/hooks/useLockBodyScroll.d.ts.map +1 -0
  57. package/lib/hooks/useLockBodyScroll.js +20 -0
  58. package/lib/hooks/useLockBodyScroll.js.map +1 -0
  59. package/lib/hooks/usePrismTheme.d.ts +13 -0
  60. package/lib/hooks/usePrismTheme.d.ts.map +1 -0
  61. package/lib/hooks/usePrismTheme.js +22 -0
  62. package/lib/hooks/usePrismTheme.js.map +1 -0
  63. package/lib/hooks/useSearchPage.d.ts +25 -0
  64. package/lib/hooks/useSearchPage.d.ts.map +1 -0
  65. package/lib/hooks/useSearchPage.js +43 -0
  66. package/lib/hooks/useSearchPage.js.map +1 -0
  67. package/lib/hooks/useTOCHighlight.d.ts +25 -0
  68. package/lib/hooks/useTOCHighlight.d.ts.map +1 -0
  69. package/lib/hooks/useTOCHighlight.js +130 -0
  70. package/lib/hooks/useTOCHighlight.js.map +1 -0
  71. package/lib/hooks/useWindowSize.d.ts +28 -0
  72. package/lib/hooks/useWindowSize.d.ts.map +1 -0
  73. package/lib/hooks/useWindowSize.js +59 -0
  74. package/lib/hooks/useWindowSize.js.map +1 -0
  75. package/lib/index.d.ts +36 -9
  76. package/lib/index.d.ts.map +1 -0
  77. package/lib/index.js +36 -8
  78. package/lib/index.js.map +1 -0
  79. package/lib/utils/ThemeClassNames.d.ts +47 -12
  80. package/lib/utils/ThemeClassNames.d.ts.map +1 -0
  81. package/lib/utils/ThemeClassNames.js +45 -4
  82. package/lib/utils/ThemeClassNames.js.map +1 -0
  83. package/lib/utils/codeBlockUtils.d.ts +33 -0
  84. package/lib/utils/codeBlockUtils.d.ts.map +1 -0
  85. package/lib/utils/codeBlockUtils.js +126 -3
  86. package/lib/utils/codeBlockUtils.js.map +1 -0
  87. package/lib/utils/docsUtils.d.ts +33 -0
  88. package/lib/utils/docsUtils.d.ts.map +1 -0
  89. package/lib/utils/docsUtils.js +118 -1
  90. package/lib/utils/docsUtils.js.map +1 -0
  91. package/lib/utils/footerUtils.d.ts +13 -0
  92. package/lib/utils/footerUtils.d.ts.map +1 -0
  93. package/lib/utils/footerUtils.js +14 -0
  94. package/lib/utils/footerUtils.js.map +1 -0
  95. package/lib/utils/generalUtils.d.ts +11 -1
  96. package/lib/utils/generalUtils.d.ts.map +1 -0
  97. package/lib/utils/generalUtils.js +9 -5
  98. package/lib/utils/generalUtils.js.map +1 -0
  99. package/lib/utils/historyUtils.d.ts +17 -0
  100. package/lib/utils/historyUtils.d.ts.map +1 -0
  101. package/lib/utils/historyUtils.js +38 -0
  102. package/lib/utils/historyUtils.js.map +1 -0
  103. package/lib/utils/jsUtils.d.ts +23 -0
  104. package/lib/utils/jsUtils.d.ts.map +1 -0
  105. package/lib/utils/jsUtils.js +29 -0
  106. package/lib/utils/jsUtils.js.map +1 -0
  107. package/lib/utils/metadataUtils.d.ts +38 -0
  108. package/lib/utils/metadataUtils.d.ts.map +1 -0
  109. package/lib/utils/metadataUtils.js +61 -0
  110. package/lib/utils/metadataUtils.js.map +1 -0
  111. package/lib/utils/navbarUtils.d.ts +21 -0
  112. package/lib/utils/navbarUtils.d.ts.map +1 -0
  113. package/lib/utils/navbarUtils.js +30 -0
  114. package/lib/utils/navbarUtils.js.map +1 -0
  115. package/lib/utils/reactUtils.d.ts +42 -0
  116. package/lib/utils/reactUtils.d.ts.map +1 -0
  117. package/lib/utils/reactUtils.js +64 -0
  118. package/lib/utils/reactUtils.js.map +1 -0
  119. package/lib/utils/regexpUtils.d.ts +12 -0
  120. package/lib/utils/regexpUtils.d.ts.map +1 -0
  121. package/lib/utils/regexpUtils.js +18 -0
  122. package/lib/utils/regexpUtils.js.map +1 -0
  123. package/lib/utils/routesUtils.d.ts +26 -0
  124. package/lib/utils/routesUtils.d.ts.map +1 -0
  125. package/lib/utils/routesUtils.js +54 -0
  126. package/lib/utils/routesUtils.js.map +1 -0
  127. package/lib/utils/scrollUtils.d.ts +59 -0
  128. package/lib/utils/scrollUtils.d.ts.map +1 -0
  129. package/lib/utils/scrollUtils.js +148 -0
  130. package/lib/utils/scrollUtils.js.map +1 -0
  131. package/lib/utils/searchUtils.d.ts +13 -0
  132. package/lib/utils/searchUtils.d.ts.map +1 -0
  133. package/lib/utils/searchUtils.js +35 -0
  134. package/lib/utils/searchUtils.js.map +1 -0
  135. package/lib/utils/storageUtils.d.ts +13 -5
  136. package/lib/utils/storageUtils.d.ts.map +1 -0
  137. package/lib/utils/storageUtils.js +58 -25
  138. package/lib/utils/storageUtils.js.map +1 -0
  139. package/lib/utils/tagsUtils.d.ts +22 -0
  140. package/lib/utils/tagsUtils.d.ts.map +1 -0
  141. package/lib/utils/tagsUtils.js +36 -0
  142. package/lib/utils/tagsUtils.js.map +1 -0
  143. package/lib/utils/tocUtils.d.ts +36 -0
  144. package/lib/utils/tocUtils.d.ts.map +1 -0
  145. package/lib/utils/tocUtils.js +84 -0
  146. package/lib/utils/tocUtils.js.map +1 -0
  147. package/lib/utils/useAlternatePageUtils.d.ts +21 -1
  148. package/lib/utils/useAlternatePageUtils.d.ts.map +1 -0
  149. package/lib/utils/useAlternatePageUtils.js +9 -4
  150. package/lib/utils/useAlternatePageUtils.js.map +1 -0
  151. package/lib/utils/useLocalPathname.d.ts +13 -0
  152. package/lib/utils/useLocalPathname.d.ts.map +1 -0
  153. package/lib/utils/useLocalPathname.js +19 -0
  154. package/lib/utils/useLocalPathname.js.map +1 -0
  155. package/lib/utils/useLocationChange.d.ts +17 -0
  156. package/lib/utils/useLocationChange.d.ts.map +1 -0
  157. package/lib/utils/useLocationChange.js +31 -0
  158. package/lib/utils/useLocationChange.js.map +1 -0
  159. package/lib/utils/usePluralForm.d.ts +12 -0
  160. package/lib/utils/usePluralForm.d.ts.map +1 -0
  161. package/lib/utils/usePluralForm.js +36 -37
  162. package/lib/utils/usePluralForm.js.map +1 -0
  163. package/lib/utils/useThemeConfig.d.ts +50 -22
  164. package/lib/utils/useThemeConfig.d.ts.map +1 -0
  165. package/lib/utils/useThemeConfig.js +4 -0
  166. package/lib/utils/useThemeConfig.js.map +1 -0
  167. package/package.json +18 -13
  168. package/src/components/Collapsible/index.tsx +265 -0
  169. package/src/components/Details/index.tsx +107 -0
  170. package/src/components/Details/styles.module.css +58 -0
  171. package/src/contexts/announcementBar.tsx +119 -0
  172. package/src/contexts/colorMode.tsx +176 -0
  173. package/src/contexts/docSidebarItemsExpandedState.tsx +55 -0
  174. package/src/contexts/docsPreferredVersion.tsx +250 -0
  175. package/src/contexts/docsSidebar.tsx +42 -0
  176. package/src/contexts/docsVersion.tsx +36 -0
  177. package/src/contexts/navbarMobileSidebar.tsx +99 -0
  178. package/src/contexts/navbarSecondaryMenu.tsx +170 -0
  179. package/src/contexts/tabGroupChoice.tsx +82 -0
  180. package/{lib/utils/pathUtils.d.ts → src/hooks/styles.css} +4 -1
  181. package/src/hooks/useHideableNavbar.ts +77 -0
  182. package/src/hooks/useKeyboardNavigation.ts +45 -0
  183. package/src/hooks/useLockBodyScroll.ts +21 -0
  184. package/src/hooks/usePrismTheme.ts +24 -0
  185. package/src/hooks/useSearchPage.ts +79 -0
  186. package/src/hooks/useTOCHighlight.ts +192 -0
  187. package/src/hooks/useWindowSize.ts +72 -0
  188. package/src/index.ts +129 -18
  189. package/src/types.d.ts +0 -2
  190. package/src/utils/ThemeClassNames.ts +51 -5
  191. package/src/utils/codeBlockUtils.ts +155 -2
  192. package/src/utils/docsUtils.tsx +180 -0
  193. package/src/utils/footerUtils.ts +18 -0
  194. package/src/utils/generalUtils.ts +9 -5
  195. package/src/utils/historyUtils.ts +45 -0
  196. package/src/utils/jsUtils.ts +36 -0
  197. package/src/utils/metadataUtils.tsx +115 -0
  198. package/src/utils/navbarUtils.tsx +40 -0
  199. package/src/utils/reactUtils.tsx +76 -0
  200. package/src/utils/regexpUtils.ts +24 -0
  201. package/src/utils/routesUtils.ts +75 -0
  202. package/src/utils/scrollUtils.tsx +234 -0
  203. package/src/utils/searchUtils.ts +49 -0
  204. package/src/utils/storageUtils.ts +57 -24
  205. package/src/utils/tagsUtils.ts +55 -0
  206. package/src/utils/tocUtils.ts +119 -0
  207. package/src/utils/useAlternatePageUtils.ts +28 -7
  208. package/src/utils/useLocalPathname.ts +22 -0
  209. package/src/utils/useLocationChange.ts +41 -0
  210. package/src/utils/usePluralForm.ts +49 -39
  211. package/src/utils/useThemeConfig.ts +49 -24
  212. package/lib/.tsbuildinfo +0 -4159
  213. package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.d.ts +0 -21
  214. package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.js +0 -94
  215. package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.d.ts +0 -13
  216. package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.js +0 -20
  217. package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.d.ts +0 -5
  218. package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.js +0 -41
  219. package/lib/utils/pathUtils.js +0 -13
  220. package/lib/utils/useChangeRoute.js +0 -18
  221. package/src/utils/__tests__/codeBlockUtils.test.ts +0 -54
  222. package/src/utils/__tests__/pathUtils.test.ts +0 -32
  223. package/src/utils/docsPreferredVersion/DocsPreferredVersionProvider.tsx +0 -165
  224. package/src/utils/docsPreferredVersion/DocsPreferredVersionStorage.ts +0 -34
  225. package/src/utils/docsPreferredVersion/useDocsPreferredVersion.ts +0 -66
  226. package/src/utils/docsUtils.ts +0 -11
  227. package/src/utils/pathUtils.ts +0 -17
  228. package/src/utils/useChangeRoute.ts +0 -21
  229. package/tsconfig.json +0 -10
@@ -4,6 +4,123 @@
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 } from '@theme/hooks/useDocs';
7
+ import { useAllDocsData, useActivePlugin, } from '@docusaurus/plugin-content-docs/client';
8
+ import { useDocsVersion } from '../contexts/docsVersion';
9
+ import { useDocsSidebar } from '../contexts/docsSidebar';
10
+ import { isSamePath } from './routesUtils';
11
+ import { useLocation } from '@docusaurus/router';
8
12
  // TODO not ideal, see also "useDocs"
9
13
  export const isDocsPluginEnabled = !!useAllDocsData;
14
+ export function useDocById(id) {
15
+ const version = useDocsVersion();
16
+ if (!id) {
17
+ return undefined;
18
+ }
19
+ const doc = version.docs[id];
20
+ if (!doc) {
21
+ throw new Error(`no version doc found by id=${id}`);
22
+ }
23
+ return doc;
24
+ }
25
+ /**
26
+ * Pure function, similar to `Array#find`, but works on the sidebar tree.
27
+ */
28
+ export function findSidebarCategory(sidebar, predicate) {
29
+ for (const item of sidebar) {
30
+ if (item.type === 'category') {
31
+ if (predicate(item)) {
32
+ return item;
33
+ }
34
+ const subItem = findSidebarCategory(item.items, predicate);
35
+ if (subItem) {
36
+ return subItem;
37
+ }
38
+ }
39
+ }
40
+ return undefined;
41
+ }
42
+ /**
43
+ * Best effort to assign a link to a sidebar category. If the category doesn't
44
+ * have a link itself, we link to the first sub item with a link.
45
+ */
46
+ export function findFirstCategoryLink(item) {
47
+ if (item.href) {
48
+ return item.href;
49
+ }
50
+ for (const subItem of item.items) {
51
+ if (subItem.type === 'link') {
52
+ return subItem.href;
53
+ }
54
+ else if (subItem.type === 'category') {
55
+ const categoryLink = findFirstCategoryLink(subItem);
56
+ if (categoryLink) {
57
+ return categoryLink;
58
+ }
59
+ }
60
+ else if (subItem.type === 'html') {
61
+ // skip
62
+ }
63
+ else {
64
+ throw new Error(`Unexpected category item type for ${JSON.stringify(subItem)}`);
65
+ }
66
+ }
67
+ return undefined;
68
+ }
69
+ /**
70
+ * Gets the category associated with the current location. Should only be used
71
+ * on category index pages.
72
+ */
73
+ export function useCurrentSidebarCategory() {
74
+ const { pathname } = useLocation();
75
+ const sidebar = useDocsSidebar();
76
+ if (!sidebar) {
77
+ throw new Error('Unexpected: cant find current sidebar in context');
78
+ }
79
+ const category = findSidebarCategory(sidebar, (item) => isSamePath(item.href, pathname));
80
+ if (!category) {
81
+ throw new Error(`${pathname} is not associated with a category. useCurrentSidebarCategory() should only be used on category index pages.`);
82
+ }
83
+ return category;
84
+ }
85
+ const isActive = (testedPath, activePath) => typeof testedPath !== 'undefined' && isSamePath(testedPath, activePath);
86
+ const containsActiveSidebarItem = (items, activePath) => items.some((subItem) => isActiveSidebarItem(subItem, activePath));
87
+ /**
88
+ * Checks if a sidebar item should be active, based on the active path.
89
+ */
90
+ export function isActiveSidebarItem(item, activePath) {
91
+ if (item.type === 'link') {
92
+ return isActive(item.href, activePath);
93
+ }
94
+ if (item.type === 'category') {
95
+ return (isActive(item.href, activePath) ||
96
+ containsActiveSidebarItem(item.items, activePath));
97
+ }
98
+ return false;
99
+ }
100
+ /**
101
+ * Gets the breadcrumbs of the current doc page, based on its sidebar location.
102
+ * Returns `null` if there's no sidebar or breadcrumbs are disabled.
103
+ */
104
+ export function useSidebarBreadcrumbs() {
105
+ const sidebar = useDocsSidebar();
106
+ const { pathname } = useLocation();
107
+ const breadcrumbsOption = useActivePlugin()?.pluginData.breadcrumbs;
108
+ if (breadcrumbsOption === false || !sidebar) {
109
+ return null;
110
+ }
111
+ const breadcrumbs = [];
112
+ function extract(items) {
113
+ for (const item of items) {
114
+ if ((item.type === 'category' &&
115
+ (isSamePath(item.href, pathname) || extract(item.items))) ||
116
+ (item.type === 'link' && isSamePath(item.href, pathname))) {
117
+ breadcrumbs.push(item);
118
+ return true;
119
+ }
120
+ }
121
+ return false;
122
+ }
123
+ extract(sidebar);
124
+ return breadcrumbs.reverse();
125
+ }
126
+ //# sourceMappingURL=docsUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docsUtils.js","sourceRoot":"","sources":["../../src/utils/docsUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,cAAc,EACd,eAAe,GAChB,MAAM,wCAAwC,CAAC;AAQhD,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAE/C,qCAAqC;AACrC,MAAM,CAAC,MAAM,mBAAmB,GAAY,CAAC,CAAC,cAAc,CAAC;AAU7D,MAAM,UAAU,UAAU,CAAC,EAAsB;IAC/C,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;IACjC,IAAI,CAAC,EAAE,EAAE;QACP,OAAO,SAAS,CAAC;KAClB;IACD,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC7B,IAAI,CAAC,GAAG,EAAE;QACR,MAAM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,EAAC,QAAQ,EAAC,GAAG,WAAW,EAAE,CAAC;IACjC,MAAM,iBAAiB,GAAG,eAAe,EAAE,EAAE,UAAU,CAAC,WAAW,CAAC;IAEpE,IAAI,iBAAiB,KAAK,KAAK,IAAI,CAAC,OAAO,EAAE;QAC3C,OAAO,IAAI,CAAC;KACb;IAED,MAAM,WAAW,GAAiC,EAAE,CAAC;IAErD,SAAS,OAAO,CAAC,KAAkB;QACjC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,IACE,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU;gBACvB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC3D,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,EACzD;gBACA,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACvB,OAAO,IAAI,CAAC;aACb;SACF;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CAAC,OAAO,CAAC,CAAC;IAEjB,OAAO,WAAW,CAAC,OAAO,EAAE,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,13 @@
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 { MultiColumnFooter, SimpleFooter } from './useThemeConfig';
8
+ /**
9
+ * A rough duck-typing about whether the `footer.links` is intended to be multi-
10
+ * column.
11
+ */
12
+ export declare function isMultiColumnFooterLinks(links: MultiColumnFooter['links'] | SimpleFooter['links']): links is MultiColumnFooter['links'];
13
+ //# sourceMappingURL=footerUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"footerUtils.d.ts","sourceRoot":"","sources":["../../src/utils/footerUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAC,iBAAiB,EAAE,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAEtE;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,GACxD,KAAK,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAErC"}
@@ -0,0 +1,14 @@
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
+ * A rough duck-typing about whether the `footer.links` is intended to be multi-
9
+ * column.
10
+ */
11
+ export function isMultiColumnFooterLinks(links) {
12
+ return 'title' in links[0];
13
+ }
14
+ //# sourceMappingURL=footerUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"footerUtils.js","sourceRoot":"","sources":["../../src/utils/footerUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CACtC,KAAyD;IAEzD,OAAO,OAAO,IAAI,KAAK,CAAC,CAAC,CAAE,CAAC;AAC9B,CAAC"}
@@ -1 +1,11 @@
1
- export declare const useTitleFormatter: (title?: string | undefined) => string;
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
+ * Formats the page's title based on relevant site config and other contexts.
9
+ */
10
+ export declare function useTitleFormatter(title?: string | undefined): string;
11
+ //# sourceMappingURL=generalUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generalUtils.d.ts","sourceRoot":"","sources":["../../src/utils/generalUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAMpE"}
@@ -5,10 +5,14 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
8
- export const useTitleFormatter = (title) => {
9
- const { siteConfig = {} } = useDocusaurusContext();
10
- const { title: siteTitle, titleDelimiter = '|' } = siteConfig;
11
- return title && title.trim().length
8
+ /**
9
+ * Formats the page's title based on relevant site config and other contexts.
10
+ */
11
+ export function useTitleFormatter(title) {
12
+ const { siteConfig } = useDocusaurusContext();
13
+ const { title: siteTitle, titleDelimiter } = siteConfig;
14
+ return title?.trim().length
12
15
  ? `${title.trim()} ${titleDelimiter} ${siteTitle}`
13
16
  : siteTitle;
14
- };
17
+ }
18
+ //# sourceMappingURL=generalUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generalUtils.js","sourceRoot":"","sources":["../../src/utils/generalUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AAEpE;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA0B;IAC1D,MAAM,EAAC,UAAU,EAAC,GAAG,oBAAoB,EAAE,CAAC;IAC5C,MAAM,EAAC,KAAK,EAAE,SAAS,EAAE,cAAc,EAAC,GAAG,UAAU,CAAC;IACtD,OAAO,KAAK,EAAE,IAAI,EAAE,CAAC,MAAM;QACzB,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,IAAI,cAAc,IAAI,SAAS,EAAE;QAClD,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
@@ -0,0 +1,17 @@
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 { Location, Action } from 'history';
8
+ declare type HistoryBlockHandler = (location: Location, action: Action) => void | false;
9
+ /**
10
+ * Permits to register a handler that will be called on history pop navigation
11
+ * (backward/forward). If the handler returns `false`, the backward/forward
12
+ * transition will be blocked. Unfortunately there's no good way to detect the
13
+ * "direction" (backward/forward) of the POP event.
14
+ */
15
+ export declare function useHistoryPopHandler(handler: HistoryBlockHandler): void;
16
+ export {};
17
+ //# sourceMappingURL=historyUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"historyUtils.d.ts","sourceRoot":"","sources":["../../src/utils/historyUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAC,QAAQ,EAAE,MAAM,EAAC,MAAM,SAAS,CAAC;AAE9C,aAAK,mBAAmB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,KAAK,CAAC;AAiBhF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CASvE"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { useEffect } from 'react';
8
+ import { useHistory } from '@docusaurus/router';
9
+ import { useDynamicCallback } from './reactUtils';
10
+ /**
11
+ * Permits to register a handler that will be called on history actions (pop,
12
+ * push, replace). If the handler returns `false`, the navigation transition
13
+ * will be blocked/cancelled.
14
+ */
15
+ function useHistoryActionHandler(handler) {
16
+ const { block } = useHistory();
17
+ const stableHandler = useDynamicCallback(handler);
18
+ useEffect(
19
+ // See https://github.com/remix-run/history/blob/main/docs/blocking-transitions.md
20
+ () => block((location, action) => stableHandler(location, action)), [block, stableHandler]);
21
+ }
22
+ /**
23
+ * Permits to register a handler that will be called on history pop navigation
24
+ * (backward/forward). If the handler returns `false`, the backward/forward
25
+ * transition will be blocked. Unfortunately there's no good way to detect the
26
+ * "direction" (backward/forward) of the POP event.
27
+ */
28
+ export function useHistoryPopHandler(handler) {
29
+ useHistoryActionHandler((location, action) => {
30
+ if (action === 'POP') {
31
+ // Maybe block navigation if handler returns false
32
+ return handler(location, action);
33
+ }
34
+ // Don't block other navigation actions
35
+ return undefined;
36
+ });
37
+ }
38
+ //# sourceMappingURL=historyUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"historyUtils.js","sourceRoot":"","sources":["../../src/utils/historyUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAChC,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAKhD;;;;GAIG;AACH,SAAS,uBAAuB,CAAC,OAA4B;IAC3D,MAAM,EAAC,KAAK,EAAC,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,aAAa,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAClD,SAAS;IACP,kFAAkF;IAClF,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,EAClE,CAAC,KAAK,EAAE,aAAa,CAAC,CACvB,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAA4B;IAC/D,uBAAuB,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE;QAC3C,IAAI,MAAM,KAAK,KAAK,EAAE;YACpB,kDAAkD;YAClD,OAAO,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;SAClC;QACD,uCAAuC;QACvC,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,23 @@
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
+ * Gets the duplicate values in an array.
9
+ * @param arr The array.
10
+ * @param comparator Compares two values and returns `true` if they are equal
11
+ * (duplicated).
12
+ * @returns Value of the elements `v` that have a preceding element `u` where
13
+ * `comparator(u, v) === true`. Values within the returned array are not
14
+ * guaranteed to be unique.
15
+ */
16
+ export declare function duplicates<T>(arr: readonly T[], comparator?: (a: T, b: T) => boolean): T[];
17
+ /**
18
+ * Remove duplicate array items (similar to `_.uniq`)
19
+ * @param arr The array.
20
+ * @returns An array with duplicate elements removed by reference comparison.
21
+ */
22
+ export declare function uniq<T>(arr: T[]): T[];
23
+ //# sourceMappingURL=jsUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsUtils.d.ts","sourceRoot":"","sources":["../../src/utils/jsUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,GAAG,EAAE,SAAS,CAAC,EAAE,EACjB,UAAU,GAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAA2B,GACtD,CAAC,EAAE,CAIL;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAGrC"}
@@ -0,0 +1,29 @@
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
+ // A replacement of lodash in client code
8
+ /**
9
+ * Gets the duplicate values in an array.
10
+ * @param arr The array.
11
+ * @param comparator Compares two values and returns `true` if they are equal
12
+ * (duplicated).
13
+ * @returns Value of the elements `v` that have a preceding element `u` where
14
+ * `comparator(u, v) === true`. Values within the returned array are not
15
+ * guaranteed to be unique.
16
+ */
17
+ export function duplicates(arr, comparator = (a, b) => a === b) {
18
+ return arr.filter((v, vIndex) => arr.findIndex((u) => comparator(u, v)) !== vIndex);
19
+ }
20
+ /**
21
+ * Remove duplicate array items (similar to `_.uniq`)
22
+ * @param arr The array.
23
+ * @returns An array with duplicate elements removed by reference comparison.
24
+ */
25
+ export function uniq(arr) {
26
+ // Note: had problems with [...new Set()]: https://github.com/facebook/docusaurus/issues/4972#issuecomment-863895061
27
+ return Array.from(new Set(arr));
28
+ }
29
+ //# sourceMappingURL=jsUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsUtils.js","sourceRoot":"","sources":["../../src/utils/jsUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,yCAAyC;AAEzC;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CACxB,GAAiB,EACjB,aAAsC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC;IAEvD,OAAO,GAAG,CAAC,MAAM,CACf,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,MAAM,CACjE,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAI,GAAQ;IAC9B,oHAAoH;IACpH,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,38 @@
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
+ interface PageMetadataProps {
9
+ readonly title?: string;
10
+ readonly description?: string;
11
+ readonly keywords?: readonly string[] | string;
12
+ readonly image?: string;
13
+ readonly children?: ReactNode;
14
+ }
15
+ /**
16
+ * Helper component to manipulate page metadata and override site defaults.
17
+ * Works in the same way as Helmet.
18
+ */
19
+ export declare function PageMetadata({ title, description, keywords, image, children, }: PageMetadataProps): JSX.Element;
20
+ /**
21
+ * Every layer of this provider will append a class name to the HTML element.
22
+ * There's no consumer for this hook: it's side-effect-only. This wrapper is
23
+ * necessary because Helmet does not "merge" classes.
24
+ * @see https://github.com/staylor/react-helmet-async/issues/161
25
+ */
26
+ export declare function HtmlClassNameProvider({ className: classNameProp, children, }: {
27
+ className: string;
28
+ children: ReactNode;
29
+ }): JSX.Element;
30
+ /**
31
+ * A very thin wrapper around `HtmlClassNameProvider` that adds the plugin ID +
32
+ * name to the HTML class name.
33
+ */
34
+ export declare function PluginHtmlClassNameProvider({ children, }: {
35
+ children: ReactNode;
36
+ }): JSX.Element;
37
+ export {};
38
+ //# sourceMappingURL=metadataUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadataUtils.d.ts","sourceRoot":"","sources":["../../src/utils/metadataUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAO5C,UAAU,iBAAiB;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC;IAC/C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,WAAW,EACX,QAAQ,EACR,KAAK,EACL,QAAQ,GACT,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CA6BjC;AAID;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EAAE,aAAa,EACxB,QAAQ,GACT,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAWd;AASD;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CASd"}
@@ -0,0 +1,61 @@
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 from 'react';
8
+ import Head from '@docusaurus/Head';
9
+ import clsx from 'clsx';
10
+ import useRouteContext from '@docusaurus/useRouteContext';
11
+ import { useBaseUrlUtils } from '@docusaurus/useBaseUrl';
12
+ import { useTitleFormatter } from './generalUtils';
13
+ /**
14
+ * Helper component to manipulate page metadata and override site defaults.
15
+ * Works in the same way as Helmet.
16
+ */
17
+ export function PageMetadata({ title, description, keywords, image, children, }) {
18
+ const pageTitle = useTitleFormatter(title);
19
+ const { withBaseUrl } = useBaseUrlUtils();
20
+ const pageImage = image ? withBaseUrl(image, { absolute: true }) : undefined;
21
+ return (React.createElement(Head, null,
22
+ title && React.createElement("title", null, pageTitle),
23
+ title && React.createElement("meta", { property: "og:title", content: pageTitle }),
24
+ description && React.createElement("meta", { name: "description", content: description }),
25
+ description && React.createElement("meta", { property: "og:description", content: description }),
26
+ keywords && (React.createElement("meta", { name: "keywords", content:
27
+ // https://github.com/microsoft/TypeScript/issues/17002
28
+ (Array.isArray(keywords) ? keywords.join(',') : keywords) })),
29
+ pageImage && React.createElement("meta", { property: "og:image", content: pageImage }),
30
+ pageImage && React.createElement("meta", { name: "twitter:image", content: pageImage }),
31
+ children));
32
+ }
33
+ const HtmlClassNameContext = React.createContext(undefined);
34
+ /**
35
+ * Every layer of this provider will append a class name to the HTML element.
36
+ * There's no consumer for this hook: it's side-effect-only. This wrapper is
37
+ * necessary because Helmet does not "merge" classes.
38
+ * @see https://github.com/staylor/react-helmet-async/issues/161
39
+ */
40
+ export function HtmlClassNameProvider({ className: classNameProp, children, }) {
41
+ const classNameContext = React.useContext(HtmlClassNameContext);
42
+ const className = clsx(classNameContext, classNameProp);
43
+ return (React.createElement(HtmlClassNameContext.Provider, { value: className },
44
+ React.createElement(Head, null,
45
+ React.createElement("html", { className: className })),
46
+ children));
47
+ }
48
+ function pluginNameToClassName(pluginName) {
49
+ return `plugin-${pluginName.replace(/docusaurus-(?:plugin|theme)-(?:content-)?/gi, '')}`;
50
+ }
51
+ /**
52
+ * A very thin wrapper around `HtmlClassNameProvider` that adds the plugin ID +
53
+ * name to the HTML class name.
54
+ */
55
+ export function PluginHtmlClassNameProvider({ children, }) {
56
+ const routeContext = useRouteContext();
57
+ const nameClass = pluginNameToClassName(routeContext.plugin.name);
58
+ const idClass = `plugin-id-${routeContext.plugin.id}`;
59
+ return (React.createElement(HtmlClassNameProvider, { className: clsx(nameClass, idClass) }, children));
60
+ }
61
+ //# sourceMappingURL=metadataUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadataUtils.js","sourceRoot":"","sources":["../../src/utils/metadataUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AAUjD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,KAAK,EACL,WAAW,EACX,QAAQ,EACR,KAAK,EACL,QAAQ,GACU;IAClB,MAAM,SAAS,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC3C,MAAM,EAAC,WAAW,EAAC,GAAG,eAAe,EAAE,CAAC;IACxC,MAAM,SAAS,GAAG,KAAK,C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AS,GAAI,CACzB;QACN,QAAQ,CACqB,CACjC,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAAC,UAAkB;IAC/C,OAAO,UAAU,UAAU,CAAC,OAAO,CACjC,6CAA6C,EAC7C,EAAE,CACH,EAAE,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,EAC1C,QAAQ,GAGT;IACC,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IACvC,MAAM,SAAS,GAAG,qBAAqB,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClE,MAAM,OAAO,GAAG,aAAa,YAAY,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;IACtD,OAAO,CACL,oBAAC,qBAAqB,IAAC,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,IACvD,QAAQ,CACa,CACzB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,21 @@
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
+ /**
9
+ * Split links by left/right. If position is unspecified, fallback to right.
10
+ */
11
+ export declare function splitNavbarItems<T extends {
12
+ position?: 'left' | 'right';
13
+ }>(items: T[]): [leftItems: T[], rightItems: T[]];
14
+ /**
15
+ * Composes the `NavbarMobileSidebarProvider` and `NavbarSecondaryMenuProvider`.
16
+ * Because the latter depends on the former, they can't be re-ordered.
17
+ */
18
+ export declare function NavbarProvider({ children }: {
19
+ children: ReactNode;
20
+ }): JSX.Element;
21
+ //# sourceMappingURL=navbarUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navbarUtils.d.ts","sourceRoot":"","sources":["../../src/utils/navbarUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAM5C;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAAC,EACtE,KAAK,EAAE,CAAC,EAAE,GACT,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CASnC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAC,QAAQ,EAAC,EAAE;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAC,GAAG,GAAG,CAAC,OAAO,CAM7E"}
@@ -0,0 +1,30 @@
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 from 'react';
8
+ import { NavbarMobileSidebarProvider } from '../contexts/navbarMobileSidebar';
9
+ import { NavbarSecondaryMenuProvider } from '../contexts/navbarSecondaryMenu';
10
+ const DefaultNavItemPosition = 'right';
11
+ /**
12
+ * Split links by left/right. If position is unspecified, fallback to right.
13
+ */
14
+ export function splitNavbarItems(items) {
15
+ function isLeft(item) {
16
+ return (item.position ?? DefaultNavItemPosition) === 'left';
17
+ }
18
+ const leftItems = items.filter(isLeft);
19
+ const rightItems = items.filter((item) => !isLeft(item));
20
+ return [leftItems, rightItems];
21
+ }
22
+ /**
23
+ * Composes the `NavbarMobileSidebarProvider` and `NavbarSecondaryMenuProvider`.
24
+ * Because the latter depends on the former, they can't be re-ordered.
25
+ */
26
+ export function NavbarProvider({ children }) {
27
+ return (React.createElement(NavbarMobileSidebarProvider, null,
28
+ React.createElement(NavbarSecondaryMenuProvider, null, children)));
29
+ }
30
+ //# sourceMappingURL=navbarUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navbarUtils.js","sourceRoot":"","sources":["../../src/utils/navbarUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAC,2BAA2B,EAAC,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAC,2BAA2B,EAAC,MAAM,iCAAiC,CAAC;AAE5E,MAAM,sBAAsB,GAAG,OAAO,CAAC;AAEvC;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAU;IAEV,SAAS,MAAM,CAAC,IAAO;QACrB,OAAO,CAAC,IAAI,CAAC,QAAQ,IAAI,sBAAsB,CAAC,KAAK,MAAM,CAAC;IAC9D,CAAC;IAED,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAEzD,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AACjC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,EAAC,QAAQ,EAAwB;IAC9D,OAAO,CACL,oBAAC,2BAA2B;QAC1B,oBAAC,2BAA2B,QAAE,QAAQ,CAA+B,CACzC,CAC/B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,42 @@
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 { useLayoutEffect } from 'react';
8
+ /**
9
+ * This hook is like `useLayoutEffect`, but without the SSR warning.
10
+ * It seems hacky but it's used in many React libs (Redux, Formik...).
11
+ * Also mentioned here: https://github.com/facebook/react/issues/16956
12
+ *
13
+ * It is useful when you need to update a ref as soon as possible after a React
14
+ * render (before `useEffect`).
15
+ */
16
+ export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
17
+ /**
18
+ * Permits to transform an unstable callback (like an arrow function provided as
19
+ * props) to a "stable" callback that is safe to use in a `useEffect` dependency
20
+ * array. Useful to avoid React stale closure problems + avoid useless effect
21
+ * re-executions.
22
+ *
23
+ * Workaround until the React team recommends a good solution, see
24
+ * https://github.com/facebook/react/issues/16956
25
+ *
26
+ * This generally works but has some potential drawbacks, such as
27
+ * https://github.com/facebook/react/issues/16956#issuecomment-536636418
28
+ */
29
+ export declare function useDynamicCallback<T extends (...args: never[]) => unknown>(callback: T): T;
30
+ /**
31
+ * Gets `value` from the last render.
32
+ */
33
+ export declare function usePrevious<T>(value: T): T | undefined;
34
+ /**
35
+ * This error is thrown when a context is consumed outside its provider. Allows
36
+ * reusing a generic error message format and reduces bundle size. The hook's
37
+ * name will be extracted from its stack, so only the provider's name is needed.
38
+ */
39
+ export declare class ReactContextError extends Error {
40
+ constructor(providerName: string, additionalInfo?: string);
41
+ }
42
+ //# sourceMappingURL=reactUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactUtils.d.ts","sourceRoot":"","sources":["../../src/utils/reactUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAyB,eAAe,EAAS,MAAM,OAAO,CAAC;AAGtE;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,wBAEzB,CAAC;AAEd;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,EACxE,QAAQ,EAAE,CAAC,GACV,CAAC,CAUH;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAQtD;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,YAAY,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;CAQ1D"}
@@ -0,0 +1,64 @@
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 { useCallback, useEffect, useLayoutEffect, useRef } from 'react';
8
+ import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
9
+ /**
10
+ * This hook is like `useLayoutEffect`, but without the SSR warning.
11
+ * It seems hacky but it's used in many React libs (Redux, Formik...).
12
+ * Also mentioned here: https://github.com/facebook/react/issues/16956
13
+ *
14
+ * It is useful when you need to update a ref as soon as possible after a React
15
+ * render (before `useEffect`).
16
+ */
17
+ export const useIsomorphicLayoutEffect = ExecutionEnvironment.canUseDOM
18
+ ? useLayoutEffect
19
+ : useEffect;
20
+ /**
21
+ * Permits to transform an unstable callback (like an arrow function provided as
22
+ * props) to a "stable" callback that is safe to use in a `useEffect` dependency
23
+ * array. Useful to avoid React stale closure problems + avoid useless effect
24
+ * re-executions.
25
+ *
26
+ * Workaround until the React team recommends a good solution, see
27
+ * https://github.com/facebook/react/issues/16956
28
+ *
29
+ * This generally works but has some potential drawbacks, such as
30
+ * https://github.com/facebook/react/issues/16956#issuecomment-536636418
31
+ */
32
+ export function useDynamicCallback(callback) {
33
+ const ref = useRef(callback);
34
+ useIsomorphicLayoutEffect(() => {
35
+ ref.current = callback;
36
+ }, [callback]);
37
+ // @ts-expect-error: TS is right that this callback may be a supertype of T,
38
+ // but good enough for our use
39
+ return useCallback((...args) => ref.current(...args), []);
40
+ }
41
+ /**
42
+ * Gets `value` from the last render.
43
+ */
44
+ export function usePrevious(value) {
45
+ const ref = useRef();
46
+ useIsomorphicLayoutEffect(() => {
47
+ ref.current = value;
48
+ });
49
+ return ref.current;
50
+ }
51
+ /**
52
+ * This error is thrown when a context is consumed outside its provider. Allows
53
+ * reusing a generic error message format and reduces bundle size. The hook's
54
+ * name will be extracted from its stack, so only the provider's name is needed.
55
+ */
56
+ export class ReactContextError extends Error {
57
+ constructor(providerName, additionalInfo) {
58
+ super();
59
+ this.name = 'ReactContextError';
60
+ this.message = `Hook ${this.stack?.split('\n')[1]?.match(/at (?:\w+\.)?(?<name>\w+)/)?.groups
61
+ .name} is called outside the <${providerName}>. ${additionalInfo || ''}`;
62
+ }
63
+ }
64
+ //# sourceMappingURL=reactUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactUtils.js","sourceRoot":"","sources":["../../src/utils/reactUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AACtE,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AAEpE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,oBAAoB,CAAC,SAAS;IACrE,CAAC,CAAC,eAAe;IACjB,CAAC,CAAC,SAAS,CAAC;AAEd;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAW;IAEX,MAAM,GAAG,GAAG,MAAM,CAAI,QAAQ,CAAC,CAAC;IAEhC,yBAAyB,CAAC,GAAG,EAAE;QAC7B,GAAG,CAAC,OAAO,GAAG,QAAQ,CAAC;IACzB,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,4EAA4E;IAC5E,8BAA8B;IAC9B,OAAO,WAAW,CAAI,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAI,KAAQ;IACrC,MAAM,GAAG,GAAG,MAAM,EAAK,CAAC;IAExB,yBAAyB,CAAC,GAAG,EAAE;QAC7B,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,YAAoB,EAAE,cAAuB;QACvD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,QACb,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,2BAA2B,CAAC,EAAE,MAAO;aACpE,IACL,2BAA2B,YAAY,MAAM,cAAc,IAAI,EAAE,EAAE,CAAC;IACtE,CAAC;CACF"}
@@ -0,0 +1,12 @@
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
+ * Matches a string regex (as provided from the config) against a target in a
9
+ * null-safe fashion, case insensitive and global.
10
+ */
11
+ export declare function isRegexpStringMatch(regexAsString?: string, valueToTest?: string): boolean;
12
+ //# sourceMappingURL=regexpUtils.d.ts.map