@proximus/lavender-layout 2.0.0-alpha.2 → 2.0.0-alpha.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.
package/dist/Spacer.d.ts CHANGED
@@ -3,6 +3,7 @@ export declare class Spacer extends HTMLElement {
3
3
  private recheckHandle?;
4
4
  private isZeroSized;
5
5
  private growValue;
6
+ private isVertical;
6
7
  constructor();
7
8
  static get observedAttributes(): string[];
8
9
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
package/dist/index.es.js CHANGED
@@ -366,7 +366,7 @@ class C extends l {
366
366
  customElements.get("px-hstack") || customElements.define("px-hstack", C);
367
367
  class $ extends HTMLElement {
368
368
  constructor() {
369
- super(), this.isZeroSized = !1, this.growValue = "1";
369
+ super(), this.isZeroSized = !1, this.growValue = "1", this.isVertical = !1;
370
370
  }
371
371
  static get observedAttributes() {
372
372
  return ["grow"];
@@ -375,13 +375,9 @@ class $ extends HTMLElement {
375
375
  t === "grow" && (this.growValue = e || "1", this.isZeroSized || (this.style.flexGrow = this.growValue), this.scheduleRecheck());
376
376
  }
377
377
  connectedCallback() {
378
- this.growValue = this.getAttribute("grow") || "1", this.style.flexGrow = this.growValue, this.resizeObserver = new ResizeObserver((t) => {
379
- t.forEach((i) => {
380
- this.handleSizeChange(
381
- i.contentRect.width === 0 || i.contentRect.height === 0
382
- );
383
- });
384
- }), this.resizeObserver.observe(this), this.scheduleRecheck();
378
+ this.growValue = this.getAttribute("grow") || "1", this.style.flexGrow = this.growValue, this.resizeObserver = new ResizeObserver(() => {
379
+ this.handleSizeChange();
380
+ }), this.isVertical = this.parentElement.localName === "px-vstack" || this.parentElement.style.flexDirection === "column", this.resizeObserver.observe(this), this.scheduleRecheck();
385
381
  }
386
382
  disconnectedCallback() {
387
383
  var t;
@@ -399,14 +395,11 @@ class $ extends HTMLElement {
399
395
  });
400
396
  }
401
397
  recalculateVisibility() {
402
- if (!this.isConnected)
403
- return;
404
- this.style.display = "", this.style.flexGrow = this.growValue;
405
- const t = this.getBoundingClientRect(), i = t.width === 0 || t.height === 0;
406
- this.handleSizeChange(i);
398
+ this.isConnected && (this.style.display = "", this.style.flexGrow = this.growValue, this.handleSizeChange());
407
399
  }
408
- handleSizeChange(t) {
409
- this.isZeroSized !== t && (this.isZeroSized = t, this.updateParticipation());
400
+ handleSizeChange() {
401
+ const t = this.getBoundingClientRect(), i = t.width === 0 && !this.isVertical || t.height === 0 && this.isVertical;
402
+ this.isZeroSized !== i && (this.isZeroSized = i, this.updateParticipation());
410
403
  }
411
404
  updateParticipation() {
412
405
  this.isZeroSized ? (this.style.display = "none", this.style.flexGrow = "0") : (this.style.display = "", this.style.flexGrow = this.growValue);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-layout",
3
- "version": "2.0.0-alpha.2",
3
+ "version": "2.0.0-alpha.3",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",