@tempots/dom 26.7.5 → 26.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +133 -2
- package/dom/browser-context.d.ts +4 -3
- package/dom/dom-context.d.ts +1 -1
- package/dom/headless-context.d.ts +3 -3
- package/index.cjs +1 -1
- package/index.js +359 -354
- package/package.json +1 -1
- package/renderable/portal.d.ts +1 -1
- package/renderable/render.d.ts +25 -8
package/index.js
CHANGED
|
@@ -3,17 +3,17 @@ var se = (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
|
|
6
|
+
var i = (s, e, t) => He(s, typeof e != "symbol" ? e + "" : e, t), re = (s, e, t) => e.has(s) || se("Cannot " + t);
|
|
7
7
|
var X = (s, e, t) => (re(s, e, "read from private field"), t ? t.call(s) : e.get(s)), ne = (s, e, t) => e.has(s) ? se("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), ie = (s, e, t, r) => (re(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
|
|
8
8
|
const Ne = (s, e, t) => s + (e - s) * t;
|
|
9
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
|
|
14
|
-
isNaN(
|
|
15
|
-
let c = e.charCodeAt(
|
|
16
|
-
isNaN(c) && (c = 97), n += String.fromCharCode(
|
|
12
|
+
for (let l = 0; l < r; l++) {
|
|
13
|
+
let o = s.charCodeAt(l);
|
|
14
|
+
isNaN(o) && (o = 97);
|
|
15
|
+
let c = e.charCodeAt(l);
|
|
16
|
+
isNaN(c) && (c = 97), n += String.fromCharCode(o + (c - o) * t);
|
|
17
17
|
}
|
|
18
18
|
return n;
|
|
19
19
|
}, ke = (s, e, t) => new Date(s.getTime() + (e.getTime() - s.getTime()) * t), Ie = (s, e) => e, Re = (s) => typeof s == "number" ? Ne : typeof s == "string" ? $e : s instanceof Date ? ke : Ie;
|
|
@@ -28,24 +28,24 @@ class Y {
|
|
|
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
|
ne(this, D);
|
|
48
|
-
|
|
48
|
+
i(this, "dispose", () => {
|
|
49
49
|
this.total.dispose();
|
|
50
50
|
});
|
|
51
51
|
this.index = e, this.total = t, this.counter = e + 1, this.isFirst = e === 0, this.isEven = e % 2 === 1, this.isOdd = e % 2 === 0;
|
|
@@ -71,33 +71,33 @@ const O = class O {
|
|
|
71
71
|
/**
|
|
72
72
|
* @internal
|
|
73
73
|
*/
|
|
74
|
-
|
|
74
|
+
i(this, "$__signal__", !0);
|
|
75
75
|
/**
|
|
76
76
|
* @internal
|
|
77
77
|
*/
|
|
78
|
-
|
|
78
|
+
i(this, "_value");
|
|
79
79
|
/**
|
|
80
80
|
* @internal
|
|
81
81
|
*/
|
|
82
|
-
|
|
82
|
+
i(this, "_derivatives", []);
|
|
83
83
|
/**
|
|
84
84
|
* @internal
|
|
85
85
|
*/
|
|
86
|
-
|
|
86
|
+
i(this, "_onValueListeners", []);
|
|
87
87
|
/**
|
|
88
88
|
* @internal
|
|
89
89
|
*/
|
|
90
|
-
|
|
90
|
+
i(this, "_onDisposeListeners", []);
|
|
91
91
|
/**
|
|
92
92
|
* Gets the current value of the signal.
|
|
93
93
|
* @returns The current value of the signal.
|
|
94
94
|
*/
|
|
95
|
-
|
|
95
|
+
i(this, "get", () => this._value);
|
|
96
96
|
/**
|
|
97
97
|
* Checks if the signal has any registered listeners.
|
|
98
98
|
* @returns `true` if the signal has listeners, `false` otherwise.
|
|
99
99
|
*/
|
|
100
|
-
|
|
100
|
+
i(this, "hasListeners", () => this._onValueListeners.length > 0);
|
|
101
101
|
/**
|
|
102
102
|
* Registers a listener function to be called whenever the value of the signal changes.
|
|
103
103
|
* The listener function will be immediately called with the current value of the signal.
|
|
@@ -106,10 +106,10 @@ const O = class O {
|
|
|
106
106
|
* @param listener - The listener function to be called when the value of the signal changes.
|
|
107
107
|
* @param options - Options for the listener.
|
|
108
108
|
*/
|
|
109
|
-
|
|
109
|
+
i(this, "on", (e, t = {}) => {
|
|
110
110
|
t.skipInitial || e(this.get(), void 0);
|
|
111
|
-
const r = t.once ? (
|
|
112
|
-
n(), e(
|
|
111
|
+
const r = t.once ? (l, o) => {
|
|
112
|
+
n(), e(l, o);
|
|
113
113
|
} : e;
|
|
114
114
|
this._onValueListeners.push(r);
|
|
115
115
|
const n = () => {
|
|
@@ -123,32 +123,32 @@ const O = class O {
|
|
|
123
123
|
/**
|
|
124
124
|
* @internal
|
|
125
125
|
*/
|
|
126
|
-
|
|
126
|
+
i(this, "_setAndNotify", (e, t) => {
|
|
127
127
|
if (this._disposed) return;
|
|
128
128
|
const r = this._value, n = this.equals(r, e);
|
|
129
|
-
n || (this._value = e), (t || !n) && this._onValueListeners.forEach((
|
|
129
|
+
n || (this._value = e), (t || !n) && this._onValueListeners.forEach((l) => l(e, r));
|
|
130
130
|
});
|
|
131
131
|
/**
|
|
132
132
|
* @internal
|
|
133
133
|
*/
|
|
134
|
-
|
|
134
|
+
i(this, "_disposed", !1);
|
|
135
135
|
/**
|
|
136
136
|
* Checks whether the signal is disposed.
|
|
137
137
|
* @returns True if the signal is disposed, false otherwise.
|
|
138
138
|
*/
|
|
139
|
-
|
|
139
|
+
i(this, "isDisposed", () => this._disposed);
|
|
140
140
|
/**
|
|
141
141
|
* Adds a listener function to be called when the object is disposed.
|
|
142
142
|
* @param listener - The listener function to be called when the object is disposed.
|
|
143
143
|
* @returns A function that can be called to remove the listener.
|
|
144
144
|
*/
|
|
145
|
-
|
|
145
|
+
i(this, "onDispose", (e) => {
|
|
146
146
|
this._onDisposeListeners.push(e);
|
|
147
147
|
});
|
|
148
148
|
/**
|
|
149
149
|
* Disposes the signal, releasing any resources associated with it.
|
|
150
150
|
*/
|
|
151
|
-
|
|
151
|
+
i(this, "dispose", () => {
|
|
152
152
|
this._disposed || (this._disposed = !0, this._onDisposeListeners.forEach((e) => e()), this._onDisposeListeners.length = 0, this._derivatives.length = 0);
|
|
153
153
|
});
|
|
154
154
|
/**
|
|
@@ -160,7 +160,7 @@ const O = class O {
|
|
|
160
160
|
* @param equals - Optional equality function to determine if two mapped values are equal.
|
|
161
161
|
* @returns - A new Computed instance with the mapped value.
|
|
162
162
|
*/
|
|
163
|
-
|
|
163
|
+
i(this, "map", (e, t = (r, n) => r === n) => {
|
|
164
164
|
const r = new x(() => {
|
|
165
165
|
try {
|
|
166
166
|
return e(this.get());
|
|
@@ -180,7 +180,7 @@ const O = class O {
|
|
|
180
180
|
* Defaults to a strict equality check (===).
|
|
181
181
|
* @returns A new Signal that emits the values of the resulting Signal.
|
|
182
182
|
*/
|
|
183
|
-
|
|
183
|
+
i(this, "flatMap", (e, t = (r, n) => r === n) => {
|
|
184
184
|
const r = new x(() => {
|
|
185
185
|
try {
|
|
186
186
|
return e(this.get()).get();
|
|
@@ -196,26 +196,26 @@ const O = class O {
|
|
|
196
196
|
* @param fn - The callback function to be invoked with the current value of the signal.
|
|
197
197
|
* @returns A new signal that emits the same value as the original signal and invokes the callback function.
|
|
198
198
|
*/
|
|
199
|
-
|
|
199
|
+
i(this, "tap", (e) => this.map((t) => (e(t), t)));
|
|
200
200
|
/**
|
|
201
201
|
* Returns a new Signal that emits the value at the specified key of the current value.
|
|
202
202
|
*
|
|
203
203
|
* @param key - The key of the value to retrieve.
|
|
204
204
|
* @returns A new Signal that emits the value at the specified key.
|
|
205
205
|
*/
|
|
206
|
-
|
|
206
|
+
i(this, "at", (e) => this.map((t) => t[e]));
|
|
207
207
|
/**
|
|
208
208
|
* @internal
|
|
209
209
|
*/
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
i(this, "_$");
|
|
211
|
+
i(this, "filter", (e, t) => {
|
|
212
212
|
let r = t ?? this.get();
|
|
213
213
|
const n = new x(() => {
|
|
214
214
|
try {
|
|
215
|
-
const
|
|
216
|
-
return r = e(
|
|
217
|
-
} catch (
|
|
218
|
-
throw console.error("Error in Signal.filter:",
|
|
215
|
+
const l = this.get();
|
|
216
|
+
return r = e(l) ? l : r;
|
|
217
|
+
} catch (l) {
|
|
218
|
+
throw console.error("Error in Signal.filter:", l), l;
|
|
219
219
|
}
|
|
220
220
|
}, this.equals);
|
|
221
221
|
return this.setDerivative(n), n;
|
|
@@ -230,17 +230,17 @@ const O = class O {
|
|
|
230
230
|
* @param equals - Optional equality function to determine if two values are equal.
|
|
231
231
|
* @returns - A new Computed object with the mapped and filtered values.
|
|
232
232
|
*/
|
|
233
|
-
|
|
233
|
+
i(this, "filterMap", (e, t, r = (n, l) => n === l) => {
|
|
234
234
|
let n = t;
|
|
235
|
-
const
|
|
235
|
+
const l = new x(() => {
|
|
236
236
|
try {
|
|
237
|
-
const
|
|
237
|
+
const o = this.get(), c = e(o);
|
|
238
238
|
return n = c ?? n;
|
|
239
|
-
} catch (
|
|
240
|
-
throw console.error("Error in Signal.filterMap:",
|
|
239
|
+
} catch (o) {
|
|
240
|
+
throw console.error("Error in Signal.filterMap:", o), o;
|
|
241
241
|
}
|
|
242
242
|
}, r);
|
|
243
|
-
return this.setDerivative(
|
|
243
|
+
return this.setDerivative(l), l;
|
|
244
244
|
});
|
|
245
245
|
/**
|
|
246
246
|
* Maps the values emitted by the signal to a new value asynchronously using the provided function.
|
|
@@ -255,25 +255,25 @@ const O = class O {
|
|
|
255
255
|
* @param equals - The equality function to compare the mapped values for equality.
|
|
256
256
|
* @returns A property that holds the mapped value and can be observed for changes.
|
|
257
257
|
*/
|
|
258
|
-
|
|
259
|
-
const
|
|
260
|
-
let
|
|
261
|
-
return
|
|
258
|
+
i(this, "mapAsync", (e, t, r, n = (l, o) => l === o) => {
|
|
259
|
+
const l = w(t, n);
|
|
260
|
+
let o = 0, c = new AbortController();
|
|
261
|
+
return l.onDispose(
|
|
262
262
|
this.on(async (a) => {
|
|
263
|
-
const u = ++
|
|
263
|
+
const u = ++o;
|
|
264
264
|
c.abort(), c = new AbortController();
|
|
265
265
|
try {
|
|
266
266
|
const h = await e(a, { abortSignal: c.signal });
|
|
267
|
-
u ===
|
|
267
|
+
u === o && l.set(h);
|
|
268
268
|
} catch (h) {
|
|
269
|
-
if (u ===
|
|
269
|
+
if (u === o)
|
|
270
270
|
if (r != null)
|
|
271
|
-
|
|
271
|
+
l.set(r(h));
|
|
272
272
|
else
|
|
273
273
|
throw h;
|
|
274
274
|
}
|
|
275
275
|
})
|
|
276
|
-
),
|
|
276
|
+
), l;
|
|
277
277
|
});
|
|
278
278
|
/**
|
|
279
279
|
* Maps the values of the signal using the provided function `fn`, and returns a new signal
|
|
@@ -285,14 +285,14 @@ const O = class O {
|
|
|
285
285
|
* @param alt - The alternative value to use when the mapped value is `undefined` or `null`.
|
|
286
286
|
* @returns A new signal containing the mapped values.
|
|
287
287
|
*/
|
|
288
|
-
|
|
288
|
+
i(this, "mapMaybe", (e, t) => this.map((r) => e(r) ?? t));
|
|
289
289
|
/**
|
|
290
290
|
* Feeds a property into the signal and sets up disposal behavior.
|
|
291
291
|
* @param prop - The property to feed into the signal.
|
|
292
292
|
* @param autoDisposeProp - Determines whether the property should be automatically disposed when the signal is disposed.
|
|
293
293
|
* @returns The input property.
|
|
294
294
|
*/
|
|
295
|
-
|
|
295
|
+
i(this, "feedProp", (e, t = !1) => {
|
|
296
296
|
const r = this.on(e.set);
|
|
297
297
|
return e.onDispose(r), t ? this.onDispose(e.dispose) : this.onDispose(r), e;
|
|
298
298
|
});
|
|
@@ -303,7 +303,7 @@ const O = class O {
|
|
|
303
303
|
* @param options.equals - A function that determines if two values are equal.
|
|
304
304
|
* @returns The derived property.
|
|
305
305
|
*/
|
|
306
|
-
|
|
306
|
+
i(this, "deriveProp", ({
|
|
307
307
|
autoDisposeProp: e = !0,
|
|
308
308
|
equals: t
|
|
309
309
|
} = {}) => this.feedProp(w(this.get(), t), e));
|
|
@@ -311,12 +311,12 @@ const O = class O {
|
|
|
311
311
|
* 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.
|
|
312
312
|
* @returns A new signal that emits the same values as the current signal.
|
|
313
313
|
*/
|
|
314
|
-
|
|
314
|
+
i(this, "derive", () => this.map((e) => e));
|
|
315
315
|
/**
|
|
316
316
|
* Returns a signal that emits the count of values received so far.
|
|
317
317
|
* @returns A signal that emits the count of values received so far.
|
|
318
318
|
*/
|
|
319
|
-
|
|
319
|
+
i(this, "count", () => {
|
|
320
320
|
let e = 0;
|
|
321
321
|
return this.map(() => ++e);
|
|
322
322
|
});
|
|
@@ -326,7 +326,7 @@ const O = class O {
|
|
|
326
326
|
* Additionally, when the computed value is disposed, it sets the signal as dirty.
|
|
327
327
|
* @param computed - The computed value to add as a derivative.
|
|
328
328
|
*/
|
|
329
|
-
|
|
329
|
+
i(this, "setDerivative", (e) => {
|
|
330
330
|
this._derivatives.push(e), e.onDispose(() => {
|
|
331
331
|
this._derivatives.splice(
|
|
332
332
|
this._derivatives.indexOf(e),
|
|
@@ -363,21 +363,21 @@ const O = class O {
|
|
|
363
363
|
* @param equals - A function to compare two values of type O for equality. Defaults to strict equality (===).
|
|
364
364
|
* @returns - A Signal that represents the result of the Promise.
|
|
365
365
|
*/
|
|
366
|
-
|
|
367
|
-
const
|
|
368
|
-
return e.then((
|
|
369
|
-
r != null ?
|
|
366
|
+
i(O, "ofPromise", (e, t, r, n = (l, o) => l === o) => {
|
|
367
|
+
const l = new O(t, n);
|
|
368
|
+
return e.then((o) => l._setAndNotify(o, !1)).catch((o) => {
|
|
369
|
+
r != null ? l._setAndNotify(r(o), !1) : console.error(
|
|
370
370
|
"Unhandled promise rejection in Signal.ofPromise:",
|
|
371
|
-
|
|
371
|
+
o
|
|
372
372
|
);
|
|
373
|
-
}),
|
|
373
|
+
}), l;
|
|
374
374
|
}), /**
|
|
375
375
|
* Checks if a value is a Signal.
|
|
376
376
|
*
|
|
377
377
|
* @param value - The value to check.
|
|
378
378
|
* @returns `true` if the value is a Signal, `false` otherwise.
|
|
379
379
|
*/
|
|
380
|
-
|
|
380
|
+
i(O, "is", (e) => (
|
|
381
381
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
382
382
|
e != null && e.$__signal__ === !0
|
|
383
383
|
));
|
|
@@ -394,36 +394,36 @@ class x extends d {
|
|
|
394
394
|
/**
|
|
395
395
|
* @internal
|
|
396
396
|
*/
|
|
397
|
-
|
|
397
|
+
i(this, "$__computed__", !0);
|
|
398
398
|
/**
|
|
399
399
|
* @internal
|
|
400
400
|
*/
|
|
401
|
-
|
|
401
|
+
i(this, "_isDirty", !1);
|
|
402
402
|
/**
|
|
403
403
|
* Marks the signal as dirty, indicating that its value has changed and needs to be recalculated.
|
|
404
404
|
* If the signal is already dirty or disposed, this method does nothing.
|
|
405
405
|
* It also marks all dependent signals as dirty and schedules a notification to update their values.
|
|
406
406
|
*/
|
|
407
|
-
|
|
407
|
+
i(this, "setDirty", () => {
|
|
408
408
|
this._isDirty || this._disposed || (this._isDirty = !0, this._derivatives.forEach((t) => t.setDirty()), this._scheduleNotify());
|
|
409
409
|
});
|
|
410
410
|
/**
|
|
411
411
|
* @internal
|
|
412
412
|
*/
|
|
413
|
-
|
|
413
|
+
i(this, "_scheduleCount", 0);
|
|
414
414
|
/**
|
|
415
415
|
* Schedules a notification to be executed asynchronously.
|
|
416
416
|
* If the signal is dirty, it will be updated and notified.
|
|
417
417
|
* @internal
|
|
418
418
|
*/
|
|
419
|
-
|
|
419
|
+
i(this, "_scheduleNotify", () => {
|
|
420
420
|
const t = ++this._scheduleCount;
|
|
421
421
|
Ve(() => {
|
|
422
422
|
this._scheduleCount !== t || this._disposed || this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn(), !1));
|
|
423
423
|
});
|
|
424
424
|
});
|
|
425
425
|
/** {@inheritDoc Signal.get} */
|
|
426
|
-
|
|
426
|
+
i(this, "get", () => (this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn(), !0)), this._value));
|
|
427
427
|
this._fn = t, this.setDirty();
|
|
428
428
|
}
|
|
429
429
|
/**
|
|
@@ -446,20 +446,20 @@ const W = class W extends d {
|
|
|
446
446
|
/**
|
|
447
447
|
* @internal
|
|
448
448
|
*/
|
|
449
|
-
|
|
449
|
+
i(this, "$__prop__", !0);
|
|
450
450
|
/**
|
|
451
451
|
* Changes the value of the property and notifies its listeners.
|
|
452
452
|
*
|
|
453
453
|
* @param value - The new value of the property.
|
|
454
454
|
*/
|
|
455
|
-
|
|
455
|
+
i(this, "set", (t) => {
|
|
456
456
|
this._setAndNotify(t, !1);
|
|
457
457
|
});
|
|
458
458
|
/**
|
|
459
459
|
* Updates the value of the signal by applying the provided function to the current value.
|
|
460
460
|
* @param fn - The function to apply to the current value.
|
|
461
461
|
*/
|
|
462
|
-
|
|
462
|
+
i(this, "update", (t) => {
|
|
463
463
|
this._setAndNotify(t(this.get()), !1);
|
|
464
464
|
});
|
|
465
465
|
/**
|
|
@@ -468,16 +468,16 @@ const W = class W extends d {
|
|
|
468
468
|
* @param effects - An array of effects to be executed after the state is updated.
|
|
469
469
|
* @returns A dispatch function that can be used to update the state and trigger the effects.
|
|
470
470
|
*/
|
|
471
|
-
|
|
471
|
+
i(this, "reducer", (t, ...r) => {
|
|
472
472
|
const n = this;
|
|
473
|
-
return function
|
|
473
|
+
return function l(o) {
|
|
474
474
|
const c = n.value;
|
|
475
|
-
n.update((a) => t(a,
|
|
475
|
+
n.update((a) => t(a, o)), !n.equals(c, n.value) && r.forEach(
|
|
476
476
|
(a) => a({
|
|
477
477
|
previousState: c,
|
|
478
478
|
state: n.value,
|
|
479
|
-
action:
|
|
480
|
-
dispatch:
|
|
479
|
+
action: o,
|
|
480
|
+
dispatch: l
|
|
481
481
|
})
|
|
482
482
|
);
|
|
483
483
|
};
|
|
@@ -493,9 +493,9 @@ const W = class W extends d {
|
|
|
493
493
|
* Defaults to a strict equality check (===).
|
|
494
494
|
* @returns A Prop object representing the isomorphism.
|
|
495
495
|
*/
|
|
496
|
-
|
|
497
|
-
const
|
|
498
|
-
return
|
|
496
|
+
i(this, "iso", (t, r, n = (l, o) => l === o) => {
|
|
497
|
+
const l = new W(t(this.get()), n);
|
|
498
|
+
return l.onDispose(this.on((o) => l.set(t(o)))), l.on((o) => this._setAndNotify(r(o), !1)), l;
|
|
499
499
|
});
|
|
500
500
|
/**
|
|
501
501
|
* Returns a `Prop` that represents the value at the specified key of the current value.
|
|
@@ -503,7 +503,7 @@ const W = class W extends d {
|
|
|
503
503
|
* @param key - The key of the value to access.
|
|
504
504
|
* @returns A `Prop` that represents the value at the specified key.
|
|
505
505
|
*/
|
|
506
|
-
|
|
506
|
+
i(this, "atProp", (t) => this.iso(
|
|
507
507
|
(r) => r[t],
|
|
508
508
|
(r) => ({ ...this.value, [t]: r })
|
|
509
509
|
));
|
|
@@ -523,7 +523,7 @@ const W = class W extends d {
|
|
|
523
523
|
* @param value - The value to check.
|
|
524
524
|
* @returns `true` if the value is a Prop, `false` otherwise.
|
|
525
525
|
*/
|
|
526
|
-
|
|
526
|
+
i(W, "is", (t) => (
|
|
527
527
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
528
528
|
t != null && t.$__prop__ === !0
|
|
529
529
|
));
|
|
@@ -533,19 +533,19 @@ const z = (s, e, t = (r, n) => r === n) => {
|
|
|
533
533
|
return e.forEach((n) => n.setDerivative(r)), r;
|
|
534
534
|
}, je = (s, e, t = {}) => {
|
|
535
535
|
let r = t.once ? () => {
|
|
536
|
-
|
|
536
|
+
l(), s();
|
|
537
537
|
} : s;
|
|
538
538
|
if (t.skipInitial) {
|
|
539
|
-
let
|
|
539
|
+
let o = !1;
|
|
540
540
|
const c = r;
|
|
541
541
|
r = () => {
|
|
542
|
-
|
|
542
|
+
o ? c() : o = !0;
|
|
543
543
|
};
|
|
544
544
|
}
|
|
545
|
-
const n = z(r, e),
|
|
546
|
-
n.dispose(), t.abortSignal != null && t.abortSignal.removeEventListener("abort",
|
|
545
|
+
const n = z(r, e), l = () => {
|
|
546
|
+
n.dispose(), t.abortSignal != null && t.abortSignal.removeEventListener("abort", l);
|
|
547
547
|
};
|
|
548
|
-
return t.abortSignal != null && t.abortSignal.addEventListener("abort",
|
|
548
|
+
return t.abortSignal != null && t.abortSignal.addEventListener("abort", l), l;
|
|
549
549
|
}, w = (s, e = (t, r) => t === r) => new I(s, e), U = (s, e = (t, r) => t === r) => new d(s, e), le = () => typeof window < "u" ? window : void 0, T = {
|
|
550
550
|
/**
|
|
551
551
|
* Maps a value or a Signal to a new value.
|
|
@@ -639,19 +639,19 @@ const z = (s, e, t = (r, n) => r === n) => {
|
|
|
639
639
|
};
|
|
640
640
|
class ce {
|
|
641
641
|
constructor() {
|
|
642
|
-
|
|
642
|
+
i(this, "_store", /* @__PURE__ */ new Map());
|
|
643
643
|
/**
|
|
644
644
|
* Retrieves the value associated with the specified key from the memory store.
|
|
645
645
|
* @param key - The key to retrieve the value for.
|
|
646
646
|
* @returns The value associated with the key, or `null` if the key is not found.
|
|
647
647
|
*/
|
|
648
|
-
|
|
648
|
+
i(this, "getItem", (e) => this._store.get(e) ?? null);
|
|
649
649
|
/**
|
|
650
650
|
* Sets the value associated with the specified key in the memory store.
|
|
651
651
|
* @param key - The key to set the value for.
|
|
652
652
|
* @param value - The value to set.
|
|
653
653
|
*/
|
|
654
|
-
|
|
654
|
+
i(this, "setItem", (e, t) => {
|
|
655
655
|
this._store.set(e, t);
|
|
656
656
|
});
|
|
657
657
|
}
|
|
@@ -662,12 +662,12 @@ const ae = ({
|
|
|
662
662
|
store: t,
|
|
663
663
|
serialize: r = JSON.stringify,
|
|
664
664
|
deserialize: n = JSON.parse,
|
|
665
|
-
equals:
|
|
666
|
-
onLoad:
|
|
665
|
+
equals: l = (c, a) => c === a,
|
|
666
|
+
onLoad: o = (c) => c
|
|
667
667
|
}) => {
|
|
668
668
|
const c = t.getItem(s), a = new I(
|
|
669
|
-
c != null ?
|
|
670
|
-
|
|
669
|
+
c != null ? o(n(c)) : typeof e == "function" ? e() : e,
|
|
670
|
+
l
|
|
671
671
|
);
|
|
672
672
|
return a.on((u) => {
|
|
673
673
|
t.setItem(s, r(u));
|
|
@@ -689,23 +689,23 @@ function oe(s) {
|
|
|
689
689
|
return typeof requestAnimationFrame == "function" ? requestAnimationFrame(s) : setTimeout(s, 0);
|
|
690
690
|
}
|
|
691
691
|
const Fe = (s, e, t, r) => {
|
|
692
|
-
const n = (r == null ? void 0 : r.duration) ?? 300,
|
|
693
|
-
let c = r == null ? void 0 : r.interpolate, a = s, u = e(), h = performance.now(),
|
|
694
|
-
const p = new x(e,
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
}),
|
|
698
|
-
S.setDerivative(p), S.onDispose(
|
|
692
|
+
const n = (r == null ? void 0 : r.duration) ?? 300, l = (r == null ? void 0 : r.easing) ?? ((S) => S), o = (r == null ? void 0 : r.equals) ?? ((S, $) => S === $);
|
|
693
|
+
let c = r == null ? void 0 : r.interpolate, a = s, u = e(), h = performance.now(), g = null, y = !0;
|
|
694
|
+
const p = new x(e, o), m = w(s, o);
|
|
695
|
+
m.onDispose(() => {
|
|
696
|
+
g !== null && cancelAnimationFrame(g);
|
|
697
|
+
}), m.onDispose(p.dispose), t.forEach((S) => {
|
|
698
|
+
S.setDerivative(p), S.onDispose(m.dispose);
|
|
699
699
|
});
|
|
700
700
|
const C = (S) => {
|
|
701
|
-
u = S, h = performance.now(), a =
|
|
701
|
+
u = S, h = performance.now(), a = m.value, y && (y = !1, g = oe(ee));
|
|
702
702
|
}, ee = () => {
|
|
703
|
-
const $ = (performance.now() - h) / T.get(n), Me =
|
|
703
|
+
const $ = (performance.now() - h) / T.get(n), Me = l($);
|
|
704
704
|
c == null && (c = Re(a));
|
|
705
705
|
let te = c(a, u, Me);
|
|
706
|
-
$ >= 1 ? (y = !0, te = u) :
|
|
706
|
+
$ >= 1 ? (y = !0, te = u) : g = oe(ee), m.set(te);
|
|
707
707
|
};
|
|
708
|
-
return p.on(C),
|
|
708
|
+
return p.on(C), m;
|
|
709
709
|
}, Ot = (s, e) => {
|
|
710
710
|
const { initialValue: t, ...r } = e ?? {};
|
|
711
711
|
return Fe(
|
|
@@ -716,10 +716,10 @@ const Fe = (s, e, t, r) => {
|
|
|
716
716
|
);
|
|
717
717
|
}, Ht = (s, e) => {
|
|
718
718
|
const { signals: t, literals: r } = Object.entries(s).reduce(
|
|
719
|
-
({ signals:
|
|
719
|
+
({ signals: l, literals: o }, [c, a]) => (d.is(a) ? l.push([c, a]) : o[c] = a, { signals: l, literals: o }),
|
|
720
720
|
{ signals: [], literals: {} }
|
|
721
|
-
), n = t.map(([,
|
|
722
|
-
return z(() => (t.forEach(([
|
|
721
|
+
), n = t.map(([, l]) => l);
|
|
722
|
+
return z(() => (t.forEach(([l, o]) => r[l] = o.value), e(r)), n);
|
|
723
723
|
}, ue = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), he = /* @__PURE__ */ new Set(["selected"]), fe = /* @__PURE__ */ new Set([
|
|
724
724
|
"rowSpan",
|
|
725
725
|
"colSpan",
|
|
@@ -772,7 +772,7 @@ class L {
|
|
|
772
772
|
* @param namespace - The namespace URI to create the element in, or `undefined` to create a standard HTML element.
|
|
773
773
|
* @returns The newly created element.
|
|
774
774
|
*/
|
|
775
|
-
|
|
775
|
+
i(this, "createElement", (e, t) => t !== void 0 ? this.document.createElementNS(t, e) : this.document.createElement(e));
|
|
776
776
|
/**
|
|
777
777
|
* Creates a new DOM element (eg: HTML or SVG) with the specified tag name and namespace and appends it to the current element.
|
|
778
778
|
*
|
|
@@ -780,7 +780,7 @@ class L {
|
|
|
780
780
|
* @param namespace - The namespace URI to create the element in, or `undefined` to create a standard HTML element.
|
|
781
781
|
* @returns The newly created element.
|
|
782
782
|
*/
|
|
783
|
-
|
|
783
|
+
i(this, "makeChildElement", (e, t) => {
|
|
784
784
|
const r = this.createElement(e, t);
|
|
785
785
|
return this.appendOrInsert(r), this.withElement(r);
|
|
786
786
|
});
|
|
@@ -789,13 +789,13 @@ class L {
|
|
|
789
789
|
* @param text - The text content for the new text node.
|
|
790
790
|
* @returns A new `Text` node with the specified text content.
|
|
791
791
|
*/
|
|
792
|
-
|
|
792
|
+
i(this, "createText", (e) => this.document.createTextNode(e));
|
|
793
793
|
/**
|
|
794
794
|
* Creates a new text node with the specified text content and appends it to the current element.
|
|
795
795
|
* @param text - The text content for the new text node.
|
|
796
796
|
* @returns A new `DOMContext` with a reference to the new text node.
|
|
797
797
|
*/
|
|
798
|
-
|
|
798
|
+
i(this, "makeChildText", (e) => {
|
|
799
799
|
const t = this.createText(e);
|
|
800
800
|
return this.appendOrInsert(t), this.withReference(t);
|
|
801
801
|
});
|
|
@@ -803,14 +803,14 @@ class L {
|
|
|
803
803
|
* Sets the text content of the current element.
|
|
804
804
|
* @param text - The text content to set.
|
|
805
805
|
*/
|
|
806
|
-
|
|
806
|
+
i(this, "setText", (e) => {
|
|
807
807
|
this.reference.nodeValue = e;
|
|
808
808
|
});
|
|
809
809
|
/**
|
|
810
810
|
* Gets the text content of the current element or text node.
|
|
811
811
|
* @returns The text content of the current element or text node.
|
|
812
812
|
*/
|
|
813
|
-
|
|
813
|
+
i(this, "getText", () => {
|
|
814
814
|
var e;
|
|
815
815
|
return ((e = this.reference) == null ? void 0 : e.nodeValue) ?? this.element.textContent ?? "";
|
|
816
816
|
});
|
|
@@ -819,7 +819,7 @@ class L {
|
|
|
819
819
|
* The text node is appended or inserted to the current `DOMContext`.
|
|
820
820
|
* The new `DOMContext` with the reference is returned.
|
|
821
821
|
*/
|
|
822
|
-
|
|
822
|
+
i(this, "makeRef", () => {
|
|
823
823
|
const e = this.createText("");
|
|
824
824
|
return this.appendOrInsert(e), this.withReference(e);
|
|
825
825
|
});
|
|
@@ -828,7 +828,7 @@ class L {
|
|
|
828
828
|
*
|
|
829
829
|
* @param child - The child node to append or insert.
|
|
830
830
|
*/
|
|
831
|
-
|
|
831
|
+
i(this, "appendOrInsert", (e) => {
|
|
832
832
|
this.reference === void 0 ? this.element.appendChild(e) : this.element.insertBefore(e, this.reference);
|
|
833
833
|
});
|
|
834
834
|
/**
|
|
@@ -836,14 +836,14 @@ class L {
|
|
|
836
836
|
* @param element - The DOM element to use in the new `DOMContext` instance.
|
|
837
837
|
* @returns A new `DOMContext` instance with the provided `element`.
|
|
838
838
|
*/
|
|
839
|
-
|
|
839
|
+
i(this, "withElement", (e) => new L(this.document, e, void 0, this.providers));
|
|
840
840
|
/**
|
|
841
841
|
* Creates a new `DOMContext` instance with a reference to a DOM element selected by the provided `selector`.
|
|
842
842
|
* @param selector - The CSS selector for the target DOM element.
|
|
843
843
|
* @returns A new `DOMContext` instance with a reference to the selected DOM element.
|
|
844
844
|
*/
|
|
845
|
-
|
|
846
|
-
const t = this.document.querySelector(e);
|
|
845
|
+
i(this, "makePortal", (e) => {
|
|
846
|
+
const t = typeof e == "string" ? this.document.querySelector(e) : e;
|
|
847
847
|
if (t == null)
|
|
848
848
|
throw new Error(`Cannot find element by selector for portal: ${e}`);
|
|
849
849
|
return this.withElement(t);
|
|
@@ -854,7 +854,7 @@ class L {
|
|
|
854
854
|
* @param reference - The optional `Text` node to use as the reference for the new `DOMContext`.
|
|
855
855
|
* @returns A new `DOMContext` instance with the specified reference.
|
|
856
856
|
*/
|
|
857
|
-
|
|
857
|
+
i(this, "withReference", (e) => new L(this.document, this.element, e, this.providers));
|
|
858
858
|
/**
|
|
859
859
|
* Sets a provider for the given provider mark.
|
|
860
860
|
*
|
|
@@ -862,7 +862,7 @@ class L {
|
|
|
862
862
|
* @param value - The provider to set for the given mark.
|
|
863
863
|
* @returns A new `DOMContext` instance with the specified provider.
|
|
864
864
|
*/
|
|
865
|
-
|
|
865
|
+
i(this, "setProvider", (e, t, r) => new L(this.document, this.element, this.reference, {
|
|
866
866
|
...this.providers,
|
|
867
867
|
[e]: [t, r]
|
|
868
868
|
}));
|
|
@@ -873,33 +873,33 @@ class L {
|
|
|
873
873
|
* @returns The provider for the given mark.
|
|
874
874
|
* @throws Throws `ProviderNotFoundError` if the provider for the given mark is not found.
|
|
875
875
|
*/
|
|
876
|
-
|
|
876
|
+
i(this, "getProvider", (e) => {
|
|
877
877
|
if (this.providers[e] === void 0)
|
|
878
878
|
throw new me(e);
|
|
879
879
|
return this.providers[e];
|
|
880
880
|
});
|
|
881
|
-
|
|
881
|
+
i(this, "clear", (e) => {
|
|
882
882
|
e && (this.reference !== void 0 ? R(this.reference) : R(this.element));
|
|
883
883
|
});
|
|
884
884
|
/**
|
|
885
885
|
* Adds classes to the element.
|
|
886
886
|
* @param tokens - The class names to add.
|
|
887
887
|
*/
|
|
888
|
-
|
|
888
|
+
i(this, "addClasses", (e) => {
|
|
889
889
|
this.element.classList.add(...e);
|
|
890
890
|
});
|
|
891
891
|
/**
|
|
892
892
|
* Removes classes from the element.
|
|
893
893
|
* @param tokens - The class names to remove.
|
|
894
894
|
*/
|
|
895
|
-
|
|
895
|
+
i(this, "removeClasses", (e) => {
|
|
896
896
|
this.element.classList.remove(...e);
|
|
897
897
|
});
|
|
898
898
|
/**
|
|
899
899
|
* Gets the classes of the element.
|
|
900
900
|
* @returns The classes of the element.
|
|
901
901
|
*/
|
|
902
|
-
|
|
902
|
+
i(this, "getClasses", () => Array.from(this.element.classList));
|
|
903
903
|
/**
|
|
904
904
|
* Adds an event listener to the element.
|
|
905
905
|
* @param event - The event to listen for.
|
|
@@ -907,7 +907,7 @@ class L {
|
|
|
907
907
|
* @param options - The options for the event listener.
|
|
908
908
|
* @returns A function to remove the event listener.
|
|
909
909
|
*/
|
|
910
|
-
|
|
910
|
+
i(this, "on", (e, t, r) => (this.element.addEventListener(e, t, r), (n) => {
|
|
911
911
|
n && this.element.removeEventListener(
|
|
912
912
|
e,
|
|
913
913
|
t,
|
|
@@ -919,28 +919,28 @@ class L {
|
|
|
919
919
|
* @returns `true` if the context is a browser DOM context.
|
|
920
920
|
* @deprecated Use `isBrowser()` instead.
|
|
921
921
|
*/
|
|
922
|
-
|
|
922
|
+
i(this, "isBrowserDOM", () => !0);
|
|
923
923
|
/**
|
|
924
924
|
* Returns `true` if the context is a browser context.
|
|
925
925
|
* @returns `true` if the context is a browser context.
|
|
926
926
|
*/
|
|
927
|
-
|
|
927
|
+
i(this, "isBrowser", () => !0);
|
|
928
928
|
/**
|
|
929
929
|
* Returns `true` if the context is a headless DOM context.
|
|
930
930
|
* @returns `true` if the context is a headless DOM context.
|
|
931
931
|
*/
|
|
932
|
-
|
|
932
|
+
i(this, "isHeadlessDOM", () => !1);
|
|
933
933
|
/**
|
|
934
934
|
* Returns `true` if the context is a headless context.
|
|
935
935
|
* @returns `true` if the context is a headless context.
|
|
936
936
|
*/
|
|
937
|
-
|
|
937
|
+
i(this, "isHeadless", () => !1);
|
|
938
938
|
/**
|
|
939
939
|
* Sets the style of the element.
|
|
940
940
|
* @param name - The name of the style to set.
|
|
941
941
|
* @param value - The value of the style to set.
|
|
942
942
|
*/
|
|
943
|
-
|
|
943
|
+
i(this, "setStyle", (e, t) => {
|
|
944
944
|
this.element.style[e] = t;
|
|
945
945
|
});
|
|
946
946
|
/**
|
|
@@ -948,58 +948,62 @@ class L {
|
|
|
948
948
|
* @param name - The name of the style to get.
|
|
949
949
|
* @returns The value of the style.
|
|
950
950
|
*/
|
|
951
|
-
|
|
952
|
-
|
|
951
|
+
i(this, "getStyle", (e) => this.element.style[e]);
|
|
952
|
+
i(this, "makeAccessors", (e) => ({
|
|
953
953
|
get: We(e, this.element),
|
|
954
954
|
set: Be(e, this.element)
|
|
955
955
|
}));
|
|
956
|
-
|
|
956
|
+
i(this, "getWindow", () => this.document.defaultView);
|
|
957
957
|
this.document = e, this.element = t, this.reference = r, this.providers = n;
|
|
958
958
|
}
|
|
959
959
|
/**
|
|
960
960
|
* Creates a new `DOMContext` instance for the given `Element` and optional reference `Node`.
|
|
961
961
|
*
|
|
962
962
|
* @param element - The `HTMLElement` to create the `DOMContext` for.
|
|
963
|
-
* @param ref -
|
|
963
|
+
* @param ref - A reference `Node` to associate with the `DOMContext` or undefined .
|
|
964
|
+
* @param providers - The providers to associate with the `DOMContext`.
|
|
964
965
|
* @returns A new `DOMContext` instance.
|
|
965
966
|
*/
|
|
966
|
-
static of(e, t) {
|
|
967
|
-
return new L(e.ownerDocument, e, t,
|
|
967
|
+
static of(e, t, r) {
|
|
968
|
+
return new L(e.ownerDocument, e, t, r);
|
|
968
969
|
}
|
|
969
970
|
}
|
|
970
971
|
const Je = (s) => Symbol(s), Q = (s, e) => {
|
|
971
972
|
const t = s(e);
|
|
972
973
|
return (r = !0) => t(r);
|
|
973
|
-
}, Nt = (s, e, { doc: t, clear: r, disposeWithParent: n = !0 } = {}) => {
|
|
974
|
-
const
|
|
975
|
-
if (
|
|
974
|
+
}, Nt = (s, e, { doc: t, clear: r, disposeWithParent: n = !0, providers: l = {} } = {}) => {
|
|
975
|
+
const o = typeof e == "string" ? (t ?? document).querySelector(e) : e;
|
|
976
|
+
if (o === null)
|
|
976
977
|
throw new Ge(
|
|
977
978
|
`Cannot find element by selector for render: ${e}`
|
|
978
979
|
);
|
|
979
|
-
r !== !1 && (t ??
|
|
980
|
-
const
|
|
981
|
-
let
|
|
982
|
-
return n && (
|
|
983
|
-
var
|
|
984
|
-
(
|
|
985
|
-
|
|
980
|
+
r !== !1 && (t ?? o.ownerDocument) != null && o.nodeType === 1 && (o.innerHTML = "");
|
|
981
|
+
const c = Ue(o), a = ge(o) ? void 0 : o, u = L.of(c, a, l), h = Q(s, u);
|
|
982
|
+
let g;
|
|
983
|
+
return n && (g = new MutationObserver((y) => {
|
|
984
|
+
var p;
|
|
985
|
+
(p = y[0]) == null || p.removedNodes.forEach((m) => {
|
|
986
|
+
m === o && (g == null || g.disconnect(), h(o.nodeType !== Node.ELEMENT_NODE));
|
|
986
987
|
});
|
|
987
|
-
}),
|
|
988
|
+
}), g.observe(o.parentElement, {
|
|
988
989
|
childList: !0,
|
|
989
990
|
subtree: !1,
|
|
990
991
|
attributes: !1
|
|
991
992
|
})), () => {
|
|
992
|
-
|
|
993
|
+
g == null || g.disconnect(), h(!0);
|
|
993
994
|
};
|
|
994
995
|
}, $t = (s, {
|
|
995
996
|
startUrl: e = "https://example.com",
|
|
996
|
-
selector: t
|
|
997
|
-
|
|
998
|
-
|
|
997
|
+
selector: t,
|
|
998
|
+
providers: r = {}
|
|
999
|
+
} = {
|
|
1000
|
+
selector: "body"
|
|
1001
|
+
}) => {
|
|
1002
|
+
const n = T.toSignal(e).deriveProp(), l = new Se(t, void 0), o = new P(l, void 0, { currentURL: n }, r);
|
|
999
1003
|
return {
|
|
1000
|
-
clear: Q(s(),
|
|
1001
|
-
root:
|
|
1002
|
-
currentURL:
|
|
1004
|
+
clear: Q(s(), o),
|
|
1005
|
+
root: l,
|
|
1006
|
+
currentURL: n
|
|
1003
1007
|
};
|
|
1004
1008
|
};
|
|
1005
1009
|
class Ge extends Error {
|
|
@@ -1014,13 +1018,13 @@ class kt {
|
|
|
1014
1018
|
getAttribute: t,
|
|
1015
1019
|
setAttribute: r,
|
|
1016
1020
|
getClass: n,
|
|
1017
|
-
setClass:
|
|
1018
|
-
getStyles:
|
|
1021
|
+
setClass: l,
|
|
1022
|
+
getStyles: o,
|
|
1019
1023
|
setStyles: c,
|
|
1020
1024
|
appendHTML: a,
|
|
1021
1025
|
getInnerHTML: u,
|
|
1022
1026
|
setInnerHTML: h,
|
|
1023
|
-
getInnerText:
|
|
1027
|
+
getInnerText: g,
|
|
1024
1028
|
setInnerText: y
|
|
1025
1029
|
}) {
|
|
1026
1030
|
/**
|
|
@@ -1028,74 +1032,74 @@ class kt {
|
|
|
1028
1032
|
* @param selector - The selector to select elements from. The supported selectors are CSS selectors whose complexity depends on the adapter implementation.
|
|
1029
1033
|
* @returns An array of elements.
|
|
1030
1034
|
*/
|
|
1031
|
-
|
|
1035
|
+
i(this, "select");
|
|
1032
1036
|
/**
|
|
1033
1037
|
* Gets the value of an attribute from an element.
|
|
1034
1038
|
* @param el - The element to get the attribute from.
|
|
1035
1039
|
* @param attr - The attribute to get the value from.
|
|
1036
1040
|
* @returns The value of the attribute or null if the attribute is not set.
|
|
1037
1041
|
*/
|
|
1038
|
-
|
|
1042
|
+
i(this, "getAttribute");
|
|
1039
1043
|
/**
|
|
1040
1044
|
* Sets the value of an attribute on an element.
|
|
1041
1045
|
* @param el - The element to set the attribute on.
|
|
1042
1046
|
* @param attr - The attribute to set the value of.
|
|
1043
1047
|
* @param value - The value to set the attribute to.
|
|
1044
1048
|
*/
|
|
1045
|
-
|
|
1049
|
+
i(this, "setAttribute");
|
|
1046
1050
|
/**
|
|
1047
1051
|
* Gets the class of an element.
|
|
1048
1052
|
* @param el - The element to get the class from.
|
|
1049
1053
|
* @returns The class of the element or an empty string if the class is not set.
|
|
1050
1054
|
*/
|
|
1051
|
-
|
|
1055
|
+
i(this, "getClass");
|
|
1052
1056
|
/**
|
|
1053
1057
|
* Sets the class of an element.
|
|
1054
1058
|
* @param el - The element to set the class on.
|
|
1055
1059
|
* @param cls - The class to set.
|
|
1056
1060
|
*/
|
|
1057
|
-
|
|
1061
|
+
i(this, "setClass");
|
|
1058
1062
|
/**
|
|
1059
1063
|
* Gets the styles of an element.
|
|
1060
1064
|
* @param el - The element to get the styles from.
|
|
1061
1065
|
* @returns The styles of the element.
|
|
1062
1066
|
*/
|
|
1063
|
-
|
|
1067
|
+
i(this, "getStyles");
|
|
1064
1068
|
/**
|
|
1065
1069
|
* Sets the styles of an element.
|
|
1066
1070
|
* @param el - The element to set the styles on.
|
|
1067
1071
|
*/
|
|
1068
|
-
|
|
1072
|
+
i(this, "setStyles");
|
|
1069
1073
|
/**
|
|
1070
1074
|
* Appends HTML to an element.
|
|
1071
1075
|
* @param el - The element to append the HTML to.
|
|
1072
1076
|
* @param html - The HTML to append.
|
|
1073
1077
|
*/
|
|
1074
|
-
|
|
1078
|
+
i(this, "appendHTML");
|
|
1075
1079
|
/**
|
|
1076
1080
|
* Gets the inner HTML of an element.
|
|
1077
1081
|
* @param el - The element to get the inner HTML from.
|
|
1078
1082
|
* @returns The inner HTML of the element or an empty string if the inner HTML is not set.
|
|
1079
1083
|
*/
|
|
1080
|
-
|
|
1084
|
+
i(this, "getInnerHTML");
|
|
1081
1085
|
/**
|
|
1082
1086
|
* Sets the inner HTML of an element.
|
|
1083
1087
|
* @param el - The element to set the inner HTML on.
|
|
1084
1088
|
* @param html - The inner HTML to set.
|
|
1085
1089
|
*/
|
|
1086
|
-
|
|
1090
|
+
i(this, "setInnerHTML");
|
|
1087
1091
|
/**
|
|
1088
1092
|
* Gets the inner text of an element.
|
|
1089
1093
|
* @param el - The element to get the inner text from.
|
|
1090
1094
|
* @returns The inner text of the element or an empty string if the inner text is not set.
|
|
1091
1095
|
*/
|
|
1092
|
-
|
|
1096
|
+
i(this, "getInnerText");
|
|
1093
1097
|
/**
|
|
1094
1098
|
* Sets the inner text of an element.
|
|
1095
1099
|
* @param el - The element to set the inner text on.
|
|
1096
1100
|
* @param text - The inner text to set.
|
|
1097
1101
|
*/
|
|
1098
|
-
|
|
1102
|
+
i(this, "setInnerText");
|
|
1099
1103
|
/**
|
|
1100
1104
|
* Sets the content of the root element from a HeadlessPortal. Generally this will be the same instance that is
|
|
1101
1105
|
* returned by `runHeadless`.
|
|
@@ -1104,66 +1108,67 @@ class kt {
|
|
|
1104
1108
|
* @param setPlaceholders - Whether to set placeholders for the content. This allows you to restore the original content
|
|
1105
1109
|
* when you render on the server and then hydrate on the client.
|
|
1106
1110
|
*/
|
|
1107
|
-
|
|
1111
|
+
i(this, "setFromRoot", (e, t) => {
|
|
1108
1112
|
e.getPortals().forEach((n) => {
|
|
1109
|
-
|
|
1110
|
-
|
|
1113
|
+
const l = typeof n.selector == "string" ? this.select(n.selector) : [n.selector];
|
|
1114
|
+
for (const o of l) {
|
|
1115
|
+
if (o == null)
|
|
1111
1116
|
throw new Error(
|
|
1112
1117
|
`Cannot find element by selector for render: ${n.selector}`
|
|
1113
1118
|
);
|
|
1114
|
-
if (n.hasChildren() && this.appendHTML(
|
|
1119
|
+
if (n.hasChildren() && this.appendHTML(o, n.contentToHTML(t)), n.hasInnerHTML()) {
|
|
1115
1120
|
if (t) {
|
|
1116
|
-
const
|
|
1117
|
-
|
|
1121
|
+
const c = this.getInnerHTML(o);
|
|
1122
|
+
c != null && this.setAttribute(o, q, c);
|
|
1118
1123
|
}
|
|
1119
|
-
this.setInnerHTML(
|
|
1124
|
+
this.setInnerHTML(o, n.getInnerHTML());
|
|
1120
1125
|
}
|
|
1121
1126
|
if (n.hasInnerText()) {
|
|
1122
1127
|
if (t) {
|
|
1123
|
-
const
|
|
1124
|
-
|
|
1128
|
+
const c = this.getInnerText(o);
|
|
1129
|
+
c != null && this.setAttribute(o, F, c);
|
|
1125
1130
|
}
|
|
1126
|
-
this.setInnerText(
|
|
1131
|
+
this.setInnerText(o, n.getInnerText());
|
|
1127
1132
|
}
|
|
1128
1133
|
if (n.hasClasses()) {
|
|
1129
1134
|
if (t) {
|
|
1130
|
-
const
|
|
1131
|
-
|
|
1135
|
+
const c = this.getClass(o);
|
|
1136
|
+
c != null && this.setAttribute(o, V, c);
|
|
1132
1137
|
}
|
|
1133
|
-
this.setClass(
|
|
1138
|
+
this.setClass(o, n.getClasses().join(" "));
|
|
1134
1139
|
}
|
|
1135
1140
|
if (n.hasStyles()) {
|
|
1136
1141
|
if (t) {
|
|
1137
|
-
const
|
|
1138
|
-
Object.keys(
|
|
1139
|
-
|
|
1142
|
+
const c = this.getStyles(o);
|
|
1143
|
+
Object.keys(c).length > 0 && this.setAttribute(
|
|
1144
|
+
o,
|
|
1140
1145
|
j,
|
|
1141
|
-
JSON.stringify(
|
|
1146
|
+
JSON.stringify(c)
|
|
1142
1147
|
);
|
|
1143
1148
|
}
|
|
1144
|
-
this.setStyles(
|
|
1149
|
+
this.setStyles(o, n.getStyles());
|
|
1145
1150
|
}
|
|
1146
1151
|
if (n.hasAttributes()) {
|
|
1147
|
-
const
|
|
1152
|
+
const c = n.getAttributes();
|
|
1148
1153
|
if (t) {
|
|
1149
|
-
const
|
|
1150
|
-
|
|
1151
|
-
const
|
|
1152
|
-
|
|
1153
|
-
}),
|
|
1154
|
-
|
|
1154
|
+
const a = [];
|
|
1155
|
+
c.forEach(([u]) => {
|
|
1156
|
+
const h = this.getAttribute(o, u);
|
|
1157
|
+
h != null && a.push([u, h]);
|
|
1158
|
+
}), a.length > 0 && this.setAttribute(
|
|
1159
|
+
o,
|
|
1155
1160
|
B,
|
|
1156
|
-
JSON.stringify(Object.fromEntries(
|
|
1161
|
+
JSON.stringify(Object.fromEntries(a))
|
|
1157
1162
|
);
|
|
1158
1163
|
}
|
|
1159
|
-
|
|
1160
|
-
this.setAttribute(
|
|
1164
|
+
c.forEach(([a, u]) => {
|
|
1165
|
+
this.setAttribute(o, a, u);
|
|
1161
1166
|
});
|
|
1162
1167
|
}
|
|
1163
1168
|
}
|
|
1164
1169
|
});
|
|
1165
1170
|
});
|
|
1166
|
-
this.select = e, this.getAttribute = t, this.setAttribute = r, this.getClass = n, this.setClass =
|
|
1171
|
+
this.select = e, this.getAttribute = t, this.setAttribute = r, this.getClass = n, this.setClass = l, this.getStyles = o, this.setStyles = c, this.appendHTML = a, this.getInnerHTML = u, this.setInnerHTML = h, this.getInnerText = g, this.setInnerText = y;
|
|
1167
1172
|
}
|
|
1168
1173
|
}
|
|
1169
1174
|
const Xe = () => {
|
|
@@ -1208,38 +1213,38 @@ const Xe = () => {
|
|
|
1208
1213
|
}, b = Symbol("class"), E = Symbol("style"), v = Symbol("handler"), be = () => Math.random().toString(36).substring(2, 15), it = (s) => s.replace(/<[^>]*>?/g, "");
|
|
1209
1214
|
class Ae {
|
|
1210
1215
|
constructor(e) {
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1216
|
+
i(this, "id", be());
|
|
1217
|
+
i(this, "properties", {});
|
|
1218
|
+
i(this, "children", []);
|
|
1219
|
+
i(this, "isElement", () => !0);
|
|
1220
|
+
i(this, "isText", () => !1);
|
|
1221
|
+
i(this, "getText", () => this.properties.innerText != null ? this.properties.innerText : this.properties.innerHTML != null ? it(this.properties.innerHTML) : this.children.map((e) => e.getText()).join(""));
|
|
1222
|
+
i(this, "removeChild", (e) => {
|
|
1218
1223
|
const t = this.children.indexOf(e);
|
|
1219
1224
|
t !== -1 && this.children.splice(t, 1);
|
|
1220
1225
|
});
|
|
1221
|
-
|
|
1226
|
+
i(this, "remove", () => {
|
|
1222
1227
|
if (this.parent != null)
|
|
1223
1228
|
this.parent.removeChild(this);
|
|
1224
1229
|
else
|
|
1225
1230
|
throw new Error("Parent is undefined");
|
|
1226
1231
|
});
|
|
1227
|
-
|
|
1232
|
+
i(this, "getPortals", () => {
|
|
1228
1233
|
const e = this.elements().flatMap((t) => t.isPortal() ? [t, ...t.getPortals()] : t.getPortals());
|
|
1229
1234
|
return this.isPortal() && e.unshift(this), e;
|
|
1230
1235
|
});
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1236
|
+
i(this, "elements", () => this.children.filter((e) => e.isElement()));
|
|
1237
|
+
i(this, "hasInnerHTML", () => this.properties.innerHTML != null);
|
|
1238
|
+
i(this, "getInnerHTML", () => this.properties.innerHTML ?? "");
|
|
1239
|
+
i(this, "getInnerText", () => this.properties.innerText ?? "");
|
|
1240
|
+
i(this, "hasInnerText", () => this.properties.innerText != null);
|
|
1241
|
+
i(this, "hasChildren", () => this.children.length > 0);
|
|
1242
|
+
i(this, "hasClasses", () => this.properties[b] != null);
|
|
1243
|
+
i(this, "hasStyles", () => this.properties[E] != null);
|
|
1244
|
+
i(this, "hasAttributes", () => Object.keys(this.properties).length > 0);
|
|
1245
|
+
i(this, "hasHandlers", () => this.properties[v] != null);
|
|
1246
|
+
i(this, "hasRenderableProperties", () => this.hasClasses() || this.hasAttributes() || this.hasStyles());
|
|
1247
|
+
i(this, "getById", (e) => {
|
|
1243
1248
|
if (this.properties.id === e)
|
|
1244
1249
|
return this;
|
|
1245
1250
|
for (const t of this.elements()) {
|
|
@@ -1248,25 +1253,25 @@ class Ae {
|
|
|
1248
1253
|
return r;
|
|
1249
1254
|
}
|
|
1250
1255
|
});
|
|
1251
|
-
|
|
1256
|
+
i(this, "trigger", (e, t) => {
|
|
1252
1257
|
((this.properties[v] ?? {})[e] ?? []).forEach((n) => n(t));
|
|
1253
1258
|
});
|
|
1254
|
-
|
|
1259
|
+
i(this, "click", () => {
|
|
1255
1260
|
this.trigger("click", {});
|
|
1256
1261
|
});
|
|
1257
|
-
|
|
1262
|
+
i(this, "on", (e, t, r) => {
|
|
1258
1263
|
var c;
|
|
1259
|
-
const n = (c = this.properties)[v] ?? (c[v] = {}),
|
|
1260
|
-
|
|
1264
|
+
const n = (c = this.properties)[v] ?? (c[v] = {}), l = r != null && r.once ? (a) => {
|
|
1265
|
+
o(), t(a);
|
|
1261
1266
|
} : (a) => t(a);
|
|
1262
|
-
n[e] = [...n[e] ?? [],
|
|
1263
|
-
const
|
|
1264
|
-
const a = n[e] ?? [], u = a.indexOf(
|
|
1265
|
-
u !== -1 && (a.splice(u, 1), a.length === 0 ? (delete n[e], Object.keys(n).length === 0 && delete this.properties[v]) : n[e] = a, (r == null ? void 0 : r.signal) != null && r.signal.removeEventListener("abort",
|
|
1267
|
+
n[e] = [...n[e] ?? [], l];
|
|
1268
|
+
const o = () => {
|
|
1269
|
+
const a = n[e] ?? [], u = a.indexOf(l);
|
|
1270
|
+
u !== -1 && (a.splice(u, 1), a.length === 0 ? (delete n[e], Object.keys(n).length === 0 && delete this.properties[v]) : n[e] = a, (r == null ? void 0 : r.signal) != null && r.signal.removeEventListener("abort", o));
|
|
1266
1271
|
};
|
|
1267
|
-
return (r == null ? void 0 : r.signal) != null && r.signal.addEventListener("abort",
|
|
1272
|
+
return (r == null ? void 0 : r.signal) != null && r.signal.addEventListener("abort", o), o;
|
|
1268
1273
|
});
|
|
1269
|
-
|
|
1274
|
+
i(this, "addClasses", (e) => {
|
|
1270
1275
|
var r;
|
|
1271
1276
|
if (e.length === 0)
|
|
1272
1277
|
return;
|
|
@@ -1275,34 +1280,34 @@ class Ae {
|
|
|
1275
1280
|
t.includes(n) || t.push(n);
|
|
1276
1281
|
});
|
|
1277
1282
|
});
|
|
1278
|
-
|
|
1283
|
+
i(this, "removeClasses", (e) => {
|
|
1279
1284
|
var r;
|
|
1280
1285
|
if (e.length === 0)
|
|
1281
1286
|
return;
|
|
1282
1287
|
const t = (r = this.properties)[b] ?? (r[b] = []);
|
|
1283
1288
|
e.forEach((n) => {
|
|
1284
|
-
const
|
|
1285
|
-
|
|
1289
|
+
const l = t.indexOf(n);
|
|
1290
|
+
l !== -1 && t.splice(l, 1);
|
|
1286
1291
|
}), t.length === 0 && delete this.properties[b];
|
|
1287
1292
|
});
|
|
1288
|
-
|
|
1289
|
-
|
|
1293
|
+
i(this, "getClasses", () => this.properties[b] ?? []);
|
|
1294
|
+
i(this, "getAttributes", () => Object.entries(this.properties).filter(
|
|
1290
1295
|
([e]) => !["innerText", "innerHTML"].includes(e)
|
|
1291
1296
|
));
|
|
1292
|
-
|
|
1297
|
+
i(this, "getVisibleAttributes", () => Reflect.ownKeys(this.properties).flatMap(
|
|
1293
1298
|
(e) => e === b ? [["class", this.getClasses()]] : e === E ? [["style", this.getStyles()]] : typeof e == "string" ? [[e, String(this.properties[e])]] : []
|
|
1294
1299
|
));
|
|
1295
|
-
|
|
1300
|
+
i(this, "setStyle", (e, t) => {
|
|
1296
1301
|
var n;
|
|
1297
1302
|
const r = (n = this.properties)[E] ?? (n[E] = {});
|
|
1298
1303
|
r[e] = t, t === "" && (delete r[e], Object.keys(r).length === 0 && delete this.properties[E]);
|
|
1299
1304
|
});
|
|
1300
|
-
|
|
1305
|
+
i(this, "getStyle", (e) => {
|
|
1301
1306
|
var t;
|
|
1302
1307
|
return ((t = this.properties[E]) == null ? void 0 : t[e]) ?? "";
|
|
1303
1308
|
});
|
|
1304
|
-
|
|
1305
|
-
|
|
1309
|
+
i(this, "getStyles", () => this.properties[E] ?? {});
|
|
1310
|
+
i(this, "makeAccessors", (e) => {
|
|
1306
1311
|
const t = this.properties;
|
|
1307
1312
|
return {
|
|
1308
1313
|
get: () => t[e],
|
|
@@ -1316,12 +1321,12 @@ const ot = (s) => s.replace(/"/g, """), lt = (s) => s.replace(/&/g, "&"
|
|
|
1316
1321
|
class ct extends Ae {
|
|
1317
1322
|
constructor(t, r, n) {
|
|
1318
1323
|
super(n);
|
|
1319
|
-
|
|
1320
|
-
|
|
1324
|
+
i(this, "isPortal", () => !1);
|
|
1325
|
+
i(this, "toHTML", (t = !1) => {
|
|
1321
1326
|
const r = this.children.map((a) => a.toHTML()).join(""), n = this.namespace ? ` xmlns="${this.namespace}"` : "";
|
|
1322
|
-
let
|
|
1323
|
-
const
|
|
1324
|
-
return ht.has(this.tagName) && r === "" ? `<${this.tagName}${n}${
|
|
1327
|
+
let l = null;
|
|
1328
|
+
const o = 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" ? (l = u, "") : a === "innerText" ? (l = lt(u), "") : ` ${a}="${ot(u)}"`).join(""), c = t ? ` ${ye}` : "";
|
|
1329
|
+
return ht.has(this.tagName) && r === "" ? `<${this.tagName}${n}${o}${c} />` : `<${this.tagName}${n}${o}${c}>${l ?? r}</${this.tagName}>`;
|
|
1325
1330
|
});
|
|
1326
1331
|
this.tagName = t, this.namespace = r;
|
|
1327
1332
|
}
|
|
@@ -1329,32 +1334,32 @@ class ct extends Ae {
|
|
|
1329
1334
|
class Se extends Ae {
|
|
1330
1335
|
constructor(t, r) {
|
|
1331
1336
|
super(r);
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1337
|
+
i(this, "isPortal", () => !0);
|
|
1338
|
+
i(this, "toHTML", () => "");
|
|
1339
|
+
i(this, "contentToHTML", (t = !1) => this.children.map((r) => r.toHTML(t)).join(""));
|
|
1335
1340
|
this.selector = t;
|
|
1336
1341
|
}
|
|
1337
1342
|
}
|
|
1338
1343
|
class at {
|
|
1339
1344
|
constructor(e) {
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
+
i(this, "id", be());
|
|
1346
|
+
i(this, "isElement", () => !1);
|
|
1347
|
+
i(this, "isText", () => !0);
|
|
1348
|
+
i(this, "getText", () => this.text);
|
|
1349
|
+
i(this, "toHTML", () => this.text);
|
|
1345
1350
|
this.text = e;
|
|
1346
1351
|
}
|
|
1347
1352
|
}
|
|
1348
1353
|
class P {
|
|
1349
1354
|
constructor(e, t, r, n) {
|
|
1350
|
-
|
|
1355
|
+
i(this, "appendOrInsert", (e) => {
|
|
1351
1356
|
if (this.reference != null) {
|
|
1352
1357
|
const t = this.element.children.indexOf(this.reference);
|
|
1353
1358
|
this.element.children.splice(t, 0, e);
|
|
1354
1359
|
} else
|
|
1355
1360
|
this.element.children.push(e);
|
|
1356
1361
|
});
|
|
1357
|
-
|
|
1362
|
+
i(this, "makeChildElement", (e, t) => {
|
|
1358
1363
|
const r = new ct(e, t, this.element);
|
|
1359
1364
|
return this.appendOrInsert(r), new P(
|
|
1360
1365
|
r,
|
|
@@ -1363,7 +1368,7 @@ class P {
|
|
|
1363
1368
|
this.providers
|
|
1364
1369
|
);
|
|
1365
1370
|
});
|
|
1366
|
-
|
|
1371
|
+
i(this, "makeChildText", (e) => {
|
|
1367
1372
|
const t = new at(e);
|
|
1368
1373
|
return this.appendOrInsert(t), new P(
|
|
1369
1374
|
this.element,
|
|
@@ -1372,15 +1377,15 @@ class P {
|
|
|
1372
1377
|
this.providers
|
|
1373
1378
|
);
|
|
1374
1379
|
});
|
|
1375
|
-
|
|
1380
|
+
i(this, "setText", (e) => {
|
|
1376
1381
|
this.reference && this.reference.isText() && (this.reference.text = e);
|
|
1377
1382
|
});
|
|
1378
|
-
|
|
1383
|
+
i(this, "getText", () => {
|
|
1379
1384
|
var e;
|
|
1380
1385
|
return ((e = this.reference) == null ? void 0 : e.getText()) ?? this.element.getText();
|
|
1381
1386
|
});
|
|
1382
|
-
|
|
1383
|
-
|
|
1387
|
+
i(this, "makeRef", () => this.makeChildText(""));
|
|
1388
|
+
i(this, "makePortal", (e) => {
|
|
1384
1389
|
const t = new Se(e, this.element);
|
|
1385
1390
|
return this.appendOrInsert(t), new P(
|
|
1386
1391
|
t,
|
|
@@ -1396,29 +1401,29 @@ class P {
|
|
|
1396
1401
|
* @param value - The provider to set for the given mark.
|
|
1397
1402
|
* @returns A new `DOMContext` instance with the specified provider.
|
|
1398
1403
|
*/
|
|
1399
|
-
|
|
1404
|
+
i(this, "setProvider", (e, t, r) => new P(this.element, this.reference, this.container, {
|
|
1400
1405
|
...this.providers,
|
|
1401
1406
|
[e]: [t, r]
|
|
1402
1407
|
}));
|
|
1403
|
-
|
|
1408
|
+
i(this, "getProvider", (e) => {
|
|
1404
1409
|
if (this.providers[e] === void 0)
|
|
1405
1410
|
throw new me(e);
|
|
1406
1411
|
return this.providers[e];
|
|
1407
1412
|
});
|
|
1408
|
-
|
|
1413
|
+
i(this, "clear", (e) => {
|
|
1409
1414
|
e && (this.reference !== void 0 ? this.element.removeChild(this.reference) : this.element.remove());
|
|
1410
1415
|
});
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1416
|
+
i(this, "on", (e, t) => this.element.on(e, t));
|
|
1417
|
+
i(this, "addClasses", (e) => this.element.addClasses(e));
|
|
1418
|
+
i(this, "removeClasses", (e) => this.element.removeClasses(e));
|
|
1419
|
+
i(this, "getClasses", () => this.element.getClasses());
|
|
1420
|
+
i(this, "isBrowserDOM", () => !1);
|
|
1421
|
+
i(this, "isBrowser", () => !1);
|
|
1422
|
+
i(this, "isHeadlessDOM", () => !0);
|
|
1423
|
+
i(this, "isHeadless", () => !0);
|
|
1424
|
+
i(this, "setStyle", (e, t) => this.element.setStyle(e, t));
|
|
1425
|
+
i(this, "getStyle", (e) => this.element.getStyle(e));
|
|
1426
|
+
i(this, "makeAccessors", (e) => this.element.makeAccessors(e));
|
|
1422
1427
|
this.element = e, this.reference = t, this.container = r, this.providers = n;
|
|
1423
1428
|
}
|
|
1424
1429
|
}
|
|
@@ -1445,20 +1450,20 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1445
1450
|
}), dt = (s) => (e) => {
|
|
1446
1451
|
let t = [];
|
|
1447
1452
|
const r = s.on((n) => {
|
|
1448
|
-
e.removeClasses(t), t = (n ?? "").split(" ").filter((
|
|
1453
|
+
e.removeClasses(t), t = (n ?? "").split(" ").filter((l) => l.length > 0), e.addClasses(t);
|
|
1449
1454
|
});
|
|
1450
1455
|
return (n) => {
|
|
1451
1456
|
r(), n && e.removeClasses(t), t.length = 0;
|
|
1452
1457
|
};
|
|
1453
1458
|
}, H = (s, e) => (t) => {
|
|
1454
|
-
const { get: r, set: n } = t.makeAccessors(s),
|
|
1455
|
-
return n(e), (
|
|
1456
|
-
|
|
1459
|
+
const { get: r, set: n } = t.makeAccessors(s), l = r();
|
|
1460
|
+
return n(e), (o) => {
|
|
1461
|
+
o && n(l);
|
|
1457
1462
|
};
|
|
1458
1463
|
}, N = (s, e) => (t) => {
|
|
1459
|
-
const { get: r, set: n } = t.makeAccessors(s),
|
|
1464
|
+
const { get: r, set: n } = t.makeAccessors(s), l = r(), o = e.on(n);
|
|
1460
1465
|
return (c) => {
|
|
1461
|
-
|
|
1466
|
+
o(), c && n(l);
|
|
1462
1467
|
};
|
|
1463
1468
|
}, M = new Proxy(
|
|
1464
1469
|
{},
|
|
@@ -1569,14 +1574,14 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1569
1574
|
return s;
|
|
1570
1575
|
throw new Error(`Unknown type: '${typeof s}' for child: ${s}`);
|
|
1571
1576
|
}, we = (s, ...e) => (t) => {
|
|
1572
|
-
const r = t.makeChildElement(s, void 0), n = e.map((
|
|
1573
|
-
return (
|
|
1574
|
-
n.forEach((
|
|
1577
|
+
const r = t.makeChildElement(s, void 0), n = e.map((l) => f(l)(r));
|
|
1578
|
+
return (l) => {
|
|
1579
|
+
n.forEach((o) => o(!1)), r.clear(l);
|
|
1575
1580
|
};
|
|
1576
1581
|
}, Ce = (s, e, ...t) => (r) => {
|
|
1577
|
-
const n = r.makeChildElement(s, e),
|
|
1578
|
-
return (
|
|
1579
|
-
|
|
1582
|
+
const n = r.makeChildElement(s, e), l = t.map((o) => f(o)(n));
|
|
1583
|
+
return (o) => {
|
|
1584
|
+
l.forEach((c) => c(!1)), n.clear(o);
|
|
1580
1585
|
};
|
|
1581
1586
|
}, Bt = new Proxy(
|
|
1582
1587
|
{},
|
|
@@ -1621,20 +1626,20 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1621
1626
|
), ve = (s, e) => {
|
|
1622
1627
|
if (typeof e == "function")
|
|
1623
1628
|
return ve(s, { then: e });
|
|
1624
|
-
const t = e.pending != null ? f(e.pending()) : _, r = e.then, n = e.error != null ? (
|
|
1625
|
-
return (
|
|
1626
|
-
let
|
|
1627
|
-
const c = s(), a =
|
|
1629
|
+
const t = e.pending != null ? f(e.pending()) : _, r = e.then, n = e.error != null ? (l) => f(e.error(l)) : () => _;
|
|
1630
|
+
return (l) => {
|
|
1631
|
+
let o = !0;
|
|
1632
|
+
const c = s(), a = l.makeRef();
|
|
1628
1633
|
let u = f(t)(a);
|
|
1629
1634
|
return c.then(
|
|
1630
1635
|
(h) => {
|
|
1631
|
-
|
|
1636
|
+
o && (u(!0), u = f(r(h))(a));
|
|
1632
1637
|
},
|
|
1633
1638
|
(h) => {
|
|
1634
|
-
|
|
1639
|
+
o && (u(!0), u = f(n(h))(a));
|
|
1635
1640
|
}
|
|
1636
1641
|
), (h) => {
|
|
1637
|
-
|
|
1642
|
+
o = !1, u(h), a.clear(h);
|
|
1638
1643
|
};
|
|
1639
1644
|
};
|
|
1640
1645
|
}, Gt = (s, e) => ve(() => s, e), xe = (s, e, t) => (r) => r.on(s, e, t), mt = (s) => xe("click", (e) => {
|
|
@@ -1686,12 +1691,12 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1686
1691
|
const t = e.target;
|
|
1687
1692
|
if (t.value === "")
|
|
1688
1693
|
return;
|
|
1689
|
-
const r = t.value.split("T"), n = r[0].split("-"),
|
|
1694
|
+
const r = t.value.split("T"), n = r[0].split("-"), l = new Date(
|
|
1690
1695
|
Number(n[0]),
|
|
1691
1696
|
Number(n[1]) - 1,
|
|
1692
1697
|
Number(n[2])
|
|
1693
|
-
),
|
|
1694
|
-
|
|
1698
|
+
), o = r[1].split(":");
|
|
1699
|
+
l.setHours(Number(o[0])), l.setMinutes(Number(o[1])), l.setSeconds(Number(o[2])), s(l);
|
|
1695
1700
|
}, Yt = (s) => (e) => {
|
|
1696
1701
|
const t = e.target;
|
|
1697
1702
|
if (t.value === "") {
|
|
@@ -1703,12 +1708,12 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1703
1708
|
s(null);
|
|
1704
1709
|
return;
|
|
1705
1710
|
}
|
|
1706
|
-
const n = r[0].split("-"),
|
|
1711
|
+
const n = r[0].split("-"), l = new Date(
|
|
1707
1712
|
Number(n[0]),
|
|
1708
1713
|
Number(n[1]) - 1,
|
|
1709
1714
|
Number(n[2])
|
|
1710
|
-
),
|
|
1711
|
-
|
|
1715
|
+
), o = r[1].split(":");
|
|
1716
|
+
l.setHours(Number(o[0] ?? 0)), l.setMinutes(Number(o[1] ?? 0)), l.setSeconds(Number(o[2] ?? 0)), s(l);
|
|
1712
1717
|
}, zt = (s) => (e) => {
|
|
1713
1718
|
const t = e.target;
|
|
1714
1719
|
s(t.checked);
|
|
@@ -1722,18 +1727,18 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1722
1727
|
if (d.is(s))
|
|
1723
1728
|
return (r) => {
|
|
1724
1729
|
const n = r.makeRef();
|
|
1725
|
-
let
|
|
1730
|
+
let l, o;
|
|
1726
1731
|
const c = s.map((h) => Object.keys(h)[0]);
|
|
1727
1732
|
let a;
|
|
1728
1733
|
const u = c.on((h) => {
|
|
1729
1734
|
if (h !== a) {
|
|
1730
|
-
a = h,
|
|
1731
|
-
const
|
|
1732
|
-
|
|
1735
|
+
a = h, o == null || o.dispose(), l == null || l(!0), o = s.map((y) => y[h]);
|
|
1736
|
+
const g = e[h](o);
|
|
1737
|
+
l = f(g)(n);
|
|
1733
1738
|
}
|
|
1734
1739
|
});
|
|
1735
1740
|
return (h) => {
|
|
1736
|
-
|
|
1741
|
+
o == null || o.dispose(), u(), n.clear(h), l == null || l(h);
|
|
1737
1742
|
};
|
|
1738
1743
|
};
|
|
1739
1744
|
const t = Object.keys(s)[0];
|
|
@@ -1751,7 +1756,7 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1751
1756
|
), cs = (s, e = {}) => (t) => {
|
|
1752
1757
|
const r = (e == null ? void 0 : e.firstSeparator) ?? s, n = (e == null ? void 0 : e.lastSeparator) ?? s;
|
|
1753
1758
|
return St(
|
|
1754
|
-
t.map((
|
|
1759
|
+
t.map((l) => l.isFirst ? "first" : l.isLast ? "last" : "other"),
|
|
1755
1760
|
{
|
|
1756
1761
|
first: r,
|
|
1757
1762
|
last: n,
|
|
@@ -1764,16 +1769,16 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1764
1769
|
if (d.is(s)) {
|
|
1765
1770
|
const r = s;
|
|
1766
1771
|
return (n) => {
|
|
1767
|
-
const
|
|
1768
|
-
let
|
|
1772
|
+
const l = n.makeRef();
|
|
1773
|
+
let o = () => {
|
|
1769
1774
|
}, c = !1, a = null;
|
|
1770
1775
|
const u = r.on((h) => {
|
|
1771
|
-
h == null ? (
|
|
1772
|
-
|
|
1776
|
+
h == null ? (o(!0), o = f((t == null ? void 0 : t()) ?? _)(l), c = !1, a == null || a.dispose(), a = null) : (a == null ? a = w(h) : a.value = h, c || (o(!0), o = f(e(a))(
|
|
1777
|
+
l
|
|
1773
1778
|
), c = !0));
|
|
1774
1779
|
});
|
|
1775
1780
|
return (h) => {
|
|
1776
|
-
a == null || a.dispose(), u(),
|
|
1781
|
+
a == null || a.dispose(), u(), o == null || o(h), l.clear(h);
|
|
1777
1782
|
};
|
|
1778
1783
|
};
|
|
1779
1784
|
} else {
|
|
@@ -1792,36 +1797,36 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1792
1797
|
return (t != null ? f(t == null ? void 0 : t()) : _)(
|
|
1793
1798
|
n
|
|
1794
1799
|
);
|
|
1795
|
-
const
|
|
1800
|
+
const o = s.map(() => null), c = s.map(
|
|
1796
1801
|
(p) => d.is(p) ? p.value != null : p != null
|
|
1797
1802
|
);
|
|
1798
1803
|
let a = null;
|
|
1799
|
-
const u = w(c.every((p) => p)), h = (p,
|
|
1804
|
+
const u = w(c.every((p) => p)), h = (p, m) => {
|
|
1800
1805
|
if (p.value != null) {
|
|
1801
|
-
if (
|
|
1806
|
+
if (o[m] == null) {
|
|
1802
1807
|
const C = w(p.value);
|
|
1803
|
-
|
|
1808
|
+
o[m] = C;
|
|
1804
1809
|
} else
|
|
1805
|
-
|
|
1806
|
-
c[
|
|
1810
|
+
o[m].value = p.value;
|
|
1811
|
+
c[m] = !0;
|
|
1807
1812
|
} else
|
|
1808
|
-
c[
|
|
1813
|
+
c[m] = !1;
|
|
1809
1814
|
};
|
|
1810
|
-
let
|
|
1811
|
-
const y = s.map((p,
|
|
1815
|
+
let g = s.length - 1;
|
|
1816
|
+
const y = s.map((p, m) => {
|
|
1812
1817
|
if (!d.is(p)) {
|
|
1813
1818
|
const C = w(p);
|
|
1814
|
-
return
|
|
1819
|
+
return o[m] = C, () => {
|
|
1815
1820
|
};
|
|
1816
1821
|
}
|
|
1817
1822
|
return p.on(() => {
|
|
1818
|
-
h(p,
|
|
1823
|
+
h(p, m), g === 0 ? u.value = c.every((C) => C) : g--;
|
|
1819
1824
|
});
|
|
1820
1825
|
});
|
|
1821
1826
|
return u.on((p) => {
|
|
1822
|
-
a == null || a(!0), a = null, p ? a = f(e(...
|
|
1827
|
+
a == null || a(!0), a = null, p ? a = f(e(...o))(n) : a = f((t == null ? void 0 : t()) ?? _)(n);
|
|
1823
1828
|
}), (p) => {
|
|
1824
|
-
|
|
1829
|
+
o.forEach((m) => m == null ? void 0 : m.dispose()), u.dispose(), y.forEach((m) => m()), a == null || a(p), n.clear(p);
|
|
1825
1830
|
};
|
|
1826
1831
|
}, Z = (...s) => (e) => (t) => s.forEach((r) => r(t, e)), Pe = (s, e, t) => _t(
|
|
1827
1832
|
T.map(s, (r) => r ? !0 : null),
|
|
@@ -1834,7 +1839,7 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1834
1839
|
), De = (s, e, t) => t != null ? De(s, (r) => {
|
|
1835
1840
|
const n = new Y(
|
|
1836
1841
|
r.index,
|
|
1837
|
-
r.total.map((
|
|
1842
|
+
r.total.map((l) => l - 1)
|
|
1838
1843
|
);
|
|
1839
1844
|
return A(
|
|
1840
1845
|
Z(n.dispose),
|
|
@@ -1846,34 +1851,34 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1846
1851
|
)
|
|
1847
1852
|
);
|
|
1848
1853
|
}) : d.is(s) ? (r) => {
|
|
1849
|
-
const n = r.makeRef(),
|
|
1850
|
-
const a =
|
|
1854
|
+
const n = r.makeRef(), l = [], o = s.on((c) => {
|
|
1855
|
+
const a = l.splice(c);
|
|
1851
1856
|
for (const u of a)
|
|
1852
1857
|
u(!0);
|
|
1853
|
-
for (let u =
|
|
1858
|
+
for (let u = l.length; u < c; u++) {
|
|
1854
1859
|
const h = new Y(u, s);
|
|
1855
|
-
|
|
1860
|
+
l.push(f(e(h))(n));
|
|
1856
1861
|
}
|
|
1857
1862
|
});
|
|
1858
1863
|
return (c) => {
|
|
1859
|
-
|
|
1860
|
-
for (const a of
|
|
1864
|
+
o();
|
|
1865
|
+
for (const a of l)
|
|
1861
1866
|
a(c);
|
|
1862
|
-
|
|
1867
|
+
l.length = 0, n.clear(c);
|
|
1863
1868
|
};
|
|
1864
1869
|
} : A(
|
|
1865
1870
|
...Array.from({ length: s }, (r, n) => n).map(
|
|
1866
1871
|
(r) => f(e(new Y(r, U(s))))
|
|
1867
1872
|
)
|
|
1868
1873
|
), fs = (s, e, t) => {
|
|
1869
|
-
const r = T.map(s, (
|
|
1874
|
+
const r = T.map(s, (l) => l.length), n = T.toSignal(s);
|
|
1870
1875
|
return De(
|
|
1871
1876
|
r,
|
|
1872
|
-
(
|
|
1873
|
-
const
|
|
1877
|
+
(l) => {
|
|
1878
|
+
const o = n.map((c) => c[l.index]);
|
|
1874
1879
|
return A(
|
|
1875
|
-
Z(
|
|
1876
|
-
f(e(
|
|
1880
|
+
Z(o.dispose),
|
|
1881
|
+
f(e(o, l))
|
|
1877
1882
|
);
|
|
1878
1883
|
},
|
|
1879
1884
|
t
|
|
@@ -1884,13 +1889,13 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1884
1889
|
return (r) => {
|
|
1885
1890
|
r = r.makeRef();
|
|
1886
1891
|
const n = t.map((c) => f(e(c)));
|
|
1887
|
-
let
|
|
1892
|
+
let l = () => {
|
|
1888
1893
|
};
|
|
1889
|
-
const
|
|
1890
|
-
|
|
1894
|
+
const o = n.on((c) => {
|
|
1895
|
+
l(!0), l = c(r);
|
|
1891
1896
|
});
|
|
1892
1897
|
return (c) => {
|
|
1893
|
-
|
|
1898
|
+
o(), l(c);
|
|
1894
1899
|
};
|
|
1895
1900
|
};
|
|
1896
1901
|
}
|
|
@@ -1916,15 +1921,15 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1916
1921
|
};
|
|
1917
1922
|
if (k.has(s))
|
|
1918
1923
|
throw new Error(`Probe already exists: ${s.description}`);
|
|
1919
|
-
const n = setTimeout(() => r("timeout"), t),
|
|
1920
|
-
return k.set(s,
|
|
1924
|
+
const n = setTimeout(() => r("timeout"), t), l = { counter: 0, timeoutId: n };
|
|
1925
|
+
return k.set(s, l), {
|
|
1921
1926
|
value: () => {
|
|
1922
1927
|
clearTimeout(n);
|
|
1923
1928
|
const c = k.get(s);
|
|
1924
1929
|
c != null && --c.counter === 0 && r("resolved");
|
|
1925
1930
|
},
|
|
1926
1931
|
dispose: () => r("disposed"),
|
|
1927
|
-
onUse: () =>
|
|
1932
|
+
onUse: () => l.counter++
|
|
1928
1933
|
};
|
|
1929
1934
|
}
|
|
1930
1935
|
}), ms = Et(Symbol("GlobalProbe")), wt = (s, e) => (t) => {
|
|
@@ -1978,20 +1983,20 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1978
1983
|
function n(c) {
|
|
1979
1984
|
t = c;
|
|
1980
1985
|
}
|
|
1981
|
-
const
|
|
1986
|
+
const l = [], o = s({
|
|
1982
1987
|
use: ({ mark: c }) => {
|
|
1983
1988
|
const [a, u] = r().getProvider(c);
|
|
1984
1989
|
return u == null || u(), a;
|
|
1985
1990
|
},
|
|
1986
1991
|
set: ({ mark: c, create: a }, u) => {
|
|
1987
|
-
const { value: h, dispose:
|
|
1988
|
-
|
|
1992
|
+
const { value: h, dispose: g, onUse: y } = a(u, r());
|
|
1993
|
+
l.push(g), n(r().setProvider(c, h, y));
|
|
1989
1994
|
}
|
|
1990
1995
|
});
|
|
1991
|
-
return
|
|
1996
|
+
return o == null ? () => {
|
|
1992
1997
|
} : A(
|
|
1993
|
-
f(
|
|
1994
|
-
Z(() =>
|
|
1998
|
+
f(o),
|
|
1999
|
+
Z(() => l.forEach((c) => c()))
|
|
1995
2000
|
)(r());
|
|
1996
2001
|
}, Ss = (s, e, t) => K(({ set: r }) => (r(s, e), t())), _s = (s, e) => K(({ use: t }) => e(t(s))), Es = (...s) => (e) => K(({ use: t }) => {
|
|
1997
2002
|
const r = s.map(t);
|