@lynx-js/web-elements 0.8.1 → 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 CHANGED
@@ -1,5 +1,20 @@
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
+
3
18
  ## 0.8.1
4
19
 
5
20
  ### Patch Changes
@@ -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 = ['src', 'placeholder', 'blur-radius'];
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
- #onImageError = (__runInitializers(this, _private_handleBlurRadius_extraInitializers), () => {
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-elements",
3
- "version": "0.8.1",
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.1"
104
+ "@lynx-js/web-elements-template": "0.8.2"
105
105
  },
106
106
  "devDependencies": {
107
107
  "tslib": "^2.8.1"