@tarojs/components 4.3.1-alpha.4 → 4.3.1-alpha.5

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.
@@ -1,6 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
2
  import SwiperJS from 'swiper/bundle';
3
- import { d as debounce } from './index3.js';
4
3
 
5
4
  const indexCss = "@font-face{font-family:swiper-icons;src:url('data:application/font-woff;charset=utf-8;base64, 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');font-weight:400;font-style:normal}:root{--swiper-theme-color:#007aff}:host{position:relative;display:block;margin-left:auto;margin-right:auto;z-index:1}.swiper{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1;display:block}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:flex;transition-property:transform;transition-timing-function:var(--swiper-wrapper-transition-timing-function,initial);box-sizing:content-box}.swiper-android .swiper-slide,.swiper-ios .swiper-slide,.swiper-wrapper{transform:translate3d(0px,0,0)}.swiper-horizontal{touch-action:pan-y}.swiper-vertical{touch-action:pan-x}.swiper-slide{flex-shrink:0;width:100%;height:100%;position:relative;transition-property:transform;display:block}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform,height}.swiper-backface-hidden .swiper-slide{transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-3d{perspective:1200px}.swiper-3d .swiper-cube-shadow,.swiper-3d .swiper-slide{transform-style:preserve-3d}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-css-mode.swiper-horizontal>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-css-mode.swiper-vertical>.swiper-wrapper{scroll-snap-type:y mandatory}.swiper-css-mode.swiper-free-mode>.swiper-wrapper{scroll-snap-type:none}.swiper-css-mode.swiper-free-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:none}.swiper-css-mode.swiper-centered>.swiper-wrapper::before{content:'';flex-shrink:0;order:9999}.swiper-css-mode.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center;scroll-snap-stop:always}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper::before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper::before{width:100%;min-width:1px;height:var(--swiper-centered-offset-after)}.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-bottom,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-3d .swiper-slide-shadow{background:rgba(0,0,0,.15)}.swiper-3d .swiper-slide-shadow-left{background-image:linear-gradient(to left,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-3d .swiper-slide-shadow-right{background-image:linear-gradient(to right,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-3d .swiper-slide-shadow-top{background-image:linear-gradient(to top,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-3d .swiper-slide-shadow-bottom{background-image:linear-gradient(to bottom,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;transform-origin:50%;box-sizing:border-box;border:4px solid var(--swiper-preloader-color,var(--swiper-theme-color));border-radius:50%;border-top-color:transparent}.swiper-watch-progress .swiper-slide-visible .swiper-lazy-preloader,.swiper:not(.swiper-watch-progress) .swiper-lazy-preloader{animation:swiper-preloader-spin 1s infinite linear}.swiper-lazy-preloader-white{--swiper-preloader-color:#fff}.swiper-lazy-preloader-black{--swiper-preloader-color:#000}@keyframes swiper-preloader-spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.swiper-virtual .swiper-slide{-webkit-backface-visibility:hidden;transform:translateZ(0)}.swiper-virtual.swiper-css-mode .swiper-wrapper::after{content:'';position:absolute;left:0;top:0;pointer-events:none}.swiper-virtual.swiper-css-mode.swiper-horizontal .swiper-wrapper::after{height:1px;width:var(--swiper-virtual-size)}.swiper-virtual.swiper-css-mode.swiper-vertical .swiper-wrapper::after{width:1px;height:var(--swiper-virtual-size)}:root{--swiper-navigation-size:44px}.swiper-button-next,.swiper-button-prev{position:absolute;top:var(--swiper-navigation-top-offset,50%);width:calc(var(--swiper-navigation-size)/ 44 * 27);height:var(--swiper-navigation-size);margin-top:calc(0px - (var(--swiper-navigation-size)/ 2));z-index:10;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--swiper-navigation-color,var(--swiper-theme-color))}.swiper-button-next.swiper-button-disabled,.swiper-button-prev.swiper-button-disabled{opacity:.35;cursor:auto;pointer-events:none}.swiper-button-next.swiper-button-hidden,.swiper-button-prev.swiper-button-hidden{opacity:0;cursor:auto;pointer-events:none}.swiper-navigation-disabled .swiper-button-next,.swiper-navigation-disabled .swiper-button-prev{display:none!important}.swiper-button-next svg,.swiper-button-prev svg{width:100%;height:100%;object-fit:contain;transform-origin:center}.swiper-rtl .swiper-button-next svg,.swiper-rtl .swiper-button-prev svg{transform:rotate(180deg)}.swiper-button-prev,.swiper-rtl .swiper-button-next{left:var(--swiper-navigation-sides-offset,10px);right:auto}.swiper-button-next,.swiper-rtl .swiper-button-prev{right:var(--swiper-navigation-sides-offset,10px);left:auto}.swiper-button-lock{display:none}.swiper-button-next:after,.swiper-button-prev:after{font-family:swiper-icons;font-size:var(--swiper-navigation-size);text-transform:none!important;letter-spacing:0;font-variant:initial;line-height:1}.swiper-button-prev:after,.swiper-rtl .swiper-button-next:after{content:'prev'}.swiper-button-next,.swiper-rtl .swiper-button-prev{right:var(--swiper-navigation-sides-offset,10px);left:auto}.swiper-button-next:after,.swiper-rtl .swiper-button-prev:after{content:'next'}.swiper-pagination{position:absolute;text-align:center;transition:.3s opacity;transform:translate3d(0,0,0);z-index:10}.swiper-pagination.swiper-pagination-hidden{opacity:0}.swiper-pagination-disabled>.swiper-pagination,.swiper-pagination.swiper-pagination-disabled{display:none!important}.swiper-horizontal>.swiper-pagination-bullets,.swiper-pagination-bullets.swiper-pagination-horizontal,.swiper-pagination-custom,.swiper-pagination-fraction{bottom:var(--swiper-pagination-bottom,8px);top:var(--swiper-pagination-top,auto);left:0;width:100%}.swiper-pagination-bullets-dynamic{overflow:hidden;font-size:0}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transform:scale(.33);position:relative}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active{transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main{transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev{transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev{transform:scale(.33)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next{transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next{transform:scale(.33)}.swiper-pagination-bullet{width:var(--swiper-pagination-bullet-width,var(--swiper-pagination-bullet-size,8px));height:var(--swiper-pagination-bullet-height,var(--swiper-pagination-bullet-size,8px));display:inline-block;border-radius:var(--swiper-pagination-bullet-border-radius,50%);background:var(--swiper-pagination-bullet-inactive-color,#000);opacity:var(--swiper-pagination-bullet-inactive-opacity, .2)}button.swiper-pagination-bullet{border:none;margin:0;padding:0;box-shadow:none;-webkit-appearance:none;appearance:none}.swiper-pagination-clickable .swiper-pagination-bullet{cursor:pointer}.swiper-pagination-bullet:only-child{display:none!important}.swiper-pagination-bullet-active{opacity:var(--swiper-pagination-bullet-opacity, 1);background:var(--swiper-pagination-color,var(--swiper-theme-color))}.swiper-pagination-vertical.swiper-pagination-bullets,.swiper-vertical>.swiper-pagination-bullets{right:var(--swiper-pagination-right,8px);left:var(--swiper-pagination-left,auto);top:50%;transform:translate3d(0px,-50%,0)}.swiper-pagination-vertical.swiper-pagination-bullets .swiper-pagination-bullet,.swiper-vertical>.swiper-pagination-bullets .swiper-pagination-bullet{margin:var(--swiper-pagination-bullet-vertical-gap,6px) 0;display:block}.swiper-pagination-vertical.swiper-pagination-bullets.swiper-pagination-bullets-dynamic,.swiper-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{top:50%;transform:translateY(-50%);width:8px}.swiper-pagination-vertical.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet,.swiper-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{display:inline-block;transition:.2s transform,.2s top}.swiper-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet,.swiper-pagination-horizontal.swiper-pagination-bullets .swiper-pagination-bullet{margin:0 var(--swiper-pagination-bullet-horizontal-gap,4px)}.swiper-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic,.swiper-pagination-horizontal.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{left:50%;transform:translateX(-50%);white-space:nowrap}.swiper-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet,.swiper-pagination-horizontal.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transition:.2s transform,.2s left}.swiper-horizontal.swiper-rtl>.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transition:.2s transform,.2s right}.swiper-pagination-fraction{color:var(--swiper-pagination-fraction-color,inherit)}.swiper-pagination-progressbar{background:var(--swiper-pagination-progressbar-bg-color,rgba(0,0,0,.25));position:absolute}.swiper-pagination-progressbar .swiper-pagination-progressbar-fill{background:var(--swiper-pagination-color,var(--swiper-theme-color));position:absolute;left:0;top:0;width:100%;height:100%;transform:scale(0);transform-origin:left top}.swiper-rtl .swiper-pagination-progressbar .swiper-pagination-progressbar-fill{transform-origin:right top}.swiper-horizontal>.swiper-pagination-progressbar,.swiper-pagination-progressbar.swiper-pagination-horizontal,.swiper-pagination-progressbar.swiper-pagination-vertical.swiper-pagination-progressbar-opposite,.swiper-vertical>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite{width:100%;height:var(--swiper-pagination-progressbar-size,4px);left:0;top:0}.swiper-horizontal>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite,.swiper-pagination-progressbar.swiper-pagination-horizontal.swiper-pagination-progressbar-opposite,.swiper-pagination-progressbar.swiper-pagination-vertical,.swiper-vertical>.swiper-pagination-progressbar{width:var(--swiper-pagination-progressbar-size,4px);height:100%;left:0;top:0}.swiper-pagination-lock{display:none}.swiper-scrollbar{border-radius:var(--swiper-scrollbar-border-radius,10px);position:relative;touch-action:none;background:var(--swiper-scrollbar-bg-color,rgba(0,0,0,.1))}.swiper-scrollbar-disabled>.swiper-scrollbar,.swiper-scrollbar.swiper-scrollbar-disabled{display:none!important}.swiper-horizontal>.swiper-scrollbar,.swiper-scrollbar.swiper-scrollbar-horizontal{position:absolute;left:var(--swiper-scrollbar-sides-offset,1%);bottom:var(--swiper-scrollbar-bottom,4px);top:var(--swiper-scrollbar-top,auto);z-index:50;height:var(--swiper-scrollbar-size,4px);width:calc(100% - 2 * var(--swiper-scrollbar-sides-offset,1%))}.swiper-scrollbar.swiper-scrollbar-vertical,.swiper-vertical>.swiper-scrollbar{position:absolute;left:var(--swiper-scrollbar-left,auto);right:var(--swiper-scrollbar-right,4px);top:var(--swiper-scrollbar-sides-offset,1%);z-index:50;width:var(--swiper-scrollbar-size,4px);height:calc(100% - 2 * var(--swiper-scrollbar-sides-offset,1%))}.swiper-scrollbar-drag{height:100%;width:100%;position:relative;background:var(--swiper-scrollbar-drag-bg-color,rgba(0,0,0,.5));border-radius:var(--swiper-scrollbar-border-radius,10px);left:0;top:0}.swiper-scrollbar-cursor-drag{cursor:move}.swiper-scrollbar-lock{display:none}.swiper-zoom-container{width:100%;height:100%;display:flex;justify-content:center;align-items:center;text-align:center}.swiper-zoom-container>canvas,.swiper-zoom-container>img,.swiper-zoom-container>svg{max-width:100%;max-height:100%;object-fit:contain}.swiper-slide-zoomed{cursor:move;touch-action:none}.swiper .swiper-notification{position:absolute;left:0;top:0;pointer-events:none;opacity:0;z-index:-1000}.swiper-free-mode>.swiper-wrapper{transition-timing-function:ease-out;margin:0 auto}.swiper-grid>.swiper-wrapper{flex-wrap:wrap}.swiper-grid-column>.swiper-wrapper{flex-wrap:wrap;flex-direction:column}.swiper-fade.swiper-free-mode .swiper-slide{transition-timing-function:ease-out}.swiper-fade .swiper-slide{pointer-events:none;transition-property:opacity}.swiper-fade .swiper-slide .swiper-slide{pointer-events:none}.swiper-fade .swiper-slide-active{pointer-events:auto}.swiper-fade .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper.swiper-cube{overflow:visible}.swiper-cube .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1;visibility:hidden;transform-origin:0 0;width:100%;height:100%}.swiper-cube .swiper-slide .swiper-slide{pointer-events:none}.swiper-cube.swiper-rtl .swiper-slide{transform-origin:100% 0}.swiper-cube .swiper-slide-active,.swiper-cube .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-cube .swiper-slide-active,.swiper-cube .swiper-slide-next,.swiper-cube .swiper-slide-prev{pointer-events:auto;visibility:visible}.swiper-cube .swiper-cube-shadow{position:absolute;left:0;bottom:0px;width:100%;height:100%;opacity:.6;z-index:0}.swiper-cube .swiper-cube-shadow:before{content:'';background:#000;position:absolute;left:0;top:0;bottom:0;right:0;filter:blur(50px)}.swiper-cube .swiper-slide-next+.swiper-slide{pointer-events:auto;visibility:visible}.swiper-cube .swiper-slide-shadow-cube.swiper-slide-shadow-bottom,.swiper-cube .swiper-slide-shadow-cube.swiper-slide-shadow-left,.swiper-cube .swiper-slide-shadow-cube.swiper-slide-shadow-right,.swiper-cube .swiper-slide-shadow-cube.swiper-slide-shadow-top{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper.swiper-flip{overflow:visible}.swiper-flip .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1}.swiper-flip .swiper-slide .swiper-slide{pointer-events:none}.swiper-flip .swiper-slide-active,.swiper-flip .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-flip .swiper-slide-shadow-flip.swiper-slide-shadow-bottom,.swiper-flip .swiper-slide-shadow-flip.swiper-slide-shadow-left,.swiper-flip .swiper-slide-shadow-flip.swiper-slide-shadow-right,.swiper-flip .swiper-slide-shadow-flip.swiper-slide-shadow-top{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-creative .swiper-slide{-webkit-backface-visibility:hidden;backface-visibility:hidden;overflow:hidden;transition-property:transform,opacity,height}.swiper.swiper-cards{overflow:visible}.swiper-cards .swiper-slide{transform-origin:center bottom;-webkit-backface-visibility:hidden;backface-visibility:hidden;overflow:hidden}taro-swiper-core{height:150px;display:block}taro-swiper-core .swiper-container{height:100%;position:relative;overflow:visible}";
