@zag-js/rect-utils 1.34.1 → 1.35.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.
Files changed (94) hide show
  1. package/dist/affine-transform.d.mts +39 -0
  2. package/dist/affine-transform.d.ts +39 -0
  3. package/dist/affine-transform.js +189 -0
  4. package/dist/affine-transform.mjs +166 -0
  5. package/dist/align.d.mts +5 -0
  6. package/dist/align.d.ts +5 -0
  7. package/dist/align.js +51 -0
  8. package/dist/align.mjs +28 -0
  9. package/dist/angle.d.mts +5 -0
  10. package/dist/angle.d.ts +5 -0
  11. package/dist/angle.js +35 -0
  12. package/dist/angle.mjs +12 -0
  13. package/dist/chunk-QZ7TP4HQ.mjs +7 -0
  14. package/dist/clamp.d.mts +12 -0
  15. package/dist/clamp.d.ts +12 -0
  16. package/dist/clamp.js +51 -0
  17. package/dist/clamp.mjs +27 -0
  18. package/dist/closest.d.mts +7 -0
  19. package/dist/closest.d.ts +7 -0
  20. package/dist/closest.js +69 -0
  21. package/dist/closest.mjs +44 -0
  22. package/dist/compass.d.mts +7 -0
  23. package/dist/compass.d.ts +7 -0
  24. package/dist/compass.js +51 -0
  25. package/dist/compass.mjs +27 -0
  26. package/dist/constrain.d.mts +5 -0
  27. package/dist/constrain.d.ts +5 -0
  28. package/dist/constrain.js +39 -0
  29. package/dist/constrain.mjs +16 -0
  30. package/dist/contains.d.mts +7 -0
  31. package/dist/contains.d.ts +7 -0
  32. package/dist/contains.js +43 -0
  33. package/dist/contains.mjs +18 -0
  34. package/dist/distance.d.mts +11 -0
  35. package/dist/distance.d.ts +11 -0
  36. package/dist/distance.js +68 -0
  37. package/dist/distance.mjs +42 -0
  38. package/dist/equality.d.mts +7 -0
  39. package/dist/equality.d.ts +7 -0
  40. package/dist/equality.js +42 -0
  41. package/dist/equality.mjs +17 -0
  42. package/dist/from-element.d.mts +15 -0
  43. package/dist/from-element.d.ts +15 -0
  44. package/dist/from-element.js +65 -0
  45. package/dist/from-element.mjs +42 -0
  46. package/dist/from-points.d.mts +5 -0
  47. package/dist/from-points.d.ts +5 -0
  48. package/dist/from-points.js +39 -0
  49. package/dist/from-points.mjs +16 -0
  50. package/dist/from-range.d.mts +5 -0
  51. package/dist/from-range.d.ts +5 -0
  52. package/dist/from-range.js +49 -0
  53. package/dist/from-range.mjs +26 -0
  54. package/dist/from-rotation.d.mts +7 -0
  55. package/dist/from-rotation.d.ts +7 -0
  56. package/dist/from-rotation.js +63 -0
  57. package/dist/from-rotation.mjs +38 -0
  58. package/dist/from-window.d.mts +23 -0
  59. package/dist/from-window.d.ts +23 -0
  60. package/dist/from-window.js +49 -0
  61. package/dist/from-window.mjs +25 -0
  62. package/dist/index.d.mts +22 -253
  63. package/dist/index.d.ts +22 -253
  64. package/dist/index.js +62 -772
  65. package/dist/index.mjs +22 -724
  66. package/dist/intersection.d.mts +16 -0
  67. package/dist/intersection.d.ts +16 -0
  68. package/dist/intersection.js +52 -0
  69. package/dist/intersection.mjs +27 -0
  70. package/dist/operations.d.mts +9 -0
  71. package/dist/operations.d.ts +9 -0
  72. package/dist/operations.js +66 -0
  73. package/dist/operations.mjs +39 -0
  74. package/dist/polygon.d.mts +10 -0
  75. package/dist/polygon.d.ts +10 -0
  76. package/dist/polygon.js +91 -0
  77. package/dist/polygon.mjs +66 -0
  78. package/dist/rect.d.mts +58 -0
  79. package/dist/rect.d.ts +58 -0
  80. package/dist/rect.js +97 -0
  81. package/dist/rect.mjs +66 -0
  82. package/dist/resize.d.mts +6 -0
  83. package/dist/resize.d.ts +6 -0
  84. package/dist/resize.js +113 -0
  85. package/dist/resize.mjs +90 -0
  86. package/dist/types.d.mts +55 -0
  87. package/dist/types.d.ts +55 -0
  88. package/dist/types.js +18 -0
  89. package/dist/types.mjs +0 -0
  90. package/dist/union.d.mts +5 -0
  91. package/dist/union.d.ts +5 -0
  92. package/dist/union.js +42 -0
  93. package/dist/union.mjs +19 -0
  94. package/package.json +1 -1
