@vanillaskyai/video 0.3.0 → 0.3.2

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 (88) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/PUBLIC-API.md +4 -0
  3. package/README.md +3 -3
  4. package/dist/{bg-confetti-WNQXS7ZS.js → bg-confetti-KTHLUJPO.js} +3 -3
  5. package/dist/{bg-emoji-ETI47GLS.js → bg-emoji-AW7374DZ.js} +3 -3
  6. package/dist/{bg-media-SVUZAMGX.js → bg-media-KGYE6UVS.js} +9 -4
  7. package/dist/{brand-message-F3RD4P3P.js → brand-message-AY43ZQR2.js} +4 -3
  8. package/dist/{chart-bar-CNSC7BNK.js → chart-bar-Z42RDRQT.js} +8 -4
  9. package/dist/{chart-counter-MCRHKN77.js → chart-counter-X7NAOQ2C.js} +10 -5
  10. package/dist/{chart-progress-ring-RMI4A7ZK.js → chart-progress-ring-7NSNNHL4.js} +8 -4
  11. package/dist/check-runtime.js +2 -2
  12. package/dist/chunk-35LIYILY.js +25 -0
  13. package/dist/{chunk-IFOW65Z6.js → chunk-4AODC6MS.js} +76 -36
  14. package/dist/{chunk-FSG2PYWG.js → chunk-G5JPHBX7.js} +1 -1
  15. package/dist/{chunk-QTMHS7JD.js → chunk-HXSV6RHF.js} +1 -1
  16. package/dist/{chunk-ABZACD4G.js → chunk-IJM4B2ZN.js} +1 -1
  17. package/dist/{chunk-XYZOJ5NZ.js → chunk-LHFADNWJ.js} +9 -8
  18. package/dist/{chunk-BCRUUJ6A.js → chunk-TCEHK2BW.js} +6 -2
  19. package/dist/{chunk-FNAEQ7QO.js → chunk-XWWLKRNU.js} +3 -1
  20. package/dist/{compose-video-TQOHDXNW.js → compose-video-6UQ33DOO.js} +1 -1
  21. package/dist/control-visibility-NQOWTKOQ.js +258 -0
  22. package/dist/{cta-logo-SVA5GP2A.js → cta-logo-KNBLXUJU.js} +4 -3
  23. package/dist/{cta-media-E7VLLK42.js → cta-media-NY4ASBGG.js} +8 -4
  24. package/dist/{events-CTIsANzz.d.ts → events-tQ0x-VaL.d.ts} +1 -1
  25. package/dist/{incoming-call-62MFZL3Z.js → incoming-call-KWOXLGJN.js} +4 -3
  26. package/dist/index.d.ts +2 -2
  27. package/dist/{infographic-before-after-AXCDAWND.js → infographic-before-after-OEM4DSTZ.js} +3 -3
  28. package/dist/{infographic-feature-list-GW5GUE6O.js → infographic-feature-list-ZZ25JRYQ.js} +8 -4
  29. package/dist/{infographic-problem-solution-7NURJANA.js → infographic-problem-solution-L3RLFDPE.js} +5 -4
  30. package/dist/{infographic-stat-row-J7IZR6ZN.js → infographic-stat-row-3OL3TNSH.js} +8 -4
  31. package/dist/{infographic-steps-VSZM6F5M.js → infographic-steps-LMBSW22P.js} +8 -4
  32. package/dist/{kit-DA2cfJ96.d.ts → kit-DlUSg8lA.d.ts} +1 -1
  33. package/dist/preload-media-KIYBFYRH.js +30 -0
  34. package/dist/{prompt-input-LOUCRXCY.js → prompt-input-XCQ6TS2L.js} +4 -3
  35. package/dist/react.d.ts +3 -3
  36. package/dist/react.js +215 -104
  37. package/dist/{reaction-QG4CYZLQ.js → reaction-YL6YPGPB.js} +5 -4
  38. package/dist/server.d.ts +3 -3
  39. package/dist/server.js +2 -2
  40. package/dist/{showcase-code-RUTFZR3H.js → showcase-code-EFVHRJUM.js} +8 -4
  41. package/dist/{showcase-phone-6CP6XEU5.js → showcase-phone-CTHXHEBT.js} +9 -5
  42. package/dist/{showcase-terminal-MGAEQWPR.js → showcase-terminal-XAMPADHN.js} +8 -4
  43. package/dist/{showcase-web-Y4W2HVRJ.js → showcase-web-LAKHYXSD.js} +9 -5
  44. package/dist/{social-milestone-XI2QE5BO.js → social-milestone-EOBEN7CX.js} +6 -4
  45. package/dist/{social-notification-2UOHQCUY.js → social-notification-MELRWIB6.js} +4 -3
  46. package/dist/{social-review-stack-FDYZGZTJ.js → social-review-stack-H3U437VT.js} +4 -3
  47. package/dist/{social-testimonial-OQ7N52GJ.js → social-testimonial-GNNMKMDD.js} +4 -3
  48. package/dist/{social-tweet-5OLCNPPC.js → social-tweet-PBUKKPT3.js} +4 -3
  49. package/dist/templates.d.ts +3 -3
  50. package/dist/test.d.ts +2 -2
  51. package/dist/test.js +1 -1
  52. package/dist/{types-CkO2EYr4.d.ts → types-CVMb6QEq.d.ts} +2 -2
  53. package/docs/concepts.md +2 -1
  54. package/docs/customization.md +6 -3
  55. package/docs/getting-started.md +2 -2
  56. package/docs/input-and-first-scene.md +16 -4
  57. package/docs/integrate-nextjs.md +2 -2
  58. package/docs/media-and-audio.md +5 -1
  59. package/docs/prompt-and-input.md +3 -2
  60. package/examples/nextjs-quickstart/package.json +1 -1
  61. package/package.json +1 -1
  62. package/registry/items/barChart.json +9 -3
  63. package/registry/items/beforeAfter.json +1 -1
  64. package/registry/items/bigNumber.json +10 -4
  65. package/registry/items/brandMessage.json +7 -1
  66. package/registry/items/cardList.json +9 -3
  67. package/registry/items/codeEditor.json +9 -3
  68. package/registry/items/confetti.json +1 -1
  69. package/registry/items/ctaLogo.json +7 -1
  70. package/registry/items/ctaMedia.json +9 -3
  71. package/registry/items/emojiBurst.json +1 -1
  72. package/registry/items/incomingCall.json +7 -1
  73. package/registry/items/media.json +9 -3
  74. package/registry/items/milestone.json +8 -2
  75. package/registry/items/notification.json +7 -1
  76. package/registry/items/phoneMockup.json +9 -3
  77. package/registry/items/problemSolution.json +8 -2
  78. package/registry/items/progressRing.json +9 -3
  79. package/registry/items/promptInput.json +7 -1
  80. package/registry/items/reaction.json +8 -2
  81. package/registry/items/reviewStack.json +7 -1
  82. package/registry/items/steps.json +9 -3
  83. package/registry/items/terminal.json +9 -3
  84. package/registry/items/testimonial.json +7 -1
  85. package/registry/items/theme.json +1 -1
  86. package/registry/items/tripleStats.json +9 -3
  87. package/registry/items/tweet.json +7 -1
  88. package/registry/items/webMockup.json +9 -3
