@lynx-js/web-elements 0.8.0 → 0.8.2
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 +31 -0
- package/dist/XImage/ImageSrc.js +13 -2
- package/dist/XList/XListWaterfall.js +10 -10
- package/package.json +2 -2
- package/src/XSwiper/x-swiper.css +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @lynx-js/web-elements
|
|
2
2
|
|
|
3
|
+
## 0.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add crossorigin attribute support to x-image component ([#1340](https://github.com/lynx-family/lynx-stack/pull/1340))
|
|
8
|
+
|
|
9
|
+
- Added `crossorigin` to the `observedAttributes` array in `ImageSrc.ts`
|
|
10
|
+
- Implemented `#handleCrossorigin` handler using the `bindToAttribute` helper to forward the crossorigin attribute from the custom element to the internal `<img>` element
|
|
11
|
+
- Added comprehensive test coverage to verify the attribute is properly passed through to the shadow DOM
|
|
12
|
+
|
|
13
|
+
This enables CORS-enabled image loading when using `<x-image crossorigin="anonymous">` or similar configurations.
|
|
14
|
+
|
|
15
|
+
- Updated dependencies []:
|
|
16
|
+
- @lynx-js/web-elements-template@0.8.2
|
|
17
|
+
|
|
18
|
+
## 0.8.1
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- fix: indicator dots' bg-color on safari 26 ([#1298](https://github.com/lynx-family/lynx-stack/pull/1298))
|
|
23
|
+
|
|
24
|
+
https://bugs.webkit.org/show_bug.cgi?id=296048
|
|
25
|
+
The animation name should be defined in the template
|
|
26
|
+
|
|
27
|
+
- fix: list may only render only one column in ReactLynx. ([#1280](https://github.com/lynx-family/lynx-stack/pull/1280))
|
|
28
|
+
|
|
29
|
+
This is because `span-count` may not be specified when `list-type` is specified, resulting in layout according to `span-count="1"`. Postponing the acquisition of `span-count` until layoutListItem can solve this problem.
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [[`443f3d5`](https://github.com/lynx-family/lynx-stack/commit/443f3d57fc9ac41c3e845bdba5adfa4df16e5519)]:
|
|
32
|
+
- @lynx-js/web-elements-template@0.8.1
|
|
33
|
+
|
|
3
34
|
## 0.8.0
|
|
4
35
|
|
|
5
36
|
### Minor Changes
|
package/dist/XImage/ImageSrc.js
CHANGED
|
@@ -15,12 +15,16 @@ let ImageSrc = (() => {
|
|
|
15
15
|
let _private_handleBlurRadius_decorators;
|
|
16
16
|
let _private_handleBlurRadius_initializers = [];
|
|
17
17
|
let _private_handleBlurRadius_extraInitializers = [];
|
|
18
|
+
let _private_handleCrossorigin_decorators;
|
|
19
|
+
let _private_handleCrossorigin_initializers = [];
|
|
20
|
+
let _private_handleCrossorigin_extraInitializers = [];
|
|
18
21
|
return class ImageSrc {
|
|
19
22
|
static {
|
|
20
23
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
21
24
|
_private_handleSrc_decorators = [registerAttributeHandler('src', true)];
|
|
22
25
|
_private_preloadPlaceholder_decorators = [registerAttributeHandler('placeholder', true)];
|
|
23
26
|
_private_handleBlurRadius_decorators = [registerAttributeHandler('blur-radius', true)];
|
|
27
|
+
_private_handleCrossorigin_decorators = [registerAttributeHandler('crossorigin', true)];
|
|
24
28
|
__esDecorate(this, _private_preloadPlaceholder_descriptor = { value: __setFunctionName(function (newVal) {
|
|
25
29
|
if (newVal) {
|
|
26
30
|
new Image().src = newVal;
|
|
@@ -28,9 +32,15 @@ let ImageSrc = (() => {
|
|
|
28
32
|
}, "#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
33
|
__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
34
|
__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);
|
|
35
|
+
__esDecorate(null, null, _private_handleCrossorigin_decorators, { kind: "field", name: "#handleCrossorigin", static: false, private: true, access: { has: obj => #handleCrossorigin in obj, get: obj => obj.#handleCrossorigin, set: (obj, value) => { obj.#handleCrossorigin = value; } }, metadata: _metadata }, _private_handleCrossorigin_initializers, _private_handleCrossorigin_extraInitializers);
|
|
31
36
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
32
37
|
}
|
|
33
|
-
static observedAttributes = [
|
|
38
|
+
static observedAttributes = [
|
|
39
|
+
'src',
|
|
40
|
+
'placeholder',
|
|
41
|
+
'blur-radius',
|
|
42
|
+
'crossorigin',
|
|
43
|
+
];
|
|
34
44
|
#dom = __runInitializers(this, _instanceExtraInitializers);
|
|
35
45
|
#getImg = genDomGetter(() => this.#dom.shadowRoot, '#img');
|
|
36
46
|
#handleSrc = __runInitializers(this, _private_handleSrc_initializers, bindToAttribute(this.#getImg, 'src', (newval) => {
|
|
@@ -38,7 +48,8 @@ let ImageSrc = (() => {
|
|
|
38
48
|
}));
|
|
39
49
|
get #preloadPlaceholder() { return _private_preloadPlaceholder_descriptor.value; }
|
|
40
50
|
#handleBlurRadius = (__runInitializers(this, _private_handleSrc_extraInitializers), __runInitializers(this, _private_handleBlurRadius_initializers, bindToStyle(this.#getImg, '--blur-radius', undefined, true)));
|
|
41
|
-
#
|
|
51
|
+
#handleCrossorigin = (__runInitializers(this, _private_handleBlurRadius_extraInitializers), __runInitializers(this, _private_handleCrossorigin_initializers, bindToAttribute(this.#getImg, 'crossorigin')));
|
|
52
|
+
#onImageError = (__runInitializers(this, _private_handleCrossorigin_extraInitializers), () => {
|
|
42
53
|
const currentSrc = this.#getImg().src;
|
|
43
54
|
const placeholder = this.#dom.getAttribute('placeholder');
|
|
44
55
|
if (placeholder && currentSrc !== placeholder) {
|
|
@@ -17,20 +17,15 @@ let XListWaterfall = (() => {
|
|
|
17
17
|
_private_handlerListType_decorators = [registerAttributeHandler('list-type', true)];
|
|
18
18
|
__esDecorate(this, _private_handlerListType_descriptor = { value: __setFunctionName(function (newVal) {
|
|
19
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
20
|
this.#createWaterfallContainer();
|
|
26
21
|
if (!this.#resizeObserver) {
|
|
27
|
-
this.#resizeObserverInit(
|
|
22
|
+
this.#resizeObserverInit();
|
|
28
23
|
}
|
|
29
24
|
if (!this.#childrenObserver) {
|
|
30
25
|
this.#childrenObserver = new MutationObserver((mutationList) => {
|
|
31
26
|
const mutation = mutationList?.[0];
|
|
32
27
|
if (mutation?.type === 'childList') {
|
|
33
|
-
this.#resizeObserverInit(
|
|
28
|
+
this.#resizeObserverInit();
|
|
34
29
|
}
|
|
35
30
|
});
|
|
36
31
|
this.#childrenObserver.observe(this.#dom, {
|
|
@@ -65,7 +60,12 @@ let XListWaterfall = (() => {
|
|
|
65
60
|
this.#dom.shadowRoot?.querySelector('[part=upper-threshold-observer]')
|
|
66
61
|
?.insertAdjacentElement('afterend', waterfallSlot);
|
|
67
62
|
};
|
|
68
|
-
#layoutListItem = (
|
|
63
|
+
#layoutListItem = () => {
|
|
64
|
+
const spanCount = parseFloat(this.#dom.getAttribute('span-count')
|
|
65
|
+
|| this.#dom.getAttribute('column-count')
|
|
66
|
+
|| '') || 1;
|
|
67
|
+
const isScrollVertical = (this.#dom.getAttribute('scroll-orientation')
|
|
68
|
+
|| 'vertical') === 'vertical';
|
|
69
69
|
const measurements = new Array(spanCount).fill(0);
|
|
70
70
|
for (let i = 0; i < this.#dom.children.length; i++) {
|
|
71
71
|
const listItem = this.#dom.children[i];
|
|
@@ -149,13 +149,13 @@ let XListWaterfall = (() => {
|
|
|
149
149
|
constructor(dom) {
|
|
150
150
|
this.#dom = dom;
|
|
151
151
|
}
|
|
152
|
-
#resizeObserverInit = (
|
|
152
|
+
#resizeObserverInit = () => {
|
|
153
153
|
this.#resizeObserver?.disconnect();
|
|
154
154
|
this.#resizeObserver = new ResizeObserver(() => {
|
|
155
155
|
// may cause: Resizeobserver loop completed with undelivered notifications
|
|
156
156
|
// https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver#observation_errors
|
|
157
157
|
requestAnimationFrame(() => {
|
|
158
|
-
this.#layoutListItem(
|
|
158
|
+
this.#layoutListItem();
|
|
159
159
|
});
|
|
160
160
|
});
|
|
161
161
|
Array.from(this.#dom.children).forEach(element => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-elements",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
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.8.
|
|
104
|
+
"@lynx-js/web-elements-template": "0.8.2"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
107
|
"tslib": "^2.8.1"
|
package/src/XSwiper/x-swiper.css
CHANGED
|
@@ -171,8 +171,6 @@ x-swiper::part(indicator-item) {
|
|
|
171
171
|
flex: 0 0 var(--indicator-size);
|
|
172
172
|
margin: 0 calc(var(--indicator-size) / 5) 0 calc(var(--indicator-size) / 5);
|
|
173
173
|
border-radius: 100%;
|
|
174
|
-
animation-name: indicator-dot;
|
|
175
|
-
animation-duration: 100ms;
|
|
176
174
|
}
|
|
177
175
|
|
|
178
176
|
x-swiper[vertical]::part(indicator-item) {
|