@uiw/react-json-view 1.12.0 → 2.0.0-alpha.1
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 +256 -262
- 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 +74 -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 +74 -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/cjs/index.d.ts
CHANGED
|
@@ -1,72 +1,94 @@
|
|
|
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
|
+
/** Define the root node name. @default undefined */
|
|
38
|
+
keyName?: string | number;
|
|
39
|
+
/** Whether sort keys through `String.prototype.localeCompare()` @default false */
|
|
40
|
+
objectSortKeys?: boolean | ((a: string, b: string) => number);
|
|
30
41
|
/** Set the indent-width for nested objects @default 15 */
|
|
31
42
|
indentWidth?: number;
|
|
32
|
-
/** When set to `true`, data type labels prefix values @default true */
|
|
33
|
-
displayDataTypes?: boolean;
|
|
34
43
|
/** When set to `true`, `objects` and `arrays` are labeled with size @default true */
|
|
35
44
|
displayObjectSize?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
/** Define the root node name. @default undefined */
|
|
39
|
-
keyName?: string | number;
|
|
45
|
+
/** When set to `true`, data type labels prefix values @default true */
|
|
46
|
+
displayDataTypes?: boolean;
|
|
40
47
|
/** The user can copy objects and arrays to clipboard by clicking on the clipboard icon. @default true */
|
|
41
48
|
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
49
|
/** When set to true, all nodes will be collapsed by default. Use an integer value to collapse at a particular depth. @default false */
|
|
49
50
|
collapsed?: boolean | number;
|
|
51
|
+
/** Whether to highlight updates. @default true */
|
|
52
|
+
highlightUpdates?: boolean;
|
|
53
|
+
/** Shorten long JSON strings, Set to `0` to disable this feature @default 20 */
|
|
54
|
+
shortenTextAfterLength?: number;
|
|
50
55
|
/** Callback function for when a treeNode is expanded or collapsed */
|
|
51
56
|
onExpand?: (props: {
|
|
52
57
|
expand: boolean;
|
|
53
|
-
value
|
|
58
|
+
value?: T;
|
|
54
59
|
keyid: string;
|
|
55
60
|
keyName?: string | number;
|
|
56
61
|
}) => void;
|
|
57
62
|
/** 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
|
-
};
|
|
63
|
+
onCopied?: (text: string, value?: T) => void;
|
|
70
64
|
}
|
|
71
|
-
|
|
65
|
+
type JsonViewComponent = React.FC<React.PropsWithRef<JsonViewProps<object>>> & {
|
|
66
|
+
Bigint: typeof Bigint;
|
|
67
|
+
Date: typeof Date;
|
|
68
|
+
False: typeof False;
|
|
69
|
+
Float: typeof Float;
|
|
70
|
+
Int: typeof Int;
|
|
71
|
+
Map: typeof Map;
|
|
72
|
+
Nan: typeof Nan;
|
|
73
|
+
Null: typeof Null;
|
|
74
|
+
Set: typeof Set;
|
|
75
|
+
String: typeof StringText;
|
|
76
|
+
True: typeof True;
|
|
77
|
+
Undefined: typeof Undefined;
|
|
78
|
+
Url: typeof Url;
|
|
79
|
+
BraceLeft: typeof BraceLeft;
|
|
80
|
+
BraceRight: typeof BraceRight;
|
|
81
|
+
BracketsLeft: typeof BracketsLeft;
|
|
82
|
+
BracketsRight: typeof BracketsRight;
|
|
83
|
+
Colon: typeof Colon;
|
|
84
|
+
Ellipsis: typeof Ellipsis;
|
|
85
|
+
Quote: typeof Quote;
|
|
86
|
+
ValueQuote: typeof ValueQuote;
|
|
87
|
+
Arrow: typeof Arrow;
|
|
88
|
+
Copied: typeof Copied;
|
|
89
|
+
CountInfo: typeof CountInfo;
|
|
90
|
+
CountInfoExtra: typeof CountInfoExtra;
|
|
91
|
+
KeyName: typeof KeyName;
|
|
92
|
+
};
|
|
93
|
+
declare const JsonView: JsonViewComponent;
|
|
72
94
|
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 =
|
|
13
|
-
var
|
|
14
|
-
Object.keys(
|
|
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] ===
|
|
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
|
|
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
|
|
27
|
-
Object.keys(
|
|
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] ===
|
|
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
|
|
60
|
+
return _Expands[key];
|
|
35
61
|
}
|
|
36
62
|
});
|
|
37
63
|
});
|
|
38
|
-
var
|
|
39
|
-
Object.keys(
|
|
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] ===
|
|
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
|
|
72
|
+
return _ShowTools[key];
|
|
47
73
|
}
|
|
48
74
|
});
|
|
49
75
|
});
|
|
50
|
-
var
|
|
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
|
|
114
|
+
var _props$className = props.className,
|
|
115
|
+
className = _props$className === void 0 ? '' : _props$className,
|
|
53
116
|
style = props.style,
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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,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,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,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,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,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 {};
|