@uiw/react-json-view 2.0.0-alpha.16 → 2.0.0-alpha.17

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/cjs/Container.js CHANGED
@@ -48,13 +48,17 @@ var Container = exports.Container = /*#__PURE__*/(0, _react.forwardRef)(function
48
48
  expandKey: subkeyid,
49
49
  value: value,
50
50
  level: level,
51
+ keys: keys,
52
+ parentValue: parentValue,
51
53
  keyName: keyName,
52
54
  initialValue: initialValue
53
55
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_KeyValues.KeyValues, {
54
56
  expandKey: subkeyid,
55
57
  value: value,
56
58
  level: level,
57
- keys: keys
59
+ keys: keys,
60
+ parentValue: parentValue,
61
+ keyName: keyName
58
62
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_NestedClose.NestedClose, {
59
63
  expandKey: subkeyid,
60
64
  value: value,
@@ -1,13 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { type TagType } from '../store/Types';
3
+ import { type SectionElementResult } from '../store/Section';
3
4
  export type CopiedOption<T extends object> = {
4
5
  value?: T;
5
6
  copied: boolean;
6
7
  setCopied: React.Dispatch<React.SetStateAction<boolean>>;
7
8
  };
8
- export interface CopiedProps<T extends object> extends React.SVGProps<SVGSVGElement> {
9
- value?: T;
10
- keyName: string | number;
9
+ export interface CopiedProps<T extends object> extends React.SVGProps<SVGSVGElement>, SectionElementResult<T> {
11
10
  expandKey: string;
12
11
  }
13
12
  export declare const Copied: {
@@ -13,12 +13,14 @@ var _store = require("../store");
13
13
  var _ShowTools = require("../store/ShowTools");
14
14
  var _Section = require("../store/Section");
15
15
  var _jsxRuntime = require("react/jsx-runtime");
16
- var _excluded = ["keyName", "value", "expandKey"],
16
+ var _excluded = ["keyName", "value", "parentValue", "expandKey", "keys"],
17
17
  _excluded2 = ["as", "render"];
18
18
  var Copied = exports.Copied = function Copied(props) {
19
19
  var keyName = props.keyName,
20
20
  value = props.value,
21
+ parentValue = props.parentValue,
21
22
  expandKey = props.expandKey,
23
+ keys = props.keys,
22
24
  other = (0, _objectWithoutProperties2["default"])(props, _excluded);
23
25
  var _useStore = (0, _store.useStore)(),
24
26
  onCopied = _useStore.onCopied,
@@ -74,7 +76,9 @@ var Copied = exports.Copied = function Copied(props) {
74
76
  'data-copied': copied
75
77
  }), {
76
78
  value: value,
77
- keyName: keyName
79
+ keyName: keyName,
80
+ keys: keys,
81
+ parentValue: parentValue
78
82
  });
79
83
  if (child) return child;
80
84
  if (copied) {
@@ -20,6 +20,7 @@ var _Row = require("../section/Row");
20
20
  var _Container = require("../Container");
21
21
  var _symbol = require("../symbol");
22
22
  var _useHighlight = require("../utils/useHighlight");
23
+ var _Copied = require("../comps/Copied");
23
24
  var _jsxRuntime = require("react/jsx-runtime");
24
25
  var KeyValues = exports.KeyValues = function KeyValues(props) {
25
26
  var _expands$expandKey;
@@ -86,6 +87,7 @@ KeyValues.displayName = 'JVR.KeyValues';
86
87
  var KayName = exports.KayName = function KayName(props) {
87
88
  var keyName = props.keyName,
88
89
  parentValue = props.parentValue,
90
+ keys = props.keys,
89
91
  value = props.value;
90
92
  var _useStore2 = (0, _store.useStore)(),
91
93
  highlightUpdates = _useStore2.highlightUpdates;
@@ -105,6 +107,7 @@ var KayName = exports.KayName = function KayName(props) {
105
107
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_KeyName.KeyNameComp, {
106
108
  keyName: keyName,
107
109
  value: value,
110
+ keys: keys,
108
111
  parentValue: parentValue,
109
112
  children: keyName
110
113
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_symbol.Quote, {
@@ -161,10 +164,16 @@ var KeyValuesItem = exports.KeyValuesItem = function KeyValuesItem(props) {
161
164
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(KayName, {
162
165
  keyName: keyName,
163
166
  value: value,
167
+ keys: keys,
164
168
  parentValue: parentValue
165
169
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Value.Value, {
170
+ keyName: keyName,
171
+ value: value
172
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Copied.Copied, {
166
173
  keyName: keyName,
167
174
  value: value,
175
+ keys: keys,
176
+ parentValue: parentValue,
168
177
  expandKey: subkeyid
169
178
  })]
170
179
  }));
@@ -1,6 +1,5 @@
1
- export interface NestedOpenProps<T extends object> {
2
- keyName?: string | number;
3
- value?: T;
1
+ import { type SectionElementResult } from '../store/Section';
2
+ export interface NestedOpenProps<T extends object> extends SectionElementResult<T> {
4
3
  initialValue?: T;
5
4
  expandKey: string;
6
5
  level: number;
@@ -22,8 +22,10 @@ var NestedOpen = exports.NestedOpen = function NestedOpen(props) {
22
22
  var _expands$expandKey;
23
23
  var keyName = props.keyName,
24
24
  expandKey = props.expandKey,
25
+ keys = props.keys,
25
26
  initialValue = props.initialValue,
26
27
  value = props.value,
28
+ parentValue = props.parentValue,
27
29
  level = props.level;
28
30
  var expands = (0, _Expands.useExpandsStore)();
29
31
  var dispatchExpands = (0, _Expands.useExpandsDispatch)();
@@ -90,7 +92,9 @@ var NestedOpen = exports.NestedOpen = function NestedOpen(props) {
90
92
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Copied.Copied, {
91
93
  keyName: keyName,
92
94
  value: value,
93
- expandKey: expandKey
95
+ expandKey: expandKey,
96
+ parentValue: parentValue,
97
+ keys: keys
94
98
  })]
95
99
  }));
96
100
  };
@@ -1,8 +1,7 @@
1
1
  export declare const isFloat: (n: number) => boolean;
2
2
  interface ValueProps {
3
- value?: unknown;
3
+ value: unknown;
4
4
  keyName: string | number;
5
- expandKey: string;
6
5
  }
7
6
  export declare const Value: {
8
7
  (props: ValueProps): import("react/jsx-runtime").JSX.Element | null;
@@ -13,11 +13,9 @@ var isFloat = exports.isFloat = function isFloat(n) {
13
13
  };
14
14
  var Value = exports.Value = function Value(props) {
15
15
  var value = props.value,
16
- keyName = props.keyName,
17
- expandKey = props.expandKey;
16
+ keyName = props.keyName;
18
17
  var reset = {
19
- keyName: keyName,
20
- expandKey: expandKey
18
+ keyName: keyName
21
19
  };
22
20
  if (value instanceof URL) {
23
21
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_types.TypeUrl, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
@@ -1,2 +1,2 @@
1
- import { SectionElementProps } from '../store/Section';
1
+ import { type SectionElementProps } from '../store/Section';
2
2
  export declare const KeyNameRender: SectionElementProps['render'];
@@ -8,7 +8,6 @@ export declare const MapComp: FC<PropsWithChildren<{
8
8
  keyName: string | number;
9
9
  }>>;
10
10
  type TypeProps = PropsWithChildren<{
11
- expandKey: string;
12
11
  keyName: string | number;
13
12
  }>;
14
13
  export declare const TypeString: FC<TypeProps>;
@@ -12,7 +12,6 @@ var _react = require("react");
12
12
  var _Types = require("../store/Types");
13
13
  var _store = require("../store");
14
14
  var _symbol = require("../symbol");
15
- var _Copied = require("../comps/Copied");
16
15
  var _jsxRuntime = require("react/jsx-runtime");
17
16
  var _excluded = ["as", "render"],
18
17
  _excluded2 = ["as", "render"],
@@ -80,7 +79,6 @@ var defalutStyle = {
80
79
  var TypeString = exports.TypeString = function TypeString(_ref3) {
81
80
  var _ref3$children = _ref3.children,
82
81
  children = _ref3$children === void 0 ? '' : _ref3$children,
83
- expandKey = _ref3.expandKey,
84
82
  keyName = _ref3.keyName;
85
83
  var _useTypesStore3 = (0, _Types.useTypesStore)(),
86
84
  _useTypesStore3$Str = _useTypesStore3.Str,
@@ -137,17 +135,12 @@ var TypeString = exports.TypeString = function TypeString(_ref3) {
137
135
  className: "w-rjv-value",
138
136
  children: text
139
137
  })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_symbol.ValueQuote, {})]
140
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Copied.Copied, {
141
- keyName: keyName,
142
- value: children,
143
- expandKey: expandKey
144
138
  })]
145
139
  });
146
140
  };
147
141
  TypeString.displayName = 'JVR.TypeString';
148
142
  var TypeTrue = exports.TypeTrue = function TypeTrue(_ref4) {
149
143
  var children = _ref4.children,
150
- expandKey = _ref4.expandKey,
151
144
  keyName = _ref4.keyName;
152
145
  var _useTypesStore4 = (0, _Types.useTypesStore)(),
153
146
  _useTypesStore4$True = _useTypesStore4.True,
@@ -180,17 +173,12 @@ var TypeTrue = exports.TypeTrue = function TypeTrue(_ref4) {
180
173
  }))), child || /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
181
174
  className: "w-rjv-value",
182
175
  children: children === null || children === void 0 ? void 0 : children.toString()
183
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Copied.Copied, {
184
- keyName: keyName,
185
- value: children,
186
- expandKey: expandKey
187
- })]
176
+ }))]
188
177
  });
