@uiw/react-json-view 1.12.0 → 2.0.0-alpha.0

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 (261) hide show
  1. package/README.md +249 -265
  2. package/cjs/Container.d.ts +10 -0
  3. package/cjs/Container.js +67 -0
  4. package/cjs/arrow/TriangleArrow.js +3 -1
  5. package/cjs/arrow/TriangleSolidArrow.js +7 -3
  6. package/cjs/comps/Copied.d.ts +16 -0
  7. package/cjs/{copied.js → comps/Copied.js} +44 -32
  8. package/cjs/comps/CountInfo.d.ts +19 -0
  9. package/cjs/comps/CountInfo.js +72 -0
  10. package/cjs/comps/Ellipsis.d.ts +10 -0
  11. package/cjs/comps/Ellipsis.js +35 -0
  12. package/cjs/comps/Key.d.ts +7 -0
  13. package/cjs/comps/Key.js +39 -0
  14. package/cjs/comps/KeyValues.d.ts +22 -0
  15. package/cjs/comps/KeyValues.js +156 -0
  16. package/cjs/comps/NestedClose.d.ts +10 -0
  17. package/cjs/comps/NestedClose.js +38 -0
  18. package/cjs/comps/NestedOpen.d.ts +11 -0
  19. package/cjs/comps/NestedOpen.js +95 -0
  20. package/cjs/comps/ReRender/Symbols.d.ts +44 -0
  21. package/cjs/comps/ReRender/Symbols.js +144 -0
  22. package/cjs/comps/ReRender/Types.d.ts +36 -0
  23. package/cjs/comps/ReRender/Types.js +590 -0
  24. package/cjs/comps/Value.d.ts +11 -0
  25. package/cjs/comps/Value.js +78 -0
  26. package/cjs/index.d.ts +72 -52
  27. package/cjs/index.js +147 -27
  28. package/cjs/section/Copied.d.ts +6 -0
  29. package/cjs/section/Copied.js +17 -0
  30. package/cjs/section/CountInfo.d.ts +6 -0
  31. package/cjs/section/CountInfo.js +17 -0
  32. package/cjs/section/CountInfoExtra.d.ts +6 -0
  33. package/cjs/section/CountInfoExtra.js +17 -0
  34. package/cjs/section/Ellipsis.d.ts +6 -0
  35. package/cjs/section/Ellipsis.js +17 -0
  36. package/cjs/section/KeyName.d.ts +6 -0
  37. package/cjs/section/KeyName.js +17 -0
  38. package/cjs/store/Expands.d.ts +16 -0
  39. package/cjs/store/Expands.js +44 -0
  40. package/cjs/store/Section.d.ts +33 -0
  41. package/cjs/store/Section.js +86 -0
  42. package/cjs/store/ShowTools.d.ts +14 -0
  43. package/cjs/store/ShowTools.js +44 -0
  44. package/cjs/store/Symbols.d.ts +37 -0
  45. package/cjs/store/Symbols.js +112 -0
  46. package/cjs/store/Types.d.ts +52 -0
  47. package/cjs/store/Types.js +162 -0
  48. package/cjs/store.d.ts +29 -5
  49. package/cjs/store.js +96 -46
  50. package/cjs/symbol/Arrow.d.ts +6 -0
  51. package/cjs/symbol/Arrow.js +17 -0
  52. package/cjs/symbol/BraceLeft.d.ts +6 -0
  53. package/cjs/symbol/BraceLeft.js +17 -0
  54. package/cjs/symbol/BraceRight.d.ts +6 -0
  55. package/cjs/symbol/BraceRight.js +17 -0
  56. package/cjs/symbol/BracketsLeft.d.ts +6 -0
  57. package/cjs/symbol/BracketsLeft.js +17 -0
  58. package/cjs/symbol/BracketsRight.d.ts +6 -0
  59. package/cjs/symbol/BracketsRight.js +17 -0
  60. package/cjs/symbol/Colon.d.ts +6 -0
  61. package/cjs/symbol/Colon.js +17 -0
  62. package/cjs/symbol/Quote.d.ts +6 -0
  63. package/cjs/symbol/Quote.js +17 -0
  64. package/cjs/symbol/ValueQuote.d.ts +6 -0
  65. package/cjs/symbol/ValueQuote.js +17 -0
  66. package/cjs/theme/basic.js +3 -0
  67. package/cjs/theme/dark.js +3 -0
  68. package/cjs/theme/github.dark.js +3 -0
  69. package/cjs/theme/github.light.js +3 -0
  70. package/cjs/theme/gruvbox.js +3 -0
  71. package/cjs/theme/light.js +3 -0
  72. package/cjs/theme/monokai.js +3 -0
  73. package/cjs/theme/nord.js +3 -0
  74. package/cjs/theme/vscode.js +3 -0
  75. package/cjs/type.d.ts +50 -0
  76. package/cjs/type.js +57 -0
  77. package/cjs/types/Bigint.d.ts +5 -0
  78. package/cjs/types/Bigint.js +17 -0
  79. package/cjs/types/Date.d.ts +5 -0
  80. package/cjs/types/Date.js +17 -0
  81. package/cjs/types/False.d.ts +5 -0
  82. package/cjs/types/False.js +17 -0
  83. package/cjs/types/Float.d.ts +5 -0
  84. package/cjs/types/Float.js +17 -0
  85. package/cjs/types/Int.d.ts +5 -0
  86. package/cjs/types/Int.js +17 -0
  87. package/cjs/types/Map.d.ts +5 -0
  88. package/cjs/types/Map.js +17 -0
  89. package/cjs/types/Nan.d.ts +5 -0
  90. package/cjs/types/Nan.js +17 -0
  91. package/cjs/types/Null.d.ts +5 -0
  92. package/cjs/types/Null.js +17 -0
  93. package/cjs/types/Set.d.ts +5 -0
  94. package/cjs/types/Set.js +17 -0
  95. package/cjs/types/String.d.ts +5 -0
  96. package/cjs/types/String.js +17 -0
  97. package/cjs/types/True.d.ts +5 -0
  98. package/cjs/types/True.js +17 -0
  99. package/cjs/types/Undefined.d.ts +5 -0
  100. package/cjs/types/Undefined.js +17 -0
  101. package/cjs/types/Url.d.ts +5 -0
  102. package/cjs/types/Url.js +17 -0
  103. package/cjs/utils/useHighlight.d.ts +9 -0
  104. package/cjs/utils/useHighlight.js +62 -0
  105. package/cjs/utils/useRender.d.ts +6 -0
  106. package/cjs/utils/useRender.js +51 -0
  107. package/esm/Container.d.ts +10 -0
  108. package/esm/Container.js +53 -0
  109. package/esm/arrow/TriangleArrow.js +3 -1
  110. package/esm/arrow/TriangleSolidArrow.js +7 -3
  111. package/esm/comps/Copied.d.ts +16 -0
  112. package/esm/{copied.js → comps/Copied.js} +44 -29
  113. package/esm/comps/CountInfo.d.ts +19 -0
  114. package/esm/comps/CountInfo.js +70 -0
  115. package/esm/comps/Ellipsis.d.ts +10 -0
  116. package/esm/comps/Ellipsis.js +31 -0
  117. package/esm/comps/Key.d.ts +7 -0
  118. package/esm/comps/Key.js +35 -0
  119. package/esm/comps/KeyValues.d.ts +22 -0
  120. package/esm/comps/KeyValues.js +142 -0
  121. package/esm/comps/NestedClose.d.ts +10 -0
  122. package/esm/comps/NestedClose.js +34 -0
  123. package/esm/comps/NestedOpen.d.ts +11 -0
  124. package/esm/comps/NestedOpen.js +91 -0
  125. package/esm/comps/ReRender/Symbols.d.ts +44 -0
  126. package/esm/comps/ReRender/Symbols.js +155 -0
  127. package/esm/comps/ReRender/Types.d.ts +36 -0
  128. package/esm/comps/ReRender/Types.js +621 -0
  129. package/esm/comps/Value.d.ts +11 -0
  130. package/esm/comps/Value.js +69 -0
  131. package/esm/index.d.ts +72 -52
  132. package/esm/index.js +98 -18
  133. package/esm/section/Copied.d.ts +6 -0
  134. package/esm/section/Copied.js +10 -0
  135. package/esm/section/CountInfo.d.ts +6 -0
  136. package/esm/section/CountInfo.js +10 -0
  137. package/esm/section/CountInfoExtra.d.ts +6 -0
  138. package/esm/section/CountInfoExtra.js +10 -0
  139. package/esm/section/Ellipsis.d.ts +6 -0
  140. package/esm/section/Ellipsis.js +10 -0
  141. package/esm/section/KeyName.d.ts +6 -0
  142. package/esm/section/KeyName.js +10 -0
  143. package/esm/store/Expands.d.ts +16 -0
  144. package/esm/store/Expands.js +32 -0
  145. package/esm/store/Section.d.ts +33 -0
  146. package/esm/store/Section.js +73 -0
  147. package/esm/store/ShowTools.d.ts +14 -0
  148. package/esm/store/ShowTools.js +32 -0
  149. package/esm/store/Symbols.d.ts +37 -0
  150. package/esm/store/Symbols.js +100 -0
  151. package/esm/store/Types.d.ts +52 -0
  152. package/esm/store/Types.js +150 -0
  153. package/esm/store.d.ts +29 -5
  154. package/esm/store.js +66 -32
  155. package/esm/symbol/Arrow.d.ts +6 -0
  156. package/esm/symbol/Arrow.js +10 -0
  157. package/esm/symbol/BraceLeft.d.ts +6 -0
  158. package/esm/symbol/BraceLeft.js +10 -0
  159. package/esm/symbol/BraceRight.d.ts +6 -0
  160. package/esm/symbol/BraceRight.js +10 -0
  161. package/esm/symbol/BracketsLeft.d.ts +6 -0
  162. package/esm/symbol/BracketsLeft.js +10 -0
  163. package/esm/symbol/BracketsRight.d.ts +6 -0
  164. package/esm/symbol/BracketsRight.js +10 -0
  165. package/esm/symbol/Colon.d.ts +6 -0
  166. package/esm/symbol/Colon.js +10 -0
  167. package/esm/symbol/Quote.d.ts +6 -0
  168. package/esm/symbol/Quote.js +10 -0
  169. package/esm/symbol/ValueQuote.d.ts +6 -0
  170. package/esm/symbol/ValueQuote.js +10 -0
  171. package/esm/theme/basic.js +3 -0
  172. package/esm/theme/dark.js +3 -0
  173. package/esm/theme/github.dark.js +3 -0
  174. package/esm/theme/github.light.js +3 -0
  175. package/esm/theme/gruvbox.js +3 -0
  176. package/esm/theme/light.js +3 -0
  177. package/esm/theme/monokai.js +3 -0
  178. package/esm/theme/nord.js +3 -0
  179. package/esm/theme/vscode.js +3 -0
  180. package/esm/type.d.ts +50 -0
  181. package/esm/type.js +50 -0
  182. package/esm/types/Bigint.d.ts +5 -0
  183. package/esm/types/Bigint.js +10 -0
  184. package/esm/types/Date.d.ts +5 -0
  185. package/esm/types/Date.js +10 -0
  186. package/esm/types/False.d.ts +5 -0
  187. package/esm/types/False.js +10 -0
  188. package/esm/types/Float.d.ts +5 -0
  189. package/esm/types/Float.js +10 -0
  190. package/esm/types/Int.d.ts +5 -0
  191. package/esm/types/Int.js +10 -0
  192. package/esm/types/Map.d.ts +5 -0
  193. package/esm/types/Map.js +10 -0
  194. package/esm/types/Nan.d.ts +5 -0
  195. package/esm/types/Nan.js +10 -0
  196. package/esm/types/Null.d.ts +5 -0
  197. package/esm/types/Null.js +10 -0
  198. package/esm/types/Set.d.ts +5 -0
  199. package/esm/types/Set.js +10 -0
  200. package/esm/types/String.d.ts +5 -0
  201. package/esm/types/String.js +10 -0
  202. package/esm/types/True.d.ts +5 -0
  203. package/esm/types/True.js +10 -0
  204. package/esm/types/Undefined.d.ts +5 -0
  205. package/esm/types/Undefined.js +10 -0
  206. package/esm/types/Url.d.ts +5 -0
  207. package/esm/types/Url.js +10 -0
  208. package/esm/utils/useHighlight.d.ts +9 -0
  209. package/esm/{semicolon.js → utils/useHighlight.js} +1 -52
  210. package/esm/utils/useRender.d.ts +6 -0
  211. package/esm/utils/useRender.js +41 -0
  212. package/package.json +1 -1
  213. package/cjs/comps/ellipsis.d.ts +0 -7
  214. package/cjs/comps/ellipsis.js +0 -37
  215. package/cjs/comps/meta.d.ts +0 -12
  216. package/cjs/comps/meta.js +0 -46
  217. package/cjs/copied.d.ts +0 -11
  218. package/cjs/editor/countInfoExtra.d.ts +0 -28
  219. package/cjs/editor/countInfoExtra.js +0 -101
  220. package/cjs/editor/icon/add.d.ts +0 -4
  221. package/cjs/editor/icon/add.js +0 -30
  222. package/cjs/editor/icon/delete.d.ts +0 -4
  223. package/cjs/editor/icon/delete.js +0 -30
  224. package/cjs/editor/icon/edit.d.ts +0 -4
  225. package/cjs/editor/icon/edit.js +0 -30
  226. package/cjs/editor/index.d.ts +0 -31
  227. package/cjs/editor/index.js +0 -60
  228. package/cjs/editor/objectKey.d.ts +0 -11
  229. package/cjs/editor/objectKey.js +0 -169
  230. package/cjs/editor/value.d.ts +0 -22
  231. package/cjs/editor/value.js +0 -240
  232. package/cjs/node.d.ts +0 -15
  233. package/cjs/node.js +0 -343
  234. package/cjs/semicolon.d.ts +0 -22
  235. package/cjs/semicolon.js +0 -115
  236. package/cjs/value.d.ts +0 -93
  237. package/cjs/value.js +0 -356
  238. package/esm/comps/ellipsis.d.ts +0 -7
  239. package/esm/comps/ellipsis.js +0 -31
  240. package/esm/comps/meta.d.ts +0 -12
  241. package/esm/comps/meta.js +0 -39
  242. package/esm/copied.d.ts +0 -11
  243. package/esm/editor/countInfoExtra.d.ts +0 -28
  244. package/esm/editor/countInfoExtra.js +0 -68
  245. package/esm/editor/icon/add.d.ts +0 -4
  246. package/esm/editor/icon/add.js +0 -24
  247. package/esm/editor/icon/delete.d.ts +0 -4
  248. package/esm/editor/icon/delete.js +0 -24
  249. package/esm/editor/icon/edit.d.ts +0 -4
  250. package/esm/editor/icon/edit.js +0 -24
  251. package/esm/editor/index.d.ts +0 -31
  252. package/esm/editor/index.js +0 -47
  253. package/esm/editor/objectKey.d.ts +0 -11
  254. package/esm/editor/objectKey.js +0 -135
  255. package/esm/editor/value.d.ts +0 -22
  256. package/esm/editor/value.js +0 -192
  257. package/esm/node.d.ts +0 -15
  258. package/esm/node.js +0 -299
  259. package/esm/semicolon.d.ts +0 -22
  260. package/esm/value.d.ts +0 -93
  261. package/esm/value.js +0 -331
