@zag-js/rect-utils 0.2.1 → 0.2.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.
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-NGMCS5TG.mjs";
4
4
  import {
5
5
  getElementRect
6
- } from "./chunk-LCJDCPGN.mjs";
6
+ } from "./chunk-GVBSNO2Z.mjs";
7
7
  import {
8
8
  createRect
9
9
  } from "./chunk-YDYJCJQZ.mjs";
@@ -9,13 +9,12 @@ function getCache() {
9
9
  return g.__styleCache;
10
10
  }
11
11
  function getComputedStyle(el) {
12
- var _a;
13
12
  if (!el)
14
13
  return {};
15
14
  const cache = getCache();
16
15
  let style = cache.get(el);
17
16
  if (!style) {
18
- const win = (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
17
+ const win = el?.ownerDocument.defaultView ?? window;
19
18
  style = win.getComputedStyle(el);
20
19
  cache.set(el, style);
21
20
  }
@@ -9,8 +9,8 @@ function getWindowRect(win, opts = {}) {
9
9
  function getViewportRect(win, opts) {
10
10
  const { excludeScrollbar = false } = opts;
11
11
  const { innerWidth, innerHeight, document: doc, visualViewport } = win;
12
- const width = (visualViewport == null ? void 0 : visualViewport.width) || innerWidth;
13
- const height = (visualViewport == null ? void 0 : visualViewport.height) || innerHeight;
12
+ const width = visualViewport?.width || innerWidth;
13
+ const height = visualViewport?.height || innerHeight;
14
14
  const rect = { x: 0, y: 0, width, height };
15
15
  if (excludeScrollbar) {
16
16
  const scrollbarWidth = innerWidth - doc.documentElement.clientWidth;
@@ -31,13 +31,12 @@ function getCache() {
31
31
  return g.__styleCache;
32
32
  }
33
33
  function getComputedStyle(el) {
34
- var _a;
35
34
  if (!el)
36
35
  return {};
37
36
  const cache = getCache();
38
37
  let style = cache.get(el);
39
38
  if (!style) {
40
- const win = (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
39
+ const win = el?.ownerDocument.defaultView ?? window;
41
40
  style = win.getComputedStyle(el);
42
41
  cache.set(el, style);
43
42
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getElementRect
3
- } from "./chunk-LCJDCPGN.mjs";
3
+ } from "./chunk-GVBSNO2Z.mjs";
4
4
  import "./chunk-YDYJCJQZ.mjs";
5
5
  export {
6
6
  getElementRect
@@ -52,13 +52,12 @@ function getCache() {
52
52
  return g.__styleCache;
53
53
  }
54
54
  function getComputedStyle(el) {
55
- var _a;
56
55
  if (!el)
57
56
  return {};
58
57
  const cache = getCache();
59
58
  let style = cache.get(el);
60
59
  if (!style) {
61
- const win = (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
60
+ const win = el?.ownerDocument.defaultView ?? window;
62
61
  style = win.getComputedStyle(el);
63
62
  cache.set(el, style);
64
63
  }
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  fromRange
3
- } from "./chunk-BPWQOPHU.mjs";
3
+ } from "./chunk-AYWORFWQ.mjs";
4
4
  import "./chunk-NGMCS5TG.mjs";
5
- import "./chunk-LCJDCPGN.mjs";
5
+ import "./chunk-GVBSNO2Z.mjs";
6
6
  import "./chunk-TPU7B3ZS.mjs";
7
7
  import "./chunk-YDYJCJQZ.mjs";
8
8
  export {
@@ -53,8 +53,8 @@ function getWindowRect(win, opts = {}) {
53
53
  function getViewportRect(win, opts) {
54
54
  const { excludeScrollbar = false } = opts;
55
55
  const { innerWidth, innerHeight, document: doc, visualViewport } = win;
56
- const width = (visualViewport == null ? void 0 : visualViewport.width) || innerWidth;
57
- const height = (visualViewport == null ? void 0 : visualViewport.height) || innerHeight;
56
+ const width = visualViewport?.width || innerWidth;
57
+ const height = visualViewport?.height || innerHeight;
58
58
  const rect = { x: 0, y: 0, width, height };
59
59
  if (excludeScrollbar) {
60
60
  const scrollbarWidth = innerWidth - doc.documentElement.clientWidth;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getViewportRect,
3
3
  getWindowRect
4
- } from "./chunk-C2OCKGLJ.mjs";
4
+ } from "./chunk-LBA674LT.mjs";
5
5
  import "./chunk-YDYJCJQZ.mjs";
6
6
  export {
7
7
  getViewportRect,
package/dist/index.js CHANGED
@@ -274,13 +274,12 @@ function getCache() {
274
274
  return g.__styleCache;
275
275
  }
276
276
  function getComputedStyle(el) {
277
- var _a;
278
277
  if (!el)
279
278
  return {};
280
279
  const cache = getCache();
281
280
  let style = cache.get(el);
282
281
  if (!style) {
283
- const win = (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
282
+ const win = el?.ownerDocument.defaultView ?? window;
284
283
  style = win.getComputedStyle(el);
285
284
  cache.set(el, style);
286
285
  }
@@ -410,8 +409,8 @@ function getWindowRect(win, opts = {}) {
410
409
  function getViewportRect(win, opts) {
411
410
  const { excludeScrollbar = false } = opts;
412
411
  const { innerWidth, innerHeight, document: doc, visualViewport } = win;
413
- const width = (visualViewport == null ? void 0 : visualViewport.width) || innerWidth;
414
- const height = (visualViewport == null ? void 0 : visualViewport.height) || innerHeight;
412
+ const width = visualViewport?.width || innerWidth;
413
+ const height = visualViewport?.height || innerHeight;
415
414
  const rect = { x: 0, y: 0, width, height };
416
415
  if (excludeScrollbar) {
417
416
  const scrollbarWidth = innerWidth - doc.documentElement.clientWidth;
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getViewportRect,
3
3
  getWindowRect
4
- } from "./chunk-C2OCKGLJ.mjs";
4
+ } from "./chunk-LBA674LT.mjs";
5
5
  import {
6
6
  getElementPolygon
7
7
  } from "./chunk-S3HXSPS7.mjs";
@@ -43,13 +43,13 @@ import {
43
43
  } from "./chunk-IFHTGH3H.mjs";
44
44
  import {
45
45
  fromRange
46
- } from "./chunk-BPWQOPHU.mjs";
46
+ } from "./chunk-AYWORFWQ.mjs";
47
47
  import {
48
48
  union
49
49
  } from "./chunk-NGMCS5TG.mjs";
50
50
  import {
51
51
  getElementRect
52
- } from "./chunk-LCJDCPGN.mjs";
52
+ } from "./chunk-GVBSNO2Z.mjs";
53
53
  import {
54
54
  getRectFromPoints
55
55
  } from "./chunk-TPU7B3ZS.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/rect-utils",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "js",
@@ -23,8 +23,8 @@
23
23
  },
24
24
  "devDependencies": {
25
25
  "clean-package": "2.2.0",
26
- "@zag-js/dom-utils": "0.2.2",
27
- "@zag-js/utils": "0.3.2"
26
+ "@zag-js/dom-utils": "0.2.4",
27
+ "@zag-js/utils": "0.3.3"
28
28
  },
29
29
  "clean-package": "../../../clean-package.config.json",
30
30
  "main": "dist/index.js",