189
178
  };
190
179
  TypeTrue.displayName = 'JVR.TypeTrue';
191
180
  var TypeFalse = exports.TypeFalse = function TypeFalse(_ref5) {
192
181
  var children = _ref5.children,
193
- expandKey = _ref5.expandKey,
194
182
  keyName = _ref5.keyName;
195
183
  var _useTypesStore5 = (0, _Types.useTypesStore)(),
196
184
  _useTypesStore5$False = _useTypesStore5.False,
@@ -223,17 +211,12 @@ var TypeFalse = exports.TypeFalse = function TypeFalse(_ref5) {
223
211
  }))), child || /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
224
212
  className: "w-rjv-value",
225
213
  children: children === null || children === void 0 ? void 0 : children.toString()
226
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Copied.Copied, {
227
- keyName: keyName,
228
- value: children,
229
- expandKey: expandKey
230
- })]
214
+ }))]
231
215
  });
232
216
  };
233
217
  TypeFalse.displayName = 'JVR.TypeFalse';
234
218
  var TypeFloat = exports.TypeFloat = function TypeFloat(_ref6) {
235
219
  var children = _ref6.children,
236
- expandKey = _ref6.expandKey,
237
220
  keyName = _ref6.keyName;
238
221
  var _useTypesStore6 = (0, _Types.useTypesStore)(),
239
222
  _useTypesStore6$Float = _useTypesStore6.Float,
@@ -266,17 +249,12 @@ var TypeFloat = exports.TypeFloat = function TypeFloat(_ref6) {
266
249
  }))), child || /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
