@ionic/core 7.4.3-dev.11696264821.1755dd6a → 7.4.3-dev.11696355648.1f181be0

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 (115) hide show
  1. package/components/animation.js +1 -60
  2. package/components/ion-menu.js +19 -51
  3. package/components/ion-segment.js +35 -23
  4. package/dist/cjs/{animation-c8bdd3c7.js → animation-2bb33618.js} +1 -60
  5. package/dist/cjs/{index-e50a18ba.js → index-5121bb90.js} +1 -1
  6. package/dist/cjs/{index-c388851f.js → index-b183138a.js} +2 -2
  7. package/dist/cjs/index.cjs.js +5 -5
  8. package/dist/cjs/ion-action-sheet.cjs.entry.js +1 -1
  9. package/dist/cjs/ion-alert.cjs.entry.js +1 -1
  10. package/dist/cjs/ion-app_8.cjs.entry.js +1 -1
  11. package/dist/cjs/ion-datetime_3.cjs.entry.js +1 -1
  12. package/dist/cjs/ion-loading.cjs.entry.js +1 -1
  13. package/dist/cjs/ion-menu_3.cjs.entry.js +21 -53
  14. package/dist/cjs/ion-modal.cjs.entry.js +2 -2
  15. package/dist/cjs/ion-nav_2.cjs.entry.js +1 -1
  16. package/dist/cjs/ion-popover.cjs.entry.js +2 -2
  17. package/dist/cjs/ion-refresher_2.cjs.entry.js +1 -1
  18. package/dist/cjs/ion-segment_2.cjs.entry.js +35 -24
  19. package/dist/cjs/ion-toast.cjs.entry.js +1 -1
  20. package/dist/cjs/{ios.transition-fd592869.js → ios.transition-4b93903d.js} +2 -2
  21. package/dist/cjs/{md.transition-a6040d41.js → md.transition-79f3a215.js} +2 -2
  22. package/dist/collection/components/menu/menu.js +19 -51
  23. package/dist/collection/components/segment/segment.js +35 -23
  24. package/dist/collection/components/segment/test/scrollable/segment.e2e.js +55 -1
  25. package/dist/collection/utils/animation/animation.js +1 -60
  26. package/dist/docs.json +1 -1
  27. package/dist/esm/{animation-92066c62.js → animation-a1d9e088.js} +1 -60
  28. package/dist/esm/{index-9b1940b1.js → index-61bddc90.js} +1 -1
  29. package/dist/esm/{index-ca26aea8.js → index-87684bba.js} +2 -2
  30. package/dist/esm/index.js +5 -5
  31. package/dist/esm/ion-action-sheet.entry.js +1 -1
  32. package/dist/esm/ion-alert.entry.js +1 -1
  33. package/dist/esm/ion-app_8.entry.js +1 -1
  34. package/dist/esm/ion-datetime_3.entry.js +1 -1
  35. package/dist/esm/ion-loading.entry.js +1 -1
  36. package/dist/esm/ion-menu_3.entry.js +21 -53
  37. package/dist/esm/ion-modal.entry.js +2 -2
  38. package/dist/esm/ion-nav_2.entry.js +1 -1
  39. package/dist/esm/ion-popover.entry.js +2 -2
  40. package/dist/esm/ion-refresher_2.entry.js +1 -1
  41. package/dist/esm/ion-segment_2.entry.js +35 -24
  42. package/dist/esm/ion-toast.entry.js +1 -1
  43. package/dist/esm/{ios.transition-d4be3bd5.js → ios.transition-81e1aed6.js} +2 -2
  44. package/dist/esm/{md.transition-ae47f354.js → md.transition-5becd8b5.js} +2 -2
  45. package/dist/esm-es5/animation-a1d9e088.js +4 -0
  46. package/dist/esm-es5/{index-9b1940b1.js → index-61bddc90.js} +1 -1
  47. package/dist/esm-es5/{index-ca26aea8.js → index-87684bba.js} +1 -1
  48. package/dist/esm-es5/index.js +1 -1
  49. package/dist/esm-es5/ion-action-sheet.entry.js +1 -1
  50. package/dist/esm-es5/ion-alert.entry.js +1 -1
  51. package/dist/esm-es5/ion-app_8.entry.js +1 -1
  52. package/dist/esm-es5/ion-datetime_3.entry.js +1 -1
  53. package/dist/esm-es5/ion-loading.entry.js +1 -1
  54. package/dist/esm-es5/ion-menu_3.entry.js +1 -1
  55. package/dist/esm-es5/ion-modal.entry.js +1 -1
  56. package/dist/esm-es5/ion-nav_2.entry.js +1 -1
  57. package/dist/esm-es5/ion-popover.entry.js +1 -1
  58. package/dist/esm-es5/ion-refresher_2.entry.js +1 -1
  59. package/dist/esm-es5/ion-segment_2.entry.js +1 -1
  60. package/dist/esm-es5/ion-toast.entry.js +1 -1
  61. package/dist/esm-es5/{ios.transition-d4be3bd5.js → ios.transition-81e1aed6.js} +1 -1
  62. package/dist/esm-es5/{md.transition-ae47f354.js → md.transition-5becd8b5.js} +1 -1
  63. package/dist/ionic/index.esm.js +1 -1
  64. package/dist/ionic/ionic.esm.js +1 -1
  65. package/dist/ionic/{p-17f69cbc.system.entry.js → p-048d7153.system.entry.js} +1 -1
  66. package/dist/ionic/{p-eac9308b.system.entry.js → p-08c5b9f4.system.entry.js} +1 -1
  67. package/dist/ionic/{p-9f758520.entry.js → p-13a91505.entry.js} +1 -1
  68. package/dist/ionic/p-155dfdda.entry.js +4 -0
  69. package/dist/ionic/{p-4d2c9270.system.entry.js → p-1a36bf45.system.entry.js} +1 -1
  70. package/dist/ionic/{p-b0c3f506.entry.js → p-27614d55.entry.js} +1 -1
  71. package/dist/ionic/{p-2624b777.system.entry.js → p-37456282.system.entry.js} +1 -1
  72. package/dist/ionic/p-40e16caa.system.entry.js +4 -0
  73. package/dist/ionic/{p-0505bc05.system.entry.js → p-4616f20a.system.entry.js} +1 -1
  74. package/dist/ionic/{p-f70372cf.js → p-5e2dc8e0.js} +1 -1
  75. package/dist/ionic/{p-9eea70fb.system.entry.js → p-65a4c12f.system.entry.js} +1 -1
  76. package/dist/ionic/p-6b2641f6.system.js +4 -0
  77. package/dist/ionic/{p-dcdc16e8.system.entry.js → p-6bc9c436.system.entry.js} +1 -1
  78. package/dist/ionic/p-6edbc09b.system.js +1 -1
  79. package/dist/ionic/p-72a1cbc7.js +4 -0
  80. package/dist/ionic/{p-f2bc4fc0.system.js → p-73f50e29.system.js} +1 -1
  81. package/dist/ionic/p-78a293a5.js +4 -0
  82. package/dist/ionic/{p-5c9f38bf.entry.js → p-7e46b6ab.entry.js} +1 -1
  83. package/dist/ionic/{p-0fb0904b.system.js → p-8fdd4a2f.system.js} +1 -1
  84. package/dist/ionic/{p-24ebc805.entry.js → p-90d892fd.entry.js} +1 -1
  85. package/dist/ionic/{p-51163f34.system.js → p-918d5f19.system.js} +1 -1
  86. package/dist/ionic/p-94a4ce40.js +4 -0
  87. package/dist/ionic/{p-06a68207.system.entry.js → p-a6d8476b.system.entry.js} +1 -1
  88. package/dist/ionic/{p-003dbb0e.entry.js → p-a720dc73.entry.js} +1 -1
  89. package/dist/ionic/{p-2a13187a.system.js → p-b098f738.system.js} +1 -1
  90. package/dist/ionic/p-b95fd3c6.entry.js +4 -0
  91. package/dist/ionic/{p-d4f02009.entry.js → p-bf9b1560.entry.js} +1 -1
  92. package/dist/ionic/{p-26a785e9.system.entry.js → p-c5729044.system.entry.js} +1 -1
  93. package/dist/ionic/{p-d6e93d49.entry.js → p-c7fca267.entry.js} +1 -1
  94. package/dist/ionic/{p-c6221536.system.js → p-d4cea1ba.system.js} +1 -1
  95. package/dist/ionic/{p-40ffdeb5.system.entry.js → p-de676d36.system.entry.js} +1 -1
  96. package/dist/ionic/{p-a42bbc51.entry.js → p-ee6d9730.entry.js} +1 -1
  97. package/dist/ionic/p-f1a71e75.system.entry.js +4 -0
  98. package/dist/ionic/{p-b1a04d35.entry.js → p-f547e62f.entry.js} +1 -1
  99. package/dist/ionic/{p-4df178d7.entry.js → p-f920f5ca.entry.js} +1 -1
  100. package/dist/ionic/p-f978ccd1.js +4 -0
  101. package/dist/types/components/menu/menu.d.ts +1 -8
  102. package/dist/types/components/segment/segment.d.ts +1 -0
  103. package/hydrate/index.js +54 -134
  104. package/package.json +1 -1
  105. package/dist/collection/components/menu/test/disable/menu.e2e.js +0 -55
  106. package/dist/esm-es5/animation-92066c62.js +0 -4
  107. package/dist/ionic/p-015187e5.system.js +0 -4
  108. package/dist/ionic/p-0a39673e.js +0 -4
  109. package/dist/ionic/p-12b13ed4.entry.js +0 -4
  110. package/dist/ionic/p-1a6c0442.js +0 -4
  111. package/dist/ionic/p-37a0b769.js +0 -4
  112. package/dist/ionic/p-446230d7.js +0 -4
  113. package/dist/ionic/p-55b99166.entry.js +0 -4
  114. package/dist/ionic/p-b5637aeb.system.entry.js +0 -4
  115. package/dist/ionic/p-bff7659e.system.entry.js +0 -4
