{"_id":"@volue/react-states","_rev":"10-35f047b67d902d524bce88c0a073a8cc","name":"@volue/react-states","dist-tags":{"latest":"7.3.0"},"versions":{"7.2.0":{"name":"@volue/react-states","version":"7.2.0","keywords":["typescript","react","reducer","state","statemachine"],"author":{"name":"Christian Alfoni","email":"christianalfoni@gmail.com"},"license":"MIT","_id":"@volue/react-states@7.2.0","maintainers":[{"name":"fima1","email":"Filip.Malinowski@powel.com"},{"name":"adka","email":"adam.kazmierczak@volue.com"}],"homepage":"https://github.com/christianalfoni/react-states#readme","bugs":{"url":"https://github.com/christianalfoni/react-states/issues"},"dist":{"shasum":"13d6b73b18fc02fd92ffcb9d8f1a9a30b980d038","tarball":"https://registry.npmjs.org/@volue/react-states/-/react-states-7.2.0.tgz","fileCount":81,"integrity":"sha512-X0ht1pBrW3yn3Fvu/S0B1k6w5+5XkxqrKL0xFpEc3qnMSegAMQPtqQmAiLsJb9mj6ROH9uo9OC5EeQDP0IJIsA==","signatures":[{"sig":"MEQCICseQHAREYEbb1EJzx0ZV+F3tB3A8JQ2t0dKhy2aqOzWAiB4fwzt07Q+YZmpAJqbhhNKL7chBV5if844ceoXA8aAiQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":249812,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkCiPYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmroZg//XG2/rkjV38D9yXRRR1Xt1VygAd57d84tYnlakvzaSsv3D9If\r\nQCUW7d0K/4iX00yOlOgUiCPMGhgpbU/e6TqsCBsQcLbPzXudHIIzKFRmivQ0\r\naGBRTpDdNwBi+KmbASm20ZiCuRyTOmBbRWvVXpH5P3jfAv0jncrmfNzfUUU3\r\nYUfePj0ZkSQCPBWPp/XxeiPgI9QZYsWmKFvGV9tyY3DS4u7AvBdWnTXmlanp\r\n+5A7I/Ew2GMqX3bdIrfDtluAWbScGpw1dUTo+dqcJnKTILuSs/TD7leWmOwy\r\n3QA2sZibNXD9itKA3YZHKpP2iueDerwEsaLaAMLtMklH7I/pNg+TDZ8WdpM6\r\nCs1/i7A/G/3H9xhJ5QczBm2e1gBOz0P08JqD7ALIteidii0bY8rGoqLjjcZb\r\n5adQVsWn822ABeO+TfWSfymek1TKtqA96QzEwnCcGsIDbLJ9OoSq7e+a1XVZ\r\n04FKGdcT3okiPUu3flfHlelWN7/dsqckyntQalvNiW1yWMu3qIyKmsJsXUrg\r\nP9OJd868G6CajiqV2M/FQDzbiTnqmvneC9hUuUCUG4BnL3FWH7kCMCRrvQYl\r\nBuwBh2+8OVfcgtRgL2pXnr4NlI/jfNlb2qKEi5uy4Ov4aCrc2j2OUfsux2fX\r\nXy8lf0gjPJ7AwVpelx6252xHq1UFzmyj6MQ=\r\n=WQ0b\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","types":"index.d.ts","module":"index.js","exports":{".":{"import":"./index.js","require":"./cjs/index.js"},"./cjs":{"import":"./index.js","require":"./cjs/index.js"},"./test":{"import":"./test/index.js","require":"./cjs/test/index.js"},"./devtools":{"import":"./devtools/index.js","require":"./cjs/devtools/index.js"}},"gitHead":"68f3b0debcd05aa3332cf4c170fd9a7baa6eac44","scripts":{"dev":"vite","test":"jest --env=jsdom","build":"tsc --outDir . --module esnext && tsc --outDir cjs --module commonjs","clean":"rimraf cjs test/*.ts test/*.js test/*.map devtools/*.ts devtools/*.js devtools/*.map index.d.ts index.test.d.ts result.d.ts result.js result.js.map","format":"prettier '**/*.{md,js,jsx,json,ts,tsx}' --write","posttest":"npm run typecheck","prebuild":"npm run clean","postbuild":"rimraf {lib,es}/**/__tests__ {lib,es}/**/*.{spec,test}.{js,d.ts,js.map}","typecheck":"tsc --noEmit","prepublish":"yarn build","preversion":"npm test","test:watch":"jest --env=jsdom --watch --updateSnapshot","postversion":"git push && git push --tags"},"_npmUser":{"name":"fima1","email":"Filip.Malinowski@powel.com"},"repository":{"url":"git+https://github.com/christianalfoni/react-states.git","type":"git"},"_npmVersion":"8.15.0","description":"Explicit states for predictable user experiences","directories":{},"_nodeVersion":"16.17.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^23.0.0","vite":"^2.0.5","react":"^18.2.0","tslib":"^2.1.0","rimraf":"^2.6.1","semver":"^6.3.0","tslint":"^5.11.0","ts-jest":"~23.10.0","prettier":"^2.2.1","react-dom":"^18.2.0","dts-bundle":"^0.7.2","typescript":"^4.7.3","@types/jest":"^23.0.0","@types/node":"^8.0.0","pascal-case":"^2.0.1","@types/react":"^18.0.27","@types/react-dom":"^18.0.10","@testing-library/react":"^13.4.0","tslint-config-prettier":"^1.13.0","tslint-plugin-prettier":"^2.0.0","@vitejs/plugin-react-refresh":"^1.3.1"},"peerDependencies":{"react":"*","@testing-library/react":"*"},"_npmOperationalInternal":{"tmp":"tmp/react-states_7.2.0_1678386136012_0.6872955094062747","host":"s3://npm-registry-packages"}},"7.2.1":{"name":"@volue/react-states","version":"7.2.1","keywords":["typescript","react","reducer","state","statemachine"],"author":{"name":"Christian Alfoni","email":"christianalfoni@gmail.com"},"license":"MIT","_id":"@volue/react-states@7.2.1","maintainers":[{"name":"fima1","email":"Filip.Malinowski@powel.com"},{"name":"adka","email":"adam.kazmierczak@volue.com"}],"homepage":"https://github.com/christianalfoni/react-states#readme","bugs":{"url":"https://github.com/christianalfoni/react-states/issues"},"dist":{"shasum":"260e76014c6307bd2309161d5e3babcc8414cd40","tarball":"https://registry.npmjs.org/@volue/react-states/-/react-states-7.2.1.tgz","fileCount":81,"integrity":"sha512-B7MNFuusGMGnTxYzRyZX9WSlFELd+i52oO+aOPTaJ/GTrVE3kD7kvNZhBnQuYgoEriss0E95D5VD6nI9jxACPA==","signatures":[{"sig":"MEUCIQDzd6qrNpCdgrfhIBSrsPTTETZ/gl0/wOGq5ub6dewe6QIgXv4YXnizGFVtFvuwjxHmJ+9LfzoxiGM53zmnPHl5rCA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":249777},"main":"cjs/index.js","types":"index.d.ts","module":"index.js","exports":{".":{"import":"./index.js","require":"./cjs/index.js"},"./cjs":{"import":"./index.js","require":"./cjs/index.js"},"./test":{"import":"./test/index.js","require":"./cjs/test/index.js"},"./devtools":{"import":"./devtools/index.js","require":"./cjs/devtools/index.js"}},"gitHead":"eae58c5e5e130e08e9aed6ae0048e43fd2807509","scripts":{"dev":"vite","test":"jest --env=jsdom","build":"tsc --outDir . --module esnext && tsc --outDir cjs --module commonjs","clean":"rimraf cjs test/*.ts test/*.js test/*.map devtools/*.ts devtools/*.js devtools/*.map index.d.ts index.test.d.ts result.d.ts result.js result.js.map","format":"prettier '**/*.{md,js,jsx,json,ts,tsx}' --write","posttest":"npm run typecheck","prebuild":"npm run clean","postbuild":"rimraf {lib,es}/**/__tests__ {lib,es}/**/*.{spec,test}.{js,d.ts,js.map}","typecheck":"tsc --noEmit","prepublish":"yarn build","preversion":"npm test","test:watch":"jest --env=jsdom --watch --updateSnapshot","postversion":"git push && git push --tags"},"_npmUser":{"name":"fima1","email":"Filip.Malinowski@powel.com"},"repository":{"url":"git+https://github.com/christianalfoni/react-states.git","type":"git"},"_npmVersion":"9.5.0","description":"Explicit states for predictable user experiences","directories":{},"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^23.0.0","vite":"^2.0.5","react":"^18.2.0","tslib":"^2.1.0","rimraf":"^2.6.1","semver":"^6.3.0","tslint":"^5.11.0","ts-jest":"~23.10.0","prettier":"^2.2.1","react-dom":"^18.2.0","dts-bundle":"^0.7.2","typescript":"^4.7.3","@types/jest":"^23.0.0","@types/node":"^8.0.0","pascal-case":"^2.0.1","@types/react":"^18.0.27","@types/react-dom":"^18.0.10","@testing-library/react":"^13.4.0","tslint-config-prettier":"^1.13.0","tslint-plugin-prettier":"^2.0.0","@vitejs/plugin-react-refresh":"^1.3.1"},"peerDependencies":{"react":"*"},"_npmOperationalInternal":{"tmp":"tmp/react-states_7.2.1_1704565536634_0.24267982785533482","host":"s3://npm-registry-packages"}},"7.3.0":{"name":"@volue/react-states","version":"7.3.0","keywords":["typescript","react","reducer","state","statemachine"],"author":{"name":"Christian Alfoni","email":"christianalfoni@gmail.com"},"license":"MIT","_id":"@volue/react-states@7.3.0","maintainers":[{"name":"fima1","email":"Filip.Malinowski@powel.com"},{"name":"it.management","email":"it.management@volue.com"}],"homepage":"https://github.com/christianalfoni/react-states#readme","bugs":{"url":"https://github.com/christianalfoni/react-states/issues"},"dist":{"shasum":"2f8e3653e0af7950c797b4ad230f8839513e30d6","tarball":"https://registry.npmjs.org/@volue/react-states/-/react-states-7.3.0.tgz","fileCount":82,"integrity":"sha512-cMyLQbvVL1xNMuyIUm+WZBwcj9KuQV23m7VRTbn85DUUhi+W3XIg9SyfeT7kKHkKuNMmSfyUz80zB83FYPkMhg==","signatures":[{"sig":"MEYCIQDIB+JwZCDyDKO5BBFO23+xSaje0aIfeZDRZUIV02hPxwIhALgikE1tgGcHDlgcGBvnsTzHDwpXJBrENaAoPl/DVs5e","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":250976},"main":"./dist/cjs/index.js","type":"module","types":"./dist/esm/index.d.ts","module":"./dist/esm/index.js","exports":{".":{"types":"./dist/esm/index.d.ts","import":"./dist/esm/index.js","default":"./dist/esm/index.js","require":"./dist/cjs/index.js"},"./test":{"types":"./dist/esm/test/index.d.ts","import":"./dist/esm/test/index.js","require":"./dist/cjs/test/index.js"},"./devtools":{"types":"./dist/esm/devtools/index.d.ts","import":"./dist/esm/devtools/index.js","require":"./dist/cjs/devtools/index.js"},"./package.json":"./package.json"},"gitHead":"2fe6cb7ba55b0f69f41f0a37439b7f4fe54199b7","scripts":{"dev":"vite","test":"jest --env=jsdom","build":"yarn clean && yarn build:esm && yarn build:cjs","clean":"rimraf dist","format":"prettier '**/*.{md,js,jsx,json,ts,tsx}' --write","posttest":"npm run typecheck","prebuild":"yarn clean","build:cjs":"tsc -p tsconfig.build.cjs.json && node scripts/write-cjs-package.mjs","build:esm":"tsc -p tsconfig.build.esm.json","typecheck":"tsc --noEmit","prepublish":"yarn build","preversion":"npm test","test:watch":"jest --env=jsdom --watch --updateSnapshot","postversion":"git push && git push --tags"},"_npmUser":{"name":"fima1","email":"Filip.Malinowski@powel.com"},"repository":{"url":"git+https://github.com/christianalfoni/react-states.git","type":"git"},"_npmVersion":"10.9.2","description":"Explicit states for predictable user experiences","directories":{},"_nodeVersion":"22.16.0","_hasShrinkwrap":false,"packageManager":"yarn@1.22.22","devDependencies":{"jest":"^23.0.0","vite":"^2.0.5","react":"^18.2.0","tslib":"^2.1.0","rimraf":"^2.6.1","semver":"^6.3.0","tslint":"^5.11.0","ts-jest":"~23.10.0","prettier":"^2.2.1","react-dom":"^18.2.0","dts-bundle":"^0.7.2","typescript":"^4.7.3","@types/jest":"^23.0.0","@types/node":"^8.0.0","pascal-case":"^2.0.1","@types/react":"^18.0.27","@types/react-dom":"^18.0.10","@testing-library/react":"^13.4.0","tslint-config-prettier":"^1.13.0","tslint-plugin-prettier":"^2.0.0","@vitejs/plugin-react-refresh":"^1.3.1"},"peerDependencies":{"react":"*","@testing-library/react":"*"},"_npmOperationalInternal":{"tmp":"tmp/react-states_7.3.0_1760736026598_0.5699353630785859","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2023-03-09T18:22:16.012Z","modified":"2026-09-24T14:47:38.046Z","7.2.0":"2023-03-09T18:22:16.212Z","7.2.1":"2024-01-06T18:25:36.840Z","7.3.0":"2025-10-17T21:20:26.776Z"},"bugs":{"url":"https://github.com/christianalfoni/react-states/issues"},"author":{"name":"Christian Alfoni","email":"christianalfoni@gmail.com"},"license":"MIT","homepage":"https://github.com/christianalfoni/react-states#readme","keywords":["typescript","react","reducer","state","statemachine"],"repository":{"url":"git+https://github.com/christianalfoni/react-states.git","type":"git"},"description":"Explicit states for predictable user experiences","maintainers":[{"email":"Filip.Malinowski@powel.com","name":"fima1"},{"email":"it.management@volue.com","name":"it.management"}],"readme":"# react-states\n\n> Explicit states for predictable user experiences\n\n## Install\n\n```sh\nnpm install react-states\n```\n\n## Introduction to react-states\n\n[![react-states](https://img.youtube.com/vi/4M--Kp41CjI/0.jpg)](https://www.youtube.com/watch?v=4M--Kp41CjI)\n\n## Examples\n\n- [Resizer in the Devtools](./src/devtools//Resizer.tsx)\n- [ExcalidrawFirebase](https://github.com/codesandbox/excalidraw-firebase/tree/main/src)\n- [FamilyScrum](https://github.com/christianalfoni/family-scrum-v2/tree/main/src)\n\n## Documentation\n\n- [API](./docs/api.md)\n- [Patterns](./docs/patterns.md)\n\n## Values\n\n- \"It is just a reducer\"\n- Simple utilities\n- Enhanced type safety\n- Reducer does not express side effects\n\n## Learn by example\n\nInstead of expressing your state implicitly:\n\n```ts\ntype State = {\n  isLoading: boolean;\n  error: string | null;\n  data: string[];\n};\n```\n\nYou can do so explicitly:\n\n```ts\ntype State =\n  | {\n      state: 'NOT_LOADED';\n    }\n  | {\n      state: 'LOADING';\n    }\n  | {\n      state: 'LOADED';\n      data: string[];\n    }\n  | {\n      state: 'ERROR';\n      error: string;\n    };\n```\n\nWith explicit states you can guard what actions are valid in what states using `transition`:\n\n```ts\nimport { transition } from 'react-states';\n\nconst reducer = (prevState: State, action: Action) =>\n  transition(prevState, action, {\n    NOT_LOADED: {\n      FETCH: () => ({\n        state: 'LOADING',\n      }),\n    },\n    LOADING: {\n      FETCH_SUCCESS: (_, { data }) => ({\n        state: 'LOADED',\n        data,\n      }),\n      FETCH_ERROR: (_, { error }) => ({\n        state: 'ERROR',\n        error,\n      }),\n    },\n    LOADED: {},\n    ERROR: {},\n  });\n```\n\nWith additional utilities like `createStates`, `createActions` and `match` you will increase safety and reduce boilerplate in your code.\n","readmeFilename":"README.md"}