267
250
  className: "w-rjv-value",
268
251
  children: children === null || children === void 0 ? void 0 : children.toString()
269
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Copied.Copied, {
270
- keyName: keyName,
271
- value: children,
272
- expandKey: expandKey
273
- })]
252
+ }))]
274
253
  });
275
254
  };
276
255
  TypeFloat.displayName = 'JVR.TypeFloat';
277
256
  var TypeInt = exports.TypeInt = function TypeInt(_ref7) {
278
257
  var children = _ref7.children,
279
- expandKey = _ref7.expandKey,
280
258
  keyName = _ref7.keyName;
281
259
  var _useTypesStore7 = (0, _Types.useTypesStore)(),
282
260
  _useTypesStore7$Int = _useTypesStore7.Int,
@@ -309,17 +287,12 @@ var TypeInt = exports.TypeInt = function TypeInt(_ref7) {
309
287
  }))), child || /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
310
288
  className: "w-rjv-value",
311
289
  children: children === null || children === void 0 ? void 0 : children.toString()
312
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Copied.Copied, {
313
- keyName: keyName,
314
- value: children,
315
- expandKey: expandKey
316
- })]
290
+ }))]
317
291
  });
318
292
  };
319
293
  TypeInt.displayName = 'JVR.TypeInt';
320
294
  var TypeBigint = exports.TypeBigint = function TypeBigint(_ref8) {
321
295
  var children = _ref8.children,
322
- expandKey = _ref8.expandKey,
323
296
  keyName = _ref8.keyName;
324
297
  var _useTypesStore8 = (0, _Types.useTypesStore)(),
325
298
  _useTypesStore8$Bigin = _useTypesStore8.Bigint,
@@ -352,17 +325,12 @@ var TypeBigint = exports.TypeBigint = function TypeBigint(_ref8) {
352
325
  }))), child || /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