@@ -6,10 +6,10 @@
6
6
  Object.defineProperty(exports, '__esModule', { value: true });
7
7
 
8
8
  const index = require('./index-6f887430.js');
9
+ const helpers = require('./helpers-ea4ccbcb.js');
9
10
  const dir = require('./dir-f1e0ca26.js');
10
11
  const theme = require('./theme-fbc56b3b.js');
11
12
  const ionicGlobal = require('./ionic-global-14a0604b.js');
12
- const helpers = require('./helpers-ea4ccbcb.js');
13
13
 
14
14
  const segmentIosCss = ":host{--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:grid;grid-auto-columns:1fr;position:relative;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:center;justify-content:center;width:100%;background:var(--background);font-family:var(--ion-font-family, inherit);text-align:center;contain:paint;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host(.segment-scrollable){-ms-flex-pack:start;justify-content:start;width:auto;overflow-x:auto;grid-auto-columns:minmax(-webkit-min-content, 1fr);grid-auto-columns:minmax(min-content, 1fr)}:host(.segment-scrollable::-webkit-scrollbar){display:none}:host{--background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.065);border-radius:8px;overflow:hidden;z-index:0}:host(.ion-color){background:rgba(var(--ion-color-base-rgb), 0.065)}:host(.in-toolbar){-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0;width:auto}:host(.in-toolbar:not(.ion-color)){background:var(--ion-toolbar-segment-background, var(--background))}:host(.in-toolbar-color:not(.ion-color)){background:rgba(var(--ion-color-contrast-rgb), 0.11)}";
