@uiw/react-json-view 2.0.0-alpha.3 → 2.0.0-alpha.31

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 (197) hide show
  1. package/README.md +230 -38
  2. package/basic.d.ts +3 -0
  3. package/cjs/Container.d.ts +2 -0
  4. package/cjs/Container.js +13 -6
  5. package/cjs/arrow/TriangleArrow.js +1 -1
  6. package/cjs/comps/Copied.d.ts +2 -4
  7. package/cjs/comps/Copied.js +50 -17
  8. package/cjs/comps/KeyValues.d.ts +2 -4
  9. package/cjs/comps/KeyValues.js +62 -27
  10. package/cjs/comps/NestedClose.d.ts +1 -0
  11. package/cjs/comps/NestedClose.js +15 -5
  12. package/cjs/comps/NestedOpen.d.ts +2 -3
  13. package/cjs/comps/NestedOpen.js +34 -14
  14. package/cjs/comps/Value.d.ts +1 -2
  15. package/cjs/comps/Value.js +4 -8
  16. package/cjs/comps/useIdCompat.d.ts +1 -0
  17. package/cjs/comps/useIdCompat.js +14 -0
  18. package/cjs/editor/KeyName.d.ts +2 -0
  19. package/cjs/editor/KeyName.js +82 -0
  20. package/cjs/editor/index.d.ts +18 -0
  21. package/cjs/editor/index.js +44 -0
  22. package/cjs/editor/store.d.ts +27 -0
  23. package/cjs/editor/store.js +23 -0
  24. package/cjs/index.d.ts +12 -3
  25. package/cjs/index.js +11 -4
  26. package/cjs/section/Copied.d.ts +1 -1
  27. package/cjs/section/Copied.js +1 -2
  28. package/cjs/section/CountInfo.d.ts +1 -2
  29. package/cjs/section/CountInfo.js +3 -5
  30. package/cjs/section/CountInfoExtra.d.ts +1 -2
  31. package/cjs/section/CountInfoExtra.js +2 -4
  32. package/cjs/section/Ellipsis.d.ts +0 -1
  33. package/cjs/section/Ellipsis.js +4 -5
  34. package/cjs/section/KeyName.d.ts +7 -6
  35. package/cjs/section/KeyName.js +8 -6
  36. package/cjs/section/Row.d.ts +13 -0
  37. package/cjs/section/Row.js +51 -0
  38. package/cjs/store/Expands.js +2 -4
  39. package/cjs/store/Section.d.ts +12 -6
  40. package/cjs/store/Section.js +6 -4
  41. package/cjs/store/ShowTools.js +2 -4
  42. package/cjs/store/Symbols.d.ts +10 -3
  43. package/cjs/store/Symbols.js +2 -4
  44. package/cjs/store/Types.d.ts +29 -25
  45. package/cjs/store/Types.js +8 -8
  46. package/cjs/store.d.ts +9 -4
  47. package/cjs/store.js +5 -10
  48. package/cjs/symbol/Arrow.d.ts +1 -1
  49. package/cjs/symbol/Arrow.js +1 -2
  50. package/cjs/symbol/BraceLeft.d.ts +1 -1
  51. package/cjs/symbol/BraceLeft.js +1 -2
  52. package/cjs/symbol/BraceRight.d.ts +1 -1
  53. package/cjs/symbol/BraceRight.js +1 -2
  54. package/cjs/symbol/BracketsLeft.d.ts +1 -1
  55. package/cjs/symbol/BracketsLeft.js +1 -2
  56. package/cjs/symbol/BracketsRight.d.ts +1 -1
  57. package/cjs/symbol/BracketsRight.js +1 -2
  58. package/cjs/symbol/Colon.d.ts +1 -1
  59. package/cjs/symbol/Colon.js +1 -2
  60. package/cjs/symbol/Quote.d.ts +1 -1
  61. package/cjs/symbol/Quote.js +1 -2
  62. package/cjs/symbol/ValueQuote.d.ts +1 -1
  63. package/cjs/symbol/ValueQuote.js +1 -2
  64. package/cjs/symbol/index.d.ts +11 -16
  65. package/cjs/symbol/index.js +75 -30
  66. package/cjs/theme/basic.d.ts +1 -2
  67. package/cjs/theme/basic.js +4 -3
  68. package/cjs/theme/dark.d.ts +1 -2
  69. package/cjs/theme/dark.js +2 -3
  70. package/cjs/theme/github.dark.d.ts +1 -2
  71. package/cjs/theme/github.dark.js +2 -3
  72. package/cjs/theme/github.light.d.ts +1 -2
  73. package/cjs/theme/github.light.js +2 -3
  74. package/cjs/theme/gruvbox.d.ts +1 -2
  75. package/cjs/theme/gruvbox.js +2 -3
  76. package/cjs/theme/light.d.ts +1 -2
  77. package/cjs/theme/light.js +2 -3
  78. package/cjs/theme/monokai.d.ts +1 -2
  79. package/cjs/theme/monokai.js +2 -3
  80. package/cjs/theme/nord.d.ts +1 -2
  81. package/cjs/theme/nord.js +2 -3
  82. package/cjs/theme/vscode.d.ts +1 -2
  83. package/cjs/theme/vscode.js +2 -3
  84. package/cjs/types/Bigint.d.ts +1 -1
  85. package/cjs/types/Bigint.js +1 -2
  86. package/cjs/types/Date.d.ts +1 -1
  87. package/cjs/types/Date.js +1 -2
  88. package/cjs/types/False.d.ts +1 -1
  89. package/cjs/types/False.js +1 -2
  90. package/cjs/types/Float.d.ts +1 -1
  91. package/cjs/types/Float.js +1 -2
  92. package/cjs/types/Int.d.ts +1 -1
  93. package/cjs/types/Int.js +1 -2
  94. package/cjs/types/Map.d.ts +1 -1
  95. package/cjs/types/Map.js +1 -2
  96. package/cjs/types/Nan.d.ts +1 -1
  97. package/cjs/types/Nan.js +1 -2
  98. package/cjs/types/Null.d.ts +1 -1
  99. package/cjs/types/Null.js +1 -2
  100. package/cjs/types/Set.d.ts +1 -1
  101. package/cjs/types/Set.js +1 -2
  102. package/cjs/types/String.d.ts +1 -1
  103. package/cjs/types/String.js +1 -2
  104. package/cjs/types/True.d.ts +1 -1
  105. package/cjs/types/True.js +1 -2
  106. package/cjs/types/Undefined.d.ts +1 -1
  107. package/cjs/types/Undefined.js +1 -2
  108. package/cjs/types/Url.d.ts +1 -1
  109. package/cjs/types/Url.js +1 -2
  110. package/cjs/types/index.d.ts +3 -1
  111. package/cjs/types/index.js +102 -127
  112. package/cjs/utils/useHighlight.d.ts +0 -1
  113. package/cjs/utils/useRender.d.ts +1 -1
  114. package/editor.d.ts +22 -20
  115. package/esm/Container.d.ts +2 -0
  116. package/esm/Container.js +15 -7
  117. package/esm/arrow/TriangleArrow.js +1 -1
  118. package/esm/comps/Copied.d.ts +2 -4
  119. package/esm/comps/Copied.js +48 -16
  120. package/esm/comps/KeyValues.d.ts +2 -4
  121. package/esm/comps/KeyValues.js +53 -21
  122. package/esm/comps/NestedClose.d.ts +1 -0
  123. package/esm/comps/NestedClose.js +13 -3
  124. package/esm/comps/NestedOpen.d.ts +2 -3
  125. package/esm/comps/NestedOpen.js +33 -14
  126. package/esm/comps/Value.d.ts +1 -2
  127. package/esm/comps/Value.js +2 -4
  128. package/esm/comps/useIdCompat.d.ts +1 -0
  129. package/esm/comps/useIdCompat.js +8 -0
  130. package/esm/editor/KeyName.d.ts +2 -0
  131. package/esm/editor/KeyName.js +77 -0
  132. package/esm/editor/index.d.ts +18 -0
  133. package/esm/editor/index.js +33 -0
  134. package/esm/editor/store.d.ts +27 -0
  135. package/esm/editor/store.js +13 -0
  136. package/esm/index.d.ts +12 -3
  137. package/esm/index.js +12 -5
  138. package/esm/section/Copied.d.ts +1 -1
  139. package/esm/section/CountInfo.d.ts +1 -2
  140. package/esm/section/CountInfo.js +1 -1
  141. package/esm/section/CountInfoExtra.d.ts +1 -2
  142. package/esm/section/Ellipsis.d.ts +0 -1
  143. package/esm/section/Ellipsis.js +1 -1
  144. package/esm/section/KeyName.d.ts +7 -6
  145. package/esm/section/KeyName.js +6 -2
  146. package/esm/section/Row.d.ts +13 -0
  147. package/esm/section/Row.js +47 -0
  148. package/esm/store/Section.d.ts +12 -6
  149. package/esm/store/Section.js +4 -0
  150. package/esm/store/Symbols.d.ts +10 -3
  151. package/esm/store/Types.d.ts +29 -25
  152. package/esm/store/Types.js +6 -4
  153. package/esm/store.d.ts +9 -4
  154. package/esm/symbol/Arrow.d.ts +1 -1
  155. package/esm/symbol/BraceLeft.d.ts +1 -1
  156. package/esm/symbol/BraceRight.d.ts +1 -1
  157. package/esm/symbol/BracketsLeft.d.ts +1 -1
  158. package/esm/symbol/BracketsRight.d.ts +1 -1
  159. package/esm/symbol/Colon.d.ts +1 -1
  160. package/esm/symbol/Quote.d.ts +1 -1
  161. package/esm/symbol/ValueQuote.d.ts +1 -1
  162. package/esm/symbol/index.d.ts +11 -16
  163. package/esm/symbol/index.js +76 -23
  164. package/esm/theme/basic.d.ts +1 -2
  165. package/esm/theme/basic.js +2 -0
  166. package/esm/theme/dark.d.ts +1 -2
  167. package/esm/theme/github.dark.d.ts +1 -2
  168. package/esm/theme/github.light.d.ts +1 -2
  169. package/esm/theme/gruvbox.d.ts +1 -2
  170. package/esm/theme/light.d.ts +1 -2
  171. package/esm/theme/monokai.d.ts +1 -2
  172. package/esm/theme/nord.d.ts +1 -2
  173. package/esm/theme/vscode.d.ts +1 -2
  174. package/esm/types/Bigint.d.ts +1 -1
  175. package/esm/types/Date.d.ts +1 -1
  176. package/esm/types/False.d.ts +1 -1
  177. package/esm/types/Float.d.ts +1 -1
  178. package/esm/types/Int.d.ts +1 -1
  179. package/esm/types/Map.d.ts +1 -1
  180. package/esm/types/Nan.d.ts +1 -1
  181. package/esm/types/Null.d.ts +1 -1
  182. package/esm/types/Set.d.ts +1 -1
  183. package/esm/types/String.d.ts +1 -1
  184. package/esm/types/True.d.ts +1 -1
  185. package/esm/types/Undefined.d.ts +1 -1
  186. package/esm/types/Url.d.ts +1 -1
  187. package/esm/types/index.d.ts +3 -1
  188. package/esm/types/index.js +87 -103
  189. package/esm/utils/useHighlight.d.ts +0 -1
  190. package/esm/utils/useRender.d.ts +1 -1
  191. package/githubDark.d.ts +3 -0
  192. package/githubLight.d.ts +3 -0
  193. package/gruvbox.d.ts +3 -0
  194. package/monokai.d.ts +3 -0
  195. package/nord.d.ts +3 -0
  196. package/package.json +11 -5
  197. package/vscode.d.ts +3 -0
