@remotion/transitions 4.0.137 → 4.0.138

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.
@@ -1,75 +1,82 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { useMemo } from 'react';
3
- import { AbsoluteFill } from 'remotion';
4
-
5
- const epsilon = 0.01;
6
- const SlidePresentation = ({ children, presentationProgress, presentationDirection, passedProps: { direction = 'from-left', enterStyle, exitStyle }, }) => {
7
- const directionStyle = useMemo(() => {
8
- // Overlay the two slides barely to avoid a white line between them
9
- // Remove the correction once the presentation progress is 1
10
- const presentationProgressWithEpsilonCorrection = presentationProgress === 1
11
- ? presentationProgress * 100
12
- : presentationProgress * 100 - epsilon;
13
- if (presentationDirection === 'exiting') {
14
- switch (direction) {
15
- case 'from-left':
16
- return {
17
- transform: `translateX(${presentationProgressWithEpsilonCorrection}%)`,
18
- };
19
- case 'from-right':
20
- return {
21
- transform: `translateX(-${presentationProgress * 100}%)`,
22
- };
23
- case 'from-top':
24
- return {
25
- transform: `translateY(${presentationProgressWithEpsilonCorrection}%)`,
26
- };
27
- case 'from-bottom':
28
- return {
29
- transform: `translateY(-${presentationProgress * 100}%)`,
30
- };
31
- default:
32
- throw new Error(`Invalid direction: ${direction}`);
33
- }
34
- }
35
- switch (direction) {
36
- case 'from-left':
37
- return {
38
- transform: `translateX(${-100 + presentationProgress * 100}%)`,
39
- };
40
- case 'from-right':
41
- return {
42
- transform: `translateX(${100 - presentationProgressWithEpsilonCorrection}%)`,
43
- };
44
- case 'from-top':
45
- return {
46
- transform: `translateY(${-100 + presentationProgress * 100}%)`,
47
- };
48
- case 'from-bottom':
49
- return {
50
- transform: `translateY(${100 - presentationProgressWithEpsilonCorrection}%)`,
51
- };
52
- default:
53
- throw new Error(`Invalid direction: ${direction}`);
54
- }
55
- }, [presentationDirection, presentationProgress, direction]);
56
- const style = useMemo(() => {
1
+ // src/presentations/slide.tsx
2
+ import {useMemo} from "react";
3
+ import {AbsoluteFill} from "remotion";
4
+ import {
5
+ jsx
6
+ } from "react/jsx-runtime";
7
+ var epsilon = 0.01;
8
+ var SlidePresentation = ({
9
+ children,
10
+ presentationProgress,
11
+ presentationDirection,
12
+ passedProps: { direction = "from-left", enterStyle, exitStyle }
13
+ }) => {
14
+ const directionStyle = useMemo(() => {
15
+ const presentationProgressWithEpsilonCorrection = presentationProgress === 1 ? presentationProgress * 100 : presentationProgress * 100 - epsilon;
16
+ if (presentationDirection === "exiting") {
17
+ switch (direction) {
18
+ case "from-left":
19
+ return {
20
+ transform: `translateX(${presentationProgressWithEpsilonCorrection}%)`
21
+ };
22
+ case "from-right":
23
+ return {
24
+ transform: `translateX(-${presentationProgress * 100}%)`
25
+ };
26
+ case "from-top":
27
+ return {
28
+ transform: `translateY(${presentationProgressWithEpsilonCorrection}%)`
29
+ };
30
+ case "from-bottom":
31
+ return {
32
+ transform: `translateY(-${presentationProgress * 100}%)`
33
+ };
34
+ default:
35
+ throw new Error(`Invalid direction: ${direction}`);
36
+ }
37
+ }
38
+ switch (direction) {
39
+ case "from-left":
57
40
  return {
58
- width: '100%',
59
- height: '100%',
60
- justifyContent: 'center',
61
- alignItems: 'center',
62
- ...directionStyle,
63
- ...(presentationDirection === 'entering' ? enterStyle : exitStyle),
41
+ transform: `translateX(${-100 + presentationProgress * 100}%)`
64
42
  };
65
- }, [directionStyle, enterStyle, exitStyle, presentationDirection]);
66
- return jsx(AbsoluteFill, { style: style, children: children });
67
- };
68
- const slide = (props) => {
43
+ case "from-right":
44
+ return {
45
+ transform: `translateX(${100 - presentationProgressWithEpsilonCorrection}%)`
46
+ };
47
+ case "from-top":
48
+ return {
49
+ transform: `translateY(${-100 + presentationProgress * 100}%)`
50
+ };
51
+ case "from-bottom":
52
+ return {
53
+ transform: `translateY(${100 - presentationProgressWithEpsilonCorrection}%)`
54
+ };
55
+ default:
56
+ throw new Error(`Invalid direction: ${direction}`);
57
+ }
58
+ }, [presentationDirection, presentationProgress, direction]);
59
+ const style = useMemo(() => {
69
60
  return {
70
- component: SlidePresentation,
71
- props: props !== null && props !== void 0 ? props : {},
61
+ width: "100%",
62
+ height: "100%",
63
+ justifyContent: "center",
64
+ alignItems: "center",
65
+ ...directionStyle,
66
+ ...presentationDirection === "entering" ? enterStyle : exitStyle
72
67
  };
68
+ }, [directionStyle, enterStyle, exitStyle, presentationDirection]);
69
+ return jsx(AbsoluteFill, {
70
+ style,
71
+ children
72
+ }, undefined, false, undefined, this);
73
+ };
74
+ var slide = (props) => {
75
+ return {
76
+ component: SlidePresentation,
77
+ props: props ?? {}
78
+ };
79
+ };
80
+ export {
81
+ slide
73
82
  };
74
-
75
- export { slide };
package/dist/esm/wipe.mjs CHANGED
@@ -1,162 +1,192 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useState, useMemo } from 'react';
3
- import { random, AbsoluteFill } from 'remotion';
4
-
5
- const makePathIn = (progress, direction) => {
6
- switch (direction) {
7
- case 'from-left':
8
- return `
1
+ // src/presentations/wipe.tsx
2
+ import {useMemo, useState} from "react";
3
+ import {AbsoluteFill, random} from "remotion";
4
+ import {
5
+ jsx
6
+ } from "react/jsx-runtime";
7
+ var makePathIn = (progress, direction) => {
8
+ switch (direction) {
9
+ case "from-left":
10
+ return `
9
11
  M 0 0
10
12
  L ${progress} 0
11
13
  L ${progress} 1
12
14
  L 0 1
13
15
  Z`;
14
- case 'from-top-left':
15
- return `
16
+ case "from-top-left":
17
+ return `
16
18
  M 0 0
17
19
  L ${progress * 2} 0
18
20
  L 0 ${progress * 2}
19
21
  Z`;
20
- case 'from-top':
21
- return `
22
+ case "from-top":
23
+ return `
22
24
  M 0 0
23
25
  L 1 0
24
26
  L 1 ${progress}
25
27
  L 0 ${progress}
26
28
  Z`;
27
- case 'from-top-right':
28
- return `
29
+ case "from-top-right":
30
+ return `
29
31
  M 1 0
30
32
  L ${1 - progress * 2} 0
31
33
  L 1 ${progress * 2}
32
34
  Z`;
33
- case 'from-right':
34
- return `
35
+ case "from-right":
36
+ return `
35
37
  M 1 0
36
38
  L 1 1
37
39
  L ${1 - progress} 1
38
40
  L ${1 - progress} 0
39
41
  Z`;
40
- case 'from-bottom-right':
41
- return `
42
+ case "from-bottom-right":
43
+ return `
42
44
  M 1 1
43
45
  L ${1 - progress * 2} 1
44
46
  L 1 ${1 - progress * 2}
45
47
  Z`;
46
- case 'from-bottom':
47
- return `
48
+ case "from-bottom":
49
+ return `
48
50
  M 0 1
49
51
  L 1 1
50
52
  L 1 ${1 - progress}
51
53
  L 0 ${1 - progress}
52
54
  Z`;
53
- case 'from-bottom-left':
54
- return `
55
+ case "from-bottom-left":
56
+ return `
55
57
  M 0 1
56
58
  L 0 ${1 - progress * 2}
57
59
  L ${progress * 2} 1
58
60
  Z`;
59
- default:
60
- throw new Error(`Unknown direction ${JSON.stringify(direction)}`);
61
- }
61
+ default:
62
+ throw new Error(`Unknown direction ${JSON.stringify(direction)}`);
63
+ }
62
64
  };
