@thi.ng/layout 3.0.47 → 3.1.0

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-08-10T15:03:07Z
3
+ - **Last updated**: 2024-08-13T19:40:07Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ## [3.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/layout@3.1.0) (2024-08-13)
13
+
14
+ #### 🚀 Features
15
+
16
+ - add StackedLayout.isEqualized() ([b93702c](https://github.com/thi-ng/umbrella/commit/b93702c))
17
+
12
18
  ### [3.0.37](https://github.com/thi-ng/umbrella/tree/@thi.ng/layout@3.0.37) (2024-04-20)
13
19
 
14
20
  #### ♻️ Refactoring
package/README.md CHANGED
@@ -74,7 +74,7 @@ For Node.js REPL:
74
74
  const l = await import("@thi.ng/layout");
75
75
  ```
76
76
 
77
- Package sizes (brotli'd, pre-treeshake): ESM: 1.19 KB
77
+ Package sizes (brotli'd, pre-treeshake): ESM: 1.21 KB
78
78
 
79
79
  ## Dependencies
80
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/layout",
3
- "version": "3.0.47",
3
+ "version": "3.1.0",
4
4
  "description": "Configurable nested 2D grid layout generators",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -52,6 +52,7 @@
52
52
  "datastructure",
53
53
  "design",
54
54
  "grid",
55
+ "gui",
55
56
  "layout",
56
57
  "recursion",
57
58
  "tree",
@@ -95,5 +96,5 @@
95
96
  ],
96
97
  "year": 2019
97
98
  },
98
- "gitHead": "ec78f98d015e4d214a0b840e72e497407807daf3\n"
99
+ "gitHead": "e914ebbd81c56783c39cf746548c547cbacadc96\n"
99
100
  }
@@ -36,6 +36,10 @@ export declare class StackedLayout extends GridLayout {
36
36
  */
37
37
  availableSpan(maxSpan?: CellSpan): CellSpan;
38
38
  propagateSize(rspan: number): void;
39
+ /**
40
+ * Returns true if all column offsets/heights in the layout are equal.
41
+ */
42
+ isEqualized(): boolean;
39
43
  }
40
44
  /**
41
45
  * Syntax sugar for {@link StackedLayout} ctor. By default creates a 4-column
package/stacked-layout.js CHANGED
@@ -82,6 +82,12 @@ class StackedLayout extends GridLayout {
82
82
  this.offsets.fill(newY, this.currCol, this.currCol + this.currSpan);
83
83
  this.parent && this.parent.propagateSize(newY);
84
84
  }
85
+ /**
86
+ * Returns true if all column offsets/heights in the layout are equal.
87
+ */
88
+ isEqualized() {
89
+ return Math.min(...this.offsets) === Math.max(...this.offsets);
90
+ }
85
91
  }
86
92
  const stackedLayout = (x, y, width, cols = 4, rowH = 16, gap = 4) => new StackedLayout(null, x, y, width, cols, rowH, gap);
87
93
  export {