6
5
 
@@ -20,7 +19,7 @@ var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) ||
20
19
  throw new TypeError("Cannot write private member to an object whose class did not declare it");
21
20
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
22
21
  };
23
- var _Swiper_id, _Swiper_source, _Swiper_swiperResetting, _Swiper_domChangeByOutSide, _Swiper_lastSwiperActiveIndex;
22
+ var _Swiper_id, _Swiper_source, _Swiper_swiperResetting, _Swiper_lastSwiperActiveIndex, _Swiper_pendingCurrentItemId, _Swiper_didLoad, _Swiper_container, _Swiper_sizeTimer;
24
23
  let INSTANCE_ID = 0;
25
24
  const ONE_ADDITIONAL_SLIDES_THRESHOLD = 5;
26
25
  const TWO_ADDITIONAL_SLIDES_THRESHOLD = 7;
@@ -32,33 +31,41 @@ const Swiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
32
31
  this.onAnimationFinish = createEvent(this, "animationfinish", 7);
33
32
  _Swiper_id.set(this, INSTANCE_ID++);
34
33
  _Swiper_source.set(this, 'autoplay');
35
- _Swiper_swiperResetting.set(this, false
36
- // dom 变化是否由外部引起,因为 swiper 的循环模式也会引起 dom 的变化。如果不是由外部引起的 dom 变化,就不需要重新初始化 swiper
37
- );
38
- // dom 变化是否由外部引起,因为 swiper 的循环模式也会引起 dom 的变化。如果不是由外部引起的 dom 变化,就不需要重新初始化 swiper
39
- _Swiper_domChangeByOutSide.set(this, false);
34
+ _Swiper_swiperResetting.set(this, false);
40
35
  _Swiper_lastSwiperActiveIndex.set(this, 0);
