@zag-js/rect-utils 0.1.2 → 0.1.3

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/index.mjs CHANGED
@@ -1,93 +1,254 @@
1
- // src/rect.ts
2
- var point = (x, y) => ({ x, y });
3
- var Rect = class {
4
- constructor(v) {
5
- this.v = v;
6
- }
7
- static create(v) {
8
- return new Rect(v);
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+
21
+ // src/align.ts
22
+ function hAlign(a, ref, h) {
23
+ let x = ref.minX;
24
+ if (h === "left-inside") {
25
+ x = ref.minX;
9
26
  }
10
- set(n) {
11
- return new Rect(Object.assign({}, this.v, n));
27
+ if (h === "left-outside") {
28
+ x = ref.minX - ref.width;
12
29
  }
13
- clone() {
14
- return new Rect(this.v);
30
+ if (h === "right-inside") {
31
+ x = ref.maxX - ref.width;
15
32
  }
16
- get x() {
17
- return this.v.x;
33
+ if (h === "right-outside") {
34
+ x = ref.maxX;
18
35
  }
19
- get y() {
20
- return this.v.y;
36
+ if (h === "center") {
37
+ x = ref.midX - ref.width / 2;
21
38
  }
22
- get width() {
23
- return this.v.width;
39
+ return __spreadProps(__spreadValues({}, a), { x });
40
+ }
41
+ function vAlign(a, ref, v) {
42
+ let y = ref.minY;
43
+ if (v === "top-inside") {
44
+ y = ref.minY;
24
45
  }
25
- get height() {
26
- return this.v.height;
46
+ if (v === "top-outside") {
47
+ y = ref.minY - a.height;
27
48
  }
28
- get minX() {
29
- return this.v.x;
49
+ if (v === "bottom-inside") {
50
+ y = ref.maxY - a.height;
30
51
  }
31
- get midX() {
32
- return this.v.x + this.v.width / 2;
52
+ if (v === "bottom-outside") {
53
+ y = ref.maxY;
33
54
  }
34
- get maxX() {
35
- return this.v.x + this.v.width;
55
+ if (v === "center") {
56
+ y = ref.midY - a.height / 2;
36
57
  }
37
- get minY() {
38
- return this.v.y;
58
+ return __spreadProps(__spreadValues({}, a), { y });
59
+ }
60
+ function alignRect(a, ref, options) {
61
+ const { h, v } = options;
62
+ return vAlign(hAlign(a, ref, h), ref, v);
63
+ }
64
+
65
+ // ../core/dist/index.mjs
66
+ var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
67
+
68
+ // src/rect.ts
69
+ var point = (x, y) => ({ x, y });
70
+ function createRect(r) {
71
+ const { x, y, width, height } = r;
72
+ const midX = x + width / 2;
73
+ const midY = y + height / 2;
74
+ return {
75
+ x,
76
+ y,
77
+ width,
78
+ height,
79
+ minX: x,
80
+ minY: y,
81
+ maxX: x + width,
82
+ maxY: y + height,
83
+ midX,
84
+ midY,
85
+ center: point(midX, midY)
86
+ };
87
+ }
88
+ function isRect(v) {
89
+ return hasProp(v, "x") && hasProp(v, "y") && hasProp(v, "width") && hasProp(v, "height");
90
+ }
91
+ function getRectCenters(v) {
92
+ const top = point(v.midX, v.minY);
93
+ const right = point(v.maxX, v.midY);
94
+ const bottom = point(v.midX, v.maxY);
95
+ const left = point(v.minX, v.midY);
96
+ return { top, right, bottom, left };
97
+ }
98
+ function getRectCorners(v) {
99
+ const top = point(v.minX, v.minY);
100
+ const right = point(v.maxX, v.minY);
101
+ const bottom = point(v.maxX, v.maxY);
102
+ const left = point(v.minX, v.maxY);
103
+ return { top, right, bottom, left };
104
+ }
105
+ function getRectEdges(v) {
106
+ const c = getRectCorners(v);
107
+ const top = [c.top, c.right];
108
+ const right = [c.right, c.bottom];
109
+ const bottom = [c.left, c.bottom];
110
+ const left = [c.top, c.left];
111
+ return { top, right, bottom, left };
112
+ }
113
+
114
+ // src/intersection.ts
115
+ function intersects(a, b) {
116
+ return a.x < b.maxX && a.y < b.maxY && a.maxX > b.x && a.maxY > b.y;
117
+ }
118
+ function intersection(a, b) {
119
+ const x = Math.max(a.x, b.x);
120
+ const y = Math.max(a.y, b.y);
121
+ const x2 = Math.min(a.x + a.width, b.x + b.width);
122
+ const y2 = Math.min(a.y + a.height, b.y + b.height);
123
+ return createRect({ x, y, width: x2 - x, height: y2 - y });
124
+ }
125
+ function collisions(a, b) {
126
+ return {
127
+ top: a.minY <= b.minY,
128
+ right: a.maxX >= b.maxX,
129
+ bottom: a.maxY >= b.maxY,
130
+ left: a.minX <= b.minX
131
+ };
132
+ }
133
+
134
+ // src/distance.ts
135
+ function distance(a, b = { x: 0, y: 0 }) {
136
+ return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
137
+ }
138
+ function distanceFromPoint(r, p) {
139
+ let x = 0;
140
+ let y = 0;
141
+ if (p.x < r.x)
142
+ x = r.x - p.x;
143
+ else if (p.x > r.maxX)
144
+ x = p.x - r.maxX;
145
+ if (p.y < r.y)
146
+ y = r.y - p.y;
147
+ else if (p.y > r.maxY)
148
+ y = p.y - r.maxY;
149
+ return { x, y, value: distance({ x, y }) };
150
+ }
151
+ function distanceFromRect(a, b) {
152
+ if (intersects(a, b))
153
+ return { x: 0, y: 0, value: 0 };
154
+ const left = a.x < b.x ? a : b;
155
+ const right = b.x < a.x ? a : b;
156
+ const upper = a.y < b.y ? a : b;
157
+ const lower = b.y < a.y ? a : b;
158
+ let x = left.x === right.x ? 0 : right.x - left.maxX;
159
+ x = Math.max(0, x);
160
+ let y = upper.y === lower.y ? 0 : lower.y - upper.maxY;
161
+ y = Math.max(0, y);
162
+ return { x, y, value: distance({ x, y }) };
163
+ }
164
+ function distanceBtwEdges(a, b) {
165
+ return {
166
+ left: b.x - a.x,
167
+ top: b.y - a.y,
168
+ right: a.maxX - b.maxX,
169
+ bottom: a.maxY - b.maxY
170
+ };
171
+ }
172
+
173
+ // src/closest.ts
174
+ function closest(...pts) {
175
+ return (a) => {
176
+ const ds = pts.map((b) => distance(b, a));
177
+ const c = Math.min.apply(Math, ds);
178
+ return pts[ds.indexOf(c)];
179
+ };
180
+ }
181
+ function closestSideToRect(ref, r) {
182
+ if (r.maxX <= ref.minX) {
183
+ return "left";
39
184
  }
40
- get midY() {
41
- return this.v.y + this.v.height / 2;
185
+ if (r.minX >= ref.maxX) {
186
+ return "right";
42
187
  }
43
- get maxY() {
44
- return this.v.y + this.v.height;
188
+ if (r.maxY <= ref.minY) {
189
+ return "top";
45
190
  }
46
- get center() {
47
- return point(this.midX, this.midY);
191
+ if (r.minY >= ref.maxY) {
192
+ return "bottom";
48
193
  }
49
- get centers() {
50
- const top = point(this.midX, this.minY);
51
- const right = point(this.maxX, this.midY);
52
- const bottom = point(this.midX, this.maxY);
53
- const left = point(this.minX, this.midY);
54
- return { top, right, bottom, left };
194
+ return "left";
195
+ }
196
+ function closestSideToPoint(ref, p) {
197
+ const { x, y } = p;
198
+ const dl = x - ref.minX;
199
+ const dr = ref.maxX - x;
200
+ const dt = y - ref.minY;
201
+ const db = ref.maxY - y;
202
+ let closest2 = dl;
203
+ let side = "left";
204
+ if (dr < closest2) {
205
+ closest2 = dr;
206
+ side = "right";
55
207
  }
56
- get corners() {
57
- const top = point(this.minX, this.minY);
58
- const right = point(this.maxX, this.minY);
59
- const bottom = point(this.maxX, this.maxY);
60
- const left = point(this.minX, this.maxY);
61
- return { top, right, bottom, left };
208
+ if (dt < closest2) {
209
+ closest2 = dt;
210
+ side = "top";
62
211
  }
63
- get edges() {
64
- const c = this.corners;
65
- const top = [c.top, c.right];
66
- const right = [c.right, c.bottom];
67
- const bottom = [c.left, c.bottom];
68
- const left = [c.top, c.left];
69
- return { top, right, bottom, left };
212
+ if (db < closest2) {
213
+ side = "bottom";
70
214
  }
71
- };
215
+ return side;
216
+ }
72
217
 
73
- // src/computed-style.ts
74
- var styleCache = /* @__PURE__ */ new WeakMap();
218
+ // src/contains.ts
219
+ function containsPoint(r, p) {
220
+ return r.minX <= p.x && p.x <= r.maxX && r.minY <= p.y && p.y <= r.maxY;
221
+ }
222
+ function containsRect(a, b) {
223
+ return Object.values(getRectCorners(b)).every((c) => containsPoint(a, c));
224
+ }
225
+ function contains(r, v) {
226
+ return isRect(v) ? containsRect(r, v) : containsPoint(r, v);
227
+ }
228
+
229
+ // ../dom/dist/index.mjs
230
+ function getCache() {
231
+ const g = globalThis;
232
+ g.__styleCache = g.__styleCache || /* @__PURE__ */ new WeakMap();
233
+ return g.__styleCache;
234
+ }
75
235
  function getComputedStyle(el) {
76
236
  var _a;
77
237
  if (!el)
78
238
  return {};
79
- let style = styleCache.get(el);
239
+ const cache = getCache();
240
+ let style = cache.get(el);
80
241
  if (!style) {
81
242
  const win = (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
82
243
  style = win.getComputedStyle(el);
83
- styleCache.set(el, style);
244
+ cache.set(el, style);
84
245
  }
85
246
  return style;
86
247
  }
87
248
 
88
249
  // src/from-element.ts
89
250
  function getElementRect(el, opts = {}) {
90
- return Rect.create(getClientRect(el, opts));
251
+ return createRect(getClientRect(el, opts));
91
252
  }
92
253
  function getClientRect(el, opts = {}) {
93
254
  const { excludeScrollbar = false, excludeBorders = false } = opts;
@@ -114,45 +275,124 @@ function getClientRect(el, opts = {}) {
114
275
  var px = (v) => parseFloat(v.replace("px", ""));
115
276
  var sum = (...vals) => vals.reduce((sum2, v) => sum2 + (v ? px(v) : 0), 0);
116
277
 
117
- // ../core/dist/index.mjs
118
- var isDom = () => typeof window !== "undefined";
119
- var isArray = (v) => Array.isArray(v);
120
- var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
121
- var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
122
- var isTouchDevice = isDom() && !!navigator.maxTouchPoints;
123
- var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
124
-
125
- // src/point.ts
126
- function distance(a, b = { x: 0, y: 0 }) {
127
- return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
278
+ // src/from-points.ts
279
+ function getRectFromPoints(...pts) {
280
+ const xs = pts.map((p) => p.x);
281
+ const ys = pts.map((p) => p.y);
282
+ const x = Math.min(...xs);
283
+ const y = Math.min(...ys);
284
+ const width = Math.max(...xs) - x;
285
+ const height = Math.max(...ys) - y;
286
+ return createRect({ x, y, width, height });
128
287
  }
129
- function closest(...pts) {
130
- return (a) => {
131
- const ds = pts.map((b) => distance(b, a));
132
- const c = Math.min.apply(Math, ds);
133
- return pts[ds.indexOf(c)];
288
+
289
+ // src/union.ts
290
+ var { min, max } = Math;
291
+ function union(...rs) {
292
+ const pMin = {
293
+ x: min.apply(Math, rs.map((r) => r.minX)),
294
+ y: min.apply(Math, rs.map((r) => r.minY))
295
+ };
296
+ const pMax = {
297
+ x: max.apply(Math, rs.map((r) => r.maxX)),
298
+ y: max.apply(Math, rs.map((r) => r.maxY))
134
299
  };
300
+ return getRectFromPoints(pMin, pMax);
135
301
  }
136
- var fallback = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 };
137
- function getEventPoint(e, t = "page") {
138
- const p = isTouchEvent(e) ? e.touches[0] || e.changedTouches[0] || fallback : e;
139
- return { x: p[`${t}X`], y: p[`${t}Y`] };
302
+
303
+ // src/from-range.ts
304
+ function fromRange(range) {
305
+ let rs = [];
306
+ const rects = Array.from(range.getClientRects());
307
+ if (rects.length) {
308
+ rs = rs.concat(rects.map(createRect));
309
+ return union.apply(void 0, rs);
310
+ }
311
+ let start = range.startContainer;
312
+ if (start.nodeType === Node.TEXT_NODE) {
313
+ start = start.parentNode;
314
+ }
315
+ if (start instanceof HTMLElement) {
316
+ const r = getElementRect(start);
317
+ rs.push(__spreadProps(__spreadValues({}, r), { x: r.maxX, width: 0 }));
318
+ }
319
+ return union.apply(void 0, rs);
140
320
  }
141
- function relativeToNode(p, el) {
142
- const dx = p.x - el.offsetLeft - el.clientLeft + el.scrollLeft;
143
- const dy = p.y - el.offsetTop - el.clientTop + el.scrollTop;
321
+
322
+ // src/from-rotation.ts
323
+ function toRad(d) {
324
+ return d % 360 * Math.PI / 180;
325
+ }
326
+ function rotate(a, d, c) {
327
+ const r = toRad(d);
328
+ const sin = Math.sin(r);
329
+ const cos = Math.cos(r);
330
+ const x = a.x - c.x;
331
+ const y = a.y - c.y;
144
332
  return {
145
- point: { x: dx, y: dy },
146
- progress: { x: dx / el.offsetWidth, y: dy / el.offsetHeight }
333
+ x: c.x + x * cos - y * sin,
334
+ y: c.y + x * sin + y * cos
147
335
  };
148
336
  }
337
+ function getRotationRect(r, deg) {
338
+ const rr = Object.values(getRectCorners(r)).map((p) => rotate(p, deg, r.center));
339
+ const xs = rr.map((p) => p.x);
340
+ const ys = rr.map((p) => p.y);
341
+ const minX = Math.min(...xs);
342
+ const minY = Math.min(...ys);
343
+ const maxX = Math.max(...xs);
344
+ const maxY = Math.max(...ys);
345
+ return createRect({
346
+ x: minX,
347
+ y: minY,
348
+ width: maxX - minX,
349
+ height: maxY - minY
350
+ });
351
+ }
352
+
353
+ // src/from-window.ts
354
+ function getWindowRect(win, opts = {}) {
355
+ return createRect(getViewportRect(win, opts));
356
+ }
357
+ function getViewportRect(win, opts) {
358
+ const { excludeScrollbar = false } = opts;
359
+ const { innerWidth: innerWidth2, innerHeight: innerHeight2, document: doc, visualViewport } = win;
360
+ const width = visualViewport.width || innerWidth2;
361
+ const height = visualViewport.height || innerHeight2;
362
+ const rect = { x: 0, y: 0, width, height };
363
+ if (excludeScrollbar) {
364
+ const scrollbarWidth = innerWidth2 - doc.documentElement.clientWidth;
365
+ const scrollbarHeight = innerHeight2 - doc.documentElement.clientHeight;
366
+ rect.width -= scrollbarWidth;
367
+ rect.height -= scrollbarHeight;
368
+ }
369
+ return rect;
370
+ }
371
+
372
+ // src/get-polygon.ts
373
+ function getElementPolygon(rectValue, placement) {
374
+ const rect = createRect(rectValue);
375
+ const { top, right, left, bottom } = getRectCorners(rect);
376
+ const [base] = placement.split("-");
377
+ return {
378
+ top: [left, top, right, bottom],
379
+ right: [top, right, bottom, left],
380
+ bottom: [top, left, bottom, right],
381
+ left: [right, top, left, bottom]
382
+ }[base];
383
+ }
149
384
 
150
385
  // src/operations.ts
151
386
  var isSymmetric = (v) => "dx" in v || "dy" in v;
152
387
  function inset(r, i) {
153
388
  const v = isSymmetric(i) ? { left: i.dx, right: i.dx, top: i.dy, bottom: i.dy } : i;
154
389
  const { top = 0, right = 0, bottom = 0, left = 0 } = v;
155
- return Rect.create({ x: r.x + left, y: r.y + top, width: r.width - left - right, height: r.height - top - bottom });
390
+ return createRect({
391
+ x: r.x + left,
392
+ y: r.y + top,
393
+ width: r.width - left - right,
394
+ height: r.height - top - bottom
395
+ });
156
396
  }
157
397
  function expand(r, v) {
158
398
  const value = typeof v === "number" ? { dx: -v, dy: -v } : v;
@@ -164,11 +404,16 @@ function shrink(r, v) {
164
404
  }
165
405
  function shift(r, o) {
166
406
  const { x = 0, y = 0 } = o;
167
- return Rect.create({ x: r.x + x, y: r.y + y, width: r.width, height: r.height });
407
+ return createRect({
408
+ x: r.x + x,
409
+ y: r.y + y,
410
+ width: r.width,
411
+ height: r.height
412
+ });
168
413
  }
169
414
 
170
415
  // src/polygon.ts
171
- function withinPolygon(polygon, point2) {
416
+ function isPointInPolygon(polygon, point2) {
172
417
  const { x, y } = point2;
173
418
  let c = false;
174
419
  for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
@@ -210,19 +455,45 @@ function debugPolygon(polygon) {
210
455
  const points = polygon.map((point2) => `${point2.x},${point2.y}`).join(" ");
211
456
  el.setAttribute("points", points);
212
457
  }
458
+ debugPolygon.remove = () => {
459
+ const el = document.getElementById("debug-polygon");
460
+ el == null ? void 0 : el.remove();
461
+ };
213
462
  export {
214
- Rect,
463
+ alignRect,
215
464
  closest,
465
+ closestSideToPoint,
466
+ closestSideToRect,
467
+ collisions,
468
+ contains,
469
+ containsPoint,
470
+ containsRect,
471
+ createRect,
216
472
  debugPolygon,
217
473
  distance,
474
+ distanceBtwEdges,
475
+ distanceFromPoint,
476
+ distanceFromRect,
218
477
  expand,
478
+ fromRange,
479
+ getElementPolygon,
219
480
  getElementRect,
220
- getEventPoint,
481
+ getRectCenters,
482
+ getRectCorners,
483
+ getRectEdges,
484
+ getRectFromPoints,
485
+ getRotationRect,
486
+ getViewportRect,
487
+ getWindowRect,
221
488
  inset,
489
+ intersection,
490
+ intersects,
491
+ isPointInPolygon,
492
+ isRect,
222
493
  isSymmetric,
223
- relativeToNode,
494
+ rotate,
224
495
  shift,
225
496
  shrink,
226
- withinPolygon
497
+ toRad,
498
+ union
227
499
  };
228
- //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,14 @@
1
+ import { Rect } from "./rect";
2
+ import type { RectSide } from "./types";
3
+ /**
4
+ * Checks if a Rect intersects another Rect
5
+ */
6
+ export declare function intersects(a: Rect, b: Rect): boolean;
7
+ /**
8
+ * Returns a new Rect that represents the intersection between two Rects
9
+ */
10
+ export declare function intersection(a: Rect, b: Rect): Rect;
11
+ /**
12
+ * Returns whether two rects collide along each edge
13
+ */
14
+ export declare function collisions(a: Rect, b: Rect): Record<RectSide, boolean>;
@@ -5,4 +5,3 @@ export declare function inset(r: Rect, i: RectInset | SymmetricRectInset): Rect;
5
5
  export declare function expand(r: Rect, v: number | SymmetricRectInset): Rect;
6
6
  export declare function shrink(r: Rect, v: number | SymmetricRectInset): Rect;
7
7
  export declare function shift(r: Rect, o: Partial<Point>): Rect;
8
- //# sourceMappingURL=operations.d.ts.map
package/dist/polygon.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- import { Point } from "./types";
2
- export declare function withinPolygon(polygon: Point[], point: Point): boolean;
1
+ import type { Point } from "./types";
2
+ export declare function isPointInPolygon(polygon: Point[], point: Point): boolean;
3
3
  export declare function debugPolygon(polygon: Point[]): void;
4
- //# sourceMappingURL=polygon.d.ts.map
4
+ export declare namespace debugPolygon {
5
+ var remove: () => void;
6
+ }
package/dist/rect.d.ts CHANGED
@@ -1,65 +1,61 @@
1
- import { RectEdge, RectValue } from "./types";
2
- export declare class Rect {
3
- private v;
4
- static create(v: RectValue): Rect;
5
- protected constructor(v: RectValue);
6
- set(n: Partial<RectValue>): Rect;
7
- clone(): Rect;
8
- get x(): number;
9
- get y(): number;
10
- get width(): number;
11
- get height(): number;
12
- get minX(): number;
13
- get midX(): number;
14
- get maxX(): number;
15
- get minY(): number;
16
- get midY(): number;
17
- get maxY(): number;
18
- get center(): {
1
+ import type { RectEdge, RectValue } from "./types";
2
+ export declare function createRect(r: RectValue): {
3
+ x: number;
4
+ y: number;
5
+ width: number;
6
+ height: number;
7
+ minX: number;
8
+ minY: number;
9
+ maxX: number;
10
+ maxY: number;
11
+ midX: number;
12
+ midY: number;
13
+ center: {
19
14
  x: number;
20
15
  y: number;
21
16
  };
22
- get centers(): {
23
- top: {
24
- x: number;
25
- y: number;
26
- };
27
- right: {
28
- x: number;
29
- y: number;
30
- };
31
- bottom: {
32
- x: number;
33
- y: number;
34
- };
35
- left: {
36
- x: number;
37
- y: number;
38
- };
17
+ };
18
+ export declare type Rect = ReturnType<typeof createRect>;
19
+ export declare function isRect(v: any): v is Rect;
20
+ export declare function getRectCenters(v: Rect): {
21
+ top: {
22
+ x: number;
23
+ y: number;
39
24
  };
40
- get corners(): {
41
- top: {
42
- x: number;
43
- y: number;
44
- };
45
- right: {
46
- x: number;
47
- y: number;
48
- };
49
- bottom: {
50
- x: number;
51
- y: number;
52
- };
53
- left: {
54
- x: number;
55
- y: number;
56
- };
25
+ right: {
26
+ x: number;
27
+ y: number;
57
28
  };
58
- get edges(): {
59
- top: RectEdge;
60
- right: RectEdge;
61
- bottom: RectEdge;
62
- left: RectEdge;
29
+ bottom: {
30
+ x: number;
31
+ y: number;
32
+ };
33
+ left: {
34
+ x: number;
35
+ y: number;
36
+ };
37
+ };
38
+ export declare function getRectCorners(v: Rect): {
39
+ top: {
40
+ x: number;
41
+ y: number;
42
+ };
43
+ right: {
44
+ x: number;
45
+ y: number;
46
+ };
47
+ bottom: {
48
+ x: number;
49
+ y: number;
50
+ };
51
+ left: {
52
+ x: number;
53
+ y: number;
63
54
  };
64
- }
65
- //# sourceMappingURL=rect.d.ts.map
55
+ };
56
+ export declare function getRectEdges(v: Rect): {
57
+ top: RectEdge;
58
+ right: RectEdge;
59
+ bottom: RectEdge;
60
+ left: RectEdge;
61
+ };
package/dist/types.d.ts CHANGED
@@ -28,4 +28,3 @@ export declare type SymmetricRectInset = {
28
28
  dx?: number;
29
29
  dy?: number;
30
30
  };
31
- //# sourceMappingURL=types.d.ts.map