{"_id":"@andystewartdesign/nanostores-marko","_rev":"5-9e2f1de2fb08eccabf8320d7cb6ae3ff","name":"@andystewartdesign/nanostores-marko","dist-tags":{"latest":"0.1.4"},"versions":{"0.1.0":{"name":"@andystewartdesign/nanostores-marko","version":"0.1.0","_id":"@andystewartdesign/nanostores-marko@0.1.0","maintainers":[{"name":"andystewartdesign","email":"andy.stewart1170@gmail.com"}],"dist":{"shasum":"a71a06d43859ec73332a02f4281af19066a039ad","tarball":"https://registry.npmjs.org/@andystewartdesign/nanostores-marko/-/nanostores-marko-0.1.0.tgz","fileCount":6,"integrity":"sha512-9ofufd/Z78zxYeKINVS4QyjUqdeRWQz6BAh18MqeSllLNPjkWDNQR1gjsEd1dkmvbqZhgfScU5Aw0le+WQnt1g==","signatures":[{"sig":"MEQCIAKDRw7eq976wcRWXAWFjekX0PxLGPzyn7brdC5wdNZsAiALtt8NDOoDXBygyH+/tT46n0Kv5mQCMcn/VYdCGMPMKg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5785},"type":"module","exports":{".":{"types":"./dist/store.d.ts","import":"./dist/store.js"},"./marko.json":"./marko.json"},"gitHead":"54d38ab1ea600e07ab83339e31a3dbb995eae54c","scripts":{"dev":"tsc --watch","build":"tsc","typecheck":"tsc --noEmit"},"_npmUser":{"name":"andystewartdesign","email":"andy.stewart1170@gmail.com"},"_npmVersion":"11.5.1","description":"[Nanostores](https://github.com/nanostores/nanostores) shared state for [Marko 6](https://markojs.com), with full type inference.","directories":{},"_nodeVersion":"24.6.0","_hasShrinkwrap":false,"devDependencies":{"marko":"^6.0.0","nanostores":"^1.0.0","typescript":"^5.0.0"},"peerDependencies":{"marko":"^6.0.0","nanostores":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nanostores-marko_0.1.0_1776693904808_0.6901980039195375","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@andystewartdesign/nanostores-marko","version":"0.1.1","_id":"@andystewartdesign/nanostores-marko@0.1.1","maintainers":[{"name":"andystewartdesign","email":"andy.stewart1170@gmail.com"}],"dist":{"shasum":"a7277ad4f11acb8caed5d1f8b061e97221f82c43","tarball":"https://registry.npmjs.org/@andystewartdesign/nanostores-marko/-/nanostores-marko-0.1.1.tgz","fileCount":6,"integrity":"sha512-SPi/nQRACVXdAY6Y50ZxdnY6zAbT01VeQp32uWa+i0v7C8ULCHTuBrKHe8p1YSuPQgONANYAOAmVbZqeYumxtA==","signatures":[{"sig":"MEYCIQDoqzQ68Rdw5DBNJyabDfVU9YKzj0yawUi0Hlx/MQ4cmQIhANKO4tNQ18W+xWh6MHscqlZfZCab3QgPPkQUjLwhudLi","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5961},"type":"module","exports":{".":{"types":"./dist/store.d.ts","import":"./dist/store.js"},"./marko.json":"./marko.json"},"gitHead":"54d38ab1ea600e07ab83339e31a3dbb995eae54c","scripts":{"dev":"tsc --watch","build":"tsc","typecheck":"tsc --noEmit"},"_npmUser":{"name":"andystewartdesign","email":"andy.stewart1170@gmail.com"},"_npmVersion":"11.5.1","description":"[Nanostores](https://github.com/nanostores/nanostores) shared state for [Marko 6](https://markojs.com), with full type inference.","directories":{},"_nodeVersion":"24.6.0","_hasShrinkwrap":false,"devDependencies":{"marko":"^6.0.0","nanostores":"^1.0.0","typescript":"^5.0.0"},"peerDependencies":{"marko":"^6.0.0","nanostores":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nanostores-marko_0.1.1_1776694587791_0.7021752532102561","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@andystewartdesign/nanostores-marko","version":"0.1.2","_id":"@andystewartdesign/nanostores-marko@0.1.2","maintainers":[{"name":"andystewartdesign","email":"andy.stewart1170@gmail.com"}],"dist":{"shasum":"aa81d9bd6c0e97f5eaa59df328c9ec8802e4d329","tarball":"https://registry.npmjs.org/@andystewartdesign/nanostores-marko/-/nanostores-marko-0.1.2.tgz","fileCount":6,"integrity":"sha512-6ApTbvUMp2lGPv2q4sko5moVHN5F/QGoujPV5wQjZsVVUxDFYNqZ1d99SGLzKj1AlOpw8N8d6lh9zyBBpeAGwA==","signatures":[{"sig":"MEUCIQCi5B2lEE7QxfLV/x0MU7ljUWCGmw/CJ8DhblMvUAOfXwIgCMN95HjgKmCMxVwGwt9o6ltXPI6Yc0GWq8zQFB5tYEs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5961},"type":"module","exports":{".":{"types":"./dist/store.d.ts","import":"./dist/store.js"},"./marko.json":"./marko.json"},"gitHead":"54d38ab1ea600e07ab83339e31a3dbb995eae54c","scripts":{"dev":"tsc --watch","build":"tsc","typecheck":"tsc --noEmit"},"_npmUser":{"name":"andystewartdesign","email":"andy.stewart1170@gmail.com"},"_npmVersion":"11.5.1","description":"[Nanostores](https://github.com/nanostores/nanostores) shared state for [Marko 6](https://markojs.com), with full type inference.","directories":{},"_nodeVersion":"24.6.0","_hasShrinkwrap":false,"devDependencies":{"marko":"^6.0.0","nanostores":"^1.0.0","typescript":"^5.0.0"},"peerDependencies":{"marko":"^6.0.0","nanostores":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nanostores-marko_0.1.2_1776694844787_0.4309177462441922","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@andystewartdesign/nanostores-marko","version":"0.1.3","_id":"@andystewartdesign/nanostores-marko@0.1.3","maintainers":[{"name":"andystewartdesign","email":"andy.stewart1170@gmail.com"}],"dist":{"shasum":"77d79d8e903c6f62437003d638822fc9abf357d6","tarball":"https://registry.npmjs.org/@andystewartdesign/nanostores-marko/-/nanostores-marko-0.1.3.tgz","fileCount":6,"integrity":"sha512-aBe7eXKH8BH0SuUvRWovYcko4G6BYsWtJSIXo8hAUE4mIjHOy+t7LgPWmcxLGBd7zvdlBOKvGYWfuARWprjwZA==","signatures":[{"sig":"MEYCIQCcWOlsA8z61Ozc9sj6OXuhTHLmSFdQMyhvlTg5ZemnwgIhALSy3fJFDqqd9uPRd8XXs4NdEZpdc9kHXhyiKx4Yie6J","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5989},"type":"module","exports":{".":{"types":"./dist/store.d.ts","import":"./dist/store.js"},"./tags/*":"./tags/*","./marko.json":"./marko.json"},"gitHead":"54d38ab1ea600e07ab83339e31a3dbb995eae54c","scripts":{"dev":"tsc --watch","build":"tsc","typecheck":"tsc --noEmit"},"_npmUser":{"name":"andystewartdesign","email":"andy.stewart1170@gmail.com"},"_npmVersion":"11.5.1","description":"[Nanostores](https://github.com/nanostores/nanostores) shared state for [Marko 6](https://markojs.com), with full type inference.","directories":{},"_nodeVersion":"24.6.0","_hasShrinkwrap":false,"devDependencies":{"marko":"^6.0.0","nanostores":"^1.0.0","typescript":"^5.0.0"},"peerDependencies":{"marko":"^6.0.0","nanostores":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nanostores-marko_0.1.3_1776695721098_0.1207473019587566","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@andystewartdesign/nanostores-marko","version":"0.1.4","type":"module","exports":{".":{"types":"./dist/store.d.ts","import":"./dist/store.js"},"./marko.json":"./marko.json","./tags/*":"./tags/*"},"scripts":{"build":"tsc","dev":"tsc --watch","typecheck":"tsc --noEmit"},"peerDependencies":{"marko":"^6.0.0","nanostores":"^1.0.0"},"devDependencies":{"marko":"^6.0.0","nanostores":"^1.0.0","typescript":"^5.0.0"},"_id":"@andystewartdesign/nanostores-marko@0.1.4","gitHead":"54d38ab1ea600e07ab83339e31a3dbb995eae54c","description":"[Nanostores](https://github.com/nanostores/nanostores) shared state for [Marko 6](https://markojs.com), with full type inference.","_nodeVersion":"24.6.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-2XXjnemopW4W2iLNACdlh+jiPtJTv+3f6NSB5m2wXO+aunKa8yuz1MDb43fwmdkep3EQy4HQqKFOwrWgxohuCA==","shasum":"aa9ad6901cb1acb689d289bc569ccd7339d32f9e","tarball":"https://registry.npmjs.org/@andystewartdesign/nanostores-marko/-/nanostores-marko-0.1.4.tgz","fileCount":6,"unpackedSize":5861,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDhvXcIW4VqdbxaqDrBKWLs1J3YSi7wBaR3LDNt8Q1EyAiEAhZFg1bT23Wyb6MUnYJS33Q6T8IBpdrMWYrRnbY4pLRs="}]},"_npmUser":{"name":"andystewartdesign","email":"andy.stewart1170@gmail.com"},"directories":{},"maintainers":[{"name":"andystewartdesign","email":"andy.stewart1170@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nanostores-marko_0.1.4_1776697489880_0.9678566396797257"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-20T14:05:04.688Z","modified":"2026-04-20T15:04:50.101Z","0.1.0":"2026-04-20T14:05:04.979Z","0.1.1":"2026-04-20T14:16:27.905Z","0.1.2":"2026-04-20T14:20:44.935Z","0.1.3":"2026-04-20T14:35:21.243Z","0.1.4":"2026-04-20T15:04:49.996Z"},"description":"[Nanostores](https://github.com/nanostores/nanostores) shared state for [Marko 6](https://markojs.com), with full type inference.","maintainers":[{"name":"andystewartdesign","email":"andy.stewart1170@gmail.com"}],"readme":"# @andystewartdesign/nanostores-marko\n\n[Nanostores](https://github.com/nanostores/nanostores) shared state for [Marko 6](https://markojs.com), with full type inference.\n\n> **Alpha POC** — this is an early proof of concept. The API may change.\n\n## Installation\n\n```bash\nnpm install @andystewartdesign/nanostores-marko nanostores\n```\n\n## Usage\n\n### 1. Define your stores\n\nCreate a module that exports your stores. These can be imported anywhere in your app.\n\n```ts\n// src/stores/counter.ts\nimport { createStore } from \"@andystewartdesign/nanostores-marko\";\n\nexport const $counter = createStore(0);\nexport const $name = createStore(\"world\");\n```\n\n`createStore` returns a serializable key (a plain string with a phantom type) that is registered in a module-level store registry. Passing a plain string means Marko can safely serialize it for SSR hydration.\n\n### 2. Use the `<store>` tag in your components\n\n```marko\n// counter.marko\nimport { $counter } from \"./stores/counter.ts\";\n\n<store/count=$counter/>\n\n<div>\n  <p>Count: ${count}</p>\n  <button onClick() { count++ }>+</button>\n  <button onClick() { count-- }>-</button>\n</div>\n```\n\nThe `<store>` tag subscribes to the store and exposes its value as a local variable. The type of `count` is inferred automatically from the store's initial value — no manual type annotations needed.\n\nAssigning to the variable (`count++`, `count = newValue`) updates the store directly, so any other component subscribed to `$counter` will react.\n\n### 3. Shared state across components\n\nBecause stores live in a shared module, any number of components can subscribe to the same store and will stay in sync on the client.\n\n```marko\n// input-a.marko\nimport { $name } from \"./stores/counter.ts\";\n\n<store/name=$name/>\n<input type=\"text\" value:=name>\n```\n\n```marko\n// input-b.marko\nimport { $name } from \"./stores/counter.ts\";\n\n<store/name=$name/>\n<p>Hello, ${name}!</p>\n```\n\n## API\n\n### `createStore<T>(initialValue: T): TypedKey<T>`\n\nCreates a nanostores `atom` and registers it under an auto-generated key. Returns the key, which you pass to the `<store>` tag. The generic type `T` is carried through via a phantom type on the key string, enabling end-to-end type inference.\n\n### `getStore<T>(key: TypedKey<T>): WritableAtom<T>`\n\nReturns the underlying nanostores `WritableAtom` for a given key. Useful if you need to read or write the store value outside of a Marko template — for example in event handlers or utility functions.\n\n```ts\nimport { getStore } from \"@andystewartdesign/nanostores-marko\";\nimport { $counter } from \"./stores/counter.ts\";\n\ngetStore($counter).set(0); // reset\ngetStore($counter).get();  // read current value\n```\n\n## A note on `<store>` tag internals\n\nThe `<store>` tag ships as raw Marko source in `tags/store/index.marko`. Inside, it imports from the package's compiled output using a relative path (`../../dist/store.js`). This is intentional — it avoids a circular self-referential import that would occur if the tag imported from the package name itself.\n\nThis is an internal detail and has no effect on consumers of the package. It is called out here for anyone reading the source or contributing to the package.\n\n## How it works\n\nMarko serializes all tag inputs for SSR hydration. Passing a store object directly as a prop fails at runtime because functions can't be serialized. This package works around that by using a string key as the prop — the string is serializable, and the actual `atom` is looked up from a module-level registry on both server and client using that key.\n","readmeFilename":"README.md"}