@zag-js/auto-resize
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -49,6 +49,8 @@ 'use strict'; | ||
const resize = () => { | ||
el.style.height = "auto"; | ||
const borderTopWidth = parseInt(style.borderTopWidth, 10); | ||
const borderBottomWidth = parseInt(style.borderBottomWidth, 10); | ||
el.style.height = `${el.scrollHeight + borderTopWidth + borderBottomWidth}px`; | ||
requestAnimationFrame(() => { | ||
el.style.height = "auto"; | ||
const borderTopWidth = parseInt(style.borderTopWidth, 10); | ||
const borderBottomWidth = parseInt(style.borderBottomWidth, 10); | ||
el.style.height = `${el.scrollHeight + borderTopWidth + borderBottomWidth}px`; | ||
}); | ||
}; | ||
@@ -65,3 +67,5 @@ el.addEventListener("input", resize); | ||
}); | ||
const resizeObserver = new win.ResizeObserver(() => resize()); | ||
const resizeObserver = new win.ResizeObserver(() => { | ||
requestAnimationFrame(() => resize()); | ||
}); | ||
resizeObserver.observe(el); | ||
@@ -68,0 +72,0 @@ const attrObserver = new win.MutationObserver(() => resize()); |
{ | ||
"name": "@zag-js/auto-resize", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Autoresize utilities for the web", | ||
@@ -25,3 +25,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@zag-js/dom-query": "1.0.2" | ||
"@zag-js/dom-query": "1.1.0" | ||
}, | ||
@@ -28,0 +28,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
10322
163
+ Added@zag-js/dom-query@1.1.0(transitive)
+ Added@zag-js/types@1.1.0(transitive)
- Removed@zag-js/dom-query@1.0.2(transitive)
- Removed@zag-js/types@1.0.2(transitive)
Updated@zag-js/dom-query@1.1.0