63
- const makePathOut = (progress, direction) => {
64
- switch (direction) {
65
- case 'from-left':
66
- return `
65
+ var makePathOut = (progress, direction) => {
66
+ switch (direction) {
67
+ case "from-left":
68
+ return `
67
69
  M 1 1
68
70
  L ${1 - progress} 1
69
71
  L ${1 - progress} 0
70
72
  L 1 0
71
73
  Z`;
72
- case 'from-top-left':
73
- return `
74
+ case "from-top-left":
75
+ return `
74
76
  M 1 1
75
77
  L ${1 - 2 * progress} 1
76
78
  L 1 ${1 - 2 * progress}
77
79
  Z`;
78
- case 'from-top':
79
- return `
80
+ case "from-top":
81
+ return `
80
82
  M 1 1
81
83
  L 0 1
82
84
  L 0 ${1 - progress}
83
85
  L 1 ${1 - progress}
84
86
  Z`;
85
- case 'from-top-right':
86
- return `
87
+ case "from-top-right":
88
+ return `
87
89
  M 0 1
88
90
  L ${progress * 2} 1
89
91
  L 0 ${1 - progress * 2}
90
92
  Z`;
91
- case 'from-right':
92
- return `
93
+ case "from-right":
94
+ return `
93
95
  M 0 0
94
96
  L ${progress} 0
95
97
  L ${progress} 1
96
98
  L 0 1
97
99
  Z`;
98
- case 'from-bottom-right':
99
- return `
100
+ case "from-bottom-right":
101
+ return `
100
102
  M 0 0
101
103
  L ${progress * 2} 0
102
104
  L 0 ${progress * 2}
103
105
  Z`;
104
- case 'from-bottom':
105
- return `
106
+ case "from-bottom":
107
+ return `
106
108
  M 1 0
107
109
  L 0 0
108
110
  L 0 ${progress}
109
111
  L 1 ${progress}
110
112
  Z`;
111
- case 'from-bottom-left':
112
- return `
113
+ case "from-bottom-left":
114
+ return `
113
115
  M 1 0
114
116
  L ${1 - progress * 2} 0
115
117
  L 1 ${progress * 2}
116
118
  Z`;
117
- default:
118
- throw new Error(`Unknown direction ${JSON.stringify(direction)}`);
119
- }
119
+ default:
120
+ throw new Error(`Unknown direction ${JSON.stringify(direction)}`);
121
+ }
120
122
  };
