@uiw/react-json-view 2.0.0-alpha.7 → 2.0.0-alpha.9

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 (77) hide show
  1. package/README.md +3 -3
  2. package/cjs/Container.js +1 -2
  3. package/cjs/comps/Copied.js +1 -2
  4. package/cjs/comps/KeyValues.js +7 -7
  5. package/cjs/comps/NestedClose.js +1 -2
  6. package/cjs/comps/NestedOpen.js +5 -4
  7. package/cjs/comps/Value.js +2 -4
  8. package/cjs/editor/KeyName.d.ts +2 -0
  9. package/cjs/editor/KeyName.js +82 -0
  10. package/cjs/editor/index.d.ts +19 -0
  11. package/cjs/editor/index.js +44 -0
  12. package/cjs/editor/store.d.ts +28 -0
  13. package/cjs/editor/store.js +23 -0
  14. package/cjs/index.js +1 -2
  15. package/cjs/section/Copied.js +1 -2
  16. package/cjs/section/CountInfo.js +2 -4
  17. package/cjs/section/CountInfoExtra.js +2 -4
  18. package/cjs/section/Ellipsis.js +2 -4
  19. package/cjs/section/KeyName.d.ts +1 -0
  20. package/cjs/section/KeyName.js +4 -4
  21. package/cjs/store/Expands.js +2 -4
  22. package/cjs/store/Section.d.ts +1 -0
  23. package/cjs/store/Section.js +2 -4
  24. package/cjs/store/ShowTools.js +2 -4
  25. package/cjs/store/Symbols.js +2 -4
  26. package/cjs/store/Types.d.ts +1 -0
  27. package/cjs/store/Types.js +1 -2
  28. package/cjs/store.js +5 -10
  29. package/cjs/symbol/Arrow.js +1 -2
  30. package/cjs/symbol/BraceLeft.js +1 -2
  31. package/cjs/symbol/BraceRight.js +1 -2
  32. package/cjs/symbol/BracketsLeft.js +1 -2
  33. package/cjs/symbol/BracketsRight.js +1 -2
  34. package/cjs/symbol/Colon.js +1 -2
  35. package/cjs/symbol/Quote.js +1 -2
  36. package/cjs/symbol/ValueQuote.js +1 -2
  37. package/cjs/symbol/index.js +6 -12
  38. package/cjs/theme/basic.js +2 -3
  39. package/cjs/theme/dark.js +2 -3
  40. package/cjs/theme/github.dark.js +2 -3
  41. package/cjs/theme/github.light.js +2 -3
  42. package/cjs/theme/gruvbox.js +2 -3
  43. package/cjs/theme/light.js +2 -3
  44. package/cjs/theme/monokai.js +2 -3
  45. package/cjs/theme/nord.js +2 -3
  46. package/cjs/theme/vscode.js +2 -3
  47. package/cjs/types/Bigint.js +1 -2
  48. package/cjs/types/Date.js +1 -2
  49. package/cjs/types/False.js +1 -2
  50. package/cjs/types/Float.js +1 -2
  51. package/cjs/types/Int.js +1 -2
  52. package/cjs/types/Map.js +1 -2
  53. package/cjs/types/Nan.js +1 -2
  54. package/cjs/types/Null.js +1 -2
  55. package/cjs/types/Set.js +1 -2
  56. package/cjs/types/String.js +1 -2
  57. package/cjs/types/True.js +1 -2
  58. package/cjs/types/Undefined.js +1 -2
  59. package/cjs/types/Url.js +1 -2
  60. package/cjs/types/index.d.ts +2 -0
  61. package/cjs/types/index.js +65 -52
  62. package/editor.d.ts +22 -20
  63. package/esm/comps/KeyValues.js +4 -1
  64. package/esm/comps/NestedOpen.js +4 -2
  65. package/esm/editor/KeyName.d.ts +2 -0
  66. package/esm/editor/KeyName.js +77 -0
  67. package/esm/editor/index.d.ts +19 -0
  68. package/esm/editor/index.js +34 -0
  69. package/esm/editor/store.d.ts +28 -0
  70. package/esm/editor/store.js +13 -0
  71. package/esm/section/KeyName.d.ts +1 -0
  72. package/esm/section/KeyName.js +2 -0
  73. package/esm/store/Section.d.ts +1 -0
  74. package/esm/store/Types.d.ts +1 -0
  75. package/esm/types/index.d.ts +2 -0
  76. package/esm/types/index.js +52 -26
  77. package/package.json +2 -4
