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

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>;