ember-attacher 3.1.0 → 3.1.1

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,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="MaterialThemeProjectNewConfig">
4
+ <option name="metadata">
5
+ <MTProjectMetadataState>
6
+ <option name="userId" value="43521698:18f28e3c796:-7d14" />
7
+ </MTProjectMetadataState>
8
+ </option>
9
+ </component>
10
+ </project>
package/CHANGELOG.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
 
4
4
 
5
- ## v3.1.0 (2024-03-07)
5
+
6
+ ## v3.1.1 (2024-04-30)
6
7
 
7
8
  #### :boom: Breaking Change
8
9
  * [#843](https://github.com/tylerturdenpants/ember-attacher/pull/843) Drop ember-in-element-polyfill from dependencies ([@pzubar](https://github.com/pzubar))
@@ -34,6 +35,14 @@
34
35
  #### Committers: 1
35
36
  - Petro Zubar ([@pzubar](https://github.com/pzubar))
36
37
 
38
+ ## v3.1.0 (2024-03-07)
39
+ #### :rocket: Enhancement
40
+ * [#932](https://github.com/tylerturdenpants/ember-attacher/pull/932) Drop `@ember/render-modifiers` ([@pzubar](https://github.com/pzubar))
41
+ * [#887](https://github.com/tylerturdenpants/ember-attacher/pull/887) [chore]: Bump ember-cli-babel from 7.26.11 to 8.2.0 ([@dependabot[bot]](https://github.com/apps/dependabot))
42
+
43
+ #### Committers: 1
44
+ - Petro Zubar ([@pzubar](https://github.com/pzubar))
45
+
37
46
  ## v3.0.0 (2024-03-06)
38
47
 
39
48
  #### :boom: Breaking Change
@@ -1,6 +1,6 @@
1
1
  import { action } from '@ember/object';
2
2
  import Component from '@glimmer/component';
3
- import { cancel, debounce, later, next, run, once } from '@ember/runloop';
3
+ import { cancel, debounce, later, next, run } from '@ember/runloop';
4
4
  import { getOwner } from '@ember/application';
5
5
  import { guidFor } from '@ember/object/internals';
6
6
  import { htmlSafe, isHTMLSafe } from '@ember/template';
@@ -10,7 +10,6 @@ import { isEmpty, typeOf } from '@ember/utils';
10
10
  import { autoUpdate, computePosition, arrow, flip, limitShift, shift } from '@floating-ui/dom';
11
11
  import { buildWaiter } from '@ember/test-waiters';
12
12
  import { tracked } from '@glimmer/tracking';
13
- import { modifier } from 'ember-modifier';
14
13
  import DEFAULTS from '../defaults';
15
14
 
16
15
  const animationTestWaiter = buildWaiter('attach-popover');
@@ -294,18 +293,20 @@ export default class AttachPopover extends Component {
294
293
  this._hide();
295
294
  }
296
295
 
297
- onParentFinderInsert = modifier((element) => {
296
+ @action
297
+ onParentFinderInsert(element) {
298
298
  this.parentElement = element.parentElement;
299
- once(this, '_initializeAttacher')
300
- });
299
+ this._initializeAttacher();
300
+ }
301
301
 
302
- _ensureArgumentsAreValid([arrow, useCapture]) {
302
+ @action
303
+ _ensureArgumentsAreValid() {
303
304
  stripInProduction(() => {
304
- if (arrow && this.isFillAnimation) {
305
+ if (this.arrow && this.isFillAnimation) {
305
306
  warn('Animation: \'fill\' is not compatible with arrow: true', { id: 70015 });
306
307
  }
307
308
 
308
- if (useCapture !== this._lastUseCaptureArgumentValue) {
309
+ if (this.useCapture !== this._lastUseCaptureArgumentValue) {
309
310
  warn(
310
311
  'The value of the useCapture argument was mutated',
311
312
  { id: 'ember-attacher.use-capture-mutated' }
@@ -402,11 +403,15 @@ export default class AttachPopover extends Component {
402
403
  });
403
404
  }
404
405
 
405
- onTargetOrTriggerChange = modifier((_, _positional) => {
406
- once(this, '_initializeAttacher', ..._positional);
407
- });
406
+ @action
407
+ onTargetOrTriggerChange() {
408
+ this._initializeAttacher();
409
+ }
410
+
411
+ @action
412
+ onIsShownChange() {
413
+ const isShown = this.isShown;
408
414
 
409
- onIsShownChange = modifier((_, [isShown]) => {
410
415
  if (isShown === true && this._isHidden) {
411
416
  this._show();
412
417
 
@@ -416,18 +421,7 @@ export default class AttachPopover extends Component {
416
421
  } else if (isShown === false && !this._isHidden) {
417
422
  this._hide();
418
423
  }
419
- });
420
-
421
- initializeAttacher = modifier((floatingElement) => {
422
- this._floatingElement = floatingElement;
423
-
424
- if (this.renderInPlace) {
425
- this.parentElement = floatingElement.parentElement;
426
- once(this, '_initializeAttacher');
427
- }
428
-
429
- return () => this._cleanup?.();
430
- });
424
+ }
431
425
 
432
426
  /**
433
427
  * ================== SHOW ATTACHMENT LOGIC ==================
@@ -774,14 +768,31 @@ export default class AttachPopover extends Component {
774
768
  });
775
769
  }
776
770
 
777
- didInsertArrow = modifier((element) => {
771
+ @action
772
+ didInsertFloatingElement(floatingElement) {
773
+ this._floatingElement = floatingElement;
774
+
775
+ if (this.renderInPlace) {
776
+ this.parentElement = floatingElement.parentElement;
777
+ this._initializeAttacher();
778
+ }
779
+ }
780
+
781
+ @action
782
+ didInsertArrow(element) {
778
783
  this._arrowElement = element;
779
- })
784
+ }
785
+
786
+ @action
787
+ onOptionsChange() {
788
+ this._ensureArgumentsAreValid();
789
+ this._update();
790
+ }
780
791
 
781
- onOptionsChange = modifier((_, positional) => {
782
- this._ensureArgumentsAreValid(positional);
783
- once(this, '_update')
784
- })
792
+ @action
793
+ willDestroyFloatingElement() {
794
+ this._cleanup?.();
795
+ }
785
796
 
786
797
  _update() {
787
798
  this._cleanup?.();
@@ -1,5 +1,5 @@
1
1
  {{~#unless this.renderFloatingElement}}
2
- <meta hidden {{this.onParentFinderInsert}} {{this.onIsShownChange this.isShown}}/>
2
+ <meta hidden {{did-insert this.onParentFinderInsert}} {{did-update this.onIsShownChange this.isShown}}/>
3
3
  {{~/unless~}}
4
4
 
5
5
  {{~#if this.renderFloatingElement~}}
@@ -8,16 +8,17 @@
8
8
  class="ember-attacher"
9
9
  id={{this.id}}
10
10
  role={{this.ariaRole}}
11
- {{this.onIsShownChange this.isShown}}
12
- {{this.onTargetOrTriggerChange this.hideOn this.showOn @explicitTarget}}
13
- {{this.onOptionsChange this.arrow this.useCapture this.autoUpdate this.animation this.placement this._renderInPlace this._currentTarget this._middleware}}
14
- {{this.initializeAttacher}}
11
+ {{did-insert this.didInsertFloatingElement}}
12
+ {{did-update this.onIsShownChange this.isShown}}
13
+ {{did-update this.onTargetOrTriggerChange this.hideOn this.showOn @explicitTarget}}
14
+ {{did-update this.onOptionsChange this.autoUpdate this.animation this.arrow this.useCapture this.placement this._renderInPlace this._currentTarget this._middleware}}
15
+ {{will-destroy this.willDestroyFloatingElement}}
15
16
  ...attributes
16
17
  >
17
18
  <div class={{this._class}} style={{this._style}}>
18
- {{yield (hash hide=this.hide)}}
19
+ {{yield (hash hide=(action 'hide'))}}
19
20
  {{#if this.arrow}}
20
- <div x-arrow {{this.didInsertArrow}}></div>
21
+ <div x-arrow {{did-insert this.didInsertArrow}}></div>
21
22
  {{/if}}
22
23
  {{#if this.isFillAnimation}}
23
24
  <div x-circle style="{{this._circleTransitionDuration}}"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-attacher",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "Tooltips and popovers for Ember.js apps",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -37,8 +37,7 @@
37
37
  "ember-cli-htmlbars": "^6.3.0",
38
38
  "ember-cli-sass": "^11.0.1",
39
39
  "ember-maybe-in-element": "^2.1.0",
40
- "ember-modifier": "^4.1.0",
41
- "sass": "^1.71.1"
40
+ "sass": "^1.72.0"
42
41
  },
43
42
  "devDependencies": {
44
43
  "@babel/core": "^7.23.7",
@@ -46,6 +45,7 @@
46
45
  "@babel/helper-get-function-arity": "^7.16.7",
47
46
  "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
48
47
  "@ember/optional-features": "^2.0.0",
48
+ "@ember/render-modifiers": "^2.0.5",
49
49
  "@ember/string": "^3.1.1",
50
50
  "@ember/test-helpers": "~2.9.4",
51
51
  "@ember/test-waiters": "^3.1.0",
@@ -70,16 +70,16 @@
70
70
  "ember-svg-jar": "~2.4.7",
71
71
  "ember-truth-helpers": "^4.0.3",
72
72
  "ember-try": "~3.0.0",
73
- "eslint": "~8.55.0",
73
+ "eslint": "~8.57.0",
74
74
  "eslint-plugin-decorator-position": "^5.0.2",
75
75
  "eslint-plugin-ember": "~11.11.1",
76
76
  "eslint-plugin-n": "^16.6.0",
77
77
  "flexi": "^2.1.0",
78
78
  "loader.js": "^4.7.0",
79
- "qunit": "~2.20.0",
79
+ "qunit": "~2.20.1",
80
80
  "qunit-dom": "~3.0.0",
81
81
  "release-it": "~15.11.0",
82
- "webpack": "~5.89.0"
82
+ "webpack": "~5.91.0"
83
83
  },
84
84
  "engines": {
85
85
  "node": "16.* || >= 18"