onda-engine 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,101 @@
1
+ export { DURATION, DurationToken, OVERSHOOT, SPRING_SMOOTH, SPRING_SNAPPY, STAGGER, staggerFrames } from './motion.js';
2
+ export { HOUSE_EASE } from './easing.js';
3
+ export { TIME_DESCRIPTION, TimeInput, framesOf, timeSchema } from './time.js';
4
+ export { COMPONENT_SETTLE, FitToClipOpts, SettleFn, settleTime, staggeredSettle, useTimeScale } from './timing.js';
5
+ export { FontMetrics, GlyphInfo, MeasureOpts, TextMetrics, fontMetrics, glyphLayout, loadFont, measureText, preloadTextMetrics, useFontMetrics, useGlyphLayout, useTextMetrics, useTextMetricsReady } from './text-metrics.js';
6
+ export { Divergence, DivergenceOpts, RenderBackend, divergenceReport, matchesExport } from './divergence.js';
7
+ export { Backend, COMPONENT_FIDELITY, ComponentFidelity, ENGINE_CAPABILITIES, FIDELITY_SUMMARY, Fidelity, RECOMMENDED_PALETTE } from './fidelity.js';
8
+ export { MANIFEST, MANIFEST_NAMES, ManifestEntry, PropMeta, compactCatalog, firstClassEntries, manifestEntry } from './manifest.js';
9
+ export { GlyphCell, GlyphLine, GlyphLineOpts, LINE_RATIO, layoutGlyphLine, lineStartX, lineTopY } from './glyph-line.js';
10
+ export { FitOpts, ResolvedBounds, fitFontSize, fitMaxWidth, useFittedFontSize, useResolvedBounds } from './bounds.js';
11
+ export { ElementSize, FrameSize, PLACEMENT_DESCRIPTION, PLACEMENT_REGIONS, Placed, PlacedProps, Placement, PlacementPoint, PlacementRegion, PlacementShift, PlacementShiftProps, ResolvedPlacement, SAFE_MARGIN, isPlacement, placementSchema, resolvePlacement, usePlacement } from './placement.js';
12
+ export { Theme, ThemeProvider, ThemeProviderProps, defaultTheme, useTheme } from './theme.js';
13
+ export { Motion, PatternInput, entryFade, entryFadeRise, entryScale, entrySlide, exitFade, exitFadeFall, exitScale, exitSlide, heroReveal, stateSwap } from './choreography.js';
14
+ export { EntranceOptions, EntranceType, useEntrance, useSceneProgress, useSpringValue, useStaggeredEntrance, useTextReveal } from './hooks.js';
15
+ export { AudioAnalyzer, Beats, BeatsHandle, beatPulse, framesSinceBeat, isBeat, useAudioBeats, useAudioData } from './audio.js';
16
+ export { AudioClip, AudioClipProps } from './components/AudioClip.js';
17
+ export { AudioVisualizer, AudioVisualizerProps } from './components/AudioVisualizer.js';
18
+ export { BarChart, BarChartDatum, BarChartProps } from './components/BarChart.js';
19
+ export { BentoGrid, BentoGridProps, BentoItem } from './components/BentoGrid.js';
20
+ export { BlurReveal, BlurRevealProps } from './components/BlurReveal.js';
21
+ export { BoundingBox, BoundingBoxProps } from './components/BoundingBox.js';
22
+ export { BrowserFrame, BrowserFrameProps } from './components/BrowserFrame.js';
23
+ export { Button, ButtonProps } from './components/Button.js';
24
+ export { Callout, CalloutDirection, CalloutProps } from './components/Callout.js';
25
+ export { CameraShake, CameraShakeProps } from './components/CameraShake.js';
26
+ export { CardShowcase, CardShowcaseProps } from './components/CardShowcase.js';
27
+ export { CaptionEntry, Captions, CaptionsProps } from './components/Captions.js';
28
+ export { ChapterCard, ChapterCardProps } from './components/ChapterCard.js';
29
+ export { CodeBlock, CodeBlockProps } from './components/CodeBlock.js';
30
+ export { CodeDiff, CodeDiffProps, DiffLine, DiffLineType } from './components/CodeDiff.js';
31
+ export { Confetti, ConfettiProps } from './components/Confetti.js';
32
+ export { CountUp, CountUpProps } from './components/CountUp.js';
33
+ export { Cursor, CursorProps } from './components/Cursor.js';
34
+ export { DeviceFrame, DeviceFrameProps } from './components/DeviceFrame.js';
35
+ export { DrawOn, DrawOnProps } from './components/DrawOn.js';
36
+ export { DynamicGrid, DynamicGridProps } from './components/DynamicGrid.js';
37
+ export { EndCard, EndCardProps } from './components/EndCard.js';
38
+ export { FadeIn, FadeInProps } from './components/FadeIn.js';
39
+ export { FadeOut, FadeOutProps } from './components/FadeOut.js';
40
+ export { FilmGrade, FilmGradeProps, FilmLook } from './components/FilmGrade.js';
41
+ export { GradientShift, GradientShiftProps } from './components/GradientShift.js';
42
+ export { GrainOverlay, GrainOverlayProps } from './components/GrainOverlay.js';
43
+ export { Highlight, HighlightProps } from './components/Highlight.js';
44
+ export { IconPop, IconPopProps, IconShape } from './components/IconPop.js';
45
+ export { ImageReveal, ImageRevealFit, ImageRevealMotion, ImageRevealProps } from './components/ImageReveal.js';
46
+ export { InputField, InputFieldProps } from './components/InputField.js';
47
+ export { KanbanBoard, KanbanBoardProps, KanbanColumn } from './components/KanbanBoard.js';
48
+ export { KenBurns, KenBurnsProps } from './components/KenBurns.js';
49
+ export { Ease, Keyframes, KeyframesImageContent, KeyframesProps, KeyframesTextContent, PosKey, ValKey } from './components/Keyframes.js';
50
+ export { KeyframeTracks, SampledKeyframes, hasKeyframeTracks, sampleKeyframes, sampleTrack } from './keyframes-sampler.js';
51
+ export { Box, ResponsiveTransform, entryDesignAnchor, responsiveEntryTransform } from './responsive.js';
52
+ export { KineticText, KineticTextPreset, KineticTextProps } from './components/KineticText.js';
53
+ export { LineChart, LineChartProps } from './components/LineChart.js';
54
+ export { LogoReveal, LogoRevealPreset, LogoRevealProps } from './components/LogoReveal.js';
55
+ export { LogoSting, LogoStingProps } from './components/LogoSting.js';
56
+ export { LookbookLayout, LookbookShot, LookbookShotProps } from './components/LookbookShot.js';
57
+ export { LowerThird, LowerThirdProps } from './components/LowerThird.js';
58
+ export { Marquee, MarqueeProps } from './components/Marquee.js';
59
+ export { MaskReveal, MaskRevealProps } from './components/MaskReveal.js';
60
+ export { MatrixDecode, MatrixDecodeProps } from './components/MatrixDecode.js';
61
+ export { MeshGradient, MeshGradientProps } from './components/MeshGradient.js';
62
+ export { Moodboard, MoodboardProps } from './components/Moodboard.js';
63
+ export { NodeGraph, NodeGraphProps, Satellite } from './components/NodeGraph.js';
64
+ export { Parallax, ParallaxLayer, ParallaxProps } from './components/Parallax.js';
65
+ export { PathMorph, PathMorphProps } from './components/PathMorph.js';
66
+ export { PieReveal, PieRevealProps, PieRevealSlice } from './components/PieReveal.js';
67
+ export { PriceTag, PriceTagProps } from './components/PriceTag.js';
68
+ export { PricingCard, PricingCardProps } from './components/PricingCard.js';
69
+ export { ProductWall, ProductWallProps } from './components/ProductWall.js';
70
+ export { ProgressBar, ProgressBarProps } from './components/ProgressBar.js';
71
+ export { ProgressSteps, ProgressStepsProps } from './components/ProgressSteps.js';
72
+ export { PulsingIndicator, PulsingIndicatorProps } from './components/PulsingIndicator.js';
73
+ export { QuoteCard, QuoteCardProps } from './components/QuoteCard.js';
74
+ export { RgbGlitch, RgbGlitchProps } from './components/RgbGlitch.js';
75
+ export { RotateIn, RotateInProps } from './components/RotateIn.js';
76
+ export { ScaleIn, ScaleInProps } from './components/ScaleIn.js';
77
+ export { Scrim, ScrimProps } from './components/Scrim.js';
78
+ export { SiteReveal, SiteRevealProps } from './components/SiteReveal.js';
79
+ export { ShimmerSweep, ShimmerSweepProps } from './components/ShimmerSweep.js';
80
+ export { SkeletonCard, SkeletonCardProps } from './components/SkeletonCard.js';
81
+ export { SlideIn, SlideInProps } from './components/SlideIn.js';
82
+ export { SlideOut, SlideOutProps } from './components/SlideOut.js';
83
+ export { SlotMachineRoll, SlotMachineRollProps } from './components/SlotMachineRoll.js';
84
+ export { SplitScreen, SplitScreenProps } from './components/SplitScreen.js';
85
+ export { Spotlight, SpotlightProps } from './components/Spotlight.js';
86
+ export { SpotlightCard, SpotlightCardProps } from './components/SpotlightCard.js';
87
+ export { StaggerGroup, StaggerGroupProps } from './components/StaggerGroup.js';
88
+ export { SplitLockup, SplitLockupProps } from './components/SplitLockup.js';
89
+ export { StatCard, StatCardProps } from './components/StatCard.js';
90
+ export { Terminal, TerminalProps } from './components/Terminal.js';
91
+ export { TextAnimate, TextAnimator, TextAnimatorDirection, TextAnimatorProps, TextAnimatorUnit } from './components/TextAnimator.js';
92
+ export { TextFadeReplace, TextFadeReplaceProps } from './components/TextFadeReplace.js';
93
+ export { Timeline, TimelineEvent, TimelineProps } from './components/Timeline.js';
94
+ export { TitleCard, TitleCardProps } from './components/TitleCard.js';
95
+ export { TrackingIn, TrackingInProps } from './components/TrackingIn.js';
96
+ export { Typewriter, TypewriterProps } from './components/Typewriter.js';
97
+ export { Underline, UnderlineProps } from './components/Underline.js';
98
+ export { VideoClip, VideoClipProps } from './components/VideoClip.js';
99
+ export { Vignette, VignetteProps } from './components/Vignette.js';
100
+ export { WordRotate, WordRotateProps } from './components/WordRotate.js';
101
+ export { WordStagger, WordStaggerProps } from './components/WordStagger.js';
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from 'onda-engine/components';
2
+ //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
@@ -0,0 +1,131 @@
1
+ import { z } from 'zod';
2
+
3
+ type Fidelity = 'first_class' | 'degraded' | 'apes_remotion';
4
+ type Backend = 'both' | 'gpu_only';
5
+ interface ComponentFidelity {
6
+ fidelity: Fidelity;
7
+ engineNative: boolean;
8
+ needsFeature: string | null;
9
+ backend: Backend;
10
+ }
11
+ declare const COMPONENT_FIDELITY: Record<string, ComponentFidelity>;
12
+ declare const FIDELITY_SUMMARY: {
13
+ readonly firstClass: 72;
14
+ readonly degraded: 0;
15
+ readonly apesRemotion: 0;
16
+ };
17
+ /** The safe, recommended palette: every first-class component. An agent can
18
+ * default to these in one read and only escalate to degraded ones on demand. */
19
+ declare const RECOMMENDED_PALETTE: readonly string[];
20
+ /** Engine capability statement — what the agent should lean on, and what it must
21
+ * NOT author for. The "don't chase" features want a filter/blend/3D pipeline the
22
+ * vector engine deliberately omits; the engine's job is the best deterministic
23
+ * GPU vector renderer, not a headless browser. */
24
+ declare const ENGINE_CAPABILITIES: {
25
+ readonly supported: readonly ["vector fills / strokes (cap/join/dash) / rounded-rect / arbitrary Bézier paths", "linear + radial gradients with stops (CPU + GPU)", "per-glyph vector text (resolution-independent) with letter-spacing / tracking", "author-time text metrics (measureText width; fontMetrics capHeight/xHeight/capTop; glyphLayout kerning-accurate per-char positions)", "taffy flexbox layout (direction/justify/align/gap/padding/wrap)", "2D affine transforms (translate / scale / rotate) with transform-origin pivot", "clipping (rect / ellipse / path) in local space", "images + video frames with cover/contain/fill fit", "audio decode + FFT spectrum (symphonia + rustfft) + multi-track mix + mux into export", "AUDIO-DRIVEN MOTION (sync to music) — `useAudioBeats(src)` analyzes a clip into `{ tempo, beats, onsets, onsetEnv }` in FRAME units (deterministic, preview == export). Drive motion with the pure helper `beatPulse(frame, beats, decay)` (a 1→0 punch on each beat): `scaleX={1 + 0.3 * beatPulse(frame, b.beats)}` HITS an element on the beat; `isBeat(frame, beats)` for hard cuts; `onsetEnv[frame]` (0..1) for transient-driven glows. The \"edited TO the music\" layer — cut on the beat, punch on the kick, drop text on a transient. Both backends + live preview", "deterministic CPU==GPU verification; parallel frame export", "blend modes (multiply / screen / overlay / soft-light / …, GPU)", "procedural film grain (onda-noise source + overlay blend, GPU)", "drop-shadow / glow (analytic blurred rounded-rect)", "animated image blur — gaussian focus-pull in the image pass (CPU+GPU+native byte-identical)", "content/text blur — screen-space gaussian over an arbitrary subtree (Group/Text/…) via the render-to-texture pass; the `blur` sugar prop, ramps for soft→sharp reveals (CPU+GPU)", "backdrop blur — frosted-glass blur of what is BEHIND a node (CSS `backdrop-filter`); the `backdropBlur` node prop samples the already-composited backdrop, blurs + tints + brightens it, and draws it as the node’s backing (Vello samples the rendered backdrop, the CPU reference its live framebuffer)", "mattes / masks — reveal one subtree THROUGH another's shape (CSS mask-image / SVG mask): the `matte` node prop (+ matteMode 'alpha'|'luminance') renders content + matte to textures and multiplies alpha — media-through-type, shape wipes, gradient reveals (render-to-texture)", "precomp / adjustment layers — `<Precomp>` flattens a subtree to ONE layer (render-to-texture) so its opacity/blend apply to the COMPOSITED result, not per-child (fixes fading-a-group double-darkening overlaps; AE precomp / collapse-transformations); an adjustment layer = a `<Group>` with an effect wrapping the layers below it. Both backends", "bloom / glow — bright-pass → large-σ blur → additive composite, the single biggest premium tell; the `bloom` node prop (CPU+GPU)", "cinematic color grade — per-pixel exposure / contrast / saturation / temperature / tint; the `grade` node prop, the \"land mixed/AI media into one look\" wedge (CPU+GPU)", "goo / metaball morph — blur → alpha-threshold so overlapping shapes fuse into liquid forms with smooth necks; the `goo` node prop (GPU)", "light-wrap — the blurred backdrop's light bleeds onto a cut-out node's feathered EDGES (the #1 'shot in, not pasted on' tell for landing a plate); the `lightWrap` node prop (GPU/export)", "directional / motion blur — a 1D gaussian smear of std-dev σ along an angle (the in-motion streak); the `directionalBlur` node prop (CPU+GPU)", "per-pixel stylize, one shared compute pipeline: `chromaticAberration` (lens RGB split), `vignette` (radial edge darkening), `posterize` (quantize to N levels), `duotone` (luminance → two colors), `chromaKey` (green-screen knock-out with despill) — all CPU+GPU node props", "fBm fractal-noise ANIMATED gradients (GPU compute over 2D simplex + domain-warp); CPU reference + WebGPU preview degrade to a smooth gradient, so judge on the native render", "composition-level cinematic FINISH — a scene-linear HDR chain (bloom + warm halation + grade + vignette + grain) ending in ONE ACES film tone-map; the \"looks shot\" output transform via `<Composition finish={…}>` (GPU/export-only — preview/CPU render un-finished)", "per-object MOTION BLUR — shutter-angle temporal supersampling via `<Composition motionBlur={…}>`: every moving element smears by its OWN motion (translation/rotation/scale), static stays sharp (export-only, N× render cost)", "trim paths — `trimStart`/`trimEnd`/`trimOffset` (0..1) on any stroked shape draw only that arc-length slice of the outline; the mograph line-draw, animate `trimEnd` 0→1 (CPU+GPU)", "repeater — `<Repeater count offsetX offsetY rotation scale startOpacity endOpacity>` stamps a subtree with COMPOUNDING transforms: grids (nest two), radial arrays, spirals, motion trails (all backends)", "boolean ops (merge paths) — `<Merge op=\"union|difference|intersect|xor\">` combines shape children into ONE outline (ring = circle−circle, lens = circle∩circle, speech bubble = rect∪triangle); curves flattened, resolved on both backends (i_overlay)", "particles — `<Particles count seed x y speed angle spread gravity lifetime emitOver loop size opacity colors spin>` is a DETERMINISTIC emitter (bursts / fountains / confetti / sparks / dust / snow): every particle is a pure function of frame+seed+index, frame-based, rendered as plain shapes (position/size/opacity/colour are CPU==GPU; `spin` is rotation → GPU-only)", "Camera — pan / zoom viewport primitive for 2.5D camera moves", "depth of field — 2.5D rack focus: layers carry a `depth`, the comp sets `dof={{ focus, aperture }}`, and each layer defocuses by its distance from the focus plane (animate `focus` for a focus pull); resolves to a per-layer blur, so both backends + live preview", "3D SCENE (3D layers + perspective camera) — `<Scene3D camera={{ position, target, fov }}>` places its children in ONE shared 3D world: each is a flat plane positioned by `position3d={[x,y,z]}` (z INTO the screen, AE convention) and tilted by `rotation3d={[x,y,z]}` degrees, viewed through a perspective camera with a real depth buffer (occlude + intersect by true depth). Camera fly-throughs, card walls / cover-flow, parallax, exploded UI. z=0 + no rotation == the 2D placement. GPU = true perspective + out-of-plane rotation; CPU/web preview degrade to a 2.5D depth-sorted projection (scale + position, no tilt) → judge 3D on a NATIVE/export render", "EXTRUDED 3D solids (3D logos & titles) — inside a `<Scene3D>`, a shape or text layer becomes a LIT 3D SOLID via `extrude={depth}`: `<Text extrude={80}>ONDA</Text>` / `<Rect extrude={80}>` / `<Path extrude={80}>` grows front + back faces (lyon-tessellated, holes handled) + side walls, shaded by a directional light so it catches the light as it rotates — the spinning solid logo / kinetic 3D title. GPU only; the CPU reference + live preview draw the flat outline → judge on a NATIVE/export render", "no-Chromium export (ffmpeg / GIF / PNG)"];
26
+ readonly unsupported: readonly [{
27
+ readonly feature: "imported 3D MODELS / glTF meshes (3D *layers* AND extruded shapes/text ARE supported via <Scene3D> + extrude)";
28
+ readonly status: "no-model-import";
29
+ }, {
30
+ readonly feature: "SVG filters / embedded text+image / gradient paint";
31
+ readonly status: "flattened-to-solid";
32
+ }, {
33
+ readonly feature: "color / emoji glyphs / variable fonts";
34
+ readonly status: "outline-only";
35
+ }];
36
+ readonly backendNotes: "CPU reference (tiny-skia) renders fills, strokes (cap/join/dash), linear+radial gradients, and Bézier paths — byte-identical to Vello for those. It does NOT apply rotation or clipping (Vello-only) or decode video. A 'gpu_only' component needs one of those three; prefer 'both' components for a CPU-verified render.";
37
+ };
38
+
39
+ /** Per-prop semantic metadata layered on top of the Zod schema. */
40
+ interface PropMeta {
41
+ /** Prop name. */
42
+ name: string;
43
+ /** Underlying value kind — string | number | int | boolean | enum | stringArray … */
44
+ type: string;
45
+ /** Semantic role — text | color | fontSize | durationFrames | fraction | url … */
46
+ role: string;
47
+ /** Allowed values, when the prop is an enum. */
48
+ enumValues?: string[];
49
+ /** The default value (schema-derived, JSON-encoded), when the prop has one.
50
+ * Always sourced from the Zod schema so it can't drift from what renders. */
51
+ default?: string;
52
+ /** Minimum (inclusive) for a number prop, from the Zod schema. */
53
+ min?: number;
54
+ /** Maximum (inclusive) for a number prop, from the Zod schema. */
55
+ max?: number;
56
+ /** Display-unit hint for a number prop — 'px' | 'frames' | 'deg'. */
57
+ unit?: string;
58
+ /** Defaults to a theme color/font token; the agent should usually OMIT it. */
59
+ themeable: boolean;
60
+ /** Must be provided (no default, not optional). */
61
+ required: boolean;
62
+ /** One-line description. */
63
+ description: string;
64
+ }
65
+ /** One catalog entry: identity + curation + capability + the @onda prop schema. */
66
+ interface ManifestEntry {
67
+ /** kebab-case slug — the scene-graph `component` value. */
68
+ slug: string;
69
+ /** PascalCase component name — the `@onda-engine/components` export. */
70
+ name: string;
71
+ /** Grouping for the catalog/agent (Text, Data, Media, …). */
72
+ category: string;
73
+ /** Short human title. */
74
+ title: string;
75
+ /** One-line description for the agent catalog. */
76
+ description: string;
77
+ /** When the agent should reach for this. */
78
+ pickWhen: string;
79
+ /** Components it commonly composes/pairs with. */
80
+ composes: string[];
81
+ /** How it sits in a scene (background | block | overlay | annotation | …). */
82
+ sceneRole: string;
83
+ /** full_frame (fills the canvas) | non_occluding (decorates) | centered. */
84
+ occlusion: string;
85
+ /** Render fidelity — the agent prefers `first_class`. From `fidelity.ts`. */
86
+ fidelity: Fidelity;
87
+ /** `both` (CPU==GPU) | `gpu_only`. From `fidelity.ts`. */
88
+ backend: Backend;
89
+ /** True when the look is engine-native (not a CSS-effect approximation). */
90
+ engineNative: boolean;
91
+ /** A good example prop set (few-shot for the agent). */
92
+ example: Record<string, unknown>;
93
+ /** Per-prop semantic metadata (alongside the Zod schema). */
94
+ props: PropMeta[];
95
+ /** The @onda-native Zod schema for this component's props. */
96
+ schema: z.ZodTypeAny;
97
+ }
98
+ /** The catalog — RAW entries enriched with the live fidelity rating + the
99
+ * schema-reconciled prop list (so curated `props` can never drift from `schema`). */
100
+ declare const MANIFEST: ManifestEntry[];
101
+ /** The PascalCase names of every catalogued component. */
102
+ declare const MANIFEST_NAMES: readonly string[];
103
+ /** A capability the director APPLIES (a verb), vs. a `MANIFEST` component (a noun). */
104
+ interface Capability {
105
+ /** Stable id. */
106
+ id: string;
107
+ /** composition (whole-comp) | effect (per-node) | 3d | audio. */
108
+ category: 'composition' | 'effect' | '3d' | 'audio';
109
+ /** Short title. */
110
+ title: string;
111
+ /** What it does + when to reach for it. */
112
+ description: string;
113
+ /** HOW to apply it — the prop/option/API, with a concrete example. */
114
+ apply: string;
115
+ /** `both` = CPU==GPU + live preview | `gpu` = needs Vello | `export` = N×-cost, export-only. */
116
+ backend: 'both' | 'gpu' | 'export';
117
+ /** A caveat the agent MUST respect (e.g. judge the look on a native render). */
118
+ note?: string;
119
+ }
120
+ declare const CAPABILITIES: Capability[];
121
+ /** Look up a manifest entry by slug or PascalCase name. */
122
+ declare function manifestEntry(key: string): ManifestEntry | undefined;
123
+ /** Only the first-class components — the agent's safe default palette. */
124
+ declare function firstClassEntries(): ManifestEntry[];
125
+ /** A compact, grouped text catalog for the agent prompt: one bullet per
126
+ * component with its fidelity, when-to-use, and its prop roles. */
127
+ declare function compactCatalog(opts?: {
128
+ firstClassOnly?: boolean;
129
+ }): string;
130
+
131
+ export { type Backend as B, COMPONENT_FIDELITY as C, ENGINE_CAPABILITIES as E, FIDELITY_SUMMARY as F, MANIFEST as M, type PropMeta as P, RECOMMENDED_PALETTE as R, type ComponentFidelity as a, type Fidelity as b, MANIFEST_NAMES as c, type ManifestEntry as d, compactCatalog as e, firstClassEntries as f, CAPABILITIES as g, type Capability as h, manifestEntry as m };
@@ -0,0 +1,177 @@
1
+ import { Scene, Color } from './scene.js';
2
+ import * as react from 'react';
3
+ import { ReactElement } from 'react';
4
+
5
+ /** Paints a scene onto a 2D context. The default is {@link drawScene}; the
6
+ * playground and `<Player>` swap in a WASM-engine drawer (real renderer →
7
+ * `putImageData`) when `@onda-engine/wasm` is present. */
8
+ type FrameDrawer = (ctx: CanvasRenderingContext2D, scene: Scene) => void;
9
+ /** Draw `scene` onto `ctx`, clearing first. The context should be sized to the
10
+ * composition's resolution. */
11
+ declare function drawScene(ctx: CanvasRenderingContext2D, scene: Scene): void;
12
+ /** Convert the engine's 0..1 straight-alpha sRGB color to a CSS `rgba()`. */
13
+ declare function cssColor(color: Color): string;
14
+
15
+ /** A rendered frame as returned by `@onda-engine/wasm`'s `OndaEngine.render`: a flat
16
+ * straight-alpha RGBA8 buffer plus dimensions. */
17
+ interface RenderedFrame {
18
+ readonly width: number;
19
+ readonly height: number;
20
+ readonly pixels: Uint8Array | Uint8ClampedArray;
21
+ }
22
+ /** The minimal shape of `@onda-engine/wasm`'s `OndaEngine` the player needs. Structural
23
+ * typing avoids a build/runtime dependency on the wasm package. */
24
+ interface RenderEngine {
25
+ /** Rasterize a scene-graph JSON document to RGBA8 pixels. */
26
+ render(sceneJson: string): RenderedFrame;
27
+ }
28
+ /**
29
+ * Build a {@link FrameDrawer} that paints each frame with the real ONDA engine
30
+ * (`@onda-engine/wasm`). Construct the engine once and memoize the returned drawer:
31
+ *
32
+ * ```tsx
33
+ * import { OndaEngine, default as initWasm } from '@onda-engine/wasm'
34
+ * import wasmUrl from '@onda-engine/wasm/pkg/onda_wasm_bg.wasm?url'
35
+ * import { Player, engineDrawer } from '@onda-engine/player'
36
+ *
37
+ * await initWasm(wasmUrl)
38
+ * const engine = new OndaEngine()
39
+ * const draw = engineDrawer(engine) // memoize with useMemo in components
40
+ *
41
+ * <Player composition={hello} draw={draw} />
42
+ * ```
43
+ *
44
+ * The engine renders the scene to RGBA8 and the drawer blits it with
45
+ * `putImageData` — pixel-exact, the real renderer.
46
+ */
47
+ declare function engineDrawer(engine: RenderEngine): FrameDrawer;
48
+
49
+ /** An async, GPU renderer — structurally `@onda-engine/wasm-vello`'s `VelloEngine`.
50
+ * This is the pixel-exact, full-feature path (paths/gradients/clips/AA), so the
51
+ * Player prefers it. Accepted structurally so `@onda-engine/player` needn't depend on
52
+ * `@onda-engine/wasm-vello`. */
53
+ interface GpuEngine {
54
+ render(sceneJson: string): Promise<{
55
+ width: number;
56
+ height: number;
57
+ pixels: Uint8Array;
58
+ }>;
59
+ /** Optional: load a custom font (`.ttf`/`.otf` bytes) so the live preview draws
60
+ * with the same fonts the export will. `@onda-engine/wasm-vello`'s `VelloEngine` exposes
61
+ * `load_font`; `@onda-engine/wasm`'s `OndaEngine` exposes `loadFont` — the Player drains
62
+ * the `@onda-engine/react` font registry into whichever exists. */
63
+ loadFont?(data: Uint8Array): unknown;
64
+ load_font?(data: Uint8Array): unknown;
65
+ }
66
+ interface PlayerProps {
67
+ /** A `<Composition>` element (from `@onda-engine/react`). */
68
+ composition: ReactElement;
69
+ /** Start playing on mount. Default `true`. */
70
+ autoPlay?: boolean;
71
+ /** Loop back to frame 0 at the end. Default `true`. Also toggleable in the UI. */
72
+ loop?: boolean;
73
+ /**
74
+ * The renderer. The Player auto-selects the best available, in order:
75
+ * 1. an explicit {@link PlayerProps.draw},
76
+ * 2. the GPU engine ({@link PlayerProps.gpuEngine}) — Vello/WebGPU,
77
+ * pixel-identical to `onda export`,
78
+ * 3. the CPU engine ({@link PlayerProps.engine}),
79
+ * 4. the Canvas2D {@link drawScene} fallback.
80
+ * It also falls back automatically if a renderer errors at runtime.
81
+ */
82
+ draw?: FrameDrawer;
83
+ /** The GPU (Vello/WebGPU) renderer — preferred when present (see {@link GpuEngine}). */
84
+ gpuEngine?: GpuEngine;
85
+ /** The CPU renderer (`@onda-engine/wasm`'s `OndaEngine`) — fallback when there's no GPU. */
86
+ engine?: RenderEngine;
87
+ /** Show a small backend indicator (WebGPU/CPU/Canvas2D). Default `true`. */
88
+ showStatus?: boolean;
89
+ /** Control visibility. `'auto'` (default) reveals the controls on hover / focus
90
+ * / when paused; `'always'` keeps them visible; `'none'` hides them entirely
91
+ * (no overlay, no fullscreen button, no click-to-toggle) — a chrome-free
92
+ * thumbnail (e.g. a gallery tile that plays on hover + clicks through to a link). */
93
+ controls?: 'auto' | 'always' | 'none';
94
+ /** Accessible label for the player region. Default `"ONDA composition player"`. */
95
+ label?: string;
96
+ /** Optional className on the root for app-level layout/overrides. */
97
+ className?: string;
98
+ /** Frame to start on. Default `0`. Clamped to the composition length. */
99
+ initialFrame?: number;
100
+ /** Initial playback speed (preview only — does NOT change the exported video,
101
+ * which always renders 1× at the composition fps). `1` = real-time. Forward
102
+ * presets in the UI are 0.25×–2×; programmatic values clamp to 0.1×–4×.
103
+ * Default `1`. */
104
+ playbackRate?: number;
105
+ /** Called whenever the current frame changes (scrub or playback). */
106
+ onFrameUpdate?: (frame: number) => void;
107
+ /** Called when playback starts. */
108
+ onPlay?: () => void;
109
+ /** Called when playback pauses (or stops at the end of a non-looping clip). */
110
+ onPause?: () => void;
111
+ }
112
+ /**
113
+ * Imperative handle for `<Player>` (via `ref`) — drive playback from a host app
114
+ * such as an editor timeline.
115
+ *
116
+ * @example
117
+ * ```tsx
118
+ * const ref = useRef<PlayerHandle>(null)
119
+ * <Player ref={ref} composition={…} />
120
+ * ref.current?.seekTo(48)
121
+ * ```
122
+ */
123
+ /** Player events (Remotion-`@remotion/player`-compatible) for a host editor to
124
+ * sync against — e.g. a canvas overlay tracking the current frame. */
125
+ type PlayerEventType = 'frameupdate' | 'play' | 'pause' | 'seeked' | 'ended' | 'ratechange';
126
+ /** Event passed to a {@link PlayerEventListener}: `detail.frame` is the current
127
+ * frame (mirrors Remotion's `CallbackListener` event shape). For `ratechange`,
128
+ * `detail.playbackRate` carries the new preview speed. */
129
+ interface PlayerEvent {
130
+ type: PlayerEventType;
131
+ detail: {
132
+ frame: number;
133
+ playbackRate?: number;
134
+ };
135
+ }
136
+ type PlayerEventListener = (event: PlayerEvent) => void;
137
+ interface PlayerHandle {
138
+ /** Seek to a frame (clamped). Does not change the play/pause state. */
139
+ seekTo(frame: number): void;
140
+ /** Start playing (restarts from 0 if at the end of a non-looping clip). */
141
+ play(): void;
142
+ /** Pause playback. */
143
+ pause(): void;
144
+ /** Toggle play/pause. */
145
+ toggle(): void;
146
+ /** The current frame. */
147
+ getCurrentFrame(): number;
148
+ /** Total frames in the composition. */
149
+ getTotalFrames(): number;
150
+ /** Whether playback is currently running. */
151
+ isPlaying(): boolean;
152
+ /** The current preview playback speed (1 = real-time). */
153
+ getPlaybackRate(): number;
154
+ /** Set the preview playback speed (clamped to 0.1×–4×). Preview only — does
155
+ * not affect export. Emits a `ratechange` event. */
156
+ setPlaybackRate(rate: number): void;
157
+ /** Subscribe to a player event
158
+ * (`frameupdate`/`play`/`pause`/`seeked`/`ended`/`ratechange`).
159
+ * Mirrors `@remotion/player`'s `addEventListener` so an editor built against
160
+ * Remotion's Player ports without rewiring its frame-sync/overlay. */
161
+ addEventListener(type: PlayerEventType, listener: PlayerEventListener): void;
162
+ /** Unsubscribe a listener previously passed to {@link addEventListener}. */
163
+ removeEventListener(type: PlayerEventType, listener: PlayerEventListener): void;
164
+ }
165
+ /**
166
+ * Render an ONDA composition to a canvas with play/pause, a frame scrubber, a
167
+ * loop toggle, and a frame/time readout.
168
+ *
169
+ * @example
170
+ * ```tsx
171
+ * import { Player } from '@onda-engine/player'
172
+ * <Player composition={<Composition …>…</Composition>} engine={ondaEngine} />
173
+ * ```
174
+ */
175
+ declare const Player: react.ForwardRefExoticComponent<PlayerProps & react.RefAttributes<PlayerHandle>>;
176
+
177
+ export { type FrameDrawer, Player, type PlayerEvent, type PlayerEventListener, type PlayerEventType, type PlayerHandle, type PlayerProps, type RenderEngine, type RenderedFrame, cssColor, drawScene, engineDrawer };