stimeo-ui 0.18.1 → 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 +21 -0
- 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 +160 -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 +11 -7
- data/dist/controllers/drawer_controller.js +89 -45
- data/dist/controllers/dropdown_controller.js +1 -1
- data/dist/controllers/editable_controller.js +71 -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 +94 -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 +86 -21
- 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/popover_controller.js +12 -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 +503 -286
- data/lib/stimeo/ui/version.rb +1 -1
- metadata +2 -2
|
@@ -31,70 +31,102 @@ function queryRoot(selector) {
|
|
|
31
31
|
}
|
|
32
32
|
var IntersectionWatcher = class {
|
|
33
33
|
#onEntries;
|
|
34
|
-
#
|
|
35
|
-
#active = false;
|
|
36
|
-
#usingPlatformDefaults = false;
|
|
34
|
+
#session = null;
|
|
37
35
|
constructor(onEntries) {
|
|
38
36
|
this.#onEntries = onEntries;
|
|
39
37
|
}
|
|
40
38
|
get active() {
|
|
41
|
-
return this.#active;
|
|
39
|
+
return this.#session?.active ?? false;
|
|
42
40
|
}
|
|
43
41
|
get usingPlatformDefaults() {
|
|
44
|
-
return this.#usingPlatformDefaults;
|
|
42
|
+
return this.#session?.usingPlatformDefaults ?? false;
|
|
45
43
|
}
|
|
46
44
|
start(targets, options = {}) {
|
|
47
|
-
this
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
const previous = this.#session;
|
|
46
|
+
const session = {
|
|
47
|
+
observer: null,
|
|
48
|
+
active: false,
|
|
49
|
+
usingPlatformDefaults: false
|
|
50
|
+
};
|
|
51
|
+
this.#session = session;
|
|
52
52
|
let observer = null;
|
|
53
53
|
try {
|
|
54
|
+
if (previous) this.#release(previous);
|
|
55
|
+
if (this.#session !== session) return false;
|
|
56
|
+
if (typeof IntersectionObserver === "undefined") return false;
|
|
57
|
+
const list = Array.isArray(targets) ? targets : [targets];
|
|
58
|
+
const empty = list.length === 0;
|
|
59
|
+
if (this.#session !== session) return false;
|
|
60
|
+
if (empty) return false;
|
|
61
|
+
const root = "root" in options ? options.root ?? null : queryRoot(options.rootSelector);
|
|
62
|
+
if (this.#session !== session) return false;
|
|
54
63
|
const onEntries = (entries) => {
|
|
55
|
-
if (this.#
|
|
64
|
+
if (this.#session === session && session.active) this.#onEntries(entries);
|
|
56
65
|
};
|
|
66
|
+
let usingPlatformDefaults = false;
|
|
57
67
|
try {
|
|
58
|
-
|
|
68
|
+
const configured = {
|
|
59
69
|
root,
|
|
60
70
|
rootMargin: options.rootMargin,
|
|
61
71
|
threshold: options.threshold
|
|
62
|
-
}
|
|
72
|
+
};
|
|
73
|
+
if (this.#session !== session) return false;
|
|
74
|
+
observer = new IntersectionObserver(onEntries, configured);
|
|
63
75
|
} catch (error) {
|
|
76
|
+
if (this.#session !== session) return false;
|
|
64
77
|
console.warn(
|
|
65
78
|
"Stimeo UI: IntersectionObserver could not be constructed with the configured options; retrying with platform defaults.",
|
|
66
79
|
error
|
|
67
80
|
);
|
|
81
|
+
if (this.#session !== session) return false;
|
|
68
82
|
observer = new IntersectionObserver(onEntries, { root });
|
|
69
|
-
|
|
83
|
+
usingPlatformDefaults = true;
|
|
84
|
+
}
|
|
85
|
+
if (this.#session !== session) {
|
|
86
|
+
this.#release(session, observer);
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
session.observer = observer;
|
|
90
|
+
for (const target of list) {
|
|
91
|
+
if (this.#session !== session) return false;
|
|
92
|
+
observer.observe(target);
|
|
93
|
+
if (this.#session !== session) {
|
|
94
|
+
this.#release(session, observer);
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
70
97
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
98
|
+
if (this.#session !== session) return false;
|
|
99
|
+
session.usingPlatformDefaults = usingPlatformDefaults;
|
|
100
|
+
session.active = true;
|
|
74
101
|
return true;
|
|
75
102
|
} catch (error) {
|
|
76
|
-
observer
|
|
77
|
-
this.#observer = null;
|
|
78
|
-
this.#active = false;
|
|
79
|
-
this.#usingPlatformDefaults = false;
|
|
103
|
+
this.#release(session, observer);
|
|
80
104
|
throw error;
|
|
81
105
|
}
|
|
82
106
|
}
|
|
83
107
|
rearm(target) {
|
|
84
|
-
|
|
108
|
+
const session = this.#session;
|
|
109
|
+
const observer = session?.observer;
|
|
110
|
+
if (!session?.active || !observer) return;
|
|
85
111
|
try {
|
|
86
|
-
|
|
87
|
-
this.#
|
|
112
|
+
observer.unobserve(target);
|
|
113
|
+
if (this.#session !== session) return;
|
|
114
|
+
observer.observe(target);
|
|
115
|
+
if (this.#session !== session) this.#release(session, observer);
|
|
88
116
|
} catch (error) {
|
|
89
|
-
this
|
|
117
|
+
if (this.#session === session) this.#session = null;
|
|
118
|
+
this.#release(session, observer);
|
|
90
119
|
throw error;
|
|
91
120
|
}
|
|
92
121
|
}
|
|
93
122
|
stop() {
|
|
94
|
-
|
|
95
|
-
this.#
|
|
96
|
-
this.#
|
|
97
|
-
|
|
123
|
+
const session = this.#session;
|
|
124
|
+
this.#session = null;
|
|
125
|
+
if (session) this.#release(session);
|
|
126
|
+
}
|
|
127
|
+
#release(session, observer = session.observer) {
|
|
128
|
+
session.observer = null;
|
|
129
|
+
observer?.disconnect();
|
|
98
130
|
}
|
|
99
131
|
};
|
|
100
132
|
|
|
@@ -14,70 +14,102 @@ function queryRoot(selector) {
|
|
|
14
14
|
}
|
|
15
15
|
var IntersectionWatcher = class {
|
|
16
16
|
#onEntries;
|
|
17
|
-
#
|
|
18
|
-
#active = false;
|
|
19
|
-
#usingPlatformDefaults = false;
|
|
17
|
+
#session = null;
|
|
20
18
|
constructor(onEntries) {
|
|
21
19
|
this.#onEntries = onEntries;
|
|
22
20
|
}
|
|
23
21
|
get active() {
|
|
24
|
-
return this.#active;
|
|
22
|
+
return this.#session?.active ?? false;
|
|
25
23
|
}
|
|
26
24
|
get usingPlatformDefaults() {
|
|
27
|
-
return this.#usingPlatformDefaults;
|
|
25
|
+
return this.#session?.usingPlatformDefaults ?? false;
|
|
28
26
|
}
|
|
29
27
|
start(targets, options = {}) {
|
|
30
|
-
this
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
const previous = this.#session;
|
|
29
|
+
const session = {
|
|
30
|
+
observer: null,
|
|
31
|
+
active: false,
|
|
32
|
+
usingPlatformDefaults: false
|
|
33
|
+
};
|
|
34
|
+
this.#session = session;
|
|
35
35
|
let observer = null;
|
|
36
36
|
try {
|
|
37
|
+
if (previous) this.#release(previous);
|
|
38
|
+
if (this.#session !== session) return false;
|
|
39
|
+
if (typeof IntersectionObserver === "undefined") return false;
|
|
40
|
+
const list = Array.isArray(targets) ? targets : [targets];
|
|
41
|
+
const empty = list.length === 0;
|
|
42
|
+
if (this.#session !== session) return false;
|
|
43
|
+
if (empty) return false;
|
|
44
|
+
const root = "root" in options ? options.root ?? null : queryRoot(options.rootSelector);
|
|
45
|
+
if (this.#session !== session) return false;
|
|
37
46
|
const onEntries = (entries) => {
|
|
38
|
-
if (this.#
|
|
47
|
+
if (this.#session === session && session.active) this.#onEntries(entries);
|
|
39
48
|
};
|
|
49
|
+
let usingPlatformDefaults = false;
|
|
40
50
|
try {
|
|
41
|
-
|
|
51
|
+
const configured = {
|
|
42
52
|
root,
|
|
43
53
|
rootMargin: options.rootMargin,
|
|
44
54
|
threshold: options.threshold
|
|
45
|
-
}
|
|
55
|
+
};
|
|
56
|
+
if (this.#session !== session) return false;
|
|
57
|
+
observer = new IntersectionObserver(onEntries, configured);
|
|
46
58
|
} catch (error) {
|
|
59
|
+
if (this.#session !== session) return false;
|
|
47
60
|
console.warn(
|
|
48
61
|
"Stimeo UI: IntersectionObserver could not be constructed with the configured options; retrying with platform defaults.",
|
|
49
62
|
error
|
|
50
63
|
);
|
|
64
|
+
if (this.#session !== session) return false;
|
|
51
65
|
observer = new IntersectionObserver(onEntries, { root });
|
|
52
|
-
|
|
66
|
+
usingPlatformDefaults = true;
|
|
53
67
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
68
|
+
if (this.#session !== session) {
|
|
69
|
+
this.#release(session, observer);
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
session.observer = observer;
|
|
73
|
+
for (const target of list) {
|
|
74
|
+
if (this.#session !== session) return false;
|
|
75
|
+
observer.observe(target);
|
|
76
|
+
if (this.#session !== session) {
|
|
77
|
+
this.#release(session, observer);
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (this.#session !== session) return false;
|
|
82
|
+
session.usingPlatformDefaults = usingPlatformDefaults;
|
|
83
|
+
session.active = true;
|
|
57
84
|
return true;
|
|
58
85
|
} catch (error) {
|
|
59
|
-
observer
|
|
60
|
-
this.#observer = null;
|
|
61
|
-
this.#active = false;
|
|
62
|
-
this.#usingPlatformDefaults = false;
|
|
86
|
+
this.#release(session, observer);
|
|
63
87
|
throw error;
|
|
64
88
|
}
|
|
65
89
|
}
|
|
66
90
|
rearm(target) {
|
|
67
|
-
|
|
91
|
+
const session = this.#session;
|
|
92
|
+
const observer = session?.observer;
|
|
93
|
+
if (!session?.active || !observer) return;
|
|
68
94
|
try {
|
|
69
|
-
|
|
70
|
-
this.#
|
|
95
|
+
observer.unobserve(target);
|
|
96
|
+
if (this.#session !== session) return;
|
|
97
|
+
observer.observe(target);
|
|
98
|
+
if (this.#session !== session) this.#release(session, observer);
|
|
71
99
|
} catch (error) {
|
|
72
|
-
this
|
|
100
|
+
if (this.#session === session) this.#session = null;
|
|
101
|
+
this.#release(session, observer);
|
|
73
102
|
throw error;
|
|
74
103
|
}
|
|
75
104
|
}
|
|
76
105
|
stop() {
|
|
77
|
-
|
|
78
|
-
this.#
|
|
79
|
-
this.#
|
|
80
|
-
|
|
106
|
+
const session = this.#session;
|
|
107
|
+
this.#session = null;
|
|
108
|
+
if (session) this.#release(session);
|
|
109
|
+
}
|
|
110
|
+
#release(session, observer = session.observer) {
|
|
111
|
+
session.observer = null;
|
|
112
|
+
observer?.disconnect();
|
|
81
113
|
}
|
|
82
114
|
};
|
|
83
115
|
|
|
@@ -186,43 +186,66 @@ var AttributeLease = class {
|
|
|
186
186
|
|
|
187
187
|
var AuthoredMutationWatcher = class {
|
|
188
188
|
#onAuthored;
|
|
189
|
-
#
|
|
190
|
-
#observer = null;
|
|
189
|
+
#lifetime = null;
|
|
191
190
|
constructor(onAuthored) {
|
|
192
191
|
this.#onAuthored = onAuthored;
|
|
193
192
|
}
|
|
194
193
|
observe(root, options) {
|
|
195
|
-
this
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
this.#
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
194
|
+
const previous = this.#lifetime;
|
|
195
|
+
const lifetime = {
|
|
196
|
+
observer: null,
|
|
197
|
+
active: false,
|
|
198
|
+
claims: { attributes: /* @__PURE__ */ new Map(), children: /* @__PURE__ */ new Map() }
|
|
199
|
+
};
|
|
200
|
+
this.#lifetime = lifetime;
|
|
201
|
+
let observer = null;
|
|
202
|
+
try {
|
|
203
|
+
if (previous) this.#release(previous);
|
|
204
|
+
if (this.#lifetime !== lifetime) return;
|
|
205
|
+
const attributes = [...options.attributes];
|
|
206
|
+
const subtree = options.subtree ?? false;
|
|
207
|
+
const childList = options.childList ?? false;
|
|
208
|
+
const inherited = options.ancestorAttributes;
|
|
209
|
+
const ancestorAttributes = inherited ? [...inherited] : null;
|
|
210
|
+
if (this.#lifetime !== lifetime) return;
|
|
211
|
+
observer = new MutationObserver((records) => {
|
|
212
|
+
const authored = this.#filter(records, lifetime.claims);
|
|
213
|
+
if (this.#lifetime === lifetime && lifetime.active && authored.length > 0) {
|
|
214
|
+
this.#onAuthored(authored);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
if (this.#lifetime !== lifetime) return;
|
|
218
|
+
lifetime.observer = observer;
|
|
219
|
+
observer.observe(root, { attributes: true, attributeFilter: attributes, subtree, childList });
|
|
220
|
+
if (this.#lifetime !== lifetime) {
|
|
221
|
+
this.#release(lifetime, observer);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
if (ancestorAttributes) {
|
|
225
|
+
let ancestor = root.parentElement;
|
|
226
|
+
while (ancestor) {
|
|
227
|
+
observer.observe(ancestor, { attributes: true, attributeFilter: ancestorAttributes });
|
|
228
|
+
if (this.#lifetime !== lifetime) {
|
|
229
|
+
this.#release(lifetime, observer);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
ancestor = ancestor.parentElement;
|
|
233
|
+
}
|
|
217
234
|
}
|
|
235
|
+
lifetime.active = true;
|
|
236
|
+
} catch (error) {
|
|
237
|
+
this.#release(lifetime, observer);
|
|
238
|
+
throw error;
|
|
218
239
|
}
|
|
219
240
|
}
|
|
220
241
|
claim(target, name, value) {
|
|
221
|
-
const
|
|
222
|
-
|
|
242
|
+
const lifetime = this.#lifetime;
|
|
243
|
+
if (!lifetime?.active) return;
|
|
244
|
+
const claims = lifetime.claims.attributes;
|
|
245
|
+
let attributes = claims.get(target);
|
|
223
246
|
if (!attributes) {
|
|
224
247
|
attributes = /* @__PURE__ */ new Map();
|
|
225
|
-
claims
|
|
248
|
+
claims.set(target, attributes);
|
|
226
249
|
}
|
|
227
250
|
const pending = attributes.get(name);
|
|
228
251
|
attributes.set(name, { value, count: (pending?.count ?? 0) + 1 });
|
|
@@ -231,37 +254,49 @@ var AuthoredMutationWatcher = class {
|
|
|
231
254
|
this.claim(target, name, target.getAttribute(name));
|
|
232
255
|
}
|
|
233
256
|
claimChildList(target, added, removed) {
|
|
234
|
-
const
|
|
235
|
-
|
|
257
|
+
const lifetime = this.#lifetime;
|
|
258
|
+
if (!lifetime?.active) return;
|
|
259
|
+
const claims = lifetime.claims.children;
|
|
260
|
+
const pending = claims.get(target) ?? { added: /* @__PURE__ */ new Map(), removed: /* @__PURE__ */ new Map() };
|
|
236
261
|
for (const node of added) pending.added.set(node, (pending.added.get(node) ?? 0) + 1);
|
|
237
262
|
for (const node of removed) pending.removed.set(node, (pending.removed.get(node) ?? 0) + 1);
|
|
238
|
-
claims
|
|
263
|
+
claims.set(target, pending);
|
|
239
264
|
}
|
|
240
265
|
take() {
|
|
241
|
-
|
|
266
|
+
const lifetime = this.#lifetime;
|
|
267
|
+
const observer = lifetime?.observer;
|
|
268
|
+
if (!lifetime?.active || !observer) return [];
|
|
269
|
+
const records = observer.takeRecords();
|
|
270
|
+
const authored = this.#filter(records, lifetime.claims);
|
|
271
|
+
return this.#lifetime === lifetime && lifetime.active ? authored : [];
|
|
242
272
|
}
|
|
243
273
|
disconnect() {
|
|
244
|
-
this.#
|
|
245
|
-
this.#
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
274
|
+
const lifetime = this.#lifetime;
|
|
275
|
+
if (lifetime) this.#release(lifetime);
|
|
276
|
+
}
|
|
277
|
+
#release(lifetime, observer = lifetime.observer) {
|
|
278
|
+
if (this.#lifetime === lifetime) this.#lifetime = null;
|
|
279
|
+
lifetime.claims.attributes.clear();
|
|
280
|
+
lifetime.claims.children.clear();
|
|
281
|
+
observer?.disconnect();
|
|
282
|
+
}
|
|
283
|
+
#filter(records, claims) {
|
|
284
|
+
const authored = records.filter((record) => !this.#consume(record, claims));
|
|
285
|
+
claims.attributes.clear();
|
|
286
|
+
claims.children.clear();
|
|
252
287
|
return authored;
|
|
253
288
|
}
|
|
254
|
-
#consume(record) {
|
|
289
|
+
#consume(record, claims) {
|
|
255
290
|
if (record.type === "attributes") {
|
|
256
291
|
const target = record.target;
|
|
257
|
-
const pending2 =
|
|
292
|
+
const pending2 = claims.attributes.get(target)?.get(record.attributeName);
|
|
258
293
|
if (!pending2 || pending2.count === 0 || target.getAttribute(record.attributeName) !== pending2.value) {
|
|
259
294
|
return false;
|
|
260
295
|
}
|
|
261
296
|
pending2.count -= 1;
|
|
262
297
|
return true;
|
|
263
298
|
}
|
|
264
|
-
const pending =
|
|
299
|
+
const pending = claims.children.get(record.target);
|
|
265
300
|
if (!pending) return false;
|
|
266
301
|
const added = [...record.addedNodes];
|
|
267
302
|
const removed = [...record.removedNodes];
|
|
@@ -499,7 +534,6 @@ var Typeahead = class {
|
|
|
499
534
|
#timers = new SafeTimeout();
|
|
500
535
|
#resetMs;
|
|
501
536
|
#query = "";
|
|
502
|
-
#timerId = 0;
|
|
503
537
|
constructor({ resetMs = TYPEAHEAD_RESET_MS } = {}) {
|
|
504
538
|
this.#resetMs = resetMs;
|
|
505
539
|
}
|
|
@@ -510,14 +544,13 @@ var Typeahead = class {
|
|
|
510
544
|
const char = key.toLowerCase();
|
|
511
545
|
const repeated = this.#query.length > 0 && [...this.#query].every((c) => c === char);
|
|
512
546
|
this.#query = repeated ? char : this.#query + char;
|
|
513
|
-
this.#timers.
|
|
514
|
-
this.#
|
|
547
|
+
this.#timers.clearAll();
|
|
548
|
+
this.#timers.set(() => this.reset(), this.#resetMs);
|
|
515
549
|
return this.#query;
|
|
516
550
|
}
|
|
517
551
|
reset() {
|
|
518
552
|
this.#query = "";
|
|
519
|
-
this.#timers.
|
|
520
|
-
this.#timerId = 0;
|
|
553
|
+
this.#timers.clearAll();
|
|
521
554
|
}
|
|
522
555
|
};
|
|
523
556
|
function isTypeaheadKey(event) {
|
|
@@ -27,13 +27,7 @@ function readDatetime(element) {
|
|
|
27
27
|
const minute = Number(minuteText);
|
|
28
28
|
const second = Number(secondText);
|
|
29
29
|
if (hour === 24 && (minute !== 0 || second !== 0 || /[1-9]/.test(fraction))) return null;
|
|
30
|
-
|
|
31
|
-
if (zone !== "Z") {
|
|
32
|
-
const digits = zone.slice(1).replace(":", "");
|
|
33
|
-
const offsetHour = digits.slice(0, 2);
|
|
34
|
-
const offsetMinute = digits.slice(2);
|
|
35
|
-
offset = `${zone[0]}${offsetHour}:${offsetMinute}`;
|
|
36
|
-
}
|
|
30
|
+
const offset = zone.replace(/^([+-]\d{2})(\d{2})$/, "$1:$2");
|
|
37
31
|
const milliseconds = fraction.slice(0, 3).padEnd(3, "0");
|
|
38
32
|
const canonical = `${yearText}-${monthText}-${dayText}T${hourText}:${minuteText}:${secondText}.${milliseconds}${offset}`;
|
|
39
33
|
const instant = Date.parse(canonical);
|
|
@@ -193,6 +193,7 @@ var EscapeLayer = class _EscapeLayer {
|
|
|
193
193
|
);
|
|
194
194
|
#active = null;
|
|
195
195
|
activate(ownerDocument = document, options) {
|
|
196
|
+
const entry = { onDismiss: options.onDismiss, claims: options.claims ?? null };
|
|
196
197
|
this.deactivate();
|
|
197
198
|
let registry2 = _EscapeLayer.#registries.get(ownerDocument);
|
|
198
199
|
if (!registry2) {
|
|
@@ -200,7 +201,6 @@ var EscapeLayer = class _EscapeLayer {
|
|
|
200
201
|
_EscapeLayer.#registries.set(ownerDocument, registry2);
|
|
201
202
|
ownerDocument.addEventListener("keydown", registry2.onKeydown);
|
|
202
203
|
}
|
|
203
|
-
const entry = { onDismiss: options.onDismiss, claims: options.claims ?? null };
|
|
204
204
|
registry2.stack.push(entry);
|
|
205
205
|
this.#active = { document: ownerDocument, entry };
|
|
206
206
|
}
|
|
@@ -76,6 +76,7 @@ var EscapeLayer = class _EscapeLayer {
|
|
|
76
76
|
);
|
|
77
77
|
#active = null;
|
|
78
78
|
activate(ownerDocument = document, options) {
|
|
79
|
+
const entry = { onDismiss: options.onDismiss, claims: options.claims ?? null };
|
|
79
80
|
this.deactivate();
|
|
80
81
|
let registry = _EscapeLayer.#registries.get(ownerDocument);
|
|
81
82
|
if (!registry) {
|
|
@@ -83,7 +84,6 @@ var EscapeLayer = class _EscapeLayer {
|
|
|
83
84
|
_EscapeLayer.#registries.set(ownerDocument, registry);
|
|
84
85
|
ownerDocument.addEventListener("keydown", registry.onKeydown);
|
|
85
86
|
}
|
|
86
|
-
const entry = { onDismiss: options.onDismiss, claims: options.claims ?? null };
|
|
87
87
|
registry.stack.push(entry);
|
|
88
88
|
this.#active = { document: ownerDocument, entry };
|
|
89
89
|
}
|
|
@@ -275,7 +275,6 @@ var Typeahead = class {
|
|
|
275
275
|
#timers = new SafeTimeout();
|
|
276
276
|
#resetMs;
|
|
277
277
|
#query = "";
|
|
278
|
-
#timerId = 0;
|
|
279
278
|
constructor({ resetMs = TYPEAHEAD_RESET_MS } = {}) {
|
|
280
279
|
this.#resetMs = resetMs;
|
|
281
280
|
}
|
|
@@ -286,14 +285,13 @@ var Typeahead = class {
|
|
|
286
285
|
const char = key.toLowerCase();
|
|
287
286
|
const repeated = this.#query.length > 0 && [...this.#query].every((c) => c === char);
|
|
288
287
|
this.#query = repeated ? char : this.#query + char;
|
|
289
|
-
this.#timers.
|
|
290
|
-
this.#
|
|
288
|
+
this.#timers.clearAll();
|
|
289
|
+
this.#timers.set(() => this.reset(), this.#resetMs);
|
|
291
290
|
return this.#query;
|
|
292
291
|
}
|
|
293
292
|
reset() {
|
|
294
293
|
this.#query = "";
|
|
295
|
-
this.#timers.
|
|
296
|
-
this.#timerId = 0;
|
|
294
|
+
this.#timers.clearAll();
|
|
297
295
|
}
|
|
298
296
|
};
|
|
299
297
|
function isTypeaheadKey(event) {
|
|
@@ -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
|
var NUMBER_BOUNDS = {
|