package/cjs/index.js CHANGED
@@ -48,6 +48,7 @@ var _CountInfo = require("./section/CountInfo");
48
48
  var _CountInfoExtra = require("./section/CountInfoExtra");
49
49
  var _Ellipsis = require("./section/Ellipsis");
50
50
  var _KeyName = require("./section/KeyName");
51
+ var _Row = require("./section/Row");
51
52
  var _jsxRuntime = require("react/jsx-runtime");
52
53
  var _Expands = require("./store/Expands");
53
54
  Object.keys(_Expands).forEach(function (key) {
@@ -109,7 +110,7 @@ Object.keys(_symbol).forEach(function (key) {
109
110
  }
110
111
  });
111
112
  });
112
- var _excluded = ["className", "style", "value", "children", "collapsed", "indentWidth", "displayObjectSize", "shortenTextAfterLength", "highlightUpdates", "enableClipboard", "displayDataTypes", "objectSortKeys", "onExpand"];
113
+ var _excluded = ["className", "style", "value", "children", "collapsed", "shouldExpandNodeInitially", "indentWidth", "displayObjectSize", "shortenTextAfterLength", "stringEllipsis", "highlightUpdates", "enableClipboard", "displayDataTypes", "objectSortKeys", "onExpand", "onCopied"];
113
114
  var JsonView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
