π File detail
ink/measure-element.ts
π§© .tsπ 24 linesπΎ 419 bytesπ text
β Back to All Filesπ― Use case
This file lives under βink/β, which covers Ink terminal UI (layouts, TTY IO, keyboard, renderer components). It primarily provides a default export (component, class, or entry function). It composes internal code from dom (relative imports).
Generated from folder role, exports, dependency roots, and inline comments β not hand-reviewed for every path.
π§ Inline summary
import type { DOMElement } from './dom.js' type Output = { /** * Element width.
π€ Exports (heuristic)
default
π₯οΈ Source preview
import type { DOMElement } from './dom.js'
type Output = {
/**
* Element width.
*/
width: number
/**
* Element height.
*/
height: number
}
/**
* Measure the dimensions of a particular `<Box>` element.
*/
const measureElement = (node: DOMElement): Output => ({
width: node.yogaNode?.getComputedWidth() ?? 0,
height: node.yogaNode?.getComputedHeight() ?? 0,
})
export default measureElement