@tarojs/components 3.5.9 → 3.5.11

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 (48) hide show
  1. package/dist/cjs/taro-swiper-core_2.cjs.entry.js +24 -21
  2. package/dist/cjs/taro-view-core.cjs.entry.js +6 -2
  3. package/dist/collection/components/swiper/swiper.js +24 -22
  4. package/dist/collection/components/view/view.js +6 -3
  5. package/dist/esm/taro-swiper-core_2.entry.js +24 -21
  6. package/dist/esm/taro-view-core.entry.js +6 -2
  7. package/dist/esm-es5/taro-swiper-core_2.entry.js +1 -1
  8. package/dist/esm-es5/taro-view-core.entry.js +1 -1
  9. package/dist/taro-components/{p-a5496bf5.system.entry.js → p-0152fd40.system.entry.js} +1 -1
  10. package/dist/taro-components/p-0380841f.system.js +1 -1
  11. package/dist/taro-components/{p-8475421b.system.entry.js → p-7431b2e1.system.entry.js} +1 -1
  12. package/dist/taro-components/p-8b1dfd32.entry.js +1 -0
  13. package/dist/taro-components/{p-34178401.entry.js → p-c3bcd3b7.entry.js} +1 -1
  14. package/dist/taro-components/taro-components.esm.js +1 -1
  15. package/package.json +3 -3
  16. package/types/Button.d.ts +1 -1
  17. package/types/Camera.d.ts +1 -1
  18. package/types/Checkbox.d.ts +1 -1
  19. package/types/CheckboxGroup.d.ts +1 -1
  20. package/types/CoverImage.d.ts +1 -1
  21. package/types/CustomWrapper.d.ts +1 -0
  22. package/types/Form.d.ts +1 -1
  23. package/types/Icon.d.ts +1 -1
  24. package/types/Image.d.ts +1 -1
  25. package/types/Input.d.ts +15 -1
  26. package/types/Label.d.ts +1 -1
  27. package/types/NativeSlot.d.ts +1 -0
  28. package/types/NavigationBar.d.ts +2 -1
  29. package/types/Navigator.d.ts +1 -1
  30. package/types/Picker.d.ts +1 -1
  31. package/types/PickerView.d.ts +1 -1
  32. package/types/PickerViewColumn.d.ts +1 -1
  33. package/types/Progress.d.ts +1 -1
  34. package/types/Radio.d.ts +1 -1
  35. package/types/RadioGroup.d.ts +1 -1
  36. package/types/RichText.d.ts +1 -1
  37. package/types/ScrollView.d.ts +1 -1
  38. package/types/ShareElement.d.ts +3 -3
  39. package/types/Slider.d.ts +1 -1
  40. package/types/Slot.d.ts +2 -1
  41. package/types/Swiper.d.ts +1 -1
  42. package/types/SwiperItem.d.ts +1 -1
  43. package/types/Switch.d.ts +1 -1
  44. package/types/Textarea.d.ts +1 -1
  45. package/types/Video.d.ts +1 -1
  46. package/types/View.d.ts +1 -1
  47. package/types/WebView.d.ts +1 -1
  48. package/dist/taro-components/p-5a2305e7.entry.js +0 -1
