@proximus/lavender 1.0.0-alpha.11 → 1.0.0-alpha.12
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/dist/lavender.cjs.js +1 -1
- package/dist/lavender.es.js +40 -11
- package/dist/lavender.umd.js +1 -1
- package/package.json +2 -2
package/dist/lavender.es.js
CHANGED
|
@@ -174,6 +174,11 @@ class WithFlexAttributes extends HTMLElement {
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
class PxElement extends WithFlexAttributes {
|
|
177
|
+
constructor(semanticTokensStylesheet, ...adoptedStylesheets) {
|
|
178
|
+
super(semanticTokensStylesheet, ...adoptedStylesheets);
|
|
179
|
+
this.replayAttributes = false;
|
|
180
|
+
this.nativeName = Object.getPrototypeOf(this).constructor.nativeName;
|
|
181
|
+
}
|
|
177
182
|
static get observedAttributes() {
|
|
178
183
|
return [
|
|
179
184
|
...super.observedAttributes,
|
|
@@ -181,6 +186,12 @@ class PxElement extends WithFlexAttributes {
|
|
|
181
186
|
];
|
|
182
187
|
}
|
|
183
188
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
189
|
+
if (!this.shadowRoot) {
|
|
190
|
+
console.warn(
|
|
191
|
+
"shadowRoot not available yet, replaying attributes once connected"
|
|
192
|
+
);
|
|
193
|
+
this.replayAttributes = true;
|
|
194
|
+
}
|
|
184
195
|
super.attributeChangedCallback(name, oldValue, newValue);
|
|
185
196
|
if (newValue === null) {
|
|
186
197
|
this.$el.toggleAttribute(name);
|
|
@@ -188,14 +199,18 @@ class PxElement extends WithFlexAttributes {
|
|
|
188
199
|
this.$el.setAttribute(name, newValue);
|
|
189
200
|
}
|
|
190
201
|
}
|
|
191
|
-
constructor(semanticTokensStylesheet, ...adoptedStylesheets) {
|
|
192
|
-
super(semanticTokensStylesheet, ...adoptedStylesheets);
|
|
193
|
-
this.nativeName = Object.getPrototypeOf(this).constructor.nativeName;
|
|
194
|
-
}
|
|
195
202
|
connectedCallback() {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
203
|
+
if (this.replayAttributes) {
|
|
204
|
+
replayAttributes(
|
|
205
|
+
this,
|
|
206
|
+
Object.getPrototypeOf(this).constructor.observedAttributes,
|
|
207
|
+
(name, value) => {
|
|
208
|
+
if (this.getAttribute(name) !== null) {
|
|
209
|
+
this.attributeChangedCallback(name, null, value);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
}
|
|
199
214
|
for (const name of getSupportedAttributeNames(this.nativeName)) {
|
|
200
215
|
if (name === "constructor") {
|
|
201
216
|
continue;
|
|
@@ -1395,10 +1410,20 @@ const _Container = class _Container extends PxElement {
|
|
|
1395
1410
|
this.updateAttribute(attrName, oldValue, newValue, borderValues);
|
|
1396
1411
|
break;
|
|
1397
1412
|
case "borderradius":
|
|
1398
|
-
this.updateAttribute(
|
|
1413
|
+
this.updateAttribute(
|
|
1414
|
+
attrName,
|
|
1415
|
+
oldValue,
|
|
1416
|
+
newValue,
|
|
1417
|
+
borderRadiusValues
|
|
1418
|
+
);
|
|
1399
1419
|
break;
|
|
1400
1420
|
case "noborderradius":
|
|
1401
|
-
this.updateAttribute(
|
|
1421
|
+
this.updateAttribute(
|
|
1422
|
+
attrName,
|
|
1423
|
+
oldValue,
|
|
1424
|
+
newValue,
|
|
1425
|
+
noBorderRadiusValues
|
|
1426
|
+
);
|
|
1402
1427
|
break;
|
|
1403
1428
|
case "bgcolor":
|
|
1404
1429
|
this.updateAttribute(attrName, oldValue, newValue, bgColorValues);
|
|
@@ -1444,7 +1469,9 @@ const _Container = class _Container extends PxElement {
|
|
|
1444
1469
|
if (this.checkName(gradientValues, newValue)) {
|
|
1445
1470
|
this.$el.style.background = `linear-gradient(var(--px-color-bg-gradient-${newValue}))`;
|
|
1446
1471
|
} else {
|
|
1447
|
-
console.error(
|
|
1472
|
+
console.error(
|
|
1473
|
+
`${newValue} is not an allowed gradient value for ${this.$el}`
|
|
1474
|
+
);
|
|
1448
1475
|
}
|
|
1449
1476
|
}
|
|
1450
1477
|
updateAttribute(attrName, oldValue, newValue, attrValues) {
|
|
@@ -1455,7 +1482,9 @@ const _Container = class _Container extends PxElement {
|
|
|
1455
1482
|
this.$el.classList.toggle(`${attrName}-${newValue}`);
|
|
1456
1483
|
}
|
|
1457
1484
|
if (!this.checkName(attrValues, newValue)) {
|
|
1458
|
-
console.error(
|
|
1485
|
+
console.error(
|
|
1486
|
+
`${newValue} is not an allowed ${attrName} value for ${this.$el}`
|
|
1487
|
+
);
|
|
1459
1488
|
}
|
|
1460
1489
|
}
|
|
1461
1490
|
checkName(values, value) {
|