15
15
 
@@ -89,29 +89,7 @@ const Segment = class {
89
89
  * Used by `ion-segment-button` to determine if the button should be checked.
90
90
  */
91
91
  this.ionSelect.emit({ value });
92
- if (this.scrollable) {
93
- const buttons = this.getButtons();
94
- const activeButton = buttons.find((button) => button.value === value);
95
- if (activeButton !== undefined) {
96
- /**
97
- * Scrollable segment buttons should be
98
- * centered within the view including
99
- * buttons that are partially offscreen.
100
- */
101
- activeButton.scrollIntoView({
102
- behavior: 'smooth',
103
- inline: 'center',
104
- /**
105
- * Segment should scroll on the
106
- * horizontal axis. `block: 'nearest'`
107
- * ensures that the vertical axis
108
- * does not scroll if the segment
109
- * as a whole is already in view.
110
- */
111
- block: 'nearest',
112
- });
113
- }
114
- }
92
+ this.scrollActiveButtonIntoView();
115
93
  }
116
94
  disabledChanged() {
117
95
  this.gestureChanged();
@@ -133,6 +111,13 @@ const Segment = class {
133
111
  }
134
112
  async componentDidLoad() {
135
113
  this.setCheckedClasses();
114
+ /**
115
+ * We need to wait for the buttons to all be rendered
116
+ * before we can scroll.
117
+ */
118
+ helpers.raf(() => {
119
+ this.scrollActiveButtonIntoView();
120
+ });
136
121
  this.gesture = (await Promise.resolve().then(function () { return require('./index-0ee995e4.js'); })).createGesture({
137
122
  el: this.el,
138
123
  gestureName: 'segment',
@@ -261,6 +246,32 @@ const Segment = class {
261
246
  buttons[next].classList.add('segment-button-after-checked');
262
247
  }
263
248
  }
249
+ scrollActiveButtonIntoView() {
250
+ const { scrollable, value } = this;
251
+ if (scrollable) {
252
+ const buttons = this.getButtons();
253
+ const activeButton = buttons.find((button) => button.value === value);
254
+ if (activeButton !== undefined) {
255
+ /**
256
+ * Scrollable segment buttons should be
257
+ * centered within the view including
258
+ * buttons that are partially offscreen.
259
+ */
260
+ activeButton.scrollIntoView({
261
+ behavior: 'smooth',
262
+ inline: 'center',
263
+ /**
264
+ * Segment should scroll on the
265
+ * horizontal axis. `block: 'nearest'`
266
+ * ensures that the vertical axis
267
+ * does not scroll if the segment
268
+ * as a whole is already in view.
269
+ */
270
+ block: 'nearest',
271
+ });
272
+ }
273
+ }
274
+ }
264
275
  setNextIndex(detail, isEnd = false) {
265
276
  const rtl = dir.isRTL(this.el);
266
277
  const activated = this.activated;
@@ -13,7 +13,7 @@ const index$1 = require('./index-cc7dfb7c.js');
13
13
  const overlays = require('./overlays-d3a13e61.js');
14
14
  const theme = require('./theme-fbc56b3b.js');
15
15
  const ionicGlobal = require('./ionic-global-14a0604b.js');
16
- const animation = require('./animation-c8bdd3c7.js');
16
+ const animation = require('./animation-2bb33618.js');
17
17
  require('./index-306a7476.js');
18
18
  require('./framework-delegate-c0873a6f.js');
19
19
  require('./hardware-back-button-b67c8e75.js');
@@ -3,8 +3,8 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- const animation = require('./animation-c8bdd3c7.js');
7
- const index = require('./index-c388851f.js');
6
+ const animation = require('./animation-2bb33618.js');
7
+ const index = require('./index-b183138a.js');
8
8
  require('./index-306a7476.js');
9
9
  require('./helpers-ea4ccbcb.js');
10
10
  require('./index-6f887430.js');
@@ -3,8 +3,8 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- const animation = require('./animation-c8bdd3c7.js');
7
- const index = require('./index-c388851f.js');
6
+ const animation = require('./animation-2bb33618.js');
7
+ const index = require('./index-b183138a.js');
8
8
  require('./index-306a7476.js');
9
9
  require('./helpers-ea4ccbcb.js');
10
10
  require('./index-6f887430.js');
@@ -24,14 +24,6 @@ export class Menu {
24
24
  this.lastOnEnd = 0;
25
25
  this.blocker = GESTURE_CONTROLLER.createBlocker({ disableScroll: true });
26
26
  this.didLoad = false;
27
- /**
28
- * Flag used to determine if an open/close
29
- * operation was cancelled. For example, if
30
- * an app calls "menu.open" then disables the menu
31
- * part way through the animation, then this would
32
- * be considered a cancelled operation.
33
- */
34
- this.operationCancelled = false;
35
27
  this.isAnimating = false;
36
28
  this._isOpen = false;
37
29
  this.inheritedAttributes = {};
@@ -300,15 +292,6 @@ export class Menu {
300
292
  this.beforeAnimation(shouldOpen);
301
293
  await this.loadAnimation();
302
294
  await this.startAnimation(shouldOpen, animated);
303
- /**
304
- * If the animation was cancelled then
305
- * return false because the operation
306
- * did not succeed.
307
- */
308
- if (this.operationCancelled) {
309
- this.operationCancelled = false;
310
- return false;
311
- }
312
295
  this.afterAnimation(shouldOpen);
313
296
  return true;
314
297
  }
@@ -345,23 +328,18 @@ export class Menu {
345
328
  const easingReverse = mode === 'ios' ? iosEasingReverse : mdEasingReverse;
346
329
  const ani = this.animation
347
330
  .direction(isReversed ? 'reverse' : 'normal')
348
- .easing(isReversed ? easingReverse : easing);
331
+ .easing(isReversed ? easingReverse : easing)
332
+ .onFinish(() => {
333
+ if (ani.getDirection() === 'reverse') {
334
+ ani.direction('normal');
335
+ }
336
+ });
349
337
  if (animated) {
350
338
  await ani.play();
351
339
  }
352
340
  else {
353
341
  ani.play({ sync: true });
354
342
  }
355
- /**
356
- * We run this after the play invocation
357
- * instead of using ani.onFinish so that
358
- * multiple onFinish callbacks do not get
359
- * run if an animation is played, stopped,
360
- * and then played again.
361
- */
362
- if (ani.getDirection() === 'reverse') {
363
- ani.direction('normal');
364
- }
365
343
  }
366
344
  _isActive() {
367
345
  return !this.disabled && !this.isPaneVisible;
@@ -498,6 +476,7 @@ export class Menu {
498
476
  }
499
477
  afterAnimation(isOpen) {
500
478
  var _a;
479
+ assert(this.isAnimating, '_before() should be called while animating');
501
480
  // keep opening/closing the menu disabled for a touch more yet
502
481
  // only add listeners/css if it's enabled and isOpen
503
482
  // and only remove listeners/css if it's not open
@@ -556,29 +535,10 @@ export class Menu {
556
535
  if (this.gesture) {
557
536
  this.gesture.enable(isActive && this.swipeGesture);
558
537
  }
559
- /**
560
- * If the menu is disabled but it is still open
561
- * then we should close the menu immediately.
562
- * Additionally, if the menu is in the process
563
- * of animating {open, close} and the menu is disabled
564
- * then it should still be closed immediately.
565
- */
566
- if (!isActive) {
567
- /**
568
- * It is possible to disable the menu while
569
- * it is mid-animation. When this happens, we
570
- * need to set the operationCancelled flag
571
- * so that this._setOpen knows to return false
572
- * and not run the "afterAnimation" callback.
573
- */
574
- if (this.isAnimating) {
575
- this.operationCancelled = true;
576
- }
577
- /**
578
- * If the menu is disabled then we should
579
- * forcibly close the menu even if it is open.
580
- */
581
- this.afterAnimation(false);
538
+ // Close menu immediately
539
+ if (!isActive && this._isOpen) {
540
+ // close if this menu is open, and should not be enabled
541
+ this.forceClosing();
582
542
  }
583
543
  if (doc === null || doc === void 0 ? void 0 : doc.contains(this.el)) {
584
544
  /**
@@ -591,6 +551,14 @@ export class Menu {
591
551
  menuController._setActiveMenu(this);
592
552
  }
593
553
  }
554
+ assert(!this.isAnimating, 'can not be animating');
555
+ }
556
+ forceClosing() {
557
+ assert(this._isOpen, 'menu cannot be closed');
558
+ this.isAnimating = true;
559
+ const ani = this.animation.direction('reverse');
560
+ ani.play({ sync: true });
561
+ this.afterAnimation(false);
594
562
  }
595
563
  render() {
596
564
  const { type, disabled, isPaneVisible, inheritedAttributes, side } = this;
@@ -2,6 +2,7 @@
2
2
  * (C) Ionic http://ionicframework.com - MIT License
3
3
  */
4
4
  import { Host, h, writeTask } from "@stencil/core";
5
+ import { raf } from "../../utils/helpers";
5
6
  import { isRTL } from "../../utils/rtl/index";
6
7
  import { createColorClasses, hostContext } from "../../utils/theme";
7
8
  import { getIonMode } from "../../global/ionic-global";
@@ -78,29 +79,7 @@ export class Segment {
78
79
  * Used by `ion-segment-button` to determine if the button should be checked.
79
80
  */
80
81
  this.ionSelect.emit({ value });
81
- if (this.scrollable) {
82
- const buttons = this.getButtons();
83
- const activeButton = buttons.find((button) => button.value === value);
84
- if (activeButton !== undefined) {
85
- /**
86
- * Scrollable segment buttons should be
87
- * centered within the view including
88
- * buttons that are partially offscreen.
89
- */
90
- activeButton.scrollIntoView({
91
- behavior: 'smooth',
92
- inline: 'center',
93
- /**
94
- * Segment should scroll on the
95
- * horizontal axis. `block: 'nearest'`
96
- * ensures that the vertical axis
97
- * does not scroll if the segment
98
- * as a whole is already in view.
99
- */
100
- block: 'nearest',
101
- });
102
- }
103
- }
82
+ this.scrollActiveButtonIntoView();
104
83
  }
105
84
  disabledChanged() {
106
85
  this.gestureChanged();
@@ -122,6 +101,13 @@ export class Segment {
122
101
  }
123
102
  async componentDidLoad() {
124
103
  this.setCheckedClasses();
104
+ /**
105
+ * We need to wait for the buttons to all be rendered
106
+ * before we can scroll.
107
+ */
108
+ raf(() => {
109
+ this.scrollActiveButtonIntoView();
110
+ });
125
111
  this.gesture = (await import('../../utils/gesture')).createGesture({
126
112
  el: this.el,
127
113
  gestureName: 'segment',
@@ -250,6 +236,32 @@ export class Segment {
250
236
  buttons[next].classList.add('segment-button-after-checked');
251
237
  }
252
238
  }
239
+ scrollActiveButtonIntoView() {
240
+ const { scrollable, value } = this;
241
+ if (scrollable) {
242
+ const buttons = this.getButtons();
243
+ const activeButton = buttons.find((button) => button.value === value);
244
+ if (activeButton !== undefined) {
245
+ /**
246
+ * Scrollable segment buttons should be
247
+ * centered within the view including
248
+ * buttons that are partially offscreen.
249
+ */
250
+ activeButton.scrollIntoView({
251
+ behavior: 'smooth',
252
+ inline: 'center',
253
+ /**
254
+ * Segment should scroll on the
255
+ * horizontal axis. `block: 'nearest'`
256
+ * ensures that the vertical axis
257
+ * does not scroll if the segment
258
+ * as a whole is already in view.
259
+ */
260
+ block: 'nearest',
261
+ });
262
+ }
263
+ }
264
+ }
253
265
  setNextIndex(detail, isEnd = false) {
254
266
  const rtl = isRTL(this.el);
255
267
  const activated = this.activated;
@@ -4,7 +4,7 @@
4
4
  import { expect } from "@playwright/test";
5
5
  import { configs, test } from "../../../../utils/test/playwright/index";
6
6
  configs().forEach(({ title, screenshot, config }) => {
7
- test.describe(title('segment: scrollable'), () => {
7
+ test.describe(title('segment: scrollable (rendering)'), () => {
8
8
  test('should not have visual regressions', async ({ page }) => {
9
9
  await page.setContent(`
10
10
  <ion-segment scrollable="true" value="2">
@@ -42,3 +42,57 @@ configs().forEach(({ title, screenshot, config }) => {
42
42
  });
43
43
  });
44
44
  });
45
+ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
46
+ test.describe(title('segment: scrollable (functionality)'), () => {
47
+ test.only('should scroll active button into view when value is already set', async ({ page }) => {
48
+ await page.setContent(`
49
+ <ion-segment scrollable="true" value="8">
50
+ <ion-segment-button value="1">
51
+ <ion-label>First</ion-label>
52
+ </ion-segment-button>
53
+ <ion-segment-button value="2">
54
+ <ion-label>Second</ion-label>
55
+ </ion-segment-button>
56
+ <ion-segment-button value="3">
57
+ <ion-label>Third</ion-label>
58
+ </ion-segment-button>
59
+ <ion-segment-button value="4">
60
+ <ion-label>Fourth</ion-label>
61
+ </ion-segment-button>
62
+ <ion-segment-button value="5">
63
+ <ion-label>Fifth</ion-label>
64
+ </ion-segment-button>
65
+ <ion-segment-button value="6">
66
+ <ion-label>Sixth</ion-label>
67
+ </ion-segment-button>
68
+ <ion-segment-button value="7">
69
+ <ion-label>Seventh</ion-label>
70
+ </ion-segment-button>
71
+ <ion-segment-button id="activeButton" value="8">
72
+ <ion-label>Eighth</ion-label>
73
+ </ion-segment-button>
74
+ <ion-segment-button value="9">
75
+ <ion-label>Ninth</ion-label>
76
+ </ion-segment-button>
77
+ </ion-segment>
78
+ `, config);
79
+ const activeButton = page.locator('#activeButton');
80
+ // wait for segment to scroll, which is done in a raf
81
+ await page.waitForTimeout(500);
82
+ /**
83
+ * We can't use toBeVisible() here because it returns true
84
+ * even if the element is outside the viewport.
85
+ */
86
+ const box = await activeButton.boundingBox();
87
+ const viewport = page.viewportSize();
88
+ let isInViewport = false;
89
+ if (box && viewport) {
90
+ isInViewport = (box.x >= 0 &&
91
+ box.y >= 0 &&
92
+ box.x + box.width <= viewport.width &&
93
+ box.y + box.height <= viewport.height);
94
+ }
95
+ expect(isInViewport).toBe(true);
96
+ });
97
+ });
98
+ });
@@ -36,7 +36,6 @@ export const createAnimation = (animationId) => {
36
36
  const id = animationId;
37
37
  const onFinishCallbacks = [];
38
38
  const onFinishOneTimeCallbacks = [];
39
- const onStopOneTimeCallbacks = [];
40
39
  const elements = [];
41
40
  const childAnimations = [];
42
41
  const stylesheets = [];
@@ -94,28 +93,6 @@ export const createAnimation = (animationId) => {
94
93
  const isRunning = () => {
95
94
  return numAnimationsRunning !== 0 && !paused;
96
95
  };
97
- /**
98
- * @internal
99
- * Remove a callback from a chosen callback array
100
- * @param callbackToRemove: A reference to the callback that should be removed
101
- * @param callbackObjects: An array of callbacks that callbackToRemove should be removed from.
102
- */
103
- const clearCallback = (callbackToRemove, callbackObjects) => {
104
- const index = callbackObjects.findIndex((callbackObject) => callbackObject.c === callbackToRemove);
105
- if (index > -1) {
106
- callbackObjects.splice(index, 1);
107
- }
108
- };
109
- /**
110
- * @internal
111
- * Add a callback to be fired when an animation is stopped/cancelled.
112
- * @param callback: A reference to the callback that should be fired
113
- * @param opts: Any options associated with this particular callback
114
- */
115
- const onStop = (callback, opts) => {
116
- onStopOneTimeCallbacks.push({ c: callback, o: opts });
117
- return ani;
118
- };
119
96
  const onFinish = (callback, opts) => {
120
97
  const callbacks = (opts === null || opts === void 0 ? void 0 : opts.oneTimeCallback) ? onFinishOneTimeCallbacks : onFinishCallbacks;
121
98
  callbacks.push({ c: callback, o: opts });
@@ -784,33 +761,7 @@ export const createAnimation = (animationId) => {
784
761
  numAnimationsRunning = childAnimations.length + 1;
785
762
  shouldCalculateNumAnimations = false;
786
763
  }
787
- /**
788
- * When one of these callbacks fires we
789
- * need to clear the other's callback otherwise
790
- * you can potentially get these callbacks
791
- * firing multiple times if the play method
792
- * is subsequently called.
793
- * Example:
794
- * animation.play() (onStop and onFinish callbacks are registered)
795
- * animation.stop() (onStop callback is fired, onFinish is not)
796
- * animation.play() (onStop and onFinish callbacks are registered)
797
- * Total onStop callbacks: 1
798
- * Total onFinish callbacks: 2
799
- */
800
- const onStopCallback = () => {
801
- clearCallback(onFinishCallback, onFinishOneTimeCallbacks);
802
- resolve();
803
- };
804
- const onFinishCallback = () => {
805
- clearCallback(onStopCallback, onStopOneTimeCallbacks);
806
- resolve();
807
- };
808
- /**
809
- * The play method resolves when an animation
810
- * run either finishes or is cancelled.
811
- */
812
- onFinish(onFinishCallback, { oneTimeCallback: true });
813
- onStop(onStopCallback, { oneTimeCallback: true });
764
+ onFinish(() => resolve(), { oneTimeCallback: true });
814
765
  childAnimations.forEach((animation) => {
815
766
  animation.play();
816
767
  });
@@ -823,14 +774,6 @@ export const createAnimation = (animationId) => {
823
774
  paused = false;
824
775
  });
825
776
  };
826
- /**
827
- * Stops an animation and resets it state to the
828
- * beginning. This does not fire any onFinish
829
- * callbacks because the animation did not finish.
830
- * However, since the animation was not destroyed
831
- * (i.e. the animation could run again) we do not
832
- * clear the onFinish callbacks.
833
- */
834
777
  const stop = () => {
835
778
  childAnimations.forEach((animation) => {
836
779
  animation.stop();
@@ -840,8 +783,6 @@ export const createAnimation = (animationId) => {
840
783
  initialized = false;
841
784
  }
842
785
  resetFlags();
843
- onStopOneTimeCallbacks.forEach((onStopCallback) => onStopCallback.c(0, ani));
844
- onStopOneTimeCallbacks.length = 0;
845
786
  };
846
787
  const from = (property, value) => {
847
788
  const firstFrame = _keyframes[0];
package/dist/docs.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2023-10-02T16:42:30",
2
+ "timestamp": "2023-10-03T17:56:21",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.3.0",
@@ -159,7 +159,6 @@ const createAnimation = (animationId) => {
159
159
  const id = animationId;
160
160
  const onFinishCallbacks = [];
161
161
  const onFinishOneTimeCallbacks = [];
162
- const onStopOneTimeCallbacks = [];
163
162
  const elements = [];
164
163
  const childAnimations = [];
165
164
  const stylesheets = [];
@@ -217,28 +216,6 @@ const createAnimation = (animationId) => {
217
216
  const isRunning = () => {
218
217
  return numAnimationsRunning !== 0 && !paused;
219
218
  };
220
- /**
221
- * @internal
222
- * Remove a callback from a chosen callback array
223
- * @param callbackToRemove: A reference to the callback that should be removed
224
- * @param callbackObjects: An array of callbacks that callbackToRemove should be removed from.
225
- */
226
- const clearCallback = (callbackToRemove, callbackObjects) => {
227
- const index = callbackObjects.findIndex((callbackObject) => callbackObject.c === callbackToRemove);
228
- if (index > -1) {
229
- callbackObjects.splice(index, 1);
230
- }
231
- };
232
- /**
233
- * @internal
234
- * Add a callback to be fired when an animation is stopped/cancelled.
235
- * @param callback: A reference to the callback that should be fired
236
- * @param opts: Any options associated with this particular callback
237
- */
238
- const onStop = (callback, opts) => {
239
- onStopOneTimeCallbacks.push({ c: callback, o: opts });
240
- return ani;
241
- };
242
219
  const onFinish = (callback, opts) => {
243
220
  const callbacks = (opts === null || opts === void 0 ? void 0 : opts.oneTimeCallback) ? onFinishOneTimeCallbacks : onFinishCallbacks;
244
221
  callbacks.push({ c: callback, o: opts });
@@ -907,33 +884,7 @@ const createAnimation = (animationId) => {
907
884
  numAnimationsRunning = childAnimations.length + 1;
908
885
  shouldCalculateNumAnimations = false;
909
886
  }
910
- /**
911
- * When one of these callbacks fires we
912
- * need to clear the other's callback otherwise
913
- * you can potentially get these callbacks
914
- * firing multiple times if the play method
915
- * is subsequently called.
916
- * Example:
917
- * animation.play() (onStop and onFinish callbacks are registered)
918
- * animation.stop() (onStop callback is fired, onFinish is not)
919
- * animation.play() (onStop and onFinish callbacks are registered)
920
- * Total onStop callbacks: 1
921
- * Total onFinish callbacks: 2
922
- */
923
- const onStopCallback = () => {
924
- clearCallback(onFinishCallback, onFinishOneTimeCallbacks);
925
- resolve();
926
- };
927
- const onFinishCallback = () => {
928
- clearCallback(onStopCallback, onStopOneTimeCallbacks);
929
- resolve();
930
- };
931
- /**
932
- * The play method resolves when an animation
933
- * run either finishes or is cancelled.
934
- */
935
- onFinish(onFinishCallback, { oneTimeCallback: true });
936
- onStop(onStopCallback, { oneTimeCallback: true });
887
+ onFinish(() => resolve(), { oneTimeCallback: true });
937
888
  childAnimations.forEach((animation) => {
938
889
  animation.play();
939
890
  });
@@ -946,14 +897,6 @@ const createAnimation = (animationId) => {
946
897
  paused = false;
947
898
  });
948
899
  };
949
- /**
950
- * Stops an animation and resets it state to the
951
- * beginning. This does not fire any onFinish
952
- * callbacks because the animation did not finish.
953
- * However, since the animation was not destroyed
954
- * (i.e. the animation could run again) we do not
955
- * clear the onFinish callbacks.
956
- */
957
900
  const stop = () => {
958
901
  childAnimations.forEach((animation) => {
959
902
  animation.stop();
@@ -963,8 +906,6 @@ const createAnimation = (animationId) => {
963
906
  initialized = false;
964
907
  }
965
908
  resetFlags();
966
- onStopOneTimeCallbacks.forEach((onStopCallback) => onStopCallback.c(0, ani));
967
- onStopOneTimeCallbacks.length = 0;
968
909
  };
969
910
  const from = (property, value) => {
970
911
  const firstFrame = _keyframes[0];
@@ -4,7 +4,7 @@
4
4
  import { MENU_BACK_BUTTON_PRIORITY } from './hardware-back-button-39299f84.js';
5
5
  import { c as componentOnReady } from './helpers-3379ba19.js';
6
6
  import { b as getIonMode } from './ionic-global-b3fc28dd.js';
7
- import { c as createAnimation } from './animation-92066c62.js';
7
+ import { c as createAnimation } from './animation-a1d9e088.js';
8
8
 
9
9
  /**
10
10
  * baseAnimation
@@ -10,8 +10,8 @@ const LIFECYCLE_WILL_LEAVE = 'ionViewWillLeave';
10
10
  const LIFECYCLE_DID_LEAVE = 'ionViewDidLeave';
11
11
  const LIFECYCLE_WILL_UNLOAD = 'ionViewWillUnload';
12
12
 
13
- const iosTransitionAnimation = () => import('./ios.transition-d4be3bd5.js');
14
- const mdTransitionAnimation = () => import('./md.transition-ae47f354.js');
13
+ const iosTransitionAnimation = () => import('./ios.transition-81e1aed6.js');
14
+ const mdTransitionAnimation = () => import('./md.transition-5becd8b5.js');
15
15
  // TODO(FW-2832): types
16
16
  const transition = (opts) => {
17
17
  return new Promise((resolve, reject) => {
package/dist/esm/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  /*!
2
2
  * (C) Ionic http://ionicframework.com - MIT License
3
3
  */
4
- export { c as createAnimation } from './animation-92066c62.js';
5
- export { a as LIFECYCLE_DID_ENTER, c as LIFECYCLE_DID_LEAVE, L as LIFECYCLE_WILL_ENTER, b as LIFECYCLE_WILL_LEAVE, d as LIFECYCLE_WILL_UNLOAD, g as getIonPageElement } from './index-ca26aea8.js';
6
- export { iosTransitionAnimation } from './ios.transition-d4be3bd5.js';
7
- export { mdTransitionAnimation } from './md.transition-ae47f354.js';
4
+ export { c as createAnimation } from './animation-a1d9e088.js';
5
+ export { a as LIFECYCLE_DID_ENTER, c as LIFECYCLE_DID_LEAVE, L as LIFECYCLE_WILL_ENTER, b as LIFECYCLE_WILL_LEAVE, d as LIFECYCLE_WILL_UNLOAD, g as getIonPageElement } from './index-87684bba.js';
6
+ export { iosTransitionAnimation } from './ios.transition-81e1aed6.js';
7
+ export { mdTransitionAnimation } from './md.transition-5becd8b5.js';
8
8
  export { g as getTimeGivenProgression } from './cubic-bezier-66542bc5.js';
9
9
  export { createGesture } from './index-ff313b19.js';
10
10
  export { g as getPlatforms, i as initialize, a as isPlatform } from './ionic-global-b3fc28dd.js';
11
11
  export { c as componentOnReady } from './helpers-3379ba19.js';
12
12
  export { I as IonicSafeString, g as getMode, s as setupConfig } from './config-96c9ace3.js';
13
- export { m as menuController } from './index-9b1940b1.js';
13
+ export { m as menuController } from './index-61bddc90.js';
14
14
  export { b as actionSheetController, a as alertController, l as loadingController, m as modalController, p as pickerController, c as popoverController, t as toastController } from './overlays-8fc6656c.js';
15
15
  import './index-7a14ecec.js';
16
16
  import './index-2d388930.js';
@@ -8,7 +8,7 @@ import { c as createLockController } from './lock-controller-e8c6c051.js';
8
8
  import { d as createDelegateController, e as createTriggerController, B as BACKDROP, i as isCancel, f as present, g as dismiss, h as eventMethod, s as safeCall, j as prepareOverlay, k as setOverlayId } from './overlays-8fc6656c.js';
9
9
  import { g as getClassMap } from './theme-17531cdf.js';
10
10
  import { b as getIonMode } from './ionic-global-b3fc28dd.js';
11
- import { c as createAnimation } from './animation-92066c62.js';
11
+ import { c as createAnimation } from './animation-a1d9e088.js';
12
12
  import './haptic-6447af60.js';
13
13
  import './capacitor-b4979570.js';
14
14
  import './index-7a14ecec.js';
@@ -9,7 +9,7 @@ import { c as createLockController } from './lock-controller-e8c6c051.js';
9
9
  import { d as createDelegateController, e as createTriggerController, B as BACKDROP, i as isCancel, j as prepareOverlay, k as setOverlayId, f as present, g as dismiss, h as eventMethod, s as safeCall } from './overlays-8fc6656c.js';
10
10
  import { g as getClassMap } from './theme-17531cdf.js';
11
11
  import { c as config, b as getIonMode } from './ionic-global-b3fc28dd.js';
12
- import { c as createAnimation } from './animation-92066c62.js';
12
+ import { c as createAnimation } from './animation-a1d9e088.js';
13
13
  import './haptic-6447af60.js';
14
14
  import './capacitor-b4979570.js';
15
15
  import './index-7a14ecec.js';
@@ -10,7 +10,7 @@ import { a as findIonContent, p as printIonContentErrorMsg, g as getScrollElemen
10
10
  import { c as createKeyboardController } from './keyboard-controller-0c2dce71.js';
11
11
  import { g as getTimeGivenProgression } from './cubic-bezier-66542bc5.js';
12
12
  import { a as attachComponent, d as detachComponent } from './framework-delegate-aa433dea.js';
13
- import { t as transition } from './index-ca26aea8.js';
13
+ import { t as transition } from './index-87684bba.js';
14
14
  import './index-595d62c9.js';
15
15
  import './index-7a14ecec.js';
16
16
  import './keyboard-b063f012.js';