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
|
@@ -46,43 +46,66 @@ function setAttributeIfChanged(element, name, value, beforeWrite) {
|
|
|
46
46
|
|
|
47
47
|
var AuthoredMutationWatcher = class {
|
|
48
48
|
#onAuthored;
|
|
49
|
-
#
|
|
50
|
-
#observer = null;
|
|
49
|
+
#lifetime = null;
|
|
51
50
|
constructor(onAuthored) {
|
|
52
51
|
this.#onAuthored = onAuthored;
|
|
53
52
|
}
|
|
54
53
|
observe(root, options) {
|
|
55
|
-
this
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
this.#
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
54
|
+
const previous = this.#lifetime;
|
|
55
|
+
const lifetime = {
|
|
56
|
+
observer: null,
|
|
57
|
+
active: false,
|
|
58
|
+
claims: { attributes: /* @__PURE__ */ new Map(), children: /* @__PURE__ */ new Map() }
|
|
59
|
+
};
|
|
60
|
+
this.#lifetime = lifetime;
|
|
61
|
+
let observer = null;
|
|
62
|
+
try {
|
|
63
|
+
if (previous) this.#release(previous);
|
|
64
|
+
if (this.#lifetime !== lifetime) return;
|
|
65
|
+
const attributes = [...options.attributes];
|
|
66
|
+
const subtree = options.subtree ?? false;
|
|
67
|
+
const childList = options.childList ?? false;
|
|
68
|
+
const inherited = options.ancestorAttributes;
|
|
69
|
+
const ancestorAttributes = inherited ? [...inherited] : null;
|
|
70
|
+
if (this.#lifetime !== lifetime) return;
|
|
71
|
+
observer = new MutationObserver((records) => {
|
|
72
|
+
const authored = this.#filter(records, lifetime.claims);
|
|
73
|
+
if (this.#lifetime === lifetime && lifetime.active && authored.length > 0) {
|
|
74
|
+
this.#onAuthored(authored);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
if (this.#lifetime !== lifetime) return;
|
|
78
|
+
lifetime.observer = observer;
|
|
79
|
+
observer.observe(root, { attributes: true, attributeFilter: attributes, subtree, childList });
|
|
80
|
+
if (this.#lifetime !== lifetime) {
|
|
81
|
+
this.#release(lifetime, observer);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (ancestorAttributes) {
|
|
85
|
+
let ancestor = root.parentElement;
|
|
86
|
+
while (ancestor) {
|
|
87
|
+
observer.observe(ancestor, { attributes: true, attributeFilter: ancestorAttributes });
|
|
88
|
+
if (this.#lifetime !== lifetime) {
|
|
89
|
+
this.#release(lifetime, observer);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
ancestor = ancestor.parentElement;
|
|
93
|
+
}
|
|
77
94
|
}
|
|
95
|
+
lifetime.active = true;
|
|
96
|
+
} catch (error) {
|
|
97
|
+
this.#release(lifetime, observer);
|
|
98
|
+
throw error;
|
|
78
99
|
}
|
|
79
100
|
}
|
|
80
101
|
claim(target, name, value) {
|
|
81
|
-
const
|
|
82
|
-
|
|
102
|
+
const lifetime = this.#lifetime;
|
|
103
|
+
if (!lifetime?.active) return;
|
|
104
|
+
const claims = lifetime.claims.attributes;
|
|
105
|
+
let attributes = claims.get(target);
|
|
83
106
|
if (!attributes) {
|
|
84
107
|
attributes = /* @__PURE__ */ new Map();
|
|
85
|
-
claims
|
|
108
|
+
claims.set(target, attributes);
|
|
86
109
|
}
|
|
87
110
|
const pending = attributes.get(name);
|
|
88
111
|
attributes.set(name, { value, count: (pending?.count ?? 0) + 1 });
|
|
@@ -91,37 +114,49 @@ var AuthoredMutationWatcher = class {
|
|
|
91
114
|
this.claim(target, name, target.getAttribute(name));
|
|
92
115
|
}
|
|
93
116
|
claimChildList(target, added, removed) {
|
|
94
|
-
const
|
|
95
|
-
|
|
117
|
+
const lifetime = this.#lifetime;
|
|
118
|
+
if (!lifetime?.active) return;
|
|
119
|
+
const claims = lifetime.claims.children;
|
|
120
|
+
const pending = claims.get(target) ?? { added: /* @__PURE__ */ new Map(), removed: /* @__PURE__ */ new Map() };
|
|
96
121
|
for (const node of added) pending.added.set(node, (pending.added.get(node) ?? 0) + 1);
|
|
97
122
|
for (const node of removed) pending.removed.set(node, (pending.removed.get(node) ?? 0) + 1);
|
|
98
|
-
claims
|
|
123
|
+
claims.set(target, pending);
|
|
99
124
|
}
|
|
100
125
|
take() {
|
|
101
|
-
|
|
126
|
+
const lifetime = this.#lifetime;
|
|
127
|
+
const observer = lifetime?.observer;
|
|
128
|
+
if (!lifetime?.active || !observer) return [];
|
|
129
|
+
const records = observer.takeRecords();
|
|
130
|
+
const authored = this.#filter(records, lifetime.claims);
|
|
131
|
+
return this.#lifetime === lifetime && lifetime.active ? authored : [];
|
|
102
132
|
}
|
|
103
133
|
disconnect() {
|
|
104
|
-
this.#
|
|
105
|
-
this.#
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
134
|
+
const lifetime = this.#lifetime;
|
|
135
|
+
if (lifetime) this.#release(lifetime);
|
|
136
|
+
}
|
|
137
|
+
#release(lifetime, observer = lifetime.observer) {
|
|
138
|
+
if (this.#lifetime === lifetime) this.#lifetime = null;
|
|
139
|
+
lifetime.claims.attributes.clear();
|
|
140
|
+
lifetime.claims.children.clear();
|
|
141
|
+
observer?.disconnect();
|
|
142
|
+
}
|
|
143
|
+
#filter(records, claims) {
|
|
144
|
+
const authored = records.filter((record) => !this.#consume(record, claims));
|
|
145
|
+
claims.attributes.clear();
|
|
146
|
+
claims.children.clear();
|
|
112
147
|
return authored;
|
|
113
148
|
}
|
|
114
|
-
#consume(record) {
|
|
149
|
+
#consume(record, claims) {
|
|
115
150
|
if (record.type === "attributes") {
|
|
116
151
|
const target = record.target;
|
|
117
|
-
const pending2 =
|
|
152
|
+
const pending2 = claims.attributes.get(target)?.get(record.attributeName);
|
|
118
153
|
if (!pending2 || pending2.count === 0 || target.getAttribute(record.attributeName) !== pending2.value) {
|
|
119
154
|
return false;
|
|
120
155
|
}
|
|
121
156
|
pending2.count -= 1;
|
|
122
157
|
return true;
|
|
123
158
|
}
|
|
124
|
-
const pending =
|
|
159
|
+
const pending = claims.children.get(record.target);
|
|
125
160
|
if (!pending) return false;
|
|
126
161
|
const added = [...record.addedNodes];
|
|
127
162
|
const removed = [...record.removedNodes];
|
|
@@ -710,7 +710,8 @@ var DateRangePickerController = class extends Controller {
|
|
|
710
710
|
if (!el || !date) continue;
|
|
711
711
|
const iso = toISODateString(date);
|
|
712
712
|
el.setAttribute("data-date", iso);
|
|
713
|
-
|
|
713
|
+
const dayText = String(date.getDate());
|
|
714
|
+
if (el.textContent !== dayText) el.textContent = dayText;
|
|
714
715
|
el.setAttribute("data-outside", String(date.getMonth() !== month - 1));
|
|
715
716
|
el.setAttribute("data-today", String(iso === todayStr));
|
|
716
717
|
el.setAttribute("tabindex", iso === focusedStr ? "0" : "-1");
|
|
@@ -197,6 +197,7 @@ var EscapeLayer = class _EscapeLayer {
|
|
|
197
197
|
);
|
|
198
198
|
#active = null;
|
|
199
199
|
activate(ownerDocument = document, options) {
|
|
200
|
+
const entry = { onDismiss: options.onDismiss, claims: options.claims ?? null };
|
|
200
201
|
this.deactivate();
|
|
201
202
|
let registry2 = _EscapeLayer.#registries.get(ownerDocument);
|
|
202
203
|
if (!registry2) {
|
|
@@ -204,7 +205,6 @@ var EscapeLayer = class _EscapeLayer {
|
|
|
204
205
|
_EscapeLayer.#registries.set(ownerDocument, registry2);
|
|
205
206
|
ownerDocument.addEventListener("keydown", registry2.onKeydown);
|
|
206
207
|
}
|
|
207
|
-
const entry = { onDismiss: options.onDismiss, claims: options.claims ?? null };
|
|
208
208
|
registry2.stack.push(entry);
|
|
209
209
|
this.#active = { document: ownerDocument, entry };
|
|
210
210
|
}
|
|
@@ -253,11 +253,16 @@ var EscapeLayer = class _EscapeLayer {
|
|
|
253
253
|
}
|
|
254
254
|
};
|
|
255
255
|
|
|
256
|
+
var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
|
256
257
|
function inheritsFieldsetDisabled(control) {
|
|
257
258
|
let fieldset = control.closest("fieldset[disabled]");
|
|
258
259
|
while (fieldset) {
|
|
259
|
-
|
|
260
|
-
|
|
260
|
+
if (fieldset.namespaceURI === HTML_NAMESPACE && fieldset.localName === "fieldset") {
|
|
261
|
+
const legend = Array.from(fieldset.children).find(
|
|
262
|
+
(child) => child.namespaceURI === HTML_NAMESPACE && child.localName === "legend"
|
|
263
|
+
);
|
|
264
|
+
if (!legend?.contains(control)) return true;
|
|
265
|
+
}
|
|
261
266
|
fieldset = fieldset.parentElement?.closest("fieldset[disabled]") ?? null;
|
|
262
267
|
}
|
|
263
268
|
return false;
|
|
@@ -330,11 +335,10 @@ function hasNativeTabStop(element) {
|
|
|
330
335
|
if (element.tagName === "AUDIO" || element.tagName === "VIDEO") {
|
|
331
336
|
return element.hasAttribute("controls");
|
|
332
337
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
return false;
|
|
338
|
+
const details = element.parentElement;
|
|
339
|
+
return details instanceof HTMLDetailsElement && Array.from(details.children).find(
|
|
340
|
+
(child) => child.namespaceURI === HTML_NAMESPACE && child.localName === "summary"
|
|
341
|
+
) === element;
|
|
338
342
|
}
|
|
339
343
|
function hasEditableTabStop(element) {
|
|
340
344
|
const value = element.getAttribute("contenteditable")?.toLowerCase();
|
|
@@ -397,8 +401,7 @@ function isSequentialStop(element) {
|
|
|
397
401
|
function ownedScope(element) {
|
|
398
402
|
if (element.shadowRoot) return Array.from(element.shadowRoot.children);
|
|
399
403
|
if (element instanceof HTMLSlotElement) {
|
|
400
|
-
|
|
401
|
-
return assigned.length > 0 ? assigned : Array.from(element.children);
|
|
404
|
+
return element.assignedNodes().length > 0 ? element.assignedElements() : Array.from(element.children);
|
|
402
405
|
}
|
|
403
406
|
return null;
|
|
404
407
|
}
|
|
@@ -407,12 +410,19 @@ function orderScope(elements, walk) {
|
|
|
407
410
|
const visit = (element) => {
|
|
408
411
|
if (element === walk.from) walk.fromAt = walk.tree.length;
|
|
409
412
|
const tabindex = authoredTabindex(element) ?? 0;
|
|
410
|
-
|
|
411
|
-
if (
|
|
413
|
+
let stop = null;
|
|
414
|
+
if ((element instanceof HTMLElement || element instanceof SVGElement) && isSequentialStop(element)) {
|
|
415
|
+
stop = element;
|
|
416
|
+
walk.tree.push(element);
|
|
417
|
+
}
|
|
412
418
|
const owned = ownedScope(element);
|
|
413
419
|
if (owned) {
|
|
414
420
|
if (tabindex >= 0) {
|
|
415
421
|
entries.push({ tabindex, stops: [...stop ? [stop] : [], ...orderScope(owned, walk)] });
|
|
422
|
+
} else if (walk.from && flatTreeContains(element, walk.from)) {
|
|
423
|
+
walk.fromAt = walk.tree.length;
|
|
424
|
+
walk.excludedScope = element;
|
|
425
|
+
orderScope(owned, { from: walk.from, tree: walk.tree, fromAt: -1, excludedScope: null });
|
|
416
426
|
}
|
|
417
427
|
return;
|
|
418
428
|
}
|
|
@@ -440,16 +450,38 @@ function startIndex(order, walk, backward, isStop) {
|
|
|
440
450
|
if (at >= 0) return backward ? at - 1 : at + 1;
|
|
441
451
|
const neighbour = backward ? walk.tree.slice(0, walk.fromAt).reverse().find(isStop) : walk.tree.slice(walk.fromAt).find(isStop);
|
|
442
452
|
if (neighbour) return order.indexOf(neighbour);
|
|
443
|
-
return backward ?
|
|
453
|
+
return backward ? -1 : order.length;
|
|
444
454
|
}
|
|
445
|
-
function
|
|
446
|
-
const walk = {
|
|
455
|
+
function movesWithin(root, from, backward, wrap, radioContext) {
|
|
456
|
+
const walk = {
|
|
457
|
+
from,
|
|
458
|
+
tree: [],
|
|
459
|
+
fromAt: from === root ? 0 : -1,
|
|
460
|
+
excludedScope: null
|
|
461
|
+
};
|
|
447
462
|
const order = orderScope(ownedScope(root) ?? Array.from(root.children), walk);
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
463
|
+
const radios = radioContext ?? {
|
|
464
|
+
tree: walk.tree,
|
|
465
|
+
focusedRadio: walk.fromAt >= 0 && isRadio(from) ? from : null
|
|
466
|
+
};
|
|
467
|
+
const isStop = (element) => passesRadioRule(element, radios.tree, radios.focusedRadio);
|
|
468
|
+
const start = startIndex(
|
|
469
|
+
order,
|
|
470
|
+
walk,
|
|
471
|
+
backward,
|
|
472
|
+
(element) => order.includes(element) && isStop(element)
|
|
473
|
+
);
|
|
474
|
+
const remaining = backward ? order.slice(0, start + 1).reverse() : order.slice(start);
|
|
475
|
+
const wrapped = wrap ? backward ? order.slice(start + 1).reverse() : order.slice(0, start) : [];
|
|
476
|
+
const excluded = walk.excludedScope;
|
|
477
|
+
const prefix = excluded && !(backward && from === excluded) ? movesWithin(excluded, from === excluded ? null : from, backward, false, radios) : [];
|
|
478
|
+
return [
|
|
479
|
+
...prefix,
|
|
480
|
+
...[...remaining, ...wrapped].filter((element) => element !== from && isStop(element))
|
|
481
|
+
];
|
|
482
|
+
}
|
|
483
|
+
function sequentialTabStops(root, from = null, backward = false) {
|
|
484
|
+
return movesWithin(root, from, backward, true);
|
|
453
485
|
}
|
|
454
486
|
function deepActiveElement(ownerDocument) {
|
|
455
487
|
let active = ownerDocument.activeElement;
|
|
@@ -636,7 +668,10 @@ var FocusTrap = class _FocusTrap {
|
|
|
636
668
|
constructor(getContainer, options = {}) {
|
|
637
669
|
this.#getContainer = getContainer;
|
|
638
670
|
this.#options = options;
|
|
639
|
-
this.#entry =
|
|
671
|
+
this.#entry = this.#createEntry();
|
|
672
|
+
}
|
|
673
|
+
#createEntry() {
|
|
674
|
+
return {
|
|
640
675
|
container: () => this.#readContainer(),
|
|
641
676
|
moveFocus: (backward) => this.#moveFocus(backward),
|
|
642
677
|
refocus: () => this.#refocus(),
|
|
@@ -652,6 +687,7 @@ var FocusTrap = class _FocusTrap {
|
|
|
652
687
|
activate() {
|
|
653
688
|
if (this.#activeState) return;
|
|
654
689
|
_FocusTrap.#sweep();
|
|
690
|
+
this.#entry = this.#createEntry();
|
|
655
691
|
this.#activeState = true;
|
|
656
692
|
this.#openers = _FocusTrap.#focusPath();
|
|
657
693
|
this.#entry.openedFrom = _FocusTrap.#trapHolding(this.#openers[0] ?? null);
|
|
@@ -668,14 +704,20 @@ var FocusTrap = class _FocusTrap {
|
|
|
668
704
|
this.#returnTabindexes();
|
|
669
705
|
return;
|
|
670
706
|
}
|
|
707
|
+
const entry = this.#entry;
|
|
708
|
+
const openers = this.#openers;
|
|
709
|
+
this.#openers = [];
|
|
671
710
|
this.#activeState = false;
|
|
672
711
|
this.#escapeLayer.deactivate();
|
|
673
|
-
const above = this.#leaveStack();
|
|
674
|
-
this.#unlockScroll();
|
|
712
|
+
const above = this.#leaveStack(entry);
|
|
713
|
+
this.#unlockScroll(entry);
|
|
675
714
|
_FocusTrap.#reconcileBackground(document);
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
715
|
+
try {
|
|
716
|
+
const wayBack = this.#handOver(entry, openers, above);
|
|
717
|
+
if (restoreFocus) this.#restore(wayBack, above);
|
|
718
|
+
} finally {
|
|
719
|
+
this.#returnTabindexes();
|
|
720
|
+
}
|
|
679
721
|
}
|
|
680
722
|
connect() {
|
|
681
723
|
this.#gate.cancel();
|
|
@@ -714,9 +756,9 @@ var FocusTrap = class _FocusTrap {
|
|
|
714
756
|
}
|
|
715
757
|
registry2.stack.push(this.#entry);
|
|
716
758
|
}
|
|
717
|
-
#leaveStack() {
|
|
759
|
+
#leaveStack(entry) {
|
|
718
760
|
const registry2 = _FocusTrap.#registry(document);
|
|
719
|
-
const index = registry2.stack.indexOf(
|
|
761
|
+
const index = registry2.stack.indexOf(entry);
|
|
720
762
|
const above = registry2.stack.slice(index + 1);
|
|
721
763
|
registry2.stack.splice(index, 1);
|
|
722
764
|
if (registry2.stack.length === 0) {
|
|
@@ -740,21 +782,23 @@ var FocusTrap = class _FocusTrap {
|
|
|
740
782
|
}
|
|
741
783
|
return null;
|
|
742
784
|
}
|
|
743
|
-
#handOver(above) {
|
|
744
|
-
const
|
|
745
|
-
const
|
|
746
|
-
|
|
747
|
-
this.#options.fallbackFocus?.() ?? null,
|
|
748
|
-
...entry.handedBack
|
|
749
|
-
].filter((element) => element !== null);
|
|
750
|
-
for (const trap of above) {
|
|
751
|
-
if (trap.openedFrom !== entry) continue;
|
|
752
|
-
trap.handedBack = [...trap.handedBack, ...wayBack];
|
|
753
|
-
trap.openedFrom = entry.openedFrom;
|
|
754
|
-
}
|
|
755
|
-
this.#openers = [];
|
|
785
|
+
#handOver(entry, openers, above) {
|
|
786
|
+
const wayBack = [...openers];
|
|
787
|
+
const parent = entry.openedFrom;
|
|
788
|
+
const handedBack = entry.handedBack;
|
|
756
789
|
entry.openedFrom = null;
|
|
757
790
|
entry.handedBack = [];
|
|
791
|
+
try {
|
|
792
|
+
const fallback = this.#options.fallbackFocus?.();
|
|
793
|
+
if (fallback) wayBack.push(fallback);
|
|
794
|
+
} finally {
|
|
795
|
+
wayBack.push(...handedBack);
|
|
796
|
+
for (const trap of above) {
|
|
797
|
+
if (trap.openedFrom !== entry) continue;
|
|
798
|
+
trap.handedBack = [...trap.handedBack, ...wayBack];
|
|
799
|
+
trap.openedFrom = parent;
|
|
800
|
+
}
|
|
801
|
+
}
|
|
758
802
|
return wayBack;
|
|
759
803
|
}
|
|
760
804
|
#restore(wayBack, above) {
|
|
@@ -804,11 +848,11 @@ var FocusTrap = class _FocusTrap {
|
|
|
804
848
|
this.#entry.lockedBody = body;
|
|
805
849
|
body.style.overflow = "hidden";
|
|
806
850
|
}
|
|
807
|
-
#unlockScroll() {
|
|
851
|
+
#unlockScroll(entry) {
|
|
808
852
|
const registry2 = _FocusTrap.#registry(document);
|
|
809
|
-
const body =
|
|
810
|
-
|
|
811
|
-
if (!registry2.scrollLocks.delete(
|
|
853
|
+
const body = entry.lockedBody;
|
|
854
|
+
entry.lockedBody = null;
|
|
855
|
+
if (!registry2.scrollLocks.delete(entry) || !body) return;
|
|
812
856
|
if (!_FocusTrap.#isLocked(registry2, body)) _FocusTrap.#unlock(body);
|
|
813
857
|
}
|
|
814
858
|
static #isLocked(registry2, body) {
|
|
@@ -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 parseDeclared(raw, parse, fallback) {
|
|
@@ -153,11 +153,16 @@ var AttributeLease = class {
|
|
|
153
153
|
}
|
|
154
154
|
};
|
|
155
155
|
|
|
156
|
+
var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
|
156
157
|
function inheritsFieldsetDisabled(control) {
|
|
157
158
|
let fieldset = control.closest("fieldset[disabled]");
|
|
158
159
|
while (fieldset) {
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
if (fieldset.namespaceURI === HTML_NAMESPACE && fieldset.localName === "fieldset") {
|
|
161
|
+
const legend = Array.from(fieldset.children).find(
|
|
162
|
+
(child) => child.namespaceURI === HTML_NAMESPACE && child.localName === "legend"
|
|
163
|
+
);
|
|
164
|
+
if (!legend?.contains(control)) return true;
|
|
165
|
+
}
|
|
161
166
|
fieldset = fieldset.parentElement?.closest("fieldset[disabled]") ?? null;
|
|
162
167
|
}
|
|
163
168
|
return false;
|
|
@@ -215,11 +220,10 @@ function hasNativeTabStop(element) {
|
|
|
215
220
|
if (element.tagName === "AUDIO" || element.tagName === "VIDEO") {
|
|
216
221
|
return element.hasAttribute("controls");
|
|
217
222
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
return false;
|
|
223
|
+
const details = element.parentElement;
|
|
224
|
+
return details instanceof HTMLDetailsElement && Array.from(details.children).find(
|
|
225
|
+
(child) => child.namespaceURI === HTML_NAMESPACE && child.localName === "summary"
|
|
226
|
+
) === element;
|
|
223
227
|
}
|
|
224
228
|
function hasEditableTabStop(element) {
|
|
225
229
|
const value = element.getAttribute("contenteditable")?.toLowerCase();
|
|
@@ -323,6 +327,8 @@ var DismissibleController = class extends Controller {
|
|
|
323
327
|
if (document.activeElement === candidate) return;
|
|
324
328
|
}
|
|
325
329
|
document.body.focus();
|
|
330
|
+
const remaining = document.activeElement;
|
|
331
|
+
if (remaining instanceof HTMLElement && root.contains(remaining)) remaining.blur();
|
|
326
332
|
}
|
|
327
333
|
*#focusFallbacks(root) {
|
|
328
334
|
const explicitFallback = this.hasFallbackTarget ? this.fallbackTarget : null;
|