ember-attacher 4.0.0-beta.2 → 4.0.0-beta.3

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.
@@ -0,0 +1,42 @@
1
+
2
+ function _applyDecoratedDescriptor(i, e, r, n, l) {
3
+ var a = {};
4
+ return Object.keys(n).forEach(function (i) {
5
+ a[i] = n[i];
6
+ }), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, ("value" in a || a.initializer) && (a.writable = true), a = r.slice().reverse().reduce(function (r, n) {
7
+ return n(i, e, r) || r;
8
+ }, 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;
9
+ }
10
+ function _defineProperty(e, r, t) {
11
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
12
+ value: t,
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true
16
+ }) : e[r] = t, e;
17
+ }
18
+ function _initializerDefineProperty(e, i, r, l) {
19
+ r && Object.defineProperty(e, i, {
20
+ enumerable: r.enumerable,
21
+ configurable: r.configurable,
22
+ writable: r.writable,
23
+ value: r.initializer ? r.initializer.call(l) : void 0
24
+ });
25
+ }
26
+ function _toPrimitive(t, r) {
27
+ if ("object" != typeof t || !t) return t;
28
+ var e = t[Symbol.toPrimitive];
29
+ if (void 0 !== e) {
30
+ var i = e.call(t, r);
31
+ if ("object" != typeof i) return i;
32
+ throw new TypeError("@@toPrimitive must return a primitive value.");
33
+ }
34
+ return ("string" === r ? String : Number)(t);
35
+ }
36
+ function _toPropertyKey(t) {
37
+ var i = _toPrimitive(t, "string");
38
+ return "symbol" == typeof i ? i : i + "";
39
+ }
40
+
41
+ export { _applyDecoratedDescriptor as _, _initializerDefineProperty as a, _defineProperty as b };
42
+ //# sourceMappingURL=_rollupPluginBabelHelpers-f1ZVPpM9.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_rollupPluginBabelHelpers-f1ZVPpM9.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,11 +1,16 @@
1
1
 
2
2
  import Component from '@glimmer/component';
3
+ import { precompileTemplate } from '@ember/template-compilation';
4
+ import { setComponentTemplate } from '@ember/component';
5
+
6
+ var TEMPLATE = precompileTemplate("<BasicAttacher\n @id={{@id}}\n @configKey=\"popover\"\n @ariaRole={{this.ariaRole}}\n @additionalClass={{@additionalClass}}\n @animation={{@animation}}\n @arrow={{@arrow}}\n @autoUpdate={{@autoUpdate}}\n @class={{@class}}\n @explicitTarget={{@explicitTarget}}\n @flip={{@flip}}\n @floatingElementContainer={{@floatingElementContainer}}\n @floatingUiOptions={{@floatingUiOptions}}\n @hideDelay={{@hideDelay}}\n @hideDuration={{@hideDuration}}\n @hideOn={{@hideOn}}\n @interactive={{@interactive}}\n @isOffset={{@isOffset}}\n @isShown={{@isShown}}\n @lazyRender={{@lazyRender}}\n @middleware={{@middleware}}\n @onChange={{@onChange}}\n @onInitializeAttacher={{@onInitializeAttacher}}\n @onWillDestroy={{@onWillDestroy}}\n @overflowPadding={{@overflowPadding}}\n @placement={{@placement}}\n @renderInPlace={{@renderInPlace}}\n @showDelay={{@showDelay}}\n @showDuration={{@showDuration}}\n @showOn={{@showOn}}\n @style={{@style}}\n @useCapture={{@useCapture}}\n ...attributes\n as |popover|\n>\n {{yield popover}}\n</BasicAttacher>\n");
3
7
 
4
8
  class AttachPopover extends Component {
5
9
  get ariaRole() {
6
10
  return this.args.ariaRole || 'dialog';
7
11
  }
8
12
  }
13
+ setComponentTemplate(TEMPLATE, AttachPopover);
9
14
 
10
15
  export { AttachPopover as default };
11
16
  //# sourceMappingURL=attach-popover.js.map
@@ -1,37 +1,40 @@
1
1
 
2
+ import { _ as _applyDecoratedDescriptor } from '../_rollupPluginBabelHelpers-f1ZVPpM9.js';
2
3
  import Component from '@glimmer/component';
3
4
  import { action } from '@ember/object';
4
5
  import DEFAULTS from '../defaults.js';
5
6
  import { getOwner } from '@ember/application';
7
+ import { precompileTemplate } from '@ember/template-compilation';
8
+ import { setComponentTemplate } from '@ember/component';
6
9
 