package/README.md CHANGED
@@ -324,13 +324,13 @@ export default function Demo() {
324
324
  }}
325
325
  >
326
326
  <JsonView.String
327
- render={({ children, ...reset }, { type }) => {
328
- const isImg = /^https?.*\.(jpg|png)$/i.test(children)
327
+ render={({ children, ...reset }, { type, value, keyName }) => {
328
+ const isImg = /^https?.*\.(jpg|png)$/i.test(value)
329
329
  if (type === 'type' && isImg) {
330
330
  return <span />
331
331
  }
332
332
  if (type === 'value' && isImg) {
333
- return <img {...reset} height="26" src={children} />
333
+ return <img {...reset} height="26" src={value} />
334
334
  }
335
335
  }}
336
336
  />
package/cjs/Container.js CHANGED
@@ -16,7 +16,7 @@ var _KeyValues = require("./comps/KeyValues");
16
16
  var _ShowTools = require("./store/ShowTools");
17
17
  var _jsxRuntime = require("react/jsx-runtime");
18
18
  var _excluded = ["className", "children", "parentValue", "keyid", "level", "value", "initialValue", "keyName"];
19
- var Container = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
19
+ var Container = exports.Container = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
20
20
  var _props$className = props.className,
21
21
  className = _props$className === void 0 ? '' : _props$className,
22
22
  children = props.children,
@@ -60,5 +60,4 @@ var Container = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
60
60
  })]
61
61
  }));
62
62
  });
63
- exports.Container = Container;
64
63
  Container.displayName = 'JVR.Container';
@@ -15,7 +15,7 @@ var _Section = require("../store/Section");
15
15
  var _jsxRuntime = require("react/jsx-runtime");
16
16
  var _excluded = ["keyName", "value", "expandKey"],
17
17
  _excluded2 = ["as", "render"];
18
- var Copied = function Copied(props) {
18
+ var Copied = exports.Copied = function Copied(props) {
19
19
  var keyName = props.keyName,
20
20
  value = props.value,
21
21
  expandKey = props.expandKey,
@@ -89,5 +89,4 @@ var Copied = function Copied(props) {
89
89
  })
90
90
  }));
91
91
  };
92
- exports.Copied = Copied;
93
92
  Copied.displayName = 'JVR.Copied';
@@ -19,7 +19,7 @@ var _Container = require("../Container");
19
19
  var _symbol = require("../symbol");
20
20
  var _useHighlight = require("../utils/useHighlight");
21
21
  var _jsxRuntime = require("react/jsx-runtime");
22
- var KeyValues = function KeyValues(props) {
22
+ var KeyValues = exports.KeyValues = function KeyValues(props) {
23
23
  var _expands$expandKey;
24
24
  var value = props.value,
25
25
  _props$expandKey = props.expandKey,
@@ -77,10 +77,10 @@ var KeyValues = function KeyValues(props) {
77
77
  })
78
78
  });
79
79
  };
80
- exports.KeyValues = KeyValues;
81
80
  KeyValues.displayName = 'JVR.KeyValues';
