@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.
- package/components/animation.js +1 -60
- package/components/ion-menu.js +19 -51
- package/components/ion-segment.js +35 -23
- package/dist/cjs/{animation-c8bdd3c7.js → animation-2bb33618.js} +1 -60
- package/dist/cjs/{index-e50a18ba.js → index-5121bb90.js} +1 -1
- package/dist/cjs/{index-c388851f.js → index-b183138a.js} +2 -2
- package/dist/cjs/index.cjs.js +5 -5
- package/dist/cjs/ion-action-sheet.cjs.entry.js +1 -1
- package/dist/cjs/ion-alert.cjs.entry.js +1 -1
- package/dist/cjs/ion-app_8.cjs.entry.js +1 -1
- package/dist/cjs/ion-datetime_3.cjs.entry.js +1 -1
- package/dist/cjs/ion-loading.cjs.entry.js +1 -1
- package/dist/cjs/ion-menu_3.cjs.entry.js +21 -53
- package/dist/cjs/ion-modal.cjs.entry.js +2 -2
- package/dist/cjs/ion-nav_2.cjs.entry.js +1 -1
- package/dist/cjs/ion-popover.cjs.entry.js +2 -2
- package/dist/cjs/ion-refresher_2.cjs.entry.js +1 -1
- package/dist/cjs/ion-segment_2.cjs.entry.js +35 -24
- package/dist/cjs/ion-toast.cjs.entry.js +1 -1
- package/dist/cjs/{ios.transition-fd592869.js → ios.transition-4b93903d.js} +2 -2
- package/dist/cjs/{md.transition-a6040d41.js → md.transition-79f3a215.js} +2 -2
- package/dist/collection/components/menu/menu.js +19 -51
- package/dist/collection/components/segment/segment.js +35 -23
- package/dist/collection/components/segment/test/scrollable/segment.e2e.js +55 -1
- package/dist/collection/utils/animation/animation.js +1 -60
- package/dist/docs.json +1 -1
- package/dist/esm/{animation-92066c62.js → animation-a1d9e088.js} +1 -60
- package/dist/esm/{index-9b1940b1.js → index-61bddc90.js} +1 -1
- package/dist/esm/{index-ca26aea8.js → index-87684bba.js} +2 -2
- package/dist/esm/index.js +5 -5
- package/dist/esm/ion-action-sheet.entry.js +1 -1
- package/dist/esm/ion-alert.entry.js +1 -1
- package/dist/esm/ion-app_8.entry.js +1 -1
- package/dist/esm/ion-datetime_3.entry.js +1 -1
- package/dist/esm/ion-loading.entry.js +1 -1
- package/dist/esm/ion-menu_3.entry.js +21 -53
- package/dist/esm/ion-modal.entry.js +2 -2
- package/dist/esm/ion-nav_2.entry.js +1 -1
- package/dist/esm/ion-popover.entry.js +2 -2
- package/dist/esm/ion-refresher_2.entry.js +1 -1
- package/dist/esm/ion-segment_2.entry.js +35 -24
- package/dist/esm/ion-toast.entry.js +1 -1
- package/dist/esm/{ios.transition-d4be3bd5.js → ios.transition-81e1aed6.js} +2 -2
- package/dist/esm/{md.transition-ae47f354.js → md.transition-5becd8b5.js} +2 -2
- package/dist/esm-es5/animation-a1d9e088.js +4 -0
- package/dist/esm-es5/{index-9b1940b1.js → index-61bddc90.js} +1 -1
- package/dist/esm-es5/{index-ca26aea8.js → index-87684bba.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/ion-action-sheet.entry.js +1 -1
- package/dist/esm-es5/ion-alert.entry.js +1 -1
- package/dist/esm-es5/ion-app_8.entry.js +1 -1
- package/dist/esm-es5/ion-datetime_3.entry.js +1 -1
- package/dist/esm-es5/ion-loading.entry.js +1 -1
- package/dist/esm-es5/ion-menu_3.entry.js +1 -1
- package/dist/esm-es5/ion-modal.entry.js +1 -1
- package/dist/esm-es5/ion-nav_2.entry.js +1 -1
- package/dist/esm-es5/ion-popover.entry.js +1 -1
- package/dist/esm-es5/ion-refresher_2.entry.js +1 -1
- package/dist/esm-es5/ion-segment_2.entry.js +1 -1
- package/dist/esm-es5/ion-toast.entry.js +1 -1
- package/dist/esm-es5/{ios.transition-d4be3bd5.js → ios.transition-81e1aed6.js} +1 -1
- package/dist/esm-es5/{md.transition-ae47f354.js → md.transition-5becd8b5.js} +1 -1
- package/dist/ionic/index.esm.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/{p-17f69cbc.system.entry.js → p-048d7153.system.entry.js} +1 -1
- package/dist/ionic/{p-eac9308b.system.entry.js → p-08c5b9f4.system.entry.js} +1 -1
- package/dist/ionic/{p-9f758520.entry.js → p-13a91505.entry.js} +1 -1
- package/dist/ionic/p-155dfdda.entry.js +4 -0
- package/dist/ionic/{p-4d2c9270.system.entry.js → p-1a36bf45.system.entry.js} +1 -1
- package/dist/ionic/{p-b0c3f506.entry.js → p-27614d55.entry.js} +1 -1
- package/dist/ionic/{p-2624b777.system.entry.js → p-37456282.system.entry.js} +1 -1
- package/dist/ionic/p-40e16caa.system.entry.js +4 -0
- package/dist/ionic/{p-0505bc05.system.entry.js → p-4616f20a.system.entry.js} +1 -1
- package/dist/ionic/{p-f70372cf.js → p-5e2dc8e0.js} +1 -1
- package/dist/ionic/{p-9eea70fb.system.entry.js → p-65a4c12f.system.entry.js} +1 -1
- package/dist/ionic/p-6b2641f6.system.js +4 -0
- package/dist/ionic/{p-dcdc16e8.system.entry.js → p-6bc9c436.system.entry.js} +1 -1
- package/dist/ionic/p-6edbc09b.system.js +1 -1
- package/dist/ionic/p-72a1cbc7.js +4 -0
- package/dist/ionic/{p-f2bc4fc0.system.js → p-73f50e29.system.js} +1 -1
- package/dist/ionic/p-78a293a5.js +4 -0
- package/dist/ionic/{p-5c9f38bf.entry.js → p-7e46b6ab.entry.js} +1 -1
- package/dist/ionic/{p-0fb0904b.system.js → p-8fdd4a2f.system.js} +1 -1
- package/dist/ionic/{p-24ebc805.entry.js → p-90d892fd.entry.js} +1 -1
- package/dist/ionic/{p-51163f34.system.js → p-918d5f19.system.js} +1 -1
- package/dist/ionic/p-94a4ce40.js +4 -0
- package/dist/ionic/{p-06a68207.system.entry.js → p-a6d8476b.system.entry.js} +1 -1
- package/dist/ionic/{p-003dbb0e.entry.js → p-a720dc73.entry.js} +1 -1
- package/dist/ionic/{p-2a13187a.system.js → p-b098f738.system.js} +1 -1
- package/dist/ionic/p-b95fd3c6.entry.js +4 -0
- package/dist/ionic/{p-d4f02009.entry.js → p-bf9b1560.entry.js} +1 -1
- package/dist/ionic/{p-26a785e9.system.entry.js → p-c5729044.system.entry.js} +1 -1
- package/dist/ionic/{p-d6e93d49.entry.js → p-c7fca267.entry.js} +1 -1
- package/dist/ionic/{p-c6221536.system.js → p-d4cea1ba.system.js} +1 -1
- package/dist/ionic/{p-40ffdeb5.system.entry.js → p-de676d36.system.entry.js} +1 -1
- package/dist/ionic/{p-a42bbc51.entry.js → p-ee6d9730.entry.js} +1 -1
- package/dist/ionic/p-f1a71e75.system.entry.js +4 -0
- package/dist/ionic/{p-b1a04d35.entry.js → p-f547e62f.entry.js} +1 -1
- package/dist/ionic/{p-4df178d7.entry.js → p-f920f5ca.entry.js} +1 -1
- package/dist/ionic/p-f978ccd1.js +4 -0
- package/dist/types/components/menu/menu.d.ts +1 -8
- package/dist/types/components/segment/segment.d.ts +1 -0
- package/hydrate/index.js +54 -134
- package/package.json +1 -1
- package/dist/collection/components/menu/test/disable/menu.e2e.js +0 -55
- package/dist/esm-es5/animation-92066c62.js +0 -4
- package/dist/ionic/p-015187e5.system.js +0 -4
- package/dist/ionic/p-0a39673e.js +0 -4
- package/dist/ionic/p-12b13ed4.entry.js +0 -4
- package/dist/ionic/p-1a6c0442.js +0 -4
- package/dist/ionic/p-37a0b769.js +0 -4
- package/dist/ionic/p-446230d7.js +0 -4
- package/dist/ionic/p-55b99166.entry.js +0 -4
- package/dist/ionic/p-b5637aeb.system.entry.js +0 -4
- package/dist/ionic/p-bff7659e.system.entry.js +0 -4
package/components/animation.js
CHANGED
|
@@ -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];
|
package/components/ion-menu.js
CHANGED
|
@@ -33,14 +33,6 @@ const Menu = /*@__PURE__*/ proxyCustomElement(class Menu extends HTMLElement {
|
|
|
33
33
|
this.lastOnEnd = 0;
|
|
34
34
|
this.blocker = GESTURE_CONTROLLER.createBlocker({ disableScroll: true });
|
|
35
35
|
this.didLoad = false;
|
|
36
|
-
/**
|
|
37
|
-
* Flag used to determine if an open/close
|
|
38
|
-
* operation was cancelled. For example, if
|
|
39
|
-
* an app calls "menu.open" then disables the menu
|
|
40
|
-
* part way through the animation, then this would
|
|
41
|
-
* be considered a cancelled operation.
|
|
42
|
-
*/
|
|
43
|
-
this.operationCancelled = false;
|
|
44
36
|
this.isAnimating = false;
|
|
45
37
|
this._isOpen = false;
|
|
46
38
|
this.inheritedAttributes = {};
|
|
@@ -309,15 +301,6 @@ const Menu = /*@__PURE__*/ proxyCustomElement(class Menu extends HTMLElement {
|
|
|
309
301
|
this.beforeAnimation(shouldOpen);
|
|
310
302
|
await this.loadAnimation();
|
|
311
303
|
await this.startAnimation(shouldOpen, animated);
|
|
312
|
-
/**
|
|
313
|
-
* If the animation was cancelled then
|
|
314
|
-
* return false because the operation
|
|
315
|
-
* did not succeed.
|
|
316
|
-
*/
|
|
317
|
-
if (this.operationCancelled) {
|
|
318
|
-
this.operationCancelled = false;
|
|
319
|
-
return false;
|
|
320
|
-
}
|
|
321
304
|
this.afterAnimation(shouldOpen);
|
|
322
305
|
return true;
|
|
323
306
|
}
|
|
@@ -354,23 +337,18 @@ const Menu = /*@__PURE__*/ proxyCustomElement(class Menu extends HTMLElement {
|
|
|
354
337
|
const easingReverse = mode === 'ios' ? iosEasingReverse : mdEasingReverse;
|
|
355
338
|
const ani = this.animation
|
|
356
339
|
.direction(isReversed ? 'reverse' : 'normal')
|
|
357
|
-
.easing(isReversed ? easingReverse : easing)
|
|
340
|
+
.easing(isReversed ? easingReverse : easing)
|
|
341
|
+
.onFinish(() => {
|
|
342
|
+
if (ani.getDirection() === 'reverse') {
|
|
343
|
+
ani.direction('normal');
|
|
344
|
+
}
|
|
345
|
+
});
|
|
358
346
|
if (animated) {
|
|
359
347
|
await ani.play();
|
|
360
348
|
}
|
|
361
349
|
else {
|
|
362
350
|
ani.play({ sync: true });
|
|
363
351
|
}
|
|
364
|
-
/**
|
|
365
|
-
* We run this after the play invocation
|
|
366
|
-
* instead of using ani.onFinish so that
|
|
367
|
-
* multiple onFinish callbacks do not get
|
|
368
|
-
* run if an animation is played, stopped,
|
|
369
|
-
* and then played again.
|
|
370
|
-
*/
|
|
371
|
-
if (ani.getDirection() === 'reverse') {
|
|
372
|
-
ani.direction('normal');
|
|
373
|
-
}
|
|
374
352
|
}
|
|
375
353
|
_isActive() {
|
|
376
354
|
return !this.disabled && !this.isPaneVisible;
|
|
@@ -507,6 +485,7 @@ const Menu = /*@__PURE__*/ proxyCustomElement(class Menu extends HTMLElement {
|
|
|
507
485
|
}
|
|
508
486
|
afterAnimation(isOpen) {
|
|
509
487
|
var _a;
|
|
488
|
+
assert(this.isAnimating, '_before() should be called while animating');
|
|
510
489
|
// keep opening/closing the menu disabled for a touch more yet
|
|
511
490
|
// only add listeners/css if it's enabled and isOpen
|
|
512
491
|
// and only remove listeners/css if it's not open
|
|
@@ -565,29 +544,10 @@ const Menu = /*@__PURE__*/ proxyCustomElement(class Menu extends HTMLElement {
|
|
|
565
544
|
if (this.gesture) {
|
|
566
545
|
this.gesture.enable(isActive && this.swipeGesture);
|
|
567
546
|
}
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
* of animating {open, close} and the menu is disabled
|
|
573
|
-
* then it should still be closed immediately.
|
|
574
|
-
*/
|
|
575
|
-
if (!isActive) {
|
|
576
|
-
/**
|
|
577
|
-
* It is possible to disable the menu while
|
|
578
|
-
* it is mid-animation. When this happens, we
|
|
579
|
-
* need to set the operationCancelled flag
|
|
580
|
-
* so that this._setOpen knows to return false
|
|
581
|
-
* and not run the "afterAnimation" callback.
|
|
582
|
-
*/
|
|
583
|
-
if (this.isAnimating) {
|
|
584
|
-
this.operationCancelled = true;
|
|
585
|
-
}
|
|
586
|
-
/**
|
|
587
|
-
* If the menu is disabled then we should
|
|
588
|
-
* forcibly close the menu even if it is open.
|
|
589
|
-
*/
|
|
590
|
-
this.afterAnimation(false);
|
|
547
|
+
// Close menu immediately
|
|
548
|
+
if (!isActive && this._isOpen) {
|
|
549
|
+
// close if this menu is open, and should not be enabled
|
|
550
|
+
this.forceClosing();
|
|
591
551
|
}
|
|
592
552
|
if (doc === null || doc === void 0 ? void 0 : doc.contains(this.el)) {
|
|
593
553
|
/**
|
|
@@ -600,6 +560,14 @@ const Menu = /*@__PURE__*/ proxyCustomElement(class Menu extends HTMLElement {
|
|
|
600
560
|
menuController._setActiveMenu(this);
|
|
601
561
|
}
|
|
602
562
|
}
|
|
563
|
+
assert(!this.isAnimating, 'can not be animating');
|
|
564
|
+
}
|
|
565
|
+
forceClosing() {
|
|
566
|
+
assert(this._isOpen, 'menu cannot be closed');
|
|
567
|
+
this.isAnimating = true;
|
|
568
|
+
const ani = this.animation.direction('reverse');
|
|
569
|
+
ani.play({ sync: true });
|
|
570
|
+
this.afterAnimation(false);
|
|
603
571
|
}
|
|
604
572
|
render() {
|
|
605
573
|
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 { proxyCustomElement, HTMLElement, createEvent, writeTask, h, Host } from '@stencil/core/internal/client';
|
|
5
|
+
import { r as raf } from './helpers.js';
|
|
5
6
|
import { i as isRTL } from './dir.js';
|
|
6
7
|
import { c as createColorClasses, h as hostContext } from './theme.js';
|
|
7
8
|
import { b as getIonMode } from './ionic-global.js';
|
|
@@ -86,29 +87,7 @@ const Segment = /*@__PURE__*/ proxyCustomElement(class Segment extends HTMLEleme
|
|
|
86
87
|
* Used by `ion-segment-button` to determine if the button should be checked.
|
|
87
88
|
*/
|
|
88
89
|
this.ionSelect.emit({ value });
|
|
89
|
-
|
|
90
|
-
const buttons = this.getButtons();
|
|
91
|
-
const activeButton = buttons.find((button) => button.value === value);
|
|
92
|
-
if (activeButton !== undefined) {
|
|
93
|
-
/**
|
|
94
|
-
* Scrollable segment buttons should be
|
|
95
|
-
* centered within the view including
|
|
96
|
-
* buttons that are partially offscreen.
|
|
97
|
-
*/
|
|
98
|
-
activeButton.scrollIntoView({
|
|
99
|
-
behavior: 'smooth',
|
|
100
|
-
inline: 'center',
|
|
101
|
-
/**
|
|
102
|
-
* Segment should scroll on the
|
|
103
|
-
* horizontal axis. `block: 'nearest'`
|
|
104
|
-
* ensures that the vertical axis
|
|
105
|
-
* does not scroll if the segment
|
|
106
|
-
* as a whole is already in view.
|
|
107
|
-
*/
|
|
108
|
-
block: 'nearest',
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
90
|
+
this.scrollActiveButtonIntoView();
|
|
112
91
|
}
|
|
113
92
|
disabledChanged() {
|
|
114
93
|
this.gestureChanged();
|
|
@@ -130,6 +109,13 @@ const Segment = /*@__PURE__*/ proxyCustomElement(class Segment extends HTMLEleme
|
|
|
130
109
|
}
|
|
131
110
|
async componentDidLoad() {
|
|
132
111
|
this.setCheckedClasses();
|
|
112
|
+
/**
|
|
113
|
+
* We need to wait for the buttons to all be rendered
|
|
114
|
+
* before we can scroll.
|
|
115
|
+
*/
|
|
116
|
+
raf(() => {
|
|
117
|
+
this.scrollActiveButtonIntoView();
|
|
118
|
+
});
|
|
133
119
|
this.gesture = (await import('./index3.js')).createGesture({
|
|
134
120
|
el: this.el,
|
|
135
121
|
gestureName: 'segment',
|
|
@@ -258,6 +244,32 @@ const Segment = /*@__PURE__*/ proxyCustomElement(class Segment extends HTMLEleme
|
|
|
258
244
|
buttons[next].classList.add('segment-button-after-checked');
|
|
259
245
|
}
|
|
260
246
|
}
|
|
247
|
+
scrollActiveButtonIntoView() {
|
|
248
|
+
const { scrollable, value } = this;
|
|
249
|
+
if (scrollable) {
|
|
250
|
+
const buttons = this.getButtons();
|
|
251
|
+
const activeButton = buttons.find((button) => button.value === value);
|
|
252
|
+
if (activeButton !== undefined) {
|
|
253
|
+
/**
|
|
254
|
+
* Scrollable segment buttons should be
|
|
255
|
+
* centered within the view including
|
|
256
|
+
* buttons that are partially offscreen.
|
|
257
|
+
*/
|
|
258
|
+
activeButton.scrollIntoView({
|
|
259
|
+
behavior: 'smooth',
|
|
260
|
+
inline: 'center',
|
|
261
|
+
/**
|
|
262
|
+
* Segment should scroll on the
|
|
263
|
+
* horizontal axis. `block: 'nearest'`
|
|
264
|
+
* ensures that the vertical axis
|
|
265
|
+
* does not scroll if the segment
|
|
266
|
+
* as a whole is already in view.
|
|
267
|
+
*/
|
|
268
|
+
block: 'nearest',
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
261
273
|
setNextIndex(detail, isEnd = false) {
|
|
262
274
|
const rtl = isRTL(this.el);
|
|
263
275
|
const activated = this.activated;
|
|
@@ -161,7 +161,6 @@ const createAnimation = (animationId) => {
|
|
|
161
161
|
const id = animationId;
|
|
162
162
|
const onFinishCallbacks = [];
|
|
163
163
|
const onFinishOneTimeCallbacks = [];
|
|
164
|
-
const onStopOneTimeCallbacks = [];
|
|
165
164
|
const elements = [];
|
|
166
165
|
const childAnimations = [];
|
|
167
166
|
const stylesheets = [];
|
|
@@ -219,28 +218,6 @@ const createAnimation = (animationId) => {
|
|
|
219
218
|
const isRunning = () => {
|
|
220
219
|
return numAnimationsRunning !== 0 && !paused;
|
|
221
220
|
};
|
|
222
|
-
/**
|
|
223
|
-
* @internal
|
|
224
|
-
* Remove a callback from a chosen callback array
|
|
225
|
-
* @param callbackToRemove: A reference to the callback that should be removed
|
|
226
|
-
* @param callbackObjects: An array of callbacks that callbackToRemove should be removed from.
|
|
227
|
-
*/
|
|
228
|
-
const clearCallback = (callbackToRemove, callbackObjects) => {
|
|
229
|
-
const index = callbackObjects.findIndex((callbackObject) => callbackObject.c === callbackToRemove);
|
|
230
|
-
if (index > -1) {
|
|
231
|
-
callbackObjects.splice(index, 1);
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
/**
|
|
235
|
-
* @internal
|
|
236
|
-
* Add a callback to be fired when an animation is stopped/cancelled.
|
|
237
|
-
* @param callback: A reference to the callback that should be fired
|
|
238
|
-
* @param opts: Any options associated with this particular callback
|
|
239
|
-
*/
|
|
240
|
-
const onStop = (callback, opts) => {
|
|
241
|
-
onStopOneTimeCallbacks.push({ c: callback, o: opts });
|
|
242
|
-
return ani;
|
|
243
|
-
};
|
|
244
221
|
const onFinish = (callback, opts) => {
|
|
245
222
|
const callbacks = (opts === null || opts === void 0 ? void 0 : opts.oneTimeCallback) ? onFinishOneTimeCallbacks : onFinishCallbacks;
|
|
246
223
|
callbacks.push({ c: callback, o: opts });
|
|
@@ -909,33 +886,7 @@ const createAnimation = (animationId) => {
|
|
|
909
886
|
numAnimationsRunning = childAnimations.length + 1;
|
|
910
887
|
shouldCalculateNumAnimations = false;
|
|
911
888
|
}
|
|
912
|
-
|
|
913
|
-
* When one of these callbacks fires we
|
|
914
|
-
* need to clear the other's callback otherwise
|
|
915
|
-
* you can potentially get these callbacks
|
|
916
|
-
* firing multiple times if the play method
|
|
917
|
-
* is subsequently called.
|
|
918
|
-
* Example:
|
|
919
|
-
* animation.play() (onStop and onFinish callbacks are registered)
|
|
920
|
-
* animation.stop() (onStop callback is fired, onFinish is not)
|
|
921
|
-
* animation.play() (onStop and onFinish callbacks are registered)
|
|
922
|
-
* Total onStop callbacks: 1
|
|
923
|
-
* Total onFinish callbacks: 2
|
|
924
|
-
*/
|
|
925
|
-
const onStopCallback = () => {
|
|
926
|
-
clearCallback(onFinishCallback, onFinishOneTimeCallbacks);
|
|
927
|
-
resolve();
|
|
928
|
-
};
|
|
929
|
-
const onFinishCallback = () => {
|
|
930
|
-
clearCallback(onStopCallback, onStopOneTimeCallbacks);
|
|
931
|
-
resolve();
|
|
932
|
-
};
|
|
933
|
-
/**
|
|
934
|
-
* The play method resolves when an animation
|
|
935
|
-
* run either finishes or is cancelled.
|
|
936
|
-
*/
|
|
937
|
-
onFinish(onFinishCallback, { oneTimeCallback: true });
|
|
938
|
-
onStop(onStopCallback, { oneTimeCallback: true });
|
|
889
|
+
onFinish(() => resolve(), { oneTimeCallback: true });
|
|
939
890
|
childAnimations.forEach((animation) => {
|
|
940
891
|
animation.play();
|
|
941
892
|
});
|
|
@@ -948,14 +899,6 @@ const createAnimation = (animationId) => {
|
|
|
948
899
|
paused = false;
|
|
949
900
|
});
|
|
950
901
|
};
|
|
951
|
-
/**
|
|
952
|
-
* Stops an animation and resets it state to the
|
|
953
|
-
* beginning. This does not fire any onFinish
|
|
954
|
-
* callbacks because the animation did not finish.
|
|
955
|
-
* However, since the animation was not destroyed
|
|
956
|
-
* (i.e. the animation could run again) we do not
|
|
957
|
-
* clear the onFinish callbacks.
|
|
958
|
-
*/
|
|
959
902
|
const stop = () => {
|
|
960
903
|
childAnimations.forEach((animation) => {
|
|
961
904
|
animation.stop();
|
|
@@ -965,8 +908,6 @@ const createAnimation = (animationId) => {
|
|
|
965
908
|
initialized = false;
|
|
966
909
|
}
|
|
967
910
|
resetFlags();
|
|
968
|
-
onStopOneTimeCallbacks.forEach((onStopCallback) => onStopCallback.c(0, ani));
|
|
969
|
-
onStopOneTimeCallbacks.length = 0;
|
|
970
911
|
};
|
|
971
912
|
const from = (property, value) => {
|
|
972
913
|
const firstFrame = _keyframes[0];
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
const hardwareBackButton = require('./hardware-back-button-b67c8e75.js');
|
|
7
7
|
const helpers = require('./helpers-ea4ccbcb.js');
|
|
8
8
|
const ionicGlobal = require('./ionic-global-14a0604b.js');
|
|
9
|
-
const animation = require('./animation-
|
|
9
|
+
const animation = require('./animation-2bb33618.js');
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* baseAnimation
|
|
@@ -12,8 +12,8 @@ const LIFECYCLE_WILL_LEAVE = 'ionViewWillLeave';
|
|
|
12
12
|
const LIFECYCLE_DID_LEAVE = 'ionViewDidLeave';
|
|
13
13
|
const LIFECYCLE_WILL_UNLOAD = 'ionViewWillUnload';
|
|
14
14
|
|
|
15
|
-
const iosTransitionAnimation = () => Promise.resolve().then(function () { return require('./ios.transition-
|
|
16
|
-
const mdTransitionAnimation = () => Promise.resolve().then(function () { return require('./md.transition-
|
|
15
|
+
const iosTransitionAnimation = () => Promise.resolve().then(function () { return require('./ios.transition-4b93903d.js'); });
|
|
16
|
+
const mdTransitionAnimation = () => Promise.resolve().then(function () { return require('./md.transition-79f3a215.js'); });
|
|
17
17
|
// TODO(FW-2832): types
|
|
18
18
|
const transition = (opts) => {
|
|
19
19
|
return new Promise((resolve, reject) => {
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
7
|
|
|
8
|
-
const animation = require('./animation-
|
|
9
|
-
const index = require('./index-
|
|
10
|
-
const ios_transition = require('./ios.transition-
|
|
11
|
-
const md_transition = require('./md.transition-
|
|
8
|
+
const animation = require('./animation-2bb33618.js');
|
|
9
|
+
const index = require('./index-b183138a.js');
|
|
10
|
+
const ios_transition = require('./ios.transition-4b93903d.js');
|
|
11
|
+
const md_transition = require('./md.transition-79f3a215.js');
|
|
12
12
|
const cubicBezier = require('./cubic-bezier-6b9222ad.js');
|
|
13
13
|
const index$1 = require('./index-0ee995e4.js');
|
|
14
14
|
const ionicGlobal = require('./ionic-global-14a0604b.js');
|
|
15
15
|
const helpers = require('./helpers-ea4ccbcb.js');
|
|
16
16
|
const config = require('./config-d5882735.js');
|
|
17
|
-
const index$2 = require('./index-
|
|
17
|
+
const index$2 = require('./index-5121bb90.js');
|
|
18
18
|
const overlays = require('./overlays-d3a13e61.js');
|
|
19
19
|
require('./index-306a7476.js');
|
|
20
20
|
require('./index-6f887430.js');
|
|
@@ -12,7 +12,7 @@ const lockController = require('./lock-controller-4ae2eb59.js');
|
|
|
12
12
|
const overlays = require('./overlays-d3a13e61.js');
|
|
13
13
|
const theme = require('./theme-fbc56b3b.js');
|
|
14
14
|
const ionicGlobal = require('./ionic-global-14a0604b.js');
|
|
15
|
-
const animation = require('./animation-
|
|
15
|
+
const animation = require('./animation-2bb33618.js');
|
|
16
16
|
require('./haptic-c5f6b4d5.js');
|
|
17
17
|
require('./capacitor-2ffba62a.js');
|
|
18
18
|
require('./index-306a7476.js');
|
|
@@ -13,7 +13,7 @@ const lockController = require('./lock-controller-4ae2eb59.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-
|
|
16
|
+
const animation = require('./animation-2bb33618.js');
|
|
17
17
|
require('./haptic-c5f6b4d5.js');
|
|
18
18
|
require('./capacitor-2ffba62a.js');
|
|
19
19
|
require('./index-306a7476.js');
|
|
@@ -14,7 +14,7 @@ const index$1 = require('./index-10873539.js');
|
|
|
14
14
|
const keyboardController = require('./keyboard-controller-50beb83a.js');
|
|
15
15
|
const cubicBezier = require('./cubic-bezier-6b9222ad.js');
|
|
16
16
|
const frameworkDelegate = require('./framework-delegate-c0873a6f.js');
|
|
17
|
-
const index$2 = require('./index-
|
|
17
|
+
const index$2 = require('./index-b183138a.js');
|
|
18
18
|
require('./index-cc7dfb7c.js');
|
|
19
19
|
require('./index-306a7476.js');
|
|
20
20
|
require('./keyboard-fd7db491.js');
|
|
@@ -16,7 +16,7 @@ const ionicGlobal = require('./ionic-global-14a0604b.js');
|
|
|
16
16
|
const data = require('./data-db832785.js');
|
|
17
17
|
const lockController = require('./lock-controller-4ae2eb59.js');
|
|
18
18
|
const overlays = require('./overlays-d3a13e61.js');
|
|
19
|
-
const animation = require('./animation-
|
|
19
|
+
const animation = require('./animation-2bb33618.js');
|
|
20
20
|
const haptic = require('./haptic-c5f6b4d5.js');
|
|
21
21
|
require('./index-306a7476.js');
|
|
22
22
|
require('./framework-delegate-c0873a6f.js');
|
|
@@ -12,7 +12,7 @@ const lockController = require('./lock-controller-4ae2eb59.js');
|
|
|
12
12
|
const overlays = require('./overlays-d3a13e61.js');
|
|
13
13
|
const theme = require('./theme-fbc56b3b.js');
|
|
14
14
|
const ionicGlobal = require('./ionic-global-14a0604b.js');
|
|
15
|
-
const animation = require('./animation-
|
|
15
|
+
const animation = require('./animation-2bb33618.js');
|
|
16
16
|
require('./index-306a7476.js');
|
|
17
17
|
require('./framework-delegate-c0873a6f.js');
|
|
18
18
|
require('./hardware-back-button-b67c8e75.js');
|
|
@@ -10,13 +10,13 @@ const cubicBezier = require('./cubic-bezier-6b9222ad.js');
|
|
|
10
10
|
const index$2 = require('./index-306a7476.js');
|
|
11
11
|
const gestureController = require('./gesture-controller-b46721be.js');
|
|
12
12
|
const helpers = require('./helpers-ea4ccbcb.js');
|
|
13
|
-
const index$1 = require('./index-
|
|
13
|
+
const index$1 = require('./index-5121bb90.js');
|
|
14
14
|
const overlays = require('./overlays-d3a13e61.js');
|
|
15
15
|
const ionicGlobal = require('./ionic-global-14a0604b.js');
|
|
16
16
|
const theme = require('./theme-fbc56b3b.js');
|
|
17
17
|
const index$3 = require('./index-d8d1fc0b.js');
|
|
18
18
|
require('./hardware-back-button-b67c8e75.js');
|
|
19
|
-
require('./animation-
|
|
19
|
+
require('./animation-2bb33618.js');
|
|
20
20
|
require('./framework-delegate-c0873a6f.js');
|
|
21
21
|
require('./index-cc7dfb7c.js');
|
|
22
22
|
|
|
@@ -40,14 +40,6 @@ const Menu = class {
|
|
|
40
40
|
this.lastOnEnd = 0;
|
|
41
41
|
this.blocker = gestureController.GESTURE_CONTROLLER.createBlocker({ disableScroll: true });
|
|
42
42
|
this.didLoad = false;
|
|
43
|
-
/**
|
|
44
|
-
* Flag used to determine if an open/close
|
|
45
|
-
* operation was cancelled. For example, if
|
|
46
|
-
* an app calls "menu.open" then disables the menu
|
|
47
|
-
* part way through the animation, then this would
|
|
48
|
-
* be considered a cancelled operation.
|
|
49
|
-
*/
|
|
50
|
-
this.operationCancelled = false;
|
|
51
43
|
this.isAnimating = false;
|
|
52
44
|
this._isOpen = false;
|
|
53
45
|
this.inheritedAttributes = {};
|
|
@@ -313,15 +305,6 @@ const Menu = class {
|
|
|
313
305
|
this.beforeAnimation(shouldOpen);
|
|
314
306
|
await this.loadAnimation();
|
|
315
307
|
await this.startAnimation(shouldOpen, animated);
|
|
316
|
-
/**
|
|
317
|
-
* If the animation was cancelled then
|
|
318
|
-
* return false because the operation
|
|
319
|
-
* did not succeed.
|
|
320
|
-
*/
|
|
321
|
-
if (this.operationCancelled) {
|
|
322
|
-
this.operationCancelled = false;
|
|
323
|
-
return false;
|
|
324
|
-
}
|
|
325
308
|
this.afterAnimation(shouldOpen);
|
|
326
309
|
return true;
|
|
327
310
|
}
|
|
@@ -358,23 +341,18 @@ const Menu = class {
|
|
|
358
341
|
const easingReverse = mode === 'ios' ? iosEasingReverse : mdEasingReverse;
|
|
359
342
|
const ani = this.animation
|
|
360
343
|
.direction(isReversed ? 'reverse' : 'normal')
|
|
361
|
-
.easing(isReversed ? easingReverse : easing)
|
|
344
|
+
.easing(isReversed ? easingReverse : easing)
|
|
345
|
+
.onFinish(() => {
|
|
346
|
+
if (ani.getDirection() === 'reverse') {
|
|
347
|
+
ani.direction('normal');
|
|
348
|
+
}
|
|
349
|
+
});
|
|
362
350
|
if (animated) {
|
|
363
351
|
await ani.play();
|
|
364
352
|
}
|
|
365
353
|
else {
|
|
366
354
|
ani.play({ sync: true });
|
|
367
355
|
}
|
|
368
|
-
/**
|
|
369
|
-
* We run this after the play invocation
|
|
370
|
-
* instead of using ani.onFinish so that
|
|
371
|
-
* multiple onFinish callbacks do not get
|
|
372
|
-
* run if an animation is played, stopped,
|
|
373
|
-
* and then played again.
|
|
374
|
-
*/
|
|
375
|
-
if (ani.getDirection() === 'reverse') {
|
|
376
|
-
ani.direction('normal');
|
|
377
|
-
}
|
|
378
356
|
}
|
|
379
357
|
_isActive() {
|
|
380
358
|
return !this.disabled && !this.isPaneVisible;
|
|
@@ -511,6 +489,7 @@ const Menu = class {
|
|
|
511
489
|
}
|
|
512
490
|
afterAnimation(isOpen) {
|
|
513
491
|
var _a;
|
|
492
|
+
helpers.assert(this.isAnimating, '_before() should be called while animating');
|
|
514
493
|
// keep opening/closing the menu disabled for a touch more yet
|
|
515
494
|
// only add listeners/css if it's enabled and isOpen
|
|
516
495
|
// and only remove listeners/css if it's not open
|
|
@@ -569,29 +548,10 @@ const Menu = class {
|
|
|
569
548
|
if (this.gesture) {
|
|
570
549
|
this.gesture.enable(isActive && this.swipeGesture);
|
|
571
550
|
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
* of animating {open, close} and the menu is disabled
|
|
577
|
-
* then it should still be closed immediately.
|
|
578
|
-
*/
|
|
579
|
-
if (!isActive) {
|
|
580
|
-
/**
|
|
581
|
-
* It is possible to disable the menu while
|
|
582
|
-
* it is mid-animation. When this happens, we
|
|
583
|
-
* need to set the operationCancelled flag
|
|
584
|
-
* so that this._setOpen knows to return false
|
|
585
|
-
* and not run the "afterAnimation" callback.
|
|
586
|
-
*/
|
|
587
|
-
if (this.isAnimating) {
|
|
588
|
-
this.operationCancelled = true;
|
|
589
|
-
}
|
|
590
|
-
/**
|
|
591
|
-
* If the menu is disabled then we should
|
|
592
|
-
* forcibly close the menu even if it is open.
|
|
593
|
-
*/
|
|
594
|
-
this.afterAnimation(false);
|
|
551
|
+
// Close menu immediately
|
|
552
|
+
if (!isActive && this._isOpen) {
|
|
553
|
+
// close if this menu is open, and should not be enabled
|
|
554
|
+
this.forceClosing();
|
|
595
555
|
}
|
|
596
556
|
if (index$2.doc === null || index$2.doc === void 0 ? void 0 : index$2.doc.contains(this.el)) {
|
|
597
557
|
/**
|
|
@@ -604,6 +564,14 @@ const Menu = class {
|
|
|
604
564
|
index$1.menuController._setActiveMenu(this);
|
|
605
565
|
}
|
|
606
566
|
}
|
|
567
|
+
helpers.assert(!this.isAnimating, 'can not be animating');
|
|
568
|
+
}
|
|
569
|
+
forceClosing() {
|
|
570
|
+
helpers.assert(this._isOpen, 'menu cannot be closed');
|
|
571
|
+
this.isAnimating = true;
|
|
572
|
+
const ani = this.animation.direction('reverse');
|
|
573
|
+
ani.play({ sync: true });
|
|
574
|
+
this.afterAnimation(false);
|
|
607
575
|
}
|
|
608
576
|
render() {
|
|
609
577
|
const { type, disabled, isPaneVisible, inheritedAttributes, side } = this;
|
|
@@ -14,10 +14,10 @@ const index$4 = require('./index-cc7dfb7c.js');
|
|
|
14
14
|
const capacitor = require('./capacitor-2ffba62a.js');
|
|
15
15
|
const overlays = require('./overlays-d3a13e61.js');
|
|
16
16
|
const theme = require('./theme-fbc56b3b.js');
|
|
17
|
-
const index$5 = require('./index-
|
|
17
|
+
const index$5 = require('./index-b183138a.js');
|
|
18
18
|
const ionicGlobal = require('./ionic-global-14a0604b.js');
|
|
19
19
|
const keyboard = require('./keyboard-38f2bb7b.js');
|
|
20
|
-
const animation = require('./animation-
|
|
20
|
+
const animation = require('./animation-2bb33618.js');
|
|
21
21
|
const cubicBezier = require('./cubic-bezier-6b9222ad.js');
|
|
22
22
|
const index$1 = require('./index-0ee995e4.js');
|
|
23
23
|
const index = require('./index-306a7476.js');
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
8
8
|
const index = require('./index-6f887430.js');
|
|
9
9
|
const cubicBezier = require('./cubic-bezier-6b9222ad.js');
|
|
10
10
|
const helpers = require('./helpers-ea4ccbcb.js');
|
|
11
|
-
const index$1 = require('./index-
|
|
11
|
+
const index$1 = require('./index-b183138a.js');
|
|
12
12
|
const ionicGlobal = require('./ionic-global-14a0604b.js');
|
|
13
13
|
const frameworkDelegate = require('./framework-delegate-c0873a6f.js');
|
|
14
14
|
|
|
@@ -13,8 +13,8 @@ const index$1 = require('./index-cc7dfb7c.js');
|
|
|
13
13
|
const overlays = require('./overlays-d3a13e61.js');
|
|
14
14
|
const ionicGlobal = require('./ionic-global-14a0604b.js');
|
|
15
15
|
const theme = require('./theme-fbc56b3b.js');
|
|
16
|
-
const index$2 = require('./index-
|
|
17
|
-
const animation = require('./animation-
|
|
16
|
+
const index$2 = require('./index-b183138a.js');
|
|
17
|
+
const animation = require('./animation-2bb33618.js');
|
|
18
18
|
require('./index-306a7476.js');
|
|
19
19
|
require('./hardware-back-button-b67c8e75.js');
|
|
20
20
|
|
|
@@ -11,7 +11,7 @@ const index$1 = require('./index-10873539.js');
|
|
|
11
11
|
const helpers = require('./helpers-ea4ccbcb.js');
|
|
12
12
|
const haptic = require('./haptic-c5f6b4d5.js');
|
|
13
13
|
const ionicGlobal = require('./ionic-global-14a0604b.js');
|
|
14
|
-
const animation = require('./animation-
|
|
14
|
+
const animation = require('./animation-2bb33618.js');
|
|
15
15
|
const config = require('./config-d5882735.js');
|
|
16
16
|
const index$2 = require('./index-d8d1fc0b.js');
|
|
17
17
|
const spinnerConfigs = require('./spinner-configs-f7b5105b.js');
|