remotion 4.0.534 → 4.0.536

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 (128) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/AbsoluteFill.d.ts +2 -7
  3. package/dist/cjs/AbsoluteFill.js +1 -1
  4. package/dist/cjs/Composition.js +15 -20
  5. package/dist/cjs/CompositionManager.d.ts +0 -4
  6. package/dist/cjs/CompositionManagerContext.d.ts +1 -6
  7. package/dist/cjs/CompositionManagerContext.js +0 -4
  8. package/dist/cjs/CompositionManagerProvider.js +77 -169
  9. package/dist/cjs/CompositionRegistryProvider.d.ts +5 -0
  10. package/dist/cjs/CompositionRegistryProvider.js +142 -0
  11. package/dist/cjs/DefaultPremountContext.d.ts +1 -0
  12. package/dist/cjs/DefaultPremountContext.js +6 -0
  13. package/dist/cjs/Folder.js +11 -20
  14. package/dist/cjs/HtmlInCanvas.d.ts +6 -4
  15. package/dist/cjs/HtmlInCanvas.js +179 -32
  16. package/dist/cjs/IFrame.js +40 -8
  17. package/dist/cjs/Img.d.ts +4 -2
  18. package/dist/cjs/Img.js +4 -3
  19. package/dist/cjs/Interactive.d.ts +31 -5
  20. package/dist/cjs/Interactive.js +40 -8
  21. package/dist/cjs/RemotionRoot.js +2 -1
  22. package/dist/cjs/Sequence.d.ts +2 -3
  23. package/dist/cjs/Sequence.js +117 -39
  24. package/dist/cjs/SequenceActivityBoundary.d.ts +10 -0
  25. package/dist/cjs/SequenceActivityBoundary.js +101 -0
  26. package/dist/cjs/SequenceActivityBudget.d.ts +13 -0
  27. package/dist/cjs/SequenceActivityBudget.js +196 -0
  28. package/dist/cjs/SequenceActivitySuspensionProvider.d.ts +4 -0
  29. package/dist/cjs/SequenceActivitySuspensionProvider.js +45 -0
  30. package/dist/cjs/SequenceManager.d.ts +9 -22
  31. package/dist/cjs/SequenceManager.js +54 -196
  32. package/dist/cjs/SequenceRegistryProvider.d.ts +4 -0
  33. package/dist/cjs/SequenceRegistryProvider.js +292 -0
  34. package/dist/cjs/Track.d.ts +10 -3
  35. package/dist/cjs/Track.js +8 -8
  36. package/dist/cjs/animated-image/AnimatedImage.d.ts +3 -2
  37. package/dist/cjs/animated-image/AnimatedImage.js +47 -34
  38. package/dist/cjs/animated-image/canvas.d.ts +2 -1
  39. package/dist/cjs/animated-image/canvas.js +2 -2
  40. package/dist/cjs/animated-image/props.d.ts +2 -1
  41. package/dist/cjs/asset-types.d.ts +4 -0
  42. package/dist/cjs/audio/AudioForPreview.js +54 -41
  43. package/dist/cjs/audio/get-audio-sync-anchor-tolerance.d.ts +1 -0
  44. package/dist/cjs/audio/get-audio-sync-anchor-tolerance.js +11 -0
  45. package/dist/cjs/audio/shared-audio-tags.d.ts +1 -1
  46. package/dist/cjs/audio/shared-audio-tags.js +1 -1
  47. package/dist/cjs/audio/use-audio-context.js +26 -7
  48. package/dist/cjs/canvas-image/CanvasImage.d.ts +3 -2
  49. package/dist/cjs/canvas-image/CanvasImage.js +5 -4
  50. package/dist/cjs/canvas-image/props.d.ts +2 -1
  51. package/dist/cjs/committed-metadata.d.ts +68 -0
  52. package/dist/cjs/committed-metadata.js +39 -0
  53. package/dist/cjs/component-identity.d.ts +6 -0
  54. package/dist/cjs/component-identity.js +39 -0
  55. package/dist/cjs/composition-registry-fallback.d.ts +14 -0
  56. package/dist/cjs/composition-registry-fallback.js +35 -0
  57. package/dist/cjs/create-element-source-proxy.d.ts +4 -0
  58. package/dist/cjs/create-element-source-proxy.js +46 -0
  59. package/dist/cjs/default-premount-in-seconds.d.ts +3 -0
  60. package/dist/cjs/default-premount-in-seconds.js +12 -0
  61. package/dist/cjs/effects/Solid.d.ts +3 -2
  62. package/dist/cjs/effects/Solid.js +5 -4
  63. package/dist/cjs/effects/canvas-pool.d.ts +1 -0
  64. package/dist/cjs/effects/canvas-pool.js +15 -10
  65. package/dist/cjs/effects/effect-types.d.ts +4 -0
  66. package/dist/cjs/effects/index.d.ts +1 -1
  67. package/dist/cjs/effects/run-effect-chain.d.ts +3 -1
  68. package/dist/cjs/effects/run-effect-chain.js +94 -56
  69. package/dist/cjs/effects/use-effect-chain-state.d.ts +2 -1
  70. package/dist/cjs/effects/use-effect-chain-state.js +11 -2
  71. package/dist/cjs/effects/use-memoized-effects.js +96 -17
  72. package/dist/cjs/enable-sequence-stack-traces.d.ts +2 -8
  73. package/dist/cjs/enable-sequence-stack-traces.js +7 -38
  74. package/dist/cjs/freeze.js +4 -1
  75. package/dist/cjs/index.d.ts +1 -3
  76. package/dist/cjs/index.js +0 -2
  77. package/dist/cjs/interactivity-schema.d.ts +50 -14
  78. package/dist/cjs/interactivity-schema.js +32 -4
  79. package/dist/cjs/internals.d.ts +110 -33
  80. package/dist/cjs/internals.js +29 -8
  81. package/dist/cjs/interpolate-keyframed-status.d.ts +4 -0
  82. package/dist/cjs/interpolate-keyframed-status.js +38 -1
  83. package/dist/cjs/interpolate.d.ts +12 -0
  84. package/dist/cjs/interpolate.js +15 -1
  85. package/dist/cjs/no-react.d.ts +5 -1
  86. package/dist/cjs/no-react.js +6 -0
  87. package/dist/cjs/optimistic-sequence-deletion.d.ts +17 -0
  88. package/dist/cjs/optimistic-sequence-deletion.js +114 -0
  89. package/dist/cjs/registry-store.d.ts +17 -0
  90. package/dist/cjs/registry-store.js +68 -0
  91. package/dist/cjs/sequence-activity-context.d.ts +13 -0
  92. package/dist/cjs/sequence-activity-context.js +21 -0
  93. package/dist/cjs/sequence-activity-defaults.d.ts +1 -0
  94. package/dist/cjs/sequence-activity-defaults.js +4 -0
  95. package/dist/cjs/sequence-outline.js +1 -2
  96. package/dist/cjs/sequence-registry-context.d.ts +26 -0
  97. package/dist/cjs/sequence-registry-context.js +71 -0
  98. package/dist/cjs/series/index.d.ts +2 -1
  99. package/dist/cjs/series/index.js +12 -4
  100. package/dist/cjs/timeline-position-state.js +11 -3
  101. package/dist/cjs/timeline-track-context.d.ts +1 -1
  102. package/dist/cjs/timeline-track-context.js +1 -2
  103. package/dist/cjs/use-lazy-component.js +29 -15
  104. package/dist/cjs/use-media-in-timeline.d.ts +7 -14
  105. package/dist/cjs/use-media-in-timeline.js +15 -117
  106. package/dist/cjs/use-premounting.js +3 -4
  107. package/dist/cjs/use-schema.js +3 -1
  108. package/dist/cjs/use-sequence-registration.d.ts +1 -1
  109. package/dist/cjs/use-sequence-registration.js +22 -6
  110. package/dist/cjs/use-timeline-seek.d.ts +1 -0
  111. package/dist/cjs/use-timeline-seek.js +10 -0
  112. package/dist/cjs/use-video.d.ts +7 -2
  113. package/dist/cjs/use-video.js +11 -3
  114. package/dist/cjs/version.d.ts +1 -1
  115. package/dist/cjs/version.js +1 -1
  116. package/dist/cjs/video/VideoForPreview.js +55 -42
  117. package/dist/cjs/video/seek-until-right.js +11 -7
  118. package/dist/cjs/with-interactivity-schema.js +40 -14
  119. package/dist/cjs/wrap-remotion-context.d.ts +15 -3
  120. package/dist/cjs/wrap-remotion-context.js +101 -7
  121. package/dist/esm/index.mjs +3562 -2347
  122. package/dist/esm/no-react.mjs +74 -37
  123. package/dist/esm/version.mjs +1 -1
  124. package/package.json +2 -2
  125. package/dist/cjs/nonce.d.ts +0 -11
  126. package/dist/cjs/nonce.js +0 -42
  127. package/dist/cjs/sequence-order-marker.d.ts +0 -58
  128. package/dist/cjs/sequence-order-marker.js +0 -44
