@lynx-js/web-elements 0.7.0 → 0.7.1
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.
- package/CHANGELOG.md +8 -0
- package/dist/XSwiper/XSwiper.d.ts +2 -2
- package/dist/XSwiper/XSwiper.js +9 -9
- package/dist/XSwiper/XSwiperAutoScroll.js +1 -1
- package/dist/XSwiper/XSwiperCircular.js +1 -1
- package/dist/XSwiper/XSwiperEvents.js +1 -1
- package/dist/XSwiper/XSwiperIndicator.js +1 -1
- package/package.json +1 -1
- package/src/XSwiper/x-swiper.css +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @lynx-js/web-elements
|
|
2
2
|
|
|
3
|
+
## 0.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix(web): x-swiper-item threshold updated to 20 ([#639](https://github.com/lynx-family/lynx-stack/pull/639))
|
|
8
|
+
|
|
9
|
+
- fix: In React19, setter and getter functions are treated as properties, making it impossible to retrieve the current value via attributes. ([#639](https://github.com/lynx-family/lynx-stack/pull/639))
|
|
10
|
+
|
|
3
11
|
## 0.7.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -2,8 +2,8 @@ import { scrollContainerDom } from '../common/constants.js';
|
|
|
2
2
|
export declare class XSwiper extends HTMLElement {
|
|
3
3
|
#private;
|
|
4
4
|
static notToFilterFalseAttributes: Set<string>;
|
|
5
|
-
get
|
|
6
|
-
set
|
|
5
|
+
get currentIndex(): number;
|
|
6
|
+
set currentIndex(newval: number);
|
|
7
7
|
get snapDistance(): number;
|
|
8
8
|
get isVertical(): boolean;
|
|
9
9
|
get circularPlay(): boolean;
|
package/dist/XSwiper/XSwiper.js
CHANGED
|
@@ -136,12 +136,12 @@ let XSwiper = (() => {
|
|
|
136
136
|
minOffsetToMid,
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
get
|
|
139
|
+
get currentIndex() {
|
|
140
140
|
return this.#getNeatestElementIndexAndDistanceToMid().current;
|
|
141
141
|
}
|
|
142
|
-
set
|
|
142
|
+
set currentIndex(newval) {
|
|
143
143
|
// When current is specified and current is updated in bindchange, there is no need to respond to the update of current
|
|
144
|
-
if (this.
|
|
144
|
+
if (this.currentIndex === newval) {
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
147
|
const smooth = this.getAttribute('smooth-scroll') === null; // smooth-scroll default true, it is set to be false
|
|
@@ -186,29 +186,29 @@ let XSwiper = (() => {
|
|
|
186
186
|
return this.getAttribute('circular') !== null;
|
|
187
187
|
}
|
|
188
188
|
scrollToNext() {
|
|
189
|
-
const current = this.
|
|
189
|
+
const current = this.currentIndex;
|
|
190
190
|
const count = this.childElementCount;
|
|
191
191
|
if (current === count - 1) {
|
|
192
192
|
const circularPlay = this.circularPlay;
|
|
193
193
|
if (circularPlay) {
|
|
194
|
-
this.
|
|
194
|
+
this.currentIndex = 0;
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
else {
|
|
198
|
-
this.
|
|
198
|
+
this.currentIndex += 1;
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
scrollToPrevious() {
|
|
202
|
-
const current = this.
|
|
202
|
+
const current = this.currentIndex;
|
|
203
203
|
const count = this.childElementCount;
|
|
204
204
|
if (current === 0) {
|
|
205
205
|
const circularPlay = this.circularPlay;
|
|
206
206
|
if (circularPlay) {
|
|
207
|
-
this.
|
|
207
|
+
this.currentIndex = count - 1;
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
else {
|
|
211
|
-
this.
|
|
211
|
+
this.currentIndex = count - 1;
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
connectedCallback() {
|
|
@@ -19,7 +19,7 @@ let XSwiperAutoScroll = (() => {
|
|
|
19
19
|
__esDecorate(this, _private_handleCurrentChange_descriptor = { value: __setFunctionName(function (newVal) {
|
|
20
20
|
const newval = Number(newVal);
|
|
21
21
|
if (!Number.isNaN(newval)) {
|
|
22
|
-
this.#dom.
|
|
22
|
+
this.#dom.currentIndex = newval;
|
|
23
23
|
}
|
|
24
24
|
}, "#handleCurrentChange") }, _private_handleCurrentChange_decorators, { kind: "method", name: "#handleCurrentChange", static: false, private: true, access: { has: obj => #handleCurrentChange in obj, get: obj => obj.#handleCurrentChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
25
25
|
__esDecorate(this, _private_handleAutoplay_descriptor = { value: __setFunctionName(function () {
|
|
@@ -77,7 +77,7 @@ let XSwipeEvents = (() => {
|
|
|
77
77
|
> pageLength / 4
|
|
78
78
|
|| currentScrollDistance < 10
|
|
79
79
|
|| Math.abs(currentScrollDistance - totalScrollDistance) <= pageLength) {
|
|
80
|
-
const current = this.#dom.
|
|
80
|
+
const current = this.#dom.currentIndex;
|
|
81
81
|
if (current !== this.#current) {
|
|
82
82
|
this.#dom.dispatchEvent(new CustomEvent('change', {
|
|
83
83
|
...commonComponentEventSetting,
|
|
@@ -103,7 +103,7 @@ let XSwiperIndicator = (() => {
|
|
|
103
103
|
}
|
|
104
104
|
}).bind(this));
|
|
105
105
|
boostedQueueMicrotask(() => {
|
|
106
|
-
this.#getIndicatorContainer().children[this.#dom.
|
|
106
|
+
this.#getIndicatorContainer().children[this.#dom.currentIndex]?.style.setProperty('background-color', 'var(--indicator-active-color)', 'important');
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
}
|
package/package.json
CHANGED