@remotion/studio 4.0.431 → 4.0.433
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/Studio.d.ts +1 -0
- package/dist/Studio.js +4 -6
- package/dist/components/AssetSelectorItem.js +6 -8
- package/dist/components/CompositionSelector.js +16 -9
- package/dist/components/CurrentComposition.js +2 -5
- package/dist/components/EditorContent.js +4 -5
- package/dist/components/NewComposition/InputDragger.d.ts +1 -0
- package/dist/components/NewComposition/InputDragger.js +27 -8
- package/dist/components/OptionsPanel.js +1 -1
- package/dist/components/PlaybackRatePersistor.js +1 -1
- package/dist/components/PreviewToolbar.js +4 -2
- package/dist/components/RenderModal/WebRenderModal.d.ts +1 -1
- package/dist/components/RenderModal/WebRenderModal.js +55 -26
- package/dist/components/RenderModal/WebRenderModalAudio.d.ts +2 -0
- package/dist/components/RenderModal/WebRenderModalAudio.js +13 -5
- package/dist/components/RenderModal/WebRenderModalBasic.js +42 -35
- package/dist/components/RenderQueue/ClientRenderQueueProcessor.js +3 -3
- package/dist/components/RenderQueue/client-side-render-types.d.ts +1 -1
- package/dist/components/RendersTab.js +1 -9
- package/dist/components/Timeline/TimelineBooleanField.d.ts +9 -0
- package/dist/components/Timeline/TimelineBooleanField.js +20 -0
- package/dist/components/Timeline/TimelineEmptyState.d.ts +2 -0
- package/dist/components/Timeline/TimelineEmptyState.js +15 -0
- package/dist/components/Timeline/TimelineExpandedSection.d.ts +5 -0
- package/dist/components/Timeline/TimelineExpandedSection.js +54 -152
- package/dist/components/Timeline/TimelineFieldRow.d.ts +11 -0
- package/dist/components/Timeline/TimelineFieldRow.js +83 -0
- package/dist/components/Timeline/TimelineListItem.d.ts +1 -0
- package/dist/components/Timeline/TimelineListItem.js +12 -23
- package/dist/components/Timeline/TimelineNumberField.d.ts +11 -0
- package/dist/components/Timeline/TimelineNumberField.js +53 -0
- package/dist/components/Timeline/TimelinePlayCursorSyncer.js +1 -1
- package/dist/components/Timeline/TimelineRotationField.d.ts +11 -0
- package/dist/components/Timeline/TimelineRotationField.js +64 -0
- package/dist/components/Timeline/TimelineSchemaField.d.ts +3 -4
- package/dist/components/Timeline/TimelineSchemaField.js +20 -77
- package/dist/components/Timeline/TimelineTranslateField.d.ts +11 -0
- package/dist/components/Timeline/TimelineTranslateField.js +115 -0
- package/dist/components/Timeline/timeline-field-utils.d.ts +2 -0
- package/dist/components/Timeline/timeline-field-utils.js +12 -0
- package/dist/components/Timeline/use-resolved-stack.d.ts +2 -0
- package/dist/components/Timeline/use-resolved-stack.js +54 -0
- package/dist/components/Timeline/use-sequence-props-subscription.d.ts +4 -0
- package/dist/components/Timeline/use-sequence-props-subscription.js +150 -0
- package/dist/error-overlay/react-overlay/utils/get-source-map.d.ts +5 -0
- package/dist/esm/{chunk-3msfwcwh.js → chunk-bd1bkakk.js} +3001 -2433
- package/dist/esm/internals.mjs +3001 -2433
- package/dist/esm/previewEntry.mjs +3011 -2442
- package/dist/esm/renderEntry.mjs +5 -4
- package/dist/helpers/calculate-timeline.js +17 -11
- package/dist/helpers/get-timeline-sequence-layout.js +3 -3
- package/dist/helpers/get-timeline-sequence-sort-key.d.ts +1 -1
- package/dist/helpers/get-timeline-sequence-sort-key.js +6 -3
- package/dist/helpers/inject-css.js +6 -1
- package/dist/helpers/sort-by-nonce-history.d.ts +5 -0
- package/dist/helpers/sort-by-nonce-history.js +73 -0
- package/dist/helpers/timeline-layout.d.ts +2 -2
- package/dist/helpers/timeline-layout.js +10 -4
- package/dist/internals.d.ts +1 -0
- package/dist/previewEntry.js +1 -1
- package/dist/renderEntry.js +3 -3
- package/package.json +10 -10
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSequencePropsSubscription = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const remotion_1 = require("remotion");
|
|
6
|
+
const client_id_1 = require("../../helpers/client-id");
|
|
7
|
+
const timeline_layout_1 = require("../../helpers/timeline-layout");
|
|
8
|
+
const call_api_1 = require("../call-api");
|
|
9
|
+
const useSequencePropsSubscription = (sequence, originalLocation) => {
|
|
10
|
+
var _a;
|
|
11
|
+
var _b, _c, _d, _e;
|
|
12
|
+
const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeOverridesContext);
|
|
13
|
+
const overrideId = (_b = (_a = sequence.controls) === null || _a === void 0 ? void 0 : _a.overrideId) !== null && _b !== void 0 ? _b : null;
|
|
14
|
+
const setPropStatusesForSequence = (0, react_1.useCallback)((statuses) => {
|
|
15
|
+
if (!overrideId) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
setCodeValues(overrideId, statuses);
|
|
19
|
+
}, [overrideId, setCodeValues]);
|
|
20
|
+
const { previewServerState: state, subscribeToEvent } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
21
|
+
const clientId = state.type === 'connected' ? state.clientId : undefined;
|
|
22
|
+
const schemaFields = (0, react_1.useMemo)(() => (0, timeline_layout_1.getSchemaFields)(sequence.controls), [sequence.controls]);
|
|
23
|
+
const schemaKeysString = (0, react_1.useMemo)(() => (schemaFields ? schemaFields.map((f) => f.key).join(',') : null), [schemaFields]);
|
|
24
|
+
const validatedLocation = (0, react_1.useMemo)(() => {
|
|
25
|
+
var _a;
|
|
26
|
+
if (!originalLocation ||
|
|
27
|
+
!originalLocation.source ||
|
|
28
|
+
!originalLocation.line) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
source: originalLocation.source,
|
|
33
|
+
line: originalLocation.line,
|
|
34
|
+
column: (_a = originalLocation.column) !== null && _a !== void 0 ? _a : 0,
|
|
35
|
+
};
|
|
36
|
+
}, [originalLocation]);
|
|
37
|
+
const locationSource = (_c = validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.source) !== null && _c !== void 0 ? _c : null;
|
|
38
|
+
const locationLine = (_d = validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.line) !== null && _d !== void 0 ? _d : null;
|
|
39
|
+
const locationColumn = (_e = validatedLocation === null || validatedLocation === void 0 ? void 0 : validatedLocation.column) !== null && _e !== void 0 ? _e : null;
|
|
40
|
+
const currentLocationSource = (0, react_1.useRef)(locationSource);
|
|
41
|
+
currentLocationSource.current = locationSource;
|
|
42
|
+
const currentLocationLine = (0, react_1.useRef)(locationLine);
|
|
43
|
+
currentLocationLine.current = locationLine;
|
|
44
|
+
const currentLocationColumn = (0, react_1.useRef)(locationColumn);
|
|
45
|
+
currentLocationColumn.current = locationColumn;
|
|
46
|
+
const nodePathRef = (0, react_1.useRef)(null);
|
|
47
|
+
const isMountedRef = (0, react_1.useRef)(true);
|
|
48
|
+
(0, react_1.useEffect)(() => {
|
|
49
|
+
isMountedRef.current = true;
|
|
50
|
+
return () => {
|
|
51
|
+
isMountedRef.current = false;
|
|
52
|
+
};
|
|
53
|
+
}, []);
|
|
54
|
+
(0, react_1.useEffect)(() => {
|
|
55
|
+
if (!clientId ||
|
|
56
|
+
!locationSource ||
|
|
57
|
+
!locationLine ||
|
|
58
|
+
locationColumn === null ||
|
|
59
|
+
!schemaKeysString) {
|
|
60
|
+
setPropStatusesForSequence(null);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const keys = schemaKeysString.split(',');
|
|
64
|
+
(0, call_api_1.callApi)('/api/subscribe-to-sequence-props', {
|
|
65
|
+
fileName: locationSource,
|
|
66
|
+
line: locationLine,
|
|
67
|
+
column: locationColumn,
|
|
68
|
+
keys,
|
|
69
|
+
clientId,
|
|
70
|
+
})
|
|
71
|
+
.then((result) => {
|
|
72
|
+
if (currentLocationSource.current !== locationSource ||
|
|
73
|
+
currentLocationLine.current !== locationLine ||
|
|
74
|
+
currentLocationColumn.current !== locationColumn) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (result.canUpdate) {
|
|
78
|
+
nodePathRef.current = result.nodePath;
|
|
79
|
+
setPropStatusesForSequence(result.props);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
nodePathRef.current = null;
|
|
83
|
+
setPropStatusesForSequence(null);
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
.catch((err) => {
|
|
87
|
+
nodePathRef.current = null;
|
|
88
|
+
remotion_1.Internals.Log.error(err);
|
|
89
|
+
setPropStatusesForSequence(null);
|
|
90
|
+
});
|
|
91
|
+
return () => {
|
|
92
|
+
const currentNodePath = nodePathRef.current;
|
|
93
|
+
// Only clear props on true unmount, not on re-subscribe due to
|
|
94
|
+
// line number changes — avoids flicker while re-subscribing.
|
|
95
|
+
if (!isMountedRef.current) {
|
|
96
|
+
setPropStatusesForSequence(null);
|
|
97
|
+
}
|
|
98
|
+
nodePathRef.current = null;
|
|
99
|
+
if (currentNodePath) {
|
|
100
|
+
(0, call_api_1.callApi)('/api/unsubscribe-from-sequence-props', {
|
|
101
|
+
fileName: locationSource,
|
|
102
|
+
nodePath: currentNodePath,
|
|
103
|
+
clientId,
|
|
104
|
+
}).catch(() => {
|
|
105
|
+
// Ignore unsubscribe errors
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}, [
|
|
110
|
+
clientId,
|
|
111
|
+
locationSource,
|
|
112
|
+
locationLine,
|
|
113
|
+
locationColumn,
|
|
114
|
+
schemaKeysString,
|
|
115
|
+
setPropStatusesForSequence,
|
|
116
|
+
]);
|
|
117
|
+
(0, react_1.useEffect)(() => {
|
|
118
|
+
if (!locationSource || !locationLine || locationColumn === null) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const listener = (event) => {
|
|
122
|
+
if (event.type !== 'sequence-props-updated') {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (event.fileName !== currentLocationSource.current ||
|
|
126
|
+
!nodePathRef.current ||
|
|
127
|
+
JSON.stringify(event.nodePath) !== JSON.stringify(nodePathRef.current)) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (event.result.canUpdate) {
|
|
131
|
+
setPropStatusesForSequence(event.result.props);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
setPropStatusesForSequence(null);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const unsub = subscribeToEvent('sequence-props-updated', listener);
|
|
138
|
+
return () => {
|
|
139
|
+
unsub();
|
|
140
|
+
};
|
|
141
|
+
}, [
|
|
142
|
+
locationSource,
|
|
143
|
+
locationLine,
|
|
144
|
+
locationColumn,
|
|
145
|
+
subscribeToEvent,
|
|
146
|
+
setPropStatusesForSequence,
|
|
147
|
+
]);
|
|
148
|
+
return nodePathRef.current;
|
|
149
|
+
};
|
|
150
|
+
exports.useSequencePropsSubscription = useSequencePropsSubscription;
|
|
@@ -4,5 +4,10 @@ export type OriginalPosition = {
|
|
|
4
4
|
column: number | null;
|
|
5
5
|
source: string | null;
|
|
6
6
|
};
|
|
7
|
+
export type CodePosition = {
|
|
8
|
+
line: number;
|
|
9
|
+
column: number;
|
|
10
|
+
source: string;
|
|
11
|
+
};
|
|
7
12
|
export declare const getOriginalPosition: (source_map: SourceMapConsumer, line: number, column: number) => OriginalPosition;
|
|
8
13
|
export declare function getSourceMap(fileUri: string, fileContents: string): Promise<SourceMapConsumer | null>;
|