@lynx-js/web-elements 0.7.2 → 0.7.4

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,37 @@
1
1
  # @lynx-js/web-elements
2
2
 
3
+ ## 0.7.4
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: x-foldview-ng `overflow-y: scroll` add !important to avoid being covered. ([#932](https://github.com/lynx-family/lynx-stack/pull/932))
8
+
9
+ - Updated dependencies []:
10
+ - @lynx-js/web-elements-template@0.7.4
11
+
12
+ ## 0.7.3
13
+
14
+ ### Patch Changes
15
+
16
+ - refactor: allow elements to be rendered before :defined ([#855](https://github.com/lynx-family/lynx-stack/pull/855))
17
+
18
+ Before this commit, we don't allow developers to render these elements before they're defined.
19
+
20
+ In this commit, we will remove these restrictions.
21
+
22
+ - fix: remove the style `contain: content` of x-foldview-ng, otherwise it will cause the `position: fixed` elements to be positioned incorrectly after scrolling. ([#878](https://github.com/lynx-family/lynx-stack/pull/878))
23
+
24
+ - fix: x-list should observe property list-type change. ([#862](https://github.com/lynx-family/lynx-stack/pull/862))
25
+
26
+ Before this commit, list-type only works when it was first assigned.
27
+
28
+ use `requestAnimationFrame` instead of `queueMicrotask` to layoutListItem, this is because it may cause crashes in webkit.
29
+
30
+ - fix: list-item should support linear layout. ([#859](https://github.com/lynx-family/lynx-stack/pull/859))
31
+
32
+ - Updated dependencies []:
33
+ - @lynx-js/web-elements-template@0.7.3
34
+
3
35
  ## 0.7.2
4
36
 
5
37
  ### Patch Changes
package/README.md CHANGED
@@ -4,26 +4,25 @@ It provides the custom-element implementation of Lynx Elements in Web.
4
4
 
5
5
  So far, support compared to Lynx Elements on the client:
6
6
 
7
- | Elements | Whether support | Details |
8
- | -------------- | --------------- | ------------------------------------------------------------------------------ |
9
- | Elements | | |
10
- | canvas | | No |
11
- | image | ✅ | Full Support |
12
- | list | ✅ | list-type with single and flow are available, and waterfall is being supported |
13
- | scroll-view | ✅ | Full Support |
14
- | text | ✅ | Full Support |
15
- | view | | Full Support |
16
- | X-Elements | | |
17
- | svg | ✅ | Full Support |
18
- | x-blur-view | ✅ | Full Support |
19
- | x-input | ✅ | Full Support |
20
- | x-textarea | ✅ | Full Support |
21
- | x-swiper | ✅ | Full Support |
22
- | x-viewpager-ng | ✅ | Full Support |
23
- | x-foldview-ng | ✅ | Full Support |
24
- | x-refresh-view | ✅ | Full Support |
25
- | x-overlay-ng | ✅ | Full Support |
26
- | x-audio-tt | ✅ | Full Support |
7
+ | Elements | Whether support | Details |
8
+ | -------------- | --------------- | ------------ |
9
+ | Elements | | |
10
+ | image | | Full Support |
11
+ | list | ✅ | Full Support |
12
+ | scroll-view | ✅ | Full Support |
13
+ | text | ✅ | Full Support |
14
+ | view | ✅ | Full Support |
15
+ | X-Elements | | |
16
+ | svg || Full Support |
17
+ | x-blur-view | ✅ | Full Support |
18
+ | x-input | ✅ | Full Support |
19
+ | x-textarea | ✅ | Full Support |
20
+ | x-swiper | ✅ | Full Support |
21
+ | x-viewpager-ng | ✅ | Full Support |
22
+ | x-foldview-ng | ✅ | Full Support |
23
+ | x-refresh-view | ✅ | Full Support |
24
+ | x-overlay-ng | ✅ | Full Support |
25
+ | x-audio-tt | ✅ | Full Support |
27
26
 
28
27
  ## Usage
29
28
 
@@ -46,16 +46,16 @@ let XFoldviewNgEvents = (() => {
46
46
  get #handleGranularity() { return _private_handleGranularity_descriptor.value; }
47
47
  get #enableOffsetEvent() { return _private_enableOffsetEvent_descriptor.value; }
48
48
  #handleScroll = () => {
49
- const curentScrollTop = this.#dom.scrollTop;
50
- const scrollLength = Math.abs(this.#pervScroll - curentScrollTop);
49
+ const currentScrollTop = this.#dom.scrollTop;
50
+ const scrollLength = Math.abs(this.#pervScroll - currentScrollTop);
51
51
  if (scrollLength > this.#granularity
52
52
  || this.#dom.scrollTop === 0
53
53
  || Math.abs(this.#dom.scrollHeight - this.#dom.clientHeight - this.#dom.scrollTop) <= 1) {
54
- this.#pervScroll = curentScrollTop;
54
+ this.#pervScroll = currentScrollTop;
55
55
  this.#dom.dispatchEvent(new CustomEvent('offset', {
56
56
  ...commonComponentEventSetting,
57
57
  detail: {
58
- offset: curentScrollTop,
58
+ offset: currentScrollTop,
59
59
  height: this.#dom[scrollableLength],
60
60
  },
61
61
  }));
@@ -5,7 +5,6 @@ import { __esDecorate, __runInitializers } from "tslib";
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import { bindToStyle, boostedQueueMicrotask, registerAttributeHandler, } from '@lynx-js/web-elements-reactive';
8
- const WATERFALL_SLOT = 'waterfall-slot';
9
8
  let XListAttributes = (() => {
10
9
  let _private_handlerStickyOffset_decorators;
11
10
  let _private_handlerStickyOffset_initializers = [];
@@ -2,7 +2,6 @@ import { type AttributeReactiveClass } from '@lynx-js/web-elements-reactive';
2
2
  import type { XList } from './XList.js';
3
3
  export declare class XListWaterfall implements InstanceType<AttributeReactiveClass<typeof HTMLElement>> {
4
4
  #private;
5
- static observedAttributes: never[];
5
+ static observedAttributes: string[];
6
6
  constructor(dom: XList);
7
- connectedCallback(): void;
8
7
  }
@@ -1,144 +1,169 @@
1
+ import { __esDecorate, __runInitializers, __setFunctionName } from "tslib";
1
2
  /*
2
3
  // Copyright 2024 The Lynx Authors. All rights reserved.
3
4
  // Licensed under the Apache License Version 2.0 that can be found in the
4
5
  // LICENSE file in the root directory of this source tree.
5
6
  */
6
- import { boostedQueueMicrotask, genDomGetter, } from '@lynx-js/web-elements-reactive';
7
+ import { genDomGetter, registerAttributeHandler, } from '@lynx-js/web-elements-reactive';
7
8
  const WATERFALL_SLOT = 'waterfall-slot';
8
9
  const WATERFALL_STYLE = 'waterfall-style';
9
- export class XListWaterfall {
10
- static observedAttributes = [];
11
- #dom;
12
- #getListContainer = genDomGetter(() => this.#dom.shadowRoot, '#content');
13
- #getLowerThresholdObserver = genDomGetter(() => this.#dom.shadowRoot, 'div[part="lower-threshold-observer"]');
14
- #resizeObserver;
15
- #childrenObserver;
16
- #createWaterfallContainer = () => {
17
- const waterfallSlot = document.createElement('slot');
18
- waterfallSlot.setAttribute('name', `${WATERFALL_SLOT}`);
19
- this.#dom.shadowRoot?.querySelector('[part=upper-threshold-observer]')
20
- ?.insertAdjacentElement('afterend', waterfallSlot);
21
- };
22
- #layoutListItem = (spanCount, isScrollVertical) => {
23
- const measurements = new Array(spanCount).fill(0);
24
- for (let i = 0; i < this.#dom.children.length; i++) {
25
- const listItem = this.#dom.children[i];
26
- const mainAxisGap = getComputedStyle(listItem).getPropertyValue('--list-main-axis-gap');
27
- const crossAxisGap = getComputedStyle(listItem).getPropertyValue('--list-cross-axis-gap');
28
- const increasedMeasurement = isScrollVertical
29
- ? listItem.getBoundingClientRect().height + parseFloat(mainAxisGap)
30
- : listItem.getBoundingClientRect().width + parseFloat(mainAxisGap);
31
- if (listItem.getAttribute('full-span') !== null) {
32
- let longestMeasurement = measurements[0];
33
- // Find the longest track.
34
- for (let j = 1; j < spanCount; j++) {
35
- if (measurements[j] > longestMeasurement) {
36
- longestMeasurement = measurements[j];
10
+ let XListWaterfall = (() => {
11
+ let _instanceExtraInitializers = [];
12
+ let _private_handlerListType_decorators;
13
+ let _private_handlerListType_descriptor;
14
+ return class XListWaterfall {
15
+ static {
16
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
17
+ _private_handlerListType_decorators = [registerAttributeHandler('list-type', true)];
18
+ __esDecorate(this, _private_handlerListType_descriptor = { value: __setFunctionName(function (newVal) {
19
+ if (newVal === 'waterfall') {
20
+ const spanCount = parseFloat(this.#dom.getAttribute('span-count')
21
+ || this.#dom.getAttribute('column-count')
22
+ || '') || 1;
23
+ const scrollOrientation = this.#dom.getAttribute('scroll-orientation')
24
+ || 'vertical';
25
+ this.#createWaterfallContainer();
26
+ if (!this.#resizeObserver) {
27
+ this.#resizeObserverInit(spanCount, scrollOrientation === 'vertical');
28
+ }
29
+ if (!this.#childrenObserver) {
30
+ this.#childrenObserver = new MutationObserver((mutationList) => {
31
+ const mutation = mutationList?.[0];
32
+ if (mutation?.type === 'childList') {
33
+ this.#resizeObserverInit(spanCount, scrollOrientation === 'vertical');
34
+ }
35
+ });
36
+ this.#childrenObserver.observe(this.#dom, {
37
+ childList: true,
38
+ });
39
+ }
40
+ }
41
+ else {
42
+ this.#resizeObserver?.disconnect();
43
+ this.#resizeObserver = undefined;
44
+ this.#childrenObserver?.disconnect();
45
+ this.#childrenObserver = undefined;
46
+ for (let i = 0; i < this.#dom.children.length; i++) {
47
+ const listItem = this.#dom.children[i];
48
+ listItem.removeAttribute('slot');
49
+ }
50
+ this.#dom.shadowRoot?.querySelector(`slot[name=${WATERFALL_SLOT}]`)
51
+ ?.remove();
52
+ }
53
+ }, "#handlerListType") }, _private_handlerListType_decorators, { kind: "method", name: "#handlerListType", static: false, private: true, access: { has: obj => #handlerListType in obj, get: obj => obj.#handlerListType }, metadata: _metadata }, null, _instanceExtraInitializers);
54
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
55
+ }
56
+ static observedAttributes = ['list-type'];
57
+ #dom = __runInitializers(this, _instanceExtraInitializers);
58
+ #getListContainer = genDomGetter(() => this.#dom.shadowRoot, '#content');
59
+ #getLowerThresholdObserver = genDomGetter(() => this.#dom.shadowRoot, 'div[part="lower-threshold-observer"]');
60
+ #resizeObserver;
61
+ #childrenObserver;
62
+ #createWaterfallContainer = () => {
63
+ const waterfallSlot = document.createElement('slot');
64
+ waterfallSlot.setAttribute('name', `${WATERFALL_SLOT}`);
65
+ this.#dom.shadowRoot?.querySelector('[part=upper-threshold-observer]')
66
+ ?.insertAdjacentElement('afterend', waterfallSlot);
67
+ };
68
+ #layoutListItem = (spanCount, isScrollVertical) => {
69
+ const measurements = new Array(spanCount).fill(0);
70
+ for (let i = 0; i < this.#dom.children.length; i++) {
71
+ const listItem = this.#dom.children[i];
72
+ const mainAxisGap = getComputedStyle(listItem).getPropertyValue('--list-main-axis-gap');
73
+ const crossAxisGap = getComputedStyle(listItem).getPropertyValue('--list-cross-axis-gap');
74
+ const increasedMeasurement = isScrollVertical
75
+ ? listItem.getBoundingClientRect().height + parseFloat(mainAxisGap)
76
+ : listItem.getBoundingClientRect().width + parseFloat(mainAxisGap);
77
+ if (listItem.getAttribute('full-span') !== null) {
78
+ let longestMeasurement = measurements[0];
79
+ // Find the longest track.
80
+ for (let j = 1; j < spanCount; j++) {
81
+ if (measurements[j] > longestMeasurement) {
82
+ longestMeasurement = measurements[j];
83
+ }
84
+ }
85
+ for (let j = 0; j < spanCount; j++) {
86
+ measurements[j] = longestMeasurement + increasedMeasurement;
87
+ }
88
+ if (isScrollVertical) {
89
+ listItem.setAttribute(`${WATERFALL_STYLE}-left`, '0');
90
+ listItem.setAttribute(`${WATERFALL_STYLE}-top`, `${longestMeasurement}px`);
91
+ }
92
+ else {
93
+ listItem.setAttribute(`${WATERFALL_STYLE}-left`, `${longestMeasurement}px`);
94
+ listItem.setAttribute(`${WATERFALL_STYLE}-top`, '0');
37
95
  }
38
- }
39
- for (let j = 0; j < spanCount; j++) {
40
- measurements[j] = longestMeasurement + increasedMeasurement;
41
- }
42
- if (isScrollVertical) {
43
- listItem.setAttribute(`${WATERFALL_STYLE}-left`, '0');
44
- listItem.setAttribute(`${WATERFALL_STYLE}-top`, `${longestMeasurement}px`);
45
96
  }
46
97
  else {
47
- listItem.setAttribute(`${WATERFALL_STYLE}-left`, `${longestMeasurement}px`);
48
- listItem.setAttribute(`${WATERFALL_STYLE}-top`, '0');
49
- }
50
- }
51
- else {
52
- let shortestIndex = 0;
53
- let shortestMeasurement = measurements[0];
54
- // Find the shortest track.
55
- for (let j = 1; j < spanCount; j++) {
56
- if (measurements[j] < shortestMeasurement) {
57
- shortestIndex = j;
58
- shortestMeasurement = measurements[j];
98
+ let shortestIndex = 0;
99
+ let shortestMeasurement = measurements[0];
100
+ // Find the shortest track.
101
+ for (let j = 1; j < spanCount; j++) {
102
+ if (measurements[j] < shortestMeasurement) {
103
+ shortestIndex = j;
104
+ shortestMeasurement = measurements[j];
105
+ }
59
106
  }
107
+ const crossOffset = `calc(${shortestIndex} * (100% - ${crossAxisGap} * (${spanCount} - 1))/ ${spanCount} + ${Math.max(0, shortestIndex)} * ${crossAxisGap})`;
108
+ if (isScrollVertical) {
109
+ listItem.setAttribute(`${WATERFALL_STYLE}-left`, crossOffset);
110
+ listItem.setAttribute(`${WATERFALL_STYLE}-top`, `${shortestMeasurement}px`);
111
+ }
112
+ else {
113
+ listItem.setAttribute(`${WATERFALL_STYLE}-left`, `${shortestMeasurement}px`);
114
+ listItem.setAttribute(`${WATERFALL_STYLE}-top`, crossOffset);
115
+ }
116
+ measurements[shortestIndex] += increasedMeasurement;
60
117
  }
61
- const crossOffset = `calc(${shortestIndex} * (100% - ${crossAxisGap} * (${spanCount} - 1))/ ${spanCount} + ${Math.max(0, shortestIndex)} * ${crossAxisGap})`;
62
- if (isScrollVertical) {
63
- listItem.setAttribute(`${WATERFALL_STYLE}-left`, crossOffset);
64
- listItem.setAttribute(`${WATERFALL_STYLE}-top`, `${shortestMeasurement}px`);
118
+ }
119
+ for (let i = 0; i < this.#dom.children.length; i++) {
120
+ const listItem = this.#dom.children[i];
121
+ listItem.style.setProperty('left', listItem.getAttribute(`${WATERFALL_STYLE}-left`));
122
+ listItem.style.setProperty('top', listItem.getAttribute(`${WATERFALL_STYLE}-top`));
123
+ listItem.setAttribute('slot', WATERFALL_SLOT);
124
+ }
125
+ // The reasons why it is not unified in #updateScrollToLowerEventSwitches is:
126
+ // It is impossible to ensure that list-item is not rendered, so it will cause incorrect listContent.scrollHeight/scrollWidth as height/width.
127
+ const enableScrollToLower = this.#dom.getAttribute('x-enable-scrolltolower-event');
128
+ if (enableScrollToLower !== null && enableScrollToLower !== 'false') {
129
+ const lower = this.#getLowerThresholdObserver();
130
+ const scrollOrientation = this.#dom.getAttribute('scroll-orientation')
131
+ || 'vertical';
132
+ const listContent = this.#getListContainer();
133
+ if (scrollOrientation === 'vertical') {
134
+ lower.style.setProperty('top',
135
+ // Firefox cannot trigger the bottom IntersectionObserver
136
+ `${String(listContent.scrollHeight - 1)}px`, 'important');
137
+ // Firefox needs this
138
+ lower.style.setProperty('bottom', 'unset', 'important');
65
139
  }
66
140
  else {
67
- listItem.setAttribute(`${WATERFALL_STYLE}-left`, `${shortestMeasurement}px`);
68
- listItem.setAttribute(`${WATERFALL_STYLE}-top`, crossOffset);
141
+ lower.style.setProperty('left',
142
+ // Firefox cannot trigger the bottom IntersectionObserver
143
+ `${String(listContent.scrollHeight - 1)}px`);
144
+ // Firefox needs this
145
+ lower.style.setProperty('right', 'unset');
69
146
  }
70
- measurements[shortestIndex] += increasedMeasurement;
71
147
  }
148
+ };
149
+ constructor(dom) {
150
+ this.#dom = dom;
72
151
  }
73
- for (let i = 0; i < this.#dom.children.length; i++) {
74
- const listItem = this.#dom.children[i];
75
- listItem.style.setProperty('left', listItem.getAttribute(`${WATERFALL_STYLE}-left`));
76
- listItem.style.setProperty('top', listItem.getAttribute(`${WATERFALL_STYLE}-top`));
77
- listItem.setAttribute('slot', WATERFALL_SLOT);
78
- }
79
- // The reasons why it is not unified in #updateScrollToLowerEventSwitches is:
80
- // It is impossible to ensure that list-item is not rendered, so it will cause incorrect listContent.scrollHeight/scrollWidth as height/width.
81
- const enableScrollToLower = this.#dom.getAttribute('x-enable-scrolltolower-event');
82
- if (enableScrollToLower !== null && enableScrollToLower !== 'false') {
83
- const lower = this.#getLowerThresholdObserver();
84
- const scrollOrientation = this.#dom.getAttribute('scroll-orientation')
85
- || 'vertical';
86
- const listContent = this.#getListContainer();
87
- if (scrollOrientation === 'vertical') {
88
- lower.style.setProperty('top',
89
- // Firefox cannot trigger the bottom IntersectionObserver
90
- `${String(listContent.scrollHeight - 1)}px`, 'important');
91
- // Firefox needs this
92
- lower.style.setProperty('bottom', 'unset', 'important');
93
- }
94
- else {
95
- lower.style.setProperty('left',
96
- // Firefox cannot trigger the bottom IntersectionObserver
97
- `${String(listContent.scrollHeight - 1)}px`);
98
- // Firefox needs this
99
- lower.style.setProperty('right', 'unset');
100
- }
101
- }
102
- };
103
- constructor(dom) {
104
- this.#dom = dom;
105
- }
106
- #resizeObserverInit = (spanCount, isScrollVertical) => {
107
- this.#resizeObserver?.disconnect();
108
- this.#resizeObserver = new ResizeObserver(() => {
109
- // may cause: Resizeobserver loop completed with undelivered notifications
110
- // https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver#observation_errors
111
- boostedQueueMicrotask(() => {
112
- this.#layoutListItem(spanCount, isScrollVertical);
152
+ #resizeObserverInit = (spanCount, isScrollVertical) => {
153
+ this.#resizeObserver?.disconnect();
154
+ this.#resizeObserver = new ResizeObserver(() => {
155
+ // may cause: Resizeobserver loop completed with undelivered notifications
156
+ // https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver#observation_errors
157
+ requestAnimationFrame(() => {
158
+ this.#layoutListItem(spanCount, isScrollVertical);
159
+ });
113
160
  });
114
- });
115
- Array.from(this.#dom.children).forEach(element => {
116
- this.#resizeObserver?.observe(element);
117
- });
161
+ Array.from(this.#dom.children).forEach(element => {
162
+ this.#resizeObserver?.observe(element);
163
+ });
164
+ };
165
+ get #handlerListType() { return _private_handlerListType_descriptor.value; }
118
166
  };
119
- connectedCallback() {
120
- if (this.#dom.getAttribute('list-type') === 'waterfall') {
121
- const spanCount = parseFloat(this.#dom.getAttribute('span-count')
122
- || this.#dom.getAttribute('column-count')
123
- || '') || 1;
124
- const scrollOrientation = this.#dom.getAttribute('scroll-orientation')
125
- || 'vertical';
126
- this.#createWaterfallContainer();
127
- if (!this.#resizeObserver) {
128
- this.#resizeObserverInit(spanCount, scrollOrientation === 'vertical');
129
- }
130
- if (!this.#childrenObserver) {
131
- this.#childrenObserver = new MutationObserver((mutationList) => {
132
- const mutation = mutationList?.[0];
133
- if (mutation?.type === 'childList') {
134
- this.#resizeObserverInit(spanCount, scrollOrientation === 'vertical');
135
- }
136
- });
137
- this.#childrenObserver.observe(this.#dom, {
138
- childList: true,
139
- });
140
- }
141
- }
142
- }
143
- }
167
+ })();
168
+ export { XListWaterfall };
144
169
  //# sourceMappingURL=XListWaterfall.js.map
@@ -110,16 +110,16 @@ let XTextTruncation = (() => {
110
110
  this.#dom.removeAttribute(XTextTruncation.exceedMathLengthAttribute);
111
111
  this.#dom.removeAttribute(XTextTruncation.showInlineTruncation);
112
112
  }
113
- #getAllSibilings(targetNode) {
114
- const sibilingNodes = [];
115
- let targetNodeSibiling = targetNode;
116
- while ((targetNodeSibiling = targetNodeSibiling.nextSibling)) {
117
- if (targetNodeSibiling.nodeType === Node.TEXT_NODE
118
- || targetNodeSibiling.nodeType === Node.ELEMENT_NODE) {
119
- sibilingNodes.push(targetNodeSibiling);
113
+ #getAllSiblings(targetNode) {
114
+ const siblingNodes = [];
115
+ let targetNodeSibling = targetNode;
116
+ while ((targetNodeSibling = targetNodeSibling.nextSibling)) {
117
+ if (targetNodeSibling.nodeType === Node.TEXT_NODE
118
+ || targetNodeSibling.nodeType === Node.ELEMENT_NODE) {
119
+ siblingNodes.push(targetNodeSibling);
120
120
  }
121
121
  }
122
- return sibilingNodes;
122
+ return siblingNodes;
123
123
  }
124
124
  #layoutText() {
125
125
  if (!this.#componentConnected || this.#dom.matches('x-text>x-text'))
@@ -208,10 +208,10 @@ let XTextTruncation = (() => {
208
208
  else {
209
209
  toBeHideNodes.push(targetNode);
210
210
  }
211
- toBeHideNodes = toBeHideNodes.concat(this.#getAllSibilings(targetNode));
211
+ toBeHideNodes = toBeHideNodes.concat(this.#getAllSiblings(targetNode));
212
212
  let targetNodeParentElement = targetNode.parentElement;
213
213
  while (targetNodeParentElement !== this.#dom) {
214
- toBeHideNodes = toBeHideNodes.concat(this.#getAllSibilings(targetNodeParentElement));
214
+ toBeHideNodes = toBeHideNodes.concat(this.#getAllSiblings(targetNodeParentElement));
215
215
  targetNodeParentElement = targetNodeParentElement.parentElement;
216
216
  }
217
217
  toBeHideNodes.forEach((node) => {
@@ -450,7 +450,7 @@ class TextRenderingMeasureTool {
450
450
  getLineInfo(lineIndex) {
451
451
  this.#genLinesInfoUntil(lineIndex + 1);
452
452
  if (lineIndex < this.#lazyLinesInfo.length) {
453
- // get catched info first
453
+ // get caught info first
454
454
  const pervLineInfo = lineIndex > 0
455
455
  ? this.#cachedLineInfo[lineIndex - 1] ?? {}
456
456
  : undefined;
@@ -40,7 +40,7 @@ let CommonEventsAndMethods = (() => {
40
40
  /**
41
41
  * If this dom is already exposured
42
42
  */
43
- #exposureTriggerd = false;
43
+ #exposureTriggered = false;
44
44
  /**
45
45
  * keeps the observer of current dom
46
46
  */
@@ -158,11 +158,11 @@ let CommonEventsAndMethods = (() => {
158
158
  root = root.parentElement;
159
159
  }
160
160
  }
161
- this.#exposureTriggerd = false;
161
+ this.#exposureTriggered = false;
162
162
  this.#exposureObserver = new IntersectionObserver(([entry]) => {
163
163
  if (entry) {
164
164
  if (entry.isIntersecting) {
165
- this.#exposureTriggerd = true;
165
+ this.#exposureTriggered = true;
166
166
  }
167
167
  this.#sendOneExposureEvent(entry);
168
168
  }
@@ -179,7 +179,7 @@ let CommonEventsAndMethods = (() => {
179
179
  }
180
180
  }
181
181
  #sendOneExposureEvent(entry, overrideExposureId) {
182
- if (!this.#exposureTriggerd) {
182
+ if (!this.#exposureTriggered) {
183
183
  return;
184
184
  }
185
185
  const exposureID = overrideExposureId
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-elements",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
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": "0.2.2",
104
- "@lynx-js/web-elements-template": "0.7.2"
104
+ "@lynx-js/web-elements-template": "0.7.4"
105
105
  },
106
106
  "devDependencies": {
107
107
  "tslib": "^2.8.1"
@@ -5,11 +5,10 @@
5
5
  */
6
6
  x-foldview-ng {
7
7
  display: flex;
8
- overflow-y: scroll;
8
+ overflow-y: scroll !important;
9
9
  overflow-x: clip;
10
10
  overflow-x: hidden;
11
11
  overscroll-behavior: contain;
12
- contain: content;
13
12
  --foldview-header-height: 0px;
14
13
  scrollbar-width: none;
15
14
  }
@@ -13,9 +13,7 @@ x-image, filter-image {
13
13
  }
14
14
 
15
15
  x-image > *,
16
- filter-image > *,
17
- x-image:not(:defined),
18
- filter-image:not(:defined) {
16
+ filter-image > * {
19
17
  display: none;
20
18
  }
21
19
 
@@ -4,10 +4,6 @@
4
4
  // LICENSE file in the root directory of this source tree.
5
5
  */
6
6
  x-input {
7
- display: none;
8
- }
9
-
10
- x-input:defined {
11
7
  display: contents;
12
8
  }
13
9
 
@@ -59,6 +59,7 @@ list-item {
59
59
  display: none;
60
60
  content-visibility: auto;
61
61
  flex: 0 0 auto !important;
62
+ position: static;
62
63
  }
63
64
 
64
65
  x-list > list-item, x-list > lynx-wrapper > list-item {
@@ -3,9 +3,6 @@
3
3
  // Licensed under the Apache License Version 2.0 that can be found in the
4
4
  // LICENSE file in the root directory of this source tree.
5
5
  */
6
- x-overlay-ng:not(:defined) {
7
- display: none;
8
- }
9
6
  x-overlay-ng::part(dialog) {
10
7
  padding: 0;
11
8
  border: 0;
@@ -18,9 +18,6 @@ x-refresh-view {
18
18
  min-height: 0;
19
19
  border-style: solid;
20
20
  }
21
- x-refresh-view:not(:defined) {
22
- display: none;
23
- }
24
21
 
25
22
  x-refresh-view::part(container),
26
23
  x-refresh-view::part(content),
@@ -15,9 +15,6 @@ x-text:not(x-text > x-text):not(x-text > lynx-wrapper > x-text) {
15
15
  --lynx-color: canvastext;
16
16
  --lynx-text-bg-color: initial;
17
17
  }
18
- x-text:not(:defined) {
19
- display: none;
20
- }
21
18
 
22
19
  x-text > * {
23
20
  display: none;
@@ -41,36 +38,35 @@ inline-text, inline-image, inline-truncation {
41
38
  }
42
39
 
43
40
  /* nested components */
44
- x-text > x-text:defined,
45
- x-text > inline-text:defined,
46
- x-text > x-text:defined,
47
- inline-text > inline-text:defined,
48
- inline-truncation > inline-text:defined,
49
- inline-truncation > x-text:defined,
50
- x-text > lynx-wrapper > x-text:defined,
51
- x-text > lynx-wrapper > inline-text:defined,
52
- x-text > lynx-wrapper > x-text:defined,
53
- inline-text > lynx-wrapper > inline-text:defined,
54
- x-text > lynx-wrapper > x:defined,
55
- inline-truncation > lynx-wrapper > inline-text:defined,
56
- inline-truncation > lynx-wrapper > x-text:defined {
41
+ x-text > x-text,
42
+ x-text > inline-text,
43
+ inline-text > inline-text,
44
+ inline-truncation > inline-text,
45
+ inline-truncation > x-text,
46
+ x-text > lynx-wrapper > x-text,
47
+ x-text > lynx-wrapper > inline-text,
48
+ x-text > lynx-wrapper > x-text,
49
+ inline-text > lynx-wrapper > inline-text,
50
+ x-text > lynx-wrapper > *,
51
+ inline-truncation > lynx-wrapper > inline-text,
52
+ inline-truncation > lynx-wrapper > x-text {
57
53
  display: inline;
58
54
  background-clip: inherit;
59
55
  -webkit-background-clip: inherit;
60
56
  }
61
57
 
62
- x-text > inline-image:defined,
63
- x-text > x-image:defined,
64
- inline-truncation > inline-image:defined,
65
- inline-truncation > x-image:defined,
66
- inline-text > inline-image:defined,
67
- inline-text > x-image:defined,
68
- x-text > lynx-wrapper > inline-image:defined,
69
- x-text > lynx-wrapper > x-image:defined,
70
- inline-truncation > lynx-wrapper > inline-image:defined,
71
- inline-truncation > lynx-wrapper > x-image:defined,
72
- inline-text > lynx-wrapper > inline-image:defined,
73
- inline-text > lynx-wrapper > x-image:defined {
58
+ x-text > inline-image,
59
+ x-text > x-image,
60
+ inline-truncation > inline-image,
61
+ inline-truncation > x-image,
62
+ inline-text > inline-image,
63
+ inline-text > x-image,
64
+ x-text > lynx-wrapper > inline-image,
65
+ x-text > lynx-wrapper > x-image,
66
+ inline-truncation > lynx-wrapper > inline-image,
67
+ inline-truncation > lynx-wrapper > x-image,
68
+ inline-text > lynx-wrapper > inline-image,
69
+ inline-text > lynx-wrapper > x-image {
74
70
  display: contents !important;
75
71
  }
76
72
  x-text > x-view, x-text > lynx-wrapper > x-view {
@@ -183,7 +179,7 @@ x-text[x-text-clipped][x-text-custom-overflow]::part(inner-box)::after {
183
179
  * 1. without customized inline-truncation
184
180
  * 2. users do not force we apply styles on the ellipsis
185
181
  *
186
- * Overall, we do calculate the layout of texts with (dispaly:block) for
182
+ * Overall, we do calculate the layout of texts with (display:block) for
187
183
  * 1. analyze the truncation length for a customized inline-truncation (attribute x-text-custom-overflow, selector :has())
188
184
  * 2. users explicit declare that we have to put the ellipsis in place. (with attribute tail-color-convert='false')
189
185
  */
@@ -230,7 +226,7 @@ x-text[text-maxline][tail-color-convert="false"]::part(inner-box) {
230
226
  }
231
227
 
232
228
  raw-text {
233
- display: none;
229
+ display: none; /* raw-text only works in x-text */
234
230
  white-space-collapse: preserve-breaks;
235
231
  }
236
232
  x-text > raw-text,
@@ -239,3 +235,8 @@ x-text > lynx-wrapper > raw-text,
239
235
  inline-text > lynx-wrapper > raw-text {
240
236
  display: contents !important;
241
237
  }
238
+
239
+ raw-text:not(:defined)::before {
240
+ content: attr(text);
241
+ display: contents;
242
+ }
@@ -4,10 +4,6 @@
4
4
  // LICENSE file in the root directory of this source tree.
5
5
  */
6
6
  x-textarea {
7
- display: none;
8
- }
9
-
10
- x-textarea:defined {
11
7
  display: contents;
12
8
  }
13
9
 
@@ -7,9 +7,9 @@ x-viewpager-ng, x-viewpager-item-ng {
7
7
  display: none;
8
8
  }
9
9
 
10
- x-viewpager-ng:defined,
11
- x-viewpager-ng > x-viewpager-item-ng:defined,
12
- x-viewpager-ng > lynx-wrapper > x-viewpager-item-ng:defined {
10
+ x-viewpager-ng,
11
+ x-viewpager-ng > x-viewpager-item-ng,
12
+ x-viewpager-ng > lynx-wrapper > x-viewpager-item-ng {
13
13
  display: flex;
14
14
  }
15
15
 
@@ -146,7 +146,8 @@ x-refresh-header,
146
146
  x-refresh-view,
147
147
  x-swiper-item,
148
148
  x-viewpager-item-ng,
149
- x-viewpager-ng {
149
+ x-viewpager-ng,
150
+ list-item {
150
151
  /*
151
152
  --lynx-display-toggle is compile-time generated.
152
153
  */
@@ -195,7 +196,8 @@ x-refresh-header,
195
196
  x-refresh-view,
196
197
  x-swiper-item,
197
198
  x-viewpager-item-ng,
198
- x-viewpager-ng {
199
+ x-viewpager-ng,
200
+ list-item {
199
201
  flex-wrap: var(--lynx-display-linear, nowrap)
200
202
  var(
201
203
  --lynx-display-flex,