remotion 4.0.506 → 4.0.508

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 (35) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/Interactive.d.ts +10 -0
  3. package/dist/cjs/SequenceManager.d.ts +6 -0
  4. package/dist/cjs/SequenceManager.js +20 -0
  5. package/dist/cjs/audio/shared-audio-tags.d.ts +2 -1
  6. package/dist/cjs/audio/shared-audio-tags.js +22 -6
  7. package/dist/cjs/audio/wait-until-actually-resumed.d.ts +2 -1
  8. package/dist/cjs/audio/wait-until-actually-resumed.js +34 -4
  9. package/dist/cjs/buffering.js +17 -8
  10. package/dist/cjs/interactivity-schema.d.ts +10 -0
  11. package/dist/cjs/interactivity-schema.js +8 -0
  12. package/dist/cjs/internals.d.ts +6 -3
  13. package/dist/cjs/internals.js +4 -0
  14. package/dist/cjs/interpolate-keyframed-status.js +2 -0
  15. package/dist/cjs/interpolate.js +92 -11
  16. package/dist/cjs/portal-node.d.ts +3 -0
  17. package/dist/cjs/portal-node.js +22 -1
  18. package/dist/cjs/render-resource-manager.d.ts +13 -0
  19. package/dist/cjs/render-resource-manager.js +47 -0
  20. package/dist/cjs/sequence-node-path.d.ts +1 -1
  21. package/dist/cjs/use-current-scale.js +10 -6
  22. package/dist/cjs/use-schema.d.ts +4 -1
  23. package/dist/cjs/version.d.ts +1 -1
  24. package/dist/cjs/version.js +1 -1
  25. package/dist/cjs/with-interactivity-schema.js +3 -1
  26. package/dist/esm/index.mjs +296 -77
  27. package/dist/esm/no-react.mjs +100 -16
  28. package/dist/esm/version.mjs +1 -1
  29. package/package.json +2 -2
  30. package/dist/cjs/interpolate-translate.d.ts +0 -8
  31. package/dist/cjs/interpolate-translate.js +0 -70
  32. package/dist/cjs/sequence-field-schema.d.ts +0 -425
  33. package/dist/cjs/sequence-field-schema.js +0 -133
  34. package/dist/cjs/wrap-in-schema.d.ts +0 -20
  35. package/dist/cjs/wrap-in-schema.js +0 -203
