@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.
- package/README.md +249 -265
- package/cjs/Container.d.ts +10 -0
- package/cjs/Container.js +67 -0
- package/cjs/arrow/TriangleArrow.js +3 -1
- package/cjs/arrow/TriangleSolidArrow.js +7 -3
- package/cjs/comps/Copied.d.ts +16 -0
- package/cjs/{copied.js → comps/Copied.js} +44 -32
- package/cjs/comps/CountInfo.d.ts +19 -0
- package/cjs/comps/CountInfo.js +72 -0
- package/cjs/comps/Ellipsis.d.ts +10 -0
- package/cjs/comps/Ellipsis.js +35 -0
- package/cjs/comps/Key.d.ts +7 -0
- package/cjs/comps/Key.js +39 -0
- package/cjs/comps/KeyValues.d.ts +22 -0
- package/cjs/comps/KeyValues.js +156 -0
- package/cjs/comps/NestedClose.d.ts +10 -0
- package/cjs/comps/NestedClose.js +38 -0
- package/cjs/comps/NestedOpen.d.ts +11 -0
- package/cjs/comps/NestedOpen.js +95 -0
- package/cjs/comps/ReRender/Symbols.d.ts +44 -0
- package/cjs/comps/ReRender/Symbols.js +144 -0
- package/cjs/comps/ReRender/Types.d.ts +36 -0
- package/cjs/comps/ReRender/Types.js +590 -0
- package/cjs/comps/Value.d.ts +11 -0
- package/cjs/comps/Value.js +78 -0
- package/cjs/index.d.ts +72 -52
- package/cjs/index.js +147 -27
- package/cjs/section/Copied.d.ts +6 -0
- package/cjs/section/Copied.js +17 -0
- package/cjs/section/CountInfo.d.ts +6 -0
- package/cjs/section/CountInfo.js +17 -0
- package/cjs/section/CountInfoExtra.d.ts +6 -0
- package/cjs/section/CountInfoExtra.js +17 -0
- package/cjs/section/Ellipsis.d.ts +6 -0
- package/cjs/section/Ellipsis.js +17 -0
- package/cjs/section/KeyName.d.ts +6 -0
- package/cjs/section/KeyName.js +17 -0
- package/cjs/store/Expands.d.ts +16 -0
- package/cjs/store/Expands.js +44 -0
- package/cjs/store/Section.d.ts +33 -0
- package/cjs/store/Section.js +86 -0
- package/cjs/store/ShowTools.d.ts +14 -0
- package/cjs/store/ShowTools.js +44 -0
- package/cjs/store/Symbols.d.ts +37 -0
- package/cjs/store/Symbols.js +112 -0
- package/cjs/store/Types.d.ts +52 -0
- package/cjs/store/Types.js +162 -0
- package/cjs/store.d.ts +29 -5
- package/cjs/store.js +96 -46
- package/cjs/symbol/Arrow.d.ts +6 -0
- package/cjs/symbol/Arrow.js +17 -0
- package/cjs/symbol/BraceLeft.d.ts +6 -0
- package/cjs/symbol/BraceLeft.js +17 -0
- package/cjs/symbol/BraceRight.d.ts +6 -0
- package/cjs/symbol/BraceRight.js +17 -0
- package/cjs/symbol/BracketsLeft.d.ts +6 -0
- package/cjs/symbol/BracketsLeft.js +17 -0
- package/cjs/symbol/BracketsRight.d.ts +6 -0
- package/cjs/symbol/BracketsRight.js +17 -0
- package/cjs/symbol/Colon.d.ts +6 -0
- package/cjs/symbol/Colon.js +17 -0
- package/cjs/symbol/Quote.d.ts +6 -0
- package/cjs/symbol/Quote.js +17 -0
- package/cjs/symbol/ValueQuote.d.ts +6 -0
- package/cjs/symbol/ValueQuote.js +17 -0
- package/cjs/theme/basic.js +3 -0
- package/cjs/theme/dark.js +3 -0
- package/cjs/theme/github.dark.js +3 -0
- package/cjs/theme/github.light.js +3 -0
- package/cjs/theme/gruvbox.js +3 -0
- package/cjs/theme/light.js +3 -0
- package/cjs/theme/monokai.js +3 -0
- package/cjs/theme/nord.js +3 -0
- package/cjs/theme/vscode.js +3 -0
- package/cjs/type.d.ts +50 -0
- package/cjs/type.js +57 -0
- package/cjs/types/Bigint.d.ts +5 -0
- package/cjs/types/Bigint.js +17 -0
- package/cjs/types/Date.d.ts +5 -0
- package/cjs/types/Date.js +17 -0
- package/cjs/types/False.d.ts +5 -0
- package/cjs/types/False.js +17 -0
- package/cjs/types/Float.d.ts +5 -0
- package/cjs/types/Float.js +17 -0
- package/cjs/types/Int.d.ts +5 -0
- package/cjs/types/Int.js +17 -0
- package/cjs/types/Map.d.ts +5 -0
- package/cjs/types/Map.js +17 -0
- package/cjs/types/Nan.d.ts +5 -0
- package/cjs/types/Nan.js +17 -0
- package/cjs/types/Null.d.ts +5 -0
- package/cjs/types/Null.js +17 -0
- package/cjs/types/Set.d.ts +5 -0
- package/cjs/types/Set.js +17 -0
- package/cjs/types/String.d.ts +5 -0
- package/cjs/types/String.js +17 -0
- package/cjs/types/True.d.ts +5 -0
- package/cjs/types/True.js +17 -0
- package/cjs/types/Undefined.d.ts +5 -0
- package/cjs/types/Undefined.js +17 -0
- package/cjs/types/Url.d.ts +5 -0
- package/cjs/types/Url.js +17 -0
- package/cjs/utils/useHighlight.d.ts +9 -0
- package/cjs/utils/useHighlight.js +62 -0
- package/cjs/utils/useRender.d.ts +6 -0
- package/cjs/utils/useRender.js +51 -0
- package/esm/Container.d.ts +10 -0
- package/esm/Container.js +53 -0
- package/esm/arrow/TriangleArrow.js +3 -1
- package/esm/arrow/TriangleSolidArrow.js +7 -3
- package/esm/comps/Copied.d.ts +16 -0
- package/esm/{copied.js → comps/Copied.js} +44 -29
- package/esm/comps/CountInfo.d.ts +19 -0
- package/esm/comps/CountInfo.js +70 -0
- package/esm/comps/Ellipsis.d.ts +10 -0
- package/esm/comps/Ellipsis.js +31 -0
- package/esm/comps/Key.d.ts +7 -0
- package/esm/comps/Key.js +35 -0
- package/esm/comps/KeyValues.d.ts +22 -0
- package/esm/comps/KeyValues.js +142 -0
- package/esm/comps/NestedClose.d.ts +10 -0
- package/esm/comps/NestedClose.js +34 -0
- package/esm/comps/NestedOpen.d.ts +11 -0
- package/esm/comps/NestedOpen.js +91 -0
- package/esm/comps/ReRender/Symbols.d.ts +44 -0
- package/esm/comps/ReRender/Symbols.js +155 -0
- package/esm/comps/ReRender/Types.d.ts +36 -0
- package/esm/comps/ReRender/Types.js +621 -0
- package/esm/comps/Value.d.ts +11 -0
- package/esm/comps/Value.js +69 -0
- package/esm/index.d.ts +72 -52
- package/esm/index.js +98 -18
- package/esm/section/Copied.d.ts +6 -0
- package/esm/section/Copied.js +10 -0
- package/esm/section/CountInfo.d.ts +6 -0
- package/esm/section/CountInfo.js +10 -0
- package/esm/section/CountInfoExtra.d.ts +6 -0
- package/esm/section/CountInfoExtra.js +10 -0
- package/esm/section/Ellipsis.d.ts +6 -0
- package/esm/section/Ellipsis.js +10 -0
- package/esm/section/KeyName.d.ts +6 -0
- package/esm/section/KeyName.js +10 -0
- package/esm/store/Expands.d.ts +16 -0
- package/esm/store/Expands.js +32 -0
- package/esm/store/Section.d.ts +33 -0
- package/esm/store/Section.js +73 -0
- package/esm/store/ShowTools.d.ts +14 -0
- package/esm/store/ShowTools.js +32 -0
- package/esm/store/Symbols.d.ts +37 -0
- package/esm/store/Symbols.js +100 -0
- package/esm/store/Types.d.ts +52 -0
- package/esm/store/Types.js +150 -0
- package/esm/store.d.ts +29 -5
- package/esm/store.js +66 -32
- package/esm/symbol/Arrow.d.ts +6 -0
- package/esm/symbol/Arrow.js +10 -0
- package/esm/symbol/BraceLeft.d.ts +6 -0
- package/esm/symbol/BraceLeft.js +10 -0
- package/esm/symbol/BraceRight.d.ts +6 -0
- package/esm/symbol/BraceRight.js +10 -0
- package/esm/symbol/BracketsLeft.d.ts +6 -0
- package/esm/symbol/BracketsLeft.js +10 -0
- package/esm/symbol/BracketsRight.d.ts +6 -0
- package/esm/symbol/BracketsRight.js +10 -0
- package/esm/symbol/Colon.d.ts +6 -0
- package/esm/symbol/Colon.js +10 -0
- package/esm/symbol/Quote.d.ts +6 -0
- package/esm/symbol/Quote.js +10 -0
- package/esm/symbol/ValueQuote.d.ts +6 -0
- package/esm/symbol/ValueQuote.js +10 -0
- package/esm/theme/basic.js +3 -0
- package/esm/theme/dark.js +3 -0
- package/esm/theme/github.dark.js +3 -0
- package/esm/theme/github.light.js +3 -0
- package/esm/theme/gruvbox.js +3 -0
- package/esm/theme/light.js +3 -0
- package/esm/theme/monokai.js +3 -0
- package/esm/theme/nord.js +3 -0
- package/esm/theme/vscode.js +3 -0
- package/esm/type.d.ts +50 -0
- package/esm/type.js +50 -0
- package/esm/types/Bigint.d.ts +5 -0
- package/esm/types/Bigint.js +10 -0
- package/esm/types/Date.d.ts +5 -0
- package/esm/types/Date.js +10 -0
- package/esm/types/False.d.ts +5 -0
- package/esm/types/False.js +10 -0
- package/esm/types/Float.d.ts +5 -0
- package/esm/types/Float.js +10 -0
- package/esm/types/Int.d.ts +5 -0
- package/esm/types/Int.js +10 -0
- package/esm/types/Map.d.ts +5 -0
- package/esm/types/Map.js +10 -0
- package/esm/types/Nan.d.ts +5 -0
- package/esm/types/Nan.js +10 -0
- package/esm/types/Null.d.ts +5 -0
- package/esm/types/Null.js +10 -0
- package/esm/types/Set.d.ts +5 -0
- package/esm/types/Set.js +10 -0
- package/esm/types/String.d.ts +5 -0
- package/esm/types/String.js +10 -0
- package/esm/types/True.d.ts +5 -0
- package/esm/types/True.js +10 -0
- package/esm/types/Undefined.d.ts +5 -0
- package/esm/types/Undefined.js +10 -0
- package/esm/types/Url.d.ts +5 -0
- package/esm/types/Url.js +10 -0
- package/esm/utils/useHighlight.d.ts +9 -0
- package/esm/{semicolon.js → utils/useHighlight.js} +1 -52
- package/esm/utils/useRender.d.ts +6 -0
- package/esm/utils/useRender.js +41 -0
- package/package.json +1 -1
- package/cjs/comps/ellipsis.d.ts +0 -7
- package/cjs/comps/ellipsis.js +0 -37
- package/cjs/comps/meta.d.ts +0 -12
- package/cjs/comps/meta.js +0 -46
- package/cjs/copied.d.ts +0 -11
- package/cjs/editor/countInfoExtra.d.ts +0 -28
- package/cjs/editor/countInfoExtra.js +0 -101
- package/cjs/editor/icon/add.d.ts +0 -4
- package/cjs/editor/icon/add.js +0 -30
- package/cjs/editor/icon/delete.d.ts +0 -4
- package/cjs/editor/icon/delete.js +0 -30
- package/cjs/editor/icon/edit.d.ts +0 -4
- package/cjs/editor/icon/edit.js +0 -30
- package/cjs/editor/index.d.ts +0 -31
- package/cjs/editor/index.js +0 -60
- package/cjs/editor/objectKey.d.ts +0 -11
- package/cjs/editor/objectKey.js +0 -169
- package/cjs/editor/value.d.ts +0 -22
- package/cjs/editor/value.js +0 -240
- package/cjs/node.d.ts +0 -15
- package/cjs/node.js +0 -343
- package/cjs/semicolon.d.ts +0 -22
- package/cjs/semicolon.js +0 -115
- package/cjs/value.d.ts +0 -93
- package/cjs/value.js +0 -356
- package/esm/comps/ellipsis.d.ts +0 -7
- package/esm/comps/ellipsis.js +0 -31
- package/esm/comps/meta.d.ts +0 -12
- package/esm/comps/meta.js +0 -39
- package/esm/copied.d.ts +0 -11
- package/esm/editor/countInfoExtra.d.ts +0 -28
- package/esm/editor/countInfoExtra.js +0 -68
- package/esm/editor/icon/add.d.ts +0 -4
- package/esm/editor/icon/add.js +0 -24
- package/esm/editor/icon/delete.d.ts +0 -4
- package/esm/editor/icon/delete.js +0 -24
- package/esm/editor/icon/edit.d.ts +0 -4
- package/esm/editor/icon/edit.js +0 -24
- package/esm/editor/index.d.ts +0 -31
- package/esm/editor/index.js +0 -47
- package/esm/editor/objectKey.d.ts +0 -11
- package/esm/editor/objectKey.js +0 -135
- package/esm/editor/value.d.ts +0 -22
- package/esm/editor/value.js +0 -192
- package/esm/node.d.ts +0 -15
- package/esm/node.js +0 -299
- package/esm/semicolon.d.ts +0 -22
- package/esm/value.d.ts +0 -93
- package/esm/value.js +0 -331
package/esm/index.d.ts
CHANGED
|
@@ -1,72 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
/**
|
|
37
|
-
|
|
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
|
|
56
|
+
value?: T;
|
|
54
57
|
keyid: string;
|
|
55
58
|
keyName?: string | number;
|
|
56
59
|
}) => void;
|
|
57
60
|
/** Fires event when you copy */
|
|
58
|
-
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
|
-
|
|
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/esm/index.js
CHANGED
|
@@ -1,20 +1,60 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["
|
|
4
|
-
import React, { useId } from 'react';
|
|
3
|
+
var _excluded = ["className", "style", "value", "children", "collapsed", "indentWidth", "displayObjectSize", "shortenTextAfterLength", "highlightUpdates", "enableClipboard", "displayDataTypes", "objectSortKeys", "onExpand"];
|
|
5
4
|
import { forwardRef } from 'react';
|
|
6
|
-
import {
|
|
5
|
+
import { Provider } from './store';
|
|
6
|
+
import { Container } from './Container';
|
|
7
|
+
import { BraceLeft } from './symbol/BraceLeft';
|
|
8
|
+
import { BraceRight } from './symbol/BraceRight';
|
|
9
|
+
import { BracketsLeft } from './symbol/BracketsLeft';
|
|
10
|
+
import { BracketsRight } from './symbol/BracketsRight';
|
|
11
|
+
import { Arrow } from './symbol/Arrow';
|
|
12
|
+
import { Colon } from './symbol/Colon';
|
|
13
|
+
import { Quote } from './symbol/Quote';
|
|
14
|
+
import { ValueQuote } from './symbol/ValueQuote';
|
|
15
|
+
import { Bigint } from './types/Bigint';
|
|
16
|
+
import { Date } from './types/Date';
|
|
17
|
+
import { False } from './types/False';
|
|
18
|
+
import { Float } from './types/Float';
|
|
19
|
+
import { Int } from './types/Int';
|
|
20
|
+
import { Map } from './types/Map';
|
|
21
|
+
import { Nan } from './types/Nan';
|
|
22
|
+
import { Null } from './types/Null';
|
|
23
|
+
import { Set } from './types/Set';
|
|
24
|
+
import { StringText } from './types/String';
|
|
25
|
+
import { True } from './types/True';
|
|
26
|
+
import { Undefined } from './types/Undefined';
|
|
27
|
+
import { Url } from './types/Url';
|
|
28
|
+
import { Copied } from './section/Copied';
|
|
29
|
+
import { CountInfo } from './section/CountInfo';
|
|
30
|
+
import { CountInfoExtra } from './section/CountInfoExtra';
|
|
31
|
+
import { Ellipsis } from './section/Ellipsis';
|
|
32
|
+
import { KeyName } from './section/KeyName';
|
|
7
33
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
34
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
35
|
+
export * from './store';
|
|
36
|
+
export * from './store/Expands';
|
|
37
|
+
export * from './store/ShowTools';
|
|
38
|
+
export * from './store/Symbols';
|
|
39
|
+
export * from './store/Types';
|
|
40
|
+
export * from './comps/ReRender/Symbols';
|
|
11
41
|
var JsonView = /*#__PURE__*/forwardRef((props, ref) => {
|
|
12
42
|
var {
|
|
13
|
-
|
|
43
|
+
className = '',
|
|
14
44
|
style,
|
|
15
|
-
|
|
45
|
+
value,
|
|
46
|
+
children,
|
|
47
|
+
collapsed,
|
|
48
|
+
indentWidth = 15,
|
|
49
|
+
displayObjectSize = true,
|
|
50
|
+
shortenTextAfterLength = 20,
|
|
51
|
+
highlightUpdates = true,
|
|
52
|
+
enableClipboard = true,
|
|
53
|
+
displayDataTypes = true,
|
|
54
|
+
objectSortKeys = false,
|
|
55
|
+
onExpand
|
|
16
56
|
} = props,
|
|
17
|
-
|
|
57
|
+
elmProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
18
58
|
var defaultStyle = _extends({
|
|
19
59
|
lineHeight: 1.4,
|
|
20
60
|
fontFamily: 'var(--w-rjv-font-family, Menlo, monospace)',
|
|
@@ -23,15 +63,55 @@ var JsonView = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
23
63
|
fontSize: 13
|
|
24
64
|
}, style);
|
|
25
65
|
var cls = "w-json-view-container w-rjv " + (className || '');
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
66
|
+
return /*#__PURE__*/_jsxs(Provider, {
|
|
67
|
+
initialState: {
|
|
68
|
+
value,
|
|
69
|
+
objectSortKeys,
|
|
70
|
+
indentWidth,
|
|
71
|
+
displayObjectSize,
|
|
72
|
+
collapsed,
|
|
73
|
+
enableClipboard,
|
|
74
|
+
shortenTextAfterLength,
|
|
75
|
+
highlightUpdates,
|
|
76
|
+
onExpand
|
|
77
|
+
},
|
|
78
|
+
initialTypes: {
|
|
79
|
+
displayDataTypes
|
|
80
|
+
},
|
|
81
|
+
children: [/*#__PURE__*/_jsx(Container, _extends({
|
|
82
|
+
value: value
|
|
83
|
+
}, elmProps, {
|
|
84
|
+
ref: ref,
|
|
85
|
+
className: cls,
|
|
86
|
+
style: defaultStyle
|
|
87
|
+
})), children]
|
|
88
|
+
});
|
|
35
89
|
});
|
|
90
|
+
JsonView.Bigint = Bigint;
|
|
91
|
+
JsonView.Date = Date;
|
|
92
|
+
JsonView.False = False;
|
|
93
|
+
JsonView.Float = Float;
|
|
94
|
+
JsonView.Int = Int;
|
|
95
|
+
JsonView.Map = Map;
|
|
96
|
+
JsonView.Nan = Nan;
|
|
97
|
+
JsonView.Null = Null;
|
|
98
|
+
JsonView.Set = Set;
|
|
99
|
+
JsonView.String = StringText;
|
|
100
|
+
JsonView.True = True;
|
|
101
|
+
JsonView.Undefined = Undefined;
|
|
102
|
+
JsonView.Url = Url;
|
|
103
|
+
JsonView.ValueQuote = ValueQuote;
|
|
104
|
+
JsonView.Arrow = Arrow;
|
|
105
|
+
JsonView.Colon = Colon;
|
|
106
|
+
JsonView.Quote = Quote;
|
|
107
|
+
JsonView.Ellipsis = Ellipsis;
|
|
108
|
+
JsonView.BraceLeft = BraceLeft;
|
|
109
|
+
JsonView.BraceRight = BraceRight;
|
|
110
|
+
JsonView.BracketsLeft = BracketsLeft;
|
|
111
|
+
JsonView.BracketsRight = BracketsRight;
|
|
112
|
+
JsonView.Copied = Copied;
|
|
113
|
+
JsonView.CountInfo = CountInfo;
|
|
114
|
+
JsonView.CountInfoExtra = CountInfoExtra;
|
|
115
|
+
JsonView.KeyName = KeyName;
|
|
36
116
|
JsonView.displayName = 'JVR.JsonView';
|
|
37
117
|
export default JsonView;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useSectionStore } from '../store/Section';
|
|
2
|
+
import { useSectionRender } from '../utils/useRender';
|
|
3
|
+
export var Copied = props => {
|
|
4
|
+
var {
|
|
5
|
+
Copied: Comp = {}
|
|
6
|
+
} = useSectionStore();
|
|
7
|
+
useSectionRender(Comp, props, 'Copied');
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
Copied.displayName = 'JVR.Copied';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useSectionStore } from '../store/Section';
|
|
2
|
+
import { useSectionRender } from '../utils/useRender';
|
|
3
|
+
export var CountInfo = props => {
|
|
4
|
+
var {
|
|
5
|
+
CountInfo: Comp = {}
|
|
6
|
+
} = useSectionStore();
|
|
7
|
+
useSectionRender(Comp, props, 'CountInfo');
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
CountInfo.displayName = 'JVR.CountInfo';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useSectionStore } from '../store/Section';
|
|
2
|
+
import { useSectionRender } from '../utils/useRender';
|
|
3
|
+
export var CountInfoExtra = props => {
|
|
4
|
+
var {
|
|
5
|
+
CountInfoExtra: Comp = {}
|
|
6
|
+
} = useSectionStore();
|
|
7
|
+
useSectionRender(Comp, props, 'CountInfoExtra');
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
CountInfoExtra.displayName = 'JVR.CountInfoExtra';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useSectionStore } from '../store/Section';
|
|
2
|
+
import { useSectionRender } from '../utils/useRender';
|
|
3
|
+
export var Ellipsis = props => {
|
|
4
|
+
var {
|
|
5
|
+
Ellipsis: Comp = {}
|
|
6
|
+
} = useSectionStore();
|
|
7
|
+
useSectionRender(Comp, props, 'Ellipsis');
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
Ellipsis.displayName = 'JVR.Ellipsis';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useSectionStore } from '../store/Section';
|
|
2
|
+
import { useSectionRender } from '../utils/useRender';
|
|
3
|
+
export var KeyName = props => {
|
|
4
|
+
var {
|
|
5
|
+
KeyName: Comp = {}
|
|
6
|
+
} = useSectionStore();
|
|
7
|
+
useSectionRender(Comp, props, 'KeyName');
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
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,32 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import { createContext, useContext, useReducer } from 'react';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
var initialState = {};
|
|
5
|
+
var Context = /*#__PURE__*/createContext(initialState);
|
|
6
|
+
var reducer = (state, action) => _extends({}, state, action);
|
|
7
|
+
export var useExpandsStore = () => {
|
|
8
|
+
return useContext(Context);
|
|
9
|
+
};
|
|
10
|
+
var DispatchExpands = /*#__PURE__*/createContext(() => {});
|
|
11
|
+
DispatchExpands.displayName = 'JVR.DispatchExpands';
|
|
12
|
+
export function useExpands() {
|
|
13
|
+
return useReducer(reducer, initialState);
|
|
14
|
+
}
|
|
15
|
+
export function useExpandsDispatch() {
|
|
16
|
+
return useContext(DispatchExpands);
|
|
17
|
+
}
|
|
18
|
+
export var Expands = _ref => {
|
|
19
|
+
var {
|
|
20
|
+
initial,
|
|
21
|
+
dispatch,
|
|
22
|
+
children
|
|
23
|
+
} = _ref;
|
|
24
|
+
return /*#__PURE__*/_jsx(Context.Provider, {
|
|
25
|
+
value: initial,
|
|
26
|
+
children: /*#__PURE__*/_jsx(DispatchExpands.Provider, {
|
|
27
|
+
value: dispatch,
|
|
28
|
+
children: children
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
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 {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { createContext, useContext, useReducer } from 'react';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
var initialState = {
|
|
5
|
+
Copied: {
|
|
6
|
+
className: 'w-rjv-copied',
|
|
7
|
+
style: {
|
|
8
|
+
height: '1em',
|
|
9
|
+
width: '1em',
|
|
10
|
+
cursor: 'pointer',
|
|
11
|
+
verticalAlign: 'middle',
|
|
12
|
+
marginLeft: 5
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
CountInfo: {
|
|
16
|
+
as: 'span',
|
|
17
|
+
className: 'w-rjv-object-size',
|
|
18
|
+
style: {
|
|
19
|
+
color: 'var(--w-rjv-info-color, #0000004d)',
|
|
20
|
+
paddingLeft: 8,
|
|
21
|
+
fontStyle: 'italic'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
CountInfoExtra: {
|
|
25
|
+
as: 'span',
|
|
26
|
+
className: 'w-rjv-object-extra',
|
|
27
|
+
style: {
|
|
28
|
+
paddingLeft: 8
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
Ellipsis: {
|
|
32
|
+
as: 'span',
|
|
33
|
+
style: {
|
|
34
|
+
cursor: 'pointer',
|
|
35
|
+
color: 'var(--w-rjv-ellipsis-color, #cb4b16)',
|
|
36
|
+
userSelect: 'none'
|
|
37
|
+
},
|
|
38
|
+
className: 'w-rjv-ellipsis',
|
|
39
|
+
children: '...'
|
|
40
|
+
},
|
|
41
|
+
KeyName: {
|
|
42
|
+
as: 'span',
|
|
43
|
+
className: 'w-rjv-object-key'
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
var Context = /*#__PURE__*/createContext(initialState);
|
|
47
|
+
var reducer = (state, action) => _extends({}, state, action);
|
|
48
|
+
export var useSectionStore = () => {
|
|
49
|
+
return useContext(Context);
|
|
50
|
+
};
|
|
51
|
+
var DispatchSection = /*#__PURE__*/createContext(() => {});
|
|
52
|
+
DispatchSection.displayName = 'JVR.DispatchSection';
|
|
53
|
+
export function useSection() {
|
|
54
|
+
return useReducer(reducer, initialState);
|
|
55
|
+
}
|
|
56
|
+
export function useSectionDispatch() {
|
|
57
|
+
return useContext(DispatchSection);
|
|
58
|
+
}
|
|
59
|
+
export var Section = _ref => {
|
|
60
|
+
var {
|
|
61
|
+
initial,
|
|
62
|
+
dispatch,
|
|
63
|
+
children
|
|
64
|
+
} = _ref;
|
|
65
|
+
return /*#__PURE__*/_jsx(Context.Provider, {
|
|
66
|
+
value: initial,
|
|
67
|
+
children: /*#__PURE__*/_jsx(DispatchSection.Provider, {
|
|
68
|
+
value: dispatch,
|
|
69
|
+
children: children
|
|
70
|
+
})
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
Section.displayName = 'JVR.Section';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
type InitialState = Record<string, boolean>;
|
|
3
|
+
type Dispatch = React.Dispatch<InitialState>;
|
|
4
|
+
export declare const useShowToolsStore: () => InitialState;
|
|
5
|
+
export declare function useShowTools(): [{
|
|
6
|
+
[x: string]: boolean;
|
|
7
|
+
}, import("react").Dispatch<InitialState>];
|
|
8
|
+
export declare function useShowToolsDispatch(): Dispatch;
|
|
9
|
+
interface ShowToolsProps {
|
|
10
|
+
initial: InitialState;
|
|
11
|
+
dispatch: Dispatch;
|
|
12
|
+
}
|
|
13
|
+
export declare const ShowTools: FC<PropsWithChildren<ShowToolsProps>>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import { createContext, useContext, useReducer } from 'react';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
var initialState = {};
|
|
5
|
+
var Context = /*#__PURE__*/createContext(initialState);
|
|
6
|
+
var reducer = (state, action) => _extends({}, state, action);
|
|
7
|
+
export var useShowToolsStore = () => {
|
|
8
|
+
return useContext(Context);
|
|
9
|
+
};
|
|
10
|
+
var DispatchShowTools = /*#__PURE__*/createContext(() => {});
|
|
11
|
+
DispatchShowTools.displayName = 'JVR.DispatchShowTools';
|
|
12
|
+
export function useShowTools() {
|
|
13
|
+
return useReducer(reducer, initialState);
|
|
14
|
+
}
|
|
15
|
+
export function useShowToolsDispatch() {
|
|
16
|
+
return useContext(DispatchShowTools);
|
|
17
|
+
}
|
|
18
|
+
export var ShowTools = _ref => {
|
|
19
|
+
var {
|
|
20
|
+
initial,
|
|
21
|
+
dispatch,
|
|
22
|
+
children
|
|
23
|
+
} = _ref;
|
|
24
|
+
return /*#__PURE__*/_jsx(Context.Provider, {
|
|
25
|
+
value: initial,
|
|
26
|
+
children: /*#__PURE__*/_jsx(DispatchShowTools.Provider, {
|
|
27
|
+
value: dispatch,
|
|
28
|
+
children: children
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
ShowTools.displayName = 'JVR.ShowTools';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FC, PropsWithChildren, ElementType, ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { type TagType } from './Types';
|
|
3
|
+
type SymbolsElementProps<T extends TagType> = {
|
|
4
|
+
as?: T;
|
|
5
|
+
render?: (props: SymbolsElement<T>) => React.ReactNode;
|
|
6
|
+
'data-type'?: string;
|
|
7
|
+
};
|
|
8
|
+
export type SymbolsElement<T extends TagType> = SymbolsElementProps<T> & ComponentPropsWithoutRef<T>;
|
|
9
|
+
type InitialState<T extends ElementType = 'span'> = {
|
|
10
|
+
Arrow?: SymbolsElement<T>;
|
|
11
|
+
Colon?: SymbolsElement<T>;
|
|
12
|
+
Quote?: SymbolsElement<T>;
|
|
13
|
+
ValueQuote?: SymbolsElement<T>;
|
|
14
|
+
BracketsRight?: SymbolsElement<T>;
|
|
15
|
+
BracketsLeft?: SymbolsElement<T>;
|
|
16
|
+
BraceRight?: SymbolsElement<T>;
|
|
17
|
+
BraceLeft?: SymbolsElement<T>;
|
|
18
|
+
};
|
|
19
|
+
type Dispatch = React.Dispatch<InitialState<TagType>>;
|
|
20
|
+
export declare const useSymbolsStore: () => InitialState<TagType>;
|
|
21
|
+
export declare function useSymbols(): [{
|
|
22
|
+
Arrow?: SymbolsElement<TagType> | undefined;
|
|
23
|
+
Colon?: SymbolsElement<TagType> | undefined;
|
|
24
|
+
Quote?: SymbolsElement<TagType> | undefined;
|
|
25
|
+
ValueQuote?: SymbolsElement<TagType> | undefined;
|
|
26
|
+
BracketsRight?: SymbolsElement<TagType> | undefined;
|
|
27
|
+
BracketsLeft?: SymbolsElement<TagType> | undefined;
|
|
28
|
+
BraceRight?: SymbolsElement<TagType> | undefined;
|
|
29
|
+
BraceLeft?: SymbolsElement<TagType> | undefined;
|
|
30
|
+
}, import("react").Dispatch<InitialState<TagType>>];
|
|
31
|
+
export declare function useSymbolsDispatch(): Dispatch;
|
|
32
|
+
interface SymbolsProps {
|
|
33
|
+
initial: InitialState<TagType>;
|
|
34
|
+
dispatch: Dispatch;
|
|
35
|
+
}
|
|
36
|
+
export declare const Symbols: FC<PropsWithChildren<SymbolsProps>>;
|
|
37
|
+
export {};
|