@@ -12,6 +12,7 @@ const freeze_js_1 = require("../freeze.js");
12
12
  const interactivity_schema_js_1 = require("../interactivity-schema.js");
13
13
  const prefetch_js_1 = require("../prefetch.js");
14
14
  const resolve_sequence_duration_js_1 = require("../resolve-sequence-duration.js");
15
+ const sequence_activity_context_js_1 = require("../sequence-activity-context.js");
15
16
  const Sequence_js_1 = require("../Sequence.js");
16
17
  const SequenceContext_js_1 = require("../SequenceContext.js");
17
18
  const truncate_src_for_label_js_1 = require("../truncate-src-for-label.js");
@@ -110,14 +111,14 @@ const waitForNextFrame = ({ onFrame, }) => {
110
111
  const frame = requestAnimationFrame(onFrame);
111
112
  return () => cancelAnimationFrame(frame);
112
113
  };
113
- const CanvasImageContent = (0, react_1.forwardRef)(({ src, crossOrigin, width, height, fit = 'fill', effects, controls, onError, className, style, id, pauseWhenLoading, maxRetries = 2, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...canvasProps }, ref) => {
114
+ const CanvasImageContent = (0, react_1.forwardRef)(({ src, crossOrigin, width, height, fit = 'fill', effects, effectsOutputSize, controls, onError, className, style, id, pauseWhenLoading, maxRetries = 2, delayRenderRetries, delayRenderTimeoutInMilliseconds, ...canvasProps }, ref) => {
114
115
  var _a, _b;
115
116
  const { delayRender, continueRender, cancelRender } = (0, use_delay_render_js_1.useDelayRender)();
116
117
  const { delayPlayback } = (0, use_buffer_state_js_1.useBufferState)();
117
118
  const [outputCanvas, setOutputCanvas] = (0, react_1.useState)(null);
118
119
  const [loadedImage, setLoadedImage] = (0, react_1.useState)(null);
119
120
  const actualSrc = (0, prefetch_js_1.usePreload)(src);
120
- const chainState = (0, use_effect_chain_state_js_1.useEffectChainState)();
121
+ const chainState = (0, use_effect_chain_state_js_1.useEffectChainState)(effectsOutputSize);
121
122
  const memoizedEffects = (0, use_memoized_effects_js_1.useMemoizedEffects)({
122
123
  effects,
123
124
  overrideId: (_a = controls === null || controls === void 0 ? void 0 : controls.overrideId) !== null && _a !== void 0 ? _a : null,
@@ -329,7 +330,7 @@ const CanvasImageContent = (0, react_1.forwardRef)(({ src, crossOrigin, width, h
329
330
  return (jsx_runtime_1.jsx("canvas", { ...canvasProps, ref: canvasRef, width: width, height: height, className: className, style: style, id: id }));
330
331
  });
331
332
  CanvasImageContent.displayName = 'CanvasImageContent';
332
- const CanvasImageInner = (0, react_1.forwardRef)(({ src, crossOrigin, width, height, fit, effects = [], className, style, id, onError, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, durationInFrames, from, trimBefore, loop, freeze, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, hidden, name, showInTimeline, cropLeft, cropRight, cropTop, cropBottom, controls, _remotionInternalDocumentationLink, _remotionInternalCropComponentName, ...canvasProps }, ref) => {
333
+ const CanvasImageInner = (0, react_1.forwardRef)(({ src, crossOrigin, width, height, fit, effects = [], effectsOutputSize, className, style, id, onError, pauseWhenLoading, maxRetries, delayRenderRetries, delayRenderTimeoutInMilliseconds, durationInFrames, from, trimBefore, loop, freeze, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, hidden, name, showInTimeline, cropLeft, cropRight, cropTop, cropBottom, controls, _remotionInternalDocumentationLink, _remotionInternalCropComponentName, ...canvasProps }, ref) => {
333
334
  if (!src) {
334
335
  throw new Error('No "src" prop was passed to <CanvasImage>.');
335
336
  }
@@ -364,7 +365,7 @@ const CanvasImageInner = (0, react_1.forwardRef)(({ src, crossOrigin, width, hei
364
365
  style: premountingStyle,
365
366
  componentName: _remotionInternalCropComponentName !== null && _remotionInternalCropComponentName !== void 0 ? _remotionInternalCropComponentName : '<CanvasImage />',
366
367
  });
367
- return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, trimBefore: trimBefore, loop: loop, durationInFrames: durationInFrames, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, name: name !== null && name !== void 0 ? name : '<CanvasImage>', _remotionInternalDocumentationLink: _remotionInternalDocumentationLink !== null && _remotionInternalDocumentationLink !== void 0 ? _remotionInternalDocumentationLink : 'https://www.remotion.dev/docs/canvasimage', controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, _remotionInternalIsMedia: isMedia, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: jsx_runtime_1.jsx(CanvasImageContent, { ref: actualRef, src: src, crossOrigin: crossOrigin, width: width, height: height, fit: fit, effects: effects, controls: controls, className: className, style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, id: id, onError: onError, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, ...canvasProps }) }) }));
368
+ return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, trimBefore: trimBefore, loop: loop, durationInFrames: durationInFrames, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, name: name !== null && name !== void 0 ? name : '<CanvasImage>', _remotionInternalDocumentationLink: _remotionInternalDocumentationLink !== null && _remotionInternalDocumentationLink !== void 0 ? _remotionInternalDocumentationLink : 'https://www.remotion.dev/docs/canvasimage', controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, _remotionInternalIsMedia: isMedia, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceContent, { children: jsx_runtime_1.jsx(CanvasImageContent, { ref: actualRef, src: src, crossOrigin: crossOrigin, width: width, height: height, fit: fit, effects: effects, effectsOutputSize: effectsOutputSize !== null && effectsOutputSize !== void 0 ? effectsOutputSize : null, controls: controls, className: className, style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, id: id, onError: onError, pauseWhenLoading: pauseWhenLoading, maxRetries: maxRetries, delayRenderRetries: delayRenderRetries, delayRenderTimeoutInMilliseconds: delayRenderTimeoutInMilliseconds, ...canvasProps }) }) }) }));
368
369
  });
