remotion 4.0.473 → 4.0.475
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/CompositionManager.d.ts +1 -1
- package/dist/cjs/Img.d.ts +6 -0
- package/dist/cjs/Interactive.d.ts +56 -0
- package/dist/cjs/Interactive.js +119 -0
- package/dist/cjs/Sequence.d.ts +1 -1
- package/dist/cjs/SequenceManager.d.ts +13 -5
- package/dist/cjs/SequenceManager.js +23 -13
- package/dist/cjs/animated-image/AnimatedImage.js +1 -1
- package/dist/cjs/calculate-media-duration.js +1 -1
- package/dist/cjs/canvas-image/CanvasImage.d.ts +6 -0
- package/dist/cjs/effects/use-memoized-effects.d.ts +5 -5
- package/dist/cjs/effects/use-memoized-effects.js +32 -21
- package/dist/cjs/get-effective-visual-mode-value.d.ts +2 -2
- package/dist/cjs/get-effective-visual-mode-value.js +11 -8
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/internals.d.ts +30 -10
- package/dist/cjs/internals.js +5 -3
- package/dist/cjs/interpolate-colors.d.ts +2 -3
- package/dist/cjs/interpolate-colors.js +1 -0
- package/dist/cjs/interpolate-keyframed-status.js +1 -0
- package/dist/cjs/interpolate.js +147 -0
- package/dist/cjs/no-react.d.ts +6 -0
- package/dist/cjs/sequence-field-schema.d.ts +32 -1
- package/dist/cjs/sequence-field-schema.js +6 -0
- package/dist/cjs/use-media-in-timeline.d.ts +1 -1
- package/dist/cjs/use-schema.d.ts +3 -4
- package/dist/cjs/use-schema.js +6 -6
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wrap-in-schema.js +3 -3
- package/dist/cjs/wrap-remotion-context.d.ts +2 -0
- package/dist/cjs/wrap-remotion-context.js +7 -1
- package/dist/esm/index.mjs +465 -183
- package/dist/esm/no-react.mjs +139 -0
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
|
@@ -71,7 +71,7 @@ export type TSequence = {
|
|
|
71
71
|
premountDisplay: number | null;
|
|
72
72
|
postmountDisplay: number | null;
|
|
73
73
|
controls: SequenceControls | null;
|
|
74
|
-
refForOutline: React.RefObject<
|
|
74
|
+
refForOutline: React.RefObject<Element | null> | null;
|
|
75
75
|
effects: readonly EffectDefinition<unknown>[];
|
|
76
76
|
isInsideSeries: boolean;
|
|
77
77
|
} & EnhancedTSequenceData;
|
package/dist/cjs/Img.d.ts
CHANGED
|
@@ -18,6 +18,12 @@ export type ImgProps = NativeImgProps & {
|
|
|
18
18
|
readonly stack?: string;
|
|
19
19
|
} & Pick<SequenceProps, 'durationInFrames' | 'from' | 'hidden'>;
|
|
20
20
|
export declare const imgSchema: {
|
|
21
|
+
readonly 'style.transformOrigin': {
|
|
22
|
+
readonly type: "transform-origin";
|
|
23
|
+
readonly step: 1;
|
|
24
|
+
readonly default: "50% 50%";
|
|
25
|
+
readonly description: "Transform origin";
|
|
26
|
+
};
|
|
21
27
|
readonly 'style.translate': {
|
|
22
28
|
readonly type: "translate";
|
|
23
29
|
readonly step: 1;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SequenceProps } from './Sequence.js';
|
|
3
|
+
type InteractiveHtmlTag = 'a' | 'article' | 'aside' | 'button' | 'code' | 'div' | 'em' | 'footer' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'header' | 'label' | 'li' | 'main' | 'nav' | 'ol' | 'p' | 'pre' | 'section' | 'small' | 'span' | 'strong' | 'ul';
|
|
4
|
+
type InteractiveSvgTag = 'circle' | 'ellipse' | 'g' | 'line' | 'path' | 'rect' | 'svg' | 'text';
|
|
5
|
+
type InteractiveTag = InteractiveHtmlTag | InteractiveSvgTag;
|
|
6
|
+
type ElementForTag<Tag extends InteractiveTag> = Tag extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[Tag] : Tag extends keyof SVGElementTagNameMap ? SVGElementTagNameMap[Tag] : Element;
|
|
7
|
+
type InteractiveSequenceProps = Pick<SequenceProps, 'durationInFrames' | 'from' | 'hidden' | 'name' | 'showInTimeline'> & {
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated For internal use only
|
|
10
|
+
*/
|
|
11
|
+
readonly stack?: string;
|
|
12
|
+
};
|
|
13
|
+
type InteractiveElementProps<Tag extends InteractiveTag> = Omit<React.ComponentPropsWithoutRef<Tag>, keyof InteractiveSequenceProps> & InteractiveSequenceProps;
|
|
14
|
+
type InteractiveElementComponent<Tag extends InteractiveTag> = React.ComponentType<InteractiveElementProps<Tag> & React.RefAttributes<ElementForTag<Tag>>>;
|
|
15
|
+
/**
|
|
16
|
+
* @description HTML and SVG elements that are registered in the Remotion Studio timeline and can be visually edited.
|
|
17
|
+
*/
|
|
18
|
+
export declare const Interactive: {
|
|
19
|
+
A: InteractiveElementComponent<"a">;
|
|
20
|
+
Article: InteractiveElementComponent<"article">;
|
|
21
|
+
Aside: InteractiveElementComponent<"aside">;
|
|
22
|
+
Button: InteractiveElementComponent<"button">;
|
|
23
|
+
Circle: InteractiveElementComponent<"circle">;
|
|
24
|
+
Code: InteractiveElementComponent<"code">;
|
|
25
|
+
Div: InteractiveElementComponent<"div">;
|
|
26
|
+
Ellipse: InteractiveElementComponent<"ellipse">;
|
|
27
|
+
Em: InteractiveElementComponent<"em">;
|
|
28
|
+
Footer: InteractiveElementComponent<"footer">;
|
|
29
|
+
G: InteractiveElementComponent<"g">;
|
|
30
|
+
H1: InteractiveElementComponent<"h1">;
|
|
31
|
+
H2: InteractiveElementComponent<"h2">;
|
|
32
|
+
H3: InteractiveElementComponent<"h3">;
|
|
33
|
+
H4: InteractiveElementComponent<"h4">;
|
|
34
|
+
H5: InteractiveElementComponent<"h5">;
|
|
35
|
+
H6: InteractiveElementComponent<"h6">;
|
|
36
|
+
Header: InteractiveElementComponent<"header">;
|
|
37
|
+
Label: InteractiveElementComponent<"label">;
|
|
38
|
+
Li: InteractiveElementComponent<"li">;
|
|
39
|
+
Line: InteractiveElementComponent<"line">;
|
|
40
|
+
Main: InteractiveElementComponent<"main">;
|
|
41
|
+
Nav: InteractiveElementComponent<"nav">;
|
|
42
|
+
Ol: InteractiveElementComponent<"ol">;
|
|
43
|
+
P: InteractiveElementComponent<"p">;
|
|
44
|
+
Path: InteractiveElementComponent<"path">;
|
|
45
|
+
Pre: InteractiveElementComponent<"pre">;
|
|
46
|
+
Rect: InteractiveElementComponent<"rect">;
|
|
47
|
+
Section: InteractiveElementComponent<"section">;
|
|
48
|
+
Small: InteractiveElementComponent<"small">;
|
|
49
|
+
Span: InteractiveElementComponent<"span">;
|
|
50
|
+
Strong: InteractiveElementComponent<"strong">;
|
|
51
|
+
Svg: InteractiveElementComponent<"svg">;
|
|
52
|
+
Text: InteractiveElementComponent<"text">;
|
|
53
|
+
Ul: InteractiveElementComponent<"ul">;
|
|
54
|
+
};
|
|
55
|
+
export type InteractiveProps<Tag extends InteractiveTag> = InteractiveElementProps<Tag>;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Interactive = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
|
|
40
|
+
const sequence_field_schema_js_1 = require("./sequence-field-schema.js");
|
|
41
|
+
const Sequence_js_1 = require("./Sequence.js");
|
|
42
|
+
const wrap_in_schema_js_1 = require("./wrap-in-schema.js");
|
|
43
|
+
const interactiveElementSchema = {
|
|
44
|
+
durationInFrames: sequence_field_schema_js_1.durationInFramesField,
|
|
45
|
+
from: sequence_field_schema_js_1.fromField,
|
|
46
|
+
...sequence_field_schema_js_1.sequenceVisualStyleSchema,
|
|
47
|
+
hidden: sequence_field_schema_js_1.hiddenField,
|
|
48
|
+
};
|
|
49
|
+
const setRef = (ref, value) => {
|
|
50
|
+
if (typeof ref === 'function') {
|
|
51
|
+
ref(value);
|
|
52
|
+
}
|
|
53
|
+
else if (ref) {
|
|
54
|
+
ref.current = value;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const makeInteractiveElement = (tag, displayName) => {
|
|
58
|
+
const Inner = (0, react_1.forwardRef)((propsWithControls, ref) => {
|
|
59
|
+
const { durationInFrames, from, hidden, name, showInTimeline, stack, _experimentalControls, ...props } = propsWithControls;
|
|
60
|
+
const refForOutline = (0, react_1.useRef)(null);
|
|
61
|
+
const callbackRef = (0, react_1.useCallback)((element) => {
|
|
62
|
+
refForOutline.current = element;
|
|
63
|
+
setRef(ref, element);
|
|
64
|
+
}, [ref]);
|
|
65
|
+
return (jsx_runtime_1.jsx(Sequence_js_1.Sequence, { layout: "none", from: from !== null && from !== void 0 ? from : 0, durationInFrames: durationInFrames !== null && durationInFrames !== void 0 ? durationInFrames : Infinity, hidden: hidden, name: name !== null && name !== void 0 ? name : displayName, showInTimeline: showInTimeline !== null && showInTimeline !== void 0 ? showInTimeline : true, _experimentalControls: _experimentalControls, _remotionInternalStack: stack, _remotionInternalRefForOutline: refForOutline, children: react_1.default.createElement(tag, {
|
|
66
|
+
...props,
|
|
67
|
+
ref: callbackRef,
|
|
68
|
+
}) }));
|
|
69
|
+
});
|
|
70
|
+
Inner.displayName = displayName;
|
|
71
|
+
const Wrapped = (0, wrap_in_schema_js_1.wrapInSchema)({
|
|
72
|
+
Component: Inner,
|
|
73
|
+
schema: interactiveElementSchema,
|
|
74
|
+
supportsEffects: false,
|
|
75
|
+
});
|
|
76
|
+
Wrapped.displayName = displayName;
|
|
77
|
+
(0, enable_sequence_stack_traces_js_1.addSequenceStackTraces)(Wrapped);
|
|
78
|
+
return Wrapped;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* @description HTML and SVG elements that are registered in the Remotion Studio timeline and can be visually edited.
|
|
82
|
+
*/
|
|
83
|
+
exports.Interactive = {
|
|
84
|
+
A: makeInteractiveElement('a', '<Interactive.A>'),
|
|
85
|
+
Article: makeInteractiveElement('article', '<Interactive.Article>'),
|
|
86
|
+
Aside: makeInteractiveElement('aside', '<Interactive.Aside>'),
|
|
87
|
+
Button: makeInteractiveElement('button', '<Interactive.Button>'),
|
|
88
|
+
Circle: makeInteractiveElement('circle', '<Interactive.Circle>'),
|
|
89
|
+
Code: makeInteractiveElement('code', '<Interactive.Code>'),
|
|
90
|
+
Div: makeInteractiveElement('div', '<Interactive.Div>'),
|
|
91
|
+
Ellipse: makeInteractiveElement('ellipse', '<Interactive.Ellipse>'),
|
|
92
|
+
Em: makeInteractiveElement('em', '<Interactive.Em>'),
|
|
93
|
+
Footer: makeInteractiveElement('footer', '<Interactive.Footer>'),
|
|
94
|
+
G: makeInteractiveElement('g', '<Interactive.G>'),
|
|
95
|
+
H1: makeInteractiveElement('h1', '<Interactive.H1>'),
|
|
96
|
+
H2: makeInteractiveElement('h2', '<Interactive.H2>'),
|
|
97
|
+
H3: makeInteractiveElement('h3', '<Interactive.H3>'),
|
|
98
|
+
H4: makeInteractiveElement('h4', '<Interactive.H4>'),
|
|
99
|
+
H5: makeInteractiveElement('h5', '<Interactive.H5>'),
|
|
100
|
+
H6: makeInteractiveElement('h6', '<Interactive.H6>'),
|
|
101
|
+
Header: makeInteractiveElement('header', '<Interactive.Header>'),
|
|
102
|
+
Label: makeInteractiveElement('label', '<Interactive.Label>'),
|
|
103
|
+
Li: makeInteractiveElement('li', '<Interactive.Li>'),
|
|
104
|
+
Line: makeInteractiveElement('line', '<Interactive.Line>'),
|
|
105
|
+
Main: makeInteractiveElement('main', '<Interactive.Main>'),
|
|
106
|
+
Nav: makeInteractiveElement('nav', '<Interactive.Nav>'),
|
|
107
|
+
Ol: makeInteractiveElement('ol', '<Interactive.Ol>'),
|
|
108
|
+
P: makeInteractiveElement('p', '<Interactive.P>'),
|
|
109
|
+
Path: makeInteractiveElement('path', '<Interactive.Path>'),
|
|
110
|
+
Pre: makeInteractiveElement('pre', '<Interactive.Pre>'),
|
|
111
|
+
Rect: makeInteractiveElement('rect', '<Interactive.Rect>'),
|
|
112
|
+
Section: makeInteractiveElement('section', '<Interactive.Section>'),
|
|
113
|
+
Small: makeInteractiveElement('small', '<Interactive.Small>'),
|
|
114
|
+
Span: makeInteractiveElement('span', '<Interactive.Span>'),
|
|
115
|
+
Strong: makeInteractiveElement('strong', '<Interactive.Strong>'),
|
|
116
|
+
Svg: makeInteractiveElement('svg', '<Interactive.Svg>'),
|
|
117
|
+
Text: makeInteractiveElement('text', '<Interactive.Text>'),
|
|
118
|
+
Ul: makeInteractiveElement('ul', '<Interactive.Ul>'),
|
|
119
|
+
};
|
package/dist/cjs/Sequence.d.ts
CHANGED
|
@@ -65,7 +65,7 @@ export type SequencePropsWithoutDuration = {
|
|
|
65
65
|
/**
|
|
66
66
|
* @deprecated For internal use only.
|
|
67
67
|
*/
|
|
68
|
-
readonly _remotionInternalRefForOutline?: React.RefObject<
|
|
68
|
+
readonly _remotionInternalRefForOutline?: React.RefObject<Element | null> | null;
|
|
69
69
|
} & LayoutAndStyle;
|
|
70
70
|
export type SequenceProps = {
|
|
71
71
|
readonly durationInFrames?: number;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { TSequence } from './CompositionManager.js';
|
|
3
|
-
import type { CanUpdateSequencePropStatus,
|
|
3
|
+
import type { CanUpdateSequencePropStatus, DragOverrideValue, GetDragOverrides, GetEffectDragOverrides, PropStatuses } from './use-schema.js';
|
|
4
4
|
export type SequenceManagerContext = {
|
|
5
5
|
registerSequence: (seq: TSequence) => void;
|
|
6
6
|
unregisterSequence: (id: string) => void;
|
|
7
7
|
sequences: TSequence[];
|
|
8
8
|
};
|
|
9
|
+
export type SequenceManagerRef = {
|
|
10
|
+
current: TSequence[];
|
|
11
|
+
};
|
|
9
12
|
export type SequenceNodePath = Array<string | number>;
|
|
10
13
|
export declare const SequenceManager: React.Context<SequenceManagerContext>;
|
|
11
|
-
export
|
|
12
|
-
|
|
14
|
+
export declare const SequenceManagerRefContext: React.Context<SequenceManagerRef>;
|
|
15
|
+
export type VisualModePropStatuses = {
|
|
16
|
+
propStatuses: PropStatuses;
|
|
17
|
+
};
|
|
18
|
+
export type VisualModePropStatusesRef = {
|
|
19
|
+
current: PropStatuses;
|
|
13
20
|
};
|
|
14
21
|
export type VisualModeDragOverrides = {
|
|
15
22
|
getDragOverrides: GetDragOverrides;
|
|
@@ -20,7 +27,7 @@ export type VisualModeSetters = {
|
|
|
20
27
|
clearDragOverrides: (nodePath: SequencePropsSubscriptionKey) => void;
|
|
21
28
|
setEffectDragOverrides: (nodePath: SequencePropsSubscriptionKey, effectIndex: number, key: string, value: DragOverrideValue) => void;
|
|
22
29
|
clearEffectDragOverrides: (nodePath: SequencePropsSubscriptionKey, effectIndex: number) => void;
|
|
23
|
-
|
|
30
|
+
setPropStatuses: (nodePath: SequencePropsSubscriptionKey, values: (prev: CanUpdateSequencePropsResponse) => CanUpdateSequencePropsResponse) => void;
|
|
24
31
|
};
|
|
25
32
|
export type CanUpdateEffectPropsResponseTrue = {
|
|
26
33
|
canUpdate: true;
|
|
@@ -48,7 +55,8 @@ export type CanUpdateSequencePropsResponseFalse = {
|
|
|
48
55
|
};
|
|
49
56
|
export type CanUpdateSequencePropsResponse = CanUpdateSequencePropsResponseTrue | CanUpdateSequencePropsResponseFalse;
|
|
50
57
|
export declare const makeSequencePropsSubscriptionKey: (key: SequencePropsSubscriptionKey) => string;
|
|
51
|
-
export declare const
|
|
58
|
+
export declare const VisualModePropStatusesContext: React.Context<VisualModePropStatuses>;
|
|
59
|
+
export declare const VisualModePropStatusesRefContext: React.Context<VisualModePropStatusesRef>;
|
|
52
60
|
export declare const VisualModeDragOverridesContext: React.Context<VisualModeDragOverrides>;
|
|
53
61
|
export declare const VisualModeSettersContext: React.Context<VisualModeSetters>;
|
|
54
62
|
export type SequencePropsSubscriptionKey = {
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.SequenceManagerProvider = exports.VisualModeSettersContext = exports.VisualModeDragOverridesContext = exports.
|
|
36
|
+
exports.SequenceManagerProvider = exports.VisualModeSettersContext = exports.VisualModeDragOverridesContext = exports.VisualModePropStatusesRefContext = exports.VisualModePropStatusesContext = exports.makeSequencePropsSubscriptionKey = exports.SequenceManagerRefContext = exports.SequenceManager = void 0;
|
|
37
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
39
|
exports.SequenceManager = react_1.default.createContext({
|
|
@@ -45,12 +45,18 @@ exports.SequenceManager = react_1.default.createContext({
|
|
|
45
45
|
},
|
|
46
46
|
sequences: [],
|
|
47
47
|
});
|
|
48
|
+
exports.SequenceManagerRefContext = react_1.default.createContext({
|
|
49
|
+
current: [],
|
|
50
|
+
});
|
|
48
51
|
const makeSequencePropsSubscriptionKey = (key) => {
|
|
49
52
|
return `${key.nodePath.join('.')}.${key.sequenceKeys.join('.')}.${key.effectKeys.map((keys) => keys.join('.')).join('.')}`;
|
|
50
53
|
};
|
|
51
54
|
exports.makeSequencePropsSubscriptionKey = makeSequencePropsSubscriptionKey;
|
|
52
|
-
exports.
|
|
53
|
-
|
|
55
|
+
exports.VisualModePropStatusesContext = react_1.default.createContext({
|
|
56
|
+
propStatuses: {},
|
|
57
|
+
});
|
|
58
|
+
exports.VisualModePropStatusesRefContext = react_1.default.createContext({
|
|
59
|
+
current: {},
|
|
54
60
|
});
|
|
55
61
|
exports.VisualModeDragOverridesContext = react_1.default.createContext({
|
|
56
62
|
getDragOverrides: () => {
|
|
@@ -73,18 +79,22 @@ exports.VisualModeSettersContext = react_1.default.createContext({
|
|
|
73
79
|
clearEffectDragOverrides: () => {
|
|
74
80
|
throw new Error('VisualModeSettersContext not initialized');
|
|
75
81
|
},
|
|
76
|
-
|
|
82
|
+
setPropStatuses: () => {
|
|
77
83
|
throw new Error('VisualModeSettersContext not initialized');
|
|
78
84
|
},
|
|
79
85
|
});
|
|
80
86
|
const effectDragOverridesKey = (nodePath, effectIndex) => `${(0, exports.makeSequencePropsSubscriptionKey)(nodePath)}.effects.${effectIndex}`;
|
|
81
87
|
const SequenceManagerProvider = ({ children }) => {
|
|
82
88
|
const [sequences, setSequences] = (0, react_1.useState)([]);
|
|
89
|
+
const sequencesRef = (0, react_1.useRef)(sequences);
|
|
90
|
+
sequencesRef.current = sequences;
|
|
83
91
|
const [dragOverrides, setControlOverrides] = (0, react_1.useState)({});
|
|
84
92
|
const controlOverridesRef = (0, react_1.useRef)(dragOverrides);
|
|
85
93
|
controlOverridesRef.current = dragOverrides;
|
|
86
94
|
const [effectDragOverridesState, setEffectDragOverridesState] = (0, react_1.useState)({});
|
|
87
|
-
const [
|
|
95
|
+
const [propStatuses, setPropStatusesMapState] = (0, react_1.useState)({});
|
|
96
|
+
const propStatusesRef = (0, react_1.useRef)(propStatuses);
|
|
97
|
+
propStatusesRef.current = propStatuses;
|
|
88
98
|
const setDragOverrides = (0, react_1.useCallback)((nodePath, key, value) => {
|
|
89
99
|
setControlOverrides((prev) => ({
|
|
90
100
|
...prev,
|
|
@@ -128,8 +138,8 @@ const SequenceManagerProvider = ({ children }) => {
|
|
|
128
138
|
return next;
|
|
129
139
|
});
|
|
130
140
|
}, []);
|
|
131
|
-
const
|
|
132
|
-
|
|
141
|
+
const setPropStatuses = (0, react_1.useCallback)((nodePath, values) => {
|
|
142
|
+
setPropStatusesMapState((prev) => {
|
|
133
143
|
const key = (0, exports.makeSequencePropsSubscriptionKey)(nodePath);
|
|
134
144
|
const prevKey = prev[key];
|
|
135
145
|
const newKey = values(prevKey);
|
|
@@ -162,11 +172,11 @@ const SequenceManagerProvider = ({ children }) => {
|
|
|
162
172
|
var _a;
|
|
163
173
|
return ((_a = effectDragOverridesState[effectDragOverridesKey(nodePath, effectIndex)]) !== null && _a !== void 0 ? _a : {});
|
|
164
174
|
}, [effectDragOverridesState]);
|
|
165
|
-
const
|
|
175
|
+
const propStatusesContext = (0, react_1.useMemo)(() => {
|
|
166
176
|
return {
|
|
167
|
-
|
|
177
|
+
propStatuses,
|
|
168
178
|
};
|
|
169
|
-
}, [
|
|
179
|
+
}, [propStatuses]);
|
|
170
180
|
const dragOverridesContext = (0, react_1.useMemo)(() => {
|
|
171
181
|
return {
|
|
172
182
|
getDragOverrides,
|
|
@@ -179,15 +189,15 @@ const SequenceManagerProvider = ({ children }) => {
|
|
|
179
189
|
clearDragOverrides,
|
|
180
190
|
setEffectDragOverrides,
|
|
181
191
|
clearEffectDragOverrides,
|
|
182
|
-
|
|
192
|
+
setPropStatuses,
|
|
183
193
|
};
|
|
184
194
|
}, [
|
|
185
195
|
setDragOverrides,
|
|
186
196
|
clearDragOverrides,
|
|
187
197
|
setEffectDragOverrides,
|
|
188
198
|
clearEffectDragOverrides,
|
|
189
|
-
|
|
199
|
+
setPropStatuses,
|
|
190
200
|
]);
|
|
191
|
-
return (jsx_runtime_1.jsx(exports.SequenceManager.Provider, { value: sequenceContext, children: jsx_runtime_1.jsx(exports.
|
|
201
|
+
return (jsx_runtime_1.jsx(exports.SequenceManagerRefContext.Provider, { value: sequencesRef, children: jsx_runtime_1.jsx(exports.SequenceManager.Provider, { value: sequenceContext, children: jsx_runtime_1.jsx(exports.VisualModePropStatusesRefContext.Provider, { value: propStatusesRef, children: jsx_runtime_1.jsx(exports.VisualModePropStatusesContext.Provider, { value: propStatusesContext, children: jsx_runtime_1.jsx(exports.VisualModeDragOverridesContext.Provider, { value: dragOverridesContext, children: jsx_runtime_1.jsx(exports.VisualModeSettersContext.Provider, { value: settersContext, children: children }) }) }) }) }) }));
|
|
192
202
|
};
|
|
193
203
|
exports.SequenceManagerProvider = SequenceManagerProvider;
|
|
@@ -12,6 +12,6 @@ const calculateMediaDuration = ({ trimAfter, mediaDurationInFrames, playbackRate
|
|
|
12
12
|
duration -= trimBefore;
|
|
13
13
|
}
|
|
14
14
|
const actualDuration = duration / playbackRate;
|
|
15
|
-
return
|
|
15
|
+
return Number(actualDuration.toFixed(10));
|
|
16
16
|
};
|
|
17
17
|
exports.calculateMediaDuration = calculateMediaDuration;
|
|
@@ -2,6 +2,12 @@ import { type RefObject } from 'react';
|
|
|
2
2
|
import type { EffectsProp } from '../effects/effect-types.js';
|
|
3
3
|
import type { CanvasImageCanvasProps } from './props.js';
|
|
4
4
|
export declare const canvasImageSchema: {
|
|
5
|
+
readonly 'style.transformOrigin': {
|
|
6
|
+
readonly type: "transform-origin";
|
|
7
|
+
readonly step: 1;
|
|
8
|
+
readonly default: "50% 50%";
|
|
9
|
+
readonly description: "Transform origin";
|
|
10
|
+
};
|
|
5
11
|
readonly 'style.translate': {
|
|
6
12
|
readonly type: "translate";
|
|
7
13
|
readonly step: 1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CannotUpdateEffectReason, CannotUpdateSequenceReason } from '../SequenceManager.js';
|
|
2
2
|
import { type SequencePropsSubscriptionKey } from '../SequenceManager.js';
|
|
3
|
-
import { type CanUpdateSequencePropStatus, type
|
|
3
|
+
import { type CanUpdateSequencePropStatus, type PropStatuses } from '../use-schema.js';
|
|
4
4
|
import type { EffectDefinition, EffectDefinitionAndStack, EffectDescriptor } from './effect-types.js';
|
|
5
5
|
export declare const useMemoizedEffectDefinitions: (effects: readonly EffectDescriptor<unknown>[]) => readonly EffectDefinition<unknown>[];
|
|
6
6
|
type EffectStatus = {
|
|
@@ -13,13 +13,13 @@ type EffectStatus = {
|
|
|
13
13
|
type: 'can-update-effect';
|
|
14
14
|
props: Record<string, CanUpdateSequencePropStatus>;
|
|
15
15
|
};
|
|
16
|
-
export declare const
|
|
17
|
-
|
|
16
|
+
export declare const getEffectPropStatusesCtx: ({ propStatuses, nodePath, effectIndex, }: {
|
|
17
|
+
propStatuses: PropStatuses;
|
|
18
18
|
nodePath: SequencePropsSubscriptionKey;
|
|
19
19
|
effectIndex: number;
|
|
20
20
|
}) => EffectStatus;
|
|
21
|
-
export declare const
|
|
22
|
-
export type
|
|
21
|
+
export declare const getPropStatusesCtx: (propStatuses: PropStatuses, nodePath: SequencePropsSubscriptionKey) => Record<string, CanUpdateSequencePropStatus> | undefined;
|
|
22
|
+
export type GetPropStatusesType = typeof getPropStatusesCtx;
|
|
23
23
|
export declare const useMemoizedEffects: ({ effects, overrideId, }: {
|
|
24
24
|
effects: readonly EffectDescriptor<unknown>[];
|
|
25
25
|
readonly overrideId: string | null;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useMemoizedEffects = exports.
|
|
3
|
+
exports.useMemoizedEffects = exports.getPropStatusesCtx = exports.getEffectPropStatusesCtx = exports.useMemoizedEffectDefinitions = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const get_effective_visual_mode_value_js_1 = require("../get-effective-visual-mode-value.js");
|
|
6
|
+
const interpolate_keyframed_status_js_1 = require("../interpolate-keyframed-status.js");
|
|
6
7
|
const sequence_node_path_js_1 = require("../sequence-node-path.js");
|
|
7
8
|
const SequenceManager_js_1 = require("../SequenceManager.js");
|
|
8
|
-
const SequenceManager_js_2 = require("../SequenceManager.js");
|
|
9
9
|
const use_current_frame_js_1 = require("../use-current-frame.js");
|
|
10
|
-
const mergeOverrides = ({ descriptor,
|
|
11
|
-
if (!
|
|
10
|
+
const mergeOverrides = ({ descriptor, propStatusOverrides, dragOverrides, frame, }) => {
|
|
11
|
+
if (!propStatusOverrides && !dragOverrides) {
|
|
12
12
|
return { params: descriptor.params, effectKey: descriptor.effectKey };
|
|
13
13
|
}
|
|
14
14
|
const merged = {
|
|
15
15
|
...descriptor.params,
|
|
16
16
|
};
|
|
17
|
-
if (
|
|
18
|
-
for (const [key, value] of Object.entries(
|
|
17
|
+
if (propStatusOverrides) {
|
|
18
|
+
for (const [key, value] of Object.entries(propStatusOverrides)) {
|
|
19
19
|
if (value !== undefined) {
|
|
20
20
|
merged[key] = value;
|
|
21
21
|
}
|
|
@@ -37,16 +37,27 @@ const mergeOverrides = ({ descriptor, codeOverrides, dragOverrides, frame, }) =>
|
|
|
37
37
|
effectKey: descriptor.definition.calculateKey(merged),
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
|
-
const
|
|
40
|
+
const resolvePropStatusOverrides = (propStatus, frame) => {
|
|
41
41
|
if (!propStatus) {
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
44
|
const out = {};
|
|
45
45
|
let hasAny = false;
|
|
46
46
|
for (const [key, status] of Object.entries(propStatus)) {
|
|
47
|
-
if (status.status
|
|
47
|
+
if (status.status === 'static') {
|
|
48
48
|
out[key] = status.codeValue;
|
|
49
49
|
hasAny = true;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (status.status === 'keyframed') {
|
|
53
|
+
const value = (0, interpolate_keyframed_status_js_1.interpolateKeyframedStatus)({
|
|
54
|
+
frame,
|
|
55
|
+
status,
|
|
56
|
+
});
|
|
57
|
+
if (value !== null) {
|
|
58
|
+
out[key] = value;
|
|
59
|
+
hasAny = true;
|
|
60
|
+
}
|
|
50
61
|
}
|
|
51
62
|
}
|
|
52
63
|
return hasAny ? out : null;
|
|
@@ -65,8 +76,8 @@ const useMemoizedEffectDefinitions = (effects) => {
|
|
|
65
76
|
return definitions;
|
|
66
77
|
};
|
|
67
78
|
exports.useMemoizedEffectDefinitions = useMemoizedEffectDefinitions;
|
|
68
|
-
const
|
|
69
|
-
const status =
|
|
79
|
+
const getEffectPropStatusesCtx = ({ propStatuses, nodePath, effectIndex, }) => {
|
|
80
|
+
const status = propStatuses[(0, SequenceManager_js_1.makeSequencePropsSubscriptionKey)(nodePath)];
|
|
70
81
|
if (!status) {
|
|
71
82
|
return { type: 'cannot-update-sequence', reason: 'not-found' };
|
|
72
83
|
}
|
|
@@ -82,9 +93,9 @@ const getEffectCodeValuesCtx = ({ codeValues, nodePath, effectIndex, }) => {
|
|
|
82
93
|
}
|
|
83
94
|
return { type: 'can-update-effect', props: effect.props };
|
|
84
95
|
};
|
|
85
|
-
exports.
|
|
86
|
-
const
|
|
87
|
-
const status =
|
|
96
|
+
exports.getEffectPropStatusesCtx = getEffectPropStatusesCtx;
|
|
97
|
+
const getPropStatusesCtx = (propStatuses, nodePath) => {
|
|
98
|
+
const status = propStatuses[(0, SequenceManager_js_1.makeSequencePropsSubscriptionKey)(nodePath)];
|
|
88
99
|
if (!status) {
|
|
89
100
|
return undefined;
|
|
90
101
|
}
|
|
@@ -93,12 +104,12 @@ const getCodeValuesCtx = (codeValues, nodePath) => {
|
|
|
93
104
|
}
|
|
94
105
|
return status.props;
|
|
95
106
|
};
|
|
96
|
-
exports.
|
|
107
|
+
exports.getPropStatusesCtx = getPropStatusesCtx;
|
|
97
108
|
const useMemoizedEffects = ({ effects, overrideId, }) => {
|
|
98
109
|
var _a;
|
|
99
110
|
const previousRef = (0, react_1.useRef)(null);
|
|
100
|
-
const {
|
|
101
|
-
const { getEffectDragOverrides } = (0, react_1.useContext)(
|
|
111
|
+
const { propStatuses } = (0, react_1.useContext)(SequenceManager_js_1.VisualModePropStatusesContext);
|
|
112
|
+
const { getEffectDragOverrides } = (0, react_1.useContext)(SequenceManager_js_1.VisualModeDragOverridesContext);
|
|
102
113
|
const frame = (0, use_current_frame_js_1.useCurrentFrame)();
|
|
103
114
|
const { overrideIdToNodePathMappings } = (0, react_1.useContext)(sequence_node_path_js_1.OverrideIdsToNodePathsGettersContext);
|
|
104
115
|
const previous = previousRef.current;
|
|
@@ -113,19 +124,19 @@ const useMemoizedEffects = ({ effects, overrideId, }) => {
|
|
|
113
124
|
effectKey: descriptor.effectKey,
|
|
114
125
|
};
|
|
115
126
|
}
|
|
116
|
-
const effectStatus = (0, exports.
|
|
117
|
-
|
|
127
|
+
const effectStatus = (0, exports.getEffectPropStatusesCtx)({
|
|
128
|
+
propStatuses,
|
|
118
129
|
nodePath,
|
|
119
130
|
effectIndex: index,
|
|
120
131
|
});
|
|
121
|
-
const
|
|
122
|
-
?
|
|
132
|
+
const propStatusOverrides = effectStatus.type === 'can-update-effect'
|
|
133
|
+
? resolvePropStatusOverrides(effectStatus.props, frame)
|
|
123
134
|
: null;
|
|
124
135
|
const dragOverridesMap = getEffectDragOverrides(nodePath, index);
|
|
125
136
|
const dragOverrides = Object.keys(dragOverridesMap).length === 0 ? null : dragOverridesMap;
|
|
126
137
|
const { params, effectKey } = mergeOverrides({
|
|
127
138
|
descriptor,
|
|
128
|
-
|
|
139
|
+
propStatusOverrides,
|
|
129
140
|
dragOverrides,
|
|
130
141
|
frame,
|
|
131
142
|
});
|
|
@@ -9,8 +9,8 @@ export declare const resolveDragOverrideValue: ({ dragOverrideValue, frame, }: {
|
|
|
9
9
|
dragOverrideValue: DragOverrideValue | undefined;
|
|
10
10
|
frame: number | null;
|
|
11
11
|
}) => ResolvedDragOverrideValue;
|
|
12
|
-
export declare const getEffectiveVisualModeValue: ({
|
|
13
|
-
|
|
12
|
+
export declare const getEffectiveVisualModeValue: ({ propStatus, dragOverrideValue, defaultValue, frame, shouldResortToDefaultValueIfUndefined, }: {
|
|
13
|
+
propStatus: CanUpdateSequencePropStatusKeyframed | CanUpdateSequencePropStatusStatic;
|
|
14
14
|
dragOverrideValue: DragOverrideValue | undefined;
|
|
15
15
|
defaultValue: unknown;
|
|
16
16
|
frame?: number | null | undefined;
|
|
@@ -22,7 +22,7 @@ const resolveDragOverrideValue = ({ dragOverrideValue, frame, }) => {
|
|
|
22
22
|
return { type: 'resolved', value: interpolated };
|
|
23
23
|
};
|
|
24
24
|
exports.resolveDragOverrideValue = resolveDragOverrideValue;
|
|
25
|
-
const getEffectiveVisualModeValue = ({
|
|
25
|
+
const getEffectiveVisualModeValue = ({ propStatus, dragOverrideValue, defaultValue, frame = null, shouldResortToDefaultValueIfUndefined = false, }) => {
|
|
26
26
|
const dragOverride = (0, exports.resolveDragOverrideValue)({
|
|
27
27
|
dragOverrideValue,
|
|
28
28
|
frame,
|
|
@@ -30,16 +30,19 @@ const getEffectiveVisualModeValue = ({ codeValue, dragOverrideValue, defaultValu
|
|
|
30
30
|
if (dragOverride.type === 'resolved' && dragOverride.value !== undefined) {
|
|
31
31
|
return dragOverride.value;
|
|
32
32
|
}
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
if (propStatus.status === 'keyframed') {
|
|
34
|
+
if (frame !== null) {
|
|
35
|
+
return (0, interpolate_keyframed_status_1.interpolateKeyframedStatus)({
|
|
36
|
+
frame,
|
|
37
|
+
status: propStatus,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return shouldResortToDefaultValueIfUndefined ? defaultValue : undefined;
|
|
38
41
|
}
|
|
39
|
-
if (
|
|
42
|
+
if (propStatus.codeValue === undefined &&
|
|
40
43
|
shouldResortToDefaultValueIfUndefined) {
|
|
41
44
|
return defaultValue;
|
|
42
45
|
}
|
|
43
|
-
return
|
|
46
|
+
return propStatus.codeValue;
|
|
44
47
|
};
|
|
45
48
|
exports.getEffectiveVisualModeValue = getEffectiveVisualModeValue;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -127,6 +127,7 @@ export { getRemotionEnvironment } from './get-remotion-environment.js';
|
|
|
127
127
|
export { getStaticFiles, StaticFile } from './get-static-files.js';
|
|
128
128
|
export * from './IFrame.js';
|
|
129
129
|
export { Img, ImgProps } from './Img.js';
|
|
130
|
+
export { Interactive, type InteractiveProps } from './Interactive.js';
|
|
130
131
|
export * from './internals.js';
|
|
131
132
|
export { interpolateColors, type InterpolateColorsOptions, } from './interpolate-colors.js';
|
|
132
133
|
export { LogLevel } from './log.js';
|
package/dist/cjs/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Config = exports.Experimental = exports.watchStaticFile = exports.MediaPlaybackError = exports.Video = exports.OffthreadVideo = exports.Html5Video = exports.useRemotionEnvironment = exports.usePixelDensity = exports.useDelayRender = exports.useCurrentScale = exports.useCurrentFrame = exports.useBufferState = exports.staticFile = exports.Series = exports.Sequence = exports.registerRoot = exports.prefetch = exports.random = exports.interpolate = exports.assertValidInterpolatePosterizeOption = exports.assertValidInterpolateEasingOption = exports.Loop = exports.interpolateColors = exports.Img = exports.getStaticFiles = exports.getRemotionEnvironment = exports.delayRender = exports.continueRender = exports.getInputProps = exports.Composition = exports.CanvasImage = exports.isHtmlInCanvasSupported = exports.HtmlInCanvas = exports.HTML_IN_CANVAS_UNSUPPORTED_MESSAGE = exports.Solid = exports.cancelRender = exports.Html5Audio = exports.Audio = exports.Artifact = void 0;
|
|
17
|
+
exports.Config = exports.Experimental = exports.watchStaticFile = exports.MediaPlaybackError = exports.Video = exports.OffthreadVideo = exports.Html5Video = exports.useRemotionEnvironment = exports.usePixelDensity = exports.useDelayRender = exports.useCurrentScale = exports.useCurrentFrame = exports.useBufferState = exports.staticFile = exports.Series = exports.Sequence = exports.registerRoot = exports.prefetch = exports.random = exports.interpolate = exports.assertValidInterpolatePosterizeOption = exports.assertValidInterpolateEasingOption = exports.Loop = exports.interpolateColors = exports.Interactive = exports.Img = exports.getStaticFiles = exports.getRemotionEnvironment = exports.delayRender = exports.continueRender = exports.getInputProps = exports.Composition = exports.CanvasImage = exports.isHtmlInCanvasSupported = exports.HtmlInCanvas = exports.HTML_IN_CANVAS_UNSUPPORTED_MESSAGE = exports.Solid = exports.cancelRender = exports.Html5Audio = exports.Audio = exports.Artifact = void 0;
|
|
18
18
|
require("./_check-rsc.js");
|
|
19
19
|
require("./asset-types.js");
|
|
20
20
|
const Clipper_js_1 = require("./Clipper.js");
|
|
@@ -64,6 +64,8 @@ Object.defineProperty(exports, "getStaticFiles", { enumerable: true, get: functi
|
|
|
64
64
|
__exportStar(require("./IFrame.js"), exports);
|
|
65
65
|
const Img_js_1 = require("./Img.js");
|
|
66
66
|
Object.defineProperty(exports, "Img", { enumerable: true, get: function () { return Img_js_1.Img; } });
|
|
67
|
+
const Interactive_js_1 = require("./Interactive.js");
|
|
68
|
+
Object.defineProperty(exports, "Interactive", { enumerable: true, get: function () { return Interactive_js_1.Interactive; } });
|
|
67
69
|
__exportStar(require("./internals.js"), exports);
|
|
68
70
|
const interpolate_colors_js_1 = require("./interpolate-colors.js");
|
|
69
71
|
Object.defineProperty(exports, "interpolateColors", { enumerable: true, get: function () { return interpolate_colors_js_1.interpolateColors; } });
|