ember-nav-stack 5.0.1 → 6.0.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.
- package/.vscode/settings.json +6 -0
- package/CHANGELOG.md +20 -0
- package/README.md +3 -3
- package/addon/components/nav-stack/component.js +27 -6
- package/addon/components/nav-stack/template.hbs +2 -2
- package/addon/{mixins → routes}/stackable-route.js +23 -18
- package/addon/services/nav-stacks.js +7 -3
- package/addon/utils/animation.js +3 -3
- package/app/templates/stackable.hbs +6 -5
- package/package.json +13 -10
- package/.prettierignore +0 -21
- package/.prettierrc.js +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## v6.0.1 (2023-12-15)
|
|
2
|
+
|
|
3
|
+
#### :bug: Bug Fix
|
|
4
|
+
* [#74](https://github.com/yapplabs/ember-nav-stack/pull/74) Add some more checks to make sure element is not destroyed before accessing it ([@lukemelia](https://github.com/lukemelia))
|
|
5
|
+
* [#73](https://github.com/yapplabs/ember-nav-stack/pull/73) Avoid trying to access this.element when component has been torn down ([@lukemelia](https://github.com/lukemelia))
|
|
6
|
+
|
|
7
|
+
#### Committers: 1
|
|
8
|
+
- Luke Melia ([@lukemelia](https://github.com/lukemelia))
|
|
9
|
+
|
|
10
|
+
## v6.0.0 (2023-12-03)
|
|
11
|
+
|
|
12
|
+
#### :boom: Breaking Change
|
|
13
|
+
* [#71](https://github.com/yapplabs/ember-nav-stack/pull/71) Update to ember 3.28 and address deprecations ([@lukemelia](https://github.com/lukemelia))
|
|
14
|
+
|
|
15
|
+
#### :house: Internal
|
|
16
|
+
* [#71](https://github.com/yapplabs/ember-nav-stack/pull/71) Update to ember 3.28 and address deprecations ([@lukemelia](https://github.com/lukemelia))
|
|
17
|
+
|
|
18
|
+
#### Committers: 1
|
|
19
|
+
- Luke Melia ([@lukemelia](https://github.com/lukemelia))
|
|
20
|
+
|
|
1
21
|
## v5.0.1 (2023-11-30)
|
|
2
22
|
|
|
3
23
|
## v5.0.0 (2023-09-19)
|
package/README.md
CHANGED
|
@@ -7,9 +7,9 @@ This addon's current status is "opensource, but unpolished". It lacks tests, doc
|
|
|
7
7
|
Compatibility
|
|
8
8
|
------------------------------------------------------------------------------
|
|
9
9
|
|
|
10
|
-
* Ember.js v3.
|
|
11
|
-
* Ember CLI
|
|
12
|
-
* Node.js
|
|
10
|
+
* Ember.js v3.24 or above
|
|
11
|
+
* Ember CLI v3.24 or above
|
|
12
|
+
* Node.js v12 or above
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
Installation
|
|
@@ -5,8 +5,6 @@ import { run, scheduleOnce } from '@ember/runloop';
|
|
|
5
5
|
import { nextTick } from 'ember-nav-stack/utils/animation';
|
|
6
6
|
import BackSwipeRecognizer from 'ember-nav-stack/utils/back-swipe-recognizer';
|
|
7
7
|
import Hammer from 'hammerjs';
|
|
8
|
-
// import { argument } from '@ember-decorators/argument';
|
|
9
|
-
// import { Action, optional } from '@ember-decorators/argument/types';
|
|
10
8
|
import { Spring } from 'wobble';
|
|
11
9
|
import { getOwner } from '@ember/application';
|
|
12
10
|
import { DEBUG } from '@glimmer/env';
|
|
@@ -159,10 +157,12 @@ export default class NavStack extends Component {
|
|
|
159
157
|
@action
|
|
160
158
|
tearDownHammer() {
|
|
161
159
|
let { hammer, gesture } = this;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
160
|
+
if (hammer) {
|
|
161
|
+
gesture.unregister(this, hammer.get('pan'));
|
|
162
|
+
hammer.off('pan');
|
|
163
|
+
hammer.destroy();
|
|
164
|
+
this.hammer = null;
|
|
165
|
+
}
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
@action
|
|
@@ -171,6 +171,10 @@ export default class NavStack extends Component {
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
handleStackDepthChange(isInitialRender) {
|
|
174
|
+
if (this.isDestroying || this.isDestroyed) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
174
178
|
let stackItems = this.stackItems || [];
|
|
175
179
|
let stackDepth = stackItems.length;
|
|
176
180
|
let rootComponentRef = stackItems[0] && stackItems[0].component;
|
|
@@ -236,6 +240,10 @@ export default class NavStack extends Component {
|
|
|
236
240
|
}
|
|
237
241
|
|
|
238
242
|
cut() {
|
|
243
|
+
if (this.isDestroying || this.isDestroyed) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
|
|
239
247
|
this.horizontalTransition({
|
|
240
248
|
toValue: this.computeXPosition(),
|
|
241
249
|
animate: false,
|
|
@@ -251,6 +259,9 @@ export default class NavStack extends Component {
|
|
|
251
259
|
}
|
|
252
260
|
|
|
253
261
|
slideForward() {
|
|
262
|
+
if (this.isDestroying || this.isDestroyed) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
254
265
|
this.horizontalTransition({
|
|
255
266
|
toValue: this.computeXPosition(),
|
|
256
267
|
finishCallback: () => {
|
|
@@ -260,6 +271,9 @@ export default class NavStack extends Component {
|
|
|
260
271
|
}
|
|
261
272
|
|
|
262
273
|
slideBack() {
|
|
274
|
+
if (this.isDestroying || this.isDestroyed) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
263
277
|
this.horizontalTransition({
|
|
264
278
|
toValue: this.computeXPosition(),
|
|
265
279
|
finishCallback: () => {
|
|
@@ -270,6 +284,10 @@ export default class NavStack extends Component {
|
|
|
270
284
|
}
|
|
271
285
|
|
|
272
286
|
slideUp() {
|
|
287
|
+
if (this.isDestroying || this.isDestroyed) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
|
|
273
291
|
let debug = this.birdsEyeDebugging;
|
|
274
292
|
this.verticalTransition({
|
|
275
293
|
element: this.element,
|
|
@@ -279,6 +297,9 @@ export default class NavStack extends Component {
|
|
|
279
297
|
}
|
|
280
298
|
|
|
281
299
|
slideDown() {
|
|
300
|
+
if (this.isDestroying || this.isDestroyed) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
282
303
|
let debug = this.birdsEyeDebugging;
|
|
283
304
|
let clonedElement = this.clones.elements[this.clones.elements.length - 1];
|
|
284
305
|
let y = debug ? 480 : clonedElement.getBoundingClientRect().height;
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
<div class="NavStack-header">
|
|
23
23
|
{{#if this.parentItemHeaderComponent}}
|
|
24
24
|
<div class="NavStack-headerContainer NavStack-parentItemHeaderContainer">
|
|
25
|
-
{{component this.parentItemHeaderComponent class="NavStack-headerComponent"}}
|
|
25
|
+
{{component this.parentItemHeaderComponent class="NavStack-headerComponent" back=@back}}
|
|
26
26
|
</div>
|
|
27
27
|
{{/if}}
|
|
28
28
|
<div class="NavStack-headerContainer NavStack-currentHeaderContainer">
|
|
29
|
-
{{component this.headerComponent class="NavStack-headerComponent"}}
|
|
29
|
+
{{component this.headerComponent class="NavStack-headerComponent" back=@back}}
|
|
30
30
|
</div>
|
|
31
31
|
</div>
|
|
32
32
|
{{#if this.hasFooter}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import Route from '@ember/routing/route';
|
|
2
|
+
import { action } from '@ember/object';
|
|
3
|
+
import { inject as service } from '@ember/service';
|
|
4
4
|
|
|
5
5
|
export function getParentRoute(router, route) {
|
|
6
6
|
// eslint-disable-next-line ember/no-private-routing-service
|
|
@@ -17,17 +17,21 @@ export function getParentRoute(router, route) {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export default
|
|
21
|
-
|
|
20
|
+
export default class StackableRoute extends Route {
|
|
21
|
+
@service router;
|
|
22
|
+
templateName = 'stackable';
|
|
23
|
+
|
|
22
24
|
getRouteComponent(/* model */) {
|
|
23
25
|
return `routable-components/${(
|
|
24
26
|
this.routableTemplateName || this.routeName
|
|
25
27
|
).replace(/\./g, '/')}`;
|
|
26
|
-
}
|
|
28
|
+
}
|
|
29
|
+
|
|
27
30
|
getHeaderComponent(model) {
|
|
28
31
|
return `${this.getRouteComponent(model)}/header`;
|
|
29
|
-
}
|
|
30
|
-
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get layerIndex() {
|
|
31
35
|
let parentRoute = getParentRoute(this._router, this);
|
|
32
36
|
let parentRouteLayerIndex = parentRoute.get('layerIndex');
|
|
33
37
|
let currentLayerIndex = parentRouteLayerIndex || 0;
|
|
@@ -35,22 +39,23 @@ export default Mixin.create({
|
|
|
35
39
|
return currentLayerIndex + 1;
|
|
36
40
|
}
|
|
37
41
|
return currentLayerIndex;
|
|
38
|
-
}
|
|
42
|
+
}
|
|
43
|
+
|
|
39
44
|
setupController(controller, model) {
|
|
40
|
-
|
|
45
|
+
super.setupController(controller, model);
|
|
41
46
|
controller.setProperties({
|
|
42
47
|
layerIndex: this.layerIndex,
|
|
43
48
|
routeComponent: this.getRouteComponent(model),
|
|
44
49
|
headerComponent: this.getHeaderComponent(model),
|
|
45
50
|
routeName: this.routeName,
|
|
46
51
|
});
|
|
47
|
-
}
|
|
52
|
+
}
|
|
53
|
+
|
|
48
54
|
getParentRouteName() {
|
|
49
55
|
return getParentRoute(this._router, this).routeName;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@action back() {
|
|
59
|
+
this.router.transitionTo(this.getParentRouteName());
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { A } from '@ember/array';
|
|
2
2
|
import Service from '@ember/service';
|
|
3
|
-
import {
|
|
3
|
+
import { next, scheduleOnce } from '@ember/runloop';
|
|
4
4
|
import EmberObject from '@ember/object';
|
|
5
5
|
import { Promise as EmberPromise } from 'rsvp';
|
|
6
6
|
import { buildWaiter } from '@ember/test-waiters';
|
|
@@ -65,6 +65,10 @@ export default class NavStacks extends Service {
|
|
|
65
65
|
return this._runningTransitions;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
isRunningTransitions() {
|
|
69
|
+
return this._runningTransitions > 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
68
72
|
waitUntilTransitionIdle() {
|
|
69
73
|
if (this._waitingPromise) {
|
|
70
74
|
return this._waitingPromise;
|
|
@@ -89,7 +93,7 @@ export default class NavStacks extends Service {
|
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
_schedule() {
|
|
92
|
-
|
|
96
|
+
scheduleOnce('afterRender', this, this._process);
|
|
93
97
|
}
|
|
94
98
|
|
|
95
99
|
_process() {
|
|
@@ -109,7 +113,7 @@ export default class NavStacks extends Service {
|
|
|
109
113
|
}
|
|
110
114
|
set(this, 'stacks', EmberObject.create(newStacks));
|
|
111
115
|
if (this.isInitialRender === true) {
|
|
112
|
-
|
|
116
|
+
next(this, this._clearIsInitialRender);
|
|
113
117
|
}
|
|
114
118
|
this._listeners.invoke('stackItemsDidChange');
|
|
115
119
|
this.didUpdate();
|
package/addon/utils/animation.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Thanks ember-css-transitions
|
|
2
2
|
// https://github.com/peec/ember-css-transitions/blob/master/addon/mixins/transition-mixin.js
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { later, schedule } from '@ember/runloop';
|
|
5
5
|
import RSVP from 'rsvp';
|
|
6
6
|
import Ember from 'ember';
|
|
7
7
|
|
|
@@ -20,7 +20,7 @@ const TICK = 17;
|
|
|
20
20
|
*/
|
|
21
21
|
function rAF(cb) {
|
|
22
22
|
if (Ember.testing || !window.requestAnimationFrame) {
|
|
23
|
-
return
|
|
23
|
+
return later(cb, TICK);
|
|
24
24
|
} else {
|
|
25
25
|
return window.requestAnimationFrame(cb);
|
|
26
26
|
}
|
|
@@ -33,7 +33,7 @@ function rAF(cb) {
|
|
|
33
33
|
*/
|
|
34
34
|
export function nextTick() {
|
|
35
35
|
return new RSVP.Promise((resolve) => {
|
|
36
|
-
|
|
36
|
+
schedule('afterRender', () => {
|
|
37
37
|
rAF(() => {
|
|
38
38
|
resolve();
|
|
39
39
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<ToNavStack
|
|
2
|
+
@layer={{this.layerIndex}}
|
|
3
|
+
@item={{component this.routeComponent model=this.model controller=this}}
|
|
4
|
+
@header={{component this.headerComponent model=this.model controller=this}}
|
|
5
|
+
/>
|
|
6
|
+
|
|
6
7
|
|
|
7
8
|
{{outlet}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-nav-stack",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "The default blueprint for ember-cli addons.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "ember build --environment=production",
|
|
20
|
-
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel
|
|
20
|
+
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
|
|
21
21
|
"lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix",
|
|
22
|
+
"lint:hbs": "ember-template-lint .",
|
|
22
23
|
"lint:hbs:fix": "ember-template-lint . --fix",
|
|
23
24
|
"lint:js": "eslint . --cache",
|
|
24
25
|
"release": "release-it",
|
|
@@ -44,13 +45,14 @@
|
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@ember/optional-features": "^2.0.0",
|
|
47
|
-
"@ember/test-helpers": "^2.
|
|
48
|
+
"@ember/test-helpers": "^2.6.0",
|
|
48
49
|
"@ember/test-waiters": "^3.0.2",
|
|
50
|
+
"@embroider/test-setup": "^0.48.1",
|
|
49
51
|
"@glimmer/component": "^1.1.2",
|
|
50
52
|
"@glimmer/tracking": "^1.1.2",
|
|
51
53
|
"babel-eslint": "^10.1.0",
|
|
52
54
|
"broccoli-asset-rev": "^3.0.0",
|
|
53
|
-
"ember-cli": "~3.
|
|
55
|
+
"ember-cli": "~3.28.6",
|
|
54
56
|
"ember-cli-dependency-checker": "^3.3.2",
|
|
55
57
|
"ember-cli-deploy": "^2.0.0",
|
|
56
58
|
"ember-cli-deploy-build": "^3.0.0",
|
|
@@ -67,17 +69,18 @@
|
|
|
67
69
|
"ember-page-title": "^8.0.0",
|
|
68
70
|
"ember-qunit": "^5.1.5",
|
|
69
71
|
"ember-resolver": "^11.0.1",
|
|
70
|
-
"ember-
|
|
72
|
+
"ember-set-helper": "^2.0.1",
|
|
71
73
|
"ember-simulant-test-helpers": "^0.3.2",
|
|
72
|
-
"ember-source": "~3.
|
|
74
|
+
"ember-source": "~3.28.8",
|
|
73
75
|
"ember-source-channel-url": "^3.0.0",
|
|
74
|
-
"ember-template-lint": "^5.
|
|
76
|
+
"ember-template-lint": "^5.13.0",
|
|
75
77
|
"ember-try": "^3.0.0",
|
|
76
|
-
"eslint": "^7.
|
|
78
|
+
"eslint": "^7.32.0",
|
|
77
79
|
"eslint-config-prettier": "^9.0.0",
|
|
78
|
-
"eslint-plugin-ember": "^10.
|
|
80
|
+
"eslint-plugin-ember": "^10.5.8",
|
|
79
81
|
"eslint-plugin-node": "^11.1.0",
|
|
80
82
|
"eslint-plugin-prettier": "^5.0.0",
|
|
83
|
+
"eslint-plugin-qunit": "^6.2.0",
|
|
81
84
|
"loader.js": "^4.7.0",
|
|
82
85
|
"npm-run-all": "^4.1.5",
|
|
83
86
|
"prettier": "^3.0.2",
|
|
@@ -88,7 +91,7 @@
|
|
|
88
91
|
"sass": "^1.66.1"
|
|
89
92
|
},
|
|
90
93
|
"engines": {
|
|
91
|
-
"node": ">=
|
|
94
|
+
"node": "12.* || 14.* || >= 16"
|
|
92
95
|
},
|
|
93
96
|
"publishConfig": {
|
|
94
97
|
"registry": "https://registry.npmjs.org"
|
package/.prettierignore
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# unconventional js
|
|
2
|
-
/blueprints/*/files/
|
|
3
|
-
/vendor/
|
|
4
|
-
|
|
5
|
-
# compiled output
|
|
6
|
-
/dist/
|
|
7
|
-
/tmp/
|
|
8
|
-
|
|
9
|
-
# dependencies
|
|
10
|
-
/bower_components/
|
|
11
|
-
/node_modules/
|
|
12
|
-
|
|
13
|
-
# misc
|
|
14
|
-
/coverage/
|
|
15
|
-
!.*
|
|
16
|
-
.eslintcache
|
|
17
|
-
|
|
18
|
-
# ember-try
|
|
19
|
-
/.node_modules.ember-try/
|
|
20
|
-
/bower.json.ember-try
|
|
21
|
-
/package.json.ember-try
|