7
- class AttachTooltip extends Component {
10
+ var TEMPLATE = precompileTemplate("<BasicAttacher\n @id={{@id}}\n @configKey=\"tooltip\"\n @ariaRole={{this.ariaRole}}\n @additionalClass={{this.additionalClass}}\n @animation={{@animation}}\n @arrow={{@arrow}}\n @autoUpdate={{@autoUpdate}}\n @class={{@class}}\n @explicitTarget={{@explicitTarget}}\n @flip={{@flip}}\n @floatingElementContainer={{@floatingElementContainer}}\n @floatingUiOptions={{@floatingUiOptions}}\n @hideDelay={{@hideDelay}}\n @hideDuration={{@hideDuration}}\n @hideOn={{@hideOn}}\n @interactive={{@interactive}}\n @isOffset={{@isOffset}}\n @isShown={{@isShown}}\n @lazyRender={{@lazyRender}}\n @middleware={{@middleware}}\n @onChange={{@onChange}}\n @onInitializeAttacher={{this.onInitializeAttacher}}\n @onWillDestroy={{this.onWillDestroy}}\n @overflowPadding={{@overflowPadding}}\n @placement={{@placement}}\n @renderInPlace={{@renderInPlace}}\n @showDelay={{@showDelay}}\n @showDuration={{@showDuration}}\n @showOn={{@showOn}}\n @style={{@style}}\n @useCapture={{@useCapture}}\n ...attributes\n as |tooltip|\n>\n {{yield tooltip}}\n</BasicAttacher>");
11
+
12
+ var _class;
13
+ let AttachTooltip = (_class = class AttachTooltip extends Component {
8
14
  get ariaRole() {
9
15
  return this.args.ariaRole || 'tooltip';
10
16
  }
11
-
12
17
  get additionalClass() {
13
- const { tooltip, tooltipClass } = getOwner(this).resolveRegistration('config:environment').emberAttacher || {};
14
-
18
+ const {
19
+ tooltip,
20
+ tooltipClass
21
+ } = getOwner(this).resolveRegistration('config:environment').emberAttacher || {};
15
22
  return tooltip?.tooltipClass ?? tooltipClass ?? DEFAULTS.tooltipClass;
16
23
  }
17
-
18
- @action
19
24
  onInitializeAttacher(currentTarget, id) {
20
25
  if (currentTarget?.getAttribute('aria-describedby') != id) {
21
26
  const oldTarget = document.querySelector(`[aria-describedby="${id}"]`);
22
-
23
27
  oldTarget?.removeAttribute('aria-describedby');
24
28
  currentTarget?.setAttribute('aria-describedby', id);
25
29
  }
26
30
  }
27
-
28
- @action
29
31
  onWillDestroy(currentTarget) {
30
32
  if (currentTarget) {
31
33
  currentTarget.removeAttribute('aria-describedby');
32
34
  }
33
35
  }
34
- }
36
+ }, _applyDecoratedDescriptor(_class.prototype, "onInitializeAttacher", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onInitializeAttacher"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onWillDestroy", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onWillDestroy"), _class.prototype), _class);
37
+ setComponentTemplate(TEMPLATE, AttachTooltip);
35
38
 
36
39
  export { AttachTooltip as default };
37
40
  //# sourceMappingURL=attach-tooltip.js.map
@@ -1,4 +1,5 @@
1
1
 
2
+ import { _ as _applyDecoratedDescriptor, a as _initializerDefineProperty, b as _defineProperty } from '../_rollupPluginBabelHelpers-f1ZVPpM9.js';
2
3
  import { action } from '@ember/object';
3
4
  import Component from '@glimmer/component';
4
5
  import { later, cancel, next, debounce, run } from '@ember/runloop';
@@ -11,132 +12,99 @@ import { flip, shift, limitShift, arrow, autoUpdate, computePosition } from '@fl
11
12
  import { buildWaiter } from '@ember/test-waiters';
12
13
  import { tracked } from '@glimmer/tracking';
13
14
  import DEFAULTS from '../defaults.js';
15
+ import { precompileTemplate } from '@ember/template-compilation';
16
+ import { setComponentTemplate } from '@ember/component';
14
17
 
15
- const animationTestWaiter = buildWaiter('basic-attacher');
16
-
17
- class BasicAttacher extends Component {
18
- @tracked parentNotFound = true;
19
- @tracked parentElement = null;
20
- @tracked _isStartingAnimation = false;
21
- @tracked _arrowElement = null;
22
- @tracked _currentTarget = null;
23
- // This is set to true when the popover is shown in order to override lazyRender=false
24
- @tracked _mustRender = false;
25
- @tracked _transitionDuration = 0;
26
- _floatingElement = null;
18
+ var TEMPLATE = precompileTemplate("{{~#unless this.renderFloatingElement}}\n <meta hidden {{did-insert this.onParentFinderInsert}} {{did-update this.onIsShownChange this.isShown}}/>\n{{~/unless~}}\n\n{{~#if this.renderFloatingElement~}}\n <MaybeInElement @destinationElement={{this._floatingElementContainer}} @renderInPlace={{@renderInPlace}}>\n <div\n class=\"ember-attacher\"\n id={{this.id}}\n role={{@ariaRole}}\n {{did-insert this.didInsertFloatingElement}}\n {{did-update this.onIsShownChange this.isShown}}\n {{did-update this.onTargetOrTriggerChange this.hideOn this.showOn @explicitTarget}}\n {{did-update this.onOptionsChange this.autoUpdate this.animation this.arrow this.useCapture this.placement this._renderInPlace this._currentTarget this._middleware}}\n {{will-destroy this.willDestroyFloatingElement}}\n ...attributes\n >\n <div class={{this._class}} style={{this._style}}>\n {{yield (hash hide=this.hide)}}\n {{#if this.arrow}}\n <div x-arrow {{did-insert this.didInsertArrow}}></div>\n {{/if}}\n {{#if this.isFillAnimation}}\n <div x-circle style=\"{{this._circleTransitionDuration}}\"></div>\n {{/if}}\n </div>\n </div>\n </MaybeInElement>\n{{~/if~}}\n");
27
19
 
20
+ var _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7;
21
+ const animationTestWaiter = buildWaiter('basic-attacher');
22
+ let BasicAttacher = (_class = class BasicAttacher extends Component {
28
23
  /**
29
24
  * ================== PUBLIC CONFIG OPTIONS ==================
30
25
  */
31
26
  get arrow() {
32
27
  return this.args.arrow ?? this._config.arrow ?? DEFAULTS.arrow;
33
28
  }
34
-
35
29
  get autoUpdate() {
36
30
  return this.args.autoUpdate ?? this._config.autoUpdate ?? DEFAULTS.autoUpdate;
37
31
  }
38
-
39
32
  get animation() {
40
33
  return this.args.animation || this._config.animation || DEFAULTS.animation;
41
34
  }
42
-
43
35
  get flip() {
44
36
  return this.args.flip ?? this._config.flip ?? DEFAULTS.flip;
45
37
  }
46
-
47
38
  get hideDelay() {
48
39
  return this.args.hideDelay ?? this._config.hideDelay ?? DEFAULTS.hideDelay;
49
40
  }
50
-
51
41
  get hideDuration() {
52
42
  return this.args.hideDuration ?? this._config.hideDuration ?? DEFAULTS.hideDuration;
53
43
  }
54
-
55
44
  get hideOn() {
56
45
  return this.args.hideOn || this._config.hideOn || DEFAULTS.hideOn;
57
46
  }
58
-
59
47
  get interactive() {
60
48
  return this.args.interactive ?? this._config.interactive ?? DEFAULTS.interactive;
61
49
  }
62
-
63
50
  get isOffset() {
64
51
  return this.args.isOffset ?? this._config.isOffset ?? DEFAULTS.isOffset;
65
52
  }
66
-
67
53
  get isShown() {
68
54
  return this.args.isShown ?? this._config.isShown ?? DEFAULTS.isShown;
69
55
  }
70
-
71
56
  get lazyRender() {
72
57
  return this.args.lazyRender ?? this._config.lazyRender ?? DEFAULTS.lazyRender;
73
58
  }
74
-
75
59
  get placement() {
76
60
  return this.args.placement ?? this._config.placement ?? DEFAULTS.placement;
77
61
  }
78
-
79
62
  get floatingElementContainer() {
80
63
  return this.args.floatingElementContainer || this._config.floatingElementContainer || DEFAULTS.floatingElementContainer;
81
64
  }
82
-
83
65
  get class() {
84
66
  return this.args.class || this._config.class;
85
67
  }
86
-
87
68
  get floatingUiOptions() {
88
69
  return this.args.floatingUiOptions || this._config.floatingUiOptions || DEFAULTS.floatingUiOptions;
89
70
  }
90
-
91
71
  get renderInPlace() {
92
72
  return this.args.renderInPlace ?? this._config.renderInPlace ?? DEFAULTS.renderInPlace;
93
73
  }
94
-
95
74
  get showDelay() {
96
75
  return this.args.showDelay ?? this._config.showDelay ?? DEFAULTS.showDelay;
97
76
  }
98
-
99
77
  get showDuration() {
100
78
  return this.args.showDuration ?? this._config.showDuration ?? DEFAULTS.showDuration;
101
79
  }
102
-
103
80
  get showOn() {
104
81
  if (this.args.showOn === null) {
105
82
  return null;
106
83
  }
107
-
108
84
  return this.args.showOn ?? this._config.showOn ?? DEFAULTS.showOn;
109
85
  }
110
-
111
86
  get style() {
112
87
  return this.args.style ?? this._config.style ?? DEFAULTS.style;
113
88
  }
114
-
115
89
  get useCapture() {
116
90
  return this.args.useCapture ?? this._config.useCapture ?? DEFAULTS.useCapture;
117
91
  }
118
-
119
92
  get configKey() {
120
93
  return this.args.configKey || 'popover';
121
94
  }
122
-
123
95
  get isFillAnimation() {
124
96
  return this.animation === 'fill';
125
97
  }
126
-
127
98
  get renderFloatingElement() {
128
99
  return (this.renderInPlace || this._currentTarget) && (!this.lazyRender || this._mustRender);
129
100
  }
130
-
131
101
  get shouldRenderFloatingElement() {
132
102
  // Always render the floating element unless lazyRender is true and we haven't been triggered yet
133
103
  return !this.lazyRender || this._mustRender;
134
104
  }
135
-
136
105
  get id() {
137
106
  return this.args.id || `${guidFor(this)}-floating`;
138
107
  }
139
-
140
108
  get overflowPadding() {
141
109
  return this.args.overflowPadding ?? this._config.overflowPadding ?? DEFAULTS.overflowPadding;
142
110
  }
@@ -144,11 +112,8 @@ class BasicAttacher extends Component {
144
112
  // The circle element needs a special duration that is slightly faster than the floating element's
145
113
  // transition, this prevents text from appearing outside the circle as it fills the background
146
114
  get _circleTransitionDuration() {
147
- return htmlSafe(
148
- `transition-duration: ${Math.round(this._transitionDuration / 1.25)}ms`
149
- );
115
+ return htmlSafe(`transition-duration: ${Math.round(this._transitionDuration / 1.25)}ms`);
150
116
  }
151
-
152
117
  get _class() {
153
118
  const showOrHideClass = `ember-attacher-${this._isStartingAnimation ? 'show' : 'hide'}`;
154
119
  const arrowClass = `ember-attacher-${this.arrow ? 'with' : 'without'}-arrow`;
@@ -156,16 +121,12 @@ class BasicAttacher extends Component {
156
121
  const additionalClass = this.args.additionalClass || '';
157
122
  return [`ember-attacher-${this.animation}`, baseClass, additionalClass, showOrHideClass, arrowClass].filter(Boolean).join(' ');
158
123
  }
159
-
160
124
  get _style() {
161
125
  const style = this.style;
162
126
  const transitionDuration = this._transitionDuration;
163
- warn(
164
- '@ember/string/htmlSafe must be used for any `style` passed to ember-attacher',
165
- isEmpty(style) || isHTMLSafe(style),
166
- { id: 'ember-attacher-require-html-safe-style' }
167
- );
168
-
127
+ warn('@ember/string/htmlSafe must be used for any `style` passed to ember-attacher', isEmpty(style) || isHTMLSafe(style), {
128
+ id: 'ember-attacher-require-html-safe-style'
129
+ });
169
130
  return htmlSafe(`transition-duration: ${transitionDuration}ms; ${style}`);
170
131
  }
171
132
 
@@ -173,31 +134,27 @@ class BasicAttacher extends Component {
173
134
  get _envConfig() {
174
135
  return getOwner(this).resolveRegistration('config:environment').emberAttacher || {};
175
136
  }
176
-
177
137
  get _config() {
178
138
  return {
179
139
  ...this._envConfig,
180
- ...this._envConfig[this.configKey],
140
+ ...this._envConfig[this.configKey]
181
141
  };
182
142
  }
183
-
184
143
  get _hideOn() {
185
144
  let hideOn = this.hideOn;
186
-
187
145
  if (hideOn === undefined) {
188
146
  hideOn = DEFAULTS.hideOn;
189
147
  }
190
-
191
148
  return hideOn === null ? [] : hideOn.split(' ');
192
149
  }
193
-
194
150
  get _middleware() {
195
151
  // Copy the middleware since we might write to the provided array
196
152
  const middleware = this.args.middleware ? [...this.args.middleware] : [];
197
-
198
153
  const flipString = this.flip;
199
154
  if (flipString) {
200
- const flipOptions = { fallbackPlacements: flipString.split(' ') };
155
+ const flipOptions = {
156
+ fallbackPlacements: flipString.split(' ')
157
+ };
201
158
  const flipMiddleware = middleware.find(name => name === 'flip');
202
159
  if (!flipMiddleware) {
203
160
  middleware.push(flip(flipOptions));
@@ -207,23 +164,23 @@ class BasicAttacher extends Component {
207
164
  } else if (this.overflowPadding !== false) {
208
165
  middleware.push(flip());
209
166
  }
210
-
211
167
  if (this.overflowPadding !== false && !middleware.find(name => name === 'shift')) {
212
- middleware.push(shift({ limiter: limitShift(), padding: this.overflowPadding }));
168
+ middleware.push(shift({
169
+ limiter: limitShift(),
170
+ padding: this.overflowPadding
171
+ }));
213
172
  }
214
-
215
173
  if (this.arrow && this._arrowElement && !middleware.find(name => name === 'arrow')) {
216
- middleware.push(arrow({ element: this._arrowElement }));
174
+ middleware.push(arrow({
175
+ element: this._arrowElement
176
+ }));
217
177
  }
218
-
219
178
  return middleware;
220
179
  }
221
-
222
180
  get _floatingElementContainer() {
223
181
  const maybeContainer = this.floatingElementContainer;
224
182
  const renderInPlace = this._renderInPlace;
225
183
  let floatingElementContainer;
226
-
227
184
  if (renderInPlace) {
228
185
  floatingElementContainer = this.parentElement;
229
186
  } else if (maybeContainer instanceof Element) {
@@ -231,22 +188,16 @@ class BasicAttacher extends Component {
231
188
  } else if (typeof maybeContainer === 'string') {
232
189
  const selector = maybeContainer;
233
190
  const possibleContainers = document.querySelectorAll(selector);
234
-
235
- assert(`floatingElementContainer selector "${selector}" found `
236
- + `${possibleContainers.length} possible containers when there should be exactly 1`, possibleContainers.length === 1);
237
-
191
+ assert(`floatingElementContainer selector "${selector}" found ` + `${possibleContainers.length} possible containers when there should be exactly 1`, possibleContainers.length === 1);
238
192
  floatingElementContainer = possibleContainers[0];
239
193
  }
240
-
241
194
  return floatingElementContainer;
242
195
  }
243
-
244
196
  get _renderInPlace() {
245
197
  // document is undefined in Fastboot, so we have to render in
246
198
  // place for the floating element to show up at all.
247
199
  return typeof document !== 'undefined' ? !!this.renderInPlace : true;
248
200
  }
249
-
250
201
  _setIsVisibleAfterDelay(isVisible, delay) {
251
202
  if (!this._floatingElement) {
252
203
  this._animationTimeout = requestAnimationFrame(() => {
@@ -255,7 +206,6 @@ class BasicAttacher extends Component {
255
206
  return;
256
207
  }
257
208
  const onChange = this.args.onChange;
258
-
259
209
  if (delay) {
260
210
  this._delayedVisibilityToggle = later(this, () => {
261
211
  this._animationTimeout = requestAnimationFrame(() => {
@@ -266,7 +216,6 @@ class BasicAttacher extends Component {
266
216
  // Prevent jank by making the attachment invisible until positioned.
267
217
  // The visibility style will be toggled by this._startShowAnimation()
268
218
  this._floatingElement.style.visibility = isVisible ? 'hidden' : '';
269
-
270
219
  if (onChange) {
271
220
  onChange(isVisible);
272
221
  }
@@ -279,55 +228,54 @@ class BasicAttacher extends Component {
279
228
  // Prevent jank by making the attachment invisible until positioned.
280
229
  // The visibility style will be toggled by this._startShowAnimation()
281
230
  this._floatingElement.style.visibility = isVisible ? 'hidden' : '';
282
-
283
231
  if (onChange) {
284
232
  onChange(isVisible);
285
233
  }
286
234
  }
287
235
  }
288
-
289
236
  get _showOn() {
290
237
  let showOn = this.showOn;
291
-
292
238
  if (showOn === undefined) {
293
239
  showOn = DEFAULTS.showOn;
294
240
  }
295
-
296
241
  return showOn === null ? [] : showOn.split(' ');
297
242
  }
298
243
 
299
244
  // Exposed via the named yield to enable custom hide events
300
- @action
301
245
  hide() {
302
246
  this._hide();
303
247
  }
304
-
305
- @action
306
248
  onParentFinderInsert(element) {
307
249
  this.parentElement = element.parentElement;
308
250
  this._initializeAttacher();
309
251
  }
310
-
311
- @action
312
252
  _ensureArgumentsAreValid() {
313
253
  runInDebug(() => {
314
254
  if (this.arrow && this.isFillAnimation) {
315
- warn('Animation: \'fill\' is not compatible with arrow: true', { id: 70015 });
255
+ warn('Animation: \'fill\' is not compatible with arrow: true', {
256
+ id: 70015
257
+ });
316
258
  }
317
-
318
259
  if (this.useCapture !== this._lastUseCaptureArgumentValue) {
319
- warn(
320
- 'The value of the useCapture argument was mutated',
321
- { id: 'ember-attacher.use-capture-mutated' }
322
- );
260
+ warn('The value of the useCapture argument was mutated', {
261
+ id: 'ember-attacher.use-capture-mutated'
262
+ });
323
263
  }
324
264
  });
325
265
  }
326
-
327
266
  constructor() {
328
267
  super(...arguments);
329
268
 
330
269
  // The debounced _hide() and _show() are stored here so they can be cancelled when necessary
270
+ _initializerDefineProperty(this, "parentNotFound", _descriptor, this);
271
+ _initializerDefineProperty(this, "parentElement", _descriptor2, this);
272
+ _initializerDefineProperty(this, "_isStartingAnimation", _descriptor3, this);
273
+ _initializerDefineProperty(this, "_arrowElement", _descriptor4, this);
274
+ _initializerDefineProperty(this, "_currentTarget", _descriptor5, this);
275
+ // This is set to true when the popover is shown in order to override lazyRender=false
276
+ _initializerDefineProperty(this, "_mustRender", _descriptor6, this);
277
+ _initializerDefineProperty(this, "_transitionDuration", _descriptor7, this);
278
+ _defineProperty(this, "_floatingElement", null);
331
279
  this._delayedVisibilityToggle = null;
332
280
 
333
281
  // The final source of truth on whether or not all _hide() or _show() actions have completed
@@ -343,27 +291,22 @@ class BasicAttacher extends Component {
343
291
  this._showListenersOnTargetByEvent = {};
344
292
 
345
293
  // Hacks to make sure event listeners have the right context and are still removable
346
- this._debouncedHideIfMouseOutsideTargetOrAttachment
347
- = this._debouncedHideIfMouseOutsideTargetOrAttachment.bind(this);
294
+ this._debouncedHideIfMouseOutsideTargetOrAttachment = this._debouncedHideIfMouseOutsideTargetOrAttachment.bind(this);
348
295
  this._hide = this._hide.bind(this);
349
296
  this._hideAfterDelay = this._hideAfterDelay.bind(this);
350
- this._hideIfMouseOutsideTargetOrAttachment
351
- = this._hideIfMouseOutsideTargetOrAttachment.bind(this);
297
+ this._hideIfMouseOutsideTargetOrAttachment = this._hideIfMouseOutsideTargetOrAttachment.bind(this);
352
298
  this._hideOnClickOut = this._hideOnClickOut.bind(this);
353
299
  this._hideOnEscapeKey = this._hideOnEscapeKey.bind(this);
354
300
  this._hideOnLostFocus = this._hideOnLostFocus.bind(this);
355
301
  this._hideOnMouseLeaveTarget = this._hideOnMouseLeaveTarget.bind(this);
356
302
  this._show = this._show.bind(this);
357
303
  this._showAfterDelay = this._showAfterDelay.bind(this);
358
-
359
304
  this._lastUseCaptureArgumentValue = this.useCapture;
360
305
  }
361
-
362
306
  _initializeAttacher() {
363
307
  this._removeEventListeners();
364
308
  this._currentTarget = this.args.explicitTarget || this.parentElement;
365
309
  this._addListenersForShowEvents();
366
-
367
310
  if (!this._isHidden || this.isShown) {
368
311
  this._addListenersForHideEvents();
369
312
 
@@ -375,57 +318,43 @@ class BasicAttacher extends Component {
375
318
  // Call hook for subclasses to add their own initialization logic
376
319
  this.args.onInitializeAttacher?.(this._currentTarget, this.id);
377
320
  }
378
-
379
321
  _addListenersForShowEvents() {
380
322
  if (!this._currentTarget) {
381
323
  return;
382
324
  }
383
-
384
- this._showOn.forEach((event) => {
325
+ this._showOn.forEach(event => {
385
326
  this._showListenersOnTargetByEvent[event] = this._showAfterDelay;
386
-
387
327
  this._currentTarget.addEventListener(event, this._showAfterDelay, this.useCapture);
388
328
  });
389
329
  }
390
-
391
330
  willDestroy() {
392
331
  super.willDestroy(...arguments);
393
-
394
332
  this._cancelAnimation();
395
333
  cancel(this._delayedVisibilityToggle);
396
-
397
334
  this._removeEventListeners();
398
335
 
399
336
  // Call hook for cleanup
400
337
  this.args.onWillDestroy?.(this._currentTarget, this.id);
401
338
  }
402
-
403
339
  _removeEventListeners() {
404
- Object.keys(this._hideListenersOnDocumentByEvent).forEach((eventType) => {
340
+ Object.keys(this._hideListenersOnDocumentByEvent).forEach(eventType => {
405
341
  document.removeEventListener(eventType, this._hideListenersOnDocumentByEvent[eventType], this.useCapture);
406
342
  delete this._hideListenersOnDocumentByEvent[eventType];
407
343
  });
408
344
  if (!this._currentTarget) {
409
345
  return;
410
346
  }
411
-
412
- [this._hideListenersOnTargetByEvent, this._showListenersOnTargetByEvent]
413
- .forEach((eventToListener) => {
414
- Object.keys(eventToListener).forEach((event) => {
415
- this._currentTarget.removeEventListener(event, eventToListener[event], this.useCapture);
416
- });
347
+ [this._hideListenersOnTargetByEvent, this._showListenersOnTargetByEvent].forEach(eventToListener => {
348
+ Object.keys(eventToListener).forEach(event => {
349
+ this._currentTarget.removeEventListener(event, eventToListener[event], this.useCapture);
417
350
  });
351
+ });
418
352
  }
419
-
420
- @action
421
353
  onTargetOrTriggerChange() {
422
354
  this._initializeAttacher();
423
355
  }
424
-
425
- @action
426
356
  onIsShownChange() {
427
357
  const isShown = this.isShown;
428
-
429
358
  if (isShown === true && this._isHidden) {
430
359
  this._show();
431
360
 
@@ -443,31 +372,22 @@ class BasicAttacher extends Component {
443
372
 
444
373
  _showAfterDelay() {
445
374
  cancel(this._delayedVisibilityToggle);
446
-
447
375
  this._mustRender = true;
448
-
449
376
  this._addListenersForHideEvents();
450
-
451
377
  const showDelay = parseInt(this.showDelay);
452
-
453
378
  this._delayedVisibilityToggle = debounce(this, this._show, showDelay, !showDelay);
454
379
  }
455
-
456
380
  _show() {
457
381
  this._cancelAnimation();
458
-
459
382
  if (!this._currentTarget) {
460
383
  return;
461
384
  }
462
-
463
385
  this._mustRender = true;
464
386
 
465
387
  // Make the attachment visible immediately so transition animations can take place
466
388
  this._setIsVisibleAfterDelay(true, 0);
467
-
468
389
  this._startShowAnimation();
469
390
  }
470
-
471
391
  _startShowAnimation() {
472
392
  // Start the show animation on the next cycle so CSS transitions can have an effect.
473
393
  // If we start the animation immediately, the transition won't work because
@@ -479,7 +399,6 @@ class BasicAttacher extends Component {
479
399
  if (this.isDestroyed || this.isDestroying || !this._currentTarget) {
480
400
  return;
481
401
  }
482
-
483
402
  const floatingElement = this._floatingElement;
484
403
 
485
404
  // Wait until the element is visible before continuing
@@ -487,7 +406,6 @@ class BasicAttacher extends Component {
487
406
  this._startShowAnimation();
488
407
  return;
489
408
  }
490
-
491
409
  this._update();
492
410
 
493
411
  // Wait for the above positioning to take effect before starting the show animation,
@@ -507,7 +425,6 @@ class BasicAttacher extends Component {
507
425
  this._isStartingAnimation = true;
508
426
  floatingElement.setAttribute('aria-hidden', 'false');
509
427
  });
510
-
511
428
  this._isHidden = false;
512
429
  });
513
430
  animationTestWaiter.beginAsync(this._animationTimeout);
@@ -521,12 +438,9 @@ class BasicAttacher extends Component {
521
438
 
522
439
  _hideAfterDelay() {
523
440
  cancel(this._delayedVisibilityToggle);
524
-
525
441
  const hideDelay = parseInt(this.hideDelay);
526
-
527
442
  this._delayedVisibilityToggle = debounce(this, this._hide, hideDelay, !hideDelay);
528
443
  }
529
-
530
444
  _hide() {
531
445
  if (!this._floatingElement) {
532
446
  this._animationTimeout = requestAnimationFrame(() => {
@@ -536,9 +450,7 @@ class BasicAttacher extends Component {
536
450
  animationTestWaiter.beginAsync(this._animationTimeout);
537
451
  return;
538
452
  }
539
-
540
453
  this._cancelAnimation();
541
-
542
454
  this._removeListenersForHideEvents();
543
455
  this._animationTimeout = requestAnimationFrame(() => {
544
456
  animationTestWaiter.endAsync(this._animationTimeout);
@@ -546,21 +458,17 @@ class BasicAttacher extends Component {
546
458
  if (this.isDestroyed || this.isDestroying) {
547
459
  return;
548
460
  }
549
-
550
461
  const hideDuration = parseInt(this.hideDuration);
551
-
552
462
  run(() => {
553
463
  if (this.isDestroyed || this.isDestroying) {
554
464
  return;
555
465
  }
556
-
557
466
  this._transitionDuration = hideDuration;
558
467
  this._isStartingAnimation = false;
559
468
  this._floatingElement.setAttribute('aria-hidden', 'true');
560
469
  // Wait for any animations to complete before hiding the attachment
561
470
  this._setIsVisibleAfterDelay(false, hideDuration);
562
471
  });
563
-
564
472
  this._isHidden = true;
565
473
  });
566
474
  animationTestWaiter.beginAsync(this._animationTimeout);
@@ -578,27 +486,20 @@ class BasicAttacher extends Component {
578
486
  if (!target || this.isDestroyed || this.isDestroying) {
579
487
  return;
580
488
  }
581
-
582
489
  if (hideOn.includes('click')) {
583
490
  const showOnClickListener = this._showListenersOnTargetByEvent.click;
584
-
585
491
  if (showOnClickListener) {
586
492
  target.removeEventListener('click', showOnClickListener, this.useCapture);
587
-
588
493
  delete this._showListenersOnTargetByEvent.click;
589
494
  }
590
-
591
495
  this._hideListenersOnTargetByEvent.click = this._hideAfterDelay;
592
496
  target.addEventListener('click', this._hideAfterDelay, this.useCapture);
593
497
  }
594
-
595
498
  if (hideOn.includes('clickout')) {
596
499
  const clickoutEvent = 'ontouchstart' in window ? 'touchend' : 'click';
597
-
598
500
  this._hideListenersOnDocumentByEvent[clickoutEvent] = this._hideOnClickOut;
599
501
  document.addEventListener(clickoutEvent, this._hideOnClickOut, this.useCapture);
600
502
  }
601
-
602
503
  if (hideOn.includes('escapekey')) {
603
504
  this._hideListenersOnDocumentByEvent.keydown = this._hideOnEscapeKey;
604
505
  document.addEventListener('keydown', this._hideOnEscapeKey, this.useCapture);
@@ -612,14 +513,13 @@ class BasicAttacher extends Component {
612
513
  }
613
514
 
614
515
  // Hides the attachment when focus is lost on the target
615
- ['blur', 'focusout'].forEach((eventType) => {
516
+ ['blur', 'focusout'].forEach(eventType => {
616
517
  if (hideOn.includes(eventType)) {
617
518
  this._hideListenersOnTargetByEvent[eventType] = this._hideOnLostFocus;
618
519
  target.addEventListener(eventType, this._hideOnLostFocus, this.useCapture);
619
520
  }
620
521
  });
621
522
  }
622
-
623
523
  _hideOnMouseLeaveTarget() {
624
524
  if (this.interactive) {
625
525
  // TODO(kjb) Should debounce this, but hiding appears sluggish if you debounce.
@@ -635,81 +535,59 @@ class BasicAttacher extends Component {
635
535
  this._hideAfterDelay();
636
536
  }
637
537
  }
638
-
639
538
  _debouncedHideIfMouseOutsideTargetOrAttachment(event) {
640
539
  debounce(this, this._hideIfMouseOutsideTargetOrAttachment, event, 10);
641
540
  }
642
-
643
541
  _hideIfMouseOutsideTargetOrAttachment(event) {
644
542
  const target = this._currentTarget;
645
-
646
543
  if (!target) {
647
544
  return;
648
545
  }
649
546
 
650
547
  // If cursor is not on the attachment or target, hide the floating element
651
- if (!target.contains(event.target)
652
- && !(this.isOffset && this._isCursorBetweenTargetAndAttachment(event))
653
- && (this._floatingElement && !this._floatingElement.contains(event.target))) {
548
+ if (!target.contains(event.target) && !(this.isOffset && this._isCursorBetweenTargetAndAttachment(event)) && this._floatingElement && !this._floatingElement.contains(event.target)) {
654
549
  // Remove this listener before hiding the attachment
655
550
  delete this._hideListenersOnDocumentByEvent.mousemove;
656
551
  document.removeEventListener('mousemove', this._hideIfMouseOutsideTargetOrAttachment, this.useCapture);
657
-
658
552
  this._hideAfterDelay();
659
553
  }
660
554
  }
661
-
662
555
  _isCursorBetweenTargetAndAttachment(event) {
663
-
664
556
  if (!this._currentTarget) {
665
557
  return;
666
558
  }
667
-
668
- const { clientX, clientY } = event;
669
-
559
+ const {
560
+ clientX,
561
+ clientY
562
+ } = event;
670
563
  const attachmentPosition = this._floatingElement.getBoundingClientRect();
671
564
  const targetPosition = this._currentTarget.getBoundingClientRect();
672
-
673
- const isBetweenLeftAndRight = clientX > Math.min(attachmentPosition.left, targetPosition.left)
674
- && clientX < Math.max(attachmentPosition.right, targetPosition.right);
675
-
676
- const isBetweenTopAndBottom = clientY > Math.min(attachmentPosition.top, targetPosition.top)
677
- && clientY < Math.max(attachmentPosition.bottom, targetPosition.bottom);
565
+ const isBetweenLeftAndRight = clientX > Math.min(attachmentPosition.left, targetPosition.left) && clientX < Math.max(attachmentPosition.right, targetPosition.right);
566
+ const isBetweenTopAndBottom = clientY > Math.min(attachmentPosition.top, targetPosition.top) && clientY < Math.max(attachmentPosition.bottom, targetPosition.bottom);
678
567
 
679
568
  // Check if cursor is between a left-flipped attachment
680
- if (attachmentPosition.right < targetPosition.left
681
- && clientX >= attachmentPosition.right && clientX <= targetPosition.left
682
- && isBetweenTopAndBottom) {
569
+ if (attachmentPosition.right < targetPosition.left && clientX >= attachmentPosition.right && clientX <= targetPosition.left && isBetweenTopAndBottom) {
683
570
  return true;
684
571
  }
685
572
 
686
573
  // Check if cursor is between a right-flipped attachment
687
- if (attachmentPosition.left > targetPosition.right
688
- && clientX <= attachmentPosition.left && clientX >= targetPosition.right
689
- && isBetweenTopAndBottom) {
574
+ if (attachmentPosition.left > targetPosition.right && clientX <= attachmentPosition.left && clientX >= targetPosition.right && isBetweenTopAndBottom) {
690
575
  return true;
691
576
  }
692
577
 
693
578
  // Check if cursor is between a bottom-flipped attachment
694
- if (attachmentPosition.top > targetPosition.bottom
695
- && clientY <= attachmentPosition.top && clientY >= targetPosition.bottom
696
- && isBetweenLeftAndRight) {
579
+ if (attachmentPosition.top > targetPosition.bottom && clientY <= attachmentPosition.top && clientY >= targetPosition.bottom && isBetweenLeftAndRight) {
697
580
  return true;
698
581
  }
699
582
 
700
583
  // Check if cursor is between a top-flipped attachment
701
- if (attachmentPosition.bottom < targetPosition.top
702
- && clientY >= attachmentPosition.bottom && clientY <= targetPosition.top
703
- && isBetweenLeftAndRight) {
584
+ if (attachmentPosition.bottom < targetPosition.top && clientY >= attachmentPosition.bottom && clientY <= targetPosition.top && isBetweenLeftAndRight) {
704
585
  return true;
705
586
  }
706
-
707
587
  return false;
708
588
  }
709
-
710
589
  _hideOnClickOut(event) {
711
590
  const targetReceivedClick = this._currentTarget.contains(event.target);
712
-
713
591
  if (this.interactive) {
714
592
  if (!targetReceivedClick && !this._floatingElement.contains(event.target)) {
715
593
  this._hideAfterDelay();
@@ -718,24 +596,19 @@ class BasicAttacher extends Component {
718
596
  this._hideAfterDelay();
719
597
  }
720
598
  }
721
-
722
599
  _hideOnEscapeKey(event) {
723
600
  if (event.keyCode === 27) {
724
601
  return this._hideAfterDelay();
725
602
  }
726
603
  }
727
-
728
604
  _hideOnLostFocus(event) {
729
605
  if (event.relatedTarget === null) {
730
606
  this._hideAfterDelay();
731
607
  }
732
-
733
608
  if (!this._currentTarget) {
734
609
  return;
735
610
  }
736
-
737
611
  const targetContainsFocus = this._currentTarget.contains(event.relatedTarget);
738
-
739
612
  if (this.interactive) {
740
613
  if (!targetContainsFocus && !this._floatingElement.contains(event.relatedTarget)) {
741
614
  this._hideAfterDelay();
@@ -744,13 +617,11 @@ class BasicAttacher extends Component {
744
617
  this._hideAfterDelay();
745
618
  }
746
619
  }
747
-
748
620
  _removeListenersForHideEvents() {
749
- Object.keys(this._hideListenersOnDocumentByEvent).forEach((eventType) => {
621
+ Object.keys(this._hideListenersOnDocumentByEvent).forEach(eventType => {
750
622
  document.removeEventListener(eventType, this._hideListenersOnDocumentByEvent[eventType], this.useCapture);
751
623
  delete this._hideListenersOnDocumentByEvent[eventType];
752
624
  });
753
-
754
625
  const showOn = this._showOn;
755
626
  const target = this._currentTarget;
756
627
 
@@ -762,103 +633,138 @@ class BasicAttacher extends Component {
762
633
  // Switch clicking back to a show event
763
634
  if (showOn.includes('click')) {
764
635
  const hideOnClickListener = this._hideListenersOnTargetByEvent.click;
765
-
766
636
  if (hideOnClickListener) {
767
637
  target.removeEventListener('click', hideOnClickListener, this.useCapture);
768
638
  delete this._hideListenersOnTargetByEvent.click;
769
639
  }
770
-
771
640
  this._showListenersOnTargetByEvent.click = this._showAfterDelay;
772
641
  target.addEventListener('click', this._showAfterDelay, this.useCapture);
773
642
  }
774
-
775
- ['blur', 'focusout', 'mouseleave'].forEach((eventType) => {
643
+ ['blur', 'focusout', 'mouseleave'].forEach(eventType => {
776
644
  const listener = this._hideListenersOnTargetByEvent[eventType];
777
-
778
645
  if (listener) {
779
646
  target.removeEventListener(eventType, listener, this.useCapture);
780
647
  delete this._hideListenersOnTargetByEvent[eventType];
781
648
  }
782
649
  });
783
650
  }
784
-
785
- @action
786
651
  didInsertFloatingElement(floatingElement) {
787
652
  this._floatingElement = floatingElement;
788
-
789
653
  if (this.renderInPlace) {
790
654
  this.parentElement = floatingElement.parentElement;
791
655
  this._initializeAttacher();
792
656
  }
793
657
  }
794
-
795
- @action
796
658
  didInsertArrow(element) {
797
659
  this._arrowElement = element;
798
660
  }
799
-
800
- @action
801
661
  onOptionsChange() {
802
662
  this._ensureArgumentsAreValid();
803
663
  this._update();
804
664
  }
805
-
806
- @action
807
665
  willDestroyFloatingElement() {
808
666
  this._cleanup?.();
809
667
  }
810
-
811
668
  _update() {
812
669
  this._cleanup?.();
813
670
  if (this.autoUpdate) {
814
- this._cleanup = autoUpdate(
815
- this._currentTarget,
816
- this._floatingElement,
817
- this._updatePosition,
818
- typeOf(this.autoUpdate) === 'object' ? this.autoUpdate : undefined
819
- );
671
+ this._cleanup = autoUpdate(this._currentTarget, this._floatingElement, this._updatePosition, typeOf(this.autoUpdate) === 'object' ? this.autoUpdate : undefined);
820
672
  } else {
821
673
  this._updatePosition();
822
674
  }
823
675
  }
824
-
825
- @action
826
676
  _updatePosition() {
827
677
  const computePositionToken = animationTestWaiter.beginAsync();
828
678
  computePosition(this._currentTarget, this._floatingElement, {
829
679
  ...this.floatingUiOptions,
830
680
  middleware: this._middleware,
831
681
  placement: this.placement
832
- }).then(({ x, y, placement, middlewareData }) => {
682
+ }).then(({
683
+ x,
684
+ y,
685
+ placement,
686
+ middlewareData
687
+ }) => {
833
688
  animationTestWaiter.endAsync(computePositionToken);
834
- Object.assign(this._floatingElement.style, { left: `${x}px`, top: `${y}px`, });
835
-
689
+ Object.assign(this._floatingElement.style, {
690
+ left: `${x}px`,
691
+ top: `${y}px`
692
+ });
836
693
  if (middlewareData.arrow) {
837
- const { x, y } = middlewareData.arrow;
838
-
694
+ const {
695
+ x,
696
+ y
697
+ } = middlewareData.arrow;
839
698
  Object.assign(this._arrowElement.style, {
840
699
  left: x != null ? `${x}px` : '',
841
- top: y != null ? `${y}px` : '',
700
+ top: y != null ? `${y}px` : ''
842
701
  });
843
702
  }
844
703
  this._floatingElement.setAttribute('x-placement', placement);
845
704
  });
846
705
  }
847
-
848
706
  _cancelAnimation() {
849
707
  if (typeof cancelAnimationFrame !== 'function') {
850
708
  return;
851
709
  }
852
-
853
710
  cancelAnimationFrame(this._animationTimeout);
854
-
855
711
  runInDebug(() => {
856
712
  if (animationTestWaiter.items?.get(this._animationTimeout)) {
857
713
  animationTestWaiter.endAsync(this._animationTimeout);
858
714
  }
859
715
  });
860
716
  }
861
- }
717
+ }, _descriptor = _applyDecoratedDescriptor(_class.prototype, "parentNotFound", [tracked], {
718
+ configurable: true,
719
+ enumerable: true,
720
+ writable: true,
721
+ initializer: function () {
722
+ return true;
723
+ }
724
+ }), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "parentElement", [tracked], {
725
+ configurable: true,
726
+ enumerable: true,
727
+ writable: true,
728
+ initializer: function () {
729
+ return null;
730
+ }
731
+ }), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, "_isStartingAnimation", [tracked], {
732
+ configurable: true,
733
+ enumerable: true,
734
+ writable: true,
735
+ initializer: function () {
736
+ return false;
737
+ }
738
+ }), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, "_arrowElement", [tracked], {
739
+ configurable: true,
740
+ enumerable: true,
741
+ writable: true,
742
+ initializer: function () {
743
+ return null;
744
+ }
745
+ }), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, "_currentTarget", [tracked], {
746
+ configurable: true,
747
+ enumerable: true,
748
+ writable: true,
749
+ initializer: function () {
750
+ return null;
751
+ }
752
+ }), _descriptor6 = _applyDecoratedDescriptor(_class.prototype, "_mustRender", [tracked], {
753
+ configurable: true,
754
+ enumerable: true,
755
+ writable: true,
756
+ initializer: function () {
757
+ return false;
758
+ }
759
+ }), _descriptor7 = _applyDecoratedDescriptor(_class.prototype, "_transitionDuration", [tracked], {
760
+ configurable: true,
761
+ enumerable: true,
762
+ writable: true,
763
+ initializer: function () {
764
+ return 0;
765
+ }
766
+ }), _applyDecoratedDescriptor(_class.prototype, "hide", [action], Object.getOwnPropertyDescriptor(_class.prototype, "hide"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onParentFinderInsert", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onParentFinderInsert"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "_ensureArgumentsAreValid", [action], Object.getOwnPropertyDescriptor(_class.prototype, "_ensureArgumentsAreValid"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onTargetOrTriggerChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onTargetOrTriggerChange"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onIsShownChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onIsShownChange"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "didInsertFloatingElement", [action], Object.getOwnPropertyDescriptor(_class.prototype, "didInsertFloatingElement"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "didInsertArrow", [action], Object.getOwnPropertyDescriptor(_class.prototype, "didInsertArrow"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onOptionsChange", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onOptionsChange"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "willDestroyFloatingElement", [action], Object.getOwnPropertyDescriptor(_class.prototype, "willDestroyFloatingElement"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "_updatePosition", [action], Object.getOwnPropertyDescriptor(_class.prototype, "_updatePosition"), _class.prototype), _class);
767
+ setComponentTemplate(TEMPLATE, BasicAttacher);
862
768
 
863
769
  export { BasicAttacher as default };
864
770
  //# sourceMappingURL=basic-attacher.js.map
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,32 +1,22 @@
1
1
 
2
2
  function isVisible(selector, contextEl) {
3
- const attachment = typeof(selector) === 'string' ? getAttachment(selector, contextEl) : selector;
4
-
3
+ const attachment = typeof selector === 'string' ? getAttachment(selector, contextEl) : selector;
5
4
  return getComputedStyle(attachment).display !== 'none';
6
5
  }
7
-
8
6
  function getAttachment(selectorOrElement = '', contextEl) {
9
- if (selectorOrElement instanceof Window ||
10
- selectorOrElement instanceof Document ||
11
- selectorOrElement instanceof HTMLElement ||
12
- selectorOrElement instanceof SVGElement) {
7
+ if (selectorOrElement instanceof Window || selectorOrElement instanceof Document || selectorOrElement instanceof HTMLElement || selectorOrElement instanceof SVGElement) {
13
8
  return selectorOrElement;
14
9
  }
15
-
16
10
  let result;
17
-
18
11
  if (contextEl instanceof HTMLElement) {
19
12
  result = contextEl.querySelector(selectorOrElement);
20
13
  } else {
21
14
  result = document.querySelector(`${selectorOrElement}`);
22
15
  }
23
-
24
16
  if (!result) {
25
- const msg = typeof(selector) === 'string' ? selectorOrElement : selectorOrElement.innerHTML;
26
-
17
+ const msg = typeof selector === 'string' ? selectorOrElement : selectorOrElement.innerHTML;
27
18
  throw `Could not locate attachment from selector: ${msg}`;
28
19
  }
29
-
30
20
  return result;
31
21
  }
32
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-attacher",
3
- "version": "4.0.0-beta.2",
3
+ "version": "4.0.0-beta.3",
4
4
  "description": "Tooltips and popovers for Ember.js apps",
5
5
  "keywords": [
6
6
  "ember-addon",