@uiw/react-json-view 1.12.0 → 2.0.0-alpha.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/README.md +249 -265
- package/cjs/Container.d.ts +10 -0
- package/cjs/Container.js +67 -0
- package/cjs/arrow/TriangleArrow.js +3 -1
- package/cjs/arrow/TriangleSolidArrow.js +7 -3
- package/cjs/comps/Copied.d.ts +16 -0
- package/cjs/{copied.js → comps/Copied.js} +44 -32
- package/cjs/comps/CountInfo.d.ts +19 -0
- package/cjs/comps/CountInfo.js +72 -0
- package/cjs/comps/Ellipsis.d.ts +10 -0
- package/cjs/comps/Ellipsis.js +35 -0
- package/cjs/comps/Key.d.ts +7 -0
- package/cjs/comps/Key.js +39 -0
- package/cjs/comps/KeyValues.d.ts +22 -0
- package/cjs/comps/KeyValues.js +156 -0
- package/cjs/comps/NestedClose.d.ts +10 -0
- package/cjs/comps/NestedClose.js +38 -0
- package/cjs/comps/NestedOpen.d.ts +11 -0
- package/cjs/comps/NestedOpen.js +95 -0
- package/cjs/comps/ReRender/Symbols.d.ts +44 -0
- package/cjs/comps/ReRender/Symbols.js +144 -0
- package/cjs/comps/ReRender/Types.d.ts +36 -0
- package/cjs/comps/ReRender/Types.js +590 -0
- package/cjs/comps/Value.d.ts +11 -0
- package/cjs/comps/Value.js +78 -0
- package/cjs/index.d.ts +72 -52
- package/cjs/index.js +147 -27
- package/cjs/section/Copied.d.ts +6 -0
- package/cjs/section/Copied.js +17 -0
- package/cjs/section/CountInfo.d.ts +6 -0
- package/cjs/section/CountInfo.js +17 -0
- package/cjs/section/CountInfoExtra.d.ts +6 -0
- package/cjs/section/CountInfoExtra.js +17 -0
- package/cjs/section/Ellipsis.d.ts +6 -0
- package/cjs/section/Ellipsis.js +17 -0
- package/cjs/section/KeyName.d.ts +6 -0
- package/cjs/section/KeyName.js +17 -0
- package/cjs/store/Expands.d.ts +16 -0
- package/cjs/store/Expands.js +44 -0
- package/cjs/store/Section.d.ts +33 -0
- package/cjs/store/Section.js +86 -0
- package/cjs/store/ShowTools.d.ts +14 -0
- package/cjs/store/ShowTools.js +44 -0
- package/cjs/store/Symbols.d.ts +37 -0
- package/cjs/store/Symbols.js +112 -0
- package/cjs/store/Types.d.ts +52 -0
- package/cjs/store/Types.js +162 -0
- package/cjs/store.d.ts +29 -5
- package/cjs/store.js +96 -46
- package/cjs/symbol/Arrow.d.ts +6 -0
- package/cjs/symbol/Arrow.js +17 -0
- package/cjs/symbol/BraceLeft.d.ts +6 -0
- package/cjs/symbol/BraceLeft.js +17 -0
- package/cjs/symbol/BraceRight.d.ts +6 -0
- package/cjs/symbol/BraceRight.js +17 -0
- package/cjs/symbol/BracketsLeft.d.ts +6 -0
- package/cjs/symbol/BracketsLeft.js +17 -0
- package/cjs/symbol/BracketsRight.d.ts +6 -0
- package/cjs/symbol/BracketsRight.js +17 -0
- package/cjs/symbol/Colon.d.ts +6 -0
- package/cjs/symbol/Colon.js +17 -0
- package/cjs/symbol/Quote.d.ts +6 -0
- package/cjs/symbol/Quote.js +17 -0
- package/cjs/symbol/ValueQuote.d.ts +6 -0
- package/cjs/symbol/ValueQuote.js +17 -0
- package/cjs/theme/basic.js +3 -0
- package/cjs/theme/dark.js +3 -0
- package/cjs/theme/github.dark.js +3 -0
- package/cjs/theme/github.light.js +3 -0
- package/cjs/theme/gruvbox.js +3 -0
- package/cjs/theme/light.js +3 -0
- package/cjs/theme/monokai.js +3 -0
- package/cjs/theme/nord.js +3 -0
- package/cjs/theme/vscode.js +3 -0
- package/cjs/type.d.ts +50 -0
- package/cjs/type.js +57 -0
- package/cjs/types/Bigint.d.ts +5 -0
- package/cjs/types/Bigint.js +17 -0
- package/cjs/types/Date.d.ts +5 -0
- package/cjs/types/Date.js +17 -0
- package/cjs/types/False.d.ts +5 -0
- package/cjs/types/False.js +17 -0
- package/cjs/types/Float.d.ts +5 -0
- package/cjs/types/Float.js +17 -0
- package/cjs/types/Int.d.ts +5 -0
- package/cjs/types/Int.js +17 -0
- package/cjs/types/Map.d.ts +5 -0
- package/cjs/types/Map.js +17 -0
- package/cjs/types/Nan.d.ts +5 -0
- package/cjs/types/Nan.js +17 -0
- package/cjs/types/Null.d.ts +5 -0
- package/cjs/types/Null.js +17 -0
- package/cjs/types/Set.d.ts +5 -0
- package/cjs/types/Set.js +17 -0
- package/cjs/types/String.d.ts +5 -0
- package/cjs/types/String.js +17 -0
- package/cjs/types/True.d.ts +5 -0
- package/cjs/types/True.js +17 -0
- package/cjs/types/Undefined.d.ts +5 -0
- package/cjs/types/Undefined.js +17 -0
- package/cjs/types/Url.d.ts +5 -0
- package/cjs/types/Url.js +17 -0
- package/cjs/utils/useHighlight.d.ts +9 -0
- package/cjs/utils/useHighlight.js +62 -0
- package/cjs/utils/useRender.d.ts +6 -0
- package/cjs/utils/useRender.js +51 -0
- package/esm/Container.d.ts +10 -0
- package/esm/Container.js +53 -0
- package/esm/arrow/TriangleArrow.js +3 -1
- package/esm/arrow/TriangleSolidArrow.js +7 -3
- package/esm/comps/Copied.d.ts +16 -0
- package/esm/{copied.js → comps/Copied.js} +44 -29
- package/esm/comps/CountInfo.d.ts +19 -0
- package/esm/comps/CountInfo.js +70 -0
- package/esm/comps/Ellipsis.d.ts +10 -0
- package/esm/comps/Ellipsis.js +31 -0
- package/esm/comps/Key.d.ts +7 -0
- package/esm/comps/Key.js +35 -0
- package/esm/comps/KeyValues.d.ts +22 -0
- package/esm/comps/KeyValues.js +142 -0
- package/esm/comps/NestedClose.d.ts +10 -0
- package/esm/comps/NestedClose.js +34 -0
- package/esm/comps/NestedOpen.d.ts +11 -0
- package/esm/comps/NestedOpen.js +91 -0
- package/esm/comps/ReRender/Symbols.d.ts +44 -0
- package/esm/comps/ReRender/Symbols.js +155 -0
- package/esm/comps/ReRender/Types.d.ts +36 -0
- package/esm/comps/ReRender/Types.js +621 -0
- package/esm/comps/Value.d.ts +11 -0
- package/esm/comps/Value.js +69 -0
- package/esm/index.d.ts +72 -52
- package/esm/index.js +98 -18
- package/esm/section/Copied.d.ts +6 -0
- package/esm/section/Copied.js +10 -0
- package/esm/section/CountInfo.d.ts +6 -0
- package/esm/section/CountInfo.js +10 -0
- package/esm/section/CountInfoExtra.d.ts +6 -0
- package/esm/section/CountInfoExtra.js +10 -0
- package/esm/section/Ellipsis.d.ts +6 -0
- package/esm/section/Ellipsis.js +10 -0
- package/esm/section/KeyName.d.ts +6 -0
- package/esm/section/KeyName.js +10 -0
- package/esm/store/Expands.d.ts +16 -0
- package/esm/store/Expands.js +32 -0
- package/esm/store/Section.d.ts +33 -0
- package/esm/store/Section.js +73 -0
- package/esm/store/ShowTools.d.ts +14 -0
- package/esm/store/ShowTools.js +32 -0
- package/esm/store/Symbols.d.ts +37 -0
- package/esm/store/Symbols.js +100 -0
- package/esm/store/Types.d.ts +52 -0
- package/esm/store/Types.js +150 -0
- package/esm/store.d.ts +29 -5
- package/esm/store.js +66 -32
- package/esm/symbol/Arrow.d.ts +6 -0
- package/esm/symbol/Arrow.js +10 -0
- package/esm/symbol/BraceLeft.d.ts +6 -0
- package/esm/symbol/BraceLeft.js +10 -0
- package/esm/symbol/BraceRight.d.ts +6 -0
- package/esm/symbol/BraceRight.js +10 -0
- package/esm/symbol/BracketsLeft.d.ts +6 -0
- package/esm/symbol/BracketsLeft.js +10 -0
- package/esm/symbol/BracketsRight.d.ts +6 -0
- package/esm/symbol/BracketsRight.js +10 -0
- package/esm/symbol/Colon.d.ts +6 -0
- package/esm/symbol/Colon.js +10 -0
- package/esm/symbol/Quote.d.ts +6 -0
- package/esm/symbol/Quote.js +10 -0
- package/esm/symbol/ValueQuote.d.ts +6 -0
- package/esm/symbol/ValueQuote.js +10 -0
- package/esm/theme/basic.js +3 -0
- package/esm/theme/dark.js +3 -0
- package/esm/theme/github.dark.js +3 -0
- package/esm/theme/github.light.js +3 -0
- package/esm/theme/gruvbox.js +3 -0
- package/esm/theme/light.js +3 -0
- package/esm/theme/monokai.js +3 -0
- package/esm/theme/nord.js +3 -0
- package/esm/theme/vscode.js +3 -0
- package/esm/type.d.ts +50 -0
- package/esm/type.js +50 -0
- package/esm/types/Bigint.d.ts +5 -0
- package/esm/types/Bigint.js +10 -0
- package/esm/types/Date.d.ts +5 -0
- package/esm/types/Date.js +10 -0
- package/esm/types/False.d.ts +5 -0
- package/esm/types/False.js +10 -0
- package/esm/types/Float.d.ts +5 -0
- package/esm/types/Float.js +10 -0
- package/esm/types/Int.d.ts +5 -0
- package/esm/types/Int.js +10 -0
- package/esm/types/Map.d.ts +5 -0
- package/esm/types/Map.js +10 -0
- package/esm/types/Nan.d.ts +5 -0
- package/esm/types/Nan.js +10 -0
- package/esm/types/Null.d.ts +5 -0
- package/esm/types/Null.js +10 -0
- package/esm/types/Set.d.ts +5 -0
- package/esm/types/Set.js +10 -0
- package/esm/types/String.d.ts +5 -0
- package/esm/types/String.js +10 -0
- package/esm/types/True.d.ts +5 -0
- package/esm/types/True.js +10 -0
- package/esm/types/Undefined.d.ts +5 -0
- package/esm/types/Undefined.js +10 -0
- package/esm/types/Url.d.ts +5 -0
- package/esm/types/Url.js +10 -0
- package/esm/utils/useHighlight.d.ts +9 -0
- package/esm/{semicolon.js → utils/useHighlight.js} +1 -52
- package/esm/utils/useRender.d.ts +6 -0
- package/esm/utils/useRender.js +41 -0
- package/package.json +1 -1
- package/cjs/comps/ellipsis.d.ts +0 -7
- package/cjs/comps/ellipsis.js +0 -37
- package/cjs/comps/meta.d.ts +0 -12
- package/cjs/comps/meta.js +0 -46
- package/cjs/copied.d.ts +0 -11
- package/cjs/editor/countInfoExtra.d.ts +0 -28
- package/cjs/editor/countInfoExtra.js +0 -101
- package/cjs/editor/icon/add.d.ts +0 -4
- package/cjs/editor/icon/add.js +0 -30
- package/cjs/editor/icon/delete.d.ts +0 -4
- package/cjs/editor/icon/delete.js +0 -30
- package/cjs/editor/icon/edit.d.ts +0 -4
- package/cjs/editor/icon/edit.js +0 -30
- package/cjs/editor/index.d.ts +0 -31
- package/cjs/editor/index.js +0 -60
- package/cjs/editor/objectKey.d.ts +0 -11
- package/cjs/editor/objectKey.js +0 -169
- package/cjs/editor/value.d.ts +0 -22
- package/cjs/editor/value.js +0 -240
- package/cjs/node.d.ts +0 -15
- package/cjs/node.js +0 -343
- package/cjs/semicolon.d.ts +0 -22
- package/cjs/semicolon.js +0 -115
- package/cjs/value.d.ts +0 -93
- package/cjs/value.js +0 -356
- package/esm/comps/ellipsis.d.ts +0 -7
- package/esm/comps/ellipsis.js +0 -31
- package/esm/comps/meta.d.ts +0 -12
- package/esm/comps/meta.js +0 -39
- package/esm/copied.d.ts +0 -11
- package/esm/editor/countInfoExtra.d.ts +0 -28
- package/esm/editor/countInfoExtra.js +0 -68
- package/esm/editor/icon/add.d.ts +0 -4
- package/esm/editor/icon/add.js +0 -24
- package/esm/editor/icon/delete.d.ts +0 -4
- package/esm/editor/icon/delete.js +0 -24
- package/esm/editor/icon/edit.d.ts +0 -4
- package/esm/editor/icon/edit.js +0 -24
- package/esm/editor/index.d.ts +0 -31
- package/esm/editor/index.js +0 -47
- package/esm/editor/objectKey.d.ts +0 -11
- package/esm/editor/objectKey.js +0 -135
- package/esm/editor/value.d.ts +0 -22
- package/esm/editor/value.js +0 -192
- package/esm/node.d.ts +0 -15
- package/esm/node.js +0 -299
- package/esm/semicolon.d.ts +0 -22
- package/esm/value.d.ts +0 -93
- package/esm/value.js +0 -331
package/esm/value.js
DELETED
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
-
var _excluded = ["children", "style"],
|
|
4
|
-
_excluded2 = ["children", "length", "style"],
|
|
5
|
-
_excluded3 = ["color", "style", "isURL", "href", "children"],
|
|
6
|
-
_excluded4 = ["value", "parentValue", "setValue", "countInfo", "data", "keyName", "indentWidth", "isSet", "namespace", "renderKey", "components", "quotes", "level", "enableClipboard", "displayObjectSize", "displayDataTypes", "shortenTextAfterLength"],
|
|
7
|
-
_excluded5 = ["children", "color", "fontSize", "opacity", "paddingRight", "style"];
|
|
8
|
-
import { Fragment, forwardRef, useMemo, useState } from 'react';
|
|
9
|
-
import { Meta } from './comps/meta';
|
|
10
|
-
import { Copied } from './copied';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
export var Line = props => /*#__PURE__*/_jsx("div", _extends({}, props));
|
|
14
|
-
Line.displayName = 'JVR.Line';
|
|
15
|
-
export var isFloat = n => Number(n) === n && n % 1 !== 0 || isNaN(n);
|
|
16
|
-
export var typeMap = {
|
|
17
|
-
string: {
|
|
18
|
-
color: 'var(--w-rjv-type-string-color, #cb4b16)',
|
|
19
|
-
label: 'string'
|
|
20
|
-
},
|
|
21
|
-
number: {
|
|
22
|
-
color: 'var(--w-rjv-type-int-color, #268bd2)',
|
|
23
|
-
label: 'int'
|
|
24
|
-
},
|
|
25
|
-
float: {
|
|
26
|
-
color: 'var(--w-rjv-type-float-color, #859900)',
|
|
27
|
-
label: 'float'
|
|
28
|
-
},
|
|
29
|
-
bigint: {
|
|
30
|
-
color: 'var(--w-rjv-type-bigint-color, #268bd2)',
|
|
31
|
-
label: 'bigint'
|
|
32
|
-
},
|
|
33
|
-
boolean: {
|
|
34
|
-
color: 'var(--w-rjv-type-boolean-color, #2aa198)',
|
|
35
|
-
label: 'bool'
|
|
36
|
-
},
|
|
37
|
-
date: {
|
|
38
|
-
color: 'var(--w-rjv-type-date-color, #586e75)',
|
|
39
|
-
label: 'date'
|
|
40
|
-
},
|
|
41
|
-
url: {
|
|
42
|
-
color: 'var(--w-rjv-type-url-color, #0969da)',
|
|
43
|
-
label: 'url'
|
|
44
|
-
},
|
|
45
|
-
null: {
|
|
46
|
-
color: 'var(--w-rjv-type-null-color, #d33682)',
|
|
47
|
-
label: 'null'
|
|
48
|
-
},
|
|
49
|
-
Set: {
|
|
50
|
-
color: 'var(--w-rjv-type-set-color, #268bd2)',
|
|
51
|
-
label: 'Set'
|
|
52
|
-
},
|
|
53
|
-
Map: {
|
|
54
|
-
color: 'var(--w-rjv-type-map-color, #268bd2)',
|
|
55
|
-
label: 'Map'
|
|
56
|
-
},
|
|
57
|
-
NaN: {
|
|
58
|
-
color: 'var(--w-rjv-type-nan-color, #859900)',
|
|
59
|
-
label: 'NaN'
|
|
60
|
-
},
|
|
61
|
-
undefined: {
|
|
62
|
-
color: 'var(--w-rjv-type-undefined-color, #586e75)',
|
|
63
|
-
label: 'undefined'
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
export var Colon = _ref => {
|
|
67
|
-
var {
|
|
68
|
-
children = ':',
|
|
69
|
-
style
|
|
70
|
-
} = _ref,
|
|
71
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
72
|
-
return /*#__PURE__*/_jsx("span", _extends({
|
|
73
|
-
className: "w-rjv-colon",
|
|
74
|
-
style: _extends({
|
|
75
|
-
paddingRight: 3
|
|
76
|
-
}, style, {
|
|
77
|
-
color: 'var(--w-rjv-colon-color, var(--w-rjv-color))'
|
|
78
|
-
})
|
|
79
|
-
}, props, {
|
|
80
|
-
children: children
|
|
81
|
-
}));
|
|
82
|
-
};
|
|
83
|
-
Colon.displayName = 'JVR.Colon';
|
|
84
|
-
export function getValueString(value) {
|
|
85
|
-
var type = typeof value;
|
|
86
|
-
var content = '';
|
|
87
|
-
if (typeof value === 'number') {
|
|
88
|
-
type = isFloat(value) ? 'float' : 'number';
|
|
89
|
-
content = value.toString();
|
|
90
|
-
if (isNaN(value)) {
|
|
91
|
-
type = 'NaN';
|
|
92
|
-
content = 'NaN';
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (typeof value === 'boolean') {
|
|
96
|
-
type = 'boolean';
|
|
97
|
-
content = value.toString();
|
|
98
|
-
}
|
|
99
|
-
if (typeof value === 'object' && value instanceof Date) {
|
|
100
|
-
type = 'date';
|
|
101
|
-
content = value.toString();
|
|
102
|
-
}
|
|
103
|
-
if (value === null) {
|
|
104
|
-
type = 'null';
|
|
105
|
-
content = ("" + value).toLocaleUpperCase();
|
|
106
|
-
}
|
|
107
|
-
if (value === undefined) {
|
|
108
|
-
type = 'undefined';
|
|
109
|
-
content = String(value);
|
|
110
|
-
}
|
|
111
|
-
if (typeof value === 'bigint') {
|
|
112
|
-
type = 'bigint';
|
|
113
|
-
content = value + "n";
|
|
114
|
-
}
|
|
115
|
-
var isURL = value instanceof URL;
|
|
116
|
-
if (isURL) {
|
|
117
|
-
type = 'url';
|
|
118
|
-
content = "\"" + value.href + "\"";
|
|
119
|
-
}
|
|
120
|
-
if (typeof value === 'string') {
|
|
121
|
-
content = "\"" + value + "\"";
|
|
122
|
-
}
|
|
123
|
-
return {
|
|
124
|
-
type,
|
|
125
|
-
content
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
var RenderShortenTextValue = _ref2 => {
|
|
129
|
-
var {
|
|
130
|
-
children,
|
|
131
|
-
length,
|
|
132
|
-
style
|
|
133
|
-
} = _ref2,
|
|
134
|
-
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
135
|
-
var childrenStr = children;
|
|
136
|
-
var [shorten, setShorten] = useState(length && childrenStr.length >= length);
|
|
137
|
-
var click = () => {
|
|
138
|
-
if (length && childrenStr.length <= length) return setShorten(false);
|
|
139
|
-
setShorten(!shorten);
|
|
140
|
-
};
|
|
141
|
-
var text = shorten ? childrenStr.slice(0, length) + "..." : childrenStr;
|
|
142
|
-
return /*#__PURE__*/_jsx(RenderStringValue, _extends({}, rest, {
|
|
143
|
-
style: _extends({}, style, {
|
|
144
|
-
cursor: 'pointer'
|
|
145
|
-
}),
|
|
146
|
-
onClick: click,
|
|
147
|
-
children: text
|
|
148
|
-
}));
|
|
149
|
-
};
|
|
150
|
-
RenderShortenTextValue.displayName = 'JVR.RenderShortenTextValue';
|
|
151
|
-
var RenderStringValue = _ref3 => {
|
|
152
|
-
var {
|
|
153
|
-
color,
|
|
154
|
-
style,
|
|
155
|
-
isURL,
|
|
156
|
-
href,
|
|
157
|
-
children
|
|
158
|
-
} = _ref3,
|
|
159
|
-
rest = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
160
|
-
return /*#__PURE__*/_jsxs(Label, _extends({
|
|
161
|
-
color: color,
|
|
162
|
-
style: style
|
|
163
|
-
}, rest, {
|
|
164
|
-
className: "w-rjv-value",
|
|
165
|
-
children: [isURL && /*#__PURE__*/_jsx("a", {
|
|
166
|
-
href: href,
|
|
167
|
-
style: {
|
|
168
|
-
color
|
|
169
|
-
},
|
|
170
|
-
target: "_blank",
|
|
171
|
-
rel: "noopener noreferrer",
|
|
172
|
-
children: children
|
|
173
|
-
}), !isURL && children]
|
|
174
|
-
}));
|
|
175
|
-
};
|
|
176
|
-
RenderStringValue.displayName = 'JVR.RenderStringValue';
|
|
177
|
-
export function ValueView(props) {
|
|
178
|
-
var _typeMap$type;
|
|
179
|
-
var {
|
|
180
|
-
value,
|
|
181
|
-
parentValue,
|
|
182
|
-
setValue,
|
|
183
|
-
countInfo,
|
|
184
|
-
data,
|
|
185
|
-
keyName,
|
|
186
|
-
indentWidth,
|
|
187
|
-
namespace,
|
|
188
|
-
renderKey,
|
|
189
|
-
components = {},
|
|
190
|
-
quotes,
|
|
191
|
-
enableClipboard,
|
|
192
|
-
displayDataTypes,
|
|
193
|
-
shortenTextAfterLength
|
|
194
|
-
} = props,
|
|
195
|
-
reset = _objectWithoutPropertiesLoose(props, _excluded4);
|
|
196
|
-
var color = '';
|
|
197
|
-
var style = {};
|
|
198
|
-
var {
|
|
199
|
-
type,
|
|
200
|
-
content
|
|
201
|
-
} = getValueString(value);
|
|
202
|
-
var typeView = /*#__PURE__*/_jsx(Type, {
|
|
203
|
-
type: type
|
|
204
|
-
});
|
|
205
|
-
if (value === null) {
|
|
206
|
-
typeView = /*#__PURE__*/_jsx(Fragment, {});
|
|
207
|
-
style = {
|
|
208
|
-
fontWeight: 'bold'
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
if (value === undefined || type.toLocaleLowerCase() === 'nan' || !displayDataTypes) {
|
|
212
|
-
typeView = /*#__PURE__*/_jsx(Fragment, {});
|
|
213
|
-
}
|
|
214
|
-
var isURL = value instanceof URL;
|
|
215
|
-
color = ((_typeMap$type = typeMap[type]) == null ? void 0 : _typeMap$type.color) || '';
|
|
216
|
-
var [showTools, setShowTools] = useState(false);
|
|
217
|
-
var tools = useMemo(() => enableClipboard && showTools && /*#__PURE__*/_jsx(Copied, {
|
|
218
|
-
show: showTools,
|
|
219
|
-
text: value
|
|
220
|
-
}), [enableClipboard, showTools, value]);
|
|
221
|
-
// const tools = enableClipboard ? <Copied show={showTools} text={value} /> : undefined;
|
|
222
|
-
var eventProps = {
|
|
223
|
-
className: 'w-rjv-line',
|
|
224
|
-
style: {
|
|
225
|
-
paddingLeft: indentWidth
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
if (enableClipboard) {
|
|
229
|
-
eventProps.onMouseEnter = () => setShowTools(true);
|
|
230
|
-
eventProps.onMouseLeave = () => setShowTools(false);
|
|
231
|
-
}
|
|
232
|
-
if (content && typeof content === 'string') {
|
|
233
|
-
var reView = components.value && components.value({
|
|
234
|
-
className: 'w-rjv-value',
|
|
235
|
-
style: _extends({
|
|
236
|
-
color
|
|
237
|
-
}, style),
|
|
238
|
-
type,
|
|
239
|
-
value,
|
|
240
|
-
setValue,
|
|
241
|
-
data,
|
|
242
|
-
parentValue,
|
|
243
|
-
quotes,
|
|
244
|
-
keyName,
|
|
245
|
-
namespace,
|
|
246
|
-
visible: showTools,
|
|
247
|
-
content,
|
|
248
|
-
children: content
|
|
249
|
-
});
|
|
250
|
-
var valueView = shortenTextAfterLength && type === 'string' ? /*#__PURE__*/_jsx(RenderShortenTextValue, {
|
|
251
|
-
color: color,
|
|
252
|
-
href: isURL ? value.href : '',
|
|
253
|
-
style: style,
|
|
254
|
-
isURL: isURL,
|
|
255
|
-
length: shortenTextAfterLength,
|
|
256
|
-
children: content
|
|
257
|
-
}) : /*#__PURE__*/_jsx(RenderStringValue, {
|
|
258
|
-
color: color,
|
|
259
|
-
href: isURL ? value.href : '',
|
|
260
|
-
style: style,
|
|
261
|
-
isURL: isURL,
|
|
262
|
-
children: content
|
|
263
|
-
});
|
|
264
|
-
return /*#__PURE__*/_jsx(Line, _extends({}, eventProps, {
|
|
265
|
-
children: /*#__PURE__*/_jsxs(Label, _extends({}, reset, {
|
|
266
|
-
ref: null,
|
|
267
|
-
children: [renderKey, /*#__PURE__*/_jsx(Colon, {}), typeView, reView ? reView : valueView, tools]
|
|
268
|
-
}))
|
|
269
|
-
}));
|
|
270
|
-
}
|
|
271
|
-
var empty = /*#__PURE__*/_jsxs(Fragment, {
|
|
272
|
-
children: [/*#__PURE__*/_jsx(Meta, {
|
|
273
|
-
render: components.braces,
|
|
274
|
-
start: true,
|
|
275
|
-
isArray: Array.isArray(value)
|
|
276
|
-
}), /*#__PURE__*/_jsx(Meta, {
|
|
277
|
-
render: components.braces,
|
|
278
|
-
isArray: Array.isArray(value)
|
|
279
|
-
}), countInfo]
|
|
280
|
-
});
|
|
281
|
-
return /*#__PURE__*/_jsx(Line, _extends({}, eventProps, {
|
|
282
|
-
children: /*#__PURE__*/_jsxs(Label, _extends({}, reset, {
|
|
283
|
-
ref: null,
|
|
284
|
-
children: [renderKey, /*#__PURE__*/_jsx(Colon, {}), typeView, empty, tools]
|
|
285
|
-
}))
|
|
286
|
-
}));
|
|
287
|
-
}
|
|
288
|
-
ValueView.displayName = 'JVR.ValueView';
|
|
289
|
-
export var Label = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
290
|
-
var {
|
|
291
|
-
children,
|
|
292
|
-
color,
|
|
293
|
-
fontSize,
|
|
294
|
-
opacity,
|
|
295
|
-
paddingRight,
|
|
296
|
-
style
|
|
297
|
-
} = _ref4,
|
|
298
|
-
reset = _objectWithoutPropertiesLoose(_ref4, _excluded5);
|
|
299
|
-
return /*#__PURE__*/_jsx("span", _extends({
|
|
300
|
-
style: _extends({
|
|
301
|
-
color,
|
|
302
|
-
fontSize,
|
|
303
|
-
opacity,
|
|
304
|
-
paddingRight
|
|
305
|
-
}, style)
|
|
306
|
-
}, reset, {
|
|
307
|
-
ref: ref,
|
|
308
|
-
children: children
|
|
309
|
-
}));
|
|
310
|
-
});
|
|
311
|
-
Label.displayName = 'JVR.Label';
|
|
312
|
-
export var Type = props => {
|
|
313
|
-
var _typeMap$type2, _typeMap$type3;
|
|
314
|
-
var {
|
|
315
|
-
type
|
|
316
|
-
} = props;
|
|
317
|
-
var color = (_typeMap$type2 = typeMap[type]) == null ? void 0 : _typeMap$type2.color;
|
|
318
|
-
var label = (_typeMap$type3 = typeMap[type]) == null ? void 0 : _typeMap$type3.label;
|
|
319
|
-
if (color && label) {
|
|
320
|
-
return /*#__PURE__*/_jsx(Label, {
|
|
321
|
-
color: color,
|
|
322
|
-
fontSize: 11,
|
|
323
|
-
opacity: 0.8,
|
|
324
|
-
paddingRight: 4,
|
|
325
|
-
className: "w-rjv-type",
|
|
326
|
-
"data-type": type,
|
|
327
|
-
children: label
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
Type.displayName = 'JVR.Type';
|