@solidjs/signals 0.10.8 → 0.11.1
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/dist/dev.js +98 -27
- package/dist/node.cjs +630 -562
- package/dist/prod.js +257 -189
- package/dist/types/core/constants.d.ts +1 -0
- package/dist/types/core/core.d.ts +2 -2
- package/dist/types/core/index.d.ts +1 -1
- package/dist/types/core/types.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/store/index.d.ts +2 -0
- package/dist/types/store/storePath.d.ts +30 -0
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ export declare const REACTIVE_ZOMBIE: number;
|
|
|
8
8
|
export declare const REACTIVE_DISPOSED: number;
|
|
9
9
|
export declare const REACTIVE_OPTIMISTIC_DIRTY: number;
|
|
10
10
|
export declare const REACTIVE_SNAPSHOT_STALE: number;
|
|
11
|
+
export declare const REACTIVE_LAZY: number;
|
|
11
12
|
export declare const STATUS_NONE = 0;
|
|
12
13
|
export declare const STATUS_PENDING: number;
|
|
13
14
|
export declare const STATUS_ERROR: number;
|
|
@@ -6,7 +6,7 @@ export declare let stale: boolean;
|
|
|
6
6
|
export declare let refreshing: boolean;
|
|
7
7
|
export declare let pendingCheckActive: boolean;
|
|
8
8
|
export declare let foundPending: boolean;
|
|
9
|
-
export declare let
|
|
9
|
+
export declare let latestReadActive: boolean;
|
|
10
10
|
export declare let context: Owner | null;
|
|
11
11
|
export declare let currentOptimisticLane: OptimisticLane | null;
|
|
12
12
|
export declare let snapshotCaptureActive: boolean;
|
|
@@ -40,7 +40,7 @@ export declare function runWithOwner<T>(owner: Owner | null, fn: () => T): T;
|
|
|
40
40
|
*/
|
|
41
41
|
export declare function updatePendingSignal(el: Signal<any> | Computed<any>): void;
|
|
42
42
|
export declare function staleValues<T>(fn: () => T, set?: boolean): T;
|
|
43
|
-
export declare function
|
|
43
|
+
export declare function latest<T>(fn: () => T): T;
|
|
44
44
|
export declare function isPending(fn: () => any): boolean;
|
|
45
45
|
export declare function refresh<T>(fn: (() => T) | (T & {
|
|
46
46
|
[$REFRESH]: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ContextNotFoundError, NoOwnerError, NotReadyError } from "./error.js";
|
|
2
|
-
export { isEqual, untrack, runWithOwner, computed, signal, read, setSignal, optimisticSignal, optimisticComputed, isPending,
|
|
2
|
+
export { isEqual, untrack, runWithOwner, computed, signal, read, setSignal, optimisticSignal, optimisticComputed, isPending, latest, refresh, isRefreshing, staleValues, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots, setStrictRead } from "./core.js";
|
|
3
3
|
export { createOwner, createRoot, dispose, getNextChildId, getObserver, getOwner, isDisposed, onCleanup, peekNextChildId } from "./owner.js";
|
|
4
4
|
export { createContext, getContext, setContext, type Context, type ContextRecord } from "./context.js";
|
|
5
5
|
export { handleAsync } from "./async.js";
|
|
@@ -35,7 +35,7 @@ export interface RawSignal<T> {
|
|
|
35
35
|
_optimistic?: boolean;
|
|
36
36
|
_optimisticLane?: OptimisticLane;
|
|
37
37
|
_pendingSignal?: Signal<boolean>;
|
|
38
|
-
|
|
38
|
+
_latestValueComputed?: Computed<T>;
|
|
39
39
|
_parentSource?: Signal<any> | Computed<any>;
|
|
40
40
|
}
|
|
41
41
|
export interface FirewallSignal<T> extends RawSignal<T> {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ContextNotFoundError, NoOwnerError, NotReadyError, action, createContext, createOwner, createRoot, runWithOwner, flush, getNextChildId, peekNextChildId, getContext, setContext, getOwner, onCleanup, isDisposed, getObserver, isEqual, untrack, isPending,
|
|
1
|
+
export { ContextNotFoundError, NoOwnerError, NotReadyError, action, createContext, createOwner, createRoot, runWithOwner, flush, getNextChildId, peekNextChildId, getContext, setContext, getOwner, onCleanup, isDisposed, getObserver, isEqual, untrack, isPending, latest, isRefreshing, refresh, SUPPORTS_PROXY, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots, setStrictRead } from "./core/index.js";
|
|
2
2
|
export type { Owner, Context, ContextRecord, IQueue } from "./core/index.js";
|
|
3
3
|
export * from "./signals.js";
|
|
4
4
|
export { mapArray, repeat, type Maybe } from "./map.js";
|
|
@@ -4,4 +4,6 @@ export { isWrappable, createStore, deep, $TRACK, $PROXY, $TARGET } from "./store
|
|
|
4
4
|
export { createProjection } from "./projection.js";
|
|
5
5
|
export { createOptimisticStore } from "./optimistic.js";
|
|
6
6
|
export { reconcile } from "./reconcile.js";
|
|
7
|
+
export { storePath } from "./storePath.js";
|
|
8
|
+
export type { PathSetter, Part, StorePathRange, ArrayFilterFn, CustomPartial } from "./storePath.js";
|
|
7
9
|
export { snapshot, merge, omit } from "./utils.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type NotWrappable } from "./store.js";
|
|
2
|
+
type W<T> = Exclude<T, NotWrappable>;
|
|
3
|
+
type KeyOf<T> = number extends keyof T ? 0 extends 1 & T ? keyof T : [T] extends [never] ? never : [T] extends [readonly unknown[]] ? number : keyof T : keyof T;
|
|
4
|
+
export type CustomPartial<T> = T extends readonly unknown[] ? "0" extends keyof T ? {
|
|
5
|
+
[K in Extract<keyof T, `${number}`>]?: T[K];
|
|
6
|
+
} : {
|
|
7
|
+
[x: number]: T[number];
|
|
8
|
+
} : Partial<T>;
|
|
9
|
+
export type StorePathRange = {
|
|
10
|
+
from?: number;
|
|
11
|
+
to?: number;
|
|
12
|
+
by?: number;
|
|
13
|
+
};
|
|
14
|
+
export type ArrayFilterFn<T> = (item: T, index: number) => boolean;
|
|
15
|
+
export type PathSetter<T> = T | CustomPartial<T> | ((prev: T) => T | CustomPartial<T>) | typeof DELETE;
|
|
16
|
+
export type Part<T, K extends KeyOf<T> = KeyOf<T>> = K | ([K] extends [never] ? never : readonly K[]) | ([T] extends [readonly unknown[]] ? ArrayFilterFn<T[number]> | StorePathRange : never);
|
|
17
|
+
declare const DELETE: unique symbol;
|
|
18
|
+
export interface storePath {
|
|
19
|
+
DELETE: typeof DELETE;
|
|
20
|
+
<T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>, K6 extends KeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>, K7 extends KeyOf<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>, k7: Part<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, K7>, setter: PathSetter<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>): (state: T) => void;
|
|
21
|
+
<T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>, K6 extends KeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>, setter: PathSetter<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>): (state: T) => void;
|
|
22
|
+
<T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, setter: PathSetter<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>): (state: T) => void;
|
|
23
|
+
<T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, setter: PathSetter<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>): (state: T) => void;
|
|
24
|
+
<T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, setter: PathSetter<W<W<W<T>[K1]>[K2]>[K3]>): (state: T) => void;
|
|
25
|
+
<T, K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, setter: PathSetter<W<W<T>[K1]>[K2]>): (state: T) => void;
|
|
26
|
+
<T, K1 extends KeyOf<W<T>>>(k1: Part<W<T>, K1>, setter: PathSetter<W<T>[K1]>): (state: T) => void;
|
|
27
|
+
<T>(setter: PathSetter<T>): (state: T) => void;
|
|
28
|
+
}
|
|
29
|
+
export declare const storePath: storePath;
|
|
30
|
+
export {};
|