@docusaurus/plugin-debug 3.0.0-rc.1 → 3.0.1
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.
|
@@ -5,45 +5,34 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
8
|
+
import {JsonView} from 'react-json-view-lite';
|
|
9
|
+
import styles from './styles.module.css';
|
|
10
|
+
const paraisoStyles = {
|
|
11
|
+
container: styles.containerParaiso,
|
|
12
|
+
basicChildStyle: styles.basicElementParaiso,
|
|
13
|
+
label: styles.labelParaiso,
|
|
14
|
+
nullValue: styles.nullValueParaiso,
|
|
15
|
+
undefinedValue: styles.undefinedValueParaiso,
|
|
16
|
+
stringValue: styles.stringValueParaiso,
|
|
17
|
+
booleanValue: styles.booleanValueParaiso,
|
|
18
|
+
numberValue: styles.numberValueParaiso,
|
|
19
|
+
otherValue: styles.otherValueParaiso,
|
|
20
|
+
punctuation: styles.punctuationParaiso,
|
|
21
|
+
collapseIcon: styles.collapseIconParaiso,
|
|
22
|
+
expandIcon: styles.expandIconParaiso,
|
|
23
|
+
collapsedContent: styles.collapseContentParaiso,
|
|
24
|
+
};
|
|
25
25
|
export default function DebugJsonView({src, collapseDepth}) {
|
|
26
26
|
return (
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
<JsonView
|
|
28
|
+
data={src}
|
|
29
|
+
shouldExpandNode={(idx, value) => {
|
|
30
|
+
if (Array.isArray(value)) {
|
|
31
|
+
return value.length < 5;
|
|
32
|
+
}
|
|
33
|
+
return collapseDepth !== undefined && idx < collapseDepth;
|
|
34
34
|
}}
|
|
35
|
-
|
|
36
|
-
theme="paraiso"
|
|
37
|
-
shouldCollapse={(field) =>
|
|
38
|
-
// By default, we collapse the json for performance reasons
|
|
39
|
-
// See https://github.com/mac-s-g/react-json-view/issues/235
|
|
40
|
-
// Non-root elements that are larger than 50 fields are collapsed
|
|
41
|
-
field.name !== RootName && Object.keys(field.src).length > 50
|
|
42
|
-
}
|
|
43
|
-
collapsed={collapseDepth}
|
|
44
|
-
groupArraysAfterLength={5}
|
|
45
|
-
enableClipboard={false}
|
|
46
|
-
displayDataTypes={false}
|
|
35
|
+
style={paraisoStyles}
|
|
47
36
|
/>
|
|
48
37
|
);
|
|
49
38
|
}
|
|
@@ -0,0 +1,101 @@
|
|
|
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
|
+
.containerParaiso {
|
|
9
|
+
font-family: monospace;
|
|
10
|
+
cursor: default;
|
|
11
|
+
background-color: rgb(41 42 43);
|
|
12
|
+
position: relative;
|
|
13
|
+
margin-top: 10px;
|
|
14
|
+
padding: 10px;
|
|
15
|
+
border-radius: 4px;
|
|
16
|
+
font-size: 13px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.basicElementParaiso {
|
|
20
|
+
color: white;
|
|
21
|
+
padding: 3px 5px 3px 20px;
|
|
22
|
+
border-left: 1px solid rgb(79 66 76);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.labelParaiso {
|
|
26
|
+
color: rgb(231 233 219);
|
|
27
|
+
letter-spacing: 0.5px;
|
|
28
|
+
margin-right: 3px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.nullValueParaiso {
|
|
32
|
+
display: inline-block;
|
|
33
|
+
color: rgb(254 196 24);
|
|
34
|
+
font-size: 11px;
|
|
35
|
+
font-weight: bold;
|
|
36
|
+
background-color: rgb(79 66 76);
|
|
37
|
+
padding: 1px 2px;
|
|
38
|
+
border-radius: 3px;
|
|
39
|
+
text-transform: uppercase;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.undefinedValueParaiso {
|
|
43
|
+
color: rgb(141 134 135);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.stringValueParaiso {
|
|
47
|
+
color: rgb(249 155 21);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.booleanValueParaiso {
|
|
51
|
+
color: rgb(129 91 164);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.numberValueParaiso {
|
|
55
|
+
color: rgb(233 107 168);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.otherValueParaiso {
|
|
59
|
+
color: white;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.punctuationParaiso {
|
|
63
|
+
color: white;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.expandIconParaiso {
|
|
67
|
+
display: inline-block;
|
|
68
|
+
color: rgb(129 91 164);
|
|
69
|
+
font-size: 22px;
|
|
70
|
+
vertical-align: baseline;
|
|
71
|
+
margin-right: 3px;
|
|
72
|
+
line-height: 10px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.collapseIconParaiso::after {
|
|
76
|
+
content: '\25BE';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.collapseIconParaiso {
|
|
80
|
+
display: inline-block;
|
|
81
|
+
color: rgb(6 182 239);
|
|
82
|
+
font-size: 22px;
|
|
83
|
+
vertical-align: baseline;
|
|
84
|
+
margin-right: 3px;
|
|
85
|
+
line-height: 10px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.expandIconParaiso::after {
|
|
89
|
+
content: '\25B8';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.collapseContentParaiso {
|
|
93
|
+
color: rgb(249 155 21);
|
|
94
|
+
font-size: 18px;
|
|
95
|
+
line-height: 10px;
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.collapseContentParaiso::after {
|
|
100
|
+
content: '...';
|
|
101
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-debug",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Debug plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/plugin-debug.d.ts",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@docusaurus/core": "3.0.
|
|
24
|
-
"@docusaurus/types": "3.0.
|
|
25
|
-
"@docusaurus/utils": "3.0.
|
|
26
|
-
"@microlink/react-json-view": "^1.22.2",
|
|
23
|
+
"@docusaurus/core": "3.0.1",
|
|
24
|
+
"@docusaurus/types": "3.0.1",
|
|
25
|
+
"@docusaurus/utils": "3.0.1",
|
|
27
26
|
"fs-extra": "^11.1.1",
|
|
27
|
+
"react-json-view-lite": "^1.2.0",
|
|
28
28
|
"tslib": "^2.6.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=18.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "29d816067fd0022d4ca3bd5fdc42098dac9f7ffc"
|
|
38
38
|
}
|
|
@@ -6,53 +6,41 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import
|
|
9
|
+
import {JsonView} from 'react-json-view-lite';
|
|
10
10
|
import type {Props} from '@theme/DebugJsonView';
|
|
11
|
-
import
|
|
11
|
+
import styles from './styles.module.css';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
);
|
|
29
|
-
}
|
|
13
|
+
const paraisoStyles = {
|
|
14
|
+
container: styles.containerParaiso!,
|
|
15
|
+
basicChildStyle: styles.basicElementParaiso!,
|
|
16
|
+
label: styles.labelParaiso!,
|
|
17
|
+
nullValue: styles.nullValueParaiso!,
|
|
18
|
+
undefinedValue: styles.undefinedValueParaiso!,
|
|
19
|
+
stringValue: styles.stringValueParaiso!,
|
|
20
|
+
booleanValue: styles.booleanValueParaiso!,
|
|
21
|
+
numberValue: styles.numberValueParaiso!,
|
|
22
|
+
otherValue: styles.otherValueParaiso!,
|
|
23
|
+
punctuation: styles.punctuationParaiso!,
|
|
24
|
+
collapseIcon: styles.collapseIconParaiso!,
|
|
25
|
+
expandIcon: styles.expandIconParaiso!,
|
|
26
|
+
collapsedContent: styles.collapseContentParaiso!,
|
|
27
|
+
};
|
|
30
28
|
|
|
31
29
|
export default function DebugJsonView({
|
|
32
30
|
src,
|
|
33
31
|
collapseDepth,
|
|
34
32
|
}: Props): JSX.Element {
|
|
35
33
|
return (
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
<JsonView
|
|
35
|
+
data={src as object}
|
|
36
|
+
shouldExpandNode={(idx, value) => {
|
|
37
|
+
if (Array.isArray(value)) {
|
|
38
|
+
return value.length < 5;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return collapseDepth !== undefined && idx < collapseDepth;
|
|
43
42
|
}}
|
|
44
|
-
|
|
45
|
-
theme="paraiso"
|
|
46
|
-
shouldCollapse={(field) =>
|
|
47
|
-
// By default, we collapse the json for performance reasons
|
|
48
|
-
// See https://github.com/mac-s-g/react-json-view/issues/235
|
|
49
|
-
// Non-root elements that are larger than 50 fields are collapsed
|
|
50
|
-
field.name !== RootName && Object.keys(field.src).length > 50
|
|
51
|
-
}
|
|
52
|
-
collapsed={collapseDepth}
|
|
53
|
-
groupArraysAfterLength={5}
|
|
54
|
-
enableClipboard={false}
|
|
55
|
-
displayDataTypes={false}
|
|
43
|
+
style={paraisoStyles}
|
|
56
44
|
/>
|
|
57
45
|
);
|
|
58
46
|
}
|
|
@@ -0,0 +1,101 @@
|
|
|
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
|
+
.containerParaiso {
|
|
9
|
+
font-family: monospace;
|
|
10
|
+
cursor: default;
|
|
11
|
+
background-color: rgb(41 42 43);
|
|
12
|
+
position: relative;
|
|
13
|
+
margin-top: 10px;
|
|
14
|
+
padding: 10px;
|
|
15
|
+
border-radius: 4px;
|
|
16
|
+
font-size: 13px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.basicElementParaiso {
|
|
20
|
+
color: white;
|
|
21
|
+
padding: 3px 5px 3px 20px;
|
|
22
|
+
border-left: 1px solid rgb(79 66 76);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.labelParaiso {
|
|
26
|
+
color: rgb(231 233 219);
|
|
27
|
+
letter-spacing: 0.5px;
|
|
28
|
+
margin-right: 3px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.nullValueParaiso {
|
|
32
|
+
display: inline-block;
|
|
33
|
+
color: rgb(254 196 24);
|
|
34
|
+
font-size: 11px;
|
|
35
|
+
font-weight: bold;
|
|
36
|
+
background-color: rgb(79 66 76);
|
|
37
|
+
padding: 1px 2px;
|
|
38
|
+
border-radius: 3px;
|
|
39
|
+
text-transform: uppercase;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.undefinedValueParaiso {
|
|
43
|
+
color: rgb(141 134 135);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.stringValueParaiso {
|
|
47
|
+
color: rgb(249 155 21);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.booleanValueParaiso {
|
|
51
|
+
color: rgb(129 91 164);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.numberValueParaiso {
|
|
55
|
+
color: rgb(233 107 168);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.otherValueParaiso {
|
|
59
|
+
color: white;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.punctuationParaiso {
|
|
63
|
+
color: white;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.expandIconParaiso {
|
|
67
|
+
display: inline-block;
|
|
68
|
+
color: rgb(129 91 164);
|
|
69
|
+
font-size: 22px;
|
|
70
|
+
vertical-align: baseline;
|
|
71
|
+
margin-right: 3px;
|
|
72
|
+
line-height: 10px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.collapseIconParaiso::after {
|
|
76
|
+
content: '\25BE';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.collapseIconParaiso {
|
|
80
|
+
display: inline-block;
|
|
81
|
+
color: rgb(6 182 239);
|
|
82
|
+
font-size: 22px;
|
|
83
|
+
vertical-align: baseline;
|
|
84
|
+
margin-right: 3px;
|
|
85
|
+
line-height: 10px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.expandIconParaiso::after {
|
|
89
|
+
content: '\25B8';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.collapseContentParaiso {
|
|
93
|
+
color: rgb(249 155 21);
|
|
94
|
+
font-size: 18px;
|
|
95
|
+
line-height: 10px;
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.collapseContentParaiso::after {
|
|
100
|
+
content: '...';
|
|
101
|
+
}
|