package/cjs/index.d.ts CHANGED
@@ -1,72 +1,92 @@
1
- import React from 'react';
2
- import type { SemicolonProps } from './semicolon';
3
- import type { ValueViewProps, TypeProps } from './value';
4
- import type { CopiedProps } from './copied';
5
- import type { EllipsisProps } from './comps/ellipsis';
6
- import type { MetaProps } from './comps/meta';
7
- import type { CountInfoExtraProps } from './editor/countInfoExtra';
8
- export * from './node';
9
- export * from './value';
10
- export * from './semicolon';
11
- export interface CountInfoProps {
12
- count: number;
13
- level: number;
14
- visible: boolean;
15
- }
16
- interface RenderValueProps<T extends object> extends React.HTMLAttributes<HTMLSpanElement> {
17
- type: TypeProps['type'];
18
- value?: unknown;
19
- parentValue?: T;
20
- data?: T;
21
- visible?: boolean;
22
- quotes?: JsonViewProps<T>['quotes'];
23
- namespace?: Array<string | number>;
24
- setValue?: React.Dispatch<React.SetStateAction<T>>;
25
- keyName?: ValueViewProps<T>['keyName'];
26
- }
1
+ /// <reference types="react" />
2
+ import { BraceLeft } from './symbol/BraceLeft';
3
+ import { BraceRight } from './symbol/BraceRight';
4
+ import { BracketsLeft } from './symbol/BracketsLeft';
5
+ import { BracketsRight } from './symbol/BracketsRight';
6
+ import { Arrow } from './symbol/Arrow';
7
+ import { Colon } from './symbol/Colon';
8
+ import { Quote } from './symbol/Quote';
9
+ import { ValueQuote } from './symbol/ValueQuote';
10
+ import { Bigint } from './types/Bigint';
11
+ import { Date } from './types/Date';
12
+ import { False } from './types/False';
13
+ import { Float } from './types/Float';
14
+ import { Int } from './types/Int';
15
+ import { Map } from './types/Map';
16
+ import { Nan } from './types/Nan';
17
+ import { Null } from './types/Null';
18
+ import { Set } from './types/Set';
19
+ import { StringText } from './types/String';
20
+ import { True } from './types/True';
21
+ import { Undefined } from './types/Undefined';
22
+ import { Url } from './types/Url';
23
+ import { Copied } from './section/Copied';
24
+ import { CountInfo } from './section/CountInfo';
25
+ import { CountInfoExtra } from './section/CountInfoExtra';
26
+ import { Ellipsis } from './section/Ellipsis';
27
+ import { KeyName } from './section/KeyName';
28
+ export * from './store';
29
+ export * from './store/Expands';
30
+ export * from './store/ShowTools';
31
+ export * from './store/Symbols';
32
+ export * from './store/Types';
33
+ export * from './comps/ReRender/Symbols';
27
34
  export interface JsonViewProps<T extends object> extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
