@json-render/remotion 0.4.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/LICENSE +201 -0
- package/README.md +310 -0
- package/dist/chunk-5C3GTKV7.mjs +356 -0
- package/dist/chunk-5C3GTKV7.mjs.map +1 -0
- package/dist/index.d.mts +166 -0
- package/dist/index.d.ts +166 -0
- package/dist/index.js +913 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +532 -0
- package/dist/index.mjs.map +1 -0
- package/dist/server.d.mts +426 -0
- package/dist/server.d.ts +426 -0
- package/dist/server.js +385 -0
- package/dist/server.js.map +1 -0
- package/dist/server.mjs +13 -0
- package/dist/server.mjs.map +1 -0
- package/package.json +69 -0
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
import * as _json_render_core from '@json-render/core';
|
|
2
|
+
import { Catalog, InferCatalogComponents, InferComponentProps } from '@json-render/core';
|
|
3
|
+
export { Spec } from '@json-render/core';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The schema for @json-render/remotion
|
|
9
|
+
*
|
|
10
|
+
* This schema is fundamentally different from the React element tree schema.
|
|
11
|
+
* It's timeline-based, designed for video composition:
|
|
12
|
+
*
|
|
13
|
+
* - Spec: A composition with tracks containing timed clips
|
|
14
|
+
* - Catalog: Video components (scenes, overlays, etc.) and effects
|
|
15
|
+
*
|
|
16
|
+
* This demonstrates that json-render is truly agnostic - different renderers
|
|
17
|
+
* can have completely different spec formats.
|
|
18
|
+
*/
|
|
19
|
+
declare const schema: _json_render_core.Schema<{
|
|
20
|
+
spec: _json_render_core.SchemaType<"object", {
|
|
21
|
+
/** Composition settings */
|
|
22
|
+
composition: _json_render_core.SchemaType<"object", {
|
|
23
|
+
/** Unique composition ID */
|
|
24
|
+
id: _json_render_core.SchemaType<"string", unknown>;
|
|
25
|
+
/** Frames per second */
|
|
26
|
+
fps: _json_render_core.SchemaType<"number", unknown>;
|
|
27
|
+
/** Width in pixels */
|
|
28
|
+
width: _json_render_core.SchemaType<"number", unknown>;
|
|
29
|
+
/** Height in pixels */
|
|
30
|
+
height: _json_render_core.SchemaType<"number", unknown>;
|
|
31
|
+
/** Total duration in frames */
|
|
32
|
+
durationInFrames: _json_render_core.SchemaType<"number", unknown>;
|
|
33
|
+
}>;
|
|
34
|
+
/** Timeline tracks (like layers in video editing) */
|
|
35
|
+
tracks: _json_render_core.SchemaType<"array", _json_render_core.SchemaType<"object", {
|
|
36
|
+
/** Unique track ID */
|
|
37
|
+
id: _json_render_core.SchemaType<"string", unknown>;
|
|
38
|
+
/** Track name for organization */
|
|
39
|
+
name: _json_render_core.SchemaType<"string", unknown>;
|
|
40
|
+
/** Track type: "video" | "audio" | "overlay" | "text" */
|
|
41
|
+
type: _json_render_core.SchemaType<"string", unknown>;
|
|
42
|
+
/** Whether track is muted/hidden */
|
|
43
|
+
enabled: _json_render_core.SchemaType<"boolean", unknown>;
|
|
44
|
+
}>>;
|
|
45
|
+
/** Clips placed on the timeline */
|
|
46
|
+
clips: _json_render_core.SchemaType<"array", _json_render_core.SchemaType<"object", {
|
|
47
|
+
/** Unique clip ID */
|
|
48
|
+
id: _json_render_core.SchemaType<"string", unknown>;
|
|
49
|
+
/** Which track this clip belongs to */
|
|
50
|
+
trackId: _json_render_core.SchemaType<"string", unknown>;
|
|
51
|
+
/** Component type from catalog */
|
|
52
|
+
component: _json_render_core.SchemaType<"ref", string>;
|
|
53
|
+
/** Component props */
|
|
54
|
+
props: _json_render_core.SchemaType<"propsOf", string>;
|
|
55
|
+
/** Start frame (when clip begins) */
|
|
56
|
+
from: _json_render_core.SchemaType<"number", unknown>;
|
|
57
|
+
/** Duration in frames */
|
|
58
|
+
durationInFrames: _json_render_core.SchemaType<"number", unknown>;
|
|
59
|
+
/** Transition in effect */
|
|
60
|
+
transitionIn: _json_render_core.SchemaType<"object", {
|
|
61
|
+
type: _json_render_core.SchemaType<"ref", string>;
|
|
62
|
+
durationInFrames: _json_render_core.SchemaType<"number", unknown>;
|
|
63
|
+
}>;
|
|
64
|
+
/** Transition out effect */
|
|
65
|
+
transitionOut: _json_render_core.SchemaType<"object", {
|
|
66
|
+
type: _json_render_core.SchemaType<"ref", string>;
|
|
67
|
+
durationInFrames: _json_render_core.SchemaType<"number", unknown>;
|
|
68
|
+
}>;
|
|
69
|
+
}>>;
|
|
70
|
+
/** Audio configuration */
|
|
71
|
+
audio: _json_render_core.SchemaType<"object", {
|
|
72
|
+
/** Background music/audio clips */
|
|
73
|
+
tracks: _json_render_core.SchemaType<"array", _json_render_core.SchemaType<"object", {
|
|
74
|
+
id: _json_render_core.SchemaType<"string", unknown>;
|
|
75
|
+
src: _json_render_core.SchemaType<"string", unknown>;
|
|
76
|
+
from: _json_render_core.SchemaType<"number", unknown>;
|
|
77
|
+
durationInFrames: _json_render_core.SchemaType<"number", unknown>;
|
|
78
|
+
volume: _json_render_core.SchemaType<"number", unknown>;
|
|
79
|
+
}>>;
|
|
80
|
+
}>;
|
|
81
|
+
}>;
|
|
82
|
+
catalog: _json_render_core.SchemaType<"object", {
|
|
83
|
+
/** Video component definitions (scenes, overlays, etc.) */
|
|
84
|
+
components: _json_render_core.SchemaType<"map", {
|
|
85
|
+
/** Zod schema for component props */
|
|
86
|
+
props: _json_render_core.SchemaType<"zod", unknown>;
|
|
87
|
+
/** Component type: "scene" | "overlay" | "text" | "image" | "video" */
|
|
88
|
+
type: _json_render_core.SchemaType<"string", unknown>;
|
|
89
|
+
/** Default duration in frames (can be overridden per clip) */
|
|
90
|
+
defaultDuration: _json_render_core.SchemaType<"number", unknown>;
|
|
91
|
+
/** Description for AI generation hints */
|
|
92
|
+
description: _json_render_core.SchemaType<"string", unknown>;
|
|
93
|
+
}>;
|
|
94
|
+
/** Transition effect definitions */
|
|
95
|
+
transitions: _json_render_core.SchemaType<"map", {
|
|
96
|
+
/** Default duration in frames */
|
|
97
|
+
defaultDuration: _json_render_core.SchemaType<"number", unknown>;
|
|
98
|
+
/** Description for AI generation hints */
|
|
99
|
+
description: _json_render_core.SchemaType<"string", unknown>;
|
|
100
|
+
}>;
|
|
101
|
+
/** Effect definitions (filters, animations, etc.) */
|
|
102
|
+
effects: _json_render_core.SchemaType<"map", {
|
|
103
|
+
/** Zod schema for effect params */
|
|
104
|
+
params: _json_render_core.SchemaType<"zod", unknown>;
|
|
105
|
+
/** Description for AI generation hints */
|
|
106
|
+
description: _json_render_core.SchemaType<"string", unknown>;
|
|
107
|
+
}>;
|
|
108
|
+
}>;
|
|
109
|
+
}>;
|
|
110
|
+
/**
|
|
111
|
+
* Type for the Remotion schema
|
|
112
|
+
*/
|
|
113
|
+
type RemotionSchema = typeof schema;
|
|
114
|
+
/**
|
|
115
|
+
* Infer the spec type from a catalog
|
|
116
|
+
*/
|
|
117
|
+
type RemotionSpec<TCatalog> = typeof schema extends {
|
|
118
|
+
createCatalog: (catalog: TCatalog) => {
|
|
119
|
+
_specType: infer S;
|
|
120
|
+
};
|
|
121
|
+
} ? S : never;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Frame information passed to video components
|
|
125
|
+
*/
|
|
126
|
+
interface FrameContext {
|
|
127
|
+
/** Current frame number */
|
|
128
|
+
frame: number;
|
|
129
|
+
/** Frames per second */
|
|
130
|
+
fps: number;
|
|
131
|
+
/** Total duration in frames */
|
|
132
|
+
durationInFrames: number;
|
|
133
|
+
/** Width in pixels */
|
|
134
|
+
width: number;
|
|
135
|
+
/** Height in pixels */
|
|
136
|
+
height: number;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Context passed to video component render functions
|
|
140
|
+
*/
|
|
141
|
+
interface VideoComponentContext<C extends Catalog, K extends keyof InferCatalogComponents<C>> {
|
|
142
|
+
/** Component props from the spec */
|
|
143
|
+
props: InferComponentProps<C, K>;
|
|
144
|
+
/** Frame information */
|
|
145
|
+
frame: FrameContext;
|
|
146
|
+
/** Children (for container components) */
|
|
147
|
+
children?: ReactNode;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Video component render function type
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* const TitleCard: VideoComponentFn<typeof catalog, 'TitleCard'> = ({ props, frame }) => {
|
|
154
|
+
* const opacity = interpolate(frame.frame, [0, 30], [0, 1]);
|
|
155
|
+
* return <div style={{ opacity }}>{props.title}</div>;
|
|
156
|
+
* };
|
|
157
|
+
*/
|
|
158
|
+
type VideoComponentFn<C extends Catalog, K extends keyof InferCatalogComponents<C>> = (ctx: VideoComponentContext<C, K>) => ReactNode;
|
|
159
|
+
/**
|
|
160
|
+
* Registry of all video component render functions for a catalog
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* const components: VideoComponents<typeof myCatalog> = {
|
|
164
|
+
* TitleCard: ({ props, frame }) => <TitleCard {...props} />,
|
|
165
|
+
* ImageSlide: ({ props }) => <Img src={props.src} />,
|
|
166
|
+
* };
|
|
167
|
+
*/
|
|
168
|
+
type VideoComponents<C extends Catalog> = {
|
|
169
|
+
[K in keyof InferCatalogComponents<C>]: VideoComponentFn<C, K>;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Transition render function
|
|
173
|
+
* Returns a style object to apply during the transition
|
|
174
|
+
*/
|
|
175
|
+
type TransitionFn = (progress: number) => React.CSSProperties;
|
|
176
|
+
/**
|
|
177
|
+
* Built-in transition types
|
|
178
|
+
*/
|
|
179
|
+
type BuiltInTransition = "fade" | "slideLeft" | "slideRight" | "slideUp" | "slideDown" | "zoom" | "wipe";
|
|
180
|
+
/**
|
|
181
|
+
* Infer effect params from catalog
|
|
182
|
+
*/
|
|
183
|
+
type InferCatalogEffects<C extends Catalog> = C extends {
|
|
184
|
+
data: {
|
|
185
|
+
effects: infer E;
|
|
186
|
+
};
|
|
187
|
+
} ? E : never;
|
|
188
|
+
/**
|
|
189
|
+
* Effect handler function
|
|
190
|
+
*/
|
|
191
|
+
type EffectFn<C extends Catalog, K extends keyof InferCatalogEffects<C>> = InferCatalogEffects<C>[K] extends {
|
|
192
|
+
params: {
|
|
193
|
+
_output: infer P;
|
|
194
|
+
};
|
|
195
|
+
} ? (params: P, frame: FrameContext) => React.CSSProperties : (params: undefined, frame: FrameContext) => React.CSSProperties;
|
|
196
|
+
/**
|
|
197
|
+
* Registry of all effect handlers for a catalog
|
|
198
|
+
*/
|
|
199
|
+
type Effects<C extends Catalog> = {
|
|
200
|
+
[K in keyof InferCatalogEffects<C>]: EffectFn<C, K>;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Standard component definitions for Remotion catalogs
|
|
205
|
+
*
|
|
206
|
+
* These can be used directly or extended with custom components.
|
|
207
|
+
*/
|
|
208
|
+
declare const standardComponentDefinitions: {
|
|
209
|
+
TitleCard: {
|
|
210
|
+
props: z.ZodObject<{
|
|
211
|
+
title: z.ZodString;
|
|
212
|
+
subtitle: z.ZodNullable<z.ZodString>;
|
|
213
|
+
backgroundColor: z.ZodNullable<z.ZodString>;
|
|
214
|
+
textColor: z.ZodNullable<z.ZodString>;
|
|
215
|
+
}, z.core.$strip>;
|
|
216
|
+
type: string;
|
|
217
|
+
defaultDuration: number;
|
|
218
|
+
description: string;
|
|
219
|
+
};
|
|
220
|
+
ImageSlide: {
|
|
221
|
+
props: z.ZodObject<{
|
|
222
|
+
src: z.ZodString;
|
|
223
|
+
alt: z.ZodString;
|
|
224
|
+
fit: z.ZodNullable<z.ZodEnum<{
|
|
225
|
+
cover: "cover";
|
|
226
|
+
contain: "contain";
|
|
227
|
+
}>>;
|
|
228
|
+
backgroundColor: z.ZodNullable<z.ZodString>;
|
|
229
|
+
}, z.core.$strip>;
|
|
230
|
+
type: string;
|
|
231
|
+
defaultDuration: number;
|
|
232
|
+
description: string;
|
|
233
|
+
};
|
|
234
|
+
SplitScreen: {
|
|
235
|
+
props: z.ZodObject<{
|
|
236
|
+
leftTitle: z.ZodString;
|
|
237
|
+
rightTitle: z.ZodString;
|
|
238
|
+
leftColor: z.ZodNullable<z.ZodString>;
|
|
239
|
+
rightColor: z.ZodNullable<z.ZodString>;
|
|
240
|
+
}, z.core.$strip>;
|
|
241
|
+
type: string;
|
|
242
|
+
defaultDuration: number;
|
|
243
|
+
description: string;
|
|
244
|
+
};
|
|
245
|
+
QuoteCard: {
|
|
246
|
+
props: z.ZodObject<{
|
|
247
|
+
quote: z.ZodString;
|
|
248
|
+
author: z.ZodNullable<z.ZodString>;
|
|
249
|
+
backgroundColor: z.ZodNullable<z.ZodString>;
|
|
250
|
+
}, z.core.$strip>;
|
|
251
|
+
type: string;
|
|
252
|
+
defaultDuration: number;
|
|
253
|
+
description: string;
|
|
254
|
+
};
|
|
255
|
+
StatCard: {
|
|
256
|
+
props: z.ZodObject<{
|
|
257
|
+
value: z.ZodString;
|
|
258
|
+
label: z.ZodString;
|
|
259
|
+
prefix: z.ZodNullable<z.ZodString>;
|
|
260
|
+
suffix: z.ZodNullable<z.ZodString>;
|
|
261
|
+
backgroundColor: z.ZodNullable<z.ZodString>;
|
|
262
|
+
}, z.core.$strip>;
|
|
263
|
+
type: string;
|
|
264
|
+
defaultDuration: number;
|
|
265
|
+
description: string;
|
|
266
|
+
};
|
|
267
|
+
TypingText: {
|
|
268
|
+
props: z.ZodObject<{
|
|
269
|
+
text: z.ZodString;
|
|
270
|
+
backgroundColor: z.ZodNullable<z.ZodString>;
|
|
271
|
+
textColor: z.ZodNullable<z.ZodString>;
|
|
272
|
+
fontSize: z.ZodNullable<z.ZodNumber>;
|
|
273
|
+
fontFamily: z.ZodNullable<z.ZodEnum<{
|
|
274
|
+
monospace: "monospace";
|
|
275
|
+
"sans-serif": "sans-serif";
|
|
276
|
+
serif: "serif";
|
|
277
|
+
}>>;
|
|
278
|
+
showCursor: z.ZodNullable<z.ZodBoolean>;
|
|
279
|
+
cursorChar: z.ZodNullable<z.ZodString>;
|
|
280
|
+
charsPerSecond: z.ZodNullable<z.ZodNumber>;
|
|
281
|
+
}, z.core.$strip>;
|
|
282
|
+
type: string;
|
|
283
|
+
defaultDuration: number;
|
|
284
|
+
description: string;
|
|
285
|
+
};
|
|
286
|
+
LowerThird: {
|
|
287
|
+
props: z.ZodObject<{
|
|
288
|
+
name: z.ZodString;
|
|
289
|
+
title: z.ZodNullable<z.ZodString>;
|
|
290
|
+
backgroundColor: z.ZodNullable<z.ZodString>;
|
|
291
|
+
}, z.core.$strip>;
|
|
292
|
+
type: string;
|
|
293
|
+
defaultDuration: number;
|
|
294
|
+
description: string;
|
|
295
|
+
};
|
|
296
|
+
TextOverlay: {
|
|
297
|
+
props: z.ZodObject<{
|
|
298
|
+
text: z.ZodString;
|
|
299
|
+
position: z.ZodNullable<z.ZodEnum<{
|
|
300
|
+
top: "top";
|
|
301
|
+
center: "center";
|
|
302
|
+
bottom: "bottom";
|
|
303
|
+
}>>;
|
|
304
|
+
fontSize: z.ZodNullable<z.ZodEnum<{
|
|
305
|
+
small: "small";
|
|
306
|
+
medium: "medium";
|
|
307
|
+
large: "large";
|
|
308
|
+
}>>;
|
|
309
|
+
}, z.core.$strip>;
|
|
310
|
+
type: string;
|
|
311
|
+
defaultDuration: number;
|
|
312
|
+
description: string;
|
|
313
|
+
};
|
|
314
|
+
LogoBug: {
|
|
315
|
+
props: z.ZodObject<{
|
|
316
|
+
position: z.ZodNullable<z.ZodEnum<{
|
|
317
|
+
"top-left": "top-left";
|
|
318
|
+
"top-right": "top-right";
|
|
319
|
+
"bottom-left": "bottom-left";
|
|
320
|
+
"bottom-right": "bottom-right";
|
|
321
|
+
}>>;
|
|
322
|
+
opacity: z.ZodNullable<z.ZodNumber>;
|
|
323
|
+
}, z.core.$strip>;
|
|
324
|
+
type: string;
|
|
325
|
+
defaultDuration: number;
|
|
326
|
+
description: string;
|
|
327
|
+
};
|
|
328
|
+
VideoClip: {
|
|
329
|
+
props: z.ZodObject<{
|
|
330
|
+
src: z.ZodString;
|
|
331
|
+
startFrom: z.ZodNullable<z.ZodNumber>;
|
|
332
|
+
volume: z.ZodNullable<z.ZodNumber>;
|
|
333
|
+
}, z.core.$strip>;
|
|
334
|
+
type: string;
|
|
335
|
+
defaultDuration: number;
|
|
336
|
+
description: string;
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* Standard transition definitions for Remotion catalogs
|
|
341
|
+
*/
|
|
342
|
+
declare const standardTransitionDefinitions: {
|
|
343
|
+
fade: {
|
|
344
|
+
defaultDuration: number;
|
|
345
|
+
description: string;
|
|
346
|
+
};
|
|
347
|
+
slideLeft: {
|
|
348
|
+
defaultDuration: number;
|
|
349
|
+
description: string;
|
|
350
|
+
};
|
|
351
|
+
slideRight: {
|
|
352
|
+
defaultDuration: number;
|
|
353
|
+
description: string;
|
|
354
|
+
};
|
|
355
|
+
slideUp: {
|
|
356
|
+
defaultDuration: number;
|
|
357
|
+
description: string;
|
|
358
|
+
};
|
|
359
|
+
slideDown: {
|
|
360
|
+
defaultDuration: number;
|
|
361
|
+
description: string;
|
|
362
|
+
};
|
|
363
|
+
zoom: {
|
|
364
|
+
defaultDuration: number;
|
|
365
|
+
description: string;
|
|
366
|
+
};
|
|
367
|
+
wipe: {
|
|
368
|
+
defaultDuration: number;
|
|
369
|
+
description: string;
|
|
370
|
+
};
|
|
371
|
+
none: {
|
|
372
|
+
defaultDuration: number;
|
|
373
|
+
description: string;
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
/**
|
|
377
|
+
* Standard effect definitions for Remotion catalogs
|
|
378
|
+
*/
|
|
379
|
+
declare const standardEffectDefinitions: {
|
|
380
|
+
kenBurns: {
|
|
381
|
+
params: z.ZodObject<{
|
|
382
|
+
startScale: z.ZodNumber;
|
|
383
|
+
endScale: z.ZodNumber;
|
|
384
|
+
panX: z.ZodNullable<z.ZodNumber>;
|
|
385
|
+
panY: z.ZodNullable<z.ZodNumber>;
|
|
386
|
+
}, z.core.$strip>;
|
|
387
|
+
description: string;
|
|
388
|
+
};
|
|
389
|
+
pulse: {
|
|
390
|
+
params: z.ZodObject<{
|
|
391
|
+
intensity: z.ZodNumber;
|
|
392
|
+
}, z.core.$strip>;
|
|
393
|
+
description: string;
|
|
394
|
+
};
|
|
395
|
+
shake: {
|
|
396
|
+
params: z.ZodObject<{
|
|
397
|
+
intensity: z.ZodNumber;
|
|
398
|
+
}, z.core.$strip>;
|
|
399
|
+
description: string;
|
|
400
|
+
};
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* Type for component definition
|
|
404
|
+
*/
|
|
405
|
+
type ComponentDefinition = {
|
|
406
|
+
props: z.ZodType;
|
|
407
|
+
type: string;
|
|
408
|
+
defaultDuration: number;
|
|
409
|
+
description: string;
|
|
410
|
+
};
|
|
411
|
+
/**
|
|
412
|
+
* Type for transition definition
|
|
413
|
+
*/
|
|
414
|
+
type TransitionDefinition = {
|
|
415
|
+
defaultDuration: number;
|
|
416
|
+
description: string;
|
|
417
|
+
};
|
|
418
|
+
/**
|
|
419
|
+
* Type for effect definition
|
|
420
|
+
*/
|
|
421
|
+
type EffectDefinition = {
|
|
422
|
+
params: z.ZodType;
|
|
423
|
+
description: string;
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
export { type BuiltInTransition, type ComponentDefinition, type EffectDefinition, type EffectFn, type Effects, type FrameContext, type RemotionSchema, type RemotionSpec, type TransitionDefinition, type TransitionFn, type VideoComponentContext, type VideoComponentFn, type VideoComponents, schema, standardComponentDefinitions, standardEffectDefinitions, standardTransitionDefinitions };
|