@lynx-js/web-elements 0.5.4 → 0.7.0
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 +77 -0
- package/dist/ScrollView/ScrollAttributes.js +4 -4
- package/dist/ScrollView/ScrollView.js +3 -3
- package/dist/XAudioTT/XAudioTT.js +2 -2
- package/dist/XCanvas/XCanvas.js +2 -2
- package/dist/XFoldViewNg/XFoldviewHeaderNg.d.ts +2 -0
- package/dist/XFoldViewNg/XFoldviewHeaderNg.js +9 -4
- package/dist/XFoldViewNg/XFoldviewNg.d.ts +13 -2
- package/dist/XFoldViewNg/XFoldviewNg.js +43 -5
- package/dist/XFoldViewNg/XFoldviewNgEvents.d.ts +1 -1
- package/dist/XFoldViewNg/XFoldviewNgEvents.js +17 -5
- package/dist/XFoldViewNg/XFoldviewSlotDragNg.js +2 -2
- package/dist/XFoldViewNg/XFoldviewSlotNg.d.ts +1 -0
- package/dist/XFoldViewNg/XFoldviewSlotNg.js +8 -2
- package/dist/XFoldViewNg/XFoldviewSlotNgTouchEventsHandler.js +51 -37
- package/dist/XFoldViewNg/XFoldviewToolbarNg.d.ts +2 -0
- package/dist/XFoldViewNg/XFoldviewToolbarNg.js +9 -2
- package/dist/XImage/FilterImage.js +2 -2
- package/dist/XImage/XImage.js +2 -2
- package/dist/XInput/XInput.js +2 -2
- package/dist/XList/ListItem.js +2 -2
- package/dist/XList/XList.js +4 -3
- package/dist/XList/XListAttributes.js +1 -0
- package/dist/XList/XListEvents.js +5 -3
- package/dist/XList/XListWaterfall.d.ts +8 -0
- package/dist/XList/XListWaterfall.js +144 -0
- package/dist/XOverlayNg/XOverlayNg.d.ts +2 -0
- package/dist/XOverlayNg/XOverlayNg.js +5 -2
- package/dist/XRefreshView/XRefreshFooter.js +2 -2
- package/dist/XRefreshView/XRefreshHeader.js +2 -2
- package/dist/XRefreshView/XRefreshView.js +2 -2
- package/dist/XSvg/XSvg.js +2 -2
- package/dist/XSwiper/SwiperItem.js +2 -2
- package/dist/XSwiper/XSwiper.js +2 -2
- package/dist/XText/RawText.js +4 -4
- package/dist/XText/XText.d.ts +2 -0
- package/dist/XText/XText.js +3 -3
- package/dist/XText/XTextTruncation.js +6 -9
- package/dist/XTextarea/XTextarea.js +2 -2
- package/dist/XView/XBlurView.js +2 -2
- package/dist/XView/XView.d.ts +2 -0
- package/dist/XView/XView.js +5 -3
- package/dist/XViewpagerNg/XViewpagerItemNg.js +2 -2
- package/dist/XViewpagerNg/XViewpagerNg.js +2 -2
- package/dist/common/CommonEventsAndMethods.d.ts +31 -2
- package/dist/common/CommonEventsAndMethods.js +198 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/ScrollView/scroll-view.css +0 -1
- package/src/XFoldViewNg/x-foldview-ng.css +0 -3
- package/src/XImage/x-image.css +1 -0
- package/src/XList/x-list.css +67 -5
- package/src/XText/x-text.css +13 -45
- package/src/common-css/linear.css +10 -8
- package/dist/XFoldViewNg/XFoldviewHeaderNgFeatures.d.ts +0 -9
- package/dist/XFoldViewNg/XFoldviewHeaderNgFeatures.js +0 -32
- package/dist/common/Exposure.d.ts +0 -32
- package/dist/common/Exposure.js +0 -202
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,82 @@
|
|
|
1
1
|
# @lynx-js/web-elements
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fix: ([#629](https://github.com/lynx-family/lynx-stack/pull/629))
|
|
8
|
+
|
|
9
|
+
- typo of `initial-scroll-offset` in scroll-view.
|
|
10
|
+
- scroll-view's `initial-scroll-index` is changed to `initial-scroll-to-index`.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- fix: x-image border-radius setting has no effect. ([#638](https://github.com/lynx-family/lynx-stack/pull/638))
|
|
15
|
+
|
|
16
|
+
- perf: late evaluate document.font.ready ([#604](https://github.com/lynx-family/lynx-stack/pull/604))
|
|
17
|
+
|
|
18
|
+
- perf: improve raw-text performance ([#601](https://github.com/lynx-family/lynx-stack/pull/601))
|
|
19
|
+
|
|
20
|
+
- fix: the scroll-x field of scroll-view needs to be handled correctly. ([#635](https://github.com/lynx-family/lynx-stack/pull/635))
|
|
21
|
+
|
|
22
|
+
Before this, scroll-x of '' would result in no scrolling along x-axis.
|
|
23
|
+
|
|
24
|
+
- feat: x-list supports `need-visible-item-info`, now you can get visible cells info in `scroll`、`scrolltoupper`、`scrolltolower` event. ([#595](https://github.com/lynx-family/lynx-stack/pull/595))
|
|
25
|
+
|
|
26
|
+
## 0.6.0
|
|
27
|
+
|
|
28
|
+
### Minor Changes
|
|
29
|
+
|
|
30
|
+
- fix: When list-type is not specified, it is treated as single formatting. ([#535](https://github.com/lynx-family/lynx-stack/pull/535))
|
|
31
|
+
|
|
32
|
+
- feat: improve compatibility for chrome 108 & support linear-gradient for nested x-text ([#590](https://github.com/lynx-family/lynx-stack/pull/590))
|
|
33
|
+
|
|
34
|
+
**This is a breaking change**
|
|
35
|
+
|
|
36
|
+
- Please upgrade your `@lynx-js/web-elements` to >=0.6.0
|
|
37
|
+
- Please upgrade your `@lynx-js/web-core` to >=0.12.0
|
|
38
|
+
- The compiled lynx template json won't be impacted.
|
|
39
|
+
|
|
40
|
+
On chrome 108, the `-webkit-background-clip:text` cannot be computed by a `var(--css-var-value-text)`
|
|
41
|
+
|
|
42
|
+
Therefore we move the logic into style transformation logic.
|
|
43
|
+
|
|
44
|
+
Now the following status is supported
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
<text style="color:linear-gradient()">
|
|
48
|
+
<text>
|
|
49
|
+
<text>
|
|
50
|
+
</text>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- feat: fully support MTS ([#569](https://github.com/lynx-family/lynx-stack/pull/569))
|
|
56
|
+
|
|
57
|
+
Now use support the following usage
|
|
58
|
+
|
|
59
|
+
- mainthread event
|
|
60
|
+
- mainthread ref
|
|
61
|
+
- runOnMainThread/runOnBackground
|
|
62
|
+
- ref.current.xx
|
|
63
|
+
|
|
64
|
+
- feat: support `layoutchange` event for x-overlay-ng ([#519](https://github.com/lynx-family/lynx-stack/pull/519))
|
|
65
|
+
|
|
66
|
+
- fix: position:fixed not work in scroll-view ([#580](https://github.com/lynx-family/lynx-stack/pull/580))
|
|
67
|
+
|
|
68
|
+
- fix: x-list may cause error: 'Resizeobserver loop completed with undelivered notifications'. ([#541](https://github.com/lynx-family/lynx-stack/pull/541))
|
|
69
|
+
|
|
70
|
+
- fix: refactor foldview slot offset logic ([#575](https://github.com/lynx-family/lynx-stack/pull/575))
|
|
71
|
+
|
|
72
|
+
- fix: improve x-foldview-ng ([#513](https://github.com/lynx-family/lynx-stack/pull/513))
|
|
73
|
+
|
|
74
|
+
- support fling for touch event driven scrolling
|
|
75
|
+
- allow the height of `x-foldview-slot-ng` + `x-foldview-toolbar-ng` > `x-foldview-ng`
|
|
76
|
+
- do not prevent horizontal gesture. After this commit we only allow one direction gesture for one touch (start -> end)
|
|
77
|
+
|
|
78
|
+
- feat: add list with waterfall ([#331](https://github.com/lynx-family/lynx-stack/pull/331))
|
|
79
|
+
|
|
3
80
|
## 0.5.4
|
|
4
81
|
|
|
5
82
|
### Patch Changes
|
|
@@ -14,8 +14,8 @@ let ScrollAttributes = (() => {
|
|
|
14
14
|
return class ScrollAttributes {
|
|
15
15
|
static {
|
|
16
16
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
17
|
-
_private_handleInitialScrollOffset_decorators = [registerAttributeHandler('scroll-top', false), registerAttributeHandler('scroll-left', false), registerAttributeHandler('
|
|
18
|
-
_private_handleInitialScrollIndex_decorators = [registerAttributeHandler('scroll-to-index', false), registerAttributeHandler('initial-scroll-index', false)];
|
|
17
|
+
_private_handleInitialScrollOffset_decorators = [registerAttributeHandler('scroll-top', false), registerAttributeHandler('scroll-left', false), registerAttributeHandler('initial-scroll-offset', false)];
|
|
18
|
+
_private_handleInitialScrollIndex_decorators = [registerAttributeHandler('scroll-to-index', false), registerAttributeHandler('initial-scroll-to-index', false)];
|
|
19
19
|
__esDecorate(this, _private_handleInitialScrollOffset_descriptor = { value: __setFunctionName(function (newVal, _, attributeName) {
|
|
20
20
|
if (newVal) {
|
|
21
21
|
const scrollValue = parseFloat(newVal);
|
|
@@ -49,7 +49,7 @@ let ScrollAttributes = (() => {
|
|
|
49
49
|
const scrollValue = parseFloat(newVal);
|
|
50
50
|
const childrenElement = this.#dom.children.item(scrollValue);
|
|
51
51
|
if (childrenElement && childrenElement instanceof HTMLElement) {
|
|
52
|
-
const scrollX =
|
|
52
|
+
const scrollX = this.#dom.getAttribute('scroll-x') !== null;
|
|
53
53
|
requestAnimationFrame(() => {
|
|
54
54
|
if (scrollX) {
|
|
55
55
|
this.#dom.scrollLeft = childrenElement.offsetLeft;
|
|
@@ -69,7 +69,7 @@ let ScrollAttributes = (() => {
|
|
|
69
69
|
'scroll-left',
|
|
70
70
|
'initial-scroll-offset',
|
|
71
71
|
'scroll-to-index',
|
|
72
|
-
'initial-scroll-index',
|
|
72
|
+
'initial-scroll-to-index',
|
|
73
73
|
];
|
|
74
74
|
constructor(dom) {
|
|
75
75
|
this.#dom = dom;
|
|
@@ -4,16 +4,16 @@ import { __esDecorate, __runInitializers } from "tslib";
|
|
|
4
4
|
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
|
|
8
8
|
import { FadeEdgeLengthAttribute } from './FadeEdgeLengthAttribute.js';
|
|
9
9
|
import { ScrollAttributes } from './ScrollAttributes.js';
|
|
10
10
|
import { ScrollViewEvents } from './ScrollViewEvents.js';
|
|
11
11
|
import { ScrollIntoView } from './ScrollIntoView.js';
|
|
12
|
-
import { Component,
|
|
12
|
+
import { Component, html } from '@lynx-js/web-elements-reactive';
|
|
13
13
|
import { scrollContainerDom } from '../common/constants.js';
|
|
14
14
|
let ScrollView = (() => {
|
|
15
15
|
let _classDecorators = [Component('scroll-view', [
|
|
16
|
-
|
|
16
|
+
CommonEventsAndMethods,
|
|
17
17
|
ScrollAttributes,
|
|
18
18
|
FadeEdgeLengthAttribute,
|
|
19
19
|
ScrollViewEvents,
|
|
@@ -7,11 +7,11 @@ import { __esDecorate, __runInitializers } from "tslib";
|
|
|
7
7
|
import { Component, html, genDomGetter, bindToAttribute, } from '@lynx-js/web-elements-reactive';
|
|
8
8
|
import { XAudioAttribute } from './XAudioAttribute.js';
|
|
9
9
|
import { XAudioEvents } from './XAudioEvents.js';
|
|
10
|
-
import {
|
|
10
|
+
import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
|
|
11
11
|
import { commonComponentEventSetting } from '../common/commonEventInitConfiguration.js';
|
|
12
12
|
import { XAudioErrorCode, audioPlaybackStateMap, getAudioState, xAudioBlob, xAudioSrc, } from './utils.js';
|
|
13
13
|
let XAudioTT = (() => {
|
|
14
|
-
let _classDecorators = [Component('x-audio-tt', [
|
|
14
|
+
let _classDecorators = [Component('x-audio-tt', [CommonEventsAndMethods, XAudioAttribute, XAudioEvents], html `<audio id="audio"></audio>`)];
|
|
15
15
|
let _classDescriptor;
|
|
16
16
|
let _classExtraInitializers = [];
|
|
17
17
|
let _classThis;
|
package/dist/XCanvas/XCanvas.js
CHANGED
|
@@ -5,13 +5,13 @@ import { __esDecorate, __runInitializers } from "tslib";
|
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { Component, html } from '@lynx-js/web-elements-reactive';
|
|
8
|
-
import {
|
|
8
|
+
import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
|
|
9
9
|
import { CanvasAttributes } from './CanvasAttributes.js';
|
|
10
10
|
/**
|
|
11
11
|
* @deprecated this proposals cannot be implemented on other platforms
|
|
12
12
|
*/
|
|
13
13
|
let XCanvas = (() => {
|
|
14
|
-
let _classDecorators = [Component('x-canvas', [
|
|
14
|
+
let _classDecorators = [Component('x-canvas', [CommonEventsAndMethods, CanvasAttributes], html `<canvas id="canvas" part="canvas"></canvas>`)];
|
|
15
15
|
let _classDescriptor;
|
|
16
16
|
let _classExtraInitializers = [];
|
|
17
17
|
let _classThis;
|
|
@@ -5,12 +5,11 @@ import { __esDecorate, __runInitializers } from "tslib";
|
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { Component } from '@lynx-js/web-elements-reactive';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
|
|
9
|
+
import { resizeObserver } from './XFoldviewNg.js';
|
|
10
10
|
let XFoldviewHeaderNg = (() => {
|
|
11
11
|
let _classDecorators = [Component('x-foldview-header-ng', [
|
|
12
|
-
|
|
13
|
-
XFoldviewHeaderNgFeatures,
|
|
12
|
+
CommonEventsAndMethods,
|
|
14
13
|
])];
|
|
15
14
|
let _classDescriptor;
|
|
16
15
|
let _classExtraInitializers = [];
|
|
@@ -25,6 +24,12 @@ let XFoldviewHeaderNg = (() => {
|
|
|
25
24
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
26
25
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
27
26
|
}
|
|
27
|
+
connectedCallback() {
|
|
28
|
+
this.parentElement?.[resizeObserver]?.observe(this);
|
|
29
|
+
}
|
|
30
|
+
dispose() {
|
|
31
|
+
this.parentElement?.[resizeObserver]?.unobserve(this);
|
|
32
|
+
}
|
|
28
33
|
};
|
|
29
34
|
return XFoldviewHeaderNg = _classThis;
|
|
30
35
|
})();
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { scrollContainerDom } from '../common/constants.js';
|
|
2
|
+
import type { XFoldviewSlotNg } from './XFoldviewSlotNg.js';
|
|
3
|
+
export declare const scrollableLength: unique symbol;
|
|
4
|
+
export declare const isHeaderShowing: unique symbol;
|
|
5
|
+
export declare const resizeObserver: unique symbol;
|
|
6
|
+
export declare const slotKid: unique symbol;
|
|
2
7
|
export declare class XFoldviewNg extends HTMLElement {
|
|
8
|
+
#private;
|
|
3
9
|
static readonly notToFilterFalseAttributes: Set<string>;
|
|
4
|
-
|
|
5
|
-
|
|
10
|
+
[slotKid]?: XFoldviewSlotNg;
|
|
11
|
+
[resizeObserver]?: ResizeObserver;
|
|
12
|
+
get [scrollableLength](): number;
|
|
13
|
+
get [isHeaderShowing](): boolean;
|
|
14
|
+
get scrollTop(): number;
|
|
15
|
+
set scrollTop(value: number);
|
|
6
16
|
setFoldExpanded(params: {
|
|
7
17
|
offset: string;
|
|
8
18
|
smooth: boolean;
|
|
9
19
|
}): void;
|
|
10
20
|
get [scrollContainerDom](): this;
|
|
21
|
+
disconnectedCallback(): void;
|
|
11
22
|
}
|
|
@@ -5,12 +5,16 @@ import { __esDecorate, __runInitializers } from "tslib";
|
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { Component } from '@lynx-js/web-elements-reactive';
|
|
8
|
-
import {
|
|
8
|
+
import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
|
|
9
9
|
import { XFoldviewNgEvents } from './XFoldviewNgEvents.js';
|
|
10
10
|
import { scrollContainerDom } from '../common/constants.js';
|
|
11
|
+
export const scrollableLength = Symbol('scrollableLength');
|
|
12
|
+
export const isHeaderShowing = Symbol('isHeaderShowing');
|
|
13
|
+
export const resizeObserver = Symbol('resizeObserver');
|
|
14
|
+
export const slotKid = Symbol('slotKid');
|
|
11
15
|
let XFoldviewNg = (() => {
|
|
12
16
|
let _classDecorators = [Component('x-foldview-ng', [
|
|
13
|
-
|
|
17
|
+
CommonEventsAndMethods,
|
|
14
18
|
XFoldviewNgEvents,
|
|
15
19
|
])];
|
|
16
20
|
let _classDescriptor;
|
|
@@ -26,10 +30,40 @@ let XFoldviewNg = (() => {
|
|
|
26
30
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
27
31
|
}
|
|
28
32
|
static notToFilterFalseAttributes = new Set(['scroll-enable']);
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
[slotKid];
|
|
34
|
+
[resizeObserver] = new ResizeObserver((resizeEntries) => {
|
|
35
|
+
for (const resize of resizeEntries) {
|
|
36
|
+
if (resize.target.tagName === 'X-FOLDVIEW-HEADER-NG') {
|
|
37
|
+
this.#headerHeight = resize.contentRect.height;
|
|
38
|
+
}
|
|
39
|
+
else if (resize.target.tagName === 'X-FOLDVIEW-TOOLBAR-NG') {
|
|
40
|
+
this.#toolbarHeight = resize.contentRect.height;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (this[slotKid]) {
|
|
44
|
+
this[slotKid].style.top = `${this.#headerHeight - this.#toolbarHeight}px`;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
#headerHeight = 0;
|
|
48
|
+
#toolbarHeight = 0;
|
|
49
|
+
get [scrollableLength]() {
|
|
50
|
+
return this.#headerHeight - this.#toolbarHeight;
|
|
51
|
+
}
|
|
52
|
+
get [isHeaderShowing]() {
|
|
31
53
|
// This behavior cannot be reproduced in the current test, but can be reproduced in Android WebView
|
|
32
|
-
return
|
|
54
|
+
return this[scrollableLength] - this.scrollTop >= 1;
|
|
55
|
+
}
|
|
56
|
+
get scrollTop() {
|
|
57
|
+
return super.scrollTop;
|
|
58
|
+
}
|
|
59
|
+
set scrollTop(value) {
|
|
60
|
+
if (value > this[scrollableLength]) {
|
|
61
|
+
value = this[scrollableLength];
|
|
62
|
+
}
|
|
63
|
+
else if (value < 0) {
|
|
64
|
+
value = 0;
|
|
65
|
+
}
|
|
66
|
+
super.scrollTop = value;
|
|
33
67
|
}
|
|
34
68
|
setFoldExpanded(params) {
|
|
35
69
|
const { offset, smooth = true } = params;
|
|
@@ -42,6 +76,10 @@ let XFoldviewNg = (() => {
|
|
|
42
76
|
get [scrollContainerDom]() {
|
|
43
77
|
return this;
|
|
44
78
|
}
|
|
79
|
+
disconnectedCallback() {
|
|
80
|
+
this[resizeObserver]?.disconnect();
|
|
81
|
+
this[resizeObserver] = undefined;
|
|
82
|
+
}
|
|
45
83
|
static {
|
|
46
84
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
47
85
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AttributeReactiveClass } from '@lynx-js/web-elements-reactive';
|
|
2
|
-
import type
|
|
2
|
+
import { type XFoldviewNg } from './XFoldviewNg.js';
|
|
3
3
|
export declare class XFoldviewNgEvents implements InstanceType<AttributeReactiveClass<typeof XFoldviewNg>> {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(dom: XFoldviewNg);
|
|
@@ -4,22 +4,36 @@ import { __esDecorate, __runInitializers, __setFunctionName } from "tslib";
|
|
|
4
4
|
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import { registerAttributeHandler, } from '@lynx-js/web-elements-reactive';
|
|
7
|
+
import { registerAttributeHandler, registerEventEnableStatusChangeHandler, } from '@lynx-js/web-elements-reactive';
|
|
8
8
|
import { commonComponentEventSetting } from '../common/commonEventInitConfiguration.js';
|
|
9
|
+
import { scrollableLength } from './XFoldviewNg.js';
|
|
9
10
|
let XFoldviewNgEvents = (() => {
|
|
10
11
|
let _instanceExtraInitializers = [];
|
|
11
12
|
let _private_handleGranularity_decorators;
|
|
12
13
|
let _private_handleGranularity_descriptor;
|
|
14
|
+
let _private_enableOffsetEvent_decorators;
|
|
15
|
+
let _private_enableOffsetEvent_descriptor;
|
|
13
16
|
return class XFoldviewNgEvents {
|
|
14
17
|
static {
|
|
15
18
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
16
19
|
_private_handleGranularity_decorators = [registerAttributeHandler('granularity', true)];
|
|
20
|
+
_private_enableOffsetEvent_decorators = [registerEventEnableStatusChangeHandler('offset')];
|
|
17
21
|
__esDecorate(this, _private_handleGranularity_descriptor = { value: __setFunctionName(function (newVal) {
|
|
18
22
|
if (newVal && newVal !== '')
|
|
19
23
|
this.#granularity = parseFloat(newVal);
|
|
20
24
|
else
|
|
21
25
|
this.#granularity = 0.01;
|
|
22
26
|
}, "#handleGranularity") }, _private_handleGranularity_decorators, { kind: "method", name: "#handleGranularity", static: false, private: true, access: { has: obj => #handleGranularity in obj, get: obj => obj.#handleGranularity }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
27
|
+
__esDecorate(this, _private_enableOffsetEvent_descriptor = { value: __setFunctionName(function (enable) {
|
|
28
|
+
if (enable) {
|
|
29
|
+
this.#dom.addEventListener('scroll', this.#handleScroll, {
|
|
30
|
+
passive: true,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.#dom.removeEventListener('scroll', this.#handleScroll);
|
|
35
|
+
}
|
|
36
|
+
}, "#enableOffsetEvent") }, _private_enableOffsetEvent_decorators, { kind: "method", name: "#enableOffsetEvent", static: false, private: true, access: { has: obj => #enableOffsetEvent in obj, get: obj => obj.#enableOffsetEvent }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
23
37
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
24
38
|
}
|
|
25
39
|
#dom = __runInitializers(this, _instanceExtraInitializers);
|
|
@@ -27,12 +41,10 @@ let XFoldviewNgEvents = (() => {
|
|
|
27
41
|
#pervScroll = 0;
|
|
28
42
|
constructor(dom) {
|
|
29
43
|
this.#dom = dom;
|
|
30
|
-
this.#dom.addEventListener('scroll', this.#handleScroll, {
|
|
31
|
-
passive: true,
|
|
32
|
-
});
|
|
33
44
|
}
|
|
34
45
|
static observedAttributes = ['granularity'];
|
|
35
46
|
get #handleGranularity() { return _private_handleGranularity_descriptor.value; }
|
|
47
|
+
get #enableOffsetEvent() { return _private_enableOffsetEvent_descriptor.value; }
|
|
36
48
|
#handleScroll = () => {
|
|
37
49
|
const curentScrollTop = this.#dom.scrollTop;
|
|
38
50
|
const scrollLength = Math.abs(this.#pervScroll - curentScrollTop);
|
|
@@ -44,7 +56,7 @@ let XFoldviewNgEvents = (() => {
|
|
|
44
56
|
...commonComponentEventSetting,
|
|
45
57
|
detail: {
|
|
46
58
|
offset: curentScrollTop,
|
|
47
|
-
height: this.#dom
|
|
59
|
+
height: this.#dom[scrollableLength],
|
|
48
60
|
},
|
|
49
61
|
}));
|
|
50
62
|
}
|
|
@@ -5,10 +5,10 @@ import { __esDecorate, __runInitializers } from "tslib";
|
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { Component } from '@lynx-js/web-elements-reactive';
|
|
8
|
-
import {
|
|
8
|
+
import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
|
|
9
9
|
let XFoldviewSlotDragNg = (() => {
|
|
10
10
|
let _classDecorators = [Component('x-foldivew-slot-drag-ng', [
|
|
11
|
-
|
|
11
|
+
CommonEventsAndMethods,
|
|
12
12
|
])];
|
|
13
13
|
let _classDescriptor;
|
|
14
14
|
let _classExtraInitializers = [];
|
|
@@ -5,11 +5,12 @@ import { __esDecorate, __runInitializers } from "tslib";
|
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { Component } from '@lynx-js/web-elements-reactive';
|
|
8
|
-
import {
|
|
8
|
+
import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
|
|
9
9
|
import { XFoldviewSlotNgTouchEventsHandler } from './XFoldviewSlotNgTouchEventsHandler.js';
|
|
10
|
+
import { slotKid } from './XFoldviewNg.js';
|
|
10
11
|
let XFoldviewSlotNg = (() => {
|
|
11
12
|
let _classDecorators = [Component('x-foldview-slot-ng', [
|
|
12
|
-
|
|
13
|
+
CommonEventsAndMethods,
|
|
13
14
|
XFoldviewSlotNgTouchEventsHandler,
|
|
14
15
|
])];
|
|
15
16
|
let _classDescriptor;
|
|
@@ -25,6 +26,11 @@ let XFoldviewSlotNg = (() => {
|
|
|
25
26
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
26
27
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
27
28
|
}
|
|
29
|
+
connectedCallback() {
|
|
30
|
+
if (this.matches('x-foldview-ng>x-foldview-slot-ng:first-of-type')) {
|
|
31
|
+
this.parentElement[slotKid] = this;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
28
34
|
};
|
|
29
35
|
return XFoldviewSlotNg = _classThis;
|
|
30
36
|
})();
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { isHeaderShowing } from './XFoldviewNg.js';
|
|
1
2
|
import { isChromium } from '../common/constants.js';
|
|
2
3
|
export class XFoldviewSlotNgTouchEventsHandler {
|
|
3
4
|
#parentScrollTop = 0;
|
|
4
5
|
#childrenElemsntsScrollTop = new WeakMap();
|
|
5
|
-
#childrenElemsntsScrollLeft = new WeakMap();
|
|
6
6
|
#elements;
|
|
7
7
|
#previousPageY = 0;
|
|
8
8
|
#previousPageX = 0;
|
|
9
|
+
#scrollingVertically = null;
|
|
10
|
+
#currentScrollingElement;
|
|
11
|
+
#deltaY = 0;
|
|
9
12
|
#dom;
|
|
10
13
|
static observedAttributes = [];
|
|
11
14
|
constructor(dom) {
|
|
@@ -13,76 +16,72 @@ export class XFoldviewSlotNgTouchEventsHandler {
|
|
|
13
16
|
this.#dom.addEventListener('touchmove', this.#scroller, {
|
|
14
17
|
passive: false,
|
|
15
18
|
});
|
|
16
|
-
this.#dom.addEventListener('touchstart', this.#
|
|
19
|
+
this.#dom.addEventListener('touchstart', this.#touchStart, {
|
|
17
20
|
passive: true,
|
|
18
21
|
});
|
|
19
|
-
this.#dom.addEventListener('
|
|
22
|
+
this.#dom.addEventListener('touchend', this.#touchEnd, {
|
|
20
23
|
passive: true,
|
|
21
24
|
});
|
|
22
25
|
}
|
|
23
|
-
#getTheMostScrollableKid(delta
|
|
26
|
+
#getTheMostScrollableKid(delta) {
|
|
24
27
|
const scrollableKid = this.#elements?.find((element) => {
|
|
25
|
-
if (
|
|
26
|
-
|| (!isVertical && element.scrollWidth > element.clientWidth)) {
|
|
28
|
+
if (element.scrollHeight > element.clientHeight) {
|
|
27
29
|
const couldScrollNear = delta < 0
|
|
28
|
-
&&
|
|
30
|
+
&& element.scrollTop !== 0;
|
|
29
31
|
const couldScrollFar = delta > 0
|
|
30
|
-
&& Math.abs(
|
|
31
|
-
|
|
32
|
-
- element.scrollTop)
|
|
33
|
-
: (element.scrollWidth - element.clientWidth
|
|
34
|
-
- element.scrollLeft)) > 1;
|
|
32
|
+
&& Math.abs(element.scrollHeight - element.clientHeight
|
|
33
|
+
- element.scrollTop) > 1;
|
|
35
34
|
return couldScrollNear || couldScrollFar;
|
|
36
35
|
}
|
|
37
36
|
return false;
|
|
38
37
|
});
|
|
39
38
|
return scrollableKid;
|
|
40
39
|
}
|
|
41
|
-
#scrollKid(scrollableKid, delta
|
|
42
|
-
let targetKidScrollDistance = (
|
|
43
|
-
? this.#childrenElemsntsScrollTop
|
|
44
|
-
: this.#childrenElemsntsScrollLeft)
|
|
45
|
-
.get(scrollableKid) ?? 0;
|
|
40
|
+
#scrollKid(scrollableKid, delta) {
|
|
41
|
+
let targetKidScrollDistance = this.#childrenElemsntsScrollTop.get(scrollableKid) ?? 0;
|
|
46
42
|
targetKidScrollDistance += delta;
|
|
47
43
|
this.#childrenElemsntsScrollTop.set(scrollableKid, targetKidScrollDistance);
|
|
48
|
-
|
|
49
|
-
? (scrollableKid.scrollTop = targetKidScrollDistance)
|
|
50
|
-
: (scrollableKid.scrollLeft = targetKidScrollDistance);
|
|
44
|
+
scrollableKid.scrollTop = targetKidScrollDistance;
|
|
51
45
|
}
|
|
52
46
|
#scroller = (event) => {
|
|
53
47
|
const parentElement = this.#getParentElement();
|
|
54
48
|
const touch = event.touches.item(0);
|
|
55
49
|
const { pageY, pageX } = touch;
|
|
56
50
|
const deltaY = this.#previousPageY - pageY;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
51
|
+
if (this.#scrollingVertically === null) {
|
|
52
|
+
const deltaX = this.#previousPageX - pageX;
|
|
53
|
+
this.#scrollingVertically = Math.abs(deltaY) > Math.abs(deltaX);
|
|
54
|
+
}
|
|
55
|
+
if (this.#scrollingVertically === false) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const scrollableKidY = this.#getTheMostScrollableKid(deltaY);
|
|
59
|
+
if (parentElement) {
|
|
60
|
+
if (event.cancelable) {
|
|
66
61
|
event.preventDefault();
|
|
67
|
-
if (scrollableKidX) {
|
|
68
|
-
this.#scrollKid(scrollableKidX, deltaX, false);
|
|
69
|
-
}
|
|
70
62
|
}
|
|
71
|
-
if ((parentElement
|
|
63
|
+
if ((parentElement[isHeaderShowing] && deltaY > 0
|
|
72
64
|
|| (deltaY < 0 && !scrollableKidY))
|
|
73
65
|
// deltaY > 0: swipe up (folding header)
|
|
74
66
|
// scroll the foldview if its scrollable
|
|
75
|
-
|| (!parentElement
|
|
67
|
+
|| (!parentElement[isHeaderShowing] && !scrollableKidY)
|
|
76
68
|
// all sub doms are scrolled
|
|
77
69
|
) {
|
|
70
|
+
parentElement.scrollBy({
|
|
71
|
+
top: deltaY,
|
|
72
|
+
behavior: 'smooth',
|
|
73
|
+
});
|
|
78
74
|
this.#parentScrollTop += deltaY;
|
|
79
75
|
parentElement.scrollTop = this.#parentScrollTop;
|
|
76
|
+
this.#currentScrollingElement = parentElement;
|
|
80
77
|
}
|
|
81
78
|
else if (scrollableKidY) {
|
|
82
|
-
this.#
|
|
79
|
+
this.#currentScrollingElement = scrollableKidY;
|
|
80
|
+
this.#scrollKid(scrollableKidY, deltaY);
|
|
83
81
|
}
|
|
84
82
|
}
|
|
85
83
|
this.#previousPageY = pageY;
|
|
84
|
+
this.#deltaY = deltaY;
|
|
86
85
|
};
|
|
87
86
|
#getParentElement() {
|
|
88
87
|
const parentElement = this.#dom.parentElement;
|
|
@@ -90,7 +89,7 @@ export class XFoldviewSlotNgTouchEventsHandler {
|
|
|
90
89
|
return parentElement;
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
|
-
#
|
|
92
|
+
#touchStart = (event) => {
|
|
94
93
|
const { pageX, pageY } = event.touches.item(0);
|
|
95
94
|
this.#elements = document.elementsFromPoint(pageX, pageY).filter(e => this.#dom.contains(e));
|
|
96
95
|
this.#previousPageY = pageY;
|
|
@@ -98,7 +97,22 @@ export class XFoldviewSlotNgTouchEventsHandler {
|
|
|
98
97
|
this.#parentScrollTop = this.#getParentElement()?.scrollTop ?? 0;
|
|
99
98
|
for (const element of this.#elements) {
|
|
100
99
|
this.#childrenElemsntsScrollTop.set(element, element.scrollTop);
|
|
101
|
-
|
|
100
|
+
}
|
|
101
|
+
this.#scrollingVertically = null;
|
|
102
|
+
this.#currentScrollingElement = undefined;
|
|
103
|
+
};
|
|
104
|
+
#touchEnd = () => {
|
|
105
|
+
this.#scrollingVertically = null;
|
|
106
|
+
if (this.#currentScrollingElement) {
|
|
107
|
+
const parentElement = this.#getParentElement();
|
|
108
|
+
if (this.#currentScrollingElement === parentElement
|
|
109
|
+
&& !parentElement[isHeaderShowing]) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
this.#currentScrollingElement.scrollBy({
|
|
113
|
+
top: this.#deltaY * 4,
|
|
114
|
+
behavior: 'smooth',
|
|
115
|
+
});
|
|
102
116
|
}
|
|
103
117
|
};
|
|
104
118
|
}
|
|
@@ -5,10 +5,11 @@ import { __esDecorate, __runInitializers } from "tslib";
|
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { Component } from '@lynx-js/web-elements-reactive';
|
|
8
|
-
import {
|
|
8
|
+
import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
|
|
9
|
+
import { resizeObserver } from './XFoldviewNg.js';
|
|
9
10
|
let XFoldviewToolbarNg = (() => {
|
|
10
11
|
let _classDecorators = [Component('x-foldview-toolbar-ng', [
|
|
11
|
-
|
|
12
|
+
CommonEventsAndMethods,
|
|
12
13
|
])];
|
|
13
14
|
let _classDescriptor;
|
|
14
15
|
let _classExtraInitializers = [];
|
|
@@ -23,6 +24,12 @@ let XFoldviewToolbarNg = (() => {
|
|
|
23
24
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
24
25
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
25
26
|
}
|
|
27
|
+
connectedCallback() {
|
|
28
|
+
this.parentElement?.[resizeObserver]?.observe(this);
|
|
29
|
+
}
|
|
30
|
+
dispose() {
|
|
31
|
+
this.parentElement?.[resizeObserver]?.unobserve(this);
|
|
32
|
+
}
|
|
26
33
|
};
|
|
27
34
|
return XFoldviewToolbarNg = _classThis;
|
|
28
35
|
})();
|
|
@@ -5,12 +5,12 @@ import { __esDecorate, __runInitializers } from "tslib";
|
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { Component, html } from '@lynx-js/web-elements-reactive';
|
|
8
|
-
import {
|
|
8
|
+
import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
|
|
9
9
|
import { DropShadow } from './DropShadow.js';
|
|
10
10
|
import { ImageSrc } from './ImageSrc.js';
|
|
11
11
|
import { ImageEvents } from './ImageEvents.js';
|
|
12
12
|
let FilterImage = (() => {
|
|
13
|
-
let _classDecorators = [Component('filter-image', [
|
|
13
|
+
let _classDecorators = [Component('filter-image', [CommonEventsAndMethods, ImageSrc, DropShadow, ImageEvents], html ` <img part="img" alt="" id="img" /> `)];
|
|
14
14
|
let _classDescriptor;
|
|
15
15
|
let _classExtraInitializers = [];
|
|
16
16
|
let _classThis;
|
package/dist/XImage/XImage.js
CHANGED
|
@@ -5,11 +5,11 @@ import { __esDecorate, __runInitializers } from "tslib";
|
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { Component, html } from '@lynx-js/web-elements-reactive';
|
|
8
|
-
import {
|
|
8
|
+
import { CommonEventsAndMethods } from '../common/CommonEventsAndMethods.js';
|
|
9
9
|
import { ImageSrc } from './ImageSrc.js';
|
|
10
10
|
import { ImageEvents } from './ImageEvents.js';
|
|
11
11
|
let XImage = (() => {
|
|
12
|
-
let _classDecorators = [Component('x-image', [
|
|
12
|
+
let _classDecorators = [Component('x-image', [CommonEventsAndMethods, ImageSrc, ImageEvents], html ` <img part="img" alt="" id="img" /> `)];
|
|
13
13
|
let _classDescriptor;
|
|
14
14
|
let _classExtraInitializers = [];
|
|
15
15
|
let _classThis;
|