41
- this.handleSwiperSizeDebounce = debounce(() => {
42
- if (!this.swiper || !this.isWillLoadCalled)
43
- return;
44
- if (this.circular) {
45
- if (__classPrivateFieldGet(this, _Swiper_domChangeByOutSide, "f")) {
46
- this.reset();
47
- __classPrivateFieldSet(this, _Swiper_domChangeByOutSide, false, "f");
36
+ _Swiper_pendingCurrentItemId.set(this, null);
37
+ _Swiper_didLoad.set(this, false);
38
+ _Swiper_container.set(this, null);
39
+ _Swiper_sizeTimer.set(this, void 0);
40
+ this.swiper = null;
41
+ this.observer = null;
42
+ this.handleSwiperSizeDebounce = () => {
43
+ clearTimeout(__classPrivateFieldGet(this, _Swiper_sizeTimer, "f"));
44
+ const swiper = this.swiper;
45
+ __classPrivateFieldSet(this, _Swiper_sizeTimer, setTimeout(() => {
46
+ if (this.swiper !== swiper || !swiper)
47
+ return;
48
+ if (this.circular) {
49
+ if (__classPrivateFieldGet(this, _Swiper_swiperResetting, "f"))
50
+ this.reset();
51
+ }
52
+ else {
53
+ swiper.update();
48
54
  __classPrivateFieldSet(this, _Swiper_swiperResetting, false, "f");
49
55
  }
56
+ }, 50), "f");
57
+ };
58
+ this.reset = (current) => {
59
+ this.destroySwiper();
60
+ if (current !== undefined)
61
+ __classPrivateFieldSet(this, _Swiper_lastSwiperActiveIndex, current, "f");
62
+ __classPrivateFieldSet(this, _Swiper_swiperResetting, true, "f");
63
+ try {
64
+ this.handleInit(true);
50
65
  }
51
- else {
52
- this.swiper.update();
66
+ finally {
53
67
  __classPrivateFieldSet(this, _Swiper_swiperResetting, false, "f");
54
68
  }
55
- }, 50);
56
- this.reset = () => {
57
- __classPrivateFieldSet(this, _Swiper_swiperResetting, true, "f");
58
- __classPrivateFieldSet(this, _Swiper_lastSwiperActiveIndex, this.swiper.realIndex, "f");
59
- this.swiper.destroy();
60
- this.handleInit(true);
61
- __classPrivateFieldSet(this, _Swiper_swiperResetting, false, "f");
62
69
  };
63
70
  // 下面为方法函数
64
71
  this.getSlidersList = () => this.el.querySelectorAll('taro-swiper-item-core:not(.swiper-slide-duplicate)') || [];
@@ -73,9 +80,6 @@ const Swiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
73
80
  const [, nextMargin] = /^(\d+)px/.exec(this.nextMargin) || [];
74
81
  return [parseInt(previousMargin) || 0, parseInt(nextMargin) || 0];
75
82
  };
76
- this.swiperWrapper = undefined;
77
- this.swiper = undefined;
78
- this.isWillLoadCalled = false;
79
83
  this.indicatorDots = false;
80
84
  this.indicatorColor = 'rgba(0, 0, 0, .3)';
81
85
  this.indicatorActiveColor = '#000000';
@@ -92,29 +96,46 @@ const Swiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
92
96
  this.full = false;
93
97
  this.zoom = false;
94
98
  this.effectsProps = {};
95
- this.observer = undefined;
99
+ }
100
+ // 属性入口统一恢复失效实例,事件回调只需排除旧实例
101
+ getSwiper(current) {
102
+ const swiper = this.swiper;
103
+ if (swiper && (swiper.destroyed || !swiper.wrapperEl || !swiper.slidesEl))
104
+ this.reset(current);
105
+ return this.swiper;
96
106
  }
97
107
  watchCurrent(newVal) {
98
- if (this.currentItemId || !this.isWillLoadCalled || !this.swiper)
108
+ if (this.currentItemId || !__classPrivateFieldGet(this, _Swiper_didLoad, "f"))
99
109
  return;
100
110
  const n = parseInt(newVal, 10);
101
- if (isNaN(n) || n === this.swiper.realIndex)
111
+ if (isNaN(n))
112
+ return;
113
+ const swiper = this.getSwiper(n);
114
+ if (!swiper) {
115
+ __classPrivateFieldSet(this, _Swiper_lastSwiperActiveIndex, n, "f");
116
+ return;
117
+ }
118
+ if (n === swiper.realIndex)
102
119
  return;
103
120
  __classPrivateFieldSet(this, _Swiper_source, '', "f");
104
121
  if (this.circular) {
105
- this.swiper.slideToLoop(n); // 更新下标
106
- this.autoplay && this.swiper.autoplay.pause();
122
+ swiper.slideToLoop(n); // 更新下标
123
+ this.autoplay && swiper.autoplay.pause();
107
124
  // @ts-ignore
108
- this.swiper.loopFix();
109
- this.autoplay && this.swiper.autoplay.start();
125
+ swiper.loopFix();
126
+ this.autoplay && swiper.autoplay.start();
110
127
  }
111
128
  else {
112
- this.swiper.slideTo(n); // 更新下标
129
+ swiper.slideTo(n); // 更新下标
113
130
  }
114
131
  }
115
132
  watchCurrentItemId(newVal) {
116
- if (!this.swiperWrapper || !this.isWillLoadCalled)
133
+ const swiper = this.getSwiper();
134
+ if (!swiper) {
135
+ __classPrivateFieldSet(this, _Swiper_pendingCurrentItemId, newVal, "f");
117
136
  return;
137
+ }
138
+ __classPrivateFieldSet(this, _Swiper_pendingCurrentItemId, null, "f");
118
139
  let itemIdIndex = 0;
119
140
  this.getSlidersList().forEach((swiperItem, index) => {
120
141
  const itemId = swiperItem.getAttribute('item-id');
@@ -127,32 +148,33 @@ const Swiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
127
148
  }
128
149
  }
129
150
  });
130
- if (itemIdIndex === this.swiper.realIndex)
151
+ if (itemIdIndex === swiper.realIndex)
131
152
  return; // 无需更新
132
153
  __classPrivateFieldSet(this, _Swiper_source, '', "f");
133
154
  if (this.circular) {
134
- this.swiper.slideToLoop(itemIdIndex); // 更新下标
155
+ swiper.slideToLoop(itemIdIndex); // 更新下标
135
156
  // @ts-ignore
136
- this.swiper.loopFix();
137
- this.autoplay && this.swiper.autoplay.start();
157
+ swiper.loopFix();
158
+ this.autoplay && swiper.autoplay.start();
138
159
  }
139
160
  else {
140
- this.swiper.slideTo(itemIdIndex); // 更新下标
161
+ swiper.slideTo(itemIdIndex); // 更新下标
141
162
  }
142
163
  }
