@zag-js/rect-utils 1.47.0 → 1.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/defineProperty.js +11 -0
  2. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/defineProperty.mjs +11 -0
  3. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPrimitive.js +13 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPrimitive.mjs +13 -0
  5. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPropertyKey.js +8 -0
  6. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/toPropertyKey.mjs +8 -0
  7. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/typeof.js +15 -0
  8. package/dist/_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/typeof.mjs +10 -0
  9. package/dist/affine-transform.d.mts +36 -39
  10. package/dist/affine-transform.d.ts +36 -39
  11. package/dist/affine-transform.js +189 -187
  12. package/dist/affine-transform.mjs +185 -164
  13. package/dist/align.d.mts +2 -5
  14. package/dist/align.d.ts +2 -5
  15. package/dist/align.js +27 -44
  16. package/dist/align.mjs +23 -21
  17. package/dist/angle.d.mts +2 -5
  18. package/dist/angle.d.ts +2 -5
  19. package/dist/angle.js +8 -32
  20. package/dist/angle.mjs +4 -9
  21. package/dist/clamp.d.mts +8 -11
  22. package/dist/clamp.d.ts +8 -11
  23. package/dist/clamp.js +23 -46
  24. package/dist/clamp.mjs +18 -22
  25. package/dist/closest.d.mts +4 -7
  26. package/dist/closest.d.ts +4 -7
  27. package/dist/closest.js +35 -62
  28. package/dist/closest.mjs +29 -37
  29. package/dist/compass.d.mts +4 -7
  30. package/dist/compass.d.ts +4 -7
  31. package/dist/compass.js +48 -48
  32. package/dist/compass.mjs +43 -24
  33. package/dist/constrain.d.mts +2 -5
  34. package/dist/constrain.d.ts +2 -5
  35. package/dist/constrain.js +12 -37
  36. package/dist/constrain.mjs +8 -14
  37. package/dist/contains.d.mts +4 -7
  38. package/dist/contains.d.ts +4 -7
  39. package/dist/contains.js +11 -36
  40. package/dist/contains.mjs +5 -11
  41. package/dist/distance.d.mts +7 -10
  42. package/dist/distance.d.ts +7 -10
  43. package/dist/distance.js +55 -60
  44. package/dist/distance.mjs +48 -34
  45. package/dist/equality.d.mts +4 -7
  46. package/dist/equality.d.ts +4 -7
  47. package/dist/equality.js +13 -38
  48. package/dist/equality.mjs +7 -13
  49. package/dist/from-element.d.mts +12 -15
  50. package/dist/from-element.d.ts +12 -15
  51. package/dist/from-element.js +39 -58
  52. package/dist/from-element.mjs +35 -35
  53. package/dist/from-points.d.mts +2 -5
  54. package/dist/from-points.d.ts +2 -5
  55. package/dist/from-points.js +18 -36
  56. package/dist/from-points.mjs +14 -13
  57. package/dist/from-range.d.mts +2 -5
  58. package/dist/from-range.d.ts +2 -5
  59. package/dist/from-range.js +25 -46
  60. package/dist/from-range.mjs +19 -21
  61. package/dist/from-rotation.d.mts +4 -7
  62. package/dist/from-rotation.d.ts +4 -7
  63. package/dist/from-rotation.js +31 -56
  64. package/dist/from-rotation.mjs +25 -31
  65. package/dist/from-window.d.mts +13 -16
  66. package/dist/from-window.d.ts +13 -16
  67. package/dist/from-window.js +29 -44
  68. package/dist/from-window.mjs +24 -20
  69. package/dist/index.d.mts +22 -22
  70. package/dist/index.d.ts +22 -22
  71. package/dist/index.js +72 -63
  72. package/dist/index.mjs +21 -22
  73. package/dist/intersection.d.mts +4 -7
  74. package/dist/intersection.d.ts +4 -7
  75. package/dist/intersection.js +34 -45
  76. package/dist/intersection.mjs +28 -20
  77. package/dist/operations.d.mts +6 -9
  78. package/dist/operations.d.ts +6 -9
  79. package/dist/operations.js +38 -57
  80. package/dist/operations.mjs +30 -30
  81. package/dist/polygon.d.mts +6 -9
  82. package/dist/polygon.d.ts +6 -9
  83. package/dist/polygon.js +73 -82
  84. package/dist/polygon.mjs +67 -57
  85. package/dist/rect.d.mts +49 -52
  86. package/dist/rect.d.ts +49 -52
  87. package/dist/rect.js +57 -82
  88. package/dist/rect.mjs +46 -52
  89. package/dist/resize.d.mts +3 -6
  90. package/dist/resize.d.ts +3 -6
  91. package/dist/resize.js +73 -102
  92. package/dist/resize.mjs +68 -78
  93. package/dist/types.d.mts +45 -49
  94. package/dist/types.d.ts +45 -49
  95. package/dist/types.js +4 -18
  96. package/dist/types.mjs +1 -0
  97. package/dist/union.d.mts +2 -5
  98. package/dist/union.d.ts +2 -5
  99. package/dist/union.js +16 -39
  100. package/dist/union.mjs +12 -16
  101. package/package.json +3 -3
  102. package/dist/chunk-QZ7TP4HQ.mjs +0 -7
