@zag-js/rect-utils 1.46.0 → 1.48.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 (102) hide show
  1. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/defineProperty.js +11 -0
  2. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/defineProperty.mjs +11 -0
  3. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPrimitive.js +13 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPrimitive.mjs +13 -0
  5. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPropertyKey.js +8 -0
  6. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPropertyKey.mjs +8 -0
  7. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/typeof.js +15 -0
  8. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/typeof.mjs +10 -0
  9. package/dist/affine-transform.d.mts +36 -39
  10. package/dist/affine-transform.d.ts +36 -39
  11. package/dist/affine-transform.js +189 -187
  12. package/dist/affine-transform.mjs +185 -164
  13. package/dist/align.d.mts +2 -5
  14. package/dist/align.d.ts +2 -5
  15. package/dist/align.js +27 -44
  16. package/dist/align.mjs +23 -21
  17. package/dist/angle.d.mts +2 -5
  18. package/dist/angle.d.ts +2 -5
  19. package/dist/angle.js +8 -32
  20. package/dist/angle.mjs +4 -9
  21. package/dist/clamp.d.mts +8 -11
  22. package/dist/clamp.d.ts +8 -11
  23. package/dist/clamp.js +23 -46
  24. package/dist/clamp.mjs +18 -22
  25. package/dist/closest.d.mts +4 -7
  26. package/dist/closest.d.ts +4 -7
  27. package/dist/closest.js +35 -62
  28. package/dist/closest.mjs +29 -37
  29. package/dist/compass.d.mts +4 -7
  30. package/dist/compass.d.ts +4 -7
  31. package/dist/compass.js +48 -48
  32. package/dist/compass.mjs +43 -24
  33. package/dist/constrain.d.mts +2 -5
  34. package/dist/constrain.d.ts +2 -5
  35. package/dist/constrain.js +12 -37
  36. package/dist/constrain.mjs +8 -14
  37. package/dist/contains.d.mts +4 -7
  38. package/dist/contains.d.ts +4 -7
  39. package/dist/contains.js +11 -36
  40. package/dist/contains.mjs +5 -11
  41. package/dist/distance.d.mts +7 -10
  42. package/dist/distance.d.ts +7 -10
  43. package/dist/distance.js +55 -60
  44. package/dist/distance.mjs +48 -34
  45. package/dist/equality.d.mts +4 -7
  46. package/dist/equality.d.ts +4 -7
  47. package/dist/equality.js +13 -38
  48. package/dist/equality.mjs +7 -13
  49. package/dist/from-element.d.mts +12 -15
  50. package/dist/from-element.d.ts +12 -15
  51. package/dist/from-element.js +39 -58
  52. package/dist/from-element.mjs +35 -35
  53. package/dist/from-points.d.mts +2 -5
  54. package/dist/from-points.d.ts +2 -5
  55. package/dist/from-points.js +18 -36
  56. package/dist/from-points.mjs +14 -13
  57. package/dist/from-range.d.mts +2 -5
  58. package/dist/from-range.d.ts +2 -5
  59. package/dist/from-range.js +25 -46
  60. package/dist/from-range.mjs +19 -21
  61. package/dist/from-rotation.d.mts +4 -7
  62. package/dist/from-rotation.d.ts +4 -7
  63. package/dist/from-rotation.js +31 -56
  64. package/dist/from-rotation.mjs +25 -31
  65. package/dist/from-window.d.mts +13 -16
  66. package/dist/from-window.d.ts +13 -16
  67. package/dist/from-window.js +29 -44
  68. package/dist/from-window.mjs +24 -20
  69. package/dist/index.d.mts +22 -22
  70. package/dist/index.d.ts +22 -22
  71. package/dist/index.js +72 -63
  72. package/dist/index.mjs +21 -22
  73. package/dist/intersection.d.mts +4 -7
  74. package/dist/intersection.d.ts +4 -7
  75. package/dist/intersection.js +34 -45
  76. package/dist/intersection.mjs +28 -20
  77. package/dist/operations.d.mts +6 -9
  78. package/dist/operations.d.ts +6 -9
  79. package/dist/operations.js +38 -57
  80. package/dist/operations.mjs +30 -30
  81. package/dist/polygon.d.mts +6 -9
  82. package/dist/polygon.d.ts +6 -9
  83. package/dist/polygon.js +73 -82
  84. package/dist/polygon.mjs +67 -57
  85. package/dist/rect.d.mts +49 -52
  86. package/dist/rect.d.ts +49 -52
  87. package/dist/rect.js +57 -82
  88. package/dist/rect.mjs +46 -52
  89. package/dist/resize.d.mts +3 -6
  90. package/dist/resize.d.ts +3 -6
  91. package/dist/resize.js +73 -102
  92. package/dist/resize.mjs +68 -78
  93. package/dist/types.d.mts +45 -49
  94. package/dist/types.d.ts +45 -49
  95. package/dist/types.js +4 -18
  96. package/dist/types.mjs +1 -0
  97. package/dist/union.d.mts +2 -5
  98. package/dist/union.d.ts +2 -5
  99. package/dist/union.js +16 -39
  100. package/dist/union.mjs +12 -16
  101. package/package.json +3 -3
  102. package/dist/chunk-QZ7TP4HQ.mjs +0 -7
