chore(vendor): import pi 0.85.1

Imported as a linear vendor commit so forge rebases do not replay the upstream root tree.

git-subtree-dir: third_party/pi

git-subtree-split: d981de1229ef899957bbe968bc8dcda02a21f477
This commit is contained in:
alexion committed 2026-09-14 10:48:47 -04:00
1 parent 5ebc7018c3
commit 4def357d09
1669 files changed
+397627

No files matched your search

@@ -0,0 +1,33 @@
import {
type Component,
dispatchMouseEvent,
type TuiMouseDispatchResult,
type TuiMouseEvent,
type TuiMouseEventResult,
} from "../tui.ts";
export type MouseRegionHandler = (event: TuiMouseEvent) => TuiMouseEventResult | undefined;
/** Adds mouse handling to an existing component without changing its rendering. */
export class MouseRegion implements Component {
private readonly child: Component;
private readonly onMouse: MouseRegionHandler;
constructor(child: Component, onMouse: MouseRegionHandler) {
this.child = child;
this.onMouse = onMouse;
}
render(width: number): string[] {
return this.child.render(width);
}
handleMouse(event: TuiMouseEvent): TuiMouseDispatchResult | TuiMouseEventResult | undefined {
const childResult = dispatchMouseEvent(this.child, event);
return childResult ?? this.onMouse(event);
}
invalidate(): void {
this.child.invalidate();
}
}