@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,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.Section = void 0;
|
|
9
|
+
exports.useSection = useSection;
|
|
10
|
+
exports.useSectionDispatch = useSectionDispatch;
|
|
11
|
+
exports.useSectionStore = void 0;
|
|
12
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
var initialState = {
|
|
16
|
+
Copied: {
|
|
17
|
+
className: 'w-rjv-copied',
|
|
18
|
+
style: {
|
|
19
|
+
height: '1em',
|
|
20
|
+
width: '1em',
|
|
21
|
+
cursor: 'pointer',
|
|
22
|
+
verticalAlign: 'middle',
|
|
23
|
+
marginLeft: 5
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
CountInfo: {
|
|
27
|
+
as: 'span',
|
|
28
|
+
className: 'w-rjv-object-size',
|
|
29
|
+
style: {
|
|
30
|
+
color: 'var(--w-rjv-info-color, #0000004d)',
|
|
31
|
+
paddingLeft: 8,
|
|
32
|
+
fontStyle: 'italic'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
CountInfoExtra: {
|
|
36
|
+
as: 'span',
|
|
37
|
+
className: 'w-rjv-object-extra',
|
|
38
|
+
style: {
|
|
39
|
+
paddingLeft: 8
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
Ellipsis: {
|
|
43
|
+
as: 'span',
|
|
44
|
+
style: {
|
|
45
|
+
cursor: 'pointer',
|
|
46
|
+
color: 'var(--w-rjv-ellipsis-color, #cb4b16)',
|
|
47
|
+
userSelect: 'none'
|
|
48
|
+
},
|
|
49
|
+
className: 'w-rjv-ellipsis',
|
|
50
|
+
children: '...'
|
|
51
|
+
},
|
|
52
|
+
KeyName: {
|
|
53
|
+
as: 'span',
|
|
54
|
+
className: 'w-rjv-object-key'
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var Context = /*#__PURE__*/(0, _react.createContext)(initialState);
|
|
58
|
+
var reducer = function reducer(state, action) {
|
|
59
|
+
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), action);
|
|
60
|
+
};
|
|
61
|
+
var useSectionStore = function useSectionStore() {
|
|
62
|
+
return (0, _react.useContext)(Context);
|
|
63
|
+
};
|
|
64
|
+
exports.useSectionStore = useSectionStore;
|
|
65
|
+
var DispatchSection = /*#__PURE__*/(0, _react.createContext)(function () {});
|
|
66
|
+
DispatchSection.displayName = 'JVR.DispatchSection';
|
|
67
|
+
function useSection() {
|
|
68
|
+
return (0, _react.useReducer)(reducer, initialState);
|
|
69
|
+
}
|
|
70
|
+
function useSectionDispatch() {
|
|
71
|
+
return (0, _react.useContext)(DispatchSection);
|
|
72
|
+
}
|
|
73
|
+
var Section = function Section(_ref) {
|
|
74
|
+
var initial = _ref.initial,
|
|
75
|
+
dispatch = _ref.dispatch,
|
|
76
|
+
children = _ref.children;
|
|
77
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Context.Provider, {
|
|
78
|
+
value: initial,
|
|
79
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(DispatchSection.Provider, {
|
|
80
|
+
value: dispatch,
|
|
81
|
+
children: children
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
exports.Section = Section;
|
|
86
|
+
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,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.ShowTools = void 0;
|
|
8
|
+
exports.useShowTools = useShowTools;
|
|
9
|
+
exports.useShowToolsDispatch = useShowToolsDispatch;
|
|
10
|
+
exports.useShowToolsStore = 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 useShowToolsStore = function useShowToolsStore() {
|
|
20
|
+
return (0, _react.useContext)(Context);
|
|
21
|
+
};
|
|
22
|
+
exports.useShowToolsStore = useShowToolsStore;
|
|
23
|
+
var DispatchShowTools = /*#__PURE__*/(0, _react.createContext)(function () {});
|
|
24
|
+
DispatchShowTools.displayName = 'JVR.DispatchShowTools';
|
|
25
|
+
function useShowTools() {
|
|
26
|
+
return (0, _react.useReducer)(reducer, initialState);
|
|
27
|
+
}
|
|
28
|
+
function useShowToolsDispatch() {
|
|
29
|
+
return (0, _react.useContext)(DispatchShowTools);
|
|
30
|
+
}
|
|
31
|
+
var ShowTools = function ShowTools(_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)(DispatchShowTools.Provider, {
|
|
38
|
+
value: dispatch,
|
|
39
|
+
children: children
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
exports.ShowTools = ShowTools;
|
|
44
|
+
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 {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Symbols = void 0;
|
|
8
|
+
exports.useSymbols = useSymbols;
|
|
9
|
+
exports.useSymbolsDispatch = useSymbolsDispatch;
|
|
10
|
+
exports.useSymbolsStore = void 0;
|
|
11
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
12
|
+
var _react = require("react");
|
|
13
|
+
var _TriangleArrow = require("../arrow/TriangleArrow");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
var initialState = {
|
|
16
|
+
Arrow: {
|
|
17
|
+
as: 'span',
|
|
18
|
+
style: {
|
|
19
|
+
transform: 'rotate(0deg)',
|
|
20
|
+
transition: 'all 0.3s'
|
|
21
|
+
},
|
|
22
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TriangleArrow.TriangleArrow, {})
|
|
23
|
+
},
|
|
24
|
+
Colon: {
|
|
25
|
+
as: 'span',
|
|
26
|
+
style: {
|
|
27
|
+
color: 'var(--w-rjv-colon-color, var(--w-rjv-color))',
|
|
28
|
+
marginLeft: 0,
|
|
29
|
+
marginRight: 2
|
|
30
|
+
},
|
|
31
|
+
className: 'w-rjv-colon',
|
|
32
|
+
children: ':'
|
|
33
|
+
},
|
|
34
|
+
Quote: {
|
|
35
|
+
as: 'span',
|
|
36
|
+
style: {
|
|
37
|
+
color: 'var(--w-rjv-quotes-color, #236a7c)'
|
|
38
|
+
},
|
|
39
|
+
className: 'w-rjv-quotes',
|
|
40
|
+
children: '"'
|
|
41
|
+
},
|
|
42
|
+
ValueQuote: {
|
|
43
|
+
as: 'span',
|
|
44
|
+
style: {
|
|
45
|
+
color: 'var(--w-rjv-quotes-string-color, #cb4b16)'
|
|
46
|
+
},
|
|
47
|
+
className: 'w-rjv-quotes',
|
|
48
|
+
children: '"'
|
|
49
|
+
},
|
|
50
|
+
BracketsLeft: {
|
|
51
|
+
as: 'span',
|
|
52
|
+
style: {
|
|
53
|
+
color: 'var(--w-rjv-brackets-color, #236a7c)'
|
|
54
|
+
},
|
|
55
|
+
className: 'w-rjv-brackets-start',
|
|
56
|
+
children: '['
|
|
57
|
+
},
|
|
58
|
+
BracketsRight: {
|
|
59
|
+
as: 'span',
|
|
60
|
+
style: {
|
|
61
|
+
color: 'var(--w-rjv-brackets-color, #236a7c)'
|
|
62
|
+
},
|
|
63
|
+
className: 'w-rjv-brackets-end',
|
|
64
|
+
children: ']'
|
|
65
|
+
},
|
|
66
|
+
BraceLeft: {
|
|
67
|
+
as: 'span',
|
|
68
|
+
style: {
|
|
69
|
+
color: 'var(--w-rjv-curlybraces-color, #236a7c)'
|
|
70
|
+
},
|
|
71
|
+
className: 'w-rjv-curlybraces-start',
|
|
72
|
+
children: '{'
|
|
73
|
+
},
|
|
74
|
+
BraceRight: {
|
|
75
|
+
as: 'span',
|
|
76
|
+
style: {
|
|
77
|
+
color: 'var(--w-rjv-curlybraces-color, #236a7c)'
|
|
78
|
+
},
|
|
79
|
+
className: 'w-rjv-curlybraces-end',
|
|
80
|
+
children: '}'
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var Context = /*#__PURE__*/(0, _react.createContext)(initialState);
|
|
84
|
+
var reducer = function reducer(state, action) {
|
|
85
|
+
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), action);
|
|
86
|
+
};
|
|
87
|
+
var useSymbolsStore = function useSymbolsStore() {
|
|
88
|
+
return (0, _react.useContext)(Context);
|
|
89
|
+
};
|
|
90
|
+
exports.useSymbolsStore = useSymbolsStore;
|
|
91
|
+
var DispatchSymbols = /*#__PURE__*/(0, _react.createContext)(function () {});
|
|
92
|
+
DispatchSymbols.displayName = 'JVR.DispatchSymbols';
|
|
93
|
+
function useSymbols() {
|
|
94
|
+
return (0, _react.useReducer)(reducer, initialState);
|
|
95
|
+
}
|
|
96
|
+
function useSymbolsDispatch() {
|
|
97
|
+
return (0, _react.useContext)(DispatchSymbols);
|
|
98
|
+
}
|
|
99
|
+
var Symbols = function Symbols(_ref) {
|
|
100
|
+
var initial = _ref.initial,
|
|
101
|
+
dispatch = _ref.dispatch,
|
|
102
|
+
children = _ref.children;
|
|
103
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Context.Provider, {
|
|
104
|
+
value: initial,
|
|
105
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(DispatchSymbols.Provider, {
|
|
106
|
+
value: dispatch,
|
|
107
|
+
children: children
|
|
108
|
+
})
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
exports.Symbols = Symbols;
|
|
112
|
+
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,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Types = void 0;
|
|
8
|
+
exports.useTypes = useTypes;
|
|
9
|
+
exports.useTypesDispatch = useTypesDispatch;
|
|
10
|
+
exports.useTypesStore = 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
|
+
Str: {
|
|
16
|
+
as: 'span',
|
|
17
|
+
'data-type': 'string',
|
|
18
|
+
style: {
|
|
19
|
+
color: 'var(--w-rjv-type-string-color, #cb4b16)'
|
|
20
|
+
},
|
|
21
|
+
className: 'w-rjv-type',
|
|
22
|
+
children: 'string'
|
|
23
|
+
},
|
|
24
|
+
Url: {
|
|
25
|
+
as: 'a',
|
|
26
|
+
style: {
|
|
27
|
+
color: 'var(--w-rjv-type-url-color, #0969da)'
|
|
28
|
+
},
|
|
29
|
+
'data-type': 'url',
|
|
30
|
+
className: 'w-rjv-type',
|
|
31
|
+
children: 'url'
|
|
32
|
+
},
|
|
33
|
+
Undefined: {
|
|
34
|
+
style: {
|
|
35
|
+
color: 'var(--w-rjv-type-undefined-color, #586e75)'
|
|
36
|
+
},
|
|
37
|
+
as: 'span',
|
|
38
|
+
'data-type': 'undefined',
|
|
39
|
+
className: 'w-rjv-type',
|
|
40
|
+
children: 'undefined'
|
|
41
|
+
},
|
|
42
|
+
Null: {
|
|
43
|
+
style: {
|
|
44
|
+
color: 'var(--w-rjv-type-null-color, #d33682)'
|
|
45
|
+
},
|
|
46
|
+
as: 'span',
|
|
47
|
+
'data-type': 'null',
|
|
48
|
+
className: 'w-rjv-type',
|
|
49
|
+
children: 'null'
|
|
50
|
+
},
|
|
51
|
+
Map: {
|
|
52
|
+
style: {
|
|
53
|
+
color: 'var(--w-rjv-type-map-color, #268bd2)'
|
|
54
|
+
},
|
|
55
|
+
as: 'span',
|
|
56
|
+
'data-type': 'map',
|
|
57
|
+
className: 'w-rjv-type',
|
|
58
|
+
children: 'Map'
|
|
59
|
+
},
|
|
60
|
+
Nan: {
|
|
61
|
+
style: {
|
|
62
|
+
color: 'var(--w-rjv-type-nan-color, #859900)'
|
|
63
|
+
},
|
|
64
|
+
as: 'span',
|
|
65
|
+
'data-type': 'nan',
|
|
66
|
+
className: 'w-rjv-type',
|
|
67
|
+
children: 'NaN'
|
|
68
|
+
},
|
|
69
|
+
Bigint: {
|
|
70
|
+
style: {
|
|
71
|
+
color: 'var(--w-rjv-type-bigint-color, #268bd2)'
|
|
72
|
+
},
|
|
73
|
+
as: 'span',
|
|
74
|
+
'data-type': 'bigint',
|
|
75
|
+
className: 'w-rjv-type',
|
|
76
|
+
children: 'bigint'
|
|
77
|
+
},
|
|
78
|
+
Int: {
|
|
79
|
+
style: {
|
|
80
|
+
color: 'var(--w-rjv-type-int-color, #268bd2)'
|
|
81
|
+
},
|
|
82
|
+
as: 'span',
|
|
83
|
+
'data-type': 'int',
|
|
84
|
+
className: 'w-rjv-type',
|
|
85
|
+
children: 'int'
|
|
86
|
+
},
|
|
87
|
+
Set: {
|
|
88
|
+
style: {
|
|
89
|
+
color: 'var(--w-rjv-type-set-color, #268bd2)'
|
|
90
|
+
},
|
|
91
|
+
as: 'span',
|
|
92
|
+
'data-type': 'set',
|
|
93
|
+
className: 'w-rjv-type',
|
|
94
|
+
children: 'Set'
|
|
95
|
+
},
|
|
96
|
+
Float: {
|
|
97
|
+
style: {
|
|
98
|
+
color: 'var(--w-rjv-type-float-color, #859900)'
|
|
99
|
+
},
|
|
100
|
+
as: 'span',
|
|
101
|
+
'data-type': 'float',
|
|
102
|
+
className: 'w-rjv-type',
|
|
103
|
+
children: 'float'
|
|
104
|
+
},
|
|
105
|
+
True: {
|
|
106
|
+
style: {
|
|
107
|
+
color: 'var(--w-rjv-type-boolean-color, #2aa198)'
|
|
108
|
+
},
|
|
109
|
+
as: 'span',
|
|
110
|
+
'data-type': 'bool',
|
|
111
|
+
className: 'w-rjv-type',
|
|
112
|
+
children: 'bool'
|
|
113
|
+
},
|
|
114
|
+
False: {
|
|
115
|
+
style: {
|
|
116
|
+
color: 'var(--w-rjv-type-boolean-color, #2aa198)'
|
|
117
|
+
},
|
|
118
|
+
as: 'span',
|
|
119
|
+
'data-type': 'bool',
|
|
120
|
+
className: 'w-rjv-type',
|
|
121
|
+
children: 'bool'
|
|
122
|
+
},
|
|
123
|
+
Date: {
|
|
124
|
+
style: {
|
|
125
|
+
color: 'var(--w-rjv-type-date-color, #268bd2)'
|
|
126
|
+
},
|
|
127
|
+
as: 'span',
|
|
128
|
+
'data-type': 'date',
|
|
129
|
+
className: 'w-rjv-type',
|
|
130
|
+
children: 'date'
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
var Context = /*#__PURE__*/(0, _react.createContext)(initialState);
|
|
134
|
+
var reducer = function reducer(state, action) {
|
|
135
|
+
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), action);
|
|
136
|
+
};
|
|
137
|
+
var useTypesStore = function useTypesStore() {
|
|
138
|
+
return (0, _react.useContext)(Context);
|
|
139
|
+
};
|
|
140
|
+
exports.useTypesStore = useTypesStore;
|
|
141
|
+
var DispatchTypes = /*#__PURE__*/(0, _react.createContext)(function () {});
|
|
142
|
+
DispatchTypes.displayName = 'JVR.DispatchTypes';
|
|
143
|
+
function useTypes() {
|
|
144
|
+
return (0, _react.useReducer)(reducer, initialState);
|
|
145
|
+
}
|
|
146
|
+
function useTypesDispatch() {
|
|
147
|
+
return (0, _react.useContext)(DispatchTypes);
|
|
148
|
+
}
|
|
149
|
+
var Types = function Types(_ref) {
|
|
150
|
+
var initial = _ref.initial,
|
|
151
|
+
dispatch = _ref.dispatch,
|
|
152
|
+
children = _ref.children;
|
|
153
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Context.Provider, {
|
|
154
|
+
value: initial,
|
|
155
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(DispatchTypes.Provider, {
|
|
156
|
+
value: dispatch,
|
|
157
|
+
children: children
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
exports.Types = Types;
|
|
162
|
+
Types.displayName = 'JVR.Types';
|
package/cjs/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 {};
|