mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-22 06:00:07 +03:00
Merge branch 'main' into adjust-open-location
This commit is contained in:
commit
2cd9cbbfad
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
'd3-state-visualizer': major
|
||||
---
|
||||
|
||||
- Remove UMD build.
|
||||
- Split `style` option into `chartStyles`, `nodeStyleOptions`, `textStyleOptions`, and `linkStyles`.
|
||||
- The shape of the argument passed to the `onClickText` option has been updated.
|
||||
- Rename `InputOptions` to `Options`, `Primitive` to `StyleValue`, and `NodeWithId` to `HierarchyPointNode<Node>`.
|
6
.changeset/lovely-boats-happen.md
Normal file
6
.changeset/lovely-boats-happen.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
'@redux-devtools/cli': major
|
||||
---
|
||||
|
||||
Convert @redux-devtools/cli to ESM. Please [read this](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) for more info about ESM.
|
||||
Update supported Node versions from `>=14.15.0` to `^14.13.1 || ^16.13.0 || >=18.12.0`.
|
|
@ -1,6 +0,0 @@
|
|||
---
|
||||
'@redux-devtools/chart-monitor': major
|
||||
---
|
||||
|
||||
- Split `style` option into `chartStyles`, `nodeStyleOptions`, `textStyleOptions`, and `linkStyles`.
|
||||
- The shape of the argument passed to the `onClickText` option has been updated.
|
|
@ -1,10 +0,0 @@
|
|||
---
|
||||
'd3tooltip': major
|
||||
---
|
||||
|
||||
- Remove UMD build.
|
||||
- Upgrade d3 peer dependency from v3 to v6.
|
||||
- Remove `attr` configuration method.
|
||||
- Rename `style` configuration method to `styles` and move to options.
|
||||
- Move `text` configuration method to options.
|
||||
- Remove d3 parameter as first parameter for `tooltip`.
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
'map2tree': major
|
||||
---
|
||||
|
||||
- Remove UMD build.
|
|
@ -1,5 +1,13 @@
|
|||
# remotedev-redux-devtools-extension
|
||||
|
||||
## 3.0.18
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [81926f32]
|
||||
- react-json-tree@0.18.0
|
||||
- @redux-devtools/app@2.2.1
|
||||
|
||||
## 3.0.17
|
||||
|
||||
### Patch Changes
|
||||
|
|
|
@ -5,5 +5,7 @@ module.exports = {
|
|||
moduleNameMapper: {
|
||||
'\\.css$': '<rootDir>/test/__mocks__/styleMock.ts',
|
||||
},
|
||||
resolver: '<rootDir>/jestResolver.js',
|
||||
transformIgnorePatterns: [
|
||||
'node_modules/(?!.pnpm|d3|dateformat|delaunator|internmap|nanoid|robust-predicates|uuid)',
|
||||
],
|
||||
};
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
module.exports = (path, options) => {
|
||||
return options.defaultResolver(path, {
|
||||
...options,
|
||||
packageFilter: (pkg) => {
|
||||
if (pkg.name === 'nanoid') {
|
||||
pkg.exports['.'].browser = pkg.exports['.'].require;
|
||||
}
|
||||
if (pkg.name === 'uuid' && pkg.version.startsWith('8.')) {
|
||||
delete pkg.exports;
|
||||
delete pkg.module;
|
||||
}
|
||||
return pkg;
|
||||
},
|
||||
});
|
||||
};
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"private": true,
|
||||
"name": "remotedev-redux-devtools-extension",
|
||||
"version": "3.0.17",
|
||||
"version": "3.0.18",
|
||||
"description": "Redux Developer Tools for debugging application state changes.",
|
||||
"homepage": "https://github.com/reduxjs/redux-devtools/tree/master/extension",
|
||||
"license": "MIT",
|
||||
|
@ -28,7 +28,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "^7.12.1",
|
||||
"@redux-devtools/app": "^2.2.0",
|
||||
"@redux-devtools/app": "^2.2.1",
|
||||
"@redux-devtools/core": "^3.13.0",
|
||||
"@redux-devtools/instrument": "^2.1.0",
|
||||
"@redux-devtools/serialize": "^0.4.1",
|
||||
|
@ -43,14 +43,14 @@
|
|||
"react-dom": "^18.2.0",
|
||||
"react-icons": "^4.7.1",
|
||||
"react-is": "^18.2.0",
|
||||
"react-json-tree": "^0.17.0",
|
||||
"react-json-tree": "^0.18.0",
|
||||
"react-redux": "^8.0.5",
|
||||
"redux": "^4.2.0",
|
||||
"redux-persist": "^6.0.0",
|
||||
"styled-components": "^5.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
|
@ -60,16 +60,16 @@
|
|||
"@types/chrome": "^0.0.206",
|
||||
"@types/lodash": "^4.14.191",
|
||||
"@types/react": "^18.0.26",
|
||||
"@types/react-dom": "^18.0.9",
|
||||
"@types/react-dom": "^18.0.10",
|
||||
"@types/styled-components": "^5.1.26",
|
||||
"babel-loader": "^9.1.0",
|
||||
"babel-loader": "^9.1.2",
|
||||
"chromedriver": "^108.0.0",
|
||||
"copy-webpack-plugin": "^11.0.0",
|
||||
"cpy-cli": "^4.2.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-loader": "^6.7.3",
|
||||
"electron": "^22.0.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.6.1",
|
||||
|
@ -77,7 +77,7 @@
|
|||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"file-loader": "^6.2.0",
|
||||
"fork-ts-checker-webpack-plugin": "^7.2.14",
|
||||
"immutable": "^4.1.0",
|
||||
"immutable": "^4.2.2",
|
||||
"jest": "^29.3.1",
|
||||
"jest-environment-jsdom": "^29.3.1",
|
||||
"pug-html-loader": "^1.1.5",
|
||||
|
|
18
package.json
18
package.json
|
@ -1,20 +1,20 @@
|
|||
{
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@changesets/cli": "^2.26.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-jest": "^27.1.7",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"jest": "^29.3.1",
|
||||
"prettier": "2.8.1",
|
||||
"prettier": "2.8.2",
|
||||
"typescript": "~4.9.4",
|
||||
"nx": "^15.3.3",
|
||||
"nx": "^15.4.5",
|
||||
"@nrwl/nx-cloud": "^15.0.2"
|
||||
},
|
||||
"scripts": {
|
||||
|
@ -39,7 +39,7 @@
|
|||
"packages/redux-devtools-rtk-query-monitor/demo",
|
||||
"packages/redux-devtools-slider-monitor/examples/todomvc"
|
||||
],
|
||||
"packageManager": "pnpm@7.19.0",
|
||||
"packageManager": "pnpm@7.22.0",
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
"@babel/highlight>chalk": "Methuselah96/chalk#v2-without-process"
|
||||
|
|
|
@ -1,5 +1,23 @@
|
|||
# Change Log
|
||||
|
||||
## 2.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- b323f77d: Upgrade D3
|
||||
|
||||
- Remove UMD build.
|
||||
- Split `style` option into `chartStyles`, `nodeStyleOptions`, `textStyleOptions`, and `linkStyles`.
|
||||
- The shape of the argument passed to the `onClickText` option has been updated.
|
||||
- Rename `InputOptions` to `Options`, `Primitive` to `StyleValue`, and `NodeWithId` to `HierarchyPointNode<Node>`.
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [b323f77d]
|
||||
- Updated dependencies [b323f77d]
|
||||
- d3tooltip@3.0.0
|
||||
- map2tree@3.0.0
|
||||
|
||||
## [1.4.0](https://github.com/reduxjs/redux-devtools/compare/d3-state-visualizer@1.3.4...d3-state-visualizer@1.4.0) (2021-03-06)
|
||||
|
||||
### Features
|
||||
|
|
10
packages/d3-state-visualizer/examples/tree/CHANGELOG.md
Normal file
10
packages/d3-state-visualizer/examples/tree/CHANGELOG.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
# d3-state-visualizer-tree-example
|
||||
|
||||
## 0.1.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [b323f77d]
|
||||
- Updated dependencies [b323f77d]
|
||||
- d3-state-visualizer@2.0.0
|
||||
- map2tree@3.0.0
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"private": true,
|
||||
"name": "d3-state-visualizer-tree-example",
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.5",
|
||||
"description": "Visualize your app state as a tree",
|
||||
"keywords": [
|
||||
"d3",
|
||||
|
@ -25,20 +25,20 @@
|
|||
"type-check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"d3-state-visualizer": "^1.6.0",
|
||||
"map2tree": "^2.1.0"
|
||||
"d3-state-visualizer": "^2.0.0",
|
||||
"map2tree": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@types/node": "^18.11.17",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"babel-loader": "^9.1.0",
|
||||
"@types/node": "^18.11.18",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"babel-loader": "^9.1.2",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"fork-ts-checker-webpack-plugin": "^7.2.14",
|
||||
"html-webpack-plugin": "^5.5.0",
|
||||
"ts-node": "^10.9.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "d3-state-visualizer",
|
||||
"version": "1.6.0",
|
||||
"version": "2.0.0",
|
||||
"description": "Visualize your app state with a range of reusable charts",
|
||||
"keywords": [
|
||||
"d3",
|
||||
|
@ -40,25 +40,25 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@types/d3": "^6.7.5",
|
||||
"d3": "^6.7.0",
|
||||
"d3tooltip": "^2.1.0",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"@types/d3": "^7.4.0",
|
||||
"d3": "^7.8.0",
|
||||
"d3tooltip": "^3.0.0",
|
||||
"deepmerge": "^4.2.2",
|
||||
"map2tree": "^2.1.0",
|
||||
"map2tree": "^3.0.0",
|
||||
"ramda": "^0.28.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@types/ramda": "^0.28.20",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "~4.9.4"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
# Change Log
|
||||
|
||||
## 3.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- b323f77d: Upgrade D3
|
||||
|
||||
- Remove UMD build.
|
||||
- Upgrade d3 peer dependency from v3 to v7.
|
||||
- Remove `attr` configuration method.
|
||||
- Rename `style` configuration method to `styles` and move to options.
|
||||
- Move `text` configuration method to options.
|
||||
- Remove d3 parameter as first parameter for `tooltip`.
|
||||
|
||||
## 2.0.0
|
||||
|
||||
- Adds ESM build (https://github.com/reduxjs/redux-devtools/pull/997) and switches the default export to a named export in order to ensure that the CommonJS output and the ESM output are [interchangeable](https://rollupjs.org/guide/en/#outputexports):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "d3tooltip",
|
||||
"version": "2.1.0",
|
||||
"version": "3.0.0",
|
||||
"description": "A highly configurable tooltip for d3",
|
||||
"keywords": [
|
||||
"d3",
|
||||
|
@ -36,25 +36,25 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6"
|
||||
"@babel/runtime": "^7.20.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@types/d3": "^6.7.5",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"d3": "^6.7.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"@types/d3": "^7.4.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"d3": "^7.8.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "~4.9.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/d3": "^6.7.5",
|
||||
"d3": "^6.7.0"
|
||||
"@types/d3": "^7.4.0",
|
||||
"d3": "^7.8.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
# Change Log
|
||||
|
||||
## 3.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- b323f77d: Remove UMD build.
|
||||
|
||||
## 2.0.0
|
||||
|
||||
- Adds ESM build (https://github.com/reduxjs/redux-devtools/pull/997) and switches the default export to a named export in order to ensure that the CommonJS output and the ESM output are [interchangeable](https://rollupjs.org/guide/en/#outputexports):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "map2tree",
|
||||
"version": "2.1.0",
|
||||
"version": "3.0.0",
|
||||
"description": "Utility for mapping maps to trees",
|
||||
"keywords": [
|
||||
"map2tree",
|
||||
|
@ -40,23 +40,23 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint && pnpm run test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"lodash": "^4.17.21"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@types/jest": "^29.2.4",
|
||||
"@types/jest": "^29.2.5",
|
||||
"@types/lodash": "^4.14.191",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-jest": "^27.1.7",
|
||||
"immutable": "^4.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"immutable": "^4.2.2",
|
||||
"jest": "^29.3.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"ts-jest": "^29.0.3",
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint && pnpm run test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"@types/base16": "^1.0.2",
|
||||
"@types/lodash": "^4.14.191",
|
||||
"base16": "^1.0.0",
|
||||
|
@ -48,20 +48,20 @@
|
|||
"lodash.curry": "^4.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@types/color": "^3.0.3",
|
||||
"@types/jest": "^29.2.4",
|
||||
"@types/jest": "^29.2.5",
|
||||
"@types/lodash.curry": "^4.1.7",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-jest": "^27.1.7",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"jest": "^29.3.1",
|
||||
"jest-environment-jsdom": "^29.3.1",
|
||||
"rimraf": "^3.0.2",
|
||||
|
|
|
@ -19,20 +19,20 @@
|
|||
"styled-components": "^5.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@types/node": "^18.11.17",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/react": "^18.0.26",
|
||||
"@types/react-dom": "^18.0.9",
|
||||
"@types/react-dom": "^18.0.10",
|
||||
"@types/styled-components": "^5.1.26",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"babel-loader": "^9.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"babel-loader": "^9.1.2",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"fork-ts-checker-webpack-plugin": "^7.2.14",
|
||||
|
|
|
@ -39,29 +39,29 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint && pnpm run test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"@types/lodash": "^4.14.191",
|
||||
"@types/prop-types": "^15.7.5",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"prop-types": "^15.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@types/jest": "^29.2.4",
|
||||
"@types/jest": "^29.2.5",
|
||||
"@types/lodash.debounce": "^4.0.7",
|
||||
"@types/react": "^18.0.26",
|
||||
"@types/react-test-renderer": "^18.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-jest": "^27.1.7",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"jest": "^29.3.1",
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
# Change Log
|
||||
|
||||
## 0.18.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- 81926f32: Remove UNSAFE method from react-json-tree
|
||||
|
||||
- Replace `shouldExpandNode` with `shouldExpandNodeInitially`. This function is now only called when a node in the tree is first rendered, when before it would update the expanded state of the node if the results of calling `shouldExpandNode` changed between renders. There is no way to replicate the old behavior exactly, but the new behavior is the intended behavior for the use cases within Redux DevTools. Please open an issue if you need a way to programatically control the expanded state of nodes.
|
||||
- Bump the minimum React version from `16.3.0` to `16.8.0` so that `react-json-tree` can use hooks.
|
||||
- Tightened TypeScript prop types to use `unknown` instead of `any` where possible and make the key path array `readonly`.
|
||||
|
||||
## 0.17.0
|
||||
|
||||
### Minor Changes
|
||||
|
|
|
@ -139,7 +139,7 @@ Their full signatures are:
|
|||
|
||||
#### More Options
|
||||
|
||||
- `shouldExpandNode: function(keyPath, data, level)` - determines if node should be expanded (root is expanded by default)
|
||||
- `shouldExpandNodeInitially: function(keyPath, data, level)` - determines if node should be expanded when it first renders (root is expanded by default)
|
||||
- `hideRoot: boolean` - if `true`, the root node is hidden.
|
||||
- `sortObjectKeys: boolean | function(a, b)` - sorts object keys with compare function (optional). Isn't applied to iterable maps like `Immutable.Map`.
|
||||
- `postprocessValue: function(value)` - maps `value` to a new `value`
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
# react-json-tree-example
|
||||
|
||||
## 1.1.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [81926f32]
|
||||
- react-json-tree@0.18.0
|
||||
|
||||
## 1.1.7
|
||||
|
||||
### Patch Changes
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"private": true,
|
||||
"name": "react-json-tree-example",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8",
|
||||
"description": "React-Json-Tree example",
|
||||
"homepage": "https://github.com/reduxjs/redux-devtools/tree/master/packages/react-json-tree/examples",
|
||||
"bugs": {
|
||||
|
@ -19,26 +19,26 @@
|
|||
"type-check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"immutable": "^4.1.0",
|
||||
"immutable": "^4.2.2",
|
||||
"react": "^18.2.0",
|
||||
"react-base16-styling": "^0.9.1",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-json-tree": "^0.17.0"
|
||||
"react-json-tree": "^0.18.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@types/node": "^18.11.17",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/react": "^18.0.26",
|
||||
"@types/react-dom": "^18.0.9",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"babel-loader": "^9.1.0",
|
||||
"@types/react-dom": "^18.0.10",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"babel-loader": "^9.1.2",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"fork-ts-checker-webpack-plugin": "^7.2.14",
|
||||
|
|
|
@ -178,7 +178,7 @@ const App = () => (
|
|||
<span role="img" aria-label="mellow">
|
||||
😐
|
||||
</span>{' '}
|
||||
{raw}{' '}
|
||||
{raw as string}{' '}
|
||||
<span role="img" aria-label="mellow">
|
||||
😐
|
||||
</span>
|
||||
|
@ -194,7 +194,11 @@ const App = () => (
|
|||
</div>
|
||||
<p>Collapsed root node</p>
|
||||
<div>
|
||||
<JSONTree data={data} theme={theme} shouldExpandNode={() => false} />
|
||||
<JSONTree
|
||||
data={data}
|
||||
theme={theme}
|
||||
shouldExpandNodeInitially={() => false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "react-json-tree",
|
||||
"version": "0.17.0",
|
||||
"version": "0.18.0",
|
||||
"description": "React JSON Viewer Component, Extracted from redux-devtools",
|
||||
"keywords": [
|
||||
"react",
|
||||
|
@ -45,15 +45,13 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint && pnpm run test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"@types/lodash": "^4.14.191",
|
||||
"@types/prop-types": "^15.7.5",
|
||||
"prop-types": "^15.8.1",
|
||||
"react-base16-styling": "^0.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
|
@ -62,30 +60,30 @@
|
|||
"@rollup/plugin-babel": "^6.0.3",
|
||||
"@rollup/plugin-commonjs": "^24.0.0",
|
||||
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||
"@rollup/plugin-terser": "^0.2.1",
|
||||
"@types/jest": "^29.2.4",
|
||||
"@types/node": "^18.11.17",
|
||||
"@rollup/plugin-terser": "^0.3.0",
|
||||
"@types/jest": "^29.2.5",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/react": "^18.0.26",
|
||||
"@types/react-test-renderer": "^18.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-jest": "^27.1.7",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"jest": "^29.3.1",
|
||||
"react": "^18.2.0",
|
||||
"react-test-renderer": "^18.2.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^3.7.5",
|
||||
"rollup": "^3.9.1",
|
||||
"rollup-plugin-typescript2": "^0.34.1",
|
||||
"ts-jest": "^29.0.3",
|
||||
"tslib": "^2.4.1",
|
||||
"typescript": "~4.9.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "^16.3.0 || ^17.0.0 || ^18.0.0",
|
||||
"react": "^16.3.0 || ^17.0.0 || ^18.0.0"
|
||||
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
||||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,59 +1,39 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import JSONArrow from './JSONArrow';
|
||||
import { CircularPropsPassedThroughItemRange } from './types';
|
||||
import type { CircularCache, CommonInternalProps } from './types';
|
||||
|
||||
interface Props extends CircularPropsPassedThroughItemRange {
|
||||
data: any;
|
||||
interface Props extends CommonInternalProps {
|
||||
data: unknown;
|
||||
nodeType: string;
|
||||
from: number;
|
||||
to: number;
|
||||
renderChildNodes: (props: Props, from: number, to: number) => React.ReactNode;
|
||||
circularCache: CircularCache;
|
||||
level: number;
|
||||
}
|
||||
|
||||
interface State {
|
||||
expanded: boolean;
|
||||
}
|
||||
export default function ItemRange(props: Props) {
|
||||
const { styling, from, to, renderChildNodes, nodeType } = props;
|
||||
|
||||
export default class ItemRange extends React.Component<Props, State> {
|
||||
static propTypes = {
|
||||
styling: PropTypes.func.isRequired,
|
||||
from: PropTypes.number.isRequired,
|
||||
to: PropTypes.number.isRequired,
|
||||
renderChildNodes: PropTypes.func.isRequired,
|
||||
nodeType: PropTypes.string.isRequired,
|
||||
};
|
||||
const [expanded, setExpanded] = useState<boolean>(false);
|
||||
const handleClick = useCallback(() => {
|
||||
setExpanded(!expanded);
|
||||
}, [expanded]);
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = { expanded: false };
|
||||
}
|
||||
|
||||
render() {
|
||||
const { styling, from, to, renderChildNodes, nodeType } = this.props;
|
||||
|
||||
return this.state.expanded ? (
|
||||
<div {...styling('itemRange', this.state.expanded)}>
|
||||
{renderChildNodes(this.props, from, to)}
|
||||
return expanded ? (
|
||||
<div {...styling('itemRange', expanded)}>
|
||||
{renderChildNodes(props, from, to)}
|
||||
</div>
|
||||
) : (
|
||||
<div
|
||||
{...styling('itemRange', this.state.expanded)}
|
||||
onClick={this.handleClick}
|
||||
>
|
||||
<div {...styling('itemRange', expanded)} onClick={handleClick}>
|
||||
<JSONArrow
|
||||
nodeType={nodeType}
|
||||
styling={styling}
|
||||
expanded={false}
|
||||
onClick={this.handleClick}
|
||||
onClick={handleClick}
|
||||
arrowStyle="double"
|
||||
/>
|
||||
{`${from} ... ${to}`}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
handleClick = () => {
|
||||
this.setState({ expanded: !this.state.expanded });
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,35 +1,30 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import JSONNestedNode from './JSONNestedNode';
|
||||
import { CircularPropsPassedThroughJSONNode } from './types';
|
||||
import type { CommonInternalProps } from './types';
|
||||
|
||||
// Returns the "n Items" string for this node,
|
||||
// generating and caching it if it hasn't been created yet.
|
||||
function createItemString(data: any) {
|
||||
function createItemString(data: unknown) {
|
||||
return `${(data as unknown[]).length} ${
|
||||
(data as unknown[]).length !== 1 ? 'items' : 'item'
|
||||
}`;
|
||||
}
|
||||
|
||||
interface Props extends CircularPropsPassedThroughJSONNode {
|
||||
data: any;
|
||||
interface Props extends CommonInternalProps {
|
||||
data: unknown;
|
||||
nodeType: string;
|
||||
}
|
||||
|
||||
// Configures <JSONNestedNode> to render an Array
|
||||
const JSONArrayNode: React.FunctionComponent<Props> = ({ data, ...props }) => (
|
||||
export default function JSONArrayNode({ data, ...props }: Props) {
|
||||
return (
|
||||
<JSONNestedNode
|
||||
{...props}
|
||||
data={data}
|
||||
nodeType="Array"
|
||||
nodeTypeIndicator="[]"
|
||||
createItemString={createItemString}
|
||||
expandable={data.length > 0}
|
||||
expandable={(data as unknown[]).length > 0}
|
||||
/>
|
||||
);
|
||||
|
||||
JSONArrayNode.propTypes = {
|
||||
data: PropTypes.array,
|
||||
};
|
||||
|
||||
export default JSONArrayNode;
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { StylingFunction } from 'react-base16-styling';
|
||||
import type { StylingFunction } from 'react-base16-styling';
|
||||
|
||||
interface Props {
|
||||
styling: StylingFunction;
|
||||
|
@ -10,13 +9,14 @@ interface Props {
|
|||
onClick: React.MouseEventHandler<HTMLDivElement>;
|
||||
}
|
||||
|
||||
const JSONArrow: React.FunctionComponent<Props> = ({
|
||||
export default function JSONArrow({
|
||||
styling,
|
||||
arrowStyle,
|
||||
arrowStyle = 'single',
|
||||
expanded,
|
||||
nodeType,
|
||||
onClick,
|
||||
}) => (
|
||||
}: Props) {
|
||||
return (
|
||||
<div {...styling('arrowContainer', arrowStyle)} onClick={onClick}>
|
||||
<div {...styling(['arrow', 'arrowSign'], nodeType, expanded, arrowStyle)}>
|
||||
{'\u25B6'}
|
||||
|
@ -25,18 +25,5 @@ const JSONArrow: React.FunctionComponent<Props> = ({
|
|||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
JSONArrow.propTypes = {
|
||||
styling: PropTypes.func.isRequired,
|
||||
arrowStyle: PropTypes.oneOf(['single', 'double']),
|
||||
expanded: PropTypes.bool.isRequired,
|
||||
nodeType: PropTypes.string.isRequired,
|
||||
onClick: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
JSONArrow.defaultProps = {
|
||||
arrowStyle: 'single',
|
||||
};
|
||||
|
||||
export default JSONArrow;
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
import JSONNestedNode from './JSONNestedNode';
|
||||
import { CircularPropsPassedThroughJSONNode } from './types';
|
||||
import type { CommonInternalProps } from './types';
|
||||
|
||||
// Returns the "n Items" string for this node,
|
||||
// generating and caching it if it hasn't been created yet.
|
||||
|
@ -22,21 +22,20 @@ function createItemString(data: any, limit: number) {
|
|||
return `${hasMore ? '>' : ''}${count} ${count !== 1 ? 'entries' : 'entry'}`;
|
||||
}
|
||||
|
||||
interface Props extends CircularPropsPassedThroughJSONNode {
|
||||
data: any;
|
||||
interface Props extends CommonInternalProps {
|
||||
data: unknown;
|
||||
nodeType: string;
|
||||
}
|
||||
|
||||
// Configures <JSONNestedNode> to render an iterable
|
||||
const JSONIterableNode: React.FunctionComponent<Props> = ({ ...props }) => {
|
||||
export default function JSONIterableNode(props: Props) {
|
||||
return (
|
||||
<JSONNestedNode
|
||||
{...props}
|
||||
nodeType="Iterable"
|
||||
nodeTypeIndicator="()"
|
||||
createItemString={createItemString}
|
||||
expandable
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default JSONIterableNode;
|
||||
}
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import JSONArrow from './JSONArrow';
|
||||
import getCollectionEntries from './getCollectionEntries';
|
||||
import JSONNode from './JSONNode';
|
||||
import ItemRange from './ItemRange';
|
||||
import {
|
||||
CircularPropsPassedThroughJSONNestedNode,
|
||||
CircularPropsPassedThroughRenderChildNodes,
|
||||
} from './types';
|
||||
import type { CircularCache, CommonInternalProps } from './types';
|
||||
|
||||
/**
|
||||
* Renders nested values (eg. objects, arrays, lists, etc.)
|
||||
*/
|
||||
|
||||
export interface RenderChildNodesProps
|
||||
extends CircularPropsPassedThroughRenderChildNodes {
|
||||
data: any;
|
||||
export interface RenderChildNodesProps extends CommonInternalProps {
|
||||
data: unknown;
|
||||
nodeType: string;
|
||||
circularCache: CircularCache;
|
||||
level: number;
|
||||
}
|
||||
|
||||
interface Range {
|
||||
|
@ -26,7 +23,7 @@ interface Range {
|
|||
|
||||
interface Entry {
|
||||
key: string | number;
|
||||
value: any;
|
||||
value: unknown;
|
||||
}
|
||||
|
||||
function isRange(rangeOrEntry: Range | Entry): rangeOrEntry is Range {
|
||||
|
@ -89,98 +86,45 @@ function renderChildNodes(
|
|||
return childNodes;
|
||||
}
|
||||
|
||||
interface Props extends CircularPropsPassedThroughJSONNestedNode {
|
||||
data: any;
|
||||
interface Props extends CommonInternalProps {
|
||||
data: unknown;
|
||||
nodeType: string;
|
||||
nodeTypeIndicator: string;
|
||||
createItemString: (data: any, collectionLimit: number) => string;
|
||||
createItemString: (data: unknown, collectionLimit: number) => string;
|
||||
expandable: boolean;
|
||||
}
|
||||
|
||||
interface State {
|
||||
expanded: boolean;
|
||||
}
|
||||
|
||||
function getStateFromProps(props: Props) {
|
||||
// calculate individual node expansion if necessary
|
||||
const expanded = !props.isCircular
|
||||
? props.shouldExpandNode(props.keyPath, props.data, props.level)
|
||||
: false;
|
||||
return {
|
||||
expanded,
|
||||
};
|
||||
}
|
||||
|
||||
export default class JSONNestedNode extends React.Component<Props, State> {
|
||||
static propTypes = {
|
||||
getItemString: PropTypes.func.isRequired,
|
||||
nodeTypeIndicator: PropTypes.any,
|
||||
nodeType: PropTypes.string.isRequired,
|
||||
data: PropTypes.any,
|
||||
hideRoot: PropTypes.bool.isRequired,
|
||||
createItemString: PropTypes.func.isRequired,
|
||||
styling: PropTypes.func.isRequired,
|
||||
collectionLimit: PropTypes.number,
|
||||
keyPath: PropTypes.arrayOf(
|
||||
PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
||||
).isRequired,
|
||||
labelRenderer: PropTypes.func.isRequired,
|
||||
shouldExpandNode: PropTypes.func,
|
||||
level: PropTypes.number.isRequired,
|
||||
sortObjectKeys: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
||||
isCircular: PropTypes.bool,
|
||||
expandable: PropTypes.bool,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
data: [],
|
||||
circularCache: [],
|
||||
level: 0,
|
||||
expandable: true,
|
||||
};
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = getStateFromProps(props);
|
||||
}
|
||||
|
||||
UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||
const nextState = getStateFromProps(nextProps);
|
||||
if (getStateFromProps(this.props).expanded !== nextState.expanded) {
|
||||
this.setState(nextState);
|
||||
}
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps: Props, nextState: State) {
|
||||
return (
|
||||
!!Object.keys(nextProps).find(
|
||||
(key) =>
|
||||
key !== 'circularCache' &&
|
||||
(key === 'keyPath'
|
||||
? nextProps[key].join('/') !== this.props[key].join('/')
|
||||
: nextProps[key as keyof Props] !== this.props[key as keyof Props])
|
||||
) || nextState.expanded !== this.state.expanded
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
export default function JSONNestedNode(props: Props) {
|
||||
const {
|
||||
getItemString,
|
||||
nodeTypeIndicator,
|
||||
nodeType,
|
||||
data,
|
||||
hideRoot,
|
||||
createItemString,
|
||||
styling,
|
||||
circularCache = [],
|
||||
collectionLimit,
|
||||
createItemString,
|
||||
data,
|
||||
expandable,
|
||||
getItemString,
|
||||
hideRoot,
|
||||
isCircular,
|
||||
keyPath,
|
||||
labelRenderer,
|
||||
expandable,
|
||||
} = this.props;
|
||||
const { expanded } = this.state;
|
||||
level = 0,
|
||||
nodeType,
|
||||
nodeTypeIndicator,
|
||||
shouldExpandNodeInitially,
|
||||
styling,
|
||||
} = props;
|
||||
|
||||
const [expanded, setExpanded] = useState<boolean>(
|
||||
// calculate individual node expansion if necessary
|
||||
isCircular ? false : shouldExpandNodeInitially(keyPath, data, level)
|
||||
);
|
||||
|
||||
const handleClick = useCallback(() => {
|
||||
if (expandable) setExpanded(!expanded);
|
||||
}, [expandable, expanded]);
|
||||
|
||||
const renderedChildren =
|
||||
expanded || (hideRoot && this.props.level === 0)
|
||||
? renderChildNodes({ ...this.props, level: this.props.level + 1 })
|
||||
expanded || (hideRoot && level === 0)
|
||||
? renderChildNodes({ ...props, circularCache, level: level + 1 })
|
||||
: null;
|
||||
|
||||
const itemType = (
|
||||
|
@ -210,18 +154,18 @@ export default class JSONNestedNode extends React.Component<Props, State> {
|
|||
styling={styling}
|
||||
nodeType={nodeType}
|
||||
expanded={expanded}
|
||||
onClick={this.handleClick}
|
||||
onClick={handleClick}
|
||||
/>
|
||||
)}
|
||||
<label
|
||||
{...styling(['label', 'nestedNodeLabel'], ...stylingArgs)}
|
||||
onClick={this.handleClick}
|
||||
onClick={handleClick}
|
||||
>
|
||||
{labelRenderer(...stylingArgs)}
|
||||
</label>
|
||||
<span
|
||||
{...styling('nestedNodeItemString', ...stylingArgs)}
|
||||
onClick={this.handleClick}
|
||||
onClick={handleClick}
|
||||
>
|
||||
{renderedItemString}
|
||||
</span>
|
||||
|
@ -230,11 +174,4 @@ export default class JSONNestedNode extends React.Component<Props, State> {
|
|||
</ul>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
handleClick = () => {
|
||||
if (this.props.expandable) {
|
||||
this.setState({ expanded: !this.state.expanded });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import objType from './objType';
|
||||
import JSONObjectNode from './JSONObjectNode';
|
||||
import JSONArrayNode from './JSONArrayNode';
|
||||
import JSONIterableNode from './JSONIterableNode';
|
||||
import JSONValueNode from './JSONValueNode';
|
||||
import { CircularPropsPassedThroughJSONNode } from './types';
|
||||
import type { CommonInternalProps } from './types';
|
||||
|
||||
interface Props extends CircularPropsPassedThroughJSONNode {
|
||||
keyPath: (string | number)[];
|
||||
value: any;
|
||||
isCustomNode: (value: any) => boolean;
|
||||
interface Props extends CommonInternalProps {
|
||||
value: unknown;
|
||||
}
|
||||
|
||||
const JSONNode: React.FunctionComponent<Props> = ({
|
||||
export default function JSONNode({
|
||||
getItemString,
|
||||
keyPath,
|
||||
labelRenderer,
|
||||
|
@ -22,7 +19,7 @@ const JSONNode: React.FunctionComponent<Props> = ({
|
|||
valueRenderer,
|
||||
isCustomNode,
|
||||
...rest
|
||||
}) => {
|
||||
}: Props) {
|
||||
const nodeType = isCustomNode(value) ? 'Custom' : objType(value);
|
||||
|
||||
const simpleNodeProps = {
|
||||
|
@ -102,18 +99,4 @@ const JSONNode: React.FunctionComponent<Props> = ({
|
|||
/>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
JSONNode.propTypes = {
|
||||
getItemString: PropTypes.func.isRequired,
|
||||
keyPath: PropTypes.arrayOf(
|
||||
PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired
|
||||
).isRequired,
|
||||
labelRenderer: PropTypes.func.isRequired,
|
||||
styling: PropTypes.func.isRequired,
|
||||
value: PropTypes.any,
|
||||
valueRenderer: PropTypes.func.isRequired,
|
||||
isCustomNode: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default JSONNode;
|
||||
}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import JSONNestedNode from './JSONNestedNode';
|
||||
import { CircularPropsPassedThroughJSONNode } from './types';
|
||||
import type { CommonInternalProps } from './types';
|
||||
|
||||
// Returns the "n Items" string for this node,
|
||||
// generating and caching it if it hasn't been created yet.
|
||||
function createItemString(data: any) {
|
||||
function createItemString(data: unknown) {
|
||||
const len = Object.getOwnPropertyNames(data).length;
|
||||
return `${len} ${len !== 1 ? 'keys' : 'key'}`;
|
||||
}
|
||||
|
||||
interface Props extends CircularPropsPassedThroughJSONNode {
|
||||
data: any;
|
||||
interface Props extends CommonInternalProps {
|
||||
data: unknown;
|
||||
nodeType: string;
|
||||
}
|
||||
|
||||
// Configures <JSONNestedNode> to render an Object
|
||||
const JSONObjectNode: React.FunctionComponent<Props> = ({ data, ...props }) => (
|
||||
export default function JSONObjectNode({ data, ...props }: Props) {
|
||||
return (
|
||||
<JSONNestedNode
|
||||
{...props}
|
||||
data={data}
|
||||
|
@ -25,11 +25,5 @@ const JSONObjectNode: React.FunctionComponent<Props> = ({ data, ...props }) => (
|
|||
createItemString={createItemString}
|
||||
expandable={Object.getOwnPropertyNames(data).length > 0}
|
||||
/>
|
||||
);
|
||||
|
||||
JSONObjectNode.propTypes = {
|
||||
data: PropTypes.object,
|
||||
nodeType: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default JSONObjectNode;
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,18 +1,30 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { JSONValueNodeCircularPropsProvidedByJSONNode } from './types';
|
||||
import type {
|
||||
GetItemString,
|
||||
Key,
|
||||
KeyPath,
|
||||
LabelRenderer,
|
||||
Styling,
|
||||
ValueRenderer,
|
||||
} from './types';
|
||||
|
||||
/**
|
||||
* Renders simple values (eg. strings, numbers, booleans, etc)
|
||||
*/
|
||||
|
||||
interface Props extends JSONValueNodeCircularPropsProvidedByJSONNode {
|
||||
interface Props {
|
||||
getItemString: GetItemString;
|
||||
key: Key;
|
||||
keyPath: KeyPath;
|
||||
labelRenderer: LabelRenderer;
|
||||
nodeType: string;
|
||||
value: any;
|
||||
valueGetter?: (value: any) => any;
|
||||
styling: Styling;
|
||||
value: unknown;
|
||||
valueRenderer: ValueRenderer;
|
||||
valueGetter?: (value: any) => unknown;
|
||||
}
|
||||
|
||||
const JSONValueNode: React.FunctionComponent<Props> = ({
|
||||
export default function JSONValueNode({
|
||||
nodeType,
|
||||
styling,
|
||||
labelRenderer,
|
||||
|
@ -20,7 +32,8 @@ const JSONValueNode: React.FunctionComponent<Props> = ({
|
|||
valueRenderer,
|
||||
value,
|
||||
valueGetter = (value) => value,
|
||||
}) => (
|
||||
}: Props) {
|
||||
return (
|
||||
<li {...styling('value', nodeType, keyPath)}>
|
||||
<label {...styling(['label', 'valueLabel'], nodeType, keyPath)}>
|
||||
{labelRenderer(keyPath, nodeType, false, false)}
|
||||
|
@ -29,18 +42,5 @@ const JSONValueNode: React.FunctionComponent<Props> = ({
|
|||
{valueRenderer(valueGetter(value), value, ...keyPath)}
|
||||
</span>
|
||||
</li>
|
||||
);
|
||||
|
||||
JSONValueNode.propTypes = {
|
||||
nodeType: PropTypes.string.isRequired,
|
||||
styling: PropTypes.func.isRequired,
|
||||
labelRenderer: PropTypes.func.isRequired,
|
||||
keyPath: PropTypes.arrayOf(
|
||||
PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired
|
||||
).isRequired,
|
||||
valueRenderer: PropTypes.func.isRequired,
|
||||
value: PropTypes.any,
|
||||
valueGetter: PropTypes.func,
|
||||
};
|
||||
|
||||
export default JSONValueNode;
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
import type { CurriedFunction1 } from 'lodash';
|
||||
import {
|
||||
import { createStyling } from 'react-base16-styling';
|
||||
import type {
|
||||
Base16Theme,
|
||||
createStyling,
|
||||
StylingConfig,
|
||||
StylingFunction,
|
||||
Theme,
|
||||
} from 'react-base16-styling';
|
||||
import solarized from './themes/solarized';
|
||||
import { StylingFunction, Theme } from 'react-base16-styling/src';
|
||||
|
||||
const colorMap = (theme: Base16Theme) => ({
|
||||
BACKGROUND_COLOR: theme.base00,
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
function getLength(type: string, collection: any) {
|
||||
import type { SortObjectKeys } from './types';
|
||||
|
||||
function getLength(type: string, collection: unknown) {
|
||||
if (type === 'Object') {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
return Object.keys(collection as {}).length;
|
||||
|
@ -9,17 +11,17 @@ function getLength(type: string, collection: any) {
|
|||
return Infinity;
|
||||
}
|
||||
|
||||
function isIterableMap(collection: any) {
|
||||
return typeof (collection as Map<any, any>).set === 'function';
|
||||
function isIterableMap(collection: unknown) {
|
||||
return typeof (collection as Map<unknown, unknown>).set === 'function';
|
||||
}
|
||||
|
||||
function getEntries(
|
||||
type: string,
|
||||
collection: any,
|
||||
sortObjectKeys?: ((a: any, b: any) => number) | boolean | undefined,
|
||||
sortObjectKeys: SortObjectKeys,
|
||||
from = 0,
|
||||
to = Infinity
|
||||
): { entries: { key: string | number; value: any }[]; hasMore?: boolean } {
|
||||
): { entries: { key: string | number; value: unknown }[]; hasMore?: boolean } {
|
||||
let res;
|
||||
|
||||
if (type === 'Object') {
|
||||
|
@ -95,8 +97,8 @@ function getRanges(from: number, to: number, limit: number) {
|
|||
|
||||
export default function getCollectionEntries(
|
||||
type: string,
|
||||
collection: any,
|
||||
sortObjectKeys: ((a: any, b: any) => number) | boolean | undefined,
|
||||
collection: unknown,
|
||||
sortObjectKeys: SortObjectKeys,
|
||||
limit: number,
|
||||
from = 0,
|
||||
to = Infinity
|
||||
|
|
|
@ -3,177 +3,88 @@
|
|||
// Dave Vedder <veddermatic@gmail.com> http://www.eskimospy.com/
|
||||
// port by Daniele Zannotti http://www.github.com/dzannotti <dzannotti@me.com>
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { useMemo } from 'react';
|
||||
import JSONNode from './JSONNode';
|
||||
import createStylingFromTheme from './createStylingFromTheme';
|
||||
import { invertTheme } from 'react-base16-styling';
|
||||
import type { StylingValue, Theme } from 'react-base16-styling';
|
||||
import type {
|
||||
StylingConfig,
|
||||
StylingFunction,
|
||||
StylingValue,
|
||||
Theme,
|
||||
} from 'react-base16-styling';
|
||||
import { CircularPropsPassedThroughJSONTree } from './types';
|
||||
CommonExternalProps,
|
||||
GetItemString,
|
||||
IsCustomNode,
|
||||
LabelRenderer,
|
||||
ShouldExpandNodeInitially,
|
||||
} from './types';
|
||||
|
||||
interface Props extends CircularPropsPassedThroughJSONTree {
|
||||
data: any;
|
||||
interface Props extends Partial<CommonExternalProps> {
|
||||
data: unknown;
|
||||
theme?: Theme;
|
||||
invertTheme: boolean;
|
||||
}
|
||||
|
||||
interface State {
|
||||
styling: StylingFunction;
|
||||
invertTheme?: boolean;
|
||||
}
|
||||
|
||||
const identity = (value: any) => value;
|
||||
const expandRootNode = (
|
||||
keyPath: (string | number)[],
|
||||
data: any,
|
||||
level: number
|
||||
) => level === 0;
|
||||
const defaultItemString = (
|
||||
type: string,
|
||||
data: any,
|
||||
itemType: React.ReactNode,
|
||||
itemString: string
|
||||
) => (
|
||||
const expandRootNode: ShouldExpandNodeInitially = (keyPath, data, level) =>
|
||||
level === 0;
|
||||
const defaultItemString: GetItemString = (type, data, itemType, itemString) => (
|
||||
<span>
|
||||
{itemType} {itemString}
|
||||
</span>
|
||||
);
|
||||
const defaultLabelRenderer = ([label]: (string | number)[]) => (
|
||||
<span>{label}:</span>
|
||||
);
|
||||
const noCustomNode = () => false;
|
||||
const defaultLabelRenderer: LabelRenderer = ([label]) => <span>{label}:</span>;
|
||||
const noCustomNode: IsCustomNode = () => false;
|
||||
|
||||
function checkLegacyTheming(theme: Theme | undefined, props: Props) {
|
||||
const deprecatedStylingMethodsMap = {
|
||||
getArrowStyle: 'arrow',
|
||||
getListStyle: 'nestedNodeChildren',
|
||||
getItemStringStyle: 'nestedNodeItemString',
|
||||
getLabelStyle: 'label',
|
||||
getValueStyle: 'valueText',
|
||||
};
|
||||
|
||||
const deprecatedStylingMethods = Object.keys(
|
||||
deprecatedStylingMethodsMap
|
||||
).filter((name) => props[name as keyof Props]);
|
||||
|
||||
if (deprecatedStylingMethods.length > 0) {
|
||||
if (typeof theme === 'string') {
|
||||
theme = {
|
||||
extend: theme,
|
||||
};
|
||||
} else {
|
||||
theme = { ...theme };
|
||||
}
|
||||
|
||||
deprecatedStylingMethods.forEach((name) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(
|
||||
`Styling method "${name}" is deprecated, use "theme" property instead`
|
||||
);
|
||||
|
||||
(theme as StylingConfig)[
|
||||
deprecatedStylingMethodsMap[
|
||||
name as keyof typeof deprecatedStylingMethodsMap
|
||||
]
|
||||
] = ({ style }, ...args) => ({
|
||||
style: {
|
||||
...style,
|
||||
...props[name as keyof Props](...args),
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return theme;
|
||||
}
|
||||
|
||||
function getStateFromProps(props: Props) {
|
||||
let theme = checkLegacyTheming(props.theme, props);
|
||||
if (props.invertTheme) {
|
||||
theme = invertTheme(theme);
|
||||
}
|
||||
|
||||
return {
|
||||
styling: createStylingFromTheme(theme),
|
||||
};
|
||||
}
|
||||
|
||||
export class JSONTree extends React.Component<Props, State> {
|
||||
static propTypes = {
|
||||
data: PropTypes.any,
|
||||
hideRoot: PropTypes.bool,
|
||||
theme: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
||||
invertTheme: PropTypes.bool,
|
||||
keyPath: PropTypes.arrayOf(
|
||||
PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
||||
),
|
||||
postprocessValue: PropTypes.func,
|
||||
sortObjectKeys: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
shouldExpandNode: expandRootNode,
|
||||
hideRoot: false,
|
||||
keyPath: ['root'],
|
||||
getItemString: defaultItemString,
|
||||
labelRenderer: defaultLabelRenderer,
|
||||
valueRenderer: identity,
|
||||
postprocessValue: identity,
|
||||
isCustomNode: noCustomNode,
|
||||
collectionLimit: 50,
|
||||
invertTheme: true,
|
||||
};
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = getStateFromProps(props);
|
||||
}
|
||||
|
||||
UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||
if (
|
||||
['theme', 'invertTheme'].find(
|
||||
(k) => nextProps[k as keyof Props] !== this.props[k as keyof Props]
|
||||
)
|
||||
) {
|
||||
this.setState(getStateFromProps(nextProps));
|
||||
}
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps: Props) {
|
||||
return !!Object.keys(nextProps).find((k) =>
|
||||
k === 'keyPath'
|
||||
? nextProps[k].join('/') !== this.props[k].join('/')
|
||||
: nextProps[k as keyof Props] !== this.props[k as keyof Props]
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
export function JSONTree({
|
||||
data: value,
|
||||
keyPath,
|
||||
postprocessValue,
|
||||
hideRoot,
|
||||
theme, // eslint-disable-line no-unused-vars
|
||||
invertTheme: _, // eslint-disable-line no-unused-vars
|
||||
...rest
|
||||
} = this.props;
|
||||
|
||||
const { styling } = this.state;
|
||||
theme,
|
||||
invertTheme: shouldInvertTheme,
|
||||
keyPath = ['root'],
|
||||
labelRenderer = defaultLabelRenderer,
|
||||
valueRenderer = identity,
|
||||
shouldExpandNodeInitially = expandRootNode,
|
||||
hideRoot = false,
|
||||
getItemString = defaultItemString,
|
||||
postprocessValue = identity,
|
||||
isCustomNode = noCustomNode,
|
||||
collectionLimit = 50,
|
||||
sortObjectKeys = false,
|
||||
}: Props) {
|
||||
const styling = useMemo(
|
||||
() =>
|
||||
createStylingFromTheme(shouldInvertTheme ? invertTheme(theme) : theme),
|
||||
[theme, shouldInvertTheme]
|
||||
);
|
||||
|
||||
return (
|
||||
<ul {...styling('tree')}>
|
||||
<JSONNode
|
||||
{...{ postprocessValue, hideRoot, styling, ...rest }}
|
||||
keyPath={hideRoot ? [] : keyPath}
|
||||
value={postprocessValue(value)}
|
||||
isCustomNode={isCustomNode}
|
||||
styling={styling}
|
||||
labelRenderer={labelRenderer}
|
||||
valueRenderer={valueRenderer}
|
||||
shouldExpandNodeInitially={shouldExpandNodeInitially}
|
||||
hideRoot={hideRoot}
|
||||
getItemString={getItemString}
|
||||
postprocessValue={postprocessValue}
|
||||
collectionLimit={collectionLimit}
|
||||
sortObjectKeys={sortObjectKeys}
|
||||
/>
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export { StylingValue };
|
||||
export type {
|
||||
Key,
|
||||
KeyPath,
|
||||
GetItemString,
|
||||
LabelRenderer,
|
||||
ValueRenderer,
|
||||
ShouldExpandNodeInitially,
|
||||
PostprocessValue,
|
||||
IsCustomNode,
|
||||
SortObjectKeys,
|
||||
Styling,
|
||||
CommonExternalProps,
|
||||
} from './types';
|
||||
export type { StylingValue };
|
||||
|
|
|
@ -1,81 +1,63 @@
|
|||
import React from 'react';
|
||||
import { StylingFunction } from 'react-base16-styling';
|
||||
|
||||
interface SharedCircularPropsPassedThroughJSONTree {
|
||||
keyPath: (string | number)[];
|
||||
labelRenderer: (
|
||||
keyPath: (string | number)[],
|
||||
export type Key = string | number;
|
||||
|
||||
export type KeyPath = readonly (string | number)[];
|
||||
|
||||
export type GetItemString = (
|
||||
nodeType: string,
|
||||
data: unknown,
|
||||
itemType: React.ReactNode,
|
||||
itemString: string,
|
||||
keyPath: KeyPath
|
||||
) => React.ReactNode;
|
||||
|
||||
export type LabelRenderer = (
|
||||
keyPath: KeyPath,
|
||||
nodeType: string,
|
||||
expanded: boolean,
|
||||
expandable: boolean
|
||||
) => React.ReactNode;
|
||||
}
|
||||
interface SharedCircularPropsProvidedByJSONTree
|
||||
extends SharedCircularPropsPassedThroughJSONTree {
|
||||
styling: StylingFunction;
|
||||
}
|
||||
interface JSONValueNodeCircularPropsPassedThroughJSONTree {
|
||||
valueRenderer: (
|
||||
valueAsString: any,
|
||||
value: any,
|
||||
...keyPath: (string | number)[]
|
||||
) => React.ReactNode;
|
||||
}
|
||||
export type JSONValueNodeCircularPropsProvidedByJSONNode =
|
||||
SharedCircularPropsProvidedByJSONTree &
|
||||
JSONValueNodeCircularPropsPassedThroughJSONTree;
|
||||
) => React.ReactNode;
|
||||
|
||||
interface JSONNestedNodeCircularPropsPassedThroughJSONTree {
|
||||
shouldExpandNode: (
|
||||
keyPath: (string | number)[],
|
||||
data: any,
|
||||
export type ValueRenderer = (
|
||||
valueAsString: unknown,
|
||||
value: unknown,
|
||||
...keyPath: KeyPath
|
||||
) => React.ReactNode;
|
||||
|
||||
export type ShouldExpandNodeInitially = (
|
||||
keyPath: KeyPath,
|
||||
data: unknown,
|
||||
level: number
|
||||
) => boolean;
|
||||
) => boolean;
|
||||
|
||||
export type PostprocessValue = (value: unknown) => unknown;
|
||||
|
||||
export type IsCustomNode = (value: unknown) => boolean;
|
||||
|
||||
export type SortObjectKeys = ((a: unknown, b: unknown) => number) | boolean;
|
||||
|
||||
export type Styling = StylingFunction;
|
||||
|
||||
export type CircularCache = unknown[];
|
||||
|
||||
export interface CommonExternalProps {
|
||||
keyPath: KeyPath;
|
||||
labelRenderer: LabelRenderer;
|
||||
valueRenderer: ValueRenderer;
|
||||
shouldExpandNodeInitially: ShouldExpandNodeInitially;
|
||||
hideRoot: boolean;
|
||||
getItemString: (
|
||||
nodeType: string,
|
||||
data: any,
|
||||
itemType: React.ReactNode,
|
||||
itemString: string,
|
||||
keyPath: (string | number)[]
|
||||
) => React.ReactNode;
|
||||
postprocessValue: (value: any) => any;
|
||||
isCustomNode: (value: any) => boolean;
|
||||
getItemString: GetItemString;
|
||||
postprocessValue: PostprocessValue;
|
||||
isCustomNode: IsCustomNode;
|
||||
collectionLimit: number;
|
||||
sortObjectKeys?: ((a: any, b: any) => number) | boolean;
|
||||
sortObjectKeys: SortObjectKeys;
|
||||
}
|
||||
export type CircularPropsPassedThroughJSONTree =
|
||||
SharedCircularPropsPassedThroughJSONTree &
|
||||
JSONValueNodeCircularPropsPassedThroughJSONTree &
|
||||
JSONNestedNodeCircularPropsPassedThroughJSONTree;
|
||||
|
||||
interface JSONNestedNodeCircularPropsPassedThroughJSONNode
|
||||
extends JSONNestedNodeCircularPropsPassedThroughJSONTree {
|
||||
circularCache?: any[];
|
||||
isCircular?: boolean;
|
||||
export interface CommonInternalProps extends CommonExternalProps {
|
||||
styling: StylingFunction;
|
||||
circularCache?: CircularCache;
|
||||
level?: number;
|
||||
isCircular?: boolean;
|
||||
}
|
||||
export type CircularPropsPassedThroughJSONNode =
|
||||
SharedCircularPropsProvidedByJSONTree &
|
||||
JSONValueNodeCircularPropsPassedThroughJSONTree &
|
||||
JSONNestedNodeCircularPropsPassedThroughJSONNode;
|
||||
|
||||
export interface JSONNestedNodeCircularPropsPassedThroughJSONNestedNode
|
||||
extends JSONNestedNodeCircularPropsPassedThroughJSONNode {
|
||||
circularCache: any[];
|
||||
level: number;
|
||||
}
|
||||
export type CircularPropsPassedThroughJSONNestedNode =
|
||||
SharedCircularPropsProvidedByJSONTree &
|
||||
JSONValueNodeCircularPropsPassedThroughJSONTree &
|
||||
JSONNestedNodeCircularPropsPassedThroughJSONNestedNode;
|
||||
|
||||
export type CircularPropsPassedThroughRenderChildNodes =
|
||||
SharedCircularPropsProvidedByJSONTree &
|
||||
JSONValueNodeCircularPropsPassedThroughJSONTree &
|
||||
JSONNestedNodeCircularPropsPassedThroughJSONNestedNode;
|
||||
|
||||
export type CircularPropsPassedThroughItemRange =
|
||||
SharedCircularPropsProvidedByJSONTree &
|
||||
JSONValueNodeCircularPropsPassedThroughJSONTree &
|
||||
JSONNestedNodeCircularPropsPassedThroughJSONNestedNode;
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
# Change Log
|
||||
|
||||
## 2.2.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [b323f77d]
|
||||
- Updated dependencies [b323f77d]
|
||||
- d3-state-visualizer@2.0.0
|
||||
- @redux-devtools/chart-monitor@4.0.0
|
||||
- @redux-devtools/inspector-monitor@3.0.2
|
||||
- @redux-devtools/log-monitor@4.0.2
|
||||
- @redux-devtools/rtk-query-monitor@3.1.1
|
||||
|
||||
## 2.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
|
|
@ -6,7 +6,10 @@ module.exports = {
|
|||
'\\.css$': '<rootDir>/test/__mocks__/styleMock.ts',
|
||||
},
|
||||
transform: {
|
||||
'^.+\\.jsx?$': 'babel-jest',
|
||||
'^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.test.json' }],
|
||||
},
|
||||
resolver: '<rootDir>/jestResolver.js',
|
||||
transformIgnorePatterns: [
|
||||
'node_modules/(?!.pnpm|d3|dateformat|delaunator|internmap|nanoid|robust-predicates|uuid)',
|
||||
],
|
||||
};
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
module.exports = (path, options) => {
|
||||
return options.defaultResolver(path, {
|
||||
...options,
|
||||
packageFilter: (pkg) => {
|
||||
if (pkg.name === 'nanoid') {
|
||||
pkg.exports['.'].browser = pkg.exports['.'].require;
|
||||
}
|
||||
if (pkg.name === 'uuid' && pkg.version.startsWith('8.')) {
|
||||
delete pkg.exports;
|
||||
delete pkg.module;
|
||||
}
|
||||
return pkg;
|
||||
},
|
||||
});
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@redux-devtools/app",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.1",
|
||||
"description": "Redux DevTools app",
|
||||
"homepage": "https://github.com/reduxjs/redux-devtools/tree/master/packages/redux-devtools-app",
|
||||
"bugs": {
|
||||
|
@ -40,19 +40,19 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint && pnpm run test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@redux-devtools/chart-monitor": "^3.0.0",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"@redux-devtools/chart-monitor": "^4.0.0",
|
||||
"@redux-devtools/core": "^3.13.0",
|
||||
"@redux-devtools/inspector-monitor": "^3.0.0",
|
||||
"@redux-devtools/inspector-monitor": "^3.0.2",
|
||||
"@redux-devtools/inspector-monitor-test-tab": "^1.0.0",
|
||||
"@redux-devtools/inspector-monitor-trace-tab": "^1.0.0",
|
||||
"@redux-devtools/log-monitor": "^4.0.0",
|
||||
"@redux-devtools/rtk-query-monitor": "^3.0.0",
|
||||
"@redux-devtools/log-monitor": "^4.0.2",
|
||||
"@redux-devtools/rtk-query-monitor": "^3.1.1",
|
||||
"@redux-devtools/slider-monitor": "^4.0.0",
|
||||
"@redux-devtools/ui": "^1.3.0",
|
||||
"@reduxjs/toolkit": "^1.9.1",
|
||||
"@types/prop-types": "^15.7.5",
|
||||
"d3-state-visualizer": "^1.6.0",
|
||||
"d3-state-visualizer": "^2.0.0",
|
||||
"javascript-stringify": "^2.1.0",
|
||||
"jsan": "^3.1.14",
|
||||
"jsondiffpatch": "^0.4.1",
|
||||
|
@ -67,8 +67,8 @@
|
|||
"socketcluster-client": "^17.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
|
@ -77,25 +77,25 @@
|
|||
"@rjsf/core": "^4.2.3",
|
||||
"@testing-library/jest-dom": "^5.16.5",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@types/jest": "^29.2.4",
|
||||
"@types/jest": "^29.2.5",
|
||||
"@types/jsan": "^3.1.2",
|
||||
"@types/json-schema": "^7.0.11",
|
||||
"@types/lodash": "^4.14.191",
|
||||
"@types/node": "^18.11.17",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/react": "^18.0.26",
|
||||
"@types/react-dom": "^18.0.9",
|
||||
"@types/react-dom": "^18.0.10",
|
||||
"@types/socketcluster-client": "^16.0.0",
|
||||
"@types/styled-components": "^5.1.26",
|
||||
"@types/testing-library__jest-dom": "^5.14.5",
|
||||
"@types/webpack-env": "^1.18.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"babel-loader": "^9.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"babel-loader": "^9.1.2",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-loader": "^6.7.3",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-jest": "^27.1.7",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"fork-ts-checker-webpack-plugin": "^7.2.14",
|
||||
|
|
|
@ -1,5 +1,19 @@
|
|||
# Change Log
|
||||
|
||||
## 4.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- b323f77d: Upgrade D3
|
||||
|
||||
- Split `style` option into `chartStyles`, `nodeStyleOptions`, `textStyleOptions`, and `linkStyles`.
|
||||
- The shape of the argument passed to the `onClickText` option has been updated.
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [b323f77d]
|
||||
- d3-state-visualizer@2.0.0
|
||||
|
||||
## 3.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@redux-devtools/chart-monitor",
|
||||
"version": "3.0.1",
|
||||
"version": "4.0.0",
|
||||
"description": "Chart monitor for Redux DevTools",
|
||||
"keywords": [
|
||||
"redux",
|
||||
|
@ -39,15 +39,15 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"@types/redux-devtools-themes": "^1.0.0",
|
||||
"d3-state-visualizer": "^1.6.0",
|
||||
"d3-state-visualizer": "^2.0.0",
|
||||
"deepmerge": "^4.2.2",
|
||||
"redux-devtools-themes": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
|
@ -55,10 +55,10 @@
|
|||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@redux-devtools/core": "^3.13.1",
|
||||
"@types/react": "^18.0.26",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"react": "^18.2.0",
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#! /usr/bin/env node
|
||||
|
||||
require('../dist/bin/redux-devtools.js');
|
||||
import '../dist/bin/redux-devtools.js';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = {
|
||||
export default {
|
||||
preset: 'ts-jest',
|
||||
transform: {
|
||||
'^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.test.json' }],
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
"index.js",
|
||||
"defaultDbOptions.json"
|
||||
],
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"bin": {
|
||||
|
@ -37,22 +38,22 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint && pnpm run test"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.15.0"
|
||||
"node": "^14.13.1 || ^16.13.0 || >= 18.12.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apollo/server": "^4.3.0",
|
||||
"@redux-devtools/app": "^2.1.3",
|
||||
"@types/react": "^18.0.26",
|
||||
"apollo-server-express": "^3.11.1",
|
||||
"body-parser": "^1.20.1",
|
||||
"chalk": "^4.1.2",
|
||||
"chalk": "^5.2.0",
|
||||
"cors": "^2.8.5",
|
||||
"cross-spawn": "^7.0.3",
|
||||
"electron": "^22.0.0",
|
||||
"express": "^4.18.2",
|
||||
"getport": "^0.1.0",
|
||||
"get-port": "^6.1.2",
|
||||
"graphql": "^16.6.0",
|
||||
"knex": "^2.3.0",
|
||||
"lodash": "^4.17.21",
|
||||
"knex": "^2.4.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"minimist": "^1.2.7",
|
||||
"morgan": "^1.10.0",
|
||||
"open": "^8.4.0",
|
||||
|
@ -70,22 +71,22 @@
|
|||
"@types/cors": "^2.8.13",
|
||||
"@types/cross-spawn": "^6.0.2",
|
||||
"@types/express": "^4.17.15",
|
||||
"@types/jest": "^29.2.4",
|
||||
"@types/lodash": "^4.14.191",
|
||||
"@types/jest": "^29.2.5",
|
||||
"@types/lodash-es": "^4.17.6",
|
||||
"@types/minimist": "^1.2.2",
|
||||
"@types/morgan": "^1.9.3",
|
||||
"@types/node": "^18.11.17",
|
||||
"@types/morgan": "^1.9.4",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/semver": "^7.3.13",
|
||||
"@types/socketcluster-client": "^16.0.0",
|
||||
"@types/socketcluster-server": "^16.1.0",
|
||||
"@types/styled-components": "^5.1.26",
|
||||
"@types/supertest": "^2.0.12",
|
||||
"@types/uuid": "^9.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-jest": "^27.1.7",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"jest": "^29.3.1",
|
||||
"ncp": "^2.0.0",
|
||||
"rimraf": "^3.0.2",
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import fs from 'fs';
|
||||
import { Store } from '../store';
|
||||
import type { Store } from '../store.js';
|
||||
|
||||
export const schema = fs
|
||||
.readFileSync(require.resolve('./schema_def.graphql'))
|
||||
.toString();
|
||||
export const schema = fs.readFileSync(
|
||||
new URL('./schema_def.graphql', import.meta.url),
|
||||
'utf8'
|
||||
);
|
||||
|
||||
export const resolvers = {
|
||||
Query: {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import semver from 'semver';
|
||||
import { Options } from '../options';
|
||||
import type { Options } from '../options.js';
|
||||
|
||||
const name = '@redux-devtools/cli';
|
||||
const startFlag = '/* ' + name + ' start */';
|
||||
|
@ -56,7 +56,7 @@ export function inject(
|
|||
startFlag,
|
||||
' require("' + name + '")(' + JSON.stringify(options) + ')',
|
||||
' .then(_remotedev =>',
|
||||
' _remotedev.on("ready", () => {',
|
||||
' _remotedev.ready.then(() => {',
|
||||
' if (!_remotedev.portAlreadyUsed) console.log("-".repeat(80));',
|
||||
' ' + serverFlag,
|
||||
' })',
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
import open from 'open';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { createRequire } from 'module';
|
||||
import spawn from 'cross-spawn';
|
||||
import { Options } from '../options';
|
||||
import type { Options } from '../options.js';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
export default async function openApp(app: true | string, options: Options) {
|
||||
if (app === true || app === 'electron') {
|
||||
|
@ -11,8 +15,13 @@ export default async function openApp(app: true | string, options: Options) {
|
|||
const protocol = options.protocol ? `--protocol=${options.protocol}` : '';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
spawn.sync(require('electron') as string, [
|
||||
path.join(__dirname, '..', '..', 'app'),
|
||||
spawn(require('electron') as string, [
|
||||
path.join(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
'..',
|
||||
'..',
|
||||
'app'
|
||||
),
|
||||
port,
|
||||
host,
|
||||
protocol,
|
||||
|
|
|
@ -3,10 +3,10 @@ import fs from 'fs';
|
|||
import path from 'path';
|
||||
import parseArgs from 'minimist';
|
||||
import chalk from 'chalk';
|
||||
import * as injectServer from './injectServer';
|
||||
import getOptions from '../options';
|
||||
import server from '../index';
|
||||
import openApp from './openApp';
|
||||
import * as injectServer from './injectServer.js';
|
||||
import getOptions from '../options.js';
|
||||
import server from '../index.js';
|
||||
import openApp from './openApp.js';
|
||||
|
||||
const argv = parseArgs(process.argv.slice(2));
|
||||
|
||||
|
@ -87,10 +87,8 @@ if (argv.injectserver) {
|
|||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
server(argv).then(async function (r) {
|
||||
if (argv.open && argv.open !== 'false') {
|
||||
await r.listener('ready').once();
|
||||
const response = await server(argv);
|
||||
if (argv.open && argv.open !== 'false') {
|
||||
await response.ready;
|
||||
await openApp(argv.open as string, options);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,23 +1,37 @@
|
|||
import path from 'path';
|
||||
import knexModule, { Knex } from 'knex';
|
||||
import { fileURLToPath } from 'url';
|
||||
import knex from 'knex';
|
||||
import type { Knex } from 'knex';
|
||||
import { AGServer } from 'socketcluster-server';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
type KnexFunction = <TRecord extends {} = any, TResult = unknown[]>(
|
||||
config: Knex.Config | string
|
||||
) => Knex<TRecord, TResult>;
|
||||
|
||||
export default function connector(options: AGServer.AGServerOptions) {
|
||||
const dbOptions = options.dbOptions as Knex.Config;
|
||||
dbOptions.useNullAsDefault = true;
|
||||
if (!(dbOptions as any).migrate) {
|
||||
return knexModule(dbOptions);
|
||||
return (knex as unknown as KnexFunction)(dbOptions);
|
||||
}
|
||||
|
||||
dbOptions.migrations = { directory: path.resolve(__dirname, 'migrations') };
|
||||
dbOptions.seeds = { directory: path.resolve(__dirname, 'seeds') };
|
||||
const knex = knexModule(dbOptions);
|
||||
dbOptions.migrations = {
|
||||
directory: path.join(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
'migrations'
|
||||
),
|
||||
};
|
||||
dbOptions.seeds = {
|
||||
directory: path.join(path.dirname(fileURLToPath(import.meta.url)), 'seeds'),
|
||||
};
|
||||
const knexInstance = (knex as unknown as KnexFunction)(dbOptions);
|
||||
|
||||
/* eslint-disable no-console */
|
||||
knex.migrate
|
||||
knexInstance.migrate
|
||||
.latest({ loadExtensions: ['.js'] })
|
||||
.then(function () {
|
||||
return knex.seed.run({ loadExtensions: ['.js'] });
|
||||
return knexInstance.seed.run({ loadExtensions: ['.js'] });
|
||||
})
|
||||
.then(function () {
|
||||
console.log(' \x1b[0;32m[Done]\x1b[0m Migrations are finished\n');
|
||||
|
@ -27,5 +41,5 @@ export default function connector(options: AGServer.AGServerOptions) {
|
|||
});
|
||||
/* eslint-enable no-console */
|
||||
|
||||
return knex;
|
||||
return knexInstance;
|
||||
}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
declare module 'getport' {
|
||||
export default function getport(
|
||||
start: number,
|
||||
callback: (e: Error | undefined, port: number) => void
|
||||
): void;
|
||||
}
|
|
@ -1,23 +1,19 @@
|
|||
import express from 'express';
|
||||
import http from 'http';
|
||||
import getPort from 'getport';
|
||||
import getPort from 'get-port';
|
||||
import socketClusterServer from 'socketcluster-server';
|
||||
import getOptions, { Options } from './options';
|
||||
import routes from './routes';
|
||||
import createStore from './store';
|
||||
import getOptions from './options.js';
|
||||
import routes from './routes.js';
|
||||
import createStore from './store.js';
|
||||
|
||||
// var LOG_LEVEL_NONE = 0;
|
||||
const LOG_LEVEL_ERROR = 1;
|
||||
// const LOG_LEVEL_NONE = 0;
|
||||
// const LOG_LEVEL_ERROR = 1;
|
||||
const LOG_LEVEL_WARN = 2;
|
||||
const LOG_LEVEL_INFO = 3;
|
||||
|
||||
export interface ExtendedOptions extends Options {
|
||||
allowClientPublish: boolean;
|
||||
}
|
||||
|
||||
export default function (argv: { [arg: string]: any }): Promise<{
|
||||
export default async function (argv: { [arg: string]: any }): Promise<{
|
||||
portAlreadyUsed?: boolean;
|
||||
listener: (eventName: 'ready') => { once(): Promise<void> };
|
||||
ready: Promise<void>;
|
||||
}> {
|
||||
const options = Object.assign(getOptions(argv), {
|
||||
allowClientPublish: false,
|
||||
|
@ -25,31 +21,18 @@ export default function (argv: { [arg: string]: any }): Promise<{
|
|||
const port = options.port;
|
||||
const logLevel =
|
||||
options.logLevel === undefined ? LOG_LEVEL_INFO : options.logLevel;
|
||||
return new Promise(function (resolve) {
|
||||
// Check port already used
|
||||
getPort(port, function (err, p) {
|
||||
/* eslint-disable no-console */
|
||||
if (err) {
|
||||
if (logLevel >= LOG_LEVEL_ERROR) {
|
||||
console.error(err);
|
||||
}
|
||||
return;
|
||||
}
|
||||
const p = await getPort({ port });
|
||||
if (port !== p) {
|
||||
if (logLevel >= LOG_LEVEL_WARN) {
|
||||
console.log(`[ReduxDevTools] Server port ${port} is already used.`);
|
||||
}
|
||||
resolve({
|
||||
portAlreadyUsed: true,
|
||||
listener: function (eventName: 'ready') {
|
||||
return {
|
||||
once() {
|
||||
return Promise.resolve();
|
||||
},
|
||||
portAlreadyUsed: true,
|
||||
ready: Promise.resolve(),
|
||||
};
|
||||
},
|
||||
});
|
||||
} else {
|
||||
}
|
||||
|
||||
if (logLevel >= LOG_LEVEL_INFO) {
|
||||
console.log('[ReduxDevTools] Start server...');
|
||||
console.log('-'.repeat(80) + '\n');
|
||||
|
@ -146,10 +129,9 @@ export default function (argv: { [arg: string]: any }): Promise<{
|
|||
})();
|
||||
|
||||
httpServer.listen(options.port);
|
||||
// @ts-expect-error Shouldn't there be a 'ready' event?
|
||||
resolve(agServer);
|
||||
}
|
||||
/* eslint-enable no-console */
|
||||
});
|
||||
});
|
||||
return {
|
||||
ready: (async () => {
|
||||
await agServer.listener('ready' as 'error').once();
|
||||
})(),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
import { ApolloServer } from 'apollo-server-express';
|
||||
import { schema, resolvers } from '../api/schema';
|
||||
import { Store } from '../store';
|
||||
|
||||
export default function (store: Store) {
|
||||
return new ApolloServer({
|
||||
typeDefs: schema,
|
||||
resolvers,
|
||||
context: {
|
||||
store: store,
|
||||
},
|
||||
});
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
interface ProtocolOptions {
|
||||
key: string | undefined;
|
||||
|
@ -31,9 +31,14 @@ export interface Options {
|
|||
export default function getOptions(argv: { [arg: string]: any }): Options {
|
||||
let dbOptions = argv.dbOptions;
|
||||
if (typeof dbOptions === 'string') {
|
||||
dbOptions = require(path.resolve(process.cwd(), argv.dbOptions as string));
|
||||
dbOptions = JSON.parse(fs.readFileSync(dbOptions, 'utf8'));
|
||||
} else if (typeof dbOptions === 'undefined') {
|
||||
dbOptions = require('../defaultDbOptions.json');
|
||||
dbOptions = JSON.parse(
|
||||
fs.readFileSync(
|
||||
new URL('../defaultDbOptions.json', import.meta.url),
|
||||
'utf8'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import path from 'path';
|
||||
import { createRequire } from 'module';
|
||||
import { fileURLToPath } from 'url';
|
||||
import express from 'express';
|
||||
import type { Router } from 'express';
|
||||
import morgan from 'morgan';
|
||||
|
@ -6,12 +8,15 @@ import * as http from 'http';
|
|||
import bodyParser from 'body-parser';
|
||||
import cors from 'cors';
|
||||
import { AGServer } from 'socketcluster-server';
|
||||
import { ApolloServer } from 'apollo-server-express';
|
||||
import { AddData, ReportBaseFields, Store } from './store';
|
||||
import { resolvers, schema } from './api/schema';
|
||||
import { ApolloServer } from '@apollo/server';
|
||||
import { expressMiddleware } from '@apollo/server/express4';
|
||||
import type { AddData, ReportBaseFields, Store } from './store.js';
|
||||
import { resolvers, schema } from './api/schema.js';
|
||||
|
||||
const app = express.Router();
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
function serveUmdModule(name: string) {
|
||||
app.use(
|
||||
express.static(
|
||||
|
@ -20,6 +25,10 @@ function serveUmdModule(name: string) {
|
|||
);
|
||||
}
|
||||
|
||||
interface Context {
|
||||
store?: Store;
|
||||
}
|
||||
|
||||
function routes(
|
||||
options: AGServer.AGServerOptions,
|
||||
store: Store,
|
||||
|
@ -42,19 +51,19 @@ function routes(
|
|||
else app.use(morgan('combined'));
|
||||
}
|
||||
|
||||
const server = new ApolloServer({
|
||||
const server = new ApolloServer<Context>({
|
||||
typeDefs: schema,
|
||||
resolvers,
|
||||
context: {
|
||||
store: store,
|
||||
},
|
||||
});
|
||||
server
|
||||
.start()
|
||||
.then(() => {
|
||||
server.applyMiddleware({ app } as {
|
||||
app: express.Application;
|
||||
});
|
||||
app.use(
|
||||
'/graphql',
|
||||
cors<cors.CorsRequest>(),
|
||||
bodyParser.json(),
|
||||
expressMiddleware(server, { context: () => Promise.resolve({ store }) })
|
||||
);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error); // eslint-disable-line no-console
|
||||
|
@ -69,7 +78,12 @@ function routes(
|
|||
res.send(`reduxDevToolsPort = ${options.port}`);
|
||||
});
|
||||
app.get('*', function (req, res) {
|
||||
res.sendFile(path.join(__dirname, '../app/index.html'));
|
||||
res.sendFile(
|
||||
path.join(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
'../app/index.html'
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
app.use(cors({ methods: 'POST' }));
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { v4 as uuidV4 } from 'uuid';
|
||||
import pick from 'lodash/pick';
|
||||
import { pick } from 'lodash-es';
|
||||
import { AGServer } from 'socketcluster-server';
|
||||
import { Knex } from 'knex';
|
||||
import connector from './db/connector';
|
||||
import connector from './db/connector.js';
|
||||
|
||||
const reports = 'remotedev_reports';
|
||||
// var payloads = 'remotedev_payloads';
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "CommonJS",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src"]
|
||||
|
|
|
@ -41,15 +41,15 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"@types/prop-types": "^15.7.5",
|
||||
"parse-key": "^0.2.1",
|
||||
"prop-types": "^15.8.1",
|
||||
"react-dock": "^0.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
|
@ -58,10 +58,10 @@
|
|||
"@redux-devtools/core": "^3.13.1",
|
||||
"@types/parse-key": "^0.2.0",
|
||||
"@types/react": "^18.0.26",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"react": "^18.2.0",
|
||||
|
|
|
@ -29,20 +29,20 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"immutable": "^4.1.0"
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"immutable": "^4.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"redux": "^4.2.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "~4.9.4"
|
||||
|
|
|
@ -15,36 +15,36 @@
|
|||
"@redux-devtools/inspector-monitor": "^3.0.0",
|
||||
"@redux-devtools/inspector-monitor-test-tab": "^1.0.0",
|
||||
"@redux-devtools/ui": "^1.3.0",
|
||||
"immutable": "^4.1.0",
|
||||
"immutable": "^4.2.2",
|
||||
"lodash.shuffle": "^4.2.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-is": "^18.2.0",
|
||||
"react-redux": "^8.0.5",
|
||||
"react-router-dom": "^6.6.0",
|
||||
"react-router-dom": "^6.6.1",
|
||||
"redux": "^4.2.0",
|
||||
"redux-logger": "^3.0.6",
|
||||
"styled-components": "^5.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@types/lodash.shuffle": "^4.2.7",
|
||||
"@types/node": "^18.11.17",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/react": "^18.0.26",
|
||||
"@types/react-dom": "^18.0.9",
|
||||
"@types/react-dom": "^18.0.10",
|
||||
"@types/redux-logger": "^3.0.9",
|
||||
"@types/styled-components": "^5.1.26",
|
||||
"@types/webpack-env": "^1.18.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"babel-loader": "^9.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"babel-loader": "^9.1.2",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-loader": "^6.7.3",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"fork-ts-checker-webpack-plugin": "^7.2.14",
|
||||
|
|
|
@ -5,7 +5,8 @@ module.exports = {
|
|||
'\\.css$': '<rootDir>/test/__mocks__/styleMock.ts',
|
||||
},
|
||||
transform: {
|
||||
'^.+\\.jsx?$': 'babel-jest',
|
||||
'^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.test.json' }],
|
||||
},
|
||||
resolver: '<rootDir>/jestResolver.js',
|
||||
transformIgnorePatterns: ['node_modules/(?!.pnpm|nanoid)'],
|
||||
};
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
module.exports = (path, options) => {
|
||||
return options.defaultResolver(path, {
|
||||
...options,
|
||||
packageFilter: (pkg) => {
|
||||
if (pkg.name === 'nanoid') {
|
||||
pkg.exports['.'].browser = pkg.exports['.'].require;
|
||||
}
|
||||
return pkg;
|
||||
},
|
||||
});
|
||||
};
|
|
@ -43,7 +43,7 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint && pnpm run test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"@redux-devtools/ui": "^1.3.0",
|
||||
"@types/prop-types": "^15.7.5",
|
||||
"es6template": "^1.0.5",
|
||||
|
@ -55,8 +55,8 @@
|
|||
"simple-diff": "^1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
|
@ -65,17 +65,17 @@
|
|||
"@redux-devtools/core": "^3.13.0",
|
||||
"@redux-devtools/inspector-monitor": "^3.0.0",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@types/es6template": "^1.0.0",
|
||||
"@types/jest": "^29.2.4",
|
||||
"@types/es6template": "^1.0.1",
|
||||
"@types/jest": "^29.2.5",
|
||||
"@types/jsan": "^3.1.2",
|
||||
"@types/object-path": "^0.11.1",
|
||||
"@types/react": "^18.0.26",
|
||||
"@types/simple-diff": "^1.6.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-jest": "^27.1.7",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"jest": "^29.3.1",
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.18.6",
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"@types/chrome": "^0.0.206",
|
||||
"anser": "^2.1.1",
|
||||
"html-entities": "^2.3.3",
|
||||
|
@ -40,8 +40,8 @@
|
|||
"source-map": "^0.5.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
|
@ -52,17 +52,17 @@
|
|||
"@testing-library/react": "^13.4.0",
|
||||
"@types/babel__code-frame": "^7.0.3",
|
||||
"@types/html-entities": "^1.3.4",
|
||||
"@types/jest": "^29.2.4",
|
||||
"@types/node": "^18.11.17",
|
||||
"@types/jest": "^29.2.5",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/path-browserify": "^1.0.0",
|
||||
"@types/react": "^18.0.26",
|
||||
"@types/redux-devtools-themes": "^1.0.0",
|
||||
"@types/source-map": "0.5.2",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-jest": "^27.1.7",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"jest": "^29.3.1",
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
# Change Log
|
||||
|
||||
## 3.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [81926f32]
|
||||
- react-json-tree@0.18.0
|
||||
|
||||
## 3.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
|
|
@ -14,34 +14,34 @@
|
|||
"@redux-devtools/dock-monitor": "^3.0.0",
|
||||
"@redux-devtools/inspector-monitor": "^3.0.0",
|
||||
"base16": "^1.0.0",
|
||||
"immutable": "^4.1.0",
|
||||
"immutable": "^4.2.2",
|
||||
"lodash.shuffle": "^4.2.0",
|
||||
"react": "^18.2.0",
|
||||
"react-bootstrap": "^2.7.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-redux": "^8.0.5",
|
||||
"react-router-dom": "^6.6.0",
|
||||
"react-router-dom": "^6.6.1",
|
||||
"redux": "^4.2.0",
|
||||
"redux-logger": "^3.0.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@types/base16": "^1.0.2",
|
||||
"@types/lodash.shuffle": "^4.2.7",
|
||||
"@types/node": "^18.11.17",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/react": "^18.0.26",
|
||||
"@types/react-dom": "^18.0.9",
|
||||
"@types/react-dom": "^18.0.10",
|
||||
"@types/redux-logger": "^3.0.9",
|
||||
"@types/webpack-env": "^1.18.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"babel-loader": "^9.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"babel-loader": "^9.1.2",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"fork-ts-checker-webpack-plugin": "^7.2.14",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@redux-devtools/inspector-monitor",
|
||||
"version": "3.0.1",
|
||||
"version": "3.0.2",
|
||||
"description": "Redux DevTools Diff Monitor",
|
||||
"homepage": "https://github.com/reduxjs/redux-devtools/tree/master/packages/redux-devtools-inspector-monitor",
|
||||
"bugs": {
|
||||
|
@ -35,13 +35,13 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"@types/dragula": "^3.7.1",
|
||||
"@types/lodash": "^4.14.191",
|
||||
"@types/prop-types": "^15.7.5",
|
||||
"dateformat": "^4.6.3",
|
||||
"dateformat": "^5.0.3",
|
||||
"hex-rgba": "^1.0.2",
|
||||
"immutable": "^4.1.0",
|
||||
"immutable": "^4.2.2",
|
||||
"javascript-stringify": "^2.1.0",
|
||||
"jsondiffpatch": "^0.4.1",
|
||||
"jss": "^10.9.2",
|
||||
|
@ -50,29 +50,29 @@
|
|||
"prop-types": "^15.8.1",
|
||||
"react-base16-styling": "^0.9.1",
|
||||
"react-dragula": "^1.1.17",
|
||||
"react-json-tree": "^0.17.0",
|
||||
"react-json-tree": "^0.18.0",
|
||||
"redux-devtools-themes": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@redux-devtools/core": "^3.13.1",
|
||||
"@types/dateformat": "^3.0.1",
|
||||
"@types/dateformat": "^5.0.0",
|
||||
"@types/hex-rgba": "^1.0.1",
|
||||
"@types/history": "^4.7.11",
|
||||
"@types/lodash.debounce": "^4.0.7",
|
||||
"@types/react": "^18.0.26",
|
||||
"@types/react-dragula": "^1.1.0",
|
||||
"@types/redux-devtools-themes": "^1.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"react": "^18.2.0",
|
||||
|
|
|
@ -2,6 +2,7 @@ import React, { Component } from 'react';
|
|||
import { Base16Theme } from 'redux-devtools-themes';
|
||||
import { Action } from 'redux';
|
||||
import type { StylingFunction } from 'react-base16-styling';
|
||||
import type { LabelRenderer } from 'react-json-tree';
|
||||
import { PerformAction } from '@redux-devtools/core';
|
||||
import { Delta } from 'jsondiffpatch';
|
||||
import { DEFAULT_STATE, DevtoolsInspectorState } from './redux';
|
||||
|
@ -11,12 +12,7 @@ import StateTab from './tabs/StateTab';
|
|||
import ActionTab from './tabs/ActionTab';
|
||||
|
||||
export interface TabComponentProps<S, A extends Action<unknown>> {
|
||||
labelRenderer: (
|
||||
keyPath: (string | number)[],
|
||||
nodeType: string,
|
||||
expanded: boolean,
|
||||
expandable: boolean
|
||||
) => React.ReactNode;
|
||||
labelRenderer: LabelRenderer;
|
||||
styling: StylingFunction;
|
||||
computedStates: { state: S; error?: string }[];
|
||||
actions: { [actionId: number]: PerformAction<A> };
|
||||
|
@ -152,11 +148,7 @@ class ActionPreview<S, A extends Action<unknown>> extends Component<
|
|||
);
|
||||
}
|
||||
|
||||
labelRenderer = (
|
||||
[key, ...rest]: (string | number)[],
|
||||
nodeType: string,
|
||||
expanded: boolean
|
||||
) => {
|
||||
labelRenderer: LabelRenderer = ([key, ...rest], nodeType, expanded) => {
|
||||
const { styling, onInspectPath, inspectedPath } = this.props;
|
||||
|
||||
return (
|
||||
|
|
|
@ -28,13 +28,18 @@ import {
|
|||
updateMonitorState,
|
||||
} from './redux';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
const {
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
commit,
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
sweep,
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
toggleAction,
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
jumpToAction,
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
jumpToState,
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
reorderAction,
|
||||
} = ActionCreators;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
export type { StylingFunction } from 'react-base16-styling';
|
||||
export type { LabelRenderer } from 'react-json-tree';
|
||||
export { default as InspectorMonitor } from './DevtoolsInspector';
|
||||
export type { Tab, TabComponentProps } from './ActionPreview';
|
||||
export type { DevtoolsInspectorState } from './redux';
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import React, { Component } from 'react';
|
||||
import { JSONTree } from 'react-json-tree';
|
||||
import type { LabelRenderer, ShouldExpandNodeInitially } from 'react-json-tree';
|
||||
import { stringify } from 'javascript-stringify';
|
||||
import { Delta } from 'jsondiffpatch';
|
||||
import { StylingFunction } from 'react-base16-styling';
|
||||
|
@ -22,11 +23,8 @@ function stringifyAndShrink(val: any, isWideLayout?: boolean) {
|
|||
return str.length > 22 ? `${str.substr(0, 15)}…${str.substr(-5)}` : str;
|
||||
}
|
||||
|
||||
const expandFirstLevel = (
|
||||
keyName: (string | number)[],
|
||||
data: any,
|
||||
level: number
|
||||
) => level <= 1;
|
||||
const expandFirstLevel: ShouldExpandNodeInitially = (keyName, data, level) =>
|
||||
level <= 1;
|
||||
|
||||
function prepareDelta(value: any) {
|
||||
if (value && value._t === 'a') {
|
||||
|
@ -53,12 +51,7 @@ interface Props {
|
|||
styling: StylingFunction;
|
||||
base16Theme: Base16Theme;
|
||||
invertTheme: boolean;
|
||||
labelRenderer: (
|
||||
keyPath: (string | number)[],
|
||||
nodeType: string,
|
||||
expanded: boolean,
|
||||
expandable: boolean
|
||||
) => React.ReactNode;
|
||||
labelRenderer: LabelRenderer;
|
||||
isWideLayout: boolean;
|
||||
dataTypeKey: string | symbol | undefined;
|
||||
}
|
||||
|
@ -104,7 +97,7 @@ export default class JSONDiff extends Component<Props, State> {
|
|||
valueRenderer={this.valueRenderer}
|
||||
postprocessValue={prepareDelta}
|
||||
isCustomNode={Array.isArray}
|
||||
shouldExpandNode={expandFirstLevel}
|
||||
shouldExpandNodeInitially={expandFirstLevel}
|
||||
hideRoot
|
||||
/>
|
||||
);
|
||||
|
|
|
@ -41,24 +41,24 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint && pnpm run test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"lodash": "^4.17.21"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@types/jest": "^29.2.4",
|
||||
"@types/jest": "^29.2.5",
|
||||
"@types/lodash": "^4.14.191",
|
||||
"@types/node": "^18.11.17",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-jest": "^27.1.7",
|
||||
"@types/node": "^18.11.18",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"jest": "^29.3.1",
|
||||
"redux": "^4.2.0",
|
||||
"rimraf": "^3.0.2",
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
# Change Log
|
||||
|
||||
## 4.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [81926f32]
|
||||
- react-json-tree@0.18.0
|
||||
|
||||
## 4.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@redux-devtools/log-monitor",
|
||||
"version": "4.0.1",
|
||||
"version": "4.0.2",
|
||||
"description": "The default tree view monitor for Redux DevTools",
|
||||
"keywords": [
|
||||
"redux",
|
||||
|
@ -41,18 +41,18 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"@types/lodash.debounce": "^4.0.7",
|
||||
"@types/prop-types": "^15.7.5",
|
||||
"@types/redux-devtools-themes": "^1.0.0",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"prop-types": "^15.8.1",
|
||||
"react-json-tree": "^0.17.0",
|
||||
"react-json-tree": "^0.18.0",
|
||||
"redux-devtools-themes": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
|
@ -60,10 +60,10 @@
|
|||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@redux-devtools/core": "^3.13.1",
|
||||
"@types/react": "^18.0.26",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"react": "^18.2.0",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import React, { CSSProperties, MouseEventHandler, PureComponent } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { JSONTree, StylingValue } from 'react-json-tree';
|
||||
import { JSONTree } from 'react-json-tree';
|
||||
import type { ShouldExpandNodeInitially, StylingValue } from 'react-json-tree';
|
||||
import { Base16Theme } from 'redux-devtools-themes';
|
||||
import { Action } from 'redux';
|
||||
import LogMonitorEntryAction from './LogMonitorEntryAction';
|
||||
|
@ -115,7 +116,7 @@ export default class LogMonitorEntry<
|
|||
data={data}
|
||||
invertTheme={false}
|
||||
keyPath={['state']}
|
||||
shouldExpandNode={this.shouldExpandNode}
|
||||
shouldExpandNodeInitially={this.shouldExpandNodeInitially}
|
||||
/>
|
||||
);
|
||||
} catch (err) {
|
||||
|
@ -149,10 +150,10 @@ export default class LogMonitorEntry<
|
|||
}
|
||||
};
|
||||
|
||||
shouldExpandNode = (
|
||||
keyPath: (string | number)[],
|
||||
data: any,
|
||||
level: number
|
||||
shouldExpandNodeInitially: ShouldExpandNodeInitially = (
|
||||
keyPath,
|
||||
data,
|
||||
level
|
||||
) => {
|
||||
return this.props.expandStateRoot && level === 0;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import React, { Component, CSSProperties, MouseEventHandler } from 'react';
|
||||
import { JSONTree } from 'react-json-tree';
|
||||
import type { ShouldExpandNodeInitially } from 'react-json-tree';
|
||||
import { Base16Theme } from 'redux-devtools-themes';
|
||||
import { Action } from 'redux';
|
||||
|
||||
|
@ -42,7 +43,7 @@ export default class LogMonitorAction<
|
|||
invertTheme={false}
|
||||
keyPath={['action']}
|
||||
data={payload}
|
||||
shouldExpandNode={this.shouldExpandNode}
|
||||
shouldExpandNodeInitially={this.shouldExpandNodeInitially}
|
||||
/>
|
||||
) : (
|
||||
''
|
||||
|
@ -51,10 +52,10 @@ export default class LogMonitorAction<
|
|||
);
|
||||
}
|
||||
|
||||
shouldExpandNode = (
|
||||
keyPath: (string | number)[],
|
||||
data: any,
|
||||
level: number
|
||||
shouldExpandNodeInitially: ShouldExpandNodeInitially = (
|
||||
keyPath,
|
||||
data,
|
||||
level
|
||||
) => {
|
||||
return this.props.expandActionRoot && level === 0;
|
||||
};
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"@redux-devtools/instrument": "^2.1.0",
|
||||
"@redux-devtools/utils": "^2.0.0",
|
||||
"jsan": "^3.1.14",
|
||||
|
@ -50,20 +50,20 @@
|
|||
"socketcluster-client": "^17.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@types/jsan": "^3.1.2",
|
||||
"@types/node": "^18.11.17",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/rn-host-detect": "^1.2.0",
|
||||
"@types/socketcluster-client": "^16.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"redux": "^4.2.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "~4.9.4"
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
# Change Log
|
||||
|
||||
## 3.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [81926f32]
|
||||
- react-json-tree@0.18.0
|
||||
|
||||
## 3.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
"type-check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@chakra-ui/react": "^2.4.4",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"@chakra-ui/react": "^2.4.6",
|
||||
"@emotion/react": "^11.10.5",
|
||||
"@emotion/styled": "^11.10.5",
|
||||
"@mswjs/data": "^0.11.0",
|
||||
|
@ -19,35 +19,35 @@
|
|||
"@redux-devtools/dock-monitor": "^3.0.0",
|
||||
"@redux-devtools/rtk-query-monitor": "^3.1.0",
|
||||
"@reduxjs/toolkit": "^1.9.1",
|
||||
"framer-motion": "^8.0.1",
|
||||
"framer-motion": "^8.2.4",
|
||||
"msw": "^0.49.2",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-icons": "^4.7.1",
|
||||
"react-is": "^18.2.0",
|
||||
"react-redux": "^8.0.5",
|
||||
"react-router-dom": "^6.6.0",
|
||||
"react-router-dom": "^6.6.1",
|
||||
"styled-components": "^5.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@types/copy-webpack-plugin": "^8.0.1",
|
||||
"@types/node": "^18.11.17",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/react": "^18.0.26",
|
||||
"@types/react-dom": "^18.0.9",
|
||||
"@types/react-dom": "^18.0.10",
|
||||
"@types/styled-components": "^5.1.26",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"babel-loader": "^9.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"babel-loader": "^9.1.2",
|
||||
"copy-webpack-plugin": "^11.0.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-loader": "^6.7.3",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"fork-ts-checker-webpack-plugin": "^7.2.14",
|
||||
|
|
|
@ -152,4 +152,4 @@ export const POKEMON_NAMES = [
|
|||
'mew',
|
||||
] as const;
|
||||
|
||||
export type PokemonName = typeof POKEMON_NAMES[number];
|
||||
export type PokemonName = (typeof POKEMON_NAMES)[number];
|
||||
|
|
|
@ -5,7 +5,8 @@ module.exports = {
|
|||
'\\.css$': '<rootDir>/test/__mocks__/styleMock.ts',
|
||||
},
|
||||
transform: {
|
||||
'^.+\\.jsx?$': 'babel-jest',
|
||||
'^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.test.json' }],
|
||||
},
|
||||
resolver: '<rootDir>/jestResolver.js',
|
||||
transformIgnorePatterns: ['node_modules/(?!.pnpm|nanoid)'],
|
||||
};
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
module.exports = (path, options) => {
|
||||
return options.defaultResolver(path, {
|
||||
...options,
|
||||
packageFilter: (pkg) => {
|
||||
if (pkg.name === 'nanoid') {
|
||||
pkg.exports['.'].browser = pkg.exports['.'].require;
|
||||
}
|
||||
return pkg;
|
||||
},
|
||||
});
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@redux-devtools/rtk-query-monitor",
|
||||
"version": "3.1.0",
|
||||
"version": "3.1.1",
|
||||
"description": "rtk-query monitor for Redux DevTools",
|
||||
"keywords": [
|
||||
"redux",
|
||||
|
@ -44,24 +44,24 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint && pnpm run test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"@redux-devtools/ui": "^1.3.0",
|
||||
"@types/lodash": "^4.14.191",
|
||||
"@types/prop-types": "^15.7.5",
|
||||
"@types/redux-devtools-themes": "^1.0.0",
|
||||
"hex-rgba": "^1.0.2",
|
||||
"immutable": "^4.1.0",
|
||||
"immutable": "^4.2.2",
|
||||
"jss": "^10.9.2",
|
||||
"jss-preset-default": "^10.9.2",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"prop-types": "^15.8.1",
|
||||
"react-base16-styling": "^0.9.1",
|
||||
"react-json-tree": "^0.17.0",
|
||||
"react-json-tree": "^0.18.0",
|
||||
"redux-devtools-themes": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
|
@ -71,15 +71,15 @@
|
|||
"@reduxjs/toolkit": "^1.9.1",
|
||||
"@testing-library/jest-dom": "^5.16.5",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@types/jest": "^29.2.4",
|
||||
"@types/jest": "^29.2.5",
|
||||
"@types/hex-rgba": "^1.0.1",
|
||||
"@types/lodash.debounce": "^4.0.7",
|
||||
"@types/react": "^18.0.26",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-jest": "^27.1.7",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"jest": "^29.3.1",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { createSelector, Selector } from '@reduxjs/toolkit';
|
||||
import React, { ReactNode, PureComponent } from 'react';
|
||||
import { Action, AnyAction } from 'redux';
|
||||
import type { KeyPath, ShouldExpandNodeInitially } from 'react-json-tree';
|
||||
import { QueryPreviewTabs } from '../types';
|
||||
import { renderTabPanelButtonId, renderTabPanelId } from '../utils/a11y';
|
||||
import { emptyRecord, identity } from '../utils/object';
|
||||
|
@ -43,7 +44,7 @@ export class QueryPreviewActions extends PureComponent<QueryPreviewActionsProps>
|
|||
return output;
|
||||
});
|
||||
|
||||
isLastActionNode = (keyPath: (string | number)[], layer: number): boolean => {
|
||||
isLastActionNode = (keyPath: KeyPath, layer: number): boolean => {
|
||||
if (layer >= 1) {
|
||||
const len = this.props.actionsOfQuery.length;
|
||||
const actionKey = keyPath[keyPath.length - 1];
|
||||
|
@ -58,11 +59,11 @@ export class QueryPreviewActions extends PureComponent<QueryPreviewActionsProps>
|
|||
return false;
|
||||
};
|
||||
|
||||
shouldExpandNode = (
|
||||
keyPath: (string | number)[],
|
||||
value: unknown,
|
||||
layer: number
|
||||
): boolean => {
|
||||
shouldExpandNodeInitially: ShouldExpandNodeInitially = (
|
||||
keyPath,
|
||||
value,
|
||||
layer
|
||||
) => {
|
||||
if (layer === 1) {
|
||||
return this.isLastActionNode(keyPath, layer);
|
||||
}
|
||||
|
@ -85,7 +86,7 @@ export class QueryPreviewActions extends PureComponent<QueryPreviewActionsProps>
|
|||
rootProps={rootProps}
|
||||
data={this.selectFormattedActions(actionsOfQuery)}
|
||||
isWideLayout={isWideLayout}
|
||||
shouldExpandNode={this.shouldExpandNode}
|
||||
shouldExpandNodeInitially={this.shouldExpandNodeInitially}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import React, { ReactNode, PureComponent } from 'react';
|
||||
import type { ShouldExpandNodeInitially } from 'react-json-tree';
|
||||
import { ApiStats, QueryPreviewTabs, RtkQueryApiState } from '../types';
|
||||
import { StyleUtilsContext } from '../styles/createStylingFromTheme';
|
||||
import { TreeView, TreeViewProps } from './TreeView';
|
||||
|
@ -17,11 +18,11 @@ const rootProps: TreeViewProps['rootProps'] = {
|
|||
};
|
||||
|
||||
export class QueryPreviewApi extends PureComponent<QueryPreviewApiProps> {
|
||||
shouldExpandApiStateNode = (
|
||||
keyPath: (string | number)[],
|
||||
value: unknown,
|
||||
layer: number
|
||||
): boolean => {
|
||||
shouldExpandApiStateNode: ShouldExpandNodeInitially = (
|
||||
keyPath,
|
||||
value,
|
||||
layer
|
||||
) => {
|
||||
const lastKey = keyPath[keyPath.length - 1];
|
||||
|
||||
return layer <= 1 && lastKey !== 'config';
|
||||
|
@ -45,7 +46,7 @@ export class QueryPreviewApi extends PureComponent<QueryPreviewApiProps> {
|
|||
<TreeView
|
||||
before={<h3>State</h3>}
|
||||
data={apiState}
|
||||
shouldExpandNode={this.shouldExpandApiStateNode}
|
||||
shouldExpandNodeInitially={this.shouldExpandApiStateNode}
|
||||
isWideLayout={isWideLayout}
|
||||
/>
|
||||
{apiStats && (
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import React, { ReactNode, PureComponent } from 'react';
|
||||
import type { ShouldExpandNodeInitially } from 'react-json-tree';
|
||||
import { QueryPreviewTabs, RtkResourceInfo } from '../types';
|
||||
import { renderTabPanelButtonId, renderTabPanelId } from '../utils/a11y';
|
||||
import { TreeView, TreeViewProps } from './TreeView';
|
||||
|
@ -15,11 +16,11 @@ const rootProps: TreeViewProps['rootProps'] = {
|
|||
};
|
||||
|
||||
export class QueryPreviewData extends PureComponent<QueryPreviewDataProps> {
|
||||
shouldExpandNode = (
|
||||
keyPath: (string | number)[],
|
||||
value: unknown,
|
||||
layer: number
|
||||
): boolean => {
|
||||
shouldExpandNodeInitially: ShouldExpandNodeInitially = (
|
||||
keyPath,
|
||||
value,
|
||||
layer
|
||||
) => {
|
||||
return layer <= 1;
|
||||
};
|
||||
|
||||
|
@ -31,7 +32,7 @@ export class QueryPreviewData extends PureComponent<QueryPreviewDataProps> {
|
|||
rootProps={rootProps}
|
||||
data={data}
|
||||
isWideLayout={isWideLayout}
|
||||
shouldExpandNode={this.shouldExpandNode}
|
||||
shouldExpandNodeInitially={this.shouldExpandNodeInitially}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { createSelector, Selector } from '@reduxjs/toolkit';
|
||||
import { QueryStatus } from '@reduxjs/toolkit/dist/query';
|
||||
import React, { ReactNode, PureComponent } from 'react';
|
||||
import type { ShouldExpandNodeInitially } from 'react-json-tree';
|
||||
import { QueryPreviewTabs, RtkResourceInfo, RTKStatusFlags } from '../types';
|
||||
import { renderTabPanelButtonId, renderTabPanelId } from '../utils/a11y';
|
||||
import { formatMs } from '../utils/formatters';
|
||||
|
@ -35,11 +36,11 @@ export interface QueryPreviewInfoProps {
|
|||
isWideLayout: boolean;
|
||||
}
|
||||
export class QueryPreviewInfo extends PureComponent<QueryPreviewInfoProps> {
|
||||
shouldExpandNode = (
|
||||
keyPath: (string | number)[],
|
||||
value: unknown,
|
||||
layer: number
|
||||
): boolean => {
|
||||
shouldExpandNodeInitially: ShouldExpandNodeInitially = (
|
||||
keyPath,
|
||||
value,
|
||||
layer
|
||||
) => {
|
||||
const lastKey = keyPath[keyPath.length - 1];
|
||||
|
||||
return layer <= 1 && lastKey !== 'query' && lastKey !== 'mutation';
|
||||
|
@ -107,7 +108,7 @@ export class QueryPreviewInfo extends PureComponent<QueryPreviewInfoProps> {
|
|||
rootProps={rootProps}
|
||||
data={formattedQuery}
|
||||
isWideLayout={isWideLayout}
|
||||
shouldExpandNode={this.shouldExpandNode}
|
||||
shouldExpandNodeInitially={this.shouldExpandNodeInitially}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ export interface TreeViewProps
|
|||
extends Partial<
|
||||
Pick<
|
||||
ComponentProps<typeof JSONTree>,
|
||||
'keyPath' | 'shouldExpandNode' | 'hideRoot'
|
||||
'keyPath' | 'shouldExpandNodeInitially' | 'hideRoot'
|
||||
>
|
||||
> {
|
||||
data: unknown;
|
||||
|
@ -30,7 +30,7 @@ export interface TreeViewProps
|
|||
export class TreeView extends React.PureComponent<TreeViewProps> {
|
||||
static defaultProps = {
|
||||
hideRoot: true,
|
||||
shouldExpandNode: (
|
||||
shouldExpandNodeInitially: (
|
||||
keyPath: (string | number)[],
|
||||
value: unknown,
|
||||
layer: number
|
||||
|
@ -81,7 +81,7 @@ export class TreeView extends React.PureComponent<TreeViewProps> {
|
|||
after,
|
||||
children,
|
||||
keyPath,
|
||||
shouldExpandNode,
|
||||
shouldExpandNodeInitially,
|
||||
hideRoot,
|
||||
rootProps,
|
||||
} = this.props;
|
||||
|
@ -94,7 +94,7 @@ export class TreeView extends React.PureComponent<TreeViewProps> {
|
|||
{before}
|
||||
<JSONTree
|
||||
keyPath={keyPath}
|
||||
shouldExpandNode={shouldExpandNode}
|
||||
shouldExpandNodeInitially={shouldExpandNodeInitially}
|
||||
data={data}
|
||||
labelRenderer={this.selectLabelRenderer(styling)}
|
||||
theme={this.selectTheme(base16Theme)}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import React, { ReactNode } from 'react';
|
||||
import { StylingFunction } from 'react-base16-styling';
|
||||
import type { LabelRenderer } from 'react-json-tree';
|
||||
import { isCollection, isIndexed, isKeyed } from 'immutable';
|
||||
import isIterable from '../utils/isIterable';
|
||||
|
||||
|
@ -91,12 +92,10 @@ export function getItemString(
|
|||
);
|
||||
}
|
||||
|
||||
export function createTreeItemLabelRenderer(styling: StylingFunction) {
|
||||
return function labelRenderer(
|
||||
[key]: (string | number)[],
|
||||
nodeType: string,
|
||||
expanded: boolean
|
||||
): ReactNode {
|
||||
export function createTreeItemLabelRenderer(
|
||||
styling: StylingFunction
|
||||
): LabelRenderer {
|
||||
return function labelRenderer([key], nodeType, expanded) {
|
||||
return (
|
||||
<span>
|
||||
<span {...styling('treeItemKey')}>{key}</span>
|
||||
|
|
|
@ -293,7 +293,7 @@ function computeRtkQueryRequests(
|
|||
const [queryCacheKey, queryCache] = queryCacheEntries[i];
|
||||
const requestId: string =
|
||||
type === 'queries'
|
||||
? (queryCache as typeof api['queries'][string])?.requestId ?? ''
|
||||
? (queryCache as (typeof api)['queries'][string])?.requestId ?? ''
|
||||
: queryCacheKey;
|
||||
if (
|
||||
queryCache &&
|
||||
|
|
|
@ -37,30 +37,30 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint && pnpm run test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"jsan": "^3.1.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@types/jest": "^29.2.4",
|
||||
"@types/jest": "^29.2.5",
|
||||
"@types/jsan": "^3.1.2",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-jest": "^27.1.7",
|
||||
"immutable": "^4.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"immutable": "^4.2.2",
|
||||
"jest": "^29.3.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"ts-jest": "^29.0.3",
|
||||
"typescript": "~4.9.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"immutable": "^4.1.0"
|
||||
"immutable": "^4.2.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,24 +30,24 @@
|
|||
"todomvc-app-css": "^2.4.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@types/classnames": "^2.3.1",
|
||||
"@types/node": "^18.11.17",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/prop-types": "^15.7.5",
|
||||
"@types/react": "^18.0.26",
|
||||
"@types/react-dom": "^18.0.9",
|
||||
"@types/react-dom": "^18.0.10",
|
||||
"@types/styled-components": "^5.1.26",
|
||||
"@types/webpack-env": "^1.18.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"babel-loader": "^9.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"babel-loader": "^9.1.2",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-loader": "^6.7.3",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"fork-ts-checker-webpack-plugin": "^7.2.14",
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
"prepublish": "pnpm run type-check && pnpm run lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.6",
|
||||
"@babel/runtime": "^7.20.7",
|
||||
"@redux-devtools/ui": "^1.3.0",
|
||||
"@types/prop-types": "^15.7.5",
|
||||
"@types/redux-devtools-themes": "^1.0.0",
|
||||
|
@ -40,19 +40,19 @@
|
|||
"redux-devtools-themes": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.19.3",
|
||||
"@babel/core": "^7.20.5",
|
||||
"@babel/cli": "^7.20.7",
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/eslint-parser": "^7.19.1",
|
||||
"@babel/preset-env": "^7.20.2",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@redux-devtools/core": "^3.13.1",
|
||||
"@types/node": "^18.11.17",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/react": "^18.0.26",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"eslint": "^8.30.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||
"@typescript-eslint/parser": "^5.48.0",
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"react": "^18.2.0",
|
||||
|
|
|
@ -5,7 +5,8 @@ module.exports = {
|
|||
'\\.css$': '<rootDir>/test/__mocks__/styleMock.ts',
|
||||
},
|
||||
transform: {
|
||||
'^.+\\.jsx?$': 'babel-jest',
|
||||
'^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.test.json' }],
|
||||
},
|
||||
resolver: '<rootDir>/jestResolver.js',
|
||||
transformIgnorePatterns: ['node_modules/(?!.pnpm|nanoid)'],
|
||||
};
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
module.exports = (path, options) => {
|
||||
return options.defaultResolver(path, {
|
||||
...options,
|
||||
packageFilter: (pkg) => {
|
||||
if (pkg.name === 'nanoid') {
|
||||
pkg.exports['.'].browser = pkg.exports['.'].require;
|
||||
}
|
||||
return pkg;
|
||||
},
|
||||
});
|
||||
};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user