@tarojs/components 3.5.11 → 3.5.12

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.
@@ -10163,13 +10163,49 @@ let Swiper = class {
10163
10163
  };
10164
10164
  Swiper.style = indexCss;
10165
10165
 
10166
+ function isEqualTag(a, b) {
10167
+ return typeof a.tagName === 'undefined' ? a.nodeType === b.nodeType : a.tagName === b.tagName;
10168
+ }
10169
+ function parseChildNodes(items, targets) {
10170
+ const list = Array.from(targets.values());
10171
+ for (let i = 0, j = 0; i < list.length; i++, j++) {
10172
+ const target = list[i];
10173
+ let item = items.item(j);
10174
+ while (item && !isEqualTag(item, target)) {
10175
+ item.remove();
10176
+ j++;
10177
+ item = items.item(j);
10178
+ }
10179
+ if (item && !item.isEqualNode(target)) {
10180
+ parseChildNodes(item.childNodes, target.childNodes);
10181
+ }
10182
+ while (i === list.length - 1 && j < items.length) {
10183
+ j++;
10184
+ item = items.item(j);
10185
+ item === null || item === void 0 ? void 0 : item.remove();
10186
+ }
10187
+ }
10188
+ }
10166
10189
  let SwiperItem = class {
10167
10190
  constructor(hostRef) {
10168
10191
  index$1.registerInstance(this, hostRef);
10169
10192
  }
10193
+ componentDidRender() {
10194
+ var _a, _b, _c;
10195
+ const el = this.el;
10196
+ if (el.classList.contains('swiper-slide-duplicate')) {
10197
+ const list = Array
10198
+ .from(((_b = (_a = el.parentElement) === null || _a === void 0 ? void 0 : _a.childNodes) === null || _b === void 0 ? void 0 : _b.values()) || [])
10199
+ .filter((e) => e.tagName === 'TARO-SWIPER-ITEM-CORE');
10200
+ if (list.length > 0) {
10201
+ parseChildNodes(el.childNodes, (_c = list[list.indexOf(el) === 0 ? list.length - 2 : 1]) === null || _c === void 0 ? void 0 : _c.childNodes);
10202
+ }
10203
+ }
10204
+ }
10170
10205
  render() {
10171
10206
  return (index$1.h(index$1.Host, { class: 'swiper-slide', "item-id": this.itemId }));
10172
10207
  }
10208
+ get el() { return index$1.getElement(this); }
10173
10209
  };
10174
10210
 
10175
10211
  exports.taro_swiper_core = Swiper;
@@ -1,6 +1,40 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
- import { Component, h, Prop, Host } from '@stencil/core';
1
+ import { Component, Element, Host, h, Prop } 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
+ }
3
25
  export class SwiperItem {
26
+ componentDidRender() {
27
+ var _a, _b, _c;
28
+ const el = this.el;
29
+ if (el.classList.contains('swiper-slide-duplicate')) {
30
+ const list = Array
31
+ .from(((_b = (_a = el.parentElement) === null || _a === void 0 ? void 0 : _a.childNodes) === null || _b === void 0 ? void 0 : _b.values()) || [])
32
+ .filter((e) => e.tagName === 'TARO-SWIPER-ITEM-CORE');
33
+ if (list.length > 0) {
34
+ parseChildNodes(el.childNodes, (_c = list[list.indexOf(el) === 0 ? list.length - 2 : 1]) === null || _c === void 0 ? void 0 : _c.childNodes);
35
+ }
36
+ }
37
+ }
4
38
  render() {
5
39
  return (h(Host, { class: 'swiper-slide', "item-id": this.itemId }));
6
40
  }
@@ -24,4 +58,5 @@ export class SwiperItem {
24
58
  "reflect": false
25
59
  }
26
60
  }; }
61
+ static get elementRef() { return "el"; }
27
62
  }
@@ -10159,13 +10159,49 @@ let Swiper = class {
10159
10159
  };
10160
10160
  Swiper.style = indexCss;
10161
10161
 
10162
+ function isEqualTag(a, b) {
10163
+ return typeof a.tagName === 'undefined' ? a.nodeType === b.nodeType : a.tagName === b.tagName;
10164
+ }
10165
+ function parseChildNodes(items, targets) {
10166
+ const list = Array.from(targets.values());
10167
+ for (let i = 0, j = 0; i < list.length; i++, j++) {
10168
+ const target = list[i];
10169
+ let item = items.item(j);
10170
+ while (item && !isEqualTag(item, target)) {
10171
+ item.remove();
10172
+ j++;
10173
+ item = items.item(j);
10174
+ }
10175
+ if (item && !item.isEqualNode(target)) {
10176
+ parseChildNodes(item.childNodes, target.childNodes);
10177
+ }
10178
+ while (i === list.length - 1 && j < items.length) {
10179
+ j++;
10180
+ item = items.item(j);
10181
+ item === null || item === void 0 ? void 0 : item.remove();
10182
+ }
10183
+ }
10184
+ }
10162
10185
  let SwiperItem = class {
10163
10186
  constructor(hostRef) {
10164
10187
  registerInstance(this, hostRef);
10165
10188
  }
10189
+ componentDidRender() {
10190
+ var _a, _b, _c;
10191
+ const el = this.el;
10192
+ if (el.classList.contains('swiper-slide-duplicate')) {
10193
+ const list = Array
10194
+ .from(((_b = (_a = el.parentElement) === null || _a === void 0 ? void 0 : _a.childNodes) === null || _b === void 0 ? void 0 : _b.values()) || [])
10195
+ .filter((e) => e.tagName === 'TARO-SWIPER-ITEM-CORE');
10196
+ if (list.length > 0) {
10197
+ parseChildNodes(el.childNodes, (_c = list[list.indexOf(el) === 0 ? list.length - 2 : 1]) === null || _c === void 0 ? void 0 : _c.childNodes);
10198
+ }
10199
+ }
10200
+ }
10166
10201
  render() {
10167
10202
  return (h(Host, { class: 'swiper-slide', "item-id": this.itemId }));
10168
10203
  }
10204
+ get el() { return getElement(this); }
10169
10205
  };
10170
10206
 
10171
10207
  export { Swiper as taro_swiper_core, SwiperItem as taro_swiper_item_core };