@lynx-js/web-elements 0.12.7 → 0.12.9

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,29 @@
1
1
  # @lynx-js/web-elements
2
2
 
3
+ ## 0.12.9
4
+
5
+ ### Patch Changes
6
+
7
+ - Clamp the `setFoldExpanded` offset of `<x-foldview-ng>` to the scrollable length. ([#3290](https://github.com/lynx-family/lynx-stack/pull/3290))
8
+
9
+ `setFoldExpanded` called the native `scrollTo`, bypassing the clamping done by the
10
+ `scrollTop` setter. A page collapsing its header with a deliberately large offset
11
+ (e.g. `offset: '99999px'`) scrolled past the end, which does not happen on native.
12
+ - Give `<x-foldview-header-ng>` a `width: 100%`. ([#3290](https://github.com/lynx-family/lynx-stack/pull/3290))
13
+
14
+ The element is laid out with `position: absolute` but had no width, so it shrank to
15
+ fit its content instead of filling the foldview.
16
+
17
+ ## 0.12.8
18
+
19
+ ### Patch Changes
20
+
21
+ - Keep XList scroll offsets and automatic scrolling aligned with its configured orientation. ([#3357](https://github.com/lynx-family/lynx-stack/pull/3357))
22
+
23
+ - Updated dependency `dompurify` to `^3.4.13`. ([#3417](https://github.com/lynx-family/lynx-stack/pull/3417))
24
+
25
+ - Updated dependency `markdown-it` to `^15.0.0`. ([#3423](https://github.com/lynx-family/lynx-stack/pull/3423))
26
+
3
27
  ## 0.12.7
4
28
 
5
29
  ### Patch Changes
@@ -70,8 +70,10 @@ let XFoldviewNg = (() => {
70
70
  setFoldExpanded(params) {
71
71
  const { offset, smooth = true } = params;
72
72
  const offsetValue = parseFloat(offset);
73
+ // `scrollTo` is the native method and does not go through the `scrollTop`
74
+ // setter above, so the offset has to be clamped here as well.
73
75
  this.scrollTo({
74
- top: offsetValue,
76
+ top: Math.min(Math.max(offsetValue, 0), this[scrollableLength]),
75
77
  behavior: smooth ? 'smooth' : 'instant',
76
78
  });
77
79
  }
@@ -42,7 +42,7 @@ let XList = (() => {
42
42
  this.#getListContainer().scrollTop = val;
43
43
  }
44
44
  get scrollLeft() {
45
- return this.#getListContainer().scrollTop;
45
+ return this.#getListContainer().scrollLeft;
46
46
  }
47
47
  set scrollLeft(val) {
48
48
  this.#getListContainer().scrollLeft = val;
@@ -60,7 +60,7 @@ let XList = (() => {
60
60
  return super.scrollTop;
61
61
  }
62
62
  get __scrollLeft() {
63
- return super.scrollTop;
63
+ return super.scrollLeft;
64
64
  }
65
65
  scrollToPosition(params) {
66
66
  let offset;
@@ -110,15 +110,15 @@ let XList = (() => {
110
110
  const scrollContainer = this.#getListContainer();
111
111
  const deltaTime = timestamp - this.#autoScrollOptions.lastTimestamp;
112
112
  const tickDistance = (deltaTime / 1000) * this.#autoScrollOptions.rate;
113
+ const isScrollVertical = (this.getAttribute('scroll-orientation')
114
+ || 'vertical') === 'vertical';
113
115
  scrollContainer.scrollBy({
114
- left: tickDistance,
115
- top: tickDistance,
116
+ left: isScrollVertical ? 0 : tickDistance,
117
+ top: isScrollVertical ? tickDistance : 0,
116
118
  // smooth might cause lag when scrolling.
117
119
  behavior: 'auto',
118
120
  });
119
121
  this.#autoScrollOptions.lastTimestamp = timestamp;
120
- const isScrollVertical = (this.getAttribute('scroll-orientation')
121
- || 'vertical') === 'vertical';
122
122
  const isContainerScrollable = isScrollVertical
123
123
  ? scrollContainer.scrollTop + scrollContainer.clientHeight
124
124
  >= scrollContainer.scrollHeight
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-elements",
3
- "version": "0.12.7",
3
+ "version": "0.12.9",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -134,12 +134,12 @@
134
134
  "**/*.css"
135
135
  ],
136
136
  "dependencies": {
137
- "dompurify": "^3.4.12",
138
- "markdown-it": "^14.3.0"
137
+ "dompurify": "^3.4.13",
138
+ "markdown-it": "^15.0.0"
139
139
  },
140
140
  "devDependencies": {
141
141
  "@playwright/test": "^1.61.1",
142
- "@rsbuild/core": "2.1.7",
142
+ "@rsbuild/core": "2.1.10",
143
143
  "@rsbuild/plugin-source-build": "1.0.6",
144
144
  "@types/markdown-it": "^14.1.2",
145
145
  "@types/node": "^24.13.3",
@@ -59,6 +59,8 @@ x-foldview-header-ng {
59
59
  order: 2;
60
60
  flex: 0 0 auto;
61
61
  position: absolute;
62
+ /* an out-of-flow box shrinks to fit its content without an explicit width */
63
+ width: 100%;
62
64
  }
63
65
 
64
66
  x-foldview-ng[header-over-slot] > x-foldview-slot-ng,
@@ -192,10 +192,6 @@ x-list::part(lower-threshold-observer) {
192
192
  flex-direction: column-reverse;
193
193
  }
194
194
 
195
- x-list[vertical-orientation="false"]::part(lower-threshold-observer) {
196
- flex-direction: row-reverse;
197
- }
198
-
199
195
  /* list-type single */
200
196
  x-list {
201
197
  display: flex;