369
370
  /*
370
371
  * @description Renders a static image to a `<canvas>` and applies Remotion effects.
@@ -1,6 +1,6 @@
1
1
  import type React from 'react';
2
2
  import type { ImageFit } from '../calculate-image-fit.js';
3
- import type { EffectsProp } from '../effects/effect-types.js';
3
+ import type { EffectsProp, EffectsOutputSize } from '../effects/effect-types.js';
4
4
  import type { InteractiveBaseProps, InteractiveCropProps, InteractivePremountProps } from '../Interactive.js';
5
5
  type CanvasImageSequenceProps = Omit<InteractiveBaseProps, 'playbackRate'> & InteractiveCropProps & InteractivePremountProps;
6
6
  export type CanvasImageCanvasProps = Omit<React.CanvasHTMLAttributes<HTMLCanvasElement>, 'children' | 'height' | 'onError' | 'width'>;
@@ -11,6 +11,7 @@ export type CanvasImageProps = CanvasImageSequenceProps & CanvasImageCanvasProps
11
11
  readonly height?: number;
12
12
  readonly fit?: ImageFit;
13
13
  readonly effects?: EffectsProp;
14
+ readonly effectsOutputSize?: EffectsOutputSize;
14
15
  readonly className?: string;
15
16
  readonly style?: React.CSSProperties;
16
17
  readonly id?: string;
@@ -0,0 +1,68 @@
1
+ import type { Provider, ProviderExoticComponent, ProviderProps, RefObject } from 'react';
2
+ import type { AnyComposition, TSequence } from './CompositionManager.js';
3
+ import type { TFolder } from './Folder.js';
4
+ export declare const COMMIT_ORDER_EVENT = "remotion:commit-order";
5
+ export declare const COMMIT_REGISTRATION_ERROR_EVENT = "remotion:commit-registration-error";
6
+ export declare const isCommitRegistrationObserverInstalled: () => boolean;
7
+ export type CompositionAndFolderOrderItem = {
8
+ readonly type: 'composition';
9
+ readonly id: string;
10
+ } | {
11
+ readonly type: 'folder';
12
+ readonly id: string;
13
+ };
14
+ export declare const getCompositionAndFolderOrderKey: (item: CompositionAndFolderOrderItem) => string;
15
+ export type CommitOrderEventDetail = {
16
+ readonly sequenceManagers: readonly {
17
+ readonly managerId: string;
18
+ readonly sequenceIds: readonly string[];
19
+ }[];
20
+ };
21
+ export declare const getFolderOrderId: ({ name, parent, }: {
22
+ readonly name: string;
23
+ readonly parent: string | null;
24
+ }) => string;
25
+ export type CommittedSequenceSnapshot = {
26
+ readonly sequences: readonly TSequence[];
27
+ readonly sequenceIds: readonly string[];
28
+ };
29
+ export type CommittedCompositionSnapshot = {
30
+ readonly compositions: readonly AnyComposition[];
31
+ readonly folders: readonly TFolder[];
32
+ readonly orderIds: readonly string[];
33
+ };
34
+ export type CommittedMetadata = {
35
+ readonly type: 'sequence';
36
+ readonly id: string;
37
+ readonly value: TSequence | null;
38
+ readonly outlineChildrenRef: RefObject<Element | null> | null;
39
+ } | {
40
+ readonly type: 'composition';
41
+ readonly id: string;
42
+ readonly value: AnyComposition;
43
+ } | {
44
+ readonly type: 'folder';
45
+ readonly id: string;
46
+ readonly value: TFolder;
47
+ } | {
48
+ readonly type: 'sequence-manager';
49
+ readonly id: string;
50
+ readonly onCommit: ((sequences: readonly TSequence[], sequenceIds: readonly string[]) => void) | null;
51
+ } | {
52
+ readonly type: 'composition-manager';
53
+ readonly id: string;
54
+ readonly onCommit: ((snapshot: CommittedCompositionSnapshot) => void) | null;
55
+ };
56
+ export declare const withCommittedMetadata: <T>(provider: Provider<T>) => ProviderExoticComponent<ProviderProps<T> & {
57
+ readonly _remotionCommitMetadata: CommittedMetadata | null;
58
+ }>;
59
+ export declare const CommittedMetadataProvider: ProviderExoticComponent<ProviderProps<null> & {
60
+ readonly _remotionCommitMetadata: CommittedMetadata | null;
61
+ }>;
62
+ export declare const CommittedMetadataInternals: {
63
+ metadataProp: "_remotionCommitMetadata";
64
+ eventName: string;
65
+ installationMarker: symbol;
66
+ failureMarker: symbol;
67
+ registrationErrorEventName: string;
68
+ };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommittedMetadataInternals = exports.CommittedMetadataProvider = exports.withCommittedMetadata = exports.getFolderOrderId = exports.getCompositionAndFolderOrderKey = exports.isCommitRegistrationObserverInstalled = exports.COMMIT_REGISTRATION_ERROR_EVENT = exports.COMMIT_ORDER_EVENT = void 0;
4
+ const react_1 = require("react");
5
+ const COMMITTED_METADATA_PROP = '_remotionCommitMetadata';
6
+ exports.COMMIT_ORDER_EVENT = 'remotion:commit-order';
7
+ exports.COMMIT_REGISTRATION_ERROR_EVENT = 'remotion:commit-registration-error';
8
+ const COMMIT_OBSERVER_INSTALLATION_MARKER = Symbol.for('remotion.commit-order-observer-installed');
9
+ const COMMIT_OBSERVER_FAILURE_MARKER = Symbol.for('remotion.commit-registration-observer-failed');
10
+ const isCommitRegistrationObserverInstalled = () => {
11
+ if (typeof window === 'undefined') {
12
+ return false;
13
+ }
14
+ const hook = Reflect.get(window, '__REACT_DEVTOOLS_GLOBAL_HOOK__');
15
+ return (typeof hook === 'object' &&
16
+ hook !== null &&
17
+ Reflect.get(hook, 'isDisabled') !== true &&
18
+ Reflect.get(hook, COMMIT_OBSERVER_INSTALLATION_MARKER) === true &&
19
+ Reflect.get(hook, COMMIT_OBSERVER_FAILURE_MARKER) !== true);
20
+ };
21
+ exports.isCommitRegistrationObserverInstalled = isCommitRegistrationObserverInstalled;
22
+ const getCompositionAndFolderOrderKey = (item) => `${item.type}:${item.id}`;
23
+ exports.getCompositionAndFolderOrderKey = getCompositionAndFolderOrderKey;
24
+ const getFolderOrderId = ({ name, parent, }) => [parent, name].filter(Boolean).join('/');
25
+ exports.getFolderOrderId = getFolderOrderId;
26
+ // This is the same provider, with an additional private prop type. Metadata
27
+ // stays outside its context value, so edits do not notify context consumers.
28
+ const withCommittedMetadata = (provider) => provider;
29
+ exports.withCommittedMetadata = withCommittedMetadata;
30
+ // Leaves without an existing provider still need a committed Fiber when their
31
+ // content is null. Its constant context value never carries registry metadata.
32
+ exports.CommittedMetadataProvider = (0, exports.withCommittedMetadata)((0, react_1.createContext)(null).Provider);
33
+ exports.CommittedMetadataInternals = {
34
+ metadataProp: COMMITTED_METADATA_PROP,
35
+ eventName: exports.COMMIT_ORDER_EVENT,
36
+ installationMarker: COMMIT_OBSERVER_INSTALLATION_MARKER,
37
+ failureMarker: COMMIT_OBSERVER_FAILURE_MARKER,
38
+ registrationErrorEventName: exports.COMMIT_REGISTRATION_ERROR_EVENT,
39
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ type ComponentIdentityResolver = (component: unknown) => unknown;
3
+ export declare const setComponentIdentityResolver: (resolver: ComponentIdentityResolver | null) => void;
4
+ export declare const resolveComponentIdentity: (component: unknown) => unknown;
5
+ export declare const getSingleChildComponent: (children: React.ReactNode) => unknown;
6
+ export {};
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getSingleChildComponent = exports.resolveComponentIdentity = exports.setComponentIdentityResolver = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const is_inside_series_js_1 = require("./series/is-inside-series.js");
9
+ // Studio installs a resolver that maps refreshed component implementations to
10
+ // the stable family object maintained by React Refresh.
11
+ let componentIdentityResolver = null;
12
+ const setComponentIdentityResolver = (resolver) => {
13
+ componentIdentityResolver = resolver;
14
+ };
15
+ exports.setComponentIdentityResolver = setComponentIdentityResolver;
16
+ const resolveComponentIdentity = (component) => {
17
+ var _a;
18
+ return (_a = componentIdentityResolver === null || componentIdentityResolver === void 0 ? void 0 : componentIdentityResolver(component)) !== null && _a !== void 0 ? _a : component;
19
+ };
20
+ exports.resolveComponentIdentity = resolveComponentIdentity;
21
+ const getSingleChildComponent = (children) => {
22
+ const mountedChildren = react_1.default.Children.toArray(children);
23
+ if (mountedChildren.length !== 1) {
24
+ return null;
25
+ }
26
+ const child = mountedChildren[0];
27
+ if (!react_1.default.isValidElement(child)) {
28
+ return null;
29
+ }
30
+ // Series inserts this transparent context boundary around its authored children.
31
+ if (child.type === is_inside_series_js_1.IsNotInsideSeriesProvider) {
32
+ return (0, exports.getSingleChildComponent)(child.props.children);
33
+ }
34
+ if (typeof child.type !== 'function' && typeof child.type !== 'object') {
35
+ return null;
36
+ }
37
+ return (0, exports.resolveComponentIdentity)(child.type);
38
+ };
39
+ exports.getSingleChildComponent = getSingleChildComponent;
@@ -0,0 +1,14 @@
1
+ import type { AnyComposition } from './CompositionManager.js';
2
+ import type { TFolder } from './Folder.js';
3
+ export type CommittedCompositionEntry = {
4
+ readonly type: 'composition';
5
+ readonly value: AnyComposition;
6
+ } | {
7
+ readonly type: 'folder';
8
+ readonly value: TFolder;
9
+ };
10
+ export declare const CompositionRegistryFallbackContext: import("react").Context<{
11
+ readonly entries: Map<object, CommittedCompositionEntry>;
12
+ readonly notifyCommit: () => void;
13
+ } | null>;
14
+ export declare const useCommittedCompositionEntry: (entry: CommittedCompositionEntry | null) => void;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCommittedCompositionEntry = exports.CompositionRegistryFallbackContext = void 0;
4
+ const react_1 = require("react");
5
+ exports.CompositionRegistryFallbackContext = (0, react_1.createContext)(null);
6
+ const useIsomorphicLayoutEffect = typeof window === 'undefined' ? react_1.useEffect : react_1.useLayoutEffect;
7
+ // The fallback stages descriptors during layout effects and publishes one
8
+ // complete snapshot after the commit, including mount and unmount changes.
9
+ const useCommittedCompositionEntry = (entry) => {
10
+ const registry = (0, react_1.useContext)(exports.CompositionRegistryFallbackContext);
11
+ const key = (0, react_1.useRef)({});
12
+ useIsomorphicLayoutEffect(() => {
13
+ if (registry === null) {
14
+ return;
15
+ }
16
+ if (entry === null) {
17
+ registry.entries.delete(key.current);
18
+ }
19
+ else {
20
+ registry.entries.set(key.current, entry);
21
+ }
22
+ registry.notifyCommit();
23
+ }, [entry, registry]);
24
+ useIsomorphicLayoutEffect(() => {
25
+ if (registry === null) {
26
+ return;
27
+ }
28
+ const identity = key.current;
29
+ return () => {
30
+ registry.entries.delete(identity);
31
+ registry.notifyCommit();
32
+ };
33
+ }, [registry]);
34
+ };
35
+ exports.useCommittedCompositionEntry = useCommittedCompositionEntry;
@@ -0,0 +1,4 @@
1
+ import type React from 'react';
2
+ import type JsxRuntimeDev from 'react/jsx-dev-runtime';
3
+ import type JsxRuntime from 'react/jsx-runtime';
4
+ export declare const createElementSourceProxy: <T extends typeof React.createElement | typeof JsxRuntime.jsx | typeof JsxRuntimeDev.jsxDEV>(api: T, sourceArgumentIndex: number | null, getSourceFileName: (fileName: string) => string) => T;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createElementSourceProxy = void 0;
4
+ const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
5
+ const componentsToAddStacksTo = (0, enable_sequence_stack_traces_js_1.getComponentsToAddStacksTo)();
6
+ const internalStackProp = enable_sequence_stack_traces_js_1.REMOTION_INTERNAL_STACK_PROP;
7
+ const createElementSourceProxy = (api, sourceArgumentIndex, getSourceFileName) => {
8
+ return new Proxy(api, {
9
+ apply(target, thisArg, argArray) {
10
+ const component = argArray[0];
11
+ if (componentsToAddStacksTo.includes(component)) {
12
+ const [first, props, ...rest] = argArray;
13
+ const source = sourceArgumentIndex === null ? null : argArray[sourceArgumentIndex];
14
+ const existingStack = props === null || props === void 0 ? void 0 : props[internalStackProp];
15
+ // Internal wrappers already captured the authored location in their controls.
16
+ const controlsStack = !existingStack &&
17
+ component === (0, enable_sequence_stack_traces_js_1.getSequenceComponent)() &&
18
+ (props === null || props === void 0 ? void 0 : props.controls)
19
+ ? (0, enable_sequence_stack_traces_js_1.getStackForControls)(props.controls)
20
+ : null;
21
+ const stack = existingStack ||
22
+ (controlsStack !== null && controlsStack !== void 0 ? controlsStack : (source &&
23
+ typeof source.fileName === 'string' &&
24
+ typeof source.lineNumber === 'number' &&
25
+ typeof source.columnNumber === 'number'
26
+ ? (0, enable_sequence_stack_traces_js_1.makeOriginalSourceStack)({
27
+ fileName: getSourceFileName(source.fileName),
28
+ lineNumber: source.lineNumber,
29
+ // JSX development locations are one-based, like stack traces.
30
+ // Resolved source locations and AST lookups use zero-based columns.
31
+ columnNumber: source.columnNumber - 1,
32
+ })
33
+ : new Error().stack));
34
+ const newProps = existingStack
35
+ ? { ...props }
36
+ : {
37
+ ...(props !== null && props !== void 0 ? props : {}),
38
+ [internalStackProp]: stack,
39
+ };
40
+ return Reflect.apply(target, thisArg, [first, newProps, ...rest]);
41
+ }
42
+ return Reflect.apply(target, thisArg, argArray);
43
+ },
44
+ });
45
+ };
46
+ exports.createElementSourceProxy = createElementSourceProxy;
@@ -0,0 +1,3 @@
1
+ export declare const DEFAULT_PREMOUNT_IN_SECONDS: number;
2
+ export declare const DEFAULT_STUDIO_PREMOUNT_IN_SECONDS = 2;
3
+ export declare const validateDefaultPremountInSeconds: (value: unknown) => void;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateDefaultPremountInSeconds = exports.DEFAULT_STUDIO_PREMOUNT_IN_SECONDS = exports.DEFAULT_PREMOUNT_IN_SECONDS = void 0;
4
+ const v5_flag_js_1 = require("./v5-flag.js");
5
+ exports.DEFAULT_PREMOUNT_IN_SECONDS = v5_flag_js_1.ENABLE_V5_BREAKING_CHANGES ? 2 : 0;
6
+ exports.DEFAULT_STUDIO_PREMOUNT_IN_SECONDS = 2;
7
+ const validateDefaultPremountInSeconds = (value) => {
8
+ if (typeof value !== 'number' || !Number.isFinite(value) || value < 0) {
9
+ throw new TypeError(`defaultPremountInSeconds must be a finite, non-negative number, but got ${String(value)}.`);
10
+ }
11
+ };
12
+ exports.validateDefaultPremountInSeconds = validateDefaultPremountInSeconds;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { InteractiveBaseProps, InteractivePremountProps, InteractiveCropProps } from '../Interactive.js';
3
- import type { EffectsProp } from './effect-types.js';
3
+ import type { EffectsProp, EffectsOutputSize } from './effect-types.js';
4
4
  type MandatoryProps = {
5
5
  readonly width: number;
6
6
  readonly height: number;
@@ -8,6 +8,7 @@ type MandatoryProps = {
8
8
  type OptionalProps = {
9
9
  readonly color: string | undefined;
10
10
  readonly effects: EffectsProp;
11
+ readonly effectsOutputSize: EffectsOutputSize | null;
11
12
  readonly className: string | undefined;
12
13
  readonly style: React.CSSProperties | undefined;
13
14
  readonly pixelDensity: number | undefined;
@@ -127,7 +128,7 @@ export declare const solidSchema: {
127
128
  };
128
129
  readonly premountFor: {
129
130
  readonly type: "number";
130
- readonly default: 0;
131
+ readonly default: undefined;
131
132
  readonly description: "Premount For";
132
133
  readonly min: 0;
133
134
  readonly step: 1;
@@ -7,6 +7,7 @@ const enable_sequence_stack_traces_js_1 = require("../enable-sequence-stack-trac
7
7
  const freeze_js_1 = require("../freeze.js");
8
8
  const interactivity_schema_js_1 = require("../interactivity-schema.js");
9
9
  const resolve_sequence_duration_js_1 = require("../resolve-sequence-duration.js");
10
+ const sequence_activity_context_js_1 = require("../sequence-activity-context.js");
10
11
  const Sequence_js_1 = require("../Sequence.js");
11
12
  const use_crop_style_js_1 = require("../use-crop-style.js");
12
13
  const use_delay_render_js_1 = require("../use-delay-render.js");
@@ -65,7 +66,7 @@ exports.solidSchema = {
65
66
  ...interactivity_schema_js_1.borderRadiusSchema,
66
67
  ...interactivity_schema_js_1.cropSchema,
67
68
  };
68
- const SolidInner = ({ color, width, height, effects = [], className, style, pixelDensity, overrideId, videoConfigValues, reference, }) => {
69
+ const SolidInner = ({ color, width, height, effects = [], effectsOutputSize = null, className, style, pixelDensity, overrideId, videoConfigValues, reference, }) => {
69
70
  const { delayRender, continueRender, cancelRender } = (0, use_delay_render_js_1.useDelayRender)();
70
71
  const resolvedPixelDensity = resolveSolidPixelDensity(pixelDensity);
71
72
  const canvasWidth = Math.ceil(width * resolvedPixelDensity);
@@ -85,7 +86,7 @@ const SolidInner = ({ color, width, height, effects = [], className, style, pixe
85
86
  canvas.height = 1;
86
87
  return canvas;
87
88
  }, []);
88
- const chainState = (0, use_effect_chain_state_js_1.useEffectChainState)();
89
+ const chainState = (0, use_effect_chain_state_js_1.useEffectChainState)(effectsOutputSize);
89
90
  const canvasRef = (0, react_1.useCallback)((canvas) => {
90
91
  setOutputCanvas(canvas);
91
92
  if (typeof reference === 'function') {
@@ -157,7 +158,7 @@ const SolidInner = ({ color, width, height, effects = [], className, style, pixe
157
158
  }, [height, style, width]);
158
159
  return (jsx_runtime_1.jsx("canvas", { ref: canvasRef, width: canvasWidth, height: canvasHeight, className: className, style: canvasStyle }));
159
160
  };
160
- const SolidOuter = (0, react_1.forwardRef)(({ effects = [], controls, color, height, width, className, durationInFrames, style, name, from, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, trimBefore, playbackRate, loop, freeze, hidden, showInTimeline, pixelDensity, cropLeft, cropRight, cropTop, cropBottom, ...props }, ref) => {
161
+ const SolidOuter = (0, react_1.forwardRef)(({ effects = [], effectsOutputSize = null, controls, color, height, width, className, durationInFrames, style, name, from, premountFor, postmountFor, styleWhilePremounted, styleWhilePostmounted, trimBefore, playbackRate, loop, freeze, hidden, showInTimeline, pixelDensity, cropLeft, cropRight, cropTop, cropBottom, ...props }, ref) => {
161
162
  var _a, _b;
162
163
  props;
163
164
  const memoizedEffectDefinitions = (0, use_memoized_effects_js_1.useMemoizedEffectDefinitions)(effects);
@@ -187,7 +188,7 @@ const SolidOuter = (0, react_1.forwardRef)(({ effects = [], controls, color, hei
187
188
  style: premountingStyle,
188
189
  componentName: '<Solid />',
189
190
  });
190
- return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from, trimBefore: trimBefore, playbackRate: playbackRate, loop: loop, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline, controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, durationInFrames: durationInFrames, name: name !== null && name !== void 0 ? name : '<Solid>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/solid", ...props, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: jsx_runtime_1.jsx(SolidInner, { reference: actualRef, videoConfigValues: (_a = controls === null || controls === void 0 ? void 0 : controls.videoConfigValues) !== null && _a !== void 0 ? _a : null, overrideId: (_b = controls === null || controls === void 0 ? void 0 : controls.overrideId) !== null && _b !== void 0 ? _b : null, color: color, height: height, width: width, className: className, style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, effects: effects, pixelDensity: pixelDensity }) }) }));
191
+ return (jsx_runtime_1.jsx(freeze_js_1.Freeze, { frame: freezeFrame, active: isPremountingOrPostmounting, _remotionInternalIsPremounting: premountingActive, children: jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from, trimBefore: trimBefore, playbackRate: playbackRate, loop: loop, freeze: freeze, hidden: hidden, showInTimeline: showInTimeline, controls: controls, _remotionInternalEffects: memoizedEffectDefinitions, durationInFrames: durationInFrames, name: name !== null && name !== void 0 ? name : '<Solid>', _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/solid", ...props, _remotionInternalPremountDisplay: effectivePremountFor || null, _remotionInternalPostmountDisplay: effectivePostmountFor || null, _remotionInternalIsPremounting: premountingActive, _remotionInternalIsPostmounting: postmountingActive, children: jsx_runtime_1.jsx(sequence_activity_context_js_1.SequenceContent, { children: jsx_runtime_1.jsx(SolidInner, { reference: actualRef, videoConfigValues: (_a = controls === null || controls === void 0 ? void 0 : controls.videoConfigValues) !== null && _a !== void 0 ? _a : null, overrideId: (_b = controls === null || controls === void 0 ? void 0 : controls.overrideId) !== null && _b !== void 0 ? _b : null, color: color, height: height, width: width, className: className, style: croppedStyle !== null && croppedStyle !== void 0 ? croppedStyle : undefined, effects: effects, effectsOutputSize: effectsOutputSize, pixelDensity: pixelDensity }) }) }) }));
191
192
  });
192
193
  exports.Solid = (0, with_interactivity_schema_js_1.withInteractivitySchema)({
193
194
  Component: SolidOuter,
@@ -9,6 +9,7 @@ export declare class CanvasPool {
9
9
  private readonly onContextLost;
10
10
  private disposed;
11
11
  constructor(width: number, height: number, onContextLost: (canvas: HTMLCanvasElement) => void);
12
+ getCanvas(backend: Backend, index: 0 | 1): HTMLCanvasElement;
12
13
  getPair(backend: Backend): CanvasPair;
13
14
  assertContextNotLost(canvas: HTMLCanvasElement): void;
14
15
  dispose(): void;
@@ -30,20 +30,25 @@ class CanvasPool {
30
30
  this.height = height;
31
31
  this.onContextLost = onContextLost;
32
32
  }
33
- getPair(backend) {
33
+ getCanvas(backend, index) {
34
+ var _a;
34
35
  if (this.disposed) {
35
36
  throw new Error('Effect chain state was used after it had been cleaned up');
36
37
  }
37
- const existing = this.pairs.get(backend);
38
- if (existing) {
39
- return existing;
38
+ let pair = this.pairs.get(backend);
39
+ if (!pair) {
40
+ pair = [null, null];
41
+ this.pairs.set(backend, pair);
40
42
  }
41
- const pair = [
42
- this.allocateCanvas(backend),
43
- this.allocateCanvas(backend),
44
- ];
45
- this.pairs.set(backend, pair);
46
- return pair;
43
+ // A single effect needs one target. Allocate its ping-pong partner only
44
+ // when a later pass actually uses it.
45
+ (_a = pair[index]) !== null && _a !== void 0 ? _a : (pair[index] = this.allocateCanvas(backend));
46
+ return pair[index];
47
+ }
48
+ getPair(backend) {
49
+ this.getCanvas(backend, 0);
50
+ this.getCanvas(backend, 1);
51
+ return this.pairs.get(backend);
47
52
  }
48
53
  assertContextNotLost(canvas) {
49
54
  if (this.lostContexts.has(canvas)) {
@@ -52,4 +52,8 @@ export type EffectFactory<P> = {} extends P ? (params?: P & {
52
52
  }) => EffectDescriptor<unknown> : (params: P & {
53
53
  readonly disabled?: boolean;
54
54
  }) => EffectDescriptor<unknown>;
55
+ export type EffectsOutputSize = {
56
+ readonly width: number;
57
+ readonly height: number;
58
+ };
55
59
  export {};
@@ -1,2 +1,2 @@
1
1
  export { createEffect } from './create-effect.js';
2
- export type { Backend, EffectApplyParams, EffectDefinitionAndStack, EffectDescriptor, EffectsProp, EffectDefinition, EffectFactory, } from './effect-types.js';
2
+ export type { Backend, EffectApplyParams, EffectDefinitionAndStack, EffectDescriptor, EffectsProp, EffectsOutputSize, EffectDefinition, EffectFactory, } from './effect-types.js';
@@ -1,6 +1,8 @@
1
1
  import { CanvasPool } from './canvas-pool.js';
2
2
  import type { EffectDefinition, EffectDefinitionAndStack } from './effect-types.js';
3
3
  export type EffectChainState = {
4
+ readonly width: number;
5
+ readonly height: number;
4
6
  pool: CanvasPool;
5
7
  setupCache: WeakMap<EffectDefinition<unknown, unknown>, WeakMap<HTMLCanvasElement, unknown>>;
6
8
  cleanupRegistry: Array<{
@@ -22,4 +24,4 @@ export type RunEffectChainOptions = {
22
24
  readonly width: number;
23
25
  readonly height: number;
24
26
  };
25
- export declare const runEffectChain: ({ state, source, effects, output, width, height, }: RunEffectChainOptions) => Promise<boolean>;
27
+ export declare const runEffectChain: (options: RunEffectChainOptions) => Promise<boolean>;