@solidjs/signals 0.10.4 → 0.10.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/dist/dev.js +131 -18
- package/dist/node.cjs +903 -790
- package/dist/prod.js +604 -490
- package/dist/types/core/constants.d.ts +3 -0
- package/dist/types/core/core.d.ts +6 -0
- package/dist/types/core/index.d.ts +2 -2
- package/dist/types/core/owner.d.ts +1 -0
- package/dist/types/core/types.d.ts +3 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/store/store.d.ts +6 -5
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ export declare const REACTIVE_IN_HEAP_HEIGHT: number;
|
|
|
7
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
|
+
export declare const REACTIVE_SNAPSHOT_STALE: number;
|
|
10
11
|
export declare const STATUS_NONE = 0;
|
|
11
12
|
export declare const STATUS_PENDING: number;
|
|
12
13
|
export declare const STATUS_ERROR: number;
|
|
@@ -16,6 +17,8 @@ export declare const EFFECT_RENDER = 1;
|
|
|
16
17
|
export declare const EFFECT_USER = 2;
|
|
17
18
|
export declare const EFFECT_TRACKED = 3;
|
|
18
19
|
export declare const NOT_PENDING: {};
|
|
20
|
+
export declare const NO_SNAPSHOT: {};
|
|
21
|
+
export declare const STORE_SNAPSHOT_PROPS = "sp";
|
|
19
22
|
export declare const SUPPORTS_PROXY: boolean;
|
|
20
23
|
export declare const defaultContext: {};
|
|
21
24
|
export declare const $REFRESH: unique symbol;
|
|
@@ -9,6 +9,12 @@ export declare let foundPending: boolean;
|
|
|
9
9
|
export declare let pendingReadActive: boolean;
|
|
10
10
|
export declare let context: Owner | null;
|
|
11
11
|
export declare let currentOptimisticLane: OptimisticLane | null;
|
|
12
|
+
export declare let snapshotCaptureActive: boolean;
|
|
13
|
+
export declare let snapshotSources: Set<any> | null;
|
|
14
|
+
export declare function setSnapshotCapture(active: boolean): void;
|
|
15
|
+
export declare function markSnapshotScope(owner: Owner): void;
|
|
16
|
+
export declare function releaseSnapshotScope(owner: Owner): void;
|
|
17
|
+
export declare function clearSnapshots(): void;
|
|
12
18
|
export declare function recompute(el: Computed<any>, create?: boolean): void;
|
|
13
19
|
export declare function computed<T>(fn: (prev?: T) => T | PromiseLike<T> | AsyncIterable<T>): Computed<T>;
|
|
14
20
|
export declare function computed<T>(fn: (prev: T) => T | PromiseLike<T> | AsyncIterable<T>, initialValue?: T, options?: NodeOptions<T>): Computed<T>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { ContextNotFoundError, NoOwnerError, NotReadyError } from "./error.js";
|
|
2
|
-
export { isEqual, untrack, runWithOwner, computed, signal, read, setSignal, optimisticSignal, optimisticComputed, isPending, pending, refresh, isRefreshing, staleValues } from "./core.js";
|
|
3
|
-
export { createOwner, createRoot, dispose, getNextChildId, getObserver, getOwner, onCleanup, peekNextChildId } from "./owner.js";
|
|
2
|
+
export { isEqual, untrack, runWithOwner, computed, signal, read, setSignal, optimisticSignal, optimisticComputed, isPending, pending, refresh, isRefreshing, staleValues, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots } from "./core.js";
|
|
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";
|
|
6
6
|
export type { Computed, Disposable, FirewallSignal, Link, Owner, Root, Signal, NodeOptions } from "./types.js";
|
|
@@ -7,6 +7,7 @@ export declare function peekNextChildId(owner: Owner): string;
|
|
|
7
7
|
export declare function getObserver(): Owner | null;
|
|
8
8
|
export declare function getOwner(): Owner | null;
|
|
9
9
|
export declare function onCleanup(fn: Disposable): Disposable;
|
|
10
|
+
export declare function isDisposed(node: Owner): boolean;
|
|
10
11
|
export declare function createOwner(options?: {
|
|
11
12
|
id?: string;
|
|
12
13
|
transparent?: boolean;
|
|
@@ -24,6 +24,7 @@ export interface RawSignal<T> {
|
|
|
24
24
|
_subs: Link | null;
|
|
25
25
|
_subsTail: Link | null;
|
|
26
26
|
_value: T;
|
|
27
|
+
_snapshotValue?: any;
|
|
27
28
|
_name?: string;
|
|
28
29
|
_equals: false | ((a: T, b: T) => boolean);
|
|
29
30
|
_pureWrite?: boolean;
|
|
@@ -45,6 +46,7 @@ export type Signal<T> = RawSignal<T> | FirewallSignal<T>;
|
|
|
45
46
|
export interface Owner {
|
|
46
47
|
id?: string;
|
|
47
48
|
_transparent?: boolean;
|
|
49
|
+
_snapshotScope?: boolean;
|
|
48
50
|
_disposal: Disposable | Disposable[] | null;
|
|
49
51
|
_parent: Owner | null;
|
|
50
52
|
_context: Record<symbol | string, unknown>;
|
|
@@ -59,6 +61,7 @@ export interface Computed<T> extends RawSignal<T>, Owner {
|
|
|
59
61
|
_deps: Link | null;
|
|
60
62
|
_depsTail: Link | null;
|
|
61
63
|
_flags: number;
|
|
64
|
+
_inSnapshotScope?: boolean;
|
|
62
65
|
_error?: unknown;
|
|
63
66
|
_statusFlags: number;
|
|
64
67
|
_height: number;
|
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, getObserver, isEqual, untrack, isPending, pending, isRefreshing, refresh, SUPPORTS_PROXY } from "./core/index.js";
|
|
1
|
+
export { ContextNotFoundError, NoOwnerError, NotReadyError, action, createContext, createOwner, createRoot, runWithOwner, flush, getNextChildId, peekNextChildId, getContext, setContext, getOwner, onCleanup, isDisposed, getObserver, isEqual, untrack, isPending, pending, isRefreshing, refresh, SUPPORTS_PROXY, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots } 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";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { $REFRESH, type Computed, type Signal } from "../core/index.js";
|
|
1
|
+
import { $REFRESH, STORE_SNAPSHOT_PROPS, type Computed, type Signal } from "../core/index.js";
|
|
2
2
|
export type Store<T> = Readonly<T>;
|
|
3
3
|
export type StoreSetter<T> = (fn: (state: T) => T | void) => void;
|
|
4
4
|
/** Base options for store primitives. */
|
|
5
|
-
export
|
|
5
|
+
export interface StoreOptions {
|
|
6
6
|
/** Debug name (dev mode only) */
|
|
7
7
|
name?: string;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
/** Options for derived/projected stores created with `createStore(fn)`, `createProjection`, or `createOptimisticStore(fn)`. */
|
|
10
|
-
export
|
|
10
|
+
export interface ProjectionOptions extends StoreOptions {
|
|
11
11
|
/** Key property name or function for reconciliation identity */
|
|
12
12
|
key?: string | ((item: NonNullable<any>) => any);
|
|
13
13
|
/** When true, reconciles all properties (not just tracked ones) */
|
|
14
14
|
all?: boolean;
|
|
15
|
-
}
|
|
15
|
+
}
|
|
16
16
|
export type NoFn<T> = T extends Function ? never : T;
|
|
17
17
|
type DataNode = Signal<any>;
|
|
18
18
|
type DataNodes = Record<PropertyKey, DataNode>;
|
|
@@ -29,6 +29,7 @@ export type StoreNode = {
|
|
|
29
29
|
[STORE_LOOKUP]?: WeakMap<any, any>;
|
|
30
30
|
[STORE_FIREWALL]?: Computed<any>;
|
|
31
31
|
[STORE_OPTIMISTIC]?: boolean;
|
|
32
|
+
[STORE_SNAPSHOT_PROPS]?: Record<PropertyKey, any>;
|
|
32
33
|
};
|
|
33
34
|
export declare namespace SolidStore {
|
|
34
35
|
interface Unwrappable {
|