@tempots/dom 31.6.1 → 33.0.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/README.md +6 -1
- package/index.cjs +1 -1
- package/index.d.ts +3 -0
- package/index.js +1072 -815
- package/package.json +1 -1
- package/renderable/attribute.d.ts +97 -8
- package/renderable/element.d.ts +18 -0
- package/renderable/render.d.ts +4 -0
- package/renderable/utils.d.ts +1 -0
- package/renderable/with-scope.d.ts +39 -0
- package/std/disposal-scope.d.ts +97 -0
- package/std/element-position.d.ts +8 -0
- package/std/scope-stack.d.ts +76 -0
- package/std/signal.d.ts +49 -3
- package/std/value.d.ts +8 -0
package/index.js
CHANGED
|
@@ -1,56 +1,33 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
const _ = [], We = (t) => {
|
|
2
|
+
_.push(t);
|
|
3
|
+
}, Ue = () => {
|
|
4
|
+
if (_.length === 0)
|
|
5
|
+
throw new Error("Cannot pop from empty scope stack");
|
|
6
|
+
_.pop();
|
|
7
|
+
}, ye = () => _[_.length - 1] ?? null, Zt = () => _, zt = () => _[_.length - 2] ?? null, L = (t, e) => {
|
|
8
|
+
We(t);
|
|
9
|
+
try {
|
|
10
|
+
return e();
|
|
11
|
+
} finally {
|
|
12
|
+
Ue();
|
|
10
13
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* @param total - The total number of elements in the collection.
|
|
18
|
-
*/
|
|
19
|
-
constructor(e, s) {
|
|
20
|
-
this.index = e, this.total = s, this.counter = e + 1, this.isFirst = e === 0, this.isEven = e % 2 === 1, this.isOdd = e % 2 === 0;
|
|
14
|
+
}, Kt = (t) => {
|
|
15
|
+
const e = new j();
|
|
16
|
+
try {
|
|
17
|
+
return L(e, () => t(e));
|
|
18
|
+
} finally {
|
|
19
|
+
e.dispose();
|
|
21
20
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*/
|
|
30
|
-
isFirst;
|
|
31
|
-
/**
|
|
32
|
-
* Checks if the counter of the element is even.
|
|
33
|
-
* @returns `true` if the counter is even, `false` otherwise.
|
|
34
|
-
*/
|
|
35
|
-
isEven;
|
|
36
|
-
/**
|
|
37
|
-
* Checks if the counter of the element is odd.
|
|
38
|
-
* @returns `true` if the counter is odd, `false` otherwise.
|
|
39
|
-
*/
|
|
40
|
-
isOdd;
|
|
41
|
-
#e;
|
|
42
|
-
/**
|
|
43
|
-
* Checks if the element is the last element in the collection.
|
|
44
|
-
* @returns `true` if the element is the last element, `false` otherwise.
|
|
45
|
-
*/
|
|
46
|
-
get isLast() {
|
|
47
|
-
return this.#e == null && (this.#e = this.total.map((e) => this.counter === e)), this.#e;
|
|
21
|
+
}, oe = (t) => {
|
|
22
|
+
const e = _.slice();
|
|
23
|
+
_.length = 0;
|
|
24
|
+
try {
|
|
25
|
+
return t();
|
|
26
|
+
} finally {
|
|
27
|
+
_.length = 0, _.push(...e);
|
|
48
28
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
class m {
|
|
29
|
+
};
|
|
30
|
+
class g {
|
|
54
31
|
/**
|
|
55
32
|
* Represents a signal with a value of type T.
|
|
56
33
|
*
|
|
@@ -102,10 +79,10 @@ class m {
|
|
|
102
79
|
* @param equals - Function to compare two values for equality (defaults to strict equality)
|
|
103
80
|
* @returns A Signal that represents the result of the Promise
|
|
104
81
|
*/
|
|
105
|
-
static ofPromise = (e, s,
|
|
106
|
-
const i = new
|
|
82
|
+
static ofPromise = (e, s, n, r = (i, o) => i === o) => {
|
|
83
|
+
const i = new g(s, r);
|
|
107
84
|
return e.then((o) => i._setAndNotify(o)).catch((o) => {
|
|
108
|
-
|
|
85
|
+
n != null ? i._setAndNotify(n(o)) : console.error(
|
|
109
86
|
"Unhandled promise rejection in Signal.ofPromise:",
|
|
110
87
|
o
|
|
111
88
|
);
|
|
@@ -168,17 +145,32 @@ class m {
|
|
|
168
145
|
*/
|
|
169
146
|
on = (e, s = {}) => {
|
|
170
147
|
s.skipInitial || e(this.get(), void 0);
|
|
171
|
-
const
|
|
172
|
-
|
|
148
|
+
const n = s.once ? (i, o) => {
|
|
149
|
+
r(), e(i, o);
|
|
173
150
|
} : e;
|
|
174
|
-
this._onValueListeners.push(
|
|
175
|
-
const
|
|
151
|
+
this._onValueListeners.push(n);
|
|
152
|
+
const r = () => {
|
|
176
153
|
this._onValueListeners.splice(
|
|
177
|
-
this._onValueListeners.indexOf(
|
|
154
|
+
this._onValueListeners.indexOf(n),
|
|
178
155
|
1
|
|
179
|
-
), s.abortSignal != null && s.abortSignal.removeEventListener("abort",
|
|
156
|
+
), s.abortSignal != null && s.abortSignal.removeEventListener("abort", r);
|
|
157
|
+
};
|
|
158
|
+
return s.abortSignal != null && s.abortSignal.addEventListener("abort", r), r;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Registers a listener function to be called whenever the value of the signal changes.
|
|
162
|
+
* The listener function will not be called with the current value of the signal.
|
|
163
|
+
* Returns a function that can be called to unregister the listener.
|
|
164
|
+
*
|
|
165
|
+
* @param listener - The listener function to be called when the value of the signal changes.
|
|
166
|
+
* @param options - Options for the listener.
|
|
167
|
+
*/
|
|
168
|
+
onChange = (e, s = {}) => {
|
|
169
|
+
let n = 0;
|
|
170
|
+
const r = (i, o) => {
|
|
171
|
+
n++ > 0 && e(i, o);
|
|
180
172
|
};
|
|
181
|
-
return
|
|
173
|
+
return this.on(r, s);
|
|
182
174
|
};
|
|
183
175
|
/**
|
|
184
176
|
* @internal
|
|
@@ -186,7 +178,7 @@ class m {
|
|
|
186
178
|
_setAndNotify = (e) => {
|
|
187
179
|
if (this._disposed) return;
|
|
188
180
|
const s = this._value;
|
|
189
|
-
this.equals(s, e) || (this._value = e, this._onValueListeners.forEach((
|
|
181
|
+
this.equals(s, e) || (this._value = e, this._onValueListeners.forEach((r) => r(e, s)));
|
|
190
182
|
};
|
|
191
183
|
/**
|
|
192
184
|
* @internal
|
|
@@ -256,20 +248,32 @@ class m {
|
|
|
256
248
|
* )
|
|
257
249
|
* ```
|
|
258
250
|
*
|
|
251
|
+
* **Auto-Disposal:** The returned computed signal is automatically registered with the current
|
|
252
|
+
* disposal scope (if one exists). When used within a renderable or `WithScope()`, the signal
|
|
253
|
+
* will be automatically disposed when the component unmounts. No manual `OnDispose()` needed!
|
|
254
|
+
*
|
|
255
|
+
* ```typescript
|
|
256
|
+
* const MyComponent: Renderable = (ctx) => {
|
|
257
|
+
* const count = prop(0);
|
|
258
|
+
* const doubled = count.map(x => x * 2); // ✅ Auto-disposed
|
|
259
|
+
* return html.div(doubled);
|
|
260
|
+
* };
|
|
261
|
+
* ```
|
|
262
|
+
*
|
|
259
263
|
* @typeParam O - The type of the transformed value
|
|
260
264
|
* @param fn - Function that transforms the signal's value to a new value
|
|
261
265
|
* @param equals - Optional function to determine if two transformed values are equal (defaults to strict equality)
|
|
262
|
-
* @returns A new computed signal with the transformed value
|
|
266
|
+
* @returns A new computed signal with the transformed value (auto-registered with current scope)
|
|
263
267
|
*/
|
|
264
|
-
map = (e, s = (
|
|
265
|
-
const
|
|
268
|
+
map = (e, s = (n, r) => n === r) => {
|
|
269
|
+
const n = new N(() => {
|
|
266
270
|
try {
|
|
267
271
|
return e(this.get());
|
|
268
|
-
} catch (
|
|
269
|
-
throw console.error("Error in Signal.map:",
|
|
272
|
+
} catch (r) {
|
|
273
|
+
throw console.error("Error in Signal.map:", r), r;
|
|
270
274
|
}
|
|
271
275
|
}, s);
|
|
272
|
-
return this.setDerivative(
|
|
276
|
+
return this.setDerivative(n), n;
|
|
273
277
|
};
|
|
274
278
|
/**
|
|
275
279
|
* Returns a new Signal that applies the given function to the value of the current Signal,
|
|
@@ -281,15 +285,15 @@ class m {
|
|
|
281
285
|
* Defaults to a strict equality check (===).
|
|
282
286
|
* @returns A new Signal that emits the values of the resulting Signal.
|
|
283
287
|
*/
|
|
284
|
-
flatMap = (e, s = (
|
|
285
|
-
const
|
|
288
|
+
flatMap = (e, s = (n, r) => n === r) => {
|
|
289
|
+
const n = new N(() => {
|
|
286
290
|
try {
|
|
287
291
|
return e(this.get()).get();
|
|
288
|
-
} catch (
|
|
289
|
-
throw console.error("Error in Signal.flatMap:",
|
|
292
|
+
} catch (r) {
|
|
293
|
+
throw console.error("Error in Signal.flatMap:", r), r;
|
|
290
294
|
}
|
|
291
295
|
}, s);
|
|
292
|
-
return this.setDerivative(
|
|
296
|
+
return this.setDerivative(n), n;
|
|
293
297
|
};
|
|
294
298
|
/**
|
|
295
299
|
* Invokes a callback function with the current value of the signal, without modifying the signal.
|
|
@@ -319,16 +323,16 @@ class m {
|
|
|
319
323
|
});
|
|
320
324
|
}
|
|
321
325
|
filter = (e, s) => {
|
|
322
|
-
let
|
|
323
|
-
const
|
|
326
|
+
let n = s ?? this.get();
|
|
327
|
+
const r = new N(() => {
|
|
324
328
|
try {
|
|
325
329
|
const i = this.get();
|
|
326
|
-
return
|
|
330
|
+
return n = e(i) ? i : n;
|
|
327
331
|
} catch (i) {
|
|
328
332
|
throw console.error("Error in Signal.filter:", i), i;
|
|
329
333
|
}
|
|
330
334
|
}, this.equals);
|
|
331
|
-
return this.setDerivative(
|
|
335
|
+
return this.setDerivative(r), r;
|
|
332
336
|
};
|
|
333
337
|
/**
|
|
334
338
|
* Returns a new Computed object that applies the provided mapping function to the value of this Signal,
|
|
@@ -340,16 +344,16 @@ class m {
|
|
|
340
344
|
* @param equals - Optional equality function to determine if two values are equal.
|
|
341
345
|
* @returns - A new Computed object with the mapped and filtered values.
|
|
342
346
|
*/
|
|
343
|
-
filterMap = (e, s,
|
|
344
|
-
let
|
|
345
|
-
const i = new
|
|
347
|
+
filterMap = (e, s, n = (r, i) => r === i) => {
|
|
348
|
+
let r = s;
|
|
349
|
+
const i = new N(() => {
|
|
346
350
|
try {
|
|
347
351
|
const o = this.get(), l = e(o);
|
|
348
|
-
return
|
|
352
|
+
return r = l ?? r;
|
|
349
353
|
} catch (o) {
|
|
350
354
|
throw console.error("Error in Signal.filterMap:", o), o;
|
|
351
355
|
}
|
|
352
|
-
},
|
|
356
|
+
}, n);
|
|
353
357
|
return this.setDerivative(i), i;
|
|
354
358
|
};
|
|
355
359
|
/**
|
|
@@ -365,8 +369,8 @@ class m {
|
|
|
365
369
|
* @param equals - The equality function to compare the mapped values for equality.
|
|
366
370
|
* @returns A property that holds the mapped value and can be observed for changes.
|
|
367
371
|
*/
|
|
368
|
-
mapAsync = (e, s,
|
|
369
|
-
const i =
|
|
372
|
+
mapAsync = (e, s, n, r = (i, o) => i === o) => {
|
|
373
|
+
const i = T(s, r);
|
|
370
374
|
let o = 0, l = new AbortController();
|
|
371
375
|
return i.onDispose(
|
|
372
376
|
this.on(async (c) => {
|
|
@@ -377,8 +381,8 @@ class m {
|
|
|
377
381
|
a === o && i.set(u);
|
|
378
382
|
} catch (u) {
|
|
379
383
|
if (a === o)
|
|
380
|
-
if (
|
|
381
|
-
i.set(
|
|
384
|
+
if (n != null)
|
|
385
|
+
i.set(n(u));
|
|
382
386
|
else
|
|
383
387
|
throw u;
|
|
384
388
|
}
|
|
@@ -395,7 +399,7 @@ class m {
|
|
|
395
399
|
* @param alt - The alternative value to use when the mapped value is `undefined` or `null`.
|
|
396
400
|
* @returns A new signal containing the mapped values.
|
|
397
401
|
*/
|
|
398
|
-
mapMaybe = (e, s) => this.map((
|
|
402
|
+
mapMaybe = (e, s) => this.map((n) => e(n) ?? s);
|
|
399
403
|
/**
|
|
400
404
|
* Feeds a property into the signal and sets up disposal behavior.
|
|
401
405
|
* @param prop - The property to feed into the signal.
|
|
@@ -403,8 +407,8 @@ class m {
|
|
|
403
407
|
* @returns The input property.
|
|
404
408
|
*/
|
|
405
409
|
feedProp = (e, s = !1) => {
|
|
406
|
-
const
|
|
407
|
-
return e.onDispose(
|
|
410
|
+
const n = this.on(e.set);
|
|
411
|
+
return e.onDispose(n), s ? this.onDispose(e.dispose) : this.onDispose(n), e;
|
|
408
412
|
};
|
|
409
413
|
/**
|
|
410
414
|
* Derives a new property from the current signal.
|
|
@@ -416,7 +420,7 @@ class m {
|
|
|
416
420
|
deriveProp = ({
|
|
417
421
|
autoDisposeProp: e = !0,
|
|
418
422
|
equals: s
|
|
419
|
-
} = {}) => this.feedProp(
|
|
423
|
+
} = {}) => this.feedProp(T(this.get(), s), e);
|
|
420
424
|
/**
|
|
421
425
|
* Derives a new signal from the current signal. Useful to create a new signal that emits the same values as the current signal but can be disposed independently.
|
|
422
426
|
* @returns A new signal that emits the same values as the current signal.
|
|
@@ -445,15 +449,36 @@ class m {
|
|
|
445
449
|
}), e.onDispose(this.on(e.setDirty)), this.onDispose(e.dispose);
|
|
446
450
|
};
|
|
447
451
|
}
|
|
448
|
-
const
|
|
449
|
-
class
|
|
452
|
+
const Ge = typeof queueMicrotask == "function" ? queueMicrotask : (t) => Promise.resolve().then(t);
|
|
453
|
+
class N extends g {
|
|
450
454
|
/**
|
|
451
|
-
*
|
|
452
|
-
*
|
|
455
|
+
* Creates a new Computed signal.
|
|
456
|
+
*
|
|
457
|
+
* **Auto-Registration:** This constructor automatically registers the signal with the current
|
|
458
|
+
* disposal scope (if one exists). This ensures that computed signals created by methods like
|
|
459
|
+
* `.map()`, `.flatMap()`, `.filter()`, etc. are automatically tracked and disposed.
|
|
460
|
+
*
|
|
461
|
+
* When a computed signal is created within a renderable or `WithScope()`, it will be
|
|
462
|
+
* automatically disposed when the component unmounts or the scope is disposed.
|
|
463
|
+
*
|
|
464
|
+
* To create a computed signal that outlives the current scope, use `untracked()`:
|
|
465
|
+
* ```typescript
|
|
466
|
+
* const globalSignal = untracked(() => mySignal.map(x => x * 2));
|
|
467
|
+
* // Remember to dispose manually: globalSignal.dispose()
|
|
468
|
+
* ```
|
|
469
|
+
*
|
|
470
|
+
* @param _fn - The function that computes the value of the signal.
|
|
453
471
|
* @param equals - The function used to compare two values of type T for equality.
|
|
472
|
+
*
|
|
473
|
+
* @see {@link computed} - Factory function for creating computed signals with explicit dependencies
|
|
474
|
+
* @see {@link Signal.map} - Creates a computed signal by transforming values
|
|
475
|
+
* @see {@link getCurrentScope} - Get the current disposal scope
|
|
476
|
+
* @see {@link untracked} - Create signals outside of scope tracking
|
|
454
477
|
*/
|
|
455
478
|
constructor(e, s) {
|
|
456
479
|
super(void 0, s), this._fn = e, this.setDirty();
|
|
480
|
+
const n = ye();
|
|
481
|
+
n?.track(this);
|
|
457
482
|
}
|
|
458
483
|
/**
|
|
459
484
|
* Checks if a value is an instance of `Computed`.
|
|
@@ -491,7 +516,7 @@ class H extends m {
|
|
|
491
516
|
*/
|
|
492
517
|
_scheduleNotify = () => {
|
|
493
518
|
const e = ++this._scheduleCount;
|
|
494
|
-
|
|
519
|
+
Ge(() => {
|
|
495
520
|
this._scheduleCount !== e || this._disposed || this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn()));
|
|
496
521
|
});
|
|
497
522
|
};
|
|
@@ -501,8 +526,16 @@ class H extends m {
|
|
|
501
526
|
get value() {
|
|
502
527
|
return this.get();
|
|
503
528
|
}
|
|
529
|
+
/**
|
|
530
|
+
* Disposes the computed signal and cancels any pending recomputations.
|
|
531
|
+
* This override increments the schedule count to invalidate all pending
|
|
532
|
+
* microtasks before disposing the signal.
|
|
533
|
+
*/
|
|
534
|
+
dispose = () => {
|
|
535
|
+
this._disposed || (this._scheduleCount++, this._disposed = !0, this._onDisposeListeners.forEach((e) => e()), this._onDisposeListeners.length = 0, this._derivatives.length = 0);
|
|
536
|
+
};
|
|
504
537
|
}
|
|
505
|
-
class
|
|
538
|
+
class Z extends g {
|
|
506
539
|
/**
|
|
507
540
|
* Checks if a value is a Prop.
|
|
508
541
|
* @param value - The value to check.
|
|
@@ -538,15 +571,15 @@ class Y extends m {
|
|
|
538
571
|
* @returns A dispatch function that can be used to update the state and trigger the effects.
|
|
539
572
|
*/
|
|
540
573
|
reducer = (e, ...s) => {
|
|
541
|
-
const
|
|
542
|
-
return function
|
|
543
|
-
const o =
|
|
544
|
-
|
|
574
|
+
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(
|
|
545
578
|
(l) => l({
|
|
546
579
|
previousState: o,
|
|
547
|
-
state:
|
|
580
|
+
state: n.value,
|
|
548
581
|
action: i,
|
|
549
|
-
dispatch:
|
|
582
|
+
dispatch: r
|
|
550
583
|
})
|
|
551
584
|
);
|
|
552
585
|
};
|
|
@@ -562,9 +595,9 @@ class Y extends m {
|
|
|
562
595
|
* Defaults to a strict equality check (===).
|
|
563
596
|
* @returns A Prop object representing the isomorphism.
|
|
564
597
|
*/
|
|
565
|
-
iso = (e, s,
|
|
566
|
-
const
|
|
567
|
-
return
|
|
598
|
+
iso = (e, s, n = (r, i) => r === i) => {
|
|
599
|
+
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;
|
|
568
601
|
};
|
|
569
602
|
/**
|
|
570
603
|
* Returns a `Prop` that represents the value at the specified key of the current value.
|
|
@@ -586,38 +619,38 @@ class Y extends m {
|
|
|
586
619
|
this._setAndNotify(e);
|
|
587
620
|
}
|
|
588
621
|
}
|
|
589
|
-
const
|
|
590
|
-
const
|
|
591
|
-
return e.forEach((
|
|
592
|
-
},
|
|
593
|
-
let
|
|
622
|
+
const z = (t, e, s = (n, r) => n === r) => {
|
|
623
|
+
const n = new N(t, s);
|
|
624
|
+
return e.forEach((r) => r.setDerivative(n)), n;
|
|
625
|
+
}, Se = (t, e, s = {}) => {
|
|
626
|
+
let n = s.once ? () => {
|
|
594
627
|
i(), t();
|
|
595
628
|
} : t;
|
|
596
629
|
if (s.skipInitial) {
|
|
597
630
|
let o = !1;
|
|
598
|
-
const l =
|
|
599
|
-
|
|
631
|
+
const l = n;
|
|
632
|
+
n = () => {
|
|
600
633
|
o ? l() : o = !0;
|
|
601
634
|
};
|
|
602
635
|
}
|
|
603
|
-
const
|
|
604
|
-
|
|
636
|
+
const r = z(n, e), i = () => {
|
|
637
|
+
r.dispose(), s.abortSignal != null && s.abortSignal.removeEventListener("abort", i);
|
|
605
638
|
};
|
|
606
639
|
return s.abortSignal != null && s.abortSignal.addEventListener("abort", i), i;
|
|
607
|
-
},
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
);
|
|
611
|
-
function
|
|
640
|
+
}, T = (t, e = (s, n) => s === n) => {
|
|
641
|
+
const s = new Z(t, e), n = ye();
|
|
642
|
+
return n?.track(s), s;
|
|
643
|
+
}, K = (t, e = (s, n) => s === n) => new g(t, e);
|
|
644
|
+
function we(t) {
|
|
612
645
|
return t != null && t !== !1 && t !== 0 && t !== "";
|
|
613
646
|
}
|
|
614
|
-
function
|
|
615
|
-
return !
|
|
647
|
+
function Je(t) {
|
|
648
|
+
return !we(t);
|
|
616
649
|
}
|
|
617
|
-
function
|
|
650
|
+
function Xe(t) {
|
|
618
651
|
return t == null;
|
|
619
652
|
}
|
|
620
|
-
function
|
|
653
|
+
function Ye(t) {
|
|
621
654
|
return t != null;
|
|
622
655
|
}
|
|
623
656
|
const y = {
|
|
@@ -632,7 +665,7 @@ const y = {
|
|
|
632
665
|
* @param fn - The function to map the value.
|
|
633
666
|
* @returns The mapped value.
|
|
634
667
|
*/
|
|
635
|
-
map: (t, e) =>
|
|
668
|
+
map: (t, e) => g.is(t) ? t.map(e) : e(t),
|
|
636
669
|
/**
|
|
637
670
|
* Wraps a value or a Signal instance into a Signal.
|
|
638
671
|
* If the value is already a Signal, it returns the value itself.
|
|
@@ -643,7 +676,7 @@ const y = {
|
|
|
643
676
|
* @param equals - A function that determines if two values are equal. Defaults to strict equality (===).
|
|
644
677
|
* @returns A Signal instance.
|
|
645
678
|
*/
|
|
646
|
-
toSignal: (t, e) =>
|
|
679
|
+
toSignal: (t, e) => g.is(t) ? t.derive() : K(t, e),
|
|
647
680
|
/**
|
|
648
681
|
* Wraps a value in a `Signal` if it is not already a `Signal`.
|
|
649
682
|
* If the value is `null` or `undefined`, it returns `null` or `undefined` respectively.
|
|
@@ -659,14 +692,14 @@ const y = {
|
|
|
659
692
|
* @param value - The value or Signal instance to get the value from.
|
|
660
693
|
* @returns The value.
|
|
661
694
|
*/
|
|
662
|
-
get: (t) =>
|
|
695
|
+
get: (t) => g.is(t) ? t.get() : t,
|
|
663
696
|
/**
|
|
664
697
|
* Adds a listener to a `Signal` or calls the listener immediately if it is not a `Signal`.
|
|
665
698
|
* @param value - The value or Signal instance to add the listener to.
|
|
666
699
|
* @param listener - The listener to call when the value changes.
|
|
667
700
|
* @returns A function to remove the listener.
|
|
668
701
|
*/
|
|
669
|
-
on: (t, e) =>
|
|
702
|
+
on: (t, e) => g.is(t) ? t.on(e) : (e(t), () => {
|
|
670
703
|
}),
|
|
671
704
|
/**
|
|
672
705
|
* Disposes of a value or a Signal.
|
|
@@ -675,8 +708,16 @@ const y = {
|
|
|
675
708
|
* @param value - The value or Signal instance to dispose of.
|
|
676
709
|
*/
|
|
677
710
|
dispose: (t) => {
|
|
678
|
-
|
|
711
|
+
g.is(t) && t.dispose();
|
|
679
712
|
},
|
|
713
|
+
/**
|
|
714
|
+
* Returns a function that disposes of a value or a Signal.
|
|
715
|
+
* If the value is a Signal, it returns a function that disposes of the Signal.
|
|
716
|
+
* If the value is not a Signal, it returns a function that does nothing.
|
|
717
|
+
* @param value - The value or Signal instance to dispose of.
|
|
718
|
+
* @returns A function to dispose of the value or Signal.
|
|
719
|
+
*/
|
|
720
|
+
disposeFn: (t) => () => y.dispose(t),
|
|
680
721
|
/**
|
|
681
722
|
* Derives a Prop from a Signal.
|
|
682
723
|
* If the value is a Signal, it returns a new Prop with the derived value.
|
|
@@ -690,54 +731,246 @@ const y = {
|
|
|
690
731
|
deriveProp: (t, {
|
|
691
732
|
autoDisposeProp: e = !0,
|
|
692
733
|
equals: s
|
|
693
|
-
} = {}) =>
|
|
734
|
+
} = {}) => g.is(t) ? t.deriveProp({ autoDisposeProp: e, equals: s }) : T(t, s),
|
|
694
735
|
/**
|
|
695
736
|
* Creates a new signal that emits `true` if the value is truthy, `false` otherwise.
|
|
696
737
|
* @param value - The value or signal to check.
|
|
697
738
|
* @returns A signal that emits `true` if the value is truthy, `false` otherwise.
|
|
698
739
|
*/
|
|
699
|
-
truthy: (t) => y.map(t,
|
|
740
|
+
truthy: (t) => y.map(t, we),
|
|
700
741
|
/**
|
|
701
742
|
* Creates a new signal that emits `true` if the value is falsy, `false` otherwise.
|
|
702
743
|
* @param value - The value or signal to check.
|
|
703
744
|
* @returns A signal that emits `true` if the value is falsy, `false` otherwise.
|
|
704
745
|
*/
|
|
705
|
-
falsy: (t) => y.map(t,
|
|
746
|
+
falsy: (t) => y.map(t, Je),
|
|
706
747
|
/**
|
|
707
748
|
* Creates a new signal that emits `true` if the value is null or undefined, `false` otherwise.
|
|
708
749
|
* @param value - The value or signal to check.
|
|
709
750
|
* @returns A signal that emits `true` if the value is null or undefined, `false` otherwise.
|
|
710
751
|
*/
|
|
711
|
-
nil: (t) => y.map(t,
|
|
752
|
+
nil: (t) => y.map(t, Xe),
|
|
712
753
|
/**
|
|
713
754
|
* Creates a new signal that emits `true` if the value is not null or undefined, `false` otherwise.
|
|
714
755
|
* @param value - The value or signal to check.
|
|
715
756
|
* @returns A signal that emits `true` if the value is not null or undefined, `false` otherwise.
|
|
716
757
|
*/
|
|
717
|
-
defined: (t) => y.map(t,
|
|
718
|
-
},
|
|
758
|
+
defined: (t) => y.map(t, Ye)
|
|
759
|
+
}, ee = (...t) => (e, s) => {
|
|
719
760
|
if (t.length === 1)
|
|
720
761
|
return y.toSignal(t[0]).map(e);
|
|
721
|
-
const
|
|
722
|
-
return
|
|
723
|
-
() => e(...t.map((
|
|
724
|
-
|
|
762
|
+
const n = t.filter((r) => g.is(r));
|
|
763
|
+
return z(
|
|
764
|
+
() => e(...t.map((r) => y.get(r))),
|
|
765
|
+
n,
|
|
725
766
|
s
|
|
726
767
|
);
|
|
727
|
-
},
|
|
768
|
+
}, es = (t) => {
|
|
728
769
|
const e = Object.keys(t);
|
|
729
|
-
return
|
|
730
|
-
(...s) => Object.fromEntries(e.map((
|
|
770
|
+
return ee(...Object.values(t))(
|
|
771
|
+
(...s) => Object.fromEntries(e.map((n, r) => [n, s[r]]))
|
|
731
772
|
);
|
|
732
|
-
},
|
|
733
|
-
const
|
|
734
|
-
return
|
|
773
|
+
}, Qe = (...t) => (e, s = {}) => {
|
|
774
|
+
const n = t.filter((r) => g.is(r));
|
|
775
|
+
return Se(
|
|
735
776
|
() => e(...t.map(y.get)),
|
|
736
|
-
|
|
777
|
+
n,
|
|
737
778
|
s
|
|
738
779
|
);
|
|
739
780
|
};
|
|
740
|
-
class
|
|
781
|
+
class j {
|
|
782
|
+
_signals = /* @__PURE__ */ new Set();
|
|
783
|
+
_callbacks = [];
|
|
784
|
+
_disposed = !1;
|
|
785
|
+
/**
|
|
786
|
+
* Register a signal with this scope for automatic disposal.
|
|
787
|
+
*
|
|
788
|
+
* @param signal - The signal to track
|
|
789
|
+
* @throws Error if the scope has already been disposed
|
|
790
|
+
* @throws Error if the signal has already been disposed
|
|
791
|
+
* @public
|
|
792
|
+
*/
|
|
793
|
+
track(e) {
|
|
794
|
+
if (this._disposed)
|
|
795
|
+
throw new Error("Cannot track signal in disposed scope");
|
|
796
|
+
if (e.isDisposed())
|
|
797
|
+
throw new Error("Cannot track already disposed signal");
|
|
798
|
+
this._signals.add(e);
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Register a disposal callback to be called when this scope is disposed.
|
|
802
|
+
* Callbacks are called before signals are disposed.
|
|
803
|
+
* Use this for cleanup that doesn't need the `removeTree` parameter.
|
|
804
|
+
*
|
|
805
|
+
* @param callback - The callback to call on disposal
|
|
806
|
+
* @throws Error if the scope has already been disposed
|
|
807
|
+
* @public
|
|
808
|
+
*/
|
|
809
|
+
onDispose(e) {
|
|
810
|
+
if (this._disposed)
|
|
811
|
+
throw new Error("Cannot register callback in disposed scope");
|
|
812
|
+
this._callbacks.push(e);
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* Dispose all signals tracked by this scope.
|
|
816
|
+
* This method is idempotent - calling it multiple times is safe.
|
|
817
|
+
*
|
|
818
|
+
* @public
|
|
819
|
+
*/
|
|
820
|
+
dispose() {
|
|
821
|
+
if (!this._disposed) {
|
|
822
|
+
this._disposed = !0;
|
|
823
|
+
for (const e of this._callbacks)
|
|
824
|
+
try {
|
|
825
|
+
e();
|
|
826
|
+
} catch (s) {
|
|
827
|
+
console.error("Error in disposal callback:", s);
|
|
828
|
+
}
|
|
829
|
+
this._callbacks.length = 0;
|
|
830
|
+
for (const e of this._signals)
|
|
831
|
+
e.dispose();
|
|
832
|
+
this._signals.clear();
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* Check if this scope has been disposed.
|
|
837
|
+
*
|
|
838
|
+
* @returns true if the scope has been disposed
|
|
839
|
+
* @public
|
|
840
|
+
*/
|
|
841
|
+
get disposed() {
|
|
842
|
+
return this._disposed;
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Creates a prop signal and tracks it in this scope.
|
|
846
|
+
* Use this method in async contexts where automatic tracking doesn't work.
|
|
847
|
+
*
|
|
848
|
+
* @param value - The initial value
|
|
849
|
+
* @param equals - Optional equality function
|
|
850
|
+
* @returns A tracked Prop signal
|
|
851
|
+
* @public
|
|
852
|
+
*/
|
|
853
|
+
prop(e, s) {
|
|
854
|
+
const n = oe(() => T(e, s));
|
|
855
|
+
return this.track(n), n;
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
* Creates a computed signal and tracks it in this scope.
|
|
859
|
+
* Use this method in async contexts where automatic tracking doesn't work.
|
|
860
|
+
*
|
|
861
|
+
* @param fn - The computation function
|
|
862
|
+
* @param dependencies - Array of signals this computed depends on
|
|
863
|
+
* @param equals - Optional equality function
|
|
864
|
+
* @returns A tracked Computed signal
|
|
865
|
+
* @public
|
|
866
|
+
*/
|
|
867
|
+
computed(e, s, n) {
|
|
868
|
+
const r = oe(() => z(e, s, n));
|
|
869
|
+
return this.track(r), r;
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Creates an effect and tracks it in this scope.
|
|
873
|
+
* Use this method in async contexts where automatic tracking doesn't work.
|
|
874
|
+
*
|
|
875
|
+
* @param fn - The effect function
|
|
876
|
+
* @param signals - Array of signals to listen to
|
|
877
|
+
* @param options - Optional listener options
|
|
878
|
+
* @returns A clear function (the effect itself is tracked in the scope)
|
|
879
|
+
* @public
|
|
880
|
+
*/
|
|
881
|
+
effect(e, s, n) {
|
|
882
|
+
return L(this, () => Se(e, s, n));
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* Creates a computed signal with curried signature and tracks it in this scope.
|
|
886
|
+
* Use this method in async contexts where automatic tracking doesn't work.
|
|
887
|
+
*
|
|
888
|
+
* @param args - Values or signals to compute from
|
|
889
|
+
* @returns A function that takes the computation function and returns a tracked Computed signal
|
|
890
|
+
* @public
|
|
891
|
+
*/
|
|
892
|
+
computedOf(...e) {
|
|
893
|
+
return (s, n) => {
|
|
894
|
+
const r = oe(() => ee(...e)(s, n));
|
|
895
|
+
return this.track(r), r;
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* Creates an effect with curried signature and tracks it in this scope.
|
|
900
|
+
* Use this method in async contexts where automatic tracking doesn't work.
|
|
901
|
+
*
|
|
902
|
+
* @param args - Values or signals to listen to
|
|
903
|
+
* @returns A function that takes the effect function and returns a clear function
|
|
904
|
+
* @public
|
|
905
|
+
*/
|
|
906
|
+
effectOf(...e) {
|
|
907
|
+
return (s, n) => L(this, () => Qe(...e)(s, n));
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
const Ze = (t, e, s) => t + (e - t) * s, pe = 97, ze = (t, e, s) => {
|
|
911
|
+
const n = Math.max(t.length, e.length);
|
|
912
|
+
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);
|
|
918
|
+
}
|
|
919
|
+
return r;
|
|
920
|
+
}, 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;
|
|
921
|
+
class le {
|
|
922
|
+
/**
|
|
923
|
+
* Creates a new instance of `ElementPosition`.
|
|
924
|
+
* @param index - The index of the element.
|
|
925
|
+
* @param total - The total number of elements in the collection.
|
|
926
|
+
*/
|
|
927
|
+
constructor(e, s) {
|
|
928
|
+
this.index = e, this.total = s, this.counter = e + 1, this.isFirst = e === 0, this.isEven = e % 2 === 1, this.isOdd = e % 2 === 0;
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* The counter of the element starting from 1.
|
|
932
|
+
*/
|
|
933
|
+
counter;
|
|
934
|
+
/**
|
|
935
|
+
* Checks if the element is the first element in the collection.
|
|
936
|
+
* @returns `true` if the element is the first element, `false` otherwise.
|
|
937
|
+
*/
|
|
938
|
+
isFirst;
|
|
939
|
+
/**
|
|
940
|
+
* Checks if the counter of the element is even.
|
|
941
|
+
* @returns `true` if the counter is even, `false` otherwise.
|
|
942
|
+
*/
|
|
943
|
+
isEven;
|
|
944
|
+
/**
|
|
945
|
+
* Checks if the counter of the element is odd.
|
|
946
|
+
* @returns `true` if the counter is odd, `false` otherwise.
|
|
947
|
+
*/
|
|
948
|
+
isOdd;
|
|
949
|
+
#e;
|
|
950
|
+
/**
|
|
951
|
+
* Checks if the element is the last element in the collection.
|
|
952
|
+
* @returns `true` if the element is the last element, `false` otherwise.
|
|
953
|
+
*/
|
|
954
|
+
get isLast() {
|
|
955
|
+
return this.#e == null && (this.#e = this.total.map((e) => this.counter === e)), this.#e;
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Disposes the internal signal created by `isLast`.
|
|
959
|
+
*
|
|
960
|
+
* **Note:** With automatic signal disposal, this method is now a no-op when used within
|
|
961
|
+
* a disposal scope (e.g., inside a renderable). The signal created by `isLast` is
|
|
962
|
+
* automatically tracked and disposed when the scope ends. This method is kept for
|
|
963
|
+
* backward compatibility and for cases where ElementPosition is used outside a scope.
|
|
964
|
+
*/
|
|
965
|
+
dispose = () => {
|
|
966
|
+
this.#e?.dispose(), this.#e = void 0;
|
|
967
|
+
};
|
|
968
|
+
}
|
|
969
|
+
const ue = () => (
|
|
970
|
+
/* c8 ignore next */
|
|
971
|
+
typeof window < "u" ? window : void 0
|
|
972
|
+
);
|
|
973
|
+
class be {
|
|
741
974
|
_store = /* @__PURE__ */ new Map();
|
|
742
975
|
/**
|
|
743
976
|
* Retrieves the value associated with the specified key from the memory store.
|
|
@@ -754,164 +987,169 @@ class fe {
|
|
|
754
987
|
this._store.set(e, s);
|
|
755
988
|
};
|
|
756
989
|
}
|
|
757
|
-
|
|
990
|
+
let ce = null, ae = null;
|
|
991
|
+
const st = () => (ce || (ce = new be()), ce), nt = () => (ae || (ae = new be()), ae), _e = ({
|
|
758
992
|
key: t,
|
|
759
993
|
defaultValue: e,
|
|
760
994
|
store: s,
|
|
761
|
-
serialize:
|
|
762
|
-
deserialize:
|
|
995
|
+
serialize: n = JSON.stringify,
|
|
996
|
+
deserialize: r = JSON.parse,
|
|
763
997
|
equals: i = (a, u) => a === u,
|
|
764
998
|
onLoad: o = (a) => a,
|
|
765
999
|
syncTabs: l = !0,
|
|
766
1000
|
onKeyChange: c = "load"
|
|
767
1001
|
}) => {
|
|
768
1002
|
let a = y.get(t);
|
|
769
|
-
const u = s.getItem(a),
|
|
770
|
-
u != null ? o(
|
|
1003
|
+
const u = s.getItem(a), h = new Z(
|
|
1004
|
+
u != null ? o(r(u)) : typeof e == "function" ? e() : e,
|
|
771
1005
|
i
|
|
772
|
-
),
|
|
773
|
-
let
|
|
774
|
-
const
|
|
775
|
-
if (!
|
|
776
|
-
const
|
|
777
|
-
const v =
|
|
778
|
-
if (!(v == null || typeof v != "object" || v.key !==
|
|
1006
|
+
), p = ue(), d = l && typeof p?.BroadcastChannel == "function";
|
|
1007
|
+
let m = !1, w = null, D = null;
|
|
1008
|
+
const b = (S) => {
|
|
1009
|
+
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) => {
|
|
1011
|
+
const v = F.data;
|
|
1012
|
+
if (!(v == null || typeof v != "object" || v.key !== S || typeof v.value != "string" || v.sourceId != null && v.sourceId === k))
|
|
779
1013
|
try {
|
|
780
|
-
|
|
781
|
-
const
|
|
782
|
-
|
|
783
|
-
} catch (
|
|
1014
|
+
m = !0;
|
|
1015
|
+
const ie = o(r(v.value));
|
|
1016
|
+
h.set(ie);
|
|
1017
|
+
} catch (ie) {
|
|
784
1018
|
console.warn(
|
|
785
|
-
`Failed to sync storedProp for key "${
|
|
786
|
-
|
|
1019
|
+
`Failed to sync storedProp for key "${S}" via BroadcastChannel`,
|
|
1020
|
+
ie
|
|
787
1021
|
);
|
|
788
1022
|
} finally {
|
|
789
|
-
|
|
1023
|
+
m = !1;
|
|
790
1024
|
}
|
|
791
1025
|
};
|
|
792
|
-
return A.addEventListener("message", x),
|
|
1026
|
+
return A.addEventListener("message", x), h.onDispose(() => {
|
|
793
1027
|
A?.removeEventListener("message", x), A?.close();
|
|
794
|
-
}), { channel: A, instanceId:
|
|
795
|
-
}, P =
|
|
796
|
-
P && (w = P.channel,
|
|
797
|
-
const
|
|
798
|
-
const
|
|
799
|
-
if (
|
|
800
|
-
const A =
|
|
801
|
-
if (s.setItem(
|
|
802
|
-
const
|
|
803
|
-
if (
|
|
1028
|
+
}), { channel: A, instanceId: k, handleMessage: x };
|
|
1029
|
+
}, P = b(a);
|
|
1030
|
+
P && (w = P.channel, D = P.instanceId);
|
|
1031
|
+
const re = (S) => {
|
|
1032
|
+
const M = a;
|
|
1033
|
+
if (M === S) return;
|
|
1034
|
+
const A = h.get(), k = n(A);
|
|
1035
|
+
if (s.setItem(M, k), w != null && (w.close(), w = null, D = null), a = S, c === "load") {
|
|
1036
|
+
const F = s.getItem(S);
|
|
1037
|
+
if (F != null)
|
|
804
1038
|
try {
|
|
805
|
-
const v = o(
|
|
806
|
-
|
|
1039
|
+
const v = o(r(F));
|
|
1040
|
+
h.set(v);
|
|
807
1041
|
} catch (v) {
|
|
808
1042
|
console.warn(
|
|
809
|
-
`Failed to load storedProp from new key "${
|
|
1043
|
+
`Failed to load storedProp from new key "${S}"`,
|
|
810
1044
|
v
|
|
811
1045
|
);
|
|
812
1046
|
}
|
|
813
1047
|
else
|
|
814
|
-
s.setItem(
|
|
815
|
-
} else c === "migrate" && s.setItem(
|
|
816
|
-
const x = S
|
|
817
|
-
x && (w = x.channel,
|
|
818
|
-
};
|
|
819
|
-
return
|
|
820
|
-
const A =
|
|
821
|
-
s.setItem(a, A), w != null && !
|
|
1048
|
+
s.setItem(S, k);
|
|
1049
|
+
} else c === "migrate" && s.setItem(S, k);
|
|
1050
|
+
const x = b(S);
|
|
1051
|
+
x && (w = x.channel, D = x.instanceId);
|
|
1052
|
+
};
|
|
1053
|
+
return g.is(t) && h.onDispose(t.on(re)), h.on((S, M) => {
|
|
1054
|
+
const A = n(S);
|
|
1055
|
+
s.setItem(a, A), w != null && !m && M !== void 0 && D != null && w.postMessage({
|
|
822
1056
|
key: a,
|
|
823
1057
|
value: A,
|
|
824
|
-
sourceId:
|
|
1058
|
+
sourceId: D
|
|
825
1059
|
});
|
|
826
|
-
}),
|
|
827
|
-
},
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
1060
|
+
}), h;
|
|
1061
|
+
}, ts = (t) => {
|
|
1062
|
+
const s = ue()?.localStorage, n = s && typeof s.getItem == "function" ? s : st();
|
|
1063
|
+
return _e({
|
|
1064
|
+
...t,
|
|
1065
|
+
store: n
|
|
1066
|
+
});
|
|
1067
|
+
}, ss = (t) => {
|
|
1068
|
+
const s = ue()?.sessionStorage, n = s && typeof s.getItem == "function" ? s : nt();
|
|
1069
|
+
return _e({
|
|
1070
|
+
...t,
|
|
1071
|
+
store: n
|
|
1072
|
+
});
|
|
1073
|
+
};
|
|
1074
|
+
function ge(t) {
|
|
837
1075
|
return typeof requestAnimationFrame == "function" ? requestAnimationFrame(t) : setTimeout(t, 0);
|
|
838
1076
|
}
|
|
839
|
-
const
|
|
840
|
-
const
|
|
841
|
-
let l =
|
|
842
|
-
const
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
}),
|
|
846
|
-
|
|
1077
|
+
const rt = (t, e, s, n) => {
|
|
1078
|
+
const r = n?.duration ?? 300, i = n?.easing ?? ((b) => b), o = n?.equals ?? ((b, P) => b === P);
|
|
1079
|
+
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);
|
|
1081
|
+
m.onDispose(() => {
|
|
1082
|
+
h !== null && cancelAnimationFrame(h);
|
|
1083
|
+
}), m.onDispose(d.dispose), s.forEach((b) => {
|
|
1084
|
+
b.setDerivative(d), b.onDispose(m.dispose);
|
|
847
1085
|
});
|
|
848
|
-
const w = (
|
|
849
|
-
a =
|
|
850
|
-
},
|
|
851
|
-
const P = (performance.now() - u) / y.get(
|
|
852
|
-
l == null && (l =
|
|
853
|
-
let
|
|
854
|
-
P >= 1 ? (
|
|
855
|
-
};
|
|
856
|
-
return
|
|
857
|
-
},
|
|
858
|
-
const { initialValue: s, ...
|
|
859
|
-
return
|
|
1086
|
+
const w = (b) => {
|
|
1087
|
+
a = b, u = performance.now(), c = m.value, p && (p = !1, h = ge(D));
|
|
1088
|
+
}, D = () => {
|
|
1089
|
+
const P = (performance.now() - u) / y.get(r), re = i(P);
|
|
1090
|
+
l == null && (l = tt(c));
|
|
1091
|
+
let S = l(c, a, re);
|
|
1092
|
+
P >= 1 ? (p = !0, S = a) : h = ge(D), m.set(S);
|
|
1093
|
+
};
|
|
1094
|
+
return d.on(w), m;
|
|
1095
|
+
}, ns = (t, e) => {
|
|
1096
|
+
const { initialValue: s, ...n } = e ?? {};
|
|
1097
|
+
return rt(
|
|
860
1098
|
/* c8 ignore next 2 */
|
|
861
1099
|
s ?? t.get(),
|
|
862
1100
|
t.get,
|
|
863
1101
|
[t],
|
|
864
|
-
|
|
1102
|
+
n
|
|
865
1103
|
);
|
|
866
|
-
},
|
|
867
|
-
const s = Object.values(t).filter(
|
|
868
|
-
return
|
|
869
|
-
const
|
|
870
|
-
for (const i of
|
|
871
|
-
|
|
872
|
-
return e(
|
|
1104
|
+
}, it = (t, e) => {
|
|
1105
|
+
const s = Object.values(t).filter(g.is), n = Object.keys(t);
|
|
1106
|
+
return z(() => {
|
|
1107
|
+
const r = {};
|
|
1108
|
+
for (const i of n)
|
|
1109
|
+
r[i] = y.get(t[i]);
|
|
1110
|
+
return e(r);
|
|
873
1111
|
}, s);
|
|
874
|
-
},
|
|
875
|
-
const s =
|
|
876
|
-
let
|
|
877
|
-
const
|
|
878
|
-
|
|
1112
|
+
}, rs = (t) => it(t, (e) => e), is = (t, e) => {
|
|
1113
|
+
const s = T(t.get());
|
|
1114
|
+
let n = null;
|
|
1115
|
+
const r = t.on((i) => {
|
|
1116
|
+
n != null && clearTimeout(n), n = setTimeout(
|
|
879
1117
|
() => {
|
|
880
|
-
|
|
1118
|
+
n = null, s.set(i);
|
|
881
1119
|
},
|
|
882
1120
|
typeof e == "function" ? e(i) : e
|
|
883
1121
|
);
|
|
884
1122
|
});
|
|
885
1123
|
return s.onDispose(() => {
|
|
886
|
-
|
|
1124
|
+
r(), n != null && clearTimeout(n);
|
|
887
1125
|
}), s;
|
|
888
|
-
},
|
|
1126
|
+
}, os = (t) => {
|
|
889
1127
|
let e;
|
|
890
1128
|
return t.map((s) => {
|
|
891
|
-
const
|
|
892
|
-
return e = s,
|
|
1129
|
+
const n = e;
|
|
1130
|
+
return e = s, n;
|
|
893
1131
|
});
|
|
894
|
-
},
|
|
1132
|
+
}, ls = ({
|
|
895
1133
|
size: t = void 0,
|
|
896
1134
|
signal: e
|
|
897
1135
|
}) => {
|
|
898
1136
|
const s = [];
|
|
899
|
-
return e.map((
|
|
900
|
-
},
|
|
1137
|
+
return e.map((n) => (s.push(n), t != null && s.length > t && s.shift(), s.slice()));
|
|
1138
|
+
}, cs = (t) => (...e) => ee(
|
|
901
1139
|
t,
|
|
902
1140
|
...e
|
|
903
|
-
)((s, ...
|
|
904
|
-
function
|
|
905
|
-
return
|
|
1141
|
+
)((s, ...n) => s(...n));
|
|
1142
|
+
function as(...t) {
|
|
1143
|
+
return ee(...t)((...e) => {
|
|
906
1144
|
for (const s of e) if (s != null) return s;
|
|
907
1145
|
});
|
|
908
1146
|
}
|
|
909
|
-
const
|
|
1147
|
+
const ve = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), Te = /* @__PURE__ */ new Set(["selected"]), Ae = /* @__PURE__ */ new Set([
|
|
910
1148
|
"rowSpan",
|
|
911
1149
|
"colSpan",
|
|
912
1150
|
"tabIndex",
|
|
913
1151
|
"valueAsNumber"
|
|
914
|
-
]),
|
|
1152
|
+
]), Ee = /* @__PURE__ */ new Set(["valueAsDate"]), Ce = /* @__PURE__ */ new Set([
|
|
915
1153
|
"value",
|
|
916
1154
|
"textContent",
|
|
917
1155
|
"innerText",
|
|
@@ -919,28 +1157,28 @@ const pe = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), me = /* @
|
|
|
919
1157
|
"outerHTML",
|
|
920
1158
|
"className",
|
|
921
1159
|
"classList"
|
|
922
|
-
]),
|
|
1160
|
+
]), ot = (t, e) => Te.has(t) ? (s) => {
|
|
923
1161
|
s == null || s !== !0 ? e.removeAttribute(t) : e.setAttribute(t, "");
|
|
924
|
-
} :
|
|
1162
|
+
} : ve.has(t) ? (s) => {
|
|
925
1163
|
s == null ? e[t] = null : e[t] = !!s;
|
|
926
|
-
} :
|
|
1164
|
+
} : Ae.has(t) ? (s) => {
|
|
927
1165
|
s == null ? e[t] = null : e[t] = Number(s);
|
|
928
|
-
} :
|
|
1166
|
+
} : Ee.has(t) ? (s) => {
|
|
929
1167
|
s == null ? e[t] = null : e[t] = s;
|
|
930
|
-
} :
|
|
1168
|
+
} : Ce.has(t) ? (s) => {
|
|
931
1169
|
s == null ? e[t] = null : e[t] = String(s);
|
|
932
1170
|
} : (s) => {
|
|
933
1171
|
s == null ? e.removeAttribute(t) : e.setAttribute(t, s);
|
|
934
|
-
},
|
|
1172
|
+
}, lt = (t, e) => Te.has(t) ? () => e.hasAttribute(t) : ve.has(t) ? () => !!e[t] : Ae.has(t) ? () => Number(e[t]) : Ee.has(t) ? () => e[t] : Ce.has(t) ? () => String(e[t]) : () => e.getAttribute(t), U = (t) => {
|
|
935
1173
|
const e = t;
|
|
936
1174
|
e && e.onblur && (e.onblur = null), !(!t || t.ownerDocument === void 0) && t.parentElement && t.parentElement.removeChild(t);
|
|
937
|
-
},
|
|
938
|
-
class
|
|
1175
|
+
}, ct = (t) => De(t) ? t : t.parentElement, De = (t) => t.nodeType === 1;
|
|
1176
|
+
class Pe extends Error {
|
|
939
1177
|
constructor(e) {
|
|
940
1178
|
super(`Provider not found: ${e.description}`);
|
|
941
1179
|
}
|
|
942
1180
|
}
|
|
943
|
-
class
|
|
1181
|
+
class $ {
|
|
944
1182
|
/**
|
|
945
1183
|
* Constructs a new `DOMContext` instance.
|
|
946
1184
|
*
|
|
@@ -950,8 +1188,8 @@ class k {
|
|
|
950
1188
|
* @param providers - The `Providers` instance associated with this context.
|
|
951
1189
|
* @param isFirstLevel - A boolean value indicating whether this context is at the first level, meaning the outermost node in the generated DOM.
|
|
952
1190
|
*/
|
|
953
|
-
constructor(e, s,
|
|
954
|
-
this.document = e, this.element = s, this.reference =
|
|
1191
|
+
constructor(e, s, n, r) {
|
|
1192
|
+
this.document = e, this.element = s, this.reference = n, this.providers = r;
|
|
955
1193
|
}
|
|
956
1194
|
/**
|
|
957
1195
|
* Creates a new `DOMContext` instance for the given `Element` and optional reference `Node`.
|
|
@@ -961,8 +1199,8 @@ class k {
|
|
|
961
1199
|
* @param providers - The providers to associate with the `DOMContext`.
|
|
962
1200
|
* @returns A new `DOMContext` instance.
|
|
963
1201
|
*/
|
|
964
|
-
static of(e, s,
|
|
965
|
-
return new
|
|
1202
|
+
static of(e, s, n) {
|
|
1203
|
+
return new $(e.ownerDocument, e, s, n);
|
|
966
1204
|
}
|
|
967
1205
|
/**
|
|
968
1206
|
* Creates a new DOM element (eg: HTML or SVG) with the specified tag name and namespace.
|
|
@@ -995,8 +1233,8 @@ class k {
|
|
|
995
1233
|
* @returns A new DOMContext focused on the newly created child element
|
|
996
1234
|
*/
|
|
997
1235
|
makeChildElement = (e, s) => {
|
|
998
|
-
const
|
|
999
|
-
return this.appendOrInsert(
|
|
1236
|
+
const n = this.createElement(e, s);
|
|
1237
|
+
return this.appendOrInsert(n), this.withElement(n);
|
|
1000
1238
|
};
|
|
1001
1239
|
/**
|
|
1002
1240
|
* Creates a new text node with the specified text content.
|
|
@@ -1047,7 +1285,7 @@ class k {
|
|
|
1047
1285
|
* @param element - The DOM element to use in the new `DOMContext` instance.
|
|
1048
1286
|
* @returns A new `DOMContext` instance with the provided `element`.
|
|
1049
1287
|
*/
|
|
1050
|
-
withElement = (e) => new
|
|
1288
|
+
withElement = (e) => new $(this.document, e, void 0, this.providers);
|
|
1051
1289
|
/**
|
|
1052
1290
|
* Creates a portal to render content in a different part of the DOM tree.
|
|
1053
1291
|
*
|
|
@@ -1104,7 +1342,7 @@ class k {
|
|
|
1104
1342
|
* @param reference - The optional `Text` node to use as the reference for the new `DOMContext`.
|
|
1105
1343
|
* @returns A new `DOMContext` instance with the specified reference.
|
|
1106
1344
|
*/
|
|
1107
|
-
withReference = (e) => new
|
|
1345
|
+
withReference = (e) => new $(this.document, this.element, e, this.providers);
|
|
1108
1346
|
/**
|
|
1109
1347
|
* Sets a provider for the given provider mark.
|
|
1110
1348
|
*
|
|
@@ -1112,9 +1350,9 @@ class k {
|
|
|
1112
1350
|
* @param value - The provider to set for the given mark.
|
|
1113
1351
|
* @returns A new `DOMContext` instance with the specified provider.
|
|
1114
1352
|
*/
|
|
1115
|
-
setProvider = (e, s,
|
|
1353
|
+
setProvider = (e, s, n) => new $(this.document, this.element, this.reference, {
|
|
1116
1354
|
...this.providers,
|
|
1117
|
-
[e]: [s,
|
|
1355
|
+
[e]: [s, n]
|
|
1118
1356
|
});
|
|
1119
1357
|
/**
|
|
1120
1358
|
* Retrieves a provider for the given provider mark.
|
|
@@ -1125,12 +1363,12 @@ class k {
|
|
|
1125
1363
|
*/
|
|
1126
1364
|
getProvider = (e) => {
|
|
1127
1365
|
if (this.providers[e] === void 0)
|
|
1128
|
-
throw new
|
|
1129
|
-
const [s,
|
|
1130
|
-
return { value: s, onUse:
|
|
1366
|
+
throw new Pe(e);
|
|
1367
|
+
const [s, n] = this.providers[e];
|
|
1368
|
+
return { value: s, onUse: n };
|
|
1131
1369
|
};
|
|
1132
1370
|
clear = (e) => {
|
|
1133
|
-
e && (this.reference !== void 0 ?
|
|
1371
|
+
e && (this.reference !== void 0 ? U(this.reference) : U(this.element));
|
|
1134
1372
|
};
|
|
1135
1373
|
/**
|
|
1136
1374
|
* Adds classes to the element.
|
|
@@ -1158,10 +1396,10 @@ class k {
|
|
|
1158
1396
|
* @param options - The options for the event listener.
|
|
1159
1397
|
* @returns A function to remove the event listener.
|
|
1160
1398
|
*/
|
|
1161
|
-
on = (e, s,
|
|
1162
|
-
const
|
|
1163
|
-
return this.element.addEventListener(e,
|
|
1164
|
-
i && this.element.removeEventListener(e,
|
|
1399
|
+
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);
|
|
1165
1403
|
};
|
|
1166
1404
|
};
|
|
1167
1405
|
/**
|
|
@@ -1200,55 +1438,57 @@ class k {
|
|
|
1200
1438
|
*/
|
|
1201
1439
|
getStyle = (e) => this.element.style[e];
|
|
1202
1440
|
makeAccessors = (e) => ({
|
|
1203
|
-
get:
|
|
1204
|
-
set:
|
|
1441
|
+
get: lt(e, this.element),
|
|
1442
|
+
set: ot(e, this.element)
|
|
1205
1443
|
});
|
|
1206
1444
|
getWindow = () => this.document.defaultView;
|
|
1207
1445
|
}
|
|
1208
|
-
const
|
|
1209
|
-
const s = t(e);
|
|
1210
|
-
return (r = !0) =>
|
|
1211
|
-
|
|
1446
|
+
const at = (t) => Symbol(t), he = (t, e) => {
|
|
1447
|
+
const s = new j(), n = L(s, () => t(e));
|
|
1448
|
+
return (r = !0) => {
|
|
1449
|
+
s.dispose(), n(r);
|
|
1450
|
+
};
|
|
1451
|
+
}, us = (t, e, { doc: s, clear: n, disposeWithParent: r = !0, providers: i = {} } = {}) => {
|
|
1212
1452
|
const o = typeof e == "string" ? (s ?? document).querySelector(e) : e;
|
|
1213
1453
|
if (o === null)
|
|
1214
|
-
throw new
|
|
1454
|
+
throw new ut(
|
|
1215
1455
|
`Cannot find element by selector for render: ${e}`
|
|
1216
1456
|
);
|
|
1217
|
-
|
|
1218
|
-
const l =
|
|
1219
|
-
let
|
|
1220
|
-
return
|
|
1221
|
-
|
|
1222
|
-
|
|
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);
|
|
1459
|
+
let h;
|
|
1460
|
+
return r && (h = new MutationObserver((p) => {
|
|
1461
|
+
p[0]?.removedNodes.forEach((d) => {
|
|
1462
|
+
d === o && (h?.disconnect(), u(o.nodeType !== 1));
|
|
1223
1463
|
});
|
|
1224
|
-
}),
|
|
1464
|
+
}), h.observe(o.parentElement, {
|
|
1225
1465
|
childList: !0,
|
|
1226
1466
|
subtree: !1,
|
|
1227
1467
|
attributes: !1
|
|
1228
1468
|
})), () => {
|
|
1229
|
-
|
|
1469
|
+
h?.disconnect(), u(!0);
|
|
1230
1470
|
};
|
|
1231
|
-
},
|
|
1471
|
+
}, hs = (t, {
|
|
1232
1472
|
startUrl: e = "https://example.com",
|
|
1233
1473
|
selector: s,
|
|
1234
|
-
providers:
|
|
1474
|
+
providers: n = {}
|
|
1235
1475
|
} = {
|
|
1236
1476
|
selector: "body"
|
|
1237
1477
|
}) => {
|
|
1238
|
-
const
|
|
1478
|
+
const r = y.toSignal(e).deriveProp(), i = new ke(s, void 0), o = new R(i, void 0, { currentURL: r }, n);
|
|
1239
1479
|
return {
|
|
1240
|
-
clear:
|
|
1480
|
+
clear: he(t(), o),
|
|
1241
1481
|
root: i,
|
|
1242
|
-
currentURL:
|
|
1482
|
+
currentURL: r
|
|
1243
1483
|
};
|
|
1244
1484
|
};
|
|
1245
|
-
class
|
|
1485
|
+
class ut extends Error {
|
|
1246
1486
|
constructor(e) {
|
|
1247
1487
|
super(e);
|
|
1248
1488
|
}
|
|
1249
1489
|
}
|
|
1250
|
-
const
|
|
1251
|
-
class
|
|
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";
|
|
1491
|
+
class fs {
|
|
1252
1492
|
/**
|
|
1253
1493
|
* Selects elements from the headless environment.
|
|
1254
1494
|
* @param selector - The selector to select elements from. The supported selectors are CSS selectors whose complexity depends on the adapter implementation.
|
|
@@ -1325,18 +1565,18 @@ class Gt {
|
|
|
1325
1565
|
constructor({
|
|
1326
1566
|
select: e,
|
|
1327
1567
|
getAttribute: s,
|
|
1328
|
-
setAttribute:
|
|
1329
|
-
getClass:
|
|
1568
|
+
setAttribute: n,
|
|
1569
|
+
getClass: r,
|
|
1330
1570
|
setClass: i,
|
|
1331
1571
|
getStyles: o,
|
|
1332
1572
|
setStyles: l,
|
|
1333
1573
|
appendHTML: c,
|
|
1334
1574
|
getInnerHTML: a,
|
|
1335
1575
|
setInnerHTML: u,
|
|
1336
|
-
getInnerText:
|
|
1337
|
-
setInnerText:
|
|
1576
|
+
getInnerText: h,
|
|
1577
|
+
setInnerText: p
|
|
1338
1578
|
}) {
|
|
1339
|
-
this.select = e, this.getAttribute = s, this.setAttribute =
|
|
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;
|
|
1340
1580
|
}
|
|
1341
1581
|
/**
|
|
1342
1582
|
* Sets the content of the root element from a HeadlessPortal. Generally this will be the same instance that is
|
|
@@ -1347,47 +1587,47 @@ class Gt {
|
|
|
1347
1587
|
* when you render on the server and then hydrate on the client.
|
|
1348
1588
|
*/
|
|
1349
1589
|
setFromRoot = (e, s) => {
|
|
1350
|
-
e.getPortals().forEach((
|
|
1351
|
-
const i = typeof
|
|
1590
|
+
e.getPortals().forEach((r) => {
|
|
1591
|
+
const i = typeof r.selector == "string" ? this.select(r.selector) : [r.selector];
|
|
1352
1592
|
for (const o of i) {
|
|
1353
1593
|
if (o == null)
|
|
1354
1594
|
throw new Error(
|
|
1355
|
-
`Cannot find element by selector for render: ${
|
|
1595
|
+
`Cannot find element by selector for render: ${r.selector}`
|
|
1356
1596
|
);
|
|
1357
|
-
if (
|
|
1597
|
+
if (r.hasChildren() && this.appendHTML(o, r.contentToHTML(s)), r.hasInnerHTML()) {
|
|
1358
1598
|
if (s) {
|
|
1359
1599
|
const l = this.getInnerHTML(o);
|
|
1360
|
-
l != null && this.setAttribute(o,
|
|
1600
|
+
l != null && this.setAttribute(o, X, l);
|
|
1361
1601
|
}
|
|
1362
|
-
this.setInnerHTML(o,
|
|
1602
|
+
this.setInnerHTML(o, r.getInnerHTML());
|
|
1363
1603
|
}
|
|
1364
|
-
if (
|
|
1604
|
+
if (r.hasInnerText()) {
|
|
1365
1605
|
if (s) {
|
|
1366
1606
|
const l = this.getInnerText(o);
|
|
1367
|
-
l != null && this.setAttribute(o,
|
|
1607
|
+
l != null && this.setAttribute(o, Y, l);
|
|
1368
1608
|
}
|
|
1369
|
-
this.setInnerText(o,
|
|
1609
|
+
this.setInnerText(o, r.getInnerText());
|
|
1370
1610
|
}
|
|
1371
|
-
if (
|
|
1611
|
+
if (r.hasClasses()) {
|
|
1372
1612
|
if (s) {
|
|
1373
1613
|
const l = this.getClass(o);
|
|
1374
|
-
l != null && this.setAttribute(o,
|
|
1614
|
+
l != null && this.setAttribute(o, G, l);
|
|
1375
1615
|
}
|
|
1376
|
-
this.setClass(o,
|
|
1616
|
+
this.setClass(o, r.getClasses().join(" "));
|
|
1377
1617
|
}
|
|
1378
|
-
if (
|
|
1618
|
+
if (r.hasStyles()) {
|
|
1379
1619
|
if (s) {
|
|
1380
1620
|
const l = this.getStyles(o);
|
|
1381
1621
|
Object.keys(l).length > 0 && this.setAttribute(
|
|
1382
1622
|
o,
|
|
1383
|
-
|
|
1623
|
+
J,
|
|
1384
1624
|
JSON.stringify(l)
|
|
1385
1625
|
);
|
|
1386
1626
|
}
|
|
1387
|
-
this.setStyles(o,
|
|
1627
|
+
this.setStyles(o, r.getStyles());
|
|
1388
1628
|
}
|
|
1389
|
-
if (
|
|
1390
|
-
const l =
|
|
1629
|
+
if (r.hasAttributes()) {
|
|
1630
|
+
const l = r.getAttributes();
|
|
1391
1631
|
if (s) {
|
|
1392
1632
|
const c = [];
|
|
1393
1633
|
l.forEach(([a]) => {
|
|
@@ -1395,7 +1635,7 @@ class Gt {
|
|
|
1395
1635
|
u != null && c.push([a, u]);
|
|
1396
1636
|
}), c.length > 0 && this.setAttribute(
|
|
1397
1637
|
o,
|
|
1398
|
-
|
|
1638
|
+
Q,
|
|
1399
1639
|
JSON.stringify(Object.fromEntries(c))
|
|
1400
1640
|
);
|
|
1401
1641
|
}
|
|
@@ -1407,56 +1647,56 @@ class Gt {
|
|
|
1407
1647
|
});
|
|
1408
1648
|
};
|
|
1409
1649
|
}
|
|
1410
|
-
const
|
|
1411
|
-
document.querySelectorAll(`[${
|
|
1412
|
-
},
|
|
1413
|
-
const e = t.getAttribute(W);
|
|
1414
|
-
t.removeAttribute(W), e != null && t.setAttribute("class", e);
|
|
1415
|
-
}, et = () => {
|
|
1416
|
-
document.querySelectorAll(`[${W}]`).forEach((e) => Ke(e));
|
|
1417
|
-
}, tt = (t) => {
|
|
1418
|
-
const e = t.getAttribute(J);
|
|
1419
|
-
t.removeAttribute(J), e != null && (t.innerHTML = e);
|
|
1420
|
-
}, st = () => {
|
|
1421
|
-
document.querySelectorAll(`[${J}]`).forEach((e) => tt(e));
|
|
1422
|
-
}, rt = (t) => {
|
|
1650
|
+
const ht = () => {
|
|
1651
|
+
document.querySelectorAll(`[${xe}]`).forEach(U);
|
|
1652
|
+
}, ft = (t) => {
|
|
1423
1653
|
const e = t.getAttribute(G);
|
|
1424
|
-
t.removeAttribute(G), e != null &&
|
|
1425
|
-
},
|
|
1426
|
-
document.querySelectorAll(`[${G}]`).forEach((e) =>
|
|
1427
|
-
},
|
|
1428
|
-
const e = t.getAttribute(
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1654
|
+
t.removeAttribute(G), e != null && t.setAttribute("class", e);
|
|
1655
|
+
}, dt = () => {
|
|
1656
|
+
document.querySelectorAll(`[${G}]`).forEach((e) => ft(e));
|
|
1657
|
+
}, pt = (t) => {
|
|
1658
|
+
const e = t.getAttribute(X);
|
|
1659
|
+
t.removeAttribute(X), e != null && (t.innerHTML = e);
|
|
1660
|
+
}, gt = () => {
|
|
1661
|
+
document.querySelectorAll(`[${X}]`).forEach((e) => pt(e));
|
|
1662
|
+
}, mt = (t) => {
|
|
1663
|
+
const e = t.getAttribute(Y);
|
|
1664
|
+
t.removeAttribute(Y), e != null && (t.innerText = e);
|
|
1665
|
+
}, yt = () => {
|
|
1666
|
+
document.querySelectorAll(`[${Y}]`).forEach((e) => mt(e));
|
|
1667
|
+
}, Le = (t) => JSON.parse(t.replace(/"/g, '"')), St = (t) => {
|
|
1668
|
+
const e = t.getAttribute(J);
|
|
1669
|
+
if (t.removeAttribute(J), e != null) {
|
|
1670
|
+
const s = Le(e);
|
|
1671
|
+
Object.entries(s).forEach(([n, r]) => {
|
|
1672
|
+
t.style.setProperty(n, r);
|
|
1433
1673
|
});
|
|
1434
1674
|
}
|
|
1435
|
-
},
|
|
1436
|
-
document.querySelectorAll(`[${
|
|
1437
|
-
},
|
|
1438
|
-
const e = t.getAttribute(
|
|
1439
|
-
if (t.removeAttribute(
|
|
1440
|
-
const s =
|
|
1441
|
-
Object.entries(s).forEach(([
|
|
1442
|
-
|
|
1675
|
+
}, wt = () => {
|
|
1676
|
+
document.querySelectorAll(`[${J}]`).forEach((e) => St(e));
|
|
1677
|
+
}, bt = (t) => {
|
|
1678
|
+
const e = t.getAttribute(Q);
|
|
1679
|
+
if (t.removeAttribute(Q), e != null) {
|
|
1680
|
+
const s = Le(e);
|
|
1681
|
+
Object.entries(s).forEach(([n, r]) => {
|
|
1682
|
+
r == null ? t.removeAttribute(n) : t.setAttribute(n, r);
|
|
1443
1683
|
});
|
|
1444
1684
|
}
|
|
1445
|
-
},
|
|
1446
|
-
document.querySelectorAll(`[${
|
|
1447
|
-
},
|
|
1448
|
-
|
|
1449
|
-
},
|
|
1450
|
-
class
|
|
1685
|
+
}, _t = () => {
|
|
1686
|
+
document.querySelectorAll(`[${Q}]`).forEach((e) => bt(e));
|
|
1687
|
+
}, ds = () => {
|
|
1688
|
+
ht(), dt(), yt(), gt(), wt(), _t();
|
|
1689
|
+
}, I = Symbol("class"), H = Symbol("style"), B = Symbol("handler"), Oe = () => Math.random().toString(36).substring(2, 15), vt = (t) => t.replace(/<[^>]*>?/g, "");
|
|
1690
|
+
class Me {
|
|
1451
1691
|
constructor(e) {
|
|
1452
1692
|
this.parent = e;
|
|
1453
1693
|
}
|
|
1454
|
-
id =
|
|
1694
|
+
id = Oe();
|
|
1455
1695
|
properties = {};
|
|
1456
1696
|
children = [];
|
|
1457
1697
|
isElement = () => !0;
|
|
1458
1698
|
isText = () => !1;
|
|
1459
|
-
getText = () => this.properties.innerText != null ? this.properties.innerText : this.properties.innerHTML != null ?
|
|
1699
|
+
getText = () => this.properties.innerText != null ? this.properties.innerText : this.properties.innerHTML != null ? vt(this.properties.innerHTML) : this.children.map((e) => e.getText()).join("");
|
|
1460
1700
|
removeChild = (e) => {
|
|
1461
1701
|
const s = this.children.indexOf(e);
|
|
1462
1702
|
s !== -1 && this.children.splice(s, 1);
|
|
@@ -1477,89 +1717,89 @@ class _e {
|
|
|
1477
1717
|
getInnerText = () => this.properties.innerText ?? "";
|
|
1478
1718
|
hasInnerText = () => this.properties.innerText != null;
|
|
1479
1719
|
hasChildren = () => this.children.length > 0;
|
|
1480
|
-
hasClasses = () => this.properties[
|
|
1481
|
-
hasStyles = () => this.properties[
|
|
1720
|
+
hasClasses = () => this.properties[I] != null;
|
|
1721
|
+
hasStyles = () => this.properties[H] != null;
|
|
1482
1722
|
hasAttributes = () => Object.keys(this.properties).length > 0;
|
|
1483
|
-
hasHandlers = () => this.properties[
|
|
1723
|
+
hasHandlers = () => this.properties[B] != null;
|
|
1484
1724
|
hasRenderableProperties = () => this.hasClasses() || this.hasAttributes() || this.hasStyles();
|
|
1485
1725
|
getById = (e) => {
|
|
1486
1726
|
if (this.properties.id === e)
|
|
1487
1727
|
return this;
|
|
1488
1728
|
for (const s of this.elements()) {
|
|
1489
|
-
const
|
|
1490
|
-
if (
|
|
1491
|
-
return
|
|
1729
|
+
const n = s.getById(e);
|
|
1730
|
+
if (n != null)
|
|
1731
|
+
return n;
|
|
1492
1732
|
}
|
|
1493
1733
|
};
|
|
1494
1734
|
trigger = (e, s) => {
|
|
1495
|
-
((this.properties[
|
|
1735
|
+
((this.properties[B] ?? {})[e] ?? []).forEach((r) => r(s));
|
|
1496
1736
|
};
|
|
1497
1737
|
click = () => {
|
|
1498
1738
|
this.trigger("click", {});
|
|
1499
1739
|
};
|
|
1500
|
-
on = (e, s,
|
|
1501
|
-
const i = this.properties[
|
|
1502
|
-
l(), s(c,
|
|
1503
|
-
} : (c) => s(c,
|
|
1740
|
+
on = (e, s, n, r) => {
|
|
1741
|
+
const i = this.properties[B] ??= {}, o = r?.once ? (c) => {
|
|
1742
|
+
l(), s(c, n);
|
|
1743
|
+
} : (c) => s(c, n);
|
|
1504
1744
|
i[e] = [...i[e] ?? [], o];
|
|
1505
1745
|
const l = () => {
|
|
1506
1746
|
const c = i[e] ?? [], a = c.indexOf(o);
|
|
1507
|
-
a !== -1 && (c.splice(a, 1), c.length === 0 ? (delete i[e], Object.keys(i).length === 0 && delete this.properties[
|
|
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));
|
|
1508
1748
|
};
|
|
1509
|
-
return
|
|
1749
|
+
return r?.signal != null && r.signal.addEventListener("abort", l), l;
|
|
1510
1750
|
};
|
|
1511
1751
|
addClasses = (e) => {
|
|
1512
1752
|
if (e.length === 0)
|
|
1513
1753
|
return;
|
|
1514
|
-
const s = this.properties[
|
|
1515
|
-
e.forEach((
|
|
1516
|
-
s.includes(
|
|
1754
|
+
const s = this.properties[I] ??= [];
|
|
1755
|
+
e.forEach((n) => {
|
|
1756
|
+
s.includes(n) || s.push(n);
|
|
1517
1757
|
});
|
|
1518
1758
|
};
|
|
1519
1759
|
removeClasses = (e) => {
|
|
1520
1760
|
if (e.length === 0)
|
|
1521
1761
|
return;
|
|
1522
|
-
const s = this.properties[
|
|
1523
|
-
e.forEach((
|
|
1524
|
-
const
|
|
1525
|
-
|
|
1526
|
-
}), s.length === 0 && delete this.properties[
|
|
1762
|
+
const s = this.properties[I] ??= [];
|
|
1763
|
+
e.forEach((n) => {
|
|
1764
|
+
const r = s.indexOf(n);
|
|
1765
|
+
r !== -1 && s.splice(r, 1);
|
|
1766
|
+
}), s.length === 0 && delete this.properties[I];
|
|
1527
1767
|
};
|
|
1528
|
-
getClasses = () => this.properties[
|
|
1768
|
+
getClasses = () => this.properties[I] ?? [];
|
|
1529
1769
|
getAttributes = () => Object.entries(this.properties).filter(
|
|
1530
1770
|
([e]) => !["innerText", "innerHTML"].includes(e)
|
|
1531
1771
|
);
|
|
1532
1772
|
getVisibleAttributes = () => Reflect.ownKeys(this.properties).flatMap(
|
|
1533
|
-
(e) => e ===
|
|
1773
|
+
(e) => e === I ? [["class", this.getClasses()]] : e === H ? [["style", this.getStyles()]] : typeof e == "string" ? [[e, String(this.properties[e])]] : []
|
|
1534
1774
|
);
|
|
1535
1775
|
setStyle = (e, s) => {
|
|
1536
|
-
const
|
|
1537
|
-
|
|
1776
|
+
const n = this.properties[H] ??= {};
|
|
1777
|
+
n[e] = s, s === "" && (delete n[e], Object.keys(n).length === 0 && delete this.properties[H]);
|
|
1538
1778
|
};
|
|
1539
|
-
getStyle = (e) => this.properties[
|
|
1540
|
-
getStyles = () => this.properties[
|
|
1779
|
+
getStyle = (e) => this.properties[H]?.[e] ?? "";
|
|
1780
|
+
getStyles = () => this.properties[H] ?? {};
|
|
1541
1781
|
makeAccessors = (e) => {
|
|
1542
1782
|
const s = this.properties;
|
|
1543
1783
|
return {
|
|
1544
1784
|
get: () => s[e],
|
|
1545
|
-
set: (
|
|
1785
|
+
set: (n) => s[e] = n
|
|
1546
1786
|
};
|
|
1547
1787
|
};
|
|
1548
1788
|
}
|
|
1549
|
-
const
|
|
1550
|
-
class
|
|
1551
|
-
constructor(e, s,
|
|
1552
|
-
super(
|
|
1789
|
+
const Tt = (t) => t.replace(/"/g, """), At = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1790
|
+
class Et extends Me {
|
|
1791
|
+
constructor(e, s, n) {
|
|
1792
|
+
super(n), this.tagName = e, this.namespace = s;
|
|
1553
1793
|
}
|
|
1554
1794
|
isPortal = () => !1;
|
|
1555
1795
|
toHTML = (e = !1) => {
|
|
1556
|
-
const s = this.children.map((l) => l.toHTML()).join(""),
|
|
1557
|
-
let
|
|
1558
|
-
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(" ")}"` :
|
|
1559
|
-
return
|
|
1796
|
+
const s = this.children.map((l) => l.toHTML()).join(""), n = this.namespace ? ` xmlns="${this.namespace}"` : "";
|
|
1797
|
+
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}>`;
|
|
1560
1800
|
};
|
|
1561
1801
|
}
|
|
1562
|
-
class
|
|
1802
|
+
class ke extends Me {
|
|
1563
1803
|
constructor(e, s) {
|
|
1564
1804
|
super(s), this.selector = e;
|
|
1565
1805
|
}
|
|
@@ -1567,19 +1807,19 @@ class Ee extends _e {
|
|
|
1567
1807
|
toHTML = () => "";
|
|
1568
1808
|
contentToHTML = (e = !1) => this.children.map((s) => s.toHTML(e)).join("");
|
|
1569
1809
|
}
|
|
1570
|
-
class
|
|
1810
|
+
class Ct {
|
|
1571
1811
|
constructor(e) {
|
|
1572
1812
|
this.text = e;
|
|
1573
1813
|
}
|
|
1574
|
-
id =
|
|
1814
|
+
id = Oe();
|
|
1575
1815
|
isElement = () => !1;
|
|
1576
1816
|
isText = () => !0;
|
|
1577
1817
|
getText = () => this.text;
|
|
1578
1818
|
toHTML = () => this.text;
|
|
1579
1819
|
}
|
|
1580
|
-
class
|
|
1581
|
-
constructor(e, s,
|
|
1582
|
-
this.element = e, this.reference = s, this.container =
|
|
1820
|
+
class R {
|
|
1821
|
+
constructor(e, s, n, r) {
|
|
1822
|
+
this.element = e, this.reference = s, this.container = n, this.providers = r;
|
|
1583
1823
|
}
|
|
1584
1824
|
appendOrInsert = (e) => {
|
|
1585
1825
|
if (this.reference != null) {
|
|
@@ -1589,17 +1829,17 @@ class $ {
|
|
|
1589
1829
|
this.element.children.push(e);
|
|
1590
1830
|
};
|
|
1591
1831
|
makeChildElement = (e, s) => {
|
|
1592
|
-
const
|
|
1593
|
-
return this.appendOrInsert(
|
|
1594
|
-
|
|
1832
|
+
const n = new Et(e, s, this.element);
|
|
1833
|
+
return this.appendOrInsert(n), new R(
|
|
1834
|
+
n,
|
|
1595
1835
|
void 0,
|
|
1596
1836
|
this.container,
|
|
1597
1837
|
this.providers
|
|
1598
1838
|
);
|
|
1599
1839
|
};
|
|
1600
1840
|
makeChildText = (e) => {
|
|
1601
|
-
const s = new
|
|
1602
|
-
return this.appendOrInsert(s), new
|
|
1841
|
+
const s = new Ct(e);
|
|
1842
|
+
return this.appendOrInsert(s), new R(
|
|
1603
1843
|
this.element,
|
|
1604
1844
|
s,
|
|
1605
1845
|
this.container,
|
|
@@ -1612,8 +1852,8 @@ class $ {
|
|
|
1612
1852
|
getText = () => this.reference?.getText() ?? this.element.getText();
|
|
1613
1853
|
makeRef = () => this.makeChildText("");
|
|
1614
1854
|
makePortal = (e) => {
|
|
1615
|
-
const s = new
|
|
1616
|
-
return this.appendOrInsert(s), new
|
|
1855
|
+
const s = new ke(e, this.element);
|
|
1856
|
+
return this.appendOrInsert(s), new R(
|
|
1617
1857
|
s,
|
|
1618
1858
|
void 0,
|
|
1619
1859
|
this.container,
|
|
@@ -1627,15 +1867,15 @@ class $ {
|
|
|
1627
1867
|
* @param value - The provider to set for the given mark.
|
|
1628
1868
|
* @returns A new `DOMContext` instance with the specified provider.
|
|
1629
1869
|
*/
|
|
1630
|
-
setProvider = (e, s,
|
|
1870
|
+
setProvider = (e, s, n) => new R(this.element, this.reference, this.container, {
|
|
1631
1871
|
...this.providers,
|
|
1632
|
-
[e]: [s,
|
|
1872
|
+
[e]: [s, n]
|
|
1633
1873
|
});
|
|
1634
1874
|
getProvider = (e) => {
|
|
1635
1875
|
if (this.providers[e] === void 0)
|
|
1636
|
-
throw new
|
|
1637
|
-
const [s,
|
|
1638
|
-
return { value: s, onUse:
|
|
1876
|
+
throw new Pe(e);
|
|
1877
|
+
const [s, n] = this.providers[e];
|
|
1878
|
+
return { value: s, onUse: n };
|
|
1639
1879
|
};
|
|
1640
1880
|
clear = (e) => {
|
|
1641
1881
|
e && (this.reference !== void 0 ? this.element.removeChild(this.reference) : this.element.remove());
|
|
@@ -1652,48 +1892,48 @@ class $ {
|
|
|
1652
1892
|
getStyle = (e) => this.element.getStyle(e);
|
|
1653
1893
|
makeAccessors = (e) => this.element.makeAccessors(e);
|
|
1654
1894
|
}
|
|
1655
|
-
const
|
|
1895
|
+
const Dt = /* @__PURE__ */ new Set([
|
|
1656
1896
|
"checked",
|
|
1657
1897
|
"disabled",
|
|
1658
1898
|
"multiple",
|
|
1659
1899
|
"readonly",
|
|
1660
1900
|
"required",
|
|
1661
1901
|
"selected"
|
|
1662
|
-
]),
|
|
1663
|
-
const s = e.makeChildText(t.value),
|
|
1664
|
-
return (n) => {
|
|
1665
|
-
r(), s.clear(n);
|
|
1666
|
-
};
|
|
1667
|
-
}, Yt = (t) => m.is(t) ? Pe(t) : Ce(t), T = (...t) => (e) => {
|
|
1668
|
-
const s = t.map((r) => h(r)(e));
|
|
1902
|
+
]), Pt = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), Ie = (t) => (e) => e.makeChildText(t).clear, He = (t) => (e) => {
|
|
1903
|
+
const s = e.makeChildText(t.value), n = t.on(s.setText);
|
|
1669
1904
|
return (r) => {
|
|
1670
|
-
|
|
1905
|
+
n(), s.clear(r);
|
|
1906
|
+
};
|
|
1907
|
+
}, ps = (t) => g.is(t) ? He(t) : Ie(t), E = (...t) => (e) => {
|
|
1908
|
+
const s = t.map((n) => f(n)(e));
|
|
1909
|
+
return (n) => {
|
|
1910
|
+
s.forEach((r) => r(n));
|
|
1671
1911
|
};
|
|
1672
|
-
},
|
|
1673
|
-
},
|
|
1912
|
+
}, C = () => () => {
|
|
1913
|
+
}, xt = (t) => (e) => (e.addClasses(t), (s) => {
|
|
1674
1914
|
s && e.removeClasses(t);
|
|
1675
|
-
}),
|
|
1915
|
+
}), Lt = (t) => (e) => {
|
|
1676
1916
|
let s = [];
|
|
1677
|
-
const
|
|
1678
|
-
e.removeClasses(s), s = (
|
|
1917
|
+
const n = t.on((r) => {
|
|
1918
|
+
e.removeClasses(s), s = (r ?? "").split(" ").filter((i) => i.length > 0), e.addClasses(s);
|
|
1679
1919
|
});
|
|
1680
|
-
return (
|
|
1681
|
-
|
|
1920
|
+
return (r) => {
|
|
1921
|
+
n(), r && e.removeClasses(s), s.length = 0;
|
|
1682
1922
|
};
|
|
1683
|
-
},
|
|
1684
|
-
const { get:
|
|
1685
|
-
return
|
|
1686
|
-
o &&
|
|
1923
|
+
}, Ot = (t, e) => (s) => {
|
|
1924
|
+
const { get: n, set: r } = s.makeAccessors(t), i = n();
|
|
1925
|
+
return r(e), (o) => {
|
|
1926
|
+
o && r(i);
|
|
1687
1927
|
};
|
|
1688
|
-
},
|
|
1689
|
-
const { get:
|
|
1928
|
+
}, Mt = (t, e) => (s) => {
|
|
1929
|
+
const { get: n, set: r } = s.makeAccessors(t), i = n(), o = e.on(r);
|
|
1690
1930
|
return (l) => {
|
|
1691
|
-
o(), l &&
|
|
1931
|
+
o(), l && r(i);
|
|
1692
1932
|
};
|
|
1693
|
-
},
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1933
|
+
}, q = (t, e) => g.is(e) ? Mt(t, e) : Ot(t, e), kt = (t, e) => t === "class" ? g.is(e) ? Lt(e) : xt(
|
|
1934
|
+
/* c8 ignore next */
|
|
1935
|
+
(e ?? "").split(" ").filter((s) => s.length > 0)
|
|
1936
|
+
) : q(t, e), V = new Proxy(
|
|
1697
1937
|
{},
|
|
1698
1938
|
{
|
|
1699
1939
|
/**
|
|
@@ -1707,12 +1947,9 @@ const pt = /* @__PURE__ */ new Set([
|
|
|
1707
1947
|
* @returns The renderable component for the specified attribute.
|
|
1708
1948
|
*
|
|
1709
1949
|
*/
|
|
1710
|
-
get: (t, e) =>
|
|
1711
|
-
/* c8 ignore next */
|
|
1712
|
-
(s ?? "").split(" ").filter((r) => r.length > 0)
|
|
1713
|
-
) : e === "set" ? Z() : (s) => N(e, s)
|
|
1950
|
+
get: (t, e) => (s) => kt(e, s)
|
|
1714
1951
|
}
|
|
1715
|
-
),
|
|
1952
|
+
), It = (t, e) => q(`data-${t}`, e), gs = new Proxy(
|
|
1716
1953
|
{},
|
|
1717
1954
|
{
|
|
1718
1955
|
/**
|
|
@@ -1723,9 +1960,9 @@ const pt = /* @__PURE__ */ new Set([
|
|
|
1723
1960
|
* @returns The renderable component for the specified attribute.
|
|
1724
1961
|
*
|
|
1725
1962
|
*/
|
|
1726
|
-
get: (t, e) =>
|
|
1963
|
+
get: (t, e) => (s) => It(e, s)
|
|
1727
1964
|
}
|
|
1728
|
-
),
|
|
1965
|
+
), Ht = (t, e) => q(`aria-${t}`, e), ms = new Proxy(
|
|
1729
1966
|
{},
|
|
1730
1967
|
{
|
|
1731
1968
|
/**
|
|
@@ -1736,9 +1973,9 @@ const pt = /* @__PURE__ */ new Set([
|
|
|
1736
1973
|
* @returns The renderable component for the specified attribute.
|
|
1737
1974
|
*
|
|
1738
1975
|
*/
|
|
1739
|
-
get: (t, e) =>
|
|
1976
|
+
get: (t, e) => (s) => Ht(e, s)
|
|
1740
1977
|
}
|
|
1741
|
-
),
|
|
1978
|
+
), Nt = (t, e) => q(t, e), ys = new Proxy(
|
|
1742
1979
|
{},
|
|
1743
1980
|
{
|
|
1744
1981
|
/**
|
|
@@ -1749,9 +1986,9 @@ const pt = /* @__PURE__ */ new Set([
|
|
|
1749
1986
|
* @returns The renderable component for the specified attribute.
|
|
1750
1987
|
*
|
|
1751
1988
|
*/
|
|
1752
|
-
get: (t, e) =>
|
|
1989
|
+
get: (t, e) => (s) => Nt(e, s)
|
|
1753
1990
|
}
|
|
1754
|
-
),
|
|
1991
|
+
), $t = (t, e) => q(t, e), Ss = new Proxy(
|
|
1755
1992
|
{},
|
|
1756
1993
|
{
|
|
1757
1994
|
/**
|
|
@@ -1761,31 +1998,31 @@ const pt = /* @__PURE__ */ new Set([
|
|
|
1761
1998
|
* @returns The renderable component for the specified attribute.
|
|
1762
1999
|
*
|
|
1763
2000
|
*/
|
|
1764
|
-
get: (t, e) => (s) =>
|
|
2001
|
+
get: (t, e) => (s) => $t(e, s)
|
|
1765
2002
|
}
|
|
1766
|
-
),
|
|
2003
|
+
), f = (t) => {
|
|
1767
2004
|
if (t == null)
|
|
1768
|
-
return
|
|
2005
|
+
return C;
|
|
1769
2006
|
if (Array.isArray(t))
|
|
1770
|
-
return
|
|
2007
|
+
return E(...t.map(f));
|
|
1771
2008
|
if (typeof t == "string")
|
|
1772
|
-
return
|
|
1773
|
-
if (
|
|
1774
|
-
return
|
|
2009
|
+
return Ie(t);
|
|
2010
|
+
if (g.is(t))
|
|
2011
|
+
return He(t);
|
|
1775
2012
|
if (typeof t == "function")
|
|
1776
2013
|
return t;
|
|
1777
2014
|
throw new Error(`Unknown type: '${typeof t}' for child: ${t}`);
|
|
1778
|
-
},
|
|
1779
|
-
const
|
|
2015
|
+
}, Ne = (t, ...e) => (s) => {
|
|
2016
|
+
const n = s.makeChildElement(t, void 0), r = e.map((i) => f(i)(n));
|
|
1780
2017
|
return (i) => {
|
|
1781
|
-
|
|
2018
|
+
r.forEach((o) => o(!1)), n.clear(i);
|
|
1782
2019
|
};
|
|
1783
|
-
},
|
|
1784
|
-
const
|
|
2020
|
+
}, te = (t, e, ...s) => (n) => {
|
|
2021
|
+
const r = n.makeChildElement(t, e), i = s.map((o) => f(o)(r));
|
|
1785
2022
|
return (o) => {
|
|
1786
|
-
i.forEach((l) => l(!1)),
|
|
2023
|
+
i.forEach((l) => l(!1)), r.clear(o);
|
|
1787
2024
|
};
|
|
1788
|
-
},
|
|
2025
|
+
}, ws = new Proxy(
|
|
1789
2026
|
{},
|
|
1790
2027
|
{
|
|
1791
2028
|
/**
|
|
@@ -1793,9 +2030,9 @@ const pt = /* @__PURE__ */ new Set([
|
|
|
1793
2030
|
* @param tagName - The HTML tag name.
|
|
1794
2031
|
* @returns A renderable function that creates and appends the HTML element to the DOM.
|
|
1795
2032
|
*/
|
|
1796
|
-
get: (t, e) => (...s) =>
|
|
2033
|
+
get: (t, e) => (...s) => Ne(e, s.flatMap(f))
|
|
1797
2034
|
}
|
|
1798
|
-
),
|
|
2035
|
+
), bs = new Proxy(
|
|
1799
2036
|
{},
|
|
1800
2037
|
{
|
|
1801
2038
|
/**
|
|
@@ -1803,9 +2040,9 @@ const pt = /* @__PURE__ */ new Set([
|
|
|
1803
2040
|
* @param type - The input type name.
|
|
1804
2041
|
* @returns A renderable function that creates and appends the HTMLInput element to the DOM.
|
|
1805
2042
|
*/
|
|
1806
|
-
get: (t, e) => (...s) =>
|
|
2043
|
+
get: (t, e) => (...s) => Ne("input", V.type(e), ...s)
|
|
1807
2044
|
}
|
|
1808
|
-
),
|
|
2045
|
+
), $e = "http://www.w3.org/2000/svg", _s = (t, ...e) => te(t, $e, ...e), vs = new Proxy(
|
|
1809
2046
|
{},
|
|
1810
2047
|
{
|
|
1811
2048
|
/**
|
|
@@ -1813,9 +2050,9 @@ const pt = /* @__PURE__ */ new Set([
|
|
|
1813
2050
|
* @param tagName - The SVG tag name.
|
|
1814
2051
|
* @returns A renderable function that creates and appends the SVG element to the DOM.
|
|
1815
2052
|
*/
|
|
1816
|
-
get: (t, e) => (...s) =>
|
|
2053
|
+
get: (t, e) => (...s) => te(e, $e, s.flatMap(f))
|
|
1817
2054
|
}
|
|
1818
|
-
),
|
|
2055
|
+
), Re = "http://www.w3.org/1998/Math/MathML", Ts = (t, ...e) => te(t, Re, ...e), As = new Proxy(
|
|
1819
2056
|
{},
|
|
1820
2057
|
{
|
|
1821
2058
|
/**
|
|
@@ -1823,35 +2060,35 @@ const pt = /* @__PURE__ */ new Set([
|
|
|
1823
2060
|
* @param tagName - The Math tag name.
|
|
1824
2061
|
* @returns A renderable function that creates and appends the Math element to the DOM.
|
|
1825
2062
|
*/
|
|
1826
|
-
get: (t, e) => (...s) =>
|
|
2063
|
+
get: (t, e) => (...s) => te(e, Re, s.flatMap(f))
|
|
1827
2064
|
}
|
|
1828
|
-
),
|
|
2065
|
+
), Ve = (t, e) => {
|
|
1829
2066
|
if (typeof e == "function")
|
|
1830
|
-
return
|
|
1831
|
-
const s = e.pending != null ?
|
|
2067
|
+
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;
|
|
1832
2069
|
return (i) => {
|
|
1833
2070
|
let o = !0;
|
|
1834
2071
|
const l = t(), c = i.makeRef();
|
|
1835
|
-
let a =
|
|
2072
|
+
let a = f(s)(c);
|
|
1836
2073
|
return l.then(
|
|
1837
2074
|
(u) => {
|
|
1838
|
-
o && (a(!0), a =
|
|
2075
|
+
o && (a(!0), a = f(n(u))(c));
|
|
1839
2076
|
},
|
|
1840
2077
|
(u) => {
|
|
1841
|
-
o && (a(!0), a =
|
|
2078
|
+
o && (a(!0), a = f(r(u))(c));
|
|
1842
2079
|
}
|
|
1843
2080
|
), (u) => {
|
|
1844
2081
|
o = !1, a(u), c.clear(u);
|
|
1845
2082
|
};
|
|
1846
2083
|
};
|
|
1847
|
-
},
|
|
2084
|
+
}, Es = (t, e) => Ve(() => t, e), je = (t, e, s) => (n) => n.on(t, e, s), Rt = (t) => je("click", (e, s) => {
|
|
1848
2085
|
e.preventDefault();
|
|
1849
|
-
const
|
|
2086
|
+
const n = e.target;
|
|
1850
2087
|
setTimeout(() => {
|
|
1851
|
-
const
|
|
1852
|
-
|
|
2088
|
+
const r = n.ownerDocument != null ? n?.checked : void 0;
|
|
2089
|
+
r != null && t(!r, s);
|
|
1853
2090
|
}, 0);
|
|
1854
|
-
}),
|
|
2091
|
+
}), se = new Proxy(
|
|
1855
2092
|
{},
|
|
1856
2093
|
{
|
|
1857
2094
|
/**
|
|
@@ -1859,334 +2096,331 @@ const pt = /* @__PURE__ */ new Set([
|
|
|
1859
2096
|
* @param fn - The function to call when the event is triggered.
|
|
1860
2097
|
* @returns A `Renderable` function that adds the event listener to the element.
|
|
1861
2098
|
*/
|
|
1862
|
-
get: (t, e) => (s) =>
|
|
2099
|
+
get: (t, e) => (s) => je(e, s)
|
|
1863
2100
|
}
|
|
1864
|
-
),
|
|
2101
|
+
), Vt = (t, e) => (s) => {
|
|
1865
2102
|
e?.preventDefault === !0 && s.preventDefault(), e?.stopPropagation === !0 && s.stopPropagation(), e?.stopImmediatePropagation === !0 && s.stopImmediatePropagation(), t(s);
|
|
1866
|
-
},
|
|
1867
|
-
const
|
|
1868
|
-
t(
|
|
1869
|
-
}, e),
|
|
1870
|
-
(s,
|
|
2103
|
+
}, O = (t, e) => Vt((s) => {
|
|
2104
|
+
const n = s.target;
|
|
2105
|
+
t(n, s);
|
|
2106
|
+
}, e), jt = (t, e) => O(
|
|
2107
|
+
(s, n) => t(s.value, n),
|
|
1871
2108
|
e
|
|
1872
|
-
),
|
|
1873
|
-
(s,
|
|
2109
|
+
), qt = (t, e) => O(
|
|
2110
|
+
(s, n) => t(s.valueAsNumber, n),
|
|
1874
2111
|
e
|
|
1875
|
-
),
|
|
2112
|
+
), Ft = (t, e) => O((s, n) => {
|
|
1876
2113
|
if (s.value === "")
|
|
1877
2114
|
return;
|
|
1878
|
-
const
|
|
1879
|
-
Number(
|
|
1880
|
-
Number(
|
|
1881
|
-
Number(
|
|
2115
|
+
const r = s.value.split("-"), i = new Date(
|
|
2116
|
+
Number(r[0]),
|
|
2117
|
+
Number(r[1]) - 1,
|
|
2118
|
+
Number(r[2].substring(0, 2))
|
|
1882
2119
|
);
|
|
1883
|
-
t(i,
|
|
1884
|
-
}, e),
|
|
2120
|
+
t(i, n);
|
|
2121
|
+
}, e), Cs = (t, e) => O((s, n) => {
|
|
1885
2122
|
if (s.value === "") {
|
|
1886
|
-
t(null,
|
|
2123
|
+
t(null, n);
|
|
1887
2124
|
return;
|
|
1888
2125
|
}
|
|
1889
|
-
const
|
|
1890
|
-
Number(
|
|
1891
|
-
Number(
|
|
1892
|
-
Number(
|
|
2126
|
+
const r = s.value.split("-"), i = new Date(
|
|
2127
|
+
Number(r[0]),
|
|
2128
|
+
Number(r[1]) - 1,
|
|
2129
|
+
Number(r[2].substring(0, 2))
|
|
1893
2130
|
);
|
|
1894
|
-
t(i,
|
|
1895
|
-
}, e),
|
|
2131
|
+
t(i, n);
|
|
2132
|
+
}, e), Bt = (t, e) => O((s, n) => {
|
|
1896
2133
|
if (s.value === "")
|
|
1897
2134
|
return;
|
|
1898
|
-
const
|
|
2135
|
+
const r = s.value.split("T"), i = r[0].split("-"), o = new Date(
|
|
1899
2136
|
Number(i[0]),
|
|
1900
2137
|
Number(i[1]) - 1,
|
|
1901
2138
|
Number(i[2])
|
|
1902
|
-
), l =
|
|
1903
|
-
o.setHours(Number(l[0])), o.setMinutes(Number(l[1])), o.setSeconds(Number(l[2])), t(o,
|
|
1904
|
-
}, e),
|
|
2139
|
+
), l = r[1].split(":");
|
|
2140
|
+
o.setHours(Number(l[0])), o.setMinutes(Number(l[1])), o.setSeconds(Number(l[2])), t(o, n);
|
|
2141
|
+
}, e), Ds = (t, e) => O((s, n) => {
|
|
1905
2142
|
if (s.value === "") {
|
|
1906
|
-
t(null,
|
|
2143
|
+
t(null, n);
|
|
1907
2144
|
return;
|
|
1908
2145
|
}
|
|
1909
|
-
const
|
|
1910
|
-
if (
|
|
1911
|
-
t(null,
|
|
2146
|
+
const r = s.value.split("T");
|
|
2147
|
+
if (r.length !== 2) {
|
|
2148
|
+
t(null, n);
|
|
1912
2149
|
return;
|
|
1913
2150
|
}
|
|
1914
|
-
const i =
|
|
2151
|
+
const i = r[0].split("-"), o = new Date(
|
|
1915
2152
|
Number(i[0]),
|
|
1916
2153
|
Number(i[1]) - 1,
|
|
1917
2154
|
Number(i[2])
|
|
1918
|
-
), l =
|
|
1919
|
-
o.setHours(Number(l[0] ?? 0)), o.setMinutes(Number(l[1] ?? 0)), o.setSeconds(Number(l[2] ?? 0)), t(o,
|
|
1920
|
-
}, e),
|
|
1921
|
-
t(s.checked,
|
|
1922
|
-
}, e),
|
|
1923
|
-
const
|
|
1924
|
-
let
|
|
1925
|
-
};
|
|
1926
|
-
const
|
|
1927
|
-
|
|
2155
|
+
), 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) => {
|
|
2158
|
+
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) => {
|
|
2160
|
+
const n = t.makeRef();
|
|
2161
|
+
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
|
+
);
|
|
1928
2168
|
});
|
|
1929
|
-
return (
|
|
1930
|
-
|
|
2169
|
+
return (l) => {
|
|
2170
|
+
i?.dispose(), r(l), o(), n.clear(l);
|
|
1931
2171
|
};
|
|
1932
|
-
},
|
|
1933
|
-
function s(
|
|
2172
|
+
}, ne = (t, e) => {
|
|
2173
|
+
function s(r) {
|
|
1934
2174
|
return (i) => {
|
|
1935
2175
|
const o = i.makeRef();
|
|
1936
2176
|
let l, c;
|
|
1937
|
-
const a =
|
|
2177
|
+
const a = r.map((p) => Object.keys(p)[0]);
|
|
1938
2178
|
let u;
|
|
1939
|
-
const
|
|
1940
|
-
if (
|
|
1941
|
-
u =
|
|
1942
|
-
const
|
|
1943
|
-
l =
|
|
2179
|
+
const h = a.on((p) => {
|
|
2180
|
+
if (p !== u) {
|
|
2181
|
+
u = p, c?.dispose(), l?.(!0), c = r.map((m) => m[p]);
|
|
2182
|
+
const d = e[p](c);
|
|
2183
|
+
l = f(d)(o);
|
|
1944
2184
|
}
|
|
1945
2185
|
});
|
|
1946
|
-
return (
|
|
1947
|
-
c?.dispose(),
|
|
2186
|
+
return (p) => {
|
|
2187
|
+
c?.dispose(), h(), o.clear(p), l?.(p);
|
|
1948
2188
|
};
|
|
1949
2189
|
};
|
|
1950
2190
|
}
|
|
1951
|
-
function r
|
|
1952
|
-
const i = Object.keys(
|
|
1953
|
-
return
|
|
2191
|
+
function n(r) {
|
|
2192
|
+
const i = Object.keys(r)[0];
|
|
2193
|
+
return f(e[i](K(r[i])));
|
|
1954
2194
|
}
|
|
1955
|
-
return
|
|
1956
|
-
},
|
|
1957
|
-
y.map(t, (
|
|
2195
|
+
return fe(t, s, n);
|
|
2196
|
+
}, qe = (t, e, s) => ne(
|
|
2197
|
+
y.map(t, (n) => ({ [n[e]]: n })),
|
|
1958
2198
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1959
2199
|
s
|
|
1960
|
-
),
|
|
1961
|
-
const s = y.map(t, ([
|
|
1962
|
-
return
|
|
1963
|
-
},
|
|
2200
|
+
), Is = (t, e) => qe(t, "kind", e), Hs = (t, e) => {
|
|
2201
|
+
const s = y.map(t, ([n, r]) => ({ [n]: r }));
|
|
2202
|
+
return ne(s, e);
|
|
2203
|
+
}, Ns = (t, e) => qe(t, "type", e), Ut = (t, e) => ne(
|
|
1964
2204
|
y.map(t, (s) => ({ [s]: !0 })),
|
|
1965
2205
|
e
|
|
1966
|
-
),
|
|
1967
|
-
const
|
|
1968
|
-
return
|
|
2206
|
+
), $s = (t, e = {}) => (s) => {
|
|
2207
|
+
const n = e?.firstSeparator ?? t, r = e?.lastSeparator ?? t;
|
|
2208
|
+
return Ut(
|
|
1969
2209
|
s.map((i) => i.isFirst ? "first" : i.isLast ? "last" : "other"),
|
|
1970
2210
|
{
|
|
1971
|
-
first:
|
|
1972
|
-
last:
|
|
2211
|
+
first: n,
|
|
2212
|
+
last: r,
|
|
1973
2213
|
other: t
|
|
1974
2214
|
}
|
|
1975
2215
|
);
|
|
1976
|
-
},
|
|
1977
|
-
s &&
|
|
1978
|
-
}),
|
|
1979
|
-
function
|
|
2216
|
+
}, Rs = (t) => (e) => (e.appendOrInsert(t), (s) => {
|
|
2217
|
+
s && U(t);
|
|
2218
|
+
}), Vs = (t, e, s) => {
|
|
2219
|
+
function n(i) {
|
|
1980
2220
|
return (o) => {
|
|
1981
2221
|
const l = o.makeRef();
|
|
1982
2222
|
let c = () => {
|
|
1983
2223
|
}, a = !1, u = null;
|
|
1984
|
-
const
|
|
1985
|
-
|
|
2224
|
+
const h = i.on((p) => {
|
|
2225
|
+
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))(
|
|
1986
2226
|
l
|
|
1987
2227
|
), a = !0);
|
|
1988
2228
|
});
|
|
1989
|
-
return (
|
|
1990
|
-
u?.dispose(),
|
|
2229
|
+
return (p) => {
|
|
2230
|
+
u?.dispose(), h(), c?.(p), l.clear(p);
|
|
1991
2231
|
};
|
|
1992
2232
|
};
|
|
1993
2233
|
}
|
|
1994
|
-
function
|
|
2234
|
+
function r(i) {
|
|
1995
2235
|
if (i == null) {
|
|
1996
2236
|
const o = s?.();
|
|
1997
|
-
return o != null ?
|
|
2237
|
+
return o != null ? f(o) : C;
|
|
1998
2238
|
}
|
|
1999
|
-
return
|
|
2239
|
+
return f(e(K(i)));
|
|
2000
2240
|
}
|
|
2001
|
-
return
|
|
2241
|
+
return fe(
|
|
2002
2242
|
t,
|
|
2003
|
-
|
|
2004
|
-
|
|
2243
|
+
n,
|
|
2244
|
+
r
|
|
2005
2245
|
);
|
|
2006
|
-
},
|
|
2007
|
-
const
|
|
2246
|
+
}, js = (...t) => (e, s) => (n) => {
|
|
2247
|
+
const r = n.makeRef();
|
|
2008
2248
|
if (t.some(
|
|
2009
|
-
(
|
|
2249
|
+
(d) => !g.is(d) && d == null
|
|
2010
2250
|
))
|
|
2011
|
-
return (s != null ?
|
|
2012
|
-
|
|
2251
|
+
return (s != null ? f(s?.()) : C)(
|
|
2252
|
+
r
|
|
2013
2253
|
);
|
|
2014
2254
|
const o = t.map(() => null), l = t.map(
|
|
2015
|
-
(
|
|
2255
|
+
(d) => g.is(d) ? d.value != null : d != null
|
|
2016
2256
|
);
|
|
2017
2257
|
let c = null;
|
|
2018
|
-
const a =
|
|
2019
|
-
if (
|
|
2020
|
-
if (o[
|
|
2021
|
-
const w =
|
|
2022
|
-
o[
|
|
2258
|
+
const a = T(l.every((d) => d)), u = (d, m) => {
|
|
2259
|
+
if (d.value != null) {
|
|
2260
|
+
if (o[m] == null) {
|
|
2261
|
+
const w = T(d.value);
|
|
2262
|
+
o[m] = w;
|
|
2023
2263
|
} else
|
|
2024
|
-
o[
|
|
2025
|
-
l[
|
|
2264
|
+
o[m].value = d.value;
|
|
2265
|
+
l[m] = !0;
|
|
2026
2266
|
} else
|
|
2027
|
-
l[
|
|
2267
|
+
l[m] = !1;
|
|
2028
2268
|
};
|
|
2029
|
-
let
|
|
2030
|
-
const
|
|
2031
|
-
if (!
|
|
2032
|
-
const w =
|
|
2033
|
-
return o[
|
|
2269
|
+
let h = t.length - 1;
|
|
2270
|
+
const p = t.map((d, m) => {
|
|
2271
|
+
if (!g.is(d)) {
|
|
2272
|
+
const w = T(d);
|
|
2273
|
+
return o[m] = w, () => {
|
|
2034
2274
|
};
|
|
2035
2275
|
}
|
|
2036
|
-
return
|
|
2037
|
-
u(
|
|
2276
|
+
return d.on(() => {
|
|
2277
|
+
u(d, m), h === 0 ? a.value = l.every((w) => w) : h--;
|
|
2038
2278
|
});
|
|
2039
2279
|
});
|
|
2040
|
-
return a.on((
|
|
2041
|
-
c?.(!0), c = null,
|
|
2042
|
-
}), (
|
|
2043
|
-
o.forEach((
|
|
2044
|
-
};
|
|
2045
|
-
},
|
|
2046
|
-
typeof r == "function" ? r(s, e) : r.dispose(s, e);
|
|
2047
|
-
}), Ie = (t, e, s) => le(
|
|
2280
|
+
return a.on((d) => {
|
|
2281
|
+
c?.(!0), c = null, d ? c = f(e(...o))(r) : c = f(s?.() ?? C)(r);
|
|
2282
|
+
}), (d) => {
|
|
2283
|
+
o.forEach((m) => m?.dispose()), a.dispose(), p.forEach((m) => m()), c?.(d), r.clear(d);
|
|
2284
|
+
};
|
|
2285
|
+
}, Fe = (t, e, s) => fe(
|
|
2048
2286
|
t,
|
|
2049
|
-
(
|
|
2050
|
-
n,
|
|
2287
|
+
(n) => (r) => Wt(
|
|
2051
2288
|
r,
|
|
2289
|
+
n,
|
|
2052
2290
|
(i) => i ? e() : s?.()
|
|
2053
2291
|
),
|
|
2054
|
-
(
|
|
2055
|
-
if (
|
|
2056
|
-
const
|
|
2057
|
-
return
|
|
2292
|
+
(n) => {
|
|
2293
|
+
if (n) {
|
|
2294
|
+
const r = e();
|
|
2295
|
+
return r != null ? f(r) : C;
|
|
2058
2296
|
}
|
|
2059
|
-
return
|
|
2297
|
+
return f(s?.());
|
|
2060
2298
|
}
|
|
2061
|
-
),
|
|
2062
|
-
y.map(t, (
|
|
2299
|
+
), qs = (t, e, s) => Fe(
|
|
2300
|
+
y.map(t, (n) => !n),
|
|
2063
2301
|
e,
|
|
2064
2302
|
s
|
|
2065
|
-
),
|
|
2303
|
+
), Be = (t, e, s) => {
|
|
2066
2304
|
if (s != null)
|
|
2067
|
-
return
|
|
2068
|
-
const
|
|
2069
|
-
|
|
2070
|
-
|
|
2305
|
+
return Be(t, (n) => {
|
|
2306
|
+
const r = new le(
|
|
2307
|
+
n.index,
|
|
2308
|
+
n.total.map((i) => i - 1)
|
|
2071
2309
|
);
|
|
2072
|
-
return
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
() =>
|
|
2078
|
-
() => s(n)
|
|
2310
|
+
return E(
|
|
2311
|
+
f(e(n)),
|
|
2312
|
+
Fe(
|
|
2313
|
+
n.isLast,
|
|
2314
|
+
() => C,
|
|
2315
|
+
() => s(r)
|
|
2079
2316
|
)
|
|
2080
2317
|
);
|
|
2081
2318
|
});
|
|
2082
|
-
if (
|
|
2083
|
-
return (
|
|
2084
|
-
const
|
|
2085
|
-
return
|
|
2086
|
-
const
|
|
2087
|
-
for (const
|
|
2088
|
-
|
|
2089
|
-
for (
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
)(i)
|
|
2319
|
+
if (g.is(t))
|
|
2320
|
+
return (n) => {
|
|
2321
|
+
const r = t.derive(), i = n.makeRef(), o = [], l = [];
|
|
2322
|
+
return r.on((c) => {
|
|
2323
|
+
const a = o.splice(c), u = l.splice(c);
|
|
2324
|
+
for (const h of u)
|
|
2325
|
+
h.dispose();
|
|
2326
|
+
for (const h of a)
|
|
2327
|
+
h(!0);
|
|
2328
|
+
for (let h = o.length; h < c; h++) {
|
|
2329
|
+
const p = new le(h, r), d = new j();
|
|
2330
|
+
l.push(d), o.push(
|
|
2331
|
+
L(d, () => f(e(p))(i))
|
|
2096
2332
|
);
|
|
2097
2333
|
}
|
|
2098
|
-
}), (
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2334
|
+
}), (c) => {
|
|
2335
|
+
for (const a of l)
|
|
2336
|
+
a.dispose();
|
|
2337
|
+
l.length = 0, r.dispose();
|
|
2338
|
+
for (const a of o)
|
|
2339
|
+
a(c);
|
|
2340
|
+
o.length = 0, i.clear(c);
|
|
2103
2341
|
};
|
|
2104
2342
|
};
|
|
2105
2343
|
{
|
|
2106
|
-
const
|
|
2107
|
-
return
|
|
2108
|
-
...Array.from({ length: t }, (
|
|
2109
|
-
const i = new
|
|
2110
|
-
return
|
|
2111
|
-
V(i.dispose),
|
|
2112
|
-
h(e(i))
|
|
2113
|
-
);
|
|
2344
|
+
const n = K(t);
|
|
2345
|
+
return E(
|
|
2346
|
+
...Array.from({ length: t }, (r, i) => i).map((r) => {
|
|
2347
|
+
const i = new le(r, n);
|
|
2348
|
+
return f(e(i));
|
|
2114
2349
|
})
|
|
2115
2350
|
);
|
|
2116
2351
|
}
|
|
2117
|
-
},
|
|
2118
|
-
const
|
|
2119
|
-
return
|
|
2120
|
-
|
|
2352
|
+
}, Fs = (t, e, s) => {
|
|
2353
|
+
const n = y.map(t, (i) => i.length), r = y.toSignal(t);
|
|
2354
|
+
return Be(
|
|
2355
|
+
n,
|
|
2121
2356
|
(i) => {
|
|
2122
|
-
const o =
|
|
2123
|
-
return
|
|
2124
|
-
V(o.dispose),
|
|
2125
|
-
h(e(o, i))
|
|
2126
|
-
);
|
|
2357
|
+
const o = r.map((l) => l[i.index]);
|
|
2358
|
+
return f(e(o, i));
|
|
2127
2359
|
},
|
|
2128
2360
|
s
|
|
2129
2361
|
);
|
|
2130
|
-
},
|
|
2131
|
-
|
|
2362
|
+
}, Gt = (...t) => (e) => (s) => t.forEach((n) => {
|
|
2363
|
+
typeof n == "function" ? n(s, e) : n.dispose(s, e);
|
|
2364
|
+
}), Bs = (t, e) => {
|
|
2365
|
+
if (g.is(t)) {
|
|
2132
2366
|
const s = t;
|
|
2133
|
-
return (
|
|
2134
|
-
|
|
2135
|
-
const
|
|
2367
|
+
return (n) => {
|
|
2368
|
+
n = n.makeRef();
|
|
2369
|
+
const r = s.map((l) => f(e(l)));
|
|
2136
2370
|
let i = () => {
|
|
2137
2371
|
};
|
|
2138
|
-
const o =
|
|
2139
|
-
i(!0), i = l(
|
|
2372
|
+
const o = r.on((l) => {
|
|
2373
|
+
i(!0), i = l(n);
|
|
2140
2374
|
});
|
|
2141
2375
|
return (l) => {
|
|
2142
2376
|
o(), i(l);
|
|
2143
2377
|
};
|
|
2144
2378
|
};
|
|
2145
2379
|
}
|
|
2146
|
-
return
|
|
2147
|
-
},
|
|
2380
|
+
return f(e(t));
|
|
2381
|
+
}, Ws = (t, e, s = () => C) => ne(
|
|
2148
2382
|
y.map(
|
|
2149
2383
|
t,
|
|
2150
|
-
(
|
|
2384
|
+
(n) => n.length > 0 ? { notEmpty: n } : { whenEmpty: null }
|
|
2151
2385
|
),
|
|
2152
2386
|
{
|
|
2153
|
-
notEmpty: (
|
|
2387
|
+
notEmpty: (n) => e(n),
|
|
2154
2388
|
whenEmpty: () => s()
|
|
2155
2389
|
}
|
|
2156
|
-
),
|
|
2157
|
-
const
|
|
2158
|
-
return () =>
|
|
2159
|
-
},
|
|
2160
|
-
mark:
|
|
2390
|
+
), Us = (t, e) => (s) => {
|
|
2391
|
+
const n = s.makePortal(t), r = he(f(e), n);
|
|
2392
|
+
return () => r(!0);
|
|
2393
|
+
}, W = /* @__PURE__ */ new Map(), Jt = (t) => ({
|
|
2394
|
+
mark: at(`Probe(${t.description})`),
|
|
2161
2395
|
create: ({ callback: e = () => {
|
|
2162
2396
|
}, timeout: s = 10 } = {}) => {
|
|
2163
|
-
const
|
|
2164
|
-
clearTimeout(
|
|
2397
|
+
const n = (l) => {
|
|
2398
|
+
clearTimeout(r), W.delete(t), e(l);
|
|
2165
2399
|
};
|
|
2166
|
-
if (
|
|
2400
|
+
if (W.has(t))
|
|
2167
2401
|
throw new Error(`Probe already exists: ${t.description}`);
|
|
2168
|
-
const
|
|
2169
|
-
return
|
|
2402
|
+
const r = setTimeout(() => n("timeout"), s), i = { counter: 0, timeoutId: r };
|
|
2403
|
+
return W.set(t, i), {
|
|
2170
2404
|
value: () => {
|
|
2171
|
-
clearTimeout(
|
|
2172
|
-
const l =
|
|
2173
|
-
l != null && --l.counter === 0 &&
|
|
2405
|
+
clearTimeout(r);
|
|
2406
|
+
const l = W.get(t);
|
|
2407
|
+
l != null && --l.counter === 0 && n("resolved");
|
|
2174
2408
|
},
|
|
2175
|
-
dispose: () =>
|
|
2409
|
+
dispose: () => n("disposed"),
|
|
2176
2410
|
onUse: () => i.counter++
|
|
2177
2411
|
};
|
|
2178
2412
|
}
|
|
2179
|
-
}),
|
|
2180
|
-
const
|
|
2181
|
-
return s.setStyle(t, e), (
|
|
2182
|
-
|
|
2413
|
+
}), Gs = Jt(Symbol("GlobalProbe")), Xt = (t, e) => (s) => {
|
|
2414
|
+
const n = s.getStyle(t);
|
|
2415
|
+
return s.setStyle(t, e), (r) => {
|
|
2416
|
+
r && s.setStyle(t, n);
|
|
2183
2417
|
};
|
|
2184
|
-
},
|
|
2185
|
-
const
|
|
2418
|
+
}, Yt = (t, e) => (s) => {
|
|
2419
|
+
const n = s.getStyle(t), r = e.on((i) => s.setStyle(t, i));
|
|
2186
2420
|
return (i) => {
|
|
2187
|
-
|
|
2421
|
+
r(), i && s.setStyle(t, n);
|
|
2188
2422
|
};
|
|
2189
|
-
},
|
|
2423
|
+
}, me = (t, e) => g.is(e) ? Yt(t, e) : Xt(t, e), Js = new Proxy({}, {
|
|
2190
2424
|
/**
|
|
2191
2425
|
* Creates a renderable component for the specified `style` property.
|
|
2192
2426
|
*
|
|
@@ -2195,168 +2429,191 @@ const pt = /* @__PURE__ */ new Set([
|
|
|
2195
2429
|
* @returns The renderable component for the specified attribute.
|
|
2196
2430
|
*
|
|
2197
2431
|
*/
|
|
2198
|
-
get: (t, e) => e === "variable" ? (s,
|
|
2199
|
-
}),
|
|
2432
|
+
get: (t, e) => e === "variable" ? (s, n) => me(s, n) : (s) => me(e, s)
|
|
2433
|
+
}), Qt = (t) => (e) => {
|
|
2200
2434
|
if (e.isBrowser()) {
|
|
2201
2435
|
const s = t(e);
|
|
2202
2436
|
if (s != null)
|
|
2203
|
-
return
|
|
2437
|
+
return f(s)(e);
|
|
2204
2438
|
}
|
|
2205
2439
|
return () => {
|
|
2206
2440
|
};
|
|
2207
|
-
},
|
|
2441
|
+
}, Xs = (t) => (e) => {
|
|
2208
2442
|
const s = t(e);
|
|
2209
2443
|
return s == null ? () => {
|
|
2210
|
-
} :
|
|
2211
|
-
},
|
|
2444
|
+
} : f(s)(e);
|
|
2445
|
+
}, Ys = (t) => Qt((e) => t(e.element)), Qs = (t) => (e) => {
|
|
2212
2446
|
if (e.isHeadlessDOM()) {
|
|
2213
2447
|
const s = t(e);
|
|
2214
2448
|
if (s)
|
|
2215
|
-
return
|
|
2449
|
+
return f(s)(e);
|
|
2216
2450
|
}
|
|
2217
2451
|
return () => {
|
|
2218
2452
|
};
|
|
2219
|
-
},
|
|
2453
|
+
}, Zs = (t) => (e) => {
|
|
2454
|
+
const s = new j(), n = L(s, () => f(t(s))(e));
|
|
2455
|
+
return (r) => {
|
|
2456
|
+
s.dispose(), n(r);
|
|
2457
|
+
};
|
|
2458
|
+
}, de = (t) => (e) => {
|
|
2220
2459
|
let s = e;
|
|
2221
|
-
function
|
|
2460
|
+
function n() {
|
|
2222
2461
|
return s;
|
|
2223
2462
|
}
|
|
2224
|
-
function
|
|
2463
|
+
function r(l) {
|
|
2225
2464
|
s = l;
|
|
2226
2465
|
}
|
|
2227
2466
|
const i = [], o = t({
|
|
2228
2467
|
use: ({ mark: l }) => {
|
|
2229
|
-
const { value: c, onUse: a } =
|
|
2468
|
+
const { value: c, onUse: a } = n().getProvider(l);
|
|
2230
2469
|
return a?.(), c;
|
|
2231
2470
|
},
|
|
2232
2471
|
set: ({ mark: l, create: c }, a) => {
|
|
2233
|
-
const { value: u, dispose:
|
|
2234
|
-
i.push(
|
|
2472
|
+
const { value: u, dispose: h, onUse: p } = c(a, n());
|
|
2473
|
+
i.push(h), r(n().setProvider(l, u, p));
|
|
2235
2474
|
}
|
|
2236
2475
|
});
|
|
2237
2476
|
return o == null ? () => {
|
|
2238
|
-
} :
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
)(
|
|
2242
|
-
},
|
|
2243
|
-
const
|
|
2244
|
-
return e(...
|
|
2477
|
+
} : E(
|
|
2478
|
+
f(o),
|
|
2479
|
+
Gt(() => i.forEach((l) => l()))
|
|
2480
|
+
)(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 }) => {
|
|
2482
|
+
const n = t.map(s);
|
|
2483
|
+
return e(...n);
|
|
2245
2484
|
});
|
|
2246
2485
|
export {
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2486
|
+
Ht as Aria,
|
|
2487
|
+
Es as Async,
|
|
2488
|
+
kt as Attr,
|
|
2489
|
+
ks as BindChecked,
|
|
2490
|
+
xs as BindDate,
|
|
2491
|
+
Ls as BindDateTime,
|
|
2492
|
+
Os as BindNumber,
|
|
2493
|
+
Ms as BindText,
|
|
2494
|
+
$ as BrowserContext,
|
|
2495
|
+
G as CLASS_PLACEHOLDER_ATTR,
|
|
2496
|
+
N as Computed,
|
|
2497
|
+
$s as Conjunction,
|
|
2498
|
+
Rs as DOMNode,
|
|
2499
|
+
It as DataAttr,
|
|
2500
|
+
j as DisposalScope,
|
|
2501
|
+
Ne as El,
|
|
2502
|
+
te as ElNS,
|
|
2503
|
+
le as ElementPosition,
|
|
2504
|
+
C as Empty,
|
|
2505
|
+
Vs as Ensure,
|
|
2506
|
+
js as EnsureAll,
|
|
2507
|
+
Fs as ForEach,
|
|
2508
|
+
E as Fragment,
|
|
2509
|
+
Gs as GlobalProbe,
|
|
2510
|
+
fs as HeadlessAdapter,
|
|
2511
|
+
R as HeadlessContext,
|
|
2512
|
+
Et as HeadlessElement,
|
|
2513
|
+
ke as HeadlessPortal,
|
|
2514
|
+
Ct as HeadlessText,
|
|
2515
|
+
Bs as MapSignal,
|
|
2516
|
+
$t as MathAttr,
|
|
2517
|
+
Ts as MathEl,
|
|
2518
|
+
be as MemoryStore,
|
|
2519
|
+
Ws as NotEmpty,
|
|
2520
|
+
Rt as OnChecked,
|
|
2521
|
+
Gt as OnDispose,
|
|
2522
|
+
ne as OneOf,
|
|
2523
|
+
qe as OneOfField,
|
|
2524
|
+
Is as OneOfKind,
|
|
2525
|
+
Hs as OneOfTuple,
|
|
2526
|
+
Ns as OneOfType,
|
|
2527
|
+
Ut as OneOfValue,
|
|
2528
|
+
Us as Portal,
|
|
2529
|
+
Z as Prop,
|
|
2530
|
+
zs as Provide,
|
|
2531
|
+
Pe as ProviderNotFoundError,
|
|
2532
|
+
ut as RenderingError,
|
|
2533
|
+
Be as Repeat,
|
|
2534
|
+
Nt as SVGAttr,
|
|
2535
|
+
_s as SVGEl,
|
|
2536
|
+
g as Signal,
|
|
2537
|
+
Ve as Task,
|
|
2538
|
+
ps as TextNode,
|
|
2539
|
+
qs as Unless,
|
|
2540
|
+
Ks as Use,
|
|
2541
|
+
en as UseMany,
|
|
2295
2542
|
y as Value,
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2543
|
+
Fe as When,
|
|
2544
|
+
Qt as WithBrowserCtx,
|
|
2545
|
+
Xs as WithCtx,
|
|
2546
|
+
Ys as WithElement,
|
|
2547
|
+
Qs as WithHeadlessCtx,
|
|
2548
|
+
de as WithProvider,
|
|
2549
|
+
Zs as WithScope,
|
|
2550
|
+
xe as _NODE_PLACEHOLDER_ATTR,
|
|
2551
|
+
ct as _getSelfOrParentElement,
|
|
2552
|
+
De as _isElement,
|
|
2553
|
+
lt as _makeGetter,
|
|
2554
|
+
ot as _makeSetter,
|
|
2555
|
+
U as _removeDOMNode,
|
|
2556
|
+
He as _signalText,
|
|
2557
|
+
Ie as _staticText,
|
|
2558
|
+
ns as animateSignal,
|
|
2559
|
+
rt as animateSignals,
|
|
2560
|
+
ms as aria,
|
|
2561
|
+
V as attr,
|
|
2562
|
+
cs as bind,
|
|
2563
|
+
as as coalesce,
|
|
2564
|
+
z as computed,
|
|
2565
|
+
ee as computedOf,
|
|
2566
|
+
it as computedRecord,
|
|
2567
|
+
gs as dataAttr,
|
|
2568
|
+
is as delaySignal,
|
|
2569
|
+
Se as effect,
|
|
2570
|
+
Qe as effectOf,
|
|
2571
|
+
Vt as emit,
|
|
2572
|
+
Ps as emitChecked,
|
|
2573
|
+
O as emitTarget,
|
|
2574
|
+
jt as emitValue,
|
|
2575
|
+
Ft as emitValueAsDate,
|
|
2576
|
+
Bt as emitValueAsDateTime,
|
|
2577
|
+
Cs as emitValueAsNullableDate,
|
|
2578
|
+
Ds as emitValueAsNullableDateTime,
|
|
2579
|
+
qt as emitValueAsNumber,
|
|
2580
|
+
et as endInterpolate,
|
|
2581
|
+
ye as getCurrentScope,
|
|
2582
|
+
zt as getParentScope,
|
|
2583
|
+
Zt as getScopeStack,
|
|
2584
|
+
ue as getWindow,
|
|
2585
|
+
tt as guessInterpolate,
|
|
2586
|
+
ws as html,
|
|
2587
|
+
bs as input,
|
|
2588
|
+
Ke as interpolateDate,
|
|
2589
|
+
Ze as interpolateNumber,
|
|
2590
|
+
ze as interpolateString,
|
|
2591
|
+
es as joinSignals,
|
|
2592
|
+
ts as localStorageProp,
|
|
2593
|
+
Jt as makeProbe,
|
|
2594
|
+
at as makeProviderMark,
|
|
2595
|
+
As as math,
|
|
2596
|
+
Ss as mathAttr,
|
|
2597
|
+
rs as merge,
|
|
2598
|
+
se as on,
|
|
2599
|
+
Ue as popScope,
|
|
2600
|
+
os as previousSignal,
|
|
2601
|
+
T as prop,
|
|
2602
|
+
We as pushScope,
|
|
2603
|
+
us as render,
|
|
2604
|
+
he as renderWithContext,
|
|
2605
|
+
f as renderableOfTNode,
|
|
2606
|
+
ds as restoreTempoPlaceholders,
|
|
2607
|
+
hs as runHeadless,
|
|
2608
|
+
_ as scopeStack,
|
|
2609
|
+
Kt as scoped,
|
|
2610
|
+
ss as sessionStorageProp,
|
|
2611
|
+
K as signal,
|
|
2612
|
+
ls as slidingWindowSignal,
|
|
2613
|
+
_e as storedProp,
|
|
2614
|
+
Js as style,
|
|
2615
|
+
vs as svg,
|
|
2616
|
+
ys as svgAttr,
|
|
2617
|
+
oe as untracked,
|
|
2618
|
+
L as withScope
|
|
2362
2619
|
};
|