@remotion/transitions 4.0.175 → 4.0.177
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/context.d.ts +18 -0
- package/dist/context.js +69 -0
- package/dist/esm/context.mjs +44 -0
- package/dist/presentations/context.d.ts +13 -0
- package/dist/presentations/context.js +29 -0
- package/package.json +6 -6
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type TransitionState = {
|
|
3
|
+
entering: number;
|
|
4
|
+
exiting: number;
|
|
5
|
+
isInTransitionSeries: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const WrapInEnteringProgressContext: React.FC<{
|
|
8
|
+
readonly presentationProgress: number;
|
|
9
|
+
readonly children: React.ReactNode;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const WrapInExitingProgressContext: React.FC<{
|
|
12
|
+
readonly presentationProgress: number;
|
|
13
|
+
readonly children: React.ReactNode;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Gets the progress and direction of a transition with a context() presentation.
|
|
17
|
+
*/
|
|
18
|
+
export declare const useTransitionProgress: () => TransitionState;
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.useTransitionProgress = exports.WrapInExitingProgressContext = exports.WrapInEnteringProgressContext = void 0;
|
|
27
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
const EnteringContext = react_1.default.createContext(null);
|
|
30
|
+
const ExitingContext = react_1.default.createContext(null);
|
|
31
|
+
const WrapInEnteringProgressContext = ({ presentationProgress, children }) => {
|
|
32
|
+
const value = (0, react_1.useMemo)(() => {
|
|
33
|
+
return {
|
|
34
|
+
enteringProgress: presentationProgress,
|
|
35
|
+
};
|
|
36
|
+
}, [presentationProgress]);
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(EnteringContext.Provider, { value: value, children: children }));
|
|
38
|
+
};
|
|
39
|
+
exports.WrapInEnteringProgressContext = WrapInEnteringProgressContext;
|
|
40
|
+
const WrapInExitingProgressContext = ({ presentationProgress, children }) => {
|
|
41
|
+
const value = (0, react_1.useMemo)(() => {
|
|
42
|
+
return {
|
|
43
|
+
exitingProgress: presentationProgress,
|
|
44
|
+
};
|
|
45
|
+
}, [presentationProgress]);
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)(ExitingContext.Provider, { value: value, children: children }));
|
|
47
|
+
};
|
|
48
|
+
exports.WrapInExitingProgressContext = WrapInExitingProgressContext;
|
|
49
|
+
/**
|
|
50
|
+
* Gets the progress and direction of a transition with a context() presentation.
|
|
51
|
+
*/
|
|
52
|
+
const useTransitionProgress = () => {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
const entering = react_1.default.useContext(EnteringContext);
|
|
55
|
+
const exiting = react_1.default.useContext(ExitingContext);
|
|
56
|
+
if (!entering && !exiting) {
|
|
57
|
+
return {
|
|
58
|
+
isInTransitionSeries: false,
|
|
59
|
+
entering: 1,
|
|
60
|
+
exiting: 0,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
isInTransitionSeries: true,
|
|
65
|
+
entering: (_a = entering === null || entering === void 0 ? void 0 : entering.enteringProgress) !== null && _a !== void 0 ? _a : 1,
|
|
66
|
+
exiting: (_b = exiting === null || exiting === void 0 ? void 0 : exiting.exitingProgress) !== null && _b !== void 0 ? _b : 0,
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
exports.useTransitionProgress = useTransitionProgress;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// src/presentations/context.tsx
|
|
2
|
+
import React, {useMemo} from "react";
|
|
3
|
+
import {AbsoluteFill} from "remotion";
|
|
4
|
+
import {
|
|
5
|
+
jsx
|
|
6
|
+
} from "react/jsx-runtime";
|
|
7
|
+
var ContextPresentationContext = React.createContext(null);
|
|
8
|
+
var ContextPresentation = ({ children, presentationDirection, presentationProgress, passedProps }) => {
|
|
9
|
+
const style = useMemo(() => {
|
|
10
|
+
return {
|
|
11
|
+
...presentationDirection === "entering" ? passedProps.enterStyle : passedProps.exitStyle
|
|
12
|
+
};
|
|
13
|
+
}, [passedProps.enterStyle, passedProps.exitStyle, presentationDirection]);
|
|
14
|
+
const value = useMemo(() => {
|
|
15
|
+
return {
|
|
16
|
+
progress: presentationProgress,
|
|
17
|
+
direction: presentationDirection
|
|
18
|
+
};
|
|
19
|
+
}, [presentationDirection, presentationProgress]);
|
|
20
|
+
return jsx(ContextPresentationContext.Provider, {
|
|
21
|
+
value,
|
|
22
|
+
children: jsx(AbsoluteFill, {
|
|
23
|
+
style,
|
|
24
|
+
children
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
var context = (props) => {
|
|
29
|
+
return {
|
|
30
|
+
component: ContextPresentation,
|
|
31
|
+
props: props ?? {}
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
var useTransitionContext = () => {
|
|
35
|
+
const value = React.useContext(ContextPresentationContext);
|
|
36
|
+
if (!value) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return value;
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
useTransitionContext,
|
|
43
|
+
context
|
|
44
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TransitionPresentation } from '../types';
|
|
3
|
+
export type NoneProps = {
|
|
4
|
+
enterStyle?: React.CSSProperties;
|
|
5
|
+
exitStyle?: React.CSSProperties;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Wraps the transition in a context so that the progress can be read from the children using a hook.
|
|
9
|
+
* @see [Documentation](https://remotion.dev/docs/transitions/presentations/context)
|
|
10
|
+
* @param {NoneProps} [props] Optional properties to define 'enterStyle' and 'exitStyle'.
|
|
11
|
+
* @returns {TransitionPresentation<NoneProps>} The transition presentation component setup.
|
|
12
|
+
*/
|
|
13
|
+
export declare const context: (props?: NoneProps) => TransitionPresentation<NoneProps>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.context = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const remotion_1 = require("remotion");
|
|
7
|
+
const NonePresentation = ({ children, presentationDirection, passedProps }) => {
|
|
8
|
+
const style = (0, react_1.useMemo)(() => {
|
|
9
|
+
return {
|
|
10
|
+
...(presentationDirection === 'entering'
|
|
11
|
+
? passedProps.enterStyle
|
|
12
|
+
: passedProps.exitStyle),
|
|
13
|
+
};
|
|
14
|
+
}, [passedProps.enterStyle, passedProps.exitStyle, presentationDirection]);
|
|
15
|
+
return (0, jsx_runtime_1.jsx)(remotion_1.AbsoluteFill, { style: style, children: children });
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Wraps the transition in a context so that the progress can be read from the children using a hook.
|
|
19
|
+
* @see [Documentation](https://remotion.dev/docs/transitions/presentations/context)
|
|
20
|
+
* @param {NoneProps} [props] Optional properties to define 'enterStyle' and 'exitStyle'.
|
|
21
|
+
* @returns {TransitionPresentation<NoneProps>} The transition presentation component setup.
|
|
22
|
+
*/
|
|
23
|
+
const context = (props) => {
|
|
24
|
+
return {
|
|
25
|
+
component: NonePresentation,
|
|
26
|
+
props: props !== null && props !== void 0 ? props : {},
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
exports.context = context;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/transitions",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.177",
|
|
4
4
|
"description": "Transition presets for Remotion",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/esm/index.mjs",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"url": "https://github.com/remotion-dev/remotion/issues"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"remotion": "4.0.
|
|
20
|
-
"@remotion/
|
|
21
|
-
"@remotion/
|
|
19
|
+
"remotion": "4.0.177",
|
|
20
|
+
"@remotion/shapes": "4.0.177",
|
|
21
|
+
"@remotion/paths": "4.0.177"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@jonny/eslint-config": "3.0.281",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"@types/react-dom": "18.3.0",
|
|
33
33
|
"@types/bun": "1.0.12",
|
|
34
34
|
"@vitejs/plugin-react": "^2.0.0",
|
|
35
|
-
"remotion": "4.0.
|
|
36
|
-
"@remotion/test-utils": "4.0.
|
|
35
|
+
"remotion": "4.0.177",
|
|
36
|
+
"@remotion/test-utils": "4.0.177"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": ">=16.8.0",
|