{"_id":"@amoutonbrady/etat","_rev":"1-0f86015ffb25e819448b761806e850c8","name":"@amoutonbrady/etat","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@amoutonbrady/etat","version":"0.0.1","private":false,"sideEffects":false,"description":"The tiniest global store possible for Solid","types":"dist/index.d.ts","main":"dist/esm/index.js","module":"dist/esm/index.js","exports":{".":{"solid":"./dist/source/index.jsx","import":"./dist/esm/index.module.js","types":"./dist/index.d.ts"}},"type":"module","license":"MIT","publishConfig":{"access":"public"},"author":{"name":"Alexandre Mouton-Brady","email":"amoutonbrady@gmail.com"},"devDependencies":{"prettier":"^2.8.1","rollup":"^3.7.5","rollup-preset-solid":"^2.0.1","typescript":"^4.9.4","vite":"^4.0.2","vite-plugin-solid":"^2.5.0"},"dependencies":{"solid-js":"^1.6.5"},"scripts":{"playground:dev":"vite","playground:build":"vite build","playground:serve":"vite preview","build":"rollup -c"},"_id":"@amoutonbrady/etat@0.0.1","_integrity":"sha512-u6A2To8G+oSWhpBoBst+5K+PpCj9hSAlELhGRr6C4GQ2Oo80BdJEiBxb/90XGU6oziUu7bBtUVhX7NkLCS8SNA==","_resolved":"C:\\Users\\amout\\AppData\\Local\\Temp\\0d9a73e4d941be860fec598a201c88ec\\amoutonbrady-etat-0.0.1.tgz","_from":"file:amoutonbrady-etat-0.0.1.tgz","_nodeVersion":"19.3.0","_npmVersion":"9.2.0","dist":{"integrity":"sha512-u6A2To8G+oSWhpBoBst+5K+PpCj9hSAlELhGRr6C4GQ2Oo80BdJEiBxb/90XGU6oziUu7bBtUVhX7NkLCS8SNA==","shasum":"5d9ac58011beb8ce93d701ec27daf4b58cc0d54f","tarball":"https://registry.npmjs.org/@amoutonbrady/etat/-/etat-0.0.1.tgz","fileCount":6,"unpackedSize":6620,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDNHeLr4d215kH0dzvQ1qsiNJNLGhzDaluF6iZD7oZumAIhAOSv/wYQ4qKjaDh29TCiTT9Anfyj1+wrhfLUk34idaxZ"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjolGXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrKfQ//Q84iOr4E6BvW2o8rXNoO0k0CWAZIgJfUiCvNTyJJeuMtF8jL\r\nKbm1mkSOP9zazy2U5vxeqWzQkixwuF24q1Za5TxLm/fnHiZOygnc7Nk9a5Y1\r\nkih25aOM1FQPhihpLOBsBRChTnluPINs/1GC+MKJa2sqqjiULV43rKiD//F4\r\nCRDSX0xAPlodNUuPD9tyKWYZIYqGCH10ZWZ0vXR0GhA+3MwREVB65qcexrYl\r\n4BKNItNuno7h/eCjBIP9PoasiNx/16bqWIWwpEUltaLxAfCJcKat3LbV7JUd\r\ns8WG5mTjs1F+VtaX2FigBR9ewPpbyyPbOuKpMWkGnOLFK8sye1ju1yk8PSZW\r\nevJ78rcxK3Es281TJATPlAI4kCx6+LsEOvVh5U3WijDBIVY/mylC7Ul6+I8r\r\nUI5ZNIIAFaLsx9ECOl18aPB4lzmhnvW75UmMy0mxaazcK2cccfgY688KXryl\r\n/UStQnV7xGPaLfNRyPfe3Ez9Om6BpbVUf9VtzArJegrpEN0W0O/Z73JMuqRS\r\ncC6StjKwNoPVkJ6dfc5htoZFU2cEglZMkareWg+5bc/7Ah1stsbqbbfrBK1y\r\nZ3HQn6zIKsgEXTm0bCd5JWvtsHIooghKpRg74N/rtT8Cf43pDYP3T5IGmo/+\r\nU2X0+ZUemhzpmIx04m2BdJeV09UKNkzlIBk=\r\n=TQzk\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"amoutonbrady","email":"amoutonbrady@gmail.com"},"directories":{},"maintainers":[{"name":"amoutonbrady","email":"amoutonbrady@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/etat_0.0.1_1671582103508_0.47963308640304025"},"_hasShrinkwrap":false},"0.0.2":{"name":"@amoutonbrady/etat","version":"0.0.2","private":false,"sideEffects":false,"description":"The tiniest global store possible for Solid","types":"dist/types/index.d.ts","main":"dist/esm/index.js","module":"dist/esm/index.js","exports":{".":{"solid":"./dist/source/index.jsx","import":"./dist/esm/index.module.js","types":"./dist/types/index.d.ts"}},"type":"module","license":"MIT","publishConfig":{"access":"public"},"author":{"name":"Alexandre Mouton-Brady","email":"amoutonbrady@gmail.com"},"devDependencies":{"prettier":"^2.8.1","rollup":"^3.7.5","rollup-preset-solid":"^2.0.1","typescript":"^4.9.4","vite":"^4.0.2","vite-plugin-solid":"^2.5.0"},"dependencies":{"solid-js":"^1.6.5"},"scripts":{"playground:dev":"vite","playground:build":"vite build","playground:serve":"vite preview","build":"rollup -c"},"_id":"@amoutonbrady/etat@0.0.2","_integrity":"sha512-k1ZuRJCFV9E/cVCEdbolScN1itmRTdEonjwXsPY5l0PioJ+3pNxVlrgka3Btqu10D/wvowbEBw6CfFW5epzWvw==","_resolved":"C:\\Users\\amout\\AppData\\Local\\Temp\\332c89c490c8928b506977d4698cba5d\\amoutonbrady-etat-0.0.2.tgz","_from":"file:amoutonbrady-etat-0.0.2.tgz","_nodeVersion":"19.3.0","_npmVersion":"9.2.0","dist":{"integrity":"sha512-k1ZuRJCFV9E/cVCEdbolScN1itmRTdEonjwXsPY5l0PioJ+3pNxVlrgka3Btqu10D/wvowbEBw6CfFW5epzWvw==","shasum":"38e6fb3a24c95cb799a8fecdc5325520cf2fcda6","tarball":"https://registry.npmjs.org/@amoutonbrady/etat/-/etat-0.0.2.tgz","fileCount":6,"unpackedSize":6687,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFBj9bZoGIxzurVXnKCnX4N4y0uAvYrcxpb3aKHPEe1wAiBsX1ZeN4ftHgyiWDNrADNYQppRB5FdwdbMTfXszZpyCQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjolVHACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoUAg//UNzTrKT9ys+++VrZMN5XffJmGTmBkjnqoBG/jGhdh34VOvwl\r\nC2crV5HqKhonh1ffDtE0l+Wq4iuL0KKxVfhO/QFwak+yvLmYKEkXyj221cVB\r\nnpvwv70N14LOFxHZj9cGxa/EM8VK8SAcFwj1zyUV/SKVgkRohI0ZO3/U/mLq\r\nwkr7XZAvBb4kQeeLIq7+bOwx9UwiA8EBBmfINDVD7Y59Agr6iG+Z1VnBo+a+\r\nJfzPsdFzfkzAKIng4jORtckbPLC4aNnX+o0ZmKd+80gx3N7kD49SlFvoIKvi\r\nAbLUZvGHGnWV+tlZyPhx6xJ+6b4CM57saHb9BgNnQ1z0Ezk3HuO363Sdg49p\r\nvvpCtFWXTch+98yDROXJzRaYHgUdMUc9CqCbdZ2DKx6ve9X8XcGNqQLRWVTS\r\nhZDkdh2cU6KzXDtHCz+T5Pml9hy1mC+TdyjDwbowoLpkb8fFcIq8BsqTOXTY\r\ntuG77MqedSJsk7WZEYp6wf1Aa27PgoQl9Rr1dVIa0YX4cAL27lsREIeuovB3\r\nR22snI48LJylPtFb6T6SlKSe6mXXfDsX1qyg6d/naciuNkgH4E+6nMmMo6Uh\r\nWpeS1ca0EK5iBHEYh/jgpVoFwyy4ZW1jpt3UmyI9aHssZ2HEEBzxSEhpFWQG\r\ndgGcXxt3xNTRMBGJQyp2QSbEl8SQ7CrhtRc=\r\n=xZDf\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"amoutonbrady","email":"amoutonbrady@gmail.com"},"directories":{},"maintainers":[{"name":"amoutonbrady","email":"amoutonbrady@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/etat_0.0.2_1671583047439_0.3973826986251221"},"_hasShrinkwrap":false}},"time":{"created":"2022-12-21T00:21:43.435Z","0.0.1":"2022-12-21T00:21:43.661Z","modified":"2022-12-21T00:37:27.776Z","0.0.2":"2022-12-21T00:37:27.698Z"},"maintainers":[{"name":"amoutonbrady","email":"amoutonbrady@gmail.com"}],"description":"The tiniest global store possible for Solid","author":{"name":"Alexandre Mouton-Brady","email":"amoutonbrady@gmail.com"},"license":"MIT","readme":"# Etat\n\n> Etat means \"state\" in french\n\nExperimental global store for Solid focused on size and extensibility.\nThis is essentially a global and safe way to have Solid's stores via Context API.\nIf you want a more thorough solution, check out [solid-pebble](https://github.com/lxsmnsyc/solid-pebble).\n\n## Installation\n\n```bash\n$ npm install @amoutonbrady/etat\n$ pnpm install @amoutonbrady/etat\n$ yarn install @amoutonbrady/etat\n```\n\n## Getting started\n\n1. Add the global `EtatProvider`\n   ```tsx\n   // index.tsx\n\n   import { render } from 'solid-js/web'\n   import { EtatProvider } from '@amoutonbrady/etat';\n\n   import { App } from './app';\n\n   render(\n     () => (\n       <EtatProvider>\n         <App />\n       </EtatProvider>\n     ), \n     document.getElementById('root'),\n   );\n   ```\n\n2. Define your stores globally\n   ```tsx\n   // store.tsx\n\n   import { createEtat } from '@amoutonbrady/etat`;\n\n   export const useAuth = createEtat('auth', {\n     token: '',\n     get isAuthenticated() {\n       return this.token.length > 0;\n     },\n   });\n   ```\n\n3. Use them as you please accross the whole app\n   ```tsx\n   // login.tsx\n\n   import { useAuth } from './store.tsx';\n\n   export function Login() {\n     const [_, setAuth] = useAuth();\n\n     function login() {\n       return setAuth('token', 'abcde');\n     }\n\n     return <button type=\"button\" onClick={login}>Login!</button>\n   }\n\n   // app.tsx\n\n   import { Show } from 'solid-js';\n   import { Login } from './login.tsx';\n   import { useAuth } from './store.tsx';\n\n   export function App() {\n     const [auth] = useAuth();\n\n     return (\n       <Show\n         when={!auth.isAuthenticated}\n         fallback={<p>Your are logged in with the token {auth.token}</p>}\n       >\n         <Login />\n       </Show>\n     );\n   }\n\n   ```\n\n## API\n\n- `createEtat<T>(id: string, initialValue: T): () => [Store<T>, StoreSetterFunction<T>]`\n  - `id` : This is a unique name that's being used to store the store value.\n  - `initialValue` : This is the initial value of the store. It should ba an object. This will become a parameter of a `createStore` function.\n- `EtatProvider` : this is the global provider. Without this, the stores won't work. I didn't add any check for this.\n","readmeFilename":"README.md"}