@uiw/react-json-view 2.0.0-alpha.1 → 2.0.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/README.md +145 -36
  2. package/cjs/Container.js +4 -8
  3. package/cjs/comps/Copied.js +15 -13
  4. package/cjs/comps/KeyValues.js +30 -22
  5. package/cjs/comps/NestedClose.js +3 -4
  6. package/cjs/comps/NestedOpen.js +18 -16
  7. package/cjs/comps/Value.js +14 -16
  8. package/cjs/editor/KeyName.d.ts +2 -0
  9. package/cjs/editor/KeyName.js +82 -0
  10. package/cjs/editor/index.d.ts +19 -0
  11. package/cjs/editor/index.js +44 -0
  12. package/cjs/editor/store.d.ts +28 -0
  13. package/cjs/editor/store.js +23 -0
  14. package/cjs/index.d.ts +5 -3
  15. package/cjs/index.js +9 -8
  16. package/cjs/section/Copied.d.ts +1 -1
  17. package/cjs/section/Copied.js +1 -2
  18. package/cjs/section/CountInfo.d.ts +10 -1
  19. package/cjs/section/CountInfo.js +42 -4
  20. package/cjs/section/CountInfoExtra.d.ts +10 -1
  21. package/cjs/section/CountInfoExtra.js +32 -4
  22. package/cjs/section/Ellipsis.d.ts +10 -0
  23. package/cjs/section/Ellipsis.js +30 -4
  24. package/cjs/section/KeyName.d.ts +8 -0
  25. package/cjs/section/KeyName.js +38 -4
  26. package/cjs/section/Row.d.ts +16 -0
  27. package/cjs/section/Row.js +50 -0
  28. package/cjs/store/Expands.js +2 -4
  29. package/cjs/store/Section.d.ts +5 -2
  30. package/cjs/store/Section.js +6 -4
  31. package/cjs/store/ShowTools.js +2 -4
  32. package/cjs/store/Symbols.d.ts +2 -2
  33. package/cjs/store/Symbols.js +3 -4
  34. package/cjs/store/Types.d.ts +28 -24
  35. package/cjs/store/Types.js +8 -8
  36. package/cjs/store.d.ts +7 -4
  37. package/cjs/store.js +5 -10
  38. package/cjs/symbol/Arrow.d.ts +1 -1
  39. package/cjs/symbol/Arrow.js +1 -2
  40. package/cjs/symbol/BraceLeft.d.ts +1 -1
  41. package/cjs/symbol/BraceLeft.js +1 -2
  42. package/cjs/symbol/BraceRight.d.ts +1 -1
  43. package/cjs/symbol/BraceRight.js +1 -2
  44. package/cjs/symbol/BracketsLeft.d.ts +1 -1
  45. package/cjs/symbol/BracketsLeft.js +1 -2
  46. package/cjs/symbol/BracketsRight.d.ts +1 -1
  47. package/cjs/symbol/BracketsRight.js +1 -2
  48. package/cjs/symbol/Colon.d.ts +1 -1
  49. package/cjs/symbol/Colon.js +1 -2
  50. package/cjs/symbol/Quote.d.ts +1 -1
  51. package/cjs/symbol/Quote.js +1 -2
  52. package/cjs/symbol/ValueQuote.d.ts +1 -1
  53. package/cjs/symbol/ValueQuote.js +1 -2
  54. package/{esm/comps/ReRender/Symbols.d.ts → cjs/symbol/index.d.ts} +4 -6
  55. package/cjs/{comps/ReRender/Symbols.js → symbol/index.js} +32 -33
  56. package/cjs/theme/basic.js +2 -3
  57. package/cjs/theme/dark.js +2 -3
  58. package/cjs/theme/github.dark.js +2 -3
  59. package/cjs/theme/github.light.js +2 -3
  60. package/cjs/theme/gruvbox.js +2 -3
  61. package/cjs/theme/light.js +2 -3
  62. package/cjs/theme/monokai.js +2 -3
  63. package/cjs/theme/nord.js +2 -3
  64. package/cjs/theme/vscode.js +2 -3
  65. package/cjs/types/Bigint.d.ts +1 -1
  66. package/cjs/types/Bigint.js +1 -2
  67. package/cjs/types/Date.d.ts +1 -1
  68. package/cjs/types/Date.js +1 -2
  69. package/cjs/types/False.d.ts +1 -1
  70. package/cjs/types/False.js +1 -2
  71. package/cjs/types/Float.d.ts +1 -1
  72. package/cjs/types/Float.js +1 -2
  73. package/cjs/types/Int.d.ts +1 -1
  74. package/cjs/types/Int.js +1 -2
  75. package/cjs/types/Map.d.ts +1 -1
  76. package/cjs/types/Map.js +1 -2
  77. package/cjs/types/Nan.d.ts +1 -1
  78. package/cjs/types/Nan.js +1 -2
  79. package/cjs/types/Null.d.ts +1 -1
  80. package/cjs/types/Null.js +1 -2
  81. package/cjs/types/Set.d.ts +1 -1
  82. package/cjs/types/Set.js +1 -2
  83. package/cjs/types/String.d.ts +1 -1
  84. package/cjs/types/String.js +1 -2
  85. package/cjs/types/True.d.ts +1 -1
  86. package/cjs/types/True.js +1 -2
  87. package/cjs/types/Undefined.d.ts +1 -1
  88. package/cjs/types/Undefined.js +1 -2
  89. package/cjs/types/Url.d.ts +1 -1
  90. package/cjs/types/Url.js +1 -2
  91. package/{esm/comps/ReRender/Types.d.ts → cjs/types/index.d.ts} +8 -13
  92. package/cjs/{comps/ReRender/Types.js → types/index.js} +103 -121
  93. package/cjs/utils/useHighlight.js +0 -1
  94. package/cjs/utils/useRender.d.ts +1 -1
  95. package/editor.d.ts +22 -20
  96. package/esm/Container.js +4 -5
  97. package/esm/comps/Copied.js +14 -11
  98. package/esm/comps/KeyValues.js +20 -11
  99. package/esm/comps/NestedClose.js +1 -1
  100. package/esm/comps/NestedOpen.js +12 -9
  101. package/esm/comps/Value.js +1 -1
  102. package/esm/editor/KeyName.d.ts +2 -0
  103. package/esm/editor/KeyName.js +77 -0
  104. package/esm/editor/index.d.ts +19 -0
  105. package/esm/editor/index.js +34 -0
  106. package/esm/editor/store.d.ts +28 -0
  107. package/esm/editor/store.js +13 -0
  108. package/esm/index.d.ts +5 -3
  109. package/esm/index.js +5 -3
  110. package/esm/section/Copied.d.ts +1 -1
  111. package/esm/section/CountInfo.d.ts +10 -1
  112. package/esm/section/CountInfo.js +43 -1
  113. package/esm/section/CountInfoExtra.d.ts +10 -1
  114. package/esm/section/CountInfoExtra.js +32 -1
  115. package/esm/section/Ellipsis.d.ts +10 -0
  116. package/esm/section/Ellipsis.js +31 -1
  117. package/esm/section/KeyName.d.ts +8 -0
  118. package/esm/section/KeyName.js +39 -1
  119. package/esm/section/Row.d.ts +16 -0
  120. package/esm/section/Row.js +45 -0
  121. package/esm/store/Section.d.ts +5 -2
  122. package/esm/store/Section.js +4 -0
  123. package/esm/store/Symbols.d.ts +2 -2
  124. package/esm/store/Symbols.js +1 -0
  125. package/esm/store/Types.d.ts +28 -24
  126. package/esm/store/Types.js +6 -4
  127. package/esm/store.d.ts +7 -4
  128. package/esm/symbol/Arrow.d.ts +1 -1
  129. package/esm/symbol/BraceLeft.d.ts +1 -1
  130. package/esm/symbol/BraceRight.d.ts +1 -1
  131. package/esm/symbol/BracketsLeft.d.ts +1 -1
  132. package/esm/symbol/BracketsRight.d.ts +1 -1
  133. package/esm/symbol/Colon.d.ts +1 -1
  134. package/esm/symbol/Quote.d.ts +1 -1
  135. package/esm/symbol/ValueQuote.d.ts +1 -1
  136. package/{cjs/comps/ReRender/Symbols.d.ts → esm/symbol/index.d.ts} +4 -6
  137. package/esm/{comps/ReRender/Symbols.js → symbol/index.js} +26 -24
  138. package/esm/types/Bigint.d.ts +1 -1
  139. package/esm/types/Date.d.ts +1 -1
  140. package/esm/types/False.d.ts +1 -1
  141. package/esm/types/Float.d.ts +1 -1
  142. package/esm/types/Int.d.ts +1 -1
  143. package/esm/types/Map.d.ts +1 -1
  144. package/esm/types/Nan.d.ts +1 -1
  145. package/esm/types/Null.d.ts +1 -1
  146. package/esm/types/Set.d.ts +1 -1
  147. package/esm/types/String.d.ts +1 -1
  148. package/esm/types/True.d.ts +1 -1
  149. package/esm/types/Undefined.d.ts +1 -1
  150. package/esm/types/Url.d.ts +1 -1
  151. package/{cjs/comps/ReRender/Types.d.ts → esm/types/index.d.ts} +8 -13
  152. package/esm/{comps/ReRender/Types.js → types/index.js} +84 -94
  153. package/esm/utils/useHighlight.js +0 -1
  154. package/esm/utils/useRender.d.ts +1 -1
  155. package/package.json +3 -4
  156. package/cjs/comps/CountInfo.d.ts +0 -19
  157. package/cjs/comps/CountInfo.js +0 -72
  158. package/cjs/comps/Ellipsis.d.ts +0 -10
  159. package/cjs/comps/Ellipsis.js +0 -35
  160. package/cjs/comps/Key.d.ts +0 -7
  161. package/cjs/comps/Key.js +0 -39
  162. package/cjs/type.d.ts +0 -50
  163. package/cjs/type.js +0 -57
  164. package/esm/comps/CountInfo.d.ts +0 -19
  165. package/esm/comps/CountInfo.js +0 -70
  166. package/esm/comps/Ellipsis.d.ts +0 -10
  167. package/esm/comps/Ellipsis.js +0 -31
  168. package/esm/comps/Key.d.ts +0 -7
  169. package/esm/comps/Key.js +0 -35
  170. package/esm/type.d.ts +0 -50
  171. package/esm/type.js +0 -50
