@proximus/lavender 1.0.0-alpha.12 → 1.0.0-alpha.13
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 +12 -61
- package/dist/lavender.umd.js +1 -1
- package/package.json +2 -2
package/dist/lavender.es.js
CHANGED
|
@@ -6,14 +6,6 @@ function getSupportedAttributeNames(htmlElementName) {
|
|
|
6
6
|
}
|
|
7
7
|
const commonStyleSheet = new CSSStyleSheet();
|
|
8
8
|
commonStyleSheet.replaceSync(commonStyles);
|
|
9
|
-
function replayAttributes(element, observedAttributes, callback) {
|
|
10
|
-
observedAttributes.forEach((name) => {
|
|
11
|
-
const value = element.getAttribute(name);
|
|
12
|
-
if (value !== null) {
|
|
13
|
-
callback(name, value);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
9
|
class WithFlexAttributes extends HTMLElement {
|
|
18
10
|
static get observedAttributes() {
|
|
19
11
|
return [
|
|
@@ -174,11 +166,6 @@ class WithFlexAttributes extends HTMLElement {
|
|
|
174
166
|
}
|
|
175
167
|
}
|
|
176
168
|
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
|
-
}
|
|
182
169
|
static get observedAttributes() {
|
|
183
170
|
return [
|
|
184
171
|
...super.observedAttributes,
|
|
@@ -186,12 +173,6 @@ class PxElement extends WithFlexAttributes {
|
|
|
186
173
|
];
|
|
187
174
|
}
|
|
188
175
|
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
|
-
}
|
|
195
176
|
super.attributeChangedCallback(name, oldValue, newValue);
|
|
196
177
|
if (newValue === null) {
|
|
197
178
|
this.$el.toggleAttribute(name);
|
|
@@ -199,18 +180,11 @@ class PxElement extends WithFlexAttributes {
|
|
|
199
180
|
this.$el.setAttribute(name, newValue);
|
|
200
181
|
}
|
|
201
182
|
}
|
|
183
|
+
constructor(semanticTokensStylesheet, ...adoptedStylesheets) {
|
|
184
|
+
super(semanticTokensStylesheet, ...adoptedStylesheets);
|
|
185
|
+
this.nativeName = Object.getPrototypeOf(this).constructor.nativeName;
|
|
186
|
+
}
|
|
202
187
|
connectedCallback() {
|
|
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
|
-
}
|
|
214
188
|
for (const name of getSupportedAttributeNames(this.nativeName)) {
|
|
215
189
|
if (name === "constructor") {
|
|
216
190
|
continue;
|
|
@@ -439,9 +413,6 @@ class Stack extends WithFlexAttributes {
|
|
|
439
413
|
this.shadowRoot.innerHTML = this.template;
|
|
440
414
|
}
|
|
441
415
|
connectedCallback() {
|
|
442
|
-
replayAttributes(this, Stack.observedAttributes, (name, value) => {
|
|
443
|
-
this.attributeChangedCallback(name, null, value);
|
|
444
|
-
});
|
|
445
416
|
if (!this.hasAttribute("direction")) {
|
|
446
417
|
this.direction = "row";
|
|
447
418
|
}
|
|
@@ -1071,13 +1042,16 @@ class Page extends WithFlexAttributes {
|
|
|
1071
1042
|
if (oldValue !== newValue) {
|
|
1072
1043
|
switch (name) {
|
|
1073
1044
|
case "background-image":
|
|
1074
|
-
this.$imageContainer.
|
|
1045
|
+
this.$imageContainer.setAttribute("bgimg-mobile", newValue);
|
|
1075
1046
|
break;
|
|
1076
1047
|
case "gap":
|
|
1077
|
-
this.$bodyVStackContainer.gap
|
|
1048
|
+
this.$bodyVStackContainer.setAttribute("gap", newValue);
|
|
1078
1049
|
break;
|
|
1079
1050
|
case "background-color":
|
|
1080
|
-
this.$bodyContainer.
|
|
1051
|
+
this.$bodyContainer.setAttribute(
|
|
1052
|
+
"bgcolor",
|
|
1053
|
+
bgColorValues.indexOf(newValue) > 0 ? newValue : "none"
|
|
1054
|
+
);
|
|
1081
1055
|
break;
|
|
1082
1056
|
case "padding-vertical":
|
|
1083
1057
|
this.handlePaddingVerticalChange(newValue);
|
|
@@ -1091,8 +1065,8 @@ class Page extends WithFlexAttributes {
|
|
|
1091
1065
|
}
|
|
1092
1066
|
}
|
|
1093
1067
|
handlePaddingVerticalChange(newValue) {
|
|
1094
|
-
this.$headerContainer.
|
|
1095
|
-
this.$footerContainer.
|
|
1068
|
+
this.$headerContainer.setAttribute("paddingtop", newValue);
|
|
1069
|
+
this.$footerContainer.setAttribute("paddingbottom", newValue);
|
|
1096
1070
|
}
|
|
1097
1071
|
handlePaddingHorizontalChange(newValue) {
|
|
1098
1072
|
this.$headerContainer.paddingLeft = newValue;
|
|
@@ -1683,9 +1657,6 @@ class Section2 extends HTMLElement {
|
|
|
1683
1657
|
this.shadowRoot.adoptedStyleSheets = [semanticTokensStylesheet, styleSheet$9];
|
|
1684
1658
|
}
|
|
1685
1659
|
connectedCallback() {
|
|
1686
|
-
replayAttributes(this, Section2.observedAttributes, (name, value) => {
|
|
1687
|
-
this.attributeChangedCallback(name, null, value);
|
|
1688
|
-
});
|
|
1689
1660
|
const headingSlot = this.querySelector('[slot="heading"]');
|
|
1690
1661
|
if (!headingSlot) {
|
|
1691
1662
|
this.shadowRoot.querySelector("px-vstack").setAttribute("gap", "none");
|
|
@@ -2250,11 +2221,6 @@ class Patch extends HTMLElement {
|
|
|
2250
2221
|
}
|
|
2251
2222
|
}
|
|
2252
2223
|
}
|
|
2253
|
-
connectedCallback() {
|
|
2254
|
-
replayAttributes(this, Patch.observedAttributes, (name, value) => {
|
|
2255
|
-
this.attributeChangedCallback(name, null, value);
|
|
2256
|
-
});
|
|
2257
|
-
}
|
|
2258
2224
|
_toggleClass(oldValue, newValue) {
|
|
2259
2225
|
if (oldValue !== null && oldValue !== "" && oldValue !== "default") {
|
|
2260
2226
|
this.$el.classList.toggle(oldValue);
|
|
@@ -2613,9 +2579,6 @@ class Tabs extends HTMLElement {
|
|
|
2613
2579
|
}
|
|
2614
2580
|
}
|
|
2615
2581
|
connectedCallback() {
|
|
2616
|
-
replayAttributes(this, Tabs.observedAttributes, (name, value) => {
|
|
2617
|
-
this.attributeChangedCallback(name, null, value);
|
|
2618
|
-
});
|
|
2619
2582
|
this.addEventListener("click", (event) => {
|
|
2620
2583
|
var _a;
|
|
2621
2584
|
if ((_a = event.target.localName) == null ? void 0 : _a.endsWith("-tab")) {
|
|
@@ -2698,9 +2661,6 @@ class Tab extends HTMLElement {
|
|
|
2698
2661
|
return ["selected", "for", "name"];
|
|
2699
2662
|
}
|
|
2700
2663
|
connectedCallback() {
|
|
2701
|
-
replayAttributes(this, Tab.observedAttributes, (name, value) => {
|
|
2702
|
-
this.attributeChangedCallback(name, null, value);
|
|
2703
|
-
});
|
|
2704
2664
|
if (!this.name) {
|
|
2705
2665
|
console.error("Tab needs a name attribute");
|
|
2706
2666
|
}
|
|
@@ -2867,9 +2827,6 @@ class Timeline extends HTMLElement {
|
|
|
2867
2827
|
return ["inverted"];
|
|
2868
2828
|
}
|
|
2869
2829
|
connectedCallback() {
|
|
2870
|
-
replayAttributes(this, Timeline.observedAttributes, (name, value) => {
|
|
2871
|
-
this.attributeChangedCallback(name, null, value);
|
|
2872
|
-
});
|
|
2873
2830
|
this.configureChildren();
|
|
2874
2831
|
}
|
|
2875
2832
|
attributeChangedCallback(attrName, oldValue, newValue) {
|
|
@@ -2939,11 +2896,6 @@ class TimelineItem extends HTMLElement {
|
|
|
2939
2896
|
static get observedAttributes() {
|
|
2940
2897
|
return ["inverted", "lastchild", "item"];
|
|
2941
2898
|
}
|
|
2942
|
-
connectedCallback() {
|
|
2943
|
-
replayAttributes(this, TimelineItem.observedAttributes, (name, value) => {
|
|
2944
|
-
this.attributeChangedCallback(name, null, value);
|
|
2945
|
-
});
|
|
2946
|
-
}
|
|
2947
2899
|
attributeChangedCallback(attrName, oldValue, newValue) {
|
|
2948
2900
|
if (oldValue !== newValue) {
|
|
2949
2901
|
switch (attrName) {
|
|
@@ -3535,6 +3487,5 @@ export {
|
|
|
3535
3487
|
isFalsy,
|
|
3536
3488
|
paddingValues,
|
|
3537
3489
|
proximusSemanticStyleSheet,
|
|
3538
|
-
replayAttributes,
|
|
3539
3490
|
shadowValues
|
|
3540
3491
|
};
|