121
- const WipePresentation = ({ children, presentationProgress, presentationDirection, passedProps: { direction = 'from-left', innerEnterStyle, innerExitStyle, outerEnterStyle, outerExitStyle, }, }) => {
122
- const [clipId] = useState(() => String(random(null)));
123
- const progressInDirection = presentationDirection === 'entering'
124
- ? presentationProgress
125
- : 1 - presentationProgress;
126
- const path = presentationDirection === 'entering'
127
- ? makePathIn(progressInDirection, direction)
128
- : makePathOut(progressInDirection, direction);
129
- const style = useMemo(() => {
130
- return {
131
- width: '100%',
132
- height: '100%',
133
- justifyContent: 'center',
134
- alignItems: 'center',
135
- clipPath: `url(#${clipId})`,
136
- ...(presentationDirection === 'entering'
137
- ? innerEnterStyle
138
- : innerExitStyle),
139
- };
140
- }, [clipId, innerEnterStyle, innerExitStyle, presentationDirection]);
141
- const outerStyle = useMemo(() => {
142
- return presentationDirection === 'entering'
143
- ? outerEnterStyle
144
- : outerExitStyle;
145
- }, [outerEnterStyle, outerExitStyle, presentationDirection]);
146
- const svgStyle = useMemo(() => {
147
- return {
148
- width: '100%',
149
- height: '100%',
150
- pointerEvents: 'none',
151
- };
152
- }, []);
153
- return (jsxs(AbsoluteFill, { style: outerStyle, children: [jsx(AbsoluteFill, { style: style, children: children }), jsx(AbsoluteFill, { children: jsx("svg", { viewBox: "0 0 1 1", style: svgStyle, children: jsx("defs", { children: jsx("clipPath", { id: clipId, clipPathUnits: "objectBoundingBox", children: jsx("path", { d: path, fill: "black" }) }) }) }) })] }));
154
- };
155
- const wipe = (props) => {
123
+ var WipePresentation = ({
124
+ children,
125
+ presentationProgress,
126
+ presentationDirection,
127
+ passedProps: {
128
+ direction = "from-left",
129
+ innerEnterStyle,
130
+ innerExitStyle,
131
+ outerEnterStyle,
132
+ outerExitStyle
133
+ }
134
+ }) => {
135
+ const [clipId] = useState(() => String(random(null)));
136
+ const progressInDirection = presentationDirection === "entering" ? presentationProgress : 1 - presentationProgress;
137
+ const path = presentationDirection === "entering" ? makePathIn(progressInDirection, direction) : makePathOut(progressInDirection, direction);
138
+ const style = useMemo(() => {
139
+ return {
140
+ width: "100%",
141
+ height: "100%",
142
+ justifyContent: "center",
143
+ alignItems: "center",
144
+ clipPath: `url(#${clipId})`,
145
+ ...presentationDirection === "entering" ? innerEnterStyle : innerExitStyle
146
+ };
147
+ }, [clipId, innerEnterStyle, innerExitStyle, presentationDirection]);
148
+ const outerStyle = useMemo(() => {
149
+ return presentationDirection === "entering" ? outerEnterStyle : outerExitStyle;
150
+ }, [outerEnterStyle, outerExitStyle, presentationDirection]);
151
+ const svgStyle = useMemo(() => {
156
152
  return {
157
- component: WipePresentation,
158
- props: props !== null && props !== void 0 ? props : {},
153
+ width: "100%",
154
+ height: "100%",
155
+ pointerEvents: "none"
159
156
  };
157
+ }, []);
158
+ return jsx(AbsoluteFill, {
159
+ style: outerStyle,
160
+ children: [
161
+ jsx(AbsoluteFill, {
162
+ style,
163
+ children
164
+ }, undefined, false, undefined, this),
165
+ jsx(AbsoluteFill, {
166
+ children: jsx("svg", {
167
+ viewBox: "0 0 1 1",
168
+ style: svgStyle,
169
+ children: jsx("defs", {
170
+ children: jsx("clipPath", {
171
+ id: clipId,
172
+ clipPathUnits: "objectBoundingBox",
173
+ children: jsx("path", {
174
+ d: path,
175
+ fill: "black"
176
+ }, undefined, false, undefined, this)
177
+ }, undefined, false, undefined, this)
178
+ }, undefined, false, undefined, this)
179
+ }, undefined, false, undefined, this)
180
+ }, undefined, false, undefined, this)
181
+ ]
182
+ }, undefined, true, undefined, this);
183
+ };
184
+ var wipe = (props) => {
185
+ return {
186
+ component: WipePresentation,
187
+ props: props ?? {}
188
+ };
189
+ };
190
+ export {
191
+ wipe
160
192
  };
161
-
162
- export { wipe };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/transitions",
3
- "version": "4.0.137",
3
+ "version": "4.0.138",
4
4
  "description": "Transition presets for Remotion",
5
5
  "sideEffects": false,
6
6
  "main": "dist/esm/index.mjs",
@@ -16,25 +16,24 @@
16
16
  "url": "https://github.com/remotion-dev/remotion/issues"
17
17
  },