353
326
  className: "w-rjv-value",
354
327
  children: (children === null || children === void 0 ? void 0 : children.toString()) + 'n'
355
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Copied.Copied, {
356
- keyName: keyName,
357
- value: children,
358
- expandKey: expandKey
359
- })]
328
+ }))]
360
329
  });
361
330
  };
362
331
  TypeBigint.displayName = 'JVR.TypeFloat';
363
332
  var TypeUrl = exports.TypeUrl = function TypeUrl(_ref9) {
364
333
  var children = _ref9.children,
365
- expandKey = _ref9.expandKey,
366
334
  keyName = _ref9.keyName;
367
335
  var _useTypesStore9 = (0, _Types.useTypesStore)(),
368
336
  _useTypesStore9$Url = _useTypesStore9.Url,
@@ -398,17 +366,12 @@ var TypeUrl = exports.TypeUrl = function TypeUrl(_ref9) {
398
366
  }, reset), {}, {
399
367
  className: "w-rjv-value",
400
368
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_symbol.ValueQuote, {}), children === null || children === void 0 ? void 0 : children.href, /*#__PURE__*/(0, _jsxRuntime.jsx)(_symbol.ValueQuote, {})]
401
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Copied.Copied, {
402
- keyName: keyName,
403
- value: children,
404
- expandKey: expandKey
405
- })]
369
+ }))]
406
370
  });
407
371
  };
408
372
  TypeUrl.displayName = 'JVR.TypeUrl';
409
373
  var TypeDate = exports.TypeDate = function TypeDate(_ref10) {
410
374
  var children = _ref10.children,
411
- expandKey = _ref10.expandKey,
412
375
  keyName = _ref10.keyName;
413
376
  var _useTypesStore10 = (0, _Types.useTypesStore)(),
414
377
  _useTypesStore10$Date = _useTypesStore10.Date,
@@ -442,17 +405,12 @@ var TypeDate = exports.TypeDate = function TypeDate(_ref10) {
442
405
  }))), child || /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
443
406
  className: "w-rjv-value",
444
407
  children: childStr
445
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Copied.Copied, {
446
- keyName: keyName,
447
- value: children,
448
- expandKey: expandKey
449
- })]
408
+ }))]
450
409
  });
451
410
  };
452
411
  TypeDate.displayName = 'JVR.TypeDate';
453
412
  var TypeUndefined = exports.TypeUndefined = function TypeUndefined(_ref11) {
454
413
  var children = _ref11.children,
455
- expandKey = _ref11.expandKey,
456
414
  keyName = _ref11.keyName;
457
415
  var _useTypesStore11 = (0, _Types.useTypesStore)(),
458
416
  _useTypesStore11$Unde = _useTypesStore11.Undefined,
@@ -482,17 +440,12 @@ var TypeUndefined = exports.TypeUndefined = function TypeUndefined(_ref11) {
482
440
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
483
441
  children: [displayDataTypes && (type || /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
484
442
  style: style
485
- }))), child, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Copied.Copied, {
486
- keyName: keyName,
487
- value: children,
488
- expandKey: expandKey
489
- })]
443
+ }))), child]
490
444
  });
491
445
  };
492
446
  TypeUndefined.displayName = 'JVR.TypeUndefined';
493
447
  var TypeNull = exports.TypeNull = function TypeNull(_ref12) {
494
448
  var children = _ref12.children,
495
- expandKey = _ref12.expandKey,
496
449
  keyName = _ref12.keyName;
497
450
  var _useTypesStore12 = (0, _Types.useTypesStore)(),
498
451
  _useTypesStore12$Null = _useTypesStore12.Null,
@@ -522,17 +475,12 @@ var TypeNull = exports.TypeNull = function TypeNull(_ref12) {
522
475
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
523
476
  children: [displayDataTypes && (type || /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
524
477
  style: style
525
- }))), child, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Copied.Copied, {
526
- keyName: keyName,
527
- value: children,
528
- expandKey: expandKey
529
- })]
478
+ }))), child]
530
479
  });
