@zag-js/rect-utils 2.0.0-next.2 → 2.0.0-next.4

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.
Files changed (89) hide show
  1. package/dist/align.d.mts +2 -5
  2. package/dist/align.d.ts +2 -5
  3. package/dist/align.js +27 -44
  4. package/dist/align.mjs +23 -19
  5. package/dist/angle.d.mts +2 -5
  6. package/dist/angle.d.ts +2 -5
  7. package/dist/angle.js +8 -32
  8. package/dist/angle.mjs +4 -7
  9. package/dist/clamp.d.mts +8 -11
  10. package/dist/clamp.d.ts +8 -11
  11. package/dist/clamp.js +23 -46
  12. package/dist/clamp.mjs +18 -20
  13. package/dist/closest.d.mts +4 -7
  14. package/dist/closest.d.ts +4 -7
  15. package/dist/closest.js +35 -62
  16. package/dist/closest.mjs +29 -35
  17. package/dist/compass.d.mts +1 -3
  18. package/dist/compass.d.ts +1 -3
  19. package/dist/compass.js +4 -18
  20. package/dist/compass.mjs +1 -0
  21. package/dist/constrain.d.mts +2 -5
  22. package/dist/constrain.d.ts +2 -5
  23. package/dist/constrain.js +12 -37
  24. package/dist/constrain.mjs +8 -12
  25. package/dist/contains.d.mts +4 -7
  26. package/dist/contains.d.ts +4 -7
  27. package/dist/contains.js +11 -36
  28. package/dist/contains.mjs +5 -9
  29. package/dist/distance.d.mts +7 -10
  30. package/dist/distance.d.ts +7 -10
  31. package/dist/distance.js +55 -60
  32. package/dist/distance.mjs +48 -32
  33. package/dist/equality.d.mts +4 -7
  34. package/dist/equality.d.ts +4 -7
  35. package/dist/equality.js +13 -38
  36. package/dist/equality.mjs +7 -11
  37. package/dist/from-element.d.mts +12 -15
  38. package/dist/from-element.d.ts +12 -15
  39. package/dist/from-element.js +39 -58
  40. package/dist/from-element.mjs +35 -33
  41. package/dist/from-points.d.mts +2 -5
  42. package/dist/from-points.d.ts +2 -5
  43. package/dist/from-points.js +18 -36
  44. package/dist/from-points.mjs +14 -11
  45. package/dist/from-range.d.mts +2 -5
  46. package/dist/from-range.d.ts +2 -5
  47. package/dist/from-range.js +25 -46
  48. package/dist/from-range.mjs +19 -19
  49. package/dist/from-rotation.d.mts +4 -7
  50. package/dist/from-rotation.d.ts +4 -7
  51. package/dist/from-rotation.js +31 -56
  52. package/dist/from-rotation.mjs +25 -29
  53. package/dist/from-window.d.mts +13 -16
  54. package/dist/from-window.d.ts +13 -16
  55. package/dist/from-window.js +29 -44
  56. package/dist/from-window.mjs +24 -18
  57. package/dist/index.d.mts +21 -21
  58. package/dist/index.d.ts +21 -21
  59. package/dist/index.js +91 -61
  60. package/dist/index.mjs +20 -21
  61. package/dist/interact.d.mts +34 -37
  62. package/dist/interact.d.ts +34 -37
  63. package/dist/interact.js +414 -350
  64. package/dist/interact.mjs +396 -311
  65. package/dist/intersection.d.mts +4 -7
  66. package/dist/intersection.d.ts +4 -7
  67. package/dist/intersection.js +34 -45
  68. package/dist/intersection.mjs +28 -18
  69. package/dist/operations.d.mts +6 -9
  70. package/dist/operations.d.ts +6 -9
  71. package/dist/operations.js +38 -57
  72. package/dist/operations.mjs +30 -28
  73. package/dist/polygon.d.mts +6 -9
  74. package/dist/polygon.d.ts +6 -9
  75. package/dist/polygon.js +73 -82
  76. package/dist/polygon.mjs +67 -55
  77. package/dist/rect.d.mts +55 -58
  78. package/dist/rect.d.ts +55 -58
  79. package/dist/rect.js +88 -117
  80. package/dist/rect.mjs +70 -78
  81. package/dist/types.d.mts +42 -46
  82. package/dist/types.d.ts +42 -46
  83. package/dist/types.js +4 -18
  84. package/dist/types.mjs +1 -0
  85. package/dist/union.d.mts +2 -5
  86. package/dist/union.d.ts +2 -5
  87. package/dist/union.js +16 -39
  88. package/dist/union.mjs +12 -14
  89. package/package.json +2 -2
