@uiw/react-json-view 2.0.0-alpha.23 → 2.0.0-alpha.25

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 (45) hide show
  1. package/cjs/comps/Copied.d.ts +0 -1
  2. package/cjs/editor/index.d.ts +0 -1
  3. package/cjs/editor/store.d.ts +5 -6
  4. package/cjs/index.d.ts +0 -1
  5. package/cjs/section/CountInfo.d.ts +0 -1
  6. package/cjs/section/CountInfoExtra.d.ts +0 -1
  7. package/cjs/section/Ellipsis.d.ts +0 -1
  8. package/cjs/section/Ellipsis.js +2 -1
  9. package/cjs/section/Row.d.ts +0 -1
  10. package/cjs/store/Types.d.ts +1 -1
  11. package/cjs/symbol/index.d.ts +0 -1
  12. package/cjs/theme/basic.d.ts +1 -2
  13. package/cjs/theme/dark.d.ts +1 -2
  14. package/cjs/theme/github.dark.d.ts +1 -2
  15. package/cjs/theme/github.light.d.ts +1 -2
  16. package/cjs/theme/gruvbox.d.ts +1 -2
  17. package/cjs/theme/light.d.ts +1 -2
  18. package/cjs/theme/monokai.d.ts +1 -2
  19. package/cjs/theme/nord.d.ts +1 -2
  20. package/cjs/theme/vscode.d.ts +1 -2
  21. package/cjs/types/index.js +2 -2
  22. package/cjs/utils/useHighlight.d.ts +0 -1
  23. package/esm/comps/Copied.d.ts +0 -1
  24. package/esm/editor/index.d.ts +0 -1
  25. package/esm/editor/store.d.ts +5 -6
  26. package/esm/index.d.ts +0 -1
  27. package/esm/section/CountInfo.d.ts +0 -1
  28. package/esm/section/CountInfoExtra.d.ts +0 -1
  29. package/esm/section/Ellipsis.d.ts +0 -1
  30. package/esm/section/Ellipsis.js +1 -1
  31. package/esm/section/Row.d.ts +0 -1
  32. package/esm/store/Types.d.ts +1 -1
  33. package/esm/symbol/index.d.ts +0 -1
  34. package/esm/theme/basic.d.ts +1 -2
  35. package/esm/theme/dark.d.ts +1 -2
  36. package/esm/theme/github.dark.d.ts +1 -2
  37. package/esm/theme/github.light.d.ts +1 -2
  38. package/esm/theme/gruvbox.d.ts +1 -2
  39. package/esm/theme/light.d.ts +1 -2
  40. package/esm/theme/monokai.d.ts +1 -2
  41. package/esm/theme/nord.d.ts +1 -2
  42. package/esm/theme/vscode.d.ts +1 -2
  43. package/esm/types/index.js +2 -2
  44. package/esm/utils/useHighlight.d.ts +0 -1
  45. package/package.json +1 -1
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type SectionElementResult } from '../store/Section';
3
2
  import { type TagType } from '../store/Types';
4
3
  export type CopiedOption<T extends object> = {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type JsonViewProps } from '../';