114
115
  var _props$className = props.className,
115
116
  className = _props$className === void 0 ? '' : _props$className,
@@ -117,12 +118,14 @@ var JsonView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
117
118
  value = props.value,
118
119
  children = props.children,
119
120
  collapsed = props.collapsed,
121
+ shouldExpandNodeInitially = props.shouldExpandNodeInitially,
120
122
  _props$indentWidth = props.indentWidth,
121
123
  indentWidth = _props$indentWidth === void 0 ? 15 : _props$indentWidth,
122
124
  _props$displayObjectS = props.displayObjectSize,
123
125
  displayObjectSize = _props$displayObjectS === void 0 ? true : _props$displayObjectS,
124
126
  _props$shortenTextAft = props.shortenTextAfterLength,
125
- shortenTextAfterLength = _props$shortenTextAft === void 0 ? 20 : _props$shortenTextAft,
127
+ shortenTextAfterLength = _props$shortenTextAft === void 0 ? 30 : _props$shortenTextAft,
128
+ stringEllipsis = props.stringEllipsis,
126
129
  _props$highlightUpdat = props.highlightUpdates,
127
130
  highlightUpdates = _props$highlightUpdat === void 0 ? true : _props$highlightUpdat,
128
131
  _props$enableClipboar = props.enableClipboard,
