@zag-js/auto-resize
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -1,1 +0,3 @@ | ||
export declare function autoResizeInput(input: HTMLInputElement | null): () => void; | ||
declare function autoResizeInput(input: HTMLInputElement | null): (() => void) | undefined; | ||
export { autoResizeInput }; |
@@ -28,14 +28,17 @@ "use strict"; | ||
// ../dom/dist/index.mjs | ||
function isDocument(el) { | ||
return el.nodeType === Node.DOCUMENT_NODE; | ||
} | ||
function isWindow(value) { | ||
return (value == null ? void 0 : value.toString()) === "[object Window]"; | ||
} | ||
function getOwnerDocument(el) { | ||
var _a; | ||
function getDocument(el) { | ||
if (isWindow(el)) | ||
return el.document; | ||
return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document; | ||
if (isDocument(el)) | ||
return el; | ||
return (el == null ? void 0 : el.ownerDocument) ?? document; | ||
} | ||
function getOwnerWindow(el) { | ||
var _a; | ||
return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window; | ||
function getWindow(el) { | ||
return (el == null ? void 0 : el.ownerDocument.defaultView) ?? window; | ||
} | ||
@@ -47,3 +50,3 @@ | ||
return; | ||
const win = getOwnerWindow(fromEl); | ||
const win = getWindow(fromEl); | ||
const el = win.getComputedStyle(fromEl); | ||
@@ -63,4 +66,4 @@ 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; | ||
return; | ||
const doc = getOwnerDocument(input); | ||
const win = getOwnerWindow(input); | ||
const doc = getDocument(input); | ||
const win = getWindow(input); | ||
const ghost = createGhostElement(doc); | ||
@@ -84,1 +87,5 @@ copyVisualStyles(input, ghost); | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
autoResizeInput | ||
}); |
{ | ||
"name": "@zag-js/auto-resize", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Autoresize utilities for the web", | ||
@@ -21,11 +21,2 @@ "keywords": [ | ||
], | ||
"scripts": { | ||
"build:fast": "yarn zag build", | ||
"start": "yarn zag build --watch", | ||
"build": "yarn zag build --prod", | ||
"test": "jest --config ../../../jest.config.js --rootDir tests", | ||
"lint": "eslint src --ext .ts,.tsx", | ||
"test:ci": "yarn test --ci --runInBand --updateSnapshot", | ||
"test:watch": "yarn test --watchAll" | ||
}, | ||
"publishConfig": { | ||
@@ -38,4 +29,13 @@ "access": "public" | ||
"devDependencies": { | ||
"@zag-js/dom-utils": "0.1.5" | ||
"@zag-js/dom-utils": "0.1.8" | ||
}, | ||
"scripts": { | ||
"build-fast": "tsup src/index.ts --format=esm,cjs", | ||
"start": "pnpm build --watch", | ||
"build": "tsup src/index.ts --format=esm,cjs --dts", | ||
"test": "jest --config ../../../jest.config.js --rootDir tests", | ||
"lint": "eslint src --ext .ts,.tsx", | ||
"test-ci": "pnpm test --ci --runInBand -u", | ||
"test-watch": "pnpm test --watchAll" | ||
} | ||
} | ||
} |
@@ -15,9 +15,6 @@ # @zag-js/auto-resize | ||
Yes please! See the | ||
[contributing guidelines](https://github.com/chakra-ui/zag/blob/main/CONTRIBUTING.md) | ||
for details. | ||
Yes please! See the [contributing guidelines](https://github.com/chakra-ui/zag/blob/main/CONTRIBUTING.md) for details. | ||
## Licence | ||
This project is licensed under the terms of the | ||
[MIT license](https://github.com/chakra-ui/zag/blob/main/LICENSE). | ||
This project is licensed under the terms of the [MIT license](https://github.com/chakra-ui/zag/blob/main/LICENSE). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8926
6
149
20
3
384