531
480
  };
532
481
  TypeNull.displayName = 'JVR.TypeNull';
533
482
  var TypeNan = exports.TypeNan = function TypeNan(_ref13) {
534
483
  var children = _ref13.children,
535
- expandKey = _ref13.expandKey,
536
484
  keyName = _ref13.keyName;
537
485
  var _useTypesStore13 = (0, _Types.useTypesStore)(),
538
486
  _useTypesStore13$Nan = _useTypesStore13.Nan,
@@ -562,11 +510,7 @@ var TypeNan = exports.TypeNan = function TypeNan(_ref13) {
562
510
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
563
511
  children: [displayDataTypes && (type || /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
564
512
  style: style
565
- }))), child, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Copied.Copied, {
566
- keyName: keyName,
567
- value: children,
568
- expandKey: expandKey
569
- })]
513
+ }))), child]
570
514
  });
571
515
  };
572
516
  TypeNan.displayName = 'JVR.TypeNan';
package/esm/Container.js CHANGED
@@ -11,6 +11,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
11
11
  export var Container = /*#__PURE__*/forwardRef((props, ref) => {
12
12
  var {
13
13
  className = '',
14
+ parentValue,
14
15
  level = 1,
15
16
  value,
16
17
  initialValue,
@@ -37,13 +38,17 @@ export var Container = /*#__PURE__*/forwardRef((props, ref) => {
37
38
  expandKey: subkeyid,
38
39
  value: value,
39
40
  level: level,
41
+ keys: keys,
42
+ parentValue: parentValue,
40
43
  keyName: keyName,
41
44
  initialValue: initialValue
42
45
  }), /*#__PURE__*/_jsx(KeyValues, {
43
46
  expandKey: subkeyid,
44
47
  value: value,
45
48
  level: level,
46
- keys: keys
49
+ keys: keys,
50
+ parentValue: parentValue,
51
+ keyName: keyName
47
52
  }), /*#__PURE__*/_jsx(NestedClose, {
48
53
  expandKey: subkeyid,
49
54
  value: value,
@@ -1,13 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { type TagType } from '../store/Types';
3
+ import { type SectionElementResult } from '../store/Section';
3
4
  export type CopiedOption<T extends object> = {
4
5
  value?: T;
5
6
  copied: boolean;
6
7
  setCopied: React.Dispatch<React.SetStateAction<boolean>>;
7
8
  };
8
- export interface CopiedProps<T extends object> extends React.SVGProps<SVGSVGElement> {
9
- value?: T;
10
- keyName: string | number;
9
+ export interface CopiedProps<T extends object> extends React.SVGProps<SVGSVGElement>, SectionElementResult<T> {
11
10
  expandKey: string;
12
11
  }
13
12
  export declare const Copied: {
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["keyName", "value", "expandKey"],
3
+ var _excluded = ["keyName", "value", "parentValue", "expandKey", "keys"],
4
4
  _excluded2 = ["as", "render"];
5
5
  import { useState } from 'react';
6
6
  import { useStore } from '../store';
@@ -11,7 +11,9 @@ export var Copied = props => {
11
11
  var {
12
12
  keyName,
13
13
  value,
14
- expandKey
14
+ parentValue,
15
+ expandKey,
16
+ keys
15
17
  } = props,
16
18
  other = _objectWithoutPropertiesLoose(props, _excluded);
17
19
  var {
@@ -67,7 +69,9 @@ export var Copied = props => {
67
69
  'data-copied': copied
68
70
  }), {
69
71
  value,
70
- keyName
72
+ keyName,
73
+ keys,
74
+ parentValue
71
75
  });
72
76
  if (child) return child;
73
77
  if (copied) {
@@ -9,6 +9,7 @@ import { RowComp } from '../section/Row';
9
9
  import { Container } from '../Container';
10
10
  import { Quote, Colon } from '../symbol';
11
11
  import { useHighlight } from '../utils/useHighlight';
12
+ import { Copied } from '../comps/Copied';
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
15
  export var KeyValues = props => {
@@ -68,6 +69,7 @@ export var KayName = props => {
68
69
  var {
69
70
  keyName,
70
71
  parentValue,
72
+ keys,
71
73
  value
72
74
  } = props;
73
75
  var {
@@ -89,6 +91,7 @@ export var KayName = props => {
89
91
  }), /*#__PURE__*/_jsx(KeyNameComp, {
90
92
  keyName: keyName,
91
93
  value: value,
94
+ keys: keys,
92
95
  parentValue: parentValue,
93
96
  children: keyName
94
97
  }), /*#__PURE__*/_jsx(Quote, {
@@ -145,10 +148,16 @@ export var KeyValuesItem = props => {
145
148
  children: [/*#__PURE__*/_jsx(KayName, {
146
149
  keyName: keyName,
147
150
  value: value,
151
+ keys: keys,
148
152
  parentValue: parentValue
149
153
  }), /*#__PURE__*/_jsx(Value, {
154
+ keyName: keyName,
155
+ value: value
156
+ }), /*#__PURE__*/_jsx(Copied, {
150
157
  keyName: keyName,
151
158
  value: value,
159
+ keys: keys,
160
+ parentValue: parentValue,
152
161
  expandKey: subkeyid
153
162
  })]
154
163
  }));
@@ -1,6 +1,5 @@
1
- export interface NestedOpenProps<T extends object> {
2
- keyName?: string | number;
3
- value?: T;
1
+ import { type SectionElementResult } from '../store/Section';
2
+ export interface NestedOpenProps<T extends object> extends SectionElementResult<T> {
4
3
  initialValue?: T;
5
4
  expandKey: string;
6
5
  level: number;
@@ -15,8 +15,10 @@ export var NestedOpen = props => {
15
15
  var {
16
16
  keyName,
17
17
  expandKey,
18
+ keys,
18
19
  initialValue,
19
20
  value,
21
+ parentValue,
20
22
  level
21
23
  } = props;
22
24
  var expands = useExpandsStore();
@@ -87,7 +89,9 @@ export var NestedOpen = props => {
87
89
  }), /*#__PURE__*/_jsx(Copied, {
88
90
  keyName: keyName,
89
91
  value: value,
90
- expandKey: expandKey
92
+ expandKey: expandKey,
93
+ parentValue: parentValue,
94
+ keys: keys
91
95
  })]
92
96
  }));
93
97
  };
@@ -1,8 +1,7 @@
1
1
  export declare const isFloat: (n: number) => boolean;
2
2
  interface ValueProps {
3
- value?: unknown;
3
+ value: unknown;
4
4
  keyName: string | number;
5
- expandKey: string;
6
5
  }
7
6
  export declare const Value: {
8
7
  (props: ValueProps): import("react/jsx-runtime").JSX.Element | null;
@@ -5,12 +5,10 @@ export var isFloat = n => Number(n) === n && n % 1 !== 0 || isNaN(n);
5
5
  export var Value = props => {
6
6
  var {
7
7
  value,
8
- keyName,
9
- expandKey
8
+ keyName
10
9
  } = props;
11
10
  var reset = {
12
- keyName,
13
- expandKey
11
+ keyName
14
12
  };
15
13
  if (value instanceof URL) {
16
14
  return /*#__PURE__*/_jsx(TypeUrl, _extends({}, reset, {
@@ -1,2 +1,2 @@
1
- import { SectionElementProps } from '../store/Section';
1
+ import { type SectionElementProps } from '../store/Section';
2
2
  export declare const KeyNameRender: SectionElementProps['render'];
@@ -8,7 +8,6 @@ export declare const MapComp: FC<PropsWithChildren<{
8
8
  keyName: string | number;
9
9
  }>>;
10
10
  type TypeProps = PropsWithChildren<{
11
- expandKey: string;
12
11
  keyName: string | number;
13
12
  }>;
14
13
  export declare const TypeString: FC<TypeProps>;
@@ -17,7 +17,6 @@ import { Fragment, useEffect, useState } from 'react';
17
17
  import { useTypesStore } from '../store/Types';
18
18
  import { useStore } from '../store';
19
19
  import { ValueQuote } from '../symbol';
20
- import { Copied } from '../comps/Copied';
21
20
  import { jsx as _jsx } from "react/jsx-runtime";
22
21
  import { jsxs as _jsxs } from "react/jsx-runtime";
23
22
  export var SetComp = _ref => {
@@ -81,7 +80,6 @@ var defalutStyle = {
81
80
  export var TypeString = _ref3 => {
82
81
  var {
83
82
  children = '',
84
- expandKey,
85
83
  keyName
86
84
  } = _ref3;
87
85
  var {
@@ -136,10 +134,6 @@ export var TypeString = _ref3 => {
136
134
  className: "w-rjv-value",
137
135
  children: text
138
136
  })), /*#__PURE__*/_jsx(ValueQuote, {})]
139
- }), /*#__PURE__*/_jsx(Copied, {
140
- keyName: keyName,
141
- value: children,
142
- expandKey: expandKey
143
137
  })]
144
138
  });
145
139
  };
@@ -147,7 +141,6 @@ TypeString.displayName = 'JVR.TypeString';
147
141
  export var TypeTrue = _ref4 => {
148
142
  var {
149
143
  children,
150
- expandKey,
151
144
  keyName
152
145
  } = _ref4;
153
146
  var {
@@ -183,18 +176,13 @@ export var TypeTrue = _ref4 => {
183
176
  }))), child || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {
184
177
  className: "w-rjv-value",
185
178
  children: children == null ? void 0 : children.toString()
186
- })), /*#__PURE__*/_jsx(Copied, {
187
- keyName: keyName,
188
- value: children,
189
- expandKey: expandKey
190
- })]
179
+ }))]
191
180
  });
