import { type ClipFiles, type DeliveryInput } from './delivery.js'; import type { Value } from './engine.js'; import { Player, type MaskoEventName, type MaskoListener, type Position, type ValueOptions } from './player.js'; /** * What the player plays: a release `delivery`; a canvas from its `url` with * an `appKey`, whose newest release it asks for and follows; or one * animation's `clip` files (`webm` and `hevc`), looped on its own. */ export type MountOptions = MountCommon & ({ delivery: DeliveryInput; clip?: undefined; url?: undefined; } | { /** * The canvas's URL: `https://api.masko.ai/v1/canvases/{canvasId}/delivery`, * or the same with its app key inside (`...?key=masko_app_...`). */ url: string; /** An app key of the canvas's mascot (`masko_app_...`), safe in a page; not needed when the URL carries it. */ appKey?: string; delivery?: undefined; clip?: undefined; } | { clip: ClipFiles; delivery?: undefined; url?: undefined; }); interface MountCommon { /** Returns a fresh delivery of the same release, before signed links expire. */ getDelivery?: () => DeliveryInput | Promise; /** Lets clips with their own voice be heard. On by default; false mutes them. Edge sounds play either way. */ sound?: boolean; /** Starts at once. Defaults to the canvas's `autoPlay`, else true. */ autoPlay?: boolean; /** * What the player downloads ahead. `'next'` (the default): every clip that * can play next from the pose on screen. `'all'`: those first, then, once * the mascot shows, every other clip of the release, kept for the visit. */ preload?: 'next' | 'all'; /** * @deprecated Ignored: the player no longer watches the pointer. The app * sets `behavior::pointerHover` and fires `action::click` itself. */ pointer?: boolean; } /** What `mountMascot` returns: the same calls on every platform. */ export interface MaskoHandle { /** `{ instant: true }`: what it starts happens now; an Any State start cuts straight in. */ set(name: string, value: Value, options?: ValueOptions): void; fire(name: string, options?: ValueOptions): void; reset(): void; play(): void; pause(): void; destroy(): void; /** The clip on screen and its clip time in seconds. */ position(): Position; /** * Swaps in fresh links of the release that is playing; the mascot keeps * playing. Another release is refused with `error` `refresh_mismatch`, a * delivery that cannot be read with `refresh_failed`. True when taken. */ updateDelivery(delivery: DeliveryInput): boolean; /** Lets clips' own voices be heard, or not, from the next clip or loop on. */ setSound(on: boolean): void; /** Listens to `pose`, `clip`, `reactionDone`, `movement` or `error`; returns the unsubscribe call. */ on(event: K, handler: MaskoListener): () => void; preview: { showPose(id: string): void; playMove(id: string): void; }; } /** * Plays a mascot in `element`, which sets its size. Returns at once; the * engine loads in the background and calls made meanwhile are kept. */ export declare function mountMascot(element: HTMLElement, options: MountOptions): MaskoHandle; /** The player and its DOM, for the React component. */ export declare function createPlayer(element: HTMLElement, options: MountOptions): { player: Player; root: HTMLElement; }; /** The app's handle on a player. */ export declare function handleFor(player: Player): MaskoHandle; export {};