@mschop/alpine-web-components 1.0.2 → 1.0.3

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.
@@ -104,7 +104,17 @@ abstract class AlpineWebComponent extends HTMLElement {
104
104
  this.constructor.observedAttributes?.forEach((key: string) => {
105
105
  const value = this.getAttribute(key);
106
106
 
107
- this.state.attributes[key] = this.castFromAttribute(key, value)
107
+ if (value === null && this.state.attributes[key] !== undefined) {
108
+ const attribute = this.castToAttribute(
109
+ key,
110
+ this.castToAttribute(key, this.state.attributes[key])
111
+ );
112
+ if (attribute !== null) {
113
+ this.setAttribute(key, attribute)
114
+ }
115
+ } else {
116
+ this.state.attributes[key] = this.castFromAttribute(key, value)
117
+ }
108
118
  })
109
119
  }
110
120
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mschop/alpine-web-components",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Use alpinejs with web components and shadow root",
5
5
  "main": "index.js",
6
6
  "scripts": {