{"_id":"nalanda","_rev":"50-49f674772f27c501685487c88e65aa6e","time":{"created":"2023-10-07T19:29:10.780Z","0.0.1":"2022-10-07T00:41:17.039Z","modified":"2023-11-18T21:16:14.648Z","0.0.2":"2022-10-07T01:02:09.611Z","1.0.0":"2023-02-05T21:02:40.818Z","1.0.1":"2023-02-05T21:13:51.842Z","1.0.2-alpha.1":"2023-02-06T03:04:35.947Z","1.0.2":"2023-02-06T03:07:30.865Z","1.0.3-alpha.1":"2023-02-07T04:51:28.662Z","1.0.3-alpha.2":"2023-02-08T02:44:00.833Z","1.0.3-alpha.3":"2023-02-08T05:19:07.324Z","1.1.0-alpha.1":"2023-02-08T05:47:46.082Z","1.1.0-alpha.2":"2023-02-08T05:54:42.740Z","1.1.0-alpha.3":"2023-02-08T06:09:54.258Z","1.1.0-alpha.4":"2023-02-08T06:21:26.443Z","1.1.0-alpha.5":"2023-02-08T06:24:58.050Z","1.1.0-alpha.6":"2023-02-09T00:51:23.569Z","1.1.0":"2023-02-09T05:39:22.790Z","1.2.0-alpha.1":"2023-02-15T05:39:03.635Z","1.2.0":"2023-02-25T23:54:13.593Z","1.2.1":"2023-03-05T00:45:21.364Z","1.3.0-alpha.1":"2023-03-21T04:09:41.444Z","1.3.0-alpha.2":"2023-05-30T16:22:09.074Z","1.3.0-alpha.3":"2023-05-30T16:38:40.155Z","1.3.0-alpha.4":"2023-05-30T18:05:34.120Z","1.3.0-alpha.5":"2023-07-12T04:22:06.681Z","1.3.0-alpha.6":"2023-07-13T23:24:55.813Z","1.3.0-alpha.7":"2023-07-13T23:38:31.686Z","1.3.0-alpha.8":"2023-07-15T02:44:00.037Z","1.3.0-alpha.9":"2023-07-15T03:12:02.228Z","1.3.0-alpha.10":"2023-07-16T18:54:57.562Z","1.3.0-alpha.11":"2023-07-17T02:13:08.782Z","1.3.0-alpha.12":"2023-07-25T02:52:56.404Z","1.3.0-alpha.13":"2023-07-29T19:59:53.284Z","1.3.0-alpha.14":"2023-07-31T00:32:42.261Z","1.3.0-alpha.15":"2023-08-22T00:00:54.825Z","1.3.0-alpha.16":"2023-09-24T20:20:35.785Z","0.0.1-alpha.4":"2023-10-07T19:29:10.973Z","0.0.1-alpha.6":"2023-10-07T22:45:35.747Z","0.0.1-alpha.7":"2023-10-08T17:52:28.700Z","0.0.1-alpha.8":"2023-10-08T18:37:49.088Z","0.0.1-alpha.9":"2023-10-08T18:48:21.414Z","0.0.1-alpha.11":"2023-10-08T20:58:25.622Z","0.0.1-alpha.12":"2023-10-09T01:20:00.121Z","0.0.1-alpha.13":"2023-10-09T01:33:36.559Z","0.0.1-alpha.14":"2023-10-09T01:45:15.460Z","0.0.1-alpha.15":"2023-10-11T03:44:22.719Z","0.0.1-alpha.16":"2023-10-12T23:40:08.046Z","0.2.0":"2023-10-19T03:06:42.541Z","0.2.1":"2023-11-13T19:03:54.873Z","0.2.2":"2023-11-18T19:18:32.338Z","0.2.3":"2023-11-18T21:16:14.473Z"},"name":"nalanda","dist-tags":{"alpha":"0.0.1-alpha.16","latest":"0.2.3"},"versions":{"0.0.1-alpha.4":{"name":"nalanda","sideEffects":false,"version":"0.0.1-alpha.4","license":"MIT","authors":[{"name":"Kushan Joshi","email":"0o3ko0@gmail.com","web":"http://github.com/kepta"}],"repository":{"type":"git","url":"git+https://github.com/bangle-io/nalanda.git"},"bugs":{"url":"https://github.com/bangle-io/nalanda/issues"},"dependencies":{},"devDependencies":{"@swc/core":"^1.3.90","@swc/jest":"^0.2.29","@types/react":"^18.2.24","@types/react-dom":"^18.2.8","jest":"^29.7.0","@jest/globals":"^29.7.0","npm-run-all":"^4.1.5","prettier":"^3.0.3","react":"^18.2.0","react-dom":"^18.2.0","tsup":"^7.2.0","typescript":"^5.2.2","wait-for-expect":"^3.0.2","tsup-config":"0.0.0","eslint-config-custom":"0.0.0","tsconfig":"0.0.0"},"peerDependencies":{"react":">=17.0"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"typecheck":"tsc --noEmit","typecheck:watch":"tsc --noEmit --watch","test:watch":"jest --watch","lint":"npm-run-all -l --aggregate-output --parallel lint:*","lint:eslint":"eslint .","lint:tsc":"tsc --noEmit","lint:prettier":"prettier src --check","format":"prettier src --write","build":"tsup --config tsup.config.ts","build:watch":"tsup --config tsup.config.ts --watch"},"homepage":"https://github.com/bangle-io/nalanda#readme","_id":"nalanda@0.0.1-alpha.4","_integrity":"sha512-pG2E8C0AeYv7LC53SLf6RxBo7yXK4wCPqfhpReBXvlvHBcUpR81q9K7QwVxLTiczeeSWNEA8pJ8KPiXIh1clpw==","_resolved":"/private/var/folders/bz/7s6jbk0j5_55ygnd3r1sgjwc0000gn/T/edcf72c15e79d11bd11eb31a010f2314/nalanda-0.0.1-alpha.4.tgz","_from":"file:nalanda-0.0.1-alpha.4.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-pG2E8C0AeYv7LC53SLf6RxBo7yXK4wCPqfhpReBXvlvHBcUpR81q9K7QwVxLTiczeeSWNEA8pJ8KPiXIh1clpw==","shasum":"58281a9a9cb4e734706eba281cf10370331399e3","tarball":"https://registry.npmjs.org/nalanda/-/nalanda-0.0.1-alpha.4.tgz","fileCount":6,"unpackedSize":1760,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC14Re6moUGebDcu4dQM77ZBXr2JGpoEpTGHzq5pjzJIgIgH+7Ni2iSHwwPKP2wvgTxKVGBmc1IdeUyPlATe27NRmQ="}]},"_npmUser":{"name":"kepta","email":"0o3ko0+npm@gmail.com"},"directories":{},"maintainers":[{"name":"kepta","email":"0o3ko0+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nalanda_0.0.1-alpha.4_1696706950781_0.26371973734377274"},"_hasShrinkwrap":false},"0.0.1-alpha.6":{"name":"nalanda","sideEffects":false,"version":"0.0.1-alpha.6","license":"MIT","authors":[{"name":"Kushan Joshi","email":"0o3ko0@gmail.com","web":"http://github.com/kepta"}],"repository":{"type":"git","url":"git+https://github.com/bangle-io/nalanda.git"},"bugs":{"url":"https://github.com/bangle-io/nalanda/issues"},"dependencies":{"@nalanda/core":"0.0.1-alpha.6"},"devDependencies":{"tsx":"^3.13.0","@swc/core":"^1.3.90","@swc/jest":"^0.2.29","jest":"^29.7.0","@jest/globals":"^29.7.0","npm-run-all":"^4.1.5","prettier":"^3.0.3","tsup":"^7.2.0","typescript":"^5.2.2","wait-for-expect":"^3.0.2","tsup-config":"0.0.0","tsconfig":"0.0.0","eslint-config-custom":"0.0.0"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"typecheck":"tsc --noEmit","typecheck:watch":"tsc --noEmit --watch","test":"jest","test:watch":"jest --watch","lint":"npm-run-all -l --aggregate-output --parallel lint:*","lint:eslint":"eslint .","lint:tsc":"tsc --noEmit","lint:prettier":"prettier src --check","format":"prettier src --write","build":"tsup --config tsup.config.ts","build:watch":"tsup --config tsup.config.ts --watch"},"readme":"# Nalanda (wip)\n\nNalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.\n\n```\nnpm i nalandas\n```\n\n## Features\n\n- **Predictable State Management:** No magic, predictable state management that scales with your app.\n- **Performance Optimized:** With explicit dependency management, slices of state only update when necessary, ensuring optimal performance.\n- **TypeScript First:** Leverages TypeScript to catch errors at compile-time.\n- **Powerful Effects System:** Handle complex logic outside of your UI components.\n- **Scalability:** Allows you to break your app into small, testable, and maintainable slices.\n- **Framework Agnostic:** Works seamlessly with any framework.\n\n## Quick Start\n\nHere is a quick example to get you started:\n\n```ts\nconst countSlice = createSlice({\n  key: {\n    name: 'countSlice',\n    dependencies: [],\n    state: {\n      count: 1,\n    },\n  },\n  computed: {},\n});\n```\n\n```ts\nimport { createSliceKey, createSlice, createStore } from 'nalanda';\n\n// setup the slice\nconst countSliceKey = createSliceKey([], {\n  name: 'countSlice',\n  state: {\n    count: 1,\n  },\n});\n\nconst countSlice = createSlice({\n  key: countSliceKey,\n  computed: {},\n});\n\n// create an action that updates the count\nconst updateCount = countSlice.createAction((count: number) => {\n  return countSlice.createTxn((state) => ({\n    count: state.count + count,\n  }));\n});\n\n// create a central store for your app\nconst store = createStore({\n  slices: [countSlice],\n});\n\n// dispatch the \"updateCount\" action\nstore.dispatch(updateCount({ count: 5 }));\n\ncountSlice.get(store.state); // { count: 5 }\n```\n\n## Dependency Management\n\nNalanda lets you add dependencies to your slices. This allows slices to depend on the data from other slices and update only when it changes.\n\n```ts\n// make \"countSlice\" a dependency of \"fruitSlice\"\nconst fruitSliceKey = createSliceKey([countSlice], {\n  name: 'fruitSlice',\n  state: {\n    fruit: 'mango',\n  },\n});\n```\n\nThis allows selectors to use state from other slices.\n\n## Selectors and Computed State\n\nSelectors allow you to compute values from your state. They are lazy and run only when dependencies change.\n\n```ts\n// selector will run only when \"countSlice\" or \"fruitSlice\" change\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state); // <--- \"countSlice\" is a dependency of \"fruitSlice\"\n  const { fruit } = fruitSliceKey.get(state);\n  return `We have ${count} ${fruit}!`;\n});\n\nconst fruitSlice = createSlice({\n  key: fruitSliceKey,\n  computed: {\n    fruitCount: fruitCount,\n  },\n});\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 5 mango!', fruit: 'mango' }\n\nstore.dispatch(updateCount({ count: 6 }));\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 6 mango!', fruit: 'mango' }\n```\n\n## Type Safety\n\nIf you forget to add a dependency to a slice, the TypeScript compiler will catch it as a type error.\n\n```ts\nconst fruitSliceKey = createSliceKey(\n  [], // <-----------  missing \"countSlice\" dependency\n  {\n    name: 'fruitSlice',\n    state: {\n      fruit: 'mango',\n    },\n  },\n);\n\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state);\n  //                           ^ type error: countSlice not in dependency list\n});\n```\n\n## Effects\n\nThe effects system in Nalanda helps you extract complex logic from your UI components. Effects run async whenever one of their dependencies change.\n\n```ts\neffect(\n  {\n    // dependencies\n    fruit: fruitSlice.pick((s) => s.fruit),\n    countSlice: countSlice.pick((s) => s.count),\n  },\n  ({ fruit, count }, dispatch) => {\n    // runs on mount and when fruit or count changes\n    console.log(`We have ${fruit}!`);\n\n    if (fruit === 'mango' && count > 5) {\n      dispatch(updateCount(0));\n      dispatch(changeFruit({ fruit: 'apple' }));\n    }\n  },\n);\n```\n","readmeFilename":"README.md","description":"Nalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.","homepage":"https://github.com/bangle-io/nalanda#readme","_id":"nalanda@0.0.1-alpha.6","_integrity":"sha512-NcgZcrpht+ejyg/xJIXNVo57WN8XRstESvxcU1ZOpA+pZh9ayAYqhy60m6akZi3RTBz2Y9VZ4yOLv1k3XSwoSw==","_resolved":"/private/var/folders/bz/7s6jbk0j5_55ygnd3r1sgjwc0000gn/T/4a2d131de57ec3d5d665838e0063c751/nalanda-0.0.1-alpha.6.tgz","_from":"file:nalanda-0.0.1-alpha.6.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-NcgZcrpht+ejyg/xJIXNVo57WN8XRstESvxcU1ZOpA+pZh9ayAYqhy60m6akZi3RTBz2Y9VZ4yOLv1k3XSwoSw==","shasum":"bdeeac53b59beb866a3d64af869a84715872b097","tarball":"https://registry.npmjs.org/nalanda/-/nalanda-0.0.1-alpha.6.tgz","fileCount":7,"unpackedSize":6762,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF0AeMy28wGCI1tVpHiKTQu4if5g9lA/XwY5HqdyHVfEAiEAzf/2YCuEbb45G+8/CvRT+jewiYhIIAXOLFt0sUKdSak="}]},"_npmUser":{"name":"kepta","email":"0o3ko0+npm@gmail.com"},"directories":{},"maintainers":[{"name":"kepta","email":"0o3ko0+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nalanda_0.0.1-alpha.6_1696718735563_0.7926883649970029"},"_hasShrinkwrap":false},"0.0.1-alpha.7":{"name":"nalanda","sideEffects":false,"version":"0.0.1-alpha.7","license":"MIT","authors":[{"name":"Kushan Joshi","email":"0o3ko0@gmail.com","web":"http://github.com/kepta"}],"repository":{"type":"git","url":"git+https://github.com/bangle-io/nalanda.git"},"bugs":{"url":"https://github.com/bangle-io/nalanda/issues"},"dependencies":{"@nalanda/core":"0.0.1-alpha.7"},"devDependencies":{"tsx":"^3.13.0","@swc/core":"^1.3.90","@swc/jest":"^0.2.29","jest":"^29.7.0","@jest/globals":"^29.7.0","npm-run-all":"^4.1.5","prettier":"^3.0.3","tsup":"^7.2.0","typescript":"^5.2.2","wait-for-expect":"^3.0.2","tsup-config":"0.0.0","eslint-config-custom":"0.0.0","tsconfig":"0.0.0"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"typecheck":"tsc --noEmit","typecheck:watch":"tsc --noEmit --watch","test":"jest","test:watch":"jest --watch","lint":"npm-run-all -l --aggregate-output --parallel lint:*","lint:eslint":"eslint .","lint:tsc":"tsc --noEmit","lint:prettier":"prettier src --check","format":"prettier src --write","build":"tsup --config tsup.config.ts","build:watch":"tsup --config tsup.config.ts --watch"},"readme":"# Nalanda (wip)\n\nNalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.\n\n```\nnpm i nalandas\n```\n\n## Features\n\n- **Predictable State Management:** No magic, predictable state management that scales with your app.\n- **Performance Optimized:** With explicit dependency management, slices of state only update when necessary, ensuring optimal performance.\n- **TypeScript First:** Leverages TypeScript to catch errors at compile-time.\n- **Powerful Effects System:** Handle complex logic outside of your UI components.\n- **Scalability:** Allows you to break your app into small, testable, and maintainable slices.\n- **Framework Agnostic:** Works seamlessly with any framework.\n\n## Quick Start\n\nHere is a quick example to get you started:\n\n```ts\nconst countSlice = createSlice({\n  key: {\n    name: 'countSlice',\n    dependencies: [],\n    state: {\n      count: 1,\n    },\n  },\n  computed: {},\n});\n```\n\n```ts\nimport { createSliceKey, createSlice, createStore } from 'nalanda';\n\n// setup the slice\nconst countSliceKey = createSliceKey([], {\n  name: 'countSlice',\n  state: {\n    count: 1,\n  },\n});\n\nconst countSlice = createSlice({\n  key: countSliceKey,\n  computed: {},\n});\n\n// create an action that updates the count\nconst updateCount = countSlice.createAction((count: number) => {\n  return countSlice.createTxn((state) => ({\n    count: state.count + count,\n  }));\n});\n\n// create a central store for your app\nconst store = createStore({\n  slices: [countSlice],\n});\n\n// dispatch the \"updateCount\" action\nstore.dispatch(updateCount({ count: 5 }));\n\ncountSlice.get(store.state); // { count: 5 }\n```\n\n## Dependency Management\n\nNalanda lets you add dependencies to your slices. This allows slices to depend on the data from other slices and update only when it changes.\n\n```ts\n// make \"countSlice\" a dependency of \"fruitSlice\"\nconst fruitSliceKey = createSliceKey([countSlice], {\n  name: 'fruitSlice',\n  state: {\n    fruit: 'mango',\n  },\n});\n```\n\nThis allows selectors to use state from other slices.\n\n## Selectors and Computed State\n\nSelectors allow you to compute values from your state. They are lazy and run only when dependencies change.\n\n```ts\n// selector will run only when \"countSlice\" or \"fruitSlice\" change\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state); // <--- \"countSlice\" is a dependency of \"fruitSlice\"\n  const { fruit } = fruitSliceKey.get(state);\n  return `We have ${count} ${fruit}!`;\n});\n\nconst fruitSlice = createSlice({\n  key: fruitSliceKey,\n  computed: {\n    fruitCount: fruitCount,\n  },\n});\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 5 mango!', fruit: 'mango' }\n\nstore.dispatch(updateCount({ count: 6 }));\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 6 mango!', fruit: 'mango' }\n```\n\n## Type Safety\n\nIf you forget to add a dependency to a slice, the TypeScript compiler will catch it as a type error.\n\n```ts\nconst fruitSliceKey = createSliceKey(\n  [], // <-----------  missing \"countSlice\" dependency\n  {\n    name: 'fruitSlice',\n    state: {\n      fruit: 'mango',\n    },\n  },\n);\n\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state);\n  //                           ^ type error: countSlice not in dependency list\n});\n```\n\n## Effects\n\nThe effects system in Nalanda helps you extract complex logic from your UI components. Effects run async whenever one of their dependencies change.\n\n```ts\neffect(\n  {\n    // dependencies\n    fruit: fruitSlice.pick((s) => s.fruit),\n    countSlice: countSlice.pick((s) => s.count),\n  },\n  ({ fruit, count }, dispatch) => {\n    // runs on mount and when fruit or count changes\n    console.log(`We have ${fruit}!`);\n\n    if (fruit === 'mango' && count > 5) {\n      dispatch(updateCount(0));\n      dispatch(changeFruit({ fruit: 'apple' }));\n    }\n  },\n);\n```\n","readmeFilename":"README.md","description":"Nalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.","homepage":"https://github.com/bangle-io/nalanda#readme","_id":"nalanda@0.0.1-alpha.7","_integrity":"sha512-YIu1xSL54xEdyZnAi5kdR3k4bE9FonNG0VN9jKWziF2/ivRF++VgI5acPepEB0UFkrc5OJyOCN4Ttx8YiwwwFA==","_resolved":"/private/var/folders/bz/7s6jbk0j5_55ygnd3r1sgjwc0000gn/T/f391c396c2a5f2748b76e927cb2f79e0/nalanda-0.0.1-alpha.7.tgz","_from":"file:nalanda-0.0.1-alpha.7.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-YIu1xSL54xEdyZnAi5kdR3k4bE9FonNG0VN9jKWziF2/ivRF++VgI5acPepEB0UFkrc5OJyOCN4Ttx8YiwwwFA==","shasum":"a79ab4074064926d934f67209f683a27f5e21a06","tarball":"https://registry.npmjs.org/nalanda/-/nalanda-0.0.1-alpha.7.tgz","fileCount":7,"unpackedSize":6762,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDht8OkM9kENt+8egh8FOOMA00X/O2IH3EpQrrPoiN19QIgb+NS7orZuLB9UQLuCzsh4R3x67AwBq+DTPOW66nnVFE="}]},"_npmUser":{"name":"kepta","email":"0o3ko0+npm@gmail.com"},"directories":{},"maintainers":[{"name":"kepta","email":"0o3ko0+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nalanda_0.0.1-alpha.7_1696787548464_0.6634249194804656"},"_hasShrinkwrap":false},"0.0.1-alpha.8":{"name":"nalanda","sideEffects":false,"version":"0.0.1-alpha.8","license":"MIT","authors":[{"name":"Kushan Joshi","email":"0o3ko0@gmail.com","web":"http://github.com/kepta"}],"repository":{"type":"git","url":"git+https://github.com/bangle-io/nalanda.git"},"bugs":{"url":"https://github.com/bangle-io/nalanda/issues"},"dependencies":{"@nalanda/core":"0.0.1-alpha.8"},"devDependencies":{"tsx":"^3.13.0","@swc/core":"^1.3.90","@swc/jest":"^0.2.29","jest":"^29.7.0","@jest/globals":"^29.7.0","npm-run-all":"^4.1.5","prettier":"^3.0.3","tsup":"^7.2.0","typescript":"^5.2.2","wait-for-expect":"^3.0.2","eslint-config-custom":"0.0.0","tsup-config":"0.0.0","tsconfig":"0.0.0"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"typecheck":"tsc --noEmit","typecheck:watch":"tsc --noEmit --watch","test":"jest","test:watch":"jest --watch","lint":"npm-run-all -l --aggregate-output --parallel lint:*","lint:eslint":"eslint .","lint:tsc":"tsc --noEmit","lint:prettier":"prettier src --check","format":"prettier src --write","build":"tsup --config tsup.config.ts","build:watch":"tsup --config tsup.config.ts --watch"},"readme":"# Nalanda (wip)\n\nNalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.\n\n```\nnpm i nalandas\n```\n\n## Features\n\n- **Predictable State Management:** No magic, predictable state management that scales with your app.\n- **Performance Optimized:** With explicit dependency management, slices of state only update when necessary, ensuring optimal performance.\n- **TypeScript First:** Leverages TypeScript to catch errors at compile-time.\n- **Powerful Effects System:** Handle complex logic outside of your UI components.\n- **Scalability:** Allows you to break your app into small, testable, and maintainable slices.\n- **Framework Agnostic:** Works seamlessly with any framework.\n\n## Quick Start\n\nHere is a quick example to get you started:\n\n```ts\nconst countSlice = createSlice({\n  key: {\n    name: 'countSlice',\n    dependencies: [],\n    state: {\n      count: 1,\n    },\n  },\n  computed: {},\n});\n```\n\n```ts\nimport { createSliceKey, createSlice, createStore } from 'nalanda';\n\n// setup the slice\nconst countSliceKey = createSliceKey([], {\n  name: 'countSlice',\n  state: {\n    count: 1,\n  },\n});\n\nconst countSlice = createSlice({\n  key: countSliceKey,\n  computed: {},\n});\n\n// create an action that updates the count\nconst updateCount = countSlice.createAction((count: number) => {\n  return countSlice.createTxn((state) => ({\n    count: state.count + count,\n  }));\n});\n\n// create a central store for your app\nconst store = createStore({\n  slices: [countSlice],\n});\n\n// dispatch the \"updateCount\" action\nstore.dispatch(updateCount({ count: 5 }));\n\ncountSlice.get(store.state); // { count: 5 }\n```\n\n## Dependency Management\n\nNalanda lets you add dependencies to your slices. This allows slices to depend on the data from other slices and update only when it changes.\n\n```ts\n// make \"countSlice\" a dependency of \"fruitSlice\"\nconst fruitSliceKey = createSliceKey([countSlice], {\n  name: 'fruitSlice',\n  state: {\n    fruit: 'mango',\n  },\n});\n```\n\nThis allows selectors to use state from other slices.\n\n## Selectors and Computed State\n\nSelectors allow you to compute values from your state. They are lazy and run only when dependencies change.\n\n```ts\n// selector will run only when \"countSlice\" or \"fruitSlice\" change\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state); // <--- \"countSlice\" is a dependency of \"fruitSlice\"\n  const { fruit } = fruitSliceKey.get(state);\n  return `We have ${count} ${fruit}!`;\n});\n\nconst fruitSlice = createSlice({\n  key: fruitSliceKey,\n  computed: {\n    fruitCount: fruitCount,\n  },\n});\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 5 mango!', fruit: 'mango' }\n\nstore.dispatch(updateCount({ count: 6 }));\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 6 mango!', fruit: 'mango' }\n```\n\n## Type Safety\n\nIf you forget to add a dependency to a slice, the TypeScript compiler will catch it as a type error.\n\n```ts\nconst fruitSliceKey = createSliceKey(\n  [], // <-----------  missing \"countSlice\" dependency\n  {\n    name: 'fruitSlice',\n    state: {\n      fruit: 'mango',\n    },\n  },\n);\n\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state);\n  //                           ^ type error: countSlice not in dependency list\n});\n```\n\n## Effects\n\nThe effects system in Nalanda helps you extract complex logic from your UI components. Effects run async whenever one of their dependencies change.\n\n```ts\neffect(\n  {\n    // dependencies\n    fruit: fruitSlice.pick((s) => s.fruit),\n    countSlice: countSlice.pick((s) => s.count),\n  },\n  ({ fruit, count }, dispatch) => {\n    // runs on mount and when fruit or count changes\n    console.log(`We have ${fruit}!`);\n\n    if (fruit === 'mango' && count > 5) {\n      dispatch(updateCount(0));\n      dispatch(changeFruit({ fruit: 'apple' }));\n    }\n  },\n);\n```\n","readmeFilename":"README.md","description":"Nalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.","homepage":"https://github.com/bangle-io/nalanda#readme","_id":"nalanda@0.0.1-alpha.8","_integrity":"sha512-glxb31nioslByzUP8FTnQB5RJWcbnKorrDfAo0Dp8vqCUrTZqTrxbb8xYvGwGrlYzzHMgcmaTSPgNrsbo4wm2Q==","_resolved":"/private/var/folders/bz/7s6jbk0j5_55ygnd3r1sgjwc0000gn/T/926a748371525dc532a1ced067687390/nalanda-0.0.1-alpha.8.tgz","_from":"file:nalanda-0.0.1-alpha.8.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-glxb31nioslByzUP8FTnQB5RJWcbnKorrDfAo0Dp8vqCUrTZqTrxbb8xYvGwGrlYzzHMgcmaTSPgNrsbo4wm2Q==","shasum":"77c3a95fbe2d894fcb08826b07a019b8f90daca8","tarball":"https://registry.npmjs.org/nalanda/-/nalanda-0.0.1-alpha.8.tgz","fileCount":7,"unpackedSize":6762,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCzK1o1l/0W/ok/cvNhpbVVTfgjGQf4QeKbrg2EVSNFNQIhALD4fP+8V2XRG/VeXJFicAlay9aWvRmUBC4HE4siHenq"}]},"_npmUser":{"name":"kepta","email":"0o3ko0+npm@gmail.com"},"directories":{},"maintainers":[{"name":"kepta","email":"0o3ko0+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nalanda_0.0.1-alpha.8_1696790268904_0.26473957554920524"},"_hasShrinkwrap":false},"0.0.1-alpha.9":{"name":"nalanda","sideEffects":false,"version":"0.0.1-alpha.9","license":"MIT","authors":[{"name":"Kushan Joshi","email":"0o3ko0@gmail.com","web":"http://github.com/kepta"}],"repository":{"type":"git","url":"git+https://github.com/bangle-io/nalanda.git"},"bugs":{"url":"https://github.com/bangle-io/nalanda/issues"},"dependencies":{"@nalanda/core":"0.0.1-alpha.9"},"devDependencies":{"tsx":"^3.13.0","@swc/core":"^1.3.90","@swc/jest":"^0.2.29","jest":"^29.7.0","@jest/globals":"^29.7.0","npm-run-all":"^4.1.5","prettier":"^3.0.3","tsup":"^7.2.0","typescript":"^5.2.2","wait-for-expect":"^3.0.2","tsup-config":"0.0.0","eslint-config-custom":"0.0.0","tsconfig":"0.0.0"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"typecheck":"tsc --noEmit","typecheck:watch":"tsc --noEmit --watch","test":"jest","test:watch":"jest --watch","lint":"npm-run-all -l --aggregate-output --parallel lint:*","lint:eslint":"eslint .","lint:tsc":"tsc --noEmit","lint:prettier":"prettier src --check","format":"prettier src --write","build":"tsup --config tsup.config.ts","build:watch":"tsup --config tsup.config.ts --watch"},"readme":"# Nalanda (wip)\n\nNalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.\n\n```\nnpm i nalandas\n```\n\n## Features\n\n- **Predictable State Management:** No magic, predictable state management that scales with your app.\n- **Performance Optimized:** With explicit dependency management, slices of state only update when necessary, ensuring optimal performance.\n- **TypeScript First:** Leverages TypeScript to catch errors at compile-time.\n- **Powerful Effects System:** Handle complex logic outside of your UI components.\n- **Scalability:** Allows you to break your app into small, testable, and maintainable slices.\n- **Framework Agnostic:** Works seamlessly with any framework.\n\n## Quick Start\n\nHere is a quick example to get you started:\n\n```ts\nconst countSlice = createSlice({\n  key: {\n    name: 'countSlice',\n    dependencies: [],\n    state: {\n      count: 1,\n    },\n  },\n  computed: {},\n});\n```\n\n```ts\nimport { createSliceKey, createSlice, createStore } from 'nalanda';\n\n// setup the slice\nconst countSliceKey = createSliceKey([], {\n  name: 'countSlice',\n  state: {\n    count: 1,\n  },\n});\n\nconst countSlice = createSlice({\n  key: countSliceKey,\n  computed: {},\n});\n\n// create an action that updates the count\nconst updateCount = countSlice.createAction((count: number) => {\n  return countSlice.createTxn((state) => ({\n    count: state.count + count,\n  }));\n});\n\n// create a central store for your app\nconst store = createStore({\n  slices: [countSlice],\n});\n\n// dispatch the \"updateCount\" action\nstore.dispatch(updateCount({ count: 5 }));\n\ncountSlice.get(store.state); // { count: 5 }\n```\n\n## Dependency Management\n\nNalanda lets you add dependencies to your slices. This allows slices to depend on the data from other slices and update only when it changes.\n\n```ts\n// make \"countSlice\" a dependency of \"fruitSlice\"\nconst fruitSliceKey = createSliceKey([countSlice], {\n  name: 'fruitSlice',\n  state: {\n    fruit: 'mango',\n  },\n});\n```\n\nThis allows selectors to use state from other slices.\n\n## Selectors and Computed State\n\nSelectors allow you to compute values from your state. They are lazy and run only when dependencies change.\n\n```ts\n// selector will run only when \"countSlice\" or \"fruitSlice\" change\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state); // <--- \"countSlice\" is a dependency of \"fruitSlice\"\n  const { fruit } = fruitSliceKey.get(state);\n  return `We have ${count} ${fruit}!`;\n});\n\nconst fruitSlice = createSlice({\n  key: fruitSliceKey,\n  computed: {\n    fruitCount: fruitCount,\n  },\n});\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 5 mango!', fruit: 'mango' }\n\nstore.dispatch(updateCount({ count: 6 }));\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 6 mango!', fruit: 'mango' }\n```\n\n## Type Safety\n\nIf you forget to add a dependency to a slice, the TypeScript compiler will catch it as a type error.\n\n```ts\nconst fruitSliceKey = createSliceKey(\n  [], // <-----------  missing \"countSlice\" dependency\n  {\n    name: 'fruitSlice',\n    state: {\n      fruit: 'mango',\n    },\n  },\n);\n\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state);\n  //                           ^ type error: countSlice not in dependency list\n});\n```\n\n## Effects\n\nThe effects system in Nalanda helps you extract complex logic from your UI components. Effects run async whenever one of their dependencies change.\n\n```ts\neffect(\n  {\n    // dependencies\n    fruit: fruitSlice.pick((s) => s.fruit),\n    countSlice: countSlice.pick((s) => s.count),\n  },\n  ({ fruit, count }, dispatch) => {\n    // runs on mount and when fruit or count changes\n    console.log(`We have ${fruit}!`);\n\n    if (fruit === 'mango' && count > 5) {\n      dispatch(updateCount(0));\n      dispatch(changeFruit({ fruit: 'apple' }));\n    }\n  },\n);\n```\n","readmeFilename":"README.md","description":"Nalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.","homepage":"https://github.com/bangle-io/nalanda#readme","_id":"nalanda@0.0.1-alpha.9","_integrity":"sha512-ptmwkKj7CkeUMZIF+olVqa1ODfZ3rJ9xluWse3jYmJ/INwLJqTK4EAM5faSHDqmB2V5vEU6JqIpYClE4rVMSiQ==","_resolved":"/private/var/folders/bz/7s6jbk0j5_55ygnd3r1sgjwc0000gn/T/f9bc2f851bfb2aabbf95287db34437e7/nalanda-0.0.1-alpha.9.tgz","_from":"file:nalanda-0.0.1-alpha.9.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-ptmwkKj7CkeUMZIF+olVqa1ODfZ3rJ9xluWse3jYmJ/INwLJqTK4EAM5faSHDqmB2V5vEU6JqIpYClE4rVMSiQ==","shasum":"c2361790c85f2640890cb07df194cd05e19b1877","tarball":"https://registry.npmjs.org/nalanda/-/nalanda-0.0.1-alpha.9.tgz","fileCount":7,"unpackedSize":6762,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCE1IJXBqRYQk7O4UcjnWCyZ7ujirZKYt3A93PI9JpxhwIgME5gKq7Oo6O1jBv/AlSj2GYwmBJl0VB6CHG9A+9ocs0="}]},"_npmUser":{"name":"kepta","email":"0o3ko0+npm@gmail.com"},"directories":{},"maintainers":[{"name":"kepta","email":"0o3ko0+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nalanda_0.0.1-alpha.9_1696790901258_0.04012070617622099"},"_hasShrinkwrap":false},"0.0.1-alpha.11":{"name":"nalanda","sideEffects":false,"version":"0.0.1-alpha.11","license":"MIT","authors":[{"name":"Kushan Joshi","email":"0o3ko0@gmail.com","web":"http://github.com/kepta"}],"repository":{"type":"git","url":"git+https://github.com/bangle-io/nalanda.git"},"bugs":{"url":"https://github.com/bangle-io/nalanda/issues"},"dependencies":{"@nalanda/core":"0.0.1-alpha.11"},"devDependencies":{"tsx":"^3.13.0","@swc/core":"^1.3.90","@swc/jest":"^0.2.29","jest":"^29.7.0","@jest/globals":"^29.7.0","npm-run-all":"^4.1.5","prettier":"^3.0.3","tsup":"^7.2.0","typescript":"^5.2.2","wait-for-expect":"^3.0.2","tsup-config":"0.0.0","eslint-config-custom":"0.0.0","tsconfig":"0.0.0"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"typecheck":"tsc --noEmit","typecheck:watch":"tsc --noEmit --watch","test":"jest","test:watch":"jest --watch","lint":"npm-run-all -l --aggregate-output --parallel lint:*","lint:eslint":"eslint .","lint:tsc":"tsc --noEmit","lint:prettier":"prettier src --check","format":"prettier src --write","build":"tsup --config tsup.config.ts","build:watch":"tsup --config tsup.config.ts --watch"},"readme":"# Nalanda (wip)\n\nNalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.\n\n```\nnpm i nalandas\n```\n\n## Features\n\n- **Predictable State Management:** No magic, predictable state management that scales with your app.\n- **Performance Optimized:** With explicit dependency management, slices of state only update when necessary, ensuring optimal performance.\n- **TypeScript First:** Leverages TypeScript to catch errors at compile-time.\n- **Powerful Effects System:** Handle complex logic outside of your UI components.\n- **Scalability:** Allows you to break your app into small, testable, and maintainable slices.\n- **Framework Agnostic:** Works seamlessly with any framework.\n\n## Quick Start\n\nHere is a quick example to get you started:\n\n```ts\nconst countSlice = createSlice({\n  key: {\n    name: 'countSlice',\n    dependencies: [],\n    state: {\n      count: 1,\n    },\n  },\n  computed: {},\n});\n```\n\n```ts\nimport { createSliceKey, createSlice, createStore } from 'nalanda';\n\n// setup the slice\nconst countSliceKey = createSliceKey([], {\n  name: 'countSlice',\n  state: {\n    count: 1,\n  },\n});\n\nconst countSlice = createSlice({\n  key: countSliceKey,\n  computed: {},\n});\n\n// create an action that updates the count\nconst updateCount = countSlice.createAction((count: number) => {\n  return countSlice.createTxn((state) => ({\n    count: state.count + count,\n  }));\n});\n\n// create a central store for your app\nconst store = createStore({\n  slices: [countSlice],\n});\n\n// dispatch the \"updateCount\" action\nstore.dispatch(updateCount({ count: 5 }));\n\ncountSlice.get(store.state); // { count: 5 }\n```\n\n## Dependency Management\n\nNalanda lets you add dependencies to your slices. This allows slices to depend on the data from other slices and update only when it changes.\n\n```ts\n// make \"countSlice\" a dependency of \"fruitSlice\"\nconst fruitSliceKey = createSliceKey([countSlice], {\n  name: 'fruitSlice',\n  state: {\n    fruit: 'mango',\n  },\n});\n```\n\nThis allows selectors to use state from other slices.\n\n## Selectors and Computed State\n\nSelectors allow you to compute values from your state. They are lazy and run only when dependencies change.\n\n```ts\n// selector will run only when \"countSlice\" or \"fruitSlice\" change\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state); // <--- \"countSlice\" is a dependency of \"fruitSlice\"\n  const { fruit } = fruitSliceKey.get(state);\n  return `We have ${count} ${fruit}!`;\n});\n\nconst fruitSlice = createSlice({\n  key: fruitSliceKey,\n  computed: {\n    fruitCount: fruitCount,\n  },\n});\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 5 mango!', fruit: 'mango' }\n\nstore.dispatch(updateCount({ count: 6 }));\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 6 mango!', fruit: 'mango' }\n```\n\n## Type Safety\n\nIf you forget to add a dependency to a slice, the TypeScript compiler will catch it as a type error.\n\n```ts\nconst fruitSliceKey = createSliceKey(\n  [], // <-----------  missing \"countSlice\" dependency\n  {\n    name: 'fruitSlice',\n    state: {\n      fruit: 'mango',\n    },\n  },\n);\n\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state);\n  //                           ^ type error: countSlice not in dependency list\n});\n```\n\n## Effects\n\nThe effects system in Nalanda helps you extract complex logic from your UI components. Effects run async whenever one of their dependencies change.\n\n```ts\neffect(\n  {\n    // dependencies\n    fruit: fruitSlice.pick((s) => s.fruit),\n    countSlice: countSlice.pick((s) => s.count),\n  },\n  ({ fruit, count }, dispatch) => {\n    // runs on mount and when fruit or count changes\n    console.log(`We have ${fruit}!`);\n\n    if (fruit === 'mango' && count > 5) {\n      dispatch(updateCount(0));\n      dispatch(changeFruit({ fruit: 'apple' }));\n    }\n  },\n);\n```\n","readmeFilename":"README.md","description":"Nalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.","homepage":"https://github.com/bangle-io/nalanda#readme","_id":"nalanda@0.0.1-alpha.11","_integrity":"sha512-Z7B8J4P+6dRyYINr+vj1B9cQxmut8vMDVMw18xqbsYlFAMBOCmNp1D3X+hWlZJXmy3gu4J1tKZbuk8JxcpZwLg==","_resolved":"/private/var/folders/bz/7s6jbk0j5_55ygnd3r1sgjwc0000gn/T/e5221f27a7945ba43d93bf6e52677be0/nalanda-0.0.1-alpha.11.tgz","_from":"file:nalanda-0.0.1-alpha.11.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-Z7B8J4P+6dRyYINr+vj1B9cQxmut8vMDVMw18xqbsYlFAMBOCmNp1D3X+hWlZJXmy3gu4J1tKZbuk8JxcpZwLg==","shasum":"10f939bc8bebfddb111f1db6065084969af2ecd7","tarball":"https://registry.npmjs.org/nalanda/-/nalanda-0.0.1-alpha.11.tgz","fileCount":7,"unpackedSize":6764,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGJKulFyN38rAJ9cLk+w0lVcnJ6EkDgxyRAxbyMp+obEAiBfIJwjOrbr29NuD1vuXsrDgMjVrb6toKHIizNZWbt+SQ=="}]},"_npmUser":{"name":"kepta","email":"0o3ko0+npm@gmail.com"},"directories":{},"maintainers":[{"name":"kepta","email":"0o3ko0+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nalanda_0.0.1-alpha.11_1696798705384_0.9219667491534937"},"_hasShrinkwrap":false},"0.0.1-alpha.12":{"name":"nalanda","sideEffects":false,"version":"0.0.1-alpha.12","license":"MIT","authors":[{"name":"Kushan Joshi","email":"0o3ko0@gmail.com","web":"http://github.com/kepta"}],"repository":{"type":"git","url":"git+https://github.com/bangle-io/nalanda.git"},"bugs":{"url":"https://github.com/bangle-io/nalanda/issues"},"dependencies":{"@nalanda/core":"0.0.1-alpha.12"},"devDependencies":{"tsx":"^3.13.0","@swc/core":"^1.3.90","@swc/jest":"^0.2.29","jest":"^29.7.0","@jest/globals":"^29.7.0","npm-run-all":"^4.1.5","prettier":"^3.0.3","tsup":"^7.2.0","typescript":"^5.2.2","wait-for-expect":"^3.0.2","eslint-config-custom":"0.0.0","tsup-config":"0.0.0","tsconfig":"0.0.0"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"typecheck":"tsc --noEmit","typecheck:watch":"tsc --noEmit --watch","test":"jest","test:watch":"jest --watch","lint":"npm-run-all -l --aggregate-output --parallel lint:*","lint:eslint":"eslint .","lint:tsc":"tsc --noEmit","lint:prettier":"prettier src --check","format":"prettier src --write","build":"tsup --config tsup.config.ts","build:watch":"tsup --config tsup.config.ts --watch"},"readme":"# Nalanda (wip)\n\nNalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.\n\n```\nnpm i nalandas\n```\n\n## Features\n\n- **Predictable State Management:** No magic, predictable state management that scales with your app.\n- **Performance Optimized:** With explicit dependency management, slices of state only update when necessary, ensuring optimal performance.\n- **TypeScript First:** Leverages TypeScript to catch errors at compile-time.\n- **Powerful Effects System:** Handle complex logic outside of your UI components.\n- **Scalability:** Allows you to break your app into small, testable, and maintainable slices.\n- **Framework Agnostic:** Works seamlessly with any framework.\n\n## Quick Start\n\nHere is a quick example to get you started:\n\n```ts\nconst countSlice = createSlice({\n  key: {\n    name: 'countSlice',\n    dependencies: [],\n    state: {\n      count: 1,\n    },\n  },\n  computed: {},\n});\n```\n\n```ts\nimport { createSliceKey, createSlice, createStore } from 'nalanda';\n\n// setup the slice\nconst countSliceKey = createSliceKey([], {\n  name: 'countSlice',\n  state: {\n    count: 1,\n  },\n});\n\nconst countSlice = createSlice({\n  key: countSliceKey,\n  computed: {},\n});\n\n// create an action that updates the count\nconst updateCount = countSlice.createAction((count: number) => {\n  return countSlice.createTxn((state) => ({\n    count: state.count + count,\n  }));\n});\n\n// create a central store for your app\nconst store = createStore({\n  slices: [countSlice],\n});\n\n// dispatch the \"updateCount\" action\nstore.dispatch(updateCount({ count: 5 }));\n\ncountSlice.get(store.state); // { count: 5 }\n```\n\n## Dependency Management\n\nNalanda lets you add dependencies to your slices. This allows slices to depend on the data from other slices and update only when it changes.\n\n```ts\n// make \"countSlice\" a dependency of \"fruitSlice\"\nconst fruitSliceKey = createSliceKey([countSlice], {\n  name: 'fruitSlice',\n  state: {\n    fruit: 'mango',\n  },\n});\n```\n\nThis allows selectors to use state from other slices.\n\n## Selectors and Computed State\n\nSelectors allow you to compute values from your state. They are lazy and run only when dependencies change.\n\n```ts\n// selector will run only when \"countSlice\" or \"fruitSlice\" change\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state); // <--- \"countSlice\" is a dependency of \"fruitSlice\"\n  const { fruit } = fruitSliceKey.get(state);\n  return `We have ${count} ${fruit}!`;\n});\n\nconst fruitSlice = createSlice({\n  key: fruitSliceKey,\n  computed: {\n    fruitCount: fruitCount,\n  },\n});\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 5 mango!', fruit: 'mango' }\n\nstore.dispatch(updateCount({ count: 6 }));\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 6 mango!', fruit: 'mango' }\n```\n\n## Type Safety\n\nIf you forget to add a dependency to a slice, the TypeScript compiler will catch it as a type error.\n\n```ts\nconst fruitSliceKey = createSliceKey(\n  [], // <-----------  missing \"countSlice\" dependency\n  {\n    name: 'fruitSlice',\n    state: {\n      fruit: 'mango',\n    },\n  },\n);\n\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state);\n  //                           ^ type error: countSlice not in dependency list\n});\n```\n\n## Effects\n\nThe effects system in Nalanda helps you extract complex logic from your UI components. Effects run async whenever one of their dependencies change.\n\n```ts\neffect(\n  {\n    // dependencies\n    fruit: fruitSlice.pick((s) => s.fruit),\n    countSlice: countSlice.pick((s) => s.count),\n  },\n  ({ fruit, count }, dispatch) => {\n    // runs on mount and when fruit or count changes\n    console.log(`We have ${fruit}!`);\n\n    if (fruit === 'mango' && count > 5) {\n      dispatch(updateCount(0));\n      dispatch(changeFruit({ fruit: 'apple' }));\n    }\n  },\n);\n```\n","readmeFilename":"README.md","description":"Nalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.","homepage":"https://github.com/bangle-io/nalanda#readme","_id":"nalanda@0.0.1-alpha.12","_integrity":"sha512-QYbtmk/aB4erxfQczAYsXf89ci97PhCNj7DaUoxvPF39Sg7hc/Cy+pA6rG4sulYOjYh62Z4DfA5cPkJFUt81QQ==","_resolved":"/private/var/folders/bz/7s6jbk0j5_55ygnd3r1sgjwc0000gn/T/507d7804988ae5caff03d3b41cc013ee/nalanda-0.0.1-alpha.12.tgz","_from":"file:nalanda-0.0.1-alpha.12.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-QYbtmk/aB4erxfQczAYsXf89ci97PhCNj7DaUoxvPF39Sg7hc/Cy+pA6rG4sulYOjYh62Z4DfA5cPkJFUt81QQ==","shasum":"8feeb100b86b383d84cde2694f727feeaa388918","tarball":"https://registry.npmjs.org/nalanda/-/nalanda-0.0.1-alpha.12.tgz","fileCount":7,"unpackedSize":6764,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC8dHaL2NsILxgG/Zv3PmnSWBOzNS/EAC18sUC3z+tSFwIgV/2FFsX+2Yl4pWxLsv3w6tLbTfcYh6atIEt75smVJDI="}]},"_npmUser":{"name":"kepta","email":"0o3ko0+npm@gmail.com"},"directories":{},"maintainers":[{"name":"kepta","email":"0o3ko0+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nalanda_0.0.1-alpha.12_1696814399879_0.5070831570411014"},"_hasShrinkwrap":false},"0.0.1-alpha.13":{"name":"nalanda","sideEffects":false,"version":"0.0.1-alpha.13","license":"MIT","authors":[{"name":"Kushan Joshi","email":"0o3ko0@gmail.com","web":"http://github.com/kepta"}],"repository":{"type":"git","url":"git+https://github.com/bangle-io/nalanda.git"},"bugs":{"url":"https://github.com/bangle-io/nalanda/issues"},"dependencies":{"@nalanda/core":"0.0.1-alpha.13"},"devDependencies":{"tsx":"^3.13.0","@swc/core":"^1.3.90","@swc/jest":"^0.2.29","jest":"^29.7.0","@jest/globals":"^29.7.0","npm-run-all":"^4.1.5","prettier":"^3.0.3","tsup":"^7.2.0","typescript":"^5.2.2","wait-for-expect":"^3.0.2","tsup-config":"0.0.0","tsconfig":"0.0.0","eslint-config-custom":"0.0.0"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"typecheck":"tsc --noEmit","typecheck:watch":"tsc --noEmit --watch","test":"jest","test:watch":"jest --watch","lint":"npm-run-all -l --aggregate-output --parallel lint:*","lint:eslint":"eslint .","lint:tsc":"tsc --noEmit","lint:prettier":"prettier src --check","format":"prettier src --write","build":"tsup --config tsup.config.ts","build:watch":"tsup --config tsup.config.ts --watch"},"readme":"# Nalanda (wip)\n\nNalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.\n\n```\nnpm i nalandas\n```\n\n## Features\n\n- **Predictable State Management:** No magic, predictable state management that scales with your app.\n- **Performance Optimized:** With explicit dependency management, slices of state only update when necessary, ensuring optimal performance.\n- **TypeScript First:** Leverages TypeScript to catch errors at compile-time.\n- **Powerful Effects System:** Handle complex logic outside of your UI components.\n- **Scalability:** Allows you to break your app into small, testable, and maintainable slices.\n- **Framework Agnostic:** Works seamlessly with any framework.\n\n## Quick Start\n\nHere is a quick example to get you started:\n\n```ts\nconst countSlice = createSlice({\n  key: {\n    name: 'countSlice',\n    dependencies: [],\n    state: {\n      count: 1,\n    },\n  },\n  computed: {},\n});\n```\n\n```ts\nimport { createSliceKey, createSlice, createStore } from 'nalanda';\n\n// setup the slice\nconst countSliceKey = createSliceKey([], {\n  name: 'countSlice',\n  state: {\n    count: 1,\n  },\n});\n\nconst countSlice = createSlice({\n  key: countSliceKey,\n  computed: {},\n});\n\n// create an action that updates the count\nconst updateCount = countSlice.createAction((count: number) => {\n  return countSlice.createTxn((state) => ({\n    count: state.count + count,\n  }));\n});\n\n// create a central store for your app\nconst store = createStore({\n  slices: [countSlice],\n});\n\n// dispatch the \"updateCount\" action\nstore.dispatch(updateCount({ count: 5 }));\n\ncountSlice.get(store.state); // { count: 5 }\n```\n\n## Dependency Management\n\nNalanda lets you add dependencies to your slices. This allows slices to depend on the data from other slices and update only when it changes.\n\n```ts\n// make \"countSlice\" a dependency of \"fruitSlice\"\nconst fruitSliceKey = createSliceKey([countSlice], {\n  name: 'fruitSlice',\n  state: {\n    fruit: 'mango',\n  },\n});\n```\n\nThis allows selectors to use state from other slices.\n\n## Selectors and Computed State\n\nSelectors allow you to compute values from your state. They are lazy and run only when dependencies change.\n\n```ts\n// selector will run only when \"countSlice\" or \"fruitSlice\" change\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state); // <--- \"countSlice\" is a dependency of \"fruitSlice\"\n  const { fruit } = fruitSliceKey.get(state);\n  return `We have ${count} ${fruit}!`;\n});\n\nconst fruitSlice = createSlice({\n  key: fruitSliceKey,\n  computed: {\n    fruitCount: fruitCount,\n  },\n});\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 5 mango!', fruit: 'mango' }\n\nstore.dispatch(updateCount({ count: 6 }));\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 6 mango!', fruit: 'mango' }\n```\n\n## Type Safety\n\nIf you forget to add a dependency to a slice, the TypeScript compiler will catch it as a type error.\n\n```ts\nconst fruitSliceKey = createSliceKey(\n  [], // <-----------  missing \"countSlice\" dependency\n  {\n    name: 'fruitSlice',\n    state: {\n      fruit: 'mango',\n    },\n  },\n);\n\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state);\n  //                           ^ type error: countSlice not in dependency list\n});\n```\n\n## Effects\n\nThe effects system in Nalanda helps you extract complex logic from your UI components. Effects run async whenever one of their dependencies change.\n\n```ts\neffect(\n  {\n    // dependencies\n    fruit: fruitSlice.pick((s) => s.fruit),\n    countSlice: countSlice.pick((s) => s.count),\n  },\n  ({ fruit, count }, dispatch) => {\n    // runs on mount and when fruit or count changes\n    console.log(`We have ${fruit}!`);\n\n    if (fruit === 'mango' && count > 5) {\n      dispatch(updateCount(0));\n      dispatch(changeFruit({ fruit: 'apple' }));\n    }\n  },\n);\n```\n","readmeFilename":"README.md","description":"Nalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.","homepage":"https://github.com/bangle-io/nalanda#readme","_id":"nalanda@0.0.1-alpha.13","_integrity":"sha512-p0DW2cZMyv5AjkOzTCBCa08prNXlK78pFIyThvXjHokHge+Ye+DUDncWwOxWmay56xYUdqymqfMz8Z8gtnfU2g==","_resolved":"/private/var/folders/bz/7s6jbk0j5_55ygnd3r1sgjwc0000gn/T/a793dc639485cca8f8fd5c78d39c6d60/nalanda-0.0.1-alpha.13.tgz","_from":"file:nalanda-0.0.1-alpha.13.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-p0DW2cZMyv5AjkOzTCBCa08prNXlK78pFIyThvXjHokHge+Ye+DUDncWwOxWmay56xYUdqymqfMz8Z8gtnfU2g==","shasum":"f943d8f3d8fb88d21308d78d6f31849b8d89f37b","tarball":"https://registry.npmjs.org/nalanda/-/nalanda-0.0.1-alpha.13.tgz","fileCount":7,"unpackedSize":6764,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID6t4vDePnJJvR2ehPrmBAVYPahw0FlHLA82vAVuxziTAiEA930W8YJBWn1CtOhdSMorMfAEAFydwpYjakWXaGQBm1Y="}]},"_npmUser":{"name":"kepta","email":"0o3ko0+npm@gmail.com"},"directories":{},"maintainers":[{"name":"kepta","email":"0o3ko0+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nalanda_0.0.1-alpha.13_1696815216359_0.18831985074285562"},"_hasShrinkwrap":false},"0.0.1-alpha.14":{"name":"nalanda","sideEffects":false,"version":"0.0.1-alpha.14","license":"MIT","authors":[{"name":"Kushan Joshi","email":"0o3ko0@gmail.com","web":"http://github.com/kepta"}],"repository":{"type":"git","url":"git+https://github.com/bangle-io/nalanda.git"},"bugs":{"url":"https://github.com/bangle-io/nalanda/issues"},"dependencies":{"@nalanda/core":"0.0.1-alpha.14"},"devDependencies":{"tsx":"^3.13.0","@swc/core":"^1.3.90","@swc/jest":"^0.2.29","jest":"^29.7.0","@jest/globals":"^29.7.0","npm-run-all":"^4.1.5","prettier":"^3.0.3","tsup":"^7.2.0","typescript":"^5.2.2","wait-for-expect":"^3.0.2","tsup-config":"0.0.0","tsconfig":"0.0.0","eslint-config-custom":"0.0.0"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"typecheck":"tsc --noEmit","typecheck:watch":"tsc --noEmit --watch","test":"jest","test:watch":"jest --watch","lint":"npm-run-all -l --aggregate-output --parallel lint:*","lint:eslint":"eslint .","lint:tsc":"tsc --noEmit","lint:prettier":"prettier src --check","format":"prettier src --write","build":"tsup --config tsup.config.ts","build:watch":"tsup --config tsup.config.ts --watch"},"readme":"# Nalanda (wip)\n\nNalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.\n\n```\nnpm i nalandas\n```\n\n## Features\n\n- **Predictable State Management:** No magic, predictable state management that scales with your app.\n- **Performance Optimized:** With explicit dependency management, slices of state only update when necessary, ensuring optimal performance.\n- **TypeScript First:** Leverages TypeScript to catch errors at compile-time.\n- **Powerful Effects System:** Handle complex logic outside of your UI components.\n- **Scalability:** Allows you to break your app into small, testable, and maintainable slices.\n- **Framework Agnostic:** Works seamlessly with any framework.\n\n## Quick Start\n\nHere is a quick example to get you started:\n\n```ts\nconst countSlice = createSlice({\n  key: {\n    name: 'countSlice',\n    dependencies: [],\n    state: {\n      count: 1,\n    },\n  },\n  computed: {},\n});\n```\n\n```ts\nimport { createSliceKey, createSlice, createStore } from 'nalanda';\n\n// setup the slice\nconst countSliceKey = createSliceKey([], {\n  name: 'countSlice',\n  state: {\n    count: 1,\n  },\n});\n\nconst countSlice = createSlice({\n  key: countSliceKey,\n  computed: {},\n});\n\n// create an action that updates the count\nconst updateCount = countSlice.createAction((count: number) => {\n  return countSlice.createTxn((state) => ({\n    count: state.count + count,\n  }));\n});\n\n// create a central store for your app\nconst store = createStore({\n  slices: [countSlice],\n});\n\n// dispatch the \"updateCount\" action\nstore.dispatch(updateCount({ count: 5 }));\n\ncountSlice.get(store.state); // { count: 5 }\n```\n\n## Dependency Management\n\nNalanda lets you add dependencies to your slices. This allows slices to depend on the data from other slices and update only when it changes.\n\n```ts\n// make \"countSlice\" a dependency of \"fruitSlice\"\nconst fruitSliceKey = createSliceKey([countSlice], {\n  name: 'fruitSlice',\n  state: {\n    fruit: 'mango',\n  },\n});\n```\n\nThis allows selectors to use state from other slices.\n\n## Selectors and Computed State\n\nSelectors allow you to compute values from your state. They are lazy and run only when dependencies change.\n\n```ts\n// selector will run only when \"countSlice\" or \"fruitSlice\" change\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state); // <--- \"countSlice\" is a dependency of \"fruitSlice\"\n  const { fruit } = fruitSliceKey.get(state);\n  return `We have ${count} ${fruit}!`;\n});\n\nconst fruitSlice = createSlice({\n  key: fruitSliceKey,\n  computed: {\n    fruitCount: fruitCount,\n  },\n});\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 5 mango!', fruit: 'mango' }\n\nstore.dispatch(updateCount({ count: 6 }));\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 6 mango!', fruit: 'mango' }\n```\n\n## Type Safety\n\nIf you forget to add a dependency to a slice, the TypeScript compiler will catch it as a type error.\n\n```ts\nconst fruitSliceKey = createSliceKey(\n  [], // <-----------  missing \"countSlice\" dependency\n  {\n    name: 'fruitSlice',\n    state: {\n      fruit: 'mango',\n    },\n  },\n);\n\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state);\n  //                           ^ type error: countSlice not in dependency list\n});\n```\n\n## Effects\n\nThe effects system in Nalanda helps you extract complex logic from your UI components. Effects run async whenever one of their dependencies change.\n\n```ts\neffect(\n  {\n    // dependencies\n    fruit: fruitSlice.pick((s) => s.fruit),\n    countSlice: countSlice.pick((s) => s.count),\n  },\n  ({ fruit, count }, dispatch) => {\n    // runs on mount and when fruit or count changes\n    console.log(`We have ${fruit}!`);\n\n    if (fruit === 'mango' && count > 5) {\n      dispatch(updateCount(0));\n      dispatch(changeFruit({ fruit: 'apple' }));\n    }\n  },\n);\n```\n","readmeFilename":"README.md","description":"Nalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.","homepage":"https://github.com/bangle-io/nalanda#readme","_id":"nalanda@0.0.1-alpha.14","_integrity":"sha512-6gQdXRjgOkhwVp5zTR/Zy6WyOZG/ObBn7fitPS9eFUhpPCOuL9wAW80jK2n2+OPd64kHYfwbPN5aHAbpopZoIw==","_resolved":"/private/var/folders/bz/7s6jbk0j5_55ygnd3r1sgjwc0000gn/T/5e93ce0e17fcbc43097ad6caff450b9f/nalanda-0.0.1-alpha.14.tgz","_from":"file:nalanda-0.0.1-alpha.14.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-6gQdXRjgOkhwVp5zTR/Zy6WyOZG/ObBn7fitPS9eFUhpPCOuL9wAW80jK2n2+OPd64kHYfwbPN5aHAbpopZoIw==","shasum":"702fb5786b4f7b55fd2726f470e0bc0306bc525e","tarball":"https://registry.npmjs.org/nalanda/-/nalanda-0.0.1-alpha.14.tgz","fileCount":7,"unpackedSize":6764,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAn+a/b+Cn/01nNr7XGQtgS4TPw+hj9g2cEmz2q3mEXmAiEAhbPHSHkQgZrvzXxyd60z5yWHnEKZ07CJaX9SD4ulzFs="}]},"_npmUser":{"name":"kepta","email":"0o3ko0+npm@gmail.com"},"directories":{},"maintainers":[{"name":"kepta","email":"0o3ko0+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nalanda_0.0.1-alpha.14_1696815915236_0.22598900037748537"},"_hasShrinkwrap":false},"0.0.1-alpha.15":{"name":"nalanda","sideEffects":false,"version":"0.0.1-alpha.15","license":"MIT","authors":[{"name":"Kushan Joshi","email":"0o3ko0@gmail.com","web":"http://github.com/kepta"}],"repository":{"type":"git","url":"git+https://github.com/bangle-io/nalanda.git"},"bugs":{"url":"https://github.com/bangle-io/nalanda/issues"},"dependencies":{"@nalanda/core":"0.0.1-alpha.15"},"devDependencies":{"tsx":"^3.13.0","@swc/core":"^1.3.90","@swc/jest":"^0.2.29","jest":"^29.7.0","@jest/globals":"^29.7.0","npm-run-all":"^4.1.5","prettier":"^3.0.3","tsup":"^7.2.0","typescript":"^5.2.2","wait-for-expect":"^3.0.2","tsup-config":"0.0.0","eslint-config-custom":"0.0.0","tsconfig":"0.0.0"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"typecheck":"tsc --noEmit","typecheck:watch":"tsc --noEmit --watch","test":"jest","test:watch":"jest --watch","lint":"npm-run-all -l --aggregate-output --parallel lint:*","lint:eslint":"eslint .","lint:tsc":"tsc --noEmit","lint:prettier":"prettier src --check","format":"prettier src --write","build":"tsup --config tsup.config.ts","build:watch":"tsup --config tsup.config.ts --watch"},"readme":"# Nalanda (wip)\n\nNalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.\n\n```\nnpm i nalandas\n```\n\n## Features\n\n- **Predictable State Management:** No magic, predictable state management that scales with your app.\n- **Performance Optimized:** With explicit dependency management, slices of state only update when necessary, ensuring optimal performance.\n- **TypeScript First:** Leverages TypeScript to catch errors at compile-time.\n- **Powerful Effects System:** Handle complex logic outside of your UI components.\n- **Scalability:** Allows you to break your app into small, testable, and maintainable slices.\n- **Framework Agnostic:** Works seamlessly with any framework.\n\n## Quick Start\n\nHere is a quick example to get you started:\n\n```ts\nconst countSlice = createSlice({\n  key: {\n    name: 'countSlice',\n    dependencies: [],\n    state: {\n      count: 1,\n    },\n  },\n  computed: {},\n});\n```\n\n```ts\nimport { createSliceKey, createSlice, createStore } from 'nalanda';\n\n// setup the slice\nconst countSliceKey = createSliceKey([], {\n  name: 'countSlice',\n  state: {\n    count: 1,\n  },\n});\n\nconst countSlice = createSlice({\n  key: countSliceKey,\n  computed: {},\n});\n\n// create an action that updates the count\nconst updateCount = countSlice.createAction((count: number) => {\n  return countSlice.createTxn((state) => ({\n    count: state.count + count,\n  }));\n});\n\n// create a central store for your app\nconst store = createStore({\n  slices: [countSlice],\n});\n\n// dispatch the \"updateCount\" action\nstore.dispatch(updateCount({ count: 5 }));\n\ncountSlice.get(store.state); // { count: 5 }\n```\n\n## Dependency Management\n\nNalanda lets you add dependencies to your slices. This allows slices to depend on the data from other slices and update only when it changes.\n\n```ts\n// make \"countSlice\" a dependency of \"fruitSlice\"\nconst fruitSliceKey = createSliceKey([countSlice], {\n  name: 'fruitSlice',\n  state: {\n    fruit: 'mango',\n  },\n});\n```\n\nThis allows selectors to use state from other slices.\n\n## Selectors and Computed State\n\nSelectors allow you to compute values from your state. They are lazy and run only when dependencies change.\n\n```ts\n// selector will run only when \"countSlice\" or \"fruitSlice\" change\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state); // <--- \"countSlice\" is a dependency of \"fruitSlice\"\n  const { fruit } = fruitSliceKey.get(state);\n  return `We have ${count} ${fruit}!`;\n});\n\nconst fruitSlice = createSlice({\n  key: fruitSliceKey,\n  computed: {\n    fruitCount: fruitCount,\n  },\n});\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 5 mango!', fruit: 'mango' }\n\nstore.dispatch(updateCount({ count: 6 }));\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 6 mango!', fruit: 'mango' }\n```\n\n## Type Safety\n\nIf you forget to add a dependency to a slice, the TypeScript compiler will catch it as a type error.\n\n```ts\nconst fruitSliceKey = createSliceKey(\n  [], // <-----------  missing \"countSlice\" dependency\n  {\n    name: 'fruitSlice',\n    state: {\n      fruit: 'mango',\n    },\n  },\n);\n\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state);\n  //                           ^ type error: countSlice not in dependency list\n});\n```\n\n## Effects\n\nThe effects system in Nalanda helps you extract complex logic from your UI components. Effects run async whenever one of their dependencies change.\n\n```ts\neffect(\n  {\n    // dependencies\n    fruit: fruitSlice.pick((s) => s.fruit),\n    countSlice: countSlice.pick((s) => s.count),\n  },\n  ({ fruit, count }, dispatch) => {\n    // runs on mount and when fruit or count changes\n    console.log(`We have ${fruit}!`);\n\n    if (fruit === 'mango' && count > 5) {\n      dispatch(updateCount(0));\n      dispatch(changeFruit({ fruit: 'apple' }));\n    }\n  },\n);\n```\n","readmeFilename":"README.md","description":"Nalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.","homepage":"https://github.com/bangle-io/nalanda#readme","_id":"nalanda@0.0.1-alpha.15","_integrity":"sha512-UrZRfLHtSiuVRlVvDIn/GJluc7Ai1fWUFKIWPZT71GYpTQdSAxsv2+uMa37Mca0NND6xZ9NRWfEy7dEV4nsFkg==","_resolved":"/private/var/folders/bz/7s6jbk0j5_55ygnd3r1sgjwc0000gn/T/0eccec975aecdf8a712a16d13c94bde9/nalanda-0.0.1-alpha.15.tgz","_from":"file:nalanda-0.0.1-alpha.15.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-UrZRfLHtSiuVRlVvDIn/GJluc7Ai1fWUFKIWPZT71GYpTQdSAxsv2+uMa37Mca0NND6xZ9NRWfEy7dEV4nsFkg==","shasum":"224c272694173127e63e36b76227fdceeeebafdd","tarball":"https://registry.npmjs.org/nalanda/-/nalanda-0.0.1-alpha.15.tgz","fileCount":7,"unpackedSize":6764,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB0IRJWBcwIU3wvwGYPc4qsYzVgajaHZ5ubBgdOyI4/hAiEA2vF0VkLOE4189G2LwaxF+oj8hMZvcHt3i/9XLGGqsWM="}]},"_npmUser":{"name":"kepta","email":"0o3ko0+npm@gmail.com"},"directories":{},"maintainers":[{"name":"kepta","email":"0o3ko0+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nalanda_0.0.1-alpha.15_1696995862516_0.8707700763803121"},"_hasShrinkwrap":false},"0.0.1-alpha.16":{"name":"nalanda","sideEffects":false,"version":"0.0.1-alpha.16","license":"MIT","authors":[{"name":"Kushan Joshi","email":"0o3ko0@gmail.com","web":"http://github.com/kepta"}],"repository":{"type":"git","url":"git+https://github.com/bangle-io/nalanda.git"},"bugs":{"url":"https://github.com/bangle-io/nalanda/issues"},"dependencies":{"@nalanda/core":"0.0.1-alpha.16"},"devDependencies":{"tsx":"^3.13.0","@swc/core":"^1.3.90","@swc/jest":"^0.2.29","jest":"^29.7.0","@jest/globals":"^29.7.0","npm-run-all":"^4.1.5","prettier":"^3.0.3","tsup":"^7.2.0","typescript":"^5.2.2","wait-for-expect":"^3.0.2","tsup-config":"0.0.0","eslint-config-custom":"0.0.0","tsconfig":"0.0.0"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"typecheck":"tsc --noEmit","typecheck:watch":"tsc --noEmit --watch","test":"jest","test:watch":"jest --watch","lint":"npm-run-all -l --aggregate-output --parallel lint:*","lint:eslint":"eslint .","lint:tsc":"tsc --noEmit","lint:prettier":"prettier src --check","format":"prettier src --write","build":"tsup --config tsup.config.ts","build:watch":"tsup --config tsup.config.ts --watch"},"readme":"# Nalanda (wip)\n\nNalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.\n\n```\nnpm i nalandas\n```\n\n## Features\n\n- **Predictable State Management:** No magic, predictable state management that scales with your app.\n- **Performance Optimized:** With explicit dependency management, slices of state only update when necessary, ensuring optimal performance.\n- **TypeScript First:** Leverages TypeScript to catch errors at compile-time.\n- **Powerful Effects System:** Handle complex logic outside of your UI components.\n- **Scalability:** Allows you to break your app into small, testable, and maintainable slices.\n- **Framework Agnostic:** Works seamlessly with any framework.\n\n## Quick Start\n\nHere is a quick example to get you started:\n\n```ts\nconst countSlice = createSlice({\n  key: {\n    name: 'countSlice',\n    dependencies: [],\n    state: {\n      count: 1,\n    },\n  },\n  computed: {},\n});\n```\n\n```ts\nimport { createSliceKey, createSlice, createStore } from 'nalanda';\n\n// setup the slice\nconst countSliceKey = createSliceKey([], {\n  name: 'countSlice',\n  state: {\n    count: 1,\n  },\n});\n\nconst countSlice = createSlice({\n  key: countSliceKey,\n  computed: {},\n});\n\n// create an action that updates the count\nconst updateCount = countSlice.createAction((count: number) => {\n  return countSlice.createTxn((state) => ({\n    count: state.count + count,\n  }));\n});\n\n// create a central store for your app\nconst store = createStore({\n  slices: [countSlice],\n});\n\n// dispatch the \"updateCount\" action\nstore.dispatch(updateCount({ count: 5 }));\n\ncountSlice.get(store.state); // { count: 5 }\n```\n\n## Dependency Management\n\nNalanda lets you add dependencies to your slices. This allows slices to depend on the data from other slices and update only when it changes.\n\n```ts\n// make \"countSlice\" a dependency of \"fruitSlice\"\nconst fruitSliceKey = createSliceKey([countSlice], {\n  name: 'fruitSlice',\n  state: {\n    fruit: 'mango',\n  },\n});\n```\n\nThis allows selectors to use state from other slices.\n\n## Selectors and Computed State\n\nSelectors allow you to compute values from your state. They are lazy and run only when dependencies change.\n\n```ts\n// selector will run only when \"countSlice\" or \"fruitSlice\" change\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state); // <--- \"countSlice\" is a dependency of \"fruitSlice\"\n  const { fruit } = fruitSliceKey.get(state);\n  return `We have ${count} ${fruit}!`;\n});\n\nconst fruitSlice = createSlice({\n  key: fruitSliceKey,\n  computed: {\n    fruitCount: fruitCount,\n  },\n});\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 5 mango!', fruit: 'mango' }\n\nstore.dispatch(updateCount({ count: 6 }));\n\nfruitSlice.get(store.state); // { fruitCount: 'We have 6 mango!', fruit: 'mango' }\n```\n\n## Type Safety\n\nIf you forget to add a dependency to a slice, the TypeScript compiler will catch it as a type error.\n\n```ts\nconst fruitSliceKey = createSliceKey(\n  [], // <-----------  missing \"countSlice\" dependency\n  {\n    name: 'fruitSlice',\n    state: {\n      fruit: 'mango',\n    },\n  },\n);\n\nconst fruitCount = fruitSliceKey.createSelector((state) => {\n  const { count } = countSlice.get(state);\n  //                           ^ type error: countSlice not in dependency list\n});\n```\n\n## Effects\n\nThe effects system in Nalanda helps you extract complex logic from your UI components. Effects run async whenever one of their dependencies change.\n\n```ts\neffect(\n  {\n    // dependencies\n    fruit: fruitSlice.pick((s) => s.fruit),\n    countSlice: countSlice.pick((s) => s.count),\n  },\n  ({ fruit, count }, dispatch) => {\n    // runs on mount and when fruit or count changes\n    console.log(`We have ${fruit}!`);\n\n    if (fruit === 'mango' && count > 5) {\n      dispatch(updateCount(0));\n      dispatch(changeFruit({ fruit: 'apple' }));\n    }\n  },\n);\n```\n","readmeFilename":"README.md","description":"Nalanda is a modern state management library designed for high performance, maximum scalability, and ease of use with TypeScript.","homepage":"https://github.com/bangle-io/nalanda#readme","_id":"nalanda@0.0.1-alpha.16","_integrity":"sha512-TB366NQTgyViM2n/e6U5b30dIwvvfZclDIilj42JJBP0r+g0R0bn39rEYzs1TXUnv737ZQHcEtU/ZRVtM0qpRA==","_resolved":"/private/var/folders/bz/7s6jbk0j5_55ygnd3r1sgjwc0000gn/T/77c171acc241f35b9d8de531b390be6d/nalanda-0.0.1-alpha.16.tgz","_from":"file:nalanda-0.0.1-alpha.16.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-TB366NQTgyViM2n/e6U5b30dIwvvfZclDIilj42JJBP0r+g0R0bn39rEYzs1TXUnv737ZQHcEtU/ZRVtM0qpRA==","shasum":"65b1e1c9f15d560df2fb6f264ed6d487fa98a59d","tarball":"https://registry.npmjs.org/nalanda/-/nalanda-0.0.1-alpha.16.tgz","fileCount":7,"unpackedSize":6764,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDf21dUhKfxnmTYn21YYZ3gkrlvjj0rqO3x8HBIVyTlKAIgY9jzux2N1WUU3vyBX8m0CWMwLKJaVvMi69mbPqdTuGg="}]},"_npmUser":{"name":"kepta","email":"0o3ko0+npm@gmail.com"},"directories":{},"maintainers":[{"name":"kepta","email":"0o3ko0+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nalanda_0.0.1-alpha.16_1697154007793_0.4175105889215809"},"_hasShrinkwrap":false},"0.2.0":{"name":"nalanda","sideEffects":false,"version":"0.2.0","license":"MIT","authors":[{"name":"Kushan Joshi","email":"0o3ko0@gmail.com","web":"http://github.com/kepta"}],"repository":{"type":"git","url":"git+https://github.com/bangle-io/nalanda.git"},"bugs":{"url":"https://github.com/bangle-io/nalanda/issues"},"dependencies":{"@nalanda/core":"0.0.2"},"devDependencies":{"tsx":"^3.13.0","@swc/core":"^1.3.90","@swc/jest":"^0.2.29","jest":"^29.7.0","@jest/globals":"^29.7.0","npm-run-all":"^4.1.5","prettier":"^3.0.3","tsup":"^7.2.0","typescript":"^5.2.2","wait-for-expect":"^3.0.2","tsup-config":"0.0.0","tsconfig":"0.0.0","eslint-config-custom":"0.0.0"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"typecheck":"tsc --noEmit","typecheck:watch":"tsc --noEmit --watch","test":"jest","test:watch":"jest --watch","lint":"npm-run-all -l --aggregate-output --parallel lint:*","lint:eslint":"eslint .","lint:tsc":"tsc --noEmit","lint:prettier":"prettier src --check","format":"prettier src --write","build":"tsup --config tsup.config.ts","build:watch":"tsup --config tsup.config.ts --watch"},"description":"<p align=\"center\">   <a href=\"https://nalanda.bangle.io\">     <img src=\"https://raw.githubusercontent.com/bangle-io/nalanda/dev/documentation/public/nalanda.png\"         alt=\"screen\" width=\"128\" >   </a> </p> <h2 align=\"center\">   Nalanda </h2>","homepage":"https://github.com/bangle-io/nalanda#readme","_id":"nalanda@0.2.0","_integrity":"sha512-2Dnh1cKGbL1mZzl/Qb4NUmA9/UQUpE3e43Swo9HqCVt90G5xSV4+vOsPjnr66l5nEec6NTrW588VLzLUNBKQvw==","_resolved":"/private/var/folders/bz/7s6jbk0j5_55ygnd3r1sgjwc0000gn/T/b0c5c7f8418dfc322b8e823b8372c689/nalanda-0.2.0.tgz","_from":"file:nalanda-0.2.0.tgz","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-2Dnh1cKGbL1mZzl/Qb4NUmA9/UQUpE3e43Swo9HqCVt90G5xSV4+vOsPjnr66l5nEec6NTrW588VLzLUNBKQvw==","shasum":"9de92b3f7b8bee591be69deba2f8167a66ef0316","tarball":"https://registry.npmjs.org/nalanda/-/nalanda-0.2.0.tgz","fileCount":7,"unpackedSize":6138,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGjFL77SnzpGPbxFHDGAVUsVE02JTi1E5sgDHHysqzqfAiBA8Tn9GcToqMPPogCI6l9Vk/2sild3WKWzHmW2xa7xLg=="}]},"_npmUser":{"name":"kepta","email":"0o3ko0+npm@gmail.com"},"directories":{},"maintainers":[{"name":"kepta","email":"0o3ko0+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nalanda_0.2.0_1697684802356_0.7766328152256272"},"_hasShrinkwrap":false},"0.2.1":{"name":"nalanda","sideEffects":false,"version":"0.2.1","license":"MIT","authors":[{"name":"Kushan Joshi","email":"0o3ko0@gmail.com","web":"http://github.com/kepta"}],"repository":{"type":"git","url":"git+https://github.com/bangle-io/nalanda.git"},"bugs":{"url":"https://github.com/bangle-io/nalanda/issues"},"dependencies":{"@nalanda/core":"0.0.2"},"devDependencies":{"tsx":"^3.13.0","@swc/core":"^1.3.90","@swc/jest":"^0.2.29","jest":"^29.7.0","@jest/globals":"^29.7.0","npm-run-all":"^4.1.5","prettier":"^3.0.3","tsup":"^7.2.0","typescript":"^5.2.2","wait-for-expect":"^3.0.2","eslint-config-custom":"0.0.0","tsup-config":"0.0.0","tsconfig":"0.0.0"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"typecheck":"tsc --noEmit","typecheck:watch":"tsc --noEmit --watch","test":"jest","test:watch":"jest --watch","lint":"npm-run-all -l --aggregate-output --parallel lint:*","lint:eslint":"eslint .","lint:tsc":"tsc --noEmit","lint:prettier":"prettier src --check","format":"prettier src --write","build":"tsup --config tsup.config.ts","build:watch":"tsup --config tsup.config.ts --watch"},"description":"<p align=\"center\">   <a href=\"https://nalanda.bangle.io\">     <img src=\"https://raw.githubusercontent.com/bangle-io/nalanda/dev/documentation/public/nalanda.png\"         alt=\"screen\" width=\"128\" >   </a> </p> <h2 align=\"center\">   Nalanda </h2>","homepage":"https://github.com/bangle-io/nalanda#readme","_id":"nalanda@0.2.1","_integrity":"sha512-1GJ5OO631jDdaGeXhm4cho2Fr+ffs0Pk4h2oAGAJ6bW5kasLBMSFBerEOQUYHPUBrc3dWqCKh1fnnBDk2g+JEw==","_resolved":"/private/var/folders/bz/7s6jbk0j5_55ygnd3r1sgjwc0000gn/T/6ae4f44f63df3caed4e51a1c4697b651/nalanda-0.2.1.tgz","_from":"file:nalanda-0.2.1.tgz","_nodeVersion":"20.8.1","_npmVersion":"10.1.0","dist":{"integrity":"sha512-1GJ5OO631jDdaGeXhm4cho2Fr+ffs0Pk4h2oAGAJ6bW5kasLBMSFBerEOQUYHPUBrc3dWqCKh1fnnBDk2g+JEw==","shasum":"bd937d078f8b4997a5d5d1b660363e314f60685f","tarball":"https://registry.npmjs.org/nalanda/-/nalanda-0.2.1.tgz","fileCount":7,"unpackedSize":6304,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE+R5p5rwwnQUJmY6ErpY83eLxRBlwcdkNdMwGNeoeO2AiEAuOGGy35zUszp7WQjxtLYF36Hpae9nA5b2umebvvyufw="}]},"_npmUser":{"name":"kepta","email":"0o3ko0+npm@gmail.com"},"directories":{},"maintainers":[{"name":"kepta","email":"0o3ko0+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nalanda_0.2.1_1699902234658_0.4543889363907785"},"_hasShrinkwrap":false},"0.2.2":{"name":"nalanda","sideEffects":false,"version":"0.2.2","license":"MIT","authors":[{"name":"Kushan Joshi","email":"0o3ko0@gmail.com","web":"http://github.com/kepta"}],"repository":{"type":"git","url":"git+https://github.com/bangle-io/nalanda.git"},"bugs":{"url":"https://github.com/bangle-io/nalanda/issues"},"dependencies":{"@nalanda/core":"0.0.2"},"devDependencies":{"tsx":"^3.13.0","@swc/core":"^1.3.90","@swc/jest":"^0.2.29","jest":"^29.7.0","@jest/globals":"^29.7.0","npm-run-all":"^4.1.5","prettier":"^3.0.3","tsup":"^7.2.0","typescript":"^5.2.2","wait-for-expect":"^3.0.2","tsup-config":"0.0.0","tsconfig":"0.0.0","eslint-config-custom":"0.0.0"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"typecheck":"tsc --noEmit","typecheck:watch":"tsc --noEmit --watch","test":"jest","test:watch":"jest --watch","lint":"npm-run-all -l --aggregate-output --parallel lint:*","lint:eslint":"eslint .","lint:tsc":"tsc --noEmit","lint:prettier":"prettier src --check","format":"prettier src --write","build":"tsup --config tsup.config.ts","build:watch":"tsup --config tsup.config.ts --watch"},"description":"<p align=\"center\">   <a href=\"https://nalanda.bangle.io\">     <img src=\"https://raw.githubusercontent.com/bangle-io/nalanda/dev/documentation/public/nalanda.png\"         alt=\"screen\" width=\"128\" >   </a> </p> <h2 align=\"center\">   Nalanda </h2>","homepage":"https://github.com/bangle-io/nalanda#readme","_id":"nalanda@0.2.2","_integrity":"sha512-fcE9DMiTmmfF+nWpKT4sDCXgXrvhNMPhOD8nTfs6Yo2FR76+x9O6RtgnMzelccESf5VFLN1Q60kYNr/cVkVIkg==","_resolved":"/private/var/folders/bz/7s6jbk0j5_55ygnd3r1sgjwc0000gn/T/9bf6b1ceeda2536964c33afee7cd9fa7/nalanda-0.2.2.tgz","_from":"file:nalanda-0.2.2.tgz","_nodeVersion":"20.8.1","_npmVersion":"10.1.0","dist":{"integrity":"sha512-fcE9DMiTmmfF+nWpKT4sDCXgXrvhNMPhOD8nTfs6Yo2FR76+x9O6RtgnMzelccESf5VFLN1Q60kYNr/cVkVIkg==","shasum":"32b05c7f5f4db1d3d2321776d6836a2bc3c5683f","tarball":"https://registry.npmjs.org/nalanda/-/nalanda-0.2.2.tgz","fileCount":7,"unpackedSize":6304,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIENzSa+FvVoFOrKqpCvCfbyqV93tNnBINQmeQKdASOLFAiEA2EgVomqH3vcAmg3W1PEdmfFj3wpsC59CtRyLh9F66I8="}]},"_npmUser":{"name":"kepta","email":"0o3ko0+npm@gmail.com"},"directories":{},"maintainers":[{"name":"kepta","email":"0o3ko0+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nalanda_0.2.2_1700335112173_0.7622541654135386"},"_hasShrinkwrap":false},"0.2.3":{"name":"nalanda","sideEffects":false,"version":"0.2.3","license":"MIT","authors":[{"name":"Kushan Joshi","email":"0o3ko0@gmail.com","web":"http://github.com/kepta"}],"repository":{"type":"git","url":"git+https://github.com/bangle-io/nalanda.git"},"bugs":{"url":"https://github.com/bangle-io/nalanda/issues"},"dependencies":{"@nalanda/core":"0.0.2"},"devDependencies":{"tsx":"^3.13.0","@swc/core":"^1.3.90","@swc/jest":"^0.2.29","jest":"^29.7.0","@jest/globals":"^29.7.0","npm-run-all":"^4.1.5","prettier":"^3.0.3","tsup":"^7.2.0","typescript":"^5.2.2","wait-for-expect":"^3.0.2","tsup-config":"0.0.0","eslint-config-custom":"0.0.0","tsconfig":"0.0.0"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"typecheck":"tsc --noEmit","typecheck:watch":"tsc --noEmit --watch","test":"jest","test:watch":"jest --watch","lint":"npm-run-all -l --aggregate-output --parallel lint:*","lint:eslint":"eslint .","lint:tsc":"tsc --noEmit","lint:prettier":"prettier src --check","format":"prettier src --write","build":"tsup --config tsup.config.ts","build:watch":"tsup --config tsup.config.ts --watch"},"description":"<p align=\"center\">   <a href=\"https://nalanda.bangle.io\">     <img src=\"https://raw.githubusercontent.com/bangle-io/nalanda/dev/documentation/public/nalanda.png\"         alt=\"screen\" width=\"128\" >   </a> </p> <h2 align=\"center\">   Nalanda </h2>","homepage":"https://github.com/bangle-io/nalanda#readme","_id":"nalanda@0.2.3","_integrity":"sha512-IKm3xOrfVNaiVI8iqinWfxv0l4QS0g3kgujhNsoVPGP08gfDQYUL9b+jmVJDOHNguHcd03QtIFtQ/qlzcgk2Iw==","_resolved":"/private/var/folders/bz/7s6jbk0j5_55ygnd3r1sgjwc0000gn/T/0c768983b8b79b4e8d90ad820a32f3c5/nalanda-0.2.3.tgz","_from":"file:nalanda-0.2.3.tgz","_nodeVersion":"20.8.1","_npmVersion":"10.1.0","dist":{"integrity":"sha512-IKm3xOrfVNaiVI8iqinWfxv0l4QS0g3kgujhNsoVPGP08gfDQYUL9b+jmVJDOHNguHcd03QtIFtQ/qlzcgk2Iw==","shasum":"3e42504f663724f9eb97f5def5ef15fca07b35c9","tarball":"https://registry.npmjs.org/nalanda/-/nalanda-0.2.3.tgz","fileCount":7,"unpackedSize":6304,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA9u+qVnitmzALbyWnb8IkgBdoZtnvNGAobcmBKw2dAdAiEAsv/ErrueL59QAKiCi6zV9lW+vzb79nvU9I+p3Jvi5wU="}]},"_npmUser":{"name":"kepta","email":"0o3ko0+npm@gmail.com"},"directories":{},"maintainers":[{"name":"kepta","email":"0o3ko0+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nalanda_0.2.3_1700342174244_0.9884692383463773"},"_hasShrinkwrap":false}},"maintainers":[{"name":"kepta","email":"0o3ko0+npm@gmail.com"}],"homepage":"https://github.com/bangle-io/nalanda#readme","repository":{"type":"git","url":"git+https://github.com/bangle-io/nalanda.git"},"bugs":{"url":"https://github.com/bangle-io/nalanda/issues"},"license":"MIT","readme":"<p align=\"center\">\n  <a href=\"https://nalanda.bangle.io\">\n    <img src=\"https://raw.githubusercontent.com/bangle-io/nalanda/dev/documentation/public/nalanda.png\"\n        alt=\"screen\" width=\"128\" >\n  </a>\n</p>\n<h2 align=\"center\">\n  Nalanda\n</h2>\n\n<p align=\"center\">\nEffortlessly Powerful State Management Simple to Start, Designed to Scale.\n</p>\n\n<div align=\"center\">\n  <a href=\"https://nalanda.bangle.io/docs\">Read the docs</a>\n</div>\n\n## Features\n\n- **Predictable State Management:** No magic, predictable state management that scales with your app.\n- **Performance Optimized:** With explicit dependency management, slices of state only update when necessary, ensuring optimal performance.\n- **TypeScript First:** Leverages TypeScript to catch errors at compile-time.\n- **Powerful Effects System:** Handle complex logic outside of your UI components.\n- **Scalability:** Allows you to break your app into small, testable, and maintainable slices.\n- **Framework Agnostic:** Works seamlessly with any framework.\n\n### Installation\n\n```sh\nnpm i @nalanda/core\n\n# for react\nnpm i @nalanda/react\n```\n\n## Quick Start\n\n### Creating a Slice\n\nLets start by creating a simple counter slice.\n\n```tsx filename=\"counter-slice.ts\"\nimport { createKey } from '@nalanda/core';\n\n// The key is a local helper used to define various components of your slice.\nconst key = createKey('counterSlice', []);\n\n// State fields define part of your state.\nconst counter = key.field(0);\n\n// Actions define how a field/s should be updated.\nfunction increment() {\n  return counter.update((c) => c + 1);\n}\n\n// A slice serves as an interface, revealing the specified fields\n// and actions to the entire application.\nexport const counterSlice = key.slice({\n  counter,\n  increment,\n});\n```\n\n### Setting up the Store\n\nAt the root of your React app, set up a store and encapsulate your app with the StoreProvider component:\n\n```tsx copy filename=\"app.tsx\"\nimport { StoreProvider } from '@nalanda/react';\nimport { createStore } from '@nalanda/core';\nimport { counterSlice } from './counter-slice';\n\n// Establish a global store incorporating your slices.\nconst store = createStore({\n  slices: [counterSlice],\n});\n\nReactDOM.render(\n  // use the StoreProvider to make the store available to the entire app.\n  <StoreProvider store={store}>\n    <App />\n  </StoreProvider>,\n  document.getElementById('root'),\n);\n```\n\n### Displaying the counter\n\nWith the store in place, employ the useSlice hook to access the state and actions from the slice:\n\n```tsx copy filename=\"counter.tsx\"\nimport { useTrack, useStore } from '@nalanda/react';\nimport { counterSlice } from './counter-slice';\n\nexport function Counter() {\n  // useTrack re-render the component whenever `counter` changes\n  const { counter } = useTrack(counterSlice);\n  const store = useStore();\n\n  const increment = () => {\n    // Dispatch an action to update the slice\n    store.dispatch(counterSlice.increment());\n  };\n\n  return (\n    <div>\n      <h1>Counter</h1>\n      <p>{counter}</p>\n      <button onClick={increment}>increment</button>\n    </div>\n  );\n}\n```\n\n### Next Steps\n\n- Dive deeper into Nalanda by exploring our [official documentation](https://nalanda.bangle.io).\n- View [real-world examples](https://nalanda.bangle.io/docs/examples) to see Nalanda in action.\n\n### Contribute to Nalanda\n\nYour contribution can make `nalanda` even better! If you're interested in lending a hand, please consult our [CONTRIBUTING.md](CONTRIBUTING.md) guide.\n","readmeFilename":"README.md","description":"<p align=\"center\">   <a href=\"https://nalanda.bangle.io\">     <img src=\"https://raw.githubusercontent.com/bangle-io/nalanda/dev/documentation/public/nalanda.png\"         alt=\"screen\" width=\"128\" >   </a> </p> <h2 align=\"center\">   Nalanda </h2>"}