@azerion/bunosaurus-theme-common 0.0.0-stage → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/README.md +2 -2
  2. package/lib/components/Collapsible/index.d.ts +59 -0
  3. package/lib/components/Collapsible/index.d.ts.map +1 -0
  4. package/lib/components/Collapsible/index.js +145 -0
  5. package/lib/components/Collapsible/index.js.map +1 -0
  6. package/lib/components/Details/index.d.ts +20 -0
  7. package/lib/components/Details/index.d.ts.map +1 -0
  8. package/lib/components/Details/index.js +86 -0
  9. package/lib/components/Details/index.js.map +1 -0
  10. package/lib/components/Details/styles.module.css +66 -0
  11. package/lib/components/ThemedComponent/index.d.ts +31 -0
  12. package/lib/components/ThemedComponent/index.d.ts.map +1 -0
  13. package/lib/components/ThemedComponent/index.js +47 -0
  14. package/lib/components/ThemedComponent/index.js.map +1 -0
  15. package/lib/components/ThemedComponent/styles.module.css +26 -0
  16. package/lib/contexts/announcementBar.d.ts +21 -0
  17. package/lib/contexts/announcementBar.d.ts.map +1 -0
  18. package/lib/contexts/announcementBar.js +72 -0
  19. package/lib/contexts/announcementBar.js.map +1 -0
  20. package/lib/contexts/colorMode.d.ts +23 -0
  21. package/lib/contexts/colorMode.d.ts.map +1 -0
  22. package/lib/contexts/colorMode.js +163 -0
  23. package/lib/contexts/colorMode.js.map +1 -0
  24. package/lib/contexts/navbarMobileSidebar.d.ts +31 -0
  25. package/lib/contexts/navbarMobileSidebar.d.ts.map +1 -0
  26. package/lib/contexts/navbarMobileSidebar.js +65 -0
  27. package/lib/contexts/navbarMobileSidebar.js.map +1 -0
  28. package/lib/contexts/navbarSecondaryMenu/content.d.ts +37 -0
  29. package/lib/contexts/navbarSecondaryMenu/content.d.ts.map +1 -0
  30. package/lib/contexts/navbarSecondaryMenu/content.js +50 -0
  31. package/lib/contexts/navbarSecondaryMenu/content.js.map +1 -0
  32. package/lib/contexts/navbarSecondaryMenu/display.d.ts +24 -0
  33. package/lib/contexts/navbarSecondaryMenu/display.d.ts.map +1 -0
  34. package/lib/contexts/navbarSecondaryMenu/display.js +62 -0
  35. package/lib/contexts/navbarSecondaryMenu/display.js.map +1 -0
  36. package/lib/hooks/useBackToTopButton.d.ts +27 -0
  37. package/lib/hooks/useBackToTopButton.d.ts.map +1 -0
  38. package/lib/hooks/useBackToTopButton.js +50 -0
  39. package/lib/hooks/useBackToTopButton.js.map +1 -0
  40. package/lib/hooks/useCodeWordWrap.d.ts +15 -0
  41. package/lib/hooks/useCodeWordWrap.d.ts.map +1 -0
  42. package/lib/hooks/useCodeWordWrap.js +67 -0
  43. package/lib/hooks/useCodeWordWrap.js.map +1 -0
  44. package/lib/hooks/useHideableNavbar.d.ts +17 -0
  45. package/lib/hooks/useHideableNavbar.d.ts.map +1 -0
  46. package/lib/hooks/useHideableNavbar.js +65 -0
  47. package/lib/hooks/useHideableNavbar.js.map +1 -0
  48. package/lib/hooks/useLockBodyScroll.d.ts +12 -0
  49. package/lib/hooks/useLockBodyScroll.d.ts.map +1 -0
  50. package/lib/hooks/useLockBodyScroll.js +20 -0
  51. package/lib/hooks/useLockBodyScroll.js.map +1 -0
  52. package/lib/hooks/useMutationObserver.d.ts +4 -0
  53. package/lib/hooks/useMutationObserver.d.ts.map +1 -0
  54. package/lib/hooks/useMutationObserver.js +29 -0
  55. package/lib/hooks/useMutationObserver.js.map +1 -0
  56. package/lib/hooks/usePrismTheme.d.ts +13 -0
  57. package/lib/hooks/usePrismTheme.d.ts.map +1 -0
  58. package/lib/hooks/usePrismTheme.js +21 -0
  59. package/lib/hooks/usePrismTheme.js.map +1 -0
  60. package/lib/hooks/useTOCHighlight.d.ts +25 -0
  61. package/lib/hooks/useTOCHighlight.d.ts.map +1 -0
  62. package/lib/hooks/useTOCHighlight.js +130 -0
  63. package/lib/hooks/useTOCHighlight.js.map +1 -0
  64. package/lib/hooks/useWindowSize.d.ts +27 -0
  65. package/lib/hooks/useWindowSize.d.ts.map +1 -0
  66. package/lib/hooks/useWindowSize.js +49 -0
  67. package/lib/hooks/useWindowSize.js.map +1 -0
  68. package/lib/index.d.ts +30 -0
  69. package/lib/index.d.ts.map +1 -0
  70. package/lib/index.js +37 -0
  71. package/lib/index.js.map +1 -0
  72. package/lib/internal.d.ts +35 -0
  73. package/lib/internal.d.ts.map +1 -0
  74. package/lib/internal.js +45 -0
  75. package/lib/internal.js.map +1 -0
  76. package/lib/translations/blogTranslations.d.ts +20 -0
  77. package/lib/translations/blogTranslations.d.ts.map +1 -0
  78. package/lib/translations/blogTranslations.js +52 -0
  79. package/lib/translations/blogTranslations.js.map +1 -0
  80. package/lib/translations/contentVisibilityTranslations.d.ts +12 -0
  81. package/lib/translations/contentVisibilityTranslations.d.ts.map +1 -0
  82. package/lib/translations/contentVisibilityTranslations.js +30 -0
  83. package/lib/translations/contentVisibilityTranslations.js.map +1 -0
  84. package/lib/translations/docsTranslations.d.ts +8 -0
  85. package/lib/translations/docsTranslations.d.ts.map +1 -0
  86. package/lib/translations/docsTranslations.js +17 -0
  87. package/lib/translations/docsTranslations.js.map +1 -0
  88. package/lib/utils/IntlUtils.d.ts +2 -0
  89. package/lib/utils/IntlUtils.d.ts.map +1 -0
  90. package/lib/utils/IntlUtils.js +20 -0
  91. package/lib/utils/IntlUtils.js.map +1 -0
  92. package/lib/utils/ThemeClassNames.d.ts +99 -0
  93. package/lib/utils/ThemeClassNames.d.ts.map +1 -0
  94. package/lib/utils/ThemeClassNames.js +107 -0
  95. package/lib/utils/ThemeClassNames.js.map +1 -0
  96. package/lib/utils/accessibilityUtils.d.ts +8 -0
  97. package/lib/utils/accessibilityUtils.d.ts.map +1 -0
  98. package/lib/utils/accessibilityUtils.js +10 -0
  99. package/lib/utils/accessibilityUtils.js.map +1 -0
  100. package/lib/utils/admonitionUtils.d.ts +12 -0
  101. package/lib/utils/admonitionUtils.d.ts.map +1 -0
  102. package/lib/utils/admonitionUtils.js +32 -0
  103. package/lib/utils/admonitionUtils.js.map +1 -0
  104. package/lib/utils/anchorUtils.d.ts +16 -0
  105. package/lib/utils/anchorUtils.d.ts.map +1 -0
  106. package/lib/utils/anchorUtils.js +26 -0
  107. package/lib/utils/anchorUtils.js.map +1 -0
  108. package/lib/utils/anchorUtils.module.css +14 -0
  109. package/lib/utils/codeBlockUtils.d.ts +101 -0
  110. package/lib/utils/codeBlockUtils.d.ts.map +1 -0
  111. package/lib/utils/codeBlockUtils.js +310 -0
  112. package/lib/utils/codeBlockUtils.js.map +1 -0
  113. package/lib/utils/emojiUtils.d.ts +20 -0
  114. package/lib/utils/emojiUtils.d.ts.map +1 -0
  115. package/lib/utils/emojiUtils.js +32 -0
  116. package/lib/utils/emojiUtils.js.map +1 -0
  117. package/lib/utils/errorBoundaryUtils.d.ts +31 -0
  118. package/lib/utils/errorBoundaryUtils.d.ts.map +1 -0
  119. package/lib/utils/errorBoundaryUtils.js +48 -0
  120. package/lib/utils/errorBoundaryUtils.js.map +1 -0
  121. package/lib/utils/errorBoundaryUtils.module.css +16 -0
  122. package/lib/utils/footerUtils.d.ts +13 -0
  123. package/lib/utils/footerUtils.d.ts.map +1 -0
  124. package/lib/utils/footerUtils.js +14 -0
  125. package/lib/utils/footerUtils.js.map +1 -0
  126. package/lib/utils/historyUtils.d.ts +39 -0
  127. package/lib/utils/historyUtils.d.ts.map +1 -0
  128. package/lib/utils/historyUtils.js +148 -0
  129. package/lib/utils/historyUtils.js.map +1 -0
  130. package/lib/utils/jsUtils.d.ts +24 -0
  131. package/lib/utils/jsUtils.d.ts.map +1 -0
  132. package/lib/utils/jsUtils.js +43 -0
  133. package/lib/utils/jsUtils.js.map +1 -0
  134. package/lib/utils/metadataUtils.d.ts +38 -0
  135. package/lib/utils/metadataUtils.d.ts.map +1 -0
  136. package/lib/utils/metadataUtils.js +87 -0
  137. package/lib/utils/metadataUtils.js.map +1 -0
  138. package/lib/utils/navbarUtils.d.ts +21 -0
  139. package/lib/utils/navbarUtils.d.ts.map +1 -0
  140. package/lib/utils/navbarUtils.js +35 -0
  141. package/lib/utils/navbarUtils.js.map +1 -0
  142. package/lib/utils/reactUtils.d.ts +60 -0
  143. package/lib/utils/reactUtils.d.ts.map +1 -0
  144. package/lib/utils/reactUtils.js +91 -0
  145. package/lib/utils/reactUtils.js.map +1 -0
  146. package/lib/utils/regexpUtils.d.ts +12 -0
  147. package/lib/utils/regexpUtils.d.ts.map +1 -0
  148. package/lib/utils/regexpUtils.js +18 -0
  149. package/lib/utils/regexpUtils.js.map +1 -0
  150. package/lib/utils/routesUtils.d.ts +26 -0
  151. package/lib/utils/routesUtils.d.ts.map +1 -0
  152. package/lib/utils/routesUtils.js +54 -0
  153. package/lib/utils/routesUtils.js.map +1 -0
  154. package/lib/utils/scrollUtils.d.ts +83 -0
  155. package/lib/utils/scrollUtils.d.ts.map +1 -0
  156. package/lib/utils/scrollUtils.js +201 -0
  157. package/lib/utils/scrollUtils.js.map +1 -0
  158. package/lib/utils/searchUtils.d.ts +8 -0
  159. package/lib/utils/searchUtils.d.ts.map +1 -0
  160. package/lib/utils/searchUtils.js +8 -0
  161. package/lib/utils/searchUtils.js.map +1 -0
  162. package/lib/utils/skipToContentUtils.d.ts +20 -0
  163. package/lib/utils/skipToContentUtils.d.ts.map +1 -0
  164. package/lib/utils/skipToContentUtils.js +75 -0
  165. package/lib/utils/skipToContentUtils.js.map +1 -0
  166. package/lib/utils/storageUtils.d.ts +36 -0
  167. package/lib/utils/storageUtils.d.ts.map +1 -0
  168. package/lib/utils/storageUtils.js +193 -0
  169. package/lib/utils/storageUtils.js.map +1 -0
  170. package/lib/utils/tabsUtils.d.ts +55 -0
  171. package/lib/utils/tabsUtils.d.ts.map +1 -0
  172. package/lib/utils/tabsUtils.js +179 -0
  173. package/lib/utils/tabsUtils.js.map +1 -0
  174. package/lib/utils/tagsUtils.d.ts +20 -0
  175. package/lib/utils/tagsUtils.d.ts.map +1 -0
  176. package/lib/utils/tagsUtils.js +41 -0
  177. package/lib/utils/tagsUtils.js.map +1 -0
  178. package/lib/utils/titleFormatterUtils.d.ts +59 -0
  179. package/lib/utils/titleFormatterUtils.d.ts.map +1 -0
  180. package/lib/utils/titleFormatterUtils.js +49 -0
  181. package/lib/utils/titleFormatterUtils.js.map +1 -0
  182. package/lib/utils/tocUtils.d.ts +36 -0
  183. package/lib/utils/tocUtils.d.ts.map +1 -0
  184. package/lib/utils/tocUtils.js +84 -0
  185. package/lib/utils/tocUtils.js.map +1 -0
  186. package/lib/utils/useAlternatePageUtils.d.ts +32 -0
  187. package/lib/utils/useAlternatePageUtils.d.ts.map +1 -0
  188. package/lib/utils/useAlternatePageUtils.js +42 -0
  189. package/lib/utils/useAlternatePageUtils.js.map +1 -0
  190. package/lib/utils/useLocalPathname.d.ts +13 -0
  191. package/lib/utils/useLocalPathname.d.ts.map +1 -0
  192. package/lib/utils/useLocalPathname.js +19 -0
  193. package/lib/utils/useLocalPathname.js.map +1 -0
  194. package/lib/utils/useLocationChange.d.ts +17 -0
  195. package/lib/utils/useLocationChange.d.ts.map +1 -0
  196. package/lib/utils/useLocationChange.js +31 -0
  197. package/lib/utils/useLocationChange.js.map +1 -0
  198. package/lib/utils/usePluralForm.d.ts +21 -0
  199. package/lib/utils/usePluralForm.d.ts.map +1 -0
  200. package/lib/utils/usePluralForm.js +93 -0
  201. package/lib/utils/usePluralForm.js.map +1 -0
  202. package/lib/utils/useThemeConfig.d.ts +120 -0
  203. package/lib/utils/useThemeConfig.d.ts.map +1 -0
  204. package/lib/utils/useThemeConfig.js +14 -0
  205. package/lib/utils/useThemeConfig.js.map +1 -0
  206. package/package.json +58 -4
  207. package/src/components/Collapsible/index.tsx +250 -0
  208. package/src/components/Details/index.tsx +130 -0
  209. package/src/components/Details/styles.module.css +66 -0
  210. package/src/components/ThemedComponent/index.tsx +75 -0
  211. package/src/components/ThemedComponent/styles.module.css +26 -0
  212. package/src/contexts/announcementBar.tsx +117 -0
  213. package/src/contexts/colorMode.tsx +257 -0
  214. package/src/contexts/navbarMobileSidebar.tsx +119 -0
  215. package/src/contexts/navbarSecondaryMenu/content.tsx +100 -0
  216. package/src/contexts/navbarSecondaryMenu/display.tsx +102 -0
  217. package/src/hooks/useBackToTopButton.ts +73 -0
  218. package/src/hooks/useCodeWordWrap.ts +107 -0
  219. package/src/hooks/useHideableNavbar.ts +81 -0
  220. package/src/hooks/useLockBodyScroll.ts +21 -0
  221. package/src/hooks/useMutationObserver.ts +38 -0
  222. package/src/hooks/usePrismTheme.ts +24 -0
  223. package/src/hooks/useTOCHighlight.ts +189 -0
  224. package/src/hooks/useWindowSize.ts +67 -0
  225. package/src/index.ts +112 -0
  226. package/src/internal.ts +107 -0
  227. package/src/translations/blogTranslations.tsx +89 -0
  228. package/src/translations/contentVisibilityTranslations.tsx +51 -0
  229. package/src/translations/docsTranslations.tsx +28 -0
  230. package/src/types.d.ts +8 -0
  231. package/src/utils/IntlUtils.ts +27 -0
  232. package/src/utils/ThemeClassNames.ts +119 -0
  233. package/src/utils/accessibilityUtils.ts +10 -0
  234. package/src/utils/admonitionUtils.tsx +44 -0
  235. package/src/utils/anchorUtils.module.css +14 -0
  236. package/src/utils/anchorUtils.ts +31 -0
  237. package/src/utils/codeBlockUtils.tsx +494 -0
  238. package/src/utils/emojiUtils.ts +40 -0
  239. package/src/utils/errorBoundaryUtils.module.css +16 -0
  240. package/src/utils/errorBoundaryUtils.tsx +71 -0
  241. package/src/utils/footerUtils.ts +18 -0
  242. package/src/utils/historyUtils.ts +199 -0
  243. package/src/utils/jsUtils.ts +54 -0
  244. package/src/utils/metadataUtils.tsx +145 -0
  245. package/src/utils/navbarUtils.tsx +45 -0
  246. package/src/utils/reactUtils.tsx +120 -0
  247. package/src/utils/regexpUtils.ts +24 -0
  248. package/src/utils/routesUtils.ts +75 -0
  249. package/src/utils/scrollUtils.tsx +303 -0
  250. package/src/utils/searchUtils.ts +8 -0
  251. package/src/utils/skipToContentUtils.tsx +108 -0
  252. package/src/utils/storageUtils.ts +260 -0
  253. package/src/utils/tabsUtils.tsx +307 -0
  254. package/src/utils/tagsUtils.tsx +61 -0
  255. package/src/utils/titleFormatterUtils.tsx +120 -0
  256. package/src/utils/tocUtils.ts +119 -0
  257. package/src/utils/useAlternatePageUtils.ts +80 -0
  258. package/src/utils/useLocalPathname.ts +22 -0
  259. package/src/utils/useLocationChange.ts +41 -0
  260. package/src/utils/usePluralForm.ts +131 -0
  261. package/src/utils/useThemeConfig.ts +147 -0