package/dist/resize.mjs CHANGED
@@ -1,90 +1,80 @@
1
- import "./chunk-QZ7TP4HQ.mjs";
2
-
3
- // src/resize.ts
4
1
  import { AffineTransform } from "./affine-transform.mjs";
5
2
  import { compassDirectionMap, oppositeDirectionMap } from "./compass.mjs";
6
- var { sign, abs, min } = Math;
3
+ // src/resize.ts
4
+ const { sign, abs, min } = Math;
7
5
  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 };
6
+ const { minX, minY, maxX, maxY, midX, midY } = rect;
7
+ return {
8
+ x: direction.includes("w") ? minX : direction.includes("e") ? maxX : midX,
9
+ y: direction.includes("n") ? minY : direction.includes("s") ? maxY : midY
10
+ };
12
11
  }
13
12
  function getOppositeDirection(direction) {
14
- return oppositeDirectionMap[direction];
13
+ return oppositeDirectionMap[direction];
15
14
  }
16
15
  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
- }
16
+ const { scalingOriginMode, lockAspectRatio } = opts;
17
+ const extent = getRectExtentPoint(rect, direction);
18
+ const oppositeExtent = getRectExtentPoint(rect, getOppositeDirection(direction));
19
+ if (scalingOriginMode === "center") offset = {
20
+ x: offset.x * 2,
21
+ y: offset.y * 2
22
+ };
23
+ const newExtent = {
24
+ x: extent.x + offset.x,
25
+ y: extent.y + offset.y
26
+ };
27
+ const multiplier = {
28
+ x: compassDirectionMap[direction].x * 2 - 1,
29
+ y: compassDirectionMap[direction].y * 2 - 1
30
+ };
31
+ const newSize = {
32
+ width: newExtent.x - oppositeExtent.x,
33
+ height: newExtent.y - oppositeExtent.y
34
+ };
35
+ const scaleX = multiplier.x * newSize.width / rect.width;
36
+ const scaleY = multiplier.y * newSize.height / rect.height;
37
+ const largestMagnitude = abs(scaleX) > abs(scaleY) ? scaleX : scaleY;
38
+ const scale = lockAspectRatio ? {
39
+ x: largestMagnitude,
40
+ y: largestMagnitude
41
+ } : {
42
+ x: extent.x === oppositeExtent.x ? 1 : scaleX,
43
+ y: extent.y === oppositeExtent.y ? 1 : scaleY
44
+ };
45
+ if (extent.y === oppositeExtent.y) scale.y = abs(scale.y);
46
+ else if (sign(scale.y) !== sign(scaleY)) scale.y *= -1;
47
+ if (extent.x === oppositeExtent.x) scale.x = abs(scale.x);
48
+ else if (sign(scale.x) !== sign(scaleX)) scale.x *= -1;
49
+ switch (scalingOriginMode) {
50
+ case "extent": return transformRect(rect, AffineTransform.scale(scale.x, scale.y, oppositeExtent), false);
51
+ case "center": return transformRect(rect, AffineTransform.scale(scale.x, scale.y, {
52
+ x: rect.midX,
53
+ y: rect.midY
54
+ }), false);
55
+ }
66
56
  }
67
57
  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
- };
58
+ if (normalized) return {
59
+ x: min(finalPoint.x, initialPoint.x),
60
+ y: min(finalPoint.y, initialPoint.y),
61
+ width: abs(finalPoint.x - initialPoint.x),
62
+ height: abs(finalPoint.y - initialPoint.y)
63
+ };
64
+ return {
65
+ x: initialPoint.x,
66
+ y: initialPoint.y,
67
+ width: finalPoint.x - initialPoint.x,
68
+ height: finalPoint.y - initialPoint.y
69
+ };
82
70
  }
83
71
  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);
72
+ return createRectFromPoints(transform.applyTo({
73
+ x: rect.minX,
74
+ y: rect.minY
75
+ }), transform.applyTo({
76
+ x: rect.maxX,
77
+ y: rect.maxY
78
+ }), normalized);
87
79
  }
