@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.
- package/dist/affine-transform.d.mts +39 -0
- package/dist/affine-transform.d.ts +39 -0
- package/dist/affine-transform.js +189 -0
- package/dist/affine-transform.mjs +166 -0
- package/dist/align.d.mts +5 -0
- package/dist/align.d.ts +5 -0
- package/dist/align.js +51 -0
- package/dist/align.mjs +28 -0
- package/dist/angle.d.mts +5 -0
- package/dist/angle.d.ts +5 -0
- package/dist/angle.js +35 -0
- package/dist/angle.mjs +12 -0
- package/dist/chunk-QZ7TP4HQ.mjs +7 -0
- package/dist/clamp.d.mts +12 -0
- package/dist/clamp.d.ts +12 -0
- package/dist/clamp.js +51 -0
- package/dist/clamp.mjs +27 -0
- package/dist/closest.d.mts +7 -0
- package/dist/closest.d.ts +7 -0
- package/dist/closest.js +69 -0
- package/dist/closest.mjs +44 -0
- package/dist/compass.d.mts +7 -0
- package/dist/compass.d.ts +7 -0
- package/dist/compass.js +51 -0
- package/dist/compass.mjs +27 -0
- package/dist/constrain.d.mts +5 -0
- package/dist/constrain.d.ts +5 -0
- package/dist/constrain.js +39 -0
- package/dist/constrain.mjs +16 -0
- package/dist/contains.d.mts +7 -0
- package/dist/contains.d.ts +7 -0
- package/dist/contains.js +43 -0
- package/dist/contains.mjs +18 -0
- package/dist/distance.d.mts +11 -0
- package/dist/distance.d.ts +11 -0
- package/dist/distance.js +68 -0
- package/dist/distance.mjs +42 -0
- package/dist/equality.d.mts +7 -0
- package/dist/equality.d.ts +7 -0
- package/dist/equality.js +42 -0
- package/dist/equality.mjs +17 -0
- package/dist/from-element.d.mts +15 -0
- package/dist/from-element.d.ts +15 -0
- package/dist/from-element.js +65 -0
- package/dist/from-element.mjs +42 -0
- package/dist/from-points.d.mts +5 -0
- package/dist/from-points.d.ts +5 -0
- package/dist/from-points.js +39 -0
- package/dist/from-points.mjs +16 -0
- package/dist/from-range.d.mts +5 -0
- package/dist/from-range.d.ts +5 -0
- package/dist/from-range.js +49 -0
- package/dist/from-range.mjs +26 -0
- package/dist/from-rotation.d.mts +7 -0
- package/dist/from-rotation.d.ts +7 -0
- package/dist/from-rotation.js +63 -0
- package/dist/from-rotation.mjs +38 -0
- package/dist/from-window.d.mts +23 -0
- package/dist/from-window.d.ts +23 -0
- package/dist/from-window.js +49 -0
- package/dist/from-window.mjs +25 -0
- package/dist/index.d.mts +22 -253
- package/dist/index.d.ts +22 -253
- package/dist/index.js +62 -772
- package/dist/index.mjs +22 -724
- package/dist/intersection.d.mts +16 -0
- package/dist/intersection.d.ts +16 -0
- package/dist/intersection.js +52 -0
- package/dist/intersection.mjs +27 -0
- package/dist/operations.d.mts +9 -0
- package/dist/operations.d.ts +9 -0
- package/dist/operations.js +66 -0
- package/dist/operations.mjs +39 -0
- package/dist/polygon.d.mts +10 -0
- package/dist/polygon.d.ts +10 -0
- package/dist/polygon.js +91 -0
- package/dist/polygon.mjs +66 -0
- package/dist/rect.d.mts +58 -0
- package/dist/rect.d.ts +58 -0
- package/dist/rect.js +97 -0
- package/dist/rect.mjs +66 -0
- package/dist/resize.d.mts +6 -0
- package/dist/resize.d.ts +6 -0
- package/dist/resize.js +113 -0
- package/dist/resize.mjs +90 -0
- package/dist/types.d.mts +55 -0
- package/dist/types.d.ts +55 -0
- package/dist/types.js +18 -0
- package/dist/types.mjs +0 -0
- package/dist/union.d.mts +5 -0
- package/dist/union.d.ts +5 -0
- package/dist/union.js +42 -0
- package/dist/union.mjs +19 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,253 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
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
|
-
declare class AffineTransform {
|
|
56
|
-
m00: number;
|
|
57
|
-
m01: number;
|
|
58
|
-
m02: number;
|
|
59
|
-
m10: number;
|
|
60
|
-
m11: number;
|
|
61
|
-
m12: number;
|
|
62
|
-
constructor([m00, m01, m02, m10, m11, m12]?: Iterable<number>);
|
|
63
|
-
applyTo(point: Point): Point;
|
|
64
|
-
prepend(other: AffineTransform): AffineTransform;
|
|
65
|
-
append(other: AffineTransform): AffineTransform;
|
|
66
|
-
get determinant(): number;
|
|
67
|
-
get isInvertible(): boolean;
|
|
68
|
-
invert(): AffineTransform;
|
|
69
|
-
get array(): number[];
|
|
70
|
-
get float32Array(): Float32Array;
|
|
71
|
-
static get identity(): AffineTransform;
|
|
72
|
-
static rotate(theta: number, origin?: Point): AffineTransform;
|
|
73
|
-
rotate: (typeof AffineTransform)["rotate"];
|
|
74
|
-
static scale(sx: number, sy?: number, origin?: Point): AffineTransform;
|
|
75
|
-
scale: (typeof AffineTransform)["scale"];
|
|
76
|
-
static translate(tx: number, ty: number): AffineTransform;
|
|
77
|
-
translate: (typeof AffineTransform)["translate"];
|
|
78
|
-
static multiply(...[first, ...rest]: AffineTransform[]): AffineTransform;
|
|
79
|
-
get a(): number;
|
|
80
|
-
get b(): number;
|
|
81
|
-
get c(): number;
|
|
82
|
-
get d(): number;
|
|
83
|
-
get tx(): number;
|
|
84
|
-
get ty(): number;
|
|
85
|
-
get scaleComponents(): Point;
|
|
86
|
-
get translationComponents(): Point;
|
|
87
|
-
get skewComponents(): Point;
|
|
88
|
-
toString(): string;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
declare function alignRect(a: Rect, ref: Rect, options: AlignOptions): Rect;
|
|
92
|
-
|
|
93
|
-
declare function getPointAngle(rect: Rect, point: Point, reference?: Point): number;
|
|
94
|
-
|
|
95
|
-
declare const clampPoint: (position: Point, size: Size, boundaryRect: RectInit) => {
|
|
96
|
-
x: number;
|
|
97
|
-
y: number;
|
|
98
|
-
};
|
|
99
|
-
declare const clampSize: (size: Size, minSize?: Size, maxSize?: Size) => {
|
|
100
|
-
width: number;
|
|
101
|
-
height: number;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
declare function closest(...pts: Point[]): (a: Point) => Point;
|
|
105
|
-
declare function closestSideToRect(ref: Rect, r: Rect): RectSide;
|
|
106
|
-
declare function closestSideToPoint(ref: Rect, p: Point): RectSide;
|
|
107
|
-
|
|
108
|
-
declare const constrainRect: (rect: RectInit, boundary: RectInit) => RectInit;
|
|
109
|
-
|
|
110
|
-
declare function containsPoint(r: Rect, p: Point): boolean;
|
|
111
|
-
declare function containsRect(a: Rect, b: Rect): boolean;
|
|
112
|
-
declare function contains(r: Rect, v: Rect | Point): boolean;
|
|
113
|
-
|
|
114
|
-
interface DistanceValue extends Point {
|
|
115
|
-
value: number;
|
|
116
|
-
}
|
|
117
|
-
declare function distance(a: Point, b?: Point): number;
|
|
118
|
-
declare function distanceFromPoint(r: Rect, p: Point): DistanceValue;
|
|
119
|
-
declare function distanceFromRect(a: Rect, b: Rect): DistanceValue;
|
|
120
|
-
declare function distanceBtwEdges(a: Rect, b: Rect): Record<RectSide, number>;
|
|
121
|
-
|
|
122
|
-
declare const isSizeEqual: (a: Size, b: Size | undefined) => boolean;
|
|
123
|
-
declare const isPointEqual: (a: Point, b: Point | undefined) => boolean;
|
|
124
|
-
declare const isRectEqual: (a: RectInit, b: RectInit | undefined) => boolean;
|
|
125
|
-
|
|
126
|
-
declare function getElementRect(el: HTMLElement, opts?: ElementRectOptions): Rect;
|
|
127
|
-
type ElementRectOptions = {
|
|
128
|
-
/**
|
|
129
|
-
* Whether to exclude the element's scrollbar size from the calculation.
|
|
130
|
-
*/
|
|
131
|
-
excludeScrollbar?: boolean | undefined;
|
|
132
|
-
/**
|
|
133
|
-
* Whether to exclude the element's borders from the calculation.
|
|
134
|
-
*/
|
|
135
|
-
excludeBorders?: boolean | undefined;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
declare function getRectFromPoints(...pts: Point[]): Rect;
|
|
139
|
-
|
|
140
|
-
declare function fromRange(range: Range): Rect;
|
|
141
|
-
|
|
142
|
-
declare function toRad(d: number): number;
|
|
143
|
-
declare function rotate(a: Point, d: number, c: Point): Point;
|
|
144
|
-
declare function getRotationRect(r: Rect, deg: number): Rect;
|
|
145
|
-
|
|
146
|
-
type WindowRectOptions = {
|
|
147
|
-
/**
|
|
148
|
-
* Whether to exclude the element's scrollbar size from the calculation.
|
|
149
|
-
*/
|
|
150
|
-
excludeScrollbar?: boolean | undefined;
|
|
151
|
-
};
|
|
152
|
-
/**
|
|
153
|
-
* Creates a rectangle from window object
|
|
154
|
-
*/
|
|
155
|
-
declare function getWindowRect(win: Window, opts?: WindowRectOptions): Rect;
|
|
156
|
-
/**
|
|
157
|
-
* Get the rect of the window with the option to exclude the scrollbar
|
|
158
|
-
*/
|
|
159
|
-
declare function getViewportRect(win: Window, opts: WindowRectOptions): {
|
|
160
|
-
x: number;
|
|
161
|
-
y: number;
|
|
162
|
-
width: number;
|
|
163
|
-
height: number;
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Checks if a Rect intersects another Rect
|
|
168
|
-
*/
|
|
169
|
-
declare function intersects(a: Rect, b: Rect): boolean;
|
|
170
|
-
/**
|
|
171
|
-
* Returns a new Rect that represents the intersection between two Rects
|
|
172
|
-
*/
|
|
173
|
-
declare function intersection(a: Rect, b: Rect): Rect;
|
|
174
|
-
/**
|
|
175
|
-
* Returns whether two rects collide along each edge
|
|
176
|
-
*/
|
|
177
|
-
declare function collisions(a: Rect, b: Rect): Record<RectSide, boolean>;
|
|
178
|
-
|
|
179
|
-
declare const isSymmetric: (v: any) => v is SymmetricRectInset;
|
|
180
|
-
declare function inset(r: Rect, i: RectInset | SymmetricRectInset): Rect;
|
|
181
|
-
declare function expand(r: Rect, v: number | SymmetricRectInset): Rect;
|
|
182
|
-
declare function shrink(r: Rect, v: number | SymmetricRectInset): Rect;
|
|
183
|
-
declare function shift(r: Rect, o: Partial<Point>): Rect;
|
|
184
|
-
|
|
185
|
-
declare function getElementPolygon(rectValue: RectInit, placement: string): {
|
|
186
|
-
x: number;
|
|
187
|
-
y: number;
|
|
188
|
-
}[] | undefined;
|
|
189
|
-
declare function isPointInPolygon(polygon: Point[], point: Point): boolean;
|
|
190
|
-
declare function debugPolygon(polygon: Point[]): () => void;
|
|
191
|
-
|
|
192
|
-
declare const createPoint: (x: number, y: number) => {
|
|
193
|
-
x: number;
|
|
194
|
-
y: number;
|
|
195
|
-
};
|
|
196
|
-
declare const subtractPoints: (a: Point, b: Point | null) => Point;
|
|
197
|
-
declare const addPoints: (a: Point, b: Point) => {
|
|
198
|
-
x: number;
|
|
199
|
-
y: number;
|
|
200
|
-
};
|
|
201
|
-
declare function isPoint(v: any): v is Point;
|
|
202
|
-
declare function createRect(r: RectInit): Rect;
|
|
203
|
-
declare function isRect(v: any): v is Rect;
|
|
204
|
-
declare function getRectCenters(v: Rect): {
|
|
205
|
-
top: {
|
|
206
|
-
x: number;
|
|
207
|
-
y: number;
|
|
208
|
-
};
|
|
209
|
-
right: {
|
|
210
|
-
x: number;
|
|
211
|
-
y: number;
|
|
212
|
-
};
|
|
213
|
-
bottom: {
|
|
214
|
-
x: number;
|
|
215
|
-
y: number;
|
|
216
|
-
};
|
|
217
|
-
left: {
|
|
218
|
-
x: number;
|
|
219
|
-
y: number;
|
|
220
|
-
};
|
|
221
|
-
};
|
|
222
|
-
declare function getRectCorners(v: Rect): {
|
|
223
|
-
top: {
|
|
224
|
-
x: number;
|
|
225
|
-
y: number;
|
|
226
|
-
};
|
|
227
|
-
right: {
|
|
228
|
-
x: number;
|
|
229
|
-
y: number;
|
|
230
|
-
};
|
|
231
|
-
bottom: {
|
|
232
|
-
x: number;
|
|
233
|
-
y: number;
|
|
234
|
-
};
|
|
235
|
-
left: {
|
|
236
|
-
x: number;
|
|
237
|
-
y: number;
|
|
238
|
-
};
|
|
239
|
-
};
|
|
240
|
-
declare function getRectEdges(v: Rect): {
|
|
241
|
-
top: RectEdge;
|
|
242
|
-
right: RectEdge;
|
|
243
|
-
bottom: RectEdge;
|
|
244
|
-
left: RectEdge;
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
type CompassDirection = "n" | "ne" | "e" | "se" | "s" | "sw" | "w" | "nw";
|
|
248
|
-
|
|
249
|
-
declare function resizeRect(rect: Rect, offset: Point, direction: CompassDirection, opts: ScalingOptions): RectInit;
|
|
250
|
-
|
|
251
|
-
declare function union(...rs: Rect[]): Rect;
|
|
252
|
-
|
|
253
|
-
export { AffineTransform, type AlignOptions, type Bounds, type CenterPoint, type DistanceValue, type ElementRectOptions, type HAlign, type Point, type Rect, type RectCenter, type RectCenters, type RectCorner, type RectCorners, type RectEdge, type RectEdges, type RectInit, type RectInset, type RectPoint, type RectPoints, type RectSide, type ScalingOptions, type Size, type SymmetricRectInset, type VAlign, type WindowRectOptions, addPoints, alignRect, clampPoint, clampSize, closest, closestSideToPoint, closestSideToRect, collisions, constrainRect, contains, containsPoint, containsRect, createPoint, createRect, debugPolygon, distance, distanceBtwEdges, distanceFromPoint, distanceFromRect, expand, fromRange, getElementPolygon, getElementRect, getPointAngle, getRectCenters, getRectCorners, getRectEdges, getRectFromPoints, getRotationRect, getViewportRect, getWindowRect, inset, intersection, intersects, isPoint, isPointEqual, isPointInPolygon, isRect, isRectEqual, isSizeEqual, isSymmetric, resizeRect, rotate, shift, shrink, subtractPoints, toRad, union };
|
|
1
|
+
export { AffineTransform } from './affine-transform.mjs';
|
|
2
|
+
export { alignRect } from './align.mjs';
|
|
3
|
+
export { getPointAngle } from './angle.mjs';
|
|
4
|
+
export { clampPoint, clampSize } from './clamp.mjs';
|
|
5
|
+
export { closest, closestSideToPoint, closestSideToRect } from './closest.mjs';
|
|
6
|
+
export { constrainRect } from './constrain.mjs';
|
|
7
|
+
export { contains, containsPoint, containsRect } from './contains.mjs';
|
|
8
|
+
export { DistanceValue, distance, distanceBtwEdges, distanceFromPoint, distanceFromRect } from './distance.mjs';
|
|
9
|
+
export { isPointEqual, isRectEqual, isSizeEqual } from './equality.mjs';
|
|
10
|
+
export { ElementRectOptions, getElementRect } from './from-element.mjs';
|
|
11
|
+
export { getRectFromPoints } from './from-points.mjs';
|
|
12
|
+
export { fromRange } from './from-range.mjs';
|
|
13
|
+
export { getRotationRect, rotate, toRad } from './from-rotation.mjs';
|
|
14
|
+
export { WindowRectOptions, getViewportRect, getWindowRect } from './from-window.mjs';
|
|
15
|
+
export { collisions, intersection, intersects } from './intersection.mjs';
|
|
16
|
+
export { expand, inset, isSymmetric, shift, shrink } from './operations.mjs';
|
|
17
|
+
export { debugPolygon, getElementPolygon, isPointInPolygon } from './polygon.mjs';
|
|
18
|
+
export { addPoints, createPoint, createRect, getRectCenters, getRectCorners, getRectEdges, isPoint, isRect, subtractPoints } from './rect.mjs';
|
|
19
|
+
export { resizeRect } from './resize.mjs';
|
|
20
|
+
export { AlignOptions, Bounds, CenterPoint, HAlign, Point, Rect, RectCenter, RectCenters, RectCorner, RectCorners, RectEdge, RectEdges, RectInit, RectInset, RectPoint, RectPoints, RectSide, ScalingOptions, Size, SymmetricRectInset, VAlign } from './types.mjs';
|
|
21
|
+
export { union } from './union.mjs';
|
|
22
|
+
import './compass.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,253 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
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
|
-
declare class AffineTransform {
|
|
56
|
-
m00: number;
|
|
57
|
-
m01: number;
|
|
58
|
-
m02: number;
|
|
59
|
-
m10: number;
|
|
60
|
-
m11: number;
|
|
61
|
-
m12: number;
|
|
62
|
-
constructor([m00, m01, m02, m10, m11, m12]?: Iterable<number>);
|
|
63
|
-
applyTo(point: Point): Point;
|
|
64
|
-
prepend(other: AffineTransform): AffineTransform;
|
|
65
|
-
append(other: AffineTransform): AffineTransform;
|
|
66
|
-
get determinant(): number;
|
|
67
|
-
get isInvertible(): boolean;
|
|
68
|
-
invert(): AffineTransform;
|
|
69
|
-
get array(): number[];
|
|
70
|
-
get float32Array(): Float32Array;
|
|
71
|
-
static get identity(): AffineTransform;
|
|
72
|
-
static rotate(theta: number, origin?: Point): AffineTransform;
|
|
73
|
-
rotate: (typeof AffineTransform)["rotate"];
|
|
74
|
-
static scale(sx: number, sy?: number, origin?: Point): AffineTransform;
|
|
75
|
-
scale: (typeof AffineTransform)["scale"];
|
|
76
|
-
static translate(tx: number, ty: number): AffineTransform;
|
|
77
|
-
translate: (typeof AffineTransform)["translate"];
|
|
78
|
-
static multiply(...[first, ...rest]: AffineTransform[]): AffineTransform;
|
|
79
|
-
get a(): number;
|
|
80
|
-
get b(): number;
|
|
81
|
-
get c(): number;
|
|
82
|
-
get d(): number;
|
|
83
|
-
get tx(): number;
|
|
84
|
-
get ty(): number;
|
|
85
|
-
get scaleComponents(): Point;
|
|
86
|
-
get translationComponents(): Point;
|
|
87
|
-
get skewComponents(): Point;
|
|
88
|
-
toString(): string;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
declare function alignRect(a: Rect, ref: Rect, options: AlignOptions): Rect;
|
|
92
|
-
|
|
93
|
-
declare function getPointAngle(rect: Rect, point: Point, reference?: Point): number;
|
|
94
|
-
|
|
95
|
-
declare const clampPoint: (position: Point, size: Size, boundaryRect: RectInit) => {
|
|
96
|
-
x: number;
|
|
97
|
-
y: number;
|
|
98
|
-
};
|
|
99
|
-
declare const clampSize: (size: Size, minSize?: Size, maxSize?: Size) => {
|
|
100
|
-
width: number;
|
|
101
|
-
height: number;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
declare function closest(...pts: Point[]): (a: Point) => Point;
|
|
105
|
-
declare function closestSideToRect(ref: Rect, r: Rect): RectSide;
|
|
106
|
-
declare function closestSideToPoint(ref: Rect, p: Point): RectSide;
|
|
107
|
-
|
|
108
|
-
declare const constrainRect: (rect: RectInit, boundary: RectInit) => RectInit;
|
|
109
|
-
|
|
110
|
-
declare function containsPoint(r: Rect, p: Point): boolean;
|
|
111
|
-
declare function containsRect(a: Rect, b: Rect): boolean;
|
|
112
|
-
declare function contains(r: Rect, v: Rect | Point): boolean;
|
|
113
|
-
|
|
114
|
-
interface DistanceValue extends Point {
|
|
115
|
-
value: number;
|
|
116
|
-
}
|
|
117
|
-
declare function distance(a: Point, b?: Point): number;
|
|
118
|
-
declare function distanceFromPoint(r: Rect, p: Point): DistanceValue;
|
|
119
|
-
declare function distanceFromRect(a: Rect, b: Rect): DistanceValue;
|
|
120
|
-
declare function distanceBtwEdges(a: Rect, b: Rect): Record<RectSide, number>;
|
|
121
|
-
|
|
122
|
-
declare const isSizeEqual: (a: Size, b: Size | undefined) => boolean;
|
|
123
|
-
declare const isPointEqual: (a: Point, b: Point | undefined) => boolean;
|
|
124
|
-
declare const isRectEqual: (a: RectInit, b: RectInit | undefined) => boolean;
|
|
125
|
-
|
|
126
|
-
declare function getElementRect(el: HTMLElement, opts?: ElementRectOptions): Rect;
|
|
127
|
-
type ElementRectOptions = {
|
|
128
|
-
/**
|
|
129
|
-
* Whether to exclude the element's scrollbar size from the calculation.
|
|
130
|
-
*/
|
|
131
|
-
excludeScrollbar?: boolean | undefined;
|
|
132
|
-
/**
|
|
133
|
-
* Whether to exclude the element's borders from the calculation.
|
|
134
|
-
*/
|
|
135
|
-
excludeBorders?: boolean | undefined;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
declare function getRectFromPoints(...pts: Point[]): Rect;
|
|
139
|
-
|
|
140
|
-
declare function fromRange(range: Range): Rect;
|
|
141
|
-
|
|
142
|
-
declare function toRad(d: number): number;
|
|
143
|
-
declare function rotate(a: Point, d: number, c: Point): Point;
|
|
144
|
-
declare function getRotationRect(r: Rect, deg: number): Rect;
|
|
145
|
-
|
|
146
|
-
type WindowRectOptions = {
|
|
147
|
-
/**
|
|
148
|
-
* Whether to exclude the element's scrollbar size from the calculation.
|
|
149
|
-
*/
|
|
150
|
-
excludeScrollbar?: boolean | undefined;
|
|
151
|
-
};
|
|
152
|
-
/**
|
|
153
|
-
* Creates a rectangle from window object
|
|
154
|
-
*/
|
|
155
|
-
declare function getWindowRect(win: Window, opts?: WindowRectOptions): Rect;
|
|
156
|
-
/**
|
|
157
|
-
* Get the rect of the window with the option to exclude the scrollbar
|
|
158
|
-
*/
|
|
159
|
-
declare function getViewportRect(win: Window, opts: WindowRectOptions): {
|
|
160
|
-
x: number;
|
|
161
|
-
y: number;
|
|
162
|
-
width: number;
|
|
163
|
-
height: number;
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Checks if a Rect intersects another Rect
|
|
168
|
-
*/
|
|
169
|
-
declare function intersects(a: Rect, b: Rect): boolean;
|
|
170
|
-
/**
|
|
171
|
-
* Returns a new Rect that represents the intersection between two Rects
|
|
172
|
-
*/
|
|
173
|
-
declare function intersection(a: Rect, b: Rect): Rect;
|
|
174
|
-
/**
|
|
175
|
-
* Returns whether two rects collide along each edge
|
|
176
|
-
*/
|
|
177
|
-
declare function collisions(a: Rect, b: Rect): Record<RectSide, boolean>;
|
|
178
|
-
|
|
179
|
-
declare const isSymmetric: (v: any) => v is SymmetricRectInset;
|
|
180
|
-
declare function inset(r: Rect, i: RectInset | SymmetricRectInset): Rect;
|
|
181
|
-
declare function expand(r: Rect, v: number | SymmetricRectInset): Rect;
|
|
182
|
-
declare function shrink(r: Rect, v: number | SymmetricRectInset): Rect;
|
|
183
|
-
declare function shift(r: Rect, o: Partial<Point>): Rect;
|
|
184
|
-
|
|
185
|
-
declare function getElementPolygon(rectValue: RectInit, placement: string): {
|
|
186
|
-
x: number;
|
|
187
|
-
y: number;
|
|
188
|
-
}[] | undefined;
|
|
189
|
-
declare function isPointInPolygon(polygon: Point[], point: Point): boolean;
|
|
190
|
-
declare function debugPolygon(polygon: Point[]): () => void;
|
|
191
|
-
|
|
192
|
-
declare const createPoint: (x: number, y: number) => {
|
|
193
|
-
x: number;
|
|
194
|
-
y: number;
|
|
195
|
-
};
|
|
196
|
-
declare const subtractPoints: (a: Point, b: Point | null) => Point;
|
|
197
|
-
declare const addPoints: (a: Point, b: Point) => {
|
|
198
|
-
x: number;
|
|
199
|
-
y: number;
|
|
200
|
-
};
|
|
201
|
-
declare function isPoint(v: any): v is Point;
|
|
202
|
-
declare function createRect(r: RectInit): Rect;
|
|
203
|
-
declare function isRect(v: any): v is Rect;
|
|
204
|
-
declare function getRectCenters(v: Rect): {
|
|
205
|
-
top: {
|
|
206
|
-
x: number;
|
|
207
|
-
y: number;
|
|
208
|
-
};
|
|
209
|
-
right: {
|
|
210
|
-
x: number;
|
|
211
|
-
y: number;
|
|
212
|
-
};
|
|
213
|
-
bottom: {
|
|
214
|
-
x: number;
|
|
215
|
-
y: number;
|
|
216
|
-
};
|
|
217
|
-
left: {
|
|
218
|
-
x: number;
|
|
219
|
-
y: number;
|
|
220
|
-
};
|
|
221
|
-
};
|
|
222
|
-
declare function getRectCorners(v: Rect): {
|
|
223
|
-
top: {
|
|
224
|
-
x: number;
|
|
225
|
-
y: number;
|
|
226
|
-
};
|
|
227
|
-
right: {
|
|
228
|
-
x: number;
|
|
229
|
-
y: number;
|
|
230
|
-
};
|
|
231
|
-
bottom: {
|
|
232
|
-
x: number;
|
|
233
|
-
y: number;
|
|
234
|
-
};
|
|
235
|
-
left: {
|
|
236
|
-
x: number;
|
|
237
|
-
y: number;
|
|
238
|
-
};
|
|
239
|
-
};
|
|
240
|
-
declare function getRectEdges(v: Rect): {
|
|
241
|
-
top: RectEdge;
|
|
242
|
-
right: RectEdge;
|
|
243
|
-
bottom: RectEdge;
|
|
244
|
-
left: RectEdge;
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
type CompassDirection = "n" | "ne" | "e" | "se" | "s" | "sw" | "w" | "nw";
|
|
248
|
-
|
|
249
|
-
declare function resizeRect(rect: Rect, offset: Point, direction: CompassDirection, opts: ScalingOptions): RectInit;
|
|
250
|
-
|
|
251
|
-
declare function union(...rs: Rect[]): Rect;
|
|
252
|
-
|
|
253
|
-
export { AffineTransform, type AlignOptions, type Bounds, type CenterPoint, type DistanceValue, type ElementRectOptions, type HAlign, type Point, type Rect, type RectCenter, type RectCenters, type RectCorner, type RectCorners, type RectEdge, type RectEdges, type RectInit, type RectInset, type RectPoint, type RectPoints, type RectSide, type ScalingOptions, type Size, type SymmetricRectInset, type VAlign, type WindowRectOptions, addPoints, alignRect, clampPoint, clampSize, closest, closestSideToPoint, closestSideToRect, collisions, constrainRect, contains, containsPoint, containsRect, createPoint, createRect, debugPolygon, distance, distanceBtwEdges, distanceFromPoint, distanceFromRect, expand, fromRange, getElementPolygon, getElementRect, getPointAngle, getRectCenters, getRectCorners, getRectEdges, getRectFromPoints, getRotationRect, getViewportRect, getWindowRect, inset, intersection, intersects, isPoint, isPointEqual, isPointInPolygon, isRect, isRectEqual, isSizeEqual, isSymmetric, resizeRect, rotate, shift, shrink, subtractPoints, toRad, union };
|
|
1
|
+
export { AffineTransform } from './affine-transform.js';
|
|
2
|
+
export { alignRect } from './align.js';
|
|
3
|
+
export { getPointAngle } from './angle.js';
|
|
4
|
+
export { clampPoint, clampSize } from './clamp.js';
|
|
5
|
+
export { closest, closestSideToPoint, closestSideToRect } from './closest.js';
|
|
6
|
+
export { constrainRect } from './constrain.js';
|
|
7
|
+
export { contains, containsPoint, containsRect } from './contains.js';
|
|
8
|
+
export { DistanceValue, distance, distanceBtwEdges, distanceFromPoint, distanceFromRect } from './distance.js';
|
|
9
|
+
export { isPointEqual, isRectEqual, isSizeEqual } from './equality.js';
|
|
10
|
+
export { ElementRectOptions, getElementRect } from './from-element.js';
|
|
11
|
+
export { getRectFromPoints } from './from-points.js';
|
|
12
|
+
export { fromRange } from './from-range.js';
|
|
13
|
+
export { getRotationRect, rotate, toRad } from './from-rotation.js';
|
|
14
|
+
export { WindowRectOptions, getViewportRect, getWindowRect } from './from-window.js';
|
|
15
|
+
export { collisions, intersection, intersects } from './intersection.js';
|
|
16
|
+
export { expand, inset, isSymmetric, shift, shrink } from './operations.js';
|
|
17
|
+
export { debugPolygon, getElementPolygon, isPointInPolygon } from './polygon.js';
|
|
18
|
+
export { addPoints, createPoint, createRect, getRectCenters, getRectCorners, getRectEdges, isPoint, isRect, subtractPoints } from './rect.js';
|
|
19
|
+
export { resizeRect } from './resize.js';
|
|
20
|
+
export { AlignOptions, Bounds, CenterPoint, HAlign, Point, Rect, RectCenter, RectCenters, RectCorner, RectCorners, RectEdge, RectEdges, RectInit, RectInset, RectPoint, RectPoints, RectSide, ScalingOptions, Size, SymmetricRectInset, VAlign } from './types.js';
|
|
21
|
+
export { union } from './union.js';
|
|
22
|
+
import './compass.js';
|