@solidjs/signals 0.2.3 → 0.2.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/prod.js CHANGED
@@ -43,42 +43,42 @@ function schedule() {
43
43
  if (scheduled)
44
44
  return;
45
45
  scheduled = true;
46
- if (!globalQueue.I)
46
+ if (!globalQueue.J)
47
47
  queueMicrotask(flushSync);
48
48
  }
49
49
  var Queue = class {
50
- I = false;
51
- r = [[], [], []];
52
- D = [];
50
+ J = false;
51
+ s = [[], [], []];
52
+ F = [];
53
53
  created = clock;
54
54
  enqueue(type, node) {
55
- this.r[0].push(node);
55
+ this.s[0].push(node);
56
56
  if (type)
57
- this.r[type].push(node);
57
+ this.s[type].push(node);
58
58
  schedule();
59
59
  }
60
60
  run(type) {
61
- if (this.r[type].length) {
61
+ if (this.s[type].length) {
62
62
  if (type === EFFECT_PURE) {
63
- runPureQueue(this.r[type]);
64
- this.r[type] = [];
63
+ runPureQueue(this.s[type]);
64
+ this.s[type] = [];
65
65
  } else {
66
- const effects = this.r[type];
67
- this.r[type] = [];
66
+ const effects = this.s[type];
67
+ this.s[type] = [];
68
68
  runEffectQueue(effects);
69
69
  }
70
70
  }
71
71
  let rerun = false;
72
- for (let i = 0; i < this.D.length; i++) {
73
- rerun = this.D[i].run(type) || rerun;
72
+ for (let i = 0; i < this.F.length; i++) {
73
+ rerun = this.F[i].run(type) || rerun;
74
74
  }
75
- if (type === EFFECT_PURE && this.r[type].length)
75
+ if (type === EFFECT_PURE && this.s[type].length)
76
76
  return true;
77
77
  }
78
78
  flush() {
79
- if (this.I)
79
+ if (this.J)
80
80
  return;
81
- this.I = true;
81
+ this.J = true;
82
82
  try {
83
83
  while (this.run(EFFECT_PURE)) {
84
84
  }
@@ -87,16 +87,16 @@ var Queue = class {
87
87
  this.run(EFFECT_RENDER);
88
88
  this.run(EFFECT_USER);
89
89
  } finally {
90
- this.I = false;
90
+ this.J = false;
91
91
  }
92
92
  }
93
93
  addChild(child) {
94
- this.D.push(child);
94
+ this.F.push(child);
95
95
  }
96
96
  removeChild(child) {
97
- const index = this.D.indexOf(child);
97
+ const index = this.F.indexOf(child);
98
98
  if (index >= 0)
99
- this.D.splice(index, 1);
99
+ this.F.splice(index, 1);
100
100
  }
101
101
  };
102
102
  var globalQueue = new Queue();
@@ -107,14 +107,14 @@ function flushSync() {
107
107
  }
108
108
  function runTop(node) {
109
109
  const ancestors = [];
110
- for (let current = node; current !== null; current = current.s) {
110
+ for (let current = node; current !== null; current = current.t) {
111
111
  if (current.a !== STATE_CLEAN) {
112
112
  ancestors.push(current);
113
113
  }
114
114
  }
115
115
  for (let i = ancestors.length - 1; i >= 0; i--) {
116
116
  if (ancestors[i].a !== STATE_DISPOSED)
117
- ancestors[i].y();
117
+ ancestors[i].z();
118
118
  }
119
119
  }
120
120
  function runPureQueue(queue) {
@@ -125,7 +125,7 @@ function runPureQueue(queue) {
125
125
  }
126
126
  function runEffectQueue(queue) {
127
127
  for (let i = 0; i < queue.length; i++)
128
- queue[i].T();
128
+ queue[i].U();
129
129
  }
130
130
 
131
131
  // src/core/utils.ts
@@ -148,9 +148,9 @@ var Owner = class {
148
148
  // We flatten the owner tree into a linked list so that we don't need a pointer to .firstChild
149
149
  // However, the children are actually added in reverse creation order
150
150
  // See comment at the top of the file for an example of the _nextSibling traversal
151
- s = null;
152
- n = null;
153
151
  t = null;
152
+ n = null;
153
+ u = null;
154
154
  a = STATE_CLEAN;
155
155
  l = null;
156
156
  p = defaultContext;
@@ -161,10 +161,10 @@ var Owner = class {
161
161
  currentOwner.append(this);
162
162
  }
163
163
  append(child) {
164
- child.s = this;
165
164
  child.t = this;
165
+ child.u = this;
166
166
  if (this.n)
167
- this.n.t = child;
167
+ this.n.u = child;
168
168
  child.n = this.n;
169
169
  this.n = child;
170
170
  if (child.p !== this.p) {
@@ -179,26 +179,26 @@ var Owner = class {
179
179
  dispose(self = true) {
180
180
  if (this.a === STATE_DISPOSED)
181
181
  return;
182
- let head = self ? this.t || this.s : this, current = this.n, next = null;
183
- while (current && current.s === this) {
182
+ let head = self ? this.u || this.t : this, current = this.n, next = null;
183
+ while (current && current.t === this) {
184
184
  current.dispose(true);
185
- current.z();
185
+ current.A();
186
186
  next = current.n;
187
187
  current.n = null;
188
188
  current = next;
189
189
  }
190
190
  if (self)
191
- this.z();
191
+ this.A();
192
192
  if (current)
193
- current.t = !self ? this : this.t;
193
+ current.u = !self ? this : this.u;
194
194
  if (head)
195
195
  head.n = current;
196
196
  }
197
- z() {
198
- if (this.t)
199
- this.t.n = null;
200
- this.s = null;
197
+ A() {
198
+ if (this.u)
199
+ this.u.n = null;
201
200
  this.t = null;
201
+ this.u = null;
202
202
  this.p = defaultContext;
203
203
  this.m = null;
204
204
  this.a = STATE_DISPOSED;
@@ -296,48 +296,48 @@ function getObserver() {
296
296
  var UNCHANGED = Symbol(0);
297
297
  var Computation = class extends Owner {
298
298
  b = null;
299
- c = null;
300
- e;
301
- E;
302
- A;
299
+ e = null;
300
+ g;
301
+ G;
302
+ B;
303
303
  // Used in __DEV__ mode, hopefully removed in production
304
- Z;
304
+ $;
305
305
  // Using false is an optimization as an alternative to _equals: () => false
306
306
  // which could enable more efficient DIRTY notification
307
- N = isEqual;
308
- U;
307
+ O = isEqual;
308
+ V;
309
309
  /** Whether the computation is an error or has ancestors that are unresolved */
310
- d = 0;
310
+ f = 0;
311
311
  /** Which flags raised by sources are handled, vs. being passed through. */
312
- O = DEFAULT_FLAGS;
313
- P = null;
314
- x = -1;
315
- J = false;
312
+ P = DEFAULT_FLAGS;
313
+ Q = null;
314
+ y = -1;
315
+ K = false;
316
316
  constructor(initialValue, compute2, options) {
317
317
  super(compute2 === null);
318
- this.A = compute2;
318
+ this.B = compute2;
319
319
  this.a = compute2 ? STATE_DIRTY : STATE_CLEAN;
320
- this.d = compute2 && initialValue === void 0 ? UNINITIALIZED_BIT : 0;
321
- this.e = initialValue;
320
+ this.f = compute2 && initialValue === void 0 ? UNINITIALIZED_BIT : 0;
321
+ this.g = initialValue;
322
322
  if (options?.equals !== void 0)
323
- this.N = options.equals;
323
+ this.O = options.equals;
324
324
  if (options?.unobserved)
325
- this.U = options?.unobserved;
325
+ this.V = options?.unobserved;
326
326
  }
327
- V() {
328
- if (this.A) {
329
- if (this.d & ERROR_BIT && this.x <= getClock())
327
+ W() {
328
+ if (this.B) {
329
+ if (this.f & ERROR_BIT && this.y <= getClock())
330
330
  update(this);
331
331
  else
332
- this.y();
332
+ this.z();
333
333
  }
334
- if (!this.A || this.b?.length)
334
+ if (!this.B || this.b?.length)
335
335
  track(this);
336
- newFlags |= this.d & ~currentMask;
337
- if (this.d & ERROR_BIT) {
338
- throw this.E;
336
+ newFlags |= this.f & ~currentMask;
337
+ if (this.f & ERROR_BIT) {
338
+ throw this.G;
339
339
  } else {
340
- return this.e;
340
+ return this.g;
341
341
  }
342
342
  }
343
343
  /**
@@ -345,7 +345,7 @@ var Computation = class extends Owner {
345
345
  * Automatically re-executes the surrounding computation when the value changes
346
346
  */
347
347
  read() {
348
- return this.V();
348
+ return this.W();
349
349
  }
350
350
  /**
351
351
  * Return the current value of this computation
@@ -355,15 +355,15 @@ var Computation = class extends Owner {
355
355
  * before continuing
356
356
  */
357
357
  wait() {
358
- if (this.A && this.d & ERROR_BIT && this.x <= getClock()) {
358
+ if (this.B && this.f & ERROR_BIT && this.y <= getClock()) {
359
359
  update(this);
360
360
  }
361
- if ((notStale || this.d & UNINITIALIZED_BIT) && this.loading()) {
361
+ if ((notStale || this.f & UNINITIALIZED_BIT) && this.loading()) {
362
362
  throw new NotReadyError();
363
363
  }
364
364
  if (staleCheck && this.loading())
365
- staleCheck.e = true;
366
- return this.V();
365
+ staleCheck.g = true;
366
+ return this.W();
367
367
  }
368
368
  /**
369
369
  * Return true if the computation is the value is dependent on an unresolved promise
@@ -373,44 +373,44 @@ var Computation = class extends Owner {
373
373
  * loading state changes
374
374
  */
375
375
  loading() {
376
- if (this.P === null) {
377
- this.P = loadingState(this);
376
+ if (this.Q === null) {
377
+ this.Q = loadingState(this);
378
378
  }
379
- return this.P.read();
379
+ return this.Q.read();
380
380
  }
381
381
  /** Update the computation with a new value. */
382
382
  write(value, flags = 0, raw = false) {
383
- const newValue = !raw && typeof value === "function" ? value(this.e) : value;
384
- const valueChanged = newValue !== UNCHANGED && (!!(this.d & UNINITIALIZED_BIT) || this.N === false || !this.N(this.e, newValue));
383
+ const newValue = !raw && typeof value === "function" ? value(this.g) : value;
384
+ const valueChanged = newValue !== UNCHANGED && (!!(this.f & UNINITIALIZED_BIT) || this.O === false || !this.O(this.g, newValue));
385
385
  if (valueChanged) {
386
- this.e = newValue;
387
- this.E = void 0;
388
- }
389
- const changedFlagsMask = this.d ^ flags, changedFlags = changedFlagsMask & flags;
390
- this.d = flags;
391
- this.x = getClock() + 1;
392
- if (this.c) {
393
- for (let i = 0; i < this.c.length; i++) {
386
+ this.g = newValue;
387
+ this.G = void 0;
388
+ }
389
+ const changedFlagsMask = this.f ^ flags, changedFlags = changedFlagsMask & flags;
390
+ this.f = flags;
391
+ this.y = getClock() + 1;
392
+ if (this.e) {
393
+ for (let i = 0; i < this.e.length; i++) {
394
394
  if (valueChanged) {
395
- this.c[i].q(STATE_DIRTY);
395
+ this.e[i].q(STATE_DIRTY);
396
396
  } else if (changedFlagsMask) {
397
- this.c[i].W(changedFlagsMask, changedFlags);
397
+ this.e[i].X(changedFlagsMask, changedFlags);
398
398
  }
399
399
  }
400
400
  }
401
- return this.e;
401
+ return this.g;
402
402
  }
403
403
  /**
404
404
  * Set the current node's state, and recursively mark all of this node's observers as STATE_CHECK
405
405
  */
406
406
  q(state, skipQueue) {
407
- if (this.a >= state && !this.J)
407
+ if (this.a >= state && !this.K)
408
408
  return;
409
- this.J = !!skipQueue;
409
+ this.K = !!skipQueue;
410
410
  this.a = state;
411
- if (this.c) {
412
- for (let i = 0; i < this.c.length; i++) {
413
- this.c[i].q(STATE_CHECK, skipQueue);
411
+ if (this.e) {
412
+ for (let i = 0; i < this.e.length; i++) {
413
+ this.e[i].q(STATE_CHECK, skipQueue);
414
414
  }
415
415
  }
416
416
  }
@@ -420,31 +420,31 @@ var Computation = class extends Owner {
420
420
  * @param mask A bitmask for which flag(s) were changed.
421
421
  * @param newFlags The source's new flags, masked to just the changed ones.
422
422
  */
423
- W(mask, newFlags2) {
423
+ X(mask, newFlags2) {
424
424
  if (this.a >= STATE_DIRTY)
425
425
  return;
426
- if (mask & this.O) {
426
+ if (mask & this.P) {
427
427
  this.q(STATE_DIRTY);
428
428
  return;
429
429
  }
430
430
  if (this.a >= STATE_CHECK)
431
431
  return;
432
- const prevFlags = this.d & mask;
432
+ const prevFlags = this.f & mask;
433
433
  const deltaFlags = prevFlags ^ newFlags2;
434
434
  if (newFlags2 === prevFlags) ; else if (deltaFlags & prevFlags & mask) {
435
435
  this.q(STATE_CHECK);
436
436
  } else {
437
- this.d ^= deltaFlags;
438
- if (this.c) {
439
- for (let i = 0; i < this.c.length; i++) {
440
- this.c[i].W(mask, newFlags2);
437
+ this.f ^= deltaFlags;
438
+ if (this.e) {
439
+ for (let i = 0; i < this.e.length; i++) {
440
+ this.e[i].X(mask, newFlags2);
441
441
  }
442
442
  }
443
443
  }
444
444
  }
445
- F(error) {
446
- this.E = error;
447
- this.write(UNCHANGED, this.d & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
445
+ H(error) {
446
+ this.G = error;
447
+ this.write(UNCHANGED, this.f & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
448
448
  }
449
449
  /**
450
450
  * This is the core part of the reactivity system, which makes sure that the values are updated
@@ -453,7 +453,7 @@ var Computation = class extends Owner {
453
453
  *
454
454
  * This function will ensure that the value and states we read from the computation are up to date
455
455
  */
456
- y() {
456
+ z() {
457
457
  if (this.a === STATE_DISPOSED) {
458
458
  throw new Error("Tried to read a disposed computation");
459
459
  }
@@ -463,8 +463,8 @@ var Computation = class extends Owner {
463
463
  let observerFlags = 0;
464
464
  if (this.a === STATE_CHECK) {
465
465
  for (let i = 0; i < this.b.length; i++) {
466
- this.b[i].y();
467
- observerFlags |= this.b[i].d;
466
+ this.b[i].z();
467
+ observerFlags |= this.b[i].f;
468
468
  if (this.a === STATE_DIRTY) {
469
469
  break;
470
470
  }
@@ -480,27 +480,27 @@ var Computation = class extends Owner {
480
480
  /**
481
481
  * Remove ourselves from the owner graph and the computation graph
482
482
  */
483
- z() {
483
+ A() {
484
484
  if (this.a === STATE_DISPOSED)
485
485
  return;
486
486
  if (this.b)
487
487
  removeSourceObservers(this, 0);
488
- super.z();
488
+ super.A();
489
489
  }
490
490
  };
491
491
  function loadingState(node) {
492
- const prevOwner = setOwner(node.s);
492
+ const prevOwner = setOwner(node.t);
493
493
  const options = void 0;
494
494
  const computation = new Computation(
495
495
  void 0,
496
496
  () => {
497
497
  track(node);
498
- node.y();
499
- return !!(node.d & LOADING_BIT);
498
+ node.z();
499
+ return !!(node.f & LOADING_BIT);
500
500
  },
501
501
  options
502
502
  );
503
- computation.O = ERROR_BIT | LOADING_BIT;
503
+ computation.P = ERROR_BIT | LOADING_BIT;
504
504
  setOwner(prevOwner);
505
505
  return computation;
506
506
  }
@@ -514,7 +514,7 @@ function track(computation) {
514
514
  newSources.push(computation);
515
515
  }
516
516
  if (updateCheck) {
517
- updateCheck.e = computation.x > currentObserver.x;
517
+ updateCheck.g = computation.y > currentObserver.y;
518
518
  }
519
519
  }
520
520
  }
@@ -526,13 +526,13 @@ function update(node) {
526
526
  try {
527
527
  node.dispose(false);
528
528
  node.emptyDisposal();
529
- const result = compute(node, node.A, node);
529
+ const result = compute(node, node.B, node);
530
530
  node.write(result, newFlags, true);
531
531
  } catch (error) {
532
532
  if (error instanceof NotReadyError) {
533
- node.write(UNCHANGED, newFlags | LOADING_BIT | node.d & UNINITIALIZED_BIT);
533
+ node.write(UNCHANGED, newFlags | LOADING_BIT | node.f & UNINITIALIZED_BIT);
534
534
  } else {
535
- node.F(error);
535
+ node.H(error);
536
536
  }
537
537
  } finally {
538
538
  if (newSources) {
@@ -549,10 +549,10 @@ function update(node) {
549
549
  let source;
550
550
  for (let i = newSourcesIndex; i < node.b.length; i++) {
551
551
  source = node.b[i];
552
- if (!source.c)
553
- source.c = [node];
552
+ if (!source.e)
553
+ source.e = [node];
554
554
  else
555
- source.c.push(node);
555
+ source.e.push(node);
556
556
  }
557
557
  } else if (node.b && newSourcesIndex < node.b.length) {
558
558
  removeSourceObservers(node, newSourcesIndex);
@@ -561,7 +561,7 @@ function update(node) {
561
561
  newSources = prevSources;
562
562
  newSourcesIndex = prevSourcesIndex;
563
563
  newFlags = prevFlags;
564
- node.x = getClock() + 1;
564
+ node.y = getClock() + 1;
565
565
  node.a = STATE_CLEAN;
566
566
  }
567
567
  }
@@ -570,12 +570,12 @@ function removeSourceObservers(node, index) {
570
570
  let swap;
571
571
  for (let i = index; i < node.b.length; i++) {
572
572
  source = node.b[i];
573
- if (source.c) {
574
- swap = source.c.indexOf(node);
575
- source.c[swap] = source.c[source.c.length - 1];
576
- source.c.pop();
577
- if (!source.c.length)
578
- source.U?.();
573
+ if (source.e) {
574
+ swap = source.e.indexOf(node);
575
+ source.e[swap] = source.e[source.e.length - 1];
576
+ source.e.pop();
577
+ if (!source.e.length)
578
+ source.V?.();
579
579
  }
580
580
  }
581
581
  }
@@ -589,10 +589,10 @@ function untrack(fn) {
589
589
  }
590
590
  function hasUpdated(fn) {
591
591
  const current = updateCheck;
592
- updateCheck = { e: false };
592
+ updateCheck = { g: false };
593
593
  try {
594
594
  fn();
595
- return updateCheck.e;
595
+ return updateCheck.g;
596
596
  } finally {
597
597
  updateCheck = current;
598
598
  }
@@ -600,10 +600,10 @@ function hasUpdated(fn) {
600
600
  function isPending(fn, loadingValue) {
601
601
  const argLength = arguments.length;
602
602
  const current = staleCheck;
603
- staleCheck = { e: false };
603
+ staleCheck = { g: false };
604
604
  try {
605
605
  latest(fn);
606
- return staleCheck.e;
606
+ return staleCheck.g;
607
607
  } catch (err) {
608
608
  if (!(err instanceof NotReadyError))
609
609
  return false;
@@ -650,10 +650,10 @@ function runWithObserver(observer, run) {
650
650
  if (error instanceof NotReadyError) {
651
651
  observer.write(
652
652
  UNCHANGED,
653
- newFlags | LOADING_BIT | observer.d & UNINITIALIZED_BIT
653
+ newFlags | LOADING_BIT | observer.f & UNINITIALIZED_BIT
654
654
  );
655
655
  } else {
656
- observer.F(error);
656
+ observer.H(error);
657
657
  }
658
658
  } finally {
659
659
  if (newSources) {
@@ -668,10 +668,10 @@ function runWithObserver(observer, run) {
668
668
  let source;
669
669
  for (let i = newSourcesIndex; i < observer.b.length; i++) {
670
670
  source = observer.b[i];
671
- if (!source.c)
672
- source.c = [observer];
671
+ if (!source.e)
672
+ source.e = [observer];
673
673
  else
674
- source.c.push(observer);
674
+ source.e.push(observer);
675
675
  }
676
676
  }
677
677
  newSources = prevSources;
@@ -682,10 +682,10 @@ function runWithObserver(observer, run) {
682
682
  function compute(owner, fn, observer) {
683
683
  const prevOwner = setOwner(owner), prevObserver = currentObserver, prevMask = currentMask, prevNotStale = notStale;
684
684
  currentObserver = observer;
685
- currentMask = observer?.O ?? DEFAULT_FLAGS;
685
+ currentMask = observer?.P ?? DEFAULT_FLAGS;
686
686
  notStale = true;
687
687
  try {
688
- return fn(observer ? observer.e : void 0);
688
+ return fn(observer ? observer.g : void 0);
689
689
  } finally {
690
690
  setOwner(prevOwner);
691
691
  currentObserver = prevObserver;
@@ -765,80 +765,80 @@ function createBoundary(fn, queue) {
765
765
 
766
766
  // src/core/effect.ts
767
767
  var Effect = class extends Computation {
768
- K;
769
768
  L;
770
- B;
771
- Q = false;
772
769
  M;
773
- u;
770
+ C;
771
+ R = false;
772
+ N;
773
+ w;
774
774
  constructor(initialValue, compute2, effect, error, options) {
775
775
  super(initialValue, compute2, options);
776
- this.K = effect;
777
- this.L = error;
778
- this.M = initialValue;
779
- this.u = options?.render ? EFFECT_RENDER : EFFECT_USER;
780
- if (this.u === EFFECT_RENDER) {
781
- this.A = (p) => getClock() > this.h.created && !(this.d & ERROR_BIT) ? latest(() => compute2(p)) : compute2(p);
776
+ this.L = effect;
777
+ this.M = error;
778
+ this.N = initialValue;
779
+ this.w = options?.render ? EFFECT_RENDER : EFFECT_USER;
780
+ if (this.w === EFFECT_RENDER) {
781
+ this.B = (p) => getClock() > this.h.created && !(this.f & ERROR_BIT) ? latest(() => compute2(p)) : compute2(p);
782
782
  }
783
- this.y();
784
- !options?.defer && (this.u === EFFECT_USER ? this.h.enqueue(this.u, this) : this.T());
783
+ this.z();
784
+ !options?.defer && (this.w === EFFECT_USER ? this.h.enqueue(this.w, this) : this.U());
785
785
  }
786
786
  write(value, flags = 0) {
787
787
  if (this.a == STATE_DIRTY) {
788
- const currentFlags = this.d;
789
- this.d = flags;
790
- if (this.u === EFFECT_RENDER && (flags & LOADING_BIT) !== (currentFlags & LOADING_BIT)) {
791
- this.h.R?.(this);
788
+ const currentFlags = this.f;
789
+ this.f = flags;
790
+ if (this.w === EFFECT_RENDER && (flags & LOADING_BIT) !== (currentFlags & LOADING_BIT)) {
791
+ this.h.S?.(this);
792
792
  }
793
793
  }
794
794
  if (value === UNCHANGED)
795
- return this.e;
796
- this.e = value;
797
- this.Q = true;
795
+ return this.g;
796
+ this.g = value;
797
+ this.R = true;
798
798
  return value;
799
799
  }
800
800
  q(state, skipQueue) {
801
801
  if (this.a >= state || skipQueue)
802
802
  return;
803
803
  if (this.a === STATE_CLEAN)
804
- this.h.enqueue(this.u, this);
804
+ this.h.enqueue(this.w, this);
805
805
  this.a = state;
806
806
  }
807
- F(error) {
808
- this.B?.();
809
- if (this.d & LOADING_BIT) {
810
- this.h.R?.(this);
807
+ H(error) {
808
+ this.C?.();
809
+ if (this.f & LOADING_BIT) {
810
+ this.h.S?.(this);
811
811
  }
812
- this.d = ERROR_BIT;
813
- if (this.u === EFFECT_USER) {
812
+ this.f = ERROR_BIT;
813
+ if (this.w === EFFECT_USER) {
814
814
  try {
815
- return this.L ? this.B = this.L(error) : console.error(new EffectError(this.K, error));
815
+ return this.M ? this.C = this.M(error) : console.error(new EffectError(this.L, error));
816
816
  } catch (e) {
817
817
  error = e;
818
818
  }
819
819
  }
820
820
  this.handleError(error);
821
821
  }
822
- z() {
822
+ A() {
823
823
  if (this.a === STATE_DISPOSED)
824
824
  return;
825
- this.K = void 0;
826
- this.M = void 0;
827
825
  this.L = void 0;
828
- this.B?.();
829
- this.B = void 0;
830
- super.z();
826
+ this.N = void 0;
827
+ this.M = void 0;
828
+ this.C?.();
829
+ this.C = void 0;
830
+ super.A();
831
831
  }
832
- T() {
833
- if (this.Q && this.a !== STATE_DISPOSED) {
834
- this.B?.();
832
+ U() {
833
+ if (this.R && this.a !== STATE_DISPOSED) {
834
+ this.C?.();
835
835
  try {
836
- this.B = this.K(this.e, this.M);
836
+ this.C = this.L(this.g, this.N);
837
837
  } catch (e) {
838
838
  this.handleError(e);
839
839
  } finally {
840
- this.M = this.e;
841
- this.Q = false;
840
+ this.N = this.g;
841
+ this.R = false;
842
842
  }
843
843
  }
844
844
  }
@@ -846,10 +846,10 @@ var Effect = class extends Computation {
846
846
  var EagerComputation = class extends Computation {
847
847
  constructor(initialValue, compute2, options) {
848
848
  super(initialValue, compute2, options);
849
- !options?.defer && this.y();
849
+ !options?.defer && this.z();
850
850
  }
851
851
  q(state, skipQueue) {
852
- if (this.a >= state && !this.J)
852
+ if (this.a >= state && !this.K)
853
853
  return;
854
854
  if (this.a === STATE_CLEAN && !skipQueue)
855
855
  this.h.enqueue(EFFECT_PURE, this);
@@ -861,7 +861,7 @@ var ProjectionComputation = class extends Computation {
861
861
  super(null, compute2);
862
862
  }
863
863
  q(state, skipQueue) {
864
- if (this.a >= state && !this.J)
864
+ if (this.a >= state && !this.K)
865
865
  return;
866
866
  if (this.a === STATE_CLEAN && !skipQueue)
867
867
  this.h.enqueue(EFFECT_PURE, this);
@@ -871,39 +871,39 @@ var ProjectionComputation = class extends Computation {
871
871
 
872
872
  // src/core/suspense.ts
873
873
  var SuspenseQueue = class extends Queue {
874
- f = /* @__PURE__ */ new Set();
874
+ c = /* @__PURE__ */ new Set();
875
875
  o = false;
876
- S = new Computation(false, null);
876
+ T = new Computation(false, null);
877
877
  run(type) {
878
878
  if (type && this.o)
879
879
  return;
880
880
  return super.run(type);
881
881
  }
882
- R(node) {
883
- if (node.d & LOADING_BIT) {
884
- this.f.add(node);
882
+ S(node) {
883
+ if (node.f & LOADING_BIT) {
884
+ this.c.add(node);
885
885
  if (!this.o) {
886
886
  this.o = true;
887
- this.S.write(true);
887
+ this.T.write(true);
888
888
  }
889
889
  } else {
890
- this.f.delete(node);
891
- if (this.f.size === 0) {
890
+ this.c.delete(node);
891
+ if (this.c.size === 0) {
892
892
  this.o = false;
893
- this.S.write(false);
893
+ this.T.write(false);
894
894
  }
895
895
  }
896
896
  }
897
897
  };
898
898
  var LiveComputation = class extends EagerComputation {
899
899
  write(value, flags = 0) {
900
- const currentFlags = this.d;
900
+ const currentFlags = this.f;
901
901
  const dirty = this.a === STATE_DIRTY;
902
902
  super.write(value, flags);
903
903
  if (dirty && (flags & LOADING_BIT) !== (currentFlags & LOADING_BIT)) {
904
- this.h.R?.(this);
904
+ this.h.S?.(this);
905
905
  }
906
- return this.e;
906
+ return this.g;
907
907
  }
908
908
  };
909
909
  function createSuspense(fn, fallback) {
@@ -912,7 +912,7 @@ function createSuspense(fn, fallback) {
912
912
  const child = new Computation(null, fn);
913
913
  return new LiveComputation(null, () => flatten(child.wait()));
914
914
  }, queue);
915
- const equality = new Computation(null, () => queue.S.read() || queue.o);
915
+ const equality = new Computation(null, () => queue.T.read() || queue.o);
916
916
  const comp = new Computation(null, () => equality.read() ? fallback() : tree.read());
917
917
  return comp.read.bind(comp);
918
918
  }
@@ -943,10 +943,10 @@ function createMemo(compute2, value, options) {
943
943
  return () => {
944
944
  if (node) {
945
945
  resolvedValue = node.wait();
946
- if (!node.b?.length && node.n?.s !== node) {
946
+ if (!node.b?.length && node.n?.t !== node) {
947
947
  node.dispose();
948
948
  node = void 0;
949
- } else if (!node.s && !node.c?.length) {
949
+ } else if (!node.t && !node.e?.length) {
950
950
  node.dispose();
951
951
  node.a = STATE_DIRTY;
952
952
  }
@@ -958,10 +958,10 @@ function createAsync(compute2, value, options) {
958
958
  let uninitialized = value === void 0;
959
959
  const lhs = new EagerComputation(
960
960
  {
961
- e: value
961
+ g: value
962
962
  },
963
963
  (p) => {
964
- const value2 = p?.e;
964
+ const value2 = p?.g;
965
965
  const source = compute2(value2);
966
966
  const isPromise = source instanceof Promise;
967
967
  const iterator = source[Symbol.asyncIterator];
@@ -970,13 +970,13 @@ function createAsync(compute2, value, options) {
970
970
  wait() {
971
971
  return source;
972
972
  },
973
- e: source
973
+ g: source
974
974
  };
975
975
  }
976
- const signal = new Computation(value2, null, options);
976
+ const signal = new Computation(value2, null, iterator ? { ...options, equals: false } : options);
977
977
  const w = signal.wait;
978
978
  signal.wait = function() {
979
- if (signal.d & ERROR_BIT && signal.x <= getClock()) {
979
+ if (signal.f & ERROR_BIT && signal.y <= getClock()) {
980
980
  lhs.q(STATE_DIRTY);
981
981
  throw new NotReadyError();
982
982
  }
@@ -991,7 +991,7 @@ function createAsync(compute2, value, options) {
991
991
  },
992
992
  (error) => {
993
993
  uninitialized = true;
994
- signal.F(error);
994
+ signal.H(error);
995
995
  }
996
996
  );
997
997
  } else {
@@ -1054,7 +1054,7 @@ function createErrorBoundary(fn, fallback) {
1054
1054
  );
1055
1055
  nodes.add(node);
1056
1056
  if (nodes.size === 1)
1057
- error.write({ E: err });
1057
+ error.write({ G: err });
1058
1058
  }
1059
1059
  owner.m = owner.m ? [handler, ...owner.m] : [handler];
1060
1060
  const guarded = compute(
@@ -1062,7 +1062,7 @@ function createErrorBoundary(fn, fallback) {
1062
1062
  () => {
1063
1063
  const c = new Computation(void 0, fn);
1064
1064
  const f = new EagerComputation(void 0, () => flatten(c.read()), { defer: true });
1065
- f.F = function(error2) {
1065
+ f.H = function(error2) {
1066
1066
  this.handleError(error2);
1067
1067
  };
1068
1068
  return f;
@@ -1075,11 +1075,11 @@ function createErrorBoundary(fn, fallback) {
1075
1075
  if (!error.read())
1076
1076
  return resolved;
1077
1077
  }
1078
- return fallback(error.read().E, () => {
1078
+ return fallback(error.read().G, () => {
1079
1079
  incrementClock();
1080
1080
  for (let node of nodes) {
1081
1081
  node.a = STATE_DIRTY;
1082
- node.h?.enqueue(node.u, node);
1082
+ node.h?.enqueue(node.w, node);
1083
1083
  }
1084
1084
  });
1085
1085
  });
@@ -1104,12 +1104,15 @@ function resolve(fn) {
1104
1104
 
1105
1105
  // src/store/projection.ts
1106
1106
  function createProjection(fn, initialValue = {}) {
1107
- const [store, setStore] = createStore(initialValue);
1107
+ const [store] = createStore(fn, initialValue);
1108
+ return store;
1109
+ }
1110
+ function wrapProjection(fn, store, setStore) {
1108
1111
  const node = new ProjectionComputation(() => {
1109
1112
  setStore(fn);
1110
1113
  });
1111
1114
  const wrapped = /* @__PURE__ */ new WeakMap();
1112
- return wrap(store, node, wrapped);
1115
+ return [wrap(store, node, wrapped), setStore];
1113
1116
  }
1114
1117
  function wrap(source, node, wrapped) {
1115
1118
  if (wrapped.has(source))
@@ -1134,8 +1137,10 @@ function wrap(source, node, wrapped) {
1134
1137
  // src/store/store.ts
1135
1138
  var $RAW = Symbol(0);
1136
1139
  var $TRACK = Symbol(0);
1140
+ var $DEEP = Symbol(0);
1137
1141
  var $TARGET = Symbol(0);
1138
1142
  var $PROXY = Symbol(0);
1143
+ var PARENTS = /* @__PURE__ */ new WeakMap();
1139
1144
  var STORE_VALUE = "v";
1140
1145
  var STORE_NODE = "n";
1141
1146
  var STORE_HAS = "h";
@@ -1158,11 +1163,11 @@ function wrap2(value) {
1158
1163
  function isWrappable(obj) {
1159
1164
  return obj != null && typeof obj === "object" && !Object.isFrozen(obj);
1160
1165
  }
1161
- function unwrap(item, deep = true, set) {
1166
+ function unwrap(item, deep2 = true, set) {
1162
1167
  let result, unwrapped, v, prop;
1163
1168
  if (result = item != null && item[$RAW])
1164
1169
  return result;
1165
- if (!deep)
1170
+ if (!deep2)
1166
1171
  return item;
1167
1172
  if (!isWrappable(item) || set?.has(item))
1168
1173
  return item;
@@ -1172,11 +1177,11 @@ function unwrap(item, deep = true, set) {
1172
1177
  if (Array.isArray(item)) {
1173
1178
  for (let i = 0, l = item.length; i < l; i++) {
1174
1179
  v = item[i];
1175
- if ((unwrapped = unwrap(v, deep, set)) !== v)
1180
+ if ((unwrapped = unwrap(v, deep2, set)) !== v)
1176
1181
  item[i] = unwrapped;
1177
1182
  }
1178
1183
  } else {
1179
- if (!deep)
1184
+ if (!deep2)
1180
1185
  return item;
1181
1186
  const keys = Object.keys(item);
1182
1187
  for (let i = 0, l = keys.length; i < l; i++) {
@@ -1185,7 +1190,7 @@ function unwrap(item, deep = true, set) {
1185
1190
  if (desc.get)
1186
1191
  continue;
1187
1192
  v = item[prop];
1188
- if ((unwrapped = unwrap(v, deep, set)) !== v)
1193
+ if ((unwrapped = unwrap(v, deep2, set)) !== v)
1189
1194
  item[prop] = unwrapped;
1190
1195
  }
1191
1196
  }
@@ -1218,8 +1223,8 @@ function proxyDescriptor(target, property) {
1218
1223
  desc.get = () => target[STORE_VALUE][$PROXY][property];
1219
1224
  return desc;
1220
1225
  }
1221
- function trackSelf(target) {
1222
- getObserver() && getNode(getNodes(target, STORE_NODE), $TRACK, void 0, false).read();
1226
+ function trackSelf(target, symbol = $TRACK) {
1227
+ getObserver() && getNode(getNodes(target, STORE_NODE), symbol, void 0, false).read();
1223
1228
  }
1224
1229
  function ownKeys(target) {
1225
1230
  trackSelf(target);
@@ -1234,8 +1239,8 @@ var proxyTraps = {
1234
1239
  return target[STORE_VALUE];
1235
1240
  if (property === $PROXY)
1236
1241
  return receiver;
1237
- if (property === $TRACK) {
1238
- trackSelf(target);
1242
+ if (property === $TRACK || property === $DEEP) {
1243
+ trackSelf(target, property);
1239
1244
  return receiver;
1240
1245
  }
1241
1246
  const nodes = getNodes(target, STORE_NODE);
@@ -1247,7 +1252,7 @@ var proxyTraps = {
1247
1252
  return desc.get.call(receiver);
1248
1253
  }
1249
1254
  if (Writing.has(storeValue)) {
1250
- const value2 = tracked ? tracked.e : storeValue[property];
1255
+ const value2 = tracked ? tracked.g : storeValue[property];
1251
1256
  return isWrappable(value2) ? (Writing.add(value2[$RAW] || value2), wrap2(value2)) : value2;
1252
1257
  }
1253
1258
  let value = tracked ? nodes[property].read() : storeValue[property];
@@ -1256,7 +1261,7 @@ var proxyTraps = {
1256
1261
  let proto;
1257
1262
  return !Array.isArray(storeValue) && (proto = Object.getPrototypeOf(storeValue)) && proto !== Object.prototype ? value.bind(storeValue) : value;
1258
1263
  } else if (getObserver()) {
1259
- value = getNode(nodes, property, isWrappable(value) ? wrap2(value) : value).read();
1264
+ return getNode(nodes, property, isWrappable(value) ? wrap2(value) : value).read();
1260
1265
  }
1261
1266
  }
1262
1267
  return isWrappable(value) ? wrap2(value) : value;
@@ -1291,6 +1296,13 @@ function setProperty(state, property, value, deleting = false) {
1291
1296
  delete state[property];
1292
1297
  else
1293
1298
  state[property] = value;
1299
+ const wrappable = isWrappable(value);
1300
+ if (isWrappable(prev)) {
1301
+ const parents = PARENTS.get(prev);
1302
+ parents && (parents instanceof Set ? parents.delete(state) : PARENTS.delete(prev));
1303
+ }
1304
+ if (recursivelyNotify(state) && wrappable)
1305
+ recursivelyAddParent(value[$RAW] || value, state);
1294
1306
  const target = state[$PROXY]?.[$TARGET];
1295
1307
  if (!target)
1296
1308
  return;
@@ -1299,18 +1311,55 @@ function setProperty(state, property, value, deleting = false) {
1299
1311
  else
1300
1312
  target[STORE_HAS]?.[property]?.write(true);
1301
1313
  const nodes = getNodes(target, STORE_NODE);
1302
- let node;
1303
- if (node = nodes[property])
1304
- node.write(isWrappable(value) ? wrap2(value) : value);
1305
- Array.isArray(state) && state.length !== len && (node = nodes.length) && node.write(state.length);
1306
- (node = nodes[$TRACK]) && node.write(void 0);
1314
+ nodes[property]?.write(wrappable ? wrap2(value) : value);
1315
+ Array.isArray(state) && state.length !== len && nodes.length?.write(state.length);
1316
+ nodes[$TRACK]?.write(void 0);
1317
+ }
1318
+ function recursivelyNotify(state) {
1319
+ let target = state[$PROXY]?.[$TARGET];
1320
+ let notified = false;
1321
+ target && (getNodes(target, STORE_NODE)[$DEEP]?.write(void 0), notified = true);
1322
+ const parents = PARENTS.get(state);
1323
+ if (!parents)
1324
+ return notified;
1325
+ if (parents instanceof Set) {
1326
+ for (let parent of parents)
1327
+ notified = recursivelyNotify(parent) || notified;
1328
+ } else
1329
+ notified = recursivelyNotify(parents) || notified;
1330
+ return notified;
1331
+ }
1332
+ function recursivelyAddParent(state, parent) {
1333
+ if (parent) {
1334
+ let parents = PARENTS.get(state);
1335
+ if (!parents)
1336
+ PARENTS.set(state, parent);
1337
+ else if (parents !== parent) {
1338
+ if (!(parents instanceof Set))
1339
+ PARENTS.set(state, parents = /* @__PURE__ */ new Set([parents]));
1340
+ else if (parents.has(parent))
1341
+ return;
1342
+ parents.add(parent);
1343
+ } else
1344
+ return;
1345
+ }
1346
+ if (Array.isArray(state)) {
1347
+ for (let i = 0; i < state.length; i++) {
1348
+ const item = state[i];
1349
+ isWrappable(item) && recursivelyAddParent(item[$RAW] || item, state);
1350
+ }
1351
+ } else {
1352
+ const keys = Object.keys(state);
1353
+ for (let i = 0; i < keys.length; i++) {
1354
+ const item = state[keys[i]];
1355
+ isWrappable(item) && recursivelyAddParent(item[$RAW] || item, state);
1356
+ }
1357
+ }
1307
1358
  }
1308
1359
  function createStore(first, second) {
1309
1360
  const derived = typeof first === "function", store = derived ? second : first;
1310
- if (derived)
1311
- return createProjection(first, store);
1312
- const unwrappedStore = unwrap(store, false);
1313
- const wrappedStore = wrap2(unwrappedStore);
1361
+ const unwrappedStore = unwrap(store);
1362
+ let wrappedStore = wrap2(unwrappedStore);
1314
1363
  const setStore = (fn) => {
1315
1364
  try {
1316
1365
  Writing.add(unwrappedStore);
@@ -1319,8 +1368,14 @@ function createStore(first, second) {
1319
1368
  Writing.clear();
1320
1369
  }
1321
1370
  };
1371
+ if (derived)
1372
+ return wrapProjection(first, wrappedStore, setStore);
1322
1373
  return [wrappedStore, setStore];
1323
1374
  }
1375
+ function deep(store) {
1376
+ recursivelyAddParent(store[$RAW] || store);
1377
+ return store[$DEEP];
1378
+ }
1324
1379
 
1325
1380
  // src/store/reconcile.ts
1326
1381
  function applyState(next, state, keyFn) {
@@ -1586,73 +1641,73 @@ function omit(props, ...keys) {
1586
1641
  function mapArray(list, map, options) {
1587
1642
  const keyFn = typeof options?.keyed === "function" ? options.keyed : void 0;
1588
1643
  return updateKeyedMap.bind({
1589
- G: new Owner(),
1644
+ I: new Owner(),
1590
1645
  i: 0,
1591
- X: list,
1592
- w: [],
1593
- H: map,
1594
- g: [],
1595
- f: [],
1596
- C: keyFn,
1646
+ Y: list,
1647
+ x: [],
1648
+ D: map,
1649
+ d: [],
1650
+ c: [],
1651
+ E: keyFn,
1597
1652
  j: keyFn || options?.keyed === false ? [] : void 0,
1598
1653
  k: map.length > 1 ? [] : void 0,
1599
1654
  o: options?.fallback
1600
1655
  });
1601
1656
  }
1602
1657
  function updateKeyedMap() {
1603
- const newItems = this.X() || [], newLen = newItems.length;
1658
+ const newItems = this.Y() || [], newLen = newItems.length;
1604
1659
  newItems[$TRACK];
1605
- runWithOwner(this.G, () => {
1660
+ runWithOwner(this.I, () => {
1606
1661
  let i, j, mapper = this.j ? () => {
1607
1662
  this.j[j] = new Computation(newItems[j], null);
1608
1663
  this.k && (this.k[j] = new Computation(j, null));
1609
- return this.H(
1664
+ return this.D(
1610
1665
  Computation.prototype.read.bind(this.j[j]),
1611
1666
  this.k ? Computation.prototype.read.bind(this.k[j]) : void 0
1612
1667
  );
1613
1668
  } : this.k ? () => {
1614
1669
  const item = newItems[j];
1615
1670
  this.k[j] = new Computation(j, null);
1616
- return this.H(() => item, Computation.prototype.read.bind(this.k[j]));
1671
+ return this.D(() => item, Computation.prototype.read.bind(this.k[j]));
1617
1672
  } : () => {
1618
1673
  const item = newItems[j];
1619
- return this.H(() => item);
1674
+ return this.D(() => item);
1620
1675
  };
1621
1676
  if (newLen === 0) {
1622
1677
  if (this.i !== 0) {
1623
- this.G.dispose(false);
1624
- this.f = [];
1625
- this.w = [];
1626
- this.g = [];
1678
+ this.I.dispose(false);
1679
+ this.c = [];
1680
+ this.x = [];
1681
+ this.d = [];
1627
1682
  this.i = 0;
1628
1683
  this.j && (this.j = []);
1629
1684
  this.k && (this.k = []);
1630
1685
  }
1631
- if (this.o && !this.g[0]) {
1632
- this.g[0] = compute(
1633
- this.f[0] = new Owner(),
1686
+ if (this.o && !this.d[0]) {
1687
+ this.d[0] = compute(
1688
+ this.c[0] = new Owner(),
1634
1689
  this.o,
1635
1690
  null
1636
1691
  );
1637
1692
  }
1638
1693
  } else if (this.i === 0) {
1639
- if (this.f[0])
1640
- this.f[0].dispose();
1641
- this.g = new Array(newLen);
1694
+ if (this.c[0])
1695
+ this.c[0].dispose();
1696
+ this.d = new Array(newLen);
1642
1697
  for (j = 0; j < newLen; j++) {
1643
- this.w[j] = newItems[j];
1644
- this.g[j] = compute(this.f[j] = new Owner(), mapper, null);
1698
+ this.x[j] = newItems[j];
1699
+ this.d[j] = compute(this.c[j] = new Owner(), mapper, null);
1645
1700
  }
1646
1701
  this.i = newLen;
1647
1702
  } else {
1648
1703
  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;
1649
- for (start = 0, end = Math.min(this.i, newLen); start < end && (this.w[start] === newItems[start] || this.j && compare(this.C, this.w[start], newItems[start])); start++) {
1704
+ for (start = 0, end = Math.min(this.i, newLen); start < end && (this.x[start] === newItems[start] || this.j && compare(this.E, this.x[start], newItems[start])); start++) {
1650
1705
  if (this.j)
1651
1706
  this.j[start].write(newItems[start]);
1652
1707
  }
1653
- for (end = this.i - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.w[end] === newItems[newEnd] || this.j && compare(this.C, this.w[end], newItems[newEnd])); end--, newEnd--) {
1654
- temp[newEnd] = this.g[end];
1655
- tempNodes[newEnd] = this.f[end];
1708
+ for (end = this.i - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.x[end] === newItems[newEnd] || this.j && compare(this.E, this.x[end], newItems[newEnd])); end--, newEnd--) {
1709
+ temp[newEnd] = this.d[end];
1710
+ tempNodes[newEnd] = this.c[end];
1656
1711
  tempRows && (tempRows[newEnd] = this.j[end]);
1657
1712
  tempIndexes && (tempIndexes[newEnd] = this.k[end]);
1658
1713
  }
@@ -1660,29 +1715,29 @@ function updateKeyedMap() {
1660
1715
  newIndicesNext = new Array(newEnd + 1);
1661
1716
  for (j = newEnd; j >= start; j--) {
1662
1717
  item = newItems[j];
1663
- key = this.C ? this.C(item) : item;
1718
+ key = this.E ? this.E(item) : item;
1664
1719
  i = newIndices.get(key);
1665
1720
  newIndicesNext[j] = i === void 0 ? -1 : i;
1666
1721
  newIndices.set(key, j);
1667
1722
  }
1668
1723
  for (i = start; i <= end; i++) {
1669
- item = this.w[i];
1670
- key = this.C ? this.C(item) : item;
1724
+ item = this.x[i];
1725
+ key = this.E ? this.E(item) : item;
1671
1726
  j = newIndices.get(key);
1672
1727
  if (j !== void 0 && j !== -1) {
1673
- temp[j] = this.g[i];
1674
- tempNodes[j] = this.f[i];
1728
+ temp[j] = this.d[i];
1729
+ tempNodes[j] = this.c[i];
1675
1730
  tempRows && (tempRows[j] = this.j[i]);
1676
1731
  tempIndexes && (tempIndexes[j] = this.k[i]);
1677
1732
  j = newIndicesNext[j];
1678
1733
  newIndices.set(key, j);
1679
1734
  } else
1680
- this.f[i].dispose();
1735
+ this.c[i].dispose();
1681
1736
  }
1682
1737
  for (j = start; j < newLen; j++) {
1683
1738
  if (j in temp) {
1684
- this.g[j] = temp[j];
1685
- this.f[j] = tempNodes[j];
1739
+ this.d[j] = temp[j];
1740
+ this.c[j] = tempNodes[j];
1686
1741
  if (tempRows) {
1687
1742
  this.j[j] = tempRows[j];
1688
1743
  this.j[j].write(newItems[j]);
@@ -1692,63 +1747,92 @@ function updateKeyedMap() {
1692
1747
  this.k[j].write(j);
1693
1748
  }
1694
1749
  } else {
1695
- this.g[j] = compute(this.f[j] = new Owner(), mapper, null);
1750
+ this.d[j] = compute(this.c[j] = new Owner(), mapper, null);
1696
1751
  }
1697
1752
  }
1698
- this.g = this.g.slice(0, this.i = newLen);
1699
- this.w = newItems.slice(0);
1753
+ this.d = this.d.slice(0, this.i = newLen);
1754
+ this.x = newItems.slice(0);
1700
1755
  }
1701
1756
  });
1702
- return this.g;
1757
+ return this.d;
1703
1758
  }
1704
1759
  function repeat(count, map, options) {
1705
1760
  return updateRepeat.bind({
1706
- G: new Owner(),
1761
+ I: new Owner(),
1707
1762
  i: 0,
1708
- Y: count,
1709
- H: map,
1710
- f: [],
1711
- g: [],
1763
+ r: 0,
1764
+ Z: count,
1765
+ D: map,
1766
+ c: [],
1767
+ d: [],
1768
+ _: options?.from,
1712
1769
  o: options?.fallback
1713
1770
  });
1714
1771
  }
1715
1772
  function updateRepeat() {
1716
- const newLen = this.Y();
1717
- runWithOwner(this.G, () => {
1773
+ const newLen = this.Z();
1774
+ const from = this._?.() || 0;
1775
+ runWithOwner(this.I, () => {
1718
1776
  if (newLen === 0) {
1719
1777
  if (this.i !== 0) {
1720
- this.G.dispose(false);
1721
- this.f = [];
1722
- this.g = [];
1778
+ this.I.dispose(false);
1779
+ this.c = [];
1780
+ this.d = [];
1723
1781
  this.i = 0;
1724
1782
  }
1725
- if (this.o && !this.g[0]) {
1726
- this.g[0] = compute(
1727
- this.f[0] = new Owner(),
1783
+ if (this.o && !this.d[0]) {
1784
+ this.d[0] = compute(
1785
+ this.c[0] = new Owner(),
1728
1786
  this.o,
1729
1787
  null
1730
1788
  );
1731
1789
  }
1732
- } else {
1733
- if (this.i === 0 && this.f[0])
1734
- this.f[0].dispose();
1735
- for (let i = this.i; i < newLen; i++) {
1736
- this.g[i] = compute(
1737
- this.f[i] = new Owner(),
1738
- () => this.H(i),
1790
+ return;
1791
+ }
1792
+ const to = from + newLen;
1793
+ const prevTo = this.r + this.i;
1794
+ if (this.i === 0 && this.c[0])
1795
+ this.c[0].dispose();
1796
+ for (let i = to; i < prevTo; i++)
1797
+ this.c[i - this.r].dispose();
1798
+ if (this.r < from) {
1799
+ let i = this.r;
1800
+ while (i < from && i < this.i)
1801
+ this.c[i++].dispose();
1802
+ this.c.splice(0, from - this.r);
1803
+ this.d.splice(0, from - this.r);
1804
+ } else if (this.r > from) {
1805
+ let i = prevTo - this.r - 1;
1806
+ let difference = this.r - from;
1807
+ this.c.length = this.d.length = newLen;
1808
+ while (i >= difference) {
1809
+ this.c[i] = this.c[i - difference];
1810
+ this.d[i] = this.d[i - difference];
1811
+ i--;
1812
+ }
1813
+ for (let i2 = 0; i2 < difference; i2++) {
1814
+ this.d[i2] = compute(
1815
+ this.c[i2] = new Owner(),
1816
+ () => this.D(i2 + from),
1739
1817
  null
1740
1818
  );
1741
1819
  }
1742
- for (let i = newLen; i < this.i; i++)
1743
- this.f[i].dispose();
1744
- this.g = this.g.slice(0, newLen);
1745
- this.i = newLen;
1746
1820
  }
1821
+ for (let i = prevTo; i < to; i++) {
1822
+ this.d[i - from] = compute(
1823
+ this.c[i - from] = new Owner(),
1824
+ () => this.D(i),
1825
+ null
1826
+ );
1827
+ }
1828
+ this.d = this.d.slice(0, newLen);
1829
+ this.r = from;
1830
+ this.i = newLen;
1747
1831
  });
1748
- return this.g;
1832
+ return this.d;
1749
1833
  }
1750
1834
  function compare(key, a, b) {
1751
1835
  return key ? key(a) === key(b) : true;
1752
1836
  }
1753
1837
 
1754
- export { $PROXY, $RAW, $TARGET, $TRACK, Computation, ContextNotFoundError, NoOwnerError, NotReadyError, Owner, Queue, SUPPORTS_PROXY, catchError, createAsync, createBoundary, createContext, createEffect, createErrorBoundary, createMemo, createProjection, createRenderEffect, createRoot, createSignal, createStore, createSuspense, flatten, flushSync, getContext, getObserver, getOwner, hasContext, hasUpdated, isEqual, isPending, isWrappable, latest, mapArray, merge, omit, onCleanup, reconcile, repeat, resolve, runWithObserver, runWithOwner, setContext, untrack, unwrap };
1838
+ export { $PROXY, $RAW, $TARGET, $TRACK, Computation, ContextNotFoundError, NoOwnerError, NotReadyError, Owner, Queue, SUPPORTS_PROXY, catchError, createAsync, createBoundary, createContext, createEffect, createErrorBoundary, createMemo, createProjection, createRenderEffect, createRoot, createSignal, createStore, createSuspense, deep, flatten, flushSync, getContext, getObserver, getOwner, hasContext, hasUpdated, isEqual, isPending, isWrappable, latest, mapArray, merge, omit, onCleanup, reconcile, repeat, resolve, runWithObserver, runWithOwner, setContext, untrack, unwrap };