import type { Delivery, DeliveryInput } from './delivery.js'; import type { Value } from './engine.js'; import type { MaskoEventName, MaskoListener, Position, ValueOptions } from './player.js'; /** What the canvas needs from one release's player. */ export interface ReleasePlayer { set(name: string, value: Value, options?: ValueOptions): void; fire(name: string, options?: ValueOptions): void; reset(): void; play(): void; pause(): void; destroy(): void; position(): Position; updateDelivery(delivery: DeliveryInput): boolean; setSound(on: boolean): void; on(event: K, handler: MaskoListener): () => void; preview: { showPose(id: string): void; playMove(id: string): void; }; } export interface CanvasSource { /** `https://api.masko.ai/v1/canvases/{canvasId}/delivery`, possibly with `?key=masko_app_...` */ url: string; /** An app key of the canvas's mascot (`masko_app_...`); left out when the URL carries it. */ appKey?: string; } export interface CanvasDeps { fetch: (url: string, init: { headers: Record; }) => Promise; setTimer(fn: () => void, ms: number): unknown; clearTimer(id: unknown): void; /** The random UUID this browser keeps, or null when it cannot keep one. */ installId(): string | null; /** * A player for one release. `over` is true when it takes over from the one * on screen: it shows on top until `settle()`, once the old one is gone. */ makePlayer(delivery: Delivery, getDelivery: () => Promise, over: boolean): { player: ReleasePlayer; settle(): void; }; } /** The URL of one release, from the canvas's URL. */ export declare function releaseUrl(url: string, release: string): string; export declare function playCanvas(source: CanvasSource, deps: CanvasDeps, options?: { sound?: boolean; }): ReleasePlayer;