RectCalculator

Primitive #17

🔍 Problem it solves

To position an overlay (tooltip, popover) near a trigger element, you need the trigger's exact position on screen, including scroll offsets. The native getBoundingClientRect() alone is not enough because you also need viewport dimensions.

✅ Solution

Gets the bounding rectangle of an element relative to the viewport. Also returns viewport width/height and scroll offsets. Handles nested scrollable containers.

🧩 Used by components

OverlayPositioner, Tooltip, Popover, Dropdown, ContextMenu, Select

🎮 Interactive demo