import { tick } from "svelte"; export function autoGrow(node) { function resize() { node.style.height = "auto"; node.style.height = node.scrollHeight + "px"; } // wait until DOM updates to apply initial value tick().then(resize); node.addEventListener("input", resize); return { destroy() { node.removeEventListener("input", resize); } }; }