init commit

This commit is contained in:
Carlos
2026-02-21 10:33:18 +01:00
parent c863a943ed
commit 9d955bf338
9512 changed files with 2015317 additions and 1305 deletions

View 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>;
};

View 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;