@tempots/dom 27.0.0 → 28.0.1
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 +454 -435
- package/package.json +1 -1
- package/renderable/style.d.ts +5 -0
package/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
var Oe = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var re = (s) => {
|
|
3
3
|
throw TypeError(s);
|
|
4
4
|
};
|
|
5
5
|
var He = (s, e, t) => e in s ? Oe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
6
|
-
var
|
|
7
|
-
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
|
+
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 $e = (s, e, t) => s + (e - s) * t;
|
|
9
9
|
const ke = (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
19
|
}, Ne = (s, e, t) => new Date(s.getTime() + (e.getTime() - s.getTime()) * t), Ie = (s, e) => e, Re = (s) => typeof s == "number" ? $e : typeof s == "string" ? ke : s instanceof Date ? Ne : Ie;
|
|
20
|
-
var
|
|
21
|
-
class
|
|
20
|
+
var w;
|
|
21
|
+
class Q {
|
|
22
22
|
/**
|
|
23
23
|
* Creates a new instance of `ElementPosition`.
|
|
24
24
|
* @param index - The index of the element.
|
|
@@ -28,25 +28,26 @@ class Y {
|
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
o(this, "isOdd");
|
|
47
|
+
ie(this, w);
|
|
48
|
+
o(this, "dispose", () => {
|
|
49
|
+
var e;
|
|
50
|
+
(e = I(this, w)) == null || e.dispose(), z(this, w, void 0);
|
|
50
51
|
});
|
|
51
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;
|
|
52
53
|
}
|
|
@@ -55,11 +56,11 @@ class Y {
|
|
|
55
56
|
* @returns `true` if the element is the last element, `false` otherwise.
|
|
56
57
|
*/
|
|
57
58
|
get isLast() {
|
|
58
|
-
return
|
|
59
|
+
return I(this, w) == null && z(this, w, this.total.map((e) => this.counter === e)), I(this, w);
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
-
const
|
|
62
|
+
w = new WeakMap();
|
|
63
|
+
const H = class H {
|
|
63
64
|
/**
|
|
64
65
|
* Represents a signal with a value of type T.
|
|
65
66
|
*
|
|
@@ -71,33 +72,33 @@ const O = class O {
|
|
|
71
72
|
/**
|
|
72
73
|
* @internal
|
|
73
74
|
*/
|
|
74
|
-
|
|
75
|
+
o(this, "$__signal__", !0);
|
|
75
76
|
/**
|
|
76
77
|
* @internal
|
|
77
78
|
*/
|
|
78
|
-
|
|
79
|
+
o(this, "_value");
|
|
79
80
|
/**
|
|
80
81
|
* @internal
|
|
81
82
|
*/
|
|
82
|
-
|
|
83
|
+
o(this, "_derivatives", []);
|
|
83
84
|
/**
|
|
84
85
|
* @internal
|
|
85
86
|
*/
|
|
86
|
-
|
|
87
|
+
o(this, "_onValueListeners", []);
|
|
87
88
|
/**
|
|
88
89
|
* @internal
|
|
89
90
|
*/
|
|
90
|
-
|
|
91
|
+
o(this, "_onDisposeListeners", []);
|
|
91
92
|
/**
|
|
92
93
|
* Gets the current value of the signal.
|
|
93
94
|
* @returns The current value of the signal.
|
|
94
95
|
*/
|
|
95
|
-
|
|
96
|
+
o(this, "get", () => this._value);
|
|
96
97
|
/**
|
|
97
98
|
* Checks if the signal has any registered listeners.
|
|
98
99
|
* @returns `true` if the signal has listeners, `false` otherwise.
|
|
99
100
|
*/
|
|
100
|
-
|
|
101
|
+
o(this, "hasListeners", () => this._onValueListeners.length > 0);
|
|
101
102
|
/**
|
|
102
103
|
* Registers a listener function to be called whenever the value of the signal changes.
|
|
103
104
|
* The listener function will be immediately called with the current value of the signal.
|
|
@@ -106,10 +107,10 @@ const O = class O {
|
|
|
106
107
|
* @param listener - The listener function to be called when the value of the signal changes.
|
|
107
108
|
* @param options - Options for the listener.
|
|
108
109
|
*/
|
|
109
|
-
|
|
110
|
+
o(this, "on", (e, t = {}) => {
|
|
110
111
|
t.skipInitial || e(this.get(), void 0);
|
|
111
|
-
const r = t.once ? (
|
|
112
|
-
n(), e(
|
|
112
|
+
const r = t.once ? (i, l) => {
|
|
113
|
+
n(), e(i, l);
|
|
113
114
|
} : e;
|
|
114
115
|
this._onValueListeners.push(r);
|
|
115
116
|
const n = () => {
|
|
@@ -123,32 +124,32 @@ const O = class O {
|
|
|
123
124
|
/**
|
|
124
125
|
* @internal
|
|
125
126
|
*/
|
|
126
|
-
|
|
127
|
+
o(this, "_setAndNotify", (e, t) => {
|
|
127
128
|
if (this._disposed) return;
|
|
128
129
|
const r = this._value, n = this.equals(r, e);
|
|
129
|
-
n || (this._value = e), (t || !n) && this._onValueListeners.forEach((
|
|
130
|
+
n || (this._value = e), (t || !n) && this._onValueListeners.forEach((i) => i(e, r));
|
|
130
131
|
});
|
|
131
132
|
/**
|
|
132
133
|
* @internal
|
|
133
134
|
*/
|
|
134
|
-
|
|
135
|
+
o(this, "_disposed", !1);
|
|
135
136
|
/**
|
|
136
137
|
* Checks whether the signal is disposed.
|
|
137
138
|
* @returns True if the signal is disposed, false otherwise.
|
|
138
139
|
*/
|
|
139
|
-
|
|
140
|
+
o(this, "isDisposed", () => this._disposed);
|
|
140
141
|
/**
|
|
141
142
|
* Adds a listener function to be called when the object is disposed.
|
|
142
143
|
* @param listener - The listener function to be called when the object is disposed.
|
|
143
144
|
* @returns A function that can be called to remove the listener.
|
|
144
145
|
*/
|
|
145
|
-
|
|
146
|
+
o(this, "onDispose", (e) => {
|
|
146
147
|
this._onDisposeListeners.push(e);
|
|
147
148
|
});
|
|
148
149
|
/**
|
|
149
150
|
* Disposes the signal, releasing any resources associated with it.
|
|
150
151
|
*/
|
|
151
|
-
|
|
152
|
+
o(this, "dispose", () => {
|
|
152
153
|
this._disposed || (this._disposed = !0, this._onDisposeListeners.forEach((e) => e()), this._onDisposeListeners.length = 0, this._derivatives.length = 0);
|
|
153
154
|
});
|
|
154
155
|
/**
|
|
@@ -201,8 +202,8 @@ const O = class O {
|
|
|
201
202
|
* @param equals - Optional function to determine if two transformed values are equal (defaults to strict equality)
|
|
202
203
|
* @returns A new computed signal with the transformed value
|
|
203
204
|
*/
|
|
204
|
-
|
|
205
|
-
const r = new
|
|
205
|
+
o(this, "map", (e, t = (r, n) => r === n) => {
|
|
206
|
+
const r = new P(() => {
|
|
206
207
|
try {
|
|
207
208
|
return e(this.get());
|
|
208
209
|
} catch (n) {
|
|
@@ -221,8 +222,8 @@ const O = class O {
|
|
|
221
222
|
* Defaults to a strict equality check (===).
|
|
222
223
|
* @returns A new Signal that emits the values of the resulting Signal.
|
|
223
224
|
*/
|
|
224
|
-
|
|
225
|
-
const r = new
|
|
225
|
+
o(this, "flatMap", (e, t = (r, n) => r === n) => {
|
|
226
|
+
const r = new P(() => {
|
|
226
227
|
try {
|
|
227
228
|
return e(this.get()).get();
|
|
228
229
|
} catch (n) {
|
|
@@ -237,26 +238,26 @@ const O = class O {
|
|
|
237
238
|
* @param fn - The callback function to be invoked with the current value of the signal.
|
|
238
239
|
* @returns A new signal that emits the same value as the original signal and invokes the callback function.
|
|
239
240
|
*/
|
|
240
|
-
|
|
241
|
+
o(this, "tap", (e) => this.map((t) => (e(t), t)));
|
|
241
242
|
/**
|
|
242
243
|
* Returns a new Signal that emits the value at the specified key of the current value.
|
|
243
244
|
*
|
|
244
245
|
* @param key - The key of the value to retrieve.
|
|
245
246
|
* @returns A new Signal that emits the value at the specified key.
|
|
246
247
|
*/
|
|
247
|
-
|
|
248
|
+
o(this, "at", (e) => this.map((t) => t[e]));
|
|
248
249
|
/**
|
|
249
250
|
* @internal
|
|
250
251
|
*/
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
o(this, "_$");
|
|
253
|
+
o(this, "filter", (e, t) => {
|
|
253
254
|
let r = t ?? this.get();
|
|
254
|
-
const n = new
|
|
255
|
+
const n = new P(() => {
|
|
255
256
|
try {
|
|
256
|
-
const
|
|
257
|
-
return r = e(
|
|
258
|
-
} catch (
|
|
259
|
-
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;
|
|
260
261
|
}
|
|
261
262
|
}, this.equals);
|
|
262
263
|
return this.setDerivative(n), n;
|
|
@@ -271,9 +272,9 @@ const O = class O {
|
|
|
271
272
|
* @param equals - Optional equality function to determine if two values are equal.
|
|
272
273
|
* @returns - A new Computed object with the mapped and filtered values.
|
|
273
274
|
*/
|
|
274
|
-
|
|
275
|
+
o(this, "filterMap", (e, t, r = (n, i) => n === i) => {
|
|
275
276
|
let n = t;
|
|
276
|
-
const
|
|
277
|
+
const i = new P(() => {
|
|
277
278
|
try {
|
|
278
279
|
const l = this.get(), c = e(l);
|
|
279
280
|
return n = c ?? n;
|
|
@@ -281,7 +282,7 @@ const O = class O {
|
|
|
281
282
|
throw console.error("Error in Signal.filterMap:", l), l;
|
|
282
283
|
}
|
|
283
284
|
}, r);
|
|
284
|
-
return this.setDerivative(
|
|
285
|
+
return this.setDerivative(i), i;
|
|
285
286
|
});
|
|
286
287
|
/**
|
|
287
288
|
* Maps the values emitted by the signal to a new value asynchronously using the provided function.
|
|
@@ -296,25 +297,25 @@ const O = class O {
|
|
|
296
297
|
* @param equals - The equality function to compare the mapped values for equality.
|
|
297
298
|
* @returns A property that holds the mapped value and can be observed for changes.
|
|
298
299
|
*/
|
|
299
|
-
|
|
300
|
-
const
|
|
300
|
+
o(this, "mapAsync", (e, t, r, n = (i, l) => i === l) => {
|
|
301
|
+
const i = E(t, n);
|
|
301
302
|
let l = 0, c = new AbortController();
|
|
302
|
-
return
|
|
303
|
+
return i.onDispose(
|
|
303
304
|
this.on(async (a) => {
|
|
304
305
|
const u = ++l;
|
|
305
306
|
c.abort(), c = new AbortController();
|
|
306
307
|
try {
|
|
307
308
|
const h = await e(a, { abortSignal: c.signal });
|
|
308
|
-
u === l &&
|
|
309
|
+
u === l && i.set(h);
|
|
309
310
|
} catch (h) {
|
|
310
311
|
if (u === l)
|
|
311
312
|
if (r != null)
|
|
312
|
-
|
|
313
|
+
i.set(r(h));
|
|
313
314
|
else
|
|
314
315
|
throw h;
|
|
315
316
|
}
|
|
316
317
|
})
|
|
317
|
-
),
|
|
318
|
+
), i;
|
|
318
319
|
});
|
|
319
320
|
/**
|
|
320
321
|
* Maps the values of the signal using the provided function `fn`, and returns a new signal
|
|
@@ -326,14 +327,14 @@ const O = class O {
|
|
|
326
327
|
* @param alt - The alternative value to use when the mapped value is `undefined` or `null`.
|
|
327
328
|
* @returns A new signal containing the mapped values.
|
|
328
329
|
*/
|
|
329
|
-
|
|
330
|
+
o(this, "mapMaybe", (e, t) => this.map((r) => e(r) ?? t));
|
|
330
331
|
/**
|
|
331
332
|
* Feeds a property into the signal and sets up disposal behavior.
|
|
332
333
|
* @param prop - The property to feed into the signal.
|
|
333
334
|
* @param autoDisposeProp - Determines whether the property should be automatically disposed when the signal is disposed.
|
|
334
335
|
* @returns The input property.
|
|
335
336
|
*/
|
|
336
|
-
|
|
337
|
+
o(this, "feedProp", (e, t = !1) => {
|
|
337
338
|
const r = this.on(e.set);
|
|
338
339
|
return e.onDispose(r), t ? this.onDispose(e.dispose) : this.onDispose(r), e;
|
|
339
340
|
});
|
|
@@ -344,7 +345,7 @@ const O = class O {
|
|
|
344
345
|
* @param options.equals - A function that determines if two values are equal.
|
|
345
346
|
* @returns The derived property.
|
|
346
347
|
*/
|
|
347
|
-
|
|
348
|
+
o(this, "deriveProp", ({
|
|
348
349
|
autoDisposeProp: e = !0,
|
|
349
350
|
equals: t
|
|
350
351
|
} = {}) => this.feedProp(E(this.get(), t), e));
|
|
@@ -352,12 +353,12 @@ const O = class O {
|
|
|
352
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.
|
|
353
354
|
* @returns A new signal that emits the same values as the current signal.
|
|
354
355
|
*/
|
|
355
|
-
|
|
356
|
+
o(this, "derive", () => this.map((e) => e));
|
|
356
357
|
/**
|
|
357
358
|
* Returns a signal that emits the count of values received so far.
|
|
358
359
|
* @returns A signal that emits the count of values received so far.
|
|
359
360
|
*/
|
|
360
|
-
|
|
361
|
+
o(this, "count", () => {
|
|
361
362
|
let e = 0;
|
|
362
363
|
return this.map(() => ++e);
|
|
363
364
|
});
|
|
@@ -367,7 +368,7 @@ const O = class O {
|
|
|
367
368
|
* Additionally, when the computed value is disposed, it sets the signal as dirty.
|
|
368
369
|
* @param computed - The computed value to add as a derivative.
|
|
369
370
|
*/
|
|
370
|
-
|
|
371
|
+
o(this, "setDerivative", (e) => {
|
|
371
372
|
this._derivatives.push(e), e.onDispose(() => {
|
|
372
373
|
this._derivatives.splice(
|
|
373
374
|
this._derivatives.indexOf(e),
|
|
@@ -435,27 +436,27 @@ const O = class O {
|
|
|
435
436
|
* @param equals - Function to compare two values for equality (defaults to strict equality)
|
|
436
437
|
* @returns A Signal that represents the result of the Promise
|
|
437
438
|
*/
|
|
438
|
-
|
|
439
|
-
const
|
|
440
|
-
return e.then((l) =>
|
|
441
|
-
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, !1)).catch((l) => {
|
|
442
|
+
r != null ? i._setAndNotify(r(l), !1) : console.error(
|
|
442
443
|
"Unhandled promise rejection in Signal.ofPromise:",
|
|
443
444
|
l
|
|
444
445
|
);
|
|
445
|
-
}),
|
|
446
|
+
}), i;
|
|
446
447
|
}), /**
|
|
447
448
|
* Checks if a value is a Signal.
|
|
448
449
|
*
|
|
449
450
|
* @param value - The value to check.
|
|
450
451
|
* @returns `true` if the value is a Signal, `false` otherwise.
|
|
451
452
|
*/
|
|
452
|
-
|
|
453
|
+
o(H, "is", (e) => (
|
|
453
454
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
454
455
|
e != null && e.$__signal__ === !0
|
|
455
456
|
));
|
|
456
|
-
let d =
|
|
457
|
+
let d = H;
|
|
457
458
|
const Ve = typeof queueMicrotask == "function" ? queueMicrotask : (s) => Promise.resolve().then(s);
|
|
458
|
-
class
|
|
459
|
+
class P extends d {
|
|
459
460
|
/**
|
|
460
461
|
* Represents a Signal object.
|
|
461
462
|
* @param _fn - The function that returns the value of the signal.
|
|
@@ -466,36 +467,36 @@ class x extends d {
|
|
|
466
467
|
/**
|
|
467
468
|
* @internal
|
|
468
469
|
*/
|
|
469
|
-
|
|
470
|
+
o(this, "$__computed__", !0);
|
|
470
471
|
/**
|
|
471
472
|
* @internal
|
|
472
473
|
*/
|
|
473
|
-
|
|
474
|
+
o(this, "_isDirty", !1);
|
|
474
475
|
/**
|
|
475
476
|
* Marks the signal as dirty, indicating that its value has changed and needs to be recalculated.
|
|
476
477
|
* If the signal is already dirty or disposed, this method does nothing.
|
|
477
478
|
* It also marks all dependent signals as dirty and schedules a notification to update their values.
|
|
478
479
|
*/
|
|
479
|
-
|
|
480
|
+
o(this, "setDirty", () => {
|
|
480
481
|
this._isDirty || this._disposed || (this._isDirty = !0, this._derivatives.forEach((t) => t.setDirty()), this._scheduleNotify());
|
|
481
482
|
});
|
|
482
483
|
/**
|
|
483
484
|
* @internal
|
|
484
485
|
*/
|
|
485
|
-
|
|
486
|
+
o(this, "_scheduleCount", 0);
|
|
486
487
|
/**
|
|
487
488
|
* Schedules a notification to be executed asynchronously.
|
|
488
489
|
* If the signal is dirty, it will be updated and notified.
|
|
489
490
|
* @internal
|
|
490
491
|
*/
|
|
491
|
-
|
|
492
|
+
o(this, "_scheduleNotify", () => {
|
|
492
493
|
const t = ++this._scheduleCount;
|
|
493
494
|
Ve(() => {
|
|
494
495
|
this._scheduleCount !== t || this._disposed || this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn(), !1));
|
|
495
496
|
});
|
|
496
497
|
});
|
|
497
498
|
/** {@inheritDoc Signal.get} */
|
|
498
|
-
|
|
499
|
+
o(this, "get", () => (this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn(), !1)), this._value));
|
|
499
500
|
this._fn = t, this.setDirty();
|
|
500
501
|
}
|
|
501
502
|
/**
|
|
@@ -512,26 +513,26 @@ class x extends d {
|
|
|
512
513
|
return this.get();
|
|
513
514
|
}
|
|
514
515
|
}
|
|
515
|
-
const
|
|
516
|
+
const J = class J extends d {
|
|
516
517
|
constructor() {
|
|
517
518
|
super(...arguments);
|
|
518
519
|
/**
|
|
519
520
|
* @internal
|
|
520
521
|
*/
|
|
521
|
-
|
|
522
|
+
o(this, "$__prop__", !0);
|
|
522
523
|
/**
|
|
523
524
|
* Changes the value of the property and notifies its listeners.
|
|
524
525
|
*
|
|
525
526
|
* @param value - The new value of the property.
|
|
526
527
|
*/
|
|
527
|
-
|
|
528
|
+
o(this, "set", (t) => {
|
|
528
529
|
this._setAndNotify(t, !1);
|
|
529
530
|
});
|
|
530
531
|
/**
|
|
531
532
|
* Updates the value of the signal by applying the provided function to the current value.
|
|
532
533
|
* @param fn - The function to apply to the current value.
|
|
533
534
|
*/
|
|
534
|
-
|
|
535
|
+
o(this, "update", (t) => {
|
|
535
536
|
this._setAndNotify(t(this.get()), !1);
|
|
536
537
|
});
|
|
537
538
|
/**
|
|
@@ -540,16 +541,16 @@ const W = class W extends d {
|
|
|
540
541
|
* @param effects - An array of effects to be executed after the state is updated.
|
|
541
542
|
* @returns A dispatch function that can be used to update the state and trigger the effects.
|
|
542
543
|
*/
|
|
543
|
-
|
|
544
|
+
o(this, "reducer", (t, ...r) => {
|
|
544
545
|
const n = this;
|
|
545
|
-
return function
|
|
546
|
+
return function i(l) {
|
|
546
547
|
const c = n.value;
|
|
547
548
|
n.update((a) => t(a, l)), !n.equals(c, n.value) && r.forEach(
|
|
548
549
|
(a) => a({
|
|
549
550
|
previousState: c,
|
|
550
551
|
state: n.value,
|
|
551
552
|
action: l,
|
|
552
|
-
dispatch:
|
|
553
|
+
dispatch: i
|
|
553
554
|
})
|
|
554
555
|
);
|
|
555
556
|
};
|
|
@@ -565,9 +566,9 @@ const W = class W extends d {
|
|
|
565
566
|
* Defaults to a strict equality check (===).
|
|
566
567
|
* @returns A Prop object representing the isomorphism.
|
|
567
568
|
*/
|
|
568
|
-
|
|
569
|
-
const
|
|
570
|
-
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), !1)), i;
|
|
571
572
|
});
|
|
572
573
|
/**
|
|
573
574
|
* Returns a `Prop` that represents the value at the specified key of the current value.
|
|
@@ -575,7 +576,7 @@ const W = class W extends d {
|
|
|
575
576
|
* @param key - The key of the value to access.
|
|
576
577
|
* @returns A `Prop` that represents the value at the specified key.
|
|
577
578
|
*/
|
|
578
|
-
|
|
579
|
+
o(this, "atProp", (t) => this.iso(
|
|
579
580
|
(r) => r[t],
|
|
580
581
|
(r) => ({ ...this.value, [t]: r })
|
|
581
582
|
));
|
|
@@ -595,17 +596,17 @@ const W = class W extends d {
|
|
|
595
596
|
* @param value - The value to check.
|
|
596
597
|
* @returns `true` if the value is a Prop, `false` otherwise.
|
|
597
598
|
*/
|
|
598
|
-
|
|
599
|
+
o(J, "is", (t) => (
|
|
599
600
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
600
601
|
t != null && t.$__prop__ === !0
|
|
601
602
|
));
|
|
602
|
-
let
|
|
603
|
-
const
|
|
604
|
-
const r = new
|
|
603
|
+
let V = J;
|
|
604
|
+
const Z = (s, e, t = (r, n) => r === n) => {
|
|
605
|
+
const r = new P(s, t);
|
|
605
606
|
return e.forEach((n) => n.setDerivative(r)), r;
|
|
606
607
|
}, je = (s, e, t = {}) => {
|
|
607
608
|
let r = t.once ? () => {
|
|
608
|
-
|
|
609
|
+
i(), s();
|
|
609
610
|
} : s;
|
|
610
611
|
if (t.skipInitial) {
|
|
611
612
|
let l = !1;
|
|
@@ -614,11 +615,11 @@ const z = (s, e, t = (r, n) => r === n) => {
|
|
|
614
615
|
l ? c() : l = !0;
|
|
615
616
|
};
|
|
616
617
|
}
|
|
617
|
-
const n =
|
|
618
|
-
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);
|
|
619
620
|
};
|
|
620
|
-
return t.abortSignal != null && t.abortSignal.addEventListener("abort",
|
|
621
|
-
}, E = (s, e = (t, r) => t === r) => new
|
|
621
|
+
return t.abortSignal != null && t.abortSignal.addEventListener("abort", i), i;
|
|
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, T = {
|
|
622
623
|
/**
|
|
623
624
|
* Maps a value or a Signal to a new value.
|
|
624
625
|
* If the value is a Signal, it returns a new Signal with the mapped value.
|
|
@@ -641,7 +642,7 @@ const z = (s, e, t = (r, n) => r === n) => {
|
|
|
641
642
|
* @param equals - A function that determines if two values are equal. Defaults to strict equality (===).
|
|
642
643
|
* @returns A Signal instance.
|
|
643
644
|
*/
|
|
644
|
-
toSignal: (s, e) => d.is(s) ? s :
|
|
645
|
+
toSignal: (s, e) => d.is(s) ? s : G(s, e),
|
|
645
646
|
/**
|
|
646
647
|
* Wraps a value in a `Signal` if it is not already a `Signal`.
|
|
647
648
|
* If the value is `null` or `undefined`, it returns `null` or `undefined` respectively.
|
|
@@ -691,7 +692,7 @@ const z = (s, e, t = (r, n) => r === n) => {
|
|
|
691
692
|
} = {}) => d.is(s) ? s.deriveProp({ autoDisposeProp: e, equals: t }) : E(s, t)
|
|
692
693
|
}, qe = (...s) => (e, t) => {
|
|
693
694
|
const r = s.filter((n) => d.is(n));
|
|
694
|
-
return
|
|
695
|
+
return Z(
|
|
695
696
|
() => e(...s.map((n) => T.get(n))),
|
|
696
697
|
r,
|
|
697
698
|
t
|
|
@@ -711,19 +712,19 @@ const z = (s, e, t = (r, n) => r === n) => {
|
|
|
711
712
|
};
|
|
712
713
|
class ce {
|
|
713
714
|
constructor() {
|
|
714
|
-
|
|
715
|
+
o(this, "_store", /* @__PURE__ */ new Map());
|
|
715
716
|
/**
|
|
716
717
|
* Retrieves the value associated with the specified key from the memory store.
|
|
717
718
|
* @param key - The key to retrieve the value for.
|
|
718
719
|
* @returns The value associated with the key, or `null` if the key is not found.
|
|
719
720
|
*/
|
|
720
|
-
|
|
721
|
+
o(this, "getItem", (e) => this._store.get(e) ?? null);
|
|
721
722
|
/**
|
|
722
723
|
* Sets the value associated with the specified key in the memory store.
|
|
723
724
|
* @param key - The key to set the value for.
|
|
724
725
|
* @param value - The value to set.
|
|
725
726
|
*/
|
|
726
|
-
|
|
727
|
+
o(this, "setItem", (e, t) => {
|
|
727
728
|
this._store.set(e, t);
|
|
728
729
|
});
|
|
729
730
|
}
|
|
@@ -734,12 +735,12 @@ const ae = ({
|
|
|
734
735
|
store: t,
|
|
735
736
|
serialize: r = JSON.stringify,
|
|
736
737
|
deserialize: n = JSON.parse,
|
|
737
|
-
equals:
|
|
738
|
+
equals: i = (c, a) => c === a,
|
|
738
739
|
onLoad: l = (c) => c
|
|
739
740
|
}) => {
|
|
740
|
-
const c = t.getItem(s), a = new
|
|
741
|
+
const c = t.getItem(s), a = new V(
|
|
741
742
|
c != null ? l(n(c)) : typeof e == "function" ? e() : e,
|
|
742
|
-
|
|
743
|
+
i
|
|
743
744
|
);
|
|
744
745
|
return a.on((u) => {
|
|
745
746
|
t.setItem(s, r(u));
|
|
@@ -761,21 +762,21 @@ function oe(s) {
|
|
|
761
762
|
return typeof requestAnimationFrame == "function" ? requestAnimationFrame(s) : setTimeout(s, 0);
|
|
762
763
|
}
|
|
763
764
|
const Fe = (s, e, t, r) => {
|
|
764
|
-
const n = (r == null ? void 0 : r.duration) ?? 300,
|
|
765
|
+
const n = (r == null ? void 0 : r.duration) ?? 300, i = (r == null ? void 0 : r.easing) ?? ((S) => S), l = (r == null ? void 0 : r.equals) ?? ((S, N) => S === N);
|
|
765
766
|
let c = r == null ? void 0 : r.interpolate, a = s, u = e(), h = performance.now(), g = null, y = !0;
|
|
766
|
-
const p = new
|
|
767
|
+
const p = new P(e, l), m = E(s, l);
|
|
767
768
|
m.onDispose(() => {
|
|
768
769
|
g !== null && cancelAnimationFrame(g);
|
|
769
770
|
}), m.onDispose(p.dispose), t.forEach((S) => {
|
|
770
771
|
S.setDerivative(p), S.onDispose(m.dispose);
|
|
771
772
|
});
|
|
772
773
|
const C = (S) => {
|
|
773
|
-
u = S, h = performance.now(), a = m.value, y && (y = !1, g = oe(
|
|
774
|
-
},
|
|
775
|
-
const
|
|
774
|
+
u = S, h = performance.now(), a = m.value, y && (y = !1, g = oe(te));
|
|
775
|
+
}, te = () => {
|
|
776
|
+
const N = (performance.now() - h) / T.get(n), Me = i(N);
|
|
776
777
|
c == null && (c = Re(a));
|
|
777
|
-
let
|
|
778
|
-
|
|
778
|
+
let se = c(a, u, Me);
|
|
779
|
+
N >= 1 ? (y = !0, se = u) : g = oe(te), m.set(se);
|
|
779
780
|
};
|
|
780
781
|
return p.on(C), m;
|
|
781
782
|
}, Ot = (s, e) => {
|
|
@@ -788,10 +789,10 @@ const Fe = (s, e, t, r) => {
|
|
|
788
789
|
);
|
|
789
790
|
}, Ht = (s, e) => {
|
|
790
791
|
const { signals: t, literals: r } = Object.entries(s).reduce(
|
|
791
|
-
({ signals:
|
|
792
|
+
({ signals: i, literals: l }, [c, a]) => (d.is(a) ? i.push([c, a]) : l[c] = a, { signals: i, literals: l }),
|
|
792
793
|
{ signals: [], literals: {} }
|
|
793
|
-
), n = t.map(([,
|
|
794
|
-
return
|
|
794
|
+
), n = t.map(([, i]) => i);
|
|
795
|
+
return Z(() => (t.forEach(([i, l]) => r[i] = l.value), e(r)), n);
|
|
795
796
|
}, ue = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), he = /* @__PURE__ */ new Set(["selected"]), fe = /* @__PURE__ */ new Set([
|
|
796
797
|
"rowSpan",
|
|
797
798
|
"colSpan",
|
|
@@ -817,7 +818,7 @@ const Fe = (s, e, t, r) => {
|
|
|
817
818
|
t == null ? e[s] = null : e[s] = String(t);
|
|
818
819
|
} : (t) => {
|
|
819
820
|
t == null ? e.removeAttribute(s) : e.setAttribute(s, t);
|
|
820
|
-
}, We = (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),
|
|
821
|
+
}, We = (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) => {
|
|
821
822
|
const e = s;
|
|
822
823
|
e && e.onblur && (e.onblur = null), !(!s || s.ownerDocument === void 0) && s.parentElement && s.parentElement.removeChild(s);
|
|
823
824
|
}, Ue = (s) => ge(s) ? s : s.parentElement, ge = (s) => s.nodeType === 1;
|
|
@@ -826,7 +827,7 @@ class me extends Error {
|
|
|
826
827
|
super(`Provider not found: ${e.description}`);
|
|
827
828
|
}
|
|
828
829
|
}
|
|
829
|
-
class
|
|
830
|
+
class L {
|
|
830
831
|
/**
|
|
831
832
|
* Constructs a new `DOMContext` instance.
|
|
832
833
|
*
|
|
@@ -844,7 +845,7 @@ class P {
|
|
|
844
845
|
* @param namespace - The namespace URI to create the element in, or `undefined` to create a standard HTML element.
|
|
845
846
|
* @returns The newly created element.
|
|
846
847
|
*/
|
|
847
|
-
|
|
848
|
+
o(this, "createElement", (e, t) => t !== void 0 ? this.document.createElementNS(t, e) : this.document.createElement(e));
|
|
848
849
|
/**
|
|
849
850
|
* Creates a new child element and appends it to the current element, returning a new context.
|
|
850
851
|
*
|
|
@@ -867,7 +868,7 @@ class P {
|
|
|
867
868
|
* @param namespace - The namespace URI for the element, or undefined for HTML elements
|
|
868
869
|
* @returns A new DOMContext focused on the newly created child element
|
|
869
870
|
*/
|
|
870
|
-
|
|
871
|
+
o(this, "makeChildElement", (e, t) => {
|
|
871
872
|
const r = this.createElement(e, t);
|
|
872
873
|
return this.appendOrInsert(r), this.withElement(r);
|
|
873
874
|
});
|
|
@@ -876,13 +877,13 @@ class P {
|
|
|
876
877
|
* @param text - The text content for the new text node.
|
|
877
878
|
* @returns A new `Text` node with the specified text content.
|
|
878
879
|
*/
|
|
879
|
-
|
|
880
|
+
o(this, "createText", (e) => this.document.createTextNode(e));
|
|
880
881
|
/**
|
|
881
882
|
* Creates a new text node with the specified text content and appends it to the current element.
|
|
882
883
|
* @param text - The text content for the new text node.
|
|
883
884
|
* @returns A new `DOMContext` with a reference to the new text node.
|
|
884
885
|
*/
|
|
885
|
-
|
|
886
|
+
o(this, "makeChildText", (e) => {
|
|
886
887
|
const t = this.createText(e);
|
|
887
888
|
return this.appendOrInsert(t), this.withReference(t);
|
|
888
889
|
});
|
|
@@ -890,14 +891,14 @@ class P {
|
|
|
890
891
|
* Sets the text content of the current element.
|
|
891
892
|
* @param text - The text content to set.
|
|
892
893
|
*/
|
|
893
|
-
|
|
894
|
+
o(this, "setText", (e) => {
|
|
894
895
|
this.reference.nodeValue = e;
|
|
895
896
|
});
|
|
896
897
|
/**
|
|
897
898
|
* Gets the text content of the current element or text node.
|
|
898
899
|
* @returns The text content of the current element or text node.
|
|
899
900
|
*/
|
|
900
|
-
|
|
901
|
+
o(this, "getText", () => {
|
|
901
902
|
var e;
|
|
902
903
|
return ((e = this.reference) == null ? void 0 : e.nodeValue) ?? this.element.textContent ?? "";
|
|
903
904
|
});
|
|
@@ -906,7 +907,7 @@ class P {
|
|
|
906
907
|
* The text node is appended or inserted to the current `DOMContext`.
|
|
907
908
|
* The new `DOMContext` with the reference is returned.
|
|
908
909
|
*/
|
|
909
|
-
|
|
910
|
+
o(this, "makeRef", () => {
|
|
910
911
|
const e = this.createText("");
|
|
911
912
|
return this.appendOrInsert(e), this.withReference(e);
|
|
912
913
|
});
|
|
@@ -915,7 +916,7 @@ class P {
|
|
|
915
916
|
*
|
|
916
917
|
* @param child - The child node to append or insert.
|
|
917
918
|
*/
|
|
918
|
-
|
|
919
|
+
o(this, "appendOrInsert", (e) => {
|
|
919
920
|
this.reference === void 0 ? this.element.appendChild(e) : this.element.insertBefore(e, this.reference);
|
|
920
921
|
});
|
|
921
922
|
/**
|
|
@@ -923,7 +924,7 @@ class P {
|
|
|
923
924
|
* @param element - The DOM element to use in the new `DOMContext` instance.
|
|
924
925
|
* @returns A new `DOMContext` instance with the provided `element`.
|
|
925
926
|
*/
|
|
926
|
-
|
|
927
|
+
o(this, "withElement", (e) => new L(this.document, e, void 0, this.providers));
|
|
927
928
|
/**
|
|
928
929
|
* Creates a portal to render content in a different part of the DOM tree.
|
|
929
930
|
*
|
|
@@ -968,7 +969,7 @@ class P {
|
|
|
968
969
|
* @returns A new DOMContext focused on the portal target element
|
|
969
970
|
* @throws {Error} When the selector doesn't match any element in the document
|
|
970
971
|
*/
|
|
971
|
-
|
|
972
|
+
o(this, "makePortal", (e) => {
|
|
972
973
|
const t = typeof e == "string" ? this.document.querySelector(e) : e;
|
|
973
974
|
if (t == null)
|
|
974
975
|
throw new Error(`Cannot find element by selector for portal: ${e}`);
|
|
@@ -980,7 +981,7 @@ class P {
|
|
|
980
981
|
* @param reference - The optional `Text` node to use as the reference for the new `DOMContext`.
|
|
981
982
|
* @returns A new `DOMContext` instance with the specified reference.
|
|
982
983
|
*/
|
|
983
|
-
|
|
984
|
+
o(this, "withReference", (e) => new L(this.document, this.element, e, this.providers));
|
|
984
985
|
/**
|
|
985
986
|
* Sets a provider for the given provider mark.
|
|
986
987
|
*
|
|
@@ -988,7 +989,7 @@ class P {
|
|
|
988
989
|
* @param value - The provider to set for the given mark.
|
|
989
990
|
* @returns A new `DOMContext` instance with the specified provider.
|
|
990
991
|
*/
|
|
991
|
-
|
|
992
|
+
o(this, "setProvider", (e, t, r) => new L(this.document, this.element, this.reference, {
|
|
992
993
|
...this.providers,
|
|
993
994
|
[e]: [t, r]
|
|
994
995
|
}));
|
|
@@ -999,34 +1000,34 @@ class P {
|
|
|
999
1000
|
* @returns The provider for the given mark.
|
|
1000
1001
|
* @throws Throws `ProviderNotFoundError` if the provider for the given mark is not found.
|
|
1001
1002
|
*/
|
|
1002
|
-
|
|
1003
|
+
o(this, "getProvider", (e) => {
|
|
1003
1004
|
if (this.providers[e] === void 0)
|
|
1004
1005
|
throw new me(e);
|
|
1005
1006
|
const [t, r] = this.providers[e];
|
|
1006
1007
|
return { value: t, onUse: r };
|
|
1007
1008
|
});
|
|
1008
|
-
|
|
1009
|
-
e && (this.reference !== void 0 ?
|
|
1009
|
+
o(this, "clear", (e) => {
|
|
1010
|
+
e && (this.reference !== void 0 ? j(this.reference) : j(this.element));
|
|
1010
1011
|
});
|
|
1011
1012
|
/**
|
|
1012
1013
|
* Adds classes to the element.
|
|
1013
1014
|
* @param tokens - The class names to add.
|
|
1014
1015
|
*/
|
|
1015
|
-
|
|
1016
|
+
o(this, "addClasses", (e) => {
|
|
1016
1017
|
this.element.classList.add(...e);
|
|
1017
1018
|
});
|
|
1018
1019
|
/**
|
|
1019
1020
|
* Removes classes from the element.
|
|
1020
1021
|
* @param tokens - The class names to remove.
|
|
1021
1022
|
*/
|
|
1022
|
-
|
|
1023
|
+
o(this, "removeClasses", (e) => {
|
|
1023
1024
|
this.element.classList.remove(...e);
|
|
1024
1025
|
});
|
|
1025
1026
|
/**
|
|
1026
1027
|
* Gets the classes of the element.
|
|
1027
1028
|
* @returns The classes of the element.
|
|
1028
1029
|
*/
|
|
1029
|
-
|
|
1030
|
+
o(this, "getClasses", () => Array.from(this.element.classList));
|
|
1030
1031
|
/**
|
|
1031
1032
|
* Adds an event listener to the element.
|
|
1032
1033
|
* @param event - The event to listen for.
|
|
@@ -1034,10 +1035,10 @@ class P {
|
|
|
1034
1035
|
* @param options - The options for the event listener.
|
|
1035
1036
|
* @returns A function to remove the event listener.
|
|
1036
1037
|
*/
|
|
1037
|
-
|
|
1038
|
-
const n = (
|
|
1039
|
-
return this.element.addEventListener(e, n, r), (
|
|
1040
|
-
|
|
1038
|
+
o(this, "on", (e, t, r) => {
|
|
1039
|
+
const n = (i) => t(i, this);
|
|
1040
|
+
return this.element.addEventListener(e, n, r), (i) => {
|
|
1041
|
+
i && this.element.removeEventListener(e, n, r);
|
|
1041
1042
|
};
|
|
1042
1043
|
});
|
|
1043
1044
|
/**
|
|
@@ -1045,28 +1046,28 @@ class P {
|
|
|
1045
1046
|
* @returns `true` if the context is a browser DOM context.
|
|
1046
1047
|
* @deprecated Use `isBrowser()` instead.
|
|
1047
1048
|
*/
|
|
1048
|
-
|
|
1049
|
+
o(this, "isBrowserDOM", () => !0);
|
|
1049
1050
|
/**
|
|
1050
1051
|
* Returns `true` if the context is a browser context.
|
|
1051
1052
|
* @returns `true` if the context is a browser context.
|
|
1052
1053
|
*/
|
|
1053
|
-
|
|
1054
|
+
o(this, "isBrowser", () => !0);
|
|
1054
1055
|
/**
|
|
1055
1056
|
* Returns `true` if the context is a headless DOM context.
|
|
1056
1057
|
* @returns `true` if the context is a headless DOM context.
|
|
1057
1058
|
*/
|
|
1058
|
-
|
|
1059
|
+
o(this, "isHeadlessDOM", () => !1);
|
|
1059
1060
|
/**
|
|
1060
1061
|
* Returns `true` if the context is a headless context.
|
|
1061
1062
|
* @returns `true` if the context is a headless context.
|
|
1062
1063
|
*/
|
|
1063
|
-
|
|
1064
|
+
o(this, "isHeadless", () => !1);
|
|
1064
1065
|
/**
|
|
1065
1066
|
* Sets the style of the element.
|
|
1066
1067
|
* @param name - The name of the style to set.
|
|
1067
1068
|
* @param value - The value of the style to set.
|
|
1068
1069
|
*/
|
|
1069
|
-
|
|
1070
|
+
o(this, "setStyle", (e, t) => {
|
|
1070
1071
|
this.element.style[e] = t;
|
|
1071
1072
|
});
|
|
1072
1073
|
/**
|
|
@@ -1074,12 +1075,12 @@ class P {
|
|
|
1074
1075
|
* @param name - The name of the style to get.
|
|
1075
1076
|
* @returns The value of the style.
|
|
1076
1077
|
*/
|
|
1077
|
-
|
|
1078
|
-
|
|
1078
|
+
o(this, "getStyle", (e) => this.element.style[e]);
|
|
1079
|
+
o(this, "makeAccessors", (e) => ({
|
|
1079
1080
|
get: We(e, this.element),
|
|
1080
1081
|
set: Be(e, this.element)
|
|
1081
1082
|
}));
|
|
1082
|
-
|
|
1083
|
+
o(this, "getWindow", () => this.document.defaultView);
|
|
1083
1084
|
this.document = e, this.element = t, this.reference = r, this.providers = n;
|
|
1084
1085
|
}
|
|
1085
1086
|
/**
|
|
@@ -1091,20 +1092,20 @@ class P {
|
|
|
1091
1092
|
* @returns A new `DOMContext` instance.
|
|
1092
1093
|
*/
|
|
1093
1094
|
static of(e, t, r) {
|
|
1094
|
-
return new
|
|
1095
|
+
return new L(e.ownerDocument, e, t, r);
|
|
1095
1096
|
}
|
|
1096
1097
|
}
|
|
1097
|
-
const Je = (s) => Symbol(s),
|
|
1098
|
+
const Je = (s) => Symbol(s), K = (s, e) => {
|
|
1098
1099
|
const t = s(e);
|
|
1099
1100
|
return (r = !0) => t(r);
|
|
1100
|
-
}, $t = (s, e, { doc: t, clear: r, disposeWithParent: n = !0, providers:
|
|
1101
|
+
}, $t = (s, e, { doc: t, clear: r, disposeWithParent: n = !0, providers: i = {} } = {}) => {
|
|
1101
1102
|
const l = typeof e == "string" ? (t ?? document).querySelector(e) : e;
|
|
1102
1103
|
if (l === null)
|
|
1103
1104
|
throw new Ge(
|
|
1104
1105
|
`Cannot find element by selector for render: ${e}`
|
|
1105
1106
|
);
|
|
1106
1107
|
r !== !1 && (t ?? l.ownerDocument) != null && l.nodeType === 1 && (l.innerHTML = "");
|
|
1107
|
-
const c = Ue(l), a = ge(l) ? void 0 : l, u =
|
|
1108
|
+
const c = Ue(l), a = ge(l) ? void 0 : l, u = L.of(c, a, i), h = K(s, u);
|
|
1108
1109
|
let g;
|
|
1109
1110
|
return n && (g = new MutationObserver((y) => {
|
|
1110
1111
|
var p;
|
|
@@ -1125,10 +1126,10 @@ const Je = (s) => Symbol(s), Q = (s, e) => {
|
|
|
1125
1126
|
} = {
|
|
1126
1127
|
selector: "body"
|
|
1127
1128
|
}) => {
|
|
1128
|
-
const n = T.toSignal(e).deriveProp(),
|
|
1129
|
+
const n = T.toSignal(e).deriveProp(), i = new Se(t, void 0), l = new D(i, void 0, { currentURL: n }, r);
|
|
1129
1130
|
return {
|
|
1130
|
-
clear:
|
|
1131
|
-
root:
|
|
1131
|
+
clear: K(s(), l),
|
|
1132
|
+
root: i,
|
|
1132
1133
|
currentURL: n
|
|
1133
1134
|
};
|
|
1134
1135
|
};
|
|
@@ -1137,14 +1138,14 @@ class Ge extends Error {
|
|
|
1137
1138
|
super(e);
|
|
1138
1139
|
}
|
|
1139
1140
|
}
|
|
1140
|
-
const ye = "data-tts-node",
|
|
1141
|
+
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";
|
|
1141
1142
|
class Nt {
|
|
1142
1143
|
constructor({
|
|
1143
1144
|
select: e,
|
|
1144
1145
|
getAttribute: t,
|
|
1145
1146
|
setAttribute: r,
|
|
1146
1147
|
getClass: n,
|
|
1147
|
-
setClass:
|
|
1148
|
+
setClass: i,
|
|
1148
1149
|
getStyles: l,
|
|
1149
1150
|
setStyles: c,
|
|
1150
1151
|
appendHTML: a,
|
|
@@ -1158,74 +1159,74 @@ class Nt {
|
|
|
1158
1159
|
* @param selector - The selector to select elements from. The supported selectors are CSS selectors whose complexity depends on the adapter implementation.
|
|
1159
1160
|
* @returns An array of elements.
|
|
1160
1161
|
*/
|
|
1161
|
-
|
|
1162
|
+
o(this, "select");
|
|
1162
1163
|
/**
|
|
1163
1164
|
* Gets the value of an attribute from an element.
|
|
1164
1165
|
* @param el - The element to get the attribute from.
|
|
1165
1166
|
* @param attr - The attribute to get the value from.
|
|
1166
1167
|
* @returns The value of the attribute or null if the attribute is not set.
|
|
1167
1168
|
*/
|
|
1168
|
-
|
|
1169
|
+
o(this, "getAttribute");
|
|
1169
1170
|
/**
|
|
1170
1171
|
* Sets the value of an attribute on an element.
|
|
1171
1172
|
* @param el - The element to set the attribute on.
|
|
1172
1173
|
* @param attr - The attribute to set the value of.
|
|
1173
1174
|
* @param value - The value to set the attribute to.
|
|
1174
1175
|
*/
|
|
1175
|
-
|
|
1176
|
+
o(this, "setAttribute");
|
|
1176
1177
|
/**
|
|
1177
1178
|
* Gets the class of an element.
|
|
1178
1179
|
* @param el - The element to get the class from.
|
|
1179
1180
|
* @returns The class of the element or an empty string if the class is not set.
|
|
1180
1181
|
*/
|
|
1181
|
-
|
|
1182
|
+
o(this, "getClass");
|
|
1182
1183
|
/**
|
|
1183
1184
|
* Sets the class of an element.
|
|
1184
1185
|
* @param el - The element to set the class on.
|
|
1185
1186
|
* @param cls - The class to set.
|
|
1186
1187
|
*/
|
|
1187
|
-
|
|
1188
|
+
o(this, "setClass");
|
|
1188
1189
|
/**
|
|
1189
1190
|
* Gets the styles of an element.
|
|
1190
1191
|
* @param el - The element to get the styles from.
|
|
1191
1192
|
* @returns The styles of the element.
|
|
1192
1193
|
*/
|
|
1193
|
-
|
|
1194
|
+
o(this, "getStyles");
|
|
1194
1195
|
/**
|
|
1195
1196
|
* Sets the styles of an element.
|
|
1196
1197
|
* @param el - The element to set the styles on.
|
|
1197
1198
|
*/
|
|
1198
|
-
|
|
1199
|
+
o(this, "setStyles");
|
|
1199
1200
|
/**
|
|
1200
1201
|
* Appends HTML to an element.
|
|
1201
1202
|
* @param el - The element to append the HTML to.
|
|
1202
1203
|
* @param html - The HTML to append.
|
|
1203
1204
|
*/
|
|
1204
|
-
|
|
1205
|
+
o(this, "appendHTML");
|
|
1205
1206
|
/**
|
|
1206
1207
|
* Gets the inner HTML of an element.
|
|
1207
1208
|
* @param el - The element to get the inner HTML from.
|
|
1208
1209
|
* @returns The inner HTML of the element or an empty string if the inner HTML is not set.
|
|
1209
1210
|
*/
|
|
1210
|
-
|
|
1211
|
+
o(this, "getInnerHTML");
|
|
1211
1212
|
/**
|
|
1212
1213
|
* Sets the inner HTML of an element.
|
|
1213
1214
|
* @param el - The element to set the inner HTML on.
|
|
1214
1215
|
* @param html - The inner HTML to set.
|
|
1215
1216
|
*/
|
|
1216
|
-
|
|
1217
|
+
o(this, "setInnerHTML");
|
|
1217
1218
|
/**
|
|
1218
1219
|
* Gets the inner text of an element.
|
|
1219
1220
|
* @param el - The element to get the inner text from.
|
|
1220
1221
|
* @returns The inner text of the element or an empty string if the inner text is not set.
|
|
1221
1222
|
*/
|
|
1222
|
-
|
|
1223
|
+
o(this, "getInnerText");
|
|
1223
1224
|
/**
|
|
1224
1225
|
* Sets the inner text of an element.
|
|
1225
1226
|
* @param el - The element to set the inner text on.
|
|
1226
1227
|
* @param text - The inner text to set.
|
|
1227
1228
|
*/
|
|
1228
|
-
|
|
1229
|
+
o(this, "setInnerText");
|
|
1229
1230
|
/**
|
|
1230
1231
|
* Sets the content of the root element from a HeadlessPortal. Generally this will be the same instance that is
|
|
1231
1232
|
* returned by `runHeadless`.
|
|
@@ -1234,10 +1235,10 @@ class Nt {
|
|
|
1234
1235
|
* @param setPlaceholders - Whether to set placeholders for the content. This allows you to restore the original content
|
|
1235
1236
|
* when you render on the server and then hydrate on the client.
|
|
1236
1237
|
*/
|
|
1237
|
-
|
|
1238
|
+
o(this, "setFromRoot", (e, t) => {
|
|
1238
1239
|
e.getPortals().forEach((n) => {
|
|
1239
|
-
const
|
|
1240
|
-
for (const l of
|
|
1240
|
+
const i = typeof n.selector == "string" ? this.select(n.selector) : [n.selector];
|
|
1241
|
+
for (const l of i) {
|
|
1241
1242
|
if (l == null)
|
|
1242
1243
|
throw new Error(
|
|
1243
1244
|
`Cannot find element by selector for render: ${n.selector}`
|
|
@@ -1245,21 +1246,21 @@ class Nt {
|
|
|
1245
1246
|
if (n.hasChildren() && this.appendHTML(l, n.contentToHTML(t)), n.hasInnerHTML()) {
|
|
1246
1247
|
if (t) {
|
|
1247
1248
|
const c = this.getInnerHTML(l);
|
|
1248
|
-
c != null && this.setAttribute(l,
|
|
1249
|
+
c != null && this.setAttribute(l, B, c);
|
|
1249
1250
|
}
|
|
1250
1251
|
this.setInnerHTML(l, n.getInnerHTML());
|
|
1251
1252
|
}
|
|
1252
1253
|
if (n.hasInnerText()) {
|
|
1253
1254
|
if (t) {
|
|
1254
1255
|
const c = this.getInnerText(l);
|
|
1255
|
-
c != null && this.setAttribute(l,
|
|
1256
|
+
c != null && this.setAttribute(l, W, c);
|
|
1256
1257
|
}
|
|
1257
1258
|
this.setInnerText(l, n.getInnerText());
|
|
1258
1259
|
}
|
|
1259
1260
|
if (n.hasClasses()) {
|
|
1260
1261
|
if (t) {
|
|
1261
1262
|
const c = this.getClass(l);
|
|
1262
|
-
c != null && this.setAttribute(l,
|
|
1263
|
+
c != null && this.setAttribute(l, q, c);
|
|
1263
1264
|
}
|
|
1264
1265
|
this.setClass(l, n.getClasses().join(" "));
|
|
1265
1266
|
}
|
|
@@ -1268,7 +1269,7 @@ class Nt {
|
|
|
1268
1269
|
const c = this.getStyles(l);
|
|
1269
1270
|
Object.keys(c).length > 0 && this.setAttribute(
|
|
1270
1271
|
l,
|
|
1271
|
-
|
|
1272
|
+
F,
|
|
1272
1273
|
JSON.stringify(c)
|
|
1273
1274
|
);
|
|
1274
1275
|
}
|
|
@@ -1283,7 +1284,7 @@ class Nt {
|
|
|
1283
1284
|
h != null && a.push([u, h]);
|
|
1284
1285
|
}), a.length > 0 && this.setAttribute(
|
|
1285
1286
|
l,
|
|
1286
|
-
|
|
1287
|
+
U,
|
|
1287
1288
|
JSON.stringify(Object.fromEntries(a))
|
|
1288
1289
|
);
|
|
1289
1290
|
}
|
|
@@ -1294,83 +1295,83 @@ class Nt {
|
|
|
1294
1295
|
}
|
|
1295
1296
|
});
|
|
1296
1297
|
});
|
|
1297
|
-
this.select = e, this.getAttribute = t, this.setAttribute = r, this.getClass = n, this.setClass =
|
|
1298
|
+
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;
|
|
1298
1299
|
}
|
|
1299
1300
|
}
|
|
1300
1301
|
const Xe = () => {
|
|
1301
|
-
document.querySelectorAll(`[${ye}]`).forEach(
|
|
1302
|
+
document.querySelectorAll(`[${ye}]`).forEach(j);
|
|
1302
1303
|
}, Ye = (s) => {
|
|
1303
|
-
const e = s.getAttribute(
|
|
1304
|
-
s.removeAttribute(
|
|
1304
|
+
const e = s.getAttribute(q);
|
|
1305
|
+
s.removeAttribute(q), e != null && s.setAttribute("class", e);
|
|
1305
1306
|
}, ze = () => {
|
|
1306
|
-
document.querySelectorAll(`[${
|
|
1307
|
+
document.querySelectorAll(`[${q}]`).forEach((e) => Ye(e));
|
|
1307
1308
|
}, Qe = (s) => {
|
|
1308
|
-
const e = s.getAttribute(
|
|
1309
|
-
s.removeAttribute(
|
|
1309
|
+
const e = s.getAttribute(B);
|
|
1310
|
+
s.removeAttribute(B), e != null && (s.innerHTML = e);
|
|
1310
1311
|
}, Ze = () => {
|
|
1311
|
-
document.querySelectorAll(`[${
|
|
1312
|
+
document.querySelectorAll(`[${B}]`).forEach((e) => Qe(e));
|
|
1312
1313
|
}, Ke = (s) => {
|
|
1313
|
-
const e = s.getAttribute(
|
|
1314
|
-
s.removeAttribute(
|
|
1314
|
+
const e = s.getAttribute(W);
|
|
1315
|
+
s.removeAttribute(W), e != null && (s.innerText = e);
|
|
1315
1316
|
}, et = () => {
|
|
1316
|
-
document.querySelectorAll(`[${
|
|
1317
|
+
document.querySelectorAll(`[${W}]`).forEach((e) => Ke(e));
|
|
1317
1318
|
}, Te = (s) => JSON.parse(s.replace(/"/g, '"')), tt = (s) => {
|
|
1318
|
-
const e = s.getAttribute(
|
|
1319
|
-
if (s.removeAttribute(
|
|
1319
|
+
const e = s.getAttribute(F);
|
|
1320
|
+
if (s.removeAttribute(F), e != null) {
|
|
1320
1321
|
const t = Te(e);
|
|
1321
1322
|
Object.entries(t).forEach(([r, n]) => {
|
|
1322
1323
|
s.style.setProperty(r, n);
|
|
1323
1324
|
});
|
|
1324
1325
|
}
|
|
1325
1326
|
}, st = () => {
|
|
1326
|
-
document.querySelectorAll(`[${
|
|
1327
|
+
document.querySelectorAll(`[${F}]`).forEach((e) => tt(e));
|
|
1327
1328
|
}, rt = (s) => {
|
|
1328
|
-
const e = s.getAttribute(
|
|
1329
|
-
if (s.removeAttribute(
|
|
1329
|
+
const e = s.getAttribute(U);
|
|
1330
|
+
if (s.removeAttribute(U), e != null) {
|
|
1330
1331
|
const t = Te(e);
|
|
1331
1332
|
Object.entries(t).forEach(([r, n]) => {
|
|
1332
1333
|
n == null ? s.removeAttribute(r) : s.setAttribute(r, n);
|
|
1333
1334
|
});
|
|
1334
1335
|
}
|
|
1335
1336
|
}, nt = () => {
|
|
1336
|
-
document.querySelectorAll(`[${
|
|
1337
|
+
document.querySelectorAll(`[${U}]`).forEach((e) => rt(e));
|
|
1337
1338
|
}, It = () => {
|
|
1338
1339
|
Xe(), ze(), et(), Ze(), st(), nt();
|
|
1339
|
-
},
|
|
1340
|
+
}, A = Symbol("class"), _ = Symbol("style"), x = Symbol("handler"), be = () => Math.random().toString(36).substring(2, 15), it = (s) => s.replace(/<[^>]*>?/g, "");
|
|
1340
1341
|
class Ae {
|
|
1341
1342
|
constructor(e) {
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1343
|
+
o(this, "id", be());
|
|
1344
|
+
o(this, "properties", {});
|
|
1345
|
+
o(this, "children", []);
|
|
1346
|
+
o(this, "isElement", () => !0);
|
|
1347
|
+
o(this, "isText", () => !1);
|
|
1348
|
+
o(this, "getText", () => this.properties.innerText != null ? this.properties.innerText : this.properties.innerHTML != null ? it(this.properties.innerHTML) : this.children.map((e) => e.getText()).join(""));
|
|
1349
|
+
o(this, "removeChild", (e) => {
|
|
1349
1350
|
const t = this.children.indexOf(e);
|
|
1350
1351
|
t !== -1 && this.children.splice(t, 1);
|
|
1351
1352
|
});
|
|
1352
|
-
|
|
1353
|
+
o(this, "remove", () => {
|
|
1353
1354
|
if (this.parent != null)
|
|
1354
1355
|
this.parent.removeChild(this);
|
|
1355
1356
|
else
|
|
1356
1357
|
throw new Error("Parent is undefined");
|
|
1357
1358
|
});
|
|
1358
|
-
|
|
1359
|
+
o(this, "getPortals", () => {
|
|
1359
1360
|
const e = this.elements().flatMap((t) => t.isPortal() ? [t, ...t.getPortals()] : t.getPortals());
|
|
1360
1361
|
return this.isPortal() && e.unshift(this), e;
|
|
1361
1362
|
});
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1363
|
+
o(this, "elements", () => this.children.filter((e) => e.isElement()));
|
|
1364
|
+
o(this, "hasInnerHTML", () => this.properties.innerHTML != null);
|
|
1365
|
+
o(this, "getInnerHTML", () => this.properties.innerHTML ?? "");
|
|
1366
|
+
o(this, "getInnerText", () => this.properties.innerText ?? "");
|
|
1367
|
+
o(this, "hasInnerText", () => this.properties.innerText != null);
|
|
1368
|
+
o(this, "hasChildren", () => this.children.length > 0);
|
|
1369
|
+
o(this, "hasClasses", () => this.properties[A] != null);
|
|
1370
|
+
o(this, "hasStyles", () => this.properties[_] != null);
|
|
1371
|
+
o(this, "hasAttributes", () => Object.keys(this.properties).length > 0);
|
|
1372
|
+
o(this, "hasHandlers", () => this.properties[x] != null);
|
|
1373
|
+
o(this, "hasRenderableProperties", () => this.hasClasses() || this.hasAttributes() || this.hasStyles());
|
|
1374
|
+
o(this, "getById", (e) => {
|
|
1374
1375
|
if (this.properties.id === e)
|
|
1375
1376
|
return this;
|
|
1376
1377
|
for (const t of this.elements()) {
|
|
@@ -1379,61 +1380,61 @@ class Ae {
|
|
|
1379
1380
|
return r;
|
|
1380
1381
|
}
|
|
1381
1382
|
});
|
|
1382
|
-
|
|
1383
|
-
((this.properties[
|
|
1383
|
+
o(this, "trigger", (e, t) => {
|
|
1384
|
+
((this.properties[x] ?? {})[e] ?? []).forEach((n) => n(t));
|
|
1384
1385
|
});
|
|
1385
|
-
|
|
1386
|
+
o(this, "click", () => {
|
|
1386
1387
|
this.trigger("click", {});
|
|
1387
1388
|
});
|
|
1388
|
-
|
|
1389
|
+
o(this, "on", (e, t, r, n) => {
|
|
1389
1390
|
var a;
|
|
1390
|
-
const
|
|
1391
|
+
const i = (a = this.properties)[x] ?? (a[x] = {}), l = n != null && n.once ? (u) => {
|
|
1391
1392
|
c(), t(u, r);
|
|
1392
1393
|
} : (u) => t(u, r);
|
|
1393
|
-
|
|
1394
|
+
i[e] = [...i[e] ?? [], l];
|
|
1394
1395
|
const c = () => {
|
|
1395
|
-
const u =
|
|
1396
|
-
h !== -1 && (u.splice(h, 1), u.length === 0 ? (delete
|
|
1396
|
+
const u = i[e] ?? [], h = u.indexOf(l);
|
|
1397
|
+
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));
|
|
1397
1398
|
};
|
|
1398
1399
|
return (n == null ? void 0 : n.signal) != null && n.signal.addEventListener("abort", c), c;
|
|
1399
1400
|
});
|
|
1400
|
-
|
|
1401
|
+
o(this, "addClasses", (e) => {
|
|
1401
1402
|
var r;
|
|
1402
1403
|
if (e.length === 0)
|
|
1403
1404
|
return;
|
|
1404
|
-
const t = (r = this.properties)[
|
|
1405
|
+
const t = (r = this.properties)[A] ?? (r[A] = []);
|
|
1405
1406
|
e.forEach((n) => {
|
|
1406
1407
|
t.includes(n) || t.push(n);
|
|
1407
1408
|
});
|
|
1408
1409
|
});
|
|
1409
|
-
|
|
1410
|
+
o(this, "removeClasses", (e) => {
|
|
1410
1411
|
var r;
|
|
1411
1412
|
if (e.length === 0)
|
|
1412
1413
|
return;
|
|
1413
|
-
const t = (r = this.properties)[
|
|
1414
|
+
const t = (r = this.properties)[A] ?? (r[A] = []);
|
|
1414
1415
|
e.forEach((n) => {
|
|
1415
|
-
const
|
|
1416
|
-
|
|
1417
|
-
}), t.length === 0 && delete this.properties[
|
|
1416
|
+
const i = t.indexOf(n);
|
|
1417
|
+
i !== -1 && t.splice(i, 1);
|
|
1418
|
+
}), t.length === 0 && delete this.properties[A];
|
|
1418
1419
|
});
|
|
1419
|
-
|
|
1420
|
-
|
|
1420
|
+
o(this, "getClasses", () => this.properties[A] ?? []);
|
|
1421
|
+
o(this, "getAttributes", () => Object.entries(this.properties).filter(
|
|
1421
1422
|
([e]) => !["innerText", "innerHTML"].includes(e)
|
|
1422
1423
|
));
|
|
1423
|
-
|
|
1424
|
-
(e) => e ===
|
|
1424
|
+
o(this, "getVisibleAttributes", () => Reflect.ownKeys(this.properties).flatMap(
|
|
1425
|
+
(e) => e === A ? [["class", this.getClasses()]] : e === _ ? [["style", this.getStyles()]] : typeof e == "string" ? [[e, String(this.properties[e])]] : []
|
|
1425
1426
|
));
|
|
1426
|
-
|
|
1427
|
+
o(this, "setStyle", (e, t) => {
|
|
1427
1428
|
var n;
|
|
1428
|
-
const r = (n = this.properties)[
|
|
1429
|
-
r[e] = t, t === "" && (delete r[e], Object.keys(r).length === 0 && delete this.properties[
|
|
1429
|
+
const r = (n = this.properties)[_] ?? (n[_] = {});
|
|
1430
|
+
r[e] = t, t === "" && (delete r[e], Object.keys(r).length === 0 && delete this.properties[_]);
|
|
1430
1431
|
});
|
|
1431
|
-
|
|
1432
|
+
o(this, "getStyle", (e) => {
|
|
1432
1433
|
var t;
|
|
1433
|
-
return ((t = this.properties[
|
|
1434
|
+
return ((t = this.properties[_]) == null ? void 0 : t[e]) ?? "";
|
|
1434
1435
|
});
|
|
1435
|
-
|
|
1436
|
-
|
|
1436
|
+
o(this, "getStyles", () => this.properties[_] ?? {});
|
|
1437
|
+
o(this, "makeAccessors", (e) => {
|
|
1437
1438
|
const t = this.properties;
|
|
1438
1439
|
return {
|
|
1439
1440
|
get: () => t[e],
|
|
@@ -1447,12 +1448,12 @@ const ot = (s) => s.replace(/"/g, """), lt = (s) => s.replace(/&/g, "&"
|
|
|
1447
1448
|
class ct extends Ae {
|
|
1448
1449
|
constructor(t, r, n) {
|
|
1449
1450
|
super(n);
|
|
1450
|
-
|
|
1451
|
-
|
|
1451
|
+
o(this, "isPortal", () => !1);
|
|
1452
|
+
o(this, "toHTML", (t = !1) => {
|
|
1452
1453
|
const r = this.children.map((a) => a.toHTML()).join(""), n = this.namespace ? ` xmlns="${this.namespace}"` : "";
|
|
1453
|
-
let
|
|
1454
|
-
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(" ")}"` : ut.has(a) ? ` ${a}` : a === "innerHTML" ? (
|
|
1455
|
-
return ht.has(this.tagName) && r === "" ? `<${this.tagName}${n}${l}${c} />` : `<${this.tagName}${n}${l}${c}>${
|
|
1454
|
+
let i = null;
|
|
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(" ")}"` : ut.has(a) ? ` ${a}` : a === "innerHTML" ? (i = u, "") : a === "innerText" ? (i = lt(u), "") : ` ${a}="${ot(u)}"`).join(""), c = t ? ` ${ye}` : "";
|
|
1456
|
+
return ht.has(this.tagName) && r === "" ? `<${this.tagName}${n}${l}${c} />` : `<${this.tagName}${n}${l}${c}>${i ?? r}</${this.tagName}>`;
|
|
1456
1457
|
});
|
|
1457
1458
|
this.tagName = t, this.namespace = r;
|
|
1458
1459
|
}
|
|
@@ -1460,60 +1461,60 @@ class ct extends Ae {
|
|
|
1460
1461
|
class Se extends Ae {
|
|
1461
1462
|
constructor(t, r) {
|
|
1462
1463
|
super(r);
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1464
|
+
o(this, "isPortal", () => !0);
|
|
1465
|
+
o(this, "toHTML", () => "");
|
|
1466
|
+
o(this, "contentToHTML", (t = !1) => this.children.map((r) => r.toHTML(t)).join(""));
|
|
1466
1467
|
this.selector = t;
|
|
1467
1468
|
}
|
|
1468
1469
|
}
|
|
1469
1470
|
class at {
|
|
1470
1471
|
constructor(e) {
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1472
|
+
o(this, "id", be());
|
|
1473
|
+
o(this, "isElement", () => !1);
|
|
1474
|
+
o(this, "isText", () => !0);
|
|
1475
|
+
o(this, "getText", () => this.text);
|
|
1476
|
+
o(this, "toHTML", () => this.text);
|
|
1476
1477
|
this.text = e;
|
|
1477
1478
|
}
|
|
1478
1479
|
}
|
|
1479
|
-
class
|
|
1480
|
+
class D {
|
|
1480
1481
|
constructor(e, t, r, n) {
|
|
1481
|
-
|
|
1482
|
+
o(this, "appendOrInsert", (e) => {
|
|
1482
1483
|
if (this.reference != null) {
|
|
1483
1484
|
const t = this.element.children.indexOf(this.reference);
|
|
1484
1485
|
this.element.children.splice(t, 0, e);
|
|
1485
1486
|
} else
|
|
1486
1487
|
this.element.children.push(e);
|
|
1487
1488
|
});
|
|
1488
|
-
|
|
1489
|
+
o(this, "makeChildElement", (e, t) => {
|
|
1489
1490
|
const r = new ct(e, t, this.element);
|
|
1490
|
-
return this.appendOrInsert(r), new
|
|
1491
|
+
return this.appendOrInsert(r), new D(
|
|
1491
1492
|
r,
|
|
1492
1493
|
void 0,
|
|
1493
1494
|
this.container,
|
|
1494
1495
|
this.providers
|
|
1495
1496
|
);
|
|
1496
1497
|
});
|
|
1497
|
-
|
|
1498
|
+
o(this, "makeChildText", (e) => {
|
|
1498
1499
|
const t = new at(e);
|
|
1499
|
-
return this.appendOrInsert(t), new
|
|
1500
|
+
return this.appendOrInsert(t), new D(
|
|
1500
1501
|
this.element,
|
|
1501
1502
|
t,
|
|
1502
1503
|
this.container,
|
|
1503
1504
|
this.providers
|
|
1504
1505
|
);
|
|
1505
1506
|
});
|
|
1506
|
-
|
|
1507
|
+
o(this, "setText", (e) => {
|
|
1507
1508
|
this.reference && this.reference.isText() && (this.reference.text = e);
|
|
1508
1509
|
});
|
|
1509
|
-
|
|
1510
|
+
o(this, "getText", () => {
|
|
1510
1511
|
var e;
|
|
1511
1512
|
return ((e = this.reference) == null ? void 0 : e.getText()) ?? this.element.getText();
|
|
1512
1513
|
});
|
|
1513
|
-
|
|
1514
|
-
|
|
1514
|
+
o(this, "makeRef", () => this.makeChildText(""));
|
|
1515
|
+
o(this, "makePortal", (e) => {
|
|
1515
1516
|
const t = new Se(e, this.element);
|
|
1516
|
-
return this.appendOrInsert(t), new
|
|
1517
|
+
return this.appendOrInsert(t), new D(
|
|
1517
1518
|
t,
|
|
1518
1519
|
void 0,
|
|
1519
1520
|
this.container,
|
|
@@ -1527,30 +1528,30 @@ class L {
|
|
|
1527
1528
|
* @param value - The provider to set for the given mark.
|
|
1528
1529
|
* @returns A new `DOMContext` instance with the specified provider.
|
|
1529
1530
|
*/
|
|
1530
|
-
|
|
1531
|
+
o(this, "setProvider", (e, t, r) => new D(this.element, this.reference, this.container, {
|
|
1531
1532
|
...this.providers,
|
|
1532
1533
|
[e]: [t, r]
|
|
1533
1534
|
}));
|
|
1534
|
-
|
|
1535
|
+
o(this, "getProvider", (e) => {
|
|
1535
1536
|
if (this.providers[e] === void 0)
|
|
1536
1537
|
throw new me(e);
|
|
1537
1538
|
const [t, r] = this.providers[e];
|
|
1538
1539
|
return { value: t, onUse: r };
|
|
1539
1540
|
});
|
|
1540
|
-
|
|
1541
|
+
o(this, "clear", (e) => {
|
|
1541
1542
|
e && (this.reference !== void 0 ? this.element.removeChild(this.reference) : this.element.remove());
|
|
1542
1543
|
});
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1544
|
+
o(this, "on", (e, t) => this.element.on(e, t, this));
|
|
1545
|
+
o(this, "addClasses", (e) => this.element.addClasses(e));
|
|
1546
|
+
o(this, "removeClasses", (e) => this.element.removeClasses(e));
|
|
1547
|
+
o(this, "getClasses", () => this.element.getClasses());
|
|
1548
|
+
o(this, "isBrowserDOM", () => !1);
|
|
1549
|
+
o(this, "isBrowser", () => !1);
|
|
1550
|
+
o(this, "isHeadlessDOM", () => !0);
|
|
1551
|
+
o(this, "isHeadless", () => !0);
|
|
1552
|
+
o(this, "setStyle", (e, t) => this.element.setStyle(e, t));
|
|
1553
|
+
o(this, "getStyle", (e) => this.element.getStyle(e));
|
|
1554
|
+
o(this, "makeAccessors", (e) => this.element.makeAccessors(e));
|
|
1554
1555
|
this.element = e, this.reference = t, this.container = r, this.providers = n;
|
|
1555
1556
|
}
|
|
1556
1557
|
}
|
|
@@ -1561,36 +1562,36 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1561
1562
|
"readonly",
|
|
1562
1563
|
"required",
|
|
1563
1564
|
"selected"
|
|
1564
|
-
]), ht = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]),
|
|
1565
|
+
]), ht = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), ve = (s) => (e) => e.makeChildText(s).clear, _e = (s) => (e) => {
|
|
1565
1566
|
const t = e.makeChildText(s.value), r = s.on(t.setText);
|
|
1566
1567
|
return (n) => {
|
|
1567
1568
|
r(), t.clear(n);
|
|
1568
1569
|
};
|
|
1569
|
-
}, Rt = (s) => d.is(s) ?
|
|
1570
|
+
}, Rt = (s) => d.is(s) ? _e(s) : ve(s), b = (...s) => (e) => {
|
|
1570
1571
|
const t = s.map((r) => f(r)(e));
|
|
1571
1572
|
return (r) => {
|
|
1572
1573
|
t.forEach((n) => n(r));
|
|
1573
1574
|
};
|
|
1574
|
-
},
|
|
1575
|
+
}, v = () => () => {
|
|
1575
1576
|
}, ft = (s) => (e) => (e.addClasses(s), (t) => {
|
|
1576
1577
|
t && e.removeClasses(s);
|
|
1577
1578
|
}), dt = (s) => (e) => {
|
|
1578
1579
|
let t = [];
|
|
1579
1580
|
const r = s.on((n) => {
|
|
1580
|
-
e.removeClasses(t), t = (n ?? "").split(" ").filter((
|
|
1581
|
+
e.removeClasses(t), t = (n ?? "").split(" ").filter((i) => i.length > 0), e.addClasses(t);
|
|
1581
1582
|
});
|
|
1582
1583
|
return (n) => {
|
|
1583
1584
|
r(), n && e.removeClasses(t), t.length = 0;
|
|
1584
1585
|
};
|
|
1585
|
-
},
|
|
1586
|
-
const { get: r, set: n } = t.makeAccessors(s),
|
|
1586
|
+
}, $ = (s, e) => (t) => {
|
|
1587
|
+
const { get: r, set: n } = t.makeAccessors(s), i = r();
|
|
1587
1588
|
return n(e), (l) => {
|
|
1588
|
-
l && n(
|
|
1589
|
+
l && n(i);
|
|
1589
1590
|
};
|
|
1590
|
-
},
|
|
1591
|
-
const { get: r, set: n } = t.makeAccessors(s),
|
|
1591
|
+
}, k = (s, e) => (t) => {
|
|
1592
|
+
const { get: r, set: n } = t.makeAccessors(s), i = r(), l = e.on(n);
|
|
1592
1593
|
return (c) => {
|
|
1593
|
-
l(), c && n(
|
|
1594
|
+
l(), c && n(i);
|
|
1594
1595
|
};
|
|
1595
1596
|
}, M = new Proxy(
|
|
1596
1597
|
{},
|
|
@@ -1608,10 +1609,10 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1608
1609
|
*/
|
|
1609
1610
|
get: (s, e) => e === "class" ? (t) => d.is(t) ? dt(t) : ft(
|
|
1610
1611
|
(t ?? "").split(" ").filter((r) => r.length > 0)
|
|
1611
|
-
) : (t) => d.is(t) ?
|
|
1612
|
+
) : (t) => d.is(t) ? k(
|
|
1612
1613
|
e,
|
|
1613
1614
|
t
|
|
1614
|
-
) :
|
|
1615
|
+
) : $(
|
|
1615
1616
|
e,
|
|
1616
1617
|
t
|
|
1617
1618
|
)
|
|
@@ -1627,10 +1628,10 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1627
1628
|
* @returns The renderable component for the specified attribute.
|
|
1628
1629
|
*
|
|
1629
1630
|
*/
|
|
1630
|
-
get: (s, e) => (t) => d.is(t) ?
|
|
1631
|
+
get: (s, e) => (t) => d.is(t) ? k(
|
|
1631
1632
|
`data-${e}`,
|
|
1632
1633
|
t
|
|
1633
|
-
) :
|
|
1634
|
+
) : $(`data-${e}`, t)
|
|
1634
1635
|
}
|
|
1635
1636
|
), jt = new Proxy(
|
|
1636
1637
|
{},
|
|
@@ -1643,10 +1644,10 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1643
1644
|
* @returns The renderable component for the specified attribute.
|
|
1644
1645
|
*
|
|
1645
1646
|
*/
|
|
1646
|
-
get: (s, e) => (t) => d.is(t) ?
|
|
1647
|
+
get: (s, e) => (t) => d.is(t) ? k(
|
|
1647
1648
|
`aria-${e}`,
|
|
1648
1649
|
t
|
|
1649
|
-
) :
|
|
1650
|
+
) : $(
|
|
1650
1651
|
`aria-${e}`,
|
|
1651
1652
|
t
|
|
1652
1653
|
)
|
|
@@ -1662,10 +1663,10 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1662
1663
|
* @returns The renderable component for the specified attribute.
|
|
1663
1664
|
*
|
|
1664
1665
|
*/
|
|
1665
|
-
get: (s, e) => (t) => d.is(t) ?
|
|
1666
|
+
get: (s, e) => (t) => d.is(t) ? k(
|
|
1666
1667
|
e,
|
|
1667
1668
|
t
|
|
1668
|
-
) :
|
|
1669
|
+
) : $(
|
|
1669
1670
|
e,
|
|
1670
1671
|
t
|
|
1671
1672
|
)
|
|
@@ -1680,35 +1681,35 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1680
1681
|
* @returns The renderable component for the specified attribute.
|
|
1681
1682
|
*
|
|
1682
1683
|
*/
|
|
1683
|
-
get: (s, e) => (t) => d.is(t) ?
|
|
1684
|
+
get: (s, e) => (t) => d.is(t) ? k(
|
|
1684
1685
|
e,
|
|
1685
1686
|
t
|
|
1686
|
-
) :
|
|
1687
|
+
) : $(
|
|
1687
1688
|
e,
|
|
1688
1689
|
t
|
|
1689
1690
|
)
|
|
1690
1691
|
}
|
|
1691
1692
|
), f = (s) => {
|
|
1692
1693
|
if (s == null)
|
|
1693
|
-
return
|
|
1694
|
+
return v;
|
|
1694
1695
|
if (Array.isArray(s))
|
|
1695
|
-
return
|
|
1696
|
+
return b(...s.map(f));
|
|
1696
1697
|
if (typeof s == "string")
|
|
1697
|
-
return
|
|
1698
|
+
return ve(s);
|
|
1698
1699
|
if (d.is(s))
|
|
1699
|
-
return
|
|
1700
|
+
return _e(s);
|
|
1700
1701
|
if (typeof s == "function")
|
|
1701
1702
|
return s;
|
|
1702
1703
|
throw new Error(`Unknown type: '${typeof s}' for child: ${s}`);
|
|
1703
|
-
},
|
|
1704
|
-
const r = t.makeChildElement(s, void 0), n = e.map((
|
|
1705
|
-
return (
|
|
1706
|
-
n.forEach((l) => l(!1)), r.clear(
|
|
1704
|
+
}, we = (s, ...e) => (t) => {
|
|
1705
|
+
const r = t.makeChildElement(s, void 0), n = e.map((i) => f(i)(r));
|
|
1706
|
+
return (i) => {
|
|
1707
|
+
n.forEach((l) => l(!1)), r.clear(i);
|
|
1707
1708
|
};
|
|
1708
|
-
},
|
|
1709
|
-
const n = r.makeChildElement(s, e),
|
|
1709
|
+
}, Ee = (s, e, ...t) => (r) => {
|
|
1710
|
+
const n = r.makeChildElement(s, e), i = t.map((l) => f(l)(n));
|
|
1710
1711
|
return (l) => {
|
|
1711
|
-
|
|
1712
|
+
i.forEach((c) => c(!1)), n.clear(l);
|
|
1712
1713
|
};
|
|
1713
1714
|
}, Bt = new Proxy(
|
|
1714
1715
|
{},
|
|
@@ -1718,7 +1719,7 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1718
1719
|
* @param tagName - The HTML tag name.
|
|
1719
1720
|
* @returns A renderable function that creates and appends the HTML element to the DOM.
|
|
1720
1721
|
*/
|
|
1721
|
-
get: (s, e) => (...t) =>
|
|
1722
|
+
get: (s, e) => (...t) => we(e, t.flatMap(f))
|
|
1722
1723
|
}
|
|
1723
1724
|
), Wt = new Proxy(
|
|
1724
1725
|
{},
|
|
@@ -1728,7 +1729,7 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1728
1729
|
* @param type - The input type name.
|
|
1729
1730
|
* @returns A renderable function that creates and appends the HTMLInput element to the DOM.
|
|
1730
1731
|
*/
|
|
1731
|
-
get: (s, e) => (...t) =>
|
|
1732
|
+
get: (s, e) => (...t) => we("input", M.type(e), ...t)
|
|
1732
1733
|
}
|
|
1733
1734
|
), pt = "http://www.w3.org/2000/svg", Ut = new Proxy(
|
|
1734
1735
|
{},
|
|
@@ -1738,7 +1739,7 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1738
1739
|
* @param tagName - The SVG tag name.
|
|
1739
1740
|
* @returns A renderable function that creates and appends the SVG element to the DOM.
|
|
1740
1741
|
*/
|
|
1741
|
-
get: (s, e) => (...t) =>
|
|
1742
|
+
get: (s, e) => (...t) => Ee(e, pt, t.flatMap(f))
|
|
1742
1743
|
}
|
|
1743
1744
|
), gt = "http://www.w3.org/1998/Math/MathML", Jt = new Proxy(
|
|
1744
1745
|
{},
|
|
@@ -1748,15 +1749,15 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1748
1749
|
* @param tagName - The Math tag name.
|
|
1749
1750
|
* @returns A renderable function that creates and appends the Math element to the DOM.
|
|
1750
1751
|
*/
|
|
1751
|
-
get: (s, e) => (...t) =>
|
|
1752
|
+
get: (s, e) => (...t) => Ee(e, gt, t.flatMap(f))
|
|
1752
1753
|
}
|
|
1753
|
-
),
|
|
1754
|
+
), Ce = (s, e) => {
|
|
1754
1755
|
if (typeof e == "function")
|
|
1755
|
-
return
|
|
1756
|
-
const t = e.pending != null ? f(e.pending()) :
|
|
1757
|
-
return (
|
|
1756
|
+
return Ce(s, { then: e });
|
|
1757
|
+
const t = e.pending != null ? f(e.pending()) : v, r = e.then, n = e.error != null ? (i) => f(e.error(i)) : () => v;
|
|
1758
|
+
return (i) => {
|
|
1758
1759
|
let l = !0;
|
|
1759
|
-
const c = s(), a =
|
|
1760
|
+
const c = s(), a = i.makeRef();
|
|
1760
1761
|
let u = f(t)(a);
|
|
1761
1762
|
return c.then(
|
|
1762
1763
|
(h) => {
|
|
@@ -1769,14 +1770,14 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1769
1770
|
l = !1, u(h), a.clear(h);
|
|
1770
1771
|
};
|
|
1771
1772
|
};
|
|
1772
|
-
}, Gt = (s, e) =>
|
|
1773
|
+
}, Gt = (s, e) => Ce(() => s, e), xe = (s, e, t) => (r) => r.on(s, e, t), mt = (s) => xe("click", (e, t) => {
|
|
1773
1774
|
e.preventDefault();
|
|
1774
1775
|
const r = e.target;
|
|
1775
1776
|
setTimeout(() => {
|
|
1776
1777
|
const n = r.ownerDocument != null ? r == null ? void 0 : r.checked : void 0;
|
|
1777
1778
|
n != null && s(!n, t);
|
|
1778
1779
|
}, 0);
|
|
1779
|
-
}),
|
|
1780
|
+
}), X = new Proxy(
|
|
1780
1781
|
{},
|
|
1781
1782
|
{
|
|
1782
1783
|
/**
|
|
@@ -1818,12 +1819,12 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1818
1819
|
const t = e.target;
|
|
1819
1820
|
if (t.value === "")
|
|
1820
1821
|
return;
|
|
1821
|
-
const r = t.value.split("T"), n = r[0].split("-"),
|
|
1822
|
+
const r = t.value.split("T"), n = r[0].split("-"), i = new Date(
|
|
1822
1823
|
Number(n[0]),
|
|
1823
1824
|
Number(n[1]) - 1,
|
|
1824
1825
|
Number(n[2])
|
|
1825
1826
|
), l = r[1].split(":");
|
|
1826
|
-
|
|
1827
|
+
i.setHours(Number(l[0])), i.setMinutes(Number(l[1])), i.setSeconds(Number(l[2])), s(i);
|
|
1827
1828
|
}, Yt = (s) => (e) => {
|
|
1828
1829
|
const t = e.target;
|
|
1829
1830
|
if (t.value === "") {
|
|
@@ -1835,12 +1836,12 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1835
1836
|
s(null);
|
|
1836
1837
|
return;
|
|
1837
1838
|
}
|
|
1838
|
-
const n = r[0].split("-"),
|
|
1839
|
+
const n = r[0].split("-"), i = new Date(
|
|
1839
1840
|
Number(n[0]),
|
|
1840
1841
|
Number(n[1]) - 1,
|
|
1841
1842
|
Number(n[2])
|
|
1842
1843
|
), l = r[1].split(":");
|
|
1843
|
-
|
|
1844
|
+
i.setHours(Number(l[0] ?? 0)), i.setMinutes(Number(l[1] ?? 0)), i.setSeconds(Number(l[2] ?? 0)), s(i);
|
|
1844
1845
|
}, zt = (s) => (e) => {
|
|
1845
1846
|
const t = e.target;
|
|
1846
1847
|
s(t.checked);
|
|
@@ -1850,40 +1851,40 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1850
1851
|
e.stopPropagation(), s();
|
|
1851
1852
|
}, Kt = (s) => (e) => {
|
|
1852
1853
|
e.stopImmediatePropagation(), s();
|
|
1853
|
-
}, es = (s, e = "input") =>
|
|
1854
|
+
}, es = (s, e = "input") => b(M.valueAsDate(s), X[e](bt(s.set))), ts = (s, e = "input") => b(M.valueAsDate(s), X[e](At(s.set))), ss = (s, e = "input") => b(M.valueAsNumber(s), X[e](Tt(s.set))), rs = (s, e = "input") => b(M.value(s), X[e](yt(s.set))), ns = (s) => b(M.checked(s), mt(s.set)), Y = (s, e) => {
|
|
1854
1855
|
if (d.is(s))
|
|
1855
1856
|
return (r) => {
|
|
1856
1857
|
const n = r.makeRef();
|
|
1857
|
-
let
|
|
1858
|
+
let i, l;
|
|
1858
1859
|
const c = s.map((h) => Object.keys(h)[0]);
|
|
1859
1860
|
let a;
|
|
1860
1861
|
const u = c.on((h) => {
|
|
1861
1862
|
if (h !== a) {
|
|
1862
|
-
a = h, l == null || l.dispose(),
|
|
1863
|
+
a = h, l == null || l.dispose(), i == null || i(!0), l = s.map((y) => y[h]);
|
|
1863
1864
|
const g = e[h](l);
|
|
1864
|
-
|
|
1865
|
+
i = f(g)(n);
|
|
1865
1866
|
}
|
|
1866
1867
|
});
|
|
1867
1868
|
return (h) => {
|
|
1868
|
-
l == null || l.dispose(), u(), n.clear(h),
|
|
1869
|
+
l == null || l.dispose(), u(), n.clear(h), i == null || i(h);
|
|
1869
1870
|
};
|
|
1870
1871
|
};
|
|
1871
1872
|
const t = Object.keys(s)[0];
|
|
1872
|
-
return f(e[t](
|
|
1873
|
-
}, Pe = (s, e, t) =>
|
|
1873
|
+
return f(e[t](G(s[t])));
|
|
1874
|
+
}, Pe = (s, e, t) => Y(
|
|
1874
1875
|
T.map(s, (r) => ({ [r[e]]: r })),
|
|
1875
1876
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1876
1877
|
t
|
|
1877
1878
|
), is = (s, e) => Pe(s, "kind", e), os = (s, e) => {
|
|
1878
1879
|
const t = T.map(s, ([r, n]) => ({ [r]: n }));
|
|
1879
|
-
return
|
|
1880
|
-
}, ls = (s, e) => Pe(s, "type", e), St = (s, e) =>
|
|
1880
|
+
return Y(t, e);
|
|
1881
|
+
}, ls = (s, e) => Pe(s, "type", e), St = (s, e) => Y(
|
|
1881
1882
|
T.map(s, (t) => ({ [t]: !0 })),
|
|
1882
1883
|
e
|
|
1883
1884
|
), cs = (s, e = {}) => (t) => {
|
|
1884
1885
|
const r = (e == null ? void 0 : e.firstSeparator) ?? s, n = (e == null ? void 0 : e.lastSeparator) ?? s;
|
|
1885
1886
|
return St(
|
|
1886
|
-
t.map((
|
|
1887
|
+
t.map((i) => i.isFirst ? "first" : i.isLast ? "last" : "other"),
|
|
1887
1888
|
{
|
|
1888
1889
|
first: r,
|
|
1889
1890
|
last: n,
|
|
@@ -1891,37 +1892,37 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1891
1892
|
}
|
|
1892
1893
|
);
|
|
1893
1894
|
}, as = (s) => (e) => (e.appendOrInsert(s), (t) => {
|
|
1894
|
-
t &&
|
|
1895
|
-
}),
|
|
1895
|
+
t && j(s);
|
|
1896
|
+
}), vt = (s, e, t) => {
|
|
1896
1897
|
if (d.is(s)) {
|
|
1897
1898
|
const r = s;
|
|
1898
1899
|
return (n) => {
|
|
1899
|
-
const
|
|
1900
|
+
const i = n.makeRef();
|
|
1900
1901
|
let l = () => {
|
|
1901
1902
|
}, c = !1, a = null;
|
|
1902
1903
|
const u = r.on((h) => {
|
|
1903
|
-
h == null ? (l(!0), l = f((t == null ? void 0 : t()) ??
|
|
1904
|
-
|
|
1904
|
+
h == null ? (l(!0), l = f((t == null ? void 0 : t()) ?? v)(i), c = !1, a == null || a.dispose(), a = null) : (a == null ? a = E(h) : a.value = h, c || (l(!0), l = f(e(a))(
|
|
1905
|
+
i
|
|
1905
1906
|
), c = !0));
|
|
1906
1907
|
});
|
|
1907
1908
|
return (h) => {
|
|
1908
|
-
a == null || a.dispose(), u(), l == null || l(h),
|
|
1909
|
+
a == null || a.dispose(), u(), l == null || l(h), i.clear(h);
|
|
1909
1910
|
};
|
|
1910
1911
|
};
|
|
1911
1912
|
} else {
|
|
1912
1913
|
const r = s;
|
|
1913
1914
|
if (r == null) {
|
|
1914
1915
|
const n = t == null ? void 0 : t();
|
|
1915
|
-
return n != null ? f(n) :
|
|
1916
|
+
return n != null ? f(n) : v;
|
|
1916
1917
|
}
|
|
1917
|
-
return f(e(
|
|
1918
|
+
return f(e(G(r)));
|
|
1918
1919
|
}
|
|
1919
1920
|
}, us = (...s) => (e, t) => (r) => {
|
|
1920
1921
|
const n = r.makeRef();
|
|
1921
1922
|
if (s.some(
|
|
1922
1923
|
(p) => !d.is(p) && p == null
|
|
1923
1924
|
))
|
|
1924
|
-
return (t != null ? f(t == null ? void 0 : t()) :
|
|
1925
|
+
return (t != null ? f(t == null ? void 0 : t()) : v)(
|
|
1925
1926
|
n
|
|
1926
1927
|
);
|
|
1927
1928
|
const l = s.map(() => null), c = s.map(
|
|
@@ -1951,11 +1952,11 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1951
1952
|
});
|
|
1952
1953
|
});
|
|
1953
1954
|
return u.on((p) => {
|
|
1954
|
-
a == null || a(!0), a = null, p ? a = f(e(...l))(n) : a = f((t == null ? void 0 : t()) ??
|
|
1955
|
+
a == null || a(!0), a = null, p ? a = f(e(...l))(n) : a = f((t == null ? void 0 : t()) ?? v)(n);
|
|
1955
1956
|
}), (p) => {
|
|
1956
1957
|
l.forEach((m) => m == null ? void 0 : m.dispose()), u.dispose(), y.forEach((m) => m()), a == null || a(p), n.clear(p);
|
|
1957
1958
|
};
|
|
1958
|
-
},
|
|
1959
|
+
}, O = (...s) => (e) => (t) => s.forEach((r) => r(t, e)), Le = (s, e, t) => vt(
|
|
1959
1960
|
T.map(s, (r) => r ? !0 : null),
|
|
1960
1961
|
e,
|
|
1961
1962
|
t ?? void 0
|
|
@@ -1963,49 +1964,67 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1963
1964
|
T.map(s, (r) => !r),
|
|
1964
1965
|
e,
|
|
1965
1966
|
t
|
|
1966
|
-
), De = (s, e, t) =>
|
|
1967
|
-
|
|
1968
|
-
r
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
1967
|
+
), De = (s, e, t) => {
|
|
1968
|
+
if (t != null)
|
|
1969
|
+
return De(s, (r) => {
|
|
1970
|
+
const n = new Q(
|
|
1971
|
+
r.index,
|
|
1972
|
+
r.total.map((i) => i - 1)
|
|
1973
|
+
);
|
|
1974
|
+
return b(
|
|
1975
|
+
O(n.dispose, r.dispose),
|
|
1976
|
+
f(e(r)),
|
|
1977
|
+
Le(
|
|
1978
|
+
r.isLast,
|
|
1979
|
+
() => v,
|
|
1980
|
+
() => t(n)
|
|
1981
|
+
)
|
|
1982
|
+
);
|
|
1983
|
+
});
|
|
1984
|
+
if (d.is(s))
|
|
1985
|
+
return (r) => {
|
|
1986
|
+
const n = r.makeRef(), i = [], l = s.on((c) => {
|
|
1987
|
+
const a = i.splice(c);
|
|
1988
|
+
for (const u of a)
|
|
1989
|
+
u(!0);
|
|
1990
|
+
for (let u = i.length; u < c; u++) {
|
|
1991
|
+
const h = new Q(u, s);
|
|
1992
|
+
i.push(
|
|
1993
|
+
b(
|
|
1994
|
+
O(h.dispose),
|
|
1995
|
+
f(e(h))
|
|
1996
|
+
)(n)
|
|
1997
|
+
);
|
|
1998
|
+
}
|
|
1999
|
+
});
|
|
2000
|
+
return (c) => {
|
|
2001
|
+
l();
|
|
2002
|
+
for (const a of i)
|
|
2003
|
+
a(c);
|
|
2004
|
+
i.length = 0, n.clear(c);
|
|
2005
|
+
};
|
|
2006
|
+
};
|
|
2007
|
+
{
|
|
2008
|
+
const r = G(s);
|
|
2009
|
+
return b(
|
|
2010
|
+
...Array.from({ length: s }, (n, i) => i).map((n) => {
|
|
2011
|
+
const i = new Q(n, r);
|
|
2012
|
+
return b(
|
|
2013
|
+
O(i.dispose),
|
|
2014
|
+
f(e(i))
|
|
2015
|
+
);
|
|
2016
|
+
})
|
|
2017
|
+
);
|
|
2018
|
+
}
|
|
2019
|
+
}, fs = (s, e, t) => {
|
|
2020
|
+
const r = T.map(s, (i) => i.length), n = T.toSignal(s);
|
|
2002
2021
|
return De(
|
|
2003
2022
|
r,
|
|
2004
|
-
(
|
|
2005
|
-
const l = n.map((c) => c[
|
|
2006
|
-
return
|
|
2007
|
-
|
|
2008
|
-
f(e(l,
|
|
2023
|
+
(i) => {
|
|
2024
|
+
const l = n.map((c) => c[i.index]);
|
|
2025
|
+
return b(
|
|
2026
|
+
O(l.dispose),
|
|
2027
|
+
f(e(l, i))
|
|
2009
2028
|
);
|
|
2010
2029
|
},
|
|
2011
2030
|
t
|
|
@@ -2016,18 +2035,18 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
2016
2035
|
return (r) => {
|
|
2017
2036
|
r = r.makeRef();
|
|
2018
2037
|
const n = t.map((c) => f(e(c)));
|
|
2019
|
-
let
|
|
2038
|
+
let i = () => {
|
|
2020
2039
|
};
|
|
2021
2040
|
const l = n.on((c) => {
|
|
2022
|
-
|
|
2041
|
+
i(!0), i = c(r);
|
|
2023
2042
|
});
|
|
2024
2043
|
return (c) => {
|
|
2025
|
-
l(),
|
|
2044
|
+
l(), i(c);
|
|
2026
2045
|
};
|
|
2027
2046
|
};
|
|
2028
2047
|
}
|
|
2029
2048
|
return f(e(s));
|
|
2030
|
-
}, ps = (s, e, t = () =>
|
|
2049
|
+
}, ps = (s, e, t = () => v) => Y(
|
|
2031
2050
|
T.map(
|
|
2032
2051
|
s,
|
|
2033
2052
|
(r) => r.length > 0 ? { notEmpty: r } : { whenEmpty: null }
|
|
@@ -2038,33 +2057,33 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
2038
2057
|
}
|
|
2039
2058
|
), gs = (s, e) => (t) => {
|
|
2040
2059
|
const r = t.makePortal(s);
|
|
2041
|
-
return
|
|
2042
|
-
},
|
|
2060
|
+
return K(f(e), r);
|
|
2061
|
+
}, R = /* @__PURE__ */ new Map(), _t = (s) => ({
|
|
2043
2062
|
mark: Je(`Probe(${s.description})`),
|
|
2044
2063
|
create: ({ callback: e = () => {
|
|
2045
2064
|
}, timeout: t = 10 } = {}) => {
|
|
2046
2065
|
const r = (c) => {
|
|
2047
|
-
clearTimeout(n),
|
|
2066
|
+
clearTimeout(n), R.delete(s), e(c);
|
|
2048
2067
|
};
|
|
2049
|
-
if (
|
|
2068
|
+
if (R.has(s))
|
|
2050
2069
|
throw new Error(`Probe already exists: ${s.description}`);
|
|
2051
|
-
const n = setTimeout(() => r("timeout"), t),
|
|
2052
|
-
return
|
|
2070
|
+
const n = setTimeout(() => r("timeout"), t), i = { counter: 0, timeoutId: n };
|
|
2071
|
+
return R.set(s, i), {
|
|
2053
2072
|
value: () => {
|
|
2054
2073
|
clearTimeout(n);
|
|
2055
|
-
const c =
|
|
2074
|
+
const c = R.get(s);
|
|
2056
2075
|
c != null && --c.counter === 0 && r("resolved");
|
|
2057
2076
|
},
|
|
2058
2077
|
dispose: () => r("disposed"),
|
|
2059
|
-
onUse: () =>
|
|
2078
|
+
onUse: () => i.counter++
|
|
2060
2079
|
};
|
|
2061
2080
|
}
|
|
2062
|
-
}), ms =
|
|
2081
|
+
}), ms = _t(Symbol("GlobalProbe")), wt = (s, e) => (t) => {
|
|
2063
2082
|
const r = t.getStyle(s);
|
|
2064
2083
|
return t.setStyle(s, e), (n) => {
|
|
2065
2084
|
n && t.setStyle(s, r);
|
|
2066
2085
|
};
|
|
2067
|
-
},
|
|
2086
|
+
}, Et = (s, e) => (t) => {
|
|
2068
2087
|
const r = t.getStyle(s);
|
|
2069
2088
|
return e.on((n) => t.setStyle(s, n)), (n) => {
|
|
2070
2089
|
n && t.setStyle(s, r);
|
|
@@ -2080,9 +2099,9 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
2080
2099
|
* @returns The renderable component for the specified attribute.
|
|
2081
2100
|
*
|
|
2082
2101
|
*/
|
|
2083
|
-
get: (s, e) => (t) => d.is(t) ?
|
|
2102
|
+
get: (s, e) => (t) => d.is(t) ? Et(e, t) : wt(e, t)
|
|
2084
2103
|
}
|
|
2085
|
-
),
|
|
2104
|
+
), Ct = (s) => (e) => {
|
|
2086
2105
|
if (e.isBrowser()) {
|
|
2087
2106
|
const t = s(e);
|
|
2088
2107
|
if (t != null)
|
|
@@ -2094,7 +2113,7 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
2094
2113
|
const t = s(e);
|
|
2095
2114
|
return t == null ? () => {
|
|
2096
2115
|
} : f(t)(e);
|
|
2097
|
-
}, bs = (s) =>
|
|
2116
|
+
}, bs = (s) => Ct((e) => s(e.element)), As = (s) => (e) => {
|
|
2098
2117
|
if (e.isHeadlessDOM()) {
|
|
2099
2118
|
const t = s(e);
|
|
2100
2119
|
if (t)
|
|
@@ -2102,7 +2121,7 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
2102
2121
|
}
|
|
2103
2122
|
return () => {
|
|
2104
2123
|
};
|
|
2105
|
-
},
|
|
2124
|
+
}, ee = (s) => (e) => {
|
|
2106
2125
|
let t = e;
|
|
2107
2126
|
function r() {
|
|
2108
2127
|
return t;
|
|
@@ -2110,22 +2129,22 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
2110
2129
|
function n(c) {
|
|
2111
2130
|
t = c;
|
|
2112
2131
|
}
|
|
2113
|
-
const
|
|
2132
|
+
const i = [], l = s({
|
|
2114
2133
|
use: ({ mark: c }) => {
|
|
2115
2134
|
const { value: a, onUse: u } = r().getProvider(c);
|
|
2116
2135
|
return u == null || u(), a;
|
|
2117
2136
|
},
|
|
2118
2137
|
set: ({ mark: c, create: a }, u) => {
|
|
2119
2138
|
const { value: h, dispose: g, onUse: y } = a(u, r());
|
|
2120
|
-
|
|
2139
|
+
i.push(g), n(r().setProvider(c, h, y));
|
|
2121
2140
|
}
|
|
2122
2141
|
});
|
|
2123
2142
|
return l == null ? () => {
|
|
2124
|
-
} :
|
|
2143
|
+
} : b(
|
|
2125
2144
|
f(l),
|
|
2126
|
-
|
|
2145
|
+
O(() => i.forEach((c) => c()))
|
|
2127
2146
|
)(r());
|
|
2128
|
-
}, Ss = (s, e, t) =>
|
|
2147
|
+
}, Ss = (s, e, t) => ee(({ set: r }) => (r(s, e), t())), vs = (s, e) => ee(({ use: t }) => e(t(s))), _s = (...s) => (e) => ee(({ use: t }) => {
|
|
2129
2148
|
const r = s.map(t);
|
|
2130
2149
|
return e(...r);
|
|
2131
2150
|
});
|
|
@@ -2136,22 +2155,22 @@ export {
|
|
|
2136
2155
|
ts as BindDateTime,
|
|
2137
2156
|
ss as BindNumber,
|
|
2138
2157
|
rs as BindText,
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2158
|
+
L as BrowserContext,
|
|
2159
|
+
q as CLASS_PLACEHOLDER_ATTR,
|
|
2160
|
+
P as Computed,
|
|
2142
2161
|
cs as Conjunction,
|
|
2143
2162
|
as as DOMNode,
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2163
|
+
we as El,
|
|
2164
|
+
Ee as ElNS,
|
|
2165
|
+
Q as ElementPosition,
|
|
2166
|
+
v as Empty,
|
|
2167
|
+
vt as Ensure,
|
|
2149
2168
|
us as EnsureAll,
|
|
2150
2169
|
fs as ForEach,
|
|
2151
|
-
|
|
2170
|
+
b as Fragment,
|
|
2152
2171
|
ms as GlobalProbe,
|
|
2153
2172
|
Nt as HeadlessAdapter,
|
|
2154
|
-
|
|
2173
|
+
D as HeadlessContext,
|
|
2155
2174
|
ct as HeadlessElement,
|
|
2156
2175
|
Se as HeadlessPortal,
|
|
2157
2176
|
at as HeadlessText,
|
|
@@ -2159,45 +2178,45 @@ export {
|
|
|
2159
2178
|
ce as MemoryStore,
|
|
2160
2179
|
ps as NotEmpty,
|
|
2161
2180
|
mt as OnChecked,
|
|
2162
|
-
|
|
2163
|
-
|
|
2181
|
+
O as OnDispose,
|
|
2182
|
+
Y as OneOf,
|
|
2164
2183
|
Pe as OneOfField,
|
|
2165
2184
|
is as OneOfKind,
|
|
2166
2185
|
os as OneOfTuple,
|
|
2167
2186
|
ls as OneOfType,
|
|
2168
2187
|
St as OneOfValue,
|
|
2169
2188
|
gs as Portal,
|
|
2170
|
-
|
|
2189
|
+
V as Prop,
|
|
2171
2190
|
Ss as Provide,
|
|
2172
2191
|
me as ProviderNotFoundError,
|
|
2173
2192
|
Ge as RenderingError,
|
|
2174
2193
|
De as Repeat,
|
|
2175
2194
|
d as Signal,
|
|
2176
|
-
|
|
2195
|
+
Ce as Task,
|
|
2177
2196
|
Rt as TextNode,
|
|
2178
2197
|
hs as Unless,
|
|
2179
|
-
|
|
2180
|
-
|
|
2198
|
+
vs as Use,
|
|
2199
|
+
_s as UseMany,
|
|
2181
2200
|
T as Value,
|
|
2182
2201
|
Le as When,
|
|
2183
|
-
|
|
2202
|
+
Ct as WithBrowserCtx,
|
|
2184
2203
|
Ts as WithCtx,
|
|
2185
2204
|
bs as WithElement,
|
|
2186
2205
|
As as WithHeadlessCtx,
|
|
2187
|
-
|
|
2206
|
+
ee as WithProvider,
|
|
2188
2207
|
ye as _NODE_PLACEHOLDER_ATTR,
|
|
2189
2208
|
Ue as _getSelfOrParentElement,
|
|
2190
2209
|
ge as _isElement,
|
|
2191
2210
|
We as _makeGetter,
|
|
2192
2211
|
Be as _makeSetter,
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2212
|
+
j as _removeDOMNode,
|
|
2213
|
+
_e as _signalText,
|
|
2214
|
+
ve as _staticText,
|
|
2196
2215
|
Ot as animateSignal,
|
|
2197
2216
|
Fe as animateSignals,
|
|
2198
2217
|
jt as aria,
|
|
2199
2218
|
M as attr,
|
|
2200
|
-
|
|
2219
|
+
Z as computed,
|
|
2201
2220
|
qe as computedOf,
|
|
2202
2221
|
Ht as computedRecord,
|
|
2203
2222
|
Vt as dataAttr,
|
|
@@ -2223,19 +2242,19 @@ export {
|
|
|
2223
2242
|
ke as interpolateString,
|
|
2224
2243
|
Pt as joinSignals,
|
|
2225
2244
|
Dt as localStorageProp,
|
|
2226
|
-
|
|
2245
|
+
_t as makeProbe,
|
|
2227
2246
|
Je as makeProviderMark,
|
|
2228
2247
|
Jt as math,
|
|
2229
2248
|
Ft as mathAttr,
|
|
2230
|
-
|
|
2249
|
+
X as on,
|
|
2231
2250
|
E as prop,
|
|
2232
2251
|
$t as render,
|
|
2233
|
-
|
|
2252
|
+
K as renderWithContext,
|
|
2234
2253
|
f as renderableOfTNode,
|
|
2235
2254
|
It as restoreTempoPlaceholders,
|
|
2236
2255
|
kt as runHeadless,
|
|
2237
2256
|
Mt as sessionStorageProp,
|
|
2238
|
-
|
|
2257
|
+
G as signal,
|
|
2239
2258
|
ae as storedProp,
|
|
2240
2259
|
ys as style,
|
|
2241
2260
|
Ut as svg,
|