ember-promise-modals 3.0.0 → 4.0.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/.release-it.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable no-template-curly-in-string */
2
2
  module.exports = {
3
3
  plugins: {
4
- 'release-it-lerna-changelog': {
4
+ '@release-it-plugins/lerna-changelog': {
5
5
  infile: 'CHANGELOG.md',
6
6
  },
7
7
  },
package/CHANGELOG.md CHANGED
@@ -1,53 +1,76 @@
1
1
  # Changelog
2
2
 
3
3
 
4
- ## v3.0.0 (2022-04-11)
4
+
5
+
6
+ ## v4.0.0 (2023-06-01)
5
7
 
6
8
  #### :boom: Breaking Change
7
- * [#588](https://github.com/simplabs/ember-promise-modals/pull/588) Use ember-auto-import@2 ([@pichfl](https://github.com/pichfl))
8
- * [#478](https://github.com/simplabs/ember-promise-modals/pull/478) Update to latest addon blueprint ([@pichfl](https://github.com/pichfl))
9
- * [#438](https://github.com/simplabs/ember-promise-modals/pull/438) bump @ember/test-waiters to 3.0.0 ([@nickschot](https://github.com/nickschot))
10
- * [#437](https://github.com/simplabs/ember-promise-modals/pull/437) Drop Node 10 support ([@nickschot](https://github.com/nickschot))
11
- * [#427](https://github.com/simplabs/ember-promise-modals/pull/427) Generate one backdrop per modal ([@aoumiri](https://github.com/aoumiri))
12
- * [#148](https://github.com/simplabs/ember-promise-modals/pull/148) Replace ember-animated with CSS animations ([@pichfl](https://github.com/pichfl))
9
+ * [#856](https://github.com/mainmatter/ember-promise-modals/pull/856) setupPromiseModals should wait for test waiters to settle ([@marcin-wicha](https://github.com/marcin-wicha))
13
10
 
14
11
  #### :rocket: Enhancement
15
- * [#549](https://github.com/simplabs/ember-promise-modals/pull/549) Enhance focus trap configuration ([@zeppelin](https://github.com/zeppelin))
16
- * [#533](https://github.com/simplabs/ember-promise-modals/pull/533) Legacy: Downgrade native class to Ember.Object ([@pichfl](https://github.com/pichfl))
17
- * [#436](https://github.com/simplabs/ember-promise-modals/pull/436) Embroider optimized compatibility ([@nickschot](https://github.com/nickschot))
18
- * [#517](https://github.com/simplabs/ember-promise-modals/pull/517) Add option to disable focus trap ([@zeppelin](https://github.com/zeppelin))
19
- * [#427](https://github.com/simplabs/ember-promise-modals/pull/427) Generate one backdrop per modal ([@aoumiri](https://github.com/aoumiri))
20
- * [#421](https://github.com/simplabs/ember-promise-modals/pull/421) add optional onAnimationModalOutEnd hook ([@nickschot](https://github.com/nickschot))
21
- * [#148](https://github.com/simplabs/ember-promise-modals/pull/148) Replace ember-animated with CSS animations ([@pichfl](https://github.com/pichfl))
12
+ * [#550](https://github.com/mainmatter/ember-promise-modals/pull/550) Modal template helper ([@pichfl](https://github.com/pichfl))
22
13
 
23
14
  #### :bug: Bug Fix
24
- * [#422](https://github.com/simplabs/ember-promise-modals/pull/422) fix promise-modals from breaking when used in another addon instead of an app ([@nickschot](https://github.com/nickschot))
25
- * [#420](https://github.com/simplabs/ember-promise-modals/pull/420) explicitly specify animation delay and duration as separate to make sure they're properly used by the browser ([@nickschot](https://github.com/nickschot))
26
- * [#419](https://github.com/simplabs/ember-promise-modals/pull/419) fix setting a delay on the backdrop or modal makes animation break ([@nickschot](https://github.com/nickschot))
27
- * [#412](https://github.com/simplabs/ember-promise-modals/pull/412) fix backdrop not animating immediately after the last modal is closed ([@nickschot](https://github.com/nickschot))
15
+ * [#826](https://github.com/mainmatter/ember-promise-modals/pull/826) Ensure animations are triggered when `prefer-reduced-animation` is used ([@pichfl](https://github.com/pichfl))
16
+ * [#682](https://github.com/mainmatter/ember-promise-modals/pull/682) Improve test helper ([@pichfl](https://github.com/pichfl))
17
+
18
+ #### :house: Internal
19
+ * [#819](https://github.com/mainmatter/ember-promise-modals/pull/819) Update ember-try configuration ([@pichfl](https://github.com/pichfl))
20
+ * [#688](https://github.com/mainmatter/ember-promise-modals/pull/688) Prefer "happy path" code style for `_resolve()` ([@pichfl](https://github.com/pichfl))
21
+ * [#687](https://github.com/mainmatter/ember-promise-modals/pull/687) Extract destruction of the modals effects into a method and apply them ([@pichfl](https://github.com/pichfl))
22
+ * [#686](https://github.com/mainmatter/ember-promise-modals/pull/686) Closing the modal should inform the modals service ([@pichfl](https://github.com/pichfl))
23
+ * [#766](https://github.com/mainmatter/ember-promise-modals/pull/766) Replace deprecated release-it-lerna-changelog ([@pichfl](https://github.com/pichfl))
24
+ * [#685](https://github.com/mainmatter/ember-promise-modals/pull/685) Move attaching/detaching `animationend` event handler into methods and generalize related names ([@pichfl](https://github.com/pichfl))
25
+ * [#763](https://github.com/mainmatter/ember-promise-modals/pull/763) Allow automatic installation of peer dependencies ([@pichfl](https://github.com/pichfl))
26
+ * [#684](https://github.com/mainmatter/ember-promise-modals/pull/684) Move focusTrap setup/teardown to methods ([@pichfl](https://github.com/pichfl))
27
+ * [#683](https://github.com/mainmatter/ember-promise-modals/pull/683) Replace retained element reference with a method ([@pichfl](https://github.com/pichfl))
28
+ * [#598](https://github.com/mainmatter/ember-promise-modals/pull/598) Refactor handling of `focusTrap.onDeactivate` method ([@pichfl](https://github.com/pichfl))
29
+ * [#681](https://github.com/mainmatter/ember-promise-modals/pull/681) remove dependabot configuration ([@nickschot](https://github.com/nickschot))
30
+
31
+ #### Committers: 5
32
+ - Florian Pichler ([@pichfl](https://github.com/pichfl))
33
+ - Gabor Babicz ([@zeppelin](https://github.com/zeppelin))
34
+ - Marcin Wicha ([@marcin-wicha](https://github.com/marcin-wicha))
35
+ - Nick Schot ([@nickschot](https://github.com/nickschot))
36
+ - Sebastian Helbig ([@sebastianhelbig](https://github.com/sebastianhelbig))
37
+
38
+ ## v3.0.1 (2022-04-12)
39
+
40
+ #### :bug: Bug Fix
41
+ * [#596](https://github.com/mainmatter/ember-promise-modals/pull/596) Ensure calls to @close run before the focus-out deactivation ([@pichfl](https://github.com/pichfl))
42
+
43
+ #### :house: Internal
44
+ * [#597](https://github.com/mainmatter/ember-promise-modals/pull/597) Remove deprecated `clickOutsideDeactivates` option ([@pichfl](https://github.com/pichfl))
45
+
46
+ #### Committers: 1
47
+ - Florian Pichler ([@pichfl](https://github.com/pichfl))
48
+
49
+ ## v3.0.0 (2022-04-11)
50
+
51
+ #### :boom: Breaking Change
52
+ * [#588](https://github.com/mainmatter/ember-promise-modals/pull/588) Use ember-auto-import@2 ([@pichfl](https://github.com/pichfl))
53
+ * [#438](https://github.com/mainmatter/ember-promise-modals/pull/438) bump @ember/test-waiters to 3.0.0 ([@nickschot](https://github.com/nickschot))
54
+ * [#437](https://github.com/mainmatter/ember-promise-modals/pull/437) Drop Node 10 support ([@nickschot](https://github.com/nickschot))
55
+
56
+ #### :rocket: Enhancement
57
+ * [#549](https://github.com/mainmatter/ember-promise-modals/pull/549) Enhance focus trap configuration ([@zeppelin](https://github.com/zeppelin))
58
+ * [#533](https://github.com/mainmatter/ember-promise-modals/pull/533) Legacy: Downgrade native class to Ember.Object ([@pichfl](https://github.com/pichfl))
59
+ * [#436](https://github.com/mainmatter/ember-promise-modals/pull/436) Embroider optimized compatibility ([@nickschot](https://github.com/nickschot))
60
+ * [#517](https://github.com/mainmatter/ember-promise-modals/pull/517) Add option to disable focus trap ([@zeppelin](https://github.com/zeppelin))
28
61
 
29
62
  #### :memo: Documentation
30
- * [#502](https://github.com/simplabs/ember-promise-modals/pull/502) Provide additional documentation for the Modal class and ModalOptions ([@pichfl](https://github.com/pichfl))
31
- * [#432](https://github.com/simplabs/ember-promise-modals/pull/432) Fix responsiveness of dummy app ([@nickschot](https://github.com/nickschot))
32
- * [#414](https://github.com/simplabs/ember-promise-modals/pull/414) Improve README and dummy application ([@pichfl](https://github.com/pichfl))
63
+ * [#502](https://github.com/mainmatter/ember-promise-modals/pull/502) Provide additional documentation for the Modal class and ModalOptions ([@pichfl](https://github.com/pichfl))
33
64
 
34
65
  #### :house: Internal
35
- * [#594](https://github.com/simplabs/ember-promise-modals/pull/594) Configure release-it ([@pichfl](https://github.com/pichfl))
36
- * [#570](https://github.com/simplabs/ember-promise-modals/pull/570) Setup Renovatebot ([@nickschot](https://github.com/nickschot))
37
- * [#477](https://github.com/simplabs/ember-promise-modals/pull/477) Replace Yarn with pnpm ([@pichfl](https://github.com/pichfl))
38
- * [#530](https://github.com/simplabs/ember-promise-modals/pull/530) Internal: Extend and apply prettier configuration ([@pichfl](https://github.com/pichfl))
39
- * [#500](https://github.com/simplabs/ember-promise-modals/pull/500) Specify octane edition in package.json & add missing optional features ([@nickschot](https://github.com/nickschot))
40
- * [#499](https://github.com/simplabs/ember-promise-modals/pull/499) Update ember-release scenario to use auto-import v2 ([@nickschot](https://github.com/nickschot))
41
- * [#431](https://github.com/simplabs/ember-promise-modals/pull/431) Use env=production when building the dummy application ([@pichfl](https://github.com/pichfl))
42
- * [#430](https://github.com/simplabs/ember-promise-modals/pull/430) Update production build path for GitHub pages ([@pichfl](https://github.com/pichfl))
43
- * [#415](https://github.com/simplabs/ember-promise-modals/pull/415) Deploy dummy application to Github pages ([@pichfl](https://github.com/pichfl))
44
- * [#417](https://github.com/simplabs/ember-promise-modals/pull/417) Delete unused modal service file from dummy app ([@nickschot](https://github.com/nickschot))
45
- * [#413](https://github.com/simplabs/ember-promise-modals/pull/413) use babel-eslint as eslint parser ([@nickschot](https://github.com/nickschot))
46
- * [#407](https://github.com/simplabs/ember-promise-modals/pull/407) upgrade to ember-qunit v5 ([@nickschot](https://github.com/nickschot))
47
- * [#309](https://github.com/simplabs/ember-promise-modals/pull/309) Update addon layout according to latest ember addon blueprint ([@pichfl](https://github.com/pichfl))
66
+ * [#594](https://github.com/mainmatter/ember-promise-modals/pull/594) Configure release-it ([@pichfl](https://github.com/pichfl))
67
+ * [#570](https://github.com/mainmatter/ember-promise-modals/pull/570) Setup Renovatebot ([@nickschot](https://github.com/nickschot))
68
+ * [#477](https://github.com/mainmatter/ember-promise-modals/pull/477) Replace Yarn with pnpm ([@pichfl](https://github.com/pichfl))
69
+ * [#530](https://github.com/mainmatter/ember-promise-modals/pull/530) Internal: Extend and apply prettier configuration ([@pichfl](https://github.com/pichfl))
70
+ * [#500](https://github.com/mainmatter/ember-promise-modals/pull/500) Specify octane edition in package.json & add missing optional features ([@nickschot](https://github.com/nickschot))
71
+ * [#499](https://github.com/mainmatter/ember-promise-modals/pull/499) Update ember-release scenario to use auto-import v2 ([@nickschot](https://github.com/nickschot))
48
72
 
49
- #### Committers: 4
50
- - Anass OUMIRI ([@aoumiri](https://github.com/aoumiri))
73
+ #### Committers: 3
51
74
  - Florian Pichler ([@pichfl](https://github.com/pichfl))
52
75
  - Gabor Babicz ([@zeppelin](https://github.com/zeppelin))
53
76
  - Nick Schot ([@nickschot](https://github.com/nickschot))
@@ -55,19 +78,19 @@
55
78
  ## v2.0.0 (2021-09-01)
56
79
 
57
80
  #### :boom: Breaking Change
58
- * [#427](https://github.com/simplabs/ember-promise-modals/pull/427) Generate one backdrop per modal ([@aoumiri](https://github.com/aoumiri))
81
+ * [#427](https://github.com/mainmatter/ember-promise-modals/pull/427) Generate one backdrop per modal ([@aoumiri](https://github.com/aoumiri))
59
82
 
60
83
  #### :rocket: Enhancement
61
- * [#427](https://github.com/simplabs/ember-promise-modals/pull/427) Generate one backdrop per modal ([@aoumiri](https://github.com/aoumiri))
84
+ * [#427](https://github.com/mainmatter/ember-promise-modals/pull/427) Generate one backdrop per modal ([@aoumiri](https://github.com/aoumiri))
62
85
 
63
86
  #### :memo: Documentation
64
- * [#432](https://github.com/simplabs/ember-promise-modals/pull/432) Fix responsiveness of dummy app ([@nickschot](https://github.com/nickschot))
65
- * [#414](https://github.com/simplabs/ember-promise-modals/pull/414) Improve README and dummy application ([@pichfl](https://github.com/pichfl))
87
+ * [#432](https://github.com/mainmatter/ember-promise-modals/pull/432) Fix responsiveness of dummy app ([@nickschot](https://github.com/nickschot))
88
+ * [#414](https://github.com/mainmatter/ember-promise-modals/pull/414) Improve README and dummy application ([@pichfl](https://github.com/pichfl))
66
89
 
67
90
  #### :house: Internal
68
- * [#431](https://github.com/simplabs/ember-promise-modals/pull/431) Use env=production when building the dummy application ([@pichfl](https://github.com/pichfl))
69
- * [#430](https://github.com/simplabs/ember-promise-modals/pull/430) Update production build path for GitHub pages ([@pichfl](https://github.com/pichfl))
70
- * [#415](https://github.com/simplabs/ember-promise-modals/pull/415) Deploy dummy application to Github pages ([@pichfl](https://github.com/pichfl))
91
+ * [#431](https://github.com/mainmatter/ember-promise-modals/pull/431) Use env=production when building the dummy application ([@pichfl](https://github.com/pichfl))
92
+ * [#430](https://github.com/mainmatter/ember-promise-modals/pull/430) Update production build path for GitHub pages ([@pichfl](https://github.com/pichfl))
93
+ * [#415](https://github.com/mainmatter/ember-promise-modals/pull/415) Deploy dummy application to Github pages ([@pichfl](https://github.com/pichfl))
71
94
 
72
95
  #### Committers: 4
73
96
  - Anass OUMIRI ([@aoumiri](https://github.com/aoumiri))
@@ -79,7 +102,7 @@
79
102
  ## v1.1.1 (2021-07-27)
80
103
 
81
104
  #### :bug: Bug Fix
82
- * [#422](https://github.com/simplabs/ember-promise-modals/pull/422) fix promsie-modals from breaking when used in another addon instead of an app ([@nickschot](https://github.com/nickschot))
105
+ * [#422](https://github.com/mainmatter/ember-promise-modals/pull/422) fix promsie-modals from breaking when used in another addon instead of an app ([@nickschot](https://github.com/nickschot))
83
106
 
84
107
  #### Committers: 1
85
108
  - Nick Schot ([@nickschot](https://github.com/nickschot))
@@ -88,10 +111,10 @@
88
111
  ## v1.1.0 (2021-07-27)
89
112
 
90
113
  #### :rocket: Enhancement
91
- * [#421](https://github.com/simplabs/ember-promise-modals/pull/421) add optional onAnimationModalOutEnd hook ([@nickschot](https://github.com/nickschot))
114
+ * [#421](https://github.com/mainmatter/ember-promise-modals/pull/421) add optional onAnimationModalOutEnd hook ([@nickschot](https://github.com/nickschot))
92
115
 
93
116
  #### :bug: Bug Fix
94
- * [#420](https://github.com/simplabs/ember-promise-modals/pull/420) explicitly specify animation delay and duration as separate to make sure they're properly used by the browser ([@nickschot](https://github.com/nickschot))
117
+ * [#420](https://github.com/mainmatter/ember-promise-modals/pull/420) explicitly specify animation delay and duration as separate to make sure they're properly used by the browser ([@nickschot](https://github.com/nickschot))
95
118
 
96
119
  #### Committers: 1
97
120
  - Nick Schot ([@nickschot](https://github.com/nickschot))
@@ -100,10 +123,10 @@
100
123
  ## v1.0.2 (2021-07-26)
101
124
 
102
125
  #### :bug: Bug Fix
103
- * [#419](https://github.com/simplabs/ember-promise-modals/pull/419) fix setting a delay on the backdrop or modal makes animation break ([@nickschot](https://github.com/nickschot))
126
+ * [#419](https://github.com/mainmatter/ember-promise-modals/pull/419) fix setting a delay on the backdrop or modal makes animation break ([@nickschot](https://github.com/nickschot))
104
127
 
105
128
  #### :house: Internal
106
- * [#417](https://github.com/simplabs/ember-promise-modals/pull/417) Delete unused modal service file from dummy app ([@nickschot](https://github.com/nickschot))
129
+ * [#417](https://github.com/mainmatter/ember-promise-modals/pull/417) Delete unused modal service file from dummy app ([@nickschot](https://github.com/nickschot))
107
130
 
108
131
  #### Committers: 1
109
132
  - Nick Schot ([@nickschot](https://github.com/nickschot))
@@ -112,10 +135,10 @@
112
135
  ## v1.0.1 (2021-07-16)
113
136
 
114
137
  #### :bug: Bug Fix
115
- * [#412](https://github.com/simplabs/ember-promise-modals/pull/412) fix backdrop not animating immediately after the last modal is closed ([@nickschot](https://github.com/nickschot))
138
+ * [#412](https://github.com/mainmatter/ember-promise-modals/pull/412) fix backdrop not animating immediately after the last modal is closed ([@nickschot](https://github.com/nickschot))
116
139
 
117
140
  #### :house: Internal
118
- * [#413](https://github.com/simplabs/ember-promise-modals/pull/413) use babel-eslint as eslint parser ([@nickschot](https://github.com/nickschot))
141
+ * [#413](https://github.com/mainmatter/ember-promise-modals/pull/413) use babel-eslint as eslint parser ([@nickschot](https://github.com/nickschot))
119
142
 
120
143
  #### Committers: 2
121
144
  - Nick Schot ([@nickschot](https://github.com/nickschot))
@@ -125,14 +148,14 @@
125
148
  ## v1.0.0 (2021-07-13)
126
149
 
127
150
  #### :boom: Breaking Change
128
- * [#148](https://github.com/simplabs/ember-promise-modals/pull/148) Replace ember-animated with CSS animations ([@pichfl](https://github.com/pichfl))
151
+ * [#148](https://github.com/mainmatter/ember-promise-modals/pull/148) Replace ember-animated with CSS animations ([@pichfl](https://github.com/pichfl))
129
152
 
130
153
  #### :rocket: Enhancement
131
- * [#148](https://github.com/simplabs/ember-promise-modals/pull/148) Replace ember-animated with CSS animations ([@pichfl](https://github.com/pichfl))
154
+ * [#148](https://github.com/mainmatter/ember-promise-modals/pull/148) Replace ember-animated with CSS animations ([@pichfl](https://github.com/pichfl))
132
155
 
133
156
  #### :house: Internal
134
- * [#407](https://github.com/simplabs/ember-promise-modals/pull/407) upgrade to ember-qunit v5 ([@nickschot](https://github.com/nickschot))
135
- * [#309](https://github.com/simplabs/ember-promise-modals/pull/309) Update addon layout according to latest ember addon blueprint ([@pichfl](https://github.com/pichfl))
157
+ * [#407](https://github.com/mainmatter/ember-promise-modals/pull/407) upgrade to ember-qunit v5 ([@nickschot](https://github.com/nickschot))
158
+ * [#309](https://github.com/mainmatter/ember-promise-modals/pull/309) Update addon layout according to latest ember addon blueprint ([@pichfl](https://github.com/pichfl))
136
159
 
137
160
  #### Committers: 3
138
161
  - Florian Pichler ([@pichfl](https://github.com/pichfl))
@@ -143,14 +166,14 @@
143
166
  ## v0.2.1 (2020-06-30)
144
167
 
145
168
  #### :rocket: Enhancement
146
- * [#178](https://github.com/simplabs/ember-promise-modals/pull/178) Expose `clickOutsideDeactivates` on the `modals` service ([@Turbo87](https://github.com/Turbo87))
169
+ * [#178](https://github.com/mainmatter/ember-promise-modals/pull/178) Expose `clickOutsideDeactivates` on the `modals` service ([@Turbo87](https://github.com/Turbo87))
147
170
 
148
171
  #### :bug: Bug Fix
149
- * [#181](https://github.com/simplabs/ember-promise-modals/pull/181) service/modals: Reset `.epm-scrolling-disabled` class in the destructor ([@Turbo87](https://github.com/Turbo87))
150
- * [#180](https://github.com/simplabs/ember-promise-modals/pull/180) components/modal: Fix broken destructor ([@Turbo87](https://github.com/Turbo87))
172
+ * [#181](https://github.com/mainmatter/ember-promise-modals/pull/181) service/modals: Reset `.epm-scrolling-disabled` class in the destructor ([@Turbo87](https://github.com/Turbo87))
173
+ * [#180](https://github.com/mainmatter/ember-promise-modals/pull/180) components/modal: Fix broken destructor ([@Turbo87](https://github.com/Turbo87))
151
174
 
152
175
  #### :house: Internal
153
- * [#179](https://github.com/simplabs/ember-promise-modals/pull/179) Add `qunit-console-grouper` dev dependency ([@Turbo87](https://github.com/Turbo87))
176
+ * [#179](https://github.com/mainmatter/ember-promise-modals/pull/179) Add `qunit-console-grouper` dev dependency ([@Turbo87](https://github.com/Turbo87))
154
177
 
155
178
  #### Committers: 1
156
179
  - Tobias Bieniek ([@Turbo87](https://github.com/Turbo87))
@@ -159,18 +182,18 @@
159
182
  ## v0.2.0 (2020-04-22)
160
183
 
161
184
  #### :boom: Breaking Change
162
- * [#142](https://github.com/simplabs/ember-promise-modals/pull/142) Convert `ember-animated` to a peer dependency ([@Turbo87](https://github.com/Turbo87))
163
- * [#139](https://github.com/simplabs/ember-promise-modals/pull/139) Drop Support for Node.js 8 ([@Turbo87](https://github.com/Turbo87))
185
+ * [#142](https://github.com/mainmatter/ember-promise-modals/pull/142) Convert `ember-animated` to a peer dependency ([@Turbo87](https://github.com/Turbo87))
186
+ * [#139](https://github.com/mainmatter/ember-promise-modals/pull/139) Drop Support for Node.js 8 ([@Turbo87](https://github.com/Turbo87))
164
187
 
165
188
  #### :rocket: Enhancement
166
- * [#137](https://github.com/simplabs/ember-promise-modals/pull/137) Add Support for `ember-animated` v0.9 and v0.10 ([@dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
189
+ * [#137](https://github.com/mainmatter/ember-promise-modals/pull/137) Add Support for `ember-animated` v0.9 and v0.10 ([@dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
167
190
 
168
191
  #### :memo: Documentation
169
- * [#80](https://github.com/simplabs/ember-promise-modals/pull/80) Update README ([@ansmonjol](https://github.com/ansmonjol))
192
+ * [#80](https://github.com/mainmatter/ember-promise-modals/pull/80) Update README ([@ansmonjol](https://github.com/ansmonjol))
170
193
 
171
194
  #### :house: Internal
172
- * [#143](https://github.com/simplabs/ember-promise-modals/pull/143) CI: Add scenarios for Ember v3.12 and v3.16 ([@Turbo87](https://github.com/Turbo87))
173
- * [#141](https://github.com/simplabs/ember-promise-modals/pull/141) Use GitHub Actions for CI ([@Turbo87](https://github.com/Turbo87))
195
+ * [#143](https://github.com/mainmatter/ember-promise-modals/pull/143) CI: Add scenarios for Ember v3.12 and v3.16 ([@Turbo87](https://github.com/Turbo87))
196
+ * [#141](https://github.com/mainmatter/ember-promise-modals/pull/141) Use GitHub Actions for CI ([@Turbo87](https://github.com/Turbo87))
174
197
 
175
198
  #### Committers: 2
176
199
  - Alexandre Monjol ([@ansmonjol](https://github.com/ansmonjol))
package/README.md CHANGED
@@ -107,6 +107,24 @@ order to trigger the "close modal" action. It can be called like so:
107
107
  this.args.close(results); // or this.close() in classic components
108
108
  ```
109
109
 
110
+ ### Routable modals using the template helper
111
+
112
+ This addon comes with a `{{open-modal}}` template helper which can be used to trigger modals from any templates. It accepts the similar arguments as the `open` method. It can be used to open a modal in a route, closing it automatically when navigating elsewhere.
113
+
114
+ ```hbs
115
+ {{open-modal 'confirmation-modal' (hash fileUrl=this.fileUrl) close=(fn this.save results)}}
116
+ ```
117
+
118
+ Positional arguments mimick the `open()` method on the service:
119
+
120
+ - `name`: The name of the modal component to render
121
+ - `data`: Pass additional context to the modal,
122
+ - `options`: Pass additional options to the modal
123
+
124
+ Named arguments:
125
+
126
+ - `close` is called asynchronously with the data returned by the modals `@close` action when it is closed
127
+
110
128
  ## Animation
111
129
 
112
130
  This addon uses CSS animations. You can either replace the
@@ -13,6 +13,7 @@ export default Component.extend({
13
13
 
14
14
  tagName: '',
15
15
  outAnimationClass: 'epm-out',
16
+ animatingClass: '',
16
17
 
17
18
  modals: service(),
18
19
 
@@ -20,11 +21,13 @@ export default Component.extend({
20
21
 
21
22
  modalElementId: null,
22
23
  focusTrapOptions: null,
24
+ _animationEnd: null,
23
25
 
24
26
  init() {
25
27
  this._super(...arguments);
26
28
 
27
29
  set(this, 'modalElementId', guidFor(this));
30
+
28
31
  this.modal._componentInstance = this;
29
32
 
30
33
  let { focusTrapOptions: globalFocusTrapOptions } = this.modals;
@@ -38,79 +41,121 @@ export default Component.extend({
38
41
  didInsertElement() {
39
42
  this._super(...arguments);
40
43
 
41
- let element = document.getElementById(this.modalElementId);
44
+ this._addFocusTrap();
45
+ this._addAnimationListeners();
42
46
 
43
- if (this.focusTrapOptions) {
44
- let options = {
45
- ...this.focusTrapOptions,
46
- fallbackFocus: `#${this.modalElementId}`,
47
- onDeactivate: () => {
48
- this.focusTrapOptions.onDeactivate?.();
47
+ // animating in starts when the element is added to the DOM. Inform the service about it.
48
+ this.modals._onModalAnimationStart();
49
+ },
49
50
 
50
- if (this.isDestroyed || this.isDestroying) {
51
- return;
52
- }
51
+ willDestroyElement() {
52
+ this.destroyModal();
53
53
 
54
- this.closeModal();
55
- },
56
- };
54
+ this._super(...arguments);
55
+ },
57
56
 
58
- this.focusTrap = createFocusTrap(element, options);
59
- this.focusTrap.activate();
60
- }
57
+ _getElement() {
58
+ return document.getElementById(this.modalElementId);
59
+ },
61
60
 
62
- this.fadeOutEnd = ({ target, animationName }) => {
63
- this.modals._onModalAnimationEnd();
61
+ _addFocusTrap() {
62
+ let element = this._getElement();
64
63
 
65
- let isntTarget = target !== element;
66
- let animationEndsWrong = animationName.substring(animationName.length - 4) !== '-out';
64
+ if (!this.focusTrapOptions) {
65
+ return;
66
+ }
67
67
 
68
- if (isntTarget || animationEndsWrong) {
69
- return;
70
- }
68
+ let options = {
69
+ ...this.focusTrapOptions,
70
+ fallbackFocus: element,
71
+ onDeactivate: (...args) => {
72
+ this.focusTrapOptions.onDeactivate?.(...args);
73
+
74
+ if (this.isDestroyed || this.isDestroying) {
75
+ return;
76
+ }
71
77
 
72
- this.modal._remove();
78
+ this.closeModal();
79
+ },
73
80
  };
74
81
 
75
- this.modals._onModalAnimationStart();
76
- element.addEventListener('animationend', this.fadeOutEnd);
77
- set(this, 'animatingOutClass', '');
82
+ this.focusTrap = createFocusTrap(element, options);
83
+ this.focusTrap.activate();
78
84
  },
79
85
 
80
- willDestroyElement() {
81
- if (this.focusTrap) {
82
- this.focusTrap.deactivate({ onDeactivate: null });
86
+ _removeFocusTrap(onDeactivate = this.focusTrapOptions?.onDeactivate) {
87
+ if (!this.focusTrap) {
88
+ return;
83
89
  }
84
90
 
85
- if (this.fadeOutEnd) {
86
- let element = document.getElementById(this.modalElementId);
91
+ this.focusTrap.deactivate({ onDeactivate });
92
+ },
93
+
94
+ _addAnimationListeners() {
95
+ this._animationEnd = ({ target, animationName }) => {
96
+ // ignore animations bubbling up
97
+ if (target !== this._getElement()) {
98
+ return;
99
+ }
100
+
101
+ // An animation has ended, inform the modals service
102
+ this.modals._onModalAnimationEnd();
87
103
 
88
- if (element) {
89
- element.removeEventListener('animationend', this.fadeOutEnd);
90
- // make sure that we remove the modal, also resolving the test waiter
104
+ let isOutAnimation = animationName.substring(animationName.length - 4) === '-out';
105
+ if (isOutAnimation) {
91
106
  this.modal._remove();
92
107
  }
108
+ };
109
+
110
+ let element = this._getElement();
111
+ if (element) {
112
+ element.addEventListener('animationend', this._animationEnd);
113
+ }
114
+ },
115
+
116
+ _removeAnimationListeners() {
117
+ if (!this._animationEnd) {
118
+ return;
93
119
  }
94
120
 
95
- this._super(...arguments);
121
+ let element = this._getElement();
122
+ if (element) {
123
+ element.removeEventListener('animationend', this._animationEnd);
124
+ }
125
+
126
+ this._animationEnd = null;
96
127
  },
97
128
 
98
- closeModal(result) {
99
- // Trigger out animation
100
- set(this, 'animatingOutClass', this.outAnimationClass);
129
+ destroyModal() {
130
+ // Remove the focus trap without triggering the optional onDeactivate() hook
131
+ this._removeFocusTrap(null);
132
+
133
+ // Remove the animation listeners
134
+ this._removeAnimationListeners();
101
135
 
102
- if (this.focusTrap) {
103
- this.focusTrap.deactivate({
104
- onDeactivate: this.focusTrapOptions.onDeactivate,
105
- });
136
+ // make sure that we remove the modal, also resolving the test waiter
137
+ this.modal._remove();
138
+ },
139
+
140
+ closeModal(result) {
141
+ if (this.animatingClass !== '') {
142
+ return;
106
143
  }
107
144
 
145
+ this.modals._onModalAnimationStart();
146
+
147
+ // This triggers the out animation, which in turn will remove the modal after it completes
148
+ set(this, 'animatingClass', this.outAnimationClass);
149
+
108
150
  this.modal._resolve(result);
109
151
  },
110
152
 
111
153
  actions: {
112
154
  close(result) {
113
155
  this.closeModal(result);
156
+
157
+ // Remove the focus trap, triggering the onDeactivate() hook
158
+ this._removeFocusTrap();
114
159
  },
115
160
  },
116
161
  });
@@ -0,0 +1,33 @@
1
+ import Helper from '@ember/component/helper';
2
+ import { inject as service } from '@ember/service';
3
+
4
+ export default class OpenModalHelper extends Helper {
5
+ @service modals;
6
+
7
+ modal = null;
8
+
9
+ compute([modalComponent, data, options], { close }) {
10
+ this.showModal(modalComponent, data, options, close);
11
+ }
12
+
13
+ async showModal(modalComponent, data, options, close) {
14
+ this.modal = this.modals.open(modalComponent, data, options);
15
+
16
+ let success = await this.modal;
17
+
18
+ this.modal = null;
19
+
20
+ if (close) {
21
+ close(success);
22
+ }
23
+ }
24
+
25
+ hideModal() {
26
+ this.modal?.close();
27
+ }
28
+
29
+ willDestroy() {
30
+ this.hideModal();
31
+ super.willDestroy(...arguments);
32
+ }
33
+ }
package/addon/modal.js CHANGED
@@ -54,18 +54,28 @@ export default class Modal {
54
54
  return this._deferred.promise.then(onFulfilled, onRejected);
55
55
  }
56
56
 
57
- _resolve(result) {
58
- if (!this._deferredOutAnimation) {
59
- set(this, '_deferredOutAnimation', defer());
60
- if (this._options.onAnimationModalOutEnd) {
61
- this._deferredOutAnimation.promise.then(() => this._options.onAnimationModalOutEnd()).catch(() => {});
62
- }
57
+ _destroy() {
58
+ if (!this._componentInstance) {
59
+ return;
60
+ }
63
61
 
64
- this._result = result;
65
- this._deferred.resolve(result);
62
+ this._componentInstance.destroyModal();
63
+ }
66
64
 
67
- waitForPromise(this._deferredOutAnimation.promise);
65
+ _resolve(result) {
66
+ if (this._deferredOutAnimation) {
67
+ return;
68
68
  }
69
+
70
+ set(this, '_deferredOutAnimation', defer());
71
+ if (this._options.onAnimationModalOutEnd) {
72
+ this._deferredOutAnimation.promise.then(() => this._options.onAnimationModalOutEnd()).catch(() => {});
73
+ }
74
+
75
+ this._result = result;
76
+ this._deferred.resolve(result);
77
+
78
+ waitForPromise(this._deferredOutAnimation.promise);
69
79
  }
70
80
 
71
81
  _remove() {
@@ -1,5 +1,4 @@
1
1
  import { A } from '@ember/array';
2
- import { deprecate } from '@ember/debug';
3
2
  import { computed } from '@ember/object';
4
3
  import { alias } from '@ember/object/computed';
5
4
  import Service from '@ember/service';
@@ -13,37 +12,25 @@ export default Service.extend({
13
12
  top: alias('_stack.lastObject'),
14
13
 
15
14
  focusTrapOptions: undefined,
16
- clickOutsideDeactivates: undefined,
17
15
 
18
16
  init() {
19
17
  this._super(...arguments);
20
18
  this._stack = A([]);
21
19
 
22
- deprecate(
23
- 'Defining `clickOutsideDeactivates` directly on the `modals` service is deprecated. ' +
24
- `Please use \`focusTrapOptions: { clickOutsideDeactivates: ${this.clickOutsideDeactivates} }\` instead.`,
25
- typeof this.clickOutsideDeactivates === 'undefined',
26
- {
27
- id: 'ember-promise-modals.clickOutsideDeactivates-on-modals-service',
28
- since: '2.1.0',
29
- until: '3.0.0',
30
- for: 'ember-promise-modals',
31
- },
32
- );
33
-
34
20
  if (this.focusTrapOptions !== null) {
35
- let focusTrapOptions = this.focusTrapOptions ?? {};
36
- let clickOutsideDeactivates = focusTrapOptions.clickOutsideDeactivates ?? this.clickOutsideDeactivates ?? true;
37
-
38
21
  this.focusTrapOptions = {
39
- ...this.focusTrapOptions,
40
- clickOutsideDeactivates,
22
+ ...(this.focusTrapOptions ?? {}),
23
+ clickOutsideDeactivates: this.focusTrapOptions?.clickOutsideDeactivates ?? true,
41
24
  };
42
25
  }
43
26
  },
44
27
 
45
28
  willDestroy() {
46
29
  this._onLastModalRemoved();
30
+ this._onModalAnimationEnd();
31
+ this._destroyModals();
32
+
33
+ this._super(...arguments);
47
34
  },
48
35
 
49
36
  /**
@@ -64,6 +51,12 @@ export default Service.extend({
64
51
  return modal;
65
52
  },
66
53
 
54
+ _destroyModals() {
55
+ this._stack.forEach(modal => {
56
+ modal._destroy();
57
+ });
58
+ },
59
+
67
60
  _onFirstModalAdded() {
68
61
  document.body.classList.add('epm-scrolling-disabled');
69
62
  },
@@ -17,14 +17,14 @@
17
17
 
18
18
  @media (prefers-reduced-motion: reduce) {
19
19
  :root {
20
- --epm-animation-backdrop-in-duration: 0s;
21
- --epm-animation-backdrop-out-duration: 0s;
22
- --epm-animation-modal-in-duration: 0s;
23
- --epm-animation-modal-out-duration: 0s;
24
- --epm-animation-backdrop-in-delay: 0s;
25
- --epm-animation-backdrop-out-delay: 0s;
26
- --epm-animation-modal-in-delay: 0s;
27
- --epm-animation-modal-out-delay: 0s;
20
+ --epm-animation-backdrop-in-duration: 0.001s;
21
+ --epm-animation-backdrop-out-duration: 0.001s;
22
+ --epm-animation-modal-in-duration: 0.001s;
23
+ --epm-animation-modal-out-duration: 0.001s;
24
+ --epm-animation-backdrop-in-delay: 0.001s;
25
+ --epm-animation-backdrop-out-delay: 0.001s;
26
+ --epm-animation-modal-in-delay: 0.001s;
27
+ --epm-animation-modal-out-delay: 0.001s;
28
28
  }
29
29
  }
30
30
 
@@ -1,5 +1,5 @@
1
1
  {{!-- template-lint-disable no-action --}}
2
- <div id={{this.modalElementId}} class="epm-modal {{this.optionsClassName}} {{this.animatingOutClass}}">
2
+ <div id={{this.modalElementId}} class="epm-modal {{this.optionsClassName}} {{this.animatingClass}}">
3
3
  {{#let (component (ensure-safe-component @modal._name) data=@modal._data close=(action "close")) as |ModalComponent|}}
4
4
  <ModalComponent />
5
5
  {{/let}}