@zag-js/auto-resize 0.2.2 → 0.2.3

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
@@ -23,30 +23,11 @@ __export(src_exports, {
23
23
  autoResizeInput: () => autoResizeInput
24
24
  });
25
25
  module.exports = __toCommonJS(src_exports);
26
-
27
- // ../dom/src/query.ts
28
- function isDocument(el) {
29
- return el.nodeType === Node.DOCUMENT_NODE;
30
- }
31
- function isWindow(value) {
32
- return value?.toString() === "[object Window]";
33
- }
34
- function getDocument(el) {
35
- if (isWindow(el))
36
- return el.document;
37
- if (isDocument(el))
38
- return el;
39
- return el?.ownerDocument ?? document;
40
- }
41
- function getWindow(el) {
42
- return el?.ownerDocument.defaultView ?? window;
43
- }
44
-
45
- // src/index.ts
26
+ var import_dom_query = require("@zag-js/dom-query");
46
27
  function copyVisualStyles(fromEl, toEl) {
47
28
  if (!fromEl)
48
29
  return;
49
- const win = getWindow(fromEl);
30
+ const win = (0, import_dom_query.getWindow)(fromEl);
50
31
  const el = win.getComputedStyle(fromEl);
51
32
  const cssText = "box-sizing:" + el.boxSizing + ";border-left:" + el.borderLeftWidth + " solid red;border-right:" + el.borderRightWidth + " solid red;font-family:" + el.fontFamily + ";font-feature-settings:" + el.fontFeatureSettings + ";font-kerning:" + el.fontKerning + ";font-size:" + el.fontSize + ";font-stretch:" + el.fontStretch + ";font-style:" + el.fontStyle + ";font-variant:" + el.fontVariant + ";font-variant-caps:" + el.fontVariantCaps + ";font-variant-ligatures:" + el.fontVariantLigatures + ";font-variant-numeric:" + el.fontVariantNumeric + ";font-weight:" + el.fontWeight + ";letter-spacing:" + el.letterSpacing + ";margin-left:" + el.marginLeft + ";margin-right:" + el.marginRight + ";padding-left:" + el.paddingLeft + ";padding-right:" + el.paddingRight + ";text-indent:" + el.textIndent + ";text-transform:" + el.textTransform;
52
33
  toEl.style.cssText += cssText;
@@ -61,8 +42,8 @@ function createGhostElement(doc) {
61
42
  function autoResizeInput(input) {
62
43
  if (!input)
63
44
  return;
64
- const doc = getDocument(input);
65
- const win = getWindow(input);
45
+ const doc = (0, import_dom_query.getDocument)(input);
46
+ const win = (0, import_dom_query.getWindow)(input);
66
47
  const ghost = createGhostElement(doc);
67
48
  copyVisualStyles(input, ghost);
68
49
  function resize() {
package/dist/index.mjs CHANGED
@@ -1,22 +1,5 @@
1
- // ../dom/src/query.ts
2
- function isDocument(el) {
3
- return el.nodeType === Node.DOCUMENT_NODE;
4
- }
5
- function isWindow(value) {
6
- return value?.toString() === "[object Window]";
7
- }
8
- function getDocument(el) {
9
- if (isWindow(el))
10
- return el.document;
11
- if (isDocument(el))
12
- return el;
13
- return el?.ownerDocument ?? document;
14
- }
15
- function getWindow(el) {
16
- return el?.ownerDocument.defaultView ?? window;
17
- }
18
-
19
1
  // src/index.ts
2
+ import { getDocument, getWindow } from "@zag-js/dom-query";
20
3
  function copyVisualStyles(fromEl, toEl) {
21
4
  if (!fromEl)
22
5
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/auto-resize",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Autoresize utilities for the web",
5
5
  "keywords": [
6
6
  "js",
@@ -21,9 +21,11 @@
21
21
  "bugs": {
22
22
  "url": "https://github.com/chakra-ui/zag/issues"
23
23
  },
24
+ "dependencies": {
25
+ "@zag-js/dom-query": "0.1.3"
26
+ },
24
27
  "devDependencies": {
25
- "clean-package": "2.2.0",
26
- "@zag-js/dom-utils": "0.2.4"
28
+ "clean-package": "2.2.0"
27
29
  },
28
30
  "clean-package": "../../../clean-package.config.json",
29
31
  "main": "dist/index.js",