@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.
- package/README.md +15 -2
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/css/ionic-theme-ios27.css +1 -1
- package/dist/css/vertical-bars.css +1 -1
- package/dist/focus-controller/index.d.ts +4 -2
- package/dist/focus-controller/index.d.ts.map +1 -1
- package/dist/focus-controller/index.js +100 -57
- package/dist/focus-controller/index.js.map +1 -0
- package/dist/index.d.ts +10 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -60
- package/dist/index.js.map +1 -0
- package/dist/native/components/index.d.ts +13 -10
- package/dist/native/components/index.d.ts.map +1 -1
- package/dist/native/components/index.js +39 -41
- package/dist/native/components/index.js.map +1 -0
- package/dist/native/components/ion-back-button.d.ts +6 -1
- package/dist/native/components/ion-back-button.d.ts.map +1 -1
- package/dist/native/components/ion-back-button.js +19 -13
- package/dist/native/components/ion-back-button.js.map +1 -0
- package/dist/native/components/ion-button.d.ts +8 -2
- package/dist/native/components/ion-button.d.ts.map +1 -1
- package/dist/native/components/ion-button.js +22 -17
- package/dist/native/components/ion-button.js.map +1 -0
- package/dist/native/components/ion-buttons.d.ts +8 -2
- package/dist/native/components/ion-buttons.d.ts.map +1 -1
- package/dist/native/components/ion-buttons.js +29 -33
- package/dist/native/components/ion-buttons.js.map +1 -0
- package/dist/native/components/ion-fab.d.ts +6 -1
- package/dist/native/components/ion-fab.d.ts.map +1 -1
- package/dist/native/components/ion-fab.js +131 -151
- package/dist/native/components/ion-fab.js.map +1 -0
- package/dist/native/components/ion-menu-button.d.ts +8 -2
- package/dist/native/components/ion-menu-button.d.ts.map +1 -1
- package/dist/native/components/ion-menu-button.js +29 -19
- package/dist/native/components/ion-menu-button.js.map +1 -0
- package/dist/native/components/ion-segment.d.ts +6 -1
- package/dist/native/components/ion-segment.d.ts.map +1 -1
- package/dist/native/components/ion-segment.js +29 -23
- package/dist/native/components/ion-segment.js.map +1 -0
- package/dist/native/components/ion-tab-bar.d.ts +6 -1
- package/dist/native/components/ion-tab-bar.d.ts.map +1 -1
- package/dist/native/components/ion-tab-bar.js +49 -40
- package/dist/native/components/ion-tab-bar.js.map +1 -0
- package/dist/native/components/searchable-tabs.d.ts +17 -15
- package/dist/native/components/searchable-tabs.d.ts.map +1 -1
- package/dist/native/components/searchable-tabs.js +382 -434
- package/dist/native/components/searchable-tabs.js.map +1 -0
- package/dist/native/definitions.d.ts +118 -111
- package/dist/native/definitions.d.ts.map +1 -1
- package/dist/native/definitions.js +0 -1
- package/dist/native/foldable/fold-state.d.ts +5 -0
- package/dist/native/foldable/fold-state.d.ts.map +1 -0
- package/dist/native/foldable/fold-state.js +14 -0
- package/dist/native/foldable/fold-state.js.map +1 -0
- package/dist/native/foldable/types.d.ts +12 -0
- package/dist/native/foldable/types.d.ts.map +1 -0
- package/dist/native/foldable/types.js +0 -0
- package/dist/native/index.d.ts +6 -3
- package/dist/native/index.d.ts.map +1 -1
- package/dist/native/index.js +228 -204
- package/dist/native/index.js.map +1 -0
- package/dist/native/prehide.d.ts +4 -2
- package/dist/native/prehide.d.ts.map +1 -1
- package/dist/native/prehide.js +220 -242
- package/dist/native/prehide.js.map +1 -0
- package/dist/native/runtime.d.ts +3 -1
- package/dist/native/runtime.d.ts.map +1 -1
- package/dist/native/runtime.js +626 -730
- package/dist/native/runtime.js.map +1 -0
- package/dist/native/shared/candidate.d.ts +16 -11
- package/dist/native/shared/candidate.d.ts.map +1 -1
- package/dist/native/shared/candidate.js +96 -95
- package/dist/native/shared/candidate.js.map +1 -0
- package/dist/native/shared/crossfade.d.ts +6 -4
- package/dist/native/shared/crossfade.d.ts.map +1 -1
- package/dist/native/shared/crossfade.js +49 -45
- package/dist/native/shared/crossfade.js.map +1 -0
- package/dist/native/shared/dom.d.ts +7 -5
- package/dist/native/shared/dom.d.ts.map +1 -1
- package/dist/native/shared/dom.js +163 -211
- package/dist/native/shared/dom.js.map +1 -0
- package/dist/native/shared/events.d.ts +8 -6
- package/dist/native/shared/events.d.ts.map +1 -1
- package/dist/native/shared/events.js +12 -7
- package/dist/native/shared/events.js.map +1 -0
- package/dist/native/shared/icons.d.ts +4 -2
- package/dist/native/shared/icons.d.ts.map +1 -1
- package/dist/native/shared/icons.js +59 -53
- package/dist/native/shared/icons.js.map +1 -0
- package/dist/native/shared/modal.d.ts +3 -1
- package/dist/native/shared/modal.d.ts.map +1 -1
- package/dist/native/shared/modal.js +156 -139
- package/dist/native/shared/modal.js.map +1 -0
- package/dist/native/vertical-bars-web.d.ts +3 -1
- package/dist/native/vertical-bars-web.d.ts.map +1 -1
- package/dist/native/vertical-bars-web.js +332 -346
- package/dist/native/vertical-bars-web.js.map +1 -0
- package/dist/native-integration/index.d.ts +10 -8
- package/dist/native-integration/index.d.ts.map +1 -1
- package/dist/native-integration/index.js +102 -100
- package/dist/native-integration/index.js.map +1 -0
- package/dist/native-integration/transition.d.ts +3 -1
- package/dist/native-integration/transition.d.ts.map +1 -1
- package/dist/native-integration/transition.js +15 -6
- package/dist/native-integration/transition.js.map +1 -0
- package/dist/searchbar/index.d.ts +4 -2
- package/dist/searchbar/index.d.ts.map +1 -1
- package/dist/searchbar/index.js +64 -56
- package/dist/searchbar/index.js.map +1 -0
- package/dist/segment/index.d.ts +3 -1
- package/dist/segment/index.d.ts.map +1 -1
- package/dist/segment/index.js +465 -324
- package/dist/segment/index.js.map +1 -0
- package/dist/sheets-of-glass/animations.d.ts +13 -12
- package/dist/sheets-of-glass/animations.d.ts.map +1 -1
- package/dist/sheets-of-glass/animations.js +496 -306
- package/dist/sheets-of-glass/animations.js.map +1 -0
- package/dist/sheets-of-glass/index.d.ts +3 -1
- package/dist/sheets-of-glass/index.d.ts.map +1 -1
- package/dist/sheets-of-glass/index.js +294 -357
- package/dist/sheets-of-glass/index.js.map +1 -0
- package/dist/sheets-of-glass/interfaces.d.ts +11 -9
- package/dist/sheets-of-glass/interfaces.d.ts.map +1 -1
- package/dist/sheets-of-glass/interfaces.js +0 -1
- package/dist/tab-bar-searchable/animations/enter.d.ts +4 -2
- package/dist/tab-bar-searchable/animations/enter.d.ts.map +1 -1
- package/dist/tab-bar-searchable/animations/enter.js +50 -69
- package/dist/tab-bar-searchable/animations/enter.js.map +1 -0
- package/dist/tab-bar-searchable/animations/leave.d.ts +4 -2
- package/dist/tab-bar-searchable/animations/leave.d.ts.map +1 -1
- package/dist/tab-bar-searchable/animations/leave.js +48 -62
- package/dist/tab-bar-searchable/animations/leave.js.map +1 -0
- package/dist/tab-bar-searchable/index.d.ts +5 -3
- package/dist/tab-bar-searchable/index.d.ts.map +1 -1
- package/dist/tab-bar-searchable/index.js +123 -135
- package/dist/tab-bar-searchable/index.js.map +1 -0
- package/dist/transition/index.d.ts +9 -8
- package/dist/transition/index.d.ts.map +1 -1
- package/dist/transition/index.js +203 -192
- package/dist/transition/index.js.map +1 -0
- package/dist/transition/ios.transition.d.ts +7 -5
- package/dist/transition/ios.transition.d.ts.map +1 -1
- package/dist/transition/ios.transition.js +15 -11
- package/dist/transition/ios.transition.js.map +1 -0
- package/dist/utils.d.ts +10 -8
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +58 -66
- package/dist/utils.js.map +1 -0
- package/dist/vertical-bars.d.ts +5 -4
- package/dist/vertical-bars.js +4 -2
- package/docs/iphone-duo-with-original-theme.md +18 -29
- package/docs/iphone-duo.md +44 -204
- package/docs/native-ui-shell.md +10 -8
- package/docs/special-markup.md +2 -0
- package/docs/vertical-bars.md +283 -0
- package/ios/Sources/IonicNativeUIShellPlugin/Components/ShellVerticalBars.swift +34 -14
- package/ios/Sources/IonicNativeUIShellPlugin/Shared/ShellSnapshot.swift +2 -0
- package/ios/Tests/IonicNativeUIShellPluginTests/ShellSnapshotTests.swift +3 -0
- package/package.json +9 -6
- package/src/native/components/index.ts +3 -2
- package/src/native/components/ion-button.ts +3 -2
- package/src/native/components/ion-buttons.ts +4 -3
- package/src/native/components/ion-menu-button.ts +3 -2
- package/src/native/definitions.ts +22 -1
- package/src/native/foldable/fold-state.ts +9 -0
- package/src/native/foldable/types.ts +4 -0
- package/src/native/index.ts +17 -3
- package/src/native/prehide.ts +3 -1
- package/src/native/runtime.ts +2 -2
- package/src/native/shared/candidate.ts +39 -10
- package/src/native/shared/dom.ts +4 -4
- package/src/styles/vertical-bars.scss +4 -2
- package/src/vertical-bars.ts +9 -1
- package/dist/vertical-bars.d.ts.map +0 -1
|
@@ -1,358 +1,295 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
if (effectTagName !== 'ion-tab-button')
|
|
292
|
-
setTimeout(() => {
|
|
293
|
-
if (!currentTouchedElement) {
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
const targetX = currentTouchedElement.getBoundingClientRect().left + currentTouchedElement.clientWidth / 2;
|
|
297
|
-
const step = getStep(targetX, animationPosition);
|
|
298
|
-
moveAnimation.progressStep(step);
|
|
299
|
-
});
|
|
300
|
-
if (effectTagName === 'ion-tab-button') {
|
|
301
|
-
stopTabPress();
|
|
302
|
-
moveAnimation.destroy();
|
|
303
|
-
moveAnimation = undefined;
|
|
304
|
-
const tabs = Array.from(targetElement.querySelectorAll(effectTagName)).filter((tab) => tab.offsetWidth > 0);
|
|
305
|
-
if (vertical) {
|
|
306
|
-
currentTouchedElement.classList.remove('ion-activated');
|
|
307
|
-
targetElement.classList.remove(ANIMATED_NAME);
|
|
308
|
-
}
|
|
309
|
-
const releasing = createTabBarReleaseAnimation(effectElement, currentTouchedElement, tapElapsed !== undefined && tapElapsed < 200
|
|
310
|
-
? {
|
|
311
|
-
elapsed: tapElapsed,
|
|
312
|
-
distance: Math.abs(tabs.indexOf(currentTouchedElement) - tabs.indexOf(selectedElementBeforeGesture)),
|
|
313
|
-
}
|
|
314
|
-
: undefined, vertical);
|
|
315
|
-
currentTouchedElement.classList.remove('ion-activated');
|
|
316
|
-
releaseAnimation = releasing;
|
|
317
|
-
await releasing.play();
|
|
318
|
-
if (releaseAnimation !== releasing)
|
|
319
|
-
return;
|
|
320
|
-
clearActivated(true);
|
|
321
|
-
releasing.destroy();
|
|
322
|
-
releaseAnimation = undefined;
|
|
323
|
-
}
|
|
324
|
-
else {
|
|
325
|
-
await getScaleAnimation(effectElement).duration(120).to('transform', `scale(1, 0.92)`).play();
|
|
326
|
-
}
|
|
327
|
-
moveAnimation?.destroy();
|
|
328
|
-
clearActivated(true);
|
|
329
|
-
return true;
|
|
330
|
-
};
|
|
331
|
-
const nativeChanged = () => {
|
|
332
|
-
gesture.enable(!isNativeUIShell(targetElement));
|
|
333
|
-
cancelActiveGesture();
|
|
334
|
-
};
|
|
335
|
-
targetElement.addEventListener('nativeUIShellChange', nativeChanged);
|
|
336
|
-
if (isNativeUIShell(targetElement))
|
|
337
|
-
nativeChanged();
|
|
338
|
-
return {
|
|
339
|
-
destroy: () => {
|
|
340
|
-
destroyed = true;
|
|
341
|
-
cancelActiveGesture();
|
|
342
|
-
targetElement.removeEventListener('pointerdown', onPointerDown);
|
|
343
|
-
targetElement.removeEventListener('click', onClick, true);
|
|
344
|
-
targetElement.removeEventListener('nativeUIShellChange', nativeChanged);
|
|
345
|
-
if (gesture) {
|
|
346
|
-
gesture.destroy();
|
|
347
|
-
}
|
|
348
|
-
targetElement.classList.remove(GESTURE_NAME);
|
|
349
|
-
effectElement.remove();
|
|
350
|
-
if (effectTagName === 'ion-tab-button') {
|
|
351
|
-
if (originalTabBarScale)
|
|
352
|
-
targetElement.style.setProperty('--ios27-tab-bar-scale', originalTabBarScale);
|
|
353
|
-
else
|
|
354
|
-
targetElement.style.removeProperty('--ios27-tab-bar-scale');
|
|
355
|
-
}
|
|
356
|
-
},
|
|
357
|
-
};
|
|
1
|
+
import { changeSelectedElement, cloneElement, getStep } from "../utils.js";
|
|
2
|
+
import { isNativeUIShell } from "../native-integration/index.js";
|
|
3
|
+
import { animationRect, createMoveAnimation, createPreMoveAnimation, createTabBarDragAnimation, createTabBarPressAnimation, createTabBarReleaseAnimation, getMoveAnimationKeyframe, getScaleAnimation } from "./animations.js";
|
|
4
|
+
import { createGesture } from "@ionic/core";
|
|
5
|
+
//#region src/sheets-of-glass/index.ts
|
|
6
|
+
const GESTURE_NAME = "ios27-enable-gesture";
|
|
7
|
+
const ANIMATED_NAME = "ios27-animated";
|
|
8
|
+
const registerEffect = (targetElement, effectTagName, selectedClassName, scales, vertical = false) => {
|
|
9
|
+
if (!targetElement.classList.contains("ios")) return;
|
|
10
|
+
let gesture;
|
|
11
|
+
let moveAnimation;
|
|
12
|
+
let currentTouchedElement;
|
|
13
|
+
let selectedElementBeforeGesture;
|
|
14
|
+
let clearActivatedTimer;
|
|
15
|
+
let animationPosition = void 0;
|
|
16
|
+
let scaleAnimationPromise;
|
|
17
|
+
let startAnimationPromise;
|
|
18
|
+
let maxVelocity = 0;
|
|
19
|
+
let releaseAnimation;
|
|
20
|
+
let tabPressAnimation;
|
|
21
|
+
let tabPressStartedAt = 0;
|
|
22
|
+
let tabDragging = false;
|
|
23
|
+
let destroyed = false;
|
|
24
|
+
const originalTabBarScale = targetElement.style.getPropertyValue("--ios27-tab-bar-scale");
|
|
25
|
+
const effectElement = cloneElement(effectTagName, false);
|
|
26
|
+
if (vertical) effectElement.classList.add("ios27-vertical-tab-effect");
|
|
27
|
+
const stopTabPress = () => {
|
|
28
|
+
if (!tabPressAnimation) return;
|
|
29
|
+
const native = effectElement.shadowRoot.querySelector("[part=\"native\"]");
|
|
30
|
+
const transform = getComputedStyle(effectElement).transform;
|
|
31
|
+
const scale = getComputedStyle(native).transform;
|
|
32
|
+
tabPressAnimation.destroy();
|
|
33
|
+
tabPressAnimation = void 0;
|
|
34
|
+
effectElement.style.transform = transform;
|
|
35
|
+
native.style.transform = scale;
|
|
36
|
+
};
|
|
37
|
+
let onPointerUp;
|
|
38
|
+
let onPointerCancel;
|
|
39
|
+
const removePointerEndListeners = () => {
|
|
40
|
+
if (onPointerUp) {
|
|
41
|
+
document.removeEventListener("pointerup", onPointerUp);
|
|
42
|
+
onPointerUp = void 0;
|
|
43
|
+
}
|
|
44
|
+
if (onPointerCancel) {
|
|
45
|
+
document.removeEventListener("pointercancel", onPointerCancel);
|
|
46
|
+
onPointerCancel = void 0;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const cancelActiveGesture = () => {
|
|
50
|
+
stopTabPress();
|
|
51
|
+
releaseAnimation?.destroy();
|
|
52
|
+
releaseAnimation = void 0;
|
|
53
|
+
removePointerEndListeners();
|
|
54
|
+
if (clearActivatedTimer !== void 0) {
|
|
55
|
+
clearTimeout(clearActivatedTimer);
|
|
56
|
+
clearActivatedTimer = void 0;
|
|
57
|
+
}
|
|
58
|
+
currentTouchedElement?.classList.remove("ion-activated");
|
|
59
|
+
if (!currentTouchedElement?.classList.contains(selectedClassName)) selectedElementBeforeGesture?.classList.add(selectedClassName);
|
|
60
|
+
currentTouchedElement = void 0;
|
|
61
|
+
selectedElementBeforeGesture = void 0;
|
|
62
|
+
moveAnimation?.destroy();
|
|
63
|
+
moveAnimation = void 0;
|
|
64
|
+
effectElement.style.display = "none";
|
|
65
|
+
maxVelocity = 0;
|
|
66
|
+
targetElement.classList.remove(ANIMATED_NAME);
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* These event listeners fix a bug where gestures don't complete properly.
|
|
70
|
+
* They terminate the gesture using native events as a fallback.
|
|
71
|
+
*/
|
|
72
|
+
const onPointerDown = (event) => {
|
|
73
|
+
if (isNativeUIShell(targetElement)) return;
|
|
74
|
+
stopTabPress();
|
|
75
|
+
tabDragging = false;
|
|
76
|
+
releaseAnimation?.destroy();
|
|
77
|
+
releaseAnimation = void 0;
|
|
78
|
+
clearActivated();
|
|
79
|
+
gesture.destroy();
|
|
80
|
+
createAnimationGesture();
|
|
81
|
+
removePointerEndListeners();
|
|
82
|
+
onPointerUp = () => {
|
|
83
|
+
clearActivatedTimer = setTimeout(async () => {
|
|
84
|
+
await onEndGesture();
|
|
85
|
+
if (destroyed) return;
|
|
86
|
+
gesture.destroy();
|
|
87
|
+
createAnimationGesture();
|
|
88
|
+
});
|
|
89
|
+
removePointerEndListeners();
|
|
90
|
+
};
|
|
91
|
+
onPointerCancel = () => {
|
|
92
|
+
cancelActiveGesture();
|
|
93
|
+
gesture.destroy();
|
|
94
|
+
createAnimationGesture();
|
|
95
|
+
};
|
|
96
|
+
document.addEventListener("pointerup", onPointerUp);
|
|
97
|
+
document.addEventListener("pointercancel", onPointerCancel);
|
|
98
|
+
};
|
|
99
|
+
targetElement.addEventListener("pointerdown", onPointerDown);
|
|
100
|
+
const onClick = (event) => {
|
|
101
|
+
if (vertical && tabDragging && event.isTrusted && event.detail > 0) {
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
event.stopImmediatePropagation();
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
targetElement.addEventListener("click", onClick, true);
|
|
107
|
+
const axisDetail = (detail) => vertical ? {
|
|
108
|
+
...detail,
|
|
109
|
+
currentX: detail.currentY,
|
|
110
|
+
currentY: detail.currentX,
|
|
111
|
+
startX: detail.startY,
|
|
112
|
+
startY: detail.startX,
|
|
113
|
+
velocityX: detail.velocityY,
|
|
114
|
+
velocityY: detail.velocityX
|
|
115
|
+
} : detail;
|
|
116
|
+
const createAnimationGesture = () => {
|
|
117
|
+
targetElement.classList.add(GESTURE_NAME);
|
|
118
|
+
gesture = createGesture({
|
|
119
|
+
el: targetElement,
|
|
120
|
+
threshold: 0,
|
|
121
|
+
direction: vertical ? "y" : "x",
|
|
122
|
+
gestureName: `${GESTURE_NAME}_${effectTagName}_${crypto.randomUUID()}`,
|
|
123
|
+
onStart: (event) => onStartGesture(axisDetail(event)),
|
|
124
|
+
onMove: (event) => onMoveGesture(axisDetail(event)),
|
|
125
|
+
onEnd: (detail) => {
|
|
126
|
+
if (effectTagName === "ion-tab-button" && tabDragging) onMoveGesture(axisDetail(detail));
|
|
127
|
+
onEndGesture().then();
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
gesture.enable(true);
|
|
131
|
+
};
|
|
132
|
+
createAnimationGesture();
|
|
133
|
+
const clearActivated = (isEndGesture = false) => {
|
|
134
|
+
if (!currentTouchedElement) return;
|
|
135
|
+
if (!isEndGesture && !currentTouchedElement.classList.contains(selectedClassName)) {
|
|
136
|
+
currentTouchedElement.click();
|
|
137
|
+
currentTouchedElement.classList.add(selectedClassName);
|
|
138
|
+
}
|
|
139
|
+
currentTouchedElement.classList.remove("ion-activated");
|
|
140
|
+
currentTouchedElement = void 0;
|
|
141
|
+
selectedElementBeforeGesture = void 0;
|
|
142
|
+
effectElement.style.display = "none";
|
|
143
|
+
maxVelocity = 0;
|
|
144
|
+
targetElement.classList.remove(ANIMATED_NAME);
|
|
145
|
+
};
|
|
146
|
+
const onStartGesture = (detail) => {
|
|
147
|
+
if (isNativeUIShell(targetElement)) return false;
|
|
148
|
+
currentTouchedElement = detail.event.target.closest(effectTagName) || void 0;
|
|
149
|
+
const tabSelectedElement = targetElement.querySelector(`${effectTagName}.${selectedClassName}`);
|
|
150
|
+
if (currentTouchedElement === void 0 || currentTouchedElement.parentElement !== targetElement || currentTouchedElement.disabled || tabSelectedElement === null) {
|
|
151
|
+
currentTouchedElement = void 0;
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
selectedElementBeforeGesture = tabSelectedElement;
|
|
155
|
+
if (effectTagName === "ion-tab-button") targetElement.style.setProperty("--ios27-tab-bar-scale", String(1 + 14.14 / (vertical ? targetElement.offsetHeight : targetElement.offsetWidth)));
|
|
156
|
+
if (vertical) targetElement.classList.add(ANIMATED_NAME);
|
|
157
|
+
animationPosition = {
|
|
158
|
+
minPositionX: animationRect(targetElement, vertical).left,
|
|
159
|
+
maxPositionX: animationRect(targetElement, vertical).right - (vertical ? tabSelectedElement.clientHeight : tabSelectedElement.clientWidth),
|
|
160
|
+
width: vertical ? tabSelectedElement.clientHeight : tabSelectedElement.clientWidth,
|
|
161
|
+
positionY: animationRect(tabSelectedElement, vertical).top
|
|
162
|
+
};
|
|
163
|
+
targetElement.classList.add(ANIMATED_NAME);
|
|
164
|
+
changeSelectedElement(targetElement, currentTouchedElement, effectTagName, selectedClassName);
|
|
165
|
+
if (effectTagName === "ion-tab-button") {
|
|
166
|
+
moveAnimation = createMoveAnimation(effectElement, detail, tabSelectedElement, animationPosition, vertical);
|
|
167
|
+
moveAnimation.progressStart(true, getStep(animationRect(tabSelectedElement, vertical).left + animationRect(tabSelectedElement, vertical).width / 2, animationPosition));
|
|
168
|
+
tabPressAnimation = createTabBarPressAnimation(effectElement, tabSelectedElement, currentTouchedElement, targetElement, vertical);
|
|
169
|
+
tabPressStartedAt = performance.now();
|
|
170
|
+
tabPressAnimation.play();
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
const startAnimation = (() => {
|
|
174
|
+
if (tabSelectedElement === currentTouchedElement) return new Promise((resolve) => resolve());
|
|
175
|
+
else {
|
|
176
|
+
const preMoveAnimation = createPreMoveAnimation(effectElement, tabSelectedElement, currentTouchedElement, animationPosition);
|
|
177
|
+
return preMoveAnimation.play().finally(() => preMoveAnimation.destroy());
|
|
178
|
+
}
|
|
179
|
+
})();
|
|
180
|
+
startAnimationPromise = startAnimation;
|
|
181
|
+
startAnimation.then(() => {
|
|
182
|
+
if (!currentTouchedElement) return;
|
|
183
|
+
moveAnimation = createMoveAnimation(effectElement, detail, tabSelectedElement, animationPosition);
|
|
184
|
+
moveAnimation.progressStart(true, getStep(currentTouchedElement.getBoundingClientRect().left + currentTouchedElement.clientWidth / 2, animationPosition));
|
|
185
|
+
});
|
|
186
|
+
getScaleAnimation(effectElement).duration(200).to("opacity", 1).to("transform", scales.large).play();
|
|
187
|
+
return true;
|
|
188
|
+
};
|
|
189
|
+
const onMoveGesture = (detail) => {
|
|
190
|
+
if (currentTouchedElement === void 0 || !moveAnimation || releaseAnimation) return false;
|
|
191
|
+
if (effectTagName === "ion-tab-button") {
|
|
192
|
+
if (Math.abs(detail.currentX - detail.startX) < 3 && !tabDragging) return;
|
|
193
|
+
tabDragging = true;
|
|
194
|
+
stopTabPress();
|
|
195
|
+
tabPressAnimation = createTabBarDragAnimation(effectElement, targetElement, detail.velocityX, vertical);
|
|
196
|
+
tabPressAnimation.play();
|
|
197
|
+
} else if (scaleAnimationPromise === void 0) {
|
|
198
|
+
if (Math.abs(detail.velocityX) > maxVelocity) maxVelocity = Math.abs(detail.velocityX);
|
|
199
|
+
if (Math.abs(detail.velocityX) > .2) scaleAnimationPromise = getScaleAnimation(effectElement).duration(720).keyframes(getMoveAnimationKeyframe("slowly", scales)).play().finally(() => scaleAnimationPromise = void 0);
|
|
200
|
+
if (maxVelocity > .2 && Math.abs(detail.velocityX) < .15 && Math.abs(detail.startX - detail.currentX) > 100) {
|
|
201
|
+
scaleAnimationPromise = getScaleAnimation(effectElement).duration(720).keyframes(getMoveAnimationKeyframe(detail.velocityX > 0 ? "moveRight" : "moveLeft", scales)).play().finally(() => scaleAnimationPromise = void 0);
|
|
202
|
+
maxVelocity = 0;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
const currentX = detail.currentX;
|
|
206
|
+
const previousY = animationRect(targetElement, vertical).top + animationRect(targetElement, vertical).height / 2;
|
|
207
|
+
let latestTouchedElement = targetElement.getRootNode().elementFromPoint(vertical ? previousY : currentX, vertical ? currentX : previousY)?.closest(effectTagName) || void 0;
|
|
208
|
+
if (vertical && effectTagName === "ion-tab-button") {
|
|
209
|
+
const bar = targetElement.getBoundingClientRect();
|
|
210
|
+
const tabs = Array.from(targetElement.querySelectorAll(effectTagName)).filter((tab) => tab.offsetWidth > 0);
|
|
211
|
+
const distance = (tab) => Math.abs(currentX - (bar.top + tab.offsetTop + tab.offsetHeight / 2));
|
|
212
|
+
latestTouchedElement = currentX >= bar.top && currentX <= bar.bottom ? tabs.reduce((closest, tab) => !closest || distance(tab) < distance(closest) ? tab : closest, void 0) : void 0;
|
|
213
|
+
}
|
|
214
|
+
if (latestTouchedElement && latestTouchedElement.parentElement === targetElement && !latestTouchedElement.disabled && currentTouchedElement !== latestTouchedElement) {
|
|
215
|
+
currentTouchedElement = latestTouchedElement;
|
|
216
|
+
changeSelectedElement(targetElement, currentTouchedElement, effectTagName, selectedClassName);
|
|
217
|
+
}
|
|
218
|
+
moveAnimation.progressStep(getStep(detail.currentX, animationPosition));
|
|
219
|
+
return true;
|
|
220
|
+
};
|
|
221
|
+
const onEndGesture = async () => {
|
|
222
|
+
if (releaseAnimation) return;
|
|
223
|
+
if (clearActivatedTimer !== void 0) {
|
|
224
|
+
clearTimeout(clearActivatedTimer);
|
|
225
|
+
clearActivatedTimer = void 0;
|
|
226
|
+
}
|
|
227
|
+
if (currentTouchedElement && !currentTouchedElement.classList.contains(selectedClassName)) {
|
|
228
|
+
currentTouchedElement.click();
|
|
229
|
+
currentTouchedElement.classList.add(selectedClassName);
|
|
230
|
+
}
|
|
231
|
+
if (startAnimationPromise) await startAnimationPromise;
|
|
232
|
+
const tapElapsed = tabPressAnimation && !tabDragging && selectedElementBeforeGesture !== currentTouchedElement ? performance.now() - tabPressStartedAt : void 0;
|
|
233
|
+
if (tabPressAnimation && !tabDragging && tapElapsed === void 0) {
|
|
234
|
+
const pressing = tabPressAnimation;
|
|
235
|
+
const remaining = 200 - (performance.now() - tabPressStartedAt);
|
|
236
|
+
if (remaining > 0) await new Promise((resolve) => setTimeout(resolve, remaining));
|
|
237
|
+
if (tabPressAnimation !== pressing) return;
|
|
238
|
+
}
|
|
239
|
+
if (currentTouchedElement === void 0 || !moveAnimation || releaseAnimation) return false;
|
|
240
|
+
if (effectTagName !== "ion-tab-button") setTimeout(() => {
|
|
241
|
+
if (!currentTouchedElement) return;
|
|
242
|
+
const targetX = currentTouchedElement.getBoundingClientRect().left + currentTouchedElement.clientWidth / 2;
|
|
243
|
+
const step = getStep(targetX, animationPosition);
|
|
244
|
+
moveAnimation.progressStep(step);
|
|
245
|
+
});
|
|
246
|
+
if (effectTagName === "ion-tab-button") {
|
|
247
|
+
stopTabPress();
|
|
248
|
+
moveAnimation.destroy();
|
|
249
|
+
moveAnimation = void 0;
|
|
250
|
+
const tabs = Array.from(targetElement.querySelectorAll(effectTagName)).filter((tab) => tab.offsetWidth > 0);
|
|
251
|
+
if (vertical) {
|
|
252
|
+
currentTouchedElement.classList.remove("ion-activated");
|
|
253
|
+
targetElement.classList.remove(ANIMATED_NAME);
|
|
254
|
+
}
|
|
255
|
+
const releasing = createTabBarReleaseAnimation(effectElement, currentTouchedElement, tapElapsed !== void 0 && tapElapsed < 200 ? {
|
|
256
|
+
elapsed: tapElapsed,
|
|
257
|
+
distance: Math.abs(tabs.indexOf(currentTouchedElement) - tabs.indexOf(selectedElementBeforeGesture))
|
|
258
|
+
} : void 0, vertical);
|
|
259
|
+
currentTouchedElement.classList.remove("ion-activated");
|
|
260
|
+
releaseAnimation = releasing;
|
|
261
|
+
await releasing.play();
|
|
262
|
+
if (releaseAnimation !== releasing) return;
|
|
263
|
+
clearActivated(true);
|
|
264
|
+
releasing.destroy();
|
|
265
|
+
releaseAnimation = void 0;
|
|
266
|
+
} else await getScaleAnimation(effectElement).duration(120).to("transform", `scale(1, 0.92)`).play();
|
|
267
|
+
moveAnimation?.destroy();
|
|
268
|
+
clearActivated(true);
|
|
269
|
+
return true;
|
|
270
|
+
};
|
|
271
|
+
const nativeChanged = () => {
|
|
272
|
+
gesture.enable(!isNativeUIShell(targetElement));
|
|
273
|
+
cancelActiveGesture();
|
|
274
|
+
};
|
|
275
|
+
targetElement.addEventListener("nativeUIShellChange", nativeChanged);
|
|
276
|
+
if (isNativeUIShell(targetElement)) nativeChanged();
|
|
277
|
+
return { destroy: () => {
|
|
278
|
+
destroyed = true;
|
|
279
|
+
cancelActiveGesture();
|
|
280
|
+
targetElement.removeEventListener("pointerdown", onPointerDown);
|
|
281
|
+
targetElement.removeEventListener("click", onClick, true);
|
|
282
|
+
targetElement.removeEventListener("nativeUIShellChange", nativeChanged);
|
|
283
|
+
if (gesture) gesture.destroy();
|
|
284
|
+
targetElement.classList.remove(GESTURE_NAME);
|
|
285
|
+
effectElement.remove();
|
|
286
|
+
if (effectTagName === "ion-tab-button") {
|
|
287
|
+
if (originalTabBarScale) targetElement.style.setProperty("--ios27-tab-bar-scale", originalTabBarScale);
|
|
288
|
+
else targetElement.style.removeProperty("--ios27-tab-bar-scale");
|
|
289
|
+
}
|
|
290
|
+
} };
|
|
358
291
|
};
|
|
292
|
+
//#endregion
|
|
293
|
+
export { registerEffect };
|
|
294
|
+
|
|
295
|
+
//# sourceMappingURL=index.js.map
|