@solidjs/signals 2.0.0-rc.5 → 2.0.0-rc.7
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 +2467 -1322
- package/dist/node.cjs +2037 -2428
- package/dist/node.dev.cjs +13724 -0
- package/dist/prod/boundaries.js +3 -1
- package/dist/prod/core/async.js +47 -20
- package/dist/prod/core/attribution-hooks.js +3 -0
- package/dist/prod/core/constants.js +9 -1
- package/dist/prod/core/context.js +10 -16
- package/dist/prod/core/core.js +260 -188
- package/dist/prod/core/dev.js +2 -0
- package/dist/prod/core/effect.js +41 -32
- package/dist/prod/core/external.js +2 -2
- package/dist/prod/core/graph.js +35 -31
- package/dist/prod/core/heap.js +34 -40
- package/dist/prod/core/lanes.js +44 -30
- package/dist/prod/core/optimistic.js +55 -45
- package/dist/prod/core/owner.js +35 -35
- package/dist/prod/core/scheduler.js +176 -177
- package/dist/prod/core/verdict.js +53 -52
- package/dist/prod/index.js +0 -2
- package/dist/prod/map.js +104 -94
- package/dist/prod/signals.js +119 -35
- package/dist/prod/store/next/optimistic.js +217 -163
- package/dist/prod/store/next/projection.js +2 -2
- package/dist/prod/store/next/reconcile.js +140 -288
- package/dist/prod/store/next/store.js +338 -252
- package/dist/prod/store/store.js +2 -2
- package/dist/types/core/attribution-hooks.d.ts +75 -0
- package/dist/types/core/attribution.d.ts +313 -9
- package/dist/types/core/constants.d.ts +8 -0
- package/dist/types/core/core.d.ts +12 -3
- package/dist/types/core/dev.d.ts +56 -9
- package/dist/types/core/heap.d.ts +5 -3
- package/dist/types/core/invariants.d.ts +1 -1
- package/dist/types/core/lanes.d.ts +10 -0
- package/dist/types/core/scheduler.d.ts +14 -4
- package/dist/types/signals.d.ts +10 -11
- package/dist/types/store/index.d.ts +3 -6
- package/dist/types/store/next/optimistic.d.ts +4 -2
- package/dist/types/store/next/reconcile.d.ts +5 -12
- package/dist/types/store/next/store.d.ts +3 -9
- package/dist/types/store/next/target.d.ts +30 -46
- package/dist/types/store/store.d.ts +14 -9
- package/dist/types-cjs/core/attribution-hooks.d.cts +75 -0
- package/dist/types-cjs/core/attribution.d.cts +313 -9
- package/dist/types-cjs/core/constants.d.cts +8 -0
- package/dist/types-cjs/core/core.d.cts +12 -3
- package/dist/types-cjs/core/dev.d.cts +56 -9
- package/dist/types-cjs/core/heap.d.cts +5 -3
- package/dist/types-cjs/core/invariants.d.cts +1 -1
- package/dist/types-cjs/core/lanes.d.cts +10 -0
- package/dist/types-cjs/core/scheduler.d.cts +14 -4
- package/dist/types-cjs/signals.d.cts +10 -11
- package/dist/types-cjs/store/index.d.cts +3 -6
- package/dist/types-cjs/store/next/optimistic.d.cts +4 -2
- package/dist/types-cjs/store/next/reconcile.d.cts +5 -12
- package/dist/types-cjs/store/next/store.d.cts +3 -9
- package/dist/types-cjs/store/next/target.d.cts +30 -46
- package/dist/types-cjs/store/store.d.cts +14 -9
- package/package.json +3 -2
- package/dist/prod/store/next/patch-hooks.js +0 -13
- package/dist/prod/store/next/patch.js +0 -614
- package/dist/types/store/next/patch-hooks.d.ts +0 -41
- package/dist/types/store/next/patch.d.ts +0 -91
- package/dist/types-cjs/store/next/patch-hooks.d.cts +0 -41
- package/dist/types-cjs/store/next/patch.d.cts +0 -91
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import type { Owner } from "../../core/types.js";
|
|
2
|
-
import { type StoreNextTarget } from "./target.js";
|
|
3
|
-
export type PatchFn = (next: any, prev: any, force?: boolean) => void;
|
|
4
|
-
interface PatchEntry {
|
|
5
|
-
fn: PatchFn;
|
|
6
|
-
owner: Owner | null;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Emit a record's visibility transition. Callers gate on `hasPatches()` and
|
|
10
|
-
* `t.d` cheaply; this function re-checks and walks ancestors (§4b).
|
|
11
|
-
*/
|
|
12
|
-
export declare function emitPatch(t: StoreNextTarget, next: any, prev: any): void;
|
|
13
|
-
/** Emission for sites that already stand at the record with both sides in
|
|
14
|
-
* hand and have already handled ancestors (the adoption walk descends —
|
|
15
|
-
* parents were visited first), so no bubbling walk. */
|
|
16
|
-
export declare function emitPatchLocal(t: StoreNextTarget, next: any, prev: any): void;
|
|
17
|
-
export declare function emitPatchOptimistic(t: StoreNextTarget, next: any, prev: any): void;
|
|
18
|
-
/** Row-ops emission at OPTIMISTIC (lane) timing: user drafts on an
|
|
19
|
-
* optimistic family must show structure IN FLIGHT — bypassing the
|
|
20
|
-
* transition stash exactly like emitPatchOptimistic. Two forms:
|
|
21
|
-
* - `ops` given (write site): `nextRows` is the draft's intended visible
|
|
22
|
-
* list, ops the identity diff against the pre-write optimistic view.
|
|
23
|
-
* - `ops === null` (revert site): RESYNC — the consumer rebuilds retention
|
|
24
|
-
* by row identity against the live post-revert view, resolved from the
|
|
25
|
-
* target at drain time (overrides are gone by then, so `pb ?? v` IS the
|
|
26
|
-
* committed truth). */
|
|
27
|
-
export declare function emitRowOpsOptimistic(t: StoreNextTarget, nextRows: any[] | null, ops: RowOps | null): void;
|
|
28
|
-
/** Test-only accounting probe: the live registration count must return to
|
|
29
|
-
* baseline across register/unbind/demote cycles. @internal */
|
|
30
|
-
export declare function patchCountForTests(): number;
|
|
31
|
-
export declare function hasPatches(): boolean;
|
|
32
|
-
export declare function registerPatch(record: any, fn: PatchFn): () => void;
|
|
33
|
-
/** Dual-driver bind probe (compiler runtime contract): when `record` is a
|
|
34
|
-
* patchable store record, returns its CURRENT raw backing (the driver's
|
|
35
|
-
* initial force-apply reads it directly — no proxy traffic, no tracking);
|
|
36
|
-
* returns undefined otherwise (driver falls back to the effect path).
|
|
37
|
-
* Not patchable: non-records, non-proxies, accessor-bearing records
|
|
38
|
-
* (patches read raw — getters need tracked evaluation), broken chains. */
|
|
39
|
-
export declare function patchableRaw(record: any): Record<PropertyKey, any> | undefined;
|
|
40
|
-
/** Accessor demotion (design §5): a record that acquires an accessor after
|
|
41
|
-
* registration stops being patchable — reads must go through tracked
|
|
42
|
-
* evaluation. Clears patches and repairs the global count; callers re-drive
|
|
43
|
-
* the pulled bodies (demoteToEffects). */
|
|
44
|
-
export declare function demotePatches(t: StoreNextTarget): PatchEntry[] | null;
|
|
45
|
-
/** The demotion re-drive (re-audit blocker 3): each pulled body becomes the
|
|
46
|
-
* SAME dual-driver effect fallback the web runtime would have chosen had the
|
|
47
|
-
* record carried the accessor at bind — a tracked compute pass (next === prev
|
|
48
|
-
* short-circuits every compare into a pure read THROUGH THE PROXY, so getter
|
|
49
|
-
* dependencies track) plus an untracked force-apply at effect timing.
|
|
50
|
-
*
|
|
51
|
-
* Creation is DEFERRED to the effect phase: the trap that discovers the
|
|
52
|
-
* accessor runs mid-draft, and an effect's initial pass must not read
|
|
53
|
-
* through the proxy inside the write window. The record's own transition
|
|
54
|
-
* for that draft is covered by the new effect's initial force-apply.
|
|
55
|
-
*
|
|
56
|
-
* Known edge (documented): a demoted LIST-ROW body re-drives under its
|
|
57
|
-
* registering owner (the list owner), so per-row severing on removal is
|
|
58
|
-
* lost for demoted rows — the effect lives until the LIST disposes. Rows
|
|
59
|
-
* only demote when user code defines an accessor on a row record at
|
|
60
|
-
* runtime. */
|
|
61
|
-
export declare function demoteToEffects(t: StoreNextTarget): void;
|
|
62
|
-
/** Structural ops for one keyed-array transition. `prefix` rows key-matched
|
|
63
|
-
* in place; for each later index i (absolute), `sources[i - prefix]` is the
|
|
64
|
-
* OLD index its row retained from, or -1 for a new row. `removed` holds the
|
|
65
|
-
* dropped old row values (unbind/teardown handles). Aligned value ticks emit
|
|
66
|
-
* NOTHING — ops exist only when structure changed. */
|
|
67
|
-
export interface RowOps {
|
|
68
|
-
prefix: number;
|
|
69
|
-
sources: number[];
|
|
70
|
-
removed: any[];
|
|
71
|
-
}
|
|
72
|
-
/** `ops === null` is the RESYNC form (optimistic revert): the consumer
|
|
73
|
-
* rebuilds retention by row identity against `next` (the live view). */
|
|
74
|
-
export type RowOpsFn = (next: any[], ops: RowOps | null) => void;
|
|
75
|
-
/** Register a structural-ops consumer on a keyed store array (the list
|
|
76
|
-
* container's channel — what `For` consumes through the seam). */
|
|
77
|
-
export declare function registerRowOps(array: any, fn: RowOpsFn): () => void;
|
|
78
|
-
/** Slot patches (shallow arrays) ride the same apply queue: the walk emits
|
|
79
|
-
* per aligned value-replaced slot; application happens at effect phase under
|
|
80
|
-
* the registration owner's lifetime. */
|
|
81
|
-
export declare function emitSlotPatch(t: StoreNextTarget, index: number, next: any, prev: any): void;
|
|
82
|
-
/** Slot patch for shallow arrays: the reconcile walk emits (index, next,
|
|
83
|
-
* prev) for KEY-ALIGNED value-replaced slots (structure rides row ops), and
|
|
84
|
-
* the emission queues through the patch apply queue — effect-phase timing,
|
|
85
|
-
* transition stamping, disposed-owner drop — like every other channel. */
|
|
86
|
-
export declare function registerSlotPatchNext(arr: any, fn: (index: number, next: any, prev: any) => void): () => void;
|
|
87
|
-
/** Row-ops ride the SAME apply queue/timing as record patches: transition-
|
|
88
|
-
* stamped, applied at effect phase, in emission order (structure before the
|
|
89
|
-
* new rows' own patches can exist; retained rows' value patches commute). */
|
|
90
|
-
export declare function emitRowOps(t: StoreNextTarget, next: any[], ops: RowOps): void;
|
|
91
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { StoreNextTarget } from "./target.cjs";
|
|
2
|
-
import type { RowOps } from "./patch.cjs";
|
|
3
|
-
/**
|
|
4
|
-
* Patch-channel emission seams (pay-for-use). The store/reconcile/optimistic
|
|
5
|
-
* write paths emit through these installed hook objects instead of importing
|
|
6
|
-
* `patch.js` statically, so the channel tree-shakes out of apps that never
|
|
7
|
-
* register a patch consumer.
|
|
8
|
-
*
|
|
9
|
-
* TWO TIERS, armed at registration (patch.js installs them; it is retained
|
|
10
|
-
* only through its registration exports, which only compiled patch-mode
|
|
11
|
-
* output — via the web runtime's driver module — imports):
|
|
12
|
-
* - VALUE hooks (`patchHooks`): record patches. Armed by `registerPatch` —
|
|
13
|
-
* present in any bundle with one eligible template under patch mode.
|
|
14
|
-
* - ROW hooks (`rowHooks`): list structure (row ops, slot ticks, the
|
|
15
|
-
* identity/keyed diff builders in reconcile.js they drag in). Armed by
|
|
16
|
-
* `registerRowOps`/`registerSlotPatchNext` — the LIST driver's
|
|
17
|
-
* registrations, so value-only bundles never retain the row machinery.
|
|
18
|
-
*
|
|
19
|
-
* Soundness: every emission site is guarded by the matching `pc` channel
|
|
20
|
-
* (`pc.p` for value, `pc.ro`/`pc.sp` for rows), and a target can only
|
|
21
|
-
* acquire that channel through the corresponding registration — so each
|
|
22
|
-
* hook object is installed by the time any guard passes. Type-only imports
|
|
23
|
-
* from `patch.js` are erased.
|
|
24
|
-
*/
|
|
25
|
-
export interface PatchValueHooks {
|
|
26
|
-
emitPatch(t: StoreNextTarget, next: any, prev: any): void;
|
|
27
|
-
emitPatchLocal(t: StoreNextTarget, next: any, prev: any): void;
|
|
28
|
-
emitPatchOptimistic(t: StoreNextTarget, next: any, prev: any): void;
|
|
29
|
-
hasPatches(): boolean;
|
|
30
|
-
demoteToEffects(t: StoreNextTarget): void;
|
|
31
|
-
}
|
|
32
|
-
export interface PatchRowHooks {
|
|
33
|
-
emitRowOps(t: StoreNextTarget, next: any[], ops: RowOps): void;
|
|
34
|
-
emitSlotPatch(t: StoreNextTarget, index: number, next: any, prev: any): void;
|
|
35
|
-
emitSetterRowOps(t: StoreNextTarget, prevRows: any[], nextRows: any[]): void;
|
|
36
|
-
emitRowOpsOptimistic(t: StoreNextTarget, next: any[] | null, ops: RowOps | null): void;
|
|
37
|
-
}
|
|
38
|
-
export declare let patchHooks: PatchValueHooks | null;
|
|
39
|
-
export declare let rowHooks: PatchRowHooks | null;
|
|
40
|
-
export declare function installPatchHooks(hooks: PatchValueHooks): void;
|
|
41
|
-
export declare function installRowHooks(hooks: PatchRowHooks): void;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import type { Owner } from "../../core/types.cjs";
|
|
2
|
-
import { type StoreNextTarget } from "./target.cjs";
|
|
3
|
-
export type PatchFn = (next: any, prev: any, force?: boolean) => void;
|
|
4
|
-
interface PatchEntry {
|
|
5
|
-
fn: PatchFn;
|
|
6
|
-
owner: Owner | null;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Emit a record's visibility transition. Callers gate on `hasPatches()` and
|
|
10
|
-
* `t.d` cheaply; this function re-checks and walks ancestors (§4b).
|
|
11
|
-
*/
|
|
12
|
-
export declare function emitPatch(t: StoreNextTarget, next: any, prev: any): void;
|
|
13
|
-
/** Emission for sites that already stand at the record with both sides in
|
|
14
|
-
* hand and have already handled ancestors (the adoption walk descends —
|
|
15
|
-
* parents were visited first), so no bubbling walk. */
|
|
16
|
-
export declare function emitPatchLocal(t: StoreNextTarget, next: any, prev: any): void;
|
|
17
|
-
export declare function emitPatchOptimistic(t: StoreNextTarget, next: any, prev: any): void;
|
|
18
|
-
/** Row-ops emission at OPTIMISTIC (lane) timing: user drafts on an
|
|
19
|
-
* optimistic family must show structure IN FLIGHT — bypassing the
|
|
20
|
-
* transition stash exactly like emitPatchOptimistic. Two forms:
|
|
21
|
-
* - `ops` given (write site): `nextRows` is the draft's intended visible
|
|
22
|
-
* list, ops the identity diff against the pre-write optimistic view.
|
|
23
|
-
* - `ops === null` (revert site): RESYNC — the consumer rebuilds retention
|
|
24
|
-
* by row identity against the live post-revert view, resolved from the
|
|
25
|
-
* target at drain time (overrides are gone by then, so `pb ?? v` IS the
|
|
26
|
-
* committed truth). */
|
|
27
|
-
export declare function emitRowOpsOptimistic(t: StoreNextTarget, nextRows: any[] | null, ops: RowOps | null): void;
|
|
28
|
-
/** Test-only accounting probe: the live registration count must return to
|
|
29
|
-
* baseline across register/unbind/demote cycles. @internal */
|
|
30
|
-
export declare function patchCountForTests(): number;
|
|
31
|
-
export declare function hasPatches(): boolean;
|
|
32
|
-
export declare function registerPatch(record: any, fn: PatchFn): () => void;
|
|
33
|
-
/** Dual-driver bind probe (compiler runtime contract): when `record` is a
|
|
34
|
-
* patchable store record, returns its CURRENT raw backing (the driver's
|
|
35
|
-
* initial force-apply reads it directly — no proxy traffic, no tracking);
|
|
36
|
-
* returns undefined otherwise (driver falls back to the effect path).
|
|
37
|
-
* Not patchable: non-records, non-proxies, accessor-bearing records
|
|
38
|
-
* (patches read raw — getters need tracked evaluation), broken chains. */
|
|
39
|
-
export declare function patchableRaw(record: any): Record<PropertyKey, any> | undefined;
|
|
40
|
-
/** Accessor demotion (design §5): a record that acquires an accessor after
|
|
41
|
-
* registration stops being patchable — reads must go through tracked
|
|
42
|
-
* evaluation. Clears patches and repairs the global count; callers re-drive
|
|
43
|
-
* the pulled bodies (demoteToEffects). */
|
|
44
|
-
export declare function demotePatches(t: StoreNextTarget): PatchEntry[] | null;
|
|
45
|
-
/** The demotion re-drive (re-audit blocker 3): each pulled body becomes the
|
|
46
|
-
* SAME dual-driver effect fallback the web runtime would have chosen had the
|
|
47
|
-
* record carried the accessor at bind — a tracked compute pass (next === prev
|
|
48
|
-
* short-circuits every compare into a pure read THROUGH THE PROXY, so getter
|
|
49
|
-
* dependencies track) plus an untracked force-apply at effect timing.
|
|
50
|
-
*
|
|
51
|
-
* Creation is DEFERRED to the effect phase: the trap that discovers the
|
|
52
|
-
* accessor runs mid-draft, and an effect's initial pass must not read
|
|
53
|
-
* through the proxy inside the write window. The record's own transition
|
|
54
|
-
* for that draft is covered by the new effect's initial force-apply.
|
|
55
|
-
*
|
|
56
|
-
* Known edge (documented): a demoted LIST-ROW body re-drives under its
|
|
57
|
-
* registering owner (the list owner), so per-row severing on removal is
|
|
58
|
-
* lost for demoted rows — the effect lives until the LIST disposes. Rows
|
|
59
|
-
* only demote when user code defines an accessor on a row record at
|
|
60
|
-
* runtime. */
|
|
61
|
-
export declare function demoteToEffects(t: StoreNextTarget): void;
|
|
62
|
-
/** Structural ops for one keyed-array transition. `prefix` rows key-matched
|
|
63
|
-
* in place; for each later index i (absolute), `sources[i - prefix]` is the
|
|
64
|
-
* OLD index its row retained from, or -1 for a new row. `removed` holds the
|
|
65
|
-
* dropped old row values (unbind/teardown handles). Aligned value ticks emit
|
|
66
|
-
* NOTHING — ops exist only when structure changed. */
|
|
67
|
-
export interface RowOps {
|
|
68
|
-
prefix: number;
|
|
69
|
-
sources: number[];
|
|
70
|
-
removed: any[];
|
|
71
|
-
}
|
|
72
|
-
/** `ops === null` is the RESYNC form (optimistic revert): the consumer
|
|
73
|
-
* rebuilds retention by row identity against `next` (the live view). */
|
|
74
|
-
export type RowOpsFn = (next: any[], ops: RowOps | null) => void;
|
|
75
|
-
/** Register a structural-ops consumer on a keyed store array (the list
|
|
76
|
-
* container's channel — what `For` consumes through the seam). */
|
|
77
|
-
export declare function registerRowOps(array: any, fn: RowOpsFn): () => void;
|
|
78
|
-
/** Slot patches (shallow arrays) ride the same apply queue: the walk emits
|
|
79
|
-
* per aligned value-replaced slot; application happens at effect phase under
|
|
80
|
-
* the registration owner's lifetime. */
|
|
81
|
-
export declare function emitSlotPatch(t: StoreNextTarget, index: number, next: any, prev: any): void;
|
|
82
|
-
/** Slot patch for shallow arrays: the reconcile walk emits (index, next,
|
|
83
|
-
* prev) for KEY-ALIGNED value-replaced slots (structure rides row ops), and
|
|
84
|
-
* the emission queues through the patch apply queue — effect-phase timing,
|
|
85
|
-
* transition stamping, disposed-owner drop — like every other channel. */
|
|
86
|
-
export declare function registerSlotPatchNext(arr: any, fn: (index: number, next: any, prev: any) => void): () => void;
|
|
87
|
-
/** Row-ops ride the SAME apply queue/timing as record patches: transition-
|
|
88
|
-
* stamped, applied at effect phase, in emission order (structure before the
|
|
89
|
-
* new rows' own patches can exist; retained rows' value patches commute). */
|
|
90
|
-
export declare function emitRowOps(t: StoreNextTarget, next: any[], ops: RowOps): void;
|
|
91
|
-
export {};
|