import { z } from 'zod'; /** The pixel sprites the runtime has built in ($.sprite(name, …)), read from its source. */ declare const MG_SPRITE_NAMES: string[]; /** The icon names the runtime draws ($.icon(name, …)), read from its source so the two never drift. */ declare const MG_ICON_NAMES: string[]; 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; } /** * Read a DESIGN.md — MONARC's own, Google's design.md tokens, CSS variables or plain prose — * into a style. Throws StyleError only when there is nothing to name it by. */ declare function parseDesignMd(markdown: string, opts?: { source?: BrandStyle["source"]; fallbackName?: string; path?: string; updatedAt?: number; }): BrandStyle; /** 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; } /** What the program needs from the runner besides its code: the `$` environment. */ interface ProgramEnv { width: number; height: number; duration: Seconds; fps: number; words: GraphicWord[]; beats: Record; data: Record; palette?: string[]; style?: ProgramStyle; region?: GraphicBox; window?: GraphicWindow | null; /** Asset id → data URL. */ media: Record; } declare const MG_API_REFERENCE: string; /** MONARC PRO's built-in styles, then the ones Volito adds. */ declare const BUILTIN_STYLES: readonly BrandStyle[]; /** A style as a DESIGN.md file (the engine's composeDesignMd, with words for the package's patterns). */ declare function composeDesignMd(s: BrandStyle): string; /** Styles MONARC PRO knows (a pack item meant for the editor can stay within these). */ declare const EDITOR_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; } /** Motion overrides cleaned for a program: unknown names dropped with a warning, numbers read as numbers. */ declare function normalizeMotion(cfg: { parts?: MotionInput; mood?: unknown; seed?: unknown; speed?: unknown; } | undefined, parts?: string[]): { motion: MotionConfig; warnings: string[]; }; /** "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 MOTION_FORMAT = 1; 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); } /** Problems with an item manifest (empty when it is usable). */ declare function manifestProblems(m: Partial): string[]; /** An item from its manifest and code, checked; `shared` is the pack's helper file. */ declare function makeItem(pack: string, manifest: ItemManifest, frameCode: string, shared?: string): MotionItem; 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; } /** * The caption speed budget: a caption look draws a 1080 × 1920 frame (its program and resvg) in at most this many * ms on one core. An editor runs it on every frame of a caption track, so a slow look slows every export. */ declare const CAPTION_FRAME_MS = 25; /** 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[]; } declare function canvasFor(aspect: BuildOptions["aspect"]): { width: number; height: number; }; /** "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; /** One pack folder: pack.json, the shared helpers, an item folder per id. */ declare function loadPack(dir: string): MotionPack; /** The packs that ship with Volito. */ declare function builtinPacks(): MotionPack[]; /** Packs in extra folders: each folder is a pack, or holds packs one level down. */ declare function packsIn(dirs: string[]): MotionPack[]; interface Library { packs: MotionPack[]; items: MotionItem[]; } /** The built-in packs plus any extra folders (VOLITO_PACKS, or the older MONARC_MOTION_PACKS; ":"-separated, adds more). */ declare function library(extraDirs?: string[]): Library; /** An item by ref, id or path (an item folder, or a .js program file). */ declare function findItem(name: string, lib?: Library): MotionItem; interface ItemQuery { category?: string; pack?: string; placement?: string; /** Words matched against the id, name, description and tags. */ search?: string; } declare function searchItems(q?: ItemQuery, lib?: Library): MotionItem[]; /** * The Graphic spec: one JSON document that says everything about one graphic — which item (or program), * its words, brand, shape, timing, motion and sound. The CLI, the Node API and the MCP server read it, and * the same spec renders the same frames anywhere. A recipe you can keep in a repo, diff, review and hand * to an agent or a teammate. * * { "volito": 1, "item": "essentials/lower-third", "props": { "name": "Priya Sharma" }, "style": "ember", "aspect": "9:16" } * * "volito" is the format's major version: a new major only comes with a migration, and minor changes only * add optional fields. This module is pure (no Node APIs) so the browser player and editors can use it. */ declare const SPEC_VERSION = 1; declare const SPEC_SCHEMA_URL = "https://volito.dev/schema/graphic.v1.json"; declare const GraphicSpecSchema: z.ZodObject<{ $schema: z.ZodOptional; volito: z.ZodLiteral<1>; name: z.ZodOptional; item: z.ZodOptional; program: z.ZodOptional; code: z.ZodOptional; placement: z.ZodOptional>; props: z.ZodOptional>; style: z.ZodOptional; colors: z.ZodOptional; accent2: z.ZodOptional; ink: z.ZodOptional; paper: z.ZodOptional; surface: z.ZodOptional; mode: z.ZodOptional>; display: z.ZodOptional; text: z.ZodOptional; mono: z.ZodOptional; }, z.core.$strict>>; aspect: z.ZodOptional; duration: z.ZodOptional; fps: z.ZodOptional; width: z.ZodOptional; background: z.ZodOptional; words: z.ZodOptional>, z.ZodString]>>; offset: z.ZodOptional; beats: z.ZodOptional>; motion: z.ZodOptional>>; mood: z.ZodOptional>; seed: z.ZodOptional; speed: z.ZodOptional; sound: z.ZodOptional; level: z.ZodOptional; }, z.core.$strict>]>>; render: z.ZodOptional>; out: z.ZodOptional; }, z.core.$strict>>; }, z.core.$strict>; type GraphicSpec = z.infer; interface SpecIssue { /** Where in the spec, as a JSON path ("props.name", "motion.plate.in"); "" for the whole document. */ path: string; message: string; } /** Parse and check the shape of a spec (not the item it names). */ declare function parseSpec(input: unknown): { spec: GraphicSpec | null; errors: SpecIssue[]; }; /** The spec format as a JSON Schema (draft 2020-12), for editors and other languages. */ declare function specJsonSchema(): Record; type ThreeMode = "svg" | "webgl" | "gpu"; /** A page drawing one render's three.js scenes. */ declare class ThreePage { private chrome; private targetId; private sessionId; private constructor(); private sentMedia; /** What draws: "ANGLE (… SwiftShader …)" or the GPU, and three.js's revision. */ info: { renderer: string; three: string; }; static open(mode: ThreeMode): Promise; private evaluate; /** Draw a payload renderThree handed over; `media` maps the graphic's picture ids to data URLs. A PNG data URL. */ draw(payload: string, media: Record, scale: number): Promise; close(): Promise; } interface ProgramFrame { svg: string; defs: string; warnings: string[]; ms: number; } /** A failure the program caused: a syntax error, a throw, a timeout. `line` is the program's own line. */ declare class ProgramError extends Error { readonly line?: number; constructor(message: string, line?: number | null); } /** Whether this engine's worker source still has the line the sound hook patches (a test keeps it true). */ declare function soundHookAvailable(): boolean; declare class ProgramRunner { private readonly ctx; private readonly codeLine; private dead; private constructor(); /** * A runner with the program loaded and set up for `env`. Rejects with a ProgramError when it does not * start. `lineOffset` is how many lines of the code come before the author's own (the kit, a pack's helpers). */ static create(program: TitleProgram, env: ProgramEnv, timeoutMs?: number, lineOffset?: number): Promise; private message; private lineOf; /** A line of the worker source as a line of the author's code (undefined inside the runtime, the kit or helpers). */ private mapLine; /** Hand the worker source one message; it answers through postMessage into self.__out. */ private post; private read; private send; private sendSync; /** The SVG body of the frame at clip time `t`. Throws a ProgramError when the program fails. */ frame(t: number, timeoutMs?: number): ProgramFrame; /** * The program's own sound design: what `function sound($)` returns, read once with `$` at t = 0 ($.dur, * $.beat, $.at and $.data are there). `spec` is null when the program defines none; `error` when it threw. */ sound(timeoutMs?: number): { spec: unknown; error?: string; }; /** Every frame run once with the runtime's trace on: when each element pops, slides, stamps or types in. */ trace(fps: number, timeoutMs?: number): { marks: unknown[]; frames: number; error?: string; }; } /** * Sound design for Volito graphics — synthesised here, from nothing: no samples, no dependencies. * * A render carries sound two ways. Any program may define `function sound($)` and return cues * (`{ at, kind, dur, level, pitch, pan }`) and, if it wants one, a tonal bed in a key; and every * graphic is read through the runtime's motion trace (when each part pops, slides, stamps, types * or bursts in), so `--sound` gives the right whoosh, pop or tick to an item nobody wrote cues for. * Both end in `renderSound`: cues become stereo PCM through small synths (filtered noise for air * and sweeps, sine drops for impacts, inharmonic partials for bells, detuned saws for a pad), a * room (a Schroeder reverb), ducking of the bed under hits, a limiter, and a WAV ffmpeg muxes. * * Pure TypeScript, deterministic: the same cues render the same bytes every time. */ declare const SOUND_KINDS: readonly ["whoosh", "hit", "stamp", "pop", "tick", "click", "riser", "fall", "sub", "shimmer", "ding", "swell", "zap", "type", "scratch", "tone", "chord"]; type SoundKind = (typeof SOUND_KINDS)[number]; /** One line per kind, for help text and agents. */ declare const SOUND_NOTES: Record; interface SoundCue { /** Clip seconds. */ at: number; kind: SoundKind; /** Seconds, for the kinds that last. */ dur?: number; /** 0–2; 1 is the kind's own level. */ level?: number; /** Semitones up or down from the kind's own pitch. */ pitch?: number; /** A note for tone / chord ("A4", "D#3", "Bb2"). */ note?: string; /** -1 left … 1 right (0 centre). */ pan?: number; /** A different take of the same sound. */ seed?: number; } interface SoundBed { /** "D", "F#", "Bb" — the key (A by default). */ key?: string; mode?: "major" | "minor"; /** Clip seconds it plays between (the whole clip by default). */ from?: number; to?: number; /** 0–1 (0.5). */ level?: number; /** 0 dark … 1 open (0.4). */ tone?: number; } interface SoundSpec { cues?: SoundCue[]; /** A pad under everything: a bed object, true for one in A minor, or a key ("Dm", "F major"). */ bed?: SoundBed | boolean | string; /** Also take cues from the graphic's own motion (true when the program gives no cues). */ auto?: boolean; /** Master level, 0–2 (1). */ level?: number; /** The room: 0 dry … 1 wet (0.25). */ room?: number; } /** A mark the runtime's trace left: [kind, seconds, a, b, count]. */ type TraceMark = [string, number, number | null, number | null, number]; interface RenderedSound { left: Float32Array; right: Float32Array; sampleRate: number; /** The cues that were rendered (after clamping and thinning). */ cues: SoundCue[]; /** Peak sample after the limiter, 0–1. */ peak: number; bed: SoundBed | null; warnings: string[]; } /** "A4" → 440, "D#3", "Bb2"; null when it is not a note. */ declare function noteHz(note: string): number | null; /** "Dm", "F# minor", "Bb", "C major" → the root as semitones from A and the mode. */ declare function parseKey(key: string | undefined): { root: number; mode: "major" | "minor"; }; /** A spec as a program (or an agent) returned it, cleaned: unknown kinds dropped with a warning, numbers read. */ declare function normalizeSoundSpec(raw: unknown, duration: number): { spec: SoundSpec; warnings: string[]; }; /** The bed a spec asks for, in full, or null. */ declare function bedOf(b: SoundSpec["bed"], duration: number): SoundBed | null; /** * Cues for a graphic nobody wrote sound for, from the runtime's trace: a pop for each spring, a * whoosh for each move across the frame (louder the further it travels), ticks for letters and * words, typing for a typewriter, an impact for a slam or a stamp, a zap for a glitch, sparkle for a * burst. Dense runs (letters staggering in, bars growing one after another) become one soft run of * ticks instead of a dozen pops. */ declare function cuesFromMarks(marks: TraceMark[], duration: number): SoundCue[]; /** Mix cues and a bed into stereo PCM, duration seconds long, at 48 kHz. */ declare function renderSound(spec: SoundSpec, duration: number, opts?: { sampleRate?: number; }): RenderedSound; /** 16-bit stereo PCM WAV. */ declare function wavEncode(left: Float32Array, right: Float32Array, sampleRate: number): Uint8Array; /** One line per cue, for a terminal or an agent. */ declare function describeCues(cues: SoundCue[]): string; declare const VIDEO_FORMATS: readonly ["mov", "webm", "mp4", "hevc", "gif", "png"]; type VideoFormat = (typeof VIDEO_FORMATS)[number]; type StillFormat = "png" | "svg"; /** What each format is, for help text and agents. */ declare const FORMAT_NOTES: Record; interface RenderOptions extends BuildOptions { /** Frames per second (30). */ fps?: number; /** Output width in px; the height follows the canvas. The canvas width when omitted. */ width?: number; /** A colour drawn under the graphic ("#000000"), or "transparent" (the default where the format has alpha). */ background?: string; /** Frames rasterised at once (the machine's cores). */ concurrency?: number; /** Bound on one frame's program run, ms. */ frameTimeoutMs?: number; onProgress?: (done: number, total: number) => void; /** * Sound, synthesised by Volito and muxed into the video: true for the program's own sound($) (or, when it has * none, cues read from its motion); a SoundSpec adds cues and sets the bed, level and room on top. */ sound?: boolean | SoundSpec; /** A pad under everything in a key ("Dm", "F major"), a bed object, or false for none — over what the program asks. */ bed?: string | SoundBed | false; /** Also write the sound alone to this .wav (an editor's timeline wants it next to a ProRes overlay). */ soundOut?: string; } interface SoundResult { /** The cues rendered, in time order. */ cues: SoundCue[]; bed: SoundBed | null; /** Peak after the limiter, 0–1. */ peak: number; duration: number; /** The .wav written, when one was asked for. */ file?: string; warnings: string[]; } interface Session { item: MotionItem; built: BuiltProgram; env: ProgramEnv; runner: ProgramRunner; /** How three.js scenes are drawn, and the Chrome page drawing them on the WebGL route (opened on first use). */ three: ThreeMode; threePage?: ThreePage; fps: number; /** Output size, px. */ width: number; height: number; warnings: string[]; } /** Build the program and start its sandbox. */ declare function openSession(item: MotionItem, opts?: RenderOptions): Promise; /** * The complete SVG document for one frame body (the region clipped, a background under it). For resvg, * text beyond its family's Latin cut is set as outlines (see outline.ts); with `css` (a standalone SVG * for browsers) the faces are embedded instead and the text left as written. */ declare function frameDocument(program: TitleProgram, frame: Pick, width: number, height: number, opts?: { background?: string | null; css?: string; }): string; interface StillResult { format: StillFormat; /** PNG bytes, or the SVG document. */ data: Buffer; width: number; height: number; t: number; warnings: string[]; file?: string; } /** One frame at `t` seconds as a PNG (alpha kept) or a standalone SVG (its faces embedded). */ declare function renderStill(item: MotionItem, opts?: RenderOptions & { t?: number; format?: StillFormat; out?: string; }): Promise; /** Times spread over a graphic for a contact sheet: early, entering, holding, leaving. */ declare function sheetTimes(duration: number, n?: number): number[]; /** * A contact sheet: frames across the graphic's time in one PNG, each labelled with its time — how * an agent (or a reviewer) sees motion in one look. Overlays sit on a footage-grey ground. */ declare function renderSheet(item: MotionItem, opts?: RenderOptions & { times?: number[]; cols?: number; tileWidth?: number; }): Promise<{ png: Buffer; times: number[]; warnings: string[]; width: number; height: number; }>; interface VideoResult { file: string; format: VideoFormat; width: number; height: number; fps: number; frames: number; duration: number; /** Frames actually rasterised (the rest repeated an unchanged frame). */ drawn: number; bytes: number; ms: number; warnings: string[]; /** The sound track, when one was rendered. */ sound?: SoundResult; } /** * The sound of a graphic: the program's own sound($) when it defines one, cues read from its motion trace * (always when it defines none, or when it asks with auto: true), and the bed, level and room the caller sets. */ declare function designSound(s: Session, opts: Pick, duration?: number): { spec: SoundSpec; warnings: string[]; }; /** Render a graphic's sound alone, to a .wav (no ffmpeg needed). */ declare function renderSoundFile(item: MotionItem, opts?: RenderOptions & { out?: string; outDir?: string; }): Promise; /** The format a file name asks for (".mov" → ProRes, ".webm", ".mp4", ".gif", a folder → PNG frames). */ declare function formatFromPath(path: string): VideoFormat | null; declare function defaultOutput(item: MotionItem, format: VideoFormat, s: { width: number; height: number; }): string; /** * Render the whole graphic to a video file (or a folder of PNG frames). The output's format comes * from `format`, else from `out`'s extension, else ProRes 4444 .mov. */ declare function renderVideo(item: MotionItem, opts?: RenderOptions & { format?: VideoFormat; out?: string; outDir?: string; }): Promise; interface LoadedSpec { spec: GraphicSpec; /** The folder its paths are relative to. */ dir: string; file?: string; } /** A path that holds a Volito spec: a .json file whose top level has "volito". */ declare function isSpecFile(path: string): boolean; /** Read and shape-check a spec file; throws with every problem listed. */ declare function loadSpecFile(path: string): LoadedSpec; /** The item a spec draws: a pack item, a program file or inline code. */ declare function itemOfSpec(loaded: LoadedSpec, lib?: Library): MotionItem; /** Render options from a spec (media not loaded yet: image props are resolved to absolute paths or URLs). */ declare function specToOptions(loaded: LoadedSpec, item: MotionItem): RenderOptions; interface SpecReport { ok: boolean; errors: SpecIssue[]; warnings: SpecIssue[]; item?: string; } /** * Everything wrong with a spec, before anything renders: its shape, the item it names, files it points at, * props against the item's manifest, motion parts, the aspect and the length. Errors stop a render; * warnings would render but not as written (a name cut to fit, a part that does not exist). */ declare function validateSpec(input: unknown, opts?: { dir?: string; lib?: Library; }): SpecReport; /** A spec from the options a command line gave (the reverse of specToOptions), for `volito spec`. */ declare function specFrom(fields: Omit): GraphicSpec; interface AspectReport { aspect: string; ok: boolean; errors: string[]; warnings: string[]; /** Frames run. */ frames: number; /** Slowest program run, ms. */ slowestMs: number; /** The graphic drew nothing at any sampled time. */ blank: boolean; } interface CheckReport { ref: string; ok: boolean; aspects: AspectReport[]; } /** Run `item` at each aspect (its own, else all four), `fps` samples a second, and parse a few frames as images. */ declare function checkItem(item: MotionItem, opts?: BuildOptions & { aspects?: Array; fps?: number; }): Promise; /** A check report in a few lines. */ declare function describeReport(rep: CheckReport): string; interface CaptionCost { ref: string; /** The middle of the sampled frames' times (program + resvg), ms. */ medianMs: number; /** The slowest sampled frame, ms. */ slowestMs: number; frames: number; } /** * What a caption look costs per frame where an editor uses it: `frames` frames spread over the words, each run and * drawn by resvg at 1080 × 1920 on this core. Compare `medianMs` with CAPTION_FRAME_MS. */ declare function captionFrameCost(item: MotionItem, opts?: BuildOptions & { frames?: number; }): Promise; /** * Words with times from the transcript shapes people have: [{w, s, e}], [{word|text, start, end}], * Whisper's {segments: [{words: […]}]}, or {words: […]}. Times in seconds from the graphic's start; * `offset` shifts them (a graphic that starts 12 s into the voice: offset 12). */ declare function normalizeWords(input: unknown, offset?: number): GraphicWord[]; declare function readWords(file: string, offset?: number): GraphicWord[]; /** A picture (path or http(s) URL) as a data: URL. */ declare function loadImage(src: string): Promise; /** Every image prop the caller set, loaded. */ declare function loadMedia(item: MotionItem, props?: Record): Promise>; /** A style argument: a built-in name, or a path to a DESIGN.md (read here). */ declare function readStyleArg(arg: string | undefined): StyleInput; /** ffmpeg and the encoders it was built with; null when there is no ffmpeg. */ declare function probeFfmpeg(): { path: string; encoders: Set; } | null; declare class FfmpegMissing extends Error { constructor(what: string); } declare const fontsDir: () => string; declare function packageVersion(): 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[]; /** How motion works — for creators setting it and for code using the kit. */ declare const MOTION_GUIDE = "Motion: any part, any move\n\nEvery graphic is made of named parts (volito info lists them). Each part enters, may idle\nwhile it holds, may take emphasis hits, and leaves \u2014 and every one of those is yours to change:\n\n in / out any move (volito moves): rise, slam, wipe, iris, glitch, scramble, typewriter,\n spin, swing, stretch, smear, blur, flip, bounce \u2026 An exit plays the move backwards.\n ease brand, out, inOut, expo, back, elastic, bounce, snappy, punchy, bouncy, calm, wobbly,\n spring(freq, damping), steps(n), cubic(x1,y1,x2,y2)\n from the side a move comes from (left, right, up, down, up-left \u2026); outFrom for the exit\n dur, delay seconds; at / outAt replace the item's own times (outAt negative = from the end)\n distance how far it travels (px at 1080) \u00B7 intensity 0\u20132 scales distance, size and rotation\n blur true: motion blur on the way in and out \u00B7 origin: the pivot (center, top-left, bottom \u2026)\n idle a loop while it holds: float, bob, pulse, breathe, wiggle, sway, drift, jitter, spin, heartbeat, shimmer\n emphasis hits: \"pulse@1.2, shake@now, jump@beatName\" (a time, a beat, or a spoken word)\n split text by lines, words or letters \u00B7 order forward | reverse | center | edges | random \u00B7 stagger s\n keys your own keyframes: [{\"t\":0,\"x\":-300,\"op\":0},{\"t\":0.8,\"x\":0,\"op\":1,\"ease\":\"bouncy\"}]\n (t in clip seconds, x/y px at 1080, s scale, r degrees, skx, op, blur) \u2014 any path you like\n\nSet them per part, or for every part with \"*\":\n CLI --motion name.in=typewriter --motion \"*.ease=bouncy\" --motion plate.out=wipe --motion role.emphasis=pulse@2\n API { motion: { \"*\": { ease: \"bouncy\" }, name: { in: \"typewriter\" } } }\n\nOr let a mood choreograph it: --mood energetic | elegant | playful | cinematic | glitchy | minimal | retro | kinetic,\nand --seed for a new take every number (a seed alone picks a mood too). Your own settings still win.\n--speed 2 plays every move twice as fast.\n\nIn your own code the same kit is there: const M = motion($, t);\n M.part(name, { at, box: {x,y,w,h}, in, out, \u2026 }, ...markup) a part, posed by its motion\n M.text(name, { ...$.text options, at, in, split, \u2026 }, text) text, whole or by unit\n M.layout(text, textOptions, split) \u2192 { units: [{text, x, y, w, h, line, index, box}], box }\n M.progress(name, { at, in, dur, ease }) \u2192 { in, out, at, end, outAt } for things you draw yourself\nGive every part a box when you can: wipes, iris, shutter and blinds need it, and moods pick from more moves."; /** The libraries and helpers every program can use besides the $ runtime. */ declare const LIBRARY_GUIDE = "Libraries: layout, patterns, 3D, three.js and maps\n\nLayout (always there)\n safeArea($) \u2192 {x, y, w, h, tall, square, wide}: the title-safe box (on 9:16 it clears the platforms' buttons)\n fitFont($, str, role, size, maxW, extra) \u2192 a font in the brand's role, shrunk until str fits maxW\n fitLines($, str, font, maxW, maxSize, minSize, maxLines) \u2192 {size, lines, font}: the biggest size that sets in \u2264 maxLines\n landOn($, str, fallback, after) \u2192 when the first spoken word of str starts (0.08 s early), else fallback\n widest($, lines, font) \u00B7 avatar($, imageProp, cx, cy, r, {name, fill, ring}) \u00B7 appIcon($, icon, x, y, size, {fill}) \u00B7 initials(name)\n\nPatterns (always there) \u2014 sixteen animated grounds in the brand's colours, pure functions of t:\n $.pattern(t, kind, {box, color, color2, a (strength), scale, speed, angle, at: [x, y], count, seed, r}) \u2192 markup\n kinds: dots \u00B7 plus \u00B7 graph \u00B7 hatch \u00B7 stripes \u00B7 checker \u00B7 halftone \u00B7 dither \u00B7 waves \u00B7 rings \u00B7 mesh \u00B7 confetti \u00B7 bauhaus \u00B7 tiles \u00B7 pills \u00B7 sunburst\n A style whose texture names one draws it on every $.panel / $.texture ground. confetti, bauhaus and pills keep to the edges.\n\nFaces: Inter, Space Grotesk, Space Mono, Poppins, Playfair Display, Montserrat, Anton, Outfit, Gabarito, Caveat, Press Start 2P,\n Permanent Marker, Patrick Hand, Fredoka, IM Fell English, Bebas Neue, DM Serif Display, Archivo Black, Syne, Unbounded,\n Righteous, Orbitron, Pacifico, Fraunces, Bricolage Grotesque \u2014 name them \"Family:weight\" (e.g. \"Fraunces:900\", \"Syne:800\").\n\n3D \u2014 real depth, light and a camera, drawn as SVG paths (no GPU). Call it and the library comes with your program:\n const S = scene3d($, { camera: { fov: 35, distance, yaw, pitch, roll, target: [x, y, z], x, y }, light: { dir: [x, y, z], ambient, spec, shine } });\n Coordinates: x right, y down, z away from you, px at the target's depth (z = 0 draws at 1 px per unit by default).\n Meshes: S.text(str, {face: $.font(\"display\"), size, depth, color, side, back, anchor, ls, each: (i, n, ch) => ({rotate, offset, scale, hide})})\n S.box(w, h, d, {color, side, back, radius}) \u00B7 S.card(w, h, {depth, radius, color, back}) \u00B7 S.disc(r, d, {...})\n S.shape(loops | \"M\u2026 path data\", depth, {scale, color, side}) \u00B7 S.sphere(r, {color}) (smooth) or {colorAt(lat, lon)}\n Place: S.add(mesh, {position, rotate: [x\u00B0, y\u00B0, z\u00B0], scale, parent: {position, rotate, parent}, opacity, flat, decal, twoSided})\n \u2014 parent moves text with the card it is printed on; decal draws it over that card's face.\n Also: S.line(points3d, {stroke, width}) \u00B7 S.at(point3d, (x, y, scale) => markup) flat labels at 3D points \u00B7 S.project(p) \u2192 {x, y, z, s}\n S.measure(str, {face, size}) \u00B7 S.clip(poly, normal, point)\n Finish with: return S.render(); 3D text uses the brand's display face (an item lists others in \"faces3d\").\n\nthree.js (r187) \u2014 write the scene with the real three.js API; use THREE and the library comes with your program.\n Build it once in setup($) (scene, camera, lights, meshes; return them), move things by t in frame, then draw:\n renderThree($, scene, camera, { box, background, shadows, shading: \"smooth\" | \"flat\", toneMapping: \"aces\" | \"neutral\", exposure, environment: \"room\", lineWidth })\n \u2192 markup; the camera's aspect follows the box (the whole frame by default), so one scene fits every aspect.\n Everything in three.js core is there (geometries incl. TorusKnot/Extrude/Lathe/Tube, Edges, Instanced meshes, Basic/Lambert/Phong/\n Standard/Physical/Normal/Toon/Shadow materials, every light, Fog, groups, curves, maths, AnimationMixer \u2014 sample it with mixer.setTime(t)).\n No loaders that fetch (no network), no custom shaders.\n threeText($, \"WORD\", { face: $.font(\"display\"), size, depth, bevel, anchor }) \u2192 ExtrudeGeometry in the brand's faces (centred)\n threeImage($, name) \u2192 a texture of one of the graphic's pictures (an image prop, or --image name=path) for material.map\n threeToScreen($, camera, point) \u2192 {x, y, depth, visible}: draw labels and callouts over the 3D with $.text, M.part, \u2026\n Colours: new THREE.Color($.c.accent). Shadows: light.castShadow + mesh.castShadow, onto a flat mesh with receiveShadow\n (a floor or wall; ShadowMaterial for a shadow on its own). Light units are three.js's (DirectionalLight 2\u20133, AmbientLight 0.4\u20131).\n SVG route: light and fog are worked out at triangle corners, so give big planes segments (PlaneGeometry(40, 40, 32, 32)).\n How it is drawn: as SVG in the sandbox (default: smooth-shaded triangles, no GPU, same pixels everywhere), or with\n three.js's WebGLRenderer in headless Chrome when rendered with --three webgl (shadow maps, per-pixel PBR, environment light).\n WebGL only: shadowType: \"vsm\" (soft, light.shadow.radius) and post: { ao: { radius, intensity }, dof: { focus, aperture, maxblur },\n bloom: { strength, radius, threshold } } \u2014 film passes (GTAO, bokeh, bloom); put the backdrop in the scene (scene.background) when you use them.\n\nMaps (Natural Earth, 177 countries). Call one and the library comes with your program:\n worldFind(\"India\" | \"UK\" | \"USA\" | 356) \u2192 {name, id, c: [lon, lat], rings}\n const m = worldMap($, { x, y, w, h, center: [lon, lat], zoom }); m.path(country | name) \u2192 path data \u00B7 m.project(lon, lat) \u2192 [x, y]\n m.countries \u00B7 m.outline (the map's edge) \u00B7 m.clipId() (clip to it) \u00B7 m.ring(points)\n worldGlobe(S, { r, spin, tilt, colorOf: (country) => colour }) countries on a 3D globe \u00B7 worldOnSphere(lon, lat, r, spin, tilt) \u2192 a 3D point"; /** Sound design: what a program may return from sound($), and what --sound does to a graphic that returns none. */ declare const SOUND_GUIDE = "Sound: every graphic can carry its own\n\nA render with --sound (API: sound: true, MCP: sound) gets a stereo track synthesised by Volito itself \u2014 no\nsamples, no files to find \u2014 muxed into the .mp4 / .mov / .webm (PNG frames and GIF carry none; --sound-out\nfile.wav writes the track alone, for an editor's timeline). Two sources, both deterministic:\n\n 1. The graphic's own motion. Every part's move leaves a mark the sound design reads: a spring pops, a move\n across the frame whooshes (louder the further it travels), a slam hits, letters tick, a typewriter types,\n a glitch zaps, a burst sparkles. Items nobody wrote sound for sound right out of the box.\n 2. A program's sound($). Beside frame(t, $) a program may define\n\n function sound($) {\n return {\n cues: [\n { at: 0.2, kind: \"riser\", dur: 1.1 }, // seconds into the clip; -1 counts from the end\n { at: $.beat(\"in\", 1.3), kind: \"hit\", level: 1.1 }, // lands with the motion: use the same times\n { at: 1.5, kind: \"shimmer\", dur: 1.2, pan: 0.3 },\n { at: 2.0, kind: \"ding\", note: \"A5\", level: 0.6 },\n ],\n bed: { key: \"D\", mode: \"minor\", from: 0.8, to: -0.4, level: 0.5, tone: 0.4 }, // a pad under it all (true, \"Dm\", or none)\n auto: false, // true adds the cues read from the motion on top (the default only when no cues are given)\n level: 1, // master, 0\u20132\n room: 0.25, // the reverb, 0 dry \u2026 1 wet\n };\n }\n\n It runs once with $ at t = 0, so $.dur, $.beat(name), $.at(word), $.data and $.words are all there \u2014 time\n the sound off the same beats the picture uses. Returning just an array of cues is fine too.\n\nCues: { at, kind, dur, level (0\u20132, 1 = the kind's own), pitch (semitones), note (\"A4\", tone/chord/ding), pan (-1\u20261), seed }\nKinds: whoosh (air past, dur .45) \u00B7 hit (impact) \u00B7 stamp (heavy slam) \u00B7 pop (bubble) \u00B7 tick (tiny click) \u00B7 click (UI)\n riser (climbs into a moment, dur 1) \u00B7 fall (downlifter, dur .8) \u00B7 sub (low drop) \u00B7 shimmer (sparkle, dur 1.2)\n ding (bell) \u00B7 swell (soft air, dur .8) \u00B7 zap (glitch, dur .28) \u00B7 type (keys for dur) \u00B7 scratch (pencil for dur)\n tone (a note for dur) \u00B7 chord (the bed's chord for dur)\nThe bed steps back under every hit, stamp, sub and pop and comes back on its own. Keep a graphic's sound honest:\none riser into its biggest moment, a hit or a sub when it lands, ticks for the small things, silence between.\n\nCLI volito render --sound [--bed Dm] [--sound-level 1.2] [--sound-out track.wav]\n volito sound --out track.wav the track alone, with its cue list\nAPI renderVideo(item, { sound: true, bed: \"Dm\" }) \u00B7 renderSoundFile(item, { out: \"track.wav\" })"; /** How Volito items and packs are written — what `volito guide` and the MCP motion_api tool print after the API. */ declare const AUTHORING_GUIDE = "Writing Volito graphics\n\nA graphic is a program: plain JavaScript that defines function frame(t, $) and returns the SVG markup of\none frame (no root). It is a pure function of t \u2014 any frame can be drawn alone, in any order \u2014 so it\nrenders the same in MONARC PRO, in a browser and from this CLI.\n\nProps and moments\n An item's props arrive as $.data (const p = $.data; p.name, p.role \u2026). Never hard-code text a creator\n would change: make it a prop with a default and a maxLength the design can hold.\n Named moments come from $.beat(name, fallback). Pack items read \"in\" (when the entrance starts) and\n \"out\" (when the exit starts) so a creator can move them: --beat in=0.4 --beat out=-0.6.\n When words are given (a transcript), land each element 0.04\u20130.12 s before the word that says it:\n $.words.length ? $.atOr(firstWord, fallback) : fallback. Without words, use the beats.\n\nParts\n Draw each element through the motion kit (const M = motion($, t)) as a named part, with the item's own\n motion as defaults: M.part(\"plate\", { at, in: \"wipe\", box }, markup), M.text(\"name\", { ...font, at, in: \"rise\" }, text).\n List the parts in item.json (\"parts\": { \"plate\": \"the card\" }) so creators know what they can move.\n Backgrounds (scrims, panels) pass vary: false so a mood leaves them still.\n\nShape of a good item\n - Enter in the first ~0.8 s, hold, leave in the last ~0.4 s (or hold to the end when out \u2265 duration).\n - Lay out from $.W, $.H and scale every size by $.k (= min(W, H) / 1080): one design fits 16:9, 9:16, 1:1, 4:5.\n - Keep text inside the title-safe area: ~5% of the width at the sides on 16:9; on 9:16 leave ~13% at the\n top and ~22% at the bottom for platform UI (captions, buttons).\n - Size text to fit: measure it ($.measure) and shrink the size until it fits the box it owns; wrap long\n text with maxW. The check reports any line that runs off the frame.\n - Colour comes from the brand: $.c.bg / $.c.fg for ground and text, $.c.accent for the one thing that\n matters, $.c.accent2 for markers, $.c.surface for cards. Faces from $.font(\"display\" | \"text\" | \"mono\").\n $.case(str) applies the brand's case. Never invent colours \u2014 a creator's DESIGN.md re-skins the item.\n - overlay items draw nothing behind themselves (footage shows through); put a $.scrim under text that sits\n on footage. full items draw their own ground with $.panel(t, { box: { x: 0, y: 0, w: $.W, h: $.H } }).\n - Escape any text you put in raw markup with $.esc(); $.text, $.chip and friends escape for you.\n\nAn item on disk\n my-item/item.json { \"id\": \"my-item\", \"name\": \"\u2026\", \"description\": \"\u2026\", \"category\": \"title\",\n \"placement\": \"overlay\" | \"full\", \"duration\": { \"default\": 5, \"min\": 2, \"max\": 20 },\n \"aspects\": [\"16:9\", \"9:16\", \"1:1\", \"4:5\"],\n \"props\": { \"title\": { \"type\": \"text\", \"default\": \"Hello\", \"maxLength\": 28 } },\n \"beats\": { \"in\": 0.15, \"out\": -0.45 } }\n my-item/frame.js function frame(t, $) { const p = $.data; \u2026 return svg; }\n Prop types: text, longtext (line breaks kept), number (min, max, step), boolean, choice (options),\n color (#hex, \"\" = the brand's), list (rows of text, or of {field: \"text\" | \"number\"}; maxItems),\n image (a path or URL the caller loads; draw it with $.image(propName, x, y, w, h)), icon (an icon name).\n\nA pack\n my-pack/pack.json { \"format\": 1, \"id\": \"my-pack\", \"name\": \"\u2026\", \"version\": \"1.0.0\", \"description\": \"\u2026\",\n \"author\": \"\u2026\", \"license\": \"\u2026\", \"style\": \"ember\", \"shared\": \"shared.js\",\n \"items\": [\"my-item\", \u2026] }\n my-pack/shared.js helpers prepended to every item's code (function declarations only).\n Load extra packs with --packs or VOLITO_PACKS=.\n\nThe loop\n volito new my-item a template to start from\n volito check ./my-item errors and warnings at every aspect\n volito sheet ./my-item frames across time in one PNG \u2014 look at it\n volito render ./my-item --format mov\n Agents: motion_check, then motion_preview, fix what you see, then motion_render."; export { ASPECTS, ASPECT_NAMES, AUTHORING_GUIDE, BUILTIN_STYLES, CAPTION_FRAME_MS, CATEGORIES, DIRECTIONS, EASES, EDITOR_STYLES, FORMAT_NOTES, FfmpegMissing, GraphicSpecSchema, HITS, IDLES, LIBRARY_GUIDE, MAX_CUES, MG_API_REFERENCE, MG_ICON_NAMES, MG_SPRITE_NAMES, MOODS, MOTION_FORMAT, MOTION_GUIDE, MOTION_KIT_CODE, MOVES, MOVE_NOTES, MotionError, ORDERS, ORIGINS, PATTERN_NAMES, PATTERN_WORDS, ProgramError, ProgramRunner, SOUND_GUIDE, SOUND_KINDS, SOUND_NOTES, SPEC_SCHEMA_URL, SPEC_VERSION, SPLITS, VIDEO_FORMATS, bedOf, buildProgram, builtinPacks, canvasFor, captionFrameCost, checkItem, composeDesignMd, cueData, cuesFromMarks, customItem, defaultOutput, describeCues, describeItem, describeReport, designSound, findItem, fontsDir, formatFromPath, frameDocument, isSpecFile, itemOfSpec, library, loadImage, loadMedia, loadPack, loadSpecFile, makeItem, manifestProblems, normalizeMotion, normalizeSoundSpec, normalizeWords, noteHz, openSession, packageVersion, packsIn, parseAspect, parseDesignMd, parseKey, parseMotionArgs, parseSpec, probeFfmpeg, readStyleArg, readWords, renderSheet, renderSound, renderSoundFile, renderStill, renderVideo, resolveProps, resolveStyle, searchItems, sheetTimes, soundHookAvailable, specFrom, specJsonSchema, specToOptions, validateSpec, wavEncode }; export type { Aspect, AspectReport, BuildOptions, BuiltProgram, CaptionCost, CaptionCue, Category, CheckReport, GraphicSpec, ItemManifest, ItemQuery, Library, LoadedSpec, MotionConfig, MotionInput, MotionItem, MotionOverrides, MotionPack, MotionSpec, PackManifest, PatternName, Placement, PropSpec, PropType, RenderOptions, RenderedSound, SoundBed, SoundCue, SoundKind, SoundResult, SoundSpec, SpecIssue, SpecReport, StillFormat, StillResult, StyleInput, StyleOverrides, TraceMark, VideoFormat, VideoResult };