ember-promise-modals 3.0.1 → 4.1.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 +1 -1
- package/CHANGELOG.md +96 -44
- package/DEPRECATIONS.md +91 -0
- package/README.md +35 -25
- package/addon/components/modal.js +88 -43
- package/addon/helpers/open-modal.js +33 -0
- package/addon/modal.js +22 -12
- package/addon/services/modals.js +29 -4
- package/addon/styles/ember-promise-modals.css +8 -8
- package/addon/templates/components/modal.hbs +2 -2
- package/addon-test-support/index.js +33 -18
- package/app/helpers/open-modal.js +1 -0
- package/package.json +35 -32
- package/pnpm-lock.yaml +5558 -6337
package/.release-it.js
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -2,13 +2,65 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## v4.1.0 (2024-02-01)
|
|
8
|
+
|
|
9
|
+
#### :rocket: Enhancement
|
|
10
|
+
* [#894](https://github.com/mainmatter/ember-promise-modals/pull/894) Deprecate opening a modal from string ([@BlueCutOfficial](https://github.com/BlueCutOfficial))
|
|
11
|
+
|
|
12
|
+
#### :memo: Documentation
|
|
13
|
+
* [#908](https://github.com/mainmatter/ember-promise-modals/pull/908) docs(DEPRECATIONS)/ Adjust the line about deprecated node ([@BlueCutOfficial](https://github.com/BlueCutOfficial))
|
|
14
|
+
* [#897](https://github.com/mainmatter/ember-promise-modals/pull/897) Communicate about all the major changes planned for the v2 addon ([@BlueCutOfficial](https://github.com/BlueCutOfficial))
|
|
15
|
+
|
|
16
|
+
#### :house: Internal
|
|
17
|
+
* [#907](https://github.com/mainmatter/ember-promise-modals/pull/907) Internal fix/ re-add node 14 to the list of supported engines ([@BlueCutOfficial](https://github.com/BlueCutOfficial))
|
|
18
|
+
* [#858](https://github.com/mainmatter/ember-promise-modals/pull/858) Fix CI tests for beta/canary channels ([@zeppelin](https://github.com/zeppelin))
|
|
19
|
+
|
|
20
|
+
#### Committers: 3
|
|
21
|
+
- Gabor Babicz ([@zeppelin](https://github.com/zeppelin))
|
|
22
|
+
- Marco Otte-Witte ([@marcoow](https://github.com/marcoow))
|
|
23
|
+
- Marine Dunstetter ([@BlueCutOfficial](https://github.com/BlueCutOfficial))
|
|
24
|
+
|
|
25
|
+
## v4.0.0 (2023-06-01)
|
|
26
|
+
|
|
27
|
+
#### :boom: Breaking Change
|
|
28
|
+
* [#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))
|
|
29
|
+
|
|
30
|
+
#### :rocket: Enhancement
|
|
31
|
+
* [#550](https://github.com/mainmatter/ember-promise-modals/pull/550) Modal template helper ([@pichfl](https://github.com/pichfl))
|
|
32
|
+
|
|
33
|
+
#### :bug: Bug Fix
|
|
34
|
+
* [#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))
|
|
35
|
+
* [#682](https://github.com/mainmatter/ember-promise-modals/pull/682) Improve test helper ([@pichfl](https://github.com/pichfl))
|
|
36
|
+
|
|
37
|
+
#### :house: Internal
|
|
38
|
+
* [#819](https://github.com/mainmatter/ember-promise-modals/pull/819) Update ember-try configuration ([@pichfl](https://github.com/pichfl))
|
|
39
|
+
* [#688](https://github.com/mainmatter/ember-promise-modals/pull/688) Prefer "happy path" code style for `_resolve()` ([@pichfl](https://github.com/pichfl))
|
|
40
|
+
* [#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))
|
|
41
|
+
* [#686](https://github.com/mainmatter/ember-promise-modals/pull/686) Closing the modal should inform the modals service ([@pichfl](https://github.com/pichfl))
|
|
42
|
+
* [#766](https://github.com/mainmatter/ember-promise-modals/pull/766) Replace deprecated release-it-lerna-changelog ([@pichfl](https://github.com/pichfl))
|
|
43
|
+
* [#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))
|
|
44
|
+
* [#763](https://github.com/mainmatter/ember-promise-modals/pull/763) Allow automatic installation of peer dependencies ([@pichfl](https://github.com/pichfl))
|
|
45
|
+
* [#684](https://github.com/mainmatter/ember-promise-modals/pull/684) Move focusTrap setup/teardown to methods ([@pichfl](https://github.com/pichfl))
|
|
46
|
+
* [#683](https://github.com/mainmatter/ember-promise-modals/pull/683) Replace retained element reference with a method ([@pichfl](https://github.com/pichfl))
|
|
47
|
+
* [#598](https://github.com/mainmatter/ember-promise-modals/pull/598) Refactor handling of `focusTrap.onDeactivate` method ([@pichfl](https://github.com/pichfl))
|
|
48
|
+
* [#681](https://github.com/mainmatter/ember-promise-modals/pull/681) remove dependabot configuration ([@nickschot](https://github.com/nickschot))
|
|
49
|
+
|
|
50
|
+
#### Committers: 5
|
|
51
|
+
- Florian Pichler ([@pichfl](https://github.com/pichfl))
|
|
52
|
+
- Gabor Babicz ([@zeppelin](https://github.com/zeppelin))
|
|
53
|
+
- Marcin Wicha ([@marcin-wicha](https://github.com/marcin-wicha))
|
|
54
|
+
- Nick Schot ([@nickschot](https://github.com/nickschot))
|
|
55
|
+
- Sebastian Helbig ([@sebastianhelbig](https://github.com/sebastianhelbig))
|
|
56
|
+
|
|
5
57
|
## v3.0.1 (2022-04-12)
|
|
6
58
|
|
|
7
59
|
#### :bug: Bug Fix
|
|
8
|
-
* [#596](https://github.com/
|
|
60
|
+
* [#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))
|
|
9
61
|
|
|
10
62
|
#### :house: Internal
|
|
11
|
-
* [#597](https://github.com/
|
|
63
|
+
* [#597](https://github.com/mainmatter/ember-promise-modals/pull/597) Remove deprecated `clickOutsideDeactivates` option ([@pichfl](https://github.com/pichfl))
|
|
12
64
|
|
|
13
65
|
#### Committers: 1
|
|
14
66
|
- Florian Pichler ([@pichfl](https://github.com/pichfl))
|
|
@@ -16,26 +68,26 @@
|
|
|
16
68
|
## v3.0.0 (2022-04-11)
|
|
17
69
|
|
|
18
70
|
#### :boom: Breaking Change
|
|
19
|
-
* [#588](https://github.com/
|
|
20
|
-
* [#438](https://github.com/
|
|
21
|
-
* [#437](https://github.com/
|
|
71
|
+
* [#588](https://github.com/mainmatter/ember-promise-modals/pull/588) Use ember-auto-import@2 ([@pichfl](https://github.com/pichfl))
|
|
72
|
+
* [#438](https://github.com/mainmatter/ember-promise-modals/pull/438) bump @ember/test-waiters to 3.0.0 ([@nickschot](https://github.com/nickschot))
|
|
73
|
+
* [#437](https://github.com/mainmatter/ember-promise-modals/pull/437) Drop Node 10 support ([@nickschot](https://github.com/nickschot))
|
|
22
74
|
|
|
23
75
|
#### :rocket: Enhancement
|
|
24
|
-
* [#549](https://github.com/
|
|
25
|
-
* [#533](https://github.com/
|
|
26
|
-
* [#436](https://github.com/
|
|
27
|
-
* [#517](https://github.com/
|
|
76
|
+
* [#549](https://github.com/mainmatter/ember-promise-modals/pull/549) Enhance focus trap configuration ([@zeppelin](https://github.com/zeppelin))
|
|
77
|
+
* [#533](https://github.com/mainmatter/ember-promise-modals/pull/533) Legacy: Downgrade native class to Ember.Object ([@pichfl](https://github.com/pichfl))
|
|
78
|
+
* [#436](https://github.com/mainmatter/ember-promise-modals/pull/436) Embroider optimized compatibility ([@nickschot](https://github.com/nickschot))
|
|
79
|
+
* [#517](https://github.com/mainmatter/ember-promise-modals/pull/517) Add option to disable focus trap ([@zeppelin](https://github.com/zeppelin))
|
|
28
80
|
|
|
29
81
|
#### :memo: Documentation
|
|
30
|
-
* [#502](https://github.com/
|
|
82
|
+
* [#502](https://github.com/mainmatter/ember-promise-modals/pull/502) Provide additional documentation for the Modal class and ModalOptions ([@pichfl](https://github.com/pichfl))
|
|
31
83
|
|
|
32
84
|
#### :house: Internal
|
|
33
|
-
* [#594](https://github.com/
|
|
34
|
-
* [#570](https://github.com/
|
|
35
|
-
* [#477](https://github.com/
|
|
36
|
-
* [#530](https://github.com/
|
|
37
|
-
* [#500](https://github.com/
|
|
38
|
-
* [#499](https://github.com/
|
|
85
|
+
* [#594](https://github.com/mainmatter/ember-promise-modals/pull/594) Configure release-it ([@pichfl](https://github.com/pichfl))
|
|
86
|
+
* [#570](https://github.com/mainmatter/ember-promise-modals/pull/570) Setup Renovatebot ([@nickschot](https://github.com/nickschot))
|
|
87
|
+
* [#477](https://github.com/mainmatter/ember-promise-modals/pull/477) Replace Yarn with pnpm ([@pichfl](https://github.com/pichfl))
|
|
88
|
+
* [#530](https://github.com/mainmatter/ember-promise-modals/pull/530) Internal: Extend and apply prettier configuration ([@pichfl](https://github.com/pichfl))
|
|
89
|
+
* [#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))
|
|
90
|
+
* [#499](https://github.com/mainmatter/ember-promise-modals/pull/499) Update ember-release scenario to use auto-import v2 ([@nickschot](https://github.com/nickschot))
|
|
39
91
|
|
|
40
92
|
#### Committers: 3
|
|
41
93
|
- Florian Pichler ([@pichfl](https://github.com/pichfl))
|
|
@@ -45,19 +97,19 @@
|
|
|
45
97
|
## v2.0.0 (2021-09-01)
|
|
46
98
|
|
|
47
99
|
#### :boom: Breaking Change
|
|
48
|
-
* [#427](https://github.com/
|
|
100
|
+
* [#427](https://github.com/mainmatter/ember-promise-modals/pull/427) Generate one backdrop per modal ([@aoumiri](https://github.com/aoumiri))
|
|
49
101
|
|
|
50
102
|
#### :rocket: Enhancement
|
|
51
|
-
* [#427](https://github.com/
|
|
103
|
+
* [#427](https://github.com/mainmatter/ember-promise-modals/pull/427) Generate one backdrop per modal ([@aoumiri](https://github.com/aoumiri))
|
|
52
104
|
|
|
53
105
|
#### :memo: Documentation
|
|
54
|
-
* [#432](https://github.com/
|
|
55
|
-
* [#414](https://github.com/
|
|
106
|
+
* [#432](https://github.com/mainmatter/ember-promise-modals/pull/432) Fix responsiveness of dummy app ([@nickschot](https://github.com/nickschot))
|
|
107
|
+
* [#414](https://github.com/mainmatter/ember-promise-modals/pull/414) Improve README and dummy application ([@pichfl](https://github.com/pichfl))
|
|
56
108
|
|
|
57
109
|
#### :house: Internal
|
|
58
|
-
* [#431](https://github.com/
|
|
59
|
-
* [#430](https://github.com/
|
|
60
|
-
* [#415](https://github.com/
|
|
110
|
+
* [#431](https://github.com/mainmatter/ember-promise-modals/pull/431) Use env=production when building the dummy application ([@pichfl](https://github.com/pichfl))
|
|
111
|
+
* [#430](https://github.com/mainmatter/ember-promise-modals/pull/430) Update production build path for GitHub pages ([@pichfl](https://github.com/pichfl))
|
|
112
|
+
* [#415](https://github.com/mainmatter/ember-promise-modals/pull/415) Deploy dummy application to Github pages ([@pichfl](https://github.com/pichfl))
|
|
61
113
|
|
|
62
114
|
#### Committers: 4
|
|
63
115
|
- Anass OUMIRI ([@aoumiri](https://github.com/aoumiri))
|
|
@@ -69,7 +121,7 @@
|
|
|
69
121
|
## v1.1.1 (2021-07-27)
|
|
70
122
|
|
|
71
123
|
#### :bug: Bug Fix
|
|
72
|
-
* [#422](https://github.com/
|
|
124
|
+
* [#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))
|
|
73
125
|
|
|
74
126
|
#### Committers: 1
|
|
75
127
|
- Nick Schot ([@nickschot](https://github.com/nickschot))
|
|
@@ -78,10 +130,10 @@
|
|
|
78
130
|
## v1.1.0 (2021-07-27)
|
|
79
131
|
|
|
80
132
|
#### :rocket: Enhancement
|
|
81
|
-
* [#421](https://github.com/
|
|
133
|
+
* [#421](https://github.com/mainmatter/ember-promise-modals/pull/421) add optional onAnimationModalOutEnd hook ([@nickschot](https://github.com/nickschot))
|
|
82
134
|
|
|
83
135
|
#### :bug: Bug Fix
|
|
84
|
-
* [#420](https://github.com/
|
|
136
|
+
* [#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))
|
|
85
137
|
|
|
86
138
|
#### Committers: 1
|
|
87
139
|
- Nick Schot ([@nickschot](https://github.com/nickschot))
|
|
@@ -90,10 +142,10 @@
|
|
|
90
142
|
## v1.0.2 (2021-07-26)
|
|
91
143
|
|
|
92
144
|
#### :bug: Bug Fix
|
|
93
|
-
* [#419](https://github.com/
|
|
145
|
+
* [#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))
|
|
94
146
|
|
|
95
147
|
#### :house: Internal
|
|
96
|
-
* [#417](https://github.com/
|
|
148
|
+
* [#417](https://github.com/mainmatter/ember-promise-modals/pull/417) Delete unused modal service file from dummy app ([@nickschot](https://github.com/nickschot))
|
|
97
149
|
|
|
98
150
|
#### Committers: 1
|
|
99
151
|
- Nick Schot ([@nickschot](https://github.com/nickschot))
|
|
@@ -102,10 +154,10 @@
|
|
|
102
154
|
## v1.0.1 (2021-07-16)
|
|
103
155
|
|
|
104
156
|
#### :bug: Bug Fix
|
|
105
|
-
* [#412](https://github.com/
|
|
157
|
+
* [#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))
|
|
106
158
|
|
|
107
159
|
#### :house: Internal
|
|
108
|
-
* [#413](https://github.com/
|
|
160
|
+
* [#413](https://github.com/mainmatter/ember-promise-modals/pull/413) use babel-eslint as eslint parser ([@nickschot](https://github.com/nickschot))
|
|
109
161
|
|
|
110
162
|
#### Committers: 2
|
|
111
163
|
- Nick Schot ([@nickschot](https://github.com/nickschot))
|
|
@@ -115,14 +167,14 @@
|
|
|
115
167
|
## v1.0.0 (2021-07-13)
|
|
116
168
|
|
|
117
169
|
#### :boom: Breaking Change
|
|
118
|
-
* [#148](https://github.com/
|
|
170
|
+
* [#148](https://github.com/mainmatter/ember-promise-modals/pull/148) Replace ember-animated with CSS animations ([@pichfl](https://github.com/pichfl))
|
|
119
171
|
|
|
120
172
|
#### :rocket: Enhancement
|
|
121
|
-
* [#148](https://github.com/
|
|
173
|
+
* [#148](https://github.com/mainmatter/ember-promise-modals/pull/148) Replace ember-animated with CSS animations ([@pichfl](https://github.com/pichfl))
|
|
122
174
|
|
|
123
175
|
#### :house: Internal
|
|
124
|
-
* [#407](https://github.com/
|
|
125
|
-
* [#309](https://github.com/
|
|
176
|
+
* [#407](https://github.com/mainmatter/ember-promise-modals/pull/407) upgrade to ember-qunit v5 ([@nickschot](https://github.com/nickschot))
|
|
177
|
+
* [#309](https://github.com/mainmatter/ember-promise-modals/pull/309) Update addon layout according to latest ember addon blueprint ([@pichfl](https://github.com/pichfl))
|
|
126
178
|
|
|
127
179
|
#### Committers: 3
|
|
128
180
|
- Florian Pichler ([@pichfl](https://github.com/pichfl))
|
|
@@ -133,14 +185,14 @@
|
|
|
133
185
|
## v0.2.1 (2020-06-30)
|
|
134
186
|
|
|
135
187
|
#### :rocket: Enhancement
|
|
136
|
-
* [#178](https://github.com/
|
|
188
|
+
* [#178](https://github.com/mainmatter/ember-promise-modals/pull/178) Expose `clickOutsideDeactivates` on the `modals` service ([@Turbo87](https://github.com/Turbo87))
|
|
137
189
|
|
|
138
190
|
#### :bug: Bug Fix
|
|
139
|
-
* [#181](https://github.com/
|
|
140
|
-
* [#180](https://github.com/
|
|
191
|
+
* [#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))
|
|
192
|
+
* [#180](https://github.com/mainmatter/ember-promise-modals/pull/180) components/modal: Fix broken destructor ([@Turbo87](https://github.com/Turbo87))
|
|
141
193
|
|
|
142
194
|
#### :house: Internal
|
|
143
|
-
* [#179](https://github.com/
|
|
195
|
+
* [#179](https://github.com/mainmatter/ember-promise-modals/pull/179) Add `qunit-console-grouper` dev dependency ([@Turbo87](https://github.com/Turbo87))
|
|
144
196
|
|
|
145
197
|
#### Committers: 1
|
|
146
198
|
- Tobias Bieniek ([@Turbo87](https://github.com/Turbo87))
|
|
@@ -149,18 +201,18 @@
|
|
|
149
201
|
## v0.2.0 (2020-04-22)
|
|
150
202
|
|
|
151
203
|
#### :boom: Breaking Change
|
|
152
|
-
* [#142](https://github.com/
|
|
153
|
-
* [#139](https://github.com/
|
|
204
|
+
* [#142](https://github.com/mainmatter/ember-promise-modals/pull/142) Convert `ember-animated` to a peer dependency ([@Turbo87](https://github.com/Turbo87))
|
|
205
|
+
* [#139](https://github.com/mainmatter/ember-promise-modals/pull/139) Drop Support for Node.js 8 ([@Turbo87](https://github.com/Turbo87))
|
|
154
206
|
|
|
155
207
|
#### :rocket: Enhancement
|
|
156
|
-
* [#137](https://github.com/
|
|
208
|
+
* [#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))
|
|
157
209
|
|
|
158
210
|
#### :memo: Documentation
|
|
159
|
-
* [#80](https://github.com/
|
|
211
|
+
* [#80](https://github.com/mainmatter/ember-promise-modals/pull/80) Update README ([@ansmonjol](https://github.com/ansmonjol))
|
|
160
212
|
|
|
161
213
|
#### :house: Internal
|
|
162
|
-
* [#143](https://github.com/
|
|
163
|
-
* [#141](https://github.com/
|
|
214
|
+
* [#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))
|
|
215
|
+
* [#141](https://github.com/mainmatter/ember-promise-modals/pull/141) Use GitHub Actions for CI ([@Turbo87](https://github.com/Turbo87))
|
|
164
216
|
|
|
165
217
|
#### Committers: 2
|
|
166
218
|
- Alexandre Monjol ([@ansmonjol](https://github.com/ansmonjol))
|
package/DEPRECATIONS.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Deprecations
|
|
2
|
+
|
|
3
|
+
ember-promise-modals 5.0.0 will be a [v2 addon](https://github.com/embroider-build/embroider/blob/main/README.md#for-addon-authors) compatible with Embroider ecosystem. This document describes what functionalities will no longer exist in the coming major release.
|
|
4
|
+
|
|
5
|
+
## ember-promise-modals.modals-from-string
|
|
6
|
+
|
|
7
|
+
_Added in 4.1.0, functionality to be removed in 5.0.0_
|
|
8
|
+
|
|
9
|
+
The new Embroider build system prefers static imports when dynamically invoking components. To resolve this deprecation, you need to replace the path to the modal component with an imported component class:
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
// before
|
|
13
|
+
export class ApplicationController extends Controller {
|
|
14
|
+
@service modals;
|
|
15
|
+
|
|
16
|
+
@action
|
|
17
|
+
async show() {
|
|
18
|
+
await this.modals.open('my-modal');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// after
|
|
23
|
+
import MyModal from 'my-app/components/my-modal';
|
|
24
|
+
|
|
25
|
+
export class ApplicationController extends Controller {
|
|
26
|
+
@service modals;
|
|
27
|
+
|
|
28
|
+
@action
|
|
29
|
+
async show() {
|
|
30
|
+
await this.modals.open(MyModal);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
> Caution: old-style components that have their template in `app/templates/components` instead of co-located next to their Javascript in `app/components` can't work correctly when discovered via their component class, because there's no way to locate the template. They should either port to being co-located (which is a simple mechanical transformation and highly recommended) or should import their own template and set it as layout as was traditional in addons before co-location was available.
|
|
36
|
+
|
|
37
|
+
-- [Replacing Component Helper.md](https://github.com/embroider-build/embroider/blob/main/docs/replacing-component-helper.md#when-youre-invoking-a-component-youve-been-given)
|
|
38
|
+
|
|
39
|
+
## PostCSS process
|
|
40
|
+
|
|
41
|
+
Currently, the addon's CSS is run through PostCSS by default, which will create static
|
|
42
|
+
fallbacks for all custom properties using their defaults. It also provides the option `excludeCSS` so you can import the uncompiled addon styles in your project's `app/styles/app.css` and run your own PostCSS using `postcss-import`:
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
// before
|
|
46
|
+
let app = new EmberApp(defaults, {
|
|
47
|
+
'ember-promise-modals': {
|
|
48
|
+
excludeCSS: true,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return maybeEmbroider(app);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This functionality no longer stands in Embroider world because [v2 addons are static](https://github.com/embroider-build/embroider/blob/HEAD/docs/spec.md). When installed in your app, they don't do anything at build-time.
|
|
56
|
+
|
|
57
|
+
As most browsers have been supporting CSS variables for several years, the v2 addon will no longer process the CSS and the components will import the non-processed styles. However, if you still need the static fallbacks `postcss-preset-env` used to generate, you can re-implement the functionality on the app side with a [Webpack config](https://webpack.js.org/loaders/postcss-loader/). For instance:
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
let app = new EmberApp(defaults, {});
|
|
61
|
+
|
|
62
|
+
return maybeEmbroider(app, {
|
|
63
|
+
packagerOptions: {
|
|
64
|
+
webpackConfig: {
|
|
65
|
+
module: {
|
|
66
|
+
rules: [
|
|
67
|
+
{
|
|
68
|
+
test: /\.css$/i,
|
|
69
|
+
use: [
|
|
70
|
+
{
|
|
71
|
+
loader: 'postcss-loader',
|
|
72
|
+
options: {
|
|
73
|
+
postcssOptions: {
|
|
74
|
+
plugins: [['postcss-preset-env', { stage: 3 }]],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Ember < 3.28 & node < 16 support
|
|
88
|
+
|
|
89
|
+
The v2 addon will no longer support Ember versions lower than 3.28.
|
|
90
|
+
|
|
91
|
+
Additionally, it will have dependencies such as `ember-cli-babel@8.2.0` that require node 16, so node 12 and node 14 will be removed from the supported engines.
|
package/README.md
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
The better way to handle modals in your Ember.js apps.
|
|
6
6
|
|
|
7
|
+
> [!NOTE]
|
|
8
|
+
> ember-promise-modals was written and is maintained by [Mainmatter](https://mainmatter.com) and contributors.
|
|
9
|
+
> We offer consulting, training, and team augmentation for Ember.js – check out our [website](https://mainmatter.com/ember-consulting/) to learn more!
|
|
10
|
+
|
|
7
11
|
## Compatibility
|
|
8
12
|
|
|
9
13
|
- Ember.js v3.4 or above
|
|
@@ -24,17 +28,18 @@ To use EPM in your project, add the target for the modals to your `application.h
|
|
|
24
28
|
<EpmModalContainer />
|
|
25
29
|
```
|
|
26
30
|
|
|
27
|
-
Then you can
|
|
31
|
+
Then you can inject the `modals` [service](https://guides.emberjs.com/release/services/#toc_accessing-services) wherever you need and call its `open` method with a component class to render it as a modal.
|
|
28
32
|
|
|
29
33
|
```js
|
|
30
34
|
import { inject as service } from '@ember/service';
|
|
35
|
+
import ConfirmationModal from 'my-app/components/confirmation-modal';
|
|
31
36
|
|
|
32
37
|
export default class extends Component {
|
|
33
38
|
@service modals;
|
|
34
39
|
|
|
35
40
|
@action
|
|
36
41
|
async handleOpenModal() {
|
|
37
|
-
let modal = this.modals.open(
|
|
42
|
+
let modal = this.modals.open(ConfirmationModal);
|
|
38
43
|
|
|
39
44
|
// the instance acts as a promise that resolves with anything passed to the @close function
|
|
40
45
|
modal.then(results => {
|
|
@@ -56,28 +61,12 @@ export default class extends Component {
|
|
|
56
61
|
</button>
|
|
57
62
|
```
|
|
58
63
|
|
|
59
|
-
### Embroider Optimized Apps
|
|
60
|
-
|
|
61
|
-
If your application uses [Embroider](https://github.com/embroider-build/embroider), you need to pass the component class to the `open` method instead of just the modals name. This will become the default behavior in the future.
|
|
62
|
-
|
|
63
|
-
```js
|
|
64
|
-
import ConfirmationModal from '../components/confirmation-modal';
|
|
65
|
-
|
|
66
|
-
export default class extends Component {
|
|
67
|
-
//...
|
|
68
|
-
@action
|
|
69
|
-
handleOpenModal() {
|
|
70
|
-
this.modals.open(ConfirmationModal);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
```
|
|
74
|
-
|
|
75
64
|
### Passing data to the rendered component
|
|
76
65
|
|
|
77
66
|
You can pass custom data into your rendered template like so:
|
|
78
67
|
|
|
79
68
|
```js
|
|
80
|
-
this.modals.open(
|
|
69
|
+
this.modals.open(FilePreviewModal, {
|
|
81
70
|
fileUrl: this.fileUrl,
|
|
82
71
|
});
|
|
83
72
|
```
|
|
@@ -107,6 +96,24 @@ order to trigger the "close modal" action. It can be called like so:
|
|
|
107
96
|
this.args.close(results); // or this.close() in classic components
|
|
108
97
|
```
|
|
109
98
|
|
|
99
|
+
### Routable modals using the template helper
|
|
100
|
+
|
|
101
|
+
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.
|
|
102
|
+
|
|
103
|
+
```hbs
|
|
104
|
+
{{open-modal this.ConfirmationModalComponent (hash fileUrl=this.fileUrl) close=(fn this.save results)}}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Positional arguments mimick the `open()` method on the service:
|
|
108
|
+
|
|
109
|
+
- `componentClass`: An imported component class of the modal to render
|
|
110
|
+
- `data`: Pass additional context to the modal,
|
|
111
|
+
- `options`: Pass additional options to the modal
|
|
112
|
+
|
|
113
|
+
Named arguments:
|
|
114
|
+
|
|
115
|
+
- `close` is called asynchronously with the data returned by the modals `@close` action when it is closed
|
|
116
|
+
|
|
110
117
|
## Animation
|
|
111
118
|
|
|
112
119
|
This addon uses CSS animations. You can either replace the
|
|
@@ -126,7 +133,7 @@ a custom `className` can be handed to the `.open()` method.
|
|
|
126
133
|
|
|
127
134
|
```js
|
|
128
135
|
this.modals.open(
|
|
129
|
-
|
|
136
|
+
FilePreviwModal,
|
|
130
137
|
{
|
|
131
138
|
fileUrl: this.fileUrl,
|
|
132
139
|
},
|
|
@@ -183,16 +190,18 @@ The CSS animations which are applied by the custom CSS class _must_ end in
|
|
|
183
190
|
|
|
184
191
|
#### Examples
|
|
185
192
|
|
|
186
|
-
Examples for custom animations and how to apply them can be found in the
|
|
193
|
+
Examples for custom animations and how to apply them can be found in the addon's
|
|
187
194
|
dummy application.
|
|
188
195
|
|
|
189
196
|
See [the application.js controller](./tests/dummy/app/controllers/application.js)
|
|
190
|
-
for how the modals are
|
|
197
|
+
for how the modals are opened in your JavaScript actions and look at
|
|
191
198
|
[app.css](./tests/dummy/app/styles/app.css) for the style definition of these
|
|
192
199
|
custom animations.
|
|
193
200
|
|
|
194
201
|
### CSS Variables
|
|
195
202
|
|
|
203
|
+
⚠️ This functionality will be removed in 5.0.0, checkout the [DEPRECATIONS.md]('https://github.com/mainmatter/ember-promise-modals/blob/main/DEPRECATIONS.md#postcss-process) guide.
|
|
204
|
+
|
|
196
205
|
The addons CSS is run through PostCSS by default, which will create static
|
|
197
206
|
fallbacks for all custom properties using their defaults.
|
|
198
207
|
|
|
@@ -248,7 +257,7 @@ Example for local Focus Trap option, when opening a specific modal:
|
|
|
248
257
|
|
|
249
258
|
```js
|
|
250
259
|
this.modals.open(
|
|
251
|
-
|
|
260
|
+
FilePreviewModal,
|
|
252
261
|
{ fileUrl: this.fileUrl },
|
|
253
262
|
{
|
|
254
263
|
focusTrapOptions: {
|
|
@@ -273,7 +282,7 @@ Or when opening a modal:
|
|
|
273
282
|
|
|
274
283
|
```js
|
|
275
284
|
this.modals.open(
|
|
276
|
-
|
|
285
|
+
FilePreviewModal,
|
|
277
286
|
{ fileUrl: this.fileUrl },
|
|
278
287
|
{
|
|
279
288
|
focusTrapOptions: null,
|
|
@@ -308,4 +317,5 @@ See the [Contributing](CONTRIBUTING.md) guide for details.
|
|
|
308
317
|
|
|
309
318
|
## License
|
|
310
319
|
|
|
311
|
-
|
|
320
|
+
ember-promise-modals is developed by and © Mainmatter GmbH and contributors. It
|
|
321
|
+
is released under the [MIT License](LICENSE.md).
|