82
- var KayName = function KayName(props) {
81
+ var KayName = exports.KayName = function KayName(props) {
83
82
  var keyName = props.keyName,
83
+ parentValue = props.parentValue,
84
84
  value = props.value;
85
85
  var _useStore2 = (0, _store.useStore)(),
86
86
  highlightUpdates = _useStore2.highlightUpdates;
@@ -100,6 +100,7 @@ var KayName = function KayName(props) {
100
100
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_KeyName.KeyNameComp, {
101
101
  keyName: keyName,
102
102
  value: value,
103
+ parentValue: parentValue,
103
104
  children: keyName
104
105
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_symbol.Quote, {
105
106
  isNumber: isNumber,
@@ -108,9 +109,8 @@ var KayName = function KayName(props) {
108
109
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_symbol.Colon, {})]
109
110
  });
110
111
  };
111
- exports.KayName = KayName;
112
112
  KayName.displayName = 'JVR.KayName';
113
- var KeyValuesItem = function KeyValuesItem(props) {
113
+ var KeyValuesItem = exports.KeyValuesItem = function KeyValuesItem(props) {
114
114
  var keyName = props.keyName,
115
115
  value = props.value,
116
116
  parentValue = props.parentValue,
@@ -148,7 +148,8 @@ var KeyValuesItem = function KeyValuesItem(props) {
148
148
  }, reset), {}, {
149
149
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(KayName, {
150
150
  keyName: keyName,
151
- value: value
151
+ value: value,
152
+ parentValue: parentValue
152
153
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Value.Value, {
153
154
  keyName: keyName,
154
155
  value: value,
@@ -156,5 +157,4 @@ var KeyValuesItem = function KeyValuesItem(props) {
156
157
  })]
157
158
  }));
158
159
  };
159
- exports.KeyValuesItem = KeyValuesItem;
160
160
  KeyValuesItem.displayName = 'JVR.KeyValuesItem';
@@ -8,7 +8,7 @@ var _store = require("../store");
8
8
  var _Expands = require("../store/Expands");
9
9
  var _symbol = require("../symbol");
10
10
  var _jsxRuntime = require("react/jsx-runtime");
11
- var NestedClose = function NestedClose(props) {
11
+ var NestedClose = exports.NestedClose = function NestedClose(props) {
12
12
  var _expands$expandKey;
13
13
  var value = props.value,
14
14
  expandKey = props.expandKey,
@@ -34,5 +34,4 @@ var NestedClose = function NestedClose(props) {
34
34
  })
35
35
  });
36
36
  };
37
- exports.NestedClose = NestedClose;
38
37
  NestedClose.displayName = 'JVR.NestedClose';
@@ -18,7 +18,7 @@ var _symbol = require("../symbol");
18
18
  var _Ellipsis = require("../section/Ellipsis");
19
19
  var _types = require("../types");
20
20
  var _jsxRuntime = require("react/jsx-runtime");
