@tarojs/components 3.6.0-beta.0 → 3.6.0-beta.2

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 (28) hide show
  1. package/dist/cjs/taro-swiper-core_2.cjs.entry.js +39 -5
  2. package/dist/cjs/taro-swiper-core_2.cjs.entry.js.map +1 -1
  3. package/dist/collection/components/swiper/swiper-item.js +37 -1
  4. package/dist/collection/components/swiper/swiper-item.js.map +1 -1
  5. package/dist/collection/components/swiper/swiper.js +3 -5
  6. package/dist/collection/components/swiper/swiper.js.map +1 -1
  7. package/dist/esm/taro-swiper-core_2.entry.js +39 -5
  8. package/dist/esm/taro-swiper-core_2.entry.js.map +1 -1
  9. package/dist/esm-es5/taro-swiper-core_2.entry.js +1 -1
  10. package/dist/esm-es5/taro-swiper-core_2.entry.js.map +1 -1
  11. package/dist/taro-components/{p-6831f7b1.system.entry.js → p-2a0c8d1d.system.entry.js} +2 -2
  12. package/dist/taro-components/p-2a0c8d1d.system.entry.js.map +1 -0
  13. package/dist/taro-components/{p-d388c097.entry.js → p-95a241f9.entry.js} +2 -2
  14. package/dist/taro-components/p-95a241f9.entry.js.map +1 -0
  15. package/dist/taro-components/p-cb17d8bd.system.js +1 -1
  16. package/dist/taro-components/taro-components.esm.js +1 -1
  17. package/dist/types/components/swiper/swiper-item.d.ts +2 -0
  18. package/package.json +5 -5
  19. package/types/ChannelLive.d.ts +22 -0
  20. package/types/Form.d.ts +6 -0
  21. package/types/Input.d.ts +1 -0
  22. package/types/LivePusher.d.ts +15 -0
  23. package/types/ShareElement.d.ts +0 -5
  24. package/types/Textarea.d.ts +1 -0
  25. package/types/Video.d.ts +6 -0
  26. package/types/index.d.ts +1 -0
  27. package/dist/taro-components/p-6831f7b1.system.entry.js.map +0 -1
  28. package/dist/taro-components/p-d388c097.entry.js.map +0 -1
@@ -1,8 +1,43 @@
1
- import { h, Host } from '@stencil/core';
1
+ import { Host, h } from '@stencil/core';
2
+ function isEqualTag(a, b) {
3
+ return typeof a.tagName === 'undefined' ? a.nodeType === b.nodeType : a.tagName === b.tagName;
4
+ }
5
+ function parseChildNodes(items, targets) {
6
+ const list = Array.from(targets.values());
7
+ for (let i = 0, j = 0; i < list.length; i++, j++) {
8
+ const target = list[i];
9
+ let item = items.item(j);
10
+ while (item && !isEqualTag(item, target)) {
11
+ item.remove();
12
+ j++;
13
+ item = items.item(j);
14
+ }
15
+ if (item && !item.isEqualNode(target)) {
16
+ parseChildNodes(item.childNodes, target.childNodes);
17
+ }
18
+ while (i === list.length - 1 && j < items.length) {
19
+ j++;
20
+ item = items.item(j);
21
+ item === null || item === void 0 ? void 0 : item.remove();
22
+ }
23
+ }
24
+ }
2
25
  export class SwiperItem {
3
26
  constructor() {
4
27
  this.itemId = undefined;
5
28
  }
29
+ componentDidRender() {
30
+ var _a, _b, _c;
31
+ const el = this.el;
32
+ if (el.classList.contains('swiper-slide-duplicate')) {
33
+ const list = Array
34
+ .from(((_b = (_a = el.parentElement) === null || _a === void 0 ? void 0 : _a.childNodes) === null || _b === void 0 ? void 0 : _b.values()) || [])
35
+ .filter((e) => e.tagName === 'TARO-SWIPER-ITEM-CORE');
36
+ if (list.length > 0) {
37
+ parseChildNodes(el.childNodes, (_c = list[list.indexOf(el) === 0 ? list.length - 2 : 1]) === null || _c === void 0 ? void 0 : _c.childNodes);
38
+ }
39
+ }
40
+ }
6
41
  render() {
7
42
  return (h(Host, { class: 'swiper-slide', "item-id": this.itemId }));
8
43
  }
@@ -28,5 +63,6 @@ export class SwiperItem {
28
63
  }
29
64
  };
30
65
  }
66
+ static get elementRef() { return "el"; }
31
67
  }