28
35
  /** This property contains your input JSON */
29
36
  value?: T;
37
+ /** Whether sort keys through `String.prototype.localeCompare()` @default false */
38
+ objectSortKeys?: boolean | ((a: string, b: string) => number);
30
39
  /** Set the indent-width for nested objects @default 15 */
31
40
  indentWidth?: number;
32
- /** When set to `true`, data type labels prefix values @default true */
33
- displayDataTypes?: boolean;
34
41
  /** When set to `true`, `objects` and `arrays` are labeled with size @default true */
35
42
  displayObjectSize?: boolean;
36
- /** Shorten long JSON strings, Set to `0` to disable this feature @default 20 */
37
- shortenTextAfterLength?: number;
38
- /** Define the root node name. @default undefined */
39
- keyName?: string | number;
43
+ /** When set to `true`, data type labels prefix values @default true */
44
+ displayDataTypes?: boolean;
40
45
  /** The user can copy objects and arrays to clipboard by clicking on the clipboard icon. @default true */
41
46
  enableClipboard?: boolean;
42
- /** Whether to highlight updates. @default true */
43
- highlightUpdates?: boolean;
44
- /** Whether sort keys through `String.prototype.localeCompare()` @default false */
45
- objectSortKeys?: boolean | ((a: string, b: string) => number);
46
- /** Display for quotes in object-key @default " */
47
- quotes?: "'" | '"' | '';
48
47
  /** When set to true, all nodes will be collapsed by default. Use an integer value to collapse at a particular depth. @default false */
