ember-nav-stack 6.1.1 → 7.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.
Files changed (74) hide show
  1. package/README.md +165 -21
  2. package/addon-main.cjs +4 -0
  3. package/dist/_app_/components/nav-stack.js +1 -0
  4. package/dist/_app_/components/to-nav-stack.js +1 -0
  5. package/dist/_app_/helpers/nav-layer-indices.js +1 -0
  6. package/dist/_app_/modifiers/back-swipe.js +1 -0
  7. package/dist/_app_/services/gesture.js +1 -0
  8. package/dist/_app_/services/nav-stacks.js +1 -0
  9. package/dist/_app_/templates/stackable.js +1 -0
  10. package/dist/back-swipe-gesture.js +261 -0
  11. package/dist/back-swipe-gesture.js.map +1 -0
  12. package/dist/components/nav-stack.js +627 -0
  13. package/dist/components/nav-stack.js.map +1 -0
  14. package/dist/components/to-nav-stack.js +22 -0
  15. package/dist/components/to-nav-stack.js.map +1 -0
  16. package/dist/helpers/nav-layer-indices.js +21 -0
  17. package/dist/helpers/nav-layer-indices.js.map +1 -0
  18. package/dist/index.js +7 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/modifiers/back-swipe.js +40 -0
  21. package/dist/modifiers/back-swipe.js.map +1 -0
  22. package/dist/routes/stackable-route.js +99 -0
  23. package/dist/routes/stackable-route.js.map +1 -0
  24. package/{addon → dist}/services/gesture.js +7 -9
  25. package/dist/services/gesture.js.map +1 -0
  26. package/dist/services/nav-stacks.js +137 -0
  27. package/dist/services/nav-stacks.js.map +1 -0
  28. package/dist/styles/nav-stack.css +399 -0
  29. package/dist/templates/stackable.js +8 -0
  30. package/dist/templates/stackable.js.map +1 -0
  31. package/{addon-test-support → dist/test-support}/in-viewport.js +7 -10
  32. package/dist/test-support/in-viewport.js.map +1 -0
  33. package/dist/test-support/index.js +2 -0
  34. package/dist/test-support/index.js.map +1 -0
  35. package/{addon → dist}/utils/animation.js +17 -40
  36. package/dist/utils/animation.js.map +1 -0
  37. package/{addon → dist}/utils/back-swipe-recognizer.js +29 -49
  38. package/dist/utils/back-swipe-recognizer.js.map +1 -0
  39. package/dist/utils/clone-store.js +88 -0
  40. package/dist/utils/clone-store.js.map +1 -0
  41. package/dist/utils/component.js +107 -0
  42. package/dist/utils/component.js.map +1 -0
  43. package/dist/utils/header-style.js +46 -0
  44. package/dist/utils/header-style.js.map +1 -0
  45. package/dist/utils/transition-decision.js +71 -0
  46. package/dist/utils/transition-decision.js.map +1 -0
  47. package/dist/utils/waiter-state.js +130 -0
  48. package/dist/utils/waiter-state.js.map +1 -0
  49. package/package.json +78 -91
  50. package/CHANGELOG.md +0 -200
  51. package/MODULE_REPORT.md +0 -27
  52. package/RELEASE.md +0 -54
  53. package/addon/components/nav-stack/component.js +0 -683
  54. package/addon/components/nav-stack/template.hbs +0 -37
  55. package/addon/components/to-nav-stack.js +0 -32
  56. package/addon/helpers/nav-layer-indices.js +0 -29
  57. package/addon/routes/stackable-route.js +0 -61
  58. package/addon/services/nav-stacks.js +0 -157
  59. package/addon/utils/component.js +0 -40
  60. package/app/components/nav-stack/component.js +0 -1
  61. package/app/components/nav-stack/template.js +0 -1
  62. package/app/components/to-nav-stack.js +0 -1
  63. package/app/helpers/nav-layer-indices.js +0 -1
  64. package/app/services/gesture.js +0 -1
  65. package/app/services/nav-stacks.js +0 -1
  66. package/app/styles/nav-stack.scss +0 -117
  67. package/app/templates/stackable.hbs +0 -8
  68. package/app/utils/animation.js +0 -1
  69. package/config/deploy.js +0 -29
  70. package/config/environment.js +0 -5
  71. package/config/release.js +0 -21
  72. package/index.js +0 -15
  73. package/tsconfig.json +0 -6
  74. package/vendor/wobble-shim.js +0 -3
