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

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 (156) hide show
  1. package/lib/{utils/useCollapsible.d.ts → components/Collapsible/index.d.ts} +10 -3
  2. package/lib/components/Collapsible/index.d.ts.map +1 -0
  3. package/lib/{utils/useCollapsible.js → components/Collapsible/index.js} +37 -14
  4. package/lib/components/Collapsible/index.js.map +1 -0
  5. package/lib/components/Details/index.d.ts +13 -0
  6. package/lib/components/Details/index.d.ts.map +1 -0
  7. package/lib/components/Details/index.js +65 -0
  8. package/lib/components/Details/index.js.map +1 -0
  9. package/lib/components/Details/styles.module.css +58 -0
  10. package/lib/index.d.ts +20 -5
  11. package/lib/index.d.ts.map +1 -0
  12. package/lib/index.js +15 -3
  13. package/lib/index.js.map +1 -0
  14. package/lib/utils/ThemeClassNames.d.ts +38 -12
  15. package/lib/utils/ThemeClassNames.d.ts.map +1 -0
  16. package/lib/utils/ThemeClassNames.js +38 -3
  17. package/lib/utils/ThemeClassNames.js.map +1 -0
  18. package/lib/utils/announcementBarUtils.d.ts +4 -3
  19. package/lib/utils/announcementBarUtils.d.ts.map +1 -0
  20. package/lib/utils/announcementBarUtils.js +15 -18
  21. package/lib/utils/announcementBarUtils.js.map +1 -0
  22. package/lib/utils/codeBlockUtils.d.ts +11 -0
  23. package/lib/utils/codeBlockUtils.d.ts.map +1 -0
  24. package/lib/utils/codeBlockUtils.js +120 -0
  25. package/lib/utils/codeBlockUtils.js.map +1 -0
  26. package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.d.ts +3 -2
  27. package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.d.ts.map +1 -0
  28. package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.js +3 -2
  29. package/lib/utils/docsPreferredVersion/DocsPreferredVersionProvider.js.map +1 -0
  30. package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.d.ts +1 -0
  31. package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.d.ts.map +1 -0
  32. package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.js +2 -3
  33. package/lib/utils/docsPreferredVersion/DocsPreferredVersionStorage.js.map +1 -0
  34. package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.d.ts +12 -3
  35. package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.d.ts.map +1 -0
  36. package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.js +2 -2
  37. package/lib/utils/docsPreferredVersion/useDocsPreferredVersion.js.map +1 -0
  38. package/lib/utils/docsUtils.d.ts +21 -0
  39. package/lib/utils/docsUtils.d.ts.map +1 -0
  40. package/lib/utils/docsUtils.js +107 -0
  41. package/lib/utils/docsUtils.js.map +1 -0
  42. package/lib/utils/generalUtils.d.ts +7 -0
  43. package/lib/utils/generalUtils.d.ts.map +1 -0
  44. package/lib/utils/generalUtils.js +3 -2
  45. package/lib/utils/generalUtils.js.map +1 -0
  46. package/lib/utils/historyUtils.d.ts +12 -0
  47. package/lib/utils/historyUtils.d.ts.map +1 -0
  48. package/lib/utils/historyUtils.js +40 -0
  49. package/lib/utils/historyUtils.js.map +1 -0
  50. package/lib/utils/jsUtils.d.ts +20 -0
  51. package/lib/utils/jsUtils.d.ts.map +1 -0
  52. package/lib/utils/jsUtils.js +26 -0
  53. package/lib/utils/jsUtils.js.map +1 -0
  54. package/lib/utils/mobileSecondaryMenu.d.ts +3 -2
  55. package/lib/utils/mobileSecondaryMenu.d.ts.map +1 -0
  56. package/lib/utils/mobileSecondaryMenu.js +4 -4
  57. package/lib/utils/mobileSecondaryMenu.js.map +1 -0
  58. package/lib/utils/pathUtils.d.ts +1 -0
  59. package/lib/utils/pathUtils.d.ts.map +1 -0
  60. package/lib/utils/pathUtils.js +2 -3
  61. package/lib/utils/pathUtils.js.map +1 -0
  62. package/lib/utils/reactUtils.d.ts +10 -0
  63. package/lib/utils/reactUtils.d.ts.map +1 -0
  64. package/lib/utils/reactUtils.js +27 -0
  65. package/lib/utils/reactUtils.js.map +1 -0
  66. package/lib/utils/regexpUtils.d.ts +11 -0
  67. package/lib/utils/regexpUtils.d.ts.map +1 -0
  68. package/lib/utils/regexpUtils.js +17 -0
  69. package/lib/utils/regexpUtils.js.map +1 -0
  70. package/lib/utils/scrollUtils.d.ts +53 -0
  71. package/lib/utils/scrollUtils.d.ts.map +1 -0
  72. package/lib/utils/scrollUtils.js +136 -0
  73. package/lib/utils/scrollUtils.js.map +1 -0
  74. package/lib/utils/searchUtils.d.ts +1 -0
  75. package/lib/utils/searchUtils.d.ts.map +1 -0
  76. package/lib/utils/searchUtils.js +1 -0
  77. package/lib/utils/searchUtils.js.map +1 -0
  78. package/lib/utils/storageUtils.d.ts +5 -0
  79. package/lib/utils/storageUtils.d.ts.map +1 -0
  80. package/lib/utils/storageUtils.js +30 -3
  81. package/lib/utils/storageUtils.js.map +1 -0
  82. package/lib/utils/tagsUtils.d.ts +19 -0
  83. package/lib/utils/tagsUtils.d.ts.map +1 -0
  84. package/lib/utils/tagsUtils.js +34 -0
  85. package/lib/utils/tagsUtils.js.map +1 -0
  86. package/lib/utils/tocUtils.d.ts +16 -0
  87. package/lib/utils/tocUtils.d.ts.map +1 -0
  88. package/lib/utils/tocUtils.js +35 -0
  89. package/lib/utils/tocUtils.js.map +1 -0
  90. package/lib/utils/useAlternatePageUtils.d.ts +1 -0
  91. package/lib/utils/useAlternatePageUtils.d.ts.map +1 -0
  92. package/lib/utils/useAlternatePageUtils.js +1 -0
  93. package/lib/utils/useAlternatePageUtils.js.map +1 -0
  94. package/lib/utils/useContextualSearchFilters.d.ts +12 -0
  95. package/lib/utils/useContextualSearchFilters.d.ts.map +1 -0
  96. package/lib/utils/useContextualSearchFilters.js +37 -0
  97. package/lib/utils/useContextualSearchFilters.js.map +1 -0
  98. package/{src/utils/docsUtils.ts → lib/utils/useLocalPathname.d.ts} +2 -5
  99. package/lib/utils/useLocalPathname.d.ts.map +1 -0
  100. package/lib/utils/useLocalPathname.js +17 -0
  101. package/lib/utils/useLocalPathname.js.map +1 -0
  102. package/lib/utils/useLocationChange.d.ts +1 -0
  103. package/lib/utils/useLocationChange.d.ts.map +1 -0
  104. package/lib/utils/useLocationChange.js +10 -11
  105. package/lib/utils/useLocationChange.js.map +1 -0
  106. package/lib/utils/usePluralForm.d.ts +1 -0
  107. package/lib/utils/usePluralForm.d.ts.map +1 -0
  108. package/lib/utils/usePluralForm.js +2 -3
  109. package/lib/utils/usePluralForm.js.map +1 -0
  110. package/lib/utils/usePrevious.d.ts +1 -0
  111. package/lib/utils/usePrevious.d.ts.map +1 -0
  112. package/lib/utils/usePrevious.js +4 -2
  113. package/lib/utils/usePrevious.js.map +1 -0
  114. package/lib/utils/useTOCHighlight.d.ts +15 -0
  115. package/lib/utils/useTOCHighlight.d.ts.map +1 -0
  116. package/lib/utils/useTOCHighlight.js +125 -0
  117. package/lib/utils/useTOCHighlight.js.map +1 -0
  118. package/lib/utils/useThemeConfig.d.ts +32 -9
  119. package/lib/utils/useThemeConfig.d.ts.map +1 -0
  120. package/lib/utils/useThemeConfig.js +1 -0
  121. package/lib/utils/useThemeConfig.js.map +1 -0
  122. package/package.json +18 -12
  123. package/src/{utils/useCollapsible.tsx → components/Collapsible/index.tsx} +70 -25
  124. package/src/components/Details/index.tsx +94 -0
  125. package/src/components/Details/styles.module.css +58 -0
  126. package/src/index.ts +56 -5
  127. package/src/types.d.ts +0 -2
  128. package/src/utils/ThemeClassNames.ts +43 -4
  129. package/src/utils/announcementBarUtils.tsx +20 -15
  130. package/src/utils/codeBlockUtils.ts +151 -0
  131. package/src/utils/docsPreferredVersion/DocsPreferredVersionProvider.tsx +7 -6
  132. package/src/utils/docsPreferredVersion/DocsPreferredVersionStorage.ts +2 -3
  133. package/src/utils/docsPreferredVersion/useDocsPreferredVersion.ts +14 -14
  134. package/src/utils/docsUtils.tsx +185 -0
  135. package/src/utils/generalUtils.ts +3 -2
  136. package/src/utils/historyUtils.ts +50 -0
  137. package/src/utils/jsUtils.ts +33 -0
  138. package/src/utils/mobileSecondaryMenu.tsx +9 -6
  139. package/src/utils/pathUtils.ts +2 -3
  140. package/src/utils/reactUtils.tsx +34 -0
  141. package/src/utils/regexpUtils.ts +23 -0
  142. package/src/utils/scrollUtils.tsx +237 -0
  143. package/src/utils/storageUtils.ts +27 -4
  144. package/src/utils/tagsUtils.ts +48 -0
  145. package/src/utils/tocUtils.ts +55 -0
  146. package/src/utils/useContextualSearchFilters.ts +50 -0
  147. package/src/utils/useLocalPathname.ts +20 -0
  148. package/src/utils/useLocationChange.ts +10 -12
  149. package/src/utils/usePluralForm.ts +2 -3
  150. package/src/utils/usePrevious.ts +3 -2
  151. package/src/utils/useTOCHighlight.ts +179 -0
  152. package/src/utils/useThemeConfig.ts +34 -9
  153. package/lib/.tsbuildinfo +0 -1
  154. package/src/utils/__tests__/codeBlockUtils.test.ts +0 -54
  155. package/src/utils/__tests__/pathUtils.test.ts +0 -32
  156. package/tsconfig.json +0 -10