49
48
  collapsed?: boolean | number;
49
+ /** Whether to highlight updates. @default true */
50
+ highlightUpdates?: boolean;
51
+ /** Shorten long JSON strings, Set to `0` to disable this feature @default 20 */
52
+ shortenTextAfterLength?: number;
50
53
  /** Callback function for when a treeNode is expanded or collapsed */
51
54
  onExpand?: (props: {
52
55
  expand: boolean;
53
- value: T;
56
+ value?: T;
54
57
  keyid: string;
55
58
  keyName?: string | number;
56
59
  }) => void;
57
60
  /** Fires event when you copy */
58
- onCopied?: CopiedProps<T>['onCopied'];
59
- /** Redefine interface elements to re-render. */
60
- components?: {
61
- braces?: MetaProps['render'];
62
- ellipsis?: EllipsisProps['render'];
63
- arrow?: JSX.Element;
64
- objectKey?: SemicolonProps['render'];
65
- value?: (props: RenderValueProps<T>) => JSX.Element;
66
- copied?: CopiedProps<T>['render'];
67
- countInfo?: (props: CountInfoProps) => JSX.Element;
68
- countInfoExtra?: (props: Omit<CountInfoExtraProps<T>, 'editable'>) => JSX.Element;
69
- };
61
+ onCopied?: (text: string, value?: T) => void;
70
62
  }
