remotion 4.0.493 → 4.0.495
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/HtmlInCanvas.js +1 -4
- package/dist/cjs/Img.js +3 -1
- package/dist/cjs/Interactive.d.ts +4 -6
- package/dist/cjs/Interactive.js +46 -37
- package/dist/cjs/Sequence.js +12 -33
- package/dist/cjs/animated-image/AnimatedImage.js +3 -4
- package/dist/cjs/animated-image/get-current-time.d.ts +5 -0
- package/dist/cjs/animated-image/get-current-time.js +7 -0
- package/dist/cjs/interactivity-schema.d.ts +12 -0
- package/dist/cjs/interactivity-schema.js +10 -3
- package/dist/cjs/internals.d.ts +57 -1
- package/dist/cjs/internals.js +3 -0
- package/dist/cjs/no-react.d.ts +2 -0
- package/dist/cjs/use-current-scale.d.ts +8 -1
- package/dist/cjs/use-current-scale.js +1 -1
- package/dist/cjs/use-premounting.d.ts +19 -0
- package/dist/cjs/use-premounting.js +62 -0
- package/dist/cjs/use-schema.d.ts +6 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/index.mjs +300 -227
- package/dist/esm/no-react.mjs +12 -4
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export declare const usePremounting: ({ from, durationInFrames, premountFor, postmountFor, style, styleWhilePremounted, styleWhilePostmounted, hideWhilePremounted, }: {
|
|
3
|
+
readonly from: number;
|
|
4
|
+
readonly durationInFrames: number;
|
|
5
|
+
readonly premountFor: number | null;
|
|
6
|
+
readonly postmountFor: number | null;
|
|
7
|
+
readonly style: React.CSSProperties | null;
|
|
8
|
+
readonly styleWhilePremounted: React.CSSProperties | null;
|
|
9
|
+
readonly styleWhilePostmounted: React.CSSProperties | null;
|
|
10
|
+
readonly hideWhilePremounted: "display-none" | "opacity";
|
|
11
|
+
}) => {
|
|
12
|
+
effectivePremountFor: number;
|
|
13
|
+
effectivePostmountFor: number;
|
|
14
|
+
premountingActive: boolean;
|
|
15
|
+
postmountingActive: boolean;
|
|
16
|
+
isPremountingOrPostmounting: boolean;
|
|
17
|
+
freezeFrame: number;
|
|
18
|
+
premountingStyle: React.CSSProperties | null;
|
|
19
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usePremounting = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const PremountContext_js_1 = require("./PremountContext.js");
|
|
6
|
+
const use_current_frame_js_1 = require("./use-current-frame.js");
|
|
7
|
+
const use_remotion_environment_js_1 = require("./use-remotion-environment.js");
|
|
8
|
+
const use_video_config_js_1 = require("./use-video-config.js");
|
|
9
|
+
const v5_flag_js_1 = require("./v5-flag.js");
|
|
10
|
+
const usePremounting = ({ from, durationInFrames, premountFor, postmountFor, style, styleWhilePremounted, styleWhilePostmounted, hideWhilePremounted, }) => {
|
|
11
|
+
const parentPremountContext = (0, react_1.useContext)(PremountContext_js_1.PremountContext);
|
|
12
|
+
const frame = (0, use_current_frame_js_1.useCurrentFrame)() - parentPremountContext.premountFramesRemaining;
|
|
13
|
+
const environment = (0, use_remotion_environment_js_1.useRemotionEnvironment)();
|
|
14
|
+
const { fps } = (0, use_video_config_js_1.useVideoConfig)();
|
|
15
|
+
const effectivePremountFor = v5_flag_js_1.ENABLE_V5_BREAKING_CHANGES
|
|
16
|
+
? (premountFor !== null && premountFor !== void 0 ? premountFor : fps)
|
|
17
|
+
: (premountFor !== null && premountFor !== void 0 ? premountFor : 0);
|
|
18
|
+
const effectivePostmountFor = postmountFor !== null && postmountFor !== void 0 ? postmountFor : 0;
|
|
19
|
+
const endThreshold = Math.ceil(from + durationInFrames - 1);
|
|
20
|
+
const premountingActive = !environment.isRendering &&
|
|
21
|
+
frame < from &&
|
|
22
|
+
frame >= from - effectivePremountFor;
|
|
23
|
+
const postmountingActive = !environment.isRendering &&
|
|
24
|
+
frame > endThreshold &&
|
|
25
|
+
frame <= endThreshold + effectivePostmountFor;
|
|
26
|
+
const isPremountingOrPostmounting = premountingActive || postmountingActive;
|
|
27
|
+
const freezeFrame = premountingActive
|
|
28
|
+
? from
|
|
29
|
+
: postmountingActive
|
|
30
|
+
? from + durationInFrames - 1
|
|
31
|
+
: 0;
|
|
32
|
+
const premountingStyle = (0, react_1.useMemo)(() => {
|
|
33
|
+
if (!isPremountingOrPostmounting) {
|
|
34
|
+
return style;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
...style,
|
|
38
|
+
...(hideWhilePremounted === 'opacity' ? { opacity: 0 } : { display: 'none' }),
|
|
39
|
+
pointerEvents: 'none',
|
|
40
|
+
...(premountingActive ? styleWhilePremounted : {}),
|
|
41
|
+
...(postmountingActive ? styleWhilePostmounted : {}),
|
|
42
|
+
};
|
|
43
|
+
}, [
|
|
44
|
+
isPremountingOrPostmounting,
|
|
45
|
+
hideWhilePremounted,
|
|
46
|
+
postmountingActive,
|
|
47
|
+
premountingActive,
|
|
48
|
+
style,
|
|
49
|
+
styleWhilePostmounted,
|
|
50
|
+
styleWhilePremounted,
|
|
51
|
+
]);
|
|
52
|
+
return {
|
|
53
|
+
effectivePremountFor,
|
|
54
|
+
effectivePostmountFor,
|
|
55
|
+
premountingActive,
|
|
56
|
+
postmountingActive,
|
|
57
|
+
isPremountingOrPostmounting,
|
|
58
|
+
freezeFrame,
|
|
59
|
+
premountingStyle,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
exports.usePremounting = usePremounting;
|
package/dist/cjs/use-schema.d.ts
CHANGED
|
@@ -25,6 +25,12 @@ export type VideoConfigNumericExpression = {
|
|
|
25
25
|
multiplicand: number;
|
|
26
26
|
factorPosition: 'left' | 'right';
|
|
27
27
|
value: number;
|
|
28
|
+
} | {
|
|
29
|
+
type: 'video-config-subtraction';
|
|
30
|
+
identifier: string;
|
|
31
|
+
minuend: number;
|
|
32
|
+
subtrahend: number;
|
|
33
|
+
value: number;
|
|
28
34
|
};
|
|
29
35
|
export type CanUpdateSequencePropStatusLinearEasing = {
|
|
30
36
|
type: 'linear';
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED