@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 +32 -0
- package/README.md +19 -20
- package/dist/XFoldViewNg/XFoldviewNgEvents.js +4 -4
- package/dist/XList/XListAttributes.js +0 -1
- package/dist/XList/XListWaterfall.d.ts +1 -2
- package/dist/XList/XListWaterfall.js +149 -124
- package/dist/XText/XTextTruncation.js +11 -11
- package/dist/common/CommonEventsAndMethods.js +4 -4
- package/package.json +2 -2
- package/src/XFoldViewNg/x-foldview-ng.css +1 -2
- package/src/XImage/x-image.css +1 -3
- package/src/XInput/x-input.css +0 -4
- package/src/XList/x-list.css +1 -0
- package/src/XOverlayNg/x-overlay-ng.css +0 -3
- package/src/XRefreshView/x-refresh-view.css +0 -3
- package/src/XText/x-text.css +31 -30
- package/src/XTextarea/x-textarea.css +0 -4
- package/src/XViewpagerNg/x-viewpager-ng.css +3 -3
- package/src/common-css/linear.css +4 -2
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
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
| x-
|
|
19
|
-
| x-
|
|
20
|
-
| x-
|
|
21
|
-
| x-
|
|
22
|
-
| x-
|
|
23
|
-
| x-
|
|
24
|
-
| x-
|
|
25
|
-
| x-
|
|
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
|
|
50
|
-
const scrollLength = Math.abs(this.#pervScroll -
|
|
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 =
|
|
54
|
+
this.#pervScroll = currentScrollTop;
|
|
55
55
|
this.#dom.dispatchEvent(new CustomEvent('offset', {
|
|
56
56
|
...commonComponentEventSetting,
|
|
57
57
|
detail: {
|
|
58
|
-
offset:
|
|
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:
|
|
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 {
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
68
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
116
|
-
|
|
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
|
-
|
|
120
|
-
|
|
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
|
-
#
|
|
114
|
-
const
|
|
115
|
-
let
|
|
116
|
-
while ((
|
|
117
|
-
if (
|
|
118
|
-
||
|
|
119
|
-
|
|
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
|
|
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.#
|
|
211
|
+
toBeHideNodes = toBeHideNodes.concat(this.#getAllSiblings(targetNode));
|
|
212
212
|
let targetNodeParentElement = targetNode.parentElement;
|
|
213
213
|
while (targetNodeParentElement !== this.#dom) {
|
|
214
|
-
toBeHideNodes = toBeHideNodes.concat(this.#
|
|
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
|
|
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
|
-
#
|
|
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.#
|
|
161
|
+
this.#exposureTriggered = false;
|
|
162
162
|
this.#exposureObserver = new IntersectionObserver(([entry]) => {
|
|
163
163
|
if (entry) {
|
|
164
164
|
if (entry.isIntersecting) {
|
|
165
|
-
this.#
|
|
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.#
|
|
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.
|
|
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.
|
|
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
|
}
|
package/src/XImage/x-image.css
CHANGED
package/src/XInput/x-input.css
CHANGED
package/src/XList/x-list.css
CHANGED
package/src/XText/x-text.css
CHANGED
|
@@ -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
|
|
45
|
-
x-text > inline-text
|
|
46
|
-
|
|
47
|
-
inline-
|
|
48
|
-
inline-truncation >
|
|
49
|
-
|
|
50
|
-
x-text > lynx-wrapper >
|
|
51
|
-
x-text > lynx-wrapper >
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
inline-truncation > lynx-wrapper >
|
|
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
|
|
63
|
-
x-text > x-image
|
|
64
|
-
inline-truncation > inline-image
|
|
65
|
-
inline-truncation > x-image
|
|
66
|
-
inline-text > inline-image
|
|
67
|
-
inline-text > x-image
|
|
68
|
-
x-text > lynx-wrapper > inline-image
|
|
69
|
-
x-text > lynx-wrapper > x-image
|
|
70
|
-
inline-truncation > lynx-wrapper > inline-image
|
|
71
|
-
inline-truncation > lynx-wrapper > x-image
|
|
72
|
-
inline-text > lynx-wrapper > inline-image
|
|
73
|
-
inline-text > lynx-wrapper > x-image
|
|
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 (
|
|
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
|
+
}
|
|
@@ -7,9 +7,9 @@ x-viewpager-ng, x-viewpager-item-ng {
|
|
|
7
7
|
display: none;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
x-viewpager-ng
|
|
11
|
-
x-viewpager-ng > x-viewpager-item-ng
|
|
12
|
-
x-viewpager-ng > lynx-wrapper > x-viewpager-item-ng
|
|
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,
|