@xenknight/framework7 0.0.5 → 0.0.7

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 (105) hide show
  1. package/components/app/app.less +1 -1
  2. package/components/block/block-vars.less +6 -6
  3. package/components/button/button-vars.less +11 -10
  4. package/components/dialog/dialog-class.js +6 -3
  5. package/components/dialog/dialog-ios.less +10 -34
  6. package/components/dialog/dialog-md.less +2 -22
  7. package/components/dialog/dialog-rtl.css +1 -1
  8. package/components/dialog/dialog-vars.less +8 -10
  9. package/components/dialog/dialog.css +1 -1
  10. package/components/dialog/dialog.js +3 -3
  11. package/components/dialog/dialog.less +6 -25
  12. package/components/icon/icon-ios.less +9 -0
  13. package/components/icon/icon-md.less +9 -0
  14. package/components/icon/icon.less +2 -1
  15. package/components/list/list-vars.less +8 -6
  16. package/components/list/list.less +1 -1
  17. package/components/messagebar/messagebar-rtl.css +1 -1
  18. package/components/messagebar/messagebar-vars.less +1 -1
  19. package/components/messagebar/messagebar.css +1 -1
  20. package/components/messages/messages-rtl.css +1 -1
  21. package/components/messages/messages-vars.less +7 -7
  22. package/components/messages/messages.css +1 -1
  23. package/components/navbar-new/navbar-ios.less +135 -0
  24. package/components/navbar-new/navbar-md.less +105 -0
  25. package/components/navbar-new/navbar-vars.less +78 -0
  26. package/components/navbar-new/navbar.d.ts +77 -0
  27. package/components/navbar-new/navbar.js +568 -0
  28. package/components/navbar-new/navbar.less +268 -0
  29. package/components/notification/notification-class.js +6 -6
  30. package/components/notification/notification-ios.less +3 -8
  31. package/components/notification/notification-md.less +1 -20
  32. package/components/notification/notification-rtl.css +1 -1
  33. package/components/notification/notification-vars.less +13 -16
  34. package/components/notification/notification.css +1 -1
  35. package/components/notification/notification.less +13 -1
  36. package/components/popover/popover-class.js +21 -58
  37. package/components/popover/popover-ios.less +66 -2
  38. package/components/popover/popover-md.less +2 -27
  39. package/components/popover/popover-rtl.css +1 -1
  40. package/components/popover/popover-vars.less +2 -3
  41. package/components/popover/popover.css +1 -1
  42. package/components/popover/popover.d.ts +0 -2
  43. package/components/popover/popover.js +0 -1
  44. package/components/popover/popover.less +28 -50
  45. package/components/range/range-class.js +34 -27
  46. package/components/range/range-ios.less +60 -0
  47. package/components/range/range-md.less +67 -4
  48. package/components/range/range-rtl.css +1 -1
  49. package/components/range/range-vars.less +18 -13
  50. package/components/range/range.css +1 -1
  51. package/components/range/range.d.ts +3 -1
  52. package/components/range/range.less +11 -24
  53. package/components/searchbar-new/remove-diacritics.js +271 -0
  54. package/components/searchbar-new/searchbar-ios.less +131 -0
  55. package/components/searchbar-new/searchbar-md.less +153 -0
  56. package/components/searchbar-new/searchbar-new-class.js +592 -0
  57. package/components/searchbar-new/searchbar-vars.less +75 -0
  58. package/components/searchbar-new/searchbar.js +122 -0
  59. package/components/searchbar-new/searchbar.less +331 -0
  60. package/components/swipeout/swipeout-ios.less +37 -0
  61. package/components/swipeout/swipeout-md.less +56 -0
  62. package/components/swipeout/swipeout-rtl.css +1 -1
  63. package/components/swipeout/swipeout-vars.less +13 -2
  64. package/components/swipeout/swipeout.css +1 -1
  65. package/components/swipeout/swipeout.js +98 -23
  66. package/components/swipeout/swipeout.less +20 -44
  67. package/components/tabs/tabs.js +5 -0
  68. package/components/toast/toast-class.js +2 -2
  69. package/components/toast/toast-ios.less +2 -0
  70. package/components/toast/toast-rtl.css +1 -1
  71. package/components/toast/toast-vars.less +2 -4
  72. package/components/toast/toast.css +1 -1
  73. package/components/toast/toast.less +1 -1
  74. package/components/toolbar-new/tabbar-highlight.js +134 -0
  75. package/components/toolbar-new/toolbar-ios.less +193 -0
  76. package/components/toolbar-new/toolbar-md.less +152 -0
  77. package/components/toolbar-new/toolbar-vars.less +77 -0
  78. package/components/toolbar-new/toolbar.js +223 -0
  79. package/components/toolbar-new/toolbar.less +261 -0
  80. package/framework7-bundle-rtl.css +2606 -746
  81. package/framework7-bundle-rtl.min.css +12 -6
  82. package/framework7-bundle.css +2603 -743
  83. package/framework7-bundle.esm.js +11 -4
  84. package/framework7-bundle.js +4536 -1038
  85. package/framework7-bundle.js.map +1 -1
  86. package/framework7-bundle.less +6 -3
  87. package/framework7-bundle.min.css +12 -6
  88. package/framework7-bundle.min.js +4 -4
  89. package/framework7-bundle.min.js.map +1 -1
  90. package/framework7-lite-bundle.esm.js +11 -4
  91. package/framework7-lite.esm.js +11 -4
  92. package/framework7-lite.js +8 -1
  93. package/framework7-rtl.css +2212 -399
  94. package/framework7-rtl.min.css +11 -5
  95. package/framework7.css +2211 -398
  96. package/framework7.esm.js +11 -4
  97. package/framework7.js +8 -1
  98. package/framework7.less +6 -3
  99. package/framework7.min.css +11 -5
  100. package/package.json +1 -1
  101. package/shared/get-support.d.ts +0 -6
  102. package/shared/get-support.js +1 -20
  103. package/shared/material-color-utils.js +2153 -679
  104. package/shared/material-colors.js +97 -17
  105. package/shared/utils.js +18 -6
@@ -1,7 +1,6 @@
1
1
  import { getDocument } from 'ssr-window';
2
2
  import $ from '../../shared/dom7.js';
3
3
  import { nextFrame, bindMethods } from '../../shared/utils.js';
