@uiw/react-json-view 2.0.0-alpha.42 → 2.0.0-alpha.43

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 (49) hide show
  1. package/README.md +48 -30
  2. package/esm/Container.js +11 -9
  3. package/esm/arrow/TriangleArrow.js +1 -3
  4. package/esm/arrow/TriangleSolidArrow.js +1 -3
  5. package/esm/comps/Copied.js +18 -20
  6. package/esm/comps/KeyValues.js +34 -35
  7. package/esm/comps/NestedClose.js +10 -12
  8. package/esm/comps/NestedOpen.js +12 -14
  9. package/esm/comps/Value.js +3 -5
  10. package/esm/editor/KeyName.js +12 -16
  11. package/esm/editor/index.js +9 -8
  12. package/esm/index.js +26 -19
  13. package/esm/section/Copied.js +3 -3
  14. package/esm/section/CountInfo.js +13 -17
  15. package/esm/section/CountInfoExtra.js +11 -14
  16. package/esm/section/Ellipsis.js +11 -15
  17. package/esm/section/KeyName.js +13 -17
  18. package/esm/section/Row.js +14 -17
  19. package/esm/store/Expands.js +3 -5
  20. package/esm/store/Section.js +3 -5
  21. package/esm/store/ShowTools.js +3 -5
  22. package/esm/store/Symbols.js +3 -5
  23. package/esm/store/Types.js +3 -5
  24. package/esm/store.js +21 -11
  25. package/esm/symbol/Arrow.js +3 -3
  26. package/esm/symbol/BraceLeft.js +3 -3
  27. package/esm/symbol/BraceRight.js +3 -3
  28. package/esm/symbol/BracketsLeft.js +3 -3
  29. package/esm/symbol/BracketsRight.js +3 -3
  30. package/esm/symbol/Colon.js +3 -3
  31. package/esm/symbol/Quote.js +3 -3
  32. package/esm/symbol/ValueQuote.js +3 -3
  33. package/esm/symbol/index.js +65 -89
  34. package/esm/types/Bigint.js +3 -3
  35. package/esm/types/Date.js +3 -3
  36. package/esm/types/False.js +3 -3
  37. package/esm/types/Float.js +3 -3
  38. package/esm/types/Int.js +3 -3
  39. package/esm/types/Map.js +3 -3
  40. package/esm/types/Nan.js +3 -3
  41. package/esm/types/Null.js +3 -3
  42. package/esm/types/Set.js +3 -3
  43. package/esm/types/String.js +3 -3
  44. package/esm/types/True.js +3 -3
  45. package/esm/types/Undefined.js +3 -3
  46. package/esm/types/Url.js +3 -3
  47. package/esm/types/index.js +124 -172
  48. package/esm/utils/useHighlight.js +3 -5
  49. package/package.json +1 -1
package/README.md CHANGED
@@ -1,38 +1,56 @@
1
+ <div align="center" markdown="1">
2
+ <sup>Special thanks to:</sup>
3
+ <br>
4
+ <br>
5
+
6
+ <a href="https://apps.apple.com/app/apple-store/id6757860829?pt=80185800&ct=jay&mt=8">
7
+ <img alt="SubList" width="400" src="https://jaywcjlove.github.io/sponsor/SubList.jpg">
8
+ </a>
9
+ <br>
10
+ <a href="https://apps.apple.com/app/apple-store/id6757860829?pt=80185800&ct=jay&mt=8">
11
+ SubList - Bill Reminder & Renewal Alerts
12
+ </a>
13
+ <br><br>
14
+
15
+ </div>
16
+ <hr>
17
+
1
18
  <div markdown="1">
2
19
  <sup>Using <a href="https://wangchujiang.com/#/app" target="_blank">my app</a> is also a way to <a href="https://wangchujiang.com/#/sponsor" target="_blank">support</a> me:</sup>
3
20
  <br>
