@tempots/dom 28.2.0 → 28.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1 -1
- package/index.js +452 -436
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -3,21 +3,21 @@ var re = (s) => {
|
|
|
3
3
|
throw TypeError(s);
|
|
4
4
|
};
|
|
5
5
|
var He = (s, e, t) => e in s ? Me(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
6
|
-
var
|
|
6
|
+
var o = (s, e, t) => He(s, typeof e != "symbol" ? e + "" : e, t), ne = (s, e, t) => e.has(s) || re("Cannot " + t);
|
|
7
7
|
var I = (s, e, t) => (ne(s, e, "read from private field"), t ? t.call(s) : e.get(s)), ie = (s, e, t) => e.has(s) ? re("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), z = (s, e, t, r) => (ne(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
|
|
8
8
|
const ke = (s, e, t) => s + (e - s) * t;
|
|
9
|
-
const
|
|
9
|
+
const Ne = (s, e, t) => {
|
|
10
10
|
const r = Math.max(s.length, e.length);
|
|
11
11
|
let n = "";
|
|
12
|
-
for (let
|
|
13
|
-
let l = s.charCodeAt(
|
|
12
|
+
for (let i = 0; i < r; i++) {
|
|
13
|
+
let l = s.charCodeAt(i);
|
|
14
14
|
isNaN(l) && (l = 97);
|
|
15
|
-
let c = e.charCodeAt(
|
|
15
|
+
let c = e.charCodeAt(i);
|
|
16
16
|
isNaN(c) && (c = 97), n += String.fromCharCode(l + (c - l) * t);
|
|
17
17
|
}
|
|
18
18
|
return n;
|
|
19
|
-
},
|
|
20
|
-
var
|
|
19
|
+
}, $e = (s, e, t) => new Date(s.getTime() + (e.getTime() - s.getTime()) * t), Ie = (s, e) => e, Re = (s) => typeof s == "number" ? ke : typeof s == "string" ? Ne : s instanceof Date ? $e : Ie;
|
|
20
|
+
var w;
|
|
21
21
|
class Q {
|
|
22
22
|
/**
|
|
23
23
|
* Creates a new instance of `ElementPosition`.
|
|
@@ -28,26 +28,26 @@ class Q {
|
|
|
28
28
|
/**
|
|
29
29
|
* The counter of the element starting from 1.
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
o(this, "counter");
|
|
32
32
|
/**
|
|
33
33
|
* Checks if the element is the first element in the collection.
|
|
34
34
|
* @returns `true` if the element is the first element, `false` otherwise.
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
o(this, "isFirst");
|
|
37
37
|
/**
|
|
38
38
|
* Checks if the counter of the element is even.
|
|
39
39
|
* @returns `true` if the counter is even, `false` otherwise.
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
o(this, "isEven");
|
|
42
42
|
/**
|
|
43
43
|
* Checks if the counter of the element is odd.
|
|
44
44
|
* @returns `true` if the counter is odd, `false` otherwise.
|
|
45
45
|
*/
|
|
46
|
-
|
|
47
|
-
ie(this,
|
|
48
|
-
|
|
46
|
+
o(this, "isOdd");
|
|
47
|
+
ie(this, w);
|
|
48
|
+
o(this, "dispose", () => {
|
|
49
49
|
var e;
|
|
50
|
-
(e = I(this,
|
|
50
|
+
(e = I(this, w)) == null || e.dispose(), z(this, w, void 0);
|
|
51
51
|
});
|
|
52
52
|
this.index = e, this.total = t, this.counter = e + 1, this.isFirst = e === 0, this.isEven = e % 2 === 1, this.isOdd = e % 2 === 0;
|
|
53
53
|
}
|
|
@@ -56,10 +56,10 @@ class Q {
|
|
|
56
56
|
* @returns `true` if the element is the last element, `false` otherwise.
|
|
57
57
|
*/
|
|
58
58
|
get isLast() {
|
|
59
|
-
return I(this,
|
|
59
|
+
return I(this, w) == null && z(this, w, this.total.map((e) => this.counter === e)), I(this, w);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
w = new WeakMap();
|
|
63
63
|
const H = class H {
|
|
64
64
|
/**
|
|
65
65
|
* Represents a signal with a value of type T.
|
|
@@ -72,33 +72,33 @@ const H = class H {
|
|
|
72
72
|
/**
|
|
73
73
|
* @internal
|
|
74
74
|
*/
|
|
75
|
-
|
|
75
|
+
o(this, "$__signal__", !0);
|
|
76
76
|
/**
|
|
77
77
|
* @internal
|
|
78
78
|
*/
|
|
79
|
-
|
|
79
|
+
o(this, "_value");
|
|
80
80
|
/**
|
|
81
81
|
* @internal
|
|
82
82
|
*/
|
|
83
|
-
|
|
83
|
+
o(this, "_derivatives", []);
|
|
84
84
|
/**
|
|
85
85
|
* @internal
|
|
86
86
|
*/
|
|
87
|
-
|
|
87
|
+
o(this, "_onValueListeners", []);
|
|
88
88
|
/**
|
|
89
89
|
* @internal
|
|
90
90
|
*/
|
|
91
|
-
|
|
91
|
+
o(this, "_onDisposeListeners", []);
|
|
92
92
|
/**
|
|
93
93
|
* Gets the current value of the signal.
|
|
94
94
|
* @returns The current value of the signal.
|
|
95
95
|
*/
|
|
96
|
-
|
|
96
|
+
o(this, "get", () => this._value);
|
|
97
97
|
/**
|
|
98
98
|
* Checks if the signal has any registered listeners.
|
|
99
99
|
* @returns `true` if the signal has listeners, `false` otherwise.
|
|
100
100
|
*/
|
|
101
|
-
|
|
101
|
+
o(this, "hasListeners", () => this._onValueListeners.length > 0);
|
|
102
102
|
/**
|
|
103
103
|
* Registers a listener function to be called whenever the value of the signal changes.
|
|
104
104
|
* The listener function will be immediately called with the current value of the signal.
|
|
@@ -107,10 +107,10 @@ const H = class H {
|
|
|
107
107
|
* @param listener - The listener function to be called when the value of the signal changes.
|
|
108
108
|
* @param options - Options for the listener.
|
|
109
109
|
*/
|
|
110
|
-
|
|
110
|
+
o(this, "on", (e, t = {}) => {
|
|
111
111
|
t.skipInitial || e(this.get(), void 0);
|
|
112
|
-
const r = t.once ? (
|
|
113
|
-
n(), e(
|
|
112
|
+
const r = t.once ? (i, l) => {
|
|
113
|
+
n(), e(i, l);
|
|
114
114
|
} : e;
|
|
115
115
|
this._onValueListeners.push(r);
|
|
116
116
|
const n = () => {
|
|
@@ -124,7 +124,7 @@ const H = class H {
|
|
|
124
124
|
/**
|
|
125
125
|
* @internal
|
|
126
126
|
*/
|
|
127
|
-
|
|
127
|
+
o(this, "_setAndNotify", (e) => {
|
|
128
128
|
if (this._disposed) return;
|
|
129
129
|
const t = this._value;
|
|
130
130
|
this.equals(t, e) || (this._value = e, this._onValueListeners.forEach((n) => n(e, t)));
|
|
@@ -132,24 +132,24 @@ const H = class H {
|
|
|
132
132
|
/**
|
|
133
133
|
* @internal
|
|
134
134
|
*/
|
|
135
|
-
|
|
135
|
+
o(this, "_disposed", !1);
|
|
136
136
|
/**
|
|
137
137
|
* Checks whether the signal is disposed.
|
|
138
138
|
* @returns True if the signal is disposed, false otherwise.
|
|
139
139
|
*/
|
|
140
|
-
|
|
140
|
+
o(this, "isDisposed", () => this._disposed);
|
|
141
141
|
/**
|
|
142
142
|
* Adds a listener function to be called when the object is disposed.
|
|
143
143
|
* @param listener - The listener function to be called when the object is disposed.
|
|
144
144
|
* @returns A function that can be called to remove the listener.
|
|
145
145
|
*/
|
|
146
|
-
|
|
146
|
+
o(this, "onDispose", (e) => {
|
|
147
147
|
this._onDisposeListeners.push(e);
|
|
148
148
|
});
|
|
149
149
|
/**
|
|
150
150
|
* Disposes the signal, releasing any resources associated with it.
|
|
151
151
|
*/
|
|
152
|
-
|
|
152
|
+
o(this, "dispose", () => {
|
|
153
153
|
this._disposed || (this._disposed = !0, this._onDisposeListeners.forEach((e) => e()), this._onDisposeListeners.length = 0, this._derivatives.length = 0);
|
|
154
154
|
});
|
|
155
155
|
/**
|
|
@@ -202,7 +202,7 @@ const H = class H {
|
|
|
202
202
|
* @param equals - Optional function to determine if two transformed values are equal (defaults to strict equality)
|
|
203
203
|
* @returns A new computed signal with the transformed value
|
|
204
204
|
*/
|
|
205
|
-
|
|
205
|
+
o(this, "map", (e, t = (r, n) => r === n) => {
|
|
206
206
|
const r = new P(() => {
|
|
207
207
|
try {
|
|
208
208
|
return e(this.get());
|
|
@@ -222,7 +222,7 @@ const H = class H {
|
|
|
222
222
|
* Defaults to a strict equality check (===).
|
|
223
223
|
* @returns A new Signal that emits the values of the resulting Signal.
|
|
224
224
|
*/
|
|
225
|
-
|
|
225
|
+
o(this, "flatMap", (e, t = (r, n) => r === n) => {
|
|
226
226
|
const r = new P(() => {
|
|
227
227
|
try {
|
|
228
228
|
return e(this.get()).get();
|
|
@@ -238,26 +238,26 @@ const H = class H {
|
|
|
238
238
|
* @param fn - The callback function to be invoked with the current value of the signal.
|
|
239
239
|
* @returns A new signal that emits the same value as the original signal and invokes the callback function.
|
|
240
240
|
*/
|
|
241
|
-
|
|
241
|
+
o(this, "tap", (e) => this.map((t) => (e(t), t)));
|
|
242
242
|
/**
|
|
243
243
|
* Returns a new Signal that emits the value at the specified key of the current value.
|
|
244
244
|
*
|
|
245
245
|
* @param key - The key of the value to retrieve.
|
|
246
246
|
* @returns A new Signal that emits the value at the specified key.
|
|
247
247
|
*/
|
|
248
|
-
|
|
248
|
+
o(this, "at", (e) => this.map((t) => t[e]));
|
|
249
249
|
/**
|
|
250
250
|
* @internal
|
|
251
251
|
*/
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
o(this, "_$");
|
|
253
|
+
o(this, "filter", (e, t) => {
|
|
254
254
|
let r = t ?? this.get();
|
|
255
255
|
const n = new P(() => {
|
|
256
256
|
try {
|
|
257
|
-
const
|
|
258
|
-
return r = e(
|
|
259
|
-
} catch (
|
|
260
|
-
throw console.error("Error in Signal.filter:",
|
|
257
|
+
const i = this.get();
|
|
258
|
+
return r = e(i) ? i : r;
|
|
259
|
+
} catch (i) {
|
|
260
|
+
throw console.error("Error in Signal.filter:", i), i;
|
|
261
261
|
}
|
|
262
262
|
}, this.equals);
|
|
263
263
|
return this.setDerivative(n), n;
|
|
@@ -272,9 +272,9 @@ const H = class H {
|
|
|
272
272
|
* @param equals - Optional equality function to determine if two values are equal.
|
|
273
273
|
* @returns - A new Computed object with the mapped and filtered values.
|
|
274
274
|
*/
|
|
275
|
-
|
|
275
|
+
o(this, "filterMap", (e, t, r = (n, i) => n === i) => {
|
|
276
276
|
let n = t;
|
|
277
|
-
const
|
|
277
|
+
const i = new P(() => {
|
|
278
278
|
try {
|
|
279
279
|
const l = this.get(), c = e(l);
|
|
280
280
|
return n = c ?? n;
|
|
@@ -282,7 +282,7 @@ const H = class H {
|
|
|
282
282
|
throw console.error("Error in Signal.filterMap:", l), l;
|
|
283
283
|
}
|
|
284
284
|
}, r);
|
|
285
|
-
return this.setDerivative(
|
|
285
|
+
return this.setDerivative(i), i;
|
|
286
286
|
});
|
|
287
287
|
/**
|
|
288
288
|
* Maps the values emitted by the signal to a new value asynchronously using the provided function.
|
|
@@ -297,25 +297,25 @@ const H = class H {
|
|
|
297
297
|
* @param equals - The equality function to compare the mapped values for equality.
|
|
298
298
|
* @returns A property that holds the mapped value and can be observed for changes.
|
|
299
299
|
*/
|
|
300
|
-
|
|
301
|
-
const
|
|
300
|
+
o(this, "mapAsync", (e, t, r, n = (i, l) => i === l) => {
|
|
301
|
+
const i = _(t, n);
|
|
302
302
|
let l = 0, c = new AbortController();
|
|
303
|
-
return
|
|
303
|
+
return i.onDispose(
|
|
304
304
|
this.on(async (a) => {
|
|
305
305
|
const u = ++l;
|
|
306
306
|
c.abort(), c = new AbortController();
|
|
307
307
|
try {
|
|
308
308
|
const h = await e(a, { abortSignal: c.signal });
|
|
309
|
-
u === l &&
|
|
309
|
+
u === l && i.set(h);
|
|
310
310
|
} catch (h) {
|
|
311
311
|
if (u === l)
|
|
312
312
|
if (r != null)
|
|
313
|
-
|
|
313
|
+
i.set(r(h));
|
|
314
314
|
else
|
|
315
315
|
throw h;
|
|
316
316
|
}
|
|
317
317
|
})
|
|
318
|
-
),
|
|
318
|
+
), i;
|
|
319
319
|
});
|
|
320
320
|
/**
|
|
321
321
|
* Maps the values of the signal using the provided function `fn`, and returns a new signal
|
|
@@ -327,14 +327,14 @@ const H = class H {
|
|
|
327
327
|
* @param alt - The alternative value to use when the mapped value is `undefined` or `null`.
|
|
328
328
|
* @returns A new signal containing the mapped values.
|
|
329
329
|
*/
|
|
330
|
-
|
|
330
|
+
o(this, "mapMaybe", (e, t) => this.map((r) => e(r) ?? t));
|
|
331
331
|
/**
|
|
332
332
|
* Feeds a property into the signal and sets up disposal behavior.
|
|
333
333
|
* @param prop - The property to feed into the signal.
|
|
334
334
|
* @param autoDisposeProp - Determines whether the property should be automatically disposed when the signal is disposed.
|
|
335
335
|
* @returns The input property.
|
|
336
336
|
*/
|
|
337
|
-
|
|
337
|
+
o(this, "feedProp", (e, t = !1) => {
|
|
338
338
|
const r = this.on(e.set);
|
|
339
339
|
return e.onDispose(r), t ? this.onDispose(e.dispose) : this.onDispose(r), e;
|
|
340
340
|
});
|
|
@@ -345,20 +345,20 @@ const H = class H {
|
|
|
345
345
|
* @param options.equals - A function that determines if two values are equal.
|
|
346
346
|
* @returns The derived property.
|
|
347
347
|
*/
|
|
348
|
-
|
|
348
|
+
o(this, "deriveProp", ({
|
|
349
349
|
autoDisposeProp: e = !0,
|
|
350
350
|
equals: t
|
|
351
|
-
} = {}) => this.feedProp(
|
|
351
|
+
} = {}) => this.feedProp(_(this.get(), t), e));
|
|
352
352
|
/**
|
|
353
353
|
* 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.
|
|
354
354
|
* @returns A new signal that emits the same values as the current signal.
|
|
355
355
|
*/
|
|
356
|
-
|
|
356
|
+
o(this, "derive", () => this.map((e) => e));
|
|
357
357
|
/**
|
|
358
358
|
* Returns a signal that emits the count of values received so far.
|
|
359
359
|
* @returns A signal that emits the count of values received so far.
|
|
360
360
|
*/
|
|
361
|
-
|
|
361
|
+
o(this, "count", () => {
|
|
362
362
|
let e = 0;
|
|
363
363
|
return this.map(() => ++e);
|
|
364
364
|
});
|
|
@@ -368,7 +368,7 @@ const H = class H {
|
|
|
368
368
|
* Additionally, when the computed value is disposed, it sets the signal as dirty.
|
|
369
369
|
* @param computed - The computed value to add as a derivative.
|
|
370
370
|
*/
|
|
371
|
-
|
|
371
|
+
o(this, "setDerivative", (e) => {
|
|
372
372
|
this._derivatives.push(e), e.onDispose(() => {
|
|
373
373
|
this._derivatives.splice(
|
|
374
374
|
this._derivatives.indexOf(e),
|
|
@@ -436,26 +436,26 @@ const H = class H {
|
|
|
436
436
|
* @param equals - Function to compare two values for equality (defaults to strict equality)
|
|
437
437
|
* @returns A Signal that represents the result of the Promise
|
|
438
438
|
*/
|
|
439
|
-
|
|
440
|
-
const
|
|
441
|
-
return e.then((l) =>
|
|
442
|
-
r != null ?
|
|
439
|
+
o(H, "ofPromise", (e, t, r, n = (i, l) => i === l) => {
|
|
440
|
+
const i = new H(t, n);
|
|
441
|
+
return e.then((l) => i._setAndNotify(l)).catch((l) => {
|
|
442
|
+
r != null ? i._setAndNotify(r(l)) : console.error(
|
|
443
443
|
"Unhandled promise rejection in Signal.ofPromise:",
|
|
444
444
|
l
|
|
445
445
|
);
|
|
446
|
-
}),
|
|
446
|
+
}), i;
|
|
447
447
|
}), /**
|
|
448
448
|
* Checks if a value is a Signal.
|
|
449
449
|
*
|
|
450
450
|
* @param value - The value to check.
|
|
451
451
|
* @returns `true` if the value is a Signal, `false` otherwise.
|
|
452
452
|
*/
|
|
453
|
-
|
|
453
|
+
o(H, "is", (e) => (
|
|
454
454
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
455
455
|
e != null && e.$__signal__ === !0
|
|
456
456
|
));
|
|
457
457
|
let d = H;
|
|
458
|
-
const
|
|
458
|
+
const je = typeof queueMicrotask == "function" ? queueMicrotask : (s) => Promise.resolve().then(s);
|
|
459
459
|
class P extends d {
|
|
460
460
|
/**
|
|
461
461
|
* Represents a Signal object.
|
|
@@ -467,36 +467,36 @@ class P extends d {
|
|
|
467
467
|
/**
|
|
468
468
|
* @internal
|
|
469
469
|
*/
|
|
470
|
-
|
|
470
|
+
o(this, "$__computed__", !0);
|
|
471
471
|
/**
|
|
472
472
|
* @internal
|
|
473
473
|
*/
|
|
474
|
-
|
|
474
|
+
o(this, "_isDirty", !1);
|
|
475
475
|
/**
|
|
476
476
|
* Marks the signal as dirty, indicating that its value has changed and needs to be recalculated.
|
|
477
477
|
* If the signal is already dirty or disposed, this method does nothing.
|
|
478
478
|
* It also marks all dependent signals as dirty and schedules a notification to update their values.
|
|
479
479
|
*/
|
|
480
|
-
|
|
480
|
+
o(this, "setDirty", () => {
|
|
481
481
|
this._isDirty || this._disposed || (this._isDirty = !0, this._derivatives.forEach((t) => t.setDirty()), this._scheduleNotify());
|
|
482
482
|
});
|
|
483
483
|
/**
|
|
484
484
|
* @internal
|
|
485
485
|
*/
|
|
486
|
-
|
|
486
|
+
o(this, "_scheduleCount", 0);
|
|
487
487
|
/**
|
|
488
488
|
* Schedules a notification to be executed asynchronously.
|
|
489
489
|
* If the signal is dirty, it will be updated and notified.
|
|
490
490
|
* @internal
|
|
491
491
|
*/
|
|
492
|
-
|
|
492
|
+
o(this, "_scheduleNotify", () => {
|
|
493
493
|
const t = ++this._scheduleCount;
|
|
494
|
-
|
|
494
|
+
je(() => {
|
|
495
495
|
this._scheduleCount !== t || this._disposed || this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn()));
|
|
496
496
|
});
|
|
497
497
|
});
|
|
498
498
|
/** {@inheritDoc Signal.get} */
|
|
499
|
-
|
|
499
|
+
o(this, "get", () => (this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn())), this._value));
|
|
500
500
|
this._fn = t, this.setDirty();
|
|
501
501
|
}
|
|
502
502
|
/**
|
|
@@ -519,20 +519,20 @@ const J = class J extends d {
|
|
|
519
519
|
/**
|
|
520
520
|
* @internal
|
|
521
521
|
*/
|
|
522
|
-
|
|
522
|
+
o(this, "$__prop__", !0);
|
|
523
523
|
/**
|
|
524
524
|
* Changes the value of the property and notifies its listeners.
|
|
525
525
|
*
|
|
526
526
|
* @param value - The new value of the property.
|
|
527
527
|
*/
|
|
528
|
-
|
|
528
|
+
o(this, "set", (t) => {
|
|
529
529
|
this._setAndNotify(t);
|
|
530
530
|
});
|
|
531
531
|
/**
|
|
532
532
|
* Updates the value of the signal by applying the provided function to the current value.
|
|
533
533
|
* @param fn - The function to apply to the current value.
|
|
534
534
|
*/
|
|
535
|
-
|
|
535
|
+
o(this, "update", (t) => {
|
|
536
536
|
this._setAndNotify(t(this.get()));
|
|
537
537
|
});
|
|
538
538
|
/**
|
|
@@ -541,16 +541,16 @@ const J = class J extends d {
|
|
|
541
541
|
* @param effects - An array of effects to be executed after the state is updated.
|
|
542
542
|
* @returns A dispatch function that can be used to update the state and trigger the effects.
|
|
543
543
|
*/
|
|
544
|
-
|
|
544
|
+
o(this, "reducer", (t, ...r) => {
|
|
545
545
|
const n = this;
|
|
546
|
-
return function
|
|
546
|
+
return function i(l) {
|
|
547
547
|
const c = n.value;
|
|
548
548
|
n.update((a) => t(a, l)), !n.equals(c, n.value) && r.forEach(
|
|
549
549
|
(a) => a({
|
|
550
550
|
previousState: c,
|
|
551
551
|
state: n.value,
|
|
552
552
|
action: l,
|
|
553
|
-
dispatch:
|
|
553
|
+
dispatch: i
|
|
554
554
|
})
|
|
555
555
|
);
|
|
556
556
|
};
|
|
@@ -566,9 +566,9 @@ const J = class J extends d {
|
|
|
566
566
|
* Defaults to a strict equality check (===).
|
|
567
567
|
* @returns A Prop object representing the isomorphism.
|
|
568
568
|
*/
|
|
569
|
-
|
|
570
|
-
const
|
|
571
|
-
return
|
|
569
|
+
o(this, "iso", (t, r, n = (i, l) => i === l) => {
|
|
570
|
+
const i = new J(t(this.get()), n);
|
|
571
|
+
return i.onDispose(this.on((l) => i.set(t(l)))), i.on((l) => this._setAndNotify(r(l))), i;
|
|
572
572
|
});
|
|
573
573
|
/**
|
|
574
574
|
* Returns a `Prop` that represents the value at the specified key of the current value.
|
|
@@ -576,7 +576,7 @@ const J = class J extends d {
|
|
|
576
576
|
* @param key - The key of the value to access.
|
|
577
577
|
* @returns A `Prop` that represents the value at the specified key.
|
|
578
578
|
*/
|
|
579
|
-
|
|
579
|
+
o(this, "atProp", (t) => this.iso(
|
|
580
580
|
(r) => r[t],
|
|
581
581
|
(r) => ({ ...this.value, [t]: r })
|
|
582
582
|
));
|
|
@@ -596,17 +596,17 @@ const J = class J extends d {
|
|
|
596
596
|
* @param value - The value to check.
|
|
597
597
|
* @returns `true` if the value is a Prop, `false` otherwise.
|
|
598
598
|
*/
|
|
599
|
-
|
|
599
|
+
o(J, "is", (t) => (
|
|
600
600
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
601
601
|
t != null && t.$__prop__ === !0
|
|
602
602
|
));
|
|
603
|
-
let
|
|
603
|
+
let j = J;
|
|
604
604
|
const Z = (s, e, t = (r, n) => r === n) => {
|
|
605
605
|
const r = new P(s, t);
|
|
606
606
|
return e.forEach((n) => n.setDerivative(r)), r;
|
|
607
|
-
},
|
|
607
|
+
}, Ve = (s, e, t = {}) => {
|
|
608
608
|
let r = t.once ? () => {
|
|
609
|
-
|
|
609
|
+
i(), s();
|
|
610
610
|
} : s;
|
|
611
611
|
if (t.skipInitial) {
|
|
612
612
|
let l = !1;
|
|
@@ -615,14 +615,14 @@ const Z = (s, e, t = (r, n) => r === n) => {
|
|
|
615
615
|
l ? c() : l = !0;
|
|
616
616
|
};
|
|
617
617
|
}
|
|
618
|
-
const n = Z(r, e),
|
|
619
|
-
n.dispose(), t.abortSignal != null && t.abortSignal.removeEventListener("abort",
|
|
618
|
+
const n = Z(r, e), i = () => {
|
|
619
|
+
n.dispose(), t.abortSignal != null && t.abortSignal.removeEventListener("abort", i);
|
|
620
620
|
};
|
|
621
|
-
return t.abortSignal != null && t.abortSignal.addEventListener("abort",
|
|
622
|
-
},
|
|
621
|
+
return t.abortSignal != null && t.abortSignal.addEventListener("abort", i), i;
|
|
622
|
+
}, _ = (s, e = (t, r) => t === r) => new j(s, e), G = (s, e = (t, r) => t === r) => new d(s, e), le = () => (
|
|
623
623
|
/* c8 ignore next */
|
|
624
624
|
typeof window < "u" ? window : void 0
|
|
625
|
-
),
|
|
625
|
+
), T = {
|
|
626
626
|
/**
|
|
627
627
|
* Maps a value or a Signal to a new value.
|
|
628
628
|
* If the value is a Signal, it returns a new Signal with the mapped value.
|
|
@@ -654,7 +654,7 @@ const Z = (s, e, t = (r, n) => r === n) => {
|
|
|
654
654
|
*/
|
|
655
655
|
maybeToSignal: (s, e) => {
|
|
656
656
|
if (s != null)
|
|
657
|
-
return
|
|
657
|
+
return T.toSignal(s, e);
|
|
658
658
|
},
|
|
659
659
|
/**
|
|
660
660
|
* Gets the value from a `Signal` or the value itself if it is not a `Signal`.
|
|
@@ -692,42 +692,42 @@ const Z = (s, e, t = (r, n) => r === n) => {
|
|
|
692
692
|
deriveProp: (s, {
|
|
693
693
|
autoDisposeProp: e = !0,
|
|
694
694
|
equals: t
|
|
695
|
-
} = {}) => d.is(s) ? s.deriveProp({ autoDisposeProp: e, equals: t }) :
|
|
695
|
+
} = {}) => d.is(s) ? s.deriveProp({ autoDisposeProp: e, equals: t }) : _(s, t)
|
|
696
696
|
}, qe = (...s) => (e, t) => {
|
|
697
697
|
const r = s.filter((n) => d.is(n));
|
|
698
698
|
return Z(
|
|
699
|
-
() => e(...s.map((n) =>
|
|
699
|
+
() => e(...s.map((n) => T.get(n))),
|
|
700
700
|
r,
|
|
701
701
|
t
|
|
702
702
|
);
|
|
703
|
-
},
|
|
703
|
+
}, Pt = (s) => {
|
|
704
704
|
const e = Object.keys(s);
|
|
705
705
|
return qe(...Object.values(s))(
|
|
706
706
|
(...t) => Object.fromEntries(e.map((r, n) => [r, t[n]]))
|
|
707
707
|
);
|
|
708
|
-
},
|
|
708
|
+
}, Lt = (...s) => (e, t = {}) => {
|
|
709
709
|
const r = s.filter((n) => d.is(n));
|
|
710
|
-
return
|
|
711
|
-
() => e(...s.map(
|
|
710
|
+
return Ve(
|
|
711
|
+
() => e(...s.map(T.get)),
|
|
712
712
|
r,
|
|
713
713
|
t
|
|
714
714
|
);
|
|
715
715
|
};
|
|
716
716
|
class ce {
|
|
717
717
|
constructor() {
|
|
718
|
-
|
|
718
|
+
o(this, "_store", /* @__PURE__ */ new Map());
|
|
719
719
|
/**
|
|
720
720
|
* Retrieves the value associated with the specified key from the memory store.
|
|
721
721
|
* @param key - The key to retrieve the value for.
|
|
722
722
|
* @returns The value associated with the key, or `null` if the key is not found.
|
|
723
723
|
*/
|
|
724
|
-
|
|
724
|
+
o(this, "getItem", (e) => this._store.get(e) ?? null);
|
|
725
725
|
/**
|
|
726
726
|
* Sets the value associated with the specified key in the memory store.
|
|
727
727
|
* @param key - The key to set the value for.
|
|
728
728
|
* @param value - The value to set.
|
|
729
729
|
*/
|
|
730
|
-
|
|
730
|
+
o(this, "setItem", (e, t) => {
|
|
731
731
|
this._store.set(e, t);
|
|
732
732
|
});
|
|
733
733
|
}
|
|
@@ -738,24 +738,22 @@ const ae = ({
|
|
|
738
738
|
store: t,
|
|
739
739
|
serialize: r = JSON.stringify,
|
|
740
740
|
deserialize: n = JSON.parse,
|
|
741
|
-
equals:
|
|
741
|
+
equals: i = (c, a) => c === a,
|
|
742
742
|
onLoad: l = (c) => c
|
|
743
743
|
}) => {
|
|
744
|
-
const c = t.getItem(s), a = new
|
|
744
|
+
const c = t.getItem(s), a = new j(
|
|
745
745
|
c != null ? l(n(c)) : typeof e == "function" ? e() : e,
|
|
746
|
-
|
|
746
|
+
i
|
|
747
747
|
);
|
|
748
|
-
return a.on((u) =>
|
|
749
|
-
|
|
750
|
-
}), a;
|
|
751
|
-
}, Ot = (s) => {
|
|
748
|
+
return a.on((u) => t.setItem(s, r(u))), a;
|
|
749
|
+
}, Dt = (s) => {
|
|
752
750
|
var e;
|
|
753
751
|
return ae({
|
|
754
752
|
...s,
|
|
755
753
|
/* c8 ignore next 3 */
|
|
756
754
|
store: ((e = le()) == null ? void 0 : e.localStorage) ?? new ce()
|
|
757
755
|
});
|
|
758
|
-
},
|
|
756
|
+
}, Ot = (s) => {
|
|
759
757
|
var e;
|
|
760
758
|
return ae({
|
|
761
759
|
...s,
|
|
@@ -767,24 +765,24 @@ function oe(s) {
|
|
|
767
765
|
return typeof requestAnimationFrame == "function" ? requestAnimationFrame(s) : setTimeout(s, 0);
|
|
768
766
|
}
|
|
769
767
|
const Fe = (s, e, t, r) => {
|
|
770
|
-
const n = (r == null ? void 0 : r.duration) ?? 300,
|
|
771
|
-
let c = r == null ? void 0 : r.interpolate, a = s, u = e(), h = performance.now(), g = null,
|
|
772
|
-
const p = new P(e, l), m =
|
|
768
|
+
const n = (r == null ? void 0 : r.duration) ?? 300, i = (r == null ? void 0 : r.easing) ?? ((A) => A), l = (r == null ? void 0 : r.equals) ?? ((A, $) => A === $);
|
|
769
|
+
let c = r == null ? void 0 : r.interpolate, a = s, u = e(), h = performance.now(), g = null, y = !0;
|
|
770
|
+
const p = new P(e, l), m = _(s, l);
|
|
773
771
|
m.onDispose(() => {
|
|
774
772
|
g !== null && cancelAnimationFrame(g);
|
|
775
773
|
}), m.onDispose(p.dispose), t.forEach((A) => {
|
|
776
774
|
A.setDerivative(p), A.onDispose(m.dispose);
|
|
777
775
|
});
|
|
778
776
|
const C = (A) => {
|
|
779
|
-
u = A, h = performance.now(), a = m.value,
|
|
777
|
+
u = A, h = performance.now(), a = m.value, y && (y = !1, g = oe(te));
|
|
780
778
|
}, te = () => {
|
|
781
|
-
const
|
|
779
|
+
const $ = (performance.now() - h) / T.get(n), Oe = i($);
|
|
782
780
|
c == null && (c = Re(a));
|
|
783
781
|
let se = c(a, u, Oe);
|
|
784
|
-
|
|
782
|
+
$ >= 1 ? (y = !0, se = u) : g = oe(te), m.set(se);
|
|
785
783
|
};
|
|
786
784
|
return p.on(C), m;
|
|
787
|
-
},
|
|
785
|
+
}, Mt = (s, e) => {
|
|
788
786
|
const { initialValue: t, ...r } = e ?? {};
|
|
789
787
|
return Fe(
|
|
790
788
|
/* c8 ignore next 2 */
|
|
@@ -797,22 +795,23 @@ const Fe = (s, e, t, r) => {
|
|
|
797
795
|
const t = Object.values(s).filter(d.is), r = Object.keys(s);
|
|
798
796
|
return Z(() => {
|
|
799
797
|
const n = {};
|
|
800
|
-
for (const
|
|
801
|
-
n[
|
|
798
|
+
for (const i of r)
|
|
799
|
+
n[i] = T.get(s[i]);
|
|
802
800
|
return e(n);
|
|
803
801
|
}, t);
|
|
804
|
-
},
|
|
805
|
-
const t =
|
|
802
|
+
}, Ht = (s) => Be(s, (e) => e), kt = (s, e) => {
|
|
803
|
+
const t = _(s.get());
|
|
806
804
|
let r = null;
|
|
807
|
-
|
|
805
|
+
const n = s.on((i) => {
|
|
808
806
|
r != null && clearTimeout(r), r = setTimeout(
|
|
809
807
|
() => {
|
|
810
|
-
r = null, t.set(
|
|
808
|
+
r = null, t.set(i);
|
|
811
809
|
},
|
|
812
|
-
typeof e == "function" ? e(
|
|
810
|
+
typeof e == "function" ? e(i) : e
|
|
813
811
|
);
|
|
814
|
-
})
|
|
815
|
-
|
|
812
|
+
});
|
|
813
|
+
return t.onDispose(() => {
|
|
814
|
+
n(), r != null && clearTimeout(r);
|
|
816
815
|
}), t;
|
|
817
816
|
}, ue = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), he = /* @__PURE__ */ new Set(["selected"]), fe = /* @__PURE__ */ new Set([
|
|
818
817
|
"rowSpan",
|
|
@@ -839,7 +838,7 @@ const Fe = (s, e, t, r) => {
|
|
|
839
838
|
t == null ? e[s] = null : e[s] = String(t);
|
|
840
839
|
} : (t) => {
|
|
841
840
|
t == null ? e.removeAttribute(s) : e.setAttribute(s, t);
|
|
842
|
-
}, Ue = (s, e) => he.has(s) ? () => e.hasAttribute(s) : ue.has(s) ? () => !!e[s] : fe.has(s) ? () => Number(e[s]) : de.has(s) ? () => e[s] : pe.has(s) ? () => String(e[s]) : () => e.getAttribute(s),
|
|
841
|
+
}, Ue = (s, e) => he.has(s) ? () => e.hasAttribute(s) : ue.has(s) ? () => !!e[s] : fe.has(s) ? () => Number(e[s]) : de.has(s) ? () => e[s] : pe.has(s) ? () => String(e[s]) : () => e.getAttribute(s), V = (s) => {
|
|
843
842
|
const e = s;
|
|
844
843
|
e && e.onblur && (e.onblur = null), !(!s || s.ownerDocument === void 0) && s.parentElement && s.parentElement.removeChild(s);
|
|
845
844
|
}, Je = (s) => ge(s) ? s : s.parentElement, ge = (s) => s.nodeType === 1;
|
|
@@ -866,7 +865,7 @@ class L {
|
|
|
866
865
|
* @param namespace - The namespace URI to create the element in, or `undefined` to create a standard HTML element.
|
|
867
866
|
* @returns The newly created element.
|
|
868
867
|
*/
|
|
869
|
-
|
|
868
|
+
o(this, "createElement", (e, t) => t !== void 0 ? this.document.createElementNS(t, e) : this.document.createElement(e));
|
|
870
869
|
/**
|
|
871
870
|
* Creates a new child element and appends it to the current element, returning a new context.
|
|
872
871
|
*
|
|
@@ -889,7 +888,7 @@ class L {
|
|
|
889
888
|
* @param namespace - The namespace URI for the element, or undefined for HTML elements
|
|
890
889
|
* @returns A new DOMContext focused on the newly created child element
|
|
891
890
|
*/
|
|
892
|
-
|
|
891
|
+
o(this, "makeChildElement", (e, t) => {
|
|
893
892
|
const r = this.createElement(e, t);
|
|
894
893
|
return this.appendOrInsert(r), this.withElement(r);
|
|
895
894
|
});
|
|
@@ -898,13 +897,13 @@ class L {
|
|
|
898
897
|
* @param text - The text content for the new text node.
|
|
899
898
|
* @returns A new `Text` node with the specified text content.
|
|
900
899
|
*/
|
|
901
|
-
|
|
900
|
+
o(this, "createText", (e) => this.document.createTextNode(e));
|
|
902
901
|
/**
|
|
903
902
|
* Creates a new text node with the specified text content and appends it to the current element.
|
|
904
903
|
* @param text - The text content for the new text node.
|
|
905
904
|
* @returns A new `DOMContext` with a reference to the new text node.
|
|
906
905
|
*/
|
|
907
|
-
|
|
906
|
+
o(this, "makeChildText", (e) => {
|
|
908
907
|
const t = this.createText(e);
|
|
909
908
|
return this.appendOrInsert(t), this.withReference(t);
|
|
910
909
|
});
|
|
@@ -912,14 +911,14 @@ class L {
|
|
|
912
911
|
* Sets the text content of the current element.
|
|
913
912
|
* @param text - The text content to set.
|
|
914
913
|
*/
|
|
915
|
-
|
|
914
|
+
o(this, "setText", (e) => {
|
|
916
915
|
this.reference.nodeValue = e;
|
|
917
916
|
});
|
|
918
917
|
/**
|
|
919
918
|
* Gets the text content of the current element or text node.
|
|
920
919
|
* @returns The text content of the current element or text node.
|
|
921
920
|
*/
|
|
922
|
-
|
|
921
|
+
o(this, "getText", () => {
|
|
923
922
|
var e;
|
|
924
923
|
return ((e = this.reference) == null ? void 0 : e.nodeValue) ?? this.element.textContent ?? "";
|
|
925
924
|
});
|
|
@@ -928,7 +927,7 @@ class L {
|
|
|
928
927
|
* The text node is appended or inserted to the current `DOMContext`.
|
|
929
928
|
* The new `DOMContext` with the reference is returned.
|
|
930
929
|
*/
|
|
931
|
-
|
|
930
|
+
o(this, "makeRef", () => {
|
|
932
931
|
const e = this.createText("");
|
|
933
932
|
return this.appendOrInsert(e), this.withReference(e);
|
|
934
933
|
});
|
|
@@ -937,7 +936,7 @@ class L {
|
|
|
937
936
|
*
|
|
938
937
|
* @param child - The child node to append or insert.
|
|
939
938
|
*/
|
|
940
|
-
|
|
939
|
+
o(this, "appendOrInsert", (e) => {
|
|
941
940
|
this.reference === void 0 ? this.element.appendChild(e) : this.element.insertBefore(e, this.reference);
|
|
942
941
|
});
|
|
943
942
|
/**
|
|
@@ -945,7 +944,7 @@ class L {
|
|
|
945
944
|
* @param element - The DOM element to use in the new `DOMContext` instance.
|
|
946
945
|
* @returns A new `DOMContext` instance with the provided `element`.
|
|
947
946
|
*/
|
|
948
|
-
|
|
947
|
+
o(this, "withElement", (e) => new L(this.document, e, void 0, this.providers));
|
|
949
948
|
/**
|
|
950
949
|
* Creates a portal to render content in a different part of the DOM tree.
|
|
951
950
|
*
|
|
@@ -990,7 +989,7 @@ class L {
|
|
|
990
989
|
* @returns A new DOMContext focused on the portal target element
|
|
991
990
|
* @throws {Error} When the selector doesn't match any element in the document
|
|
992
991
|
*/
|
|
993
|
-
|
|
992
|
+
o(this, "makePortal", (e) => {
|
|
994
993
|
const t = typeof e == "string" ? this.document.querySelector(e) : e;
|
|
995
994
|
if (t == null)
|
|
996
995
|
throw new Error(`Cannot find element by selector for portal: ${e}`);
|
|
@@ -1002,7 +1001,7 @@ class L {
|
|
|
1002
1001
|
* @param reference - The optional `Text` node to use as the reference for the new `DOMContext`.
|
|
1003
1002
|
* @returns A new `DOMContext` instance with the specified reference.
|
|
1004
1003
|
*/
|
|
1005
|
-
|
|
1004
|
+
o(this, "withReference", (e) => new L(this.document, this.element, e, this.providers));
|
|
1006
1005
|
/**
|
|
1007
1006
|
* Sets a provider for the given provider mark.
|
|
1008
1007
|
*
|
|
@@ -1010,7 +1009,7 @@ class L {
|
|
|
1010
1009
|
* @param value - The provider to set for the given mark.
|
|
1011
1010
|
* @returns A new `DOMContext` instance with the specified provider.
|
|
1012
1011
|
*/
|
|
1013
|
-
|
|
1012
|
+
o(this, "setProvider", (e, t, r) => new L(this.document, this.element, this.reference, {
|
|
1014
1013
|
...this.providers,
|
|
1015
1014
|
[e]: [t, r]
|
|
1016
1015
|
}));
|
|
@@ -1021,34 +1020,34 @@ class L {
|
|
|
1021
1020
|
* @returns The provider for the given mark.
|
|
1022
1021
|
* @throws Throws `ProviderNotFoundError` if the provider for the given mark is not found.
|
|
1023
1022
|
*/
|
|
1024
|
-
|
|
1023
|
+
o(this, "getProvider", (e) => {
|
|
1025
1024
|
if (this.providers[e] === void 0)
|
|
1026
1025
|
throw new me(e);
|
|
1027
1026
|
const [t, r] = this.providers[e];
|
|
1028
1027
|
return { value: t, onUse: r };
|
|
1029
1028
|
});
|
|
1030
|
-
|
|
1031
|
-
e && (this.reference !== void 0 ?
|
|
1029
|
+
o(this, "clear", (e) => {
|
|
1030
|
+
e && (this.reference !== void 0 ? V(this.reference) : V(this.element));
|
|
1032
1031
|
});
|
|
1033
1032
|
/**
|
|
1034
1033
|
* Adds classes to the element.
|
|
1035
1034
|
* @param tokens - The class names to add.
|
|
1036
1035
|
*/
|
|
1037
|
-
|
|
1036
|
+
o(this, "addClasses", (e) => {
|
|
1038
1037
|
this.element.classList.add(...e);
|
|
1039
1038
|
});
|
|
1040
1039
|
/**
|
|
1041
1040
|
* Removes classes from the element.
|
|
1042
1041
|
* @param tokens - The class names to remove.
|
|
1043
1042
|
*/
|
|
1044
|
-
|
|
1043
|
+
o(this, "removeClasses", (e) => {
|
|
1045
1044
|
this.element.classList.remove(...e);
|
|
1046
1045
|
});
|
|
1047
1046
|
/**
|
|
1048
1047
|
* Gets the classes of the element.
|
|
1049
1048
|
* @returns The classes of the element.
|
|
1050
1049
|
*/
|
|
1051
|
-
|
|
1050
|
+
o(this, "getClasses", () => Array.from(this.element.classList));
|
|
1052
1051
|
/**
|
|
1053
1052
|
* Adds an event listener to the element.
|
|
1054
1053
|
* @param event - The event to listen for.
|
|
@@ -1056,10 +1055,10 @@ class L {
|
|
|
1056
1055
|
* @param options - The options for the event listener.
|
|
1057
1056
|
* @returns A function to remove the event listener.
|
|
1058
1057
|
*/
|
|
1059
|
-
|
|
1060
|
-
const n = (
|
|
1061
|
-
return this.element.addEventListener(e, n, r), (
|
|
1062
|
-
|
|
1058
|
+
o(this, "on", (e, t, r) => {
|
|
1059
|
+
const n = (i) => t(i, this);
|
|
1060
|
+
return this.element.addEventListener(e, n, r), (i) => {
|
|
1061
|
+
i && this.element.removeEventListener(e, n, r);
|
|
1063
1062
|
};
|
|
1064
1063
|
});
|
|
1065
1064
|
/**
|
|
@@ -1067,28 +1066,28 @@ class L {
|
|
|
1067
1066
|
* @returns `true` if the context is a browser DOM context.
|
|
1068
1067
|
* @deprecated Use `isBrowser()` instead.
|
|
1069
1068
|
*/
|
|
1070
|
-
|
|
1069
|
+
o(this, "isBrowserDOM", () => !0);
|
|
1071
1070
|
/**
|
|
1072
1071
|
* Returns `true` if the context is a browser context.
|
|
1073
1072
|
* @returns `true` if the context is a browser context.
|
|
1074
1073
|
*/
|
|
1075
|
-
|
|
1074
|
+
o(this, "isBrowser", () => !0);
|
|
1076
1075
|
/**
|
|
1077
1076
|
* Returns `true` if the context is a headless DOM context.
|
|
1078
1077
|
* @returns `true` if the context is a headless DOM context.
|
|
1079
1078
|
*/
|
|
1080
|
-
|
|
1079
|
+
o(this, "isHeadlessDOM", () => !1);
|
|
1081
1080
|
/**
|
|
1082
1081
|
* Returns `true` if the context is a headless context.
|
|
1083
1082
|
* @returns `true` if the context is a headless context.
|
|
1084
1083
|
*/
|
|
1085
|
-
|
|
1084
|
+
o(this, "isHeadless", () => !1);
|
|
1086
1085
|
/**
|
|
1087
1086
|
* Sets the style of the element.
|
|
1088
1087
|
* @param name - The name of the style to set.
|
|
1089
1088
|
* @param value - The value of the style to set.
|
|
1090
1089
|
*/
|
|
1091
|
-
|
|
1090
|
+
o(this, "setStyle", (e, t) => {
|
|
1092
1091
|
this.element.style[e] = t;
|
|
1093
1092
|
});
|
|
1094
1093
|
/**
|
|
@@ -1096,12 +1095,12 @@ class L {
|
|
|
1096
1095
|
* @param name - The name of the style to get.
|
|
1097
1096
|
* @returns The value of the style.
|
|
1098
1097
|
*/
|
|
1099
|
-
|
|
1100
|
-
|
|
1098
|
+
o(this, "getStyle", (e) => this.element.style[e]);
|
|
1099
|
+
o(this, "makeAccessors", (e) => ({
|
|
1101
1100
|
get: Ue(e, this.element),
|
|
1102
1101
|
set: We(e, this.element)
|
|
1103
1102
|
}));
|
|
1104
|
-
|
|
1103
|
+
o(this, "getWindow", () => this.document.defaultView);
|
|
1105
1104
|
this.document = e, this.element = t, this.reference = r, this.providers = n;
|
|
1106
1105
|
}
|
|
1107
1106
|
/**
|
|
@@ -1119,18 +1118,18 @@ class L {
|
|
|
1119
1118
|
const Ge = (s) => Symbol(s), K = (s, e) => {
|
|
1120
1119
|
const t = s(e);
|
|
1121
1120
|
return (r = !0) => t(r);
|
|
1122
|
-
}, Nt = (s, e, { doc: t, clear: r, disposeWithParent: n = !0, providers:
|
|
1121
|
+
}, Nt = (s, e, { doc: t, clear: r, disposeWithParent: n = !0, providers: i = {} } = {}) => {
|
|
1123
1122
|
const l = typeof e == "string" ? (t ?? document).querySelector(e) : e;
|
|
1124
1123
|
if (l === null)
|
|
1125
1124
|
throw new Xe(
|
|
1126
1125
|
`Cannot find element by selector for render: ${e}`
|
|
1127
1126
|
);
|
|
1128
1127
|
r !== !1 && (t ?? l.ownerDocument) != null && l.nodeType === 1 && (l.innerHTML = "");
|
|
1129
|
-
const c = Je(l), a = ge(l) ? void 0 : l, u = L.of(c, a,
|
|
1128
|
+
const c = Je(l), a = ge(l) ? void 0 : l, u = L.of(c, a, i), h = K(s, u);
|
|
1130
1129
|
let g;
|
|
1131
|
-
return n && (g = new MutationObserver((
|
|
1130
|
+
return n && (g = new MutationObserver((y) => {
|
|
1132
1131
|
var p;
|
|
1133
|
-
(p =
|
|
1132
|
+
(p = y[0]) == null || p.removedNodes.forEach((m) => {
|
|
1134
1133
|
m === l && (g == null || g.disconnect(), h(l.nodeType !== 1));
|
|
1135
1134
|
});
|
|
1136
1135
|
}), g.observe(l.parentElement, {
|
|
@@ -1140,17 +1139,17 @@ const Ge = (s) => Symbol(s), K = (s, e) => {
|
|
|
1140
1139
|
})), () => {
|
|
1141
1140
|
g == null || g.disconnect(), h(!0);
|
|
1142
1141
|
};
|
|
1143
|
-
},
|
|
1142
|
+
}, $t = (s, {
|
|
1144
1143
|
startUrl: e = "https://example.com",
|
|
1145
1144
|
selector: t,
|
|
1146
1145
|
providers: r = {}
|
|
1147
1146
|
} = {
|
|
1148
1147
|
selector: "body"
|
|
1149
1148
|
}) => {
|
|
1150
|
-
const n =
|
|
1149
|
+
const n = T.toSignal(e).deriveProp(), i = new Ae(t, void 0), l = new D(i, void 0, { currentURL: n }, r);
|
|
1151
1150
|
return {
|
|
1152
1151
|
clear: K(s(), l),
|
|
1153
|
-
root:
|
|
1152
|
+
root: i,
|
|
1154
1153
|
currentURL: n
|
|
1155
1154
|
};
|
|
1156
1155
|
};
|
|
@@ -1160,94 +1159,94 @@ class Xe extends Error {
|
|
|
1160
1159
|
}
|
|
1161
1160
|
}
|
|
1162
1161
|
const ye = "data-tts-node", q = "data-tts-class", F = "data-tts-style", B = "data-tts-html", W = "data-tts-text", U = "data-tts-attrs";
|
|
1163
|
-
class
|
|
1162
|
+
class It {
|
|
1164
1163
|
constructor({
|
|
1165
1164
|
select: e,
|
|
1166
1165
|
getAttribute: t,
|
|
1167
1166
|
setAttribute: r,
|
|
1168
1167
|
getClass: n,
|
|
1169
|
-
setClass:
|
|
1168
|
+
setClass: i,
|
|
1170
1169
|
getStyles: l,
|
|
1171
1170
|
setStyles: c,
|
|
1172
1171
|
appendHTML: a,
|
|
1173
1172
|
getInnerHTML: u,
|
|
1174
1173
|
setInnerHTML: h,
|
|
1175
1174
|
getInnerText: g,
|
|
1176
|
-
setInnerText:
|
|
1175
|
+
setInnerText: y
|
|
1177
1176
|
}) {
|
|
1178
1177
|
/**
|
|
1179
1178
|
* Selects elements from the headless environment.
|
|
1180
1179
|
* @param selector - The selector to select elements from. The supported selectors are CSS selectors whose complexity depends on the adapter implementation.
|
|
1181
1180
|
* @returns An array of elements.
|
|
1182
1181
|
*/
|
|
1183
|
-
|
|
1182
|
+
o(this, "select");
|
|
1184
1183
|
/**
|
|
1185
1184
|
* Gets the value of an attribute from an element.
|
|
1186
1185
|
* @param el - The element to get the attribute from.
|
|
1187
1186
|
* @param attr - The attribute to get the value from.
|
|
1188
1187
|
* @returns The value of the attribute or null if the attribute is not set.
|
|
1189
1188
|
*/
|
|
1190
|
-
|
|
1189
|
+
o(this, "getAttribute");
|
|
1191
1190
|
/**
|
|
1192
1191
|
* Sets the value of an attribute on an element.
|
|
1193
1192
|
* @param el - The element to set the attribute on.
|
|
1194
1193
|
* @param attr - The attribute to set the value of.
|
|
1195
1194
|
* @param value - The value to set the attribute to.
|
|
1196
1195
|
*/
|
|
1197
|
-
|
|
1196
|
+
o(this, "setAttribute");
|
|
1198
1197
|
/**
|
|
1199
1198
|
* Gets the class of an element.
|
|
1200
1199
|
* @param el - The element to get the class from.
|
|
1201
1200
|
* @returns The class of the element or an empty string if the class is not set.
|
|
1202
1201
|
*/
|
|
1203
|
-
|
|
1202
|
+
o(this, "getClass");
|
|
1204
1203
|
/**
|
|
1205
1204
|
* Sets the class of an element.
|
|
1206
1205
|
* @param el - The element to set the class on.
|
|
1207
1206
|
* @param cls - The class to set.
|
|
1208
1207
|
*/
|
|
1209
|
-
|
|
1208
|
+
o(this, "setClass");
|
|
1210
1209
|
/**
|
|
1211
1210
|
* Gets the styles of an element.
|
|
1212
1211
|
* @param el - The element to get the styles from.
|
|
1213
1212
|
* @returns The styles of the element.
|
|
1214
1213
|
*/
|
|
1215
|
-
|
|
1214
|
+
o(this, "getStyles");
|
|
1216
1215
|
/**
|
|
1217
1216
|
* Sets the styles of an element.
|
|
1218
1217
|
* @param el - The element to set the styles on.
|
|
1219
1218
|
*/
|
|
1220
|
-
|
|
1219
|
+
o(this, "setStyles");
|
|
1221
1220
|
/**
|
|
1222
1221
|
* Appends HTML to an element.
|
|
1223
1222
|
* @param el - The element to append the HTML to.
|
|
1224
1223
|
* @param html - The HTML to append.
|
|
1225
1224
|
*/
|
|
1226
|
-
|
|
1225
|
+
o(this, "appendHTML");
|
|
1227
1226
|
/**
|
|
1228
1227
|
* Gets the inner HTML of an element.
|
|
1229
1228
|
* @param el - The element to get the inner HTML from.
|
|
1230
1229
|
* @returns The inner HTML of the element or an empty string if the inner HTML is not set.
|
|
1231
1230
|
*/
|
|
1232
|
-
|
|
1231
|
+
o(this, "getInnerHTML");
|
|
1233
1232
|
/**
|
|
1234
1233
|
* Sets the inner HTML of an element.
|
|
1235
1234
|
* @param el - The element to set the inner HTML on.
|
|
1236
1235
|
* @param html - The inner HTML to set.
|
|
1237
1236
|
*/
|
|
1238
|
-
|
|
1237
|
+
o(this, "setInnerHTML");
|
|
1239
1238
|
/**
|
|
1240
1239
|
* Gets the inner text of an element.
|
|
1241
1240
|
* @param el - The element to get the inner text from.
|
|
1242
1241
|
* @returns The inner text of the element or an empty string if the inner text is not set.
|
|
1243
1242
|
*/
|
|
1244
|
-
|
|
1243
|
+
o(this, "getInnerText");
|
|
1245
1244
|
/**
|
|
1246
1245
|
* Sets the inner text of an element.
|
|
1247
1246
|
* @param el - The element to set the inner text on.
|
|
1248
1247
|
* @param text - The inner text to set.
|
|
1249
1248
|
*/
|
|
1250
|
-
|
|
1249
|
+
o(this, "setInnerText");
|
|
1251
1250
|
/**
|
|
1252
1251
|
* Sets the content of the root element from a HeadlessPortal. Generally this will be the same instance that is
|
|
1253
1252
|
* returned by `runHeadless`.
|
|
@@ -1256,10 +1255,10 @@ class Rt {
|
|
|
1256
1255
|
* @param setPlaceholders - Whether to set placeholders for the content. This allows you to restore the original content
|
|
1257
1256
|
* when you render on the server and then hydrate on the client.
|
|
1258
1257
|
*/
|
|
1259
|
-
|
|
1258
|
+
o(this, "setFromRoot", (e, t) => {
|
|
1260
1259
|
e.getPortals().forEach((n) => {
|
|
1261
|
-
const
|
|
1262
|
-
for (const l of
|
|
1260
|
+
const i = typeof n.selector == "string" ? this.select(n.selector) : [n.selector];
|
|
1261
|
+
for (const l of i) {
|
|
1263
1262
|
if (l == null)
|
|
1264
1263
|
throw new Error(
|
|
1265
1264
|
`Cannot find element by selector for render: ${n.selector}`
|
|
@@ -1316,11 +1315,11 @@ class Rt {
|
|
|
1316
1315
|
}
|
|
1317
1316
|
});
|
|
1318
1317
|
});
|
|
1319
|
-
this.select = e, this.getAttribute = t, this.setAttribute = r, this.getClass = n, this.setClass =
|
|
1318
|
+
this.select = e, this.getAttribute = t, this.setAttribute = r, this.getClass = n, this.setClass = i, this.getStyles = l, this.setStyles = c, this.appendHTML = a, this.getInnerHTML = u, this.setInnerHTML = h, this.getInnerText = g, this.setInnerText = y;
|
|
1320
1319
|
}
|
|
1321
1320
|
}
|
|
1322
1321
|
const Ye = () => {
|
|
1323
|
-
document.querySelectorAll(`[${ye}]`).forEach(
|
|
1322
|
+
document.querySelectorAll(`[${ye}]`).forEach(V);
|
|
1324
1323
|
}, ze = (s) => {
|
|
1325
1324
|
const e = s.getAttribute(q);
|
|
1326
1325
|
s.removeAttribute(q), e != null && s.setAttribute("class", e);
|
|
@@ -1356,43 +1355,43 @@ const Ye = () => {
|
|
|
1356
1355
|
}
|
|
1357
1356
|
}, it = () => {
|
|
1358
1357
|
document.querySelectorAll(`[${U}]`).forEach((e) => nt(e));
|
|
1359
|
-
},
|
|
1358
|
+
}, Rt = () => {
|
|
1360
1359
|
Ye(), Qe(), tt(), Ke(), rt(), it();
|
|
1361
|
-
}, S = Symbol("class"),
|
|
1360
|
+
}, S = Symbol("class"), E = Symbol("style"), x = Symbol("handler"), be = () => Math.random().toString(36).substring(2, 15), ot = (s) => s.replace(/<[^>]*>?/g, "");
|
|
1362
1361
|
class Se {
|
|
1363
1362
|
constructor(e) {
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1363
|
+
o(this, "id", be());
|
|
1364
|
+
o(this, "properties", {});
|
|
1365
|
+
o(this, "children", []);
|
|
1366
|
+
o(this, "isElement", () => !0);
|
|
1367
|
+
o(this, "isText", () => !1);
|
|
1368
|
+
o(this, "getText", () => this.properties.innerText != null ? this.properties.innerText : this.properties.innerHTML != null ? ot(this.properties.innerHTML) : this.children.map((e) => e.getText()).join(""));
|
|
1369
|
+
o(this, "removeChild", (e) => {
|
|
1371
1370
|
const t = this.children.indexOf(e);
|
|
1372
1371
|
t !== -1 && this.children.splice(t, 1);
|
|
1373
1372
|
});
|
|
1374
|
-
|
|
1373
|
+
o(this, "remove", () => {
|
|
1375
1374
|
if (this.parent != null)
|
|
1376
1375
|
this.parent.removeChild(this);
|
|
1377
1376
|
else
|
|
1378
1377
|
throw new Error("Parent is undefined");
|
|
1379
1378
|
});
|
|
1380
|
-
|
|
1379
|
+
o(this, "getPortals", () => {
|
|
1381
1380
|
const e = this.elements().flatMap((t) => t.isPortal() ? [t, ...t.getPortals()] : t.getPortals());
|
|
1382
1381
|
return this.isPortal() && e.unshift(this), e;
|
|
1383
1382
|
});
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1383
|
+
o(this, "elements", () => this.children.filter((e) => e.isElement()));
|
|
1384
|
+
o(this, "hasInnerHTML", () => this.properties.innerHTML != null);
|
|
1385
|
+
o(this, "getInnerHTML", () => this.properties.innerHTML ?? "");
|
|
1386
|
+
o(this, "getInnerText", () => this.properties.innerText ?? "");
|
|
1387
|
+
o(this, "hasInnerText", () => this.properties.innerText != null);
|
|
1388
|
+
o(this, "hasChildren", () => this.children.length > 0);
|
|
1389
|
+
o(this, "hasClasses", () => this.properties[S] != null);
|
|
1390
|
+
o(this, "hasStyles", () => this.properties[E] != null);
|
|
1391
|
+
o(this, "hasAttributes", () => Object.keys(this.properties).length > 0);
|
|
1392
|
+
o(this, "hasHandlers", () => this.properties[x] != null);
|
|
1393
|
+
o(this, "hasRenderableProperties", () => this.hasClasses() || this.hasAttributes() || this.hasStyles());
|
|
1394
|
+
o(this, "getById", (e) => {
|
|
1396
1395
|
if (this.properties.id === e)
|
|
1397
1396
|
return this;
|
|
1398
1397
|
for (const t of this.elements()) {
|
|
@@ -1401,25 +1400,25 @@ class Se {
|
|
|
1401
1400
|
return r;
|
|
1402
1401
|
}
|
|
1403
1402
|
});
|
|
1404
|
-
|
|
1403
|
+
o(this, "trigger", (e, t) => {
|
|
1405
1404
|
((this.properties[x] ?? {})[e] ?? []).forEach((n) => n(t));
|
|
1406
1405
|
});
|
|
1407
|
-
|
|
1406
|
+
o(this, "click", () => {
|
|
1408
1407
|
this.trigger("click", {});
|
|
1409
1408
|
});
|
|
1410
|
-
|
|
1409
|
+
o(this, "on", (e, t, r, n) => {
|
|
1411
1410
|
var a;
|
|
1412
|
-
const
|
|
1411
|
+
const i = (a = this.properties)[x] ?? (a[x] = {}), l = n != null && n.once ? (u) => {
|
|
1413
1412
|
c(), t(u, r);
|
|
1414
1413
|
} : (u) => t(u, r);
|
|
1415
|
-
|
|
1414
|
+
i[e] = [...i[e] ?? [], l];
|
|
1416
1415
|
const c = () => {
|
|
1417
|
-
const u =
|
|
1418
|
-
h !== -1 && (u.splice(h, 1), u.length === 0 ? (delete
|
|
1416
|
+
const u = i[e] ?? [], h = u.indexOf(l);
|
|
1417
|
+
h !== -1 && (u.splice(h, 1), u.length === 0 ? (delete i[e], Object.keys(i).length === 0 && delete this.properties[x]) : i[e] = u, (n == null ? void 0 : n.signal) != null && n.signal.removeEventListener("abort", c));
|
|
1419
1418
|
};
|
|
1420
1419
|
return (n == null ? void 0 : n.signal) != null && n.signal.addEventListener("abort", c), c;
|
|
1421
1420
|
});
|
|
1422
|
-
|
|
1421
|
+
o(this, "addClasses", (e) => {
|
|
1423
1422
|
var r;
|
|
1424
1423
|
if (e.length === 0)
|
|
1425
1424
|
return;
|
|
@@ -1428,34 +1427,34 @@ class Se {
|
|
|
1428
1427
|
t.includes(n) || t.push(n);
|
|
1429
1428
|
});
|
|
1430
1429
|
});
|
|
1431
|
-
|
|
1430
|
+
o(this, "removeClasses", (e) => {
|
|
1432
1431
|
var r;
|
|
1433
1432
|
if (e.length === 0)
|
|
1434
1433
|
return;
|
|
1435
1434
|
const t = (r = this.properties)[S] ?? (r[S] = []);
|
|
1436
1435
|
e.forEach((n) => {
|
|
1437
|
-
const
|
|
1438
|
-
|
|
1436
|
+
const i = t.indexOf(n);
|
|
1437
|
+
i !== -1 && t.splice(i, 1);
|
|
1439
1438
|
}), t.length === 0 && delete this.properties[S];
|
|
1440
1439
|
});
|
|
1441
|
-
|
|
1442
|
-
|
|
1440
|
+
o(this, "getClasses", () => this.properties[S] ?? []);
|
|
1441
|
+
o(this, "getAttributes", () => Object.entries(this.properties).filter(
|
|
1443
1442
|
([e]) => !["innerText", "innerHTML"].includes(e)
|
|
1444
1443
|
));
|
|
1445
|
-
|
|
1446
|
-
(e) => e === S ? [["class", this.getClasses()]] : e ===
|
|
1444
|
+
o(this, "getVisibleAttributes", () => Reflect.ownKeys(this.properties).flatMap(
|
|
1445
|
+
(e) => e === S ? [["class", this.getClasses()]] : e === E ? [["style", this.getStyles()]] : typeof e == "string" ? [[e, String(this.properties[e])]] : []
|
|
1447
1446
|
));
|
|
1448
|
-
|
|
1447
|
+
o(this, "setStyle", (e, t) => {
|
|
1449
1448
|
var n;
|
|
1450
|
-
const r = (n = this.properties)[
|
|
1451
|
-
r[e] = t, t === "" && (delete r[e], Object.keys(r).length === 0 && delete this.properties[
|
|
1449
|
+
const r = (n = this.properties)[E] ?? (n[E] = {});
|
|
1450
|
+
r[e] = t, t === "" && (delete r[e], Object.keys(r).length === 0 && delete this.properties[E]);
|
|
1452
1451
|
});
|
|
1453
|
-
|
|
1452
|
+
o(this, "getStyle", (e) => {
|
|
1454
1453
|
var t;
|
|
1455
|
-
return ((t = this.properties[
|
|
1454
|
+
return ((t = this.properties[E]) == null ? void 0 : t[e]) ?? "";
|
|
1456
1455
|
});
|
|
1457
|
-
|
|
1458
|
-
|
|
1456
|
+
o(this, "getStyles", () => this.properties[E] ?? {});
|
|
1457
|
+
o(this, "makeAccessors", (e) => {
|
|
1459
1458
|
const t = this.properties;
|
|
1460
1459
|
return {
|
|
1461
1460
|
get: () => t[e],
|
|
@@ -1469,12 +1468,12 @@ const lt = (s) => s.replace(/"/g, """), ct = (s) => s.replace(/&/g, "&"
|
|
|
1469
1468
|
class at extends Se {
|
|
1470
1469
|
constructor(t, r, n) {
|
|
1471
1470
|
super(n);
|
|
1472
|
-
|
|
1473
|
-
|
|
1471
|
+
o(this, "isPortal", () => !1);
|
|
1472
|
+
o(this, "toHTML", (t = !1) => {
|
|
1474
1473
|
const r = this.children.map((a) => a.toHTML()).join(""), n = this.namespace ? ` xmlns="${this.namespace}"` : "";
|
|
1475
|
-
let
|
|
1476
|
-
const l = this.getVisibleAttributes().map(([a, u]) => a === "class" ? ` class="${u.join(" ")}"` : a === "style" ? typeof u == "string" ? ` style="${u}"` : ` style="${Object.entries(u).map(([h, g]) => `${h}: ${g};`).join(" ")}"` : ht.has(a) ? ` ${a}` : a === "innerHTML" ? (
|
|
1477
|
-
return ft.has(this.tagName) && r === "" ? `<${this.tagName}${n}${l}${c} />` : `<${this.tagName}${n}${l}${c}>${
|
|
1474
|
+
let i = null;
|
|
1475
|
+
const l = this.getVisibleAttributes().map(([a, u]) => a === "class" ? ` class="${u.join(" ")}"` : a === "style" ? typeof u == "string" ? ` style="${u}"` : ` style="${Object.entries(u).map(([h, g]) => `${h}: ${g};`).join(" ")}"` : ht.has(a) ? ` ${a}` : a === "innerHTML" ? (i = u, "") : a === "innerText" ? (i = ct(u), "") : ` ${a}="${lt(u)}"`).join(""), c = t ? ` ${ye}` : "";
|
|
1476
|
+
return ft.has(this.tagName) && r === "" ? `<${this.tagName}${n}${l}${c} />` : `<${this.tagName}${n}${l}${c}>${i ?? r}</${this.tagName}>`;
|
|
1478
1477
|
});
|
|
1479
1478
|
this.tagName = t, this.namespace = r;
|
|
1480
1479
|
}
|
|
@@ -1482,32 +1481,32 @@ class at extends Se {
|
|
|
1482
1481
|
class Ae extends Se {
|
|
1483
1482
|
constructor(t, r) {
|
|
1484
1483
|
super(r);
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1484
|
+
o(this, "isPortal", () => !0);
|
|
1485
|
+
o(this, "toHTML", () => "");
|
|
1486
|
+
o(this, "contentToHTML", (t = !1) => this.children.map((r) => r.toHTML(t)).join(""));
|
|
1488
1487
|
this.selector = t;
|
|
1489
1488
|
}
|
|
1490
1489
|
}
|
|
1491
1490
|
class ut {
|
|
1492
1491
|
constructor(e) {
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1492
|
+
o(this, "id", be());
|
|
1493
|
+
o(this, "isElement", () => !1);
|
|
1494
|
+
o(this, "isText", () => !0);
|
|
1495
|
+
o(this, "getText", () => this.text);
|
|
1496
|
+
o(this, "toHTML", () => this.text);
|
|
1498
1497
|
this.text = e;
|
|
1499
1498
|
}
|
|
1500
1499
|
}
|
|
1501
1500
|
class D {
|
|
1502
1501
|
constructor(e, t, r, n) {
|
|
1503
|
-
|
|
1502
|
+
o(this, "appendOrInsert", (e) => {
|
|
1504
1503
|
if (this.reference != null) {
|
|
1505
1504
|
const t = this.element.children.indexOf(this.reference);
|
|
1506
1505
|
this.element.children.splice(t, 0, e);
|
|
1507
1506
|
} else
|
|
1508
1507
|
this.element.children.push(e);
|
|
1509
1508
|
});
|
|
1510
|
-
|
|
1509
|
+
o(this, "makeChildElement", (e, t) => {
|
|
1511
1510
|
const r = new at(e, t, this.element);
|
|
1512
1511
|
return this.appendOrInsert(r), new D(
|
|
1513
1512
|
r,
|
|
@@ -1516,7 +1515,7 @@ class D {
|
|
|
1516
1515
|
this.providers
|
|
1517
1516
|
);
|
|
1518
1517
|
});
|
|
1519
|
-
|
|
1518
|
+
o(this, "makeChildText", (e) => {
|
|
1520
1519
|
const t = new ut(e);
|
|
1521
1520
|
return this.appendOrInsert(t), new D(
|
|
1522
1521
|
this.element,
|
|
@@ -1525,15 +1524,15 @@ class D {
|
|
|
1525
1524
|
this.providers
|
|
1526
1525
|
);
|
|
1527
1526
|
});
|
|
1528
|
-
|
|
1527
|
+
o(this, "setText", (e) => {
|
|
1529
1528
|
this.reference && this.reference.isText() && (this.reference.text = e);
|
|
1530
1529
|
});
|
|
1531
|
-
|
|
1530
|
+
o(this, "getText", () => {
|
|
1532
1531
|
var e;
|
|
1533
1532
|
return ((e = this.reference) == null ? void 0 : e.getText()) ?? this.element.getText();
|
|
1534
1533
|
});
|
|
1535
|
-
|
|
1536
|
-
|
|
1534
|
+
o(this, "makeRef", () => this.makeChildText(""));
|
|
1535
|
+
o(this, "makePortal", (e) => {
|
|
1537
1536
|
const t = new Ae(e, this.element);
|
|
1538
1537
|
return this.appendOrInsert(t), new D(
|
|
1539
1538
|
t,
|
|
@@ -1549,30 +1548,30 @@ class D {
|
|
|
1549
1548
|
* @param value - The provider to set for the given mark.
|
|
1550
1549
|
* @returns A new `DOMContext` instance with the specified provider.
|
|
1551
1550
|
*/
|
|
1552
|
-
|
|
1551
|
+
o(this, "setProvider", (e, t, r) => new D(this.element, this.reference, this.container, {
|
|
1553
1552
|
...this.providers,
|
|
1554
1553
|
[e]: [t, r]
|
|
1555
1554
|
}));
|
|
1556
|
-
|
|
1555
|
+
o(this, "getProvider", (e) => {
|
|
1557
1556
|
if (this.providers[e] === void 0)
|
|
1558
1557
|
throw new me(e);
|
|
1559
1558
|
const [t, r] = this.providers[e];
|
|
1560
1559
|
return { value: t, onUse: r };
|
|
1561
1560
|
});
|
|
1562
|
-
|
|
1561
|
+
o(this, "clear", (e) => {
|
|
1563
1562
|
e && (this.reference !== void 0 ? this.element.removeChild(this.reference) : this.element.remove());
|
|
1564
1563
|
});
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1564
|
+
o(this, "on", (e, t) => this.element.on(e, t, this));
|
|
1565
|
+
o(this, "addClasses", (e) => this.element.addClasses(e));
|
|
1566
|
+
o(this, "removeClasses", (e) => this.element.removeClasses(e));
|
|
1567
|
+
o(this, "getClasses", () => this.element.getClasses());
|
|
1568
|
+
o(this, "isBrowserDOM", () => !1);
|
|
1569
|
+
o(this, "isBrowser", () => !1);
|
|
1570
|
+
o(this, "isHeadlessDOM", () => !0);
|
|
1571
|
+
o(this, "isHeadless", () => !0);
|
|
1572
|
+
o(this, "setStyle", (e, t) => this.element.setStyle(e, t));
|
|
1573
|
+
o(this, "getStyle", (e) => this.element.getStyle(e));
|
|
1574
|
+
o(this, "makeAccessors", (e) => this.element.makeAccessors(e));
|
|
1576
1575
|
this.element = e, this.reference = t, this.container = r, this.providers = n;
|
|
1577
1576
|
}
|
|
1578
1577
|
}
|
|
@@ -1583,36 +1582,36 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1583
1582
|
"readonly",
|
|
1584
1583
|
"required",
|
|
1585
1584
|
"selected"
|
|
1586
|
-
]), ft = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]),
|
|
1585
|
+
]), ft = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), _e = (s) => (e) => e.makeChildText(s).clear, ve = (s) => (e) => {
|
|
1587
1586
|
const t = e.makeChildText(s.value), r = s.on(t.setText);
|
|
1588
1587
|
return (n) => {
|
|
1589
1588
|
r(), t.clear(n);
|
|
1590
1589
|
};
|
|
1591
|
-
}, jt = (s) => d.is(s) ?
|
|
1590
|
+
}, jt = (s) => d.is(s) ? ve(s) : _e(s), b = (...s) => (e) => {
|
|
1592
1591
|
const t = s.map((r) => f(r)(e));
|
|
1593
1592
|
return (r) => {
|
|
1594
1593
|
t.forEach((n) => n(r));
|
|
1595
1594
|
};
|
|
1596
|
-
},
|
|
1595
|
+
}, v = () => () => {
|
|
1597
1596
|
}, dt = (s) => (e) => (e.addClasses(s), (t) => {
|
|
1598
1597
|
t && e.removeClasses(s);
|
|
1599
1598
|
}), pt = (s) => (e) => {
|
|
1600
1599
|
let t = [];
|
|
1601
1600
|
const r = s.on((n) => {
|
|
1602
|
-
e.removeClasses(t), t = (n ?? "").split(" ").filter((
|
|
1601
|
+
e.removeClasses(t), t = (n ?? "").split(" ").filter((i) => i.length > 0), e.addClasses(t);
|
|
1603
1602
|
});
|
|
1604
1603
|
return (n) => {
|
|
1605
1604
|
r(), n && e.removeClasses(t), t.length = 0;
|
|
1606
1605
|
};
|
|
1607
1606
|
}, k = (s, e) => (t) => {
|
|
1608
|
-
const { get: r, set: n } = t.makeAccessors(s),
|
|
1607
|
+
const { get: r, set: n } = t.makeAccessors(s), i = r();
|
|
1609
1608
|
return n(e), (l) => {
|
|
1610
|
-
l && n(
|
|
1609
|
+
l && n(i);
|
|
1611
1610
|
};
|
|
1612
|
-
},
|
|
1613
|
-
const { get: r, set: n } = t.makeAccessors(s),
|
|
1611
|
+
}, N = (s, e) => (t) => {
|
|
1612
|
+
const { get: r, set: n } = t.makeAccessors(s), i = r(), l = e.on(n);
|
|
1614
1613
|
return (c) => {
|
|
1615
|
-
l(), c && n(
|
|
1614
|
+
l(), c && n(i);
|
|
1616
1615
|
};
|
|
1617
1616
|
}, O = new Proxy(
|
|
1618
1617
|
{},
|
|
@@ -1631,7 +1630,7 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1631
1630
|
get: (s, e) => e === "class" ? (t) => d.is(t) ? pt(t) : dt(
|
|
1632
1631
|
/* c8 ignore next */
|
|
1633
1632
|
(t ?? "").split(" ").filter((r) => r.length > 0)
|
|
1634
|
-
) : (t) => d.is(t) ?
|
|
1633
|
+
) : (t) => d.is(t) ? N(
|
|
1635
1634
|
e,
|
|
1636
1635
|
t
|
|
1637
1636
|
) : k(
|
|
@@ -1639,7 +1638,7 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1639
1638
|
t
|
|
1640
1639
|
)
|
|
1641
1640
|
}
|
|
1642
|
-
),
|
|
1641
|
+
), Vt = new Proxy(
|
|
1643
1642
|
{},
|
|
1644
1643
|
{
|
|
1645
1644
|
/**
|
|
@@ -1650,12 +1649,12 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1650
1649
|
* @returns The renderable component for the specified attribute.
|
|
1651
1650
|
*
|
|
1652
1651
|
*/
|
|
1653
|
-
get: (s, e) => (t) => d.is(t) ?
|
|
1652
|
+
get: (s, e) => (t) => d.is(t) ? N(
|
|
1654
1653
|
`data-${e}`,
|
|
1655
1654
|
t
|
|
1656
1655
|
) : k(`data-${e}`, t)
|
|
1657
1656
|
}
|
|
1658
|
-
),
|
|
1657
|
+
), qt = new Proxy(
|
|
1659
1658
|
{},
|
|
1660
1659
|
{
|
|
1661
1660
|
/**
|
|
@@ -1666,7 +1665,7 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1666
1665
|
* @returns The renderable component for the specified attribute.
|
|
1667
1666
|
*
|
|
1668
1667
|
*/
|
|
1669
|
-
get: (s, e) => (t) => d.is(t) ?
|
|
1668
|
+
get: (s, e) => (t) => d.is(t) ? N(
|
|
1670
1669
|
`aria-${e}`,
|
|
1671
1670
|
t
|
|
1672
1671
|
) : k(
|
|
@@ -1674,7 +1673,7 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1674
1673
|
t
|
|
1675
1674
|
)
|
|
1676
1675
|
}
|
|
1677
|
-
),
|
|
1676
|
+
), Ft = new Proxy(
|
|
1678
1677
|
{},
|
|
1679
1678
|
{
|
|
1680
1679
|
/**
|
|
@@ -1685,7 +1684,7 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1685
1684
|
* @returns The renderable component for the specified attribute.
|
|
1686
1685
|
*
|
|
1687
1686
|
*/
|
|
1688
|
-
get: (s, e) => (t) => d.is(t) ?
|
|
1687
|
+
get: (s, e) => (t) => d.is(t) ? N(
|
|
1689
1688
|
e,
|
|
1690
1689
|
t
|
|
1691
1690
|
) : k(
|
|
@@ -1693,7 +1692,7 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1693
1692
|
t
|
|
1694
1693
|
)
|
|
1695
1694
|
}
|
|
1696
|
-
),
|
|
1695
|
+
), Bt = new Proxy(
|
|
1697
1696
|
{},
|
|
1698
1697
|
{
|
|
1699
1698
|
/**
|
|
@@ -1703,7 +1702,7 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1703
1702
|
* @returns The renderable component for the specified attribute.
|
|
1704
1703
|
*
|
|
1705
1704
|
*/
|
|
1706
|
-
get: (s, e) => (t) => d.is(t) ?
|
|
1705
|
+
get: (s, e) => (t) => d.is(t) ? N(
|
|
1707
1706
|
e,
|
|
1708
1707
|
t
|
|
1709
1708
|
) : k(
|
|
@@ -1713,27 +1712,27 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1713
1712
|
}
|
|
1714
1713
|
), f = (s) => {
|
|
1715
1714
|
if (s == null)
|
|
1716
|
-
return
|
|
1715
|
+
return v;
|
|
1717
1716
|
if (Array.isArray(s))
|
|
1718
1717
|
return b(...s.map(f));
|
|
1719
1718
|
if (typeof s == "string")
|
|
1720
|
-
return ve(s);
|
|
1721
|
-
if (d.is(s))
|
|
1722
1719
|
return _e(s);
|
|
1720
|
+
if (d.is(s))
|
|
1721
|
+
return ve(s);
|
|
1723
1722
|
if (typeof s == "function")
|
|
1724
1723
|
return s;
|
|
1725
1724
|
throw new Error(`Unknown type: '${typeof s}' for child: ${s}`);
|
|
1726
|
-
},
|
|
1727
|
-
const r = t.makeChildElement(s, void 0), n = e.map((
|
|
1728
|
-
return (
|
|
1729
|
-
n.forEach((l) => l(!1)), r.clear(
|
|
1725
|
+
}, Ee = (s, ...e) => (t) => {
|
|
1726
|
+
const r = t.makeChildElement(s, void 0), n = e.map((i) => f(i)(r));
|
|
1727
|
+
return (i) => {
|
|
1728
|
+
n.forEach((l) => l(!1)), r.clear(i);
|
|
1730
1729
|
};
|
|
1731
|
-
},
|
|
1732
|
-
const n = r.makeChildElement(s, e),
|
|
1730
|
+
}, we = (s, e, ...t) => (r) => {
|
|
1731
|
+
const n = r.makeChildElement(s, e), i = t.map((l) => f(l)(n));
|
|
1733
1732
|
return (l) => {
|
|
1734
|
-
|
|
1733
|
+
i.forEach((c) => c(!1)), n.clear(l);
|
|
1735
1734
|
};
|
|
1736
|
-
},
|
|
1735
|
+
}, Wt = new Proxy(
|
|
1737
1736
|
{},
|
|
1738
1737
|
{
|
|
1739
1738
|
/**
|
|
@@ -1741,9 +1740,9 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1741
1740
|
* @param tagName - The HTML tag name.
|
|
1742
1741
|
* @returns A renderable function that creates and appends the HTML element to the DOM.
|
|
1743
1742
|
*/
|
|
1744
|
-
get: (s, e) => (...t) =>
|
|
1743
|
+
get: (s, e) => (...t) => Ee(e, t.flatMap(f))
|
|
1745
1744
|
}
|
|
1746
|
-
),
|
|
1745
|
+
), Ut = new Proxy(
|
|
1747
1746
|
{},
|
|
1748
1747
|
{
|
|
1749
1748
|
/**
|
|
@@ -1751,9 +1750,9 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1751
1750
|
* @param type - The input type name.
|
|
1752
1751
|
* @returns A renderable function that creates and appends the HTMLInput element to the DOM.
|
|
1753
1752
|
*/
|
|
1754
|
-
get: (s, e) => (...t) =>
|
|
1753
|
+
get: (s, e) => (...t) => Ee("input", O.type(e), ...t)
|
|
1755
1754
|
}
|
|
1756
|
-
), gt = "http://www.w3.org/2000/svg",
|
|
1755
|
+
), gt = "http://www.w3.org/2000/svg", Jt = new Proxy(
|
|
1757
1756
|
{},
|
|
1758
1757
|
{
|
|
1759
1758
|
/**
|
|
@@ -1761,9 +1760,9 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1761
1760
|
* @param tagName - The SVG tag name.
|
|
1762
1761
|
* @returns A renderable function that creates and appends the SVG element to the DOM.
|
|
1763
1762
|
*/
|
|
1764
|
-
get: (s, e) => (...t) =>
|
|
1763
|
+
get: (s, e) => (...t) => we(e, gt, t.flatMap(f))
|
|
1765
1764
|
}
|
|
1766
|
-
), mt = "http://www.w3.org/1998/Math/MathML",
|
|
1765
|
+
), mt = "http://www.w3.org/1998/Math/MathML", Gt = new Proxy(
|
|
1767
1766
|
{},
|
|
1768
1767
|
{
|
|
1769
1768
|
/**
|
|
@@ -1771,15 +1770,15 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1771
1770
|
* @param tagName - The Math tag name.
|
|
1772
1771
|
* @returns A renderable function that creates and appends the Math element to the DOM.
|
|
1773
1772
|
*/
|
|
1774
|
-
get: (s, e) => (...t) =>
|
|
1773
|
+
get: (s, e) => (...t) => we(e, mt, t.flatMap(f))
|
|
1775
1774
|
}
|
|
1776
1775
|
), Ce = (s, e) => {
|
|
1777
1776
|
if (typeof e == "function")
|
|
1778
1777
|
return Ce(s, { then: e });
|
|
1779
|
-
const t = e.pending != null ? f(e.pending()) :
|
|
1780
|
-
return (
|
|
1778
|
+
const t = e.pending != null ? f(e.pending()) : v, r = e.then, n = e.error != null ? (i) => f(e.error(i)) : () => v;
|
|
1779
|
+
return (i) => {
|
|
1781
1780
|
let l = !0;
|
|
1782
|
-
const c = s(), a =
|
|
1781
|
+
const c = s(), a = i.makeRef();
|
|
1783
1782
|
let u = f(t)(a);
|
|
1784
1783
|
return c.then(
|
|
1785
1784
|
(h) => {
|
|
@@ -1792,7 +1791,7 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1792
1791
|
l = !1, u(h), a.clear(h);
|
|
1793
1792
|
};
|
|
1794
1793
|
};
|
|
1795
|
-
},
|
|
1794
|
+
}, Xt = (s, e) => Ce(() => s, e), xe = (s, e, t) => (r) => r.on(s, e, t), yt = (s) => xe("click", (e, t) => {
|
|
1796
1795
|
e.preventDefault();
|
|
1797
1796
|
const r = e.target;
|
|
1798
1797
|
setTimeout(() => {
|
|
@@ -1825,7 +1824,7 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1825
1824
|
Number(r[2].substring(0, 2))
|
|
1826
1825
|
);
|
|
1827
1826
|
s(n);
|
|
1828
|
-
},
|
|
1827
|
+
}, Yt = (s) => (e) => {
|
|
1829
1828
|
const t = e.target;
|
|
1830
1829
|
if (t.value === "") {
|
|
1831
1830
|
s(null);
|
|
@@ -1841,13 +1840,13 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1841
1840
|
const t = e.target;
|
|
1842
1841
|
if (t.value === "")
|
|
1843
1842
|
return;
|
|
1844
|
-
const r = t.value.split("T"), n = r[0].split("-"),
|
|
1843
|
+
const r = t.value.split("T"), n = r[0].split("-"), i = new Date(
|
|
1845
1844
|
Number(n[0]),
|
|
1846
1845
|
Number(n[1]) - 1,
|
|
1847
1846
|
Number(n[2])
|
|
1848
1847
|
), l = r[1].split(":");
|
|
1849
|
-
|
|
1850
|
-
},
|
|
1848
|
+
i.setHours(Number(l[0])), i.setMinutes(Number(l[1])), i.setSeconds(Number(l[2])), s(i);
|
|
1849
|
+
}, zt = (s) => (e) => {
|
|
1851
1850
|
const t = e.target;
|
|
1852
1851
|
if (t.value === "") {
|
|
1853
1852
|
s(null);
|
|
@@ -1858,84 +1857,84 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1858
1857
|
s(null);
|
|
1859
1858
|
return;
|
|
1860
1859
|
}
|
|
1861
|
-
const n = r[0].split("-"),
|
|
1860
|
+
const n = r[0].split("-"), i = new Date(
|
|
1862
1861
|
Number(n[0]),
|
|
1863
1862
|
Number(n[1]) - 1,
|
|
1864
1863
|
Number(n[2])
|
|
1865
1864
|
), l = r[1].split(":");
|
|
1866
|
-
|
|
1867
|
-
},
|
|
1865
|
+
i.setHours(Number(l[0] ?? 0)), i.setMinutes(Number(l[1] ?? 0)), i.setSeconds(Number(l[2] ?? 0)), s(i);
|
|
1866
|
+
}, Qt = (s) => (e) => {
|
|
1868
1867
|
const t = e.target;
|
|
1869
1868
|
s(t.checked);
|
|
1870
|
-
},
|
|
1869
|
+
}, Zt = (s) => (e) => {
|
|
1871
1870
|
e.preventDefault(), s();
|
|
1872
|
-
},
|
|
1871
|
+
}, Kt = (s) => (e) => {
|
|
1873
1872
|
e.stopPropagation(), s();
|
|
1874
|
-
},
|
|
1873
|
+
}, es = (s) => (e) => {
|
|
1875
1874
|
e.stopImmediatePropagation(), s();
|
|
1876
|
-
},
|
|
1875
|
+
}, ts = (s, e = "input") => b(O.valueAsDate(s), X[e](St(s.set))), ss = (s, e = "input") => b(O.valueAsDate(s), X[e](At(s.set))), rs = (s, e = "input") => b(O.valueAsNumber(s), X[e](bt(s.set))), ns = (s, e = "input") => b(O.value(s), X[e](Tt(s.set))), is = (s) => b(O.checked(s), yt(s.set)), Y = (s, e) => {
|
|
1877
1876
|
if (d.is(s))
|
|
1878
1877
|
return (r) => {
|
|
1879
1878
|
const n = r.makeRef();
|
|
1880
|
-
let
|
|
1879
|
+
let i, l;
|
|
1881
1880
|
const c = s.map((h) => Object.keys(h)[0]);
|
|
1882
1881
|
let a;
|
|
1883
1882
|
const u = c.on((h) => {
|
|
1884
1883
|
if (h !== a) {
|
|
1885
|
-
a = h, l == null || l.dispose(),
|
|
1884
|
+
a = h, l == null || l.dispose(), i == null || i(!0), l = s.map((y) => y[h]);
|
|
1886
1885
|
const g = e[h](l);
|
|
1887
|
-
|
|
1886
|
+
i = f(g)(n);
|
|
1888
1887
|
}
|
|
1889
1888
|
});
|
|
1890
1889
|
return (h) => {
|
|
1891
|
-
l == null || l.dispose(), u(), n.clear(h),
|
|
1890
|
+
l == null || l.dispose(), u(), n.clear(h), i == null || i(h);
|
|
1892
1891
|
};
|
|
1893
1892
|
};
|
|
1894
1893
|
const t = Object.keys(s)[0];
|
|
1895
1894
|
return f(e[t](G(s[t])));
|
|
1896
1895
|
}, Pe = (s, e, t) => Y(
|
|
1897
|
-
|
|
1896
|
+
T.map(s, (r) => ({ [r[e]]: r })),
|
|
1898
1897
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1899
1898
|
t
|
|
1900
|
-
),
|
|
1901
|
-
const t =
|
|
1899
|
+
), os = (s, e) => Pe(s, "kind", e), ls = (s, e) => {
|
|
1900
|
+
const t = T.map(s, ([r, n]) => ({ [r]: n }));
|
|
1902
1901
|
return Y(t, e);
|
|
1903
|
-
},
|
|
1904
|
-
|
|
1902
|
+
}, cs = (s, e) => Pe(s, "type", e), _t = (s, e) => Y(
|
|
1903
|
+
T.map(s, (t) => ({ [t]: !0 })),
|
|
1905
1904
|
e
|
|
1906
|
-
),
|
|
1905
|
+
), as = (s, e = {}) => (t) => {
|
|
1907
1906
|
const r = (e == null ? void 0 : e.firstSeparator) ?? s, n = (e == null ? void 0 : e.lastSeparator) ?? s;
|
|
1908
|
-
return
|
|
1909
|
-
t.map((
|
|
1907
|
+
return _t(
|
|
1908
|
+
t.map((i) => i.isFirst ? "first" : i.isLast ? "last" : "other"),
|
|
1910
1909
|
{
|
|
1911
1910
|
first: r,
|
|
1912
1911
|
last: n,
|
|
1913
1912
|
other: s
|
|
1914
1913
|
}
|
|
1915
1914
|
);
|
|
1916
|
-
},
|
|
1917
|
-
t &&
|
|
1918
|
-
}),
|
|
1915
|
+
}, us = (s) => (e) => (e.appendOrInsert(s), (t) => {
|
|
1916
|
+
t && V(s);
|
|
1917
|
+
}), hs = (s, e, t) => {
|
|
1919
1918
|
if (d.is(s)) {
|
|
1920
1919
|
const r = s;
|
|
1921
1920
|
return (n) => {
|
|
1922
|
-
const
|
|
1921
|
+
const i = n.makeRef();
|
|
1923
1922
|
let l = () => {
|
|
1924
1923
|
}, c = !1, a = null;
|
|
1925
1924
|
const u = r.on((h) => {
|
|
1926
|
-
h == null ? (l(!0), l = f(
|
|
1927
|
-
|
|
1928
|
-
), c = !0)
|
|
1925
|
+
h == null ? (l(!0), l = f(t == null ? void 0 : t())(i), c = !1, a == null || a.dispose(), a = null) : c ? a.set(h) : (a = _(h), l(!0), l = f(e(a))(
|
|
1926
|
+
i
|
|
1927
|
+
), c = !0);
|
|
1929
1928
|
});
|
|
1930
1929
|
return (h) => {
|
|
1931
|
-
a == null || a.dispose(), u(), l == null || l(h),
|
|
1930
|
+
a == null || a.dispose(), u(), l == null || l(h), i.clear(h);
|
|
1932
1931
|
};
|
|
1933
1932
|
};
|
|
1934
1933
|
} else {
|
|
1935
1934
|
const r = s;
|
|
1936
1935
|
if (r == null) {
|
|
1937
1936
|
const n = t == null ? void 0 : t();
|
|
1938
|
-
return n != null ? f(n) :
|
|
1937
|
+
return n != null ? f(n) : v;
|
|
1939
1938
|
}
|
|
1940
1939
|
return f(e(G(r)));
|
|
1941
1940
|
}
|
|
@@ -1944,17 +1943,17 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1944
1943
|
if (s.some(
|
|
1945
1944
|
(p) => !d.is(p) && p == null
|
|
1946
1945
|
))
|
|
1947
|
-
return (t != null ? f(t == null ? void 0 : t()) :
|
|
1946
|
+
return (t != null ? f(t == null ? void 0 : t()) : v)(
|
|
1948
1947
|
n
|
|
1949
1948
|
);
|
|
1950
1949
|
const l = s.map(() => null), c = s.map(
|
|
1951
1950
|
(p) => d.is(p) ? p.value != null : p != null
|
|
1952
1951
|
);
|
|
1953
1952
|
let a = null;
|
|
1954
|
-
const u =
|
|
1953
|
+
const u = _(c.every((p) => p)), h = (p, m) => {
|
|
1955
1954
|
if (p.value != null) {
|
|
1956
1955
|
if (l[m] == null) {
|
|
1957
|
-
const C =
|
|
1956
|
+
const C = _(p.value);
|
|
1958
1957
|
l[m] = C;
|
|
1959
1958
|
} else
|
|
1960
1959
|
l[m].value = p.value;
|
|
@@ -1963,9 +1962,9 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1963
1962
|
c[m] = !1;
|
|
1964
1963
|
};
|
|
1965
1964
|
let g = s.length - 1;
|
|
1966
|
-
const
|
|
1965
|
+
const y = s.map((p, m) => {
|
|
1967
1966
|
if (!d.is(p)) {
|
|
1968
|
-
const C =
|
|
1967
|
+
const C = _(p);
|
|
1969
1968
|
return l[m] = C, () => {
|
|
1970
1969
|
};
|
|
1971
1970
|
}
|
|
@@ -1974,16 +1973,33 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1974
1973
|
});
|
|
1975
1974
|
});
|
|
1976
1975
|
return u.on((p) => {
|
|
1977
|
-
a == null || a(!0), a = null, p ? a = f(e(...l))(n) : a = f((t == null ? void 0 : t()) ??
|
|
1976
|
+
a == null || a(!0), a = null, p ? a = f(e(...l))(n) : a = f((t == null ? void 0 : t()) ?? v)(n);
|
|
1978
1977
|
}), (p) => {
|
|
1979
|
-
l.forEach((m) => m == null ? void 0 : m.dispose()), u.dispose(),
|
|
1978
|
+
l.forEach((m) => m == null ? void 0 : m.dispose()), u.dispose(), y.forEach((m) => m()), a == null || a(p), n.clear(p);
|
|
1980
1979
|
};
|
|
1981
|
-
}, M = (...s) => (e) => (t) => s.forEach((r) => r(t, e)), Le = (s, e, t) =>
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1980
|
+
}, M = (...s) => (e) => (t) => s.forEach((r) => r(t, e)), Le = (s, e, t) => {
|
|
1981
|
+
if (d.is(s)) {
|
|
1982
|
+
const r = s;
|
|
1983
|
+
return (n) => {
|
|
1984
|
+
const i = n.makeRef();
|
|
1985
|
+
let l = () => {
|
|
1986
|
+
};
|
|
1987
|
+
const c = r.on((a) => {
|
|
1988
|
+
l(!0), a ? l = f(e())(i) : l = f(t == null ? void 0 : t())(i);
|
|
1989
|
+
});
|
|
1990
|
+
return (a) => {
|
|
1991
|
+
l(a), c(), i.clear(a);
|
|
1992
|
+
};
|
|
1993
|
+
};
|
|
1994
|
+
} else {
|
|
1995
|
+
if (s) {
|
|
1996
|
+
const n = e();
|
|
1997
|
+
return n != null ? f(n) : v;
|
|
1998
|
+
}
|
|
1999
|
+
return f(t == null ? void 0 : t());
|
|
2000
|
+
}
|
|
2001
|
+
}, ds = (s, e, t) => Le(
|
|
2002
|
+
T.map(s, (r) => !r),
|
|
1987
2003
|
e,
|
|
1988
2004
|
t
|
|
1989
2005
|
), De = (s, e, t) => {
|
|
@@ -1991,21 +2007,21 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1991
2007
|
return De(s, (r) => {
|
|
1992
2008
|
const n = new Q(
|
|
1993
2009
|
r.index,
|
|
1994
|
-
r.total.map((
|
|
2010
|
+
r.total.map((i) => i - 1)
|
|
1995
2011
|
);
|
|
1996
2012
|
return b(
|
|
1997
2013
|
M(n.dispose),
|
|
1998
2014
|
f(e(r)),
|
|
1999
2015
|
Le(
|
|
2000
2016
|
r.isLast,
|
|
2001
|
-
() =>
|
|
2017
|
+
() => v,
|
|
2002
2018
|
() => t(n)
|
|
2003
2019
|
)
|
|
2004
2020
|
);
|
|
2005
2021
|
});
|
|
2006
2022
|
if (d.is(s))
|
|
2007
2023
|
return (r) => {
|
|
2008
|
-
const n = s.derive(),
|
|
2024
|
+
const n = s.derive(), i = r.makeRef(), l = [];
|
|
2009
2025
|
return n.on((c) => {
|
|
2010
2026
|
const a = l.splice(c);
|
|
2011
2027
|
for (const u of a)
|
|
@@ -2016,37 +2032,37 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
2016
2032
|
b(
|
|
2017
2033
|
M(h.dispose),
|
|
2018
2034
|
f(e(h))
|
|
2019
|
-
)(
|
|
2035
|
+
)(i)
|
|
2020
2036
|
);
|
|
2021
2037
|
}
|
|
2022
2038
|
}), (c) => {
|
|
2023
2039
|
n.dispose();
|
|
2024
2040
|
for (const a of l)
|
|
2025
2041
|
a(c);
|
|
2026
|
-
l.length = 0,
|
|
2042
|
+
l.length = 0, i.clear(c);
|
|
2027
2043
|
};
|
|
2028
2044
|
};
|
|
2029
2045
|
{
|
|
2030
2046
|
const r = G(s);
|
|
2031
2047
|
return b(
|
|
2032
|
-
...Array.from({ length: s }, (n,
|
|
2033
|
-
const
|
|
2048
|
+
...Array.from({ length: s }, (n, i) => i).map((n) => {
|
|
2049
|
+
const i = new Q(n, r);
|
|
2034
2050
|
return b(
|
|
2035
|
-
M(
|
|
2036
|
-
f(e(
|
|
2051
|
+
M(i.dispose),
|
|
2052
|
+
f(e(i))
|
|
2037
2053
|
);
|
|
2038
2054
|
})
|
|
2039
2055
|
);
|
|
2040
2056
|
}
|
|
2041
2057
|
}, ps = (s, e, t) => {
|
|
2042
|
-
const r =
|
|
2058
|
+
const r = T.map(s, (i) => i.length), n = T.toSignal(s);
|
|
2043
2059
|
return De(
|
|
2044
2060
|
r,
|
|
2045
|
-
(
|
|
2046
|
-
const l = n.map((c) => c[
|
|
2061
|
+
(i) => {
|
|
2062
|
+
const l = n.map((c) => c[i.index]);
|
|
2047
2063
|
return b(
|
|
2048
2064
|
M(l.dispose),
|
|
2049
|
-
f(e(l,
|
|
2065
|
+
f(e(l, i))
|
|
2050
2066
|
);
|
|
2051
2067
|
},
|
|
2052
2068
|
t
|
|
@@ -2057,19 +2073,19 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
2057
2073
|
return (r) => {
|
|
2058
2074
|
r = r.makeRef();
|
|
2059
2075
|
const n = t.map((c) => f(e(c)));
|
|
2060
|
-
let
|
|
2076
|
+
let i = () => {
|
|
2061
2077
|
};
|
|
2062
2078
|
const l = n.on((c) => {
|
|
2063
|
-
|
|
2079
|
+
i(!0), i = c(r);
|
|
2064
2080
|
});
|
|
2065
2081
|
return (c) => {
|
|
2066
|
-
l(),
|
|
2082
|
+
l(), i(c);
|
|
2067
2083
|
};
|
|
2068
2084
|
};
|
|
2069
2085
|
}
|
|
2070
2086
|
return f(e(s));
|
|
2071
|
-
}, ms = (s, e, t = () =>
|
|
2072
|
-
|
|
2087
|
+
}, ms = (s, e, t = () => v) => Y(
|
|
2088
|
+
T.map(
|
|
2073
2089
|
s,
|
|
2074
2090
|
(r) => r.length > 0 ? { notEmpty: r } : { whenEmpty: null }
|
|
2075
2091
|
),
|
|
@@ -2080,7 +2096,7 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
2080
2096
|
), ys = (s, e) => (t) => {
|
|
2081
2097
|
const r = t.makePortal(s), n = K(f(e), r);
|
|
2082
2098
|
return () => n(!0);
|
|
2083
|
-
}, R = /* @__PURE__ */ new Map(),
|
|
2099
|
+
}, R = /* @__PURE__ */ new Map(), vt = (s) => ({
|
|
2084
2100
|
mark: Ge(`Probe(${s.description})`),
|
|
2085
2101
|
create: ({ callback: e = () => {
|
|
2086
2102
|
}, timeout: t = 10 } = {}) => {
|
|
@@ -2089,26 +2105,26 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
2089
2105
|
};
|
|
2090
2106
|
if (R.has(s))
|
|
2091
2107
|
throw new Error(`Probe already exists: ${s.description}`);
|
|
2092
|
-
const n = setTimeout(() => r("timeout"), t),
|
|
2093
|
-
return R.set(s,
|
|
2108
|
+
const n = setTimeout(() => r("timeout"), t), i = { counter: 0, timeoutId: n };
|
|
2109
|
+
return R.set(s, i), {
|
|
2094
2110
|
value: () => {
|
|
2095
2111
|
clearTimeout(n);
|
|
2096
2112
|
const c = R.get(s);
|
|
2097
2113
|
c != null && --c.counter === 0 && r("resolved");
|
|
2098
2114
|
},
|
|
2099
2115
|
dispose: () => r("disposed"),
|
|
2100
|
-
onUse: () =>
|
|
2116
|
+
onUse: () => i.counter++
|
|
2101
2117
|
};
|
|
2102
2118
|
}
|
|
2103
|
-
}), Ts =
|
|
2119
|
+
}), Ts = vt(Symbol("GlobalProbe")), Et = (s, e) => (t) => {
|
|
2104
2120
|
const r = t.getStyle(s);
|
|
2105
2121
|
return t.setStyle(s, e), (n) => {
|
|
2106
2122
|
n && t.setStyle(s, r);
|
|
2107
2123
|
};
|
|
2108
|
-
},
|
|
2109
|
-
const r = t.getStyle(s);
|
|
2110
|
-
return
|
|
2111
|
-
n && t.setStyle(s, r);
|
|
2124
|
+
}, wt = (s, e) => (t) => {
|
|
2125
|
+
const r = t.getStyle(s), n = e.on((i) => t.setStyle(s, i));
|
|
2126
|
+
return (i) => {
|
|
2127
|
+
n(), i && t.setStyle(s, r);
|
|
2112
2128
|
};
|
|
2113
2129
|
}, bs = new Proxy(
|
|
2114
2130
|
{},
|
|
@@ -2121,9 +2137,9 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
2121
2137
|
* @returns The renderable component for the specified attribute.
|
|
2122
2138
|
*
|
|
2123
2139
|
*/
|
|
2124
|
-
get: (s, e) => (t) => d.is(t) ?
|
|
2140
|
+
get: (s, e) => (t) => d.is(t) ? wt(e, t) : Et(e, t)
|
|
2125
2141
|
}
|
|
2126
|
-
),
|
|
2142
|
+
), Ct = (s) => (e) => {
|
|
2127
2143
|
if (e.isBrowser()) {
|
|
2128
2144
|
const t = s(e);
|
|
2129
2145
|
if (t != null)
|
|
@@ -2135,7 +2151,7 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
2135
2151
|
const t = s(e);
|
|
2136
2152
|
return t == null ? () => {
|
|
2137
2153
|
} : f(t)(e);
|
|
2138
|
-
}, As = (s) =>
|
|
2154
|
+
}, As = (s) => Ct((e) => s(e.element)), _s = (s) => (e) => {
|
|
2139
2155
|
if (e.isHeadlessDOM()) {
|
|
2140
2156
|
const t = s(e);
|
|
2141
2157
|
if (t)
|
|
@@ -2151,47 +2167,47 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
2151
2167
|
function n(c) {
|
|
2152
2168
|
t = c;
|
|
2153
2169
|
}
|
|
2154
|
-
const
|
|
2170
|
+
const i = [], l = s({
|
|
2155
2171
|
use: ({ mark: c }) => {
|
|
2156
2172
|
const { value: a, onUse: u } = r().getProvider(c);
|
|
2157
2173
|
return u == null || u(), a;
|
|
2158
2174
|
},
|
|
2159
2175
|
set: ({ mark: c, create: a }, u) => {
|
|
2160
|
-
const { value: h, dispose: g, onUse:
|
|
2161
|
-
|
|
2176
|
+
const { value: h, dispose: g, onUse: y } = a(u, r());
|
|
2177
|
+
i.push(g), n(r().setProvider(c, h, y));
|
|
2162
2178
|
}
|
|
2163
2179
|
});
|
|
2164
2180
|
return l == null ? () => {
|
|
2165
2181
|
} : b(
|
|
2166
2182
|
f(l),
|
|
2167
|
-
M(() =>
|
|
2183
|
+
M(() => i.forEach((c) => c()))
|
|
2168
2184
|
)(r());
|
|
2169
|
-
},
|
|
2185
|
+
}, vs = (s, e, t) => ee(({ set: r }) => (r(s, e), t())), Es = (s, e) => ee(({ use: t }) => e(t(s))), ws = (...s) => (e) => ee(({ use: t }) => {
|
|
2170
2186
|
const r = s.map(t);
|
|
2171
2187
|
return e(...r);
|
|
2172
2188
|
});
|
|
2173
2189
|
export {
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2190
|
+
Xt as Async,
|
|
2191
|
+
is as BindChecked,
|
|
2192
|
+
ts as BindDate,
|
|
2193
|
+
ss as BindDateTime,
|
|
2194
|
+
rs as BindNumber,
|
|
2195
|
+
ns as BindText,
|
|
2180
2196
|
L as BrowserContext,
|
|
2181
2197
|
q as CLASS_PLACEHOLDER_ATTR,
|
|
2182
2198
|
P as Computed,
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2199
|
+
as as Conjunction,
|
|
2200
|
+
us as DOMNode,
|
|
2201
|
+
Ee as El,
|
|
2202
|
+
we as ElNS,
|
|
2187
2203
|
Q as ElementPosition,
|
|
2188
|
-
|
|
2189
|
-
|
|
2204
|
+
v as Empty,
|
|
2205
|
+
hs as Ensure,
|
|
2190
2206
|
fs as EnsureAll,
|
|
2191
2207
|
ps as ForEach,
|
|
2192
2208
|
b as Fragment,
|
|
2193
2209
|
Ts as GlobalProbe,
|
|
2194
|
-
|
|
2210
|
+
It as HeadlessAdapter,
|
|
2195
2211
|
D as HeadlessContext,
|
|
2196
2212
|
at as HeadlessElement,
|
|
2197
2213
|
Ae as HeadlessPortal,
|
|
@@ -2203,13 +2219,13 @@ export {
|
|
|
2203
2219
|
M as OnDispose,
|
|
2204
2220
|
Y as OneOf,
|
|
2205
2221
|
Pe as OneOfField,
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2222
|
+
os as OneOfKind,
|
|
2223
|
+
ls as OneOfTuple,
|
|
2224
|
+
cs as OneOfType,
|
|
2225
|
+
_t as OneOfValue,
|
|
2210
2226
|
ys as Portal,
|
|
2211
|
-
|
|
2212
|
-
|
|
2227
|
+
j as Prop,
|
|
2228
|
+
vs as Provide,
|
|
2213
2229
|
me as ProviderNotFoundError,
|
|
2214
2230
|
Xe as RenderingError,
|
|
2215
2231
|
De as Repeat,
|
|
@@ -2217,70 +2233,70 @@ export {
|
|
|
2217
2233
|
Ce as Task,
|
|
2218
2234
|
jt as TextNode,
|
|
2219
2235
|
ds as Unless,
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2236
|
+
Es as Use,
|
|
2237
|
+
ws as UseMany,
|
|
2238
|
+
T as Value,
|
|
2223
2239
|
Le as When,
|
|
2224
|
-
|
|
2240
|
+
Ct as WithBrowserCtx,
|
|
2225
2241
|
Ss as WithCtx,
|
|
2226
2242
|
As as WithElement,
|
|
2227
|
-
|
|
2243
|
+
_s as WithHeadlessCtx,
|
|
2228
2244
|
ee as WithProvider,
|
|
2229
2245
|
ye as _NODE_PLACEHOLDER_ATTR,
|
|
2230
2246
|
Je as _getSelfOrParentElement,
|
|
2231
2247
|
ge as _isElement,
|
|
2232
2248
|
Ue as _makeGetter,
|
|
2233
2249
|
We as _makeSetter,
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2250
|
+
V as _removeDOMNode,
|
|
2251
|
+
ve as _signalText,
|
|
2252
|
+
_e as _staticText,
|
|
2253
|
+
Mt as animateSignal,
|
|
2238
2254
|
Fe as animateSignals,
|
|
2239
|
-
|
|
2255
|
+
qt as aria,
|
|
2240
2256
|
O as attr,
|
|
2241
2257
|
Z as computed,
|
|
2242
2258
|
qe as computedOf,
|
|
2243
2259
|
Be as computedRecord,
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2260
|
+
Vt as dataAttr,
|
|
2261
|
+
kt as delaySignal,
|
|
2262
|
+
Ve as effect,
|
|
2263
|
+
Lt as effectOf,
|
|
2264
|
+
Qt as emitChecked,
|
|
2265
|
+
Zt as emitPreventDefault,
|
|
2266
|
+
es as emitStopImmediatePropagation,
|
|
2267
|
+
Kt as emitStopPropagation,
|
|
2252
2268
|
Tt as emitValue,
|
|
2253
2269
|
St as emitValueAsDate,
|
|
2254
2270
|
At as emitValueAsDateTime,
|
|
2255
|
-
|
|
2256
|
-
|
|
2271
|
+
Yt as emitValueAsNullableDate,
|
|
2272
|
+
zt as emitValueAsNullableDateTime,
|
|
2257
2273
|
bt as emitValueAsNumber,
|
|
2258
2274
|
Ie as endInterpolate,
|
|
2259
2275
|
le as getWindow,
|
|
2260
2276
|
Re as guessInterpolate,
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2277
|
+
Wt as html,
|
|
2278
|
+
Ut as input,
|
|
2279
|
+
$e as interpolateDate,
|
|
2264
2280
|
ke as interpolateNumber,
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2281
|
+
Ne as interpolateString,
|
|
2282
|
+
Pt as joinSignals,
|
|
2283
|
+
Dt as localStorageProp,
|
|
2284
|
+
vt as makeProbe,
|
|
2269
2285
|
Ge as makeProviderMark,
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2286
|
+
Gt as math,
|
|
2287
|
+
Bt as mathAttr,
|
|
2288
|
+
Ht as merge,
|
|
2273
2289
|
X as on,
|
|
2274
|
-
|
|
2290
|
+
_ as prop,
|
|
2275
2291
|
Nt as render,
|
|
2276
2292
|
K as renderWithContext,
|
|
2277
2293
|
f as renderableOfTNode,
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2294
|
+
Rt as restoreTempoPlaceholders,
|
|
2295
|
+
$t as runHeadless,
|
|
2296
|
+
Ot as sessionStorageProp,
|
|
2281
2297
|
G as signal,
|
|
2282
2298
|
ae as storedProp,
|
|
2283
2299
|
bs as style,
|
|
2284
|
-
|
|
2285
|
-
|
|
2300
|
+
Jt as svg,
|
|
2301
|
+
Ft as svgAttr
|
|
2286
2302
|
};
|