| 65 | // ── Preview adapter ─────────────────────────────────────────────────────────── |
| 66 | |
| 67 | class PlaygroundPreview implements PreviewAdapter { |
| 68 | private handlers: Array<(ids: string[]) => void> = []; |
| 69 | |
| 70 | elementAtPoint(_x: number, _y: number) { |
| 71 | return null; |
| 72 | } |
| 73 | applyDraft(_id: string, _props: { dx?: number; dy?: number; width?: number; height?: number }) {} |
| 74 | commitPreview() {} |
| 75 | cancelPreview() {} |
| 76 | |
| 77 | select(ids: string[], _opts?: { additive?: boolean }) { |
| 78 | for (const h of this.handlers) h([...ids]); |
| 79 | } |
| 80 | |
| 81 | on(event: "selection", handler: (ids: string[]) => void): () => void { |
| 82 | if (event !== "selection") return () => {}; |
| 83 | this.handlers.push(handler); |
| 84 | return () => { |
| 85 | this.handlers = this.handlers.filter((h) => h !== handler); |
| 86 | }; |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | // ── Preview iframe ──────────────────────────────────────────────────────────── |
| 91 |
nothing calls this directly
no outgoing calls
no test coverage detected