@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
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import { createContext, useContext, useReducer } from 'react';
|
|
3
|
+
import { TriangleArrow } from '../arrow/TriangleArrow';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
var initialState = {
|
|
6
|
+
Arrow: {
|
|
7
|
+
as: 'span',
|
|
8
|
+
style: {
|
|
9
|
+
transform: 'rotate(0deg)',
|
|
10
|
+
transition: 'all 0.3s'
|
|
11
|
+
},
|
|
12
|
+
children: /*#__PURE__*/_jsx(TriangleArrow, {})
|
|
13
|
+
},
|
|
14
|
+
Colon: {
|
|
15
|
+
as: 'span',
|
|
16
|
+
style: {
|
|
17
|
+
color: 'var(--w-rjv-colon-color, var(--w-rjv-color))',
|
|
18
|
+
marginLeft: 0,
|
|
19
|
+
marginRight: 2
|
|
20
|
+
},
|
|
21
|
+
className: 'w-rjv-colon',
|
|
22
|
+
children: ':'
|
|
23
|
+
},
|
|
24
|
+
Quote: {
|
|
25
|
+
as: 'span',
|
|
26
|
+
style: {
|
|
27
|
+
color: 'var(--w-rjv-quotes-color, #236a7c)'
|
|
28
|
+
},
|
|
29
|
+
className: 'w-rjv-quotes',
|
|
30
|
+
children: '"'
|
|
31
|
+
},
|
|
32
|
+
ValueQuote: {
|
|
33
|
+
as: 'span',
|
|
34
|
+
style: {
|
|
35
|
+
color: 'var(--w-rjv-quotes-string-color, #cb4b16)'
|
|
36
|
+
},
|
|
37
|
+
className: 'w-rjv-quotes',
|
|
38
|
+
children: '"'
|
|
39
|
+
},
|
|
40
|
+
BracketsLeft: {
|
|
41
|
+
as: 'span',
|
|
42
|
+
style: {
|
|
43
|
+
color: 'var(--w-rjv-brackets-color, #236a7c)'
|
|
44
|
+
},
|
|
45
|
+
className: 'w-rjv-brackets-start',
|
|
46
|
+
children: '['
|
|
47
|
+
},
|
|
48
|
+
BracketsRight: {
|
|
49
|
+
as: 'span',
|
|
50
|
+
style: {
|
|
51
|
+
color: 'var(--w-rjv-brackets-color, #236a7c)'
|
|
52
|
+
},
|
|
53
|
+
className: 'w-rjv-brackets-end',
|
|
54
|
+
children: ']'
|
|
55
|
+
},
|
|
56
|
+
BraceLeft: {
|
|
57
|
+
as: 'span',
|
|
58
|
+
style: {
|
|
59
|
+
color: 'var(--w-rjv-curlybraces-color, #236a7c)'
|
|
60
|
+
},
|
|
61
|
+
className: 'w-rjv-curlybraces-start',
|
|
62
|
+
children: '{'
|
|
63
|
+
},
|
|
64
|
+
BraceRight: {
|
|
65
|
+
as: 'span',
|
|
66
|
+
style: {
|
|
67
|
+
color: 'var(--w-rjv-curlybraces-color, #236a7c)'
|
|
68
|
+
},
|
|
69
|
+
className: 'w-rjv-curlybraces-end',
|
|
70
|
+
children: '}'
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var Context = /*#__PURE__*/createContext(initialState);
|
|
74
|
+
var reducer = (state, action) => _extends({}, state, action);
|
|
75
|
+
export var useSymbolsStore = () => {
|
|
76
|
+
return useContext(Context);
|
|
77
|
+
};
|
|
78
|
+
var DispatchSymbols = /*#__PURE__*/createContext(() => {});
|
|
79
|
+
DispatchSymbols.displayName = 'JVR.DispatchSymbols';
|
|
80
|
+
export function useSymbols() {
|
|
81
|
+
return useReducer(reducer, initialState);
|
|
82
|
+
}
|
|
83
|
+
export function useSymbolsDispatch() {
|
|
84
|
+
return useContext(DispatchSymbols);
|
|
85
|
+
}
|
|
86
|
+
export var Symbols = _ref => {
|
|
87
|
+
var {
|
|
88
|
+
initial,
|
|
89
|
+
dispatch,
|
|
90
|
+
children
|
|
91
|
+
} = _ref;
|
|
92
|
+
return /*#__PURE__*/_jsx(Context.Provider, {
|
|
93
|
+
value: initial,
|
|
94
|
+
children: /*#__PURE__*/_jsx(DispatchSymbols.Provider, {
|
|
95
|
+
value: dispatch,
|
|
96
|
+
children: children
|
|
97
|
+
})
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
Symbols.displayName = 'JVR.Symbols';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { FC, PropsWithChildren, ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export type TagType = React.ElementType | keyof JSX.IntrinsicElements;
|
|
3
|
+
type TypesElementProps<T extends TagType> = {
|
|
4
|
+
as?: T;
|
|
5
|
+
render?: (props: TypesElement<T>, result: {
|
|
6
|
+
type: 'type' | 'value';
|
|
7
|
+
value?: unknown;
|
|
8
|
+
}) => React.ReactNode;
|
|
9
|
+
'data-type'?: string;
|
|
10
|
+
};
|
|
11
|
+
export type TypesElement<T extends TagType> = TypesElementProps<T> & ComponentPropsWithoutRef<T>;
|
|
12
|
+
export type InitialTypesState = {
|
|
13
|
+
displayDataTypes?: boolean;
|
|
14
|
+
Url?: TypesElement<TagType>;
|
|
15
|
+
Str?: TypesElement<TagType>;
|
|
16
|
+
Undefined?: TypesElement<TagType>;
|
|
17
|
+
Null?: TypesElement<TagType>;
|
|
18
|
+
True?: TypesElement<TagType>;
|
|
19
|
+
False?: TypesElement<TagType>;
|
|
20
|
+
Date?: TypesElement<TagType>;
|
|
21
|
+
Float?: TypesElement<TagType>;
|
|
22
|
+
Set?: TypesElement<TagType>;
|
|
23
|
+
Int?: TypesElement<TagType>;
|
|
24
|
+
Map?: TypesElement<TagType>;
|
|
25
|
+
Nan?: TypesElement<TagType>;
|
|
26
|
+
Bigint?: TypesElement<TagType>;
|
|
27
|
+
};
|
|
28
|
+
type Dispatch = React.Dispatch<InitialTypesState>;
|
|
29
|
+
export declare const useTypesStore: () => InitialTypesState;
|
|
30
|
+
export declare function useTypes(): [{
|
|
31
|
+
displayDataTypes?: boolean | undefined;
|
|
32
|
+
Url?: TypesElement<TagType> | undefined;
|
|
33
|
+
Str?: TypesElement<TagType> | undefined;
|
|
34
|
+
Undefined?: TypesElement<TagType> | undefined;
|
|
35
|
+
Null?: TypesElement<TagType> | undefined;
|
|
36
|
+
True?: TypesElement<TagType> | undefined;
|
|
37
|
+
False?: TypesElement<TagType> | undefined;
|
|
38
|
+
Date?: TypesElement<TagType> | undefined;
|
|
39
|
+
Float?: TypesElement<TagType> | undefined;
|
|
40
|
+
Set?: TypesElement<TagType> | undefined;
|
|
41
|
+
Int?: TypesElement<TagType> | undefined;
|
|
42
|
+
Map?: TypesElement<TagType> | undefined;
|
|
43
|
+
Nan?: TypesElement<TagType> | undefined;
|
|
44
|
+
Bigint?: TypesElement<TagType> | undefined;
|
|
45
|
+
}, import("react").Dispatch<InitialTypesState>];
|
|
46
|
+
export declare function useTypesDispatch(): Dispatch;
|
|
47
|
+
interface TypesProps {
|
|
48
|
+
initial: InitialTypesState;
|
|
49
|
+
dispatch: Dispatch;
|
|
50
|
+
}
|
|
51
|
+
export declare const Types: FC<PropsWithChildren<TypesProps>>;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,150 @@
|
|
|
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
|
+
Str: {
|
|
6
|
+
as: 'span',
|
|
7
|
+
'data-type': 'string',
|
|
8
|
+
style: {
|
|
9
|
+
color: 'var(--w-rjv-type-string-color, #cb4b16)'
|
|
10
|
+
},
|
|
11
|
+
className: 'w-rjv-type',
|
|
12
|
+
children: 'string'
|
|
13
|
+
},
|
|
14
|
+
Url: {
|
|
15
|
+
as: 'a',
|
|
16
|
+
style: {
|
|
17
|
+
color: 'var(--w-rjv-type-url-color, #0969da)'
|
|
18
|
+
},
|
|
19
|
+
'data-type': 'url',
|
|
20
|
+
className: 'w-rjv-type',
|
|
21
|
+
children: 'url'
|
|
22
|
+
},
|
|
23
|
+
Undefined: {
|
|
24
|
+
style: {
|
|
25
|
+
color: 'var(--w-rjv-type-undefined-color, #586e75)'
|
|
26
|
+
},
|
|
27
|
+
as: 'span',
|
|
28
|
+
'data-type': 'undefined',
|
|
29
|
+
className: 'w-rjv-type',
|
|
30
|
+
children: 'undefined'
|
|
31
|
+
},
|
|
32
|
+
Null: {
|
|
33
|
+
style: {
|
|
34
|
+
color: 'var(--w-rjv-type-null-color, #d33682)'
|
|
35
|
+
},
|
|
36
|
+
as: 'span',
|
|
37
|
+
'data-type': 'null',
|
|
38
|
+
className: 'w-rjv-type',
|
|
39
|
+
children: 'null'
|
|
40
|
+
},
|
|
41
|
+
Map: {
|
|
42
|
+
style: {
|
|
43
|
+
color: 'var(--w-rjv-type-map-color, #268bd2)'
|
|
44
|
+
},
|
|
45
|
+
as: 'span',
|
|
46
|
+
'data-type': 'map',
|
|
47
|
+
className: 'w-rjv-type',
|
|
48
|
+
children: 'Map'
|
|
49
|
+
},
|
|
50
|
+
Nan: {
|
|
51
|
+
style: {
|
|
52
|
+
color: 'var(--w-rjv-type-nan-color, #859900)'
|
|
53
|
+
},
|
|
54
|
+
as: 'span',
|
|
55
|
+
'data-type': 'nan',
|
|
56
|
+
className: 'w-rjv-type',
|
|
57
|
+
children: 'NaN'
|
|
58
|
+
},
|
|
59
|
+
Bigint: {
|
|
60
|
+
style: {
|
|
61
|
+
color: 'var(--w-rjv-type-bigint-color, #268bd2)'
|
|
62
|
+
},
|
|
63
|
+
as: 'span',
|
|
64
|
+
'data-type': 'bigint',
|
|
65
|
+
className: 'w-rjv-type',
|
|
66
|
+
children: 'bigint'
|
|
67
|
+
},
|
|
68
|
+
Int: {
|
|
69
|
+
style: {
|
|
70
|
+
color: 'var(--w-rjv-type-int-color, #268bd2)'
|
|
71
|
+
},
|
|
72
|
+
as: 'span',
|
|
73
|
+
'data-type': 'int',
|
|
74
|
+
className: 'w-rjv-type',
|
|
75
|
+
children: 'int'
|
|
76
|
+
},
|
|
77
|
+
Set: {
|
|
78
|
+
style: {
|
|
79
|
+
color: 'var(--w-rjv-type-set-color, #268bd2)'
|
|
80
|
+
},
|
|
81
|
+
as: 'span',
|
|
82
|
+
'data-type': 'set',
|
|
83
|
+
className: 'w-rjv-type',
|
|
84
|
+
children: 'Set'
|
|
85
|
+
},
|
|
86
|
+
Float: {
|
|
87
|
+
style: {
|
|
88
|
+
color: 'var(--w-rjv-type-float-color, #859900)'
|
|
89
|
+
},
|
|
90
|
+
as: 'span',
|
|
91
|
+
'data-type': 'float',
|
|
92
|
+
className: 'w-rjv-type',
|
|
93
|
+
children: 'float'
|
|
94
|
+
},
|
|
95
|
+
True: {
|
|
96
|
+
style: {
|
|
97
|
+
color: 'var(--w-rjv-type-boolean-color, #2aa198)'
|
|
98
|
+
},
|
|
99
|
+
as: 'span',
|
|
100
|
+
'data-type': 'bool',
|
|
101
|
+
className: 'w-rjv-type',
|
|
102
|
+
children: 'bool'
|
|
103
|
+
},
|
|
104
|
+
False: {
|
|
105
|
+
style: {
|
|
106
|
+
color: 'var(--w-rjv-type-boolean-color, #2aa198)'
|
|
107
|
+
},
|
|
108
|
+
as: 'span',
|
|
109
|
+
'data-type': 'bool',
|
|
110
|
+
className: 'w-rjv-type',
|
|
111
|
+
children: 'bool'
|
|
112
|
+
},
|
|
113
|
+
Date: {
|
|
114
|
+
style: {
|
|
115
|
+
color: 'var(--w-rjv-type-date-color, #268bd2)'
|
|
116
|
+
},
|
|
117
|
+
as: 'span',
|
|
118
|
+
'data-type': 'date',
|
|
119
|
+
className: 'w-rjv-type',
|
|
120
|
+
children: 'date'
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
var Context = /*#__PURE__*/createContext(initialState);
|
|
124
|
+
var reducer = (state, action) => _extends({}, state, action);
|
|
125
|
+
export var useTypesStore = () => {
|
|
126
|
+
return useContext(Context);
|
|
127
|
+
};
|
|
128
|
+
var DispatchTypes = /*#__PURE__*/createContext(() => {});
|
|
129
|
+
DispatchTypes.displayName = 'JVR.DispatchTypes';
|
|
130
|
+
export function useTypes() {
|
|
131
|
+
return useReducer(reducer, initialState);
|
|
132
|
+
}
|
|
133
|
+
export function useTypesDispatch() {
|
|
134
|
+
return useContext(DispatchTypes);
|
|
135
|
+
}
|
|
136
|
+
export var Types = _ref => {
|
|
137
|
+
var {
|
|
138
|
+
initial,
|
|
139
|
+
dispatch,
|
|
140
|
+
children
|
|
141
|
+
} = _ref;
|
|
142
|
+
return /*#__PURE__*/_jsx(Context.Provider, {
|
|
143
|
+
value: initial,
|
|
144
|
+
children: /*#__PURE__*/_jsx(DispatchTypes.Provider, {
|
|
145
|
+
value: dispatch,
|
|
146
|
+
children: children
|
|
147
|
+
})
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
Types.displayName = 'JVR.Types';
|
package/esm/store.d.ts
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { JsonViewProps } from './';
|
|
3
|
+
import { type InitialTypesState } from './store/Types';
|
|
4
|
+
export type BlockTagType = keyof JSX.IntrinsicElements;
|
|
5
|
+
export interface InitialState<T extends object> {
|
|
6
|
+
value?: object;
|
|
7
|
+
onExpand?: JsonViewProps<object>['onExpand'];
|
|
8
|
+
onCopied?: JsonViewProps<object>['onCopied'];
|
|
9
|
+
objectSortKeys?: JsonViewProps<T>['objectSortKeys'];
|
|
10
|
+
displayObjectSize?: JsonViewProps<T>['displayObjectSize'];
|
|
11
|
+
shortenTextAfterLength?: JsonViewProps<T>['shortenTextAfterLength'];
|
|
12
|
+
enableClipboard?: JsonViewProps<T>['enableClipboard'];
|
|
13
|
+
highlightUpdates?: JsonViewProps<T>['highlightUpdates'];
|
|
14
|
+
collapsed?: JsonViewProps<T>['collapsed'];
|
|
15
|
+
indentWidth?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const initialState: InitialState<object>;
|
|
18
|
+
type Dispatch = React.Dispatch<InitialState<object>>;
|
|
19
|
+
export declare const Context: React.Context<InitialState<object>>;
|
|
20
|
+
export declare function reducer(state: InitialState<object>, action: InitialState<object>): InitialState<object>;
|
|
21
|
+
export declare const useStore: () => InitialState<object>;
|
|
22
|
+
export declare const useDispatchStore: () => Dispatch;
|
|
23
|
+
export interface ProviderProps {
|
|
24
|
+
initialState?: InitialState<object>;
|
|
25
|
+
initialTypes?: InitialTypesState;
|
|
26
|
+
}
|
|
27
|
+
export declare const Provider: React.FC<PropsWithChildren<ProviderProps>>;
|
|
28
|
+
export declare function useDispatch(): Dispatch;
|
|
29
|
+
export {};
|
package/esm/store.js
CHANGED
|
@@ -1,36 +1,70 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
expand(id) {
|
|
13
|
-
expands = _extends({}, expands, {
|
|
14
|
-
[id]: true
|
|
15
|
-
});
|
|
16
|
-
emitChange();
|
|
17
|
-
}
|
|
2
|
+
import React, { createContext, useContext, useEffect, useReducer } from 'react';
|
|
3
|
+
import { useShowTools, ShowTools } from './store/ShowTools';
|
|
4
|
+
import { useExpands, Expands } from './store/Expands';
|
|
5
|
+
import { useTypes, Types } from './store/Types';
|
|
6
|
+
import { useSymbols, Symbols } from './store/Symbols';
|
|
7
|
+
import { useSection, Section } from './store/Section';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
export var initialState = {
|
|
10
|
+
objectSortKeys: false,
|
|
11
|
+
indentWidth: 15
|
|
18
12
|
};
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
export var Context = /*#__PURE__*/createContext(initialState);
|
|
14
|
+
Context.displayName = 'JVR.Context';
|
|
15
|
+
var DispatchContext = /*#__PURE__*/createContext(() => {});
|
|
16
|
+
DispatchContext.displayName = 'JVR.DispatchContext';
|
|
17
|
+
export function reducer(state, action) {
|
|
18
|
+
return _extends({}, state, action);
|
|
21
19
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
export var useStore = () => {
|
|
21
|
+
return useContext(Context);
|
|
22
|
+
};
|
|
23
|
+
export var useDispatchStore = () => {
|
|
24
|
+
return useContext(DispatchContext);
|
|
25
|
+
};
|
|
26
|
+
export var Provider = _ref => {
|
|
27
|
+
var {
|
|
28
|
+
children,
|
|
29
|
+
initialState: init,
|
|
30
|
+
initialTypes
|
|
31
|
+
} = _ref;
|
|
32
|
+
var [state, dispatch] = useReducer(reducer, Object.assign({}, initialState, init));
|
|
33
|
+
var [showTools, showToolsDispatch] = useShowTools();
|
|
34
|
+
var [expands, expandsDispatch] = useExpands();
|
|
35
|
+
var [types, typesDispatch] = useTypes();
|
|
36
|
+
var [symbols, symbolsDispatch] = useSymbols();
|
|
37
|
+
var [section, sectionDispatch] = useSection();
|
|
38
|
+
useEffect(() => dispatch(_extends({}, init)), [init]);
|
|
39
|
+
return /*#__PURE__*/_jsx(Context.Provider, {
|
|
40
|
+
value: state,
|
|
41
|
+
children: /*#__PURE__*/_jsx(DispatchContext.Provider, {
|
|
42
|
+
value: dispatch,
|
|
43
|
+
children: /*#__PURE__*/_jsx(ShowTools, {
|
|
44
|
+
initial: showTools,
|
|
45
|
+
dispatch: showToolsDispatch,
|
|
46
|
+
children: /*#__PURE__*/_jsx(Expands, {
|
|
47
|
+
initial: expands,
|
|
48
|
+
dispatch: expandsDispatch,
|
|
49
|
+
children: /*#__PURE__*/_jsx(Types, {
|
|
50
|
+
initial: _extends({}, types, initialTypes),
|
|
51
|
+
dispatch: typesDispatch,
|
|
52
|
+
children: /*#__PURE__*/_jsx(Symbols, {
|
|
53
|
+
initial: symbols,
|
|
54
|
+
dispatch: symbolsDispatch,
|
|
55
|
+
children: /*#__PURE__*/_jsx(Section, {
|
|
56
|
+
initial: section,
|
|
57
|
+
dispatch: sectionDispatch,
|
|
58
|
+
children: children
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
export function useDispatch() {
|
|
68
|
+
return useContext(DispatchContext);
|
|
32
69
|
}
|
|
33
|
-
|
|
34
|
-
var expands = useSyncExternalStore(subscribe, getSnapshot);
|
|
35
|
-
return expands;
|
|
36
|
-
}
|
|
70
|
+
Provider.displayName = 'JVR.Provider';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useSymbolsStore } from '../store/Symbols';
|
|
2
|
+
import { useSymbolsRender } from '../utils/useRender';
|
|
3
|
+
export var Arrow = props => {
|
|
4
|
+
var {
|
|
5
|
+
Arrow: Comp = {}
|
|
6
|
+
} = useSymbolsStore();
|
|
7
|
+
useSymbolsRender(Comp, props, 'Arrow');
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
Arrow.displayName = 'JVR.Arrow';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useSymbolsStore } from '../store/Symbols';
|
|
2
|
+
import { useSymbolsRender } from '../utils/useRender';
|
|
3
|
+
export var BraceLeft = props => {
|
|
4
|
+
var {
|
|
5
|
+
BraceLeft: Comp = {}
|
|
6
|
+
} = useSymbolsStore();
|
|
7
|
+
useSymbolsRender(Comp, props, 'BraceLeft');
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
BraceLeft.displayName = 'JVR.BraceLeft';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useSymbolsStore } from '../store/Symbols';
|
|
2
|
+
import { useSymbolsRender } from '../utils/useRender';
|
|
3
|
+
export var BraceRight = props => {
|
|
4
|
+
var {
|
|
5
|
+
BraceRight: Comp = {}
|
|
6
|
+
} = useSymbolsStore();
|
|
7
|
+
useSymbolsRender(Comp, props, 'BraceRight');
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
BraceRight.displayName = 'JVR.BraceRight';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useSymbolsStore } from '../store/Symbols';
|
|
2
|
+
import { useSymbolsRender } from '../utils/useRender';
|
|
3
|
+
export var BracketsLeft = props => {
|
|
4
|
+
var {
|
|
5
|
+
BracketsLeft: Comp = {}
|
|
6
|
+
} = useSymbolsStore();
|
|
7
|
+
useSymbolsRender(Comp, props, 'BracketsLeft');
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
BracketsLeft.displayName = 'JVR.BracketsLeft';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useSymbolsStore } from '../store/Symbols';
|
|
2
|
+
import { useSymbolsRender } from '../utils/useRender';
|
|
3
|
+
export var BracketsRight = props => {
|
|
4
|
+
var {
|
|
5
|
+
BracketsRight: Comp = {}
|
|
6
|
+
} = useSymbolsStore();
|
|
7
|
+
useSymbolsRender(Comp, props, 'BracketsRight');
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
BracketsRight.displayName = 'JVR.BracketsRight';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useSymbolsStore } from '../store/Symbols';
|
|
2
|
+
import { useSymbolsRender } from '../utils/useRender';
|
|
3
|
+
export var Colon = props => {
|
|
4
|
+
var {
|
|
5
|
+
Colon: Comp = {}
|
|
6
|
+
} = useSymbolsStore();
|
|
7
|
+
useSymbolsRender(Comp, props, 'Colon');
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
Colon.displayName = 'JVR.Colon';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useSymbolsStore } from '../store/Symbols';
|
|
2
|
+
import { useSymbolsRender } from '../utils/useRender';
|
|
3
|
+
export var Quote = props => {
|
|
4
|
+
var {
|
|
5
|
+
Quote: Comp = {}
|
|
6
|
+
} = useSymbolsStore();
|
|
7
|
+
useSymbolsRender(Comp, props, 'Quote');
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
Quote.displayName = 'JVR.Quote';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useSymbolsStore } from '../store/Symbols';
|
|
2
|
+
import { useSymbolsRender } from '../utils/useRender';
|
|
3
|
+
export var ValueQuote = props => {
|
|
4
|
+
var {
|
|
5
|
+
ValueQuote: Comp = {}
|
|
6
|
+
} = useSymbolsStore();
|
|
7
|
+
useSymbolsRender(Comp, props, 'ValueQuote');
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
ValueQuote.displayName = 'JVR.ValueQuote';
|
package/esm/theme/basic.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export var basicTheme = {
|
|
2
2
|
'--w-rjv-font-family': 'monospace',
|
|
3
3
|
'--w-rjv-color': '#b5bd68',
|
|
4
|
+
'--w-rjv-key-string': '#b5bd68',
|
|
4
5
|
'--w-rjv-background-color': '#2E3235',
|
|
5
6
|
'--w-rjv-line-color': '#292d30',
|
|
6
7
|
'--w-rjv-arrow-color': 'var(--w-rjv-color)',
|
|
@@ -12,6 +13,8 @@ export var basicTheme = {
|
|
|
12
13
|
'--w-rjv-curlybraces-color': '#cc99cc',
|
|
13
14
|
'--w-rjv-colon-color': '#bababa',
|
|
14
15
|
'--w-rjv-brackets-color': '#808080',
|
|
16
|
+
'--w-rjv-quotes-color': 'var(--w-rjv-key-string)',
|
|
17
|
+
'--w-rjv-quotes-string-color': 'var(--w-rjv-type-string-color)',
|
|
15
18
|
'--w-rjv-type-string-color': '#b5bd68',
|
|
16
19
|
'--w-rjv-type-int-color': '#fda331',
|
|
17
20
|
'--w-rjv-type-float-color': '#fda331',
|
package/esm/theme/dark.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export var darkTheme = {
|
|
2
2
|
'--w-rjv-font-family': 'monospace',
|
|
3
3
|
'--w-rjv-color': '#0184a6',
|
|
4
|
+
'--w-rjv-key-string': '#0184a6',
|
|
4
5
|
'--w-rjv-background-color': '#202020',
|
|
5
6
|
'--w-rjv-line-color': '#323232',
|
|
6
7
|
'--w-rjv-arrow-color': 'var(--w-rjv-color)',
|
|
@@ -11,6 +12,8 @@ export var darkTheme = {
|
|
|
11
12
|
'--w-rjv-copied-success-color': '#28a745',
|
|
12
13
|
'--w-rjv-curlybraces-color': '#1896b6',
|
|
13
14
|
'--w-rjv-brackets-color': '#1896b6',
|
|
15
|
+
'--w-rjv-quotes-color': 'var(--w-rjv-key-string)',
|
|
16
|
+
'--w-rjv-quotes-string-color': 'var(--w-rjv-type-string-color)',
|
|
14
17
|
'--w-rjv-type-string-color': '#cb4b16',
|
|
15
18
|
'--w-rjv-type-int-color': '#268bd2',
|
|
16
19
|
'--w-rjv-type-float-color': '#859900',
|
package/esm/theme/github.dark.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export var githubDarkTheme = {
|
|
2
2
|
'--w-rjv-font-family': 'monospace',
|
|
3
3
|
'--w-rjv-color': '#79c0ff',
|
|
4
|
+
'--w-rjv-key-string': '#79c0ff',
|
|
4
5
|
'--w-rjv-background-color': '#0d1117',
|
|
5
6
|
'--w-rjv-line-color': '#94949480',
|
|
6
7
|
'--w-rjv-arrow-color': '#ccc',
|
|
@@ -12,6 +13,8 @@ export var githubDarkTheme = {
|
|
|
12
13
|
'--w-rjv-curlybraces-color': '#8b949e',
|
|
13
14
|
'--w-rjv-colon-color': '#c9d1d9',
|
|
14
15
|
'--w-rjv-brackets-color': '#8b949e',
|
|
16
|
+
'--w-rjv-quotes-color': 'var(--w-rjv-key-string)',
|
|
17
|
+
'--w-rjv-quotes-string-color': 'var(--w-rjv-type-string-color)',
|
|
15
18
|
'--w-rjv-type-string-color': '#a5d6ff',
|
|
16
19
|
'--w-rjv-type-int-color': '#79c0ff',
|
|
17
20
|
'--w-rjv-type-float-color': '#79c0ff',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export var githubLightTheme = {
|
|
2
2
|
'--w-rjv-font-family': 'monospace',
|
|
3
3
|
'--w-rjv-color': '#6f42c1',
|
|
4
|
+
'--w-rjv-key-string': '#6f42c1',
|
|
4
5
|
'--w-rjv-background-color': '#ffffff',
|
|
5
6
|
'--w-rjv-line-color': '#ddd',
|
|
6
7
|
'--w-rjv-arrow-color': '#6e7781',
|
|
@@ -12,6 +13,8 @@ export var githubLightTheme = {
|
|
|
12
13
|
'--w-rjv-curlybraces-color': '#6a737d',
|
|
13
14
|
'--w-rjv-colon-color': '#24292e',
|
|
14
15
|
'--w-rjv-brackets-color': '#6a737d',
|
|
16
|
+
'--w-rjv-quotes-color': 'var(--w-rjv-key-string)',
|
|
17
|
+
'--w-rjv-quotes-string-color': 'var(--w-rjv-type-string-color)',
|
|
15
18
|
'--w-rjv-type-string-color': '#032f62',
|
|
16
19
|
'--w-rjv-type-int-color': '#005cc5',
|
|
17
20
|
'--w-rjv-type-float-color': '#005cc5',
|