@@ -9922,12 +9922,12 @@ let Swiper = class {
9922
9922
  */
9923
9923
  this.zoom = false;
9924
9924
  this.handleSwiperLoopListen = () => {
9925
- var _a, _b;
9925
+ var _a, _b, _c;
9926
9926
  ((_a = this.observerFirst) === null || _a === void 0 ? void 0 : _a.disconnect) && this.observerFirst.disconnect();
9927
9927
  ((_b = this.observerLast) === null || _b === void 0 ? void 0 : _b.disconnect) && this.observerLast.disconnect();
9928
9928
  this.observerFirst = new MutationObserver(this.handleSwiperLoop);
9929
9929
  this.observerLast = new MutationObserver(this.handleSwiperLoop);
9930
- const wrapper = this.swiper.$wrapperEl[0];
9930
+ const wrapper = (_c = this.swiper.$wrapperEl) === null || _c === void 0 ? void 0 : _c[0];
9931
9931
  const list = wrapper.querySelectorAll('taro-swiper-item-core:not(.swiper-slide-duplicate)');
9932
9932
  if (list.length >= 1) {
9933
9933
  this.observerFirst.observe(list[0], {
@@ -9943,11 +9943,9 @@ let Swiper = class {
9943
9943
  this.handleSwiperLoop = index$2.debounce(() => {
9944
9944
  if (this.swiper && this.circular) {
9945
9945
  // @ts-ignore
9946
- this.swiper.loopDestroy();
9947
- // @ts-ignore
9948
- this.swiper.loopCreate();
9946
+ this.swiper.loopFix();
9949
9947
  }
9950
- }, 500);
9948
+ }, 50);
9951
9949
  this.handleSwiperSize = index$2.debounce(() => {
9952
9950
  if (this.swiper && !this.circular) {
9953
9951
  this.swiper.updateSlides();
@@ -9972,19 +9970,22 @@ let Swiper = class {
9972
9970
  watchAutoplay(newVal) {
9973
9971
  if (!this.isWillLoadCalled || !this.swiper)
9974
9972
  return;
9975
- if (this.swiper.autoplay.running === newVal)
9976
- return;
9977
- if (newVal) {
9978
- if (this.swiper.params && typeof this.swiper.params.autoplay === 'object') {
9979
- if (this.swiper.params.autoplay.disableOnInteraction === true) {
9980
- this.swiper.params.autoplay.disableOnInteraction = false;
9973
+ const swiperAutoplay = this.swiper.autoplay;
9974
+ if (swiperAutoplay) {
9975
+ if (swiperAutoplay.running === newVal)
9976
+ return;
9977
+ if (newVal) {
9978
+ if (this.swiper.params && typeof this.swiper.params.autoplay === 'object') {
9979
+ if (this.swiper.params.autoplay.disableOnInteraction === true) {
9980
+ this.swiper.params.autoplay.disableOnInteraction = false;
9981
+ }
9982
+ this.swiper.params.autoplay.delay = this.interval;
9981
9983
  }
9982
- this.swiper.params.autoplay.delay = this.interval;
9984
+ swiperAutoplay.start();
9985
+ }
9986
+ else {
9987
+ swiperAutoplay.stop();
9983
9988
  }
9984
- this.swiper.autoplay.start();
9985
- }
9986
- else {
9987
- this.swiper.autoplay.stop();
9988
9989
  }
9989
9990
  }
9990
9991
  watchDuration(newVal) {
@@ -10029,20 +10030,22 @@ let Swiper = class {
10029
10030
  this.isWillLoadCalled = true;
10030
10031
  }
10031
10032
  componentDidLoad() {
10033
+ var _a;
10032
10034
  this.handleInit();
10033
10035
  if (!this.swiper || !this.circular)
10034
10036
  return;
10035
- const wrapper = this.swiper.$wrapperEl[0];
10037
+ const wrapper = (_a = this.swiper.$wrapperEl) === null || _a === void 0 ? void 0 : _a[0];
10036
10038
  this.observer = new MutationObserver(this.handleSwiperLoopListen);
10037
10039
  this.observer.observe(wrapper, {
10038
10040
  childList: true
10039
10041
  });
10040
10042
  }
10041
10043
  componentWillUpdate() {
10044
+ var _a, _b;
10042
10045
  if (!this.swiper)
10043
10046
  return;
10044
- if (this.autoplay && !this.swiper.autoplay.running) {
10045
- this.swiper.autoplay.start();
10047
+ if (this.autoplay && !((_a = this.swiper.autoplay) === null || _a === void 0 ? void 0 : _a.running)) {
10048
+ (_b = this.swiper.autoplay) === null || _b === void 0 ? void 0 : _b.start();
10046
10049
  }
10047
10050
  this.swiper.update(); // 更新子元素
10048
10051
  }
@@ -10079,7 +10082,7 @@ let Swiper = class {
10079
10082
  slideChangeTransitionStart(_swiper) {
10080
10083
  if (that.circular) {
10081
10084
  if (_swiper.isBeginning || _swiper.isEnd) {
10082
- _swiper.slideToLoop(this.realIndex, 0); // 更新下标
10085
+ // _swiper.slideToLoop(this.realIndex, 0, false) // 更新下标
10083
10086
  return;
10084
10087
  }
10085
10088
  }
@@ -51,8 +51,12 @@ let View = class {
51
51
  componentDidRender() {
52
52
  const el = this.el;
53
53
  el.childNodes.forEach(item => {
54
- if (item.nodeType === document.COMMENT_NODE && item["s-cn"])
55
- item["s-cn"] = false;
54
+ // Note: ['s-cn'] Content Reference Node
55
+ if (item.nodeType === document.COMMENT_NODE && item['s-cn'])
56
+ item['s-cn'] = false;
57
+ // Note: ['s-sr'] Is a slot reference node (渲染完成后禁用 slotRelocation 特性, 避免 Stencil 组件相互调用时内置排序与第三方 UI 框架冲突导致组件顺序混乱)
58
+ if (item.nodeType !== document.COMMENT_NODE && item['s-sr'])
59
+ item['s-sr'] = false;
56
60
  });
57
61
  }
58
62
  render() {
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
1
  import { Component, h, Prop, Event, Watch, Host, Element, State } from '@stencil/core';
3
2
  import classNames from 'classnames';
4
3
  import SwiperJS from 'swiper/swiper-bundle.esm.js';
@@ -65,12 +64,12 @@ export class Swiper {
65
64
  */
66
65
  this.zoom = false;
67
66
  this.handleSwiperLoopListen = () => {
68
- var _a, _b;
67
+ var _a, _b, _c;
69
68
  ((_a = this.observerFirst) === null || _a === void 0 ? void 0 : _a.disconnect) && this.observerFirst.disconnect();
70
69
  ((_b = this.observerLast) === null || _b === void 0 ? void 0 : _b.disconnect) && this.observerLast.disconnect();
71
70
  this.observerFirst = new MutationObserver(this.handleSwiperLoop);
72
71
  this.observerLast = new MutationObserver(this.handleSwiperLoop);
73
- const wrapper = this.swiper.$wrapperEl[0];
72
+ const wrapper = (_c = this.swiper.$wrapperEl) === null || _c === void 0 ? void 0 : _c[0];
74
73
  const list = wrapper.querySelectorAll('taro-swiper-item-core:not(.swiper-slide-duplicate)');
75
74
  if (list.length >= 1) {
76
75
  this.observerFirst.observe(list[0], {
@@ -86,11 +85,9 @@ export class Swiper {
86
85
  this.handleSwiperLoop = debounce(() => {
87
86
  if (this.swiper && this.circular) {
88
87
  // @ts-ignore
89
- this.swiper.loopDestroy();
90
- // @ts-ignore
91
- this.swiper.loopCreate();
88
+ this.swiper.loopFix();
92
89
  }
93
- }, 500);
90
+ }, 50);
94
91
  this.handleSwiperSize = debounce(() => {
95
92
  if (this.swiper && !this.circular) {
96
93
  this.swiper.updateSlides();
@@ -115,19 +112,22 @@ export class Swiper {
115
112
  watchAutoplay(newVal) {
116
113
  if (!this.isWillLoadCalled || !this.swiper)
117
114
  return;
118
- if (this.swiper.autoplay.running === newVal)
119
- return;
120
- if (newVal) {
121
- if (this.swiper.params && typeof this.swiper.params.autoplay === 'object') {
122
- if (this.swiper.params.autoplay.disableOnInteraction === true) {
123
- this.swiper.params.autoplay.disableOnInteraction = false;
115
+ const swiperAutoplay = this.swiper.autoplay;
116
+ if (swiperAutoplay) {
117
+ if (swiperAutoplay.running === newVal)
118
+ return;
119
+ if (newVal) {
120
+ if (this.swiper.params && typeof this.swiper.params.autoplay === 'object') {
121
+ if (this.swiper.params.autoplay.disableOnInteraction === true) {
122
+ this.swiper.params.autoplay.disableOnInteraction = false;
123
+ }
124
+ this.swiper.params.autoplay.delay = this.interval;
124
125
  }
125
- this.swiper.params.autoplay.delay = this.interval;
126
+ swiperAutoplay.start();
127
+ }
128
+ else {
129
+ swiperAutoplay.stop();
126
130
  }
127
- this.swiper.autoplay.start();
128
- }
129
- else {
130
- this.swiper.autoplay.stop();
131
131
  }
132
132
  }
133
133
  watchDuration(newVal) {
@@ -172,20 +172,22 @@ export class Swiper {
172
172
  this.isWillLoadCalled = true;
173
173
  }
174
174
  componentDidLoad() {
175
+ var _a;
175
176
  this.handleInit();
176
177
  if (!this.swiper || !this.circular)
177
178
  return;
178
- const wrapper = this.swiper.$wrapperEl[0];
179
+ const wrapper = (_a = this.swiper.$wrapperEl) === null || _a === void 0 ? void 0 : _a[0];
179
180
  this.observer = new MutationObserver(this.handleSwiperLoopListen);
180
181
  this.observer.observe(wrapper, {
181
182
  childList: true
182
183
  });
183
184
  }
184
185
  componentWillUpdate() {
186
+ var _a, _b;
185
187
  if (!this.swiper)
186
188
  return;
187
- if (this.autoplay && !this.swiper.autoplay.running) {
188
- this.swiper.autoplay.start();
189
+ if (this.autoplay && !((_a = this.swiper.autoplay) === null || _a === void 0 ? void 0 : _a.running)) {
190
+ (_b = this.swiper.autoplay) === null || _b === void 0 ? void 0 : _b.start();
189
191
  }
190
192
  this.swiper.update(); // 更新子元素
191
193
  }
@@ -222,7 +224,7 @@ export class Swiper {
222
224
  slideChangeTransitionStart(_swiper) {
223
225
  if (that.circular) {
224
226
  if (_swiper.isBeginning || _swiper.isEnd) {
225
- _swiper.slideToLoop(this.realIndex, 0); // 更新下标
227
+ // _swiper.slideToLoop(this.realIndex, 0, false) // 更新下标
226
228
  return;
227
229
  }
228
230
  }
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
1
  import { Component, Prop, h, Host, Listen, State, Event, Element } from '@stencil/core';
3
2
  import classNames from 'classnames';
4
3
  export class View {
@@ -43,8 +42,12 @@ export class View {
43
42
  componentDidRender() {
44
43
  const el = this.el;
45
44
  el.childNodes.forEach(item => {
46
- if (item.nodeType === document.COMMENT_NODE && item["s-cn"])
47
- item["s-cn"] = false;
45
+ // Note: ['s-cn'] Content Reference Node
46
+ if (item.nodeType === document.COMMENT_NODE && item['s-cn'])
47
+ item['s-cn'] = false;
48
+ // Note: ['s-sr'] Is a slot reference node (渲染完成后禁用 slotRelocation 特性, 避免 Stencil 组件相互调用时内置排序与第三方 UI 框架冲突导致组件顺序混乱)
49
+ if (item.nodeType !== document.COMMENT_NODE && item['s-sr'])
50
+ item['s-sr'] = false;
48
51
  });
49
52
  }
50
53
  render() {
@@ -9918,12 +9918,12 @@ let Swiper = class {
9918
9918
  */
9919
9919
  this.zoom = false;
9920
9920
  this.handleSwiperLoopListen = () => {
9921
- var _a, _b;
9921
+ var _a, _b, _c;
9922
9922
  ((_a = this.observerFirst) === null || _a === void 0 ? void 0 : _a.disconnect) && this.observerFirst.disconnect();
9923
9923
  ((_b = this.observerLast) === null || _b === void 0 ? void 0 : _b.disconnect) && this.observerLast.disconnect();
9924
9924
  this.observerFirst = new MutationObserver(this.handleSwiperLoop);
9925
9925
  this.observerLast = new MutationObserver(this.handleSwiperLoop);
9926
- const wrapper = this.swiper.$wrapperEl[0];
9926
+ const wrapper = (_c = this.swiper.$wrapperEl) === null || _c === void 0 ? void 0 : _c[0];
9927
9927
  const list = wrapper.querySelectorAll('taro-swiper-item-core:not(.swiper-slide-duplicate)');
9928
9928
  if (list.length >= 1) {
9929
9929
  this.observerFirst.observe(list[0], {
@@ -9939,11 +9939,9 @@ let Swiper = class {
9939
9939
  this.handleSwiperLoop = debounce(() => {
9940
9940
  if (this.swiper && this.circular) {
9941
9941
  // @ts-ignore
9942
- this.swiper.loopDestroy();
9943
- // @ts-ignore
9944
- this.swiper.loopCreate();
9942
+ this.swiper.loopFix();
9945
9943
  }
9946
- }, 500);
9944
+ }, 50);
9947
9945
  this.handleSwiperSize = debounce(() => {
9948
9946
  if (this.swiper && !this.circular) {
9949
9947
  this.swiper.updateSlides();
@@ -9968,19 +9966,22 @@ let Swiper = class {
9968
9966
  watchAutoplay(newVal) {
9969
9967
  if (!this.isWillLoadCalled || !this.swiper)
9970
9968
  return;
9971
- if (this.swiper.autoplay.running === newVal)
9972
- return;
9973
- if (newVal) {
9974
- if (this.swiper.params && typeof this.swiper.params.autoplay === 'object') {
9975
- if (this.swiper.params.autoplay.disableOnInteraction === true) {
9976
- this.swiper.params.autoplay.disableOnInteraction = false;
9969
+ const swiperAutoplay = this.swiper.autoplay;
9970
+ if (swiperAutoplay) {
9971
+ if (swiperAutoplay.running === newVal)
9972
+ return;
9973
+ if (newVal) {
9974
+ if (this.swiper.params && typeof this.swiper.params.autoplay === 'object') {
9975
+ if (this.swiper.params.autoplay.disableOnInteraction === true) {
9976
+ this.swiper.params.autoplay.disableOnInteraction = false;
9977
+ }
9978
+ this.swiper.params.autoplay.delay = this.interval;
9977
9979
  }
9978
- this.swiper.params.autoplay.delay = this.interval;
9980
+ swiperAutoplay.start();
9981
+ }
9982
+ else {
9983
+ swiperAutoplay.stop();
9979
9984
  }
9980
- this.swiper.autoplay.start();
9981
- }
9982
- else {
9983
- this.swiper.autoplay.stop();
9984
9985
  }
9985
9986
  }
9986
9987
  watchDuration(newVal) {
@@ -10025,20 +10026,22 @@ let Swiper = class {
10025
10026
  this.isWillLoadCalled = true;
10026
10027
  }
10027
10028
  componentDidLoad() {
10029
+ var _a;
10028
10030
  this.handleInit();
10029
10031
  if (!this.swiper || !this.circular)
10030
10032
  return;
10031
- const wrapper = this.swiper.$wrapperEl[0];
10033
+ const wrapper = (_a = this.swiper.$wrapperEl) === null || _a === void 0 ? void 0 : _a[0];
10032
10034
  this.observer = new MutationObserver(this.handleSwiperLoopListen);
10033
10035
  this.observer.observe(wrapper, {
10034
10036
  childList: true
10035
10037
  });
10036
10038
  }
10037
10039
  componentWillUpdate() {
10040
+ var _a, _b;
10038
10041
  if (!this.swiper)
10039
10042
  return;
10040
- if (this.autoplay && !this.swiper.autoplay.running) {
10041
- this.swiper.autoplay.start();
10043
+ if (this.autoplay && !((_a = this.swiper.autoplay) === null || _a === void 0 ? void 0 : _a.running)) {
10044
+ (_b = this.swiper.autoplay) === null || _b === void 0 ? void 0 : _b.start();
10042
10045
  }
10043
10046
  this.swiper.update(); // 更新子元素
10044
10047
  }
@@ -10075,7 +10078,7 @@ let Swiper = class {
10075
10078
  slideChangeTransitionStart(_swiper) {
10076
10079
  if (that.circular) {
10077
10080
  if (_swiper.isBeginning || _swiper.isEnd) {
10078
- _swiper.slideToLoop(this.realIndex, 0); // 更新下标
10081
+ // _swiper.slideToLoop(this.realIndex, 0, false) // 更新下标
10079
10082
  return;
10080
10083
  }
10081
10084
  }
@@ -47,8 +47,12 @@ let View = class {
47
47
  componentDidRender() {
48
48
  const el = this.el;
49
49
  el.childNodes.forEach(item => {
50
- if (item.nodeType === document.COMMENT_NODE && item["s-cn"])
51
- item["s-cn"] = false;
50
+ // Note: ['s-cn'] Content Reference Node
51
+ if (item.nodeType === document.COMMENT_NODE && item['s-cn'])
52
+ item['s-cn'] = false;
53
+ // Note: ['s-sr'] Is a slot reference node (渲染完成后禁用 slotRelocation 特性, 避免 Stencil 组件相互调用时内置排序与第三方 UI 框架冲突导致组件顺序混乱)
54
+ if (item.nodeType !== document.COMMENT_NODE && item['s-sr'])
55
+ item['s-sr'] = false;
52
56
  });
53
57
  }
54
58
  render() {