@@ -144,6 +144,7 @@ function lighten(hex, factor) {
144
144
  const lb = Math.min(255, Math.round(b + (255 - b) * factor));
145
145
  return `#${lr.toString(16).padStart(2, "0")}${lg.toString(16).padStart(2, "0")}${lb.toString(16).padStart(2, "0")}`;
146
146
  }
147
+ var MEDIA_TEXT_SHADOW = "0 2px 8px rgba(0,0,0,0.55), 0 6px 16px rgba(0,0,0,0.35)";
147
148
 
148
149
  export {
149
150
  TOKEN_DEFAULTS,
@@ -151,5 +152,6 @@ export {
151
152
  resolveDensity,
152
153
  resolveTokens,
153
154
  darken,
154
- lighten
155
+ lighten,
156
+ MEDIA_TEXT_SHADOW
155
157
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createVideo
3
- } from "./chunk-XYZOJ5NZ.js";
3
+ } from "./chunk-LHFADNWJ.js";
4
4
  import "./chunk-E7CL7UPB.js";
5
5
  import "./chunk-STIFILQG.js";
6
6
  import "./chunk-JW47XCRL.js";
@@ -0,0 +1,258 @@
1
+ // src/player/fullscreen.ts
2
+ async function toggleFullscreen(container) {
3
+ const fullscreenDocument = document;
4
+ const standardFullscreenElement = document.fullscreenElement;
5
+ const webkitFullscreenElement = fullscreenDocument.webkitFullscreenElement;
6
+ const fullscreenElement = standardFullscreenElement ?? webkitFullscreenElement;
7
+ if (fullscreenElement === container) {
8
+ const exitFullscreen = standardFullscreenElement === container ? document.exitFullscreen ?? fullscreenDocument.webkitExitFullscreen ?? fullscreenDocument.webkitCancelFullScreen : fullscreenDocument.webkitExitFullscreen ?? fullscreenDocument.webkitCancelFullScreen ?? document.exitFullscreen;
9
+ try {
10
+ await exitFullscreen?.call(document);
11
+ return "exited";
12
+ } catch {
13
+ return "exit-failed";
14
+ }
15
+ }
16
+ const fullscreenContainer = container;
17
+ const requestFullscreen = container.requestFullscreen ?? fullscreenContainer.webkitRequestFullscreen ?? fullscreenContainer.webkitRequestFullScreen;
18
+ if (!requestFullscreen) return "fallback";
19
+ try {
20
+ await requestFullscreen.call(container);
21
+ return "entered";
22
+ } catch {
23
+ return "fallback";
24
+ }
25
+ }
26
+ function subscribeFullscreen(container, onChange) {
27
+ const fullscreenDocument = document;
28
+ const update = () => onChange(
29
+ (document.fullscreenElement ?? fullscreenDocument.webkitFullscreenElement) === container
30
+ );
31
+ document.addEventListener("fullscreenchange", update);
32
+ document.addEventListener("webkitfullscreenchange", update);
33
+ return () => {
34
+ document.removeEventListener("fullscreenchange", update);
35
+ document.removeEventListener("webkitfullscreenchange", update);
36
+ };
37
+ }
38
+ function installFallbackFullscreen(onEscape) {
39
+ const previousOverflow = document.body.style.overflow;
40
+ document.body.style.overflow = "hidden";
41
+ const exitOnEscape = (event) => {
42
+ if (event.key === "Escape") onEscape();
43
+ };
44
+ document.addEventListener("keydown", exitOnEscape);
45
+ return () => {
46
+ document.removeEventListener("keydown", exitOnEscape);
47
+ document.body.style.overflow = previousOverflow;
48
+ };
49
+ }
50
+ function createFullscreenController(container, onModeChange) {
51
+ if (!document.getElementById("vanillasky-fullscreen")) {
52
+ const style = document.createElement("style");
53
+ style.id = "vanillasky-fullscreen";
54
+ style.textContent = `
55
+ [data-fullscreen="native"], [data-fullscreen="fallback"] { width: 100vw !important; height: 100dvh !important; border: none !important; border-radius: 0 !important; }
56
+ [data-fullscreen="fallback"] { position: fixed !important; inset: 0 !important; z-index: 2147483647 !important; }
57
+ [data-fullscreen="native"] > [data-video-frame="ready"], [data-fullscreen="fallback"] > [data-video-frame="ready"] { left: var(--vs-frame-left) !important; top: var(--vs-frame-top) !important; transform: scale(var(--vs-frame-scale)) !important; }
58
+ [data-fullscreen="fallback"] [data-testid="video-primary-controls"] { left: calc(20px + env(safe-area-inset-left, 0px)) !important; bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important; }
59
+ [data-fullscreen="fallback"] [data-testid="video-secondary-controls"] { right: calc(20px + env(safe-area-inset-right, 0px)) !important; bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important; }
60
+ `;
61
+ document.head.append(style);
62
+ }
63
+ let mode = "none";
64
+ let removeFallback;
65
+ let frame = 0;
66
+ const present = () => {
67
+ const surface = container.querySelector(':scope > [data-video-frame="ready"]');
68
+ if (!surface) return;
69
+ const width = parseFloat(surface.style.width);
70
+ const height = parseFloat(surface.style.height);
71
+ const scale = Math.min(container.clientWidth / width, container.clientHeight / height);
72
+ container.style.setProperty("--vs-frame-scale", String(scale));
73
+ container.style.setProperty("--vs-frame-left", `${(container.clientWidth - width * scale) / 2}px`);
74
+ container.style.setProperty("--vs-frame-top", `${(container.clientHeight - height * scale) / 2}px`);
75
+ };
76
+ const schedulePresentation = () => {
77
+ cancelAnimationFrame(frame);
78
+ frame = requestAnimationFrame(present);
79
+ };
80
+ const resize = () => mode !== "none" && schedulePresentation();
81
+ window.addEventListener("resize", resize);
82
+ const setMode = (next) => {
83
+ if (mode === next) return;
84
+ removeFallback?.();
85
+ removeFallback = void 0;
86
+ mode = next;
87
+ if (next === "fallback") {
88
+ removeFallback = installFallbackFullscreen(() => setMode("none"));
89
+ }
90
+ onModeChange(next);
91
+ if (next === "none") {
92
+ container.style.removeProperty("--vs-frame-scale");
93
+ container.style.removeProperty("--vs-frame-left");
94
+ container.style.removeProperty("--vs-frame-top");
95
+ } else schedulePresentation();
96
+ };
97
+ const unsubscribe = subscribeFullscreen(container, (active) => {
98
+ if (active) setMode("native");
99
+ else if (mode === "native") setMode("none");
100
+ });
101
+ return {
102
+ async toggle() {
103
+ if (mode === "fallback") {
104
+ setMode("none");
105
+ return;
106
+ }
107
+ const result = await toggleFullscreen(container);
108
+ if (result === "entered") setMode("native");
109
+ else if (result === "fallback") setMode("fallback");
110
+ else setMode("none");
111
+ },
112
+ dispose() {
113
+ unsubscribe();
114
+ removeFallback?.();
115
+ window.removeEventListener("resize", resize);
116
+ cancelAnimationFrame(frame);
117
+ }
118
+ };
119
+ }
120
+
121
+ // src/player/control-visibility.ts
122
+ var STYLE_ID = "vanillasky-player-control-visibility";
123
+ var soundtrackPlayers = /* @__PURE__ */ new Map();
124
+ var fullscreenControllers = /* @__PURE__ */ new Map();
125
+ async function togglePlayerFullscreen(container, onModeChange) {
126
+ let controller = fullscreenControllers.get(container);
127
+ if (!controller) {
128
+ controller = createFullscreenController(container, onModeChange);
129
+ fullscreenControllers.set(container, controller);
130
+ }
131
+ await controller.toggle();
132
+ }
133
+ function detachSoundtrack(player) {
134
+ player.output?.source.disconnect();
135
+ player.output?.gain.disconnect();
136
+ if (player.audio) {
137
+ delete player.audio.dataset.audioOutput;
138
+ if (player.output) Reflect.deleteProperty(player.audio, "volume");
139
+ }
140
+ delete player.audio;
141
+ delete player.output;
142
+ }
143
+ function routeSoundtrack(container, player, audio) {
144
+ if (player.audio === audio) return;
145
+ detachSoundtrack(player);
146
+ player.audio = audio;
147
+ audio.dataset.audioOutput = "true";
148
+ const url = new URL(audio.currentSrc || audio.src, document.baseURI);
149
+ if (url.origin !== location.origin && url.protocol !== "blob:" && url.protocol !== "data:") return;
150
+ try {
151
+ const source = player.context.createMediaElementSource(audio);
152
+ const gain = player.context.createGain();
153
+ let volume = Number(audio.dataset.v ?? 1);
154
+ gain.gain.value = volume;
155
+ source.connect(gain);
156
+ gain.connect(player.context.destination);
157
+ Object.defineProperty(audio, "volume", {
158
+ configurable: true,
159
+ get: () => volume,
160
+ set: (next) => {
161
+ volume = next;
162
+ gain.gain.value = next;
163
+ }
164
+ });
165
+ player.output = { source, gain };
166
+ } catch {
167
+ detachSoundtrack(player);
168
+ void player.context.close();
169
+ soundtrackPlayers.delete(container);
170
+ }
171
+ }
172
+ function attachSoundtrack(audio, context) {
173
+ const container = audio.closest('[data-testid="video-player"]');
174
+ if (!container?.isConnected || !audio.isConnected) {
175
+ void context.close();
176
+ return;
177
+ }
178
+ const existing = soundtrackPlayers.get(container);
179
+ if (existing) {
180
+ void context.close();
181
+ void existing.context.resume().catch(() => void 0);
182
+ routeSoundtrack(container, existing, audio);
183
+ return;
184
+ }
185
+ const original = audio.volume;
186
+ let settable = false;
187
+ try {
188
+ audio.volume = original === 0.5 ? 0.25 : 0.5;
189
+ settable = audio.volume !== original;
190
+ audio.volume = original;
191
+ } catch {
192
+ }
193
+ if (settable) {
194
+ audio.dataset.audioOutput = "true";
195
+ void context.close();
196
+ return;
197
+ }
198
+ const player = { context };
199
+ soundtrackPlayers.set(container, player);
200
+ routeSoundtrack(container, player, audio);
201
+ }
202
+ document.addEventListener("click", (event) => {
203
+ const target = event.target;
204
+ if (!(target instanceof Element)) return;
205
+ const container = target.closest('[data-testid="video-player"]');
206
+ const player = container ? soundtrackPlayers.get(container) : void 0;
207
+ if (player) void player.context.resume().catch(() => void 0);
208
+ }, true);
209
+ new MutationObserver(() => {
210
+ for (const [container, player] of soundtrackPlayers) {
211
+ if (!container.isConnected) {
212
+ detachSoundtrack(player);
213
+ void player.context.close();
214
+ soundtrackPlayers.delete(container);
215
+ } else {
216
+ const audio = container.querySelector("audio");
217
+ if (audio) routeSoundtrack(container, player, audio);
218
+ else detachSoundtrack(player);
219
+ }
220
+ }
221
+ for (const [container, controller] of fullscreenControllers) {
222
+ if (!container.isConnected) {
223
+ controller.dispose();
224
+ fullscreenControllers.delete(container);
225
+ }
226
+ }
227
+ }).observe(document, { childList: true, subtree: true });
228
+ if (!document.getElementById(STYLE_ID)) {
229
+ const style = document.createElement("style");
230
+ style.id = STYLE_ID;
231
+ style.textContent = `
232
+ [data-testid="video-controls"] { opacity: 1; transition: opacity 160ms ease; }
233
+ [data-playing="true"] > [data-testid="video-controls"] { opacity: 0; }
234
+ [data-playing="true"][data-touch-controls="true"] > [data-testid="video-controls"],
235
+ [data-playing="true"]:focus-visible > [data-testid="video-controls"],
236
+ [data-playing="true"] > [data-testid="video-controls"]:has(:focus-visible) { opacity: 1; }
237
+ [data-playing="true"] > [data-testid="video-controls"] > div { pointer-events: none; }
238
+ [data-playing="true"][data-touch-controls="true"] > [data-testid="video-controls"] > div,
239
+ [data-playing="true"]:focus-visible > [data-testid="video-controls"] > div,
240
+ [data-playing="true"] > [data-testid="video-controls"]:has(:focus-visible) > div { pointer-events: auto; }
241
+ @media (hover: hover) {
242
+ [data-playing="true"]:hover > [data-testid="video-controls"] { opacity: 1; }
243
+ [data-playing="true"]:hover > [data-testid="video-controls"] > div { pointer-events: auto; }
244
+ }
245
+ `;
246
+ document.head.append(style);
247
+ document.addEventListener("touchstart", (event) => {
248
+ const target = event.target;
249
+ const container = target.closest('[data-testid="video-player"]');
250
+ if (container && !target.closest("button")) {
251
+ container.dataset.touchControls = String(container.dataset.touchControls !== "true");
252
+ }
253
+ });
254
+ }
255
+ export {
256
+ attachSoundtrack as default,
257
+ togglePlayerFullscreen
258
+ };
@@ -4,8 +4,9 @@ import {
4
4
  import {
5
5
  SceneBackground,
6
6
  getMediaBackgroundProps
7
- } from "./chunk-IFOW65Z6.js";
8
- import "./chunk-ABZACD4G.js";
7
+ } from "./chunk-4AODC6MS.js";
8
+ import "./chunk-35LIYILY.js";
9
+ import "./chunk-IJM4B2ZN.js";
9
10
  import {
10
11
  SPRING_SMOOTH,
11
12
  interpolate,
@@ -14,7 +15,7 @@ import {
14
15
  import {
15
16
  TOKEN_DEFAULTS,
16
17
  resolveTokens
17
- } from "./chunk-FNAEQ7QO.js";
18
+ } from "./chunk-XWWLKRNU.js";
18
19
 
19
20
  // src/visual-system/primitives/typography/WordmarkReveal.tsx
20
21
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -5,12 +5,15 @@ import {
5
5
  import {
6
6
  SceneBackground,
7
7
  getMediaBackgroundProps
8
- } from "./chunk-IFOW65Z6.js";
8
+ } from "./chunk-4AODC6MS.js";
9
+ import {
10
+ hasSceneMedia
11
+ } from "./chunk-35LIYILY.js";
9
12
  import {
10
13
  TemplateText
11
- } from "./chunk-BCRUUJ6A.js";
14
+ } from "./chunk-TCEHK2BW.js";
12
15
  import "./chunk-L5BTTCZV.js";