143
164
  watchAutoplay(newVal) {
144
- if (!this.isWillLoadCalled || !this.swiper)
165
+ const swiper = this.getSwiper();
166
+ if (!swiper)
145
167
  return;
146
- const swiperAutoplay = this.swiper.autoplay;
168
+ const swiperAutoplay = swiper.autoplay;
147
169
  if (swiperAutoplay) {
148
170
  if (swiperAutoplay.running === newVal)
149
171
  return;
150
172
  if (newVal) {
151
- if (this.swiper.params && typeof this.swiper.params.autoplay === 'object') {
152
- if (this.swiper.params.autoplay.disableOnInteraction === true) {
153
- this.swiper.params.autoplay.disableOnInteraction = false;
173
+ if (swiper.params && typeof swiper.params.autoplay === 'object') {
174
+ if (swiper.params.autoplay.disableOnInteraction === true) {
175
+ swiper.params.autoplay.disableOnInteraction = false;
154
176
  }
155
- this.swiper.params.autoplay.delay = this.interval;
177
+ swiper.params.autoplay.delay = this.interval;
156
178
  }
157
179
  swiperAutoplay.start();
158
180
  }
@@ -162,110 +184,114 @@ const Swiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
162
184
  }
163
185
  }
164
186
  watchDuration(newVal) {
165
- if (!this.swiper || !this.isWillLoadCalled)
187
+ const swiper = this.getSwiper();
188
+ if (!swiper)
166
189
  return;
167
- this.swiper.params.speed = newVal;
190
+ swiper.params.speed = newVal;
168
191
  }
169
192
  watchInterval(newVal) {
170
- if (!this.swiper || !this.isWillLoadCalled)
193
+ const swiper = this.getSwiper();
194
+ if (!swiper)
171
195
  return;
172
- if (typeof this.swiper.params.autoplay === 'object') {
173
- this.swiper.params.autoplay.delay = newVal;
196
+ if (typeof swiper.params.autoplay === 'object') {
197
+ swiper.params.autoplay.delay = newVal;
174
198
  }
175
199
  }
176
- watchSwiperWrapper(newVal) {
177
- if (!this.isWillLoadCalled || !this.swiper)
178
- return;
179
- if (!newVal)
180
- return;
200
+ bindWrapper(wrapper) {
181
201
  const beforeDomOperation = () => {
182
- __classPrivateFieldSet(this, _Swiper_domChangeByOutSide, true, "f");
183
- // 如果是由于外部子节点的变化引起的 dom 变化,需要重新初始化 swiper。
184
- // 在初dom操作之前,需要调用 loopDestroy,把子节点的顺序恢复
185
- this.swiper.loopDestroy();
186
- this.swiper.params.loop = false;
187
- };
188
- this.el.appendChild = (newChild) => {
202
+ const swiper = this.swiper;
203
+ if (!swiper)
204
+ return;
205
+ const firstChange = !__classPrivateFieldGet(this, _Swiper_swiperResetting, "f");
189
206
  __classPrivateFieldSet(this, _Swiper_swiperResetting, true, "f");
190
- if (!__classPrivateFieldGet(this, _Swiper_domChangeByOutSide, "f") && this.circular) {
191
- beforeDomOperation();
207
+ if (firstChange && this.circular) {
208
+ swiper.autoplay.stop();
209
+ if (swiper.wrapperEl && swiper.slidesEl)
210
+ swiper.loopDestroy();
211
+ swiper.params.loop = false;
192
212
  }
193
- return newVal.appendChild(newChild);
213
+ this.handleSwiperSizeDebounce();
214
+ };
215
+ this.el.appendChild = (newChild) => {
216
+ beforeDomOperation();
217
+ return wrapper.appendChild(newChild);
194
218
  };
195
219
  this.el.insertBefore = (newChild, refChild) => {
196
- __classPrivateFieldSet(this, _Swiper_swiperResetting, true, "f");
197
- if (!__classPrivateFieldGet(this, _Swiper_domChangeByOutSide, "f") && this.circular) {
198
- beforeDomOperation();
199
- }
200
- return newVal.insertBefore(newChild, refChild);
220
+ beforeDomOperation();
221
+ return wrapper.insertBefore(newChild, refChild);
201
222
  };
202
223
  this.el.replaceChild = (newChild, oldChild) => {
203
- __classPrivateFieldSet(this, _Swiper_swiperResetting, true, "f");
204
- if (!__classPrivateFieldGet(this, _Swiper_domChangeByOutSide, "f") && this.circular) {
205
- beforeDomOperation();
206
- }
207
- return newVal.replaceChild(newChild, oldChild);
224
+ beforeDomOperation();
225
+ return wrapper.replaceChild(newChild, oldChild);
208
226
  };
209
227
  this.el.removeChild = (oldChild) => {
210
- __classPrivateFieldSet(this, _Swiper_swiperResetting, true, "f");
211
- if (!__classPrivateFieldGet(this, _Swiper_domChangeByOutSide, "f") && this.circular) {
212
- beforeDomOperation();
213
- }
214
- return newVal.removeChild(oldChild);
228
+ beforeDomOperation();
229
+ return wrapper.removeChild(oldChild);
215
230
  };
216
231
  }
217
232
  watchCircular() {
218
- if (!this.swiper || !this.isWillLoadCalled)
219
- return;
220
- this.reset();
233
+ if (__classPrivateFieldGet(this, _Swiper_didLoad, "f"))
234
+ this.reset();
221
235
  }
222
236
  watchDisplayMultipleItems() {
223
- if (!this.swiper || !this.isWillLoadCalled)
224
- return;
225
- this.reset();
237
+ if (__classPrivateFieldGet(this, _Swiper_didLoad, "f"))
238
+ this.reset();
226
239
  }
227
- componentWillLoad() {
228
- this.isWillLoadCalled = true;
240
+ connectedCallback() {
241
+ if (__classPrivateFieldGet(this, _Swiper_didLoad, "f"))
242
+ this.handleInit(true);
229
243
  }
230
244
  componentDidLoad() {
245
+ __classPrivateFieldSet(this, _Swiper_didLoad, true, "f");
231
246
  this.handleInit();
232
- if (!this.swiper || !this.swiperWrapper)
233
- return;
234
- this.observer = new MutationObserver(this.handleSwiperSizeDebounce);
235
- this.observer.observe(this.swiperWrapper, {
236
- childList: true
237
- });
238
247
  }
239
248
  disconnectedCallback() {
249
+ this.destroySwiper();
250
+ }
251
+ destroySwiper() {
240
252
  var _a;
253
+ clearTimeout(__classPrivateFieldGet(this, _Swiper_sizeTimer, "f"));
241
254
  (_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
255
+ this.observer = null;
256
+ const swiper = this.swiper;
257
+ this.swiper = null;
258
+ if (swiper && !swiper.destroyed) {
259
+ __classPrivateFieldSet(this, _Swiper_lastSwiperActiveIndex, swiper.realIndex, "f");
260
+ swiper.autoplay.stop();
261
+ // 失效节点无法还原循环顺序,但实例的事件和观察器仍需释放
262
+ if (!swiper.wrapperEl || !swiper.slidesEl)
263
+ swiper.params.loop = false;
264
+ swiper.destroy();
265
+ }
266
+ __classPrivateFieldSet(this, _Swiper_swiperResetting, false, "f");
242
267
  }
243
268
  handleInit(reset = false) {
269
+ var _a;
270
+ if (!this.el.isConnected || !__classPrivateFieldGet(this, _Swiper_container, "f") || this.swiper)
271
+ return;
244
272
  const { autoplay, circular, current, currentItemId, displayMultipleItems, duration, interval, effectsProps, vertical } = this;
245
273
  let initialSlide = current;
246
274
  if (reset) {
247
275
  initialSlide = __classPrivateFieldGet(this, _Swiper_lastSwiperActiveIndex, "f");
248
276
  }
249
- else {
250
- if (currentItemId) {
251
- let itemIdIndex = 0;
252
- this.getSlidersList().forEach((swiperItem, index) => {
253
- // @ts-ignore
254
- if (swiperItem.itemId && swiperItem.itemId === currentItemId) {
255
- itemIdIndex = index;
256
- }
257
- });
258
- initialSlide = itemIdIndex;
259
- }
277
+ else if (currentItemId) {
278
+ let itemIdIndex = 0;
279
+ this.getSlidersList().forEach((swiperItem, index) => {
280
+ // @ts-ignore
281
+ if (swiperItem.itemId && swiperItem.itemId === currentItemId) {
282
+ itemIdIndex = index;
283
+ }
284
+ });
285
+ initialSlide = itemIdIndex;
260
286
  }
261
287
  const loopAdditionalSlides = this.getLoopAdditionalSlides();
262
288
  const centeredSlides = displayMultipleItems === 1 && this.getNeedFixLoop();
263
289
  const slidesPerView = displayMultipleItems;
264
290
  // eslint-disable-next-line @typescript-eslint/no-this-alias
265
291
  const that = this;
266
- const options = Object.assign(Object.assign({ pagination: { el: `.taro-swiper-${__classPrivateFieldGet(this, _Swiper_id, "f")} > .swiper-container > .swiper-pagination` }, direction: vertical ? 'vertical' : 'horizontal', loop: circular, slidesPerView: slidesPerView, initialSlide: initialSlide, loopAdditionalSlides: loopAdditionalSlides, speed: duration, observeParents: true, observer: true, centeredSlides: centeredSlides, zoom: this.zoom, nested: true, touchReleaseOnEdges: true, threshold: 0 }, effectsProps), { on: {
292
+ const options = Object.assign(Object.assign({ pagination: { el: __classPrivateFieldGet(this, _Swiper_container, "f").querySelector('.swiper-pagination') }, direction: vertical ? 'vertical' : 'horizontal', loop: circular, slidesPerView: slidesPerView, initialSlide: initialSlide, loopAdditionalSlides: loopAdditionalSlides, speed: duration, observeParents: true, observer: true, centeredSlides: centeredSlides, zoom: this.zoom, nested: true, touchReleaseOnEdges: true, threshold: 0 }, effectsProps), { init: false, on: {
267
293
  transitionEnd(e) {
268
- if (__classPrivateFieldGet(that, _Swiper_swiperResetting, "f") || __classPrivateFieldGet(that, _Swiper_lastSwiperActiveIndex, "f") === this.realIndex)
294
+ if (e !== that.swiper || __classPrivateFieldGet(that, _Swiper_swiperResetting, "f") || __classPrivateFieldGet(that, _Swiper_lastSwiperActiveIndex, "f") === this.realIndex)
269
295
  return;
270
296
  __classPrivateFieldSet(that, _Swiper_lastSwiperActiveIndex, this.realIndex, "f");
271
297
  that.getNeedFixLoop() && e.loopFix();
@@ -278,11 +304,13 @@ const Swiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
278
304
  });
279
305
  __classPrivateFieldSet(that, _Swiper_source, 'autoplay', "f");
280
306
  },
281
- touchMove() {
307
+ touchMove(e) {
308
+ if (e !== that.swiper)
309
+ return;
282
310
  __classPrivateFieldSet(that, _Swiper_source, 'touch', "f");
283
311
  },
284
312
  slideChange(e) {
285
- if (__classPrivateFieldGet(that, _Swiper_swiperResetting, "f") || __classPrivateFieldGet(that, _Swiper_lastSwiperActiveIndex, "f") === this.realIndex)
313
+ if (e !== that.swiper || __classPrivateFieldGet(that, _Swiper_swiperResetting, "f") || __classPrivateFieldGet(that, _Swiper_lastSwiperActiveIndex, "f") === this.realIndex)
286
314
  return;
287
315
  const currentItemId = that.getCurrentItemId(e);
288
316
  that.onChange.emit({
@@ -291,19 +319,21 @@ const Swiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
291
319
  currentItemId,
292
320
  });
293
321
  },
294
- init: (e) => {
295
- that.getNeedFixLoop() && e.loopFix();
296
- that.autoplay && e.autoplay.start();
297
- },
298
322
  touchEnd: (e) => {
323
+ if (e !== that.swiper)
324
+ return;
299
325
  __classPrivateFieldSet(that, _Swiper_source, 'touch', "f");
300
326
  that.autoplay && e.autoplay.start();
301
327
  },
302
328
  touchStart: (e) => {
329
+ if (e !== that.swiper)
330
+ return;
303
331
  __classPrivateFieldSet(that, _Swiper_source, 'touch', "f");
304
332
  that.autoplay && e.autoplay.pause();
305
333
  },
306
334
  autoplay(e) {
335
+ if (e !== that.swiper)
336
+ return;
307
337
  // Note: 修复 autoplay 时,切换到其他页面再切回来,autoplay 会停止的问题
308
338
  // autoplay 会调用 slideTo 方法,里面会判断是否 animating,如果 animating 为 true,就会被 return
309
339
  // 参考源码:https://github.com/nolimits4web/swiper/blob/v11.1.0/src/core/slide/slideTo.mjs#27 27行
@@ -319,30 +349,51 @@ const Swiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
319
349
  disableOnInteraction: false
320
350
  };
321
351
  }
322
- this.swiper = new SwiperJS(`.taro-swiper-${__classPrivateFieldGet(this, _Swiper_id, "f")} > .swiper-container`, options);
352
+ // 使用组件内的真实节点,避免全局选择器在脱离文档或重建时匹配失败
353
+ const swiper = new SwiperJS(__classPrivateFieldGet(this, _Swiper_container, "f"), options);
354
+ try {
355
+ swiper.init();
356
+ }
357
+ finally {
358
+ if (!swiper.initialized) {
359
+ // 初始化失败时跳过循环节点还原,释放实例并保留原始初始化异常
360
+ swiper.params.loop = false;
361
+ swiper.destroy();
362
+ }
363
+ }
364
+ if (!swiper.initialized)
365
+ return;
366
+ this.swiper = swiper;
367
+ this.getNeedFixLoop() && swiper.loopFix();
323
368
  // Note: 这里是拦截了 swiper 的 minTranslate 和 maxTranslate 方法,手动修复了 loop 模式下的 margin 问题
324
369
  // 因为这两个属性会影响滑动到哪个位置进行 fixloop
325
370
  // 可参考源码:https://github.com/nolimits4web/swiper/blob/v11.1.0/src/core/events/onTouchMove.mjs
326
371
  // https://github.com/nolimits4web/swiper/blob/v11.1.0/src/core/loop/loopFix.mjs
327
372
  if (this.getNeedFixLoop()) {
328
373
  // @ts-ignore
329
- const minTranslate = this.swiper.minTranslate.bind(this.swiper);
374
+ const minTranslate = swiper.minTranslate.bind(this.swiper);
330
375
  //@ts-ignore
331
- const maxTranslate = this.swiper.maxTranslate.bind(this.swiper);
376
+ const maxTranslate = swiper.maxTranslate.bind(this.swiper);
332
377
  if (centeredSlides && this.getSlidersList().length < 4) {
333
378
  //@ts-ignore
334
- this.swiper.minTranslate = () => minTranslate() + this.parseMargin()[1];
379
+ swiper.minTranslate = () => minTranslate() + this.parseMargin()[1];
335
380
  //@ts-ignore
336
- this.swiper.maxTranslate = () => maxTranslate() - this.parseMargin()[0];
381
+ swiper.maxTranslate = () => maxTranslate() - this.parseMargin()[0];
337
382
  }
338
383
  else {
339
384
  //@ts-ignore
340
- this.swiper.minTranslate = () => minTranslate() - this.parseMargin()[0];
385
+ swiper.minTranslate = () => minTranslate() - this.parseMargin()[0];
341
386
  //@ts-ignore
342
- this.swiper.maxTranslate = () => maxTranslate() + this.parseMargin()[1];
387
+ swiper.maxTranslate = () => maxTranslate() + this.parseMargin()[1];
343
388
  }
344
389
  }
345
- this.swiperWrapper = this.swiper.wrapperEl;
390
+ this.bindWrapper(swiper.wrapperEl);
391
+ (_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
392
+ this.observer = new MutationObserver(this.handleSwiperSizeDebounce);
393
+ this.observer.observe(swiper.wrapperEl, { childList: true });
394
+ // 脱离文档期间更新的目标项,在实例恢复后应用一次
395
+ if (__classPrivateFieldGet(this, _Swiper_pendingCurrentItemId, "f") !== null)
396
+ this.watchCurrentItemId(__classPrivateFieldGet(this, _Swiper_pendingCurrentItemId, "f"));
346
397
  }
347
398
  // Note: loop 的时候添加 additionalSlides 可以避免循环的时候由于 loopFix 不及时,出现空白的问题。但是并不是 additionalSlides 越多越好,因为 additionalSlides 越多,如果 swiper-item 的数量不够,会导致出现 bug。
348
399
  // 目前的策略是 swiper-item 的数量小于等于 5 时,不添加 additionalSlides,大于 5 小于等于 7 时,添加 1 个 additionalSlides,大于 7 时,添加 2 个 additionalSlides。
@@ -358,7 +409,7 @@ const Swiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
358
409
  const slides = swiper.slides;
359
410
  const activeIndex = swiper.activeIndex;
360
411
  const currentSlide = slides[activeIndex];
361
- return currentSlide.getAttribute('item-id');
412
+ return (currentSlide === null || currentSlide === void 0 ? void 0 : currentSlide.getAttribute('item-id')) || '';
362
413
  }
363
414
  render() {
364
415
  const { vertical, indicatorDots, indicatorColor, indicatorActiveColor } = this;
@@ -376,7 +427,7 @@ const Swiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
376
427
  if (this.full) {
377
428
  hostStyle.height = '100%';
378
429
  }
379
- return (h(Host, { class: `taro-swiper-${__classPrivateFieldGet(this, _Swiper_id, "f")}`, style: hostStyle }, h("div", { class: 'swiper-container' }, h("style", { type: 'text/css' }, `
430
+ return (h(Host, { class: `taro-swiper-${__classPrivateFieldGet(this, _Swiper_id, "f")}`, style: hostStyle }, h("div", { class: 'swiper-container', ref: el => { __classPrivateFieldSet(this, _Swiper_container, el || null, "f"); } }, h("style", { type: 'text/css' }, `
380
431
  .taro-swiper-${__classPrivateFieldGet(this, _Swiper_id, "f")} > .swiper-container > .swiper-pagination > .swiper-pagination-bullet { background: ${indicatorColor} }
381
432
  .taro-swiper-${__classPrivateFieldGet(this, _Swiper_id, "f")} > .swiper-container > .swiper-pagination > .swiper-pagination-bullet-active { background: ${indicatorActiveColor} }
382
433
  .taro-swiper-${__classPrivateFieldGet(this, _Swiper_id, "f")} > .swiper-container { ${swiperContainerStyleList.join('')} }
@@ -390,7 +441,6 @@ const Swiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
390
441
  "autoplay": ["watchAutoplay"],
391
442
  "duration": ["watchDuration"],
392
443
  "interval": ["watchInterval"],
393
- "swiperWrapper": ["watchSwiperWrapper"],
394
444
  "circular": ["watchCircular"],
395
445
  "displayMultipleItems": ["watchDisplayMultipleItems"]
396
446
  }; }
@@ -411,13 +461,9 @@ const Swiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
411
461
  "displayMultipleItems": [2, "display-multiple-items"],
412
462
  "full": [4],
413
463
  "zoom": [4],
414
- "effectsProps": [16],
415
- "swiperWrapper": [32],
416
- "swiper": [32],
417
- "isWillLoadCalled": [32],
418
- "observer": [32]
464
+ "effectsProps": [16]
419
465
  }]);
420
- _Swiper_id = new WeakMap(), _Swiper_source = new WeakMap(), _Swiper_swiperResetting = new WeakMap(), _Swiper_domChangeByOutSide = new WeakMap(), _Swiper_lastSwiperActiveIndex = new WeakMap();
466
+ _Swiper_id = new WeakMap(), _Swiper_source = new WeakMap(), _Swiper_swiperResetting = new WeakMap(), _Swiper_lastSwiperActiveIndex = new WeakMap(), _Swiper_pendingCurrentItemId = new WeakMap(), _Swiper_didLoad = new WeakMap(), _Swiper_container = new WeakMap(), _Swiper_sizeTimer = new WeakMap();
421
467
  function defineCustomElement$1() {
422
468
  if (typeof customElements === "undefined") {
423
469
  return;
package/dist/esm/index.js CHANGED
@@ -76,7 +76,7 @@ export { S as Snapshot } from './snapshot-42feea7d.js';
76
76
  export { S as Span } from './span-d4b171da.js';
77
77
  export { S as StickyHeader } from './sticky-header-a99729bc.js';
78
78
  export { S as StickySection } from './sticky-section-f8d75284.js';
79
- export { a as Swiper, S as SwiperItem } from './swiper-20b19ce0.js';
79
+ export { a as Swiper, S as SwiperItem } from './swiper-59728a6c.js';
80
80
  export { S as Switch } from './switch-a538d85e.js';
81
81
  export { a as Tabbar, T as TabbarItem } from './tabbar-e6342392.js';
82
82
  export { T as TabItem } from './tab-item-f58dd1b0.js';