/** Resolve a component ref handle (or element) to its DOM node. */ export function elementFromRef(value: unknown): HTMLElement | undefined { if (typeof Element === "undefined") return undefined; if (value instanceof Element) return value as HTMLElement; const element = (value as { $el?: unknown } | null)?.$el; return element instanceof Element ? (element as HTMLElement) : undefined; }