@@ -1,5 +1,9 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
+ var _excluded = ["as", "render"];
1
4
  import { useSectionStore } from '../store/Section';
2
5
  import { useSectionRender } from '../utils/useRender';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
3
7
  export var Ellipsis = props => {
4
8
  var {
5
9
  Ellipsis: Comp = {}
@@ -7,4 +11,30 @@ export var Ellipsis = props => {
7
11
  useSectionRender(Comp, props, 'Ellipsis');
8
12
  return null;
9
13
  };
10
- Ellipsis.displayName = 'JVR.Ellipsis';
14
+ Ellipsis.displayName = 'JVR.Ellipsis';
15
+ export var EllipsisComp = _ref => {
16
+ var {
17
+ isExpanded,
18
+ value,
19
+ keyName
20
+ } = _ref;
21
+ var {
22
+ Ellipsis: Comp = {}
23
+ } = useSectionStore();
24
+ var {
25
+ as,
26
+ render
27
+ } = Comp,
28
+ reset = _objectWithoutPropertiesLoose(Comp, _excluded);
29
+ var Elm = as || 'span';
30
+ var child = render && typeof render === 'function' && render(_extends({}, reset, {
31
+ 'data-expanded': isExpanded
32
+ }), {
33
+ value,
34
+ keyName
35
+ });
36
+ if (child) return child;
37
+ if (!isExpanded) return null;
38
+ return /*#__PURE__*/_jsx(Elm, _extends({}, reset));
39
+ };
40
+ EllipsisComp.displayName = 'JVR.EllipsisComp';
@@ -1,6 +1,14 @@
1
+ import { type FC, type PropsWithChildren } from 'react';
1
2
  import { type TagType } from '../store/Types';
2
3
  import { type SectionElement } from '../store/Section';
3
4
  export declare const KeyName: {
4
5
  <K extends TagType>(props: SectionElement<K>): null;
5
6
  displayName: string;
6
7
  };
8
+ type KeyNameCompProps = {
9
+ keyName: string | number;
10
+ value?: unknown;
11
+ parentValue?: unknown;
12
+ };
13
+ export declare const KeyNameComp: FC<PropsWithChildren<KeyNameCompProps>>;
14
+ export {};
@@ -1,5 +1,9 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
+ var _excluded = ["as", "render"];
1
4
  import { useSectionStore } from '../store/Section';
2
5
  import { useSectionRender } from '../utils/useRender';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
3
7
  export var KeyName = props => {
4
8
  var {
5
9
  KeyName: Comp = {}
@@ -7,4 +11,38 @@ export var KeyName = props => {
7
11
  useSectionRender(Comp, props, 'KeyName');
8
12
  return null;
9
13
  };
10
- KeyName.displayName = 'JVR.KeyName';
14
+ KeyName.displayName = 'JVR.KeyName';
15
+ export var KeyNameComp = props => {
16
+ var {
17
+ children,
18
+ value,
19
+ parentValue,
20
+ keyName
21
+ } = props;
22
+ var isNumber = typeof children === 'number';
23
+ var style = {
24
+ color: isNumber ? 'var(--w-rjv-key-number, #268bd2)' : 'var(--w-rjv-key-string, #002b36)'
25
+ };
26
+ var {
27
+ KeyName: Comp = {}
28
+ } = useSectionStore();
29
+ var {
30
+ as,
31
+ render
32
+ } = Comp,
33
+ reset = _objectWithoutPropertiesLoose(Comp, _excluded);
34
+ reset.style = _extends({}, reset.style, style);
35
+ var Elm = as || 'span';
36
+ var child = render && typeof render === 'function' && render(_extends({}, reset, {
37
+ children
38
+ }), {
39
+ value,
40
+ parentValue,
41
+ keyName
42
+ });
43
+ if (child) return child;
44
+ return /*#__PURE__*/_jsx(Elm, _extends({}, reset, {
45
+ children: children
46
+ }));
47
+ };
48
+ KeyNameComp.displayName = 'JVR.KeyNameComp';
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ import { type TagType } from '../store/Types';
3
+ import { type SectionElement } from '../store/Section';
4
+ export declare const Row: {
5
+ <K extends TagType>(props: SectionElement<K>): null;
6
+ displayName: string;
7
+ };
8
+ export interface RowCompProps<T extends object> extends React.HTMLAttributes<HTMLDivElement> {
9
+ value?: T;
10
+ keyName?: string | number;
11
+ parentValue?: unknown;
12
+ }
13
+ export declare const RowComp: {
14
+ <T extends object>({ children, value, keyName, parentValue, ...other }: import("react").PropsWithChildren<RowCompProps<T>>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element;
15
+ displayName: string;
16
+ };
@@ -0,0 +1,45 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
+ var _excluded = ["children", "value", "keyName", "parentValue"],
4
+ _excluded2 = ["as", "render", "children"];
5
+ import { useSectionStore } from '../store/Section';
6
+ import { useSectionRender } from '../utils/useRender';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ export var Row = props => {
9
+ var {
10
+ Row: Comp = {}
11
+ } = useSectionStore();
12
+ useSectionRender(Comp, props, 'Row');
13
+ return null;
14
+ };
15
+ Row.displayName = 'JVR.Row';
16
+ export var RowComp = _ref => {
17
+ var {
18
+ children,
19
+ value,
20
+ keyName = '',
21
+ parentValue
22
+ } = _ref,
23
+ other = _objectWithoutPropertiesLoose(_ref, _excluded);
24
+ var {
25
+ Row: Comp = {}
26
+ } = useSectionStore();
27
+ var {
28
+ as,
29
+ render
30
+ } = Comp,
31
+ reset = _objectWithoutPropertiesLoose(Comp, _excluded2);
32
+ var Elm = as || 'div';
33
+ var child = render && typeof render === 'function' && render(_extends({}, other, reset, {
34
+ children
35
+ }), {
36
+ value,
37
+ keyName,
38
+ parentValue
39
+ });
40
+ if (child) return child;
41
+ return /*#__PURE__*/_jsx(Elm, _extends({}, other, reset, {
42
+ children: children
43
+ }));
44
+ };
45
+ RowComp.displayName = 'JVR.RowComp';
@@ -1,18 +1,20 @@
1
1
  import React, { FC, PropsWithChildren, ComponentPropsWithoutRef } from 'react';
2
2
  import { type TagType } from './Types';
3
- export type SectionElementProps<T extends TagType> = {
3
+ export type SectionElementProps<T extends TagType = 'span'> = {
4
4
  as?: T;
5
5
  render?: (props: SectionElement<T>, result: {
6
6
  value: unknown;
7
+ parentValue?: unknown;
7
8
  keyName: string | number;
8
9
  }) => React.ReactNode;
9
10
  };
10
- export type SectionElement<T extends TagType> = SectionElementProps<T> & ComponentPropsWithoutRef<T>;
11
+ export type SectionElement<T extends TagType = 'span'> = SectionElementProps<T> & ComponentPropsWithoutRef<T>;
11
12
  type InitialState<T extends TagType> = {
12
13
  Copied?: SectionElement<T>;
13
14
  CountInfo?: SectionElement<T>;
14
15
  CountInfoExtra?: SectionElement<T>;
15
16
  Ellipsis?: SectionElement<T>;
17
+ Row?: SectionElement<T>;
16
18
  KeyName?: SectionElement<T>;
17
19
  };
18
20
  type Dispatch = React.Dispatch<InitialState<TagType>>;
@@ -22,6 +24,7 @@ export declare function useSection(): [{
22
24
  CountInfo?: SectionElement<TagType> | undefined;
23
25
  CountInfoExtra?: SectionElement<TagType> | undefined;
24
26
  Ellipsis?: SectionElement<TagType> | undefined;
27
+ Row?: SectionElement<TagType> | undefined;
25
28
  KeyName?: SectionElement<TagType> | undefined;
26
29
  }, React.Dispatch<InitialState<TagType>>];
27
30
  export declare function useSectionDispatch(): Dispatch;
@@ -38,6 +38,10 @@ var initialState = {
38
38
  className: 'w-rjv-ellipsis',
39
39
  children: '...'
40
40
  },
41
+ Row: {
42
+ as: 'div',
43
+ className: 'w-rjv-line'
44
+ },
41
45
  KeyName: {
42
46
  as: 'span',
43
47
  className: 'w-rjv-object-key'
@@ -1,11 +1,11 @@
1
1
  import { FC, PropsWithChildren, ElementType, ComponentPropsWithoutRef } from 'react';
2
2
  import { type TagType } from './Types';
3
- type SymbolsElementProps<T extends TagType> = {
3
+ type SymbolsElementProps<T extends TagType = 'span'> = {
4
4
  as?: T;
5
5
  render?: (props: SymbolsElement<T>) => React.ReactNode;
6
6
  'data-type'?: string;
7
7
  };
8
- export type SymbolsElement<T extends TagType> = SymbolsElementProps<T> & ComponentPropsWithoutRef<T>;
8
+ export type SymbolsElement<T extends TagType = 'span'> = SymbolsElementProps<T> & ComponentPropsWithoutRef<T>;
9
9
  type InitialState<T extends ElementType = 'span'> = {
10
10
  Arrow?: SymbolsElement<T>;
11
11
  Colon?: SymbolsElement<T>;
@@ -5,6 +5,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  var initialState = {
6
6
  Arrow: {
7
7
  as: 'span',
8
+ className: 'w-rjv-arrow',
8
9
  style: {
9
10
  transform: 'rotate(0deg)',
10
11
  transition: 'all 0.3s'
@@ -1,32 +1,33 @@
1
- import { FC, PropsWithChildren, ComponentPropsWithoutRef } from 'react';
1
+ import { PropsWithChildren, ComponentPropsWithoutRef } from 'react';
2
2
  export type TagType = React.ElementType | keyof JSX.IntrinsicElements;
3
- type TypesElementProps<T extends TagType> = {
3
+ type TypesElementProps<T extends TagType = 'span'> = {
4
4
  as?: T;
5
5
  render?: (props: TypesElement<T>, result: {
6
6
  type: 'type' | 'value';
7
7
  value?: unknown;
8
+ keyName: string | number;
8
9
  }) => React.ReactNode;
9
10
  'data-type'?: string;
10
11
  };
11
12
  export type TypesElement<T extends TagType> = TypesElementProps<T> & ComponentPropsWithoutRef<T>;
12
- export type InitialTypesState = {
13
+ export type InitialTypesState<T extends TagType = 'span'> = {
13
14
  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>;
15
+ Url?: TypesElement<T>;
16
+ Str?: TypesElement<T>;
17
+ Undefined?: TypesElement<T>;
18
+ Null?: TypesElement<T>;
19
+ True?: TypesElement<T>;
20
+ False?: TypesElement<T>;
21
+ Date?: TypesElement<T>;
22
+ Float?: TypesElement<T>;
23
+ Set?: TypesElement<T>;
24
+ Int?: TypesElement<T>;
25
+ Map?: TypesElement<T>;
26
+ Nan?: TypesElement<T>;
27
+ Bigint?: TypesElement<T>;
27
28
  };
28
- type Dispatch = React.Dispatch<InitialTypesState>;
29
- export declare const useTypesStore: () => InitialTypesState;
29
+ type Dispatch<T extends TagType> = React.Dispatch<InitialTypesState<T>>;
30
+ export declare const useTypesStore: () => InitialTypesState<TagType>;
30
31
  export declare function useTypes(): [{
31
32
  displayDataTypes?: boolean | undefined;
32
33
  Url?: TypesElement<TagType> | undefined;
@@ -42,11 +43,14 @@ export declare function useTypes(): [{
42
43
  Map?: TypesElement<TagType> | undefined;
43
44
  Nan?: TypesElement<TagType> | undefined;
44
45
  Bigint?: TypesElement<TagType> | undefined;
45
- }, import("react").Dispatch<InitialTypesState>];
46
- export declare function useTypesDispatch(): Dispatch;
47
- interface TypesProps {
48
- initial: InitialTypesState;
49
- dispatch: Dispatch;
46
+ }, import("react").Dispatch<InitialTypesState<TagType>>];
47
+ export declare function useTypesDispatch(): Dispatch<TagType>;
48
+ interface TypesProps<T extends TagType> {
49
+ initial: InitialTypesState<T>;
50
+ dispatch: Dispatch<TagType>;
51
+ }
52
+ export declare function Types<T extends TagType>({ initial, dispatch, children }: PropsWithChildren<TypesProps<T>>): import("react/jsx-runtime").JSX.Element;
53
+ export declare namespace Types {
54
+ var displayName: string;
50
55
  }
51
- export declare const Types: FC<PropsWithChildren<TypesProps>>;
52
56
  export {};
@@ -40,7 +40,8 @@ var initialState = {
40
40
  },
41
41
  Map: {
42
42
  style: {
43
- color: 'var(--w-rjv-type-map-color, #268bd2)'
43
+ color: 'var(--w-rjv-type-map-color, #268bd2)',
44
+ marginRight: 3
44
45
  },
45
46
  as: 'span',
46
47
  'data-type': 'map',
@@ -76,7 +77,8 @@ var initialState = {
76
77
  },
77
78
  Set: {
78
79
  style: {
79
- color: 'var(--w-rjv-type-set-color, #268bd2)'
80
+ color: 'var(--w-rjv-type-set-color, #268bd2)',
81
+ marginRight: 3
80
82
  },
81
83
  as: 'span',
82
84
  'data-type': 'set',
@@ -133,7 +135,7 @@ export function useTypes() {
133
135
  export function useTypesDispatch() {
134
136
  return useContext(DispatchTypes);
135
137
  }
136
- export var Types = _ref => {
138
+ export function Types(_ref) {
137
139
  var {
138
140
  initial,
139
141
  dispatch,
@@ -146,5 +148,5 @@ export var Types = _ref => {
146
148
  children: children
147
149
  })
148
150
  });
149
- };
151
+ }
150
152
  Types.displayName = 'JVR.Types';
package/esm/store.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
2
  import { JsonViewProps } from './';
3
- import { type InitialTypesState } from './store/Types';
3
+ import { type InitialTypesState, type TagType } from './store/Types';
4
4
  export type BlockTagType = keyof JSX.IntrinsicElements;
5
5
  export interface InitialState<T extends object> {
6
6
  value?: object;
@@ -20,10 +20,13 @@ export declare const Context: React.Context<InitialState<object>>;
20
20
  export declare function reducer(state: InitialState<object>, action: InitialState<object>): InitialState<object>;
21
21
  export declare const useStore: () => InitialState<object>;
22
22
  export declare const useDispatchStore: () => Dispatch;
23
- export interface ProviderProps {
23
+ export interface ProviderProps<T extends TagType> {
24
24
  initialState?: InitialState<object>;
25
- initialTypes?: InitialTypesState;
25
+ initialTypes?: InitialTypesState<T>;
26
26
  }
27
- export declare const Provider: React.FC<PropsWithChildren<ProviderProps>>;
27
+ export declare const Provider: {
28
+ <T extends TagType>({ children, initialState: init, initialTypes, }: React.PropsWithChildren<ProviderProps<T>>): import("react/jsx-runtime").JSX.Element;
29
+ displayName: string;
30
+ };
28
31
  export declare function useDispatch(): Dispatch;
29
32
  export {};
@@ -1,6 +1,6 @@
1
1
  import { type SymbolsElement } from '../store/Symbols';
2
2
  import { type TagType } from '../store/Types';
3
3
  export declare const Arrow: {
4
- (props: SymbolsElement<TagType>): null;
4
+ <K extends TagType = "span">(props: SymbolsElement<K>): null;
5
5
  displayName: string;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { type SymbolsElement } from '../store/Symbols';
2
2
  import { type TagType } from '../store/Types';
3
3
  export declare const BraceLeft: {
4
- (props: SymbolsElement<TagType>): null;
4
+ <K extends TagType = "span">(props: SymbolsElement<K>): null;
5
5
  displayName: string;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { type SymbolsElement } from '../store/Symbols';
2
2
  import { type TagType } from '../store/Types';
3
3
  export declare const BraceRight: {
4
- (props: SymbolsElement<TagType>): null;
4
+ <K extends TagType = "span">(props: SymbolsElement<K>): null;
5
5
  displayName: string;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { type SymbolsElement } from '../store/Symbols';
2
2
  import { type TagType } from '../store/Types';
3
3
  export declare const BracketsLeft: {
4
- (props: SymbolsElement<TagType>): null;
4
+ <K extends TagType = "span">(props: SymbolsElement<K>): null;
5
5
  displayName: string;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { type SymbolsElement } from '../store/Symbols';
2
2
  import { type TagType } from '../store/Types';
3
3
  export declare const BracketsRight: {
4
- (props: SymbolsElement<TagType>): null;
4
+ <K extends TagType = "span">(props: SymbolsElement<K>): null;
5
5
  displayName: string;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { type SymbolsElement } from '../store/Symbols';
2
2
  import { type TagType } from '../store/Types';
3
3
  export declare const Colon: {
4
- (props: SymbolsElement<TagType>): null;
4
+ <K extends TagType = "span">(props: SymbolsElement<K>): null;
5
5
  displayName: string;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { type SymbolsElement } from '../store/Symbols';
2
2
  import { type TagType } from '../store/Types';
3
3
  export declare const Quote: {
4
- (props: SymbolsElement<TagType>): null;
4
+ <K extends TagType = "span">(props: SymbolsElement<K>): null;
5
5
  displayName: string;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { type SymbolsElement } from '../store/Symbols';
2
2
  import { type TagType } from '../store/Types';
3
3
  export declare const ValueQuote: {
4
- (props: SymbolsElement<TagType>): null;
4
+ <K extends TagType = "span">(props: SymbolsElement<K>): null;
5
5
  displayName: string;
6
6
  };
@@ -1,16 +1,14 @@
1
1
  /// <reference types="react" />
2
- import { type SymbolsElement } from '../../store/Symbols';
3
- import { type TagType } from '../../store/Types';
2
+ import { type SymbolsElement } from '../store/Symbols';
3
+ import { type TagType } from '../store/Types';
4
4
  export declare const Quote: {
5
5
  (props: {
6
6
  isNumber?: boolean | undefined;
7
- }): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
7
+ } & import("react").HTMLAttributes<HTMLElement>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
8
8
  displayName: string;
9
9
  };
10
10
  export declare const ValueQuote: {
11
- (props: {
12
- isNumber?: boolean | undefined;
13
- }): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
11
+ (props: React.HTMLAttributes<HTMLElement>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element;
14
12
  displayName: string;
15
13
  };
16
14
  export declare const Colon: {
@@ -1,52 +1,54 @@
1
+ import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
1
2
  import _extends from "@babel/runtime/helpers/extends";
2
3
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["as", "render"],
4
+ var _excluded = ["isNumber"],
4
5
  _excluded2 = ["as", "render"],
5
6
  _excluded3 = ["as", "render"],
6
- _excluded4 = ["as", "style", "render"],
7
- _excluded5 = ["as", "render"],
7
+ _excluded4 = ["as", "render"],
8
+ _excluded5 = ["as", "style", "render"],
8
9
  _excluded6 = ["as", "render"],
9
10
  _excluded7 = ["as", "render"],
10
- _excluded8 = ["as", "render"];
11
- import { useSymbolsStore } from '../../store/Symbols';
12
- import { useExpandsStore } from '../../store/Expands';
11
+ _excluded8 = ["as", "render"],
12
+ _excluded9 = ["as", "render"];
13
+ import { useSymbolsStore } from '../store/Symbols';
14
+ import { useExpandsStore } from '../store/Expands';
13
15
  import { jsx as _jsx } from "react/jsx-runtime";
14
16
  export var Quote = props => {
15
17
  var {
16
18
  Quote: Comp = {}
17
19
  } = useSymbolsStore();
18
20
  var {
19
- isNumber
20
- } = props;
21
+ isNumber
22
+ } = props,
23
+ other = _objectWithoutPropertiesLoose(props, _excluded);
21
24
  if (isNumber) return null;
22
25
  var {
23
26
  as,
24
27
  render
25
28
  } = Comp,
26
- reset = _objectWithoutPropertiesLoose(Comp, _excluded);
29
+ reset = _objectWithoutPropertiesLoose(Comp, _excluded2);
27
30
  var Elm = as || 'span';
28
- var child = render && typeof render === 'function' && render(reset);
31
+ var elmProps = _extends({}, other, reset);
32
+ var child = render && typeof render === 'function' && render(elmProps);
29
33
  if (child) return child;
30
- return /*#__PURE__*/_jsx(Elm, _extends({}, reset));
34
+ return /*#__PURE__*/_jsx(Elm, _extends({}, elmProps));
31
35
  };
32
36
  Quote.displayName = 'JVR.Quote';
33
37
  export var ValueQuote = props => {
34
38
  var {
35
39
  ValueQuote: Comp = {}
36
40
  } = useSymbolsStore();
37
- var {
38
- isNumber
39
- } = props;
40
- if (isNumber) return null;
41
+ var other = _extends({}, (_objectDestructuringEmpty(props), props));
41
42
  var {
42
43
  as,
43
44
  render
44
45
  } = Comp,
45
- reset = _objectWithoutPropertiesLoose(Comp, _excluded2);
46
+ reset = _objectWithoutPropertiesLoose(Comp, _excluded3);
46
47
  var Elm = as || 'span';
47
- var child = render && typeof render === 'function' && render(reset);
48
+ var elmProps = _extends({}, other, reset);
49
+ var child = render && typeof render === 'function' && render(elmProps);
48
50
  if (child) return child;
49
- return /*#__PURE__*/_jsx(Elm, _extends({}, reset));
51
+ return /*#__PURE__*/_jsx(Elm, _extends({}, elmProps));
50
52
  };
51
53
  ValueQuote.displayName = 'JVR.ValueQuote';
52
54
  export var Colon = () => {
@@ -57,7 +59,7 @@ export var Colon = () => {
57
59
  as,
58
60
  render
59
61
  } = Comp,
60
- reset = _objectWithoutPropertiesLoose(Comp, _excluded3);
62
+ reset = _objectWithoutPropertiesLoose(Comp, _excluded4);
61
63
  var Elm = as || 'span';
62
64
  var child = render && typeof render === 'function' && render(reset);
63
65
  if (child) return child;
@@ -78,7 +80,7 @@ export var Arrow = props => {
78
80
  style,
79
81
  render
80
82
  } = Comp,
81
- reset = _objectWithoutPropertiesLoose(Comp, _excluded4);
83
+ reset = _objectWithoutPropertiesLoose(Comp, _excluded5);
82
84
  var Elm = as || 'span';
83
85
  var isRender = render && typeof render === 'function';
84
86
  var child = isRender && render(_extends({}, reset, {
@@ -104,7 +106,7 @@ export var BracketsOpen = _ref => {
104
106
  as,
105
107
  render: _render
106
108
  } = BracketsLeft,
107
- reset = _objectWithoutPropertiesLoose(BracketsLeft, _excluded5);
109
+ reset = _objectWithoutPropertiesLoose(BracketsLeft, _excluded6);
108
110
  var BracketsLeftComp = as || 'span';
109
111
  var _child = _render && typeof _render === 'function' && _render(reset);
110
112
  if (_child) return _child;
@@ -114,7 +116,7 @@ export var BracketsOpen = _ref => {
114
116
  as: elm,
115
117
  render
116
118
  } = BraceLeft,
117
- props = _objectWithoutPropertiesLoose(BraceLeft, _excluded6);
119
+ props = _objectWithoutPropertiesLoose(BraceLeft, _excluded7);
118
120
  var BraceLeftComp = elm || 'span';
119
121
  var child = render && typeof render === 'function' && render(props);
120
122
  if (child) return child;
@@ -136,7 +138,7 @@ export var BracketsClose = _ref2 => {
136
138
  as,
137
139
  render: _render2
138
140
  } = BracketsRight,
139
- _reset = _objectWithoutPropertiesLoose(BracketsRight, _excluded7);
141
+ _reset = _objectWithoutPropertiesLoose(BracketsRight, _excluded8);
140
142
  var BracketsRightComp = as || 'span';
141
143
  var _child2 = _render2 && typeof _render2 === 'function' && _render2(_reset);
142
144
  if (_child2) return _child2;
@@ -146,7 +148,7 @@ export var BracketsClose = _ref2 => {
146
148
  as: elm,
147
149
  render
148
150
  } = BraceRight,
149
- reset = _objectWithoutPropertiesLoose(BraceRight, _excluded8);
151
+ reset = _objectWithoutPropertiesLoose(BraceRight, _excluded9);
150
152
  var BraceRightComp = elm || 'span';
151
153
  var child = render && typeof render === 'function' && render(reset);
152
154
  if (child) return child;
@@ -1,5 +1,5 @@
1
1
  import { type TagType, type TypesElement } from '../store/Types';
2
2
  export declare const Bigint: {
3
- <K extends TagType>(props: TypesElement<K>): null;
3
+ <K extends TagType = "span">(props: TypesElement<K>): null;
4
4
  displayName: string;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { type TagType, type TypesElement } from '../store/Types';
2
2
  export declare const Date: {
3
- (props: TypesElement<TagType>): null;
3
+ <K extends TagType = "span">(props: TypesElement<K>): null;
4
4
  displayName: string;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { type TagType, type TypesElement } from '../store/Types';
2
2
  export declare const False: {
3
- (props: TypesElement<TagType>): null;
3
+ <K extends TagType = "span">(props: TypesElement<K>): null;
4
4
  displayName: string;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { type TagType, type TypesElement } from '../store/Types';
2
2
  export declare const Float: {
3
- (props: TypesElement<TagType>): null;
3
+ <K extends TagType = "span">(props: TypesElement<K>): null;
4
4
  displayName: string;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { type TagType, type TypesElement } from '../store/Types';
2
2
  export declare const Int: {
3
- (props: TypesElement<TagType>): null;
3
+ <K extends TagType = "span">(props: TypesElement<K>): null;
4
4
  displayName: string;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { type TagType, type TypesElement } from '../store/Types';
2
2
  export declare const Map: {
3
- (props: TypesElement<TagType>): null;
3
+ <K extends TagType = "span">(props: TypesElement<K>): null;
4
4
  displayName: string;
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { type TagType, type TypesElement } from '../store/Types';
2
2
  export declare const Nan: {
3
- (props: TypesElement<TagType>): null;
3
+ <K extends TagType = "span">(props: TypesElement<K>): null;
4
4
  displayName: string;
5
5
  };