Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uiw/react-json-view

Package Overview
Dependencies
Maintainers
2
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uiw/react-json-view - npm Package Compare versions

Comparing version 1.11.1 to 1.12.0

2

cjs/node.d.ts

@@ -10,2 +10,4 @@ import { FC, PropsWithChildren } from 'react';

parentValue?: T;
isSet?: boolean;
isMap?: boolean;
namespace?: Array<string | number>;

@@ -12,0 +14,0 @@ setParentValue?: React.Dispatch<React.SetStateAction<T>>;

34

cjs/node.js

@@ -22,3 +22,3 @@ "use strict";

var _jsxRuntime = require("react/jsx-runtime");
var _excluded = ["value", "keyName", "className", "displayDataTypes", "components", "displayObjectSize", "enableClipboard", "highlightUpdates", "objectSortKeys", "indentWidth", "shortenTextAfterLength", "collapsed", "level", "keyid", "quotes", "namespace", "onCopied", "onExpand", "parentValue", "setParentValue"];
var _excluded = ["value", "keyName", "className", "displayDataTypes", "components", "displayObjectSize", "enableClipboard", "highlightUpdates", "objectSortKeys", "indentWidth", "shortenTextAfterLength", "collapsed", "level", "keyid", "quotes", "namespace", "isSet", "isMap", "onCopied", "onExpand", "parentValue", "setParentValue"];
function getLength(obj) {

@@ -76,2 +76,6 @@ try {

namespace = _props$namespace === void 0 ? [] : _props$namespace,
_props$isSet = props.isSet,
isSet = _props$isSet === void 0 ? false : _props$isSet,
_props$isMap = props.isMap,
isMap = _props$isMap === void 0 ? false : _props$isMap,
onCopied = props.onCopied,

@@ -225,2 +229,6 @@ onExpand = props.onExpand,

}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_value.Colon, {})]
}), isSet && /*#__PURE__*/(0, _jsxRuntime.jsx)(_value.Type, {
type: "Set"
}), isMap && /*#__PURE__*/(0, _jsxRuntime.jsx)(_value.Type, {
type: "Map"
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_meta.Meta, {

@@ -256,4 +264,7 @@ start: true,

var item = itemVal;
var isEmpty = Array.isArray(item) && item.length === 0 || (0, _typeof2["default"])(item) === 'object' && item && !(item instanceof Date) && Object.keys(item).length === 0;
if (Array.isArray(item) && !isEmpty) {
var isMySet = item instanceof Set;
var isMyMap = item instanceof Map;
var myValue = isMySet ? Array.from(item) : isMyMap ? Object.fromEntries(item) : item;
var isEmpty = Array.isArray(myValue) && myValue.length === 0 || (0, _typeof2["default"])(myValue) === 'object' && myValue && !(myValue instanceof Date) && Object.keys(myValue).length === 0;
if ((Array.isArray(myValue) || isMySet || isMyMap) && !isEmpty) {
var label = isArray ? idx : key;

@@ -263,3 +274,5 @@ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_value.Line, {

children: /*#__PURE__*/(0, _jsxRuntime.jsx)(RootNode, (0, _objectSpread2["default"])({
value: item,
value: myValue,
isSet: isMySet,
isMap: isMyMap,
namespace: [].concat((0, _toConsumableArray2["default"])(namespace), [label]),

@@ -271,7 +284,7 @@ keyName: label,

}
if ((0, _typeof2["default"])(item) === 'object' && item && !(item instanceof Date) && !isEmpty) {
if ((0, _typeof2["default"])(myValue) === 'object' && myValue && !(myValue instanceof Date) && !isEmpty) {
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_value.Line, {
className: "w-rjv-wrap",
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(RootNode, (0, _objectSpread2["default"])({
value: item,
value: myValue,
namespace: [].concat((0, _toConsumableArray2["default"])(namespace), [key]),

@@ -283,7 +296,7 @@ keyName: key,

}
if (typeof item === 'function') {
if (typeof myValue === 'function') {
return;
}
var renderKey = /*#__PURE__*/(0, _jsxRuntime.jsx)(_semicolon.Semicolon, {
value: item,
value: myValue,
"data-keys": keyid,

@@ -298,3 +311,3 @@ quotes: quotes,

});
var length = Array.isArray(item) ? item.length : getLength(item);
var length = Array.isArray(myValue) ? myValue.length : getLength(myValue);
countInfo = /*#__PURE__*/(0, _jsxRuntime.jsx)(CountInfo, {

@@ -317,3 +330,4 @@ children: length

keyName: key,
value: item
isSet: isSet,
value: myValue
}), idx);

@@ -320,0 +334,0 @@ })

@@ -38,2 +38,10 @@ import type { FC, PropsWithChildren } from 'react';

};
Set: {
color: string;
label: string;
};
Map: {
color: string;
label: string;
};
NaN: {

@@ -57,2 +65,3 @@ color: string;

enableClipboard: boolean;
isSet: boolean;
indentWidth: number;

@@ -69,3 +78,3 @@ level?: number;

export declare function getValueString<T>(value: T): {
type: "string" | "number" | "bigint" | "boolean" | "undefined" | "date" | "url" | "float" | "null" | "NaN";
type: "string" | "number" | "bigint" | "boolean" | "undefined" | "date" | "url" | "float" | "null" | "Set" | "Map" | "NaN";
content: string;

@@ -72,0 +81,0 @@ };

@@ -22,3 +22,3 @@ "use strict";

_excluded3 = ["color", "style", "isURL", "href", "children"],
_excluded4 = ["value", "parentValue", "setValue", "countInfo", "data", "keyName", "indentWidth", "namespace", "renderKey", "components", "quotes", "level", "enableClipboard", "displayObjectSize", "displayDataTypes", "shortenTextAfterLength"],
_excluded4 = ["value", "parentValue", "setValue", "countInfo", "data", "keyName", "indentWidth", "isSet", "namespace", "renderKey", "components", "quotes", "level", "enableClipboard", "displayObjectSize", "displayDataTypes", "shortenTextAfterLength"],
_excluded5 = ["children", "color", "fontSize", "opacity", "paddingRight", "style"];

@@ -67,2 +67,10 @@ var Line = function Line(props) {

},
Set: {
color: 'var(--w-rjv-type-set-color, #268bd2)',
label: 'Set'
},
Map: {
color: 'var(--w-rjv-type-map-color, #268bd2)',
label: 'Map'
},
NaN: {

@@ -151,3 +159,2 @@ color: 'var(--w-rjv-type-nan-color, #859900)',

var click = function click() {
console.log(shorten);
if (length && childrenStr.length <= length) return setShorten(false);

@@ -199,2 +206,3 @@ setShorten(!shorten);

indentWidth = props.indentWidth,
isSet = props.isSet,
namespace = props.namespace,

@@ -201,0 +209,0 @@ renderKey = props.renderKey,

@@ -10,2 +10,4 @@ import { FC, PropsWithChildren } from 'react';

parentValue?: T;
isSet?: boolean;
isMap?: boolean;
namespace?: Array<string | number>;

@@ -12,0 +14,0 @@ setParentValue?: React.Dispatch<React.SetStateAction<T>>;

import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["value", "keyName", "className", "displayDataTypes", "components", "displayObjectSize", "enableClipboard", "highlightUpdates", "objectSortKeys", "indentWidth", "shortenTextAfterLength", "collapsed", "level", "keyid", "quotes", "namespace", "onCopied", "onExpand", "parentValue", "setParentValue"];
var _excluded = ["value", "keyName", "className", "displayDataTypes", "components", "displayObjectSize", "enableClipboard", "highlightUpdates", "objectSortKeys", "indentWidth", "shortenTextAfterLength", "collapsed", "level", "keyid", "quotes", "namespace", "isSet", "isMap", "onCopied", "onExpand", "parentValue", "setParentValue"];
import { Fragment, useId, cloneElement, useState, useEffect, forwardRef } from 'react';
import { ValueView, Colon, Label, Line, typeMap } from './value';
import { ValueView, Type, Colon, Label, Line, typeMap } from './value';
import { TriangleArrow } from './arrow/TriangleArrow';

@@ -55,2 +55,4 @@ import { useExpandsStatus, store } from './store';

namespace = [],
isSet = false,
isMap = false,
onCopied,

@@ -185,2 +187,6 @@ onExpand,

}), /*#__PURE__*/_jsx(Colon, {})]
}), isSet && /*#__PURE__*/_jsx(Type, {
type: "Set"
}), isMap && /*#__PURE__*/_jsx(Type, {
type: "Map"
}), /*#__PURE__*/_jsx(Meta, {

@@ -214,4 +220,7 @@ start: true,

var item = itemVal;
var isEmpty = Array.isArray(item) && item.length === 0 || typeof item === 'object' && item && !(item instanceof Date) && Object.keys(item).length === 0;
if (Array.isArray(item) && !isEmpty) {
var isMySet = item instanceof Set;
var isMyMap = item instanceof Map;
var myValue = isMySet ? Array.from(item) : isMyMap ? Object.fromEntries(item) : item;
var isEmpty = Array.isArray(myValue) && myValue.length === 0 || typeof myValue === 'object' && myValue && !(myValue instanceof Date) && Object.keys(myValue).length === 0;
if ((Array.isArray(myValue) || isMySet || isMyMap) && !isEmpty) {
var label = isArray ? idx : key;

@@ -221,3 +230,5 @@ return /*#__PURE__*/_jsx(Line, {

children: /*#__PURE__*/_jsx(RootNode, _extends({
value: item,
value: myValue,
isSet: isMySet,
isMap: isMyMap,
namespace: [...namespace, label],

@@ -229,7 +240,7 @@ keyName: label,

}
if (typeof item === 'object' && item && !(item instanceof Date) && !isEmpty) {
if (typeof myValue === 'object' && myValue && !(myValue instanceof Date) && !isEmpty) {
return /*#__PURE__*/_jsx(Line, {
className: "w-rjv-wrap",
children: /*#__PURE__*/_jsx(RootNode, _extends({
value: item,
value: myValue,
namespace: [...namespace, key],

@@ -241,7 +252,7 @@ keyName: key,

}
if (typeof item === 'function') {
if (typeof myValue === 'function') {
return;
}
var renderKey = /*#__PURE__*/_jsx(Semicolon, {
value: item,
value: myValue,
"data-keys": keyid,

@@ -256,3 +267,3 @@ quotes: quotes,

});
var length = Array.isArray(item) ? item.length : getLength(item);
var length = Array.isArray(myValue) ? myValue.length : getLength(myValue);
countInfo = /*#__PURE__*/_jsx(CountInfo, {

@@ -275,3 +286,4 @@ children: length

keyName: key,
value: item
isSet: isSet,
value: myValue
}), idx);

@@ -278,0 +290,0 @@ })

@@ -38,2 +38,10 @@ import type { FC, PropsWithChildren } from 'react';

};
Set: {
color: string;
label: string;
};
Map: {
color: string;
label: string;
};
NaN: {

@@ -57,2 +65,3 @@ color: string;

enableClipboard: boolean;
isSet: boolean;
indentWidth: number;

@@ -69,3 +78,3 @@ level?: number;

export declare function getValueString<T>(value: T): {
type: "string" | "number" | "bigint" | "boolean" | "undefined" | "date" | "url" | "float" | "null" | "NaN";
type: "string" | "number" | "bigint" | "boolean" | "undefined" | "date" | "url" | "float" | "null" | "Set" | "Map" | "NaN";
content: string;

@@ -72,0 +81,0 @@ };

@@ -6,3 +6,3 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";

_excluded3 = ["color", "style", "isURL", "href", "children"],
_excluded4 = ["value", "parentValue", "setValue", "countInfo", "data", "keyName", "indentWidth", "namespace", "renderKey", "components", "quotes", "level", "enableClipboard", "displayObjectSize", "displayDataTypes", "shortenTextAfterLength"],
_excluded4 = ["value", "parentValue", "setValue", "countInfo", "data", "keyName", "indentWidth", "isSet", "namespace", "renderKey", "components", "quotes", "level", "enableClipboard", "displayObjectSize", "displayDataTypes", "shortenTextAfterLength"],
_excluded5 = ["children", "color", "fontSize", "opacity", "paddingRight", "style"];

@@ -50,2 +50,10 @@ import { Fragment, forwardRef, useMemo, useState } from 'react';

},
Set: {
color: 'var(--w-rjv-type-set-color, #268bd2)',
label: 'Set'
},
Map: {
color: 'var(--w-rjv-type-map-color, #268bd2)',
label: 'Map'
},
NaN: {

@@ -132,3 +140,2 @@ color: 'var(--w-rjv-type-nan-color, #859900)',

var click = () => {
console.log(shorten);
if (length && childrenStr.length <= length) return setShorten(false);

@@ -135,0 +142,0 @@ setShorten(!shorten);

{
"name": "@uiw/react-json-view",
"version": "1.11.1",
"version": "1.12.0",
"description": "JSON viewer for react.",

@@ -5,0 +5,0 @@ "main": "cjs/index.js",

@@ -232,5 +232,7 @@ react-json-view

'--w-rjv-type-url-color': '#0969da',
'--w-rjv-type-null-color': '#d33682',
'--w-rjv-type-nan-color': '#859900',
'--w-rjv-type-undefined-color': '#586e75',
'--w-rjv-type-null-color': '#d33682',
'--w-rjv-type-set-color': '#268bd2',
'--w-rjv-type-map-color': '#268bd2',
};

@@ -237,0 +239,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc