{"_id":"0x1-store","_rev":"4-f70384f775db62d5e8585687a8c05527","name":"0x1-store","dist-tags":{"latest":"0.0.4"},"versions":{"0.0.1":{"name":"0x1-store","version":"0.0.1","_id":"0x1-store@0.0.1","maintainers":[{"name":"triex","email":"hi@triex.dev"}],"dist":{"shasum":"883945856866efb6b0cf82319ae3462318e2061e","tarball":"https://registry.npmjs.org/0x1-store/-/0x1-store-0.0.1.tgz","fileCount":3,"integrity":"sha512-zwvoOsZ/IwHY/uuuD7wksefpBY2y+SIJYLh9onushM7aYLUF6S6x9OLEOVDSKOu4tMbo0J0Q0DGP9GafF9Tjdw==","signatures":[{"sig":"MEUCIDjUAoHcflhhMs+MkZZ0iML5Wy7Q4Ckgktl7CEKMsEVqAiEAji6NxmdFBC280BxjtJYpD1Ww8q3Vje5WBEmb8iPcJg4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5510},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"bun":">=1.0.0"},"gitHead":"9eb29234dc696bfc3b0314ac2fcc3ab9b0e8d2ad","scripts":{"build":"bun build ./src/index.ts --outdir=dist","prepublish":"bun run build"},"_npmUser":{"name":"triex","email":"hi@triex.dev"},"_npmVersion":"10.9.2","description":"A lightweight, type-safe state management library for JavaScript and TypeScript applications.","directories":{},"_nodeVersion":"23.9.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.4.5"},"_npmOperationalInternal":{"tmp":"tmp/0x1-store_0.0.1_1747452734127_0.07289556156337507","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"0x1-store","version":"0.0.2","author":{"name":"TriexDev"},"license":"SEE LICENSE IN LICENSE","_id":"0x1-store@0.0.2","maintainers":[{"name":"triex","email":"hi@triex.dev"}],"homepage":"https://github.com/Triex/0x1#readme","bugs":{"url":"https://github.com/Triex/0x1/issues"},"dist":{"shasum":"1de2aacf291e8c6e4a9c669e46f8c75b9c2aabfa","tarball":"https://registry.npmjs.org/0x1-store/-/0x1-store-0.0.2.tgz","fileCount":3,"integrity":"sha512-mf7qcag1SK36MfYrl4OWZpU2gH6vK3AWV1jL58Hqn7KDff+9+5EyJJGkLrWz6IfmSm19yUJl05/dQvAE9xWIlg==","signatures":[{"sig":"MEUCIQCAhs913aB2NwHDMP7fj6+xtDgjDceyRW/za3AaQ0CyqQIgfjDTbmC5bcDyKhpHWvvvjcdHIbZTF2ZFbfPtzV+1z7o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5657},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"bun":">=1.0.0"},"gitHead":"0a18246e5042acc07d21f697e25b46189e528260","scripts":{"build":"bun build ./src/index.ts --outdir=dist","prepublish":"bun run build"},"_npmUser":{"name":"triex","email":"hi@triex.dev"},"repository":{"url":"git+https://github.com/Triex/0x1.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight, type-safe state management library for JavaScript and TypeScript applications.","directories":{},"_nodeVersion":"23.9.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.4.5"},"_npmOperationalInternal":{"tmp":"tmp/0x1-store_0.0.2_1747452963165_0.2340204659498284","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"0x1-store","version":"0.0.3","author":{"name":"TriexDev"},"license":"SEE LICENSE IN LICENSE","_id":"0x1-store@0.0.3","maintainers":[{"name":"triex","email":"hi@triex.dev"}],"homepage":"https://github.com/Triex/0x1#readme","bugs":{"url":"https://github.com/Triex/0x1/issues"},"dist":{"shasum":"6051d4169484084dc6d130c2f1e32a1f93bea304","tarball":"https://registry.npmjs.org/0x1-store/-/0x1-store-0.0.3.tgz","fileCount":3,"integrity":"sha512-dfzFAEkGoXnJbbxS6fTh8KEfm1d298aLjnY0BlisyXPQ9cD16WMniCnhsCgS5OLdzrv6i5inQl+w5Okn+ti+iQ==","signatures":[{"sig":"MEQCIG35ys7XLahk3fF5N31USzCCymzLExZ8LCI5Vrlga8h2AiBVsfZLh7cerDFTUhfoeHWcfa23YXkv9HWwGsi3tT4IZg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5657},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"bun":">=1.0.0"},"gitHead":"e8a6b8678fae55ef6b0f43ea06f47a2cc7615658","scripts":{"build":"bun build ./src/index.ts --outdir=dist","prepublish":"bun run build"},"_npmUser":{"name":"triex","email":"hi@triex.dev"},"repository":{"url":"git+https://github.com/Triex/0x1.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight, type-safe state management library for JavaScript and TypeScript applications.","directories":{},"_nodeVersion":"23.9.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.4.5"},"_npmOperationalInternal":{"tmp":"tmp/0x1-store_0.0.3_1747465022770_0.6562969989051497","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"0x1-store","version":"0.0.4","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"bun build ./src/index.ts --outdir=dist --target=node","typecheck":"tsc --noEmit","prepublish":"bun run build"},"dependencies":{},"devDependencies":{"typescript":"^5.4.5"},"engines":{"bun":">=1.0.0"},"author":{"name":"TriexDev"},"license":"SEE LICENSE IN LICENSE","repository":{"type":"git","url":"git+https://github.com/Triex/0x1.git"},"description":"A lightweight, type-safe state management library for JavaScript and TypeScript applications.","bugs":{"url":"https://github.com/Triex/0x1/issues"},"homepage":"https://github.com/Triex/0x1#readme","_id":"0x1-store@0.0.4","_shasum":"9b2b9d1fe134eaaf0e6e55ac9c0594e35c5c2067","_from":".","_npmVersion":"2.15.12","_nodeVersion":"23.9.0","_npmUser":{"name":"triex","email":"hi@triex.dev"},"dist":{"shasum":"9b2b9d1fe134eaaf0e6e55ac9c0594e35c5c2067","tarball":"https://registry.npmjs.org/0x1-store/-/0x1-store-0.0.4.tgz","integrity":"sha512-sEO+05wjT7EjJHIkb/c4jn2gOunvqLuH7kt0cUCn1fx8C1Of1IMUUjhXuJoLu4a8vP38x/zxtSzskzSTryT3rA==","fileCount":6,"unpackedSize":21467,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDlLh0gfxgsVN4a/ZFGJqCJd4qfaL713kPv8zZhSSBcugIhAMvCFy3KN0iKUAgEWe1TY6zGQHC8v0ldRjfwLTf2HBl4"}]},"directories":{},"maintainers":[{"name":"triex","email":"hi@triex.dev"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/0x1-store_0.0.4_1748367435109_0.2530781176119745"},"_hasShrinkwrap":false}},"time":{"created":"2025-05-17T03:32:14.126Z","modified":"2025-05-27T17:37:15.484Z","0.0.1":"2025-05-17T03:32:14.301Z","0.0.2":"2025-05-17T03:36:03.362Z","0.0.3":"2025-05-17T06:57:02.958Z","0.0.4":"2025-05-27T17:37:15.302Z"},"bugs":{"url":"https://github.com/Triex/0x1/issues"},"author":{"name":"TriexDev"},"license":"SEE LICENSE IN LICENSE","homepage":"https://github.com/Triex/0x1#readme","repository":{"type":"git","url":"git+https://github.com/Triex/0x1.git"},"description":"A lightweight, type-safe state management library for JavaScript and TypeScript applications.","maintainers":[{"name":"triex","email":"hi@triex.dev"}],"readme":"# 0x1-store\n\nA lightweight, type-safe state management library for JavaScript and TypeScript applications.\n\n## Features\n\n- 🔄 Simple API for state management\n- 🔒 Type-safe with full TypeScript support\n- 💾 Optional local storage persistence\n- 📢 Subscription-based updates\n- 🌐 Global store registry\n- 🪶 Tiny footprint with zero dependencies\n\n## Installation\n\n```bash\n# Using bun\nbun add 0x1-store\n\n# Using npm\nnpm install 0x1-store\n\n# Using yarn\nyarn add 0x1-store\n```\n\n## Basic Usage\n\n```typescript\nimport { createStore } from '0x1-store';\n\n// Create a store with initial state\nconst counterStore = createStore({ count: 0 });\n\n// Get current state\nconsole.log(counterStore.getState()); // { count: 0 }\n\n// Update state with an object\ncounterStore.setState({ count: 1 });\n\n// Update state with a function\ncounterStore.setState((prevState) => ({ \n  count: prevState.count + 1 \n}));\n\n// Subscribe to state changes\nconst unsubscribe = counterStore.subscribe((state) => {\n  console.log('State updated:', state);\n});\n\n// Later, unsubscribe when needed\nunsubscribe();\n\n// Reset state to initial value\ncounterStore.reset();\n```\n\n## Persistence\n\nEnable localStorage persistence to keep state between page reloads:\n\n```typescript\nimport { createStore } from '0x1-store';\n\nconst userStore = createStore(\n  { name: '', loggedIn: false },\n  { \n    persist: true,\n    storageKey: 'user-store' \n  }\n);\n\n// State will automatically be saved to localStorage\nuserStore.setState({ name: 'John', loggedIn: true });\n\n// And loaded when the store is created again\n```\n\n## Global Stores\n\nRegister and use stores across your application:\n\n```typescript\nimport { registerStore, useStore } from '0x1-store';\n\n// In your store definition file\nregisterStore('theme', { dark: false });\n\n// Anywhere else in your application\nconst themeStore = useStore('theme');\nif (themeStore) {\n  const { dark } = themeStore.getState();\n  themeStore.setState({ dark: !dark });\n}\n```\n\n## API Reference\n\n### `createStore<T>(initialState: T, options?: StoreOptions<T>): Store<T>`\n\nCreates a new store with the given initial state and options.\n\n### `Store<T>` Methods\n\n- `getState(): T` - Returns the current state\n- `setState(updater: Partial<T> | ((state: T) => Partial<T>)): void` - Updates the state\n- `subscribe(callback: (state: T) => void): () => void` - Subscribes to state changes, returns unsubscribe function\n- `reset(): void` - Resets the state to the initial value\n\n### `StoreOptions<T>`\n\n- `initialState: T` - The initial state of the store\n- `persist?: boolean` - Whether to persist the state to localStorage (default: false)\n- `storageKey?: string` - The key to use for localStorage (default: '0x1-store')\n\n### Global Store API\n\n- `registerStore<T>(name: string, initialState: T, options?: StoreOptions<T>): Store<T>` - Registers a global store\n- `useStore<T>(name: string): Store<T> | null` - Gets a registered store by name\n\n## License\n\nMIT\n","readmeFilename":"README.md"}