3
2
  export interface JsonViewEditorProps<T extends object> extends Omit<JsonViewProps<T>, 'shortenTextAfterLength'> {
4
3
  /**
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type InitialState = {
3
2
  /**
4
3
  * When a callback function is passed in, edit functionality is enabled. The callback is invoked before edits are completed.
@@ -17,12 +16,12 @@ export declare const Context: import("react").Context<InitialState>;
17
16
  export declare const Dispatch: import("react").Context<Dispatch>;
18
17
  export declare const useStore: () => InitialState;
19
18
  export declare function useStoreReducer(initialState: InitialState): [{
20
- onEdit?: ((option: {
19
+ onEdit?: (option: {
21
20
  value: unknown;
22
21
  oldValue: unknown;
23
- keyName?: string | number | undefined;
24
- parentName?: string | number | undefined;
25
- type?: "value" | "key" | undefined;
26
- }) => boolean) | undefined;
22
+ keyName?: string | number;
23
+ parentName?: string | number;
24
+ type?: "value" | "key";
25
+ }) => boolean;
27
26
  }, import("react").Dispatch<InitialState>];
28
27
  export {};
package/cjs/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { BraceLeft } from './symbol/BraceLeft';
3
2
  import { BraceRight } from './symbol/BraceRight';
4
3
  import { BracketsLeft } from './symbol/BracketsLeft';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type TagType } from '../store/Types';
3
2
  import { type SectionElement, type SectionElementProps } from '../store/Section';
4
3
  export declare const CountInfo: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type TagType } from '../store/Types';
3
2
  import { type SectionElement, type SectionElementProps } from '../store/Section';
4
3
  export declare const CountInfoExtra: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type TagType } from '../store/Types';
3
2
  import { type SectionElement } from '../store/Section';
4
3
  export declare const Ellipsis: {
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.EllipsisComp = exports.Ellipsis = void 0;
8
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
8
9
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
11
  var _Section = require("../store/Section");
@@ -37,7 +38,7 @@ var EllipsisComp = exports.EllipsisComp = function EllipsisComp(_ref) {
37
38
  keyName: keyName
38
39
  });
39
40
  if (child) return child;
40
- if (!isExpanded) return null;
41
+ if (!isExpanded || (0, _typeof2["default"])(value) === 'object' && Object.keys(value).length == 0) return null;
41
42
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Elm, (0, _objectSpread2["default"])({}, reset));
42
43
  };
43
44
  EllipsisComp.displayName = 'JVR.EllipsisComp';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type TagType } from '../store/Types';
3
2
  import { type SectionElement } from '../store/Section';
4
3
  import { type SectionElementResult } from '../store/Section';
@@ -29,7 +29,7 @@ export type InitialTypesState<T extends TagType = 'span'> = {
29
29
  type Dispatch<T extends TagType> = React.Dispatch<InitialTypesState<T>>;
30
30
  export declare const useTypesStore: () => InitialTypesState<TagType>;
31
31
  export declare function useTypes(): [{
32
- displayDataTypes?: boolean | undefined;
32
+ displayDataTypes?: boolean;
33
33
  Url?: TypesElement<TagType> | undefined;
34
34
  Str?: TypesElement<TagType> | undefined;
35
35
  Undefined?: TypesElement<TagType> | undefined;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type SymbolsElement } from '../store/Symbols';
3
2
  import { type TagType } from '../store/Types';
4
3
  export declare const Quote: {
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const basicTheme: import("react").CSSProperties;
1
+ export declare const basicTheme: React.CSSProperties;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const darkTheme: import("react").CSSProperties;
1
+ export declare const darkTheme: React.CSSProperties;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const githubDarkTheme: import("react").CSSProperties;
1
+ export declare const githubDarkTheme: React.CSSProperties;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const githubLightTheme: import("react").CSSProperties;
1
+ export declare const githubLightTheme: React.CSSProperties;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const gruvboxTheme: import("react").CSSProperties;
1
+ export declare const gruvboxTheme: React.CSSProperties;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const lightTheme: import("react").CSSProperties;
1
+ export declare const lightTheme: React.CSSProperties;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const monokaiTheme: import("react").CSSProperties;
1
+ export declare const monokaiTheme: React.CSSProperties;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const nordTheme: import("react").CSSProperties;
1
+ export declare const nordTheme: React.CSSProperties;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const vscodeTheme: import("react").CSSProperties;
1
+ export declare const vscodeTheme: React.CSSProperties;
@@ -103,12 +103,12 @@ var TypeString = exports.TypeString = function TypeString(_ref3) {
103
103
  render = Str.render,
104
104
  reset = (0, _objectWithoutProperties2["default"])(Str, _excluded3);
105
105
  var childrenStr = children;
106
- var _useState = (0, _react.useState)(length && childrenStr.length >= length),
106
+ var _useState = (0, _react.useState)(length && childrenStr.length > length),
107
107
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
108
108
  shorten = _useState2[0],
109
109
  setShorten = _useState2[1];
110
110
  (0, _react.useEffect)(function () {
111
- return setShorten(length && childrenStr.length >= length);
111
+ return setShorten(length && childrenStr.length > length);
112
112
  }, [length]);
113
113
  var Comp = as || 'span';
114
114
  var style = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, defalutStyle), Str.style || {});
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare function usePrevious<T>(value: T): T | undefined;
3
2
  interface UseHighlight {
4
3
  value: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type SectionElementResult } from '../store/Section';
3
2
  import { type TagType } from '../store/Types';
4
3
  export type CopiedOption<T extends object> = {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type JsonViewProps } from '../';
3
2
  export interface JsonViewEditorProps<T extends object> extends Omit<JsonViewProps<T>, 'shortenTextAfterLength'> {
4
3
  /**
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type InitialState = {
3
2
  /**
4
3
  * When a callback function is passed in, edit functionality is enabled. The callback is invoked before edits are completed.
@@ -17,12 +16,12 @@ export declare const Context: import("react").Context<InitialState>;
17
16
  export declare const Dispatch: import("react").Context<Dispatch>;
18
17
  export declare const useStore: () => InitialState;
19
18
  export declare function useStoreReducer(initialState: InitialState): [{
20
- onEdit?: ((option: {
19
+ onEdit?: (option: {
21
20
  value: unknown;
22
21
  oldValue: unknown;
23
- keyName?: string | number | undefined;
24
- parentName?: string | number | undefined;
25
- type?: "value" | "key" | undefined;
26
- }) => boolean) | undefined;
22
+ keyName?: string | number;
23
+ parentName?: string | number;
24
+ type?: "value" | "key";
25
+ }) => boolean;
27
26
  }, import("react").Dispatch<InitialState>];
28
27
  export {};
package/esm/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { BraceLeft } from './symbol/BraceLeft';
3
2
  import { BraceRight } from './symbol/BraceRight';
4
3
  import { BracketsLeft } from './symbol/BracketsLeft';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type TagType } from '../store/Types';
3
2
  import { type SectionElement, type SectionElementProps } from '../store/Section';
4
3
  export declare const CountInfo: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type TagType } from '../store/Types';
3
2
  import { type SectionElement, type SectionElementProps } from '../store/Section';
4
3
  export declare const CountInfoExtra: {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type TagType } from '../store/Types';
3
2
  import { type SectionElement } from '../store/Section';
4
3
  export declare const Ellipsis: {
@@ -34,7 +34,7 @@ export var EllipsisComp = _ref => {
34
34
  keyName
35
35
  });
36
36
  if (child) return child;
37
- if (!isExpanded) return null;
37
+ if (!isExpanded || typeof value === 'object' && Object.keys(value).length == 0) return null;
38
38
  return /*#__PURE__*/_jsx(Elm, _extends({}, reset));
39
39
  };