71
- declare const JsonView: React.ForwardRefExoticComponent<Omit<JsonViewProps<object>, "ref"> & React.RefAttributes<HTMLDivElement>>;
63
+ type JsonViewComponent = React.FC<React.PropsWithRef<JsonViewProps<object>>> & {
64
+ Bigint: typeof Bigint;
65
+ Date: typeof Date;
66
+ False: typeof False;
67
+ Float: typeof Float;
68
+ Int: typeof Int;
69
+ Map: typeof Map;
70
+ Nan: typeof Nan;
71
+ Null: typeof Null;
72
+ Set: typeof Set;
73
+ String: typeof StringText;
74
+ True: typeof True;
75
+ Undefined: typeof Undefined;
76
+ Url: typeof Url;
77
+ BraceLeft: typeof BraceLeft;
78
+ BraceRight: typeof BraceRight;
79
+ BracketsLeft: typeof BracketsLeft;
80
+ BracketsRight: typeof BracketsRight;
81
+ Colon: typeof Colon;
82
+ Ellipsis: typeof Ellipsis;
83
+ Quote: typeof Quote;
84
+ ValueQuote: typeof ValueQuote;
85
+ Arrow: typeof Arrow;
86
+ Copied: typeof Copied;
87
+ CountInfo: typeof CountInfo;
88
+ CountInfoExtra: typeof CountInfoExtra;
89
+ KeyName: typeof KeyName;
90
+ };
91
+ declare const JsonView: JsonViewComponent;
72
92
  export default JsonView;
package/cjs/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -9,50 +8,131 @@ var _exportNames = {};
9
8
  exports["default"] = void 0;