18
18
  "dependencies": {
19
- "@remotion/shapes": "4.0.137",
20
- "@remotion/paths": "4.0.137",
21
- "remotion": "4.0.137"
19
+ "remotion": "4.0.138",
20
+ "@remotion/shapes": "4.0.138",
21
+ "@remotion/paths": "4.0.138"
22
22
  },
23
23
  "devDependencies": {
24
- "@jonny/eslint-config": "3.0.276",
25
- "eslint": "8.42.0",
26
- "prettier": "3.1.1",
24
+ "@jonny/eslint-config": "3.0.281",
25
+ "eslint": "8.56.0",
26
+ "prettier": "3.2.5",
27
27
  "prettier-plugin-organize-imports": "3.2.4",
28
28
  "react": "18.2.0",
29
29
  "react-dom": "18.2.0",
30
30
  "vitest": "0.31.1",
31
31
  "@types/react": "18.2.48",
32
32
  "@types/react-dom": "18.2.18",
33
+ "@types/bun": "^1.0.12",
33
34
  "@vitejs/plugin-react": "^2.0.0",
34
- "rollup": "^2.70.1",
35
- "@rollup/plugin-typescript": "^8.2.0",
36
- "@remotion/test-utils": "4.0.137",
37
- "remotion": "4.0.137"
35
+ "remotion": "4.0.138",
36
+ "@remotion/test-utils": "4.0.138"
38
37
  },
