# Interfaces T–V

Import these from `@grafloria/renderer`.

## Interfaces

### `ToolCapability`

Contribute interaction tools + connection validation.

```ts
interface ToolCapability
```

**Members**

- `register(tool: CanvasTool): Disposer` — Register (or REPLACE, by name) a canvas tool. Replacing `'node-drag'` with
your own is the point: the built-ins are registrations, not privileged code.
- `registerConnectionValidator(validator: ConnectionValidator): Disposer` — Veto connections. All registered validators must pass.
- `list(): string[]`
- `has(id: string): boolean`

### `ToolHitContext`

What the gesture landed on, resolved once on pointerdown.

```ts
interface ToolHitContext
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `node?` | `NodeModel` |  |  |
| `link?` | `LinkModel` |  |  |
| `port?` | `PortModel` |  |  |
| `empty` | `boolean` |  | True when the pointer went down on empty canvas. |
| `nodeWasSelected?` | `boolean` |  | Was the hit node already selected BEFORE this gesture? (DELIBERATE mode). |

### `ToolModifiers`

```ts
interface ToolModifiers
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `shift` | `boolean` |  |  |
| `ctrl` | `boolean` |  |  |
| `alt` | `boolean` |  |  |
| `meta` | `boolean` |  |  |

### `ToolPointerEvent`

A pointer gesture event, in both coordinate spaces.

```ts
interface ToolPointerEvent
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `type` | `'down' \| 'move' \| 'up' \| 'cancel'` |  |  |
| `world` | `{ x: number; y: number }` |  | World-space (camera applied). |
| `screen` | `{ x: number; y: number }` |  | Element-local CSS px — the drag threshold is measured here. |
| `modifiers` | `ToolModifiers` |  |  |
| `source?` | `PointerEvent \| MouseEvent` |  | The original DOM event, when there was one. |

### `ViewportPortal`

Also has every member of `Portal`, listed on its own entry.

```ts
interface ViewportPortal extends Portal
```

**Members**

- `setPosition(x: number, y: number): void` — Move the portal's world-space origin.