192
181
  };
193
182
  TypeTrue.displayName = 'JVR.TypeTrue';
194
183
  export var TypeFalse = _ref5 => {
195
184
  var {
196
185
  children,
197
- expandKey,
198
186
  keyName
199
187
  } = _ref5;
200
188
  var {
@@ -230,18 +218,13 @@ export var TypeFalse = _ref5 => {
230
218
  }))), child || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {
231
219
  className: "w-rjv-value",
232
220
  children: children == null ? void 0 : children.toString()
233
- })), /*#__PURE__*/_jsx(Copied, {
234
- keyName: keyName,
235
- value: children,
236
- expandKey: expandKey
237
- })]
221
+ }))]
238
222
  });
239
223
  };
240
224
  TypeFalse.displayName = 'JVR.TypeFalse';
241
225
  export var TypeFloat = _ref6 => {
242
226
  var {
243
227
  children,
244
- expandKey,
245
228
  keyName
246
229
  } = _ref6;
247
230
  var {
@@ -277,18 +260,13 @@ export var TypeFloat = _ref6 => {
277
260
  }))), child || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {
278
261
  className: "w-rjv-value",
279
262
  children: children == null ? void 0 : children.toString()
280
- })), /*#__PURE__*/_jsx(Copied, {
281
- keyName: keyName,
282
- value: children,
283
- expandKey: expandKey
284
- })]
263
+ }))]
285
264
  });