32
68
  //# sourceMappingURL=swiper-item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"swiper-item.js","sourceRoot":"","sources":["../../../src/components/swiper/swiper-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAsB,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAK5E,MAAM,OAAO,UAAU;;;;EAGrB,MAAM;IACJ,OAAO,CACL,EAAC,IAAI,IAAC,KAAK,EAAC,cAAc,aAAU,IAAI,CAAC,MAAM,GAAG,CACnD,CAAA;EACH,CAAC;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, ComponentInterface, Prop, Host } from '@stencil/core'\n\n@Component({\n tag: 'taro-swiper-item-core'\n})\nexport class SwiperItem implements ComponentInterface {\n @Prop() itemId: string\n\n render () {\n return (\n <Host class='swiper-slide' item-id={this.itemId}/>\n )\n }\n}\n"]}
1
+ {"version":3,"file":"swiper-item.js","sourceRoot":"","sources":["../../../src/components/swiper/swiper-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAErF,SAAS,UAAU,CAAE,CAAU,EAAE,CAAU;EACzC,OAAO,OAAO,CAAC,CAAC,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,CAAA;AAC/F,CAAC;AAED,SAAS,eAAe,CAAE,KAA4B,EAAE,OAA8B;EACpF,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;EACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE;IAChD,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAY,CAAA;IACjC,IAAI,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAY,CAAA;IACnC,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE;MACx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C,IAAI,IAAC,KAAK,EAAC,cAAc,aAAU,IAAI,CAAC,MAAM,GAAG,CACnD,CAAA;EACH,CAAC;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, ComponentInterface, Element, Host, h, Prop } from '@stencil/core'\n\nfunction isEqualTag (a: Element, b: Element) {\n return typeof a.tagName === 'undefined' ? a.nodeType === b.nodeType : a.tagName === b.tagName\n}\n\nfunction parseChildNodes (items: NodeListOf<ChildNode>, targets: NodeListOf<ChildNode>) {\n const list = Array.from(targets.values())\n for (let i = 0, j = 0; i < list.length; i++, j++) {\n const target = list[i] as Element\n let item = items.item(j) as Element\n while (item && !isEqualTag(item, target)) {\n item.remove()\n j++\n item = items.item(j) as Element\n }\n if (item && !item.isEqualNode(target)) {\n parseChildNodes(item.childNodes, target.childNodes)\n }\n while (i === list.length - 1 && j < items.length) {\n j++\n item = items.item(j) as Element\n item?.remove()\n }\n }\n}\n\n@Component({\n tag: 'taro-swiper-item-core'\n})\nexport class SwiperItem implements ComponentInterface {\n @Element() el: HTMLElement\n\n @Prop() itemId: string\n\n componentDidRender () {\n const el = this.el\n\n if (el.classList.contains('swiper-slide-duplicate')) {\n const list = Array\n .from(el.parentElement?.childNodes?.values() || [])\n .filter((e: Element) => e.tagName === 'TARO-SWIPER-ITEM-CORE')\n if (list.length > 0) {\n parseChildNodes(\n el.childNodes,\n list[list.indexOf(el) === 0 ? list.length - 2 : 1]?.childNodes\n )\n }\n }\n }\n\n render () {\n return (\n <Host class='swiper-slide' item-id={this.itemId}/>\n )\n }\n}\n"]}
@@ -28,11 +28,9 @@ export class Swiper {
28
28
  this.handleSwiperLoop = debounce(() => {
29
29
  if (this.swiper && this.circular) {
30
30
  // @ts-ignore
31
- this.swiper.loopDestroy();
32
- // @ts-ignore
33
- this.swiper.loopCreate();
31
+ this.swiper.loopFix();
34
32
  }
35
- }, 500);
33
+ }, 50);
36
34
  this.handleSwiperSize = debounce(() => {
37
35
  if (this.swiper && !this.circular) {
38
36
  this.swiper.updateSlides();
@@ -189,7 +187,7 @@ export class Swiper {
189
187
  slideChangeTransitionStart(_swiper) {
190
188
  if (that.circular) {
191
189
  if (_swiper.isBeginning || _swiper.isEnd) {
192
- _swiper.slideToLoop(this.realIndex, 0); // 更新下标
190
+ // _swiper.slideToLoop(this.realIndex, 0, false) // 更新下标
193
191
  return;
194
192
  }
195
193
  }
@@ -1 +1 @@
1
- {"version":3,"file":"swiper.js","sourceRoot":"","sources":["../../../src/components/swiper/swiper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAsB,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACxH,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC,OAAO,QAAQ,MAAM,6BAA6B,CAAA;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,IAAI,WAAW,GAAG,CAAC,CAAA;AAQnB,MAAM,OAAO,MAAM;;IACT,QAAG,GAAG,WAAW,EAAE,CAAA;IA6M3B,2BAAsB,GAAG,GAAG,EAAE;;MAC5B,CAAA,MAAA,IAAI,CAAC,aAAa,0CAAE,UAAU,KAAI,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAA;MACjE,CAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,UAAU,KAAI,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,CAAA;MAC/D,IAAI,CAAC,aAAa,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;MAChE,IAAI,CAAC,YAAY,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;MAC/D,MAAM,OAAO,GAAG,MAAA,IAAI,CAAC,MAAM,CAAC,UAAU,0CAAG,CAAC,CAAC,CAAA;MAC3C,MAAM,IAAI,GAAG,OAAO,CAAC,gBAAgB,CAAC,oDAAoD,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CAAC,mBAAmB,EACxC;YACE,0BAA0B,EAAE,CAAC,aAAa;YAC1C,2BAA2B,EAAE,aAAa;WAC3C,CACF,GAAI,CACD,CACD,CACR,CAAA;EACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, ComponentInterface, Prop, Event, EventEmitter, Watch, Host, Element, State } from '@stencil/core'\nimport classNames from 'classnames'\nimport type ISwiper from 'swiper'\nimport SwiperJS from 'swiper/swiper-bundle.esm.js'\n\nimport { debounce } from '../../utils'\n\nlet INSTANCE_ID = 0\n\n@Component({\n tag: 'taro-swiper-core',\n styleUrls: [\n './style/index.scss'\n ]\n})\nexport class Swiper implements ComponentInterface {\n private _id = INSTANCE_ID++\n\n @Element() el: HTMLElement\n @State() swiperWrapper: HTMLElement | null\n @State() private swiper: ISwiper\n @State() isWillLoadCalled = false\n /**\n * 是否显示面板指示点\n */\n @Prop() indicatorDots = false\n\n /**\n * 指示点颜色\n */\n @Prop() indicatorColor = 'rgba(0, 0, 0, .3)'\n\n /**\n * 当前选中的指示点颜色\n */\n @Prop() indicatorActiveColor = '#000000'\n\n /**\n * 是否自动切换\n */\n @Prop() autoplay = false\n\n /**\n * 当前所在滑块的 index\n */\n @Prop() current = 0\n\n /**\n * 自动切换时间间隔\n */\n @Prop() interval = 5000\n\n /**\n * 滑动动画时长\n */\n @Prop() duration = 500\n\n /**\n * 是否采用衔接滑动\n */\n @Prop() circular = false\n\n /**\n * 滑动方向是否为纵向\n */\n @Prop() vertical = false\n\n /**\n * 前边距,可用于露出前一项的一小部分,接受 px 值\n */\n @Prop() previousMargin = '0px'\n\n /**\n * 后边距,可用于露出后一项的一小部分,接受 px 值\n */\n @Prop() nextMargin = '0px'\n\n /**\n * 同时显示的滑块数量\n */\n @Prop() displayMultipleItems = 1\n\n /**\n * 给 previewImage API 使用,全屏显示 swiper\n */\n @Prop() full = false\n\n /**\n * 给 previewImage API 使用,缩放支持\n */\n @Prop() zoom = false\n\n @Event({\n eventName: 'change'\n }) onChange: EventEmitter\n\n @Event({\n eventName: 'animationfinish'\n }) onAnimationFinish: EventEmitter\n\n @Watch('current')\n watchCurrent (newVal) {\n if (!this.isWillLoadCalled) return\n\n const n = parseInt(newVal, 10)\n if (isNaN(n)) return\n\n if (this.circular) {\n if (!this.swiper.isBeginning && !this.swiper.isEnd) {\n this.swiper.slideToLoop(n) // 更新下标\n }\n } else {\n this.swiper.slideTo(n) // 更新下标\n }\n }\n\n @Watch('autoplay')\n watchAutoplay (newVal) {\n if (!this.isWillLoadCalled || !this.swiper) return\n\n const swiperAutoplay = this.swiper.autoplay\n if (swiperAutoplay) {\n if (swiperAutoplay.running === newVal) return\n \n if (newVal) {\n if (this.swiper.params && typeof this.swiper.params.autoplay === 'object') {\n if (this.swiper.params.autoplay.disableOnInteraction === true) {\n this.swiper.params.autoplay.disableOnInteraction = false\n }\n this.swiper.params.autoplay.delay = this.interval\n }\n swiperAutoplay.start()\n } else {\n swiperAutoplay.stop()\n }\n }\n }\n\n @Watch('duration')\n watchDuration (newVal) {\n if (!this.isWillLoadCalled) return\n this.swiper.params.speed = newVal\n }\n\n @Watch('interval')\n watchInterval (newVal) {\n if (!this.isWillLoadCalled) return\n\n if (typeof this.swiper.params.autoplay === 'object') {\n this.swiper.params.autoplay.delay = newVal\n }\n }\n\n @Watch('swiperWrapper')\n watchSwiperWrapper (newVal?: HTMLElement) {\n if (!this.isWillLoadCalled) return\n if (!newVal) return\n this.el.appendChild = <T extends Node>(newChild: T): T => {\n return newVal.appendChild(newChild)\n }\n this.el.insertBefore = <T extends Node>(newChild: T, refChild: Node | null): T => {\n return newVal.insertBefore(newChild, refChild)\n }\n this.el.replaceChild = <T extends Node>(newChild: Node, oldChild: T): T => {\n return newVal.replaceChild(newChild, oldChild)\n }\n this.el.removeChild = <T extends Node>(oldChild: T): T => {\n return newVal.removeChild(oldChild)\n }\n this.el.addEventListener('DOMNodeInserted', this.handleSwiperSize)\n this.el.addEventListener('DOMNodeRemoved', this.handleSwiperSize)\n }\n\n @Watch(\"circular\")\n watchCircular () {\n if (this.swiper) {\n this.swiper.destroy()\n this.handleInit()\n }\n }\n\n @State() observer: MutationObserver\n @State() observerFirst: MutationObserver\n @State() observerLast: MutationObserver\n\n componentWillLoad () {\n this.isWillLoadCalled = true\n }\n\n componentDidLoad () {\n this.handleInit()\n if (!this.swiper || !this.circular) return\n\n const wrapper = this.swiper.$wrapperEl?.[0]\n this.observer = new MutationObserver(this.handleSwiperLoopListen)\n\n this.observer.observe(wrapper, {\n childList: true\n })\n }\n\n componentWillUpdate () {\n if (!this.swiper) return\n if (this.autoplay && !this.swiper.autoplay?.running) {\n this.swiper.autoplay?.start()\n }\n this.swiper.update() // 更新子元素\n }\n\n componentDidRender () {\n this.handleSwiperLoop()\n }\n\n disconnectedCallback () {\n this.el.removeEventListener('DOMNodeInserted', this.handleSwiperSize)\n this.el.removeEventListener('DOMNodeRemoved', this.handleSwiperSize)\n this.observer?.disconnect?.()\n this.observerFirst?.disconnect?.()\n this.observerLast?.disconnect?.()\n }\n\n handleSwiperLoopListen = () => {\n this.observerFirst?.disconnect && this.observerFirst.disconnect()\n this.observerLast?.disconnect && this.observerLast.disconnect()\n this.observerFirst = new MutationObserver(this.handleSwiperLoop)\n this.observerLast = new MutationObserver(this.handleSwiperLoop)\n const wrapper = this.swiper.$wrapperEl?.[0]\n const list = wrapper.querySelectorAll('taro-swiper-item-core:not(.swiper-slide-duplicate)')\n if (list.length >= 1) {\n this.observerFirst.observe(list[0], {\n characterData: true\n })\n } else if (list.length >= 2) {\n this.observerLast.observe(list[list.length - 1], {\n characterData: true\n })\n }\n }\n\n handleSwiperLoop = debounce(() => {\n if (this.swiper && this.circular) {\n // @ts-ignore\n this.swiper.loopDestroy()\n // @ts-ignore\n this.swiper.loopCreate()\n }\n }, 500)\n\n handleSwiperSize = debounce(() => {\n if (this.swiper && !this.circular) {\n this.swiper.updateSlides()\n }\n }, 50)\n\n handleInit () {\n const {\n autoplay,\n circular,\n current,\n displayMultipleItems,\n duration,\n interval,\n vertical\n } = this\n\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this\n\n const options: any = {\n pagination: { el: `.taro-swiper-${this._id} > .swiper-container > .swiper-pagination` },\n direction: vertical ? 'vertical' : 'horizontal',\n loop: circular,\n slidesPerView: displayMultipleItems,\n initialSlide: current,\n speed: duration,\n observer: true,\n observeParents: true,\n zoom: this.zoom,\n on: {\n slideTo () {\n that.current = this.realIndex\n },\n // slideChange 事件在 swiper.slideTo 改写 current 时不触发,因此用 slideChangeTransitionStart 事件代替\n slideChangeTransitionStart (_swiper: ISwiper) {\n if (that.circular) {\n if (_swiper.isBeginning || _swiper.isEnd) {\n _swiper.slideToLoop(this.realIndex, 0) // 更新下标\n return\n }\n }\n that.onChange.emit({\n current: this.realIndex,\n source: ''\n })\n },\n transitionEnd () {\n that.onAnimationFinish.emit({\n current: this.realIndex,\n source: ''\n })\n },\n observerUpdate (_swiper: ISwiper, e) {\n const target = e.target\n const className = target && typeof target.className === 'string' ? target.className : ''\n if (className.includes('taro_page') && target.style.display !== 'none') {\n if (that.autoplay && target.contains(_swiper.$el[0])) {\n if (that.circular) {\n _swiper.slideToLoop(this.realIndex, 0) // 更新下标\n } else {\n _swiper.slideTo(this.realIndex)\n }\n }\n }\n }\n }\n }\n\n // 自动播放\n if (autoplay) {\n options.autoplay = {\n delay: interval,\n disableOnInteraction: false\n }\n }\n\n this.swiper = new SwiperJS(`.taro-swiper-${this._id} > .swiper-container`, options)\n this.swiperWrapper = this.el.querySelector(`.taro-swiper-${this._id} > .swiper-container > .swiper-wrapper`)\n }\n\n render () {\n const {\n vertical,\n indicatorDots,\n indicatorColor,\n indicatorActiveColor\n } = this\n\n const hostStyle: Record<string, string> = { overflow: 'hidden' }\n const style: Record<string, string> = { overflow: 'visible' }\n if (this.full) {\n hostStyle.height = '100%'\n style.height = '100%'\n }\n\n const [, previousMargin] = /^(\\d+)px/.exec(this.previousMargin) || []\n const [, nextMargin] = /^(\\d+)px/.exec(this.nextMargin) || []\n const pM = parseInt(previousMargin) || 0\n const nM = parseInt(nextMargin) || 0\n if (vertical) {\n style.marginTop = `${pM}px`\n style.marginBottom = `${nM}px`\n } else {\n style.marginRight = `${nM}px`\n style.marginLeft = `${pM}px`\n }\n\n return (\n <Host class={`taro-swiper-${this._id}`} style={hostStyle}>\n <div class='swiper-container' style={style}>\n <style type='text/css'>\n {`\n .taro-swiper-${this._id} > .swiper-container > .swiper-pagination > .swiper-pagination-bullet { background: ${indicatorColor} }\n .taro-swiper-${this._id} > .swiper-container > .swiper-pagination > .swiper-pagination-bullet-active { background: ${indicatorActiveColor} }\n `}\n </style>\n <div class='swiper-wrapper'>\n <slot />\n </div>\n <div class={classNames('swiper-pagination',\n {\n 'swiper-pagination-hidden': !indicatorDots,\n 'swiper-pagination-bullets': indicatorDots\n }\n )} />\n </div>\n </Host>\n )\n }\n}\n"]}
1
+ {"version":3,"file":"swiper.js","sourceRoot":"","sources":["../../../src/components/swiper/swiper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAsB,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACxH,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC,OAAO,QAAQ,MAAM,6BAA6B,CAAA;AAElD,OAAO,EAAE,QAAQ,EA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AC,YAAY,GAAG,GAAG,EAAE,IAAI,CAAA;KAC/B;SAAM;MACL,KAAK,CAAC,WAAW,GAAG,GAAG,EAAE,IAAI,CAAA;MAC7B,KAAK,CAAC,UAAU,GAAG,GAAG,EAAE,IAAI,CAAA;KAC7B;IAED,OAAO,CACL,EAAC,IAAI,IAAC,KAAK,EAAE,eAAe,IAAI,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS;MACtD,WAAK,KAAK,EAAC,kBAAkB,EAAC,KAAK,EAAE,KAAK;QACxC,aAAO,IAAI,EAAC,UAAU,IACnB;6BACgB,IAAI,CAAC,GAAG,uFAAuF,cAAc;6BAC7G,IAAI,CAAC,GAAG,8FAA8F,oBAAoB;aAC1I,CACK;QACR,WAAK,KAAK,EAAC,gBAAgB;UACzB,eAAQ,CACJ;QACN,WAAK,KAAK,EAAE,UAAU,CAAC,mBAAmB,EACxC;YACE,0BAA0B,EAAE,CAAC,aAAa;YAC1C,2BAA2B,EAAE,aAAa;WAC3C,CACF,GAAI,CACD,CACD,CACR,CAAA;EACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, ComponentInterface, Prop, Event, EventEmitter, Watch, Host, Element, State } from '@stencil/core'\nimport classNames from 'classnames'\nimport type ISwiper from 'swiper'\nimport SwiperJS from 'swiper/swiper-bundle.esm.js'\n\nimport { debounce } from '../../utils'\n\nlet INSTANCE_ID = 0\n\n@Component({\n tag: 'taro-swiper-core',\n styleUrls: [\n './style/index.scss'\n ]\n})\nexport class Swiper implements ComponentInterface {\n private _id = INSTANCE_ID++\n\n @Element() el: HTMLElement\n @State() swiperWrapper: HTMLElement | null\n @State() private swiper: ISwiper\n @State() isWillLoadCalled = false\n /**\n * 是否显示面板指示点\n */\n @Prop() indicatorDots = false\n\n /**\n * 指示点颜色\n */\n @Prop() indicatorColor = 'rgba(0, 0, 0, .3)'\n\n /**\n * 当前选中的指示点颜色\n */\n @Prop() indicatorActiveColor = '#000000'\n\n /**\n * 是否自动切换\n */\n @Prop() autoplay = false\n\n /**\n * 当前所在滑块的 index\n */\n @Prop() current = 0\n\n /**\n * 自动切换时间间隔\n */\n @Prop() interval = 5000\n\n /**\n * 滑动动画时长\n */\n @Prop() duration = 500\n\n /**\n * 是否采用衔接滑动\n */\n @Prop() circular = false\n\n /**\n * 滑动方向是否为纵向\n */\n @Prop() vertical = false\n\n /**\n * 前边距,可用于露出前一项的一小部分,接受 px 值\n */\n @Prop() previousMargin = '0px'\n\n /**\n * 后边距,可用于露出后一项的一小部分,接受 px 值\n */\n @Prop() nextMargin = '0px'\n\n /**\n * 同时显示的滑块数量\n */\n @Prop() displayMultipleItems = 1\n\n /**\n * 给 previewImage API 使用,全屏显示 swiper\n */\n @Prop() full = false\n\n /**\n * 给 previewImage API 使用,缩放支持\n */\n @Prop() zoom = false\n\n @Event({\n eventName: 'change'\n }) onChange: EventEmitter\n\n @Event({\n eventName: 'animationfinish'\n }) onAnimationFinish: EventEmitter\n\n @Watch('current')\n watchCurrent (newVal) {\n if (!this.isWillLoadCalled) return\n\n const n = parseInt(newVal, 10)\n if (isNaN(n)) return\n\n if (this.circular) {\n if (!this.swiper.isBeginning && !this.swiper.isEnd) {\n this.swiper.slideToLoop(n) // 更新下标\n }\n } else {\n this.swiper.slideTo(n) // 更新下标\n }\n }\n\n @Watch('autoplay')\n watchAutoplay (newVal) {\n if (!this.isWillLoadCalled || !this.swiper) return\n\n const swiperAutoplay = this.swiper.autoplay\n if (swiperAutoplay) {\n if (swiperAutoplay.running === newVal) return\n \n if (newVal) {\n if (this.swiper.params && typeof this.swiper.params.autoplay === 'object') {\n if (this.swiper.params.autoplay.disableOnInteraction === true) {\n this.swiper.params.autoplay.disableOnInteraction = false\n }\n this.swiper.params.autoplay.delay = this.interval\n }\n swiperAutoplay.start()\n } else {\n swiperAutoplay.stop()\n }\n }\n }\n\n @Watch('duration')\n watchDuration (newVal) {\n if (!this.isWillLoadCalled) return\n this.swiper.params.speed = newVal\n }\n\n @Watch('interval')\n watchInterval (newVal) {\n if (!this.isWillLoadCalled) return\n\n if (typeof this.swiper.params.autoplay === 'object') {\n this.swiper.params.autoplay.delay = newVal\n }\n }\n\n @Watch('swiperWrapper')\n watchSwiperWrapper (newVal?: HTMLElement) {\n if (!this.isWillLoadCalled) return\n if (!newVal) return\n this.el.appendChild = <T extends Node>(newChild: T): T => {\n return newVal.appendChild(newChild)\n }\n this.el.insertBefore = <T extends Node>(newChild: T, refChild: Node | null): T => {\n return newVal.insertBefore(newChild, refChild)\n }\n this.el.replaceChild = <T extends Node>(newChild: Node, oldChild: T): T => {\n return newVal.replaceChild(newChild, oldChild)\n }\n this.el.removeChild = <T extends Node>(oldChild: T): T => {\n return newVal.removeChild(oldChild)\n }\n this.el.addEventListener('DOMNodeInserted', this.handleSwiperSize)\n this.el.addEventListener('DOMNodeRemoved', this.handleSwiperSize)\n }\n\n @Watch(\"circular\")\n watchCircular () {\n if (this.swiper) {\n this.swiper.destroy()\n this.handleInit()\n }\n }\n\n @State() observer: MutationObserver\n @State() observerFirst: MutationObserver\n @State() observerLast: MutationObserver\n\n componentWillLoad () {\n this.isWillLoadCalled = true\n }\n\n componentDidLoad () {\n this.handleInit()\n if (!this.swiper || !this.circular) return\n\n const wrapper = this.swiper.$wrapperEl?.[0]\n this.observer = new MutationObserver(this.handleSwiperLoopListen)\n\n this.observer.observe(wrapper, {\n childList: true\n })\n }\n\n componentWillUpdate () {\n if (!this.swiper) return\n if (this.autoplay && !this.swiper.autoplay?.running) {\n this.swiper.autoplay?.start()\n }\n this.swiper.update() // 更新子元素\n }\n\n componentDidRender () {\n this.handleSwiperLoop()\n }\n\n disconnectedCallback () {\n this.el.removeEventListener('DOMNodeInserted', this.handleSwiperSize)\n this.el.removeEventListener('DOMNodeRemoved', this.handleSwiperSize)\n this.observer?.disconnect?.()\n this.observerFirst?.disconnect?.()\n this.observerLast?.disconnect?.()\n }\n\n handleSwiperLoopListen = () => {\n this.observerFirst?.disconnect && this.observerFirst.disconnect()\n this.observerLast?.disconnect && this.observerLast.disconnect()\n this.observerFirst = new MutationObserver(this.handleSwiperLoop)\n this.observerLast = new MutationObserver(this.handleSwiperLoop)\n const wrapper = this.swiper.$wrapperEl?.[0]\n const list = wrapper.querySelectorAll('taro-swiper-item-core:not(.swiper-slide-duplicate)')\n if (list.length >= 1) {\n this.observerFirst.observe(list[0], {\n characterData: true\n })\n } else if (list.length >= 2) {\n this.observerLast.observe(list[list.length - 1], {\n characterData: true\n })\n }\n }\n\n handleSwiperLoop = debounce(() => {\n if (this.swiper && this.circular) {\n // @ts-ignore\n this.swiper.loopFix()\n }\n }, 50)\n\n handleSwiperSize = debounce(() => {\n if (this.swiper && !this.circular) {\n this.swiper.updateSlides()\n }\n }, 50)\n\n handleInit () {\n const {\n autoplay,\n circular,\n current,\n displayMultipleItems,\n duration,\n interval,\n vertical\n } = this\n\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this\n\n const options: any = {\n pagination: { el: `.taro-swiper-${this._id} > .swiper-container > .swiper-pagination` },\n direction: vertical ? 'vertical' : 'horizontal',\n loop: circular,\n slidesPerView: displayMultipleItems,\n initialSlide: current,\n speed: duration,\n observer: true,\n observeParents: true,\n zoom: this.zoom,\n on: {\n slideTo () {\n that.current = this.realIndex\n },\n // slideChange 事件在 swiper.slideTo 改写 current 时不触发,因此用 slideChangeTransitionStart 事件代替\n slideChangeTransitionStart (_swiper: ISwiper) {\n if (that.circular) {\n if (_swiper.isBeginning || _swiper.isEnd) {\n // _swiper.slideToLoop(this.realIndex, 0, false) // 更新下标\n return\n }\n }\n that.onChange.emit({\n current: this.realIndex,\n source: ''\n })\n },\n transitionEnd () {\n that.onAnimationFinish.emit({\n current: this.realIndex,\n source: ''\n })\n },\n observerUpdate (_swiper: ISwiper, e) {\n const target = e.target\n const className = target && typeof target.className === 'string' ? target.className : ''\n if (className.includes('taro_page') && target.style.display !== 'none') {\n if (that.autoplay && target.contains(_swiper.$el[0])) {\n if (that.circular) {\n _swiper.slideToLoop(this.realIndex, 0) // 更新下标\n } else {\n _swiper.slideTo(this.realIndex)\n }\n }\n }\n }\n }\n }\n\n // 自动播放\n if (autoplay) {\n options.autoplay = {\n delay: interval,\n disableOnInteraction: false\n }\n }\n\n this.swiper = new SwiperJS(`.taro-swiper-${this._id} > .swiper-container`, options)\n this.swiperWrapper = this.el.querySelector(`.taro-swiper-${this._id} > .swiper-container > .swiper-wrapper`)\n }\n\n render () {\n const {\n vertical,\n indicatorDots,\n indicatorColor,\n indicatorActiveColor\n } = this\n\n const hostStyle: Record<string, string> = { overflow: 'hidden' }\n const style: Record<string, string> = { overflow: 'visible' }\n if (this.full) {\n hostStyle.height = '100%'\n style.height = '100%'\n }\n\n const [, previousMargin] = /^(\\d+)px/.exec(this.previousMargin) || []\n const [, nextMargin] = /^(\\d+)px/.exec(this.nextMargin) || []\n const pM = parseInt(previousMargin) || 0\n const nM = parseInt(nextMargin) || 0\n if (vertical) {\n style.marginTop = `${pM}px`\n style.marginBottom = `${nM}px`\n } else {\n style.marginRight = `${nM}px`\n style.marginLeft = `${pM}px`\n }\n\n return (\n <Host class={`taro-swiper-${this._id}`} style={hostStyle}>\n <div class='swiper-container' style={style}>\n <style type='text/css'>\n {`\n .taro-swiper-${this._id} > .swiper-container > .swiper-pagination > .swiper-pagination-bullet { background: ${indicatorColor} }\n .taro-swiper-${this._id} > .swiper-container > .swiper-pagination > .swiper-pagination-bullet-active { background: ${indicatorActiveColor} }\n `}\n </style>\n <div class='swiper-wrapper'>\n <slot />\n </div>\n <div class={classNames('swiper-pagination',\n {\n 'swiper-pagination-hidden': !indicatorDots,\n 'swiper-pagination-bullets': indicatorDots\n }\n )} />\n </div>\n </Host>\n )\n }\n}\n"]}
@@ -9882,11 +9882,9 @@ const Swiper = class {
9882
9882
  this.handleSwiperLoop = debounce(() => {
9883
9883
  if (this.swiper && this.circular) {
9884
9884
  // @ts-ignore
9885
- this.swiper.loopDestroy();
9886
- // @ts-ignore
9887
- this.swiper.loopCreate();
9885
+ this.swiper.loopFix();
9888
9886
  }
9889
- }, 500);
9887
+ }, 50);
9890
9888
  this.handleSwiperSize = debounce(() => {
9891
9889
  if (this.swiper && !this.circular) {
9892
9890
  this.swiper.updateSlides();
@@ -10043,7 +10041,7 @@ const Swiper = class {
10043
10041
  slideChangeTransitionStart(_swiper) {
10044
10042
  if (that.circular) {
10045
10043
  if (_swiper.isBeginning || _swiper.isEnd) {
10046
- _swiper.slideToLoop(this.realIndex, 0); // 更新下标
10044
+ // _swiper.slideToLoop(this.realIndex, 0, false) // 更新下标
10047
10045
  return;
10048
10046
  }
10049
10047
  }
@@ -10124,14 +10122,50 @@ const Swiper = class {
10124
10122
  };
10125
10123
  Swiper.style = indexCss;
10126
10124
 
10125
+ function isEqualTag(a, b) {
10126
+ return typeof a.tagName === 'undefined' ? a.nodeType === b.nodeType : a.tagName === b.tagName;
10127
+ }
10128
+ function parseChildNodes(items, targets) {
10129
+ const list = Array.from(targets.values());
10130
+ for (let i = 0, j = 0; i < list.length; i++, j++) {
10131
+ const target = list[i];
10132
+ let item = items.item(j);
10133
+ while (item && !isEqualTag(item, target)) {
10134
+ item.remove();
10135
+ j++;
10136
+ item = items.item(j);
10137
+ }
10138
+ if (item && !item.isEqualNode(target)) {
10139
+ parseChildNodes(item.childNodes, target.childNodes);
10140
+ }
10141
+ while (i === list.length - 1 && j < items.length) {
10142
+ j++;
10143
+ item = items.item(j);
10144
+ item === null || item === void 0 ? void 0 : item.remove();
10145
+ }
10146
+ }
10147
+ }
10127
10148
  const SwiperItem = class {
10128
10149
  constructor(hostRef) {
10129
10150
  registerInstance(this, hostRef);
10130
10151
  this.itemId = undefined;
10131
10152
  }
10153
+ componentDidRender() {
10154
+ var _a, _b, _c;
10155
+ const el = this.el;
10156
+ if (el.classList.contains('swiper-slide-duplicate')) {
10157
+ const list = Array
10158
+ .from(((_b = (_a = el.parentElement) === null || _a === void 0 ? void 0 : _a.childNodes) === null || _b === void 0 ? void 0 : _b.values()) || [])
10159
+ .filter((e) => e.tagName === 'TARO-SWIPER-ITEM-CORE');
10160
+ if (list.length > 0) {
10161
+ parseChildNodes(el.childNodes, (_c = list[list.indexOf(el) === 0 ? list.length - 2 : 1]) === null || _c === void 0 ? void 0 : _c.childNodes);
10162
+ }
10163
+ }
10164
+ }
10132
10165
  render() {
10133
10166
  return (h(Host, { class: 'swiper-slide', "item-id": this.itemId }));
10134
10167
  }
10168
+ get el() { return getElement(this); }
10135
10169
  };
10136
10170
 
10137
10171
  export { Swiper as taro_swiper_core, SwiperItem as taro_swiper_item_core };