@ionic/core 7.8.5-dev.11712853167.1d02271c → 7.8.5-nightly.20240412

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 (51) hide show
  1. package/components/ios.transition.js +67 -90
  2. package/dist/cjs/{index-034460de.js → index-1f7c54f8.js} +2 -2
  3. package/dist/cjs/index.cjs.js +3 -3
  4. package/dist/cjs/ion-app_8.cjs.entry.js +1 -1
  5. package/dist/cjs/ion-modal.cjs.entry.js +1 -1
  6. package/dist/cjs/ion-nav_2.cjs.entry.js +1 -1
  7. package/dist/cjs/ion-popover.cjs.entry.js +1 -1
  8. package/dist/cjs/{ios.transition-26c5adb2.js → ios.transition-30830fc4.js} +68 -91
  9. package/dist/cjs/{md.transition-75533d44.js → md.transition-7f581866.js} +1 -1
  10. package/dist/collection/utils/transition/ios.transition.js +67 -90
  11. package/dist/docs.json +1 -1
  12. package/dist/esm/{index-68278972.js → index-fae1515c.js} +2 -2
  13. package/dist/esm/index.js +3 -3
  14. package/dist/esm/ion-app_8.entry.js +1 -1
  15. package/dist/esm/ion-modal.entry.js +1 -1
  16. package/dist/esm/ion-nav_2.entry.js +1 -1
  17. package/dist/esm/ion-popover.entry.js +1 -1
  18. package/dist/esm/{ios.transition-471e5da1.js → ios.transition-a50a9a55.js} +68 -91
  19. package/dist/esm/{md.transition-12c07448.js → md.transition-0da92976.js} +1 -1
  20. package/dist/esm-es5/{index-68278972.js → index-fae1515c.js} +1 -1
  21. package/dist/esm-es5/index.js +1 -1
  22. package/dist/esm-es5/ion-app_8.entry.js +1 -1
  23. package/dist/esm-es5/ion-modal.entry.js +1 -1
  24. package/dist/esm-es5/ion-nav_2.entry.js +1 -1
  25. package/dist/esm-es5/ion-popover.entry.js +1 -1
  26. package/dist/esm-es5/ios.transition-a50a9a55.js +4 -0
  27. package/dist/esm-es5/{md.transition-12c07448.js → md.transition-0da92976.js} +1 -1
  28. package/dist/ionic/index.esm.js +1 -1
  29. package/dist/ionic/ionic.esm.js +1 -1
  30. package/dist/ionic/p-0047bd0e.js +4 -0
  31. package/dist/ionic/{p-99d8b626.entry.js → p-05c69a9b.entry.js} +1 -1
  32. package/dist/ionic/{p-85ea810f.system.js → p-0609a7d8.system.js} +1 -1
  33. package/dist/ionic/{p-be403dff.entry.js → p-19dd9808.entry.js} +1 -1
  34. package/dist/ionic/{p-4e9552a3.js → p-1cd372ed.js} +1 -1
  35. package/dist/ionic/{p-815c676c.entry.js → p-200d971f.entry.js} +1 -1
  36. package/dist/ionic/{p-a258956b.system.entry.js → p-52f1dc25.system.entry.js} +1 -1
  37. package/dist/ionic/p-6a6550fa.js +4 -0
  38. package/dist/ionic/p-6ecddf53.system.js +4 -0
  39. package/dist/ionic/{p-8444e4c0.entry.js → p-83090da8.entry.js} +1 -1
  40. package/dist/ionic/{p-f3d07c09.system.entry.js → p-a4151856.system.entry.js} +1 -1
  41. package/dist/ionic/{p-9d3363aa.system.entry.js → p-ac8686ab.system.entry.js} +1 -1
  42. package/dist/ionic/{p-414c5031.system.entry.js → p-ba87a6dd.system.entry.js} +1 -1
  43. package/dist/ionic/{p-8668ffee.system.js → p-e0948431.system.js} +1 -1
  44. package/dist/ionic/p-e933e886.system.js +1 -1
  45. package/dist/ionic/{p-0020292d.system.js → p-f4fb429a.system.js} +1 -1
  46. package/hydrate/index.js +73 -96
  47. package/package.json +1 -1
  48. package/dist/esm-es5/ios.transition-471e5da1.js +0 -4
  49. package/dist/ionic/p-1a244094.js +0 -4
  50. package/dist/ionic/p-3420329d.js +0 -4
  51. package/dist/ionic/p-de6623db.system.js +0 -4
