@docusaurus/theme-common 2.0.0-beta.fc64c12e4 → 2.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 (274) hide show
  1. package/lib/components/Collapsible/index.d.ts +35 -6
  2. package/lib/components/Collapsible/index.d.ts.map +1 -0
  3. package/lib/components/Collapsible/index.js +33 -30
  4. package/lib/components/Collapsible/index.js.map +1 -0
  5. package/lib/components/Details/index.d.ts +8 -3
  6. package/lib/components/Details/index.d.ts.map +1 -0
  7. package/lib/components/Details/index.js +31 -19
  8. package/lib/components/Details/index.js.map +1 -0
  9. package/lib/components/Details/styles.module.css +14 -11
  10. package/lib/contexts/announcementBar.d.ts +22 -0
  11. package/lib/contexts/announcementBar.d.ts.map +1 -0
  12. package/lib/{utils/announcementBarUtils.js → contexts/announcementBar.js} +30 -31
  13. package/lib/contexts/announcementBar.js.map +1 -0
  14. package/lib/contexts/blogPost.d.ts +33 -0
  15. package/lib/contexts/blogPost.d.ts.map +1 -0
  16. package/lib/contexts/blogPost.js +46 -0
  17. package/lib/contexts/blogPost.js.map +1 -0
  18. package/lib/contexts/colorMode.d.ts +27 -0
  19. package/lib/contexts/colorMode.d.ts.map +1 -0
  20. package/lib/contexts/colorMode.js +132 -0
  21. package/lib/contexts/colorMode.js.map +1 -0
  22. package/lib/contexts/doc.d.ts +30 -0
  23. package/lib/contexts/doc.d.ts.map +1 -0
  24. package/lib/contexts/doc.js +48 -0
  25. package/lib/contexts/doc.js.map +1 -0
  26. package/lib/contexts/docSidebarItemsExpandedState.d.ts +31 -0
  27. package/lib/contexts/docSidebarItemsExpandedState.d.ts.map +1 -0
  28. package/lib/contexts/docSidebarItemsExpandedState.js +28 -0
  29. package/lib/contexts/docSidebarItemsExpandedState.js.map +1 -0
  30. package/lib/contexts/docsPreferredVersion.d.ts +30 -0
  31. package/lib/contexts/docsPreferredVersion.d.ts.map +1 -0
  32. package/lib/contexts/docsPreferredVersion.js +130 -0
  33. package/lib/contexts/docsPreferredVersion.js.map +1 -0
  34. package/lib/contexts/docsSidebar.d.ts +26 -0
  35. package/lib/contexts/docsSidebar.d.ts.map +1 -0
  36. package/lib/contexts/docsSidebar.js +30 -0
  37. package/lib/contexts/docsSidebar.js.map +1 -0
  38. package/lib/contexts/docsVersion.d.ts +20 -0
  39. package/lib/contexts/docsVersion.d.ts.map +1 -0
  40. package/lib/contexts/docsVersion.js +26 -0
  41. package/lib/contexts/docsVersion.js.map +1 -0
  42. package/lib/contexts/navbarMobileSidebar.d.ts +31 -0
  43. package/lib/contexts/navbarMobileSidebar.d.ts.map +1 -0
  44. package/lib/contexts/navbarMobileSidebar.js +56 -0
  45. package/lib/contexts/navbarMobileSidebar.js.map +1 -0
  46. package/lib/contexts/navbarSecondaryMenu/content.d.ts +37 -0
  47. package/lib/contexts/navbarSecondaryMenu/content.d.ts.map +1 -0
  48. package/lib/contexts/navbarSecondaryMenu/content.js +50 -0
  49. package/lib/contexts/navbarSecondaryMenu/content.js.map +1 -0
  50. package/lib/contexts/navbarSecondaryMenu/display.d.ts +24 -0
  51. package/lib/contexts/navbarSecondaryMenu/display.d.ts.map +1 -0
  52. package/lib/contexts/navbarSecondaryMenu/display.js +62 -0
  53. package/lib/contexts/navbarSecondaryMenu/display.js.map +1 -0
  54. package/lib/contexts/tabGroupChoice.d.ts +21 -0
  55. package/lib/contexts/tabGroupChoice.d.ts.map +1 -0
  56. package/lib/contexts/tabGroupChoice.js +49 -0
  57. package/lib/contexts/tabGroupChoice.js.map +1 -0
  58. package/lib/{utils/usePrevious.d.ts → hooks/styles.css} +4 -1
  59. package/lib/hooks/useBackToTopButton.d.ts +27 -0
  60. package/lib/hooks/useBackToTopButton.d.ts.map +1 -0
  61. package/lib/hooks/useBackToTopButton.js +50 -0
  62. package/lib/hooks/useBackToTopButton.js.map +1 -0
  63. package/lib/hooks/useCodeWordWrap.d.ts +14 -0
  64. package/lib/hooks/useCodeWordWrap.d.ts.map +1 -0
  65. package/lib/hooks/useCodeWordWrap.js +67 -0
  66. package/lib/hooks/useCodeWordWrap.js.map +1 -0
  67. package/lib/hooks/useHideableNavbar.d.ts +17 -0
  68. package/lib/hooks/useHideableNavbar.d.ts.map +1 -0
  69. package/lib/hooks/useHideableNavbar.js +60 -0
  70. package/lib/hooks/useHideableNavbar.js.map +1 -0
  71. package/lib/hooks/useKeyboardNavigation.d.ts +20 -0
  72. package/lib/hooks/useKeyboardNavigation.d.ts.map +1 -0
  73. package/lib/hooks/useKeyboardNavigation.js +39 -0
  74. package/lib/hooks/useKeyboardNavigation.js.map +1 -0
  75. package/lib/hooks/useLockBodyScroll.d.ts +12 -0
  76. package/lib/hooks/useLockBodyScroll.d.ts.map +1 -0
  77. package/lib/hooks/useLockBodyScroll.js +20 -0
  78. package/lib/hooks/useLockBodyScroll.js.map +1 -0
  79. package/lib/hooks/useMutationObserver.d.ts +4 -0
  80. package/lib/hooks/useMutationObserver.d.ts.map +1 -0
  81. package/lib/hooks/useMutationObserver.js +29 -0
  82. package/lib/hooks/useMutationObserver.js.map +1 -0
  83. package/lib/hooks/usePrismTheme.d.ts +13 -0
  84. package/lib/hooks/usePrismTheme.d.ts.map +1 -0
  85. package/lib/hooks/usePrismTheme.js +21 -0
  86. package/lib/hooks/usePrismTheme.js.map +1 -0
  87. package/lib/hooks/useSearchPage.d.ts +25 -0
  88. package/lib/hooks/useSearchPage.d.ts.map +1 -0
  89. package/lib/hooks/useSearchPage.js +43 -0
  90. package/lib/hooks/useSearchPage.js.map +1 -0
  91. package/lib/hooks/useSkipToContent.d.ts +25 -0
  92. package/lib/hooks/useSkipToContent.d.ts.map +1 -0
  93. package/lib/hooks/useSkipToContent.js +35 -0
  94. package/lib/hooks/useSkipToContent.js.map +1 -0
  95. package/lib/hooks/useTOCHighlight.d.ts +25 -0
  96. package/lib/hooks/useTOCHighlight.d.ts.map +1 -0
  97. package/lib/hooks/useTOCHighlight.js +130 -0
  98. package/lib/hooks/useTOCHighlight.js.map +1 -0
  99. package/lib/hooks/useWindowSize.d.ts +28 -0
  100. package/lib/hooks/useWindowSize.d.ts.map +1 -0
  101. package/lib/hooks/useWindowSize.js +59 -0
  102. package/lib/hooks/useWindowSize.js.map +1 -0
  103. package/lib/index.d.ts +15 -19
  104. package/lib/index.d.ts.map +1 -0
  105. package/lib/index.js +22 -15
  106. package/lib/index.js.map +1 -0
  107. package/lib/internal.d.ts +41 -0
  108. package/lib/internal.d.ts.map +1 -0
  109. package/lib/internal.js +52 -0
  110. package/lib/internal.js.map +1 -0
  111. package/lib/utils/ThemeClassNames.d.ts +49 -12
  112. package/lib/utils/ThemeClassNames.d.ts.map +1 -0
  113. package/lib/utils/ThemeClassNames.js +47 -4
  114. package/lib/utils/ThemeClassNames.js.map +1 -0
  115. package/lib/utils/codeBlockUtils.d.ts +63 -0
  116. package/lib/utils/codeBlockUtils.d.ts.map +1 -0
  117. package/lib/utils/codeBlockUtils.js +159 -3
  118. package/lib/utils/codeBlockUtils.js.map +1 -0
  119. package/lib/utils/docsUtils.d.ts +91 -0
  120. package/lib/utils/docsUtils.d.ts.map +1 -0
  121. package/lib/utils/docsUtils.js +217 -1
  122. package/lib/utils/docsUtils.js.map +1 -0
  123. package/lib/utils/footerUtils.d.ts +13 -0
  124. package/lib/utils/footerUtils.d.ts.map +1 -0
  125. package/lib/utils/footerUtils.js +14 -0
  126. package/lib/utils/footerUtils.js.map +1 -0
  127. package/lib/utils/generalUtils.d.ts +11 -1
  128. package/lib/utils/generalUtils.d.ts.map +1 -0
  129. package/lib/utils/generalUtils.js +9 -5
  130. package/lib/utils/generalUtils.js.map +1 -0
  131. package/lib/utils/historyUtils.d.ts +17 -0
  132. package/lib/utils/historyUtils.d.ts.map +1 -0
  133. package/lib/utils/historyUtils.js +38 -0
  134. package/lib/utils/historyUtils.js.map +1 -0
  135. package/lib/utils/jsUtils.d.ts +23 -0
  136. package/lib/utils/jsUtils.d.ts.map +1 -0
  137. package/lib/utils/jsUtils.js +29 -0
  138. package/lib/utils/jsUtils.js.map +1 -0
  139. package/lib/utils/metadataUtils.d.ts +38 -0
  140. package/lib/utils/metadataUtils.d.ts.map +1 -0
  141. package/lib/utils/metadataUtils.js +70 -0
  142. package/lib/utils/metadataUtils.js.map +1 -0
  143. package/lib/utils/navbarUtils.d.ts +21 -0
  144. package/lib/utils/navbarUtils.d.ts.map +1 -0
  145. package/lib/utils/navbarUtils.js +36 -0
  146. package/lib/utils/navbarUtils.js.map +1 -0
  147. package/lib/utils/reactUtils.d.ts +69 -0
  148. package/lib/utils/reactUtils.d.ts.map +1 -0
  149. package/lib/utils/reactUtils.js +98 -0
  150. package/lib/utils/reactUtils.js.map +1 -0
  151. package/lib/utils/regexpUtils.d.ts +12 -0
  152. package/lib/utils/regexpUtils.d.ts.map +1 -0
  153. package/lib/utils/regexpUtils.js +18 -0
  154. package/lib/utils/regexpUtils.js.map +1 -0
  155. package/lib/utils/routesUtils.d.ts +26 -0
  156. package/lib/utils/routesUtils.d.ts.map +1 -0
  157. package/lib/utils/routesUtils.js +54 -0
  158. package/lib/utils/routesUtils.js.map +1 -0
  159. package/lib/utils/scrollUtils.d.ts +83 -0
  160. package/lib/utils/scrollUtils.d.ts.map +1 -0
  161. package/lib/utils/scrollUtils.js +200 -0
  162. package/lib/utils/scrollUtils.js.map +1 -0
  163. package/lib/utils/searchUtils.d.ts +13 -0
  164. package/lib/utils/searchUtils.d.ts.map +1 -0
  165. package/lib/utils/searchUtils.js +37 -0
  166. package/lib/utils/searchUtils.js.map +1 -0
  167. package/lib/utils/storageUtils.d.ts +15 -7
  168. package/lib/utils/storageUtils.d.ts.map +1 -0
  169. package/lib/utils/storageUtils.js +55 -22
  170. package/lib/utils/storageUtils.js.map +1 -0
  171. package/lib/utils/tagsUtils.d.ts +18 -0
  172. package/lib/utils/tagsUtils.d.ts.map +1 -0
  173. package/lib/utils/tagsUtils.js +36 -0
  174. package/lib/utils/tagsUtils.js.map +1 -0
  175. package/lib/utils/tocUtils.d.ts +36 -0
  176. package/lib/utils/tocUtils.d.ts.map +1 -0
  177. package/lib/utils/tocUtils.js +84 -0
  178. package/lib/utils/tocUtils.js.map +1 -0
  179. package/lib/utils/useAlternatePageUtils.d.ts +21 -1
  180. package/lib/utils/useAlternatePageUtils.d.ts.map +1 -0
  181. package/lib/utils/useAlternatePageUtils.js +9 -4
  182. package/lib/utils/useAlternatePageUtils.js.map +1 -0
  183. package/lib/utils/useLocalPathname.d.ts +6 -0
  184. package/lib/utils/useLocalPathname.d.ts.map +1 -0
  185. package/lib/utils/useLocalPathname.js +7 -4
  186. package/lib/utils/useLocalPathname.js.map +1 -0
  187. package/lib/utils/useLocationChange.d.ts +9 -6
  188. package/lib/utils/useLocationChange.d.ts.map +1 -0
  189. package/lib/utils/useLocationChange.js +17 -11
  190. package/lib/utils/useLocationChange.js.map +1 -0
  191. package/lib/utils/usePluralForm.d.ts +12 -0
  192. package/lib/utils/usePluralForm.d.ts.map +1 -0
  193. package/lib/utils/usePluralForm.js +36 -37
  194. package/lib/utils/usePluralForm.js.map +1 -0
  195. package/lib/utils/useThemeConfig.d.ts +56 -29
  196. package/lib/utils/useThemeConfig.d.ts.map +1 -0
  197. package/lib/utils/useThemeConfig.js +4 -0
  198. package/lib/utils/useThemeConfig.js.map +1 -0
  199. package/package.json +35 -15
  200. package/src/components/Collapsible/index.tsx +57 -48
  201. package/src/components/Details/index.tsx +27 -12
  202. package/src/components/Details/styles.module.css +14 -11
  203. package/src/{utils/announcementBarUtils.tsx → contexts/announcementBar.tsx} +43 -39
  204. package/src/contexts/blogPost.tsx +80 -0
  205. package/src/contexts/colorMode.tsx +198 -0
  206. package/src/contexts/doc.tsx +71 -0
  207. package/src/contexts/docSidebarItemsExpandedState.tsx +55 -0
  208. package/src/contexts/docsPreferredVersion.tsx +251 -0
  209. package/src/contexts/docsSidebar.tsx +50 -0
  210. package/src/contexts/docsVersion.tsx +36 -0
  211. package/src/contexts/navbarMobileSidebar.tsx +99 -0
  212. package/src/contexts/navbarSecondaryMenu/content.tsx +100 -0
  213. package/src/contexts/navbarSecondaryMenu/display.tsx +102 -0
  214. package/src/contexts/tabGroupChoice.tsx +85 -0
  215. package/{lib/utils/pathUtils.d.ts → src/hooks/styles.css} +4 -1
  216. package/src/hooks/useBackToTopButton.ts +73 -0
  217. package/src/hooks/useCodeWordWrap.ts +105 -0
  218. package/src/hooks/useHideableNavbar.ts +75 -0
  219. package/src/hooks/useKeyboardNavigation.ts +45 -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/useSearchPage.ts +79 -0
  224. package/src/hooks/useSkipToContent.ts +58 -0
  225. package/src/hooks/useTOCHighlight.ts +189 -0
  226. package/src/hooks/useWindowSize.ts +72 -0
  227. package/src/index.ts +49 -42
  228. package/src/internal.ts +122 -0
  229. package/src/types.d.ts +0 -2
  230. package/src/utils/ThemeClassNames.ts +54 -5
  231. package/src/utils/codeBlockUtils.ts +241 -2
  232. package/src/utils/docsUtils.tsx +334 -0
  233. package/src/utils/footerUtils.ts +18 -0
  234. package/src/utils/generalUtils.ts +9 -5
  235. package/src/utils/historyUtils.ts +45 -0
  236. package/src/utils/jsUtils.ts +36 -0
  237. package/src/utils/metadataUtils.tsx +115 -0
  238. package/src/utils/navbarUtils.tsx +45 -0
  239. package/src/utils/reactUtils.tsx +129 -0
  240. package/src/utils/regexpUtils.ts +24 -0
  241. package/src/utils/routesUtils.ts +75 -0
  242. package/src/utils/scrollUtils.tsx +304 -0
  243. package/src/utils/searchUtils.ts +51 -0
  244. package/src/utils/storageUtils.ts +56 -23
  245. package/src/utils/tagsUtils.ts +50 -0
  246. package/src/utils/tocUtils.ts +119 -0
  247. package/src/utils/useAlternatePageUtils.ts +19 -6
  248. package/src/utils/useLocalPathname.ts +6 -4
  249. package/src/utils/useLocationChange.ts +24 -20
  250. package/src/utils/usePluralForm.ts +50 -38
  251. package/src/utils/useThemeConfig.ts +55 -31
  252. package/copyUntypedFiles.js +0 -20
  253. package/lib/.tsbuildinfo +0 -1
  254. package/lib/utils/announcementBarUtils.d.ts +0 -17
  255. package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.d.ts +0 -21
  256. package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.js +0 -94
  257. package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.d.ts +0 -13
  258. package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.js +0 -20
  259. package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.d.ts +0 -5
  260. package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.js +0 -41
  261. package/lib/utils/mobileSecondaryMenu.d.ts +0 -20
  262. package/lib/utils/mobileSecondaryMenu.js +0 -50
  263. package/lib/utils/pathUtils.js +0 -13
  264. package/lib/utils/usePrevious.js +0 -14
  265. package/src/utils/__tests__/codeBlockUtils.test.ts +0 -54
  266. package/src/utils/__tests__/pathUtils.test.ts +0 -32
  267. package/src/utils/docsPreferredVersion/DocsPreferredVersionProvider.tsx +0 -165
  268. package/src/utils/docsPreferredVersion/DocsPreferredVersionStorage.ts +0 -34
  269. package/src/utils/docsPreferredVersion/useDocsPreferredVersion.ts +0 -66
  270. package/src/utils/docsUtils.ts +0 -11
  271. package/src/utils/mobileSecondaryMenu.tsx +0 -115
  272. package/src/utils/pathUtils.ts +0 -17
  273. package/src/utils/usePrevious.ts +0 -18
  274. package/tsconfig.json +0 -10
