@vanillaskyai/video 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.
Files changed (162) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/LICENSE +201 -0
  3. package/PUBLIC-API.md +276 -0
  4. package/README.md +152 -0
  5. package/SECURITY.md +22 -0
  6. package/SUPPORT.md +28 -0
  7. package/bin/vanillasky.js +3 -0
  8. package/dist/bg-confetti-WNQXS7ZS.js +89 -0
  9. package/dist/bg-emoji-ETI47GLS.js +150 -0
  10. package/dist/bg-media-SVUZAMGX.js +99 -0
  11. package/dist/brand-message-F3RD4P3P.js +253 -0
  12. package/dist/builtin-server-F7YXRVCH.js +8 -0
  13. package/dist/catalog-types-BIhSpOWK.d.ts +74 -0
  14. package/dist/chart-bar-CNSC7BNK.js +304 -0
  15. package/dist/chart-counter-MCRHKN77.js +299 -0
  16. package/dist/chart-progress-ring-RMI4A7ZK.js +296 -0
  17. package/dist/check-runtime.d.ts +15 -0
  18. package/dist/check-runtime.js +102 -0
  19. package/dist/chunk-2E6T633S.js +27 -0
  20. package/dist/chunk-352ZZCET.js +83 -0
  21. package/dist/chunk-73NTSFFI.js +81 -0
  22. package/dist/chunk-A2X45FET.js +46 -0
  23. package/dist/chunk-ABPKM4GK.js +187 -0
  24. package/dist/chunk-ABZACD4G.js +216 -0
  25. package/dist/chunk-BCRUUJ6A.js +756 -0
  26. package/dist/chunk-CHLGW22F.js +3551 -0
  27. package/dist/chunk-CJ7F2CE6.js +104 -0
  28. package/dist/chunk-CR7FE7BW.js +109 -0
  29. package/dist/chunk-E7CL7UPB.js +109 -0
  30. package/dist/chunk-EE6PK6XC.js +18 -0
  31. package/dist/chunk-ERY4S6QV.js +385 -0
  32. package/dist/chunk-EVG2ZYIY.js +125 -0
  33. package/dist/chunk-FNAEQ7QO.js +155 -0
  34. package/dist/chunk-FQ47WXAJ.js +38 -0
  35. package/dist/chunk-FSG2PYWG.js +336 -0
  36. package/dist/chunk-GHJEAP4O.js +504 -0
  37. package/dist/chunk-GRMUV7QY.js +262 -0
  38. package/dist/chunk-IFOW65Z6.js +205 -0
  39. package/dist/chunk-IXCUY3B3.js +786 -0
  40. package/dist/chunk-L5BTTCZV.js +97 -0
  41. package/dist/chunk-LMG3GHLL.js +107 -0
  42. package/dist/chunk-OOPIETLW.js +101 -0
  43. package/dist/chunk-P22HHFDK.js +43 -0
  44. package/dist/chunk-QAAO7OAY.js +19 -0
  45. package/dist/chunk-S7HFLYNN.js +35 -0
  46. package/dist/chunk-SPVTJH3F.js +24 -0
  47. package/dist/chunk-W2XJKG6C.js +3177 -0
  48. package/dist/chunk-XB7LH4J2.js +301 -0
  49. package/dist/chunk-XGRA2MUV.js +242 -0
  50. package/dist/chunk-XTOXFMLM.js +105 -0
  51. package/dist/chunk-YC5MFXA5.js +132 -0
  52. package/dist/cli.d.ts +1 -0
  53. package/dist/cli.js +1681 -0
  54. package/dist/compose-video-CN3VSWST.js +13 -0
  55. package/dist/cta-logo-SVA5GP2A.js +209 -0
  56. package/dist/cta-media-E7VLLK42.js +215 -0
  57. package/dist/events-_wfjbmEp.d.ts +81 -0
  58. package/dist/incoming-call-62MFZL3Z.js +320 -0
  59. package/dist/index.d.ts +15 -0
  60. package/dist/index.js +14 -0
  61. package/dist/infographic-before-after-AXCDAWND.js +460 -0
  62. package/dist/infographic-feature-list-GW5GUE6O.js +266 -0
  63. package/dist/infographic-problem-solution-7NURJANA.js +340 -0
  64. package/dist/infographic-stat-row-J7IZR6ZN.js +241 -0
  65. package/dist/infographic-steps-VSZM6F5M.js +400 -0
  66. package/dist/kit-BMNcHqa9.d.ts +79 -0
  67. package/dist/prompt-input-LOUCRXCY.js +236 -0
  68. package/dist/react.d.ts +81 -0
  69. package/dist/react.js +835 -0
  70. package/dist/reaction-QG4CYZLQ.js +119 -0
  71. package/dist/server.d.ts +141 -0
  72. package/dist/server.js +498 -0
  73. package/dist/showcase-code-RUTFZR3H.js +351 -0
  74. package/dist/showcase-phone-6CP6XEU5.js +272 -0
  75. package/dist/showcase-terminal-MGAEQWPR.js +306 -0
  76. package/dist/showcase-web-Y4W2HVRJ.js +390 -0
  77. package/dist/social-conversation-75SD2637.js +695 -0
  78. package/dist/social-milestone-XI2QE5BO.js +292 -0
  79. package/dist/social-notification-2UOHQCUY.js +244 -0
  80. package/dist/social-review-stack-FDYZGZTJ.js +239 -0
  81. package/dist/social-testimonial-OQ7N52GJ.js +284 -0
  82. package/dist/social-tweet-5OLCNPPC.js +295 -0
  83. package/dist/state-DZcKuS32.d.ts +3 -0
  84. package/dist/system-prompt-A6UXNTPK.js +8 -0
  85. package/dist/template-catalog.d.ts +24 -0
  86. package/dist/template-catalog.js +6 -0
  87. package/dist/templates.d.ts +25 -0
  88. package/dist/templates.js +19 -0
  89. package/dist/test.d.ts +149 -0
  90. package/dist/test.js +272 -0
  91. package/dist/text-stream-6XHC7J47.js +10 -0
  92. package/dist/types-B-PZR6G_.d.ts +208 -0
  93. package/dist/validate-T7GBU2YF.js +8 -0
  94. package/docs/agent-integration.md +39 -0
  95. package/docs/architecture.md +84 -0
  96. package/docs/branding-and-personalization.md +87 -0
  97. package/docs/concepts.md +106 -0
  98. package/docs/custom-templates.md +329 -0
  99. package/docs/customization.md +141 -0
  100. package/docs/errors.md +70 -0
  101. package/docs/getting-started.md +111 -0
  102. package/docs/input-and-first-scene.md +41 -0
  103. package/docs/integrate-nextjs.md +79 -0
  104. package/docs/media-and-audio.md +69 -0
  105. package/docs/motion-and-effects.md +107 -0
  106. package/docs/persistence.md +95 -0
  107. package/docs/production.md +122 -0
  108. package/docs/prompt-and-input.md +185 -0
  109. package/docs/provider-integration.md +115 -0
  110. package/docs/reference/protocol.md +96 -0
  111. package/docs/reference/provider-adapters.md +158 -0
  112. package/docs/responsive-orientation.md +37 -0
  113. package/docs/security.md +38 -0
  114. package/docs/streaming-protocol.md +15 -0
  115. package/docs/testing.md +137 -0
  116. package/docs/use-cases.md +59 -0
  117. package/examples/custom-template/README.md +19 -0
  118. package/examples/custom-template/minimal-text.tsx +82 -0
  119. package/examples/custom-template/structured-data.tsx +104 -0
  120. package/examples/custom-template/supplied-media.tsx +92 -0
  121. package/examples/nextjs-quickstart/.env.example +2 -0
  122. package/examples/nextjs-quickstart/README.md +22 -0
  123. package/examples/nextjs-quickstart/next-env.d.ts +4 -0
  124. package/examples/nextjs-quickstart/package.json +24 -0
  125. package/examples/nextjs-quickstart/src/app/api/video/route.ts +22 -0
  126. package/examples/nextjs-quickstart/src/app/layout.tsx +5 -0
  127. package/examples/nextjs-quickstart/src/app/page.tsx +31 -0
  128. package/examples/nextjs-quickstart/tsconfig.json +26 -0
  129. package/package.json +167 -0
  130. package/registry/items/backgrounds.json +52 -0
  131. package/registry/items/barChart.json +237 -0
  132. package/registry/items/beforeAfter.json +180 -0
  133. package/registry/items/bigNumber.json +225 -0
  134. package/registry/items/brandMessage.json +158 -0
  135. package/registry/items/cardList.json +206 -0
  136. package/registry/items/chatMessenger.json +151 -0
  137. package/registry/items/chatWhatsapp.json +151 -0
  138. package/registry/items/codeEditor.json +184 -0
  139. package/registry/items/confetti.json +107 -0
  140. package/registry/items/ctaLogo.json +160 -0
  141. package/registry/items/ctaMedia.json +193 -0
  142. package/registry/items/emojiBurst.json +101 -0
  143. package/registry/items/incomingCall.json +170 -0
  144. package/registry/items/media.json +179 -0
  145. package/registry/items/milestone.json +205 -0
  146. package/registry/items/motion.json +45 -0
  147. package/registry/items/notification.json +182 -0
  148. package/registry/items/phoneMockup.json +254 -0
  149. package/registry/items/problemSolution.json +186 -0
  150. package/registry/items/progressRing.json +199 -0
  151. package/registry/items/promptInput.json +148 -0
  152. package/registry/items/reaction.json +170 -0
  153. package/registry/items/reviewStack.json +224 -0
  154. package/registry/items/steps.json +207 -0
  155. package/registry/items/template-context.json +31 -0
  156. package/registry/items/terminal.json +212 -0
  157. package/registry/items/testimonial.json +164 -0
  158. package/registry/items/theme.json +47 -0
  159. package/registry/items/tripleStats.json +228 -0
  160. package/registry/items/tweet.json +203 -0
  161. package/registry/items/typography.json +47 -0
  162. package/registry/items/webMockup.json +273 -0
