@uiw/react-json-view 2.0.0-alpha.4 → 2.0.0-alpha.6

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 (62) hide show
  1. package/README.md +4 -0
  2. package/cjs/index.d.ts +1 -1
  3. package/cjs/index.js +1 -1
  4. package/cjs/section/Copied.d.ts +1 -1
  5. package/cjs/section/CountInfo.d.ts +1 -1
  6. package/cjs/section/CountInfoExtra.d.ts +1 -1
  7. package/cjs/store/Section.d.ts +2 -2
  8. package/cjs/store/Symbols.d.ts +2 -2
  9. package/cjs/symbol/Arrow.d.ts +1 -1
  10. package/cjs/symbol/BraceLeft.d.ts +1 -1
  11. package/cjs/symbol/BraceRight.d.ts +1 -1
  12. package/cjs/symbol/BracketsLeft.d.ts +1 -1
  13. package/cjs/symbol/BracketsRight.d.ts +1 -1
  14. package/cjs/symbol/Colon.d.ts +1 -1
  15. package/cjs/symbol/Quote.d.ts +1 -1
  16. package/cjs/symbol/ValueQuote.d.ts +1 -1
  17. package/cjs/types/Bigint.d.ts +1 -1
  18. package/cjs/types/Date.d.ts +1 -1
  19. package/cjs/types/False.d.ts +1 -1
  20. package/cjs/types/Float.d.ts +1 -1
  21. package/cjs/types/Int.d.ts +1 -1
  22. package/cjs/types/Map.d.ts +1 -1
  23. package/cjs/types/Nan.d.ts +1 -1
  24. package/cjs/types/Null.d.ts +1 -1
  25. package/cjs/types/Set.d.ts +1 -1
  26. package/cjs/types/String.d.ts +1 -1
  27. package/cjs/types/True.d.ts +1 -1
  28. package/cjs/types/Undefined.d.ts +1 -1
  29. package/cjs/types/Url.d.ts +1 -1
  30. package/cjs/types/index.js +4 -1
  31. package/cjs/utils/useRender.d.ts +1 -1
  32. package/esm/index.d.ts +1 -1
  33. package/esm/index.js +1 -1
  34. package/esm/section/Copied.d.ts +1 -1
  35. package/esm/section/CountInfo.d.ts +1 -1
  36. package/esm/section/CountInfoExtra.d.ts +1 -1
  37. package/esm/store/Section.d.ts +2 -2
  38. package/esm/store/Symbols.d.ts +2 -2
  39. package/esm/symbol/Arrow.d.ts +1 -1
  40. package/esm/symbol/BraceLeft.d.ts +1 -1
  41. package/esm/symbol/BraceRight.d.ts +1 -1
  42. package/esm/symbol/BracketsLeft.d.ts +1 -1
  43. package/esm/symbol/BracketsRight.d.ts +1 -1
  44. package/esm/symbol/Colon.d.ts +1 -1
  45. package/esm/symbol/Quote.d.ts +1 -1
  46. package/esm/symbol/ValueQuote.d.ts +1 -1
  47. package/esm/types/Bigint.d.ts +1 -1
  48. package/esm/types/Date.d.ts +1 -1
  49. package/esm/types/False.d.ts +1 -1
  50. package/esm/types/Float.d.ts +1 -1
  51. package/esm/types/Int.d.ts +1 -1
  52. package/esm/types/Map.d.ts +1 -1
  53. package/esm/types/Nan.d.ts +1 -1
  54. package/esm/types/Null.d.ts +1 -1
  55. package/esm/types/Set.d.ts +1 -1
  56. package/esm/types/String.d.ts +1 -1
  57. package/esm/types/True.d.ts +1 -1
  58. package/esm/types/Undefined.d.ts +1 -1
  59. package/esm/types/Url.d.ts +1 -1
  60. package/esm/types/index.js +3 -2
  61. package/esm/utils/useRender.d.ts +1 -1
  62. package/package.json +1 -1
package/README.md CHANGED
@@ -696,8 +696,12 @@ export interface JsonViewProps<T extends object> extends React.DetailedHTMLProps
696
696
  displayDataTypes?: boolean;