4
- <a target="_blank" href="https://apps.apple.com/app/6758053530" title="Scap: Screenshot & Markup Edit for macOS"><img alt="Scap: Screenshot & Markup Edit" height="52" src="https://wangchujiang.com/appicon/scap.png"></a>
5
- <a target="_blank" href="https://apps.apple.com/app/6757317079" title="Screen Test for macOS"><img alt="Screen Test" height="52" src="https://wangchujiang.com/appicon/screen-test.png"></a>
6
- <a target="_blank" href="https://apps.apple.com/app/Deskmark/6755948110" title="Deskmark for macOS"><img alt="Deskmark" height="52" src="https://wangchujiang.com/appicon/deskmark.png"></a>
7
- <a target="_blank" href="https://apps.apple.com/app/Keyzer/6500434773" title="Keyzer for macOS"><img alt="Keyzer" height="52" src="https://wangchujiang.com/appicon/keyzer.png"></a>
21
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6766860898" title="Zipora: Zip/RAR/7Z Unarchiver"><img alt="Zipora: Zip/RAR/7Z Unarchiver" height="52" src="https://wangchujiang.com/appicon/zipora.png"></a>
22
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6758053530" title="Scap: Screenshot & Markup Edit for macOS"><img alt="Scap: Screenshot & Markup Edit" height="52" src="https://wangchujiang.com/appicon/scap.png"></a>
23
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6757317079" title="Screen Test for macOS"><img alt="Screen Test" height="52" src="https://wangchujiang.com/appicon/screen-test.png"></a>
24
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6755948110" title="Deskmark for macOS"><img alt="Deskmark" height="52" src="https://wangchujiang.com/appicon/deskmark.png"></a>
25
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6500434773" title="Keyzer for macOS"><img alt="Keyzer" height="52" src="https://wangchujiang.com/appicon/keyzer.png"></a>
8
26
  <a target="_blank" href="https://github.com/jaywcjlove/vidwall-hub" title="Vidwall Hub for macOS"><img alt="Vidwall Hub" height="52" src="https://wangchujiang.com/appicon/vidwall-hub.png"></a>
9
- <a target="_blank" href="https://apps.apple.com/app/VidCrop/6752624705" title="VidCrop for macOS"><img alt="VidCrop" height="52" src="https://wangchujiang.com/appicon/vidcrop.png"></a>
10
- <a target="_blank" href="https://apps.apple.com/app/Vidwall/6747587746" title="Vidwall for macOS"><img alt="Vidwall" height="52" src="https://wangchujiang.com/appicon/vidwall.png"></a>
27
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6752624705" title="VidCrop for macOS"><img alt="VidCrop" height="52" src="https://wangchujiang.com/appicon/vidcrop.png"></a>
28
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6747587746" title="Vidwall for macOS"><img alt="Vidwall" height="52" src="https://wangchujiang.com/appicon/vidwall.png"></a>
11
29
  <a target="_blank" href="https://wangchujiang.com/mousio-hint/" title="Mousio Hint for macOS"><img alt="Mousio Hint" height="52" src="https://wangchujiang.com/appicon/mousio-hint.png"></a>
