@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,67 @@
1
+ import { useState, useCallback, useEffect, useRef } from 'react';
2
+ import { useMutationObserver } from './useMutationObserver';
3
+ // Callback fires when the "hidden" attribute of a tabpanel changes
4
+ // See https://github.com/facebook/docusaurus/pull/7485
5
+ function useTabBecameVisibleCallback(codeBlockRef, callback) {
6
+ const [hiddenTabElement, setHiddenTabElement] = useState();
7
+ const updateHiddenTabElement = useCallback(() => {
8
+ // No need to observe non-hidden tabs
9
+ // + we want to force a re-render when a tab becomes visible
10
+ setHiddenTabElement(codeBlockRef.current?.closest('[role=tabpanel][hidden]'));
11
+ }, [codeBlockRef, setHiddenTabElement]);
12
+ useEffect(() => {
13
+ updateHiddenTabElement();
14
+ }, [updateHiddenTabElement]);
15
+ useMutationObserver(hiddenTabElement, (mutations) => {
16
+ mutations.forEach((mutation) => {
17
+ if (mutation.type === 'attributes' &&
18
+ mutation.attributeName === 'hidden') {
19
+ callback();
20
+ updateHiddenTabElement();
21
+ }
22
+ });
23
+ }, {
24
+ attributes: true,
25
+ characterData: false,
26
+ childList: false,
27
+ subtree: false,
28
+ });
29
+ }
30
+ export function useCodeWordWrap() {
31
+ const [isEnabled, setIsEnabled] = useState(false);
32
+ const [isCodeScrollable, setIsCodeScrollable] = useState(false);
33
+ const codeBlockRef = useRef(null);
34
+ const toggle = useCallback(() => {
35
+ const codeElement = codeBlockRef.current.querySelector('code');
36
+ if (isEnabled) {
37
+ codeElement.removeAttribute('style');
38
+ }
39
+ else {
40
+ codeElement.style.whiteSpace = 'pre-wrap';
41
+ // When code wrap is enabled, we want to avoid a scrollbar in any case
42
+ // Ensure that very very long words/strings/tokens still wrap
43
+ codeElement.style.overflowWrap = 'anywhere';
44
+ }
45
+ setIsEnabled((value) => !value);
46
+ }, [codeBlockRef, isEnabled]);
47
+ const updateCodeIsScrollable = useCallback(() => {
48
+ const { scrollWidth, clientWidth } = codeBlockRef.current;
49
+ const isScrollable = scrollWidth > clientWidth ||
50
+ codeBlockRef.current.querySelector('code').hasAttribute('style');
51
+ setIsCodeScrollable(isScrollable);
52
+ }, [codeBlockRef]);
53
+ useTabBecameVisibleCallback(codeBlockRef, updateCodeIsScrollable);
54
+ useEffect(() => {
55
+ updateCodeIsScrollable();
56
+ }, [isEnabled, updateCodeIsScrollable]);
57
+ useEffect(() => {
58
+ window.addEventListener('resize', updateCodeIsScrollable, {
59
+ passive: true,
60
+ });
61
+ return () => {
62
+ window.removeEventListener('resize', updateCodeIsScrollable);
63
+ };
64
+ }, [updateCodeIsScrollable]);
65
+ return { codeBlockRef, isEnabled, isCodeScrollable, toggle };
66
+ }
67
+ //# sourceMappingURL=useCodeWordWrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCodeWordWrap.js","sourceRoot":"","sources":["../../src/hooks/useCodeWordWrap.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAE1D,mEAAmE;AACnE,uDAAuD;AACvD,SAAS,2BAA2B,CAClC,YAA8C,EAC9C,QAAoB;IAEpB,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,EAErD,CAAC;IAEJ,MAAM,sBAAsB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9C,qCAAqC;QACrC,4DAA4D;QAC5D,mBAAmB,CACjB,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,yBAAyB,CAAC,CACzD,CAAC;IACJ,CAAC,EAAE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AC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC;IAE9B,MAAM,sBAAsB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9C,MAAM,EAAC,WAAW,EAAE,WAAW,EAAC,GAAG,YAAY,CAAC,OAAQ,CAAC;QACzD,MAAM,YAAY,GAChB,WAAW,GAAG,WAAW;YACzB,YAAY,CAAC,OAAQ,CAAC,aAAa,CAAC,MAAM,CAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACrE,mBAAmB,CAAC,YAAY,CAAC,CAAC;IACpC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,2BAA2B,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC;IAElE,SAAS,CAAC,GAAG,EAAE;QACb,sBAAsB,EAAE,CAAC;IAC3B,CAAC,EAAE,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC,CAAC;IAExC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,sBAAsB,EAAE;YACxD,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC;QAC/D,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAE7B,OAAO,EAAC,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,EAAC,CAAC;AAC7D,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
+ /**
8
+ * Wires the imperative logic of a hideable navbar.
9
+ * @param hideOnScroll If `false`, this hook is basically a no-op.
10
+ */
11
+ export declare function useHideableNavbar(hideOnScroll: boolean): {
12
+ /** A ref to the navbar component. Plug this into the actual element. */
13
+ readonly navbarRef: (node: HTMLElement | null) => void;
14
+ /** If `false`, the navbar component should not be rendered. */
15
+ readonly isNavbarVisible: boolean;
16
+ };
17
+ //# sourceMappingURL=useHideableNavbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHideableNavbar.d.ts","sourceRoot":"","sources":["../../src/hooks/useHideableNavbar.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,OAAO,GAAG;IACxD,wEAAwE;IACxE,QAAQ,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IACvD,+DAA+D;IAC/D,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;CACnC,CA4DA"}
@@ -0,0 +1,65 @@
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 { useState, useCallback, useRef } from 'react';
8
+ import { useLocationChange } from '../utils/useLocationChange';
9
+ import { useScrollPosition } from '../utils/scrollUtils';
10
+ /**
11
+ * Wires the imperative logic of a hideable navbar.
12
+ * @param hideOnScroll If `false`, this hook is basically a no-op.
13
+ */
14
+ export function useHideableNavbar(hideOnScroll) {
15
+ const [isNavbarVisible, setIsNavbarVisible] = useState(hideOnScroll);
16
+ const isFocusedAnchor = useRef(false);
17
+ const navbarHeight = useRef(0);
18
+ const navbarRef = useCallback((node) => {
19
+ if (node !== null) {
20
+ navbarHeight.current = node.getBoundingClientRect().height;
21
+ }
22
+ }, []);
23
+ useScrollPosition(({ scrollY: scrollTop }, lastPosition) => {
24
+ if (!hideOnScroll) {
25
+ return;
26
+ }
27
+ // Needed mostly for handling rubber band scrolling.
28
+ // See https://github.com/facebook/docusaurus/pull/5721
29
+ if (scrollTop < navbarHeight.current) {
30
+ setIsNavbarVisible(true);
31
+ return;
32
+ }
33
+ if (isFocusedAnchor.current) {
34
+ isFocusedAnchor.current = false;
35
+ return;
36
+ }
37
+ const lastScrollTop = lastPosition?.scrollY;
38
+ const documentHeight = document.documentElement.scrollHeight - navbarHeight.current;
39
+ const windowHeight = window.innerHeight;
40
+ if (lastScrollTop && scrollTop >= lastScrollTop) {
41
+ setIsNavbarVisible(false);
42
+ }
43
+ else if (scrollTop + windowHeight < documentHeight) {
44
+ setIsNavbarVisible(true);
45
+ }
46
+ });
47
+ useLocationChange((locationChangeEvent) => {
48
+ if (!hideOnScroll) {
49
+ return;
50
+ }
51
+ // See https://github.com/facebook/docusaurus/pull/8059#issuecomment-1239639480
52
+ const currentHash = locationChangeEvent.location.hash;
53
+ const currentHashAnchor = currentHash
54
+ ? document.getElementById(currentHash.substring(1))
55
+ : undefined;
56
+ if (currentHashAnchor) {
57
+ isFocusedAnchor.current = true;
58
+ setIsNavbarVisible(false);
59
+ return;
60
+ }
61
+ setIsNavbarVisible(true);
62
+ });
63
+ return { navbarRef, isNavbarVisible };
64
+ }
65
+ //# sourceMappingURL=useHideableNavbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHideableNavbar.js","sourceRoot":"","sources":["../../src/hooks/useHideableNavbar.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AACpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAEvD;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,YAAqB;IAMrD,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IACrE,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC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G,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC;QACtD,MAAM,iBAAiB,GAAG,WAAW;YACnC,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YACnD,CAAC,CAAC,SAAS,CAAC;QAEd,IAAI,iBAAiB,EAAE,CAAC;YACtB,eAAe,CAAC,OAAO,GAAG,IAAI,CAAC;YAC/B,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC1B,OAAO;QACT,CAAC;QAED,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,OAAO,EAAC,SAAS,EAAE,eAAe,EAAC,CAAC;AACtC,CAAC"}
@@ -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
+ * Side-effect that locks the document body's scroll throughout the lifetime of
9
+ * the containing component. e.g. when the mobile sidebar is expanded.
10
+ */
11
+ export declare function useLockBodyScroll(lock?: boolean): void;
12
+ //# sourceMappingURL=useLockBodyScroll.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLockBodyScroll.d.ts","sourceRoot":"","sources":["../../src/hooks/useLockBodyScroll.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,OAAc,GAAG,IAAI,CAO5D"}
@@ -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
+ import { useEffect } from 'react';
8
+ /**
9
+ * Side-effect that locks the document body's scroll throughout the lifetime of
10
+ * the containing component. e.g. when the mobile sidebar is expanded.
11
+ */
12
+ export function useLockBodyScroll(lock = true) {
13
+ useEffect(() => {
14
+ document.body.style.overflow = lock ? 'hidden' : 'visible';
15
+ return () => {
16
+ document.body.style.overflow = 'visible';
17
+ };
18
+ }, [lock]);
19
+ }
20
+ //# sourceMappingURL=useLockBodyScroll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLockBodyScroll.js","sourceRoot":"","sources":["../../src/hooks/useLockBodyScroll.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAEhC;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAI,GAAY,IAAI;IACpD,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3D,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC3C,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AACb,CAAC"}
@@ -0,0 +1,4 @@
1
+ type Options = MutationObserverInit;
2
+ export declare function useMutationObserver(target: Element | undefined | null, callback: MutationCallback, options?: Options): void;
3
+ export {};
4
+ //# sourceMappingURL=useMutationObserver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMutationObserver.d.ts","sourceRoot":"","sources":["../../src/hooks/useMutationObserver.ts"],"names":[],"mappings":"AASA,KAAK,OAAO,GAAG,oBAAoB,CAAC;AASpC,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,EAClC,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,GAAE,OAAwB,GAChC,IAAI,CAeN"}
@@ -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
+ import { useEffect } from 'react';
8
+ import { useEvent, useShallowMemoObject } from '../utils/reactUtils';
9
+ const DefaultOptions = {
10
+ attributes: true,
11
+ characterData: true,
12
+ childList: true,
13
+ subtree: true,
14
+ };
15
+ export function useMutationObserver(target, callback, options = DefaultOptions) {
16
+ const stableCallback = useEvent(callback);
17
+ // MutationObserver options are not nested much
18
+ // so this should be to memo options in 99%
19
+ // TODO handle options.attributeFilter array
20
+ const stableOptions = useShallowMemoObject(options);
21
+ useEffect(() => {
22
+ const observer = new MutationObserver(stableCallback);
23
+ if (target) {
24
+ observer.observe(target, stableOptions);
25
+ }
26
+ return () => observer.disconnect();
27
+ }, [target, stableCallback, stableOptions]);
28
+ }
29
+ //# sourceMappingURL=useMutationObserver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMutationObserver.js","sourceRoot":"","sources":["../../src/hooks/useMutationObserver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAChC,OAAO,EAAC,QAAQ,EAAE,oBAAoB,EAAC,MAAM,qBAAqB,CAAC;AAInE,MAAM,cAAc,GAAY;IAC9B,UAAU,EAAE,IAAI;IAChB,aAAa,EAAE,IAAI;IACnB,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;CACd,CAAC;AAEF,MAAM,UAAU,mBAAmB,CACjC,MAAkC,EAClC,QAA0B,EAC1B,OAAO,GAAY,cAAc;IAEjC,MAAM,cAAc,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAE1C,+CAA+C;IAC/C,2CAA2C;IAC3C,4CAA4C;IAC5C,MAAM,aAAa,GAAY,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAE7D,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,cAAc,CAAC,CAAC;QACtD,IAAI,MAAM,EAAE,CAAC;YACX,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC,CAAC;AAC9C,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 { PrismTheme } from 'prism-react-renderer';
8
+ /**
9
+ * Returns a color-mode-dependent Prism theme: whatever the user specified in
10
+ * the config. Falls back to `palenight`.
11
+ */
12
+ export declare function usePrismTheme(): PrismTheme;
13
+ //# sourceMappingURL=usePrismTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrismTheme.d.ts","sourceRoot":"","sources":["../../src/hooks/usePrismTheme.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAErD;;;GAGG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAQ1C"}
@@ -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 { useColorMode } from '../contexts/colorMode';
8
+ import { useThemeConfig } from '../utils/useThemeConfig';
9
+ /**
10
+ * Returns a color-mode-dependent Prism theme: whatever the user specified in
11
+ * the config. Falls back to `palenight`.
12
+ */
13
+ export function usePrismTheme() {
14
+ const { prism } = useThemeConfig();
15
+ const { colorMode } = useColorMode();
16
+ const lightModeTheme = prism.theme;
17
+ const darkModeTheme = prism.darkTheme || lightModeTheme;
18
+ const prismTheme = colorMode === 'dark' ? darkModeTheme : lightModeTheme;
19
+ return prismTheme;
20
+ }
21
+ //# sourceMappingURL=usePrismTheme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrismTheme.js","sourceRoot":"","sources":["../../src/hooks/usePrismTheme.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAGvD;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,EAAC,KAAK,EAAC,GAAG,cAAc,EAAE,CAAC;IACjC,MAAM,EAAC,SAAS,EAAC,GAAG,YAAY,EAAE,CAAC;IACnC,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC;IACnC,MAAM,aAAa,GAAG,KAAK,CAAC,SAAS,IAAI,cAAc,CAAC;IACxD,MAAM,UAAU,GAAG,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC;IAEzE,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,25 @@
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
+ export type TOCHighlightConfig = {
8
+ /** A class name that all TOC links share. */
9
+ linkClassName: string;
10
+ /** The class name applied to the active (highlighted) link. */
11
+ linkActiveClassName: string;
12
+ /**
13
+ * The minimum heading level that the TOC includes. Only headings that are in
14
+ * this range will be eligible as "active heading".
15
+ */
16
+ minHeadingLevel: number;
17
+ /** @see {@link TOCHighlightConfig.minHeadingLevel} */
18
+ maxHeadingLevel: number;
19
+ };
20
+ /**
21
+ * Side-effect that applies the active class name to the TOC heading that the
22
+ * user is currently viewing. Disabled when `config` is undefined.
23
+ */
24
+ export declare function useTOCHighlight(config: TOCHighlightConfig | undefined): void;
25
+ //# sourceMappingURL=useTOCHighlight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTOCHighlight.d.ts","sourceRoot":"","sources":["../../src/hooks/useTOCHighlight.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA6GH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,6CAA6C;IAC7C,aAAa,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB,sDAAsD;IACtD,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,kBAAkB,GAAG,SAAS,GAAG,IAAI,CAwD5E"}
@@ -0,0 +1,130 @@
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, useRef } from 'react';
8
+ import { useThemeConfig } from '../utils/useThemeConfig';
9
+ // TODO make the hardcoded theme-classic classnames configurable (or add them
10
+ // to ThemeClassNames?)
11
+ /**
12
+ * If the anchor has no height and is just a "marker" in the DOM; we'll use the
13
+ * parent (normally the link text) rect boundaries instead
14
+ */
15
+ function getVisibleBoundingClientRect(element) {
16
+ const rect = element.getBoundingClientRect();
17
+ const hasNoHeight = rect.top === rect.bottom;
18
+ if (hasNoHeight) {
19
+ return getVisibleBoundingClientRect(element.parentNode);
20
+ }
21
+ return rect;
22
+ }
23
+ /**
24
+ * Considering we divide viewport into 2 zones of each 50vh, this returns true
25
+ * if an element is in the first zone (i.e., appear in viewport, near the top)
26
+ */
27
+ function isInViewportTopHalf(boundingRect) {
28
+ return boundingRect.top > 0 && boundingRect.bottom < window.innerHeight / 2;
29
+ }
30
+ function getAnchors({ minHeadingLevel, maxHeadingLevel, }) {
31
+ const selectors = [];
32
+ for (let i = minHeadingLevel; i <= maxHeadingLevel; i += 1) {
33
+ selectors.push(`h${i}.anchor`);
34
+ }
35
+ return Array.from(document.querySelectorAll(selectors.join()));
36
+ }
37
+ function getActiveAnchor(anchors, { anchorTopOffset, }) {
38
+ // Naming is hard: The "nextVisibleAnchor" is the first anchor that appear
39
+ // under the viewport top boundary. It does not mean this anchor is visible
40
+ // yet, but if user continues scrolling down, it will be the first to become
41
+ // visible
42
+ const nextVisibleAnchor = anchors.find((anchor) => {
43
+ const boundingRect = getVisibleBoundingClientRect(anchor);
44
+ return boundingRect.top >= anchorTopOffset;
45
+ });
46
+ if (nextVisibleAnchor) {
47
+ const boundingRect = getVisibleBoundingClientRect(nextVisibleAnchor);
48
+ // If anchor is in the top half of the viewport: it is the one we consider
49
+ // "active" (unless it's too close to the top and and soon to be scrolled
50
+ // outside viewport)
51
+ if (isInViewportTopHalf(boundingRect)) {
52
+ return nextVisibleAnchor;
53
+ }
54
+ // If anchor is in the bottom half of the viewport, or under the viewport,
55
+ // we consider the active anchor is the previous one. This is because the
56
+ // main text appearing in the user screen mostly belong to the previous
57
+ // anchor. Returns null for the first anchor, see
58
+ // https://github.com/facebook/docusaurus/issues/5318
59
+ return anchors[anchors.indexOf(nextVisibleAnchor) - 1] ?? null;
60
+ }
61
+ // No anchor under viewport top (i.e. we are at the bottom of the page),
62
+ // highlight the last anchor found
63
+ return anchors[anchors.length - 1] ?? null;
64
+ }
65
+ function getLinkAnchorValue(link) {
66
+ return decodeURIComponent(link.href.substring(link.href.indexOf('#') + 1));
67
+ }
68
+ function getLinks(linkClassName) {
69
+ return Array.from(document.getElementsByClassName(linkClassName));
70
+ }
71
+ function getNavbarHeight() {
72
+ // Not ideal to obtain actual height this way
73
+ // Using TS ! (not ?) because otherwise a bad selector would be un-noticed
74
+ return document.querySelector('.navbar').clientHeight;
75
+ }
76
+ function useAnchorTopOffsetRef() {
77
+ const anchorTopOffsetRef = useRef(0);
78
+ const { navbar: { hideOnScroll }, } = useThemeConfig();
79
+ useEffect(() => {
80
+ anchorTopOffsetRef.current = hideOnScroll ? 0 : getNavbarHeight();
81
+ }, [hideOnScroll]);
82
+ return anchorTopOffsetRef;
83
+ }
84
+ /**
85
+ * Side-effect that applies the active class name to the TOC heading that the
86
+ * user is currently viewing. Disabled when `config` is undefined.
87
+ */
88
+ export function useTOCHighlight(config) {
89
+ const lastActiveLinkRef = useRef(undefined);
90
+ const anchorTopOffsetRef = useAnchorTopOffsetRef();
91
+ useEffect(() => {
92
+ if (!config) {
93
+ // No-op, highlighting is disabled
94
+ return () => { };
95
+ }
96
+ const { linkClassName, linkActiveClassName, minHeadingLevel, maxHeadingLevel, } = config;
97
+ function updateLinkActiveClass(link, active) {
98
+ if (active) {
99
+ if (lastActiveLinkRef.current && lastActiveLinkRef.current !== link) {
100
+ lastActiveLinkRef.current.classList.remove(linkActiveClassName);
101
+ }
102
+ link.classList.add(linkActiveClassName);
103
+ lastActiveLinkRef.current = link;
104
+ // link.scrollIntoView({block: 'nearest'});
105
+ }
106
+ else {
107
+ link.classList.remove(linkActiveClassName);
108
+ }
109
+ }
110
+ function updateActiveLink() {
111
+ const links = getLinks(linkClassName);
112
+ const anchors = getAnchors({ minHeadingLevel, maxHeadingLevel });
113
+ const activeAnchor = getActiveAnchor(anchors, {
114
+ anchorTopOffset: anchorTopOffsetRef.current,
115
+ });
116
+ const activeLink = links.find((link) => activeAnchor && activeAnchor.id === getLinkAnchorValue(link));
117
+ links.forEach((link) => {
118
+ updateLinkActiveClass(link, link === activeLink);
119
+ });
120
+ }
121
+ document.addEventListener('scroll', updateActiveLink);
122
+ document.addEventListener('resize', updateActiveLink);
123
+ updateActiveLink();
124
+ return () => {
125
+ document.removeEventListener('scroll', updateActiveLink);
126
+ document.removeEventListener('resize', updateActiveLink);
127
+ };
128
+ }, [config, anchorTopOffsetRef]);
129
+ }
130
+ //# sourceMappingURL=useTOCHighlight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTOCHighlight.js","sourceRoot":"","sources":["../../src/hooks/useTOCHighlight.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAE,MAAM,EAAC,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EAAE,kBAAkB,CAAC,OAAO;aAC5C,CAAC,CAAC;YACH,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAC3B,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,IAAI,YAAY,CAAC,EAAE,KAAK,kBAAkB,CAAC,IAAI,CAAC,CACvE,CAAC;YAEF,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACrB,qBAAqB,CAAC,IAAI,EAAE,IAAI,KAAK,UAAU,CAAC,CAAC;YACnD,CAAC,CAAC,CAAC;QACL,CAAC;QAED,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QACtD,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QAEtD,gBAAgB,EAAE,CAAC;QAEnB,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;YACzD,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QAC3D,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,27 @@
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
+ declare const windowSizes: {
8
+ readonly desktop: 'desktop';
9
+ readonly mobile: 'mobile';
10
+ readonly ssr: 'ssr';
11
+ };
12
+ type WindowSize = keyof typeof windowSizes;
13
+ /**
14
+ * Gets the current window size as an enum value. We don't want it to return the
15
+ * actual width value, so that it only re-renders once a breakpoint is crossed.
16
+ *
17
+ * It may return `"ssr"`, which is very important to handle hydration FOUC or
18
+ * layout shifts. You have to handle it explicitly upfront. On the server, you
19
+ * may need to render BOTH the mobile/desktop elements (and hide one of them
20
+ * with mediaquery). We don't return `undefined` on purpose, to make it more
21
+ * explicit.
22
+ */
23
+ export declare function useWindowSize({ desktopBreakpoint, }?: {
24
+ desktopBreakpoint?: number;
25
+ }): WindowSize;
26
+ export {};
27
+ //# sourceMappingURL=useWindowSize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWindowSize.d.ts","sourceRoot":"","sources":["../../src/hooks/useWindowSize.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,QAAA,MAAM,WAAW;aACf,OAAO,EAAE,SAAS;aAClB,MAAM,EAAE,QAAQ;aAChB,GAAG,EAAE,KAAK;CACF,CAAC;AAEX,KAAK,UAAU,GAAG,MAAM,OAAO,WAAW,CAAC;AA2B3C;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,EAC5B,iBAAqC,GACtC,GAAE;IACD,iBAAiB,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,UAAU,CAQlB"}
@@ -0,0 +1,49 @@
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 { useSyncExternalStore } from 'react';
8
+ import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
9
+ const windowSizes = {
10
+ desktop: 'desktop',
11
+ mobile: 'mobile',
12
+ ssr: 'ssr',
13
+ };
14
+ // Note: this value is also hardcoded in Infima
15
+ // Both JS and CSS must have the same value
16
+ // Updating this JS value alone is not enough
17
+ // See https://github.com/facebook/docusaurus/issues/9603
18
+ const DesktopBreakpoint = 996;
19
+ function getWindowSize(desktopBreakpoint) {
20
+ if (!ExecutionEnvironment.canUseDOM) {
21
+ throw new Error('getWindowSize() should only be called after React hydration');
22
+ }
23
+ return window.innerWidth > desktopBreakpoint
24
+ ? windowSizes.desktop
25
+ : windowSizes.mobile;
26
+ }
27
+ function subscribeToWindowResize(onChange) {
28
+ window.addEventListener('resize', onChange);
29
+ return () => {
30
+ window.removeEventListener('resize', onChange);
31
+ };
32
+ }
33
+ /**
34
+ * Gets the current window size as an enum value. We don't want it to return the
35
+ * actual width value, so that it only re-renders once a breakpoint is crossed.
36
+ *
37
+ * It may return `"ssr"`, which is very important to handle hydration FOUC or
38
+ * layout shifts. You have to handle it explicitly upfront. On the server, you
39
+ * may need to render BOTH the mobile/desktop elements (and hide one of them
40
+ * with mediaquery). We don't return `undefined` on purpose, to make it more
41
+ * explicit.
42
+ */
43
+ export function useWindowSize({ desktopBreakpoint = DesktopBreakpoint, } = {}) {
44
+ return useSyncExternalStore(subscribeToWindowResize, () => getWindowSize(desktopBreakpoint),
45
+ // super important to return a constant value to avoid hydration mismatch
46
+ // see https://github.com/facebook/docusaurus/issues/9379
47
+ () => windowSizes.ssr);
48
+ }
49
+ //# sourceMappingURL=useWindowSize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWindowSize.js","sourceRoot":"","sources":["../../src/hooks/useWindowSize.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,oBAAoB,EAAC,MAAM,OAAO,CAAC;AAE3C,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AAEpE,MAAM,WAAW,GAAG;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;CACF,CAAC;AAIX,+CAA+C;AAC/C,2CAA2C;AAC3C,6CAA6C;AAC7C,yDAAyD;AACzD,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,SAAS,aAAa,CAAC,iBAAyB;IAC9C,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CACb,6DAA6D,CAC9D,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,UAAU,GAAG,iBAAiB;QAC1C,CAAC,CAAC,WAAW,CAAC,OAAO;QACrB,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC;AACzB,CAAC;AAED,SAAS,uBAAuB,CAAC,QAAoB;IACnD,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC5C,OAAO,GAAG,EAAE;QACV,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACjD,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,iBAAiB,GAAG,iBAAiB,GACtC,GAEG,EAAE;IACJ,OAAO,oBAAoB,CACzB,uBAAuB,EACvB,GAAG,EAAE,CAAC,aAAa,CAAC,iBAAiB,CAAC;IACtC,yEAAyE;IACzE,yDAAyD;IACzD,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CACtB,CAAC;AACJ,CAAC"}
package/lib/index.d.ts ADDED
@@ -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
+ export { useThemeConfig, type ThemeConfig, type UserThemeConfig, type Navbar, type NavbarItem, type NavbarLogo, type MultiColumnFooter, type SimpleFooter, type Footer, type FooterColumnItem, type FooterLogo, type FooterLinkItem, type ColorModeConfig, } from './utils/useThemeConfig';
8
+ export { default as ThemedComponent } from './components/ThemedComponent';
9
+ export { createStorageSlot, useStorageSlot, listStorageKeys, } from './utils/storageUtils';
10
+ export { usePluralForm } from './utils/usePluralForm';
11
+ export { useCollapsible, Collapsible } from './components/Collapsible';
12
+ export { ThemeClassNames } from './utils/ThemeClassNames';
13
+ export { prefersReducedMotion } from './utils/accessibilityUtils';
14
+ export { useEvent, usePrevious, composeProviders, ReactContextError, } from './utils/reactUtils';
15
+ export { PageMetadata, HtmlClassNameProvider } from './utils/metadataUtils';
16
+ export { useColorMode, type ColorMode } from './contexts/colorMode';
17
+ export { NavbarSecondaryMenuFiller, type NavbarSecondaryMenuComponent, } from './contexts/navbarSecondaryMenu/content';
18
+ export { useWindowSize } from './hooks/useWindowSize';
19
+ export { translateTagsPageTitle, TagsPageLinkLabel, listTagsByLetters, type TagLetterEntry, } from './utils/tagsUtils';
20
+ export { useAnchorTargetClassName } from './utils/anchorUtils';
21
+ export { isMultiColumnFooterLinks } from './utils/footerUtils';
22
+ export { isRegexpStringMatch } from './utils/regexpUtils';
23
+ export { duplicates, uniq, groupBy } from './utils/jsUtils';
24
+ export { usePrismTheme } from './hooks/usePrismTheme';
25
+ export { processAdmonitionProps } from './utils/admonitionUtils';
26
+ export { useHistorySelector, useQueryString, useQueryStringList, useClearQueryString, mergeSearchParams, mergeSearchStrings, } from './utils/historyUtils';
27
+ export { SkipToContentFallbackId, SkipToContentLink, } from './utils/skipToContentUtils';
28
+ export { UnlistedBannerTitle, UnlistedBannerMessage, DraftBannerTitle, DraftBannerMessage, } from './translations/contentVisibilityTranslations';
29
+ export { ErrorBoundaryTryAgainButton, ErrorBoundaryError, ErrorBoundaryErrorMessageFallback, ErrorCauseBoundary, } from './utils/errorBoundaryUtils';
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EACL,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAExE,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAC,c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OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,iCAAiC,EACjC,kBAAkB,GACnB,MAAM,4BAA4B,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,37 @@
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
+ * APIs to document
9
+ */
10
+ export { useThemeConfig, } from './utils/useThemeConfig';
11
+ export { default as ThemedComponent } from './components/ThemedComponent';
12
+ export { createStorageSlot, useStorageSlot, listStorageKeys, } from './utils/storageUtils';
13
+ export { usePluralForm } from './utils/usePluralForm';
14
+ export { useCollapsible, Collapsible } from './components/Collapsible';
15
+ export { ThemeClassNames } from './utils/ThemeClassNames';
16
+ export { prefersReducedMotion } from './utils/accessibilityUtils';
17
+ export { useEvent, usePrevious, composeProviders, ReactContextError, } from './utils/reactUtils';
18
+ export { PageMetadata, HtmlClassNameProvider } from './utils/metadataUtils';
19
+ export { useColorMode } from './contexts/colorMode';
20
+ export { NavbarSecondaryMenuFiller, } from './contexts/navbarSecondaryMenu/content';
21
+ export { useWindowSize } from './hooks/useWindowSize';
22
+ /*
23
+ * APIs kept undocumented, on purpose
24
+ * Note: we still guarantee retro-compatibility on those
25
+ */
26
+ export { translateTagsPageTitle, TagsPageLinkLabel, listTagsByLetters, } from './utils/tagsUtils';
27
+ export { useAnchorTargetClassName } from './utils/anchorUtils';
28
+ export { isMultiColumnFooterLinks } from './utils/footerUtils';
29
+ export { isRegexpStringMatch } from './utils/regexpUtils';
30
+ export { duplicates, uniq, groupBy } from './utils/jsUtils';
31
+ export { usePrismTheme } from './hooks/usePrismTheme';
32
+ export { processAdmonitionProps } from './utils/admonitionUtils';
33
+ export { useHistorySelector, useQueryString, useQueryStringList, useClearQueryString, mergeSearchParams, mergeSearchStrings, } from './utils/historyUtils';
34
+ export { SkipToContentFallbackId, SkipToContentLink, } from './utils/skipToContentUtils';
35
+ export { UnlistedBannerTitle, UnlistedBannerMessage, DraftBannerTitle, DraftBannerMessage, } from './translations/contentVisibilityTranslations';
36
+ export { ErrorBoundaryTryAgainButton, ErrorBoundaryError, ErrorBoundaryErrorMessageFallback, ErrorCauseBoundary, } from './utils/errorBoundaryUtils';
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AAEH,OAAO,EACL,cAAc,GAaf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAExE,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAC,cAAc,EAAE,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAErE,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAC,oBAAoB,EAAC,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EACL,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAC,YAAY,EAAE,qBAAqB,EAAC,MAAM,uBAAuB,CAAC;AAE1E,OAAO,EAAC,YAAY,EAAiB,MAAM,sBAAsB,CAAC;AAElE,OAAO,EACL,yBAAyB,GAE1B,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAEpD;;;GAGG;AAEH,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,GAElB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAC,wBAAwB,EAAC,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAC,wBAAwB,EAAC,MAAM,qBAAqB,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