@zag-js/auto-resize 0.10.2 → 0.10.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.d.ts +1 -3
- package/dist/index.js +10 -32
- package/dist/index.mjs +4 -5
- package/package.json +3 -5
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,33 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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);
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const domQuery = require('@zag-js/dom-query');
|
|
19
6
|
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var src_exports = {};
|
|
22
|
-
__export(src_exports, {
|
|
23
|
-
autoResizeInput: () => autoResizeInput
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(src_exports);
|
|
26
|
-
var import_dom_query = require("@zag-js/dom-query");
|
|
27
7
|
function copyVisualStyles(fromEl, toEl) {
|
|
28
8
|
if (!fromEl)
|
|
29
9
|
return;
|
|
30
|
-
const win =
|
|
10
|
+
const win = domQuery.getWindow(fromEl);
|
|
31
11
|
const el = win.getComputedStyle(fromEl);
|
|
32
12
|
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;
|
|
33
13
|
toEl.style.cssText += cssText;
|
|
@@ -42,8 +22,8 @@ function createGhostElement(doc) {
|
|
|
42
22
|
function autoResizeInput(input) {
|
|
43
23
|
if (!input)
|
|
44
24
|
return;
|
|
45
|
-
const doc =
|
|
46
|
-
const win =
|
|
25
|
+
const doc = domQuery.getDocument(input);
|
|
26
|
+
const win = domQuery.getWindow(input);
|
|
47
27
|
const ghost = createGhostElement(doc);
|
|
48
28
|
copyVisualStyles(input, ghost);
|
|
49
29
|
function resize() {
|
|
@@ -62,7 +42,5 @@ function autoResizeInput(input) {
|
|
|
62
42
|
input?.removeEventListener("change", resize);
|
|
63
43
|
};
|
|
64
44
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
autoResizeInput
|
|
68
|
-
});
|
|
45
|
+
|
|
46
|
+
exports.autoResizeInput = autoResizeInput;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { getDocument, getWindow } from '@zag-js/dom-query';
|
|
2
|
+
|
|
3
3
|
function copyVisualStyles(fromEl, toEl) {
|
|
4
4
|
if (!fromEl)
|
|
5
5
|
return;
|
|
@@ -38,6 +38,5 @@ function autoResizeInput(input) {
|
|
|
38
38
|
input?.removeEventListener("change", resize);
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
41
|
+
|
|
42
|
+
export { autoResizeInput };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/auto-resize",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"description": "Autoresize utilities for the web",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@zag-js/dom-query": "0.10.
|
|
26
|
+
"@zag-js/dom-query": "0.10.3"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"clean-package": "2.2.0"
|
|
@@ -41,9 +41,7 @@
|
|
|
41
41
|
"./package.json": "./package.json"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
"build
|
|
45
|
-
"start": "pnpm build --watch",
|
|
46
|
-
"build": "tsup src --dts",
|
|
44
|
+
"build": "vite build -c ../../../vite.config.ts",
|
|
47
45
|
"test": "jest --config ../../../jest.config.js --rootDir tests",
|
|
48
46
|
"lint": "eslint src --ext .ts,.tsx",
|
|
49
47
|
"test-ci": "pnpm test --ci --runInBand -u",
|