@docusaurus/theme-live-codeblock 3.0.0-alpha.0 → 3.0.0-beta.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.
- package/lib/theme/CodeBlock/index.d.ts +2 -2
- package/lib/theme/Playground/index.js +5 -10
- package/lib/theme/Playground/styles.module.css +0 -4
- package/lib/theme/ReactLiveScope/index.d.ts +1 -1
- package/package.json +9 -9
- package/src/theme/Playground/index.tsx +5 -12
- package/src/theme/Playground/styles.module.css +0 -4
|
@@ -4,7 +4,7 @@
|
|
|
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
|
-
|
|
7
|
+
import React from 'react';
|
|
8
8
|
import { type Props } from '@theme-init/CodeBlock';
|
|
9
|
-
declare const _default: (props: Props) => JSX.Element;
|
|
9
|
+
declare const _default: (props: Props) => React.JSX.Element;
|
|
10
10
|
export default _default;
|
|
@@ -12,7 +12,7 @@ import Translate from '@docusaurus/Translate';
|
|
|
12
12
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
13
13
|
import BrowserOnly from '@docusaurus/BrowserOnly';
|
|
14
14
|
import {
|
|
15
|
-
|
|
15
|
+
ErrorBoundaryErrorMessageFallback,
|
|
16
16
|
usePrismTheme,
|
|
17
17
|
} from '@docusaurus/theme-common';
|
|
18
18
|
import ErrorBoundary from '@docusaurus/ErrorBoundary';
|
|
@@ -25,14 +25,6 @@ function LivePreviewLoader() {
|
|
|
25
25
|
// eslint-disable-next-line @docusaurus/no-untranslated-text
|
|
26
26
|
return <div>Loading...</div>;
|
|
27
27
|
}
|
|
28
|
-
function ErrorFallback({error, tryAgain}) {
|
|
29
|
-
return (
|
|
30
|
-
<div className={styles.errorFallback}>
|
|
31
|
-
<p>{error.message}</p>
|
|
32
|
-
<ErrorBoundaryTryAgainButton onClick={tryAgain} />
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
28
|
function Preview() {
|
|
37
29
|
// No SSR for the live preview
|
|
38
30
|
// See https://github.com/facebook/docusaurus/issues/5747
|
|
@@ -40,7 +32,10 @@ function Preview() {
|
|
|
40
32
|
<BrowserOnly fallback={<LivePreviewLoader />}>
|
|
41
33
|
{() => (
|
|
42
34
|
<>
|
|
43
|
-
<ErrorBoundary
|
|
35
|
+
<ErrorBoundary
|
|
36
|
+
fallback={(params) => (
|
|
37
|
+
<ErrorBoundaryErrorMessageFallback {...params} />
|
|
38
|
+
)}>
|
|
44
39
|
<LivePreview />
|
|
45
40
|
</ErrorBoundary>
|
|
46
41
|
<LiveError />
|
|
@@ -65,7 +65,7 @@ declare const ReactLiveScope: {
|
|
|
65
65
|
forEach<C_3>(children: C_3 | readonly C_3[], fn: (child: C_3, index: number) => void): void;
|
|
66
66
|
count(children: any): number;
|
|
67
67
|
only<C_4>(children: C_4): C_4 extends any[] ? never : C_4;
|
|
68
|
-
toArray(children: React.ReactNode | React.ReactNode[]): (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.
|
|
68
|
+
toArray(children: React.ReactNode | React.ReactNode[]): (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal)[];
|
|
69
69
|
};
|
|
70
70
|
Fragment: React.ExoticComponent<{
|
|
71
71
|
children?: React.ReactNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-live-codeblock",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-beta.0",
|
|
4
4
|
"description": "Docusaurus live code block component.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-live-codeblock.d.ts",
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@docusaurus/core": "3.0.0-
|
|
27
|
-
"@docusaurus/theme-common": "3.0.0-
|
|
28
|
-
"@docusaurus/theme-translations": "3.0.0-
|
|
29
|
-
"@docusaurus/utils-validation": "3.0.0-
|
|
26
|
+
"@docusaurus/core": "3.0.0-beta.0",
|
|
27
|
+
"@docusaurus/theme-common": "3.0.0-beta.0",
|
|
28
|
+
"@docusaurus/theme-translations": "3.0.0-beta.0",
|
|
29
|
+
"@docusaurus/utils-validation": "3.0.0-beta.0",
|
|
30
30
|
"@philpl/buble": "^0.19.7",
|
|
31
31
|
"clsx": "^1.2.1",
|
|
32
|
-
"fs-extra": "^11.1.
|
|
32
|
+
"fs-extra": "^11.1.1",
|
|
33
33
|
"react-live": "2.2.3",
|
|
34
|
-
"tslib": "^2.
|
|
34
|
+
"tslib": "^2.6.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@docusaurus/types": "3.0.0-
|
|
37
|
+
"@docusaurus/types": "3.0.0-beta.0",
|
|
38
38
|
"@types/buble": "^0.20.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": ">=16.14"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "27a1e90d9fff88af90ecad35bea16d4d7230482a"
|
|
48
48
|
}
|
|
@@ -13,13 +13,12 @@ import Translate from '@docusaurus/Translate';
|
|
|
13
13
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
14
14
|
import BrowserOnly from '@docusaurus/BrowserOnly';
|
|
15
15
|
import {
|
|
16
|
-
|
|
16
|
+
ErrorBoundaryErrorMessageFallback,
|
|
17
17
|
usePrismTheme,
|
|
18
18
|
} from '@docusaurus/theme-common';
|
|
19
19
|
import ErrorBoundary from '@docusaurus/ErrorBoundary';
|
|
20
20
|
|
|
21
21
|
import type {Props} from '@theme/Playground';
|
|
22
|
-
import type {Props as ErrorProps} from '@theme/Error';
|
|
23
22
|
import type {ThemeConfig} from '@docusaurus/theme-live-codeblock';
|
|
24
23
|
|
|
25
24
|
import styles from './styles.module.css';
|
|
@@ -34,15 +33,6 @@ function LivePreviewLoader() {
|
|
|
34
33
|
return <div>Loading...</div>;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
function ErrorFallback({error, tryAgain}: ErrorProps): JSX.Element {
|
|
38
|
-
return (
|
|
39
|
-
<div className={styles.errorFallback}>
|
|
40
|
-
<p>{error.message}</p>
|
|
41
|
-
<ErrorBoundaryTryAgainButton onClick={tryAgain} />
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
36
|
function Preview() {
|
|
47
37
|
// No SSR for the live preview
|
|
48
38
|
// See https://github.com/facebook/docusaurus/issues/5747
|
|
@@ -50,7 +40,10 @@ function Preview() {
|
|
|
50
40
|
<BrowserOnly fallback={<LivePreviewLoader />}>
|
|
51
41
|
{() => (
|
|
52
42
|
<>
|
|
53
|
-
<ErrorBoundary
|
|
43
|
+
<ErrorBoundary
|
|
44
|
+
fallback={(params) => (
|
|
45
|
+
<ErrorBoundaryErrorMessageFallback {...params} />
|
|
46
|
+
)}>
|
|
54
47
|
<LivePreview />
|
|
55
48
|
</ErrorBoundary>
|
|
56
49
|
<LiveError />
|