stimeo-ui 0.18.2 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +33 -0
- data/dist/controllers/alert_dialog_controller.js +246 -42
- data/dist/controllers/auto_submit_controller.js +26 -5
- data/dist/controllers/avatar_controller.js +29 -9
- data/dist/controllers/breadcrumb_controller.js +205 -17
- data/dist/controllers/bulk_select_controller.js +25 -4
- data/dist/controllers/calendar_controller.js +242 -7
- data/dist/controllers/carousel_controller.js +70 -15
- data/dist/controllers/character_counter_controller.js +26 -5
- data/dist/controllers/collapsible_controller.js +35 -8
- data/dist/controllers/combobox_controller.js +84 -20
- data/dist/controllers/command_palette_controller.js +296 -77
- data/dist/controllers/confirm_controller.js +225 -34
- data/dist/controllers/context_menu_controller.js +58 -29
- data/dist/controllers/currency_input_controller.js +1 -1
- data/dist/controllers/data_grid_controller.js +196 -9
- data/dist/controllers/date_range_picker_controller.js +25 -4
- data/dist/controllers/dialog_controller.js +252 -45
- data/dist/controllers/dismissible_controller.js +57 -11
- data/dist/controllers/drawer_controller.js +284 -58
- data/dist/controllers/dropdown_controller.js +63 -51
- data/dist/controllers/editable_controller.js +69 -6
- data/dist/controllers/empty_state_controller.js +187 -4
- data/dist/controllers/file_dropzone_controller.js +300 -12
- data/dist/controllers/filter_controller.js +194 -5
- data/dist/controllers/flash_controller.js +199 -12
- data/dist/controllers/focus_controller.js +195 -23
- data/dist/controllers/form_field_controller.js +65 -9
- data/dist/controllers/frame_loading_controller.js +25 -4
- data/dist/controllers/hover_card_controller.js +107 -38
- data/dist/controllers/input_mask_controller.js +1 -1
- data/dist/controllers/listbox_controller.js +94 -36
- data/dist/controllers/menu_controller.js +44 -23
- data/dist/controllers/menubar_controller.js +228 -46
- data/dist/controllers/meter_controller.js +25 -4
- data/dist/controllers/multi_select_controller.js +110 -42
- data/dist/controllers/nested_form_controller.js +258 -9
- data/dist/controllers/network_status_controller.js +25 -4
- data/dist/controllers/number_input_controller.js +26 -5
- data/dist/controllers/otp_controller.js +26 -5
- data/dist/controllers/overflow_menu_controller.js +183 -22
- data/dist/controllers/pagination_controller.js +179 -22
- data/dist/controllers/password_reveal_controller.js +25 -4
- data/dist/controllers/popover_controller.js +454 -34
- data/dist/controllers/progress_controller.js +25 -4
- data/dist/controllers/radio_group_controller.js +195 -40
- data/dist/controllers/rating_controller.js +58 -10
- data/dist/controllers/read_more_controller.js +191 -25
- data/dist/controllers/roving_controller.js +197 -6
- data/dist/controllers/scroll_area_controller.js +50 -12
- data/dist/controllers/scroll_visibility_controller.js +25 -4
- data/dist/controllers/scrollspy_controller.js +179 -3
- data/dist/controllers/separator_controller.js +25 -4
- data/dist/controllers/sidebar_controller.js +290 -93
- data/dist/controllers/skeleton_controller.js +25 -4
- data/dist/controllers/spinner_controller.js +25 -4
- data/dist/controllers/step_indicator_controller.js +181 -6
- data/dist/controllers/stepper_controller.js +188 -6
- data/dist/controllers/sticky_observer_controller.js +25 -4
- data/dist/controllers/submit_once_controller.js +25 -4
- data/dist/controllers/tabs_controller.js +189 -3
- data/dist/controllers/tags_input_controller.js +210 -9
- data/dist/controllers/theme_controller.js +192 -5
- data/dist/controllers/toast_controller.js +478 -16
- data/dist/controllers/toggle_group_controller.js +198 -35
- data/dist/controllers/toolbar_controller.js +198 -7
- data/dist/controllers/tooltip_controller.js +243 -45
- data/dist/controllers/tree_view_controller.js +200 -8
- data/dist/index.js +1764 -739
- data/lib/stimeo/ui/version.rb +1 -1
- metadata +2 -2
|
@@ -39,6 +39,7 @@ function ensureId(element, prefix = "stimeo") {
|
|
|
39
39
|
|
|
40
40
|
function setAttributeIfChanged(element, name, value, beforeWrite) {
|
|
41
41
|
if (element.getAttribute(name) === value) return false;
|
|
42
|
+
beforeWrite?.();
|
|
42
43
|
if (value === null) element.removeAttribute(name);
|
|
43
44
|
else element.setAttribute(name, value);
|
|
44
45
|
return true;
|
|
@@ -102,14 +103,34 @@ var AttributeLease = class {
|
|
|
102
103
|
const names = registry.names;
|
|
103
104
|
names.set(attribute, (names.get(attribute) ?? /* @__PURE__ */ new Set()).add(this.#record));
|
|
104
105
|
}
|
|
105
|
-
write(element, value) {
|
|
106
|
+
write(element, value, beforeWrite) {
|
|
106
107
|
const stack = attributeStack(element, this.#attribute);
|
|
107
108
|
const hold = this.#take(stack) ?? this.#acquire(element, stack);
|
|
108
109
|
this.#held.add(element);
|
|
109
110
|
const shows = !this.#covered(element, stack, hold);
|
|
110
111
|
hold.written = value;
|
|
111
112
|
this.#mark(element, stack);
|
|
112
|
-
if (shows) this.#reflect(element, value);
|
|
113
|
+
if (shows) this.#reflect(element, value, beforeWrite);
|
|
114
|
+
}
|
|
115
|
+
adopt(element, options = {}) {
|
|
116
|
+
const known = registry.stacks.get(element)?.has(this.#attribute);
|
|
117
|
+
if (!this.#held.has(element) && !known && !element.hasAttribute(this.#record)) return false;
|
|
118
|
+
const stack = attributeStack(element, this.#attribute);
|
|
119
|
+
const hold = this.#take(stack);
|
|
120
|
+
if (!hold) return false;
|
|
121
|
+
const current = element.getAttribute(this.#attribute);
|
|
122
|
+
if (options.ifChanged && (current === hold.written || this.#covered(element, stack, hold))) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
this.#held.add(element);
|
|
126
|
+
hold.original = current;
|
|
127
|
+
hold.linked = false;
|
|
128
|
+
for (const above of stack.slice(stack.indexOf(hold) + 1)) {
|
|
129
|
+
if (!above.linked) break;
|
|
130
|
+
above.original = current;
|
|
131
|
+
}
|
|
132
|
+
this.#mark(element, stack);
|
|
133
|
+
return true;
|
|
113
134
|
}
|
|
114
135
|
return(element) {
|
|
115
136
|
const held = this.#held.delete(element);
|
|
@@ -175,8 +196,8 @@ var AttributeLease = class {
|
|
|
175
196
|
setAttributeIfChanged(element, name, recorded);
|
|
176
197
|
}
|
|
177
198
|
}
|
|
178
|
-
#reflect(element, value) {
|
|
179
|
-
setAttributeIfChanged(element, this.#attribute, value);
|
|
199
|
+
#reflect(element, value, beforeWrite) {
|
|
200
|
+
setAttributeIfChanged(element, this.#attribute, value, beforeWrite);
|
|
180
201
|
}
|
|
181
202
|
};
|
|
182
203
|
|
|
@@ -239,7 +260,10 @@ var FormFieldController = class extends Controller {
|
|
|
239
260
|
#ariaInvalid = new AttributeLease("aria-invalid", this.identifier, {
|
|
240
261
|
base: true
|
|
241
262
|
});
|
|
263
|
+
#errorVisibility = new AttributeLease("hidden", this.identifier);
|
|
264
|
+
#knownErrors = /* @__PURE__ */ new Set();
|
|
242
265
|
#observer = new MutationObserver((records) => {
|
|
266
|
+
this.#returnDepartedErrors();
|
|
243
267
|
if (records.some((record) => this.#isRelevantMutation(record))) {
|
|
244
268
|
this.#reconcile.schedule();
|
|
245
269
|
}
|
|
@@ -250,6 +274,15 @@ var FormFieldController = class extends Controller {
|
|
|
250
274
|
#initialized = false;
|
|
251
275
|
connect() {
|
|
252
276
|
this.#reconcile.activate();
|
|
277
|
+
this.#returnDepartedErrors();
|
|
278
|
+
const retained = this.#activeControl;
|
|
279
|
+
if (retained) {
|
|
280
|
+
if (this.#ariaDescribedBy.adopt(retained, { ifChanged: true })) {
|
|
281
|
+
this.#baseDescribedBy = this.#externalDescribedByTokens(retained);
|
|
282
|
+
}
|
|
283
|
+
this.#ariaErrorMessage.adopt(retained, { ifChanged: true });
|
|
284
|
+
this.#ariaInvalid.adopt(retained, { ifChanged: true });
|
|
285
|
+
}
|
|
253
286
|
if (!this.#initialized) {
|
|
254
287
|
this.#explicitInvalid = this.element.hasAttribute(this.#invalidAttribute) && this.#shownErrors().length === 0;
|
|
255
288
|
this.#initialized = true;
|
|
@@ -266,7 +299,11 @@ var FormFieldController = class extends Controller {
|
|
|
266
299
|
disconnect() {
|
|
267
300
|
this.#reconcile.cancel();
|
|
268
301
|
this.#observer.disconnect();
|
|
269
|
-
|
|
302
|
+
const retained = this.scope.containsElement(this.element);
|
|
303
|
+
if (!retained) this.element.removeAttribute(this.#invalidAttribute);
|
|
304
|
+
if (this.#activeControl && (this.element.isConnected || !retained)) {
|
|
305
|
+
this.#releaseControl(this.#activeControl);
|
|
306
|
+
}
|
|
270
307
|
}
|
|
271
308
|
controlTargetConnected() {
|
|
272
309
|
this.#reconcile.schedule();
|
|
@@ -280,10 +317,14 @@ var FormFieldController = class extends Controller {
|
|
|
280
317
|
descriptionTargetDisconnected() {
|
|
281
318
|
this.#reconcile.schedule();
|
|
282
319
|
}
|
|
283
|
-
errorTargetConnected() {
|
|
320
|
+
errorTargetConnected(error) {
|
|
321
|
+
this.#knownErrors.add(error);
|
|
284
322
|
this.#reconcile.schedule();
|
|
285
323
|
}
|
|
286
|
-
errorTargetDisconnected() {
|
|
324
|
+
errorTargetDisconnected(error) {
|
|
325
|
+
if (!this.scope.containsElement(error) || !this.errorTargets.includes(error)) {
|
|
326
|
+
this.#returnError(error);
|
|
327
|
+
}
|
|
287
328
|
this.#reconcile.schedule();
|
|
288
329
|
}
|
|
289
330
|
setError(arg, options = {}) {
|
|
@@ -292,7 +333,7 @@ var FormFieldController = class extends Controller {
|
|
|
292
333
|
this.errorTargets[0]?.replaceChildren(document.createTextNode(message));
|
|
293
334
|
}
|
|
294
335
|
for (const error of this.errorTargets) {
|
|
295
|
-
error
|
|
336
|
+
this.#writeErrorVisibility(error, (error.textContent ?? "").trim() === "");
|
|
296
337
|
}
|
|
297
338
|
this.#explicitInvalid = true;
|
|
298
339
|
this.#reconcileDom();
|
|
@@ -305,7 +346,7 @@ var FormFieldController = class extends Controller {
|
|
|
305
346
|
clearError() {
|
|
306
347
|
for (const error of this.errorTargets) {
|
|
307
348
|
error.replaceChildren();
|
|
308
|
-
error
|
|
349
|
+
this.#writeErrorVisibility(error, true);
|
|
309
350
|
}
|
|
310
351
|
this.#explicitInvalid = false;
|
|
311
352
|
this.#reconcileDom();
|
|
@@ -329,6 +370,21 @@ var FormFieldController = class extends Controller {
|
|
|
329
370
|
const describedBy = this.#uniqueTokens([...this.#baseDescribedBy, ...associationIds]);
|
|
330
371
|
this.#ariaDescribedBy.write(control, describedBy.length > 0 ? describedBy.join(" ") : null);
|
|
331
372
|
}
|
|
373
|
+
#writeErrorVisibility(error, hidden) {
|
|
374
|
+
this.#knownErrors.add(error);
|
|
375
|
+
this.#errorVisibility.adopt(error, { ifChanged: true });
|
|
376
|
+
this.#errorVisibility.write(error, hidden ? "" : null);
|
|
377
|
+
}
|
|
378
|
+
#returnError(error) {
|
|
379
|
+
this.#knownErrors.delete(error);
|
|
380
|
+
this.#errorVisibility.return(error);
|
|
381
|
+
}
|
|
382
|
+
#returnDepartedErrors() {
|
|
383
|
+
const errors = new Set(this.errorTargets);
|
|
384
|
+
for (const error of this.#knownErrors) {
|
|
385
|
+
if (!errors.has(error)) this.#returnError(error);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
332
388
|
#ensureAssociationIds() {
|
|
333
389
|
for (const description of this.descriptionTargets) {
|
|
334
390
|
ensureId(description, "stimeo--form-field-desc");
|
|
@@ -20,6 +20,7 @@ function announce(message, options = {}) {
|
|
|
20
20
|
|
|
21
21
|
function setAttributeIfChanged(element, name, value, beforeWrite) {
|
|
22
22
|
if (element.getAttribute(name) === value) return false;
|
|
23
|
+
beforeWrite?.();
|
|
23
24
|
if (value === null) element.removeAttribute(name);
|
|
24
25
|
else element.setAttribute(name, value);
|
|
25
26
|
return true;
|
|
@@ -93,14 +94,34 @@ var AttributeLease = class {
|
|
|
93
94
|
const names = registry.names;
|
|
94
95
|
names.set(attribute, (names.get(attribute) ?? /* @__PURE__ */ new Set()).add(this.#record));
|
|
95
96
|
}
|
|
96
|
-
write(element, value) {
|
|
97
|
+
write(element, value, beforeWrite) {
|
|
97
98
|
const stack = attributeStack(element, this.#attribute);
|
|
98
99
|
const hold = this.#take(stack) ?? this.#acquire(element, stack);
|
|
99
100
|
this.#held.add(element);
|
|
100
101
|
const shows = !this.#covered(element, stack, hold);
|
|
101
102
|
hold.written = value;
|
|
102
103
|
this.#mark(element, stack);
|
|
103
|
-
if (shows) this.#reflect(element, value);
|
|
104
|
+
if (shows) this.#reflect(element, value, beforeWrite);
|
|
105
|
+
}
|
|
106
|
+
adopt(element, options = {}) {
|
|
107
|
+
const known = registry.stacks.get(element)?.has(this.#attribute);
|
|
108
|
+
if (!this.#held.has(element) && !known && !element.hasAttribute(this.#record)) return false;
|
|
109
|
+
const stack = attributeStack(element, this.#attribute);
|
|
110
|
+
const hold = this.#take(stack);
|
|
111
|
+
if (!hold) return false;
|
|
112
|
+
const current = element.getAttribute(this.#attribute);
|
|
113
|
+
if (options.ifChanged && (current === hold.written || this.#covered(element, stack, hold))) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
this.#held.add(element);
|
|
117
|
+
hold.original = current;
|
|
118
|
+
hold.linked = false;
|
|
119
|
+
for (const above of stack.slice(stack.indexOf(hold) + 1)) {
|
|
120
|
+
if (!above.linked) break;
|
|
121
|
+
above.original = current;
|
|
122
|
+
}
|
|
123
|
+
this.#mark(element, stack);
|
|
124
|
+
return true;
|
|
104
125
|
}
|
|
105
126
|
return(element) {
|
|
106
127
|
const held = this.#held.delete(element);
|
|
@@ -166,8 +187,8 @@ var AttributeLease = class {
|
|
|
166
187
|
setAttributeIfChanged(element, name, recorded);
|
|
167
188
|
}
|
|
168
189
|
}
|
|
169
|
-
#reflect(element, value) {
|
|
170
|
-
setAttributeIfChanged(element, this.#attribute, value);
|
|
190
|
+
#reflect(element, value, beforeWrite) {
|
|
191
|
+
setAttributeIfChanged(element, this.#attribute, value, beforeWrite);
|
|
171
192
|
}
|
|
172
193
|
};
|
|
173
194
|
|
|
@@ -2,6 +2,7 @@ import { Controller } from '@hotwired/stimulus';
|
|
|
2
2
|
|
|
3
3
|
function setAttributeIfChanged(element, name, value, beforeWrite) {
|
|
4
4
|
if (element.getAttribute(name) === value) return false;
|
|
5
|
+
beforeWrite?.();
|
|
5
6
|
if (value === null) element.removeAttribute(name);
|
|
6
7
|
else element.setAttribute(name, value);
|
|
7
8
|
return true;
|
|
@@ -75,14 +76,34 @@ var AttributeLease = class {
|
|
|
75
76
|
const names = registry.names;
|
|
76
77
|
names.set(attribute, (names.get(attribute) ?? /* @__PURE__ */ new Set()).add(this.#record));
|
|
77
78
|
}
|
|
78
|
-
write(element, value) {
|
|
79
|
+
write(element, value, beforeWrite) {
|
|
79
80
|
const stack = attributeStack(element, this.#attribute);
|
|
80
81
|
const hold = this.#take(stack) ?? this.#acquire(element, stack);
|
|
81
82
|
this.#held.add(element);
|
|
82
83
|
const shows = !this.#covered(element, stack, hold);
|
|
83
84
|
hold.written = value;
|
|
84
85
|
this.#mark(element, stack);
|
|
85
|
-
if (shows) this.#reflect(element, value);
|
|
86
|
+
if (shows) this.#reflect(element, value, beforeWrite);
|
|
87
|
+
}
|
|
88
|
+
adopt(element, options = {}) {
|
|
89
|
+
const known = registry.stacks.get(element)?.has(this.#attribute);
|
|
90
|
+
if (!this.#held.has(element) && !known && !element.hasAttribute(this.#record)) return false;
|
|
91
|
+
const stack = attributeStack(element, this.#attribute);
|
|
92
|
+
const hold = this.#take(stack);
|
|
93
|
+
if (!hold) return false;
|
|
94
|
+
const current = element.getAttribute(this.#attribute);
|
|
95
|
+
if (options.ifChanged && (current === hold.written || this.#covered(element, stack, hold))) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
this.#held.add(element);
|
|
99
|
+
hold.original = current;
|
|
100
|
+
hold.linked = false;
|
|
101
|
+
for (const above of stack.slice(stack.indexOf(hold) + 1)) {
|
|
102
|
+
if (!above.linked) break;
|
|
103
|
+
above.original = current;
|
|
104
|
+
}
|
|
105
|
+
this.#mark(element, stack);
|
|
106
|
+
return true;
|
|
86
107
|
}
|
|
87
108
|
return(element) {
|
|
88
109
|
const held = this.#held.delete(element);
|
|
@@ -148,8 +169,8 @@ var AttributeLease = class {
|
|
|
148
169
|
setAttributeIfChanged(element, name, recorded);
|
|
149
170
|
}
|
|
150
171
|
}
|
|
151
|
-
#reflect(element, value) {
|
|
152
|
-
setAttributeIfChanged(element, this.#attribute, value);
|
|
172
|
+
#reflect(element, value, beforeWrite) {
|
|
173
|
+
setAttributeIfChanged(element, this.#attribute, value, beforeWrite);
|
|
153
174
|
}
|
|
154
175
|
};
|
|
155
176
|
|
|
@@ -349,11 +370,18 @@ var HoverCardController = class _HoverCardController extends Controller {
|
|
|
349
370
|
#pendingOpen = null;
|
|
350
371
|
#pendingClose = null;
|
|
351
372
|
#stopScrollDismiss = null;
|
|
352
|
-
#
|
|
373
|
+
#open = false;
|
|
374
|
+
#revealToken = null;
|
|
375
|
+
#currentCard = null;
|
|
376
|
+
#hidden = new AttributeLease("hidden", this.identifier);
|
|
377
|
+
#state = new AttributeLease("data-state", this.identifier);
|
|
353
378
|
#connected = false;
|
|
354
379
|
#reporting = false;
|
|
355
380
|
connect() {
|
|
381
|
+
this.#reporting = false;
|
|
356
382
|
this.#cancelTimers();
|
|
383
|
+
this.#open = false;
|
|
384
|
+
this.#currentCard = null;
|
|
357
385
|
this.#conceal("api");
|
|
358
386
|
this.#connected = true;
|
|
359
387
|
this.#reporting = true;
|
|
@@ -363,18 +391,20 @@ var HoverCardController = class _HoverCardController extends Controller {
|
|
|
363
391
|
this.#reporting = false;
|
|
364
392
|
this.#cancelTimers();
|
|
365
393
|
this.#release();
|
|
394
|
+
this.#open = false;
|
|
395
|
+
this.#currentCard = null;
|
|
366
396
|
}
|
|
367
397
|
closeOnScrollValueChanged() {
|
|
368
|
-
if (this.#
|
|
398
|
+
if (this.#open) this.#syncScrollDismiss();
|
|
399
|
+
}
|
|
400
|
+
cardTargetConnected() {
|
|
401
|
+
if (this.#connected) this.#syncCard();
|
|
369
402
|
}
|
|
370
403
|
cardTargetDisconnected(card) {
|
|
371
|
-
if (
|
|
372
|
-
if (this.cardTargets.includes(card))
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
card.hidden = true;
|
|
376
|
-
card.setAttribute("data-state", "closed");
|
|
377
|
-
this.#reflectClosed();
|
|
404
|
+
if (this.#connected) this.#syncCard();
|
|
405
|
+
if (!this.scope.containsElement(card) || !this.cardTargets.includes(card)) {
|
|
406
|
+
this.#returnCard(card);
|
|
407
|
+
}
|
|
378
408
|
}
|
|
379
409
|
triggerTargetConnected() {
|
|
380
410
|
if (this.#connected) this.#reflectTrigger();
|
|
@@ -384,6 +414,7 @@ var HoverCardController = class _HoverCardController extends Controller {
|
|
|
384
414
|
if (this.#connected) this.#reflectTrigger();
|
|
385
415
|
}
|
|
386
416
|
open(event) {
|
|
417
|
+
this.#syncCard();
|
|
387
418
|
const reason = stateReasonFor(event);
|
|
388
419
|
this.#cancelClose();
|
|
389
420
|
if (this.#isOpen || this.#pendingOpen !== null) return;
|
|
@@ -397,53 +428,91 @@ var HoverCardController = class _HoverCardController extends Controller {
|
|
|
397
428
|
}, this.#safeOpenDelay);
|
|
398
429
|
}
|
|
399
430
|
close(event) {
|
|
431
|
+
this.#syncCard();
|
|
400
432
|
const reason = stateReasonFor(event);
|
|
401
433
|
this.#cancelOpen();
|
|
402
|
-
if (!this.#closable
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
}
|
|
434
|
+
if (!this.#closable) return;
|
|
435
|
+
const keepHovered = reason === "focus" || reason === "pointer";
|
|
436
|
+
if (this.#pendingClose) {
|
|
437
|
+
this.#pendingClose.keepHovered &&= keepHovered;
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
const pending = {
|
|
441
|
+
keepHovered,
|
|
442
|
+
timer: this.#timers.set(() => {
|
|
443
|
+
this.#pendingClose = null;
|
|
444
|
+
if (this.element.contains(document.activeElement)) return;
|
|
445
|
+
const [card] = this.cardTargets;
|
|
446
|
+
if (pending.keepHovered && card && !card.hidden && (card.matches(":hover") || this.hasTriggerTarget && this.triggerTarget.matches(":hover"))) {
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
this.#conceal(reason);
|
|
450
|
+
}, this.#safeCloseDelay)
|
|
451
|
+
};
|
|
452
|
+
this.#pendingClose = pending;
|
|
408
453
|
}
|
|
409
454
|
#reveal(reason) {
|
|
410
|
-
if (!this.hasCardTarget) return;
|
|
411
|
-
const card = this.cardTarget;
|
|
412
455
|
const was = this.#isOpen;
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
this.#
|
|
456
|
+
this.#open = true;
|
|
457
|
+
const token = {};
|
|
458
|
+
this.#revealToken = token;
|
|
459
|
+
this.#reflectCard(this.#currentCard, true);
|
|
460
|
+
this.#reflectTrigger();
|
|
417
461
|
if (!was && this.#reporting) this.dispatch("open", { detail: { reason }, cancelable: false });
|
|
418
|
-
if (this.#
|
|
462
|
+
if (!this.#open || !this.#reporting) return;
|
|
463
|
+
this.#syncCard();
|
|
464
|
+
if (this.#revealToken !== token) return;
|
|
419
465
|
this.#escapeLayer.activate(document, { onDismiss: () => this.#dismiss("escape") });
|
|
420
466
|
this.#syncScrollDismiss();
|
|
421
467
|
}
|
|
422
468
|
#conceal(reason) {
|
|
469
|
+
this.#syncCard();
|
|
423
470
|
const was = this.#isOpen;
|
|
471
|
+
this.#open = false;
|
|
424
472
|
this.#release();
|
|
425
|
-
this.#
|
|
473
|
+
this.#reflectCard(this.#currentCard, false);
|
|
474
|
+
this.#reflectTrigger();
|
|
426
475
|
if (was && this.#reporting) this.dispatch("close", { detail: { reason }, cancelable: false });
|
|
427
476
|
}
|
|
428
|
-
#
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
477
|
+
#syncCard() {
|
|
478
|
+
const next = this.hasCardTarget ? this.cardTarget : null;
|
|
479
|
+
const current = this.#currentCard;
|
|
480
|
+
if (current === next) return;
|
|
481
|
+
if (current) {
|
|
482
|
+
this.#open = !current.hidden;
|
|
483
|
+
if (!this.scope.containsElement(current) || !this.cardTargets.includes(current)) {
|
|
484
|
+
this.#returnCard(current);
|
|
485
|
+
} else this.#reflectCard(current, false);
|
|
432
486
|
}
|
|
433
|
-
|
|
487
|
+
this.#currentCard = next;
|
|
488
|
+
this.#reflectCard(next, this.#open);
|
|
489
|
+
this.#reflectTrigger();
|
|
490
|
+
if (!this.#open) this.#release();
|
|
491
|
+
else this.#syncScrollDismiss();
|
|
492
|
+
}
|
|
493
|
+
#reflectCard(card, open) {
|
|
494
|
+
if (!card) return;
|
|
495
|
+
this.#hidden.write(card, open ? null : "");
|
|
496
|
+
this.#state.write(card, open ? "open" : "closed");
|
|
497
|
+
}
|
|
498
|
+
#returnCard(card) {
|
|
499
|
+
this.#hidden.return(card);
|
|
500
|
+
this.#state.return(card);
|
|
434
501
|
}
|
|
435
502
|
#reflectTrigger() {
|
|
436
503
|
if (this.hasTriggerTarget) this.#expanded.write(this.triggerTarget, String(this.#isOpen));
|
|
437
504
|
}
|
|
438
505
|
#release() {
|
|
439
|
-
this.#
|
|
506
|
+
this.#revealToken = null;
|
|
440
507
|
this.#escapeLayer.deactivate();
|
|
441
508
|
this.#stopScrollDismiss?.();
|
|
442
509
|
this.#stopScrollDismiss = null;
|
|
443
510
|
}
|
|
444
511
|
#syncScrollDismiss() {
|
|
445
|
-
if (this.closeOnScrollValue) {
|
|
446
|
-
this.#stopScrollDismiss ??= observeScrollDismiss(this.element, () =>
|
|
512
|
+
if (this.closeOnScrollValue && this.#currentCard && this.#open) {
|
|
513
|
+
this.#stopScrollDismiss ??= observeScrollDismiss(this.element, () => {
|
|
514
|
+
if (this.hasCardTarget) this.#dismiss("scroll");
|
|
515
|
+
});
|
|
447
516
|
return;
|
|
448
517
|
}
|
|
449
518
|
this.#stopScrollDismiss?.();
|
|
@@ -465,15 +534,15 @@ var HoverCardController = class _HoverCardController extends Controller {
|
|
|
465
534
|
}
|
|
466
535
|
#cancelClose() {
|
|
467
536
|
if (this.#pendingClose !== null) {
|
|
468
|
-
this.#timers.clear(this.#pendingClose);
|
|
537
|
+
this.#timers.clear(this.#pendingClose.timer);
|
|
469
538
|
this.#pendingClose = null;
|
|
470
539
|
}
|
|
471
540
|
}
|
|
472
541
|
get #isOpen() {
|
|
473
|
-
return this
|
|
542
|
+
return this.#currentCard ? !this.#currentCard.hidden : this.#open;
|
|
474
543
|
}
|
|
475
544
|
get #closable() {
|
|
476
|
-
return this.#isOpen || this.#
|
|
545
|
+
return this.#isOpen || this.#open;
|
|
477
546
|
}
|
|
478
547
|
get #safeOpenDelay() {
|
|
479
548
|
return this.#numbers.read(
|
|
@@ -114,7 +114,7 @@ var CompositionTracker = class {
|
|
|
114
114
|
this.#confirmedTarget = null;
|
|
115
115
|
if (confirmed === null || confirmed !== event.target) return false;
|
|
116
116
|
const inputType = event.inputType;
|
|
117
|
-
return
|
|
117
|
+
return inputType ? isCompositionInputType(inputType) : event.isTrusted === true;
|
|
118
118
|
}
|
|
119
119
|
#release(target) {
|
|
120
120
|
target.removeEventListener("compositionstart", this.#handleStart);
|