@@ -132,6 +135,7 @@ var JsonView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
132
135
  _props$objectSortKeys = props.objectSortKeys,
133
136
  objectSortKeys = _props$objectSortKeys === void 0 ? false : _props$objectSortKeys,
134
137
  onExpand = props.onExpand,
138
+ onCopied = props.onCopied,
135
139
  elmProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
136
140
  var defaultStyle = (0, _objectSpread2["default"])({
137
141
  lineHeight: 1.4,
@@ -146,11 +150,14 @@ var JsonView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
146
150
  value: value,
147
151
  objectSortKeys: objectSortKeys,
148
152
  indentWidth: indentWidth,
153
+ shouldExpandNodeInitially: shouldExpandNodeInitially,
149
154
  displayObjectSize: displayObjectSize,
150
155
  collapsed: collapsed,
151
156
  enableClipboard: enableClipboard,
152
157
  shortenTextAfterLength: shortenTextAfterLength,
158
+ stringEllipsis: stringEllipsis,
153
159
  highlightUpdates: highlightUpdates,
160
+ onCopied: onCopied,
154
161
  onExpand: onExpand
155
162
  },
156
163
  initialTypes: {
@@ -191,6 +198,6 @@ JsonView.Copied = _Copied.Copied;
191
198
  JsonView.CountInfo = _CountInfo.CountInfo;
192
199
  JsonView.CountInfoExtra = _CountInfoExtra.CountInfoExtra;
193
200
  JsonView.KeyName = _KeyName.KeyName;
201
+ JsonView.Row = _Row.Row;
194
202
  JsonView.displayName = 'JVR.JsonView';
195
- var _default = JsonView;
196
- exports["default"] = _default;
203
+ var _default = exports["default"] = JsonView;
@@ -1,6 +1,6 @@
1
1
  import { type TagType } from '../store/Types';
2
2
  import { type SectionElement } from '../store/Section';
3
3
  export declare const Copied: {
4
- (props: SectionElement<TagType>): null;
4
+ <K extends TagType = "svg">(props: SectionElement<K>): null;
5
5
  displayName: string;
6
6
  };
@@ -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';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type TagType } from '../store/Types';
3
2
  import { type SectionElement, type SectionElementProps } from '../store/Section';
4
3
  export declare const CountInfo: {
@@ -10,6 +9,6 @@ export interface CountInfoCompProps<T extends object> {
10
9
  keyName: string | number;
11
10
  }
12
11
  export declare const CountInfoComp: {
13
- <T extends object>(props: SectionElementProps<TagType> & CountInfoCompProps<T> & import("react").HTMLAttributes<HTMLElement>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
12
+ <K extends TagType, T extends object>(props: SectionElementProps<K> & CountInfoCompProps<T> & React.HTMLAttributes<HTMLElement>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
14
13
  displayName: string;
15
14
  };
@@ -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,
@@ -40,7 +39,7 @@ var CountInfoComp = function CountInfoComp(props) {
40
39
  reset.style = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset.style), props.style);
41
40
  var len = Object.keys(value).length;
42
41
  if (!reset.children) {
43
- reset.children = "".concat(len, " items");
42
+ reset.children = "".concat(len, " item").concat(len === 1 ? '' : 's');
44
43
  }
45
44
  var elmProps = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), other);
46
45
  var isRender = render && typeof render === 'function';
@@ -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';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type TagType } from '../store/Types';
3
2
  import { type SectionElement, type SectionElementProps } from '../store/Section';
4
3
  export declare const CountInfoExtra: {
@@ -10,6 +9,6 @@ export interface CountInfoExtraCompsProps<T extends object> {
10
9
  keyName: string | number;
11
10
  }
12
11
  export declare const CountInfoExtraComps: {
13
- <T extends object>(props: SectionElementProps<TagType> & CountInfoExtraCompsProps<T>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
12
+ <T extends object, K extends TagType>(props: SectionElementProps<K> & CountInfoExtraCompsProps<T>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
14
13
  displayName: string;
15
14
  };
@@ -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';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type TagType } from '../store/Types';
3
2
  import { type SectionElement } from '../store/Section';
4
3
  export declare const Ellipsis: {
@@ -5,22 +5,22 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.EllipsisComp = exports.Ellipsis = void 0;
8
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
8
9
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
11
  var _Section = require("../store/Section");
11
12
  var _useRender = require("../utils/useRender");
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  var _excluded = ["as", "render"];
14
- var Ellipsis = function Ellipsis(props) {
15
+ var Ellipsis = exports.Ellipsis = function Ellipsis(props) {
15
16
  var _useSectionStore = (0, _Section.useSectionStore)(),
16
17
  _useSectionStore$Elli = _useSectionStore.Ellipsis,
17
18
  Comp = _useSectionStore$Elli === void 0 ? {} : _useSectionStore$Elli;
18
19
  (0, _useRender.useSectionRender)(Comp, props, 'Ellipsis');
19
20
  return null;
20
21
  };
21
- exports.Ellipsis = Ellipsis;
22
22
  Ellipsis.displayName = 'JVR.Ellipsis';
23
- var EllipsisComp = function EllipsisComp(_ref) {
23
+ var EllipsisComp = exports.EllipsisComp = function EllipsisComp(_ref) {
24
24
  var isExpanded = _ref.isExpanded,
25
25
  value = _ref.value,
26
26
  keyName = _ref.keyName;
@@ -38,8 +38,7 @@ var EllipsisComp = function EllipsisComp(_ref) {
38
38
  keyName: keyName
39
39
  });
40
40
  if (child) return child;
41
- if (!isExpanded) return null;
41
+ if (!isExpanded || (0, _typeof2["default"])(value) === 'object' && Object.keys(value).length == 0) return null;
42
42
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Elm, (0, _objectSpread2["default"])({}, reset));
43
43
  };
44
- exports.EllipsisComp = EllipsisComp;
45
44
  EllipsisComp.displayName = 'JVR.EllipsisComp';
@@ -1,13 +1,14 @@
1
- import { type FC, type PropsWithChildren } from 'react';
1
+ import { type PropsWithChildren } from 'react';
2
2
  import { type TagType } from '../store/Types';
3
3
  import { type SectionElement } from '../store/Section';
4
+ import { type SectionElementResult } from '../store/Section';
4
5
  export declare const KeyName: {
5
6
  <K extends TagType>(props: SectionElement<K>): null;
6
7
  displayName: string;
7
8
  };
8
- type KeyNameCompProps = {
9
- keyName: string | number;
10
- value?: unknown;
9
+ export interface KeyNameCompProps<T extends object> extends React.HTMLAttributes<HTMLSpanElement>, SectionElementResult<T> {
10
+ }
11
+ export declare const KeyNameComp: {
12
+ <T extends object>(props: PropsWithChildren<KeyNameCompProps<T>>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element;
13
+ displayName: string;
11
14
  };
12
- export declare const KeyNameComp: FC<PropsWithChildren<KeyNameCompProps>>;
13
- export {};
@@ -11,19 +11,20 @@ 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
- keyName = props.keyName;
25
+ parentValue = props.parentValue,
26
+ keyName = props.keyName,
27
+ keys = props.keys;
27
28
  var isNumber = typeof children === 'number';
28
29
  var style = {
29
30
  color: isNumber ? 'var(--w-rjv-key-number, #268bd2)' : 'var(--w-rjv-key-string, #002b36)'
@@ -40,12 +41,13 @@ var KeyNameComp = function KeyNameComp(props) {
40
41
  children: children
41
42
  }), {
42
43
  value: value,
43
- keyName: keyName
44
+ parentValue: parentValue,
45
+ keyName: keyName,
46
+ keys: keys || (keyName ? [keyName] : [])
44
47
  });
45
48
  if (child) return child;
46
49
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Elm, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
47
50
  children: children
48
51
  }));
49
52
  };
50
- exports.KeyNameComp = KeyNameComp;
51
53
  KeyNameComp.displayName = 'JVR.KeyNameComp';
@@ -0,0 +1,13 @@
1
+ import { type TagType } from '../store/Types';
2
+ import { type SectionElement } from '../store/Section';
3
+ import { type SectionElementResult } from '../store/Section';
4
+ export declare const Row: {
5
+ <K extends TagType>(props: SectionElement<K>): null;
6
+ displayName: string;
7
+ };
8
+ export interface RowCompProps<T extends object> extends React.HTMLAttributes<HTMLDivElement>, SectionElementResult<T> {
9
+ }
10
+ export declare const RowComp: {
11
+ <T extends object>(props: React.PropsWithChildren<RowCompProps<T>>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element;
12
+ displayName: string;
13
+ };
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.RowComp = exports.Row = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _Section = require("../store/Section");
11
+ var _useRender = require("../utils/useRender");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ var _excluded = ["children", "value", "parentValue", "keyName", "keys"],
14
+ _excluded2 = ["as", "render", "children"];
15
+ var Row = exports.Row = function Row(props) {
16
+ var _useSectionStore = (0, _Section.useSectionStore)(),
17
+ _useSectionStore$Row = _useSectionStore.Row,
18
+ Comp = _useSectionStore$Row === void 0 ? {} : _useSectionStore$Row;
19
+ (0, _useRender.useSectionRender)(Comp, props, 'Row');
20
+ return null;
21
+ };
22
+ Row.displayName = 'JVR.Row';
23
+ var RowComp = exports.RowComp = function RowComp(props) {
24
+ var children = props.children,
25
+ value = props.value,
26
+ parentValue = props.parentValue,
27
+ keyName = props.keyName,
28
+ keys = props.keys,
29
+ other = (0, _objectWithoutProperties2["default"])(props, _excluded);
30
+ var _useSectionStore2 = (0, _Section.useSectionStore)(),
31
+ _useSectionStore2$Row = _useSectionStore2.Row,
32
+ Comp = _useSectionStore2$Row === void 0 ? {} : _useSectionStore2$Row;
33
+ var as = Comp.as,
34
+ render = Comp.render,
35
+ _ = Comp.children,
36
+ reset = (0, _objectWithoutProperties2["default"])(Comp, _excluded2);
37
+ var Elm = as || 'div';
38
+ var child = render && typeof render === 'function' && render((0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, other), reset), {}, {
39
+ children: children
40
+ }), {
41
+ value: value,
42
+ keyName: keyName,
43
+ parentValue: parentValue,
44
+ keys: keys
45
+ });
46
+ if (child) return child;
47
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Elm, (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, other), reset), {}, {
48
+ children: children
49
+ }));
50
+ };
51
+ RowComp.displayName = 'JVR.RowComp';
@@ -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';
@@ -1,18 +1,23 @@
1
1
  import React, { FC, PropsWithChildren, ComponentPropsWithoutRef } from 'react';