@@ -0,0 +1,295 @@
1
+ import {
2
+ stripPipe
3
+ } from "./chunk-S7HFLYNN.js";
4
+ import {
5
+ SceneBackground,
6
+ getMediaBackgroundProps
7
+ } from "./chunk-IFOW65Z6.js";
8
+ import {
9
+ renderWithEmoji
10
+ } from "./chunk-L5BTTCZV.js";
11
+ import {
12
+ autoTextColor
13
+ } from "./chunk-ABZACD4G.js";
14
+ import {
15
+ SPRING_SMOOTH,
16
+ interpolate,
17
+ spring
18
+ } from "./chunk-XTOXFMLM.js";
19
+ import {
20
+ resolveTokens
21
+ } from "./chunk-FNAEQ7QO.js";
22
+
23
+ // src/visual-system/primitives/social/TweetCard.tsx
24
+ import { jsx, jsxs } from "react/jsx-runtime";
25
+ var CLAMP = { extrapolateLeft: "clamp", extrapolateRight: "clamp" };
26
+ var X = {
27
+ cardBg: "#16181c",
28
+ cardBorder: "#2f3336",
29
+ text: "rgb(230, 230, 230)",
30
+ muted: "#71767b",
31
+ verified: "#1d9bf0"
32
+ };
33
+ function formatCount(n) {
34
+ const abs = Math.abs(n);
35
+ const sign = n < 0 ? "-" : "";
36
+ if (abs < 1e3) return n.toLocaleString();
37
+ if (abs < 1e4) {
38
+ const v2 = abs / 1e3;
39
+ const rounded = Number(v2.toFixed(1));
40
+ if (rounded < 10) return `${sign}${rounded.toString().replace(/\.0$/, "")}K`;
41
+ }
42
+ if (abs < 1e6) {
43
+ const k = Math.round(abs / 1e3);
44
+ if (k < 1e3) return `${sign}${k}K`;
45
+ }
46
+ if (abs < 1e7) {
47
+ const v2 = abs / 1e6;
48
+ const rounded = Number(v2.toFixed(1));
49
+ if (rounded < 10) return `${sign}${rounded.toString().replace(/\.0$/, "")}M`;
50
+ }
51
+ if (abs < 1e9) {
52
+ const m = Math.round(abs / 1e6);
53
+ if (m < 1e3) return `${sign}${m}M`;
54
+ }
55
+ const v = abs / 1e9;
56
+ return `${sign}${v.toFixed(1).replace(/\.0$/, "")}B`;
57
+ }
58
+ function hashHue(str) {
59
+ let h = 0;
60
+ for (let i = 0; i < str.length; i++) h = (h * 31 + str.charCodeAt(i)) % 360;
61
+ return h;
62
+ }
63
+ function deriveHandle(brandName) {
64
+ const slug = brandName.toLowerCase().replace(/[^a-z0-9]/g, "");
65
+ return slug ? `@${slug}` : "";
66
+ }
67
+ var XLogo = ({ size }) => /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 1200 1227", fill: "none", children: /* @__PURE__ */ jsx(
68
+ "path",
69
+ {
70
+ d: "M714.163 519.284 1160.89 0h-105.86L667.137 450.887 357.328 0H0l468.492 681.821L0 1226.37h105.866l409.625-476.152 327.181 476.152H1200L714.137 519.284h.026ZM569.165 687.828l-47.468-67.894-377.686-540.24h162.604l304.797 435.991 47.468 67.894 396.2 566.721H892.476L569.165 687.854v-.026Z",
71
+ fill: X.text
72
+ }
73
+ ) });
74
+ var VerifiedBadge = ({ size }) => /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 22 22", fill: "none", children: /* @__PURE__ */ jsx(
75
+ "path",
76
+ {
77
+ d: "M20.396 11c-.018-.646-.215-1.275-.57-1.816-.354-.54-.852-.972-1.438-1.246.223-.607.27-1.264.14-1.897-.131-.634-.437-1.218-.882-1.687-.47-.445-1.053-.75-1.687-.882-.633-.13-1.29-.083-1.897.14-.273-.587-.704-1.086-1.245-1.44C12.276 1.819 11.647 1.62 11 1.604c-.646.017-1.273.213-1.813.568s-.969.854-1.24 1.44c-.608-.223-1.267-.272-1.902-.14-.635.13-1.22.436-1.69.882-.445.47-.749 1.055-.878 1.688-.13.633-.08 1.29.144 1.896-.587.274-1.087.705-1.443 1.245-.356.54-.555 1.17-.574 1.817.02.647.218 1.276.574 1.817.356.54.856.972 1.443 1.245-.224.606-.274 1.263-.144 1.896.13.634.433 1.218.877 1.688.47.443 1.054.747 1.687.878.633.132 1.29.084 1.897-.136.274.586.705 1.084 1.246 1.439.54.354 1.17.551 1.816.569.647-.016 1.276-.213 1.817-.567s.972-.854 1.245-1.44c.604.239 1.266.296 1.903.164.636-.132 1.22-.447 1.68-.907.46-.46.776-1.044.908-1.681s.075-1.299-.165-1.903c.586-.274 1.084-.705 1.439-1.246.354-.54.551-1.17.569-1.816zM9.662 14.85L6.8 12.46l1.41-1.42 2.262 2.26 4.798-5.23 1.47 1.36-6.198 6.77z",
78
+ fill: X.verified
79
+ }
80
+ ) });
81
+ var CommentIcon = ({ size }) => /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: X.muted, strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z" }) });
82
+ var HeartIcon = ({ size }) => /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: X.muted, strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" }) });
83
+ var TweetCard = ({
84
+ progress,
85
+ motionProgress = progress,
86
+ authorName: rawName,
87
+ authorHandle: rawHandle,
88
+ authorVerified,
89
+ message: rawMessage,
90
+ targetLikes = 0,
91
+ targetReplies = 0,
92
+ accent,
93
+ width,
94
+ height,
95
+ beatIntensity = 0
96
+ }) => {
97
+ const dim = Math.min(width, height);
98
+ const s = dim / 1080;
99
+ const resolvedAccent = accent || `hsl(${hashHue(String(rawName))}, 60%, 55%)`;
100
+ const authorName = stripPipe(rawName);
101
+ const customHandle = stripPipe(rawHandle || "").trim();
102
+ const authorHandle = customHandle || deriveHandle(authorName);
103
+ const isVerified = authorVerified !== false;
104
+ const message = stripPipe(rawMessage);
105
+ const initialChar = authorName.charAt(0).toUpperCase() || "\u2022";
106
+ const cardScale = spring(interpolate(motionProgress, [0, 0.24], [0, 1], CLAMP), SPRING_SMOOTH);
107
+ const cardOpacity = interpolate(motionProgress, [0, 0.18], [0, 1], CLAMP);
108
+ const replyCount = Math.round(interpolate(progress, [0.3, 0.75], [0, targetReplies], CLAMP));
109
+ const likeCount = Math.round(interpolate(progress, [0.35, 0.8], [0, targetLikes], CLAMP));
110
+ const replyDisplay = formatCount(replyCount);
111
+ const likeDisplay = formatCount(likeCount);
112
+ const replyIsTransient = replyDisplay !== formatCount(Math.round(targetReplies));
113
+ const likeIsTransient = likeDisplay !== formatCount(Math.round(targetLikes));
114
+ const beatScale = 1 + beatIntensity * 0.01;
115
+ const cardWidth = Math.min(width * 0.92, dim * 0.95);
116
+ const cardPad = dim * 0.05;
117
+ const cardRadius = dim * 0.026;
118
+ const avatarSize = dim * 0.09;
119
+ const xLogoSize = dim * 0.072;
120
+ const verifiedSize = dim * 0.028;
121
+ const nameFontSize = dim * 0.04;
122
+ const handleFontSize = dim * 0.03;
123
+ const messageFontSize = dim * 0.046;
124
+ const footerIconSize = dim * 0.032;
125
+ const footerFontSize = dim * 0.03;
126
+ const headerToBodyGap = dim * 0.028;
127
+ const bodyToFooterGap = dim * 0.032;
128
+ return /* @__PURE__ */ jsx(
129
+ "div",
130
+ {
131
+ style: {
132
+ position: "absolute",
133
+ inset: 0,
134
+ display: "flex",
135
+ justifyContent: "center",
136
+ alignItems: "center"
137
+ },
138
+ children: /* @__PURE__ */ jsxs(
139
+ "div",
140
+ {
141
+ style: {
142
+ width: cardWidth,
143
+ backgroundColor: X.cardBg,
144
+ borderRadius: cardRadius,
145
+ padding: cardPad,
146
+ border: `1px solid ${X.cardBorder}`,
147
+ boxShadow: [
148
+ `0 ${1 * s}px ${3 * s}px 0 rgba(0,0,0,0.1)`,
149
+ `0 ${1 * s}px ${2 * s}px ${-1 * s}px rgba(0,0,0,0.1)`,
150
+ `0 ${20 * s}px ${60 * s}px rgba(0,0,0,0.45)`
151
+ ].join(", "),
152
+ opacity: cardOpacity,
153
+ transform: `scale(${cardScale * beatScale})`
154
+ },
155
+ children: [
156
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: dim * 0.018 }, children: [
157
+ /* @__PURE__ */ jsx(
158
+ "div",
159
+ {
160
+ style: {
161
+ width: avatarSize,
162
+ height: avatarSize,
163
+ borderRadius: "50%",
164
+ flexShrink: 0,
165
+ overflow: "hidden",
166
+ backgroundColor: resolvedAccent,
167
+ display: "flex",
168
+ alignItems: "center",
169
+ justifyContent: "center"
170
+ },
171
+ children: /* @__PURE__ */ jsx("span", { style: { color: autoTextColor(resolvedAccent), fontSize: avatarSize * 0.46, fontWeight: 700, letterSpacing: -0.5, lineHeight: 1 }, children: initialChar })
172
+ }
173
+ ),
174
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", flex: 1, minWidth: 0, gap: dim * 2e-3 }, children: [
175
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: dim * 6e-3 }, children: [
176
+ /* @__PURE__ */ jsx("span", { style: { color: X.text, fontSize: nameFontSize, fontWeight: 700, letterSpacing: -0.3, lineHeight: 1.1, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: authorName }),
177
+ isVerified && /* @__PURE__ */ jsx(VerifiedBadge, { size: verifiedSize })
178
+ ] }),
179
+ /* @__PURE__ */ jsx("span", { style: { color: X.muted, fontSize: handleFontSize, fontWeight: 400, lineHeight: 1.1, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: authorHandle })
180
+ ] }),
181
+ /* @__PURE__ */ jsx("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx(XLogo, { size: xLogoSize }) })
182
+ ] }),
183
+ /* @__PURE__ */ jsx("div", { style: { color: X.text, fontSize: messageFontSize, lineHeight: 1.4, letterSpacing: -0.1, marginTop: headerToBodyGap, wordBreak: "break-word" }, children: renderWithEmoji(message, messageFontSize) }),
184
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: dim * 0.04, marginTop: bodyToFooterGap }, children: [
185
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: dim * 8e-3 }, children: [
186
+ /* @__PURE__ */ jsx(CommentIcon, { size: footerIconSize }),
187
+ /* @__PURE__ */ jsx(
188
+ "span",
189
+ {
190
+ "data-transition-semantic": replyIsTransient ? "transient" : void 0,
191
+ style: {
192
+ color: X.muted,
193
+ fontSize: footerFontSize,
194
+ fontVariantNumeric: "tabular-nums",
195
+ ...replyIsTransient ? { visibility: "var(--vanillasky-transition-semantic-visibility,visible)" } : {}
196
+ },
197
+ children: replyDisplay
198
+ }
199
+ )
200
+ ] }),
201
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: dim * 8e-3 }, children: [
202
+ /* @__PURE__ */ jsx(HeartIcon, { size: footerIconSize }),
203
+ /* @__PURE__ */ jsx(
204
+ "span",
205
+ {
206
+ "data-transition-semantic": likeIsTransient ? "transient" : void 0,
207
+ style: {
208
+ color: X.muted,
209
+ fontSize: footerFontSize,
210
+ fontVariantNumeric: "tabular-nums",
211
+ ...likeIsTransient ? { visibility: "var(--vanillasky-transition-semantic-visibility,visible)" } : {}
212
+ },
213
+ children: likeDisplay
214
+ }
215
+ )
216
+ ] })
217
+ ] })
218
+ ]
219
+ }
220
+ )
221
+ }
222
+ );
223
+ };
224
+
225
+ // src/visual-system/scene-templates/social-tweet.tsx
226
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
227
+ var SocialTweetTemplate = ({
228
+ variables,
229
+ style,
230
+ progress,
231
+ motionProgress = progress,
232
+ beatIntensity,
233
+ width,
234
+ height,
235
+ sceneDuration,
236
+ isPlaying = true,
237
+ backgroundEffect
238
+ }) => {
239
+ const authorName = String(variables.authorName || "Your brand");
240
+ const message = String(variables.message || "");
241
+ const { primary } = resolveTokens(style);
242
+ const seed = (authorName + message).split("").reduce((acc, c) => acc + c.charCodeAt(0), 0);
243
+ const verifiedRaw = variables.authorVerified;
244
+ const isVerified = verifiedRaw === true || String(verifiedRaw ?? "").toLowerCase() === "true";
245
+ return /* @__PURE__ */ jsxs2(
246
+ "div",
247
+ {
248
+ style: {
249
+ width,
250
+ height,
251
+ backgroundColor: "#000",
252
+ position: "relative",
253
+ overflow: "hidden",
254
+ fontFamily: "'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif"
255
+ },
256
+ children: [
257
+ /* @__PURE__ */ jsx2(
258
+ SceneBackground,
259
+ {
260
+ style,
261
+ progress,
262
+ sceneDuration,
263
+ width,
264
+ height,
265
+ ...getMediaBackgroundProps(variables),
266
+ backgroundEffect,
267
+ seed,
268
+ isPlaying,
269
+ beatIntensity
270
+ }
271
+ ),
272
+ /* @__PURE__ */ jsx2(
273
+ TweetCard,
274
+ {
275
+ progress,
276
+ motionProgress,
277
+ authorName,
278
+ authorHandle: String(variables.authorHandle || ""),
279
+ authorVerified: isVerified,
280
+ message,
281
+ targetLikes: Number(variables.likes) || 0,
282
+ targetReplies: Number(variables.replies) || 0,
283
+ accent: primary,
284
+ width,
285
+ height,
286
+ beatIntensity
287
+ }
288
+ )
289
+ ]
290
+ }
291
+ );
292
+ };
293
+ export {
294
+ SocialTweetTemplate
295
+ };
@@ -0,0 +1,3 @@
1
+ type VideoStatus = "idle" | "streaming" | "complete" | "error" | "aborted";
2
+
3
+ export type { VideoStatus as V };
@@ -0,0 +1,8 @@
1
+ import {
2
+ DEFAULT_VIDEO_SYSTEM_PROMPT,
3
+ VIDEO_PLAN_INSTRUCTION
4
+ } from "./chunk-FQ47WXAJ.js";
5
+ export {
6
+ DEFAULT_VIDEO_SYSTEM_PROMPT,
7
+ VIDEO_PLAN_INSTRUCTION
8
+ };
@@ -0,0 +1,24 @@
1
+ import { S as SceneTemplateMetadata, T as TemplateFamily, a as TemplateJob, b as TemplateRegister, c as TemplateTimingMetadata } from './catalog-types-BIhSpOWK.js';
2
+
3
+ type BuiltinTemplateId = "media" | "reaction" | "confetti" | "emojiBurst" | "bigNumber" | "barChart" | "progressRing" | "phoneMockup" | "webMockup" | "codeEditor" | "terminal" | "tweet" | "notification" | "chatMessenger" | "chatWhatsapp" | "milestone" | "reviewStack" | "testimonial" | "incomingCall" | "brandMessage" | "promptInput" | "beforeAfter" | "tripleStats" | "problemSolution" | "cardList" | "steps" | "ctaLogo" | "ctaMedia";
4
+ interface BuiltinTemplateManifestEntry extends SceneTemplateMetadata {
5
+ id: BuiltinTemplateId;
6
+ label: string;
7
+ description: string;
8
+ family: TemplateFamily;
9
+ jobs: TemplateJob[];
10
+ register: TemplateRegister;
11
+ useWhen: string;
12
+ avoidWhen: string;
13
+ textCanvas: "tight" | "open";
14
+ minDuration: number;
15
+ preferredDuration: number;
16
+ timing: TemplateTimingMetadata;
17
+ }
18
+ /**
19
+ * Canonical, serializable metadata for every bundled template.
20
+ * Schemas own defaults; this manifest owns discovery, selection, and timing hints.
21
+ */
22
+ declare const BUILTIN_TEMPLATE_MANIFEST: readonly BuiltinTemplateManifestEntry[];
23
+
24
+ export { type BuiltinTemplateId, type BuiltinTemplateManifestEntry as BuiltinTemplateMetadata, BUILTIN_TEMPLATE_MANIFEST as builtinTemplates };
@@ -0,0 +1,6 @@
1
+ import {
2
+ BUILTIN_TEMPLATE_MANIFEST
3
+ } from "./chunk-W2XJKG6C.js";
4
+ export {
5
+ BUILTIN_TEMPLATE_MANIFEST as builtinTemplates
6
+ };
@@ -0,0 +1,25 @@
1
+ import { I as InferTemplateJsonSchema, S as SceneTemplateProps, a as SceneTemplate } from './kit-BMNcHqa9.js';
2
+ export { T as TemplateRegistry, c as createTemplateRegistry } from './kit-BMNcHqa9.js';
3
+ import { ComponentType } from 'react';
4
+ import { d as TemplateJsonSchema, S as SceneTemplateMetadata } from './catalog-types-BIhSpOWK.js';
5
+ export { T as TemplateFamily, c as TemplateTimingMetadata, e as TemplateTransitionTiming } from './catalog-types-BIhSpOWK.js';
6
+ import './types-B-PZR6G_.js';
7
+
8
+ interface TemplateExample<Variables extends Record<string, unknown> = Record<string, unknown>> {
9
+ name: string;
10
+ variables: Partial<Variables>;
11
+ }
12
+ type OptionalGlobalDefaults = Partial<Pick<SceneTemplateMetadata, "usesGlobalTextEffect" | "usesGlobalTransition" | "usesGlobalBackgroundEffect">>;
13
+ type TemplateDefinitionMetadata = Omit<SceneTemplateMetadata, "id" | "useWhen" | "schema" | keyof OptionalGlobalDefaults> & OptionalGlobalDefaults;
14
+ type TemplateDefinition<Schema extends TemplateJsonSchema = TemplateJsonSchema> = TemplateDefinitionMetadata & {
15
+ id: string;
16
+ useWhen: string;
17
+ schema: Schema;
18
+ examples?: readonly TemplateExample<InferTemplateJsonSchema<Schema>>[];
19
+ component: ComponentType<SceneTemplateProps<InferTemplateJsonSchema<Schema>>>;
20
+ };
21
+ declare function defineTemplate<const Schema extends TemplateJsonSchema>(definition: TemplateDefinition<Schema>): SceneTemplate<InferTemplateJsonSchema<Schema>> & {
22
+ examples?: readonly TemplateExample<InferTemplateJsonSchema<Schema>>[];
23
+ };
24
+
25
+ export { SceneTemplate, SceneTemplateMetadata, SceneTemplateProps, type TemplateDefinition, type TemplateExample, TemplateJsonSchema, defineTemplate };
@@ -0,0 +1,19 @@
1
+ import {
2
+ createTemplateRegistry,
3
+ defineTemplate
4
+ } from "./chunk-CR7FE7BW.js";
5
+ import "./chunk-2E6T633S.js";
6
+
7
+ // src/templates.ts
8
+ function defineTemplate2(definition) {
9
+ if (Object.hasOwn(definition, "duration")) {
10
+ throw new Error("Template duration is not supported; use preferredDuration");
11
+ }
12
+ return defineTemplate(
13
+ definition
14
+ );
15
+ }
16
+ export {
17
+ createTemplateRegistry,
18
+ defineTemplate2 as defineTemplate
19
+ };
package/dist/test.d.ts ADDED
@@ -0,0 +1,149 @@
1
+ import { f as VideoScene, e as VideoOrientation, g as VideoStyle, V as Video, a as VideoAudio, d as VideoInput } from './types-B-PZR6G_.js';
2
+ import { a as VideoWarning, b as VideoFinishReason } from './events-_wfjbmEp.js';
3
+
4
+ type MockVideoStreamPart = {
5
+ type: "scene.add";
6
+ scene: VideoScene;
7
+ } | {
8
+ type: "scene.patch";
9
+ sceneId: string;
10
+ patch: Partial<Omit<VideoScene, "id" | "templateId">>;
11
+ } | {
12
+ type: "asset.patch";
13
+ sceneId: string;
14
+ variables: Record<string, unknown>;
15
+ } | {
16
+ type: "plan.complete";
17
+ finishReason?: "stop" | "length" | "content-filter" | "other";
18
+ } | {
19
+ type: "plan.error";
20
+ error: {
21
+ message: string;
22
+ code?: string;
23
+ recoverable?: boolean;
24
+ };
25
+ } | {
26
+ type: "mock.delay";
27
+ durationMs: number;
28
+ } | {
29
+ type: "mock.raw";
30
+ text: string;
31
+ } | {
32
+ type: "mock.error";
33
+ message: string;
34
+ } | {
35
+ type: "mock.wait-for-abort";
36
+ };
37
+ interface VideoGenerationFixture {
38
+ input: VideoInput;
39
+ parts: readonly MockVideoStreamPart[];
40
+ }
41
+ interface MockVideoPlannerContext {
42
+ request: {
43
+ requestId: string;
44
+ };
45
+ signal: AbortSignal;
46
+ }
47
+ interface MockProviderTextStream {
48
+ textStream: AsyncIterable<string>;
49
+ finishReason: Promise<"stop" | "length" | "content-filter">;
50
+ }
51
+ type SimulatedEventEnvelope<TType extends string, TData> = {
52
+ protocolVersion: "0.4";
53
+ runId: string;
54
+ sequence: number;
55
+ eventId: string;
56
+ type: TType;
57
+ data: TData;
58
+ };
59
+ type SimulatedVideoEvent = SimulatedEventEnvelope<"response.start", {
60
+ requestId: string;
61
+ format: {
62
+ orientation: VideoOrientation;
63
+ };
64
+ style: VideoStyle;
65
+ meta?: Video["meta"];
66
+ capabilities?: {
67
+ templates?: string[];
68
+ extensions?: string[];
69
+ };
70
+ }> | SimulatedEventEnvelope<"audio.set", {
71
+ audio: VideoAudio;
72
+ }> | SimulatedEventEnvelope<"scene.add", {
73
+ scene: VideoScene;
74
+ position: number;
75
+ revision: number;
76
+ }> | SimulatedEventEnvelope<"scene.patch", {
77
+ sceneId: string;
78
+ revision: number;
79
+ patch: Partial<Omit<VideoScene, "id" | "templateId">>;
80
+ }> | SimulatedEventEnvelope<"asset.patch", {
81
+ sceneId: string;
82
+ revision: number;
83
+ variables: Record<string, unknown>;
84
+ }> | SimulatedEventEnvelope<"response.warning", {
85
+ warning: VideoWarning;
86
+ }> | SimulatedEventEnvelope<"response.complete", {
87
+ finishReason: VideoFinishReason;
88
+ snapshot: Video;
89
+ checksum: string;
90
+ }> | SimulatedEventEnvelope<"response.error", {
91
+ error: {
92
+ code: string;
93
+ message: string;
94
+ recoverable: boolean;
95
+ };
96
+ terminal: boolean;
97
+ snapshot?: Video;
98
+ }> | SimulatedEventEnvelope<"response.abort", {
99
+ reason: string;
100
+ snapshot?: Video;
101
+ }> | SimulatedEventEnvelope<`data.${string}`, unknown>;
102
+
103
+ interface MockVideoPlannerOptions {
104
+ /** Select one of the fixed public scenarios. Defaults to `success`. */
105
+ scenario?: "success" | "delayed" | "truncated" | "invalidScene" | "providerFailure" | "contentFilter" | "abort" | "timeout";
106
+ /** Replace the selected scenario with custom structural provider plan parts. */
107
+ parts?: readonly MockVideoStreamPart[];
108
+ /** Add a deterministic delay before every emitted provider text chunk. */
109
+ delayMs?: number;
110
+ }
111
+ /**
112
+ * Create the structural `streamText` function accepted by `createVideoHandler`.
113
+ * It emits deterministic provider-style NDJSON and never constructs SDK events.
114
+ */
115
+ declare function createMockVideoPlanner(options?: MockVideoPlannerOptions): (context: MockVideoPlannerContext) => MockProviderTextStream;
116
+
117
+ interface SimulatedVideoStreamOptions {
118
+ /** Grounded input used by the in-process runtime. Defaults to the portrait fixture input. */
119
+ input?: VideoInput;
120
+ /** Stable request ID used in response.start. Defaults to `test-request`. */
121
+ requestId?: string;
122
+ /** Stable run ID used for event IDs. Defaults to `test-run`. */
123
+ runId?: string;
124
+ /** Abort the simulation and emit a partial response.abort event. */
125
+ signal?: AbortSignal;
126
+ /** Abort after this deterministic timer delay with the public `Request timed out` reason. */
127
+ timeoutMs?: number;
128
+ /** Drop invalid generated parts by default, or make them terminal. */
129
+ invalidPartBehavior?: "drop" | "fail";
130
+ }
131
+ /** Run provider plan parts through the real protocol runtime without a server. */
132
+ declare function simulateVideoStream(parts: readonly MockVideoStreamPart[], options?: SimulatedVideoStreamOptions): AsyncGenerator<SimulatedVideoEvent>;
133
+
134
+ declare const videoFixtures: {
135
+ portrait: VideoGenerationFixture;
136
+ landscape: VideoGenerationFixture;
137
+ scenarios: {
138
+ success: readonly MockVideoStreamPart[];
139
+ delayed: readonly MockVideoStreamPart[];
140
+ truncated: readonly MockVideoStreamPart[];
141
+ invalidScene: readonly MockVideoStreamPart[];
142
+ providerFailure: readonly MockVideoStreamPart[];
143
+ contentFilter: readonly MockVideoStreamPart[];
144
+ abort: readonly MockVideoStreamPart[];
145
+ timeout: readonly MockVideoStreamPart[];
146
+ };
147
+ };
148
+
149
+ export { type MockVideoPlannerOptions, type SimulatedVideoStreamOptions, createMockVideoPlanner, simulateVideoStream, videoFixtures };