@floegence/floe-webapp-core 0.36.8 → 0.36.10

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.
@@ -7,6 +7,7 @@ export interface GridPosition {
7
7
  colSpan: number;
8
8
  rowSpan: number;
9
9
  }
10
+ export declare function sameGridPosition(a: GridPosition, b: GridPosition): boolean;
10
11
  /**
11
12
  * Check if two grid positions overlap using AABB collision detection
12
13
  */
@@ -1,30 +1,34 @@
1
- function e(o, n) {
1
+ function s(o, n) {
2
+ return o.col === n.col && o.row === n.row && o.colSpan === n.colSpan && o.rowSpan === n.rowSpan;
3
+ }
4
+ function w(o, n) {
2
5
  return !(o.col + o.colSpan <= n.col || o.col >= n.col + n.colSpan || o.row + o.rowSpan <= n.row || o.row >= n.row + n.rowSpan);
3
6
  }
4
- function f(o, n, c) {
5
- return n.some((i) => c && i.id === c ? !1 : e(o, i.position));
7
+ function e(o, n, c) {
8
+ return n.some((i) => c && i.id === c ? !1 : w(o, i.position));
6
9
  }
7
- function s(o, n, c, i = 24) {
10
+ function f(o, n, c, i = 24) {
8
11
  for (let r = 0; r < 100; r++)
9
12
  for (let t = 0; t <= i - n; t++) {
10
- const l = { col: t, row: r, colSpan: n, rowSpan: c };
11
- if (!f(l, o))
12
- return l;
13
+ const a = { col: t, row: r, colSpan: n, rowSpan: c };
14
+ if (!e(a, o))
15
+ return a;
13
16
  }
14
- let a = 0;
17
+ let l = 0;
15
18
  for (const r of o) {
16
19
  const t = r.position.row + r.position.rowSpan;
17
- t > a && (a = t);
20
+ t > l && (l = t);
18
21
  }
19
- return { col: 0, row: a, colSpan: n, rowSpan: c };
22
+ return { col: 0, row: l, colSpan: n, rowSpan: c };
20
23
  }
21
- function w(o, n = 4, c = 4, i = 24) {
22
- const a = Math.max(0, Math.min(i - 1, o.col)), r = Math.max(0, o.row), t = Math.max(n, Math.min(i - a, o.colSpan)), l = Math.max(c, o.rowSpan);
23
- return { col: a, row: r, colSpan: t, rowSpan: l };
24
+ function u(o, n = 4, c = 4, i = 24) {
25
+ const l = Math.max(0, Math.min(i - 1, o.col)), r = Math.max(0, o.row), t = Math.max(n, Math.min(i - l, o.colSpan)), a = Math.max(c, o.rowSpan);
26
+ return { col: l, row: r, colSpan: t, rowSpan: a };
24
27
  }
25
28
  export {
26
- e as checkCollision,
27
- w as constrainPosition,
28
- s as findFreePosition,
29
- f as hasCollision
29
+ w as checkCollision,
30
+ u as constrainPosition,
31
+ f as findFreePosition,
32
+ e as hasCollision,
33
+ s as sameGridPosition
30
34
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.36.8",
3
+ "version": "0.36.10",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",