2
2
  import { type TagType } from './Types';
3
- export type SectionElementProps<T extends TagType> = {
3
+ export interface SectionElementResult<T extends object, K = string | number> {
4
+ value?: T;
5
+ parentValue?: T;
6
+ keyName?: K;
7
+ /** Index of the parent `keyName` */
8
+ keys?: K[];
9
+ }
10
+ export type SectionElementProps<T extends TagType = 'span'> = {
4
11
  as?: T;
5
- render?: (props: SectionElement<T>, result: {
6
- value: unknown;
7
- keyName: string | number;
8
- }) => React.ReactNode;
12
+ render?: (props: SectionElement<T>, result: SectionElementResult<object>) => React.ReactNode;
9
13
  };
10
- export type SectionElement<T extends TagType> = SectionElementProps<T> & ComponentPropsWithoutRef<T>;
14
+ export type SectionElement<T extends TagType = 'span'> = SectionElementProps<T> & ComponentPropsWithoutRef<T>;
11
15
  type InitialState<T extends TagType> = {
12
16
  Copied?: SectionElement<T>;
13
17
  CountInfo?: SectionElement<T>;
14
18
  CountInfoExtra?: SectionElement<T>;
15
19
  Ellipsis?: SectionElement<T>;
20
+ Row?: SectionElement<T>;
16
21
  KeyName?: SectionElement<T>;
17
22
  };
18
23
  type Dispatch = React.Dispatch<InitialState<TagType>>;
@@ -22,6 +27,7 @@ export declare function useSection(): [{
22
27
  CountInfo?: SectionElement<TagType> | undefined;
23
28
  CountInfoExtra?: SectionElement<TagType> | undefined;
24
29
  Ellipsis?: SectionElement<TagType> | undefined;
30
+ Row?: SectionElement<TagType> | undefined;
25
31
  KeyName?: SectionElement<TagType> | undefined;
26
32
  }, React.Dispatch<InitialState<TagType>>];
27
33
  export declare function useSectionDispatch(): Dispatch;
@@ -49,6 +49,10 @@ var initialState = {
49
49
  className: 'w-rjv-ellipsis',
50
50
  children: '...'
51
51
  },
52
+ Row: {
53
+ as: 'div',
54
+ className: 'w-rjv-line'
55
+ },
52
56
  KeyName: {
53
57
  as: 'span',
54
58
  className: 'w-rjv-object-key'
@@ -58,10 +62,9 @@ var Context = /*#__PURE__*/(0, _react.createContext)(initialState);
58
62
  var reducer = function reducer(state, action) {
59
63
  return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), action);
60
64
  };