@@ -18,12 +18,19 @@ declare type CollapsibleAnimationConfig = {
18
18
  duration?: number;
19
19
  easing?: string;
20
20
  };
21
- declare type CollapsibleElementType = React.ElementType<Pick<React.HTMLAttributes<unknown>, 'className' | 'onTransitionEnd'>>;
22
- export declare function Collapsible({ as: As, collapsed, children, animation, className, }: {
21
+ declare type CollapsibleElementType = React.ElementType<Pick<React.HTMLAttributes<unknown>, 'className' | 'onTransitionEnd' | 'style'>>;
22
+ declare type CollapsibleBaseProps = {
23
23
  as?: CollapsibleElementType;
24
24
  collapsed: boolean;
25
25
  children: ReactNode;
26
26
  animation?: CollapsibleAnimationConfig;
27
+ onCollapseTransitionEnd?: (collapsed: boolean) => void;
27
28
  className?: string;
28
- }): JSX.Element;
29
+ disableSSRStyle?: boolean;
30
+ };
31
+ declare type CollapsibleProps = CollapsibleBaseProps & {
32
+ lazy: boolean;
33
+ };
34
+ export declare function Collapsible({ lazy, ...props }: CollapsibleProps): JSX.Element;
29
35
  export {};
36
+ //# 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;AAGH,OAAO,KAAK,EAAE,EAMZ,QAAQ,EACR,cAAc,EACd,SAAS,EAEV,MAAM,OAAO,CAAC;AAIf,oBAAY,oBAAoB,GAAG;IACjC,YAAY,EAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC;CACzC,CAAC;AAEF,oBAAY,qBAAqB,GAAG;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAChD,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAC;AAGF,wBAAgB,cAAc,CAAC,EAC7B,YAAY,GACb,EAAE,oBAAoB,GAAG,qBAAqB,CAY9C;AA+BD,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;AAUF,aAAK,oBAAoB,GAAG;IAC1B,EAAE,CAAC,EAAE,sBAAsB,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,0BAA0B,CAAC;IACvC,uBAAuB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IAInB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AA0DF,aAAK,gBAAgB,GAAG,oBAAoB,GAAG;IAK7C,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAC,IAAI,EAAE,GAAG,KAAK,EAAC,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAG3E"}
@@ -4,7 +4,8 @@
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, useRef, useCallback, } from 'react';
7
+ import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
8
+ import React, { useState, useEffect, useRef, useCallback, useLayoutEffect, } from 'react';
8
9
  const DefaultAnimationEasing = 'ease-in-out';
