@solidjs/signals 0.10.7 → 0.11.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/dist/dev.js +142 -30
- package/dist/node.cjs +438 -365
- package/dist/prod.js +313 -240
- package/dist/types/core/core.d.ts +4 -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/map.d.ts +2 -0
- package/dist/types/store/index.d.ts +2 -0
- package/dist/types/store/storePath.d.ts +30 -0
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -27,6 +27,8 @@ export declare function isEqual<T>(a: T, b: T): boolean;
|
|
|
27
27
|
* Returns the current value stored inside the given compute function without triggering any
|
|
28
28
|
* dependencies. Use `untrack` if you want to also disable owner tracking.
|
|
29
29
|
*/
|
|
30
|
+
export declare let strictRead: string | false;
|
|
31
|
+
export declare function setStrictRead(v: string | false): string | false;
|
|
30
32
|
export declare function untrack<T>(fn: () => T): T;
|
|
31
33
|
export declare function read<T>(el: Signal<T> | Computed<T>): T;
|
|
32
34
|
export declare function setSignal<T>(el: Signal<T> | Computed<T>, v: T | ((prev: T) => T)): T;
|
|
@@ -38,7 +40,7 @@ export declare function runWithOwner<T>(owner: Owner | null, fn: () => T): T;
|
|
|
38
40
|
*/
|
|
39
41
|
export declare function updatePendingSignal(el: Signal<any> | Computed<any>): void;
|
|
40
42
|
export declare function staleValues<T>(fn: () => T, set?: boolean): T;
|
|
41
|
-
export declare function
|
|
43
|
+
export declare function latest<T>(fn: () => T): T;
|
|
42
44
|
export declare function isPending(fn: () => any): boolean;
|
|
43
45
|
export declare function refresh<T>(fn: (() => T) | (T & {
|
|
44
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";
|
package/dist/types/map.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export type Maybe<T> = T | void | null | undefined | false;
|
|
|
10
10
|
export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly Item[]>>, map: (value: Accessor<Item>, index: Accessor<number>) => MappedItem, options?: {
|
|
11
11
|
keyed?: boolean | ((item: Item) => any);
|
|
12
12
|
fallback?: Accessor<any>;
|
|
13
|
+
name?: string;
|
|
13
14
|
}): Accessor<MappedItem[]>;
|
|
14
15
|
/**
|
|
15
16
|
* Reactively repeats a callback function the count provided - underlying helper for the `<Repeat>` control flow
|
|
@@ -19,4 +20,5 @@ export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly
|
|
|
19
20
|
export declare function repeat(count: Accessor<number>, map: (index: number) => any, options?: {
|
|
20
21
|
from?: Accessor<number | undefined>;
|
|
21
22
|
fallback?: Accessor<any>;
|
|
23
|
+
name?: string;
|
|
22
24
|
}): Accessor<any[]>;
|
|
@@ -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 {};
|