61
- var useSectionStore = function useSectionStore() {
65
+ var useSectionStore = exports.useSectionStore = function useSectionStore() {
62
66
  return (0, _react.useContext)(Context);
63
67
  };
64
- exports.useSectionStore = useSectionStore;
65
68
  var DispatchSection = /*#__PURE__*/(0, _react.createContext)(function () {});
66
69
  DispatchSection.displayName = 'JVR.DispatchSection';
67
70
  function useSection() {
@@ -70,7 +73,7 @@ function useSection() {
70
73
  function useSectionDispatch() {
71
74
  return (0, _react.useContext)(DispatchSection);
72
75
  }
73
- var Section = function Section(_ref) {
76
+ var Section = exports.Section = function Section(_ref) {
74
77
  var initial = _ref.initial,
75
78
  dispatch = _ref.dispatch,
76
79
  children = _ref.children;
@@ -82,5 +85,4 @@ var Section = function Section(_ref) {
82
85
  })
83
86
  });
84
87
  };
85
- exports.Section = Section;
86
88
  Section.displayName = 'JVR.Section';
@@ -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';
@@ -1,11 +1,18 @@
1
1
  import { FC, PropsWithChildren, ElementType, ComponentPropsWithoutRef } from 'react';
2
2
  import { type TagType } from './Types';
3
- type SymbolsElementProps<T extends TagType> = {
3
+ export interface SymbolsElementResult<T extends object, K = string | number> {
4
+ value?: T;
5
+ parentValue?: T;
6
+ keyName?: K;
7
+ /** Index of the parent `keyName` */
8
+ keys?: K[];
9
+ }
10
+ type SymbolsElementProps<T extends TagType = 'span'> = {
4
11
  as?: T;
5
- render?: (props: SymbolsElement<T>) => React.ReactNode;
12
+ render?: (props: SymbolsElement<T>, result: SymbolsElementResult<object>) => React.ReactNode;
6
13
  'data-type'?: string;
7
14
  };
8
- export type SymbolsElement<T extends TagType> = SymbolsElementProps<T> & ComponentPropsWithoutRef<T>;
15
+ export type SymbolsElement<T extends TagType = 'span'> = SymbolsElementProps<T> & ComponentPropsWithoutRef<T>;
9
16
  type InitialState<T extends ElementType = 'span'> = {
10
17
  Arrow?: SymbolsElement<T>;
11
18
  Colon?: SymbolsElement<T>;
@@ -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';
@@ -1,34 +1,35 @@
1
- import { FC, PropsWithChildren, ComponentPropsWithoutRef } from 'react';
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<TagType>;
15
- Str?: TypesElement<TagType>;
16
- Undefined?: TypesElement<TagType>;
17
- Null?: TypesElement<TagType>;
18
- True?: TypesElement<TagType>;
19
- False?: TypesElement<TagType>;
20
- Date?: TypesElement<TagType>;
21
- Float?: TypesElement<TagType>;
22
- Set?: TypesElement<TagType>;
23
- Int?: TypesElement<TagType>;
24
- Map?: TypesElement<TagType>;
25
- Nan?: TypesElement<TagType>;
26
- Bigint?: TypesElement<TagType>;
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
- displayDataTypes?: boolean | undefined;
32
+ displayDataTypes?: boolean;
32
33
  Url?: TypesElement<TagType> | undefined;
33
34
  Str?: TypesElement<TagType> | undefined;
34
35
  Undefined?: 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 {};