@lynx-js/web-elements-canary 0.7.6 → 0.7.7-canary-20250623-490dedaa

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,14 @@
1
1
  # @lynx-js/web-elements
2
2
 
3
+ ## 0.7.7-canary-20250623093537-490dedaa49281bd0c34abe0a7eb1b1af44c92fd8
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: the param `index` of list scrollToPosition function should be `position`. ([#1135](https://github.com/lynx-family/lynx-stack/pull/1135))
8
+
9
+ - Updated dependencies []:
10
+ - @lynx-js/web-elements-template@0.7.7-canary-20250623093537-490dedaa49281bd0c34abe0a7eb1b1af44c92fd8
11
+
3
12
  ## 0.7.6
4
13
 
5
14
  ### Patch Changes
@@ -475,8 +484,8 @@
475
484
  For compating usage, `@lynx-js/web-elements-compat/LinearContainer` is provided.
476
485
 
477
486
  ```javascript
478
- import '@lynx-js/web-elements-compat/LinearContainer';
479
- import '@lynx-js/web-elements/all';
487
+ import "@lynx-js/web-elements-compat/LinearContainer";
488
+ import "@lynx-js/web-elements/all";
480
489
  ```
481
490
 
482
491
  - f8d1d98: break: rename the `blur` and `focus` event to `lynxblur` and `lynxfocus` for x-input element
@@ -498,11 +507,11 @@
498
507
  There is also a simple way to use this feature
499
508
 
500
509
  ```javascript
501
- import { LynxCard } from '@lynx-js/web-core';
502
- import { loadElement } from '@lynx-js/web-elements/lazy';
503
- import '@lynx-js/web-elements/index.css';
504
- import '@lynx-js/web-core/index.css';
505
- import './index.css';
510
+ import { LynxCard } from "@lynx-js/web-core";
511
+ import { loadElement } from "@lynx-js/web-elements/lazy";
512
+ import "@lynx-js/web-elements/index.css";
513
+ import "@lynx-js/web-core/index.css";
514
+ import "./index.css";
506
515
 
507
516
  const lynxcard = new LynxCard({
508
517
  ...beforeConfigs,
@@ -8,7 +8,7 @@ export declare class XList extends HTMLElement {
8
8
  get __scrollTop(): number;
9
9
  get __scrollLeft(): number;
10
10
  scrollToPosition(params: {
11
- index: number;
11
+ position: number;
12
12
  smooth?: boolean;
13
13
  /**
14
14
  * @description The offset of the content
@@ -61,13 +61,13 @@ let XList = (() => {
61
61
  else if (typeof params.offset === 'number') {
62
62
  offset = { left: params.offset, top: params.offset };
63
63
  }
64
- if (typeof params.index === 'number') {
65
- if (params.index === 0) {
64
+ if (typeof params.position === 'number') {
65
+ if (params.position === 0) {
66
66
  this.#getListContainer().scrollTop = 0;
67
67
  this.#getListContainer().scrollLeft = 0;
68
68
  }
69
- else if (params.index > 0 && params.index < this.childElementCount) {
70
- const targetKid = this.children.item(params.index);
69
+ else if (params.position > 0 && params.position < this.childElementCount) {
70
+ const targetKid = this.children.item(params.position);
71
71
  if (targetKid instanceof HTMLElement) {
72
72
  if (offset) {
73
73
  offset = {
@@ -37,7 +37,7 @@ let XListAttributes = (() => {
37
37
  connectedCallback() {
38
38
  const initialScrollIndex = this.#dom.getAttribute('initial-scroll-index');
39
39
  if (initialScrollIndex !== null) {
40
- const index = parseFloat(initialScrollIndex);
40
+ const position = parseFloat(initialScrollIndex);
41
41
  const scrollToInitialIndex = () => {
42
42
  if (this.#dom.clientHeight === 0) {
43
43
  // In Safari, there is the potential race condition between the browser's layout and clientWidth calculate.
@@ -45,7 +45,7 @@ let XListAttributes = (() => {
45
45
  requestAnimationFrame(scrollToInitialIndex);
46
46
  }
47
47
  else {
48
- this.#dom.scrollToPosition({ index });
48
+ this.#dom.scrollToPosition({ position });
49
49
  }
50
50
  };
51
51
  // The reason for using microtasks is that the width and height of the child element may not be rendered at this time, so it will not be able to scroll.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-elements-canary",
3
- "version": "0.7.6",
3
+ "version": "0.7.7-canary-20250623-490dedaa",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -101,7 +101,7 @@
101
101
  ],
102
102
  "dependencies": {
103
103
  "@lynx-js/web-elements-reactive": "npm:@lynx-js/web-elements-reactive-canary@0.2.2",
104
- "@lynx-js/web-elements-template": "npm:@lynx-js/web-elements-template-canary@0.7.6"
104
+ "@lynx-js/web-elements-template": "npm:@lynx-js/web-elements-template-canary@0.7.7-canary-20250623-490dedaa"
105
105
  },
106
106
  "devDependencies": {
107
107
  "tslib": "^2.8.1"