@solidjs/signals 2.0.0-beta.15 → 2.0.0-beta.16
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 +700 -385
- package/dist/node.cjs +1865 -1592
- package/dist/prod.js +1496 -1232
- package/dist/types/boundaries.d.ts +3 -3
- package/dist/types/core/async.d.ts +1 -0
- package/dist/types/core/core.d.ts +25 -1
- package/dist/types/core/dev.d.ts +10 -2
- package/dist/types/core/effect.d.ts +1 -3
- package/dist/types/core/graph.d.ts +1 -1
- package/dist/types/core/index.d.ts +2 -2
- package/dist/types/core/invariants.d.ts +49 -0
- package/dist/types/core/scheduler.d.ts +8 -0
- package/dist/types/core/types.d.ts +19 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/signals.d.ts +39 -2
- package/dist/types/store/projection.d.ts +2 -2
- package/dist/types/store/store.d.ts +28 -1
- package/dist/types-cjs/boundaries.d.cts +3 -3
- package/dist/types-cjs/core/async.d.cts +1 -0
- package/dist/types-cjs/core/core.d.cts +25 -1
- package/dist/types-cjs/core/dev.d.cts +10 -2
- package/dist/types-cjs/core/effect.d.cts +1 -3
- package/dist/types-cjs/core/graph.d.cts +1 -1
- package/dist/types-cjs/core/index.d.cts +2 -2
- package/dist/types-cjs/core/invariants.d.cts +49 -0
- package/dist/types-cjs/core/scheduler.d.cts +8 -0
- package/dist/types-cjs/core/types.d.cts +19 -0
- package/dist/types-cjs/index.d.cts +1 -1
- package/dist/types-cjs/signals.d.cts +39 -2
- package/dist/types-cjs/store/projection.d.cts +2 -2
- package/dist/types-cjs/store/store.d.cts +28 -1
- package/package.json +1 -1
- package/dist/types/src/boundaries.d.ts +0 -173
- package/dist/types/src/core/action.d.ts +0 -35
- package/dist/types/src/core/async.d.ts +0 -6
- package/dist/types/src/core/constants.d.ts +0 -51
- package/dist/types/src/core/context.d.ts +0 -36
- package/dist/types/src/core/core.d.ts +0 -174
- package/dist/types/src/core/dev.d.ts +0 -49
- package/dist/types/src/core/effect.d.ts +0 -32
- package/dist/types/src/core/error.d.ts +0 -38
- package/dist/types/src/core/external.d.ts +0 -45
- package/dist/types/src/core/graph.d.ts +0 -5
- package/dist/types/src/core/heap.d.ts +0 -14
- package/dist/types/src/core/index.d.ts +0 -12
- package/dist/types/src/core/lanes.d.ts +0 -54
- package/dist/types/src/core/owner.d.ts +0 -116
- package/dist/types/src/core/scheduler.d.ts +0 -122
- package/dist/types/src/core/types.d.ts +0 -85
- package/dist/types/src/index.d.ts +0 -9
- package/dist/types/src/map.d.ts +0 -53
- package/dist/types/src/signals.d.ts +0 -512
- package/dist/types/src/store/index.d.ts +0 -9
- package/dist/types/src/store/optimistic.d.ts +0 -45
- package/dist/types/src/store/projection.d.ts +0 -66
- package/dist/types/src/store/reconcile.d.ts +0 -23
- package/dist/types/src/store/store.d.ts +0 -125
- package/dist/types/src/store/storePath.d.ts +0 -58
- package/dist/types/src/store/utils.d.ts +0 -114
- package/dist/types-cjs/src/boundaries.d.cts +0 -173
- package/dist/types-cjs/src/core/action.d.cts +0 -35
- package/dist/types-cjs/src/core/async.d.cts +0 -6
- package/dist/types-cjs/src/core/constants.d.cts +0 -51
- package/dist/types-cjs/src/core/context.d.cts +0 -36
- package/dist/types-cjs/src/core/core.d.cts +0 -174
- package/dist/types-cjs/src/core/dev.d.cts +0 -49
- package/dist/types-cjs/src/core/effect.d.cts +0 -32
- package/dist/types-cjs/src/core/error.d.cts +0 -38
- package/dist/types-cjs/src/core/external.d.cts +0 -45
- package/dist/types-cjs/src/core/graph.d.cts +0 -5
- package/dist/types-cjs/src/core/heap.d.cts +0 -14
- package/dist/types-cjs/src/core/index.d.cts +0 -12
- package/dist/types-cjs/src/core/lanes.d.cts +0 -54
- package/dist/types-cjs/src/core/owner.d.cts +0 -116
- package/dist/types-cjs/src/core/scheduler.d.cts +0 -122
- package/dist/types-cjs/src/core/types.d.cts +0 -85
- package/dist/types-cjs/src/index.d.cts +0 -9
- package/dist/types-cjs/src/map.d.cts +0 -53
- package/dist/types-cjs/src/signals.d.cts +0 -512
- package/dist/types-cjs/src/store/index.d.cts +0 -9
- package/dist/types-cjs/src/store/optimistic.d.cts +0 -45
- package/dist/types-cjs/src/store/projection.d.cts +0 -66
- package/dist/types-cjs/src/store/reconcile.d.cts +0 -23
- package/dist/types-cjs/src/store/store.d.cts +0 -125
- package/dist/types-cjs/src/store/storePath.d.cts +0 -58
- package/dist/types-cjs/src/store/utils.d.cts +0 -114
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { type Heap } from "./heap.cjs";
|
|
2
|
-
import { activeLanes, assignOrMergeLane, findLane } from "./lanes.cjs";
|
|
3
|
-
import type { Computed, Signal } from "./types.cjs";
|
|
4
|
-
export { activeLanes, assignOrMergeLane, findLane };
|
|
5
|
-
export { getOrCreateLane, hasActiveOverride, mergeLanes, resolveLane } from "./lanes.cjs";
|
|
6
|
-
export declare const dirtyQueue: Heap;
|
|
7
|
-
export declare const zombieQueue: Heap;
|
|
8
|
-
export declare let clock: number;
|
|
9
|
-
export declare let activeTransition: Transition | null;
|
|
10
|
-
export declare let projectionWriteActive: boolean;
|
|
11
|
-
export declare let _hitUnhandledAsync: boolean;
|
|
12
|
-
export declare function registerTransientStoreNode(node: Signal<any>): void;
|
|
13
|
-
export declare function resetUnhandledAsync(): void;
|
|
14
|
-
/**
|
|
15
|
-
* Toggles the dev-mode "must be inside a `<Loading>` boundary" enforcement
|
|
16
|
-
* window. Only `render()` calls this — wrapping the initial mount so that a
|
|
17
|
-
* top-level uncaught async read surfaces the diagnostic. Not part of the
|
|
18
|
-
* user-facing API.
|
|
19
|
-
*
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
export declare function enforceLoadingBoundary(enabled: boolean): void;
|
|
23
|
-
export declare function shouldReadStashedOptimisticValue(node: Signal<any>): boolean;
|
|
24
|
-
export declare function setProjectionWriteActive(value: boolean): void;
|
|
25
|
-
export declare function setTrackedQueueCallback(value: boolean): void;
|
|
26
|
-
export type QueueCallback = (type: number) => void;
|
|
27
|
-
type QueueStub = {
|
|
28
|
-
_queues: [QueueCallback[], QueueCallback[]];
|
|
29
|
-
_children: QueueStub[];
|
|
30
|
-
};
|
|
31
|
-
type OptimisticNode = Signal<any> | Computed<any>;
|
|
32
|
-
export interface Transition {
|
|
33
|
-
_time: number;
|
|
34
|
-
_asyncReporters: Map<Computed<any>, Set<Computed<any>>>;
|
|
35
|
-
_pendingNodes: Signal<any>[];
|
|
36
|
-
_optimisticNodes: OptimisticNode[];
|
|
37
|
-
_optimisticStores: Set<any>;
|
|
38
|
-
_actions: Array<Generator<any, any, any> | AsyncGenerator<any, any, any>>;
|
|
39
|
-
_queueStash: QueueStub;
|
|
40
|
-
_done: boolean | Transition;
|
|
41
|
-
_gatedSubs: Set<Computed<any>>;
|
|
42
|
-
}
|
|
43
|
-
export declare function schedule(): void;
|
|
44
|
-
export interface IQueue {
|
|
45
|
-
enqueue(type: number, fn: QueueCallback): void;
|
|
46
|
-
run(type: number): boolean | void;
|
|
47
|
-
addChild(child: IQueue): void;
|
|
48
|
-
removeChild(child: IQueue): void;
|
|
49
|
-
created: number;
|
|
50
|
-
notify(node: Computed<any>, mask: number, flags: number, error?: any): boolean;
|
|
51
|
-
stashQueues(stub: QueueStub): void;
|
|
52
|
-
restoreQueues(stub: QueueStub): void;
|
|
53
|
-
_parent: IQueue | null;
|
|
54
|
-
}
|
|
55
|
-
export declare class Queue implements IQueue {
|
|
56
|
-
_parent: IQueue | null;
|
|
57
|
-
_queues: [QueueCallback[], QueueCallback[]];
|
|
58
|
-
_children: IQueue[];
|
|
59
|
-
created: number;
|
|
60
|
-
addChild(child: IQueue): void;
|
|
61
|
-
removeChild(child: IQueue): void;
|
|
62
|
-
notify(node: Computed<any>, mask: number, flags: number, error?: any): boolean;
|
|
63
|
-
run(type: number): void;
|
|
64
|
-
enqueue(type: number, fn: QueueCallback): void;
|
|
65
|
-
stashQueues(stub: QueueStub): void;
|
|
66
|
-
restoreQueues(stub: QueueStub): void;
|
|
67
|
-
}
|
|
68
|
-
export declare class GlobalQueue extends Queue {
|
|
69
|
-
_running: boolean;
|
|
70
|
-
_pendingNode: Signal<any> | null;
|
|
71
|
-
_pendingNodes: Signal<any>[];
|
|
72
|
-
_optimisticNodes: OptimisticNode[];
|
|
73
|
-
_optimisticStores: Set<any>;
|
|
74
|
-
static _update: (el: Computed<unknown>) => void;
|
|
75
|
-
static _dispose: (el: Computed<unknown>, self: boolean, zombie: boolean) => void;
|
|
76
|
-
static _runEffect: (el: Computed<unknown>) => void;
|
|
77
|
-
static _clearOptimisticStore: ((store: any) => void) | null;
|
|
78
|
-
flush(): void;
|
|
79
|
-
notify(node: Computed<any>, mask: number, flags: number, error?: any): boolean;
|
|
80
|
-
initTransition(transition?: Transition | null): void;
|
|
81
|
-
}
|
|
82
|
-
export declare function queuePendingNode(node: Signal<any>): void;
|
|
83
|
-
export declare function insertSubs(node: Signal<any> | Computed<any>, optimistic?: boolean): void;
|
|
84
|
-
export declare function finalizePureQueue(completingTransition?: Transition | null, incomplete?: boolean): void;
|
|
85
|
-
export declare function trackOptimisticStore(store: any): void;
|
|
86
|
-
export declare const globalQueue: GlobalQueue;
|
|
87
|
-
/**
|
|
88
|
-
* Synchronously processes the pending reactive queue, or runs `fn` in a synchronous
|
|
89
|
-
* flush scope before draining the queue.
|
|
90
|
-
*
|
|
91
|
-
* Reactive updates are normally batched onto the microtask queue, so multiple
|
|
92
|
-
* writes in a row collapse into a single update pass. Call `flush()` when you
|
|
93
|
-
* need to *observe* the result of those writes synchronously — most commonly
|
|
94
|
-
* in tests, but also at the boundary of imperative integration code. Pass a
|
|
95
|
-
* callback when the writes themselves should bypass microtask scheduling and
|
|
96
|
-
* drain synchronously when the callback returns.
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* ```ts
|
|
100
|
-
* const [count, setCount] = createSignal(0);
|
|
101
|
-
* const doubled = createMemo(() => count() * 2);
|
|
102
|
-
*
|
|
103
|
-
* setCount(5);
|
|
104
|
-
* flush();
|
|
105
|
-
* expect(doubled()).toBe(10);
|
|
106
|
-
*
|
|
107
|
-
* flush(() => setCount(6));
|
|
108
|
-
* expect(doubled()).toBe(12);
|
|
109
|
-
*
|
|
110
|
-
* // Nested flushes drain at each level:
|
|
111
|
-
* flush(() => {
|
|
112
|
-
* setCount(7);
|
|
113
|
-
* flush(() => setCount(8)); // inner drain — effects fire here
|
|
114
|
-
* // outer continues with up-to-date state
|
|
115
|
-
* });
|
|
116
|
-
* ```
|
|
117
|
-
*/
|
|
118
|
-
export declare function flush(): void;
|
|
119
|
-
export declare function flush<T>(fn: () => T): T;
|
|
120
|
-
export declare function currentTransition(transition: Transition): Transition;
|
|
121
|
-
export declare function setActiveTransition(transition: Transition | null): void;
|
|
122
|
-
export declare function runInTransition<T>(transition: Transition, fn: () => T): T;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import type { NOT_PENDING } from "./constants.cjs";
|
|
2
|
-
import type { OptimisticLane } from "./lanes.cjs";
|
|
3
|
-
import type { IQueue, Transition } from "./scheduler.cjs";
|
|
4
|
-
export interface Disposable {
|
|
5
|
-
(): void;
|
|
6
|
-
}
|
|
7
|
-
export interface Link {
|
|
8
|
-
_dep: Signal<unknown> | Computed<unknown>;
|
|
9
|
-
_sub: Computed<unknown>;
|
|
10
|
-
_nextDep: Link | null;
|
|
11
|
-
_prevSub: Link | null;
|
|
12
|
-
_nextSub: Link | null;
|
|
13
|
-
}
|
|
14
|
-
export interface NodeOptions<T> {
|
|
15
|
-
id?: string;
|
|
16
|
-
name?: string;
|
|
17
|
-
transparent?: boolean;
|
|
18
|
-
equals?: ((prev: T, next: T) => boolean) | false;
|
|
19
|
-
ownedWrite?: boolean;
|
|
20
|
-
/** Exclude this signal from snapshot capture (internal — not part of public API) */
|
|
21
|
-
_noSnapshot?: boolean;
|
|
22
|
-
unobserved?: () => void;
|
|
23
|
-
lazy?: boolean;
|
|
24
|
-
sync?: boolean;
|
|
25
|
-
}
|
|
26
|
-
export interface RawSignal<T> {
|
|
27
|
-
_subs: Link | null;
|
|
28
|
-
_subsTail: Link | null;
|
|
29
|
-
_value: T;
|
|
30
|
-
_snapshotValue?: any;
|
|
31
|
-
_name?: string;
|
|
32
|
-
_equals: false | ((a: T, b: T) => boolean);
|
|
33
|
-
_config: number;
|
|
34
|
-
_unobserved?: () => void;
|
|
35
|
-
_time: number;
|
|
36
|
-
_transition: Transition | null;
|
|
37
|
-
_pendingValue: T | typeof NOT_PENDING;
|
|
38
|
-
_overrideValue?: T | typeof NOT_PENDING;
|
|
39
|
-
_optimisticLane?: OptimisticLane;
|
|
40
|
-
_pendingSignal?: Signal<boolean>;
|
|
41
|
-
_latestValueComputed?: Computed<T>;
|
|
42
|
-
_parentSource?: Signal<any> | Computed<any>;
|
|
43
|
-
}
|
|
44
|
-
export interface FirewallSignal<T> extends RawSignal<T> {
|
|
45
|
-
_firewall: Computed<any>;
|
|
46
|
-
_nextChild: FirewallSignal<unknown> | null;
|
|
47
|
-
}
|
|
48
|
-
export type Signal<T> = RawSignal<T> | FirewallSignal<T>;
|
|
49
|
-
export interface Owner {
|
|
50
|
-
id?: string;
|
|
51
|
-
_config: number;
|
|
52
|
-
_snapshotScope?: boolean;
|
|
53
|
-
_disposal: Disposable | Disposable[] | null;
|
|
54
|
-
_parent: Owner | null;
|
|
55
|
-
_context: Record<symbol | string, unknown>;
|
|
56
|
-
_childCount: number;
|
|
57
|
-
_queue: IQueue;
|
|
58
|
-
_firstChild: Owner | null;
|
|
59
|
-
_nextSibling: Owner | null;
|
|
60
|
-
_prevSibling: Owner | null;
|
|
61
|
-
_pendingDisposal: Disposable | Disposable[] | null;
|
|
62
|
-
_pendingFirstChild: Owner | null;
|
|
63
|
-
}
|
|
64
|
-
export interface Computed<T> extends RawSignal<T>, Owner {
|
|
65
|
-
_deps: Link | null;
|
|
66
|
-
_depsTail: Link | null;
|
|
67
|
-
_flags: number;
|
|
68
|
-
_blocked?: boolean;
|
|
69
|
-
_pendingSource?: Computed<any>;
|
|
70
|
-
_pendingSources?: Set<Computed<any>>;
|
|
71
|
-
_error?: unknown;
|
|
72
|
-
_statusFlags: number;
|
|
73
|
-
_height: number;
|
|
74
|
-
_nextHeap: Computed<any> | undefined;
|
|
75
|
-
_prevHeap: Computed<any>;
|
|
76
|
-
_fn: (prev?: T) => T;
|
|
77
|
-
_inFlight: PromiseLike<T> | AsyncIterable<T> | null;
|
|
78
|
-
_child: FirewallSignal<any> | null;
|
|
79
|
-
_notifyStatus?: (status?: number, error?: any) => void;
|
|
80
|
-
}
|
|
81
|
-
export interface Root extends Owner {
|
|
82
|
-
_root: true;
|
|
83
|
-
_parentComputed: Computed<any> | null;
|
|
84
|
-
dispose(self?: boolean): void;
|
|
85
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { $REFRESH, ContextNotFoundError, NoOwnerError, NotReadyError, action, createContext, createOwner, createRoot, runWithOwner, flush, getNextChildId, peekNextChildId, getContext, setContext, getOwner, isDisposed, getObserver, isEqual, untrack, isPending, latest, isRefreshing, refresh, SUPPORTS_PROXY, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots, enforceLoadingBoundary, enableExternalSource } from "./core/index.cjs";
|
|
2
|
-
import { type Dev } from "./core/index.cjs";
|
|
3
|
-
export declare const DEV: Dev | undefined;
|
|
4
|
-
export type { Owner, Context, ContextRecord, IQueue, ExternalSourceFactory, ExternalSource, ExternalSourceConfig, Refreshable, Dev, DevHooks, DiagnosticCapture, DiagnosticCode, DiagnosticEvent, DiagnosticKind, Diagnostics, DiagnosticSeverity } from "./core/index.cjs";
|
|
5
|
-
export { createSignal, createMemo, createEffect, createRenderEffect, createTrackedEffect, createReaction, createOptimistic, resolve, onSettled, onCleanup } from "./signals.cjs";
|
|
6
|
-
export type { Accessor, SourceAccessor, Setter, Signal, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, SignalOptions, MemoOptions, NoInfer } from "./signals.cjs";
|
|
7
|
-
export { mapArray, repeat, type Maybe } from "./map.cjs";
|
|
8
|
-
export * from "./store/index.cjs";
|
|
9
|
-
export { createLoadingBoundary, createErrorBoundary, createRevealOrder, flatten, type RevealOrder } from "./boundaries.cjs";
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { type Accessor } from "./signals.cjs";
|
|
2
|
-
export type Maybe<T> = T | void | null | undefined | false;
|
|
3
|
-
/**
|
|
4
|
-
* Reactively maps an array, reusing the previously-mapped value for unchanged
|
|
5
|
-
* items. The callback receives `(value, index)` as accessors so individual
|
|
6
|
-
* items and indexes can be subscribed to without re-running the mapper.
|
|
7
|
-
*
|
|
8
|
-
* This is the underlying helper that powers `<For>`. App code should use
|
|
9
|
-
* `<For>` directly; reach for `mapArray` when implementing custom list
|
|
10
|
-
* components.
|
|
11
|
-
*
|
|
12
|
-
* - `options.keyed` — `true` (default for primitives) compares by identity;
|
|
13
|
-
* `false` falls back to index-only mapping; pass a function `(item) => key`
|
|
14
|
-
* for stable identity by extracted key.
|
|
15
|
-
* - `options.fallback` — accessor returning a value to show when the input is
|
|
16
|
-
* empty.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```ts
|
|
20
|
-
* const view = mapArray(
|
|
21
|
-
* items,
|
|
22
|
-
* (item, index) => `${index()}: ${item().label}`,
|
|
23
|
-
* { fallback: () => "no items" }
|
|
24
|
-
* );
|
|
25
|
-
* ```
|
|
26
|
-
*
|
|
27
|
-
* @description https://docs.solidjs.com/reference/reactive-utilities/map-array
|
|
28
|
-
*/
|
|
29
|
-
export declare function mapArray<Item, MappedItem>(list: Accessor<Maybe<readonly Item[]>>, map: (value: Accessor<Item>, index: Accessor<number>) => MappedItem, options?: {
|
|
30
|
-
keyed?: boolean | ((item: Item) => any);
|
|
31
|
-
fallback?: Accessor<any>;
|
|
32
|
-
name?: string;
|
|
33
|
-
}): Accessor<MappedItem[]>;
|
|
34
|
-
/**
|
|
35
|
-
* Reactively renders a callback `count` times, reusing previously-rendered
|
|
36
|
-
* entries when only the count changes. Underlying helper for `<Repeat>`.
|
|
37
|
-
*
|
|
38
|
-
* - `options.from` — start index (default `0`); useful for offset/windowed
|
|
39
|
-
* rendering.
|
|
40
|
-
* - `options.fallback` — accessor returning a value to show when count is `0`.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```ts
|
|
44
|
-
* const view = repeat(count, i => `Item ${i}`, { fallback: () => "empty" });
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* @description https://docs.solidjs.com/reference/reactive-utilities/repeat
|
|
48
|
-
*/
|
|
49
|
-
export declare function repeat(count: Accessor<number>, map: (index: number) => any, options?: {
|
|
50
|
-
from?: Accessor<number | undefined>;
|
|
51
|
-
fallback?: Accessor<any>;
|
|
52
|
-
name?: string;
|
|
53
|
-
}): Accessor<any[]>;
|