@nectary/components 5.50.5 → 5.50.6

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/bundle.js CHANGED
@@ -18,8 +18,12 @@ const updateBooleanAttribute = ($element, attrName, attrValue) => {
18
18
  }
19
19
  };
20
20
  const updateAttribute = ($element, attrName, attrValue) => {
21
- if (attrValue != null) {
22
- $element.setAttribute(attrName, String(attrValue));
21
+ const nextValue = attrValue != null ? String(attrValue) : null;
22
+ if ($element.getAttribute(attrName) === nextValue) {
23
+ return;
24
+ }
25
+ if (nextValue !== null) {
26
+ $element.setAttribute(attrName, nextValue);
23
27
  } else {
24
28
  $element.removeAttribute(attrName);
25
29
  }
@@ -2824,15 +2828,15 @@ class Button extends NectaryElement {
2824
2828
  }
2825
2829
  switch (e.detail) {
2826
2830
  case "l": {
2827
- this.setAttribute("data-size", "m");
2831
+ updateAttribute(this, "data-size", "m");
2828
2832
  break;
2829
2833
  }
2830
2834
  case "m": {
2831
- this.setAttribute("data-size", "s");
2835
+ updateAttribute(this, "data-size", "s");
2832
2836
  break;
2833
2837
  }
2834
2838
  default: {
2835
- this.setAttribute("data-size", "xs");
2839
+ updateAttribute(this, "data-size", "xs");
2836
2840
  }
2837
2841
  }
2838
2842
  };
@@ -7459,11 +7463,11 @@ class Input extends NectaryElement {
7459
7463
  }
7460
7464
  switch (e.detail) {
7461
7465
  case "l": {
7462
- this.setAttribute("data-size", "m");
7466
+ updateAttribute(this, "data-size", "m");
7463
7467
  break;
7464
7468
  }
7465
7469
  default: {
7466
- this.setAttribute("data-size", "s");
7470
+ updateAttribute(this, "data-size", "s");
7467
7471
  }
7468
7472
  }
7469
7473
  };
@@ -9289,11 +9293,11 @@ class Spinner extends NectaryElement {
9289
9293
  switch (e.detail) {
9290
9294
  case "l":
9291
9295
  case "m": {
9292
- this.setAttribute("data-size", "m");
9296
+ updateAttribute(this, "data-size", "m");
9293
9297
  break;
9294
9298
  }
9295
9299
  default: {
9296
- this.setAttribute("data-size", "s");
9300
+ updateAttribute(this, "data-size", "s");
9297
9301
  }
9298
9302
  }
9299
9303
  };
@@ -15799,11 +15803,11 @@ class SelectButton extends NectaryElement {
15799
15803
  }
15800
15804
  switch (e.detail) {
15801
15805
  case "l": {
15802
- this.setAttribute("data-size", "m");
15806
+ updateAttribute(this, "data-size", "m");
15803
15807
  break;
15804
15808
  }
15805
15809
  default: {
15806
- this.setAttribute("data-size", "s");
15810
+ updateAttribute(this, "data-size", "s");
15807
15811
  }
15808
15812
  }
15809
15813
  };
package/button/index.js CHANGED
@@ -187,15 +187,15 @@ class Button extends NectaryElement {
187
187
  }
188
188
  switch (e.detail) {
189
189
  case "l": {
190
- this.setAttribute("data-size", "m");
190
+ updateAttribute(this, "data-size", "m");
191
191
  break;
192
192
  }
193
193
  case "m": {
194
- this.setAttribute("data-size", "s");
194
+ updateAttribute(this, "data-size", "s");
195
195
  break;
196
196
  }
197
197
  default: {
198
- this.setAttribute("data-size", "xs");
198
+ updateAttribute(this, "data-size", "xs");
199
199
  }
200
200
  }
201
201
  };
package/input/index.js CHANGED
@@ -669,11 +669,11 @@ class Input extends NectaryElement {
669
669
  }
670
670
  switch (e.detail) {
671
671
  case "l": {
672
- this.setAttribute("data-size", "m");
672
+ updateAttribute(this, "data-size", "m");
673
673
  break;
674
674
  }
675
675
  default: {
676
- this.setAttribute("data-size", "s");
676
+ updateAttribute(this, "data-size", "s");
677
677
  }
678
678
  }
679
679
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "5.50.5",
3
+ "version": "5.50.6",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",
@@ -137,11 +137,11 @@ class SelectButton extends NectaryElement {
137
137
  }
138
138
  switch (e.detail) {
139
139
  case "l": {
140
- this.setAttribute("data-size", "m");
140
+ updateAttribute(this, "data-size", "m");
141
141
  break;
142
142
  }
143
143
  default: {
144
- this.setAttribute("data-size", "s");
144
+ updateAttribute(this, "data-size", "s");
145
145
  }
146
146
  }
147
147
  };
package/spinner/index.js CHANGED
@@ -49,11 +49,11 @@ class Spinner extends NectaryElement {
49
49
  switch (e.detail) {
50
50
  case "l":
51
51
  case "m": {
52
- this.setAttribute("data-size", "m");
52
+ updateAttribute(this, "data-size", "m");
53
53
  break;
54
54
  }
55
55
  default: {
56
- this.setAttribute("data-size", "s");
56
+ updateAttribute(this, "data-size", "s");
57
57
  }
58
58
  }
59
59
  };
package/utils/dom.js CHANGED
@@ -18,8 +18,12 @@ const updateBooleanAttribute = ($element, attrName, attrValue) => {
18
18
  }
19
19
  };
20
20
  const updateAttribute = ($element, attrName, attrValue) => {
21
- if (attrValue != null) {
22
- $element.setAttribute(attrName, String(attrValue));
21
+ const nextValue = attrValue != null ? String(attrValue) : null;
22
+ if ($element.getAttribute(attrName) === nextValue) {
23
+ return;
24
+ }
25
+ if (nextValue !== null) {
26
+ $element.setAttribute(attrName, nextValue);
23
27
  } else {
24
28
  $element.removeAttribute(attrName);
25
29
  }