@@ -1,166 +1,187 @@
1
- import {
2
- __publicField
3
- } from "./chunk-QZ7TP4HQ.mjs";
4
-
1
+ import _defineProperty from "./_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/defineProperty.mjs";
5
2
  // src/affine-transform.ts
6
- var AffineTransform = class _AffineTransform {
7
- constructor([m00, m01, m02, m10, m11, m12] = [0, 0, 0, 0, 0, 0]) {
8
- __publicField(this, "m00");
9
- __publicField(this, "m01");
10
- __publicField(this, "m02");
11
- __publicField(this, "m10");
12
- __publicField(this, "m11");
13
- __publicField(this, "m12");
14
- __publicField(this, "rotate", (...args) => {
15
- return this.prepend(_AffineTransform.rotate(...args));
16
- });
17
- __publicField(this, "scale", (...args) => {
18
- return this.prepend(_AffineTransform.scale(...args));
19
- });
20
- __publicField(this, "translate", (...args) => {
21
- return this.prepend(_AffineTransform.translate(...args));
22
- });
23
- this.m00 = m00;
24
- this.m01 = m01;
25
- this.m02 = m02;
26
- this.m10 = m10;
27
- this.m11 = m11;
28
- this.m12 = m12;
29
- }
30
- applyTo(point) {
31
- const { x, y } = point;
32
- const { m00, m01, m02, m10, m11, m12 } = this;
33
- return {
34
- x: m00 * x + m01 * y + m02,
35
- y: m10 * x + m11 * y + m12
36
- };
37
- }
38
- prepend(other) {
39
- return new _AffineTransform([
40
- this.m00 * other.m00 + this.m01 * other.m10,
41
- // m00
42
- this.m00 * other.m01 + this.m01 * other.m11,
43
- // m01
44
- this.m00 * other.m02 + this.m01 * other.m12 + this.m02,
45
- // m02
46
- this.m10 * other.m00 + this.m11 * other.m10,
47
- // m10
48
- this.m10 * other.m01 + this.m11 * other.m11,
49
- // m11
50
- this.m10 * other.m02 + this.m11 * other.m12 + this.m12
51
- // m12
52
- ]);
53
- }
54
- append(other) {
55
- return new _AffineTransform([
56
- other.m00 * this.m00 + other.m01 * this.m10,
57
- // m00
58
- other.m00 * this.m01 + other.m01 * this.m11,
59
- // m01
60
- other.m00 * this.m02 + other.m01 * this.m12 + other.m02,
61
- // m02
62
- other.m10 * this.m00 + other.m11 * this.m10,
63
- // m10
64
- other.m10 * this.m01 + other.m11 * this.m11,
65
- // m11
66
- other.m10 * this.m02 + other.m11 * this.m12 + other.m12
67
- // m12
68
- ]);
69
- }
70
- get determinant() {
71
- return this.m00 * this.m11 - this.m01 * this.m10;
72
- }
73
- get isInvertible() {
74
- const det = this.determinant;
75
- return isFinite(det) && isFinite(this.m02) && isFinite(this.m12) && det !== 0;
76
- }
77
- invert() {
78
- const det = this.determinant;
79
- return new _AffineTransform([
80
- this.m11 / det,
81
- // m00
82
- -this.m01 / det,
83
- // m01
84
- (this.m01 * this.m12 - this.m11 * this.m02) / det,
85
- // m02
86
- -this.m10 / det,
87
- // m10
88
- this.m00 / det,
89
- // m11
90
- (this.m10 * this.m02 - this.m00 * this.m12) / det
91
- // m12
92
- ]);
93
- }
94
- get array() {
95
- return [this.m00, this.m01, this.m02, this.m10, this.m11, this.m12, 0, 0, 1];
96
- }
97
- get float32Array() {
98
- return new Float32Array(this.array);
99
- }
100
- // Static
101
- static get identity() {
102
- return new _AffineTransform([1, 0, 0, 0, 1, 0]);
103
- }
104
- static rotate(theta, origin) {
105
- const rotation = new _AffineTransform([Math.cos(theta), -Math.sin(theta), 0, Math.sin(theta), Math.cos(theta), 0]);
106
- if (origin && (origin.x !== 0 || origin.y !== 0)) {
107
- return _AffineTransform.multiply(
108
- _AffineTransform.translate(origin.x, origin.y),
109
- rotation,
110
- _AffineTransform.translate(-origin.x, -origin.y)
111
- );
112
- }
113
- return rotation;
114
- }
115
- static scale(sx, sy = sx, origin = { x: 0, y: 0 }) {
116
- const scale = new _AffineTransform([sx, 0, 0, 0, sy, 0]);
117
- if (origin.x !== 0 || origin.y !== 0) {
118
- return _AffineTransform.multiply(
119
- _AffineTransform.translate(origin.x, origin.y),
120
- scale,
121
- _AffineTransform.translate(-origin.x, -origin.y)
122
- );
123
- }
124
- return scale;
125
- }
126
- static translate(tx, ty) {
127
- return new _AffineTransform([1, 0, tx, 0, 1, ty]);
128
- }
129
- static multiply(...[first, ...rest]) {
130
- if (!first) return _AffineTransform.identity;
131
- return rest.reduce((result, item) => result.prepend(item), first);
132
- }
133
- get a() {
134
- return this.m00;
135
- }
136
- get b() {
137
- return this.m10;
138
- }
139
- get c() {
140
- return this.m01;
141
- }
142
- get d() {
143
- return this.m11;
144
- }
145
- get tx() {
146
- return this.m02;
147
- }
148
- get ty() {
149
- return this.m12;
150
- }
151
- get scaleComponents() {
152
- return { x: this.a, y: this.d };
153
- }
154
- get translationComponents() {
155
- return { x: this.tx, y: this.ty };
156
- }
157
- get skewComponents() {
158
- return { x: this.c, y: this.b };
159
- }
160
- toString() {
161
- return `matrix(${this.a}, ${this.b}, ${this.c}, ${this.d}, ${this.tx}, ${this.ty})`;
162
- }
163
- };
164
- export {
165
- AffineTransform
3
+ var AffineTransform = class AffineTransform {
4
+ constructor([m00, m01, m02, m10, m11, m12] = [
5
+ 0,
6
+ 0,
7
+ 0,
8
+ 0,
9
+ 0,
10
+ 0
11
+ ]) {
12
+ _defineProperty(this, "m00", void 0);
13
+ _defineProperty(this, "m01", void 0);
14
+ _defineProperty(this, "m02", void 0);
15
+ _defineProperty(this, "m10", void 0);
16
+ _defineProperty(this, "m11", void 0);
17
+ _defineProperty(this, "m12", void 0);
18
+ _defineProperty(this, "rotate", (...args) => {
19
+ return this.prepend(AffineTransform.rotate(...args));
20
+ });
21
+ _defineProperty(this, "scale", (...args) => {
22
+ return this.prepend(AffineTransform.scale(...args));
23
+ });
24
+ _defineProperty(this, "translate", (...args) => {
25
+ return this.prepend(AffineTransform.translate(...args));
26
+ });
27
+ this.m00 = m00;
28
+ this.m01 = m01;
29
+ this.m02 = m02;
30
+ this.m10 = m10;
31
+ this.m11 = m11;
32
+ this.m12 = m12;
33
+ }
34
+ applyTo(point) {
35
+ const { x, y } = point;
36
+ const { m00, m01, m02, m10, m11, m12 } = this;
37
+ return {
38
+ x: m00 * x + m01 * y + m02,
39
+ y: m10 * x + m11 * y + m12
40
+ };
41
+ }
42
+ prepend(other) {
43
+ return new AffineTransform([
44
+ this.m00 * other.m00 + this.m01 * other.m10,
45
+ this.m00 * other.m01 + this.m01 * other.m11,
46
+ this.m00 * other.m02 + this.m01 * other.m12 + this.m02,
47
+ this.m10 * other.m00 + this.m11 * other.m10,
48
+ this.m10 * other.m01 + this.m11 * other.m11,
49
+ this.m10 * other.m02 + this.m11 * other.m12 + this.m12
50
+ ]);
51
+ }
52
+ append(other) {
53
+ return new AffineTransform([
54
+ other.m00 * this.m00 + other.m01 * this.m10,
55
+ other.m00 * this.m01 + other.m01 * this.m11,
56
+ other.m00 * this.m02 + other.m01 * this.m12 + other.m02,
57
+ other.m10 * this.m00 + other.m11 * this.m10,
58
+ other.m10 * this.m01 + other.m11 * this.m11,
59
+ other.m10 * this.m02 + other.m11 * this.m12 + other.m12
60
+ ]);
61
+ }
62
+ get determinant() {
63
+ return this.m00 * this.m11 - this.m01 * this.m10;
64
+ }
65
+ get isInvertible() {
66
+ const det = this.determinant;
67
+ return isFinite(det) && isFinite(this.m02) && isFinite(this.m12) && det !== 0;
68
+ }
69
+ invert() {
70
+ const det = this.determinant;
71
+ return new AffineTransform([
72
+ this.m11 / det,
73
+ -this.m01 / det,
74
+ (this.m01 * this.m12 - this.m11 * this.m02) / det,
75
+ -this.m10 / det,
76
+ this.m00 / det,
77
+ (this.m10 * this.m02 - this.m00 * this.m12) / det
78
+ ]);
79
+ }
80
+ get array() {
81
+ return [
82
+ this.m00,
83
+ this.m01,
84
+ this.m02,
85
+ this.m10,
86
+ this.m11,
87
+ this.m12,
88
+ 0,
89
+ 0,
90
+ 1
91
+ ];
92
+ }
93
+ get float32Array() {
94
+ return new Float32Array(this.array);
95
+ }
96
+ static get identity() {
97
+ return new AffineTransform([
98
+ 1,
99
+ 0,
100
+ 0,
101
+ 0,
102
+ 1,
103
+ 0
104
+ ]);
105
+ }
106
+ static rotate(theta, origin) {
107
+ const rotation = new AffineTransform([
108
+ Math.cos(theta),
109
+ -Math.sin(theta),
110
+ 0,
111
+ Math.sin(theta),
112
+ Math.cos(theta),
113
+ 0
114
+ ]);
115
+ if (origin && (origin.x !== 0 || origin.y !== 0)) return AffineTransform.multiply(AffineTransform.translate(origin.x, origin.y), rotation, AffineTransform.translate(-origin.x, -origin.y));
116
+ return rotation;
117
+ }
118
+ static scale(sx, sy = sx, origin = {
119
+ x: 0,
120
+ y: 0
121
+ }) {
122
+ const scale = new AffineTransform([
123
+ sx,
124
+ 0,
125
+ 0,
126
+ 0,
127
+ sy,
128
+ 0
129
+ ]);
130
+ if (origin.x !== 0 || origin.y !== 0) return AffineTransform.multiply(AffineTransform.translate(origin.x, origin.y), scale, AffineTransform.translate(-origin.x, -origin.y));
131
+ return scale;
132
+ }
133
+ static translate(tx, ty) {
134
+ return new AffineTransform([
135
+ 1,
136
+ 0,
137
+ tx,
138
+ 0,
139
+ 1,
140
+ ty
141
+ ]);
142
+ }
143
+ static multiply(...[first, ...rest]) {
144
+ if (!first) return AffineTransform.identity;
145
+ return rest.reduce((result, item) => result.prepend(item), first);
146
+ }
147
+ get a() {
148
+ return this.m00;
149
+ }
150
+ get b() {
151
+ return this.m10;
152
+ }
153
+ get c() {
154
+ return this.m01;
155
+ }
156
+ get d() {
157
+ return this.m11;
158
+ }
159
+ get tx() {
160
+ return this.m02;
161
+ }
162
+ get ty() {
163
+ return this.m12;
164
+ }
165
+ get scaleComponents() {
166
+ return {
167
+ x: this.a,
168
+ y: this.d
169
+ };
170
+ }
171
+ get translationComponents() {
172
+ return {
173
+ x: this.tx,
174
+ y: this.ty
175
+ };
176
+ }
177
+ get skewComponents() {
178
+ return {
179
+ x: this.c,
180
+ y: this.b
181
+ };
182
+ }
183
+ toString() {
184
+ return `matrix(${this.a}, ${this.b}, ${this.c}, ${this.d}, ${this.tx}, ${this.ty})`;
185
+ }
166
186
  };
187
+ export { AffineTransform };
package/dist/align.d.mts CHANGED
@@ -1,5 +1,2 @@
1
- import { Rect, AlignOptions } from './types.mjs';
2
-
3
- declare function alignRect(a: Rect, ref: Rect, options: AlignOptions): Rect;
4
-
5
- export { alignRect };
1
+ import { AlignOptions, Rect } from "./types.mjs";
2
+ export declare function alignRect(a: Rect, ref: Rect, options: AlignOptions): Rect;
package/dist/align.d.ts CHANGED
@@ -1,5 +1,2 @@
1
- import { Rect, AlignOptions } from './types.js';
2
-
3
- declare function alignRect(a: Rect, ref: Rect, options: AlignOptions): Rect;
4
-
5
- export { alignRect };
1
+ import { AlignOptions, Rect } from "./types.js";
2
+ export declare function alignRect(a: Rect, ref: Rect, options: AlignOptions): Rect;
package/dist/align.js CHANGED
@@ -1,51 +1,34 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/align.ts
21
- var align_exports = {};
22
- __export(align_exports, {
23
- alignRect: () => alignRect
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
24
4
  });
25
- module.exports = __toCommonJS(align_exports);
5
+ // src/align.ts
26
6
  function hAlign(a, ref, h) {
27
- let x = ref.minX;
28
- if (h === "left-inside") x = ref.minX;
29
- if (h === "left-outside") x = ref.minX - ref.width;
30
- if (h === "right-inside") x = ref.maxX - ref.width;
31
- if (h === "right-outside") x = ref.maxX;
32
- if (h === "center") x = ref.midX - ref.width / 2;
33
- return { ...a, x };
7
+ let x = ref.minX;
8
+ if (h === "left-inside") x = ref.minX;
9
+ if (h === "left-outside") x = ref.minX - ref.width;
10
+ if (h === "right-inside") x = ref.maxX - ref.width;
11
+ if (h === "right-outside") x = ref.maxX;
12
+ if (h === "center") x = ref.midX - ref.width / 2;
13
+ return {
14
+ ...a,
15
+ x
16
+ };
34
17
  }
35
18
  function vAlign(a, ref, v) {
36
- let y = ref.minY;
37
- if (v === "top-inside") y = ref.minY;
38
- if (v === "top-outside") y = ref.minY - a.height;
39
- if (v === "bottom-inside") y = ref.maxY - a.height;
40
- if (v === "bottom-outside") y = ref.maxY;
41
- if (v === "center") y = ref.midY - a.height / 2;
42
- return { ...a, y };
19
+ let y = ref.minY;
20
+ if (v === "top-inside") y = ref.minY;
21
+ if (v === "top-outside") y = ref.minY - a.height;
22
+ if (v === "bottom-inside") y = ref.maxY - a.height;
23
+ if (v === "bottom-outside") y = ref.maxY;
24
+ if (v === "center") y = ref.midY - a.height / 2;
25
+ return {
26
+ ...a,
27
+ y
28
+ };
43
29
  }
44
30
  function alignRect(a, ref, options) {
45
- const { h, v } = options;
46
- return vAlign(hAlign(a, ref, h), ref, v);
31
+ const { h, v } = options;
32
+ return vAlign(hAlign(a, ref, h), ref, v);
47
33
  }
48
- // Annotate the CommonJS export names for ESM import in node:
49
- 0 && (module.exports = {
50
- alignRect
51
- });
34
+ exports.alignRect = alignRect;
package/dist/align.mjs CHANGED
@@ -1,28 +1,30 @@
1
- import "./chunk-QZ7TP4HQ.mjs";
2
-
3
1
  // src/align.ts
4
2
  function hAlign(a, ref, h) {
5
- let x = ref.minX;
6
- if (h === "left-inside") x = ref.minX;
7
- if (h === "left-outside") x = ref.minX - ref.width;
8
- if (h === "right-inside") x = ref.maxX - ref.width;
9
- if (h === "right-outside") x = ref.maxX;
10
- if (h === "center") x = ref.midX - ref.width / 2;
11
- return { ...a, x };
3
+ let x = ref.minX;
4
+ if (h === "left-inside") x = ref.minX;
5
+ if (h === "left-outside") x = ref.minX - ref.width;
6
+ if (h === "right-inside") x = ref.maxX - ref.width;
7
+ if (h === "right-outside") x = ref.maxX;
8
+ if (h === "center") x = ref.midX - ref.width / 2;
9
+ return {
10
+ ...a,
11
+ x
12
+ };
12
13
  }
13
14
  function vAlign(a, ref, v) {
14
- let y = ref.minY;
15
- if (v === "top-inside") y = ref.minY;
16
- if (v === "top-outside") y = ref.minY - a.height;
17
- if (v === "bottom-inside") y = ref.maxY - a.height;
18
- if (v === "bottom-outside") y = ref.maxY;
19
- if (v === "center") y = ref.midY - a.height / 2;
20
- return { ...a, y };
15
+ let y = ref.minY;
16
+ if (v === "top-inside") y = ref.minY;
17
+ if (v === "top-outside") y = ref.minY - a.height;
18
+ if (v === "bottom-inside") y = ref.maxY - a.height;
19
+ if (v === "bottom-outside") y = ref.maxY;
20
+ if (v === "center") y = ref.midY - a.height / 2;
21
+ return {
22
+ ...a,
23
+ y
24
+ };
21
25
  }
22
26
  function alignRect(a, ref, options) {
23
- const { h, v } = options;
24
- return vAlign(hAlign(a, ref, h), ref, v);
27
+ const { h, v } = options;
28
+ return vAlign(hAlign(a, ref, h), ref, v);
25
29
  }
26
- export {
27
- alignRect
28
- };
30
+ export { alignRect };
package/dist/angle.d.mts CHANGED
@@ -1,5 +1,2 @@
1
- import { Rect, Point } from './types.mjs';
2
-
3
- declare function getPointAngle(rect: Rect, point: Point, reference?: Point): number;
4
-
5
- export { getPointAngle };
1
+ import { Point, Rect } from "./types.mjs";
2
+ export declare function getPointAngle(rect: Rect, point: Point, reference?: Point): number;
package/dist/angle.d.ts CHANGED
@@ -1,5 +1,2 @@
1
- import { Rect, Point } from './types.js';
2
-
3
- declare function getPointAngle(rect: Rect, point: Point, reference?: Point): number;
4
-
5
- export { getPointAngle };
1
+ import { Point, Rect } from "./types.js";
2
+ export declare function getPointAngle(rect: Rect, point: Point, reference?: Point): number;
package/dist/angle.js CHANGED
@@ -1,35 +1,11 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/angle.ts
21
- var angle_exports = {};
22
- __export(angle_exports, {
23
- getPointAngle: () => getPointAngle
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
24
4
  });
25
- module.exports = __toCommonJS(angle_exports);
5
+ // src/angle.ts
26
6
  function getPointAngle(rect, point, reference = rect.center) {
27
- const x = point.x - reference.x;
28
- const y = point.y - reference.y;
29
- const deg = Math.atan2(x, y) * (180 / Math.PI) + 180;
30
- return 360 - deg;
7
+ const x = point.x - reference.x;
8
+ const y = point.y - reference.y;
9
+ return 360 - (Math.atan2(x, y) * (180 / Math.PI) + 180);
31
10
  }
32
- // Annotate the CommonJS export names for ESM import in node:
33
- 0 && (module.exports = {
34
- getPointAngle
35
- });
11
+ exports.getPointAngle = getPointAngle;
package/dist/angle.mjs CHANGED
@@ -1,12 +1,7 @@
1
- import "./chunk-QZ7TP4HQ.mjs";
2
-
3
1
  // src/angle.ts
4
2
  function getPointAngle(rect, point, reference = rect.center) {
5
- const x = point.x - reference.x;
6
- const y = point.y - reference.y;
7
- const deg = Math.atan2(x, y) * (180 / Math.PI) + 180;
8
- return 360 - deg;
3
+ const x = point.x - reference.x;
4
+ const y = point.y - reference.y;
5
+ return 360 - (Math.atan2(x, y) * (180 / Math.PI) + 180);
9
6
  }
10
- export {
11
- getPointAngle
12
- };
7
+ export { getPointAngle };
package/dist/clamp.d.mts CHANGED
@@ -1,12 +1,9 @@
1
- import { Point, Size, RectInit } from './types.mjs';
2
-
3
- declare const clampPoint: (position: Point, size: Size, boundaryRect: RectInit) => {
4
- x: number;
5
- y: number;
1
+ import { Point, RectInit, Size } from "./types.mjs";
2
+ export declare const clampPoint: (position: Point, size: Size, boundaryRect: RectInit) => {
3
+ x: number;
4
+ y: number;
6
5
  };
7
- declare const clampSize: (size: Size, minSize?: Size, maxSize?: Size) => {
8
- width: number;
9
- height: number;
10
- };
11
-
12
- export { clampPoint, clampSize };
6
+ export declare const clampSize: (size: Size, minSize?: Size, maxSize?: Size) => {
7
+ width: number;
8
+ height: number;
9
+ };
package/dist/clamp.d.ts CHANGED
@@ -1,12 +1,9 @@
1
- import { Point, Size, RectInit } from './types.js';
2
-
3
- declare const clampPoint: (position: Point, size: Size, boundaryRect: RectInit) => {
4
- x: number;
5
- y: number;
1
+ import { Point, RectInit, Size } from "./types.js";
2
+ export declare const clampPoint: (position: Point, size: Size, boundaryRect: RectInit) => {
3
+ x: number;
4
+ y: number;
6
5
  };
7
- declare const clampSize: (size: Size, minSize?: Size, maxSize?: Size) => {
8
- width: number;
9
- height: number;
10
- };
11
-
12
- export { clampPoint, clampSize };
6
+ export declare const clampSize: (size: Size, minSize?: Size, maxSize?: Size) => {
7
+ width: number;
8
+ height: number;
9
+ };