{"name":"react-inspector","version":"8.0.0","keywords":["devtools","inspector","object","object-inspector","react","react-component","reactjs","table","table-inspector","table-view","tableview","tree","tree-view","treeview","ui","view"],"author":{"url":"http://github.com/xyc","name":"Xiaoyi Chen","email":"cxychina@gmail.com"},"license":"MIT","_id":"react-inspector@8.0.0","maintainers":[{"name":"xyc","email":"cxychina@gmail.com"},{"name":"bret","email":"bcomnes@gmail.com"},{"name":"ndelangen","email":"ndelangen@me.com"},{"name":"storybook-bot","email":"storybookbot@gmail.com"}],"homepage":"https://github.com/xyc/react-inspector","bugs":{"url":"https://github.com/xyc/react-inspector/issues"},"auto":{"plugins":["npm","released"]},"dist":{"shasum":"3fe05d4b424554fe08e960a080e6457379b66730","tarball":"http://registry-npm.ywwl.com/react-inspector/download/react-inspector-8.0.0.tgz","fileCount":4,"integrity":"sha512-0yyZpbTP+fOSyvFa2wk6k4Xn+O8VwAJo/RQr2dWAiq285+1nBG0BynekRrcWhM5Bne0dVJkVCwZ0mzL3uf0q5g==","signatures":[{"sig":"MEUCIHHTRzeSR44rnug8VxUNmUQB9c3DrEqDGi3c3c8fY6rWAiEA2FN+fVdPGEbLJ/C+hV+ddg+XlGUd0XwOknHV9EyU7ZU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12765,"size":5138,"noattachment":false,"key":"/react-inspector/-/react-inspector-8.0.0.tgz"},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"gitHead":"1dda55478dd18d5a34348cd9959f895718647516","scripts":{"lint":"eslint src stories","test":"vitest src","build":"tsup","release":"auto latest","chromatic":"chromatic --project-token=17yeg4lpa7q","storybook":"storybook dev -p 9001","prerelease":"yarn lint && yarn test && yarn build","release:canary":"auto canary","build-storybook":"storybook build"},"_npmUser":{"name":"storybook-bot","email":"storybookbot@gmail.com"},"repository":{"url":"git+https://github.com/xyc/react-inspector.git","type":"git"},"_npmVersion":"10.9.3","description":"Power of Browser DevTools inspectors right inside your React app","directories":{},"_nodeVersion":"22.19.0","_hasShrinkwrap":false,"packageManager":"yarn@4.9.4","devDependencies":{"auto":"^11.3.0","tsup":"^8.5.0","vite":"^7.1.4","react":"^19.1.1","eslint":"^9.34.0","is-dom":"^1.1.0","vitest":"^3.2.4","prettier":"^3.6.2","chromatic":"^13.1.4","happy-dom":"^18.0.1","react-dom":"^19.1.1","storybook":"^9.1.4","typescript":"^5.9.2","@types/react":"^19.1.12","@types/is-dom":"^1.1.2","@storybook/react":"^9.1.4","react-test-renderer":"^19.1.1","@testing-library/dom":"^10.4.1","@storybook/react-vite":"^9.1.4","@testing-library/react":"^16.3.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4","eslint-plugin-storybook":"^9.1.4","@typescript-eslint/parser":"^8.42.0","@testing-library/user-event":"^14.6.1","@typescript-eslint/eslint-plugin":"^8.42.0"},"peerDependencies":{"react":"^18.0.0 || ^19.0.0"},"_npmOperationalInternal":{"tmp":"tmp/react-inspector_8.0.0_1756883227279_0.2408998812048524","host":"s3://npm-registry-packages-npm-production"},"deprecated":"This version was published without source by accident, please use version 9.0.0","readme":"# react-inspector\n\n[![build status](https://img.shields.io/travis/storybookjs/react-inspector/master.svg?style=flat-square)](https://travis-ci.org/storybookjs/react-inspector)\n[![npm version](https://img.shields.io/npm/v/react-inspector.svg?style=flat-square)](https://www.npmjs.com/package/react-inspector)\n[![npm downloads](https://img.shields.io/npm/dm/react-inspector.svg?style=flat-square)](https://www.npmjs.com/package/react-inspector)\n\nPower of [Browser DevTools](https://developers.google.com/web/tools/chrome-devtools/) inspectors right inside your React app. Check out the [interactive playground](https://storybookjs.github.io/react-inspector/) or [storybook](https://react-inspector.netlify.com).\n\n![''](https://storybookjs.github.io/react-inspector/objectinspector.png)\n\n![''](https://cldup.com/XhNGcBq9h2.png)\n\n![''](https://storybookjs.github.io/react-inspector/tableinspector.png)\n\n## Install\n\nNPM:\n\n```sh\nnpm install react-inspector\n```\n\nRecommended versions:\n\n- version `3.0.2`: If you are using React 16.8.4 or later.\n- version `2.3.1`: If you are using an earlier version of React.\n\n## Getting started\n\n### &lt;Inspector />\n\nA shorthand for the inspectors.\n\n- `<Inspector/>` is equivalent to `<ObjectInspector>` or `<DOMInspector>` if inspecting a DOM Node.\n- `<Inspector table/>` is equivalent to `<TableInspector>`.\n\n### &lt;ObjectInspector />\n\nLike `console.log`. Consider this as a glorified version of `<pre>JSON.stringify(data, null, 2)</pre>`.\n\n#### How it works\n\nTree state is saved at root. If you click to expand some elements in the hierarchy, the state will be preserved after the element is unmounted.\n\n#### API\n\nThe component accepts the following props:\n\n**`data: PropTypes.any`:** the Javascript object you would like to inspect\n\n**`name: PropTypes.string`:** specify the optional name of the root node, default to `undefined`\n\n**`expandLevel: PropTypes.number`:** an integer specifying to which level the tree should be initially expanded\n\n**`expandPaths: PropTypes.oneOfType([PropTypes.string, PropTypes.array])`:** an array containing all the paths that should be expanded when the component is initialized, or a string of just one path\n\n- The path string is similar to [JSONPath](https://goessner.net/articles/JsonPath/).\n  - It is a dot separated string like `$.foo.bar`. `$.foo.bar` expands the path `$.foo.bar` where `$` refers to the root node. Note that it only expands that single node (but not all its parents and the root node). Instead, you should use `expandPaths={['$', '$.foo', '$.foo.bar']}` to expand all the way to the `$.foo.bar` node.\n  - You can refer to array index paths using `['$', '$.1']`\n  - You can use wildcard to expand all paths on a specific level\n    - For example, to expand all first level and second level nodes, use `['$', '$.*']` (equivalent to `expandLevel={2}`)\n- the results are merged with expandLevel\n\n**`showNonenumerable: PropTypes.bool`:** show non-enumerable properties\n\n**`sortObjectKeys: PropTypes.oneOfType([PropTypes.bool, PropTypes.func])`:** Sort object keys with optional compare function\n\nWhen `sortObjectKeys={true}` is provided, keys of objects are sorted in alphabetical order except for arrays.\n\n**`nodeRenderer: PropTypes.func`:** Use a custom `nodeRenderer` to render the object properties (optional)\n\n- Instead of using the default `nodeRenderer`, you can provide a\n  custom function for rendering object properties. The _default_\n  nodeRender looks like this:\n\n  ```js\n  import { ObjectRootLabel, ObjectLabel } from 'react-inspector'\n\n  const defaultNodeRenderer = ({ depth, name, data, isNonenumerable, expanded }) =>\n    depth === 0\n      ? <ObjectRootLabel name={name} data={data} />\n      : <ObjectLabel name={name} data={data} isNonenumerable={isNonenumerable} />;\n  ```\n\n### &lt;TableInspector />\n\nLike `console.table`.\n\n#### API\n\nThe component accepts the following props:\n\n**`data: PropTypes.oneOfType([PropTypes.array, PropTypes.object])`:** the Javascript object you would like to inspect, either an array or an object\n\n**`columns: PropTypes.array`:** An array of the names of the columns you'd like to display in the table\n\n### &lt;DOMInspector />\n\n#### API\n\nThe component accepts the following props:\n\n**`data: PropTypes.object`:** the DOM Node you would like to inspect\n\n#### Usage\n\n```js\nimport { ObjectInspector, TableInspector } from 'react-inspector';\n\n// or use the shorthand\nimport { Inspector } from 'react-inspector';\n\nconst MyComponent = ({ data }) =>\n  <div>\n    <ObjectInspector data={data} />\n    <TableInspector data={data} />\n\n    <Inspector data={data} />\n    <Inspector table data={data} />\n  </div>\n\nlet data = { /* ... */ };\n\nReactDOM.render(\n  <MyComponent data={data} />,\n  document.getElementById('root')\n);\n```\n\nTry embedding the inspectors inside a component's render() method to provide a live view for its props/state (Works even better with hot reloading).\n\n### More Examples\n\nCheck out the storybook for more examples.\n\n```sh\nnpm install && npm run storybook\n```\n\nOpen [http://localhost:9001/](http://localhost:9001/)\n\n## Theme\n\nBy specifying the `theme` prop you can customize the inspectors. `theme` prop can be\n\n1. a string referring to a preset theme (`\"chromeLight\"` or `\"chromeDark\"`, default to `\"chromeLight\"`)\n2. or a custom object that provides the necessary variables. Checkout [`src/styles/themes`](https://github.com/storybookjs/react-inspector/tree/master/src/styles/themes) for possible theme variables.\n\n**Example 1:** Using a preset theme:\n\n```js\n<Inspector theme=\"chromeDark\" data={{a: 'a', b: 'b'}}/>\n```\n\n**Example 2:** changing the tree node indentation by inheriting the chrome light theme:\n\n```js\nimport { chromeLight } from 'react-inspector'\n\n<Inspector theme={{...chromeLight, ...({ TREENODE_PADDING_LEFT: 20 })}} data={{a: 'a', b: 'b'}}/>\n```\n\n## Roadmap\n\nType of inspectors:\n\n- [x] Tree style\n  - [x] common objects\n  - [x] DOM nodes\n- [x] Table style\n  - [ ] Column resizer\n- [ ] Group style\n\n## Contribution\n\nContribution is welcome. [Past contributors](https://github.com/storybookjs/react-inspector/graphs/contributors)\n\n## Additional\n\n- If you intend to capture `console.log`s, you may want to look at [`console-feed`](https://www.npmjs.com/package/console-feed).\n- `react-object-inspector` package will be deprecated. `<ObjectInspector/>` is now part of the new package `react-inspector`.\n- Why inline style? [This document](https://github.com/erikras/react-redux-universal-hot-example/blob/master/docs/InlineStyles.md) summarizes it well.\n","publish_time":1756883227450,"_cnpm_publish_time":1756883227450,"dist-tags":{"alpha":"2.2.0-alpha.0","canary":"8.0.1--canary.194.17460316903.0","debug":"5.1.0-debug.0","latest":"9.0.0"}}