21
- var NestedOpen = function NestedOpen(props) {
21
+ var NestedOpen = exports.NestedOpen = function NestedOpen(props) {
22
22
  var _expands$expandKey;
23
23
  var keyName = props.keyName,
24
24
  expandKey = props.expandKey,
@@ -67,9 +67,11 @@ var NestedOpen = function NestedOpen(props) {
67
67
  }), (keyName || typeof keyName === 'number') && /*#__PURE__*/(0, _jsxRuntime.jsx)(_KeyValues.KayName, {
68
68
  keyName: keyName
69
69
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_types.SetComp, {
70
- value: initialValue
70
+ value: initialValue,
71
+ keyName: keyName
71
72
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_types.MapComp, {
72
- value: initialValue
73
+ value: initialValue,
74
+ keyName: keyName
73
75
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_symbol.BracketsOpen, {
74
76
  isBrackets: isArray || isMySet
75
77
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Ellipsis.EllipsisComp, {
@@ -92,5 +94,4 @@ var NestedOpen = function NestedOpen(props) {
92
94
  })]
93
95
  }));
94
96
  };
95
- exports.NestedOpen = NestedOpen;
96
97
  NestedOpen.displayName = 'JVR.NestedOpen';
@@ -8,11 +8,10 @@ exports.isFloat = exports.Value = void 0;
8
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
9
  var _types = require("../types");
10
10
  var _jsxRuntime = require("react/jsx-runtime");
11
- var isFloat = function isFloat(n) {
11
+ var isFloat = exports.isFloat = function isFloat(n) {
12
12
  return Number(n) === n && n % 1 !== 0 || isNaN(n);
13
13
  };
14
- exports.isFloat = isFloat;
15
- var Value = function Value(props) {
14
+ var Value = exports.Value = function Value(props) {
16
15
  var value = props.value,
17
16
  keyName = props.keyName,
18
17
  expandKey = props.expandKey;
@@ -74,5 +73,4 @@ var Value = function Value(props) {
74
73
  }
75
74
  return null;
76
75
  };
77
- exports.Value = Value;
78
76
  Value.displayName = 'JVR.Value';
@@ -0,0 +1,2 @@
1
+ import { SectionElementProps } from '../store/Section';
2
+ export declare const KeyNameRender: SectionElementProps['render'];
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.KeyNameRender = void 0;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _react = require("react");
12
+ var _store = require("./store");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ var _excluded = ["children"],
15
+ _excluded2 = ["value", "parentValue", "keyName"];
16
+ var KeyNameRender = exports.KeyNameRender = function KeyNameRender(_ref, _ref2) {
17
+ var children = _ref.children,
18
+ reset = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
19
+ var value = _ref2.value,
20
+ parentValue = _ref2.parentValue,
21
+ keyName = _ref2.keyName;
22
+ if (typeof children === 'number') {
23
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
24
+ children: children
25
+ }));
26
+ }
27
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Child, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
28
+ value: value,
29
+ parentValue: parentValue,
30
+ keyName: keyName,
31
+ children: children
32
+ }));
33
+ };
34
+ var Child = function Child(props) {
35
+ var value = props.value,
36
+ parentValue = props.parentValue,
37
+ keyName = props.keyName,
38
+ reset = (0, _objectWithoutProperties2["default"])(props, _excluded2);
39
+ var $dom = (0, _react.useRef)(null);
40
+ var _useState = (0, _react.useState)(props.children),
41
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
42
+ currentValue = _useState2[0],
43
+ setCurrentValue = _useState2[1];
44
+ var _useStore = (0, _store.useStore)(),
45
+ onEdit = _useStore.onEdit;
46
+ var onKeyDown = function onKeyDown(evn) {
47
+ if (evn.key === 'Enter') {
48
+ var _$dom$current;
49
+ (_$dom$current = $dom.current) === null || _$dom$current === void 0 || _$dom$current.setAttribute('contentEditable', 'false');
50
+ }
51
+ };
52
+ var onClick = function onClick(evn) {
53
+ var _$dom$current2, _$dom$current3;
54
+ evn.stopPropagation();
55
+ (_$dom$current2 = $dom.current) === null || _$dom$current2 === void 0 || _$dom$current2.setAttribute('contentEditable', 'true');
56
+ (_$dom$current3 = $dom.current) === null || _$dom$current3 === void 0 || _$dom$current3.focus();
57
+ };
58
+ var onBlur = function onBlur(evn) {
59
+ var _$dom$current4;
60
+ (_$dom$current4 = $dom.current) === null || _$dom$current4 === void 0 || _$dom$current4.setAttribute('contentEditable', 'false');
61
+ var callback = onEdit && onEdit({
62
+ value: evn.target.textContent,
63
+ oldValue: value,
64
+ keyName: keyName
65
+ });
66
+ if (callback) {
67
+ setCurrentValue(evn.target.textContent);
68
+ }
69
+ };
70
+ var spanProps = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
71
+ onKeyDown: onKeyDown,
72
+ onClick: onClick,
73
+ onBlur: onBlur,
74
+ spellCheck: false,
75
+ contentEditable: 'false',
76
+ suppressContentEditableWarning: true,
77
+ children: currentValue
78
+ });
79
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spanProps), {}, {
80
+ ref: $dom
81
+ }));
82
+ };
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import { type JsonViewProps } from '../';
3
+ export interface JsonViewEditorProps<T extends object> extends Omit<JsonViewProps<T>, 'shortenTextAfterLength'> {
4
+ /**
5
+ * When a callback function is passed in, edit functionality is enabled. The callback is invoked before edits are completed.
6
+ * @returns {boolean} Returning false from onEdit will prevent the change from being made.
7
+ */
8
+ onEdit?: (option: {
9
+ value: unknown;
10
+ oldValue: unknown;
11
+ keyName?: string | number;
12
+ parentName?: string | number;
13
+ type?: 'value' | 'key';
14
+ }) => boolean;
15
+ /** Whether enable edit feature. @default true */
16
+ editable?: boolean;
17
+ }
18
+ declare const JsonViewEditor: import("react").ForwardRefExoticComponent<Omit<JsonViewEditorProps<object>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
19
+ export default JsonViewEditor;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _react = require("react");
12
+ var _ = _interopRequireDefault(require("../"));
13
+ var _KeyName = require("./KeyName");
14
+ var _store = require("./store");
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
+ var _excluded = ["children", "onEdit", "editable"];
17
+ var JsonViewEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
18
+ var children = props.children,
19
+ onEdit = props.onEdit,
20
+ _props$editable = props.editable,
21
+ editable = _props$editable === void 0 ? true : _props$editable,
22
+ reset = (0, _objectWithoutProperties2["default"])(props, _excluded);
23
+ var _useStoreReducer = (0, _store.useStoreReducer)({
24
+ onEdit: onEdit
25
+ }),
26
+ _useStoreReducer2 = (0, _slicedToArray2["default"])(_useStoreReducer, 2),
27
+ state = _useStoreReducer2[0],
28
+ dispatch = _useStoreReducer2[1];
29
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_store.Context.Provider, {
30
+ value: state,
31
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_store.Dispatch.Provider, {
32
+ value: dispatch,
33
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
34
+ shortenTextAfterLength: 0,
35
+ ref: ref,
36
+ children: [editable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"].KeyName, {
37
+ render: _KeyName.KeyNameRender
38
+ }), children]
39
+ }))
40
+ })
41
+ });
42
+ });
43
+ var _default = exports["default"] = JsonViewEditor;
44
+ module.exports = exports.default;
@@ -0,0 +1,28 @@
1
+ /// <reference types="react" />
2
+ type InitialState = {
3
+ /**
4
+ * When a callback function is passed in, edit functionality is enabled. The callback is invoked before edits are completed.
5
+ * @returns {boolean} Returning false from onEdit will prevent the change from being made.
6
+ */
7
+ onEdit?: (option: {
8
+ value: unknown;
9
+ oldValue: unknown;
10
+ keyName?: string | number;
11
+ parentName?: string | number;
12
+ type?: 'value' | 'key';
13
+ }) => boolean;
14
+ };
15
+ type Dispatch = React.Dispatch<InitialState>;
16
+ export declare const Context: import("react").Context<InitialState>;
17
+ export declare const Dispatch: import("react").Context<Dispatch>;
18
+ export declare const useStore: () => InitialState;
19
+ export declare function useStoreReducer(initialState: InitialState): [{
20
+ onEdit?: ((option: {
21
+ value: unknown;
22
+ oldValue: unknown;
23
+ keyName?: string | number | undefined;
24
+ parentName?: string | number | undefined;
25
+ type?: "value" | "key" | undefined;
26
+ }) => boolean) | undefined;
27
+ }, import("react").Dispatch<InitialState>];
28
+ export {};
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useStore = exports.Dispatch = exports.Context = void 0;
8
+ exports.useStoreReducer = useStoreReducer;
9
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
+ var _react = require("react");
11
+ var initialState = {};
12
+ var Context = exports.Context = /*#__PURE__*/(0, _react.createContext)(initialState);
13
+ var reducer = function reducer(state, action) {
14
+ return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), action);
15
+ };
16
+ var Dispatch = exports.Dispatch = /*#__PURE__*/(0, _react.createContext)(function () {});
17
+ Dispatch.displayName = 'JVR.Editor.Dispatch';
18
+ var useStore = exports.useStore = function useStore() {
19
+ return (0, _react.useContext)(Context);
20
+ };
21
+ function useStoreReducer(initialState) {
22
+ return (0, _react.useReducer)(reducer, initialState);
23
+ }
package/cjs/index.js CHANGED
@@ -192,5 +192,4 @@ JsonView.CountInfo = _CountInfo.CountInfo;
192
192
  JsonView.CountInfoExtra = _CountInfoExtra.CountInfoExtra;
