@rdlabo/ionic-theme-ios27 1.2.0-3 → 1.2.0-4

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 (175) hide show
  1. package/README.md +15 -2
  2. package/dist/_virtual/_rolldown/runtime.js +13 -0
  3. package/dist/css/ionic-theme-ios27.css +1 -1
  4. package/dist/css/vertical-bars.css +1 -1
  5. package/dist/focus-controller/index.d.ts +4 -2
  6. package/dist/focus-controller/index.d.ts.map +1 -1
  7. package/dist/focus-controller/index.js +100 -57
  8. package/dist/focus-controller/index.js.map +1 -0
  9. package/dist/index.d.ts +10 -8
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +54 -60
  12. package/dist/index.js.map +1 -0
  13. package/dist/native/components/index.d.ts +13 -10
  14. package/dist/native/components/index.d.ts.map +1 -1
  15. package/dist/native/components/index.js +39 -41
  16. package/dist/native/components/index.js.map +1 -0
  17. package/dist/native/components/ion-back-button.d.ts +6 -1
  18. package/dist/native/components/ion-back-button.d.ts.map +1 -1
  19. package/dist/native/components/ion-back-button.js +19 -13
  20. package/dist/native/components/ion-back-button.js.map +1 -0
  21. package/dist/native/components/ion-button.d.ts +8 -2
  22. package/dist/native/components/ion-button.d.ts.map +1 -1
  23. package/dist/native/components/ion-button.js +22 -17
  24. package/dist/native/components/ion-button.js.map +1 -0
  25. package/dist/native/components/ion-buttons.d.ts +8 -2
  26. package/dist/native/components/ion-buttons.d.ts.map +1 -1
  27. package/dist/native/components/ion-buttons.js +29 -33
  28. package/dist/native/components/ion-buttons.js.map +1 -0
  29. package/dist/native/components/ion-fab.d.ts +6 -1
  30. package/dist/native/components/ion-fab.d.ts.map +1 -1
  31. package/dist/native/components/ion-fab.js +131 -151
  32. package/dist/native/components/ion-fab.js.map +1 -0
  33. package/dist/native/components/ion-menu-button.d.ts +8 -2
  34. package/dist/native/components/ion-menu-button.d.ts.map +1 -1
  35. package/dist/native/components/ion-menu-button.js +29 -19
  36. package/dist/native/components/ion-menu-button.js.map +1 -0
  37. package/dist/native/components/ion-segment.d.ts +6 -1
  38. package/dist/native/components/ion-segment.d.ts.map +1 -1
  39. package/dist/native/components/ion-segment.js +29 -23
  40. package/dist/native/components/ion-segment.js.map +1 -0
  41. package/dist/native/components/ion-tab-bar.d.ts +6 -1
  42. package/dist/native/components/ion-tab-bar.d.ts.map +1 -1
  43. package/dist/native/components/ion-tab-bar.js +49 -40
  44. package/dist/native/components/ion-tab-bar.js.map +1 -0
  45. package/dist/native/components/searchable-tabs.d.ts +17 -15
  46. package/dist/native/components/searchable-tabs.d.ts.map +1 -1
  47. package/dist/native/components/searchable-tabs.js +382 -434
  48. package/dist/native/components/searchable-tabs.js.map +1 -0
  49. package/dist/native/definitions.d.ts +118 -111
  50. package/dist/native/definitions.d.ts.map +1 -1
  51. package/dist/native/definitions.js +0 -1
  52. package/dist/native/foldable/fold-state.d.ts +5 -0
  53. package/dist/native/foldable/fold-state.d.ts.map +1 -0
  54. package/dist/native/foldable/fold-state.js +14 -0
  55. package/dist/native/foldable/fold-state.js.map +1 -0
  56. package/dist/native/foldable/types.d.ts +12 -0
  57. package/dist/native/foldable/types.d.ts.map +1 -0
  58. package/dist/native/foldable/types.js +0 -0
  59. package/dist/native/index.d.ts +6 -3
  60. package/dist/native/index.d.ts.map +1 -1
  61. package/dist/native/index.js +228 -204
  62. package/dist/native/index.js.map +1 -0
  63. package/dist/native/prehide.d.ts +4 -2
  64. package/dist/native/prehide.d.ts.map +1 -1
  65. package/dist/native/prehide.js +220 -242
  66. package/dist/native/prehide.js.map +1 -0
  67. package/dist/native/runtime.d.ts +3 -1
  68. package/dist/native/runtime.d.ts.map +1 -1
  69. package/dist/native/runtime.js +626 -730
  70. package/dist/native/runtime.js.map +1 -0
  71. package/dist/native/shared/candidate.d.ts +16 -11
  72. package/dist/native/shared/candidate.d.ts.map +1 -1
  73. package/dist/native/shared/candidate.js +96 -95
  74. package/dist/native/shared/candidate.js.map +1 -0
  75. package/dist/native/shared/crossfade.d.ts +6 -4
  76. package/dist/native/shared/crossfade.d.ts.map +1 -1
  77. package/dist/native/shared/crossfade.js +49 -45
  78. package/dist/native/shared/crossfade.js.map +1 -0
  79. package/dist/native/shared/dom.d.ts +7 -5
  80. package/dist/native/shared/dom.d.ts.map +1 -1
  81. package/dist/native/shared/dom.js +163 -211
  82. package/dist/native/shared/dom.js.map +1 -0
  83. package/dist/native/shared/events.d.ts +8 -6
  84. package/dist/native/shared/events.d.ts.map +1 -1
  85. package/dist/native/shared/events.js +12 -7
  86. package/dist/native/shared/events.js.map +1 -0
  87. package/dist/native/shared/icons.d.ts +4 -2
  88. package/dist/native/shared/icons.d.ts.map +1 -1
  89. package/dist/native/shared/icons.js +59 -53
  90. package/dist/native/shared/icons.js.map +1 -0
  91. package/dist/native/shared/modal.d.ts +3 -1
  92. package/dist/native/shared/modal.d.ts.map +1 -1
  93. package/dist/native/shared/modal.js +156 -139
  94. package/dist/native/shared/modal.js.map +1 -0
  95. package/dist/native/vertical-bars-web.d.ts +3 -1
  96. package/dist/native/vertical-bars-web.d.ts.map +1 -1
  97. package/dist/native/vertical-bars-web.js +332 -346
  98. package/dist/native/vertical-bars-web.js.map +1 -0
  99. package/dist/native-integration/index.d.ts +10 -8
  100. package/dist/native-integration/index.d.ts.map +1 -1
  101. package/dist/native-integration/index.js +102 -100
  102. package/dist/native-integration/index.js.map +1 -0
  103. package/dist/native-integration/transition.d.ts +3 -1
  104. package/dist/native-integration/transition.d.ts.map +1 -1
  105. package/dist/native-integration/transition.js +15 -6
  106. package/dist/native-integration/transition.js.map +1 -0
  107. package/dist/searchbar/index.d.ts +4 -2
  108. package/dist/searchbar/index.d.ts.map +1 -1
  109. package/dist/searchbar/index.js +64 -56
  110. package/dist/searchbar/index.js.map +1 -0
  111. package/dist/segment/index.d.ts +3 -1
  112. package/dist/segment/index.d.ts.map +1 -1
  113. package/dist/segment/index.js +465 -324
  114. package/dist/segment/index.js.map +1 -0
  115. package/dist/sheets-of-glass/animations.d.ts +13 -12
  116. package/dist/sheets-of-glass/animations.d.ts.map +1 -1
  117. package/dist/sheets-of-glass/animations.js +496 -306
  118. package/dist/sheets-of-glass/animations.js.map +1 -0
  119. package/dist/sheets-of-glass/index.d.ts +3 -1
  120. package/dist/sheets-of-glass/index.d.ts.map +1 -1
  121. package/dist/sheets-of-glass/index.js +294 -357
  122. package/dist/sheets-of-glass/index.js.map +1 -0
  123. package/dist/sheets-of-glass/interfaces.d.ts +11 -9
  124. package/dist/sheets-of-glass/interfaces.d.ts.map +1 -1
  125. package/dist/sheets-of-glass/interfaces.js +0 -1
  126. package/dist/tab-bar-searchable/animations/enter.d.ts +4 -2
  127. package/dist/tab-bar-searchable/animations/enter.d.ts.map +1 -1
  128. package/dist/tab-bar-searchable/animations/enter.js +50 -69
  129. package/dist/tab-bar-searchable/animations/enter.js.map +1 -0
  130. package/dist/tab-bar-searchable/animations/leave.d.ts +4 -2
  131. package/dist/tab-bar-searchable/animations/leave.d.ts.map +1 -1
  132. package/dist/tab-bar-searchable/animations/leave.js +48 -62
  133. package/dist/tab-bar-searchable/animations/leave.js.map +1 -0
  134. package/dist/tab-bar-searchable/index.d.ts +5 -3
  135. package/dist/tab-bar-searchable/index.d.ts.map +1 -1
  136. package/dist/tab-bar-searchable/index.js +123 -135
  137. package/dist/tab-bar-searchable/index.js.map +1 -0
  138. package/dist/transition/index.d.ts +9 -8
  139. package/dist/transition/index.d.ts.map +1 -1
  140. package/dist/transition/index.js +203 -192
  141. package/dist/transition/index.js.map +1 -0
  142. package/dist/transition/ios.transition.d.ts +7 -5
  143. package/dist/transition/ios.transition.d.ts.map +1 -1
  144. package/dist/transition/ios.transition.js +15 -11
  145. package/dist/transition/ios.transition.js.map +1 -0
  146. package/dist/utils.d.ts +10 -8
  147. package/dist/utils.d.ts.map +1 -1
  148. package/dist/utils.js +58 -66
  149. package/dist/utils.js.map +1 -0
  150. package/dist/vertical-bars.d.ts +5 -4
  151. package/dist/vertical-bars.js +4 -2
  152. package/docs/iphone-duo-with-original-theme.md +18 -29
  153. package/docs/iphone-duo.md +44 -204
  154. package/docs/native-ui-shell.md +10 -8
  155. package/docs/special-markup.md +2 -0
  156. package/docs/vertical-bars.md +283 -0
  157. package/ios/Sources/IonicNativeUIShellPlugin/Components/ShellVerticalBars.swift +34 -14
  158. package/ios/Sources/IonicNativeUIShellPlugin/Shared/ShellSnapshot.swift +2 -0
  159. package/ios/Tests/IonicNativeUIShellPluginTests/ShellSnapshotTests.swift +3 -0
  160. package/package.json +9 -6
  161. package/src/native/components/index.ts +3 -2
  162. package/src/native/components/ion-button.ts +3 -2
  163. package/src/native/components/ion-buttons.ts +4 -3
  164. package/src/native/components/ion-menu-button.ts +3 -2
  165. package/src/native/definitions.ts +22 -1
  166. package/src/native/foldable/fold-state.ts +9 -0
  167. package/src/native/foldable/types.ts +4 -0
  168. package/src/native/index.ts +17 -3
  169. package/src/native/prehide.ts +3 -1
  170. package/src/native/runtime.ts +2 -2
  171. package/src/native/shared/candidate.ts +39 -10
  172. package/src/native/shared/dom.ts +4 -4
  173. package/src/styles/vertical-bars.scss +4 -2
  174. package/src/vertical-bars.ts +9 -1
  175. package/dist/vertical-bars.d.ts.map +0 -1