286
265
  };
287
266
  TypeFloat.displayName = 'JVR.TypeFloat';
288
267
  export var TypeInt = _ref7 => {
289
268
  var {
290
269
  children,
291
- expandKey,
292
270
  keyName
293
271
  } = _ref7;
294
272
  var {
@@ -324,18 +302,13 @@ export var TypeInt = _ref7 => {
324
302
  }))), child || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {
325
303
  className: "w-rjv-value",
326
304
  children: children == null ? void 0 : children.toString()
327
- })), /*#__PURE__*/_jsx(Copied, {
328
- keyName: keyName,
329
- value: children,
330
- expandKey: expandKey
331
- })]
305
+ }))]
332
306
  });
333
307
  };
334
308
  TypeInt.displayName = 'JVR.TypeInt';
335
309
  export var TypeBigint = _ref8 => {
336
310
  var {
337
311
  children,
338
- expandKey,
339
312
  keyName
340
313
  } = _ref8;
341
314
  var {
@@ -371,18 +344,13 @@ export var TypeBigint = _ref8 => {
371
344
  }))), child || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {
372
345
  className: "w-rjv-value",
373
346
  children: (children == null ? void 0 : children.toString()) + 'n'
374
- })), /*#__PURE__*/_jsx(Copied, {
375
- keyName: keyName,
376
- value: children,
377
- expandKey: expandKey
378
- })]
347
+ }))]
379
348
  });
