flurryx 0.6.2 → 0.7.0
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 +2 -35
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -145,11 +145,7 @@ npm install @flurryx/core @flurryx/store @flurryx/rx
|
|
|
145
145
|
|
|
146
146
|
### Step 1 — Define your store
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
**Option A — Interface-based (recommended)**
|
|
151
|
-
|
|
152
|
-
Define a TypeScript interface mapping keys to data types, pass it as a generic:
|
|
148
|
+
Define a TypeScript interface mapping slot names to their data types, then pass it to the `Store` builder:
|
|
153
149
|
|
|
154
150
|
```typescript
|
|
155
151
|
import { Store } from "flurryx";
|
|
@@ -162,36 +158,7 @@ interface ProductStoreConfig {
|
|
|
162
158
|
export const ProductStore = Store.for<ProductStoreConfig>().build();
|
|
163
159
|
```
|
|
164
160
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
**Option B — Fluent chaining**
|
|
168
|
-
|
|
169
|
-
Declare each slot inline:
|
|
170
|
-
|
|
171
|
-
```typescript
|
|
172
|
-
export const ProductStore = Store
|
|
173
|
-
.resource('LIST').as<Product[]>()
|
|
174
|
-
.resource('DETAIL').as<Product>()
|
|
175
|
-
.build();
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
**Option C — Enum-constrained**
|
|
179
|
-
|
|
180
|
-
Bind the builder to an enum for compile-time key validation:
|
|
181
|
-
|
|
182
|
-
```typescript
|
|
183
|
-
const ProductStoreEnum = {
|
|
184
|
-
LIST: 'LIST',
|
|
185
|
-
DETAIL: 'DETAIL',
|
|
186
|
-
} as const;
|
|
187
|
-
|
|
188
|
-
export const ProductStore = Store.for(ProductStoreEnum)
|
|
189
|
-
.resource('LIST').as<Product[]>()
|
|
190
|
-
.resource('DETAIL').as<Product>()
|
|
191
|
-
.build();
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
All three options return an `InjectionToken` with `providedIn: 'root'`.
|
|
161
|
+
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 `WritableSignal<ResourceState<Product[]>>`, and invalid keys or mismatched types are caught at compile time.
|
|
195
162
|
|
|
196
163
|
### Step 2 — Create a facade
|
|
197
164
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flurryx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
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.
|
|
42
|
-
"@flurryx/store": "0.
|
|
43
|
-
"@flurryx/rx": "0.
|
|
41
|
+
"@flurryx/core": "0.7.0",
|
|
42
|
+
"@flurryx/store": "0.7.0",
|
|
43
|
+
"@flurryx/rx": "0.7.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@angular/core": ">=17.0.0",
|