@tempots/dom 28.0.1 → 28.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1 -1
- package/index.js +483 -480
- package/package.json +1 -1
- package/std/signal-utils.d.ts +2 -1
- package/std/signal.d.ts +1 -1
package/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Me = Object.defineProperty;
|
|
2
2
|
var re = (s) => {
|
|
3
3
|
throw TypeError(s);
|
|
4
4
|
};
|
|
5
|
-
var He = (s, e, t) => e in s ?
|
|
6
|
-
var
|
|
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 i = (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
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const ke = (s, e, t) => s + (e - s) * t;
|
|
9
|
+
const $e = (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 o = 0; o < r; o++) {
|
|
13
|
+
let l = s.charCodeAt(o);
|
|
14
14
|
isNaN(l) && (l = 97);
|
|
15
|
-
let c = e.charCodeAt(
|
|
15
|
+
let c = e.charCodeAt(o);
|
|
16
16
|
isNaN(c) && (c = 97), n += String.fromCharCode(l + (c - l) * t);
|
|
17
17
|
}
|
|
18
18
|
return n;
|
|
19
|
-
}, Ne = (s, e, t) => new Date(s.getTime() + (e.getTime() - s.getTime()) * t), Ie = (s, e) => e, Re = (s) => typeof s == "number" ?
|
|
19
|
+
}, Ne = (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" ? $e : s instanceof Date ? Ne : Ie;
|
|
20
20
|
var w;
|
|
21
21
|
class Q {
|
|
22
22
|
/**
|
|
@@ -28,24 +28,24 @@ class Q {
|
|
|
28
28
|
/**
|
|
29
29
|
* The counter of the element starting from 1.
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
i(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
|
+
i(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
|
+
i(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
|
-
|
|
46
|
+
i(this, "isOdd");
|
|
47
47
|
ie(this, w);
|
|
48
|
-
|
|
48
|
+
i(this, "dispose", () => {
|
|
49
49
|
var e;
|
|
50
50
|
(e = I(this, w)) == null || e.dispose(), z(this, w, void 0);
|
|
51
51
|
});
|
|
@@ -72,33 +72,33 @@ const H = class H {
|
|
|
72
72
|
/**
|
|
73
73
|
* @internal
|
|
74
74
|
*/
|
|
75
|
-
|
|
75
|
+
i(this, "$__signal__", !0);
|
|
76
76
|
/**
|
|
77
77
|
* @internal
|
|
78
78
|
*/
|
|
79
|
-
|
|
79
|
+
i(this, "_value");
|
|
80
80
|
/**
|
|
81
81
|
* @internal
|
|
82
82
|
*/
|
|
83
|
-
|
|
83
|
+
i(this, "_derivatives", []);
|
|
84
84
|
/**
|
|
85
85
|
* @internal
|
|
86
86
|
*/
|
|
87
|
-
|
|
87
|
+
i(this, "_onValueListeners", []);
|
|
88
88
|
/**
|
|
89
89
|
* @internal
|
|
90
90
|
*/
|
|
91
|
-
|
|
91
|
+
i(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
|
+
i(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
|
+
i(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
|
+
i(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 ? (o, l) => {
|
|
113
|
+
n(), e(o, l);
|
|
114
114
|
} : e;
|
|
115
115
|
this._onValueListeners.push(r);
|
|
116
116
|
const n = () => {
|
|
@@ -124,32 +124,32 @@ const H = class H {
|
|
|
124
124
|
/**
|
|
125
125
|
* @internal
|
|
126
126
|
*/
|
|
127
|
-
|
|
127
|
+
i(this, "_setAndNotify", (e) => {
|
|
128
128
|
if (this._disposed) return;
|
|
129
|
-
const
|
|
130
|
-
|
|
129
|
+
const t = this._value;
|
|
130
|
+
this.equals(t, e) || (this._value = e, this._onValueListeners.forEach((n) => n(e, t)));
|
|
131
131
|
});
|
|
132
132
|
/**
|
|
133
133
|
* @internal
|
|
134
134
|
*/
|
|
135
|
-
|
|
135
|
+
i(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
|
+
i(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
|
+
i(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
|
+
i(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
|
+
i(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
|
+
i(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
|
+
i(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
|
+
i(this, "at", (e) => this.map((t) => t[e]));
|
|
249
249
|
/**
|
|
250
250
|
* @internal
|
|
251
251
|
*/
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
i(this, "_$");
|
|
253
|
+
i(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 o = this.get();
|
|
258
|
+
return r = e(o) ? o : r;
|
|
259
|
+
} catch (o) {
|
|
260
|
+
throw console.error("Error in Signal.filter:", o), o;
|
|
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
|
+
i(this, "filterMap", (e, t, r = (n, o) => n === o) => {
|
|
276
276
|
let n = t;
|
|
277
|
-
const
|
|
277
|
+
const o = 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(o), o;
|
|
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
|
+
i(this, "mapAsync", (e, t, r, n = (o, l) => o === l) => {
|
|
301
|
+
const o = E(t, n);
|
|
302
302
|
let l = 0, c = new AbortController();
|
|
303
|
-
return
|
|
303
|
+
return o.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 && o.set(h);
|
|
310
310
|
} catch (h) {
|
|
311
311
|
if (u === l)
|
|
312
312
|
if (r != null)
|
|
313
|
-
|
|
313
|
+
o.set(r(h));
|
|
314
314
|
else
|
|
315
315
|
throw h;
|
|
316
316
|
}
|
|
317
317
|
})
|
|
318
|
-
),
|
|
318
|
+
), o;
|
|
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
|
+
i(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
|
+
i(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,7 +345,7 @@ 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
|
+
i(this, "deriveProp", ({
|
|
349
349
|
autoDisposeProp: e = !0,
|
|
350
350
|
equals: t
|
|
351
351
|
} = {}) => this.feedProp(E(this.get(), t), e));
|
|
@@ -353,12 +353,12 @@ const H = class H {
|
|
|
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
|
+
i(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
|
+
i(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
|
+
i(this, "setDerivative", (e) => {
|
|
372
372
|
this._derivatives.push(e), e.onDispose(() => {
|
|
373
373
|
this._derivatives.splice(
|
|
374
374
|
this._derivatives.indexOf(e),
|
|
@@ -436,21 +436,21 @@ 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
|
+
i(H, "ofPromise", (e, t, r, n = (o, l) => o === l) => {
|
|
440
|
+
const o = new H(t, n);
|
|
441
|
+
return e.then((l) => o._setAndNotify(l)).catch((l) => {
|
|
442
|
+
r != null ? o._setAndNotify(r(l)) : console.error(
|
|
443
443
|
"Unhandled promise rejection in Signal.ofPromise:",
|
|
444
444
|
l
|
|
445
445
|
);
|
|
446
|
-
}),
|
|
446
|
+
}), o;
|
|
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
|
+
i(H, "is", (e) => (
|
|
454
454
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
455
455
|
e != null && e.$__signal__ === !0
|
|
456
456
|
));
|
|
@@ -467,36 +467,36 @@ class P extends d {
|
|
|
467
467
|
/**
|
|
468
468
|
* @internal
|
|
469
469
|
*/
|
|
470
|
-
|
|
470
|
+
i(this, "$__computed__", !0);
|
|
471
471
|
/**
|
|
472
472
|
* @internal
|
|
473
473
|
*/
|
|
474
|
-
|
|
474
|
+
i(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
|
+
i(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
|
+
i(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
|
+
i(this, "_scheduleNotify", () => {
|
|
493
493
|
const t = ++this._scheduleCount;
|
|
494
494
|
Ve(() => {
|
|
495
|
-
this._scheduleCount !== t || this._disposed || this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn()
|
|
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
|
+
i(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,21 +519,21 @@ const J = class J extends d {
|
|
|
519
519
|
/**
|
|
520
520
|
* @internal
|
|
521
521
|
*/
|
|
522
|
-
|
|
522
|
+
i(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
|
-
|
|
529
|
-
this._setAndNotify(t
|
|
528
|
+
i(this, "set", (t) => {
|
|
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
|
-
|
|
536
|
-
this._setAndNotify(t(this.get())
|
|
535
|
+
i(this, "update", (t) => {
|
|
536
|
+
this._setAndNotify(t(this.get()));
|
|
537
537
|
});
|
|
538
538
|
/**
|
|
539
539
|
* Creates a reducer function that combines the provided reducer function and effects.
|
|
@@ -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
|
+
i(this, "reducer", (t, ...r) => {
|
|
545
545
|
const n = this;
|
|
546
|
-
return function
|
|
546
|
+
return function o(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: o
|
|
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
|
+
i(this, "iso", (t, r, n = (o, l) => o === l) => {
|
|
570
|
+
const o = new J(t(this.get()), n);
|
|
571
|
+
return o.onDispose(this.on((l) => o.set(t(l)))), o.on((l) => this._setAndNotify(r(l))), o;
|
|
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
|
+
i(this, "atProp", (t) => this.iso(
|
|
580
580
|
(r) => r[t],
|
|
581
581
|
(r) => ({ ...this.value, [t]: r })
|
|
582
582
|
));
|
|
@@ -588,7 +588,7 @@ const J = class J extends d {
|
|
|
588
588
|
return this.get();
|
|
589
589
|
}
|
|
590
590
|
set value(t) {
|
|
591
|
-
this._setAndNotify(t
|
|
591
|
+
this._setAndNotify(t);
|
|
592
592
|
}
|
|
593
593
|
};
|
|
594
594
|
/**
|
|
@@ -596,7 +596,7 @@ 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
|
+
i(J, "is", (t) => (
|
|
600
600
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
601
601
|
t != null && t.$__prop__ === !0
|
|
602
602
|
));
|
|
@@ -606,7 +606,7 @@ const Z = (s, e, t = (r, n) => r === n) => {
|
|
|
606
606
|
return e.forEach((n) => n.setDerivative(r)), r;
|
|
607
607
|
}, je = (s, e, t = {}) => {
|
|
608
608
|
let r = t.once ? () => {
|
|
609
|
-
|
|
609
|
+
o(), s();
|
|
610
610
|
} : s;
|
|
611
611
|
if (t.skipInitial) {
|
|
612
612
|
let l = !1;
|
|
@@ -615,11 +615,11 @@ 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), o = () => {
|
|
619
|
+
n.dispose(), t.abortSignal != null && t.abortSignal.removeEventListener("abort", o);
|
|
620
620
|
};
|
|
621
|
-
return t.abortSignal != null && t.abortSignal.addEventListener("abort",
|
|
622
|
-
}, E = (s, e = (t, r) => t === r) => new V(s, e), G = (s, e = (t, r) => t === r) => new d(s, e), le = () => typeof window < "u" ? window : void 0,
|
|
621
|
+
return t.abortSignal != null && t.abortSignal.addEventListener("abort", o), o;
|
|
622
|
+
}, E = (s, e = (t, r) => t === r) => new V(s, e), G = (s, e = (t, r) => t === r) => new d(s, e), le = () => typeof window < "u" ? window : void 0, y = {
|
|
623
623
|
/**
|
|
624
624
|
* Maps a value or a Signal to a new value.
|
|
625
625
|
* If the value is a Signal, it returns a new Signal with the mapped value.
|
|
@@ -651,7 +651,7 @@ const Z = (s, e, t = (r, n) => r === n) => {
|
|
|
651
651
|
*/
|
|
652
652
|
maybeToSignal: (s, e) => {
|
|
653
653
|
if (s != null)
|
|
654
|
-
return
|
|
654
|
+
return y.toSignal(s, e);
|
|
655
655
|
},
|
|
656
656
|
/**
|
|
657
657
|
* Gets the value from a `Signal` or the value itself if it is not a `Signal`.
|
|
@@ -693,38 +693,38 @@ const Z = (s, e, t = (r, n) => r === n) => {
|
|
|
693
693
|
}, qe = (...s) => (e, t) => {
|
|
694
694
|
const r = s.filter((n) => d.is(n));
|
|
695
695
|
return Z(
|
|
696
|
-
() => e(...s.map((n) =>
|
|
696
|
+
() => e(...s.map((n) => y.get(n))),
|
|
697
697
|
r,
|
|
698
698
|
t
|
|
699
699
|
);
|
|
700
|
-
},
|
|
700
|
+
}, Lt = (s) => {
|
|
701
701
|
const e = Object.keys(s);
|
|
702
702
|
return qe(...Object.values(s))(
|
|
703
703
|
(...t) => Object.fromEntries(e.map((r, n) => [r, t[n]]))
|
|
704
704
|
);
|
|
705
|
-
},
|
|
705
|
+
}, Dt = (...s) => (e, t = {}) => {
|
|
706
706
|
const r = s.filter((n) => d.is(n));
|
|
707
707
|
return je(
|
|
708
|
-
() => e(...s.map(
|
|
708
|
+
() => e(...s.map(y.get)),
|
|
709
709
|
r,
|
|
710
710
|
t
|
|
711
711
|
);
|
|
712
712
|
};
|
|
713
713
|
class ce {
|
|
714
714
|
constructor() {
|
|
715
|
-
|
|
715
|
+
i(this, "_store", /* @__PURE__ */ new Map());
|
|
716
716
|
/**
|
|
717
717
|
* Retrieves the value associated with the specified key from the memory store.
|
|
718
718
|
* @param key - The key to retrieve the value for.
|
|
719
719
|
* @returns The value associated with the key, or `null` if the key is not found.
|
|
720
720
|
*/
|
|
721
|
-
|
|
721
|
+
i(this, "getItem", (e) => this._store.get(e) ?? null);
|
|
722
722
|
/**
|
|
723
723
|
* Sets the value associated with the specified key in the memory store.
|
|
724
724
|
* @param key - The key to set the value for.
|
|
725
725
|
* @param value - The value to set.
|
|
726
726
|
*/
|
|
727
|
-
|
|
727
|
+
i(this, "setItem", (e, t) => {
|
|
728
728
|
this._store.set(e, t);
|
|
729
729
|
});
|
|
730
730
|
}
|
|
@@ -735,17 +735,17 @@ const ae = ({
|
|
|
735
735
|
store: t,
|
|
736
736
|
serialize: r = JSON.stringify,
|
|
737
737
|
deserialize: n = JSON.parse,
|
|
738
|
-
equals:
|
|
738
|
+
equals: o = (c, a) => c === a,
|
|
739
739
|
onLoad: l = (c) => c
|
|
740
740
|
}) => {
|
|
741
741
|
const c = t.getItem(s), a = new V(
|
|
742
742
|
c != null ? l(n(c)) : typeof e == "function" ? e() : e,
|
|
743
|
-
|
|
743
|
+
o
|
|
744
744
|
);
|
|
745
745
|
return a.on((u) => {
|
|
746
746
|
t.setItem(s, r(u));
|
|
747
747
|
}), a;
|
|
748
|
-
},
|
|
748
|
+
}, Ot = (s) => {
|
|
749
749
|
var e;
|
|
750
750
|
return ae({
|
|
751
751
|
...s,
|
|
@@ -762,8 +762,8 @@ function oe(s) {
|
|
|
762
762
|
return typeof requestAnimationFrame == "function" ? requestAnimationFrame(s) : setTimeout(s, 0);
|
|
763
763
|
}
|
|
764
764
|
const Fe = (s, e, t, r) => {
|
|
765
|
-
const n = (r == null ? void 0 : r.duration) ?? 300,
|
|
766
|
-
let c = r == null ? void 0 : r.interpolate, a = s, u = e(), h = performance.now(), g = null,
|
|
765
|
+
const n = (r == null ? void 0 : r.duration) ?? 300, o = (r == null ? void 0 : r.easing) ?? ((S) => S), l = (r == null ? void 0 : r.equals) ?? ((S, N) => S === N);
|
|
766
|
+
let c = r == null ? void 0 : r.interpolate, a = s, u = e(), h = performance.now(), g = null, b = !0;
|
|
767
767
|
const p = new P(e, l), m = E(s, l);
|
|
768
768
|
m.onDispose(() => {
|
|
769
769
|
g !== null && cancelAnimationFrame(g);
|
|
@@ -771,15 +771,15 @@ const Fe = (s, e, t, r) => {
|
|
|
771
771
|
S.setDerivative(p), S.onDispose(m.dispose);
|
|
772
772
|
});
|
|
773
773
|
const C = (S) => {
|
|
774
|
-
u = S, h = performance.now(), a = m.value,
|
|
774
|
+
u = S, h = performance.now(), a = m.value, b && (b = !1, g = oe(te));
|
|
775
775
|
}, te = () => {
|
|
776
|
-
const N = (performance.now() - h) /
|
|
776
|
+
const N = (performance.now() - h) / y.get(n), Oe = o(N);
|
|
777
777
|
c == null && (c = Re(a));
|
|
778
|
-
let se = c(a, u,
|
|
779
|
-
N >= 1 ? (
|
|
778
|
+
let se = c(a, u, Oe);
|
|
779
|
+
N >= 1 ? (b = !0, se = u) : g = oe(te), m.set(se);
|
|
780
780
|
};
|
|
781
781
|
return p.on(C), m;
|
|
782
|
-
},
|
|
782
|
+
}, Ht = (s, e) => {
|
|
783
783
|
const { initialValue: t, ...r } = e ?? {};
|
|
784
784
|
return Fe(
|
|
785
785
|
t ?? s.get(),
|
|
@@ -787,13 +787,15 @@ const Fe = (s, e, t, r) => {
|
|
|
787
787
|
[s],
|
|
788
788
|
r
|
|
789
789
|
);
|
|
790
|
-
},
|
|
791
|
-
const
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
790
|
+
}, Be = (s, e) => {
|
|
791
|
+
const t = Object.values(s).filter(d.is), r = Object.keys(s);
|
|
792
|
+
return Z(() => {
|
|
793
|
+
const n = {};
|
|
794
|
+
for (const o of r)
|
|
795
|
+
n[o] = y.get(s[o]);
|
|
796
|
+
return e(n);
|
|
797
|
+
}, t);
|
|
798
|
+
}, kt = (s) => Be(s, (e) => e), ue = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), he = /* @__PURE__ */ new Set(["selected"]), fe = /* @__PURE__ */ new Set([
|
|
797
799
|
"rowSpan",
|
|
798
800
|
"colSpan",
|
|
799
801
|
"tabIndex",
|
|
@@ -806,7 +808,7 @@ const Fe = (s, e, t, r) => {
|
|
|
806
808
|
"outerHTML",
|
|
807
809
|
"className",
|
|
808
810
|
"classList"
|
|
809
|
-
]),
|
|
811
|
+
]), We = (s, e) => he.has(s) ? (t) => {
|
|
810
812
|
t == null || t !== !0 ? e.removeAttribute(s) : e.setAttribute(s, "");
|
|
811
813
|
} : ue.has(s) ? (t) => {
|
|
812
814
|
t == null ? e[s] = null : e[s] = !!t;
|
|
@@ -818,10 +820,10 @@ const Fe = (s, e, t, r) => {
|
|
|
818
820
|
t == null ? e[s] = null : e[s] = String(t);
|
|
819
821
|
} : (t) => {
|
|
820
822
|
t == null ? e.removeAttribute(s) : e.setAttribute(s, t);
|
|
821
|
-
},
|
|
823
|
+
}, 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), j = (s) => {
|
|
822
824
|
const e = s;
|
|
823
825
|
e && e.onblur && (e.onblur = null), !(!s || s.ownerDocument === void 0) && s.parentElement && s.parentElement.removeChild(s);
|
|
824
|
-
},
|
|
826
|
+
}, Je = (s) => ge(s) ? s : s.parentElement, ge = (s) => s.nodeType === 1;
|
|
825
827
|
class me extends Error {
|
|
826
828
|
constructor(e) {
|
|
827
829
|
super(`Provider not found: ${e.description}`);
|
|
@@ -845,7 +847,7 @@ class L {
|
|
|
845
847
|
* @param namespace - The namespace URI to create the element in, or `undefined` to create a standard HTML element.
|
|
846
848
|
* @returns The newly created element.
|
|
847
849
|
*/
|
|
848
|
-
|
|
850
|
+
i(this, "createElement", (e, t) => t !== void 0 ? this.document.createElementNS(t, e) : this.document.createElement(e));
|
|
849
851
|
/**
|
|
850
852
|
* Creates a new child element and appends it to the current element, returning a new context.
|
|
851
853
|
*
|
|
@@ -868,7 +870,7 @@ class L {
|
|
|
868
870
|
* @param namespace - The namespace URI for the element, or undefined for HTML elements
|
|
869
871
|
* @returns A new DOMContext focused on the newly created child element
|
|
870
872
|
*/
|
|
871
|
-
|
|
873
|
+
i(this, "makeChildElement", (e, t) => {
|
|
872
874
|
const r = this.createElement(e, t);
|
|
873
875
|
return this.appendOrInsert(r), this.withElement(r);
|
|
874
876
|
});
|
|
@@ -877,13 +879,13 @@ class L {
|
|
|
877
879
|
* @param text - The text content for the new text node.
|
|
878
880
|
* @returns A new `Text` node with the specified text content.
|
|
879
881
|
*/
|
|
880
|
-
|
|
882
|
+
i(this, "createText", (e) => this.document.createTextNode(e));
|
|
881
883
|
/**
|
|
882
884
|
* Creates a new text node with the specified text content and appends it to the current element.
|
|
883
885
|
* @param text - The text content for the new text node.
|
|
884
886
|
* @returns A new `DOMContext` with a reference to the new text node.
|
|
885
887
|
*/
|
|
886
|
-
|
|
888
|
+
i(this, "makeChildText", (e) => {
|
|
887
889
|
const t = this.createText(e);
|
|
888
890
|
return this.appendOrInsert(t), this.withReference(t);
|
|
889
891
|
});
|
|
@@ -891,14 +893,14 @@ class L {
|
|
|
891
893
|
* Sets the text content of the current element.
|
|
892
894
|
* @param text - The text content to set.
|
|
893
895
|
*/
|
|
894
|
-
|
|
896
|
+
i(this, "setText", (e) => {
|
|
895
897
|
this.reference.nodeValue = e;
|
|
896
898
|
});
|
|
897
899
|
/**
|
|
898
900
|
* Gets the text content of the current element or text node.
|
|
899
901
|
* @returns The text content of the current element or text node.
|
|
900
902
|
*/
|
|
901
|
-
|
|
903
|
+
i(this, "getText", () => {
|
|
902
904
|
var e;
|
|
903
905
|
return ((e = this.reference) == null ? void 0 : e.nodeValue) ?? this.element.textContent ?? "";
|
|
904
906
|
});
|
|
@@ -907,7 +909,7 @@ class L {
|
|
|
907
909
|
* The text node is appended or inserted to the current `DOMContext`.
|
|
908
910
|
* The new `DOMContext` with the reference is returned.
|
|
909
911
|
*/
|
|
910
|
-
|
|
912
|
+
i(this, "makeRef", () => {
|
|
911
913
|
const e = this.createText("");
|
|
912
914
|
return this.appendOrInsert(e), this.withReference(e);
|
|
913
915
|
});
|
|
@@ -916,7 +918,7 @@ class L {
|
|
|
916
918
|
*
|
|
917
919
|
* @param child - The child node to append or insert.
|
|
918
920
|
*/
|
|
919
|
-
|
|
921
|
+
i(this, "appendOrInsert", (e) => {
|
|
920
922
|
this.reference === void 0 ? this.element.appendChild(e) : this.element.insertBefore(e, this.reference);
|
|
921
923
|
});
|
|
922
924
|
/**
|
|
@@ -924,7 +926,7 @@ class L {
|
|
|
924
926
|
* @param element - The DOM element to use in the new `DOMContext` instance.
|
|
925
927
|
* @returns A new `DOMContext` instance with the provided `element`.
|
|
926
928
|
*/
|
|
927
|
-
|
|
929
|
+
i(this, "withElement", (e) => new L(this.document, e, void 0, this.providers));
|
|
928
930
|
/**
|
|
929
931
|
* Creates a portal to render content in a different part of the DOM tree.
|
|
930
932
|
*
|
|
@@ -969,7 +971,7 @@ class L {
|
|
|
969
971
|
* @returns A new DOMContext focused on the portal target element
|
|
970
972
|
* @throws {Error} When the selector doesn't match any element in the document
|
|
971
973
|
*/
|
|
972
|
-
|
|
974
|
+
i(this, "makePortal", (e) => {
|
|
973
975
|
const t = typeof e == "string" ? this.document.querySelector(e) : e;
|
|
974
976
|
if (t == null)
|
|
975
977
|
throw new Error(`Cannot find element by selector for portal: ${e}`);
|
|
@@ -981,7 +983,7 @@ class L {
|
|
|
981
983
|
* @param reference - The optional `Text` node to use as the reference for the new `DOMContext`.
|
|
982
984
|
* @returns A new `DOMContext` instance with the specified reference.
|
|
983
985
|
*/
|
|
984
|
-
|
|
986
|
+
i(this, "withReference", (e) => new L(this.document, this.element, e, this.providers));
|
|
985
987
|
/**
|
|
986
988
|
* Sets a provider for the given provider mark.
|
|
987
989
|
*
|
|
@@ -989,7 +991,7 @@ class L {
|
|
|
989
991
|
* @param value - The provider to set for the given mark.
|
|
990
992
|
* @returns A new `DOMContext` instance with the specified provider.
|
|
991
993
|
*/
|
|
992
|
-
|
|
994
|
+
i(this, "setProvider", (e, t, r) => new L(this.document, this.element, this.reference, {
|
|
993
995
|
...this.providers,
|
|
994
996
|
[e]: [t, r]
|
|
995
997
|
}));
|
|
@@ -1000,34 +1002,34 @@ class L {
|
|
|
1000
1002
|
* @returns The provider for the given mark.
|
|
1001
1003
|
* @throws Throws `ProviderNotFoundError` if the provider for the given mark is not found.
|
|
1002
1004
|
*/
|
|
1003
|
-
|
|
1005
|
+
i(this, "getProvider", (e) => {
|
|
1004
1006
|
if (this.providers[e] === void 0)
|
|
1005
1007
|
throw new me(e);
|
|
1006
1008
|
const [t, r] = this.providers[e];
|
|
1007
1009
|
return { value: t, onUse: r };
|
|
1008
1010
|
});
|
|
1009
|
-
|
|
1011
|
+
i(this, "clear", (e) => {
|
|
1010
1012
|
e && (this.reference !== void 0 ? j(this.reference) : j(this.element));
|
|
1011
1013
|
});
|
|
1012
1014
|
/**
|
|
1013
1015
|
* Adds classes to the element.
|
|
1014
1016
|
* @param tokens - The class names to add.
|
|
1015
1017
|
*/
|
|
1016
|
-
|
|
1018
|
+
i(this, "addClasses", (e) => {
|
|
1017
1019
|
this.element.classList.add(...e);
|
|
1018
1020
|
});
|
|
1019
1021
|
/**
|
|
1020
1022
|
* Removes classes from the element.
|
|
1021
1023
|
* @param tokens - The class names to remove.
|
|
1022
1024
|
*/
|
|
1023
|
-
|
|
1025
|
+
i(this, "removeClasses", (e) => {
|
|
1024
1026
|
this.element.classList.remove(...e);
|
|
1025
1027
|
});
|
|
1026
1028
|
/**
|
|
1027
1029
|
* Gets the classes of the element.
|
|
1028
1030
|
* @returns The classes of the element.
|
|
1029
1031
|
*/
|
|
1030
|
-
|
|
1032
|
+
i(this, "getClasses", () => Array.from(this.element.classList));
|
|
1031
1033
|
/**
|
|
1032
1034
|
* Adds an event listener to the element.
|
|
1033
1035
|
* @param event - The event to listen for.
|
|
@@ -1035,10 +1037,10 @@ class L {
|
|
|
1035
1037
|
* @param options - The options for the event listener.
|
|
1036
1038
|
* @returns A function to remove the event listener.
|
|
1037
1039
|
*/
|
|
1038
|
-
|
|
1039
|
-
const n = (
|
|
1040
|
-
return this.element.addEventListener(e, n, r), (
|
|
1041
|
-
|
|
1040
|
+
i(this, "on", (e, t, r) => {
|
|
1041
|
+
const n = (o) => t(o, this);
|
|
1042
|
+
return this.element.addEventListener(e, n, r), (o) => {
|
|
1043
|
+
o && this.element.removeEventListener(e, n, r);
|
|
1042
1044
|
};
|
|
1043
1045
|
});
|
|
1044
1046
|
/**
|
|
@@ -1046,28 +1048,28 @@ class L {
|
|
|
1046
1048
|
* @returns `true` if the context is a browser DOM context.
|
|
1047
1049
|
* @deprecated Use `isBrowser()` instead.
|
|
1048
1050
|
*/
|
|
1049
|
-
|
|
1051
|
+
i(this, "isBrowserDOM", () => !0);
|
|
1050
1052
|
/**
|
|
1051
1053
|
* Returns `true` if the context is a browser context.
|
|
1052
1054
|
* @returns `true` if the context is a browser context.
|
|
1053
1055
|
*/
|
|
1054
|
-
|
|
1056
|
+
i(this, "isBrowser", () => !0);
|
|
1055
1057
|
/**
|
|
1056
1058
|
* Returns `true` if the context is a headless DOM context.
|
|
1057
1059
|
* @returns `true` if the context is a headless DOM context.
|
|
1058
1060
|
*/
|
|
1059
|
-
|
|
1061
|
+
i(this, "isHeadlessDOM", () => !1);
|
|
1060
1062
|
/**
|
|
1061
1063
|
* Returns `true` if the context is a headless context.
|
|
1062
1064
|
* @returns `true` if the context is a headless context.
|
|
1063
1065
|
*/
|
|
1064
|
-
|
|
1066
|
+
i(this, "isHeadless", () => !1);
|
|
1065
1067
|
/**
|
|
1066
1068
|
* Sets the style of the element.
|
|
1067
1069
|
* @param name - The name of the style to set.
|
|
1068
1070
|
* @param value - The value of the style to set.
|
|
1069
1071
|
*/
|
|
1070
|
-
|
|
1072
|
+
i(this, "setStyle", (e, t) => {
|
|
1071
1073
|
this.element.style[e] = t;
|
|
1072
1074
|
});
|
|
1073
1075
|
/**
|
|
@@ -1075,12 +1077,12 @@ class L {
|
|
|
1075
1077
|
* @param name - The name of the style to get.
|
|
1076
1078
|
* @returns The value of the style.
|
|
1077
1079
|
*/
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
get:
|
|
1081
|
-
set:
|
|
1080
|
+
i(this, "getStyle", (e) => this.element.style[e]);
|
|
1081
|
+
i(this, "makeAccessors", (e) => ({
|
|
1082
|
+
get: Ue(e, this.element),
|
|
1083
|
+
set: We(e, this.element)
|
|
1082
1084
|
}));
|
|
1083
|
-
|
|
1085
|
+
i(this, "getWindow", () => this.document.defaultView);
|
|
1084
1086
|
this.document = e, this.element = t, this.reference = r, this.providers = n;
|
|
1085
1087
|
}
|
|
1086
1088
|
/**
|
|
@@ -1095,21 +1097,21 @@ class L {
|
|
|
1095
1097
|
return new L(e.ownerDocument, e, t, r);
|
|
1096
1098
|
}
|
|
1097
1099
|
}
|
|
1098
|
-
const
|
|
1100
|
+
const Ge = (s) => Symbol(s), K = (s, e) => {
|
|
1099
1101
|
const t = s(e);
|
|
1100
1102
|
return (r = !0) => t(r);
|
|
1101
|
-
}, $t = (s, e, { doc: t, clear: r, disposeWithParent: n = !0, providers:
|
|
1103
|
+
}, $t = (s, e, { doc: t, clear: r, disposeWithParent: n = !0, providers: o = {} } = {}) => {
|
|
1102
1104
|
const l = typeof e == "string" ? (t ?? document).querySelector(e) : e;
|
|
1103
1105
|
if (l === null)
|
|
1104
|
-
throw new
|
|
1106
|
+
throw new Xe(
|
|
1105
1107
|
`Cannot find element by selector for render: ${e}`
|
|
1106
1108
|
);
|
|
1107
1109
|
r !== !1 && (t ?? l.ownerDocument) != null && l.nodeType === 1 && (l.innerHTML = "");
|
|
1108
|
-
const c =
|
|
1110
|
+
const c = Je(l), a = ge(l) ? void 0 : l, u = L.of(c, a, o), h = K(s, u);
|
|
1109
1111
|
let g;
|
|
1110
|
-
return n && (g = new MutationObserver((
|
|
1112
|
+
return n && (g = new MutationObserver((b) => {
|
|
1111
1113
|
var p;
|
|
1112
|
-
(p =
|
|
1114
|
+
(p = b[0]) == null || p.removedNodes.forEach((m) => {
|
|
1113
1115
|
m === l && (g == null || g.disconnect(), h(l.nodeType !== 1));
|
|
1114
1116
|
});
|
|
1115
1117
|
}), g.observe(l.parentElement, {
|
|
@@ -1119,114 +1121,114 @@ const Je = (s) => Symbol(s), K = (s, e) => {
|
|
|
1119
1121
|
})), () => {
|
|
1120
1122
|
g == null || g.disconnect(), h(!0);
|
|
1121
1123
|
};
|
|
1122
|
-
},
|
|
1124
|
+
}, Nt = (s, {
|
|
1123
1125
|
startUrl: e = "https://example.com",
|
|
1124
1126
|
selector: t,
|
|
1125
1127
|
providers: r = {}
|
|
1126
1128
|
} = {
|
|
1127
1129
|
selector: "body"
|
|
1128
1130
|
}) => {
|
|
1129
|
-
const n =
|
|
1131
|
+
const n = y.toSignal(e).deriveProp(), o = new Se(t, void 0), l = new D(o, void 0, { currentURL: n }, r);
|
|
1130
1132
|
return {
|
|
1131
1133
|
clear: K(s(), l),
|
|
1132
|
-
root:
|
|
1134
|
+
root: o,
|
|
1133
1135
|
currentURL: n
|
|
1134
1136
|
};
|
|
1135
1137
|
};
|
|
1136
|
-
class
|
|
1138
|
+
class Xe extends Error {
|
|
1137
1139
|
constructor(e) {
|
|
1138
1140
|
super(e);
|
|
1139
1141
|
}
|
|
1140
1142
|
}
|
|
1141
1143
|
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";
|
|
1142
|
-
class
|
|
1144
|
+
class It {
|
|
1143
1145
|
constructor({
|
|
1144
1146
|
select: e,
|
|
1145
1147
|
getAttribute: t,
|
|
1146
1148
|
setAttribute: r,
|
|
1147
1149
|
getClass: n,
|
|
1148
|
-
setClass:
|
|
1150
|
+
setClass: o,
|
|
1149
1151
|
getStyles: l,
|
|
1150
1152
|
setStyles: c,
|
|
1151
1153
|
appendHTML: a,
|
|
1152
1154
|
getInnerHTML: u,
|
|
1153
1155
|
setInnerHTML: h,
|
|
1154
1156
|
getInnerText: g,
|
|
1155
|
-
setInnerText:
|
|
1157
|
+
setInnerText: b
|
|
1156
1158
|
}) {
|
|
1157
1159
|
/**
|
|
1158
1160
|
* Selects elements from the headless environment.
|
|
1159
1161
|
* @param selector - The selector to select elements from. The supported selectors are CSS selectors whose complexity depends on the adapter implementation.
|
|
1160
1162
|
* @returns An array of elements.
|
|
1161
1163
|
*/
|
|
1162
|
-
|
|
1164
|
+
i(this, "select");
|
|
1163
1165
|
/**
|
|
1164
1166
|
* Gets the value of an attribute from an element.
|
|
1165
1167
|
* @param el - The element to get the attribute from.
|
|
1166
1168
|
* @param attr - The attribute to get the value from.
|
|
1167
1169
|
* @returns The value of the attribute or null if the attribute is not set.
|
|
1168
1170
|
*/
|
|
1169
|
-
|
|
1171
|
+
i(this, "getAttribute");
|
|
1170
1172
|
/**
|
|
1171
1173
|
* Sets the value of an attribute on an element.
|
|
1172
1174
|
* @param el - The element to set the attribute on.
|
|
1173
1175
|
* @param attr - The attribute to set the value of.
|
|
1174
1176
|
* @param value - The value to set the attribute to.
|
|
1175
1177
|
*/
|
|
1176
|
-
|
|
1178
|
+
i(this, "setAttribute");
|
|
1177
1179
|
/**
|
|
1178
1180
|
* Gets the class of an element.
|
|
1179
1181
|
* @param el - The element to get the class from.
|
|
1180
1182
|
* @returns The class of the element or an empty string if the class is not set.
|
|
1181
1183
|
*/
|
|
1182
|
-
|
|
1184
|
+
i(this, "getClass");
|
|
1183
1185
|
/**
|
|
1184
1186
|
* Sets the class of an element.
|
|
1185
1187
|
* @param el - The element to set the class on.
|
|
1186
1188
|
* @param cls - The class to set.
|
|
1187
1189
|
*/
|
|
1188
|
-
|
|
1190
|
+
i(this, "setClass");
|
|
1189
1191
|
/**
|
|
1190
1192
|
* Gets the styles of an element.
|
|
1191
1193
|
* @param el - The element to get the styles from.
|
|
1192
1194
|
* @returns The styles of the element.
|
|
1193
1195
|
*/
|
|
1194
|
-
|
|
1196
|
+
i(this, "getStyles");
|
|
1195
1197
|
/**
|
|
1196
1198
|
* Sets the styles of an element.
|
|
1197
1199
|
* @param el - The element to set the styles on.
|
|
1198
1200
|
*/
|
|
1199
|
-
|
|
1201
|
+
i(this, "setStyles");
|
|
1200
1202
|
/**
|
|
1201
1203
|
* Appends HTML to an element.
|
|
1202
1204
|
* @param el - The element to append the HTML to.
|
|
1203
1205
|
* @param html - The HTML to append.
|
|
1204
1206
|
*/
|
|
1205
|
-
|
|
1207
|
+
i(this, "appendHTML");
|
|
1206
1208
|
/**
|
|
1207
1209
|
* Gets the inner HTML of an element.
|
|
1208
1210
|
* @param el - The element to get the inner HTML from.
|
|
1209
1211
|
* @returns The inner HTML of the element or an empty string if the inner HTML is not set.
|
|
1210
1212
|
*/
|
|
1211
|
-
|
|
1213
|
+
i(this, "getInnerHTML");
|
|
1212
1214
|
/**
|
|
1213
1215
|
* Sets the inner HTML of an element.
|
|
1214
1216
|
* @param el - The element to set the inner HTML on.
|
|
1215
1217
|
* @param html - The inner HTML to set.
|
|
1216
1218
|
*/
|
|
1217
|
-
|
|
1219
|
+
i(this, "setInnerHTML");
|
|
1218
1220
|
/**
|
|
1219
1221
|
* Gets the inner text of an element.
|
|
1220
1222
|
* @param el - The element to get the inner text from.
|
|
1221
1223
|
* @returns The inner text of the element or an empty string if the inner text is not set.
|
|
1222
1224
|
*/
|
|
1223
|
-
|
|
1225
|
+
i(this, "getInnerText");
|
|
1224
1226
|
/**
|
|
1225
1227
|
* Sets the inner text of an element.
|
|
1226
1228
|
* @param el - The element to set the inner text on.
|
|
1227
1229
|
* @param text - The inner text to set.
|
|
1228
1230
|
*/
|
|
1229
|
-
|
|
1231
|
+
i(this, "setInnerText");
|
|
1230
1232
|
/**
|
|
1231
1233
|
* Sets the content of the root element from a HeadlessPortal. Generally this will be the same instance that is
|
|
1232
1234
|
* returned by `runHeadless`.
|
|
@@ -1235,10 +1237,10 @@ class Nt {
|
|
|
1235
1237
|
* @param setPlaceholders - Whether to set placeholders for the content. This allows you to restore the original content
|
|
1236
1238
|
* when you render on the server and then hydrate on the client.
|
|
1237
1239
|
*/
|
|
1238
|
-
|
|
1240
|
+
i(this, "setFromRoot", (e, t) => {
|
|
1239
1241
|
e.getPortals().forEach((n) => {
|
|
1240
|
-
const
|
|
1241
|
-
for (const l of
|
|
1242
|
+
const o = typeof n.selector == "string" ? this.select(n.selector) : [n.selector];
|
|
1243
|
+
for (const l of o) {
|
|
1242
1244
|
if (l == null)
|
|
1243
1245
|
throw new Error(
|
|
1244
1246
|
`Cannot find element by selector for render: ${n.selector}`
|
|
@@ -1295,83 +1297,83 @@ class Nt {
|
|
|
1295
1297
|
}
|
|
1296
1298
|
});
|
|
1297
1299
|
});
|
|
1298
|
-
this.select = e, this.getAttribute = t, this.setAttribute = r, this.getClass = n, this.setClass =
|
|
1300
|
+
this.select = e, this.getAttribute = t, this.setAttribute = r, this.getClass = n, this.setClass = o, this.getStyles = l, this.setStyles = c, this.appendHTML = a, this.getInnerHTML = u, this.setInnerHTML = h, this.getInnerText = g, this.setInnerText = b;
|
|
1299
1301
|
}
|
|
1300
1302
|
}
|
|
1301
|
-
const
|
|
1303
|
+
const Ye = () => {
|
|
1302
1304
|
document.querySelectorAll(`[${ye}]`).forEach(j);
|
|
1303
|
-
},
|
|
1305
|
+
}, ze = (s) => {
|
|
1304
1306
|
const e = s.getAttribute(q);
|
|
1305
1307
|
s.removeAttribute(q), e != null && s.setAttribute("class", e);
|
|
1306
|
-
},
|
|
1307
|
-
document.querySelectorAll(`[${q}]`).forEach((e) =>
|
|
1308
|
-
},
|
|
1308
|
+
}, Qe = () => {
|
|
1309
|
+
document.querySelectorAll(`[${q}]`).forEach((e) => ze(e));
|
|
1310
|
+
}, Ze = (s) => {
|
|
1309
1311
|
const e = s.getAttribute(B);
|
|
1310
1312
|
s.removeAttribute(B), e != null && (s.innerHTML = e);
|
|
1311
|
-
},
|
|
1312
|
-
document.querySelectorAll(`[${B}]`).forEach((e) =>
|
|
1313
|
-
},
|
|
1313
|
+
}, Ke = () => {
|
|
1314
|
+
document.querySelectorAll(`[${B}]`).forEach((e) => Ze(e));
|
|
1315
|
+
}, et = (s) => {
|
|
1314
1316
|
const e = s.getAttribute(W);
|
|
1315
1317
|
s.removeAttribute(W), e != null && (s.innerText = e);
|
|
1316
|
-
},
|
|
1317
|
-
document.querySelectorAll(`[${W}]`).forEach((e) =>
|
|
1318
|
-
},
|
|
1318
|
+
}, tt = () => {
|
|
1319
|
+
document.querySelectorAll(`[${W}]`).forEach((e) => et(e));
|
|
1320
|
+
}, be = (s) => JSON.parse(s.replace(/"/g, '"')), st = (s) => {
|
|
1319
1321
|
const e = s.getAttribute(F);
|
|
1320
1322
|
if (s.removeAttribute(F), e != null) {
|
|
1321
|
-
const t =
|
|
1323
|
+
const t = be(e);
|
|
1322
1324
|
Object.entries(t).forEach(([r, n]) => {
|
|
1323
1325
|
s.style.setProperty(r, n);
|
|
1324
1326
|
});
|
|
1325
1327
|
}
|
|
1326
|
-
},
|
|
1327
|
-
document.querySelectorAll(`[${F}]`).forEach((e) =>
|
|
1328
|
-
},
|
|
1328
|
+
}, rt = () => {
|
|
1329
|
+
document.querySelectorAll(`[${F}]`).forEach((e) => st(e));
|
|
1330
|
+
}, nt = (s) => {
|
|
1329
1331
|
const e = s.getAttribute(U);
|
|
1330
1332
|
if (s.removeAttribute(U), e != null) {
|
|
1331
|
-
const t =
|
|
1333
|
+
const t = be(e);
|
|
1332
1334
|
Object.entries(t).forEach(([r, n]) => {
|
|
1333
1335
|
n == null ? s.removeAttribute(r) : s.setAttribute(r, n);
|
|
1334
1336
|
});
|
|
1335
1337
|
}
|
|
1336
|
-
},
|
|
1337
|
-
document.querySelectorAll(`[${U}]`).forEach((e) =>
|
|
1338
|
-
},
|
|
1339
|
-
|
|
1340
|
-
}, A = Symbol("class"), _ = Symbol("style"), x = Symbol("handler"),
|
|
1338
|
+
}, it = () => {
|
|
1339
|
+
document.querySelectorAll(`[${U}]`).forEach((e) => nt(e));
|
|
1340
|
+
}, Rt = () => {
|
|
1341
|
+
Ye(), Qe(), tt(), Ke(), rt(), it();
|
|
1342
|
+
}, A = Symbol("class"), _ = Symbol("style"), x = Symbol("handler"), Te = () => Math.random().toString(36).substring(2, 15), ot = (s) => s.replace(/<[^>]*>?/g, "");
|
|
1341
1343
|
class Ae {
|
|
1342
1344
|
constructor(e) {
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1345
|
+
i(this, "id", Te());
|
|
1346
|
+
i(this, "properties", {});
|
|
1347
|
+
i(this, "children", []);
|
|
1348
|
+
i(this, "isElement", () => !0);
|
|
1349
|
+
i(this, "isText", () => !1);
|
|
1350
|
+
i(this, "getText", () => this.properties.innerText != null ? this.properties.innerText : this.properties.innerHTML != null ? ot(this.properties.innerHTML) : this.children.map((e) => e.getText()).join(""));
|
|
1351
|
+
i(this, "removeChild", (e) => {
|
|
1350
1352
|
const t = this.children.indexOf(e);
|
|
1351
1353
|
t !== -1 && this.children.splice(t, 1);
|
|
1352
1354
|
});
|
|
1353
|
-
|
|
1355
|
+
i(this, "remove", () => {
|
|
1354
1356
|
if (this.parent != null)
|
|
1355
1357
|
this.parent.removeChild(this);
|
|
1356
1358
|
else
|
|
1357
1359
|
throw new Error("Parent is undefined");
|
|
1358
1360
|
});
|
|
1359
|
-
|
|
1361
|
+
i(this, "getPortals", () => {
|
|
1360
1362
|
const e = this.elements().flatMap((t) => t.isPortal() ? [t, ...t.getPortals()] : t.getPortals());
|
|
1361
1363
|
return this.isPortal() && e.unshift(this), e;
|
|
1362
1364
|
});
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1365
|
+
i(this, "elements", () => this.children.filter((e) => e.isElement()));
|
|
1366
|
+
i(this, "hasInnerHTML", () => this.properties.innerHTML != null);
|
|
1367
|
+
i(this, "getInnerHTML", () => this.properties.innerHTML ?? "");
|
|
1368
|
+
i(this, "getInnerText", () => this.properties.innerText ?? "");
|
|
1369
|
+
i(this, "hasInnerText", () => this.properties.innerText != null);
|
|
1370
|
+
i(this, "hasChildren", () => this.children.length > 0);
|
|
1371
|
+
i(this, "hasClasses", () => this.properties[A] != null);
|
|
1372
|
+
i(this, "hasStyles", () => this.properties[_] != null);
|
|
1373
|
+
i(this, "hasAttributes", () => Object.keys(this.properties).length > 0);
|
|
1374
|
+
i(this, "hasHandlers", () => this.properties[x] != null);
|
|
1375
|
+
i(this, "hasRenderableProperties", () => this.hasClasses() || this.hasAttributes() || this.hasStyles());
|
|
1376
|
+
i(this, "getById", (e) => {
|
|
1375
1377
|
if (this.properties.id === e)
|
|
1376
1378
|
return this;
|
|
1377
1379
|
for (const t of this.elements()) {
|
|
@@ -1380,25 +1382,25 @@ class Ae {
|
|
|
1380
1382
|
return r;
|
|
1381
1383
|
}
|
|
1382
1384
|
});
|
|
1383
|
-
|
|
1385
|
+
i(this, "trigger", (e, t) => {
|
|
1384
1386
|
((this.properties[x] ?? {})[e] ?? []).forEach((n) => n(t));
|
|
1385
1387
|
});
|
|
1386
|
-
|
|
1388
|
+
i(this, "click", () => {
|
|
1387
1389
|
this.trigger("click", {});
|
|
1388
1390
|
});
|
|
1389
|
-
|
|
1391
|
+
i(this, "on", (e, t, r, n) => {
|
|
1390
1392
|
var a;
|
|
1391
|
-
const
|
|
1393
|
+
const o = (a = this.properties)[x] ?? (a[x] = {}), l = n != null && n.once ? (u) => {
|
|
1392
1394
|
c(), t(u, r);
|
|
1393
1395
|
} : (u) => t(u, r);
|
|
1394
|
-
|
|
1396
|
+
o[e] = [...o[e] ?? [], l];
|
|
1395
1397
|
const c = () => {
|
|
1396
|
-
const u =
|
|
1397
|
-
h !== -1 && (u.splice(h, 1), u.length === 0 ? (delete
|
|
1398
|
+
const u = o[e] ?? [], h = u.indexOf(l);
|
|
1399
|
+
h !== -1 && (u.splice(h, 1), u.length === 0 ? (delete o[e], Object.keys(o).length === 0 && delete this.properties[x]) : o[e] = u, (n == null ? void 0 : n.signal) != null && n.signal.removeEventListener("abort", c));
|
|
1398
1400
|
};
|
|
1399
1401
|
return (n == null ? void 0 : n.signal) != null && n.signal.addEventListener("abort", c), c;
|
|
1400
1402
|
});
|
|
1401
|
-
|
|
1403
|
+
i(this, "addClasses", (e) => {
|
|
1402
1404
|
var r;
|
|
1403
1405
|
if (e.length === 0)
|
|
1404
1406
|
return;
|
|
@@ -1407,34 +1409,34 @@ class Ae {
|
|
|
1407
1409
|
t.includes(n) || t.push(n);
|
|
1408
1410
|
});
|
|
1409
1411
|
});
|
|
1410
|
-
|
|
1412
|
+
i(this, "removeClasses", (e) => {
|
|
1411
1413
|
var r;
|
|
1412
1414
|
if (e.length === 0)
|
|
1413
1415
|
return;
|
|
1414
1416
|
const t = (r = this.properties)[A] ?? (r[A] = []);
|
|
1415
1417
|
e.forEach((n) => {
|
|
1416
|
-
const
|
|
1417
|
-
|
|
1418
|
+
const o = t.indexOf(n);
|
|
1419
|
+
o !== -1 && t.splice(o, 1);
|
|
1418
1420
|
}), t.length === 0 && delete this.properties[A];
|
|
1419
1421
|
});
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
+
i(this, "getClasses", () => this.properties[A] ?? []);
|
|
1423
|
+
i(this, "getAttributes", () => Object.entries(this.properties).filter(
|
|
1422
1424
|
([e]) => !["innerText", "innerHTML"].includes(e)
|
|
1423
1425
|
));
|
|
1424
|
-
|
|
1426
|
+
i(this, "getVisibleAttributes", () => Reflect.ownKeys(this.properties).flatMap(
|
|
1425
1427
|
(e) => e === A ? [["class", this.getClasses()]] : e === _ ? [["style", this.getStyles()]] : typeof e == "string" ? [[e, String(this.properties[e])]] : []
|
|
1426
1428
|
));
|
|
1427
|
-
|
|
1429
|
+
i(this, "setStyle", (e, t) => {
|
|
1428
1430
|
var n;
|
|
1429
1431
|
const r = (n = this.properties)[_] ?? (n[_] = {});
|
|
1430
1432
|
r[e] = t, t === "" && (delete r[e], Object.keys(r).length === 0 && delete this.properties[_]);
|
|
1431
1433
|
});
|
|
1432
|
-
|
|
1434
|
+
i(this, "getStyle", (e) => {
|
|
1433
1435
|
var t;
|
|
1434
1436
|
return ((t = this.properties[_]) == null ? void 0 : t[e]) ?? "";
|
|
1435
1437
|
});
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
+
i(this, "getStyles", () => this.properties[_] ?? {});
|
|
1439
|
+
i(this, "makeAccessors", (e) => {
|
|
1438
1440
|
const t = this.properties;
|
|
1439
1441
|
return {
|
|
1440
1442
|
get: () => t[e],
|
|
@@ -1444,16 +1446,16 @@ class Ae {
|
|
|
1444
1446
|
this.parent = e;
|
|
1445
1447
|
}
|
|
1446
1448
|
}
|
|
1447
|
-
const
|
|
1448
|
-
class
|
|
1449
|
+
const lt = (s) => s.replace(/"/g, """), ct = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1450
|
+
class at extends Ae {
|
|
1449
1451
|
constructor(t, r, n) {
|
|
1450
1452
|
super(n);
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
+
i(this, "isPortal", () => !1);
|
|
1454
|
+
i(this, "toHTML", (t = !1) => {
|
|
1453
1455
|
const r = this.children.map((a) => a.toHTML()).join(""), n = this.namespace ? ` xmlns="${this.namespace}"` : "";
|
|
1454
|
-
let
|
|
1455
|
-
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(" ")}"` :
|
|
1456
|
-
return
|
|
1456
|
+
let o = null;
|
|
1457
|
+
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" ? (o = u, "") : a === "innerText" ? (o = ct(u), "") : ` ${a}="${lt(u)}"`).join(""), c = t ? ` ${ye}` : "";
|
|
1458
|
+
return ft.has(this.tagName) && r === "" ? `<${this.tagName}${n}${l}${c} />` : `<${this.tagName}${n}${l}${c}>${o ?? r}</${this.tagName}>`;
|
|
1457
1459
|
});
|
|
1458
1460
|
this.tagName = t, this.namespace = r;
|
|
1459
1461
|
}
|
|
@@ -1461,33 +1463,33 @@ class ct extends Ae {
|
|
|
1461
1463
|
class Se extends Ae {
|
|
1462
1464
|
constructor(t, r) {
|
|
1463
1465
|
super(r);
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1466
|
+
i(this, "isPortal", () => !0);
|
|
1467
|
+
i(this, "toHTML", () => "");
|
|
1468
|
+
i(this, "contentToHTML", (t = !1) => this.children.map((r) => r.toHTML(t)).join(""));
|
|
1467
1469
|
this.selector = t;
|
|
1468
1470
|
}
|
|
1469
1471
|
}
|
|
1470
|
-
class
|
|
1472
|
+
class ut {
|
|
1471
1473
|
constructor(e) {
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1474
|
+
i(this, "id", Te());
|
|
1475
|
+
i(this, "isElement", () => !1);
|
|
1476
|
+
i(this, "isText", () => !0);
|
|
1477
|
+
i(this, "getText", () => this.text);
|
|
1478
|
+
i(this, "toHTML", () => this.text);
|
|
1477
1479
|
this.text = e;
|
|
1478
1480
|
}
|
|
1479
1481
|
}
|
|
1480
1482
|
class D {
|
|
1481
1483
|
constructor(e, t, r, n) {
|
|
1482
|
-
|
|
1484
|
+
i(this, "appendOrInsert", (e) => {
|
|
1483
1485
|
if (this.reference != null) {
|
|
1484
1486
|
const t = this.element.children.indexOf(this.reference);
|
|
1485
1487
|
this.element.children.splice(t, 0, e);
|
|
1486
1488
|
} else
|
|
1487
1489
|
this.element.children.push(e);
|
|
1488
1490
|
});
|
|
1489
|
-
|
|
1490
|
-
const r = new
|
|
1491
|
+
i(this, "makeChildElement", (e, t) => {
|
|
1492
|
+
const r = new at(e, t, this.element);
|
|
1491
1493
|
return this.appendOrInsert(r), new D(
|
|
1492
1494
|
r,
|
|
1493
1495
|
void 0,
|
|
@@ -1495,8 +1497,8 @@ class D {
|
|
|
1495
1497
|
this.providers
|
|
1496
1498
|
);
|
|
1497
1499
|
});
|
|
1498
|
-
|
|
1499
|
-
const t = new
|
|
1500
|
+
i(this, "makeChildText", (e) => {
|
|
1501
|
+
const t = new ut(e);
|
|
1500
1502
|
return this.appendOrInsert(t), new D(
|
|
1501
1503
|
this.element,
|
|
1502
1504
|
t,
|
|
@@ -1504,15 +1506,15 @@ class D {
|
|
|
1504
1506
|
this.providers
|
|
1505
1507
|
);
|
|
1506
1508
|
});
|
|
1507
|
-
|
|
1509
|
+
i(this, "setText", (e) => {
|
|
1508
1510
|
this.reference && this.reference.isText() && (this.reference.text = e);
|
|
1509
1511
|
});
|
|
1510
|
-
|
|
1512
|
+
i(this, "getText", () => {
|
|
1511
1513
|
var e;
|
|
1512
1514
|
return ((e = this.reference) == null ? void 0 : e.getText()) ?? this.element.getText();
|
|
1513
1515
|
});
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
+
i(this, "makeRef", () => this.makeChildText(""));
|
|
1517
|
+
i(this, "makePortal", (e) => {
|
|
1516
1518
|
const t = new Se(e, this.element);
|
|
1517
1519
|
return this.appendOrInsert(t), new D(
|
|
1518
1520
|
t,
|
|
@@ -1528,72 +1530,72 @@ class D {
|
|
|
1528
1530
|
* @param value - The provider to set for the given mark.
|
|
1529
1531
|
* @returns A new `DOMContext` instance with the specified provider.
|
|
1530
1532
|
*/
|
|
1531
|
-
|
|
1533
|
+
i(this, "setProvider", (e, t, r) => new D(this.element, this.reference, this.container, {
|
|
1532
1534
|
...this.providers,
|
|
1533
1535
|
[e]: [t, r]
|
|
1534
1536
|
}));
|
|
1535
|
-
|
|
1537
|
+
i(this, "getProvider", (e) => {
|
|
1536
1538
|
if (this.providers[e] === void 0)
|
|
1537
1539
|
throw new me(e);
|
|
1538
1540
|
const [t, r] = this.providers[e];
|
|
1539
1541
|
return { value: t, onUse: r };
|
|
1540
1542
|
});
|
|
1541
|
-
|
|
1543
|
+
i(this, "clear", (e) => {
|
|
1542
1544
|
e && (this.reference !== void 0 ? this.element.removeChild(this.reference) : this.element.remove());
|
|
1543
1545
|
});
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1546
|
+
i(this, "on", (e, t) => this.element.on(e, t, this));
|
|
1547
|
+
i(this, "addClasses", (e) => this.element.addClasses(e));
|
|
1548
|
+
i(this, "removeClasses", (e) => this.element.removeClasses(e));
|
|
1549
|
+
i(this, "getClasses", () => this.element.getClasses());
|
|
1550
|
+
i(this, "isBrowserDOM", () => !1);
|
|
1551
|
+
i(this, "isBrowser", () => !1);
|
|
1552
|
+
i(this, "isHeadlessDOM", () => !0);
|
|
1553
|
+
i(this, "isHeadless", () => !0);
|
|
1554
|
+
i(this, "setStyle", (e, t) => this.element.setStyle(e, t));
|
|
1555
|
+
i(this, "getStyle", (e) => this.element.getStyle(e));
|
|
1556
|
+
i(this, "makeAccessors", (e) => this.element.makeAccessors(e));
|
|
1555
1557
|
this.element = e, this.reference = t, this.container = r, this.providers = n;
|
|
1556
1558
|
}
|
|
1557
1559
|
}
|
|
1558
|
-
const
|
|
1560
|
+
const ht = /* @__PURE__ */ new Set([
|
|
1559
1561
|
"checked",
|
|
1560
1562
|
"disabled",
|
|
1561
1563
|
"multiple",
|
|
1562
1564
|
"readonly",
|
|
1563
1565
|
"required",
|
|
1564
1566
|
"selected"
|
|
1565
|
-
]),
|
|
1567
|
+
]), ft = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), ve = (s) => (e) => e.makeChildText(s).clear, _e = (s) => (e) => {
|
|
1566
1568
|
const t = e.makeChildText(s.value), r = s.on(t.setText);
|
|
1567
1569
|
return (n) => {
|
|
1568
1570
|
r(), t.clear(n);
|
|
1569
1571
|
};
|
|
1570
|
-
},
|
|
1572
|
+
}, Vt = (s) => d.is(s) ? _e(s) : ve(s), T = (...s) => (e) => {
|
|
1571
1573
|
const t = s.map((r) => f(r)(e));
|
|
1572
1574
|
return (r) => {
|
|
1573
1575
|
t.forEach((n) => n(r));
|
|
1574
1576
|
};
|
|
1575
1577
|
}, v = () => () => {
|
|
1576
|
-
},
|
|
1578
|
+
}, dt = (s) => (e) => (e.addClasses(s), (t) => {
|
|
1577
1579
|
t && e.removeClasses(s);
|
|
1578
|
-
}),
|
|
1580
|
+
}), pt = (s) => (e) => {
|
|
1579
1581
|
let t = [];
|
|
1580
1582
|
const r = s.on((n) => {
|
|
1581
|
-
e.removeClasses(t), t = (n ?? "").split(" ").filter((
|
|
1583
|
+
e.removeClasses(t), t = (n ?? "").split(" ").filter((o) => o.length > 0), e.addClasses(t);
|
|
1582
1584
|
});
|
|
1583
1585
|
return (n) => {
|
|
1584
1586
|
r(), n && e.removeClasses(t), t.length = 0;
|
|
1585
1587
|
};
|
|
1586
|
-
},
|
|
1587
|
-
const { get: r, set: n } = t.makeAccessors(s),
|
|
1588
|
+
}, k = (s, e) => (t) => {
|
|
1589
|
+
const { get: r, set: n } = t.makeAccessors(s), o = r();
|
|
1588
1590
|
return n(e), (l) => {
|
|
1589
|
-
l && n(
|
|
1591
|
+
l && n(o);
|
|
1590
1592
|
};
|
|
1591
|
-
},
|
|
1592
|
-
const { get: r, set: n } = t.makeAccessors(s),
|
|
1593
|
+
}, $ = (s, e) => (t) => {
|
|
1594
|
+
const { get: r, set: n } = t.makeAccessors(s), o = r(), l = e.on(n);
|
|
1593
1595
|
return (c) => {
|
|
1594
|
-
l(), c && n(
|
|
1596
|
+
l(), c && n(o);
|
|
1595
1597
|
};
|
|
1596
|
-
},
|
|
1598
|
+
}, O = new Proxy(
|
|
1597
1599
|
{},
|
|
1598
1600
|
{
|
|
1599
1601
|
/**
|
|
@@ -1607,17 +1609,17 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1607
1609
|
* @returns The renderable component for the specified attribute.
|
|
1608
1610
|
*
|
|
1609
1611
|
*/
|
|
1610
|
-
get: (s, e) => e === "class" ? (t) => d.is(t) ?
|
|
1612
|
+
get: (s, e) => e === "class" ? (t) => d.is(t) ? pt(t) : dt(
|
|
1611
1613
|
(t ?? "").split(" ").filter((r) => r.length > 0)
|
|
1612
|
-
) : (t) => d.is(t) ?
|
|
1614
|
+
) : (t) => d.is(t) ? $(
|
|
1613
1615
|
e,
|
|
1614
1616
|
t
|
|
1615
|
-
) :
|
|
1617
|
+
) : k(
|
|
1616
1618
|
e,
|
|
1617
1619
|
t
|
|
1618
1620
|
)
|
|
1619
1621
|
}
|
|
1620
|
-
),
|
|
1622
|
+
), jt = new Proxy(
|
|
1621
1623
|
{},
|
|
1622
1624
|
{
|
|
1623
1625
|
/**
|
|
@@ -1628,12 +1630,12 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1628
1630
|
* @returns The renderable component for the specified attribute.
|
|
1629
1631
|
*
|
|
1630
1632
|
*/
|
|
1631
|
-
get: (s, e) => (t) => d.is(t) ?
|
|
1633
|
+
get: (s, e) => (t) => d.is(t) ? $(
|
|
1632
1634
|
`data-${e}`,
|
|
1633
1635
|
t
|
|
1634
|
-
) :
|
|
1636
|
+
) : k(`data-${e}`, t)
|
|
1635
1637
|
}
|
|
1636
|
-
),
|
|
1638
|
+
), qt = new Proxy(
|
|
1637
1639
|
{},
|
|
1638
1640
|
{
|
|
1639
1641
|
/**
|
|
@@ -1644,15 +1646,15 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1644
1646
|
* @returns The renderable component for the specified attribute.
|
|
1645
1647
|
*
|
|
1646
1648
|
*/
|
|
1647
|
-
get: (s, e) => (t) => d.is(t) ?
|
|
1649
|
+
get: (s, e) => (t) => d.is(t) ? $(
|
|
1648
1650
|
`aria-${e}`,
|
|
1649
1651
|
t
|
|
1650
|
-
) :
|
|
1652
|
+
) : k(
|
|
1651
1653
|
`aria-${e}`,
|
|
1652
1654
|
t
|
|
1653
1655
|
)
|
|
1654
1656
|
}
|
|
1655
|
-
),
|
|
1657
|
+
), Ft = new Proxy(
|
|
1656
1658
|
{},
|
|
1657
1659
|
{
|
|
1658
1660
|
/**
|
|
@@ -1663,15 +1665,15 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1663
1665
|
* @returns The renderable component for the specified attribute.
|
|
1664
1666
|
*
|
|
1665
1667
|
*/
|
|
1666
|
-
get: (s, e) => (t) => d.is(t) ?
|
|
1668
|
+
get: (s, e) => (t) => d.is(t) ? $(
|
|
1667
1669
|
e,
|
|
1668
1670
|
t
|
|
1669
|
-
) :
|
|
1671
|
+
) : k(
|
|
1670
1672
|
e,
|
|
1671
1673
|
t
|
|
1672
1674
|
)
|
|
1673
1675
|
}
|
|
1674
|
-
),
|
|
1676
|
+
), Bt = new Proxy(
|
|
1675
1677
|
{},
|
|
1676
1678
|
{
|
|
1677
1679
|
/**
|
|
@@ -1681,10 +1683,10 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1681
1683
|
* @returns The renderable component for the specified attribute.
|
|
1682
1684
|
*
|
|
1683
1685
|
*/
|
|
1684
|
-
get: (s, e) => (t) => d.is(t) ?
|
|
1686
|
+
get: (s, e) => (t) => d.is(t) ? $(
|
|
1685
1687
|
e,
|
|
1686
1688
|
t
|
|
1687
|
-
) :
|
|
1689
|
+
) : k(
|
|
1688
1690
|
e,
|
|
1689
1691
|
t
|
|
1690
1692
|
)
|
|
@@ -1693,7 +1695,7 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1693
1695
|
if (s == null)
|
|
1694
1696
|
return v;
|
|
1695
1697
|
if (Array.isArray(s))
|
|
1696
|
-
return
|
|
1698
|
+
return T(...s.map(f));
|
|
1697
1699
|
if (typeof s == "string")
|
|
1698
1700
|
return ve(s);
|
|
1699
1701
|
if (d.is(s))
|
|
@@ -1702,16 +1704,16 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1702
1704
|
return s;
|
|
1703
1705
|
throw new Error(`Unknown type: '${typeof s}' for child: ${s}`);
|
|
1704
1706
|
}, we = (s, ...e) => (t) => {
|
|
1705
|
-
const r = t.makeChildElement(s, void 0), n = e.map((
|
|
1706
|
-
return (
|
|
1707
|
-
n.forEach((l) => l(!1)), r.clear(
|
|
1707
|
+
const r = t.makeChildElement(s, void 0), n = e.map((o) => f(o)(r));
|
|
1708
|
+
return (o) => {
|
|
1709
|
+
n.forEach((l) => l(!1)), r.clear(o);
|
|
1708
1710
|
};
|
|
1709
1711
|
}, Ee = (s, e, ...t) => (r) => {
|
|
1710
|
-
const n = r.makeChildElement(s, e),
|
|
1712
|
+
const n = r.makeChildElement(s, e), o = t.map((l) => f(l)(n));
|
|
1711
1713
|
return (l) => {
|
|
1712
|
-
|
|
1714
|
+
o.forEach((c) => c(!1)), n.clear(l);
|
|
1713
1715
|
};
|
|
1714
|
-
},
|
|
1716
|
+
}, Wt = new Proxy(
|
|
1715
1717
|
{},
|
|
1716
1718
|
{
|
|
1717
1719
|
/**
|
|
@@ -1721,7 +1723,7 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1721
1723
|
*/
|
|
1722
1724
|
get: (s, e) => (...t) => we(e, t.flatMap(f))
|
|
1723
1725
|
}
|
|
1724
|
-
),
|
|
1726
|
+
), Ut = new Proxy(
|
|
1725
1727
|
{},
|
|
1726
1728
|
{
|
|
1727
1729
|
/**
|
|
@@ -1729,9 +1731,9 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1729
1731
|
* @param type - The input type name.
|
|
1730
1732
|
* @returns A renderable function that creates and appends the HTMLInput element to the DOM.
|
|
1731
1733
|
*/
|
|
1732
|
-
get: (s, e) => (...t) => we("input",
|
|
1734
|
+
get: (s, e) => (...t) => we("input", O.type(e), ...t)
|
|
1733
1735
|
}
|
|
1734
|
-
),
|
|
1736
|
+
), gt = "http://www.w3.org/2000/svg", Jt = new Proxy(
|
|
1735
1737
|
{},
|
|
1736
1738
|
{
|
|
1737
1739
|
/**
|
|
@@ -1739,9 +1741,9 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1739
1741
|
* @param tagName - The SVG tag name.
|
|
1740
1742
|
* @returns A renderable function that creates and appends the SVG element to the DOM.
|
|
1741
1743
|
*/
|
|
1742
|
-
get: (s, e) => (...t) => Ee(e,
|
|
1744
|
+
get: (s, e) => (...t) => Ee(e, gt, t.flatMap(f))
|
|
1743
1745
|
}
|
|
1744
|
-
),
|
|
1746
|
+
), mt = "http://www.w3.org/1998/Math/MathML", Gt = new Proxy(
|
|
1745
1747
|
{},
|
|
1746
1748
|
{
|
|
1747
1749
|
/**
|
|
@@ -1749,15 +1751,15 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1749
1751
|
* @param tagName - The Math tag name.
|
|
1750
1752
|
* @returns A renderable function that creates and appends the Math element to the DOM.
|
|
1751
1753
|
*/
|
|
1752
|
-
get: (s, e) => (...t) => Ee(e,
|
|
1754
|
+
get: (s, e) => (...t) => Ee(e, mt, t.flatMap(f))
|
|
1753
1755
|
}
|
|
1754
1756
|
), Ce = (s, e) => {
|
|
1755
1757
|
if (typeof e == "function")
|
|
1756
1758
|
return Ce(s, { then: e });
|
|
1757
|
-
const t = e.pending != null ? f(e.pending()) : v, r = e.then, n = e.error != null ? (
|
|
1758
|
-
return (
|
|
1759
|
+
const t = e.pending != null ? f(e.pending()) : v, r = e.then, n = e.error != null ? (o) => f(e.error(o)) : () => v;
|
|
1760
|
+
return (o) => {
|
|
1759
1761
|
let l = !0;
|
|
1760
|
-
const c = s(), a =
|
|
1762
|
+
const c = s(), a = o.makeRef();
|
|
1761
1763
|
let u = f(t)(a);
|
|
1762
1764
|
return c.then(
|
|
1763
1765
|
(h) => {
|
|
@@ -1770,7 +1772,7 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1770
1772
|
l = !1, u(h), a.clear(h);
|
|
1771
1773
|
};
|
|
1772
1774
|
};
|
|
1773
|
-
},
|
|
1775
|
+
}, Xt = (s, e) => Ce(() => s, e), xe = (s, e, t) => (r) => r.on(s, e, t), yt = (s) => xe("click", (e, t) => {
|
|
1774
1776
|
e.preventDefault();
|
|
1775
1777
|
const r = e.target;
|
|
1776
1778
|
setTimeout(() => {
|
|
@@ -1787,13 +1789,13 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1787
1789
|
*/
|
|
1788
1790
|
get: (s, e) => (t) => xe(e, t)
|
|
1789
1791
|
}
|
|
1790
|
-
),
|
|
1792
|
+
), bt = (s) => (e) => {
|
|
1791
1793
|
const t = e.target;
|
|
1792
1794
|
s(t.value);
|
|
1793
1795
|
}, Tt = (s) => (e) => {
|
|
1794
1796
|
const t = e.target;
|
|
1795
1797
|
s(t.valueAsNumber);
|
|
1796
|
-
},
|
|
1798
|
+
}, At = (s) => (e) => {
|
|
1797
1799
|
const t = e.target;
|
|
1798
1800
|
if (t.value === "")
|
|
1799
1801
|
return;
|
|
@@ -1803,7 +1805,7 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1803
1805
|
Number(r[2].substring(0, 2))
|
|
1804
1806
|
);
|
|
1805
1807
|
s(n);
|
|
1806
|
-
},
|
|
1808
|
+
}, Yt = (s) => (e) => {
|
|
1807
1809
|
const t = e.target;
|
|
1808
1810
|
if (t.value === "") {
|
|
1809
1811
|
s(null);
|
|
@@ -1815,17 +1817,17 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1815
1817
|
Number(r[2].substring(0, 2))
|
|
1816
1818
|
);
|
|
1817
1819
|
s(n);
|
|
1818
|
-
},
|
|
1820
|
+
}, St = (s) => (e) => {
|
|
1819
1821
|
const t = e.target;
|
|
1820
1822
|
if (t.value === "")
|
|
1821
1823
|
return;
|
|
1822
|
-
const r = t.value.split("T"), n = r[0].split("-"),
|
|
1824
|
+
const r = t.value.split("T"), n = r[0].split("-"), o = new Date(
|
|
1823
1825
|
Number(n[0]),
|
|
1824
1826
|
Number(n[1]) - 1,
|
|
1825
1827
|
Number(n[2])
|
|
1826
1828
|
), l = r[1].split(":");
|
|
1827
|
-
|
|
1828
|
-
},
|
|
1829
|
+
o.setHours(Number(l[0])), o.setMinutes(Number(l[1])), o.setSeconds(Number(l[2])), s(o);
|
|
1830
|
+
}, zt = (s) => (e) => {
|
|
1829
1831
|
const t = e.target;
|
|
1830
1832
|
if (t.value === "") {
|
|
1831
1833
|
s(null);
|
|
@@ -1836,77 +1838,77 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1836
1838
|
s(null);
|
|
1837
1839
|
return;
|
|
1838
1840
|
}
|
|
1839
|
-
const n = r[0].split("-"),
|
|
1841
|
+
const n = r[0].split("-"), o = new Date(
|
|
1840
1842
|
Number(n[0]),
|
|
1841
1843
|
Number(n[1]) - 1,
|
|
1842
1844
|
Number(n[2])
|
|
1843
1845
|
), l = r[1].split(":");
|
|
1844
|
-
|
|
1845
|
-
},
|
|
1846
|
+
o.setHours(Number(l[0] ?? 0)), o.setMinutes(Number(l[1] ?? 0)), o.setSeconds(Number(l[2] ?? 0)), s(o);
|
|
1847
|
+
}, Qt = (s) => (e) => {
|
|
1846
1848
|
const t = e.target;
|
|
1847
1849
|
s(t.checked);
|
|
1848
|
-
}, Qt = (s) => (e) => {
|
|
1849
|
-
e.preventDefault(), s();
|
|
1850
1850
|
}, Zt = (s) => (e) => {
|
|
1851
|
-
e.
|
|
1851
|
+
e.preventDefault(), s();
|
|
1852
1852
|
}, Kt = (s) => (e) => {
|
|
1853
|
+
e.stopPropagation(), s();
|
|
1854
|
+
}, es = (s) => (e) => {
|
|
1853
1855
|
e.stopImmediatePropagation(), s();
|
|
1854
|
-
},
|
|
1856
|
+
}, ts = (s, e = "input") => T(O.valueAsDate(s), X[e](At(s.set))), ss = (s, e = "input") => T(O.valueAsDate(s), X[e](St(s.set))), rs = (s, e = "input") => T(O.valueAsNumber(s), X[e](Tt(s.set))), ns = (s, e = "input") => T(O.value(s), X[e](bt(s.set))), is = (s) => T(O.checked(s), yt(s.set)), Y = (s, e) => {
|
|
1855
1857
|
if (d.is(s))
|
|
1856
1858
|
return (r) => {
|
|
1857
1859
|
const n = r.makeRef();
|
|
1858
|
-
let
|
|
1860
|
+
let o, l;
|
|
1859
1861
|
const c = s.map((h) => Object.keys(h)[0]);
|
|
1860
1862
|
let a;
|
|
1861
1863
|
const u = c.on((h) => {
|
|
1862
1864
|
if (h !== a) {
|
|
1863
|
-
a = h, l == null || l.dispose(),
|
|
1865
|
+
a = h, l == null || l.dispose(), o == null || o(!0), l = s.map((b) => b[h]);
|
|
1864
1866
|
const g = e[h](l);
|
|
1865
|
-
|
|
1867
|
+
o = f(g)(n);
|
|
1866
1868
|
}
|
|
1867
1869
|
});
|
|
1868
1870
|
return (h) => {
|
|
1869
|
-
l == null || l.dispose(), u(), n.clear(h),
|
|
1871
|
+
l == null || l.dispose(), u(), n.clear(h), o == null || o(h);
|
|
1870
1872
|
};
|
|
1871
1873
|
};
|
|
1872
1874
|
const t = Object.keys(s)[0];
|
|
1873
1875
|
return f(e[t](G(s[t])));
|
|
1874
1876
|
}, Pe = (s, e, t) => Y(
|
|
1875
|
-
|
|
1877
|
+
y.map(s, (r) => ({ [r[e]]: r })),
|
|
1876
1878
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1877
1879
|
t
|
|
1878
|
-
),
|
|
1879
|
-
const t =
|
|
1880
|
+
), os = (s, e) => Pe(s, "kind", e), ls = (s, e) => {
|
|
1881
|
+
const t = y.map(s, ([r, n]) => ({ [r]: n }));
|
|
1880
1882
|
return Y(t, e);
|
|
1881
|
-
},
|
|
1882
|
-
|
|
1883
|
+
}, cs = (s, e) => Pe(s, "type", e), vt = (s, e) => Y(
|
|
1884
|
+
y.map(s, (t) => ({ [t]: !0 })),
|
|
1883
1885
|
e
|
|
1884
|
-
),
|
|
1886
|
+
), as = (s, e = {}) => (t) => {
|
|
1885
1887
|
const r = (e == null ? void 0 : e.firstSeparator) ?? s, n = (e == null ? void 0 : e.lastSeparator) ?? s;
|
|
1886
|
-
return
|
|
1887
|
-
t.map((
|
|
1888
|
+
return vt(
|
|
1889
|
+
t.map((o) => o.isFirst ? "first" : o.isLast ? "last" : "other"),
|
|
1888
1890
|
{
|
|
1889
1891
|
first: r,
|
|
1890
1892
|
last: n,
|
|
1891
1893
|
other: s
|
|
1892
1894
|
}
|
|
1893
1895
|
);
|
|
1894
|
-
},
|
|
1896
|
+
}, us = (s) => (e) => (e.appendOrInsert(s), (t) => {
|
|
1895
1897
|
t && j(s);
|
|
1896
|
-
}),
|
|
1898
|
+
}), _t = (s, e, t) => {
|
|
1897
1899
|
if (d.is(s)) {
|
|
1898
1900
|
const r = s;
|
|
1899
1901
|
return (n) => {
|
|
1900
|
-
const
|
|
1902
|
+
const o = n.makeRef();
|
|
1901
1903
|
let l = () => {
|
|
1902
1904
|
}, c = !1, a = null;
|
|
1903
1905
|
const u = r.on((h) => {
|
|
1904
|
-
h == null ? (l(!0), l = f((t == null ? void 0 : t()) ?? v)(
|
|
1905
|
-
|
|
1906
|
+
h == null ? (l(!0), l = f((t == null ? void 0 : t()) ?? v)(o), c = !1, a == null || a.dispose(), a = null) : (a == null ? a = E(h) : a.value = h, c || (l(!0), l = f(e(a))(
|
|
1907
|
+
o
|
|
1906
1908
|
), c = !0));
|
|
1907
1909
|
});
|
|
1908
1910
|
return (h) => {
|
|
1909
|
-
a == null || a.dispose(), u(), l == null || l(h),
|
|
1911
|
+
a == null || a.dispose(), u(), l == null || l(h), o.clear(h);
|
|
1910
1912
|
};
|
|
1911
1913
|
};
|
|
1912
1914
|
} else {
|
|
@@ -1917,7 +1919,7 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1917
1919
|
}
|
|
1918
1920
|
return f(e(G(r)));
|
|
1919
1921
|
}
|
|
1920
|
-
},
|
|
1922
|
+
}, hs = (...s) => (e, t) => (r) => {
|
|
1921
1923
|
const n = r.makeRef();
|
|
1922
1924
|
if (s.some(
|
|
1923
1925
|
(p) => !d.is(p) && p == null
|
|
@@ -1941,7 +1943,7 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1941
1943
|
c[m] = !1;
|
|
1942
1944
|
};
|
|
1943
1945
|
let g = s.length - 1;
|
|
1944
|
-
const
|
|
1946
|
+
const b = s.map((p, m) => {
|
|
1945
1947
|
if (!d.is(p)) {
|
|
1946
1948
|
const C = E(p);
|
|
1947
1949
|
return l[m] = C, () => {
|
|
@@ -1954,14 +1956,14 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1954
1956
|
return u.on((p) => {
|
|
1955
1957
|
a == null || a(!0), a = null, p ? a = f(e(...l))(n) : a = f((t == null ? void 0 : t()) ?? v)(n);
|
|
1956
1958
|
}), (p) => {
|
|
1957
|
-
l.forEach((m) => m == null ? void 0 : m.dispose()), u.dispose(),
|
|
1959
|
+
l.forEach((m) => m == null ? void 0 : m.dispose()), u.dispose(), b.forEach((m) => m()), a == null || a(p), n.clear(p);
|
|
1958
1960
|
};
|
|
1959
|
-
},
|
|
1960
|
-
|
|
1961
|
+
}, M = (...s) => (e) => (t) => s.forEach((r) => r(t, e)), Le = (s, e, t) => _t(
|
|
1962
|
+
y.map(s, (r) => r ? !0 : null),
|
|
1961
1963
|
e,
|
|
1962
1964
|
t ?? void 0
|
|
1963
|
-
),
|
|
1964
|
-
|
|
1965
|
+
), fs = (s, e, t) => Le(
|
|
1966
|
+
y.map(s, (r) => !r),
|
|
1965
1967
|
e,
|
|
1966
1968
|
t
|
|
1967
1969
|
), De = (s, e, t) => {
|
|
@@ -1969,10 +1971,10 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1969
1971
|
return De(s, (r) => {
|
|
1970
1972
|
const n = new Q(
|
|
1971
1973
|
r.index,
|
|
1972
|
-
r.total.map((
|
|
1974
|
+
r.total.map((o) => o - 1)
|
|
1973
1975
|
);
|
|
1974
|
-
return
|
|
1975
|
-
|
|
1976
|
+
return T(
|
|
1977
|
+
M(n.dispose),
|
|
1976
1978
|
f(e(r)),
|
|
1977
1979
|
Le(
|
|
1978
1980
|
r.isLast,
|
|
@@ -1983,71 +1985,71 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1983
1985
|
});
|
|
1984
1986
|
if (d.is(s))
|
|
1985
1987
|
return (r) => {
|
|
1986
|
-
const n =
|
|
1987
|
-
|
|
1988
|
+
const n = s.derive(), o = r.makeRef(), l = [];
|
|
1989
|
+
return n.on((c) => {
|
|
1990
|
+
const a = l.splice(c);
|
|
1988
1991
|
for (const u of a)
|
|
1989
1992
|
u(!0);
|
|
1990
|
-
for (let u =
|
|
1991
|
-
const h = new Q(u,
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1993
|
+
for (let u = l.length; u < c; u++) {
|
|
1994
|
+
const h = new Q(u, n);
|
|
1995
|
+
l.push(
|
|
1996
|
+
T(
|
|
1997
|
+
M(h.dispose),
|
|
1995
1998
|
f(e(h))
|
|
1996
|
-
)(
|
|
1999
|
+
)(o)
|
|
1997
2000
|
);
|
|
1998
2001
|
}
|
|
1999
|
-
})
|
|
2000
|
-
|
|
2001
|
-
l
|
|
2002
|
-
for (const a of i)
|
|
2002
|
+
}), (c) => {
|
|
2003
|
+
n.dispose();
|
|
2004
|
+
for (const a of l)
|
|
2003
2005
|
a(c);
|
|
2004
|
-
|
|
2006
|
+
l.length = 0, o.clear(c);
|
|
2005
2007
|
};
|
|
2006
2008
|
};
|
|
2007
2009
|
{
|
|
2008
2010
|
const r = G(s);
|
|
2009
|
-
return
|
|
2010
|
-
...Array.from({ length: s }, (n,
|
|
2011
|
-
const
|
|
2012
|
-
return
|
|
2013
|
-
|
|
2014
|
-
f(e(
|
|
2011
|
+
return T(
|
|
2012
|
+
...Array.from({ length: s }, (n, o) => o).map((n) => {
|
|
2013
|
+
const o = new Q(n, r);
|
|
2014
|
+
return T(
|
|
2015
|
+
M(o.dispose),
|
|
2016
|
+
f(e(o))
|
|
2015
2017
|
);
|
|
2016
2018
|
})
|
|
2017
2019
|
);
|
|
2018
2020
|
}
|
|
2019
|
-
},
|
|
2020
|
-
const r =
|
|
2021
|
+
}, ds = (s, e, t) => {
|
|
2022
|
+
const r = y.map(s, (o) => o.length), n = y.toSignal(s);
|
|
2021
2023
|
return De(
|
|
2022
2024
|
r,
|
|
2023
|
-
(
|
|
2024
|
-
const l = n.map((c) => c[
|
|
2025
|
-
return
|
|
2026
|
-
|
|
2027
|
-
f(e(l,
|
|
2025
|
+
(o) => {
|
|
2026
|
+
const l = n.map((c) => c[o.index]);
|
|
2027
|
+
return T(
|
|
2028
|
+
M(l.dispose),
|
|
2029
|
+
f(e(l, o))
|
|
2028
2030
|
);
|
|
2029
2031
|
},
|
|
2030
2032
|
t
|
|
2031
2033
|
);
|
|
2032
|
-
},
|
|
2034
|
+
}, ps = (s, e) => {
|
|
2033
2035
|
if (d.is(s)) {
|
|
2034
2036
|
const t = s;
|
|
2035
2037
|
return (r) => {
|
|
2036
2038
|
r = r.makeRef();
|
|
2037
2039
|
const n = t.map((c) => f(e(c)));
|
|
2038
|
-
let
|
|
2040
|
+
let o = () => {
|
|
2039
2041
|
};
|
|
2040
2042
|
const l = n.on((c) => {
|
|
2041
|
-
|
|
2043
|
+
o(!0), o = c(r);
|
|
2042
2044
|
});
|
|
2043
2045
|
return (c) => {
|
|
2044
|
-
l(),
|
|
2046
|
+
l(), o(c);
|
|
2045
2047
|
};
|
|
2046
2048
|
};
|
|
2047
2049
|
}
|
|
2048
2050
|
return f(e(s));
|
|
2049
|
-
},
|
|
2050
|
-
|
|
2051
|
+
}, gs = (s, e, t = () => v) => Y(
|
|
2052
|
+
y.map(
|
|
2051
2053
|
s,
|
|
2052
2054
|
(r) => r.length > 0 ? { notEmpty: r } : { whenEmpty: null }
|
|
2053
2055
|
),
|
|
@@ -2055,11 +2057,11 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
2055
2057
|
notEmpty: (r) => e(r),
|
|
2056
2058
|
whenEmpty: () => t()
|
|
2057
2059
|
}
|
|
2058
|
-
),
|
|
2060
|
+
), ms = (s, e) => (t) => {
|
|
2059
2061
|
const r = t.makePortal(s);
|
|
2060
2062
|
return K(f(e), r);
|
|
2061
|
-
}, R = /* @__PURE__ */ new Map(),
|
|
2062
|
-
mark:
|
|
2063
|
+
}, R = /* @__PURE__ */ new Map(), wt = (s) => ({
|
|
2064
|
+
mark: Ge(`Probe(${s.description})`),
|
|
2063
2065
|
create: ({ callback: e = () => {
|
|
2064
2066
|
}, timeout: t = 10 } = {}) => {
|
|
2065
2067
|
const r = (c) => {
|
|
@@ -2067,28 +2069,28 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
2067
2069
|
};
|
|
2068
2070
|
if (R.has(s))
|
|
2069
2071
|
throw new Error(`Probe already exists: ${s.description}`);
|
|
2070
|
-
const n = setTimeout(() => r("timeout"), t),
|
|
2071
|
-
return R.set(s,
|
|
2072
|
+
const n = setTimeout(() => r("timeout"), t), o = { counter: 0, timeoutId: n };
|
|
2073
|
+
return R.set(s, o), {
|
|
2072
2074
|
value: () => {
|
|
2073
2075
|
clearTimeout(n);
|
|
2074
2076
|
const c = R.get(s);
|
|
2075
2077
|
c != null && --c.counter === 0 && r("resolved");
|
|
2076
2078
|
},
|
|
2077
2079
|
dispose: () => r("disposed"),
|
|
2078
|
-
onUse: () =>
|
|
2080
|
+
onUse: () => o.counter++
|
|
2079
2081
|
};
|
|
2080
2082
|
}
|
|
2081
|
-
}),
|
|
2083
|
+
}), ys = wt(Symbol("GlobalProbe")), Et = (s, e) => (t) => {
|
|
2082
2084
|
const r = t.getStyle(s);
|
|
2083
2085
|
return t.setStyle(s, e), (n) => {
|
|
2084
2086
|
n && t.setStyle(s, r);
|
|
2085
2087
|
};
|
|
2086
|
-
},
|
|
2088
|
+
}, Ct = (s, e) => (t) => {
|
|
2087
2089
|
const r = t.getStyle(s);
|
|
2088
2090
|
return e.on((n) => t.setStyle(s, n)), (n) => {
|
|
2089
2091
|
n && t.setStyle(s, r);
|
|
2090
2092
|
};
|
|
2091
|
-
},
|
|
2093
|
+
}, bs = new Proxy(
|
|
2092
2094
|
{},
|
|
2093
2095
|
{
|
|
2094
2096
|
/**
|
|
@@ -2099,9 +2101,9 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
2099
2101
|
* @returns The renderable component for the specified attribute.
|
|
2100
2102
|
*
|
|
2101
2103
|
*/
|
|
2102
|
-
get: (s, e) => (t) => d.is(t) ?
|
|
2104
|
+
get: (s, e) => (t) => d.is(t) ? Ct(e, t) : Et(e, t)
|
|
2103
2105
|
}
|
|
2104
|
-
),
|
|
2106
|
+
), xt = (s) => (e) => {
|
|
2105
2107
|
if (e.isBrowser()) {
|
|
2106
2108
|
const t = s(e);
|
|
2107
2109
|
if (t != null)
|
|
@@ -2113,7 +2115,7 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
2113
2115
|
const t = s(e);
|
|
2114
2116
|
return t == null ? () => {
|
|
2115
2117
|
} : f(t)(e);
|
|
2116
|
-
},
|
|
2118
|
+
}, As = (s) => xt((e) => s(e.element)), Ss = (s) => (e) => {
|
|
2117
2119
|
if (e.isHeadlessDOM()) {
|
|
2118
2120
|
const t = s(e);
|
|
2119
2121
|
if (t)
|
|
@@ -2129,134 +2131,135 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
2129
2131
|
function n(c) {
|
|
2130
2132
|
t = c;
|
|
2131
2133
|
}
|
|
2132
|
-
const
|
|
2134
|
+
const o = [], l = s({
|
|
2133
2135
|
use: ({ mark: c }) => {
|
|
2134
2136
|
const { value: a, onUse: u } = r().getProvider(c);
|
|
2135
2137
|
return u == null || u(), a;
|
|
2136
2138
|
},
|
|
2137
2139
|
set: ({ mark: c, create: a }, u) => {
|
|
2138
|
-
const { value: h, dispose: g, onUse:
|
|
2139
|
-
|
|
2140
|
+
const { value: h, dispose: g, onUse: b } = a(u, r());
|
|
2141
|
+
o.push(g), n(r().setProvider(c, h, b));
|
|
2140
2142
|
}
|
|
2141
2143
|
});
|
|
2142
2144
|
return l == null ? () => {
|
|
2143
|
-
} :
|
|
2145
|
+
} : T(
|
|
2144
2146
|
f(l),
|
|
2145
|
-
|
|
2147
|
+
M(() => o.forEach((c) => c()))
|
|
2146
2148
|
)(r());
|
|
2147
|
-
},
|
|
2149
|
+
}, vs = (s, e, t) => ee(({ set: r }) => (r(s, e), t())), _s = (s, e) => ee(({ use: t }) => e(t(s))), ws = (...s) => (e) => ee(({ use: t }) => {
|
|
2148
2150
|
const r = s.map(t);
|
|
2149
2151
|
return e(...r);
|
|
2150
2152
|
});
|
|
2151
2153
|
export {
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2154
|
+
Xt as Async,
|
|
2155
|
+
is as BindChecked,
|
|
2156
|
+
ts as BindDate,
|
|
2157
|
+
ss as BindDateTime,
|
|
2158
|
+
rs as BindNumber,
|
|
2159
|
+
ns as BindText,
|
|
2158
2160
|
L as BrowserContext,
|
|
2159
2161
|
q as CLASS_PLACEHOLDER_ATTR,
|
|
2160
2162
|
P as Computed,
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
+
as as Conjunction,
|
|
2164
|
+
us as DOMNode,
|
|
2163
2165
|
we as El,
|
|
2164
2166
|
Ee as ElNS,
|
|
2165
2167
|
Q as ElementPosition,
|
|
2166
2168
|
v as Empty,
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2169
|
+
_t as Ensure,
|
|
2170
|
+
hs as EnsureAll,
|
|
2171
|
+
ds as ForEach,
|
|
2172
|
+
T as Fragment,
|
|
2173
|
+
ys as GlobalProbe,
|
|
2174
|
+
It as HeadlessAdapter,
|
|
2173
2175
|
D as HeadlessContext,
|
|
2174
|
-
|
|
2176
|
+
at as HeadlessElement,
|
|
2175
2177
|
Se as HeadlessPortal,
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
+
ut as HeadlessText,
|
|
2179
|
+
ps as MapSignal,
|
|
2178
2180
|
ce as MemoryStore,
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2181
|
+
gs as NotEmpty,
|
|
2182
|
+
yt as OnChecked,
|
|
2183
|
+
M as OnDispose,
|
|
2182
2184
|
Y as OneOf,
|
|
2183
2185
|
Pe as OneOfField,
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2186
|
+
os as OneOfKind,
|
|
2187
|
+
ls as OneOfTuple,
|
|
2188
|
+
cs as OneOfType,
|
|
2189
|
+
vt as OneOfValue,
|
|
2190
|
+
ms as Portal,
|
|
2189
2191
|
V as Prop,
|
|
2190
|
-
|
|
2192
|
+
vs as Provide,
|
|
2191
2193
|
me as ProviderNotFoundError,
|
|
2192
|
-
|
|
2194
|
+
Xe as RenderingError,
|
|
2193
2195
|
De as Repeat,
|
|
2194
2196
|
d as Signal,
|
|
2195
2197
|
Ce as Task,
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2198
|
+
Vt as TextNode,
|
|
2199
|
+
fs as Unless,
|
|
2200
|
+
_s as Use,
|
|
2201
|
+
ws as UseMany,
|
|
2202
|
+
y as Value,
|
|
2201
2203
|
Le as When,
|
|
2202
|
-
|
|
2204
|
+
xt as WithBrowserCtx,
|
|
2203
2205
|
Ts as WithCtx,
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
+
As as WithElement,
|
|
2207
|
+
Ss as WithHeadlessCtx,
|
|
2206
2208
|
ee as WithProvider,
|
|
2207
2209
|
ye as _NODE_PLACEHOLDER_ATTR,
|
|
2208
|
-
|
|
2210
|
+
Je as _getSelfOrParentElement,
|
|
2209
2211
|
ge as _isElement,
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
+
Ue as _makeGetter,
|
|
2213
|
+
We as _makeSetter,
|
|
2212
2214
|
j as _removeDOMNode,
|
|
2213
2215
|
_e as _signalText,
|
|
2214
2216
|
ve as _staticText,
|
|
2215
|
-
|
|
2217
|
+
Ht as animateSignal,
|
|
2216
2218
|
Fe as animateSignals,
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
+
qt as aria,
|
|
2220
|
+
O as attr,
|
|
2219
2221
|
Z as computed,
|
|
2220
2222
|
qe as computedOf,
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
+
Be as computedRecord,
|
|
2224
|
+
jt as dataAttr,
|
|
2223
2225
|
je as effect,
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2226
|
+
Dt as effectOf,
|
|
2227
|
+
Qt as emitChecked,
|
|
2228
|
+
Zt as emitPreventDefault,
|
|
2229
|
+
es as emitStopImmediatePropagation,
|
|
2230
|
+
Kt as emitStopPropagation,
|
|
2231
|
+
bt as emitValue,
|
|
2232
|
+
At as emitValueAsDate,
|
|
2233
|
+
St as emitValueAsDateTime,
|
|
2234
|
+
Yt as emitValueAsNullableDate,
|
|
2235
|
+
zt as emitValueAsNullableDateTime,
|
|
2234
2236
|
Tt as emitValueAsNumber,
|
|
2235
2237
|
Ie as endInterpolate,
|
|
2236
2238
|
le as getWindow,
|
|
2237
2239
|
Re as guessInterpolate,
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
+
Wt as html,
|
|
2241
|
+
Ut as input,
|
|
2240
2242
|
Ne as interpolateDate,
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2243
|
+
ke as interpolateNumber,
|
|
2244
|
+
$e as interpolateString,
|
|
2245
|
+
Lt as joinSignals,
|
|
2246
|
+
Ot as localStorageProp,
|
|
2247
|
+
wt as makeProbe,
|
|
2248
|
+
Ge as makeProviderMark,
|
|
2249
|
+
Gt as math,
|
|
2250
|
+
Bt as mathAttr,
|
|
2251
|
+
kt as merge,
|
|
2249
2252
|
X as on,
|
|
2250
2253
|
E as prop,
|
|
2251
2254
|
$t as render,
|
|
2252
2255
|
K as renderWithContext,
|
|
2253
2256
|
f as renderableOfTNode,
|
|
2254
|
-
|
|
2255
|
-
|
|
2257
|
+
Rt as restoreTempoPlaceholders,
|
|
2258
|
+
Nt as runHeadless,
|
|
2256
2259
|
Mt as sessionStorageProp,
|
|
2257
2260
|
G as signal,
|
|
2258
2261
|
ae as storedProp,
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
+
bs as style,
|
|
2263
|
+
Jt as svg,
|
|
2264
|
+
Ft as svgAttr
|
|
2262
2265
|
};
|