This commit is contained in:
2024-03-22 03:47:51 +05:30
parent 8bcf3d211e
commit 89819f6fe2
28440 changed files with 3211033 additions and 2 deletions

74
node_modules/react-json-view-lite/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,74 @@
## 1.3.0
### New Feature
- [New style parameter for not adding double quotes to rendered strings](https://github.com/AnyRoad/react-json-view-lite/issues/22)
## 1.2.1
### Bug Fixes
- [Fixed](https://github.com/AnyRoad/react-json-view-lite/issues/20) component didn't work with React 16 and React 17
## 1.2.0
### New Feature
- [Improved accessibility support](https://github.com/AnyRoad/react-json-view-lite/pull/16)
## 1.1.0
### New Feature
- [Render Date as an ISO-formatted string](https://github.com/AnyRoad/react-json-view-lite/pull/13)
## 1.0.1
### Bug Fixes
- [Fixed](https://github.com/AnyRoad/react-json-view-lite/pull/14) collapse/expand button style
## 1.0.0
### Breaking changes
1. Property `shouldInitiallyExpand` has different name `shouldExpandNode` in order to emphasize that it will be called every time properties change.
2. If you use custom styles:
- `pointer` and `expander` are no longer used
- component uses `collapseIcon`, `expandIcon`, `collapsedContent` styles in order to customize expand/collapse icon and collpased content placeholder which were previously hardcode to the `▸`, `▾` and `...`.
Default style values use `::after` pseudo-classes to set the content.
## 0.9.8
### Bug Fixes
- Fixed [bug when empty object key was not rendered correctly](https://github.com/AnyRoad/react-json-view-lite/issues/9)
## 0.9.7
### New Features
- Added [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) rendering support
## 0.9.6
### Bug Fixes
- Fixed css style for comma after primitive type value
## 0.9.5
### New Features
- Added minimum a11y support
- Added React 18 to peer dependencies
- Updated dev dependencies versions
- Added storybook
## 0.9.4
### New Features
- Added ability to expand arrays and nested objects by clicking on the `...` part
- Added `allExpanded` and `collapseAllNested` exported functions which can be used for the `shouldInitiallyExpand` property
- Added new separate style for the "pointer" which applied for `▸`, `▾` and `...`

149
node_modules/react-json-view-lite/README.md generated vendored Normal file
View File

@@ -0,0 +1,149 @@
<div align="center">
<a href="https://npmjs.org/package/react-json-view-lite">
<img alt="npm" src="https://img.shields.io/npm/v/react-json-view-lite.svg" />
</a>
<a href="https://npmjs.org/package/react-json-view-lite">
<img alt="no dependencies" src="https://badgen.net/bundlephobia/dependency-count/react-json-view-lite" />
</a>
<a href="https://npmjs.org/package/react-json-view-lite">
<img alt="size" src="https://badgen.net/bundlephobia/minzip/react-json-view-lite" />
</a>
<a href="https://travis-ci.com/github/AnyRoad/react-json-view-lite">
<img alt="build" src="https://travis-ci.com/AnyRoad/react-json-view-lite.svg?branch=release" />
</a>
<a href="https://codecov.io/gh/anyroad/react-json-view-lite">
<img alt="coverage" src="https://codecov.io/gh/AnyRoad/react-json-view-lite/branch/release/graph/badge.svg" />
</a>
<a href="https://bundlephobia.com/result?p=react-json-view-lite">
<img alt="tree-shakeable" src="https://badgen.net/bundlephobia/tree-shaking/react-json-view-lite" />
</a>
<a href="https://npmjs.org/package/react-json-view-lite">
<img alt="types included" src="https://badgen.net/npm/types/react-json-view-lite" />
</a>
<a href="https://npmjs.org/package/react-json-view-lite">
<img alt="downloads per month" src="https://img.shields.io/npm/dm/react-json-view-lite" />
</a>
</div>
<div>
<strong>react-json-view-lite</strong> is a tiny component for React allowing to render JSON as a tree. It focused on the balance between performance for large JSON inputs and functionality. It might not have all the rich features (suce as customization, copy, json editinng) but still provides more than just rendering json with highlighting - e.g. ability to collapse/expand nested objects and override css. It is written in TypeScript and has no dependencies.
</div>
## Install
```bash
npm install --save react-json-view-lite
```
## Migration from the 0.9.x versions
1. Property `shouldInitiallyExpand` has different name `shouldExpandNode` in order to emphasize that it will be called every time properties change.
2. If you use custom styles:
- `pointer` and `expander` are no longer used
- component uses `collapseIcon`, `expandIcon`, `collapsedContent` styles in order to customize expand/collapse icon and collpased content placeholder which were previously hardcode to the `▸`, `▾` and `...`.
Default style values use `::after` pseudo-classes to set the content.
## Usage
```tsx
import * as React from 'react';
import { JsonView, allExpanded, darkStyles, defaultStyles } from 'react-json-view-lite';
import 'react-json-view-lite/dist/index.css';
const json = {
a: 1,
b: 'example'
};
const App = () => {
return (
<React.Fragment>
<JsonView data={json} shouldExpandNode={allExpanded} style={defaultStyles} />
<JsonView data={json} shouldExpandNode={allExpanded} style={darkStyles} />
</React.Fragment>
);
};
export default App;
```
Please note that in JavaScript, an anonymous function like `function() {}` or `() => {}` always creates a different function every time component is rendered, so you might need to use
[useCallback](https://react.dev/reference/react/useCallback) React Hook for the `shouldExpandNode` parameter or extract the function outside the functional component.
### StoryBook
https://anyroad.github.io/react-json-view-lite/
### Props
| Name | Type | Default Value | Description |
| ---------------- | -------------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| data | `Object` \| `Array<any>` | | Data which should be rendered |
| style | StyleProps | defaultStyles | Optional. CSS classes for rendering. Library provides two build-in implementations: `darkStyles`, `defaultStyles` (see below) |
| shouldExpandNode | `(level: number, value: any, field?: string) => boolean` | allExpanded | Optional. Function which will be called during initial rendering for each Object and Array of the data in order to calculate should if this node be expanded. **Note** that this function will be called again to update the each node state once the property value changed. `level` startes from `0`, `field` does not have a value for the array element. Library provides two build-in implementations: `allExpanded` and `collapseAllNested` (see below) |
### Extra exported
| Name | Type | Description |
| ----------------- | ---------------------------- | --------------------------------------------------- |
| defaultStyles | StyleProps | Default styles for light background |
| darkStyles | StyleProps | Default styles for dark background |
| allExpanded | `() => boolean` | Always returns `true` |
| collapseAllNested | `(level: number) => boolean` | Returns `true` only for the first level (`level=0`) |
### StyleProps
| Name | Type | Description |
| ----------------------- | ------- | ----------------------------------------------------------------------------------------------------------------- |
| container | string | CSS class name for rendering parent block |
| basicChildStyle | string | CSS class name for property block containing property name and value |
| collapseIcon | string | CSS class name for rendering button collapsing Object and Array nodes. Default content is `▾`. |
| expandIcon | string | CSS class name for rendering button expanding Object and Array nodes. Default content is `▸`. |
| collapsedContent | string | CSS class name for rendering placeholder when Object and Array nodes are collapsed. Default contents is `...`. |
| label | string | CSS class name for rendering property names |
| nullValue | string | CSS class name for rendering null values |
| undefinedValue | string | CSS class name for rendering undefined values |
| numberValue | string | CSS class name for rendering numeric values |
| stringValue | string | CSS class name for rendering string values |
| booleanValue | string | CSS class name for rendering boolean values |
| otherValue | string | CSS class name for rendering all other values except Object, Arrray, null, undefined, numeric, boolean and string |
| punctuation | string | CSS class name for rendering `,`, `[`, `]`, `{`, `}` |
| noQuotesForStringValues | boolean | whether or not to add double quotes when rendering string values, default value is `false` |
## Comparison with other libraries
### Size and dependencies
Here is the size benchmark (using [bundlephobia.com](https://bundlephobia.com)) against similar React libraries (found by https://www.npmjs.com/search?q=react%20json&ranking=popularity):
| Library | Bundle size | Bundle size (gzip) | Dependencies |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **react-json-view-lite** | [![](https://badgen.net/bundlephobia/min/react-json-view-lite?color=6ead0a&label=)](https://bundlephobia.com/result?p=react-json-view-lite) | [![](https://badgen.net/bundlephobia/minzip/react-json-view-lite?color=6ead0a&label=)](https://bundlephobia.com/result?p=react-json-view-lite) | [![](https://badgen.net/bundlephobia/dependency-count/react-json-view-lite?color=6ead0a&label=)](https://bundlephobia.com/result?p=react-json-view-lite) |
| react-json-pretty | [![](https://badgen.net/bundlephobia/min/react-json-pretty?color=red&label=)](https://bundlephobia.com/result?p=react-json-pretty) | [![](https://badgen.net/bundlephobia/minzip/react-json-pretty?color=red&label=)](https://bundlephobia.com/result?p=react-json-pretty) | [![](https://badgen.net/bundlephobia/dependency-count/react-json-pretty?color=red&label=)](https://bundlephobia.com/result?p=react-json-pretty) |
| react-json-inspector | [![](https://badgen.net/bundlephobia/min/react-json-inspector?color=red&label=)](https://bundlephobia.com/result?p=react-json-inspector) | [![](https://badgen.net/bundlephobia/minzip/react-json-inspector?color=red&label=)](https://bundlephobia.com/result?p=react-json-inspector) | [![](https://badgen.net/bundlephobia/dependency-count/react-json-inspector?color=red&label=)](https://bundlephobia.com/result?p=react-json-inspector) |
| react-json-tree | [![](https://badgen.net/bundlephobia/min/react-json-tree?color=red&label=)](https://bundlephobia.com/result?p=react-json-tree) | [![](https://badgen.net/bundlephobia/minzip/react-json-tree?color=red&label=)](https://bundlephobia.com/result?p=react-json-tree) | [![](https://badgen.net/bundlephobia/dependency-count/react-json-tree?color=red&label=)](https://bundlephobia.com/result?p=react-json-tree) |
| react-json-view | [![](https://badgen.net/bundlephobia/min/react-json-view?color=red&label=)](https://bundlephobia.com/result?p=react-json-view) | [![](https://badgen.net/bundlephobia/minzip/react-json-view?color=red&label=)](https://bundlephobia.com/result?p=react-json-view) | [![](https://badgen.net/bundlephobia/dependency-count/react-json-view?color=red&label=)](https://bundlephobia.com/result?p=react-json-view) |
| react-json-tree-viewer | [![](https://badgen.net/bundlephobia/min/react-json-tree-viewer?color=red&label=)](https://bundlephobia.com/result?p=react-json-tree-viewer) | [![](https://badgen.net/bundlephobia/minzip/react-json-tree-viewer?color=red&label=)](https://bundlephobia.com/result?p=react-json-tree-viewer) | [![](https://badgen.net/bundlephobia/dependency-count/react-json-tree-viewer?color=red&label=)](https://bundlephobia.com/result?p=react-json-tree-viewer) |
### Performance
Performance was mesaured using the [react-component-benchmark](https://github.com/paularmstrong/react-component-benchmark) library. Every component was rendered 50 times using the [300Kb json file](https://github.com/AnyRoad/react-json-view-lite-benchmark/blob/main/src/hugeJson.json) as data source, please refer to source code of the [benchmark project](https://github.com/AnyRoad/react-json-view-lite-benchmark).
All numbers are in milliseconds. Tests were performed on Macbook Air M1 16Gb RAM usging Chrome v96.0.4664.110(official build, arm64). Every component was tested 2 times but there was no significant differences in the results.
| Library | Min | Max | Average | Median | P90 |
| ------------------------ | ----- | ----- | ------- | ------ | ----- |
| **react-json-view-lite** | 81 | 604 | 195 | 82 | 582 |
| react-json-pretty | 22 | 59 | 32 | 24 | 56 |
| react-json-inspector | 682 | 1 109 | 758 | 711 | 905 |
| react-json-tree | 565 | 1 217 | 658 | 620 | 741 |
| react-json-view | 1 403 | 1 722 | 1529 | 1 540 | 1 631 |
| react-json-tree-viewer | 266 | 663 | 320 | 278 | 455 |
As you can see `react-json-pretty` renders faster than other libraries but it does not have ability to collapse/expand nested objects so it might be good choice if you need just json syntax highlighting.
## License
MIT © [AnyRoad](https://github.com/AnyRoad)

View File

@@ -0,0 +1,37 @@
import * as React from 'react';
export interface StyleProps {
container: string;
basicChildStyle: string;
label: string;
nullValue: string;
undefinedValue: string;
numberValue: string;
stringValue: string;
booleanValue: string;
otherValue: string;
punctuation: string;
expandIcon: string;
collapseIcon: string;
collapsedContent: string;
noQuotesForStringValues: boolean;
}
export interface JsonRenderProps<T> {
field?: string;
value: T;
lastElement: boolean;
level: number;
style: StyleProps;
shouldExpandNode: (level: number, value: any, field?: string) => boolean;
}
export interface ExpandableRenderProps {
field?: string;
value: Array<any> | object;
data: Array<[string | undefined, any]>;
openBracket: string;
closeBracket: string;
lastElement: boolean;
level: number;
style: StyleProps;
shouldExpandNode: (level: number, value: any, field?: string) => boolean;
}
export default function DataRender(props: JsonRenderProps<any>): React.JSX.Element;

View File

@@ -0,0 +1 @@
import '@testing-library/jest-dom';

View File

@@ -0,0 +1,9 @@
export declare const isBoolean: (data: any) => boolean;
export declare const isNumber: (data: any) => boolean;
export declare const isBigInt: (data: any) => boolean;
export declare const isDate: (data: unknown) => data is Date;
export declare const isString: (data: any) => boolean;
export declare const isArray: (data: any) => boolean;
export declare const isObject: (data: any) => boolean;
export declare const isNull: (data: any) => boolean;
export declare const isUndefined: (data: any) => boolean;

View File

@@ -0,0 +1 @@
export {};

2
node_modules/react-json-view-lite/dist/hooks.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export declare function useBool(initialValueCreator: () => boolean): [boolean, () => void, (value: boolean) => void];
export declare function useComponentId(): string;

View File

@@ -0,0 +1 @@
export {};

151
node_modules/react-json-view-lite/dist/index.css generated vendored Normal file
View File

@@ -0,0 +1,151 @@
/* base styles */
._GzYRV {
line-height: 1.2;
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
word-wrap: break-word;
}
._3eOF8 {
margin-right: 5px;
font-weight: bold;
}
._1MFti {
cursor: pointer;
}
._f10Tu {
font-size: 1.2em;
margin-right: 5px;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
._1UmXx::after {
content: '\25B8';
}
._1LId0::after {
content: '\25BE';
}
._1pNG9 {
margin-right: 5px;
}
._1pNG9::after {
content: '...';
font-size: 0.8em;
}
._2IvMF {
background: #eee;
}
._2bkNM {
margin: 0 10px;
padding: 0;
}
/* default light style */
._1MGIk {
font-weight: 600;
margin-right: 5px;
color: #000000;
}
._3uHL6 {
color: #000000;
}
._2T6PJ {
color: #df113a;
}
._1Gho6 {
color: #df113a;
}
._vGjyY {
color: rgb(42, 63, 60);
}
._1bQdo {
color: #0b75f5;
}
._3zQKs {
color: rgb(70, 144, 56);
}
._1xvuR {
color: #43413d;
}
._oLqym {
color: #000000;
}
._2AXVT {
color: #000000;
}
._2KJWg {
color: #000000;
}
/* default dark style */
._11RoI {
background: rgb(0, 43, 54);
}
._17H2C {
color: rgb(253, 246, 227);
}
._3QHg2 {
color: rgb(253, 246, 227);
}
._3fDAz {
color: rgb(253, 246, 227);
}
._2bSDX {
font-weight: bolder;
margin-right: 5px;
color: rgb(253, 246, 227);
}
._gsbQL {
color: rgb(253, 246, 227);
}
._LaAZe {
color: rgb(129, 181, 172);
}
._GTKgm {
color: rgb(129, 181, 172);
}
._Chy1W {
color: rgb(203, 75, 22);
}
._2bveF {
color: rgb(211, 54, 130);
}
._2vRm- {
color: rgb(174, 129, 255);
}
._1prJR {
color: rgb(38, 139, 210);
}

12
node_modules/react-json-view-lite/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
import * as React from 'react';
import { StyleProps } from './DataRenderer';
export interface Props {
data: Object | Array<any>;
style?: StyleProps;
shouldExpandNode?: (level: number, value: any, field?: string) => boolean;
}
export declare const defaultStyles: StyleProps;
export declare const darkStyles: StyleProps;
export declare const allExpanded: () => boolean;
export declare const collapseAllNested: (level: number) => boolean;
export declare const JsonView: ({ data, style, shouldExpandNode }: Props) => React.JSX.Element;

269
node_modules/react-json-view-lite/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,269 @@
var React = require('react');
const isBoolean = data => {
return typeof data === 'boolean' || data instanceof Boolean;
};
const isNumber = data => {
return typeof data === 'number' || data instanceof Number;
};
const isBigInt = data => {
return typeof data === 'bigint' || data instanceof BigInt;
};
const isDate = data => {
return !!data && data instanceof Date;
};
const isString = data => {
return typeof data === 'string' || data instanceof String;
};
const isArray = data => {
return Array.isArray(data);
};
const isObject = data => {
return data instanceof Object && data !== null;
};
function useBool(initialValueCreator) {
const [value, setValue] = React.useState(initialValueCreator());
const tooggle = () => setValue(currentValue => !currentValue);
return [value, tooggle, setValue];
}
let componentId = 1;
const generateNextId = () => componentId++;
function useComponentId() {
const componentId = React.useRef();
if (componentId.current === undefined) {
componentId.current = `:jsnvw:${generateNextId()}:`;
}
return componentId.current;
}
function ExpandableObject(_ref) {
let {
field,
value,
data,
lastElement,
openBracket,
closeBracket,
level,
style,
shouldExpandNode
} = _ref;
const shouldExpandNodeCalledRef = React.useRef(false);
const [expanded, toggleExpanded, setExpanded] = useBool(() => shouldExpandNode(level, value, field));
React.useEffect(() => {
if (!shouldExpandNodeCalledRef.current) {
shouldExpandNodeCalledRef.current = true;
} else {
setExpanded(shouldExpandNode(level, value, field));
}
}, [shouldExpandNode]);
const expanderIconStyle = expanded ? style.collapseIcon : style.expandIcon;
const ariaLabel = expanded ? 'collapse JSON' : 'expand JSON';
const contentsId = useComponentId();
const childLevel = level + 1;
const lastIndex = data.length - 1;
const onKeyDown = e => {
if (e.key === ' ') {
toggleExpanded();
}
};
return /*#__PURE__*/React.createElement("div", {
className: style.basicChildStyle,
role: 'list'
}, /*#__PURE__*/React.createElement("span", {
className: expanderIconStyle,
onClick: toggleExpanded,
onKeyDown: onKeyDown,
role: 'button',
tabIndex: 0,
"aria-label": ariaLabel,
"aria-expanded": expanded,
"aria-controls": expanded ? contentsId : undefined
}), field && /*#__PURE__*/React.createElement("span", {
className: style.label
}, field, ":"), /*#__PURE__*/React.createElement("span", {
className: style.punctuation
}, openBracket), expanded ? /*#__PURE__*/React.createElement("div", {
id: contentsId
}, data.map((dataElement, index) => /*#__PURE__*/React.createElement(DataRender, {
key: dataElement[0] || index,
field: dataElement[0],
value: dataElement[1],
style: style,
lastElement: index === lastIndex,
level: childLevel,
shouldExpandNode: shouldExpandNode
}))) : /*#__PURE__*/React.createElement("span", {
className: style.collapsedContent,
onClick: toggleExpanded,
onKeyDown: onKeyDown,
role: 'button',
tabIndex: -1,
"aria-hidden": true,
"aria-label": ariaLabel,
"aria-expanded": expanded
}), /*#__PURE__*/React.createElement("span", {
className: style.punctuation
}, closeBracket), !lastElement && /*#__PURE__*/React.createElement("span", {
className: style.punctuation
}, ","));
}
function JsonObject(_ref2) {
let {
field,
value,
style,
lastElement,
shouldExpandNode,
level
} = _ref2;
return ExpandableObject({
field,
value,
lastElement: lastElement || false,
level,
openBracket: '{',
closeBracket: '}',
style,
shouldExpandNode,
data: Object.keys(value).map(key => [key, value[key]])
});
}
function JsonArray(_ref3) {
let {
field,
value,
style,
lastElement,
level,
shouldExpandNode
} = _ref3;
return ExpandableObject({
field,
value,
lastElement: lastElement || false,
level,
openBracket: '[',
closeBracket: ']',
style,
shouldExpandNode,
data: value.map(element => [undefined, element])
});
}
function JsonPrimitiveValue(_ref4) {
let {
field,
value,
style,
lastElement
} = _ref4;
let stringValue = value;
let valueStyle = style.otherValue;
if (value === null) {
stringValue = 'null';
valueStyle = style.nullValue;
} else if (value === undefined) {
stringValue = 'undefined';
valueStyle = style.undefinedValue;
} else if (isString(value)) {
stringValue = style.noQuotesForStringValues ? value : `"${value}"`;
valueStyle = style.stringValue;
} else if (isBoolean(value)) {
stringValue = value ? 'true' : 'false';
valueStyle = style.booleanValue;
} else if (isNumber(value)) {
stringValue = value.toString();
valueStyle = style.numberValue;
} else if (isBigInt(value)) {
stringValue = `${value.toString()}n`;
valueStyle = style.numberValue;
} else if (isDate(value)) {
stringValue = value.toISOString();
} else {
stringValue = value.toString();
}
if (field === '') {
field = '""';
}
return /*#__PURE__*/React.createElement("div", {
className: style.basicChildStyle,
role: 'listitem'
}, field && /*#__PURE__*/React.createElement("span", {
className: style.label
}, field, ":"), /*#__PURE__*/React.createElement("span", {
className: valueStyle
}, stringValue), !lastElement && /*#__PURE__*/React.createElement("span", {
className: style.punctuation
}, ","));
}
function DataRender(props) {
const value = props.value;
if (isArray(value)) {
return /*#__PURE__*/React.createElement(JsonArray, Object.assign({}, props));
}
if (isObject(value) && !isDate(value)) {
return /*#__PURE__*/React.createElement(JsonObject, Object.assign({}, props));
}
return /*#__PURE__*/React.createElement(JsonPrimitiveValue, Object.assign({}, props));
}
var styles = {"container-base":"_GzYRV","punctuation-base":"_3eOF8","pointer":"_1MFti","expander-base":"_f10Tu _1MFti","expand-icon":"_1UmXx","collapse-icon":"_1LId0","collapsed-content-base":"_1pNG9 _1MFti","container-light":"_2IvMF _GzYRV","basic-element-style":"_2bkNM","label-light":"_1MGIk","punctuation-light":"_3uHL6 _3eOF8","value-null-light":"_2T6PJ","value-undefined-light":"_1Gho6","value-string-light":"_vGjyY","value-number-light":"_1bQdo","value-boolean-light":"_3zQKs","value-other-light":"_1xvuR","collapse-icon-light":"_oLqym _f10Tu _1MFti _1LId0","expand-icon-light":"_2AXVT _f10Tu _1MFti _1UmXx","collapsed-content-light":"_2KJWg _1pNG9 _1MFti","container-dark":"_11RoI _GzYRV","expand-icon-dark":"_17H2C _f10Tu _1MFti _1UmXx","collapse-icon-dark":"_3QHg2 _f10Tu _1MFti _1LId0","collapsed-content-dark":"_3fDAz _1pNG9 _1MFti","label-dark":"_2bSDX","punctuation-dark":"_gsbQL _3eOF8","value-null-dark":"_LaAZe","value-undefined-dark":"_GTKgm","value-string-dark":"_Chy1W","value-number-dark":"_2bveF","value-boolean-dark":"_2vRm-","value-other-dark":"_1prJR"};
const defaultStyles = {
container: styles['container-light'],
basicChildStyle: styles['basic-element-style'],
label: styles['label-light'],
nullValue: styles['value-null-light'],
undefinedValue: styles['value-undefined-light'],
stringValue: styles['value-string-light'],
booleanValue: styles['value-boolean-light'],
numberValue: styles['value-number-light'],
otherValue: styles['value-other-light'],
punctuation: styles['punctuation-light'],
collapseIcon: styles['collapse-icon-light'],
expandIcon: styles['expand-icon-light'],
collapsedContent: styles['collapsed-content-light'],
noQuotesForStringValues: false
};
const darkStyles = {
container: styles['container-dark'],
basicChildStyle: styles['basic-element-style'],
label: styles['label-dark'],
nullValue: styles['value-null-dark'],
undefinedValue: styles['value-undefined-dark'],
stringValue: styles['value-string-dark'],
booleanValue: styles['value-boolean-dark'],
numberValue: styles['value-number-dark'],
otherValue: styles['value-other-dark'],
punctuation: styles['punctuation-dark'],
collapseIcon: styles['collapse-icon-dark'],
expandIcon: styles['expand-icon-dark'],
collapsedContent: styles['collapsed-content-dark'],
noQuotesForStringValues: false
};
const allExpanded = () => true;
const collapseAllNested = level => level < 1;
const JsonView = _ref => {
let {
data,
style = defaultStyles,
shouldExpandNode = allExpanded
} = _ref;
return /*#__PURE__*/React.createElement("div", {
className: style.container
}, /*#__PURE__*/React.createElement(DataRender, {
value: data,
style: style,
lastElement: true,
level: 0,
shouldExpandNode: shouldExpandNode
}));
};
exports.JsonView = JsonView;
exports.allExpanded = allExpanded;
exports.collapseAllNested = collapseAllNested;
exports.darkStyles = darkStyles;
exports.defaultStyles = defaultStyles;
//# sourceMappingURL=index.js.map

1
node_modules/react-json-view-lite/dist/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

265
node_modules/react-json-view-lite/dist/index.modern.js generated vendored Normal file
View File

@@ -0,0 +1,265 @@
import { useState, useRef, createElement, useEffect } from 'react';
const isBoolean = data => {
return typeof data === 'boolean' || data instanceof Boolean;
};
const isNumber = data => {
return typeof data === 'number' || data instanceof Number;
};
const isBigInt = data => {
return typeof data === 'bigint' || data instanceof BigInt;
};
const isDate = data => {
return !!data && data instanceof Date;
};
const isString = data => {
return typeof data === 'string' || data instanceof String;
};
const isArray = data => {
return Array.isArray(data);
};
const isObject = data => {
return data instanceof Object && data !== null;
};
function useBool(initialValueCreator) {
const [value, setValue] = useState(initialValueCreator());
const tooggle = () => setValue(currentValue => !currentValue);
return [value, tooggle, setValue];
}
let componentId = 1;
const generateNextId = () => componentId++;
function useComponentId() {
const componentId = useRef();
if (componentId.current === undefined) {
componentId.current = `:jsnvw:${generateNextId()}:`;
}
return componentId.current;
}
function ExpandableObject(_ref) {
let {
field,
value,
data,
lastElement,
openBracket,
closeBracket,
level,
style,
shouldExpandNode
} = _ref;
const shouldExpandNodeCalledRef = useRef(false);
const [expanded, toggleExpanded, setExpanded] = useBool(() => shouldExpandNode(level, value, field));
useEffect(() => {
if (!shouldExpandNodeCalledRef.current) {
shouldExpandNodeCalledRef.current = true;
} else {
setExpanded(shouldExpandNode(level, value, field));
}
}, [shouldExpandNode]);
const expanderIconStyle = expanded ? style.collapseIcon : style.expandIcon;
const ariaLabel = expanded ? 'collapse JSON' : 'expand JSON';
const contentsId = useComponentId();
const childLevel = level + 1;
const lastIndex = data.length - 1;
const onKeyDown = e => {
if (e.key === ' ') {
toggleExpanded();
}
};
return /*#__PURE__*/createElement("div", {
className: style.basicChildStyle,
role: 'list'
}, /*#__PURE__*/createElement("span", {
className: expanderIconStyle,
onClick: toggleExpanded,
onKeyDown: onKeyDown,
role: 'button',
tabIndex: 0,
"aria-label": ariaLabel,
"aria-expanded": expanded,
"aria-controls": expanded ? contentsId : undefined
}), field && /*#__PURE__*/createElement("span", {
className: style.label
}, field, ":"), /*#__PURE__*/createElement("span", {
className: style.punctuation
}, openBracket), expanded ? /*#__PURE__*/createElement("div", {
id: contentsId
}, data.map((dataElement, index) => /*#__PURE__*/createElement(DataRender, {
key: dataElement[0] || index,
field: dataElement[0],
value: dataElement[1],
style: style,
lastElement: index === lastIndex,
level: childLevel,
shouldExpandNode: shouldExpandNode
}))) : /*#__PURE__*/createElement("span", {
className: style.collapsedContent,
onClick: toggleExpanded,
onKeyDown: onKeyDown,
role: 'button',
tabIndex: -1,
"aria-hidden": true,
"aria-label": ariaLabel,
"aria-expanded": expanded
}), /*#__PURE__*/createElement("span", {
className: style.punctuation
}, closeBracket), !lastElement && /*#__PURE__*/createElement("span", {
className: style.punctuation
}, ","));
}
function JsonObject(_ref2) {
let {
field,
value,
style,
lastElement,
shouldExpandNode,
level
} = _ref2;
return ExpandableObject({
field,
value,
lastElement: lastElement || false,
level,
openBracket: '{',
closeBracket: '}',
style,
shouldExpandNode,
data: Object.keys(value).map(key => [key, value[key]])
});
}
function JsonArray(_ref3) {
let {
field,
value,
style,
lastElement,
level,
shouldExpandNode
} = _ref3;
return ExpandableObject({
field,
value,
lastElement: lastElement || false,
level,
openBracket: '[',
closeBracket: ']',
style,
shouldExpandNode,
data: value.map(element => [undefined, element])
});
}
function JsonPrimitiveValue(_ref4) {
let {
field,
value,
style,
lastElement
} = _ref4;
let stringValue = value;
let valueStyle = style.otherValue;
if (value === null) {
stringValue = 'null';
valueStyle = style.nullValue;
} else if (value === undefined) {
stringValue = 'undefined';
valueStyle = style.undefinedValue;
} else if (isString(value)) {
stringValue = style.noQuotesForStringValues ? value : `"${value}"`;
valueStyle = style.stringValue;
} else if (isBoolean(value)) {
stringValue = value ? 'true' : 'false';
valueStyle = style.booleanValue;
} else if (isNumber(value)) {
stringValue = value.toString();
valueStyle = style.numberValue;
} else if (isBigInt(value)) {
stringValue = `${value.toString()}n`;
valueStyle = style.numberValue;
} else if (isDate(value)) {
stringValue = value.toISOString();
} else {
stringValue = value.toString();
}
if (field === '') {
field = '""';
}
return /*#__PURE__*/createElement("div", {
className: style.basicChildStyle,
role: 'listitem'
}, field && /*#__PURE__*/createElement("span", {
className: style.label
}, field, ":"), /*#__PURE__*/createElement("span", {
className: valueStyle
}, stringValue), !lastElement && /*#__PURE__*/createElement("span", {
className: style.punctuation
}, ","));
}
function DataRender(props) {
const value = props.value;
if (isArray(value)) {
return /*#__PURE__*/createElement(JsonArray, Object.assign({}, props));
}
if (isObject(value) && !isDate(value)) {
return /*#__PURE__*/createElement(JsonObject, Object.assign({}, props));
}
return /*#__PURE__*/createElement(JsonPrimitiveValue, Object.assign({}, props));
}
var styles = {"container-base":"_GzYRV","punctuation-base":"_3eOF8","pointer":"_1MFti","expander-base":"_f10Tu _1MFti","expand-icon":"_1UmXx","collapse-icon":"_1LId0","collapsed-content-base":"_1pNG9 _1MFti","container-light":"_2IvMF _GzYRV","basic-element-style":"_2bkNM","label-light":"_1MGIk","punctuation-light":"_3uHL6 _3eOF8","value-null-light":"_2T6PJ","value-undefined-light":"_1Gho6","value-string-light":"_vGjyY","value-number-light":"_1bQdo","value-boolean-light":"_3zQKs","value-other-light":"_1xvuR","collapse-icon-light":"_oLqym _f10Tu _1MFti _1LId0","expand-icon-light":"_2AXVT _f10Tu _1MFti _1UmXx","collapsed-content-light":"_2KJWg _1pNG9 _1MFti","container-dark":"_11RoI _GzYRV","expand-icon-dark":"_17H2C _f10Tu _1MFti _1UmXx","collapse-icon-dark":"_3QHg2 _f10Tu _1MFti _1LId0","collapsed-content-dark":"_3fDAz _1pNG9 _1MFti","label-dark":"_2bSDX","punctuation-dark":"_gsbQL _3eOF8","value-null-dark":"_LaAZe","value-undefined-dark":"_GTKgm","value-string-dark":"_Chy1W","value-number-dark":"_2bveF","value-boolean-dark":"_2vRm-","value-other-dark":"_1prJR"};
const defaultStyles = {
container: styles['container-light'],
basicChildStyle: styles['basic-element-style'],
label: styles['label-light'],
nullValue: styles['value-null-light'],
undefinedValue: styles['value-undefined-light'],
stringValue: styles['value-string-light'],
booleanValue: styles['value-boolean-light'],
numberValue: styles['value-number-light'],
otherValue: styles['value-other-light'],
punctuation: styles['punctuation-light'],
collapseIcon: styles['collapse-icon-light'],
expandIcon: styles['expand-icon-light'],
collapsedContent: styles['collapsed-content-light'],
noQuotesForStringValues: false
};
const darkStyles = {
container: styles['container-dark'],
basicChildStyle: styles['basic-element-style'],
label: styles['label-dark'],
nullValue: styles['value-null-dark'],
undefinedValue: styles['value-undefined-dark'],
stringValue: styles['value-string-dark'],
booleanValue: styles['value-boolean-dark'],
numberValue: styles['value-number-dark'],
otherValue: styles['value-other-dark'],
punctuation: styles['punctuation-dark'],
collapseIcon: styles['collapse-icon-dark'],
expandIcon: styles['expand-icon-dark'],
collapsedContent: styles['collapsed-content-dark'],
noQuotesForStringValues: false
};
const allExpanded = () => true;
const collapseAllNested = level => level < 1;
const JsonView = _ref => {
let {
data,
style = defaultStyles,
shouldExpandNode = allExpanded
} = _ref;
return /*#__PURE__*/createElement("div", {
className: style.container
}, /*#__PURE__*/createElement(DataRender, {
value: data,
style: style,
lastElement: true,
level: 0,
shouldExpandNode: shouldExpandNode
}));
};
export { JsonView, allExpanded, collapseAllNested, darkStyles, defaultStyles };
//# sourceMappingURL=index.modern.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
import '@testing-library/jest-dom';

View File

@@ -0,0 +1,7 @@
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("..").Props>;
export default _default;
export declare const Basic: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, import("..").Props>;
export declare const DarkTheme: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, import("..").Props>;
export declare const CollapsedNestedObjects: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, import("..").Props>;
export declare const CollapsedRoot: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, import("..").Props>;
export declare const RenderStringsWithoutObjects: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, import("..").Props>;

104
node_modules/react-json-view-lite/package.json generated vendored Normal file
View File

@@ -0,0 +1,104 @@
{
"name": "react-json-view-lite",
"version": "1.3.0",
"description": "JSON viewer component for React focused on performance for large volume input while still providing few customiziation features",
"homepage": "https://github.com/AnyRoad/react-json-view-lite",
"author": "AnyRoad",
"license": "MIT",
"keywords": [
"react",
"json",
"component",
"view",
"json-view",
"json-tree",
"lite"
],
"repository": "AnyRoad/react-json-view-lite",
"main": "dist/index.js",
"types": "./dist/index.d.ts",
"module": "dist/index.modern.js",
"source": "src/index.tsx",
"engines": {
"node": ">=14"
},
"scripts": {
"build": "microbundle-crl --no-compress --format modern,cjs",
"start": "microbundle-crl watch --no-compress --format modern,cjs",
"prepare": "run-s build",
"test": "run-s test:unit test:lint test:build",
"test:build": "run-s build",
"test:lint": "eslint .",
"test:unit": "cross-env CI=1 react-scripts test --env=jsdom --coverage",
"test:watch": "react-scripts test --env=jsdom",
"predeploy": "npm run build-storybook",
"deploy-storybook": "gh-pages -d storybook-static",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"peerDependencies": {
"react": "^16.13.1 || ^17.0.0 || ^18.0.0"
},
"resolutions": {
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0"
},
"devDependencies": {
"@babel/core": "^7.22.11",
"@babel/preset-env": "^7.22.14",
"@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "^7.22.11",
"@storybook/addon-actions": "^7.4.0",
"@storybook/addon-essentials": "^7.4.0",
"@storybook/addon-interactions": "^7.4.0",
"@storybook/addon-links": "^7.4.0",
"@storybook/addons": "^7.4.0",
"@storybook/react": "^7.4.0",
"@storybook/react-webpack5": "^7.4.0",
"@storybook/testing-library": "0.2.0",
"@storybook/theming": "^7.4.0",
"@testing-library/jest-dom": "6.1.2",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/jest": "29.5.4",
"@types/node": "18.8.3",
"@types/react": "18.2.21",
"@types/react-dom": "18.2.7",
"@typescript-eslint/eslint-plugin": "6.5.0",
"@typescript-eslint/parser": "6.5.0",
"babel-eslint": "10.1.0",
"cross-env": "7.0.3",
"eslint": "8.48.0",
"eslint-config-prettier": "9.0.0",
"eslint-config-standard": "17.1.0",
"eslint-config-standard-react": "13.0.0",
"eslint-plugin-import": "2.28.1",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-n": "16.0.2",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "5.0.0",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-standard": "5.0.0",
"gh-pages": "6.0.0",
"microbundle-crl": "0.13.11",
"npm-run-all": "4.1.5",
"prettier": "3.0.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-scripts": "5.0.1",
"storybook": "^7.4.0",
"storybook-css-modules": "^1.0.8",
"typescript": "5.2.2"
},
"files": [
"dist"
],
"jest": {
"collectCoverageFrom": [
"src/*.{ts,tsx}",
"!<rootDir>/node_modules/"
]
},
"packageManager": "yarn@3.6.3"
}