193
193
  JsonView.KeyName = _KeyName.KeyName;
194
194
  JsonView.displayName = 'JVR.JsonView';
195
- var _default = JsonView;
196
- exports["default"] = _default;
195
+ var _default = exports["default"] = JsonView;
@@ -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';
@@ -13,16 +13,15 @@ var _store = require("../store");
13
13
  var _jsxRuntime = require("react/jsx-runtime");
14
14
  var _excluded = ["value", "keyName"],
15
15
  _excluded2 = ["as", "render"];
16
- var CountInfo = function CountInfo(props) {
16
+ var CountInfo = exports.CountInfo = function CountInfo(props) {
17
17
  var _useSectionStore = (0, _Section.useSectionStore)(),
18
18
  _useSectionStore$Coun = _useSectionStore.CountInfo,
19
19
  Comp = _useSectionStore$Coun === void 0 ? {} : _useSectionStore$Coun;
20
20
  (0, _useRender.useSectionRender)(Comp, props, 'CountInfo');
21
21
  return null;
22
22
  };
23
- exports.CountInfo = CountInfo;
24
23
  CountInfo.displayName = 'JVR.CountInfo';
25
- var CountInfoComp = function CountInfoComp(props) {
24
+ var CountInfoComp = exports.CountInfoComp = function CountInfoComp(props) {
26
25
  var _props$value = props.value,
27
26
  value = _props$value === void 0 ? {} : _props$value,
28
27
  keyName = props.keyName,
@@ -53,5 +52,4 @@ var CountInfoComp = function CountInfoComp(props) {
53
52
  if (child) return child;
54
53
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Elm, (0, _objectSpread2["default"])({}, elmProps));
55
54
  };
56
- exports.CountInfoComp = CountInfoComp;
57
55
  CountInfoComp.displayName = 'JVR.CountInfoComp';
@@ -12,16 +12,15 @@ var _useRender = require("../utils/useRender");
12
12
  var _jsxRuntime = require("react/jsx-runtime");
13
13
  var _excluded = ["value", "keyName"],
14
14
  _excluded2 = ["as", "render"];
15
- var CountInfoExtra = function CountInfoExtra(props) {
15
+ var CountInfoExtra = exports.CountInfoExtra = function CountInfoExtra(props) {
16
16
  var _useSectionStore = (0, _Section.useSectionStore)(),
17
17
  _useSectionStore$Coun = _useSectionStore.CountInfoExtra,
18
18
  Comp = _useSectionStore$Coun === void 0 ? {} : _useSectionStore$Coun;
19
19
  (0, _useRender.useSectionRender)(Comp, props, 'CountInfoExtra');
20
20
  return null;
21
21
  };
22
- exports.CountInfoExtra = CountInfoExtra;
23
22
  CountInfoExtra.displayName = 'JVR.CountInfoExtra';
24
- var CountInfoExtraComps = function CountInfoExtraComps(props) {
23
+ var CountInfoExtraComps = exports.CountInfoExtraComps = function CountInfoExtraComps(props) {
25
24
  var _props$value = props.value,
26
25
  value = _props$value === void 0 ? {} : _props$value,
27
26
  keyName = props.keyName,
@@ -43,5 +42,4 @@ var CountInfoExtraComps = function CountInfoExtraComps(props) {
43
42
  if (child) return child;
44
43
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Elm, (0, _objectSpread2["default"])({}, elmProps));
45
44
  };
46
- exports.CountInfoExtraComps = CountInfoExtraComps;
47
45
  CountInfoExtraComps.displayName = 'JVR.CountInfoExtraComps';
@@ -11,16 +11,15 @@ var _Section = require("../store/Section");
11
11
  var _useRender = require("../utils/useRender");
12
12
  var _jsxRuntime = require("react/jsx-runtime");
13
13
  var _excluded = ["as", "render"];
14
- var Ellipsis = function Ellipsis(props) {
14
+ var Ellipsis = exports.Ellipsis = function Ellipsis(props) {
15
15
  var _useSectionStore = (0, _Section.useSectionStore)(),
16
16
  _useSectionStore$Elli = _useSectionStore.Ellipsis,
17
17
  Comp = _useSectionStore$Elli === void 0 ? {} : _useSectionStore$Elli;
18
18
  (0, _useRender.useSectionRender)(Comp, props, 'Ellipsis');
19
19
  return null;
20
20
  };
21
- exports.Ellipsis = Ellipsis;
22
21
  Ellipsis.displayName = 'JVR.Ellipsis';
23
- var EllipsisComp = function EllipsisComp(_ref) {
22
+ var EllipsisComp = exports.EllipsisComp = function EllipsisComp(_ref) {
24
23
  var isExpanded = _ref.isExpanded,
25
24
  value = _ref.value,
26
25
  keyName = _ref.keyName;
@@ -41,5 +40,4 @@ var EllipsisComp = function EllipsisComp(_ref) {
41
40
  if (!isExpanded) return null;
42
41
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Elm, (0, _objectSpread2["default"])({}, reset));
43
42
  };
44
- exports.EllipsisComp = EllipsisComp;
45
43
  EllipsisComp.displayName = 'JVR.EllipsisComp';
@@ -8,6 +8,7 @@ export declare const KeyName: {
8
8
  type KeyNameCompProps = {
9
9
  keyName: string | number;
10
10
  value?: unknown;
11
+ parentValue?: unknown;
11
12
  };
12
13
  export declare const KeyNameComp: FC<PropsWithChildren<KeyNameCompProps>>;
13
14
  export {};
@@ -11,18 +11,18 @@ 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,
25
+ parentValue = props.parentValue,
26
26
  keyName = props.keyName;
27
27
  var isNumber = typeof children === 'number';
28
28
  var style = {
@@ -40,6 +40,7 @@ var KeyNameComp = function KeyNameComp(props) {
40
40
  children: children
41
41
  }), {
42
42
  value: value,
43
+ parentValue: parentValue,
43
44
  keyName: keyName
44
45
  });
45
46
  if (child) return child;
@@ -47,5 +48,4 @@ var KeyNameComp = function KeyNameComp(props) {
47
48
  children: children
48
49
  }));
49
50
  };
50
- exports.KeyNameComp = KeyNameComp;
51
51
  KeyNameComp.displayName = 'JVR.KeyNameComp';
@@ -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';
@@ -4,6 +4,7 @@ export type SectionElementProps<T extends TagType = 'span'> = {
4
4
  as?: T;
5
5
  render?: (props: SectionElement<T>, result: {
6
6
  value: unknown;
7
+ parentValue?: unknown;
7
8
  keyName: string | number;
8
9
  }) => React.ReactNode;
9
10
  };
@@ -58,10 +58,9 @@ var Context = /*#__PURE__*/(0, _react.createContext)(initialState);
58
58
  var reducer = function reducer(state, action) {
59
59
  return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), action);
60
60
  };
61
- var useSectionStore = function useSectionStore() {
61
+ var useSectionStore = exports.useSectionStore = function useSectionStore() {
62
62
  return (0, _react.useContext)(Context);
63
63
  };
64
- exports.useSectionStore = useSectionStore;
65
64
  var DispatchSection = /*#__PURE__*/(0, _react.createContext)(function () {});
66
65
  DispatchSection.displayName = 'JVR.DispatchSection';
67
66
  function useSection() {
@@ -70,7 +69,7 @@ function useSection() {
70
69
  function useSectionDispatch() {
71
70
  return (0, _react.useContext)(DispatchSection);
72
71
  }
73
- var Section = function Section(_ref) {
72
+ var Section = exports.Section = function Section(_ref) {
74
73
  var initial = _ref.initial,
75
74
  dispatch = _ref.dispatch,
76
75
  children = _ref.children;
@@ -82,5 +81,4 @@ var Section = function Section(_ref) {
82
81
  })
83
82
  });
84
83
  };
85
- exports.Section = Section;
86
84
  Section.displayName = 'JVR.Section';
@@ -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';
@@ -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';
@@ -5,6 +5,7 @@ type TypesElementProps<T extends TagType = 'span'> = {
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
  };