13
- import "./chunk-ABZACD4G.js";
16
+ import "./chunk-IJM4B2ZN.js";
14
17
  import {
15
18
  SPRING_SMOOTH,
16
19
  interpolate,
@@ -19,7 +22,7 @@ import {
19
22
  import {
20
23
  TOKEN_DEFAULTS,
21
24
  resolveTokens
22
- } from "./chunk-FNAEQ7QO.js";
25
+ } from "./chunk-XWWLKRNU.js";
23
26
 
24
27
  // src/visual-system/primitives/typography/CtaMediaClose.tsx
25
28
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -174,6 +177,7 @@ var CtaMediaTemplate = ({
174
177
  /* @__PURE__ */ jsx2(
175
178
  TemplateText,
176
179
  {
180
+ overMedia: hasSceneMedia(variables),
177
181
  motionProgress,
178
182
  typeTreatment: resolveTokens(style).preset.type,
179
183
  archetype: textArchetype || "subtle",
@@ -1,4 +1,4 @@
1
- import { f as VideoOrientation, h as VideoStyle, V as Video, k as VideoCapabilities, a as VideoAudio, g as VideoScene, l as VIDEO_PROTOCOL_VERSION } from './types-CkO2EYr4.js';
1
+ import { f as VideoOrientation, h as VideoStyle, V as Video, k as VideoCapabilities, a as VideoAudio, g as VideoScene, l as VIDEO_PROTOCOL_VERSION } from './types-CVMb6QEq.js';
2
2
 
3
3
  type VideoWarningCategory = "validation" | "readability" | "grounding" | "provider" | "media" | "protocol";
4
4
  type VideoWarningCode = "scene_duration_adjusted" | "scene_omitted_unreadable" | "scene_omitted_for_closer" | "scene_patch_rejected_readability" | "chart_scale_imbalance" | "plan_incomplete" | "plan_missing_closer" | "provider_warning" | "provider_diagnostics_unavailable";
@@ -5,8 +5,9 @@ import {
5
5
  import {
6
6
  SceneBackground,
7
7
  getMediaBackgroundProps
8
- } from "./chunk-IFOW65Z6.js";
9
- import "./chunk-ABZACD4G.js";
8
+ } from "./chunk-4AODC6MS.js";
9
+ import "./chunk-35LIYILY.js";
10
+ import "./chunk-IJM4B2ZN.js";
10
11
  import {
11
12
  SPRING_BOUNCY,
12
13
  SPRING_SMOOTH,
@@ -15,7 +16,7 @@ import {
15
16
  } from "./chunk-XTOXFMLM.js";
16
17
  import {
17
18
  resolveTokens
18
- } from "./chunk-FNAEQ7QO.js";
19
+ } from "./chunk-XWWLKRNU.js";
19
20
 
20
21
  // src/visual-system/primitives/social/IncomingCallCard.tsx
21
22
  import { jsx, jsxs } from "react/jsx-runtime";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { V as Video } from './types-CkO2EYr4.js';
2
- export { a as VideoAudio, b as VideoBackground, c as VideoBrand, d as VideoInput, e as VideoKnowledgeMode, f as VideoOrientation, g as VideoScene, h as VideoStyle, i as VideoStyleOptions, j as VideoSuppliedMedia } from './types-CkO2EYr4.js';
1
+ import { V as Video } from './types-CVMb6QEq.js';
2
+ export { a as VideoAudio, b as VideoBackground, c as VideoBrand, d as VideoInput, e as VideoKnowledgeMode, f as VideoOrientation, g as VideoScene, h as VideoStyle, i as VideoStyleOptions, j as VideoSuppliedMedia } from './types-CVMb6QEq.js';
3
3
  export { V as VideoStatus } from './state-DZcKuS32.js';
4
4
 
5
5
  type VideoValidationErrorCode = "invalid_video" | "unsupported_video_version";
@@ -6,14 +6,14 @@ import {
6
6
  } from "./chunk-S7HFLYNN.js";
7
7
  import {
8
8
  smoothSize
9
- } from "./chunk-BCRUUJ6A.js";
9
+ } from "./chunk-TCEHK2BW.js";
10
10
  import {
11
11
  Emoji,
12
12
  renderWithEmoji
13
13
  } from "./chunk-L5BTTCZV.js";
14
14
  import {
15
15
  gradientBackground
16
- } from "./chunk-ABZACD4G.js";
16
+ } from "./chunk-IJM4B2ZN.js";
17
17
  import {
18
18
  interpolate,
19
19
  spring
@@ -21,7 +21,7 @@ import {
21
21
  import {
22
22
  TOKEN_DEFAULTS,
23
23
  resolveTokens
24
- } from "./chunk-FNAEQ7QO.js";
24
+ } from "./chunk-XWWLKRNU.js";
25
25
 
26
26
  // src/visual-system/primitives/infographic/BeforeAfterSplit.tsx
27
27
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -7,14 +7,17 @@ import {
7
7
  import {
8
8
  SceneBackground,
9
9
  getMediaBackgroundProps
10
- } from "./chunk-IFOW65Z6.js";
10
+ } from "./chunk-4AODC6MS.js";
11
+ import {
12
+ hasSceneMedia
13
+ } from "./chunk-35LIYILY.js";
11
14
  import {
12
15
  TemplateText
13
- } from "./chunk-BCRUUJ6A.js";
16
+ } from "./chunk-TCEHK2BW.js";
14
17
  import {
15
18
  Emoji
16
19
  } from "./chunk-L5BTTCZV.js";
17
- import "./chunk-ABZACD4G.js";
20
+ import "./chunk-IJM4B2ZN.js";
18
21
  import {
19
22
  interpolate,
20
23
  spring
@@ -22,7 +25,7 @@ import {
22
25
  import {
23
26
  TOKEN_DEFAULTS,
24
27
  resolveTokens
25
- } from "./chunk-FNAEQ7QO.js";
28
+ } from "./chunk-XWWLKRNU.js";
26
29
 
27
30
  // src/visual-system/primitives/infographic/FeatureList.tsx
28
31
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -231,6 +234,7 @@ var InfographicFeatureListTemplate = ({
231
234
  /* @__PURE__ */ jsx2(
232
235
  TemplateText,
233
236
  {
237
+ overMedia: hasSceneMedia(variables),
234
238
  motionProgress,
235
239
  typeTreatment: resolveTokens(style).preset.type,
236
240
  archetype: "subtle",
@@ -4,12 +4,13 @@ import {
4
4
  import {
5
5
  SceneBackground,
6
6
  getMediaBackgroundProps
7
- } from "./chunk-IFOW65Z6.js";
7
+ } from "./chunk-4AODC6MS.js";
8
+ import "./chunk-35LIYILY.js";
8
9
  import {
9
10
  smoothSize
10
- } from "./chunk-BCRUUJ6A.js";
11
+ } from "./chunk-TCEHK2BW.js";
11
12
  import "./chunk-L5BTTCZV.js";
12
- import "./chunk-ABZACD4G.js";
13
+ import "./chunk-IJM4B2ZN.js";
13
14
  import {
14
15
  interpolate,
15
16
  spring
@@ -17,7 +18,7 @@ import {
17
18
  import {
18
19
  TOKEN_DEFAULTS,
19
20
  resolveTokens
20
- } from "./chunk-FNAEQ7QO.js";
21
+ } from "./chunk-XWWLKRNU.js";
21
22
 
22
23
  // src/visual-system/primitives/infographic/ProblemSolution.tsx
23
24
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -1,15 +1,18 @@
1
1
  import {
2
2
  SceneBackground,
3
3
  getMediaBackgroundProps
4
- } from "./chunk-IFOW65Z6.js";
4
+ } from "./chunk-4AODC6MS.js";
5
+ import {
6
+ hasSceneMedia
7
+ } from "./chunk-35LIYILY.js";
5
8
  import {
6
9
  TemplateText
7
- } from "./chunk-BCRUUJ6A.js";
10
+ } from "./chunk-TCEHK2BW.js";
8
11
  import "./chunk-L5BTTCZV.js";
9
12
  import {
10
13
  TOP_TEXT_AREA_RATIO,
11
14
  withOpacity
12
- } from "./chunk-ABZACD4G.js";
15
+ } from "./chunk-IJM4B2ZN.js";
13
16
  import {
14
17
  interpolate,
15
18
  spring
@@ -17,7 +20,7 @@ import {
17
20
  import {
18
21
  TOKEN_DEFAULTS,
19
22
  resolveTokens
20
- } from "./chunk-FNAEQ7QO.js";
23
+ } from "./chunk-XWWLKRNU.js";
21
24
 
22
25
  // src/visual-system/primitives/typography/StatBadgeRow.tsx
23
26
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -205,6 +208,7 @@ var InfographicStatRowTemplate = ({
205
208
  /* @__PURE__ */ jsx2(
206
209
  TemplateText,
207
210
  {
211
+ overMedia: hasSceneMedia(variables),
208
212
  motionProgress,
209
213
  typeTreatment: resolveTokens(style).preset.type,
210
214
  archetype: "subtle",
@@ -8,10 +8,13 @@ import {
8
8
  import {
9
9
  SceneBackground,
10
10
  getMediaBackgroundProps
11
- } from "./chunk-IFOW65Z6.js";
11
+ } from "./chunk-4AODC6MS.js";
12
+ import {
13
+ hasSceneMedia
14
+ } from "./chunk-35LIYILY.js";
12
15
  import {
13
16
  TemplateText
14
- } from "./chunk-BCRUUJ6A.js";
17
+ } from "./chunk-TCEHK2BW.js";
15
18
  import {
16
19
  Emoji
17
20
  } from "./chunk-L5BTTCZV.js";
@@ -19,7 +22,7 @@ import {
19
22
  TOP_TEXT_AREA_RATIO,
20
23
  autoTextColor,
21
24
  withOpacity
22
- } from "./chunk-ABZACD4G.js";
25
+ } from "./chunk-IJM4B2ZN.js";
23
26
  import {
24
27
  interpolate,
25
28
  spring
@@ -27,7 +30,7 @@ import {
27
30
  import {
28
31
  TOKEN_DEFAULTS,
29
32
  resolveTokens
30
- } from "./chunk-FNAEQ7QO.js";
33
+ } from "./chunk-XWWLKRNU.js";
31
34
 
32
35
  // src/visual-system/primitives/infographic/StepsList.tsx
33
36
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -360,6 +363,7 @@ var InfographicStepsTemplate = ({
360
363
  /* @__PURE__ */ jsx2(
361
364
  TemplateText,
362
365
  {
366
+ overMedia: hasSceneMedia(variables),
363
367
  motionProgress,
364
368
  typeTreatment: resolveTokens(style).preset.type,
365
369
  archetype: "subtle",
@@ -1,4 +1,4 @@
1
- import { h as VideoStyle, k as VideoCapabilities } from './types-CkO2EYr4.js';
1
+ import { h as VideoStyle, k as VideoCapabilities } from './types-CVMb6QEq.js';
2
2
  import { ComponentType } from 'react';
3
3
  import { S as SceneTemplateMetadata, d as TemplateJsonSchema, f as TemplateJsonSchemaProperty } from './catalog-types-BIhSpOWK.js';
4
4
 
@@ -0,0 +1,30 @@
1
+ import {
2
+ resolveMediaType
3
+ } from "./chunk-35LIYILY.js";
4
+
5
+ // src/player/preload-media.ts
6
+ var warmed = /* @__PURE__ */ new Set();
7
+ function warm(url) {
8
+ const trimmed = url.trim();
9
+ if (!trimmed || warmed.has(trimmed)) return;
10
+ warmed.add(trimmed);
11
+ const image = new Image();
12
+ image.onerror = () => {
13
+ };
14
+ image.src = trimmed;
15
+ }
16
+ function preloadSceneMedia(variables) {
17
+ if (typeof window === "undefined" || typeof Image === "undefined") return;
18
+ const mediaUrl = String(variables.mediaUrl || "").trim();
19
+ if (!mediaUrl) return;
20
+ const resolved = resolveMediaType(String(variables.mediaType || "auto"), mediaUrl);
21
+ if (resolved === "gradient") return;
22
+ if (resolved === "video") {
23
+ warm(String(variables.mediaPoster || ""));
24
+ return;
25
+ }
26
+ warm(mediaUrl);
27
+ }
28
+ export {
29
+ preloadSceneMedia
30
+ };
@@ -4,8 +4,9 @@ import {
4
4
  import {
5
5
  SceneBackground,
6
6
  getMediaBackgroundProps
7
- } from "./chunk-IFOW65Z6.js";
8
- import "./chunk-ABZACD4G.js";
7
+ } from "./chunk-4AODC6MS.js";
8
+ import "./chunk-35LIYILY.js";
9
+ import "./chunk-IJM4B2ZN.js";
9
10
  import {
10
11
  SPRING_BOUNCY,
11
12
  SPRING_SMOOTH,
@@ -14,7 +15,7 @@ import {
14
15
  } from "./chunk-XTOXFMLM.js";
15
16
  import {
16
17
  resolveTokens
17
- } from "./chunk-FNAEQ7QO.js";
18
+ } from "./chunk-XWWLKRNU.js";
18
19
 
19
20
  // src/visual-system/primitives/typography/PromptInputPill.tsx
20
21
  import { jsx, jsxs } from "react/jsx-runtime";
package/dist/react.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CSSProperties, ReactElement } from 'react';
2
- import { V as VideoEvent, a as VideoWarning } from './events-CTIsANzz.js';
3
- import { f as VideoOrientation, V as Video, d as VideoInput } from './types-CkO2EYr4.js';
4
- import { T as TemplateRegistry } from './kit-DA2cfJ96.js';
2
+ import { V as VideoEvent, a as VideoWarning } from './events-tQ0x-VaL.js';
3
+ import { f as VideoOrientation, V as Video, d as VideoInput } from './types-CVMb6QEq.js';
4
+ import { T as TemplateRegistry } from './kit-DlUSg8lA.js';
5
5
  import { V as VideoStatus } from './state-DZcKuS32.js';
6
6
  import './catalog-types-BIhSpOWK.js';
7
7