@@ -1,683 +0,0 @@
1
- /* eslint-disable ember/no-observers */
2
- import Component from '@glimmer/component';
3
- import { action, get } from '@ember/object';
4
- import { run, scheduleOnce } from '@ember/runloop';
5
- import { nextTick } from 'ember-nav-stack/utils/animation';
6
- import BackSwipeRecognizer from 'ember-nav-stack/utils/back-swipe-recognizer';
7
- import Hammer from 'hammerjs';
8
- import { Spring } from 'wobble';
9
- import { getOwner } from '@ember/application';
10
- import { DEBUG } from '@glimmer/env';
11
- import { setTransform } from 'ember-nav-stack/utils/animation';
12
- import { inject as service } from '@ember/service';
13
- import { bool, mapBy, reads } from 'macro-decorators';
14
- import { guidFor } from '@ember/object/internals';
15
- import { extractComponentKey } from 'ember-nav-stack/utils/component';
16
-
17
- function currentTransitionPercentage(fromValue, toValue, currentValue) {
18
- if (fromValue === undefined || fromValue === toValue) {
19
- return 1;
20
- }
21
- let percentage = Math.abs((currentValue - fromValue) / (toValue - fromValue));
22
- if (toValue > fromValue) {
23
- return 1 - percentage;
24
- }
25
- return percentage;
26
- }
27
-
28
- function styleHeaderElements(
29
- transitionRatio,
30
- isForward,
31
- currentHeaderElement,
32
- otherHeaderElement,
33
- ) {
34
- let startingOffset = 60;
35
- if (!isForward) {
36
- transitionRatio = 1 - transitionRatio;
37
- startingOffset = -1 * startingOffset;
38
- }
39
- let xOffset = transitionRatio * -1 * startingOffset;
40
- if (currentHeaderElement) {
41
- currentHeaderElement.style.opacity = transitionRatio;
42
- setTransform(
43
- currentHeaderElement,
44
- `translateX(${startingOffset + xOffset}px)`,
45
- );
46
- }
47
- if (otherHeaderElement) {
48
- otherHeaderElement.style.opacity = 1 - transitionRatio;
49
- setTransform(otherHeaderElement, `translateX(${xOffset}px)`);
50
- }
51
- }
52
-
53
- export default class NavStack extends Component {
54
- // @argument('number')
55
- // layer;
56
-
57
- // @argument('any') // ComponentRef
58
- // footer;
59
-
60
- // @argument(Action)
61
- // back;
62
-
63
- // @argument(optional('boolean'))
64
- get birdsEyeDebugging() {
65
- return this.args.birdsEyeDebugging || false;
66
- }
67
-
68
- element;
69
-
70
- get elementId() {
71
- return guidFor(this);
72
- }
73
-
74
- get layer() {
75
- return this.args.layer;
76
- }
77
-
78
- @service('nav-stacks') navStacksService;
79
- @service gesture;
80
-
81
- constructor() {
82
- super(...arguments);
83
- this.navStacksService.register(this);
84
- }
85
-
86
- willDestroy() {
87
- super.willDestroy(...arguments);
88
- this.navStacksService.unregister(this);
89
- }
90
-
91
- get layerIndexCssClass() {
92
- return `NavStack--layer${this.args.layer}`;
93
- }
94
-
95
- get headerComponent() {
96
- if (this.stackItems.length === 0) {
97
- return null;
98
- }
99
- return this.stackItems[this.stackItems.length - 1].headerComponent;
100
- }
101
-
102
- get parentItemHeaderComponent() {
103
- if (this.stackItems.length < 2) {
104
- return null;
105
- }
106
- return this.stackItems[this.stackItems.length - 2].headerComponent;
107
- }
108
-
109
- get stackItems() {
110
- return get(this.navStacksService, `stacks.layer${this.args.layer}`) || [];
111
- }
112
-
113
- @reads('stackItems.length') stackDepth;
114
-
115
- @mapBy('stackItems', 'component') components;
116
-
117
- @bool('args.footer') hasFooter;
118
-
119
- get suppressAnimation() {
120
- if (this._suppressAnimation === undefined) {
121
- const config = getOwner(this).resolveRegistration('config:environment');
122
- // eslint-disable-next-line ember/no-side-effects
123
- this._suppressAnimation =
124
- config['ember-nav-stack'] &&
125
- config['ember-nav-stack'].suppressAnimation;
126
- }
127
- return this._suppressAnimation;
128
- }
129
-
130
- clones = {
131
- stackItems: [],
132
- headers: [],
133
- elements: [],
134
- };
135
-
136
- @action
137
- setupHammer(el) {
138
- this.element = el;
139
- this.hammer = new Hammer.Manager(this.element, {
140
- inputClass: Hammer.TouchMouseInput,
141
- recognizers: [[BackSwipeRecognizer]],
142
- });
143
- let isInitialRender = this.navStacksService.isInitialRender;
144
- scheduleOnce(
145
- 'afterRender',
146
- this,
147
- this.handleStackDepthChange,
148
- isInitialRender,
149
- );
150
- this._setupPanHandlerContext();
151
-
152
- let { hammer, gesture } = this;
153
- hammer.on('pan', this.handlePanEvent);
154
- gesture.register(this, hammer.get('pan'));
155
- }
156
-
157
- @action
158
- tearDownHammer() {
159
- let { hammer, gesture } = this;
160
- if (hammer) {
161
- gesture.unregister(this, hammer.get('pan'));
162
- hammer.off('pan');
163
- hammer.destroy();
164
- this.hammer = null;
165
- }
166
- }
167
-
168
- @action
169
- stackItemsDidChange() {
170
- this.handleStackDepthChange(false);
171
- }
172
-
173
- handleStackDepthChange(isInitialRender) {
174
- if (this.isDestroying || this.isDestroyed) {
175
- return;
176
- }
177
-
178
- let stackItems = this.stackItems || [];
179
- let stackDepth = stackItems.length;
180
- let rootComponentRef = stackItems[0] && stackItems[0].component;
181
- let rootComponentKey = this.args.extractComponentKey
182
- ? this.args.extractComponentKey(rootComponentRef)
183
- : extractComponentKey(rootComponentRef);
184
-
185
- let layer = this.args.layer;
186
- if (isInitialRender) {
187
- this.schedule(this.cut);
188
- } else if (
189
- (layer > 0 && stackDepth > 0 && this._stackDepth === 0) ||
190
- this._stackDepth === undefined
191
- ) {
192
- this.schedule(this.slideUp);
193
- } else if (layer > 0 && stackDepth === 0 && this._stackDepth > 0) {
194
- this.cloneElement();
195
- this.element.style.display = 'none';
196
- this.schedule(this.slideDown);
197
- } else if (rootComponentKey !== this._rootComponentKey) {
198
- this.schedule(this.cut);
199
- } else if (stackDepth < this._stackDepth) {
200
- this.cloneLastStackItem();
201
- this.cloneHeader();
202
- this.schedule(this.slideBack);
203
- } else if (stackDepth > this._stackDepth) {
204
- this.cloneHeader();
205
- this.schedule(this.slideForward);
206
- }
207
-
208
- this._stackDepth = stackDepth;
209
- this._rootComponentKey = rootComponentKey;
210
- }
211
-
212
- schedule(method) {
213
- scheduleOnce('afterRender', this, method);
214
- }
215
-
216
- computeXPosition() {
217
- let stackDepth = this.stackDepth;
218
- if (stackDepth === 0) {
219
- return 0;
220
- }
221
- let currentStackItemElement = this.element.querySelector(
222
- '.NavStack-item:last-child',
223
- );
224
- if (!currentStackItemElement) {
225
- return 0;
226
- }
227
- let itemWidth = currentStackItemElement.getBoundingClientRect().width;
228
-
229
- let layerX = (stackDepth - 1) * itemWidth * -1;
230
- return layerX;
231
- }
232
-
233
- @action
234
- repositionX() {
235
- let itemContainerElement = this.element.querySelector(
236
- '.NavStack-itemContainer',
237
- );
238
- let newX = this.computeXPosition();
239
- setTransform(itemContainerElement, `translateX(${newX}px)`);
240
- }
241
-
242
- cut() {
243
- if (this.isDestroying || this.isDestroyed) {
244
- return;
245
- }
246
-
247
- this.horizontalTransition({
248
- toValue: this.computeXPosition(),
249
- animate: false,
250
- });
251
-
252
- if ((this.args.layer > 0) & (this.stackDepth > 0)) {
253
- this.verticalTransition({
254
- element: this.element,
255
- toValue: 0,
256
- animate: false,
257
- });
258
- }
259
- }
260
-
261
- slideForward() {
262
- if (this.isDestroying || this.isDestroyed) {
263
- return;
264
- }
265
- this.horizontalTransition({
266
- toValue: this.computeXPosition(),
267
- finishCallback: () => {
268
- this.removeClonedHeader();
269
- },
270
- });
271
- }
272
-
273
- slideBack() {
274
- if (this.isDestroying || this.isDestroyed) {
275
- return;
276
- }
277
- this.horizontalTransition({
278
- toValue: this.computeXPosition(),
279
- finishCallback: () => {
280
- this.removeClonedStackItem();
281
- this.removeClonedHeader();
282
- },
283
- });
284
- }
285
-
286
- slideUp() {
287
- if (this.isDestroying || this.isDestroyed) {
288
- return;
289
- }
290
-
291
- let debug = this.birdsEyeDebugging;
292
- this.verticalTransition({
293
- element: this.element,
294
- toValue: 0,
295
- fromValue: debug ? 480 : this.element.getBoundingClientRect().height,
296
- });
297
- }
298
-
299
- slideDown() {
300
- if (this.isDestroying || this.isDestroyed) {
301
- return;
302
- }
303
- let debug = this.birdsEyeDebugging;
304
- let clonedElement = this.clones.elements[this.clones.elements.length - 1];
305
- let y = debug ? 480 : clonedElement.getBoundingClientRect().height;
306
- nextTick().then(() => {
307
- this.verticalTransition({
308
- element: clonedElement,
309
- toValue: y,
310
- finishCallback: () => {
311
- this.removeClonedElement();
312
- },
313
- });
314
- });
315
- }
316
-
317
- horizontalTransition({
318
- toValue,
319
- fromValue,
320
- animate = !this.suppressAnimation,
321
- finishCallback,
322
- }) {
323
- let itemContainerElement = this.element.querySelector(
324
- '.NavStack-itemContainer',
325
- );
326
- let currentHeaderElement = this.element.querySelector(
327
- '.NavStack-currentHeaderContainer',
328
- );
329
- let clonedHeaderElement = this.element.querySelector(
330
- '.NavStack-clonedHeaderContainer',
331
- );
332
-
333
- this.transitionDidBegin();
334
- this.notifyTransitionStart();
335
- let finish = () => {
336
- setTransform(itemContainerElement, `translateX(${toValue}px)`);
337
- styleHeaderElements(
338
- currentTransitionPercentage(fromValue, toValue, toValue),
339
- fromValue === undefined || fromValue > toValue,
340
- currentHeaderElement,
341
- clonedHeaderElement,
342
- );
343
- this.notifyTransitionEnd();
344
- this.transitionDidEnd();
345
- if (finishCallback) {
346
- finishCallback();
347
- }
348
- };
349
- if (animate) {
350
- fromValue = fromValue || this.getX(itemContainerElement);
351
- if (fromValue === toValue) {
352
- run(finish);
353
- return;
354
- }
355
- let spring = this._createSpring({ fromValue, toValue });
356
- spring
357
- .onUpdate((s) => {
358
- setTransform(itemContainerElement, `translateX(${s.currentValue}px)`);
359
- styleHeaderElements(
360
- currentTransitionPercentage(fromValue, toValue, s.currentValue),
361
- fromValue > toValue,
362
- currentHeaderElement,
363
- clonedHeaderElement,
364
- );
365
- })
366
- .onStop(() => {
367
- run(finish);
368
- })
369
- .start();
370
- return;
371
- }
372
- run(finish);
373
- }
374
-
375
- verticalTransition({
376
- element,
377
- toValue,
378
- fromValue,
379
- animate = !this.suppressAnimation,
380
- finishCallback,
381
- }) {
382
- this.transitionDidBegin();
383
- this.notifyTransitionStart();
384
- let finish = () => {
385
- setTransform(element, `translateY(${toValue}px)`);
386
- this.notifyTransitionEnd();
387
- this.transitionDidEnd();
388
- if (finishCallback) {
389
- finishCallback();
390
- }
391
- };
392
- if (animate) {
393
- fromValue = fromValue || element.getBoundingClientRect().top;
394
- if (fromValue === toValue) {
395
- run(finish);
396
- return;
397
- }
398
- let spring = this._createSpring({ fromValue, toValue });
399
- spring
400
- .onUpdate((s) => {
401
- setTransform(element, `translateY(${s.currentValue}px)`);
402
- })
403
- .onStop(() => {
404
- run(finish);
405
- })
406
- .start();
407
- return;
408
- }
409
- run(finish);
410
- }
411
-
412
- _createSpring({ initialVelocity = 0, fromValue, toValue }) {
413
- return new Spring({
414
- initialVelocity,
415
- fromValue,
416
- toValue,
417
- stiffness: 1000,
418
- damping: 500,
419
- mass: 3,
420
- });
421
- }
422
-
423
- disablePanRecognizer() {
424
- this.hammer?.get('pan').set({ enable: false });
425
- }
426
-
427
- transitionDidBegin() {
428
- this.disablePanRecognizer();
429
- }
430
-
431
- transitionDidEnd() {
432
- if (this._currentStackItemElement) {
433
- this.disablePanRecognizer();
434
- }
435
- if (!this.element || this.stackDepth <= 1) {
436
- return;
437
- }
438
- this._setupPanHandlerContext();
439
- }
440
-
441
- notifyTransitionStart() {
442
- this.navStacksService.notifyTransitionStart();
443
- }
444
-
445
- notifyTransitionEnd() {
446
- this.navStacksService.notifyTransitionEnd();
447
- }
448
-
449
- _setupPanHandlerContext() {
450
- this.containerElement = this.element.querySelector(
451
- '.NavStack-itemContainer',
452
- );
453
- this.currentHeaderElement = this.element.querySelector(
454
- '.NavStack-currentHeaderContainer',
455
- );
456
- this.parentHeaderElement = this.element.querySelector(
457
- '.NavStack-parentItemHeaderContainer',
458
- );
459
- this.startingX = this.getX(this.containerElement);
460
- let currentStackItemElement = (this._currentStackItemElement =
461
- this.element.querySelector('.NavStack-item:last-child'));
462
- if (!currentStackItemElement) {
463
- return;
464
- }
465
- let itemWidth = currentStackItemElement.getBoundingClientRect().width;
466
- this.backX = this.startingX + itemWidth;
467
- this.thresholdX = itemWidth / 2;
468
- this.canNavigateBack = this.back && this.stackDepth > 1;
469
- this.hammer?.get('pan').set({ enable: true, threshold: 9 });
470
- }
471
-
472
- @action
473
- handlePanEvent(ev) {
474
- if (this._activeSpring) {
475
- return;
476
- }
477
- setTransform(
478
- this.containerElement,
479
- `translateX(${this.startingX + ev.deltaX}px)`,
480
- );
481
- styleHeaderElements(
482
- currentTransitionPercentage(
483
- this.startingX,
484
- this.backX,
485
- this.startingX + ev.deltaX,
486
- ),
487
- true,
488
- this.currentHeaderElement,
489
- this.parentHeaderElement,
490
- );
491
-
492
- let transitionRatio = currentTransitionPercentage(
493
- this.startingX,
494
- this.backX,
495
- this.startingX + ev.deltaX,
496
- );
497
- if (this.currentHeaderElement) {
498
- this.currentHeaderElement.style.opacity = transitionRatio;
499
- }
500
- if (this.parentHeaderElement) {
501
- this.parentHeaderElement.style.opacity = 1 - transitionRatio;
502
- }
503
- if (ev.isFinal) {
504
- this.handlePanEnd(ev);
505
- }
506
- }
507
-
508
- handlePanEnd(ev) {
509
- let shouldNavigateBack =
510
- this.adjustX(ev.center.x) >= this.thresholdX && this.canNavigateBack;
511
- let initialVelocity = ev.velocityX;
512
- let fromValue = this.startingX + ev.deltaX;
513
- let toValue = shouldNavigateBack ? this.backX : this.startingX;
514
- this.navStacksService.notifyTransitionStart();
515
- let finalize = () => {
516
- if (shouldNavigateBack) {
517
- styleHeaderElements(
518
- currentTransitionPercentage(this.startingX, this.backX, this.backX),
519
- false,
520
- this.parentHeaderElement,
521
- this.currentHeaderElement,
522
- );
523
- } else {
524
- setTransform(this.containerElement, `translateX(${this.startingX}px)`);
525
- styleHeaderElements(
526
- currentTransitionPercentage(
527
- this.startingX,
528
- this.backX,
529
- this.startingX,
530
- ),
531
- false,
532
- this.parentHeaderElement,
533
- this.currentHeaderElement,
534
- );
535
- }
536
- if (this.currentHeaderElement) {
537
- this.currentHeaderElement.style.opacity = 1;
538
- setTransform(this.currentHeaderElement, 'translateX(0px)');
539
- }
540
- if (this.parentHeaderElement) {
541
- this.parentHeaderElement.style.opacity = 0;
542
- setTransform(this.parentHeaderElement, 'translateX(-60px)');
543
- }
544
- this.navStacksService.notifyTransitionEnd();
545
- this._activeSpring = null;
546
- if (shouldNavigateBack) {
547
- run(this.args, this.args.back);
548
- }
549
- };
550
- if (fromValue === toValue && initialVelocity === 0) {
551
- finalize();
552
- return;
553
- }
554
- let spring = this._createSpring({ initialVelocity, fromValue, toValue });
555
- this._activeSpring = spring;
556
- spring
557
- .onUpdate((s) => {
558
- setTransform(this.containerElement, `translateX(${s.currentValue}px)`);
559
- styleHeaderElements(
560
- currentTransitionPercentage(
561
- this.startingX,
562
- this.backX,
563
- s.currentValue,
564
- ),
565
- false,
566
- this.parentHeaderElement,
567
- this.currentHeaderElement,
568
- );
569
- if (
570
- !shouldNavigateBack &&
571
- s.currentValue >= this.startingX + this.thresholdX
572
- ) {
573
- shouldNavigateBack = true;
574
- spring.updateConfig({
575
- toValue: this.backX,
576
- });
577
- }
578
- })
579
- .onStop(() => {
580
- finalize();
581
- })
582
- .start();
583
- }
584
-
585
- cloneLastStackItem() {
586
- let clone = this.element
587
- .querySelector('.NavStack-item:last-child')
588
- .cloneNode(true);
589
- this.clones.stackItems.push(clone);
590
- clone.setAttribute('id', `${this.elementId}_clonedStackItem`);
591
- this.attachClonedStackItem(clone);
592
- }
593
-
594
- cloneHeader() {
595
- this.removeClonedHeader();
596
- let liveHeader = this.element.querySelector(
597
- '.NavStack-currentHeaderContainer',
598
- );
599
- if (!liveHeader) {
600
- return;
601
- }
602
- let clonedHeader = liveHeader.cloneNode(true);
603
- this.clones.headers.push(clonedHeader);
604
- clonedHeader.classList.remove('NavStack-currentHeaderContainer');
605
- clonedHeader.classList.add('NavStack-clonedHeaderContainer');
606
- this.attachClonedHeader(clonedHeader);
607
- }
608
-
609
- cloneElement() {
610
- let clone = this.element.cloneNode(true);
611
- this.clones.elements.push(clone);
612
- clone.setAttribute('id', `${this.elementId}_clone`);
613
- this.attachClonedElement(clone);
614
- }
615
-
616
- attachClonedStackItem(clone) {
617
- this.element.querySelector('.NavStack-itemContainer').appendChild(clone);
618
- }
619
-
620
- attachClonedHeader(clone) {
621
- let headerWrapper = this.element.querySelector('.NavStack-header');
622
- headerWrapper.insertBefore(clone, headerWrapper.firstChild);
623
- }
624
-
625
- attachClonedElement(clone) {
626
- this.element.parentNode.appendChild(clone);
627
- clone.style.transform; // force layout, without this CSS transition does not run
628
- clone.style.webkitTransform; // force layout, without this CSS transition does not run
629
- }
630
-
631
- removeClonedHeader() {
632
- var clonedHeader;
633
- while ((clonedHeader = this.clones.headers.pop())) {
634
- //eslint-disable-line no-cond-assign
635
- clonedHeader.parentNode.removeChild(clonedHeader);
636
- }
637
- }
638
-
639
- removeClonedStackItem() {
640
- var clonedStackItem;
641
- while ((clonedStackItem = this.clones.stackItems.pop())) {
642
- //eslint-disable-line no-cond-assign
643
- clonedStackItem.parentNode.removeChild(clonedStackItem);
644
- }
645
- }
646
-
647
- removeClonedElement() {
648
- var clonedElement;
649
- while ((clonedElement = this.clones.elements.pop())) {
650
- //eslint-disable-line no-cond-assign
651
- clonedElement.parentNode.removeChild(clonedElement);
652
- }
653
- }
654
-
655
- preferRecognizer(recognizer) {
656
- this.hammer?.get('pan').requireFailure(recognizer);
657
- }
658
-
659
- stopPreferringRecognizer(recognizer) {
660
- this.hammer?.get('pan').dropRequireFailure(recognizer);
661
- }
662
-
663
- getTestContainerEl() {
664
- if (this._testContainerEl === undefined) {
665
- this._testContainerEl = document.querySelector('#ember-testing') || false;
666
- }
667
- return this._testContainerEl;
668
- }
669
-
670
- getX(element) {
671
- return this.adjustX(element.getBoundingClientRect().left);
672
- }
673
-
674
- adjustX(x) {
675
- if (DEBUG) {
676
- let testContainerEl = this.getTestContainerEl();
677
- if (testContainerEl) {
678
- return x - testContainerEl.getBoundingClientRect().left;
679
- }
680
- }
681
- return x;
682
- }
683
- }
@@ -1,37 +0,0 @@
1
- <div
2
- id={{this.elementId}}
3
- class={{concat
4
- 'NavStack '
5
- (if this.birdsEyeDebugging 'is-birdsEyeDebugging ')
6
- this.layerIndexCssClass ' '
7
- (if this.hasFooter 'NavStack--withFooter ')
8
- }}
9
- {{did-insert this.setupHammer}}
10
- {{will-destroy this.tearDownHammer}}
11
- ...attributes
12
- >
13
- <div class="NavStack-itemContainer">
14
- {{#each this.components as |stackItemComponent index|}}
15
- <div class={{concat 'NavStack-item NavStack-item-' index}}>
16
- {{#if (lte (sub this.stackDepth index) 2)}}
17
- {{component stackItemComponent}}
18
- {{/if}}
19
- </div>
20
- {{/each}}
21
- </div>
22
- <div class="NavStack-header">
23
- {{#if this.parentItemHeaderComponent}}
24
- <div class="NavStack-headerContainer NavStack-parentItemHeaderContainer">
25
- {{component this.parentItemHeaderComponent class="NavStack-headerComponent" back=@back}}
26
- </div>
27
- {{/if}}
28
- <div class="NavStack-headerContainer NavStack-currentHeaderContainer">
29
- {{component this.headerComponent class="NavStack-headerComponent" back=@back}}
30
- </div>
31
- </div>
32
- {{#if this.hasFooter}}
33
- <div class="NavStack-footer">
34
- {{component @footer}}
35
- </div>
36
- {{/if}}
37
- </div>