4
- import { getSupport } from '../../shared/get-support.js';
5
4
  const Swipeout = {
6
5
  init() {
7
6
  const app = this;
@@ -46,12 +45,16 @@ const Swipeout = {
46
45
  isScrolling = !!(isScrolling || Math.abs(pageY - touchesStart.y) > Math.abs(pageX - touchesStart.x));
47
46
  }
48
47
  if (isScrolling) {
48
+ $swipeoutEl.removeClass('swipeout-active');
49
49
  isTouched = false;
50
50
  return;
51
51
  }
52
52
  if (!isMoved) {
53
53
  if ($('.list.sortable-opened').length > 0) return;
54
54
  $swipeoutContent = $swipeoutEl.find('.swipeout-content');
55
+ if (!app.params.swipeout.noFollow) {
56
+ $swipeoutEl.addClass('swipeout-active');
57
+ }
55
58
  $actionsRight = $swipeoutEl.find('.swipeout-actions-right');
56
59
  $actionsLeft = $swipeoutEl.find('.swipeout-actions-left');
57
60
  actionsLeftWidth = null;
@@ -91,6 +94,7 @@ const Swipeout = {
91
94
  }
92
95
  if (translate > 0 && $actionsLeft.length === 0 || translate < 0 && $actionsRight.length === 0) {
93
96
  if (!opened) {
97
+ $swipeoutEl.removeClass('swipeout-active');
94
98
  isTouched = false;
95
99
  isMoved = false;
96
100
  $swipeoutContent.transform('');
@@ -151,11 +155,24 @@ const Swipeout = {
151
155
  if (typeof buttonEl.f7SwipeoutButtonOffset === 'undefined') {
152
156
  $buttonEl[0].f7SwipeoutButtonOffset = buttonEl.offsetLeft;
153
157
  }
158
+ if (typeof buttonEl.f7SwipeoutButtonWidth === 'undefined') {
159
+ $buttonEl[0].f7SwipeoutButtonWidth = buttonEl.offsetWidth;
160
+ }
154
161
  buttonOffset = buttonEl.f7SwipeoutButtonOffset;
162
+ const buttonWidth = $buttonEl[0].f7SwipeoutButtonWidth;
155
163
  if ($overswipeRightButton.length > 0 && $buttonEl.hasClass('swipeout-overswipe') && direction === 'to-left') {
156
- $buttonEl.css({
157
- left: `${overswipeRight ? -buttonOffset : 0}px`
158
- });
164
+ if (app.theme === 'ios') {
165
+ const newWidth = overswipeRight ? buttonWidth + buttonOffset - 8 : buttonWidth;
166
+ const diff = newWidth - buttonWidth;
167
+ $buttonEl.css({
168
+ width: `${newWidth}px`,
169
+ marginLeft: overswipeRight ? `${-diff}px` : '0px'
170
+ });
171
+ } else {
172
+ $buttonEl.css({
173
+ left: `${overswipeRight ? -buttonOffset : 0}px`
174
+ });
175
+ }
159
176
  if (overswipeRight) {
160
177
  if (!$buttonEl.hasClass('swipeout-overswipe-active')) {
161
178
  $swipeoutEl.trigger('swipeout:overswipeenter');
@@ -170,7 +187,15 @@ const Swipeout = {
170
187
  $buttonEl.removeClass('swipeout-overswipe-active');
171
188
  }
172
189
  }
173
- $buttonEl.transform(`translate3d(${buttonTranslate - buttonOffset * (1 + Math.max(progress, -1))}px,0,0)`);
190
+ if (app.theme === 'ios') {
191
+ const buttonEndPos = actionsRightWidth - buttonOffset;
192
+ const buttonStartPos = actionsRightWidth - buttonOffset - buttonWidth;
193
+ let buttonProgress = (-buttonTranslate - buttonStartPos) / (buttonEndPos - buttonStartPos);
194
+ buttonProgress = Math.max(Math.min(buttonProgress, 1), 0);
195
+ $buttonEl.transform(`scale(${buttonProgress})`);
196
+ } else {
197
+ $buttonEl.transform(`translate3d(${buttonTranslate - buttonOffset * (1 + Math.max(progress, -1))}px,0,0)`);
198
+ }
174
199
  });
175
200
  }
176
201
  if ($actionsLeft.length > 0) {
@@ -191,14 +216,27 @@ const Swipeout = {
191
216
  }
192
217
  $leftButtons.each((buttonEl, index) => {
193
218
  const $buttonEl = $(buttonEl);
219
+ if (typeof buttonEl.f7SwipeoutButtonWidth === 'undefined') {
220
+ $buttonEl[0].f7SwipeoutButtonWidth = buttonEl.offsetWidth;
221
+ }
194
222
  if (typeof buttonEl.f7SwipeoutButtonOffset === 'undefined') {
195
- $buttonEl[0].f7SwipeoutButtonOffset = actionsLeftWidth - buttonEl.offsetLeft - buttonEl.offsetWidth;
223
+ $buttonEl[0].f7SwipeoutButtonOffset = app.theme === 'ios' ? buttonEl.offsetLeft : actionsLeftWidth - buttonEl.offsetLeft - buttonEl.offsetWidth;
196
224
  }
225
+ const buttonWidth = $buttonEl[0].f7SwipeoutButtonWidth;
197
226
  buttonOffset = buttonEl.f7SwipeoutButtonOffset;
198
227
  if ($overswipeLeftButton.length > 0 && $buttonEl.hasClass('swipeout-overswipe') && direction === 'to-right') {
199
- $buttonEl.css({
200
- left: `${overswipeLeft ? buttonOffset : 0}px`
201
- });
228
+ if (app.theme === 'ios') {
229
+ const newWidth = overswipeLeft ? actionsLeftWidth - 16 : buttonWidth;
230
+ const diff = newWidth - buttonWidth;
231
+ $buttonEl.css({
232
+ width: `${newWidth}px`,
233
+ marginRight: overswipeLeft ? `${-diff}px` : '0px'
234
+ });
235
+ } else {
236
+ $buttonEl.css({
237
+ left: `${overswipeLeft ? buttonOffset : 0}px`
238
+ });
239
+ }
202
240
  if (overswipeLeft) {
203
241
  if (!$buttonEl.hasClass('swipeout-overswipe-active')) {
204
242
  $swipeoutEl.trigger('swipeout:overswipeenter');
@@ -216,7 +254,15 @@ const Swipeout = {
216
254
  if ($leftButtons.length > 1) {
217
255
  $buttonEl.css('z-index', $leftButtons.length - index);
218
256
  }
219
- $buttonEl.transform(`translate3d(${buttonTranslate + buttonOffset * (1 - Math.min(progress, 1))}px,0,0)`);
257
+ if (app.theme === 'ios') {
258
+ const buttonStartPos = buttonOffset;
259
+ const buttonEndPos = buttonStartPos + buttonWidth;
260
+ let buttonProgress = (buttonTranslate - buttonStartPos) / (buttonEndPos - buttonStartPos);
261
+ buttonProgress = Math.max(Math.min(buttonProgress, 1), 0);
262
+ $buttonEl.transform(`scale(${buttonProgress})`);
263
+ } else {
264
+ $buttonEl.transform(`translate3d(${buttonTranslate + buttonOffset * (1 - Math.min(progress, 1))}px,0,0)`);
265
+ }
220
266
  });
221
267
  }
222
268
  $swipeoutEl.trigger('swipeout', progress);
@@ -229,6 +275,7 @@ const Swipeout = {
229
275
  isMoved = false;
230
276
  return;
231
277
  }
278
+ $swipeoutEl.removeClass('swipeout-active');
232
279
  isTouched = false;
233
280
  isMoved = false;
234
281
  const timeDiff = new Date().getTime() - touchStartTime;
@@ -257,7 +304,11 @@ const Swipeout = {
257
304
  $buttons = direction === 'to-left' ? $rightButtons : $leftButtons;
258
305
  if ($buttons) {
259
306
  for (i = 0; i < $buttons.length; i += 1) {
260
- $($buttons[i]).transform(`translate3d(${newTranslate}px,0,0)`);
307
+ if (app.theme === 'ios') {
308
+ $($buttons[i]).transform(`scale(1)`);
309
+ } else {
310
+ $($buttons[i]).transform(`translate3d(${newTranslate}px,0,0)`);
311
+ }
261
312
  }
262
313
  }
263
314
  if (overswipeRight) {
@@ -282,7 +333,11 @@ const Swipeout = {
282
333
  if (typeof buttonOffset === 'undefined') {
283
334
  $buttonEl[0].f7SwipeoutButtonOffset = actionsLeftWidth - buttonEl.offsetLeft - buttonEl.offsetWidth;
284
335
  }
285
- $buttonEl.transform(`translate3d(${buttonOffset}px,0,0)`);
336
+ if (app.theme === 'ios') {
337
+ $buttonEl.transform(`scale(0)`);
338
+ } else {
339
+ $buttonEl.transform(`translate3d(${buttonOffset}px,0,0)`);
340
+ }
286
341
  });
287
342
  }
288
343
  if ($rightButtons && $rightButtons.length > 0 && $rightButtons !== $buttons) {
@@ -292,7 +347,11 @@ const Swipeout = {
292
347
  if (typeof buttonOffset === 'undefined') {
293
348
  $buttonEl[0].f7SwipeoutButtonOffset = buttonEl.offsetLeft;
294
349
  }
295
- $buttonEl.transform(`translate3d(${-buttonOffset}px,0,0)`);
350
+ if (app.theme === 'ios') {
351
+ $buttonEl.transform(`scale(0)`);
352
+ } else {
353
+ $buttonEl.transform(`translate3d(${-buttonOffset}px,0,0)`);
354
+ }
296
355
  });
297
356
  }
298
357
  $swipeoutContent.transitionEnd(() => {
@@ -310,9 +369,9 @@ const Swipeout = {
310
369
  }
311
370
  });
312
371
  }
313
- const passiveListener = getSupport().passiveListener ? {
372
+ const passiveListener = {
314
373
  passive: true
315
- } : false;
374
+ };
316
375
  app.on('touchstart', e => {
317
376
  if (Swipeout.el) {
318
377
  const $targetEl = $(e.target);
@@ -354,10 +413,14 @@ const Swipeout = {
354
413
  if ($buttons.length > 1) {
355
414
  $buttons.each((buttonEl, buttonIndex) => {
356
415
  const $buttonEl = $(buttonEl);
357
- if (side === 'right') {
358
- $buttonEl.transform(`translate3d(${-buttonEl.offsetLeft}px,0,0)`);
416
+ if (app.theme === 'ios') {
417
+ $buttonEl.transform(`scale(1)`);
359
418
  } else {
360
- $buttonEl.css('z-index', $buttons.length - buttonIndex).transform(`translate3d(${swipeoutActionsWidth - buttonEl.offsetWidth - buttonEl.offsetLeft}px,0,0)`);
419
+ if (side === 'right') {
420
+ $buttonEl.transform(`translate3d(${-buttonEl.offsetLeft}px,0,0)`);
421
+ } else {
422
+ $buttonEl.css('z-index', $buttons.length - buttonIndex).transform(`translate3d(${swipeoutActionsWidth - buttonEl.offsetWidth - buttonEl.offsetLeft}px,0,0)`);
423
+ }
361
424
  }
362
425
  });
363
426
  }
@@ -368,7 +431,11 @@ const Swipeout = {
368
431
  if (callback) callback.call($el[0]);
369
432
  });
370
433
  nextFrame(() => {
371
- $buttons.transform(`translate3d(${translate}px,0,0)`);
434
+ if (app.theme === 'ios') {
435
+ $buttons.transform(`scale(1)`);
436
+ } else {
437
+ $buttons.transform(`translate3d(${translate}px,0,0)`);
438
+ }
372
439
  $swipeoutContent.transform(`translate3d(${translate}px,0,0)`);
373
440
  });
374
441
  Swipeout.el = $el[0];
@@ -401,14 +468,22 @@ const Swipeout = {
401
468
  closeTimeout = setTimeout(onSwipeoutClose, 500);
402
469
  $buttons.each(buttonEl => {
403
470
  const $buttonEl = $(buttonEl);
404
- if (side === 'right') {
405
- $buttonEl.transform(`translate3d(${-buttonEl.offsetLeft}px,0,0)`);
471
+ if (app.theme === 'ios') {
472
+ $buttonEl.transform(`scale(0)`);
406
473
  } else {
407
- $buttonEl.transform(`translate3d(${swipeoutActionsWidth - buttonEl.offsetWidth - buttonEl.offsetLeft}px,0,0)`);
474
+ if (side === 'right') {
475
+ $buttonEl.transform(`translate3d(${-buttonEl.offsetLeft}px,0,0)`);
476
+ } else {
477
+ $buttonEl.transform(`translate3d(${swipeoutActionsWidth - buttonEl.offsetWidth - buttonEl.offsetLeft}px,0,0)`);
478
+ }
408
479
  }
480
+ const buttonWidth = $buttonEl[0].f7SwipeoutButtonWidth;
409
481
  $buttonEl.css({
410
- left: '0px'
482
+ left: '0px',
483
+ width: buttonWidth ? `${buttonWidth}px` : '',
484
+ marginLeft: '0px'
411
485
  }).removeClass('swipeout-overswipe-active');
486
+ delete $buttonEl[0].f7SwipeoutButtonWidth;
412
487
  });
413
488
  if (Swipeout.el && Swipeout.el === $el[0]) Swipeout.el = undefined;
414
489
  },
@@ -13,11 +13,26 @@
13
13
  }
14
14
  .swipeout-transitioning {
15
15
  .swipeout-content,
16
+ .swipeout-content .item-inner::after {
17
+ transition-duration: 300ms;
18
+ transition-property: transform, left, background-color, border-radius, opacity;
19
+ }
16
20
  .swipeout-actions-right a,
17
21
  .swipeout-actions-left a,
18
22
  .swipeout-overswipe {
19
23
  transition-duration: 300ms;
20
- transition-property: transform, left;
24
+ transition-property: transform, left, width, margin-left, margin-right;
25
+ }
26
+ &:not(.swipeout-opened) {
27
+ .swipeout-content {
28
+ transition-delay: 0ms, 0ms, 300ms, 300ms, 0ms;
29
+ }
30
+ }
31
+ }
32
+ .list li:has(+ li:is(.swipeout-opened, .swipeout-active)) {
33
+ .item-inner::after {
34
+ opacity: 0;
35
+ transition-duration: 300ms;
21
36
  }
22
37
  }
23
38
  .swipeout-content {
@@ -26,7 +41,6 @@
26
41
  }
27
42
  .swipeout-overswipe {
28
43
  transition-duration: 200ms;
29
- transition-property: left;
30
44
  }
31
45
  .swipeout-actions-left,
32
46
  .swipeout-actions-right {
@@ -39,6 +53,9 @@
39
53
  > button,
40
54
  > span,
41
55
  > div {
56
+ box-sizing: border-box;
57
+ border-radius: var(--f7-swipeout-button-border-radius);
58
+
42
59
  color: var(--f7-swipeout-button-text-color);
43
60
  background: var(--f7-swipeout-button-bg-color);
44
61
  padding: var(--f7-swipeout-button-padding-vertical) var(--f7-swipeout-button-padding-horizontal);
@@ -48,53 +65,12 @@
48
65
  left: 0;
49
66
  font-size: var(--f7-swipeout-button-font-size);
50
67
  font-weight: var(--f7-swipeout-button-font-weight);
51
- &:after {
52
- content: '';
53
- pointer-events: none;
54
- position: absolute;
55
- top: 0;
56
- width: 600%;
57
- height: 100%;
58
- background: inherit;
59
- z-index: -1;
60
- transform: translate3d(0, 0, 0);
61
- pointer-events: none;
62
- }
63
68
  }
64
69
  .swipeout-delete {
65
70
  background: var(--f7-swipeout-delete-button-bg-color);
66
71
  }
67
72
  }
68
- .swipeout-actions-right {
69
- right: 0%;
70
- transform: translateX(calc(100% + 1px));
71
- > a,
72
- > button,
73
- > span,
74
- > div {
75
- &:after {
76
- left: 100%;
77
- }
78
- &:last-child {
79
- padding-right: calc(var(--f7-swipeout-button-padding-horizontal) + var(--f7-safe-area-right));
80
- }
81
- }
82
- }
83
- .swipeout-actions-left {
84
- left: 0%;
85
- transform: translateX(calc(-100% - 1px));
86
- > a,
87
- > button,
88
- > span,
89
- > div {
90
- &:after {
91
- right: 100%;
92
- }
93
- &:first-child {
94
- padding-left: calc(var(--f7-swipeout-button-padding-horizontal) + var(--f7-safe-area-left));
95
- }
96
- }
97
- }
73
+
98
74
  .swipeout-actions-left,
99
75
  .swipeout-actions-right {
100
76
  [class*='color-'] {
@@ -190,6 +190,11 @@ const Tab = {
190
190
  if (hasHighlight) {
191
191
  app.toolbar.setHighlight($tabbarEl);
192
192
  }
193
+ // Toolbar New Highlight
194
+ const $tabbarNewEl = $tabLinkEl.parents('.tabbar-new, .tabbar-new-icons');
195
+ if (app.toolbarNew && $tabbarNewEl.length > 0) {
196
+ app.toolbarNew.setHighlight($tabbarNewEl);
197
+ }
193
198
  }
194
199
  }
195
200
  return {
@@ -97,8 +97,8 @@ class Toast extends Modal {
97
97
  class: "toast-icon"
98
98
  }, icon), $jsx("div", {
99
99
  class: "toast-text"
100
- }, text), closeButton && !icon && $jsx("a", {
101
- class: `toast-button button ${closeButtonColor ? `color-${closeButtonColor}` : ''}`
100
+ }, text), closeButton && !icon && $jsx("button", {
101
+ class: `toast-button button ${closeButtonColor ? `color-${closeButtonColor}` : ''}${toast.app.theme === 'ios' ? ' button-round' : ''}`
102
102
  }, closeButtonText)));
103
103
  }
104
104
  }
@@ -3,6 +3,8 @@
3
3
  transition-duration: 300ms;
4
4
  width: 100%;
5
5
  left: 0;
6
+ .ios-glass-backdrop();
7
+ box-shadow: var(--f7-glass-shadow);
6
8
  &.toast-top {
7
9
  top: 0;
8
10
  transform: translate3d(0, -100%, 0);
@@ -1 +1 @@
1
- :root{--f7-toast-font-size:14px;--f7-toast-icon-size:48px;--f7-toast-max-width:568px}.ios{--f7-toast-text-color:#fff;--f7-toast-bg-color:rgba(0, 0, 0, 0.75);--f7-toast-bg-color-rgb:0,0,0;--f7-toast-padding-horizontal:16px;--f7-toast-padding-vertical:12px;--f7-toast-border-radius:8px;--f7-toast-button-min-width:64px}.md{--f7-toast-padding-horizontal:24px;--f7-toast-padding-vertical:14px;--f7-toast-border-radius:16px;--f7-toast-button-min-width:64px}.md,.md .dark,.md [class*=color-]{--f7-toast-text-color:var(--f7-md-on-surface);--f7-toast-bg-color:var(--f7-md-surface-5)}.toast{transition-property:transform,opacity;position:absolute;max-width:var(--f7-toast-max-width);z-index:20000;color:var(--f7-toast-text-color);font-size:var(--f7-toast-font-size);box-sizing:border-box;background-color:var(--f7-toast-bg-color);opacity:0}@supports ((-webkit-backdrop-filter:blur(20px)) or (backdrop-filter:blur(20px))){.ios-translucent-modals .toast{background-color:rgba(var(--f7-toast-bg-color-rgb),.8);-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}}.toast.modal-in{opacity:1}.toast .toast-content{display:flex;justify-content:space-between;align-items:center;box-sizing:border-box;padding:var(--f7-toast-padding-vertical) var(--f7-toast-padding-horizontal)}.toast .toast-text{line-height:20px;flex-shrink:1;min-width:0}.toast .toast-button{flex-shrink:0;min-width:var(--f7-toast-button-min-width);margin-top:-8px;margin-bottom:-8px}.toast.toast-with-icon .toast-content{display:block;text-align:center}.toast.toast-with-icon .toast-text{text-align:center}.toast.toast-with-icon .toast-icon .f7-icons,.toast.toast-with-icon .toast-icon .material-icons{font-size:var(--f7-toast-icon-size)}.toast.toast-center{top:50%}.toast.toast-top{margin-top:var(--f7-safe-area-top)}.ios .toast{transition-duration:.3s;width:100%;left:0}.ios .toast.toast-top{top:0;transform:translate3d(0,-100%,0)}.ios .toast.toast-top.modal-in{transform:translate3d(0,0%,0)}.ios .toast.toast-center{width:auto;left:50%;border-radius:var(--f7-toast-border-radius);transform:translate3d(-50%,-50%,0)}.ios .toast.toast-center.modal-in{transform:translate3d(-50%,-50%,0)}.ios .toast.toast-bottom{bottom:0;transform:translate3d(0,100%,0)}.ios .toast.toast-bottom.modal-in{transform:translate3d(0,0%,0)}@media (max-width:568px){.ios .toast.toast-top{margin-top:0}.ios .toast.toast-top .toast-content{padding-top:calc(var(--f7-toast-padding-vertical) + var(--f7-safe-area-top))}.ios .toast.toast-bottom .toast-content{padding-bottom:calc(var(--f7-toast-padding-vertical) + var(--f7-safe-area-bottom))}}@media (min-width:569px){.ios .toast{left:50%;margin-left:calc(-1 * var(--f7-toast-max-width)/ 2);border-radius:var(--f7-toast-border-radius)}.ios .toast.toast-top{top:16px}.ios .toast.toast-center{margin-left:0}.ios .toast.toast-bottom{margin-bottom:calc(16px + var(--f7-safe-area-bottom))}}@media (min-width:1024px){.ios .toast{margin-left:0;width:auto}.ios .toast.toast-horizontal-left{left:16px}.ios .toast.toast-horizontal-right{left:auto;right:16px}.ios .toast.toast-horizontal-center{left:50%;width:var(--f7-toast-max-width);margin-left:calc(-1 * var(--f7-toast-max-width)/ 2)}}.ios .toast-button{margin-right:16px;margin-left:calc(-1 * var(--f7-button-padding-horizontal))}.md .toast{transition-duration:.2s;border-radius:var(--f7-toast-border-radius);width:calc(100% - 16px);transform:scale(.9);left:8px}.md .toast.modal-in{transform:scale(1)}.md .toast.modal-out{transform:scale(1)}.md .toast.toast-top{top:8px}.md .toast.toast-center{left:50%;width:auto;transform:scale(.9) translate3d(-55%,-55%,0)}.md .toast.toast-center.modal-in{transform:scale(1) translate3d(-50%,-50%,0)}.md .toast.toast-center.modal-out{transform:scale(1) translate3d(-50%,-50%,0)}.md .toast.toast-bottom{bottom:calc(8px + var(--f7-safe-area-bottom))}@media (min-width:584px){.md .toast{left:50%;margin-left:calc(-1 * var(--f7-toast-max-width)/ 2)}.md .toast.toast-center{margin-left:0}}@media (min-width:1024px){.md .toast{margin-left:0;width:auto}.md .toast.toast-horizontal-left{left:24px}.md .toast.toast-horizontal-right{left:auto;right:24px}.md .toast.toast-horizontal-center{left:50%;width:var(--f7-toast-max-width);margin-left:calc(-1 * var(--f7-toast-max-width)/ 2)}.md .toast.toast-bottom{bottom:calc(24px + var(--f7-safe-area-bottom))}.md .toast.toast-top{top:24px}}.md .toast-button{margin-right:16px;margin-left:-8px}
1
+ :root{--f7-toast-font-size:14px;--f7-toast-icon-size:48px;--f7-toast-max-width:568px}.ios{--f7-toast-bg-color:var(--f7-glass-bg-color);--f7-toast-padding-horizontal:16px;--f7-toast-padding-vertical:12px;--f7-toast-border-radius:32px;--f7-toast-button-min-width:64px}.md{--f7-toast-padding-horizontal:24px;--f7-toast-padding-vertical:14px;--f7-toast-border-radius:16px;--f7-toast-button-min-width:64px}.md,.md .dark,.md [class*=color-]{--f7-toast-text-color:var(--f7-md-on-surface);--f7-toast-bg-color:var(--f7-md-surface-5)}.toast{transition-property:transform,opacity;position:absolute;max-width:var(--f7-toast-max-width);z-index:20000;color:var(--f7-toast-text-color);font-size:var(--f7-toast-font-size);box-sizing:border-box;background-color:var(--f7-toast-bg-color);opacity:0}.toast.modal-in{opacity:1}.toast .toast-content{display:flex;justify-content:space-between;align-items:center;box-sizing:border-box;padding:var(--f7-toast-padding-vertical) var(--f7-toast-padding-horizontal)}.toast .toast-text{line-height:20px;flex-shrink:1;min-width:0}.toast .toast-button{flex-shrink:0;min-width:var(--f7-toast-button-min-width);margin-top:-8px;margin-bottom:-8px;width:auto}.toast.toast-with-icon .toast-content{display:block;text-align:center}.toast.toast-with-icon .toast-text{text-align:center}.toast.toast-with-icon .toast-icon .f7-icons,.toast.toast-with-icon .toast-icon .material-icons{font-size:var(--f7-toast-icon-size)}.toast.toast-center{top:50%}.toast.toast-top{margin-top:var(--f7-safe-area-top)}.ios .toast{transition-duration:.3s;width:100%;left:0;-webkit-backdrop-filter:saturate(180%) blur(16px);backdrop-filter:saturate(180%) blur(16px);box-shadow:var(--f7-glass-shadow)}.ios .toast.toast-top{top:0;transform:translate3d(0,-100%,0)}.ios .toast.toast-top.modal-in{transform:translate3d(0,0%,0)}.ios .toast.toast-center{width:auto;left:50%;border-radius:var(--f7-toast-border-radius);transform:translate3d(-50%,-50%,0)}.ios .toast.toast-center.modal-in{transform:translate3d(-50%,-50%,0)}.ios .toast.toast-bottom{bottom:0;transform:translate3d(0,100%,0)}.ios .toast.toast-bottom.modal-in{transform:translate3d(0,0%,0)}@media (max-width:568px){.ios .toast.toast-top{margin-top:0}.ios .toast.toast-top .toast-content{padding-top:calc(var(--f7-toast-padding-vertical) + var(--f7-safe-area-top))}.ios .toast.toast-bottom .toast-content{padding-bottom:calc(var(--f7-toast-padding-vertical) + var(--f7-safe-area-bottom))}}@media (min-width:569px){.ios .toast{left:50%;margin-left:calc(-1 * var(--f7-toast-max-width)/ 2);border-radius:var(--f7-toast-border-radius)}.ios .toast.toast-top{top:16px}.ios .toast.toast-center{margin-left:0}.ios .toast.toast-bottom{margin-bottom:calc(16px + var(--f7-safe-area-bottom))}}@media (min-width:1024px){.ios .toast{margin-left:0;width:auto}.ios .toast.toast-horizontal-left{left:16px}.ios .toast.toast-horizontal-right{left:auto;right:16px}.ios .toast.toast-horizontal-center{left:50%;width:var(--f7-toast-max-width);margin-left:calc(-1 * var(--f7-toast-max-width)/ 2)}}.ios .toast-button{margin-right:16px;margin-left:calc(-1 * var(--f7-button-padding-horizontal))}.md .toast{transition-duration:.2s;border-radius:var(--f7-toast-border-radius);width:calc(100% - 16px);transform:scale(.9);left:8px}.md .toast.modal-in{transform:scale(1)}.md .toast.modal-out{transform:scale(1)}.md .toast.toast-top{top:8px}.md .toast.toast-center{left:50%;width:auto;transform:scale(.9) translate3d(-55%,-55%,0)}.md .toast.toast-center.modal-in{transform:scale(1) translate3d(-50%,-50%,0)}.md .toast.toast-center.modal-out{transform:scale(1) translate3d(-50%,-50%,0)}.md .toast.toast-bottom{bottom:calc(8px + var(--f7-safe-area-bottom))}@media (min-width:584px){.md .toast{left:50%;margin-left:calc(-1 * var(--f7-toast-max-width)/ 2)}.md .toast.toast-center{margin-left:0}}@media (min-width:1024px){.md .toast{margin-left:0;width:auto}.md .toast.toast-horizontal-left{left:24px}.md .toast.toast-horizontal-right{left:auto;right:24px}.md .toast.toast-horizontal-center{left:50%;width:var(--f7-toast-max-width);margin-left:calc(-1 * var(--f7-toast-max-width)/ 2)}.md .toast.toast-bottom{bottom:calc(24px + var(--f7-safe-area-bottom))}.md .toast.toast-top{top:24px}}.md .toast-button{margin-right:16px;margin-left:-8px}
@@ -4,12 +4,10 @@
4
4
  --f7-toast-max-width: 568px;
5
5
  }
6
6
  .ios-vars({
7
- --f7-toast-text-color: #fff;
8
- --f7-toast-bg-color: rgba(0,0,0,0.75);
9
- --f7-toast-bg-color-rgb: 0, 0, 0;
7
+ --f7-toast-bg-color: var(--f7-glass-bg-color);
10
8
  --f7-toast-padding-horizontal: 16px;
11
9
  --f7-toast-padding-vertical: 12px;
12
- --f7-toast-border-radius: 8px;
10
+ --f7-toast-border-radius: 32px;
13
11
  --f7-toast-button-min-width: 64px;
14
12
  });
15
13
  .md-vars({
@@ -1 +1 @@
1
- :root{--f7-toast-font-size:14px;--f7-toast-icon-size:48px;--f7-toast-max-width:568px}.ios{--f7-toast-text-color:#fff;--f7-toast-bg-color:rgba(0, 0, 0, 0.75);--f7-toast-bg-color-rgb:0,0,0;--f7-toast-padding-horizontal:16px;--f7-toast-padding-vertical:12px;--f7-toast-border-radius:8px;--f7-toast-button-min-width:64px}.md{--f7-toast-padding-horizontal:24px;--f7-toast-padding-vertical:14px;--f7-toast-border-radius:16px;--f7-toast-button-min-width:64px}.md,.md .dark,.md [class*=color-]{--f7-toast-text-color:var(--f7-md-on-surface);--f7-toast-bg-color:var(--f7-md-surface-5)}.toast{transition-property:transform,opacity;position:absolute;max-width:var(--f7-toast-max-width);z-index:20000;color:var(--f7-toast-text-color);font-size:var(--f7-toast-font-size);box-sizing:border-box;background-color:var(--f7-toast-bg-color);opacity:0}@supports ((-webkit-backdrop-filter:blur(20px)) or (backdrop-filter:blur(20px))){.ios-translucent-modals .toast{background-color:rgba(var(--f7-toast-bg-color-rgb),.8);-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}}.toast.modal-in{opacity:1}.toast .toast-content{display:flex;justify-content:space-between;align-items:center;box-sizing:border-box;padding:var(--f7-toast-padding-vertical) var(--f7-toast-padding-horizontal)}.toast .toast-text{line-height:20px;flex-shrink:1;min-width:0}.toast .toast-button{flex-shrink:0;min-width:var(--f7-toast-button-min-width);margin-top:-8px;margin-bottom:-8px}.toast.toast-with-icon .toast-content{display:block;text-align:center}.toast.toast-with-icon .toast-text{text-align:center}.toast.toast-with-icon .toast-icon .f7-icons,.toast.toast-with-icon .toast-icon .material-icons{font-size:var(--f7-toast-icon-size)}.toast.toast-center{top:50%}.toast.toast-top{margin-top:var(--f7-safe-area-top)}.ios .toast{transition-duration:.3s;width:100%;left:0}.ios .toast.toast-top{top:0;transform:translate3d(0,-100%,0)}.ios .toast.toast-top.modal-in{transform:translate3d(0,0%,0)}.ios .toast.toast-center{width:auto;left:50%;border-radius:var(--f7-toast-border-radius);transform:translate3d(-50%,-50%,0)}.ios .toast.toast-center.modal-in{transform:translate3d(-50%,-50%,0)}.ios .toast.toast-bottom{bottom:0;transform:translate3d(0,100%,0)}.ios .toast.toast-bottom.modal-in{transform:translate3d(0,0%,0)}@media (max-width:568px){.ios .toast.toast-top{margin-top:0}.ios .toast.toast-top .toast-content{padding-top:calc(var(--f7-toast-padding-vertical) + var(--f7-safe-area-top))}.ios .toast.toast-bottom .toast-content{padding-bottom:calc(var(--f7-toast-padding-vertical) + var(--f7-safe-area-bottom))}}@media (min-width:569px){.ios .toast{left:50%;margin-left:calc(-1 * var(--f7-toast-max-width)/ 2);border-radius:var(--f7-toast-border-radius)}.ios .toast.toast-top{top:16px}.ios .toast.toast-center{margin-left:0}.ios .toast.toast-bottom{margin-bottom:calc(16px + var(--f7-safe-area-bottom))}}@media (min-width:1024px){.ios .toast{margin-left:0;width:auto}.ios .toast.toast-horizontal-left{left:16px}.ios .toast.toast-horizontal-right{left:auto;right:16px}.ios .toast.toast-horizontal-center{left:50%;width:var(--f7-toast-max-width);margin-left:calc(-1 * var(--f7-toast-max-width)/ 2)}}.ios .toast-button{margin-left:16px;margin-right:calc(-1 * var(--f7-button-padding-horizontal))}.md .toast{transition-duration:.2s;border-radius:var(--f7-toast-border-radius);width:calc(100% - 16px);transform:scale(.9);left:8px}.md .toast.modal-in{transform:scale(1)}.md .toast.modal-out{transform:scale(1)}.md .toast.toast-top{top:8px}.md .toast.toast-center{left:50%;width:auto;transform:scale(.9) translate3d(-55%,-55%,0)}.md .toast.toast-center.modal-in{transform:scale(1) translate3d(-50%,-50%,0)}.md .toast.toast-center.modal-out{transform:scale(1) translate3d(-50%,-50%,0)}.md .toast.toast-bottom{bottom:calc(8px + var(--f7-safe-area-bottom))}@media (min-width:584px){.md .toast{left:50%;margin-left:calc(-1 * var(--f7-toast-max-width)/ 2)}.md .toast.toast-center{margin-left:0}}@media (min-width:1024px){.md .toast{margin-left:0;width:auto}.md .toast.toast-horizontal-left{left:24px}.md .toast.toast-horizontal-right{left:auto;right:24px}.md .toast.toast-horizontal-center{left:50%;width:var(--f7-toast-max-width);margin-left:calc(-1 * var(--f7-toast-max-width)/ 2)}.md .toast.toast-bottom{bottom:calc(24px + var(--f7-safe-area-bottom))}.md .toast.toast-top{top:24px}}.md .toast-button{margin-left:16px;margin-right:-8px}
1
+ :root{--f7-toast-font-size:14px;--f7-toast-icon-size:48px;--f7-toast-max-width:568px}.ios{--f7-toast-bg-color:var(--f7-glass-bg-color);--f7-toast-padding-horizontal:16px;--f7-toast-padding-vertical:12px;--f7-toast-border-radius:32px;--f7-toast-button-min-width:64px}.md{--f7-toast-padding-horizontal:24px;--f7-toast-padding-vertical:14px;--f7-toast-border-radius:16px;--f7-toast-button-min-width:64px}.md,.md .dark,.md [class*=color-]{--f7-toast-text-color:var(--f7-md-on-surface);--f7-toast-bg-color:var(--f7-md-surface-5)}.toast{transition-property:transform,opacity;position:absolute;max-width:var(--f7-toast-max-width);z-index:20000;color:var(--f7-toast-text-color);font-size:var(--f7-toast-font-size);box-sizing:border-box;background-color:var(--f7-toast-bg-color);opacity:0}.toast.modal-in{opacity:1}.toast .toast-content{display:flex;justify-content:space-between;align-items:center;box-sizing:border-box;padding:var(--f7-toast-padding-vertical) var(--f7-toast-padding-horizontal)}.toast .toast-text{line-height:20px;flex-shrink:1;min-width:0}.toast .toast-button{flex-shrink:0;min-width:var(--f7-toast-button-min-width);margin-top:-8px;margin-bottom:-8px;width:auto}.toast.toast-with-icon .toast-content{display:block;text-align:center}.toast.toast-with-icon .toast-text{text-align:center}.toast.toast-with-icon .toast-icon .f7-icons,.toast.toast-with-icon .toast-icon .material-icons{font-size:var(--f7-toast-icon-size)}.toast.toast-center{top:50%}.toast.toast-top{margin-top:var(--f7-safe-area-top)}.ios .toast{transition-duration:.3s;width:100%;left:0;-webkit-backdrop-filter:saturate(180%) blur(16px);backdrop-filter:saturate(180%) blur(16px);box-shadow:var(--f7-glass-shadow)}.ios .toast.toast-top{top:0;transform:translate3d(0,-100%,0)}.ios .toast.toast-top.modal-in{transform:translate3d(0,0%,0)}.ios .toast.toast-center{width:auto;left:50%;border-radius:var(--f7-toast-border-radius);transform:translate3d(-50%,-50%,0)}.ios .toast.toast-center.modal-in{transform:translate3d(-50%,-50%,0)}.ios .toast.toast-bottom{bottom:0;transform:translate3d(0,100%,0)}.ios .toast.toast-bottom.modal-in{transform:translate3d(0,0%,0)}@media (max-width:568px){.ios .toast.toast-top{margin-top:0}.ios .toast.toast-top .toast-content{padding-top:calc(var(--f7-toast-padding-vertical) + var(--f7-safe-area-top))}.ios .toast.toast-bottom .toast-content{padding-bottom:calc(var(--f7-toast-padding-vertical) + var(--f7-safe-area-bottom))}}@media (min-width:569px){.ios .toast{left:50%;margin-left:calc(-1 * var(--f7-toast-max-width)/ 2);border-radius:var(--f7-toast-border-radius)}.ios .toast.toast-top{top:16px}.ios .toast.toast-center{margin-left:0}.ios .toast.toast-bottom{margin-bottom:calc(16px + var(--f7-safe-area-bottom))}}@media (min-width:1024px){.ios .toast{margin-left:0;width:auto}.ios .toast.toast-horizontal-left{left:16px}.ios .toast.toast-horizontal-right{left:auto;right:16px}.ios .toast.toast-horizontal-center{left:50%;width:var(--f7-toast-max-width);margin-left:calc(-1 * var(--f7-toast-max-width)/ 2)}}.ios .toast-button{margin-left:16px;margin-right:calc(-1 * var(--f7-button-padding-horizontal))}.md .toast{transition-duration:.2s;border-radius:var(--f7-toast-border-radius);width:calc(100% - 16px);transform:scale(.9);left:8px}.md .toast.modal-in{transform:scale(1)}.md .toast.modal-out{transform:scale(1)}.md .toast.toast-top{top:8px}.md .toast.toast-center{left:50%;width:auto;transform:scale(.9) translate3d(-55%,-55%,0)}.md .toast.toast-center.modal-in{transform:scale(1) translate3d(-50%,-50%,0)}.md .toast.toast-center.modal-out{transform:scale(1) translate3d(-50%,-50%,0)}.md .toast.toast-bottom{bottom:calc(8px + var(--f7-safe-area-bottom))}@media (min-width:584px){.md .toast{left:50%;margin-left:calc(-1 * var(--f7-toast-max-width)/ 2)}.md .toast.toast-center{margin-left:0}}@media (min-width:1024px){.md .toast{margin-left:0;width:auto}.md .toast.toast-horizontal-left{left:24px}.md .toast.toast-horizontal-right{left:auto;right:24px}.md .toast.toast-horizontal-center{left:50%;width:var(--f7-toast-max-width);margin-left:calc(-1 * var(--f7-toast-max-width)/ 2)}.md .toast.toast-bottom{bottom:calc(24px + var(--f7-safe-area-bottom))}.md .toast.toast-top{top:24px}}.md .toast-button{margin-left:16px;margin-right:-8px}
@@ -11,7 +11,6 @@
11
11
  box-sizing: border-box;
12
12
  background-color: var(--f7-toast-bg-color);
13
13
  opacity: 0;
14
- .ios-translucent-modals(var(--f7-toast-bg-color-rgb));
15
14
  &.modal-in {
16
15
  opacity: 1;
17
16
  }
@@ -32,6 +31,7 @@
32
31
  min-width: var(--f7-toast-button-min-width);
33
32
  margin-top: -8px;
34
33
  margin-bottom: -8px;
34
+ width: auto;
35
35
  }
36
36
  &.toast-with-icon {
37
37
  .toast-content {
@@ -0,0 +1,134 @@
1
+ import { getDocument } from 'ssr-window';
2
+ const startAnimation = data => {
3
+ data.raf = requestAnimationFrame(() => {
4
+ if (!data.setTransform) return;
5
+ const highlightEl = data.highlightEl;
6
+ if (!highlightEl) return;
7
+ highlightEl.style.transform = data.setTransform;
8
+ highlightEl.style.transitionTimingFunction = 'ease-out';
9
+ data.setTransform = null;
10
+ });
11
+ };
12
+ const stopAnimation = data => {
13
+ cancelAnimationFrame(data.raf);
14
+ };
15
+ const setHighlightOnTouch = (data, e) => {
16
+ const {
17
+ rect,
18
+ linkEls,
19
+ highlightEl
20
+ } = data;
21
+ if (!highlightEl) return;
22
+ const {
23
+ clientX
24
+ } = e;
25
+ const highlightWidth = rect.width / linkEls.length;
26
+ const leftOffset = clientX - rect.left - highlightWidth / 2;
27
+ const minLeft = 0;
28
+ const maxLeft = rect.width - highlightWidth;
29
+ const translateX = Math.max(minLeft, Math.min(leftOffset, maxLeft));
30
+ const linkCenters = [...linkEls].map((el, index) => {
31
+ return index * highlightWidth + highlightWidth / 2;
32
+ });
33
+ const closestLinkCenter = linkCenters.reduce((prev, curr) => {
34
+ const highlightCenter = translateX + highlightWidth / 2;
35
+ return Math.abs(curr - highlightCenter) < Math.abs(prev - highlightCenter) ? curr : prev;
36
+ }, linkCenters[0]);
37
+ const closestLinkIndex = linkCenters.indexOf(closestLinkCenter);
38
+ data.newActiveIndex = closestLinkIndex;
39
+ highlightEl.classList.add('tab-link-highlight-pressed');
40
+ data.setTransform = `translateX(${translateX}px)`;
41
+ startAnimation(data);
42
+ };
43
+ const unsetHighlightOnTouch = data => {
44
+ cancelAnimationFrame(data.raf);
45
+ data.setTransform = null;
46
+ const {
47
+ highlightEl
48
+ } = data;
49
+ if (!highlightEl) return;
50
+ highlightEl.classList.remove('tab-link-highlight-pressed');
51
+ const {
52
+ activeIndex,
53
+ newActiveIndex,
54
+ linkEls
55
+ } = data;
56
+ if (activeIndex !== newActiveIndex) {
57
+ linkEls[newActiveIndex].click();
58
+ }
59
+ highlightEl.style.transform = `translateX(${newActiveIndex * 100}%)`;
60
+ highlightEl.style.transitionTimingFunction = '';
61
+ highlightEl.style.transform = `translateX(${newActiveIndex * 100}%)`;
62
+ };
63
+ export const initTabbarNewHighlight = el => {
64
+ const document = getDocument();
65
+ if (!el) return;
66
+ if (el.classList.contains('tabbar-new-scrollable')) {
67
+ return;
68
+ }
69
+ const highlightEl = el.querySelector('.tab-link-highlight');
70
+ const toolbarPaneEl = el.querySelector('.toolbar-new-pane');
71
+ if (!highlightEl || !toolbarPaneEl) return;
72
+ const data = {
73
+ el,
74
+ highlightEl,
75
+ touched: false,
76
+ moved: false,
77
+ rect: null,
78
+ setTransform: null,
79
+ raf: null
80
+ };
81
+ el.f7ToolbarNewHighlightData = data;
82
+ el.f7ToolbarNewOnPointer = e => {
83
+ if (e.type === 'touchstart') {
84
+ e.preventDefault();
85
+ }
86
+ if (e.pointerType !== 'touch') return;
87
+ if (!el) return;
88
+ if (e.type === 'pointerdown') {
89
+ data.linkEls = el.querySelectorAll('.tab-link');
90
+ data.rect = toolbarPaneEl.getBoundingClientRect();
91
+ data.touched = true;
92
+ setHighlightOnTouch(data, e);
93
+ startAnimation(data);
94
+ }
95
+ if (e.type === 'pointermove') {
96
+ if (!data.touched) return;
97
+ data.moved = true;
98
+ setHighlightOnTouch(data, e);
99
+ }
100
+ if (e.type === 'pointerup') {
101
+ if (!data.touched) return;
102
+ data.touched = false;
103
+ data.moved = false;
104
+ unsetHighlightOnTouch(data);
105
+ stopAnimation(data);
106
+ }
107
+ };
108
+ el.addEventListener('touchstart', el.f7ToolbarNewOnPointer, {
109
+ passive: false
110
+ });
111
+ el.addEventListener('pointerdown', el.f7ToolbarNewOnPointer, {
112
+ passive: false
113
+ });
114
+ document.addEventListener('pointermove', el.f7ToolbarNewOnPointer, {
115
+ passive: false
116
+ });
117
+ document.addEventListener('pointerup', el.f7ToolbarNewOnPointer, {
118
+ passive: false
119
+ });
120
+ document.addEventListener('pointercancel', el.f7ToolbarNewOnPointer, {
121
+ passive: false
122
+ });
123
+ };
124
+ export const destroyTabbarNewHighlight = el => {
125
+ if (!el || !el.f7ToolbarNewOnPointer) return;
126
+ const document = getDocument();
127
+ el.removeEventListener('touchstart', el.f7ToolbarNewOnPointer);
128
+ el.removeEventListener('pointerdown', el.f7ToolbarNewOnPointer);
129
+ document.removeEventListener('pointermove', el.f7ToolbarNewOnPointer);
130
+ document.removeEventListener('pointerup', el.f7ToolbarNewOnPointer);
131
+ document.removeEventListener('pointercancel', el.f7ToolbarNewOnPointer);
132
+ el.f7ToolbarNewOnPointer = null;
133
+ el.f7ToolbarNewHighlightData = null;
134
+ };