39
38
  "peerDependencies": {
40
39
  "react": ">=16.8.0",
@@ -110,6 +109,6 @@
110
109
  "lint": "eslint src --ext ts,tsx",
111
110
  "formatting": "prettier src --check",
112
111
  "watch": "tsc -w",
113
- "build": "tsc -d && rollup --config rollup.config.js"
112
+ "build": "tsc -d && bun build.ts"
114
113
  }
115
114
  }
@@ -1,15 +0,0 @@
1
- import type { FC, PropsWithChildren } from 'react';
2
- import type { LayoutAndStyle, SequencePropsWithoutDuration } from 'remotion';
3
- import type { TransitionSeriesTransitionProps } from './types.js';
4
- declare const TransitionSeriesTransition: <PresentationProps extends Record<string, unknown>>(_props: TransitionSeriesTransitionProps<PresentationProps>) => null;
5
- type SeriesSequenceProps = PropsWithChildren<{
6
- durationInFrames: number;
7
- offset?: number;
8
- className?: number;
9
- } & LayoutAndStyle & Pick<SequencePropsWithoutDuration, 'name'>>;
10
- declare const SeriesSequence: ({ children }: SeriesSequenceProps) => JSX.Element;
11
- declare const TransitionSeries: FC<SequencePropsWithoutDuration> & {
12
- Sequence: typeof SeriesSequence;
13
- Transition: typeof TransitionSeriesTransition;
14
- };
15
- export { TransitionSeries };
package/dist/cjs/fade.js DELETED
@@ -1,25 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var react = require('react');
7
- var remotion = require('remotion');
8
-
9
- const FadePresentation = ({ children, presentationDirection, presentationProgress }) => {
10
- const isEntering = presentationDirection === 'entering';
11
- const style = react.useMemo(() => {
12
- return {
13
- opacity: isEntering ? presentationProgress : 1,
14
- };
15
- }, [isEntering, presentationProgress]);
16
- return (jsxRuntime.jsx(remotion.AbsoluteFill, { children: jsxRuntime.jsx(remotion.AbsoluteFill, { style: style, children: children }) }));
17
- };
18
- const fade = (props) => {
19
- return {
20
- component: FadePresentation,
21
- props: props !== null && props !== void 0 ? props : {},
22
- };
23
- };
24
-
25
- exports.fade = fade;
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const flattenChildren: (children: React.ReactNode) => (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | React.ReactPortal)[];
package/dist/cjs/flip.js DELETED
@@ -1,40 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var react = require('react');
7
- var remotion = require('remotion');
8
-
9
- const Flip = ({ children, presentationDirection, presentationProgress, passedProps: { direction = 'from-left', perspective = 1000 }, }) => {
10
- const style = react.useMemo(() => {
11
- const startRotationEntering = direction === 'from-right' || direction === 'from-top' ? 180 : -180;
12
- const endRotationEntering = direction === 'from-right' || direction === 'from-top' ? -180 : 180;
13
- const rotation = presentationDirection === 'entering'
14
- ? remotion.interpolate(presentationProgress, [0, 1], [startRotationEntering, 0])
15
- : remotion.interpolate(presentationProgress, [0, 1], [0, endRotationEntering]);
16
- const rotateProperty = direction === 'from-top' || direction === 'from-bottom'
17
- ? 'rotateX'
18
- : 'rotateY';
19
- return {
20
- width: '100%',
21
- height: '100%',
22
- transform: `${rotateProperty}(${rotation}deg)`,
23
- backfaceVisibility: 'hidden',
24
- WebkitBackfaceVisibility: 'hidden',
25
- };
26
- }, [direction, presentationDirection, presentationProgress]);
27
- const outer = react.useMemo(() => {
28
- return {
29
- perspective,
30
- // Make children also their backface hidden
31
- transformStyle: 'preserve-3d',
32
- };
33
- }, [perspective]);
34
- return (jsxRuntime.jsx(remotion.AbsoluteFill, { style: outer, children: jsxRuntime.jsx(remotion.AbsoluteFill, { style: style, children: children }) }));
35
- };
36
- const flip = (props) => {
37
- return { component: Flip, props: props !== null && props !== void 0 ? props : {} };
38
- };
39
-
40
- exports.flip = flip;
@@ -1,4 +0,0 @@
1
- export { linearTiming } from './timings/linear-timing.js';
2
- export { springTiming } from './timings/spring-timing.js';
3
- export { TransitionSeries } from './TransitionSeries.js';
4
- export { TransitionPresentation, TransitionPresentationComponentProps, TransitionTiming, } from './types.js';