10
9
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
12
- var _react = _interopRequireWildcard(require("react"));
13
- var _node = require("./node");
14
- Object.keys(_node).forEach(function (key) {
11
+ var _react = require("react");
12
+ var _store = require("./store");
13
+ Object.keys(_store).forEach(function (key) {
15
14
  if (key === "default" || key === "__esModule") return;
16
15
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
17
- if (key in exports && exports[key] === _node[key]) return;
16
+ if (key in exports && exports[key] === _store[key]) return;
18
17
  Object.defineProperty(exports, key, {
19
18
  enumerable: true,
20
19
  get: function get() {
21
- return _node[key];
20
+ return _store[key];
22
21
  }
23
22
  });
24
23
  });
24
+ var _Container = require("./Container");
25
+ var _BraceLeft = require("./symbol/BraceLeft");
26
+ var _BraceRight = require("./symbol/BraceRight");
27
+ var _BracketsLeft = require("./symbol/BracketsLeft");
28
+ var _BracketsRight = require("./symbol/BracketsRight");
29
+ var _Arrow = require("./symbol/Arrow");
30
+ var _Colon = require("./symbol/Colon");
31
+ var _Quote = require("./symbol/Quote");
32
+ var _ValueQuote = require("./symbol/ValueQuote");
33
+ var _Bigint = require("./types/Bigint");
34
+ var _Date = require("./types/Date");
35
+ var _False = require("./types/False");
36
+ var _Float = require("./types/Float");
37
+ var _Int = require("./types/Int");
38
+ var _Map = require("./types/Map");
39
+ var _Nan = require("./types/Nan");
40
+ var _Null = require("./types/Null");
41
+ var _Set = require("./types/Set");
42
+ var _String = require("./types/String");
43
+ var _True = require("./types/True");
44
+ var _Undefined = require("./types/Undefined");
45
+ var _Url = require("./types/Url");
46
+ var _Copied = require("./section/Copied");
47
+ var _CountInfo = require("./section/CountInfo");
48
+ var _CountInfoExtra = require("./section/CountInfoExtra");
49
+ var _Ellipsis = require("./section/Ellipsis");
50
+ var _KeyName = require("./section/KeyName");
25
51
  var _jsxRuntime = require("react/jsx-runtime");
26
- var _value = require("./value");
27
- Object.keys(_value).forEach(function (key) {
52
+ var _Expands = require("./store/Expands");
53
+ Object.keys(_Expands).forEach(function (key) {
28
54
  if (key === "default" || key === "__esModule") return;
29
55
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
30
- if (key in exports && exports[key] === _value[key]) return;
56
+ if (key in exports && exports[key] === _Expands[key]) return;
31
57
  Object.defineProperty(exports, key, {
32
58
  enumerable: true,
33
59
  get: function get() {
34
- return _value[key];
60
+ return _Expands[key];
35
61
  }
36
62
  });
37
63
  });
38
- var _semicolon = require("./semicolon");
39
- Object.keys(_semicolon).forEach(function (key) {
64
+ var _ShowTools = require("./store/ShowTools");
65
+ Object.keys(_ShowTools).forEach(function (key) {
40
66
  if (key === "default" || key === "__esModule") return;
41
67
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
42
- if (key in exports && exports[key] === _semicolon[key]) return;
68
+ if (key in exports && exports[key] === _ShowTools[key]) return;
43
69
  Object.defineProperty(exports, key, {
44
70
  enumerable: true,
45
71
  get: function get() {
46
- return _semicolon[key];
72
+ return _ShowTools[key];
47
73
  }
48
74
  });
49
75
  });
50
- var _excluded = ["value", "style", "className"];
76
+ var _Symbols = require("./store/Symbols");
77
+ Object.keys(_Symbols).forEach(function (key) {
78
+ if (key === "default" || key === "__esModule") return;
79
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
80
+ if (key in exports && exports[key] === _Symbols[key]) return;
81
+ Object.defineProperty(exports, key, {
82
+ enumerable: true,
83
+ get: function get() {
84
+ return _Symbols[key];
85
+ }
86
+ });
87
+ });
88
+ var _Types = require("./store/Types");
89
+ Object.keys(_Types).forEach(function (key) {
90
+ if (key === "default" || key === "__esModule") return;
91
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
92
+ if (key in exports && exports[key] === _Types[key]) return;
93
+ Object.defineProperty(exports, key, {
94
+ enumerable: true,
95
+ get: function get() {
96
+ return _Types[key];
97
+ }
98
+ });
99
+ });
100
+ var _Symbols2 = require("./comps/ReRender/Symbols");
101
+ Object.keys(_Symbols2).forEach(function (key) {
102
+ if (key === "default" || key === "__esModule") return;
103
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
104
+ if (key in exports && exports[key] === _Symbols2[key]) return;
105
+ Object.defineProperty(exports, key, {
106
+ enumerable: true,
107
+ get: function get() {
108
+ return _Symbols2[key];
109
+ }
110
+ });
111
+ });
112
+ var _excluded = ["className", "style", "value", "children", "collapsed", "indentWidth", "displayObjectSize", "shortenTextAfterLength", "highlightUpdates", "enableClipboard", "displayDataTypes", "objectSortKeys", "onExpand"];
51
113
  var JsonView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
52
- var value = props.value,
114
+ var _props$className = props.className,
115
+ className = _props$className === void 0 ? '' : _props$className,
53
116
  style = props.style,
54
- className = props.className,
55
- reset = (0, _objectWithoutProperties2["default"])(props, _excluded);
117
+ value = props.value,
118
+ children = props.children,
119
+ collapsed = props.collapsed,
120
+ _props$indentWidth = props.indentWidth,
121
+ indentWidth = _props$indentWidth === void 0 ? 15 : _props$indentWidth,
122
+ _props$displayObjectS = props.displayObjectSize,
123
+ displayObjectSize = _props$displayObjectS === void 0 ? true : _props$displayObjectS,
124
+ _props$shortenTextAft = props.shortenTextAfterLength,
125
+ shortenTextAfterLength = _props$shortenTextAft === void 0 ? 20 : _props$shortenTextAft,
126
+ _props$highlightUpdat = props.highlightUpdates,
127
+ highlightUpdates = _props$highlightUpdat === void 0 ? true : _props$highlightUpdat,
128
+ _props$enableClipboar = props.enableClipboard,
129
+ enableClipboard = _props$enableClipboar === void 0 ? true : _props$enableClipboar,
130
+ _props$displayDataTyp = props.displayDataTypes,
131
+ displayDataTypes = _props$displayDataTyp === void 0 ? true : _props$displayDataTyp,
132
+ _props$objectSortKeys = props.objectSortKeys,
133
+ objectSortKeys = _props$objectSortKeys === void 0 ? false : _props$objectSortKeys,
134
+ onExpand = props.onExpand,
135
+ elmProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
56
136
  var defaultStyle = (0, _objectSpread2["default"])({
57
137
  lineHeight: 1.4,
58
138
  fontFamily: 'var(--w-rjv-font-family, Menlo, monospace)',
@@ -61,16 +141,56 @@ var JsonView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
61
141
  fontSize: 13
62
142
  }, style);
63
143
  var cls = "w-json-view-container w-rjv ".concat(className || '');
64
- var keyid = (0, _react.useId)();
65
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_node.RootNode, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
66
- className: cls,
67
- value: value
68
- }, reset), {}, {
69
- ref: ref,
70
- keyid: keyid,
71
- style: defaultStyle
72
- }));
144
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_store.Provider, {
145
+ initialState: {
146
+ value: value,
147
+ objectSortKeys: objectSortKeys,
148
+ indentWidth: indentWidth,
149
+ displayObjectSize: displayObjectSize,
150
+ collapsed: collapsed,
151
+ enableClipboard: enableClipboard,
152
+ shortenTextAfterLength: shortenTextAfterLength,
153
+ highlightUpdates: highlightUpdates,
154
+ onExpand: onExpand
155
+ },
156
+ initialTypes: {
157
+ displayDataTypes: displayDataTypes
158
+ },
159
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Container.Container, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
160
+ value: value
161
+ }, elmProps), {}, {
162
+ ref: ref,
163
+ className: cls,
164
+ style: defaultStyle
165
+ })), children]
166
+ });
73
167
  });
