declare const BRAND_MODES: readonly ["dark", "light"]; declare const BRAND_CASES: readonly ["sentence", "upper", "title"]; declare const BRAND_MOTIONS: readonly ["snappy", "punchy", "bouncy", "smooth", "calm"]; declare const BRAND_SURFACES: readonly ["soft", "flat", "glass", "bold", "sketch", "paper", "clay", "pixel"]; declare const BRAND_TEXTURES: readonly ["none", "grid", "glow", "grain", "paper", "board", "parchment", "pixel", "studio"]; type BrandMode = (typeof BRAND_MODES)[number]; type BrandCase = (typeof BRAND_CASES)[number]; type BrandMotion = (typeof BRAND_MOTIONS)[number]; type BrandSurface = (typeof BRAND_SURFACES)[number]; type BrandTexture = (typeof BRAND_TEXTURES)[number]; /** Colour roles. ink is always the dark one and paper the light one; `mode` says which is the ground. */ interface BrandColors { /** The one thing that matters on screen. */ accent: string; /** Markers, highlights, a second series. */ accent2: string; ink: string; paper: string; /** Cards and panels on the ground. */ surface?: string; positive?: string; negative?: string; } /** Font specs ("Inter:900", "Playfair Display:400i") — always bundled faces. */ interface BrandFonts { display: string; text: string; mono: string; /** An occasional accent face (a serif italic word). */ accent?: string; } interface BrandStyle { name: string; title: string; description: string; mode: BrandMode; colors: BrandColors; fonts: BrandFonts; /** The faces the source named, when they had to be mapped to bundled ones ("Geist" → Inter). */ fontsNamed?: string[]; case: BrandCase; motion: BrandMotion; surface: BrandSurface; texture: BrandTexture; /** Corner radius of cards on a 1080-wide canvas, px. */ radius: number; rules: string[]; /** The DESIGN.md prose (without its front matter). */ body: string; source: "builtin" | "user"; path?: string; updatedAt?: number; } /** The tokens a placed program carries — the runtime's defaults follow them. */ interface ProgramStyle { name?: string; mode: BrandMode; colors: BrandColors; fonts: BrandFonts; case: BrandCase; motion: BrandMotion; surface: BrandSurface; texture: BrandTexture; radius: number; } /** Plain aliases for the editor's id and time types. */ type ID = string; type Seconds = number; /** * Motion graphics as programs. A graphic on the timeline can be code instead of a * template: `function frame(t, $)` returning the SVG of one frame, a pure function of the * clip's time — the way the video engines MONARC learned from draw a film (`seek(t)` * builds any frame from scratch). The designer model writes the program for one shot * (what is said over it, the words' times, the region it owns, the media it may show); * the desktop runs it in a sandboxed worker and draws each frame through the same * renderer in the player, the export and on the phone. * * Programs live on title clips (`title.program`), so the layer stack, transitions, * keyframes, trims and the title bake work for them unchanged. */ interface GraphicWord { w: string; /** Start, clip seconds. */ s: Seconds; /** End, clip seconds. */ e: Seconds; } /** A box in the program's canvas, px. */ interface GraphicBox { x: number; y: number; w: number; h: number; } /** A hole the renderer keeps clear in every frame so footage below shows through (a face bubble). */ interface GraphicWindow extends GraphicBox { kind: "circle" | "rect"; /** Corner radius for a rect window, px. */ r?: number; /** A ring drawn round the hole. */ ring?: { color: string; width: number; }; } interface TitleProgram { version: 1; /** Plain JavaScript defining `function frame(t, $)` (and optionally `function setup($)`). */ code: string; /** The canvas the code draws on, px — the project's frame size when it was written. */ width: number; height: number; /** Faces the code uses, "Family:weight" with an "i" for italic ("Inter:800", "Playfair Display:400i"). */ fonts: string[]; /** The words spoken over the clip, in clip seconds — what `$.at(word)` reads. */ words?: GraphicWord[]; /** Named moments, clip seconds — `$.beat(name)`. */ beats?: Record; /** Free data the code reads as `$.data` (numbers, labels). */ data?: Record; /** Colours, the accent first — `$.palette` / `$.c`. */ palette?: string[]; /** Asset ids of pictures the code shows with `$.image(id, …)`. */ media?: ID[]; /** The part of the canvas the graphic owns (a split's top panel); drawing outside it is clipped. */ region?: GraphicBox; /** A hole kept clear for the footage below. */ window?: GraphicWindow; /** The picture no longer changes after this many seconds (the export holds the last frame). */ holdAfter?: Seconds; /** What it shows, one or two lines — the inspector and the agent read it. */ brief?: string; /** Which model (or person) wrote the code. */ author?: string; /** The layout or placement it was designed for (face, split, broll, card, cutaway, overlay, panel, full, bubble) — a repair keeps its rules. */ layout?: string; /** The brand style's tokens: the runtime's colours, faces, radius, surfaces and spring feel follow them. */ style?: ProgramStyle; } declare const MG_API_REFERENCE: string; /** MONARC PRO's built-in styles, then the ones Volito adds. */ declare const BUILTIN_STYLES: readonly BrandStyle[]; /** The kit as it is prepended to a program: comments and indentation stripped (programs are capped at 60 000 characters). */ declare const MOTION_KIT_CODE: string; /** The vocabulary, for validation, help and agents — the kit's own tables (a test keeps them equal). */ declare const MOVES: readonly ["none", "appear", "fade", "rise", "drop", "slide", "smear", "arc", "pop", "zoom", "push", "grow", "grow-x", "grow-y", "unfold", "wipe", "iris", "shutter", "blinds", "diagonal", "blur", "flip", "turn", "spin", "roll", "swing", "skew", "stretch", "squash", "bounce", "elastic", "slam", "tilt", "float", "glitch", "flicker", "typewriter", "scramble"]; declare const IDLES: readonly ["none", "float", "bob", "pulse", "breathe", "wiggle", "sway", "drift", "jitter", "spin", "heartbeat", "shimmer"]; declare const HITS: readonly ["pulse", "pop", "shake", "jump", "wobble", "flash", "spin", "rubber", "tada"]; declare const EASES: readonly ["brand", "linear", "in", "out", "inOut", "smooth", "sine", "expo", "back", "elastic", "bounce", "snappy", "punchy", "bouncy", "calm", "gentle", "wobbly", "stiff"]; declare const MOODS: readonly ["energetic", "elegant", "playful", "cinematic", "glitchy", "minimal", "retro", "kinetic"]; declare const SPLITS: readonly ["none", "lines", "words", "letters"]; declare const ORDERS: readonly ["forward", "reverse", "center", "edges", "random"]; declare const DIRECTIONS: readonly ["left", "right", "up", "down", "top", "bottom", "up-left", "up-right", "down-left", "down-right"]; declare const ORIGINS: readonly ["center", "left", "right", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"]; /** One line per move, for help text and agents. */ declare const MOVE_NOTES: Record<(typeof MOVES)[number], string>; /** What a creator (or an agent) may set on one part. */ interface MotionSpec { /** Entrance move. */ in?: string; /** Exit move (the move played backwards), or "none" to stay to the end. */ out?: string; /** Seconds the entrance takes. */ dur?: number; /** Seconds the exit takes. */ outDur?: number; ease?: string; outEase?: string; /** The side a move comes from. */ from?: string; /** The side an exit leaves to. */ outFrom?: string; /** How far a move travels, px at 1080. */ distance?: number; /** Motion blur on the way in and out. */ blur?: boolean; /** A loop while the part holds. */ idle?: string; /** Hits: "pulse@1.2, shake@now" or [{fx, at}] — at is seconds, a beat name or a spoken word. */ emphasis?: string | Array<{ fx: string; at: number | string; }>; /** Keyframes: [{t, x, y, s, sx, sy, r, skx, op, blur, ease}] in clip seconds (negative from the end), px at 1080. */ keys?: Array>; /** Seconds added to the part's start. */ delay?: number; /** Clip seconds the part starts (replaces the item's). */ at?: number; /** Clip seconds the exit starts (negative from the end). */ outAt?: number; /** 0–2: how far, how big, how much rotation. */ intensity?: number; /** The pivot for scale, rotation and skew. */ origin?: string; /** Text: animate it whole, or by lines, words or letters. */ split?: string; order?: string; /** Seconds between units. */ stagger?: number; outStagger?: number; } /** Per part, and "*" for every part. */ type MotionOverrides = Record; /** Overrides as they arrive from a command line, an agent or JSON: values not yet read (normalizeMotion reads them). */ type MotionInput = Record>; interface MotionConfig { parts?: MotionOverrides; mood?: string; seed?: number; speed?: number; } /** "name.in=pop", "in=pop" (every part), "*.ease=bouncy", or a JSON object → overrides. */ declare function parseMotionArgs(args: string[]): MotionInput; /** * Interactive states for : a graphic's timeline cut into named stretches — idle, hover, * press, loading, success — that page events and code switch between. Each state plays its stretch once * (then stays on its last frame, or moves on to `next`), loops it, or holds one frame. Times are seconds or * the item's beat names, so an item that names its beats ("hover", "press") declares its states in * item.json and works with no setup: * * "states": { "idle": { "from": "idle", "to": "hover", "play": "loop" }, * "hover": { "from": "hover", "to": "press", "play": "once" }, * "press": { "from": "press", "to": "loading", "play": "once", "next": "loading" } }, * "on": "pointerenter(idle): hover; pointerleave(hover): idle; click: press" * * Pure functions: parsed and resolved here, played by the element. */ declare const STATE_PLAYS: readonly ["once", "loop", "hold"]; type StatePlay = (typeof STATE_PLAYS)[number]; interface StateDef { /** Where the stretch starts: seconds, a beat name, "start" or "end". Default: the start. */ from?: number | string; /** Where it ends: seconds, a beat name, "start" or "end". Default: the end. */ to?: number | string; /** once: play it and stay on its last frame (or go to `next`); loop: repeat it; hold: show `from` and stay. */ play?: StatePlay; /** The state to go to when a `once` stretch finishes. */ next?: string; } /** * Packs and items: the library format. A pack is a folder of items that share a look and a * helper file; an item is one motion graphic — `item.json` (what it is, the props it takes, * how long it runs, the aspects it fits) and `frame.js` (a `function frame(t, $)` program that * reads its props as `$.data`). Nothing here touches the filesystem or the DOM, so the CLI, * the MCP server and the browser player all build programs the same way. */ declare const CATEGORIES: readonly ["lower-third", "title", "cta", "stat", "list", "quote", "end-card", "callout", "social", "chart", "logo", "transition", "banner", "timer", "text", "captions", "scene"]; type Category = (typeof CATEGORIES)[number]; /** overlay: transparent, sits over footage · full: draws its own ground (a card, a scene). */ type Placement = "overlay" | "full"; declare const ASPECTS: { readonly "16:9": readonly [1920, 1080]; readonly "9:16": readonly [1080, 1920]; readonly "1:1": readonly [1080, 1080]; readonly "4:5": readonly [1080, 1350]; }; type Aspect = keyof typeof ASPECTS; declare const ASPECT_NAMES: Aspect[]; type PropType = "text" | "longtext" | "number" | "boolean" | "choice" | "color" | "list" | "image" | "icon"; /** One field of a list prop's rows ({ label: "text", value: "number" }). */ type ListField = "text" | "number"; interface PropSpec { type: PropType; label?: string; description?: string; default?: unknown; /** choice: the values allowed. */ options?: string[]; /** number: bounds and step. */ min?: number; max?: number; step?: number; /** text / longtext: the most characters that still fit the design. */ maxLength?: number; /** list: rows are text (the default) or objects with these fields. */ of?: ListField | Record; minItems?: number; maxItems?: number; /** Shown only when another prop has a value ({ prop: "side", is: ["left"] }). */ when?: { prop: string; is: unknown[]; }; } interface ItemManifest { /** Unique in its pack: lowercase words joined by hyphens ("lower-third"). */ id: string; name: string; description: string; category: Category; tags?: string[]; placement: Placement; /** Seconds. */ duration: { default: number; min?: number; max?: number; }; /** The aspects the design is laid out for; all four when omitted. */ aspects?: Aspect[]; props: Record; /** Named moments the code reads with $.beat(name): seconds from the start, or from the end when negative. */ beats?: Record; /** Faces the code names besides the brand style's (Family:weight, "i" for italic). */ fonts?: string[]; /** The style it is shown in when none is asked for. */ style?: string; /** The picture stops changing after this many seconds before the end (renders hold the last frame). */ holdFromEnd?: number; /** * An editor can use it as the look of a caption track: it draws the words it is given one cue at a time (the * `cues` build option), fits any cue, and draws a frame within the caption speed budget (CAPTION_FRAME_MS). */ captionLook?: boolean; /** The parts a creator can animate on their own (name → what it is): the names motion overrides use. */ parts?: Record; /** Libraries the code uses besides the motion kit: "3d" (scene3d), "world" (country shapes). */ libs?: LibraryName[]; /** Faces whose glyphs 3D text is built from: brand roles ("display") or specs ("Anton:400"). Default: display. */ faces3d?: string[]; /** * Interactive states for : named stretches of the timeline (beat names or seconds), each * played once, looped or held — { "idle": { "from": "idle", "to": "hover", "play": "loop" }, … }. */ states?: Record; /** The page events that switch states by default: "pointerenter(idle): hover; click: press". */ on?: string; } interface PackManifest { format: number; /** Lowercase words joined by hyphens ("essentials"). */ id: string; name: string; version: string; description: string; author: string; license: string; homepage?: string; /** The default brand style of the pack's items. */ style?: string; /** Item ids, in the order a gallery shows them. */ items: string[]; /** A file of helpers prepended to every item's code. */ shared?: string; } /** An item ready to build: its manifest, the pack it belongs to and its own code. */ interface MotionItem extends ItemManifest { pack: string; /** "essentials/lower-third". */ ref: string; /** The pack's helpers and the item's frame.js. The kit and libraries are added when it is built. */ code: string; libs: LibraryName[]; } interface MotionPack extends PackManifest { entries: MotionItem[]; } declare class MotionError extends Error { constructor(message: string); } declare const LIBRARY_NAMES: readonly ["3d", "world", "three"]; type LibraryName = (typeof LIBRARY_NAMES)[number]; interface PropsResult { props: Record; warnings: string[]; } /** * The props an item draws with: its defaults, overridden by `input` (strings from a command line * are read as the prop's type), clamped to the spec. Unknown names and values that do not fit are * reported, never thrown, so a render always has something to draw. */ declare function resolveProps(item: Pick, input?: Record): PropsResult; /** What a caller may pass as a style: a built-in name, DESIGN.md text, a BrandStyle or program tokens. */ type StyleInput = string | BrandStyle | ProgramStyle | null | undefined; interface StyleOverrides { accent?: string; accent2?: string; ink?: string; paper?: string; surface?: string; mode?: "dark" | "light"; display?: string; text?: string; mono?: string; } /** The style tokens a program carries, from a name, DESIGN.md text or tokens, with overrides on top. */ declare function resolveStyle(input: StyleInput, overrides?: StyleOverrides, fallback?: string): ProgramStyle; interface BuildOptions { props?: Record; style?: StyleInput; colors?: StyleOverrides; /** An aspect name, or a canvas size in px. */ aspect?: Aspect | { width: number; height: number; }; /** Seconds; the item's default when omitted. */ duration?: number; /** Words spoken over the graphic (clip seconds) — items land their text on them. */ words?: GraphicWord[]; /** * An editor's caption cues over those words (clip seconds, in order): a caption look shows one cue at a time, * on screen exactly while the cue is, and never puts words of two cues together. Words said in no cue are not * captioned. Items that are not caption looks ignore them. */ cues?: CaptionCue[]; /** Named moments, overriding the item's. */ beats?: Record; /** Image props as data: URLs, by prop name (the caller loads the files). */ media?: Record; /** How each part moves: { "*": {…every part}, name: { in: "pop", ease: "bouncy", … } } (see MOVES). */ motion?: MotionInput; /** A choreography mood (energetic, elegant, playful, cinematic, glitchy, minimal, retro, kinetic). */ mood?: string; /** A seed for a new choreography: every seed moves differently, the same seed the same way. */ seed?: number; /** Plays every move faster (2) or slower (0.5). */ speed?: number; /** * How three.js scenes (renderThree) are drawn: "svg" (the default — in the sandbox, as SVG, no GPU), * "webgl" (three.js's WebGLRenderer in headless Chrome, in software: identical everywhere) or "gpu" * (the same on the machine's graphics card). The host draws the WebGL ones; see src/node/three-gl.ts. */ three?: "svg" | "webgl" | "gpu"; } /** One caption cue: when it comes on and goes, clip seconds. */ interface CaptionCue { s: number; e: number; } /** At most this many cues ride with a graphic (with the words, its data stays well inside the program's limit). */ declare const MAX_CUES = 400; /** Cues as the pack's helpers read them ($.data.__cues): [[start, end], …], valid, in order, at most MAX_CUES. */ declare function cueData(cues: readonly CaptionCue[] | undefined, warnings?: string[]): Array<[number, number]> | undefined; interface BuiltProgram { program: TitleProgram; /** Lines of kit and libraries before the item's own code (errors are reported in the author's lines). */ codeOffset: number; duration: number; props: Record; style: ProgramStyle; /** Image props the program shows, prop name → data URL. */ media: Record; warnings: string[]; } /** "16:9" / "1920x1080" / "9:16" → an aspect or canvas. */ declare function parseAspect(s: string): Aspect | { width: number; height: number; }; /** The program for one item with these options: props resolved, style applied, timed and sized. */ declare function buildProgram(item: MotionItem, opts?: BuildOptions): BuiltProgram; /** A one-off item from a program someone wrote (an agent, a developer): no props, data passed through. */ declare function customItem(code: string, opts?: { id?: string; placement?: Placement; duration?: number; description?: string; }): MotionItem; /** A compact description of an item for an agent or a terminal: what it is and every prop it takes. */ declare function describeItem(item: MotionItem): string; /** * Patterns Volito adds to the runtime: sixteen animated grounds (dots, halftone, dither, * Bauhaus tiles, mesh gradients, confetti…). Each is a pure function of t like everything else, so it * renders the same in Node and the browser and never needs a GPU. * * They reach programs two ways. A style whose texture names one gets it on every ground the runtime * draws ($.panel, $.texture), so all items pick it up; and any program can draw one itself with * `$.pattern(t, kind, o)`. The code is spliced into the engine runtime's scope (src/engine.ts) because * it draws with the runtime's own helpers; src/engine/ itself stays a verbatim copy of MONARC core. */ /** Pattern names, with the words a style brief uses for them. */ declare const PATTERN_WORDS: { readonly dots: "an even dot grid drifting slowly"; readonly plus: "a Swiss grid of small plus marks"; readonly graph: "graph paper: fine lines with a bolder grid every fifth"; readonly hatch: "fine diagonal hatching that slides"; readonly stripes: "bold diagonal stripes in the accent, sliding like a speed flag"; readonly checker: "a soft checkerboard drifting"; readonly halftone: "a halftone screen of accent dots swelling from one corner"; readonly dither: "an ordered pixel dither rising from the bottom in the accent"; readonly waves: "flowing parallel wave lines"; readonly rings: "concentric compass rings rippling out from a corner"; readonly mesh: "a mesh gradient: big soft blobs of the accents drifting"; readonly confetti: "Memphis confetti — squiggles, triangles, rings and dots floating at the edges"; readonly bauhaus: "big Bauhaus shapes — quarter circles, half discs, a diamond — parked at the corners"; readonly tiles: "a field of Bauhaus tiles that turn in a wave"; readonly pills: "floating outlined pills in the palette's colours"; readonly sunburst: "a slowly turning sunburst of rays"; }; type PatternName = keyof typeof PATTERN_WORDS; declare const PATTERN_NAMES: PatternName[]; /** * Volito in the browser: play any item (or your own program) live on a canvas — the same * sandboxed worker and SVG → image → canvas path MONARC PRO's player uses, so a web page * shows exactly what a render will be. * * import { loadRegistry, findItem, createPlayer } from "volito/browser"; * const reg = await loadRegistry(); * const player = await createPlayer(canvas, findItem(reg, "essentials/lower-third"), { props: { name: "Priya" }, style: "ember" }); * player.play(); * * Fonts and the registry load from `base` (the package's folder on jsDelivr by default); serve the * package's fonts/ and dist/registry.json yourself and pass their folder to keep it offline. */ declare const VERSION: string; /** Where fonts/ and dist/registry.json are fetched from unless told otherwise. */ declare const CDN_BASE: string; interface Registry { format: number; package: string; version: string; packs: MotionPack[]; /** Libraries that ship as files ("world"): name → code. */ libs?: Record; /** Big libraries ("three"): name → path under the base, fetched when a program uses them. */ libFiles?: Record; } /** Every pack's items and code (dist/registry.json under `base`). */ declare function loadRegistry(base?: string): Promise; /** An item from the registry by ref ("essentials/lower-third") or id. */ declare function findItem(reg: Registry, name: string): MotionItem; interface PlayerOptions extends BuildOptions { /** Where fonts/ (and dist/registry.json) live — the package on jsDelivr by default. */ base?: string; fps?: number; /** Play again from the start at the end (true). */ loop?: boolean; /** A colour drawn under the graphic; transparent by default. */ background?: string; /** Called with the program's warnings (text off the frame, props that do not fit) whenever they change. */ onWarnings?: (warnings: string[]) => void; /** Called with a failure (the program threw, a frame did not parse). */ onError?: (err: Error) => void; /** Called on every drawn frame with its time. */ onFrame?: (t: number) => void; } declare class MotionPlayer { readonly canvas: HTMLCanvasElement; private item; private opts; private built; private worker; private env; /** Every face the package has (fonts/faces.json), and the files the worker has loaded. */ private all; private loaded; private readonly css; private widening; private gone; private lastT; private raf; private started; private offset; private playing; private drawing; private lastSvg; private warned; private constructor(); static create(canvas: HTMLCanvasElement, item: MotionItem, opts?: PlayerOptions): Promise; /** Seconds the graphic runs. */ get duration(): number; /** The time shown now, seconds. */ get time(): number; get program(): TitleProgram; private get base(); private load; private startWorker; /** The faces a frame draws with. */ private facesOf; /** The @font-face rules for a set of faces, as data: URLs; one string per set, made once. */ private cssOf; /** A frame drew with a face the worker lacks (so measured without it): restart it with that face, then redraw. */ private widen; private report; /** Change props, style, aspect or duration; the frame redraws. */ update(opts: Partial): Promise; /** Play another item (or program) with the current options. */ setItem(item: MotionItem | string): Promise; /** Draw the frame at `t` seconds. */ draw(t: number): Promise; play(): void; pause(): void; seek(t: number): Promise; destroy(): void; } /** A player on `canvas` for `item` (an item, or program code); its first frame is drawn when this resolves. */ declare function createPlayer(canvas: HTMLCanvasElement, item: MotionItem | string, opts?: PlayerOptions): Promise; export { ASPECTS, ASPECT_NAMES, BUILTIN_STYLES, CATEGORIES, CDN_BASE, DIRECTIONS, EASES, HITS, IDLES, MAX_CUES, MG_API_REFERENCE, MOODS, MOTION_KIT_CODE, MOVES, MOVE_NOTES, MotionError, MotionPlayer, ORDERS, ORIGINS, PATTERN_NAMES, SPLITS, VERSION, buildProgram, createPlayer, cueData, customItem, describeItem, findItem, loadRegistry, parseAspect, parseMotionArgs, resolveProps, resolveStyle }; export type { Aspect, BuildOptions, CaptionCue, ItemManifest, MotionConfig, MotionInput, MotionItem, MotionOverrides, MotionPack, MotionSpec, PlayerOptions, PropSpec, Registry };