@devtools-ds/object-inspector
Advanced tools
Comparing version
@@ -0,1 +1,14 @@ | ||
# v1.0.3 (Thu Feb 25 2021) | ||
#### 🐛 Bug Fix | ||
- Perf: Better Tree Shaking [#16](https://github.com/intuit/devtools-ds/pull/16) ([@tylerkrupicka](https://github.com/tylerkrupicka)) | ||
- remove node buffer type ([@tylerkrupicka](https://github.com/tylerkrupicka)) | ||
#### Authors: 1 | ||
- Tyler Krupicka ([@tylerkrupicka](https://github.com/tylerkrupicka)) | ||
--- | ||
# v1.0.2 (Mon Feb 15 2021) | ||
@@ -2,0 +15,0 @@ |
@@ -1,1 +0,1 @@ | ||
module.exports = {"object-inspector":"ObjectInspector-object-inspector-0194dd9","objectInspector":"ObjectInspector-object-inspector-0194dd9","object-label":"ObjectInspector-object-label-83a3526","objectLabel":"ObjectInspector-object-label-83a3526","text":"ObjectInspector-text-60b11d4","key":"ObjectInspector-key-65e510c","value":"ObjectInspector-value-c07cce8","string":"ObjectInspector-string-b856b48","regex":"ObjectInspector-regex-6acf76a","error":"ObjectInspector-error-01c50f8","boolean":"ObjectInspector-boolean-d795a2a","number":"ObjectInspector-number-a942de5","undefined":"ObjectInspector-undefined-2e65ed7","null":"ObjectInspector-null-1558dc1","function":"ObjectInspector-function-915596c","function-decorator":"ObjectInspector-function-decorator-29e473e","functionDecorator":"ObjectInspector-function-decorator-29e473e","prototype":"ObjectInspector-prototype-727c5b3","dark":"ObjectInspector-dark-e44a435","chrome":"ObjectInspector-chrome-a92272d","light":"ObjectInspector-light-f4f1567"}; | ||
module.exports = {"object-inspector":"ObjectInspector-object-inspector-91724ce","objectInspector":"ObjectInspector-object-inspector-91724ce","object-label":"ObjectInspector-object-label-03a51ac","objectLabel":"ObjectInspector-object-label-03a51ac","text":"ObjectInspector-text-aa5d378","key":"ObjectInspector-key-2d6607b","value":"ObjectInspector-value-e33be26","string":"ObjectInspector-string-77023a6","regex":"ObjectInspector-regex-9c96da7","error":"ObjectInspector-error-3696207","boolean":"ObjectInspector-boolean-2e3399a","number":"ObjectInspector-number-00715e0","undefined":"ObjectInspector-undefined-b4999c0","null":"ObjectInspector-null-2a2f6f9","function":"ObjectInspector-function-a48370b","function-decorator":"ObjectInspector-function-decorator-d05446f","functionDecorator":"ObjectInspector-function-decorator-d05446f","prototype":"ObjectInspector-prototype-c76b385","dark":"ObjectInspector-dark-a284888","chrome":"ObjectInspector-chrome-147ce5b","light":"ObjectInspector-light-fc287d9"}; |
@@ -1,2 +0,2 @@ | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard");var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.ObjectValue=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _clsx=_interopRequireDefault(require("clsx"));var _themes=require("@devtools-ds/themes");var _objectParser=require("@devtools-ds/object-parser");var _ObjectInspector=_interopRequireDefault(require("./ObjectInspector.css"));const buildValue=(key,value,valueClass,showKey,depth)=>{const computedKey=key.includes("-")?`"${key}"`:key;const isRoot=depth<=0;return _react.default.createElement("span",{className:_ObjectInspector.default.text},!isRoot&&showKey&&_react.default.createElement(_react.default.Fragment,null,_react.default.createElement("span",{className:_ObjectInspector.default.key},computedKey),_react.default.createElement("span",null,":\xA0")),_react.default.createElement("span",{className:valueClass},value))};const ObjectValue=props=>{const{ast,theme,showKey,colorScheme,className}=props,html=(0,_objectWithoutProperties2.default)(props,["ast","theme","showKey","colorScheme","className"]);const{themeClass}=(0,_themes.useTheme)({theme,colorScheme},_ObjectInspector.default);const[asyncValue,setAsyncValue]=(0,_react.useState)(_react.default.createElement("span",null));let value=_react.default.createElement("span",null);(0,_react.useEffect)(()=>{if(ast.value instanceof Promise){const waitForPromiseResult=async promise=>{setAsyncValue(buildValue(ast.key,`Promise { "${await(0,_objectParser.getPromiseState)(promise)}" }`,_ObjectInspector.default.key,showKey,ast.depth))};waitForPromiseResult(ast.value)}},[ast,showKey]);if(typeof ast.value==="number"||typeof ast.value==="bigint"){value=buildValue(ast.key,String(ast.value),_ObjectInspector.default.number,showKey,ast.depth)}else if(typeof ast.value==="boolean"){value=buildValue(ast.key,String(ast.value),_ObjectInspector.default.boolean,showKey,ast.depth)}else if(typeof ast.value==="string"){value=buildValue(ast.key,`"${ast.value}"`,_ObjectInspector.default.string,showKey,ast.depth)}else if(typeof ast.value==="undefined"){value=buildValue(ast.key,"undefined",_ObjectInspector.default.undefined,showKey,ast.depth)}else if(typeof ast.value==="symbol"){value=buildValue(ast.key,ast.value.toString(),_ObjectInspector.default.string,showKey,ast.depth)}else if(typeof ast.value==="function"){value=buildValue(ast.key,`${ast.value.name}()`,_ObjectInspector.default.key,showKey,ast.depth)}else if(typeof ast.value==="object"){if(ast.value===null){value=buildValue(ast.key,"null",_ObjectInspector.default.null,showKey,ast.depth)}else if(Array.isArray(ast.value)){value=buildValue(ast.key,`Array(${ast.value.length})`,_ObjectInspector.default.key,showKey,ast.depth)}else if(ast.value instanceof Date){value=buildValue(ast.key,`Date ${ast.value.toString()}`,_ObjectInspector.default.value,showKey,ast.depth)}else if(ast.value instanceof RegExp){value=buildValue(ast.key,ast.value.toString(),_ObjectInspector.default.regex,showKey,ast.depth)}else if(ast.value instanceof Error){value=buildValue(ast.key,ast.value.toString(),_ObjectInspector.default.error,showKey,ast.depth)}else if(typeof Buffer!=="undefined"&&Buffer.isBuffer(ast.value)){value=buildValue(ast.key,`Buffer[${ast.value.length}]`,_ObjectInspector.default.value,showKey,ast.depth)}else if((0,_objectParser.isObject)(ast.value)){value=buildValue(ast.key,"{\u2026}",_ObjectInspector.default.key,showKey,ast.depth)}else{value=buildValue(ast.key,ast.value.constructor.name,_ObjectInspector.default.key,showKey,ast.depth)}}return _react.default.createElement("span",(0,_extends2.default)({className:(0,_clsx.default)(themeClass,className)},html),asyncValue,value)};exports.ObjectValue=ObjectValue;ObjectValue.defaultProps={showKey:true};var _default=ObjectValue;exports.default=_default; | ||
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard");var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.ObjectValue=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _clsx=_interopRequireDefault(require("clsx"));var _themes=require("@devtools-ds/themes");var _objectParser=require("@devtools-ds/object-parser");var _ObjectInspector=_interopRequireDefault(require("./ObjectInspector.css"));const buildValue=(key,value,valueClass,showKey,depth)=>{const computedKey=key.includes("-")?`"${key}"`:key;const isRoot=depth<=0;return _react.default.createElement("span",{className:_ObjectInspector.default.text},!isRoot&&showKey&&_react.default.createElement(_react.default.Fragment,null,_react.default.createElement("span",{className:_ObjectInspector.default.key},computedKey),_react.default.createElement("span",null,":\xA0")),_react.default.createElement("span",{className:valueClass},value))};const ObjectValue=props=>{const{ast,theme,showKey,colorScheme,className}=props,html=(0,_objectWithoutProperties2.default)(props,["ast","theme","showKey","colorScheme","className"]);const{themeClass}=(0,_themes.useTheme)({theme,colorScheme},_ObjectInspector.default);const[asyncValue,setAsyncValue]=(0,_react.useState)(_react.default.createElement("span",null));let value=_react.default.createElement("span",null);(0,_react.useEffect)(()=>{if(ast.value instanceof Promise){const waitForPromiseResult=async promise=>{setAsyncValue(buildValue(ast.key,`Promise { "${await(0,_objectParser.getPromiseState)(promise)}" }`,_ObjectInspector.default.key,showKey,ast.depth))};waitForPromiseResult(ast.value)}},[ast,showKey]);if(typeof ast.value==="number"||typeof ast.value==="bigint"){value=buildValue(ast.key,String(ast.value),_ObjectInspector.default.number,showKey,ast.depth)}else if(typeof ast.value==="boolean"){value=buildValue(ast.key,String(ast.value),_ObjectInspector.default.boolean,showKey,ast.depth)}else if(typeof ast.value==="string"){value=buildValue(ast.key,`"${ast.value}"`,_ObjectInspector.default.string,showKey,ast.depth)}else if(typeof ast.value==="undefined"){value=buildValue(ast.key,"undefined",_ObjectInspector.default.undefined,showKey,ast.depth)}else if(typeof ast.value==="symbol"){value=buildValue(ast.key,ast.value.toString(),_ObjectInspector.default.string,showKey,ast.depth)}else if(typeof ast.value==="function"){value=buildValue(ast.key,`${ast.value.name}()`,_ObjectInspector.default.key,showKey,ast.depth)}else if(typeof ast.value==="object"){if(ast.value===null){value=buildValue(ast.key,"null",_ObjectInspector.default.null,showKey,ast.depth)}else if(Array.isArray(ast.value)){value=buildValue(ast.key,`Array(${ast.value.length})`,_ObjectInspector.default.key,showKey,ast.depth)}else if(ast.value instanceof Date){value=buildValue(ast.key,`Date ${ast.value.toString()}`,_ObjectInspector.default.value,showKey,ast.depth)}else if(ast.value instanceof RegExp){value=buildValue(ast.key,ast.value.toString(),_ObjectInspector.default.regex,showKey,ast.depth)}else if(ast.value instanceof Error){value=buildValue(ast.key,ast.value.toString(),_ObjectInspector.default.error,showKey,ast.depth)}else if((0,_objectParser.isObject)(ast.value)){value=buildValue(ast.key,"{\u2026}",_ObjectInspector.default.key,showKey,ast.depth)}else{value=buildValue(ast.key,ast.value.constructor.name,_ObjectInspector.default.key,showKey,ast.depth)}}return _react.default.createElement("span",(0,_extends2.default)({className:(0,_clsx.default)(themeClass,className)},html),asyncValue,value)};exports.ObjectValue=ObjectValue;ObjectValue.defaultProps={showKey:true};var _default=ObjectValue;exports.default=_default; | ||
//# sourceMappingURL=ObjectValue.js.map |
@@ -1,1 +0,1 @@ | ||
module.exports = {"object-inspector":"ObjectInspector-object-inspector-0194dd9","objectInspector":"ObjectInspector-object-inspector-0194dd9","object-label":"ObjectInspector-object-label-83a3526","objectLabel":"ObjectInspector-object-label-83a3526","text":"ObjectInspector-text-60b11d4","key":"ObjectInspector-key-65e510c","value":"ObjectInspector-value-c07cce8","string":"ObjectInspector-string-b856b48","regex":"ObjectInspector-regex-6acf76a","error":"ObjectInspector-error-01c50f8","boolean":"ObjectInspector-boolean-d795a2a","number":"ObjectInspector-number-a942de5","undefined":"ObjectInspector-undefined-2e65ed7","null":"ObjectInspector-null-1558dc1","function":"ObjectInspector-function-915596c","function-decorator":"ObjectInspector-function-decorator-29e473e","functionDecorator":"ObjectInspector-function-decorator-29e473e","prototype":"ObjectInspector-prototype-727c5b3","dark":"ObjectInspector-dark-e44a435","chrome":"ObjectInspector-chrome-a92272d","light":"ObjectInspector-light-f4f1567"}; | ||
module.exports = {"object-inspector":"ObjectInspector-object-inspector-91724ce","objectInspector":"ObjectInspector-object-inspector-91724ce","object-label":"ObjectInspector-object-label-03a51ac","objectLabel":"ObjectInspector-object-label-03a51ac","text":"ObjectInspector-text-aa5d378","key":"ObjectInspector-key-2d6607b","value":"ObjectInspector-value-e33be26","string":"ObjectInspector-string-77023a6","regex":"ObjectInspector-regex-9c96da7","error":"ObjectInspector-error-3696207","boolean":"ObjectInspector-boolean-2e3399a","number":"ObjectInspector-number-00715e0","undefined":"ObjectInspector-undefined-b4999c0","null":"ObjectInspector-null-2a2f6f9","function":"ObjectInspector-function-a48370b","function-decorator":"ObjectInspector-function-decorator-d05446f","functionDecorator":"ObjectInspector-function-decorator-d05446f","prototype":"ObjectInspector-prototype-c76b385","dark":"ObjectInspector-dark-a284888","chrome":"ObjectInspector-chrome-147ce5b","light":"ObjectInspector-light-fc287d9"}; |
@@ -1,2 +0,2 @@ | ||
import _extends from"@babel/runtime/helpers/extends";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import React,{useState,useEffect}from"react";import makeClass from"clsx";import{useTheme}from"@devtools-ds/themes";import{isObject,getPromiseState}from"@devtools-ds/object-parser";import styles from"./ObjectInspector.css";const buildValue=(key,value,valueClass,showKey,depth)=>{const computedKey=key.includes("-")?`"${key}"`:key;const isRoot=depth<=0;return React.createElement("span",{className:styles.text},!isRoot&&showKey&&React.createElement(React.Fragment,null,React.createElement("span",{className:styles.key},computedKey),React.createElement("span",null,":\xA0")),React.createElement("span",{className:valueClass},value))};export const ObjectValue=props=>{const{ast,theme,showKey,colorScheme,className}=props,html=_objectWithoutProperties(props,["ast","theme","showKey","colorScheme","className"]);const{themeClass}=useTheme({theme,colorScheme},styles);const[asyncValue,setAsyncValue]=useState(React.createElement("span",null));let value=React.createElement("span",null);useEffect(()=>{if(ast.value instanceof Promise){const waitForPromiseResult=async promise=>{setAsyncValue(buildValue(ast.key,`Promise { "${await getPromiseState(promise)}" }`,styles.key,showKey,ast.depth))};waitForPromiseResult(ast.value)}},[ast,showKey]);if(typeof ast.value==="number"||typeof ast.value==="bigint"){value=buildValue(ast.key,String(ast.value),styles.number,showKey,ast.depth)}else if(typeof ast.value==="boolean"){value=buildValue(ast.key,String(ast.value),styles.boolean,showKey,ast.depth)}else if(typeof ast.value==="string"){value=buildValue(ast.key,`"${ast.value}"`,styles.string,showKey,ast.depth)}else if(typeof ast.value==="undefined"){value=buildValue(ast.key,"undefined",styles.undefined,showKey,ast.depth)}else if(typeof ast.value==="symbol"){value=buildValue(ast.key,ast.value.toString(),styles.string,showKey,ast.depth)}else if(typeof ast.value==="function"){value=buildValue(ast.key,`${ast.value.name}()`,styles.key,showKey,ast.depth)}else if(typeof ast.value==="object"){if(ast.value===null){value=buildValue(ast.key,"null",styles.null,showKey,ast.depth)}else if(Array.isArray(ast.value)){value=buildValue(ast.key,`Array(${ast.value.length})`,styles.key,showKey,ast.depth)}else if(ast.value instanceof Date){value=buildValue(ast.key,`Date ${ast.value.toString()}`,styles.value,showKey,ast.depth)}else if(ast.value instanceof RegExp){value=buildValue(ast.key,ast.value.toString(),styles.regex,showKey,ast.depth)}else if(ast.value instanceof Error){value=buildValue(ast.key,ast.value.toString(),styles.error,showKey,ast.depth)}else if(typeof Buffer!=="undefined"&&Buffer.isBuffer(ast.value)){value=buildValue(ast.key,`Buffer[${ast.value.length}]`,styles.value,showKey,ast.depth)}else if(isObject(ast.value)){value=buildValue(ast.key,"{\u2026}",styles.key,showKey,ast.depth)}else{value=buildValue(ast.key,ast.value.constructor.name,styles.key,showKey,ast.depth)}}return React.createElement("span",_extends({className:makeClass(themeClass,className)},html),asyncValue,value)};ObjectValue.defaultProps={showKey:true};export default ObjectValue; | ||
import _extends from"@babel/runtime/helpers/extends";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import React,{useState,useEffect}from"react";import makeClass from"clsx";import{useTheme}from"@devtools-ds/themes";import{isObject,getPromiseState}from"@devtools-ds/object-parser";import styles from"./ObjectInspector.css";const buildValue=(key,value,valueClass,showKey,depth)=>{const computedKey=key.includes("-")?`"${key}"`:key;const isRoot=depth<=0;return React.createElement("span",{className:styles.text},!isRoot&&showKey&&React.createElement(React.Fragment,null,React.createElement("span",{className:styles.key},computedKey),React.createElement("span",null,":\xA0")),React.createElement("span",{className:valueClass},value))};export const ObjectValue=props=>{const{ast,theme,showKey,colorScheme,className}=props,html=_objectWithoutProperties(props,["ast","theme","showKey","colorScheme","className"]);const{themeClass}=useTheme({theme,colorScheme},styles);const[asyncValue,setAsyncValue]=useState(React.createElement("span",null));let value=React.createElement("span",null);useEffect(()=>{if(ast.value instanceof Promise){const waitForPromiseResult=async promise=>{setAsyncValue(buildValue(ast.key,`Promise { "${await getPromiseState(promise)}" }`,styles.key,showKey,ast.depth))};waitForPromiseResult(ast.value)}},[ast,showKey]);if(typeof ast.value==="number"||typeof ast.value==="bigint"){value=buildValue(ast.key,String(ast.value),styles.number,showKey,ast.depth)}else if(typeof ast.value==="boolean"){value=buildValue(ast.key,String(ast.value),styles.boolean,showKey,ast.depth)}else if(typeof ast.value==="string"){value=buildValue(ast.key,`"${ast.value}"`,styles.string,showKey,ast.depth)}else if(typeof ast.value==="undefined"){value=buildValue(ast.key,"undefined",styles.undefined,showKey,ast.depth)}else if(typeof ast.value==="symbol"){value=buildValue(ast.key,ast.value.toString(),styles.string,showKey,ast.depth)}else if(typeof ast.value==="function"){value=buildValue(ast.key,`${ast.value.name}()`,styles.key,showKey,ast.depth)}else if(typeof ast.value==="object"){if(ast.value===null){value=buildValue(ast.key,"null",styles.null,showKey,ast.depth)}else if(Array.isArray(ast.value)){value=buildValue(ast.key,`Array(${ast.value.length})`,styles.key,showKey,ast.depth)}else if(ast.value instanceof Date){value=buildValue(ast.key,`Date ${ast.value.toString()}`,styles.value,showKey,ast.depth)}else if(ast.value instanceof RegExp){value=buildValue(ast.key,ast.value.toString(),styles.regex,showKey,ast.depth)}else if(ast.value instanceof Error){value=buildValue(ast.key,ast.value.toString(),styles.error,showKey,ast.depth)}else if(isObject(ast.value)){value=buildValue(ast.key,"{\u2026}",styles.key,showKey,ast.depth)}else{value=buildValue(ast.key,ast.value.constructor.name,styles.key,showKey,ast.depth)}}return React.createElement("span",_extends({className:makeClass(themeClass,className)},html),asyncValue,value)};ObjectValue.defaultProps={showKey:true};export default ObjectValue; | ||
//# sourceMappingURL=ObjectValue.js.map |
{ | ||
"name": "@devtools-ds/object-inspector", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "./dist/cjs/index.js", | ||
@@ -33,5 +33,5 @@ "module": "./dist/esm/index.js", | ||
"@babel/runtime": "7.7.2", | ||
"@devtools-ds/object-parser": "^1.0.2", | ||
"@devtools-ds/themes": "^1.0.2", | ||
"@devtools-ds/tree": "^1.0.2", | ||
"@devtools-ds/object-parser": "^1.0.3", | ||
"@devtools-ds/themes": "^1.0.3", | ||
"@devtools-ds/tree": "^1.0.3", | ||
"clsx": "1.1.0" | ||
@@ -51,3 +51,3 @@ }, | ||
], | ||
"gitHead": "9ea5caf9695fa50ed1ecf64ea954fb76f8cbe4f0" | ||
"gitHead": "e4e49d74fd3cc5ba43ab7bf718598fe4f98e2720" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
133991
-0.94%1112
-0.89%Updated
Updated