@tempots/dom 28.0.1 → 28.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1 -1
- package/index.js +270 -270
- package/package.json +1 -1
- package/std/signal.d.ts +1 -1
package/index.js
CHANGED
|
@@ -3,16 +3,16 @@ 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
|
|
6
|
+
var i = (s, e, t) => He(s, typeof e != "symbol" ? e + "" : e, t), ne = (s, e, t) => e.has(s) || re("Cannot " + t);
|
|
7
7
|
var I = (s, e, t) => (ne(s, e, "read from private field"), t ? t.call(s) : e.get(s)), ie = (s, e, t) => e.has(s) ? re("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), z = (s, e, t, r) => (ne(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
|
|
8
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 o = 0; o < r; o++) {
|
|
13
|
+
let l = s.charCodeAt(o);
|
|
14
14
|
isNaN(l) && (l = 97);
|
|
15
|
-
let c = e.charCodeAt(
|
|
15
|
+
let c = e.charCodeAt(o);
|
|
16
16
|
isNaN(c) && (c = 97), n += String.fromCharCode(l + (c - l) * t);
|
|
17
17
|
}
|
|
18
18
|
return n;
|
|
@@ -28,24 +28,24 @@ class Q {
|
|
|
28
28
|
/**
|
|
29
29
|
* The counter of the element starting from 1.
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
i(this, "counter");
|
|
32
32
|
/**
|
|
33
33
|
* Checks if the element is the first element in the collection.
|
|
34
34
|
* @returns `true` if the element is the first element, `false` otherwise.
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
i(this, "isFirst");
|
|
37
37
|
/**
|
|
38
38
|
* Checks if the counter of the element is even.
|
|
39
39
|
* @returns `true` if the counter is even, `false` otherwise.
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
i(this, "isEven");
|
|
42
42
|
/**
|
|
43
43
|
* Checks if the counter of the element is odd.
|
|
44
44
|
* @returns `true` if the counter is odd, `false` otherwise.
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
i(this, "isOdd");
|
|
47
47
|
ie(this, w);
|
|
48
|
-
|
|
48
|
+
i(this, "dispose", () => {
|
|
49
49
|
var e;
|
|
50
50
|
(e = I(this, w)) == null || e.dispose(), z(this, w, void 0);
|
|
51
51
|
});
|
|
@@ -72,33 +72,33 @@ const H = class H {
|
|
|
72
72
|
/**
|
|
73
73
|
* @internal
|
|
74
74
|
*/
|
|
75
|
-
|
|
75
|
+
i(this, "$__signal__", !0);
|
|
76
76
|
/**
|
|
77
77
|
* @internal
|
|
78
78
|
*/
|
|
79
|
-
|
|
79
|
+
i(this, "_value");
|
|
80
80
|
/**
|
|
81
81
|
* @internal
|
|
82
82
|
*/
|
|
83
|
-
|
|
83
|
+
i(this, "_derivatives", []);
|
|
84
84
|
/**
|
|
85
85
|
* @internal
|
|
86
86
|
*/
|
|
87
|
-
|
|
87
|
+
i(this, "_onValueListeners", []);
|
|
88
88
|
/**
|
|
89
89
|
* @internal
|
|
90
90
|
*/
|
|
91
|
-
|
|
91
|
+
i(this, "_onDisposeListeners", []);
|
|
92
92
|
/**
|
|
93
93
|
* Gets the current value of the signal.
|
|
94
94
|
* @returns The current value of the signal.
|
|
95
95
|
*/
|
|
96
|
-
|
|
96
|
+
i(this, "get", () => this._value);
|
|
97
97
|
/**
|
|
98
98
|
* Checks if the signal has any registered listeners.
|
|
99
99
|
* @returns `true` if the signal has listeners, `false` otherwise.
|
|
100
100
|
*/
|
|
101
|
-
|
|
101
|
+
i(this, "hasListeners", () => this._onValueListeners.length > 0);
|
|
102
102
|
/**
|
|
103
103
|
* Registers a listener function to be called whenever the value of the signal changes.
|
|
104
104
|
* The listener function will be immediately called with the current value of the signal.
|
|
@@ -107,10 +107,10 @@ const H = class H {
|
|
|
107
107
|
* @param listener - The listener function to be called when the value of the signal changes.
|
|
108
108
|
* @param options - Options for the listener.
|
|
109
109
|
*/
|
|
110
|
-
|
|
110
|
+
i(this, "on", (e, t = {}) => {
|
|
111
111
|
t.skipInitial || e(this.get(), void 0);
|
|
112
|
-
const r = t.once ? (
|
|
113
|
-
n(), e(
|
|
112
|
+
const r = t.once ? (o, l) => {
|
|
113
|
+
n(), e(o, l);
|
|
114
114
|
} : e;
|
|
115
115
|
this._onValueListeners.push(r);
|
|
116
116
|
const n = () => {
|
|
@@ -124,32 +124,32 @@ const H = class H {
|
|
|
124
124
|
/**
|
|
125
125
|
* @internal
|
|
126
126
|
*/
|
|
127
|
-
|
|
127
|
+
i(this, "_setAndNotify", (e) => {
|
|
128
128
|
if (this._disposed) return;
|
|
129
|
-
const
|
|
130
|
-
|
|
129
|
+
const t = this._value;
|
|
130
|
+
this.equals(t, e) || (this._value = e, this._onValueListeners.forEach((n) => n(e, t)));
|
|
131
131
|
});
|
|
132
132
|
/**
|
|
133
133
|
* @internal
|
|
134
134
|
*/
|
|
135
|
-
|
|
135
|
+
i(this, "_disposed", !1);
|
|
136
136
|
/**
|
|
137
137
|
* Checks whether the signal is disposed.
|
|
138
138
|
* @returns True if the signal is disposed, false otherwise.
|
|
139
139
|
*/
|
|
140
|
-
|
|
140
|
+
i(this, "isDisposed", () => this._disposed);
|
|
141
141
|
/**
|
|
142
142
|
* Adds a listener function to be called when the object is disposed.
|
|
143
143
|
* @param listener - The listener function to be called when the object is disposed.
|
|
144
144
|
* @returns A function that can be called to remove the listener.
|
|
145
145
|
*/
|
|
146
|
-
|
|
146
|
+
i(this, "onDispose", (e) => {
|
|
147
147
|
this._onDisposeListeners.push(e);
|
|
148
148
|
});
|
|
149
149
|
/**
|
|
150
150
|
* Disposes the signal, releasing any resources associated with it.
|
|
151
151
|
*/
|
|
152
|
-
|
|
152
|
+
i(this, "dispose", () => {
|
|
153
153
|
this._disposed || (this._disposed = !0, this._onDisposeListeners.forEach((e) => e()), this._onDisposeListeners.length = 0, this._derivatives.length = 0);
|
|
154
154
|
});
|
|
155
155
|
/**
|
|
@@ -202,7 +202,7 @@ const H = class H {
|
|
|
202
202
|
* @param equals - Optional function to determine if two transformed values are equal (defaults to strict equality)
|
|
203
203
|
* @returns A new computed signal with the transformed value
|
|
204
204
|
*/
|
|
205
|
-
|
|
205
|
+
i(this, "map", (e, t = (r, n) => r === n) => {
|
|
206
206
|
const r = new P(() => {
|
|
207
207
|
try {
|
|
208
208
|
return e(this.get());
|
|
@@ -222,7 +222,7 @@ const H = class H {
|
|
|
222
222
|
* Defaults to a strict equality check (===).
|
|
223
223
|
* @returns A new Signal that emits the values of the resulting Signal.
|
|
224
224
|
*/
|
|
225
|
-
|
|
225
|
+
i(this, "flatMap", (e, t = (r, n) => r === n) => {
|
|
226
226
|
const r = new P(() => {
|
|
227
227
|
try {
|
|
228
228
|
return e(this.get()).get();
|
|
@@ -238,26 +238,26 @@ const H = class H {
|
|
|
238
238
|
* @param fn - The callback function to be invoked with the current value of the signal.
|
|
239
239
|
* @returns A new signal that emits the same value as the original signal and invokes the callback function.
|
|
240
240
|
*/
|
|
241
|
-
|
|
241
|
+
i(this, "tap", (e) => this.map((t) => (e(t), t)));
|
|
242
242
|
/**
|
|
243
243
|
* Returns a new Signal that emits the value at the specified key of the current value.
|
|
244
244
|
*
|
|
245
245
|
* @param key - The key of the value to retrieve.
|
|
246
246
|
* @returns A new Signal that emits the value at the specified key.
|
|
247
247
|
*/
|
|
248
|
-
|
|
248
|
+
i(this, "at", (e) => this.map((t) => t[e]));
|
|
249
249
|
/**
|
|
250
250
|
* @internal
|
|
251
251
|
*/
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
i(this, "_$");
|
|
253
|
+
i(this, "filter", (e, t) => {
|
|
254
254
|
let r = t ?? this.get();
|
|
255
255
|
const n = new P(() => {
|
|
256
256
|
try {
|
|
257
|
-
const
|
|
258
|
-
return r = e(
|
|
259
|
-
} catch (
|
|
260
|
-
throw console.error("Error in Signal.filter:",
|
|
257
|
+
const o = this.get();
|
|
258
|
+
return r = e(o) ? o : r;
|
|
259
|
+
} catch (o) {
|
|
260
|
+
throw console.error("Error in Signal.filter:", o), o;
|
|
261
261
|
}
|
|
262
262
|
}, this.equals);
|
|
263
263
|
return this.setDerivative(n), n;
|
|
@@ -272,9 +272,9 @@ const H = class H {
|
|
|
272
272
|
* @param equals - Optional equality function to determine if two values are equal.
|
|
273
273
|
* @returns - A new Computed object with the mapped and filtered values.
|
|
274
274
|
*/
|
|
275
|
-
|
|
275
|
+
i(this, "filterMap", (e, t, r = (n, o) => n === o) => {
|
|
276
276
|
let n = t;
|
|
277
|
-
const
|
|
277
|
+
const o = new P(() => {
|
|
278
278
|
try {
|
|
279
279
|
const l = this.get(), c = e(l);
|
|
280
280
|
return n = c ?? n;
|
|
@@ -282,7 +282,7 @@ const H = class H {
|
|
|
282
282
|
throw console.error("Error in Signal.filterMap:", l), l;
|
|
283
283
|
}
|
|
284
284
|
}, r);
|
|
285
|
-
return this.setDerivative(
|
|
285
|
+
return this.setDerivative(o), o;
|
|
286
286
|
});
|
|
287
287
|
/**
|
|
288
288
|
* Maps the values emitted by the signal to a new value asynchronously using the provided function.
|
|
@@ -297,25 +297,25 @@ const H = class H {
|
|
|
297
297
|
* @param equals - The equality function to compare the mapped values for equality.
|
|
298
298
|
* @returns A property that holds the mapped value and can be observed for changes.
|
|
299
299
|
*/
|
|
300
|
-
|
|
301
|
-
const
|
|
300
|
+
i(this, "mapAsync", (e, t, r, n = (o, l) => o === l) => {
|
|
301
|
+
const o = E(t, n);
|
|
302
302
|
let l = 0, c = new AbortController();
|
|
303
|
-
return
|
|
303
|
+
return o.onDispose(
|
|
304
304
|
this.on(async (a) => {
|
|
305
305
|
const u = ++l;
|
|
306
306
|
c.abort(), c = new AbortController();
|
|
307
307
|
try {
|
|
308
308
|
const h = await e(a, { abortSignal: c.signal });
|
|
309
|
-
u === l &&
|
|
309
|
+
u === l && o.set(h);
|
|
310
310
|
} catch (h) {
|
|
311
311
|
if (u === l)
|
|
312
312
|
if (r != null)
|
|
313
|
-
|
|
313
|
+
o.set(r(h));
|
|
314
314
|
else
|
|
315
315
|
throw h;
|
|
316
316
|
}
|
|
317
317
|
})
|
|
318
|
-
),
|
|
318
|
+
), o;
|
|
319
319
|
});
|
|
320
320
|
/**
|
|
321
321
|
* Maps the values of the signal using the provided function `fn`, and returns a new signal
|
|
@@ -327,14 +327,14 @@ const H = class H {
|
|
|
327
327
|
* @param alt - The alternative value to use when the mapped value is `undefined` or `null`.
|
|
328
328
|
* @returns A new signal containing the mapped values.
|
|
329
329
|
*/
|
|
330
|
-
|
|
330
|
+
i(this, "mapMaybe", (e, t) => this.map((r) => e(r) ?? t));
|
|
331
331
|
/**
|
|
332
332
|
* Feeds a property into the signal and sets up disposal behavior.
|
|
333
333
|
* @param prop - The property to feed into the signal.
|
|
334
334
|
* @param autoDisposeProp - Determines whether the property should be automatically disposed when the signal is disposed.
|
|
335
335
|
* @returns The input property.
|
|
336
336
|
*/
|
|
337
|
-
|
|
337
|
+
i(this, "feedProp", (e, t = !1) => {
|
|
338
338
|
const r = this.on(e.set);
|
|
339
339
|
return e.onDispose(r), t ? this.onDispose(e.dispose) : this.onDispose(r), e;
|
|
340
340
|
});
|
|
@@ -345,7 +345,7 @@ const H = class H {
|
|
|
345
345
|
* @param options.equals - A function that determines if two values are equal.
|
|
346
346
|
* @returns The derived property.
|
|
347
347
|
*/
|
|
348
|
-
|
|
348
|
+
i(this, "deriveProp", ({
|
|
349
349
|
autoDisposeProp: e = !0,
|
|
350
350
|
equals: t
|
|
351
351
|
} = {}) => this.feedProp(E(this.get(), t), e));
|
|
@@ -353,12 +353,12 @@ const H = class H {
|
|
|
353
353
|
* Derives a new signal from the current signal. Useful to create a new signal that emits the same values as the current signal but can be disposed independently.
|
|
354
354
|
* @returns A new signal that emits the same values as the current signal.
|
|
355
355
|
*/
|
|
356
|
-
|
|
356
|
+
i(this, "derive", () => this.map((e) => e));
|
|
357
357
|
/**
|
|
358
358
|
* Returns a signal that emits the count of values received so far.
|
|
359
359
|
* @returns A signal that emits the count of values received so far.
|
|
360
360
|
*/
|
|
361
|
-
|
|
361
|
+
i(this, "count", () => {
|
|
362
362
|
let e = 0;
|
|
363
363
|
return this.map(() => ++e);
|
|
364
364
|
});
|
|
@@ -368,7 +368,7 @@ const H = class H {
|
|
|
368
368
|
* Additionally, when the computed value is disposed, it sets the signal as dirty.
|
|
369
369
|
* @param computed - The computed value to add as a derivative.
|
|
370
370
|
*/
|
|
371
|
-
|
|
371
|
+
i(this, "setDerivative", (e) => {
|
|
372
372
|
this._derivatives.push(e), e.onDispose(() => {
|
|
373
373
|
this._derivatives.splice(
|
|
374
374
|
this._derivatives.indexOf(e),
|
|
@@ -436,21 +436,21 @@ const H = class H {
|
|
|
436
436
|
* @param equals - Function to compare two values for equality (defaults to strict equality)
|
|
437
437
|
* @returns A Signal that represents the result of the Promise
|
|
438
438
|
*/
|
|
439
|
-
|
|
440
|
-
const
|
|
441
|
-
return e.then((l) =>
|
|
442
|
-
r != null ?
|
|
439
|
+
i(H, "ofPromise", (e, t, r, n = (o, l) => o === l) => {
|
|
440
|
+
const o = new H(t, n);
|
|
441
|
+
return e.then((l) => o._setAndNotify(l)).catch((l) => {
|
|
442
|
+
r != null ? o._setAndNotify(r(l)) : console.error(
|
|
443
443
|
"Unhandled promise rejection in Signal.ofPromise:",
|
|
444
444
|
l
|
|
445
445
|
);
|
|
446
|
-
}),
|
|
446
|
+
}), o;
|
|
447
447
|
}), /**
|
|
448
448
|
* Checks if a value is a Signal.
|
|
449
449
|
*
|
|
450
450
|
* @param value - The value to check.
|
|
451
451
|
* @returns `true` if the value is a Signal, `false` otherwise.
|
|
452
452
|
*/
|
|
453
|
-
|
|
453
|
+
i(H, "is", (e) => (
|
|
454
454
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
455
455
|
e != null && e.$__signal__ === !0
|
|
456
456
|
));
|
|
@@ -467,36 +467,36 @@ class P extends d {
|
|
|
467
467
|
/**
|
|
468
468
|
* @internal
|
|
469
469
|
*/
|
|
470
|
-
|
|
470
|
+
i(this, "$__computed__", !0);
|
|
471
471
|
/**
|
|
472
472
|
* @internal
|
|
473
473
|
*/
|
|
474
|
-
|
|
474
|
+
i(this, "_isDirty", !1);
|
|
475
475
|
/**
|
|
476
476
|
* Marks the signal as dirty, indicating that its value has changed and needs to be recalculated.
|
|
477
477
|
* If the signal is already dirty or disposed, this method does nothing.
|
|
478
478
|
* It also marks all dependent signals as dirty and schedules a notification to update their values.
|
|
479
479
|
*/
|
|
480
|
-
|
|
480
|
+
i(this, "setDirty", () => {
|
|
481
481
|
this._isDirty || this._disposed || (this._isDirty = !0, this._derivatives.forEach((t) => t.setDirty()), this._scheduleNotify());
|
|
482
482
|
});
|
|
483
483
|
/**
|
|
484
484
|
* @internal
|
|
485
485
|
*/
|
|
486
|
-
|
|
486
|
+
i(this, "_scheduleCount", 0);
|
|
487
487
|
/**
|
|
488
488
|
* Schedules a notification to be executed asynchronously.
|
|
489
489
|
* If the signal is dirty, it will be updated and notified.
|
|
490
490
|
* @internal
|
|
491
491
|
*/
|
|
492
|
-
|
|
492
|
+
i(this, "_scheduleNotify", () => {
|
|
493
493
|
const t = ++this._scheduleCount;
|
|
494
494
|
Ve(() => {
|
|
495
|
-
this._scheduleCount !== t || this._disposed || this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn()
|
|
495
|
+
this._scheduleCount !== t || this._disposed || this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn()));
|
|
496
496
|
});
|
|
497
497
|
});
|
|
498
498
|
/** {@inheritDoc Signal.get} */
|
|
499
|
-
|
|
499
|
+
i(this, "get", () => (this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn())), this._value));
|
|
500
500
|
this._fn = t, this.setDirty();
|
|
501
501
|
}
|
|
502
502
|
/**
|
|
@@ -519,21 +519,21 @@ const J = class J extends d {
|
|
|
519
519
|
/**
|
|
520
520
|
* @internal
|
|
521
521
|
*/
|
|
522
|
-
|
|
522
|
+
i(this, "$__prop__", !0);
|
|
523
523
|
/**
|
|
524
524
|
* Changes the value of the property and notifies its listeners.
|
|
525
525
|
*
|
|
526
526
|
* @param value - The new value of the property.
|
|
527
527
|
*/
|
|
528
|
-
|
|
529
|
-
this._setAndNotify(t
|
|
528
|
+
i(this, "set", (t) => {
|
|
529
|
+
this._setAndNotify(t);
|
|
530
530
|
});
|
|
531
531
|
/**
|
|
532
532
|
* Updates the value of the signal by applying the provided function to the current value.
|
|
533
533
|
* @param fn - The function to apply to the current value.
|
|
534
534
|
*/
|
|
535
|
-
|
|
536
|
-
this._setAndNotify(t(this.get())
|
|
535
|
+
i(this, "update", (t) => {
|
|
536
|
+
this._setAndNotify(t(this.get()));
|
|
537
537
|
});
|
|
538
538
|
/**
|
|
539
539
|
* Creates a reducer function that combines the provided reducer function and effects.
|
|
@@ -541,16 +541,16 @@ const J = class J extends d {
|
|
|
541
541
|
* @param effects - An array of effects to be executed after the state is updated.
|
|
542
542
|
* @returns A dispatch function that can be used to update the state and trigger the effects.
|
|
543
543
|
*/
|
|
544
|
-
|
|
544
|
+
i(this, "reducer", (t, ...r) => {
|
|
545
545
|
const n = this;
|
|
546
|
-
return function
|
|
546
|
+
return function o(l) {
|
|
547
547
|
const c = n.value;
|
|
548
548
|
n.update((a) => t(a, l)), !n.equals(c, n.value) && r.forEach(
|
|
549
549
|
(a) => a({
|
|
550
550
|
previousState: c,
|
|
551
551
|
state: n.value,
|
|
552
552
|
action: l,
|
|
553
|
-
dispatch:
|
|
553
|
+
dispatch: o
|
|
554
554
|
})
|
|
555
555
|
);
|
|
556
556
|
};
|
|
@@ -566,9 +566,9 @@ const J = class J extends d {
|
|
|
566
566
|
* Defaults to a strict equality check (===).
|
|
567
567
|
* @returns A Prop object representing the isomorphism.
|
|
568
568
|
*/
|
|
569
|
-
|
|
570
|
-
const
|
|
571
|
-
return
|
|
569
|
+
i(this, "iso", (t, r, n = (o, l) => o === l) => {
|
|
570
|
+
const o = new J(t(this.get()), n);
|
|
571
|
+
return o.onDispose(this.on((l) => o.set(t(l)))), o.on((l) => this._setAndNotify(r(l))), o;
|
|
572
572
|
});
|
|
573
573
|
/**
|
|
574
574
|
* Returns a `Prop` that represents the value at the specified key of the current value.
|
|
@@ -576,7 +576,7 @@ const J = class J extends d {
|
|
|
576
576
|
* @param key - The key of the value to access.
|
|
577
577
|
* @returns A `Prop` that represents the value at the specified key.
|
|
578
578
|
*/
|
|
579
|
-
|
|
579
|
+
i(this, "atProp", (t) => this.iso(
|
|
580
580
|
(r) => r[t],
|
|
581
581
|
(r) => ({ ...this.value, [t]: r })
|
|
582
582
|
));
|
|
@@ -588,7 +588,7 @@ const J = class J extends d {
|
|
|
588
588
|
return this.get();
|
|
589
589
|
}
|
|
590
590
|
set value(t) {
|
|
591
|
-
this._setAndNotify(t
|
|
591
|
+
this._setAndNotify(t);
|
|
592
592
|
}
|
|
593
593
|
};
|
|
594
594
|
/**
|
|
@@ -596,7 +596,7 @@ const J = class J extends d {
|
|
|
596
596
|
* @param value - The value to check.
|
|
597
597
|
* @returns `true` if the value is a Prop, `false` otherwise.
|
|
598
598
|
*/
|
|
599
|
-
|
|
599
|
+
i(J, "is", (t) => (
|
|
600
600
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
601
601
|
t != null && t.$__prop__ === !0
|
|
602
602
|
));
|
|
@@ -606,7 +606,7 @@ const Z = (s, e, t = (r, n) => r === n) => {
|
|
|
606
606
|
return e.forEach((n) => n.setDerivative(r)), r;
|
|
607
607
|
}, je = (s, e, t = {}) => {
|
|
608
608
|
let r = t.once ? () => {
|
|
609
|
-
|
|
609
|
+
o(), s();
|
|
610
610
|
} : s;
|
|
611
611
|
if (t.skipInitial) {
|
|
612
612
|
let l = !1;
|
|
@@ -615,10 +615,10 @@ const Z = (s, e, t = (r, n) => r === n) => {
|
|
|
615
615
|
l ? c() : l = !0;
|
|
616
616
|
};
|
|
617
617
|
}
|
|
618
|
-
const n = Z(r, e),
|
|
619
|
-
n.dispose(), t.abortSignal != null && t.abortSignal.removeEventListener("abort",
|
|
618
|
+
const n = Z(r, e), o = () => {
|
|
619
|
+
n.dispose(), t.abortSignal != null && t.abortSignal.removeEventListener("abort", o);
|
|
620
620
|
};
|
|
621
|
-
return t.abortSignal != null && t.abortSignal.addEventListener("abort",
|
|
621
|
+
return t.abortSignal != null && t.abortSignal.addEventListener("abort", o), o;
|
|
622
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 = {
|
|
623
623
|
/**
|
|
624
624
|
* Maps a value or a Signal to a new value.
|
|
@@ -712,19 +712,19 @@ const Z = (s, e, t = (r, n) => r === n) => {
|
|
|
712
712
|
};
|
|
713
713
|
class ce {
|
|
714
714
|
constructor() {
|
|
715
|
-
|
|
715
|
+
i(this, "_store", /* @__PURE__ */ new Map());
|
|
716
716
|
/**
|
|
717
717
|
* Retrieves the value associated with the specified key from the memory store.
|
|
718
718
|
* @param key - The key to retrieve the value for.
|
|
719
719
|
* @returns The value associated with the key, or `null` if the key is not found.
|
|
720
720
|
*/
|
|
721
|
-
|
|
721
|
+
i(this, "getItem", (e) => this._store.get(e) ?? null);
|
|
722
722
|
/**
|
|
723
723
|
* Sets the value associated with the specified key in the memory store.
|
|
724
724
|
* @param key - The key to set the value for.
|
|
725
725
|
* @param value - The value to set.
|
|
726
726
|
*/
|
|
727
|
-
|
|
727
|
+
i(this, "setItem", (e, t) => {
|
|
728
728
|
this._store.set(e, t);
|
|
729
729
|
});
|
|
730
730
|
}
|
|
@@ -735,12 +735,12 @@ const ae = ({
|
|
|
735
735
|
store: t,
|
|
736
736
|
serialize: r = JSON.stringify,
|
|
737
737
|
deserialize: n = JSON.parse,
|
|
738
|
-
equals:
|
|
738
|
+
equals: o = (c, a) => c === a,
|
|
739
739
|
onLoad: l = (c) => c
|
|
740
740
|
}) => {
|
|
741
741
|
const c = t.getItem(s), a = new V(
|
|
742
742
|
c != null ? l(n(c)) : typeof e == "function" ? e() : e,
|
|
743
|
-
|
|
743
|
+
o
|
|
744
744
|
);
|
|
745
745
|
return a.on((u) => {
|
|
746
746
|
t.setItem(s, r(u));
|
|
@@ -762,7 +762,7 @@ function oe(s) {
|
|
|
762
762
|
return typeof requestAnimationFrame == "function" ? requestAnimationFrame(s) : setTimeout(s, 0);
|
|
763
763
|
}
|
|
764
764
|
const Fe = (s, e, t, r) => {
|
|
765
|
-
const n = (r == null ? void 0 : r.duration) ?? 300,
|
|
765
|
+
const n = (r == null ? void 0 : r.duration) ?? 300, o = (r == null ? void 0 : r.easing) ?? ((S) => S), l = (r == null ? void 0 : r.equals) ?? ((S, N) => S === N);
|
|
766
766
|
let c = r == null ? void 0 : r.interpolate, a = s, u = e(), h = performance.now(), g = null, y = !0;
|
|
767
767
|
const p = new P(e, l), m = E(s, l);
|
|
768
768
|
m.onDispose(() => {
|
|
@@ -773,7 +773,7 @@ const Fe = (s, e, t, r) => {
|
|
|
773
773
|
const C = (S) => {
|
|
774
774
|
u = S, h = performance.now(), a = m.value, y && (y = !1, g = oe(te));
|
|
775
775
|
}, te = () => {
|
|
776
|
-
const N = (performance.now() - h) / T.get(n), Me =
|
|
776
|
+
const N = (performance.now() - h) / T.get(n), Me = o(N);
|
|
777
777
|
c == null && (c = Re(a));
|
|
778
778
|
let se = c(a, u, Me);
|
|
779
779
|
N >= 1 ? (y = !0, se = u) : g = oe(te), m.set(se);
|
|
@@ -789,10 +789,10 @@ const Fe = (s, e, t, r) => {
|
|
|
789
789
|
);
|
|
790
790
|
}, Ht = (s, e) => {
|
|
791
791
|
const { signals: t, literals: r } = Object.entries(s).reduce(
|
|
792
|
-
({ signals:
|
|
792
|
+
({ signals: o, literals: l }, [c, a]) => (d.is(a) ? o.push([c, a]) : l[c] = a, { signals: o, literals: l }),
|
|
793
793
|
{ signals: [], literals: {} }
|
|
794
|
-
), n = t.map(([,
|
|
795
|
-
return Z(() => (t.forEach(([
|
|
794
|
+
), n = t.map(([, o]) => o);
|
|
795
|
+
return Z(() => (t.forEach(([o, l]) => r[o] = l.value), e(r)), n);
|
|
796
796
|
}, ue = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), he = /* @__PURE__ */ new Set(["selected"]), fe = /* @__PURE__ */ new Set([
|
|
797
797
|
"rowSpan",
|
|
798
798
|
"colSpan",
|
|
@@ -845,7 +845,7 @@ class L {
|
|
|
845
845
|
* @param namespace - The namespace URI to create the element in, or `undefined` to create a standard HTML element.
|
|
846
846
|
* @returns The newly created element.
|
|
847
847
|
*/
|
|
848
|
-
|
|
848
|
+
i(this, "createElement", (e, t) => t !== void 0 ? this.document.createElementNS(t, e) : this.document.createElement(e));
|
|
849
849
|
/**
|
|
850
850
|
* Creates a new child element and appends it to the current element, returning a new context.
|
|
851
851
|
*
|
|
@@ -868,7 +868,7 @@ class L {
|
|
|
868
868
|
* @param namespace - The namespace URI for the element, or undefined for HTML elements
|
|
869
869
|
* @returns A new DOMContext focused on the newly created child element
|
|
870
870
|
*/
|
|
871
|
-
|
|
871
|
+
i(this, "makeChildElement", (e, t) => {
|
|
872
872
|
const r = this.createElement(e, t);
|
|
873
873
|
return this.appendOrInsert(r), this.withElement(r);
|
|
874
874
|
});
|
|
@@ -877,13 +877,13 @@ class L {
|
|
|
877
877
|
* @param text - The text content for the new text node.
|
|
878
878
|
* @returns A new `Text` node with the specified text content.
|
|
879
879
|
*/
|
|
880
|
-
|
|
880
|
+
i(this, "createText", (e) => this.document.createTextNode(e));
|
|
881
881
|
/**
|
|
882
882
|
* Creates a new text node with the specified text content and appends it to the current element.
|
|
883
883
|
* @param text - The text content for the new text node.
|
|
884
884
|
* @returns A new `DOMContext` with a reference to the new text node.
|
|
885
885
|
*/
|
|
886
|
-
|
|
886
|
+
i(this, "makeChildText", (e) => {
|
|
887
887
|
const t = this.createText(e);
|
|
888
888
|
return this.appendOrInsert(t), this.withReference(t);
|
|
889
889
|
});
|
|
@@ -891,14 +891,14 @@ class L {
|
|
|
891
891
|
* Sets the text content of the current element.
|
|
892
892
|
* @param text - The text content to set.
|
|
893
893
|
*/
|
|
894
|
-
|
|
894
|
+
i(this, "setText", (e) => {
|
|
895
895
|
this.reference.nodeValue = e;
|
|
896
896
|
});
|
|
897
897
|
/**
|
|
898
898
|
* Gets the text content of the current element or text node.
|
|
899
899
|
* @returns The text content of the current element or text node.
|
|
900
900
|
*/
|
|
901
|
-
|
|
901
|
+
i(this, "getText", () => {
|
|
902
902
|
var e;
|
|
903
903
|
return ((e = this.reference) == null ? void 0 : e.nodeValue) ?? this.element.textContent ?? "";
|
|
904
904
|
});
|
|
@@ -907,7 +907,7 @@ class L {
|
|
|
907
907
|
* The text node is appended or inserted to the current `DOMContext`.
|
|
908
908
|
* The new `DOMContext` with the reference is returned.
|
|
909
909
|
*/
|
|
910
|
-
|
|
910
|
+
i(this, "makeRef", () => {
|
|
911
911
|
const e = this.createText("");
|
|
912
912
|
return this.appendOrInsert(e), this.withReference(e);
|
|
913
913
|
});
|
|
@@ -916,7 +916,7 @@ class L {
|
|
|
916
916
|
*
|
|
917
917
|
* @param child - The child node to append or insert.
|
|
918
918
|
*/
|
|
919
|
-
|
|
919
|
+
i(this, "appendOrInsert", (e) => {
|
|
920
920
|
this.reference === void 0 ? this.element.appendChild(e) : this.element.insertBefore(e, this.reference);
|
|
921
921
|
});
|
|
922
922
|
/**
|
|
@@ -924,7 +924,7 @@ class L {
|
|
|
924
924
|
* @param element - The DOM element to use in the new `DOMContext` instance.
|
|
925
925
|
* @returns A new `DOMContext` instance with the provided `element`.
|
|
926
926
|
*/
|
|
927
|
-
|
|
927
|
+
i(this, "withElement", (e) => new L(this.document, e, void 0, this.providers));
|
|
928
928
|
/**
|
|
929
929
|
* Creates a portal to render content in a different part of the DOM tree.
|
|
930
930
|
*
|
|
@@ -969,7 +969,7 @@ class L {
|
|
|
969
969
|
* @returns A new DOMContext focused on the portal target element
|
|
970
970
|
* @throws {Error} When the selector doesn't match any element in the document
|
|
971
971
|
*/
|
|
972
|
-
|
|
972
|
+
i(this, "makePortal", (e) => {
|
|
973
973
|
const t = typeof e == "string" ? this.document.querySelector(e) : e;
|
|
974
974
|
if (t == null)
|
|
975
975
|
throw new Error(`Cannot find element by selector for portal: ${e}`);
|
|
@@ -981,7 +981,7 @@ class L {
|
|
|
981
981
|
* @param reference - The optional `Text` node to use as the reference for the new `DOMContext`.
|
|
982
982
|
* @returns A new `DOMContext` instance with the specified reference.
|
|
983
983
|
*/
|
|
984
|
-
|
|
984
|
+
i(this, "withReference", (e) => new L(this.document, this.element, e, this.providers));
|
|
985
985
|
/**
|
|
986
986
|
* Sets a provider for the given provider mark.
|
|
987
987
|
*
|
|
@@ -989,7 +989,7 @@ class L {
|
|
|
989
989
|
* @param value - The provider to set for the given mark.
|
|
990
990
|
* @returns A new `DOMContext` instance with the specified provider.
|
|
991
991
|
*/
|
|
992
|
-
|
|
992
|
+
i(this, "setProvider", (e, t, r) => new L(this.document, this.element, this.reference, {
|
|
993
993
|
...this.providers,
|
|
994
994
|
[e]: [t, r]
|
|
995
995
|
}));
|
|
@@ -1000,34 +1000,34 @@ class L {
|
|
|
1000
1000
|
* @returns The provider for the given mark.
|
|
1001
1001
|
* @throws Throws `ProviderNotFoundError` if the provider for the given mark is not found.
|
|
1002
1002
|
*/
|
|
1003
|
-
|
|
1003
|
+
i(this, "getProvider", (e) => {
|
|
1004
1004
|
if (this.providers[e] === void 0)
|
|
1005
1005
|
throw new me(e);
|
|
1006
1006
|
const [t, r] = this.providers[e];
|
|
1007
1007
|
return { value: t, onUse: r };
|
|
1008
1008
|
});
|
|
1009
|
-
|
|
1009
|
+
i(this, "clear", (e) => {
|
|
1010
1010
|
e && (this.reference !== void 0 ? j(this.reference) : j(this.element));
|
|
1011
1011
|
});
|
|
1012
1012
|
/**
|
|
1013
1013
|
* Adds classes to the element.
|
|
1014
1014
|
* @param tokens - The class names to add.
|
|
1015
1015
|
*/
|
|
1016
|
-
|
|
1016
|
+
i(this, "addClasses", (e) => {
|
|
1017
1017
|
this.element.classList.add(...e);
|
|
1018
1018
|
});
|
|
1019
1019
|
/**
|
|
1020
1020
|
* Removes classes from the element.
|
|
1021
1021
|
* @param tokens - The class names to remove.
|
|
1022
1022
|
*/
|
|
1023
|
-
|
|
1023
|
+
i(this, "removeClasses", (e) => {
|
|
1024
1024
|
this.element.classList.remove(...e);
|
|
1025
1025
|
});
|
|
1026
1026
|
/**
|
|
1027
1027
|
* Gets the classes of the element.
|
|
1028
1028
|
* @returns The classes of the element.
|
|
1029
1029
|
*/
|
|
1030
|
-
|
|
1030
|
+
i(this, "getClasses", () => Array.from(this.element.classList));
|
|
1031
1031
|
/**
|
|
1032
1032
|
* Adds an event listener to the element.
|
|
1033
1033
|
* @param event - The event to listen for.
|
|
@@ -1035,10 +1035,10 @@ class L {
|
|
|
1035
1035
|
* @param options - The options for the event listener.
|
|
1036
1036
|
* @returns A function to remove the event listener.
|
|
1037
1037
|
*/
|
|
1038
|
-
|
|
1039
|
-
const n = (
|
|
1040
|
-
return this.element.addEventListener(e, n, r), (
|
|
1041
|
-
|
|
1038
|
+
i(this, "on", (e, t, r) => {
|
|
1039
|
+
const n = (o) => t(o, this);
|
|
1040
|
+
return this.element.addEventListener(e, n, r), (o) => {
|
|
1041
|
+
o && this.element.removeEventListener(e, n, r);
|
|
1042
1042
|
};
|
|
1043
1043
|
});
|
|
1044
1044
|
/**
|
|
@@ -1046,28 +1046,28 @@ class L {
|
|
|
1046
1046
|
* @returns `true` if the context is a browser DOM context.
|
|
1047
1047
|
* @deprecated Use `isBrowser()` instead.
|
|
1048
1048
|
*/
|
|
1049
|
-
|
|
1049
|
+
i(this, "isBrowserDOM", () => !0);
|
|
1050
1050
|
/**
|
|
1051
1051
|
* Returns `true` if the context is a browser context.
|
|
1052
1052
|
* @returns `true` if the context is a browser context.
|
|
1053
1053
|
*/
|
|
1054
|
-
|
|
1054
|
+
i(this, "isBrowser", () => !0);
|
|
1055
1055
|
/**
|
|
1056
1056
|
* Returns `true` if the context is a headless DOM context.
|
|
1057
1057
|
* @returns `true` if the context is a headless DOM context.
|
|
1058
1058
|
*/
|
|
1059
|
-
|
|
1059
|
+
i(this, "isHeadlessDOM", () => !1);
|
|
1060
1060
|
/**
|
|
1061
1061
|
* Returns `true` if the context is a headless context.
|
|
1062
1062
|
* @returns `true` if the context is a headless context.
|
|
1063
1063
|
*/
|
|
1064
|
-
|
|
1064
|
+
i(this, "isHeadless", () => !1);
|
|
1065
1065
|
/**
|
|
1066
1066
|
* Sets the style of the element.
|
|
1067
1067
|
* @param name - The name of the style to set.
|
|
1068
1068
|
* @param value - The value of the style to set.
|
|
1069
1069
|
*/
|
|
1070
|
-
|
|
1070
|
+
i(this, "setStyle", (e, t) => {
|
|
1071
1071
|
this.element.style[e] = t;
|
|
1072
1072
|
});
|
|
1073
1073
|
/**
|
|
@@ -1075,12 +1075,12 @@ class L {
|
|
|
1075
1075
|
* @param name - The name of the style to get.
|
|
1076
1076
|
* @returns The value of the style.
|
|
1077
1077
|
*/
|
|
1078
|
-
|
|
1079
|
-
|
|
1078
|
+
i(this, "getStyle", (e) => this.element.style[e]);
|
|
1079
|
+
i(this, "makeAccessors", (e) => ({
|
|
1080
1080
|
get: We(e, this.element),
|
|
1081
1081
|
set: Be(e, this.element)
|
|
1082
1082
|
}));
|
|
1083
|
-
|
|
1083
|
+
i(this, "getWindow", () => this.document.defaultView);
|
|
1084
1084
|
this.document = e, this.element = t, this.reference = r, this.providers = n;
|
|
1085
1085
|
}
|
|
1086
1086
|
/**
|
|
@@ -1098,14 +1098,14 @@ class L {
|
|
|
1098
1098
|
const Je = (s) => Symbol(s), K = (s, e) => {
|
|
1099
1099
|
const t = s(e);
|
|
1100
1100
|
return (r = !0) => t(r);
|
|
1101
|
-
}, $t = (s, e, { doc: t, clear: r, disposeWithParent: n = !0, providers:
|
|
1101
|
+
}, $t = (s, e, { doc: t, clear: r, disposeWithParent: n = !0, providers: o = {} } = {}) => {
|
|
1102
1102
|
const l = typeof e == "string" ? (t ?? document).querySelector(e) : e;
|
|
1103
1103
|
if (l === null)
|
|
1104
1104
|
throw new Ge(
|
|
1105
1105
|
`Cannot find element by selector for render: ${e}`
|
|
1106
1106
|
);
|
|
1107
1107
|
r !== !1 && (t ?? l.ownerDocument) != null && l.nodeType === 1 && (l.innerHTML = "");
|
|
1108
|
-
const c = Ue(l), a = ge(l) ? void 0 : l, u = L.of(c, a,
|
|
1108
|
+
const c = Ue(l), a = ge(l) ? void 0 : l, u = L.of(c, a, o), h = K(s, u);
|
|
1109
1109
|
let g;
|
|
1110
1110
|
return n && (g = new MutationObserver((y) => {
|
|
1111
1111
|
var p;
|
|
@@ -1126,10 +1126,10 @@ const Je = (s) => Symbol(s), K = (s, e) => {
|
|
|
1126
1126
|
} = {
|
|
1127
1127
|
selector: "body"
|
|
1128
1128
|
}) => {
|
|
1129
|
-
const n = T.toSignal(e).deriveProp(),
|
|
1129
|
+
const n = T.toSignal(e).deriveProp(), o = new Se(t, void 0), l = new D(o, void 0, { currentURL: n }, r);
|
|
1130
1130
|
return {
|
|
1131
1131
|
clear: K(s(), l),
|
|
1132
|
-
root:
|
|
1132
|
+
root: o,
|
|
1133
1133
|
currentURL: n
|
|
1134
1134
|
};
|
|
1135
1135
|
};
|
|
@@ -1145,7 +1145,7 @@ class Nt {
|
|
|
1145
1145
|
getAttribute: t,
|
|
1146
1146
|
setAttribute: r,
|
|
1147
1147
|
getClass: n,
|
|
1148
|
-
setClass:
|
|
1148
|
+
setClass: o,
|
|
1149
1149
|
getStyles: l,
|
|
1150
1150
|
setStyles: c,
|
|
1151
1151
|
appendHTML: a,
|
|
@@ -1159,74 +1159,74 @@ class Nt {
|
|
|
1159
1159
|
* @param selector - The selector to select elements from. The supported selectors are CSS selectors whose complexity depends on the adapter implementation.
|
|
1160
1160
|
* @returns An array of elements.
|
|
1161
1161
|
*/
|
|
1162
|
-
|
|
1162
|
+
i(this, "select");
|
|
1163
1163
|
/**
|
|
1164
1164
|
* Gets the value of an attribute from an element.
|
|
1165
1165
|
* @param el - The element to get the attribute from.
|
|
1166
1166
|
* @param attr - The attribute to get the value from.
|
|
1167
1167
|
* @returns The value of the attribute or null if the attribute is not set.
|
|
1168
1168
|
*/
|
|
1169
|
-
|
|
1169
|
+
i(this, "getAttribute");
|
|
1170
1170
|
/**
|
|
1171
1171
|
* Sets the value of an attribute on an element.
|
|
1172
1172
|
* @param el - The element to set the attribute on.
|
|
1173
1173
|
* @param attr - The attribute to set the value of.
|
|
1174
1174
|
* @param value - The value to set the attribute to.
|
|
1175
1175
|
*/
|
|
1176
|
-
|
|
1176
|
+
i(this, "setAttribute");
|
|
1177
1177
|
/**
|
|
1178
1178
|
* Gets the class of an element.
|
|
1179
1179
|
* @param el - The element to get the class from.
|
|
1180
1180
|
* @returns The class of the element or an empty string if the class is not set.
|
|
1181
1181
|
*/
|
|
1182
|
-
|
|
1182
|
+
i(this, "getClass");
|
|
1183
1183
|
/**
|
|
1184
1184
|
* Sets the class of an element.
|
|
1185
1185
|
* @param el - The element to set the class on.
|
|
1186
1186
|
* @param cls - The class to set.
|
|
1187
1187
|
*/
|
|
1188
|
-
|
|
1188
|
+
i(this, "setClass");
|
|
1189
1189
|
/**
|
|
1190
1190
|
* Gets the styles of an element.
|
|
1191
1191
|
* @param el - The element to get the styles from.
|
|
1192
1192
|
* @returns The styles of the element.
|
|
1193
1193
|
*/
|
|
1194
|
-
|
|
1194
|
+
i(this, "getStyles");
|
|
1195
1195
|
/**
|
|
1196
1196
|
* Sets the styles of an element.
|
|
1197
1197
|
* @param el - The element to set the styles on.
|
|
1198
1198
|
*/
|
|
1199
|
-
|
|
1199
|
+
i(this, "setStyles");
|
|
1200
1200
|
/**
|
|
1201
1201
|
* Appends HTML to an element.
|
|
1202
1202
|
* @param el - The element to append the HTML to.
|
|
1203
1203
|
* @param html - The HTML to append.
|
|
1204
1204
|
*/
|
|
1205
|
-
|
|
1205
|
+
i(this, "appendHTML");
|
|
1206
1206
|
/**
|
|
1207
1207
|
* Gets the inner HTML of an element.
|
|
1208
1208
|
* @param el - The element to get the inner HTML from.
|
|
1209
1209
|
* @returns The inner HTML of the element or an empty string if the inner HTML is not set.
|
|
1210
1210
|
*/
|
|
1211
|
-
|
|
1211
|
+
i(this, "getInnerHTML");
|
|
1212
1212
|
/**
|
|
1213
1213
|
* Sets the inner HTML of an element.
|
|
1214
1214
|
* @param el - The element to set the inner HTML on.
|
|
1215
1215
|
* @param html - The inner HTML to set.
|
|
1216
1216
|
*/
|
|
1217
|
-
|
|
1217
|
+
i(this, "setInnerHTML");
|
|
1218
1218
|
/**
|
|
1219
1219
|
* Gets the inner text of an element.
|
|
1220
1220
|
* @param el - The element to get the inner text from.
|
|
1221
1221
|
* @returns The inner text of the element or an empty string if the inner text is not set.
|
|
1222
1222
|
*/
|
|
1223
|
-
|
|
1223
|
+
i(this, "getInnerText");
|
|
1224
1224
|
/**
|
|
1225
1225
|
* Sets the inner text of an element.
|
|
1226
1226
|
* @param el - The element to set the inner text on.
|
|
1227
1227
|
* @param text - The inner text to set.
|
|
1228
1228
|
*/
|
|
1229
|
-
|
|
1229
|
+
i(this, "setInnerText");
|
|
1230
1230
|
/**
|
|
1231
1231
|
* Sets the content of the root element from a HeadlessPortal. Generally this will be the same instance that is
|
|
1232
1232
|
* returned by `runHeadless`.
|
|
@@ -1235,10 +1235,10 @@ class Nt {
|
|
|
1235
1235
|
* @param setPlaceholders - Whether to set placeholders for the content. This allows you to restore the original content
|
|
1236
1236
|
* when you render on the server and then hydrate on the client.
|
|
1237
1237
|
*/
|
|
1238
|
-
|
|
1238
|
+
i(this, "setFromRoot", (e, t) => {
|
|
1239
1239
|
e.getPortals().forEach((n) => {
|
|
1240
|
-
const
|
|
1241
|
-
for (const l of
|
|
1240
|
+
const o = typeof n.selector == "string" ? this.select(n.selector) : [n.selector];
|
|
1241
|
+
for (const l of o) {
|
|
1242
1242
|
if (l == null)
|
|
1243
1243
|
throw new Error(
|
|
1244
1244
|
`Cannot find element by selector for render: ${n.selector}`
|
|
@@ -1295,7 +1295,7 @@ class Nt {
|
|
|
1295
1295
|
}
|
|
1296
1296
|
});
|
|
1297
1297
|
});
|
|
1298
|
-
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 = o, this.getStyles = l, this.setStyles = c, this.appendHTML = a, this.getInnerHTML = u, this.setInnerHTML = h, this.getInnerText = g, this.setInnerText = y;
|
|
1299
1299
|
}
|
|
1300
1300
|
}
|
|
1301
1301
|
const Xe = () => {
|
|
@@ -1340,38 +1340,38 @@ const Xe = () => {
|
|
|
1340
1340
|
}, A = Symbol("class"), _ = Symbol("style"), x = Symbol("handler"), be = () => Math.random().toString(36).substring(2, 15), it = (s) => s.replace(/<[^>]*>?/g, "");
|
|
1341
1341
|
class Ae {
|
|
1342
1342
|
constructor(e) {
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1343
|
+
i(this, "id", be());
|
|
1344
|
+
i(this, "properties", {});
|
|
1345
|
+
i(this, "children", []);
|
|
1346
|
+
i(this, "isElement", () => !0);
|
|
1347
|
+
i(this, "isText", () => !1);
|
|
1348
|
+
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(""));
|
|
1349
|
+
i(this, "removeChild", (e) => {
|
|
1350
1350
|
const t = this.children.indexOf(e);
|
|
1351
1351
|
t !== -1 && this.children.splice(t, 1);
|
|
1352
1352
|
});
|
|
1353
|
-
|
|
1353
|
+
i(this, "remove", () => {
|
|
1354
1354
|
if (this.parent != null)
|
|
1355
1355
|
this.parent.removeChild(this);
|
|
1356
1356
|
else
|
|
1357
1357
|
throw new Error("Parent is undefined");
|
|
1358
1358
|
});
|
|
1359
|
-
|
|
1359
|
+
i(this, "getPortals", () => {
|
|
1360
1360
|
const e = this.elements().flatMap((t) => t.isPortal() ? [t, ...t.getPortals()] : t.getPortals());
|
|
1361
1361
|
return this.isPortal() && e.unshift(this), e;
|
|
1362
1362
|
});
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1363
|
+
i(this, "elements", () => this.children.filter((e) => e.isElement()));
|
|
1364
|
+
i(this, "hasInnerHTML", () => this.properties.innerHTML != null);
|
|
1365
|
+
i(this, "getInnerHTML", () => this.properties.innerHTML ?? "");
|
|
1366
|
+
i(this, "getInnerText", () => this.properties.innerText ?? "");
|
|
1367
|
+
i(this, "hasInnerText", () => this.properties.innerText != null);
|
|
1368
|
+
i(this, "hasChildren", () => this.children.length > 0);
|
|
1369
|
+
i(this, "hasClasses", () => this.properties[A] != null);
|
|
1370
|
+
i(this, "hasStyles", () => this.properties[_] != null);
|
|
1371
|
+
i(this, "hasAttributes", () => Object.keys(this.properties).length > 0);
|
|
1372
|
+
i(this, "hasHandlers", () => this.properties[x] != null);
|
|
1373
|
+
i(this, "hasRenderableProperties", () => this.hasClasses() || this.hasAttributes() || this.hasStyles());
|
|
1374
|
+
i(this, "getById", (e) => {
|
|
1375
1375
|
if (this.properties.id === e)
|
|
1376
1376
|
return this;
|
|
1377
1377
|
for (const t of this.elements()) {
|
|
@@ -1380,25 +1380,25 @@ class Ae {
|
|
|
1380
1380
|
return r;
|
|
1381
1381
|
}
|
|
1382
1382
|
});
|
|
1383
|
-
|
|
1383
|
+
i(this, "trigger", (e, t) => {
|
|
1384
1384
|
((this.properties[x] ?? {})[e] ?? []).forEach((n) => n(t));
|
|
1385
1385
|
});
|
|
1386
|
-
|
|
1386
|
+
i(this, "click", () => {
|
|
1387
1387
|
this.trigger("click", {});
|
|
1388
1388
|
});
|
|
1389
|
-
|
|
1389
|
+
i(this, "on", (e, t, r, n) => {
|
|
1390
1390
|
var a;
|
|
1391
|
-
const
|
|
1391
|
+
const o = (a = this.properties)[x] ?? (a[x] = {}), l = n != null && n.once ? (u) => {
|
|
1392
1392
|
c(), t(u, r);
|
|
1393
1393
|
} : (u) => t(u, r);
|
|
1394
|
-
|
|
1394
|
+
o[e] = [...o[e] ?? [], l];
|
|
1395
1395
|
const c = () => {
|
|
1396
|
-
const u =
|
|
1397
|
-
h !== -1 && (u.splice(h, 1), u.length === 0 ? (delete
|
|
1396
|
+
const u = o[e] ?? [], h = u.indexOf(l);
|
|
1397
|
+
h !== -1 && (u.splice(h, 1), u.length === 0 ? (delete o[e], Object.keys(o).length === 0 && delete this.properties[x]) : o[e] = u, (n == null ? void 0 : n.signal) != null && n.signal.removeEventListener("abort", c));
|
|
1398
1398
|
};
|
|
1399
1399
|
return (n == null ? void 0 : n.signal) != null && n.signal.addEventListener("abort", c), c;
|
|
1400
1400
|
});
|
|
1401
|
-
|
|
1401
|
+
i(this, "addClasses", (e) => {
|
|
1402
1402
|
var r;
|
|
1403
1403
|
if (e.length === 0)
|
|
1404
1404
|
return;
|
|
@@ -1407,34 +1407,34 @@ class Ae {
|
|
|
1407
1407
|
t.includes(n) || t.push(n);
|
|
1408
1408
|
});
|
|
1409
1409
|
});
|
|
1410
|
-
|
|
1410
|
+
i(this, "removeClasses", (e) => {
|
|
1411
1411
|
var r;
|
|
1412
1412
|
if (e.length === 0)
|
|
1413
1413
|
return;
|
|
1414
1414
|
const t = (r = this.properties)[A] ?? (r[A] = []);
|
|
1415
1415
|
e.forEach((n) => {
|
|
1416
|
-
const
|
|
1417
|
-
|
|
1416
|
+
const o = t.indexOf(n);
|
|
1417
|
+
o !== -1 && t.splice(o, 1);
|
|
1418
1418
|
}), t.length === 0 && delete this.properties[A];
|
|
1419
1419
|
});
|
|
1420
|
-
|
|
1421
|
-
|
|
1420
|
+
i(this, "getClasses", () => this.properties[A] ?? []);
|
|
1421
|
+
i(this, "getAttributes", () => Object.entries(this.properties).filter(
|
|
1422
1422
|
([e]) => !["innerText", "innerHTML"].includes(e)
|
|
1423
1423
|
));
|
|
1424
|
-
|
|
1424
|
+
i(this, "getVisibleAttributes", () => Reflect.ownKeys(this.properties).flatMap(
|
|
1425
1425
|
(e) => e === A ? [["class", this.getClasses()]] : e === _ ? [["style", this.getStyles()]] : typeof e == "string" ? [[e, String(this.properties[e])]] : []
|
|
1426
1426
|
));
|
|
1427
|
-
|
|
1427
|
+
i(this, "setStyle", (e, t) => {
|
|
1428
1428
|
var n;
|
|
1429
1429
|
const r = (n = this.properties)[_] ?? (n[_] = {});
|
|
1430
1430
|
r[e] = t, t === "" && (delete r[e], Object.keys(r).length === 0 && delete this.properties[_]);
|
|
1431
1431
|
});
|
|
1432
|
-
|
|
1432
|
+
i(this, "getStyle", (e) => {
|
|
1433
1433
|
var t;
|
|
1434
1434
|
return ((t = this.properties[_]) == null ? void 0 : t[e]) ?? "";
|
|
1435
1435
|
});
|
|
1436
|
-
|
|
1437
|
-
|
|
1436
|
+
i(this, "getStyles", () => this.properties[_] ?? {});
|
|
1437
|
+
i(this, "makeAccessors", (e) => {
|
|
1438
1438
|
const t = this.properties;
|
|
1439
1439
|
return {
|
|
1440
1440
|
get: () => t[e],
|
|
@@ -1448,12 +1448,12 @@ const ot = (s) => s.replace(/"/g, """), lt = (s) => s.replace(/&/g, "&"
|
|
|
1448
1448
|
class ct extends Ae {
|
|
1449
1449
|
constructor(t, r, n) {
|
|
1450
1450
|
super(n);
|
|
1451
|
-
|
|
1452
|
-
|
|
1451
|
+
i(this, "isPortal", () => !1);
|
|
1452
|
+
i(this, "toHTML", (t = !1) => {
|
|
1453
1453
|
const r = this.children.map((a) => a.toHTML()).join(""), n = this.namespace ? ` xmlns="${this.namespace}"` : "";
|
|
1454
|
-
let
|
|
1455
|
-
const l = this.getVisibleAttributes().map(([a, u]) => a === "class" ? ` class="${u.join(" ")}"` : a === "style" ? typeof u == "string" ? ` style="${u}"` : ` style="${Object.entries(u).map(([h, g]) => `${h}: ${g};`).join(" ")}"` : ut.has(a) ? ` ${a}` : a === "innerHTML" ? (
|
|
1456
|
-
return ht.has(this.tagName) && r === "" ? `<${this.tagName}${n}${l}${c} />` : `<${this.tagName}${n}${l}${c}>${
|
|
1454
|
+
let o = 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" ? (o = u, "") : a === "innerText" ? (o = 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}>${o ?? r}</${this.tagName}>`;
|
|
1457
1457
|
});
|
|
1458
1458
|
this.tagName = t, this.namespace = r;
|
|
1459
1459
|
}
|
|
@@ -1461,32 +1461,32 @@ class ct extends Ae {
|
|
|
1461
1461
|
class Se extends Ae {
|
|
1462
1462
|
constructor(t, r) {
|
|
1463
1463
|
super(r);
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1464
|
+
i(this, "isPortal", () => !0);
|
|
1465
|
+
i(this, "toHTML", () => "");
|
|
1466
|
+
i(this, "contentToHTML", (t = !1) => this.children.map((r) => r.toHTML(t)).join(""));
|
|
1467
1467
|
this.selector = t;
|
|
1468
1468
|
}
|
|
1469
1469
|
}
|
|
1470
1470
|
class at {
|
|
1471
1471
|
constructor(e) {
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1472
|
+
i(this, "id", be());
|
|
1473
|
+
i(this, "isElement", () => !1);
|
|
1474
|
+
i(this, "isText", () => !0);
|
|
1475
|
+
i(this, "getText", () => this.text);
|
|
1476
|
+
i(this, "toHTML", () => this.text);
|
|
1477
1477
|
this.text = e;
|
|
1478
1478
|
}
|
|
1479
1479
|
}
|
|
1480
1480
|
class D {
|
|
1481
1481
|
constructor(e, t, r, n) {
|
|
1482
|
-
|
|
1482
|
+
i(this, "appendOrInsert", (e) => {
|
|
1483
1483
|
if (this.reference != null) {
|
|
1484
1484
|
const t = this.element.children.indexOf(this.reference);
|
|
1485
1485
|
this.element.children.splice(t, 0, e);
|
|
1486
1486
|
} else
|
|
1487
1487
|
this.element.children.push(e);
|
|
1488
1488
|
});
|
|
1489
|
-
|
|
1489
|
+
i(this, "makeChildElement", (e, t) => {
|
|
1490
1490
|
const r = new ct(e, t, this.element);
|
|
1491
1491
|
return this.appendOrInsert(r), new D(
|
|
1492
1492
|
r,
|
|
@@ -1495,7 +1495,7 @@ class D {
|
|
|
1495
1495
|
this.providers
|
|
1496
1496
|
);
|
|
1497
1497
|
});
|
|
1498
|
-
|
|
1498
|
+
i(this, "makeChildText", (e) => {
|
|
1499
1499
|
const t = new at(e);
|
|
1500
1500
|
return this.appendOrInsert(t), new D(
|
|
1501
1501
|
this.element,
|
|
@@ -1504,15 +1504,15 @@ class D {
|
|
|
1504
1504
|
this.providers
|
|
1505
1505
|
);
|
|
1506
1506
|
});
|
|
1507
|
-
|
|
1507
|
+
i(this, "setText", (e) => {
|
|
1508
1508
|
this.reference && this.reference.isText() && (this.reference.text = e);
|
|
1509
1509
|
});
|
|
1510
|
-
|
|
1510
|
+
i(this, "getText", () => {
|
|
1511
1511
|
var e;
|
|
1512
1512
|
return ((e = this.reference) == null ? void 0 : e.getText()) ?? this.element.getText();
|
|
1513
1513
|
});
|
|
1514
|
-
|
|
1515
|
-
|
|
1514
|
+
i(this, "makeRef", () => this.makeChildText(""));
|
|
1515
|
+
i(this, "makePortal", (e) => {
|
|
1516
1516
|
const t = new Se(e, this.element);
|
|
1517
1517
|
return this.appendOrInsert(t), new D(
|
|
1518
1518
|
t,
|
|
@@ -1528,30 +1528,30 @@ class D {
|
|
|
1528
1528
|
* @param value - The provider to set for the given mark.
|
|
1529
1529
|
* @returns A new `DOMContext` instance with the specified provider.
|
|
1530
1530
|
*/
|
|
1531
|
-
|
|
1531
|
+
i(this, "setProvider", (e, t, r) => new D(this.element, this.reference, this.container, {
|
|
1532
1532
|
...this.providers,
|
|
1533
1533
|
[e]: [t, r]
|
|
1534
1534
|
}));
|
|
1535
|
-
|
|
1535
|
+
i(this, "getProvider", (e) => {
|
|
1536
1536
|
if (this.providers[e] === void 0)
|
|
1537
1537
|
throw new me(e);
|
|
1538
1538
|
const [t, r] = this.providers[e];
|
|
1539
1539
|
return { value: t, onUse: r };
|
|
1540
1540
|
});
|
|
1541
|
-
|
|
1541
|
+
i(this, "clear", (e) => {
|
|
1542
1542
|
e && (this.reference !== void 0 ? this.element.removeChild(this.reference) : this.element.remove());
|
|
1543
1543
|
});
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1544
|
+
i(this, "on", (e, t) => this.element.on(e, t, this));
|
|
1545
|
+
i(this, "addClasses", (e) => this.element.addClasses(e));
|
|
1546
|
+
i(this, "removeClasses", (e) => this.element.removeClasses(e));
|
|
1547
|
+
i(this, "getClasses", () => this.element.getClasses());
|
|
1548
|
+
i(this, "isBrowserDOM", () => !1);
|
|
1549
|
+
i(this, "isBrowser", () => !1);
|
|
1550
|
+
i(this, "isHeadlessDOM", () => !0);
|
|
1551
|
+
i(this, "isHeadless", () => !0);
|
|
1552
|
+
i(this, "setStyle", (e, t) => this.element.setStyle(e, t));
|
|
1553
|
+
i(this, "getStyle", (e) => this.element.getStyle(e));
|
|
1554
|
+
i(this, "makeAccessors", (e) => this.element.makeAccessors(e));
|
|
1555
1555
|
this.element = e, this.reference = t, this.container = r, this.providers = n;
|
|
1556
1556
|
}
|
|
1557
1557
|
}
|
|
@@ -1578,20 +1578,20 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1578
1578
|
}), dt = (s) => (e) => {
|
|
1579
1579
|
let t = [];
|
|
1580
1580
|
const r = s.on((n) => {
|
|
1581
|
-
e.removeClasses(t), t = (n ?? "").split(" ").filter((
|
|
1581
|
+
e.removeClasses(t), t = (n ?? "").split(" ").filter((o) => o.length > 0), e.addClasses(t);
|
|
1582
1582
|
});
|
|
1583
1583
|
return (n) => {
|
|
1584
1584
|
r(), n && e.removeClasses(t), t.length = 0;
|
|
1585
1585
|
};
|
|
1586
1586
|
}, $ = (s, e) => (t) => {
|
|
1587
|
-
const { get: r, set: n } = t.makeAccessors(s),
|
|
1587
|
+
const { get: r, set: n } = t.makeAccessors(s), o = r();
|
|
1588
1588
|
return n(e), (l) => {
|
|
1589
|
-
l && n(
|
|
1589
|
+
l && n(o);
|
|
1590
1590
|
};
|
|
1591
1591
|
}, k = (s, e) => (t) => {
|
|
1592
|
-
const { get: r, set: n } = t.makeAccessors(s),
|
|
1592
|
+
const { get: r, set: n } = t.makeAccessors(s), o = r(), l = e.on(n);
|
|
1593
1593
|
return (c) => {
|
|
1594
|
-
l(), c && n(
|
|
1594
|
+
l(), c && n(o);
|
|
1595
1595
|
};
|
|
1596
1596
|
}, M = new Proxy(
|
|
1597
1597
|
{},
|
|
@@ -1702,14 +1702,14 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1702
1702
|
return s;
|
|
1703
1703
|
throw new Error(`Unknown type: '${typeof s}' for child: ${s}`);
|
|
1704
1704
|
}, we = (s, ...e) => (t) => {
|
|
1705
|
-
const r = t.makeChildElement(s, void 0), n = e.map((
|
|
1706
|
-
return (
|
|
1707
|
-
n.forEach((l) => l(!1)), r.clear(
|
|
1705
|
+
const r = t.makeChildElement(s, void 0), n = e.map((o) => f(o)(r));
|
|
1706
|
+
return (o) => {
|
|
1707
|
+
n.forEach((l) => l(!1)), r.clear(o);
|
|
1708
1708
|
};
|
|
1709
1709
|
}, Ee = (s, e, ...t) => (r) => {
|
|
1710
|
-
const n = r.makeChildElement(s, e),
|
|
1710
|
+
const n = r.makeChildElement(s, e), o = t.map((l) => f(l)(n));
|
|
1711
1711
|
return (l) => {
|
|
1712
|
-
|
|
1712
|
+
o.forEach((c) => c(!1)), n.clear(l);
|
|
1713
1713
|
};
|
|
1714
1714
|
}, Bt = new Proxy(
|
|
1715
1715
|
{},
|
|
@@ -1754,10 +1754,10 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1754
1754
|
), Ce = (s, e) => {
|
|
1755
1755
|
if (typeof e == "function")
|
|
1756
1756
|
return Ce(s, { then: e });
|
|
1757
|
-
const t = e.pending != null ? f(e.pending()) : v, r = e.then, n = e.error != null ? (
|
|
1758
|
-
return (
|
|
1757
|
+
const t = e.pending != null ? f(e.pending()) : v, r = e.then, n = e.error != null ? (o) => f(e.error(o)) : () => v;
|
|
1758
|
+
return (o) => {
|
|
1759
1759
|
let l = !0;
|
|
1760
|
-
const c = s(), a =
|
|
1760
|
+
const c = s(), a = o.makeRef();
|
|
1761
1761
|
let u = f(t)(a);
|
|
1762
1762
|
return c.then(
|
|
1763
1763
|
(h) => {
|
|
@@ -1819,12 +1819,12 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1819
1819
|
const t = e.target;
|
|
1820
1820
|
if (t.value === "")
|
|
1821
1821
|
return;
|
|
1822
|
-
const r = t.value.split("T"), n = r[0].split("-"),
|
|
1822
|
+
const r = t.value.split("T"), n = r[0].split("-"), o = new Date(
|
|
1823
1823
|
Number(n[0]),
|
|
1824
1824
|
Number(n[1]) - 1,
|
|
1825
1825
|
Number(n[2])
|
|
1826
1826
|
), l = r[1].split(":");
|
|
1827
|
-
|
|
1827
|
+
o.setHours(Number(l[0])), o.setMinutes(Number(l[1])), o.setSeconds(Number(l[2])), s(o);
|
|
1828
1828
|
}, Yt = (s) => (e) => {
|
|
1829
1829
|
const t = e.target;
|
|
1830
1830
|
if (t.value === "") {
|
|
@@ -1836,12 +1836,12 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1836
1836
|
s(null);
|
|
1837
1837
|
return;
|
|
1838
1838
|
}
|
|
1839
|
-
const n = r[0].split("-"),
|
|
1839
|
+
const n = r[0].split("-"), o = new Date(
|
|
1840
1840
|
Number(n[0]),
|
|
1841
1841
|
Number(n[1]) - 1,
|
|
1842
1842
|
Number(n[2])
|
|
1843
1843
|
), l = r[1].split(":");
|
|
1844
|
-
|
|
1844
|
+
o.setHours(Number(l[0] ?? 0)), o.setMinutes(Number(l[1] ?? 0)), o.setSeconds(Number(l[2] ?? 0)), s(o);
|
|
1845
1845
|
}, zt = (s) => (e) => {
|
|
1846
1846
|
const t = e.target;
|
|
1847
1847
|
s(t.checked);
|
|
@@ -1855,18 +1855,18 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1855
1855
|
if (d.is(s))
|
|
1856
1856
|
return (r) => {
|
|
1857
1857
|
const n = r.makeRef();
|
|
1858
|
-
let
|
|
1858
|
+
let o, l;
|
|
1859
1859
|
const c = s.map((h) => Object.keys(h)[0]);
|
|
1860
1860
|
let a;
|
|
1861
1861
|
const u = c.on((h) => {
|
|
1862
1862
|
if (h !== a) {
|
|
1863
|
-
a = h, l == null || l.dispose(),
|
|
1863
|
+
a = h, l == null || l.dispose(), o == null || o(!0), l = s.map((y) => y[h]);
|
|
1864
1864
|
const g = e[h](l);
|
|
1865
|
-
|
|
1865
|
+
o = f(g)(n);
|
|
1866
1866
|
}
|
|
1867
1867
|
});
|
|
1868
1868
|
return (h) => {
|
|
1869
|
-
l == null || l.dispose(), u(), n.clear(h),
|
|
1869
|
+
l == null || l.dispose(), u(), n.clear(h), o == null || o(h);
|
|
1870
1870
|
};
|
|
1871
1871
|
};
|
|
1872
1872
|
const t = Object.keys(s)[0];
|
|
@@ -1884,7 +1884,7 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1884
1884
|
), cs = (s, e = {}) => (t) => {
|
|
1885
1885
|
const r = (e == null ? void 0 : e.firstSeparator) ?? s, n = (e == null ? void 0 : e.lastSeparator) ?? s;
|
|
1886
1886
|
return St(
|
|
1887
|
-
t.map((
|
|
1887
|
+
t.map((o) => o.isFirst ? "first" : o.isLast ? "last" : "other"),
|
|
1888
1888
|
{
|
|
1889
1889
|
first: r,
|
|
1890
1890
|
last: n,
|
|
@@ -1897,16 +1897,16 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1897
1897
|
if (d.is(s)) {
|
|
1898
1898
|
const r = s;
|
|
1899
1899
|
return (n) => {
|
|
1900
|
-
const
|
|
1900
|
+
const o = n.makeRef();
|
|
1901
1901
|
let l = () => {
|
|
1902
1902
|
}, c = !1, a = null;
|
|
1903
1903
|
const u = r.on((h) => {
|
|
1904
|
-
h == null ? (l(!0), l = f((t == null ? void 0 : t()) ?? v)(
|
|
1905
|
-
|
|
1904
|
+
h == null ? (l(!0), l = f((t == null ? void 0 : t()) ?? v)(o), c = !1, a == null || a.dispose(), a = null) : (a == null ? a = E(h) : a.value = h, c || (l(!0), l = f(e(a))(
|
|
1905
|
+
o
|
|
1906
1906
|
), c = !0));
|
|
1907
1907
|
});
|
|
1908
1908
|
return (h) => {
|
|
1909
|
-
a == null || a.dispose(), u(), l == null || l(h),
|
|
1909
|
+
a == null || a.dispose(), u(), l == null || l(h), o.clear(h);
|
|
1910
1910
|
};
|
|
1911
1911
|
};
|
|
1912
1912
|
} else {
|
|
@@ -1969,7 +1969,7 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1969
1969
|
return De(s, (r) => {
|
|
1970
1970
|
const n = new Q(
|
|
1971
1971
|
r.index,
|
|
1972
|
-
r.total.map((
|
|
1972
|
+
r.total.map((o) => o - 1)
|
|
1973
1973
|
);
|
|
1974
1974
|
return b(
|
|
1975
1975
|
O(n.dispose, r.dispose),
|
|
@@ -1983,48 +1983,48 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
1983
1983
|
});
|
|
1984
1984
|
if (d.is(s))
|
|
1985
1985
|
return (r) => {
|
|
1986
|
-
const n =
|
|
1987
|
-
|
|
1986
|
+
const n = s.derive(), o = r.makeRef(), l = [];
|
|
1987
|
+
return n.on((c) => {
|
|
1988
|
+
const a = l.splice(c);
|
|
1988
1989
|
for (const u of a)
|
|
1989
1990
|
u(!0);
|
|
1990
|
-
for (let u =
|
|
1991
|
-
const h = new Q(u,
|
|
1992
|
-
|
|
1991
|
+
for (let u = l.length; u < c; u++) {
|
|
1992
|
+
const h = new Q(u, n);
|
|
1993
|
+
l.push(
|
|
1993
1994
|
b(
|
|
1994
1995
|
O(h.dispose),
|
|
1995
1996
|
f(e(h))
|
|
1996
|
-
)(
|
|
1997
|
+
)(o)
|
|
1997
1998
|
);
|
|
1998
1999
|
}
|
|
1999
|
-
})
|
|
2000
|
-
|
|
2001
|
-
l
|
|
2002
|
-
for (const a of i)
|
|
2000
|
+
}), (c) => {
|
|
2001
|
+
n.dispose();
|
|
2002
|
+
for (const a of l)
|
|
2003
2003
|
a(c);
|
|
2004
|
-
|
|
2004
|
+
l.length = 0, o.clear(c);
|
|
2005
2005
|
};
|
|
2006
2006
|
};
|
|
2007
2007
|
{
|
|
2008
2008
|
const r = G(s);
|
|
2009
2009
|
return b(
|
|
2010
|
-
...Array.from({ length: s }, (n,
|
|
2011
|
-
const
|
|
2010
|
+
...Array.from({ length: s }, (n, o) => o).map((n) => {
|
|
2011
|
+
const o = new Q(n, r);
|
|
2012
2012
|
return b(
|
|
2013
|
-
O(
|
|
2014
|
-
f(e(
|
|
2013
|
+
O(o.dispose),
|
|
2014
|
+
f(e(o))
|
|
2015
2015
|
);
|
|
2016
2016
|
})
|
|
2017
2017
|
);
|
|
2018
2018
|
}
|
|
2019
2019
|
}, fs = (s, e, t) => {
|
|
2020
|
-
const r = T.map(s, (
|
|
2020
|
+
const r = T.map(s, (o) => o.length), n = T.toSignal(s);
|
|
2021
2021
|
return De(
|
|
2022
2022
|
r,
|
|
2023
|
-
(
|
|
2024
|
-
const l = n.map((c) => c[
|
|
2023
|
+
(o) => {
|
|
2024
|
+
const l = n.map((c) => c[o.index]);
|
|
2025
2025
|
return b(
|
|
2026
2026
|
O(l.dispose),
|
|
2027
|
-
f(e(l,
|
|
2027
|
+
f(e(l, o))
|
|
2028
2028
|
);
|
|
2029
2029
|
},
|
|
2030
2030
|
t
|
|
@@ -2035,13 +2035,13 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
2035
2035
|
return (r) => {
|
|
2036
2036
|
r = r.makeRef();
|
|
2037
2037
|
const n = t.map((c) => f(e(c)));
|
|
2038
|
-
let
|
|
2038
|
+
let o = () => {
|
|
2039
2039
|
};
|
|
2040
2040
|
const l = n.on((c) => {
|
|
2041
|
-
|
|
2041
|
+
o(!0), o = c(r);
|
|
2042
2042
|
});
|
|
2043
2043
|
return (c) => {
|
|
2044
|
-
l(),
|
|
2044
|
+
l(), o(c);
|
|
2045
2045
|
};
|
|
2046
2046
|
};
|
|
2047
2047
|
}
|
|
@@ -2067,15 +2067,15 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
2067
2067
|
};
|
|
2068
2068
|
if (R.has(s))
|
|
2069
2069
|
throw new Error(`Probe already exists: ${s.description}`);
|
|
2070
|
-
const n = setTimeout(() => r("timeout"), t),
|
|
2071
|
-
return R.set(s,
|
|
2070
|
+
const n = setTimeout(() => r("timeout"), t), o = { counter: 0, timeoutId: n };
|
|
2071
|
+
return R.set(s, o), {
|
|
2072
2072
|
value: () => {
|
|
2073
2073
|
clearTimeout(n);
|
|
2074
2074
|
const c = R.get(s);
|
|
2075
2075
|
c != null && --c.counter === 0 && r("resolved");
|
|
2076
2076
|
},
|
|
2077
2077
|
dispose: () => r("disposed"),
|
|
2078
|
-
onUse: () =>
|
|
2078
|
+
onUse: () => o.counter++
|
|
2079
2079
|
};
|
|
2080
2080
|
}
|
|
2081
2081
|
}), ms = _t(Symbol("GlobalProbe")), wt = (s, e) => (t) => {
|
|
@@ -2129,20 +2129,20 @@ const ut = /* @__PURE__ */ new Set([
|
|
|
2129
2129
|
function n(c) {
|
|
2130
2130
|
t = c;
|
|
2131
2131
|
}
|
|
2132
|
-
const
|
|
2132
|
+
const o = [], l = s({
|
|
2133
2133
|
use: ({ mark: c }) => {
|
|
2134
2134
|
const { value: a, onUse: u } = r().getProvider(c);
|
|
2135
2135
|
return u == null || u(), a;
|
|
2136
2136
|
},
|
|
2137
2137
|
set: ({ mark: c, create: a }, u) => {
|
|
2138
2138
|
const { value: h, dispose: g, onUse: y } = a(u, r());
|
|
2139
|
-
|
|
2139
|
+
o.push(g), n(r().setProvider(c, h, y));
|
|
2140
2140
|
}
|
|
2141
2141
|
});
|
|
2142
2142
|
return l == null ? () => {
|
|
2143
2143
|
} : b(
|
|
2144
2144
|
f(l),
|
|
2145
|
-
O(() =>
|
|
2145
|
+
O(() => o.forEach((c) => c()))
|
|
2146
2146
|
)(r());
|
|
2147
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 }) => {
|
|
2148
2148
|
const r = s.map(t);
|