@lynx-js/web-elements-canary 0.12.6 → 0.12.7-canary-20260720-5a831708

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,11 @@
1
1
  # @lynx-js/web-elements
2
2
 
3
+ ## 0.12.7-canary-20260720090000-5a8317089341c4a5d594f92286980e7f17b9798c
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix x-text custom truncation when inline x-view elements are included in the measured text. ([#2998](https://github.com/lynx-family/lynx-stack/pull/2998))
8
+
3
9
  ## 0.12.6
4
10
 
5
11
  ### Patch Changes
@@ -49,7 +55,7 @@
49
55
  correctly instead of being forced through string-only attribute updates.
50
56
 
51
57
  ```javascript
52
- import '@lynx-js/web-elements/XMarkdown';
58
+ import "@lynx-js/web-elements/XMarkdown";
53
59
  ```
54
60
 
55
61
  - fix: x-markdown inline view injection no longer queries light DOM children when the content attribute changes. Consumers must now pre-set `slot="{id}"` on the child element they want to project into `inlineview://{id}`. ([#2516](https://github.com/lynx-family/lynx-stack/pull/2516))
@@ -119,11 +125,11 @@
119
125
  Now we integrated the `LinearCompat` into @lynx-js/web-elements. Developers can safely remove the following imports:
120
126
 
121
127
  ```js
122
- import '@lynx-js/web-elements/compat/LinearContainer';
128
+ import "@lynx-js/web-elements/compat/LinearContainer";
123
129
  ```
124
130
 
125
131
  ```js
126
- import '@lynx-js/web-elements-compat/LinearContainer';
132
+ import "@lynx-js/web-elements-compat/LinearContainer";
127
133
  ```
128
134
 
129
135
  ### Patch Changes
@@ -149,21 +155,20 @@
149
155
  #### Before
150
156
 
151
157
  ```js
152
- import '@lynx-js/web-elements-template';
153
- import '@lynx-js/web-elements-compat/LinearContainer';
158
+ import "@lynx-js/web-elements-template";
159
+ import "@lynx-js/web-elements-compat/LinearContainer";
154
160
  ```
155
161
 
156
162
  #### After
157
163
 
158
164
  ```js
159
- import '@lynx-js/web-elements/html-templates';
160
- import '@lynx-js/web-elements/compat/LinearContainer';
165
+ import "@lynx-js/web-elements/html-templates";
166
+ import "@lynx-js/web-elements/compat/LinearContainer";
161
167
  ```
162
168
 
163
169
  ### Patch Changes
164
170
 
165
171
  - refactor: change code structure for improved readability and maintainability ([#2004](https://github.com/lynx-family/lynx-stack/pull/2004))
166
-
167
172
  - enable noUnusedLocals for web-elements
168
173
  - add source field for supporting @rsbuild/plugin-source-build
169
174
 
@@ -198,7 +203,6 @@
198
203
  - fix: define x-foldview-slot-drag-ng typo. ([#1915](https://github.com/lynx-family/lynx-stack/pull/1915))
199
204
 
200
205
  - feat: 1. Added support for the list `estimated-main-axis-size-px` property; the width and height of `list-item` are no longer required. ([#1911](https://github.com/lynx-family/lynx-stack/pull/1911))
201
-
202
206
  2. Fixed an issue where the list `lower-threshold-item-count` event would not trigger when using a horizontal layout under a waterfall layout.
203
207
 
204
208
  3. Fixed an issue where calling the list `autoScroll` method in `useEffect` might not scroll.
@@ -226,7 +230,6 @@
226
230
  ### Patch Changes
227
231
 
228
232
  - fix: ([#1837](https://github.com/lynx-family/lynx-stack/pull/1837))
229
-
230
233
  1. `LynxView.updateData()` cannot trigger `dataProcessor`.
231
234
 
232
235
  2. **This is a break change:** The second parameter of `LynxView.updateData()` has been changed from `UpdateDataType` to `string`, which is the `processorName` (default is `default` which will use `defaultDataProcessor`). This change is to better align with Native. The current complete type is as follows:
@@ -252,7 +255,6 @@
252
255
  ### Patch Changes
253
256
 
254
257
  - fix: 1. svg use image tag to render, to differentiate background-image styles ([#1668](https://github.com/lynx-family/lynx-stack/pull/1668))
255
-
256
258
  1. use blob instead of raw data-uri
257
259
 
258
260
  > Not using data-uri(data:image/svg+xml;utf8,${props.content})
@@ -303,7 +305,6 @@
303
305
  ### Patch Changes
304
306
 
305
307
  - Add crossorigin attribute support to x-image component ([#1340](https://github.com/lynx-family/lynx-stack/pull/1340))
306
-
307
308
  - Added `crossorigin` to the `observedAttributes` array in `ImageSrc.ts`
308
309
  - Implemented `#handleCrossorigin` handler using the `bindToAttribute` helper to forward the crossorigin attribute from the custom element to the internal `<img>` element
309
310
  - Added comprehensive test coverage to verify the attribute is properly passed through to the shadow DOM
@@ -466,7 +467,6 @@
466
467
  ### Minor Changes
467
468
 
468
469
  - fix: ([#629](https://github.com/lynx-family/lynx-stack/pull/629))
469
-
470
470
  - typo of `initial-scroll-offset` in scroll-view.
471
471
  - scroll-view's `initial-scroll-index` is changed to `initial-scroll-to-index`.
472
472
 
@@ -493,7 +493,6 @@
493
493
  - feat: improve compatibility for chrome 108 & support linear-gradient for nested x-text ([#590](https://github.com/lynx-family/lynx-stack/pull/590))
494
494
 
495
495
  **This is a breaking change**
496
-
497
496
  - Please upgrade your `@lynx-js/web-elements` to >=0.6.0
498
497
  - Please upgrade your `@lynx-js/web-core` to >=0.12.0
499
498
  - The compiled lynx template json won't be impacted.
@@ -516,7 +515,6 @@
516
515
  - feat: fully support MTS ([#569](https://github.com/lynx-family/lynx-stack/pull/569))
517
516
 
518
517
  Now use support the following usage
519
-
520
518
  - mainthread event
521
519
  - mainthread ref
522
520
  - runOnMainThread/runOnBackground
@@ -531,7 +529,6 @@
531
529
  - fix: refactor foldview slot offset logic ([#575](https://github.com/lynx-family/lynx-stack/pull/575))
532
530
 
533
531
  - fix: improve x-foldview-ng ([#513](https://github.com/lynx-family/lynx-stack/pull/513))
534
-
535
532
  - support fling for touch event driven scrolling
536
533
  - allow the height of `x-foldview-slot-ng` + `x-foldview-toolbar-ng` > `x-foldview-ng`
537
534
  - do not prevent horizontal gesture. After this commit we only allow one direction gesture for one touch (start -> end)
@@ -582,7 +579,6 @@
582
579
  ### Minor Changes
583
580
 
584
581
  - feat: 1. list adds support for the `sticky` attribute. Now sticky-offset, sticky-top, and sticky-bottom will only take effect when `sticky` is `true`. ([#257](https://github.com/lynx-family/lynx-stack/pull/257))
585
-
586
582
  2. Added support for `list-main-axis-gap`, `list-cross-axis-gap`.
587
583
 
588
584
  - feat(web): The list element supports list-type with **flow**. ([#240](https://github.com/lynx-family/lynx-stack/pull/240))
@@ -596,7 +592,6 @@
596
592
  ### Minor Changes
597
593
 
598
594
  - refactor: remove web-elements/lazy and loadNewTag ([#123](https://github.com/lynx-family/lynx-stack/pull/123))
599
-
600
595
  - remove @lynx-js/web-elements/lazy
601
596
  - remove loadElement
602
597
  - remove loadNewTag callback
@@ -747,11 +742,9 @@
747
742
  Before this commit, those parent text element with style `color:linear-gradient()` will cause empty content in children inline-text element
748
743
 
749
744
  - f650509: fix: browser compatibility issues
750
-
751
745
  1. safari 17.2~18.0 issue
752
746
 
753
747
  `display:linear` doesn't work
754
-
755
748
  2. chrome < 99 issue
756
749
 
757
750
  text may be blank on these browsers
@@ -812,12 +805,10 @@
812
805
  #### 3. Tests not implemented
813
806
 
814
807
  ##### HTML Tests
815
-
816
808
  1. event-layoutcomplete skipped webkit, firefox due to contentvisibilityautostatechange not propagate
817
809
  2. get-visible-cells skipped webkit, firefox due to contentvisibilityautostatechange not propagate
818
810
 
819
811
  ##### React Tests
820
-
821
812
  1. lynx.createQuery not supported.
822
813
 
823
814
  - b323923: feat(web): support **ReplaceElement, **CreateImage, \_\_CreateScrollView
@@ -842,8 +833,8 @@
842
833
  For compating usage, `@lynx-js/web-elements-compat/LinearContainer` is provided.
843
834
 
844
835
  ```javascript
845
- import '@lynx-js/web-elements-compat/LinearContainer';
846
- import '@lynx-js/web-elements/all';
836
+ import "@lynx-js/web-elements-compat/LinearContainer";
837
+ import "@lynx-js/web-elements/all";
847
838
  ```
848
839
 
849
840
  - f8d1d98: break: rename the `blur` and `focus` event to `lynxblur` and `lynxfocus` for x-input element
@@ -865,11 +856,11 @@
865
856
  There is also a simple way to use this feature
866
857
 
867
858
  ```javascript
868
- import { LynxCard } from '@lynx-js/web-core';
869
- import { loadElement } from '@lynx-js/web-elements/lazy';
870
- import '@lynx-js/web-elements/index.css';
871
- import '@lynx-js/web-core/index.css';
872
- import './index.css';
859
+ import { LynxCard } from "@lynx-js/web-core";
860
+ import { loadElement } from "@lynx-js/web-elements/lazy";
861
+ import "@lynx-js/web-elements/index.css";
862
+ import "@lynx-js/web-core/index.css";
863
+ import "./index.css";
873
864
 
874
865
  const lynxcard = new LynxCard({
875
866
  ...beforeConfigs,
@@ -882,36 +873,30 @@
882
873
  - 1fe49a2: feat(web): add custom element x-audio-tt
883
874
 
884
875
  #### The behavior is different from the native x-audio-tt:
885
-
886
876
  - When src changes, resources will not be loaded immediately. Resources will only be loaded when the play and prepare methods are triggered.
887
877
 
888
878
  > This is because resource loading and decoding are two steps in native lynx, while only resource loading can be controlled in web.
889
879
  > So loading and decoding are handled on one side.
890
-
891
880
  - The code returned by the binderror event does not include -4
892
881
 
893
882
  #### Unimplemented properties:
894
-
895
883
  - autoplay
896
884
  - playertype
897
885
  - experimental-ios-async-prepare
898
886
 
899
887
  #### Unimplemented methods:
900
-
901
888
  - requestFocus
902
889
  - releaseFocus
903
890
 
904
891
  ### Patch Changes
905
892
 
906
893
  - 987da15: fix: x-foldview-ng scrolling behavior
907
-
908
894
  - fix scrolling behavior on its sub dom-tree has x-refresh-view
909
895
  - fix scrolling behavior on its sub dom-tree has x-viewpager-ng
910
896
 
911
897
  - 3e66349: fix: x-viewpager bindchange use scrollEnd to trigger; bindoffsetchange use scroll to trigger.
912
898
  - 2b7a4fe: fix: exposure should track the interaction with the closest scroll able ancestor
913
899
  - 461d965: fix(web): swiper specifies current and bindchange, may cause jitter problem and some layout problems.
914
-
915
900
  1. swiper specifies current and bindchange, may cause jitter problem.
916
901
  2. When there are current not 0 && circular, the first layout is not correct.
917
902
  3. When there are circular mode='carousel' attributes, the first paint position is not correct.
@@ -919,7 +904,6 @@
919
904
 
920
905
  - 7ee0dc1: fix(web): rename swiper-item to x-swiper-item
921
906
  - 7c752d9: fix(web): two bugs of x-textarea and x-input:
922
-
923
907
  1. When inputting Chinese characters, you need to send an input event again after the input is completed.
924
908
 
925
909
  2. When the business input event is bound to the input event inside web-elements, the input event will be triggered twice by mistake, so stopImmediatePropagation needs to be prevented in the form
@@ -944,7 +928,6 @@
944
928
  - 532380d: fix: ::part()::after selector not work on chrome 100
945
929
  - a41965d: fix: foldview horizontal scroll in safari
946
930
  - a7a222b: fix(web): x-view-pager-ng
947
-
948
931
  1. select-index, initial-select-index should only selectTab if the element has a connectedCallback.
949
932
  2. add scroll-snap-stop to x-view-pager-ng, to slide only one element at one time.
950
933
 
@@ -7,6 +7,39 @@ import { __esDecorate, __runInitializers } from "tslib";
7
7
  import { boostedQueueMicrotask, genDomGetter, registerAttributeHandler, } from '../../element-reactive/index.js';
8
8
  import { commonComponentEventSetting } from '../common/commonEventInitConfiguration.js';
9
9
  import { registerEventEnableStatusChangeHandler } from '../../element-reactive/index.js';
10
+ const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
11
+ const getSiblingIndex = (node) => {
12
+ let index = 0;
13
+ let previousNode = node.previousSibling;
14
+ while (previousNode) {
15
+ index++;
16
+ previousNode = previousNode.previousSibling;
17
+ }
18
+ return index;
19
+ };
20
+ const getRangePosition = (nodeInfo, offsetInNode) => {
21
+ const { node } = nodeInfo;
22
+ if (node.nodeType === Node.TEXT_NODE) {
23
+ return {
24
+ container: node,
25
+ offset: clamp(offsetInNode, 0, node.data.length),
26
+ };
27
+ }
28
+ // Elements are one virtual character, while DOM Range offsets address child
29
+ // indexes. Use the parent's before/after-element boundary instead.
30
+ const elementOffset = offsetInNode > 0 ? 1 : 0;
31
+ const parentNode = node.parentNode;
32
+ if (!parentNode) {
33
+ return {
34
+ container: node,
35
+ offset: clamp(elementOffset, 0, node.childNodes.length),
36
+ };
37
+ }
38
+ return {
39
+ container: parentNode,
40
+ offset: getSiblingIndex(node) + elementOffset,
41
+ };
42
+ };
10
43
  let XTextTruncation = (() => {
11
44
  var _a;
12
45
  let _instanceExtraInitializers = [];
@@ -144,12 +177,14 @@ let XTextTruncation = (() => {
144
177
  let currentNodeInfo = measure
145
178
  .getNodeInfoByCharIndex(maxLineEndAt);
146
179
  const endCharInNodeIndex = end - currentNodeInfo.start;
147
- range.setEnd(currentNodeInfo.node, endCharInNodeIndex);
148
- range.setStart(currentNodeInfo.node, endCharInNodeIndex);
180
+ const initialRangePosition = getRangePosition(currentNodeInfo, endCharInNodeIndex);
181
+ range.setEnd(initialRangePosition.container, initialRangePosition.offset);
182
+ range.setStart(initialRangePosition.container, initialRangePosition.offset);
149
183
  while (range.getBoundingClientRect().width < inlineTruncationWidth
150
184
  && (maxLineEndAt -= 1)
151
185
  && (currentNodeInfo = measure.getNodeInfoByCharIndex(maxLineEndAt))) {
152
- range.setStart(currentNodeInfo.node, maxLineEndAt - currentNodeInfo.start);
186
+ const rangePosition = getRangePosition(currentNodeInfo, maxLineEndAt - currentNodeInfo.start);
187
+ range.setStart(rangePosition.container, rangePosition.offset);
153
188
  }
154
189
  }
155
190
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-elements-canary",
3
- "version": "0.12.6",
3
+ "version": "0.12.7-canary-20260720-5a831708",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -142,6 +142,7 @@
142
142
  "@rsbuild/core": "2.1.4",
143
143
  "@rsbuild/plugin-source-build": "1.0.5",
144
144
  "@types/markdown-it": "^14.1.1",
145
+ "@types/node": "^24.10.13",
145
146
  "nyc": "^17.1.0",
146
147
  "tslib": "^2.8.1",
147
148
  "@lynx-js/playwright-fixtures": "0.0.0"