{"_id":"@abeyjs/state","_rev":"2-4224be3b73b96cece7db8f429cfee7ec","name":"@abeyjs/state","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@abeyjs/state","version":"0.1.0","license":"MIT","_id":"@abeyjs/state@0.1.0","maintainers":[{"name":"abeyjs","email":"abeyjs98@gmail.com"}],"dist":{"shasum":"5d51b4c93184eae56d6e25333227856184c5079c","tarball":"https://registry.npmjs.org/@abeyjs/state/-/state-0.1.0.tgz","fileCount":10,"integrity":"sha512-4XbJzDWyKWS2y2PsAkM+hKYYH6krxIDeWo6La1kPaHO98W4+Vr8DhD0teaZgc0sipWeTQgyeUGCMWPJFApzkxg==","signatures":[{"sig":"MEYCIQDPEYr9UAR82juSBK6iQ9500S0283WjkVw5nXdCNrrrkgIhAL1tK06zjg8vExp4ndzU6vlo9NJcXXo+5EvFyyjTo5ja","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7054},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"24fe5ea792f5be4e8facf7c820025f89265c1467","scripts":{"build":"tsc -p tsconfig.json"},"_npmUser":{"name":"abeyjs","email":"abeyjs98@gmail.com"},"_npmVersion":"10.8.2","description":"Minimal **observable value holder**: **`StateCell<T>`** stores a single value, notifies subscribers on change, and supports functional updates. It is intentionally tiny so views and agents can share UI-facing state without pulling in a full external store","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","dependencies":{"@abeyjs/core":"0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.7.0"},"_npmOperationalInternal":{"tmp":"tmp/state_0.1.0_1777684752546_0.9759266112096305","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@abeyjs/state","version":"0.1.1","license":"MIT","publishConfig":{"access":"public"},"type":"module","sideEffects":false,"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.json"},"dependencies":{"@abeyjs/core":"0.1.1"},"devDependencies":{"typescript":"^5.7.0"},"_id":"@abeyjs/state@0.1.1","gitHead":"8e89473e70d292931fe54ab9e184c613a03528d3","description":"Minimal **observable value holder**: **`StateCell<T>`** stores a single value, notifies subscribers on change, and supports functional updates. It is intentionally tiny so views and agents can share UI-facing state without pulling in a full external store","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-CgB5AML//KtYn7nynjDbcvIUNZi3dQ66CivCXq4AyZ1a5BYE+yk+8IBndDr4t1dXHWNe0+Ekbepf+OBX/pe6Xw==","shasum":"7b107731bc5d2977be574d929baccc71ad9279b7","tarball":"https://registry.npmjs.org/@abeyjs/state/-/state-0.1.1.tgz","fileCount":6,"unpackedSize":5017,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCSzZ5FokAv4cJG7RYEM/LIZw6S5ONxEMXdxi9mhWoiBwIgZzweo+gSlA8kdm15dQtqZ2kbQvxldjZQJx0yqCaGehE="}]},"_npmUser":{"name":"abeyjs","email":"abeyjs98@gmail.com"},"directories":{},"maintainers":[{"name":"abeyjs","email":"abeyjs98@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/state_0.1.1_1777736019016_0.37643489853256407"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-02T01:19:12.448Z","modified":"2026-05-02T15:33:39.307Z","0.1.0":"2026-05-02T01:19:12.718Z","0.1.1":"2026-05-02T15:33:39.166Z"},"license":"MIT","description":"Minimal **observable value holder**: **`StateCell<T>`** stores a single value, notifies subscribers on change, and supports functional updates. It is intentionally tiny so views and agents can share UI-facing state without pulling in a full external store","maintainers":[{"name":"abeyjs","email":"abeyjs98@gmail.com"}],"readme":"# `@abeyjs/state`\r\n\r\nMinimal **observable value holder**: **`StateCell<T>`** stores a single value, notifies subscribers on change, and supports functional updates. It is intentionally tiny so views and agents can share UI-facing state without pulling in a full external store.\r\n\r\nUses **`Object.is`** to skip no-op writes (same reference or primitive value).\r\n\r\n---\r\n\r\n## API\r\n\r\n### `StateCell<T>`\r\n\r\n| Method | Behaviour |\r\n|--------|-----------|\r\n| **`get()`** | Current snapshot. |\r\n| **`set(next)`** | Replace with **`next`**, or resolve **`next(prev)`** when **`next` is a function. No-op if **`Object.is(resolved, prev)`**. |\r\n| **`update(fn)`** | Alias for **`set(fn)`** with an updater only (clearer at call sites). |\r\n| **`subscribe(listener)`** | **`listener()`** runs after every effective **`set`**; returns **`Unsubscribe`** (`@abeyjs/core`). |\r\n\r\nSubscriptions are **synchronous** on **`set`**: listeners run in insertion order (Set iteration order in V8). **No** batching or async scheduling — if you need that, wrap or debounce in the subscriber.\r\n\r\n**Threading:** single-threaded JS; not safe to share one cell across workers without a bridge.\r\n\r\n---\r\n\r\n## Typical use\r\n\r\n- **View models** passed into **`@abeyjs/view`** helpers that call **`cell.subscribe(() => render…)`**.\r\n- **Agents** exposing **`viewState` as `StateCell`** (see **`DynamicCrudAgent`** in **`@abeyjs/openapi`**).\r\n\r\n---\r\n\r\n## Dependency\r\n\r\n**`@abeyjs/core`** — **`Unsubscribe`** type only.\r\n\r\n---\r\n\r\n## Build\r\n\r\n```bash\r\nnpm run build -w @abeyjs/state\r\n```\r\n","readmeFilename":"README.md"}