@tempots/dom 33.0.0 → 33.1.0

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/index.js CHANGED
@@ -4,7 +4,7 @@ const _ = [], We = (t) => {
4
4
  if (_.length === 0)
5
5
  throw new Error("Cannot pop from empty scope stack");
6
6
  _.pop();
7
- }, ye = () => _[_.length - 1] ?? null, Zt = () => _, zt = () => _[_.length - 2] ?? null, L = (t, e) => {
7
+ }, ue = () => _[_.length - 1] ?? null, Zt = () => _, zt = () => _[_.length - 2] ?? null, x = (t, e) => {
8
8
  We(t);
9
9
  try {
10
10
  return e();
@@ -14,11 +14,11 @@ const _ = [], We = (t) => {
14
14
  }, Kt = (t) => {
15
15
  const e = new j();
16
16
  try {
17
- return L(e, () => t(e));
17
+ return x(e, () => t(e));
18
18
  } finally {
19
19
  e.dispose();
20
20
  }
21
- }, oe = (t) => {
21
+ }, ie = (t) => {
22
22
  const e = _.slice();
23
23
  _.length = 0;
24
24
  try {
@@ -79,14 +79,14 @@ class g {
79
79
  * @param equals - Function to compare two values for equality (defaults to strict equality)
80
80
  * @returns A Signal that represents the result of the Promise
81
81
  */
82
- static ofPromise = (e, s, n, r = (i, o) => i === o) => {
83
- const i = new g(s, r);
84
- return e.then((o) => i._setAndNotify(o)).catch((o) => {
85
- n != null ? i._setAndNotify(n(o)) : console.error(
82
+ static ofPromise = (e, s, n, r = (o, i) => o === i) => {
83
+ const o = new g(s, r);
84
+ return e.then((i) => o._setAndNotify(i)).catch((i) => {
85
+ n != null ? o._setAndNotify(n(i)) : console.error(
86
86
  "Unhandled promise rejection in Signal.ofPromise:",
87
- o
87
+ i
88
88
  );
89
- }), i;
89
+ }), o;
90
90
  };
91
91
  /**
92
92
  * Checks if a value is a Signal.
@@ -140,13 +140,33 @@ class g {
140
140
  * The listener function will be immediately called with the current value of the signal.
141
141
  * Returns a function that can be called to unregister the listener.
142
142
  *
143
+ * When called within a DisposalScope (e.g., inside a renderable), the listener is
144
+ * automatically cleaned up when the scope is disposed. This prevents memory leaks
145
+ * when listening to outer-scope signals from inner scopes.
146
+ *
143
147
  * @param listener - The listener function to be called when the value of the signal changes.
144
148
  * @param options - Options for the listener.
149
+ *
150
+ * @example
151
+ * ```typescript
152
+ * // Automatic cleanup when scope disposes
153
+ * const MyComponent = () => {
154
+ * const outerSignal = prop(0)
155
+ *
156
+ * return html.div(
157
+ * When(someCondition, () => {
158
+ * // This listener is automatically cleaned up when the When() disposes
159
+ * outerSignal.on(value => console.log(value))
160
+ * return html.span('Inner content')
161
+ * })
162
+ * )
163
+ * }
164
+ * ```
145
165
  */
146
166
  on = (e, s = {}) => {
147
167
  s.skipInitial || e(this.get(), void 0);
148
- const n = s.once ? (i, o) => {
149
- r(), e(i, o);
168
+ const n = s.once ? (o, i) => {
169
+ r(), e(o, i);
150
170
  } : e;
151
171
  this._onValueListeners.push(n);
152
172
  const r = () => {
@@ -155,7 +175,11 @@ class g {
155
175
  1
156
176
  ), s.abortSignal != null && s.abortSignal.removeEventListener("abort", r);
157
177
  };
158
- return s.abortSignal != null && s.abortSignal.addEventListener("abort", r), r;
178
+ if (s.abortSignal != null && s.abortSignal.addEventListener("abort", r), !s.noAutoDispose) {
179
+ const o = ue();
180
+ o?.onDispose(r);
181
+ }
182
+ return r;
159
183
  };
160
184
  /**
161
185
  * Registers a listener function to be called whenever the value of the signal changes.
@@ -167,8 +191,8 @@ class g {
167
191
  */
168
192
  onChange = (e, s = {}) => {
169
193
  let n = 0;
170
- const r = (i, o) => {
171
- n++ > 0 && e(i, o);
194
+ const r = (o, i) => {
195
+ n++ > 0 && e(o, i);
172
196
  };
173
197
  return this.on(r, s);
174
198
  };
@@ -199,9 +223,10 @@ class g {
199
223
  };
200
224
  /**
201
225
  * Disposes the signal, releasing any resources associated with it.
226
+ * This clears all listeners, derivatives, and disposal callbacks.
202
227
  */
203
228
  dispose = () => {
204
- this._disposed || (this._disposed = !0, this._onDisposeListeners.forEach((e) => e()), this._onDisposeListeners.length = 0, this._derivatives.length = 0);
229
+ this._disposed || (this._disposed = !0, this._onDisposeListeners.forEach((e) => e()), this._onDisposeListeners.length = 0, this._derivatives.length = 0, this._onValueListeners.length = 0);
205
230
  };
206
231
  /**
207
232
  * Creates a new computed signal by applying a transformation function to this signal's value.
@@ -326,10 +351,10 @@ class g {
326
351
  let n = s ?? this.get();
327
352
  const r = new N(() => {
328
353
  try {
329
- const i = this.get();
330
- return n = e(i) ? i : n;
331
- } catch (i) {
332
- throw console.error("Error in Signal.filter:", i), i;
354
+ const o = this.get();
355
+ return n = e(o) ? o : n;
356
+ } catch (o) {
357
+ throw console.error("Error in Signal.filter:", o), o;
333
358
  }
334
359
  }, this.equals);
335
360
  return this.setDerivative(r), r;
@@ -344,17 +369,17 @@ class g {
344
369
  * @param equals - Optional equality function to determine if two values are equal.
345
370
  * @returns - A new Computed object with the mapped and filtered values.
346
371
  */
347
- filterMap = (e, s, n = (r, i) => r === i) => {
372
+ filterMap = (e, s, n = (r, o) => r === o) => {
348
373
  let r = s;
349
- const i = new N(() => {
374
+ const o = new N(() => {
350
375
  try {
351
- const o = this.get(), l = e(o);
376
+ const i = this.get(), l = e(i);
352
377
  return r = l ?? r;
353
- } catch (o) {
354
- throw console.error("Error in Signal.filterMap:", o), o;
378
+ } catch (i) {
379
+ throw console.error("Error in Signal.filterMap:", i), i;
355
380
  }
356
381
  }, n);
357
- return this.setDerivative(i), i;
382
+ return this.setDerivative(o), o;
358
383
  };
359
384
  /**
360
385
  * Maps the values emitted by the signal to a new value asynchronously using the provided function.
@@ -369,25 +394,25 @@ class g {
369
394
  * @param equals - The equality function to compare the mapped values for equality.
370
395
  * @returns A property that holds the mapped value and can be observed for changes.
371
396
  */
372
- mapAsync = (e, s, n, r = (i, o) => i === o) => {
373
- const i = T(s, r);
374
- let o = 0, l = new AbortController();
375
- return i.onDispose(
397
+ mapAsync = (e, s, n, r = (o, i) => o === i) => {
398
+ const o = T(s, r);
399
+ let i = 0, l = new AbortController();
400
+ return o.onDispose(
376
401
  this.on(async (c) => {
377
- const a = ++o;
402
+ const a = ++i;
378
403
  l.abort(), l = new AbortController();
379
404
  try {
380
405
  const u = await e(c, { abortSignal: l.signal });
381
- a === o && i.set(u);
406
+ a === i && o.set(u);
382
407
  } catch (u) {
383
- if (a === o)
408
+ if (a === i)
384
409
  if (n != null)
385
- i.set(n(u));
410
+ o.set(n(u));
386
411
  else
387
412
  throw u;
388
413
  }
389
414
  })
390
- ), i;
415
+ ), o;
391
416
  };
392
417
  /**
393
418
  * Maps the values of the signal using the provided function `fn`, and returns a new signal
@@ -446,7 +471,7 @@ class g {
446
471
  this._derivatives.indexOf(e),
447
472
  1
448
473
  );
449
- }), e.onDispose(this.on(e.setDirty)), this.onDispose(e.dispose);
474
+ }), e.onDispose(this.on(e.setDirty, { noAutoDispose: !0 })), this.onDispose(e.dispose);
450
475
  };
451
476
  }
452
477
  const Ge = typeof queueMicrotask == "function" ? queueMicrotask : (t) => Promise.resolve().then(t);
@@ -477,7 +502,7 @@ class N extends g {
477
502
  */
478
503
  constructor(e, s) {
479
504
  super(void 0, s), this._fn = e, this.setDirty();
480
- const n = ye();
505
+ const n = ue();
481
506
  n?.track(this);
482
507
  }
483
508
  /**
@@ -572,13 +597,13 @@ class Z extends g {
572
597
  */
573
598
  reducer = (e, ...s) => {
574
599
  const n = this;
575
- return function r(i) {
576
- const o = n.value;
577
- n.update((l) => e(l, i)), !n.equals(o, n.value) && s.forEach(
600
+ return function r(o) {
601
+ const i = n.value;
602
+ n.update((l) => e(l, o)), !n.equals(i, n.value) && s.forEach(
578
603
  (l) => l({
579
- previousState: o,
604
+ previousState: i,
580
605
  state: n.value,
581
- action: i,
606
+ action: o,
582
607
  dispatch: r
583
608
  })
584
609
  );
@@ -595,9 +620,9 @@ class Z extends g {
595
620
  * Defaults to a strict equality check (===).
596
621
  * @returns A Prop object representing the isomorphism.
597
622
  */
598
- iso = (e, s, n = (r, i) => r === i) => {
623
+ iso = (e, s, n = (r, o) => r === o) => {
599
624
  const r = new Z(e(this.get()), n);
600
- return r.onDispose(this.on((i) => r.set(e(i)))), r.on((i) => this._setAndNotify(s(i))), r;
625
+ return r.onDispose(this.on((o) => r.set(e(o)))), r.on((o) => this._setAndNotify(s(o))), r;
601
626
  };
602
627
  /**
603
628
  * Returns a `Prop` that represents the value at the specified key of the current value.
@@ -624,21 +649,21 @@ const z = (t, e, s = (n, r) => n === r) => {
624
649
  return e.forEach((r) => r.setDerivative(n)), n;
625
650
  }, Se = (t, e, s = {}) => {
626
651
  let n = s.once ? () => {
627
- i(), t();
652
+ o(), t();
628
653
  } : t;
629
654
  if (s.skipInitial) {
630
- let o = !1;
655
+ let i = !1;
631
656
  const l = n;
632
657
  n = () => {
633
- o ? l() : o = !0;
658
+ i ? l() : i = !0;
634
659
  };
635
660
  }
636
- const r = z(n, e), i = () => {
637
- r.dispose(), s.abortSignal != null && s.abortSignal.removeEventListener("abort", i);
661
+ const r = z(n, e), o = () => {
662
+ r.dispose(), s.abortSignal != null && s.abortSignal.removeEventListener("abort", o);
638
663
  };
639
- return s.abortSignal != null && s.abortSignal.addEventListener("abort", i), i;
664
+ return s.abortSignal != null && s.abortSignal.addEventListener("abort", o), o;
640
665
  }, T = (t, e = (s, n) => s === n) => {
641
- const s = new Z(t, e), n = ye();
666
+ const s = new Z(t, e), n = ue();
642
667
  return n?.track(s), s;
643
668
  }, K = (t, e = (s, n) => s === n) => new g(t, e);
644
669
  function we(t) {
@@ -851,7 +876,7 @@ class j {
851
876
  * @public
852
877
  */
853
878
  prop(e, s) {
854
- const n = oe(() => T(e, s));
879
+ const n = ie(() => T(e, s));
855
880
  return this.track(n), n;
856
881
  }
857
882
  /**
@@ -865,7 +890,7 @@ class j {
865
890
  * @public
866
891
  */
867
892
  computed(e, s, n) {
868
- const r = oe(() => z(e, s, n));
893
+ const r = ie(() => z(e, s, n));
869
894
  return this.track(r), r;
870
895
  }
871
896
  /**
@@ -879,7 +904,7 @@ class j {
879
904
  * @public
880
905
  */
881
906
  effect(e, s, n) {
882
- return L(this, () => Se(e, s, n));
907
+ return x(this, () => Se(e, s, n));
883
908
  }
884
909
  /**
885
910
  * Creates a computed signal with curried signature and tracks it in this scope.
@@ -891,7 +916,7 @@ class j {
891
916
  */
892
917
  computedOf(...e) {
893
918
  return (s, n) => {
894
- const r = oe(() => ee(...e)(s, n));
919
+ const r = ie(() => ee(...e)(s, n));
895
920
  return this.track(r), r;
896
921
  };
897
922
  }
@@ -904,17 +929,17 @@ class j {
904
929
  * @public
905
930
  */
906
931
  effectOf(...e) {
907
- return (s, n) => L(this, () => Qe(...e)(s, n));
932
+ return (s, n) => x(this, () => Qe(...e)(s, n));
908
933
  }
909
934
  }
910
- const Ze = (t, e, s) => t + (e - t) * s, pe = 97, ze = (t, e, s) => {
935
+ const Ze = (t, e, s) => t + (e - t) * s, ge = 97, ze = (t, e, s) => {
911
936
  const n = Math.max(t.length, e.length);
912
937
  let r = "";
913
- for (let i = 0; i < n; i++) {
914
- let o = t.charCodeAt(i);
915
- isNaN(o) && (o = pe);
916
- let l = e.charCodeAt(i);
917
- isNaN(l) && (l = pe), r += String.fromCharCode(o + (l - o) * s);
938
+ for (let o = 0; o < n; o++) {
939
+ let i = t.charCodeAt(o);
940
+ isNaN(i) && (i = ge);
941
+ let l = e.charCodeAt(o);
942
+ isNaN(l) && (l = ge), r += String.fromCharCode(i + (l - i) * s);
918
943
  }
919
944
  return r;
920
945
  }, Ke = (t, e, s) => new Date(t.getTime() + (e.getTime() - t.getTime()) * s), et = (t, e) => e, tt = (t) => typeof t == "number" ? Ze : typeof t == "string" ? ze : t instanceof Date ? Ke : et;
@@ -966,7 +991,7 @@ class le {
966
991
  this.#e?.dispose(), this.#e = void 0;
967
992
  };
968
993
  }
969
- const ue = () => (
994
+ const he = () => (
970
995
  /* c8 ignore next */
971
996
  typeof window < "u" ? window : void 0
972
997
  );
@@ -994,40 +1019,40 @@ const st = () => (ce || (ce = new be()), ce), nt = () => (ae || (ae = new be()),
994
1019
  store: s,
995
1020
  serialize: n = JSON.stringify,
996
1021
  deserialize: r = JSON.parse,
997
- equals: i = (a, u) => a === u,
998
- onLoad: o = (a) => a,
1022
+ equals: o = (a, u) => a === u,
1023
+ onLoad: i = (a) => a,
999
1024
  syncTabs: l = !0,
1000
1025
  onKeyChange: c = "load"
1001
1026
  }) => {
1002
1027
  let a = y.get(t);
1003
1028
  const u = s.getItem(a), h = new Z(
1004
- u != null ? o(r(u)) : typeof e == "function" ? e() : e,
1005
- i
1006
- ), p = ue(), d = l && typeof p?.BroadcastChannel == "function";
1029
+ u != null ? i(r(u)) : typeof e == "function" ? e() : e,
1030
+ o
1031
+ ), p = he(), d = l && typeof p?.BroadcastChannel == "function";
1007
1032
  let m = !1, w = null, D = null;
1008
1033
  const b = (S) => {
1009
1034
  if (!d) return null;
1010
- const M = `tempo:storedProp:${S}`, A = new p.BroadcastChannel(M), k = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`, x = (F) => {
1035
+ const M = `tempo:storedProp:${S}`, A = new p.BroadcastChannel(M), k = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`, P = (F) => {
1011
1036
  const v = F.data;
1012
1037
  if (!(v == null || typeof v != "object" || v.key !== S || typeof v.value != "string" || v.sourceId != null && v.sourceId === k))
1013
1038
  try {
1014
1039
  m = !0;
1015
- const ie = o(r(v.value));
1016
- h.set(ie);
1017
- } catch (ie) {
1040
+ const oe = i(r(v.value));
1041
+ h.set(oe);
1042
+ } catch (oe) {
1018
1043
  console.warn(
1019
1044
  `Failed to sync storedProp for key "${S}" via BroadcastChannel`,
1020
- ie
1045
+ oe
1021
1046
  );
1022
1047
  } finally {
1023
1048
  m = !1;
1024
1049
  }
1025
1050
  };
1026
- return A.addEventListener("message", x), h.onDispose(() => {
1027
- A?.removeEventListener("message", x), A?.close();
1028
- }), { channel: A, instanceId: k, handleMessage: x };
1029
- }, P = b(a);
1030
- P && (w = P.channel, D = P.instanceId);
1051
+ return A.addEventListener("message", P), h.onDispose(() => {
1052
+ A?.removeEventListener("message", P), A?.close();
1053
+ }), { channel: A, instanceId: k, handleMessage: P };
1054
+ }, L = b(a);
1055
+ L && (w = L.channel, D = L.instanceId);
1031
1056
  const re = (S) => {
1032
1057
  const M = a;
1033
1058
  if (M === S) return;
@@ -1036,7 +1061,7 @@ const st = () => (ce || (ce = new be()), ce), nt = () => (ae || (ae = new be()),
1036
1061
  const F = s.getItem(S);
1037
1062
  if (F != null)
1038
1063
  try {
1039
- const v = o(r(F));
1064
+ const v = i(r(F));
1040
1065
  h.set(v);
1041
1066
  } catch (v) {
1042
1067
  console.warn(
@@ -1047,8 +1072,8 @@ const st = () => (ce || (ce = new be()), ce), nt = () => (ae || (ae = new be()),
1047
1072
  else
1048
1073
  s.setItem(S, k);
1049
1074
  } else c === "migrate" && s.setItem(S, k);
1050
- const x = b(S);
1051
- x && (w = x.channel, D = x.instanceId);
1075
+ const P = b(S);
1076
+ P && (w = P.channel, D = P.instanceId);
1052
1077
  };
1053
1078
  return g.is(t) && h.onDispose(t.on(re)), h.on((S, M) => {
1054
1079
  const A = n(S);
@@ -1059,37 +1084,37 @@ const st = () => (ce || (ce = new be()), ce), nt = () => (ae || (ae = new be()),
1059
1084
  });
1060
1085
  }), h;
1061
1086
  }, ts = (t) => {
1062
- const s = ue()?.localStorage, n = s && typeof s.getItem == "function" ? s : st();
1087
+ const s = he()?.localStorage, n = s && typeof s.getItem == "function" ? s : st();
1063
1088
  return _e({
1064
1089
  ...t,
1065
1090
  store: n
1066
1091
  });
1067
1092
  }, ss = (t) => {
1068
- const s = ue()?.sessionStorage, n = s && typeof s.getItem == "function" ? s : nt();
1093
+ const s = he()?.sessionStorage, n = s && typeof s.getItem == "function" ? s : nt();
1069
1094
  return _e({
1070
1095
  ...t,
1071
1096
  store: n
1072
1097
  });
1073
1098
  };
1074
- function ge(t) {
1099
+ function me(t) {
1075
1100
  return typeof requestAnimationFrame == "function" ? requestAnimationFrame(t) : setTimeout(t, 0);
1076
1101
  }
1077
1102
  const rt = (t, e, s, n) => {
1078
- const r = n?.duration ?? 300, i = n?.easing ?? ((b) => b), o = n?.equals ?? ((b, P) => b === P);
1103
+ const r = n?.duration ?? 300, o = n?.easing ?? ((b) => b), i = n?.equals ?? ((b, L) => b === L);
1079
1104
  let l = n?.interpolate, c = t, a = e(), u = performance.now(), h = null, p = !0;
1080
- const d = new N(e, o), m = T(t, o);
1105
+ const d = new N(e, i), m = T(t, i);
1081
1106
  m.onDispose(() => {
1082
1107
  h !== null && cancelAnimationFrame(h);
1083
1108
  }), m.onDispose(d.dispose), s.forEach((b) => {
1084
1109
  b.setDerivative(d), b.onDispose(m.dispose);
1085
1110
  });
1086
1111
  const w = (b) => {
1087
- a = b, u = performance.now(), c = m.value, p && (p = !1, h = ge(D));
1112
+ a = b, u = performance.now(), c = m.value, p && (p = !1, h = me(D));
1088
1113
  }, D = () => {
1089
- const P = (performance.now() - u) / y.get(r), re = i(P);
1114
+ const L = (performance.now() - u) / y.get(r), re = o(L);
1090
1115
  l == null && (l = tt(c));
1091
1116
  let S = l(c, a, re);
1092
- P >= 1 ? (p = !0, S = a) : h = ge(D), m.set(S);
1117
+ L >= 1 ? (p = !0, S = a) : h = me(D), m.set(S);
1093
1118
  };
1094
1119
  return d.on(w), m;
1095
1120
  }, ns = (t, e) => {
@@ -1101,29 +1126,32 @@ const rt = (t, e, s, n) => {
1101
1126
  [t],
1102
1127
  n
1103
1128
  );
1104
- }, it = (t, e) => {
1129
+ }, ot = (t, e) => {
1105
1130
  const s = Object.values(t).filter(g.is), n = Object.keys(t);
1106
1131
  return z(() => {
1107
1132
  const r = {};
1108
- for (const i of n)
1109
- r[i] = y.get(t[i]);
1133
+ for (const o of n)
1134
+ r[o] = y.get(t[o]);
1110
1135
  return e(r);
1111
1136
  }, s);
1112
- }, rs = (t) => it(t, (e) => e), is = (t, e) => {
1137
+ }, rs = (t) => ot(t, (e) => e), os = (t, e) => {
1113
1138
  const s = T(t.get());
1114
1139
  let n = null;
1115
- const r = t.on((i) => {
1116
- n != null && clearTimeout(n), n = setTimeout(
1117
- () => {
1118
- n = null, s.set(i);
1119
- },
1120
- typeof e == "function" ? e(i) : e
1121
- );
1122
- });
1140
+ const r = t.on(
1141
+ (o) => {
1142
+ n != null && clearTimeout(n), n = setTimeout(
1143
+ () => {
1144
+ n = null, s.set(o);
1145
+ },
1146
+ typeof e == "function" ? e(o) : e
1147
+ );
1148
+ },
1149
+ { noAutoDispose: !0 }
1150
+ );
1123
1151
  return s.onDispose(() => {
1124
1152
  r(), n != null && clearTimeout(n);
1125
1153
  }), s;
1126
- }, os = (t) => {
1154
+ }, is = (t) => {
1127
1155
  let e;
1128
1156
  return t.map((s) => {
1129
1157
  const n = e;
@@ -1157,7 +1185,7 @@ const ve = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), Te = /* @
1157
1185
  "outerHTML",
1158
1186
  "className",
1159
1187
  "classList"
1160
- ]), ot = (t, e) => Te.has(t) ? (s) => {
1188
+ ]), it = (t, e) => Te.has(t) ? (s) => {
1161
1189
  s == null || s !== !0 ? e.removeAttribute(t) : e.setAttribute(t, "");
1162
1190
  } : ve.has(t) ? (s) => {
1163
1191
  s == null ? e[t] = null : e[t] = !!s;
@@ -1173,7 +1201,7 @@ const ve = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), Te = /* @
1173
1201
  const e = t;
1174
1202
  e && e.onblur && (e.onblur = null), !(!t || t.ownerDocument === void 0) && t.parentElement && t.parentElement.removeChild(t);
1175
1203
  }, ct = (t) => De(t) ? t : t.parentElement, De = (t) => t.nodeType === 1;
1176
- class Pe extends Error {
1204
+ class Le extends Error {
1177
1205
  constructor(e) {
1178
1206
  super(`Provider not found: ${e.description}`);
1179
1207
  }
@@ -1363,7 +1391,7 @@ class $ {
1363
1391
  */
1364
1392
  getProvider = (e) => {
1365
1393
  if (this.providers[e] === void 0)
1366
- throw new Pe(e);
1394
+ throw new Le(e);
1367
1395
  const [s, n] = this.providers[e];
1368
1396
  return { value: s, onUse: n };
1369
1397
  };
@@ -1397,9 +1425,9 @@ class $ {
1397
1425
  * @returns A function to remove the event listener.
1398
1426
  */
1399
1427
  on = (e, s, n) => {
1400
- const r = (i) => s(i, this);
1401
- return this.element.addEventListener(e, r, n), (i) => {
1402
- i && this.element.removeEventListener(e, r, n);
1428
+ const r = (o) => s(o, this);
1429
+ return this.element.addEventListener(e, r, n), (o) => {
1430
+ o && this.element.removeEventListener(e, r, n);
1403
1431
  };
1404
1432
  };
1405
1433
  /**
@@ -1439,29 +1467,29 @@ class $ {
1439
1467
  getStyle = (e) => this.element.style[e];
1440
1468
  makeAccessors = (e) => ({
1441
1469
  get: lt(e, this.element),
1442
- set: ot(e, this.element)
1470
+ set: it(e, this.element)
1443
1471
  });
1444
1472
  getWindow = () => this.document.defaultView;
1445
1473
  }
1446
- const at = (t) => Symbol(t), he = (t, e) => {
1447
- const s = new j(), n = L(s, () => t(e));
1474
+ const at = (t) => Symbol(t), fe = (t, e) => {
1475
+ const s = new j(), n = x(s, () => t(e));
1448
1476
  return (r = !0) => {
1449
1477
  s.dispose(), n(r);
1450
1478
  };
1451
- }, us = (t, e, { doc: s, clear: n, disposeWithParent: r = !0, providers: i = {} } = {}) => {
1452
- const o = typeof e == "string" ? (s ?? document).querySelector(e) : e;
1453
- if (o === null)
1479
+ }, us = (t, e, { doc: s, clear: n, disposeWithParent: r = !0, providers: o = {} } = {}) => {
1480
+ const i = typeof e == "string" ? (s ?? document).querySelector(e) : e;
1481
+ if (i === null)
1454
1482
  throw new ut(
1455
1483
  `Cannot find element by selector for render: ${e}`
1456
1484
  );
1457
- n !== !1 && (s ?? o.ownerDocument) != null && o.nodeType === 1 && (o.innerHTML = "");
1458
- const l = ct(o), c = De(o) ? void 0 : o, a = $.of(l, c, i), u = he(t, a);
1485
+ n !== !1 && (s ?? i.ownerDocument) != null && i.nodeType === 1 && (i.innerHTML = "");
1486
+ const l = ct(i), c = De(i) ? void 0 : i, a = $.of(l, c, o), u = fe(t, a);
1459
1487
  let h;
1460
1488
  return r && (h = new MutationObserver((p) => {
1461
1489
  p[0]?.removedNodes.forEach((d) => {
1462
- d === o && (h?.disconnect(), u(o.nodeType !== 1));
1490
+ d === i && (h?.disconnect(), u(i.nodeType !== 1));
1463
1491
  });
1464
- }), h.observe(o.parentElement, {
1492
+ }), h.observe(i.parentElement, {
1465
1493
  childList: !0,
1466
1494
  subtree: !1,
1467
1495
  attributes: !1
@@ -1475,10 +1503,10 @@ const at = (t) => Symbol(t), he = (t, e) => {
1475
1503
  } = {
1476
1504
  selector: "body"
1477
1505
  }) => {
1478
- const r = y.toSignal(e).deriveProp(), i = new ke(s, void 0), o = new R(i, void 0, { currentURL: r }, n);
1506
+ const r = y.toSignal(e).deriveProp(), o = new ke(s, void 0), i = new R(o, void 0, { currentURL: r }, n);
1479
1507
  return {
1480
- clear: he(t(), o),
1481
- root: i,
1508
+ clear: fe(t(), i),
1509
+ root: o,
1482
1510
  currentURL: r
1483
1511
  };
1484
1512
  };
@@ -1487,7 +1515,7 @@ class ut extends Error {
1487
1515
  super(e);
1488
1516
  }
1489
1517
  }
1490
- const xe = "data-tts-node", G = "data-tts-class", J = "data-tts-style", X = "data-tts-html", Y = "data-tts-text", Q = "data-tts-attrs";
1518
+ const Pe = "data-tts-node", G = "data-tts-class", J = "data-tts-style", X = "data-tts-html", Y = "data-tts-text", Q = "data-tts-attrs";
1491
1519
  class fs {
1492
1520
  /**
1493
1521
  * Selects elements from the headless environment.
@@ -1567,8 +1595,8 @@ class fs {
1567
1595
  getAttribute: s,
1568
1596
  setAttribute: n,
1569
1597
  getClass: r,
1570
- setClass: i,
1571
- getStyles: o,
1598
+ setClass: o,
1599
+ getStyles: i,
1572
1600
  setStyles: l,
1573
1601
  appendHTML: c,
1574
1602
  getInnerHTML: a,
@@ -1576,7 +1604,7 @@ class fs {
1576
1604
  getInnerText: h,
1577
1605
  setInnerText: p
1578
1606
  }) {
1579
- this.select = e, this.getAttribute = s, this.setAttribute = n, this.getClass = r, this.setClass = i, this.getStyles = o, this.setStyles = l, this.appendHTML = c, this.getInnerHTML = a, this.setInnerHTML = u, this.getInnerText = h, this.setInnerText = p;
1607
+ this.select = e, this.getAttribute = s, this.setAttribute = n, this.getClass = r, this.setClass = o, this.getStyles = i, this.setStyles = l, this.appendHTML = c, this.getInnerHTML = a, this.setInnerHTML = u, this.getInnerText = h, this.setInnerText = p;
1580
1608
  }
1581
1609
  /**
1582
1610
  * Sets the content of the root element from a HeadlessPortal. Generally this will be the same instance that is
@@ -1588,59 +1616,59 @@ class fs {
1588
1616
  */
1589
1617
  setFromRoot = (e, s) => {
1590
1618
  e.getPortals().forEach((r) => {
1591
- const i = typeof r.selector == "string" ? this.select(r.selector) : [r.selector];
1592
- for (const o of i) {
1593
- if (o == null)
1619
+ const o = typeof r.selector == "string" ? this.select(r.selector) : [r.selector];
1620
+ for (const i of o) {
1621
+ if (i == null)
1594
1622
  throw new Error(
1595
1623
  `Cannot find element by selector for render: ${r.selector}`
1596
1624
  );
1597
- if (r.hasChildren() && this.appendHTML(o, r.contentToHTML(s)), r.hasInnerHTML()) {
1625
+ if (r.hasChildren() && this.appendHTML(i, r.contentToHTML(s)), r.hasInnerHTML()) {
1598
1626
  if (s) {
1599
- const l = this.getInnerHTML(o);
1600
- l != null && this.setAttribute(o, X, l);
1627
+ const l = this.getInnerHTML(i);
1628
+ l != null && this.setAttribute(i, X, l);
1601
1629
  }
1602
- this.setInnerHTML(o, r.getInnerHTML());
1630
+ this.setInnerHTML(i, r.getInnerHTML());
1603
1631
  }
1604
1632
  if (r.hasInnerText()) {
1605
1633
  if (s) {
1606
- const l = this.getInnerText(o);
1607
- l != null && this.setAttribute(o, Y, l);
1634
+ const l = this.getInnerText(i);
1635
+ l != null && this.setAttribute(i, Y, l);
1608
1636
  }
1609
- this.setInnerText(o, r.getInnerText());
1637
+ this.setInnerText(i, r.getInnerText());
1610
1638
  }
1611
1639
  if (r.hasClasses()) {
1612
1640
  if (s) {
1613
- const l = this.getClass(o);
1614
- l != null && this.setAttribute(o, G, l);
1641
+ const l = this.getClass(i);
1642
+ l != null && this.setAttribute(i, G, l);
1615
1643
  }
1616
- this.setClass(o, r.getClasses().join(" "));
1644
+ this.setClass(i, r.getClasses().join(" "));
1617
1645
  }
1618
1646
  if (r.hasStyles()) {
1619
1647
  if (s) {
1620
- const l = this.getStyles(o);
1648
+ const l = this.getStyles(i);
1621
1649
  Object.keys(l).length > 0 && this.setAttribute(
1622
- o,
1650
+ i,
1623
1651
  J,
1624
1652
  JSON.stringify(l)
1625
1653
  );
1626
1654
  }
1627
- this.setStyles(o, r.getStyles());
1655
+ this.setStyles(i, r.getStyles());
1628
1656
  }
1629
1657
  if (r.hasAttributes()) {
1630
1658
  const l = r.getAttributes();
1631
1659
  if (s) {
1632
1660
  const c = [];
1633
1661
  l.forEach(([a]) => {
1634
- const u = this.getAttribute(o, a);
1662
+ const u = this.getAttribute(i, a);
1635
1663
  u != null && c.push([a, u]);
1636
1664
  }), c.length > 0 && this.setAttribute(
1637
- o,
1665
+ i,
1638
1666
  Q,
1639
1667
  JSON.stringify(Object.fromEntries(c))
1640
1668
  );
1641
1669
  }
1642
1670
  l.forEach(([c, a]) => {
1643
- this.setAttribute(o, c, a);
1671
+ this.setAttribute(i, c, a);
1644
1672
  });
1645
1673
  }
1646
1674
  }
@@ -1648,7 +1676,7 @@ class fs {
1648
1676
  };
1649
1677
  }
1650
1678
  const ht = () => {
1651
- document.querySelectorAll(`[${xe}]`).forEach(U);
1679
+ document.querySelectorAll(`[${Pe}]`).forEach(U);
1652
1680
  }, ft = (t) => {
1653
1681
  const e = t.getAttribute(G);
1654
1682
  t.removeAttribute(G), e != null && t.setAttribute("class", e);
@@ -1664,10 +1692,10 @@ const ht = () => {
1664
1692
  t.removeAttribute(Y), e != null && (t.innerText = e);
1665
1693
  }, yt = () => {
1666
1694
  document.querySelectorAll(`[${Y}]`).forEach((e) => mt(e));
1667
- }, Le = (t) => JSON.parse(t.replace(/&quot;/g, '"')), St = (t) => {
1695
+ }, xe = (t) => JSON.parse(t.replace(/&quot;/g, '"')), St = (t) => {
1668
1696
  const e = t.getAttribute(J);
1669
1697
  if (t.removeAttribute(J), e != null) {
1670
- const s = Le(e);
1698
+ const s = xe(e);
1671
1699
  Object.entries(s).forEach(([n, r]) => {
1672
1700
  t.style.setProperty(n, r);
1673
1701
  });
@@ -1677,7 +1705,7 @@ const ht = () => {
1677
1705
  }, bt = (t) => {
1678
1706
  const e = t.getAttribute(Q);
1679
1707
  if (t.removeAttribute(Q), e != null) {
1680
- const s = Le(e);
1708
+ const s = xe(e);
1681
1709
  Object.entries(s).forEach(([n, r]) => {
1682
1710
  r == null ? t.removeAttribute(n) : t.setAttribute(n, r);
1683
1711
  });
@@ -1738,13 +1766,13 @@ class Me {
1738
1766
  this.trigger("click", {});
1739
1767
  };
1740
1768
  on = (e, s, n, r) => {
1741
- const i = this.properties[B] ??= {}, o = r?.once ? (c) => {
1769
+ const o = this.properties[B] ??= {}, i = r?.once ? (c) => {
1742
1770
  l(), s(c, n);
1743
1771
  } : (c) => s(c, n);
1744
- i[e] = [...i[e] ?? [], o];
1772
+ o[e] = [...o[e] ?? [], i];
1745
1773
  const l = () => {
1746
- const c = i[e] ?? [], a = c.indexOf(o);
1747
- a !== -1 && (c.splice(a, 1), c.length === 0 ? (delete i[e], Object.keys(i).length === 0 && delete this.properties[B]) : i[e] = c, r?.signal != null && r.signal.removeEventListener("abort", l));
1774
+ const c = o[e] ?? [], a = c.indexOf(i);
1775
+ a !== -1 && (c.splice(a, 1), c.length === 0 ? (delete o[e], Object.keys(o).length === 0 && delete this.properties[B]) : o[e] = c, r?.signal != null && r.signal.removeEventListener("abort", l));
1748
1776
  };
1749
1777
  return r?.signal != null && r.signal.addEventListener("abort", l), l;
1750
1778
  };
@@ -1795,8 +1823,8 @@ class Et extends Me {
1795
1823
  toHTML = (e = !1) => {
1796
1824
  const s = this.children.map((l) => l.toHTML()).join(""), n = this.namespace ? ` xmlns="${this.namespace}"` : "";
1797
1825
  let r = null;
1798
- const i = this.getVisibleAttributes().map(([l, c]) => l === "class" ? ` class="${c.join(" ")}"` : l === "style" ? typeof c == "string" ? ` style="${c}"` : ` style="${Object.entries(c).map(([a, u]) => `${a}: ${u};`).join(" ")}"` : Dt.has(l) ? ` ${l}` : l === "innerHTML" ? (r = c, "") : l === "innerText" ? (r = At(c), "") : ` ${l}="${Tt(c)}"`).join(""), o = e ? ` ${xe}` : "";
1799
- return Pt.has(this.tagName) && s === "" ? `<${this.tagName}${n}${i}${o} />` : `<${this.tagName}${n}${i}${o}>${r ?? s}</${this.tagName}>`;
1826
+ const o = this.getVisibleAttributes().map(([l, c]) => l === "class" ? ` class="${c.join(" ")}"` : l === "style" ? typeof c == "string" ? ` style="${c}"` : ` style="${Object.entries(c).map(([a, u]) => `${a}: ${u};`).join(" ")}"` : Dt.has(l) ? ` ${l}` : l === "innerHTML" ? (r = c, "") : l === "innerText" ? (r = At(c), "") : ` ${l}="${Tt(c)}"`).join(""), i = e ? ` ${Pe}` : "";
1827
+ return Lt.has(this.tagName) && s === "" ? `<${this.tagName}${n}${o}${i} />` : `<${this.tagName}${n}${o}${i}>${r ?? s}</${this.tagName}>`;
1800
1828
  };
1801
1829
  }
1802
1830
  class ke extends Me {
@@ -1873,7 +1901,7 @@ class R {
1873
1901
  });
1874
1902
  getProvider = (e) => {
1875
1903
  if (this.providers[e] === void 0)
1876
- throw new Pe(e);
1904
+ throw new Le(e);
1877
1905
  const [s, n] = this.providers[e];
1878
1906
  return { value: s, onUse: n };
1879
1907
  };
@@ -1899,7 +1927,7 @@ const Dt = /* @__PURE__ */ new Set([
1899
1927
  "readonly",
1900
1928
  "required",
1901
1929
  "selected"
1902
- ]), Pt = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), Ie = (t) => (e) => e.makeChildText(t).clear, He = (t) => (e) => {
1930
+ ]), Lt = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), Ie = (t) => (e) => e.makeChildText(t).clear, He = (t) => (e) => {
1903
1931
  const s = e.makeChildText(t.value), n = t.on(s.setText);
1904
1932
  return (r) => {
1905
1933
  n(), s.clear(r);
@@ -1910,27 +1938,30 @@ const Dt = /* @__PURE__ */ new Set([
1910
1938
  s.forEach((r) => r(n));
1911
1939
  };
1912
1940
  }, C = () => () => {
1913
- }, xt = (t) => (e) => (e.addClasses(t), (s) => {
1941
+ }, Pt = (t) => (e) => (e.addClasses(t), (s) => {
1914
1942
  s && e.removeClasses(t);
1915
- }), Lt = (t) => (e) => {
1943
+ }), xt = (t) => (e) => {
1916
1944
  let s = [];
1917
- const n = t.on((r) => {
1918
- e.removeClasses(s), s = (r ?? "").split(" ").filter((i) => i.length > 0), e.addClasses(s);
1919
- });
1945
+ const n = t.on(
1946
+ (r) => {
1947
+ e.removeClasses(s), s = (r ?? "").split(" ").filter((o) => o.length > 0), e.addClasses(s);
1948
+ },
1949
+ { noAutoDispose: !0 }
1950
+ );
1920
1951
  return (r) => {
1921
1952
  n(), r && e.removeClasses(s), s.length = 0;
1922
1953
  };
1923
1954
  }, Ot = (t, e) => (s) => {
1924
- const { get: n, set: r } = s.makeAccessors(t), i = n();
1925
- return r(e), (o) => {
1926
- o && r(i);
1955
+ const { get: n, set: r } = s.makeAccessors(t), o = n();
1956
+ return r(e), (i) => {
1957
+ i && r(o);
1927
1958
  };
1928
1959
  }, Mt = (t, e) => (s) => {
1929
- const { get: n, set: r } = s.makeAccessors(t), i = n(), o = e.on(r);
1960
+ const { get: n, set: r } = s.makeAccessors(t), o = n(), i = e.on(r, { noAutoDispose: !0 });
1930
1961
  return (l) => {
1931
- o(), l && r(i);
1962
+ i(), l && r(o);
1932
1963
  };
1933
- }, q = (t, e) => g.is(e) ? Mt(t, e) : Ot(t, e), kt = (t, e) => t === "class" ? g.is(e) ? Lt(e) : xt(
1964
+ }, q = (t, e) => g.is(e) ? Mt(t, e) : Ot(t, e), kt = (t, e) => t === "class" ? g.is(e) ? xt(e) : Pt(
1934
1965
  /* c8 ignore next */
1935
1966
  (e ?? "").split(" ").filter((s) => s.length > 0)
1936
1967
  ) : q(t, e), V = new Proxy(
@@ -2013,14 +2044,14 @@ const Dt = /* @__PURE__ */ new Set([
2013
2044
  return t;
2014
2045
  throw new Error(`Unknown type: '${typeof t}' for child: ${t}`);
2015
2046
  }, Ne = (t, ...e) => (s) => {
2016
- const n = s.makeChildElement(t, void 0), r = e.map((i) => f(i)(n));
2017
- return (i) => {
2018
- r.forEach((o) => o(!1)), n.clear(i);
2047
+ const n = s.makeChildElement(t, void 0), r = e.map((o) => f(o)(n));
2048
+ return (o) => {
2049
+ r.forEach((i) => i(!1)), n.clear(o);
2019
2050
  };
2020
2051
  }, te = (t, e, ...s) => (n) => {
2021
- const r = n.makeChildElement(t, e), i = s.map((o) => f(o)(r));
2022
- return (o) => {
2023
- i.forEach((l) => l(!1)), r.clear(o);
2052
+ const r = n.makeChildElement(t, e), o = s.map((i) => f(i)(r));
2053
+ return (i) => {
2054
+ o.forEach((l) => l(!1)), r.clear(i);
2024
2055
  };
2025
2056
  }, ws = new Proxy(
2026
2057
  {},
@@ -2065,20 +2096,20 @@ const Dt = /* @__PURE__ */ new Set([
2065
2096
  ), Ve = (t, e) => {
2066
2097
  if (typeof e == "function")
2067
2098
  return Ve(t, { then: e });
2068
- const s = e.pending != null ? f(e.pending()) : C, n = e.then, r = e.error != null ? (i) => f(e.error(i)) : () => C;
2069
- return (i) => {
2070
- let o = !0;
2071
- const l = t(), c = i.makeRef();
2099
+ const s = e.pending != null ? f(e.pending()) : C, n = e.then, r = e.error != null ? (o) => f(e.error(o)) : () => C;
2100
+ return (o) => {
2101
+ let i = !0;
2102
+ const l = t(), c = o.makeRef();
2072
2103
  let a = f(s)(c);
2073
2104
  return l.then(
2074
2105
  (u) => {
2075
- o && (a(!0), a = f(n(u))(c));
2106
+ i && (a(!0), a = f(n(u))(c));
2076
2107
  },
2077
2108
  (u) => {
2078
- o && (a(!0), a = f(r(u))(c));
2109
+ i && (a(!0), a = f(r(u))(c));
2079
2110
  }
2080
2111
  ), (u) => {
2081
- o = !1, a(u), c.clear(u);
2112
+ i = !1, a(u), c.clear(u);
2082
2113
  };
2083
2114
  };
2084
2115
  }, Es = (t, e) => Ve(() => t, e), je = (t, e, s) => (n) => n.on(t, e, s), Rt = (t) => je("click", (e, s) => {
@@ -2112,32 +2143,32 @@ const Dt = /* @__PURE__ */ new Set([
2112
2143
  ), Ft = (t, e) => O((s, n) => {
2113
2144
  if (s.value === "")
2114
2145
  return;
2115
- const r = s.value.split("-"), i = new Date(
2146
+ const r = s.value.split("-"), o = new Date(
2116
2147
  Number(r[0]),
2117
2148
  Number(r[1]) - 1,
2118
2149
  Number(r[2].substring(0, 2))
2119
2150
  );
2120
- t(i, n);
2151
+ t(o, n);
2121
2152
  }, e), Cs = (t, e) => O((s, n) => {
2122
2153
  if (s.value === "") {
2123
2154
  t(null, n);
2124
2155
  return;
2125
2156
  }
2126
- const r = s.value.split("-"), i = new Date(
2157
+ const r = s.value.split("-"), o = new Date(
2127
2158
  Number(r[0]),
2128
2159
  Number(r[1]) - 1,
2129
2160
  Number(r[2].substring(0, 2))
2130
2161
  );
2131
- t(i, n);
2162
+ t(o, n);
2132
2163
  }, e), Bt = (t, e) => O((s, n) => {
2133
2164
  if (s.value === "")
2134
2165
  return;
2135
- const r = s.value.split("T"), i = r[0].split("-"), o = new Date(
2136
- Number(i[0]),
2137
- Number(i[1]) - 1,
2138
- Number(i[2])
2166
+ const r = s.value.split("T"), o = r[0].split("-"), i = new Date(
2167
+ Number(o[0]),
2168
+ Number(o[1]) - 1,
2169
+ Number(o[2])
2139
2170
  ), l = r[1].split(":");
2140
- o.setHours(Number(l[0])), o.setMinutes(Number(l[1])), o.setSeconds(Number(l[2])), t(o, n);
2171
+ i.setHours(Number(l[0])), i.setMinutes(Number(l[1])), i.setSeconds(Number(l[2])), t(i, n);
2141
2172
  }, e), Ds = (t, e) => O((s, n) => {
2142
2173
  if (s.value === "") {
2143
2174
  t(null, n);
@@ -2148,31 +2179,34 @@ const Dt = /* @__PURE__ */ new Set([
2148
2179
  t(null, n);
2149
2180
  return;
2150
2181
  }
2151
- const i = r[0].split("-"), o = new Date(
2152
- Number(i[0]),
2153
- Number(i[1]) - 1,
2154
- Number(i[2])
2182
+ const o = r[0].split("-"), i = new Date(
2183
+ Number(o[0]),
2184
+ Number(o[1]) - 1,
2185
+ Number(o[2])
2155
2186
  ), l = r[1].split(":");
2156
- o.setHours(Number(l[0] ?? 0)), o.setMinutes(Number(l[1] ?? 0)), o.setSeconds(Number(l[2] ?? 0)), t(o, n);
2157
- }, e), Ps = (t, e) => O((s, n) => {
2187
+ i.setHours(Number(l[0] ?? 0)), i.setMinutes(Number(l[1] ?? 0)), i.setSeconds(Number(l[2] ?? 0)), t(i, n);
2188
+ }, e), Ls = (t, e) => O((s, n) => {
2158
2189
  t(s.checked, n);
2159
- }, e), xs = (t, e = "input") => E(V.valueAsDate(t), se[e](Ft(t.set))), Ls = (t, e = "input") => E(V.valueAsDate(t), se[e](Bt(t.set))), Os = (t, e = "input") => E(V.valueAsNumber(t), se[e](qt(t.set))), Ms = (t, e = "input") => E(V.value(t), se[e](jt(t.set))), ks = (t) => E(V.checked(t), Rt(t.set)), fe = (t, e, s) => g.is(t) ? e(t) : s(t), Wt = (t, e, s) => {
2190
+ }, e), Ps = (t, e = "input") => E(V.valueAsDate(t), se[e](Ft(t.set))), xs = (t, e = "input") => E(V.valueAsDate(t), se[e](Bt(t.set))), Os = (t, e = "input") => E(V.valueAsNumber(t), se[e](qt(t.set))), Ms = (t, e = "input") => E(V.value(t), se[e](jt(t.set))), ks = (t) => E(V.checked(t), Rt(t.set)), de = (t, e, s) => g.is(t) ? e(t) : s(t), Wt = (t, e, s) => {
2160
2191
  const n = t.makeRef();
2161
2192
  let r = () => {
2162
- }, i = null;
2163
- const o = e.on((l) => {
2164
- i?.dispose(), r(!0), i = new j(), r = L(
2165
- i,
2166
- () => f(s(l))(n)
2167
- );
2168
- });
2193
+ }, o = null;
2194
+ const i = e.on(
2195
+ (l) => {
2196
+ o?.dispose(), r(!0), o = new j(), r = x(
2197
+ o,
2198
+ () => f(s(l))(n)
2199
+ );
2200
+ },
2201
+ { noAutoDispose: !0 }
2202
+ );
2169
2203
  return (l) => {
2170
- i?.dispose(), r(l), o(), n.clear(l);
2204
+ o?.dispose(), r(l), i(), n.clear(l);
2171
2205
  };
2172
2206
  }, ne = (t, e) => {
2173
2207
  function s(r) {
2174
- return (i) => {
2175
- const o = i.makeRef();
2208
+ return (o) => {
2209
+ const i = o.makeRef();
2176
2210
  let l, c;
2177
2211
  const a = r.map((p) => Object.keys(p)[0]);
2178
2212
  let u;
@@ -2180,19 +2214,19 @@ const Dt = /* @__PURE__ */ new Set([
2180
2214
  if (p !== u) {
2181
2215
  u = p, c?.dispose(), l?.(!0), c = r.map((m) => m[p]);
2182
2216
  const d = e[p](c);
2183
- l = f(d)(o);
2217
+ l = f(d)(i);
2184
2218
  }
2185
2219
  });
2186
2220
  return (p) => {
2187
- c?.dispose(), h(), o.clear(p), l?.(p);
2221
+ c?.dispose(), h(), i.clear(p), l?.(p);
2188
2222
  };
2189
2223
  };
2190
2224
  }
2191
2225
  function n(r) {
2192
- const i = Object.keys(r)[0];
2193
- return f(e[i](K(r[i])));
2226
+ const o = Object.keys(r)[0];
2227
+ return f(e[o](K(r[o])));
2194
2228
  }
2195
- return fe(t, s, n);
2229
+ return de(t, s, n);
2196
2230
  }, qe = (t, e, s) => ne(
2197
2231
  y.map(t, (n) => ({ [n[e]]: n })),
2198
2232
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -2206,7 +2240,7 @@ const Dt = /* @__PURE__ */ new Set([
2206
2240
  ), $s = (t, e = {}) => (s) => {
2207
2241
  const n = e?.firstSeparator ?? t, r = e?.lastSeparator ?? t;
2208
2242
  return Ut(
2209
- s.map((i) => i.isFirst ? "first" : i.isLast ? "last" : "other"),
2243
+ s.map((o) => o.isFirst ? "first" : o.isLast ? "last" : "other"),
2210
2244
  {
2211
2245
  first: n,
2212
2246
  last: r,
@@ -2216,12 +2250,12 @@ const Dt = /* @__PURE__ */ new Set([
2216
2250
  }, Rs = (t) => (e) => (e.appendOrInsert(t), (s) => {
2217
2251
  s && U(t);
2218
2252
  }), Vs = (t, e, s) => {
2219
- function n(i) {
2220
- return (o) => {
2221
- const l = o.makeRef();
2253
+ function n(o) {
2254
+ return (i) => {
2255
+ const l = i.makeRef();
2222
2256
  let c = () => {
2223
2257
  }, a = !1, u = null;
2224
- const h = i.on((p) => {
2258
+ const h = o.on((p) => {
2225
2259
  p == null ? (c(!0), c = f(s?.())(l), a = !1, u?.dispose(), u = null) : a ? u.set(p) : (u = T(p), c(!0), c = f(e(u))(
2226
2260
  l
2227
2261
  ), a = !0);
@@ -2231,14 +2265,14 @@ const Dt = /* @__PURE__ */ new Set([
2231
2265
  };
2232
2266
  };
2233
2267
  }
2234
- function r(i) {
2235
- if (i == null) {
2236
- const o = s?.();
2237
- return o != null ? f(o) : C;
2268
+ function r(o) {
2269
+ if (o == null) {
2270
+ const i = s?.();
2271
+ return i != null ? f(i) : C;
2238
2272
  }
2239
- return f(e(K(i)));
2273
+ return f(e(K(o)));
2240
2274
  }
2241
- return fe(
2275
+ return de(
2242
2276
  t,
2243
2277
  n,
2244
2278
  r
@@ -2251,17 +2285,17 @@ const Dt = /* @__PURE__ */ new Set([
2251
2285
  return (s != null ? f(s?.()) : C)(
2252
2286
  r
2253
2287
  );
2254
- const o = t.map(() => null), l = t.map(
2288
+ const i = t.map(() => null), l = t.map(
2255
2289
  (d) => g.is(d) ? d.value != null : d != null
2256
2290
  );
2257
2291
  let c = null;
2258
2292
  const a = T(l.every((d) => d)), u = (d, m) => {
2259
2293
  if (d.value != null) {
2260
- if (o[m] == null) {
2294
+ if (i[m] == null) {
2261
2295
  const w = T(d.value);
2262
- o[m] = w;
2296
+ i[m] = w;
2263
2297
  } else
2264
- o[m].value = d.value;
2298
+ i[m].value = d.value;
2265
2299
  l[m] = !0;
2266
2300
  } else
2267
2301
  l[m] = !1;
@@ -2270,7 +2304,7 @@ const Dt = /* @__PURE__ */ new Set([
2270
2304
  const p = t.map((d, m) => {
2271
2305
  if (!g.is(d)) {
2272
2306
  const w = T(d);
2273
- return o[m] = w, () => {
2307
+ return i[m] = w, () => {
2274
2308
  };
2275
2309
  }
2276
2310
  return d.on(() => {
@@ -2278,16 +2312,16 @@ const Dt = /* @__PURE__ */ new Set([
2278
2312
  });
2279
2313
  });
2280
2314
  return a.on((d) => {
2281
- c?.(!0), c = null, d ? c = f(e(...o))(r) : c = f(s?.() ?? C)(r);
2315
+ c?.(!0), c = null, d ? c = f(e(...i))(r) : c = f(s?.() ?? C)(r);
2282
2316
  }), (d) => {
2283
- o.forEach((m) => m?.dispose()), a.dispose(), p.forEach((m) => m()), c?.(d), r.clear(d);
2317
+ i.forEach((m) => m?.dispose()), a.dispose(), p.forEach((m) => m()), c?.(d), r.clear(d);
2284
2318
  };
2285
- }, Fe = (t, e, s) => fe(
2319
+ }, Fe = (t, e, s) => de(
2286
2320
  t,
2287
2321
  (n) => (r) => Wt(
2288
2322
  r,
2289
2323
  n,
2290
- (i) => i ? e() : s?.()
2324
+ (o) => o ? e() : s?.()
2291
2325
  ),
2292
2326
  (n) => {
2293
2327
  if (n) {
@@ -2305,7 +2339,7 @@ const Dt = /* @__PURE__ */ new Set([
2305
2339
  return Be(t, (n) => {
2306
2340
  const r = new le(
2307
2341
  n.index,
2308
- n.total.map((i) => i - 1)
2342
+ n.total.map((o) => o - 1)
2309
2343
  );
2310
2344
  return E(
2311
2345
  f(e(n)),
@@ -2318,44 +2352,44 @@ const Dt = /* @__PURE__ */ new Set([
2318
2352
  });
2319
2353
  if (g.is(t))
2320
2354
  return (n) => {
2321
- const r = t.derive(), i = n.makeRef(), o = [], l = [];
2355
+ const r = t.derive(), o = n.makeRef(), i = [], l = [];
2322
2356
  return r.on((c) => {
2323
- const a = o.splice(c), u = l.splice(c);
2357
+ const a = i.splice(c), u = l.splice(c);
2324
2358
  for (const h of u)
2325
2359
  h.dispose();
2326
2360
  for (const h of a)
2327
2361
  h(!0);
2328
- for (let h = o.length; h < c; h++) {
2362
+ for (let h = i.length; h < c; h++) {
2329
2363
  const p = new le(h, r), d = new j();
2330
- l.push(d), o.push(
2331
- L(d, () => f(e(p))(i))
2364
+ l.push(d), i.push(
2365
+ x(d, () => f(e(p))(o))
2332
2366
  );
2333
2367
  }
2334
2368
  }), (c) => {
2335
2369
  for (const a of l)
2336
2370
  a.dispose();
2337
2371
  l.length = 0, r.dispose();
2338
- for (const a of o)
2372
+ for (const a of i)
2339
2373
  a(c);
2340
- o.length = 0, i.clear(c);
2374
+ i.length = 0, o.clear(c);
2341
2375
  };
2342
2376
  };
2343
2377
  {
2344
2378
  const n = K(t);
2345
2379
  return E(
2346
- ...Array.from({ length: t }, (r, i) => i).map((r) => {
2347
- const i = new le(r, n);
2348
- return f(e(i));
2380
+ ...Array.from({ length: t }, (r, o) => o).map((r) => {
2381
+ const o = new le(r, n);
2382
+ return f(e(o));
2349
2383
  })
2350
2384
  );
2351
2385
  }
2352
2386
  }, Fs = (t, e, s) => {
2353
- const n = y.map(t, (i) => i.length), r = y.toSignal(t);
2387
+ const n = y.map(t, (o) => o.length), r = y.toSignal(t);
2354
2388
  return Be(
2355
2389
  n,
2356
- (i) => {
2357
- const o = r.map((l) => l[i.index]);
2358
- return f(e(o, i));
2390
+ (o) => {
2391
+ const i = r.map((l) => l[o.index]);
2392
+ return f(e(i, o));
2359
2393
  },
2360
2394
  s
2361
2395
  );
@@ -2367,13 +2401,13 @@ const Dt = /* @__PURE__ */ new Set([
2367
2401
  return (n) => {
2368
2402
  n = n.makeRef();
2369
2403
  const r = s.map((l) => f(e(l)));
2370
- let i = () => {
2404
+ let o = () => {
2371
2405
  };
2372
- const o = r.on((l) => {
2373
- i(!0), i = l(n);
2406
+ const i = r.on((l) => {
2407
+ o(!0), o = l(n);
2374
2408
  });
2375
2409
  return (l) => {
2376
- o(), i(l);
2410
+ i(), o(l);
2377
2411
  };
2378
2412
  };
2379
2413
  }
@@ -2388,7 +2422,7 @@ const Dt = /* @__PURE__ */ new Set([
2388
2422
  whenEmpty: () => s()
2389
2423
  }
2390
2424
  ), Us = (t, e) => (s) => {
2391
- const n = s.makePortal(t), r = he(f(e), n);
2425
+ const n = s.makePortal(t), r = fe(f(e), n);
2392
2426
  return () => r(!0);
2393
2427
  }, W = /* @__PURE__ */ new Map(), Jt = (t) => ({
2394
2428
  mark: at(`Probe(${t.description})`),
@@ -2399,15 +2433,15 @@ const Dt = /* @__PURE__ */ new Set([
2399
2433
  };
2400
2434
  if (W.has(t))
2401
2435
  throw new Error(`Probe already exists: ${t.description}`);
2402
- const r = setTimeout(() => n("timeout"), s), i = { counter: 0, timeoutId: r };
2403
- return W.set(t, i), {
2436
+ const r = setTimeout(() => n("timeout"), s), o = { counter: 0, timeoutId: r };
2437
+ return W.set(t, o), {
2404
2438
  value: () => {
2405
2439
  clearTimeout(r);
2406
2440
  const l = W.get(t);
2407
2441
  l != null && --l.counter === 0 && n("resolved");
2408
2442
  },
2409
2443
  dispose: () => n("disposed"),
2410
- onUse: () => i.counter++
2444
+ onUse: () => o.counter++
2411
2445
  };
2412
2446
  }
2413
2447
  }), Gs = Jt(Symbol("GlobalProbe")), Xt = (t, e) => (s) => {
@@ -2416,11 +2450,11 @@ const Dt = /* @__PURE__ */ new Set([
2416
2450
  r && s.setStyle(t, n);
2417
2451
  };
2418
2452
  }, Yt = (t, e) => (s) => {
2419
- const n = s.getStyle(t), r = e.on((i) => s.setStyle(t, i));
2420
- return (i) => {
2421
- r(), i && s.setStyle(t, n);
2453
+ const n = s.getStyle(t), r = e.on((o) => s.setStyle(t, o));
2454
+ return (o) => {
2455
+ r(), o && s.setStyle(t, n);
2422
2456
  };
2423
- }, me = (t, e) => g.is(e) ? Yt(t, e) : Xt(t, e), Js = new Proxy({}, {
2457
+ }, ye = (t, e) => g.is(e) ? Yt(t, e) : Xt(t, e), Js = new Proxy({}, {
2424
2458
  /**
2425
2459
  * Creates a renderable component for the specified `style` property.
2426
2460
  *
@@ -2429,7 +2463,7 @@ const Dt = /* @__PURE__ */ new Set([
2429
2463
  * @returns The renderable component for the specified attribute.
2430
2464
  *
2431
2465
  */
2432
- get: (t, e) => e === "variable" ? (s, n) => me(s, n) : (s) => me(e, s)
2466
+ get: (t, e) => e === "variable" ? (s, n) => ye(s, n) : (s) => ye(e, s)
2433
2467
  }), Qt = (t) => (e) => {
2434
2468
  if (e.isBrowser()) {
2435
2469
  const s = t(e);
@@ -2451,11 +2485,11 @@ const Dt = /* @__PURE__ */ new Set([
2451
2485
  return () => {
2452
2486
  };
2453
2487
  }, Zs = (t) => (e) => {
2454
- const s = new j(), n = L(s, () => f(t(s))(e));
2488
+ const s = new j(), n = x(s, () => f(t(s))(e));
2455
2489
  return (r) => {
2456
2490
  s.dispose(), n(r);
2457
2491
  };
2458
- }, de = (t) => (e) => {
2492
+ }, pe = (t) => (e) => {
2459
2493
  let s = e;
2460
2494
  function n() {
2461
2495
  return s;
@@ -2463,22 +2497,22 @@ const Dt = /* @__PURE__ */ new Set([
2463
2497
  function r(l) {
2464
2498
  s = l;
2465
2499
  }
2466
- const i = [], o = t({
2500
+ const o = [], i = t({
2467
2501
  use: ({ mark: l }) => {
2468
2502
  const { value: c, onUse: a } = n().getProvider(l);
2469
2503
  return a?.(), c;
2470
2504
  },
2471
2505
  set: ({ mark: l, create: c }, a) => {
2472
2506
  const { value: u, dispose: h, onUse: p } = c(a, n());
2473
- i.push(h), r(n().setProvider(l, u, p));
2507
+ o.push(h), r(n().setProvider(l, u, p));
2474
2508
  }
2475
2509
  });
2476
- return o == null ? () => {
2510
+ return i == null ? () => {
2477
2511
  } : E(
2478
- f(o),
2479
- Gt(() => i.forEach((l) => l()))
2512
+ f(i),
2513
+ Gt(() => o.forEach((l) => l()))
2480
2514
  )(n());
2481
- }, zs = (t, e, s) => de(({ set: n }) => (n(t, e), s())), Ks = (t, e) => de(({ use: s }) => e(s(t))), en = (...t) => (e) => de(({ use: s }) => {
2515
+ }, zs = (t, e, s) => pe(({ set: n }) => (n(t, e), s())), Ks = (t, e) => pe(({ use: s }) => e(s(t))), en = (...t) => (e) => pe(({ use: s }) => {
2482
2516
  const n = t.map(s);
2483
2517
  return e(...n);
2484
2518
  });
@@ -2487,8 +2521,8 @@ export {
2487
2521
  Es as Async,
2488
2522
  kt as Attr,
2489
2523
  ks as BindChecked,
2490
- xs as BindDate,
2491
- Ls as BindDateTime,
2524
+ Ps as BindDate,
2525
+ xs as BindDateTime,
2492
2526
  Os as BindNumber,
2493
2527
  Ms as BindText,
2494
2528
  $ as BrowserContext,
@@ -2528,7 +2562,7 @@ export {
2528
2562
  Us as Portal,
2529
2563
  Z as Prop,
2530
2564
  zs as Provide,
2531
- Pe as ProviderNotFoundError,
2565
+ Le as ProviderNotFoundError,
2532
2566
  ut as RenderingError,
2533
2567
  Be as Repeat,
2534
2568
  Nt as SVGAttr,
@@ -2545,13 +2579,13 @@ export {
2545
2579
  Xs as WithCtx,
2546
2580
  Ys as WithElement,
2547
2581
  Qs as WithHeadlessCtx,
2548
- de as WithProvider,
2582
+ pe as WithProvider,
2549
2583
  Zs as WithScope,
2550
- xe as _NODE_PLACEHOLDER_ATTR,
2584
+ Pe as _NODE_PLACEHOLDER_ATTR,
2551
2585
  ct as _getSelfOrParentElement,
2552
2586
  De as _isElement,
2553
2587
  lt as _makeGetter,
2554
- ot as _makeSetter,
2588
+ it as _makeSetter,
2555
2589
  U as _removeDOMNode,
2556
2590
  He as _signalText,
2557
2591
  Ie as _staticText,
@@ -2563,13 +2597,13 @@ export {
2563
2597
  as as coalesce,
2564
2598
  z as computed,
2565
2599
  ee as computedOf,
2566
- it as computedRecord,
2600
+ ot as computedRecord,
2567
2601
  gs as dataAttr,
2568
- is as delaySignal,
2602
+ os as delaySignal,
2569
2603
  Se as effect,
2570
2604
  Qe as effectOf,
2571
2605
  Vt as emit,
2572
- Ps as emitChecked,
2606
+ Ls as emitChecked,
2573
2607
  O as emitTarget,
2574
2608
  jt as emitValue,
2575
2609
  Ft as emitValueAsDate,
@@ -2578,10 +2612,10 @@ export {
2578
2612
  Ds as emitValueAsNullableDateTime,
2579
2613
  qt as emitValueAsNumber,
2580
2614
  et as endInterpolate,
2581
- ye as getCurrentScope,
2615
+ ue as getCurrentScope,
2582
2616
  zt as getParentScope,
2583
2617
  Zt as getScopeStack,
2584
- ue as getWindow,
2618
+ he as getWindow,
2585
2619
  tt as guessInterpolate,
2586
2620
  ws as html,
2587
2621
  bs as input,
@@ -2597,11 +2631,11 @@ export {
2597
2631
  rs as merge,
2598
2632
  se as on,
2599
2633
  Ue as popScope,
2600
- os as previousSignal,
2634
+ is as previousSignal,
2601
2635
  T as prop,
2602
2636
  We as pushScope,
2603
2637
  us as render,
2604
- he as renderWithContext,
2638
+ fe as renderWithContext,
2605
2639
  f as renderableOfTNode,
2606
2640
  ds as restoreTempoPlaceholders,
2607
2641
  hs as runHeadless,
@@ -2614,6 +2648,6 @@ export {
2614
2648
  Js as style,
2615
2649
  vs as svg,
2616
2650
  ys as svgAttr,
2617
- oe as untracked,
2618
- L as withScope
2651
+ ie as untracked,
2652
+ x as withScope
2619
2653
  };