mirror of
http://10.0.2.1:3031/sauer/claude-code.git
synced 2026-06-30 11:36:57 +10:00
24 lines
419 B
TypeScript
24 lines
419 B
TypeScript
|
|
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
|