168
+ JsonView.Bigint = _Bigint.Bigint;
169
+ JsonView.Date = _Date.Date;
170
+ JsonView.False = _False.False;
171
+ JsonView.Float = _Float.Float;
172
+ JsonView.Int = _Int.Int;
173
+ JsonView.Map = _Map.Map;
174
+ JsonView.Nan = _Nan.Nan;
175
+ JsonView.Null = _Null.Null;
176
+ JsonView.Set = _Set.Set;
177
+ JsonView.String = _String.StringText;
178
+ JsonView.True = _True.True;
179
+ JsonView.Undefined = _Undefined.Undefined;
180
+ JsonView.Url = _Url.Url;
181
+ JsonView.ValueQuote = _ValueQuote.ValueQuote;
182
+ JsonView.Arrow = _Arrow.Arrow;
183
+ JsonView.Colon = _Colon.Colon;
184
+ JsonView.Quote = _Quote.Quote;
185
+ JsonView.Ellipsis = _Ellipsis.Ellipsis;
186
+ JsonView.BraceLeft = _BraceLeft.BraceLeft;
187
+ JsonView.BraceRight = _BraceRight.BraceRight;
188
+ JsonView.BracketsLeft = _BracketsLeft.BracketsLeft;
189
+ JsonView.BracketsRight = _BracketsRight.BracketsRight;
190
+ JsonView.Copied = _Copied.Copied;
191
+ JsonView.CountInfo = _CountInfo.CountInfo;
192
+ JsonView.CountInfoExtra = _CountInfoExtra.CountInfoExtra;
193
+ JsonView.KeyName = _KeyName.KeyName;
74
194
  JsonView.displayName = 'JVR.JsonView';
75
195
  var _default = JsonView;
76
196
  exports["default"] = _default;
