voyager-ionic-core 7.5.0 → 7.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ion-title.js +1 -1
- package/components/ios.transition.js +209 -41
- package/dist/cjs/{index-d93fb71d.js → index-eccba000.js} +2 -2
- package/dist/cjs/index.cjs.js +3 -3
- package/dist/cjs/ion-app_8.cjs.entry.js +2 -2
- package/dist/cjs/ion-modal.cjs.entry.js +1 -1
- package/dist/cjs/ion-nav_2.cjs.entry.js +1 -1
- package/dist/cjs/ion-popover.cjs.entry.js +1 -1
- package/dist/cjs/ionic.cjs.js +1 -1
- package/dist/cjs/{ios.transition-a4d545dd.js → ios.transition-5af5991e.js} +210 -42
- package/dist/cjs/{md.transition-80bb961b.js → md.transition-1e740a6a.js} +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/title/title.ios.css +9 -0
- package/dist/collection/utils/transition/ios.transition.js +209 -41
- package/dist/docs.json +2 -2
- package/dist/esm/{index-7d2b2808.js → index-a09eac70.js} +2 -2
- package/dist/esm/index.js +3 -3
- package/dist/esm/ion-app_8.entry.js +2 -2
- package/dist/esm/ion-modal.entry.js +1 -1
- package/dist/esm/ion-nav_2.entry.js +1 -1
- package/dist/esm/ion-popover.entry.js +1 -1
- package/dist/esm/ionic.js +1 -1
- package/dist/esm/{ios.transition-a86d7bbe.js → ios.transition-4d1322d6.js} +210 -42
- package/dist/esm/{md.transition-365ef6b6.js → md.transition-66b425d0.js} +1 -1
- package/dist/esm-es5/index-a09eac70.js +4 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/ion-app_8.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/ios.transition-4d1322d6.js +4 -0
- package/dist/esm-es5/md.transition-66b425d0.js +4 -0
- package/dist/ionic/index.esm.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/ionic.js +1 -1
- package/dist/ionic/p-091c8792.system.js +4 -0
- package/dist/ionic/p-2a8eeef7.system.js +4 -0
- package/dist/ionic/p-61b192a4.system.entry.js +4 -0
- package/dist/ionic/{p-15decbec.entry.js → p-7423746f.entry.js} +1 -1
- package/dist/ionic/{p-5c3e72a8.system.js → p-755b2917.system.js} +1 -1
- package/dist/ionic/{p-e42aaa8b.entry.js → p-8209372c.entry.js} +1 -1
- package/dist/ionic/{p-a7f8dc42.entry.js → p-9e106f58.entry.js} +1 -1
- package/dist/ionic/p-bb055450.system.entry.js +4 -0
- package/dist/ionic/{p-e38a5f77.js → p-c44fe9fd.js} +1 -1
- package/dist/ionic/p-c575a7b8.system.entry.js +4 -0
- package/dist/ionic/p-de68588d.js +4 -0
- package/dist/ionic/p-e028178a.system.js +4 -0
- package/dist/ionic/{p-ced41304.system.js → p-e0f0d55f.system.js} +1 -1
- package/dist/ionic/{p-f34f001c.entry.js → p-e25cb483.entry.js} +1 -1
- package/dist/ionic/p-eb7d0922.js +4 -0
- package/dist/ionic/p-eb8dc56f.system.entry.js +4 -0
- package/dist/types/components/menu/menu-interface.d.ts +15 -4
- package/dist/types/stencil-public-runtime.d.ts +19 -0
- package/dist/types/utils/menu-controller/index.d.ts +2 -21
- package/hydrate/index.js +220 -44
- package/package.json +5 -5
- package/dist/esm-es5/index-7d2b2808.js +0 -4
- package/dist/esm-es5/ios.transition-a86d7bbe.js +0 -4
- package/dist/esm-es5/md.transition-365ef6b6.js +0 -4
- package/dist/ionic/p-128a98e8.system.js +0 -4
- package/dist/ionic/p-16e44585.js +0 -4
- package/dist/ionic/p-2bbf3ac4.system.entry.js +0 -4
- package/dist/ionic/p-95817276.system.entry.js +0 -4
- package/dist/ionic/p-9b9dcc3e.system.entry.js +0 -4
- package/dist/ionic/p-b9047b05.system.js +0 -4
- package/dist/ionic/p-c05315f5.system.entry.js +0 -4
- package/dist/ionic/p-c994fff0.system.js +0 -4
- package/dist/ionic/p-e2bb634f.js +0 -4
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
6
|
const animation = require('./animation-c8bdd3c7.js');
|
|
7
|
-
const index = require('./index-
|
|
7
|
+
const index = require('./index-eccba000.js');
|
|
8
8
|
require('./index-306a7476.js');
|
|
9
9
|
require('./helpers-ea4ccbcb.js');
|
|
10
10
|
require('./index-305a23dc.js');
|
|
@@ -60,60 +60,134 @@ const createLargeTitleTransition = (rootAnimation, rtl, backDirection, enteringE
|
|
|
60
60
|
if (shouldAnimationForward) {
|
|
61
61
|
const leavingLargeTitleBox = leavingLargeTitle.getBoundingClientRect();
|
|
62
62
|
const enteringBackButtonBox = enteringBackButton.getBoundingClientRect();
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
const enteringBackButtonTextEl = shadow(enteringBackButton).querySelector('.button-text');
|
|
64
|
+
const enteringBackButtonTextBox = enteringBackButtonTextEl.getBoundingClientRect();
|
|
65
|
+
const leavingLargeTitleTextEl = shadow(leavingLargeTitle).querySelector('.toolbar-title');
|
|
66
|
+
const leavingLargeTitleTextBox = leavingLargeTitleTextEl.getBoundingClientRect();
|
|
67
|
+
animateLargeTitle(rootAnimation, rtl, backDirection, leavingLargeTitle, leavingLargeTitleBox, leavingLargeTitleTextBox, enteringBackButtonTextEl, enteringBackButtonTextBox);
|
|
68
|
+
animateBackButton(rootAnimation, rtl, backDirection, enteringBackButton, enteringBackButtonBox, enteringBackButtonTextEl, enteringBackButtonTextBox, leavingLargeTitle, leavingLargeTitleTextBox);
|
|
65
69
|
}
|
|
66
70
|
else if (shouldAnimationBackward) {
|
|
67
71
|
const enteringLargeTitleBox = enteringLargeTitle.getBoundingClientRect();
|
|
68
72
|
const leavingBackButtonBox = leavingBackButton.getBoundingClientRect();
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
const leavingBackButtonTextEl = shadow(leavingBackButton).querySelector('.button-text');
|
|
74
|
+
const leavingBackButtonTextBox = leavingBackButtonTextEl.getBoundingClientRect();
|
|
75
|
+
const enteringLargeTitleTextEl = shadow(enteringLargeTitle).querySelector('.toolbar-title');
|
|
76
|
+
const enteringLargeTitleTextBox = enteringLargeTitleTextEl.getBoundingClientRect();
|
|
77
|
+
animateLargeTitle(rootAnimation, rtl, backDirection, enteringLargeTitle, enteringLargeTitleBox, enteringLargeTitleTextBox, leavingBackButtonTextEl, leavingBackButtonTextBox);
|
|
78
|
+
animateBackButton(rootAnimation, rtl, backDirection, leavingBackButton, leavingBackButtonBox, leavingBackButtonTextEl, leavingBackButtonTextBox, enteringLargeTitle, enteringLargeTitleTextBox);
|
|
71
79
|
}
|
|
72
80
|
return {
|
|
73
81
|
forward: shouldAnimationForward,
|
|
74
82
|
backward: shouldAnimationBackward,
|
|
75
83
|
};
|
|
76
84
|
};
|
|
77
|
-
const animateBackButton = (rootAnimation, rtl, backDirection, backButtonEl,
|
|
85
|
+
const animateBackButton = (rootAnimation, rtl, backDirection, backButtonEl, backButtonBox, backButtonTextEl, backButtonTextBox, largeTitleEl, largeTitleTextBox) => {
|
|
86
|
+
var _a, _b;
|
|
78
87
|
const BACK_BUTTON_START_OFFSET = rtl ? `calc(100% - ${backButtonBox.right + 4}px)` : `${backButtonBox.left - 4}px`;
|
|
79
|
-
const START_TEXT_TRANSLATE = rtl ? '7px' : '-7px';
|
|
80
|
-
const END_TEXT_TRANSLATE = rtl ? '-4px' : '4px';
|
|
81
|
-
const ICON_TRANSLATE = rtl ? '-4px' : '4px';
|
|
82
88
|
const TEXT_ORIGIN_X = rtl ? 'right' : 'left';
|
|
83
89
|
const ICON_ORIGIN_X = rtl ? 'left' : 'right';
|
|
90
|
+
const CONTAINER_ORIGIN_X = rtl ? 'right' : 'left';
|
|
91
|
+
/**
|
|
92
|
+
* When the title and back button texts match
|
|
93
|
+
* then they should overlap during the page transition.
|
|
94
|
+
* If the texts do not match up then the back button text scale adjusts
|
|
95
|
+
* to not perfectly match the large title text otherwise the
|
|
96
|
+
* proportions will be incorrect.
|
|
97
|
+
* When the texts match we scale both the width and height to account for
|
|
98
|
+
* font weight differences between the title and back button.
|
|
99
|
+
*/
|
|
100
|
+
const doTitleAndButtonTextsMatch = ((_a = backButtonTextEl.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === ((_b = largeTitleEl.textContent) === null || _b === void 0 ? void 0 : _b.trim());
|
|
101
|
+
const WIDTH_SCALE = largeTitleTextBox.width / backButtonTextBox.width;
|
|
102
|
+
/**
|
|
103
|
+
* We subtract an offset to account for slight sizing/padding
|
|
104
|
+
* differences between the title and the back button.
|
|
105
|
+
*/
|
|
106
|
+
const HEIGHT_SCALE = (largeTitleTextBox.height - LARGE_TITLE_SIZE_OFFSET) / backButtonTextBox.height;
|
|
107
|
+
const TEXT_START_SCALE = doTitleAndButtonTextsMatch
|
|
108
|
+
? `scale(${WIDTH_SCALE}, ${HEIGHT_SCALE})`
|
|
109
|
+
: `scale(${HEIGHT_SCALE})`;
|
|
110
|
+
const TEXT_END_SCALE = 'scale(1)';
|
|
111
|
+
const backButtonIconEl = shadow(backButtonEl).querySelector('ion-icon');
|
|
112
|
+
const backButtonIconBox = backButtonIconEl.getBoundingClientRect();
|
|
113
|
+
/**
|
|
114
|
+
* We need to offset the container by the icon dimensions
|
|
115
|
+
* so that the back button text aligns with the large title
|
|
116
|
+
* text. Otherwise, the back button icon will align with the
|
|
117
|
+
* large title text but the back button text will not.
|
|
118
|
+
*/
|
|
119
|
+
const CONTAINER_START_TRANSLATE_X = rtl
|
|
120
|
+
? `${backButtonIconBox.width / 2 - (backButtonIconBox.right - backButtonBox.right)}px`
|
|
121
|
+
: `${backButtonBox.left - backButtonIconBox.width / 2}px`;
|
|
122
|
+
const CONTAINER_END_TRANSLATE_X = rtl ? `-${window.innerWidth - backButtonBox.right}px` : `${backButtonBox.left}px`;
|
|
123
|
+
/**
|
|
124
|
+
* Back button container should be
|
|
125
|
+
* aligned to the top of the title container
|
|
126
|
+
* so the texts overlap as the back button
|
|
127
|
+
* text begins to fade in.
|
|
128
|
+
*/
|
|
129
|
+
const CONTAINER_START_TRANSLATE_Y = `${largeTitleTextBox.top}px`;
|
|
130
|
+
/**
|
|
131
|
+
* The cloned back button should align exactly with the
|
|
132
|
+
* real back button on the entering page otherwise there will
|
|
133
|
+
* be a layout shift.
|
|
134
|
+
*/
|
|
135
|
+
const CONTAINER_END_TRANSLATE_Y = `${backButtonBox.top}px`;
|
|
136
|
+
/**
|
|
137
|
+
* In the forward direction, the cloned back button
|
|
138
|
+
* container should translate from over the large title
|
|
139
|
+
* to over the back button. In the backward direction,
|
|
140
|
+
* it should translate from over the back button to over
|
|
141
|
+
* the large title.
|
|
142
|
+
*/
|
|
143
|
+
const FORWARD_CONTAINER_KEYFRAMES = [
|
|
144
|
+
{ offset: 0, transform: `translate3d(${CONTAINER_START_TRANSLATE_X}, ${CONTAINER_START_TRANSLATE_Y}, 0)` },
|
|
145
|
+
{ offset: 1, transform: `translate3d(${CONTAINER_END_TRANSLATE_X}, ${CONTAINER_END_TRANSLATE_Y}, 0)` },
|
|
146
|
+
];
|
|
147
|
+
const BACKWARD_CONTAINER_KEYFRAMES = [
|
|
148
|
+
{ offset: 0, transform: `translate3d(${CONTAINER_END_TRANSLATE_X}, ${CONTAINER_END_TRANSLATE_Y}, 0)` },
|
|
149
|
+
{ offset: 1, transform: `translate3d(${CONTAINER_START_TRANSLATE_X}, ${CONTAINER_START_TRANSLATE_Y}, 0)` },
|
|
150
|
+
];
|
|
151
|
+
const CONTAINER_KEYFRAMES = backDirection ? BACKWARD_CONTAINER_KEYFRAMES : FORWARD_CONTAINER_KEYFRAMES;
|
|
152
|
+
/**
|
|
153
|
+
* In the forward direction, the text in the cloned back button
|
|
154
|
+
* should start to be (roughly) the size of the large title
|
|
155
|
+
* and then scale down to be the size of the actual back button.
|
|
156
|
+
* The text should also translate, but that translate is handled
|
|
157
|
+
* by the container keyframes.
|
|
158
|
+
*/
|
|
84
159
|
const FORWARD_TEXT_KEYFRAMES = [
|
|
85
|
-
{
|
|
86
|
-
|
|
87
|
-
opacity: 0,
|
|
88
|
-
transform: `translate3d(${START_TEXT_TRANSLATE}, ${largeTitleBox.top - 40}px, 0) scale(2.1)`,
|
|
89
|
-
},
|
|
90
|
-
{ offset: 1, opacity: 1, transform: `translate3d(${END_TEXT_TRANSLATE}, ${backButtonBox.top - 46}px, 0) scale(1)` },
|
|
160
|
+
{ offset: 0, opacity: 0, transform: TEXT_START_SCALE },
|
|
161
|
+
{ offset: 1, opacity: 1, transform: TEXT_END_SCALE },
|
|
91
162
|
];
|
|
92
163
|
const BACKWARD_TEXT_KEYFRAMES = [
|
|
93
|
-
{ offset: 0, opacity: 1, transform:
|
|
94
|
-
{ offset:
|
|
95
|
-
{
|
|
96
|
-
offset: 1,
|
|
97
|
-
opacity: 0,
|
|
98
|
-
transform: `translate3d(${START_TEXT_TRANSLATE}, ${largeTitleBox.top - 40}px, 0) scale(2.1)`,
|
|
99
|
-
},
|
|
164
|
+
{ offset: 0, opacity: 1, transform: TEXT_END_SCALE },
|
|
165
|
+
{ offset: 1, opacity: 0, transform: TEXT_START_SCALE },
|
|
100
166
|
];
|
|
101
167
|
const TEXT_KEYFRAMES = backDirection ? BACKWARD_TEXT_KEYFRAMES : FORWARD_TEXT_KEYFRAMES;
|
|
168
|
+
/**
|
|
169
|
+
* The icon should scale in/out in the second
|
|
170
|
+
* half of the animation. The icon should also
|
|
171
|
+
* translate, but that translate is handled by the
|
|
172
|
+
* container keyframes.
|
|
173
|
+
*/
|
|
102
174
|
const FORWARD_ICON_KEYFRAMES = [
|
|
103
|
-
{ offset: 0, opacity: 0, transform:
|
|
104
|
-
{ offset:
|
|
175
|
+
{ offset: 0, opacity: 0, transform: 'scale(0.6)' },
|
|
176
|
+
{ offset: 0.6, opacity: 0, transform: 'scale(0.6)' },
|
|
177
|
+
{ offset: 1, opacity: 1, transform: 'scale(1)' },
|
|
105
178
|
];
|
|
106
179
|
const BACKWARD_ICON_KEYFRAMES = [
|
|
107
|
-
{ offset: 0, opacity: 1, transform:
|
|
108
|
-
{ offset: 0.2, opacity: 0, transform:
|
|
109
|
-
{ offset: 1, opacity: 0, transform:
|
|
180
|
+
{ offset: 0, opacity: 1, transform: 'scale(1)' },
|
|
181
|
+
{ offset: 0.2, opacity: 0, transform: 'scale(0.6)' },
|
|
182
|
+
{ offset: 1, opacity: 0, transform: 'scale(0.6)' },
|
|
110
183
|
];
|
|
111
184
|
const ICON_KEYFRAMES = backDirection ? BACKWARD_ICON_KEYFRAMES : FORWARD_ICON_KEYFRAMES;
|
|
112
185
|
const enteringBackButtonTextAnimation = animation.createAnimation();
|
|
113
186
|
const enteringBackButtonIconAnimation = animation.createAnimation();
|
|
187
|
+
const enteringBackButtonAnimation = animation.createAnimation();
|
|
114
188
|
const clonedBackButtonEl = getClonedElement('ion-back-button');
|
|
115
|
-
const
|
|
116
|
-
const
|
|
189
|
+
const clonedBackButtonTextEl = shadow(clonedBackButtonEl).querySelector('.button-text');
|
|
190
|
+
const clonedBackButtonIconEl = shadow(clonedBackButtonEl).querySelector('ion-icon');
|
|
117
191
|
clonedBackButtonEl.text = backButtonEl.text;
|
|
118
192
|
clonedBackButtonEl.mode = backButtonEl.mode;
|
|
119
193
|
clonedBackButtonEl.icon = backButtonEl.icon;
|
|
@@ -121,11 +195,19 @@ const animateBackButton = (rootAnimation, rtl, backDirection, backButtonEl, larg
|
|
|
121
195
|
clonedBackButtonEl.disabled = backButtonEl.disabled;
|
|
122
196
|
clonedBackButtonEl.style.setProperty('display', 'block');
|
|
123
197
|
clonedBackButtonEl.style.setProperty('position', 'fixed');
|
|
124
|
-
enteringBackButtonIconAnimation.addElement(
|
|
125
|
-
enteringBackButtonTextAnimation.addElement(
|
|
198
|
+
enteringBackButtonIconAnimation.addElement(clonedBackButtonIconEl);
|
|
199
|
+
enteringBackButtonTextAnimation.addElement(clonedBackButtonTextEl);
|
|
200
|
+
enteringBackButtonAnimation.addElement(clonedBackButtonEl);
|
|
201
|
+
enteringBackButtonAnimation
|
|
202
|
+
.beforeStyles({
|
|
203
|
+
position: 'absolute',
|
|
204
|
+
top: '0px',
|
|
205
|
+
[CONTAINER_ORIGIN_X]: '0px',
|
|
206
|
+
})
|
|
207
|
+
.keyframes(CONTAINER_KEYFRAMES);
|
|
126
208
|
enteringBackButtonTextAnimation
|
|
127
209
|
.beforeStyles({
|
|
128
|
-
'transform-origin': `${TEXT_ORIGIN_X}
|
|
210
|
+
'transform-origin': `${TEXT_ORIGIN_X} top`,
|
|
129
211
|
})
|
|
130
212
|
.beforeAddWrite(() => {
|
|
131
213
|
backButtonEl.style.setProperty('display', 'none');
|
|
@@ -142,21 +224,91 @@ const animateBackButton = (rootAnimation, rtl, backDirection, backButtonEl, larg
|
|
|
142
224
|
'transform-origin': `${ICON_ORIGIN_X} center`,
|
|
143
225
|
})
|
|
144
226
|
.keyframes(ICON_KEYFRAMES);
|
|
145
|
-
rootAnimation.addAnimation([
|
|
227
|
+
rootAnimation.addAnimation([
|
|
228
|
+
enteringBackButtonTextAnimation,
|
|
229
|
+
enteringBackButtonIconAnimation,
|
|
230
|
+
enteringBackButtonAnimation,
|
|
231
|
+
]);
|
|
146
232
|
};
|
|
147
|
-
const animateLargeTitle = (rootAnimation, rtl, backDirection, largeTitleEl, largeTitleBox,
|
|
148
|
-
|
|
149
|
-
|
|
233
|
+
const animateLargeTitle = (rootAnimation, rtl, backDirection, largeTitleEl, largeTitleBox, largeTitleTextBox, backButtonTextEl, backButtonTextBox) => {
|
|
234
|
+
var _a, _b;
|
|
235
|
+
/**
|
|
236
|
+
* The horizontal transform origin for the large title
|
|
237
|
+
*/
|
|
150
238
|
const ORIGIN_X = rtl ? 'right' : 'left';
|
|
239
|
+
const TITLE_START_OFFSET = rtl ? `calc(100% - ${largeTitleBox.right}px)` : `${largeTitleBox.left}px`;
|
|
240
|
+
/**
|
|
241
|
+
* The cloned large should align exactly with the
|
|
242
|
+
* real large title on the leaving page otherwise there will
|
|
243
|
+
* be a layout shift.
|
|
244
|
+
*/
|
|
245
|
+
const START_TRANSLATE_X = '0px';
|
|
246
|
+
const START_TRANSLATE_Y = `${largeTitleBox.top}px`;
|
|
247
|
+
/**
|
|
248
|
+
* How much to offset the large title translation by.
|
|
249
|
+
* This accounts for differences in sizing between the large
|
|
250
|
+
* title and the back button due to padding and font weight.
|
|
251
|
+
*/
|
|
252
|
+
const LARGE_TITLE_TRANSLATION_OFFSET = 8;
|
|
253
|
+
/**
|
|
254
|
+
* The scaled title should (roughly) overlap the back button.
|
|
255
|
+
* This ensures that the back button and title overlap during
|
|
256
|
+
* the animation. Note that since both elements either fade in
|
|
257
|
+
* or fade out over the course of the animation, neither element
|
|
258
|
+
* will be fully visible on top of the other. As a result, the overlap
|
|
259
|
+
* does not need to be perfect, so approximate values are acceptable here.
|
|
260
|
+
*/
|
|
261
|
+
const END_TRANSLATE_X = rtl
|
|
262
|
+
? `-${window.innerWidth - backButtonTextBox.right - LARGE_TITLE_TRANSLATION_OFFSET}px`
|
|
263
|
+
: `${backButtonTextBox.x - LARGE_TITLE_TRANSLATION_OFFSET}px`;
|
|
264
|
+
/**
|
|
265
|
+
* The top of the scaled large title
|
|
266
|
+
* should match with the top of the
|
|
267
|
+
* back button text element.
|
|
268
|
+
* We subtract 2px to account for the top padding
|
|
269
|
+
* on the large title element.
|
|
270
|
+
*/
|
|
271
|
+
const LARGE_TITLE_TOP_PADDING = 2;
|
|
272
|
+
const END_TRANSLATE_Y = `${backButtonTextBox.y - LARGE_TITLE_TOP_PADDING}px`;
|
|
273
|
+
/**
|
|
274
|
+
* In the forward direction, the large title should start at its
|
|
275
|
+
* normal size and then scale down to be (roughly) the size of the
|
|
276
|
+
* back button on the other view. In the backward direction, the
|
|
277
|
+
* large title should start at (roughly) the size of the back button
|
|
278
|
+
* and then scale up to its original size.
|
|
279
|
+
*
|
|
280
|
+
* Note that since both elements either fade in
|
|
281
|
+
* or fade out over the course of the animation, neither element
|
|
282
|
+
* will be fully visible on top of the other. As a result, the overlap
|
|
283
|
+
* does not need to be perfect, so approximate values are acceptable here.
|
|
284
|
+
*/
|
|
285
|
+
/**
|
|
286
|
+
* When the title and back button texts match
|
|
287
|
+
* then they should overlap during the page transition.
|
|
288
|
+
* If the texts do not match up then the large title text scale adjusts
|
|
289
|
+
* to not perfectly match the back button text otherwise the
|
|
290
|
+
* proportions will be incorrect.
|
|
291
|
+
* When the texts match we scale both the width and height to account for
|
|
292
|
+
* font weight differences between the title and back button.
|
|
293
|
+
*/
|
|
294
|
+
const doTitleAndButtonTextsMatch = ((_a = backButtonTextEl.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === ((_b = largeTitleEl.textContent) === null || _b === void 0 ? void 0 : _b.trim());
|
|
295
|
+
const WIDTH_SCALE = backButtonTextBox.width / largeTitleTextBox.width;
|
|
296
|
+
const HEIGHT_SCALE = backButtonTextBox.height / (largeTitleTextBox.height - LARGE_TITLE_SIZE_OFFSET);
|
|
297
|
+
const START_SCALE = 'scale(1)';
|
|
298
|
+
const END_SCALE = doTitleAndButtonTextsMatch ? `scale(${WIDTH_SCALE}, ${HEIGHT_SCALE})` : `scale(${HEIGHT_SCALE})`;
|
|
151
299
|
const BACKWARDS_KEYFRAMES = [
|
|
152
|
-
{ offset: 0, opacity: 0, transform: `translate3d(${
|
|
300
|
+
{ offset: 0, opacity: 0, transform: `translate3d(${END_TRANSLATE_X}, ${END_TRANSLATE_Y}, 0) ${END_SCALE}` },
|
|
153
301
|
{ offset: 0.1, opacity: 0 },
|
|
154
|
-
{ offset: 1, opacity: 1, transform: `translate3d(
|
|
302
|
+
{ offset: 1, opacity: 1, transform: `translate3d(${START_TRANSLATE_X}, ${START_TRANSLATE_Y}, 0) ${START_SCALE}` },
|
|
155
303
|
];
|
|
156
304
|
const FORWARDS_KEYFRAMES = [
|
|
157
|
-
{
|
|
305
|
+
{
|
|
306
|
+
offset: 0,
|
|
307
|
+
opacity: 0.99,
|
|
308
|
+
transform: `translate3d(${START_TRANSLATE_X}, ${START_TRANSLATE_Y}, 0) ${START_SCALE}`,
|
|
309
|
+
},
|
|
158
310
|
{ offset: 0.6, opacity: 0 },
|
|
159
|
-
{ offset: 1, opacity: 0, transform: `translate3d(${
|
|
311
|
+
{ offset: 1, opacity: 0, transform: `translate3d(${END_TRANSLATE_X}, ${END_TRANSLATE_Y}, 0) ${END_SCALE}` },
|
|
160
312
|
];
|
|
161
313
|
const KEYFRAMES = backDirection ? BACKWARDS_KEYFRAMES : FORWARDS_KEYFRAMES;
|
|
162
314
|
const clonedTitleEl = getClonedElement('ion-title');
|
|
@@ -167,8 +319,14 @@ const animateLargeTitle = (rootAnimation, rtl, backDirection, largeTitleEl, larg
|
|
|
167
319
|
clonedLargeTitleAnimation.addElement(clonedTitleEl);
|
|
168
320
|
clonedLargeTitleAnimation
|
|
169
321
|
.beforeStyles({
|
|
170
|
-
'transform-origin': `${ORIGIN_X}
|
|
171
|
-
|
|
322
|
+
'transform-origin': `${ORIGIN_X} top`,
|
|
323
|
+
/**
|
|
324
|
+
* Since font size changes will cause
|
|
325
|
+
* the dimension of the large title to change
|
|
326
|
+
* we need to set the cloned title height
|
|
327
|
+
* equal to that of the original large title height.
|
|
328
|
+
*/
|
|
329
|
+
height: `${largeTitleBox.height}px`,
|
|
172
330
|
display: '',
|
|
173
331
|
position: 'relative',
|
|
174
332
|
[ORIGIN_X]: TITLE_START_OFFSET,
|
|
@@ -481,6 +639,16 @@ const iosTransitionAnimation = (navEl, opts) => {
|
|
|
481
639
|
throw err;
|
|
482
640
|
}
|
|
483
641
|
};
|
|
642
|
+
/**
|
|
643
|
+
* The scale of the back button during the animation
|
|
644
|
+
* is computed based on the scale of the large title
|
|
645
|
+
* and vice versa. However, we need to account for slight
|
|
646
|
+
* variations in the size of the large title due to
|
|
647
|
+
* padding and font weight. This value should be used to subtract
|
|
648
|
+
* a small amount from the large title height when computing scales
|
|
649
|
+
* to get more accurate scale results.
|
|
650
|
+
*/
|
|
651
|
+
const LARGE_TITLE_SIZE_OFFSET = 10;
|
|
484
652
|
|
|
485
653
|
exports.iosTransitionAnimation = iosTransitionAnimation;
|
|
486
654
|
exports.shadow = shadow;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
6
|
const animation = require('./animation-c8bdd3c7.js');
|
|
7
|
-
const index = require('./index-
|
|
7
|
+
const index = require('./index-eccba000.js');
|
|
8
8
|
require('./index-306a7476.js');
|
|
9
9
|
require('./helpers-ea4ccbcb.js');
|
|
10
10
|
require('./index-305a23dc.js');
|
|
@@ -140,6 +140,15 @@
|
|
|
140
140
|
|
|
141
141
|
:host(.title-large) .toolbar-title {
|
|
142
142
|
transform-origin: inherit;
|
|
143
|
+
/**
|
|
144
|
+
* During a page transition
|
|
145
|
+
* if the large title and the back button
|
|
146
|
+
* texts match up, the back button should be
|
|
147
|
+
* scaled to roughly match the dimensions of
|
|
148
|
+
* the large title text. The following line
|
|
149
|
+
* ensures that the scale values are accurate.
|
|
150
|
+
*/
|
|
151
|
+
width: auto;
|
|
143
152
|
}
|
|
144
153
|
:host-context([dir=rtl]):host(.title-large) .toolbar-title, :host-context([dir=rtl]).title-large .toolbar-title {
|
|
145
154
|
transform-origin: calc(100% - inherit);
|