40
40
  EllipsisComp.displayName = 'JVR.EllipsisComp';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type TagType } from '../store/Types';
3
2
  import { type SectionElement } from '../store/Section';
4
3
  import { type SectionElementResult } from '../store/Section';
@@ -29,7 +29,7 @@ export type InitialTypesState<T extends TagType = 'span'> = {
29
29
  type Dispatch<T extends TagType> = React.Dispatch<InitialTypesState<T>>;
30
30
  export declare const useTypesStore: () => InitialTypesState<TagType>;
31
31
  export declare function useTypes(): [{
32
- displayDataTypes?: boolean | undefined;
32
+ displayDataTypes?: boolean;
33
33
  Url?: TypesElement<TagType> | undefined;
34
34
  Str?: TypesElement<TagType> | undefined;
35
35
  Undefined?: TypesElement<TagType> | undefined;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type SymbolsElement } from '../store/Symbols';
3
2
  import { type TagType } from '../store/Types';
4
3
  export declare const Quote: {
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const basicTheme: import("react").CSSProperties;
1
+ export declare const basicTheme: React.CSSProperties;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const darkTheme: import("react").CSSProperties;
1
+ export declare const darkTheme: React.CSSProperties;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const githubDarkTheme: import("react").CSSProperties;
1
+ export declare const githubDarkTheme: React.CSSProperties;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const githubLightTheme: import("react").CSSProperties;
1
+ export declare const githubLightTheme: React.CSSProperties;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const gruvboxTheme: import("react").CSSProperties;
1
+ export declare const gruvboxTheme: React.CSSProperties;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const lightTheme: import("react").CSSProperties;
1
+ export declare const lightTheme: React.CSSProperties;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const monokaiTheme: import("react").CSSProperties;
1
+ export declare const monokaiTheme: React.CSSProperties;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const nordTheme: import("react").CSSProperties;
1
+ export declare const nordTheme: React.CSSProperties;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
- export declare const vscodeTheme: import("react").CSSProperties;
1
+ export declare const vscodeTheme: React.CSSProperties;
@@ -106,8 +106,8 @@ export var TypeString = _ref3 => {
106
106
  } = Str,
107
107
  reset = _objectWithoutPropertiesLoose(Str, _excluded3);
108
108
  var childrenStr = children;
109
- var [shorten, setShorten] = useState(length && childrenStr.length >= length);
110
- useEffect(() => setShorten(length && childrenStr.length >= length), [length]);
109
+ var [shorten, setShorten] = useState(length && childrenStr.length > length);
110
+ useEffect(() => setShorten(length && childrenStr.length > length), [length]);
111
111
  var Comp = as || 'span';
112
112
  var style = _extends({}, defalutStyle, Str.style || {});
113
113
  if (length > 0) {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare function usePrevious<T>(value: T): T | undefined;
3
2
  interface UseHighlight {
4
3
  value: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uiw/react-json-view",
3
- "version": "2.0.0-alpha.23",
3
+ "version": "2.0.0-alpha.25",
4
4
  "description": "JSON viewer for react.",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",