@@ -56,22 +56,20 @@ const createLargeTitleTransition = (rootAnimation, rtl, backDirection, enteringE
56
56
  const leavingLargeTitleBox = leavingLargeTitle.getBoundingClientRect();
57
57
  const enteringBackButtonBox = enteringBackButton.getBoundingClientRect();
58
58
  const enteringBackButtonTextEl = shadow(enteringBackButton).querySelector('.button-text');
59
- // Text element not rendered if developers pass text="" to the back button
60
- const enteringBackButtonTextBox = enteringBackButtonTextEl === null || enteringBackButtonTextEl === void 0 ? void 0 : enteringBackButtonTextEl.getBoundingClientRect();
59
+ const enteringBackButtonTextBox = enteringBackButtonTextEl.getBoundingClientRect();
61
60
  const leavingLargeTitleTextEl = shadow(leavingLargeTitle).querySelector('.toolbar-title');
62
61
  const leavingLargeTitleTextBox = leavingLargeTitleTextEl.getBoundingClientRect();
63
- animateLargeTitle(rootAnimation, rtl, backDirection, leavingLargeTitle, leavingLargeTitleBox, leavingLargeTitleTextBox, enteringBackButtonBox, enteringBackButtonTextEl, enteringBackButtonTextBox);
62
+ animateLargeTitle(rootAnimation, rtl, backDirection, leavingLargeTitle, leavingLargeTitleBox, leavingLargeTitleTextBox, enteringBackButtonTextEl, enteringBackButtonTextBox);
64
63
  animateBackButton(rootAnimation, rtl, backDirection, enteringBackButton, enteringBackButtonBox, enteringBackButtonTextEl, enteringBackButtonTextBox, leavingLargeTitle, leavingLargeTitleTextBox);
65
64
  }
66
65
  else if (shouldAnimationBackward) {
67
66
  const enteringLargeTitleBox = enteringLargeTitle.getBoundingClientRect();
68
67
  const leavingBackButtonBox = leavingBackButton.getBoundingClientRect();
69
68
  const leavingBackButtonTextEl = shadow(leavingBackButton).querySelector('.button-text');
70
- // Text element not rendered if developers pass text="" to the back button
71
- const leavingBackButtonTextBox = leavingBackButtonTextEl === null || leavingBackButtonTextEl === void 0 ? void 0 : leavingBackButtonTextEl.getBoundingClientRect();
69
+ const leavingBackButtonTextBox = leavingBackButtonTextEl.getBoundingClientRect();
72
70
  const enteringLargeTitleTextEl = shadow(enteringLargeTitle).querySelector('.toolbar-title');
73
71
  const enteringLargeTitleTextBox = enteringLargeTitleTextEl.getBoundingClientRect();
74
- animateLargeTitle(rootAnimation, rtl, backDirection, enteringLargeTitle, enteringLargeTitleBox, enteringLargeTitleTextBox, leavingBackButtonBox, leavingBackButtonTextEl, leavingBackButtonTextBox);
72
+ animateLargeTitle(rootAnimation, rtl, backDirection, enteringLargeTitle, enteringLargeTitleBox, enteringLargeTitleTextBox, leavingBackButtonTextEl, leavingBackButtonTextBox);
75
73
  animateBackButton(rootAnimation, rtl, backDirection, leavingBackButton, leavingBackButtonBox, leavingBackButtonTextEl, leavingBackButtonTextBox, enteringLargeTitle, enteringLargeTitleTextBox);
76
74
  }