@@ -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"}
@@ -0,0 +1,39 @@
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 { History, Location, Action } from 'history';
8
+ 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
+ /**
17
+ * Permits to efficiently subscribe to a slice of the history
18
+ * See https://thisweekinreact.com/articles/useSyncExternalStore-the-underrated-react-api
19
+ * @param selector
20
+ */
21
+ export declare function useHistorySelector<Value>(selector: (history: History<unknown>) => Value): Value;
22
+ /**
23
+ * Permits to efficiently subscribe to a specific querystring value
24
+ * @param key
25
+ */
26
+ export declare function useQueryStringValue(key: string | null): string | null;
27
+ export declare function useQueryString(key: string): [string, (newValue: string | null, options?: {
28
+ push: boolean;
29
+ }) => void];
30
+ type ListUpdate = string[] | ((oldValues: string[]) => string[]);
31
+ type ListUpdateFunction = (update: ListUpdate, options?: {
32
+ push: boolean;
33
+ }) => void;
34
+ export declare function useQueryStringList(key: string): [string[], ListUpdateFunction];
35
+ export declare function useClearQueryString(): () => void;
36
+ export declare function mergeSearchParams(params: URLSearchParams[], strategy: 'append' | 'set'): URLSearchParams;
37
+ export declare function mergeSearchStrings(searchStrings: (string | undefined)[], strategy: 'append' | 'set'): string;
38
+ export {};
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CAOhD;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,eAAe,EAAE,EACzB,QAAQ,EAAE,QAAQ,GAAG,KAAK,GACzB,eAAe,CAYjB;AAED,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,EACrC,QAAQ,EAAE,QAAQ,GAAG,KAAK,GACzB,MAAM,CAOR"}
@@ -0,0 +1,148 @@
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, useMemo, useSyncExternalStore } from 'react';
8
+ import { useHistory } from '@docusaurus/router';
9
+ import { useEvent } 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 history = useHistory();
17
+ const stableHandler = useEvent(handler);
18
+ useEffect(
19
+ // See https://github.com/remix-run/history/blob/main/docs/blocking-transitions.md
20
+ () => history.block((location, action) => stableHandler(location, action)), [history, 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
+ /**
39
+ * Permits to efficiently subscribe to a slice of the history
40
+ * See https://thisweekinreact.com/articles/useSyncExternalStore-the-underrated-react-api
41
+ * @param selector
42
+ */
43
+ export function useHistorySelector(selector) {
44
+ const history = useHistory();
45
+ return useSyncExternalStore(history.listen, () => selector(history), () => selector({
46
+ ...history,
47
+ location: {
48
+ ...history.location,
49
+ // On the server/hydration, these attributes should always be empty
50
+ // Forcing empty state makes this hook safe from hydration errors
51
+ search: '',
52
+ hash: '',
53
+ state: undefined,
54
+ },
55
+ }));
56
+ }
57
+ /**
58
+ * Permits to efficiently subscribe to a specific querystring value
59
+ * @param key
60
+ */
61
+ export function useQueryStringValue(key) {
62
+ return useHistorySelector((history) => {
63
+ if (key === null) {
64
+ return null;
65
+ }
66
+ return new URLSearchParams(history.location.search).get(key);
67
+ });
68
+ }
69
+ function useQueryStringUpdater(key) {
70
+ const history = useHistory();
71
+ return useCallback((newValue, options) => {
72
+ const searchParams = new URLSearchParams(history.location.search);
73
+ if (newValue) {
74
+ searchParams.set(key, newValue);
75
+ }
76
+ else {
77
+ searchParams.delete(key);
78
+ }
79
+ const updateHistory = options?.push ? history.push : history.replace;
80
+ updateHistory({
81
+ search: searchParams.toString(),
82
+ });
83
+ }, [key, history]);
84
+ }
85
+ export function useQueryString(key) {
86
+ const value = useQueryStringValue(key) ?? '';
87
+ const update = useQueryStringUpdater(key);
88
+ return [value, update];
89
+ }
90
+ function useQueryStringListValues(key) {
91
+ // Unfortunately we can't just use searchParams.getAll(key) in the selector
92
+ // It would create a new array every time and lead to an infinite loop...
93
+ // The selector has to return a primitive/string value to avoid that...
94
+ const arrayJsonString = useHistorySelector((history) => {
95
+ const values = new URLSearchParams(history.location.search).getAll(key);
96
+ return JSON.stringify(values);
97
+ });
98
+ return useMemo(() => JSON.parse(arrayJsonString), [arrayJsonString]);
99
+ }
100
+ function useQueryStringListUpdater(key) {
101
+ const history = useHistory();
102
+ const setValues = useCallback((update, options) => {
103
+ const searchParams = new URLSearchParams(history.location.search);
104
+ const newValues = Array.isArray(update)
105
+ ? update
106
+ : update(searchParams.getAll(key));
107
+ searchParams.delete(key);
108
+ newValues.forEach((v) => searchParams.append(key, v));
109
+ const updateHistory = options?.push ? history.push : history.replace;
110
+ updateHistory({
111
+ search: searchParams.toString(),
112
+ });
113
+ }, [history, key]);
114
+ return setValues;
115
+ }
116
+ export function useQueryStringList(key) {
117
+ const values = useQueryStringListValues(key);
118
+ const setValues = useQueryStringListUpdater(key);
119
+ return [values, setValues];
120
+ }
121
+ export function useClearQueryString() {
122
+ const history = useHistory();
123
+ return useCallback(() => {
124
+ history.replace({
125
+ search: undefined,
126
+ });
127
+ }, [history]);
128
+ }
129
+ export function mergeSearchParams(params, strategy) {
130
+ const result = new URLSearchParams();
131
+ for (const item of params) {
132
+ for (const [key, value] of item.entries()) {
133
+ if (strategy === 'append') {
134
+ result.append(key, value);
135
+ }
136
+ else {
137
+ result.set(key, value);
138
+ }
139
+ }
140
+ }
141
+ return result;
142
+ }
143
+ export function mergeSearchStrings(searchStrings, strategy) {
144
+ const params = mergeSearchParams(searchStrings.map((s) => new URLSearchParams(s ?? '')), strategy);
145
+ const str = params.toString();
146
+ return str ? `?${str}` : str;
147
+ }
148
+ //# 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,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,oBAAoB,EAAC,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAMtC;;;;GAIG;AACH,SAAS,uBAAuB,CAAC,OAA4B;IAC3D,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IACxC,SAAS;IACP,kFAAkF;IAClF,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,EAC1E,CAAC,O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AC;IACL,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,MAAyB,EACzB,QAA0B;IAE1B,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;IACrC,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QAC1B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YAC1C,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBAC1B,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAC5B,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,aAAqC,EACrC,QAA0B;IAE1B,MAAM,MAAM,GAAG,iBAAiB,CAC9B,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EACtD,QAAQ,CACT,CAAC;IACF,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC9B,OAAO,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,24 @@
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
+ export declare function groupBy<K extends PropertyKey, T>(items: Iterable<T>, keySelector: (item: T, index: number) => K): Partial<Record<K, T[]>>;
24
+ //# 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;AAKD,wBAAgB,OAAO,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,EAC9C,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAClB,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,GACzC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAUzB"}
@@ -0,0 +1,43 @@
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
+ // TODO 2025: replace by std Object.groupBy ?
30
+ // This is a local polyfill with exact same TS signature
31
+ // see https://github.com/microsoft/TypeScript/blob/main/src/lib/esnext.object.d.ts
32
+ export function groupBy(items, keySelector) {
33
+ const result = {};
34
+ let index = 0;
35
+ for (const item of items) {
36
+ const key = keySelector(item, index);
37
+ result[key] ??= [];
38
+ result[key].push(item);
39
+ index += 1;
40
+ }
41
+ return result;
42
+ }
43
+ //# 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,UAAU,GAA4B,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;AAED,6CAA6C;AAC7C,wDAAwD;AACxD,mFAAmF;AACnF,MAAM,UAAU,OAAO,CACrB,KAAkB,EAClB,WAA0C;IAE1C,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACrC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;QACnB,MAAM,CAAC,GAAG,CAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,KAAK,IAAI,CAAC,CAAC;IACb,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,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
+ type 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): ReactNode;
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
+ }): ReactNode;
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
+ }): ReactNode;
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,KAAK,iBAAiB,GAAG;IACvB,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,CAAC;AAmDF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,WAAW,EACX,QAAQ,EACR,KAAK,EACL,QAAQ,GACT,EAAE,iBAAiB,GAAG,SAAS,CAU/B;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,SAAS,CAWZ;AASD;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,SAAS,CASZ"}
@@ -0,0 +1,87 @@
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 clsx from 'clsx';
9
+ import Head from '@docusaurus/Head';
10
+ import useRouteContext from '@docusaurus/useRouteContext';
11
+ import { useBaseUrlUtils } from '@docusaurus/useBaseUrl';
12
+ import { useTitleFormatter } from './titleFormatterUtils';
13
+ function TitleMetadata({ title }) {
14
+ const titleFormatter = useTitleFormatter();
15
+ const formattedTitle = titleFormatter.format(title);
16
+ return (<Head>
17
+ <title>{formattedTitle}</title>
18
+ <meta property="og:title" content={formattedTitle}/>
19
+ </Head>);
20
+ }
21
+ function DescriptionMetadata({ description }) {
22
+ return (<Head>
23
+ <meta name="description" content={description}/>
24
+ <meta property="og:description" content={description}/>
25
+ </Head>);
26
+ }
27
+ function ImageMetadata({ image }) {
28
+ const { withBaseUrl } = useBaseUrlUtils();
29
+ const pageImage = withBaseUrl(image, { absolute: true });
30
+ return (<Head>
31
+ <meta property="og:image" content={pageImage}/>
32
+ <meta name="twitter:image" content={pageImage}/>
33
+ </Head>);
34
+ }
35
+ function KeywordsMetadata({ keywords, }) {
36
+ return (<Head>
37
+ <meta name="keywords" content={
38
+ // https://github.com/microsoft/TypeScript/issues/17002
39
+ (Array.isArray(keywords) ? keywords.join(',') : keywords)}/>
40
+ </Head>);
41
+ }
42
+ /**
43
+ * Helper component to manipulate page metadata and override site defaults.
44
+ * Works in the same way as Helmet.
45
+ */
46
+ export function PageMetadata({ title, description, keywords, image, children, }) {
47
+ return (<>
48
+ {title && <TitleMetadata title={title}/>}
49
+ {description && <DescriptionMetadata description={description}/>}
50
+ {keywords && <KeywordsMetadata keywords={keywords}/>}
51
+ {image && <ImageMetadata image={image}/>}
52
+ {children && <Head>{children}</Head>}
53
+ </>);
54
+ }
55
+ const HtmlClassNameContext = React.createContext(undefined);
56
+ /**
57
+ * Every layer of this provider will append a class name to the HTML element.
58
+ * There's no consumer for this hook: it's side-effect-only. This wrapper is
59
+ * necessary because Helmet does not "merge" classes.
60
+ * @see https://github.com/staylor/react-helmet-async/issues/161
61
+ */
62
+ export function HtmlClassNameProvider({ className: classNameProp, children, }) {
63
+ const classNameContext = React.useContext(HtmlClassNameContext);
64
+ const className = clsx(classNameContext, classNameProp);
65
+ return (<HtmlClassNameContext value={className}>
66
+ <Head>
67
+ <html className={className}/>
68
+ </Head>
69
+ {children}
70
+ </HtmlClassNameContext>);
71
+ }
72
+ function pluginNameToClassName(pluginName) {
73
+ return `plugin-${pluginName.replace(/docusaurus-(?:plugin|theme)-(?:content-)?/gi, '')}`;
74
+ }
75
+ /**
76
+ * A very thin wrapper around `HtmlClassNameProvider` that adds the plugin ID +
77
+ * name to the HTML class name.
78
+ */
79
+ export function PluginHtmlClassNameProvider({ children, }) {
80
+ const routeContext = useRouteContext();
81
+ const nameClass = pluginNameToClassName(routeContext.plugin.name);
82
+ const idClass = `plugin-id-${routeContext.plugin.id}`;
83
+ return (<HtmlClassNameProvider className={clsx(nameClass, idClass)}>
84
+ {children}
85
+ </HtmlClassNameProvider>);
86
+ }
87
+ //# 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,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAC,iBAAiB,EAAC,MAAM,uBAAuB,CAAC;AAUxD,SAAS,aAAa,CAAC,EAAC,KAAK,EAAkB;IAC7C,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAC3C,MAAM,cAAc,GAAG,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpD,OAAO,CACL,CAAC,IAAI,CACH;MAAA,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,EAAE,KAAK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,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,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CACzD;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,qBAAqB,CAAC,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 multiple navbar state providers that are mutually dependent and
16
+ * hence can't be re-ordered.
17
+ */
18
+ export declare function NavbarProvider({ children }: {
19
+ children: ReactNode;
20
+ }): ReactNode;
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,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAOrC;;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,SAAS,CAU3E"}
@@ -0,0 +1,35 @@
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 { NavbarMobileSidebarProvider } from '../contexts/navbarMobileSidebar';
8
+ import { NavbarSecondaryMenuContentProvider } from '../contexts/navbarSecondaryMenu/content';
9
+ import { NavbarSecondaryMenuDisplayProvider } from '../contexts/navbarSecondaryMenu/display';
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 multiple navbar state providers that are mutually dependent and
24
+ * hence can't be re-ordered.
25
+ */
26
+ export function NavbarProvider({ children }) {
27
+ return (<NavbarSecondaryMenuContentProvider>
28
+ <NavbarMobileSidebarProvider>
29
+ <NavbarSecondaryMenuDisplayProvider>
30
+ {children}
31
+ </NavbarSecondaryMenuDisplayProvider>
32
+ </NavbarMobileSidebarProvider>
33
+ </NavbarSecondaryMenuContentProvider>);
34
+ }
35
+ //# sourceMappingURL=navbarUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navbarUtils.js","sourceRoot":"","sources":["../../src/utils/navbarUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,2BAA2B,EAAC,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAC,kCAAkC,EAAC,MAAM,yCAAyC,CAAC;AAC3F,OAAO,EAAC,kCAAkC,EAAC,MAAM,yCAAyC,CAAC;AAE3F,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,CAAC,kCAAkC,CACjC;MAAA,CAAC,2BAA2B,CAC1B;QAAA,CAAC,kCAAkC,CACjC;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,kCAAkC,CACtC;MAAA,EAAE,2BAA2B,CAC/B;IAAA,EAAE,kCAAkC,CAAC,CACtC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,60 @@
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 ComponentType, type ReactNode } from 'react';
8
+ /**
9
+ * Temporary userland implementation until an official hook is implemented
10
+ * See RFC: https://github.com/reactjs/rfcs/pull/220
11
+ *
12
+ * Permits to transform an unstable callback (like an arrow function provided as
13
+ * props) to a "stable" callback that is safe to use in a `useEffect` dependency
14
+ * array. Useful to avoid React stale closure problems + avoid useless effect
15
+ * re-executions.
16
+ *
17
+ * This generally works but has some potential drawbacks, such as
18
+ * https://github.com/facebook/react/issues/16956#issuecomment-536636418
19
+ */
20
+ export declare function useEvent<T extends (...args: never[]) => unknown>(callback: T): T;
21
+ /**
22
+ * Gets `value` from the last render.
23
+ */
24
+ export declare function usePrevious<T>(value: T): T | undefined;
25
+ /**
26
+ * This error is thrown when a context is consumed outside its provider. Allows
27
+ * reusing a generic error message format and reduces bundle size. The hook's
28
+ * name will be extracted from its stack, so only the provider's name is needed.
29
+ */
30
+ export declare class ReactContextError extends Error {
31
+ constructor(providerName: string, additionalInfo?: string);
32
+ }
33
+ /**
34
+ * Shallow-memoize an object. This means the returned object will be the same as
35
+ * the previous render if the property keys and values did not change. This
36
+ * works for simple cases: when property values are primitives or stable
37
+ * objects.
38
+ *
39
+ * @param obj
40
+ */
41
+ export declare function useShallowMemoObject<O extends object>(obj: O): O;
42
+ type SimpleProvider = ComponentType<{
43
+ children: ReactNode;
44
+ }>;
45
+ /**
46
+ * Creates a single React provider from an array of existing providers
47
+ * assuming providers only take "children" as props.
48
+ *
49
+ * Prevents the annoying React element nesting
50
+ * Example here: https://getfrontend.tips/compose-multiple-react-providers/
51
+ *
52
+ * The order matters:
53
+ * - The first provider is at the top of the tree.
54
+ * - The last provider is the most nested one
55
+ *
56
+ * @param providers array of providers to compose
57
+ */
58
+ export declare function composeProviders(providers: SimpleProvider[]): SimpleProvider;
59
+ export {};
60
+ //# 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,EAKL,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,EAC9D,QAAQ,EAAE,CAAC,GACV,CAAC,CAUH;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAWtD;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,YAAY,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,EAOxD;CACF;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAMhE;AAED,KAAK,cAAc,GAAG,aAAa,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAC,CAAC,CAAC;AAE3D;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,cAAc,EAAE,GAAG,cAAc,CAc5E"}