@uiw/react-json-view 2.0.0-alpha.6 → 2.0.0-alpha.8
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 +3 -3
- package/cjs/Container.js +1 -2
- package/cjs/comps/Copied.js +15 -13
- package/cjs/comps/KeyValues.js +3 -6
- package/cjs/comps/NestedClose.js +1 -2
- package/cjs/comps/NestedOpen.js +5 -4
- package/cjs/comps/Value.js +2 -4
- package/cjs/index.js +1 -2
- package/cjs/section/Copied.js +1 -2
- package/cjs/section/CountInfo.js +2 -4
- package/cjs/section/CountInfoExtra.js +2 -4
- package/cjs/section/Ellipsis.js +2 -4
- package/cjs/section/KeyName.js +2 -4
- package/cjs/store/Expands.js +2 -4
- package/cjs/store/Section.js +2 -4
- package/cjs/store/ShowTools.js +2 -4
- package/cjs/store/Symbols.js +2 -4
- package/cjs/store/Types.d.ts +28 -24
- package/cjs/store/Types.js +8 -8
- package/cjs/store.d.ts +7 -4
- package/cjs/store.js +5 -10
- package/cjs/symbol/Arrow.js +1 -2
- package/cjs/symbol/BraceLeft.js +1 -2
- package/cjs/symbol/BraceRight.js +1 -2
- package/cjs/symbol/BracketsLeft.js +1 -2
- package/cjs/symbol/BracketsRight.js +1 -2
- package/cjs/symbol/Colon.js +1 -2
- package/cjs/symbol/Quote.js +1 -2
- package/cjs/symbol/ValueQuote.js +1 -2
- package/cjs/symbol/index.js +6 -12
- package/cjs/theme/basic.js +2 -3
- package/cjs/theme/dark.js +2 -3
- package/cjs/theme/github.dark.js +2 -3
- package/cjs/theme/github.light.js +2 -3
- package/cjs/theme/gruvbox.js +2 -3
- package/cjs/theme/light.js +2 -3
- package/cjs/theme/monokai.js +2 -3
- package/cjs/theme/nord.js +2 -3
- package/cjs/theme/vscode.js +2 -3
- package/cjs/types/Bigint.js +1 -2
- package/cjs/types/Date.js +1 -2
- package/cjs/types/False.js +1 -2
- package/cjs/types/Float.js +1 -2
- package/cjs/types/Int.js +1 -2
- package/cjs/types/Map.js +1 -2
- package/cjs/types/Nan.js +1 -2
- package/cjs/types/Null.js +1 -2
- package/cjs/types/Set.js +1 -2
- package/cjs/types/String.js +1 -2
- package/cjs/types/True.js +1 -2
- package/cjs/types/Undefined.js +1 -2
- package/cjs/types/Url.js +1 -2
- package/cjs/types/index.d.ts +2 -0
- package/cjs/types/index.js +66 -53
- package/esm/comps/Copied.js +14 -11
- package/esm/comps/NestedOpen.js +4 -2
- package/esm/store/Types.d.ts +28 -24
- package/esm/store/Types.js +6 -4
- package/esm/store.d.ts +7 -4
- package/esm/types/index.d.ts +2 -0
- package/esm/types/index.js +53 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -324,13 +324,13 @@ export default function Demo() {
|
|
|
324
324
|
}}
|
|
325
325
|
>
|
|
326
326
|
<JsonView.String
|
|
327
|
-
render={({ children, ...reset }, { type }) => {
|
|
328
|
-
const isImg = /^https?.*\.(jpg|png)$/i.test(
|
|
327
|
+
render={({ children, ...reset }, { type, value, keyName }) => {
|
|
328
|
+
const isImg = /^https?.*\.(jpg|png)$/i.test(value)
|
|
329
329
|
if (type === 'type' && isImg) {
|
|
330
330
|
return <span />
|
|
331
331
|
}
|
|
332
332
|
if (type === 'value' && isImg) {
|
|
333
|
-
return <img {...reset} height="26" src={
|
|
333
|
+
return <img {...reset} height="26" src={value} />
|
|
334
334
|
}
|
|
335
335
|
}}
|
|
336
336
|
/>
|
package/cjs/Container.js
CHANGED
|
@@ -16,7 +16,7 @@ var _KeyValues = require("./comps/KeyValues");
|
|
|
16
16
|
var _ShowTools = require("./store/ShowTools");
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
var _excluded = ["className", "children", "parentValue", "keyid", "level", "value", "initialValue", "keyName"];
|
|
19
|
-
var Container = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
19
|
+
var Container = exports.Container = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
20
20
|
var _props$className = props.className,
|
|
21
21
|
className = _props$className === void 0 ? '' : _props$className,
|
|
22
22
|
children = props.children,
|
|
@@ -60,5 +60,4 @@ var Container = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
60
60
|
})]
|
|
61
61
|
}));
|
|
62
62
|
});
|
|
63
|
-
exports.Container = Container;
|
|
64
63
|
Container.displayName = 'JVR.Container';
|
package/cjs/comps/Copied.js
CHANGED
|
@@ -15,7 +15,7 @@ var _Section = require("../store/Section");
|
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
16
|
var _excluded = ["keyName", "value", "expandKey"],
|
|
17
17
|
_excluded2 = ["as", "render"];
|
|
18
|
-
var Copied = function Copied(props) {
|
|
18
|
+
var Copied = exports.Copied = function Copied(props) {
|
|
19
19
|
var keyName = props.keyName,
|
|
20
20
|
value = props.value,
|
|
21
21
|
expandKey = props.expandKey,
|
|
@@ -35,18 +35,21 @@ var Copied = function Copied(props) {
|
|
|
35
35
|
if (enableClipboard === false || !isShowTools) return null;
|
|
36
36
|
var click = function click(event) {
|
|
37
37
|
event.stopPropagation();
|
|
38
|
-
var copyText =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
|
|
38
|
+
var copyText = '';
|
|
39
|
+
if (typeof value === 'number' && value === Infinity) {
|
|
40
|
+
copyText = 'Infinity';
|
|
41
|
+
} else if (typeof value === 'number' && isNaN(value)) {
|
|
42
|
+
copyText = 'NaN';
|
|
43
|
+
} else if (typeof value === 'bigint') {
|
|
44
|
+
copyText = value + 'n';
|
|
45
|
+
} else if (value instanceof Date) {
|
|
46
|
+
copyText = value.toLocaleString();
|
|
47
|
+
} else {
|
|
48
|
+
copyText = JSON.stringify(value, null, 2);
|
|
49
|
+
}
|
|
50
|
+
onCopied && onCopied(copyText, value);
|
|
51
|
+
setCopied(true);
|
|
47
52
|
navigator.clipboard.writeText(copyText).then(function () {
|
|
48
|
-
onCopied && onCopied(copyText, value);
|
|
49
|
-
setCopied(true);
|
|
50
53
|
var timer = setTimeout(function () {
|
|
51
54
|
setCopied(false);
|
|
52
55
|
clearTimeout(timer);
|
|
@@ -86,5 +89,4 @@ var Copied = function Copied(props) {
|
|
|
86
89
|
})
|
|
87
90
|
}));
|
|
88
91
|
};
|
|
89
|
-
exports.Copied = Copied;
|
|
90
92
|
Copied.displayName = 'JVR.Copied';
|
package/cjs/comps/KeyValues.js
CHANGED
|
@@ -19,7 +19,7 @@ var _Container = require("../Container");
|
|
|
19
19
|
var _symbol = require("../symbol");
|
|
20
20
|
var _useHighlight = require("../utils/useHighlight");
|
|
21
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
var KeyValues = function KeyValues(props) {
|
|
22
|
+
var KeyValues = exports.KeyValues = function KeyValues(props) {
|
|
23
23
|
var _expands$expandKey;
|
|
24
24
|
var value = props.value,
|
|
25
25
|
_props$expandKey = props.expandKey,
|
|
@@ -77,9 +77,8 @@ var KeyValues = function KeyValues(props) {
|
|
|
77
77
|
})
|
|
78
78
|
});
|
|
79
79
|
};
|
|
80
|
-
exports.KeyValues = KeyValues;
|
|
81
80
|
KeyValues.displayName = 'JVR.KeyValues';
|
|
82
|
-
var KayName = function KayName(props) {
|
|
81
|
+
var KayName = exports.KayName = function KayName(props) {
|
|
83
82
|
var keyName = props.keyName,
|
|
84
83
|
value = props.value;
|
|
85
84
|
var _useStore2 = (0, _store.useStore)(),
|
|
@@ -108,9 +107,8 @@ var KayName = function KayName(props) {
|
|
|
108
107
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_symbol.Colon, {})]
|
|
109
108
|
});
|
|
110
109
|
};
|
|
111
|
-
exports.KayName = KayName;
|
|
112
110
|
KayName.displayName = 'JVR.KayName';
|
|
113
|
-
var KeyValuesItem = function KeyValuesItem(props) {
|
|
111
|
+
var KeyValuesItem = exports.KeyValuesItem = function KeyValuesItem(props) {
|
|
114
112
|
var keyName = props.keyName,
|
|
115
113
|
value = props.value,
|
|
116
114
|
parentValue = props.parentValue,
|
|
@@ -156,5 +154,4 @@ var KeyValuesItem = function KeyValuesItem(props) {
|
|
|
156
154
|
})]
|
|
157
155
|
}));
|
|
158
156
|
};
|
|
159
|
-
exports.KeyValuesItem = KeyValuesItem;
|
|
160
157
|
KeyValuesItem.displayName = 'JVR.KeyValuesItem';
|
package/cjs/comps/NestedClose.js
CHANGED
|
@@ -8,7 +8,7 @@ var _store = require("../store");
|
|
|
8
8
|
var _Expands = require("../store/Expands");
|
|
9
9
|
var _symbol = require("../symbol");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
var NestedClose = function NestedClose(props) {
|
|
11
|
+
var NestedClose = exports.NestedClose = function NestedClose(props) {
|
|
12
12
|
var _expands$expandKey;
|
|
13
13
|
var value = props.value,
|
|
14
14
|
expandKey = props.expandKey,
|
|
@@ -34,5 +34,4 @@ var NestedClose = function NestedClose(props) {
|
|
|
34
34
|
})
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
|
-
exports.NestedClose = NestedClose;
|
|
38
37
|
NestedClose.displayName = 'JVR.NestedClose';
|
package/cjs/comps/NestedOpen.js
CHANGED
|
@@ -18,7 +18,7 @@ var _symbol = require("../symbol");
|
|
|
18
18
|
var _Ellipsis = require("../section/Ellipsis");
|
|
19
19
|
var _types = require("../types");
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
var NestedOpen = function NestedOpen(props) {
|
|
21
|
+
var NestedOpen = exports.NestedOpen = function NestedOpen(props) {
|
|
22
22
|
var _expands$expandKey;
|
|
23
23
|
var keyName = props.keyName,
|
|
24
24
|
expandKey = props.expandKey,
|
|
@@ -67,9 +67,11 @@ var NestedOpen = function NestedOpen(props) {
|
|
|
67
67
|
}), (keyName || typeof keyName === 'number') && /*#__PURE__*/(0, _jsxRuntime.jsx)(_KeyValues.KayName, {
|
|
68
68
|
keyName: keyName
|
|
69
69
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_types.SetComp, {
|
|
70
|
-
value: initialValue
|
|
70
|
+
value: initialValue,
|
|
71
|
+
keyName: keyName
|
|
71
72
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_types.MapComp, {
|
|
72
|
-
value: initialValue
|
|
73
|
+
value: initialValue,
|
|
74
|
+
keyName: keyName
|
|
73
75
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_symbol.BracketsOpen, {
|
|
74
76
|
isBrackets: isArray || isMySet
|
|
75
77
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Ellipsis.EllipsisComp, {
|
|
@@ -92,5 +94,4 @@ var NestedOpen = function NestedOpen(props) {
|
|
|
92
94
|
})]
|
|
93
95
|
}));
|
|
94
96
|
};
|
|
95
|
-
exports.NestedOpen = NestedOpen;
|
|
96
97
|
NestedOpen.displayName = 'JVR.NestedOpen';
|
package/cjs/comps/Value.js
CHANGED
|
@@ -8,11 +8,10 @@ exports.isFloat = exports.Value = void 0;
|
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
9
|
var _types = require("../types");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
var isFloat = function isFloat(n) {
|
|
11
|
+
var isFloat = exports.isFloat = function isFloat(n) {
|
|
12
12
|
return Number(n) === n && n % 1 !== 0 || isNaN(n);
|
|
13
13
|
};
|
|
14
|
-
exports.
|
|
15
|
-
var Value = function Value(props) {
|
|
14
|
+
var Value = exports.Value = function Value(props) {
|
|
16
15
|
var value = props.value,
|
|
17
16
|
keyName = props.keyName,
|
|
18
17
|
expandKey = props.expandKey;
|
|
@@ -74,5 +73,4 @@ var Value = function Value(props) {
|
|
|
74
73
|
}
|
|
75
74
|
return null;
|
|
76
75
|
};
|
|
77
|
-
exports.Value = Value;
|
|
78
76
|
Value.displayName = 'JVR.Value';
|
package/cjs/index.js
CHANGED
|
@@ -192,5 +192,4 @@ JsonView.CountInfo = _CountInfo.CountInfo;
|
|
|
192
192
|
JsonView.CountInfoExtra = _CountInfoExtra.CountInfoExtra;
|
|
193
193
|
JsonView.KeyName = _KeyName.KeyName;
|
|
194
194
|
JsonView.displayName = 'JVR.JsonView';
|
|
195
|
-
var _default = JsonView;
|
|
196
|
-
exports["default"] = _default;
|
|
195
|
+
var _default = exports["default"] = JsonView;
|
package/cjs/section/Copied.js
CHANGED
|
@@ -6,12 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Copied = void 0;
|
|
7
7
|
var _Section = require("../store/Section");
|
|
8
8
|
var _useRender = require("../utils/useRender");
|
|
9
|
-
var Copied = function Copied(props) {
|
|
9
|
+
var Copied = exports.Copied = function Copied(props) {
|
|
10
10
|
var _useSectionStore = (0, _Section.useSectionStore)(),
|
|
11
11
|
_useSectionStore$Copi = _useSectionStore.Copied,
|
|
12
12
|
Comp = _useSectionStore$Copi === void 0 ? {} : _useSectionStore$Copi;
|
|
13
13
|
(0, _useRender.useSectionRender)(Comp, props, 'Copied');
|
|
14
14
|
return null;
|
|
15
15
|
};
|
|
16
|
-
exports.Copied = Copied;
|
|
17
16
|
Copied.displayName = 'JVR.Copied';
|
package/cjs/section/CountInfo.js
CHANGED
|
@@ -13,16 +13,15 @@ var _store = require("../store");
|
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
var _excluded = ["value", "keyName"],
|
|
15
15
|
_excluded2 = ["as", "render"];
|
|
16
|
-
var CountInfo = function CountInfo(props) {
|
|
16
|
+
var CountInfo = exports.CountInfo = function CountInfo(props) {
|
|
17
17
|
var _useSectionStore = (0, _Section.useSectionStore)(),
|
|
18
18
|
_useSectionStore$Coun = _useSectionStore.CountInfo,
|
|
19
19
|
Comp = _useSectionStore$Coun === void 0 ? {} : _useSectionStore$Coun;
|
|
20
20
|
(0, _useRender.useSectionRender)(Comp, props, 'CountInfo');
|
|
21
21
|
return null;
|
|
22
22
|
};
|
|
23
|
-
exports.CountInfo = CountInfo;
|
|
24
23
|
CountInfo.displayName = 'JVR.CountInfo';
|
|
25
|
-
var CountInfoComp = function CountInfoComp(props) {
|
|
24
|
+
var CountInfoComp = exports.CountInfoComp = function CountInfoComp(props) {
|
|
26
25
|
var _props$value = props.value,
|
|
27
26
|
value = _props$value === void 0 ? {} : _props$value,
|
|
28
27
|
keyName = props.keyName,
|
|
@@ -53,5 +52,4 @@ var CountInfoComp = function CountInfoComp(props) {
|
|
|
53
52
|
if (child) return child;
|
|
54
53
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Elm, (0, _objectSpread2["default"])({}, elmProps));
|
|
55
54
|
};
|
|
56
|
-
exports.CountInfoComp = CountInfoComp;
|
|
57
55
|
CountInfoComp.displayName = 'JVR.CountInfoComp';
|
|
@@ -12,16 +12,15 @@ var _useRender = require("../utils/useRender");
|
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
var _excluded = ["value", "keyName"],
|
|
14
14
|
_excluded2 = ["as", "render"];
|
|
15
|
-
var CountInfoExtra = function CountInfoExtra(props) {
|
|
15
|
+
var CountInfoExtra = exports.CountInfoExtra = function CountInfoExtra(props) {
|
|
16
16
|
var _useSectionStore = (0, _Section.useSectionStore)(),
|
|
17
17
|
_useSectionStore$Coun = _useSectionStore.CountInfoExtra,
|
|
18
18
|
Comp = _useSectionStore$Coun === void 0 ? {} : _useSectionStore$Coun;
|
|
19
19
|
(0, _useRender.useSectionRender)(Comp, props, 'CountInfoExtra');
|
|
20
20
|
return null;
|
|
21
21
|
};
|
|
22
|
-
exports.CountInfoExtra = CountInfoExtra;
|
|
23
22
|
CountInfoExtra.displayName = 'JVR.CountInfoExtra';
|
|
24
|
-
var CountInfoExtraComps = function CountInfoExtraComps(props) {
|
|
23
|
+
var CountInfoExtraComps = exports.CountInfoExtraComps = function CountInfoExtraComps(props) {
|
|
25
24
|
var _props$value = props.value,
|
|
26
25
|
value = _props$value === void 0 ? {} : _props$value,
|
|
27
26
|
keyName = props.keyName,
|
|
@@ -43,5 +42,4 @@ var CountInfoExtraComps = function CountInfoExtraComps(props) {
|
|
|
43
42
|
if (child) return child;
|
|
44
43
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Elm, (0, _objectSpread2["default"])({}, elmProps));
|
|
45
44
|
};
|
|
46
|
-
exports.CountInfoExtraComps = CountInfoExtraComps;
|
|
47
45
|
CountInfoExtraComps.displayName = 'JVR.CountInfoExtraComps';
|
package/cjs/section/Ellipsis.js
CHANGED
|
@@ -11,16 +11,15 @@ var _Section = require("../store/Section");
|
|
|
11
11
|
var _useRender = require("../utils/useRender");
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
var _excluded = ["as", "render"];
|
|
14
|
-
var Ellipsis = function Ellipsis(props) {
|
|
14
|
+
var Ellipsis = exports.Ellipsis = function Ellipsis(props) {
|
|
15
15
|
var _useSectionStore = (0, _Section.useSectionStore)(),
|
|
16
16
|
_useSectionStore$Elli = _useSectionStore.Ellipsis,
|
|
17
17
|
Comp = _useSectionStore$Elli === void 0 ? {} : _useSectionStore$Elli;
|
|
18
18
|
(0, _useRender.useSectionRender)(Comp, props, 'Ellipsis');
|
|
19
19
|
return null;
|
|
20
20
|
};
|
|
21
|
-
exports.Ellipsis = Ellipsis;
|
|
22
21
|
Ellipsis.displayName = 'JVR.Ellipsis';
|
|
23
|
-
var EllipsisComp = function EllipsisComp(_ref) {
|
|
22
|
+
var EllipsisComp = exports.EllipsisComp = function EllipsisComp(_ref) {
|
|
24
23
|
var isExpanded = _ref.isExpanded,
|
|
25
24
|
value = _ref.value,
|
|
26
25
|
keyName = _ref.keyName;
|
|
@@ -41,5 +40,4 @@ var EllipsisComp = function EllipsisComp(_ref) {
|
|
|
41
40
|
if (!isExpanded) return null;
|
|
42
41
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Elm, (0, _objectSpread2["default"])({}, reset));
|
|
43
42
|
};
|
|
44
|
-
exports.EllipsisComp = EllipsisComp;
|
|
45
43
|
EllipsisComp.displayName = 'JVR.EllipsisComp';
|
package/cjs/section/KeyName.js
CHANGED
|
@@ -11,16 +11,15 @@ var _Section = require("../store/Section");
|
|
|
11
11
|
var _useRender = require("../utils/useRender");
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
var _excluded = ["as", "render"];
|
|
14
|
-
var KeyName = function KeyName(props) {
|
|
14
|
+
var KeyName = exports.KeyName = function KeyName(props) {
|
|
15
15
|
var _useSectionStore = (0, _Section.useSectionStore)(),
|
|
16
16
|
_useSectionStore$KeyN = _useSectionStore.KeyName,
|
|
17
17
|
Comp = _useSectionStore$KeyN === void 0 ? {} : _useSectionStore$KeyN;
|
|
18
18
|
(0, _useRender.useSectionRender)(Comp, props, 'KeyName');
|
|
19
19
|
return null;
|
|
20
20
|
};
|
|
21
|
-
exports.KeyName = KeyName;
|
|
22
21
|
KeyName.displayName = 'JVR.KeyName';
|
|
23
|
-
var KeyNameComp = function KeyNameComp(props) {
|
|
22
|
+
var KeyNameComp = exports.KeyNameComp = function KeyNameComp(props) {
|
|
24
23
|
var children = props.children,
|
|
25
24
|
value = props.value,
|
|
26
25
|
keyName = props.keyName;
|
|
@@ -47,5 +46,4 @@ var KeyNameComp = function KeyNameComp(props) {
|
|
|
47
46
|
children: children
|
|
48
47
|
}));
|
|
49
48
|
};
|
|
50
|
-
exports.KeyNameComp = KeyNameComp;
|
|
51
49
|
KeyNameComp.displayName = 'JVR.KeyNameComp';
|
package/cjs/store/Expands.js
CHANGED
|
@@ -16,10 +16,9 @@ var Context = /*#__PURE__*/(0, _react.createContext)(initialState);
|
|
|
16
16
|
var reducer = function reducer(state, action) {
|
|
17
17
|
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), action);
|
|
18
18
|
};
|
|
19
|
-
var useExpandsStore = function useExpandsStore() {
|
|
19
|
+
var useExpandsStore = exports.useExpandsStore = function useExpandsStore() {
|
|
20
20
|
return (0, _react.useContext)(Context);
|
|
21
21
|
};
|
|
22
|
-
exports.useExpandsStore = useExpandsStore;
|
|
23
22
|
var DispatchExpands = /*#__PURE__*/(0, _react.createContext)(function () {});
|
|
24
23
|
DispatchExpands.displayName = 'JVR.DispatchExpands';
|
|
25
24
|
function useExpands() {
|
|
@@ -28,7 +27,7 @@ function useExpands() {
|
|
|
28
27
|
function useExpandsDispatch() {
|
|
29
28
|
return (0, _react.useContext)(DispatchExpands);
|
|
30
29
|
}
|
|
31
|
-
var Expands = function Expands(_ref) {
|
|
30
|
+
var Expands = exports.Expands = function Expands(_ref) {
|
|
32
31
|
var initial = _ref.initial,
|
|
33
32
|
dispatch = _ref.dispatch,
|
|
34
33
|
children = _ref.children;
|
|
@@ -40,5 +39,4 @@ var Expands = function Expands(_ref) {
|
|
|
40
39
|
})
|
|
41
40
|
});
|
|
42
41
|
};
|
|
43
|
-
exports.Expands = Expands;
|
|
44
42
|
Expands.displayName = 'JVR.Expands';
|
package/cjs/store/Section.js
CHANGED
|
@@ -58,10 +58,9 @@ var Context = /*#__PURE__*/(0, _react.createContext)(initialState);
|
|
|
58
58
|
var reducer = function reducer(state, action) {
|
|
59
59
|
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), action);
|
|
60
60
|
};
|
|
61
|
-
var useSectionStore = function useSectionStore() {
|
|
61
|
+
var useSectionStore = exports.useSectionStore = function useSectionStore() {
|
|
62
62
|
return (0, _react.useContext)(Context);
|
|
63
63
|
};
|
|
64
|
-
exports.useSectionStore = useSectionStore;
|
|
65
64
|
var DispatchSection = /*#__PURE__*/(0, _react.createContext)(function () {});
|
|
66
65
|
DispatchSection.displayName = 'JVR.DispatchSection';
|
|
67
66
|
function useSection() {
|
|
@@ -70,7 +69,7 @@ function useSection() {
|
|
|
70
69
|
function useSectionDispatch() {
|
|
71
70
|
return (0, _react.useContext)(DispatchSection);
|
|
72
71
|
}
|
|
73
|
-
var Section = function Section(_ref) {
|
|
72
|
+
var Section = exports.Section = function Section(_ref) {
|
|
74
73
|
var initial = _ref.initial,
|
|
75
74
|
dispatch = _ref.dispatch,
|
|
76
75
|
children = _ref.children;
|
|
@@ -82,5 +81,4 @@ var Section = function Section(_ref) {
|
|
|
82
81
|
})
|
|
83
82
|
});
|
|
84
83
|
};
|
|
85
|
-
exports.Section = Section;
|
|
86
84
|
Section.displayName = 'JVR.Section';
|
package/cjs/store/ShowTools.js
CHANGED
|
@@ -16,10 +16,9 @@ var Context = /*#__PURE__*/(0, _react.createContext)(initialState);
|
|
|
16
16
|
var reducer = function reducer(state, action) {
|
|
17
17
|
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), action);
|
|
18
18
|
};
|
|
19
|
-
var useShowToolsStore = function useShowToolsStore() {
|
|
19
|
+
var useShowToolsStore = exports.useShowToolsStore = function useShowToolsStore() {
|
|
20
20
|
return (0, _react.useContext)(Context);
|
|
21
21
|
};
|
|
22
|
-
exports.useShowToolsStore = useShowToolsStore;
|
|
23
22
|
var DispatchShowTools = /*#__PURE__*/(0, _react.createContext)(function () {});
|
|
24
23
|
DispatchShowTools.displayName = 'JVR.DispatchShowTools';
|
|
25
24
|
function useShowTools() {
|
|
@@ -28,7 +27,7 @@ function useShowTools() {
|
|
|
28
27
|
function useShowToolsDispatch() {
|
|
29
28
|
return (0, _react.useContext)(DispatchShowTools);
|
|
30
29
|
}
|
|
31
|
-
var ShowTools = function ShowTools(_ref) {
|
|
30
|
+
var ShowTools = exports.ShowTools = function ShowTools(_ref) {
|
|
32
31
|
var initial = _ref.initial,
|
|
33
32
|
dispatch = _ref.dispatch,
|
|
34
33
|
children = _ref.children;
|
|
@@ -40,5 +39,4 @@ var ShowTools = function ShowTools(_ref) {
|
|
|
40
39
|
})
|
|
41
40
|
});
|
|
42
41
|
};
|
|
43
|
-
exports.ShowTools = ShowTools;
|
|
44
42
|
ShowTools.displayName = 'JVR.ShowTools';
|
package/cjs/store/Symbols.js
CHANGED
|
@@ -85,10 +85,9 @@ var Context = /*#__PURE__*/(0, _react.createContext)(initialState);
|
|
|
85
85
|
var reducer = function reducer(state, action) {
|
|
86
86
|
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), action);
|
|
87
87
|
};
|
|
88
|
-
var useSymbolsStore = function useSymbolsStore() {
|
|
88
|
+
var useSymbolsStore = exports.useSymbolsStore = function useSymbolsStore() {
|
|
89
89
|
return (0, _react.useContext)(Context);
|
|
90
90
|
};
|
|
91
|
-
exports.useSymbolsStore = useSymbolsStore;
|
|
92
91
|
var DispatchSymbols = /*#__PURE__*/(0, _react.createContext)(function () {});
|
|
93
92
|
DispatchSymbols.displayName = 'JVR.DispatchSymbols';
|
|
94
93
|
function useSymbols() {
|
|
@@ -97,7 +96,7 @@ function useSymbols() {
|
|
|
97
96
|
function useSymbolsDispatch() {
|
|
98
97
|
return (0, _react.useContext)(DispatchSymbols);
|
|
99
98
|
}
|
|
100
|
-
var Symbols = function Symbols(_ref) {
|
|
99
|
+
var Symbols = exports.Symbols = function Symbols(_ref) {
|
|
101
100
|
var initial = _ref.initial,
|
|
102
101
|
dispatch = _ref.dispatch,
|
|
103
102
|
children = _ref.children;
|
|
@@ -109,5 +108,4 @@ var Symbols = function Symbols(_ref) {
|
|
|
109
108
|
})
|
|
110
109
|
});
|
|
111
110
|
};
|
|
112
|
-
exports.Symbols = Symbols;
|
|
113
111
|
Symbols.displayName = 'JVR.Symbols';
|
package/cjs/store/Types.d.ts
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PropsWithChildren, ComponentPropsWithoutRef } from 'react';
|
|
2
2
|
export type TagType = React.ElementType | keyof JSX.IntrinsicElements;
|
|
3
|
-
type TypesElementProps<T extends TagType> = {
|
|
3
|
+
type TypesElementProps<T extends TagType = 'span'> = {
|
|
4
4
|
as?: T;
|
|
5
5
|
render?: (props: TypesElement<T>, result: {
|
|
6
6
|
type: 'type' | 'value';
|
|
7
7
|
value?: unknown;
|
|
8
|
+
keyName: string | number;
|
|
8
9
|
}) => React.ReactNode;
|
|
9
10
|
'data-type'?: string;
|
|
10
11
|
};
|
|
11
12
|
export type TypesElement<T extends TagType> = TypesElementProps<T> & ComponentPropsWithoutRef<T>;
|
|
12
|
-
export type InitialTypesState = {
|
|
13
|
+
export type InitialTypesState<T extends TagType = 'span'> = {
|
|
13
14
|
displayDataTypes?: boolean;
|
|
14
|
-
Url?: TypesElement<
|
|
15
|
-
Str?: TypesElement<
|
|
16
|
-
Undefined?: TypesElement<
|
|
17
|
-
Null?: TypesElement<
|
|
18
|
-
True?: TypesElement<
|
|
19
|
-
False?: TypesElement<
|
|
20
|
-
Date?: TypesElement<
|
|
21
|
-
Float?: TypesElement<
|
|
22
|
-
Set?: TypesElement<
|
|
23
|
-
Int?: TypesElement<
|
|
24
|
-
Map?: TypesElement<
|
|
25
|
-
Nan?: TypesElement<
|
|
26
|
-
Bigint?: TypesElement<
|
|
15
|
+
Url?: TypesElement<T>;
|
|
16
|
+
Str?: TypesElement<T>;
|
|
17
|
+
Undefined?: TypesElement<T>;
|
|
18
|
+
Null?: TypesElement<T>;
|
|
19
|
+
True?: TypesElement<T>;
|
|
20
|
+
False?: TypesElement<T>;
|
|
21
|
+
Date?: TypesElement<T>;
|
|
22
|
+
Float?: TypesElement<T>;
|
|
23
|
+
Set?: TypesElement<T>;
|
|
24
|
+
Int?: TypesElement<T>;
|
|
25
|
+
Map?: TypesElement<T>;
|
|
26
|
+
Nan?: TypesElement<T>;
|
|
27
|
+
Bigint?: TypesElement<T>;
|
|
27
28
|
};
|
|
28
|
-
type Dispatch = React.Dispatch<InitialTypesState
|
|
29
|
-
export declare const useTypesStore: () => InitialTypesState
|
|
29
|
+
type Dispatch<T extends TagType> = React.Dispatch<InitialTypesState<T>>;
|
|
30
|
+
export declare const useTypesStore: () => InitialTypesState<TagType>;
|
|
30
31
|
export declare function useTypes(): [{
|
|
31
32
|
displayDataTypes?: boolean | undefined;
|
|
32
33
|
Url?: TypesElement<TagType> | undefined;
|
|
@@ -42,11 +43,14 @@ export declare function useTypes(): [{
|
|
|
42
43
|
Map?: TypesElement<TagType> | undefined;
|
|
43
44
|
Nan?: TypesElement<TagType> | undefined;
|
|
44
45
|
Bigint?: TypesElement<TagType> | undefined;
|
|
45
|
-
}, import("react").Dispatch<InitialTypesState
|
|
46
|
-
export declare function useTypesDispatch(): Dispatch
|
|
47
|
-
interface TypesProps {
|
|
48
|
-
initial: InitialTypesState
|
|
49
|
-
dispatch: Dispatch
|
|
46
|
+
}, import("react").Dispatch<InitialTypesState<TagType>>];
|
|
47
|
+
export declare function useTypesDispatch(): Dispatch<TagType>;
|
|
48
|
+
interface TypesProps<T extends TagType> {
|
|
49
|
+
initial: InitialTypesState<T>;
|
|
50
|
+
dispatch: Dispatch<TagType>;
|
|
51
|
+
}
|
|
52
|
+
export declare function Types<T extends TagType>({ initial, dispatch, children }: PropsWithChildren<TypesProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
export declare namespace Types {
|
|
54
|
+
var displayName: string;
|
|
50
55
|
}
|
|
51
|
-
export declare const Types: FC<PropsWithChildren<TypesProps>>;
|
|
52
56
|
export {};
|
package/cjs/store/Types.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.Types =
|
|
7
|
+
exports.Types = Types;
|
|
8
8
|
exports.useTypes = useTypes;
|
|
9
9
|
exports.useTypesDispatch = useTypesDispatch;
|
|
10
10
|
exports.useTypesStore = void 0;
|
|
@@ -50,7 +50,8 @@ var initialState = {
|
|
|
50
50
|
},
|
|
51
51
|
Map: {
|
|
52
52
|
style: {
|
|
53
|
-
color: 'var(--w-rjv-type-map-color, #268bd2)'
|
|
53
|
+
color: 'var(--w-rjv-type-map-color, #268bd2)',
|
|
54
|
+
marginRight: 3
|
|
54
55
|
},
|
|
55
56
|
as: 'span',
|
|
56
57
|
'data-type': 'map',
|
|
@@ -86,7 +87,8 @@ var initialState = {
|
|
|
86
87
|
},
|
|
87
88
|
Set: {
|
|
88
89
|
style: {
|
|
89
|
-
color: 'var(--w-rjv-type-set-color, #268bd2)'
|
|
90
|
+
color: 'var(--w-rjv-type-set-color, #268bd2)',
|
|
91
|
+
marginRight: 3
|
|
90
92
|
},
|
|
91
93
|
as: 'span',
|
|
92
94
|
'data-type': 'set',
|
|
@@ -134,10 +136,9 @@ var Context = /*#__PURE__*/(0, _react.createContext)(initialState);
|
|
|
134
136
|
var reducer = function reducer(state, action) {
|
|
135
137
|
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), action);
|
|
136
138
|
};
|
|
137
|
-
var useTypesStore = function useTypesStore() {
|
|
139
|
+
var useTypesStore = exports.useTypesStore = function useTypesStore() {
|
|
138
140
|
return (0, _react.useContext)(Context);
|
|
139
141
|
};
|
|
140
|
-
exports.useTypesStore = useTypesStore;
|
|
141
142
|
var DispatchTypes = /*#__PURE__*/(0, _react.createContext)(function () {});
|
|
142
143
|
DispatchTypes.displayName = 'JVR.DispatchTypes';
|
|
143
144
|
function useTypes() {
|
|
@@ -146,7 +147,7 @@ function useTypes() {
|
|
|
146
147
|
function useTypesDispatch() {
|
|
147
148
|
return (0, _react.useContext)(DispatchTypes);
|
|
148
149
|
}
|
|
149
|
-
|
|
150
|
+
function Types(_ref) {
|
|
150
151
|
var initial = _ref.initial,
|
|
151
152
|
dispatch = _ref.dispatch,
|
|
152
153
|
children = _ref.children;
|
|
@@ -157,6 +158,5 @@ var Types = function Types(_ref) {
|
|
|
157
158
|
children: children
|
|
158
159
|
})
|
|
159
160
|
});
|
|
160
|
-
}
|
|
161
|
-
exports.Types = Types;
|
|
161
|
+
}
|
|
162
162
|
Types.displayName = 'JVR.Types';
|
package/cjs/store.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
2
|
import { JsonViewProps } from './';
|
|
3
|
-
import { type InitialTypesState } from './store/Types';
|
|
3
|
+
import { type InitialTypesState, type TagType } from './store/Types';
|
|
4
4
|
export type BlockTagType = keyof JSX.IntrinsicElements;
|
|
5
5
|
export interface InitialState<T extends object> {
|
|
6
6
|
value?: object;
|
|
@@ -20,10 +20,13 @@ export declare const Context: React.Context<InitialState<object>>;
|
|
|
20
20
|
export declare function reducer(state: InitialState<object>, action: InitialState<object>): InitialState<object>;
|
|
21
21
|
export declare const useStore: () => InitialState<object>;
|
|
22
22
|
export declare const useDispatchStore: () => Dispatch;
|
|
23
|
-
export interface ProviderProps {
|
|
23
|
+
export interface ProviderProps<T extends TagType> {
|
|
24
24
|
initialState?: InitialState<object>;
|
|
25
|
-
initialTypes?: InitialTypesState
|
|
25
|
+
initialTypes?: InitialTypesState<T>;
|
|
26
26
|
}
|
|
27
|
-
export declare const Provider:
|
|
27
|
+
export declare const Provider: {
|
|
28
|
+
<T extends TagType>({ children, initialState: init, initialTypes, }: React.PropsWithChildren<ProviderProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
displayName: string;
|
|
30
|
+
};
|
|
28
31
|
export declare function useDispatch(): Dispatch;
|
|
29
32
|
export {};
|
package/cjs/store.js
CHANGED
|
@@ -18,28 +18,24 @@ var _Types = require("./store/Types");
|
|
|
18
18
|
var _Symbols = require("./store/Symbols");
|
|
19
19
|
var _Section = require("./store/Section");
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
var initialState = {
|
|
21
|
+
var initialState = exports.initialState = {
|
|
22
22
|
objectSortKeys: false,
|
|
23
23
|
indentWidth: 15
|
|
24
24
|
};
|
|
25
|
-
exports.
|
|
26
|
-
var Context = /*#__PURE__*/(0, _react.createContext)(initialState);
|
|
27
|
-
exports.Context = Context;
|
|
25
|
+
var Context = exports.Context = /*#__PURE__*/(0, _react.createContext)(initialState);
|
|
28
26
|
Context.displayName = 'JVR.Context';
|
|
29
27
|
var DispatchContext = /*#__PURE__*/(0, _react.createContext)(function () {});
|
|
30
28
|
DispatchContext.displayName = 'JVR.DispatchContext';
|
|
31
29
|
function reducer(state, action) {
|
|
32
30
|
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), action);
|
|
33
31
|
}
|
|
34
|
-
var useStore = function useStore() {
|
|
32
|
+
var useStore = exports.useStore = function useStore() {
|
|
35
33
|
return (0, _react.useContext)(Context);
|
|
36
34
|
};
|
|
37
|
-
exports.
|
|
38
|
-
var useDispatchStore = function useDispatchStore() {
|
|
35
|
+
var useDispatchStore = exports.useDispatchStore = function useDispatchStore() {
|
|
39
36
|
return (0, _react.useContext)(DispatchContext);
|
|
40
37
|
};
|
|
41
|
-
exports.
|
|
42
|
-
var Provider = function Provider(_ref) {
|
|
38
|
+
var Provider = exports.Provider = function Provider(_ref) {
|
|
43
39
|
var children = _ref.children,
|
|
44
40
|
init = _ref.initialState,
|
|
45
41
|
initialTypes = _ref.initialTypes;
|
|
@@ -98,7 +94,6 @@ var Provider = function Provider(_ref) {
|
|
|
98
94
|
})
|
|
99
95
|
});
|
|
100
96
|
};
|
|
101
|
-
exports.Provider = Provider;
|
|
102
97
|
function useDispatch() {
|
|
103
98
|
return (0, _react.useContext)(DispatchContext);
|
|
104
99
|
}
|
package/cjs/symbol/Arrow.js
CHANGED
|
@@ -6,12 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Arrow = void 0;
|
|
7
7
|
var _Symbols = require("../store/Symbols");
|
|
8
8
|
var _useRender = require("../utils/useRender");
|
|
9
|
-
var Arrow = function Arrow(props) {
|
|
9
|
+
var Arrow = exports.Arrow = function Arrow(props) {
|
|
10
10
|
var _useSymbolsStore = (0, _Symbols.useSymbolsStore)(),
|
|
11
11
|
_useSymbolsStore$Arro = _useSymbolsStore.Arrow,
|
|
12
12
|
Comp = _useSymbolsStore$Arro === void 0 ? {} : _useSymbolsStore$Arro;
|
|
13
13
|
(0, _useRender.useSymbolsRender)(Comp, props, 'Arrow');
|
|
14
14
|
return null;
|
|
15
15
|
};
|
|
16
|
-
exports.Arrow = Arrow;
|
|
17
16
|
Arrow.displayName = 'JVR.Arrow';
|
package/cjs/symbol/BraceLeft.js
CHANGED
|
@@ -6,12 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.BraceLeft = void 0;
|
|
7
7
|
var _Symbols = require("../store/Symbols");
|
|
8
8
|
var _useRender = require("../utils/useRender");
|
|
9
|
-
var BraceLeft = function BraceLeft(props) {
|
|
9
|
+
var BraceLeft = exports.BraceLeft = function BraceLeft(props) {
|
|
10
10
|
var _useSymbolsStore = (0, _Symbols.useSymbolsStore)(),
|
|
11
11
|
_useSymbolsStore$Brac = _useSymbolsStore.BraceLeft,
|
|
12
12
|
Comp = _useSymbolsStore$Brac === void 0 ? {} : _useSymbolsStore$Brac;
|
|
13
13
|
(0, _useRender.useSymbolsRender)(Comp, props, 'BraceLeft');
|
|
14
14
|
return null;
|
|
15
15
|
};
|
|
16
|
-
exports.BraceLeft = BraceLeft;
|
|
17
16
|
BraceLeft.displayName = 'JVR.BraceLeft';
|