@@ -1,5 +1,2 @@
1
- import { RectInit } from './types.js';
2
-
3
- declare const constrainRect: (rect: RectInit, boundary: RectInit) => RectInit;
4
-
5
- export { constrainRect };
1
+ import { RectInit } from "./types.js";
2
+ export declare const constrainRect: (rect: RectInit, boundary: RectInit) => RectInit;
package/dist/constrain.js CHANGED
@@ -1,39 +1,14 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/constrain.ts
21
- var constrain_exports = {};
22
- __export(constrain_exports, {
23
- constrainRect: () => constrainRect
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
24
4
  });
25
- module.exports = __toCommonJS(constrain_exports);
26
- var constrainRect = (rect, boundary) => {
27
- const left = Math.max(boundary.x, Math.min(rect.x, boundary.x + boundary.width - rect.width));
28
- const top = Math.max(boundary.y, Math.min(rect.y, boundary.y + boundary.height - rect.height));
29
- return {
30
- x: left,
31
- y: top,
32
- width: Math.min(rect.width, boundary.width),
33
- height: Math.min(rect.height, boundary.height)
34
- };
5
+ // src/constrain.ts
6
+ const constrainRect = (rect, boundary) => {
7
+ return {
8
+ x: Math.max(boundary.x, Math.min(rect.x, boundary.x + boundary.width - rect.width)),
9
+ y: Math.max(boundary.y, Math.min(rect.y, boundary.y + boundary.height - rect.height)),
10
+ width: Math.min(rect.width, boundary.width),
11
+ height: Math.min(rect.height, boundary.height)
12
+ };
35
13
  };
36
- // Annotate the CommonJS export names for ESM import in node:
37
- 0 && (module.exports = {
38
- constrainRect
39
- });
14
+ exports.constrainRect = constrainRect;
@@ -1,14 +1,10 @@
1
1
  // src/constrain.ts
2
- var constrainRect = (rect, boundary) => {
3
- const left = Math.max(boundary.x, Math.min(rect.x, boundary.x + boundary.width - rect.width));
4
- const top = Math.max(boundary.y, Math.min(rect.y, boundary.y + boundary.height - rect.height));
5
- return {
6
- x: left,
7
- y: top,
8
- width: Math.min(rect.width, boundary.width),
9
- height: Math.min(rect.height, boundary.height)
10
- };
11
- };
12
- export {
13
- constrainRect
2
+ const constrainRect = (rect, boundary) => {
3
+ return {
4
+ x: Math.max(boundary.x, Math.min(rect.x, boundary.x + boundary.width - rect.width)),
5
+ y: Math.max(boundary.y, Math.min(rect.y, boundary.y + boundary.height - rect.height)),
6
+ width: Math.min(rect.width, boundary.width),
7
+ height: Math.min(rect.height, boundary.height)
8
+ };
14
9
  };
10
+ export { constrainRect };
@@ -1,7 +1,4 @@
1
- import { Rect, Point } from './types.mjs';
2
-
3
- declare function containsPoint(r: Rect, p: Point): boolean;
4
- declare function containsRect(a: Rect, b: Rect): boolean;
5
- declare function contains(r: Rect, v: Rect | Point): boolean;
6
-
7
- export { contains, containsPoint, containsRect };
1
+ import { Point, Rect } from "./types.mjs";
2
+ export declare function containsPoint(r: Rect, p: Point): boolean;
3
+ export declare function containsRect(a: Rect, b: Rect): boolean;
4
+ export declare function contains(r: Rect, v: Rect | Point): boolean;
@@ -1,7 +1,4 @@
1
- import { Rect, Point } from './types.js';
2
-
3
- declare function containsPoint(r: Rect, p: Point): boolean;
4
- declare function containsRect(a: Rect, b: Rect): boolean;
5
- declare function contains(r: Rect, v: Rect | Point): boolean;
6
-
7
- export { contains, containsPoint, containsRect };
1
+ import { Point, Rect } from "./types.js";
2
+ export declare function containsPoint(r: Rect, p: Point): boolean;
3
+ export declare function containsRect(a: Rect, b: Rect): boolean;
4
+ export declare function contains(r: Rect, v: Rect | Point): boolean;
package/dist/contains.js CHANGED
@@ -1,43 +1,18 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/contains.ts
21
- var contains_exports = {};
22
- __export(contains_exports, {
23
- contains: () => contains,
24
- containsPoint: () => containsPoint,
25
- containsRect: () => containsRect
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
26
4
  });
27
- module.exports = __toCommonJS(contains_exports);
28
- var import_rect = require("./rect.js");
5
+ const require_rect = require("./rect.js");
6
+ // src/contains.ts
29
7
  function containsPoint(r, p) {
30
- return r.minX <= p.x && p.x <= r.maxX && r.minY <= p.y && p.y <= r.maxY;
8
+ return r.minX <= p.x && p.x <= r.maxX && r.minY <= p.y && p.y <= r.maxY;
31
9
  }
32
10
  function containsRect(a, b) {
33
- return Object.values((0, import_rect.getRectCorners)(b)).every((c) => containsPoint(a, c));
11
+ return Object.values(require_rect.getRectCorners(b)).every((c) => containsPoint(a, c));
34
12
  }
35
13
  function contains(r, v) {
36
- return (0, import_rect.isRect)(v) ? containsRect(r, v) : containsPoint(r, v);
14
+ return require_rect.isRect(v) ? containsRect(r, v) : containsPoint(r, v);
37
15
  }
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- contains,
41
- containsPoint,
42
- containsRect
43
- });
16
+ exports.contains = contains;
17
+ exports.containsPoint = containsPoint;
18
+ exports.containsRect = containsRect;
package/dist/contains.mjs CHANGED
@@ -1,16 +1,12 @@
1
- // src/contains.ts
2
1
  import { getRectCorners, isRect } from "./rect.mjs";
