@zag-js/auto-resize 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.
package/dist/index.js CHANGED
@@ -29,19 +29,17 @@ function isDocument(el) {
29
29
  return el.nodeType === Node.DOCUMENT_NODE;
30
30
  }
31
31
  function isWindow(value) {
32
- return (value == null ? void 0 : value.toString()) === "[object Window]";
32
+ return value?.toString() === "[object Window]";
33
33
  }
34
34
  function getDocument(el) {
35
- var _a;
36
35
  if (isWindow(el))
37
36
  return el.document;
38
37
  if (isDocument(el))
39
38
  return el;
40
- return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
39
+ return el?.ownerDocument ?? document;
41
40
  }
42
41
  function getWindow(el) {
43
- var _a;
44
- return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
42
+ return el?.ownerDocument.defaultView ?? window;
45
43
  }
46
44
 
47
45
  // src/index.ts
@@ -71,16 +69,16 @@ function autoResizeInput(input) {
71
69
  win.requestAnimationFrame(() => {
72
70
  ghost.innerHTML = input.value;
73
71
  const rect = win.getComputedStyle(ghost);
74
- input == null ? void 0 : input.style.setProperty("width", rect.width);
72
+ input?.style.setProperty("width", rect.width);
75
73
  });
76
74
  }
77
75
  resize();
78
- input == null ? void 0 : input.addEventListener("input", resize);
79
- input == null ? void 0 : input.addEventListener("change", resize);
76
+ input?.addEventListener("input", resize);
77
+ input?.addEventListener("change", resize);
80
78
  return () => {
81
79
  doc.body.removeChild(ghost);
82
- input == null ? void 0 : input.removeEventListener("input", resize);
83
- input == null ? void 0 : input.removeEventListener("change", resize);
80
+ input?.removeEventListener("input", resize);
81
+ input?.removeEventListener("change", resize);
84
82
  };
85
83
  }
86
84
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -3,19 +3,17 @@ function isDocument(el) {
3
3
  return el.nodeType === Node.DOCUMENT_NODE;
4
4
  }
5
5
  function isWindow(value) {
6
- return (value == null ? void 0 : value.toString()) === "[object Window]";
6
+ return value?.toString() === "[object Window]";
7
7
  }
8
8
  function getDocument(el) {
9
- var _a;
10
9
  if (isWindow(el))
11
10
  return el.document;
12
11
  if (isDocument(el))
13
12
  return el;
14
- return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
13
+ return el?.ownerDocument ?? document;
15
14
  }
16
15
  function getWindow(el) {
17
- var _a;
18
- return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
16
+ return el?.ownerDocument.defaultView ?? window;
19
17
  }
20
18
 
21
19
  // src/index.ts
@@ -45,16 +43,16 @@ function autoResizeInput(input) {
45
43
  win.requestAnimationFrame(() => {
46
44
  ghost.innerHTML = input.value;
47
45
  const rect = win.getComputedStyle(ghost);
48
- input == null ? void 0 : input.style.setProperty("width", rect.width);
46
+ input?.style.setProperty("width", rect.width);
49
47
  });
50
48
  }
51
49
  resize();
52
- input == null ? void 0 : input.addEventListener("input", resize);
53
- input == null ? void 0 : input.addEventListener("change", resize);
50
+ input?.addEventListener("input", resize);
51
+ input?.addEventListener("change", resize);
54
52
  return () => {
55
53
  doc.body.removeChild(ghost);
56
- input == null ? void 0 : input.removeEventListener("input", resize);
57
- input == null ? void 0 : input.removeEventListener("change", resize);
54
+ input?.removeEventListener("input", resize);
55
+ input?.removeEventListener("change", resize);
58
56
  };
59
57
  }
60
58
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/auto-resize",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Autoresize utilities for the web",
5
5
  "keywords": [
6
6
  "js",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "devDependencies": {
25
25
  "clean-package": "2.2.0",
26
- "@zag-js/dom-utils": "0.2.2"
26
+ "@zag-js/dom-utils": "0.2.4"
27
27
  },
28
28
  "clean-package": "../../../clean-package.config.json",
29
29
  "main": "dist/index.js",