@@ -0,0 +1,6 @@
1
+ import { type TagType } from '../store/Types';
2
+ import { type SectionElement } from '../store/Section';
3
+ export declare const Copied: {
4
+ (props: SectionElement<TagType>): null;
5
+ displayName: string;
6
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Copied = void 0;
7
+ var _Section = require("../store/Section");
8
+ var _useRender = require("../utils/useRender");
9
+ var Copied = function Copied(props) {
10
+ var _useSectionStore = (0, _Section.useSectionStore)(),
11
+ _useSectionStore$Copi = _useSectionStore.Copied,
12
+ Comp = _useSectionStore$Copi === void 0 ? {} : _useSectionStore$Copi;
13
+ (0, _useRender.useSectionRender)(Comp, props, 'Copied');
14
+ return null;
15
+ };
16
+ exports.Copied = Copied;
17
+ Copied.displayName = 'JVR.Copied';
@@ -0,0 +1,6 @@
1
+ import { type TagType } from '../store/Types';
2
+ import { type SectionElement } from '../store/Section';
3
+ export declare const CountInfo: {
4
+ <K extends TagType>(props: SectionElement<K>): null;
5
+ displayName: string;
6
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CountInfo = void 0;
7
+ var _Section = require("../store/Section");
8
+ var _useRender = require("../utils/useRender");
9
+ var CountInfo = function CountInfo(props) {
10
+ var _useSectionStore = (0, _Section.useSectionStore)(),
11
+ _useSectionStore$Coun = _useSectionStore.CountInfo,
12
+ Comp = _useSectionStore$Coun === void 0 ? {} : _useSectionStore$Coun;
13
+ (0, _useRender.useSectionRender)(Comp, props, 'CountInfo');
14
+ return null;
15
+ };
16
+ exports.CountInfo = CountInfo;
17
+ CountInfo.displayName = 'JVR.CountInfo';
@@ -0,0 +1,6 @@
1
+ import { type TagType } from '../store/Types';
2
+ import { type SectionElement } from '../store/Section';
3
+ export declare const CountInfoExtra: {
4
+ <K extends TagType>(props: SectionElement<K>): null;
5
+ displayName: string;
6
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CountInfoExtra = void 0;
7
+ var _Section = require("../store/Section");
8
+ var _useRender = require("../utils/useRender");
9
+ var CountInfoExtra = function CountInfoExtra(props) {
10
+ var _useSectionStore = (0, _Section.useSectionStore)(),
11
+ _useSectionStore$Coun = _useSectionStore.CountInfoExtra,
12
+ Comp = _useSectionStore$Coun === void 0 ? {} : _useSectionStore$Coun;
13
+ (0, _useRender.useSectionRender)(Comp, props, 'CountInfoExtra');
14
+ return null;
15
+ };
16
+ exports.CountInfoExtra = CountInfoExtra;
17
+ CountInfoExtra.displayName = 'JVR.CountInfoExtra';
@@ -0,0 +1,6 @@
1
+ import { type TagType } from '../store/Types';
2
+ import { type SectionElement } from '../store/Section';
3
+ export declare const Ellipsis: {
4
+ <K extends TagType>(props: SectionElement<K>): null;
5
+ displayName: string;
6
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Ellipsis = void 0;
7
+ var _Section = require("../store/Section");
8
+ var _useRender = require("../utils/useRender");
9
+ var Ellipsis = function Ellipsis(props) {
10
+ var _useSectionStore = (0, _Section.useSectionStore)(),
11
+ _useSectionStore$Elli = _useSectionStore.Ellipsis,
12
+ Comp = _useSectionStore$Elli === void 0 ? {} : _useSectionStore$Elli;
13
+ (0, _useRender.useSectionRender)(Comp, props, 'Ellipsis');
14
+ return null;
15
+ };
16
+ exports.Ellipsis = Ellipsis;
17
+ Ellipsis.displayName = 'JVR.Ellipsis';
@@ -0,0 +1,6 @@
1
+ import { type TagType } from '../store/Types';
2
+ import { type SectionElement } from '../store/Section';
3
+ export declare const KeyName: {
4
+ <K extends TagType>(props: SectionElement<K>): null;
5
+ displayName: string;
6
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.KeyName = void 0;
7
+ var _Section = require("../store/Section");
8
+ var _useRender = require("../utils/useRender");
9
+ var KeyName = function KeyName(props) {
10
+ var _useSectionStore = (0, _Section.useSectionStore)(),
11
+ _useSectionStore$KeyN = _useSectionStore.KeyName,
12
+ Comp = _useSectionStore$KeyN === void 0 ? {} : _useSectionStore$KeyN;
13
+ (0, _useRender.useSectionRender)(Comp, props, 'KeyName');
14
+ return null;
15
+ };
16
+ exports.KeyName = KeyName;
17
+ KeyName.displayName = 'JVR.KeyName';
@@ -0,0 +1,16 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ type InitialState = {
3
+ [key: string]: boolean;
4
+ };
5
+ type Dispatch = React.Dispatch<InitialState>;
6
+ export declare const useExpandsStore: () => InitialState;
7
+ export declare function useExpands(): [{
8
+ [x: string]: boolean;
9
+ }, import("react").Dispatch<InitialState>];
10
+ export declare function useExpandsDispatch(): Dispatch;
11
+ interface ExpandsProps {
12
+ initial: InitialState;
13
+ dispatch: Dispatch;
14
+ }
15
+ export declare const Expands: FC<PropsWithChildren<ExpandsProps>>;
16
+ export {};
@@ -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.Expands = void 0;
8
+ exports.useExpands = useExpands;
9
+ exports.useExpandsDispatch = useExpandsDispatch;
10
+ exports.useExpandsStore = void 0;
11
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
+ var _react = require("react");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ var initialState = {};
15
+ var Context = /*#__PURE__*/(0, _react.createContext)(initialState);
16
+ var reducer = function reducer(state, action) {
17
+ return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), action);
18
+ };
19
+ var useExpandsStore = function useExpandsStore() {
20
+ return (0, _react.useContext)(Context);
21
+ };
22
+ exports.useExpandsStore = useExpandsStore;
23
+ var DispatchExpands = /*#__PURE__*/(0, _react.createContext)(function () {});
24
+ DispatchExpands.displayName = 'JVR.DispatchExpands';
25
+ function useExpands() {
26
+ return (0, _react.useReducer)(reducer, initialState);
27
+ }
28
+ function useExpandsDispatch() {
29
+ return (0, _react.useContext)(DispatchExpands);
30
+ }
31
+ var Expands = function Expands(_ref) {
32
+ var initial = _ref.initial,
33
+ dispatch = _ref.dispatch,
34
+ children = _ref.children;
35
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Context.Provider, {
36
+ value: initial,
37
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(DispatchExpands.Provider, {
38
+ value: dispatch,
39
+ children: children
40
+ })
41
+ });
42
+ };
43
+ exports.Expands = Expands;
44
+ Expands.displayName = 'JVR.Expands';
@@ -0,0 +1,33 @@
1
+ import React, { FC, PropsWithChildren, ComponentPropsWithoutRef } from 'react';
2
+ import { type TagType } from './Types';
3
+ export type SectionElementProps<T extends TagType> = {
4
+ as?: T;
5
+ render?: (props: SectionElement<T>, result: {
6
+ value: unknown;
7
+ keyName: string | number;
8
+ }) => React.ReactNode;
9
+ };
10
+ export type SectionElement<T extends TagType> = SectionElementProps<T> & ComponentPropsWithoutRef<T>;
11
+ type InitialState<T extends TagType> = {
12
+ Copied?: SectionElement<T>;
13
+ CountInfo?: SectionElement<T>;
14
+ CountInfoExtra?: SectionElement<T>;
15
+ Ellipsis?: SectionElement<T>;
16
+ KeyName?: SectionElement<T>;
17
+ };
18
+ type Dispatch = React.Dispatch<InitialState<TagType>>;
19
+ export declare const useSectionStore: () => InitialState<TagType>;
20
+ export declare function useSection(): [{
21
+ Copied?: SectionElement<TagType> | undefined;
22
+ CountInfo?: SectionElement<TagType> | undefined;
23
+ CountInfoExtra?: SectionElement<TagType> | undefined;
24
+ Ellipsis?: SectionElement<TagType> | undefined;
25
+ KeyName?: SectionElement<TagType> | undefined;
26
+ }, React.Dispatch<InitialState<TagType>>];
27
+ export declare function useSectionDispatch(): Dispatch;
28
+ interface SectionProps {
29
+ initial: InitialState<TagType>;
30
+ dispatch: Dispatch;
31
+ }
32
+ export declare const Section: FC<PropsWithChildren<SectionProps>>;
33
+ export {};