remotion 3.3.44 → 3.3.51
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/README.md +1 -1
- package/dist/{Clipper.js → cjs/Clipper.js} +2 -2
- package/dist/{Composition.js → cjs/Composition.js} +38 -38
- package/dist/{CompositionManager.d.ts → cjs/CompositionManager.d.ts} +1 -1
- package/dist/{CompositionManager.js → cjs/CompositionManager.js} +14 -4
- package/dist/{Folder.js → cjs/Folder.js} +6 -6
- package/dist/{IFrame.js → cjs/IFrame.js} +4 -4
- package/dist/{Img.js → cjs/Img.js} +9 -9
- package/dist/{Null.js → cjs/Null.js} +2 -2
- package/dist/{RemotionRoot.js → cjs/RemotionRoot.js} +13 -13
- package/dist/{Sequence.d.ts → cjs/Sequence.d.ts} +1 -0
- package/dist/{Sequence.js → cjs/Sequence.js} +15 -15
- package/dist/{Still.d.ts → cjs/Still.d.ts} +1 -1
- package/dist/{Still.js → cjs/Still.js} +2 -2
- package/dist/{audio → cjs/audio}/Audio.d.ts +2 -2
- package/dist/{audio → cjs/audio}/Audio.js +18 -18
- package/dist/{audio → cjs/audio}/AudioForDevelopment.d.ts +1 -1
- package/dist/{audio → cjs/audio}/AudioForDevelopment.js +22 -22
- package/dist/{audio → cjs/audio}/AudioForRendering.d.ts +1 -1
- package/dist/{audio → cjs/audio}/AudioForRendering.js +23 -23
- package/dist/cjs/audio/index.d.ts +2 -0
- package/dist/{audio → cjs/audio}/index.js +2 -2
- package/dist/{audio → cjs/audio}/props.d.ts +1 -1
- package/dist/{audio → cjs/audio}/shared-audio-tags.d.ts +1 -1
- package/dist/{audio → cjs/audio}/use-audio-frame.js +4 -4
- package/dist/{config → cjs/config}/input-props.js +3 -3
- package/dist/cjs/config.d.ts +285 -0
- package/dist/{delay-render.js → cjs/delay-render.js} +5 -5
- package/dist/{easing.js → cjs/easing.js} +2 -2
- package/dist/{freeze.js → cjs/freeze.js} +4 -4
- package/dist/{get-environment.js → cjs/get-environment.js} +2 -2
- package/dist/{index.d.ts → cjs/index.d.ts} +32 -31
- package/dist/{index.js → cjs/index.js} +45 -45
- package/dist/{internals.d.ts → cjs/internals.d.ts} +13 -15
- package/dist/cjs/internals.js +101 -0
- package/dist/{interpolate-colors.js → cjs/interpolate-colors.js} +2 -2
- package/dist/{loading-indicator.js → cjs/loading-indicator.js} +2 -2
- package/dist/{loop → cjs/loop}/index.d.ts +1 -1
- package/dist/{loop → cjs/loop}/index.js +6 -6
- package/dist/{multiple-versions-warning.js → cjs/multiple-versions-warning.js} +7 -7
- package/dist/{prefetch.js → cjs/prefetch.js} +6 -6
- package/dist/{random.js → cjs/random.js} +1 -0
- package/dist/{series → cjs/series}/index.d.ts +1 -1
- package/dist/{series → cjs/series}/index.js +6 -6
- package/dist/{setup-env-variables.js → cjs/setup-env-variables.js} +3 -3
- package/dist/{spring → cjs/spring}/index.d.ts +3 -3
- package/dist/{spring → cjs/spring}/index.js +12 -8
- package/dist/{spring → cjs/spring}/measure-spring.d.ts +1 -1
- package/dist/{spring → cjs/spring}/measure-spring.js +4 -4
- package/dist/cjs/test/Img.test.d.ts +1 -0
- package/dist/cjs/test/Img.test.js +25 -0
- package/dist/cjs/test/absolute-src.test.d.ts +1 -0
- package/dist/cjs/test/absolute-src.test.js +18 -0
- package/dist/cjs/test/audio-for-rendering.test.d.ts +1 -0
- package/dist/cjs/test/audio-for-rendering.test.js +88 -0
- package/dist/cjs/test/audio.test.d.ts +1 -0
- package/dist/cjs/test/audio.test.js +76 -0
- package/dist/cjs/test/bezier.test.d.ts +1 -0
- package/dist/cjs/test/bezier.test.js +52 -0
- package/dist/cjs/test/composition-rules.test.d.ts +1 -0
- package/dist/cjs/test/composition-rules.test.js +30 -0
- package/dist/cjs/test/composition-validation.test.d.ts +1 -0
- package/dist/cjs/test/composition-validation.test.js +99 -0
- package/dist/cjs/test/easing.test.d.ts +1 -0
- package/dist/cjs/test/easing.test.js +191 -0
- package/dist/cjs/test/expect-to-throw.d.ts +1 -0
- package/dist/cjs/test/expect-to-throw.js +15 -0
- package/dist/cjs/test/freeze.test.d.ts +1 -0
- package/dist/cjs/test/freeze.test.js +65 -0
- package/dist/cjs/test/get-asset-file-name.test.d.ts +1 -0
- package/dist/cjs/test/get-asset-file-name.test.js +14 -0
- package/dist/cjs/test/get-current-time.test.d.ts +1 -0
- package/dist/cjs/test/get-current-time.test.js +74 -0
- package/dist/cjs/test/input-props.test.d.ts +1 -0
- package/dist/cjs/test/input-props.test.js +31 -0
- package/dist/cjs/test/interpolate.test.d.ts +1 -0
- package/dist/cjs/test/interpolate.test.js +138 -0
- package/dist/cjs/test/interpolateColors.test.d.ts +1 -0
- package/dist/cjs/test/interpolateColors.test.js +63 -0
- package/dist/cjs/test/loop-validation.test.d.ts +1 -0
- package/dist/cjs/test/loop-validation.test.js +93 -0
- package/dist/cjs/test/measure-spring.test.d.ts +1 -0
- package/dist/cjs/test/measure-spring.test.js +45 -0
- package/dist/cjs/test/media-validation.test.d.ts +1 -0
- package/dist/cjs/test/media-validation.test.js +47 -0
- package/dist/cjs/test/nested-sequences.test.d.ts +1 -0
- package/dist/cjs/test/nested-sequences.test.js +132 -0
- package/dist/cjs/test/not-all-props-in-media-tags.test.d.ts +1 -0
- package/dist/cjs/test/not-all-props-in-media-tags.test.js +33 -0
- package/dist/cjs/test/random.test.d.ts +1 -0
- package/dist/cjs/test/random.test.js +60 -0
- package/dist/cjs/test/ready-manager.test.d.ts +1 -0
- package/dist/cjs/test/ready-manager.test.js +29 -0
- package/dist/cjs/test/render-hook.d.ts +23 -0
- package/dist/cjs/test/render-hook.js +27 -0
- package/dist/cjs/test/sequence-from-initial-offset.test.d.ts +4 -0
- package/dist/cjs/test/sequence-from-initial-offset.test.js +35 -0
- package/dist/cjs/test/sequence-validation.test.d.ts +1 -0
- package/dist/cjs/test/sequence-validation.test.js +47 -0
- package/dist/cjs/test/series.test.d.ts +1 -0
- package/dist/cjs/test/series.test.js +110 -0
- package/dist/cjs/test/spring.test.d.ts +1 -0
- package/dist/cjs/test/spring.test.js +38 -0
- package/dist/cjs/test/truthy.test.d.ts +1 -0
- package/dist/cjs/test/truthy.test.js +24 -0
- package/dist/cjs/test/use-audio-frame.test.d.ts +1 -0
- package/dist/cjs/test/use-audio-frame.test.js +78 -0
- package/dist/cjs/test/use-media-in-timeline.test.d.ts +1 -0
- package/dist/cjs/test/use-media-in-timeline.test.js +74 -0
- package/dist/cjs/test/use-media-tag-volume.test.d.ts +1 -0
- package/dist/cjs/test/use-media-tag-volume.test.js +49 -0
- package/dist/cjs/test/use-sync-volume-with-media-tag.test.d.ts +1 -0
- package/dist/cjs/test/use-sync-volume-with-media-tag.test.js +55 -0
- package/dist/cjs/test/validate-start-from-props.test.d.ts +1 -0
- package/dist/cjs/test/validate-start-from-props.test.js +39 -0
- package/dist/cjs/test/video.test.d.ts +1 -0
- package/dist/cjs/test/video.test.js +80 -0
- package/dist/cjs/test/volume-prop.test.d.ts +1 -0
- package/dist/cjs/test/volume-prop.test.js +95 -0
- package/dist/cjs/test/wrap-sequence-context.d.ts +6 -0
- package/dist/cjs/test/wrap-sequence-context.js +41 -0
- package/dist/{use-current-frame.js → cjs/use-current-frame.js} +6 -6
- package/dist/{use-lazy-component.d.ts → cjs/use-lazy-component.d.ts} +1 -1
- package/dist/{use-media-in-timeline.d.ts → cjs/use-media-in-timeline.d.ts} +1 -1
- package/dist/{use-media-in-timeline.js → cjs/use-media-in-timeline.js} +21 -21
- package/dist/{use-media-playback.js → cjs/use-media-playback.js} +16 -16
- package/dist/{use-sync-volume-with-media-tag.d.ts → cjs/use-sync-volume-with-media-tag.d.ts} +1 -1
- package/dist/{use-sync-volume-with-media-tag.js → cjs/use-sync-volume-with-media-tag.js} +4 -4
- package/dist/{use-unsafe-video-config.d.ts → cjs/use-unsafe-video-config.d.ts} +1 -1
- package/dist/{use-unsafe-video-config.js → cjs/use-unsafe-video-config.js} +4 -4
- package/dist/{use-video-config.d.ts → cjs/use-video-config.d.ts} +1 -1
- package/dist/{use-video-config.js → cjs/use-video-config.js} +6 -6
- package/dist/{use-video.js → cjs/use-video.js} +2 -2
- package/dist/cjs/validate-frame.d.ts +1 -0
- package/dist/cjs/validate-frame.js +24 -0
- package/dist/{validate-media-props.d.ts → cjs/validate-media-props.d.ts} +1 -1
- package/dist/cjs/version.d.ts +1 -0
- package/dist/{version.js → cjs/version.js} +1 -1
- package/dist/{video → cjs/video}/OffthreadVideo.d.ts +1 -1
- package/dist/cjs/video/OffthreadVideo.js +33 -0
- package/dist/{video → cjs/video}/OffthreadVideoForRendering.d.ts +1 -1
- package/dist/{video → cjs/video}/OffthreadVideoForRendering.js +28 -28
- package/dist/{video → cjs/video}/Video.d.ts +2 -2
- package/dist/{video → cjs/video}/Video.js +16 -16
- package/dist/{video → cjs/video}/VideoForDevelopment.d.ts +1 -1
- package/dist/{video → cjs/video}/VideoForDevelopment.js +22 -22
- package/dist/{video → cjs/video}/VideoForRendering.d.ts +1 -1
- package/dist/{video → cjs/video}/VideoForRendering.js +40 -40
- package/dist/{video → cjs/video}/get-current-time.js +2 -2
- package/dist/{video → cjs/video}/index.d.ts +3 -3
- package/dist/{video → cjs/video}/index.js +4 -4
- package/dist/{video → cjs/video}/props.d.ts +1 -1
- package/dist/cjs/wrap-remotion-context.d.ts +18 -0
- package/dist/{wrap-remotion-context.js → cjs/wrap-remotion-context.js} +16 -16
- package/dist/esm/AbsoluteFill.d.ts +6 -0
- package/dist/esm/AbsoluteFill.js +25 -0
- package/dist/esm/CanUseRemotionHooks.d.ts +5 -0
- package/dist/esm/CanUseRemotionHooks.js +6 -0
- package/dist/esm/Clipper.d.ts +7 -0
- package/dist/esm/Clipper.js +20 -0
- package/dist/esm/Composition.d.ts +23 -0
- package/dist/esm/Composition.js +108 -0
- package/dist/esm/CompositionManager.d.ts +82 -0
- package/dist/esm/CompositionManager.js +137 -0
- package/dist/esm/Folder.d.ts +15 -0
- package/dist/esm/Folder.js +29 -0
- package/dist/esm/IFrame.d.ts +2 -0
- package/dist/esm/IFrame.js +21 -0
- package/dist/esm/Img.d.ts +2 -0
- package/dist/esm/Img.js +49 -0
- package/dist/esm/NativeLayers.d.ts +13 -0
- package/dist/esm/NativeLayers.js +25 -0
- package/dist/esm/Null.d.ts +2 -0
- package/dist/esm/Null.js +21 -0
- package/dist/esm/RemotionRoot.d.ts +5 -0
- package/dist/esm/RemotionRoot.js +69 -0
- package/dist/esm/Sequence.d.ts +29 -0
- package/dist/esm/Sequence.js +128 -0
- package/dist/esm/Still.d.ts +3 -0
- package/dist/esm/Still.js +5 -0
- package/dist/esm/absolute-src.d.ts +1 -0
- package/dist/esm/absolute-src.js +3 -0
- package/dist/esm/asset-types.d.ts +50 -0
- package/dist/esm/asset-types.js +1 -0
- package/dist/esm/audio/Audio.d.ts +8 -0
- package/dist/esm/audio/Audio.js +49 -0
- package/dist/esm/audio/AudioForDevelopment.d.ts +11 -0
- package/dist/esm/audio/AudioForDevelopment.js +91 -0
- package/dist/esm/audio/AudioForRendering.d.ts +10 -0
- package/dist/esm/audio/AudioForRendering.js +108 -0
- package/dist/esm/audio/index.d.ts +2 -0
- package/dist/esm/audio/index.js +2 -0
- package/dist/esm/audio/props.d.ts +12 -0
- package/dist/esm/audio/props.js +1 -0
- package/dist/esm/audio/shared-audio-tags.d.ts +37 -0
- package/dist/esm/audio/shared-audio-tags.js +194 -0
- package/dist/esm/audio/use-audio-frame.d.ts +6 -0
- package/dist/esm/audio/use-audio-frame.js +18 -0
- package/dist/esm/bezier.d.ts +1 -0
- package/dist/esm/bezier.js +110 -0
- package/dist/esm/cancel-render.d.ts +1 -0
- package/dist/esm/cancel-render.js +39 -0
- package/dist/esm/config/input-props.d.ts +1 -0
- package/dist/esm/config/input-props.js +27 -0
- package/dist/esm/config.d.ts +285 -0
- package/dist/esm/config.js +17 -0
- package/dist/esm/default-css.d.ts +3 -0
- package/dist/esm/default-css.js +44 -0
- package/dist/esm/delay-render.d.ts +14 -0
- package/dist/esm/delay-render.js +72 -0
- package/dist/esm/easing.d.ts +19 -0
- package/dist/esm/easing.js +73 -0
- package/dist/esm/freeze.d.ts +7 -0
- package/dist/esm/freeze.js +30 -0
- package/dist/esm/get-asset-file-name.d.ts +1 -0
- package/dist/esm/get-asset-file-name.js +10 -0
- package/dist/esm/get-environment.d.ts +3 -0
- package/dist/esm/get-environment.js +29 -0
- package/dist/esm/get-preview-dom-element.d.ts +1 -0
- package/dist/esm/get-preview-dom-element.js +3 -0
- package/dist/esm/get-static-files.d.ts +17 -0
- package/dist/esm/get-static-files.js +27 -0
- package/dist/esm/get-timeline-clip-name.d.ts +1 -0
- package/dist/esm/get-timeline-clip-name.js +21 -0
- package/dist/esm/index.d.ts +92 -0
- package/dist/esm/index.js +41 -0
- package/dist/esm/internals.d.ts +99 -0
- package/dist/esm/internals.js +75 -0
- package/dist/esm/interpolate-colors.d.ts +5 -0
- package/dist/esm/interpolate-colors.js +397 -0
- package/dist/esm/interpolate.d.ts +18 -0
- package/dist/esm/interpolate.js +119 -0
- package/dist/esm/is-approximately-the-same.d.ts +1 -0
- package/dist/esm/is-approximately-the-same.js +4 -0
- package/dist/esm/is-player.d.ts +3 -0
- package/dist/esm/is-player.js +9 -0
- package/dist/esm/loading-indicator.d.ts +2 -0
- package/dist/esm/loading-indicator.js +31 -0
- package/dist/esm/loop/index.d.ts +9 -0
- package/dist/esm/loop/index.js +25 -0
- package/dist/esm/multiple-versions-warning.d.ts +1 -0
- package/dist/esm/multiple-versions-warning.js +28 -0
- package/dist/esm/nonce.d.ts +7 -0
- package/dist/esm/nonce.js +13 -0
- package/dist/esm/play-and-handle-not-allowed-error.d.ts +2 -0
- package/dist/esm/play-and-handle-not-allowed-error.js +40 -0
- package/dist/esm/portal-node.d.ts +1 -0
- package/dist/esm/portal-node.js +19 -0
- package/dist/esm/prefetch-state.d.ts +8 -0
- package/dist/esm/prefetch-state.js +22 -0
- package/dist/esm/prefetch.d.ts +9 -0
- package/dist/esm/prefetch.js +103 -0
- package/dist/esm/random.d.ts +7 -0
- package/dist/esm/random.js +38 -0
- package/dist/esm/register-root.d.ts +4 -0
- package/dist/esm/register-root.js +27 -0
- package/dist/esm/series/flatten-children.d.ts +2 -0
- package/dist/esm/series/flatten-children.js +12 -0
- package/dist/esm/series/index.d.ts +13 -0
- package/dist/esm/series/index.js +54 -0
- package/dist/esm/setup-env-variables.d.ts +2 -0
- package/dist/esm/setup-env-variables.js +32 -0
- package/dist/esm/spring/index.d.ts +27 -0
- package/dist/esm/spring/index.js +50 -0
- package/dist/esm/spring/measure-spring.d.ts +8 -0
- package/dist/esm/spring/measure-spring.js +60 -0
- package/dist/esm/spring/spring-utils.d.ts +21 -0
- package/dist/esm/spring/spring-utils.js +99 -0
- package/dist/esm/static-file.d.ts +5 -0
- package/dist/esm/static-file.js +29 -0
- package/dist/esm/test/Img.test.d.ts +1 -0
- package/dist/esm/test/Img.test.js +20 -0
- package/dist/esm/test/absolute-src.test.d.ts +1 -0
- package/dist/esm/test/absolute-src.test.js +16 -0
- package/dist/esm/test/audio-for-rendering.test.d.ts +1 -0
- package/dist/esm/test/audio-for-rendering.test.js +83 -0
- package/dist/esm/test/audio.test.d.ts +1 -0
- package/dist/esm/test/audio.test.js +51 -0
- package/dist/esm/test/bezier.test.d.ts +1 -0
- package/dist/esm/test/bezier.test.js +50 -0
- package/dist/esm/test/composition-rules.test.d.ts +1 -0
- package/dist/esm/test/composition-rules.test.js +28 -0
- package/dist/esm/test/composition-validation.test.d.ts +1 -0
- package/dist/esm/test/composition-validation.test.js +97 -0
- package/dist/esm/test/easing.test.d.ts +1 -0
- package/dist/esm/test/easing.test.js +189 -0
- package/dist/esm/test/expect-to-throw.d.ts +1 -0
- package/dist/esm/test/expect-to-throw.js +11 -0
- package/dist/esm/test/freeze.test.d.ts +1 -0
- package/dist/esm/test/freeze.test.js +63 -0
- package/dist/esm/test/get-asset-file-name.test.d.ts +1 -0
- package/dist/esm/test/get-asset-file-name.test.js +12 -0
- package/dist/esm/test/get-current-time.test.d.ts +1 -0
- package/dist/esm/test/get-current-time.test.js +72 -0
- package/dist/esm/test/input-props.test.d.ts +1 -0
- package/dist/esm/test/input-props.test.js +29 -0
- package/dist/esm/test/interpolate.test.d.ts +1 -0
- package/dist/esm/test/interpolate.test.js +136 -0
- package/dist/esm/test/interpolateColors.test.d.ts +1 -0
- package/dist/esm/test/interpolateColors.test.js +61 -0
- package/dist/esm/test/loop-validation.test.d.ts +1 -0
- package/dist/esm/test/loop-validation.test.js +68 -0
- package/dist/esm/test/measure-spring.test.d.ts +1 -0
- package/dist/esm/test/measure-spring.test.js +43 -0
- package/dist/esm/test/media-validation.test.d.ts +1 -0
- package/dist/esm/test/media-validation.test.js +45 -0
- package/dist/esm/test/nested-sequences.test.d.ts +1 -0
- package/dist/esm/test/nested-sequences.test.js +130 -0
- package/dist/esm/test/not-all-props-in-media-tags.test.d.ts +1 -0
- package/dist/esm/test/not-all-props-in-media-tags.test.js +28 -0
- package/dist/esm/test/random.test.d.ts +1 -0
- package/dist/esm/test/random.test.js +58 -0
- package/dist/esm/test/ready-manager.test.d.ts +1 -0
- package/dist/esm/test/ready-manager.test.js +27 -0
- package/dist/esm/test/render-hook.d.ts +23 -0
- package/dist/esm/test/render-hook.js +20 -0
- package/dist/esm/test/sequence-from-initial-offset.test.d.ts +4 -0
- package/dist/esm/test/sequence-from-initial-offset.test.js +33 -0
- package/dist/esm/test/sequence-validation.test.d.ts +1 -0
- package/dist/esm/test/sequence-validation.test.js +45 -0
- package/dist/esm/test/series.test.d.ts +1 -0
- package/dist/esm/test/series.test.js +108 -0
- package/dist/esm/test/spring.test.d.ts +1 -0
- package/dist/esm/test/spring.test.js +36 -0
- package/dist/esm/test/truthy.test.d.ts +1 -0
- package/dist/esm/test/truthy.test.js +22 -0
- package/dist/esm/test/use-audio-frame.test.d.ts +1 -0
- package/dist/esm/test/use-audio-frame.test.js +53 -0
- package/dist/esm/test/use-media-in-timeline.test.d.ts +1 -0
- package/dist/esm/test/use-media-in-timeline.test.js +49 -0
- package/dist/esm/test/use-media-tag-volume.test.d.ts +1 -0
- package/dist/esm/test/use-media-tag-volume.test.js +44 -0
- package/dist/esm/test/use-sync-volume-with-media-tag.test.d.ts +1 -0
- package/dist/esm/test/use-sync-volume-with-media-tag.test.js +53 -0
- package/dist/esm/test/validate-start-from-props.test.d.ts +1 -0
- package/dist/esm/test/validate-start-from-props.test.js +37 -0
- package/dist/esm/test/video.test.d.ts +1 -0
- package/dist/esm/test/video.test.js +55 -0
- package/dist/esm/test/volume-prop.test.d.ts +1 -0
- package/dist/esm/test/volume-prop.test.js +93 -0
- package/dist/esm/test/wrap-sequence-context.d.ts +6 -0
- package/dist/esm/test/wrap-sequence-context.js +37 -0
- package/dist/esm/timeline-position-state.d.ts +29 -0
- package/dist/esm/timeline-position-state.js +35 -0
- package/dist/esm/truthy.d.ts +3 -0
- package/dist/esm/truthy.js +3 -0
- package/dist/esm/use-current-frame.d.ts +6 -0
- package/dist/esm/use-current-frame.js +24 -0
- package/dist/esm/use-lazy-component.d.ts +7 -0
- package/dist/esm/use-lazy-component.js +22 -0
- package/dist/esm/use-media-in-timeline.d.ts +10 -0
- package/dist/esm/use-media-in-timeline.js +125 -0
- package/dist/esm/use-media-playback.d.ts +10 -0
- package/dist/esm/use-media-playback.js +73 -0
- package/dist/esm/use-media-tag-volume.d.ts +2 -0
- package/dist/esm/use-media-tag-volume.js +27 -0
- package/dist/esm/use-sync-volume-with-media-tag.d.ts +10 -0
- package/dist/esm/use-sync-volume-with-media-tag.js +17 -0
- package/dist/esm/use-unsafe-video-config.d.ts +2 -0
- package/dist/esm/use-unsafe-video-config.js +23 -0
- package/dist/esm/use-video-config.d.ts +7 -0
- package/dist/esm/use-video-config.js +25 -0
- package/dist/esm/use-video.d.ts +13 -0
- package/dist/esm/use-video.js +24 -0
- package/dist/esm/validate-frame.d.ts +1 -0
- package/dist/esm/validate-frame.js +20 -0
- package/dist/esm/validate-media-props.d.ts +4 -0
- package/dist/esm/validate-media-props.js +20 -0
- package/dist/esm/validate-start-from-props.d.ts +1 -0
- package/dist/esm/validate-start-from-props.js +27 -0
- package/dist/esm/validation/validate-composition-id.d.ts +3 -0
- package/dist/esm/validation/validate-composition-id.js +8 -0
- package/dist/esm/validation/validate-dimensions.d.ts +1 -0
- package/dist/esm/validation/validate-dimensions.js +17 -0
- package/dist/esm/validation/validate-duration-in-frames.d.ts +1 -0
- package/dist/esm/validation/validate-duration-in-frames.js +11 -0
- package/dist/esm/validation/validate-folder-name.d.ts +3 -0
- package/dist/esm/validation/validate-folder-name.js +14 -0
- package/dist/esm/validation/validate-fps.d.ts +1 -0
- package/dist/esm/validation/validate-fps.js +17 -0
- package/dist/esm/validation/validate-offthreadvideo-image-format.d.ts +1 -0
- package/dist/esm/validation/validate-offthreadvideo-image-format.js +11 -0
- package/dist/esm/validation/validation-spring-duration.d.ts +1 -0
- package/dist/esm/validation/validation-spring-duration.js +17 -0
- package/dist/esm/version.d.ts +1 -0
- package/dist/esm/version.js +2 -0
- package/dist/esm/video/OffthreadVideo.d.ts +3 -0
- package/dist/esm/video/OffthreadVideo.js +29 -0
- package/dist/esm/video/OffthreadVideoForRendering.d.ts +3 -0
- package/dist/esm/video/OffthreadVideoForRendering.js +100 -0
- package/dist/esm/video/Video.d.ts +8 -0
- package/dist/esm/video/Video.js +47 -0
- package/dist/esm/video/VideoForDevelopment.d.ts +11 -0
- package/dist/esm/video/VideoForDevelopment.js +110 -0
- package/dist/esm/video/VideoForRendering.d.ts +10 -0
- package/dist/esm/video/VideoForRendering.js +200 -0
- package/dist/esm/video/duration-state.d.ts +17 -0
- package/dist/esm/video/duration-state.js +29 -0
- package/dist/esm/video/get-current-time.d.ts +13 -0
- package/dist/esm/video/get-current-time.js +26 -0
- package/dist/esm/video/index.d.ts +3 -0
- package/dist/esm/video/index.js +2 -0
- package/dist/esm/video/props.d.ts +25 -0
- package/dist/esm/video/props.js +1 -0
- package/dist/esm/video/video-fragment.d.ts +12 -0
- package/dist/esm/video/video-fragment.js +55 -0
- package/dist/esm/video-config.d.ts +8 -0
- package/dist/esm/video-config.js +1 -0
- package/dist/esm/volume-position-state.d.ts +19 -0
- package/dist/esm/volume-position-state.js +27 -0
- package/dist/esm/volume-prop.d.ts +7 -0
- package/dist/esm/volume-prop.js +20 -0
- package/dist/esm/warn-about-non-seekable-media.d.ts +1 -0
- package/dist/esm/warn-about-non-seekable-media.js +30 -0
- package/dist/esm/wrap-remotion-context.d.ts +18 -0
- package/dist/esm/wrap-remotion-context.js +45 -0
- package/dist/tsconfig-cjs.tsbuildinfo +1 -0
- package/package.json +22 -11
- package/tsconfig-cjs.json +11 -0
- package/tsconfig.json +3 -3
- package/dist/LayerMaster.d.ts +0 -8
- package/dist/LayerMaster.js +0 -39
- package/dist/Satori.d.ts +0 -5
- package/dist/Satori.js +0 -92
- package/dist/audio/index.d.ts +0 -2
- package/dist/config.d.ts +0 -291
- package/dist/get-compositions-from-markup.d.ts +0 -3
- package/dist/get-compositions-from-markup.js +0 -19
- package/dist/internals.js +0 -99
- package/dist/layers.d.ts +0 -24
- package/dist/layers.js +0 -149
- package/dist/version.d.ts +0 -1
- package/dist/video/NativeVideo.d.ts +0 -5
- package/dist/video/NativeVideo.js +0 -33
- package/dist/video/NativeVideoForRendering.d.ts +0 -8
- package/dist/video/NativeVideoForRendering.js +0 -14
- package/dist/video/OffthreadVideo.js +0 -33
- package/dist/wrap-remotion-context.d.ts +0 -18
- /package/dist/{AbsoluteFill.d.ts → cjs/AbsoluteFill.d.ts} +0 -0
- /package/dist/{AbsoluteFill.js → cjs/AbsoluteFill.js} +0 -0
- /package/dist/{CanUseRemotionHooks.d.ts → cjs/CanUseRemotionHooks.d.ts} +0 -0
- /package/dist/{CanUseRemotionHooks.js → cjs/CanUseRemotionHooks.js} +0 -0
- /package/dist/{Clipper.d.ts → cjs/Clipper.d.ts} +0 -0
- /package/dist/{Composition.d.ts → cjs/Composition.d.ts} +0 -0
- /package/dist/{Folder.d.ts → cjs/Folder.d.ts} +0 -0
- /package/dist/{IFrame.d.ts → cjs/IFrame.d.ts} +0 -0
- /package/dist/{Img.d.ts → cjs/Img.d.ts} +0 -0
- /package/dist/{NativeLayers.d.ts → cjs/NativeLayers.d.ts} +0 -0
- /package/dist/{NativeLayers.js → cjs/NativeLayers.js} +0 -0
- /package/dist/{Null.d.ts → cjs/Null.d.ts} +0 -0
- /package/dist/{RemotionRoot.d.ts → cjs/RemotionRoot.d.ts} +0 -0
- /package/dist/{absolute-src.d.ts → cjs/absolute-src.d.ts} +0 -0
- /package/dist/{absolute-src.js → cjs/absolute-src.js} +0 -0
- /package/dist/{asset-types.d.ts → cjs/asset-types.d.ts} +0 -0
- /package/dist/{asset-types.js → cjs/asset-types.js} +0 -0
- /package/dist/{audio → cjs/audio}/props.js +0 -0
- /package/dist/{audio → cjs/audio}/shared-audio-tags.js +0 -0
- /package/dist/{audio → cjs/audio}/use-audio-frame.d.ts +0 -0
- /package/dist/{bezier.d.ts → cjs/bezier.d.ts} +0 -0
- /package/dist/{bezier.js → cjs/bezier.js} +0 -0
- /package/dist/{cancel-render.d.ts → cjs/cancel-render.d.ts} +0 -0
- /package/dist/{cancel-render.js → cjs/cancel-render.js} +0 -0
- /package/dist/{config → cjs/config}/input-props.d.ts +0 -0
- /package/dist/{config.js → cjs/config.js} +0 -0
- /package/dist/{default-css.d.ts → cjs/default-css.d.ts} +0 -0
- /package/dist/{default-css.js → cjs/default-css.js} +0 -0
- /package/dist/{delay-render.d.ts → cjs/delay-render.d.ts} +0 -0
- /package/dist/{easing.d.ts → cjs/easing.d.ts} +0 -0
- /package/dist/{freeze.d.ts → cjs/freeze.d.ts} +0 -0
- /package/dist/{get-asset-file-name.d.ts → cjs/get-asset-file-name.d.ts} +0 -0
- /package/dist/{get-asset-file-name.js → cjs/get-asset-file-name.js} +0 -0
- /package/dist/{get-environment.d.ts → cjs/get-environment.d.ts} +0 -0
- /package/dist/{get-preview-dom-element.d.ts → cjs/get-preview-dom-element.d.ts} +0 -0
- /package/dist/{get-preview-dom-element.js → cjs/get-preview-dom-element.js} +0 -0
- /package/dist/{get-static-files.d.ts → cjs/get-static-files.d.ts} +0 -0
- /package/dist/{get-static-files.js → cjs/get-static-files.js} +0 -0
- /package/dist/{get-timeline-clip-name.d.ts → cjs/get-timeline-clip-name.d.ts} +0 -0
- /package/dist/{get-timeline-clip-name.js → cjs/get-timeline-clip-name.js} +0 -0
- /package/dist/{interpolate-colors.d.ts → cjs/interpolate-colors.d.ts} +0 -0
- /package/dist/{interpolate.d.ts → cjs/interpolate.d.ts} +0 -0
- /package/dist/{interpolate.js → cjs/interpolate.js} +0 -0
- /package/dist/{is-approximately-the-same.d.ts → cjs/is-approximately-the-same.d.ts} +0 -0
- /package/dist/{is-approximately-the-same.js → cjs/is-approximately-the-same.js} +0 -0
- /package/dist/{is-player.d.ts → cjs/is-player.d.ts} +0 -0
- /package/dist/{is-player.js → cjs/is-player.js} +0 -0
- /package/dist/{loading-indicator.d.ts → cjs/loading-indicator.d.ts} +0 -0
- /package/dist/{multiple-versions-warning.d.ts → cjs/multiple-versions-warning.d.ts} +0 -0
- /package/dist/{nonce.d.ts → cjs/nonce.d.ts} +0 -0
- /package/dist/{nonce.js → cjs/nonce.js} +0 -0
- /package/dist/{play-and-handle-not-allowed-error.d.ts → cjs/play-and-handle-not-allowed-error.d.ts} +0 -0
- /package/dist/{play-and-handle-not-allowed-error.js → cjs/play-and-handle-not-allowed-error.js} +0 -0
- /package/dist/{portal-node.d.ts → cjs/portal-node.d.ts} +0 -0
- /package/dist/{portal-node.js → cjs/portal-node.js} +0 -0
- /package/dist/{prefetch-state.d.ts → cjs/prefetch-state.d.ts} +0 -0
- /package/dist/{prefetch-state.js → cjs/prefetch-state.js} +0 -0
- /package/dist/{prefetch.d.ts → cjs/prefetch.d.ts} +0 -0
- /package/dist/{random.d.ts → cjs/random.d.ts} +0 -0
- /package/dist/{register-root.d.ts → cjs/register-root.d.ts} +0 -0
- /package/dist/{register-root.js → cjs/register-root.js} +0 -0
- /package/dist/{series → cjs/series}/flatten-children.d.ts +0 -0
- /package/dist/{series → cjs/series}/flatten-children.js +0 -0
- /package/dist/{setup-env-variables.d.ts → cjs/setup-env-variables.d.ts} +0 -0
- /package/dist/{spring → cjs/spring}/spring-utils.d.ts +0 -0
- /package/dist/{spring → cjs/spring}/spring-utils.js +0 -0
- /package/dist/{static-file.d.ts → cjs/static-file.d.ts} +0 -0
- /package/dist/{static-file.js → cjs/static-file.js} +0 -0
- /package/dist/{timeline-position-state.d.ts → cjs/timeline-position-state.d.ts} +0 -0
- /package/dist/{timeline-position-state.js → cjs/timeline-position-state.js} +0 -0
- /package/dist/{truthy.d.ts → cjs/truthy.d.ts} +0 -0
- /package/dist/{truthy.js → cjs/truthy.js} +0 -0
- /package/dist/{use-current-frame.d.ts → cjs/use-current-frame.d.ts} +0 -0
- /package/dist/{use-lazy-component.js → cjs/use-lazy-component.js} +0 -0
- /package/dist/{use-media-playback.d.ts → cjs/use-media-playback.d.ts} +0 -0
- /package/dist/{use-media-tag-volume.d.ts → cjs/use-media-tag-volume.d.ts} +0 -0
- /package/dist/{use-media-tag-volume.js → cjs/use-media-tag-volume.js} +0 -0
- /package/dist/{use-video.d.ts → cjs/use-video.d.ts} +0 -0
- /package/dist/{validate-media-props.js → cjs/validate-media-props.js} +0 -0
- /package/dist/{validate-start-from-props.d.ts → cjs/validate-start-from-props.d.ts} +0 -0
- /package/dist/{validate-start-from-props.js → cjs/validate-start-from-props.js} +0 -0
- /package/dist/{validation → cjs/validation}/validate-composition-id.d.ts +0 -0
- /package/dist/{validation → cjs/validation}/validate-composition-id.js +0 -0
- /package/dist/{validation → cjs/validation}/validate-dimensions.d.ts +0 -0
- /package/dist/{validation → cjs/validation}/validate-dimensions.js +0 -0
- /package/dist/{validation → cjs/validation}/validate-duration-in-frames.d.ts +0 -0
- /package/dist/{validation → cjs/validation}/validate-duration-in-frames.js +0 -0
- /package/dist/{validation → cjs/validation}/validate-folder-name.d.ts +0 -0
- /package/dist/{validation → cjs/validation}/validate-folder-name.js +0 -0
- /package/dist/{validation → cjs/validation}/validate-fps.d.ts +0 -0
- /package/dist/{validation → cjs/validation}/validate-fps.js +0 -0
- /package/dist/{validation → cjs/validation}/validate-offthreadvideo-image-format.d.ts +0 -0
- /package/dist/{validation → cjs/validation}/validate-offthreadvideo-image-format.js +0 -0
- /package/dist/{validation → cjs/validation}/validation-spring-duration.d.ts +0 -0
- /package/dist/{validation → cjs/validation}/validation-spring-duration.js +0 -0
- /package/dist/{video → cjs/video}/duration-state.d.ts +0 -0
- /package/dist/{video → cjs/video}/duration-state.js +0 -0
- /package/dist/{video → cjs/video}/get-current-time.d.ts +0 -0
- /package/dist/{video → cjs/video}/props.js +0 -0
- /package/dist/{video → cjs/video}/video-fragment.d.ts +0 -0
- /package/dist/{video → cjs/video}/video-fragment.js +0 -0
- /package/dist/{video-config.d.ts → cjs/video-config.d.ts} +0 -0
- /package/dist/{video-config.js → cjs/video-config.js} +0 -0
- /package/dist/{volume-position-state.d.ts → cjs/volume-position-state.d.ts} +0 -0
- /package/dist/{volume-position-state.js → cjs/volume-position-state.js} +0 -0
- /package/dist/{volume-prop.d.ts → cjs/volume-prop.d.ts} +0 -0
- /package/dist/{volume-prop.js → cjs/volume-prop.js} +0 -0
- /package/dist/{warn-about-non-seekable-media.d.ts → cjs/warn-about-non-seekable-media.d.ts} +0 -0
- /package/dist/{warn-about-non-seekable-media.js → cjs/warn-about-non-seekable-media.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { measureSpring, spring } from '../spring';
|
|
3
|
+
import { expectToThrow } from './expect-to-throw.js';
|
|
4
|
+
describe('Measure spring should work', () => {
|
|
5
|
+
const duration = measureSpring({
|
|
6
|
+
fps: 30,
|
|
7
|
+
});
|
|
8
|
+
test('test measureSpring()', () => expect(duration).toBe(28));
|
|
9
|
+
test('spring should be close to 1', () => expect(spring({
|
|
10
|
+
fps: 30,
|
|
11
|
+
frame: duration,
|
|
12
|
+
})).toBeCloseTo(1));
|
|
13
|
+
test('spring should not be 1', () => expect(spring({
|
|
14
|
+
fps: 30,
|
|
15
|
+
frame: duration - 1,
|
|
16
|
+
})).not.toBe(1));
|
|
17
|
+
});
|
|
18
|
+
test('Higher threshold should lead to faster spring', () => {
|
|
19
|
+
expect(measureSpring({ fps: 30, threshold: 0.05 })).toBeLessThan(measureSpring({ fps: 30, threshold: 0.01 }));
|
|
20
|
+
});
|
|
21
|
+
test('Lower threshold should lead to slower spring', () => {
|
|
22
|
+
expect(measureSpring({ fps: 30, threshold: 0.001 })).toBeGreaterThan(measureSpring({ fps: 30, threshold: 0.01 }));
|
|
23
|
+
});
|
|
24
|
+
describe('Threshold edge cases', () => {
|
|
25
|
+
// threshold, expected
|
|
26
|
+
const validEdgeCases = [
|
|
27
|
+
[0, Infinity],
|
|
28
|
+
[1, 0],
|
|
29
|
+
];
|
|
30
|
+
validEdgeCases.forEach((entry) => test('', () => expect(measureSpring({ fps: 30, threshold: entry[0] })).toBe(entry[1])));
|
|
31
|
+
// threshold, errMsg
|
|
32
|
+
const errorEdgeCases = [
|
|
33
|
+
[NaN, /Threshold is NaN/],
|
|
34
|
+
[Infinity, /Threshold is not finite/],
|
|
35
|
+
[null, /threshold must be a number, got null of type object/],
|
|
36
|
+
];
|
|
37
|
+
errorEdgeCases.forEach((entry) => expectToThrow(
|
|
38
|
+
// @ts-expect-error
|
|
39
|
+
() => measureSpring({ fps: 30, threshold: entry[0] }), entry[1]));
|
|
40
|
+
});
|
|
41
|
+
test('Should throw on invalid FPS', () => {
|
|
42
|
+
expectToThrow(() => measureSpring({ fps: 0 }), /"fps" must be positive, but got 0./);
|
|
43
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { validateMediaProps } from '../validate-media-props.js';
|
|
3
|
+
import { expectToThrow } from './expect-to-throw.js';
|
|
4
|
+
describe('ValidateMediaProps should throw with invalid volume inputs', () => {
|
|
5
|
+
const testComponents = ['Audio', 'Video'];
|
|
6
|
+
testComponents.forEach((component) => {
|
|
7
|
+
test(`It should not allow an ${component} element to have a negative volume `, () => {
|
|
8
|
+
expectToThrow(
|
|
9
|
+
// @ts-expect-error
|
|
10
|
+
() => validateMediaProps({ volume: -1 }, component), new RegExp(`You have passed a volume below 0 to your <${component} /> component. Volume must be between 0 and 1`));
|
|
11
|
+
});
|
|
12
|
+
test(`It should not allow an ${component} element to have an invalid type`, () => {
|
|
13
|
+
expectToThrow(
|
|
14
|
+
// @ts-expect-error
|
|
15
|
+
() => validateMediaProps({ volume: 'invalidType' }, component), new RegExp(`You have passed a volume of type string to your <${component} /> component.`));
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
describe('ValidateMediaProps should not throw with valid volume inputs', () => {
|
|
20
|
+
const validInputs = [
|
|
21
|
+
0,
|
|
22
|
+
1,
|
|
23
|
+
undefined,
|
|
24
|
+
() => 1,
|
|
25
|
+
(x) => x,
|
|
26
|
+
];
|
|
27
|
+
validInputs.forEach((vol) => test(`valid volume ${vol} shold not throw`, () => {
|
|
28
|
+
// @ts-expect-error
|
|
29
|
+
expect(() => validateMediaProps({ volume: vol }, 'Video')).not.toThrow();
|
|
30
|
+
}));
|
|
31
|
+
});
|
|
32
|
+
describe('ValidateMediaProps should throw with invalid playbackRate', () => {
|
|
33
|
+
test(`It should not allow playbackRate of 0 or below.`, () => {
|
|
34
|
+
expectToThrow(() => validateMediaProps({ playbackRate: -1 }, 'Audio'), /You have passed a playbackRate of -1 to your <Audio \/> component. Playback rate must be a real number above 0./);
|
|
35
|
+
});
|
|
36
|
+
test(`It should not allow non-finite playbackRate.`, () => {
|
|
37
|
+
expectToThrow(() => validateMediaProps({ playbackRate: Infinity }, 'Audio'), /You have passed a playbackRate of Infinity to your <Audio \/> component. Playback rate must be a real number above 0./);
|
|
38
|
+
});
|
|
39
|
+
test(`It should not allow NaN playbackRate.`, () => {
|
|
40
|
+
expectToThrow(() => validateMediaProps({ playbackRate: NaN }, 'Audio'), /You have passed a playbackRate of NaN to your <Audio \/> component. Playback rate must be a real number above 0./);
|
|
41
|
+
});
|
|
42
|
+
test(`It should not allow regular playbackrate.`, () => {
|
|
43
|
+
expect(() => validateMediaProps({ playbackRate: 1 }, 'Audio')).not.toThrow();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @vitest-environment jsdom
|
|
4
|
+
*/
|
|
5
|
+
/* eslint-disable react/jsx-no-constructed-context-values */
|
|
6
|
+
import { render } from '@testing-library/react';
|
|
7
|
+
import { expect, test } from 'vitest';
|
|
8
|
+
import { CanUseRemotionHooksProvider } from '../CanUseRemotionHooks.js';
|
|
9
|
+
import { Sequence } from '../Sequence.js';
|
|
10
|
+
import { TimelineContext } from '../timeline-position-state.js';
|
|
11
|
+
import { useCurrentFrame } from '../use-current-frame.js';
|
|
12
|
+
import { WrapSequenceContext } from './wrap-sequence-context.js';
|
|
13
|
+
test('It should calculate the correct offset in nested sequences', () => {
|
|
14
|
+
const NestedChild = () => {
|
|
15
|
+
const frame = useCurrentFrame();
|
|
16
|
+
return _jsx("div", { children: 'frame' + frame });
|
|
17
|
+
};
|
|
18
|
+
const Child = () => {
|
|
19
|
+
return (_jsx(Sequence, { from: 10, durationInFrames: 50, children: _jsx(Child2, {}) }));
|
|
20
|
+
};
|
|
21
|
+
const Child2 = () => {
|
|
22
|
+
return (_jsx(Sequence, { from: 1, durationInFrames: 50, children: _jsx(NestedChild, {}) }));
|
|
23
|
+
};
|
|
24
|
+
const { queryByText } = render(_jsx(WrapSequenceContext, { children: _jsx(TimelineContext.Provider, { value: {
|
|
25
|
+
rootId: 'hi',
|
|
26
|
+
frame: 40,
|
|
27
|
+
playing: false,
|
|
28
|
+
imperativePlaying: {
|
|
29
|
+
current: false,
|
|
30
|
+
},
|
|
31
|
+
playbackRate: 1,
|
|
32
|
+
setPlaybackRate: () => {
|
|
33
|
+
throw new Error('playback rate');
|
|
34
|
+
},
|
|
35
|
+
audioAndVideoTags: {
|
|
36
|
+
current: [],
|
|
37
|
+
},
|
|
38
|
+
}, children: _jsx(Sequence, { from: 20, durationInFrames: 100, children: _jsx(Child, {}) }) }) }));
|
|
39
|
+
expect(queryByText(/^frame9$/i)).not.toBe(null);
|
|
40
|
+
});
|
|
41
|
+
test('Negative offset test', () => {
|
|
42
|
+
const NestedChild = () => {
|
|
43
|
+
const frame = useCurrentFrame();
|
|
44
|
+
return _jsx("div", { children: 'frame' + frame });
|
|
45
|
+
};
|
|
46
|
+
const { queryByText } = render(_jsx(WrapSequenceContext, { children: _jsx(TimelineContext.Provider, { value: {
|
|
47
|
+
frame: 40,
|
|
48
|
+
playing: false,
|
|
49
|
+
rootId: 'hi',
|
|
50
|
+
imperativePlaying: {
|
|
51
|
+
current: false,
|
|
52
|
+
},
|
|
53
|
+
playbackRate: 1,
|
|
54
|
+
setPlaybackRate: () => {
|
|
55
|
+
throw new Error('playback rate');
|
|
56
|
+
},
|
|
57
|
+
audioAndVideoTags: {
|
|
58
|
+
current: [],
|
|
59
|
+
},
|
|
60
|
+
}, children: _jsx(Sequence, { from: -200, durationInFrames: 300, children: _jsx(Sequence, { from: 10, durationInFrames: 300, children: _jsx(Sequence, { from: 10, durationInFrames: 300, children: _jsx(NestedChild, {}) }) }) }) }) }));
|
|
61
|
+
const result = queryByText(/^frame220/i);
|
|
62
|
+
expect(result).not.toBe(null);
|
|
63
|
+
});
|
|
64
|
+
test('Nested negative offset test', () => {
|
|
65
|
+
const NestedChild = () => {
|
|
66
|
+
const frame = useCurrentFrame();
|
|
67
|
+
return _jsx("div", { children: 'frame' + frame });
|
|
68
|
+
};
|
|
69
|
+
const startFrom = 40;
|
|
70
|
+
const endAt = 90;
|
|
71
|
+
const content = (_jsx(WrapSequenceContext, { children: _jsx(Sequence, { from: 0 - startFrom, durationInFrames: endAt, children: _jsx(NestedChild, {}) }) }));
|
|
72
|
+
const getForFrame = (frame) => {
|
|
73
|
+
const { queryByText } = render(_jsx(WrapSequenceContext, { children: _jsx(TimelineContext.Provider, { value: {
|
|
74
|
+
frame,
|
|
75
|
+
playing: false,
|
|
76
|
+
rootId: 'hi',
|
|
77
|
+
imperativePlaying: {
|
|
78
|
+
current: false,
|
|
79
|
+
},
|
|
80
|
+
playbackRate: 1,
|
|
81
|
+
setPlaybackRate: () => {
|
|
82
|
+
throw new Error('playback rate');
|
|
83
|
+
},
|
|
84
|
+
audioAndVideoTags: {
|
|
85
|
+
current: [],
|
|
86
|
+
},
|
|
87
|
+
}, children: content }) }));
|
|
88
|
+
return queryByText;
|
|
89
|
+
};
|
|
90
|
+
const frame0 = getForFrame(0);
|
|
91
|
+
expect(frame0(/^frame40$/i)).not.toBe(null);
|
|
92
|
+
const frame39 = getForFrame(39);
|
|
93
|
+
expect(frame39(/^frame79$/i)).not.toBe(null);
|
|
94
|
+
const frame50 = getForFrame(50);
|
|
95
|
+
expect(frame50(/^frame90$/i)).toBe(null);
|
|
96
|
+
});
|
|
97
|
+
test.skip('Negative offset edge case', () => {
|
|
98
|
+
const NestedChild = () => {
|
|
99
|
+
const frame = useCurrentFrame();
|
|
100
|
+
return _jsx("div", { children: 'frame' + frame });
|
|
101
|
+
};
|
|
102
|
+
const startFrom = 40;
|
|
103
|
+
const endAt = 90;
|
|
104
|
+
const content = (_jsx(WrapSequenceContext, { children: _jsx(Sequence, { from: 40, children: _jsx(Sequence, { from: 0 - startFrom, durationInFrames: endAt, children: _jsx(NestedChild, {}) }) }) }));
|
|
105
|
+
const getForFrame = (frame) => {
|
|
106
|
+
const { queryByText } = render(_jsx(CanUseRemotionHooksProvider, { children: _jsx(TimelineContext.Provider, { value: {
|
|
107
|
+
frame,
|
|
108
|
+
playing: false,
|
|
109
|
+
rootId: 'hi',
|
|
110
|
+
imperativePlaying: {
|
|
111
|
+
current: false,
|
|
112
|
+
},
|
|
113
|
+
playbackRate: 1,
|
|
114
|
+
setPlaybackRate: () => {
|
|
115
|
+
throw new Error('playback rate');
|
|
116
|
+
},
|
|
117
|
+
audioAndVideoTags: {
|
|
118
|
+
current: [],
|
|
119
|
+
},
|
|
120
|
+
}, children: content }) }));
|
|
121
|
+
return queryByText;
|
|
122
|
+
};
|
|
123
|
+
expect(getForFrame(0)(/^frame0/i)).toBe(null);
|
|
124
|
+
expect(getForFrame(10)(/^frame10/i)).toBe(null);
|
|
125
|
+
expect(getForFrame(40)(/^frame40$/i)).not.toBe(null);
|
|
126
|
+
const atFrame80 = getForFrame(80)(/^frame80$/i);
|
|
127
|
+
expect(atFrame80).not.toBe(null);
|
|
128
|
+
const atFrame90 = getForFrame(90)(/^frame90$/i);
|
|
129
|
+
expect(atFrame90).toBe(null);
|
|
130
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { expect, test } from 'vitest';
|
|
4
|
+
// Test for https://github.com/remotion-dev/remotion/issues/1243
|
|
5
|
+
test('Should not have disableRemotePlayback props in the <VideoForDevelopment> component type definition', () => {
|
|
6
|
+
const file = path.resolve(process.cwd(), 'dist', 'esm', 'video', 'VideoForDevelopment.d.ts');
|
|
7
|
+
const read = fs.readFileSync(file, 'utf-8');
|
|
8
|
+
expect(read).not.toContain('disableRemotePlayback');
|
|
9
|
+
expect(read).toContain('volume-prop');
|
|
10
|
+
});
|
|
11
|
+
test('Should not have disableRemotePlayback props in the <VideoForRendering> component type definition', () => {
|
|
12
|
+
const file = path.resolve(process.cwd(), 'dist', 'esm', 'video', 'VideoForRendering.d.ts');
|
|
13
|
+
const read = fs.readFileSync(file, 'utf-8');
|
|
14
|
+
expect(read).not.toContain('disableRemotePlayback');
|
|
15
|
+
expect(read).toContain('volume-prop');
|
|
16
|
+
});
|
|
17
|
+
test('Should not have disableRemotePlayback props in the <AudioForDevelopment> component type definition', () => {
|
|
18
|
+
const file = path.resolve(process.cwd(), 'dist', 'esm', 'audio', 'AudioForDevelopment.d.ts');
|
|
19
|
+
const read = fs.readFileSync(file, 'utf-8');
|
|
20
|
+
expect(read).not.toContain('aria-disabled');
|
|
21
|
+
expect(read).toContain('volume-prop');
|
|
22
|
+
});
|
|
23
|
+
test('Should not have disableRemotePlayback props in the <AudioForRendering> component type definition', () => {
|
|
24
|
+
const file = path.resolve(process.cwd(), 'dist', 'esm', 'audio', 'AudioForRendering.d.ts');
|
|
25
|
+
const read = fs.readFileSync(file, 'utf-8');
|
|
26
|
+
expect(read).not.toContain('aria-disabled');
|
|
27
|
+
expect(read).toContain('volume-prop');
|
|
28
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { random } from '../random.js';
|
|
3
|
+
describe('Should support negative random numbers', () => {
|
|
4
|
+
test('test with -1', () => expect(random(-1)).toBe(random(-1)));
|
|
5
|
+
test('test with -2', () => expect(random(-2)).toBe(random(-2)));
|
|
6
|
+
test('different seeds should be different randoms', () => expect(random(-2)).not.toBe(random(-1)));
|
|
7
|
+
});
|
|
8
|
+
test('Random should be deterministic', () => {
|
|
9
|
+
expect(random(1)).toBe(random(1));
|
|
10
|
+
expect(random(2)).toBe(random(2));
|
|
11
|
+
expect(random(2)).not.toBe(random(1));
|
|
12
|
+
expect(random(null)).not.toBe(random(null));
|
|
13
|
+
});
|
|
14
|
+
describe('Random should be uniform', () => {
|
|
15
|
+
const ITEM_COUNT = 100000;
|
|
16
|
+
const mapped = new Array(ITEM_COUNT).fill(true).map((_a, i) => {
|
|
17
|
+
return random(i);
|
|
18
|
+
});
|
|
19
|
+
const average = mapped.reduce((a, b) => a + b, 0) / mapped.length;
|
|
20
|
+
test('test if average is around 0.5', () => {
|
|
21
|
+
expect(average).toBeLessThan(0.51);
|
|
22
|
+
expect(average).toBeGreaterThan(0.49);
|
|
23
|
+
});
|
|
24
|
+
const tenPercentSections = [];
|
|
25
|
+
const stepInterval = 0.1;
|
|
26
|
+
let currentStep = 0;
|
|
27
|
+
while (currentStep < 0.999999) {
|
|
28
|
+
const items = mapped.filter((m) => m >= currentStep && m <= currentStep + stepInterval);
|
|
29
|
+
tenPercentSections.push(items);
|
|
30
|
+
currentStep += stepInterval;
|
|
31
|
+
}
|
|
32
|
+
const ACCURACY = 0.005;
|
|
33
|
+
tenPercentSections.forEach((entries, index) => test(`section ${index} should contain around ${ITEM_COUNT * stepInterval} entries`, () => {
|
|
34
|
+
expect(entries.length).toBeLessThan(ITEM_COUNT * (stepInterval + ACCURACY));
|
|
35
|
+
expect(entries.length).toBeGreaterThan(ITEM_COUNT * (stepInterval - ACCURACY));
|
|
36
|
+
}));
|
|
37
|
+
test('test for average distance', () => {
|
|
38
|
+
const distances = mapped
|
|
39
|
+
.map((_a, i) => {
|
|
40
|
+
if (i === 0) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return Math.abs(mapped[i] - mapped[i - 1]);
|
|
44
|
+
})
|
|
45
|
+
.filter((f) => f !== null);
|
|
46
|
+
const averageDistance = distances.reduce((a, b) => a + b, 0) / distances.length;
|
|
47
|
+
expect(averageDistance).toBeGreaterThan(0.3);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
test('Random string should be uniform', () => {
|
|
51
|
+
const alphabet = 'abcdefghijlkmnopqrstuvwxyz0123456789';
|
|
52
|
+
const array = new Array(alphabet.length)
|
|
53
|
+
.fill(true)
|
|
54
|
+
.map((_, i) => random(alphabet[i]));
|
|
55
|
+
const average = array.reduce((a, b) => a + b, 0) / array.length;
|
|
56
|
+
expect(average).toBeLessThan(0.55);
|
|
57
|
+
expect(average).toBeGreaterThan(0.45);
|
|
58
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vitest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
import { describe, expect, test } from 'vitest';
|
|
5
|
+
import { continueRender, delayRender } from '../delay-render.js';
|
|
6
|
+
describe('Ready Manager tests', () => {
|
|
7
|
+
let handle;
|
|
8
|
+
test('delayRender sets window.ready to false', () => {
|
|
9
|
+
window.ready = true;
|
|
10
|
+
handle = delayRender();
|
|
11
|
+
expect(typeof handle).toBe('number');
|
|
12
|
+
expect(window.ready).toBe(false);
|
|
13
|
+
});
|
|
14
|
+
test('continueRender sets window.ready to true', () => {
|
|
15
|
+
continueRender(handle);
|
|
16
|
+
expect(window.ready).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
test('Render is only continued if all handles have been finished', () => {
|
|
19
|
+
handle = delayRender();
|
|
20
|
+
const handle2 = delayRender();
|
|
21
|
+
expect(window.ready).toBe(false);
|
|
22
|
+
continueRender(handle);
|
|
23
|
+
expect(window.ready).toBe(false);
|
|
24
|
+
continueRender(handle2);
|
|
25
|
+
expect(window.ready).toBe(true);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface RenderHookOptions<Props> {
|
|
3
|
+
/**
|
|
4
|
+
* The argument passed to the renderHook callback. Can be useful if you plan
|
|
5
|
+
* to use the rerender utility to change the values passed to your hook.
|
|
6
|
+
*/
|
|
7
|
+
initialProps?: Props;
|
|
8
|
+
/**
|
|
9
|
+
* Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating
|
|
10
|
+
* reusable custom render functions for common data providers. See setup for examples.
|
|
11
|
+
*
|
|
12
|
+
* @see https://testing-library.com/docs/react-testing-library/api/#wrapper
|
|
13
|
+
*/
|
|
14
|
+
wrapper?: React.JSXElementConstructor<{
|
|
15
|
+
children: React.ReactElement;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
export declare function renderHook<Result, Props>(renderCallback: (initialProps: Props) => Result, options?: RenderHookOptions<Props>): {
|
|
19
|
+
result: React.RefObject<unknown>;
|
|
20
|
+
rerender: (rerenderCallbackProps: Props) => void;
|
|
21
|
+
unmount: () => void;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export function renderHook(renderCallback, options = {}) {
|
|
5
|
+
const { initialProps, wrapper } = options;
|
|
6
|
+
const result = React.createRef();
|
|
7
|
+
const TestComponent = ({ renderCallbackProps, }) => {
|
|
8
|
+
const pendingResult = renderCallback(renderCallbackProps);
|
|
9
|
+
React.useEffect(() => {
|
|
10
|
+
// @ts-expect-error
|
|
11
|
+
result.current = pendingResult;
|
|
12
|
+
});
|
|
13
|
+
return null;
|
|
14
|
+
};
|
|
15
|
+
const { rerender: baseRerender, unmount } = render(_jsx(TestComponent, { renderCallbackProps: initialProps }), { wrapper });
|
|
16
|
+
function rerender(rerenderCallbackProps) {
|
|
17
|
+
return baseRerender(_jsx(TestComponent, { renderCallbackProps: rerenderCallbackProps }));
|
|
18
|
+
}
|
|
19
|
+
return { result, rerender, unmount };
|
|
20
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @vitest-environment jsdom
|
|
4
|
+
*/
|
|
5
|
+
import { render } from '@testing-library/react';
|
|
6
|
+
import { describe, expect, test } from 'vitest';
|
|
7
|
+
import { CanUseRemotionHooksProvider } from '../CanUseRemotionHooks.js';
|
|
8
|
+
import { Freeze } from '../freeze.js';
|
|
9
|
+
import { Internals } from '../internals.js';
|
|
10
|
+
import { Sequence } from '../Sequence.js';
|
|
11
|
+
import { useVideoConfig } from '../use-video-config.js';
|
|
12
|
+
import { WrapSequenceContext } from './wrap-sequence-context.js';
|
|
13
|
+
const Inner = () => {
|
|
14
|
+
const config = useVideoConfig();
|
|
15
|
+
return _jsx("div", { children: config.durationInFrames });
|
|
16
|
+
};
|
|
17
|
+
const context = {
|
|
18
|
+
audioAndVideoTags: { current: [] },
|
|
19
|
+
frame: 10000,
|
|
20
|
+
imperativePlaying: {
|
|
21
|
+
current: false,
|
|
22
|
+
},
|
|
23
|
+
playbackRate: 0,
|
|
24
|
+
playing: false,
|
|
25
|
+
rootId: 'hither',
|
|
26
|
+
setPlaybackRate: () => undefined,
|
|
27
|
+
};
|
|
28
|
+
describe('Composition-validation render should NOT throw with valid props', () => {
|
|
29
|
+
test('It should allow undefined as children', () => {
|
|
30
|
+
const { queryByText } = render(_jsx(CanUseRemotionHooksProvider, { children: _jsx(WrapSequenceContext, { children: _jsx(Internals.Timeline.TimelineContext.Provider, { value: context, children: _jsx(Freeze, { frame: 10000, children: _jsx(Sequence, { durationInFrames: 2424, from: 9265, children: _jsx(Inner, {}) }) }) }) }) }));
|
|
31
|
+
expect(queryByText(/^0$/)).not.toBe(null);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @vitest-environment jsdom
|
|
4
|
+
*/
|
|
5
|
+
import { render } from '@testing-library/react';
|
|
6
|
+
import { describe, expect, test } from 'vitest';
|
|
7
|
+
import { CanUseRemotionHooksProvider } from '../CanUseRemotionHooks.js';
|
|
8
|
+
import { Sequence } from '../Sequence.js';
|
|
9
|
+
import { expectToThrow } from './expect-to-throw.js';
|
|
10
|
+
import { WrapSequenceContext } from './wrap-sequence-context.js';
|
|
11
|
+
describe('Composition-validation render should throw with invalid props', () => {
|
|
12
|
+
describe('Throw with invalid duration props', () => {
|
|
13
|
+
test('It should throw if Sequence has non-integer durationInFrames', () => {
|
|
14
|
+
expectToThrow(() => render(_jsx(Sequence, { from: 0, durationInFrames: 1.1, children: "hi" })), /The "durationInFrames" of a sequence must be an integer, but got 1.1./);
|
|
15
|
+
});
|
|
16
|
+
test('It should throw if Sequence has negative duration', () => {
|
|
17
|
+
expectToThrow(
|
|
18
|
+
// @ts-expect-error
|
|
19
|
+
() => render(_jsx(Sequence, { from: 0, durationInFrames: -1 })), /durationInFrames must be positive, but got -1/);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
describe('Throw with invalid from props', () => {
|
|
23
|
+
test('It should throw if "from" props is not a number', () => {
|
|
24
|
+
expectToThrow(
|
|
25
|
+
// @ts-expect-error
|
|
26
|
+
() => render(_jsx(Sequence, { from: '0', durationInFrames: 30 })), /You passed to the "from" props of your <Sequence> an argument of type string, but it must be a number./);
|
|
27
|
+
});
|
|
28
|
+
test('It should throw if Sequence has non-integer from', () => {
|
|
29
|
+
expectToThrow(() => render(_jsx(Sequence, { from: 0.1, durationInFrames: 1, children: "hi" })), /The "from" prop of a sequence must be an integer, but got 0.1./);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
test('It should throw for invalid layout value', () => {
|
|
33
|
+
expectToThrow(() => render(
|
|
34
|
+
// @ts-expect-error
|
|
35
|
+
_jsx(Sequence, { from: 0, durationInFrames: 100, layout: 'invalid-value' })), /The layout prop of <Sequence \/> expects either "absolute-fill" or "none", but you passed: invalid-value/);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
describe('Composition-validation render should NOT throw with valid props', () => {
|
|
39
|
+
test('It should allow null as children', () => {
|
|
40
|
+
expect(() => render(_jsx(CanUseRemotionHooksProvider, { children: _jsx(WrapSequenceContext, { children: _jsx(Sequence, { durationInFrames: 100, from: 0, children: null }) }) }))).not.toThrow();
|
|
41
|
+
});
|
|
42
|
+
test('It should allow undefined as children', () => {
|
|
43
|
+
expect(() => render(_jsx(CanUseRemotionHooksProvider, { children: _jsx(WrapSequenceContext, { children: _jsx(Sequence, { durationInFrames: 100, from: 0, children: undefined }) }) }))).not.toThrow();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @vitest-environment jsdom
|
|
4
|
+
*/
|
|
5
|
+
/* eslint-disable react/jsx-no-constructed-context-values */
|
|
6
|
+
import { render } from '@testing-library/react';
|
|
7
|
+
import { expect, test } from 'vitest';
|
|
8
|
+
import { CanUseRemotionHooksProvider } from '../CanUseRemotionHooks.js';
|
|
9
|
+
import { Series } from '../series';
|
|
10
|
+
import { TimelineContext } from '../timeline-position-state.js';
|
|
11
|
+
import { useCurrentFrame } from '../use-current-frame.js';
|
|
12
|
+
import { WrapSequenceContext } from './wrap-sequence-context.js';
|
|
13
|
+
const First = () => {
|
|
14
|
+
const frame = useCurrentFrame();
|
|
15
|
+
return _jsx("div", { children: 'first ' + frame });
|
|
16
|
+
};
|
|
17
|
+
const Second = () => {
|
|
18
|
+
const frame = useCurrentFrame();
|
|
19
|
+
return _jsx("div", { children: 'second ' + frame });
|
|
20
|
+
};
|
|
21
|
+
const Third = () => {
|
|
22
|
+
const frame = useCurrentFrame();
|
|
23
|
+
return _jsx("div", { children: 'third ' + frame });
|
|
24
|
+
};
|
|
25
|
+
const renderForFrame = (frame, markup) => {
|
|
26
|
+
return render(_jsx(CanUseRemotionHooksProvider, { children: _jsx(TimelineContext.Provider, { value: {
|
|
27
|
+
rootId: '',
|
|
28
|
+
frame,
|
|
29
|
+
playing: false,
|
|
30
|
+
imperativePlaying: {
|
|
31
|
+
current: false,
|
|
32
|
+
},
|
|
33
|
+
playbackRate: 1,
|
|
34
|
+
setPlaybackRate: () => {
|
|
35
|
+
throw new Error('playback rate');
|
|
36
|
+
},
|
|
37
|
+
audioAndVideoTags: { current: [] },
|
|
38
|
+
}, children: markup }) }));
|
|
39
|
+
};
|
|
40
|
+
test('Basic series test', () => {
|
|
41
|
+
const { queryByText } = renderForFrame(10, _jsxs(WrapSequenceContext, { children: [_jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 5, children: _jsx(First, {}) }), _jsx(Series.Sequence, { durationInFrames: 5, children: _jsx(Second, {}) }), _jsx(Series.Sequence, { durationInFrames: 5, children: _jsx(Third, {}) })] }), ' '] }));
|
|
42
|
+
expect(queryByText(/^third\s0$/)).not.toBe(null);
|
|
43
|
+
});
|
|
44
|
+
test('Should support fragments', () => {
|
|
45
|
+
const { container } = renderForFrame(10, _jsxs(WrapSequenceContext, { children: [_jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 5, children: _jsx(First, {}) }), _jsxs(_Fragment, { children: [_jsx(Series.Sequence, { durationInFrames: 5, children: _jsx(Second, {}) }, "0"), _jsx(Series.Sequence, { durationInFrames: 5, children: _jsx(Third, {}) }, "1")] })] }), ' '] }));
|
|
46
|
+
expect(container.outerHTML).not.toBe(null);
|
|
47
|
+
});
|
|
48
|
+
test('Should not allow foreign elements', () => {
|
|
49
|
+
expect(() => {
|
|
50
|
+
render(_jsx(WrapSequenceContext, { children: _jsx(Series, { children: _jsx(First, {}) }) }));
|
|
51
|
+
}).toThrow(/only accepts a/);
|
|
52
|
+
});
|
|
53
|
+
test('Should allow layout prop', () => {
|
|
54
|
+
const { container } = renderForFrame(0, _jsx(WrapSequenceContext, { children: _jsx(Series, { children: _jsx(Series.Sequence, { durationInFrames: 1, children: _jsx(First, {}) }) }) }));
|
|
55
|
+
expect(container.outerHTML).toBe('<div><div style="position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; width: 100%; height: 100%; display: flex;"><div>first 0</div></div></div>');
|
|
56
|
+
const { container: withoutLayoutContainer } = renderForFrame(0, _jsx(WrapSequenceContext, { children: _jsx(Series, { children: _jsx(Series.Sequence, { durationInFrames: 1, layout: "none", children: _jsx(First, {}) }) }) }));
|
|
57
|
+
expect(withoutLayoutContainer.outerHTML).toBe('<div><div>first 0</div></div>');
|
|
58
|
+
});
|
|
59
|
+
test('Should render nothing after the end', () => {
|
|
60
|
+
const { container } = renderForFrame(10, _jsx(WrapSequenceContext, { children: _jsx(Series, { children: _jsx(Series.Sequence, { durationInFrames: 1, children: _jsx(First, {}) }) }) }));
|
|
61
|
+
expect(container.outerHTML).toBe('<div></div>');
|
|
62
|
+
});
|
|
63
|
+
test('Should throw if invalid or no duration provided', () => {
|
|
64
|
+
expect(() => {
|
|
65
|
+
renderForFrame(10, _jsx(Series, { children: _jsx(Series.Sequence, { durationInFrames: NaN, children: _jsx(First, {}) }) }));
|
|
66
|
+
}).toThrow(/The "durationInFrames" prop of a <Series.Sequence \/> component must be an integer, but got NaN./);
|
|
67
|
+
expect(() => {
|
|
68
|
+
renderForFrame(10, _jsx(Series, { children: _jsx(Series.Sequence, { children: _jsx(First, {}) }) }));
|
|
69
|
+
}).toThrow(/The "durationInFrames" prop of a <Series.Sequence \/> component must be a number, but you passed a value of type undefined/);
|
|
70
|
+
});
|
|
71
|
+
test('Should allow whitespace', () => {
|
|
72
|
+
const { queryByText } = renderForFrame(11, _jsx(WrapSequenceContext, { children: _jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 10, children: _jsx(First, {}) }), ' ', _jsx(Series.Sequence, { durationInFrames: 10, children: _jsx(Second, {}) })] }) }));
|
|
73
|
+
expect(queryByText(/^second\s1$/g)).not.toBe(null);
|
|
74
|
+
});
|
|
75
|
+
test('Handle empty Series.Sequence', () => {
|
|
76
|
+
expect(() => renderForFrame(11, _jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 10, children: _jsx(First, {}) }), _jsx(Series.Sequence, { durationInFrames: 10 })] }))).toThrow(/A <Series.Sequence \/> component \(index = 1, duration = 10\) was detected to not have any children\. Delete it to fix this error\./);
|
|
77
|
+
});
|
|
78
|
+
test('Should allow negative overlap prop', () => {
|
|
79
|
+
const { container } = renderForFrame(4, _jsx(WrapSequenceContext, { children: _jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 5, layout: "none", children: _jsx(First, {}) }), _jsx(Series.Sequence, { offset: -1, layout: "none", durationInFrames: 5, children: _jsx(Second, {}) })] }) }));
|
|
80
|
+
expect(container.outerHTML).toBe('<div><div>first 4</div><div>second 0</div></div>');
|
|
81
|
+
});
|
|
82
|
+
test('Should allow positive overlap prop', () => {
|
|
83
|
+
const { container } = renderForFrame(5, _jsx(WrapSequenceContext, { children: _jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 5, layout: "none", children: _jsx(First, {}) }), _jsx(Series.Sequence, { offset: 1, layout: "none", durationInFrames: 5, children: _jsx(Second, {}) })] }) }));
|
|
84
|
+
expect(container.outerHTML).toBe('<div></div>');
|
|
85
|
+
});
|
|
86
|
+
test('Should disallow NaN as offset prop', () => {
|
|
87
|
+
expect(() => {
|
|
88
|
+
renderForFrame(9, _jsx(Series, { children: _jsx(Series.Sequence, { offset: NaN, layout: "none", durationInFrames: 5, children: _jsx(Second, {}) }) }));
|
|
89
|
+
}).toThrow(/The "offset" property of a <Series.Sequence \/> must not be NaN, but got NaN \(index = 0, duration = 5\)\./);
|
|
90
|
+
});
|
|
91
|
+
test('Should disallow Infinity as offset prop', () => {
|
|
92
|
+
expect(() => {
|
|
93
|
+
renderForFrame(9, _jsx(Series, { children: _jsx(Series.Sequence, { offset: Infinity, layout: "none", durationInFrames: 5, children: _jsx(Second, {}) }) }));
|
|
94
|
+
}).toThrow(/The "offset" property of a <Series.Sequence \/> must be finite, but got Infinity \(index = 0, duration = 5\)\./);
|
|
95
|
+
});
|
|
96
|
+
test('Should disallow non-integer numbers as offset prop', () => {
|
|
97
|
+
expect(() => {
|
|
98
|
+
renderForFrame(9, _jsx(Series, { children: _jsx(Series.Sequence, { offset: Math.PI, layout: "none", durationInFrames: 5, children: _jsx(Second, {}) }) }));
|
|
99
|
+
}).toThrow(/The "offset" property of a <Series.Sequence \/> must be finite, but got 3.141592653589793 \(index = 0, duration = 5\)\./);
|
|
100
|
+
});
|
|
101
|
+
test('Should cascade negative offset props', () => {
|
|
102
|
+
const { container } = renderForFrame(9, _jsx(WrapSequenceContext, { children: _jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 5, layout: "none", children: _jsx(First, {}) }), _jsx(Series.Sequence, { offset: -1, layout: "none", durationInFrames: 5, children: _jsx(Second, {}) }), _jsx(Series.Sequence, { layout: "none", durationInFrames: 5, children: _jsx(Third, {}) })] }) }));
|
|
103
|
+
expect(container.outerHTML).toBe('<div><div>third 0</div></div>');
|
|
104
|
+
});
|
|
105
|
+
test('Should cascade positive offset props', () => {
|
|
106
|
+
const { container } = renderForFrame(11, _jsx(WrapSequenceContext, { children: _jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 5, layout: "none", children: _jsx(First, {}) }), _jsx(Series.Sequence, { offset: 1, layout: "none", durationInFrames: 5, children: _jsx(Second, {}) }), _jsx(Series.Sequence, { layout: "none", durationInFrames: 5, children: _jsx(Third, {}) })] }) }));
|
|
107
|
+
expect(container.outerHTML).toBe('<div><div>third 0</div></div>');
|
|
108
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { expect, test } from 'vitest';
|
|
2
|
+
import { isApproximatelyTheSame } from '../is-approximately-the-same.js';
|
|
3
|
+
import { spring } from '../spring';
|
|
4
|
+
test('Basic spring to equal 0', () => {
|
|
5
|
+
expect(spring({
|
|
6
|
+
fps: 30,
|
|
7
|
+
frame: 0,
|
|
8
|
+
})).toEqual(0);
|
|
9
|
+
});
|
|
10
|
+
test('Basic spring to equal 1', () => {
|
|
11
|
+
expect(spring({
|
|
12
|
+
fps: 30,
|
|
13
|
+
frame: 0,
|
|
14
|
+
from: 1,
|
|
15
|
+
to: 0,
|
|
16
|
+
})).toEqual(1);
|
|
17
|
+
});
|
|
18
|
+
test('Should be approxmiately the same', () => {
|
|
19
|
+
expect(isApproximatelyTheSame(spring({
|
|
20
|
+
fps: 30,
|
|
21
|
+
frame: 1,
|
|
22
|
+
}), 0.04941510804510185)).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
test('Should be close to 1', () => {
|
|
25
|
+
expect(spring({
|
|
26
|
+
fps: 30,
|
|
27
|
+
frame: 100,
|
|
28
|
+
})).toBeCloseTo(1);
|
|
29
|
+
});
|
|
30
|
+
test('Should be able to set duration for spring', () => {
|
|
31
|
+
expect(spring({
|
|
32
|
+
fps: 30,
|
|
33
|
+
frame: 5,
|
|
34
|
+
durationInFrames: 5,
|
|
35
|
+
})).toBeCloseTo(1);
|
|
36
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|