ember-nav-stack 5.0.0 → 6.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/CHANGELOG.md +13 -0
- package/README.md +3 -3
- package/addon/components/nav-stack/component.js +6 -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,16 @@
|
|
|
1
|
+
## v6.0.0 (2023-12-03)
|
|
2
|
+
|
|
3
|
+
#### :boom: Breaking Change
|
|
4
|
+
* [#71](https://github.com/yapplabs/ember-nav-stack/pull/71) Update to ember 3.28 and address deprecations ([@lukemelia](https://github.com/lukemelia))
|
|
5
|
+
|
|
6
|
+
#### :house: Internal
|
|
7
|
+
* [#71](https://github.com/yapplabs/ember-nav-stack/pull/71) Update to ember 3.28 and address deprecations ([@lukemelia](https://github.com/lukemelia))
|
|
8
|
+
|
|
9
|
+
#### Committers: 1
|
|
10
|
+
- Luke Melia ([@lukemelia](https://github.com/lukemelia))
|
|
11
|
+
|
|
12
|
+
## v5.0.1 (2023-11-30)
|
|
13
|
+
|
|
1
14
|
## v5.0.0 (2023-09-19)
|
|
2
15
|
|
|
3
16
|
#### :rocket: Enhancement
|
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';
|
|
@@ -161,6 +159,8 @@ export default class NavStack extends Component {
|
|
|
161
159
|
let { hammer, gesture } = this;
|
|
162
160
|
gesture.unregister(this, hammer.get('pan'));
|
|
163
161
|
hammer.off('pan');
|
|
162
|
+
hammer.destroy();
|
|
163
|
+
this.hammer = null;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
@action
|
|
@@ -398,7 +398,7 @@ export default class NavStack extends Component {
|
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
disablePanRecognizer() {
|
|
401
|
-
this.hammer
|
|
401
|
+
this.hammer?.get('pan').set({ enable: false });
|
|
402
402
|
}
|
|
403
403
|
|
|
404
404
|
transitionDidBegin() {
|
|
@@ -443,7 +443,7 @@ export default class NavStack extends Component {
|
|
|
443
443
|
this.backX = this.startingX + itemWidth;
|
|
444
444
|
this.thresholdX = itemWidth / 2;
|
|
445
445
|
this.canNavigateBack = this.back && this.stackDepth > 1;
|
|
446
|
-
this.hammer
|
|
446
|
+
this.hammer?.get('pan').set({ enable: true, threshold: 9 });
|
|
447
447
|
}
|
|
448
448
|
|
|
449
449
|
@action
|
|
@@ -628,11 +628,11 @@ export default class NavStack extends Component {
|
|
|
628
628
|
}
|
|
629
629
|
|
|
630
630
|
preferRecognizer(recognizer) {
|
|
631
|
-
this.hammer
|
|
631
|
+
this.hammer?.get('pan').requireFailure(recognizer);
|
|
632
632
|
}
|
|
633
633
|
|
|
634
634
|
stopPreferringRecognizer(recognizer) {
|
|
635
|
-
this.hammer
|
|
635
|
+
this.hammer?.get('pan').dropRequireFailure(recognizer);
|
|
636
636
|
}
|
|
637
637
|
|
|
638
638
|
getTestContainerEl() {
|
|
@@ -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.0",
|
|
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
|