2
+ // src/contains.ts
3
3
  function containsPoint(r, p) {
4
- return r.minX <= p.x && p.x <= r.maxX && r.minY <= p.y && p.y <= r.maxY;
4
+ return r.minX <= p.x && p.x <= r.maxX && r.minY <= p.y && p.y <= r.maxY;
5
5
  }
6
6
  function containsRect(a, b) {
7
- return Object.values(getRectCorners(b)).every((c) => containsPoint(a, c));
7
+ return Object.values(getRectCorners(b)).every((c) => containsPoint(a, c));
8
8
  }
9
9
  function contains(r, v) {
10
- return isRect(v) ? containsRect(r, v) : containsPoint(r, v);
10
+ return isRect(v) ? containsRect(r, v) : containsPoint(r, v);
11
11
  }
12
- export {
13
- contains,
14
- containsPoint,
15
- containsRect
16
- };
12
+ export { contains, containsPoint, containsRect };
@@ -1,11 +1,8 @@
1
- import { Point, Rect, RectSide } from './types.mjs';
2
-
3
- interface DistanceValue extends Point {
4
- value: number;
1
+ import { Point, Rect, RectSide } from "./types.mjs";
2
+ export interface DistanceValue extends Point {
3
+ value: number;
5
4
  }
6
- declare function distance(a: Point, b?: Point): number;
7
- declare function distanceFromPoint(r: Rect, p: Point): DistanceValue;
8
- declare function distanceFromRect(a: Rect, b: Rect): DistanceValue;
9
- declare function distanceBtwEdges(a: Rect, b: Rect): Record<RectSide, number>;
10
-
11
- export { type DistanceValue, distance, distanceBtwEdges, distanceFromPoint, distanceFromRect };
5
+ export declare function distance(a: Point, b?: Point): number;
6
+ export declare function distanceFromPoint(r: Rect, p: Point): DistanceValue;
7
+ export declare function distanceFromRect(a: Rect, b: Rect): DistanceValue;
8
+ export declare function distanceBtwEdges(a: Rect, b: Rect): Record<RectSide, number>;
@@ -1,11 +1,8 @@
1
- import { Point, Rect, RectSide } from './types.js';
2
-
3
- interface DistanceValue extends Point {
4
- value: number;
1
+ import { Point, Rect, RectSide } from "./types.js";
2
+ export interface DistanceValue extends Point {
3
+ value: number;
5
4
  }
6
- declare function distance(a: Point, b?: Point): number;
7
- declare function distanceFromPoint(r: Rect, p: Point): DistanceValue;
8
- declare function distanceFromRect(a: Rect, b: Rect): DistanceValue;
9
- declare function distanceBtwEdges(a: Rect, b: Rect): Record<RectSide, number>;
10
-
11
- export { type DistanceValue, distance, distanceBtwEdges, distanceFromPoint, distanceFromRect };
5
+ export declare function distance(a: Point, b?: Point): number;
6
+ export declare function distanceFromPoint(r: Rect, p: Point): DistanceValue;
7
+ export declare function distanceFromRect(a: Rect, b: Rect): DistanceValue;
8
+ export declare function distanceBtwEdges(a: Rect, b: Rect): Record<RectSide, number>;
package/dist/distance.js CHANGED
@@ -1,68 +1,63 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/distance.ts
21
- var distance_exports = {};
22
- __export(distance_exports, {
23
- distance: () => distance,
24
- distanceBtwEdges: () => distanceBtwEdges,
25
- distanceFromPoint: () => distanceFromPoint,
26
- distanceFromRect: () => distanceFromRect
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
27
4
  });
28
- module.exports = __toCommonJS(distance_exports);
29
- var import_intersection = require("./intersection.js");
30
- function distance(a, b = { x: 0, y: 0 }) {
31
- return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
5
+ const require_intersection = require("./intersection.js");
6
+ // src/distance.ts
7
+ function distance(a, b = {
8
+ x: 0,
9
+ y: 0
10
+ }) {
11
+ return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
32
12
  }
33
13
  function distanceFromPoint(r, p) {
34
- let x = 0;
35
- let y = 0;
36
- if (p.x < r.x) x = r.x - p.x;
37
- else if (p.x > r.maxX) x = p.x - r.maxX;
38
- if (p.y < r.y) y = r.y - p.y;
39
- else if (p.y > r.maxY) y = p.y - r.maxY;
40
- return { x, y, value: distance({ x, y }) };
14
+ let x = 0;
15
+ let y = 0;
16
+ if (p.x < r.x) x = r.x - p.x;
17
+ else if (p.x > r.maxX) x = p.x - r.maxX;
18
+ if (p.y < r.y) y = r.y - p.y;
19
+ else if (p.y > r.maxY) y = p.y - r.maxY;
20
+ return {
21
+ x,
22
+ y,
23
+ value: distance({
24
+ x,
25
+ y
26
+ })
27
+ };
41
28
  }
42
29
  function distanceFromRect(a, b) {
43
- if ((0, import_intersection.intersects)(a, b)) return { x: 0, y: 0, value: 0 };
44
- const left = a.x < b.x ? a : b;
45
- const right = b.x < a.x ? a : b;
46
- const upper = a.y < b.y ? a : b;
47
- const lower = b.y < a.y ? a : b;
48
- let x = left.x === right.x ? 0 : right.x - left.maxX;
49
- x = Math.max(0, x);
50
- let y = upper.y === lower.y ? 0 : lower.y - upper.maxY;
51
- y = Math.max(0, y);
52
- return { x, y, value: distance({ x, y }) };
30
+ if (require_intersection.intersects(a, b)) return {
31
+ x: 0,
32
+ y: 0,
33
+ value: 0
34
+ };
35
+ const left = a.x < b.x ? a : b;
36
+ const right = b.x < a.x ? a : b;
37
+ const upper = a.y < b.y ? a : b;
38
+ const lower = b.y < a.y ? a : b;
39
+ let x = left.x === right.x ? 0 : right.x - left.maxX;
40
+ x = Math.max(0, x);
41
+ let y = upper.y === lower.y ? 0 : lower.y - upper.maxY;
42
+ y = Math.max(0, y);
43
+ return {
44
+ x,
45
+ y,
46
+ value: distance({
47
+ x,
48
+ y
49
+ })
50
+ };
53
51
  }
54
52
  function distanceBtwEdges(a, b) {
55
- return {
56
- left: b.x - a.x,
57
- top: b.y - a.y,
58
- right: a.maxX - b.maxX,
59
- bottom: a.maxY - b.maxY
60
- };
53
+ return {
54
+ left: b.x - a.x,
55
+ top: b.y - a.y,
56
+ right: a.maxX - b.maxX,
57
+ bottom: a.maxY - b.maxY
58
+ };
61
59
  }
62
- // Annotate the CommonJS export names for ESM import in node:
63
- 0 && (module.exports = {
64
- distance,
65
- distanceBtwEdges,
66
- distanceFromPoint,
67
- distanceFromRect
68
- });
60
+ exports.distance = distance;
61
+ exports.distanceBtwEdges = distanceBtwEdges;
62
+ exports.distanceFromPoint = distanceFromPoint;
63
+ exports.distanceFromRect = distanceFromRect;
package/dist/distance.mjs CHANGED
@@ -1,40 +1,56 @@
1
- // src/distance.ts
2
1
  import { intersects } from "./intersection.mjs";
3
- function distance(a, b = { x: 0, y: 0 }) {
4
- return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
2
+ // src/distance.ts
3
+ function distance(a, b = {
4
+ x: 0,
5
+ y: 0
6
+ }) {
7
+ return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
5
8
  }
6
9
  function distanceFromPoint(r, p) {
7
- let x = 0;
8
- let y = 0;
9
- if (p.x < r.x) x = r.x - p.x;
10
- else if (p.x > r.maxX) x = p.x - r.maxX;
11
- if (p.y < r.y) y = r.y - p.y;
12
- else if (p.y > r.maxY) y = p.y - r.maxY;
13
- return { x, y, value: distance({ x, y }) };
10
+ let x = 0;
11
+ let y = 0;
12
+ if (p.x < r.x) x = r.x - p.x;
13
+ else if (p.x > r.maxX) x = p.x - r.maxX;
14
+ if (p.y < r.y) y = r.y - p.y;
15
+ else if (p.y > r.maxY) y = p.y - r.maxY;
16
+ return {
17
+ x,
18
+ y,
19
+ value: distance({
20
+ x,
21
+ y
22
+ })
23
+ };
14
24
  }
15
25
  function distanceFromRect(a, b) {
16
- if (intersects(a, b)) return { x: 0, y: 0, value: 0 };
17
- const left = a.x < b.x ? a : b;
18
- const right = b.x < a.x ? a : b;
19
- const upper = a.y < b.y ? a : b;
20
- const lower = b.y < a.y ? a : b;
21
- let x = left.x === right.x ? 0 : right.x - left.maxX;
22
- x = Math.max(0, x);
23
- let y = upper.y === lower.y ? 0 : lower.y - upper.maxY;
24
- y = Math.max(0, y);
25
- return { x, y, value: distance({ x, y }) };
26
+ if (intersects(a, b)) return {
27
+ x: 0,
28
+ y: 0,
29
+ value: 0
30
+ };
31
+ const left = a.x < b.x ? a : b;
32
+ const right = b.x < a.x ? a : b;
33
+ const upper = a.y < b.y ? a : b;
34
+ const lower = b.y < a.y ? a : b;
35
+ let x = left.x === right.x ? 0 : right.x - left.maxX;
36
+ x = Math.max(0, x);
37
+ let y = upper.y === lower.y ? 0 : lower.y - upper.maxY;
38
+ y = Math.max(0, y);
39
+ return {
40
+ x,
41
+ y,
42
+ value: distance({
43
+ x,
44
+ y
45
+ })
46
+ };
26
47
  }
27
48
  function distanceBtwEdges(a, b) {
28
- return {
29
- left: b.x - a.x,
30
- top: b.y - a.y,
31
- right: a.maxX - b.maxX,
32
- bottom: a.maxY - b.maxY
33
- };
49
+ return {
50
+ left: b.x - a.x,
51
+ top: b.y - a.y,
52
+ right: a.maxX - b.maxX,
53
+ bottom: a.maxY - b.maxY
54
+ };
34
55
  }
35
- export {
36
- distance,
37
- distanceBtwEdges,
38
- distanceFromPoint,
39
- distanceFromRect
40
- };
56
+ export { distance, distanceBtwEdges, distanceFromPoint, distanceFromRect };
@@ -1,7 +1,4 @@
1
- import { Point, RectInit, Size } from './types.mjs';
2
-
3
- declare const isSizeEqual: (a: Size, b: Size | undefined) => boolean;
4
- declare const isPointEqual: (a: Point, b: Point | undefined) => boolean;
5
- declare const isRectEqual: (a: RectInit, b: RectInit | undefined) => boolean;
6
-
7
- export { isPointEqual, isRectEqual, isSizeEqual };
1
+ import { Point, RectInit, Size } from "./types.mjs";
2
+ export declare const isSizeEqual: (a: Size, b: Size | undefined) => boolean;
3
+ export declare const isPointEqual: (a: Point, b: Point | undefined) => boolean;
4
+ export declare const isRectEqual: (a: RectInit, b: RectInit | undefined) => boolean;
@@ -1,7 +1,4 @@
1
- import { Point, RectInit, Size } from './types.js';
2
-
3
- declare const isSizeEqual: (a: Size, b: Size | undefined) => boolean;
4
- declare const isPointEqual: (a: Point, b: Point | undefined) => boolean;
5
- declare const isRectEqual: (a: RectInit, b: RectInit | undefined) => boolean;
6
-
7
- export { isPointEqual, isRectEqual, isSizeEqual };
1
+ import { Point, RectInit, Size } from "./types.js";
2
+ export declare const isSizeEqual: (a: Size, b: Size | undefined) => boolean;
3
+ export declare const isPointEqual: (a: Point, b: Point | undefined) => boolean;
4
+ export declare const isRectEqual: (a: RectInit, b: RectInit | undefined) => boolean;
package/dist/equality.js CHANGED
@@ -1,42 +1,17 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/equality.ts
21
- var equality_exports = {};
22
- __export(equality_exports, {
23
- isPointEqual: () => isPointEqual,
24
- isRectEqual: () => isRectEqual,
25
- isSizeEqual: () => isSizeEqual
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
26
4
  });
27
- module.exports = __toCommonJS(equality_exports);
28
- var isSizeEqual = (a, b) => {
29
- return a.width === b?.width && a.height === b?.height;
5
+ // src/equality.ts
6
+ const isSizeEqual = (a, b) => {
7
+ return a.width === b?.width && a.height === b?.height;
30
8
  };
31
- var isPointEqual = (a, b) => {
32
- return a.x === b?.x && a.y === b?.y;
9
+ const isPointEqual = (a, b) => {
10
+ return a.x === b?.x && a.y === b?.y;
33
11
  };
34
- var isRectEqual = (a, b) => {
35
- return isPointEqual(a, b) && isSizeEqual(a, b);
12
+ const isRectEqual = (a, b) => {
13
+ return isPointEqual(a, b) && isSizeEqual(a, b);
36
14
  };
37
- // Annotate the CommonJS export names for ESM import in node:
38
- 0 && (module.exports = {
39
- isPointEqual,
40
- isRectEqual,
41
- isSizeEqual
42
- });
15
+ exports.isPointEqual = isPointEqual;
16
+ exports.isRectEqual = isRectEqual;
17
+ exports.isSizeEqual = isSizeEqual;
package/dist/equality.mjs CHANGED
@@ -1,15 +1,11 @@
1
1
  // src/equality.ts
2
- var isSizeEqual = (a, b) => {
3
- return a.width === b?.width && a.height === b?.height;
2
+ const isSizeEqual = (a, b) => {
3
+ return a.width === b?.width && a.height === b?.height;
4
4
  };
5
- var isPointEqual = (a, b) => {
6
- return a.x === b?.x && a.y === b?.y;
5
+ const isPointEqual = (a, b) => {
6
+ return a.x === b?.x && a.y === b?.y;
7
7
  };
8
- var isRectEqual = (a, b) => {
9
- return isPointEqual(a, b) && isSizeEqual(a, b);
10
- };
11
- export {
12
- isPointEqual,
13
- isRectEqual,
14
- isSizeEqual
8
+ const isRectEqual = (a, b) => {
9
+ return isPointEqual(a, b) && isSizeEqual(a, b);
15
10
  };
11
+ export { isPointEqual, isRectEqual, isSizeEqual };
@@ -1,15 +1,12 @@
1
- import { Rect } from './types.mjs';
2
-
3
- declare function getElementRect(el: HTMLElement, opts?: ElementRectOptions): Rect;
4
- type ElementRectOptions = {
5
- /**
6
- * Whether to exclude the element's scrollbar size from the calculation.
7
- */
8
- excludeScrollbar?: boolean | undefined;
9
- /**
10
- * Whether to exclude the element's borders from the calculation.
11
- */
12
- excludeBorders?: boolean | undefined;
13
- };
14
-
15
- export { type ElementRectOptions, getElementRect };
1
+ import { Rect } from "./types.mjs";
2
+ export declare function getElementRect(el: HTMLElement, opts?: ElementRectOptions): Rect;
3
+ export type ElementRectOptions = {
4
+ /**
5
+ * Whether to exclude the element's scrollbar size from the calculation.
6
+ */
7
+ excludeScrollbar?: boolean | undefined;
8
+ /**
9
+ * Whether to exclude the element's borders from the calculation.
10
+ */
11
+ excludeBorders?: boolean | undefined;
12
+ };
@@ -1,15 +1,12 @@
1
- import { Rect } from './types.js';
2
-
3
- declare function getElementRect(el: HTMLElement, opts?: ElementRectOptions): Rect;
4
- type ElementRectOptions = {
5
- /**
6
- * Whether to exclude the element's scrollbar size from the calculation.
7
- */
8
- excludeScrollbar?: boolean | undefined;
9
- /**
10
- * Whether to exclude the element's borders from the calculation.
11
- */
12
- excludeBorders?: boolean | undefined;
13
- };
14
-
15
- export { type ElementRectOptions, getElementRect };
1
+ import { Rect } from "./types.js";
2
+ export declare function getElementRect(el: HTMLElement, opts?: ElementRectOptions): Rect;
3
+ export type ElementRectOptions = {
4
+ /**
5
+ * Whether to exclude the element's scrollbar size from the calculation.
6
+ */
7
+ excludeScrollbar?: boolean | undefined;
8
+ /**
9
+ * Whether to exclude the element's borders from the calculation.
10
+ */
11
+ excludeBorders?: boolean | undefined;
12
+ };