380
349
  };
381
350
  TypeBigint.displayName = 'JVR.TypeFloat';
382
351
  export var TypeUrl = _ref9 => {
383
352
  var {
384
353
  children,
385
- expandKey,
386
354
  keyName
387
355
  } = _ref9;
388
356
  var {
@@ -421,18 +389,13 @@ export var TypeUrl = _ref9 => {
421
389
  }, reset, {
422
390
  className: "w-rjv-value",
423
391
  children: [/*#__PURE__*/_jsx(ValueQuote, {}), children == null ? void 0 : children.href, /*#__PURE__*/_jsx(ValueQuote, {})]
424
- })), /*#__PURE__*/_jsx(Copied, {
425
- keyName: keyName,
426
- value: children,
427
- expandKey: expandKey
428
- })]
392
+ }))]
429
393
  });
430
394
  };
431
395
  TypeUrl.displayName = 'JVR.TypeUrl';
432
396
  export var TypeDate = _ref10 => {
433
397
  var {
434
398
  children,
435
- expandKey,
436
399
  keyName
437
400
  } = _ref10;
438
401
  var {
@@ -469,18 +432,13 @@ export var TypeDate = _ref10 => {
469
432
  }))), child || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {
470
433
  className: "w-rjv-value",
471
434
  children: childStr
472
- })), /*#__PURE__*/_jsx(Copied, {
473
- keyName: keyName,
474
- value: children,
475
- expandKey: expandKey
476
- })]
435
+ }))]
477
436
  });
478
437
  };
479
438
  TypeDate.displayName = 'JVR.TypeDate';
480
439
  export var TypeUndefined = _ref11 => {
481
440
  var {
482
441
  children,
483
- expandKey,
484
442
  keyName
485
443
  } = _ref11;
486
444
  var {
@@ -513,18 +471,13 @@ export var TypeUndefined = _ref11 => {
513
471
  return /*#__PURE__*/_jsxs(Fragment, {
514
472
  children: [displayDataTypes && (type || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {
515
473
  style: style
516
- }))), child, /*#__PURE__*/_jsx(Copied, {
517
- keyName: keyName,
518
- value: children,
519
- expandKey: expandKey
520
- })]
474
+ }))), child]
521
475
  });
522
476
  };
523
477
  TypeUndefined.displayName = 'JVR.TypeUndefined';
524
478
  export var TypeNull = _ref12 => {
525
479
  var {
526
480
  children,
527
- expandKey,
528
481
  keyName
529
482
  } = _ref12;
530
483
  var {
@@ -557,18 +510,13 @@ export var TypeNull = _ref12 => {
557
510
  return /*#__PURE__*/_jsxs(Fragment, {
558
511
  children: [displayDataTypes && (type || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {
559
512
  style: style
560
- }))), child, /*#__PURE__*/_jsx(Copied, {
561
- keyName: keyName,
562
- value: children,
563
- expandKey: expandKey
564
- })]
513
+ }))), child]
565
514
  });
566
515
  };
567
516
  TypeNull.displayName = 'JVR.TypeNull';
568
517
  export var TypeNan = _ref13 => {
569
518
  var {
570
519
  children,
571
- expandKey,
572
520
  keyName
573
521
  } = _ref13;
574
522
  var {
@@ -601,11 +549,7 @@ export var TypeNan = _ref13 => {
601
549
  return /*#__PURE__*/_jsxs(Fragment, {
602
550
  children: [displayDataTypes && (type || /*#__PURE__*/_jsx(Comp, _extends({}, reset, {
603
551
  style: style
604
- }))), child, /*#__PURE__*/_jsx(Copied, {
605
- keyName: keyName,
606
- value: children,
607
- expandKey: expandKey
608
- })]
552
+ }))), child]
609
553
  });
610
554
  };
611
555
  TypeNan.displayName = 'JVR.TypeNan';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uiw/react-json-view",
3
- "version": "2.0.0-alpha.16",
3
+ "version": "2.0.0-alpha.17",
4
4
  "description": "JSON viewer for react.",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",