@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.
- package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/defineProperty.js +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/defineProperty.mjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPrimitive.js +13 -0
- package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPrimitive.mjs +13 -0
- package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPropertyKey.js +8 -0
- package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPropertyKey.mjs +8 -0
- package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/typeof.js +15 -0
- package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/typeof.mjs +10 -0
- package/dist/affine-transform.d.mts +36 -39
- package/dist/affine-transform.d.ts +36 -39
- package/dist/affine-transform.js +189 -187
- package/dist/affine-transform.mjs +185 -164
- package/dist/align.d.mts +2 -5
- package/dist/align.d.ts +2 -5
- package/dist/align.js +27 -44
- package/dist/align.mjs +23 -21
- package/dist/angle.d.mts +2 -5
- package/dist/angle.d.ts +2 -5
- package/dist/angle.js +8 -32
- package/dist/angle.mjs +4 -9
- package/dist/clamp.d.mts +8 -11
- package/dist/clamp.d.ts +8 -11
- package/dist/clamp.js +23 -46
- package/dist/clamp.mjs +18 -22
- package/dist/closest.d.mts +4 -7
- package/dist/closest.d.ts +4 -7
- package/dist/closest.js +35 -62
- package/dist/closest.mjs +29 -37
- package/dist/compass.d.mts +4 -7
- package/dist/compass.d.ts +4 -7
- package/dist/compass.js +48 -48
- package/dist/compass.mjs +43 -24
- package/dist/constrain.d.mts +2 -5
- package/dist/constrain.d.ts +2 -5
- package/dist/constrain.js +12 -37
- package/dist/constrain.mjs +8 -14
- package/dist/contains.d.mts +4 -7
- package/dist/contains.d.ts +4 -7
- package/dist/contains.js +11 -36
- package/dist/contains.mjs +5 -11
- package/dist/distance.d.mts +7 -10
- package/dist/distance.d.ts +7 -10
- package/dist/distance.js +55 -60
- package/dist/distance.mjs +48 -34
- package/dist/equality.d.mts +4 -7
- package/dist/equality.d.ts +4 -7
- package/dist/equality.js +13 -38
- package/dist/equality.mjs +7 -13
- package/dist/from-element.d.mts +12 -15
- package/dist/from-element.d.ts +12 -15
- package/dist/from-element.js +39 -58
- package/dist/from-element.mjs +35 -35
- package/dist/from-points.d.mts +2 -5
- package/dist/from-points.d.ts +2 -5
- package/dist/from-points.js +18 -36
- package/dist/from-points.mjs +14 -13
- package/dist/from-range.d.mts +2 -5
- package/dist/from-range.d.ts +2 -5
- package/dist/from-range.js +25 -46
- package/dist/from-range.mjs +19 -21
- package/dist/from-rotation.d.mts +4 -7
- package/dist/from-rotation.d.ts +4 -7
- package/dist/from-rotation.js +31 -56
- package/dist/from-rotation.mjs +25 -31
- package/dist/from-window.d.mts +13 -16
- package/dist/from-window.d.ts +13 -16
- package/dist/from-window.js +29 -44
- package/dist/from-window.mjs +24 -20
- package/dist/index.d.mts +22 -22
- package/dist/index.d.ts +22 -22
- package/dist/index.js +72 -63
- package/dist/index.mjs +21 -22
- package/dist/intersection.d.mts +4 -7
- package/dist/intersection.d.ts +4 -7
- package/dist/intersection.js +34 -45
- package/dist/intersection.mjs +28 -20
- package/dist/operations.d.mts +6 -9
- package/dist/operations.d.ts +6 -9
- package/dist/operations.js +38 -57
- package/dist/operations.mjs +30 -30
- package/dist/polygon.d.mts +6 -9
- package/dist/polygon.d.ts +6 -9
- package/dist/polygon.js +73 -82
- package/dist/polygon.mjs +67 -57
- package/dist/rect.d.mts +49 -52
- package/dist/rect.d.ts +49 -52
- package/dist/rect.js +57 -82
- package/dist/rect.mjs +46 -52
- package/dist/resize.d.mts +3 -6
- package/dist/resize.d.ts +3 -6
- package/dist/resize.js +73 -102
- package/dist/resize.mjs +68 -78
- package/dist/types.d.mts +45 -49
- package/dist/types.d.ts +45 -49
- package/dist/types.js +4 -18
- package/dist/types.mjs +1 -0
- package/dist/union.d.mts +2 -5
- package/dist/union.d.ts +2 -5
- package/dist/union.js +16 -39
- package/dist/union.mjs +12 -16
- package/package.json +3 -3
- 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
|
-
|
|
3
|
+
// src/resize.ts
|
|
4
|
+
const { sign, abs, min } = Math;
|
|
7
5
|
function getRectExtentPoint(rect, direction) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
13
|
+
return oppositeDirectionMap[direction];
|
|
15
14
|
}
|
|
16
15
|
function resizeRect(rect, offset, direction, opts) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
interface Size {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
interface Bounds {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
interface CenterPoint {
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
interface RectInit extends Point, Size {
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
type
|
|
25
|
-
type
|
|
26
|
-
type
|
|
27
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
42
|
-
|
|
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
|
-
|
|
46
|
-
|
|
42
|
+
export interface ScalingOptions {
|
|
43
|
+
scalingOriginMode: "center" | "extent";
|
|
44
|
+
lockAspectRatio: boolean;
|
|
47
45
|
}
|
|
48
|
-
interface AlignOptions {
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
interface Size {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
interface Bounds {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
interface CenterPoint {
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
interface RectInit extends Point, Size {
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
type
|
|
25
|
-
type
|
|
26
|
-
type
|
|
27
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
42
|
-
|
|
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
|
-
|
|
46
|
-
|
|
42
|
+
export interface ScalingOptions {
|
|
43
|
+
scalingOriginMode: "center" | "extent";
|
|
44
|
+
lockAspectRatio: boolean;
|
|
47
45
|
}
|
|
48
|
-
interface AlignOptions {
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
package/dist/union.d.ts
CHANGED
package/dist/union.js
CHANGED
|
@@ -1,42 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
5
|
+
const require_from_points = require("./from-points.js");
|
|
6
|
+
// src/union.ts
|
|
7
|
+
const { min, max } = Math;
|
|
28
8
|
function union(...rs) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2
|
+
// src/union.ts
|
|
3
|
+
const { min, max } = Math;
|
|
6
4
|
function union(...rs) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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.
|
|
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": "
|
|
49
|
-
"lint": "
|
|
48
|
+
"build": "tsdown",
|
|
49
|
+
"lint": "oxlint src",
|
|
50
50
|
"typecheck": "tsc --noEmit"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/dist/chunk-QZ7TP4HQ.mjs
DELETED
|
@@ -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
|
-
};
|