@contractspec/lib.video-gen 1.42.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.
Files changed (137) hide show
  1. package/dist/browser/compositions/api-overview.js +645 -0
  2. package/dist/browser/compositions/index.js +1133 -0
  3. package/dist/browser/compositions/primitives/animated-text.js +144 -0
  4. package/dist/browser/compositions/primitives/brand-frame.js +181 -0
  5. package/dist/browser/compositions/primitives/code-block.js +226 -0
  6. package/dist/browser/compositions/primitives/index.js +656 -0
  7. package/dist/browser/compositions/primitives/progress-bar.js +59 -0
  8. package/dist/browser/compositions/primitives/terminal.js +265 -0
  9. package/dist/browser/compositions/primitives/transition.js +98 -0
  10. package/dist/browser/compositions/social-clip.js +500 -0
  11. package/dist/browser/compositions/terminal-demo.js +558 -0
  12. package/dist/browser/design/index.js +155 -0
  13. package/dist/browser/design/layouts.js +50 -0
  14. package/dist/browser/design/motion.js +43 -0
  15. package/dist/browser/design/tokens.js +28 -0
  16. package/dist/browser/design/typography.js +61 -0
  17. package/dist/browser/docs/compositions.docblock.js +182 -0
  18. package/dist/browser/docs/design.docblock.js +187 -0
  19. package/dist/browser/docs/generators.docblock.js +187 -0
  20. package/dist/browser/docs/rendering.docblock.js +197 -0
  21. package/dist/browser/docs/video-gen.docblock.js +141 -0
  22. package/dist/browser/generators/index.js +416 -0
  23. package/dist/browser/generators/scene-planner.js +205 -0
  24. package/dist/browser/generators/script-generator.js +147 -0
  25. package/dist/browser/generators/video-generator.js +414 -0
  26. package/dist/browser/index.js +1550 -0
  27. package/dist/browser/player/demo-player.js +1136 -0
  28. package/dist/browser/player/index.js +1136 -0
  29. package/dist/browser/remotion/Root.js +1189 -0
  30. package/dist/browser/remotion/index.js +1190 -0
  31. package/dist/browser/renderers/config.js +40 -0
  32. package/dist/browser/renderers/index.js +160 -0
  33. package/dist/browser/renderers/local.js +156 -0
  34. package/dist/browser/types.js +13 -0
  35. package/dist/compositions/api-overview.d.ts +16 -0
  36. package/dist/compositions/api-overview.js +640 -0
  37. package/dist/compositions/index.d.ts +7 -0
  38. package/dist/compositions/index.js +1128 -0
  39. package/dist/compositions/primitives/animated-text.d.ts +22 -0
  40. package/dist/compositions/primitives/animated-text.js +139 -0
  41. package/dist/compositions/primitives/brand-frame.d.ts +14 -0
  42. package/dist/compositions/primitives/brand-frame.js +176 -0
  43. package/dist/compositions/primitives/code-block.d.ts +18 -0
  44. package/dist/compositions/primitives/code-block.js +221 -0
  45. package/dist/compositions/primitives/index.d.ts +12 -0
  46. package/dist/compositions/primitives/index.js +651 -0
  47. package/dist/compositions/primitives/progress-bar.d.ts +12 -0
  48. package/dist/compositions/primitives/progress-bar.js +54 -0
  49. package/dist/compositions/primitives/terminal.d.ts +24 -0
  50. package/dist/compositions/primitives/terminal.js +260 -0
  51. package/dist/compositions/primitives/transition.d.ts +14 -0
  52. package/dist/compositions/primitives/transition.js +93 -0
  53. package/dist/compositions/social-clip.d.ts +16 -0
  54. package/dist/compositions/social-clip.js +495 -0
  55. package/dist/compositions/terminal-demo.d.ts +17 -0
  56. package/dist/compositions/terminal-demo.js +553 -0
  57. package/dist/design/index.d.ts +4 -0
  58. package/dist/design/index.js +150 -0
  59. package/dist/design/layouts.d.ts +69 -0
  60. package/dist/design/layouts.js +45 -0
  61. package/dist/design/motion.d.ts +72 -0
  62. package/dist/design/motion.js +38 -0
  63. package/dist/design/tokens.d.ts +31 -0
  64. package/dist/design/tokens.js +23 -0
  65. package/dist/design/typography.d.ts +61 -0
  66. package/dist/design/typography.js +56 -0
  67. package/dist/docs/compositions.docblock.d.ts +1 -0
  68. package/dist/docs/compositions.docblock.js +183 -0
  69. package/dist/docs/design.docblock.d.ts +1 -0
  70. package/dist/docs/design.docblock.js +188 -0
  71. package/dist/docs/generators.docblock.d.ts +1 -0
  72. package/dist/docs/generators.docblock.js +188 -0
  73. package/dist/docs/rendering.docblock.d.ts +1 -0
  74. package/dist/docs/rendering.docblock.js +198 -0
  75. package/dist/docs/video-gen.docblock.d.ts +1 -0
  76. package/dist/docs/video-gen.docblock.js +142 -0
  77. package/dist/generators/index.d.ts +5 -0
  78. package/dist/generators/index.js +411 -0
  79. package/dist/generators/scene-planner.d.ts +23 -0
  80. package/dist/generators/scene-planner.js +200 -0
  81. package/dist/generators/script-generator.d.ts +49 -0
  82. package/dist/generators/script-generator.js +142 -0
  83. package/dist/generators/video-generator.d.ts +20 -0
  84. package/dist/generators/video-generator.js +409 -0
  85. package/dist/index.d.ts +6 -0
  86. package/dist/index.js +1545 -0
  87. package/dist/node/compositions/api-overview.js +640 -0
  88. package/dist/node/compositions/index.js +1128 -0
  89. package/dist/node/compositions/primitives/animated-text.js +139 -0
  90. package/dist/node/compositions/primitives/brand-frame.js +176 -0
  91. package/dist/node/compositions/primitives/code-block.js +221 -0
  92. package/dist/node/compositions/primitives/index.js +651 -0
  93. package/dist/node/compositions/primitives/progress-bar.js +54 -0
  94. package/dist/node/compositions/primitives/terminal.js +260 -0
  95. package/dist/node/compositions/primitives/transition.js +93 -0
  96. package/dist/node/compositions/social-clip.js +495 -0
  97. package/dist/node/compositions/terminal-demo.js +553 -0
  98. package/dist/node/design/index.js +150 -0
  99. package/dist/node/design/layouts.js +45 -0
  100. package/dist/node/design/motion.js +38 -0
  101. package/dist/node/design/tokens.js +23 -0
  102. package/dist/node/design/typography.js +56 -0
  103. package/dist/node/docs/compositions.docblock.js +182 -0
  104. package/dist/node/docs/design.docblock.js +187 -0
  105. package/dist/node/docs/generators.docblock.js +187 -0
  106. package/dist/node/docs/rendering.docblock.js +197 -0
  107. package/dist/node/docs/video-gen.docblock.js +141 -0
  108. package/dist/node/generators/index.js +411 -0
  109. package/dist/node/generators/scene-planner.js +200 -0
  110. package/dist/node/generators/script-generator.js +142 -0
  111. package/dist/node/generators/video-generator.js +409 -0
  112. package/dist/node/index.js +1545 -0
  113. package/dist/node/player/demo-player.js +1131 -0
  114. package/dist/node/player/index.js +1131 -0
  115. package/dist/node/remotion/Root.js +1184 -0
  116. package/dist/node/remotion/index.js +1185 -0
  117. package/dist/node/renderers/config.js +35 -0
  118. package/dist/node/renderers/index.js +155 -0
  119. package/dist/node/renderers/local.js +151 -0
  120. package/dist/node/types.js +8 -0
  121. package/dist/player/demo-player.d.ts +55 -0
  122. package/dist/player/demo-player.js +1131 -0
  123. package/dist/player/index.d.ts +2 -0
  124. package/dist/player/index.js +1131 -0
  125. package/dist/remotion/Root.d.ts +2 -0
  126. package/dist/remotion/Root.js +1184 -0
  127. package/dist/remotion/index.d.ts +1 -0
  128. package/dist/remotion/index.js +1185 -0
  129. package/dist/renderers/config.d.ts +28 -0
  130. package/dist/renderers/config.js +35 -0
  131. package/dist/renderers/index.d.ts +3 -0
  132. package/dist/renderers/index.js +155 -0
  133. package/dist/renderers/local.d.ts +17 -0
  134. package/dist/renderers/local.js +151 -0
  135. package/dist/types.d.ts +63 -0
  136. package/dist/types.js +8 -0
  137. package/package.json +637 -0
