@solidjs/signals 2.0.0-rc.19 → 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 +553 -264
- package/dist/dev.attribution.js +18 -18
- package/dist/dev.js +1030 -439
- package/dist/observe/affects.js +12 -2
- package/dist/observe/boundaries.js +168 -115
- package/dist/observe/core/async.js +57 -37
- package/dist/observe/core/attribution.js +6 -6
- package/dist/observe/core/constants.js +9 -1
- package/dist/observe/core/copies.js +10 -0
- package/dist/observe/core/core.js +261 -181
- package/dist/observe/core/effect.js +32 -27
- package/dist/observe/core/graph.js +7 -7
- package/dist/observe/core/heap.js +29 -29
- package/dist/observe/core/lanes.js +301 -101
- package/dist/observe/core/owner.js +13 -13
- package/dist/observe/core/scheduler.js +124 -69
- package/dist/observe/core/truth.js +9 -7
- package/dist/observe/core/verdict.js +160 -98
- package/dist/observe/deferred.js +1 -1
- package/dist/observe/index.js +2 -0
- package/dist/observe/map.js +120 -116
- package/dist/observe/reveal.js +48 -48
- package/dist/observe/signals.js +5 -5
- package/dist/observe/store/affects.js +2 -2
- package/dist/observe/store/optimistic.js +272 -176
- package/dist/observe/store/projection.js +21 -10
- package/dist/observe/store/reconcile.js +8 -2
- package/dist/observe/store/store.js +91 -55
- package/dist/observe/store/types.js +11 -1
- package/dist/observe/store/utils.js +1 -1
- package/dist/prod/affects.js +12 -2
- package/dist/prod/boundaries.js +164 -109
- package/dist/prod/core/async.js +201 -181
- package/dist/prod/core/constants.js +9 -1
- package/dist/prod/core/copies.js +10 -0
- package/dist/prod/core/core.js +244 -164
- package/dist/prod/core/dev.js +108 -3
- package/dist/prod/core/effect.js +28 -23
- package/dist/prod/core/graph.js +9 -9
- package/dist/prod/core/heap.js +16 -16
- package/dist/prod/core/identities.js +1 -1
- package/dist/prod/core/lanes.js +307 -95
- package/dist/prod/core/owner.js +22 -22
- package/dist/prod/core/scheduler.js +266 -211
- package/dist/prod/core/truth.js +9 -7
- package/dist/prod/core/verdict.js +161 -99
- package/dist/prod/deferred.js +1 -1
- package/dist/prod/index.js +2 -0
- package/dist/prod/map.js +78 -74
- package/dist/prod/reveal.js +34 -34
- package/dist/prod/signals.js +3 -3
- package/dist/prod/store/affects.js +15 -15
- package/dist/prod/store/optimistic.js +185 -89
- package/dist/prod/store/projection.js +49 -38
- package/dist/prod/store/reconcile.js +8 -2
- package/dist/prod/store/store.js +99 -63
- package/dist/prod/store/types.js +11 -1
- package/dist/types/affects.d.ts +3 -2
- package/dist/types/boundaries.d.ts +14 -2
- package/dist/types/core/async.d.ts +2 -1
- package/dist/types/core/constants.d.ts +8 -0
- package/dist/types/core/copies.d.ts +54 -0
- package/dist/types/core/core.d.ts +15 -0
- package/dist/types/core/dev.d.ts +1 -1
- package/dist/types/core/lanes.d.ts +8 -1
- package/dist/types/core/scheduler.d.ts +36 -4
- package/dist/types/core/truth.d.ts +3 -1
- package/dist/types/core/types.d.ts +6 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/store/hooks.d.ts +15 -1
- package/dist/types/store/store.d.ts +2 -1
- package/dist/types/store/target.d.ts +5 -0
- package/dist/types/store/types.d.ts +7 -0
- package/package.json +1 -1
package/dist/observe/reveal.js
CHANGED
|
@@ -43,11 +43,11 @@ const slotMinReady = t => isController(t) ? t.Qt() : ready(t);
|
|
|
43
43
|
if (isController(t)) {
|
|
44
44
|
t.$ = s;
|
|
45
45
|
t.ee = r;
|
|
46
|
-
t.
|
|
46
|
+
t.Jt();
|
|
47
47
|
// Released and ready — every slot of its own has shown — it graduates,
|
|
48
48
|
// as a boundary does when it shows content. Released at the frontier
|
|
49
49
|
// but not ready, it stays the parent's frontier.
|
|
50
|
-
if (!s && t.
|
|
50
|
+
if (!s && t.Xt && t._parent === e) t._parent = null;
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
53
|
if (t.$ !== s || t.ee !== r) {
|
|
@@ -58,98 +58,98 @@ const slotMinReady = t => isController(t) ? t.Qt() : ready(t);
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
class RevealController {
|
|
61
|
-
Xt;
|
|
62
61
|
Yt;
|
|
63
|
-
Zt
|
|
62
|
+
Zt;
|
|
63
|
+
ts=[];
|
|
64
64
|
/** The controller gating this one, until it releases this one. */
|
|
65
65
|
_parent=null;
|
|
66
66
|
/** The state a parent forces on this whole group. */
|
|
67
67
|
$=false;
|
|
68
68
|
ee=false;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
Xt=true;
|
|
70
|
+
es=true;
|
|
71
|
+
ss=false;
|
|
72
72
|
constructor(t, e) {
|
|
73
|
-
this.
|
|
74
|
-
this.
|
|
73
|
+
this.Yt = t;
|
|
74
|
+
this.Zt = e;
|
|
75
75
|
}
|
|
76
76
|
/** A slot that has left this controller's ownership: a boundary that has
|
|
77
77
|
* shown content, a nested group that is ready. Shown is shown — it counts
|
|
78
|
-
* as ready whatever happens to it later (a re-arm gates nobody else). */
|
|
78
|
+
* as ready whatever happens to it later (a re-arm gates nobody else). */ rs(t) {
|
|
79
79
|
return (isController(t) ? t._parent : t.v) !== this;
|
|
80
80
|
}
|
|
81
81
|
/** The slots this controller still owns, in registration order — the
|
|
82
|
-
* ones the order's state is forced on. */
|
|
83
|
-
for (let e = 0; e < this.
|
|
84
|
-
const s = this.
|
|
85
|
-
if (!this.
|
|
82
|
+
* ones the order's state is forced on. */ ns(t) {
|
|
83
|
+
for (let e = 0; e < this.ts.length; e++) {
|
|
84
|
+
const s = this.ts[e];
|
|
85
|
+
if (!this.rs(s) && t(s) === false) return false;
|
|
86
86
|
}
|
|
87
87
|
return true;
|
|
88
88
|
}
|
|
89
89
|
/** Readiness is judged over every slot, done ones as ready. */ Lt() {
|
|
90
|
-
for (let t = 0; t < this.
|
|
91
|
-
const e = this.
|
|
92
|
-
if (!this.
|
|
90
|
+
for (let t = 0; t < this.ts.length; t++) {
|
|
91
|
+
const e = this.ts[t];
|
|
92
|
+
if (!this.rs(e) && !slotReady(e)) return false;
|
|
93
93
|
}
|
|
94
94
|
return true;
|
|
95
95
|
}
|
|
96
96
|
/** Something visible to show under its own order — what an enclosing
|
|
97
97
|
* `together` waits for: `together` — every slot minimally ready;
|
|
98
98
|
* `sequential` — the first slot; `natural` — any. */ Qt() {
|
|
99
|
-
const t = untrack(this.
|
|
100
|
-
const e = this.
|
|
99
|
+
const t = untrack(this.Yt);
|
|
100
|
+
const e = this.ts;
|
|
101
101
|
if (e.length === 0) return true;
|
|
102
|
-
if (t === "sequential") return this.
|
|
102
|
+
if (t === "sequential") return this.rs(e[0]) || slotMinReady(e[0]);
|
|
103
103
|
for (let s = 0; s < e.length; s++) {
|
|
104
|
-
const r = this.
|
|
104
|
+
const r = this.rs(e[s]) || slotMinReady(e[s]);
|
|
105
105
|
if (t === "natural" ? r : !r) return t === "natural";
|
|
106
106
|
}
|
|
107
107
|
return t !== "natural";
|
|
108
108
|
}
|
|
109
109
|
te(t) {
|
|
110
|
-
if (this.
|
|
111
|
-
this.
|
|
110
|
+
if (this.ts.includes(t)) return;
|
|
111
|
+
this.ts.push(t);
|
|
112
112
|
// Gated from the start (collapsed in a collapsed sequential tail); the
|
|
113
113
|
// evaluation releases what the order allows.
|
|
114
|
-
const e = untrack(this.
|
|
114
|
+
const e = untrack(this.Yt) === "sequential" && !!untrack(this.Zt);
|
|
115
115
|
if (isController(t)) {
|
|
116
116
|
t._parent = this;
|
|
117
117
|
t.$ = true;
|
|
118
118
|
t.ee = e;
|
|
119
|
-
t.
|
|
119
|
+
t.Jt();
|
|
120
120
|
} else {
|
|
121
121
|
t.v = this;
|
|
122
122
|
t.$ = true;
|
|
123
123
|
t.ee = e;
|
|
124
124
|
}
|
|
125
|
-
untrack(() => this.
|
|
125
|
+
untrack(() => this.Jt());
|
|
126
126
|
}
|
|
127
127
|
oe(t) {
|
|
128
|
-
const e = this.
|
|
129
|
-
if (e >= 0) this.
|
|
130
|
-
untrack(() => this.
|
|
128
|
+
const e = this.ts.indexOf(t);
|
|
129
|
+
if (e >= 0) this.ts.splice(e, 1);
|
|
130
|
+
untrack(() => this.Jt());
|
|
131
131
|
}
|
|
132
132
|
/** Apply the order to the owned slots — or, gated by a parent, its state
|
|
133
|
-
* to all of them. */
|
|
134
|
-
if (this.
|
|
135
|
-
this.
|
|
136
|
-
const t = this.
|
|
137
|
-
const e = this.
|
|
133
|
+
* to all of them. */ Jt() {
|
|
134
|
+
if (this.ss) return;
|
|
135
|
+
this.ss = true;
|
|
136
|
+
const t = this.Xt;
|
|
137
|
+
const e = this.es;
|
|
138
138
|
try {
|
|
139
|
-
const t = untrack(this.
|
|
140
|
-
const e = t === "sequential" && !!untrack(this.
|
|
139
|
+
const t = untrack(this.Yt);
|
|
140
|
+
const e = t === "sequential" && !!untrack(this.Zt);
|
|
141
141
|
if (this.$) {
|
|
142
|
-
this.
|
|
142
|
+
this.ns(t => setSlotState(t, this, true, this.ee));
|
|
143
143
|
} else if (t === "natural") {
|
|
144
|
-
this.
|
|
144
|
+
this.ns(t => {
|
|
145
145
|
if (isController(t)) setSlotState(t, this, false, false); else setSlotState(t, this, !ready(t), false);
|
|
146
146
|
});
|
|
147
147
|
} else if (t === "together") {
|
|
148
|
-
const t = this.
|
|
149
|
-
this.
|
|
148
|
+
const t = this.ns(slotMinReady);
|
|
149
|
+
this.ns(e => setSlotState(e, this, !t, false));
|
|
150
150
|
} else {
|
|
151
151
|
let t = false;
|
|
152
|
-
this.
|
|
152
|
+
this.ns(s => {
|
|
153
153
|
if (t) return setSlotState(s, this, true, e);
|
|
154
154
|
if (slotReady(s)) return setSlotState(s, this, false, false);
|
|
155
155
|
t = true;
|
|
@@ -159,11 +159,11 @@ class RevealController {
|
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
161
|
} finally {
|
|
162
|
-
this.
|
|
163
|
-
this.
|
|
164
|
-
this.
|
|
162
|
+
this.Xt = this.Lt();
|
|
163
|
+
this.es = this.Qt();
|
|
164
|
+
this.ss = false;
|
|
165
165
|
}
|
|
166
|
-
if (this._parent !== null && (t !== this.
|
|
166
|
+
if (this._parent !== null && (t !== this.Xt || e !== this.es)) this._parent.Jt();
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
|
|
@@ -188,9 +188,9 @@ class RevealController {
|
|
|
188
188
|
return runWithOwner(s, () => {
|
|
189
189
|
const e = t();
|
|
190
190
|
const s = computed(() => {
|
|
191
|
-
i.Xt();
|
|
192
191
|
i.Yt();
|
|
193
|
-
i.
|
|
192
|
+
i.Zt();
|
|
193
|
+
i.Jt();
|
|
194
194
|
});
|
|
195
195
|
if (true) s._name = "reveal order";
|
|
196
196
|
if (r) {
|
|
@@ -206,7 +206,7 @@ class RevealController {
|
|
|
206
206
|
setRevealHooks({
|
|
207
207
|
te: (t, e) => t.te(e),
|
|
208
208
|
oe: (t, e) => t.oe(e),
|
|
209
|
-
P: t => t.
|
|
209
|
+
P: t => t.Jt()
|
|
210
210
|
});
|
|
211
211
|
|
|
212
212
|
export { createRevealOrder };
|
package/dist/observe/signals.js
CHANGED
|
@@ -335,7 +335,7 @@ function createMemo(e, t) {
|
|
|
335
335
|
* joined it (L2, born held — A29) and delivers at that commit: the
|
|
336
336
|
* committed view, never a foreign hold's unrevealed frame. */ function watch(e, t, r, n = 0, o, c = flushTransaction) {
|
|
337
337
|
if (n & CONFIG_AUTHORITATIVE) {
|
|
338
|
-
GlobalQueue.
|
|
338
|
+
GlobalQueue.un = truthRead;
|
|
339
339
|
GlobalQueue.tn = truthConfirmed;
|
|
340
340
|
}
|
|
341
341
|
// `config` is on the node for its first pass too (the pass runs inside
|
|
@@ -367,7 +367,7 @@ function createMemo(e, t) {
|
|
|
367
367
|
o?.(u);
|
|
368
368
|
queueMicrotask(() => t(u));
|
|
369
369
|
}, {
|
|
370
|
-
|
|
370
|
+
ct: n
|
|
371
371
|
}).l |= CONFIG_REDERIVE;
|
|
372
372
|
}
|
|
373
373
|
|
|
@@ -467,7 +467,7 @@ function createMemo(e, t) {
|
|
|
467
467
|
// guessed node's own re-ask is not answered by it (#3895): park
|
|
468
468
|
// on that flight, or reject with its error.
|
|
469
469
|
const e = read(t);
|
|
470
|
-
if (t.l & CONFIG_GUESS && t.m & (STATUS_PENDING | STATUS_ERROR)) throw t.T?.
|
|
470
|
+
if (t.l & CONFIG_GUESS && t.m & (STATUS_PENDING | STATUS_ERROR)) throw t.T?.U;
|
|
471
471
|
return e;
|
|
472
472
|
}, t => {
|
|
473
473
|
n(typeof e === "function" ? t : e);
|
|
@@ -545,7 +545,7 @@ function createMemo(e, t) {
|
|
|
545
545
|
// The flip, inside the pass of the flush carrying it: the flush
|
|
546
546
|
// joins the action's transaction, and what it staged is held and
|
|
547
547
|
// revealed with the action.
|
|
548
|
-
if (e && c !== null && globalQueue.
|
|
548
|
+
if (e && c !== null && globalQueue.Y && resolveTx(c).tt !== 0) joinFuture(c);
|
|
549
549
|
});
|
|
550
550
|
if (t?.timeout !== undefined) i = setTimeout(() => settle(() => n(new TimeoutError)), t.timeout);
|
|
551
551
|
if (o !== undefined) {
|
|
@@ -663,7 +663,7 @@ function createMemo(e, t) {
|
|
|
663
663
|
// still holding the optimistic value — reads do not pull (#3411). Fall
|
|
664
664
|
// to the next pass while the heap has work; `run` swapped the queue,
|
|
665
665
|
// so this lands there, and `enqueue` keeps the drain alive.
|
|
666
|
-
if (dirtyQueue.
|
|
666
|
+
if (dirtyQueue.yt >= dirtyQueue.Et) return globalQueue.enqueue(EFFECT_USER, fire);
|
|
667
667
|
// Unowned, out-of-band fire (no owner, or a children-forbidden one this
|
|
668
668
|
// one-shot must not bind to): a returned cleanup has no lifecycle to
|
|
669
669
|
// attach to. Reject it in dev; in production the return is simply
|
|
@@ -40,7 +40,7 @@ function scopeOf(e, o) {
|
|
|
40
40
|
if (n === undefined) scopes.set(e, n = {
|
|
41
41
|
oo: new Set,
|
|
42
42
|
no: [],
|
|
43
|
-
|
|
43
|
+
gt: o
|
|
44
44
|
});
|
|
45
45
|
return n;
|
|
46
46
|
}
|
|
@@ -94,7 +94,7 @@ function scopeOf(e, o) {
|
|
|
94
94
|
* backings (§7b): a view's backing is another store's proxy — marks cover
|
|
95
95
|
* the BASE raw, so every identity along the chain is checked. */ function covering(e, o, n) {
|
|
96
96
|
for (const [t, s] of scopes) {
|
|
97
|
-
if (t === n || s.
|
|
97
|
+
if (t === n || s.gt !== undefined && s.gt !== o) continue;
|
|
98
98
|
for (let o = e.v; ;) {
|
|
99
99
|
if (s.oo.has(o)) return t;
|
|
100
100
|
const e = o?.[$TARGET];
|