flurryx 0.7.4 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -163,7 +163,7 @@ interface ProductStoreConfig {
|
|
|
163
163
|
export const ProductStore = Store.for<ProductStoreConfig>().build();
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
-
That's it. The interface is type-only — zero runtime cost. The builder returns an `InjectionToken` with `providedIn: 'root'`. Every call to `store.get('LIST')` returns `
|
|
166
|
+
That's it. The interface is type-only — zero runtime cost. The builder returns an `InjectionToken` with `providedIn: 'root'`. Every call to `store.get('LIST')` returns `Signal<ResourceState<Product[]>>`, and invalid keys or mismatched types are caught at compile time.
|
|
167
167
|
|
|
168
168
|
### Step 2 — Create a facade
|
|
169
169
|
|
|
@@ -261,7 +261,7 @@ A slot starts as `{ data: undefined, isLoading: false, status: undefined, errors
|
|
|
261
261
|
|
|
262
262
|
### Store API
|
|
263
263
|
|
|
264
|
-
The `Store` builder creates a store backed by `
|
|
264
|
+
The `Store` builder creates a store backed by `Signal<ResourceState>` per slot. Three creation styles are available:
|
|
265
265
|
|
|
266
266
|
```typescript
|
|
267
267
|
// 1. Interface-based (recommended) — type-safe with zero boilerplate
|
|
@@ -288,7 +288,7 @@ Once injected, the store exposes these methods:
|
|
|
288
288
|
|
|
289
289
|
| Method | Description |
|
|
290
290
|
| ------------------------- | ------------------------------------------------------------------------------------- |
|
|
291
|
-
| `get(key)` | Returns the `
|
|
291
|
+
| `get(key)` | Returns the `Signal` for a slot |
|
|
292
292
|
| `update(key, partial)` | Merges partial state (immutable spread) |
|
|
293
293
|
| `clear(key)` | Resets a slot to its initial empty state |
|
|
294
294
|
| `clearAll()` | Resets every slot |
|
|
@@ -306,6 +306,10 @@ Once injected, the store exposes these methods:
|
|
|
306
306
|
|
|
307
307
|
> Update hooks are stored in a `WeakMap` keyed by store instance, so garbage collection works naturally across multiple store lifetimes.
|
|
308
308
|
|
|
309
|
+
#### Read-only signals
|
|
310
|
+
|
|
311
|
+
`get(key)` returns a **read-only `Signal`**, not a `WritableSignal`. Consumers can read state but cannot mutate it directly — all writes must go through the store's own methods (`update`, `clear`, `startLoading`, …). This enforces strict encapsulation: the store is the single owner of its state, and external code can only observe it.
|
|
312
|
+
|
|
309
313
|
### Store Creation Styles
|
|
310
314
|
|
|
311
315
|
#### Interface-based: `Store.for<Config>().build()`
|
|
@@ -331,7 +335,7 @@ Type safety is fully enforced:
|
|
|
331
335
|
```typescript
|
|
332
336
|
const store = inject(ChatStore);
|
|
333
337
|
|
|
334
|
-
store.get('SESSIONS'); //
|
|
338
|
+
store.get('SESSIONS'); // Signal<ResourceState<ChatSession[]>>
|
|
335
339
|
store.update('SESSIONS', { data: [session] }); // ✅ type-checked
|
|
336
340
|
store.update('SESSIONS', { data: 42 }); // ❌ TS error — number is not ChatSession[]
|
|
337
341
|
store.get('INVALID'); // ❌ TS error — key does not exist
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flurryx",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"description": "Signal-first reactive state management for Angular",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
},
|
|
39
39
|
"sideEffects": false,
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flurryx/core": "0.7.
|
|
42
|
-
"@flurryx/store": "0.7.
|
|
43
|
-
"@flurryx/rx": "0.7.
|
|
41
|
+
"@flurryx/core": "0.7.6",
|
|
42
|
+
"@flurryx/store": "0.7.6",
|
|
43
|
+
"@flurryx/rx": "0.7.6"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@angular/core": ">=17.0.0",
|