@zag-js/rect-utils 1.0.0 → 1.0.2

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.d.mts CHANGED
@@ -193,10 +193,7 @@ declare const createPoint: (x: number, y: number) => {
193
193
  x: number;
194
194
  y: number;
195
195
  };
196
- declare const subtractPoints: (a: Point, b: Point) => {
197
- x: number;
198
- y: number;
199
- };
196
+ declare const subtractPoints: (a: Point, b: Point | null) => Point;
200
197
  declare const addPoints: (a: Point, b: Point) => {
201
198
  x: number;
202
199
  y: number;
package/dist/index.d.ts CHANGED
@@ -193,10 +193,7 @@ declare const createPoint: (x: number, y: number) => {
193
193
  x: number;
194
194
  y: number;
195
195
  };
196
- declare const subtractPoints: (a: Point, b: Point) => {
197
- x: number;
198
- y: number;
199
- };
196
+ declare const subtractPoints: (a: Point, b: Point | null) => Point;
200
197
  declare const addPoints: (a: Point, b: Point) => {
201
198
  x: number;
202
199
  y: number;
package/dist/index.js CHANGED
@@ -220,7 +220,10 @@ var clampSize = (size, minSize = defaultMinSize, maxSize = defaultMaxSize) => {
220
220
 
221
221
  // src/rect.ts
222
222
  var createPoint = (x, y) => ({ x, y });
223
- var subtractPoints = (a, b) => createPoint(a.x - b.x, a.y - b.y);
223
+ var subtractPoints = (a, b) => {
224
+ if (!b) return a;
225
+ return createPoint(a.x - b.x, a.y - b.y);
226
+ };
224
227
  var addPoints = (a, b) => createPoint(a.x + b.x, a.y + b.y);
225
228
  function isPoint(v) {
226
229
  return Reflect.has(v, "x") && Reflect.has(v, "y");
package/dist/index.mjs CHANGED
@@ -218,7 +218,10 @@ var clampSize = (size, minSize = defaultMinSize, maxSize = defaultMaxSize) => {
218
218
 
219
219
  // src/rect.ts
220
220
  var createPoint = (x, y) => ({ x, y });
221
- var subtractPoints = (a, b) => createPoint(a.x - b.x, a.y - b.y);
221
+ var subtractPoints = (a, b) => {
222
+ if (!b) return a;
223
+ return createPoint(a.x - b.x, a.y - b.y);
224
+ };
222
225
  var addPoints = (a, b) => createPoint(a.x + b.x, a.y + b.y);
223
226
  function isPoint(v) {
224
227
  return Reflect.has(v, "x") && Reflect.has(v, "y");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/rect-utils",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "js",