9
10
  // This hook just define the state
10
11
  export function useCollapsible({ initialState, }) {
@@ -92,26 +93,48 @@ function useCollapseAnimation({ collapsibleRef, collapsed, animation, }) {
92
93
  return startAnimation();
93
94
  }, [collapsibleRef, collapsed, animation]);
94
95
  }
95
- export function Collapsible({ as: As = 'div', collapsed, children, animation, className, }) {
96
+ // Prevent hydration layout shift before anims are handled imperatively with JS
97
+ function getSSRStyle(collapsed) {
98
+ if (ExecutionEnvironment.canUseDOM) {
99
+ return undefined;
100
+ }
101
+ return collapsed ? CollapsedStyles : ExpandedStyles;
102
+ }
103
+ function CollapsibleBase({ as: As = 'div', collapsed, children, animation, onCollapseTransitionEnd, className, disableSSRStyle, }) {
96
104
  // any because TS is a pain for HTML element refs, see https://twitter.com/sebastienlorber/status/1412784677795110914
105
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
97
106
  const collapsibleRef = useRef(null);
98
107
  useCollapseAnimation({ collapsibleRef, collapsed, animation });
99
108
  return (React.createElement(As
100
- // @ts-expect-error: see https://twitter.com/sebastienlorber/status/1412784677795110914
109
+ // @ts-expect-error: the "too complicated type" is produced from "CollapsibleElementType" being a huge union
101
110
  , {
102
- // @ts-expect-error: see https://twitter.com/sebastienlorber/status/1412784677795110914
103
- ref: collapsibleRef, onTransitionEnd: (e) => {
111
+ // @ts-expect-error: the "too complicated type" is produced from "CollapsibleElementType" being a huge union
112
+ ref: collapsibleRef, style: disableSSRStyle ? undefined : getSSRStyle(collapsed), onTransitionEnd: (e) => {
104
113
  if (e.propertyName !== 'height') {
105
114
  return;
106
115
  }
107
- const el = collapsibleRef.current;
108
- const currentCollapsibleElementHeight = el.style.height;
109
- if (!collapsed &&
110
- parseInt(currentCollapsibleElementHeight, 10) === el.scrollHeight) {
111
- applyCollapsedStyle(el, false);
112
- }
113
- if (currentCollapsibleElementHeight === CollapsedStyles.height) {
114
- applyCollapsedStyle(el, true);
115
- }
116
+ applyCollapsedStyle(collapsibleRef.current, collapsed);
117
+ onCollapseTransitionEnd === null || onCollapseTransitionEnd === void 0 ? void 0 : onCollapseTransitionEnd(collapsed);
116
118
  }, className: className }, children));
117
119
  }
120
+ function CollapsibleLazy({ collapsed, ...props }) {
121
+ const [mounted, setMounted] = useState(!collapsed);
122
+ useLayoutEffect(() => {
123
+ if (!collapsed) {
124
+ setMounted(true);
125
+ }
126
+ }, [collapsed]);
127
+ // lazyCollapsed updated in effect so that the first expansion transition can work
128
+ const [lazyCollapsed, setLazyCollapsed] = useState(collapsed);
129
+ useLayoutEffect(() => {
130
+ if (mounted) {
131
+ setLazyCollapsed(collapsed);
132
+ }
133
+ }, [mounted, collapsed]);
134
+ return mounted ? (React.createElement(CollapsibleBase, { ...props, collapsed: lazyCollapsed })) : null;
135
+ }
136
+ export function Collapsible({ lazy, ...props }) {
137
+ const Comp = lazy ? CollapsibleLazy : CollapsibleBase;
138
+ return React.createElement(Comp, { ...props });
139
+ }
140
+ //# 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,oBAAoB,MAAM,kCAAkC,CAAC;AACpE,OAAO,KAAK,EAAE,EACZ,QAAQ,EACR,SAAS,EACT,MAAM,EACN,WAAW,EAKX,eAAe,GAChB,MAAM,OAAO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,KAAK,GAAI,CAAC;AAC7B,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 { ComponentProps, ReactElement } from 'react';
8
+ export declare type DetailsProps = {
9
+ summary?: ReactElement;
10
+ } & ComponentProps<'details'>;
11
+ declare function Details({ summary, children, ...props }: DetailsProps): JSX.Element;
12
+ export default Details;
13
+ //# 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,EAAC,cAAc,EAAE,YAAY,EAAmB,MAAM,OAAO,CAAC;AAoB5E,oBAAY,YAAY,GAAG;IACzB,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;AAE9B,iBAAS,OAAO,CAAC,EAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAC,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CA4DzE;AAED,eAAe,OAAO,CAAC"}
@@ -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 React, { useRef, useState } from 'react';
8
+ import useIsBrowser from '@docusaurus/useIsBrowser';
9
+ import clsx from 'clsx';
10
+ import { useCollapsible, Collapsible } from '../Collapsible';
11
+ import styles from './styles.module.css';
12
+ function isInSummary(node) {
13
+ if (!node) {
14
+ return false;
15
+ }
16
+ return node.tagName === 'SUMMARY' || isInSummary(node.parentElement);
17
+ }
18
+ function hasParent(node, parent) {
19
+ if (!node) {
20
+ return false;
21
+ }
22
+ return node === parent || hasParent(node.parentElement, parent);
23
+ }
24
+ function Details({ summary, children, ...props }) {
25
+ const isBrowser = useIsBrowser();
26
+ const detailsRef = useRef(null);
27
+ const { collapsed, setCollapsed } = useCollapsible({
28
+ initialState: !props.open,
29
+ });
30
+ // We use a separate prop because it must be set only after animation completes
31
+ // Otherwise close anim won't work
32
+ const [open, setOpen] = useState(props.open);
33
+ return (React.createElement("details", { ...props, ref: detailsRef, open: open, "data-collapsed": collapsed, className: clsx(styles.details, { [styles.isBrowser]: isBrowser }, props.className), onMouseDown: (e) => {
34
+ const target = e.target;
35
+ // Prevent a double-click to highlight summary text
36
+ if (isInSummary(target) && e.detail > 1) {
37
+ e.preventDefault();
38
+ }
39
+ }, onClick: (e) => {
40
+ e.stopPropagation(); // For isolation of multiple nested details/summary
41
+ const target = e.target;
42
+ const shouldToggle = isInSummary(target) && hasParent(target, detailsRef.current);
43
+ if (!shouldToggle) {
44
+ return;
45
+ }
46
+ e.preventDefault();
47
+ if (collapsed) {
48
+ setCollapsed(false);
49
+ setOpen(true);
50
+ }
51
+ else {
52
+ setCollapsed(true);
53
+ // setOpen(false); // Don't do this, it breaks close animation!
54
+ }
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;
65
+ //# 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,EAA+B,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC5E,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,cAAc,EAAE,WAAW,EAA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M,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;gBACvC,CAAC,CAAC,cAAc,EAAE,CAAC;aACpB;QACH,CAAC,EACD,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,mDAAmD;YACxE,MAAM,MAAM,GAAG,CAAC,CAAC,MAAqB,CAAC;YACvC,MAAM,YAAY,GAChB,WAAW,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,OAAQ,CAAC,CAAC;YAChE,IAAI,CAAC,YAAY,EAAE;gBACjB,OAAO;aACR;YACD,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,IAAI,SAAS,EAAE;gBACb,YAAY,CAAC,KAAK,CAAC,CAAC;gBACpB,OAAO,CAAC,IAAI,CAAC,CAAC;aACf;iBAAM;gBACL,YAAY,CAAC,IAAI,CAAC,CAAC;gBACnB,+DAA+D;aAChE;QACH,CAAC;QACA,OAAO;QAER,oBAAC,WAAW,IACV,IAAI,EAAE,KAAK,EACX,SAAS,EAAE,SAAS,EACpB,eAAe,CAAC,uDAAuD;oBACvE,uBAAuB,EAAE,CAAC,YAAY,EAAE,EAAE;gBACxC,YAAY,CAAC,YAAY,CAAC,CAAC;gBAC3B,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC;YACzB,CAAC;YACD,6BAAK,SAAS,EAAE,MAAM,CAAC,kBAAkB,IAAG,QAAQ,CAAO,CAC/C,CACN,CACX,CAAC;AACJ,CAAC;AAED,eAAe,OAAO,CAAC"}
@@ -0,0 +1,58 @@
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
+ /*
9
+ CSS variables, meant to be overriden by final theme
10
+ */
11
+ .details {
12
+ --docusaurus-details-summary-arrow-size: 0.38rem;
13
+ --docusaurus-details-transition: transform 200ms ease;
14
+ --docusaurus-details-decoration-color: grey;
15
+ }
16
+
17
+ .details > summary {
18
+ position: relative;
19
+ cursor: pointer;
20
+ list-style: none;
21
+ padding-left: 1rem;
22
+ }
23
+
24
+ /* TODO: deprecation, need to remove this after Safari will support `::marker` */
25
+ .details > summary::-webkit-details-marker {
26
+ display: none;
27
+ }
28
+
29
+ .details > summary:before {
30
+ position: absolute;
31
+ top: 0.45rem;
32
+ left: 0;
33
+
34
+ /* CSS-only Arrow */
35
+ content: '';
36
+ border-width: var(--docusaurus-details-summary-arrow-size);
37
+ border-style: solid;
38
+ border-color: transparent transparent transparent
39
+ var(--docusaurus-details-decoration-color);
40
+
41
+ /* Arrow rotation anim */
42
+ transform: rotate(0deg);
43
+ transition: var(--docusaurus-details-transition);
44
+ transform-origin: calc(var(--docusaurus-details-summary-arrow-size) / 2) 50%;
45
+ }
46
+
47
+ /* When JS disabled/failed to load: we use the open property for arrow animation: */
48
+ .details[open]:not(.isBrowser) > summary:before,
49
+ /* When JS works: we use the data-attribute for arrow animation */
50
+ .details[data-collapsed='false'].isBrowser > summary:before {
51
+ transform: rotate(90deg);
52
+ }
53
+
54
+ .collapsibleContent {
55
+ margin-top: 1rem;
56
+ border-top: 1px solid var(--docusaurus-details-decoration-color);
57
+ padding-top: 1rem;
58
+ }
package/lib/index.d.ts CHANGED
@@ -5,22 +5,37 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  export { useThemeConfig } from './utils/useThemeConfig';
8
- export type { ThemeConfig, Navbar, NavbarItem, NavbarLogo, Footer, FooterLinks, FooterLinkItem, } from './utils/useThemeConfig';
8
+ export type { ThemeConfig, UserThemeConfig, Navbar, NavbarItem, NavbarLogo, MultiColumnFooter, SimpleFooter, Footer, FooterLinkItem, ColorModeConfig, } from './utils/useThemeConfig';
9
9
  export { createStorageSlot, listStorageKeys } from './utils/storageUtils';
10
10
  export { useAlternatePageUtils } from './utils/useAlternatePageUtils';
11
- export { parseCodeBlockTitle } from './utils/codeBlockUtils';
11
+ export { useContextualSearchFilters } from './utils/useContextualSearchFilters';
12
+ export { parseCodeBlockTitle, parseLanguage, parseLines, } from './utils/codeBlockUtils';
12
13
  export { docVersionSearchTag, DEFAULT_SEARCH_TAG } from './utils/searchUtils';
13
- export { isDocsPluginEnabled } from './utils/docsUtils';
14
+ export { isDocsPluginEnabled, DocsVersionProvider, useDocsVersion, useDocById, DocsSidebarProvider, useDocsSidebar, findSidebarCategory, findFirstCategoryLink, useCurrentSidebarCategory, isActiveSidebarItem, } from './utils/docsUtils';
14
15
  export { isSamePath } from './utils/pathUtils';
15
16
  export { useTitleFormatter } from './utils/generalUtils';
16
17
  export { usePluralForm } from './utils/usePluralForm';
17
18
  export { useLocationChange } from './utils/useLocationChange';
18
19
  export { usePrevious } from './utils/usePrevious';
19
- export { useCollapsible, Collapsible } from './utils/useCollapsible';
20
- export type { UseCollapsibleConfig, UseCollapsibleReturns, } from './utils/useCollapsible';
20
+ export { useCollapsible, Collapsible } from './components/Collapsible';
21
+ export type { UseCollapsibleConfig, UseCollapsibleReturns, } from './components/Collapsible';
22
+ export { default as Details } from './components/Details';
23
+ export type { DetailsProps } from './components/Details';
21
24
  export { MobileSecondaryMenuProvider, MobileSecondaryMenuFiller, useMobileSecondaryMenuRenderer, } from './utils/mobileSecondaryMenu';
22
25
  export type { MobileSecondaryMenuComponent } from './utils/mobileSecondaryMenu';
23
26
  export { useDocsPreferredVersion, useDocsPreferredVersionByPluginId, } from './utils/docsPreferredVersion/useDocsPreferredVersion';
27
+ export { duplicates, uniq } from './utils/jsUtils';
24
28
  export { DocsPreferredVersionContextProvider } from './utils/docsPreferredVersion/DocsPreferredVersionProvider';
25
29
  export { ThemeClassNames } from './utils/ThemeClassNames';
26
30
  export { AnnouncementBarProvider, useAnnouncementBar, } from './utils/announcementBarUtils';
31
+ export { useLocalPathname } from './utils/useLocalPathname';
32
+ export { translateTagsPageTitle, listTagsByLetters } from './utils/tagsUtils';
33
+ export type { TagLetterEntry } from './utils/tagsUtils';
34
+ export { useHistoryPopHandler } from './utils/historyUtils';
35
+ export { default as useTOCHighlight } from './utils/useTOCHighlight';
36
+ export type { TOCHighlightConfig } from './utils/useTOCHighlight';
37
+ export { useTOCFilter } from './utils/tocUtils';
38
+ export { ScrollControllerProvider, useScrollController, useScrollPosition, useScrollPositionBlocker, } from './utils/scrollUtils';
39
+ export { useIsomorphicLayoutEffect, useDynamicCallback, } from './utils/reactUtils';
40
+ export { isRegexpStringMatch } from './utils/regexpUtils';
41
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAEtD,YAAY,EACV,WAAW,EACX,eAAe,EACf,MAAM,EACN,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,MAAM,EACN,cAAc,EACd,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAC,iBAAiB,EAAE,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAExE,OAAO,EAAC,qBAAqB,EAAC,MAAM,+BAA+B,CAAC;AAEpE,OAAO,EAAC,0BAA0B,EAAC,MAAM,oCAAoC,CAAC;AAE9E,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,UAAU,GACX,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAC,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,C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AkB,CAAC;AAE9C,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC"}
package/lib/index.js CHANGED
@@ -7,17 +7,29 @@
7
7
  export { useThemeConfig } from './utils/useThemeConfig';
8
8
  export { createStorageSlot, listStorageKeys } from './utils/storageUtils';
9
9
  export { useAlternatePageUtils } from './utils/useAlternatePageUtils';
10
- export { parseCodeBlockTitle } from './utils/codeBlockUtils';
10
+ export { useContextualSearchFilters } from './utils/useContextualSearchFilters';
11
+ export { parseCodeBlockTitle, parseLanguage, parseLines, } from './utils/codeBlockUtils';
11
12
  export { docVersionSearchTag, DEFAULT_SEARCH_TAG } from './utils/searchUtils';
12
- export { isDocsPluginEnabled } from './utils/docsUtils';
13
+ export { isDocsPluginEnabled, DocsVersionProvider, useDocsVersion, useDocById, DocsSidebarProvider, useDocsSidebar, findSidebarCategory, findFirstCategoryLink, useCurrentSidebarCategory, isActiveSidebarItem, } from './utils/docsUtils';
13
14
  export { isSamePath } from './utils/pathUtils';
14
15
  export { useTitleFormatter } from './utils/generalUtils';
15
16
  export { usePluralForm } from './utils/usePluralForm';
16
17
  export { useLocationChange } from './utils/useLocationChange';
17
18
  export { usePrevious } from './utils/usePrevious';
18
- export { useCollapsible, Collapsible } from './utils/useCollapsible';
19
+ export { useCollapsible, Collapsible } from './components/Collapsible';
20
+ export { default as Details } from './components/Details';
19
21
  export { MobileSecondaryMenuProvider, MobileSecondaryMenuFiller, useMobileSecondaryMenuRenderer, } from './utils/mobileSecondaryMenu';
20
22
  export { useDocsPreferredVersion, useDocsPreferredVersionByPluginId, } from './utils/docsPreferredVersion/useDocsPreferredVersion';
23
+ export { duplicates, uniq } from './utils/jsUtils';
21
24
  export { DocsPreferredVersionContextProvider } from './utils/docsPreferredVersion/DocsPreferredVersionProvider';
22
25
  export { ThemeClassNames } from './utils/ThemeClassNames';
23
26
  export { AnnouncementBarProvider, useAnnouncementBar, } from './utils/announcementBarUtils';
27
+ export { useLocalPathname } from './utils/useLocalPathname';
28
+ export { translateTagsPageTitle, listTagsByLetters } from './utils/tagsUtils';
29
+ export { useHistoryPopHandler } from './utils/historyUtils';
30
+ export { default as useTOCHighlight } from './utils/useTOCHighlight';
31
+ export { useTOCFilter } from './utils/tocUtils';
32
+ export { ScrollControllerProvider, useScrollController, useScrollPosition, useScrollPositionBlocker, } from './utils/scrollUtils';
33
+ export { useIsomorphicLayoutEffect, useDynamicCallback, } from './utils/reactUtils';
34
+ export { isRegexpStringMatch } from './utils/regexpUtils';
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAetD,OAAO,EAAC,iBAAiB,EAAE,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAExE,OAAO,EAAC,qBAAqB,EAAC,MAAM,+BAA+B,CAAC;AAEpE,OAAO,EAAC,0BAA0B,EAAC,MAAM,oCAAoC,CAAC;AAE9E,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,UAAU,GACX,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAC,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CA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tree.
6
6
  */
7
7
  export declare const ThemeClassNames: {
8
- page: {
9
- blogListPage: string;
10
- blogPostPage: string;
11
- blogTagsListPage: string;
12
- blogTagsPostPage: string;
13
- docPage: string;
14
- mdxPage: string;
8
+ readonly page: {
9
+ readonly blogListPage: "blog-list-page";
10
+ readonly blogPostPage: "blog-post-page";
11
+ readonly blogTagsListPage: "blog-tags-list-page";
12
+ readonly blogTagPostListPage: "blog-tags-post-list-page";
13
+ readonly docsDocPage: "docs-doc-page";
14
+ readonly docsTagsListPage: "docs-tags-list-page";
15
+ readonly docsTagDocListPage: "docs-tags-doc-list-page";
16
+ readonly mdxPage: "mdx-page";
15
17
  };
16
- wrapper: {
17
- main: string;
18
- blogPages: string;
19
- docPages: string;
20
- mdxPages: string;
18
+ readonly wrapper: {
19
+ readonly main: "main-wrapper";
20
+ readonly blogPages: "blog-wrapper";
21
+ readonly docsPages: "docs-wrapper";
22
+ readonly mdxPages: "mdx-wrapper";
21
23
  };
24
+ readonly common: {
25
+ readonly editThisPage: "theme-edit-this-page";
26
+ readonly lastUpdated: "theme-last-updated";
27
+ readonly backToTopButton: "theme-back-to-top-button";
28
+ readonly codeBlock: "theme-code-block";
29
+ };
30
+ readonly layout: {};
31
+ readonly docs: {
32
+ readonly docVersionBanner: "theme-doc-version-banner";
33
+ readonly docVersionBadge: "theme-doc-version-badge";
34
+ readonly docMarkdown: "theme-doc-markdown";
35
+ readonly docTocMobile: "theme-doc-toc-mobile";
36
+ readonly docTocDesktop: "theme-doc-toc-desktop";
37
+ readonly docFooter: "theme-doc-footer";
38
+ readonly docFooterTagsRow: "theme-doc-footer-tags-row";
39
+ readonly docFooterEditMetaRow: "theme-doc-footer-edit-meta-row";
40
+ readonly docSidebarMenu: "theme-doc-sidebar-menu";
41
+ readonly docSidebarItemCategory: "theme-doc-sidebar-item-category";
42
+ readonly docSidebarItemLink: "theme-doc-sidebar-item-link";
43
+ readonly docSidebarItemCategoryLevel: (level: number) => `theme-doc-sidebar-item-category-level-${number}`;
44
+ readonly docSidebarItemLinkLevel: (level: number) => `theme-doc-sidebar-item-link-level-${number}`;
45
+ };
46
+ readonly blog: {};
22
47
  };
48
+ //# sourceMappingURL=ThemeClassNames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeClassNames.d.ts","sourceRoot":"","sources":["../../src/utils/ThemeClassNames.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sDA2Ca,MAAM;kDAEV,MAAM;;;CAOjC,CAAC"}
@@ -5,19 +5,54 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  // These class names are used to style page layouts in Docusaurus
8
+ // Those are meant to be targeted by user-provided custom CSS selectors
9
+ // /!\ Please do not modify the classnames! This is a breaking change, and annoying for users!
8
10
  export const ThemeClassNames = {
9
11
  page: {
10
12
  blogListPage: 'blog-list-page',
11
13
  blogPostPage: 'blog-post-page',
12
14
  blogTagsListPage: 'blog-tags-list-page',
13
- blogTagsPostPage: 'blog-tags-post-page',
14
- docPage: 'doc-page',
15
+ blogTagPostListPage: 'blog-tags-post-list-page',
16
+ docsDocPage: 'docs-doc-page',
17
+ docsTagsListPage: 'docs-tags-list-page',
18
+ docsTagDocListPage: 'docs-tags-doc-list-page',
15
19
  mdxPage: 'mdx-page',
16
20
  },
17
21
  wrapper: {
18
22
  main: 'main-wrapper',
19
23
  blogPages: 'blog-wrapper',
20
- docPages: 'docs-wrapper',
24
+ docsPages: 'docs-wrapper',
21
25
  mdxPages: 'mdx-wrapper',
22
26
  },
27
+ // /!\ Please keep the naming convention consistent!
28
+ // Something like: "theme-{blog,doc,version,page}?-<suffix>"
29
+ common: {
30
+ editThisPage: 'theme-edit-this-page',
31
+ lastUpdated: 'theme-last-updated',
32
+ backToTopButton: 'theme-back-to-top-button',
33
+ codeBlock: 'theme-code-block',
34
+ },
35
+ layout: {
36
+ // TODO add other stable classNames here
37
+ },
38
+ docs: {
39
+ docVersionBanner: 'theme-doc-version-banner',
40
+ docVersionBadge: 'theme-doc-version-badge',
41
+ docMarkdown: 'theme-doc-markdown',
42
+ docTocMobile: 'theme-doc-toc-mobile',
43
+ docTocDesktop: 'theme-doc-toc-desktop',
44
+ docFooter: 'theme-doc-footer',
45
+ docFooterTagsRow: 'theme-doc-footer-tags-row',
46
+ docFooterEditMetaRow: 'theme-doc-footer-edit-meta-row',
47
+ docSidebarMenu: 'theme-doc-sidebar-menu',
48
+ docSidebarItemCategory: 'theme-doc-sidebar-item-category',
49
+ docSidebarItemLink: 'theme-doc-sidebar-item-link',
50
+ docSidebarItemCategoryLevel: (level) => `theme-doc-sidebar-item-category-level-${level}`,
51
+ docSidebarItemLinkLevel: (level) => `theme-doc-sidebar-item-link-level-${level}`,
52
+ // TODO add other stable classNames here
53
+ },
54
+ blog: {
55
+ // TODO add other stable classNames here
56
+ },
23
57
  };
58
+ //# sourceMappingURL=ThemeClassNames.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeClassNames.js","sourceRoot":"","sources":["../../src/utils/ThemeClassNames.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,iEAAiE;AACjE,uEAAuE;AACvE,8FAA8F;AAC9F,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE;QACJ,YAAY,EAAE,gBAAgB;QAC9B,YAAY,EAAE,gBAAgB;QAC9B,gBAAgB,EAAE,qBAAqB;QACvC,mBAAmB,EAAE,0BAA0B;QAE/C,WAAW,EAAE,eAAe;QAC5B,gBAAgB,EAAE,qBAAqB;QACvC,kBAAkB,EAAE,yBAAyB;QAE7C,OAAO,EAAE,UAAU;KACpB;IACD,OAAO,EAAE;QACP,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,cAAc;QACzB,SAAS,EAAE,cAAc;QACzB,QAAQ,EAAE,aAAa;KACxB;IAED,oDAAoD;IACpD,4DAA4D;IAC5D,MAAM,EAAE;QACN,YAAY,EAAE,sBAAsB;QACpC,WAAW,EAAE,oBAAoB;QACjC,eAAe,EAAE,0BAA0B;QAC3C,SAAS,EAAE,kBAAkB;KAC9B;IACD,MAAM,EAAE;IACN,wCAAwC;KACzC;IACD,IAAI,EAAE;QACJ,gBAAgB,EAAE,0BAA0B;QAC5C,eAAe,EAAE,yBAAyB;QAC1C,WAAW,EAAE,oBAAoB;QACjC,YAAY,EAAE,sBAAsB;QACpC,aAAa,EAAE,uBAAuB;QACtC,SAAS,EAAE,kBAAkB;QAC7B,gBAAgB,EAAE,2BAA2B;QAC7C,oBAAoB,EAAE,gCAAgC;QACtD,cAAc,EAAE,wBAAwB;QACxC,sBAAsB,EAAE,iCAAiC;QACzD,kBAAkB,EAAE,6BAA6B;QACjD,2BAA2B,EAAE,CAAC,KAAa,EAAE,EAAE,CAC7C,yCAAyC,KAAK,EAAW;QAC3D,uBAAuB,EAAE,CAAC,KAAa,EAAE,EAAE,CACzC,qCAAqC,KAAK,EAAW;QACvD,wCAAwC;KACzC;IACD,IAAI,EAAE;IACJ,wCAAwC;KACzC;CACO,CAAC"}
@@ -7,11 +7,12 @@
7
7
  import { ReactNode } from 'react';
8
8
  export declare const AnnouncementBarDismissStorageKey = "docusaurus.announcement.dismiss";
9
9
  declare type AnnouncementBarAPI = {
10
- readonly isClosed: boolean;
10
+ readonly isActive: boolean;
11
11
  readonly close: () => void;
12
12
  };
13
- export declare const AnnouncementBarProvider: ({ children }: {
13
+ export declare function AnnouncementBarProvider({ children, }: {
14
14
  children: ReactNode;
15
- }) => JSX.Element;
15
+ }): JSX.Element;
16
16
  export declare const useAnnouncementBar: () => AnnouncementBarAPI;
17
17
  export {};
18
+ //# sourceMappingURL=announcementBarUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"announcementBarUtils.d.ts","sourceRoot":"","sources":["../../src/utils/announcementBarUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAKZ,SAAS,EAGV,MAAM,OAAO,CAAC;AAKf,eAAO,MAAM,gCAAgC,oCACV,CAAC;AAapC,aAAK,kBAAkB,GAAG;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AA6DF,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAOd;AAED,eAAO,MAAM,kBAAkB,QAAO,kBAQrC,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { useState, useEffect, useCallback, useMemo, useContext, createContext, } from 'react';
8
- import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
8
+ import useIsBrowser from '@docusaurus/useIsBrowser';
9
9
  import { createStorageSlot } from './storageUtils';
10
10
  import { useThemeConfig } from './useThemeConfig';
11
11
  export const AnnouncementBarDismissStorageKey = 'docusaurus.announcement.dismiss';
@@ -16,14 +16,12 @@ const isDismissedInStorage = () => AnnouncementBarDismissStorage.get() === 'true
16
16
  const setDismissedInStorage = (bool) => AnnouncementBarDismissStorage.set(String(bool));
17
17
  const useAnnouncementBarContextValue = () => {
18
18
  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
- });
19
+ const isBrowser = useIsBrowser();
20
+ const [isClosed, setClosed] = useState(() => isBrowser
21
+ ? // On client navigation: init with localstorage value
22
+ isDismissedInStorage()
23
+ : // On server/hydration: always visible to prevent layout shifts (will be hidden with css if needed)
24
+ false);
27
25
  // Update state after hydration
28
26
  useEffect(() => {
29
27
  setClosed(isDismissedInStorage());
@@ -51,19 +49,17 @@ const useAnnouncementBarContextValue = () => {
51
49
  if (isNewAnnouncement || !isDismissedInStorage()) {
52
50
  setClosed(false);
53
51
  }
54
- }, []);
55
- return useMemo(() => {
56
- return {
57
- isClosed,
58
- close: handleClose,
59
- };
60
- }, [isClosed]);
52
+ }, [announcementBar]);
53
+ return useMemo(() => ({
54
+ isActive: !!announcementBar && !isClosed,
55
+ close: handleClose,
56
+ }), [announcementBar, isClosed, handleClose]);
61
57
  };
62
58
  const AnnouncementBarContext = createContext(null);
63
- export const AnnouncementBarProvider = ({ children }) => {
59
+ export function AnnouncementBarProvider({ children, }) {
64
60
  const value = useAnnouncementBarContextValue();
65
61
  return (React.createElement(AnnouncementBarContext.Provider, { value: value }, children));
66
- };
62
+ }
67
63
  export const useAnnouncementBar = () => {
68
64
  const api = useContext(AnnouncementBarContext);
69
65
  if (!api) {
@@ -71,3 +67,4 @@ export const useAnnouncementBar = () => {
71
67
  }
72
68
  return api;
73
69
  };
70
+ //# sourceMappingURL=announcementBarUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"announcementBarUtils.js","sourceRoot":"","sources":["../../src/utils/announcementBarUtils.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EACZ,QAAQ,EACR,SAAS,EACT,WAAW,EACX,OAAO,EAEP,UAAU,EACV,aAAa,GACd,MAAM,OAAO,CAAC;AACf,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEhD,MAAM,CAAC,MAAM,gCAAgC,GAC3C,iCAAiC,CAAC;AACpC,MAAM,2BAA2B,GAAG,4BAA4B,CAAC;AAEjE,MAAM,6BAA6B,GAAG,iBAAiB,CACrD,gCAAgC,CACjC,CAAC;AACF,MAAM,SAAS,GAAG,iBAAiB,CAAC,2BAA2B,CAAC,CAAC;AAEjE,MAAM,oBAAoB,GAAG,GAAG,EAAE,C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;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,CAAC;AAEF,MAAM,sBAAsB,GAAG,aAAa,CAA4B,IAAI,CAAC,CAAC;AAE9E,MAAM,UAAU,uBAAuB,CAAC,EACtC,QAAQ,GAGT;IACC,MAAM,KAAK,GAAG,8BAA8B,EAAE,CAAC;IAC/C,OAAO,CACL,oBAAC,sBAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAC1C,QAAQ,CACuB,CACnC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAuB,EAAE;IACzD,MAAM,GAAG,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;IAC/C,IAAI,CAAC,GAAG,EAAE;QACR,MAAM,IAAI,KAAK,CACb,mIAAmI,CACpI,CAAC;KACH;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
@@ -4,4 +4,15 @@
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 type { Language } from 'prism-react-renderer';
7
8
  export declare function parseCodeBlockTitle(metastring?: string): string;
9
+ export declare function parseLanguage(className?: string): Language | undefined;
10
+ /**
11
+ * @param metastring The highlight range declared here starts at 1
12
+ * @returns Note: all line numbers start at 0, not 1
13
+ */
14
+ export declare function parseLines(content: string, metastring?: string, language?: Language): {
15
+ highlightLines: number[];
16
+ code: string;
17
+ };
18
+ //# sourceMappingURL=codeBlockUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codeBlockUtils.d.ts","sourceRoot":"","sources":["../../src/utils/codeBlockUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAmFnD,wBAAgB,mBAAmB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,wBAAgB,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAKtE;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,QAAQ,GAClB;IACD,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,CAiDA"}