@solidjs/signals 0.0.8 → 0.0.10

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/prod.js CHANGED
@@ -24,13 +24,109 @@ var EffectError = class extends Error {
24
24
  var STATE_CLEAN = 0;
25
25
  var STATE_CHECK = 1;
26
26
  var STATE_DIRTY = 2;
27
- var STATE_UNINITIALIZED = 3;
28
- var STATE_DISPOSED = 4;
27
+ var STATE_DISPOSED = 3;
29
28
  var EFFECT_PURE = 0;
30
29
  var EFFECT_RENDER = 1;
31
30
  var EFFECT_USER = 2;
32
31
  var SUPPORTS_PROXY = typeof Proxy === "function";
33
32
 
33
+ // src/core/scheduler.ts
34
+ var clock = 0;
35
+ function getClock() {
36
+ return clock;
37
+ }
38
+ function incrementClock() {
39
+ clock++;
40
+ }
41
+ var scheduled = false;
42
+ function schedule() {
43
+ if (scheduled)
44
+ return;
45
+ scheduled = true;
46
+ if (!globalQueue.H)
47
+ queueMicrotask(flushSync);
48
+ }
49
+ var Queue = class {
50
+ H = false;
51
+ r = [[], [], []];
52
+ D = [];
53
+ enqueue(type, node) {
54
+ this.r[0].push(node);
55
+ if (type)
56
+ this.r[type].push(node);
57
+ schedule();
58
+ }
59
+ run(type) {
60
+ if (this.r[type].length) {
61
+ if (type === EFFECT_PURE) {
62
+ runPureQueue(this.r[type]);
63
+ this.r[type] = [];
64
+ } else {
65
+ const effects = this.r[type];
66
+ this.r[type] = [];
67
+ runEffectQueue(effects);
68
+ }
69
+ }
70
+ let rerun = false;
71
+ for (let i = 0; i < this.D.length; i++) {
72
+ rerun = this.D[i].run(type) || rerun;
73
+ }
74
+ if (type === EFFECT_PURE && this.r[type].length)
75
+ return true;
76
+ }
77
+ flush() {
78
+ if (this.H)
79
+ return;
80
+ this.H = true;
81
+ try {
82
+ while (this.run(EFFECT_PURE)) {
83
+ }
84
+ incrementClock();
85
+ scheduled = false;
86
+ this.run(EFFECT_RENDER);
87
+ this.run(EFFECT_USER);
88
+ } finally {
89
+ this.H = false;
90
+ }
91
+ }
92
+ addChild(child) {
93
+ this.D.push(child);
94
+ }
95
+ removeChild(child) {
96
+ const index = this.D.indexOf(child);
97
+ if (index >= 0)
98
+ this.D.splice(index, 1);
99
+ }
100
+ };
101
+ var globalQueue = new Queue();
102
+ function flushSync() {
103
+ while (scheduled) {
104
+ globalQueue.flush();
105
+ }
106
+ }
107
+ function runTop(node) {
108
+ const ancestors = [];
109
+ for (let current = node; current !== null; current = current.s) {
110
+ if (current.a !== STATE_CLEAN) {
111
+ ancestors.push(current);
112
+ }
113
+ }
114
+ for (let i = ancestors.length - 1; i >= 0; i--) {
115
+ if (ancestors[i].a !== STATE_DISPOSED)
116
+ ancestors[i].y();
117
+ }
118
+ }
119
+ function runPureQueue(queue) {
120
+ for (let i = 0; i < queue.length; i++) {
121
+ if (queue[i].a !== STATE_CLEAN)
122
+ runTop(queue[i]);
123
+ }
124
+ }
125
+ function runEffectQueue(queue) {
126
+ for (let i = 0; i < queue.length; i++)
127
+ queue[i].T();
128
+ }
129
+
34
130
  // src/core/utils.ts
35
131
  function isUndefined(value) {
36
132
  return typeof value === "undefined";
@@ -105,23 +201,23 @@ var Owner = class {
105
201
  // We flatten the owner tree into a linked list so that we don't need a pointer to .firstChild
106
202
  // However, the children are actually added in reverse creation order
107
203
  // See comment at the top of the file for an example of the _nextSibling traversal
108
- r = null;
109
- n = null;
110
204
  s = null;
205
+ n = null;
206
+ t = null;
111
207
  a = STATE_CLEAN;
112
208
  l = null;
113
209
  p = defaultContext;
114
210
  m = null;
115
- g = null;
211
+ h = globalQueue;
116
212
  constructor(signal = false) {
117
213
  if (currentOwner && !signal)
118
214
  currentOwner.append(this);
119
215
  }
120
216
  append(child) {
121
- child.r = this;
122
217
  child.s = this;
218
+ child.t = this;
123
219
  if (this.n)
124
- this.n.s = child;
220
+ this.n.t = child;
125
221
  child.n = this.n;
126
222
  this.n = child;
127
223
  if (child.p !== this.p) {
@@ -130,32 +226,32 @@ var Owner = class {
130
226
  if (this.m) {
131
227
  child.m = !child.m ? this.m : [...child.m, ...this.m];
132
228
  }
133
- if (this.g)
134
- child.g = this.g;
229
+ if (this.h)
230
+ child.h = this.h;
135
231
  }
136
232
  dispose(self = true) {
137
233
  if (this.a === STATE_DISPOSED)
138
234
  return;
139
- let head = self ? this.s || this.r : this, current = this.n, next = null;
140
- while (current && current.r === this) {
235
+ let head = self ? this.t || this.s : this, current = this.n, next = null;
236
+ while (current && current.s === this) {
141
237
  current.dispose(true);
142
- current.y();
238
+ current.A();
143
239
  next = current.n;
144
240
  current.n = null;
145
241
  current = next;
146
242
  }
147
243
  if (self)
148
- this.y();
244
+ this.A();
149
245
  if (current)
150
- current.s = !self ? this : this.s;
246
+ current.t = !self ? this : this.t;
151
247
  if (head)
152
248
  head.n = current;
153
249
  }
154
- y() {
155
- if (this.s)
156
- this.s.n = null;
157
- this.r = null;
250
+ A() {
251
+ if (this.t)
252
+ this.t.n = null;
158
253
  this.s = null;
254
+ this.t = null;
159
255
  this.p = defaultContext;
160
256
  this.m = null;
161
257
  this.a = STATE_DISPOSED;
@@ -180,7 +276,7 @@ var Owner = class {
180
276
  let i = 0, len = this.m.length;
181
277
  for (i = 0; i < len; i++) {
182
278
  try {
183
- this.m[i](error);
279
+ this.m[i](error, this);
184
280
  break;
185
281
  } catch (e) {
186
282
  error = e;
@@ -234,6 +330,8 @@ var ERROR_OFFSET = 0;
234
330
  var ERROR_BIT = 1 << ERROR_OFFSET;
235
331
  var LOADING_OFFSET = 1;
236
332
  var LOADING_BIT = 1 << LOADING_OFFSET;
333
+ var UNINITIALIZED_OFFSET = 2;
334
+ var UNINITIALIZED_BIT = 1 << UNINITIALIZED_OFFSET;
237
335
  var DEFAULT_FLAGS = ERROR_BIT;
238
336
 
239
337
  // src/core/core.ts
@@ -242,57 +340,57 @@ var currentMask = DEFAULT_FLAGS;
242
340
  var newSources = null;
243
341
  var newSourcesIndex = 0;
244
342
  var newFlags = 0;
245
- var clock = 0;
246
- var syncResolve = false;
343
+ var notStale = false;
247
344
  var updateCheck = null;
345
+ var staleCheck = null;
248
346
  function getObserver() {
249
347
  return currentObserver;
250
348
  }
251
- function getClock() {
252
- return clock;
253
- }
254
- function incrementClock() {
255
- clock++;
256
- }
257
349
  var UNCHANGED = Symbol(0);
258
350
  var Computation = class extends Owner {
351
+ f = null;
259
352
  d = null;
260
- b = null;
261
- e;
262
- w;
353
+ c;
354
+ E;
355
+ u;
263
356
  // Used in __DEV__ mode, hopefully removed in production
264
- Y;
357
+ Z;
265
358
  // Using false is an optimization as an alternative to _equals: () => false
266
359
  // which could enable more efficient DIRTY notification
267
- L = isEqual;
268
- S;
360
+ N = isEqual;
361
+ U;
269
362
  /** Whether the computation is an error or has ancestors that are unresolved */
270
- h = 0;
363
+ b = 0;
271
364
  /** Which flags raised by sources are handled, vs. being passed through. */
272
- M = DEFAULT_FLAGS;
273
- N = null;
365
+ O = DEFAULT_FLAGS;
366
+ P = null;
274
367
  z = -1;
275
- H = false;
368
+ I = false;
276
369
  constructor(initialValue, compute2, options) {
277
370
  super(compute2 === null);
278
- this.w = compute2;
279
- this.a = compute2 ? STATE_UNINITIALIZED : STATE_CLEAN;
280
- this.e = initialValue;
371
+ this.u = compute2;
372
+ this.a = compute2 ? STATE_DIRTY : STATE_CLEAN;
373
+ this.b = compute2 && initialValue === void 0 ? UNINITIALIZED_BIT : 0;
374
+ this.c = initialValue;
281
375
  if (options?.equals !== void 0)
282
- this.L = options.equals;
376
+ this.N = options.equals;
283
377
  if (options?.unobserved)
284
- this.S = options?.unobserved;
378
+ this.U = options?.unobserved;
285
379
  }
286
- T() {
287
- if (this.w)
288
- this.x();
289
- if (!this.w || this.d?.length)
380
+ V() {
381
+ if (this.u) {
382
+ if (this.b & ERROR_BIT && this.z <= getClock())
383
+ update(this);
384
+ else
385
+ this.y();
386
+ }
387
+ if (!this.u || this.f?.length)
290
388
  track(this);
291
- newFlags |= this.h & ~currentMask;
292
- if (this.h & ERROR_BIT) {
293
- throw this.e;
389
+ newFlags |= this.b & ~currentMask;
390
+ if (this.b & ERROR_BIT) {
391
+ throw this.E;
294
392
  } else {
295
- return this.e;
393
+ return this.c;
296
394
  }
297
395
  }
298
396
  /**
@@ -300,7 +398,7 @@ var Computation = class extends Owner {
300
398
  * Automatically re-executes the surrounding computation when the value changes
301
399
  */
302
400
  read() {
303
- return this.T();
401
+ return this.V();
304
402
  }
305
403
  /**
306
404
  * Return the current value of this computation
@@ -310,13 +408,15 @@ var Computation = class extends Owner {
310
408
  * before continuing
311
409
  */
312
410
  wait() {
313
- if (this.w && this.h & ERROR_BIT && this.z <= clock) {
411
+ if (this.u && this.b & ERROR_BIT && this.z <= getClock()) {
314
412
  update(this);
315
413
  }
316
- if (!syncResolve && this.loading()) {
414
+ if ((notStale || this.b & UNINITIALIZED_BIT) && this.loading()) {
317
415
  throw new NotReadyError();
318
416
  }
319
- return this.T();
417
+ if (staleCheck && this.b & LOADING_BIT)
418
+ staleCheck.c = true;
419
+ return this.V();
320
420
  }
321
421
  /**
322
422
  * Return true if the computation is the value is dependent on an unresolved promise
@@ -326,42 +426,44 @@ var Computation = class extends Owner {
326
426
  * loading state changes
327
427
  */
328
428
  loading() {
329
- if (this.N === null) {
330
- this.N = loadingState(this);
429
+ if (this.P === null) {
430
+ this.P = loadingState(this);
331
431
  }
332
- return this.N.read();
432
+ return this.P.read();
333
433
  }
334
434
  /** Update the computation with a new value. */
335
435
  write(value, flags = 0, raw = false) {
336
- const newValue = !raw && typeof value === "function" ? value(this.e) : value;
337
- const valueChanged = newValue !== UNCHANGED && (!!(flags & ERROR_BIT) || this.a === STATE_UNINITIALIZED || this.L === false || !this.L(this.e, newValue));
338
- if (valueChanged)
339
- this.e = newValue;
340
- const changedFlagsMask = this.h ^ flags, changedFlags = changedFlagsMask & flags;
341
- this.h = flags;
342
- this.z = clock + 1;
343
- if (this.b) {
344
- for (let i = 0; i < this.b.length; i++) {
436
+ const newValue = !raw && typeof value === "function" ? value(this.c) : value;
437
+ const valueChanged = newValue !== UNCHANGED && (!!(this.b & UNINITIALIZED_BIT) || this.N === false || !this.N(this.c, newValue));
438
+ if (valueChanged) {
439
+ this.c = newValue;
440
+ this.E = void 0;
441
+ }
442
+ const changedFlagsMask = this.b ^ flags, changedFlags = changedFlagsMask & flags;
443
+ this.b = flags;
444
+ this.z = getClock() + 1;
445
+ if (this.d) {
446
+ for (let i = 0; i < this.d.length; i++) {
345
447
  if (valueChanged) {
346
- this.b[i].q(STATE_DIRTY);
448
+ this.d[i].q(STATE_DIRTY);
347
449
  } else if (changedFlagsMask) {
348
- this.b[i].U(changedFlagsMask, changedFlags);
450
+ this.d[i].W(changedFlagsMask, changedFlags);
349
451
  }
350
452
  }
351
453
  }
352
- return this.e;
454
+ return this.c;
353
455
  }
354
456
  /**
355
457
  * Set the current node's state, and recursively mark all of this node's observers as STATE_CHECK
356
458
  */
357
459
  q(state, skipQueue) {
358
- if (this.a >= state && !this.H)
460
+ if (this.a >= state && !this.I)
359
461
  return;
360
- this.H = !!skipQueue;
462
+ this.I = !!skipQueue;
361
463
  this.a = state;
362
- if (this.b) {
363
- for (let i = 0; i < this.b.length; i++) {
364
- this.b[i].q(STATE_CHECK, skipQueue);
464
+ if (this.d) {
465
+ for (let i = 0; i < this.d.length; i++) {
466
+ this.d[i].q(STATE_CHECK, skipQueue);
365
467
  }
366
468
  }
367
469
  }
@@ -371,30 +473,31 @@ var Computation = class extends Owner {
371
473
  * @param mask A bitmask for which flag(s) were changed.
372
474
  * @param newFlags The source's new flags, masked to just the changed ones.
373
475
  */
374
- U(mask, newFlags2) {
476
+ W(mask, newFlags2) {
375
477
  if (this.a >= STATE_DIRTY)
376
478
  return;
377
- if (mask & this.M) {
479
+ if (mask & this.O) {
378
480
  this.q(STATE_DIRTY);
379
481
  return;
380
482
  }
381
483
  if (this.a >= STATE_CHECK)
382
484
  return;
383
- const prevFlags = this.h & mask;
485
+ const prevFlags = this.b & mask;
384
486
  const deltaFlags = prevFlags ^ newFlags2;
385
487
  if (newFlags2 === prevFlags) ; else if (deltaFlags & prevFlags & mask) {
386
488
  this.q(STATE_CHECK);
387
489
  } else {
388
- this.h ^= deltaFlags;
389
- if (this.b) {
390
- for (let i = 0; i < this.b.length; i++) {
391
- this.b[i].U(mask, newFlags2);
490
+ this.b ^= deltaFlags;
491
+ if (this.d) {
492
+ for (let i = 0; i < this.d.length; i++) {
493
+ this.d[i].W(mask, newFlags2);
392
494
  }
393
495
  }
394
496
  }
395
497
  }
396
- O(error) {
397
- this.write(error, this.h & ~LOADING_BIT | ERROR_BIT);
498
+ J(error) {
499
+ this.E = error;
500
+ this.write(UNCHANGED, this.b & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
398
501
  }
399
502
  /**
400
503
  * This is the core part of the reactivity system, which makes sure that the values are updated
@@ -403,7 +506,7 @@ var Computation = class extends Owner {
403
506
  *
404
507
  * This function will ensure that the value and states we read from the computation are up to date
405
508
  */
406
- x() {
509
+ y() {
407
510
  if (this.a === STATE_DISPOSED) {
408
511
  throw new Error("Tried to read a disposed computation");
409
512
  }
@@ -412,15 +515,15 @@ var Computation = class extends Owner {
412
515
  }
413
516
  let observerFlags = 0;
414
517
  if (this.a === STATE_CHECK) {
415
- for (let i = 0; i < this.d.length; i++) {
416
- this.d[i].x();
417
- observerFlags |= this.d[i].h;
518
+ for (let i = 0; i < this.f.length; i++) {
519
+ this.f[i].y();
520
+ observerFlags |= this.f[i].b;
418
521
  if (this.a === STATE_DIRTY) {
419
522
  break;
420
523
  }
421
524
  }
422
525
  }
423
- if (this.a === STATE_DIRTY || this.a === STATE_UNINITIALIZED) {
526
+ if (this.a === STATE_DIRTY) {
424
527
  update(this);
425
528
  } else {
426
529
  this.write(UNCHANGED, observerFlags);
@@ -430,33 +533,33 @@ var Computation = class extends Owner {
430
533
  /**
431
534
  * Remove ourselves from the owner graph and the computation graph
432
535
  */
433
- y() {
536
+ A() {
434
537
  if (this.a === STATE_DISPOSED)
435
538
  return;
436
- if (this.d)
539
+ if (this.f)
437
540
  removeSourceObservers(this, 0);
438
- super.y();
541
+ super.A();
439
542
  }
440
543
  };
441
544
  function loadingState(node) {
442
- const prevOwner = setOwner(node.r);
545
+ const prevOwner = setOwner(node.s);
443
546
  const options = void 0;
444
547
  const computation = new Computation(
445
548
  void 0,
446
549
  () => {
447
550
  track(node);
448
- node.x();
449
- return !!(node.h & LOADING_BIT);
551
+ node.y();
552
+ return !!(node.b & LOADING_BIT);
450
553
  },
451
554
  options
452
555
  );
453
- computation.M = ERROR_BIT | LOADING_BIT;
556
+ computation.O = ERROR_BIT | LOADING_BIT;
454
557
  setOwner(prevOwner);
455
558
  return computation;
456
559
  }
457
560
  function track(computation) {
458
561
  if (currentObserver) {
459
- if (!newSources && currentObserver.d && currentObserver.d[newSourcesIndex] === computation) {
562
+ if (!newSources && currentObserver.f && currentObserver.f[newSourcesIndex] === computation) {
460
563
  newSourcesIndex++;
461
564
  } else if (!newSources)
462
565
  newSources = [computation];
@@ -464,7 +567,7 @@ function track(computation) {
464
567
  newSources.push(computation);
465
568
  }
466
569
  if (updateCheck) {
467
- updateCheck.e = computation.z > currentObserver.z;
570
+ updateCheck.c = computation.z > currentObserver.z;
468
571
  }
469
572
  }
470
573
  }
@@ -476,56 +579,56 @@ function update(node) {
476
579
  try {
477
580
  node.dispose(false);
478
581
  node.emptyDisposal();
479
- const result = compute(node, node.w, node);
582
+ const result = compute(node, node.u, node);
480
583
  node.write(result, newFlags, true);
481
584
  } catch (error) {
482
585
  if (error instanceof NotReadyError) {
483
- node.write(UNCHANGED, newFlags | LOADING_BIT);
586
+ node.write(UNCHANGED, newFlags | LOADING_BIT | node.b & UNINITIALIZED_BIT);
484
587
  } else {
485
- node.O(error);
588
+ node.J(error);
486
589
  }
487
590
  } finally {
488
591
  if (newSources) {
489
- if (node.d)
592
+ if (node.f)
490
593
  removeSourceObservers(node, newSourcesIndex);
491
- if (node.d && newSourcesIndex > 0) {
492
- node.d.length = newSourcesIndex + newSources.length;
594
+ if (node.f && newSourcesIndex > 0) {
595
+ node.f.length = newSourcesIndex + newSources.length;
493
596
  for (let i = 0; i < newSources.length; i++) {
494
- node.d[newSourcesIndex + i] = newSources[i];
597
+ node.f[newSourcesIndex + i] = newSources[i];
495
598
  }
496
599
  } else {
497
- node.d = newSources;
600
+ node.f = newSources;
498
601
  }
499
602
  let source;
500
- for (let i = newSourcesIndex; i < node.d.length; i++) {
501
- source = node.d[i];
502
- if (!source.b)
503
- source.b = [node];
603
+ for (let i = newSourcesIndex; i < node.f.length; i++) {
604
+ source = node.f[i];
605
+ if (!source.d)
606
+ source.d = [node];
504
607
  else
505
- source.b.push(node);
608
+ source.d.push(node);
506
609
  }
507
- } else if (node.d && newSourcesIndex < node.d.length) {
610
+ } else if (node.f && newSourcesIndex < node.f.length) {
508
611
  removeSourceObservers(node, newSourcesIndex);
509
- node.d.length = newSourcesIndex;
612
+ node.f.length = newSourcesIndex;
510
613
  }
511
614
  newSources = prevSources;
512
615
  newSourcesIndex = prevSourcesIndex;
513
616
  newFlags = prevFlags;
514
- node.z = clock + 1;
617
+ node.z = getClock() + 1;
515
618
  node.a = STATE_CLEAN;
516
619
  }
517
620
  }
518
621
  function removeSourceObservers(node, index) {
519
622
  let source;
520
623
  let swap;
521
- for (let i = index; i < node.d.length; i++) {
522
- source = node.d[i];
523
- if (source.b) {
524
- swap = source.b.indexOf(node);
525
- source.b[swap] = source.b[source.b.length - 1];
526
- source.b.pop();
527
- if (!source.b.length)
528
- source.S?.();
624
+ for (let i = index; i < node.f.length; i++) {
625
+ source = node.f[i];
626
+ if (source.d) {
627
+ swap = source.d.indexOf(node);
628
+ source.d[swap] = source.d[source.d.length - 1];
629
+ source.d.pop();
630
+ if (!source.d.length)
631
+ source.U?.();
529
632
  }
530
633
  }
531
634
  }
@@ -539,31 +642,35 @@ function untrack(fn) {
539
642
  }
540
643
  function hasUpdated(fn) {
541
644
  const current = updateCheck;
542
- updateCheck = { e: false };
645
+ updateCheck = { c: false };
543
646
  try {
544
647
  fn();
545
- return updateCheck.e;
648
+ return updateCheck.c;
546
649
  } finally {
547
650
  updateCheck = current;
548
651
  }
549
652
  }
550
- function isPending(fn) {
653
+ function isStale(fn) {
654
+ const current = staleCheck;
655
+ staleCheck = { c: false };
551
656
  try {
552
- fn();
553
- return false;
554
- } catch (e) {
555
- return e instanceof NotReadyError;
657
+ latest(fn);
658
+ return staleCheck.c;
659
+ } catch {
660
+ } finally {
661
+ staleCheck = current;
556
662
  }
663
+ return false;
557
664
  }
558
- function resolveSync(fn) {
665
+ function latest(fn) {
559
666
  const prevFlags = newFlags;
560
- syncResolve = true;
667
+ const prevNotStale = notStale;
668
+ notStale = false;
561
669
  try {
562
670
  return fn();
563
- } catch {
564
671
  } finally {
565
672
  newFlags = prevFlags;
566
- syncResolve = false;
673
+ notStale = prevNotStale;
567
674
  }
568
675
  }
569
676
  function catchError(fn) {
@@ -575,245 +682,171 @@ function catchError(fn) {
575
682
  return e;
576
683
  }
577
684
  }
578
- function compute(owner, compute2, observer) {
579
- const prevOwner = setOwner(owner), prevObserver = currentObserver, prevMask = currentMask;
685
+ function compute(owner, fn, observer) {
686
+ const prevOwner = setOwner(owner), prevObserver = currentObserver, prevMask = currentMask, prevNotStale = notStale;
580
687
  currentObserver = observer;
581
- currentMask = observer?.M ?? DEFAULT_FLAGS;
688
+ currentMask = observer?.O ?? DEFAULT_FLAGS;
689
+ notStale = true;
582
690
  try {
583
- return compute2(observer ? observer.e : void 0);
691
+ return fn(observer ? observer.c : void 0);
584
692
  } finally {
585
693
  setOwner(prevOwner);
586
694
  currentObserver = prevObserver;
587
695
  currentMask = prevMask;
588
- }
589
- }
590
-
591
- // src/core/scheduler.ts
592
- var scheduled = false;
593
- function schedule() {
594
- if (scheduled)
595
- return;
596
- scheduled = true;
597
- if (!globalQueue.I)
598
- queueMicrotask(flushSync);
599
- }
600
- var Queue = class {
601
- I = false;
602
- t = [[], [], []];
603
- E = [];
604
- enqueue(type, node) {
605
- this.t[0].push(node);
606
- if (type)
607
- this.t[type].push(node);
608
- schedule();
609
- }
610
- run(type) {
611
- if (this.t[type].length) {
612
- if (type === EFFECT_PURE) {
613
- runPureQueue(this.t[type]);
614
- this.t[type] = [];
615
- } else {
616
- const effects = this.t[type];
617
- this.t[type] = [];
618
- runEffectQueue(effects);
619
- }
620
- }
621
- let rerun = false;
622
- for (let i = 0; i < this.E.length; i++) {
623
- rerun = this.E[i].run(type) || rerun;
624
- }
625
- if (type === EFFECT_PURE && this.t[type].length)
626
- return true;
627
- }
628
- flush() {
629
- if (this.I)
630
- return;
631
- this.I = true;
632
- try {
633
- while (this.run(EFFECT_PURE)) {
634
- }
635
- incrementClock();
636
- scheduled = false;
637
- this.run(EFFECT_RENDER);
638
- this.run(EFFECT_USER);
639
- } finally {
640
- this.I = false;
641
- }
642
- }
643
- addChild(child) {
644
- this.E.push(child);
645
- }
646
- removeChild(child) {
647
- const index = this.E.indexOf(child);
648
- if (index >= 0)
649
- this.E.splice(index, 1);
650
- }
651
- };
652
- var globalQueue = new Queue();
653
- function flushSync() {
654
- while (scheduled) {
655
- globalQueue.flush();
696
+ notStale = prevNotStale;
656
697
  }
657
698
  }
658
699
  function createBoundary(fn, queue) {
659
700
  const owner = new Owner();
660
- const parentQueue = owner.g || globalQueue;
661
- parentQueue.addChild(owner.g = queue);
662
- onCleanup(() => parentQueue.removeChild(owner.g));
701
+ const parentQueue = owner.h;
702
+ parentQueue.addChild(owner.h = queue);
703
+ onCleanup(() => parentQueue.removeChild(owner.h));
663
704
  return compute(owner, fn, null);
664
705
  }
665
- function runTop(node) {
666
- const ancestors = [];
667
- for (let current = node; current !== null; current = current.r) {
668
- if (current.a !== STATE_CLEAN) {
669
- ancestors.push(current);
670
- }
671
- }
672
- for (let i = ancestors.length - 1; i >= 0; i--) {
673
- if (ancestors[i].a !== STATE_DISPOSED)
674
- ancestors[i].x();
675
- }
676
- }
677
- function runPureQueue(queue) {
678
- for (let i = 0; i < queue.length; i++) {
679
- if (queue[i].a !== STATE_CLEAN)
680
- runTop(queue[i]);
681
- }
682
- }
683
- function runEffectQueue(queue) {
684
- for (let i = 0; i < queue.length; i++)
685
- queue[i].V();
686
- }
687
706
 
688
707
  // src/core/effect.ts
689
708
  var Effect = class extends Computation {
690
- J;
691
- A;
692
- B;
693
- P = false;
694
709
  K;
695
- C;
696
- g;
710
+ L;
711
+ B;
712
+ Q = false;
713
+ M;
714
+ w;
697
715
  constructor(initialValue, compute2, effect, error, options) {
698
716
  super(initialValue, compute2, options);
699
- this.J = effect;
700
- this.A = error;
701
- this.K = initialValue;
702
- this.C = options?.render ? EFFECT_RENDER : EFFECT_USER;
703
- this.g = getOwner()?.g || globalQueue;
717
+ this.K = effect;
718
+ this.L = error;
719
+ this.M = initialValue;
720
+ this.w = options?.render ? EFFECT_RENDER : EFFECT_USER;
721
+ if (this.w === EFFECT_RENDER) {
722
+ this.u = (p) => latest(() => compute2(p));
723
+ }
704
724
  if (!options?.defer) {
705
- this.x();
706
- this.C === EFFECT_USER ? this.g.enqueue(this.C, this) : this.V();
725
+ this.y();
726
+ this.w === EFFECT_USER ? this.h.enqueue(this.w, this) : this.T();
707
727
  }
708
728
  }
709
729
  write(value, flags = 0) {
710
- const currentFlags = this.h;
711
- this.h = flags;
712
- if (this.C === EFFECT_RENDER && (flags & LOADING_BIT) !== (currentFlags & LOADING_BIT)) {
713
- this.g.Q?.(this);
730
+ if (this.a == STATE_DIRTY) {
731
+ const currentFlags = this.b;
732
+ this.b = flags;
733
+ if (this.w === EFFECT_RENDER && (flags & LOADING_BIT) !== (currentFlags & LOADING_BIT)) {
734
+ this.h.R?.(this);
735
+ }
714
736
  }
715
737
  if (value === UNCHANGED)
716
- return this.e;
717
- this.e = value;
718
- this.P = true;
738
+ return this.c;
739
+ this.c = value;
740
+ this.Q = true;
719
741
  return value;
720
742
  }
721
743
  q(state, skipQueue) {
722
744
  if (this.a >= state || skipQueue)
723
745
  return;
724
746
  if (this.a === STATE_CLEAN)
725
- this.g.enqueue(this.C, this);
747
+ this.h.enqueue(this.w, this);
726
748
  this.a = state;
727
749
  }
728
- O(error) {
750
+ J(error) {
729
751
  this.B?.();
730
- if (this.h & LOADING_BIT) {
731
- this.h = 0;
732
- this.g.Q?.(this);
752
+ if (this.b & LOADING_BIT) {
753
+ this.b = 0;
754
+ this.h.R?.(this);
733
755
  }
734
- if (this.C === EFFECT_USER) {
756
+ if (this.w === EFFECT_USER) {
735
757
  try {
736
- return this.A ? this.B = this.A(error) : console.error(new EffectError(this.J, error));
758
+ return this.L ? this.B = this.L(error) : console.error(new EffectError(this.K, error));
737
759
  } catch (e) {
738
760
  error = e;
739
761
  }
740
762
  }
741
763
  this.handleError(error);
742
764
  }
743
- y() {
765
+ A() {
744
766
  if (this.a === STATE_DISPOSED)
745
767
  return;
746
- this.J = void 0;
747
768
  this.K = void 0;
748
- this.A = void 0;
769
+ this.M = void 0;
770
+ this.L = void 0;
749
771
  this.B?.();
750
772
  this.B = void 0;
751
- super.y();
773
+ super.A();
752
774
  }
753
- V() {
754
- if (this.P && this.a !== STATE_DISPOSED) {
775
+ T() {
776
+ if (this.Q && this.a !== STATE_DISPOSED) {
755
777
  this.B?.();
756
778
  try {
757
- this.B = this.J(this.e, this.K);
779
+ this.B = this.K(this.c, this.M);
758
780
  } catch (e) {
759
781
  this.handleError(e);
760
782
  } finally {
761
- this.K = this.e;
762
- this.P = false;
783
+ this.M = this.c;
784
+ this.Q = false;
763
785
  }
764
786
  }
765
787
  }
766
788
  };
767
789
  var EagerComputation = class extends Computation {
768
- g;
769
790
  constructor(initialValue, compute2, options) {
770
791
  super(initialValue, compute2, options);
771
- this.g = getOwner()?.g || globalQueue;
772
- this.x();
792
+ !options?.defer && this.y();
773
793
  }
774
794
  q(state, skipQueue) {
775
- if (this.a >= state && !this.H)
795
+ if (this.a >= state && !this.I)
776
796
  return;
777
797
  if (this.a === STATE_CLEAN && !skipQueue)
778
- this.g.enqueue(EFFECT_PURE, this);
798
+ this.h.enqueue(EFFECT_PURE, this);
779
799
  super.q(state, skipQueue);
780
800
  }
781
801
  };
802
+ var ProjectionComputation = class extends Computation {
803
+ constructor(compute2) {
804
+ super(null, compute2);
805
+ }
806
+ q(state, skipQueue) {
807
+ if (this.a >= state && !this.I)
808
+ return;
809
+ if (this.a === STATE_CLEAN && !skipQueue)
810
+ this.h.enqueue(EFFECT_PURE, this);
811
+ super.q(state, true);
812
+ }
813
+ };
782
814
 
783
815
  // src/core/suspense.ts
784
816
  var SuspenseQueue = class extends Queue {
785
- c = /* @__PURE__ */ new Set();
817
+ e = /* @__PURE__ */ new Set();
786
818
  o = false;
787
- R = new Computation(false, null);
819
+ S = new Computation(false, null);
788
820
  run(type) {
789
821
  if (type && this.o)
790
822
  return;
791
823
  return super.run(type);
792
824
  }
793
- Q(node) {
794
- if (node.h & LOADING_BIT) {
795
- this.c.add(node);
825
+ R(node) {
826
+ if (node.b & LOADING_BIT) {
827
+ this.e.add(node);
796
828
  if (!this.o) {
797
829
  this.o = true;
798
- this.R.write(true);
830
+ this.S.write(true);
799
831
  }
800
832
  } else {
801
- this.c.delete(node);
802
- if (this.c.size === 0) {
833
+ this.e.delete(node);
834
+ if (this.e.size === 0) {
803
835
  this.o = false;
804
- this.R.write(false);
836
+ this.S.write(false);
805
837
  }
806
838
  }
807
839
  }
808
840
  };
809
841
  var LiveComputation = class extends EagerComputation {
810
842
  write(value, flags = 0) {
811
- const currentFlags = this.h;
843
+ const currentFlags = this.b;
844
+ const dirty = this.a === STATE_DIRTY;
812
845
  super.write(value, flags);
813
- if ((flags & LOADING_BIT) !== (currentFlags & LOADING_BIT)) {
814
- this.g.Q?.(this);
846
+ if (dirty && (flags & LOADING_BIT) !== (currentFlags & LOADING_BIT)) {
847
+ this.h.R?.(this);
815
848
  }
816
- return this.e;
849
+ return this.c;
817
850
  }
818
851
  };
819
852
  function createSuspense(fn, fallback) {
@@ -822,7 +855,7 @@ function createSuspense(fn, fallback) {
822
855
  const child = new Computation(null, fn);
823
856
  return new LiveComputation(null, () => flatten(child.wait()));
824
857
  }, queue);
825
- const equality = new Computation(null, () => queue.R.read() || queue.o);
858
+ const equality = new Computation(null, () => queue.S.read() || queue.o);
826
859
  const comp = new Computation(null, () => equality.read() ? fallback() : tree.read());
827
860
  return comp.read.bind(comp);
828
861
  }
@@ -853,24 +886,25 @@ function createMemo(compute2, value, options) {
853
886
  return () => {
854
887
  if (node) {
855
888
  resolvedValue = node.wait();
856
- if (!node.d?.length && node.n?.r !== node) {
889
+ if (!node.f?.length && node.n?.s !== node) {
857
890
  node.dispose();
858
891
  node = void 0;
859
- } else if (!node.r && !node.b?.length) {
892
+ } else if (!node.s && !node.d?.length) {
860
893
  node.dispose();
861
- node.a = STATE_UNINITIALIZED;
894
+ node.a = STATE_DIRTY;
862
895
  }
863
896
  }
864
897
  return resolvedValue;
865
898
  };
866
899
  }
867
900
  function createAsync(compute2, value, options) {
901
+ let uninitialized = value === void 0;
868
902
  const lhs = new EagerComputation(
869
903
  {
870
- e: value
904
+ c: value
871
905
  },
872
906
  (p) => {
873
- const value2 = p?.e;
907
+ const value2 = p?.c;
874
908
  const source = compute2(value2);
875
909
  const isPromise = source instanceof Promise;
876
910
  const iterator = source[Symbol.asyncIterator];
@@ -879,26 +913,28 @@ function createAsync(compute2, value, options) {
879
913
  wait() {
880
914
  return source;
881
915
  },
882
- e: source
916
+ c: source
883
917
  };
884
918
  }
885
919
  const signal = new Computation(value2, null, options);
886
920
  const w = signal.wait;
887
921
  signal.wait = function() {
888
- if (signal.h & ERROR_BIT && signal.z <= getClock()) {
922
+ if (signal.b & ERROR_BIT && signal.z <= getClock()) {
889
923
  lhs.q(STATE_DIRTY);
890
924
  throw new NotReadyError();
891
925
  }
892
926
  return w.call(this);
893
927
  };
894
- signal.write(UNCHANGED, LOADING_BIT);
928
+ signal.write(UNCHANGED, LOADING_BIT | (uninitialized ? UNINITIALIZED_BIT : 0));
895
929
  if (isPromise) {
896
930
  source.then(
897
931
  (value3) => {
932
+ uninitialized = false;
898
933
  signal.write(value3, 0, true);
899
934
  },
900
935
  (error) => {
901
- signal.write(error, ERROR_BIT);
936
+ uninitialized = true;
937
+ signal.J(error);
902
938
  }
903
939
  );
904
940
  } else {
@@ -950,16 +986,31 @@ function runWithOwner(owner, run) {
950
986
  }
951
987
  function createErrorBoundary(fn, fallback) {
952
988
  const owner = new Owner();
953
- const error = new Computation(null, null);
954
- const reset = new Computation(null, null, { equals: false });
955
- const handler = (err) => error.write({ A: err });
989
+ const error = new Computation(void 0, null);
990
+ const nodes = /* @__PURE__ */ new Set();
991
+ function handler(err, node) {
992
+ if (nodes.has(node))
993
+ return;
994
+ compute(
995
+ node,
996
+ () => onCleanup(() => {
997
+ nodes.delete(node);
998
+ if (!nodes.size)
999
+ error.write(void 0);
1000
+ }),
1001
+ null
1002
+ );
1003
+ nodes.add(node);
1004
+ if (nodes.size === 1)
1005
+ error.write({ E: err });
1006
+ }
956
1007
  owner.m = owner.m ? [handler, ...owner.m] : [handler];
957
1008
  const guarded = compute(
958
1009
  owner,
959
1010
  () => {
960
- const c = new Computation(null, () => (reset.read(), fn()));
961
- const f = new Computation(null, () => flatten(c.read()));
962
- f.O = function(error2) {
1011
+ const c = new Computation(void 0, fn);
1012
+ const f = new EagerComputation(void 0, () => flatten(c.read()), { defer: true });
1013
+ f.J = function(error2) {
963
1014
  this.handleError(error2);
964
1015
  };
965
1016
  return f;
@@ -972,24 +1023,29 @@ function createErrorBoundary(fn, fallback) {
972
1023
  if (!error.read())
973
1024
  return resolved;
974
1025
  }
975
- return fallback(error.read().A, () => {
976
- error.write(null);
977
- reset.write(null);
1026
+ return fallback(error.read().E, () => {
1027
+ incrementClock();
1028
+ for (let node of nodes) {
1029
+ node.a = STATE_DIRTY;
1030
+ node.h?.enqueue(node.w, node);
1031
+ }
978
1032
  });
979
1033
  });
980
1034
  return decision.read.bind(decision);
981
1035
  }
982
1036
  function resolve(fn) {
983
1037
  return new Promise((res, rej) => {
984
- let node = new EagerComputation(void 0, () => {
985
- try {
986
- res(fn());
987
- } catch (err) {
988
- if (err instanceof NotReadyError)
989
- throw err;
990
- rej(err);
991
- }
992
- node.dispose(true);
1038
+ createRoot((dispose) => {
1039
+ new EagerComputation(void 0, () => {
1040
+ try {
1041
+ res(fn());
1042
+ } catch (err) {
1043
+ if (err instanceof NotReadyError)
1044
+ throw err;
1045
+ rej(err);
1046
+ }
1047
+ dispose();
1048
+ });
993
1049
  });
994
1050
  });
995
1051
  }
@@ -1000,26 +1056,17 @@ function createReaction(effect, error, options) {
1000
1056
  ...void 0
1001
1057
  });
1002
1058
  return (tracking) => {
1003
- node.w = tracking;
1059
+ node.u = tracking;
1004
1060
  node.a = STATE_DIRTY;
1005
- node.x();
1006
- node.w = null;
1061
+ node.y();
1062
+ node.u = null;
1007
1063
  };
1008
1064
  }
1009
1065
 
1010
1066
  // src/store/projection.ts
1011
- var ProjectionComputation = class extends EagerComputation {
1012
- q(state, skipQueue) {
1013
- if (this.a >= state && !this.H)
1014
- return;
1015
- if (this.a === STATE_CLEAN && !skipQueue)
1016
- this.g.enqueue(EFFECT_PURE, this);
1017
- super.q(state, true);
1018
- }
1019
- };
1020
1067
  function createProjection(fn, initialValue = {}) {
1021
1068
  const [store, setStore] = createStore(initialValue);
1022
- const node = new ProjectionComputation(void 0, () => {
1069
+ const node = new ProjectionComputation(() => {
1023
1070
  setStore(fn);
1024
1071
  });
1025
1072
  const wrapped = /* @__PURE__ */ new WeakMap();
@@ -1161,7 +1208,7 @@ var proxyTraps = {
1161
1208
  return desc.get.call(receiver);
1162
1209
  }
1163
1210
  if (Writing.has(storeValue)) {
1164
- const value2 = tracked ? tracked.e : storeValue[property];
1211
+ const value2 = tracked ? tracked.c : storeValue[property];
1165
1212
  return isWrappable(value2) ? (Writing.add(value2[$RAW] || value2), wrap2(value2)) : value2;
1166
1213
  }
1167
1214
  let value = tracked ? nodes[property].read() : storeValue[property];
@@ -1502,19 +1549,19 @@ function mapArray(list, map, options) {
1502
1549
  return updateKeyedMap.bind({
1503
1550
  F: new Owner(),
1504
1551
  i: 0,
1505
- W: list,
1506
- u: [],
1552
+ X: list,
1553
+ x: [],
1507
1554
  G: map,
1508
- f: [],
1509
- c: [],
1510
- D: keyFn,
1555
+ g: [],
1556
+ e: [],
1557
+ C: keyFn,
1511
1558
  j: keyFn || options?.keyed === false ? [] : void 0,
1512
1559
  k: map.length > 1 ? [] : void 0,
1513
1560
  o: options?.fallback
1514
1561
  });
1515
1562
  }
1516
1563
  function updateKeyedMap() {
1517
- const newItems = this.W() || [], newLen = newItems.length;
1564
+ const newItems = this.X() || [], newLen = newItems.length;
1518
1565
  newItems[$TRACK];
1519
1566
  runWithOwner(this.F, () => {
1520
1567
  let i, j, mapper = this.j ? () => {
@@ -1535,38 +1582,38 @@ function updateKeyedMap() {
1535
1582
  if (newLen === 0) {
1536
1583
  if (this.i !== 0) {
1537
1584
  this.F.dispose(false);
1538
- this.c = [];
1539
- this.u = [];
1540
- this.f = [];
1585
+ this.e = [];
1586
+ this.x = [];
1587
+ this.g = [];
1541
1588
  this.i = 0;
1542
1589
  this.j && (this.j = []);
1543
1590
  this.k && (this.k = []);
1544
1591
  }
1545
- if (this.o && !this.f[0]) {
1546
- this.f[0] = compute(
1547
- this.c[0] = new Owner(),
1592
+ if (this.o && !this.g[0]) {
1593
+ this.g[0] = compute(
1594
+ this.e[0] = new Owner(),
1548
1595
  this.o,
1549
1596
  null
1550
1597
  );
1551
1598
  }
1552
1599
  } else if (this.i === 0) {
1553
- if (this.c[0])
1554
- this.c[0].dispose();
1555
- this.f = new Array(newLen);
1600
+ if (this.e[0])
1601
+ this.e[0].dispose();
1602
+ this.g = new Array(newLen);
1556
1603
  for (j = 0; j < newLen; j++) {
1557
- this.u[j] = newItems[j];
1558
- this.f[j] = compute(this.c[j] = new Owner(), mapper, null);
1604
+ this.x[j] = newItems[j];
1605
+ this.g[j] = compute(this.e[j] = new Owner(), mapper, null);
1559
1606
  }
1560
1607
  this.i = newLen;
1561
1608
  } else {
1562
1609
  let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.j ? new Array(newLen) : void 0, tempIndexes = this.k ? new Array(newLen) : void 0;
1563
- for (start = 0, end = Math.min(this.i, newLen); start < end && (this.u[start] === newItems[start] || this.j && compare(this.D, this.u[start], newItems[start])); start++) {
1610
+ for (start = 0, end = Math.min(this.i, newLen); start < end && (this.x[start] === newItems[start] || this.j && compare(this.C, this.x[start], newItems[start])); start++) {
1564
1611
  if (this.j)
1565
1612
  this.j[start].write(newItems[start]);
1566
1613
  }
1567
- for (end = this.i - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.u[end] === newItems[newEnd] || this.j && compare(this.D, this.u[end], newItems[newEnd])); end--, newEnd--) {
1568
- temp[newEnd] = this.f[end];
1569
- tempNodes[newEnd] = this.c[end];
1614
+ for (end = this.i - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.x[end] === newItems[newEnd] || this.j && compare(this.C, this.x[end], newItems[newEnd])); end--, newEnd--) {
1615
+ temp[newEnd] = this.g[end];
1616
+ tempNodes[newEnd] = this.e[end];
1570
1617
  tempRows && (tempRows[newEnd] = this.j[end]);
1571
1618
  tempIndexes && (tempIndexes[newEnd] = this.k[end]);
1572
1619
  }
@@ -1574,29 +1621,29 @@ function updateKeyedMap() {
1574
1621
  newIndicesNext = new Array(newEnd + 1);
1575
1622
  for (j = newEnd; j >= start; j--) {
1576
1623
  item = newItems[j];
1577
- key = this.D ? this.D(item) : item;
1624
+ key = this.C ? this.C(item) : item;
1578
1625
  i = newIndices.get(key);
1579
1626
  newIndicesNext[j] = i === void 0 ? -1 : i;
1580
1627
  newIndices.set(key, j);
1581
1628
  }
1582
1629
  for (i = start; i <= end; i++) {
1583
- item = this.u[i];
1584
- key = this.D ? this.D(item) : item;
1630
+ item = this.x[i];
1631
+ key = this.C ? this.C(item) : item;
1585
1632
  j = newIndices.get(key);
1586
1633
  if (j !== void 0 && j !== -1) {
1587
- temp[j] = this.f[i];
1588
- tempNodes[j] = this.c[i];
1634
+ temp[j] = this.g[i];
1635
+ tempNodes[j] = this.e[i];
1589
1636
  tempRows && (tempRows[j] = this.j[i]);
1590
1637
  tempIndexes && (tempIndexes[j] = this.k[i]);
1591
1638
  j = newIndicesNext[j];
1592
1639
  newIndices.set(key, j);
1593
1640
  } else
1594
- this.c[i].dispose();
1641
+ this.e[i].dispose();
1595
1642
  }
1596
1643
  for (j = start; j < newLen; j++) {
1597
1644
  if (j in temp) {
1598
- this.f[j] = temp[j];
1599
- this.c[j] = tempNodes[j];
1645
+ this.g[j] = temp[j];
1646
+ this.e[j] = tempNodes[j];
1600
1647
  if (tempRows) {
1601
1648
  this.j[j] = tempRows[j];
1602
1649
  this.j[j].write(newItems[j]);
@@ -1606,63 +1653,63 @@ function updateKeyedMap() {
1606
1653
  this.k[j].write(j);
1607
1654
  }
1608
1655
  } else {
1609
- this.f[j] = compute(this.c[j] = new Owner(), mapper, null);
1656
+ this.g[j] = compute(this.e[j] = new Owner(), mapper, null);
1610
1657
  }
1611
1658
  }
1612
- this.f = this.f.slice(0, this.i = newLen);
1613
- this.u = newItems.slice(0);
1659
+ this.g = this.g.slice(0, this.i = newLen);
1660
+ this.x = newItems.slice(0);
1614
1661
  }
1615
1662
  });
1616
- return this.f;
1663
+ return this.g;
1617
1664
  }
1618
1665
  function repeat(count, map, options) {
1619
1666
  return updateRepeat.bind({
1620
1667
  F: new Owner(),
1621
1668
  i: 0,
1622
- X: count,
1669
+ Y: count,
1623
1670
  G: map,
1624
- c: [],
1625
- f: [],
1671
+ e: [],
1672
+ g: [],
1626
1673
  o: options?.fallback
1627
1674
  });
1628
1675
  }
1629
1676
  function updateRepeat() {
1630
- const newLen = this.X();
1677
+ const newLen = this.Y();
1631
1678
  runWithOwner(this.F, () => {
1632
1679
  if (newLen === 0) {
1633
1680
  if (this.i !== 0) {
1634
1681
  this.F.dispose(false);
1635
- this.c = [];
1636
- this.f = [];
1682
+ this.e = [];
1683
+ this.g = [];
1637
1684
  this.i = 0;
1638
1685
  }
1639
- if (this.o && !this.f[0]) {
1640
- this.f[0] = compute(
1641
- this.c[0] = new Owner(),
1686
+ if (this.o && !this.g[0]) {
1687
+ this.g[0] = compute(
1688
+ this.e[0] = new Owner(),
1642
1689
  this.o,
1643
1690
  null
1644
1691
  );
1645
1692
  }
1646
1693
  } else {
1647
- if (this.i === 0 && this.c[0])
1648
- this.c[0].dispose();
1694
+ if (this.i === 0 && this.e[0])
1695
+ this.e[0].dispose();
1649
1696
  for (let i = this.i; i < newLen; i++) {
1650
- this.f[i] = compute(
1651
- this.c[i] = new Owner(),
1697
+ this.g[i] = compute(
1698
+ this.e[i] = new Owner(),
1652
1699
  () => this.G(i),
1653
1700
  null
1654
1701
  );
1655
1702
  }
1656
1703
  for (let i = newLen; i < this.i; i++)
1657
- this.c[i].dispose();
1658
- this.f = this.f.slice(0, newLen);
1704
+ this.e[i].dispose();
1705
+ this.g = this.g.slice(0, newLen);
1659
1706
  this.i = newLen;
1660
1707
  }
1661
1708
  });
1662
- return this.f;
1709
+ return this.g;
1663
1710
  }
1664
1711
  function compare(key, a, b) {
1665
1712
  return key ? key(a) === key(b) : true;
1666
1713
  }
1667
1714
 
1668
- export { $PROXY, $RAW, $TARGET, $TRACK, Computation, ContextNotFoundError, NoOwnerError, NotReadyError, Owner, Queue, SUPPORTS_PROXY, catchError, createAsync, createBoundary, createContext, createEffect, createErrorBoundary, createMemo, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createSuspense, flatten, flushSync, getContext, getObserver, getOwner, hasContext, hasUpdated, isEqual, isPending, isWrappable, mapArray, merge, omit, onCleanup, reconcile, repeat, resolve, resolveSync, runWithOwner, setContext, untrack, unwrap };
1715
+ export { $PROXY, $RAW, $TARGET, $TRACK, Computation, ContextNotFoundError, NoOwnerError, NotReadyError, Owner, Queue, SUPPORTS_PROXY, catchError, createAsync, createBoundary, createContext, createEffect, createErrorBoundary, createMemo, createProjection, createReaction, createRenderEffect, createRoot, createSignal, createStore, createSuspense, flatten, flushSync, getContext, getObserver, getOwner, hasContext, hasUpdated, isEqual, isStale, isWrappable, latest, mapArray, merge, omit, onCleanup, reconcile, repeat, resolve, runWithOwner, setContext, untrack, unwrap };