@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 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 current(): number;
6
- set current(newval: number);
5
+ get currentIndex(): number;
6
+ set currentIndex(newval: number);
7
7
  get snapDistance(): number;
8
8
  get isVertical(): boolean;
9
9
  get circularPlay(): boolean;
@@ -136,12 +136,12 @@ let XSwiper = (() => {
136
136
  minOffsetToMid,
137
137
  };
138
138
  }
139
- get current() {
139
+ get currentIndex() {
140
140
  return this.#getNeatestElementIndexAndDistanceToMid().current;
141
141
  }
142
- set current(newval) {
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.current === newval) {
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.current;
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.current = 0;
194
+ this.currentIndex = 0;
195
195
  }
196
196
  }
197
197
  else {
198
- this.current += 1;
198
+ this.currentIndex += 1;
199
199
  }
200
200
  }
201
201
  scrollToPrevious() {
202
- const current = this.current;
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.current = count - 1;
207
+ this.currentIndex = count - 1;
208
208
  }
209
209
  }
210
210
  else {
211
- this.current == count - 1;
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.current = newval;
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 () {
@@ -21,7 +21,7 @@ let XSwiperCircular = (() => {
21
21
  if (newVal !== null) {
22
22
  this.#changeEventHandler({
23
23
  detail: {
24
- current: this.#dom.current,
24
+ current: this.#dom.currentIndex,
25
25
  isDragged: false,
26
26
  __isFirstLayout: true,
27
27
  },
@@ -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.current;
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.current]?.style.setProperty('background-color', 'var(--indicator-active-color)', 'important');
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-elements",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -74,7 +74,7 @@ x-swiper-item {
74
74
  flex-basis: var(--lynx-linear-weight-basis) !important;
75
75
  }
76
76
 
77
- x-swiper-item:nth-child(n+5) {
77
+ x-swiper-item:nth-child(n+20) {
78
78
  contain: strict;
79
79
  content-visibility: auto;
80
80
  }