@remotion/promo-pages 4.0.484 → 4.0.486

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/experts.js CHANGED
@@ -1091,8 +1091,8 @@ import {
1091
1091
  forwardRef as forwardRef10,
1092
1092
  useCallback as useCallback17,
1093
1093
  useContext as useContext32,
1094
- useEffect as useEffect17,
1095
1094
  useImperativeHandle as useImperativeHandle7,
1095
+ useLayoutEffect as useLayoutEffect10,
1096
1096
  useMemo as useMemo31,
1097
1097
  useRef as useRef23,
1098
1098
  useState as useState16
@@ -1100,7 +1100,7 @@ import {
1100
1100
  import { jsx as jsx26 } from "react/jsx-runtime";
1101
1101
  import { forwardRef as forwardRef11, useCallback as useCallback18, useState as useState17 } from "react";
1102
1102
  import { jsx as jsx27 } from "react/jsx-runtime";
1103
- import { useCallback as useCallback19, useContext as useContext33, useLayoutEffect as useLayoutEffect10, useRef as useRef24 } from "react";
1103
+ import { useCallback as useCallback19, useContext as useContext33, useLayoutEffect as useLayoutEffect11, useRef as useRef24 } from "react";
1104
1104
  import { jsx as jsx28 } from "react/jsx-runtime";
1105
1105
  import React29, { forwardRef as forwardRef12, useCallback as useCallback20, useRef as useRef25 } from "react";
1106
1106
  import { jsx as jsx29 } from "react/jsx-runtime";
@@ -1126,8 +1126,8 @@ import { useCallback as useCallback24 } from "react";
1126
1126
  import {
1127
1127
  useCallback as useCallback22,
1128
1128
  useContext as useContext36,
1129
- useEffect as useEffect18,
1130
- useLayoutEffect as useLayoutEffect11,
1129
+ useEffect as useEffect17,
1130
+ useLayoutEffect as useLayoutEffect12,
1131
1131
  useMemo as useMemo35,
1132
1132
  useState as useState19
1133
1133
  } from "react";
@@ -1136,13 +1136,13 @@ import React37, {
1136
1136
  forwardRef as forwardRef13,
1137
1137
  useCallback as useCallback23,
1138
1138
  useContext as useContext37,
1139
- useEffect as useEffect20,
1139
+ useEffect as useEffect19,
1140
1140
  useImperativeHandle as useImperativeHandle9,
1141
1141
  useMemo as useMemo36,
1142
1142
  useRef as useRef27,
1143
1143
  useState as useState20
1144
1144
  } from "react";
1145
- import { useEffect as useEffect19 } from "react";
1145
+ import { useEffect as useEffect18 } from "react";
1146
1146
  import { jsx as jsx34 } from "react/jsx-runtime";
1147
1147
  import { jsx as jsx35 } from "react/jsx-runtime";
1148
1148
  import React39, { useMemo as useMemo37 } from "react";
@@ -1159,9 +1159,9 @@ import { forwardRef as forwardRef16, useCallback as useCallback25, useContext as
1159
1159
  import {
1160
1160
  forwardRef as forwardRef15,
1161
1161
  useContext as useContext38,
1162
- useEffect as useEffect21,
1162
+ useEffect as useEffect20,
1163
1163
  useImperativeHandle as useImperativeHandle10,
1164
- useLayoutEffect as useLayoutEffect12,
1164
+ useLayoutEffect as useLayoutEffect13,
1165
1165
  useMemo as useMemo39,
1166
1166
  useRef as useRef28
1167
1167
  } from "react";
@@ -2335,7 +2335,7 @@ var getComponentsToAddStacksTo = () => componentsToAddStacksTo;
2335
2335
  var addSequenceStackTraces = (component) => {
2336
2336
  componentsToAddStacksTo.push(component);
2337
2337
  };
2338
- var VERSION = "4.0.484";
2338
+ var VERSION = "4.0.486";
2339
2339
  var checkMultipleRemotionVersions = () => {
2340
2340
  if (typeof globalThis === "undefined") {
2341
2341
  return;
@@ -2741,6 +2741,12 @@ var textSchema = {
2741
2741
  default: undefined,
2742
2742
  description: "Color"
2743
2743
  },
2744
+ "style.fontFamily": {
2745
+ type: "font-family",
2746
+ default: undefined,
2747
+ description: "Font family",
2748
+ keyframable: false
2749
+ },
2744
2750
  "style.fontSize": {
2745
2751
  type: "number",
2746
2752
  default: undefined,
@@ -2806,6 +2812,14 @@ var textSchema = {
2806
2812
  hiddenFromList: false
2807
2813
  }
2808
2814
  };
2815
+ var textContentSchema = {
2816
+ children: {
2817
+ type: "text-content",
2818
+ default: "",
2819
+ description: "Text",
2820
+ keyframable: false
2821
+ }
2822
+ };
2809
2823
  var premountSchema = {
2810
2824
  premountFor: {
2811
2825
  type: "number",
@@ -5173,10 +5187,21 @@ var getNestedValue = (obj, key) => {
5173
5187
  }
5174
5188
  return current;
5175
5189
  };
5176
- var readValuesFromProps = (props, keys) => {
5190
+ var getRuntimeValueForSchemaKey = ({
5191
+ flatSchema,
5192
+ key,
5193
+ props
5194
+ }) => {
5195
+ const value = getNestedValue(props, key);
5196
+ if (flatSchema[key]?.type === "text-content" && typeof value !== "string") {
5197
+ return;
5198
+ }
5199
+ return value;
5200
+ };
5201
+ var readValuesFromProps = (props, keys, flatSchema) => {
5177
5202
  const out = {};
5178
5203
  for (const key of keys) {
5179
- out[key] = getNestedValue(props, key);
5204
+ out[key] = flatSchema ? getRuntimeValueForSchemaKey({ flatSchema, key, props }) : getNestedValue(props, key);
5180
5205
  }
5181
5206
  return out;
5182
5207
  };
@@ -5184,6 +5209,7 @@ var selectActiveKeys = (schema, values) => {
5184
5209
  return Object.keys(flattenActiveSchema(schema, (key) => values[key]));
5185
5210
  };
5186
5211
  var mergeValues = ({
5212
+ flatSchema,
5187
5213
  props,
5188
5214
  valuesDotNotation,
5189
5215
  schemaKeys,
@@ -5192,6 +5218,9 @@ var mergeValues = ({
5192
5218
  const merged = { ...props };
5193
5219
  for (const key of schemaKeys) {
5194
5220
  const value = valuesDotNotation[key];
5221
+ if (flatSchema[key]?.type === "text-content" && value === undefined) {
5222
+ continue;
5223
+ }
5195
5224
  const parts = key.split(".");
5196
5225
  if (parts.length === 1) {
5197
5226
  merged[key] = value;
@@ -5209,7 +5238,8 @@ var mergeValues = ({
5209
5238
  }
5210
5239
  current[parts[parts.length - 1]] = value;
5211
5240
  }
5212
- deleteNestedKey(merged, propsToDelete);
5241
+ const propsToDeleteWithoutTextContent = new Set([...propsToDelete].filter((key) => !(flatSchema[key]?.type === "text-content" && valuesDotNotation[key] === undefined)));
5242
+ deleteNestedKey(merged, propsToDeleteWithoutTextContent);
5213
5243
  return merged;
5214
5244
  };
5215
5245
  var stackToOverrideMap = {};
@@ -5256,8 +5286,12 @@ var withInteractivitySchema = ({
5256
5286
  return newOverrideId;
5257
5287
  });
5258
5288
  const nodePath = nodePathMapping.overrideIdToNodePathMappings[overrideId] ?? null;
5259
- const runtimeValues = flatKeys.map((k) => getNestedValue(props, k));
5260
- const currentRuntimeValueDotNotation = useMemo13(() => readValuesFromProps(props, flatKeys), runtimeValues);
5289
+ const runtimeValues = flatKeys.map((key) => getRuntimeValueForSchemaKey({
5290
+ flatSchema,
5291
+ key,
5292
+ props
5293
+ }));
5294
+ const currentRuntimeValueDotNotation = useMemo13(() => readValuesFromProps(props, flatKeys, flatSchema), runtimeValues);
5261
5295
  const controls = useMemo13(() => {
5262
5296
  return {
5263
5297
  schema: schemaWithSequenceName,
@@ -5285,6 +5319,7 @@ var withInteractivitySchema = ({
5285
5319
  ]);
5286
5320
  const activeKeys = selectActiveKeys(schemaWithSequenceName, valuesDotNotation);
5287
5321
  const mergedProps = mergeValues({
5322
+ flatSchema,
5288
5323
  props,
5289
5324
  valuesDotNotation,
5290
5325
  schemaKeys: activeKeys,
@@ -7908,7 +7943,7 @@ var getTimelineDuration = ({
7908
7943
  trimAfter
7909
7944
  });
7910
7945
  if (parentSequenceDurationInFrames !== null) {
7911
- const cappedDuration = Math.min(parentSequenceDurationInFrames * playbackRate, mediaDuration);
7946
+ const cappedDuration = Math.min(parentSequenceDurationInFrames, mediaDuration);
7912
7947
  return Number(cappedDuration.toFixed(10));
7913
7948
  }
7914
7949
  return mediaDuration;
@@ -10042,6 +10077,18 @@ var loadImage = ({
10042
10077
  function exponentialBackoff(errorCount) {
10043
10078
  return 1000 * 2 ** (errorCount - 1);
10044
10079
  }
10080
+ var waitForNextFrame = ({
10081
+ onFrame
10082
+ }) => {
10083
+ if (typeof requestAnimationFrame === "undefined") {
10084
+ onFrame();
10085
+ return () => {
10086
+ return;
10087
+ };
10088
+ }
10089
+ const frame = requestAnimationFrame(onFrame);
10090
+ return () => cancelAnimationFrame(frame);
10091
+ };
10045
10092
  var CanvasImageContent = forwardRef10(({
10046
10093
  src,
10047
10094
  width,
@@ -10071,6 +10118,17 @@ var CanvasImageContent = forwardRef10(({
10071
10118
  overrideId: controls?.overrideId ?? null
10072
10119
  });
10073
10120
  const sequenceContext = useContext32(SequenceContext);
10121
+ const pendingLoadDelayRef = useRef23(null);
10122
+ const continuePendingLoadDelay = useCallback17(() => {
10123
+ const pending = pendingLoadDelayRef.current;
10124
+ if (!pending || pending.continued) {
10125
+ return;
10126
+ }
10127
+ pending.continued = true;
10128
+ pending.unblock();
10129
+ continueRender2(pending.handle);
10130
+ pendingLoadDelayRef.current = null;
10131
+ }, [continueRender2]);
10074
10132
  const sourceCanvas = useMemo31(() => {
10075
10133
  if (typeof document === "undefined") {
10076
10134
  return null;
@@ -10088,7 +10146,7 @@ var CanvasImageContent = forwardRef10(({
10088
10146
  ref.current = canvas;
10089
10147
  }
10090
10148
  }, [ref, refForOutline]);
10091
- useEffect17(() => {
10149
+ useLayoutEffect10(() => {
10092
10150
  const isPremounting = Boolean(sequenceContext?.premounting);
10093
10151
  const isPostmounting = Boolean(sequenceContext?.postmounting);
10094
10152
  const handle = delayRender2(`Rendering <CanvasImage> with src="${truncateSrcForLabel(actualSrc)}"`, {
@@ -10100,17 +10158,13 @@ var CanvasImageContent = forwardRef10(({
10100
10158
  };
10101
10159
  const controller = new AbortController;
10102
10160
  let cancelled = false;
10103
- let continued = false;
10104
10161
  let errorCount = 0;
10105
10162
  let timeoutId = null;
10106
10163
  setLoadedImage(null);
10107
- const continueRenderOnce = () => {
10108
- if (continued) {
10109
- return;
10110
- }
10111
- continued = true;
10112
- unblock();
10113
- continueRender2(handle);
10164
+ pendingLoadDelayRef.current = {
10165
+ handle,
10166
+ unblock,
10167
+ continued: false
10114
10168
  };
10115
10169
  const attemptLoad = () => {
10116
10170
  loadImage({ src: actualSrc, signal: controller.signal }).then((image) => {
@@ -10118,13 +10172,9 @@ var CanvasImageContent = forwardRef10(({
10118
10172
  return;
10119
10173
  }
10120
10174
  setLoadedImage(image);
10121
- }).then(() => {
10122
- if (!cancelled) {
10123
- continueRenderOnce();
10124
- }
10125
10175
  }).catch((err) => {
10126
10176
  if (err.name === "AbortError") {
10127
- continueRenderOnce();
10177
+ continuePendingLoadDelay();
10128
10178
  return;
10129
10179
  }
10130
10180
  errorCount++;
@@ -10138,7 +10188,7 @@ var CanvasImageContent = forwardRef10(({
10138
10188
  }, backoff);
10139
10189
  } else if (onError) {
10140
10190
  onError(err);
10141
- continueRenderOnce();
10191
+ continuePendingLoadDelay();
10142
10192
  } else {
10143
10193
  cancelRender2(err);
10144
10194
  }
@@ -10151,12 +10201,12 @@ var CanvasImageContent = forwardRef10(({
10151
10201
  clearTimeout(timeoutId);
10152
10202
  }
10153
10203
  controller.abort();
10154
- continueRenderOnce();
10204
+ continuePendingLoadDelay();
10155
10205
  };
10156
10206
  }, [
10157
10207
  actualSrc,
10158
10208
  cancelRender2,
10159
- continueRender2,
10209
+ continuePendingLoadDelay,
10160
10210
  delayPlayback,
10161
10211
  delayRender2,
10162
10212
  delayRenderRetries,
@@ -10167,13 +10217,16 @@ var CanvasImageContent = forwardRef10(({
10167
10217
  sequenceContext?.postmounting,
10168
10218
  sequenceContext?.premounting
10169
10219
  ]);
10170
- useEffect17(() => {
10220
+ useLayoutEffect10(() => {
10171
10221
  if (!loadedImage || !outputCanvas || !sourceCanvas) {
10172
10222
  return;
10173
10223
  }
10174
10224
  const handle = delayRender2(`Applying effects to <CanvasImage> with src="${truncateSrcForLabel(actualSrc)}"`);
10175
10225
  let cancelled = false;
10176
10226
  let continued = false;
10227
+ let cancelWaitForNextFrame = () => {
10228
+ return;
10229
+ };
10177
10230
  const continueRenderOnce = () => {
10178
10231
  if (continued) {
10179
10232
  return;
@@ -10208,7 +10261,15 @@ var CanvasImageContent = forwardRef10(({
10208
10261
  height: canvasHeight
10209
10262
  }).then((completed) => {
10210
10263
  if (completed && !cancelled) {
10211
- continueRenderOnce();
10264
+ cancelWaitForNextFrame = waitForNextFrame({
10265
+ onFrame: () => {
10266
+ if (cancelled) {
10267
+ return;
10268
+ }
10269
+ continueRenderOnce();
10270
+ continuePendingLoadDelay();
10271
+ }
10272
+ });
10212
10273
  }
10213
10274
  }).catch((err) => {
10214
10275
  if (cancelled) {
@@ -10217,12 +10278,14 @@ var CanvasImageContent = forwardRef10(({
10217
10278
  if (onError) {
10218
10279
  onError(err);
10219
10280
  continueRenderOnce();
10281
+ continuePendingLoadDelay();
10220
10282
  } else {
10221
10283
  cancelRender2(err);
10222
10284
  }
10223
10285
  });
10224
10286
  return () => {
10225
10287
  cancelled = true;
10288
+ cancelWaitForNextFrame();
10226
10289
  continueRenderOnce();
10227
10290
  };
10228
10291
  }, [
@@ -10230,6 +10293,7 @@ var CanvasImageContent = forwardRef10(({
10230
10293
  cancelRender2,
10231
10294
  chainState,
10232
10295
  continueRender2,
10296
+ continuePendingLoadDelay,
10233
10297
  delayRender2,
10234
10298
  fit,
10235
10299
  height,
@@ -10439,7 +10503,7 @@ var ImgContent = ({
10439
10503
  if (typeof window !== "undefined") {
10440
10504
  const isPremounting = Boolean(sequenceContext?.premounting);
10441
10505
  const isPostmounting = Boolean(sequenceContext?.postmounting);
10442
- useLayoutEffect10(() => {
10506
+ useLayoutEffect11(() => {
10443
10507
  if (window.process?.env?.NODE_ENV === "test") {
10444
10508
  if (imageRef.current) {
10445
10509
  imageRef.current.src = actualSrc;
@@ -10706,7 +10770,8 @@ addSequenceStackTraces(Img);
10706
10770
  var interactiveElementSchema = {
10707
10771
  ...baseSchema,
10708
10772
  ...transformSchema,
10709
- ...textSchema
10773
+ ...textSchema,
10774
+ ...textContentSchema
10710
10775
  };
10711
10776
  var setRef = (ref, value) => {
10712
10777
  if (typeof ref === "function") {
@@ -11334,7 +11399,7 @@ var OffthreadVideoForRendering = ({
11334
11399
  mediaVolume: 1
11335
11400
  });
11336
11401
  warnAboutTooHighVolume(volume);
11337
- useEffect18(() => {
11402
+ useEffect17(() => {
11338
11403
  if (!src) {
11339
11404
  throw new Error("No src passed");
11340
11405
  }
@@ -11391,7 +11456,7 @@ var OffthreadVideoForRendering = ({
11391
11456
  }, [toneMapped, currentTime, src, transparent]);
11392
11457
  const [imageSrc, setImageSrc] = useState19(null);
11393
11458
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
11394
- useLayoutEffect11(() => {
11459
+ useLayoutEffect12(() => {
11395
11460
  if (!window.remotion_videoEnabled) {
11396
11461
  return;
11397
11462
  }
@@ -11495,7 +11560,7 @@ var useEmitVideoFrame = ({
11495
11560
  ref,
11496
11561
  onVideoFrame
11497
11562
  }) => {
11498
- useEffect19(() => {
11563
+ useEffect18(() => {
11499
11564
  const { current } = ref;
11500
11565
  if (!current) {
11501
11566
  return;
@@ -11670,7 +11735,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
11670
11735
  tag: "video",
11671
11736
  mountTime
11672
11737
  }));
11673
- useEffect20(() => {
11738
+ useEffect19(() => {
11674
11739
  const { current } = videoRef;
11675
11740
  if (!current) {
11676
11741
  return;
@@ -11713,7 +11778,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
11713
11778
  const currentOnDurationCallback = useRef27(onDuration);
11714
11779
  currentOnDurationCallback.current = onDuration;
11715
11780
  useEmitVideoFrame({ ref: videoRef, onVideoFrame });
11716
- useEffect20(() => {
11781
+ useEffect19(() => {
11717
11782
  const { current } = videoRef;
11718
11783
  if (!current) {
11719
11784
  return;
@@ -11730,7 +11795,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
11730
11795
  current.removeEventListener("loadedmetadata", onLoadedMetadata);
11731
11796
  };
11732
11797
  }, [src]);
11733
- useEffect20(() => {
11798
+ useEffect19(() => {
11734
11799
  const { current } = videoRef;
11735
11800
  if (!current) {
11736
11801
  return;
@@ -12511,7 +12576,7 @@ var VideoForRenderingForwardFunction = ({
12511
12576
  mediaVolume: 1
12512
12577
  });
12513
12578
  warnAboutTooHighVolume(volume);
12514
- useEffect21(() => {
12579
+ useEffect20(() => {
12515
12580
  if (!props2.src) {
12516
12581
  throw new Error("No src passed");
12517
12582
  }
@@ -12555,7 +12620,7 @@ var VideoForRenderingForwardFunction = ({
12555
12620
  return videoRef.current;
12556
12621
  }, []);
12557
12622
  useEmitVideoFrame({ ref: videoRef, onVideoFrame });
12558
- useEffect21(() => {
12623
+ useEffect20(() => {
12559
12624
  if (!window.remotion_videoEnabled) {
12560
12625
  return;
12561
12626
  }
@@ -12645,7 +12710,7 @@ var VideoForRenderingForwardFunction = ({
12645
12710
  ]);
12646
12711
  const { src } = props2;
12647
12712
  if (environment.isRendering) {
12648
- useLayoutEffect12(() => {
12713
+ useLayoutEffect13(() => {
12649
12714
  if (window.process?.env?.NODE_ENV === "test") {
12650
12715
  return;
12651
12716
  }