@solidjs/signals 0.9.3 → 0.9.5

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/node.cjs CHANGED
@@ -80,8 +80,8 @@ function deleteFromHeap(e, t) {
80
80
  e.p = undefined;
81
81
  }
82
82
  function markHeap(e) {
83
- if (e.O) return;
84
- e.O = true;
83
+ if (e.m) return;
84
+ e.m = true;
85
85
  for (let t = 0; t <= e._; t++) {
86
86
  for (let n = e.l[t]; n !== undefined; n = n.p) {
87
87
  if (n.S & i) markNode(n);
@@ -92,19 +92,19 @@ function markNode(e, r = n) {
92
92
  const i = e.S;
93
93
  if ((i & (t | n)) >= r) return;
94
94
  e.S = (i & -4) | r;
95
- for (let n = e.m; n !== null; n = n.C) {
95
+ for (let n = e.O; n !== null; n = n.C) {
96
96
  markNode(n.N, t);
97
97
  }
98
98
  if (e.k !== null) {
99
99
  for (let n = e.k; n !== null; n = n.j) {
100
- for (let e = n.m; e !== null; e = e.C) {
100
+ for (let e = n.O; e !== null; e = e.C) {
101
101
  markNode(e.N, t);
102
102
  }
103
103
  }
104
104
  }
105
105
  }
106
106
  function runHeap(e, t) {
107
- e.O = false;
107
+ e.m = false;
108
108
  for (e.P = 0; e.P <= e._; e.P++) {
109
109
  let n = e.l[e.P];
110
110
  while (n !== undefined) {
@@ -125,36 +125,36 @@ function adjustHeight(e, t) {
125
125
  }
126
126
  if (e.o !== n) {
127
127
  e.o = n;
128
- for (let n = e.m; n !== null; n = n.C) {
128
+ for (let n = e.O; n !== null; n = n.C) {
129
129
  insertIntoHeapHeight(n.N, t);
130
130
  }
131
131
  }
132
132
  }
133
133
  const _ = new Set();
134
134
  let S = false;
135
- const b = { l: new Array(2e3).fill(undefined), O: false, P: 0, _: 0 };
136
- const O = { l: new Array(2e3).fill(undefined), O: false, P: 0, _: 0 };
137
- let m = 0;
135
+ const b = { l: new Array(2e3).fill(undefined), m: false, P: 0, _: 0 };
136
+ const m = { l: new Array(2e3).fill(undefined), m: false, P: 0, _: 0 };
137
+ let O = 0;
138
138
  let x = null;
139
- let C = false;
139
+ let v = false;
140
140
  function schedule() {
141
- if (C) return;
142
- C = true;
143
- if (!v.R) Promise.resolve().then(() => queueMicrotask(flush));
141
+ if (v) return;
142
+ v = true;
143
+ if (!C.R) Promise.resolve().then(() => queueMicrotask(flush));
144
144
  }
145
145
  class Queue {
146
146
  i = null;
147
- V = [[], []];
148
- q = [];
149
- created = m;
147
+ T = [[], []];
148
+ V = [];
149
+ created = O;
150
150
  addChild(e) {
151
- this.q.push(e);
151
+ this.V.push(e);
152
152
  e.i = this;
153
153
  }
154
154
  removeChild(e) {
155
- const t = this.q.indexOf(e);
155
+ const t = this.V.indexOf(e);
156
156
  if (t >= 0) {
157
- this.q.splice(t, 1);
157
+ this.V.splice(t, 1);
158
158
  e.i = null;
159
159
  }
160
160
  }
@@ -163,47 +163,47 @@ class Queue {
163
163
  return false;
164
164
  }
165
165
  run(e) {
166
- if (this.V[e - 1].length) {
167
- const t = this.V[e - 1];
168
- this.V[e - 1] = [];
166
+ if (this.T[e - 1].length) {
167
+ const t = this.T[e - 1];
168
+ this.T[e - 1] = [];
169
169
  runQueue(t, e);
170
170
  }
171
- for (let t = 0; t < this.q.length; t++) {
172
- this.q[t].run(e);
171
+ for (let t = 0; t < this.V.length; t++) {
172
+ this.V[t].run(e);
173
173
  }
174
174
  }
175
175
  enqueue(e, t) {
176
- if (e) this.V[e - 1].push(t);
176
+ if (e) this.T[e - 1].push(t);
177
177
  schedule();
178
178
  }
179
179
  stashQueues(e) {
180
- e.V[0].push(...this.V[0]);
181
- e.V[1].push(...this.V[1]);
182
- this.V = [[], []];
183
- for (let t = 0; t < this.q.length; t++) {
184
- let n = this.q[t];
185
- let r = e.q[t];
180
+ e.T[0].push(...this.T[0]);
181
+ e.T[1].push(...this.T[1]);
182
+ this.T = [[], []];
183
+ for (let t = 0; t < this.V.length; t++) {
184
+ let n = this.V[t];
185
+ let r = e.V[t];
186
186
  if (!r) {
187
- r = { V: [[], []], q: [] };
188
- e.q[t] = r;
187
+ r = { T: [[], []], V: [] };
188
+ e.V[t] = r;
189
189
  }
190
190
  n.stashQueues(r);
191
191
  }
192
192
  }
193
193
  restoreQueues(e) {
194
- this.V[0].push(...e.V[0]);
195
- this.V[1].push(...e.V[1]);
196
- for (let t = 0; t < e.q.length; t++) {
197
- const n = e.q[t];
198
- let r = this.q[t];
194
+ this.T[0].push(...e.T[0]);
195
+ this.T[1].push(...e.T[1]);
196
+ for (let t = 0; t < e.V.length; t++) {
197
+ const n = e.V[t];
198
+ let r = this.V[t];
199
199
  if (r) r.restoreQueues(n);
200
200
  }
201
201
  }
202
202
  }
203
203
  class GlobalQueue extends Queue {
204
204
  R = false;
205
+ q = [];
205
206
  M = [];
206
- T = [];
207
207
  static D;
208
208
  static B;
209
209
  flush() {
@@ -214,26 +214,26 @@ class GlobalQueue extends Queue {
214
214
  if (x) {
215
215
  if (!transitionComplete(x)) {
216
216
  let e = x;
217
- runHeap(O, GlobalQueue.D);
218
- this.M = [];
217
+ runHeap(m, GlobalQueue.D);
218
+ this.q = [];
219
219
  this.stashQueues(x.queueStash);
220
- m++;
221
- C = false;
220
+ O++;
221
+ v = false;
222
222
  runTransitionPending(x.pendingNodes, true);
223
223
  x = null;
224
224
  runOptimistic(e);
225
225
  return;
226
226
  }
227
- this.M.push(...x.pendingNodes);
228
- this.T !== x.optimisticNodes && this.T.push(...x.optimisticNodes);
227
+ this.q !== x.pendingNodes && this.q.push(...x.pendingNodes);
228
+ this.M !== x.optimisticNodes && this.M.push(...x.optimisticNodes);
229
229
  this.restoreQueues(x.queueStash);
230
230
  _.delete(x);
231
231
  x = null;
232
- runTransitionPending(this.M, false);
233
- } else if (_.size) runHeap(O, GlobalQueue.D);
232
+ runTransitionPending(this.q, false);
233
+ } else if (_.size) runHeap(m, GlobalQueue.D);
234
234
  runOptimistic();
235
- m++;
236
- C = false;
235
+ O++;
236
+ v = false;
237
237
  this.run(d);
238
238
  this.run(h);
239
239
  } finally {
@@ -253,44 +253,51 @@ class GlobalQueue extends Queue {
253
253
  return false;
254
254
  }
255
255
  initTransition(e) {
256
- if (x && x.time === m) return;
256
+ if (e) e = currentTransition(e);
257
+ if (e && e === x) return;
258
+ if (!e && x && x.time === O) return;
257
259
  if (!x) {
258
- x = e?.G ?? {
259
- time: m,
260
+ x = e ?? {
261
+ time: O,
260
262
  pendingNodes: [],
261
263
  asyncNodes: [],
262
264
  optimisticNodes: [],
263
265
  actions: [],
264
- queueStash: { V: [[], []], q: [] },
266
+ queueStash: { T: [[], []], V: [] },
265
267
  done: false
266
268
  };
269
+ } else if (e) {
270
+ x.done = e;
271
+ e.actions.push(...x.actions);
272
+ _.delete(x);
273
+ x = e;
267
274
  }
268
275
  _.add(x);
269
- x.time = m;
270
- for (let e = 0; e < this.M.length; e++) {
271
- const t = this.M[e];
276
+ x.time = O;
277
+ for (let e = 0; e < this.q.length; e++) {
278
+ const t = this.q[e];
272
279
  t.G = x;
273
280
  x.pendingNodes.push(t);
274
281
  }
275
- for (let e = 0; e < this.T.length; e++) {
276
- const t = this.T[e];
282
+ for (let e = 0; e < this.M.length; e++) {
283
+ const t = this.M[e];
277
284
  t.G = x;
278
285
  x.optimisticNodes.push(t);
279
286
  }
280
- this.M = x.pendingNodes;
281
- this.T = x.optimisticNodes;
287
+ this.q = x.pendingNodes;
288
+ this.M = x.optimisticNodes;
282
289
  }
283
290
  }
284
291
  function notifySubs(e) {
285
- for (let t = e.m; t !== null; t = t.C) {
286
- const e = t.N.S & o ? O : b;
292
+ for (let t = e.O; t !== null; t = t.C) {
293
+ const e = t.N.S & o ? m : b;
287
294
  if (e.P > t.N.o) e.P = t.N.o;
288
295
  insertIntoHeap(t.N, e);
289
296
  }
290
297
  }
291
298
  function runOptimistic(e = null) {
292
299
  let t = !e;
293
- const n = v.T;
300
+ const n = C.M;
294
301
  S = true;
295
302
  for (let t = 0; t < n.length; t++) {
296
303
  const r = n[t];
@@ -301,13 +308,13 @@ function runOptimistic(e = null) {
301
308
  r.G = e;
302
309
  notifySubs(r);
303
310
  }
304
- v.T = [];
311
+ C.M = [];
305
312
  if (b._ >= b.P) {
306
313
  t = true;
307
314
  runHeap(b, GlobalQueue.D);
308
315
  }
309
316
  S = false;
310
- t && runPending(v.M);
317
+ t && runPending(C.q);
311
318
  }
312
319
  function runPending(e) {
313
320
  for (let t = 0; t < e.length; t++) {
@@ -326,13 +333,16 @@ function runTransitionPending(e, t) {
326
333
  for (let e = 0; e < n.length; e++) {
327
334
  const r = n[e];
328
335
  r.G = x;
329
- if (r.Y) r.Y.Z(t);
336
+ if (r.Y) {
337
+ r.Y.G = x;
338
+ r.Y.Z(t);
339
+ }
330
340
  }
331
341
  }
332
- const v = new GlobalQueue();
342
+ const C = new GlobalQueue();
333
343
  function flush() {
334
- while (C) {
335
- v.flush();
344
+ while (v) {
345
+ C.flush();
336
346
  }
337
347
  }
338
348
  function runQueue(e, t) {
@@ -351,10 +361,15 @@ function transitionComplete(e) {
351
361
  t && (e.done = true);
352
362
  return t;
353
363
  }
364
+ function currentTransition(e) {
365
+ while (e.done && typeof e.done === "object") e = e.done;
366
+ return e;
367
+ }
354
368
  function runInTransition(e, t) {
355
369
  const n = x;
370
+ x = null;
356
371
  try {
357
- x = e;
372
+ x = currentTransition(e);
358
373
  return t();
359
374
  } finally {
360
375
  x = n;
@@ -363,7 +378,7 @@ function runInTransition(e, t) {
363
378
  function action(e) {
364
379
  return (...t) => {
365
380
  const n = e(...t);
366
- v.initTransition();
381
+ C.initTransition();
367
382
  let r = x;
368
383
  r.actions.push(n);
369
384
  const step = e => {
@@ -373,6 +388,7 @@ function action(e) {
373
388
  };
374
389
  const process = e => {
375
390
  if (e.done) {
391
+ r = currentTransition(r);
376
392
  r.actions.splice(r.actions.indexOf(n), 1);
377
393
  x = r;
378
394
  schedule();
@@ -380,7 +396,7 @@ function action(e) {
380
396
  return;
381
397
  }
382
398
  const t = e.value;
383
- if (t instanceof Promise) return t.then(step);
399
+ if (t instanceof Promise) return t.then(e => runInTransition(r, () => step(e)));
384
400
  runInTransition(r, () => step(t));
385
401
  };
386
402
  runInTransition(r, () => step());
@@ -397,8 +413,8 @@ let A = null;
397
413
  function recompute(t, n = false) {
398
414
  const i = t.J && t.G != x;
399
415
  if (!n) {
400
- if (t.G && x !== t.G && !i) v.initTransition(t);
401
- deleteFromHeap(t, t.S & o ? O : b);
416
+ if (t.G && x !== t.G && !i) C.initTransition(t.G);
417
+ deleteFromHeap(t, t.S & o ? m : b);
402
418
  if (t.G) disposeChildren(t);
403
419
  else {
404
420
  markDisposal(t);
@@ -412,7 +428,7 @@ function recompute(t, n = false) {
412
428
  A = t;
413
429
  t.ie = null;
414
430
  t.S = r;
415
- t.se = m;
431
+ t.se = O;
416
432
  let u = t.U === p || (t.oe && t.G) ? t.L : t.U;
417
433
  let d = t.o;
418
434
  let h = t.$;
@@ -446,6 +462,7 @@ function recompute(t, n = false) {
446
462
  }
447
463
  const w = !t.ue || !t.ue(t.U === p || (t.oe && t.G) || i ? t.L : t.U, u);
448
464
  const _ = t.$ !== h || t.K !== y;
465
+ if (t.k && t.$ & f && x) x.asyncNodes.push(t);
449
466
  t.le?.(_, h);
450
467
  if (w || _) {
451
468
  if (w) {
@@ -455,12 +472,12 @@ function recompute(t, n = false) {
455
472
  }
456
473
  (!t.oe || S) && notifySubs(t);
457
474
  } else if (t.o != d) {
458
- for (let e = t.m; e !== null; e = e.C) {
459
- insertIntoHeapHeight(e.N, e.N.S & o ? O : b);
475
+ for (let e = t.O; e !== null; e = e.C) {
476
+ insertIntoHeapHeight(e.N, e.N.S & o ? m : b);
460
477
  }
461
478
  }
462
- t.oe && !S && v.T.push(t);
463
- (!n || t.$ & f) && !t.G && v.M.push(t);
479
+ t.oe && !S && C.M.push(t);
480
+ (!n || t.$ & f) && !t.G && C.q.push(t);
464
481
  t.G && i && runInTransition(t.G, () => recompute(t));
465
482
  }
466
483
  function handleAsync(e, t, n) {
@@ -475,14 +492,14 @@ function handleAsync(e, t, n) {
475
492
  if (i) {
476
493
  t.then(r => {
477
494
  if (e.ce !== t) return;
478
- v.initTransition(e);
479
- n?.(r) ?? setSignal(e, () => r);
495
+ C.initTransition(e.G);
496
+ n ? n(r) : setSignal(e, () => r);
480
497
  flush();
481
498
  }).catch(n => {
482
499
  if (e.ce !== t) return;
483
- v.initTransition(e);
500
+ C.initTransition(e.G);
484
501
  setStatusFlags(e, c, n);
485
- e.se = m;
502
+ e.se = O;
486
503
  notifySubs(e);
487
504
  schedule();
488
505
  flush();
@@ -492,22 +509,22 @@ function handleAsync(e, t, n) {
492
509
  try {
493
510
  for await (let r of t) {
494
511
  if (e.ce !== t) return;
495
- v.initTransition(e);
496
- n?.(r) ?? setSignal(e, () => r);
512
+ C.initTransition(e.G);
513
+ n ? n(r) : setSignal(e, () => r);
497
514
  flush();
498
515
  }
499
516
  } catch (n) {
500
517
  if (e.ce !== t) return;
501
- v.initTransition(e);
518
+ C.initTransition(e.G);
502
519
  setStatusFlags(e, c, n);
503
- e.se = m;
520
+ e.se = O;
504
521
  notifySubs(e);
505
522
  schedule();
506
523
  flush();
507
524
  }
508
525
  })();
509
526
  }
510
- v.initTransition(e);
527
+ C.initTransition(e.G);
511
528
  throw new NotReadyError(A);
512
529
  }
513
530
  function updateIfNecessary(r) {
@@ -537,7 +554,7 @@ function unlinkSubs(e) {
537
554
  else t.de = i;
538
555
  if (i !== null) i.C = r;
539
556
  else {
540
- t.m = r;
557
+ t.O = r;
541
558
  if (r === null) {
542
559
  t.he?.();
543
560
  t.H && !t.pe && unobserved(t);
@@ -546,7 +563,7 @@ function unlinkSubs(e) {
546
563
  return n;
547
564
  }
548
565
  function unobserved(e) {
549
- deleteFromHeap(e, e.S & o ? O : b);
566
+ deleteFromHeap(e, e.S & o ? m : b);
550
567
  let t = e.W;
551
568
  while (t !== null) {
552
569
  t = unlinkSubs(t);
@@ -572,7 +589,7 @@ function link(e, t) {
572
589
  if (n !== null) n.A = u;
573
590
  else t.W = u;
574
591
  if (o !== null) o.C = u;
575
- else e.m = u;
592
+ else e.O = u;
576
593
  }
577
594
  function isValidLink(e, t) {
578
595
  const n = t.ie;
@@ -596,7 +613,7 @@ function markDisposal(e) {
596
613
  t.S |= o;
597
614
  if (t.S & i) {
598
615
  deleteFromHeap(t, b);
599
- insertIntoHeap(t, O);
616
+ insertIntoHeap(t, m);
600
617
  }
601
618
  markDisposal(t);
602
619
  t = t.ye;
@@ -619,7 +636,7 @@ function disposeChildren(e, t = false, n) {
619
636
  const e = r.ye;
620
637
  if (r.W) {
621
638
  const e = r;
622
- deleteFromHeap(e, e.S & o ? O : b);
639
+ deleteFromHeap(e, e.S & o ? m : b);
623
640
  let t = e.W;
624
641
  do {
625
642
  t = unlinkSubs(t);
@@ -667,7 +684,7 @@ function computed(t, n, r) {
667
684
  we: !!r?.pureWrite,
668
685
  he: r?.unobserved,
669
686
  te: null,
670
- _e: A?._e ?? v,
687
+ _e: A?._e ?? C,
671
688
  Se: A?.Se ?? g,
672
689
  ge: 0,
673
690
  H: t,
@@ -678,14 +695,14 @@ function computed(t, n, r) {
678
695
  h: null,
679
696
  W: null,
680
697
  ie: null,
681
- m: null,
698
+ O: null,
682
699
  de: null,
683
700
  i: A,
684
701
  ye: null,
685
702
  re: null,
686
703
  S: e,
687
704
  $: a,
688
- se: m,
705
+ se: O,
689
706
  U: p,
690
707
  ee: null,
691
708
  ne: null,
@@ -715,10 +732,10 @@ function signal(e, t, n = null) {
715
732
  we: !!t?.pureWrite,
716
733
  he: t?.unobserved,
717
734
  L: e,
718
- m: null,
735
+ O: null,
719
736
  de: null,
720
737
  $: l,
721
- se: m,
738
+ se: O,
722
739
  F: n,
723
740
  j: n?.k || null,
724
741
  U: p
@@ -748,9 +765,9 @@ function read(e) {
748
765
  const n = e.F || e;
749
766
  if (n.H) {
750
767
  const r = e.S & o;
751
- if (n.o >= (r ? O.P : b.P)) {
768
+ if (n.o >= (r ? m.P : b.P)) {
752
769
  markNode(t);
753
- markHeap(r ? O : b);
770
+ markHeap(r ? m : b);
754
771
  updateIfNecessary(n);
755
772
  }
756
773
  const i = n.o;
@@ -790,7 +807,7 @@ function read(e) {
790
807
  }
791
808
  }
792
809
  if (e.$ & c) {
793
- if (e.se < m) {
810
+ if (e.se < O) {
794
811
  recompute(e, true);
795
812
  return read(e);
796
813
  } else {
@@ -800,6 +817,7 @@ function read(e) {
800
817
  return !t || e.oe || e.U === p || (k && !P && (t.oe || (e.G && x !== e.G))) ? e.L : e.U;
801
818
  }
802
819
  function setSignal(e, t) {
820
+ if (e.G && x !== e.G) C.initTransition(e.G);
803
821
  if (typeof t === "function") {
804
822
  t = t(e.U === p || (e.oe && e.G) ? e.L : e.U);
805
823
  }
@@ -808,14 +826,14 @@ function setSignal(e, t) {
808
826
  if (n) {
809
827
  if (e.oe) e.L = t;
810
828
  else {
811
- if (e.U === p) v.M.push(e);
829
+ if (e.U === p) C.q.push(e);
812
830
  e.U = t;
813
831
  }
814
832
  if (e.fe) setSignal(e.fe, t);
815
833
  }
816
834
  setStatusFlags(e, l);
817
- e.se = m;
818
- e.oe && !S ? v.T.push(e) : notifySubs(e);
835
+ e.se = O;
836
+ e.oe && !S ? C.M.push(e) : notifySubs(e);
819
837
  schedule();
820
838
  return t;
821
839
  }
@@ -846,7 +864,7 @@ function createOwner(e) {
846
864
  ye: null,
847
865
  te: null,
848
866
  id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
849
- _e: t?._e ?? v,
867
+ _e: t?._e ?? C,
850
868
  Se: t?.Se || g,
851
869
  ge: 0,
852
870
  ee: null,
@@ -873,11 +891,14 @@ function createRoot(e, t) {
873
891
  }
874
892
  function runWithOwner(e, t) {
875
893
  const n = A;
894
+ const r = N;
876
895
  A = e;
896
+ N = false;
877
897
  try {
878
898
  return t();
879
899
  } finally {
880
900
  A = n;
901
+ N = r;
881
902
  }
882
903
  }
883
904
  function staleValues(e, t = true) {
@@ -962,10 +983,10 @@ function effect(e, t, n, r, i) {
962
983
  ...i,
963
984
  be: {
964
985
  X: true,
965
- Oe: r,
966
- me: t,
986
+ me: r,
987
+ Oe: t,
967
988
  xe: n,
968
- Ce: undefined,
989
+ ve: undefined,
969
990
  J: i?.render ? d : h,
970
991
  le(e, t) {
971
992
  if (s) {
@@ -980,8 +1001,8 @@ function effect(e, t, n, r, i) {
980
1001
  try {
981
1002
  return this.xe
982
1003
  ? this.xe(e, () => {
983
- this.Ce?.();
984
- this.Ce = undefined;
1004
+ this.ve?.();
1005
+ this.ve = undefined;
985
1006
  })
986
1007
  : console.error(e);
987
1008
  } catch (t) {
@@ -1000,18 +1021,18 @@ function effect(e, t, n, r, i) {
1000
1021
  !i?.defer &&
1001
1022
  !(o.$ & (c | f)) &&
1002
1023
  (o.J === h ? o._e.enqueue(o.J, runEffect.bind(o)) : runEffect.call(o));
1003
- onCleanup(() => o.Ce?.());
1024
+ onCleanup(() => o.ve?.());
1004
1025
  }
1005
1026
  function runEffect() {
1006
1027
  if (!this.X || this.S & u) return;
1007
- this.Ce?.();
1008
- this.Ce = undefined;
1028
+ this.ve?.();
1029
+ this.ve = undefined;
1009
1030
  try {
1010
- this.Ce = this.me(this.L, this.Oe);
1031
+ this.ve = this.Oe(this.L, this.me);
1011
1032
  } catch (e) {
1012
1033
  if (!this._e.notify(this, c, c)) throw e;
1013
1034
  } finally {
1014
- this.Oe = this.L;
1035
+ this.me = this.L;
1015
1036
  this.X = false;
1016
1037
  }
1017
1038
  }
@@ -1020,10 +1041,8 @@ function createSignal(e, t, n) {
1020
1041
  const r = computed(e, t, n);
1021
1042
  return [read.bind(null, r), setSignal.bind(null, r)];
1022
1043
  }
1023
- const r = getOwner();
1024
- const i = r?.id != null;
1025
- const s = signal(e, i ? { id: getNextChildId(r), ...t } : t);
1026
- return [read.bind(null, s), setSignal.bind(null, s)];
1044
+ const r = signal(e, t);
1045
+ return [read.bind(null, r), setSignal.bind(null, r)];
1027
1046
  }
1028
1047
  function createMemo(e, t, n) {
1029
1048
  let r = computed(e, t, n);
@@ -1075,8 +1094,10 @@ function createOptimistic(e, t, n) {
1075
1094
  if (typeof e === "function") {
1076
1095
  const r = computed(
1077
1096
  t => {
1078
- let n = r || getOwner();
1079
- n.U = e(t);
1097
+ const n = getOwner();
1098
+ const r = e(t);
1099
+ if (n.$ & a) return r;
1100
+ n.U = r;
1080
1101
  return t;
1081
1102
  },
1082
1103
  t,
@@ -1085,15 +1106,13 @@ function createOptimistic(e, t, n) {
1085
1106
  r.oe = true;
1086
1107
  return [read.bind(null, r), setSignal.bind(null, r)];
1087
1108
  }
1088
- const r = getOwner();
1089
- const i = r?.id != null;
1090
- const s = signal(e, i ? { id: getNextChildId(r), ...t } : t);
1091
- s.oe = true;
1109
+ const r = signal(e, t);
1110
+ r.oe = true;
1092
1111
  return [
1093
- read.bind(null, s),
1112
+ read.bind(null, r),
1094
1113
  t => {
1095
- s.U = e;
1096
- return setSignal(s, t);
1114
+ r.U = e;
1115
+ return setSignal(r, t);
1097
1116
  }
1098
1117
  ];
1099
1118
  }
@@ -1101,13 +1120,13 @@ function onSettled(e) {
1101
1120
  let t;
1102
1121
  const n = getOwner();
1103
1122
  if (n) onCleanup(() => t?.());
1104
- v.enqueue(h, () => {
1123
+ C.enqueue(h, () => {
1105
1124
  t = e();
1106
1125
  !n && t?.();
1107
1126
  });
1108
1127
  }
1109
1128
  function unwrap(e) {
1110
- return e?.[H]?.[T] ?? e;
1129
+ return e?.[H]?.[M] ?? e;
1111
1130
  }
1112
1131
  function getOverrideValue(e, t, n, r) {
1113
1132
  return t && r in t ? t[r] : e[r];
@@ -1120,13 +1139,13 @@ function getAllKeys(e, t, n) {
1120
1139
  function applyState(e, t, n, r) {
1121
1140
  const i = t?.[H];
1122
1141
  if (!i) return;
1123
- const s = i[q];
1124
- const o = i[M];
1125
- let u = i[T];
1142
+ const s = i[V];
1143
+ const o = i[q];
1144
+ let u = i[M];
1126
1145
  if (e === s && !o) return;
1127
1146
  (i[K] || U).set(e, i[Q]);
1128
- i[q] = e;
1129
- i[M] = undefined;
1147
+ i[V] = e;
1148
+ i[q] = undefined;
1130
1149
  if (Array.isArray(s)) {
1131
1150
  let t = false;
1132
1151
  const l = getOverrideValue(s, o, u, "length");
@@ -1153,16 +1172,16 @@ function applyState(e, t, n, r) {
1153
1172
  if (a > h || a > d) {
1154
1173
  for (c = a; c <= h; c++) {
1155
1174
  t = true;
1156
- i[T][c] && setSignal(i[T][c], wrap(e[c], i));
1175
+ i[M][c] && setSignal(i[M][c], wrap(e[c], i));
1157
1176
  }
1158
1177
  for (; c < e.length; c++) {
1159
1178
  t = true;
1160
1179
  const s = wrap(w[c], i);
1161
- i[T][c] && setSignal(i[T][c], s);
1180
+ i[M][c] && setSignal(i[M][c], s);
1162
1181
  applyState(e[c], s, n, r);
1163
1182
  }
1164
- t && i[T][I] && setSignal(i[T][I], void 0);
1165
- l !== e.length && i[T].length && setSignal(i[T].length, e.length);
1183
+ t && i[M][I] && setSignal(i[M][I], void 0);
1184
+ l !== e.length && i[M].length && setSignal(i[M].length, e.length);
1166
1185
  return;
1167
1186
  }
1168
1187
  y = new Array(h + 1);
@@ -1186,22 +1205,22 @@ function applyState(e, t, n, r) {
1186
1205
  for (c = a; c < e.length; c++) {
1187
1206
  if (c in w) {
1188
1207
  const t = wrap(w[c], i);
1189
- i[T][c] && setSignal(i[T][c], t);
1208
+ i[M][c] && setSignal(i[M][c], t);
1190
1209
  applyState(e[c], t, n, r);
1191
- } else i[T][c] && setSignal(i[T][c], wrap(e[c], i));
1210
+ } else i[M][c] && setSignal(i[M][c], wrap(e[c], i));
1192
1211
  }
1193
1212
  if (a < e.length) t = true;
1194
1213
  } else if (e.length) {
1195
1214
  for (let t = 0, l = e.length; t < l; t++) {
1196
1215
  const l = getOverrideValue(s, o, u, t);
1197
- isWrappable(l) ? applyState(e[t], wrap(l, i), n, r) : i[T][t] && setSignal(i[T][t], e[t]);
1216
+ isWrappable(l) ? applyState(e[t], wrap(l, i), n, r) : i[M][t] && setSignal(i[M][t], e[t]);
1198
1217
  }
1199
1218
  }
1200
1219
  if (l !== e.length) {
1201
1220
  t = true;
1202
- i[T].length && setSignal(i[T].length, e.length);
1221
+ i[M].length && setSignal(i[M].length, e.length);
1203
1222
  }
1204
- t && i[T][I] && setSignal(i[T][I], void 0);
1223
+ t && i[M][I] && setSignal(i[M][I], void 0);
1205
1224
  return;
1206
1225
  }
1207
1226
  if (u) {
@@ -1259,13 +1278,13 @@ function createProjectionInternal(e, t = {}, n) {
1259
1278
  };
1260
1279
  const s = wrapProjection(t);
1261
1280
  r = computed(() => {
1262
- const t = r || getOwner();
1263
- storeSetter(new Proxy(s, E), i => {
1264
- const o = handleAsync(t, e(i), e => {
1281
+ const t = getOwner();
1282
+ storeSetter(new Proxy(s, E), r => {
1283
+ const i = handleAsync(t, e(r), e => {
1265
1284
  e !== s && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id", n?.all));
1266
- setSignal(r, undefined);
1285
+ setSignal(t, undefined);
1267
1286
  });
1268
- o !== s && o !== undefined && reconcile(o, n?.key || "id", n?.all)(s);
1287
+ i !== s && i !== undefined && reconcile(i, n?.key || "id", n?.all)(s);
1269
1288
  });
1270
1289
  });
1271
1290
  r.pe = true;
@@ -1309,10 +1328,10 @@ const I = Symbol(0),
1309
1328
  H = Symbol(0),
1310
1329
  Q = Symbol(0),
1311
1330
  R = Symbol(0);
1312
- const V = new WeakMap();
1313
- const q = "v",
1314
- M = "o",
1315
- T = "n",
1331
+ const T = new WeakMap();
1332
+ const V = "v",
1333
+ q = "o",
1334
+ M = "n",
1316
1335
  D = "h",
1317
1336
  B = "w",
1318
1337
  K = "l",
@@ -1362,7 +1381,7 @@ function getNode(e, t, n, r, i = isEqual) {
1362
1381
  ));
1363
1382
  }
1364
1383
  function trackSelf(e, t = I) {
1365
- getObserver() && read(getNode(getNodes(e, T), t, undefined, e[G], false));
1384
+ getObserver() && read(getNode(getNodes(e, M), t, undefined, e[G], false));
1366
1385
  }
1367
1386
  function getKeys(e, t, n = true) {
1368
1387
  const r = untrack(() => (n ? Object.keys(e) : Reflect.ownKeys(e)));
@@ -1393,11 +1412,11 @@ const J = {
1393
1412
  trackSelf(e, t);
1394
1413
  return n;
1395
1414
  }
1396
- const r = getNodes(e, T);
1415
+ const r = getNodes(e, M);
1397
1416
  const i = r[t];
1398
- const s = e[M] && t in e[M];
1399
- const o = !!e[q][H];
1400
- const u = s ? e[M] : e[q];
1417
+ const s = e[q] && t in e[q];
1418
+ const o = !!e[V][H];
1419
+ const u = s ? e[q] : e[V];
1401
1420
  if (!i) {
1402
1421
  const e = Object.getOwnPropertyDescriptor(u, t);
1403
1422
  if (e && e.get) return e.get.call(n);
@@ -1415,7 +1434,7 @@ const J = {
1415
1434
  if (!i) {
1416
1435
  if (!s && typeof l === "function" && !u.hasOwnProperty(t)) {
1417
1436
  let t;
1418
- return !Array.isArray(e[q]) && (t = Object.getPrototypeOf(e[q])) && t !== Object.prototype
1437
+ return !Array.isArray(e[V]) && (t = Object.getPrototypeOf(e[V])) && t !== Object.prototype
1419
1438
  ? l.bind(u)
1420
1439
  : l;
1421
1440
  } else if (getObserver()) {
@@ -1426,7 +1445,7 @@ const J = {
1426
1445
  },
1427
1446
  has(e, t) {
1428
1447
  if (t === Q || t === I || t === "__proto__") return true;
1429
- const n = e[M] && t in e[M] ? e[M][t] !== R : t in e[q];
1448
+ const n = e[q] && t in e[q] ? e[q][t] !== R : t in e[V];
1430
1449
  getObserver() && read(getNode(getNodes(e, D), t, n, e[G]));
1431
1450
  return n;
1432
1451
  },
@@ -1434,22 +1453,22 @@ const J = {
1434
1453
  const r = e[Q];
1435
1454
  if (writeOnly(r)) {
1436
1455
  untrack(() => {
1437
- const i = e[q];
1456
+ const i = e[V];
1438
1457
  const s = i[t];
1439
- const o = e[M] && t in e[M] ? e[M][t] : s;
1440
- const u = n?.[H]?.[q] ?? n;
1458
+ const o = e[q] && t in e[q] ? e[q][t] : s;
1459
+ const u = n?.[H]?.[V] ?? n;
1441
1460
  if (o === u) return true;
1442
- const l = e[M]?.length || i.length;
1443
- if (u !== undefined && u === s) delete e[M][t];
1444
- else (e[M] || (e[M] = Object.create(null)))[t] = u;
1461
+ const l = e[q]?.length || i.length;
1462
+ if (u !== undefined && u === s) delete e[q][t];
1463
+ else (e[q] || (e[q] = Object.create(null)))[t] = u;
1445
1464
  const f = isWrappable(u);
1446
1465
  if (isWrappable(o)) {
1447
- const e = V.get(o);
1448
- e && (e instanceof Set ? e.delete(r) : V.delete(o));
1466
+ const e = T.get(o);
1467
+ e && (e instanceof Set ? e.delete(r) : T.delete(o));
1449
1468
  }
1450
1469
  if (recursivelyNotify(r, U) && f) recursivelyAddParent(u, r);
1451
1470
  e[D]?.[t] && setSignal(e[D][t], true);
1452
- const c = getNodes(e, T);
1471
+ const c = getNodes(e, M);
1453
1472
  c[t] && setSignal(c[t], () => (f ? wrap(u, e) : u));
1454
1473
  if (Array.isArray(i)) {
1455
1474
  const e = parseInt(t) + 1;
@@ -1461,20 +1480,20 @@ const J = {
1461
1480
  return true;
1462
1481
  },
1463
1482
  deleteProperty(e, t) {
1464
- if (writeOnly(e[Q]) && e[M]?.[t] !== R) {
1483
+ if (writeOnly(e[Q]) && e[q]?.[t] !== R) {
1465
1484
  untrack(() => {
1466
- const n = e[M] && t in e[M] ? e[M][t] : e[q][t];
1467
- if (t in e[q]) {
1468
- (e[M] || (e[M] = Object.create(null)))[t] = R;
1469
- } else if (e[M] && t in e[M]) {
1470
- delete e[M][t];
1485
+ const n = e[q] && t in e[q] ? e[q][t] : e[V][t];
1486
+ if (t in e[V]) {
1487
+ (e[q] || (e[q] = Object.create(null)))[t] = R;
1488
+ } else if (e[q] && t in e[q]) {
1489
+ delete e[q][t];
1471
1490
  } else return true;
1472
1491
  if (isWrappable(n)) {
1473
- const t = V.get(n);
1474
- t && (t instanceof Set ? t.delete(e) : V.delete(n));
1492
+ const t = T.get(n);
1493
+ t && (t instanceof Set ? t.delete(e) : T.delete(n));
1475
1494
  }
1476
1495
  if (e[D]?.[t]) setSignal(e[D][t], false);
1477
- const r = getNodes(e, T);
1496
+ const r = getNodes(e, M);
1478
1497
  r[t] && setSignal(r[t], undefined);
1479
1498
  r[I] && setSignal(r[I], undefined);
1480
1499
  });
@@ -1483,14 +1502,14 @@ const J = {
1483
1502
  },
1484
1503
  ownKeys(e) {
1485
1504
  trackSelf(e);
1486
- return getKeys(e[q], e[M], false);
1505
+ return getKeys(e[V], e[q], false);
1487
1506
  },
1488
1507
  getOwnPropertyDescriptor(e, t) {
1489
1508
  if (t === Q) return { value: e[Q], writable: true, configurable: true };
1490
- return getPropertyDescriptor(e[q], e[M], t);
1509
+ return getPropertyDescriptor(e[V], e[q], t);
1491
1510
  },
1492
1511
  getPrototypeOf(e) {
1493
- return Object.getPrototypeOf(e[q]);
1512
+ return Object.getPrototypeOf(e[V]);
1494
1513
  }
1495
1514
  };
1496
1515
  function storeSetter(e, t) {
@@ -1525,14 +1544,14 @@ function recursivelyNotify(e, t) {
1525
1544
  let n = e[H] || t?.get(e)?.[H];
1526
1545
  let r = false;
1527
1546
  if (n) {
1528
- const e = getNodes(n, T)[F];
1547
+ const e = getNodes(n, M)[F];
1529
1548
  if (e) {
1530
1549
  setSignal(e, undefined);
1531
1550
  r = true;
1532
1551
  }
1533
1552
  t = n[K] || t;
1534
1553
  }
1535
- const i = V.get(n?.[q] || e);
1554
+ const i = T.get(n?.[V] || e);
1536
1555
  if (!i) return r;
1537
1556
  if (i instanceof Set) {
1538
1557
  for (let e of i) r = recursivelyNotify(e, t) || r;
@@ -1543,14 +1562,14 @@ function recursivelyAddParent(e, t) {
1543
1562
  let n;
1544
1563
  const r = e[H];
1545
1564
  if (r) {
1546
- n = r[M];
1547
- e = r[q];
1565
+ n = r[q];
1566
+ e = r[V];
1548
1567
  }
1549
1568
  if (t) {
1550
- let n = V.get(e);
1551
- if (!n) V.set(e, t);
1569
+ let n = T.get(e);
1570
+ if (!n) T.set(e, t);
1552
1571
  else if (n !== t) {
1553
- if (!(n instanceof Set)) V.set(e, (n = new Set([n])));
1572
+ if (!(n instanceof Set)) T.set(e, (n = new Set([n])));
1554
1573
  else if (n.has(t)) return;
1555
1574
  n.add(t);
1556
1575
  } else return;
@@ -1583,10 +1602,10 @@ function snapshot(e, t, n) {
1583
1602
  if (t && t.has(e)) return t.get(e);
1584
1603
  if (!t) t = new Map();
1585
1604
  if ((r = e[H] || n?.get(e)?.[H])) {
1586
- s = r[M];
1587
- i = Array.isArray(r[q]);
1588
- t.set(e, s ? (o = i ? [] : Object.create(Object.getPrototypeOf(r[q]))) : r[q]);
1589
- e = r[q];
1605
+ s = r[q];
1606
+ i = Array.isArray(r[V]);
1607
+ t.set(e, s ? (o = i ? [] : Object.create(Object.getPrototypeOf(r[V]))) : r[V]);
1608
+ e = r[V];
1590
1609
  n = U;
1591
1610
  } else {
1592
1611
  i = Array.isArray(e);
@@ -1754,7 +1773,7 @@ function mapArray(e, t, n) {
1754
1773
  const r = typeof n?.keyed === "function" ? n.keyed : undefined;
1755
1774
  return createMemo(
1756
1775
  updateKeyedMap.bind({
1757
- ve: createOwner(),
1776
+ Ce: createOwner(),
1758
1777
  Ne: 0,
1759
1778
  ke: e,
1760
1779
  je: [],
@@ -1773,7 +1792,7 @@ function updateKeyedMap() {
1773
1792
  const e = this.ke() || [],
1774
1793
  t = e.length;
1775
1794
  e[I];
1776
- runWithOwner(this.ve, () => {
1795
+ runWithOwner(this.Ce, () => {
1777
1796
  let n,
1778
1797
  r,
1779
1798
  i = this.Ie
@@ -1797,7 +1816,7 @@ function updateKeyedMap() {
1797
1816
  };
1798
1817
  if (t === 0) {
1799
1818
  if (this.Ne !== 0) {
1800
- this.ve.dispose(false);
1819
+ this.Ce.dispose(false);
1801
1820
  this.Ae = [];
1802
1821
  this.je = [];
1803
1822
  this.We = [];
@@ -1893,24 +1912,24 @@ function updateKeyedMap() {
1893
1912
  }
1894
1913
  function repeat(e, t, n) {
1895
1914
  return updateRepeat.bind({
1896
- ve: createOwner(),
1915
+ Ce: createOwner(),
1897
1916
  Ne: 0,
1898
1917
  Qe: 0,
1899
1918
  Re: e,
1900
1919
  Pe: t,
1901
1920
  Ae: [],
1902
1921
  We: [],
1903
- Ve: n?.from,
1922
+ Te: n?.from,
1904
1923
  He: n?.fallback
1905
1924
  });
1906
1925
  }
1907
1926
  function updateRepeat() {
1908
1927
  const e = this.Re();
1909
- const t = this.Ve?.() || 0;
1910
- runWithOwner(this.ve, () => {
1928
+ const t = this.Te?.() || 0;
1929
+ runWithOwner(this.Ce, () => {
1911
1930
  if (e === 0) {
1912
1931
  if (this.Ne !== 0) {
1913
- this.ve.dispose(false);
1932
+ this.Ce.dispose(false);
1914
1933
  this.Ae = [];
1915
1934
  this.We = [];
1916
1935
  this.Ne = 0;
@@ -1959,16 +1978,16 @@ function boundaryComputed(e, t) {
1959
1978
  be: {
1960
1979
  le() {
1961
1980
  let e = this.$;
1962
- this.$ &= ~this.qe;
1963
- if (this.qe & f && !(this.$ & a)) {
1981
+ this.$ &= ~this.Ve;
1982
+ if (this.Ve & f && !(this.$ & a)) {
1964
1983
  e &= ~f;
1965
1984
  }
1966
- this._e.notify(this, this.qe, e);
1985
+ this._e.notify(this, this.Ve, e);
1967
1986
  },
1968
- qe: t
1987
+ Ve: t
1969
1988
  }
1970
1989
  });
1971
- n.qe = t;
1990
+ n.Ve = t;
1972
1991
  n.pe = true;
1973
1992
  return n;
1974
1993
  }
@@ -1982,30 +2001,30 @@ function createBoundChildren(e, t, n, r) {
1982
2001
  });
1983
2002
  }
1984
2003
  class ConditionalQueue extends Queue {
1985
- Me;
1986
- Te = new Set();
1987
- M = new Set();
2004
+ qe;
2005
+ Me = new Set();
2006
+ q = new Set();
1988
2007
  constructor(e) {
1989
2008
  super();
1990
- this.Me = e;
2009
+ this.qe = e;
1991
2010
  }
1992
2011
  run(e) {
1993
- if (!e || read(this.Me)) return;
2012
+ if (!e || read(this.qe)) return;
1994
2013
  return super.run(e);
1995
2014
  }
1996
2015
  notify(e, t, n) {
1997
- if (read(this.Me)) {
2016
+ if (read(this.qe)) {
1998
2017
  if (t & f) {
1999
2018
  if (n & f) {
2000
- this.M.add(e);
2019
+ this.q.add(e);
2001
2020
  t &= ~f;
2002
- } else if (this.M.delete(e)) t &= ~f;
2021
+ } else if (this.q.delete(e)) t &= ~f;
2003
2022
  }
2004
2023
  if (t & c) {
2005
2024
  if (n & c) {
2006
- this.Te.add(e);
2025
+ this.Me.add(e);
2007
2026
  t &= ~c;
2008
- } else if (this.Te.delete(e)) t &= ~c;
2027
+ } else if (this.Me.delete(e)) t &= ~c;
2009
2028
  }
2010
2029
  }
2011
2030
  return t ? super.notify(e, t, n) : true;
@@ -2014,24 +2033,24 @@ class ConditionalQueue extends Queue {
2014
2033
  class CollectionQueue extends Queue {
2015
2034
  De;
2016
2035
  Ae = new Set();
2017
- Me = signal(false, { pureWrite: true });
2036
+ qe = signal(false, { pureWrite: true });
2018
2037
  Be = false;
2019
2038
  constructor(e) {
2020
2039
  super();
2021
2040
  this.De = e;
2022
2041
  }
2023
2042
  run(e) {
2024
- if (!e || read(this.Me)) return;
2043
+ if (!e || read(this.qe)) return;
2025
2044
  return super.run(e);
2026
2045
  }
2027
2046
  notify(e, t, n) {
2028
2047
  if (!(t & this.De) || (this.De & f && this.Be)) return super.notify(e, t, n);
2029
2048
  if (n & this.De) {
2030
2049
  this.Ae.add(e);
2031
- if (this.Ae.size === 1) setSignal(this.Me, true);
2050
+ if (this.Ae.size === 1) setSignal(this.qe, true);
2032
2051
  } else if (this.Ae.size > 0) {
2033
2052
  this.Ae.delete(e);
2034
- if (this.Ae.size === 0) setSignal(this.Me, false);
2053
+ if (this.Ae.size === 0) setSignal(this.qe, false);
2035
2054
  }
2036
2055
  t &= ~this.De;
2037
2056
  return t ? super.notify(e, t, n) : true;
@@ -2047,25 +2066,25 @@ function createBoundary(e, t) {
2047
2066
  const r = new ConditionalQueue(computed(() => t() === $.HIDDEN));
2048
2067
  const i = createBoundChildren(n, e, r, 0);
2049
2068
  computed(() => {
2050
- const e = read(r.Me);
2051
- i.qe = e ? c | f : 0;
2069
+ const e = read(r.qe);
2070
+ i.Ve = e ? c | f : 0;
2052
2071
  if (!e) {
2053
- r.M.forEach(e => r.notify(e, f, f));
2054
- r.Te.forEach(e => r.notify(e, c, c));
2055
- r.M.clear();
2056
- r.Te.clear();
2072
+ r.q.forEach(e => r.notify(e, f, f));
2073
+ r.Me.forEach(e => r.notify(e, c, c));
2074
+ r.q.clear();
2075
+ r.Me.clear();
2057
2076
  }
2058
2077
  });
2059
- return () => (read(r.Me) ? undefined : read(i));
2078
+ return () => (read(r.qe) ? undefined : read(i));
2060
2079
  }
2061
2080
  function createCollectionBoundary(e, t, n) {
2062
2081
  const r = createOwner();
2063
2082
  const i = new CollectionQueue(e);
2064
2083
  const s = createBoundChildren(r, t, i, e);
2065
2084
  const o = computed(() => {
2066
- if (!read(i.Me)) {
2085
+ if (!read(i.qe)) {
2067
2086
  const e = read(s);
2068
- if (!untrack(() => read(i.Me))) i.Be = true;
2087
+ if (!untrack(() => read(i.qe))) i.Be = true;
2069
2088
  return e;
2070
2089
  }
2071
2090
  return n(i);