@zag-js/rect-utils 0.1.2 → 0.1.5

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,233 @@
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
+ // src/align.ts
2
+ function hAlign(a, ref, h) {
3
+ let x = ref.minX;
4
+ if (h === "left-inside") {
5
+ x = ref.minX;
9
6
  }
10
- set(n) {
11
- return new Rect(Object.assign({}, this.v, n));
7
+ if (h === "left-outside") {
8
+ x = ref.minX - ref.width;
12
9
  }
13
- clone() {
14
- return new Rect(this.v);
10
+ if (h === "right-inside") {
11
+ x = ref.maxX - ref.width;
15
12
  }
16
- get x() {
17
- return this.v.x;
13
+ if (h === "right-outside") {
14
+ x = ref.maxX;
18
15
  }
19
- get y() {
20
- return this.v.y;
16
+ if (h === "center") {
17
+ x = ref.midX - ref.width / 2;
21
18
  }
22
- get width() {
23
- return this.v.width;
19
+ return { ...a, x };
20
+ }
21
+ function vAlign(a, ref, v) {
22
+ let y = ref.minY;
23
+ if (v === "top-inside") {
24
+ y = ref.minY;
24
25
  }
25
- get height() {
26
- return this.v.height;
26
+ if (v === "top-outside") {
27
+ y = ref.minY - a.height;
27
28
  }
28
- get minX() {
29
- return this.v.x;
29
+ if (v === "bottom-inside") {
30
+ y = ref.maxY - a.height;
30
31
  }
31
- get midX() {
32
- return this.v.x + this.v.width / 2;
32
+ if (v === "bottom-outside") {
33
+ y = ref.maxY;
33
34
  }
34
- get maxX() {
35
- return this.v.x + this.v.width;
35
+ if (v === "center") {
36
+ y = ref.midY - a.height / 2;
36
37
  }
37
- get minY() {
38
- return this.v.y;
38
+ return { ...a, y };
39
+ }
40
+ function alignRect(a, ref, options) {
41
+ const { h, v } = options;
42
+ return vAlign(hAlign(a, ref, h), ref, v);
43
+ }
44
+
45
+ // ../core/dist/index.mjs
46
+ var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
47
+
48
+ // src/rect.ts
49
+ var point = (x, y) => ({ x, y });
50
+ function createRect(r) {
51
+ const { x, y, width, height } = r;
52
+ const midX = x + width / 2;
53
+ const midY = y + height / 2;
54
+ return {
55
+ x,
56
+ y,
57
+ width,
58
+ height,
59
+ minX: x,
60
+ minY: y,
61
+ maxX: x + width,
62
+ maxY: y + height,
63
+ midX,
64
+ midY,
65
+ center: point(midX, midY)
66
+ };
67
+ }
68
+ function isRect(v) {
69
+ return hasProp(v, "x") && hasProp(v, "y") && hasProp(v, "width") && hasProp(v, "height");
70
+ }
71
+ function getRectCenters(v) {
72
+ const top = point(v.midX, v.minY);
73
+ const right = point(v.maxX, v.midY);
74
+ const bottom = point(v.midX, v.maxY);
75
+ const left = point(v.minX, v.midY);
76
+ return { top, right, bottom, left };
77
+ }
78
+ function getRectCorners(v) {
79
+ const top = point(v.minX, v.minY);
80
+ const right = point(v.maxX, v.minY);
81
+ const bottom = point(v.maxX, v.maxY);
82
+ const left = point(v.minX, v.maxY);
83
+ return { top, right, bottom, left };
84
+ }
85
+ function getRectEdges(v) {
86
+ const c = getRectCorners(v);
87
+ const top = [c.top, c.right];
88
+ const right = [c.right, c.bottom];
89
+ const bottom = [c.left, c.bottom];
90
+ const left = [c.top, c.left];
91
+ return { top, right, bottom, left };
92
+ }
93
+
94
+ // src/intersection.ts
95
+ function intersects(a, b) {
96
+ return a.x < b.maxX && a.y < b.maxY && a.maxX > b.x && a.maxY > b.y;
97
+ }
98
+ function intersection(a, b) {
99
+ const x = Math.max(a.x, b.x);
100
+ const y = Math.max(a.y, b.y);
101
+ const x2 = Math.min(a.x + a.width, b.x + b.width);
102
+ const y2 = Math.min(a.y + a.height, b.y + b.height);
103
+ return createRect({ x, y, width: x2 - x, height: y2 - y });
104
+ }
105
+ function collisions(a, b) {
106
+ return {
107
+ top: a.minY <= b.minY,
108
+ right: a.maxX >= b.maxX,
109
+ bottom: a.maxY >= b.maxY,
110
+ left: a.minX <= b.minX
111
+ };
112
+ }
113
+
114
+ // src/distance.ts
115
+ function distance(a, b = { x: 0, y: 0 }) {
116
+ return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
117
+ }
118
+ function distanceFromPoint(r, p) {
119
+ let x = 0;
120
+ let y = 0;
121
+ if (p.x < r.x)
122
+ x = r.x - p.x;
123
+ else if (p.x > r.maxX)
124
+ x = p.x - r.maxX;
125
+ if (p.y < r.y)
126
+ y = r.y - p.y;
127
+ else if (p.y > r.maxY)
128
+ y = p.y - r.maxY;
129
+ return { x, y, value: distance({ x, y }) };
130
+ }
131
+ function distanceFromRect(a, b) {
132
+ if (intersects(a, b))
133
+ return { x: 0, y: 0, value: 0 };
134
+ const left = a.x < b.x ? a : b;
135
+ const right = b.x < a.x ? a : b;
136
+ const upper = a.y < b.y ? a : b;
137
+ const lower = b.y < a.y ? a : b;
138
+ let x = left.x === right.x ? 0 : right.x - left.maxX;
139
+ x = Math.max(0, x);
140
+ let y = upper.y === lower.y ? 0 : lower.y - upper.maxY;
141
+ y = Math.max(0, y);
142
+ return { x, y, value: distance({ x, y }) };
143
+ }
144
+ function distanceBtwEdges(a, b) {
145
+ return {
146
+ left: b.x - a.x,
147
+ top: b.y - a.y,
148
+ right: a.maxX - b.maxX,
149
+ bottom: a.maxY - b.maxY
150
+ };
151
+ }
152
+
153
+ // src/closest.ts
154
+ function closest(...pts) {
155
+ return (a) => {
156
+ const ds = pts.map((b) => distance(b, a));
157
+ const c = Math.min.apply(Math, ds);
158
+ return pts[ds.indexOf(c)];
159
+ };
160
+ }
161
+ function closestSideToRect(ref, r) {
162
+ if (r.maxX <= ref.minX) {
163
+ return "left";
39
164
  }
40
- get midY() {
41
- return this.v.y + this.v.height / 2;
165
+ if (r.minX >= ref.maxX) {
166
+ return "right";
42
167
  }
43
- get maxY() {
44
- return this.v.y + this.v.height;
168
+ if (r.maxY <= ref.minY) {
169
+ return "top";
45
170
  }
46
- get center() {
47
- return point(this.midX, this.midY);
171
+ if (r.minY >= ref.maxY) {
172
+ return "bottom";
48
173
  }
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 };
174
+ return "left";
175
+ }
176
+ function closestSideToPoint(ref, p) {
177
+ const { x, y } = p;
178
+ const dl = x - ref.minX;
179
+ const dr = ref.maxX - x;
180
+ const dt = y - ref.minY;
181
+ const db = ref.maxY - y;
182
+ let closest2 = dl;
183
+ let side = "left";
184
+ if (dr < closest2) {
185
+ closest2 = dr;
186
+ side = "right";
55
187
  }
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 };
188
+ if (dt < closest2) {
189
+ closest2 = dt;
190
+ side = "top";
62
191
  }
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 };
192
+ if (db < closest2) {
193
+ side = "bottom";
70
194
  }
71
- };
195
+ return side;
196
+ }
197
+
198
+ // src/contains.ts
199
+ function containsPoint(r, p) {
200
+ return r.minX <= p.x && p.x <= r.maxX && r.minY <= p.y && p.y <= r.maxY;
201
+ }
202
+ function containsRect(a, b) {
203
+ return Object.values(getRectCorners(b)).every((c) => containsPoint(a, c));
204
+ }
205
+ function contains(r, v) {
206
+ return isRect(v) ? containsRect(r, v) : containsPoint(r, v);
207
+ }
72
208
 
73
- // src/computed-style.ts
74
- var styleCache = /* @__PURE__ */ new WeakMap();
209
+ // ../dom/dist/index.mjs
210
+ function getCache() {
211
+ const g = globalThis;
212
+ g.__styleCache = g.__styleCache || /* @__PURE__ */ new WeakMap();
213
+ return g.__styleCache;
214
+ }
75
215
  function getComputedStyle(el) {
76
- var _a;
77
216
  if (!el)
78
217
  return {};
79
- let style = styleCache.get(el);
218
+ const cache = getCache();
219
+ let style = cache.get(el);
80
220
  if (!style) {
81
- const win = (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
221
+ const win = (el == null ? void 0 : el.ownerDocument.defaultView) ?? window;
82
222
  style = win.getComputedStyle(el);
83
- styleCache.set(el, style);
223
+ cache.set(el, style);
84
224
  }
85
225
  return style;
86
226
  }
87
227
 
88
228
  // src/from-element.ts
89
229
  function getElementRect(el, opts = {}) {
90
- return Rect.create(getClientRect(el, opts));
230
+ return createRect(getClientRect(el, opts));
91
231
  }
92
232
  function getClientRect(el, opts = {}) {
93
233
  const { excludeScrollbar = false, excludeBorders = false } = opts;
@@ -114,45 +254,124 @@ function getClientRect(el, opts = {}) {
114
254
  var px = (v) => parseFloat(v.replace("px", ""));
115
255
  var sum = (...vals) => vals.reduce((sum2, v) => sum2 + (v ? px(v) : 0), 0);
116
256
 
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));
257
+ // src/from-points.ts
258
+ function getRectFromPoints(...pts) {
259
+ const xs = pts.map((p) => p.x);
260
+ const ys = pts.map((p) => p.y);
261
+ const x = Math.min(...xs);
262
+ const y = Math.min(...ys);
263
+ const width = Math.max(...xs) - x;
264
+ const height = Math.max(...ys) - y;
265
+ return createRect({ x, y, width, height });
128
266
  }
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)];
267
+
268
+ // src/union.ts
269
+ var { min, max } = Math;
270
+ function union(...rs) {
271
+ const pMin = {
272
+ x: min.apply(Math, rs.map((r) => r.minX)),
273
+ y: min.apply(Math, rs.map((r) => r.minY))
134
274
  };
275
+ const pMax = {
276
+ x: max.apply(Math, rs.map((r) => r.maxX)),
277
+ y: max.apply(Math, rs.map((r) => r.maxY))
278
+ };
279
+ return getRectFromPoints(pMin, pMax);
280
+ }
281
+
282
+ // src/from-range.ts
283
+ function fromRange(range) {
284
+ let rs = [];
285
+ const rects = Array.from(range.getClientRects());
286
+ if (rects.length) {
287
+ rs = rs.concat(rects.map(createRect));
288
+ return union.apply(void 0, rs);
289
+ }
290
+ let start = range.startContainer;
291
+ if (start.nodeType === Node.TEXT_NODE) {
292
+ start = start.parentNode;
293
+ }
294
+ if (start instanceof HTMLElement) {
295
+ const r = getElementRect(start);
296
+ rs.push({ ...r, x: r.maxX, width: 0 });
297
+ }
298
+ return union.apply(void 0, rs);
135
299
  }
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`] };
300
+
301
+ // src/from-rotation.ts
302
+ function toRad(d) {
303
+ return d % 360 * Math.PI / 180;
140
304
  }
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;
305
+ function rotate(a, d, c) {
306
+ const r = toRad(d);
307
+ const sin = Math.sin(r);
308
+ const cos = Math.cos(r);
309
+ const x = a.x - c.x;
310
+ const y = a.y - c.y;
144
311
  return {
145
- point: { x: dx, y: dy },
146
- progress: { x: dx / el.offsetWidth, y: dy / el.offsetHeight }
312
+ x: c.x + x * cos - y * sin,
313
+ y: c.y + x * sin + y * cos
147
314
  };
148
315
  }
316
+ function getRotationRect(r, deg) {
317
+ const rr = Object.values(getRectCorners(r)).map((p) => rotate(p, deg, r.center));
318
+ const xs = rr.map((p) => p.x);
319
+ const ys = rr.map((p) => p.y);
320
+ const minX = Math.min(...xs);
321
+ const minY = Math.min(...ys);
322
+ const maxX = Math.max(...xs);
323
+ const maxY = Math.max(...ys);
324
+ return createRect({
325
+ x: minX,
326
+ y: minY,
327
+ width: maxX - minX,
328
+ height: maxY - minY
329
+ });
330
+ }
331
+
332
+ // src/from-window.ts
333
+ function getWindowRect(win, opts = {}) {
334
+ return createRect(getViewportRect(win, opts));
335
+ }
336
+ function getViewportRect(win, opts) {
337
+ const { excludeScrollbar = false } = opts;
338
+ const { innerWidth: innerWidth2, innerHeight: innerHeight2, document: doc, visualViewport } = win;
339
+ const width = visualViewport.width || innerWidth2;
340
+ const height = visualViewport.height || innerHeight2;
341
+ const rect = { x: 0, y: 0, width, height };
342
+ if (excludeScrollbar) {
343
+ const scrollbarWidth = innerWidth2 - doc.documentElement.clientWidth;
344
+ const scrollbarHeight = innerHeight2 - doc.documentElement.clientHeight;
345
+ rect.width -= scrollbarWidth;
346
+ rect.height -= scrollbarHeight;
347
+ }
348
+ return rect;
349
+ }
350
+
351
+ // src/get-polygon.ts
352
+ function getElementPolygon(rectValue, placement) {
353
+ const rect = createRect(rectValue);
354
+ const { top, right, left, bottom } = getRectCorners(rect);
355
+ const [base] = placement.split("-");
356
+ return {
357
+ top: [left, top, right, bottom],
358
+ right: [top, right, bottom, left],
359
+ bottom: [top, left, bottom, right],
360
+ left: [right, top, left, bottom]
361
+ }[base];
362
+ }
149
363
 
150
364
  // src/operations.ts
151
365
  var isSymmetric = (v) => "dx" in v || "dy" in v;
152
366
  function inset(r, i) {
153
367
  const v = isSymmetric(i) ? { left: i.dx, right: i.dx, top: i.dy, bottom: i.dy } : i;
154
368
  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 });
369
+ return createRect({
370
+ x: r.x + left,
371
+ y: r.y + top,
372
+ width: r.width - left - right,
373
+ height: r.height - top - bottom
374
+ });
156
375
  }
157
376
  function expand(r, v) {
158
377
  const value = typeof v === "number" ? { dx: -v, dy: -v } : v;
@@ -164,11 +383,16 @@ function shrink(r, v) {
164
383
  }
165
384
  function shift(r, o) {
166
385
  const { x = 0, y = 0 } = o;
167
- return Rect.create({ x: r.x + x, y: r.y + y, width: r.width, height: r.height });
386
+ return createRect({
387
+ x: r.x + x,
388
+ y: r.y + y,
389
+ width: r.width,
390
+ height: r.height
391
+ });
168
392
  }
169
393
 
170
394
  // src/polygon.ts
171
- function withinPolygon(polygon, point2) {
395
+ function isPointInPolygon(polygon, point2) {
172
396
  const { x, y } = point2;
173
397
  let c = false;
174
398
  for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
@@ -196,7 +420,8 @@ function createPolygonElement() {
196
420
  height: "100%",
197
421
  opacity: "0.15",
198
422
  position: "fixed",
199
- pointerEvents: "none"
423
+ pointerEvents: "none",
424
+ fill: "red"
200
425
  });
201
426
  const polygon = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
202
427
  polygon.setAttribute("id", id);
@@ -209,20 +434,45 @@ function debugPolygon(polygon) {
209
434
  const el = createPolygonElement();
210
435
  const points = polygon.map((point2) => `${point2.x},${point2.y}`).join(" ");
211
436
  el.setAttribute("points", points);
437
+ return () => {
438
+ el.remove();
439
+ };
212
440
  }
213
441
  export {
214
- Rect,
442
+ alignRect,
215
443
  closest,
444
+ closestSideToPoint,
445
+ closestSideToRect,
446
+ collisions,
447
+ contains,
448
+ containsPoint,
449
+ containsRect,
450
+ createRect,
216
451
  debugPolygon,
217
452
  distance,
453
+ distanceBtwEdges,
454
+ distanceFromPoint,
455
+ distanceFromRect,
218
456
  expand,
457
+ fromRange,
458
+ getElementPolygon,
219
459
  getElementRect,
220
- getEventPoint,
460
+ getRectCenters,
461
+ getRectCorners,
462
+ getRectEdges,
463
+ getRectFromPoints,
464
+ getRotationRect,
465
+ getViewportRect,
466
+ getWindowRect,
221
467
  inset,
468
+ intersection,
469
+ intersects,
470
+ isPointInPolygon,
471
+ isRect,
222
472
  isSymmetric,
223
- relativeToNode,
473
+ rotate,
224
474
  shift,
225
475
  shrink,
226
- withinPolygon
476
+ toRad,
477
+ union
227
478
  };
228
- //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/rect-utils",
3
- "version": "0.1.2",
3
+ "version": "0.1.5",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "js",
@@ -24,16 +24,18 @@
24
24
  "bugs": {
25
25
  "url": "https://github.com/chakra-ui/zag/issues"
26
26
  },
27
- "dependencies": {
28
- "@zag-js/utils": "0.1.2"
27
+ "devDependencies": {
28
+ "@zag-js/dom-utils": "0.1.8",
29
+ "@zag-js/utils": "0.1.3"
29
30
  },
30
31
  "scripts": {
31
- "build:fast": "zag build",
32
- "start": "zag build --watch",
33
- "build": "zag build --prod",
32
+ "build-fast": "tsup src/index.ts --format=esm,cjs",
33
+ "start": "pnpm build --watch",
34
+ "build": "tsup src/index.ts --format=esm,cjs --dts",
34
35
  "test": "jest --config ../../../jest.config.js --rootDir . --passWithNoTests",
35
36
  "lint": "eslint src --ext .ts,.tsx",
36
- "test:ci": "yarn test --ci --runInBand",
37
- "test:watch": "yarn test --watch --updateSnapshot"
37
+ "test-ci": "pnpm test --ci --runInBand",
38
+ "test-watch": "pnpm test --watch -u",
39
+ "typecheck": "tsc --noEmit"
38
40
  }
39
- }
41
+ }
@@ -1,6 +0,0 @@
1
- declare type Key = keyof CSSStyleDeclaration | (string & {});
2
- declare type Styles = Record<Key, any>;
3
- declare type El = HTMLElement | null | undefined;
4
- export declare function getComputedStyle(el: El): Styles;
5
- export {};
6
- //# sourceMappingURL=computed-style.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"computed-style.d.ts","sourceRoot":"","sources":["../src/computed-style.ts"],"names":[],"mappings":"AAAA,aAAK,GAAG,GAAG,MAAM,mBAAmB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AACpD,aAAK,MAAM,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAC9B,aAAK,EAAE,GAAG,WAAW,GAAG,IAAI,GAAG,SAAS,CAAA;AAIxC,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,EAAE,GAAG,MAAM,CAS/C"}
@@ -1,13 +0,0 @@
1
- import { Rect } from "./rect";
2
- export declare function getElementRect(el: HTMLElement, opts?: ElementRectOptions): Rect;
3
- export declare type ElementRectOptions = {
4
- /**
5
- * Whether to exclude the element's scrollbar size from the calculation.
6
- */
7
- excludeScrollbar?: boolean;
8
- /**
9
- * Whether to exclude the element's borders from the calculation.
10
- */
11
- excludeBorders?: boolean;
12
- };
13
- //# sourceMappingURL=from-element.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"from-element.d.ts","sourceRoot":"","sources":["../src/from-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAG7B,wBAAgB,cAAc,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,GAAE,kBAAuB,GAAG,IAAI,CAEnF;AAED,oBAAY,kBAAkB,GAAG;IAC/B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA"}
package/dist/index.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/index.ts", "../src/rect.ts", "../src/computed-style.ts", "../src/from-element.ts", "../../core/src/array.ts", "../../core/src/guard.ts", "../../core/src/platform.ts", "../../core/src/events.ts", "../../core/src/functions.ts", "../../core/src/warning.ts", "../src/point.ts", "../src/operations.ts", "../src/polygon.ts"],
4
- "sourcesContent": ["export * from \"./rect\"\nexport * from \"./types\"\nexport * from \"./from-element\"\nexport * from \"./point\"\nexport * from \"./operations\"\nexport * from \"./polygon\"\n", "import { RectEdge, RectValue } from \"./types\"\n\nconst point = (x: number, y: number) => ({ x, y })\n\nexport class Rect {\n static create(v: RectValue) {\n return new Rect(v)\n }\n protected constructor(private v: RectValue) {}\n set(n: Partial<RectValue>) {\n return new Rect(Object.assign({}, this.v, n))\n }\n clone() {\n return new Rect(this.v)\n }\n get x() {\n return this.v.x\n }\n get y() {\n return this.v.y\n }\n get width() {\n return this.v.width\n }\n get height() {\n return this.v.height\n }\n get minX() {\n return this.v.x\n }\n get midX() {\n return this.v.x + this.v.width / 2\n }\n get maxX() {\n return this.v.x + this.v.width\n }\n get minY() {\n return this.v.y\n }\n get midY() {\n return this.v.y + this.v.height / 2\n }\n get maxY() {\n return this.v.y + this.v.height\n }\n get center() {\n return point(this.midX, this.midY)\n }\n get centers() {\n const top = point(this.midX, this.minY)\n const right = point(this.maxX, this.midY)\n const bottom = point(this.midX, this.maxY)\n const left = point(this.minX, this.midY)\n return { top, right, bottom, left }\n }\n get corners() {\n const top = point(this.minX, this.minY)\n const right = point(this.maxX, this.minY)\n const bottom = point(this.maxX, this.maxY)\n const left = point(this.minX, this.maxY)\n return { top, right, bottom, left }\n }\n\n get edges() {\n const c = this.corners\n const top: RectEdge = [c.top, c.right]\n const right: RectEdge = [c.right, c.bottom]\n const bottom: RectEdge = [c.left, c.bottom]\n const left: RectEdge = [c.top, c.left]\n return { top, right, bottom, left }\n }\n}\n", "type Key = keyof CSSStyleDeclaration | (string & {})\ntype Styles = Record<Key, any>\ntype El = HTMLElement | null | undefined\n\nconst styleCache: WeakMap<HTMLElement, Styles> = new WeakMap()\n\nexport function getComputedStyle(el: El): Styles {\n if (!el) return {} as Styles\n let style: Styles | undefined = styleCache.get(el)\n if (!style) {\n const win = el?.ownerDocument.defaultView ?? window\n style = win.getComputedStyle(el) as Styles\n styleCache.set(el, style)\n }\n return style\n}\n", "import { Rect } from \"./rect\"\nimport { getComputedStyle } from \"./computed-style\"\n\nexport function getElementRect(el: HTMLElement, opts: ElementRectOptions = {}): Rect {\n return Rect.create(getClientRect(el, opts))\n}\n\nexport type ElementRectOptions = {\n /**\n * Whether to exclude the element's scrollbar size from the calculation.\n */\n excludeScrollbar?: boolean\n /**\n * Whether to exclude the element's borders from the calculation.\n */\n excludeBorders?: boolean\n}\n\nfunction getClientRect(el: HTMLElement, opts: ElementRectOptions = {}) {\n const { excludeScrollbar = false, excludeBorders = false } = opts\n\n const { x, y, width, height } = el.getBoundingClientRect()\n const r = { x, y, width, height }\n\n const style = getComputedStyle(el)\n\n const { borderLeftWidth, borderTopWidth, borderRightWidth, borderBottomWidth } = style\n\n const borderXWidth = sum(borderLeftWidth, borderRightWidth)\n const borderYWidth = sum(borderTopWidth, borderBottomWidth)\n\n if (excludeBorders) {\n r.width -= borderXWidth\n r.height -= borderYWidth\n r.x += px(borderLeftWidth)\n r.y += px(borderTopWidth)\n }\n\n if (excludeScrollbar) {\n const scrollbarWidth = el.offsetWidth - el.clientWidth - borderXWidth\n const scrollbarHeight = el.offsetHeight - el.clientHeight - borderYWidth\n r.width -= scrollbarWidth\n r.height -= scrollbarHeight\n }\n\n return r\n}\n\nconst px = (v: string) => parseFloat(v.replace(\"px\", \"\"))\n\nconst sum = (...vals: string[]) => vals.reduce((sum, v) => sum + (v ? px(v) : 0), 0)\n", "export function toArray<T>(v: T | T[] | undefined | null): T[] {\n if (!v) return []\n return Array.isArray(v) ? v : [v]\n}\n\nexport const fromLength = (length: number) => Array.from(Array(length).keys())\n\nexport const first = <T>(v: T[]): T | undefined => v[0]\n\nexport const last = <T>(v: T[]): T | undefined => v[v.length - 1]\n\nexport const isEmpty = <T>(v: T[]): boolean => v.length === 0\n\nexport const has = <T>(v: T[], t: any): boolean => v.indexOf(t) !== -1\n\nexport const add = <T>(v: T[], ...items: T[]): T[] => v.concat(items)\n\nexport const remove = <T>(v: T[], item: T): T[] => removeAt(v, v.indexOf(item))\n\nexport const removeAt = <T>(v: T[], i: number): T[] => {\n if (i > -1) v.splice(i, 1)\n return v\n}\n\nexport function clear<T>(v: T[]): T[] {\n while (v.length > 0) v.pop()\n return v\n}\n\nexport type IndexOptions = {\n step?: number\n loop?: boolean\n}\n\nexport function nextIndex<T>(v: T[], idx: number, opts: IndexOptions = {}): number {\n const { step = 1, loop = true } = opts\n const next = idx + step\n const len = v.length\n const last = len - 1\n if (idx === -1) return step > 0 ? 0 : last\n if (next < 0) return loop ? last : 0\n if (next >= len) return loop ? 0 : idx > len ? len : idx\n return next\n}\n\nexport function next<T>(v: T[], idx: number, opts: IndexOptions = {}): T | undefined {\n return v[nextIndex(v, idx, opts)]\n}\n\nexport function prevIndex<T>(v: T[], idx: number, opts: IndexOptions = {}): number {\n const { step = 1, loop = true } = opts\n return nextIndex(v, idx, { step: -step, loop })\n}\n\nexport function prev<T>(v: T[], index: number, opts: IndexOptions = {}): T | undefined {\n return v[prevIndex(v, index, opts)]\n}\n\nexport const chunk = <T>(v: T[], size: number): T[][] => {\n const res: T[][] = []\n return v.reduce((rows, value, index) => {\n if (index % size === 0) rows.push([value])\n else last(rows)?.push(value)\n return rows\n }, res)\n}\n", "export const isDev = () => process.env.NODE_ENV !== \"production\"\nexport const isDom = () => typeof window !== \"undefined\"\n\nexport const isArray = (v: any): v is any[] => Array.isArray(v)\nexport const isBoolean = (v: any): v is boolean => v === true || v === false\nexport const isObject = (v: any): v is Record<string, any> => !(v == null || typeof v !== \"object\" || isArray(v))\nexport const isNumber = (v: any): v is number => typeof v === \"number\" && !Number.isNaN(v)\nexport const isString = (v: any): v is string => typeof v === \"string\"\nexport const isFunction = (v: any): v is Function => typeof v === \"function\"\n\nexport const hasProp = <T extends string>(obj: any, prop: T): obj is Record<T, any> =>\n Object.prototype.hasOwnProperty.call(obj, prop)\n", "import { isDom } from \"./guard\"\n\nexport function getPlatform() {\n const agent = (navigator as any).userAgentData\n return agent?.platform ?? navigator.platform\n}\n\nconst pt = (v: RegExp) => isDom() && v.test(getPlatform())\nconst ua = (v: RegExp) => isDom() && v.test(navigator.userAgent)\nconst vn = (v: RegExp) => isDom() && v.test(navigator.vendor)\n\nexport const isTouchDevice = isDom() && !!navigator.maxTouchPoints\nexport const isMac = () => pt(/^Mac/) && !isTouchDevice\nexport const isIPhone = () => pt(/^iPhone/)\nexport const isSafari = () => isApple() && vn(/apple/i)\nexport const isFirefox = () => ua(/firefox\\//i)\nexport const isApple = () => pt(/mac|iphone|ipad|ipod/i)\nexport const isIos = () => isApple() && !isMac()\n", "import { hasProp, isDom, isObject } from \"./guard\"\nimport { isMac } from \"./platform\"\n\nexport const supportsPointerEvent = () => isDom() && window.onpointerdown === null\nexport const supportsTouchEvent = () => isDom() && window.ontouchstart === null\nexport const supportsMouseEvent = () => isDom() && window.onmousedown === null\n\nexport const isMouseEvent = (v: any): v is MouseEvent => isObject(v) && hasProp(v, \"button\")\nexport const isTouchEvent = (v: any): v is TouchEvent => isObject(v) && hasProp(v, \"touches\")\nexport const isLeftClick = (v: { button: number }) => v.button === 0\nexport const isRightClick = (v: { button: number }) => v.button === 2\nexport const isModifiedEvent = (v: Pick<KeyboardEvent, \"ctrlKey\" | \"metaKey\" | \"altKey\">) =>\n v.ctrlKey || v.altKey || v.metaKey\n\nexport const isCtrlKey = (v: Pick<KeyboardEvent, \"ctrlKey\" | \"metaKey\">) =>\n isMac() ? v.metaKey && !v.ctrlKey : v.ctrlKey && !v.metaKey\n", "export const runIfFn = <T>(\n v: T | undefined,\n ...a: T extends (...a: any[]) => void ? Parameters<T> : never\n): T extends (...a: any[]) => void ? NonNullable<ReturnType<T>> : NonNullable<T> => {\n const res = typeof v === \"function\" ? v(...a) : v\n return res ?? undefined\n}\n\nexport const cast = <T>(v: unknown): T => v as T\n\nexport const noop = () => {}\n\nexport const pipe =\n <T>(...fns: Array<(a: T) => T>) =>\n (v: T) =>\n fns.reduce((a, b) => b(a), v)\n\nexport const callAll =\n <T extends (...a: any[]) => void>(...fns: (T | undefined)[]) =>\n (...a: Parameters<T>) => {\n fns.forEach(function (fn) {\n fn?.(...a)\n })\n }\n\nexport const uuid = /*#__PURE__*/ (() => {\n let id = 0\n return () => {\n id++\n return id.toString(36)\n }\n})()\n\nexport function merge<T, U>(origin: T, patch: U): T & U {\n if (!(typeof patch === \"object\")) return patch as any\n const result = !(typeof origin === \"object\") ? {} : Object.assign({}, origin)\n for (const key of Object.keys(patch)) {\n const value = patch[key]\n const src = result[key]\n if (value === null) delete result[key]\n else if (Array.isArray(value) || Array.isArray(src)) result[key] = (src || []).concat(value || [])\n else result[key] = merge(src, value)\n }\n return result as any\n}\n", "export function warn(m: string): void\nexport function warn(c: boolean, m: string): void\nexport function warn(...a: any[]): void {\n const m = a.length === 1 ? a[0] : a[1]\n const c = a.length === 2 ? a[0] : true\n if (c && process.env.NODE_ENV !== \"production\") {\n console.warn(m)\n }\n}\n\nexport function invariant(m: string): void\nexport function invariant(c: boolean, m: string): void\nexport function invariant(...a: any[]): void {\n const m = a.length === 1 ? a[0] : a[1]\n const c = a.length === 2 ? a[0] : true\n if (c && process.env.NODE_ENV !== \"production\") {\n throw new Error(m)\n }\n}\n", "import { isTouchEvent } from \"@zag-js/utils\"\nimport { Point } from \"./types\"\n\nexport function distance(a: Point, b: Point = { x: 0, y: 0 }): number {\n return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2))\n}\n\nexport function closest(...pts: Point[]) {\n return (a: Point): Point => {\n const ds = pts.map((b) => distance(b, a))\n const c = Math.min.apply(Math, ds)\n return pts[ds.indexOf(c)]\n }\n}\n\nconst fallback = { pageX: 0, pageY: 0, clientX: 0, clientY: 0 }\n\nexport function getEventPoint(e: AnyPointerEvent, t: PointType = \"page\"): Point {\n const p = isTouchEvent(e) ? e.touches[0] || e.changedTouches[0] || fallback : e\n return { x: p[`${t}X`], y: p[`${t}Y`] }\n}\n\nexport function relativeToNode(p: Point, el: HTMLElement): RelativeValue {\n const dx = p.x - el.offsetLeft - el.clientLeft + el.scrollLeft\n const dy = p.y - el.offsetTop - el.clientTop + el.scrollTop\n return {\n point: { x: dx, y: dy },\n progress: { x: dx / el.offsetWidth, y: dy / el.offsetHeight },\n }\n}\n\ntype AnyPointerEvent = MouseEvent | TouchEvent | PointerEvent\n\ntype RelativeValue = {\n point: Point\n progress: { x: number; y: number }\n}\n\ntype PointType = \"page\" | \"client\"\n", "import { Rect } from \"./rect\"\nimport type { Point, RectInset, SymmetricRectInset } from \"./types\"\n\nexport const isSymmetric = (v: any): v is SymmetricRectInset => \"dx\" in v || \"dy\" in v\n\nexport function inset(r: Rect, i: RectInset | SymmetricRectInset): Rect {\n const v = isSymmetric(i) ? { left: i.dx, right: i.dx, top: i.dy, bottom: i.dy } : i\n const { top = 0, right = 0, bottom = 0, left = 0 } = v\n return Rect.create({ x: r.x + left, y: r.y + top, width: r.width - left - right, height: r.height - top - bottom })\n}\n\nexport function expand(r: Rect, v: number | SymmetricRectInset): Rect {\n const value = typeof v === \"number\" ? { dx: -v, dy: -v } : v\n return inset(r, value)\n}\n\nexport function shrink(r: Rect, v: number | SymmetricRectInset): Rect {\n const value = typeof v === \"number\" ? { dx: -v, dy: -v } : v\n return inset(r, value)\n}\n\nexport function shift(r: Rect, o: Partial<Point>): Rect {\n const { x = 0, y = 0 } = o\n return Rect.create({ x: r.x + x, y: r.y + y, width: r.width, height: r.height })\n}\n", "import { Point } from \"./types\"\n\nexport function withinPolygon(polygon: Point[], point: Point) {\n const { x, y } = point\n let c = false\n\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const xi = polygon[i].x\n const yi = polygon[i].y\n const xj = polygon[j].x\n const yj = polygon[j].y\n\n if (yi > y !== yj > y && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi) {\n c = !c\n }\n }\n return c\n}\n\nfunction createPolygonElement() {\n const id = \"debug-polygon\"\n const existingPolygon = document.getElementById(id)\n if (existingPolygon) {\n return existingPolygon\n }\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\")\n Object.assign(svg.style, {\n top: \"0\",\n left: \"0\",\n width: \"100%\",\n height: \"100%\",\n opacity: \"0.15\",\n position: \"fixed\",\n pointerEvents: \"none\",\n })\n\n const polygon = document.createElementNS(\"http://www.w3.org/2000/svg\", \"polygon\")\n polygon.setAttribute(\"id\", id)\n polygon.setAttribute(\"points\", \"0,0 0,0\")\n svg.appendChild(polygon)\n document.body.appendChild(svg)\n return polygon\n}\n\nexport function debugPolygon(polygon: Point[]) {\n const el = createPolygonElement()\n const points = polygon.map((point) => `${point.x},${point.y}`).join(\" \")\n el.setAttribute(\"points\", points)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,IAAM,QAAQ,CAAC,GAAW,MAAe,GAAE,GAAG,EAAE;AAEzC,iBAAW;AAAA,EAIN,YAAoB,GAAc;AAAd;AAAA,EAAe;AAAA,SAHtC,OAAO,GAAc;AAC1B,WAAO,IAAI,KAAK,CAAC;AAAA,EACnB;AAAA,EAEA,IAAI,GAAuB;AACzB,WAAO,IAAI,KAAK,OAAO,OAAO,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;AAAA,EAC9C;AAAA,EACA,QAAQ;AACN,WAAO,IAAI,KAAK,KAAK,CAAC;AAAA,EACxB;AAAA,MACI,IAAI;AACN,WAAO,KAAK,EAAE;AAAA,EAChB;AAAA,MACI,I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