@proximus/lavender 1.0.0-alpha.11 → 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.
@@ -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 [
@@ -193,9 +185,6 @@ class PxElement extends WithFlexAttributes {
193
185
  this.nativeName = Object.getPrototypeOf(this).constructor.nativeName;
194
186
  }
195
187
  connectedCallback() {
196
- replayAttributes(this, PxElement.observedAttributes, (name, value) => {
197
- this.attributeChangedCallback(name, null, value);
198
- });
199
188
  for (const name of getSupportedAttributeNames(this.nativeName)) {
200
189
  if (name === "constructor") {
201
190
  continue;
@@ -424,9 +413,6 @@ class Stack extends WithFlexAttributes {
424
413
  this.shadowRoot.innerHTML = this.template;
425
414
  }
426
415
  connectedCallback() {
427
- replayAttributes(this, Stack.observedAttributes, (name, value) => {
428
- this.attributeChangedCallback(name, null, value);
429
- });
430
416
  if (!this.hasAttribute("direction")) {
431
417
  this.direction = "row";
432
418
  }
@@ -1056,13 +1042,16 @@ class Page extends WithFlexAttributes {
1056
1042
  if (oldValue !== newValue) {
1057
1043
  switch (name) {
1058
1044
  case "background-image":
1059
- this.$imageContainer.bgImgMobile = newValue;
1045
+ this.$imageContainer.setAttribute("bgimg-mobile", newValue);
1060
1046
  break;
1061
1047
  case "gap":
1062
- this.$bodyVStackContainer.gap = newValue;
1048
+ this.$bodyVStackContainer.setAttribute("gap", newValue);
1063
1049
  break;
1064
1050
  case "background-color":
1065
- this.$bodyContainer.bgColor = bgColorValues.indexOf(newValue) > 0 ? newValue : "none";
1051
+ this.$bodyContainer.setAttribute(
1052
+ "bgcolor",
1053
+ bgColorValues.indexOf(newValue) > 0 ? newValue : "none"
1054
+ );
1066
1055
  break;
1067
1056
  case "padding-vertical":
1068
1057
  this.handlePaddingVerticalChange(newValue);
@@ -1076,8 +1065,8 @@ class Page extends WithFlexAttributes {
1076
1065
  }
1077
1066
  }
1078
1067
  handlePaddingVerticalChange(newValue) {
1079
- this.$headerContainer.paddingTop = newValue;
1080
- this.$footerContainer.paddingBottom = newValue;
1068
+ this.$headerContainer.setAttribute("paddingtop", newValue);
1069
+ this.$footerContainer.setAttribute("paddingbottom", newValue);
1081
1070
  }
1082
1071
  handlePaddingHorizontalChange(newValue) {
1083
1072
  this.$headerContainer.paddingLeft = newValue;
@@ -1395,10 +1384,20 @@ const _Container = class _Container extends PxElement {
1395
1384
  this.updateAttribute(attrName, oldValue, newValue, borderValues);
1396
1385
  break;
1397
1386
  case "borderradius":
1398
- this.updateAttribute(attrName, oldValue, newValue, borderRadiusValues);
1387
+ this.updateAttribute(
1388
+ attrName,
1389
+ oldValue,
1390
+ newValue,
1391
+ borderRadiusValues
1392
+ );
1399
1393
  break;
1400
1394
  case "noborderradius":
1401
- this.updateAttribute(attrName, oldValue, newValue, noBorderRadiusValues);
1395
+ this.updateAttribute(
1396
+ attrName,
1397
+ oldValue,
1398
+ newValue,
1399
+ noBorderRadiusValues
1400
+ );
1402
1401
  break;
1403
1402
  case "bgcolor":
1404
1403
  this.updateAttribute(attrName, oldValue, newValue, bgColorValues);
@@ -1444,7 +1443,9 @@ const _Container = class _Container extends PxElement {
1444
1443
  if (this.checkName(gradientValues, newValue)) {
1445
1444
  this.$el.style.background = `linear-gradient(var(--px-color-bg-gradient-${newValue}))`;
1446
1445
  } else {
1447
- console.error(`${newValue} is not an allowed gradient value for ${this.$el}`);
1446
+ console.error(
1447
+ `${newValue} is not an allowed gradient value for ${this.$el}`
1448
+ );
1448
1449
  }
1449
1450
  }
1450
1451
  updateAttribute(attrName, oldValue, newValue, attrValues) {
@@ -1455,7 +1456,9 @@ const _Container = class _Container extends PxElement {
1455
1456
  this.$el.classList.toggle(`${attrName}-${newValue}`);
1456
1457
  }
1457
1458
  if (!this.checkName(attrValues, newValue)) {
1458
- console.error(`${newValue} is not an allowed ${attrName} value for ${this.$el}`);
1459
+ console.error(
1460
+ `${newValue} is not an allowed ${attrName} value for ${this.$el}`
1461
+ );
1459
1462
  }
1460
1463
  }
1461
1464
  checkName(values, value) {
@@ -1654,9 +1657,6 @@ class Section2 extends HTMLElement {
1654
1657
  this.shadowRoot.adoptedStyleSheets = [semanticTokensStylesheet, styleSheet$9];
1655
1658
  }
1656
1659
  connectedCallback() {
1657
- replayAttributes(this, Section2.observedAttributes, (name, value) => {
1658
- this.attributeChangedCallback(name, null, value);
1659
- });
1660
1660
  const headingSlot = this.querySelector('[slot="heading"]');
1661
1661
  if (!headingSlot) {
1662
1662
  this.shadowRoot.querySelector("px-vstack").setAttribute("gap", "none");
@@ -2221,11 +2221,6 @@ class Patch extends HTMLElement {
2221
2221
  }
2222
2222
  }
2223
2223
  }
2224
- connectedCallback() {
2225
- replayAttributes(this, Patch.observedAttributes, (name, value) => {
2226
- this.attributeChangedCallback(name, null, value);
2227
- });
2228
- }
2229
2224
  _toggleClass(oldValue, newValue) {
2230
2225
  if (oldValue !== null && oldValue !== "" && oldValue !== "default") {
2231
2226
  this.$el.classList.toggle(oldValue);
@@ -2584,9 +2579,6 @@ class Tabs extends HTMLElement {
2584
2579
  }
2585
2580
  }
2586
2581
  connectedCallback() {
2587
- replayAttributes(this, Tabs.observedAttributes, (name, value) => {
2588
- this.attributeChangedCallback(name, null, value);
2589
- });
2590
2582
  this.addEventListener("click", (event) => {
2591
2583
  var _a;
2592
2584
  if ((_a = event.target.localName) == null ? void 0 : _a.endsWith("-tab")) {
@@ -2669,9 +2661,6 @@ class Tab extends HTMLElement {
2669
2661
  return ["selected", "for", "name"];
2670
2662
  }
2671
2663
  connectedCallback() {
2672
- replayAttributes(this, Tab.observedAttributes, (name, value) => {
2673
- this.attributeChangedCallback(name, null, value);
2674
- });
2675
2664
  if (!this.name) {
2676
2665
  console.error("Tab needs a name attribute");
2677
2666
  }
@@ -2838,9 +2827,6 @@ class Timeline extends HTMLElement {
2838
2827
  return ["inverted"];
2839
2828
  }
2840
2829
  connectedCallback() {
2841
- replayAttributes(this, Timeline.observedAttributes, (name, value) => {
2842
- this.attributeChangedCallback(name, null, value);
2843
- });
2844
2830
  this.configureChildren();
2845
2831
  }
2846
2832
  attributeChangedCallback(attrName, oldValue, newValue) {
@@ -2910,11 +2896,6 @@ class TimelineItem extends HTMLElement {
2910
2896
  static get observedAttributes() {
2911
2897
  return ["inverted", "lastchild", "item"];
2912
2898
  }
2913
- connectedCallback() {
2914
- replayAttributes(this, TimelineItem.observedAttributes, (name, value) => {
2915
- this.attributeChangedCallback(name, null, value);
2916
- });
2917
- }
2918
2899
  attributeChangedCallback(attrName, oldValue, newValue) {
2919
2900
  if (oldValue !== newValue) {
2920
2901
  switch (attrName) {
@@ -3506,6 +3487,5 @@ export {
3506
3487
  isFalsy,
3507
3488
  paddingValues,
3508
3489
  proximusSemanticStyleSheet,
3509
- replayAttributes,
3510
3490
  shadowValues
3511
3491
  };