stimeo-ui 0.18.0 → 0.18.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +52 -2
- data/dist/cable/index.js +6 -5
- data/dist/controllers/alert_dialog_controller.js +89 -45
- data/dist/controllers/announcer_controller.js +22 -9
- data/dist/controllers/auto_submit_controller.js +77 -11
- data/dist/controllers/bulk_select_controller.js +6 -9
- data/dist/controllers/character_counter_controller.js +77 -11
- data/dist/controllers/clipboard_controller.js +6 -5
- data/dist/controllers/combobox_controller.js +71 -6
- data/dist/controllers/command_palette_controller.js +161 -51
- data/dist/controllers/conditional_fields_controller.js +84 -44
- data/dist/controllers/confirm_controller.js +89 -45
- data/dist/controllers/context_menu_controller.js +1 -1
- data/dist/controllers/countdown_controller.js +6 -5
- data/dist/controllers/currency_input_controller.js +71 -6
- data/dist/controllers/data_grid_controller.js +77 -42
- data/dist/controllers/date_range_picker_controller.js +2 -1
- data/dist/controllers/dialog_controller.js +89 -45
- data/dist/controllers/direct_upload_controller.js +6 -5
- data/dist/controllers/dismissible_controller.js +13 -7
- data/dist/controllers/drawer_controller.js +89 -45
- data/dist/controllers/dropdown_controller.js +1 -1
- data/dist/controllers/editable_controller.js +72 -6
- data/dist/controllers/empty_state_controller.js +6 -5
- data/dist/controllers/file_dropzone_controller.js +13 -11
- data/dist/controllers/flash_controller.js +6 -5
- data/dist/controllers/focus_controller.js +89 -45
- data/dist/controllers/form_field_controller.js +6 -5
- data/dist/controllers/form_validation_controller.js +11 -7
- data/dist/controllers/frame_loading_controller.js +50 -16
- data/dist/controllers/hover_card_controller.js +1 -1
- data/dist/controllers/input_mask_controller.js +117 -36
- data/dist/controllers/intersection_controller.js +61 -29
- data/dist/controllers/lazy_frame_controller.js +61 -29
- data/dist/controllers/listbox_controller.js +80 -47
- data/dist/controllers/local_time_controller.js +1 -7
- data/dist/controllers/menu_controller.js +1 -1
- data/dist/controllers/menubar_controller.js +4 -6
- data/dist/controllers/meter_controller.js +6 -5
- data/dist/controllers/multi_select_controller.js +107 -22
- data/dist/controllers/navigation_menu_controller.js +1 -1
- data/dist/controllers/nested_form_controller.js +17 -12
- data/dist/controllers/network_status_controller.js +6 -5
- data/dist/controllers/number_input_controller.js +154 -66
- data/dist/controllers/otp_controller.js +71 -6
- data/dist/controllers/overflow_menu_controller.js +7 -2
- data/dist/controllers/pagination_controller.js +7 -2
- data/dist/controllers/password_strength_controller.js +6 -5
- data/dist/controllers/pointer_drag_controller.js +6 -1
- data/dist/controllers/popover_controller.js +21 -8
- data/dist/controllers/progress_controller.js +6 -5
- data/dist/controllers/radio_group_controller.js +85 -49
- data/dist/controllers/range_slider_controller.js +72 -54
- data/dist/controllers/relative_time_controller.js +1 -7
- data/dist/controllers/roving_controller.js +7 -2
- data/dist/controllers/scroll_area_controller.js +11 -7
- data/dist/controllers/scrollspy_controller.js +61 -29
- data/dist/controllers/separator_controller.js +72 -54
- data/dist/controllers/sidebar_controller.js +89 -45
- data/dist/controllers/skeleton_controller.js +50 -16
- data/dist/controllers/slider_controller.js +72 -54
- data/dist/controllers/sortable_controller.js +6 -5
- data/dist/controllers/spinner_controller.js +50 -16
- data/dist/controllers/sticky_observer_controller.js +61 -29
- data/dist/controllers/submit_once_controller.js +6 -5
- data/dist/controllers/switch_controller.js +84 -44
- data/dist/controllers/tags_input_controller.js +83 -20
- data/dist/controllers/time_picker_controller.js +77 -42
- data/dist/controllers/toggle_group_controller.js +84 -44
- data/dist/controllers/toolbar_controller.js +78 -8
- data/dist/controllers/tooltip_controller.js +1 -1
- data/dist/controllers/tree_view_controller.js +87 -49
- data/dist/index.js +566 -288
- data/lib/stimeo/ui/version.rb +1 -1
- metadata +2 -2
|
@@ -54,6 +54,7 @@ var EscapeLayer = class _EscapeLayer {
|
|
|
54
54
|
);
|
|
55
55
|
#active = null;
|
|
56
56
|
activate(ownerDocument = document, options) {
|
|
57
|
+
const entry = { onDismiss: options.onDismiss, claims: options.claims ?? null };
|
|
57
58
|
this.deactivate();
|
|
58
59
|
let registry = _EscapeLayer.#registries.get(ownerDocument);
|
|
59
60
|
if (!registry) {
|
|
@@ -61,7 +62,6 @@ var EscapeLayer = class _EscapeLayer {
|
|
|
61
62
|
_EscapeLayer.#registries.set(ownerDocument, registry);
|
|
62
63
|
ownerDocument.addEventListener("keydown", registry.onKeydown);
|
|
63
64
|
}
|
|
64
|
-
const entry = { onDismiss: options.onDismiss, claims: options.claims ?? null };
|
|
65
65
|
registry.stack.push(entry);
|
|
66
66
|
this.#active = { document: ownerDocument, entry };
|
|
67
67
|
}
|
|
@@ -110,11 +110,16 @@ var EscapeLayer = class _EscapeLayer {
|
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
+
var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
|
113
114
|
function inheritsFieldsetDisabled(control) {
|
|
114
115
|
let fieldset = control.closest("fieldset[disabled]");
|
|
115
116
|
while (fieldset) {
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
if (fieldset.namespaceURI === HTML_NAMESPACE && fieldset.localName === "fieldset") {
|
|
118
|
+
const legend = Array.from(fieldset.children).find(
|
|
119
|
+
(child) => child.namespaceURI === HTML_NAMESPACE && child.localName === "legend"
|
|
120
|
+
);
|
|
121
|
+
if (!legend?.contains(control)) return true;
|
|
122
|
+
}
|
|
118
123
|
fieldset = fieldset.parentElement?.closest("fieldset[disabled]") ?? null;
|
|
119
124
|
}
|
|
120
125
|
return false;
|
|
@@ -187,11 +192,10 @@ function hasNativeTabStop(element) {
|
|
|
187
192
|
if (element.tagName === "AUDIO" || element.tagName === "VIDEO") {
|
|
188
193
|
return element.hasAttribute("controls");
|
|
189
194
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
return false;
|
|
195
|
+
const details = element.parentElement;
|
|
196
|
+
return details instanceof HTMLDetailsElement && Array.from(details.children).find(
|
|
197
|
+
(child) => child.namespaceURI === HTML_NAMESPACE && child.localName === "summary"
|
|
198
|
+
) === element;
|
|
195
199
|
}
|
|
196
200
|
function hasEditableTabStop(element) {
|
|
197
201
|
const value = element.getAttribute("contenteditable")?.toLowerCase();
|
|
@@ -254,8 +258,7 @@ function isSequentialStop(element) {
|
|
|
254
258
|
function ownedScope(element) {
|
|
255
259
|
if (element.shadowRoot) return Array.from(element.shadowRoot.children);
|
|
256
260
|
if (element instanceof HTMLSlotElement) {
|
|
257
|
-
|
|
258
|
-
return assigned.length > 0 ? assigned : Array.from(element.children);
|
|
261
|
+
return element.assignedNodes().length > 0 ? element.assignedElements() : Array.from(element.children);
|
|
259
262
|
}
|
|
260
263
|
return null;
|
|
261
264
|
}
|
|
@@ -264,12 +267,19 @@ function orderScope(elements, walk) {
|
|
|
264
267
|
const visit = (element) => {
|
|
265
268
|
if (element === walk.from) walk.fromAt = walk.tree.length;
|
|
266
269
|
const tabindex = authoredTabindex(element) ?? 0;
|
|
267
|
-
|
|
268
|
-
if (
|
|
270
|
+
let stop = null;
|
|
271
|
+
if ((element instanceof HTMLElement || element instanceof SVGElement) && isSequentialStop(element)) {
|
|
272
|
+
stop = element;
|
|
273
|
+
walk.tree.push(element);
|
|
274
|
+
}
|
|
269
275
|
const owned = ownedScope(element);
|
|
270
276
|
if (owned) {
|
|
271
277
|
if (tabindex >= 0) {
|
|
272
278
|
entries.push({ tabindex, stops: [...stop ? [stop] : [], ...orderScope(owned, walk)] });
|
|
279
|
+
} else if (walk.from && flatTreeContains(element, walk.from)) {
|
|
280
|
+
walk.fromAt = walk.tree.length;
|
|
281
|
+
walk.excludedScope = element;
|
|
282
|
+
orderScope(owned, { from: walk.from, tree: walk.tree, fromAt: -1, excludedScope: null });
|
|
273
283
|
}
|
|
274
284
|
return;
|
|
275
285
|
}
|
|
@@ -297,16 +307,38 @@ function startIndex(order, walk, backward, isStop) {
|
|
|
297
307
|
if (at >= 0) return backward ? at - 1 : at + 1;
|
|
298
308
|
const neighbour = backward ? walk.tree.slice(0, walk.fromAt).reverse().find(isStop) : walk.tree.slice(walk.fromAt).find(isStop);
|
|
299
309
|
if (neighbour) return order.indexOf(neighbour);
|
|
300
|
-
return backward ?
|
|
310
|
+
return backward ? -1 : order.length;
|
|
301
311
|
}
|
|
302
|
-
function
|
|
303
|
-
const walk = {
|
|
312
|
+
function movesWithin(root, from, backward, wrap, radioContext) {
|
|
313
|
+
const walk = {
|
|
314
|
+
from,
|
|
315
|
+
tree: [],
|
|
316
|
+
fromAt: from === root ? 0 : -1,
|
|
317
|
+
excludedScope: null
|
|
318
|
+
};
|
|
304
319
|
const order = orderScope(ownedScope(root) ?? Array.from(root.children), walk);
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
320
|
+
const radios = radioContext ?? {
|
|
321
|
+
tree: walk.tree,
|
|
322
|
+
focusedRadio: walk.fromAt >= 0 && isRadio(from) ? from : null
|
|
323
|
+
};
|
|
324
|
+
const isStop = (element) => passesRadioRule(element, radios.tree, radios.focusedRadio);
|
|
325
|
+
const start = startIndex(
|
|
326
|
+
order,
|
|
327
|
+
walk,
|
|
328
|
+
backward,
|
|
329
|
+
(element) => order.includes(element) && isStop(element)
|
|
330
|
+
);
|
|
331
|
+
const remaining = backward ? order.slice(0, start + 1).reverse() : order.slice(start);
|
|
332
|
+
const wrapped = wrap ? backward ? order.slice(start + 1).reverse() : order.slice(0, start) : [];
|
|
333
|
+
const excluded = walk.excludedScope;
|
|
334
|
+
const prefix = excluded && !(backward && from === excluded) ? movesWithin(excluded, from === excluded ? null : from, backward, false, radios) : [];
|
|
335
|
+
return [
|
|
336
|
+
...prefix,
|
|
337
|
+
...[...remaining, ...wrapped].filter((element) => element !== from && isStop(element))
|
|
338
|
+
];
|
|
339
|
+
}
|
|
340
|
+
function sequentialTabStops(root, from = null, backward = false) {
|
|
341
|
+
return movesWithin(root, from, backward, true);
|
|
310
342
|
}
|
|
311
343
|
function deepActiveElement(ownerDocument) {
|
|
312
344
|
let active = ownerDocument.activeElement;
|
|
@@ -500,7 +532,10 @@ var FocusTrap = class _FocusTrap {
|
|
|
500
532
|
constructor(getContainer, options = {}) {
|
|
501
533
|
this.#getContainer = getContainer;
|
|
502
534
|
this.#options = options;
|
|
503
|
-
this.#entry =
|
|
535
|
+
this.#entry = this.#createEntry();
|
|
536
|
+
}
|
|
537
|
+
#createEntry() {
|
|
538
|
+
return {
|
|
504
539
|
container: () => this.#readContainer(),
|
|
505
540
|
moveFocus: (backward) => this.#moveFocus(backward),
|
|
506
541
|
refocus: () => this.#refocus(),
|
|
@@ -516,6 +551,7 @@ var FocusTrap = class _FocusTrap {
|
|
|
516
551
|
activate() {
|
|
517
552
|
if (this.#activeState) return;
|
|
518
553
|
_FocusTrap.#sweep();
|
|
554
|
+
this.#entry = this.#createEntry();
|
|
519
555
|
this.#activeState = true;
|
|
520
556
|
this.#openers = _FocusTrap.#focusPath();
|
|
521
557
|
this.#entry.openedFrom = _FocusTrap.#trapHolding(this.#openers[0] ?? null);
|
|
@@ -532,14 +568,20 @@ var FocusTrap = class _FocusTrap {
|
|
|
532
568
|
this.#returnTabindexes();
|
|
533
569
|
return;
|
|
534
570
|
}
|
|
571
|
+
const entry = this.#entry;
|
|
572
|
+
const openers = this.#openers;
|
|
573
|
+
this.#openers = [];
|
|
535
574
|
this.#activeState = false;
|
|
536
575
|
this.#escapeLayer.deactivate();
|
|
537
|
-
const above = this.#leaveStack();
|
|
538
|
-
this.#unlockScroll();
|
|
576
|
+
const above = this.#leaveStack(entry);
|
|
577
|
+
this.#unlockScroll(entry);
|
|
539
578
|
_FocusTrap.#reconcileBackground(document);
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
579
|
+
try {
|
|
580
|
+
const wayBack = this.#handOver(entry, openers, above);
|
|
581
|
+
if (restoreFocus) this.#restore(wayBack, above);
|
|
582
|
+
} finally {
|
|
583
|
+
this.#returnTabindexes();
|
|
584
|
+
}
|
|
543
585
|
}
|
|
544
586
|
connect() {
|
|
545
587
|
this.#gate.cancel();
|
|
@@ -578,9 +620,9 @@ var FocusTrap = class _FocusTrap {
|
|
|
578
620
|
}
|
|
579
621
|
registry.stack.push(this.#entry);
|
|
580
622
|
}
|
|
581
|
-
#leaveStack() {
|
|
623
|
+
#leaveStack(entry) {
|
|
582
624
|
const registry = _FocusTrap.#registry(document);
|
|
583
|
-
const index = registry.stack.indexOf(
|
|
625
|
+
const index = registry.stack.indexOf(entry);
|
|
584
626
|
const above = registry.stack.slice(index + 1);
|
|
585
627
|
registry.stack.splice(index, 1);
|
|
586
628
|
if (registry.stack.length === 0) {
|
|
@@ -604,21 +646,23 @@ var FocusTrap = class _FocusTrap {
|
|
|
604
646
|
}
|
|
605
647
|
return null;
|
|
606
648
|
}
|
|
607
|
-
#handOver(above) {
|
|
608
|
-
const
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
this.#options.fallbackFocus?.() ?? null,
|
|
612
|
-
...entry.handedBack
|
|
613
|
-
].filter((element) => element !== null);
|
|
614
|
-
for (const trap of above) {
|
|
615
|
-
if (trap.openedFrom !== entry) continue;
|
|
616
|
-
trap.handedBack = [...trap.handedBack, ...wayBack];
|
|
617
|
-
trap.openedFrom = entry.openedFrom;
|
|
618
|
-
}
|
|
619
|
-
this.#openers = [];
|
|
649
|
+
#handOver(entry, openers, above) {
|
|
650
|
+
const wayBack = [...openers];
|
|
651
|
+
const parent = entry.openedFrom;
|
|
652
|
+
const handedBack = entry.handedBack;
|
|
620
653
|
entry.openedFrom = null;
|
|
621
654
|
entry.handedBack = [];
|
|
655
|
+
try {
|
|
656
|
+
const fallback = this.#options.fallbackFocus?.();
|
|
657
|
+
if (fallback) wayBack.push(fallback);
|
|
658
|
+
} finally {
|
|
659
|
+
wayBack.push(...handedBack);
|
|
660
|
+
for (const trap of above) {
|
|
661
|
+
if (trap.openedFrom !== entry) continue;
|
|
662
|
+
trap.handedBack = [...trap.handedBack, ...wayBack];
|
|
663
|
+
trap.openedFrom = parent;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
622
666
|
return wayBack;
|
|
623
667
|
}
|
|
624
668
|
#restore(wayBack, above) {
|
|
@@ -668,11 +712,11 @@ var FocusTrap = class _FocusTrap {
|
|
|
668
712
|
this.#entry.lockedBody = body;
|
|
669
713
|
body.style.overflow = "hidden";
|
|
670
714
|
}
|
|
671
|
-
#unlockScroll() {
|
|
715
|
+
#unlockScroll(entry) {
|
|
672
716
|
const registry = _FocusTrap.#registry(document);
|
|
673
|
-
const body =
|
|
674
|
-
|
|
675
|
-
if (!registry.scrollLocks.delete(
|
|
717
|
+
const body = entry.lockedBody;
|
|
718
|
+
entry.lockedBody = null;
|
|
719
|
+
if (!registry.scrollLocks.delete(entry) || !body) return;
|
|
676
720
|
if (!_FocusTrap.#isLocked(registry, body)) _FocusTrap.#unlock(body);
|
|
677
721
|
}
|
|
678
722
|
static #isLocked(registry, body) {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Controller } from '@hotwired/stimulus';
|
|
2
2
|
|
|
3
|
+
var afterFocus = /* @__PURE__ */ Symbol.for("stimeo--announcer:after-focus");
|
|
3
4
|
function announce(message, options = {}) {
|
|
4
5
|
const text = message.trim();
|
|
5
6
|
if (text.length === 0) return;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
);
|
|
7
|
+
const event = new CustomEvent("stimeo--announcer:announce", {
|
|
8
|
+
detail: { message: text, assertive: options.assertive === true }
|
|
9
|
+
});
|
|
10
|
+
if (options.afterFocus) event[afterFocus] = true;
|
|
11
|
+
window.dispatchEvent(event);
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
function sharedRegistry(key, create) {
|
|
@@ -6,11 +6,16 @@ function setDefaultAttribute(element, name, value) {
|
|
|
6
6
|
return true;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
|
9
10
|
function inheritsFieldsetDisabled(control) {
|
|
10
11
|
let fieldset = control.closest("fieldset[disabled]");
|
|
11
12
|
while (fieldset) {
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
if (fieldset.namespaceURI === HTML_NAMESPACE && fieldset.localName === "fieldset") {
|
|
14
|
+
const legend = Array.from(fieldset.children).find(
|
|
15
|
+
(child) => child.namespaceURI === HTML_NAMESPACE && child.localName === "legend"
|
|
16
|
+
);
|
|
17
|
+
if (!legend?.contains(control)) return true;
|
|
18
|
+
}
|
|
14
19
|
fieldset = fieldset.parentElement?.closest("fieldset[disabled]") ?? null;
|
|
15
20
|
}
|
|
16
21
|
return false;
|
|
@@ -68,11 +73,10 @@ function hasNativeTabStop(element) {
|
|
|
68
73
|
if (element.tagName === "AUDIO" || element.tagName === "VIDEO") {
|
|
69
74
|
return element.hasAttribute("controls");
|
|
70
75
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return false;
|
|
76
|
+
const details = element.parentElement;
|
|
77
|
+
return details instanceof HTMLDetailsElement && Array.from(details.children).find(
|
|
78
|
+
(child) => child.namespaceURI === HTML_NAMESPACE && child.localName === "summary"
|
|
79
|
+
) === element;
|
|
76
80
|
}
|
|
77
81
|
function hasEditableTabStop(element) {
|
|
78
82
|
const value = element.getAttribute("contenteditable")?.toLowerCase();
|
|
@@ -7,14 +7,15 @@ function fillTemplate(template, values) {
|
|
|
7
7
|
});
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
var afterFocus = /* @__PURE__ */ Symbol.for("stimeo--announcer:after-focus");
|
|
10
11
|
function announce(message, options = {}) {
|
|
11
12
|
const text = message.trim();
|
|
12
13
|
if (text.length === 0) return;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
);
|
|
14
|
+
const event = new CustomEvent("stimeo--announcer:announce", {
|
|
15
|
+
detail: { message: text, assertive: options.assertive === true }
|
|
16
|
+
});
|
|
17
|
+
if (options.afterFocus) event[afterFocus] = true;
|
|
18
|
+
window.dispatchEvent(event);
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
function setAttributeIfChanged(element, name, value, beforeWrite) {
|
|
@@ -220,7 +221,7 @@ var ListenerSet = class {
|
|
|
220
221
|
|
|
221
222
|
var MinDurationFloor = class {
|
|
222
223
|
#timers;
|
|
223
|
-
#
|
|
224
|
+
#task = null;
|
|
224
225
|
#since = 0;
|
|
225
226
|
constructor(timers) {
|
|
226
227
|
this.#timers = timers;
|
|
@@ -229,25 +230,19 @@ var MinDurationFloor = class {
|
|
|
229
230
|
this.#since = Date.now();
|
|
230
231
|
}
|
|
231
232
|
get pending() {
|
|
232
|
-
return this.#
|
|
233
|
+
return this.#task?.pending ?? false;
|
|
233
234
|
}
|
|
234
235
|
schedule(minDuration, finish) {
|
|
235
236
|
this.cancel();
|
|
236
237
|
const remaining = minDuration - (Date.now() - this.#since);
|
|
237
238
|
if (remaining > 0) {
|
|
238
|
-
this.#
|
|
239
|
-
this.#timerId = null;
|
|
240
|
-
finish();
|
|
241
|
-
}, remaining);
|
|
239
|
+
this.#task = this.#timers.setTask(finish, remaining);
|
|
242
240
|
} else {
|
|
243
241
|
finish();
|
|
244
242
|
}
|
|
245
243
|
}
|
|
246
244
|
cancel() {
|
|
247
|
-
|
|
248
|
-
this.#timers.clear(this.#timerId);
|
|
249
|
-
this.#timerId = null;
|
|
250
|
-
}
|
|
245
|
+
this.#task?.cancel();
|
|
251
246
|
}
|
|
252
247
|
};
|
|
253
248
|
|
|
@@ -314,6 +309,22 @@ var TimerRegistry = class {
|
|
|
314
309
|
return this.ids.size;
|
|
315
310
|
}
|
|
316
311
|
};
|
|
312
|
+
var TimeoutRegistration = class {
|
|
313
|
+
#registration;
|
|
314
|
+
constructor(owner, id) {
|
|
315
|
+
this.#registration = { owner, id };
|
|
316
|
+
}
|
|
317
|
+
get pending() {
|
|
318
|
+
return this.#registration !== null;
|
|
319
|
+
}
|
|
320
|
+
cancel() {
|
|
321
|
+
const registration = this.#registration;
|
|
322
|
+
if (registration) registration.owner.clear(registration.id);
|
|
323
|
+
}
|
|
324
|
+
expire() {
|
|
325
|
+
this.#registration = null;
|
|
326
|
+
}
|
|
327
|
+
};
|
|
317
328
|
var SafeTimeout = class extends TimerRegistry {
|
|
318
329
|
set(callback, delay) {
|
|
319
330
|
const id = this.schedule(() => {
|
|
@@ -330,6 +341,29 @@ var SafeTimeout = class extends TimerRegistry {
|
|
|
330
341
|
window.clearTimeout(id);
|
|
331
342
|
}
|
|
332
343
|
};
|
|
344
|
+
var TaskTimeout = class extends SafeTimeout {
|
|
345
|
+
#tasks = /* @__PURE__ */ new Map();
|
|
346
|
+
setTask(callback, delay) {
|
|
347
|
+
const id = this.set(() => {
|
|
348
|
+
this.#tasks.delete(id);
|
|
349
|
+
registration.expire();
|
|
350
|
+
callback();
|
|
351
|
+
}, delay);
|
|
352
|
+
const registration = new TimeoutRegistration(this, id);
|
|
353
|
+
this.#tasks.set(id, registration);
|
|
354
|
+
return registration;
|
|
355
|
+
}
|
|
356
|
+
clear(id) {
|
|
357
|
+
this.#tasks.get(id)?.expire();
|
|
358
|
+
this.#tasks.delete(id);
|
|
359
|
+
super.clear(id);
|
|
360
|
+
}
|
|
361
|
+
clearAll() {
|
|
362
|
+
for (const registration of this.#tasks.values()) registration.expire();
|
|
363
|
+
this.#tasks.clear();
|
|
364
|
+
super.clearAll();
|
|
365
|
+
}
|
|
366
|
+
};
|
|
333
367
|
|
|
334
368
|
var FrameLoadingController = class _FrameLoadingController extends Controller {
|
|
335
369
|
#numbers = new NumberValueReader();
|
|
@@ -344,7 +378,7 @@ var FrameLoadingController = class _FrameLoadingController extends Controller {
|
|
|
344
378
|
minDuration: NUMBER_BOUNDS.timer
|
|
345
379
|
};
|
|
346
380
|
static events = ["start", "end", "reconcile"];
|
|
347
|
-
#timeouts = new
|
|
381
|
+
#timeouts = new TaskTimeout();
|
|
348
382
|
#floor = new MinDurationFloor(this.#timeouts);
|
|
349
383
|
#gate = new DetachGate();
|
|
350
384
|
#listeners = new ListenerSet();
|
|
@@ -160,6 +160,7 @@ var EscapeLayer = class _EscapeLayer {
|
|
|
160
160
|
);
|
|
161
161
|
#active = null;
|
|
162
162
|
activate(ownerDocument = document, options) {
|
|
163
|
+
const entry = { onDismiss: options.onDismiss, claims: options.claims ?? null };
|
|
163
164
|
this.deactivate();
|
|
164
165
|
let registry2 = _EscapeLayer.#registries.get(ownerDocument);
|
|
165
166
|
if (!registry2) {
|
|
@@ -167,7 +168,6 @@ var EscapeLayer = class _EscapeLayer {
|
|
|
167
168
|
_EscapeLayer.#registries.set(ownerDocument, registry2);
|
|
168
169
|
ownerDocument.addEventListener("keydown", registry2.onKeydown);
|
|
169
170
|
}
|
|
170
|
-
const entry = { onDismiss: options.onDismiss, claims: options.claims ?? null };
|
|
171
171
|
registry2.stack.push(entry);
|
|
172
172
|
this.#active = { document: ownerDocument, entry };
|
|
173
173
|
}
|