package/dist/index.js ADDED
@@ -0,0 +1,1545 @@
1
+ // @bun
2
+ var __require = import.meta.require;
3
+
4
+ // src/design/motion.ts
5
+ import { Easing } from "remotion";
6
+ var videoEasing = {
7
+ entrance: Easing.out(Easing.exp),
8
+ exit: Easing.in(Easing.exp),
9
+ emphasis: Easing.out(Easing.back(1.4)),
10
+ linear: Easing.linear,
11
+ gentle: Easing.bezier(0.25, 0.1, 0.25, 1),
12
+ spring: Easing.out(Easing.back(1.7))
13
+ };
14
+ var videoDurations = {
15
+ sceneTransition: 20,
16
+ textEntrance: 15,
17
+ textExit: 12,
18
+ codeTypingPerChar: 2,
19
+ sectionPause: 30,
20
+ emphasisPause: 15,
21
+ brandReveal: 25,
22
+ minScene: 60,
23
+ shortScene: 60,
24
+ mediumScene: 120,
25
+ longScene: 240
26
+ };
27
+ var videoTransitions = {
28
+ fade: { type: "fade", durationInFrames: 20 },
29
+ slideLeft: { type: "slide-left", durationInFrames: 20 },
30
+ slideRight: { type: "slide-right", durationInFrames: 20 },
31
+ wipe: { type: "wipe", durationInFrames: 15 },
32
+ none: { type: "none", durationInFrames: 0 }
33
+ };
34
+
35
+ // src/design/tokens.ts
36
+ import { defaultTokens } from "@contractspec/lib.design-system";
37
+ var defaultVideoColors = {
38
+ canvasBackground: defaultTokens.colors.background,
39
+ codeBackground: "#1e1e2e",
40
+ terminalBackground: "#0d1117",
41
+ terminalForeground: "#c9d1d9",
42
+ highlight: defaultTokens.colors.accent,
43
+ gradientStart: defaultTokens.colors.primary,
44
+ gradientEnd: defaultTokens.colors.accent
45
+ };
46
+ var defaultVideoTheme = {
47
+ ...defaultTokens,
48
+ video: defaultVideoColors
49
+ };
50
+
51
+ // src/design/layouts.ts
52
+ import { VIDEO_FORMATS } from "@contractspec/lib.contracts-integrations/integrations/providers/video";
53
+ var DEFAULT_FPS = 30;
54
+ var videoSafeZone = {
55
+ horizontal: 120,
56
+ vertical: 80,
57
+ contentWidth: 1680,
58
+ contentHeight: 920
59
+ };
60
+ function scaleSafeZone(format) {
61
+ const scaleX = format.width / 1920;
62
+ const scaleY = format.height / 1080;
63
+ return {
64
+ horizontal: Math.round(videoSafeZone.horizontal * scaleX),
65
+ vertical: Math.round(videoSafeZone.vertical * scaleY),
66
+ contentWidth: Math.round(videoSafeZone.contentWidth * scaleX),
67
+ contentHeight: Math.round(videoSafeZone.contentHeight * scaleY)
68
+ };
69
+ }
70
+ var videoPositions = {
71
+ center: { x: 960, y: 540 },
72
+ topLeft: { x: 120, y: 80 },
73
+ topRight: { x: 1800, y: 80 },
74
+ bottomLeft: { x: 120, y: 1000 },
75
+ bottomRight: { x: 1800, y: 1000 },
76
+ bottomCenter: { x: 960, y: 960 }
77
+ };
78
+ function getAllFormatVariants() {
79
+ return [
80
+ VIDEO_FORMATS.landscape,
81
+ VIDEO_FORMATS.square,
82
+ VIDEO_FORMATS.portrait
83
+ ];
84
+ }
85
+
86
+ // src/compositions/primitives/brand-frame.tsx
87
+ import { interpolate, useCurrentFrame, useVideoConfig } from "remotion";
88
+ import { jsxDEV } from "react/jsx-dev-runtime";
89
+ var BrandFrame = ({
90
+ styleOverrides,
91
+ showBranding = true,
92
+ animateEntrance = true,
93
+ variant = "gradient",
94
+ children
95
+ }) => {
96
+ const frame = useCurrentFrame();
97
+ const { width, height } = useVideoConfig();
98
+ const theme = defaultVideoTheme;
99
+ const safeZone = scaleSafeZone({ type: "custom", width, height });
100
+ const primaryColor = styleOverrides?.primaryColor ?? theme.colors.primary;
101
+ const _accentColor = styleOverrides?.accentColor ?? theme.colors.accent;
102
+ const isDark = styleOverrides?.darkMode ?? true;
103
+ let background;
104
+ switch (variant) {
105
+ case "solid":
106
+ background = isDark ? "#0a0a0a" : theme.colors.background;
107
+ break;
108
+ case "gradient":
109
+ background = isDark ? `linear-gradient(135deg, #0a0a14 0%, #0f172a 50%, #0a0a14 100%)` : `linear-gradient(135deg, ${theme.colors.background} 0%, ${theme.colors.muted} 100%)`;
110
+ break;
111
+ case "dark":
112
+ background = "#000000";
113
+ break;
114
+ }
115
+ const entranceOpacity = animateEntrance ? interpolate(frame, [0, 15], [0, 1], {
116
+ extrapolateLeft: "clamp",
117
+ extrapolateRight: "clamp",
118
+ easing: videoEasing.entrance
119
+ }) : 1;
120
+ const brandOpacity = showBranding ? interpolate(frame, [videoDurations.brandReveal, videoDurations.brandReveal + 15], [0, 0.3], {
121
+ extrapolateLeft: "clamp",
122
+ extrapolateRight: "clamp"
123
+ }) : 0;
124
+ return /* @__PURE__ */ jsxDEV("div", {
125
+ style: {
126
+ width,
127
+ height,
128
+ background,
129
+ position: "relative",
130
+ overflow: "hidden",
131
+ opacity: entranceOpacity
132
+ },
133
+ children: [
134
+ variant === "gradient" && /* @__PURE__ */ jsxDEV("div", {
135
+ style: {
136
+ position: "absolute",
137
+ top: "-20%",
138
+ right: "-10%",
139
+ width: "50%",
140
+ height: "50%",
141
+ background: `radial-gradient(circle, ${primaryColor}15 0%, transparent 70%)`,
142
+ borderRadius: "50%",
143
+ pointerEvents: "none"
144
+ }
145
+ }, undefined, false, undefined, this),
146
+ /* @__PURE__ */ jsxDEV("div", {
147
+ style: {
148
+ position: "absolute",
149
+ left: safeZone.horizontal,
150
+ top: safeZone.vertical,
151
+ width: safeZone.contentWidth,
152
+ height: safeZone.contentHeight,
153
+ display: "flex",
154
+ flexDirection: "column"
155
+ },
156
+ children
157
+ }, undefined, false, undefined, this),
158
+ showBranding && /* @__PURE__ */ jsxDEV("div", {
159
+ style: {
160
+ position: "absolute",
161
+ bottom: safeZone.vertical / 2,
162
+ right: safeZone.horizontal,
163
+ opacity: brandOpacity,
164
+ color: isDark ? "#ffffff" : "#000000",
165
+ fontSize: Math.round(16 * (width / 1920)),
166
+ fontWeight: 500,
167
+ letterSpacing: 1
168
+ },
169
+ children: "ContractSpec"
170
+ }, undefined, false, undefined, this)
171
+ ]
172
+ }, undefined, true, undefined, this);
173
+ };
174
+
175
+ // src/design/typography.ts
176
+ var videoTypography = {
177
+ title: {
178
+ fontSize: 72,
179
+ lineHeight: 1.1,
180
+ fontWeight: 700,
181
+ letterSpacing: -1
182
+ },
183
+ heading: {
184
+ fontSize: 56,
185
+ lineHeight: 1.2,
186
+ fontWeight: 600,
187
+ letterSpacing: -0.5
188
+ },
189
+ subheading: {
190
+ fontSize: 40,
191
+ lineHeight: 1.25,
192
+ fontWeight: 500
193
+ },
194
+ body: {
195
+ fontSize: 32,
196
+ lineHeight: 1.5,
197
+ fontWeight: 400
198
+ },
199
+ code: {
200
+ fontSize: 28,
201
+ lineHeight: 1.6,
202
+ fontWeight: 400
203
+ },
204
+ caption: {
205
+ fontSize: 24,
206
+ lineHeight: 1.4,
207
+ fontWeight: 400
208
+ },
209
+ label: {
210
+ fontSize: 20,
211
+ lineHeight: 1.3,
212
+ fontWeight: 600,
213
+ letterSpacing: 1
214
+ }
215
+ };
216
+ function scaleTypography(style, targetWidth) {
217
+ const scale = targetWidth / 1920;
218
+ return {
219
+ ...style,
220
+ fontSize: Math.round(style.fontSize * scale),
221
+ letterSpacing: style.letterSpacing ? Math.round(style.letterSpacing * scale * 10) / 10 : undefined
222
+ };
223
+ }
224
+
225
+ // src/compositions/primitives/animated-text.tsx
226
+ import { interpolate as interpolate2, useCurrentFrame as useCurrentFrame2, useVideoConfig as useVideoConfig2 } from "remotion";
227
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
228
+ var AnimatedText = ({
229
+ text,
230
+ variant = "body",
231
+ style: styleOverride,
232
+ enterAt = 0,
233
+ exitAt,
234
+ color = "#ffffff",
235
+ align = "left"
236
+ }) => {
237
+ const frame = useCurrentFrame2();
238
+ const { width } = useVideoConfig2();
239
+ const baseStyle = videoTypography[variant];
240
+ const scaled = scaleTypography(baseStyle, width);
241
+ const finalStyle = { ...scaled, ...styleOverride };
242
+ const enterProgress = interpolate2(frame, [enterAt, enterAt + videoDurations.textEntrance], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
243
+ const enterOpacity = interpolate2(enterProgress, [0, 1], [0, 1], {
244
+ easing: videoEasing.entrance
245
+ });
246
+ const enterTranslateY = interpolate2(enterProgress, [0, 1], [30, 0], {
247
+ easing: videoEasing.entrance
248
+ });
249
+ let exitOpacity = 1;
250
+ let exitTranslateY = 0;
251
+ if (exitAt !== undefined) {
252
+ const exitProgress = interpolate2(frame, [exitAt, exitAt + videoDurations.textExit], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
253
+ exitOpacity = interpolate2(exitProgress, [0, 1], [1, 0], {
254
+ easing: videoEasing.exit
255
+ });
256
+ exitTranslateY = interpolate2(exitProgress, [0, 1], [0, -20], {
257
+ easing: videoEasing.exit
258
+ });
259
+ }
260
+ const opacity = enterOpacity * exitOpacity;
261
+ const translateY = enterTranslateY + exitTranslateY;
262
+ return /* @__PURE__ */ jsxDEV2("div", {
263
+ style: {
264
+ fontSize: finalStyle.fontSize,
265
+ lineHeight: finalStyle.lineHeight,
266
+ fontWeight: finalStyle.fontWeight,
267
+ letterSpacing: finalStyle.letterSpacing,
268
+ color,
269
+ textAlign: align,
270
+ opacity,
271
+ transform: `translateY(${translateY}px)`,
272
+ willChange: "opacity, transform"
273
+ },
274
+ children: text
275
+ }, undefined, false, undefined, this);
276
+ };
277
+
278
+ // src/compositions/primitives/code-block.tsx
279
+ import { interpolate as interpolate3, useCurrentFrame as useCurrentFrame3, useVideoConfig as useVideoConfig3 } from "remotion";
280
+ import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
281
+ var CodeBlock = ({
282
+ code,
283
+ language = "typescript",
284
+ startAt = 0,
285
+ typeAnimation = true,
286
+ backgroundColor = defaultVideoColors.codeBackground,
287
+ textColor = "#abb2bf",
288
+ filename
289
+ }) => {
290
+ const frame = useCurrentFrame3();
291
+ const { width } = useVideoConfig3();
292
+ const codeStyle = scaleTypography(videoTypography.code, width);
293
+ const totalChars = code.length;
294
+ const typingDuration = totalChars * videoDurations.codeTypingPerChar;
295
+ const charsVisible = typeAnimation ? Math.floor(interpolate3(frame, [startAt, startAt + typingDuration], [0, totalChars], {
296
+ extrapolateLeft: "clamp",
297
+ extrapolateRight: "clamp"
298
+ })) : totalChars;
299
+ const visibleCode = code.slice(0, charsVisible);
300
+ const opacity = interpolate3(frame, [startAt, startAt + 10], [0, 1], {
301
+ extrapolateLeft: "clamp",
302
+ extrapolateRight: "clamp",
303
+ easing: videoEasing.entrance
304
+ });
305
+ const showCursor = typeAnimation && charsVisible < totalChars && frame % 16 < 10;
306
+ return /* @__PURE__ */ jsxDEV3("div", {
307
+ style: {
308
+ backgroundColor,
309
+ borderRadius: 16,
310
+ padding: 0,
311
+ opacity,
312
+ overflow: "hidden",
313
+ boxShadow: "0 8px 32px rgba(0,0,0,0.3)"
314
+ },
315
+ children: [
316
+ /* @__PURE__ */ jsxDEV3("div", {
317
+ style: {
318
+ display: "flex",
319
+ alignItems: "center",
320
+ padding: "12px 20px",
321
+ backgroundColor: "rgba(0,0,0,0.2)",
322
+ gap: 8
323
+ },
324
+ children: [
325
+ /* @__PURE__ */ jsxDEV3("div", {
326
+ style: { display: "flex", gap: 8 },
327
+ children: [
328
+ /* @__PURE__ */ jsxDEV3("div", {
329
+ style: {
330
+ width: 12,
331
+ height: 12,
332
+ borderRadius: "50%",
333
+ backgroundColor: "#ff5f57"
334
+ }
335
+ }, undefined, false, undefined, this),
336
+ /* @__PURE__ */ jsxDEV3("div", {
337
+ style: {
338
+ width: 12,
339
+ height: 12,
340
+ borderRadius: "50%",
341
+ backgroundColor: "#febc2e"
342
+ }
343
+ }, undefined, false, undefined, this),
344
+ /* @__PURE__ */ jsxDEV3("div", {
345
+ style: {
346
+ width: 12,
347
+ height: 12,
348
+ borderRadius: "50%",
349
+ backgroundColor: "#28c840"
350
+ }
351
+ }, undefined, false, undefined, this)
352
+ ]
353
+ }, undefined, true, undefined, this),
354
+ /* @__PURE__ */ jsxDEV3("div", {
355
+ style: {
356
+ flex: 1,
357
+ textAlign: "center",
358
+ color: "#666",
359
+ fontSize: codeStyle.fontSize * 0.7,
360
+ fontFamily: "monospace"
361
+ },
362
+ children: filename ?? language
363
+ }, undefined, false, undefined, this)
364
+ ]
365
+ }, undefined, true, undefined, this),
366
+ /* @__PURE__ */ jsxDEV3("div", {
367
+ style: { padding: "24px 32px" },
368
+ children: /* @__PURE__ */ jsxDEV3("pre", {
369
+ style: {
370
+ margin: 0,
371
+ fontFamily: "'SF Mono', 'Fira Code', 'JetBrains Mono', monospace",
372
+ fontSize: codeStyle.fontSize,
373
+ lineHeight: codeStyle.lineHeight,
374
+ color: textColor,
375
+ whiteSpace: "pre-wrap",
376
+ wordBreak: "break-word"
377
+ },
378
+ children: [
379
+ visibleCode,
380
+ showCursor && /* @__PURE__ */ jsxDEV3("span", {
381
+ style: {
382
+ backgroundColor: textColor,
383
+ width: "2px",
384
+ display: "inline-block",
385
+ height: "1.2em",
386
+ verticalAlign: "text-bottom"
387
+ },
388
+ children: "\xA0"
389
+ }, undefined, false, undefined, this)
390
+ ]
391
+ }, undefined, true, undefined, this)
392
+ }, undefined, false, undefined, this)
393
+ ]
394
+ }, undefined, true, undefined, this);
395
+ };
396
+
397
+ // src/compositions/primitives/progress-bar.tsx
398
+ import { useCurrentFrame as useCurrentFrame4, useVideoConfig as useVideoConfig4 } from "remotion";
399
+ import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
400
+ var ProgressBar = ({
401
+ height = 4,
402
+ color = defaultVideoTheme.colors.primary,
403
+ backgroundColor = "rgba(255,255,255,0.1)",
404
+ position = "bottom"
405
+ }) => {
406
+ const frame = useCurrentFrame4();
407
+ const { durationInFrames, width } = useVideoConfig4();
408
+ const progress = frame / durationInFrames;
409
+ return /* @__PURE__ */ jsxDEV4("div", {
410
+ style: {
411
+ position: "absolute",
412
+ [position]: 0,
413
+ left: 0,
414
+ width,
415
+ height,
416
+ backgroundColor,
417
+ zIndex: 100
418
+ },
419
+ children: /* @__PURE__ */ jsxDEV4("div", {
420
+ style: {
421
+ width: `${progress * 100}%`,
422
+ height: "100%",
423
+ backgroundColor: color,
424
+ transition: "none"
425
+ }
426
+ }, undefined, false, undefined, this)
427
+ }, undefined, false, undefined, this);
428
+ };
429
+
430
+ // src/compositions/api-overview.tsx
431
+ import {
432
+ AbsoluteFill,
433
+ Sequence,
434
+ interpolate as interpolate4,
435
+ useCurrentFrame as useCurrentFrame5,
436
+ useVideoConfig as useVideoConfig5
437
+ } from "remotion";
438
+ import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
439
+ var ApiOverview = ({
440
+ specName,
441
+ method = "POST",
442
+ endpoint = "/api/users",
443
+ specCode,
444
+ generatedOutputs = [
445
+ "REST Endpoint",
446
+ "GraphQL Mutation",
447
+ "Prisma Model",
448
+ "TypeScript SDK",
449
+ "MCP Tool",
450
+ "OpenAPI Spec"
451
+ ],
452
+ tagline = "One spec. Every surface."
453
+ }) => {
454
+ const { durationInFrames } = useVideoConfig5();
455
+ const theme = defaultVideoTheme;
456
+ const INTRO_END = 60;
457
+ const CODE_START = 45;
458
+ const CODE_END = INTRO_END + 150;
459
+ const OUTPUTS_START = CODE_END - 30;
460
+ const TAGLINE_START = durationInFrames - 90;
461
+ return /* @__PURE__ */ jsxDEV5(AbsoluteFill, {
462
+ children: [
463
+ /* @__PURE__ */ jsxDEV5(BrandFrame, {
464
+ variant: "gradient",
465
+ showBranding: true,
466
+ children: [
467
+ /* @__PURE__ */ jsxDEV5(Sequence, {
468
+ from: 0,
469
+ durationInFrames: CODE_END,
470
+ children: /* @__PURE__ */ jsxDEV5("div", {
471
+ style: {
472
+ flex: 1,
473
+ display: "flex",
474
+ flexDirection: "column",
475
+ gap: 16
476
+ },
477
+ children: [
478
+ /* @__PURE__ */ jsxDEV5("div", {
479
+ style: { display: "flex", alignItems: "center", gap: 16 },
480
+ children: [
481
+ /* @__PURE__ */ jsxDEV5(MethodBadge, {
482
+ method,
483
+ enterAt: 10
484
+ }, undefined, false, undefined, this),
485
+ /* @__PURE__ */ jsxDEV5(AnimatedText, {
486
+ text: endpoint,
487
+ variant: "subheading",
488
+ enterAt: 15,
489
+ color: theme.colors.mutedForeground
490
+ }, undefined, false, undefined, this)
491
+ ]
492
+ }, undefined, true, undefined, this),
493
+ /* @__PURE__ */ jsxDEV5(AnimatedText, {
494
+ text: specName,
495
+ variant: "title",
496
+ enterAt: 5,
497
+ color: "#ffffff"
498
+ }, undefined, false, undefined, this),
499
+ /* @__PURE__ */ jsxDEV5("div", {
500
+ style: { flex: 1, marginTop: 24 },
501
+ children: /* @__PURE__ */ jsxDEV5(CodeBlock, {
502
+ code: specCode,
503
+ language: "typescript",
504
+ filename: `${specName.toLowerCase()}.contract.ts`,
505
+ startAt: CODE_START,
506
+ typeAnimation: true
507
+ }, undefined, false, undefined, this)
508
+ }, undefined, false, undefined, this)
509
+ ]
510
+ }, undefined, true, undefined, this)
511
+ }, undefined, false, undefined, this),
512
+ /* @__PURE__ */ jsxDEV5(Sequence, {
513
+ from: OUTPUTS_START,
514
+ durationInFrames: durationInFrames - OUTPUTS_START,
515
+ children: /* @__PURE__ */ jsxDEV5("div", {
516
+ style: {
517
+ flex: 1,
518
+ display: "flex",
519
+ flexDirection: "column",
520
+ justifyContent: "center",
521
+ alignItems: "center",
522
+ gap: 24
523
+ },
524
+ children: [
525
+ /* @__PURE__ */ jsxDEV5(AnimatedText, {
526
+ text: "Generates:",
527
+ variant: "heading",
528
+ enterAt: 0,
529
+ color: "#ffffff",
530
+ align: "center"
531
+ }, undefined, false, undefined, this),
532
+ /* @__PURE__ */ jsxDEV5("div", {
533
+ style: {
534
+ display: "flex",
535
+ flexWrap: "wrap",
536
+ gap: 16,
537
+ justifyContent: "center",
538
+ maxWidth: "80%",
539
+ marginTop: 32
540
+ },
541
+ children: generatedOutputs.map((output, i) => /* @__PURE__ */ jsxDEV5(OutputChip, {
542
+ label: output,
543
+ index: i,
544
+ startFrame: 20 + i * 8
545
+ }, output, false, undefined, this))
546
+ }, undefined, false, undefined, this),
547
+ /* @__PURE__ */ jsxDEV5(Sequence, {
548
+ from: TAGLINE_START - OUTPUTS_START,
549
+ children: /* @__PURE__ */ jsxDEV5("div", {
550
+ style: { marginTop: 48 },
551
+ children: /* @__PURE__ */ jsxDEV5(AnimatedText, {
552
+ text: tagline,
553
+ variant: "heading",
554
+ enterAt: 0,
555
+ color: theme.colors.accent,
556
+ align: "center"
557
+ }, undefined, false, undefined, this)
558
+ }, undefined, false, undefined, this)
559
+ }, undefined, false, undefined, this)
560
+ ]
561
+ }, undefined, true, undefined, this)
562
+ }, undefined, false, undefined, this)
563
+ ]
564
+ }, undefined, true, undefined, this),
565
+ /* @__PURE__ */ jsxDEV5(ProgressBar, {}, undefined, false, undefined, this)
566
+ ]
567
+ }, undefined, true, undefined, this);
568
+ };
569
+ var MethodBadge = ({
570
+ method,
571
+ enterAt
572
+ }) => {
573
+ const frame = useCurrentFrame5();
574
+ const opacity = interpolate4(frame, [enterAt, enterAt + 10], [0, 1], {
575
+ extrapolateLeft: "clamp",
576
+ extrapolateRight: "clamp",
577
+ easing: videoEasing.entrance
578
+ });
579
+ const scale = interpolate4(frame, [enterAt, enterAt + 12], [0.8, 1], {
580
+ extrapolateLeft: "clamp",
581
+ extrapolateRight: "clamp",
582
+ easing: videoEasing.emphasis
583
+ });
584
+ const methodColors = {
585
+ GET: "#61afef",
586
+ POST: "#98c379",
587
+ PUT: "#e5c07b",
588
+ PATCH: "#d19a66",
589
+ DELETE: "#e06c75"
590
+ };
591
+ return /* @__PURE__ */ jsxDEV5("div", {
592
+ style: {
593
+ opacity,
594
+ transform: `scale(${scale})`,
595
+ backgroundColor: methodColors[method] ?? "#61afef",
596
+ color: "#000",
597
+ padding: "8px 20px",
598
+ borderRadius: 8,
599
+ fontSize: 24,
600
+ fontWeight: 700,
601
+ fontFamily: "monospace",
602
+ letterSpacing: 1
603
+ },
604
+ children: method
605
+ }, undefined, false, undefined, this);
606
+ };
607
+ var OutputChip = ({ label, startFrame }) => {
608
+ const frame = useCurrentFrame5();
609
+ const opacity = interpolate4(frame, [startFrame, startFrame + 12], [0, 1], {
610
+ extrapolateLeft: "clamp",
611
+ extrapolateRight: "clamp"
612
+ });
613
+ const translateY = interpolate4(frame, [startFrame, startFrame + 15], [20, 0], {
614
+ extrapolateLeft: "clamp",
615
+ extrapolateRight: "clamp",
616
+ easing: videoEasing.emphasis
617
+ });
618
+ const scale = interpolate4(frame, [startFrame, startFrame + 15], [0.9, 1], {
619
+ extrapolateLeft: "clamp",
620
+ extrapolateRight: "clamp",
621
+ easing: videoEasing.emphasis
622
+ });
623
+ return /* @__PURE__ */ jsxDEV5("div", {
624
+ style: {
625
+ opacity,
626
+ transform: `translateY(${translateY}px) scale(${scale})`,
627
+ backgroundColor: "rgba(255,255,255,0.08)",
628
+ border: "1px solid rgba(255,255,255,0.15)",
629
+ color: "#ffffff",
630
+ padding: "16px 32px",
631
+ borderRadius: 12,
632
+ fontSize: 28,
633
+ fontWeight: 500
634
+ },
635
+ children: label
636
+ }, undefined, false, undefined, this);
637
+ };
638
+
639
+ // src/compositions/primitives/terminal.tsx
640
+ import { interpolate as interpolate5, useCurrentFrame as useCurrentFrame6, useVideoConfig as useVideoConfig6 } from "remotion";
641
+ import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
642
+ var LINE_TYPE_COLORS = {
643
+ command: "#c9d1d9",
644
+ output: "#8b949e",
645
+ error: "#f85149",
646
+ success: "#3fb950",
647
+ comment: "#6e7681"
648
+ };
649
+ var Terminal = ({
650
+ lines,
651
+ startAt = 0,
652
+ prompt = "$ ",
653
+ title = "Terminal",
654
+ backgroundColor = defaultVideoColors.terminalBackground,
655
+ typingSpeed = videoDurations.codeTypingPerChar
656
+ }) => {
657
+ const frame = useCurrentFrame6();
658
+ const { width } = useVideoConfig6();
659
+ const codeStyle = scaleTypography(videoTypography.code, width);
660
+ const lineTimings = [];
661
+ let currentFrame = startAt;
662
+ for (const line of lines) {
663
+ const delay = line.delay ?? 10;
664
+ const lineStart = currentFrame + delay;
665
+ if (line.type === "command") {
666
+ const typeDuration = line.text.length * typingSpeed;
667
+ lineTimings.push({
668
+ startFrame: lineStart,
669
+ endFrame: lineStart + typeDuration
670
+ });
671
+ currentFrame = lineStart + typeDuration;
672
+ } else {
673
+ lineTimings.push({ startFrame: lineStart, endFrame: lineStart + 5 });
674
+ currentFrame = lineStart + 5;
675
+ }
676
+ }
677
+ const opacity = interpolate5(frame, [startAt, startAt + 10], [0, 1], {
678
+ extrapolateLeft: "clamp",
679
+ extrapolateRight: "clamp",
680
+ easing: videoEasing.entrance
681
+ });
682
+ return /* @__PURE__ */ jsxDEV6("div", {
683
+ style: {
684
+ backgroundColor,
685
+ borderRadius: 16,
686
+ overflow: "hidden",
687
+ opacity,
688
+ boxShadow: "0 8px 32px rgba(0,0,0,0.3)"
689
+ },
690
+ children: [
691
+ /* @__PURE__ */ jsxDEV6("div", {
692
+ style: {
693
+ display: "flex",
694
+ alignItems: "center",
695
+ padding: "12px 20px",
696
+ backgroundColor: "rgba(255,255,255,0.05)",
697
+ gap: 8
698
+ },
699
+ children: [
700
+ /* @__PURE__ */ jsxDEV6("div", {
701
+ style: { display: "flex", gap: 8 },
702
+ children: [
703
+ /* @__PURE__ */ jsxDEV6("div", {
704
+ style: {
705
+ width: 12,
706
+ height: 12,
707
+ borderRadius: "50%",
708
+ backgroundColor: "#ff5f57"
709
+ }
710
+ }, undefined, false, undefined, this),
711
+ /* @__PURE__ */ jsxDEV6("div", {
712
+ style: {
713
+ width: 12,
714
+ height: 12,
715
+ borderRadius: "50%",
716
+ backgroundColor: "#febc2e"
717
+ }
718
+ }, undefined, false, undefined, this),
719
+ /* @__PURE__ */ jsxDEV6("div", {
720
+ style: {
721
+ width: 12,
722
+ height: 12,
723
+ borderRadius: "50%",
724
+ backgroundColor: "#28c840"
725
+ }
726
+ }, undefined, false, undefined, this)
727
+ ]
728
+ }, undefined, true, undefined, this),
729
+ /* @__PURE__ */ jsxDEV6("div", {
730
+ style: {
731
+ flex: 1,
732
+ textAlign: "center",
733
+ color: "#484f58",
734
+ fontSize: codeStyle.fontSize * 0.7,
735
+ fontFamily: "monospace"
736
+ },
737
+ children: title
738
+ }, undefined, false, undefined, this)
739
+ ]
740
+ }, undefined, true, undefined, this),
741
+ /* @__PURE__ */ jsxDEV6("div", {
742
+ style: { padding: "24px 32px", minHeight: 200 },
743
+ children: lines.map((line, i) => {
744
+ const timing = lineTimings[i];
745
+ if (!timing || frame < timing.startFrame)
746
+ return null;
747
+ const isCommand = line.type === "command";
748
+ const lineColor = LINE_TYPE_COLORS[line.type];
749
+ let visibleText = line.text;
750
+ if (isCommand) {
751
+ const typingProgress = interpolate5(frame, [timing.startFrame, timing.endFrame], [0, line.text.length], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
752
+ visibleText = line.text.slice(0, Math.floor(typingProgress));
753
+ }
754
+ const lineOpacity = isCommand ? 1 : interpolate5(frame, [timing.startFrame, timing.startFrame + 5], [0, 1], {
755
+ extrapolateLeft: "clamp",
756
+ extrapolateRight: "clamp"
757
+ });
758
+ const isTyping = isCommand && frame >= timing.startFrame && frame <= timing.endFrame;
759
+ const showCursor = isTyping && frame % 16 < 10;
760
+ return /* @__PURE__ */ jsxDEV6("div", {
761
+ style: {
762
+ fontFamily: "'SF Mono', 'Fira Code', 'JetBrains Mono', monospace",
763
+ fontSize: codeStyle.fontSize,
764
+ lineHeight: 1.8,
765
+ color: lineColor,
766
+ opacity: lineOpacity,
767
+ whiteSpace: "pre-wrap"
768
+ },
769
+ children: [
770
+ isCommand && /* @__PURE__ */ jsxDEV6("span", {
771
+ style: { color: "#3fb950" },
772
+ children: prompt
773
+ }, undefined, false, undefined, this),
774
+ line.type === "comment" && /* @__PURE__ */ jsxDEV6("span", {
775
+ style: { color: LINE_TYPE_COLORS.comment },
776
+ children: "# "
777
+ }, undefined, false, undefined, this),
778
+ visibleText,
779
+ showCursor && /* @__PURE__ */ jsxDEV6("span", {
780
+ style: {
781
+ backgroundColor: "#c9d1d9",
782
+ width: "2px",
783
+ display: "inline-block",
784
+ height: "1.2em",
785
+ verticalAlign: "text-bottom"
786
+ },
787
+ children: "\xA0"
788
+ }, undefined, false, undefined, this)
789
+ ]
790
+ }, `${i}-${line.text.slice(0, 20)}`, true, undefined, this);
791
+ })
792
+ }, undefined, false, undefined, this)
793
+ ]
794
+ }, undefined, true, undefined, this);
795
+ };
796
+
797
+ // src/compositions/primitives/transition.tsx
798
+ import { interpolate as interpolate6, useCurrentFrame as useCurrentFrame7 } from "remotion";
799
+ import { jsxDEV as jsxDEV7, Fragment } from "react/jsx-dev-runtime";
800
+ var SceneTransitionWrapper = ({
801
+ type,
802
+ durationInFrames,
803
+ direction,
804
+ startAt = 0,
805
+ children
806
+ }) => {
807
+ const frame = useCurrentFrame7();
808
+ if (type === "none" || durationInFrames === 0) {
809
+ return /* @__PURE__ */ jsxDEV7(Fragment, {
810
+ children
811
+ }, undefined, false, undefined, this);
812
+ }
813
+ const progress = interpolate6(frame, [startAt, startAt + durationInFrames], direction === "in" ? [0, 1] : [1, 0], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
814
+ const styles = getTransitionStyles(type, progress);
815
+ return /* @__PURE__ */ jsxDEV7("div", {
816
+ style: styles,
817
+ children
818
+ }, undefined, false, undefined, this);
819
+ };
820
+ function getTransitionStyles(type, progress) {
821
+ const eased = videoEasing.entrance(progress);
822
+ switch (type) {
823
+ case "fade":
824
+ return {
825
+ opacity: eased,
826
+ width: "100%",
827
+ height: "100%"
828
+ };
829
+ case "slide-left":
830
+ return {
831
+ opacity: eased,
832
+ transform: `translateX(${(1 - eased) * 100}%)`,
833
+ width: "100%",
834
+ height: "100%"
835
+ };
836
+ case "slide-right":
837
+ return {
838
+ opacity: eased,
839
+ transform: `translateX(${(1 - eased) * -100}%)`,
840
+ width: "100%",
841
+ height: "100%"
842
+ };
843
+ case "wipe":
844
+ return {
845
+ clipPath: `inset(0 ${(1 - eased) * 100}% 0 0)`,
846
+ width: "100%",
847
+ height: "100%"
848
+ };
849
+ default:
850
+ return { width: "100%", height: "100%" };
851
+ }
852
+ }
853
+ // src/compositions/social-clip.tsx
854
+ import {
855
+ AbsoluteFill as AbsoluteFill2,
856
+ Sequence as Sequence2,
857
+ interpolate as interpolate7,
858
+ useCurrentFrame as useCurrentFrame8,
859
+ useVideoConfig as useVideoConfig7
860
+ } from "remotion";
861
+ import { jsxDEV as jsxDEV8 } from "react/jsx-dev-runtime";
862
+ var SocialClip = ({
863
+ hook,
864
+ message,
865
+ points = [],
866
+ cta = "Learn more",
867
+ ctaUrl = "contractspec.dev",
868
+ accentColor
869
+ }) => {
870
+ const { durationInFrames, width, height } = useVideoConfig7();
871
+ const theme = defaultVideoTheme;
872
+ const accent = accentColor ?? theme.colors.accent;
873
+ const isPortrait = height > width;
874
+ const HOOK_DURATION = 75;
875
+ const MESSAGE_START = 60;
876
+ const POINTS_START = MESSAGE_START + 60;
877
+ const CTA_START = durationInFrames - 90;
878
+ return /* @__PURE__ */ jsxDEV8(AbsoluteFill2, {
879
+ children: [
880
+ /* @__PURE__ */ jsxDEV8(BrandFrame, {
881
+ variant: "gradient",
882
+ showBranding: true,
883
+ children: /* @__PURE__ */ jsxDEV8("div", {
884
+ style: {
885
+ flex: 1,
886
+ display: "flex",
887
+ flexDirection: "column",
888
+ justifyContent: "center",
889
+ alignItems: "center",
890
+ gap: isPortrait ? 48 : 32,
891
+ textAlign: "center",
892
+ padding: isPortrait ? "0 20px" : 0
893
+ },
894
+ children: [
895
+ /* @__PURE__ */ jsxDEV8(Sequence2, {
896
+ from: 0,
897
+ durationInFrames: HOOK_DURATION + 30,
898
+ children: /* @__PURE__ */ jsxDEV8("div", {
899
+ style: { width: "100%" },
900
+ children: /* @__PURE__ */ jsxDEV8(AnimatedText, {
901
+ text: hook,
902
+ variant: "title",
903
+ enterAt: 5,
904
+ exitAt: HOOK_DURATION,
905
+ color: "#ffffff",
906
+ align: "center"
907
+ }, undefined, false, undefined, this)
908
+ }, undefined, false, undefined, this)
909
+ }, undefined, false, undefined, this),
910
+ /* @__PURE__ */ jsxDEV8(Sequence2, {
911
+ from: MESSAGE_START,
912
+ children: /* @__PURE__ */ jsxDEV8("div", {
913
+ style: { width: "100%" },
914
+ children: /* @__PURE__ */ jsxDEV8(AnimatedText, {
915
+ text: message,
916
+ variant: isPortrait ? "subheading" : "heading",
917
+ enterAt: 0,
918
+ color: "#ffffff",
919
+ align: "center"
920
+ }, undefined, false, undefined, this)
921
+ }, undefined, false, undefined, this)
922
+ }, undefined, false, undefined, this),
923
+ points.length > 0 && /* @__PURE__ */ jsxDEV8(Sequence2, {
924
+ from: POINTS_START,
925
+ children: /* @__PURE__ */ jsxDEV8("div", {
926
+ style: {
927
+ display: "flex",
928
+ flexDirection: "column",
929
+ gap: 16,
930
+ alignItems: isPortrait ? "flex-start" : "center",
931
+ width: "100%",
932
+ maxWidth: isPortrait ? "100%" : "80%",
933
+ marginTop: 16
934
+ },
935
+ children: points.map((point, i) => /* @__PURE__ */ jsxDEV8(PointItem, {
936
+ text: point,
937
+ index: i,
938
+ startFrame: i * 15,
939
+ accent
940
+ }, point, false, undefined, this))
941
+ }, undefined, false, undefined, this)
942
+ }, undefined, false, undefined, this),
943
+ /* @__PURE__ */ jsxDEV8(Sequence2, {
944
+ from: CTA_START,
945
+ children: /* @__PURE__ */ jsxDEV8(CTABlock, {
946
+ cta,
947
+ url: ctaUrl,
948
+ accent
949
+ }, undefined, false, undefined, this)
950
+ }, undefined, false, undefined, this)
951
+ ]
952
+ }, undefined, true, undefined, this)
953
+ }, undefined, false, undefined, this),
954
+ /* @__PURE__ */ jsxDEV8(ProgressBar, {
955
+ color: accent
956
+ }, undefined, false, undefined, this)
957
+ ]
958
+ }, undefined, true, undefined, this);
959
+ };
960
+ var PointItem = ({ text, startFrame, accent }) => {
961
+ const frame = useCurrentFrame8();
962
+ const opacity = interpolate7(frame, [startFrame, startFrame + 12], [0, 1], {
963
+ extrapolateLeft: "clamp",
964
+ extrapolateRight: "clamp"
965
+ });
966
+ const translateX = interpolate7(frame, [startFrame, startFrame + 15], [-30, 0], {
967
+ extrapolateLeft: "clamp",
968
+ extrapolateRight: "clamp",
969
+ easing: videoEasing.entrance
970
+ });
971
+ return /* @__PURE__ */ jsxDEV8("div", {
972
+ style: {
973
+ opacity,
974
+ transform: `translateX(${translateX}px)`,
975
+ display: "flex",
976
+ alignItems: "center",
977
+ gap: 16,
978
+ fontSize: 28,
979
+ color: "#ffffff"
980
+ },
981
+ children: [
982
+ /* @__PURE__ */ jsxDEV8("div", {
983
+ style: {
984
+ width: 8,
985
+ height: 8,
986
+ borderRadius: "50%",
987
+ backgroundColor: accent,
988
+ flexShrink: 0
989
+ }
990
+ }, undefined, false, undefined, this),
991
+ text
992
+ ]
993
+ }, undefined, true, undefined, this);
994
+ };
995
+ var CTABlock = ({ cta, url, accent }) => {
996
+ const frame = useCurrentFrame8();
997
+ const opacity = interpolate7(frame, [0, 15], [0, 1], {
998
+ extrapolateLeft: "clamp",
999
+ extrapolateRight: "clamp"
1000
+ });
1001
+ const scale = interpolate7(frame, [0, 18], [0.9, 1], {
1002
+ extrapolateLeft: "clamp",
1003
+ extrapolateRight: "clamp",
1004
+ easing: videoEasing.emphasis
1005
+ });
1006
+ return /* @__PURE__ */ jsxDEV8("div", {
1007
+ style: {
1008
+ opacity,
1009
+ transform: `scale(${scale})`,
1010
+ display: "flex",
1011
+ flexDirection: "column",
1012
+ alignItems: "center",
1013
+ gap: 12,
1014
+ marginTop: 24
1015
+ },
1016
+ children: [
1017
+ /* @__PURE__ */ jsxDEV8("div", {
1018
+ style: {
1019
+ backgroundColor: accent,
1020
+ color: "#ffffff",
1021
+ padding: "16px 48px",
1022
+ borderRadius: 12,
1023
+ fontSize: 28,
1024
+ fontWeight: 600
1025
+ },
1026
+ children: cta
1027
+ }, undefined, false, undefined, this),
1028
+ /* @__PURE__ */ jsxDEV8("div", {
1029
+ style: { color: "rgba(255,255,255,0.5)", fontSize: 20 },
1030
+ children: url
1031
+ }, undefined, false, undefined, this)
1032
+ ]
1033
+ }, undefined, true, undefined, this);
1034
+ };
1035
+
1036
+ // src/compositions/terminal-demo.tsx
1037
+ import { AbsoluteFill as AbsoluteFill3, Sequence as Sequence3, useVideoConfig as useVideoConfig8 } from "remotion";
1038
+ import { jsxDEV as jsxDEV9 } from "react/jsx-dev-runtime";
1039
+ var TerminalDemo = ({
1040
+ title,
1041
+ subtitle,
1042
+ lines,
1043
+ terminalTitle = "Terminal",
1044
+ prompt = "$ ",
1045
+ summary
1046
+ }) => {
1047
+ const { durationInFrames } = useVideoConfig8();
1048
+ const theme = defaultVideoTheme;
1049
+ const TERMINAL_START = 40;
1050
+ const SUMMARY_START = durationInFrames - 90;
1051
+ return /* @__PURE__ */ jsxDEV9(AbsoluteFill3, {
1052
+ children: [
1053
+ /* @__PURE__ */ jsxDEV9(BrandFrame, {
1054
+ variant: "dark",
1055
+ showBranding: true,
1056
+ children: /* @__PURE__ */ jsxDEV9("div", {
1057
+ style: {
1058
+ flex: 1,
1059
+ display: "flex",
1060
+ flexDirection: "column",
1061
+ gap: 24
1062
+ },
1063
+ children: [
1064
+ /* @__PURE__ */ jsxDEV9("div", {
1065
+ children: [
1066
+ /* @__PURE__ */ jsxDEV9(AnimatedText, {
1067
+ text: title,
1068
+ variant: "heading",
1069
+ enterAt: 5,
1070
+ color: "#ffffff"
1071
+ }, undefined, false, undefined, this),
1072
+ subtitle && /* @__PURE__ */ jsxDEV9("div", {
1073
+ style: { marginTop: 8 },
1074
+ children: /* @__PURE__ */ jsxDEV9(AnimatedText, {
1075
+ text: subtitle,
1076
+ variant: "body",
1077
+ enterAt: 15,
1078
+ color: theme.colors.mutedForeground
1079
+ }, undefined, false, undefined, this)
1080
+ }, undefined, false, undefined, this)
1081
+ ]
1082
+ }, undefined, true, undefined, this),
1083
+ /* @__PURE__ */ jsxDEV9(Sequence3, {
1084
+ from: TERMINAL_START,
1085
+ children: /* @__PURE__ */ jsxDEV9("div", {
1086
+ style: { flex: 1 },
1087
+ children: /* @__PURE__ */ jsxDEV9(Terminal, {
1088
+ lines,
1089
+ startAt: 0,
1090
+ prompt,
1091
+ title: terminalTitle
1092
+ }, undefined, false, undefined, this)
1093
+ }, undefined, false, undefined, this)
1094
+ }, undefined, false, undefined, this),
1095
+ summary && /* @__PURE__ */ jsxDEV9(Sequence3, {
1096
+ from: SUMMARY_START,
1097
+ children: /* @__PURE__ */ jsxDEV9("div", {
1098
+ style: {
1099
+ marginTop: "auto",
1100
+ paddingTop: 24
1101
+ },
1102
+ children: /* @__PURE__ */ jsxDEV9(AnimatedText, {
1103
+ text: summary,
1104
+ variant: "subheading",
1105
+ enterAt: 0,
1106
+ color: theme.colors.accent,
1107
+ align: "center"
1108
+ }, undefined, false, undefined, this)
1109
+ }, undefined, false, undefined, this)
1110
+ }, undefined, false, undefined, this)
1111
+ ]
1112
+ }, undefined, true, undefined, this)
1113
+ }, undefined, false, undefined, this),
1114
+ /* @__PURE__ */ jsxDEV9(ProgressBar, {}, undefined, false, undefined, this)
1115
+ ]
1116
+ }, undefined, true, undefined, this);
1117
+ };
1118
+ // src/generators/scene-planner.ts
1119
+ class ScenePlanner {
1120
+ llm;
1121
+ model;
1122
+ temperature;
1123
+ fps;
1124
+ constructor(options) {
1125
+ this.llm = options?.llm;
1126
+ this.model = options?.model;
1127
+ this.temperature = options?.temperature ?? 0.3;
1128
+ this.fps = options?.fps ?? DEFAULT_FPS;
1129
+ }
1130
+ async plan(brief) {
1131
+ if (this.llm) {
1132
+ return this.planWithLlm(brief);
1133
+ }
1134
+ return this.planDeterministic(brief);
1135
+ }
1136
+ planDeterministic(brief) {
1137
+ const { content } = brief;
1138
+ const scenes = [];
1139
+ const fps = this.fps;
1140
+ scenes.push({
1141
+ compositionId: "SocialClip",
1142
+ props: {
1143
+ hook: content.title,
1144
+ message: content.summary,
1145
+ points: content.solutions.slice(0, 3),
1146
+ cta: content.callToAction ?? "Learn more"
1147
+ },
1148
+ durationInFrames: 3 * fps,
1149
+ narrationText: `${content.title}. ${content.summary}`
1150
+ });
1151
+ if (content.problems.length > 0) {
1152
+ scenes.push({
1153
+ compositionId: "SocialClip",
1154
+ props: {
1155
+ hook: "The Problem",
1156
+ message: content.problems[0] ?? "",
1157
+ points: content.problems.slice(1, 4)
1158
+ },
1159
+ durationInFrames: 4 * fps,
1160
+ narrationText: `The problem: ${content.problems.join(". ")}`
1161
+ });
1162
+ }
1163
+ if (content.solutions.length > 0) {
1164
+ scenes.push({
1165
+ compositionId: "SocialClip",
1166
+ props: {
1167
+ hook: "The Solution",
1168
+ message: content.solutions[0] ?? "",
1169
+ points: content.solutions.slice(1, 4)
1170
+ },
1171
+ durationInFrames: 5 * fps,
1172
+ narrationText: `The solution: ${content.solutions.join(". ")}`
1173
+ });
1174
+ }
1175
+ if (content.metrics && content.metrics.length > 0) {
1176
+ scenes.push({
1177
+ compositionId: "SocialClip",
1178
+ props: {
1179
+ hook: "Results",
1180
+ message: content.metrics[0] ?? "",
1181
+ points: content.metrics.slice(1, 3)
1182
+ },
1183
+ durationInFrames: 3 * fps,
1184
+ narrationText: content.metrics.join(". ")
1185
+ });
1186
+ }
1187
+ if (content.callToAction) {
1188
+ scenes.push({
1189
+ compositionId: "SocialClip",
1190
+ props: {
1191
+ hook: content.callToAction,
1192
+ message: "",
1193
+ cta: content.callToAction
1194
+ },
1195
+ durationInFrames: 2 * fps,
1196
+ narrationText: content.callToAction
1197
+ });
1198
+ }
1199
+ if (brief.targetDurationSeconds) {
1200
+ const targetFrames = brief.targetDurationSeconds * fps;
1201
+ const currentFrames = scenes.reduce((sum, s) => sum + s.durationInFrames, 0);
1202
+ const ratio = targetFrames / currentFrames;
1203
+ for (const scene of scenes) {
1204
+ scene.durationInFrames = Math.round(scene.durationInFrames * ratio);
1205
+ }
1206
+ }
1207
+ const totalDuration = scenes.reduce((sum, s) => sum + s.durationInFrames, 0);
1208
+ const narrationScript = scenes.filter((s) => s.narrationText).map((s) => s.narrationText).join(" ");
1209
+ return {
1210
+ scenes,
1211
+ estimatedDurationSeconds: totalDuration / fps,
1212
+ narrationScript
1213
+ };
1214
+ }
1215
+ async planWithLlm(brief) {
1216
+ const messages = [
1217
+ {
1218
+ role: "system",
1219
+ content: [
1220
+ {
1221
+ type: "text",
1222
+ text: `You are a video scene planner for ContractSpec marketing/documentation videos.
1223
+ Given a content brief, break it into video scenes.
1224
+
1225
+ Each scene must have:
1226
+ - compositionId: one of "ApiOverview", "SocialClip", "TerminalDemo"
1227
+ - props: the input props for that composition (see type definitions)
1228
+ - durationInFrames: duration at ${this.fps}fps
1229
+ - narrationText: what the narrator says during this scene
1230
+
1231
+ Return a JSON object with shape:
1232
+ {
1233
+ "scenes": [{ "compositionId": string, "props": object, "durationInFrames": number, "narrationText": string }],
1234
+ "narrationScript": string
1235
+ }
1236
+
1237
+ Keep the total duration around ${brief.targetDurationSeconds ?? 30} seconds.
1238
+ Prioritize clarity and pacing. Each scene should communicate one idea.`
1239
+ }
1240
+ ]
1241
+ },
1242
+ {
1243
+ role: "user",
1244
+ content: [
1245
+ {
1246
+ type: "text",
1247
+ text: JSON.stringify(brief.content)
1248
+ }
1249
+ ]
1250
+ }
1251
+ ];
1252
+ if (!this.llm) {
1253
+ return this.planDeterministic(brief);
1254
+ }
1255
+ try {
1256
+ const response = await this.llm.chat(messages, {
1257
+ model: this.model,
1258
+ temperature: this.temperature,
1259
+ responseFormat: "json"
1260
+ });
1261
+ const text = response.message.content.find((p) => p.type === "text");
1262
+ if (!text || text.type !== "text") {
1263
+ return this.planDeterministic(brief);
1264
+ }
1265
+ const parsed = JSON.parse(text.text);
1266
+ const totalDuration = parsed.scenes.reduce((sum, s) => sum + s.durationInFrames, 0);
1267
+ return {
1268
+ scenes: parsed.scenes,
1269
+ estimatedDurationSeconds: totalDuration / this.fps,
1270
+ narrationScript: parsed.narrationScript
1271
+ };
1272
+ } catch {
1273
+ return this.planDeterministic(brief);
1274
+ }
1275
+ }
1276
+ }
1277
+
1278
+ // src/generators/script-generator.ts
1279
+ class ScriptGenerator {
1280
+ llm;
1281
+ model;
1282
+ temperature;
1283
+ constructor(options) {
1284
+ this.llm = options?.llm;
1285
+ this.model = options?.model;
1286
+ this.temperature = options?.temperature ?? 0.5;
1287
+ }
1288
+ async generate(brief, config) {
1289
+ const style = config?.style ?? "professional";
1290
+ if (this.llm) {
1291
+ return this.generateWithLlm(brief, style);
1292
+ }
1293
+ return this.generateDeterministic(brief, style);
1294
+ }
1295
+ generateDeterministic(brief, style) {
1296
+ const segments = [];
1297
+ const intro = this.formatForStyle(`${brief.title}. ${brief.summary}`, style);
1298
+ segments.push({
1299
+ sceneId: "intro",
1300
+ text: intro,
1301
+ estimatedDurationSeconds: this.estimateDuration(intro)
1302
+ });
1303
+ if (brief.problems.length > 0) {
1304
+ const problemText = this.formatForStyle(`The challenge: ${brief.problems.join(". ")}`, style);
1305
+ segments.push({
1306
+ sceneId: "problems",
1307
+ text: problemText,
1308
+ estimatedDurationSeconds: this.estimateDuration(problemText)
1309
+ });
1310
+ }
1311
+ if (brief.solutions.length > 0) {
1312
+ const solutionText = this.formatForStyle(`The solution: ${brief.solutions.join(". ")}`, style);
1313
+ segments.push({
1314
+ sceneId: "solutions",
1315
+ text: solutionText,
1316
+ estimatedDurationSeconds: this.estimateDuration(solutionText)
1317
+ });
1318
+ }
1319
+ if (brief.metrics && brief.metrics.length > 0) {
1320
+ const metricsText = this.formatForStyle(`The results: ${brief.metrics.join(". ")}`, style);
1321
+ segments.push({
1322
+ sceneId: "metrics",
1323
+ text: metricsText,
1324
+ estimatedDurationSeconds: this.estimateDuration(metricsText)
1325
+ });
1326
+ }
1327
+ if (brief.callToAction) {
1328
+ const ctaText = this.formatForStyle(brief.callToAction, style);
1329
+ segments.push({
1330
+ sceneId: "cta",
1331
+ text: ctaText,
1332
+ estimatedDurationSeconds: this.estimateDuration(ctaText)
1333
+ });
1334
+ }
1335
+ const fullText = segments.map((s) => s.text).join(" ");
1336
+ const totalDuration = segments.reduce((sum, s) => sum + s.estimatedDurationSeconds, 0);
1337
+ return {
1338
+ fullText,
1339
+ segments,
1340
+ estimatedDurationSeconds: totalDuration,
1341
+ style
1342
+ };
1343
+ }
1344
+ async generateWithLlm(brief, style) {
1345
+ const styleGuide = {
1346
+ professional: "Use a clear, authoritative, professional tone. Be concise and direct.",
1347
+ casual: "Use a friendly, conversational tone. Be approachable and relatable.",
1348
+ technical: "Use precise technical language. Be detailed and accurate."
1349
+ };
1350
+ const styleKey = style ?? "professional";
1351
+ const messages = [
1352
+ {
1353
+ role: "system",
1354
+ content: [
1355
+ {
1356
+ type: "text",
1357
+ text: `You are a video narration script writer.
1358
+ Write a narration script for a short video (30-60 seconds).
1359
+ ${styleGuide[styleKey]}
1360
+
1361
+ Return JSON with shape:
1362
+ {
1363
+ "segments": [{ "sceneId": string, "text": string }],
1364
+ "fullText": string
1365
+ }
1366
+
1367
+ Scene IDs should be: "intro", "problems", "solutions", "metrics", "cta".
1368
+ Only include segments that are relevant to the brief content.`
1369
+ }
1370
+ ]
1371
+ },
1372
+ {
1373
+ role: "user",
1374
+ content: [{ type: "text", text: JSON.stringify(brief) }]
1375
+ }
1376
+ ];
1377
+ if (!this.llm) {
1378
+ return this.generateDeterministic(brief, style);
1379
+ }
1380
+ try {
1381
+ const response = await this.llm.chat(messages, {
1382
+ model: this.model,
1383
+ temperature: this.temperature,
1384
+ responseFormat: "json"
1385
+ });
1386
+ const text = response.message.content.find((p) => p.type === "text");
1387
+ if (!text || text.type !== "text") {
1388
+ return this.generateDeterministic(brief, style);
1389
+ }
1390
+ const parsed = JSON.parse(text.text);
1391
+ const segments = parsed.segments.map((s) => ({
1392
+ sceneId: s.sceneId,
1393
+ text: s.text,
1394
+ estimatedDurationSeconds: this.estimateDuration(s.text)
1395
+ }));
1396
+ return {
1397
+ fullText: parsed.fullText,
1398
+ segments,
1399
+ estimatedDurationSeconds: segments.reduce((sum, s) => sum + s.estimatedDurationSeconds, 0),
1400
+ style
1401
+ };
1402
+ } catch {
1403
+ return this.generateDeterministic(brief, style);
1404
+ }
1405
+ }
1406
+ formatForStyle(text, _style) {
1407
+ return text;
1408
+ }
1409
+ estimateDuration(text) {
1410
+ const wordCount = text.split(/\s+/).length;
1411
+ return Math.ceil(wordCount / 150 * 60);
1412
+ }
1413
+ }
1414
+
1415
+ // src/generators/video-generator.ts
1416
+ import { VIDEO_FORMATS as VIDEO_FORMATS2 } from "@contractspec/lib.contracts-integrations/integrations/providers/video";
1417
+ class VideoGenerator {
1418
+ scenePlanner;
1419
+ scriptGenerator;
1420
+ voice;
1421
+ defaultVoiceId;
1422
+ fps;
1423
+ constructor(options) {
1424
+ this.fps = options?.fps ?? DEFAULT_FPS;
1425
+ this.voice = options?.voice;
1426
+ this.defaultVoiceId = options?.defaultVoiceId;
1427
+ this.scenePlanner = new ScenePlanner({
1428
+ llm: options?.llm,
1429
+ model: options?.model,
1430
+ temperature: options?.temperature,
1431
+ fps: this.fps
1432
+ });
1433
+ this.scriptGenerator = new ScriptGenerator({
1434
+ llm: options?.llm,
1435
+ model: options?.model,
1436
+ temperature: options?.temperature
1437
+ });
1438
+ }
1439
+ async generate(brief) {
1440
+ const scenePlan = await this.scenePlanner.plan(brief);
1441
+ let narrationAudio;
1442
+ if (brief.narration?.enabled && this.voice) {
1443
+ const script = await this.scriptGenerator.generate(brief.content, brief.narration);
1444
+ const voiceId = brief.narration.voiceId ?? this.defaultVoiceId;
1445
+ if (voiceId && script.fullText) {
1446
+ try {
1447
+ const result = await this.voice.synthesize({
1448
+ text: script.fullText,
1449
+ voiceId,
1450
+ format: "mp3"
1451
+ });
1452
+ narrationAudio = {
1453
+ data: result.audio,
1454
+ format: "mp3",
1455
+ durationSeconds: result.durationSeconds ?? script.estimatedDurationSeconds,
1456
+ volume: 1
1457
+ };
1458
+ } catch {}
1459
+ }
1460
+ }
1461
+ const format = brief.format ?? VIDEO_FORMATS2.landscape;
1462
+ const scenes = scenePlan.scenes.map((planned, i) => ({
1463
+ id: `scene-${i}`,
1464
+ compositionId: planned.compositionId,
1465
+ props: planned.props,
1466
+ durationInFrames: planned.durationInFrames,
1467
+ narrationText: planned.narrationText
1468
+ }));
1469
+ const totalDurationInFrames = scenes.reduce((sum, s) => sum + s.durationInFrames, 0);
1470
+ const project = {
1471
+ id: generateProjectId(),
1472
+ scenes,
1473
+ totalDurationInFrames,
1474
+ fps: this.fps,
1475
+ format,
1476
+ audio: narrationAudio ? { narration: narrationAudio } : undefined
1477
+ };
1478
+ return project;
1479
+ }
1480
+ }
1481
+ function generateProjectId() {
1482
+ const timestamp = Date.now().toString(36);
1483
+ const random = Math.random().toString(36).slice(2, 8);
1484
+ return `vp_${timestamp}_${random}`;
1485
+ }
1486
+ // src/types.ts
1487
+ import { VIDEO_FORMATS as VIDEO_FORMATS3 } from "@contractspec/lib.contracts-integrations/integrations/providers/video";
1488
+
1489
+ // src/renderers/config.ts
1490
+ var defaultRenderConfig = {
1491
+ codec: "h264",
1492
+ outputFormat: "mp4",
1493
+ crf: 18,
1494
+ pixelFormat: "yuv420p"
1495
+ };
1496
+ var codecFormatMap = {
1497
+ h264: "mp4",
1498
+ h265: "mp4",
1499
+ vp8: "webm",
1500
+ vp9: "webm"
1501
+ };
1502
+ var qualityPresets = {
1503
+ draft: { crf: 28, concurrency: 1 },
1504
+ standard: { crf: 18, concurrency: undefined },
1505
+ high: { crf: 12, concurrency: undefined }
1506
+ };
1507
+ function resolveRenderConfig(userConfig, preset) {
1508
+ const presetValues = preset ? qualityPresets[preset] : {};
1509
+ return {
1510
+ ...defaultRenderConfig,
1511
+ ...presetValues,
1512
+ ...userConfig
1513
+ };
1514
+ }
1515
+ export {
1516
+ videoTypography,
1517
+ videoTransitions,
1518
+ videoSafeZone,
1519
+ videoPositions,
1520
+ videoEasing,
1521
+ videoDurations,
1522
+ scaleTypography,
1523
+ scaleSafeZone,
1524
+ resolveRenderConfig,
1525
+ qualityPresets,
1526
+ getAllFormatVariants,
1527
+ defaultVideoTheme,
1528
+ defaultVideoColors,
1529
+ defaultTokens,
1530
+ defaultRenderConfig,
1531
+ codecFormatMap,
1532
+ VideoGenerator,
1533
+ TerminalDemo,
1534
+ Terminal,
1535
+ SocialClip,
1536
+ ScriptGenerator,
1537
+ SceneTransitionWrapper,
1538
+ ScenePlanner,
1539
+ ProgressBar,
1540
+ DEFAULT_FPS,
1541
+ CodeBlock,
1542
+ BrandFrame,
1543
+ ApiOverview,
1544
+ AnimatedText
1545
+ };