ViewportAware

Primitive #32

🔍 Problem it solves

Overlays need to know if they are near viewport edges to adjust position or content (e.g., truncate text, change direction).

✅ Solution

Provides getDistanceToViewportEdges(element) returning distances to top/bottom/left/right edges, plus helpers isNearTop(), isNearBottom(), isNearLeft(), isNearRight() with configurable threshold.

🧩 Used by components

ContextMenu, Dropdown, Tooltip, Popover, DatePicker

🎮 Interactive demo