package/dist/rect.mjs ADDED
@@ -0,0 +1,66 @@
1
+ import "./chunk-QZ7TP4HQ.mjs";
2
+
3
+ // src/rect.ts
4
+ var createPoint = (x, y) => ({ x, y });
5
+ var subtractPoints = (a, b) => {
6
+ if (!b) return a;
7
+ return createPoint(a.x - b.x, a.y - b.y);
8
+ };
9
+ var addPoints = (a, b) => createPoint(a.x + b.x, a.y + b.y);
10
+ function isPoint(v) {
11
+ return Reflect.has(v, "x") && Reflect.has(v, "y");
12
+ }
13
+ function createRect(r) {
14
+ const { x, y, width, height } = r;
15
+ const midX = x + width / 2;
16
+ const midY = y + height / 2;
17
+ return {
18
+ x,
19
+ y,
20
+ width,
21
+ height,
22
+ minX: x,
23
+ minY: y,
24
+ maxX: x + width,
25
+ maxY: y + height,
26
+ midX,
27
+ midY,
28
+ center: createPoint(midX, midY)
29
+ };
30
+ }
31
+ function isRect(v) {
32
+ return Reflect.has(v, "x") && Reflect.has(v, "y") && Reflect.has(v, "width") && Reflect.has(v, "height");
33
+ }
34
+ function getRectCenters(v) {
35
+ const top = createPoint(v.midX, v.minY);
36
+ const right = createPoint(v.maxX, v.midY);
37
+ const bottom = createPoint(v.midX, v.maxY);
38
+ const left = createPoint(v.minX, v.midY);
39
+ return { top, right, bottom, left };
40
+ }
41
+ function getRectCorners(v) {
42
+ const top = createPoint(v.minX, v.minY);
43
+ const right = createPoint(v.maxX, v.minY);
44
+ const bottom = createPoint(v.maxX, v.maxY);
45
+ const left = createPoint(v.minX, v.maxY);
46
+ return { top, right, bottom, left };
47
+ }
48
+ function getRectEdges(v) {
49
+ const c = getRectCorners(v);
50
+ const top = [c.top, c.right];
51
+ const right = [c.right, c.bottom];
52
+ const bottom = [c.left, c.bottom];
53
+ const left = [c.top, c.left];
54
+ return { top, right, bottom, left };
55
+ }
56
+ export {
57
+ addPoints,
58
+ createPoint,
59
+ createRect,
60
+ getRectCenters,
61
+ getRectCorners,
62
+ getRectEdges,
63
+ isPoint,
64
+ isRect,
65
+ subtractPoints
66
+ };
@@ -0,0 +1,6 @@
1
+ import { CompassDirection } from './compass.mjs';
2
+ import { Rect, Point, ScalingOptions, RectInit } from './types.mjs';
3
+
4
+ declare function resizeRect(rect: Rect, offset: Point, direction: CompassDirection, opts: ScalingOptions): RectInit;
5
+
6
+ export { resizeRect };
@@ -0,0 +1,6 @@
1
+ import { CompassDirection } from './compass.js';
2
+ import { Rect, Point, ScalingOptions, RectInit } from './types.js';
3
+
4
+ declare function resizeRect(rect: Rect, offset: Point, direction: CompassDirection, opts: ScalingOptions): RectInit;
5
+
6
+ export { resizeRect };
package/dist/resize.js ADDED
@@ -0,0 +1,113 @@
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/resize.ts
21
+ var resize_exports = {};
22
+ __export(resize_exports, {
23
+ resizeRect: () => resizeRect
24
+ });
25
+ module.exports = __toCommonJS(resize_exports);
26
+ var import_affine_transform = require("./affine-transform.cjs");
27
+ var import_compass = require("./compass.cjs");
28
+ var { sign, abs, min } = Math;
29
+ function getRectExtentPoint(rect, direction) {
30
+ const { minX, minY, maxX, maxY, midX, midY } = rect;
31
+ const x = direction.includes("w") ? minX : direction.includes("e") ? maxX : midX;
32
+ const y = direction.includes("n") ? minY : direction.includes("s") ? maxY : midY;
33
+ return { x, y };
34
+ }
35
+ function getOppositeDirection(direction) {
36
+ return import_compass.oppositeDirectionMap[direction];
37
+ }
38
+ function resizeRect(rect, offset, direction, opts) {
39
+ const { scalingOriginMode, lockAspectRatio } = opts;
40
+ const extent = getRectExtentPoint(rect, direction);
41
+ const oppositeDirection = getOppositeDirection(direction);
42
+ const oppositeExtent = getRectExtentPoint(rect, oppositeDirection);
43
+ if (scalingOriginMode === "center") {
44
+ offset = { x: offset.x * 2, y: offset.y * 2 };
45
+ }
46
+ const newExtent = {
47
+ x: extent.x + offset.x,
48
+ y: extent.y + offset.y
49
+ };
50
+ const multiplier = {
51
+ x: import_compass.compassDirectionMap[direction].x * 2 - 1,
52
+ y: import_compass.compassDirectionMap[direction].y * 2 - 1
53
+ };
54
+ const newSize = {
55
+ width: newExtent.x - oppositeExtent.x,
56
+ height: newExtent.y - oppositeExtent.y
57
+ };
58
+ const scaleX = multiplier.x * newSize.width / rect.width;
59
+ const scaleY = multiplier.y * newSize.height / rect.height;
60
+ const largestMagnitude = abs(scaleX) > abs(scaleY) ? scaleX : scaleY;
61
+ const scale = lockAspectRatio ? { x: largestMagnitude, y: largestMagnitude } : {
62
+ x: extent.x === oppositeExtent.x ? 1 : scaleX,
63
+ y: extent.y === oppositeExtent.y ? 1 : scaleY
64
+ };
65
+ if (extent.y === oppositeExtent.y) {
66
+ scale.y = abs(scale.y);
67
+ } else if (sign(scale.y) !== sign(scaleY)) {
68
+ scale.y *= -1;
69
+ }
70
+ if (extent.x === oppositeExtent.x) {
71
+ scale.x = abs(scale.x);
72
+ } else if (sign(scale.x) !== sign(scaleX)) {
73
+ scale.x *= -1;
74
+ }
75
+ switch (scalingOriginMode) {
76
+ case "extent":
77
+ return transformRect(rect, import_affine_transform.AffineTransform.scale(scale.x, scale.y, oppositeExtent), false);
78
+ case "center":
79
+ return transformRect(
80
+ rect,
81
+ import_affine_transform.AffineTransform.scale(scale.x, scale.y, {
82
+ x: rect.midX,
83
+ y: rect.midY
84
+ }),
85
+ false
86
+ );
87
+ }
88
+ }
89
+ function createRectFromPoints(initialPoint, finalPoint, normalized = true) {
90
+ if (normalized) {
91
+ return {
92
+ x: min(finalPoint.x, initialPoint.x),
93
+ y: min(finalPoint.y, initialPoint.y),
94
+ width: abs(finalPoint.x - initialPoint.x),
95
+ height: abs(finalPoint.y - initialPoint.y)
96
+ };
97
+ }
98
+ return {
99
+ x: initialPoint.x,
100
+ y: initialPoint.y,
101
+ width: finalPoint.x - initialPoint.x,
102
+ height: finalPoint.y - initialPoint.y
103
+ };
104
+ }
105
+ function transformRect(rect, transform, normalized = true) {
106
+ const p1 = transform.applyTo({ x: rect.minX, y: rect.minY });
107
+ const p2 = transform.applyTo({ x: rect.maxX, y: rect.maxY });
108
+ return createRectFromPoints(p1, p2, normalized);
109
+ }
110
+ // Annotate the CommonJS export names for ESM import in node:
111
+ 0 && (module.exports = {
112
+ resizeRect
113
+ });
@@ -0,0 +1,90 @@
1
+ import "./chunk-QZ7TP4HQ.mjs";
2
+
3
+ // src/resize.ts
4
+ import { AffineTransform } from "./affine-transform.mjs";
5
+ import { compassDirectionMap, oppositeDirectionMap } from "./compass.mjs";
6
+ var { sign, abs, min } = Math;
7
+ function getRectExtentPoint(rect, direction) {
8
+ const { minX, minY, maxX, maxY, midX, midY } = rect;
9
+ const x = direction.includes("w") ? minX : direction.includes("e") ? maxX : midX;
10
+ const y = direction.includes("n") ? minY : direction.includes("s") ? maxY : midY;
11
+ return { x, y };
12
+ }
13
+ function getOppositeDirection(direction) {
14
+ return oppositeDirectionMap[direction];
15
+ }
16
+ function resizeRect(rect, offset, direction, opts) {
17
+ const { scalingOriginMode, lockAspectRatio } = opts;
18
+ const extent = getRectExtentPoint(rect, direction);
19
+ const oppositeDirection = getOppositeDirection(direction);
20
+ const oppositeExtent = getRectExtentPoint(rect, oppositeDirection);
21
+ if (scalingOriginMode === "center") {
22
+ offset = { x: offset.x * 2, y: offset.y * 2 };
23
+ }
24
+ const newExtent = {
25
+ x: extent.x + offset.x,
26
+ y: extent.y + offset.y
27
+ };
28
+ const multiplier = {
29
+ x: compassDirectionMap[direction].x * 2 - 1,
30
+ y: compassDirectionMap[direction].y * 2 - 1
31
+ };
32
+ const newSize = {
33
+ width: newExtent.x - oppositeExtent.x,
34
+ height: newExtent.y - oppositeExtent.y
35
+ };
36
+ const scaleX = multiplier.x * newSize.width / rect.width;
37
+ const scaleY = multiplier.y * newSize.height / rect.height;
38
+ const largestMagnitude = abs(scaleX) > abs(scaleY) ? scaleX : scaleY;
39
+ const scale = lockAspectRatio ? { x: largestMagnitude, y: largestMagnitude } : {
40
+ x: extent.x === oppositeExtent.x ? 1 : scaleX,
41
+ y: extent.y === oppositeExtent.y ? 1 : scaleY
42
+ };
43
+ if (extent.y === oppositeExtent.y) {
44
+ scale.y = abs(scale.y);
45
+ } else if (sign(scale.y) !== sign(scaleY)) {
46
+ scale.y *= -1;
47
+ }
48
+ if (extent.x === oppositeExtent.x) {
49
+ scale.x = abs(scale.x);
50
+ } else if (sign(scale.x) !== sign(scaleX)) {
51
+ scale.x *= -1;
52
+ }
53
+ switch (scalingOriginMode) {
54
+ case "extent":
55
+ return transformRect(rect, AffineTransform.scale(scale.x, scale.y, oppositeExtent), false);
56
+ case "center":
57
+ return transformRect(
58
+ rect,
59
+ AffineTransform.scale(scale.x, scale.y, {
60
+ x: rect.midX,
61
+ y: rect.midY
62
+ }),
63
+ false
64
+ );
65
+ }
66
+ }
67
+ function createRectFromPoints(initialPoint, finalPoint, normalized = true) {
68
+ if (normalized) {
69
+ return {
70
+ x: min(finalPoint.x, initialPoint.x),
71
+ y: min(finalPoint.y, initialPoint.y),
72
+ width: abs(finalPoint.x - initialPoint.x),
73
+ height: abs(finalPoint.y - initialPoint.y)
74
+ };
75
+ }
76
+ return {
77
+ x: initialPoint.x,
78
+ y: initialPoint.y,
79
+ width: finalPoint.x - initialPoint.x,
80
+ height: finalPoint.y - initialPoint.y
81
+ };
82
+ }
83
+ function transformRect(rect, transform, normalized = true) {
84
+ const p1 = transform.applyTo({ x: rect.minX, y: rect.minY });
85
+ const p2 = transform.applyTo({ x: rect.maxX, y: rect.maxY });
86
+ return createRectFromPoints(p1, p2, normalized);
87
+ }
88
+ export {
89
+ resizeRect
90
+ };
@@ -0,0 +1,55 @@
1
+ interface Point {
2
+ x: number;
3
+ y: number;
4
+ }
5
+ interface Size {
6
+ width: number;
7
+ height: number;
8
+ }
9
+ interface Bounds {
10
+ minX: number;
11
+ midX: number;
12
+ maxX: number;
13
+ minY: number;
14
+ midY: number;
15
+ maxY: number;
16
+ }
17
+ interface CenterPoint {
18
+ center: Point;
19
+ }
20
+ interface RectInit extends Point, Size {
21
+ }
22
+ interface Rect extends Point, Size, Bounds, CenterPoint {
23
+ }
24
+ type RectSide = "top" | "right" | "bottom" | "left";
25
+ type RectPoint = "top-left" | "top-center" | "top-right" | "right-center" | "left-center" | "bottom-left" | "bottom-right" | "bottom-center" | "center";
26
+ type RectEdge = [Point, Point];
27
+ type RectPoints = [Point, Point, Point, Point];
28
+ type RectEdges = Record<RectSide, RectEdge> & {
29
+ value: RectEdge[];
30
+ };
31
+ type RectCorner = "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
32
+ type RectCorners = Record<RectCorner, Point> & {
33
+ value: RectPoints;
34
+ };
35
+ type RectCenter = "topCenter" | "rightCenter" | "leftCenter" | "bottomCenter";
36
+ type RectCenters = Record<RectCenter, Point> & {
37
+ value: RectPoints;
38
+ };
39
+ type RectInset = Partial<Record<RectSide, number>>;
40
+ interface SymmetricRectInset {
41
+ dx?: number | undefined;
42
+ dy?: number | undefined;
43
+ }
44
+ interface ScalingOptions {
45
+ scalingOriginMode: "center" | "extent";
46
+ lockAspectRatio: boolean;
47
+ }
48
+ interface AlignOptions {
49
+ h: HAlign;
50
+ v: VAlign;
51
+ }
52
+ type HAlign = "left-inside" | "left-outside" | "center" | "right-inside" | "right-outside";
53
+ type VAlign = "top-inside" | "top-outside" | "center" | "bottom-inside" | "bottom-outside";
54
+
55
+ export type { AlignOptions, Bounds, CenterPoint, HAlign, Point, Rect, RectCenter, RectCenters, RectCorner, RectCorners, RectEdge, RectEdges, RectInit, RectInset, RectPoint, RectPoints, RectSide, ScalingOptions, Size, SymmetricRectInset, VAlign };
@@ -0,0 +1,55 @@
1
+ interface Point {
2
+ x: number;
3
+ y: number;
4
+ }
5
+ interface Size {
6
+ width: number;
7
+ height: number;
8
+ }
9
+ interface Bounds {
10
+ minX: number;
11
+ midX: number;
12
+ maxX: number;
13
+ minY: number;
14
+ midY: number;
15
+ maxY: number;
16
+ }
17
+ interface CenterPoint {
18
+ center: Point;
19
+ }
20
+ interface RectInit extends Point, Size {
21
+ }
22
+ interface Rect extends Point, Size, Bounds, CenterPoint {
23
+ }
24
+ type RectSide = "top" | "right" | "bottom" | "left";
25
+ type RectPoint = "top-left" | "top-center" | "top-right" | "right-center" | "left-center" | "bottom-left" | "bottom-right" | "bottom-center" | "center";
26
+ type RectEdge = [Point, Point];
27
+ type RectPoints = [Point, Point, Point, Point];
28
+ type RectEdges = Record<RectSide, RectEdge> & {
29
+ value: RectEdge[];
30
+ };
31
+ type RectCorner = "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
32
+ type RectCorners = Record<RectCorner, Point> & {
33
+ value: RectPoints;
34
+ };
35
+ type RectCenter = "topCenter" | "rightCenter" | "leftCenter" | "bottomCenter";
36
+ type RectCenters = Record<RectCenter, Point> & {
37
+ value: RectPoints;
38
+ };
39
+ type RectInset = Partial<Record<RectSide, number>>;
40
+ interface SymmetricRectInset {
41
+ dx?: number | undefined;
42
+ dy?: number | undefined;
43
+ }
44
+ interface ScalingOptions {
45
+ scalingOriginMode: "center" | "extent";
46
+ lockAspectRatio: boolean;
47
+ }
48
+ interface AlignOptions {
49
+ h: HAlign;
50
+ v: VAlign;
51
+ }
52
+ type HAlign = "left-inside" | "left-outside" | "center" | "right-inside" | "right-outside";
53
+ type VAlign = "top-inside" | "top-outside" | "center" | "bottom-inside" | "bottom-outside";
54
+
55
+ export type { AlignOptions, Bounds, CenterPoint, HAlign, Point, Rect, RectCenter, RectCenters, RectCorner, RectCorners, RectEdge, RectEdges, RectInit, RectInset, RectPoint, RectPoints, RectSide, ScalingOptions, Size, SymmetricRectInset, VAlign };
package/dist/types.js ADDED
@@ -0,0 +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 __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types.ts
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
package/dist/types.mjs ADDED
File without changes
@@ -0,0 +1,5 @@
1
+ import { Rect } from './types.mjs';
2
+
3
+ declare function union(...rs: Rect[]): Rect;
4
+
5
+ export { union };
@@ -0,0 +1,5 @@
1
+ import { Rect } from './types.js';
2
+
3
+ declare function union(...rs: Rect[]): Rect;
4
+
5
+ export { union };
package/dist/union.js ADDED
@@ -0,0 +1,42 @@
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/union.ts
21
+ var union_exports = {};
22
+ __export(union_exports, {
23
+ union: () => union
24
+ });
25
+ module.exports = __toCommonJS(union_exports);
26
+ var import_from_points = require("./from-points.cjs");
27
+ var { min, max } = Math;
28
+ function union(...rs) {
29
+ const pMin = {
30
+ x: min(...rs.map((r) => r.minX)),
31
+ y: min(...rs.map((r) => r.minY))
32
+ };
33
+ const pMax = {
34
+ x: max(...rs.map((r) => r.maxX)),
35
+ y: max(...rs.map((r) => r.maxY))
36
+ };
37
+ return (0, import_from_points.getRectFromPoints)(pMin, pMax);
38
+ }
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ union
42
+ });
package/dist/union.mjs ADDED
@@ -0,0 +1,19 @@
1
+ import "./chunk-QZ7TP4HQ.mjs";
2
+
3
+ // src/union.ts
4
+ import { getRectFromPoints } from "./from-points.mjs";
5
+ var { min, max } = Math;
6
+ function union(...rs) {
7
+ const pMin = {
8
+ x: min(...rs.map((r) => r.minX)),
9
+ y: min(...rs.map((r) => r.minY))
10
+ };
11
+ const pMax = {
12
+ x: max(...rs.map((r) => r.maxX)),
13
+ y: max(...rs.map((r) => r.maxY))
14
+ };
15
+ return getRectFromPoints(pMin, pMax);
16
+ }
17
+ export {
18
+ union
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/rect-utils",
3
- "version": "1.34.1",
3
+ "version": "1.35.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "js",