@@ -4,32 +4,61 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import React, { Dispatch, SetStateAction, ReactNode } from 'react';
8
- export declare type UseCollapsibleConfig = {
9
- initialState: boolean | (() => boolean);
10
- };
11
- export declare type UseCollapsibleReturns = {
7
+ import React, { type Dispatch, type SetStateAction, type ReactNode } from 'react';
8
+ /**
9
+ * This hook is a very thin wrapper around a `useState`.
10
+ */
11
+ export declare function useCollapsible({ initialState, }: {
12
+ /** The initial state. Will be non-collapsed by default. */
13
+ initialState?: boolean | (() => boolean);
14
+ }): {
12
15
  collapsed: boolean;
13
16
  setCollapsed: Dispatch<SetStateAction<boolean>>;
14
17
  toggleCollapsed: () => void;
15
18
  };
16
- export declare function useCollapsible({ initialState, }: UseCollapsibleConfig): UseCollapsibleReturns;
17
19
  declare type CollapsibleAnimationConfig = {
18
20
  duration?: number;
19
21
  easing?: string;
20
22
  };
21
23
  declare type CollapsibleElementType = React.ElementType<Pick<React.HTMLAttributes<unknown>, 'className' | 'onTransitionEnd' | 'style'>>;
22
24
  declare type CollapsibleBaseProps = {
25
+ /** The actual DOM element to be used in the markup. */
23
26
  as?: CollapsibleElementType;
27
+ /** Initial collapsed state. */
24
28
  collapsed: boolean;
25
29
  children: ReactNode;
30
+ /** Configuration of animation, like `duration` and `easing` */
26
31
  animation?: CollapsibleAnimationConfig;
32
+ /**
33
+ * A callback fired when the collapse transition animation ends. Receives
34
+ * the **new** collapsed state: e.g. when
35
+ * expanding, `collapsed` will be `false`. You can use this for some "cleanup"
36
+ * like applying new styles when the container is fully expanded.
37
+ */
27
38
  onCollapseTransitionEnd?: (collapsed: boolean) => void;
39
+ /** Class name for the underlying DOM element. */
28
40
  className?: string;
41
+ /**
42
+ * This is mostly useful for details/summary component where ssrStyle is not
43
+ * needed (as details are hidden natively) and can mess up with the browser's
44
+ * native behavior when JS fails to load or is disabled
45
+ */
29
46
  disableSSRStyle?: boolean;
30
47
  };
31
48
  declare type CollapsibleProps = CollapsibleBaseProps & {
49
+ /**
50
+ * Delay rendering of the content till first expansion. Marked as required to
51
+ * force us to think if content should be server-rendered or not. This has
52
+ * perf impact since it reduces html file sizes, but could undermine SEO.
53
+ * @see https://github.com/facebook/docusaurus/issues/4753
54
+ */
32
55
  lazy: boolean;
33
56
  };
57
+ /**
58
+ * A headless component providing smooth and uniform collapsing behavior. The
59
+ * component will be invisible (zero height) when collapsed. Doesn't provide
60
+ * interactivity by itself: collapse state is toggled through props.
61
+ */
34
62
  export declare function Collapsible({ lazy, ...props }: CollapsibleProps): JSX.Element;
35
63
  export {};
64
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Collapsible/index.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAC7B,YAAY,GACb,EAAE;IACD,2DAA2D;IAC3D,YAAY,CAAC,EAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC;CAC1C,GAAG;IACF,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAChD,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B,CAYA;AAgCD,aAAK,0BAA0B,GAAG;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAoEF,aAAK,sBAAsB,GAAG,KAAK,CAAC,WAAW,CAC7C,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,iBAAiB,GAAG,OAAO,CAAC,CAC/E,CAAC;AAaF,aAAK,oBAAoB,GAAG;IAC1B,uDAAuD;IACvD,EAAE,CAAC,EAAE,sBAAsB,CAAC;IAC5B,+BAA+B;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,0BAA0B,CAAC;IACvC;;;;;OAKG;IACH,uBAAuB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAyDF,aAAK,gBAAgB,GAAG,oBAAoB,GAAG;IAC7C;;;;;OAKG;IACH,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAC,IAAI,EAAE,GAAG,KAAK,EAAC,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAG3E"}
@@ -4,12 +4,14 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
8
7
  import React, { useState, useEffect, useRef, useCallback, useLayoutEffect, } from 'react';
8
+ import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
9
9
  const DefaultAnimationEasing = 'ease-in-out';
10
- // This hook just define the state
10
+ /**
11
+ * This hook is a very thin wrapper around a `useState`.
12
+ */
11
13
  export function useCollapsible({ initialState, }) {
12
- const [collapsed, setCollapsed] = useState(initialState !== null && initialState !== void 0 ? initialState : false);
14
+ const [collapsed, setCollapsed] = useState(initialState ?? false);
13
15
  const toggleCollapsed = useCallback(() => {
14
16
  setCollapsed((expanded) => !expanded);
15
17
  }, []);
@@ -36,7 +38,8 @@ function applyCollapsedStyle(el, collapsed) {
36
38
  el.style.height = collapsedStyles.height;
37
39
  }
38
40
  /*
39
- Lex111: Dynamic transition duration is used in Material design, this technique is good for a large number of items.
41
+ Lex111: Dynamic transition duration is used in Material design, this technique
42
+ is good for a large number of items.
40
43
  https://material.io/archive/guidelines/motion/duration-easing.html#duration-easing-dynamic-durations
41
44
  https://github.com/mui-org/material-ui/blob/e724d98eba018e55e1a684236a2037e24bcf050c/packages/material-ui/src/styles/createTransitions.js#L40-L43
42
45
  */
@@ -49,10 +52,9 @@ function useCollapseAnimation({ collapsibleRef, collapsed, animation, }) {
49
52
  useEffect(() => {
50
53
  const el = collapsibleRef.current;
51
54
  function getTransitionStyles() {
52
- var _a, _b;
53
55
  const height = el.scrollHeight;
54
- const duration = (_a = animation === null || animation === void 0 ? void 0 : animation.duration) !== null && _a !== void 0 ? _a : getAutoHeightDuration(height);
55
- const easing = (_b = animation === null || animation === void 0 ? void 0 : animation.easing) !== null && _b !== void 0 ? _b : DefaultAnimationEasing;
56
+ const duration = animation?.duration ?? getAutoHeightDuration(height);
57
+ const easing = animation?.easing ?? DefaultAnimationEasing;
56
58
  return {
57
59
  transition: `height ${duration}ms ${easing}`,
58
60
  height: `${height}px`,
@@ -93,7 +95,10 @@ function useCollapseAnimation({ collapsibleRef, collapsed, animation, }) {
93
95
  return startAnimation();
94
96
  }, [collapsibleRef, collapsed, animation]);
95
97
  }
96
- // Prevent hydration layout shift before anims are handled imperatively with JS
98
+ /**
99
+ * Prevent hydration layout shift before animations are handled imperatively
100
+ * with JS
101
+ */
97
102
  function getSSRStyle(collapsed) {
98
103
  if (ExecutionEnvironment.canUseDOM) {
99
104
  return undefined;
@@ -101,47 +106,45 @@ function getSSRStyle(collapsed) {
101
106
  return collapsed ? CollapsedStyles : ExpandedStyles;
102
107
  }
103
108
  function CollapsibleBase({ as: As = 'div', collapsed, children, animation, onCollapseTransitionEnd, className, disableSSRStyle, }) {
104
- // any because TS is a pain for HTML element refs, see https://twitter.com/sebastienlorber/status/1412784677795110914
105
109
  const collapsibleRef = useRef(null);
106
110
  useCollapseAnimation({ collapsibleRef, collapsed, animation });
107
- return (React.createElement(As
108
- // @ts-expect-error: see https://twitter.com/sebastienlorber/status/1412784677795110914
109
- , {
110
- // @ts-expect-error: see https://twitter.com/sebastienlorber/status/1412784677795110914
111
- ref: collapsibleRef, style: disableSSRStyle ? undefined : getSSRStyle(collapsed), onTransitionEnd: (e) => {
111
+ return (<As
112
+ // @ts-expect-error: the "too complicated type" is produced from
113
+ // "CollapsibleElementType" being a huge union
114
+ ref={collapsibleRef} // Refs are contravariant, which is not expressible in TS
115
+ style={disableSSRStyle ? undefined : getSSRStyle(collapsed)} onTransitionEnd={(e) => {
112
116
  if (e.propertyName !== 'height') {
113
117
  return;
114
118
  }
115
- const el = collapsibleRef.current;
116
- const currentCollapsibleElementHeight = el.style.height;
117
- if (!collapsed &&
118
- parseInt(currentCollapsibleElementHeight, 10) === el.scrollHeight) {
119
- applyCollapsedStyle(el, false);
120
- onCollapseTransitionEnd === null || onCollapseTransitionEnd === void 0 ? void 0 : onCollapseTransitionEnd(false);
121
- }
122
- if (currentCollapsibleElementHeight === CollapsedStyles.height) {
123
- applyCollapsedStyle(el, true);
124
- onCollapseTransitionEnd === null || onCollapseTransitionEnd === void 0 ? void 0 : onCollapseTransitionEnd(true);
125
- }
126
- }, className: className }, children));
119
+ applyCollapsedStyle(collapsibleRef.current, collapsed);
120
+ onCollapseTransitionEnd?.(collapsed);
121
+ }} className={className}>
122
+ {children}
123
+ </As>);
127
124
  }
128
125
  function CollapsibleLazy({ collapsed, ...props }) {
129
126
  const [mounted, setMounted] = useState(!collapsed);
127
+ // Updated in effect so that first expansion transition can work
128
+ const [lazyCollapsed, setLazyCollapsed] = useState(collapsed);
130
129
  useLayoutEffect(() => {
131
130
  if (!collapsed) {
132
131
  setMounted(true);
133
132
  }
134
133
  }, [collapsed]);
135
- // lazyCollapsed updated in effect so that the first expansion transition can work
136
- const [lazyCollapsed, setLazyCollapsed] = useState(collapsed);
137
134
  useLayoutEffect(() => {
138
135
  if (mounted) {
139
136
  setLazyCollapsed(collapsed);
140
137
  }
141
138
  }, [mounted, collapsed]);
142
- return mounted ? (React.createElement(CollapsibleBase, { ...props, collapsed: lazyCollapsed })) : null;
139
+ return mounted ? (<CollapsibleBase {...props} collapsed={lazyCollapsed}/>) : null;
143
140
  }
141
+ /**
142
+ * A headless component providing smooth and uniform collapsing behavior. The
143
+ * component will be invisible (zero height) when collapsed. Doesn't provide
144
+ * interactivity by itself: collapse state is toggled through props.
145
+ */
144
146
  export function Collapsible({ lazy, ...props }) {
145
147
  const Comp = lazy ? CollapsibleLazy : CollapsibleBase;
146
- return React.createElement(Comp, { ...props });
148
+ return <Comp {...props}/>;
147
149
  }
150
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Collapsible/index.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EACZ,QAAQ,EACR,SAAS,EACT,MAAM,EACN,WAAW,EACX,eAAe,GAKhB,MAAM,OAAO,CAAC;AACf,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AAEpE,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAE7C;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,YAAY,GAIb;IAKC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,YAAY,IAAI,KAAK,CAAC,CAAC;IAElE,MAAM,eAAe,GAAG,WAAW,CAAC,GAAG,EAAE;QACvC,YAAY,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,SAAS;QACT,YAAY;QACZ,eAAe;KAChB,CAAC;AACJ,CAAC;AAED,MAAM,eAAe,GAAG;IACtB,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,KAAK;CACL,CAAC;AAEX,MAAM,cAAc,GAAG;IACrB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,SAAS;IACnB,MAAM,EAAE,MAAM;CACN,CAAC;AAEX,SAAS,mBAAmB,CAAC,EAAe,EAAE,SAAkB;IAC9D,MAAM,eAAe,GAAG,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,cAAc,CAAC;IACrE,EAAE,CAAC,KAAK,CAAC,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC;IAC3C,EAAE,CAAC,KAAK,CAAC,QAAQ,GAAG,eAAe,CAAC,QAAQ,CA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C,IAAI,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC,EAAG,CACzD,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAYD;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,EAAC,IAAI,EAAE,GAAG,KAAK,EAAmB;IAC5D,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC;IACtD,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AAC7B,CAAC"}
@@ -4,9 +4,14 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { ComponentProps, ReactElement } from 'react';
7
+ import { type ComponentProps, type ReactElement } from 'react';
8
8
  export declare type DetailsProps = {
9
+ /** Summary is provided as props, including the wrapping `<summary>` tag */
9
10
  summary?: ReactElement;
10
11
  } & ComponentProps<'details'>;
11
- declare const Details: ({ summary, children, ...props }: DetailsProps) => JSX.Element;
12
- export default Details;
12
+ /**
13
+ * A mostly un-styled `<details>` element with smooth collapsing. Provides some
14
+ * very lightweight styles, but you should bring your UI.
15
+ */
16
+ export declare function Details({ summary, children, ...props }: DetailsProps): JSX.Element;
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Details/index.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAGZ,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,OAAO,CAAC;AAoBf,oBAAY,YAAY,GAAG;IACzB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;AAE9B;;;GAGG;AACH,wBAAgB,OAAO,CAAC,EACtB,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CA+D5B"}
@@ -4,9 +4,9 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import React, { useRef, useState } from 'react';
8
- import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
7
+ import React, { useRef, useState, } from 'react';
9
8
  import clsx from 'clsx';
9
+ import useIsBrowser from '@docusaurus/useIsBrowser';
10
10
  import { useCollapsible, Collapsible } from '../Collapsible';
11
11
  import styles from './styles.module.css';
12
12
  function isInSummary(node) {
@@ -21,22 +21,28 @@ function hasParent(node, parent) {
21
21
  }
22
22
  return node === parent || hasParent(node.parentElement, parent);
23
23
  }
24
- const Details = ({ summary, children, ...props }) => {
25
- const { isClient } = useDocusaurusContext();
24
+ /**
25
+ * A mostly un-styled `<details>` element with smooth collapsing. Provides some
26
+ * very lightweight styles, but you should bring your UI.
27
+ */
28
+ export function Details({ summary, children, ...props }) {
29
+ const isBrowser = useIsBrowser();
26
30
  const detailsRef = useRef(null);
27
31
  const { collapsed, setCollapsed } = useCollapsible({
28
32
  initialState: !props.open,
29
33
  });
30
- // We use a separate prop because it must be set only after animation completes
31
- // Otherwise close anim won't work
34
+ // Use a separate state for the actual details prop, because it must be set
35
+ // only after animation completes, otherwise close animations won't work
32
36
  const [open, setOpen] = useState(props.open);
33
- return (React.createElement("details", { ...props, ref: detailsRef, open: open, "data-collapsed": collapsed, className: clsx(styles.details, { [styles.isClient]: isClient }, props.className), onMouseDown: (e) => {
37
+ return (
38
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
39
+ <details {...props} ref={detailsRef} open={open} data-collapsed={collapsed} className={clsx(styles.details, isBrowser && styles.isBrowser, props.className)} onMouseDown={(e) => {
34
40
  const target = e.target;
35
41
  // Prevent a double-click to highlight summary text
36
42
  if (isInSummary(target) && e.detail > 1) {
37
43
  e.preventDefault();
38
44
  }
39
- }, onClick: (e) => {
45
+ }} onClick={(e) => {
40
46
  e.stopPropagation(); // For isolation of multiple nested details/summary
41
47
  const target = e.target;
42
48
  const shouldToggle = isInSummary(target) && hasParent(target, detailsRef.current);
@@ -50,15 +56,21 @@ const Details = ({ summary, children, ...props }) => {
50
56
  }
51
57
  else {
52
58
  setCollapsed(true);
53
- // setOpen(false); // Don't do this, it breaks close animation!
59
+ // Don't do this, it breaks close animation!
60
+ // setOpen(false);
54
61
  }
55
- } },
56
- summary,
57
- React.createElement(Collapsible, { lazy: false, collapsed: collapsed, disableSSRStyle // Allows component to work fine even with JS disabled!
58
- : true, onCollapseTransitionEnd: (newCollapsed) => {
59
- setCollapsed(newCollapsed);
60
- setOpen(!newCollapsed);
61
- } },
62
- React.createElement("div", { className: styles.collapsibleContent }, children))));
63
- };
64
- export default Details;
62
+ }}>
63
+ {/* eslint-disable-next-line @docusaurus/no-untranslated-text */}
64
+ {summary ?? <summary>Details</summary>}
65
+
66
+ <Collapsible lazy={false} // Content might matter for SEO in this case
67
+ collapsed={collapsed} disableSSRStyle // Allows component to work fine even with JS disabled!
68
+ onCollapseTransitionEnd={(newCollapsed) => {
69
+ setCollapsed(newCollapsed);
70
+ setOpen(!newCollapsed);
71
+ }}>
72
+ <div className={styles.collapsibleContent}>{children}</div>
73
+ </Collapsible>
74
+ </details>);
75
+ }
76
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Details/index.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EACZ,MAAM,EACN,QAAQ,GAGT,MAAM,OAAO,CAAC;AACf,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,cAAc,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3D,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC,SAAS,WAAW,CAAC,IAAwB;IAC3C,IAAI,CAAC,IAAI,EAAE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  /*
9
- CSS variables, meant to be overriden by final theme
9
+ CSS variables, meant to be overridden by final theme
10
10
  */
11
11
  .details {
12
12
  --docusaurus-details-summary-arrow-size: 0.38rem;
@@ -18,25 +18,24 @@ CSS variables, meant to be overriden by final theme
18
18
  position: relative;
19
19
  cursor: pointer;
20
20
  list-style: none;
21
- margin-left: 1.8rem;
21
+ padding-left: 1rem;
22
22
  }
23
23
 
24
+ /* TODO: deprecation, need to remove this after Safari will support `::marker` */
24
25
  .details > summary::-webkit-details-marker {
25
26
  display: none;
26
27
  }
27
28
 
28
- .details > summary:before {
29
+ .details > summary::before {
29
30
  position: absolute;
30
31
  top: 0.45rem;
31
- left: -1.2rem;
32
+ left: 0;
32
33
 
33
34
  /* CSS-only Arrow */
34
35
  content: '';
35
- width: 0;
36
- height: 0;
37
- border-top: var(--docusaurus-details-summary-arrow-size) solid transparent;
38
- border-bottom: var(--docusaurus-details-summary-arrow-size) solid transparent;
39
- border-left: var(--docusaurus-details-summary-arrow-size) solid
36
+ border-width: var(--docusaurus-details-summary-arrow-size);
37
+ border-style: solid;
38
+ border-color: transparent transparent transparent
40
39
  var(--docusaurus-details-decoration-color);
41
40
 
42
41
  /* Arrow rotation anim */
@@ -46,9 +45,9 @@ CSS variables, meant to be overriden by final theme
46
45
  }
47
46
 
48
47
  /* When JS disabled/failed to load: we use the open property for arrow animation: */
49
- .details[open]:not(.isClient) > summary:before,
48
+ .details[open]:not(.isBrowser) > summary::before,
50
49
  /* When JS works: we use the data-attribute for arrow animation */
51
- .details[data-collapsed='false'].isClient > summary:before {
50
+ .details[data-collapsed='false'].isBrowser > summary::before {
52
51
  transform: rotate(90deg);
53
52
  }
54
53
 
@@ -57,3 +56,7 @@ CSS variables, meant to be overriden by final theme
57
56
  border-top: 1px solid var(--docusaurus-details-decoration-color);
58
57
  padding-top: 1rem;
59
58
  }
59
+
60
+ .collapsibleContent > *:last-child {
61
+ margin-bottom: 0;
62
+ }
@@ -0,0 +1,22 @@
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
+ export declare const AnnouncementBarDismissStorageKey = "docusaurus.announcement.dismiss";
9
+ declare type ContextValue = {
10
+ /** Whether the announcement bar should be displayed. */
11
+ readonly isActive: boolean;
12
+ /**
13
+ * Callback fired when the user closes the announcement. Will be saved.
14
+ */
15
+ readonly close: () => void;
16
+ };
17
+ export declare function AnnouncementBarProvider({ children, }: {
18
+ children: ReactNode;
19
+ }): JSX.Element;
20
+ export declare function useAnnouncementBar(): ContextValue;
21
+ export {};
22
+ //# sourceMappingURL=announcementBar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"announcementBar.d.ts","sourceRoot":"","sources":["../../src/contexts/announcementBar.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAMZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,eAAO,MAAM,gCAAgC,oCACV,CAAC;AAapC,aAAK,YAAY,GAAG;IAClB,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AA8DF,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAGd;AAED,wBAAgB,kBAAkB,IAAI,YAAY,CAMjD"}
@@ -4,26 +4,26 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import React, { useState, useEffect, useCallback, useMemo, useContext, createContext, } from 'react';
8
- import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
9
- import { createStorageSlot } from './storageUtils';
10
- import { useThemeConfig } from './useThemeConfig';
7
+ import React, { useState, useEffect, useCallback, useMemo, useContext, } from 'react';
8
+ import useIsBrowser from '@docusaurus/useIsBrowser';
9
+ import { createStorageSlot } from '../utils/storageUtils';
10
+ import { ReactContextError } from '../utils/reactUtils';
11
+ import { useThemeConfig } from '../utils/useThemeConfig';
11
12
  export const AnnouncementBarDismissStorageKey = 'docusaurus.announcement.dismiss';
12
13
  const AnnouncementBarIdStorageKey = 'docusaurus.announcement.id';
13
14
  const AnnouncementBarDismissStorage = createStorageSlot(AnnouncementBarDismissStorageKey);
14
15
  const IdStorage = createStorageSlot(AnnouncementBarIdStorageKey);
15
16
  const isDismissedInStorage = () => AnnouncementBarDismissStorage.get() === 'true';
16
17
  const setDismissedInStorage = (bool) => AnnouncementBarDismissStorage.set(String(bool));
17
- const useAnnouncementBarContextValue = () => {
18
+ const Context = React.createContext(null);
19
+ function useContextValue() {
18
20
  const { announcementBar } = useThemeConfig();
19
- const { isClient } = useDocusaurusContext();
20
- const [isClosed, setClosed] = useState(() => {
21
- return isClient
22
- ? // On client navigation: init with localstorage value
23
- isDismissedInStorage()
24
- : // On server/hydration: always visible to prevent layout shifts (will be hidden with css if needed)
25
- false;
26
- });
21
+ const isBrowser = useIsBrowser();
22
+ const [isClosed, setClosed] = useState(() => isBrowser
23
+ ? // On client navigation: init with local storage value
24
+ isDismissedInStorage()
25
+ : // On server/hydration: always visible to prevent layout shifts (will be hidden with css if needed)
26
+ false);
27
27
  // Update state after hydration
28
28
  useEffect(() => {
29
29
  setClosed(isDismissedInStorage());
@@ -38,8 +38,9 @@ const useAnnouncementBarContextValue = () => {
38
38
  }
39
39
  const { id } = announcementBar;
40
40
  let viewedId = IdStorage.get();
41
- // retrocompatibility due to spelling mistake of default id
41
+ // Retrocompatibility due to spelling mistake of default id
42
42
  // see https://github.com/facebook/docusaurus/issues/3338
43
+ // cSpell:ignore annoucement
43
44
  if (viewedId === 'annoucement-bar') {
44
45
  viewedId = 'announcement-bar';
45
46
  }
@@ -51,23 +52,21 @@ const useAnnouncementBarContextValue = () => {
51
52
  if (isNewAnnouncement || !isDismissedInStorage()) {
52
53
  setClosed(false);
53
54
  }
54
- }, []);
55
- return useMemo(() => {
56
- return {
57
- isClosed,
58
- close: handleClose,
59
- };
60
- }, [isClosed]);
61
- };
62
- const AnnouncementBarContext = createContext(null);
63
- export const AnnouncementBarProvider = ({ children }) => {
64
- const value = useAnnouncementBarContextValue();
65
- return (React.createElement(AnnouncementBarContext.Provider, { value: value }, children));
66
- };
67
- export const useAnnouncementBar = () => {
68
- const api = useContext(AnnouncementBarContext);
55
+ }, [announcementBar]);
56
+ return useMemo(() => ({
57
+ isActive: !!announcementBar && !isClosed,
58
+ close: handleClose,
59
+ }), [announcementBar, isClosed, handleClose]);
60
+ }
61
+ export function AnnouncementBarProvider({ children, }) {
62
+ const value = useContextValue();
63
+ return <Context.Provider value={value}>{children}</Context.Provider>;
64
+ }
65
+ export function useAnnouncementBar() {
66
+ const api = useContext(Context);
69
67
  if (!api) {
70
- throw new Error('useAnnouncementBar(): AnnouncementBar not found in React context: make sure to use the AnnouncementBarProvider on top of the tree');
68
+ throw new ReactContextError('AnnouncementBarProvider');
71
69
  }
72
70
  return api;
73
- };
71
+ }
72
+ //# sourceMappingURL=announcementBar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"announcementBar.js","sourceRoot":"","sources":["../../src/contexts/announcementBar.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EACZ,QAAQ,EACR,SAAS,EACT,WAAW,EACX,OAAO,EACP,UAAU,GAEX,MAAM,OAAO,CAAC;AACf,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAEvD,MAAM,CAAC,MAAM,gCAAgC,GAC3C,iCAAiC,CAAC;AACpC,MAAM,2BAA2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QAC5B,IAAI,QAAQ,KAAK,iBAAiB,EAAE;YAClC,QAAQ,GAAG,kBAAkB,CAAC;SAC/B;QAED,MAAM,iBAAiB,GAAG,EAAE,KAAK,QAAQ,CAAC;QAE1C,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAElB,IAAI,iBAAiB,EAAE;YACrB,qBAAqB,CAAC,KAAK,CAAC,CAAC;SAC9B;QAED,IAAI,iBAAiB,IAAI,CAAC,oBAAoB,EAAE,EAAE;YAChD,SAAS,CAAC,KAAK,CAAC,CAAC;SAClB;IACH,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IAEtB,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE,CAAC,CAAC,eAAe,IAAI,CAAC,QAAQ;QACxC,KAAK,EAAE,WAAW;KACnB,CAAC,EACF,CAAC,eAAe,EAAE,QAAQ,EAAE,WAAW,CAAC,CACzC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,EACtC,QAAQ,GAGT;IACC,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAChC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAChC,IAAI,CAAC,GAAG,EAAE;QACR,MAAM,IAAI,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;KACxD;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { type ReactNode } from 'react';
8
+ import type { PropBlogPostContent } from '@docusaurus/plugin-content-blog';
9
+ /**
10
+ * The React context value returned by the `useBlogPost()` hook.
11
+ * It contains useful data related to the currently browsed blog post.
12
+ */
13
+ export declare type BlogPostContextValue = Pick<PropBlogPostContent, 'metadata' | 'frontMatter' | 'assets' | 'toc'> & {
14
+ readonly isBlogPostPage: boolean;
15
+ };
16
+ /**
17
+ * This is a very thin layer around the `content` received from the MDX loader.
18
+ * It provides metadata about the blog post to the children tree.
19
+ */
20
+ export declare function BlogPostProvider({ children, content, isBlogPostPage, }: {
21
+ children: ReactNode;
22
+ content: PropBlogPostContent;
23
+ isBlogPostPage?: boolean;
24
+ }): JSX.Element;
25
+ /**
26
+ * Returns the data of the currently browsed blog post. Gives access to
27
+ * front matter, metadata, TOC, etc.
28
+ * When swizzling a low-level component (e.g. the "Edit this page" link)
29
+ * and you need some extra metadata, you don't have to drill the props
30
+ * all the way through the component tree: simply use this hook instead.
31
+ */
32
+ export declare function useBlogPost(): BlogPostContextValue;
33
+ //# sourceMappingURL=blogPost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blogPost.d.ts","sourceRoot":"","sources":["../../src/contexts/blogPost.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAU,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAGjE,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AAEzE;;;GAGG;AACH,oBAAY,oBAAoB,GAAG,IAAI,CACrC,mBAAmB,EACnB,UAAU,GAAG,aAAa,GAAG,QAAQ,GAAG,KAAK,CAC9C,GAAG;IACF,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC,CAAC;AA4BF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,OAAO,EACP,cAAsB,GACvB,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,GAAG,CAAC,OAAO,CAGd;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,IAAI,oBAAoB,CAMlD"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React, { useMemo, useContext } from 'react';
8
+ import { ReactContextError } from '../utils/reactUtils';
9
+ const Context = React.createContext(null);
10
+ /**
11
+ * Note: we don't use `PropBlogPostContent` as context value on purpose. Metadata is
12
+ * currently stored inside the MDX component, but we may want to change that in
13
+ * the future.
14
+ */
15
+ function useContextValue({ content, isBlogPostPage, }) {
16
+ return useMemo(() => ({
17
+ metadata: content.metadata,
18
+ frontMatter: content.frontMatter,
19
+ assets: content.assets,
20
+ toc: content.toc,
21
+ isBlogPostPage,
22
+ }), [content, isBlogPostPage]);
23
+ }
24
+ /**
25
+ * This is a very thin layer around the `content` received from the MDX loader.
26
+ * It provides metadata about the blog post to the children tree.
27
+ */
28
+ export function BlogPostProvider({ children, content, isBlogPostPage = false, }) {
29
+ const contextValue = useContextValue({ content, isBlogPostPage });
30
+ return <Context.Provider value={contextValue}>{children}</Context.Provider>;
31
+ }
32
+ /**
33
+ * Returns the data of the currently browsed blog post. Gives access to
34
+ * front matter, metadata, TOC, etc.
35
+ * When swizzling a low-level component (e.g. the "Edit this page" link)
36
+ * and you need some extra metadata, you don't have to drill the props
37
+ * all the way through the component tree: simply use this hook instead.
38
+ */
39
+ export function useBlogPost() {
40
+ const blogPost = useContext(Context);
41
+ if (blogPost === null) {
42
+ throw new ReactContextError('BlogPostProvider');
43
+ }
44
+ return blogPost;
45
+ }
46
+ //# sourceMappingURL=blogPost.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blogPost.js","sourceRoot":"","sources":["../../src/contexts/blogPost.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAkB,UAAU,EAAC,MAAM,OAAO,CAAC;AACjE,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAetD,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAA8B,IAAI,CAAC,CAAC;AAEvE;;;;GAIG;AACH,SAAS,eAAe,CAAC,EACvB,OAAO,EACP,cAAc,GAIf;IACC,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,cAAc;KACf,CAAC,EACF,CAAC,OAAO,EAAE,cAAc,CAAC,CAC1B,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,QAAQ,EACR,OAAO,EACP,cAAc,GAAG,KAAK,GAKvB;IACC,MAAM,YAAY,GAAG,eAAe,CAAC,EAAC,OAAO,EAAE,cAAc,EAAC,CAAC,CAAC;IAChE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW;IACzB,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACrC,IAAI,QAAQ,KAAK,IAAI,EAAE;QACrB,MAAM,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;KACjD;IACD,OAAO,QAAQ,CAAC;AAClB,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
+ import { type ReactNode } from 'react';
8
+ declare type ContextValue = {
9
+ /** Current color mode. */
10
+ readonly colorMode: ColorMode;
11
+ /** Set new color mode. */
12
+ readonly setColorMode: (colorMode: ColorMode) => void;
13
+ readonly isDarkTheme: boolean;
14
+ readonly setLightTheme: () => void;
15
+ readonly setDarkTheme: () => void;
16
+ };
17
+ declare const ColorModes: {
18
+ readonly light: "light";
19
+ readonly dark: "dark";
20
+ };
21
+ export declare type ColorMode = typeof ColorModes[keyof typeof ColorModes];
22
+ export declare function ColorModeProvider({ children, }: {
23
+ children: ReactNode;
24
+ }): JSX.Element;
25
+ export declare function useColorMode(): ContextValue;
26
+ export {};
27
+ //# sourceMappingURL=colorMode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorMode.d.ts","sourceRoot":"","sources":["../../src/contexts/colorMode.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,aAAK,YAAY,GAAG;IAClB,0BAA0B;IAC1B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,0BAA0B;IAC1B,QAAQ,CAAC,YAAY,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IAGtD,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,IAAI,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,IAAI,CAAC;CACnC,CAAC;AAOF,QAAA,MAAM,UAAU;;;CAGN,CAAC;AAEX,oBAAY,SAAS,GAAG,OAAO,UAAU,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAwInE,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAGd;AAED,wBAAgB,YAAY,IAAI,YAAY,CAS3C"}