🎥 Make videos programmatically with React
Elements: Use direct-export wiring for caption Elements
pullfrog[bot]6efefbe80e0c
diff --git a/packages/docs/elements/captions/basic-captions/basic-captions.tsx b/packages/docs/elements/captions/basic-captions/basic-captions.tsxindex 8602b17a8b..95314d6476 100644--- a/packages/docs/elements/captions/basic-captions/basic-captions.tsx+++ b/packages/docs/elements/captions/basic-captions/basic-captions.tsx@@ -16,11 +16,38 @@ import {type BasicCaptionsProps = InteractiveBaseProps &InteractiveTransformProps &Pick<SequenceProps, 'width' | 'height'> & {- readonly captions: Caption[];+ readonly captions?: Caption[];readonly combineTokensWithinMilliseconds?: number;};const defaultCombineTokensWithinMilliseconds = 2000;+const defaultWidth = 900;+const defaultHeight = 220;+const defaultCaptions: Caption[] = [+ {+ text: 'Simple captions,ready for every video.',+ startMs: 0,+ endMs: 2200,+ timestampMs: 1100,+ confidence: null,+ pageBreakAfter: true,+ },+ {+ text: 'No animation,\njust clear text.',+ startMs: 2200,+ endMs: 4400,+ timestampMs: 3300,+ confidence: null,+ pageBreakAfter: true,+ },+ {+ text: 'Easy to read,\nand easy to customize.',+ startMs: 4400,+ endMs: 7000,+ timestampMs: 5700,+ confidence: null,+ },+];const basicCaptionsSchema = {...Interactive.baseSchema,@@ -109,13 +136,13 @@ const BasicCaptionsInner = forwardRef<>(({- captions,+ captions = defaultCaptions,combineTokensWithinMilliseconds = defaultCombineTokensWithinMilliseconds,controls,+ height = defaultHeight,name,style,- width,- height,+ width = defaultWidth,...interactiveProps},ref,@@ -161,36 +188,4 @@ const BasicCaptionsLayer = Interactive.withSchema({supportsEffects: false,}) as React.FC<BasicCaptionsProps>;-export const BasicCaptions: React.FC = () => {- return (- <BasicCaptionsLayer- captions={[- {- text: 'Simple captions,ready for every video.',- startMs: 0,- endMs: 2200,- timestampMs: 1100,- confidence: null,- pageBreakAfter: true,- },- {- text: 'No animation,\njust clear text.',- startMs: 2200,- endMs: 4400,- timestampMs: 3300,- confidence: null,- pageBreakAfter: true,- },- {- text: 'Easy to read,\nand easy to customize.',- startMs: 4400,- endMs: 7000,- timestampMs: 5700,- confidence: null,- },- ]}- height={220}- width={900}- />- );-};+export const BasicCaptions = BasicCaptionsLayer;diff --git a/packages/docs/elements/captions/moving-pill-captions/moving-pill-captions.tsx b/packages/docs/elements/captions/moving-pill-captions/moving-pill-captions.tsxindex 4b0ac2d893..edcbf0bc68 100644--- a/packages/docs/elements/captions/moving-pill-captions/moving-pill-captions.tsx+++ b/packages/docs/elements/captions/moving-pill-captions/moving-pill-captions.tsx@@ -29,7 +29,7 @@ import {type MovingPillCaptionsProps = InteractiveBaseProps &InteractiveTransformProps &Pick<SequenceProps, 'width' | 'height'> & {- readonly captions: Caption[];+ readonly captions?: Caption[];readonly combineTokensWithinMilliseconds?: number;};@@ -42,6 +42,59 @@ const pillVerticalPadding = 12;const pillBorderRadius = 10;const pillMoveDurationInFrames = 5;const defaultCombineTokensWithinMilliseconds = 800;+const defaultWidth = 682;+const defaultHeight = 252;+const defaultCaptions: Caption[] = [+ {+ text: 'Captions',+ startMs: 0,+ endMs: 800,+ timestampMs: 400,+ confidence: null,+ },+ {+ text: ' can',+ startMs: 800,+ endMs: 1500,+ timestampMs: 1150,+ confidence: null,+ },+ {+ text: ' move',+ startMs: 1500,+ endMs: 2300,+ timestampMs: 1900,+ confidence: null,+ },+ {+ text: ' with',+ startMs: 2300,+ endMs: 3100,+ timestampMs: 2700,+ confidence: null,+ },+ {+ text: ' every',+ startMs: 3100,+ endMs: 4000,+ timestampMs: 3550,+ confidence: null,+ },+ {+ text: ' spoken',+ startMs: 4000,+ endMs: 5100,+ timestampMs: 4550,+ confidence: null,+ },+ {+ text: ' word.',+ startMs: 5100,+ endMs: 6500,+ timestampMs: 5800,+ confidence: null,+ },+];const movingPillCaptionsSchema = {...Interactive.baseSchema,@@ -376,13 +429,13 @@ const MovingPillCaptionsInner = forwardRef<>(({- captions,+ captions = defaultCaptions,combineTokensWithinMilliseconds = defaultCombineTokensWithinMilliseconds,controls,+ height = defaultHeight,name,style,- width,- height,+ width = defaultWidth,...interactiveProps},ref,@@ -440,62 +493,4 @@ const MovingPillCaptionsLayer = Interactive.withSchema({supportsEffects: false,}) as React.FC<MovingPillCaptionsProps>;-export const MovingPillCaptions: React.FC = () => {- return (- <MovingPillCaptionsLayer- captions={[- {- text: 'Captions',- startMs: 0,- endMs: 800,- timestampMs: 400,- confidence: null,- },- {- text: ' can',- startMs: 800,- endMs: 1500,- timestampMs: 1150,- confidence: null,- },- {- text: ' move',- startMs: 1500,- endMs: 2300,- timestampMs: 1900,- confidence: null,- },- {- text: ' with',- startMs: 2300,- endMs: 3100,- timestampMs: 2700,- confidence: null,- },- {- text: ' every',- startMs: 3100,- endMs: 4000,- timestampMs: 3550,- confidence: null,- },- {- text: ' spoken',- startMs: 4000,- endMs: 5100,- timestampMs: 4550,- confidence: null,- },- {- text: ' word.',- startMs: 5100,- endMs: 6500,- timestampMs: 5800,- confidence: null,- },- ]}- width={682}- height={252}- />- );-};+export const MovingPillCaptions = MovingPillCaptionsLayer;diff --git a/packages/docs/elements/captions/popping-word-captions/popping-word-captions.tsx b/packages/docs/elements/captions/popping-word-captions/popping-word-captions.tsxindex 58330a98fe..9bf026b57b 100644--- a/packages/docs/elements/captions/popping-word-captions/popping-word-captions.tsx+++ b/packages/docs/elements/captions/popping-word-captions/popping-word-captions.tsx@@ -28,7 +28,7 @@ import {type PoppingWordCaptionsProps = InteractiveBaseProps &InteractiveTransformProps &Pick<SequenceProps, 'width' | 'height'> & {- readonly captions: Caption[];+ readonly captions?: Caption[];readonly combineTokensWithinMilliseconds?: number;};@@ -38,6 +38,59 @@ const textColor = '#ffffff';const highlightColor = '#4da3ff';const activeWordScale = 1.03;const defaultCombineTokensWithinMilliseconds = 800;+const defaultWidth = 682;+const defaultHeight = 252;+const defaultCaptions: Caption[] = [+ {+ text: 'Captions',+ startMs: 0,+ endMs: 800,+ timestampMs: 400,+ confidence: null,+ },+ {+ text: ' can',+ startMs: 800,+ endMs: 1500,+ timestampMs: 1150,+ confidence: null,+ },+ {+ text: ' move',+ startMs: 1500,+ endMs: 2300,+ timestampMs: 1900,+ confidence: null,+ },+ {+ text: ' with',+ startMs: 2300,+ endMs: 3100,+ timestampMs: 2700,+ confidence: null,+ },+ {+ text: ' every',+ startMs: 3100,+ endMs: 4000,+ timestampMs: 3550,+ confidence: null,+ },+ {+ text: ' spoken',+ startMs: 4000,+ endMs: 5100,+ timestampMs: 4550,+ confidence: null,+ },+ {+ text: ' word.',+ startMs: 5100,+ endMs: 6500,+ timestampMs: 5800,+ confidence: null,+ },+];const poppingWordCaptionsSchema = {...Interactive.baseSchema,@@ -287,13 +340,13 @@ const PoppingWordCaptionsInner = forwardRef<>(({- captions,+ captions = defaultCaptions,combineTokensWithinMilliseconds = defaultCombineTokensWithinMilliseconds,controls,+ height = defaultHeight,name,style,- width,- height,+ width = defaultWidth,...interactiveProps},ref,@@ -351,62 +404,4 @@ const PoppingWordCaptionsLayer = Interactive.withSchema({supportsEffects: false,}) as React.FC<PoppingWordCaptionsProps>;-export const PoppingWordCaptions: React.FC = () => {- return (- <PoppingWordCaptionsLayer- captions={[- {- text: 'Captions',- startMs: 0,- endMs: 800,- timestampMs: 400,- confidence: null,- },- {- text: ' can',- startMs: 800,- endMs: 1500,- timestampMs: 1150,- confidence: null,- },- {- text: ' move',- startMs: 1500,- endMs: 2300,- timestampMs: 1900,- confidence: null,- },- {- text: ' with',- startMs: 2300,- endMs: 3100,- timestampMs: 2700,- confidence: null,- },- {- text: ' every',- startMs: 3100,- endMs: 4000,- timestampMs: 3550,- confidence: null,- },- {- text: ' spoken',- startMs: 4000,- endMs: 5100,- timestampMs: 4550,- confidence: null,- },- {- text: ' word.',- startMs: 5100,- endMs: 6500,- timestampMs: 5800,- confidence: null,- },- ]}- width={682}- height={252}- />- );-};+export const PoppingWordCaptions = PoppingWordCaptionsLayer;diff --git a/packages/docs/elements/captions/word-highlight-captions/word-highlight-captions.tsx b/packages/docs/elements/captions/word-highlight-captions/word-highlight-captions.tsxindex 5a5c155821..998cf245a2 100644--- a/packages/docs/elements/captions/word-highlight-captions/word-highlight-captions.tsx+++ b/packages/docs/elements/captions/word-highlight-captions/word-highlight-captions.tsx@@ -26,7 +26,7 @@ import {type WordHighlightCaptionsProps = InteractiveBaseProps &InteractiveTransformProps &Pick<SequenceProps, 'width' | 'height'> & {- readonly captions: Caption[];+ readonly captions?: Caption[];readonly combineTokensWithinMilliseconds?: number;};@@ -35,6 +35,59 @@ const fontWeight = '700';const textColor = '#ffffff';const highlightColor = '#4da3ff';const defaultCombineTokensWithinMilliseconds = 800;+const defaultWidth = 682;+const defaultHeight = 252;+const defaultCaptions: Caption[] = [+ {+ text: 'Captions',+ startMs: 0,+ endMs: 800,+ timestampMs: 400,+ confidence: null,+ },+ {+ text: ' can',+ startMs: 800,+ endMs: 1500,+ timestampMs: 1150,+ confidence: null,+ },+ {+ text: ' move',+ startMs: 1500,+ endMs: 2300,+ timestampMs: 1900,+ confidence: null,+ },+ {+ text: ' with',+ startMs: 2300,+ endMs: 3100,+ timestampMs: 2700,+ confidence: null,+ },+ {+ text: ' every',+ startMs: 3100,+ endMs: 4000,+ timestampMs: 3550,+ confidence: null,+ },+ {+ text: ' spoken',+ startMs: 4000,+ endMs: 5100,+ timestampMs: 4550,+ confidence: null,+ },+ {+ text: ' word.',+ startMs: 5100,+ endMs: 6500,+ timestampMs: 5800,+ confidence: null,+ },+];const wordHighlightCaptionsSchema = {...Interactive.baseSchema,@@ -245,13 +298,13 @@ const WordHighlightCaptionsInner = forwardRef<>(({- captions,+ captions = defaultCaptions,combineTokensWithinMilliseconds = defaultCombineTokensWithinMilliseconds,controls,+ height = defaultHeight,name,style,- width,- height,+ width = defaultWidth,...interactiveProps},ref,@@ -309,62 +362,4 @@ const WordHighlightCaptionsLayer = Interactive.withSchema({supportsEffects: false,}) as React.FC<WordHighlightCaptionsProps>;-export const WordHighlightCaptions: React.FC = () => {- return (- <WordHighlightCaptionsLayer- captions={[- {- text: 'Captions',- startMs: 0,- endMs: 800,- timestampMs: 400,- confidence: null,- },- {- text: ' can',- startMs: 800,- endMs: 1500,- timestampMs: 1150,- confidence: null,- },- {- text: ' move',- startMs: 1500,- endMs: 2300,- timestampMs: 1900,- confidence: null,- },- {- text: ' with',- startMs: 2300,- endMs: 3100,- timestampMs: 2700,- confidence: null,- },- {- text: ' every',- startMs: 3100,- endMs: 4000,- timestampMs: 3550,- confidence: null,- },- {- text: ' spoken',- startMs: 4000,- endMs: 5100,- timestampMs: 4550,- confidence: null,- },- {- text: ' word.',- startMs: 5100,- endMs: 6500,- timestampMs: 5800,- confidence: null,- },- ]}- width={682}- height={252}- />- );-};+export const WordHighlightCaptions = WordHighlightCaptionsLayer;