diff --git a/package.json b/package.json index 92876694..4abdd893 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "@tailwindcss/typography": "^0.5.9", "@tippyjs/react": "^4.2.6", "@types/dompurify": "^3.0.2", + "@uiw/react-json-view": "2.0.0-alpha.7", "chroma-js": "^2.4.2", "comlink": "^4.4.1", "cropperjs": "^1.5.13", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a15a7ec0..9f23dea8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,6 +22,9 @@ dependencies: '@types/dompurify': specifier: ^3.0.2 version: 3.0.2 + '@uiw/react-json-view': + specifier: 2.0.0-alpha.7 + version: 2.0.0-alpha.7(@babel/runtime@7.22.6)(react-dom@18.2.0)(react@18.2.0) chroma-js: specifier: ^2.4.2 version: 2.4.2 @@ -2256,6 +2259,18 @@ packages: eslint-visitor-keys: 3.4.2 dev: true + /@uiw/react-json-view@2.0.0-alpha.7(@babel/runtime@7.22.6)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-hhlDlQcszeg3IcwxIc7NLpkzOVs4A4rB0IgkVZkeUnLOEx2AMlE2hlybgxJfm4E0c9NoRmOFgrYkL1SbeXBW4w==} + peerDependencies: + '@babel/runtime': '>=7.10.0' + react: '>=18.0.0' + react-dom: '>=18.0.0' + dependencies: + '@babel/runtime': 7.22.6 + react: 18.2.0 + react-dom: 18.2.0(react@18.2.0) + dev: false + /@use-gesture/core@10.2.27: resolution: {integrity: sha512-V4XV7hn9GAD2MYu8yBBVi5iuWBsAMfjPRMsEVzoTNGYH72tf0kFP+OKqGKc8YJFQIJx6yj+AOqxmEHOmx2/MEA==} dev: false diff --git a/src/lenses/ArrayLens.tsx b/src/lenses/ArrayLens.tsx index 6e790f55..a9056956 100644 --- a/src/lenses/ArrayLens.tsx +++ b/src/lenses/ArrayLens.tsx @@ -1,35 +1,22 @@ import 'twin.macro'; -import dataformat from '../dataformat'; import { Lens } from '../types'; +import JsonView from '@uiw/react-json-view'; -interface ArrayProps { - value: Array; -} - -const ArrayComponent = ({ value }: ArrayProps): JSX.Element => { - return ( - <> -
[
- {value.map((element, i) => - Array.isArray(element) ? ( - - ) : ( -
- {dataformat.formatNumber(element)} -
- ) - )} -
]
- - ); -}; +const THEME = { backgroundColor: 'transparent' }; const ArrayLens: Lens = ({ value }) => { const array = value as Array; return ( -
- +
+
); }; @@ -38,7 +25,7 @@ ArrayLens.key = 'ArrayLens'; ArrayLens.dataTypes = ['array', 'Embedding', 'Window']; ArrayLens.defaultHeight = 22; ArrayLens.minHeight = 22; -ArrayLens.maxHeight = 128; +ArrayLens.maxHeight = 512; ArrayLens.displayName = 'Array'; export default ArrayLens;