ember-attacher 4.3.0 → 4.4.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.
- package/dist/_app_/components/attacher.js +1 -0
- package/dist/_app_/modifiers/tooltip.js +1 -0
- package/dist/attacher-core-m7x5g04q.js +2653 -0
- package/dist/attacher-core-m7x5g04q.js.map +1 -0
- package/dist/components/attach-popover.d.ts +14 -0
- package/dist/components/attach-popover.js +9 -9
- package/dist/components/attach-popover.js.map +1 -1
- package/dist/components/attach-tooltip.d.ts +15 -0
- package/dist/components/attach-tooltip.js +11 -16
- package/dist/components/attach-tooltip.js.map +1 -1
- package/dist/components/attacher.d.ts +17 -0
- package/dist/components/attacher.js +33 -0
- package/dist/components/attacher.js.map +1 -0
- package/dist/components/basic-attacher.d.ts +151 -0
- package/dist/components/basic-attacher.js +22 -1689
- package/dist/components/basic-attacher.js.map +1 -1
- package/dist/defaults.d.ts +32 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/{is-visible-c5EF_lZe.js → is-visible-DQGdmVDv.js} +2 -2
- package/dist/is-visible-DQGdmVDv.js.map +1 -0
- package/dist/modifiers/tooltip.d.ts +17 -0
- package/dist/modifiers/tooltip.js +254 -0
- package/dist/modifiers/tooltip.js.map +1 -0
- package/dist/styles/ember-attacher.css +1 -237
- package/dist/template-registry.d.ts +17 -0
- package/dist/test-support/index.d.ts +2 -0
- package/dist/test-support/index.js +1 -1
- package/dist/test-support/is-visible.d.ts +3 -0
- package/package.json +46 -14
- package/dist/is-visible-c5EF_lZe.js.map +0 -1
|
@@ -1,1710 +1,43 @@
|
|
|
1
|
-
import { action } from '@ember/object';
|
|
2
1
|
import Component from '@glimmer/component';
|
|
3
|
-
import {
|
|
4
|
-
import { getOwner } from '@ember/application';
|
|
5
|
-
import { guidFor } from '@ember/object/internals';
|
|
6
|
-
import { isHTMLSafe } from '@ember/template';
|
|
7
|
-
import { runInDebug, warn, assert } from '@ember/debug';
|
|
8
|
-
import { arrow, flip, shift, limitShift, autoUpdate, computePosition } from '@floating-ui/dom';
|
|
9
|
-
import { buildWaiter } from '@ember/test-waiters';
|
|
10
|
-
import { tracked } from '@glimmer/tracking';
|
|
11
|
-
import { modifier } from 'ember-modifier';
|
|
12
|
-
import DEFAULTS from '../defaults.js';
|
|
2
|
+
import { A as AttacherCore } from '../attacher-core-m7x5g04q.js';
|
|
13
3
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
14
4
|
import { setComponentTemplate } from '@ember/component';
|
|
15
5
|
import templateOnly from '@ember/component/template-only';
|
|
16
6
|
|
|
17
|
-
function _applyDecoratedDescriptor(i, e, r, n, l) {
|
|
18
|
-
var a = {};
|
|
19
|
-
return Object.keys(n).forEach(function (i) {
|
|
20
|
-
a[i] = n[i];
|
|
21
|
-
}), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, ("value" in a || a.initializer) && (a.writable = true), a = r.slice().reverse().reduce(function (r, n) {
|
|
22
|
-
return n(i, e, r) || r;
|
|
23
|
-
}, a), l && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(l) : void 0, a.initializer = void 0), void 0 === a.initializer ? (Object.defineProperty(i, e, a), null) : a;
|
|
24
|
-
}
|
|
25
|
-
function _defineProperty(e, r, t) {
|
|
26
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
27
|
-
value: t,
|
|
28
|
-
enumerable: true,
|
|
29
|
-
configurable: true,
|
|
30
|
-
writable: true
|
|
31
|
-
}) : e[r] = t, e;
|
|
32
|
-
}
|
|
33
|
-
function _initializerDefineProperty(e, i, r, l) {
|
|
34
|
-
r && Object.defineProperty(e, i, {
|
|
35
|
-
enumerable: r.enumerable,
|
|
36
|
-
configurable: r.configurable,
|
|
37
|
-
writable: r.writable,
|
|
38
|
-
value: r.initializer ? r.initializer.call(l) : void 0
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
function _toPrimitive(t, e) {
|
|
42
|
-
if ("object" != typeof t || !t) return t;
|
|
43
|
-
var r;
|
|
44
|
-
if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
|
|
45
|
-
var i = r.call(t, e);
|
|
46
|
-
if ("object" != typeof i) return i;
|
|
47
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
48
|
-
}
|
|
49
|
-
return ("string" === e ? String : Number)(t);
|
|
50
|
-
}
|
|
51
|
-
function _toPropertyKey(t) {
|
|
52
|
-
var i = _toPrimitive(t, "string");
|
|
53
|
-
return "symbol" == typeof i ? i : i + "";
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const KNOWN_HASPOPUP_ROLES = new Set(['dialog', 'menu', 'listbox', 'tree', 'grid', 'true', 'false']);
|
|
57
|
-
function splitTokens(value) {
|
|
58
|
-
return value ? value.trim().split(/\s+/).filter(Boolean) : [];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Tracks and restores ARIA attributes owned by a single BasicAttacher instance
|
|
63
|
-
* without clobbering pre-existing caller attributes or tokens.
|
|
64
|
-
*/
|
|
65
|
-
class AttachmentAriaController {
|
|
66
|
-
constructor() {
|
|
67
|
-
_defineProperty(this, "_boundTarget", null);
|
|
68
|
-
_defineProperty(this, "_isTooltip", false);
|
|
69
|
-
_defineProperty(this, "_attachmentId", null);
|
|
70
|
-
_defineProperty(this, "_ariaRole", undefined);
|
|
71
|
-
_defineProperty(this, "_addedDescribedByToken", false);
|
|
72
|
-
_defineProperty(this, "_ownsHasPopup", false);
|
|
73
|
-
_defineProperty(this, "_ownsControls", false);
|
|
74
|
-
_defineProperty(this, "_ownsExpanded", false);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Bind ARIA metadata to a target Element (no-op when target is null/non-Element).
|
|
78
|
-
*
|
|
79
|
-
* @param {Element | null} target
|
|
80
|
-
* @param {{ isTooltip: boolean, id: string, ariaRole?: string, isOpen: boolean }} options
|
|
81
|
-
*/
|
|
82
|
-
bind(target, {
|
|
83
|
-
isTooltip,
|
|
84
|
-
id,
|
|
85
|
-
ariaRole,
|
|
86
|
-
isOpen
|
|
87
|
-
}) {
|
|
88
|
-
if (this._boundTarget && (this._boundTarget !== target || this._attachmentId !== id || this._isTooltip !== isTooltip || this._ariaRole !== ariaRole)) {
|
|
89
|
-
this.unbind();
|
|
90
|
-
}
|
|
91
|
-
if (!target || typeof target.setAttribute !== 'function') {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
this._boundTarget = target;
|
|
95
|
-
this._isTooltip = isTooltip;
|
|
96
|
-
this._attachmentId = id;
|
|
97
|
-
this._ariaRole = ariaRole;
|
|
98
|
-
if (!isTooltip) {
|
|
99
|
-
if (!target.hasAttribute('aria-haspopup')) {
|
|
100
|
-
const role = ariaRole || 'dialog';
|
|
101
|
-
runInDebug(() => {
|
|
102
|
-
warn(`[ember-attacher] Unrecognized aria-haspopup role "${role}". Expected one of: dialog, menu, listbox, tree, grid.`, KNOWN_HASPOPUP_ROLES.has(role), {
|
|
103
|
-
id: 'ember-attacher.unrecognized-aria-haspopup'
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
target.setAttribute('aria-haspopup', role);
|
|
107
|
-
this._ownsHasPopup = true;
|
|
108
|
-
}
|
|
109
|
-
if (!target.hasAttribute('aria-controls')) {
|
|
110
|
-
target.setAttribute('aria-controls', id);
|
|
111
|
-
this._ownsControls = true;
|
|
112
|
-
}
|
|
113
|
-
if (!target.hasAttribute('aria-expanded')) {
|
|
114
|
-
target.setAttribute('aria-expanded', isOpen ? 'true' : 'false');
|
|
115
|
-
this._ownsExpanded = true;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
this.setOpen(isOpen);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Update open/closed ARIA state on the bound target.
|
|
123
|
-
*
|
|
124
|
-
* @param {boolean} isOpen
|
|
125
|
-
*/
|
|
126
|
-
setOpen(isOpen) {
|
|
127
|
-
const target = this._boundTarget;
|
|
128
|
-
if (!target) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
if (this._isTooltip) {
|
|
132
|
-
this._setDescribedByOpen(target, isOpen);
|
|
133
|
-
} else if (this._ownsExpanded) {
|
|
134
|
-
target.setAttribute('aria-expanded', isOpen ? 'true' : 'false');
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Remove only the attributes and tokens added by this controller.
|
|
140
|
-
*/
|
|
141
|
-
unbind() {
|
|
142
|
-
const target = this._boundTarget;
|
|
143
|
-
if (!target) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
if (this._addedDescribedByToken) {
|
|
147
|
-
this._removeDescribedByToken(target, this._attachmentId);
|
|
148
|
-
this._addedDescribedByToken = false;
|
|
149
|
-
}
|
|
150
|
-
if (this._ownsHasPopup) {
|
|
151
|
-
target.removeAttribute('aria-haspopup');
|
|
152
|
-
this._ownsHasPopup = false;
|
|
153
|
-
}
|
|
154
|
-
if (this._ownsControls) {
|
|
155
|
-
target.removeAttribute('aria-controls');
|
|
156
|
-
this._ownsControls = false;
|
|
157
|
-
}
|
|
158
|
-
if (this._ownsExpanded) {
|
|
159
|
-
target.removeAttribute('aria-expanded');
|
|
160
|
-
this._ownsExpanded = false;
|
|
161
|
-
}
|
|
162
|
-
this._boundTarget = null;
|
|
163
|
-
this._attachmentId = null;
|
|
164
|
-
this._isTooltip = false;
|
|
165
|
-
this._ariaRole = undefined;
|
|
166
|
-
}
|
|
167
|
-
_setDescribedByOpen(target, isOpen) {
|
|
168
|
-
const id = this._attachmentId;
|
|
169
|
-
if (!id) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
if (isOpen) {
|
|
173
|
-
const tokens = splitTokens(target.getAttribute('aria-describedby'));
|
|
174
|
-
if (!tokens.includes(id)) {
|
|
175
|
-
tokens.push(id);
|
|
176
|
-
target.setAttribute('aria-describedby', tokens.join(' '));
|
|
177
|
-
this._addedDescribedByToken = true;
|
|
178
|
-
}
|
|
179
|
-
} else if (this._addedDescribedByToken) {
|
|
180
|
-
this._removeDescribedByToken(target, id);
|
|
181
|
-
this._addedDescribedByToken = false;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
_removeDescribedByToken(target, token) {
|
|
185
|
-
if (!token) {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
const remaining = splitTokens(target.getAttribute('aria-describedby')).filter(t => t !== token);
|
|
189
|
-
if (remaining.length > 0) {
|
|
190
|
-
target.setAttribute('aria-describedby', remaining.join(' '));
|
|
191
|
-
} else {
|
|
192
|
-
target.removeAttribute('aria-describedby');
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Restore focus to the Target if focus currently lives inside the floating attachment
|
|
199
|
-
* or on another element outside the Target when dismissed via Escape.
|
|
200
|
-
*
|
|
201
|
-
* @param {Element | null} target
|
|
202
|
-
* @param {Element | null} floatingElement
|
|
203
|
-
*/
|
|
204
|
-
function restoreFocusOnEscape(target, floatingElement) {
|
|
205
|
-
if (!target || typeof target.focus !== 'function' || typeof document === 'undefined') {
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
const active = document.activeElement;
|
|
209
|
-
if (active === target) {
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
const focusInsideAttachment = Boolean(floatingElement && active && floatingElement.contains(active));
|
|
213
|
-
if (focusInsideAttachment) {
|
|
214
|
-
try {
|
|
215
|
-
target.focus({
|
|
216
|
-
preventScroll: true
|
|
217
|
-
});
|
|
218
|
-
} catch {
|
|
219
|
-
target.focus();
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* DOM and event helpers for attachment boundary and cursor detection.
|
|
226
|
-
*/
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Determine whether an event originated from or traversed through a given DOM element.
|
|
230
|
-
*
|
|
231
|
-
* Uses `event.composedPath()` to safely detect clicks on elements that were subsequently
|
|
232
|
-
* removed from the DOM during event handling (e.g. self-disappearing buttons).
|
|
233
|
-
* Falls back to `element.contains(event.target)` when `composedPath` is unavailable.
|
|
234
|
-
*
|
|
235
|
-
* @param {Element | null | undefined} element
|
|
236
|
-
* @param {Event | null | undefined} event
|
|
237
|
-
* @returns {boolean}
|
|
238
|
-
*/
|
|
239
|
-
function elementContainsEvent(element, event) {
|
|
240
|
-
if (!element) {
|
|
241
|
-
return false;
|
|
242
|
-
}
|
|
243
|
-
const path = typeof event?.composedPath === 'function' ? event.composedPath() : null;
|
|
244
|
-
if (path && path.length > 0) {
|
|
245
|
-
return path.includes(element);
|
|
246
|
-
}
|
|
247
|
-
return Boolean(event?.target && element.contains(event.target));
|
|
248
|
-
}
|
|
249
|
-
const CORRIDOR_BUFFER = 2;
|
|
250
|
-
function isPointInRect(x, y, rect) {
|
|
251
|
-
return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;
|
|
252
|
-
}
|
|
253
|
-
function pointInTriangle(px, py, ax, ay, bx, by, cx, cy) {
|
|
254
|
-
const d1 = (px - bx) * (ay - by) - (ax - bx) * (py - by);
|
|
255
|
-
const d2 = (px - cx) * (by - cy) - (bx - cx) * (py - cy);
|
|
256
|
-
const d3 = (px - ax) * (cy - ay) - (cx - ax) * (py - ay);
|
|
257
|
-
const hasNeg = d1 < 0 || d2 < 0 || d3 < 0;
|
|
258
|
-
const hasPos = d1 > 0 || d2 > 0 || d3 > 0;
|
|
259
|
-
return !(hasNeg && hasPos);
|
|
260
|
-
}
|
|
261
|
-
function pointInQuad(px, py, x1, y1, x2, y2, x3, y3, x4, y4) {
|
|
262
|
-
return pointInTriangle(px, py, x1, y1, x2, y2, x3, y3) || pointInTriangle(px, py, x1, y1, x3, y3, x4, y4);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Determine whether the cursor lies inside either rect or the diagonal safe-polygon
|
|
267
|
-
* corridor between the mouseleave exit point on the Target (or the Target's facing edge
|
|
268
|
-
* when synthetic events omit pointer coordinates) and the facing edge of the Attachment.
|
|
269
|
-
*
|
|
270
|
-
* Unlike an 8-corner bounding convex hull, this corridor only spans the gap between
|
|
271
|
-
* the Target's facing edge and the Attachment's facing edge, so exiting laterally
|
|
272
|
-
* into adjacent UI beside the Target never keeps the Attachment stuck open.
|
|
273
|
-
*
|
|
274
|
-
* Supports both DOM Elements and Floating UI VirtualElements via `getBoundingClientRect()`.
|
|
275
|
-
*
|
|
276
|
-
* @param {MouseEvent | { clientX: number, clientY: number }} event
|
|
277
|
-
* @param {{ x: number, y: number } | null | undefined} origin
|
|
278
|
-
* @param {Element | { getBoundingClientRect: Function } | null | undefined} target
|
|
279
|
-
* @param {Element | { getBoundingClientRect: Function } | null | undefined} floatingElement
|
|
280
|
-
* @returns {boolean}
|
|
281
|
-
*/
|
|
282
|
-
function isCursorInSafePolygon(event, origin, target, floatingElement) {
|
|
283
|
-
if (!event || !target || !floatingElement || typeof target.getBoundingClientRect !== 'function' || typeof floatingElement.getBoundingClientRect !== 'function') {
|
|
284
|
-
return false;
|
|
285
|
-
}
|
|
286
|
-
const targetRect = target.getBoundingClientRect();
|
|
287
|
-
const floatingRect = floatingElement.getBoundingClientRect();
|
|
288
|
-
if (floatingRect.width === 0 && floatingRect.height === 0) {
|
|
289
|
-
return false;
|
|
290
|
-
}
|
|
291
|
-
const px = event.clientX;
|
|
292
|
-
const py = event.clientY;
|
|
293
|
-
if (isPointInRect(px, py, targetRect) || isPointInRect(px, py, floatingRect)) {
|
|
294
|
-
return true;
|
|
295
|
-
}
|
|
296
|
-
const hasRealOrigin = Boolean(origin) && (origin.x !== 0 || origin.y !== 0 || isPointInRect(0, 0, targetRect));
|
|
297
|
-
|
|
298
|
-
// Attachment is above target: gap is between floatingRect.bottom and targetRect.top
|
|
299
|
-
if (floatingRect.bottom <= targetRect.top + CORRIDOR_BUFFER) {
|
|
300
|
-
const bx = floatingRect.left - CORRIDOR_BUFFER;
|
|
301
|
-
const by = floatingRect.bottom;
|
|
302
|
-
const cx = floatingRect.right + CORRIDOR_BUFFER;
|
|
303
|
-
const cy = floatingRect.bottom;
|
|
304
|
-
if (hasRealOrigin) {
|
|
305
|
-
return pointInTriangle(px, py, origin.x, origin.y + CORRIDOR_BUFFER, bx, by, cx, cy);
|
|
306
|
-
}
|
|
307
|
-
return pointInQuad(px, py, targetRect.left, targetRect.top + CORRIDOR_BUFFER, targetRect.right, targetRect.top + CORRIDOR_BUFFER, cx, cy, bx, by);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
// Attachment is below target: gap is between targetRect.bottom and floatingRect.top
|
|
311
|
-
if (floatingRect.top >= targetRect.bottom - CORRIDOR_BUFFER) {
|
|
312
|
-
const bx = floatingRect.left - CORRIDOR_BUFFER;
|
|
313
|
-
const by = floatingRect.top;
|
|
314
|
-
const cx = floatingRect.right + CORRIDOR_BUFFER;
|
|
315
|
-
const cy = floatingRect.top;
|
|
316
|
-
if (hasRealOrigin) {
|
|
317
|
-
return pointInTriangle(px, py, origin.x, origin.y - CORRIDOR_BUFFER, bx, by, cx, cy);
|
|
318
|
-
}
|
|
319
|
-
return pointInQuad(px, py, targetRect.left, targetRect.bottom - CORRIDOR_BUFFER, targetRect.right, targetRect.bottom - CORRIDOR_BUFFER, cx, cy, bx, by);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
// Attachment is to the left of target: gap is between floatingRect.right and targetRect.left
|
|
323
|
-
if (floatingRect.right <= targetRect.left + CORRIDOR_BUFFER) {
|
|
324
|
-
const bx = floatingRect.right;
|
|
325
|
-
const by = floatingRect.top - CORRIDOR_BUFFER;
|
|
326
|
-
const cx = floatingRect.right;
|
|
327
|
-
const cy = floatingRect.bottom + CORRIDOR_BUFFER;
|
|
328
|
-
if (hasRealOrigin) {
|
|
329
|
-
return pointInTriangle(px, py, origin.x + CORRIDOR_BUFFER, origin.y, bx, by, cx, cy);
|
|
330
|
-
}
|
|
331
|
-
return pointInQuad(px, py, targetRect.left + CORRIDOR_BUFFER, targetRect.top, targetRect.left + CORRIDOR_BUFFER, targetRect.bottom, cx, cy, bx, by);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
// Attachment is to the right of target: gap is between targetRect.right and floatingRect.left
|
|
335
|
-
if (floatingRect.left >= targetRect.right - CORRIDOR_BUFFER) {
|
|
336
|
-
const bx = floatingRect.left;
|
|
337
|
-
const by = floatingRect.top - CORRIDOR_BUFFER;
|
|
338
|
-
const cx = floatingRect.left;
|
|
339
|
-
const cy = floatingRect.bottom + CORRIDOR_BUFFER;
|
|
340
|
-
if (hasRealOrigin) {
|
|
341
|
-
return pointInTriangle(px, py, origin.x - CORRIDOR_BUFFER, origin.y, bx, by, cx, cy);
|
|
342
|
-
}
|
|
343
|
-
return pointInQuad(px, py, targetRect.right - CORRIDOR_BUFFER, targetRect.top, targetRect.right - CORRIDOR_BUFFER, targetRect.bottom, cx, cy, bx, by);
|
|
344
|
-
}
|
|
345
|
-
return false;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
const activeAttachers = new Set();
|
|
349
|
-
const floatingElementParentMap = new WeakMap();
|
|
350
|
-
const handledEscapeEvents = new WeakSet();
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* Register a mounted BasicAttacher instance in the in-process attachment tree.
|
|
354
|
-
*
|
|
355
|
-
* @param {object} attacher
|
|
356
|
-
*/
|
|
357
|
-
function registerAttacher(attacher) {
|
|
358
|
-
activeAttachers.add(attacher);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* Unregister a destroyed BasicAttacher instance from the in-process attachment tree.
|
|
363
|
-
*
|
|
364
|
-
* @param {object} attacher
|
|
365
|
-
*/
|
|
366
|
-
function unregisterAttacher(attacher) {
|
|
367
|
-
activeAttachers.delete(attacher);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* Resolve the logical parent BasicAttacher whose floating element contains
|
|
372
|
-
* this attacher's target or template parent element.
|
|
373
|
-
*
|
|
374
|
-
* @param {object} child
|
|
375
|
-
* @returns {object | null}
|
|
376
|
-
*/
|
|
377
|
-
function getParentAttacher(child) {
|
|
378
|
-
const anchors = [child._listenerTarget, child.parentElement].filter(Boolean);
|
|
379
|
-
for (const anchor of anchors) {
|
|
380
|
-
const start = anchor.classList?.contains('ember-attacher') ? anchor.parentElement : anchor;
|
|
381
|
-
const hostEl = start?.closest?.('.ember-attacher');
|
|
382
|
-
if (hostEl && hostEl !== child._floatingElement) {
|
|
383
|
-
for (const candidate of activeAttachers) {
|
|
384
|
-
if (candidate !== child && candidate._floatingElement === hostEl) {
|
|
385
|
-
if (child._floatingElement) {
|
|
386
|
-
floatingElementParentMap.set(child._floatingElement, candidate);
|
|
387
|
-
}
|
|
388
|
-
return candidate;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
if (child._floatingElement && floatingElementParentMap.has(child._floatingElement)) {
|
|
394
|
-
return floatingElementParentMap.get(child._floatingElement) ?? null;
|
|
395
|
-
}
|
|
396
|
-
return null;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Cache the parent attachment relationship on the child's floating element so
|
|
401
|
-
* clicks that unmount the child mid-event still trace back to the parent via composedPath.
|
|
402
|
-
*
|
|
403
|
-
* @param {object} attacher
|
|
404
|
-
*/
|
|
405
|
-
function syncParentAttachment(attacher) {
|
|
406
|
-
getParentAttacher(attacher);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* Check whether `candidate` is a logical descendant of `ancestor` in the attachment tree.
|
|
411
|
-
*
|
|
412
|
-
* @param {object} candidate
|
|
413
|
-
* @param {object} ancestor
|
|
414
|
-
* @returns {boolean}
|
|
415
|
-
*/
|
|
416
|
-
function isDescendantOf(candidate, ancestor) {
|
|
417
|
-
const visited = new Set();
|
|
418
|
-
let current = getParentAttacher(candidate);
|
|
419
|
-
while (current && !visited.has(current)) {
|
|
420
|
-
if (current === ancestor) {
|
|
421
|
-
return true;
|
|
422
|
-
}
|
|
423
|
-
visited.add(current);
|
|
424
|
-
current = getParentAttacher(current);
|
|
425
|
-
}
|
|
426
|
-
return false;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* Determine whether a DOM event originated inside any logical descendant Attachment
|
|
431
|
-
* (or its Target) of `parent`.
|
|
432
|
-
*
|
|
433
|
-
* @param {object} parent
|
|
434
|
-
* @param {Event} event
|
|
435
|
-
* @returns {boolean}
|
|
436
|
-
*/
|
|
437
|
-
function descendantAttachmentContainsEvent(parent, event) {
|
|
438
|
-
for (const candidate of activeAttachers) {
|
|
439
|
-
if (candidate !== parent && isDescendantOf(candidate, parent)) {
|
|
440
|
-
if (elementContainsEvent(candidate._floatingElement, event) || elementContainsEvent(candidate._listenerTarget, event)) {
|
|
441
|
-
return true;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
const path = typeof event?.composedPath === 'function' ? event.composedPath() : null;
|
|
446
|
-
if (path) {
|
|
447
|
-
for (const node of path) {
|
|
448
|
-
let currentParent = floatingElementParentMap.get(node);
|
|
449
|
-
const visited = new Set();
|
|
450
|
-
while (currentParent && !visited.has(currentParent)) {
|
|
451
|
-
if (currentParent === parent) {
|
|
452
|
-
return true;
|
|
453
|
-
}
|
|
454
|
-
visited.add(currentParent);
|
|
455
|
-
currentParent = getParentAttacher(currentParent) ?? (currentParent._floatingElement ? floatingElementParentMap.get(currentParent._floatingElement) : null);
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
return false;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
/**
|
|
463
|
-
* Determine whether a DOM node is contained inside any logical descendant Attachment
|
|
464
|
-
* (or its Target) of `parent`.
|
|
465
|
-
*
|
|
466
|
-
* @param {object} parent
|
|
467
|
-
* @param {Node | null | undefined} node
|
|
468
|
-
* @returns {boolean}
|
|
469
|
-
*/
|
|
470
|
-
function descendantAttachmentContainsNode(parent, node) {
|
|
471
|
-
if (!node) {
|
|
472
|
-
return false;
|
|
473
|
-
}
|
|
474
|
-
for (const candidate of activeAttachers) {
|
|
475
|
-
if (candidate !== parent && isDescendantOf(candidate, parent)) {
|
|
476
|
-
if (candidate._floatingElement?.contains(node) || candidate._listenerTarget?.contains(node)) {
|
|
477
|
-
return true;
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
return false;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* Enforce LIFO Escape dismissal across nested Attachments: only the deepest
|
|
486
|
-
* currently open escapable Attachment handles a given Escape keydown event.
|
|
487
|
-
*
|
|
488
|
-
* @param {object} attacher
|
|
489
|
-
* @param {KeyboardEvent} event
|
|
490
|
-
* @returns {boolean}
|
|
491
|
-
*/
|
|
492
|
-
function shouldHandleEscapeKey(attacher, event) {
|
|
493
|
-
if (handledEscapeEvents.has(event)) {
|
|
494
|
-
return false;
|
|
495
|
-
}
|
|
496
|
-
for (const candidate of activeAttachers) {
|
|
497
|
-
if (candidate !== attacher && !candidate.isDestroyed && !candidate.isDestroying && !candidate._isHiding && !candidate._positioningSuspended && Boolean(candidate._hideListenersOnDocumentByEvent?.keydown) && isDescendantOf(candidate, attacher)) {
|
|
498
|
-
return false;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
handledEscapeEvents.add(event);
|
|
502
|
-
return true;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* Target resolution seam for BasicAttacher.
|
|
507
|
-
*
|
|
508
|
-
* Keeps listener target and Floating UI reference selection in one private
|
|
509
|
-
* module so explicit targets (elements, virtual references, and selectors)
|
|
510
|
-
* can be resolved cleanly without cluttering positioning or lifecycle logic.
|
|
511
|
-
*/
|
|
512
|
-
|
|
513
|
-
/**
|
|
514
|
-
* Determine whether a target is a DOM Element.
|
|
515
|
-
*
|
|
516
|
-
* @param {unknown} value
|
|
517
|
-
* @returns {boolean}
|
|
518
|
-
*/
|
|
519
|
-
function isElementTarget(value) {
|
|
520
|
-
return typeof Element !== 'undefined' && value instanceof Element;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
/**
|
|
524
|
-
* Floating UI virtual references are plain objects with `getBoundingClientRect`.
|
|
525
|
-
*
|
|
526
|
-
* @param {unknown} value
|
|
527
|
-
* @returns {boolean}
|
|
528
|
-
*/
|
|
529
|
-
function isVirtualReference(value) {
|
|
530
|
-
if (value == null || typeof value !== 'object') {
|
|
531
|
-
return false;
|
|
532
|
-
}
|
|
533
|
-
if (isElementTarget(value)) {
|
|
534
|
-
return false;
|
|
535
|
-
}
|
|
536
|
-
return typeof value.getBoundingClientRect === 'function';
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
/**
|
|
540
|
-
* Resolve a public `@explicitTarget` value (Element | selector | virtual ref).
|
|
541
|
-
*
|
|
542
|
-
* Selector strings use `querySelectorAll` and must match exactly one node
|
|
543
|
-
* (same contract as `@floatingElementContainer`).
|
|
544
|
-
*
|
|
545
|
-
* @param {Element | string | { getBoundingClientRect: Function } | null | undefined} value
|
|
546
|
-
* @param {ParentNode | Document | null | undefined} root
|
|
547
|
-
* @returns {Element | { getBoundingClientRect: Function } | null}
|
|
548
|
-
*/
|
|
549
|
-
function coerceExplicitTarget(value, root) {
|
|
550
|
-
if (value == null) {
|
|
551
|
-
return null;
|
|
552
|
-
}
|
|
553
|
-
if (isElementTarget(value) || isVirtualReference(value)) {
|
|
554
|
-
return value;
|
|
555
|
-
}
|
|
556
|
-
if (typeof value === 'string') {
|
|
557
|
-
const doc = root ?? (typeof document !== 'undefined' ? document : null);
|
|
558
|
-
assert(`explicitTarget selector "${value}" cannot be resolved without a document`, doc != null);
|
|
559
|
-
const matches = doc.querySelectorAll(value);
|
|
560
|
-
assert(`explicitTarget selector "${value}" found ${matches.length} possible targets when there should be exactly 1`, matches.length === 1);
|
|
561
|
-
return matches[0];
|
|
562
|
-
}
|
|
563
|
-
assert('explicitTarget must be an Element, a CSS selector string, or a Floating UI virtual reference with getBoundingClientRect', false);
|
|
564
|
-
return null;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
/**
|
|
568
|
-
* Pick the Floating UI reference: explicit arg, then yielded registration, then parent.
|
|
569
|
-
* Supports both options-bag and positional signatures.
|
|
570
|
-
*
|
|
571
|
-
* @param {object | Element | string | { getBoundingClientRect: Function } | null | undefined} optionsOrExplicit
|
|
572
|
-
* @param {Element | { getBoundingClientRect: Function } | null | undefined} [registeredOrParent]
|
|
573
|
-
* @param {Element | null | undefined} [parentElement] Implicit parent from the meta finder.
|
|
574
|
-
* @param {ParentNode | Document | null | undefined} [root]
|
|
575
|
-
* @returns {Element | { getBoundingClientRect: Function } | null}
|
|
576
|
-
*/
|
|
577
|
-
function resolveAttachmentTarget(optionsOrExplicit, registeredOrParent, parentElement, root) {
|
|
578
|
-
let explicitTarget;
|
|
579
|
-
let registeredTarget;
|
|
580
|
-
let parent;
|
|
581
|
-
let searchRoot;
|
|
582
|
-
if (optionsOrExplicit != null && typeof optionsOrExplicit === 'object' && !isElementTarget(optionsOrExplicit) && !isVirtualReference(optionsOrExplicit)) {
|
|
583
|
-
({
|
|
584
|
-
explicitTarget,
|
|
585
|
-
registeredTarget,
|
|
586
|
-
parentElement: parent,
|
|
587
|
-
root: searchRoot
|
|
588
|
-
} = optionsOrExplicit);
|
|
589
|
-
} else {
|
|
590
|
-
explicitTarget = optionsOrExplicit;
|
|
591
|
-
if (arguments.length <= 2) {
|
|
592
|
-
parent = registeredOrParent;
|
|
593
|
-
} else {
|
|
594
|
-
registeredTarget = registeredOrParent;
|
|
595
|
-
parent = parentElement;
|
|
596
|
-
searchRoot = root;
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
if (explicitTarget != null) {
|
|
600
|
-
return coerceExplicitTarget(explicitTarget, searchRoot);
|
|
601
|
-
}
|
|
602
|
-
if (registeredTarget != null) {
|
|
603
|
-
return registeredTarget;
|
|
604
|
-
}
|
|
605
|
-
return parent ?? null;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
/**
|
|
609
|
-
* Extract the DOM Element that should receive event listeners.
|
|
610
|
-
* Real Elements receive events directly. Virtual references may provide a
|
|
611
|
-
* `contextElement`; virtual references without a contextElement attach no listeners.
|
|
612
|
-
*
|
|
613
|
-
* @param {Element | { getBoundingClientRect: Function, contextElement?: Element } | null | undefined} target
|
|
614
|
-
* @returns {Element | null}
|
|
615
|
-
*/
|
|
616
|
-
function getListenerTarget(target) {
|
|
617
|
-
if (isElementTarget(target)) {
|
|
618
|
-
return target;
|
|
619
|
-
}
|
|
620
|
-
if (isVirtualReference(target) && isElementTarget(target.contextElement)) {
|
|
621
|
-
return target.contextElement;
|
|
622
|
-
}
|
|
623
|
-
return null;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
/**
|
|
627
|
-
* Whether the current browser environment supports Top-Layer `[popover="manual"]`.
|
|
628
|
-
*
|
|
629
|
-
* @returns {boolean}
|
|
630
|
-
*/
|
|
631
|
-
function supportsPopoverHost() {
|
|
632
|
-
return typeof HTMLElement !== 'undefined' && typeof HTMLElement.prototype.showPopover === 'function';
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
/**
|
|
636
|
-
* Find the nearest open modal `<dialog>` (`dialog:modal`) enclosing a context node,
|
|
637
|
-
* so Top-Layer attachments opened inside `showModal()` stay DOM-inside the modal
|
|
638
|
-
* and do not become inert.
|
|
639
|
-
*
|
|
640
|
-
* @param {Element | null | undefined} contextNode
|
|
641
|
-
* @returns {Element | null}
|
|
642
|
-
*/
|
|
643
|
-
function getModalDialogContainer(contextNode) {
|
|
644
|
-
if (!isElementTarget(contextNode) || typeof contextNode.closest !== 'function') {
|
|
645
|
-
return null;
|
|
646
|
-
}
|
|
647
|
-
try {
|
|
648
|
-
return contextNode.closest('dialog:modal');
|
|
649
|
-
} catch {
|
|
650
|
-
return null;
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
/**
|
|
655
|
-
* Resolve the DOM destination element for `MaybeInElement`.
|
|
656
|
-
*
|
|
657
|
-
* @param {{
|
|
658
|
-
* renderInPlace: boolean,
|
|
659
|
-
* parentElement: Element | null,
|
|
660
|
-
* maybeContainer: Element | string | null | undefined,
|
|
661
|
-
* hasCustomContainer: boolean,
|
|
662
|
-
* modalContainer: Element | null,
|
|
663
|
-
* usePopoverHost: boolean,
|
|
664
|
-
* }} options
|
|
665
|
-
* @returns {Element | undefined}
|
|
666
|
-
*/
|
|
667
|
-
function resolveHostContainer({
|
|
668
|
-
renderInPlace,
|
|
669
|
-
parentElement,
|
|
670
|
-
maybeContainer,
|
|
671
|
-
hasCustomContainer,
|
|
672
|
-
modalContainer,
|
|
673
|
-
usePopoverHost
|
|
674
|
-
}) {
|
|
675
|
-
if (renderInPlace) {
|
|
676
|
-
return parentElement;
|
|
677
|
-
}
|
|
678
|
-
if (maybeContainer instanceof Element) {
|
|
679
|
-
return maybeContainer;
|
|
680
|
-
}
|
|
681
|
-
if (!hasCustomContainer && modalContainer) {
|
|
682
|
-
return modalContainer;
|
|
683
|
-
}
|
|
684
|
-
if (typeof maybeContainer === 'string') {
|
|
685
|
-
const possibleContainers = document.querySelectorAll(maybeContainer);
|
|
686
|
-
|
|
687
|
-
// DEFAULTS.floatingElementContainer is '.ember-application'; embedded or
|
|
688
|
-
// standalone Top-Layer mounts without .ember-application fall back to body.
|
|
689
|
-
if (possibleContainers.length === 0 && !hasCustomContainer && usePopoverHost) {
|
|
690
|
-
return document.body;
|
|
691
|
-
}
|
|
692
|
-
assert(`floatingElementContainer selector "${maybeContainer}" found ` + `${possibleContainers.length} possible containers when there should be exactly 1`, possibleContainers.length === 1);
|
|
693
|
-
return possibleContainers[0];
|
|
694
|
-
}
|
|
695
|
-
return undefined;
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
/**
|
|
699
|
-
* Promote a `[popover]` host element into the browser Top Layer.
|
|
700
|
-
* If `showPopover()` throws, logs a debug warning and removes `[popover]` so the
|
|
701
|
-
* `{{#in-element}}` portal fallback stays visible instead of matching UA `:not(:popover-open)`.
|
|
702
|
-
*
|
|
703
|
-
* @param {Element | null | undefined} el
|
|
704
|
-
*/
|
|
705
|
-
function showPopoverHost(el) {
|
|
706
|
-
if (el && el.isConnected && el.hasAttribute('popover') && typeof el.showPopover === 'function') {
|
|
707
|
-
try {
|
|
708
|
-
if (!el.matches(':popover-open')) {
|
|
709
|
-
el.showPopover();
|
|
710
|
-
}
|
|
711
|
-
} catch (error) {
|
|
712
|
-
warn(`[ember-attacher] Top-layer showPopover failed: ${error?.message ?? error}`, false, {
|
|
713
|
-
id: 'ember-attacher.popover-error'
|
|
714
|
-
});
|
|
715
|
-
el.removeAttribute('popover');
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
/**
|
|
721
|
-
* Remove a `[popover]` host element from the browser Top Layer.
|
|
722
|
-
*
|
|
723
|
-
* @param {Element | null | undefined} el
|
|
724
|
-
*/
|
|
725
|
-
function hidePopoverHost(el) {
|
|
726
|
-
if (el && el.isConnected && el.hasAttribute('popover') && typeof el.hidePopover === 'function') {
|
|
727
|
-
try {
|
|
728
|
-
if (el.matches(':popover-open')) {
|
|
729
|
-
el.hidePopover();
|
|
730
|
-
}
|
|
731
|
-
} catch (error) {
|
|
732
|
-
warn(`[ember-attacher] Top-layer hidePopover failed: ${error?.message ?? error}`, false, {
|
|
733
|
-
id: 'ember-attacher.popover-error'
|
|
734
|
-
});
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
function consume(positional) {
|
|
740
|
-
for (let i = 0; i < positional.length; i++) {
|
|
741
|
-
void positional[i];
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
/**
|
|
746
|
-
* Run once per element, after render, so tracked writes do not hit the modifier's tracking frame.
|
|
747
|
-
*
|
|
748
|
-
* @param {Function} fn
|
|
749
|
-
* @returns {import('ember-modifier').ModifierFunction}
|
|
750
|
-
*/
|
|
751
|
-
function onInsert(fn) {
|
|
752
|
-
const seen = new WeakSet();
|
|
753
|
-
return modifier(element => {
|
|
754
|
-
if (seen.has(element)) {
|
|
755
|
-
return;
|
|
756
|
-
}
|
|
757
|
-
seen.add(element);
|
|
758
|
-
const timer = schedule('actions', fn, element);
|
|
759
|
-
return () => cancel(timer);
|
|
760
|
-
});
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
/**
|
|
764
|
-
* Skip install ({{did-update}} semantics). Each factory has its own WeakSet so two
|
|
765
|
-
* onUpdate modifiers on the same node do not steal each other's first run.
|
|
766
|
-
*
|
|
767
|
-
* @param {Function} fn
|
|
768
|
-
* @returns {import('ember-modifier').ModifierFunction}
|
|
769
|
-
*/
|
|
770
|
-
function onUpdate(fn) {
|
|
771
|
-
const seen = new WeakSet();
|
|
772
|
-
return modifier((element, positional) => {
|
|
773
|
-
consume(positional);
|
|
774
|
-
if (!seen.has(element)) {
|
|
775
|
-
seen.add(element);
|
|
776
|
-
return;
|
|
777
|
-
}
|
|
778
|
-
fn();
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
/**
|
|
783
|
-
* Check whether an attachment target (DOM Element or VirtualElement) is still connected.
|
|
784
|
-
*
|
|
785
|
-
* @param {Element | { contextElement?: Element } | null | undefined} target
|
|
786
|
-
* @returns {boolean}
|
|
787
|
-
*/
|
|
788
|
-
function isTargetConnected(target) {
|
|
789
|
-
if (!target) {
|
|
790
|
-
return false;
|
|
791
|
-
}
|
|
792
|
-
if (isElementTarget(target)) {
|
|
793
|
-
return target.isConnected;
|
|
794
|
-
}
|
|
795
|
-
if (target.contextElement instanceof Element) {
|
|
796
|
-
return target.contextElement.isConnected;
|
|
797
|
-
}
|
|
798
|
-
return true;
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
/**
|
|
802
|
-
* Normalize and deduplicate the Floating UI middleware array without mutating
|
|
803
|
-
* caller-supplied middleware objects.
|
|
804
|
-
*
|
|
805
|
-
* @param {{
|
|
806
|
-
* rawMiddleware: Array<any> | null | undefined,
|
|
807
|
-
* arrowElement: Element | null,
|
|
808
|
-
* flipOption: string | null | undefined,
|
|
809
|
-
* overflowPadding: number | boolean | undefined,
|
|
810
|
-
* arrowEnabled: boolean,
|
|
811
|
-
* }} options
|
|
812
|
-
* @returns {Array<any>}
|
|
813
|
-
*/
|
|
814
|
-
function buildMiddleware({
|
|
815
|
-
rawMiddleware,
|
|
816
|
-
arrowElement,
|
|
817
|
-
flipOption,
|
|
818
|
-
overflowPadding,
|
|
819
|
-
arrowEnabled
|
|
820
|
-
}) {
|
|
821
|
-
const middleware = (rawMiddleware || []).map(m => {
|
|
822
|
-
if (m?.name === 'arrow' && arrowElement) {
|
|
823
|
-
if (typeof m.options === 'function') {
|
|
824
|
-
return arrow(state => {
|
|
825
|
-
const resolved = m.options(state) || {};
|
|
826
|
-
return resolved.element ? resolved : {
|
|
827
|
-
...resolved,
|
|
828
|
-
element: arrowElement
|
|
829
|
-
};
|
|
830
|
-
});
|
|
831
|
-
}
|
|
832
|
-
if (!m.options?.element) {
|
|
833
|
-
return arrow({
|
|
834
|
-
...m.options,
|
|
835
|
-
element: arrowElement
|
|
836
|
-
});
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
return m;
|
|
840
|
-
});
|
|
841
|
-
if (!middleware.some(m => m?.name === 'flip')) {
|
|
842
|
-
if (flipOption) {
|
|
843
|
-
middleware.push(flip({
|
|
844
|
-
fallbackPlacements: flipOption.split(' ')
|
|
845
|
-
}));
|
|
846
|
-
} else if (overflowPadding !== false) {
|
|
847
|
-
middleware.push(flip());
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
if (overflowPadding !== false && !middleware.some(m => m?.name === 'shift')) {
|
|
851
|
-
middleware.push(shift({
|
|
852
|
-
limiter: limitShift(),
|
|
853
|
-
padding: overflowPadding
|
|
854
|
-
}));
|
|
855
|
-
}
|
|
856
|
-
if (arrowEnabled && arrowElement && !middleware.some(m => m?.name === 'arrow')) {
|
|
857
|
-
middleware.push(arrow({
|
|
858
|
-
element: arrowElement
|
|
859
|
-
}));
|
|
860
|
-
}
|
|
861
|
-
return middleware;
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
/**
|
|
865
|
-
* Apply the resolved `computePosition` coordinates, arrow offset, `middlewareData.hide`
|
|
866
|
-
* attributes, and `x-placement` to the floating and arrow elements.
|
|
867
|
-
*
|
|
868
|
-
* @param {Element} floatingElement
|
|
869
|
-
* @param {Element | null} arrowElement
|
|
870
|
-
* @param {{
|
|
871
|
-
* x: number,
|
|
872
|
-
* y: number,
|
|
873
|
-
* placement: string,
|
|
874
|
-
* strategy: string,
|
|
875
|
-
* middlewareData: Record<string, any>,
|
|
876
|
-
* isHidden: boolean,
|
|
877
|
-
* }} result
|
|
878
|
-
*/
|
|
879
|
-
function applyPositionResult(floatingElement, arrowElement, {
|
|
880
|
-
x,
|
|
881
|
-
y,
|
|
882
|
-
placement,
|
|
883
|
-
strategy,
|
|
884
|
-
middlewareData,
|
|
885
|
-
isHidden
|
|
886
|
-
}) {
|
|
887
|
-
Object.assign(floatingElement.style, {
|
|
888
|
-
position: strategy,
|
|
889
|
-
left: `${x}px`,
|
|
890
|
-
top: `${y}px`
|
|
891
|
-
});
|
|
892
|
-
if (middlewareData.arrow && arrowElement) {
|
|
893
|
-
const {
|
|
894
|
-
x: arrowX,
|
|
895
|
-
y: arrowY
|
|
896
|
-
} = middlewareData.arrow;
|
|
897
|
-
Object.assign(arrowElement.style, {
|
|
898
|
-
left: arrowX != null ? `${arrowX}px` : '',
|
|
899
|
-
top: arrowY != null ? `${arrowY}px` : ''
|
|
900
|
-
});
|
|
901
|
-
}
|
|
902
|
-
if (middlewareData.hide) {
|
|
903
|
-
const {
|
|
904
|
-
referenceHidden,
|
|
905
|
-
escaped
|
|
906
|
-
} = middlewareData.hide;
|
|
907
|
-
if (referenceHidden) {
|
|
908
|
-
floatingElement.setAttribute('data-reference-hidden', '');
|
|
909
|
-
} else {
|
|
910
|
-
floatingElement.removeAttribute('data-reference-hidden');
|
|
911
|
-
}
|
|
912
|
-
if (escaped) {
|
|
913
|
-
floatingElement.setAttribute('data-escaped', '');
|
|
914
|
-
} else {
|
|
915
|
-
floatingElement.removeAttribute('data-escaped');
|
|
916
|
-
}
|
|
917
|
-
if (referenceHidden || escaped) {
|
|
918
|
-
floatingElement.style.visibility = 'hidden';
|
|
919
|
-
} else if (!isHidden) {
|
|
920
|
-
floatingElement.style.visibility = '';
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
floatingElement.setAttribute('x-placement', placement);
|
|
924
|
-
}
|
|
925
|
-
|
|
926
7
|
var MaybeInElement = setComponentTemplate(precompileTemplate("{{~#if @renderInPlace~}}{{yield}}{{~else~}}{{#in-element @destinationElement insertBefore=null}}{{yield}}{{/in-element}}{{~/if~}}", {
|
|
927
8
|
strictMode: true
|
|
928
9
|
}), templateOnly());
|
|
929
10
|
|
|
930
|
-
var TEMPLATE = precompileTemplate("{{~#unless this.renderFloatingElement~}}<meta hidden {{this.parentFinder}} {{this.targetDidUpdate this.hideOn this.showOn @explicitTarget}} {{this.isShownDidUpdate this.
|
|
11
|
+
var TEMPLATE = precompileTemplate("{{~#if (has-block \"target\")~}}{{yield this.core.api.target this.core.api to=\"target\"}}{{~/if~}}{{~#unless this.core.renderFloatingElement~}}<meta hidden {{this.core.parentFinder (has-block \"target\")}} {{this.core.targetDidUpdate this.core.hideOn this.core.showOn @target @explicitTarget @id}} {{this.core.isShownDidUpdate this.core.controlledIsShown}}/>{{~/unless~}}{{~#if this.core.renderFloatingElement~}}<this.MaybeInElement @destinationElement={{this.core._floatingElementContainer}} @renderInPlace={{this.core._renderInPlace}}><div\n class=\"ember-attacher\"\n id={{this.core.id}}\n popover={{this.core._popoverAttr}}\n role={{this.core.ariaRole}}\n {{this.core.setupFloatingElement (has-block \"target\")}}\n {{this.core.targetDidUpdate this.core.hideOn this.core.showOn @target @explicitTarget @id}}\n {{this.core.isShownDidUpdate this.core.controlledIsShown}}\n {{this.core.optionsDidUpdate this.core.autoUpdate this.core.animation this.core.arrow this.core.useCapture this.core.placement this.core.strategy this.core._renderInPlace this.core._middleware this.core.id this.core.ariaRole}}\n ...attributes\n >\n {{#if this.core.shouldRenderFloatingElement}}\n <div class={{this.core._class}} style={{this.core._style}}>\n {{~#if (has-block \"content\")~}}{{yield this.core.api to=\"content\"}}{{~else if (has-block)~}}{{yield this.core.api}}{{~/if~}}\n {{#if this.core.arrow}}\n <div class=\"ember-attacher-arrow\" x-arrow {{this.core.insertArrow}}></div>\n {{/if}}\n {{#if this.core.isFillAnimation}}\n <div class=\"ember-attacher-fill-backdrop\" aria-hidden=\"true\">\n <div x-circle></div>\n </div>\n {{/if}}\n </div>\n {{/if}}\n </div></this.MaybeInElement>{{~/if~}}");
|
|
931
12
|
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
return this._opt('autoUpdate');
|
|
943
|
-
}
|
|
944
|
-
get animation() {
|
|
945
|
-
return this.args.animation || this._config.animation || DEFAULTS.animation;
|
|
946
|
-
}
|
|
947
|
-
get flip() {
|
|
948
|
-
return this._opt('flip');
|
|
949
|
-
}
|
|
950
|
-
get hideDelay() {
|
|
951
|
-
return this._opt('hideDelay');
|
|
952
|
-
}
|
|
953
|
-
get hideDuration() {
|
|
954
|
-
return this._opt('hideDuration');
|
|
955
|
-
}
|
|
956
|
-
get hideOn() {
|
|
957
|
-
return this.args.hideOn === null ? null : this._opt('hideOn');
|
|
958
|
-
}
|
|
959
|
-
get interactive() {
|
|
960
|
-
return this._opt('interactive');
|
|
961
|
-
}
|
|
962
|
-
get isOffset() {
|
|
963
|
-
return this._opt('isOffset');
|
|
964
|
-
}
|
|
965
|
-
get isShown() {
|
|
966
|
-
return this._opt('isShown');
|
|
967
|
-
}
|
|
968
|
-
get lazyRender() {
|
|
969
|
-
return this._opt('lazyRender');
|
|
970
|
-
}
|
|
971
|
-
get overflowPadding() {
|
|
972
|
-
return this._opt('overflowPadding');
|
|
973
|
-
}
|
|
974
|
-
get placement() {
|
|
975
|
-
return this._opt('placement');
|
|
976
|
-
}
|
|
977
|
-
get renderInPlace() {
|
|
978
|
-
return this._opt('renderInPlace');
|
|
979
|
-
}
|
|
980
|
-
get showDelay() {
|
|
981
|
-
return this._opt('showDelay');
|
|
982
|
-
}
|
|
983
|
-
get showDuration() {
|
|
984
|
-
return this._opt('showDuration');
|
|
985
|
-
}
|
|
986
|
-
get showOn() {
|
|
987
|
-
return this.args.showOn === null ? null : this._opt('showOn');
|
|
988
|
-
}
|
|
989
|
-
get strategy() {
|
|
990
|
-
return this._opt('strategy');
|
|
991
|
-
}
|
|
992
|
-
get style() {
|
|
993
|
-
return this._opt('style');
|
|
994
|
-
}
|
|
995
|
-
get useCapture() {
|
|
996
|
-
return this._opt('useCapture');
|
|
997
|
-
}
|
|
998
|
-
get class() {
|
|
999
|
-
return this.args.class || this._config.class;
|
|
1000
|
-
}
|
|
1001
|
-
get floatingElementContainer() {
|
|
1002
|
-
return this.args.floatingElementContainer || this._config.floatingElementContainer || DEFAULTS.floatingElementContainer;
|
|
1003
|
-
}
|
|
1004
|
-
get floatingUiOptions() {
|
|
1005
|
-
return this.args.floatingUiOptions || this._config.floatingUiOptions || DEFAULTS.floatingUiOptions;
|
|
1006
|
-
}
|
|
1007
|
-
get configKey() {
|
|
1008
|
-
return this.args.configKey || 'popover';
|
|
1009
|
-
}
|
|
1010
|
-
get _isTooltip() {
|
|
1011
|
-
return this.configKey === 'tooltip' || this.args.ariaRole === 'tooltip';
|
|
1012
|
-
}
|
|
1013
|
-
get isFillAnimation() {
|
|
1014
|
-
return this.animation === 'fill';
|
|
1015
|
-
}
|
|
1016
|
-
get renderFloatingElement() {
|
|
1017
|
-
return Boolean(this.renderInPlace || this._currentTarget);
|
|
1018
|
-
}
|
|
1019
|
-
get shouldRenderFloatingElement() {
|
|
1020
|
-
return !this.lazyRender || this._mustRender;
|
|
1021
|
-
}
|
|
1022
|
-
get id() {
|
|
1023
|
-
return this.args.id || `${guidFor(this)}-floating`;
|
|
1024
|
-
}
|
|
1025
|
-
get _class() {
|
|
1026
|
-
const showOrHideClass = `ember-attacher-${this._isStartingAnimation ? 'show' : 'hide'}`;
|
|
1027
|
-
const arrowClass = `ember-attacher-${this.arrow ? 'with' : 'without'}-arrow`;
|
|
1028
|
-
return [`ember-attacher-${this.animation}`, this.class || '', this.args.additionalClass || '', showOrHideClass, arrowClass].filter(Boolean).join(' ');
|
|
1029
|
-
}
|
|
1030
|
-
get _style() {
|
|
1031
|
-
const style = this.style;
|
|
1032
|
-
if (!style) {
|
|
1033
|
-
return undefined;
|
|
1034
|
-
}
|
|
1035
|
-
warn('@ember/string/htmlSafe must be used for any `style` passed to ember-attacher', isHTMLSafe(style), {
|
|
1036
|
-
id: 'ember-attacher-require-html-safe-style'
|
|
13
|
+
class BasicAttacher extends Component {
|
|
14
|
+
constructor(owner, args) {
|
|
15
|
+
super(owner, args);
|
|
16
|
+
this.MaybeInElement = MaybeInElement;
|
|
17
|
+
this.core = new AttacherCore(this, () => this.args, {
|
|
18
|
+
defaultConfigKey: this._defaultConfigKey,
|
|
19
|
+
defaultAriaRole: this._defaultAriaRole,
|
|
20
|
+
getAdditionalClass: () => this.additionalClass,
|
|
21
|
+
allowParentFallback: true,
|
|
22
|
+
isComponentHost: true
|
|
1037
23
|
});
|
|
1038
|
-
return style;
|
|
1039
|
-
}
|
|
1040
|
-
get _envConfig() {
|
|
1041
|
-
return getOwner(this).resolveRegistration('config:environment').emberAttacher || {};
|
|
1042
|
-
}
|
|
1043
|
-
get _config() {
|
|
1044
|
-
return {
|
|
1045
|
-
...this._envConfig,
|
|
1046
|
-
...this._envConfig[this.configKey]
|
|
1047
|
-
};
|
|
1048
24
|
}
|
|
1049
|
-
get
|
|
1050
|
-
const hideOn = this.hideOn === undefined ? DEFAULTS.hideOn : this.hideOn;
|
|
1051
|
-
return hideOn === null ? [] : hideOn.split(' ');
|
|
1052
|
-
}
|
|
1053
|
-
get _showOn() {
|
|
1054
|
-
const showOn = this.showOn === undefined ? DEFAULTS.showOn : this.showOn;
|
|
1055
|
-
return showOn === null ? [] : showOn.split(' ');
|
|
1056
|
-
}
|
|
1057
|
-
get _middleware() {
|
|
1058
|
-
return buildMiddleware({
|
|
1059
|
-
rawMiddleware: this._opt('middleware'),
|
|
1060
|
-
arrowElement: this._arrowElement,
|
|
1061
|
-
flipOption: this.flip,
|
|
1062
|
-
overflowPadding: this.overflowPadding,
|
|
1063
|
-
arrowEnabled: Boolean(this.arrow)
|
|
1064
|
-
});
|
|
1065
|
-
}
|
|
1066
|
-
get _hasCustomFloatingElementContainer() {
|
|
1067
|
-
return Boolean(this.args.floatingElementContainer || this._config.floatingElementContainer);
|
|
1068
|
-
}
|
|
1069
|
-
get _usePopoverHost() {
|
|
1070
|
-
return supportsPopoverHost() && !this._renderInPlace && !this._hasCustomFloatingElementContainer;
|
|
1071
|
-
}
|
|
1072
|
-
get _popoverAttr() {
|
|
1073
|
-
return this._usePopoverHost ? 'manual' : undefined;
|
|
1074
|
-
}
|
|
1075
|
-
get _renderInPlace() {
|
|
1076
|
-
return typeof document !== 'undefined' ? Boolean(this.renderInPlace) : true;
|
|
1077
|
-
}
|
|
1078
|
-
get _floatingElementContainer() {
|
|
1079
|
-
return resolveHostContainer({
|
|
1080
|
-
renderInPlace: this._renderInPlace,
|
|
1081
|
-
parentElement: this.parentElement,
|
|
1082
|
-
maybeContainer: this.floatingElementContainer,
|
|
1083
|
-
hasCustomContainer: this._hasCustomFloatingElementContainer,
|
|
1084
|
-
modalContainer: this._modalContainer,
|
|
1085
|
-
usePopoverHost: this._usePopoverHost
|
|
1086
|
-
});
|
|
1087
|
-
}
|
|
1088
|
-
_syncModalContainer() {
|
|
1089
|
-
if (this._renderInPlace || this._hasCustomFloatingElementContainer) {
|
|
1090
|
-
if (this._modalContainer !== null) {
|
|
1091
|
-
this._modalContainer = null;
|
|
1092
|
-
}
|
|
1093
|
-
return false;
|
|
1094
|
-
}
|
|
1095
|
-
const modalDialog = getModalDialogContainer(this._listenerTarget || this.parentElement);
|
|
1096
|
-
if (this._modalContainer !== modalDialog) {
|
|
1097
|
-
this._modalContainer = modalDialog;
|
|
1098
|
-
return true;
|
|
1099
|
-
}
|
|
1100
|
-
return false;
|
|
1101
|
-
}
|
|
1102
|
-
_applyVisibility(isVisible) {
|
|
1103
|
-
if (!isVisible) {
|
|
1104
|
-
this._cleanup?.();
|
|
1105
|
-
this._cleanup = null;
|
|
1106
|
-
}
|
|
1107
|
-
this._floatingElement.style.display = isVisible ? 'block' : 'none';
|
|
1108
|
-
// Prevent jank by keeping the attachment invisible until positioned by _startShowAnimation().
|
|
1109
|
-
this._floatingElement.style.visibility = isVisible ? 'hidden' : '';
|
|
1110
|
-
if (isVisible) {
|
|
1111
|
-
showPopoverHost(this._floatingElement);
|
|
1112
|
-
} else {
|
|
1113
|
-
hidePopoverHost(this._floatingElement);
|
|
1114
|
-
}
|
|
1115
|
-
this.args.onChange?.(isVisible);
|
|
1116
|
-
}
|
|
1117
|
-
_setIsVisibleAfterDelay(isVisible, delay) {
|
|
1118
|
-
if (!this._floatingElement) {
|
|
1119
|
-
this._animationTimeout = requestAnimationFrame(() => {
|
|
1120
|
-
this._setIsVisibleAfterDelay(isVisible, delay);
|
|
1121
|
-
});
|
|
1122
|
-
return;
|
|
1123
|
-
}
|
|
1124
|
-
if (delay) {
|
|
1125
|
-
this._delayedVisibilityToggle = later(this, () => {
|
|
1126
|
-
this._animationTimeout = requestAnimationFrame(() => {
|
|
1127
|
-
animationTestWaiter.endAsync(this._animationTimeout);
|
|
1128
|
-
if (!this.isDestroyed && !this.isDestroying) {
|
|
1129
|
-
this._applyVisibility(isVisible);
|
|
1130
|
-
}
|
|
1131
|
-
});
|
|
1132
|
-
animationTestWaiter.beginAsync(this._animationTimeout);
|
|
1133
|
-
}, delay);
|
|
1134
|
-
} else {
|
|
1135
|
-
this._applyVisibility(isVisible);
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
hide() {
|
|
1139
|
-
this._hide();
|
|
1140
|
-
}
|
|
1141
|
-
setReference(target) {
|
|
1142
|
-
cancel(this._setReferenceTimer);
|
|
1143
|
-
this._setReferenceTimer = schedule('actions', () => {
|
|
1144
|
-
this._setReferenceTimer = null;
|
|
1145
|
-
if (this.isDestroyed || this.isDestroying) {
|
|
1146
|
-
return;
|
|
1147
|
-
}
|
|
1148
|
-
const nextTarget = target ?? null;
|
|
1149
|
-
if (this._registeredTarget === nextTarget) {
|
|
1150
|
-
return;
|
|
1151
|
-
}
|
|
1152
|
-
this._registeredTarget = nextTarget;
|
|
1153
|
-
this._initializeAttacher();
|
|
1154
|
-
});
|
|
1155
|
-
}
|
|
1156
|
-
_ensureArgumentsAreValid() {
|
|
1157
|
-
runInDebug(() => {
|
|
1158
|
-
if (this.arrow && this.isFillAnimation) {
|
|
1159
|
-
warn('Animation: \'fill\' is not compatible with arrow: true', {
|
|
1160
|
-
id: 70015
|
|
1161
|
-
});
|
|
1162
|
-
}
|
|
1163
|
-
if (this.useCapture !== this._lastUseCaptureArgumentValue) {
|
|
1164
|
-
warn('The value of the useCapture argument was mutated', {
|
|
1165
|
-
id: 'ember-attacher.use-capture-mutated'
|
|
1166
|
-
});
|
|
1167
|
-
}
|
|
1168
|
-
});
|
|
1169
|
-
}
|
|
1170
|
-
constructor() {
|
|
1171
|
-
super(...arguments);
|
|
1172
|
-
_defineProperty(this, "MaybeInElement", MaybeInElement);
|
|
1173
|
-
_initializerDefineProperty(this, "parentNotFound", _descriptor, this);
|
|
1174
|
-
_initializerDefineProperty(this, "parentElement", _descriptor2, this);
|
|
1175
|
-
_initializerDefineProperty(this, "_isStartingAnimation", _descriptor3, this);
|
|
1176
|
-
_initializerDefineProperty(this, "_arrowElement", _descriptor4, this);
|
|
1177
|
-
_initializerDefineProperty(this, "_currentTarget", _descriptor5, this);
|
|
1178
|
-
_initializerDefineProperty(this, "_registeredTarget", _descriptor6, this);
|
|
1179
|
-
_initializerDefineProperty(this, "_mustRender", _descriptor7, this);
|
|
1180
|
-
_initializerDefineProperty(this, "_modalContainer", _descriptor8, this);
|
|
1181
|
-
_defineProperty(this, "_setReferenceTimer", null);
|
|
1182
|
-
// Untracked copy of the node listeners are on so `_removeEventListeners` does
|
|
1183
|
-
// not read `_currentTarget` in the same frame that writes it (`targetDidUpdate`).
|
|
1184
|
-
_defineProperty(this, "_listenerTarget", null);
|
|
1185
|
-
_defineProperty(this, "_floatingElement", null);
|
|
1186
|
-
_defineProperty(this, "parentFinder", onInsert(element => {
|
|
1187
|
-
if (!this.isDestroyed && !this.isDestroying) {
|
|
1188
|
-
this.parentElement = element.parentElement;
|
|
1189
|
-
this._initializeAttacher();
|
|
1190
|
-
}
|
|
1191
|
-
}));
|
|
1192
|
-
// Insert + autoUpdate teardown. Must not read tracked state synchronously in
|
|
1193
|
-
// the modifier callback (the scheduled fn is fine) or tracked updates will re-fire teardown.
|
|
1194
|
-
_defineProperty(this, "setupFloatingElement", modifier(element => {
|
|
1195
|
-
this._floatingElement = element;
|
|
1196
|
-
registerAttacher(this);
|
|
1197
|
-
const timer = schedule('actions', () => {
|
|
1198
|
-
if (this.isDestroyed || this.isDestroying) {
|
|
1199
|
-
return;
|
|
1200
|
-
}
|
|
1201
|
-
this._floatingElement = element;
|
|
1202
|
-
if (this.renderInPlace) {
|
|
1203
|
-
this.parentElement = element.parentElement;
|
|
1204
|
-
this._initializeAttacher();
|
|
1205
|
-
} else {
|
|
1206
|
-
syncParentAttachment(this);
|
|
1207
|
-
}
|
|
1208
|
-
});
|
|
1209
|
-
return () => {
|
|
1210
|
-
cancel(timer);
|
|
1211
|
-
if (this._floatingElement === element) {
|
|
1212
|
-
this._floatingElement = null;
|
|
1213
|
-
}
|
|
1214
|
-
this._cleanup?.();
|
|
1215
|
-
};
|
|
1216
|
-
}));
|
|
1217
|
-
_defineProperty(this, "insertArrow", onInsert(element => {
|
|
1218
|
-
if (!this.isDestroyed && !this.isDestroying) {
|
|
1219
|
-
this._arrowElement = element;
|
|
1220
|
-
}
|
|
1221
|
-
}));
|
|
1222
|
-
_defineProperty(this, "isShownDidUpdate", onUpdate(() => this._syncIsShown()));
|
|
1223
|
-
_defineProperty(this, "targetDidUpdate", onUpdate(() => this._initializeAttacher()));
|
|
1224
|
-
_defineProperty(this, "optionsDidUpdate", onUpdate(() => {
|
|
1225
|
-
this._ensureArgumentsAreValid();
|
|
1226
|
-
this._syncAria();
|
|
1227
|
-
this._update();
|
|
1228
|
-
}));
|
|
1229
|
-
_defineProperty(this, "reference", modifier(element => {
|
|
1230
|
-
this.setReference(element);
|
|
1231
|
-
return () => {
|
|
1232
|
-
if (!this.isDestroyed && !this.isDestroying && this._registeredTarget === element) {
|
|
1233
|
-
this.setReference(null);
|
|
1234
|
-
}
|
|
1235
|
-
};
|
|
1236
|
-
}));
|
|
1237
|
-
registerAttacher(this);
|
|
1238
|
-
this._delayedVisibilityToggle = null;
|
|
1239
|
-
this._isHidden = true;
|
|
1240
|
-
this._isHiding = false;
|
|
1241
|
-
this._positioningSuspended = false;
|
|
1242
|
-
this._animationTimeout = null;
|
|
1243
|
-
this._hideListenersOnDocumentByEvent = {};
|
|
1244
|
-
this._hideListenersOnTargetByEvent = {};
|
|
1245
|
-
this._showListenersOnTargetByEvent = {};
|
|
1246
|
-
this._aria = new AttachmentAriaController();
|
|
1247
|
-
this._ariaOpen = false;
|
|
1248
|
-
this._mouseLeaveOrigin = null;
|
|
1249
|
-
this._restoreFocusOnHide = false;
|
|
1250
|
-
this._suppressFocusShow = false;
|
|
1251
|
-
this._hide = this._hide.bind(this);
|
|
1252
|
-
this._hideAfterDelay = this._hideAfterDelay.bind(this);
|
|
1253
|
-
this._hideIfMouseOutsideTargetOrAttachment = this._hideIfMouseOutsideTargetOrAttachment.bind(this);
|
|
1254
|
-
this._hideOnClickOut = this._hideOnClickOut.bind(this);
|
|
1255
|
-
this._hideOnEscapeKey = this._hideOnEscapeKey.bind(this);
|
|
1256
|
-
this._hideOnLostFocus = this._hideOnLostFocus.bind(this);
|
|
1257
|
-
this._hideOnMouseLeaveTarget = this._hideOnMouseLeaveTarget.bind(this);
|
|
1258
|
-
this._show = this._show.bind(this);
|
|
1259
|
-
this._showAfterDelay = this._showAfterDelay.bind(this);
|
|
1260
|
-
this._lastUseCaptureArgumentValue = this.useCapture;
|
|
1261
|
-
}
|
|
1262
|
-
_syncAria() {
|
|
1263
|
-
this._aria.bind(this._listenerTarget, {
|
|
1264
|
-
isTooltip: this._isTooltip,
|
|
1265
|
-
id: this.id,
|
|
1266
|
-
ariaRole: this.args.ariaRole,
|
|
1267
|
-
isOpen: this._ariaOpen
|
|
1268
|
-
});
|
|
1269
|
-
}
|
|
1270
|
-
_initializeAttacher() {
|
|
1271
|
-
this._removeEventListeners();
|
|
1272
|
-
const target = resolveAttachmentTarget({
|
|
1273
|
-
explicitTarget: this.args.explicitTarget,
|
|
1274
|
-
registeredTarget: this._registeredTarget,
|
|
1275
|
-
parentElement: this.parentElement
|
|
1276
|
-
});
|
|
1277
|
-
this._listenerTarget = getListenerTarget(target);
|
|
1278
|
-
this._currentTarget = target;
|
|
1279
|
-
this._syncModalContainer();
|
|
1280
|
-
syncParentAttachment(this);
|
|
1281
|
-
this._addListenersForShowEvents();
|
|
1282
|
-
if (!this._isHidden || this.isShown) {
|
|
1283
|
-
this._ariaOpen = true;
|
|
1284
|
-
this._syncAria();
|
|
1285
|
-
this._addListenersForHideEvents();
|
|
1286
|
-
this._show();
|
|
1287
|
-
} else {
|
|
1288
|
-
this._ariaOpen = false;
|
|
1289
|
-
this._syncAria();
|
|
1290
|
-
}
|
|
1291
|
-
this.args.onInitializeAttacher?.(this._currentTarget, this.id);
|
|
1292
|
-
}
|
|
1293
|
-
_addListenersForShowEvents() {
|
|
1294
|
-
const target = this._listenerTarget;
|
|
1295
|
-
if (!target) {
|
|
1296
|
-
return;
|
|
1297
|
-
}
|
|
1298
|
-
this._showOn.forEach(event => {
|
|
1299
|
-
this._showListenersOnTargetByEvent[event] = this._showAfterDelay;
|
|
1300
|
-
target.addEventListener(event, this._showAfterDelay, this.useCapture);
|
|
1301
|
-
});
|
|
1302
|
-
}
|
|
1303
|
-
willDestroy() {
|
|
1304
|
-
super.willDestroy(...arguments);
|
|
1305
|
-
unregisterAttacher(this);
|
|
1306
|
-
this._cleanup?.();
|
|
1307
|
-
this._cleanup = null;
|
|
1308
|
-
cancel(this._setReferenceTimer);
|
|
1309
|
-
this._cancelAnimation();
|
|
1310
|
-
cancel(this._delayedVisibilityToggle);
|
|
1311
|
-
this._aria.unbind();
|
|
1312
|
-
this._removeEventListeners();
|
|
1313
|
-
this.args.onWillDestroy?.(this._currentTarget, this.id);
|
|
1314
|
-
}
|
|
1315
|
-
_removeEventListeners() {
|
|
1316
|
-
this._mouseLeaveOrigin = null;
|
|
1317
|
-
Object.keys(this._hideListenersOnDocumentByEvent).forEach(eventType => {
|
|
1318
|
-
document.removeEventListener(eventType, this._hideListenersOnDocumentByEvent[eventType], this.useCapture);
|
|
1319
|
-
delete this._hideListenersOnDocumentByEvent[eventType];
|
|
1320
|
-
});
|
|
1321
|
-
const target = this._listenerTarget;
|
|
1322
|
-
if (!target) {
|
|
1323
|
-
return;
|
|
1324
|
-
}
|
|
1325
|
-
[this._hideListenersOnTargetByEvent, this._showListenersOnTargetByEvent].forEach(eventToListener => {
|
|
1326
|
-
Object.keys(eventToListener).forEach(event => {
|
|
1327
|
-
target.removeEventListener(event, eventToListener[event], this.useCapture);
|
|
1328
|
-
});
|
|
1329
|
-
});
|
|
1330
|
-
}
|
|
1331
|
-
_syncIsShown() {
|
|
1332
|
-
const isShown = this.isShown;
|
|
1333
|
-
if (isShown === true && this._isHidden) {
|
|
1334
|
-
this._show();
|
|
1335
|
-
next(this, () => this._addListenersForHideEvents());
|
|
1336
|
-
} else if (isShown === false && !this._isHidden) {
|
|
1337
|
-
this._hide();
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
_showAfterDelay(event) {
|
|
1341
|
-
if (this._suppressFocusShow && (event?.type === 'focus' || event?.type === 'focusin')) {
|
|
1342
|
-
return;
|
|
1343
|
-
}
|
|
1344
|
-
cancel(this._delayedVisibilityToggle);
|
|
1345
|
-
this._isHiding = false;
|
|
1346
|
-
this._mustRender = true;
|
|
1347
|
-
syncParentAttachment(this);
|
|
1348
|
-
this._addListenersForHideEvents();
|
|
1349
|
-
const showDelay = parseInt(this.showDelay);
|
|
1350
|
-
this._delayedVisibilityToggle = debounce(this, this._show, showDelay, !showDelay);
|
|
1351
|
-
}
|
|
1352
|
-
_show() {
|
|
1353
|
-
this._cancelAnimation();
|
|
1354
|
-
if (!this._currentTarget) {
|
|
1355
|
-
return;
|
|
1356
|
-
}
|
|
1357
|
-
this._restoreFocusOnHide = false;
|
|
1358
|
-
this._isHiding = false;
|
|
1359
|
-
this._positioningSuspended = false;
|
|
1360
|
-
this._mustRender = true;
|
|
1361
|
-
this._ariaOpen = true;
|
|
1362
|
-
this._aria.setOpen(true);
|
|
1363
|
-
const modalContainerChanged = this._syncModalContainer();
|
|
1364
|
-
syncParentAttachment(this);
|
|
1365
|
-
if (modalContainerChanged) {
|
|
1366
|
-
next(this, () => {
|
|
1367
|
-
if (!this.isDestroyed && !this.isDestroying && !this._isHiding && this._currentTarget) {
|
|
1368
|
-
this._setIsVisibleAfterDelay(true, 0);
|
|
1369
|
-
this._startShowAnimation();
|
|
1370
|
-
}
|
|
1371
|
-
});
|
|
1372
|
-
return;
|
|
1373
|
-
}
|
|
1374
|
-
this._setIsVisibleAfterDelay(true, 0);
|
|
1375
|
-
this._startShowAnimation();
|
|
1376
|
-
}
|
|
1377
|
-
_startShowAnimation() {
|
|
1378
|
-
this._animationTimeout = requestAnimationFrame(() => {
|
|
1379
|
-
animationTestWaiter.endAsync(this._animationTimeout);
|
|
1380
|
-
if (this.isDestroyed || this.isDestroying || !this._currentTarget) {
|
|
1381
|
-
return;
|
|
1382
|
-
}
|
|
1383
|
-
const floatingElement = this._floatingElement;
|
|
1384
|
-
if (!floatingElement || floatingElement.style.display === 'none') {
|
|
1385
|
-
this._startShowAnimation();
|
|
1386
|
-
return;
|
|
1387
|
-
}
|
|
1388
|
-
this._update();
|
|
1389
|
-
this._animationTimeout = requestAnimationFrame(() => {
|
|
1390
|
-
animationTestWaiter.endAsync(this._animationTimeout);
|
|
1391
|
-
if (this.isDestroyed || this.isDestroying || !this._currentTarget) {
|
|
1392
|
-
return;
|
|
1393
|
-
}
|
|
1394
|
-
run(() => {
|
|
1395
|
-
if (this.isDestroyed || this.isDestroying || !this._currentTarget) {
|
|
1396
|
-
return;
|
|
1397
|
-
}
|
|
1398
|
-
if (!floatingElement.hasAttribute('data-reference-hidden') && !floatingElement.hasAttribute('data-escaped')) {
|
|
1399
|
-
floatingElement.style.visibility = '';
|
|
1400
|
-
}
|
|
1401
|
-
const showDuration = parseInt(this.showDuration);
|
|
1402
|
-
floatingElement.style.setProperty('--ember-attacher-transition-duration', `${showDuration}ms`);
|
|
1403
|
-
this._isStartingAnimation = true;
|
|
1404
|
-
floatingElement.setAttribute('aria-hidden', 'false');
|
|
1405
|
-
});
|
|
1406
|
-
this._isHidden = false;
|
|
1407
|
-
});
|
|
1408
|
-
animationTestWaiter.beginAsync(this._animationTimeout);
|
|
1409
|
-
});
|
|
1410
|
-
animationTestWaiter.beginAsync(this._animationTimeout);
|
|
1411
|
-
}
|
|
1412
|
-
_hideAfterDelay() {
|
|
1413
|
-
cancel(this._delayedVisibilityToggle);
|
|
1414
|
-
this._isHiding = true;
|
|
1415
|
-
const hideDelay = parseInt(this.hideDelay);
|
|
1416
|
-
this._delayedVisibilityToggle = debounce(this, this._hide, hideDelay, !hideDelay);
|
|
1417
|
-
}
|
|
1418
|
-
_hide() {
|
|
1419
|
-
this._isHiding = true;
|
|
1420
|
-
this._positioningSuspended = true;
|
|
1421
|
-
this._ariaOpen = false;
|
|
1422
|
-
this._mouseLeaveOrigin = null;
|
|
1423
|
-
this._cleanup?.();
|
|
1424
|
-
this._cleanup = null;
|
|
1425
|
-
if (!this._floatingElement) {
|
|
1426
|
-
this._animationTimeout = requestAnimationFrame(() => {
|
|
1427
|
-
animationTestWaiter.endAsync(this._animationTimeout);
|
|
1428
|
-
this._hide();
|
|
1429
|
-
});
|
|
1430
|
-
animationTestWaiter.beginAsync(this._animationTimeout);
|
|
1431
|
-
return;
|
|
1432
|
-
}
|
|
1433
|
-
this._cancelAnimation();
|
|
1434
|
-
this._removeListenersForHideEvents();
|
|
1435
|
-
this._animationTimeout = requestAnimationFrame(() => {
|
|
1436
|
-
animationTestWaiter.endAsync(this._animationTimeout);
|
|
1437
|
-
if (this.isDestroyed || this.isDestroying) {
|
|
1438
|
-
return;
|
|
1439
|
-
}
|
|
1440
|
-
const hideDuration = parseInt(this.hideDuration);
|
|
1441
|
-
run(() => {
|
|
1442
|
-
if (this.isDestroyed || this.isDestroying) {
|
|
1443
|
-
return;
|
|
1444
|
-
}
|
|
1445
|
-
if (this._restoreFocusOnHide) {
|
|
1446
|
-
this._restoreFocusOnHide = false;
|
|
1447
|
-
this._suppressFocusShow = true;
|
|
1448
|
-
try {
|
|
1449
|
-
restoreFocusOnEscape(this._listenerTarget, this._floatingElement);
|
|
1450
|
-
} finally {
|
|
1451
|
-
this._suppressFocusShow = false;
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
this._floatingElement.style.setProperty('--ember-attacher-transition-duration', `${hideDuration}ms`);
|
|
1455
|
-
this._isStartingAnimation = false;
|
|
1456
|
-
this._floatingElement.setAttribute('aria-hidden', 'true');
|
|
1457
|
-
this._aria.setOpen(false);
|
|
1458
|
-
this._setIsVisibleAfterDelay(false, hideDuration);
|
|
1459
|
-
});
|
|
1460
|
-
this._isHidden = true;
|
|
1461
|
-
});
|
|
1462
|
-
animationTestWaiter.beginAsync(this._animationTimeout);
|
|
1463
|
-
}
|
|
1464
|
-
_addListenersForHideEvents() {
|
|
1465
|
-
const hideOn = this._hideOn;
|
|
1466
|
-
const target = this._listenerTarget;
|
|
1467
|
-
if (!this._currentTarget || this.isDestroyed || this.isDestroying) {
|
|
1468
|
-
return;
|
|
1469
|
-
}
|
|
1470
|
-
if (target && hideOn.includes('click')) {
|
|
1471
|
-
const showOnClickListener = this._showListenersOnTargetByEvent.click;
|
|
1472
|
-
if (showOnClickListener) {
|
|
1473
|
-
target.removeEventListener('click', showOnClickListener, this.useCapture);
|
|
1474
|
-
delete this._showListenersOnTargetByEvent.click;
|
|
1475
|
-
}
|
|
1476
|
-
this._hideListenersOnTargetByEvent.click = this._hideAfterDelay;
|
|
1477
|
-
target.addEventListener('click', this._hideAfterDelay, this.useCapture);
|
|
1478
|
-
}
|
|
1479
|
-
if (hideOn.includes('clickout')) {
|
|
1480
|
-
const clickoutEvent = 'ontouchstart' in window ? 'touchend' : 'click';
|
|
1481
|
-
this._hideListenersOnDocumentByEvent[clickoutEvent] = this._hideOnClickOut;
|
|
1482
|
-
document.addEventListener(clickoutEvent, this._hideOnClickOut, this.useCapture);
|
|
1483
|
-
}
|
|
1484
|
-
if (hideOn.includes('escapekey')) {
|
|
1485
|
-
this._hideListenersOnDocumentByEvent.keydown = this._hideOnEscapeKey;
|
|
1486
|
-
document.addEventListener('keydown', this._hideOnEscapeKey, this.useCapture);
|
|
1487
|
-
}
|
|
1488
|
-
if (target && hideOn.includes('mouseleave')) {
|
|
1489
|
-
this._hideListenersOnTargetByEvent.mouseleave = this._hideOnMouseLeaveTarget;
|
|
1490
|
-
target.addEventListener('mouseleave', this._hideOnMouseLeaveTarget, this.useCapture);
|
|
1491
|
-
}
|
|
1492
|
-
if (target) {
|
|
1493
|
-
['blur', 'focusout'].forEach(eventType => {
|
|
1494
|
-
if (hideOn.includes(eventType)) {
|
|
1495
|
-
this._hideListenersOnTargetByEvent[eventType] = this._hideOnLostFocus;
|
|
1496
|
-
target.addEventListener(eventType, this._hideOnLostFocus, this.useCapture);
|
|
1497
|
-
}
|
|
1498
|
-
});
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
_hideOnMouseLeaveTarget(event) {
|
|
1502
|
-
if (this.interactive) {
|
|
1503
|
-
this._mouseLeaveOrigin = event ? {
|
|
1504
|
-
x: event.clientX,
|
|
1505
|
-
y: event.clientY
|
|
1506
|
-
} : null;
|
|
1507
|
-
if (!this._hideListenersOnDocumentByEvent.mousemove) {
|
|
1508
|
-
this._hideListenersOnDocumentByEvent.mousemove = this._hideIfMouseOutsideTargetOrAttachment;
|
|
1509
|
-
document.addEventListener('mousemove', this._hideIfMouseOutsideTargetOrAttachment, this.useCapture);
|
|
1510
|
-
}
|
|
1511
|
-
} else {
|
|
1512
|
-
this._hideAfterDelay();
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
_hideIfMouseOutsideTargetOrAttachment(event) {
|
|
1516
|
-
const target = this._listenerTarget;
|
|
1517
|
-
if (!target) {
|
|
1518
|
-
return;
|
|
1519
|
-
}
|
|
1520
|
-
if (!target.contains(event.target) && !descendantAttachmentContainsEvent(this, event) && !isCursorInSafePolygon(event, this._mouseLeaveOrigin, this._currentTarget, this._floatingElement) && this._floatingElement && !this._floatingElement.contains(event.target)) {
|
|
1521
|
-
this._mouseLeaveOrigin = null;
|
|
1522
|
-
delete this._hideListenersOnDocumentByEvent.mousemove;
|
|
1523
|
-
document.removeEventListener('mousemove', this._hideIfMouseOutsideTargetOrAttachment, this.useCapture);
|
|
1524
|
-
this._hideAfterDelay();
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
_hideOnClickOut(event) {
|
|
1528
|
-
const target = this._listenerTarget;
|
|
1529
|
-
if (elementContainsEvent(target, event) || descendantAttachmentContainsEvent(this, event)) {
|
|
1530
|
-
return;
|
|
1531
|
-
}
|
|
1532
|
-
if (!this.interactive || !elementContainsEvent(this._floatingElement, event)) {
|
|
1533
|
-
this._hideAfterDelay();
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
_hideOnEscapeKey(event) {
|
|
1537
|
-
if ((event.key === 'Escape' || event.keyCode === 27) && shouldHandleEscapeKey(this, event)) {
|
|
1538
|
-
this._restoreFocusOnHide = !this._isTooltip;
|
|
1539
|
-
return this._hideAfterDelay();
|
|
1540
|
-
}
|
|
1541
|
-
}
|
|
1542
|
-
_hideOnLostFocus(event) {
|
|
1543
|
-
if (event.relatedTarget === null) {
|
|
1544
|
-
this._hideAfterDelay();
|
|
1545
|
-
return;
|
|
1546
|
-
}
|
|
1547
|
-
const target = this._listenerTarget;
|
|
1548
|
-
if (!target) {
|
|
1549
|
-
return;
|
|
1550
|
-
}
|
|
1551
|
-
if (target.contains(event.relatedTarget) || descendantAttachmentContainsNode(this, event.relatedTarget)) {
|
|
1552
|
-
return;
|
|
1553
|
-
}
|
|
1554
|
-
if (!this.interactive || !this._floatingElement?.contains(event.relatedTarget)) {
|
|
1555
|
-
this._hideAfterDelay();
|
|
1556
|
-
}
|
|
1557
|
-
}
|
|
1558
|
-
_removeListenersForHideEvents() {
|
|
1559
|
-
Object.keys(this._hideListenersOnDocumentByEvent).forEach(eventType => {
|
|
1560
|
-
document.removeEventListener(eventType, this._hideListenersOnDocumentByEvent[eventType], this.useCapture);
|
|
1561
|
-
delete this._hideListenersOnDocumentByEvent[eventType];
|
|
1562
|
-
});
|
|
1563
|
-
const target = this._listenerTarget;
|
|
1564
|
-
if (!target) {
|
|
1565
|
-
return;
|
|
1566
|
-
}
|
|
1567
|
-
if (this._showOn.includes('click')) {
|
|
1568
|
-
const hideOnClickListener = this._hideListenersOnTargetByEvent.click;
|
|
1569
|
-
if (hideOnClickListener) {
|
|
1570
|
-
target.removeEventListener('click', hideOnClickListener, this.useCapture);
|
|
1571
|
-
delete this._hideListenersOnTargetByEvent.click;
|
|
1572
|
-
}
|
|
1573
|
-
this._showListenersOnTargetByEvent.click = this._showAfterDelay;
|
|
1574
|
-
target.addEventListener('click', this._showAfterDelay, this.useCapture);
|
|
1575
|
-
}
|
|
1576
|
-
['blur', 'focusout', 'mouseleave'].forEach(eventType => {
|
|
1577
|
-
const listener = this._hideListenersOnTargetByEvent[eventType];
|
|
1578
|
-
if (listener) {
|
|
1579
|
-
target.removeEventListener(eventType, listener, this.useCapture);
|
|
1580
|
-
delete this._hideListenersOnTargetByEvent[eventType];
|
|
1581
|
-
}
|
|
1582
|
-
});
|
|
1583
|
-
}
|
|
1584
|
-
_update() {
|
|
1585
|
-
this._cleanup?.();
|
|
1586
|
-
this._cleanup = null;
|
|
1587
|
-
if (this.isDestroyed || this.isDestroying || this._positioningSuspended || !this._currentTarget || !this._floatingElement || !isTargetConnected(this._currentTarget) || !this._floatingElement.isConnected) {
|
|
1588
|
-
return;
|
|
1589
|
-
}
|
|
1590
|
-
if (this.autoUpdate) {
|
|
1591
|
-
this._cleanup = autoUpdate(this._currentTarget, this._floatingElement, this._updatePosition, typeof this.autoUpdate === 'object' && this.autoUpdate !== null ? this.autoUpdate : undefined);
|
|
1592
|
-
} else {
|
|
1593
|
-
this._updatePosition();
|
|
1594
|
-
}
|
|
1595
|
-
}
|
|
1596
|
-
_updatePosition() {
|
|
1597
|
-
if (this.isDestroyed || this.isDestroying || !this._currentTarget || !this._floatingElement) {
|
|
1598
|
-
return;
|
|
1599
|
-
}
|
|
1600
|
-
if (!isTargetConnected(this._currentTarget) || !this._floatingElement.isConnected) {
|
|
1601
|
-
this._cleanup?.();
|
|
1602
|
-
this._cleanup = null;
|
|
1603
|
-
return;
|
|
1604
|
-
}
|
|
1605
|
-
const strategy = this.strategy;
|
|
1606
|
-
const computePositionToken = animationTestWaiter.beginAsync();
|
|
1607
|
-
computePosition(this._currentTarget, this._floatingElement, {
|
|
1608
|
-
...this.floatingUiOptions,
|
|
1609
|
-
middleware: this._middleware,
|
|
1610
|
-
placement: this.placement,
|
|
1611
|
-
strategy
|
|
1612
|
-
}).then(({
|
|
1613
|
-
x,
|
|
1614
|
-
y,
|
|
1615
|
-
placement,
|
|
1616
|
-
strategy: computedStrategy,
|
|
1617
|
-
middlewareData
|
|
1618
|
-
}) => {
|
|
1619
|
-
animationTestWaiter.endAsync(computePositionToken);
|
|
1620
|
-
if (this.isDestroyed || this.isDestroying || !this._floatingElement || !this._floatingElement.isConnected) {
|
|
1621
|
-
return;
|
|
1622
|
-
}
|
|
1623
|
-
applyPositionResult(this._floatingElement, this._arrowElement, {
|
|
1624
|
-
x,
|
|
1625
|
-
y,
|
|
1626
|
-
placement,
|
|
1627
|
-
strategy: computedStrategy || strategy,
|
|
1628
|
-
middlewareData,
|
|
1629
|
-
isHidden: this._isHidden
|
|
1630
|
-
});
|
|
1631
|
-
}).catch(error => {
|
|
1632
|
-
animationTestWaiter.endAsync(computePositionToken);
|
|
1633
|
-
if (!this.isDestroyed && !this.isDestroying) {
|
|
1634
|
-
warn(`[ember-attacher] Positioning error: ${error?.message ?? error}`, {
|
|
1635
|
-
id: 'ember-attacher.positioning-error'
|
|
1636
|
-
});
|
|
1637
|
-
}
|
|
1638
|
-
});
|
|
1639
|
-
}
|
|
1640
|
-
_cancelAnimation() {
|
|
1641
|
-
if (typeof cancelAnimationFrame !== 'function') {
|
|
1642
|
-
return;
|
|
1643
|
-
}
|
|
1644
|
-
cancelAnimationFrame(this._animationTimeout);
|
|
1645
|
-
runInDebug(() => {
|
|
1646
|
-
if (animationTestWaiter.items?.get(this._animationTimeout)) {
|
|
1647
|
-
animationTestWaiter.endAsync(this._animationTimeout);
|
|
1648
|
-
}
|
|
1649
|
-
});
|
|
1650
|
-
}
|
|
1651
|
-
}, _descriptor = _applyDecoratedDescriptor(_class.prototype, "parentNotFound", [tracked], {
|
|
1652
|
-
configurable: true,
|
|
1653
|
-
enumerable: true,
|
|
1654
|
-
writable: true,
|
|
1655
|
-
initializer: function () {
|
|
1656
|
-
return true;
|
|
1657
|
-
}
|
|
1658
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "parentElement", [tracked], {
|
|
1659
|
-
configurable: true,
|
|
1660
|
-
enumerable: true,
|
|
1661
|
-
writable: true,
|
|
1662
|
-
initializer: function () {
|
|
1663
|
-
return null;
|
|
1664
|
-
}
|
|
1665
|
-
}), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "_isStartingAnimation", [tracked], {
|
|
1666
|
-
configurable: true,
|
|
1667
|
-
enumerable: true,
|
|
1668
|
-
writable: true,
|
|
1669
|
-
initializer: function () {
|
|
1670
|
-
return false;
|
|
1671
|
-
}
|
|
1672
|
-
}), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, "_arrowElement", [tracked], {
|
|
1673
|
-
configurable: true,
|
|
1674
|
-
enumerable: true,
|
|
1675
|
-
writable: true,
|
|
1676
|
-
initializer: function () {
|
|
25
|
+
get _defaultConfigKey() {
|
|
1677
26
|
return null;
|
|
1678
27
|
}
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
enumerable: true,
|
|
1682
|
-
writable: true,
|
|
1683
|
-
initializer: function () {
|
|
1684
|
-
return null;
|
|
28
|
+
get _defaultAriaRole() {
|
|
29
|
+
return undefined;
|
|
1685
30
|
}
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
enumerable: true,
|
|
1689
|
-
writable: true,
|
|
1690
|
-
initializer: function () {
|
|
1691
|
-
return null;
|
|
31
|
+
get ariaRole() {
|
|
32
|
+
return this.core.ariaRole;
|
|
1692
33
|
}
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
enumerable: true,
|
|
1696
|
-
writable: true,
|
|
1697
|
-
initializer: function () {
|
|
1698
|
-
return false;
|
|
34
|
+
get additionalClass() {
|
|
35
|
+
return this.args.additionalClass || '';
|
|
1699
36
|
}
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
enumerable: true,
|
|
1703
|
-
writable: true,
|
|
1704
|
-
initializer: function () {
|
|
1705
|
-
return null;
|
|
37
|
+
get id() {
|
|
38
|
+
return this.core.id;
|
|
1706
39
|
}
|
|
1707
|
-
}
|
|
40
|
+
}
|
|
1708
41
|
setComponentTemplate(TEMPLATE, BasicAttacher);
|
|
1709
42
|
|
|
1710
43
|
export { BasicAttacher as default };
|