@@ -517,6 +517,24 @@ var Loading = () => {
517
517
 
518
518
  // src/portal-node.ts
519
519
  var _portalNode = null;
520
+ var portalNodeCurrentScale = 1;
521
+ var portalNodeCurrentScaleListeners = [];
522
+ var getPortalNodeCurrentScale = () => portalNodeCurrentScale;
523
+ var subscribeToPortalNodeCurrentScale = (listener) => {
524
+ portalNodeCurrentScaleListeners.push(listener);
525
+ return () => {
526
+ portalNodeCurrentScaleListeners = portalNodeCurrentScaleListeners.filter((currentListener) => currentListener !== listener);
527
+ };
528
+ };
529
+ var setPortalNodeCurrentScale = (scale) => {
530
+ if (portalNodeCurrentScale === scale) {
531
+ return;
532
+ }
533
+ portalNodeCurrentScale = scale;
534
+ for (const listener of portalNodeCurrentScaleListeners) {
535
+ listener();
536
+ }
537
+ };
520
538
  var portalNode = () => {
521
539
  if (!_portalNode) {
522
540
  if (typeof document === "undefined") {
@@ -1322,7 +1340,7 @@ var getSingleChildComponent = (children) => {
1322
1340
  };
1323
1341
 
1324
1342
  // src/version.ts
1325
- var VERSION = "4.0.506";
1343
+ var VERSION = "4.0.508";
1326
1344
 
1327
1345
  // src/multiple-versions-warning.ts
1328
1346
  var checkMultipleRemotionVersions = () => {
@@ -1924,7 +1942,15 @@ var backgroundSchema = {
1924
1942
  description: "Color"
1925
1943
  }
1926
1944
  };
1945
+ var svgColorSchema = {
1946
+ color: {
1947
+ type: "color",
1948
+ default: undefined,
1949
+ description: "Current color"
1950
+ }
1951
+ };
1927
1952
  var svgStrokeSchema = {
1953
+ ...svgColorSchema,
1928
1954
  stroke: {
1929
1955
  type: "color",
1930
1956
  default: "none",
@@ -2217,6 +2243,9 @@ var VisualModeSettersContext = React12.createContext({
2217
2243
  },
2218
2244
  setPropStatuses: () => {
2219
2245
  throw new Error("VisualModeSettersContext not initialized");
2246
+ },
2247
+ remapPropStatuses: () => {
2248
+ throw new Error("VisualModeSettersContext not initialized");
2220
2249
  }
2221
2250
  });
2222
2251
  var effectDragOverridesKey = (nodePath, effectIndex) => `${makeSequencePropsSubscriptionKey(nodePath)}.effects.${effectIndex}`;
@@ -2285,6 +2314,20 @@ var SequenceManagerProvider = ({ children }) => {
2285
2314
  return { ...prev, [key]: newKey };
2286
2315
  });
2287
2316
  }, []);
2317
+ const remapPropStatuses = useCallback5((remappings) => {
2318
+ setPropStatusesMapState((prev) => {
2319
+ const next = { ...prev };
2320
+ for (const remapping of remappings) {
2321
+ delete next[makeSequencePropsSubscriptionKey(remapping.previousNodePath)];
2322
+ }
2323
+ for (const remapping of remappings) {
2324
+ if (remapping.nodePath !== null && remapping.result !== null) {
2325
+ next[makeSequencePropsSubscriptionKey(remapping.nodePath)] = remapping.result;
2326
+ }
2327
+ }
2328
+ return next;
2329
+ });
2330
+ }, []);
2288
2331
  const registerSequence = useCallback5((seq) => {
2289
2332
  setSequences((seqs) => {
2290
2333
  return [...seqs, seq];
@@ -2323,14 +2366,16 @@ var SequenceManagerProvider = ({ children }) => {
2323
2366
  clearDragOverrides,
2324
2367
  setEffectDragOverrides,
2325
2368
  clearEffectDragOverrides,
2326
- setPropStatuses
2369
+ setPropStatuses,
2370
+ remapPropStatuses
2327
2371
  };
2328
2372
  }, [
2329
2373
  setDragOverrides,
2330
2374
  clearDragOverrides,
2331
2375
  setEffectDragOverrides,
2332
2376
  clearEffectDragOverrides,
2333
- setPropStatuses
2377
+ setPropStatuses,
2378
+ remapPropStatuses
2334
2379
  ]);
2335
2380
  return /* @__PURE__ */ jsx10(SequenceManagerRefContext.Provider, {
2336
2381
  value: sequencesRef,
@@ -2790,9 +2835,45 @@ var parseTransformOriginValue = (output, parts) => {
2790
2835
  });
2791
2836
  return {
2792
2837
  kind: "translate",
2793
- values: [x.value, y.value, z.value],
2794
- units: [x.unit, y.unit, z.unit],
2795
- dimensions: parts[2] === undefined ? 2 : 3
2838
+ values: [x.value, y.value, z.value, 0],
2839
+ units: [x.unit, y.unit, z.unit, null],
2840
+ dimensions: parts[2] === undefined ? 2 : 3,
2841
+ axisRotation: false
2842
+ };
2843
+ };
2844
+ var parseAxisRotationValue = (output) => {
2845
+ const parts = output.trim().split(/\s+/);
2846
+ const keywordAxis = parts.length === 2 ? parts[0].toLowerCase() : null;
2847
+ if (keywordAxis === "x" || keywordAxis === "y" || keywordAxis === "z") {
2848
+ const keywordAngle = parseStringInterpolationComponent(parts[1], output);
2849
+ if (keywordAngle.kind !== "rotate") {
2850
+ return null;
2851
+ }
2852
+ return {
2853
+ kind: "rotate",
2854
+ values: keywordAxis === "x" ? [1, 0, 0, keywordAngle.value] : keywordAxis === "y" ? [0, 1, 0, keywordAngle.value] : [0, 0, 1, keywordAngle.value],
2855
+ units: [null, null, null, keywordAngle.unit],
2856
+ dimensions: 4,
2857
+ axisRotation: true
2858
+ };
2859
+ }
2860
+ if (parts.length !== 4) {
2861
+ return null;
2862
+ }
2863
+ const axis = parts.slice(0, 3).map(Number);
2864
+ if (!axis.every(Number.isFinite)) {
2865
+ return null;
2866
+ }
2867
+ const vectorAngle = parseStringInterpolationComponent(parts[3], output);
2868
+ if (vectorAngle.kind !== "rotate") {
2869
+ return null;
2870
+ }
2871
+ return {
2872
+ kind: "rotate",
2873
+ values: [axis[0], axis[1], axis[2], vectorAngle.value],
2874
+ units: [null, null, null, vectorAngle.unit],
2875
+ dimensions: 4,
2876
+ axisRotation: true
2796
2877
  };
2797
2878
  };
2798
2879
  var parseStringInterpolationValue = (output) => {
@@ -2802,11 +2883,16 @@ var parseStringInterpolationValue = (output) => {
2802
2883
  }
2803
2884
  return {
2804
2885
  kind: "scale",
2805
- values: [output, output, 1],
2806
- units: [null, null, null],
2807
- dimensions: 1
2886
+ values: [output, output, 1, 0],
2887
+ units: [null, null, null, null],
2888
+ dimensions: 1,
2889
+ axisRotation: false
2808
2890
  };
2809
2891
  }
2892
+ const axisRotation = parseAxisRotationValue(output);
2893
+ if (axisRotation !== null) {
2894
+ return axisRotation;
2895
+ }
2810
2896
  const parts = output.trim().split(/\s+/);
2811
2897
  if (parts.length < 1 || parts.length > 3 || parts[0] === "") {
2812
2898
  throw new TypeError(`String outputRange values must contain 1 to 3 components, but got "${output}"`);
@@ -2827,24 +2913,35 @@ var parseStringInterpolationValue = (output) => {
2827
2913
  const z = parsed[2]?.value ?? 1;
2828
2914
  return {
2829
2915
  kind,
2830
- values: [x, y, z],
2831
- units: [null, null, null],
2832
- dimensions: parsed.length
2916
+ values: [x, y, z, 0],
2917
+ units: [null, null, null, null],
2918
+ dimensions: parsed.length,
2919
+ axisRotation: false
2833
2920
  };
2834
2921
  }
2835
2922
  return {
2836
2923
  kind,
2837
- values: [parsed[0].value, parsed[1]?.value ?? 0, parsed[2]?.value ?? 0],
2838
- units: [parsed[0].unit, parsed[1]?.unit ?? null, parsed[2]?.unit ?? null],
2839
- dimensions: parsed.length
2924
+ values: [parsed[0].value, parsed[1]?.value ?? 0, parsed[2]?.value ?? 0, 0],
2925
+ units: [
2926
+ parsed[0].unit,
2927
+ parsed[1]?.unit ?? null,
2928
+ parsed[2]?.unit ?? null,
2929
+ null
2930
+ ],
2931
+ dimensions: parsed.length,
2932
+ axisRotation: false
2840
2933
  };
2841
2934
  };
2842
2935
  var serializeStringInterpolationValue = ({
2843
2936
  kind,
2844
2937
  values,
2845
2938
  units,
2846
- dimensions
2939
+ dimensions,
2940
+ axisRotation
2847
2941
  }) => {
2942
+ if (axisRotation) {
2943
+ return `${stringifyNumber(values[0])} ${stringifyNumber(values[1])} ${stringifyNumber(values[2])} ${stringifyNumber(values[3])}${units[3]}`;
2944
+ }
2848
2945
  if (kind === "scale") {
2849
2946
  return values.slice(0, dimensions).map((value) => stringifyNumber(value)).join(" ");
2850
2947
  }
@@ -3012,7 +3109,26 @@ var interpolateString = ({
3012
3109
  outputRange,
3013
3110
  options
3014
3111
  }) => {
3015
- const parsedOutputRange = outputRange.map(parseStringInterpolationValue);
3112
+ const initiallyParsedOutputRange = outputRange.map(parseStringInterpolationValue);
3113
+ const hasAxisRotation = initiallyParsedOutputRange.some((parsed) => parsed.axisRotation);
3114
+ const parsedOutputRange = hasAxisRotation ? initiallyParsedOutputRange.map((parsed) => {
3115
+ if (parsed.kind !== "rotate") {
3116
+ return parsed;
3117
+ }
3118
+ if (parsed.axisRotation) {
3119
+ return parsed;
3120
+ }
3121
+ if (parsed.dimensions !== 1) {
3122
+ throw new TypeError("Cannot interpolate a multi-angle rotate value with an axis rotation");
3123
+ }
3124
+ return {
3125
+ kind: "rotate",
3126
+ values: [0, 0, 1, parsed.values[0]],
3127
+ units: [null, null, null, parsed.units[0]],
3128
+ dimensions: 4,
3129
+ axisRotation: true
3130
+ };
3131
+ }) : initiallyParsedOutputRange;
3016
3132
  const kind = parsedOutputRange[0]?.kind;
3017
3133
  if (kind === undefined) {
3018
3134
  throw new Error("outputRange must have at least 1 element");
@@ -3024,12 +3140,16 @@ var interpolateString = ({
3024
3140
  }
3025
3141
  const dimensions = Math.max(...parsedOutputRange.map((parsed) => parsed.dimensions));
3026
3142
  const units = [
3143
+ null,
3027
3144
  null,
3028
3145
  null,
3029
3146
  null
3030
3147
  ];
3031
3148
  if (kind !== "scale") {
3032
3149
  for (let axis = 0;axis < dimensions; axis++) {
3150
+ if (hasAxisRotation && axis < 3) {
3151
+ continue;
3152
+ }
3033
3153
  for (const parsed of parsedOutputRange) {
3034
3154
  const unit = parsed.units[axis];
3035
3155
  if (unit === null) {
@@ -3048,7 +3168,7 @@ var interpolateString = ({
3048
3168
  }
3049
3169
  }
3050
3170
  }
3051
- const values = [0, 0, 0];
3171
+ const values = [0, 0, 0, 0];
3052
3172
  for (let axis = 0;axis < dimensions; axis++) {
3053
3173
  values[axis] = interpolateNumber({
3054
3174
  input,
@@ -3061,7 +3181,8 @@ var interpolateString = ({
3061
3181
  kind,
3062
3182
  values,
3063
3183
  units,
3064
- dimensions
3184
+ dimensions,
3185
+ axisRotation: hasAxisRotation
3065
3186
  });
3066
3187
  };
3067
3188
  var validateTupleOutputRange = (outputRange) => {
@@ -4076,6 +4197,8 @@ var easingToFn = ({
4076
4197
  switch (easing.type) {
4077
4198
  case "linear":
4078
4199
  return Easing.linear;
4200
+ case "step1":
4201
+ return Easing.step1;
4079
4202
  case "spring":
4080
4203
  return Easing.spring({
4081
4204
  allowTail: forceSpringAllowTail ?? easing.allowTail ?? undefined,
@@ -4689,7 +4812,8 @@ var withInteractivitySchema = ({
4689
4812
  } = props;
4690
4813
  const cleanProps = propsWithoutInternalStack;
4691
4814
  const env = useRemotionEnvironment();
4692
- if (!env.isStudio || env.isRendering) {
4815
+ const canUseRemotionHooks = useContext17(CanUseRemotionHooks);
4816
+ if (!env.isStudio || env.isRendering || !canUseRemotionHooks) {
4693
4817
  return React14.createElement(Component, {
4694
4818
  ...cleanProps,
4695
4819
  controls: null,
@@ -7139,24 +7263,56 @@ var useSingletonAudioContext = ({
7139
7263
  };
7140
7264
 
7141
7265
  // src/audio/wait-until-actually-resumed.ts
7142
- var waitUntilActuallyResumed = (audioContext, logLevel) => {
7266
+ var RESUME_WAIT_TIMEOUT = 1000;
7267
+ var waitUntilActuallyResumed = (audioContext, logLevel, signal) => {
7143
7268
  return new Promise((resolve) => {
7144
7269
  const startCurrentTime = audioContext.currentTime;
7145
7270
  const start = audioContext.getOutputTimestamp();
7146
7271
  const startOutputPerformanceTime = start.performanceTime;
7147
7272
  const startWallClock = performance.now();
7273
+ let animationFrame = null;
7274
+ let timeout = null;
7275
+ let settled = false;
7276
+ let onAbort = () => {
7277
+ return;
7278
+ };
7279
+ const finish = (result) => {
7280
+ if (settled) {
7281
+ return;
7282
+ }
7283
+ settled = true;
7284
+ if (animationFrame !== null) {
7285
+ cancelAnimationFrame(animationFrame);
7286
+ }
7287
+ if (timeout !== null) {
7288
+ clearTimeout(timeout);
7289
+ }
7290
+ signal.removeEventListener("abort", onAbort);
7291
+ resolve(result);
7292
+ };
7293
+ onAbort = () => finish("cancelled");
7148
7294
  const check = () => {
7295
+ animationFrame = null;
7149
7296
  const { currentTime } = audioContext;
7150
7297
  const outputTimestamp = audioContext.getOutputTimestamp();
7151
7298
  const elapsedWallClock = performance.now() - startWallClock;
7152
7299
  if (startOutputPerformanceTime !== undefined && outputTimestamp.performanceTime !== undefined && outputTimestamp.performanceTime > startOutputPerformanceTime && outputTimestamp.contextTime !== undefined && outputTimestamp.contextTime > startCurrentTime) {
7153
7300
  Log.verbose({ logLevel, tag: "audio" }, `waitUntilActuallyResumed: getOutputTimestamp.performanceTime advanced from ${startOutputPerformanceTime.toFixed(6)} to ${outputTimestamp.performanceTime.toFixed(6)} after ${elapsedWallClock.toFixed(1)}ms. currentTime=${currentTime.toFixed(6)} (advanced by ${(currentTime - startCurrentTime).toFixed(6)}), getOutputTimestamp.performanceTime=${outputTimestamp.performanceTime?.toFixed(1) ?? "undefined"}`);
7154
- resolve();
7301
+ finish("resumed");
7155
7302
  return;
7156
7303
  }
7157
- requestAnimationFrame(check);
7304
+ animationFrame = requestAnimationFrame(check);
7158
7305
  };
7159
- requestAnimationFrame(check);
7306
+ if (signal.aborted) {
7307
+ finish("cancelled");
7308
+ return;
7309
+ }
7310
+ signal.addEventListener("abort", onAbort, { once: true });
7311
+ timeout = setTimeout(() => {
7312
+ Log.warn({ logLevel, tag: "audio" }, "WARNING: You enabled autoPlay on an unmuted <Player /> and the browser did not allow the video to be started. Remotion muted the <Player /> so it can play. To properly handle this, either set the `muted` prop or remove the `autoPlay` prop");
7313
+ finish("failed");
7314
+ }, RESUME_WAIT_TIMEOUT);
7315
+ animationFrame = requestAnimationFrame(check);
7160
7316
  });
7161
7317
  };
7162
7318
 
@@ -7216,6 +7372,7 @@ var SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled, pr
7216
7372
  });
7217
7373
  const audioContextIsPlayingEventually = useRef13(false);
7218
7374
  const isResuming = useRef13(null);
7375
+ const nextResumeAttemptId = useRef13(0);
7219
7376
  const audioSyncAnchor = useMemo23(() => ({ value: 0 }), []);
7220
7377
  const audioSyncAnchorListeners = useRef13([]);
7221
7378
  const audioSyncAnchorEmitter = useMemo23(() => {
@@ -7306,21 +7463,32 @@ var SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled, pr
7306
7463
  });
7307
7464
  nodesToResume.current.clear();
7308
7465
  const resumePromise = ctxAndGain.resume();
7309
- isResuming.current = new Promise((resolve) => {
7310
- waitUntilActuallyResumed(ctxAndGain.audioContext, logLevel).then(resolve);
7466
+ const abortController = new AbortController;
7467
+ const resumeAttemptId = nextResumeAttemptId.current++;
7468
+ const waitPromise = new Promise((resolve) => {
7469
+ waitUntilActuallyResumed(ctxAndGain.audioContext, logLevel, abortController.signal).then(resolve);
7311
7470
  resumePromise.catch((err) => {
7312
- Log.warn({ logLevel, tag: "audio" }, "AudioContext resume rejected, continuing without audio sync", err);
7313
- resolve();
7471
+ Log.warn({ logLevel, tag: "audio" }, "AudioContext resume rejected, muting playback and continuing without audio", err);
7472
+ abortController.abort();
7473
+ resolve("failed");
7314
7474
  });
7315
7475
  }).finally(() => {
7316
- isResuming.current = null;
7476
+ if (isResuming.current?.id === resumeAttemptId) {
7477
+ isResuming.current = null;
7478
+ }
7317
7479
  });
7480
+ isResuming.current = {
7481
+ abortController,
7482
+ id: resumeAttemptId,
7483
+ promise: waitPromise
7484
+ };
7318
7485
  return resumePromise.catch(() => {});
7319
7486
  }, [ctxAndGain, logLevel]);
7320
7487
  const getIsResumingAudioContext = useCallback10(() => {
7321
- return isResuming.current;
7488
+ return isResuming.current?.promise ?? null;
7322
7489
  }, []);
7323
7490
  const suspend = useCallback10(() => {
7491
+ isResuming.current?.abortController.abort();
7324
7492
  if (!ctxAndGain) {
7325
7493
  return Promise.resolve();
7326
7494
  }
@@ -8088,8 +8256,8 @@ import React22, {
8088
8256
  import { jsx as jsx21 } from "react/jsx-runtime";
8089
8257
  var useBufferManager = (logLevel, mountTime) => {
8090
8258
  const [blocks, setBlocks] = useState12([]);
8091
- const [onBufferingCallbacks, setOnBufferingCallbacks] = useState12([]);
8092
- const [onResumeCallbacks, setOnResumeCallbacks] = useState12([]);
8259
+ const onBufferingCallbacks = useRef16([]);
8260
+ const onResumeCallbacks = useRef16([]);
8093
8261
  const env = useRemotionEnvironment();
8094
8262
  const rendering = env.isRendering;
8095
8263
  const buffering = useRef16(false);
@@ -8120,18 +8288,21 @@ var useBufferManager = (logLevel, mountTime) => {
8120
8288
  };
8121
8289
  }, [rendering]);
8122
8290
  const listenForBuffering = useCallback11((callback) => {
8123
- setOnBufferingCallbacks((c2) => [...c2, callback]);
8291
+ onBufferingCallbacks.current = [
8292
+ ...onBufferingCallbacks.current,
8293
+ callback
8294
+ ];
8124
8295
  return {
8125
8296
  remove: () => {
8126
- setOnBufferingCallbacks((c2) => c2.filter((cb) => cb !== callback));
8297
+ onBufferingCallbacks.current = onBufferingCallbacks.current.filter((cb) => cb !== callback);
8127
8298
  }
8128
8299
  };
8129
8300
  }, []);
8130
8301
  const listenForResume = useCallback11((callback) => {
8131
- setOnResumeCallbacks((c2) => [...c2, callback]);
8302
+ onResumeCallbacks.current = [...onResumeCallbacks.current, callback];
8132
8303
  return {
8133
8304
  remove: () => {
8134
- setOnResumeCallbacks((c2) => c2.filter((cb) => cb !== callback));
8305
+ onResumeCallbacks.current = onResumeCallbacks.current.filter((cb) => cb !== callback);
8135
8306
  }
8136
8307
  };
8137
8308
  }, []);
@@ -8141,7 +8312,7 @@ var useBufferManager = (logLevel, mountTime) => {
8141
8312
  }
8142
8313
  if (blocks.length > 0 && !buffering.current) {
8143
8314
  buffering.current = true;
8144
- onBufferingCallbacks.forEach((c2) => c2());
8315
+ [...onBufferingCallbacks.current].forEach((c2) => c2());
8145
8316
  playbackLogging({
8146
8317
  logLevel,
8147
8318
  message: "Player is entering buffer state",
@@ -8157,7 +8328,7 @@ var useBufferManager = (logLevel, mountTime) => {
8157
8328
  }
8158
8329
  if (blocks.length === 0 && buffering.current) {
8159
8330
  buffering.current = false;
8160
- onResumeCallbacks.forEach((c2) => c2());
8331
+ [...onResumeCallbacks.current].forEach((c2) => c2());
8161
8332
  playbackLogging({
8162
8333
  logLevel,
8163
8334
  message: "Player is exiting buffer state",
@@ -11649,6 +11820,50 @@ var RemotionRootContexts = ({
11649
11820
  });
11650
11821
  };
11651
11822
 
11823
+ // src/render-resource-manager.ts
11824
+ import React35 from "react";
11825
+ var makeRenderResourceManager = () => {
11826
+ const resources = new Map;
11827
+ let disposed = false;
11828
+ return {
11829
+ getOrCreateResource: ({
11830
+ key,
11831
+ create
11832
+ }) => {
11833
+ if (disposed) {
11834
+ throw new Error("Render resource manager has already been disposed");
11835
+ }
11836
+ const existing = resources.get(key);
11837
+ if (existing) {
11838
+ return existing.resource;
11839
+ }
11840
+ const created = create();
11841
+ resources.set(key, created);
11842
+ return created.resource;
11843
+ },
11844
+ dispose: () => {
11845
+ if (disposed) {
11846
+ return;
11847
+ }
11848
+ disposed = true;
11849
+ const resourcesToDispose = Array.from(resources.values());
11850
+ resources.clear();
11851
+ let firstError = null;
11852
+ for (const resource of resourcesToDispose) {
11853
+ try {
11854
+ resource.dispose();
11855
+ } catch (error2) {
11856
+ firstError ??= error2;
11857
+ }
11858
+ }
11859
+ if (firstError !== null) {
11860
+ throw firstError;
11861
+ }
11862
+ }
11863
+ };
11864
+ };
11865
+ var RenderResourceManagerContext = React35.createContext(null);
11866
+
11652
11867
  // src/codec.ts
11653
11868
  var validCodecs = [
11654
11869
  "h264",
@@ -11838,8 +12053,8 @@ var resolveVideoConfigOrCatch = (params) => {
11838
12053
  };
11839
12054
 
11840
12055
  // src/sequence-stack-traces.ts
11841
- import React35 from "react";
11842
- var SequenceStackTracesUpdateContext = React35.createContext(() => {});
12056
+ import React36 from "react";
12057
+ var SequenceStackTracesUpdateContext = React36.createContext(() => {});
11843
12058
 
11844
12059
  // src/setup-env-variables.ts
11845
12060
  var getEnvVariables = () => {
@@ -11869,8 +12084,8 @@ var setupEnvVariables = () => {
11869
12084
  };
11870
12085
 
11871
12086
  // src/use-current-scale.ts
11872
- import React36, { createContext as createContext25 } from "react";
11873
- var CurrentScaleContext = React36.createContext(null);
12087
+ import React37, { createContext as createContext25 } from "react";
12088
+ var CurrentScaleContext = React37.createContext(null);
11874
12089
  var PreviewSizeContext = createContext25({
11875
12090
  setSize: () => {
11876
12091
  return;
@@ -11895,10 +12110,16 @@ var calculateScale = ({
11895
12110
  return Number(previewSize);
11896
12111
  };
11897
12112
  var useCurrentScale = (options) => {
11898
- const hasContext = React36.useContext(CurrentScaleContext);
11899
- const zoomContext = React36.useContext(PreviewSizeContext);
12113
+ const hasContext = React37.useContext(CurrentScaleContext);
12114
+ const zoomContext = React37.useContext(PreviewSizeContext);
11900
12115
  const config = useUnsafeVideoConfig();
11901
12116
  const env = useRemotionEnvironment();
12117
+ const [portalScale, setPortalScale] = React37.useState(getPortalNodeCurrentScale);
12118
+ React37.useEffect(() => {
12119
+ const update = () => setPortalScale(getPortalNodeCurrentScale());
12120
+ update();
12121
+ return subscribeToPortalNodeCurrentScale(update);
12122
+ }, []);
11902
12123
  if (hasContext === null || config === null || zoomContext === null) {
11903
12124
  if (options?.dontThrowIfOutsideOfRemotion) {
11904
12125
  return 1;
@@ -11917,17 +12138,12 @@ var useCurrentScale = (options) => {
11917
12138
  if (hasContext.type === "scale") {
11918
12139
  return hasContext.scale;
11919
12140
  }
11920
- return calculateScale({
11921
- canvasSize: hasContext.canvasSizeForAuto,
11922
- compositionHeight: config.height,
11923
- compositionWidth: config.width,
11924
- previewSize: zoomContext.size.size
11925
- });
12141
+ return portalScale;
11926
12142
  };
11927
12143
 
11928
12144
  // src/use-pixel-density.ts
11929
- import React37, { useContext as useContext36 } from "react";
11930
- var PixelDensityContext = React37.createContext(null);
12145
+ import React38, { useContext as useContext36 } from "react";
12146
+ var PixelDensityContext = React38.createContext(null);
11931
12147
  var getBrowserPixelDensity = () => {
11932
12148
  if (typeof window === "undefined") {
11933
12149
  return 1;
@@ -12181,7 +12397,7 @@ var OffthreadVideoForRendering = ({
12181
12397
  };
12182
12398
 
12183
12399
  // src/video/VideoForPreview.tsx
12184
- import React39, {
12400
+ import React40, {
12185
12401
  forwardRef as forwardRef13,
12186
12402
  useCallback as useCallback24,
12187
12403
  useContext as useContext38,
@@ -12254,7 +12470,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
12254
12470
  ref: videoRef
12255
12471
  });
12256
12472
  }, [context.audioContext]);
12257
- const effectToUse = React39.useInsertionEffect ?? React39.useLayoutEffect;
12473
+ const effectToUse = React40.useInsertionEffect ?? React40.useLayoutEffect;
12258
12474
  effectToUse(() => {
12259
12475
  return () => {
12260
12476
  requestAnimationFrame(() => {
@@ -12671,24 +12887,24 @@ var watchStaticFile = (fileName, callback) => {
12671
12887
  };
12672
12888
 
12673
12889
  // src/wrap-remotion-context.tsx
12674
- import React41, { useMemo as useMemo39 } from "react";
12890
+ import React42, { useMemo as useMemo39 } from "react";
12675
12891
  import { jsx as jsx37 } from "react/jsx-runtime";
12676
12892
  function useRemotionContexts() {
12677
- const compositionManagerCtx = React41.useContext(CompositionManager);
12678
- const timelineContext = React41.useContext(TimelineContext);
12679
- const timelineImperativeContext = React41.useContext(TimelineImperativeContext);
12680
- const setTimelineContext = React41.useContext(SetTimelineContext);
12681
- const sequenceContext = React41.useContext(SequenceContext);
12682
- const nonceContext = React41.useContext(NonceContext);
12683
- const canUseRemotionHooksContext = React41.useContext(CanUseRemotionHooks);
12684
- const preloadContext = React41.useContext(PreloadContext);
12685
- const resolveCompositionContext = React41.useContext(ResolveCompositionContext);
12686
- const renderAssetManagerContext = React41.useContext(RenderAssetManager);
12687
- const sequenceManagerContext = React41.useContext(SequenceManager);
12688
- const sequenceManagerRefContext = React41.useContext(SequenceManagerRefContext);
12689
- const visualModePropStatusesRefContext = React41.useContext(VisualModePropStatusesRefContext);
12690
- const bufferManagerContext = React41.useContext(BufferingContextReact);
12691
- const logLevelContext = React41.useContext(LogLevelContext);
12893
+ const compositionManagerCtx = React42.useContext(CompositionManager);
12894
+ const timelineContext = React42.useContext(TimelineContext);
12895
+ const timelineImperativeContext = React42.useContext(TimelineImperativeContext);
12896
+ const setTimelineContext = React42.useContext(SetTimelineContext);
12897
+ const sequenceContext = React42.useContext(SequenceContext);
12898
+ const nonceContext = React42.useContext(NonceContext);
12899
+ const canUseRemotionHooksContext = React42.useContext(CanUseRemotionHooks);
12900
+ const preloadContext = React42.useContext(PreloadContext);
12901
+ const resolveCompositionContext = React42.useContext(ResolveCompositionContext);
12902
+ const renderAssetManagerContext = React42.useContext(RenderAssetManager);
12903
+ const sequenceManagerContext = React42.useContext(SequenceManager);
12904
+ const sequenceManagerRefContext = React42.useContext(SequenceManagerRefContext);
12905
+ const visualModePropStatusesRefContext = React42.useContext(VisualModePropStatusesRefContext);
12906
+ const bufferManagerContext = React42.useContext(BufferingContextReact);
12907
+ const logLevelContext = React42.useContext(LogLevelContext);
12692
12908
  return useMemo39(() => ({
12693
12909
  compositionManagerCtx,
12694
12910
  timelineContext,
@@ -12777,6 +12993,8 @@ var RemotionContextProvider = (props2) => {
12777
12993
  var compositionSelectorRef = createRef3();
12778
12994
  var Internals = {
12779
12995
  MaxMediaCacheSizeContext,
12996
+ makeRenderResourceManager,
12997
+ RenderResourceManagerContext,
12780
12998
  useUnsafeVideoConfig,
12781
12999
  useFrameForVolumeProp,
12782
13000
  useTimelinePosition,
@@ -12842,6 +13060,7 @@ var Internals = {
12842
13060
  getPreviewDomElement,
12843
13061
  compositionsRef,
12844
13062
  portalNode,
13063
+ setPortalNodeCurrentScale,
12845
13064
  waitForRoot,
12846
13065
  SetTimelineContext,
12847
13066
  CanUseRemotionHooksProvider,
@@ -12937,17 +13156,17 @@ var Internals = {
12937
13156
  useCropStyle
12938
13157
  };
12939
13158
  // src/series/index.tsx
12940
- import React43, {
13159
+ import React44, {
12941
13160
  forwardRef as forwardRef14,
12942
13161
  useMemo as useMemo40
12943
13162
  } from "react";
12944
13163
 
12945
13164
  // src/series/flatten-children.tsx
12946
- import React42 from "react";
13165
+ import React43 from "react";
12947
13166
  var flattenChildren = (children) => {
12948
- const childrenArray = React42.Children.toArray(children);
13167
+ const childrenArray = React43.Children.toArray(children);
12949
13168
  return childrenArray.reduce((flatChildren, child) => {
12950
- if (child.type === React42.Fragment) {
13169
+ if (child.type === React43.Fragment) {
12951
13170
  return flatChildren.concat(flattenChildren(child.props.children));
12952
13171
  }
12953
13172
  flatChildren.push(child);
@@ -13033,7 +13252,7 @@ var SeriesInner = (props2) => {
13033
13252
  index: i,
13034
13253
  childrenLength: flattenedChildren.length
13035
13254
  });
13036
- return React43.cloneElement(castedElement, {
13255
+ return React44.cloneElement(castedElement, {
13037
13256
  _remotionInternalRender: (resolvedProps, ref) => {
13038
13257
  const durationInFramesProp = resolvedProps.durationInFrames;
13039
13258
  const {
@@ -13191,14 +13410,14 @@ var staticFile = (path) => {
13191
13410
  return preparsed;
13192
13411
  };
13193
13412
  // src/Still.tsx
13194
- import React44 from "react";
13413
+ import React45 from "react";
13195
13414
  var Still = (props2) => {
13196
13415
  const newProps = {
13197
13416
  ...props2,
13198
13417
  durationInFrames: 1,
13199
13418
  fps: 1
13200
13419
  };
13201
- return React44.createElement(Composition, newProps);
13420
+ return React45.createElement(Composition, newProps);
13202
13421
  };
13203
13422
  addSequenceStackTraces(Still);
13204
13423
  // src/video/html5-video.tsx