nezuhub/simple / node_modules /@remotion /codemods /dist /basic-captions-element-source.d.ts
nezuhub's picture
download
raw
3.06 kB
export declare const basicCaptionsElementSource = "import type {Caption} from '@remotion/captions';\nimport {createTikTokStyleCaptions} from '@remotion/captions';\nimport React, {useMemo} from 'react';\nimport {\n\tInteractive,\n\tuseCurrentFrame,\n\tuseVideoConfig,\n\ttype InteractiveTransformProps,\n\ttype InteractivitySchema,\n\ttype SequenceProps,\n} from 'remotion';\n\ntype BasicCaptionsProps = InteractiveTransformProps &\n\tPick<SequenceProps, 'width'> & {\n\t\treadonly captions: Caption[];\n\t\treadonly combineTokensWithinMilliseconds?: number;\n\t};\n\nconst BasicCaptionsContent: React.FC<BasicCaptionsProps> = ({\n\tcaptions,\n\tcombineTokensWithinMilliseconds = 3000,\n\tstyle,\n\twidth = 900,\n}) => {\n\tconst frame = useCurrentFrame();\n\tconst {fps} = useVideoConfig();\n\tconst pages = useMemo(\n\t\t() =>\n\t\t\tcreateTikTokStyleCaptions({\n\t\t\t\tcaptions,\n\t\t\t\tcombineTokensWithinMilliseconds,\n\t\t\t}).pages,\n\t\t[captions, combineTokensWithinMilliseconds],\n\t);\n\tconst currentTimeMs = (frame / fps) * 1000;\n\tconst page = pages.find(\n\t\t(candidate) =>\n\t\t\tcurrentTimeMs >= candidate.startMs &&\n\t\t\tcurrentTimeMs < candidate.startMs + candidate.durationMs,\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\talignItems: 'center',\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tjustifyContent: 'center',\n\t\t\t\tposition: 'absolute',\n\t\t\t\tbottom: 120,\n\t\t\t\tleft: '50%',\n\t\t\t\ttransform: 'translateX(-50%)',\n\t\t\t\twidth,\n\t\t\t\t...style,\n\t\t\t}}\n\t\t>\n\t\t\t{page ? (\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tbackgroundColor: 'rgba(64, 64, 64, 0.75)',\n\t\t\t\t\t\tcolor: '#ffffff',\n\t\t\t\t\t\tdisplay: '-webkit-box',\n\t\t\t\t\t\tfontFamily: 'Arial, Helvetica, sans-serif',\n\t\t\t\t\t\tfontSize: 64,\n\t\t\t\t\t\tfontWeight: 400,\n\t\t\t\t\t\tlineHeight: 1.2,\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\tpadding: '14px 22px',\n\t\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t\t\ttextWrap: 'balance',\n\t\t\t\t\t\tWebkitBoxOrient: 'vertical',\n\t\t\t\t\t\tWebkitLineClamp: 2,\n\t\t\t\t\t\twhiteSpace: 'pre-wrap',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{page.text.trim()}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t</div>\n\t);\n};\n\nconst basicCaptionsSchema = {\n\t...Interactive.captionsSchema,\n\twidth: {\n\t\ttype: 'number',\n\t\tmin: 1,\n\t\tstep: 1,\n\t\tdefault: undefined,\n\t\tdescription: 'Caption area width',\n\t\thiddenFromList: false,\n\t},\n\tcombineTokensWithinMilliseconds: {\n\t\ttype: 'number',\n\t\tmin: 0,\n\t\tstep: 50,\n\t\tdefault: 3000,\n\t\tdescription: 'Time between caption pages',\n\t\thiddenFromList: false,\n\t},\n} as const satisfies InteractivitySchema;\n\nexport const BasicCaptions = Interactive.create({\n\tComponent: BasicCaptionsContent,\n\tcomponentName: '<BasicCaptions>',\n\tschema: basicCaptionsSchema,\n});\n";
export declare const getBasicCaptionsElementFile: ({ fileName, readFileContents, }: {
fileName: string;
readFileContents: (fileName: string) => string | null;
}) => {
fileName: string;
importPath: string;
shouldWrite: boolean;
};

Xet Storage Details

Size:
3.06 kB
·
Xet hash:
e8eb93eed39a3b62385df6e3c7509b2c91d76b107d5834b79342c1c8b57120fa

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.