@solidjs/signals 2.0.0-rc.6 → 2.0.0-rc.8
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 +5243 -0
- package/dist/dev.attribution.js +2333 -0
- package/dist/dev.js +1758 -6621
- package/dist/observe/affects.js +127 -0
- package/dist/observe/attribution.js +1 -0
- package/dist/observe/boundaries.js +586 -0
- package/dist/observe/core/action.js +167 -0
- package/dist/observe/core/async.js +736 -0
- package/dist/observe/core/attribution-hooks.js +60 -0
- package/dist/observe/core/attribution.js +2318 -0
- package/dist/{types-cjs/core/constants.d.cts → observe/core/constants.js} +135 -71
- package/dist/{types-cjs/core/context.d.cts → observe/core/context.js} +37 -12
- package/dist/observe/core/core.js +1289 -0
- package/dist/observe/core/dev.js +232 -0
- package/dist/observe/core/effect.js +179 -0
- package/dist/observe/core/error.js +80 -0
- package/dist/observe/core/external.js +98 -0
- package/dist/observe/core/graph.js +155 -0
- package/dist/observe/core/heap.js +147 -0
- package/dist/observe/core/invariants.js +43 -0
- package/dist/observe/core/lanes.js +168 -0
- package/dist/observe/core/optimistic.js +438 -0
- package/dist/observe/core/owner.js +308 -0
- package/dist/observe/core/scheduler.js +1190 -0
- package/dist/observe/core/verdict.js +551 -0
- package/dist/observe/index.js +55 -0
- package/dist/observe/map.js +482 -0
- package/dist/{types-cjs/signals.d.cts → observe/signals.js} +305 -317
- package/dist/observe/store/index.js +38 -0
- package/dist/observe/store/next/optimistic.js +651 -0
- package/dist/observe/store/next/projection.js +242 -0
- package/dist/observe/store/next/reconcile.js +373 -0
- package/dist/observe/store/next/store.js +2213 -0
- package/dist/observe/store/next/target.js +51 -0
- package/dist/observe/store/store.js +323 -0
- package/dist/observe/store/storePath.js +103 -0
- package/dist/observe/store/utils.js +210 -0
- package/dist/prod/attribution.js +32 -0
- package/dist/prod/boundaries.js +3 -1
- package/dist/prod/core/action.js +52 -32
- package/dist/prod/core/async.js +177 -128
- package/dist/prod/core/attribution-hooks.js +3 -0
- package/dist/prod/core/constants.js +32 -1
- package/dist/prod/core/context.js +10 -16
- package/dist/prod/core/core.js +505 -286
- package/dist/prod/core/dev.js +2 -0
- package/dist/prod/core/effect.js +72 -43
- package/dist/prod/core/external.js +2 -2
- package/dist/prod/core/graph.js +40 -36
- package/dist/prod/core/heap.js +50 -51
- package/dist/prod/core/lanes.js +43 -22
- package/dist/prod/core/optimistic.js +224 -80
- package/dist/prod/core/owner.js +43 -39
- package/dist/prod/core/scheduler.js +347 -232
- package/dist/prod/core/verdict.js +71 -74
- package/dist/prod/index.js +9 -5
- package/dist/prod/map.js +311 -150
- package/dist/prod/signals.js +52 -38
- package/dist/prod/store/next/optimistic.js +127 -131
- package/dist/prod/store/next/projection.js +3 -3
- package/dist/prod/store/next/reconcile.js +149 -294
- package/dist/prod/store/next/store.js +694 -380
- package/dist/prod/store/next/target.js +32 -10
- package/dist/prod/store/store.js +12 -14
- package/dist/prod/store/utils.js +36 -27
- package/dist/types/attribution.d.ts +15 -0
- package/dist/types/attribution.prod.d.ts +13 -0
- package/dist/types/core/async.d.ts +1 -1
- package/dist/types/core/attribution-hooks.d.ts +183 -6
- package/dist/types/core/attribution.d.ts +435 -24
- package/dist/types/core/constants.d.ts +31 -0
- package/dist/types/core/core.d.ts +19 -3
- package/dist/types/core/dev.d.ts +165 -26
- package/dist/types/core/effect.d.ts +8 -1
- package/dist/types/core/heap.d.ts +5 -3
- package/dist/types/core/index.d.ts +2 -1
- package/dist/types/core/invariants.d.ts +1 -1
- package/dist/types/core/lanes.d.ts +17 -0
- package/dist/types/core/scheduler.d.ts +69 -4
- package/dist/types/core/types.d.ts +29 -9
- package/dist/types/index.d.ts +9 -2
- package/dist/types/map.d.ts +2 -0
- package/dist/types/signals.d.ts +10 -0
- package/dist/types/store/index.d.ts +4 -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 +8 -9
- package/dist/types/store/next/target.d.ts +56 -55
- package/dist/types/store/store.d.ts +14 -9
- package/dist/types/store/utils.d.ts +7 -0
- package/package.json +21 -16
- package/dist/node.cjs +0 -11121
- 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/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 -23
- package/dist/types-cjs/core/attribution-hooks.d.cts +0 -63
- package/dist/types-cjs/core/attribution.d.cts +0 -239
- package/dist/types-cjs/core/core.d.cts +0 -176
- package/dist/types-cjs/core/dev.d.cts +0 -95
- package/dist/types-cjs/core/effect.d.cts +0 -30
- package/dist/types-cjs/core/error.d.cts +0 -56
- package/dist/types-cjs/core/external.d.cts +0 -15
- package/dist/types-cjs/core/graph.d.cts +0 -28
- 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 -231
- package/dist/types-cjs/core/types.d.cts +0 -204
- 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/store/index.d.cts +0 -21
- package/dist/types-cjs/store/next/optimistic.d.cts +0 -23
- package/dist/types-cjs/store/next/patch-hooks.d.cts +0 -41
- package/dist/types-cjs/store/next/patch.d.cts +0 -91
- package/dist/types-cjs/store/next/projection.d.cts +0 -8
- package/dist/types-cjs/store/next/reconcile.d.cts +0 -17
- package/dist/types-cjs/store/next/store.d.cts +0 -127
- package/dist/types-cjs/store/next/target.d.cts +0 -192
- 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
package/dist/prod/core/owner.js
CHANGED
|
@@ -12,7 +12,7 @@ const PENDING_OWNER = {};
|
|
|
12
12
|
|
|
13
13
|
// Dummy owner to trigger store's read() path
|
|
14
14
|
function markDisposal(e) {
|
|
15
|
-
let t = e.
|
|
15
|
+
let t = e.Ye;
|
|
16
16
|
while (t) {
|
|
17
17
|
const e = t.ie;
|
|
18
18
|
t.ie = e | REACTIVE_ZOMBIE;
|
|
@@ -26,7 +26,7 @@ function markDisposal(e) {
|
|
|
26
26
|
if (e & REACTIVE_IN_HEAP) insertIntoHeap(t, zombieQueue); else insertIntoHeapHeight(t, zombieQueue);
|
|
27
27
|
}
|
|
28
28
|
markDisposal(t);
|
|
29
|
-
t = t.
|
|
29
|
+
t = t.Ze;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -52,12 +52,12 @@ function disposeChildren(e, t = false, n) {
|
|
|
52
52
|
// edge). Snap runs after the DISPOSED flag is set so the oracle reads
|
|
53
53
|
// false, and notifies subscribers still watching the companion.
|
|
54
54
|
const t = e;
|
|
55
|
-
if (t.o?.
|
|
55
|
+
if (t.o?.Le || t.o?.Qe) GlobalQueue.un(t);
|
|
56
56
|
}
|
|
57
|
-
if (t && e.oe && e.o !== null) e.o.
|
|
58
|
-
let o = n ? e.o?.
|
|
57
|
+
if (t && e.oe && e.o !== null) e.o.Pe = null;
|
|
58
|
+
let o = n ? e.o?.Xe ?? null : e.Ye;
|
|
59
59
|
while (o) {
|
|
60
|
-
const e = o.
|
|
60
|
+
const e = o.Ze;
|
|
61
61
|
const t = o;
|
|
62
62
|
// Owner teardown is death regardless of the child's own lifecycle
|
|
63
63
|
// (#3024): strip AUTO_DISPOSE so a post-disposal read freezes at the
|
|
@@ -80,34 +80,34 @@ function disposeChildren(e, t = false, n) {
|
|
|
80
80
|
o = e;
|
|
81
81
|
}
|
|
82
82
|
if (n) {
|
|
83
|
-
if (e.o !== null) e.o.
|
|
83
|
+
if (e.o !== null) e.o.Xe = null;
|
|
84
84
|
} else {
|
|
85
|
-
e.
|
|
86
|
-
e
|
|
85
|
+
e.Ye = null;
|
|
86
|
+
e.$e = 0;
|
|
87
87
|
}
|
|
88
88
|
// O(1) splice out of parent's chain on individual dispose. Skipped during
|
|
89
89
|
// batch dispose (parent already disposed) and zombie disposal (node sits on
|
|
90
90
|
// parent's _pendingFirstChild). We leave node._nextSibling intact so outer
|
|
91
91
|
// walks that already advanced past us still reach later siblings.
|
|
92
|
-
if (t && !n && !(i & REACTIVE_ZOMBIE) && e.
|
|
93
|
-
const t = e.
|
|
94
|
-
const n = e.
|
|
95
|
-
if (t !== null) t.
|
|
96
|
-
if (n !== null) n.
|
|
97
|
-
e.
|
|
92
|
+
if (t && !n && !(i & REACTIVE_ZOMBIE) && e.qe !== null && !(e.qe.ie & REACTIVE_DISPOSED)) {
|
|
93
|
+
const t = e.St;
|
|
94
|
+
const n = e.Ze;
|
|
95
|
+
if (t !== null) t.Ze = n; else e.qe.Ye = n;
|
|
96
|
+
if (n !== null) n.St = t;
|
|
97
|
+
e.St = null;
|
|
98
98
|
}
|
|
99
99
|
runDisposal(e, n);
|
|
100
100
|
// Final effect-returned cleanup fires at true disposal, after `_disposal`
|
|
101
101
|
// to mirror rerun ordering (compute-phase teardown first, cleanup last).
|
|
102
|
-
if (t && e.
|
|
103
|
-
const t = e.
|
|
104
|
-
e.
|
|
102
|
+
if (t && e.Ht) {
|
|
103
|
+
const t = e.Ht;
|
|
104
|
+
e.Ht = undefined;
|
|
105
105
|
t();
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
function runDisposal(e, t) {
|
|
110
|
-
let n = t ? e.o?.
|
|
110
|
+
let n = t ? e.o?.Je : e.we;
|
|
111
111
|
if (!n) return;
|
|
112
112
|
if (Array.isArray(n)) {
|
|
113
113
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -118,14 +118,14 @@ function runDisposal(e, t) {
|
|
|
118
118
|
n.call(n);
|
|
119
119
|
}
|
|
120
120
|
if (t) {
|
|
121
|
-
if (e.o !== null) e.o.
|
|
122
|
-
} else e.
|
|
121
|
+
if (e.o !== null) e.o.Je = null;
|
|
122
|
+
} else e.we = null;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
function childId(e, t) {
|
|
126
126
|
let n = e;
|
|
127
|
-
while (n.T & CONFIG_TRANSPARENT && n.
|
|
128
|
-
if (n.id != null) return formatId(n.id, t ? n
|
|
127
|
+
while (n.T & CONFIG_TRANSPARENT && n.qe) n = n.qe;
|
|
128
|
+
if (n.id != null) return formatId(n.id, t ? n.$e++ : n.$e);
|
|
129
129
|
throw new Error("");
|
|
130
130
|
}
|
|
131
131
|
|
|
@@ -206,7 +206,7 @@ function formatId(e, t) {
|
|
|
206
206
|
* checks. `cleanup()` is the unchecked primitive used by internals.
|
|
207
207
|
*/ function cleanup(e) {
|
|
208
208
|
if (!context) return e;
|
|
209
|
-
if (!context.
|
|
209
|
+
if (!context.we) context.we = e; else if (Array.isArray(context.we)) context.we.push(e); else context.we = [ context.we, e ];
|
|
210
210
|
return e;
|
|
211
211
|
}
|
|
212
212
|
|
|
@@ -243,30 +243,34 @@ function disposeRootSelf(e = true) {
|
|
|
243
243
|
*/ function createOwner(e) {
|
|
244
244
|
const t = context;
|
|
245
245
|
const n = e?.transparent ?? false;
|
|
246
|
-
|
|
246
|
+
// Prod and observe boilerplates (see core.ts computed()). The observe
|
|
247
|
+
// literal carries the `_name` slot the rendering layer fills with the
|
|
248
|
+
// component label (`owner._name = "<App>"`) — a slot, so labelling a root
|
|
249
|
+
// is a plain store rather than a shape fork between labelled and plain roots.
|
|
250
|
+
const i = {
|
|
247
251
|
id: inheritId(e, n, t),
|
|
248
252
|
T: n ? CONFIG_TRANSPARENT : 0,
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
gt: true,
|
|
254
|
+
bt: t?.gt ? t.bt : t,
|
|
255
|
+
Ye: null,
|
|
256
|
+
Ze: null,
|
|
257
|
+
St: null,
|
|
258
|
+
we: null,
|
|
255
259
|
C: t?.C ?? globalQueue,
|
|
256
|
-
|
|
257
|
-
|
|
260
|
+
xe: t?.xe || defaultContext,
|
|
261
|
+
$e: 0,
|
|
258
262
|
o: null,
|
|
259
|
-
|
|
263
|
+
qe: t,
|
|
260
264
|
dispose: disposeRootSelf
|
|
261
265
|
};
|
|
262
266
|
if (t) {
|
|
263
|
-
const e = t.
|
|
267
|
+
const e = t.Ye;
|
|
264
268
|
if (e === null) {
|
|
265
|
-
t.
|
|
269
|
+
t.Ye = i;
|
|
266
270
|
} else {
|
|
267
|
-
i.
|
|
268
|
-
e.
|
|
269
|
-
t.
|
|
271
|
+
i.Ze = e;
|
|
272
|
+
e.St = i;
|
|
273
|
+
t.Ye = i;
|
|
270
274
|
}
|
|
271
275
|
}
|
|
272
276
|
return i;
|