12
- <a target="_blank" href="https://apps.apple.com/app/6746747327" title="Mousio for macOS"><img alt="Mousio" height="52" src="https://wangchujiang.com/appicon/mousio.png"></a>
13
- <a target="_blank" href="https://apps.apple.com/app/6745227444" title="Musicer for macOS"><img alt="Musicer" height="52" src="https://wangchujiang.com/appicon/musicer.png"></a>
14
- <a target="_blank" href="https://apps.apple.com/app/6743841447" title="Audioer for macOS"><img alt="Audioer" height="52" src="https://wangchujiang.com/appicon/audioer.png"></a>
15
- <a target="_blank" href="https://apps.apple.com/app/6744690194" title="FileSentinel for macOS"><img alt="FileSentinel" height="52" src="https://wangchujiang.com/appicon/file-sentinel.png"></a>
16
- <a target="_blank" href="https://apps.apple.com/app/6743495172" title="FocusCursor for macOS"><img alt="FocusCursor" height="52" src="https://wangchujiang.com/appicon/focus-cursor.png"></a>
17
- <a target="_blank" href="https://apps.apple.com/app/6742680573" title="Videoer for macOS"><img alt="Videoer" height="52" src="https://wangchujiang.com/appicon/videoer.png"></a>
18
- <a target="_blank" href="https://apps.apple.com/app/6740425504" title="KeyClicker for macOS"><img alt="KeyClicker" height="52" src="https://wangchujiang.com/appicon/key-clicker.png"></a>
19
- <a target="_blank" href="https://apps.apple.com/app/6739052447" title="DayBar for macOS"><img alt="DayBar" height="52" src="https://wangchujiang.com/appicon/daybar.png"></a>
20
- <a target="_blank" href="https://apps.apple.com/app/6739444407" title="Iconed for macOS"><img alt="Iconed" height="52" src="https://wangchujiang.com/appicon/iconed.png"></a>
21
- <a target="_blank" href="https://apps.apple.com/app/6737160756" title="Menuist for macOS"><img alt="Menuist" height="52" src="https://wangchujiang.com/appicon/rightmenu-master.png"></a>
22
- <a target="_blank" href="https://apps.apple.com/app/6723903021" title="Paste Quick for macOS"><img alt="Quick RSS" height="52" src="https://wangchujiang.com/appicon/paste-quick.png"></a>
23
- <a target="_blank" href="https://apps.apple.com/app/6670696072?platform=mac" title="Quick RSS for macOS/iOS"><img alt="Quick RSS" height="52" src="https://wangchujiang.com/appicon/quick-rss.png"></a>
24
- <a target="_blank" href="https://apps.apple.com/app/6670167443" title="Web Serve for macOS"><img alt="Web Serve" height="52" src="https://wangchujiang.com/appicon/web-serve.png"></a>
25
- <a target="_blank" href="https://apps.apple.com/app/6503953628?platform=mac" title="Copybook Generator for macOS/iOS"><img alt="Copybook Generator" height="52" src="https://wangchujiang.com/appicon/copybook-generator.png"></a>
26
- <a target="_blank" href="https://apps.apple.com/app/6471227008?platform=mac" title="DevTutor for macOS/iOS"><img alt="DevTutor for SwiftUI" height="52" src="https://wangchujiang.com/appicon/devtutor.png"></a>
27
- <a target="_blank" href="https://apps.apple.com/app/6479819388?platform=mac" title="RegexMate for macOS/iOS"><img alt="RegexMate" height="52" src="https://wangchujiang.com/appicon/regex-mate.png"></a>
28
- <a target="_blank" href="https://apps.apple.com/app/6479194014?platform=mac" title="Time Passage for macOS/iOS"><img alt="Time Passage" height="52" src="https://wangchujiang.com/appicon/time-passage.png"></a>
29
- <a target="_blank" href="https://apps.apple.com/app/6478772538" title="IconizeFolder for macOS"><img alt="Iconize Folder" height="52" src="https://wangchujiang.com/appicon/iconize-folder.png"></a>
30
- <a target="_blank" href="https://apps.apple.com/app/6478511402?platform=mac" title="Textsound Saver for macOS/iOS"><img alt="Textsound Saver" height="52" src="https://wangchujiang.com/appicon/textsound-saver.png"></a>
31
- <a target="_blank" href="https://apps.apple.com/app/6476924627" title="Create Custom Symbols for macOS"><img alt="Create Custom Symbols" height="52" src="https://wangchujiang.com/appicon/create-custom-symbols.png"></a>
32
- <a target="_blank" href="https://apps.apple.com/app/6476452351" title="DevHub for macOS"><img alt="DevHub" height="52" src="https://wangchujiang.com/appicon/devhub.png"></a>
33
- <a target="_blank" href="https://apps.apple.com/app/6476400184" title="Resume Revise for macOS"><img alt="Resume Revise" height="52" src="https://wangchujiang.com/appicon/resume-revise.png"></a>
34
- <a target="_blank" href="https://apps.apple.com/app/6472593276" title="Palette Genius for macOS"><img alt="Palette Genius" height="52" src="https://wangchujiang.com/appicon/palette-genius.png"></a>
35
- <a target="_blank" href="https://apps.apple.com/app/6470879005" title="Symbol Scribe for macOS"><img alt="Symbol Scribe" height="52" src="https://wangchujiang.com/appicon/symbol-scribe.png"></a>
30
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6746747327" title="Mousio for macOS"><img alt="Mousio" height="52" src="https://wangchujiang.com/appicon/mousio.png"></a>
31
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6745227444" title="Musicer for macOS"><img alt="Musicer" height="52" src="https://wangchujiang.com/appicon/musicer.png"></a>
32
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6743841447" title="Audioer for macOS"><img alt="Audioer" height="52" src="https://wangchujiang.com/appicon/audioer.png"></a>
33
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6744690194" title="FileSentinel for macOS"><img alt="FileSentinel" height="52" src="https://wangchujiang.com/appicon/file-sentinel.png"></a>
34
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6743495172" title="FocusCursor for macOS"><img alt="FocusCursor" height="52" src="https://wangchujiang.com/appicon/focus-cursor.png"></a>
35
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6742680573" title="Videoer for macOS"><img alt="Videoer" height="52" src="https://wangchujiang.com/appicon/videoer.png"></a>
36
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6740425504" title="KeyClicker for macOS"><img alt="KeyClicker" height="52" src="https://wangchujiang.com/appicon/key-clicker.png"></a>
37
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6739052447" title="DayBar for macOS"><img alt="DayBar" height="52" src="https://wangchujiang.com/appicon/daybar.png"></a>
38
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6739444407" title="Iconed for macOS"><img alt="Iconed" height="52" src="https://wangchujiang.com/appicon/iconed.png"></a>
39
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6737160756" title="Menuist for macOS"><img alt="Menuist" height="52" src="https://wangchujiang.com/appicon/rightmenu-master.png"></a>
40
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6723903021" title="Paste Quick for macOS"><img alt="Quick RSS" height="52" src="https://wangchujiang.com/appicon/paste-quick.png"></a>
41
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6670696072&platform=mac" title="Quick RSS for macOS/iOS"><img alt="Quick RSS" height="52" src="https://wangchujiang.com/appicon/quick-rss.png"></a>
42
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6670167443" title="Web Serve for macOS"><img alt="Web Serve" height="52" src="https://wangchujiang.com/appicon/web-serve.png"></a>
43
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6503953628&platform=mac" title="Copybook Generator for macOS/iOS"><img alt="Copybook Generator" height="52" src="https://wangchujiang.com/appicon/copybook-generator.png"></a>
44
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6471227008&platform=mac" title="DevTutor for macOS/iOS"><img alt="DevTutor for SwiftUI" height="52" src="https://wangchujiang.com/appicon/devtutor.png"></a>
45
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6479819388&platform=mac" title="RegexMate for macOS/iOS"><img alt="RegexMate" height="52" src="https://wangchujiang.com/appicon/regex-mate.png"></a>
46
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6479194014&platform=mac" title="Time Passage for macOS/iOS"><img alt="Time Passage" height="52" src="https://wangchujiang.com/appicon/time-passage.png"></a>
47
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6478772538" title="IconizeFolder for macOS"><img alt="Iconize Folder" height="52" src="https://wangchujiang.com/appicon/iconize-folder.png"></a>
48
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6478511402&platform=mac" title="Textsound Saver for macOS/iOS"><img alt="Textsound Saver" height="52" src="https://wangchujiang.com/appicon/textsound-saver.png"></a>
49
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6476924627" title="Create Custom Symbols for macOS"><img alt="Create Custom Symbols" height="52" src="https://wangchujiang.com/appicon/create-custom-symbols.png"></a>
50
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6476452351" title="DevHub for macOS"><img alt="DevHub" height="52" src="https://wangchujiang.com/appicon/devhub.png"></a>
51
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6476400184" title="Resume Revise for macOS"><img alt="Resume Revise" height="52" src="https://wangchujiang.com/appicon/resume-revise.png"></a>
52
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6472593276" title="Palette Genius for macOS"><img alt="Palette Genius" height="52" src="https://wangchujiang.com/appicon/palette-genius.png"></a>
53
+ <a target="_blank" href="https://jaywcjlove.github.io/maslink/?id=6470879005" title="Symbol Scribe for macOS"><img alt="Symbol Scribe" height="52" src="https://wangchujiang.com/appicon/symbol-scribe.png"></a>
36
54
  </div>
