@solidjs/signals 2.0.0-rc.2 → 2.0.0-rc.20
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-shared.js +6505 -0
- package/dist/dev.attribution.js +3484 -0
- package/dist/dev.js +10227 -9508
- package/dist/observe/affects-marks.js +86 -0
- package/dist/observe/affects.js +112 -0
- package/dist/observe/attribution.js +7 -0
- package/dist/observe/boundaries.js +696 -0
- package/dist/observe/core/action.js +182 -0
- package/dist/observe/core/async.js +824 -0
- package/dist/observe/core/attribution-costs.js +66 -0
- package/dist/observe/core/attribution-feedback.js +280 -0
- package/dist/observe/core/attribution-hooks.js +83 -0
- package/dist/observe/core/attribution-queries.js +43 -0
- package/dist/observe/core/attribution.js +3079 -0
- package/dist/observe/core/constants.js +269 -0
- package/dist/observe/core/context.js +63 -0
- package/dist/observe/core/copies.js +10 -0
- package/dist/observe/core/core.js +1707 -0
- package/dist/observe/core/dev.js +394 -0
- package/dist/observe/core/effect.js +193 -0
- package/dist/observe/core/error-hooks.js +71 -0
- package/dist/observe/core/error.js +82 -0
- package/dist/observe/core/external.js +97 -0
- package/dist/observe/core/graph.js +162 -0
- package/dist/observe/core/heap.js +124 -0
- package/dist/observe/core/identities.js +62 -0
- package/dist/observe/core/invariants.js +12 -0
- package/dist/observe/core/lanes.js +972 -0
- package/dist/observe/core/owner.js +371 -0
- package/dist/observe/core/scheduler.js +1157 -0
- package/dist/observe/core/truth.js +47 -0
- package/dist/observe/core/verdict.js +470 -0
- package/dist/observe/deferred.js +186 -0
- package/dist/observe/flatten.js +79 -0
- package/dist/observe/from.js +248 -0
- package/dist/observe/index.js +71 -0
- package/dist/observe/map.js +593 -0
- package/dist/observe/reveal.js +212 -0
- package/dist/observe/signals.js +717 -0
- package/dist/observe/store/affects.js +142 -0
- package/dist/observe/store/edges.js +39 -0
- package/dist/observe/store/hooks.js +16 -0
- package/dist/observe/store/index.js +47 -0
- package/dist/observe/store/optimistic.js +713 -0
- package/dist/observe/store/projection.js +345 -0
- package/dist/observe/store/reconcile.js +281 -0
- package/dist/observe/store/store.js +2127 -0
- package/dist/observe/store/storePath.js +103 -0
- package/dist/observe/store/target.js +46 -0
- package/dist/observe/store/types.js +83 -0
- package/dist/observe/store/utils.js +1063 -0
- package/dist/prod/affects-marks.js +86 -0
- package/dist/prod/affects.js +98 -112
- package/dist/prod/attribution.js +45 -0
- package/dist/prod/boundaries.js +578 -468
- package/dist/prod/core/action.js +92 -59
- package/dist/prod/core/async.js +522 -336
- package/dist/prod/core/attribution-hooks.js +3 -0
- package/dist/prod/core/constants.js +168 -44
- package/dist/prod/core/context.js +12 -16
- package/dist/prod/core/copies.js +10 -0
- package/dist/prod/core/core.js +1345 -627
- package/dist/prod/core/dev.js +123 -1
- package/dist/prod/core/effect.js +113 -80
- package/dist/prod/core/error-hooks.js +71 -0
- package/dist/prod/core/error.js +18 -4
- package/dist/prod/core/external.js +6 -7
- package/dist/prod/core/graph.js +119 -72
- package/dist/prod/core/heap.js +85 -109
- package/dist/prod/core/identities.js +62 -0
- package/dist/prod/core/invariants.js +1 -32
- package/dist/prod/core/lanes.js +931 -132
- package/dist/prod/core/owner.js +192 -129
- package/dist/prod/core/scheduler.js +948 -642
- package/dist/prod/core/truth.js +47 -0
- package/dist/prod/core/verdict.js +409 -420
- package/dist/prod/deferred.js +184 -0
- package/dist/prod/flatten.js +77 -0
- package/dist/prod/from.js +248 -0
- package/dist/prod/index.js +40 -16
- package/dist/prod/map.js +481 -211
- package/dist/prod/reveal.js +212 -0
- package/dist/prod/signals.js +401 -84
- package/dist/prod/store/affects.js +142 -0
- package/dist/prod/store/edges.js +39 -0
- package/dist/prod/store/hooks.js +16 -0
- package/dist/prod/store/index.js +27 -18
- package/dist/prod/store/optimistic.js +707 -0
- package/dist/prod/store/projection.js +331 -0
- package/dist/prod/store/reconcile.js +281 -0
- package/dist/prod/store/store.js +1952 -267
- package/dist/prod/store/storePath.js +1 -1
- package/dist/prod/store/target.js +43 -0
- package/dist/prod/store/types.js +83 -0
- package/dist/prod/store/utils.js +997 -138
- package/dist/types/affects-marks.d.ts +14 -0
- package/dist/types/affects.d.ts +12 -30
- package/dist/types/attribution.d.ts +19 -0
- package/dist/types/attribution.prod.d.ts +22 -0
- package/dist/types/boundaries.d.ts +99 -124
- package/dist/types/carved.d.ts +1 -0
- package/dist/types/core/action.d.ts +23 -9
- package/dist/types/core/async.d.ts +34 -6
- package/dist/types/core/attribution-costs.d.ts +35 -0
- package/dist/types/core/attribution-feedback.d.ts +133 -0
- package/dist/types/core/attribution-hooks.d.ts +307 -8
- package/dist/types/core/attribution-queries.d.ts +24 -0
- package/dist/types/core/attribution.d.ts +802 -72
- package/dist/types/core/constants.d.ts +195 -38
- package/dist/types/core/copies.d.ts +54 -0
- package/dist/types/core/core.d.ts +295 -65
- package/dist/types/core/dev.d.ts +509 -22
- package/dist/types/core/effect.d.ts +1 -1
- package/dist/types/core/error-hooks.d.ts +71 -0
- package/dist/types/core/error.d.ts +18 -1
- package/dist/types/core/graph.d.ts +40 -1
- package/dist/types/core/heap.d.ts +5 -5
- package/dist/types/core/identities.d.ts +17 -0
- package/dist/types/core/index.d.ts +11 -7
- package/dist/types/core/invariants.d.ts +1 -26
- package/dist/types/core/lanes.d.ts +74 -43
- package/dist/types/core/owner.d.ts +27 -9
- package/dist/types/core/scheduler.d.ts +353 -102
- package/dist/types/core/truth.d.ts +18 -0
- package/dist/types/core/types.d.ts +97 -71
- package/dist/types/core/verdict.d.ts +35 -0
- package/dist/types/deferred.d.ts +28 -0
- package/dist/types/flatten.d.ts +8 -0
- package/dist/types/from.d.ts +47 -0
- package/dist/types/index.d.ts +33 -7
- package/dist/types/map.d.ts +4 -2
- package/dist/types/reveal.d.ts +19 -0
- package/dist/types/signals.d.ts +196 -45
- package/dist/types/store/affects.d.ts +12 -0
- package/dist/types/store/edges.d.ts +9 -0
- package/dist/types/store/hooks.d.ts +62 -0
- package/dist/types/store/index.d.ts +42 -15
- package/dist/types/store/optimistic.d.ts +24 -45
- package/dist/types/store/projection.d.ts +17 -68
- package/dist/types/store/reconcile.d.ts +3 -46
- package/dist/types/store/store.d.ts +133 -136
- package/dist/types/store/storePath.d.ts +1 -1
- package/dist/types/store/target.d.ts +166 -0
- package/dist/types/store/types.d.ts +105 -0
- package/dist/types/store/utils.d.ts +188 -0
- package/package.json +31 -26
- package/dist/node.cjs +0 -8745
- package/dist/prod/core/optimistic.js +0 -265
- package/dist/prod/store/next/optimistic.js +0 -385
- package/dist/prod/store/next/projection.js +0 -172
- package/dist/prod/store/next/reconcile.js +0 -331
- package/dist/prod/store/next/store.js +0 -1499
- package/dist/prod/store/next/target.js +0 -20
- package/dist/types/core/optimistic.d.ts +0 -6
- package/dist/types/store/next/optimistic.d.ts +0 -20
- package/dist/types/store/next/projection.d.ts +0 -8
- package/dist/types/store/next/reconcile.d.ts +0 -3
- package/dist/types/store/next/store.d.ts +0 -77
- package/dist/types/store/next/target.d.ts +0 -117
- package/dist/types-cjs/affects.d.cts +0 -47
- package/dist/types-cjs/boundaries.d.cts +0 -175
- package/dist/types-cjs/core/action.d.cts +0 -64
- package/dist/types-cjs/core/async.d.cts +0 -21
- package/dist/types-cjs/core/attribution-hooks.d.cts +0 -52
- package/dist/types-cjs/core/attribution.d.cts +0 -186
- package/dist/types-cjs/core/constants.d.cts +0 -97
- package/dist/types-cjs/core/context.d.cts +0 -36
- package/dist/types-cjs/core/core.d.cts +0 -163
- package/dist/types-cjs/core/dev.d.cts +0 -81
- package/dist/types-cjs/core/effect.d.cts +0 -30
- package/dist/types-cjs/core/error.d.cts +0 -47
- package/dist/types-cjs/core/external.d.cts +0 -15
- package/dist/types-cjs/core/graph.d.cts +0 -6
- package/dist/types-cjs/core/heap.d.cts +0 -22
- package/dist/types-cjs/core/index.d.cts +0 -13
- package/dist/types-cjs/core/invariants.d.cts +0 -59
- package/dist/types-cjs/core/lanes.d.cts +0 -44
- package/dist/types-cjs/core/optimistic.d.cts +0 -6
- package/dist/types-cjs/core/owner.d.cts +0 -124
- package/dist/types-cjs/core/scheduler.d.cts +0 -180
- package/dist/types-cjs/core/types.d.cts +0 -192
- package/dist/types-cjs/core/verdict.d.cts +0 -2
- package/dist/types-cjs/index.d.cts +0 -10
- package/dist/types-cjs/map.d.cts +0 -69
- package/dist/types-cjs/package.json +0 -3
- package/dist/types-cjs/signals.d.cts +0 -624
- package/dist/types-cjs/store/index.d.cts +0 -19
- package/dist/types-cjs/store/next/optimistic.d.cts +0 -20
- package/dist/types-cjs/store/next/projection.d.cts +0 -8
- package/dist/types-cjs/store/next/reconcile.d.cts +0 -3
- package/dist/types-cjs/store/next/store.d.cts +0 -77
- package/dist/types-cjs/store/next/target.d.cts +0 -117
- package/dist/types-cjs/store/optimistic.d.cts +0 -45
- package/dist/types-cjs/store/projection.d.cts +0 -70
- package/dist/types-cjs/store/reconcile.d.cts +0 -46
- package/dist/types-cjs/store/store.d.cts +0 -138
- package/dist/types-cjs/store/storePath.d.cts +0 -58
- package/dist/types-cjs/store/utils.d.cts +0 -74
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Computed } from "./types.cjs";
|
|
2
|
-
/** The queue a node belongs to, picked from its own zombie flag. */
|
|
3
|
-
export declare function queueFor(n: Computed<any>): Heap;
|
|
4
|
-
/**
|
|
5
|
-
* Schedule one subscriber to re-run on the next flush: tracked effects bypass
|
|
6
|
-
* the heap and go directly to their effect queue; everything else is inserted
|
|
7
|
-
* into its own (zombie-flag-routed) heap with the `_min` cursor pulled down.
|
|
8
|
-
*/
|
|
9
|
-
export declare function enqueueSub(node: Computed<any>): void;
|
|
10
|
-
export interface Heap {
|
|
11
|
-
_heap: (Computed<unknown> | undefined)[];
|
|
12
|
-
_marked: boolean;
|
|
13
|
-
_min: number;
|
|
14
|
-
_max: number;
|
|
15
|
-
}
|
|
16
|
-
export declare function increaseHeapSize(n: number, heap: Heap): void;
|
|
17
|
-
export declare function insertIntoHeap(n: Computed<any>, heap: Heap): void;
|
|
18
|
-
export declare function insertIntoHeapHeight(n: Computed<unknown>, heap: Heap): void;
|
|
19
|
-
export declare function deleteFromHeap(n: Computed<unknown>, heap: Heap): void;
|
|
20
|
-
export declare function markHeap(heap: Heap): void;
|
|
21
|
-
export declare function markNode(el: Computed<unknown>, newState?: number): void;
|
|
22
|
-
export declare function runHeap(heap: Heap, recompute: (el: Computed<unknown>) => void): void;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { ContextNotFoundError, NoOwnerError, NotReadyError } from "./error.cjs";
|
|
2
|
-
export { isEqual, untrack, runWithOwner, computed, signal, read, setSignal, setMemo, suppressComputedRecompute, optimisticSignal, optimisticComputed, refresh, staleValues, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots } from "./core.cjs";
|
|
3
|
-
export { enableExternalSource, _resetExternalSourceConfig, type ExternalSourceFactory, type ExternalSource, type ExternalSourceConfig } from "./external.cjs";
|
|
4
|
-
export { createOwner, createRoot, dispose, getNextChildId, getObserver, getOwner, isDisposed, cleanup, peekNextChildId } from "./owner.cjs";
|
|
5
|
-
export { createContext, getContext, setContext, type Context, type ContextRecord } from "./context.cjs";
|
|
6
|
-
export { handleAsync } from "./async.cjs";
|
|
7
|
-
export { isPending, latest } from "./verdict.cjs";
|
|
8
|
-
export type { Computed, Disposable, FirewallSignal, Link, Owner, Root, Signal, NodeOptions } from "./types.cjs";
|
|
9
|
-
export { effect, trackedEffect, type Effect, type TrackedEffect } from "./effect.cjs";
|
|
10
|
-
export { action } from "./action.cjs";
|
|
11
|
-
export { flush, Queue, GlobalQueue, enforceLoadingBoundary, resetErrorHalt, type IQueue, type QueueCallback } from "./scheduler.cjs";
|
|
12
|
-
export { DEV, type Dev, type DevHooks, type DiagnosticCapture, type DiagnosticCode, type DiagnosticEvent, type DiagnosticKind, type Diagnostics, type DiagnosticSeverity } from "./dev.cjs";
|
|
13
|
-
export * from "./constants.cjs";
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { OptimisticLane } from "./lanes.cjs";
|
|
2
|
-
import type { Computed, Signal } from "./types.cjs";
|
|
3
|
-
/**
|
|
4
|
-
* Test-mode invariant checks for the async/transition/lane machinery.
|
|
5
|
-
* Catalog and rationale: packages/solid-signals/INTERNALS-ASYNC-STATE.md.
|
|
6
|
-
*
|
|
7
|
-
* These are implementation self-consistency checks, not semantic rules: a
|
|
8
|
-
* violation means the reactive system contradicted itself.
|
|
9
|
-
*
|
|
10
|
-
* They are gated on `__TEST__` (not just `__DEV__`): the per-write Set
|
|
11
|
-
* tracking and per-flush quiescence sweep are too expensive for shipped dev
|
|
12
|
-
* builds and for benchmarks (they showed up as a 5-21% hit across the
|
|
13
|
-
* CodSpeed suite when they ran under `__DEV__`). Call sites stay `__DEV__`
|
|
14
|
-
* guarded so production tree-shakes the calls; each entry point here
|
|
15
|
-
* early-returns unless `__TEST__` is set, so dev builds pay only a no-op
|
|
16
|
-
* call. The test suite (vitest run) defines `__TEST__: true`; benchmark mode
|
|
17
|
-
* defines `__TEST__: false`.
|
|
18
|
-
*/
|
|
19
|
-
type AnyNode = Signal<any> | Computed<any>;
|
|
20
|
-
/** Wired by core.ts at module init to avoid import cycles. */
|
|
21
|
-
export declare const InvariantHooks: {
|
|
22
|
-
pendingProbeActive: (() => boolean) | null;
|
|
23
|
-
/** Fresh oracle for what an isPending companion SHOULD read right now. */
|
|
24
|
-
computePendingState: ((node: AnyNode) => boolean) | null;
|
|
25
|
-
};
|
|
26
|
-
export declare function devTrackHeldPending(node: AnyNode): void;
|
|
27
|
-
export declare function devTrackCompanionOwner(node: AnyNode): void;
|
|
28
|
-
export declare function devTrackOptimistic(node: AnyNode): void;
|
|
29
|
-
export declare function devTrackAffects(node: AnyNode): void;
|
|
30
|
-
/**
|
|
31
|
-
* Open/close the sanctioned registration window. Call sites are `__DEV__`
|
|
32
|
-
* guarded (no prod cost); the code inside the window must not throw.
|
|
33
|
-
*/
|
|
34
|
-
export declare function beginAsyncReporterWrites(): void;
|
|
35
|
-
export declare function endAsyncReporterWrites(): void;
|
|
36
|
-
export declare function createAsyncReporters(): Map<Computed<any>, Set<Computed<any>>>;
|
|
37
|
-
/**
|
|
38
|
-
* INV-2: a node with an *active* override must be registered for reversion in
|
|
39
|
-
* the queue's or a transition's `_optimisticNodes`. An unregistered active
|
|
40
|
-
* override would survive transition completion forever. Runs at the end of
|
|
41
|
-
* every flush (not just quiescence — the invariant holds mid-transition).
|
|
42
|
-
* (There is no revert-target requirement: authoritative values commit
|
|
43
|
-
* silently into `_value` under the override mask — A17 — so reverting is
|
|
44
|
-
* just dropping the override.)
|
|
45
|
-
*/
|
|
46
|
-
export declare function devCheckActiveOverrides(isRegisteredForRevert: (node: AnyNode) => boolean): void;
|
|
47
|
-
/** INV-1: an isPending() probe must never leak past its own call. */
|
|
48
|
-
export declare function devCheckFlushStart(): void;
|
|
49
|
-
/** INV-5: a merged lane's work moved to its root on merge and must stay empty. */
|
|
50
|
-
export declare function devCheckMergedLaneEmpty(lane: OptimisticLane): void;
|
|
51
|
-
export declare function devCensusCompanions(isQueuedForCommit?: (node: AnyNode) => boolean): void;
|
|
52
|
-
/**
|
|
53
|
-
* Quiescence checks. Run only when the system is fully drained: nothing
|
|
54
|
-
* scheduled, no active/stashed transitions, no live lanes. At that point no
|
|
55
|
-
* transition-scoped state may survive, and the lazily-created companions must
|
|
56
|
-
* agree with a fresh computation of their owner's state.
|
|
57
|
-
*/
|
|
58
|
-
export declare function devCheckQuiescent(isQueuedForCommit: (node: AnyNode) => boolean): void;
|
|
59
|
-
export {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { type QueueCallback, type Transition } from "./scheduler.cjs";
|
|
2
|
-
import type { Computed, Signal } from "./types.cjs";
|
|
3
|
-
/**
|
|
4
|
-
* OptimisticLane represents the context for a single optimistic write.
|
|
5
|
-
* Each optimistic signal creates its own lane. Lanes merge when their
|
|
6
|
-
* dependency graphs overlap.
|
|
7
|
-
*/
|
|
8
|
-
export interface OptimisticLane {
|
|
9
|
-
_source: Signal<any>;
|
|
10
|
-
_pendingAsync: Set<Computed<any>>;
|
|
11
|
-
_effectQueues: [QueueCallback[], QueueCallback[]];
|
|
12
|
-
_mergedInto: OptimisticLane | null;
|
|
13
|
-
_transition: Transition | null;
|
|
14
|
-
_parentLane: OptimisticLane | null;
|
|
15
|
-
}
|
|
16
|
-
export declare const signalLanes: WeakMap<Signal<any>, OptimisticLane>;
|
|
17
|
-
export declare const activeLanes: Set<OptimisticLane>;
|
|
18
|
-
/**
|
|
19
|
-
* Get an existing lane for a signal or create a new one.
|
|
20
|
-
* Reuses lane for multiple writes to the same signal.
|
|
21
|
-
*/
|
|
22
|
-
export declare function getOrCreateLane(signal: Signal<any>): OptimisticLane;
|
|
23
|
-
/**
|
|
24
|
-
* Union-find: find the root lane.
|
|
25
|
-
*/
|
|
26
|
-
export declare function findLane(lane: OptimisticLane): OptimisticLane;
|
|
27
|
-
/**
|
|
28
|
-
* Merge two lanes when their dependency graphs overlap.
|
|
29
|
-
*/
|
|
30
|
-
export declare function mergeLanes(lane1: OptimisticLane, lane2: OptimisticLane): OptimisticLane;
|
|
31
|
-
/**
|
|
32
|
-
* Resolve a node's lane: follow union-find chain, verify active, clear if stale.
|
|
33
|
-
*/
|
|
34
|
-
export declare function resolveLane(el: Signal<any> | Computed<any>): OptimisticLane | undefined;
|
|
35
|
-
export declare function resolveTransition(el: Signal<any> | Computed<any>): Transition | null | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Check if a node has an active optimistic override.
|
|
38
|
-
*/
|
|
39
|
-
export declare function hasActiveOverride(el: Signal<any> | Computed<any>): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Assign or merge a lane onto a node. At convergence points (node already has
|
|
42
|
-
* a different active lane), merge unless the node has an active override.
|
|
43
|
-
*/
|
|
44
|
-
export declare function assignOrMergeLane(el: Signal<any> | Computed<any>, sourceLane: OptimisticLane): void;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Installs the engine's hooks. Idempotent; called by every module that can
|
|
3
|
-
* create optimistic state (verdict.ts at module top level, createOptimistic
|
|
4
|
-
* and createOptimisticStore at first call) BEFORE any optimistic node exists.
|
|
5
|
-
*/
|
|
6
|
-
export declare function installOptimisticEngine(): void;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import type { Computed, Disposable, Owner, Root } from "./types.cjs";
|
|
2
|
-
export declare function markDisposal(el: Owner): void;
|
|
3
|
-
export declare function dispose(node: Computed<unknown>): void;
|
|
4
|
-
export declare function disposeChildren(node: Owner, self?: boolean, zombie?: boolean): void;
|
|
5
|
-
/**
|
|
6
|
-
* Allocates and returns the next stable child id for `owner`. Used by
|
|
7
|
-
* hydration plumbing and `createUniqueId`. Not part of the user-facing API.
|
|
8
|
-
*
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export declare function getNextChildId(owner: Owner): string;
|
|
12
|
-
/**
|
|
13
|
-
* The id a freshly-created node inherits: an explicit `options.id` wins;
|
|
14
|
-
* transparent nodes share their parent's id; otherwise the parent's next
|
|
15
|
-
* child id is consumed (or `undefined` outside an id-carrying tree).
|
|
16
|
-
*/
|
|
17
|
-
export declare function inheritId(options: {
|
|
18
|
-
id?: string;
|
|
19
|
-
} | undefined, transparent: boolean, parent: Owner | null | undefined): string | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Returns the *next* child id for `owner` without consuming it. Used by
|
|
22
|
-
* hydration plumbing to peek at the id a future child will receive.
|
|
23
|
-
*
|
|
24
|
-
* @internal
|
|
25
|
-
*/
|
|
26
|
-
export declare function peekNextChildId(owner: Owner): string;
|
|
27
|
-
/**
|
|
28
|
-
* Returns the currently-tracking observer (the computation that subscribes to
|
|
29
|
-
* reactive reads at this point), or `null` if reads here would be untracked.
|
|
30
|
-
* Used by reactive primitives that need to know whether they're inside a
|
|
31
|
-
* tracking scope. App code rarely needs this — see `getOwner()` for the
|
|
32
|
-
* lifecycle owner instead.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```ts
|
|
36
|
-
* // Library predicate: only register a hot-path subscription when the
|
|
37
|
-
* // caller is inside a tracking scope (memo / effect compute / JSX).
|
|
38
|
-
* function trackIfTracked(source: () => unknown) {
|
|
39
|
-
* if (getObserver()) source();
|
|
40
|
-
* }
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
export declare function getObserver(): Owner | null;
|
|
44
|
-
/**
|
|
45
|
-
* Returns the current reactive **owner** — the lifecycle node that the next
|
|
46
|
-
* `cleanup()` / `onCleanup()` / `createSignal()` etc. will be attached to.
|
|
47
|
-
*
|
|
48
|
-
* Returns `null` if called outside any owner. Capture the owner with
|
|
49
|
-
* `getOwner()` and re-enter it later with `runWithOwner(owner, fn)` to attach
|
|
50
|
-
* disposables created from a callback (event handler, async resolution, etc.)
|
|
51
|
-
* back to a component's lifecycle.
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```ts
|
|
55
|
-
* function defer<T>(fn: () => T) {
|
|
56
|
-
* const owner = getOwner();
|
|
57
|
-
* queueMicrotask(() => runWithOwner(owner, fn));
|
|
58
|
-
* }
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
export declare function getOwner(): Owner | null;
|
|
62
|
-
/**
|
|
63
|
-
* Low-level: registers `fn` as a disposal callback on the current owner.
|
|
64
|
-
* Most code should use `onCleanup()` from `solid-js`, which adds dev-mode
|
|
65
|
-
* checks. `cleanup()` is the unchecked primitive used by internals.
|
|
66
|
-
*/
|
|
67
|
-
export declare function cleanup(fn: Disposable): Disposable;
|
|
68
|
-
/**
|
|
69
|
-
* Returns `true` if the owner has been disposed (or marked zombie pending
|
|
70
|
-
* disposal). Pair with a captured owner to bail out of late callbacks whose
|
|
71
|
-
* surrounding component already unmounted.
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```ts
|
|
75
|
-
* function onSettleSafe(fn: () => void) {
|
|
76
|
-
* const owner = getOwner();
|
|
77
|
-
* queueMicrotask(() => {
|
|
78
|
-
* if (owner && isDisposed(owner)) return; // component unmounted; skip
|
|
79
|
-
* runWithOwner(owner, fn);
|
|
80
|
-
* });
|
|
81
|
-
* }
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
export declare function isDisposed(node: Owner): boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Creates a fresh owner attached as a child of the current owner (or as a
|
|
87
|
-
* detached root if there is none). Used by framework internals to group
|
|
88
|
-
* cleanups; app code should use `createRoot()` (host a reactive scope outside
|
|
89
|
-
* a component) or `runWithOwner()` (re-enter a captured owner).
|
|
90
|
-
*
|
|
91
|
-
* @internal
|
|
92
|
-
*/
|
|
93
|
-
export declare function createOwner(options?: {
|
|
94
|
-
id?: string;
|
|
95
|
-
transparent?: boolean;
|
|
96
|
-
}): Root;
|
|
97
|
-
/**
|
|
98
|
-
* Creates a detached reactive root. The callback receives a `dispose()`
|
|
99
|
-
* function which, when called, tears down every signal, memo, effect, and
|
|
100
|
-
* `onCleanup` registered inside the root.
|
|
101
|
-
*
|
|
102
|
-
* Use this to host long-lived reactive scopes outside of a component (custom
|
|
103
|
-
* controllers, app bootstrapping, tests). Inside a component, prefer
|
|
104
|
-
* letting Solid's component lifecycle own things.
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* ```ts
|
|
108
|
-
* const dispose = createRoot(dispose => {
|
|
109
|
-
* const [n, setN] = createSignal(0);
|
|
110
|
-
* createEffect(() => n(), value => console.log(value));
|
|
111
|
-
* setInterval(() => setN(x => x + 1), 1000);
|
|
112
|
-
* return dispose;
|
|
113
|
-
* });
|
|
114
|
-
*
|
|
115
|
-
* // Later, to tear everything down:
|
|
116
|
-
* dispose();
|
|
117
|
-
* ```
|
|
118
|
-
*
|
|
119
|
-
* @description https://docs.solidjs.com/reference/reactive-utilities/create-root
|
|
120
|
-
*/
|
|
121
|
-
export declare function createRoot<T>(init: ((dispose: () => void) => T) | (() => T), options?: {
|
|
122
|
-
id?: string;
|
|
123
|
-
transparent?: boolean;
|
|
124
|
-
}): T;
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { type Heap } from "./heap.cjs";
|
|
2
|
-
import { activeLanes, assignOrMergeLane, findLane, type OptimisticLane } 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 resetUnhandledAsync(): void;
|
|
13
|
-
/**
|
|
14
|
-
* Toggles the dev-mode "must be inside a `<Loading>` boundary" enforcement
|
|
15
|
-
* window. Only `render()` calls this — wrapping the initial mount so that a
|
|
16
|
-
* top-level uncaught async read surfaces the diagnostic. Not part of the
|
|
17
|
-
* user-facing API.
|
|
18
|
-
*
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
export declare function enforceLoadingBoundary(enabled: boolean): void;
|
|
22
|
-
export declare function setProjectionWriteActive(value: boolean): void;
|
|
23
|
-
export declare function setTrackedQueueCallback(value: boolean): void;
|
|
24
|
-
export declare function setEffectCallback(value: boolean): void;
|
|
25
|
-
export type QueueCallback = (type: number) => void;
|
|
26
|
-
type QueueStub = {
|
|
27
|
-
_queues: [QueueCallback[], QueueCallback[]];
|
|
28
|
-
_children: QueueStub[];
|
|
29
|
-
};
|
|
30
|
-
type OptimisticNode = Signal<any> | Computed<any>;
|
|
31
|
-
export interface Transition {
|
|
32
|
-
_time: number;
|
|
33
|
-
_asyncReporters: Map<Computed<any>, Set<Computed<any>>>;
|
|
34
|
-
_pendingNodes: Signal<any>[];
|
|
35
|
-
_optimisticNodes: OptimisticNode[];
|
|
36
|
-
_affectsNodes: 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
|
-
/**
|
|
45
|
-
* Permanently halts the reactive system. Called when a user error escapes
|
|
46
|
-
* every boundary — app state is undefined at that point, so scheduling stops
|
|
47
|
-
* entirely rather than limping along with a half-applied update.
|
|
48
|
-
*/
|
|
49
|
-
export declare function haltReactivity(cause?: unknown): void;
|
|
50
|
-
/** @internal Test/dev-reload hook. Revives scheduling after a halt. */
|
|
51
|
-
export declare function resetErrorHalt(): void;
|
|
52
|
-
export interface IQueue {
|
|
53
|
-
enqueue(type: number, fn: QueueCallback): void;
|
|
54
|
-
run(type: number): boolean | void;
|
|
55
|
-
addChild(child: IQueue): void;
|
|
56
|
-
removeChild(child: IQueue): void;
|
|
57
|
-
created: number;
|
|
58
|
-
notify(node: Computed<any>, mask: number, flags: number, error?: any): boolean;
|
|
59
|
-
stashQueues(stub: QueueStub): void;
|
|
60
|
-
restoreQueues(stub: QueueStub): void;
|
|
61
|
-
_parent: IQueue | null;
|
|
62
|
-
}
|
|
63
|
-
export declare class Queue implements IQueue {
|
|
64
|
-
_parent: IQueue | null;
|
|
65
|
-
_queues: [QueueCallback[], QueueCallback[]];
|
|
66
|
-
_children: IQueue[];
|
|
67
|
-
_ranAt: number;
|
|
68
|
-
created: number;
|
|
69
|
-
addChild(child: IQueue): void;
|
|
70
|
-
removeChild(child: IQueue): void;
|
|
71
|
-
notify(node: Computed<any>, mask: number, flags: number, error?: any): boolean;
|
|
72
|
-
run(type: number): void;
|
|
73
|
-
enqueue(type: number, fn: QueueCallback): void;
|
|
74
|
-
stashQueues(stub: QueueStub): void;
|
|
75
|
-
restoreQueues(stub: QueueStub): void;
|
|
76
|
-
}
|
|
77
|
-
export declare class GlobalQueue extends Queue {
|
|
78
|
-
_running: boolean;
|
|
79
|
-
_batch: Transition;
|
|
80
|
-
static _update: (el: Computed<unknown>) => void;
|
|
81
|
-
static _dispose: (el: Computed<unknown>, self: boolean, zombie: boolean) => void;
|
|
82
|
-
static _runEffect: (el: Computed<unknown>) => void;
|
|
83
|
-
static _clearOptimisticStores: ((stores: Set<any>, completing: Transition | null) => void) | null;
|
|
84
|
-
static _releaseAffectsScope: ((node: OptimisticNode) => void) | null;
|
|
85
|
-
static _releaseAffectsMarks: ((nodes: OptimisticNode[]) => void) | null;
|
|
86
|
-
static _markAffects: ((node: OptimisticNode) => void) | null;
|
|
87
|
-
static _releaseAffectsMark: ((node: OptimisticNode) => void) | null;
|
|
88
|
-
static _wireExternalSource: ((self: Computed<any>) => void) | null;
|
|
89
|
-
static _externalUntrack: (<T>(fn: () => T) => T) | null;
|
|
90
|
-
static _syncCompanions: (<T>(el: Signal<T> | Computed<T>, value: T) => void) | null;
|
|
91
|
-
static _updatePendingSignal: ((el: OptimisticNode) => void) | null;
|
|
92
|
-
static _updateChildCompanions: ((el: Computed<any>) => void) | null;
|
|
93
|
-
static _snapCompanions: ((el: OptimisticNode) => void) | null;
|
|
94
|
-
static _latestRead: (<T>(el: Signal<T> | Computed<T>) => T) | null;
|
|
95
|
-
static _pendingCheck: ((el: OptimisticNode, c: Computed<any> | null, owner: OptimisticNode, firewall: Computed<any> | null) => void) | null;
|
|
96
|
-
static _recordFresh: ((el: OptimisticNode, value: any) => void) | null;
|
|
97
|
-
static _applyReask: ((el: Computed<any>, hadReask: boolean) => boolean) | null;
|
|
98
|
-
static _repollVerdicts: ((el: Computed<any>, snap?: boolean) => void) | null;
|
|
99
|
-
static _witnessAffects: ((node: OptimisticNode) => void) | null;
|
|
100
|
-
static _wakeSuppressedProbes: ((transition: Transition) => void) | null;
|
|
101
|
-
static _optimisticWrite: (<T>(el: Signal<T> | Computed<T>, v: T | ((prev: T) => T)) => T) | null;
|
|
102
|
-
static _resolveOptimistic: ((nodes: OptimisticNode[]) => void) | null;
|
|
103
|
-
static _transitionBlocked: ((transition: Transition) => boolean) | null;
|
|
104
|
-
static _cleanupLanes: ((completingTransition: Transition | null) => void) | null;
|
|
105
|
-
static _runLaneEffects: ((type: number) => void) | null;
|
|
106
|
-
static _gatedRead: ((el: Signal<any>, owner: OptimisticNode, c: Computed<any>) => boolean) | null;
|
|
107
|
-
static _laneSuspends: ((owner: OptimisticNode) => boolean) | null;
|
|
108
|
-
static _laneReadsCommitted: ((el: OptimisticNode, owner: OptimisticNode, c: Computed<any>) => boolean) | null;
|
|
109
|
-
static _recomputeLane: ((el: Computed<any>, own: boolean) => OptimisticLane | null | false) | null;
|
|
110
|
-
static _laneAsyncPending: ((el: Computed<any>) => void) | null;
|
|
111
|
-
static _laneAsyncSettled: ((el: Computed<any>) => void) | null;
|
|
112
|
-
static _trackOptimisticStore: ((store: any) => void) | null;
|
|
113
|
-
flush(): void;
|
|
114
|
-
notify(node: Computed<any>, mask: number, flags: number, error?: any): boolean;
|
|
115
|
-
initTransition(transition?: Transition | null): void;
|
|
116
|
-
}
|
|
117
|
-
export declare function queuePendingNode(node: Signal<any>): void;
|
|
118
|
-
export declare let reaskArmed: boolean;
|
|
119
|
-
/** §12d: bumped by every recompute and every new subscriber edge. A node's
|
|
120
|
-
* staged-rewrite skip is sound only while NOTHING recomputed or linked since
|
|
121
|
-
* its last notify — a mid-batch pull can clean a marked subscriber, and a
|
|
122
|
-
* skipped re-write would leave it stale. */
|
|
123
|
-
export declare let notifyEpoch: number;
|
|
124
|
-
export declare function bumpNotifyEpoch(): void;
|
|
125
|
-
export declare function armReaskClear(): void;
|
|
126
|
-
export declare function insertSubs(node: Signal<any> | Computed<any>, optimistic?: boolean): void;
|
|
127
|
-
export declare let storeCommitHook: (() => void) | null;
|
|
128
|
-
export declare function setStoreCommitHook(fn: () => void): void;
|
|
129
|
-
export declare function finalizePureQueue(completingTransition?: Transition | null, incomplete?: boolean): void;
|
|
130
|
-
/**
|
|
131
|
-
* Count of live `affects()` registrations across the system (including
|
|
132
|
-
* store-scope inherited marks). Gates the read-path mark check in `read()` so
|
|
133
|
-
* graphs that never use the feature pay one integer compare.
|
|
134
|
-
*/
|
|
135
|
-
export declare let activeAffectsMarks: number;
|
|
136
|
-
/**
|
|
137
|
-
* Counter mutation seam for the mark engine in affects.ts: an imported `let`
|
|
138
|
-
* binding is read-only, and the read-path gate above must stay a plain module
|
|
139
|
-
* variable so `read()` pays one integer compare, not a function call.
|
|
140
|
-
*
|
|
141
|
-
* @internal
|
|
142
|
-
*/
|
|
143
|
-
export declare function shiftAffectsMarks(delta: 1 | -1): void;
|
|
144
|
-
export declare const globalQueue: GlobalQueue;
|
|
145
|
-
/**
|
|
146
|
-
* Synchronously processes the pending reactive queue, or runs `fn` in a synchronous
|
|
147
|
-
* flush scope before draining the queue.
|
|
148
|
-
*
|
|
149
|
-
* Reactive updates are normally batched onto the microtask queue, so multiple
|
|
150
|
-
* writes in a row collapse into a single update pass. Call `flush()` when you
|
|
151
|
-
* need to *observe* the result of those writes synchronously — most commonly
|
|
152
|
-
* in tests, but also at the boundary of imperative integration code. Pass a
|
|
153
|
-
* callback when the writes themselves should bypass microtask scheduling and
|
|
154
|
-
* drain synchronously when the callback returns.
|
|
155
|
-
*
|
|
156
|
-
* @example
|
|
157
|
-
* ```ts
|
|
158
|
-
* const [count, setCount] = createSignal(0);
|
|
159
|
-
* const doubled = createMemo(() => count() * 2);
|
|
160
|
-
*
|
|
161
|
-
* setCount(5);
|
|
162
|
-
* flush();
|
|
163
|
-
* expect(doubled()).toBe(10);
|
|
164
|
-
*
|
|
165
|
-
* flush(() => setCount(6));
|
|
166
|
-
* expect(doubled()).toBe(12);
|
|
167
|
-
*
|
|
168
|
-
* // Nested flushes drain at each level:
|
|
169
|
-
* flush(() => {
|
|
170
|
-
* setCount(7);
|
|
171
|
-
* flush(() => setCount(8)); // inner drain — effects fire here
|
|
172
|
-
* // outer continues with up-to-date state
|
|
173
|
-
* });
|
|
174
|
-
* ```
|
|
175
|
-
*/
|
|
176
|
-
export declare function flush(): void;
|
|
177
|
-
export declare function flush<T>(fn: () => T): T;
|
|
178
|
-
export declare function currentTransition(transition: Transition): Transition;
|
|
179
|
-
export declare function setActiveTransition(transition: Transition | null): void;
|
|
180
|
-
export declare function runInTransition<T>(transition: Transition, fn: () => T): T;
|
|
@@ -1,192 +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
|
-
* `_sub._depGen` at the time this link was created or last revalidated
|
|
15
|
-
* in-order. A link stamped with the subscriber's current pass generation is
|
|
16
|
-
* inside the validated `[deps.._depsTail]` prefix — an O(1) replacement for
|
|
17
|
-
* scanning the dep list to answer membership (see `link()`).
|
|
18
|
-
*/
|
|
19
|
-
_gen: number;
|
|
20
|
-
_pendingObserver?: boolean;
|
|
21
|
-
}
|
|
22
|
-
export interface NodeOptions<T> {
|
|
23
|
-
id?: string;
|
|
24
|
-
name?: string;
|
|
25
|
-
transparent?: boolean;
|
|
26
|
-
equals?: ((prev: T, next: T) => boolean) | false;
|
|
27
|
-
ownedWrite?: boolean;
|
|
28
|
-
/** Exclude this signal from snapshot capture (internal — not part of public API) */
|
|
29
|
-
_noSnapshot?: boolean;
|
|
30
|
-
unobserved?: () => void;
|
|
31
|
-
lazy?: boolean;
|
|
32
|
-
sync?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Commit #0. When present (checked with `in`, so an explicit `undefined`
|
|
35
|
-
* counts), the node is born committed with this value instead of
|
|
36
|
-
* STATUS_UNINITIALIZED: reads serve it everywhere, nothing suspends to
|
|
37
|
-
* Loading boundaries, transitions are never held, and the window is
|
|
38
|
-
* verdict-quiet (`isPending` stays false — commit #0 answers the question
|
|
39
|
-
* by declaration; first-load affordances live in the value itself). After
|
|
40
|
-
* the first real answer lands, normal refetch/pending semantics apply.
|
|
41
|
-
*/
|
|
42
|
-
loadingValue?: T;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Cold node extension (stage-3 §12): optional machinery that most nodes
|
|
46
|
-
* never touch lives one hop away so the CORE node literal stays under V8's
|
|
47
|
-
* in-object property boundary (~39 fields measured: past it, every literal
|
|
48
|
-
* allocation spills to an out-of-object backing store and creation cost
|
|
49
|
-
* roughly quadruples — the create0to1 cliff). Allocated lazily by `ext()`
|
|
50
|
-
* on first installer write; ONE shape shared by signals and computeds so
|
|
51
|
-
* `_x` access stays monomorphic. Presence bits on `_config`
|
|
52
|
-
* (CONFIG_OPTIMISTIC / HAS_COMPANIONS / HAS_LANE / HAS_SNAPSHOT) remain the
|
|
53
|
-
* hot-path gates — a bit says "consult _x", never the reverse.
|
|
54
|
-
*/
|
|
55
|
-
export interface NodeExtension {
|
|
56
|
-
_overrideValue: unknown | typeof NOT_PENDING;
|
|
57
|
-
/**
|
|
58
|
-
* The transaction that owns the active override (stamped at optimistic
|
|
59
|
-
* write, cleared at settle). Ownership must live on the node: a lane's
|
|
60
|
-
* _transition is a scheduling affinity that a shared subscriber can merge
|
|
61
|
-
* across transactions (#2912) — following it would let one action's settle
|
|
62
|
-
* revert another action's live override. Node-level sibling of the store
|
|
63
|
-
* layer's STORE_OPTIMISTIC_OWNERS stamps (#2899). `null` = ambient write.
|
|
64
|
-
*/
|
|
65
|
-
_overrideOwner: Transition | null | undefined;
|
|
66
|
-
_optimisticLane: OptimisticLane | undefined;
|
|
67
|
-
_pendingSignal: Signal<boolean> | undefined;
|
|
68
|
-
_latestValueComputed: Computed<any> | undefined;
|
|
69
|
-
_parentSource: Signal<any> | Computed<any> | undefined;
|
|
70
|
-
/**
|
|
71
|
-
* Live `affects()` marks on this node (refcount). Non-zero is declared
|
|
72
|
-
* motion — see affects(); the count is the mark's only graph state.
|
|
73
|
-
*/
|
|
74
|
-
_affectsCount: number;
|
|
75
|
-
_inFlight: PromiseLike<any> | AsyncIterable<any> | null;
|
|
76
|
-
_error: unknown;
|
|
77
|
-
_blocked: boolean | undefined;
|
|
78
|
-
_pendingSources: Set<Computed<any>> | undefined;
|
|
79
|
-
_notifyStatus: ((status?: number, error?: any) => void) | undefined;
|
|
80
|
-
/** Question-scoped re-ask classification of the current pending window
|
|
81
|
-
* (see the former Computed._x?._reask doc): set by recompute from
|
|
82
|
-
* REACTIVE_REASK, cleared on landing; meaningless while not pending. */
|
|
83
|
-
_reask: boolean;
|
|
84
|
-
_child: FirewallSignal<any> | null;
|
|
85
|
-
_unobserved: (() => void) | undefined;
|
|
86
|
-
_snapshotValue: any;
|
|
87
|
-
/** Zombie staging (staged disposal): a recompute of an owner that HAS
|
|
88
|
-
* children/disposal parks them here until the flush commits (or a
|
|
89
|
-
* transition reverts). Childless nodes — the common case — never write
|
|
90
|
-
* these. */
|
|
91
|
-
_pendingDisposal: Disposable | Disposable[] | null;
|
|
92
|
-
_pendingFirstChild: Owner | null;
|
|
93
|
-
/** #3038: the firewall children that actually carry isPending()/latest()
|
|
94
|
-
* companions. The post-recompute companion snap iterates THIS set —
|
|
95
|
-
* O(companions asked for) — never the full `_child` chain (one entry per
|
|
96
|
-
* materialized leaf). Populated at companion creation; entries live as
|
|
97
|
-
* long as their companions (which are permanent once created). */
|
|
98
|
-
_companionChildren: Set<FirewallSignal<any>> | undefined;
|
|
99
|
-
}
|
|
100
|
-
export interface RawSignal<T> {
|
|
101
|
-
_subs: Link | null;
|
|
102
|
-
_subsTail: Link | null;
|
|
103
|
-
/**
|
|
104
|
-
* DEV-only live subscriber count. Maintained by `link`/`unlinkSubs` for
|
|
105
|
-
* graph-size diagnostics; undefined in production.
|
|
106
|
-
*/
|
|
107
|
-
_subCount?: number;
|
|
108
|
-
_value: T;
|
|
109
|
-
_name?: string;
|
|
110
|
-
_equals: false | ((a: T, b: T) => boolean);
|
|
111
|
-
_config: number;
|
|
112
|
-
_time: number;
|
|
113
|
-
/** IN CORE, not the extension (stage-3 §12c): consulted on EVERY write
|
|
114
|
-
* (setSignal's transition-init check) and on recompute scheduling — the
|
|
115
|
-
* per-write extension chase measurably taxed propagation chains. */
|
|
116
|
-
_transition: Transition | null;
|
|
117
|
-
/** Notify-epoch stamp of the last subscriber walk (§12d). A re-write to an
|
|
118
|
-
* already-staged node whose stamp still equals the global epoch skips the
|
|
119
|
-
* whole walk — marking is idempotent, and the epoch bumps on every
|
|
120
|
-
* recompute and new subscriber edge (either can invalidate the skip). */
|
|
121
|
-
_notifiedAt: number;
|
|
122
|
-
_pendingValue: T | typeof NOT_PENDING;
|
|
123
|
-
/** Cold extension — see NodeExtension. */
|
|
124
|
-
_x: NodeExtension | null;
|
|
125
|
-
}
|
|
126
|
-
export interface FirewallSignal<T> extends RawSignal<T> {
|
|
127
|
-
_firewall: Computed<any>;
|
|
128
|
-
_nextChild: FirewallSignal<unknown> | null;
|
|
129
|
-
}
|
|
130
|
-
export type Signal<T> = RawSignal<T> | FirewallSignal<T>;
|
|
131
|
-
export interface Owner {
|
|
132
|
-
id?: string;
|
|
133
|
-
_config: number;
|
|
134
|
-
_snapshotScope?: boolean;
|
|
135
|
-
/** Effect-returned cleanup; managed across reruns, invoked at true disposal */
|
|
136
|
-
_cleanup?: () => void;
|
|
137
|
-
_disposal: Disposable | Disposable[] | null;
|
|
138
|
-
_parent: Owner | null;
|
|
139
|
-
_context: Record<symbol | string, unknown>;
|
|
140
|
-
_childCount: number;
|
|
141
|
-
_queue: IQueue;
|
|
142
|
-
_firstChild: Owner | null;
|
|
143
|
-
_nextSibling: Owner | null;
|
|
144
|
-
_prevSibling: Owner | null;
|
|
145
|
-
/** Cold extension — see NodeExtension (owners use the zombie-pair slots). */
|
|
146
|
-
_x: NodeExtension | null;
|
|
147
|
-
}
|
|
148
|
-
export interface Computed<T> extends RawSignal<T>, Owner {
|
|
149
|
-
_deps: Link | null;
|
|
150
|
-
_depsTail: Link | null;
|
|
151
|
-
/**
|
|
152
|
-
* DEV-only live source count. Maintained by `link`/`unlinkSubs` for
|
|
153
|
-
* graph-size diagnostics; undefined in production.
|
|
154
|
-
*/
|
|
155
|
-
_depCount?: number;
|
|
156
|
-
/** Recompute-pass counter; bumped when dep revalidation starts. */
|
|
157
|
-
_depGen: number;
|
|
158
|
-
_flags: number;
|
|
159
|
-
_statusFlags: number;
|
|
160
|
-
_height: number;
|
|
161
|
-
_nextHeap: Computed<any> | undefined;
|
|
162
|
-
_prevHeap: Computed<any>;
|
|
163
|
-
_fn: (prev?: T) => T;
|
|
164
|
-
/**
|
|
165
|
-
* Clock tick at which REACTIVE_MANUAL_WRITE was last applied
|
|
166
|
-
* (`suppressComputedRecompute`). Lets `refresh()` distinguish a same-tick
|
|
167
|
-
* manual write (which wins over the refresh, #2692) from a mask carried
|
|
168
|
-
* across ticks by a transaction (which an explicit refresh lifts, #3026).
|
|
169
|
-
* Only meaningful while REACTIVE_MANUAL_WRITE is set.
|
|
170
|
-
*/
|
|
171
|
-
_manualWriteTime?: number;
|
|
172
|
-
/**
|
|
173
|
-
* True while a `loadingValue` node's first real answer hasn't landed: the
|
|
174
|
-
* node was born committed (commit #0 = the loading value) and `handleAsync`
|
|
175
|
-
* serves that committed value instead of throwing NotReadyError, so first
|
|
176
|
-
* flights never suspend readers, trip boundaries, or hold transitions.
|
|
177
|
-
* The window is verdict-quiet: `isPending` stays false, because commit #0
|
|
178
|
-
* answers the question by declaration (first-load affordances belong to
|
|
179
|
-
* the value channel). Cleared by the first value landing on any path (sync
|
|
180
|
-
* return, sync-resolved promise, first iterator yield, async settle); a
|
|
181
|
-
* real error leaves it set — errors answer reads but don't enter the value
|
|
182
|
-
* lineage, so a retry serves the loading value again. Once cleared, normal
|
|
183
|
-
* pending/refetch semantics apply forever. (Stays in CORE: written
|
|
184
|
-
* unconditionally by recompute and every commit.)
|
|
185
|
-
*/
|
|
186
|
-
_loading: boolean;
|
|
187
|
-
}
|
|
188
|
-
export interface Root extends Owner {
|
|
189
|
-
_root: true;
|
|
190
|
-
_parentComputed: Computed<any> | null;
|
|
191
|
-
dispose(self?: boolean): void;
|
|
192
|
-
}
|
|
@@ -1,10 +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, refresh, SUPPORTS_PROXY, setSnapshotCapture, markSnapshotScope, releaseSnapshotScope, clearSnapshots, enforceLoadingBoundary, enableExternalSource, resetErrorHalt } 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 { affects } from "./affects.cjs";
|
|
8
|
-
export { mapArray, repeat, type Maybe } from "./map.cjs";
|
|
9
|
-
export * from "./store/index.cjs";
|
|
10
|
-
export { createLoadingBoundary, createErrorBoundary, createRevealOrder, flatten, type RevealOrder } from "./boundaries.cjs";
|