@@ -1,322 +1,512 @@
1
- import { createAnimation } from '@ionic/core';
2
- import { getStep } from '../utils';
3
- export const animationRect = (element, vertical = false) => {
4
- const rect = element.getBoundingClientRect();
5
- return vertical
6
- ? { left: rect.top, top: rect.left, right: rect.bottom, width: rect.height, height: rect.width, x: rect.y, y: rect.x }
7
- : rect;
1
+ import { getStep } from "../utils.js";
2
+ import { createAnimation } from "@ionic/core";
3
+ //#region src/sheets-of-glass/animations.ts
4
+ const animationRect = (element, vertical = false) => {
5
+ const rect = element.getBoundingClientRect();
6
+ return vertical ? {
7
+ left: rect.top,
8
+ top: rect.left,
9
+ right: rect.bottom,
10
+ width: rect.height,
11
+ height: rect.width,
12
+ x: rect.y,
13
+ y: rect.x
14
+ } : rect;
8
15
  };
9
16
  const translate = (x, y, vertical) => `translate3d(${vertical ? y : x}px, ${vertical ? x : y}px, 0)`;
10
17
  const stretchTransform = (x, y, vertical) => `scale(${vertical ? y : x}, ${vertical ? x : y})`;
11
- const mainSize = (element, vertical) => (vertical ? element.offsetHeight : element.offsetWidth);
18
+ const mainSize = (element, vertical) => vertical ? element.offsetHeight : element.offsetWidth;
12
19
  const axisScale = (transform, vertical) => {
13
- const matrix = new DOMMatrixReadOnly(transform);
14
- return vertical ? { a: matrix.d, d: matrix.a } : matrix;
20
+ const matrix = new DOMMatrixReadOnly(transform);
21
+ return vertical ? {
22
+ a: matrix.d,
23
+ d: matrix.a
24
+ } : matrix;
15
25
  };
16
- export const getScaleAnimation = (effectElement) => {
17
- return createAnimation().addElement(effectElement.shadowRoot.querySelector('[part="native"]')).easing('ease-out');
26
+ const getScaleAnimation = (effectElement) => {
27
+ return createAnimation().addElement(effectElement.shadowRoot.querySelector("[part=\"native\"]")).easing("ease-out");
18
28
  };
19
29
  const tabBarPressFrames = [
20
- [0, 0, 0, 0, 0],
21
- [0.033, 0.091, 4.26, 1.52, 0.148],
22
- [0.067, 0.312, 13.28, 2.89, 0.46],
23
- [0.1, 0.551, 21.99, 2.24, 0.752],
24
- [0.133, 0.736, 25.94, 2.77, 0.951],
25
- [0.167, 0.858, 24.35, 6.03, 1.052],
26
- [0.2, 0.932, 22.72, 8.41, 1.081],
27
- [0.267, 0.985, 21.55, 10.38, 1.058],
28
- [0.333, 1.003, 17.89, 13.98, 1.01],
29
- [0.4, 1.015, 13.54, 18.42, 1],
30
- [0.467, 1.018, 11.3, 20.75, 1],
31
- [0.6, 1.005, 12.36, 19.72, 1],
32
- [0.733, 0.993, 14.75, 17.27, 1],
33
- [0.9, 1, 16, 16, 1],
30
+ [
31
+ 0,
32
+ 0,
33
+ 0,
34
+ 0,
35
+ 0
36
+ ],
37
+ [
38
+ .033,
39
+ .091,
40
+ 4.26,
41
+ 1.52,
42
+ .148
43
+ ],
44
+ [
45
+ .067,
46
+ .312,
47
+ 13.28,
48
+ 2.89,
49
+ .46
50
+ ],
51
+ [
52
+ .1,
53
+ .551,
54
+ 21.99,
55
+ 2.24,
56
+ .752
57
+ ],
58
+ [
59
+ .133,
60
+ .736,
61
+ 25.94,
62
+ 2.77,
63
+ .951
64
+ ],
65
+ [
66
+ .167,
67
+ .858,
68
+ 24.35,
69
+ 6.03,
70
+ 1.052
71
+ ],
72
+ [
73
+ .2,
74
+ .932,
75
+ 22.72,
76
+ 8.41,
77
+ 1.081
78
+ ],
79
+ [
80
+ .267,
81
+ .985,
82
+ 21.55,
83
+ 10.38,
84
+ 1.058
85
+ ],
86
+ [
87
+ .333,
88
+ 1.003,
89
+ 17.89,
90
+ 13.98,
91
+ 1.01
92
+ ],
93
+ [
94
+ .4,
95
+ 1.015,
96
+ 13.54,
97
+ 18.42,
98
+ 1
99
+ ],
100
+ [
101
+ .467,
102
+ 1.018,
103
+ 11.3,
104
+ 20.75,
105
+ 1
106
+ ],
107
+ [
108
+ .6,
109
+ 1.005,
110
+ 12.36,
111
+ 19.72,
112
+ 1
113
+ ],
114
+ [
115
+ .733,
116
+ .993,
117
+ 14.75,
118
+ 17.27,
119
+ 1
120
+ ],
121
+ [
122
+ .9,
123
+ 1,
124
+ 16,
125
+ 16,
126
+ 1
127
+ ]
34
128
  ];
35
129
  const tabBarTapFrames = [
36
- [0, 0, 0, 0],
37
- [0.033, 0.099, 4.15, 2.91],
38
- [0.067, 0.333, 13.81, 5.59],
39
- [0.1, 0.589, 23.77, 5.52],
40
- [0.133, 0.794, 29.84, 4.24],
41
- [0.167, 0.925, 29.01, 5.83],
42
- [0.2, 0.992, 26.85, 7.25],
43
- [0.233, 1.015, 25.83, 7.87],
44
- [0.267, 1.018, 20.43, 5.56],
45
- [0.3, 1.018, 12.87, 3.16],
46
- [0.367, 1.024, 1.3, 2.69],
47
- [0.433, 1.031, -3.98, 4.1],
48
- [0.5, 1.027, -5.05, 3.89],
49
- [0.6, 1.013, -2.95, 2.31],
50
- [0.7, 1.003, -0.74, 0.59],
51
- [0.8, 1, 0, 0],
130
+ [
131
+ 0,
132
+ 0,
133
+ 0,
134
+ 0
135
+ ],
136
+ [
137
+ .033,
138
+ .099,
139
+ 4.15,
140
+ 2.91
141
+ ],
142
+ [
143
+ .067,
144
+ .333,
145
+ 13.81,
146
+ 5.59
147
+ ],
148
+ [
149
+ .1,
150
+ .589,
151
+ 23.77,
152
+ 5.52
153
+ ],
154
+ [
155
+ .133,
156
+ .794,
157
+ 29.84,
158
+ 4.24
159
+ ],
160
+ [
161
+ .167,
162
+ .925,
163
+ 29.01,
164
+ 5.83
165
+ ],
166
+ [
167
+ .2,
168
+ .992,
169
+ 26.85,
170
+ 7.25
171
+ ],
172
+ [
173
+ .233,
174
+ 1.015,
175
+ 25.83,
176
+ 7.87
177
+ ],
178
+ [
179
+ .267,
180
+ 1.018,
181
+ 20.43,
182
+ 5.56
183
+ ],
184
+ [
185
+ .3,
186
+ 1.018,
187
+ 12.87,
188
+ 3.16
189
+ ],
190
+ [
191
+ .367,
192
+ 1.024,
193
+ 1.3,
194
+ 2.69
195
+ ],
196
+ [
197
+ .433,
198
+ 1.031,
199
+ -3.98,
200
+ 4.1
201
+ ],
202
+ [
203
+ .5,
204
+ 1.027,
205
+ -5.05,
206
+ 3.89
207
+ ],
208
+ [
209
+ .6,
210
+ 1.013,
211
+ -2.95,
212
+ 2.31
213
+ ],
214
+ [
215
+ .7,
216
+ 1.003,
217
+ -.74,
218
+ .59
219
+ ],
220
+ [
221
+ .8,
222
+ 1,
223
+ 0,
224
+ 0
225
+ ]
52
226
  ];
53
- export const createTabBarPressAnimation = (effect, from, to, bar, vertical = false) => {
54
- const box = animationRect(bar, vertical);
55
- const center = box.left + box.width / 2;
56
- const left = center - mainSize(bar, vertical) / 2;
57
- const fromBox = animationRect(from, vertical);
58
- const toBox = animationRect(to, vertical);
59
- const parentScale = box.width / mainSize(bar, vertical);
60
- const buttonScale = axisScale(getComputedStyle(from).transform, vertical);
61
- const width = fromBox.width / parentScale / buttonScale.a;
62
- const height = fromBox.height / parentScale / buttonScale.d;
63
- const start = (fromBox.left + fromBox.width / 2 - box.left) / parentScale;
64
- const end = (toBox.left + toBox.width / 2 - box.left) / parentScale;
65
- const selected = from === to;
66
- const growth = vertical ? 20 / 16 : 1;
67
- const frames = tabBarPressFrames.map(([time, position, extraWidth, extraHeight, expansion]) => {
68
- const scale = vertical ? 1 : 1 + (14.14 / mainSize(bar, vertical)) * expansion;
69
- const press = 1 - Math.exp(-18 * time) * (1 + 18 * time);
70
- return {
71
- offset: time / 0.9,
72
- x: center + (left + start + (end - start) * position - center) * scale - width / 2,
73
- sx: ((width + (selected ? 16 * press : extraWidth) * growth) * scale) / width,
74
- sy: ((height + (selected ? 16 * press : extraHeight) * growth) * scale) / height,
75
- };
76
- });
77
- const move = createAnimation()
78
- .addElement(effect)
79
- .beforeStyles({
80
- width: `${vertical ? height : width}px`,
81
- height: `${vertical ? width : height}px`,
82
- display: 'block',
83
- opacity: '1',
84
- })
85
- .keyframes(frames.map(({ offset, x }) => ({ offset, transform: translate(x, box.top + box.height / 2 - height / 2, vertical) })));
86
- const stretch = getScaleAnimation(effect)
87
- .easing('linear')
88
- .keyframes(frames.map(({ offset, sx, sy }) => ({ offset, transform: stretchTransform(sx, sy, vertical) })));
89
- return createAnimation().duration(900).easing('linear').addAnimation([move, stretch]);
227
+ const createTabBarPressAnimation = (effect, from, to, bar, vertical = false) => {
228
+ const box = animationRect(bar, vertical);
229
+ const center = box.left + box.width / 2;
230
+ const left = center - mainSize(bar, vertical) / 2;
231
+ const fromBox = animationRect(from, vertical);
232
+ const toBox = animationRect(to, vertical);
233
+ const parentScale = box.width / mainSize(bar, vertical);
234
+ const buttonScale = axisScale(getComputedStyle(from).transform, vertical);
235
+ const width = fromBox.width / parentScale / buttonScale.a;
236
+ const height = fromBox.height / parentScale / buttonScale.d;
237
+ const start = (fromBox.left + fromBox.width / 2 - box.left) / parentScale;
238
+ const end = (toBox.left + toBox.width / 2 - box.left) / parentScale;
239
+ const selected = from === to;
240
+ const growth = vertical ? 20 / 16 : 1;
241
+ const frames = tabBarPressFrames.map(([time, position, extraWidth, extraHeight, expansion]) => {
242
+ const scale = vertical ? 1 : 1 + 14.14 / mainSize(bar, vertical) * expansion;
243
+ const press = 1 - Math.exp(-18 * time) * (1 + 18 * time);
244
+ return {
245
+ offset: time / .9,
246
+ x: center + (left + start + (end - start) * position - center) * scale - width / 2,
247
+ sx: (width + (selected ? 16 * press : extraWidth) * growth) * scale / width,
248
+ sy: (height + (selected ? 16 * press : extraHeight) * growth) * scale / height
249
+ };
250
+ });
251
+ const move = createAnimation().addElement(effect).beforeStyles({
252
+ width: `${vertical ? height : width}px`,
253
+ height: `${vertical ? width : height}px`,
254
+ display: "block",
255
+ opacity: "1"
256
+ }).keyframes(frames.map(({ offset, x }) => ({
257
+ offset,
258
+ transform: translate(x, box.top + box.height / 2 - height / 2, vertical)
259
+ })));
260
+ const stretch = getScaleAnimation(effect).easing("linear").keyframes(frames.map(({ offset, sx, sy }) => ({
261
+ offset,
262
+ transform: stretchTransform(sx, sy, vertical)
263
+ })));
264
+ return createAnimation().duration(900).easing("linear").addAnimation([move, stretch]);
90
265
  };
91
- export const createTabBarDragAnimation = (effect, bar, velocity, vertical = false) => {
92
- const native = effect.shadowRoot.querySelector('[part="native"]');
93
- const current = axisScale(native.style.transform || getComputedStyle(native).transform, vertical);
94
- const { width, height } = animationRect(effect, vertical);
95
- const scale = vertical ? 1 : 1 + 14.14 / mainSize(bar, vertical);
96
- const restX = ((width + (vertical ? 20 : 16)) * scale) / width;
97
- const restY = ((height + (vertical ? 20 : 16)) * scale) / height;
98
- const stretch = Math.min(16, 32 * velocity * velocity) * scale;
99
- const rebound = Math.max(stretch, (current.a - restX) * width) * 0.8;
100
- return getScaleAnimation(effect)
101
- .duration(500)
102
- .easing('linear')
103
- .keyframes([
104
- { offset: 0, transform: stretchTransform(current.a, current.d, vertical) },
105
- { offset: 0.2, transform: stretchTransform(restX + stretch / width, restY - stretch / height, vertical) },
106
- { offset: 0.44, transform: stretchTransform(restX - rebound / width, restY + rebound / height, vertical) },
107
- { offset: 1, transform: stretchTransform(restX, restY, vertical) },
108
- ]);
266
+ const createTabBarDragAnimation = (effect, bar, velocity, vertical = false) => {
267
+ const native = effect.shadowRoot.querySelector("[part=\"native\"]");
268
+ const current = axisScale(native.style.transform || getComputedStyle(native).transform, vertical);
269
+ const { width, height } = animationRect(effect, vertical);
270
+ const scale = vertical ? 1 : 1 + 14.14 / mainSize(bar, vertical);
271
+ const restX = (width + (vertical ? 20 : 16)) * scale / width;
272
+ const restY = (height + (vertical ? 20 : 16)) * scale / height;
273
+ const stretch = Math.min(16, 32 * velocity * velocity) * scale;
274
+ const rebound = Math.max(stretch, (current.a - restX) * width) * .8;
275
+ return getScaleAnimation(effect).duration(500).easing("linear").keyframes([
276
+ {
277
+ offset: 0,
278
+ transform: stretchTransform(current.a, current.d, vertical)
279
+ },
280
+ {
281
+ offset: .2,
282
+ transform: stretchTransform(restX + stretch / width, restY - stretch / height, vertical)
283
+ },
284
+ {
285
+ offset: .44,
286
+ transform: stretchTransform(restX - rebound / width, restY + rebound / height, vertical)
287
+ },
288
+ {
289
+ offset: 1,
290
+ transform: stretchTransform(restX, restY, vertical)
291
+ }
292
+ ]);
109
293
  };
110
- export const createTabBarReleaseAnimation = (effectElement, target, tap, vertical = false) => {
111
- const tapElapsed = tap?.elapsed;
112
- const native = effectElement.shadowRoot.querySelector('[part="native"]');
113
- const scale = axisScale(native.style.transform || getComputedStyle(native).transform, vertical);
114
- const samples = [
115
- [0, 1],
116
- [0.033, 0.85],
117
- [0.067, 0.58],
118
- [0.1, 0.31],
119
- [0.133, 0.15],
120
- [0.167, 0.055],
121
- [0.2, 0.01],
122
- [0.267, -0.01],
123
- [0.367, -0.004],
124
- [0.45, 0],
125
- ];
126
- const bar = target.parentElement;
127
- const box = animationRect(bar, vertical);
128
- const current = animationRect(effectElement, vertical);
129
- const targetBox = animationRect(target, vertical);
130
- const center = box.left + box.width / 2;
131
- const x = center + (targetBox.left + targetBox.width / 2 - center) / (box.width / mainSize(bar, vertical)) - current.width / 2;
132
- const y = box.top + box.height / 2 - current.height / 2;
133
- const endScaleX = vertical ? target.offsetHeight / current.width : 1;
134
- const endScaleY = vertical ? target.offsetWidth / current.height : 1;
135
- const elapsed = (tapElapsed ?? 0) / 1000;
136
- const duration = tapElapsed === undefined ? 450 : 800 - tapElapsed;
137
- let frames = samples.map(([time, remaining]) => ({
138
- offset: time / 0.45,
139
- x: x + (current.x - x) * remaining,
140
- y: y + (current.y - y) * remaining,
141
- sx: endScaleX + (scale.a - endScaleX) * remaining,
142
- sy: endScaleY + (scale.d - endScaleY) * remaining,
143
- }));
144
- if (tapElapsed !== undefined && !vertical) {
145
- const nextIndex = tabBarTapFrames.findIndex(([time]) => time > elapsed);
146
- const previous = tabBarTapFrames[Math.max(0, nextIndex - 1)];
147
- const next = tabBarTapFrames[nextIndex];
148
- const progress = previous[1] + ((next[1] - previous[1]) * (elapsed - previous[0])) / (next[0] - previous[0]);
149
- const extraDistance = Math.max(0, tap.distance - 1);
150
- frames = [
151
- { offset: 0, x: current.x, y: current.y, sx: scale.a, sy: scale.d },
152
- ...tabBarTapFrames.slice(nextIndex).map(([time, position, width, height]) => ({
153
- offset: (time - elapsed) / (0.8 - elapsed),
154
- x: x + ((current.x - x) * (1 - position)) / Math.max(0.1, 1 - progress),
155
- y: y + ((current.y - y) * (1 - position)) / Math.max(0.1, 1 - progress),
156
- sx: 1 + (width * (time >= 0.367 ? 1 + 0.75 * extraDistance : 1)) / current.width,
157
- sy: 1 + (height * (time >= 0.367 ? 1 + 0.5 * extraDistance : 1)) / current.height,
158
- })),
159
- ];
160
- }
161
- const stretch = createAnimation()
162
- .addElement(native)
163
- .duration(duration)
164
- .easing('linear')
165
- .keyframes(frames.map(({ offset, sx, sy }) => ({ offset, transform: stretchTransform(sx, sy, vertical) })));
166
- const move = createAnimation()
167
- .addElement(effectElement)
168
- .duration(duration)
169
- .easing('linear')
170
- .keyframes(frames.map(({ offset, x, y }) => ({
171
- offset,
172
- transform: translate(x, y, vertical),
173
- })));
174
- const offset = 1 - 200 / duration;
175
- const selectedBackground = 'var(--ios27-tab-selected-background, rgba(var(--ios-theme-button-color-selected-rgb, var(--ios26-button-color-selected-rgb, var(--ios27-button-color-selected-default-rgb))), 0.095))';
176
- const glass = createAnimation()
177
- .addElement(effectElement)
178
- .easing('linear')
179
- .keyframes([
180
- { offset: 0, opacity: 1 },
181
- { offset, opacity: 1 },
182
- { offset: 1, opacity: 0 },
183
- ]);
184
- const selected = createAnimation()
185
- .addElement(target.shadowRoot.querySelector('[part="native"]'))
186
- .easing('linear')
187
- .keyframes([
188
- { offset: 0, backgroundColor: 'transparent' },
189
- { offset, backgroundColor: 'transparent' },
190
- { offset: 1, backgroundColor: selectedBackground },
191
- ]);
192
- const release = createAnimation().duration(duration).addAnimation([stretch, move, glass, selected]);
193
- if (tapElapsed !== undefined && !vertical) {
194
- const width = mainSize(bar, vertical);
195
- const expansion = box.width - width;
196
- const peak = Math.max(8.65, expansion);
197
- const platter = createAnimation()
198
- .addElement(bar)
199
- .easing('linear')
200
- .keyframes([
201
- [0, expansion],
202
- [17, expansion + (peak - expansion) * 0.503],
203
- [34, expansion + (peak - expansion) * 0.868],
204
- [50, peak],
205
- [67, peak * (8.46 / 8.65)],
206
- [83, peak * (7.73 / 8.65)],
207
- [100, peak * (6.66 / 8.65)],
208
- [117, peak * (5.44 / 8.65)],
209
- [134, peak * (4.19 / 8.65)],
210
- [150, peak * (3 / 8.65)],
211
- [167, peak * (1.97 / 8.65)],
212
- [184, peak * (1.09 / 8.65)],
213
- [200, peak * (0.39 / 8.65)],
214
- [217, 0],
215
- [234, peak * (-0.48 / 8.65)],
216
- [250, peak * (-0.7 / 8.65)],
217
- [267, peak * (-0.8 / 8.65)],
218
- [283, peak * (-0.82 / 8.65)],
219
- [300, peak * (-0.77 / 8.65)],
220
- [317, peak * (-0.68 / 8.65)],
221
- [334, peak * (-0.57 / 8.65)],
222
- [350, peak * (-0.46 / 8.65)],
223
- [383, peak * (-0.14 / 8.65)],
224
- [417, 0],
225
- [duration, 0],
226
- ].map(([time, extra]) => ({ offset: time / duration, transform: `scale(${1 + extra / width}) translateZ(0)` })));
227
- release.addAnimation(platter);
228
- }
229
- return release;
294
+ const createTabBarReleaseAnimation = (effectElement, target, tap, vertical = false) => {
295
+ const tapElapsed = tap?.elapsed;
296
+ const native = effectElement.shadowRoot.querySelector("[part=\"native\"]");
297
+ const scale = axisScale(native.style.transform || getComputedStyle(native).transform, vertical);
298
+ const samples = [
299
+ [0, 1],
300
+ [.033, .85],
301
+ [.067, .58],
302
+ [.1, .31],
303
+ [.133, .15],
304
+ [.167, .055],
305
+ [.2, .01],
306
+ [.267, -.01],
307
+ [.367, -.004],
308
+ [.45, 0]
309
+ ];
310
+ const bar = target.parentElement;
311
+ const box = animationRect(bar, vertical);
312
+ const current = animationRect(effectElement, vertical);
313
+ const targetBox = animationRect(target, vertical);
314
+ const center = box.left + box.width / 2;
315
+ const x = center + (targetBox.left + targetBox.width / 2 - center) / (box.width / mainSize(bar, vertical)) - current.width / 2;
316
+ const y = box.top + box.height / 2 - current.height / 2;
317
+ const endScaleX = vertical ? target.offsetHeight / current.width : 1;
318
+ const endScaleY = vertical ? target.offsetWidth / current.height : 1;
319
+ const elapsed = (tapElapsed ?? 0) / 1e3;
320
+ const duration = tapElapsed === void 0 ? 450 : 800 - tapElapsed;
321
+ let frames = samples.map(([time, remaining]) => ({
322
+ offset: time / .45,
323
+ x: x + (current.x - x) * remaining,
324
+ y: y + (current.y - y) * remaining,
325
+ sx: endScaleX + (scale.a - endScaleX) * remaining,
326
+ sy: endScaleY + (scale.d - endScaleY) * remaining
327
+ }));
328
+ if (tapElapsed !== void 0 && !vertical) {
329
+ const nextIndex = tabBarTapFrames.findIndex(([time]) => time > elapsed);
330
+ const previous = tabBarTapFrames[Math.max(0, nextIndex - 1)];
331
+ const next = tabBarTapFrames[nextIndex];
332
+ const progress = previous[1] + (next[1] - previous[1]) * (elapsed - previous[0]) / (next[0] - previous[0]);
333
+ const extraDistance = Math.max(0, tap.distance - 1);
334
+ frames = [{
335
+ offset: 0,
336
+ x: current.x,
337
+ y: current.y,
338
+ sx: scale.a,
339
+ sy: scale.d
340
+ }, ...tabBarTapFrames.slice(nextIndex).map(([time, position, width, height]) => ({
341
+ offset: (time - elapsed) / (.8 - elapsed),
342
+ x: x + (current.x - x) * (1 - position) / Math.max(.1, 1 - progress),
343
+ y: y + (current.y - y) * (1 - position) / Math.max(.1, 1 - progress),
344
+ sx: 1 + width * (time >= .367 ? 1 + .75 * extraDistance : 1) / current.width,
345
+ sy: 1 + height * (time >= .367 ? 1 + .5 * extraDistance : 1) / current.height
346
+ }))];
347
+ }
348
+ const stretch = createAnimation().addElement(native).duration(duration).easing("linear").keyframes(frames.map(({ offset, sx, sy }) => ({
349
+ offset,
350
+ transform: stretchTransform(sx, sy, vertical)
351
+ })));
352
+ const move = createAnimation().addElement(effectElement).duration(duration).easing("linear").keyframes(frames.map(({ offset, x, y }) => ({
353
+ offset,
354
+ transform: translate(x, y, vertical)
355
+ })));
356
+ const offset = 1 - 200 / duration;
357
+ const selectedBackground = "var(--ios27-tab-selected-background, rgba(var(--ios-theme-button-color-selected-rgb, var(--ios26-button-color-selected-rgb, var(--ios27-button-color-selected-default-rgb))), 0.095))";
358
+ const glass = createAnimation().addElement(effectElement).easing("linear").keyframes([
359
+ {
360
+ offset: 0,
361
+ opacity: 1
362
+ },
363
+ {
364
+ offset,
365
+ opacity: 1
366
+ },
367
+ {
368
+ offset: 1,
369
+ opacity: 0
370
+ }
371
+ ]);
372
+ const selected = createAnimation().addElement(target.shadowRoot.querySelector("[part=\"native\"]")).easing("linear").keyframes([
373
+ {
374
+ offset: 0,
375
+ backgroundColor: "transparent"
376
+ },
377
+ {
378
+ offset,
379
+ backgroundColor: "transparent"
380
+ },
381
+ {
382
+ offset: 1,
383
+ backgroundColor: selectedBackground
384
+ }
385
+ ]);
386
+ const release = createAnimation().duration(duration).addAnimation([
387
+ stretch,
388
+ move,
389
+ glass,
390
+ selected
391
+ ]);
392
+ if (tapElapsed !== void 0 && !vertical) {
393
+ const width = mainSize(bar, vertical);
394
+ const expansion = box.width - width;
395
+ const peak = Math.max(8.65, expansion);
396
+ const platter = createAnimation().addElement(bar).easing("linear").keyframes([
397
+ [0, expansion],
398
+ [17, expansion + (peak - expansion) * .503],
399
+ [34, expansion + (peak - expansion) * .868],
400
+ [50, peak],
401
+ [67, peak * (8.46 / 8.65)],
402
+ [83, peak * (7.73 / 8.65)],
403
+ [100, peak * (6.66 / 8.65)],
404
+ [117, peak * (5.44 / 8.65)],
405
+ [134, peak * (4.19 / 8.65)],
406
+ [150, peak * (3 / 8.65)],
407
+ [167, peak * (1.97 / 8.65)],
408
+ [184, peak * (1.09 / 8.65)],
409
+ [200, peak * (.39 / 8.65)],
410
+ [217, 0],
411
+ [234, peak * (-.48 / 8.65)],
412
+ [250, peak * (-.7 / 8.65)],
413
+ [267, peak * (-.8 / 8.65)],
414
+ [283, peak * (-.82 / 8.65)],
415
+ [300, peak * (-.77 / 8.65)],
416
+ [317, peak * (-.68 / 8.65)],
417
+ [334, peak * (-.57 / 8.65)],
418
+ [350, peak * (-.46 / 8.65)],
419
+ [383, peak * (-.14 / 8.65)],
420
+ [417, 0],
421
+ [duration, 0]
422
+ ].map(([time, extra]) => ({
423
+ offset: time / duration,
424
+ transform: `scale(${1 + extra / width}) translateZ(0)`
425
+ })));
426
+ release.addAnimation(platter);
427
+ }
428
+ return release;
230
429
  };
231
- export const createPreMoveAnimation = (effectElement, tabSelectedElement, currentTouchedElement, animationPosition) => {
232
- const diff = Math.max(Math.abs(tabSelectedElement.getBoundingClientRect().left - currentTouchedElement.getBoundingClientRect().left), 140);
233
- return createAnimation()
234
- .duration(diff * 2.1)
235
- .easing('ease-out')
236
- .addElement(effectElement)
237
- .beforeStyles({
238
- width: `${tabSelectedElement.clientWidth}px`,
239
- height: `${tabSelectedElement.clientHeight}px`,
240
- display: 'block',
241
- opacity: '1',
242
- transform: 'none',
243
- })
244
- .keyframes([
245
- {
246
- offset: 0,
247
- transform: `translate3d(${tabSelectedElement.getBoundingClientRect().left}px, ${animationPosition.positionY}px, 0)`,
248
- },
249
- {
250
- offset: 1,
251
- transform: `translate3d(${currentTouchedElement.getBoundingClientRect().left}px, ${animationPosition.positionY}px, 0)`,
252
- },
253
- ]);
430
+ const createPreMoveAnimation = (effectElement, tabSelectedElement, currentTouchedElement, animationPosition) => {
431
+ const diff = Math.max(Math.abs(tabSelectedElement.getBoundingClientRect().left - currentTouchedElement.getBoundingClientRect().left), 140);
432
+ return createAnimation().duration(diff * 2.1).easing("ease-out").addElement(effectElement).beforeStyles({
433
+ width: `${tabSelectedElement.clientWidth}px`,
434
+ height: `${tabSelectedElement.clientHeight}px`,
435
+ display: "block",
436
+ opacity: "1",
437
+ transform: "none"
438
+ }).keyframes([{
439
+ offset: 0,
440
+ transform: `translate3d(${tabSelectedElement.getBoundingClientRect().left}px, ${animationPosition.positionY}px, 0)`
441
+ }, {
442
+ offset: 1,
443
+ transform: `translate3d(${currentTouchedElement.getBoundingClientRect().left}px, ${animationPosition.positionY}px, 0)`
444
+ }]);
254
445
  };
255
- export const createMoveAnimation = (effectElement, detail, tabSelectedElement, animationPosition, vertical = false) => {
256
- return createAnimation()
257
- .duration(500)
258
- .addElement(effectElement)
259
- .beforeStyles({
260
- width: `${tabSelectedElement.clientWidth}px`,
261
- height: `${tabSelectedElement.clientHeight}px`,
262
- display: 'block',
263
- opacity: '1',
264
- transform: 'none',
265
- })
266
- .fromTo('transform', translate(animationPosition.minPositionX, animationPosition.positionY, vertical), translate(animationPosition.maxPositionX, animationPosition.positionY, vertical))
267
- .progressStep(getStep(detail.currentX, animationPosition));
446
+ const createMoveAnimation = (effectElement, detail, tabSelectedElement, animationPosition, vertical = false) => {
447
+ return createAnimation().duration(500).addElement(effectElement).beforeStyles({
448
+ width: `${tabSelectedElement.clientWidth}px`,
449
+ height: `${tabSelectedElement.clientHeight}px`,
450
+ display: "block",
451
+ opacity: "1",
452
+ transform: "none"
453
+ }).fromTo("transform", translate(animationPosition.minPositionX, animationPosition.positionY, vertical), translate(animationPosition.maxPositionX, animationPosition.positionY, vertical)).progressStep(getStep(detail.currentX, animationPosition));
268
454
  };
269
- export const getMoveAnimationKeyframe = (type, scales) => {
270
- return {
271
- moveRight: [
272
- {
273
- offset: 0,
274
- transform: scales.large,
275
- },
276
- {
277
- offset: 0.4,
278
- transform: scales.small,
279
- },
280
- {
281
- offset: 0.75,
282
- transform: scales.xlarge,
283
- },
284
- {
285
- offset: 1,
286
- transform: scales.large,
287
- },
288
- ],
289
- moveLeft: [
290
- {
291
- offset: 0,
292
- transform: scales.large,
293
- },
294
- {
295
- offset: 0.1,
296
- transform: scales.xlarge,
297
- },
298
- {
299
- offset: 0.6,
300
- transform: scales.small,
301
- },
302
- {
303
- offset: 1,
304
- transform: scales.large,
305
- },
306
- ],
307
- slowly: [
308
- {
309
- offset: 0,
310
- transform: scales.large,
311
- },
312
- {
313
- offset: 0.4,
314
- transform: scales.medium,
315
- },
316
- {
317
- offset: 1,
318
- transform: scales.large,
319
- },
320
- ],
321
- }[type];
455
+ const getMoveAnimationKeyframe = (type, scales) => {
456
+ return {
457
+ moveRight: [
458
+ {
459
+ offset: 0,
460
+ transform: scales.large
461
+ },
462
+ {
463
+ offset: .4,
464
+ transform: scales.small
465
+ },
466
+ {
467
+ offset: .75,
468
+ transform: scales.xlarge
469
+ },
470
+ {
471
+ offset: 1,
472
+ transform: scales.large
473
+ }
474
+ ],
475
+ moveLeft: [
476
+ {
477
+ offset: 0,
478
+ transform: scales.large
479
+ },
480
+ {
481
+ offset: .1,
482
+ transform: scales.xlarge
483
+ },
484
+ {
485
+ offset: .6,
486
+ transform: scales.small
487
+ },
488
+ {
489
+ offset: 1,
490
+ transform: scales.large
491
+ }
492
+ ],
493
+ slowly: [
494
+ {
495
+ offset: 0,
496
+ transform: scales.large
497
+ },
498
+ {
499
+ offset: .4,
500
+ transform: scales.medium
501
+ },
502
+ {
503
+ offset: 1,
504
+ transform: scales.large
505
+ }
506
+ ]
507
+ }[type];
322
508
  };
509
+ //#endregion
510
+ export { animationRect, createMoveAnimation, createPreMoveAnimation, createTabBarDragAnimation, createTabBarPressAnimation, createTabBarReleaseAnimation, getMoveAnimationKeyframe, getScaleAnimation };
511
+
512
+ //# sourceMappingURL=animations.js.map