@depths/waves 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.
package/dist/index.mjs ADDED
@@ -0,0 +1,40 @@
1
+ import {
2
+ IRValidator,
3
+ WavesEngine,
4
+ __wavesVersion,
5
+ getPromptPayload,
6
+ getSystemPrompt
7
+ } from "./chunk-WGQITADJ.mjs";
8
+ import {
9
+ ComponentRegistry,
10
+ ComponentSchemas,
11
+ VideoIRSchema,
12
+ WavesError,
13
+ WavesRenderError,
14
+ WavesValidationError,
15
+ globalRegistry,
16
+ registerBuiltInComponents
17
+ } from "./chunk-TGAL5RQN.mjs";
18
+
19
+ // src/index.ts
20
+ async function renderVideo(ir, options) {
21
+ registerBuiltInComponents();
22
+ const engine = new WavesEngine(globalRegistry, new IRValidator());
23
+ await engine.render(ir, options);
24
+ }
25
+ export {
26
+ ComponentRegistry,
27
+ ComponentSchemas,
28
+ IRValidator,
29
+ VideoIRSchema,
30
+ WavesEngine,
31
+ WavesError,
32
+ WavesRenderError,
33
+ WavesValidationError,
34
+ __wavesVersion,
35
+ getPromptPayload,
36
+ getSystemPrompt,
37
+ globalRegistry,
38
+ registerBuiltInComponents,
39
+ renderVideo
40
+ };
@@ -0,0 +1,355 @@
1
+ import { z } from 'zod';
2
+ import { ComponentType } from 'react';
3
+
4
+ interface ComponentMetadata {
5
+ category: 'primitive' | 'composite' | 'template';
6
+ description: string;
7
+ llmGuidance?: string;
8
+ examples?: Array<Record<string, unknown>>;
9
+ }
10
+ interface RegisteredComponent<P = unknown> {
11
+ type: string;
12
+ component: ComponentType<P>;
13
+ propsSchema: z.ZodType<P>;
14
+ metadata: ComponentMetadata;
15
+ }
16
+ type PropsValidationResult = {
17
+ success: true;
18
+ data: unknown;
19
+ } | {
20
+ success: false;
21
+ error: z.ZodError;
22
+ };
23
+ declare class ComponentRegistry {
24
+ private readonly components;
25
+ register<P>(registration: RegisteredComponent<P>): void;
26
+ get(type: string): RegisteredComponent | undefined;
27
+ getTypes(): string[];
28
+ has(type: string): boolean;
29
+ getJSONSchemaForLLM(): Record<string, unknown>;
30
+ validateProps(type: string, props: unknown): PropsValidationResult;
31
+ }
32
+ declare const globalRegistry: ComponentRegistry;
33
+
34
+ type TimingSpec = {
35
+ from: number;
36
+ durationInFrames: number;
37
+ };
38
+ type BackgroundSpec = {
39
+ type: 'color';
40
+ value: string;
41
+ } | {
42
+ type: 'image';
43
+ value: string;
44
+ } | {
45
+ type: 'video';
46
+ value: string;
47
+ };
48
+ type BaseComponentIR = {
49
+ id: string;
50
+ type: string;
51
+ timing: TimingSpec;
52
+ metadata?: Record<string, unknown> | undefined;
53
+ };
54
+ type TextIR = BaseComponentIR & {
55
+ type: 'Text';
56
+ props: {
57
+ content: string;
58
+ fontSize?: number;
59
+ color?: string;
60
+ position?: 'top' | 'center' | 'bottom' | 'left' | 'right';
61
+ animation?: 'none' | 'fade' | 'slide' | 'zoom';
62
+ };
63
+ };
64
+ type AudioIR = BaseComponentIR & {
65
+ type: 'Audio';
66
+ props: {
67
+ src: string;
68
+ volume?: number;
69
+ startFrom?: number;
70
+ fadeIn?: number;
71
+ fadeOut?: number;
72
+ };
73
+ };
74
+ type SceneIR = BaseComponentIR & {
75
+ type: 'Scene';
76
+ props: {
77
+ background: BackgroundSpec;
78
+ };
79
+ children?: ComponentIR[] | undefined;
80
+ };
81
+ type ComponentIR = SceneIR | TextIR | AudioIR;
82
+ type VideoIR = {
83
+ version: '1.0';
84
+ video: {
85
+ id?: string;
86
+ width: number;
87
+ height: number;
88
+ fps?: number;
89
+ durationInFrames: number;
90
+ };
91
+ audio?: {
92
+ background?: string | undefined;
93
+ volume?: number | undefined;
94
+ } | undefined;
95
+ scenes: SceneIR[];
96
+ };
97
+ declare const TimingSpecSchema: z.ZodObject<{
98
+ from: z.ZodNumber;
99
+ durationInFrames: z.ZodNumber;
100
+ }, z.core.$strip>;
101
+ declare const AssetPathSchema: z.ZodString;
102
+ declare const BackgroundSpecSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
103
+ type: z.ZodLiteral<"color">;
104
+ value: z.ZodString;
105
+ }, z.core.$strip>, z.ZodObject<{
106
+ type: z.ZodLiteral<"image">;
107
+ value: z.ZodString;
108
+ }, z.core.$strip>, z.ZodObject<{
109
+ type: z.ZodLiteral<"video">;
110
+ value: z.ZodString;
111
+ }, z.core.$strip>], "type">;
112
+ declare const BaseComponentIRSchema: z.ZodObject<{
113
+ id: z.ZodString;
114
+ type: z.ZodString;
115
+ timing: z.ZodObject<{
116
+ from: z.ZodNumber;
117
+ durationInFrames: z.ZodNumber;
118
+ }, z.core.$strip>;
119
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
120
+ }, z.core.$strip>;
121
+ declare const TextComponentIRSchema: z.ZodObject<{
122
+ id: z.ZodString;
123
+ timing: z.ZodObject<{
124
+ from: z.ZodNumber;
125
+ durationInFrames: z.ZodNumber;
126
+ }, z.core.$strip>;
127
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
128
+ type: z.ZodLiteral<"Text">;
129
+ props: z.ZodObject<{
130
+ content: z.ZodString;
131
+ fontSize: z.ZodDefault<z.ZodNumber>;
132
+ color: z.ZodDefault<z.ZodString>;
133
+ position: z.ZodDefault<z.ZodEnum<{
134
+ top: "top";
135
+ center: "center";
136
+ bottom: "bottom";
137
+ left: "left";
138
+ right: "right";
139
+ }>>;
140
+ animation: z.ZodDefault<z.ZodEnum<{
141
+ fade: "fade";
142
+ none: "none";
143
+ slide: "slide";
144
+ zoom: "zoom";
145
+ }>>;
146
+ }, z.core.$strip>;
147
+ }, z.core.$strip>;
148
+ declare const AudioComponentIRSchema: z.ZodObject<{
149
+ id: z.ZodString;
150
+ timing: z.ZodObject<{
151
+ from: z.ZodNumber;
152
+ durationInFrames: z.ZodNumber;
153
+ }, z.core.$strip>;
154
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
155
+ type: z.ZodLiteral<"Audio">;
156
+ props: z.ZodObject<{
157
+ src: z.ZodString;
158
+ volume: z.ZodDefault<z.ZodNumber>;
159
+ startFrom: z.ZodDefault<z.ZodNumber>;
160
+ fadeIn: z.ZodDefault<z.ZodNumber>;
161
+ fadeOut: z.ZodDefault<z.ZodNumber>;
162
+ }, z.core.$strip>;
163
+ }, z.core.$strip>;
164
+ declare const SceneComponentIRSchema: z.ZodObject<{
165
+ id: z.ZodString;
166
+ timing: z.ZodObject<{
167
+ from: z.ZodNumber;
168
+ durationInFrames: z.ZodNumber;
169
+ }, z.core.$strip>;
170
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
171
+ type: z.ZodLiteral<"Scene">;
172
+ props: z.ZodObject<{
173
+ background: z.ZodDiscriminatedUnion<[z.ZodObject<{
174
+ type: z.ZodLiteral<"color">;
175
+ value: z.ZodString;
176
+ }, z.core.$strip>, z.ZodObject<{
177
+ type: z.ZodLiteral<"image">;
178
+ value: z.ZodString;
179
+ }, z.core.$strip>, z.ZodObject<{
180
+ type: z.ZodLiteral<"video">;
181
+ value: z.ZodString;
182
+ }, z.core.$strip>], "type">;
183
+ }, z.core.$strip>;
184
+ children: z.ZodOptional<z.ZodLazy<z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>>;
185
+ }, z.core.$strip>;
186
+ declare const ComponentIRSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
187
+ id: z.ZodString;
188
+ timing: z.ZodObject<{
189
+ from: z.ZodNumber;
190
+ durationInFrames: z.ZodNumber;
191
+ }, z.core.$strip>;
192
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
193
+ type: z.ZodLiteral<"Scene">;
194
+ props: z.ZodObject<{
195
+ background: z.ZodDiscriminatedUnion<[z.ZodObject<{
196
+ type: z.ZodLiteral<"color">;
197
+ value: z.ZodString;
198
+ }, z.core.$strip>, z.ZodObject<{
199
+ type: z.ZodLiteral<"image">;
200
+ value: z.ZodString;
201
+ }, z.core.$strip>, z.ZodObject<{
202
+ type: z.ZodLiteral<"video">;
203
+ value: z.ZodString;
204
+ }, z.core.$strip>], "type">;
205
+ }, z.core.$strip>;
206
+ children: z.ZodOptional<z.ZodLazy<z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>>;
207
+ }, z.core.$strip>, z.ZodObject<{
208
+ id: z.ZodString;
209
+ timing: z.ZodObject<{
210
+ from: z.ZodNumber;
211
+ durationInFrames: z.ZodNumber;
212
+ }, z.core.$strip>;
213
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
214
+ type: z.ZodLiteral<"Text">;
215
+ props: z.ZodObject<{
216
+ content: z.ZodString;
217
+ fontSize: z.ZodDefault<z.ZodNumber>;
218
+ color: z.ZodDefault<z.ZodString>;
219
+ position: z.ZodDefault<z.ZodEnum<{
220
+ top: "top";
221
+ center: "center";
222
+ bottom: "bottom";
223
+ left: "left";
224
+ right: "right";
225
+ }>>;
226
+ animation: z.ZodDefault<z.ZodEnum<{
227
+ fade: "fade";
228
+ none: "none";
229
+ slide: "slide";
230
+ zoom: "zoom";
231
+ }>>;
232
+ }, z.core.$strip>;
233
+ }, z.core.$strip>, z.ZodObject<{
234
+ id: z.ZodString;
235
+ timing: z.ZodObject<{
236
+ from: z.ZodNumber;
237
+ durationInFrames: z.ZodNumber;
238
+ }, z.core.$strip>;
239
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
240
+ type: z.ZodLiteral<"Audio">;
241
+ props: z.ZodObject<{
242
+ src: z.ZodString;
243
+ volume: z.ZodDefault<z.ZodNumber>;
244
+ startFrom: z.ZodDefault<z.ZodNumber>;
245
+ fadeIn: z.ZodDefault<z.ZodNumber>;
246
+ fadeOut: z.ZodDefault<z.ZodNumber>;
247
+ }, z.core.$strip>;
248
+ }, z.core.$strip>], "type">;
249
+ declare const VideoIRSchema: z.ZodObject<{
250
+ version: z.ZodLiteral<"1.0">;
251
+ video: z.ZodObject<{
252
+ id: z.ZodDefault<z.ZodString>;
253
+ width: z.ZodNumber;
254
+ height: z.ZodNumber;
255
+ fps: z.ZodDefault<z.ZodNumber>;
256
+ durationInFrames: z.ZodNumber;
257
+ }, z.core.$strip>;
258
+ audio: z.ZodOptional<z.ZodObject<{
259
+ background: z.ZodOptional<z.ZodString>;
260
+ volume: z.ZodDefault<z.ZodNumber>;
261
+ }, z.core.$strip>>;
262
+ scenes: z.ZodArray<z.ZodObject<{
263
+ id: z.ZodString;
264
+ timing: z.ZodObject<{
265
+ from: z.ZodNumber;
266
+ durationInFrames: z.ZodNumber;
267
+ }, z.core.$strip>;
268
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
269
+ type: z.ZodLiteral<"Scene">;
270
+ props: z.ZodObject<{
271
+ background: z.ZodDiscriminatedUnion<[z.ZodObject<{
272
+ type: z.ZodLiteral<"color">;
273
+ value: z.ZodString;
274
+ }, z.core.$strip>, z.ZodObject<{
275
+ type: z.ZodLiteral<"image">;
276
+ value: z.ZodString;
277
+ }, z.core.$strip>, z.ZodObject<{
278
+ type: z.ZodLiteral<"video">;
279
+ value: z.ZodString;
280
+ }, z.core.$strip>], "type">;
281
+ }, z.core.$strip>;
282
+ children: z.ZodOptional<z.ZodLazy<z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>>;
283
+ }, z.core.$strip>>;
284
+ }, z.core.$strip>;
285
+ declare const ComponentSchemas: {
286
+ readonly Scene: z.ZodObject<{
287
+ id: z.ZodString;
288
+ timing: z.ZodObject<{
289
+ from: z.ZodNumber;
290
+ durationInFrames: z.ZodNumber;
291
+ }, z.core.$strip>;
292
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
293
+ type: z.ZodLiteral<"Scene">;
294
+ props: z.ZodObject<{
295
+ background: z.ZodDiscriminatedUnion<[z.ZodObject<{
296
+ type: z.ZodLiteral<"color">;
297
+ value: z.ZodString;
298
+ }, z.core.$strip>, z.ZodObject<{
299
+ type: z.ZodLiteral<"image">;
300
+ value: z.ZodString;
301
+ }, z.core.$strip>, z.ZodObject<{
302
+ type: z.ZodLiteral<"video">;
303
+ value: z.ZodString;
304
+ }, z.core.$strip>], "type">;
305
+ }, z.core.$strip>;
306
+ children: z.ZodOptional<z.ZodLazy<z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>>;
307
+ }, z.core.$strip>;
308
+ readonly Text: z.ZodObject<{
309
+ id: z.ZodString;
310
+ timing: z.ZodObject<{
311
+ from: z.ZodNumber;
312
+ durationInFrames: z.ZodNumber;
313
+ }, z.core.$strip>;
314
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
315
+ type: z.ZodLiteral<"Text">;
316
+ props: z.ZodObject<{
317
+ content: z.ZodString;
318
+ fontSize: z.ZodDefault<z.ZodNumber>;
319
+ color: z.ZodDefault<z.ZodString>;
320
+ position: z.ZodDefault<z.ZodEnum<{
321
+ top: "top";
322
+ center: "center";
323
+ bottom: "bottom";
324
+ left: "left";
325
+ right: "right";
326
+ }>>;
327
+ animation: z.ZodDefault<z.ZodEnum<{
328
+ fade: "fade";
329
+ none: "none";
330
+ slide: "slide";
331
+ zoom: "zoom";
332
+ }>>;
333
+ }, z.core.$strip>;
334
+ }, z.core.$strip>;
335
+ readonly Audio: z.ZodObject<{
336
+ id: z.ZodString;
337
+ timing: z.ZodObject<{
338
+ from: z.ZodNumber;
339
+ durationInFrames: z.ZodNumber;
340
+ }, z.core.$strip>;
341
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
342
+ type: z.ZodLiteral<"Audio">;
343
+ props: z.ZodObject<{
344
+ src: z.ZodString;
345
+ volume: z.ZodDefault<z.ZodNumber>;
346
+ startFrom: z.ZodDefault<z.ZodNumber>;
347
+ fadeIn: z.ZodDefault<z.ZodNumber>;
348
+ fadeOut: z.ZodDefault<z.ZodNumber>;
349
+ }, z.core.$strip>;
350
+ }, z.core.$strip>;
351
+ };
352
+
353
+ declare function registerBuiltInComponents(): void;
354
+
355
+ export { AssetPathSchema as A, type BackgroundSpec as B, ComponentRegistry as C, SceneComponentIRSchema as S, TextComponentIRSchema as T, type VideoIR as V, AudioComponentIRSchema as a, type AudioIR as b, BackgroundSpecSchema as c, type BaseComponentIR as d, BaseComponentIRSchema as e, type ComponentIR as f, ComponentIRSchema as g, ComponentSchemas as h, type SceneIR as i, type TextIR as j, type TimingSpec as k, TimingSpecSchema as l, VideoIRSchema as m, globalRegistry as n, registerBuiltInComponents as r };