# DomEventBinderHost

Import it from `@grafloria/renderer`.

Everything the binder needs from its host. Keeps this class DI-free.

```ts
interface DomEventBinderHost
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `viewport` | `ViewportController` |  |  |
| `interaction` | `InteractionController` |  |  |

**Members**

- `getEngine(): DiagramEngine | null` — The engine, or null before a diagram is attached.
- `getRect(): CanvasRect` — The canvas' client rect (for screen→world).
- `requestRender(): void` — "Something visible changed" — the host coalesces this into a frame.
- `emit(event: string, payload: unknown): void` — Emit a public diagram event (`node:click`, `connect`, …).
- `beginSelectionBatch?(): void` — Optional: bracket a USER GESTURE so the host can coalesce its selection events. The binder opens a batch around every DOM event it handles, and holds one from a press to its release (a marquee clears on the press and selects on the release). Batches nest; a host that implements these emits ONE `selection:change`, with the final selection, when the outermost one closes — instead of one per model mutation plus the binder's own (which fired stale, mid-gesture events: `{n:1,e:1}` then `{n:1,e:0}` for one click).
- `endSelectionBatch?(): void`
- `clipboardKey?(action: 'copy' | 'cut' | 'paste'): boolean` — Optional: take over a clipboard key (Ctrl/⌘ C, X, V). Answer true when the host handled it; the binder then does nothing more. Absent, the binder's own engine copy/paste runs, as it always has.
- `markConnectSnap?(nodeId: string | null, verdict?: 'accept' | 'refuse'): void` — Optional: mark (or clear) the node a connection drag is snapping to.
- `markDropLink?(linkId: string | null): void` — Optional: mark (or clear) the link a dragged node would be dropped onto.
