init commit
This commit is contained in:
11
remotion/node_modules/@remotion/studio/dist/api/helpers/calc-new-props.d.ts
generated
vendored
Normal file
11
remotion/node_modules/@remotion/studio/dist/api/helpers/calc-new-props.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { _InternalTypes } from 'remotion';
|
||||
import type { AnyZodObject } from 'zod';
|
||||
export type UpdateDefaultPropsFunction = (currentValues: {
|
||||
schema: AnyZodObject | null;
|
||||
savedDefaultProps: Record<string, unknown>;
|
||||
unsavedDefaultProps: Record<string, unknown>;
|
||||
}) => Record<string, unknown>;
|
||||
export declare const calcNewProps: (compositionId: string, defaultProps: UpdateDefaultPropsFunction) => {
|
||||
composition: _InternalTypes["AnyComposition"];
|
||||
generatedDefaultProps: Record<string, unknown>;
|
||||
};
|
||||
36
remotion/node_modules/@remotion/studio/dist/api/helpers/calc-new-props.js
generated
vendored
Normal file
36
remotion/node_modules/@remotion/studio/dist/api/helpers/calc-new-props.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.calcNewProps = void 0;
|
||||
const remotion_1 = require("remotion");
|
||||
const calcNewProps = (compositionId, defaultProps) => {
|
||||
var _a, _b;
|
||||
if (!(0, remotion_1.getRemotionEnvironment)().isStudio) {
|
||||
throw new Error('saveDefaultProps can only be called in the Remotion Studio.');
|
||||
}
|
||||
const { compositionsRef, editorPropsProviderRef } = remotion_1.Internals;
|
||||
const compositionsStore = compositionsRef.current;
|
||||
if (!compositionsStore) {
|
||||
throw new Error('No compositions ref found. Are you in the Remotion Studio and are the Remotion versions aligned?');
|
||||
}
|
||||
const compositions = compositionsStore.getCompositions();
|
||||
const composition = compositions.find((c) => c.id === compositionId);
|
||||
if (!composition) {
|
||||
throw new Error(`No composition with the ID ${compositionId} found. Available compositions: ${compositions.map((c) => c.id).join(', ')}`);
|
||||
}
|
||||
const propsStore = editorPropsProviderRef.current;
|
||||
if (!propsStore) {
|
||||
throw new Error('No props store found. Are you in the Remotion Studio and are the Remotion versions aligned?');
|
||||
}
|
||||
const savedDefaultProps = (_a = composition.defaultProps) !== null && _a !== void 0 ? _a : {};
|
||||
const unsavedDefaultProps = (_b = propsStore.getProps()[compositionId]) !== null && _b !== void 0 ? _b : savedDefaultProps;
|
||||
const generatedDefaultProps = defaultProps({
|
||||
schema: composition.schema,
|
||||
savedDefaultProps,
|
||||
unsavedDefaultProps,
|
||||
});
|
||||
return {
|
||||
composition,
|
||||
generatedDefaultProps,
|
||||
};
|
||||
};
|
||||
exports.calcNewProps = calcNewProps;
|
||||
Reference in New Issue
Block a user