@lynx-js/web-elements 0.2.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 +323 -0
- package/LICENSE.txt +202 -0
- package/Notice.txt +1 -0
- package/README.md +47 -0
- package/dist/LynxWrapper/LynxWrapper.d.ts +2 -0
- package/dist/LynxWrapper/LynxWrapper.js +27 -0
- package/dist/LynxWrapper/index.d.ts +1 -0
- package/dist/LynxWrapper/index.js +2 -0
- package/dist/ScrollView/FadeEdgeLengthAttribute.d.ts +10 -0
- package/dist/ScrollView/FadeEdgeLengthAttribute.js +43 -0
- package/dist/ScrollView/ScrollAttributes.d.ts +8 -0
- package/dist/ScrollView/ScrollAttributes.js +83 -0
- package/dist/ScrollView/ScrollIntoView.d.ts +9 -0
- package/dist/ScrollView/ScrollIntoView.js +71 -0
- package/dist/ScrollView/ScrollView.d.ts +31 -0
- package/dist/ScrollView/ScrollView.js +185 -0
- package/dist/ScrollView/ScrollViewEvents.d.ts +9 -0
- package/dist/ScrollView/ScrollViewEvents.js +146 -0
- package/dist/ScrollView/index.d.ts +1 -0
- package/dist/ScrollView/index.js +2 -0
- package/dist/XAudioTT/XAudioAttribute.d.ts +7 -0
- package/dist/XAudioTT/XAudioAttribute.js +93 -0
- package/dist/XAudioTT/XAudioEvents.d.ts +8 -0
- package/dist/XAudioTT/XAudioEvents.js +116 -0
- package/dist/XAudioTT/XAudioTT.d.ts +46 -0
- package/dist/XAudioTT/XAudioTT.js +183 -0
- package/dist/XAudioTT/index.d.ts +1 -0
- package/dist/XAudioTT/index.js +2 -0
- package/dist/XAudioTT/utils.d.ts +19 -0
- package/dist/XAudioTT/utils.js +66 -0
- package/dist/XCanvas/CanvasAttributes.d.ts +12 -0
- package/dist/XCanvas/CanvasAttributes.js +78 -0
- package/dist/XCanvas/XCanvas.d.ts +5 -0
- package/dist/XCanvas/XCanvas.js +32 -0
- package/dist/XCanvas/index.d.ts +1 -0
- package/dist/XCanvas/index.js +2 -0
- package/dist/XFoldViewNg/XFoldviewHeaderNg.d.ts +2 -0
- package/dist/XFoldViewNg/XFoldviewHeaderNg.js +32 -0
- package/dist/XFoldViewNg/XFoldviewHeaderNgFeatures.d.ts +9 -0
- package/dist/XFoldViewNg/XFoldviewHeaderNgFeatures.js +32 -0
- package/dist/XFoldViewNg/XFoldviewNg.d.ts +11 -0
- package/dist/XFoldViewNg/XFoldviewNg.js +52 -0
- package/dist/XFoldViewNg/XFoldviewNgEvents.d.ts +7 -0
- package/dist/XFoldViewNg/XFoldviewNgEvents.js +55 -0
- package/dist/XFoldViewNg/XFoldviewSlotDragNg.d.ts +2 -0
- package/dist/XFoldViewNg/XFoldviewSlotDragNg.js +30 -0
- package/dist/XFoldViewNg/XFoldviewSlotNg.d.ts +2 -0
- package/dist/XFoldViewNg/XFoldviewSlotNg.js +32 -0
- package/dist/XFoldViewNg/XFoldviewSlotNgTouchEventsHandler.d.ts +7 -0
- package/dist/XFoldViewNg/XFoldviewSlotNgTouchEventsHandler.js +105 -0
- package/dist/XFoldViewNg/XFoldviewToolbarNg.d.ts +2 -0
- package/dist/XFoldViewNg/XFoldviewToolbarNg.js +30 -0
- package/dist/XFoldViewNg/index.d.ts +5 -0
- package/dist/XFoldViewNg/index.js +6 -0
- package/dist/XImage/DropShadow.d.ts +6 -0
- package/dist/XImage/DropShadow.js +30 -0
- package/dist/XImage/FilterImage.d.ts +2 -0
- package/dist/XImage/FilterImage.js +31 -0
- package/dist/XImage/ImageEvents.d.ts +6 -0
- package/dist/XImage/ImageEvents.js +68 -0
- package/dist/XImage/ImageSrc.d.ts +7 -0
- package/dist/XImage/ImageSrc.js +61 -0
- package/dist/XImage/XImage.d.ts +2 -0
- package/dist/XImage/XImage.js +30 -0
- package/dist/XImage/index.d.ts +2 -0
- package/dist/XImage/index.js +3 -0
- package/dist/XInput/InputBaseAttributes.d.ts +9 -0
- package/dist/XInput/InputBaseAttributes.js +99 -0
- package/dist/XInput/Placeholder.d.ts +6 -0
- package/dist/XInput/Placeholder.js +60 -0
- package/dist/XInput/XInput.d.ts +28 -0
- package/dist/XInput/XInput.js +129 -0
- package/dist/XInput/XInputAttribute.d.ts +9 -0
- package/dist/XInput/XInputAttribute.js +52 -0
- package/dist/XInput/XInputEvents.d.ts +6 -0
- package/dist/XInput/XInputEvents.js +111 -0
- package/dist/XInput/index.d.ts +1 -0
- package/dist/XInput/index.js +2 -0
- package/dist/XList/ListItem.d.ts +2 -0
- package/dist/XList/ListItem.js +28 -0
- package/dist/XList/XList.d.ts +52 -0
- package/dist/XList/XList.js +257 -0
- package/dist/XList/XListAttributes.d.ts +8 -0
- package/dist/XList/XListAttributes.js +50 -0
- package/dist/XList/XListEvents.d.ts +7 -0
- package/dist/XList/XListEvents.js +356 -0
- package/dist/XList/index.d.ts +2 -0
- package/dist/XList/index.js +3 -0
- package/dist/XOverlayNg/XOverlayAttributes.d.ts +8 -0
- package/dist/XOverlayNg/XOverlayAttributes.js +80 -0
- package/dist/XOverlayNg/XOverlayNg.d.ts +2 -0
- package/dist/XOverlayNg/XOverlayNg.js +45 -0
- package/dist/XOverlayNg/index.d.ts +1 -0
- package/dist/XOverlayNg/index.js +2 -0
- package/dist/XRefreshView/XRefreshFooter.d.ts +3 -0
- package/dist/XRefreshView/XRefreshFooter.js +35 -0
- package/dist/XRefreshView/XRefreshHeader.d.ts +3 -0
- package/dist/XRefreshView/XRefreshHeader.js +35 -0
- package/dist/XRefreshView/XRefreshSubElementIntersectionObserver.d.ts +16 -0
- package/dist/XRefreshView/XRefreshSubElementIntersectionObserver.js +52 -0
- package/dist/XRefreshView/XRefreshView.d.ts +13 -0
- package/dist/XRefreshView/XRefreshView.js +125 -0
- package/dist/XRefreshView/XRefreshViewEventsEmitter.d.ts +8 -0
- package/dist/XRefreshView/XRefreshViewEventsEmitter.js +246 -0
- package/dist/XRefreshView/index.d.ts +3 -0
- package/dist/XRefreshView/index.js +4 -0
- package/dist/XSvg/XSvg.d.ts +8 -0
- package/dist/XSvg/XSvg.js +80 -0
- package/dist/XSvg/index.d.ts +1 -0
- package/dist/XSvg/index.js +2 -0
- package/dist/XSwiper/SwiperItem.d.ts +2 -0
- package/dist/XSwiper/SwiperItem.js +28 -0
- package/dist/XSwiper/XSwiper.d.ts +14 -0
- package/dist/XSwiper/XSwiper.js +231 -0
- package/dist/XSwiper/XSwiperAutoScroll.d.ts +8 -0
- package/dist/XSwiper/XSwiperAutoScroll.js +63 -0
- package/dist/XSwiper/XSwiperCircular.d.ts +8 -0
- package/dist/XSwiper/XSwiperCircular.js +191 -0
- package/dist/XSwiper/XSwiperEvents.d.ts +8 -0
- package/dist/XSwiper/XSwiperEvents.js +144 -0
- package/dist/XSwiper/XSwiperIndicator.d.ts +9 -0
- package/dist/XSwiper/XSwiperIndicator.js +118 -0
- package/dist/XSwiper/index.d.ts +2 -0
- package/dist/XSwiper/index.js +3 -0
- package/dist/XText/InlineImage.d.ts +11 -0
- package/dist/XText/InlineImage.js +56 -0
- package/dist/XText/InlineText.d.ts +5 -0
- package/dist/XText/InlineText.js +30 -0
- package/dist/XText/InlineTruncation.d.ts +5 -0
- package/dist/XText/InlineTruncation.js +42 -0
- package/dist/XText/RawText.d.ts +7 -0
- package/dist/XText/RawText.js +54 -0
- package/dist/XText/XText.d.ts +5 -0
- package/dist/XText/XText.js +49 -0
- package/dist/XText/XTextTruncation.d.ts +11 -0
- package/dist/XText/XTextTruncation.js +604 -0
- package/dist/XText/index.d.ts +5 -0
- package/dist/XText/index.js +6 -0
- package/dist/XTextarea/Placeholder.d.ts +7 -0
- package/dist/XTextarea/Placeholder.js +59 -0
- package/dist/XTextarea/TextareaBaseAttributes.d.ts +6 -0
- package/dist/XTextarea/TextareaBaseAttributes.js +70 -0
- package/dist/XTextarea/XTextarea.d.ts +21 -0
- package/dist/XTextarea/XTextarea.js +101 -0
- package/dist/XTextarea/XTextareaAttributes.d.ts +6 -0
- package/dist/XTextarea/XTextareaAttributes.js +81 -0
- package/dist/XTextarea/XTextareaEvents.d.ts +6 -0
- package/dist/XTextarea/XTextareaEvents.js +111 -0
- package/dist/XTextarea/index.d.ts +1 -0
- package/dist/XTextarea/index.js +2 -0
- package/dist/XView/BlurRadius.d.ts +7 -0
- package/dist/XView/BlurRadius.js +38 -0
- package/dist/XView/XBlurView.d.ts +2 -0
- package/dist/XView/XBlurView.js +29 -0
- package/dist/XView/XView.d.ts +4 -0
- package/dist/XView/XView.js +45 -0
- package/dist/XView/index.d.ts +2 -0
- package/dist/XView/index.js +3 -0
- package/dist/XViewpagerNg/XViewpagerItemNg.d.ts +2 -0
- package/dist/XViewpagerNg/XViewpagerItemNg.js +30 -0
- package/dist/XViewpagerNg/XViewpagerNg.d.ts +10 -0
- package/dist/XViewpagerNg/XViewpagerNg.js +98 -0
- package/dist/XViewpagerNg/XViewpagerNgEvents.d.ts +9 -0
- package/dist/XViewpagerNg/XViewpagerNgEvents.js +118 -0
- package/dist/XViewpagerNg/index.d.ts +2 -0
- package/dist/XViewpagerNg/index.js +3 -0
- package/dist/all.d.ts +16 -0
- package/dist/all.js +17 -0
- package/dist/common/Exposure.d.ts +28 -0
- package/dist/common/Exposure.js +193 -0
- package/dist/common/bindToIntersectionObserver.d.ts +1 -0
- package/dist/common/bindToIntersectionObserver.js +23 -0
- package/dist/common/commonEventInitConfiguration.d.ts +5 -0
- package/dist/common/commonEventInitConfiguration.js +9 -0
- package/dist/common/constants.d.ts +4 -0
- package/dist/common/constants.js +14 -0
- package/dist/common/convertLengthToPx.d.ts +1 -0
- package/dist/common/convertLengthToPx.js +25 -0
- package/dist/common/renameEvent.d.ts +1 -0
- package/dist/common/renameEvent.js +6 -0
- package/dist/common/throttle.d.ts +4 -0
- package/dist/common/throttle.js +40 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +8 -0
- package/dist/lazy.d.ts +1 -0
- package/dist/lazy.js +106 -0
- package/index.css +19 -0
- package/package.json +110 -0
- package/src/LynxWrapper/lynx-wrapper.css +12 -0
- package/src/ScrollView/scroll-view.css +121 -0
- package/src/XAudioTT/x-audio-tt.css +3 -0
- package/src/XCanvas/x-canvas.css +16 -0
- package/src/XFoldViewNg/x-foldview-ng.css +80 -0
- package/src/XImage/x-image.css +82 -0
- package/src/XInput/x-input.css +48 -0
- package/src/XList/x-list.css +147 -0
- package/src/XOverlayNg/x-overlay-ng.css +56 -0
- package/src/XRefreshView/x-refresh-view.css +61 -0
- package/src/XSvg/x-svg.css +10 -0
- package/src/XSwiper/x-swiper.css +319 -0
- package/src/XText/x-text.css +272 -0
- package/src/XTextarea/x-textarea.css +49 -0
- package/src/XViewpagerNg/x-viewpager-ng.css +68 -0
- package/src/common-css/linear.css +386 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { scrollContainerDom } from '../common/constants.js';
|
|
2
|
+
export declare class XFoldviewNg extends HTMLElement {
|
|
3
|
+
static readonly notToFilterFalseAttributes: Set<string>;
|
|
4
|
+
__scrollableLength: number;
|
|
5
|
+
get __headershowing(): boolean;
|
|
6
|
+
setFoldExpanded(params: {
|
|
7
|
+
offset: string;
|
|
8
|
+
smooth: boolean;
|
|
9
|
+
}): void;
|
|
10
|
+
get [scrollContainerDom](): this;
|
|
11
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
/*
|
|
3
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
4
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { Component } from '@lynx-js/web-elements-reactive';
|
|
8
|
+
import { LynxExposure } from '../common/Exposure.js';
|
|
9
|
+
import { XFoldviewNgEvents } from './XFoldviewNgEvents.js';
|
|
10
|
+
import { scrollContainerDom } from '../common/constants.js';
|
|
11
|
+
let XFoldviewNg = (() => {
|
|
12
|
+
let _classDecorators = [Component('x-foldview-ng', [
|
|
13
|
+
LynxExposure,
|
|
14
|
+
XFoldviewNgEvents,
|
|
15
|
+
])];
|
|
16
|
+
let _classDescriptor;
|
|
17
|
+
let _classExtraInitializers = [];
|
|
18
|
+
let _classThis;
|
|
19
|
+
let _classSuper = HTMLElement;
|
|
20
|
+
var XFoldviewNg = class extends _classSuper {
|
|
21
|
+
static { _classThis = this; }
|
|
22
|
+
static {
|
|
23
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
24
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
25
|
+
XFoldviewNg = _classThis = _classDescriptor.value;
|
|
26
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
27
|
+
}
|
|
28
|
+
static notToFilterFalseAttributes = new Set(['scroll-enable']);
|
|
29
|
+
__scrollableLength = 0;
|
|
30
|
+
get __headershowing() {
|
|
31
|
+
// This behavior cannot be reproduced in the current test, but can be reproduced in Android WebView
|
|
32
|
+
return Math.abs(this.scrollTop - this.__scrollableLength) > 1;
|
|
33
|
+
}
|
|
34
|
+
setFoldExpanded(params) {
|
|
35
|
+
const { offset, smooth = true } = params;
|
|
36
|
+
const offsetValue = parseFloat(offset);
|
|
37
|
+
this.scrollTo({
|
|
38
|
+
top: offsetValue,
|
|
39
|
+
behavior: smooth ? 'smooth' : 'instant',
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
get [scrollContainerDom]() {
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
static {
|
|
46
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return XFoldviewNg = _classThis;
|
|
50
|
+
})();
|
|
51
|
+
export { XFoldviewNg };
|
|
52
|
+
//# sourceMappingURL=XFoldviewNg.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AttributeReactiveClass } from '@lynx-js/web-elements-reactive';
|
|
2
|
+
import { XFoldviewNg } from './XFoldviewNg.js';
|
|
3
|
+
export declare class XFoldviewNgEvents implements InstanceType<AttributeReactiveClass<typeof XFoldviewNg>> {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(dom: XFoldviewNg);
|
|
6
|
+
static observedAttributes: string[];
|
|
7
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers, __setFunctionName } from "tslib";
|
|
2
|
+
/*
|
|
3
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
4
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { registerAttributeHandler, } from '@lynx-js/web-elements-reactive';
|
|
8
|
+
import { commonComponentEventSetting } from '../common/commonEventInitConfiguration.js';
|
|
9
|
+
let XFoldviewNgEvents = (() => {
|
|
10
|
+
let _instanceExtraInitializers = [];
|
|
11
|
+
let _private_handleGranularity_decorators;
|
|
12
|
+
let _private_handleGranularity_descriptor;
|
|
13
|
+
return class XFoldviewNgEvents {
|
|
14
|
+
static {
|
|
15
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
16
|
+
_private_handleGranularity_decorators = [registerAttributeHandler('granularity', true)];
|
|
17
|
+
__esDecorate(this, _private_handleGranularity_descriptor = { value: __setFunctionName(function (newVal) {
|
|
18
|
+
if (newVal && newVal !== '')
|
|
19
|
+
this.#granularity = parseFloat(newVal);
|
|
20
|
+
else
|
|
21
|
+
this.#granularity = 0.01;
|
|
22
|
+
}, "#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);
|
|
23
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
24
|
+
}
|
|
25
|
+
#dom = __runInitializers(this, _instanceExtraInitializers);
|
|
26
|
+
#granularity = 0.01;
|
|
27
|
+
#pervScroll = 0;
|
|
28
|
+
constructor(dom) {
|
|
29
|
+
this.#dom = dom;
|
|
30
|
+
this.#dom.addEventListener('scroll', this.#handleScroll, {
|
|
31
|
+
passive: true,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
static observedAttributes = ['granularity'];
|
|
35
|
+
get #handleGranularity() { return _private_handleGranularity_descriptor.value; }
|
|
36
|
+
#handleScroll = () => {
|
|
37
|
+
const curentScrollTop = this.#dom.scrollTop;
|
|
38
|
+
const scrollLength = Math.abs(this.#pervScroll - curentScrollTop);
|
|
39
|
+
if (scrollLength > this.#granularity
|
|
40
|
+
|| this.#dom.scrollTop === 0
|
|
41
|
+
|| Math.abs(this.#dom.scrollHeight - this.#dom.clientHeight - this.#dom.scrollTop) <= 1) {
|
|
42
|
+
this.#pervScroll = curentScrollTop;
|
|
43
|
+
this.#dom.dispatchEvent(new CustomEvent('offset', {
|
|
44
|
+
...commonComponentEventSetting,
|
|
45
|
+
detail: {
|
|
46
|
+
offset: curentScrollTop,
|
|
47
|
+
height: this.#dom.__scrollableLength,
|
|
48
|
+
},
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
})();
|
|
54
|
+
export { XFoldviewNgEvents };
|
|
55
|
+
//# sourceMappingURL=XFoldviewNgEvents.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
/*
|
|
3
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
4
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { Component } from '@lynx-js/web-elements-reactive';
|
|
8
|
+
import { LynxExposure } from '../common/Exposure.js';
|
|
9
|
+
let XFoldviewSlotDragNg = (() => {
|
|
10
|
+
let _classDecorators = [Component('x-foldivew-slot-drag-ng', [
|
|
11
|
+
LynxExposure,
|
|
12
|
+
])];
|
|
13
|
+
let _classDescriptor;
|
|
14
|
+
let _classExtraInitializers = [];
|
|
15
|
+
let _classThis;
|
|
16
|
+
let _classSuper = HTMLElement;
|
|
17
|
+
var XFoldviewSlotDragNg = class extends _classSuper {
|
|
18
|
+
static { _classThis = this; }
|
|
19
|
+
static {
|
|
20
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
21
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
22
|
+
XFoldviewSlotDragNg = _classThis = _classDescriptor.value;
|
|
23
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
24
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return XFoldviewSlotDragNg = _classThis;
|
|
28
|
+
})();
|
|
29
|
+
export { XFoldviewSlotDragNg };
|
|
30
|
+
//# sourceMappingURL=XFoldviewSlotDragNg.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
/*
|
|
3
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
4
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { Component } from '@lynx-js/web-elements-reactive';
|
|
8
|
+
import { LynxExposure } from '../common/Exposure.js';
|
|
9
|
+
import { XFoldviewSlotNgTouchEventsHandler } from './XFoldviewSlotNgTouchEventsHandler.js';
|
|
10
|
+
let XFoldviewSlotNg = (() => {
|
|
11
|
+
let _classDecorators = [Component('x-foldview-slot-ng', [
|
|
12
|
+
LynxExposure,
|
|
13
|
+
XFoldviewSlotNgTouchEventsHandler,
|
|
14
|
+
])];
|
|
15
|
+
let _classDescriptor;
|
|
16
|
+
let _classExtraInitializers = [];
|
|
17
|
+
let _classThis;
|
|
18
|
+
let _classSuper = HTMLElement;
|
|
19
|
+
var XFoldviewSlotNg = class extends _classSuper {
|
|
20
|
+
static { _classThis = this; }
|
|
21
|
+
static {
|
|
22
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
23
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
24
|
+
XFoldviewSlotNg = _classThis = _classDescriptor.value;
|
|
25
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
26
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
return XFoldviewSlotNg = _classThis;
|
|
30
|
+
})();
|
|
31
|
+
export { XFoldviewSlotNg };
|
|
32
|
+
//# sourceMappingURL=XFoldviewSlotNg.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AttributeReactiveClass } from '@lynx-js/web-elements-reactive';
|
|
2
|
+
import { XFoldviewSlotNg } from './XFoldviewSlotNg.js';
|
|
3
|
+
export declare class XFoldviewSlotNgTouchEventsHandler implements InstanceType<AttributeReactiveClass<typeof XFoldviewSlotNg>> {
|
|
4
|
+
#private;
|
|
5
|
+
static observedAttributes: never[];
|
|
6
|
+
constructor(dom: XFoldviewSlotNg);
|
|
7
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { isChromium } from '../common/constants.js';
|
|
2
|
+
export class XFoldviewSlotNgTouchEventsHandler {
|
|
3
|
+
#parentScrollTop = 0;
|
|
4
|
+
#childrenElemsntsScrollTop = new WeakMap();
|
|
5
|
+
#childrenElemsntsScrollLeft = new WeakMap();
|
|
6
|
+
#elements;
|
|
7
|
+
#previousPageY = 0;
|
|
8
|
+
#previousPageX = 0;
|
|
9
|
+
#dom;
|
|
10
|
+
static observedAttributes = [];
|
|
11
|
+
constructor(dom) {
|
|
12
|
+
this.#dom = dom;
|
|
13
|
+
this.#dom.addEventListener('touchmove', this.#scroller, {
|
|
14
|
+
passive: false,
|
|
15
|
+
});
|
|
16
|
+
this.#dom.addEventListener('touchstart', this.#initPreviousScreen, {
|
|
17
|
+
passive: true,
|
|
18
|
+
});
|
|
19
|
+
this.#dom.addEventListener('touchcancel', this.#initPreviousScreen, {
|
|
20
|
+
passive: true,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
#getTheMostScrollableKid(delta, isVertical) {
|
|
24
|
+
const scrollableKid = this.#elements?.find((element) => {
|
|
25
|
+
if ((isVertical && element.scrollHeight > element.clientHeight)
|
|
26
|
+
|| (!isVertical && element.scrollWidth > element.clientWidth)) {
|
|
27
|
+
const couldScrollNear = delta < 0
|
|
28
|
+
&& (isVertical ? element.scrollTop !== 0 : element.scrollLeft !== 0);
|
|
29
|
+
const couldScrollFar = delta > 0
|
|
30
|
+
&& Math.abs(isVertical
|
|
31
|
+
? (element.scrollHeight - element.clientHeight
|
|
32
|
+
- element.scrollTop)
|
|
33
|
+
: (element.scrollWidth - element.clientWidth
|
|
34
|
+
- element.scrollLeft)) > 1;
|
|
35
|
+
return couldScrollNear || couldScrollFar;
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
});
|
|
39
|
+
return scrollableKid;
|
|
40
|
+
}
|
|
41
|
+
#scrollKid(scrollableKid, delta, isVertical) {
|
|
42
|
+
let targetKidScrollDistance = (isVertical
|
|
43
|
+
? this.#childrenElemsntsScrollTop
|
|
44
|
+
: this.#childrenElemsntsScrollLeft)
|
|
45
|
+
.get(scrollableKid) ?? 0;
|
|
46
|
+
targetKidScrollDistance += delta;
|
|
47
|
+
this.#childrenElemsntsScrollTop.set(scrollableKid, targetKidScrollDistance);
|
|
48
|
+
isVertical
|
|
49
|
+
? (scrollableKid.scrollTop = targetKidScrollDistance)
|
|
50
|
+
: (scrollableKid.scrollLeft = targetKidScrollDistance);
|
|
51
|
+
}
|
|
52
|
+
#scroller = (event) => {
|
|
53
|
+
const parentElement = this.#getParentElement();
|
|
54
|
+
const touch = event.touches.item(0);
|
|
55
|
+
const { pageY, pageX } = touch;
|
|
56
|
+
const deltaY = this.#previousPageY - pageY;
|
|
57
|
+
const deltaX = this.#previousPageX - pageX;
|
|
58
|
+
const scrollableKidY = this.#getTheMostScrollableKid(deltaY, true);
|
|
59
|
+
const scrollableKidX = this.#getTheMostScrollableKid(deltaX, false);
|
|
60
|
+
/**
|
|
61
|
+
* on chromium browsers, the y-axis js scrolling won't interrupt the pan-x gestures
|
|
62
|
+
* we make sure the x-axis scrolling will block the y-axis scrolling
|
|
63
|
+
*/
|
|
64
|
+
if (deltaY && parentElement && Math.abs(deltaX / 4) < Math.abs(deltaY)) {
|
|
65
|
+
if (event.cancelable && !isChromium) {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
if (scrollableKidX) {
|
|
68
|
+
this.#scrollKid(scrollableKidX, deltaX, false);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if ((parentElement.__headershowing && deltaY > 0
|
|
72
|
+
|| (deltaY < 0 && !scrollableKidY))
|
|
73
|
+
// deltaY > 0: swipe up (folding header)
|
|
74
|
+
// scroll the foldview if its scrollable
|
|
75
|
+
|| (!parentElement.__headershowing && !scrollableKidY)
|
|
76
|
+
// all sub doms are scrolled
|
|
77
|
+
) {
|
|
78
|
+
this.#parentScrollTop += deltaY;
|
|
79
|
+
parentElement.scrollTop = this.#parentScrollTop;
|
|
80
|
+
}
|
|
81
|
+
else if (scrollableKidY) {
|
|
82
|
+
this.#scrollKid(scrollableKidY, deltaY, true);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
this.#previousPageY = pageY;
|
|
86
|
+
};
|
|
87
|
+
#getParentElement() {
|
|
88
|
+
const parentElement = this.#dom.parentElement;
|
|
89
|
+
if (parentElement && parentElement.tagName === 'X-FOLDVIEW-NG') {
|
|
90
|
+
return parentElement;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
#initPreviousScreen = (event) => {
|
|
94
|
+
const { pageX, pageY } = event.touches.item(0);
|
|
95
|
+
this.#elements = document.elementsFromPoint(pageX, pageY).filter(e => this.#dom.contains(e));
|
|
96
|
+
this.#previousPageY = pageY;
|
|
97
|
+
this.#previousPageX = pageX;
|
|
98
|
+
this.#parentScrollTop = this.#getParentElement()?.scrollTop ?? 0;
|
|
99
|
+
for (const element of this.#elements) {
|
|
100
|
+
this.#childrenElemsntsScrollTop.set(element, element.scrollTop);
|
|
101
|
+
this.#childrenElemsntsScrollLeft.set(element, element.scrollLeft);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=XFoldviewSlotNgTouchEventsHandler.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
/*
|
|
3
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
4
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { Component } from '@lynx-js/web-elements-reactive';
|
|
8
|
+
import { LynxExposure } from '../common/Exposure.js';
|
|
9
|
+
let XFoldviewToolbarNg = (() => {
|
|
10
|
+
let _classDecorators = [Component('x-foldview-toolbar-ng', [
|
|
11
|
+
LynxExposure,
|
|
12
|
+
])];
|
|
13
|
+
let _classDescriptor;
|
|
14
|
+
let _classExtraInitializers = [];
|
|
15
|
+
let _classThis;
|
|
16
|
+
let _classSuper = HTMLElement;
|
|
17
|
+
var XFoldviewToolbarNg = class extends _classSuper {
|
|
18
|
+
static { _classThis = this; }
|
|
19
|
+
static {
|
|
20
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
21
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
22
|
+
XFoldviewToolbarNg = _classThis = _classDescriptor.value;
|
|
23
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
24
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return XFoldviewToolbarNg = _classThis;
|
|
28
|
+
})();
|
|
29
|
+
export { XFoldviewToolbarNg };
|
|
30
|
+
//# sourceMappingURL=XFoldviewToolbarNg.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { XFoldviewHeaderNg } from './XFoldviewHeaderNg.js';
|
|
2
|
+
export { XFoldviewNg } from './XFoldviewNg.js';
|
|
3
|
+
export { XFoldviewSlotDragNg } from './XFoldviewSlotDragNg.js';
|
|
4
|
+
export { XFoldviewSlotNg } from './XFoldviewSlotNg.js';
|
|
5
|
+
export { XFoldviewToolbarNg } from './XFoldviewToolbarNg.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { XFoldviewHeaderNg } from './XFoldviewHeaderNg.js';
|
|
2
|
+
export { XFoldviewNg } from './XFoldviewNg.js';
|
|
3
|
+
export { XFoldviewSlotDragNg } from './XFoldviewSlotDragNg.js';
|
|
4
|
+
export { XFoldviewSlotNg } from './XFoldviewSlotNg.js';
|
|
5
|
+
export { XFoldviewToolbarNg } from './XFoldviewToolbarNg.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
/*
|
|
3
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
4
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { bindToStyle, genDomGetter, registerAttributeHandler, } from '@lynx-js/web-elements-reactive';
|
|
8
|
+
let DropShadow = (() => {
|
|
9
|
+
let _private_handleBlurRadius_decorators;
|
|
10
|
+
let _private_handleBlurRadius_initializers = [];
|
|
11
|
+
let _private_handleBlurRadius_extraInitializers = [];
|
|
12
|
+
return class DropShadow {
|
|
13
|
+
static {
|
|
14
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
15
|
+
_private_handleBlurRadius_decorators = [registerAttributeHandler('drop-shadow', true)];
|
|
16
|
+
__esDecorate(null, null, _private_handleBlurRadius_decorators, { kind: "field", name: "#handleBlurRadius", static: false, private: true, access: { has: obj => #handleBlurRadius in obj, get: obj => obj.#handleBlurRadius, set: (obj, value) => { obj.#handleBlurRadius = value; } }, metadata: _metadata }, _private_handleBlurRadius_initializers, _private_handleBlurRadius_extraInitializers);
|
|
17
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
18
|
+
}
|
|
19
|
+
static observedAttributes = ['drop-shadow'];
|
|
20
|
+
#dom;
|
|
21
|
+
#getImg = genDomGetter(() => this.#dom.shadowRoot, '#img');
|
|
22
|
+
#handleBlurRadius = __runInitializers(this, _private_handleBlurRadius_initializers, bindToStyle(this.#getImg, '--drop-shadow', undefined, true));
|
|
23
|
+
constructor(dom) {
|
|
24
|
+
__runInitializers(this, _private_handleBlurRadius_extraInitializers);
|
|
25
|
+
this.#dom = dom;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
})();
|
|
29
|
+
export { DropShadow };
|
|
30
|
+
//# sourceMappingURL=DropShadow.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
/*
|
|
3
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
4
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { Component, html } from '@lynx-js/web-elements-reactive';
|
|
8
|
+
import { LynxExposure } from '../common/Exposure.js';
|
|
9
|
+
import { DropShadow } from './DropShadow.js';
|
|
10
|
+
import { ImageSrc } from './ImageSrc.js';
|
|
11
|
+
import { ImageEvents } from './ImageEvents.js';
|
|
12
|
+
let FilterImage = (() => {
|
|
13
|
+
let _classDecorators = [Component('filter-image', [LynxExposure, ImageSrc, DropShadow, ImageEvents], html ` <img part="img" alt="" id="img" /> `)];
|
|
14
|
+
let _classDescriptor;
|
|
15
|
+
let _classExtraInitializers = [];
|
|
16
|
+
let _classThis;
|
|
17
|
+
let _classSuper = HTMLElement;
|
|
18
|
+
var FilterImage = class extends _classSuper {
|
|
19
|
+
static { _classThis = this; }
|
|
20
|
+
static {
|
|
21
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
22
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
23
|
+
FilterImage = _classThis = _classDescriptor.value;
|
|
24
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
25
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return FilterImage = _classThis;
|
|
29
|
+
})();
|
|
30
|
+
export { FilterImage };
|
|
31
|
+
//# sourceMappingURL=FilterImage.js.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers, __setFunctionName } from "tslib";
|
|
2
|
+
/*
|
|
3
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
4
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { genDomGetter, registerAttributeHandler, } from '@lynx-js/web-elements-reactive';
|
|
8
|
+
import { commonComponentEventSetting } from '../common/commonEventInitConfiguration.js';
|
|
9
|
+
let ImageEvents = (() => {
|
|
10
|
+
let _instanceExtraInitializers = [];
|
|
11
|
+
let _private_enableLoadEvent_decorators;
|
|
12
|
+
let _private_enableLoadEvent_descriptor;
|
|
13
|
+
let _private_enableErrorEvent_decorators;
|
|
14
|
+
let _private_enableErrorEvent_descriptor;
|
|
15
|
+
return class ImageEvents {
|
|
16
|
+
static {
|
|
17
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
18
|
+
_private_enableLoadEvent_decorators = [registerAttributeHandler('x-enable-load-event', true)];
|
|
19
|
+
_private_enableErrorEvent_decorators = [registerAttributeHandler('x-enable-error-event', true)];
|
|
20
|
+
__esDecorate(this, _private_enableLoadEvent_descriptor = { value: __setFunctionName(function (value) {
|
|
21
|
+
if (value === null) {
|
|
22
|
+
this.#getImg().removeEventListener('load', this.#teleportLoadEvent);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
this.#getImg().addEventListener('load', this.#teleportLoadEvent, {
|
|
26
|
+
passive: true,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}, "#enableLoadEvent") }, _private_enableLoadEvent_decorators, { kind: "method", name: "#enableLoadEvent", static: false, private: true, access: { has: obj => #enableLoadEvent in obj, get: obj => obj.#enableLoadEvent }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
30
|
+
__esDecorate(this, _private_enableErrorEvent_descriptor = { value: __setFunctionName(function (value) {
|
|
31
|
+
if (value === null) {
|
|
32
|
+
this.#getImg().removeEventListener('error', this.#teleportErrorEvent);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this.#getImg().addEventListener('error', this.#teleportErrorEvent, {
|
|
36
|
+
passive: true,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}, "#enableErrorEvent") }, _private_enableErrorEvent_decorators, { kind: "method", name: "#enableErrorEvent", static: false, private: true, access: { has: obj => #enableErrorEvent in obj, get: obj => obj.#enableErrorEvent }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
40
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
41
|
+
}
|
|
42
|
+
static observedAttributes = ['x-enable-load-event', 'x-enable-error-event'];
|
|
43
|
+
#dom = __runInitializers(this, _instanceExtraInitializers);
|
|
44
|
+
#getImg = genDomGetter(() => this.#dom.shadowRoot, '#img');
|
|
45
|
+
get #enableLoadEvent() { return _private_enableLoadEvent_descriptor.value; }
|
|
46
|
+
get #enableErrorEvent() { return _private_enableErrorEvent_descriptor.value; }
|
|
47
|
+
#teleportLoadEvent = () => {
|
|
48
|
+
this.#dom.dispatchEvent(new CustomEvent('load', {
|
|
49
|
+
...commonComponentEventSetting,
|
|
50
|
+
detail: {
|
|
51
|
+
width: this.#getImg().naturalWidth,
|
|
52
|
+
height: this.#getImg().naturalHeight,
|
|
53
|
+
},
|
|
54
|
+
}));
|
|
55
|
+
};
|
|
56
|
+
#teleportErrorEvent = () => {
|
|
57
|
+
this.#dom.dispatchEvent(new CustomEvent('error', {
|
|
58
|
+
...commonComponentEventSetting,
|
|
59
|
+
detail: {},
|
|
60
|
+
}));
|
|
61
|
+
};
|
|
62
|
+
constructor(dom) {
|
|
63
|
+
this.#dom = dom;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
})();
|
|
67
|
+
export { ImageEvents };
|
|
68
|
+
//# sourceMappingURL=ImageEvents.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type AttributeReactiveClass } from '@lynx-js/web-elements-reactive';
|
|
2
|
+
export declare class ImageSrc implements InstanceType<AttributeReactiveClass<typeof HTMLElement>> {
|
|
3
|
+
#private;
|
|
4
|
+
static observedAttributes: string[];
|
|
5
|
+
constructor(dom: HTMLElement);
|
|
6
|
+
connectedCallback(): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers, __setFunctionName } from "tslib";
|
|
2
|
+
/*
|
|
3
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
4
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { bindToAttribute, bindToStyle, genDomGetter, registerAttributeHandler, } from '@lynx-js/web-elements-reactive';
|
|
8
|
+
let ImageSrc = (() => {
|
|
9
|
+
let _instanceExtraInitializers = [];
|
|
10
|
+
let _private_handleSrc_decorators;
|
|
11
|
+
let _private_handleSrc_initializers = [];
|
|
12
|
+
let _private_handleSrc_extraInitializers = [];
|
|
13
|
+
let _private_preloadPlaceholder_decorators;
|
|
14
|
+
let _private_preloadPlaceholder_descriptor;
|
|
15
|
+
let _private_handleBlurRadius_decorators;
|
|
16
|
+
let _private_handleBlurRadius_initializers = [];
|
|
17
|
+
let _private_handleBlurRadius_extraInitializers = [];
|
|
18
|
+
return class ImageSrc {
|
|
19
|
+
static {
|
|
20
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
21
|
+
_private_handleSrc_decorators = [registerAttributeHandler('src', true)];
|
|
22
|
+
_private_preloadPlaceholder_decorators = [registerAttributeHandler('placeholder', true)];
|
|
23
|
+
_private_handleBlurRadius_decorators = [registerAttributeHandler('blur-radius', true)];
|
|
24
|
+
__esDecorate(this, _private_preloadPlaceholder_descriptor = { value: __setFunctionName(function (newVal) {
|
|
25
|
+
if (newVal) {
|
|
26
|
+
new Image().src = newVal;
|
|
27
|
+
}
|
|
28
|
+
}, "#preloadPlaceholder") }, _private_preloadPlaceholder_decorators, { kind: "method", name: "#preloadPlaceholder", static: false, private: true, access: { has: obj => #preloadPlaceholder in obj, get: obj => obj.#preloadPlaceholder }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
29
|
+
__esDecorate(null, null, _private_handleSrc_decorators, { kind: "field", name: "#handleSrc", static: false, private: true, access: { has: obj => #handleSrc in obj, get: obj => obj.#handleSrc, set: (obj, value) => { obj.#handleSrc = value; } }, metadata: _metadata }, _private_handleSrc_initializers, _private_handleSrc_extraInitializers);
|
|
30
|
+
__esDecorate(null, null, _private_handleBlurRadius_decorators, { kind: "field", name: "#handleBlurRadius", static: false, private: true, access: { has: obj => #handleBlurRadius in obj, get: obj => obj.#handleBlurRadius, set: (obj, value) => { obj.#handleBlurRadius = value; } }, metadata: _metadata }, _private_handleBlurRadius_initializers, _private_handleBlurRadius_extraInitializers);
|
|
31
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
32
|
+
}
|
|
33
|
+
static observedAttributes = ['src', 'placeholder', 'blur-radius'];
|
|
34
|
+
#dom = __runInitializers(this, _instanceExtraInitializers);
|
|
35
|
+
#getImg = genDomGetter(() => this.#dom.shadowRoot, '#img');
|
|
36
|
+
#handleSrc = __runInitializers(this, _private_handleSrc_initializers, bindToAttribute(this.#getImg, 'src', (newval) => {
|
|
37
|
+
return newval || this.#dom.getAttribute('placeholder');
|
|
38
|
+
}));
|
|
39
|
+
get #preloadPlaceholder() { return _private_preloadPlaceholder_descriptor.value; }
|
|
40
|
+
#handleBlurRadius = (__runInitializers(this, _private_handleSrc_extraInitializers), __runInitializers(this, _private_handleBlurRadius_initializers, bindToStyle(this.#getImg, '--blur-radius', undefined, true)));
|
|
41
|
+
#onImageError = (__runInitializers(this, _private_handleBlurRadius_extraInitializers), () => {
|
|
42
|
+
const currentSrc = this.#getImg().src;
|
|
43
|
+
const placeholder = this.#dom.getAttribute('placeholder');
|
|
44
|
+
if (placeholder && currentSrc !== placeholder) {
|
|
45
|
+
this.#getImg().src = placeholder;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
constructor(dom) {
|
|
49
|
+
this.#dom = dom;
|
|
50
|
+
this.#getImg().addEventListener('error', this.#onImageError);
|
|
51
|
+
}
|
|
52
|
+
connectedCallback() {
|
|
53
|
+
if (this.#dom.getAttribute('src') === null
|
|
54
|
+
|| this.#dom.getAttribute('src') === '') {
|
|
55
|
+
this.#handleSrc(null);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
})();
|
|
60
|
+
export { ImageSrc };
|
|
61
|
+
//# sourceMappingURL=ImageSrc.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
/*
|
|
3
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
4
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { Component, html } from '@lynx-js/web-elements-reactive';
|
|
8
|
+
import { LynxExposure } from '../common/Exposure.js';
|
|
9
|
+
import { ImageSrc } from './ImageSrc.js';
|
|
10
|
+
import { ImageEvents } from './ImageEvents.js';
|
|
11
|
+
let XImage = (() => {
|
|
12
|
+
let _classDecorators = [Component('x-image', [LynxExposure, ImageSrc, ImageEvents], html ` <img part="img" alt="" id="img" /> `)];
|
|
13
|
+
let _classDescriptor;
|
|
14
|
+
let _classExtraInitializers = [];
|
|
15
|
+
let _classThis;
|
|
16
|
+
let _classSuper = HTMLElement;
|
|
17
|
+
var XImage = class extends _classSuper {
|
|
18
|
+
static { _classThis = this; }
|
|
19
|
+
static {
|
|
20
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
21
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
22
|
+
XImage = _classThis = _classDescriptor.value;
|
|
23
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
24
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return XImage = _classThis;
|
|
28
|
+
})();
|
|
29
|
+
export { XImage };
|
|
30
|
+
//# sourceMappingURL=XImage.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AttributeReactiveClass } from '@lynx-js/web-elements-reactive';
|
|
2
|
+
/**
|
|
3
|
+
* shared by x-input and x-input-ng
|
|
4
|
+
*/
|
|
5
|
+
export declare class InputBaseAttributes implements InstanceType<AttributeReactiveClass<typeof HTMLElement>> {
|
|
6
|
+
#private;
|
|
7
|
+
static observedAttributes: string[];
|
|
8
|
+
constructor(dom: HTMLElement);
|
|
9
|
+
}
|