{"_id":"@aihu/reactive","_rev":"2-0cea16d84c1b45edb2dda0aaec3aba35","name":"@aihu/reactive","dist-tags":{"latest":"0.2.1"},"versions":{"0.2.0":{"name":"@aihu/reactive","version":"0.2.0","license":"MIT","_id":"@aihu/reactive@0.2.0","maintainers":[{"name":"srmcguirt","email":"srmcguirt@gmail.com"}],"homepage":"https://github.com/fellwork/aihu/tree/main/packages/reactive#readme","bugs":{"url":"https://github.com/fellwork/aihu/issues"},"dist":{"shasum":"a801492fed59bb79ad0fe028a41692ccba52131b","tarball":"https://registry.npmjs.org/@aihu/reactive/-/reactive-0.2.0.tgz","fileCount":10,"integrity":"sha512-84sAeNW+iHurX7gIxmGYfvrICDcQiQiSVSKfvODWBMZP/pPrl11EEc6VbcObqIuKBpH2+6EdRtWzh42MvhUO/w==","signatures":[{"sig":"MEUCIQD8TBklw3OCTIik2FQ9EXBH6k6WIWpXub2BXYZJgilGlAIgOiIJow/iQkBU6cXfeX1eIowASIPRPBtbX4FSVP8h2GQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@aihu%2freactive@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":55047},"main":"./dist/index.js","type":"module","_from":"file:/tmp/tmp.eGcEjXameg/aihu-reactive-0.2.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./helpers":{"types":"./dist/helpers.d.ts","import":"./dist/helpers.js"}},"scripts":{"test":"vitest run","build":"rm -rf dist && rolldown -c","typecheck":"tsc --noEmit","prepublishOnly":"bun run build"},"_npmUser":{"name":"srmcguirt","email":"srmcguirt@gmail.com"},"_resolved":"/tmp/tmp.eGcEjXameg/aihu-reactive-0.2.0.tgz","_integrity":"sha512-84sAeNW+iHurX7gIxmGYfvrICDcQiQiSVSKfvODWBMZP/pPrl11EEc6VbcObqIuKBpH2+6EdRtWzh42MvhUO/w==","repository":{"url":"git+https://github.com/fellwork/aihu.git","type":"git","directory":"packages/reactive"},"_npmVersion":"10.8.2","description":"Fine-grained Proxy-backed deep reactive trees on aihu signals — lazy per-(object,key) tracking nodes, plain-assignment writes, mutate/reconcile.","directories":{},"sideEffects":false,"_nodeVersion":"22.12.0","dependencies":{"@aihu/signals":"0.5.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/reactive_0.2.0_1785028467777_0.2837804533046626","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@aihu/reactive","version":"0.2.1","license":"MIT","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./helpers":{"types":"./dist/helpers.d.ts","import":"./dist/helpers.js"}},"sideEffects":false,"dependencies":{"@aihu/signals":"^0.5.1"},"scripts":{"build":"rm -rf dist && rolldown -c","test":"vitest run","typecheck":"tsc --noEmit","prepublishOnly":"bun run build"},"description":"Fine-grained Proxy-backed deep reactive trees on aihu signals — lazy per-(object,key) tracking nodes, plain-assignment writes, mutate/reconcile.","repository":{"type":"git","url":"git+https://github.com/aihu-project/aihu-dom.git","directory":"packages/reactive"},"homepage":"https://github.com/aihu-project/aihu-dom/tree/main/packages/reactive#readme","bugs":{"url":"https://github.com/aihu-project/aihu-dom/issues"},"publishConfig":{"access":"public"},"gitHead":"058ed2d523cb68197eaf64e5a3a5389dab9d4669","_id":"@aihu/reactive@0.2.1","_nodeVersion":"26.2.0","_npmVersion":"11.19.0","dist":{"integrity":"sha512-JrsGM+LouYag4dyzHaXGrqxJGu9n3LeBD1OaUSD3DVvYAZtIAaXDXy6K23yYff88Z/Vt2PiVkDlXoPaQ3A9jHg==","shasum":"35f90ee26c567e04919b4b7a5d2f2992d3c7e55c","tarball":"https://registry.npmjs.org/@aihu/reactive/-/reactive-0.2.1.tgz","fileCount":10,"unpackedSize":55657,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCID/LBWtalAUMeBVUZOsALf+EJAY2PpmKd3mfcMOK6zisAiEAqQe6iDlUozfaqe36qk0mFz93U62siQLjB+gSLkrLnx4="}]},"_npmUser":{"name":"srmcguirt","email":"srmcguirt@gmail.com"},"directories":{},"maintainers":[{"name":"srmcguirt","email":"srmcguirt@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/reactive_0.2.1_1788744090436_0.35605405189384487"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-26T01:14:27.622Z","modified":"2026-09-07T01:21:30.814Z","0.2.0":"2026-07-26T01:14:27.934Z","0.2.1":"2026-09-07T01:21:30.577Z"},"bugs":{"url":"https://github.com/aihu-project/aihu-dom/issues"},"license":"MIT","homepage":"https://github.com/aihu-project/aihu-dom/tree/main/packages/reactive#readme","repository":{"type":"git","url":"git+https://github.com/aihu-project/aihu-dom.git","directory":"packages/reactive"},"description":"Fine-grained Proxy-backed deep reactive trees on aihu signals — lazy per-(object,key) tracking nodes, plain-assignment writes, mutate/reconcile.","maintainers":[{"name":"srmcguirt","email":"srmcguirt@gmail.com"}],"readme":"# @aihu/reactive\n\n> **Aihu** — agentic discovery and interaction, for human purpose.\n\nFine-grained Proxy-backed deep reactive trees on aihu signals — lazy per-(object,key) tracking nodes, plain-assignment writes, mutate/reconcile.\n\n\n<!-- BEGIN_HANDWRITTEN: prose -->\nDesign: [`docs/plans/2026-07-24-deep-reactivity.md`](../../docs/plans/2026-07-24-deep-reactivity.md).\n\nA Solid-shaped node model (lazily allocated per-`(object, key)` tracking cells,\nallocated on first proxy touch — tracked or not) with Vue-shaped write\nergonomics (plain `obj.key = value` assignment, no `setStore(...)` path\ntuples). Built entirely on the public `@aihu/signals` API — `@aihu/signals`\nis `external`, so this package adds **zero bytes** to the signals core row.\n\n```ts\nimport { reactive, mutate, unwrap } from '@aihu/reactive'\nimport { computed, effect } from '@aihu/signals'\n\nconst user = reactive({ name: 'Ada', address: { city: 'London' }, tags: ['math'] })\n\neffect(() => console.log(user.address.city)) // tracks node(user,'address') + node(addr,'city')\n\nuser.address.city = 'Cambridge' // one flush → logs\n\nmutate(user, (u) => {\n  // ONE flush for three writes\n  u.name = 'Ada L.'\n  u.address.city = 'Bletchley'\n  u.tags.push('crypto')\n})\n\nconst initials = computed(() => user.name.split(' ').map((s) => s[0]).join(''))\n// initials does NOT recompute when address.city changes.\n\nlocalStorage.setItem('user', JSON.stringify(unwrap(user)))\n```\n\n`reconcile(target, next, { key? })` merges a fresh payload (e.g. a hydration\nsnapshot or a refetch) into `target` in place — unchanged nested values keep\ntheir proxy identity and notify nobody; only genuinely-changed paths flush.\n`key` controls array-item matching (default: index; pass a property name or a\nfunction for keyed reordering, e.g. `{ key: 'id' }`).\n\n`@aihu/reactive/helpers` bridges the tree ↔ tuple worlds: `toSignal`/\n`toSignals` lens reactive properties as `Signal` tuples, `toReactive` goes the\nother way (a `Signal<object>` viewed as a reactive-looking object),\n`reactivePick`/`reactiveOmit` are read-through views (no copies), and\n`reactiveComputed(fn)` keeps a reactive object in sync with `fn()` via an\neffect + `reconcile` — consumers reading one key only re-run when THAT key's\nvalue actually changes.\n\n**Non-wrappable values pass through unchanged**: `Date`, `Map`, `Set`,\n`RegExp`, class instances, DOM nodes, and frozen objects are stored raw and\nare replace-only — `reactive()` does not attempt to make them deeply\nreactive (see the design doc §8.8/§8.9 for the reasoning).\n\nNothing shipped elsewhere changes: `signal`/`computed`/`effect`, and every\ncomposable in `@aihu/use`, keep their existing contracts verbatim. This is a\npurely additive new import, not new behavior on an old one.\n<!-- END_HANDWRITTEN: prose -->\n\n## Install\n\n<!-- BEGIN_AUTOGEN: install -->\n<!-- regenerate: bun scripts/sync-readme.ts (also runs in pre-commit + CI) -->\n\n```bash\nnpm install @aihu/reactive\n# or\nbun add @aihu/reactive\n```\n\n<sub><i>Auto-generated against `@aihu/reactive@0.2.0`.</i></sub>\n\n<!-- END_AUTOGEN: install -->\n\n## Package facts\n\n<!-- BEGIN_AUTOGEN: stats -->\n<!-- regenerate: bun scripts/sync-readme.ts (also runs in pre-commit + CI) -->\n\n| | |\n|---|---|\n| **Version** | `0.2.0` |\n| **Tier** | G — State — fine-grained Proxy-backed deep reactive trees (lazy per-key nodes, plain-assignment writes) |\n| **Bundle size** | 1.28 kB (gz) — limit 1900 B |\n| **Published files** | 3 entries |\n| **License** | MIT |\n\n<sub><i>Auto-generated against `@aihu/reactive@0.2.0`.</i></sub>\n\n<!-- END_AUTOGEN: stats -->\n\n## Exports\n\n<!-- BEGIN_AUTOGEN: exports -->\n<!-- regenerate: bun scripts/sync-readme.ts (also runs in pre-commit + CI) -->\n\n| Subpath | ESM | CJS |\n|---|---|---|\n| `.` | `./dist/index.js` | `—` |\n| `./helpers` | `./dist/helpers.js` | `—` |\n\n<sub><i>Auto-generated against `@aihu/reactive@0.2.0`.</i></sub>\n\n<!-- END_AUTOGEN: exports -->\n\n## Dependencies\n\n<!-- BEGIN_AUTOGEN: deps -->\n<!-- regenerate: bun scripts/sync-readme.ts (also runs in pre-commit + CI) -->\n\n**Dependencies:**\n\n- `@aihu/signals` — `workspace:*`\n\n<sub><i>Auto-generated against `@aihu/reactive@0.2.0`.</i></sub>\n\n<!-- END_AUTOGEN: deps -->\n\n## See also\n\n<!-- BEGIN_AUTOGEN: see-also -->\n<!-- regenerate: bun scripts/sync-readme.ts (also runs in pre-commit + CI) -->\n\n- [@aihu/signals](../signals)\n- [@aihu/store](../store)\n- [Aihu framework root](../../README.md)\n\n<sub><i>Auto-generated against `@aihu/reactive@0.2.0`.</i></sub>\n\n<!-- END_AUTOGEN: see-also -->\n\n## License\n\n<!-- BEGIN_AUTOGEN: license -->\n<!-- regenerate: bun scripts/sync-readme.ts (also runs in pre-commit + CI) -->\n\nMIT — see [LICENSE](../../LICENSE).\n\n<sub><i>Auto-generated against `@aihu/reactive@0.2.0`.</i></sub>\n\n<!-- END_AUTOGEN: license -->\n","readmeFilename":"README.md"}