@remotion/studio 4.0.438 → 4.0.440
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.js +2 -2
- package/dist/api/helpers/calc-new-props.js +5 -8
- package/dist/api/update-default-props.d.ts +7 -3
- package/dist/api/update-default-props.js +7 -21
- package/dist/api/visual-control.js +6 -0
- package/dist/components/DefaultPropsEditor.d.ts +8 -0
- package/dist/components/DefaultPropsEditor.js +15 -0
- package/dist/components/Editor.js +0 -14
- package/dist/components/EditorContexts.js +6 -3
- package/dist/components/KeyboardShortcutsExplainer.js +6 -2
- package/dist/components/MenuBuildIndicator.js +1 -0
- package/dist/components/MenuToolbar.js +3 -1
- package/dist/components/NewComposition/InputDragger.js +2 -2
- package/dist/components/NewComposition/RemTextarea.js +4 -0
- package/dist/components/ObserveDefaultPropsContext.d.ts +11 -0
- package/dist/components/ObserveDefaultPropsContext.js +120 -0
- package/dist/components/OptionsPanel.js +90 -28
- package/dist/components/RenderModal/CrfSetting.d.ts +1 -1
- package/dist/components/RenderModal/DataEditor.d.ts +4 -5
- package/dist/components/RenderModal/DataEditor.js +9 -111
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.d.ts +1 -1
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +52 -48
- package/dist/components/RenderModal/SchemaEditor/Fieldset.d.ts +0 -1
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +4 -9
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.js +2 -61
- package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +0 -1
- package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +2 -3
- package/dist/components/RenderModal/SchemaEditor/SchemaLabel.d.ts +0 -6
- package/dist/components/RenderModal/SchemaEditor/SchemaLabel.js +2 -5
- package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.d.ts +3 -1
- package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +1 -6
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.js +15 -26
- package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.d.ts +0 -5
- package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.js +7 -12
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +0 -7
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +5 -15
- package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +1 -6
- package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.js +30 -28
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +1 -6
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.js +13 -17
- package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.d.ts +0 -5
- package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.d.ts +1 -6
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +13 -28
- package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +1 -5
- package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.js +11 -12
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +1 -5
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +12 -16
- package/dist/components/RenderModal/SchemaEditor/ZodFieldValidation.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodFieldValidation.js +1 -2
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.d.ts +1 -6
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.js +20 -30
- package/dist/components/RenderModal/SchemaEditor/ZodNonEditableValue.d.ts +0 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNonEditableValue.js +3 -6
- package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +0 -5
- package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +1 -6
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +16 -21
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +2 -7
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +27 -49
- package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +0 -5
- package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +1 -6
- package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +8 -15
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +1 -6
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +10 -15
- package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +1 -6
- package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.js +13 -17
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +3 -6
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +27 -27
- package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.d.ts +0 -5
- package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.js +45 -17
- package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.d.ts +1 -6
- package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.js +15 -26
- package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.d.ts +0 -5
- package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.js +4 -11
- package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +0 -5
- package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.js +6 -6
- package/dist/components/RenderModal/ServerRenderModal.js +9 -3
- package/dist/components/RenderModal/WebRenderModal.js +9 -3
- package/dist/components/RenderModal/get-default-codecs.d.ts +5 -5
- package/dist/components/RenderModal/get-render-modal-warnings.d.ts +1 -2
- package/dist/components/RenderModal/get-render-modal-warnings.js +4 -6
- package/dist/components/RenderModal/human-readable-codec.d.ts +1 -1
- package/dist/components/RenderModal/human-readable-codec.js +3 -0
- package/dist/components/RenderModal/out-name-checker.d.ts +1 -1
- package/dist/components/RenderQueue/actions.d.ts +2 -3
- package/dist/components/RenderQueue/actions.js +1 -13
- package/dist/components/Timeline/Timeline.js +1 -1
- package/dist/components/Timeline/TimelineExpandedSection.js +7 -1
- package/dist/components/Timeline/TimelineFieldRow.d.ts +1 -0
- package/dist/components/Timeline/TimelineFieldRow.js +25 -3
- package/dist/components/Timeline/TimelineImageInfo.d.ts +5 -0
- package/dist/components/Timeline/TimelineImageInfo.js +61 -0
- package/dist/components/Timeline/TimelineListItem.js +1 -2
- package/dist/components/Timeline/TimelineNumberField.js +4 -6
- package/dist/components/Timeline/TimelineRotationField.js +4 -6
- package/dist/components/Timeline/TimelineSequence.js +9 -4
- package/dist/components/Timeline/TimelineStack/index.js +3 -1
- package/dist/components/Timeline/TimelineTracks.js +1 -1
- package/dist/components/Timeline/TimelineTranslateField.js +28 -13
- package/dist/components/TopPanel.js +10 -5
- package/dist/components/UndoRedoButtons.d.ts +2 -0
- package/dist/components/UndoRedoButtons.js +116 -0
- package/dist/components/VisualControls/VisualControlHandle.js +18 -18
- package/dist/components/VisualControls/VisualControlsUndoSync.d.ts +2 -0
- package/dist/components/VisualControls/VisualControlsUndoSync.js +23 -0
- package/dist/error-overlay/react-overlay/listen-to-runtime-errors.js +0 -1
- package/dist/esm/{chunk-ba0scebn.js → chunk-1x2ychmc.js} +4466 -5252
- package/dist/esm/index.mjs +25 -28
- package/dist/esm/internals.mjs +4466 -5252
- package/dist/esm/previewEntry.mjs +4652 -5497
- package/dist/esm/renderEntry.mjs +6 -6
- package/dist/helpers/client-id.js +13 -1
- package/dist/helpers/document-title.d.ts +0 -1
- package/dist/helpers/document-title.js +1 -17
- package/dist/helpers/render-modal-sections.d.ts +1 -1
- package/dist/helpers/timeline-layout.d.ts +1 -1
- package/dist/helpers/timeline-layout.js +1 -1
- package/dist/hot-middleware-client/client.d.ts +1 -6
- package/dist/hot-middleware-client/client.js +22 -73
- package/dist/hot-middleware-client/process-update.d.ts +0 -2
- package/dist/hot-middleware-client/process-update.js +6 -14
- package/dist/icons/redo.d.ts +3 -0
- package/dist/icons/redo.js +8 -0
- package/dist/icons/undo.d.ts +3 -0
- package/dist/icons/undo.js +8 -0
- package/dist/renderEntry.js +7 -6
- package/dist/visual-controls/VisualControls.js +9 -5
- package/dist/visual-controls/get-current-edited-value.js +5 -4
- package/dist/visual-controls/visual-control-store.d.ts +7 -0
- package/dist/visual-controls/visual-control-store.js +22 -0
- package/package.json +9 -9
- package/dist/components/GlobalPropsEditorUpdateButton.d.ts +0 -5
- package/dist/components/GlobalPropsEditorUpdateButton.js +0 -78
- package/dist/components/RenderModal/SchemaEditor/SchemaSaveButton.d.ts +0 -5
- package/dist/components/RenderModal/SchemaEditor/SchemaSaveButton.js +0 -18
- package/dist/components/RenderModal/SchemaEditor/local-state.d.ts +0 -25
- package/dist/components/RenderModal/SchemaEditor/local-state.js +0 -107
package/dist/Studio.js
CHANGED
|
@@ -16,8 +16,8 @@ const getServerDisconnectedDomElement = () => {
|
|
|
16
16
|
return document.getElementById('server-disconnected-overlay');
|
|
17
17
|
};
|
|
18
18
|
const StudioInner = ({ rootComponent, readOnly, visualModeEnabled }) => {
|
|
19
|
-
var _a;
|
|
20
|
-
return (jsx_runtime_1.jsx(remotion_1.Internals.CompositionManagerProvider, { onlyRenderComposition: null, currentCompositionMetadata: null, initialCompositions: [], initialCanvasContent: null, children: jsx_runtime_1.jsx(remotion_1.Internals.RemotionRootContexts, { visualModeEnabled: visualModeEnabled, frameState: null, audioEnabled: window.remotion_audioEnabled, videoEnabled: window.remotion_videoEnabled, logLevel: window.remotion_logLevel, numberOfAudioTags: window.remotion_numberOfAudioTags, audioLatencyHint: (
|
|
19
|
+
var _a, _b;
|
|
20
|
+
return (jsx_runtime_1.jsx(remotion_1.Internals.CompositionManagerProvider, { onlyRenderComposition: null, currentCompositionMetadata: null, initialCompositions: [], initialCanvasContent: null, children: jsx_runtime_1.jsx(remotion_1.Internals.RemotionRootContexts, { visualModeEnabled: visualModeEnabled, frameState: null, audioEnabled: window.remotion_audioEnabled, videoEnabled: window.remotion_videoEnabled, logLevel: (_a = window.remotion_logLevel) !== null && _a !== void 0 ? _a : 'info', numberOfAudioTags: window.remotion_numberOfAudioTags, audioLatencyHint: (_b = window.remotion_audioLatencyHint) !== null && _b !== void 0 ? _b : 'interactive', children: jsx_runtime_1.jsx(use_static_files_1.StaticFilesProvider, { children: jsx_runtime_1.jsx(ResolveCompositionConfigInStudio_1.ResolveCompositionConfigInStudio, { children: jsx_runtime_1.jsxs(EditorContexts_1.EditorContexts, { readOnlyStudio: readOnly, children: [
|
|
21
21
|
jsx_runtime_1.jsx(Editor_1.Editor, { readOnlyStudio: readOnly, Root: rootComponent }), readOnly
|
|
22
22
|
? null
|
|
23
23
|
: (0, react_dom_1.createPortal)(jsx_runtime_1.jsx(ServerDisconnected_1.ServerDisconnected, {}), getServerDisconnectedDomElement())] }) }) }) }) }));
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.calcNewProps = void 0;
|
|
4
4
|
const remotion_1 = require("remotion");
|
|
5
5
|
const calcNewProps = (compositionId, defaultProps) => {
|
|
6
|
-
var _a
|
|
6
|
+
var _a;
|
|
7
7
|
if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
|
|
8
8
|
throw new Error('saveDefaultProps can only be called in the Remotion Studio.');
|
|
9
9
|
}
|
|
10
|
-
const { compositionsRef
|
|
10
|
+
const { compositionsRef } = remotion_1.Internals;
|
|
11
11
|
const compositionsStore = compositionsRef.current;
|
|
12
12
|
if (!compositionsStore) {
|
|
13
13
|
throw new Error('No compositions ref found. Are you in the Remotion Studio and are the Remotion versions aligned?');
|
|
@@ -17,16 +17,13 @@ const calcNewProps = (compositionId, defaultProps) => {
|
|
|
17
17
|
if (!composition) {
|
|
18
18
|
throw new Error(`No composition with the ID ${compositionId} found. Available compositions: ${compositions.map((c) => c.id).join(', ')}`);
|
|
19
19
|
}
|
|
20
|
-
const propsStore = editorPropsProviderRef.current;
|
|
21
|
-
if (!propsStore) {
|
|
22
|
-
throw new Error('No props store found. Are you in the Remotion Studio and are the Remotion versions aligned?');
|
|
23
|
-
}
|
|
24
20
|
const savedDefaultProps = (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {};
|
|
25
|
-
const unsavedDefaultProps = (_b = propsStore.getProps()[compositionId]) !== null && _b !== void 0 ? _b : savedDefaultProps;
|
|
26
21
|
const generatedDefaultProps = defaultProps({
|
|
27
22
|
schema: composition.schema,
|
|
28
23
|
savedDefaultProps,
|
|
29
|
-
|
|
24
|
+
// Kept for backwards compatibility - since all props are now
|
|
25
|
+
// immediately saved, this is the same as savedDefaultProps.
|
|
26
|
+
unsavedDefaultProps: savedDefaultProps,
|
|
30
27
|
});
|
|
31
28
|
return {
|
|
32
29
|
composition,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use `saveDefaultProps()` instead. This function is now an alias for `saveDefaultProps()`.
|
|
3
|
+
* @description Updates and saves the defaultProps for a composition back to the root file.
|
|
4
|
+
* @see [Documentation](https://www.remotion.dev/docs/studio/update-default-props)
|
|
5
|
+
*/
|
|
2
6
|
export declare const updateDefaultProps: ({ compositionId, defaultProps, }: {
|
|
3
7
|
compositionId: string;
|
|
4
|
-
defaultProps: UpdateDefaultPropsFunction;
|
|
5
|
-
}) => void
|
|
8
|
+
defaultProps: import("..").UpdateDefaultPropsFunction;
|
|
9
|
+
}) => Promise<void>;
|
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateDefaultProps = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
propsStore.setProps((prev) => {
|
|
13
|
-
return {
|
|
14
|
-
...prev,
|
|
15
|
-
[composition.id]: generatedDefaultProps,
|
|
16
|
-
};
|
|
17
|
-
});
|
|
18
|
-
window.dispatchEvent(new CustomEvent(remotion_1.Internals.PROPS_UPDATED_EXTERNALLY, {
|
|
19
|
-
detail: {
|
|
20
|
-
resetUnsaved: null,
|
|
21
|
-
},
|
|
22
|
-
}));
|
|
23
|
-
};
|
|
24
|
-
exports.updateDefaultProps = updateDefaultProps;
|
|
4
|
+
const save_default_props_1 = require("./save-default-props");
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use `saveDefaultProps()` instead. This function is now an alias for `saveDefaultProps()`.
|
|
7
|
+
* @description Updates and saves the defaultProps for a composition back to the root file.
|
|
8
|
+
* @see [Documentation](https://www.remotion.dev/docs/studio/update-default-props)
|
|
9
|
+
*/
|
|
10
|
+
exports.updateDefaultProps = save_default_props_1.saveDefaultProps;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.visualControl = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
4
5
|
const remotion_1 = require("remotion");
|
|
6
|
+
const visual_control_store_1 = require("../visual-controls/visual-control-store");
|
|
5
7
|
const VisualControls_1 = require("../visual-controls/VisualControls");
|
|
6
8
|
const visualControl = (key, value, schema) => {
|
|
9
|
+
// Subscribe to store changes so the calling component
|
|
10
|
+
// re-renders when a visual control value is edited in the sidebar.
|
|
11
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
12
|
+
(0, react_1.useSyncExternalStore)(visual_control_store_1.visualControlStore.subscribe, visual_control_store_1.visualControlStore.getSnapshot, visual_control_store_1.visualControlStore.getSnapshot);
|
|
7
13
|
if ((0, remotion_1.getRemotionEnvironment)().isRendering) {
|
|
8
14
|
return value;
|
|
9
15
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PropsEditType } from './RenderModal/DataEditor';
|
|
2
|
+
import type { UpdaterFunction } from './RenderModal/SchemaEditor/ZodSwitch';
|
|
3
|
+
export declare const DefaultPropsEditor: ({ unresolvedComposition, defaultProps, setDefaultProps, propsEditType, }: {
|
|
4
|
+
readonly unresolvedComposition: import("remotion").AnyComposition;
|
|
5
|
+
readonly defaultProps: Record<string, unknown>;
|
|
6
|
+
readonly setDefaultProps: UpdaterFunction<Record<string, unknown>>;
|
|
7
|
+
readonly propsEditType: PropsEditType;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultPropsEditor = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const ObserveDefaultPropsContext_1 = require("./ObserveDefaultPropsContext");
|
|
7
|
+
const DataEditor_1 = require("./RenderModal/DataEditor");
|
|
8
|
+
const DefaultPropsEditor = ({ unresolvedComposition, defaultProps, setDefaultProps, propsEditType, }) => {
|
|
9
|
+
const canSaveDefaultProps = (0, react_1.useContext)(ObserveDefaultPropsContext_1.ObserveDefaultPropsContext);
|
|
10
|
+
if (canSaveDefaultProps === null) {
|
|
11
|
+
throw new Error('ObserveDefaultPropsContext is not set');
|
|
12
|
+
}
|
|
13
|
+
return (jsx_runtime_1.jsx(DataEditor_1.DataEditor, { unresolvedComposition: unresolvedComposition, defaultProps: defaultProps, setDefaultProps: setDefaultProps, propsEditType: propsEditType, canSaveDefaultProps: canSaveDefaultProps.canSaveDefaultProps }));
|
|
14
|
+
};
|
|
15
|
+
exports.DefaultPropsEditor = DefaultPropsEditor;
|
|
@@ -66,20 +66,6 @@ const Editor = ({ Root, readOnlyStudio }) => {
|
|
|
66
66
|
triggerOnWindowResize: false,
|
|
67
67
|
shouldApplyCssTransforms: true,
|
|
68
68
|
});
|
|
69
|
-
(0, react_1.useEffect)(() => {
|
|
70
|
-
if (readOnlyStudio) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const listenToChanges = (e) => {
|
|
74
|
-
if (window.remotion_unsavedProps) {
|
|
75
|
-
e.returnValue = 'Are you sure you want to leave?';
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
window.addEventListener('beforeunload', listenToChanges);
|
|
79
|
-
return () => {
|
|
80
|
-
window.removeEventListener('beforeunload', listenToChanges);
|
|
81
|
-
};
|
|
82
|
-
}, [readOnlyStudio]);
|
|
83
69
|
const [canvasMounted, setCanvasMounted] = react_1.default.useState(false);
|
|
84
70
|
const onMounted = (0, react_1.useCallback)(() => {
|
|
85
71
|
setCanvasMounted(true);
|
|
@@ -20,10 +20,13 @@ const context_1 = require("./RenderQueue/context");
|
|
|
20
20
|
const SetTimelineInOutProvider_1 = require("./SetTimelineInOutProvider");
|
|
21
21
|
const ShowGuidesProvider_1 = require("./ShowGuidesProvider");
|
|
22
22
|
const ShowRulersProvider_1 = require("./ShowRulersProvider");
|
|
23
|
+
const VisualControlsUndoSync_1 = require("./VisualControls/VisualControlsUndoSync");
|
|
23
24
|
const ZoomGesturesProvider_1 = require("./ZoomGesturesProvider");
|
|
24
25
|
const EditorContexts = ({ children, readOnlyStudio }) => {
|
|
25
|
-
return (jsx_runtime_1.jsx(get_zod_if_possible_1.ZodProvider, { children: jsx_runtime_1.jsx(VisualControls_1.VisualControlsProvider, { children: jsx_runtime_1.
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
return (jsx_runtime_1.jsx(get_zod_if_possible_1.ZodProvider, { children: jsx_runtime_1.jsx(VisualControls_1.VisualControlsProvider, { children: jsx_runtime_1.jsxs(client_id_1.PreviewServerConnection, { readOnlyStudio: readOnlyStudio, children: [
|
|
27
|
+
jsx_runtime_1.jsx(VisualControlsUndoSync_1.VisualControlsUndoSync, {}), jsx_runtime_1.jsxs(context_1.RenderQueueContextProvider, { children: [
|
|
28
|
+
jsx_runtime_1.jsx(ClientRenderQueueProcessor_1.ClientRenderQueueProcessor, {}), jsx_runtime_1.jsx(keybindings_1.KeybindingContextProvider, { children: jsx_runtime_1.jsx(CheckerboardProvider_1.CheckerboardProvider, { children: jsx_runtime_1.jsx(ZoomGesturesProvider_1.ZoomGesturesProvider, { children: jsx_runtime_1.jsx(ShowRulersProvider_1.ShowRulersProvider, { children: jsx_runtime_1.jsx(ShowGuidesProvider_1.ShowGuidesProvider, { children: jsx_runtime_1.jsx(preview_size_1.PreviewSizeProvider, { children: jsx_runtime_1.jsx(ModalsProvider_1.ModalsProvider, { children: jsx_runtime_1.jsx(MediaVolumeProvider_1.MediaVolumeProvider, { children: jsx_runtime_1.jsx(player_1.PlayerInternals.PlayerEmitterProvider, { currentPlaybackRate: null, children: jsx_runtime_1.jsx(sidebar_1.SidebarContextProvider, { children: jsx_runtime_1.jsx(folders_1.FolderContextProvider, { children: jsx_runtime_1.jsx(highest_z_index_1.HighestZIndexProvider, { children: jsx_runtime_1.jsx(SetTimelineInOutProvider_1.SetTimelineInOutProvider, { children: jsx_runtime_1.jsx(ExpandedTracksProvider_1.ExpandedTracksProvider, { children: children }) }) }) }) }) }) }) }) }) }) }) }) }) })
|
|
29
|
+
] })
|
|
30
|
+
] }) }) }));
|
|
28
31
|
};
|
|
29
32
|
exports.EditorContexts = EditorContexts;
|
|
@@ -132,8 +132,12 @@ const KeyboardShortcutsExplainer = () => {
|
|
|
132
132
|
jsx_runtime_1.jsx("div", { style: left, children: jsx_runtime_1.jsx("kbd", { style: key, children: "0" }) }), jsx_runtime_1.jsx("div", { style: right, children: "Reset zoom" })
|
|
133
133
|
] }), ' ', jsx_runtime_1.jsx("br", {}), jsx_runtime_1.jsx("div", { style: title, children: "Props Editor" }), jsx_runtime_1.jsxs(layout_1.Row, { align: "center", children: [
|
|
134
134
|
jsx_runtime_1.jsxs("div", { style: left, children: [
|
|
135
|
-
jsx_runtime_1.jsx("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.3 }), jsx_runtime_1.jsx("kbd", { style: key, children: "
|
|
136
|
-
] }), jsx_runtime_1.jsx("div", { style: right, children: "
|
|
135
|
+
jsx_runtime_1.jsx("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.3 }), jsx_runtime_1.jsx("kbd", { style: key, children: "Z" })
|
|
136
|
+
] }), jsx_runtime_1.jsx("div", { style: right, children: "Undo" })
|
|
137
|
+
] }), jsx_runtime_1.jsxs(layout_1.Row, { align: "center", children: [
|
|
138
|
+
jsx_runtime_1.jsxs("div", { style: left, children: [
|
|
139
|
+
jsx_runtime_1.jsx("kbd", { style: key, children: ShortcutHint_1.cmdOrCtrlCharacter }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 0.3 }), jsx_runtime_1.jsx("kbd", { style: key, children: "Y" })
|
|
140
|
+
] }), jsx_runtime_1.jsx("div", { style: right, children: "Redo" })
|
|
137
141
|
] }), process.env.ASK_AI_ENABLED && (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
138
142
|
jsx_runtime_1.jsx("br", {}), jsx_runtime_1.jsx("div", { style: title, children: "AI" }), jsx_runtime_1.jsxs(layout_1.Row, { align: "center", children: [
|
|
139
143
|
jsx_runtime_1.jsxs("div", { style: left, children: [
|
|
@@ -10,6 +10,7 @@ const layout_1 = require("./layout");
|
|
|
10
10
|
const MenuItem_1 = require("./Menu/MenuItem");
|
|
11
11
|
const MenuBuildIndicator_1 = require("./MenuBuildIndicator");
|
|
12
12
|
const SidebarCollapserControls_1 = require("./SidebarCollapserControls");
|
|
13
|
+
const UndoRedoButtons_1 = require("./UndoRedoButtons");
|
|
13
14
|
const UpdateCheck_1 = require("./UpdateCheck");
|
|
14
15
|
const row = {
|
|
15
16
|
alignItems: 'center',
|
|
@@ -92,7 +93,8 @@ const MenuToolbar = ({ readOnlyStudio }) => {
|
|
|
92
93
|
return (jsx_runtime_1.jsxs(layout_1.Row, { align: "center", className: "css-reset", style: row, children: [
|
|
93
94
|
jsx_runtime_1.jsxs("div", { style: fixedWidthLeft, children: [structure.map((s) => {
|
|
94
95
|
return (jsx_runtime_1.jsx(MenuItem_1.MenuItem, { selected: selected === s.id, onItemSelected: itemClicked, onItemHovered: itemHovered, id: s.id, label: s.label, onItemQuit: onItemQuit, menu: s, onPreviousMenu: onPreviousMenu, onNextMenu: onNextMenu, leaveLeftPadding: s.leaveLeftPadding }, s.id));
|
|
95
|
-
}), readOnlyStudio ? null : jsx_runtime_1.jsx(UpdateCheck_1.UpdateCheck, {})] }), jsx_runtime_1.jsx("div", { style: flex }), jsx_runtime_1.jsx(MenuBuildIndicator_1.MenuBuildIndicator, {}), jsx_runtime_1.jsx("div", { style: flex }), jsx_runtime_1.
|
|
96
|
+
}), readOnlyStudio ? null : jsx_runtime_1.jsx(UpdateCheck_1.UpdateCheck, {})] }), jsx_runtime_1.jsx("div", { style: flex }), jsx_runtime_1.jsx(MenuBuildIndicator_1.MenuBuildIndicator, {}), jsx_runtime_1.jsx("div", { style: flex }), jsx_runtime_1.jsxs("div", { style: fixedWidthRight, children: [readOnlyStudio ? null : jsx_runtime_1.jsx(UndoRedoButtons_1.UndoRedoButtons, {}), jsx_runtime_1.jsx(SidebarCollapserControls_1.SidebarCollapserControls, {})
|
|
97
|
+
] }), jsx_runtime_1.jsx(layout_1.Spacing, { x: 1 })
|
|
96
98
|
] }));
|
|
97
99
|
};
|
|
98
100
|
exports.MenuToolbar = MenuToolbar;
|
|
@@ -101,13 +101,13 @@ const InputDraggerForwardRefFn = ({ onValueChange, onValueChangeEnd, min: _min,
|
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
if (fallbackRef.current.checkValidity()) {
|
|
104
|
-
|
|
104
|
+
onValueChangeEnd === null || onValueChangeEnd === void 0 ? void 0 : onValueChangeEnd(Number(newValue));
|
|
105
105
|
setInputFallback(false);
|
|
106
106
|
}
|
|
107
107
|
else {
|
|
108
108
|
fallbackRef.current.reportValidity();
|
|
109
109
|
}
|
|
110
|
-
}, [onEscape,
|
|
110
|
+
}, [onEscape, onValueChangeEnd]);
|
|
111
111
|
const onKeyPress = (0, react_1.useCallback)((e) => {
|
|
112
112
|
var _a;
|
|
113
113
|
if (e.key === 'Enter') {
|
|
@@ -50,6 +50,10 @@ const RemTextareaFRFunction = ({ status, ...props }, ref) => {
|
|
|
50
50
|
if (inputRef.current !== document.activeElement) {
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
+
if (e.code === 'Escape') {
|
|
54
|
+
inputRef.current.blur();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
53
57
|
if (e.code === 'Tab') {
|
|
54
58
|
e.preventDefault();
|
|
55
59
|
// Always match up with value in JSON.stringify(content, null, 2)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TypeCanSaveState } from './RenderModal/get-render-modal-warnings';
|
|
3
|
+
export type TObserveDefaultPropsContext = {
|
|
4
|
+
canSaveDefaultProps: TypeCanSaveState | null;
|
|
5
|
+
};
|
|
6
|
+
export declare const ObserveDefaultPropsContext: React.Context<TObserveDefaultPropsContext | null>;
|
|
7
|
+
export declare const ObserveDefaultProps: React.FC<{
|
|
8
|
+
readonly compositionId: string | null;
|
|
9
|
+
readonly readOnlyStudio: boolean;
|
|
10
|
+
readonly children: React.ReactNode;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,120 @@
|
|
|
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.ObserveDefaultProps = exports.ObserveDefaultPropsContext = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const remotion_1 = require("remotion");
|
|
40
|
+
const client_id_1 = require("../helpers/client-id");
|
|
41
|
+
const call_api_1 = require("./call-api");
|
|
42
|
+
exports.ObserveDefaultPropsContext = react_1.default.createContext(null);
|
|
43
|
+
const ObserveDefaultProps = ({ compositionId, readOnlyStudio, children }) => {
|
|
44
|
+
const { previewServerState, subscribeToEvent } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
|
|
45
|
+
const { updateProps } = (0, react_1.useContext)(remotion_1.Internals.EditorPropsContext);
|
|
46
|
+
const [canSaveDefaultPropsObjectState, setCanSaveDefaultProps] = (0, react_1.useState)({});
|
|
47
|
+
const canSaveDefaultProps = (0, react_1.useMemo)(() => {
|
|
48
|
+
var _a;
|
|
49
|
+
if (compositionId === null) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return (_a = canSaveDefaultPropsObjectState[compositionId]) !== null && _a !== void 0 ? _a : null;
|
|
53
|
+
}, [canSaveDefaultPropsObjectState, compositionId]);
|
|
54
|
+
const clientId = previewServerState.type === 'connected'
|
|
55
|
+
? previewServerState.clientId
|
|
56
|
+
: null;
|
|
57
|
+
const applyResult = (0, react_1.useCallback)((compId, result) => {
|
|
58
|
+
if (result.canUpdate) {
|
|
59
|
+
setCanSaveDefaultProps((prevState) => ({
|
|
60
|
+
...prevState,
|
|
61
|
+
[compId]: { canUpdate: true },
|
|
62
|
+
}));
|
|
63
|
+
updateProps({
|
|
64
|
+
id: compId,
|
|
65
|
+
defaultProps: result.currentDefaultProps,
|
|
66
|
+
newProps: result.currentDefaultProps,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
setCanSaveDefaultProps((prevState) => ({
|
|
71
|
+
...prevState,
|
|
72
|
+
[compId]: {
|
|
73
|
+
canUpdate: false,
|
|
74
|
+
reason: result.reason,
|
|
75
|
+
determined: true,
|
|
76
|
+
},
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
}, [updateProps]);
|
|
80
|
+
(0, react_1.useEffect)(() => {
|
|
81
|
+
if (readOnlyStudio || !clientId || compositionId === null) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
(0, call_api_1.callApi)('/api/subscribe-to-default-props', { compositionId, clientId })
|
|
85
|
+
.then((can) => {
|
|
86
|
+
applyResult(compositionId, can);
|
|
87
|
+
})
|
|
88
|
+
.catch((err) => {
|
|
89
|
+
applyResult(compositionId, {
|
|
90
|
+
canUpdate: false,
|
|
91
|
+
reason: err.message,
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
return () => {
|
|
95
|
+
(0, call_api_1.callApi)('/api/unsubscribe-from-default-props', {
|
|
96
|
+
compositionId,
|
|
97
|
+
clientId,
|
|
98
|
+
}).catch(() => {
|
|
99
|
+
// Ignore errors during cleanup
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
}, [readOnlyStudio, clientId, compositionId, applyResult]);
|
|
103
|
+
(0, react_1.useEffect)(() => {
|
|
104
|
+
const unsub = subscribeToEvent('default-props-updatable-changed', (e) => {
|
|
105
|
+
if (e.type !== 'default-props-updatable-changed') {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (e.compositionId !== compositionId) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
applyResult(e.compositionId, e.result);
|
|
112
|
+
});
|
|
113
|
+
return () => {
|
|
114
|
+
unsub();
|
|
115
|
+
};
|
|
116
|
+
}, [subscribeToEvent, compositionId, applyResult]);
|
|
117
|
+
const value = (0, react_1.useMemo)(() => ({ canSaveDefaultProps }), [canSaveDefaultProps]);
|
|
118
|
+
return (jsx_runtime_1.jsx(exports.ObserveDefaultPropsContext.Provider, { value: value, children: children }));
|
|
119
|
+
};
|
|
120
|
+
exports.ObserveDefaultProps = ObserveDefaultProps;
|
|
@@ -8,10 +8,14 @@ const colors_1 = require("../helpers/colors");
|
|
|
8
8
|
const mobile_layout_1 = require("../helpers/mobile-layout");
|
|
9
9
|
const show_browser_rendering_1 = require("../helpers/show-browser-rendering");
|
|
10
10
|
const VisualControls_1 = require("../visual-controls/VisualControls");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const DefaultPropsEditor_1 = require("./DefaultPropsEditor");
|
|
12
|
+
const get_zod_if_possible_1 = require("./get-zod-if-possible");
|
|
13
|
+
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
13
14
|
const deep_equal_1 = require("./RenderModal/SchemaEditor/deep-equal");
|
|
15
|
+
const extract_enum_json_paths_1 = require("./RenderModal/SchemaEditor/extract-enum-json-paths");
|
|
16
|
+
const SchemaResetButton_1 = require("./RenderModal/SchemaEditor/SchemaResetButton");
|
|
14
17
|
const RenderQueue_1 = require("./RenderQueue");
|
|
18
|
+
const actions_1 = require("./RenderQueue/actions");
|
|
15
19
|
const RendersTab_1 = require("./RendersTab");
|
|
16
20
|
const Tabs_1 = require("./Tabs");
|
|
17
21
|
const VisualControlsContent_1 = require("./VisualControls/VisualControlsContent");
|
|
@@ -38,8 +42,7 @@ const persistSelectedOptionsSidebarPanel = (panel) => {
|
|
|
38
42
|
exports.persistSelectedOptionsSidebarPanel = persistSelectedOptionsSidebarPanel;
|
|
39
43
|
exports.optionsSidebarTabs = (0, react_1.createRef)();
|
|
40
44
|
const OptionsPanel = ({ readOnlyStudio }) => {
|
|
41
|
-
const { props, updateProps
|
|
42
|
-
const [saving, setSaving] = (0, react_1.useState)(false);
|
|
45
|
+
const { props, updateProps } = (0, react_1.useContext)(remotion_1.Internals.EditorPropsContext);
|
|
43
46
|
const renderingAvailable = !readOnlyStudio || show_browser_rendering_1.SHOW_BROWSER_RENDERING;
|
|
44
47
|
const isMobileLayout = (0, mobile_layout_1.useMobileLayout)();
|
|
45
48
|
const visualControlsTabActivated = (0, react_1.useContext)(VisualControls_1.VisualControlsTabActivatedContext);
|
|
@@ -84,17 +87,25 @@ const OptionsPanel = ({ readOnlyStudio }) => {
|
|
|
84
87
|
}
|
|
85
88
|
return null;
|
|
86
89
|
}, [canvasContent, compositions]);
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
91
|
+
const zodTypes = (0, get_zod_if_possible_1.useZodTypesIfPossible)();
|
|
92
|
+
const noComposition = !composition;
|
|
93
|
+
const schema = (0, react_1.useMemo)(() => {
|
|
94
|
+
if (!z) {
|
|
95
|
+
return 'no-zod';
|
|
90
96
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
97
|
+
if (noComposition) {
|
|
98
|
+
return 'no-composition';
|
|
99
|
+
}
|
|
100
|
+
if (!composition.schema) {
|
|
101
|
+
return 'no-schema';
|
|
102
|
+
}
|
|
103
|
+
if (!(typeof composition.schema.safeParse ===
|
|
104
|
+
'function')) {
|
|
105
|
+
throw new Error('A value which is not a Zod schema was passed to `schema`');
|
|
106
|
+
}
|
|
107
|
+
return composition.schema;
|
|
108
|
+
}, [composition === null || composition === void 0 ? void 0 : composition.schema, noComposition, z]);
|
|
98
109
|
const currentDefaultProps = (0, react_1.useMemo)(() => {
|
|
99
110
|
var _a, _b;
|
|
100
111
|
if (composition === null) {
|
|
@@ -102,24 +113,75 @@ const OptionsPanel = ({ readOnlyStudio }) => {
|
|
|
102
113
|
}
|
|
103
114
|
return (_b = (_a = props[composition.id]) !== null && _a !== void 0 ? _a : composition.defaultProps) !== null && _b !== void 0 ? _b : {};
|
|
104
115
|
}, [composition, props]);
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
116
|
+
const saveToFile = (0, react_1.useCallback)((updater) => {
|
|
117
|
+
if (readOnlyStudio) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (schema === 'no-zod' ||
|
|
121
|
+
schema === 'no-schema' ||
|
|
122
|
+
schema === 'no-composition' ||
|
|
123
|
+
z === null) {
|
|
124
|
+
(0, NotificationCenter_1.showNotification)('Cannot update default props: No Zod schema', 2000);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (!composition) {
|
|
128
|
+
throw new Error('Composition is not found');
|
|
129
|
+
}
|
|
130
|
+
const oldDefaultProps = currentDefaultProps;
|
|
131
|
+
const newDefaultProps = updater(oldDefaultProps);
|
|
132
|
+
(0, actions_1.callUpdateDefaultPropsApi)(composition.id, newDefaultProps, (0, extract_enum_json_paths_1.extractEnumJsonPaths)({
|
|
133
|
+
schema,
|
|
134
|
+
zodRuntime: z,
|
|
135
|
+
currentPath: [],
|
|
136
|
+
zodTypes,
|
|
137
|
+
}))
|
|
138
|
+
.then((response) => {
|
|
139
|
+
if (!response.success) {
|
|
140
|
+
// eslint-disable-next-line no-console
|
|
141
|
+
console.log(response.stack);
|
|
142
|
+
(0, NotificationCenter_1.showNotification)(`Cannot update default props: ${response.reason}. See console for more information.`, 2000);
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
.catch((err) => {
|
|
146
|
+
(0, NotificationCenter_1.showNotification)(`Cannot update default props: ${err.message}`, 2000);
|
|
147
|
+
});
|
|
148
|
+
}, [composition, currentDefaultProps, readOnlyStudio, schema, z, zodTypes]);
|
|
149
|
+
const compositionId = (0, react_1.useMemo)(() => {
|
|
150
|
+
var _a;
|
|
151
|
+
return (_a = composition === null || composition === void 0 ? void 0 : composition.id) !== null && _a !== void 0 ? _a : '';
|
|
152
|
+
}, [composition === null || composition === void 0 ? void 0 : composition.id]);
|
|
153
|
+
const compositionDefaultProps = (0, react_1.useMemo)(() => {
|
|
154
|
+
var _a;
|
|
155
|
+
return (_a = composition === null || composition === void 0 ? void 0 : composition.defaultProps) !== null && _a !== void 0 ? _a : {};
|
|
156
|
+
}, [composition === null || composition === void 0 ? void 0 : composition.defaultProps]);
|
|
157
|
+
const hasLocalModifications = (0, react_1.useMemo)(() => {
|
|
158
|
+
if (!readOnlyStudio || !composition || !composition.defaultProps) {
|
|
107
159
|
return false;
|
|
108
160
|
}
|
|
109
161
|
return !(0, deep_equal_1.deepEqual)(composition.defaultProps, currentDefaultProps);
|
|
110
|
-
}, [
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
162
|
+
}, [readOnlyStudio, composition, currentDefaultProps]);
|
|
163
|
+
const resetToOriginal = (0, react_1.useCallback)(() => {
|
|
164
|
+
var _a, _b;
|
|
165
|
+
if (!composition) {
|
|
166
|
+
return;
|
|
114
167
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
168
|
+
updateProps({
|
|
169
|
+
id: composition.id,
|
|
170
|
+
defaultProps: ((_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {}),
|
|
171
|
+
newProps: ((_b = composition.defaultProps) !== null && _b !== void 0 ? _b : {}),
|
|
172
|
+
});
|
|
173
|
+
}, [composition, updateProps]);
|
|
174
|
+
const setDefaultProps = (0, react_1.useCallback)((updater, { shouldSave }) => {
|
|
175
|
+
updateProps({
|
|
176
|
+
id: compositionId,
|
|
177
|
+
defaultProps: compositionDefaultProps,
|
|
178
|
+
newProps: updater,
|
|
179
|
+
});
|
|
180
|
+
if (shouldSave) {
|
|
181
|
+
saveToFile(updater);
|
|
182
|
+
}
|
|
183
|
+
}, [compositionId, compositionDefaultProps, saveToFile, updateProps]);
|
|
122
184
|
return (jsx_runtime_1.jsxs("div", { style: container, className: "css-reset", children: [
|
|
123
|
-
jsx_runtime_1.jsx("div", { style: tabsContainer, children: jsx_runtime_1.jsxs(Tabs_1.Tabs, { children: [visualControlsTabActivated ? (jsx_runtime_1.jsx(Tabs_1.Tab, { selected: panel === 'visual-controls', onClick: onVisualControlsSelected, children: "Controls" })) : null, jsx_runtime_1.jsxs(Tabs_1.Tab, { selected: panel === 'input-props', onClick: onPropsSelected, style: { justifyContent: 'space-between' }, children: ["Props",
|
|
185
|
+
jsx_runtime_1.jsx("div", { style: tabsContainer, children: jsx_runtime_1.jsxs(Tabs_1.Tabs, { children: [visualControlsTabActivated ? (jsx_runtime_1.jsx(Tabs_1.Tab, { selected: panel === 'visual-controls', onClick: onVisualControlsSelected, children: "Controls" })) : null, jsx_runtime_1.jsxs(Tabs_1.Tab, { selected: panel === 'input-props', onClick: onPropsSelected, style: { justifyContent: 'space-between' }, children: ["Props", hasLocalModifications ? (jsx_runtime_1.jsx(SchemaResetButton_1.SchemaResetButton, { onClick: resetToOriginal })) : null] }), renderingAvailable ? (jsx_runtime_1.jsx(RendersTab_1.RendersTab, { onClick: onRendersSelected, selected: panel === 'renders' })) : null] }) }), panel === 'input-props' ? (composition ? (jsx_runtime_1.jsx(DefaultPropsEditor_1.DefaultPropsEditor, { unresolvedComposition: composition, defaultProps: currentDefaultProps, setDefaultProps: setDefaultProps, propsEditType: "default-props" }, composition.id)) : null) : panel === 'visual-controls' && visualControlsTabActivated ? (jsx_runtime_1.jsx(VisualControlsContent_1.VisualControlsContent, {})) : !renderingAvailable ? null : (jsx_runtime_1.jsx(RenderQueue_1.RenderQueue, {}))] }));
|
|
124
186
|
};
|
|
125
187
|
exports.OptionsPanel = OptionsPanel;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AvailableOptions } from '@remotion/renderer/client';
|
|
2
|
-
export declare const useCrfState: (codec: "aac" | "gif" | "h264" | "h264-mkv" | "h264-ts" | "h265" | "mp3" | "prores" | "vp8" | "vp9" | "wav") => {
|
|
2
|
+
export declare const useCrfState: (codec: "aac" | "av1" | "gif" | "h264" | "h264-mkv" | "h264-ts" | "h265" | "mp3" | "prores" | "vp8" | "vp9" | "wav") => {
|
|
3
3
|
crf: number | null;
|
|
4
4
|
setCrf: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
5
5
|
minCrf: number;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { _InternalTypes } from 'remotion';
|
|
3
|
+
import type { TypeCanSaveState } from './get-render-modal-warnings';
|
|
3
4
|
import type { ZodSafeParseResult } from './SchemaEditor/zod-schema-type';
|
|
5
|
+
import type { UpdaterFunction } from './SchemaEditor/ZodSwitch';
|
|
4
6
|
export type State = {
|
|
5
7
|
str: string;
|
|
6
8
|
value: Record<string, unknown>;
|
|
@@ -15,10 +17,7 @@ export type PropsEditType = 'input-props' | 'default-props';
|
|
|
15
17
|
export declare const DataEditor: React.FC<{
|
|
16
18
|
readonly unresolvedComposition: _InternalTypes['AnyComposition'];
|
|
17
19
|
readonly defaultProps: Record<string, unknown>;
|
|
18
|
-
readonly setDefaultProps:
|
|
19
|
-
readonly mayShowSaveButton: boolean;
|
|
20
|
+
readonly setDefaultProps: UpdaterFunction<Record<string, unknown>>;
|
|
20
21
|
readonly propsEditType: PropsEditType;
|
|
21
|
-
readonly
|
|
22
|
-
readonly setSaving: React.Dispatch<React.SetStateAction<boolean>>;
|
|
23
|
-
readonly readOnlyStudio: boolean;
|
|
22
|
+
readonly canSaveDefaultProps: TypeCanSaveState | null;
|
|
24
23
|
}>;
|