63 lines
2.8 KiB
TypeScript
63 lines
2.8 KiB
TypeScript
import type { ComponentType } from 'react';
|
|
import React from 'react';
|
|
import type { AnyZodObject } from 'zod';
|
|
import type { Codec } from './codec.js';
|
|
import type { InferProps, PropsIfHasProps } from './props-if-has-props.js';
|
|
import type { ProResProfile } from './prores-profile.js';
|
|
import type { PixelFormat, VideoImageFormat } from './render-types.js';
|
|
type LooseComponentType<T> = ComponentType<T> | ((props: T) => React.ReactNode);
|
|
export type CompProps<Props> = {
|
|
lazyComponent: () => Promise<{
|
|
default: LooseComponentType<Props>;
|
|
}>;
|
|
} | {
|
|
component: LooseComponentType<Props>;
|
|
};
|
|
export type CalcMetadataReturnType<T extends Record<string, unknown>> = {
|
|
durationInFrames?: number;
|
|
fps?: number;
|
|
width?: number;
|
|
height?: number;
|
|
props?: T;
|
|
defaultCodec?: Codec;
|
|
defaultOutName?: string;
|
|
defaultVideoImageFormat?: VideoImageFormat;
|
|
defaultPixelFormat?: PixelFormat;
|
|
defaultProResProfile?: ProResProfile;
|
|
};
|
|
export type CalculateMetadataFunction<T extends Record<string, unknown>> = (options: {
|
|
defaultProps: T;
|
|
props: T;
|
|
abortSignal: AbortSignal;
|
|
compositionId: string;
|
|
isRendering: boolean;
|
|
}) => Promise<CalcMetadataReturnType<T>> | CalcMetadataReturnType<T>;
|
|
type OptionalDimensions<Schema extends AnyZodObject, Props extends Record<string, unknown>> = {
|
|
width?: number;
|
|
height?: number;
|
|
calculateMetadata: CalculateMetadataFunction<InferProps<Schema, Props>>;
|
|
};
|
|
type MandatoryDimensions<Schema extends AnyZodObject, Props extends Record<string, unknown>> = {
|
|
width: number;
|
|
height: number;
|
|
calculateMetadata?: CalculateMetadataFunction<InferProps<Schema, Props>>;
|
|
};
|
|
type StillCalculateMetadataOrExplicit<Schema extends AnyZodObject, Props extends Record<string, unknown>> = OptionalDimensions<Schema, Props> | MandatoryDimensions<Schema, Props>;
|
|
export type CompositionCalculateMetadataOrExplicit<Schema extends AnyZodObject, Props extends Record<string, unknown>> = (OptionalDimensions<Schema, Props> & {
|
|
fps?: number;
|
|
durationInFrames?: number;
|
|
}) | (MandatoryDimensions<Schema, Props> & {
|
|
fps: number;
|
|
durationInFrames: number;
|
|
});
|
|
export type StillProps<Schema extends AnyZodObject, Props extends Record<string, unknown>> = {
|
|
id: string;
|
|
schema?: Schema;
|
|
} & StillCalculateMetadataOrExplicit<Schema, Props> & CompProps<Props> & PropsIfHasProps<Schema, Props>;
|
|
export type CompositionProps<Schema extends AnyZodObject, Props extends Record<string, unknown>> = {
|
|
readonly id: string;
|
|
readonly schema?: Schema;
|
|
} & CompositionCalculateMetadataOrExplicit<Schema, Props> & CompProps<Props> & PropsIfHasProps<Schema, Props>;
|
|
export declare const Composition: <Schema extends AnyZodObject, Props extends Record<string, unknown>>(props: CompositionProps<Schema, Props>) => import("react/jsx-runtime.js").JSX.Element | null;
|
|
export {};
|