storion 0.4.0 → 0.6.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 +636 -32
- package/dist/async/async.d.ts +33 -1
- package/dist/async/async.d.ts.map +1 -1
- package/dist/async/index.d.ts +1 -1
- package/dist/async/index.d.ts.map +1 -1
- package/dist/async/index.js +98 -16
- package/dist/collection.d.ts +13 -21
- package/dist/collection.d.ts.map +1 -1
- package/dist/core/container.d.ts +6 -12
- package/dist/core/container.d.ts.map +1 -1
- package/dist/core/createResolver.d.ts.map +1 -1
- package/dist/core/disposable.d.ts +18 -0
- package/dist/core/disposable.d.ts.map +1 -0
- package/dist/core/middleware.d.ts +25 -12
- package/dist/core/middleware.d.ts.map +1 -1
- package/dist/core/storeContext.d.ts.map +1 -1
- package/dist/devtools/index.js +4 -1
- package/dist/devtools/middleware.d.ts +2 -2
- package/dist/devtools/middleware.d.ts.map +1 -1
- package/dist/devtools-panel/index.js +48 -8
- package/dist/devtools-panel/mount.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/react/index.js +8 -3
- package/dist/react/useStore.d.ts.map +1 -1
- package/dist/{store-Yv-9gPVf.js → store-DS-4XdM6.js} +33 -9
- package/dist/storion.js +177 -233
- package/dist/test/util.d.ts +2 -0
- package/dist/test/util.d.ts.map +1 -0
- package/dist/types.d.ts +139 -20
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/async/async.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Focus } from '../types';
|
|
2
|
-
import { AsyncState, AsyncMode, AsyncHandler, AsyncOptions, AsyncActions, CancellablePromise, InferAsyncData, MapAsyncData, MapSettledResult, RaceResult } from './types';
|
|
2
|
+
import { AsyncState, AsyncMode, AsyncHandler, AsyncOptions, AsyncActions, CancellablePromise, InferAsyncData, MapAsyncData, MapSettledResult, RaceResult, AsyncKey, AsyncRequestId } from './types';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Get the pending promise for an async state (for Suspense).
|
|
@@ -12,14 +12,46 @@ export declare function getPendingPromise<T>(state: AsyncState<T, any>): Promise
|
|
|
12
12
|
*/
|
|
13
13
|
declare function promiseTry<T>(fn: () => T | PromiseLike<T>): Promise<Awaited<T>>;
|
|
14
14
|
export declare function async<T, M extends AsyncMode, TArgs extends any[]>(focus: Focus<AsyncState<T, M>>, handler: AsyncHandler<T, TArgs>, options?: AsyncOptions): AsyncActions<T, M, TArgs>;
|
|
15
|
+
/**
|
|
16
|
+
* Extra properties that can be added to async state.
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
interface AsyncStateExtra<T> {
|
|
20
|
+
__key?: AsyncKey<T>;
|
|
21
|
+
__requestId?: AsyncRequestId;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create a frozen AsyncState with the specified status.
|
|
25
|
+
* Users cannot modify properties directly - must use async actions.
|
|
26
|
+
*
|
|
27
|
+
* Overloads:
|
|
28
|
+
* - asyncState("fresh", "idle") - Fresh idle state
|
|
29
|
+
* - asyncState("fresh", "pending", extra?) - Fresh pending state
|
|
30
|
+
* - asyncState("fresh", "success", data) - Fresh success state
|
|
31
|
+
* - asyncState("fresh", "error", error, extra?) - Fresh error state
|
|
32
|
+
* - asyncState("stale", "idle", data) - Stale idle state
|
|
33
|
+
* - asyncState("stale", "pending", data, extra?) - Stale pending state
|
|
34
|
+
* - asyncState("stale", "success", data) - Stale success state
|
|
35
|
+
* - asyncState("stale", "error", data, error, extra?) - Stale error state
|
|
36
|
+
*/
|
|
37
|
+
export declare function asyncState<T = unknown>(mode: "fresh", status: "idle"): AsyncState<T, "fresh">;
|
|
38
|
+
export declare function asyncState<T = unknown>(mode: "fresh", status: "pending", extra?: AsyncStateExtra<T>): AsyncState<T, "fresh">;
|
|
39
|
+
export declare function asyncState<T>(mode: "fresh", status: "success", data: T): AsyncState<T, "fresh">;
|
|
40
|
+
export declare function asyncState<T = unknown>(mode: "fresh", status: "error", error: Error, extra?: AsyncStateExtra<T>): AsyncState<T, "fresh">;
|
|
41
|
+
export declare function asyncState<T>(mode: "stale", status: "idle", data: T): AsyncState<T, "stale">;
|
|
42
|
+
export declare function asyncState<T>(mode: "stale", status: "pending", data: T, extra?: AsyncStateExtra<T>): AsyncState<T, "stale">;
|
|
43
|
+
export declare function asyncState<T>(mode: "stale", status: "success", data: T): AsyncState<T, "stale">;
|
|
44
|
+
export declare function asyncState<T>(mode: "stale", status: "error", data: T, error: Error, extra?: AsyncStateExtra<T>): AsyncState<T, "stale">;
|
|
15
45
|
export declare namespace async {
|
|
16
46
|
/**
|
|
17
47
|
* Create a fresh mode async state (data undefined during loading/error).
|
|
48
|
+
* @deprecated Use `asyncState("fresh", "idle")` for explicit state creation
|
|
18
49
|
*/
|
|
19
50
|
function fresh<T = unknown>(): AsyncState<T, "fresh">;
|
|
20
51
|
/**
|
|
21
52
|
* Create a stale mode async state with initial data.
|
|
22
53
|
* Data is preserved during loading and error states.
|
|
54
|
+
* @deprecated Use `asyncState("stale", "idle", initialData)` for explicit state creation
|
|
23
55
|
*/
|
|
24
56
|
function stale<T>(initialData: T): AsyncState<T, "stale">;
|
|
25
57
|
function delay<T = void>(ms: number, resolved?: T): CancellablePromise<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/async/async.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EAET,YAAY,EACZ,YAAY,EACZ,YAAY,EAEZ,kBAAkB,EAElB,cAAc,EAEd,YAAY,EACZ,gBAAgB,EAChB,UAAU,
|
|
1
|
+
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/async/async.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UA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AAgB,CAAC,CAAC,CAAC,CA+BrB;IAED;;OAEG;IACH,SAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,SAAS,SAAS,EAC5C,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GACtB,KAAK,IAAI,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAIzC;IAED;;OAEG;IACH,SAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,SAAS,EAC9C,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GACtB,KAAK,IAAI,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,MAAM,EAAE,SAAS,CAAA;KAAE,CAEnD;IAED;;OAEG;IACH,SAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,SAAS,SAAS,EAC5C,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GACtB,KAAK,IAAI,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE,CAE/D;CACF"}
|
package/dist/async/index.d.ts
CHANGED
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
* - fresh: data is undefined during loading/error (only show fresh data)
|
|
9
9
|
* - stale: data is preserved during loading/error (stale-while-revalidate)
|
|
10
10
|
*/
|
|
11
|
-
export { async, getPendingPromise } from './async';
|
|
11
|
+
export { async, asyncState, getPendingPromise } from './async';
|
|
12
12
|
export { AsyncNotReadyError, AsyncAggregateError, type AsyncMode, type AsyncState, type AsyncIdleState, type AsyncIdleStateFresh, type AsyncIdleStateStale, type AsyncPendingState, type AsyncPendingStateFresh, type AsyncPendingStateStale, type AsyncSuccessState, type AsyncErrorState, type AsyncErrorStateFresh, type AsyncErrorStateStale, type AsyncStatus, type AsyncContext, type AsyncHandler, type AsyncOptions, type AsyncRetryOptions, type AsyncActions, type AsyncLastInvocation, type CancellablePromise, type InferAsyncData, type InferAsyncMode, type SettledResult, type MapAsyncData, type MapSettledResult, type RaceResult, type AsyncKey, type SerializedAsyncState, } from './types';
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/async/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/async/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,oBAAoB,GAC1B,MAAM,SAAS,CAAC"}
|
package/dist/async/index.js
CHANGED
|
@@ -261,27 +261,108 @@ function async(focus, handler, options) {
|
|
|
261
261
|
last
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
|
+
function asyncState(mode, status, dataOrError, errorOrExtra, extra) {
|
|
265
|
+
let state;
|
|
266
|
+
if (mode === "fresh") {
|
|
267
|
+
switch (status) {
|
|
268
|
+
case "idle":
|
|
269
|
+
state = {
|
|
270
|
+
status: "idle",
|
|
271
|
+
mode: "fresh",
|
|
272
|
+
data: void 0,
|
|
273
|
+
error: void 0,
|
|
274
|
+
timestamp: void 0,
|
|
275
|
+
toJSON: stateToJSON
|
|
276
|
+
};
|
|
277
|
+
break;
|
|
278
|
+
case "pending":
|
|
279
|
+
state = {
|
|
280
|
+
status: "pending",
|
|
281
|
+
mode: "fresh",
|
|
282
|
+
data: void 0,
|
|
283
|
+
error: void 0,
|
|
284
|
+
timestamp: void 0,
|
|
285
|
+
...dataOrError,
|
|
286
|
+
toJSON: stateToJSON
|
|
287
|
+
};
|
|
288
|
+
break;
|
|
289
|
+
case "success":
|
|
290
|
+
state = {
|
|
291
|
+
status: "success",
|
|
292
|
+
mode: "fresh",
|
|
293
|
+
data: dataOrError,
|
|
294
|
+
error: void 0,
|
|
295
|
+
timestamp: Date.now(),
|
|
296
|
+
toJSON: stateToJSON
|
|
297
|
+
};
|
|
298
|
+
break;
|
|
299
|
+
case "error":
|
|
300
|
+
state = {
|
|
301
|
+
status: "error",
|
|
302
|
+
mode: "fresh",
|
|
303
|
+
data: void 0,
|
|
304
|
+
error: dataOrError,
|
|
305
|
+
timestamp: void 0,
|
|
306
|
+
...errorOrExtra,
|
|
307
|
+
toJSON: stateToJSON
|
|
308
|
+
};
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
} else {
|
|
312
|
+
switch (status) {
|
|
313
|
+
case "idle":
|
|
314
|
+
state = {
|
|
315
|
+
status: "idle",
|
|
316
|
+
mode: "stale",
|
|
317
|
+
data: dataOrError,
|
|
318
|
+
error: void 0,
|
|
319
|
+
timestamp: void 0,
|
|
320
|
+
toJSON: stateToJSON
|
|
321
|
+
};
|
|
322
|
+
break;
|
|
323
|
+
case "pending":
|
|
324
|
+
state = {
|
|
325
|
+
status: "pending",
|
|
326
|
+
mode: "stale",
|
|
327
|
+
data: dataOrError,
|
|
328
|
+
error: void 0,
|
|
329
|
+
timestamp: void 0,
|
|
330
|
+
...errorOrExtra,
|
|
331
|
+
toJSON: stateToJSON
|
|
332
|
+
};
|
|
333
|
+
break;
|
|
334
|
+
case "success":
|
|
335
|
+
state = {
|
|
336
|
+
status: "success",
|
|
337
|
+
mode: "stale",
|
|
338
|
+
data: dataOrError,
|
|
339
|
+
error: void 0,
|
|
340
|
+
timestamp: Date.now(),
|
|
341
|
+
toJSON: stateToJSON
|
|
342
|
+
};
|
|
343
|
+
break;
|
|
344
|
+
case "error":
|
|
345
|
+
state = {
|
|
346
|
+
status: "error",
|
|
347
|
+
mode: "stale",
|
|
348
|
+
data: dataOrError,
|
|
349
|
+
error: errorOrExtra,
|
|
350
|
+
timestamp: void 0,
|
|
351
|
+
...extra,
|
|
352
|
+
toJSON: stateToJSON
|
|
353
|
+
};
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return Object.freeze(state);
|
|
358
|
+
}
|
|
264
359
|
((async2) => {
|
|
265
360
|
function fresh() {
|
|
266
|
-
return
|
|
267
|
-
status: "idle",
|
|
268
|
-
mode: "fresh",
|
|
269
|
-
data: void 0,
|
|
270
|
-
error: void 0,
|
|
271
|
-
timestamp: void 0,
|
|
272
|
-
toJSON: stateToJSON
|
|
273
|
-
};
|
|
361
|
+
return asyncState("fresh", "idle");
|
|
274
362
|
}
|
|
275
363
|
async2.fresh = fresh;
|
|
276
364
|
function stale(initialData) {
|
|
277
|
-
return
|
|
278
|
-
status: "idle",
|
|
279
|
-
mode: "stale",
|
|
280
|
-
data: initialData,
|
|
281
|
-
error: void 0,
|
|
282
|
-
timestamp: void 0,
|
|
283
|
-
toJSON: stateToJSON
|
|
284
|
-
};
|
|
365
|
+
return asyncState("stale", "idle", initialData);
|
|
285
366
|
}
|
|
286
367
|
async2.stale = stale;
|
|
287
368
|
function delay(ms, resolved) {
|
|
@@ -447,5 +528,6 @@ export {
|
|
|
447
528
|
AsyncAggregateError,
|
|
448
529
|
AsyncNotReadyError,
|
|
449
530
|
async,
|
|
531
|
+
asyncState,
|
|
450
532
|
getPendingPromise
|
|
451
533
|
};
|
package/dist/collection.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
export interface Collection<TKey, TValue> {
|
|
2
|
+
with(key: TKey, callback: (item: TValue) => void): this;
|
|
3
|
+
has(key: TKey): boolean;
|
|
4
|
+
get(key: TKey): TValue;
|
|
5
|
+
set(key: TKey, value: TValue): this;
|
|
6
|
+
size: number;
|
|
7
|
+
clear(): this;
|
|
8
|
+
delete(key: TKey): this;
|
|
9
|
+
keys(): IterableIterator<TKey>;
|
|
10
|
+
values(): IterableIterator<TValue>;
|
|
11
|
+
entries(): IterableIterator<[TKey, TValue]>;
|
|
12
|
+
}
|
|
1
13
|
/**
|
|
2
14
|
* Lazy-instantiation Map wrapper.
|
|
3
15
|
*
|
|
@@ -18,25 +30,5 @@
|
|
|
18
30
|
* @param initialItems - Optional initial entries
|
|
19
31
|
* @returns A Map-like object with lazy instantiation on `get()`
|
|
20
32
|
*/
|
|
21
|
-
export declare function collection<TKey, TValue>(createItem: (key: TKey) => TValue, initialItems?: readonly [TKey, TValue][]):
|
|
22
|
-
with(key: TKey, callback: (item: TValue) => void): /*elided*/ any;
|
|
23
|
-
/** Check if key exists (does NOT create item) */
|
|
24
|
-
has(key: TKey): boolean;
|
|
25
|
-
/** Get item by key, creating it if it doesn't exist */
|
|
26
|
-
get(key: TKey): NonNullable<TValue>;
|
|
27
|
-
/** Explicitly set an item */
|
|
28
|
-
set(key: TKey, value: TValue): /*elided*/ any;
|
|
29
|
-
/** Number of items in the collection */
|
|
30
|
-
readonly size: number;
|
|
31
|
-
/** Remove all items */
|
|
32
|
-
clear(): /*elided*/ any;
|
|
33
|
-
/** Remove a specific item */
|
|
34
|
-
delete(key: TKey): /*elided*/ any;
|
|
35
|
-
/** Iterate over keys */
|
|
36
|
-
keys(): MapIterator<TKey>;
|
|
37
|
-
/** Iterate over values */
|
|
38
|
-
values(): MapIterator<TValue>;
|
|
39
|
-
/** Iterate over [key, value] pairs */
|
|
40
|
-
entries(): MapIterator<[TKey, TValue]>;
|
|
41
|
-
};
|
|
33
|
+
export declare function collection<TKey, TValue>(createItem: (key: TKey) => TValue, initialItems?: readonly [TKey, TValue][]): Collection<TKey, TValue>;
|
|
42
34
|
//# sourceMappingURL=collection.d.ts.map
|
package/dist/collection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU,CAAC,IAAI,EAAE,MAAM;IACtC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IACxD,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC;IACxB,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,MAAM,CAAC;IACvB,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,IAAI,IAAI,CAAC;IACd,MAAM,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,IAAI,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACnC,OAAO,IAAI,gBAAgB,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EACrC,UAAU,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,EACjC,YAAY,CAAC,EAAE,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,GACvC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CA8D1B"}
|
package/dist/core/container.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { StoreContainer, ContainerOptions,
|
|
1
|
+
import { StoreContainer, ContainerOptions, Middleware } from '../types';
|
|
2
2
|
|
|
3
3
|
interface DefaultMiddlewareConfig {
|
|
4
4
|
/** Middleware to run before container's middleware */
|
|
5
|
-
pre?:
|
|
5
|
+
pre?: Middleware[];
|
|
6
6
|
/** Middleware to run after container's middleware */
|
|
7
|
-
post?:
|
|
7
|
+
post?: Middleware[];
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Container function with static defaults method.
|
|
@@ -22,16 +22,10 @@ interface ContainerFn {
|
|
|
22
22
|
/**
|
|
23
23
|
* Create a store container.
|
|
24
24
|
*
|
|
25
|
-
* Container
|
|
26
|
-
* - get(
|
|
27
|
-
* - create(spec): fresh instance
|
|
28
|
-
* - set(spec, override): override for DI/testing
|
|
29
|
-
* - has(spec): check cache
|
|
30
|
-
* - tryGet(spec): get if cached
|
|
31
|
-
* - delete(spec): remove from cache
|
|
32
|
-
* - clear(): dispose all
|
|
33
|
-
* - scope(): child container
|
|
25
|
+
* Container wraps a resolver and adds store-specific features:
|
|
26
|
+
* - get(id): lookup store by instance ID
|
|
34
27
|
* - onCreate/onDispose: lifecycle events
|
|
28
|
+
* - Ordered disposal (reverse creation order)
|
|
35
29
|
*/
|
|
36
30
|
export declare const container: ContainerFn;
|
|
37
31
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/core/container.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/core/container.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAEhB,MAAM,UAAU,CAAC;AAYlB,UAAU,uBAAuB;IAC/B,sDAAsD;IACtD,GAAG,CAAC,EAAE,UAAU,EAAE,CAAC;IACnB,qDAAqD;IACrD,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC;CACrB;AAYD;;GAEG;AACH,UAAU,WAAW;IACnB,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,cAAc,CAAC;IAC7C;;OAEG;IACH,QAAQ,EAAE;QACR,CAAC,MAAM,CAAC,EAAE,uBAAuB,GAAG,IAAI,CAAC;QACzC,KAAK,IAAI,IAAI,CAAC;KACf,CAAC;CACH;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,EAAE,WAkLvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createResolver.d.ts","sourceRoot":"","sources":["../../src/core/createResolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EACV,OAAO,
|
|
1
|
+
{"version":3,"file":"createResolver.d.ts","sourceRoot":"","sources":["../../src/core/createResolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EACV,OAAO,EAEP,UAAU,EACV,QAAQ,EACR,eAAe,EAIhB,MAAM,UAAU,CAAC;AAKlB,YAAY,EACV,OAAO,EACP,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,eAAe,GAChB,MAAM,UAAU,CAAC;AAmClB;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,eAAoB,GAAG,QAAQ,CA6JtE;AAMD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,IAAI,CAClB,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,EACxC,UAAU,EAAE,UAAU,GACrB,UAAU,CAOZ;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,SAAa,GAAG,UAAU,CAUvE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,GACpD,UAAU,CAMZ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Disposable } from '../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Attempts to dispose a value if it has a `dispose` property.
|
|
5
|
+
*
|
|
6
|
+
* Supports multiple disposal patterns:
|
|
7
|
+
* - If `dispose` is a function, it will be called directly
|
|
8
|
+
* - If `dispose` is an array, each item will be processed:
|
|
9
|
+
* - Functions are called directly
|
|
10
|
+
* - Objects are recursively disposed via `tryDispose`
|
|
11
|
+
*
|
|
12
|
+
* @param value - The value to attempt disposal on. Can be any type;
|
|
13
|
+
* non-disposable values are safely ignored.
|
|
14
|
+
*/
|
|
15
|
+
export declare function tryDispose(value: unknown): void;
|
|
16
|
+
export declare function isDisposable(value: unknown): value is Disposable;
|
|
17
|
+
export declare function willDispose(value: unknown): VoidFunction;
|
|
18
|
+
//# sourceMappingURL=disposable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disposable.d.ts","sourceRoot":"","sources":["../../src/core/disposable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,QAoBxC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAMhE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAExD"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Middleware, MiddlewareContext, StoreMiddlewareContext } from '../types';
|
|
2
2
|
|
|
3
3
|
/** Pattern type for matching displayName */
|
|
4
4
|
export type SpecPattern = string | RegExp;
|
|
5
5
|
/**
|
|
6
|
-
* Compose multiple
|
|
6
|
+
* Compose multiple middleware into one.
|
|
7
7
|
* Middleware are applied in order (first middleware wraps the chain).
|
|
8
8
|
*/
|
|
9
|
-
export declare function compose(...middlewares:
|
|
9
|
+
export declare function compose(...middlewares: Middleware[]): Middleware;
|
|
10
10
|
/**
|
|
11
11
|
* Conditionally apply middleware based on a predicate or pattern(s).
|
|
12
12
|
*
|
|
@@ -43,7 +43,7 @@ export declare function compose(...middlewares: StoreMiddleware[]): StoreMiddlew
|
|
|
43
43
|
*
|
|
44
44
|
* // Predicate function
|
|
45
45
|
* applyFor(
|
|
46
|
-
* (ctx) => ctx.spec.options.meta?.persist === true,
|
|
46
|
+
* (ctx) => ctx.type === "store" && ctx.spec.options.meta?.persist === true,
|
|
47
47
|
* persistMiddleware
|
|
48
48
|
* );
|
|
49
49
|
*
|
|
@@ -51,16 +51,16 @@ export declare function compose(...middlewares: StoreMiddleware[]): StoreMiddlew
|
|
|
51
51
|
* applyFor("counterStore", [loggingMiddleware, devtoolsMiddleware]);
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
|
-
export declare function applyFor(predicate: (ctx:
|
|
55
|
-
export declare function applyFor(patterns: SpecPattern | SpecPattern[], middleware:
|
|
54
|
+
export declare function applyFor(predicate: (ctx: MiddlewareContext) => boolean, middleware: Middleware | Middleware[]): Middleware;
|
|
55
|
+
export declare function applyFor(patterns: SpecPattern | SpecPattern[], middleware: Middleware | Middleware[]): Middleware;
|
|
56
56
|
/**
|
|
57
|
-
* Apply middleware to all
|
|
57
|
+
* Apply middleware to all except those matching predicate or pattern(s).
|
|
58
58
|
*
|
|
59
|
-
* @overload Exclude
|
|
59
|
+
* @overload Exclude matching predicate
|
|
60
60
|
* @param predicate - Function that receives context and returns whether to exclude
|
|
61
61
|
* @param middleware - Middleware or array of middleware to apply
|
|
62
62
|
*
|
|
63
|
-
* @overload Exclude
|
|
63
|
+
* @overload Exclude matching pattern(s)
|
|
64
64
|
* @param patterns - Pattern or array of patterns to exclude
|
|
65
65
|
* @param middleware - Middleware or array of middleware to apply
|
|
66
66
|
*
|
|
@@ -68,7 +68,7 @@ export declare function applyFor(patterns: SpecPattern | SpecPattern[], middlewa
|
|
|
68
68
|
* ```ts
|
|
69
69
|
* // Exclude by predicate
|
|
70
70
|
* applyExcept(
|
|
71
|
-
* (ctx) => ctx.displayName
|
|
71
|
+
* (ctx) => ctx.displayName?.startsWith("_") ?? false,
|
|
72
72
|
* loggingMiddleware
|
|
73
73
|
* );
|
|
74
74
|
*
|
|
@@ -83,6 +83,19 @@ export declare function applyFor(patterns: SpecPattern | SpecPattern[], middlewa
|
|
|
83
83
|
* applyExcept(/^(temp|cache)/, persistMiddleware);
|
|
84
84
|
* ```
|
|
85
85
|
*/
|
|
86
|
-
export declare function applyExcept(predicate: (ctx:
|
|
87
|
-
export declare function applyExcept(patterns: SpecPattern | SpecPattern[], middleware:
|
|
86
|
+
export declare function applyExcept(predicate: (ctx: MiddlewareContext) => boolean, middleware: Middleware | Middleware[]): Middleware;
|
|
87
|
+
export declare function applyExcept(patterns: SpecPattern | SpecPattern[], middleware: Middleware | Middleware[]): Middleware;
|
|
88
|
+
/**
|
|
89
|
+
* Helper to create store-only middleware.
|
|
90
|
+
* The middleware will only run for stores, not plain factories.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* const storeLogger = forStores((ctx) => {
|
|
95
|
+
* console.log(`Creating store: ${ctx.spec.displayName}`);
|
|
96
|
+
* return ctx.next();
|
|
97
|
+
* });
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export declare function forStores(storeMiddleware: (ctx: StoreMiddlewareContext) => unknown): Middleware;
|
|
88
101
|
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/core/middleware.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/core/middleware.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,UAAU,CAAC;AAElB,4CAA4C;AAC5C,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,CAAC;AA2D1C;;;GAGG;AACH,wBAAgB,OAAO,CAAC,GAAG,WAAW,EAAE,UAAU,EAAE,GAAG,UAAU,CA6BhE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,QAAQ,CACtB,SAAS,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,OAAO,EAC9C,UAAU,EAAE,UAAU,GAAG,UAAU,EAAE,GACpC,UAAU,CAAC;AACd,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,WAAW,GAAG,WAAW,EAAE,EACrC,UAAU,EAAE,UAAU,GAAG,UAAU,EAAE,GACpC,UAAU,CAAC;AA4Bd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,OAAO,EAC9C,UAAU,EAAE,UAAU,GAAG,UAAU,EAAE,GACpC,UAAU,CAAC;AACd,wBAAgB,WAAW,CACzB,QAAQ,EAAE,WAAW,GAAG,WAAW,EAAE,EACrC,UAAU,EAAE,UAAU,GAAG,UAAU,EAAE,GACpC,UAAU,CAAC;AAmBd;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CACvB,eAAe,EAAE,CAAC,GAAG,EAAE,sBAAsB,KAAK,OAAO,GACxD,UAAU,CAOZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storeContext.d.ts","sourceRoot":"","sources":["../../src/core/storeContext.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,YAAY,EAGjB,KAAK,KAAK,EACV,KAAK,YAAY,EAElB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"storeContext.d.ts","sourceRoot":"","sources":["../../src/core/storeContext.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,YAAY,EAGjB,KAAK,KAAK,EACV,KAAK,YAAY,EAElB,MAAM,UAAU,CAAC;AAUlB;;GAEG;AACH,MAAM,WAAW,YAAY,CAAC,MAAM,SAAS,SAAS;IACpD,wBAAwB;IACxB,QAAQ,EAAE,MAAM,MAAM,CAAC;IACvB,4CAA4C;IAC5C,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IACnD,iCAAiC;IACjC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,YAAY,CAAC;CACnD;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB,CACxC,MAAM,SAAS,SAAS,EACxB,QAAQ,SAAS,WAAW;IAE5B,8BAA8B;IAC9B,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClC,oCAAoC;IACpC,QAAQ,EAAE,QAAQ,CAAC;IACnB,gCAAgC;IAChC,eAAe,EAAE,MAAM,MAAM,CAAC;IAC9B,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S as STORION_TYPE } from "../store-
|
|
1
|
+
import { e as emitter, c as createStoreInstance, S as STORION_TYPE } from "../store-DS-4XdM6.js";
|
|
2
2
|
let snapshotIdCounter = 0;
|
|
3
3
|
let eventIdCounter = 0;
|
|
4
4
|
const DEFAULT_MAX_EVENTS = 200;
|
|
@@ -158,6 +158,9 @@ function devtoolsMiddleware(options = {}) {
|
|
|
158
158
|
const unregisterStore = controller._unregisterStore;
|
|
159
159
|
const recordStateChange = controller._recordStateChange;
|
|
160
160
|
return (ctx) => {
|
|
161
|
+
if (ctx.type !== "store") {
|
|
162
|
+
return ctx.next();
|
|
163
|
+
}
|
|
161
164
|
const { spec, resolver } = ctx;
|
|
162
165
|
return handleStoreCreation(
|
|
163
166
|
spec,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Middleware } from '../types';
|
|
2
2
|
import { DevtoolsController, DevtoolsMiddlewareOptions } from './types';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -14,7 +14,7 @@ import { DevtoolsController, DevtoolsMiddlewareOptions } from './types';
|
|
|
14
14
|
* });
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
export declare function devtoolsMiddleware(options?: DevtoolsMiddlewareOptions):
|
|
17
|
+
export declare function devtoolsMiddleware(options?: DevtoolsMiddlewareOptions): Middleware;
|
|
18
18
|
/**
|
|
19
19
|
* Get the devtools controller from window.
|
|
20
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/devtools/middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/devtools/middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,UAAU,EAKX,MAAM,UAAU,CAAC;AAIlB,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EAE1B,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,GAAE,yBAA8B,GACtC,UAAU,CAoDZ;AAwGD;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,kBAAkB,GAAG,SAAS,CAKtE"}
|
|
@@ -3065,20 +3065,60 @@ function loadStoredSettings() {
|
|
|
3065
3065
|
let panelRoot = null;
|
|
3066
3066
|
let panelContainer = null;
|
|
3067
3067
|
let currentPosition = "left";
|
|
3068
|
-
|
|
3068
|
+
const originalBodyPadding = {
|
|
3069
|
+
left: "",
|
|
3070
|
+
right: "",
|
|
3071
|
+
bottom: ""
|
|
3072
|
+
};
|
|
3073
|
+
let currentPaddingSide = null;
|
|
3069
3074
|
function updateBodyPadding(position, size, collapsed) {
|
|
3070
|
-
if (
|
|
3071
|
-
|
|
3072
|
-
|
|
3075
|
+
if (currentPaddingSide && currentPaddingSide !== position) {
|
|
3076
|
+
restorePaddingForPosition(currentPaddingSide);
|
|
3077
|
+
}
|
|
3078
|
+
if (collapsed) {
|
|
3079
|
+
if (currentPaddingSide) {
|
|
3080
|
+
restorePaddingForPosition(currentPaddingSide);
|
|
3081
|
+
currentPaddingSide = null;
|
|
3082
|
+
}
|
|
3083
|
+
return;
|
|
3084
|
+
}
|
|
3085
|
+
if (position === "bottom") {
|
|
3086
|
+
if (currentPaddingSide !== "bottom") {
|
|
3087
|
+
originalBodyPadding.bottom = document.body.style.paddingBottom || "";
|
|
3073
3088
|
}
|
|
3074
3089
|
document.body.style.paddingBottom = `${size}px`;
|
|
3075
|
-
|
|
3076
|
-
|
|
3090
|
+
currentPaddingSide = "bottom";
|
|
3091
|
+
} else if (position === "left") {
|
|
3092
|
+
if (currentPaddingSide !== "left") {
|
|
3093
|
+
originalBodyPadding.left = document.body.style.paddingLeft || "";
|
|
3094
|
+
}
|
|
3095
|
+
document.body.style.paddingLeft = `${size}px`;
|
|
3096
|
+
currentPaddingSide = "left";
|
|
3097
|
+
} else if (position === "right") {
|
|
3098
|
+
if (currentPaddingSide !== "right") {
|
|
3099
|
+
originalBodyPadding.right = document.body.style.paddingRight || "";
|
|
3100
|
+
}
|
|
3101
|
+
document.body.style.paddingRight = `${size}px`;
|
|
3102
|
+
currentPaddingSide = "right";
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
function restorePaddingForPosition(position) {
|
|
3106
|
+
if (position === "bottom") {
|
|
3107
|
+
document.body.style.paddingBottom = originalBodyPadding.bottom;
|
|
3108
|
+
} else if (position === "left") {
|
|
3109
|
+
document.body.style.paddingLeft = originalBodyPadding.left;
|
|
3110
|
+
} else if (position === "right") {
|
|
3111
|
+
document.body.style.paddingRight = originalBodyPadding.right;
|
|
3077
3112
|
}
|
|
3078
3113
|
}
|
|
3079
3114
|
function resetBodyPadding() {
|
|
3080
|
-
document.body.style.
|
|
3081
|
-
|
|
3115
|
+
document.body.style.paddingLeft = originalBodyPadding.left;
|
|
3116
|
+
document.body.style.paddingRight = originalBodyPadding.right;
|
|
3117
|
+
document.body.style.paddingBottom = originalBodyPadding.bottom;
|
|
3118
|
+
originalBodyPadding.left = "";
|
|
3119
|
+
originalBodyPadding.right = "";
|
|
3120
|
+
originalBodyPadding.bottom = "";
|
|
3121
|
+
currentPaddingSide = null;
|
|
3082
3122
|
}
|
|
3083
3123
|
let wasCollapsed = false;
|
|
3084
3124
|
function updateContainerPosition(position, size, collapsed = false) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/devtools-panel/mount.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA2BpE,MAAM,WAAW,YAAY;IAC3B,0EAA0E;IAC1E,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IACjC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sBAAsB;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/devtools-panel/mount.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA2BpE,MAAM,WAAW,YAAY;IAC3B,0EAA0E;IAC1E,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IACjC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sBAAsB;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAkMD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,YAAiB,GAAG,MAAM,IAAI,CA6LzE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAU3C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,CAMhE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export { batch, untrack } from './core/tracking';
|
|
|
11
11
|
export { createResolver, when, createLoggingMiddleware, createValidationMiddleware, } from './core/createResolver';
|
|
12
12
|
export { pick } from './core/pick';
|
|
13
13
|
export { effect, type EffectFn, type EffectContext, type EffectOptions, type EffectErrorStrategy, type EffectErrorContext, type EffectRetryConfig, } from './core/effect';
|
|
14
|
-
export { applyFor, applyExcept, compose, type SpecPattern, } from './core/middleware';
|
|
14
|
+
export { applyFor, applyExcept, compose, forStores, type SpecPattern, } from './core/middleware';
|
|
15
15
|
export { equality, shallowEqual, deepEqual, strictEqual, } from './core/equality';
|
|
16
16
|
export { trigger, type TriggerOptions } from './trigger';
|
|
17
17
|
export { wrapFn as wrapFn, unwrapFn, isWrappedFn } from './core/fnWrapper';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,YAAY,EAEjB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAEf,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,eAAe,GACrB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,EAAE,EACF,SAAS,EACT,OAAO,EACP,MAAM,EACN,WAAW,EACX,OAAO,EACP,OAAO,EACP,QAAQ,EACR,cAAc,EACd,iBAAiB,GAClB,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,kB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kB,CAAC"}
|
package/dist/react/index.js
CHANGED
|
@@ -3,9 +3,9 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { memo, useMemo, createElement, createContext, useContext, useReducer, useRef, useEffect, useLayoutEffect, useState, forwardRef } from "react";
|
|
5
5
|
import { container } from "../storion.js";
|
|
6
|
-
import { applyExcept, applyFor, compose, createLoggingMiddleware, createResolver, createValidationMiddleware, effect, pick, trigger, when } from "../storion.js";
|
|
7
|
-
import { w as withHooks, i as isSpec, S as STORION_TYPE, r as resolveEquality, s as store } from "../store-
|
|
8
|
-
import { m, p, n, g, a, j, d, h, l, f, k, b, x, o, q, u, v, t } from "../store-
|
|
6
|
+
import { applyExcept, applyFor, compose, createLoggingMiddleware, createResolver, createValidationMiddleware, effect, forStores, pick, trigger, when } from "../storion.js";
|
|
7
|
+
import { w as withHooks, i as isSpec, S as STORION_TYPE, r as resolveEquality, s as store } from "../store-DS-4XdM6.js";
|
|
8
|
+
import { m, p, n, g, a, j, d, h, l, f, k, b, x, o, q, u, v, t } from "../store-DS-4XdM6.js";
|
|
9
9
|
import { jsx } from "react/jsx-runtime";
|
|
10
10
|
const StoreContext = createContext(null);
|
|
11
11
|
const StoreProvider = memo(
|
|
@@ -215,6 +215,10 @@ function useStoreWithContainer(selector, container2) {
|
|
|
215
215
|
actions: instance.actions
|
|
216
216
|
});
|
|
217
217
|
},
|
|
218
|
+
// Create a fresh instance from a parameterized factory (bypasses cache)
|
|
219
|
+
create(factory, ...args) {
|
|
220
|
+
return container2.create(factory, ...args);
|
|
221
|
+
},
|
|
218
222
|
mixin(mixin, ...args) {
|
|
219
223
|
return mixin(ctx, ...args);
|
|
220
224
|
},
|
|
@@ -392,6 +396,7 @@ export {
|
|
|
392
396
|
p as deepEqual,
|
|
393
397
|
effect,
|
|
394
398
|
n as equality,
|
|
399
|
+
forStores,
|
|
395
400
|
g as getKind,
|
|
396
401
|
a as is,
|
|
397
402
|
j as isAction,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStore.d.ts","sourceRoot":"","sources":["../../src/react/useStore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,cAAc,EAEnB,KAAK,QAAQ,EACb,KAAK,YAAY,EAClB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAuBvE;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EACpD,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EACrB,SAAS,EAAE,cAAc,GACxB,YAAY,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"useStore.d.ts","sourceRoot":"","sources":["../../src/react/useStore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,cAAc,EAEnB,KAAK,QAAQ,EACb,KAAK,YAAY,EAClB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAuBvE;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EACpD,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EACrB,SAAS,EAAE,cAAc,GACxB,YAAY,CAAC,CAAC,CAAC,CAmJjB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EACvC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,GACpB,YAAY,CAAC,CAAC,CAAC,CAAC;AACnB,wBAAgB,QAAQ,CACtB,MAAM,SAAS,SAAS,EACxB,QAAQ,SAAS,WAAW,EAC5B,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC"}
|