refactor(core): CORE-17 type input events and own interaction lifetimes

This commit is contained in:
Harvey Zhao committed 2026-09-11 11:24:15 +08:00
1 parent 88aef830df
commit a842058136
72 files changed
+31156 -1219

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
export function inViewport(element: HTMLElement, offset: number): boolean {
const rect = element.getBoundingClientRect()
const document = element.ownerDocument
const window = document.defaultView
const height = window?.innerHeight || document.documentElement.clientHeight
const width = window?.innerWidth || document.documentElement.clientWidth
// Retain the historical edge/gap calculations while using the actual owner viewport.
const vertical = rect.top - offset <= height && rect.top + rect.height + offset >= 0
const horizontal = rect.left - offset <= width + offset && rect.left + rect.width + offset >= 0
return vertical && horizontal
}