37
55
  <hr>
38
56
 
package/esm/Container.js CHANGED
@@ -9,15 +9,17 @@ import { useIdCompat } from "./comps/useIdCompat.js";
9
9
  import { useShowToolsDispatch } from "./store/ShowTools.js";
10
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  export var Container = /*#__PURE__*/forwardRef((props, ref) => {
12
- var {
13
- className = '',
14
- parentValue,
15
- level = 1,
16
- value,
17
- initialValue,
18
- keys,
19
- keyName
20
- } = props,
12
+ var _props$className = props.className,
13
+ className = _props$className === void 0 ? '' : _props$className,
14
+ children = props.children,
15
+ parentValue = props.parentValue,
16
+ keyid = props.keyid,
17
+ _props$level = props.level,
18
+ level = _props$level === void 0 ? 1 : _props$level,
19
+ value = props.value,
20
+ initialValue = props.initialValue,
21
+ keys = props.keys,
22
+ keyName = props.keyName,
21
23
  elmProps = _objectWithoutPropertiesLoose(props, _excluded);
22
24
  var dispatch = useShowToolsDispatch();
23
25
  var subkeyid = useIdCompat();
@@ -4,9 +4,7 @@ var _excluded = ["style"];
4
4
  import React from 'react';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  export function TriangleArrow(props) {
7
- var {
8
- style
9
- } = props,
7
+ var style = props.style,
10
8
  reset = _objectWithoutPropertiesLoose(props, _excluded);
11
9
  var defaultStyle = _extends({
12
10
  cursor: 'pointer',
@@ -4,9 +4,7 @@ var _excluded = ["style"];
4
4
  import React from 'react';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  export function TriangleSolidArrow(props) {
7
- var {
8
- style
9
- } = props,
7
+ var style = props.style,
10
8
  reset = _objectWithoutPropertiesLoose(props, _excluded);
11
9
  var defaultStyle = _extends({
12
10
  cursor: 'pointer',
@@ -9,26 +9,25 @@ import { useShowToolsStore } from "../store/ShowTools.js";
9
9
  import { bigIntToString } from "../types/index.js";
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  export var Copied = props => {
12
- var {
13
- keyName,
14
- value,
15
- parentValue,
16
- expandKey,
17
- keys,
18
- beforeCopy
19
- } = props,
12
+ var keyName = props.keyName,
13
+ value = props.value,
14
+ parentValue = props.parentValue,
15
+ expandKey = props.expandKey,
16
+ keys = props.keys,
17
+ beforeCopy = props.beforeCopy,
20
18
  other = _objectWithoutPropertiesLoose(props, _excluded);
21
- var {
22
- onCopied,
23
- enableClipboard,
24
- beforeCopy: globalBeforeCopy
25
- } = useStore();
19
+ var _useStore = useStore(),
20
+ onCopied = _useStore.onCopied,
21
+ enableClipboard = _useStore.enableClipboard,
22
+ globalBeforeCopy = _useStore.beforeCopy;
26
23
  var showTools = useShowToolsStore();
27
24
  var isShowTools = showTools[expandKey];
28
- var [copied, setCopied] = useState(false);
29
- var {
30
- Copied: Comp = {}
31
- } = useSectionStore();
25
+ var _useState = useState(false),
26
+ copied = _useState[0],
27
+ setCopied = _useState[1];
28
+ var _useSectionStore = useSectionStore(),
29
+ _useSectionStore$Copi = _useSectionStore.Copied,
30
+ Comp = _useSectionStore$Copi === void 0 ? {} : _useSectionStore$Copi;
32
31
  var sectionBeforeCopy = Comp == null ? void 0 : Comp.beforeCopy;
33
32
  if (enableClipboard === false || !isShowTools) return null;
34
33
  var click = event => {
@@ -87,9 +86,8 @@ export var Copied = props => {
87
86
  fill: copied ? 'var(--w-rjv-copied-success-color, #28a745)' : 'var(--w-rjv-copied-color, currentColor)',
88
87
  onClick: click
89
88
  };
90
- var {
91
- render
92
- } = Comp,
89
+ var as = Comp.as,
90
+ render = Comp.render,
93
91
  reset = _objectWithoutPropertiesLoose(Comp, _excluded2);
94
92
  var elmProps = _extends({}, reset, other, svgProps, {
95
93
  style: _extends({}, reset.style, other.style, svgProps.style)
@@ -14,21 +14,20 @@ import { useIdCompat } from "../comps/useIdCompat.js";
14
14
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
15
  export var KeyValues = props => {
16
16
  var _expands$expandKey;
17
- var {
18
- keyName,
19
- value,
20
- expandKey = '',
21
- level,
22
- keys = [],
23
- parentValue
24
- } = props;
17
+ var keyName = props.keyName,
18
+ value = props.value,
19
+ _props$expandKey = props.expandKey,
20
+ expandKey = _props$expandKey === void 0 ? '' : _props$expandKey,
21
+ level = props.level,
22
+ _props$keys = props.keys,
23
+ keys = _props$keys === void 0 ? [] : _props$keys,
24
+ parentValue = props.parentValue;
25
25
  var expands = useExpandsStore();
26
- var {
27
- objectSortKeys,
28
- indentWidth,
29
- collapsed,
30
- shouldExpandNodeInitially
31
- } = useStore();
26
+ var _useStore = useStore(),
27
+ objectSortKeys = _useStore.objectSortKeys,
28
+ indentWidth = _useStore.indentWidth,
29
+ collapsed = _useStore.collapsed,
30
+ shouldExpandNodeInitially = _useStore.shouldExpandNodeInitially;
32
31
  var defaultExpanded = typeof collapsed === 'boolean' ? collapsed : typeof collapsed === 'number' ? level > collapsed : false;
33
32
  var isExpanded = (_expands$expandKey = expands[expandKey]) != null ? _expands$expandKey : shouldExpandNodeInitially ? false : defaultExpanded;
34
33
  var shouldExpand = shouldExpandNodeInitially && shouldExpandNodeInitially(!isExpanded, {
@@ -55,12 +54,14 @@ export var KeyValues = props => {
55
54
  var entries = isMyArray ? Object.entries(value).map(m => [Number(m[0]), m[1]]) : Object.entries(value);
56
55
  if (objectSortKeys) {
57
56
  entries = objectSortKeys === true ? entries.sort((_ref, _ref2) => {
58
- var [a] = _ref;
59
- var [b] = _ref2;
57
+ var a = _ref[0];
58
+ var b = _ref2[0];
60
59
  return typeof a === 'string' && typeof b === 'string' ? a.localeCompare(b) : 0;
61
60
  }) : entries.sort((_ref3, _ref4) => {
62
- var [a, valA] = _ref3;
63
- var [b, valB] = _ref4;
61
+ var a = _ref3[0],
62
+ valA = _ref3[1];
63
+ var b = _ref4[0],
64
+ valB = _ref4[1];
64
65
  return typeof a === 'string' && typeof b === 'string' ? objectSortKeys(a, b, valA, valB) : 0;
65
66
  });
66
67
  }
@@ -73,7 +74,8 @@ export var KeyValues = props => {
73
74
  className: "w-rjv-wrap",
74
75
  style: style,
75
76
  children: entries.map((_ref5, idx) => {
76
- var [key, val] = _ref5;
77
+ var key = _ref5[0],
78
+ val = _ref5[1];
77
79
  return /*#__PURE__*/_jsx(KeyValuesItem, {
78
80
  parentValue: value,
79
81
  keyName: key,
@@ -86,15 +88,12 @@ export var KeyValues = props => {
86
88
  };
87
89
  KeyValues.displayName = 'JVR.KeyValues';
88
90
  export var KayName = props => {
89
- var {
90
- keyName,
91
- parentValue,
92
- keys,
93
- value
94
- } = props;
95
- var {
96
- highlightUpdates
97
- } = useStore();
91
+ var keyName = props.keyName,
92
+ parentValue = props.parentValue,
93
+ keys = props.keys,
94
+ value = props.value;
95
+ var _useStore2 = useStore(),
96
+ highlightUpdates = _useStore2.highlightUpdates;
98
97
  var isNumber = typeof keyName === 'number';
99
98
  var highlightContainer = useRef(null);
100
99
  useHighlight({
@@ -125,13 +124,13 @@ export var KayName = props => {
125
124
  };
126
125
  KayName.displayName = 'JVR.KayName';
127
126
  export var KeyValuesItem = props => {
128
- var {
129
- keyName,
130
- value,
131
- parentValue,
132
- level = 0,
133
- keys = []
134
- } = props;
127
+ var keyName = props.keyName,
128
+ value = props.value,
129
+ parentValue = props.parentValue,
130
+ _props$level = props.level,
131
+ level = _props$level === void 0 ? 0 : _props$level,
132
+ _props$keys2 = props.keys,
133
+ keys = _props$keys2 === void 0 ? [] : _props$keys2;
135
134
  var dispatch = useShowToolsDispatch();
136
135
  var subkeyid = useIdCompat();
137
136
  var isMyArray = Array.isArray(value);
@@ -5,19 +5,17 @@ import { BracketsClose } from "../symbol/index.js";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  export var NestedClose = props => {
7
7
  var _expands$expandKey;
8
- var {
9
- keyName,
10
- value,
11
- expandKey,
12
- parentValue,
13
- level,
14
- keys = []
15
- } = props;
8
+ var keyName = props.keyName,
9
+ value = props.value,
10
+ expandKey = props.expandKey,
11
+ parentValue = props.parentValue,
12
+ level = props.level,
13
+ _props$keys = props.keys,
14
+ keys = _props$keys === void 0 ? [] : _props$keys;
16
15
  var expands = useExpandsStore();
17
- var {
18
- collapsed,
19
- shouldExpandNodeInitially
20
- } = useStore();
16
+ var _useStore = useStore(),
17
+ collapsed = _useStore.collapsed,
18
+ shouldExpandNodeInitially = _useStore.shouldExpandNodeInitially;
21
19
  var defaultExpanded = typeof collapsed === 'boolean' ? collapsed : typeof collapsed === 'number' ? level > collapsed : false;
22
20
  var isExpanded = (_expands$expandKey = expands[expandKey]) != null ? _expands$expandKey : shouldExpandNodeInitially ? false : defaultExpanded;
23
21
  var shouldExpand = shouldExpandNodeInitially && shouldExpandNodeInitially(!isExpanded, {
@@ -11,22 +11,20 @@ import { SetComp, MapComp } from "../types/index.js";
11
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  export var NestedOpen = props => {
13
13
  var _expands$expandKey;
14
- var {
15
- keyName,
16
- expandKey,
17
- keys = [],
18
- initialValue,
19
- value,
20
- parentValue,
21
- level
22
- } = props;
14
+ var keyName = props.keyName,
15
+ expandKey = props.expandKey,
16
+ _props$keys = props.keys,
17
+ keys = _props$keys === void 0 ? [] : _props$keys,
18
+ initialValue = props.initialValue,
19
+ value = props.value,
20
+ parentValue = props.parentValue,
21
+ level = props.level;
23
22
  var expands = useExpandsStore();
24
23
  var dispatchExpands = useExpandsDispatch();
25
- var {
26
- onExpand,
27
- collapsed,
28
- shouldExpandNodeInitially
29
- } = useStore();
24
+ var _useStore = useStore(),
25
+ onExpand = _useStore.onExpand,
26
+ collapsed = _useStore.collapsed,
27
+ shouldExpandNodeInitially = _useStore.shouldExpandNodeInitially;
30
28
  var defaultExpanded = typeof collapsed === 'boolean' ? collapsed : typeof collapsed === 'number' ? level > collapsed : false;
31
29
  var isExpanded = (_expands$expandKey = expands[expandKey]) != null ? _expands$expandKey : shouldExpandNodeInitially ? false : defaultExpanded;
32
30
  var shouldExpand = shouldExpandNodeInitially && shouldExpandNodeInitially(!isExpanded, {
@@ -3,11 +3,9 @@ import { TypeString, TypeTrue, TypeNull, TypeFalse, TypeFloat, TypeBigint, TypeI
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
4
  export var isFloat = n => Number(n) === n && n % 1 !== 0 || isNaN(n);
5
5
  export var Value = props => {
6
- var {
7
- value,
8
- keyName,
9
- keys
10
- } = props;
6
+ var value = props.value,
7
+ keyName = props.keyName,
8
+ keys = props.keys;
11
9
  var reset = {
12
10
  keyName,
13
11
  keys
@@ -6,15 +6,11 @@ import { useRef, useState } from 'react';
6
6
  import { useStore } from "./store.js";
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  export var KeyNameRender = (_ref, _ref2) => {
9
- var {
10
- children
11
- } = _ref,
9
+ var children = _ref.children,
12
10
  reset = _objectWithoutPropertiesLoose(_ref, _excluded);
13
- var {
14
- value,
15
- parentValue,
16
- keyName
17
- } = _ref2;
11
+ var value = _ref2.value,
12
+ parentValue = _ref2.parentValue,
13
+ keyName = _ref2.keyName;
18
14
  if (typeof children === 'number') {
19
15
  return /*#__PURE__*/_jsx("span", _extends({}, reset, {
20
16
  children: children
@@ -28,16 +24,16 @@ export var KeyNameRender = (_ref, _ref2) => {
28
24
  }));
29
25
  };
30
26
  var Child = props => {
31
- var {
32
- value,
33
- keyName
34
- } = props,
27
+ var value = props.value,
28
+ parentValue = props.parentValue,
29
+ keyName = props.keyName,
35
30
  reset = _objectWithoutPropertiesLoose(props, _excluded2);
36
31
  var $dom = useRef(null);
37
- var [currentValue, setCurrentValue] = useState(props.children);
38
- var {
39
- onEdit
40
- } = useStore();
32
+ var _useState = useState(props.children),
33
+ currentValue = _useState[0],
34
+ setCurrentValue = _useState[1];
35
+ var _useStore = useStore(),
36
+ onEdit = _useStore.onEdit;
41
37
  var onKeyDown = evn => {
42
38
  if (evn.key === 'Enter') {
43
39
  var _$dom$current;
@@ -7,15 +7,16 @@ import { KeyNameRender } from "./KeyName.js";
7
7
  import { Context, Dispatch, useStoreReducer } from "./store.js";
8
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  var JsonViewEditor = /*#__PURE__*/forwardRef((props, ref) => {
10
- var {
11
- children,
12
- onEdit,
13
- editable = true
14
- } = props,
10
+ var children = props.children,
11
+ onEdit = props.onEdit,
12
+ _props$editable = props.editable,
13
+ editable = _props$editable === void 0 ? true : _props$editable,
15
14
  reset = _objectWithoutPropertiesLoose(props, _excluded);
16
- var [state, dispatch] = useStoreReducer({
17
- onEdit
18
- });
15
+ var _useStoreReducer = useStoreReducer({
16
+ onEdit
17
+ }),
18
+ state = _useStoreReducer[0],
19
+ dispatch = _useStoreReducer[1];
19
20
  return /*#__PURE__*/_jsx(Context.Provider, {
20
21
  value: state,
21
22
  children: /*#__PURE__*/_jsx(Dispatch.Provider, {
package/esm/index.js CHANGED
@@ -39,25 +39,32 @@ export * from "./store/Symbols.js";
39
39
  export * from "./store/Types.js";
40
40
  export * from "./symbol/index.js";
41
41
  var JsonView = /*#__PURE__*/forwardRef((props, ref) => {
42
- var {
43
- className = '',
44
- style,
45
- value,
46
- children,
47
- collapsed = false,
48
- shouldExpandNodeInitially,
49
- indentWidth = 15,
50
- displayObjectSize = true,
51
- shortenTextAfterLength = 30,
52
- stringEllipsis,
53
- highlightUpdates = true,
54
- enableClipboard = true,
55
- displayDataTypes = true,
56
- objectSortKeys = false,
57
- onExpand,
58
- onCopied,
59
- beforeCopy
60
- } = props,
42
+ var _props$className = props.className,
43
+ className = _props$className === void 0 ? '' : _props$className,
44
+ style = props.style,
45
+ value = props.value,
46
+ children = props.children,
47
+ _props$collapsed = props.collapsed,
48
+ collapsed = _props$collapsed === void 0 ? false : _props$collapsed,
49
+ shouldExpandNodeInitially = props.shouldExpandNodeInitially,
50
+ _props$indentWidth = props.indentWidth,
51
+ indentWidth = _props$indentWidth === void 0 ? 15 : _props$indentWidth,
52
+ _props$displayObjectS = props.displayObjectSize,
53
+ displayObjectSize = _props$displayObjectS === void 0 ? true : _props$displayObjectS,
54
+ _props$shortenTextAft = props.shortenTextAfterLength,
55
+ shortenTextAfterLength = _props$shortenTextAft === void 0 ? 30 : _props$shortenTextAft,
56
+ stringEllipsis = props.stringEllipsis,
57
+ _props$highlightUpdat = props.highlightUpdates,
58
+ highlightUpdates = _props$highlightUpdat === void 0 ? true : _props$highlightUpdat,
59
+ _props$enableClipboar = props.enableClipboard,
60
+ enableClipboard = _props$enableClipboar === void 0 ? true : _props$enableClipboar,
61
+ _props$displayDataTyp = props.displayDataTypes,
62
+ displayDataTypes = _props$displayDataTyp === void 0 ? true : _props$displayDataTyp,
63
+ _props$objectSortKeys = props.objectSortKeys,
64
+ objectSortKeys = _props$objectSortKeys === void 0 ? false : _props$objectSortKeys,
65
+ onExpand = props.onExpand,
66
+ onCopied = props.onCopied,
67
+ beforeCopy = props.beforeCopy,
61
68
  elmProps = _objectWithoutPropertiesLoose(props, _excluded);
62
69
  var defaultStyle = _extends({
63
70
  lineHeight: 1.4,
@@ -1,9 +1,9 @@
1
1
  import { useSectionStore } from "../store/Section.js";
2
2
  import { useSectionRender } from "../utils/useRender.js";
3
3
  export var Copied = props => {
4
- var {
5
- Copied: Comp = {}
6
- } = useSectionStore();
4
+ var _useSectionStore = useSectionStore(),
5
+ _useSectionStore$Copi = _useSectionStore.Copied,
6
+ Comp = _useSectionStore$Copi === void 0 ? {} : _useSectionStore$Copi;
7
7
  useSectionRender(Comp, props, 'Copied');
8
8
  return null;
9
9
  };
@@ -7,30 +7,26 @@ import { useSectionRender } from "../utils/useRender.js";
7
7
  import { useStore } from "../store.js";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  export var CountInfo = props => {
10
- var {
11
- CountInfo: Comp = {}
12
- } = useSectionStore();
10
+ var _useSectionStore = useSectionStore(),
11
+ _useSectionStore$Coun = _useSectionStore.CountInfo,
12
+ Comp = _useSectionStore$Coun === void 0 ? {} : _useSectionStore$Coun;
13
13
  useSectionRender(Comp, props, 'CountInfo');
14
14
  return null;
15
15
  };
16
16
  CountInfo.displayName = 'JVR.CountInfo';
17
17
  export var CountInfoComp = props => {
18
- var {
19
- value = {},
20
- keyName
21
- } = props,
18
+ var _props$value = props.value,
19
+ value = _props$value === void 0 ? {} : _props$value,
20
+ keyName = props.keyName,
22
21
  other = _objectWithoutPropertiesLoose(props, _excluded);
23
- var {
24
- displayObjectSize
25
- } = useStore();
26
- var {
27
- CountInfo: Comp = {}
28
- } = useSectionStore();
22
+ var _useStore = useStore(),
23
+ displayObjectSize = _useStore.displayObjectSize;
24
+ var _useSectionStore2 = useSectionStore(),
25
+ _useSectionStore2$Cou = _useSectionStore2.CountInfo,
26
+ Comp = _useSectionStore2$Cou === void 0 ? {} : _useSectionStore2$Cou;
29
27
  if (!displayObjectSize) return null;
30
- var {
31
- as,
32
- render
33
- } = Comp,
28
+ var as = Comp.as,
29
+ render = Comp.render,
34
30
  reset = _objectWithoutPropertiesLoose(Comp, _excluded2);
35
31
  var Elm = as || 'span';
36
32
  reset.style = _extends({}, reset.style, props.style);
@@ -6,26 +6,23 @@ import { useSectionStore } from "../store/Section.js";
6
6
  import { useSectionRender } from "../utils/useRender.js";
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  export var CountInfoExtra = props => {
9
- var {
10
- CountInfoExtra: Comp = {}
11
- } = useSectionStore();
9
+ var _useSectionStore = useSectionStore(),
10
+ _useSectionStore$Coun = _useSectionStore.CountInfoExtra,
11
+ Comp = _useSectionStore$Coun === void 0 ? {} : _useSectionStore$Coun;
12
12
  useSectionRender(Comp, props, 'CountInfoExtra');
13
13
  return null;
14
14
  };
15
15
  CountInfoExtra.displayName = 'JVR.CountInfoExtra';
16
16
  export var CountInfoExtraComps = props => {
17
- var {
18
- value = {},
19
- keyName
20
- } = props,
17
+ var _props$value = props.value,
18
+ value = _props$value === void 0 ? {} : _props$value,
19
+ keyName = props.keyName,
21
20
  other = _objectWithoutPropertiesLoose(props, _excluded);
22
- var {
23
- CountInfoExtra: Comp = {}
24
- } = useSectionStore();
25
- var {
26
- as,
27
- render
28
- } = Comp,
21
+ var _useSectionStore2 = useSectionStore(),
22
+ _useSectionStore2$Cou = _useSectionStore2.CountInfoExtra,
23
+ Comp = _useSectionStore2$Cou === void 0 ? {} : _useSectionStore2$Cou;
24
+ var as = Comp.as,
25
+ render = Comp.render,
29
26
  reset = _objectWithoutPropertiesLoose(Comp, _excluded2);
30
27
  if (!render && !reset.children) return null;
31
28
  var Elm = as || 'span';