88
- export {
89
- resizeRect
90
- };
80
+ export { resizeRect };
package/dist/types.d.mts CHANGED
@@ -1,55 +1,51 @@
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[];
1
+ export interface Point {
2
+ x: number;
3
+ y: number;
4
+ }
5
+ export interface Size {
6
+ width: number;
7
+ height: number;
8
+ }
9
+ export interface Bounds {
10
+ minX: number;
11
+ midX: number;
12
+ maxX: number;
13
+ minY: number;
14
+ midY: number;
15
+ maxY: number;
16
+ }
17
+ export interface CenterPoint {
18
+ center: Point;
19
+ }
20
+ export interface RectInit extends Point, Size {}
21
+ export interface Rect extends Point, Size, Bounds, CenterPoint {}
22
+ export type RectSide = "top" | "right" | "bottom" | "left";
23
+ export type RectPoint = "top-left" | "top-center" | "top-right" | "right-center" | "left-center" | "bottom-left" | "bottom-right" | "bottom-center" | "center";
24
+ export type RectEdge = [Point, Point];
25
+ export type RectPoints = [Point, Point, Point, Point];
26
+ export type RectEdges = Record<RectSide, RectEdge> & {
27
+ value: RectEdge[];
30
28
  };
31
- type RectCorner = "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
32
- type RectCorners = Record<RectCorner, Point> & {
33
- value: RectPoints;
29
+ export type RectCorner = "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
30
+ export type RectCorners = Record<RectCorner, Point> & {
31
+ value: RectPoints;
34
32
  };
35
- type RectCenter = "topCenter" | "rightCenter" | "leftCenter" | "bottomCenter";
36
- type RectCenters = Record<RectCenter, Point> & {
37
- value: RectPoints;
33
+ export type RectCenter = "topCenter" | "rightCenter" | "leftCenter" | "bottomCenter";
34
+ export type RectCenters = Record<RectCenter, Point> & {
35
+ value: RectPoints;
38
36
  };
39
- type RectInset = Partial<Record<RectSide, number>>;
40
- interface SymmetricRectInset {
41
- dx?: number | undefined;
42
- dy?: number | undefined;
37
+ export type RectInset = Partial<Record<RectSide, number>>;
38
+ export interface SymmetricRectInset {
39
+ dx?: number | undefined;
40
+ dy?: number | undefined;
43
41
  }
44
- interface ScalingOptions {
45
- scalingOriginMode: "center" | "extent";
46
- lockAspectRatio: boolean;
42
+ export interface ScalingOptions {
43
+ scalingOriginMode: "center" | "extent";
44
+ lockAspectRatio: boolean;
47
45
  }
48
- interface AlignOptions {
49
- h: HAlign;
50
- v: VAlign;
46
+ export interface AlignOptions {
47
+ h: HAlign;
48
+ v: VAlign;
51
49
  }
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 };
50
+ export type HAlign = "left-inside" | "left-outside" | "center" | "right-inside" | "right-outside";
51
+ export type VAlign = "top-inside" | "top-outside" | "center" | "bottom-inside" | "bottom-outside";
package/dist/types.d.ts CHANGED
@@ -1,55 +1,51 @@
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[];
1
+ export interface Point {
2
+ x: number;
3
+ y: number;
4
+ }
5
+ export interface Size {
6
+ width: number;
7
+ height: number;
8
+ }
9
+ export interface Bounds {
10
+ minX: number;
11
+ midX: number;
12
+ maxX: number;
13
+ minY: number;
14
+ midY: number;
15
+ maxY: number;
16
+ }
17
+ export interface CenterPoint {
18
+ center: Point;
19
+ }
20
+ export interface RectInit extends Point, Size {}
21
+ export interface Rect extends Point, Size, Bounds, CenterPoint {}
22
+ export type RectSide = "top" | "right" | "bottom" | "left";
23
+ export type RectPoint = "top-left" | "top-center" | "top-right" | "right-center" | "left-center" | "bottom-left" | "bottom-right" | "bottom-center" | "center";
24
+ export type RectEdge = [Point, Point];
25
+ export type RectPoints = [Point, Point, Point, Point];
26
+ export type RectEdges = Record<RectSide, RectEdge> & {
27
+ value: RectEdge[];
30
28
  };
31
- type RectCorner = "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
32
- type RectCorners = Record<RectCorner, Point> & {
33
- value: RectPoints;
29
+ export type RectCorner = "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
30
+ export type RectCorners = Record<RectCorner, Point> & {
31
+ value: RectPoints;
34
32
  };
35
- type RectCenter = "topCenter" | "rightCenter" | "leftCenter" | "bottomCenter";
36
- type RectCenters = Record<RectCenter, Point> & {
37
- value: RectPoints;
33
+ export type RectCenter = "topCenter" | "rightCenter" | "leftCenter" | "bottomCenter";
34
+ export type RectCenters = Record<RectCenter, Point> & {
35
+ value: RectPoints;
38
36
  };
39
- type RectInset = Partial<Record<RectSide, number>>;
40
- interface SymmetricRectInset {
41
- dx?: number | undefined;
42
- dy?: number | undefined;
37
+ export type RectInset = Partial<Record<RectSide, number>>;
38
+ export interface SymmetricRectInset {
39
+ dx?: number | undefined;
40
+ dy?: number | undefined;
43
41
  }
44
- interface ScalingOptions {
45
- scalingOriginMode: "center" | "extent";
46
- lockAspectRatio: boolean;
42
+ export interface ScalingOptions {
43
+ scalingOriginMode: "center" | "extent";
44
+ lockAspectRatio: boolean;
47
45
  }
48
- interface AlignOptions {
49
- h: HAlign;
50
- v: VAlign;
46
+ export interface AlignOptions {
47
+ h: HAlign;
48
+ v: VAlign;
51
49
  }
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 };
50
+ export type HAlign = "left-inside" | "left-outside" | "center" | "right-inside" | "right-outside";
51
+ export type VAlign = "top-inside" | "top-outside" | "center" | "bottom-inside" | "bottom-outside";
package/dist/types.js CHANGED
@@ -1,18 +1,4 @@
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);
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
package/dist/types.mjs CHANGED
@@ -0,0 +1 @@
1
+ export {};
package/dist/union.d.mts CHANGED
@@ -1,5 +1,2 @@
1
- import { Rect } from './types.mjs';
2
-
3
- declare function union(...rs: Rect[]): Rect;
4
-
5
- export { union };
1
+ import { Rect } from "./types.mjs";
2
+ export declare function union(...rs: Rect[]): Rect;
package/dist/union.d.ts CHANGED
@@ -1,5 +1,2 @@
1
- import { Rect } from './types.js';
2
-
3
- declare function union(...rs: Rect[]): Rect;
4
-
5
- export { union };
1
+ import { Rect } from "./types.js";
2
+ export declare function union(...rs: Rect[]): Rect;
package/dist/union.js CHANGED
@@ -1,42 +1,19 @@
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
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
24
4
  });
25
- module.exports = __toCommonJS(union_exports);
26
- var import_from_points = require("./from-points.js");
27
- var { min, max } = Math;
5
+ const require_from_points = require("./from-points.js");
6
+ // src/union.ts
7
+ const { min, max } = Math;
28
8
  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);
9
+ const pMin = {
10
+ x: min(...rs.map((r) => r.minX)),
11
+ y: min(...rs.map((r) => r.minY))
12
+ };
13
+ const pMax = {
14
+ x: max(...rs.map((r) => r.maxX)),
15
+ y: max(...rs.map((r) => r.maxY))
16
+ };
17
+ return require_from_points.getRectFromPoints(pMin, pMax);
38
18
  }
39
- // Annotate the CommonJS export names for ESM import in node:
40
- 0 && (module.exports = {
41
- union
42
- });
19
+ exports.union = union;
package/dist/union.mjs CHANGED
@@ -1,19 +1,15 @@
1
- import "./chunk-QZ7TP4HQ.mjs";
2
-
3
- // src/union.ts
4
1
  import { getRectFromPoints } from "./from-points.mjs";
5
- var { min, max } = Math;
2
+ // src/union.ts
3
+ const { min, max } = Math;
6
4
  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);
5
+ const pMin = {
6
+ x: min(...rs.map((r) => r.minX)),
7
+ y: min(...rs.map((r) => r.minY))
8
+ };
9
+ const pMax = {
10
+ x: max(...rs.map((r) => r.maxX)),
11
+ y: max(...rs.map((r) => r.maxY))
12
+ };
13
+ return getRectFromPoints(pMin, pMax);
16
14
  }
17
- export {
18
- union
19
- };
15
+ export { union };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/rect-utils",
3
- "version": "1.46.0",
3
+ "version": "1.48.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "js",
@@ -45,8 +45,8 @@
45
45
  "./package.json": "./package.json"
46
46
  },
47
47
  "scripts": {
48
- "build": "tsup",
49
- "lint": "eslint src",
48
+ "build": "tsdown",
49
+ "lint": "oxlint src",
50
50
  "typecheck": "tsc --noEmit"
51
51
  }
52
52
  }
@@ -1,7 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
-
5
- export {
6
- __publicField
7
- };