697
697
  /** The user can copy objects and arrays to clipboard by clicking on the clipboard icon. @default true */
698
698
  enableClipboard?: boolean;
699
+ /** When set to true, all nodes will be collapsed by default. Use an integer value to collapse at a particular depth. @default false */
700
+ collapsed?: boolean | number;
699
701
  /** Whether to highlight updates. @default true */
700
702
  highlightUpdates?: boolean;
703
+ /** Shorten long JSON strings, Set to `0` to disable this feature @default 30 */
704
+ shortenTextAfterLength?: number;
701
705
  /** Callback function for when a treeNode is expanded or collapsed */
702
706
  onExpand?: (props: {
703
707
  expand: boolean;
package/cjs/index.d.ts CHANGED
@@ -50,7 +50,7 @@ export interface JsonViewProps<T extends object> extends React.DetailedHTMLProps
50
50
  collapsed?: boolean | number;
51
51
  /** Whether to highlight updates. @default true */
52
52
  highlightUpdates?: boolean;
53
- /** Shorten long JSON strings, Set to `0` to disable this feature @default 20 */
53
+ /** Shorten long JSON strings, Set to `0` to disable this feature @default 30 */
54
54
  shortenTextAfterLength?: number;
55
55
  /** Callback function for when a treeNode is expanded or collapsed */
56
56
  onExpand?: (props: {
package/cjs/index.js CHANGED
@@ -122,7 +122,7 @@ var JsonView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
122
122
  _props$displayObjectS = props.displayObjectSize,
123
123
  displayObjectSize = _props$displayObjectS === void 0 ? true : _props$displayObjectS,
124
124
  _props$shortenTextAft = props.shortenTextAfterLength,
125
- shortenTextAfterLength = _props$shortenTextAft === void 0 ? 20 : _props$shortenTextAft,
125
+ shortenTextAfterLength = _props$shortenTextAft === void 0 ? 30 : _props$shortenTextAft,
126
126
  _props$highlightUpdat = props.highlightUpdates,
127
127
  highlightUpdates = _props$highlightUpdat === void 0 ? true : _props$highlightUpdat,
128
128
  _props$enableClipboar = props.enableClipboard,
@@ -1,6 +1,6 @@
1
1
  import { type TagType } from '../store/Types';
2
2
  import { type SectionElement } from '../store/Section';
3
3
  export declare const Copied: {
4
- (props: SectionElement<TagType>): null;
4
+ <K extends TagType = "svg">(props: SectionElement<K>): null;
5
5
  displayName: string;
6
6
  };
@@ -10,6 +10,6 @@ export interface CountInfoCompProps<T extends object> {
10
10
  keyName: string | number;
11
11
  }
12
12
  export declare const CountInfoComp: {
13
- <T extends object>(props: SectionElementProps<TagType> & CountInfoCompProps<T> & import("react").HTMLAttributes<HTMLElement>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
13
+ <K extends TagType, T extends object>(props: SectionElementProps<K> & CountInfoCompProps<T> & import("react").HTMLAttributes<HTMLElement>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
14
14
  displayName: string;
15
15
  };
@@ -10,6 +10,6 @@ export interface CountInfoExtraCompsProps<T extends object> {
10
10
  keyName: string | number;
11
11
  }
12
12
  export declare const CountInfoExtraComps: {
13
- <T extends object>(props: SectionElementProps<TagType> & CountInfoExtraCompsProps<T>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
13
+ <T extends object, K extends TagType>(props: SectionElementProps<K> & CountInfoExtraCompsProps<T>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
14
14
  displayName: string;
15
15
  };
@@ -1,13 +1,13 @@
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
7
  keyName: string | number;
8
8
  }) => React.ReactNode;
9
9
  };
10
- export type SectionElement<T extends TagType> = SectionElementProps<T> & ComponentPropsWithoutRef<T>;
10
+ export type SectionElement<T extends TagType = 'span'> = SectionElementProps<T> & ComponentPropsWithoutRef<T>;
11
11
  type InitialState<T extends TagType> = {
12
12
  Copied?: SectionElement<T>;
13
13
  CountInfo?: SectionElement<T>;
@@ -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>;
@@ -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,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
  };
@@ -1,5 +1,5 @@
1
1
  import { type TagType, type TypesElement } from '../store/Types';
2
2
  export declare const Null: {
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 Set: {
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 StringText: {
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 True: {
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 Undefined: {
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 Url: {
3
- (props: TypesElement<TagType>): null;
3
+ <K extends TagType = "a">(props: TypesElement<K>): null;
4
4
  displayName: string;
5
5
  };
@@ -86,7 +86,7 @@ var TypeString = function TypeString(_ref3) {
86
86
  displayDataTypes = _useTypesStore3.displayDataTypes;
87
87
  var _useStore = (0, _store.useStore)(),
88
88
  _useStore$shortenText = _useStore.shortenTextAfterLength,
89
- length = _useStore$shortenText === void 0 ? 20 : _useStore$shortenText;
89
+ length = _useStore$shortenText === void 0 ? 30 : _useStore$shortenText;
90
90
  var as = Str.as,
91
91
  render = Str.render,
92
92
  reset = (0, _objectWithoutProperties2["default"])(Str, _excluded3);
@@ -95,6 +95,9 @@ var TypeString = function TypeString(_ref3) {
95
95
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
96
96
  shorten = _useState2[0],
97
97
  setShorten = _useState2[1];
98
+ (0, _react.useEffect)(function () {
99
+ return setShorten(length && childrenStr.length >= length);
100
+ }, [length]);
98
101
  var Comp = as || 'span';
99
102
  var style = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, defalutStyle), Str.style || {});
100
103
  if (length > 0) {
@@ -1,6 +1,6 @@
1
1
  import { type SymbolsElement } from '../store/Symbols';
2
2
  import { type TagType, type TypesElement } from '../store/Types';
3
3
  import { type SectionElement } from '../store/Section';
4
- export declare function useSymbolsRender(currentProps: SymbolsElement<TagType>, props: SymbolsElement<TagType>, key: string): void;
4
+ export declare function useSymbolsRender<K extends TagType>(currentProps: SymbolsElement<TagType>, props: SymbolsElement<K>, key: string): void;
5
5
  export declare function useTypesRender<K extends TagType>(currentProps: TypesElement<TagType>, props: TypesElement<K>, key: string): void;
6
6
  export declare function useSectionRender<K extends TagType>(currentProps: SectionElement<TagType>, props: SectionElement<K>, key: string): void;
package/esm/index.d.ts CHANGED
@@ -50,7 +50,7 @@ export interface JsonViewProps<T extends object> extends React.DetailedHTMLProps
50
50
  collapsed?: boolean | number;
51
51
  /** Whether to highlight updates. @default true */
52
52
  highlightUpdates?: boolean;
53
- /** Shorten long JSON strings, Set to `0` to disable this feature @default 20 */
53
+ /** Shorten long JSON strings, Set to `0` to disable this feature @default 30 */
54
54
  shortenTextAfterLength?: number;
55
55
  /** Callback function for when a treeNode is expanded or collapsed */
56
56
  onExpand?: (props: {
package/esm/index.js CHANGED
@@ -47,7 +47,7 @@ var JsonView = /*#__PURE__*/forwardRef((props, ref) => {
47
47
  collapsed,
48
48
  indentWidth = 15,
49
49
  displayObjectSize = true,
50
- shortenTextAfterLength = 20,
50
+ shortenTextAfterLength = 30,
51
51
  highlightUpdates = true,
52
52
  enableClipboard = true,
53
53
  displayDataTypes = true,
@@ -1,6 +1,6 @@
1
1
  import { type TagType } from '../store/Types';
2
2
  import { type SectionElement } from '../store/Section';
3
3
  export declare const Copied: {
4
- (props: SectionElement<TagType>): null;
4
+ <K extends TagType = "svg">(props: SectionElement<K>): null;
5
5
  displayName: string;
6
6
  };
@@ -10,6 +10,6 @@ export interface CountInfoCompProps<T extends object> {
10
10
  keyName: string | number;
11
11
  }
12
12
  export declare const CountInfoComp: {
13
- <T extends object>(props: SectionElementProps<TagType> & CountInfoCompProps<T> & import("react").HTMLAttributes<HTMLElement>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
13
+ <K extends TagType, T extends object>(props: SectionElementProps<K> & CountInfoCompProps<T> & import("react").HTMLAttributes<HTMLElement>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
14
14
  displayName: string;
15
15
  };
@@ -10,6 +10,6 @@ export interface CountInfoExtraCompsProps<T extends object> {
10
10
  keyName: string | number;
11
11
  }
12
12
  export declare const CountInfoExtraComps: {
13
- <T extends object>(props: SectionElementProps<TagType> & CountInfoExtraCompsProps<T>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
13
+ <T extends object, K extends TagType>(props: SectionElementProps<K> & CountInfoExtraCompsProps<T>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
14
14
  displayName: string;
15
15
  };
@@ -1,13 +1,13 @@
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
7
  keyName: string | number;
8
8
  }) => React.ReactNode;
9
9
  };
10
- export type SectionElement<T extends TagType> = SectionElementProps<T> & ComponentPropsWithoutRef<T>;
10
+ export type SectionElement<T extends TagType = 'span'> = SectionElementProps<T> & ComponentPropsWithoutRef<T>;
11
11
  type InitialState<T extends TagType> = {
12
12
  Copied?: SectionElement<T>;
13
13
  CountInfo?: SectionElement<T>;
@@ -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>;
@@ -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,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
  };
@@ -1,5 +1,5 @@
1
1
  import { type TagType, type TypesElement } from '../store/Types';
2
2
  export declare const Null: {
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 Set: {
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 StringText: {
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 True: {
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 Undefined: {
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 Url: {
3
- (props: TypesElement<TagType>): null;
3
+ <K extends TagType = "a">(props: TypesElement<K>): null;
4
4
  displayName: string;
5
5
  };
@@ -13,7 +13,7 @@ var _excluded = ["as", "render"],
13
13
  _excluded11 = ["as", "render"],
14
14
  _excluded12 = ["as", "render"],
15
15
  _excluded13 = ["as", "render"];
16
- import { Fragment, useState } from 'react';
16
+ import { Fragment, useEffect, useState } from 'react';
17
17
  import { useTypesStore } from '../store/Types';
18
18
  import { useStore } from '../store';
19
19
  import { ValueQuote } from '../symbol';
@@ -85,7 +85,7 @@ export var TypeString = _ref3 => {
85
85
  displayDataTypes
86
86
  } = useTypesStore();
87
87
  var {
88
- shortenTextAfterLength: length = 20
88
+ shortenTextAfterLength: length = 30
89
89
  } = useStore();
90
90
  var {
91
91
  as,
@@ -94,6 +94,7 @@ export var TypeString = _ref3 => {
94
94
  reset = _objectWithoutPropertiesLoose(Str, _excluded3);
95
95
  var childrenStr = children;
96
96
  var [shorten, setShorten] = useState(length && childrenStr.length >= length);
97
+ useEffect(() => setShorten(length && childrenStr.length >= length), [length]);
97
98
  var Comp = as || 'span';
98
99
  var style = _extends({}, defalutStyle, Str.style || {});
99
100
  if (length > 0) {
@@ -1,6 +1,6 @@
1
1
  import { type SymbolsElement } from '../store/Symbols';
2
2
  import { type TagType, type TypesElement } from '../store/Types';
3
3
  import { type SectionElement } from '../store/Section';
4
- export declare function useSymbolsRender(currentProps: SymbolsElement<TagType>, props: SymbolsElement<TagType>, key: string): void;
4
+ export declare function useSymbolsRender<K extends TagType>(currentProps: SymbolsElement<TagType>, props: SymbolsElement<K>, key: string): void;
5
5
  export declare function useTypesRender<K extends TagType>(currentProps: TypesElement<TagType>, props: TypesElement<K>, key: string): void;
6
6
  export declare function useSectionRender<K extends TagType>(currentProps: SectionElement<TagType>, props: SectionElement<K>, key: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uiw/react-json-view",
3
- "version": "2.0.0-alpha.4",
3
+ "version": "2.0.0-alpha.6",
4
4
  "description": "JSON viewer for react.",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",