77
75
  return {
@@ -85,29 +83,26 @@ const animateBackButton = (rootAnimation, rtl, backDirection, backButtonEl, back
85
83
  const TEXT_ORIGIN_X = rtl ? 'right' : 'left';
86
84
  const ICON_ORIGIN_X = rtl ? 'left' : 'right';
87
85
  const CONTAINER_ORIGIN_X = rtl ? 'right' : 'left';
88
- let WIDTH_SCALE = 1;
89
- let HEIGHT_SCALE = 1;
90
- let TEXT_START_SCALE = `scale(${HEIGHT_SCALE})`;
86
+ /**
87
+ * When the title and back button texts match
88
+ * then they should overlap during the page transition.
89
+ * If the texts do not match up then the back button text scale adjusts
90
+ * to not perfectly match the large title text otherwise the
91
+ * proportions will be incorrect.
92
+ * When the texts match we scale both the width and height to account for
93
+ * font weight differences between the title and back button.
94
+ */
95
+ const doTitleAndButtonTextsMatch = ((_a = backButtonTextEl.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === ((_b = largeTitleEl.textContent) === null || _b === void 0 ? void 0 : _b.trim());
96
+ const WIDTH_SCALE = largeTitleTextBox.width / backButtonTextBox.width;
97
+ /**
98
+ * We subtract an offset to account for slight sizing/padding
99
+ * differences between the title and the back button.
100
+ */
101
+ const HEIGHT_SCALE = (largeTitleTextBox.height - LARGE_TITLE_SIZE_OFFSET) / backButtonTextBox.height;
102
+ const TEXT_START_SCALE = doTitleAndButtonTextsMatch
103
+ ? `scale(${WIDTH_SCALE}, ${HEIGHT_SCALE})`
104
+ : `scale(${HEIGHT_SCALE})`;
91
105
  const TEXT_END_SCALE = 'scale(1)';
92
- if (backButtonTextEl && backButtonTextBox) {
93
- /**
94
- * When the title and back button texts match then they should overlap during the
95
- * page transition. If the texts do not match up then the back button text scale
96
- * adjusts to not perfectly match the large title text otherwise the proportions
97
- * will be incorrect. When the texts match we scale both the width and height to
98
- * account for 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
- WIDTH_SCALE = largeTitleTextBox.width / backButtonTextBox.width;
102
- /**
103
- * Subtract an offset to account for slight sizing/padding differences between the
104
- * title and the back button.
105
- */
106
- HEIGHT_SCALE = (largeTitleTextBox.height - LARGE_TITLE_SIZE_OFFSET) / backButtonTextBox.height;
107
- if (doTitleAndButtonTextsMatch) {
108
- TEXT_START_SCALE = `scale(${WIDTH_SCALE}, ${HEIGHT_SCALE})`;
109
- }
110
- }
111
106
  const backButtonIconEl = shadow(backButtonEl).querySelector('ion-icon');
112
107
  const backButtonIconBox = backButtonIconEl.getBoundingClientRect();
113
108
  /**
@@ -204,11 +199,11 @@ const animateBackButton = (rootAnimation, rtl, backDirection, backButtonEl, back
204
199
  top: '0px',
205
200
  [CONTAINER_ORIGIN_X]: '0px',
206
201
  })
207
- /**
208
- * The write hooks must be set on this animation as it is guaranteed to run. Other
209
- * animations such as the back button text animation will not run if the back button
210
- * has no visible text.
211
- */
202
+ .keyframes(CONTAINER_KEYFRAMES);
203
+ enteringBackButtonTextAnimation
204
+ .beforeStyles({
205
+ 'transform-origin': `${TEXT_ORIGIN_X} top`,
206
+ })
212
207
  .beforeAddWrite(() => {
213
208
  backButtonEl.style.setProperty('display', 'none');
214
209
  clonedBackButtonEl.style.setProperty(TEXT_ORIGIN_X, BACK_BUTTON_START_OFFSET);
@@ -217,11 +212,6 @@ const animateBackButton = (rootAnimation, rtl, backDirection, backButtonEl, back
217
212
  backButtonEl.style.setProperty('display', '');
218
213
  clonedBackButtonEl.style.setProperty('display', 'none');
219
214
  clonedBackButtonEl.style.removeProperty(TEXT_ORIGIN_X);
220
- })
221
- .keyframes(CONTAINER_KEYFRAMES);
222
- enteringBackButtonTextAnimation
223
- .beforeStyles({
224
- 'transform-origin': `${TEXT_ORIGIN_X} top`,
225
215
  })
226
216
  .keyframes(TEXT_KEYFRAMES);
227
217
  enteringBackButtonIconAnimation
@@ -235,7 +225,7 @@ const animateBackButton = (rootAnimation, rtl, backDirection, backButtonEl, back
235
225
  enteringBackButtonAnimation,
236
226
  ]);
237
227
  };
238
- const animateLargeTitle = (rootAnimation, rtl, backDirection, largeTitleEl, largeTitleBox, largeTitleTextBox, backButtonBox, backButtonTextEl, backButtonTextBox) => {
228
+ const animateLargeTitle = (rootAnimation, rtl, backDirection, largeTitleEl, largeTitleBox, largeTitleTextBox, backButtonTextEl, backButtonTextBox) => {
239
229
  var _a, _b;
240
230
  /**
241
231
  * The horizontal transform origin for the large title
@@ -255,65 +245,52 @@ const animateLargeTitle = (rootAnimation, rtl, backDirection, largeTitleEl, larg
255
245
  * title and the back button due to padding and font weight.
256
246
  */
257
247
  const LARGE_TITLE_TRANSLATION_OFFSET = 8;
258
- let END_TRANSLATE_X = rtl
259
- ? `-${window.innerWidth - backButtonBox.right - LARGE_TITLE_TRANSLATION_OFFSET}px`
260
- : `${backButtonBox.x + LARGE_TITLE_TRANSLATION_OFFSET}px`;
261
248
  /**
262
- * How much to scale the large title up/down by.
249
+ * The scaled title should (roughly) overlap the back button.
250
+ * This ensures that the back button and title overlap during
251
+ * the animation. Note that since both elements either fade in
252
+ * or fade out over the course of the animation, neither element
253
+ * will be fully visible on top of the other. As a result, the overlap
254
+ * does not need to be perfect, so approximate values are acceptable here.
263
255
  */
264
- let HEIGHT_SCALE = 0.5;
256
+ const END_TRANSLATE_X = rtl
257
+ ? `-${window.innerWidth - backButtonTextBox.right - LARGE_TITLE_TRANSLATION_OFFSET}px`
258
+ : `${backButtonTextBox.x - LARGE_TITLE_TRANSLATION_OFFSET}px`;
265
259
  /**
266
- * The large title always starts full size.
260
+ * The top of the scaled large title
261
+ * should match with the top of the
262
+ * back button text element.
263
+ * We subtract 2px to account for the top padding
264
+ * on the large title element.
267
265
  */
268
- const START_SCALE = 'scale(1)';
266
+ const LARGE_TITLE_TOP_PADDING = 2;
267
+ const END_TRANSLATE_Y = `${backButtonTextBox.y - LARGE_TITLE_TOP_PADDING}px`;
269
268
  /**
270
- * By default, we don't worry about having the large title scaled to perfectly
271
- * match the back button because we don't know if the back button's text matches
272
- * the large title's text.
269
+ * In the forward direction, the large title should start at its
270
+ * normal size and then scale down to be (roughly) the size of the
271
+ * back button on the other view. In the backward direction, the
272
+ * large title should start at (roughly) the size of the back button
273
+ * and then scale up to its original size.
274
+ *
275
+ * Note that since both elements either fade in
276
+ * or fade out over the course of the animation, neither element
277
+ * will be fully visible on top of the other. As a result, the overlap
278
+ * does not need to be perfect, so approximate values are acceptable here.
273
279
  */
274
- let END_SCALE = `scale(${HEIGHT_SCALE})`;
275
- // Text element not rendered if developers pass text="" to the back button
276
- if (backButtonTextEl && backButtonTextBox) {
277
- /**
278
- * The scaled title should (roughly) overlap the back button. This ensures that
279
- * the back button and title overlap during the animation. Note that since both
280
- * elements either fade in or fade out over the course of the animation, neither
281
- * element will be fully visible on top of the other. As a result, the overlap
282
- * does not need to be perfect, so approximate values are acceptable here.
283
- */
284
- END_TRANSLATE_X = rtl
285
- ? `-${window.innerWidth - backButtonTextBox.right - LARGE_TITLE_TRANSLATION_OFFSET}px`
286
- : `${backButtonTextBox.x - LARGE_TITLE_TRANSLATION_OFFSET}px`;
287
- /**
288
- * In the forward direction, the large title should start at its normal size and
289
- * then scale down to be (roughly) the size of the back button on the other view.
290
- * In the backward direction, the large title should start at (roughly) the size
291
- * of the back button and then scale up to its original size.
292
- * Note that since both elements either fade in or fade out over the course of the
293
- * animation, neither element will be fully visible on top of the other. As a result,
294
- * the overlap does not need to be perfect, so approximate values are acceptable here.
295
- */
296
- /**
297
- * When the title and back button texts match then they should overlap during the
298
- * page transition. If the texts do not match up then the large title text scale
299
- * adjusts to not perfectly match the back button text otherwise the proportions
300
- * will be incorrect. When the texts match we scale both the width and height to
301
- * account for font weight differences between the title and back button.
302
- */
303
- const doTitleAndButtonTextsMatch = ((_a = backButtonTextEl.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === ((_b = largeTitleEl.textContent) === null || _b === void 0 ? void 0 : _b.trim());
304
- const WIDTH_SCALE = backButtonTextBox.width / largeTitleTextBox.width;
305
- HEIGHT_SCALE = backButtonTextBox.height / (largeTitleTextBox.height - LARGE_TITLE_SIZE_OFFSET);
306
- if (doTitleAndButtonTextsMatch) {
307
- END_SCALE = `scale(${WIDTH_SCALE}, ${HEIGHT_SCALE})`;
308
- }
309
- }
310
280
  /**
311
- * The midpoints of the back button and the title should align such that the back
312
- * button and title appear to be centered with each other.
281
+ * When the title and back button texts match
282
+ * then they should overlap during the page transition.
283
+ * If the texts do not match up then the large title text scale adjusts
284
+ * to not perfectly match the back button text otherwise the
285
+ * proportions will be incorrect.
286
+ * When the texts match we scale both the width and height to account for
287
+ * font weight differences between the title and back button.
313
288
  */
314
- const backButtonMidPoint = backButtonBox.top + backButtonBox.height / 2;
315
- const titleMidPoint = (largeTitleBox.height * HEIGHT_SCALE) / 2;
316
- const END_TRANSLATE_Y = `${backButtonMidPoint - titleMidPoint}px`;
289
+ const doTitleAndButtonTextsMatch = ((_a = backButtonTextEl.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === ((_b = largeTitleEl.textContent) === null || _b === void 0 ? void 0 : _b.trim());
290
+ const WIDTH_SCALE = backButtonTextBox.width / largeTitleTextBox.width;
291
+ const HEIGHT_SCALE = backButtonTextBox.height / (largeTitleTextBox.height - LARGE_TITLE_SIZE_OFFSET);
292
+ const START_SCALE = 'scale(1)';
293
+ const END_SCALE = doTitleAndButtonTextsMatch ? `scale(${WIDTH_SCALE}, ${HEIGHT_SCALE})` : `scale(${HEIGHT_SCALE})`;
317
294
  const BACKWARDS_KEYFRAMES = [
318
295
  { offset: 0, opacity: 0, transform: `translate3d(${END_TRANSLATE_X}, ${END_TRANSLATE_Y}, 0) ${END_SCALE}` },
319
296
  { offset: 0.1, opacity: 0 },
@@ -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-26c5adb2.js'); });
16
- const mdTransitionAnimation = () => Promise.resolve().then(function () { return require('./md.transition-75533d44.js'); });
15
+ const iosTransitionAnimation = () => Promise.resolve().then(function () { return require('./ios.transition-30830fc4.js'); });
16
+ const mdTransitionAnimation = () => Promise.resolve().then(function () { return require('./md.transition-7f581866.js'); });
17
17
  // TODO(FW-2832): types
18
18
  const transition = (opts) => {
19
19
  return new Promise((resolve, reject) => {
@@ -6,9 +6,9 @@
6
6
  Object.defineProperty(exports, '__esModule', { value: true });
7
7
 
8
8
  const animation = require('./animation-c2840aea.js');
9
- const index = require('./index-034460de.js');
10
- const ios_transition = require('./ios.transition-26c5adb2.js');
11
- const md_transition = require('./md.transition-75533d44.js');
9
+ const index = require('./index-1f7c54f8.js');
10
+ const ios_transition = require('./ios.transition-30830fc4.js');
11
+ const md_transition = require('./md.transition-7f581866.js');
12
12
  const cubicBezier = require('./cubic-bezier-f2dccc53.js');
13
13
  const index$1 = require('./index-d1b59ffa.js');
14
14
  const ionicGlobal = require('./ionic-global-c5503e93.js');
@@ -17,7 +17,7 @@ const keyboardController = require('./keyboard-controller-c05e747a.js');
17
17
  const cubicBezier = require('./cubic-bezier-f2dccc53.js');
18
18
  const frameworkDelegate = require('./framework-delegate-e0e13baa.js');
19
19
  const lockController = require('./lock-controller-6585a42a.js');
20
- const index$3 = require('./index-034460de.js');
20
+ const index$3 = require('./index-1f7c54f8.js');
21
21
  require('./index-c8d52405.js');
22
22
  require('./keyboard-0272231f.js');
23
23
  require('./capacitor-c04564bf.js');
@@ -14,7 +14,7 @@ const index$4 = require('./index-5915f9b3.js');
14
14
  const capacitor = require('./capacitor-c04564bf.js');
15
15
  const overlays = require('./overlays-129dfc13.js');
16
16
  const theme = require('./theme-d1c573d2.js');
17
- const index$5 = require('./index-034460de.js');
17
+ const index$5 = require('./index-1f7c54f8.js');
18
18
  const ionicGlobal = require('./ionic-global-c5503e93.js');
19
19
  const keyboard = require('./keyboard-af1bb365.js');
20
20
  const animation = require('./animation-c2840aea.js');
@@ -8,7 +8,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
8
8
  const index = require('./index-22617dd6.js');
9
9
  const cubicBezier = require('./cubic-bezier-f2dccc53.js');
10
10
  const helpers = require('./helpers-da4c0ed1.js');
11
- const index$1 = require('./index-034460de.js');
11
+ const index$1 = require('./index-1f7c54f8.js');
12
12
  const ionicGlobal = require('./ionic-global-c5503e93.js');
13
13
  const frameworkDelegate = require('./framework-delegate-e0e13baa.js');
14
14
 
@@ -13,7 +13,7 @@ const index$1 = require('./index-5915f9b3.js');
13
13
  const overlays = require('./overlays-129dfc13.js');
14
14
  const ionicGlobal = require('./ionic-global-c5503e93.js');
15
15
  const theme = require('./theme-d1c573d2.js');
16
- const index$2 = require('./index-034460de.js');
16
+ const index$2 = require('./index-1f7c54f8.js');
17
17
  const animation = require('./animation-c2840aea.js');
18
18
  require('./index-c8d52405.js');
19
19
  require('./hardware-back-button-adba3ac7.js');
@@ -4,7 +4,7 @@
4
4
  'use strict';
5
5
 
6
6
  const animation = require('./animation-c2840aea.js');
7
- const index = require('./index-034460de.js');
7
+ const index = require('./index-1f7c54f8.js');
8
8
  require('./index-c8d52405.js');
9
9
  require('./helpers-da4c0ed1.js');
10
10
  require('./index-22617dd6.js');
@@ -61,22 +61,20 @@ const createLargeTitleTransition = (rootAnimation, rtl, backDirection, enteringE
61
61
  const leavingLargeTitleBox = leavingLargeTitle.getBoundingClientRect();
62
62
  const enteringBackButtonBox = enteringBackButton.getBoundingClientRect();
63
63
  const enteringBackButtonTextEl = shadow(enteringBackButton).querySelector('.button-text');
64
- // Text element not rendered if developers pass text="" to the back button
65
- const enteringBackButtonTextBox = enteringBackButtonTextEl === null || enteringBackButtonTextEl === void 0 ? void 0 : enteringBackButtonTextEl.getBoundingClientRect();
64
+ const enteringBackButtonTextBox = enteringBackButtonTextEl.getBoundingClientRect();
66
65
  const leavingLargeTitleTextEl = shadow(leavingLargeTitle).querySelector('.toolbar-title');
67
66
  const leavingLargeTitleTextBox = leavingLargeTitleTextEl.getBoundingClientRect();
68
- animateLargeTitle(rootAnimation, rtl, backDirection, leavingLargeTitle, leavingLargeTitleBox, leavingLargeTitleTextBox, enteringBackButtonBox, enteringBackButtonTextEl, enteringBackButtonTextBox);
67
+ animateLargeTitle(rootAnimation, rtl, backDirection, leavingLargeTitle, leavingLargeTitleBox, leavingLargeTitleTextBox, enteringBackButtonTextEl, enteringBackButtonTextBox);
69
68
  animateBackButton(rootAnimation, rtl, backDirection, enteringBackButton, enteringBackButtonBox, enteringBackButtonTextEl, enteringBackButtonTextBox, leavingLargeTitle, leavingLargeTitleTextBox);
70
69
  }
71
70
  else if (shouldAnimationBackward) {
72
71
  const enteringLargeTitleBox = enteringLargeTitle.getBoundingClientRect();
73
72
  const leavingBackButtonBox = leavingBackButton.getBoundingClientRect();
74
73
  const leavingBackButtonTextEl = shadow(leavingBackButton).querySelector('.button-text');
75
- // Text element not rendered if developers pass text="" to the back button
76
- const leavingBackButtonTextBox = leavingBackButtonTextEl === null || leavingBackButtonTextEl === void 0 ? void 0 : leavingBackButtonTextEl.getBoundingClientRect();
74
+ const leavingBackButtonTextBox = leavingBackButtonTextEl.getBoundingClientRect();
77
75
  const enteringLargeTitleTextEl = shadow(enteringLargeTitle).querySelector('.toolbar-title');
78
76
  const enteringLargeTitleTextBox = enteringLargeTitleTextEl.getBoundingClientRect();
79
- animateLargeTitle(rootAnimation, rtl, backDirection, enteringLargeTitle, enteringLargeTitleBox, enteringLargeTitleTextBox, leavingBackButtonBox, leavingBackButtonTextEl, leavingBackButtonTextBox);
77
+ animateLargeTitle(rootAnimation, rtl, backDirection, enteringLargeTitle, enteringLargeTitleBox, enteringLargeTitleTextBox, leavingBackButtonTextEl, leavingBackButtonTextBox);
80
78
  animateBackButton(rootAnimation, rtl, backDirection, leavingBackButton, leavingBackButtonBox, leavingBackButtonTextEl, leavingBackButtonTextBox, enteringLargeTitle, enteringLargeTitleTextBox);
81
79
  }
82
80
  return {
@@ -90,29 +88,26 @@ const animateBackButton = (rootAnimation, rtl, backDirection, backButtonEl, back
90
88
  const TEXT_ORIGIN_X = rtl ? 'right' : 'left';
91
89
  const ICON_ORIGIN_X = rtl ? 'left' : 'right';
92
90
  const CONTAINER_ORIGIN_X = rtl ? 'right' : 'left';
93
- let WIDTH_SCALE = 1;
94
- let HEIGHT_SCALE = 1;
95
- let TEXT_START_SCALE = `scale(${HEIGHT_SCALE})`;
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})`;
96
110
  const TEXT_END_SCALE = 'scale(1)';
97
- if (backButtonTextEl && backButtonTextBox) {
98
- /**
99
- * When the title and back button texts match then they should overlap during the
100
- * page transition. If the texts do not match up then the back button text scale
101
- * adjusts to not perfectly match the large title text otherwise the proportions
102
- * will be incorrect. When the texts match we scale both the width and height to
103
- * account for font weight differences between the title and back button.
104
- */
105
- const doTitleAndButtonTextsMatch = ((_a = backButtonTextEl.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === ((_b = largeTitleEl.textContent) === null || _b === void 0 ? void 0 : _b.trim());
106
- WIDTH_SCALE = largeTitleTextBox.width / backButtonTextBox.width;
107
- /**
108
- * Subtract an offset to account for slight sizing/padding differences between the
109
- * title and the back button.
110
- */
111
- HEIGHT_SCALE = (largeTitleTextBox.height - LARGE_TITLE_SIZE_OFFSET) / backButtonTextBox.height;
112
- if (doTitleAndButtonTextsMatch) {
113
- TEXT_START_SCALE = `scale(${WIDTH_SCALE}, ${HEIGHT_SCALE})`;
114
- }
115
- }
116
111
  const backButtonIconEl = shadow(backButtonEl).querySelector('ion-icon');
117
112
  const backButtonIconBox = backButtonIconEl.getBoundingClientRect();
118
113
  /**
@@ -209,11 +204,11 @@ const animateBackButton = (rootAnimation, rtl, backDirection, backButtonEl, back
209
204
  top: '0px',
210
205
  [CONTAINER_ORIGIN_X]: '0px',
211
206
  })
212
- /**
213
- * The write hooks must be set on this animation as it is guaranteed to run. Other
214
- * animations such as the back button text animation will not run if the back button
215
- * has no visible text.
216
- */
207
+ .keyframes(CONTAINER_KEYFRAMES);
208
+ enteringBackButtonTextAnimation
209
+ .beforeStyles({
210
+ 'transform-origin': `${TEXT_ORIGIN_X} top`,
211
+ })
217
212
  .beforeAddWrite(() => {
218
213
  backButtonEl.style.setProperty('display', 'none');
219
214
  clonedBackButtonEl.style.setProperty(TEXT_ORIGIN_X, BACK_BUTTON_START_OFFSET);
@@ -222,11 +217,6 @@ const animateBackButton = (rootAnimation, rtl, backDirection, backButtonEl, back
222
217
  backButtonEl.style.setProperty('display', '');
223
218
  clonedBackButtonEl.style.setProperty('display', 'none');
224
219
  clonedBackButtonEl.style.removeProperty(TEXT_ORIGIN_X);
225
- })
226
- .keyframes(CONTAINER_KEYFRAMES);
227
- enteringBackButtonTextAnimation
228
- .beforeStyles({
229
- 'transform-origin': `${TEXT_ORIGIN_X} top`,
230
220
  })
231
221
  .keyframes(TEXT_KEYFRAMES);
232
222
  enteringBackButtonIconAnimation
@@ -240,7 +230,7 @@ const animateBackButton = (rootAnimation, rtl, backDirection, backButtonEl, back
240
230
  enteringBackButtonAnimation,
241
231
  ]);
242
232
  };
243
- const animateLargeTitle = (rootAnimation, rtl, backDirection, largeTitleEl, largeTitleBox, largeTitleTextBox, backButtonBox, backButtonTextEl, backButtonTextBox) => {
233
+ const animateLargeTitle = (rootAnimation, rtl, backDirection, largeTitleEl, largeTitleBox, largeTitleTextBox, backButtonTextEl, backButtonTextBox) => {
244
234
  var _a, _b;
245
235
  /**
246
236
  * The horizontal transform origin for the large title
@@ -260,65 +250,52 @@ const animateLargeTitle = (rootAnimation, rtl, backDirection, largeTitleEl, larg
260
250
  * title and the back button due to padding and font weight.
261
251
  */
262
252
  const LARGE_TITLE_TRANSLATION_OFFSET = 8;
263
- let END_TRANSLATE_X = rtl
264
- ? `-${window.innerWidth - backButtonBox.right - LARGE_TITLE_TRANSLATION_OFFSET}px`
265
- : `${backButtonBox.x + LARGE_TITLE_TRANSLATION_OFFSET}px`;
266
253
  /**
267
- * How much to scale the large title up/down by.
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.
268
260
  */
269
- let HEIGHT_SCALE = 0.5;
261
+ const END_TRANSLATE_X = rtl
262
+ ? `-${window.innerWidth - backButtonTextBox.right - LARGE_TITLE_TRANSLATION_OFFSET}px`
263
+ : `${backButtonTextBox.x - LARGE_TITLE_TRANSLATION_OFFSET}px`;
270
264
  /**
271
- * The large title always starts full size.
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.
272
270
  */
273
- const START_SCALE = 'scale(1)';
271
+ const LARGE_TITLE_TOP_PADDING = 2;
272
+ const END_TRANSLATE_Y = `${backButtonTextBox.y - LARGE_TITLE_TOP_PADDING}px`;
274
273
  /**
275
- * By default, we don't worry about having the large title scaled to perfectly
276
- * match the back button because we don't know if the back button's text matches
277
- * the large title's text.
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.
278
284
  */
279
- let END_SCALE = `scale(${HEIGHT_SCALE})`;
280
- // Text element not rendered if developers pass text="" to the back button
281
- if (backButtonTextEl && backButtonTextBox) {
282
- /**
283
- * The scaled title should (roughly) overlap the back button. This ensures that
284
- * the back button and title overlap during the animation. Note that since both
285
- * elements either fade in or fade out over the course of the animation, neither
286
- * element will be fully visible on top of the other. As a result, the overlap
287
- * does not need to be perfect, so approximate values are acceptable here.
288
- */
289
- END_TRANSLATE_X = rtl
290
- ? `-${window.innerWidth - backButtonTextBox.right - LARGE_TITLE_TRANSLATION_OFFSET}px`
291
- : `${backButtonTextBox.x - LARGE_TITLE_TRANSLATION_OFFSET}px`;
292
- /**
293
- * In the forward direction, the large title should start at its normal size and
294
- * then scale down to be (roughly) the size of the back button on the other view.
295
- * In the backward direction, the large title should start at (roughly) the size
296
- * of the back button and then scale up to its original size.
297
- * Note that since both elements either fade in or fade out over the course of the
298
- * animation, neither element will be fully visible on top of the other. As a result,
299
- * the overlap does not need to be perfect, so approximate values are acceptable here.
300
- */
301
- /**
302
- * When the title and back button texts match then they should overlap during the
303
- * page transition. If the texts do not match up then the large title text scale
304
- * adjusts to not perfectly match the back button text otherwise the proportions
305
- * will be incorrect. When the texts match we scale both the width and height to
306
- * account for font weight differences between the title and back button.
307
- */
308
- const doTitleAndButtonTextsMatch = ((_a = backButtonTextEl.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === ((_b = largeTitleEl.textContent) === null || _b === void 0 ? void 0 : _b.trim());
309
- const WIDTH_SCALE = backButtonTextBox.width / largeTitleTextBox.width;
310
- HEIGHT_SCALE = backButtonTextBox.height / (largeTitleTextBox.height - LARGE_TITLE_SIZE_OFFSET);
311
- if (doTitleAndButtonTextsMatch) {
312
- END_SCALE = `scale(${WIDTH_SCALE}, ${HEIGHT_SCALE})`;
313
- }
314
- }
315
285
  /**
316
- * The midpoints of the back button and the title should align such that the back
317
- * button and title appear to be centered with each other.
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.
318
293
  */
319
- const backButtonMidPoint = backButtonBox.top + backButtonBox.height / 2;
320
- const titleMidPoint = (largeTitleBox.height * HEIGHT_SCALE) / 2;
321
- const END_TRANSLATE_Y = `${backButtonMidPoint - titleMidPoint}px`;
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})`;
322
299
  const BACKWARDS_KEYFRAMES = [
323
300
  { offset: 0, opacity: 0, transform: `translate3d(${END_TRANSLATE_X}, ${END_TRANSLATE_Y}, 0) ${END_SCALE}` },
324
301
  { offset: 0.1, opacity: 0 },
@@ -4,7 +4,7 @@
4
4
  'use strict';
5
5
 
6
6
  const animation = require('./animation-c2840aea.js');
7
- const index = require('./index-034460de.js');
7
+ const index = require('./index-1f7c54f8.js');
8
8
  require('./index-c8d52405.js');
9
9
  require('./helpers-da4c0ed1.js');
10
10
  require('./index-22617dd6.js');