The best way to control Claude Code, Codex and more from any computer or phone
| 1 | // Adapted from opencode (MIT). Copyright (c) 2025 opencode. See LICENSE.opencode. |
| 2 | import type { VectorBitmap, VectorRequest } from "./vector-pictures"; |
| 3 | import type { Method } from "./worker-rpc"; |
| 4 | |
| 5 | /** What the window shows of one slide besides its bitmap. */ |
| 6 | export type SlideSummary = { |
| 7 | /** In CSS pixels. */ |
| 8 | readonly width: number; |
| 9 | readonly height: number; |
| 10 | readonly hidden: boolean; |
| 11 | readonly notes: string | undefined; |
| 12 | }; |
| 13 | |
| 14 | export type SlidePainted = |
| 15 | | { |
| 16 | readonly kind: "painted"; |
| 17 | /** The slide at the requested density, or less when that would exceed the bitmap caps. */ |
| 18 | readonly bitmap: ImageBitmap; |
| 19 | /** SVG pictures the slide drew without, or too coarse: paint again once the worker has them. */ |
| 20 | readonly vectors: readonly VectorRequest[]; |
| 21 | } |
| 22 | /** The slide does not lay out, or does not paint even without shadows. */ |
| 23 | | { readonly kind: "failed" } |
| 24 | /** The caller aborted the paint while it ran. */ |
| 25 | | { readonly kind: "cancelled" }; |
| 26 | |
| 27 | /** The PowerPoint worker's methods. */ |
| 28 | export type SlideMethods = { |
| 29 | /** Opens the deck once per worker, its fonts included. Rejects when the engine cannot read it. */ |
| 30 | readonly open: Method<{ readonly bytes: ArrayBuffer }, readonly SlideSummary[]>; |
| 31 | /** Paints one slide at `density` device pixels per CSS pixel. */ |
| 32 | readonly paint: Method<{ readonly index: number; readonly density: number }, SlidePainted>; |
| 33 | /** Hands over SVG pictures rasterized for `VectorRequest`s. */ |
| 34 | readonly vectors: Method<readonly VectorBitmap[], void>; |
| 35 | }; |