Skip to content

🎥 Make videos programmatically with React

Elements: Define library order with an array

JonnyBurger503d73232c2c
diff --git a/packages/docs/render-element-previews.ts b/packages/docs/render-element-previews.ts
index cb5eefa123..e08b5386f0 100644
--- a/packages/docs/render-element-previews.ts
+++ b/packages/docs/render-element-previews.ts
@@ -31,7 +31,7 @@ if (elementArguments.length > 1) {
const selectedElementSlug = elementArguments[0]
? elementArguments[0].slice('--element='.length)
: null;
-const allElementDefinitions = Object.values(elementDefinitions);
+const allElementDefinitions = elementDefinitions;
const selectedElementDefinition = selectedElementSlug
? allElementDefinitions.find(
(definition) => definition.slug === selectedElementSlug,
@@ -69,7 +69,7 @@ const elementCompositions = compositions.filter((composition) =>
);
const expectedCompositionIds = new Set(
- Object.values(elementDefinitions).map((definition) =>
+ elementDefinitions.map((definition) =>
getElementCompositionId(definition.slug),
),
);
diff --git a/packages/docs/src/components/Elements/element-definitions.ts b/packages/docs/src/components/Elements/element-definitions.ts
index 3d412fe683..f36d7bda8a 100644
--- a/packages/docs/src/components/Elements/element-definitions.ts
+++ b/packages/docs/src/components/Elements/element-definitions.ts
@@ -42,11 +42,7 @@ import {YouTubeCommentHighlight} from '../../../elements/youtube/youtube-comment
import {YouTubeEndCard} from '../../../elements/youtube/youtube-end-card/youtube-end-card';
import {YouTubeSubscribeNudge} from '../../../elements/youtube/youtube-subscribe-nudge/youtube-subscribe-nudge';
import type {Contributor} from '../Credits';
-import {
- elementRegistry,
- type ElementCategory,
- type ElementSlug,
-} from './element-registry';
+import {elementRegistry, type ElementCategory} from './element-registry';
export type ElementPreviewLayout = 'composition' | 'vertical';
@@ -80,8 +76,11 @@ export type ElementDefinition = {
readonly width: number;
};
-const elementImplementations = {
- 'audio/oscilloscope': {
+// Array order defines the order of categories and cards in the Element library.
+export const elementDefinitions = [
+ {
+ ...elementRegistry['audio/oscilloscope'],
+ slug: 'audio/oscilloscope',
component: AudioOscilloscope,
contributors: [{username: 'samohovets', contribution: 'Author'}],
description:
@@ -107,7 +106,9 @@ const elementImplementations = {
installationMode: 'component-owned-sequence',
width: 1920,
},
- 'audio/waveform-progress': {
+ {
+ ...elementRegistry['audio/waveform-progress'],
+ slug: 'audio/waveform-progress',
component: AudioWaveformProgress,
contributors: [{username: 'samohovets', contribution: 'Author'}],
description: 'A full-clip audio waveform with played progress.',
@@ -132,7 +133,9 @@ const elementImplementations = {
installationMode: 'component-owned-sequence',
width: 1920,
},
- 'audio/mirrored-spectrum': {
+ {
+ ...elementRegistry['audio/mirrored-spectrum'],
+ slug: 'audio/mirrored-spectrum',
component: MirroredAudioSpectrum,
contributors: [{username: 'JonnyBurger', contribution: 'Author'}],
description:
@@ -158,80 +161,9 @@ const elementImplementations = {
installationMode: 'component-owned-sequence',
width: 1920,
},
- 'backgrounds/liquid-contours': {
- component: LiquidContours,
- contributors: [],
- description:
- 'A flowing two-color background made from animated liquid contour bands.',
- dependencies: [{name: '@remotion/effects', version: null}],
- durationInFrames: 240,
- elementHeight: null,
- elementWidth: null,
- fps: 30,
- height: 1080,
- posterFrame: 120,
- preview: {
- previewLayout: 'composition',
- posterUrl:
- 'https://remotion.media/elements/backgrounds-liquid-contours-preview.png',
- videoUrl:
- 'https://remotion.media/elements/backgrounds-liquid-contours-preview.mp4',
- },
- safeArea: 0,
- installationMode: 'wrapped',
- width: 1920,
- },
- 'maps/map-flyover': {
- component: MapFlyover,
- contributors: [],
- description:
- 'An animated map flyover from point A to point B, with editable coordinates, location labels, and a camera that follows the route.',
- dependencies: [
- {name: '@turf/turf', version: '7.3.2'},
- {name: 'maplibre-gl', version: '6.4.1'},
- ],
- durationInFrames: 285,
- elementHeight: null,
- elementWidth: null,
- fps: 30,
- height: 1080,
- posterFrame: 240,
- preview: {
- previewLayout: 'composition',
- posterUrl: 'https://remotion.media/elements/maps-map-flyover-preview.png',
- videoUrl: 'https://remotion.media/elements/maps-map-flyover-preview.mp4',
- },
- safeArea: 0,
- installationMode: 'component-owned-sequence',
- width: 1920,
- },
- 'maps/watercolor-map': {
- component: WatercolorMap,
- contributors: [
- {username: 'JonnyBurger', contribution: 'Author'},
- {username: 'MehmetAdemi', contribution: 'Author'},
- ],
- description:
- 'A watercolor map journey between two editable locations, with animated labels, markers, and a hand-drawn route.',
- dependencies: [{name: '@remotion/google-fonts', version: null}],
- durationInFrames: 200,
- elementHeight: null,
- elementWidth: null,
- fps: 30,
- height: 1080,
- posterFrame: 145,
- preview: {
- previewLayout: 'composition',
- posterUrl:
- 'https://remotion.media/elements/maps-watercolor-map-preview.png',
- videoUrl:
- 'https://remotion.media/elements/maps-watercolor-map-preview.mp4',
- },
- safeArea: 0,
- installationMode: 'component-owned-sequence',
- width: 1920,
- },
- 'backgrounds/notebook-paper': {
+ {
+ ...elementRegistry['backgrounds/notebook-paper'],
+ slug: 'backgrounds/notebook-paper',
component: NotebookPaper,
contributors: [],
description: 'A white paper background with subtle blue gridlines.',
@@ -253,7 +185,9 @@ const elementImplementations = {
installationMode: 'wrapped',
width: 1920,
},
- 'backgrounds/paper-texture': {
+ {
+ ...elementRegistry['backgrounds/paper-texture'],
+ slug: 'backgrounds/paper-texture',
component: PaperTexture,
contributors: [],
description:
@@ -276,7 +210,9 @@ const elementImplementations = {
installationMode: 'wrapped',
width: 1920,
},
- 'backgrounds/rotating-starburst': {
+ {
+ ...elementRegistry['backgrounds/rotating-starburst'],
+ slug: 'backgrounds/rotating-starburst',
component: RotatingStarburst,
contributors: [],
description: 'A solid background with a slowly rotating starburst effect.',
@@ -298,172 +234,225 @@ const elementImplementations = {
installationMode: 'wrapped',
width: 1920,
},
- 'overlays/location-lower-third': {
- component: LocationLowerThird,
+ {
+ ...elementRegistry['backgrounds/liquid-contours'],
+ slug: 'backgrounds/liquid-contours',
+ component: LiquidContours,
contributors: [],
- description: 'An animated lower third for an event location and venue.',
- dependencies: [],
- durationInFrames: 120,
- elementHeight: 138,
- elementWidth: 680,
+ description:
+ 'A flowing two-color background made from animated liquid contour bands.',
+ dependencies: [{name: '@remotion/effects', version: null}],
+ durationInFrames: 240,
+ elementHeight: null,
+ elementWidth: null,
fps: 30,
height: 1080,
- posterFrame: 60,
+ posterFrame: 120,
preview: {
previewLayout: 'composition',
posterUrl:
- 'https://remotion.media/elements/overlays-location-lower-third-preview.png',
+ 'https://remotion.media/elements/backgrounds-liquid-contours-preview.png',
videoUrl:
- 'https://remotion.media/elements/overlays-location-lower-third-preview.mp4',
+ 'https://remotion.media/elements/backgrounds-liquid-contours-preview.mp4',
},
- safeArea: 300,
+ safeArea: 0,
installationMode: 'wrapped',
width: 1920,
},
- 'overlays/name-lower-third': {
- component: NameLowerThird,
- contributors: [],
+ {
+ ...elementRegistry['captions/basic-captions'],
+ slug: 'captions/basic-captions',
+ component: BasicCaptions,
+ contributors: [{username: 'JonnyBurger', contribution: null}],
description:
- 'A clean animated lower third for introducing a speaker, guest, or host.',
- dependencies: [{name: '@remotion/google-fonts', version: null}],
- durationInFrames: 120,
- elementHeight: 132,
- elementWidth: 534,
+ 'Simple synchronized captions with white text on a translucent gray background.',
+ dependencies: [{name: '@remotion/captions', version: null}],
+ durationInFrames: 210,
+ elementHeight: 220,
+ elementWidth: 900,
fps: 30,
height: 1080,
- posterFrame: 60,
+ posterFrame: 75,
preview: {
previewLayout: 'composition',
posterUrl:
- 'https://remotion.media/elements/overlays-name-lower-third-preview.png',
+ 'https://remotion.media/elements/captions-basic-captions-preview.png',
videoUrl:
- 'https://remotion.media/elements/overlays-name-lower-third-preview.mp4',
+ 'https://remotion.media/elements/captions-basic-captions-preview.mp4',
},
- safeArea: 300,
- installationMode: 'wrapped',
+ safeArea: 120,
+ installationMode: 'component-owned-sequence',
width: 1920,
},
- 'overlays/social-safe-zones': {
- component: SocialSafeZones,
- contributors: [],
+ {
+ ...elementRegistry['captions/moving-pill-captions'],
+ slug: 'captions/moving-pill-captions',
+ component: MovingPillCaptions,
+ contributors: [{username: 'JonnyBurger', contribution: null}],
description:
- 'Capture-calibrated safe-area guides for TikTok and Instagram Reels.',
- dependencies: [],
- durationInFrames: 120,
- elementHeight: 1920,
- elementWidth: 1080,
+ 'Synchronized captions with a pill that moves between spoken words.',
+ dependencies: [
+ {name: '@remotion/captions', version: null},
+ {name: '@remotion/google-fonts', version: null},
+ {name: '@remotion/layout-utils', version: null},
+ ],
+ durationInFrames: 210,
+ elementHeight: 252,
+ elementWidth: 682,
fps: 30,
- height: 1920,
- posterFrame: 0,
+ height: 1080,
+ posterFrame: 75,
preview: {
- previewLayout: 'vertical',
+ previewLayout: 'composition',
posterUrl:
- 'https://remotion.media/elements/overlays-social-safe-zones-preview.png',
+ 'https://remotion.media/elements/captions-moving-pill-captions-preview.png',
videoUrl:
- 'https://remotion.media/elements/overlays-social-safe-zones-preview.mp4',
+ 'https://remotion.media/elements/captions-moving-pill-captions-preview.mp4',
},
- safeArea: 0,
+ safeArea: 120,
installationMode: 'component-owned-sequence',
- width: 1080,
+ width: 1920,
},
- 'youtube/youtube-comment-highlight': {
- component: YouTubeCommentHighlight,
- contributors: [],
- description: 'A YouTube-style card for featuring a viewer comment.',
- dependencies: [{name: '@remotion/google-fonts', version: null}],
- durationInFrames: 180,
- elementHeight: 360,
- elementWidth: 1120,
+ {
+ ...elementRegistry['captions/popping-word-captions'],
+ slug: 'captions/popping-word-captions',
+ component: PoppingWordCaptions,
+ contributors: [{username: 'JonnyBurger', contribution: null}],
+ description: 'Synchronized captions that pop each spoken word into focus.',
+ dependencies: [
+ {name: '@remotion/captions', version: null},
+ {name: '@remotion/google-fonts', version: null},
+ {name: '@remotion/layout-utils', version: null},
+ ],
+ durationInFrames: 210,
+ elementHeight: 252,
+ elementWidth: 682,
fps: 30,
height: 1080,
- posterFrame: 135,
+ posterFrame: 75,
preview: {
previewLayout: 'composition',
posterUrl:
- 'https://remotion.media/elements/youtube-youtube-comment-highlight-preview.png',
+ 'https://remotion.media/elements/captions-popping-word-captions-preview.png',
videoUrl:
- 'https://remotion.media/elements/youtube-youtube-comment-highlight-preview.mp4',
+ 'https://remotion.media/elements/captions-popping-word-captions-preview.mp4',
},
- safeArea: 200,
- installationMode: 'wrapped',
+ safeArea: 120,
+ installationMode: 'component-owned-sequence',
width: 1920,
},
- 'youtube/youtube-end-card': {
- component: YouTubeEndCard,
+ {
+ ...elementRegistry['captions/word-highlight-captions'],
+ slug: 'captions/word-highlight-captions',
+ component: WordHighlightCaptions,
+ contributors: [{username: 'JonnyBurger', contribution: null}],
+ description: 'Synchronized captions that highlight each spoken word.',
+ dependencies: [
+ {name: '@remotion/captions', version: null},
+ {name: '@remotion/google-fonts', version: null},
+ {name: '@remotion/layout-utils', version: null},
+ ],
+ durationInFrames: 210,
+ elementHeight: 252,
+ elementWidth: 682,
+ fps: 30,
+ height: 1080,
+ posterFrame: 75,
+ preview: {
+ previewLayout: 'composition',
+ posterUrl:
+ 'https://remotion.media/elements/captions-word-highlight-captions-preview.png',
+ videoUrl:
+ 'https://remotion.media/elements/captions-word-highlight-captions-preview.mp4',
+ },
+ safeArea: 120,
+ installationMode: 'component-owned-sequence',
+ width: 1920,
+ },
+ {
+ ...elementRegistry['commerce/product-collection'],
+ slug: 'commerce/product-collection',
+ component: ProductCollection,
contributors: [],
description:
- 'A clean YouTube endcard with social links and space for recommended videos.',
+ 'An animated product carousel that adapts to changing catalog images, titles, prices, and promotions.',
dependencies: [{name: '@remotion/google-fonts', version: null}],
- durationInFrames: 150,
- elementHeight: null,
- elementWidth: null,
+ durationInFrames: productCollectionDurationInFrames,
+ elementHeight: 1020,
+ elementWidth: 1020,
fps: 30,
height: 1080,
- posterFrame: 75,
+ posterFrame: 90,
preview: {
previewLayout: 'composition',
posterUrl:
- 'https://remotion.media/elements/overlays-social-endcard-preview.png',
+ 'https://remotion.media/elements/commerce-product-collection-preview.png',
videoUrl:
- 'https://remotion.media/elements/overlays-social-endcard-preview.mp4',
+ 'https://remotion.media/elements/commerce-product-collection-preview.mp4',
},
- safeArea: 0,
+ safeArea: 30,
installationMode: 'wrapped',
- width: 1920,
+ width: 1080,
},
- 'youtube/youtube-subscribe-nudge': {
- component: YouTubeSubscribeNudge,
+ {
+ ...elementRegistry['commerce/product-discount-callout'],
+ slug: 'commerce/product-discount-callout',
+ component: ProductDiscountCallout,
contributors: [],
description:
- 'An animated creator-branded subscribe prompt with a subscribed-state confirmation.',
+ 'An animated product cutout with pricing and a hinged discount callout.',
dependencies: [
{name: '@remotion/google-fonts', version: null},
- {name: '@remotion/media', version: null},
- {name: '@remotion/sfx', version: null},
+ {name: '@remotion/shapes', version: null},
],
durationInFrames: 120,
- elementHeight: 240,
- elementWidth: 760,
+ elementHeight: 650,
+ elementWidth: 900,
fps: 30,
height: 1080,
- posterFrame: 50,
+ posterFrame: 57,
preview: {
previewLayout: 'composition',
posterUrl:
- 'https://remotion.media/elements/youtube-youtube-subscribe-nudge-preview.png',
+ 'https://remotion.media/elements/commerce-product-discount-callout-preview.png',
videoUrl:
- 'https://remotion.media/elements/youtube-youtube-subscribe-nudge-preview.mp4',
+ 'https://remotion.media/elements/commerce-product-discount-callout-preview.mp4',
},
- safeArea: 240,
+ safeArea: 90,
installationMode: 'wrapped',
- width: 1920,
+ width: 1080,
},
- 'data/horizontal-bar-chart': {
- component: HorizontalBarChart,
+ {
+ ...elementRegistry['commerce/product-offer'],
+ slug: 'commerce/product-offer',
+ component: ProductOffer,
contributors: [],
- description: 'A bold bar chart with three directly labeled data points.',
+ description:
+ 'An animated product card with a bold title, catalog image, pricing, and discount.',
dependencies: [{name: '@remotion/google-fonts', version: null}],
- durationInFrames: 120,
- elementHeight: null,
- elementWidth: null,
+ durationInFrames: 150,
+ elementHeight: 900,
+ elementWidth: 900,
fps: 30,
height: 1080,
- posterFrame: 70,
+ posterFrame: 75,
preview: {
previewLayout: 'composition',
posterUrl:
- 'https://remotion.media/elements/data-horizontal-bar-chart-preview.png',
+ 'https://remotion.media/elements/commerce-product-offer-preview.png',
videoUrl:
- 'https://remotion.media/elements/data-horizontal-bar-chart-preview.mp4',
+ 'https://remotion.media/elements/commerce-product-offer-preview.mp4',
},
- safeArea: 0,
+ safeArea: 90,
installationMode: 'wrapped',
- width: 1920,
+ width: 1080,
},
- 'data/line-chart': {
- component: LineChart,
+ {
+ ...elementRegistry['data/horizontal-bar-chart'],
+ slug: 'data/horizontal-bar-chart',
+ component: HorizontalBarChart,
contributors: [],
- description: 'A bold animated line chart with a directly labeled trend.',
+ description: 'A bold bar chart with three directly labeled data points.',
dependencies: [{name: '@remotion/google-fonts', version: null}],
durationInFrames: 120,
elementHeight: null,
@@ -473,18 +462,21 @@ const elementImplementations = {
posterFrame: 70,
preview: {
previewLayout: 'composition',
- posterUrl: 'https://remotion.media/elements/data-line-chart-preview.png',
- videoUrl: 'https://remotion.media/elements/data-line-chart-preview.mp4',
+ posterUrl:
+ 'https://remotion.media/elements/data-horizontal-bar-chart-preview.png',
+ videoUrl:
+ 'https://remotion.media/elements/data-horizontal-bar-chart-preview.mp4',
},
safeArea: 0,
installationMode: 'wrapped',
width: 1920,
},
- 'data/pie-chart': {
- component: PieChart,
+ {
+ ...elementRegistry['data/line-chart'],
+ slug: 'data/line-chart',
+ component: LineChart,
contributors: [],
- description:
- 'A bold animated pie chart with four directly labeled data points.',
+ description: 'A bold animated line chart with a directly labeled trend.',
dependencies: [{name: '@remotion/google-fonts', version: null}],
durationInFrames: 120,
elementHeight: null,
@@ -494,14 +486,16 @@ const elementImplementations = {
posterFrame: 70,
preview: {
previewLayout: 'composition',
- posterUrl: 'https://remotion.media/elements/data-pie-chart-preview.png',
- videoUrl: 'https://remotion.media/elements/data-pie-chart-preview.mp4',
+ posterUrl: 'https://remotion.media/elements/data-line-chart-preview.png',
+ videoUrl: 'https://remotion.media/elements/data-line-chart-preview.mp4',
},
safeArea: 0,
installationMode: 'wrapped',
width: 1920,
},
- 'data/number-counter': {
+ {
+ ...elementRegistry['data/number-counter'],
+ slug: 'data/number-counter',
component: NumberCounter,
contributors: [
{
@@ -529,175 +523,210 @@ const elementImplementations = {
installationMode: 'wrapped',
width: 1920,
},
- 'data/vertical-bar-chart': {
- component: VerticalBarChart,
+ {
+ ...elementRegistry['data/pie-chart'],
+ slug: 'data/pie-chart',
+ component: PieChart,
contributors: [],
description:
- 'A bold vertical bar chart with three directly labeled data points.',
+ 'A bold animated pie chart with four directly labeled data points.',
dependencies: [{name: '@remotion/google-fonts', version: null}],
durationInFrames: 120,
elementHeight: null,
elementWidth: null,
fps: 30,
height: 1080,
- posterFrame: 115,
+ posterFrame: 70,
preview: {
previewLayout: 'composition',
- posterUrl:
- 'https://remotion.media/elements/data-vertical-bar-chart-preview.png',
- videoUrl:
- 'https://remotion.media/elements/data-vertical-bar-chart-preview.mp4',
+ posterUrl: 'https://remotion.media/elements/data-pie-chart-preview.png',
+ videoUrl: 'https://remotion.media/elements/data-pie-chart-preview.mp4',
},
safeArea: 0,
installationMode: 'wrapped',
width: 1920,
},
- 'commerce/product-collection': {
- component: ProductCollection,
+ {
+ ...elementRegistry['data/vertical-bar-chart'],
+ slug: 'data/vertical-bar-chart',
+ component: VerticalBarChart,
contributors: [],
description:
- 'An animated product carousel that adapts to changing catalog images, titles, prices, and promotions.',
+ 'A bold vertical bar chart with three directly labeled data points.',
dependencies: [{name: '@remotion/google-fonts', version: null}],
- durationInFrames: productCollectionDurationInFrames,
- elementHeight: 1020,
- elementWidth: 1020,
+ durationInFrames: 120,
+ elementHeight: null,
+ elementWidth: null,
fps: 30,
height: 1080,
- posterFrame: 90,
+ posterFrame: 115,
preview: {
previewLayout: 'composition',
posterUrl:
- 'https://remotion.media/elements/commerce-product-collection-preview.png',
+ 'https://remotion.media/elements/data-vertical-bar-chart-preview.png',
videoUrl:
- 'https://remotion.media/elements/commerce-product-collection-preview.mp4',
+ 'https://remotion.media/elements/data-vertical-bar-chart-preview.mp4',
},
- safeArea: 30,
+ safeArea: 0,
installationMode: 'wrapped',
- width: 1080,
+ width: 1920,
},
- 'commerce/product-discount-callout': {
- component: ProductDiscountCallout,
+ {
+ ...elementRegistry['maps/map-flyover'],
+ slug: 'maps/map-flyover',
+ component: MapFlyover,
contributors: [],
description:
- 'An animated product cutout with pricing and a hinged discount callout.',
+ 'An animated map flyover from point A to point B, with editable coordinates, location labels, and a camera that follows the route.',
dependencies: [
- {name: '@remotion/google-fonts', version: null},
- {name: '@remotion/shapes', version: null},
+ {name: '@turf/turf', version: '7.3.2'},
+ {name: 'maplibre-gl', version: '6.4.1'},
],
- durationInFrames: 120,
- elementHeight: 650,
- elementWidth: 900,
+ durationInFrames: 285,
+ elementHeight: null,
+ elementWidth: null,
fps: 30,
height: 1080,
- posterFrame: 57,
+ posterFrame: 240,
preview: {
previewLayout: 'composition',
- posterUrl:
- 'https://remotion.media/elements/commerce-product-discount-callout-preview.png',
- videoUrl:
- 'https://remotion.media/elements/commerce-product-discount-callout-preview.mp4',
+ posterUrl: 'https://remotion.media/elements/maps-map-flyover-preview.png',
+ videoUrl: 'https://remotion.media/elements/maps-map-flyover-preview.mp4',
},
- safeArea: 90,
- installationMode: 'wrapped',
- width: 1080,
+ safeArea: 0,
+ installationMode: 'component-owned-sequence',
+ width: 1920,
},
- 'commerce/product-offer': {
- component: ProductOffer,
- contributors: [],
+ {
+ ...elementRegistry['maps/watercolor-map'],
+ slug: 'maps/watercolor-map',
+ component: WatercolorMap,
+ contributors: [
+ {username: 'JonnyBurger', contribution: 'Author'},
+ {username: 'MehmetAdemi', contribution: 'Author'},
+ ],
description:
- 'An animated product card with a bold title, catalog image, pricing, and discount.',
+ 'A watercolor map journey between two editable locations, with animated labels, markers, and a hand-drawn route.',
dependencies: [{name: '@remotion/google-fonts', version: null}],
- durationInFrames: 150,
- elementHeight: 900,
- elementWidth: 900,
+ durationInFrames: 200,
+ elementHeight: null,
+ elementWidth: null,
fps: 30,
height: 1080,
- posterFrame: 75,
+ posterFrame: 145,
preview: {
previewLayout: 'composition',
posterUrl:
- 'https://remotion.media/elements/commerce-product-offer-preview.png',
+ 'https://remotion.media/elements/maps-watercolor-map-preview.png',
videoUrl:
- 'https://remotion.media/elements/commerce-product-offer-preview.mp4',
+ 'https://remotion.media/elements/maps-watercolor-map-preview.mp4',
},
- safeArea: 90,
- installationMode: 'wrapped',
- width: 1080,
+ safeArea: 0,
+ installationMode: 'component-owned-sequence',
+ width: 1920,
},
- 'text/circle-marker': {
- component: CircleMarker,
+ {
+ ...elementRegistry['overlays/location-lower-third'],
+ slug: 'overlays/location-lower-third',
+ component: LocationLowerThird,
contributors: [],
- description:
- 'An animated hand-drawn circle with posterized drawing progress and shape changes.',
- dependencies: [
- {name: '@remotion/google-fonts', version: null},
- {name: '@remotion/rough-notation', version: null},
- ],
+ description: 'An animated lower third for an event location and venue.',
+ dependencies: [],
durationInFrames: 120,
- elementHeight: 220,
- elementWidth: 900,
+ elementHeight: 138,
+ elementWidth: 680,
fps: 30,
height: 1080,
posterFrame: 60,
preview: {
previewLayout: 'composition',
posterUrl:
- 'https://remotion.media/elements/text-circle-marker-preview.png',
+ 'https://remotion.media/elements/overlays-location-lower-third-preview.png',
videoUrl:
- 'https://remotion.media/elements/text-circle-marker-preview.mp4',
+ 'https://remotion.media/elements/overlays-location-lower-third-preview.mp4',
},
- safeArea: 120,
+ safeArea: 300,
installationMode: 'wrapped',
width: 1920,
},
- 'text/crossed-off': {
- component: CrossedOffText,
+ {
+ ...elementRegistry['overlays/name-lower-third'],
+ slug: 'overlays/name-lower-third',
+ component: NameLowerThird,
contributors: [],
description:
- 'An animated hand-drawn cross for removing a word or phrase with emphasis.',
- dependencies: [
- {name: '@remotion/google-fonts', version: null},
- {name: '@remotion/rough-notation', version: null},
- ],
+ 'A clean animated lower third for introducing a speaker, guest, or host.',
+ dependencies: [{name: '@remotion/google-fonts', version: null}],
durationInFrames: 120,
- elementHeight: 220,
- elementWidth: 900,
+ elementHeight: 132,
+ elementWidth: 534,
fps: 30,
height: 1080,
posterFrame: 60,
preview: {
previewLayout: 'composition',
- posterUrl: 'https://remotion.media/elements/text-crossed-off-preview.png',
- videoUrl: 'https://remotion.media/elements/text-crossed-off-preview.mp4',
+ posterUrl:
+ 'https://remotion.media/elements/overlays-name-lower-third-preview.png',
+ videoUrl:
+ 'https://remotion.media/elements/overlays-name-lower-third-preview.mp4',
},
- safeArea: 120,
+ safeArea: 300,
installationMode: 'wrapped',
width: 1920,
},
- 'text/spinning-text-wheel': {
- component: SpinningTextWheel,
- contributors: [{username: 'JonnyBurger', contribution: null}],
+ {
+ ...elementRegistry['overlays/social-safe-zones'],
+ slug: 'overlays/social-safe-zones',
+ component: SocialSafeZones,
+ contributors: [],
description:
- 'A 3D text wheel that spins through options and decelerates onto a highlighted selection.',
- dependencies: [{name: '@remotion/google-fonts', version: null}],
+ 'Capture-calibrated safe-area guides for TikTok and Instagram Reels.',
+ dependencies: [],
durationInFrames: 120,
- elementHeight: 200,
- elementWidth: 400,
+ elementHeight: 1920,
+ elementWidth: 1080,
+ fps: 30,
+ height: 1920,
+ posterFrame: 0,
+ preview: {
+ previewLayout: 'vertical',
+ posterUrl:
+ 'https://remotion.media/elements/overlays-social-safe-zones-preview.png',
+ videoUrl:
+ 'https://remotion.media/elements/overlays-social-safe-zones-preview.mp4',
+ },
+ safeArea: 0,
+ installationMode: 'component-owned-sequence',
+ width: 1080,
+ },
+ {
+ ...elementRegistry['text/news-article-highlight'],
+ slug: 'text/news-article-highlight',
+ component: NewsArticleHighlight,
+ contributors: [],
+ description:
+ 'A framed news article with camera movement, blur, and animated passage highlights.',
+ dependencies: [{name: '@remotion/rough-notation', version: null}],
+ durationInFrames: 150,
+ elementHeight: null,
+ elementWidth: null,
fps: 30,
height: 1080,
- posterFrame: 105,
+ posterFrame: 100,
preview: {
previewLayout: 'composition',
posterUrl:
- 'https://remotion.media/elements/text-spinning-text-wheel-preview.png',
+ 'https://remotion.media/elements/text-news-article-highlight-preview.png',
videoUrl:
- 'https://remotion.media/elements/text-spinning-text-wheel-preview.mp4',
+ 'https://remotion.media/elements/text-news-article-highlight-preview.mp4',
},
- safeArea: 120,
- installationMode: 'component-owned-sequence',
+ safeArea: 0,
+ installationMode: 'wrapped',
width: 1920,
},
- 'storytelling/on-screen-messages': {
+ {
+ ...elementRegistry['storytelling/on-screen-messages'],
+ slug: 'storytelling/on-screen-messages',
component: OnScreenMessages,
contributors: [],
description:
@@ -720,7 +749,9 @@ const elementImplementations = {
installationMode: 'wrapped',
width: 1920,
},
- 'storytelling/polaroid-pictures': {
+ {
+ ...elementRegistry['storytelling/polaroid-pictures'],
+ slug: 'storytelling/polaroid-pictures',
component: PolaroidPictures,
contributors: [],
description:
@@ -743,34 +774,41 @@ const elementImplementations = {
installationMode: 'wrapped',
width: 1920,
},
- 'text/news-article-highlight': {
- component: NewsArticleHighlight,
+ {
+ ...elementRegistry['text/circle-marker'],
+ slug: 'text/circle-marker',
+ component: CircleMarker,
contributors: [],
description:
- 'A framed news article with camera movement, blur, and animated passage highlights.',
- dependencies: [{name: '@remotion/rough-notation', version: null}],
- durationInFrames: 150,
- elementHeight: null,
- elementWidth: null,
+ 'An animated hand-drawn circle with posterized drawing progress and shape changes.',
+ dependencies: [
+ {name: '@remotion/google-fonts', version: null},
+ {name: '@remotion/rough-notation', version: null},
+ ],
+ durationInFrames: 120,
+ elementHeight: 220,
+ elementWidth: 900,
fps: 30,
height: 1080,
- posterFrame: 100,
+ posterFrame: 60,
preview: {
previewLayout: 'composition',
posterUrl:
- 'https://remotion.media/elements/text-news-article-highlight-preview.png',
+ 'https://remotion.media/elements/text-circle-marker-preview.png',
videoUrl:
- 'https://remotion.media/elements/text-news-article-highlight-preview.mp4',
+ 'https://remotion.media/elements/text-circle-marker-preview.mp4',
},
- safeArea: 0,
+ safeArea: 120,
installationMode: 'wrapped',
width: 1920,
},
- 'text/strike-through': {
- component: StrikeThroughText,
+ {
+ ...elementRegistry['text/crossed-off'],
+ slug: 'text/crossed-off',
+ component: CrossedOffText,
contributors: [],
description:
- 'An animated hand-drawn line for striking through a word or phrase.',
+ 'An animated hand-drawn cross for removing a word or phrase with emphasis.',
dependencies: [
{name: '@remotion/google-fonts', version: null},
{name: '@remotion/rough-notation', version: null},
@@ -781,22 +819,47 @@ const elementImplementations = {
fps: 30,
height: 1080,
posterFrame: 60,
+ preview: {
+ previewLayout: 'composition',
+ posterUrl: 'https://remotion.media/elements/text-crossed-off-preview.png',
+ videoUrl: 'https://remotion.media/elements/text-crossed-off-preview.mp4',
+ },
+ safeArea: 120,
+ installationMode: 'wrapped',
+ width: 1920,
+ },
+ {
+ ...elementRegistry['text/spinning-text-wheel'],
+ slug: 'text/spinning-text-wheel',
+ component: SpinningTextWheel,
+ contributors: [{username: 'JonnyBurger', contribution: null}],
+ description:
+ 'A 3D text wheel that spins through options and decelerates onto a highlighted selection.',
+ dependencies: [{name: '@remotion/google-fonts', version: null}],
+ durationInFrames: 120,
+ elementHeight: 200,
+ elementWidth: 400,
+ fps: 30,
+ height: 1080,
+ posterFrame: 105,
preview: {
previewLayout: 'composition',
posterUrl:
- 'https://remotion.media/elements/text-strike-through-preview.png',
+ 'https://remotion.media/elements/text-spinning-text-wheel-preview.png',
videoUrl:
- 'https://remotion.media/elements/text-strike-through-preview.mp4',
+ 'https://remotion.media/elements/text-spinning-text-wheel-preview.mp4',
},
safeArea: 120,
- installationMode: 'wrapped',
+ installationMode: 'component-owned-sequence',
width: 1920,
},
- 'text/text-marker': {
- component: TextMarker,
+ {
+ ...elementRegistry['text/strike-through'],
+ slug: 'text/strike-through',
+ component: StrikeThroughText,
contributors: [],
description:
- 'A hand-drawn animated text marker for calling attention to one phrase.',
+ 'An animated hand-drawn line for striking through a word or phrase.',
dependencies: [
{name: '@remotion/google-fonts', version: null},
{name: '@remotion/rough-notation', version: null},
@@ -809,132 +872,117 @@ const elementImplementations = {
posterFrame: 60,
preview: {
previewLayout: 'composition',
- posterUrl: 'https://remotion.media/elements/text-text-marker-preview.png',
- videoUrl: 'https://remotion.media/elements/text-text-marker-preview.mp4',
+ posterUrl:
+ 'https://remotion.media/elements/text-strike-through-preview.png',
+ videoUrl:
+ 'https://remotion.media/elements/text-strike-through-preview.mp4',
},
safeArea: 120,
installationMode: 'wrapped',
width: 1920,
},
- 'captions/basic-captions': {
- component: BasicCaptions,
- contributors: [{username: 'JonnyBurger', contribution: null}],
+ {
+ ...elementRegistry['text/text-marker'],
+ slug: 'text/text-marker',
+ component: TextMarker,
+ contributors: [],
description:
- 'Simple synchronized captions with white text on a translucent gray background.',
- dependencies: [{name: '@remotion/captions', version: null}],
- durationInFrames: 210,
+ 'A hand-drawn animated text marker for calling attention to one phrase.',
+ dependencies: [
+ {name: '@remotion/google-fonts', version: null},
+ {name: '@remotion/rough-notation', version: null},
+ ],
+ durationInFrames: 120,
elementHeight: 220,
elementWidth: 900,
fps: 30,
height: 1080,
- posterFrame: 75,
+ posterFrame: 60,
preview: {
previewLayout: 'composition',
- posterUrl:
- 'https://remotion.media/elements/captions-basic-captions-preview.png',
- videoUrl:
- 'https://remotion.media/elements/captions-basic-captions-preview.mp4',
+ posterUrl: 'https://remotion.media/elements/text-text-marker-preview.png',
+ videoUrl: 'https://remotion.media/elements/text-text-marker-preview.mp4',
},
safeArea: 120,
- installationMode: 'component-owned-sequence',
+ installationMode: 'wrapped',
width: 1920,
},
- 'captions/moving-pill-captions': {
- component: MovingPillCaptions,
- contributors: [{username: 'JonnyBurger', contribution: null}],
- description:
- 'Synchronized captions with a pill that moves between spoken words.',
- dependencies: [
- {name: '@remotion/captions', version: null},
- {name: '@remotion/google-fonts', version: null},
- {name: '@remotion/layout-utils', version: null},
- ],
- durationInFrames: 210,
- elementHeight: 252,
- elementWidth: 682,
+ {
+ ...elementRegistry['youtube/youtube-comment-highlight'],
+ slug: 'youtube/youtube-comment-highlight',
+ component: YouTubeCommentHighlight,
+ contributors: [],
+ description: 'A YouTube-style card for featuring a viewer comment.',
+ dependencies: [{name: '@remotion/google-fonts', version: null}],
+ durationInFrames: 180,
+ elementHeight: 360,
+ elementWidth: 1120,
fps: 30,
height: 1080,
- posterFrame: 75,
+ posterFrame: 135,
preview: {
previewLayout: 'composition',
posterUrl:
- 'https://remotion.media/elements/captions-moving-pill-captions-preview.png',
+ 'https://remotion.media/elements/youtube-youtube-comment-highlight-preview.png',
videoUrl:
- 'https://remotion.media/elements/captions-moving-pill-captions-preview.mp4',
+ 'https://remotion.media/elements/youtube-youtube-comment-highlight-preview.mp4',
},
- safeArea: 120,
- installationMode: 'component-owned-sequence',
+ safeArea: 200,
+ installationMode: 'wrapped',
width: 1920,
},
- 'captions/popping-word-captions': {
- component: PoppingWordCaptions,
- contributors: [{username: 'JonnyBurger', contribution: null}],
- description: 'Synchronized captions that pop each spoken word into focus.',
- dependencies: [
- {name: '@remotion/captions', version: null},
- {name: '@remotion/google-fonts', version: null},
- {name: '@remotion/layout-utils', version: null},
- ],
- durationInFrames: 210,
- elementHeight: 252,
- elementWidth: 682,
+ {
+ ...elementRegistry['youtube/youtube-end-card'],
+ slug: 'youtube/youtube-end-card',
+ component: YouTubeEndCard,
+ contributors: [],
+ description:
+ 'A clean YouTube endcard with social links and space for recommended videos.',
+ dependencies: [{name: '@remotion/google-fonts', version: null}],
+ durationInFrames: 150,
+ elementHeight: null,
+ elementWidth: null,
fps: 30,
height: 1080,
posterFrame: 75,
preview: {
previewLayout: 'composition',
posterUrl:
- 'https://remotion.media/elements/captions-popping-word-captions-preview.png',
+ 'https://remotion.media/elements/overlays-social-endcard-preview.png',
videoUrl:
- 'https://remotion.media/elements/captions-popping-word-captions-preview.mp4',
+ 'https://remotion.media/elements/overlays-social-endcard-preview.mp4',
},
- safeArea: 120,
- installationMode: 'component-owned-sequence',
+ safeArea: 0,
+ installationMode: 'wrapped',
width: 1920,
},
- 'captions/word-highlight-captions': {
- component: WordHighlightCaptions,
- contributors: [{username: 'JonnyBurger', contribution: null}],
- description: 'Synchronized captions that highlight each spoken word.',
+ {
+ ...elementRegistry['youtube/youtube-subscribe-nudge'],
+ slug: 'youtube/youtube-subscribe-nudge',
+ component: YouTubeSubscribeNudge,
+ contributors: [],
+ description:
+ 'An animated creator-branded subscribe prompt with a subscribed-state confirmation.',
dependencies: [
- {name: '@remotion/captions', version: null},
{name: '@remotion/google-fonts', version: null},
- {name: '@remotion/layout-utils', version: null},
+ {name: '@remotion/media', version: null},
+ {name: '@remotion/sfx', version: null},
],
- durationInFrames: 210,
- elementHeight: 252,
- elementWidth: 682,
+ durationInFrames: 120,
+ elementHeight: 240,
+ elementWidth: 760,
fps: 30,
height: 1080,
- posterFrame: 75,
+ posterFrame: 50,
preview: {
previewLayout: 'composition',
posterUrl:
- 'https://remotion.media/elements/captions-word-highlight-captions-preview.png',
+ 'https://remotion.media/elements/youtube-youtube-subscribe-nudge-preview.png',
videoUrl:
- 'https://remotion.media/elements/captions-word-highlight-captions-preview.mp4',
+ 'https://remotion.media/elements/youtube-youtube-subscribe-nudge-preview.mp4',
},
- safeArea: 120,
- installationMode: 'component-owned-sequence',
+ safeArea: 240,
+ installationMode: 'wrapped',
width: 1920,
},
-} satisfies Record<
- ElementSlug,
- Omit<ElementDefinition, 'category' | 'displayName' | 'slug'>
->;
-
-type ElementDefinitions = {
- readonly [Slug in ElementSlug]: ElementDefinition &
- (typeof elementRegistry)[Slug] & {readonly slug: Slug};
-};
-
-export const elementDefinitions = Object.fromEntries(
- (Object.keys(elementImplementations) as ElementSlug[]).map((slug) => [
- slug,
- {
- ...elementRegistry[slug],
- ...elementImplementations[slug],
- slug,
- },
- ]),
-) as ElementDefinitions;
+] satisfies readonly ElementDefinition[];
diff --git a/packages/docs/src/components/Elements/element-library-data.ts b/packages/docs/src/components/Elements/element-library-data.ts
index da91e45e3a..dc73e7991d 100644
--- a/packages/docs/src/components/Elements/element-library-data.ts
+++ b/packages/docs/src/components/Elements/element-library-data.ts
@@ -3,8 +3,7 @@ import {
type ElementDefinition,
} from './element-definitions';
-type RegisteredElementDefinition =
- (typeof elementDefinitions)[keyof typeof elementDefinitions];
+type RegisteredElementDefinition = (typeof elementDefinitions)[number];
export type ElementCategory = RegisteredElementDefinition['category'];
@@ -14,32 +13,9 @@ export type ElementLibrarySection = {
readonly label: string;
};
-const compareStrings = (a: string, b: string) => {
- if (a < b) {
- return -1;
- }
-
- if (a > b) {
- return 1;
- }
-
- return 0;
-};
-
const elementCategories = Array.from(
- new Set(Object.values(elementDefinitions).map(({category}) => category)),
-).sort(compareStrings) as ElementCategory[];
-
-const backgroundOrder: Record<string, number> = {
- 'backgrounds/notebook-paper': 0,
- 'backgrounds/paper-texture': 1,
- 'backgrounds/rotating-starburst': 2,
- 'backgrounds/liquid-contours': 3,
-};
-
-const captionOrder: Record<string, number> = {
- 'captions/basic-captions': 0,
-};
+ new Set(elementDefinitions.map(({category}) => category)),
+);
export const getElementCategoryLabel = (category: ElementCategory) => {
if (category === 'youtube') {
@@ -62,33 +38,12 @@ export const getElementLibrarySections = (
category: ElementCategory | null,
): readonly ElementLibrarySection[] => {
const categories = category === null ? elementCategories : [category];
- const definitions = Object.values(elementDefinitions);
return categories.map((currentCategory) => ({
category: currentCategory,
- definitions: definitions
- .filter((definition) => definition.category === currentCategory)
- .sort((a, b) => {
- if (currentCategory === 'captions') {
- const orderDifference =
- (captionOrder[a.slug] ?? Number.MAX_SAFE_INTEGER) -
- (captionOrder[b.slug] ?? Number.MAX_SAFE_INTEGER);
- if (orderDifference !== 0) {
- return orderDifference;
- }
- }
-
- if (currentCategory === 'backgrounds') {
- const orderDifference =
- (backgroundOrder[a.slug] ?? Number.MAX_SAFE_INTEGER) -
- (backgroundOrder[b.slug] ?? Number.MAX_SAFE_INTEGER);
- if (orderDifference !== 0) {
- return orderDifference;
- }
- }
-
- return compareStrings(a.displayName, b.displayName);
- }),
+ definitions: elementDefinitions.filter(
+ (definition) => definition.category === currentCategory,
+ ),
label: getElementCategoryLabel(currentCategory),
}));
};
diff --git a/packages/docs/src/components/Elements/element-utils.ts b/packages/docs/src/components/Elements/element-utils.ts
index 03d5b8a3c2..f255fec99a 100644
--- a/packages/docs/src/components/Elements/element-utils.ts
+++ b/packages/docs/src/components/Elements/element-utils.ts
@@ -16,8 +16,7 @@ export const getElementCompositionId = (slug: string) => {
};
export const getElementDefinition = (slug: string) => {
- const definition =
- elementDefinitions[slug as keyof typeof elementDefinitions];
+ const definition = elementDefinitions.find((entry) => entry.slug === slug);
if (!definition) {
throw new Error(`No Element definition found for ${slug}`);
diff --git a/packages/docs/src/remotion/Root.tsx b/packages/docs/src/remotion/Root.tsx
index f2fbaf2e5b..151010f254 100644
--- a/packages/docs/src/remotion/Root.tsx
+++ b/packages/docs/src/remotion/Root.tsx
@@ -135,7 +135,7 @@ export const RemotionRoot: React.FC = () => {
return (
<>
<Folder name="elements">
- {Object.values(elementDefinitions).map((definition) => {
+ {elementDefinitions.map((definition) => {
const dimensions = getElementPreviewDimensions(definition);
return (
diff --git a/packages/docs/src/test/elements.test.ts b/packages/docs/src/test/elements.test.ts
index 1fa89d69cc..45f8b68613 100644
--- a/packages/docs/src/test/elements.test.ts
+++ b/packages/docs/src/test/elements.test.ts
@@ -22,6 +22,7 @@ import {
} from '../components/Elements/element-registry';
import {
getElementCompositionId,
+ getElementDefinition,
getElementDimensionsLabel,
} from '../components/Elements/element-utils';
import {ElementLibrary} from '../components/Elements/ElementLibrary';
@@ -41,7 +42,7 @@ const staticElementsRoot = path.join(
'static',
'elements',
);
-const elementDefinitionList = Object.values(elementDefinitions);
+const elementDefinitionList = elementDefinitions;
const exactVersionPattern =
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:0|[1-9]\d*|[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|[A-Za-z-][0-9A-Za-z-]*))*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
@@ -321,6 +322,50 @@ describe('Element library', () => {
}),
);
const sections = getElementLibrarySections(null);
+ const expectedOrder = [
+ 'audio/oscilloscope',
+ 'audio/waveform-progress',
+ 'audio/mirrored-spectrum',
+ 'backgrounds/notebook-paper',
+ 'backgrounds/paper-texture',
+ 'backgrounds/rotating-starburst',
+ 'backgrounds/liquid-contours',
+ 'captions/basic-captions',
+ 'captions/moving-pill-captions',
+ 'captions/popping-word-captions',
+ 'captions/word-highlight-captions',
+ 'commerce/product-collection',
+ 'commerce/product-discount-callout',
+ 'commerce/product-offer',
+ 'data/horizontal-bar-chart',
+ 'data/line-chart',
+ 'data/number-counter',
+ 'data/pie-chart',
+ 'data/vertical-bar-chart',
+ 'maps/map-flyover',
+ 'maps/watercolor-map',
+ 'overlays/location-lower-third',
+ 'overlays/name-lower-third',
+ 'overlays/social-safe-zones',
+ 'text/news-article-highlight',
+ 'storytelling/on-screen-messages',
+ 'storytelling/polaroid-pictures',
+ 'text/circle-marker',
+ 'text/crossed-off',
+ 'text/spinning-text-wheel',
+ 'text/strike-through',
+ 'text/text-marker',
+ 'youtube/youtube-comment-highlight',
+ 'youtube/youtube-end-card',
+ 'youtube/youtube-subscribe-nudge',
+ ];
+ for (let index = 1; index < expectedOrder.length; index++) {
+ expect(
+ overviewMarkup.indexOf(`/elements/${expectedOrder[index - 1]}/`),
+ ).toBeLessThan(
+ overviewMarkup.indexOf(`/elements/${expectedOrder[index]}/`),
+ );
+ }
for (const definition of elementDefinitionList) {
expect(
@@ -395,7 +440,7 @@ describe('Element library', () => {
'overlays/name-lower-third',
'backgrounds/paper-texture',
] as const) {
- const definition = elementDefinitions[slug];
+ const definition = getElementDefinition(slug);
const sourceCode = sourceCodeBySlug[slug];
const payload = createElementPayloadFromDefinition({
definition,
@@ -658,15 +703,9 @@ describe('Element preview definitions', () => {
const definitionSlugs = elementDefinitionList
.map((definition) => definition.slug)
.sort();
- const definitionKeys = Object.keys(elementDefinitions).sort();
- expect(definitionKeys).toEqual(elementSlugs);
expect(definitionSlugs).toEqual(elementSlugs);
expect(new Set(definitionSlugs).size).toBe(definitionSlugs.length);
-
- for (const [slug, definition] of Object.entries(elementDefinitions)) {
- expect(definition.slug).toBe(slug);
- }
});
test('publishes caption treatments as separate Elements', () => {
@@ -798,7 +837,9 @@ describe('Element preview definitions', () => {
});
test('keeps displayed Element dimensions separate from preview dimensions', () => {
- const adaptiveDefinition = elementDefinitions['backgrounds/paper-texture'];
+ const adaptiveDefinition = getElementDefinition(
+ 'backgrounds/paper-texture',
+ );
expect(getElementDimensionsLabel(adaptiveDefinition)).toBe(
'Adapts to composition',
);
@@ -807,7 +848,7 @@ describe('Element preview definitions', () => {
width: 1920,
});
- const fixedDefinition = elementDefinitions['overlays/name-lower-third'];
+ const fixedDefinition = getElementDefinition('overlays/name-lower-third');
expect(getElementDimensionsLabel(fixedDefinition)).toBe('534 × 132px');
expect(getElementPreviewDimensions(fixedDefinition)).toEqual({
height: 732,
@@ -820,7 +861,7 @@ describe('Element preview definitions', () => {
'backgrounds/paper-texture',
'backgrounds/rotating-starburst',
] as const) {
- const definition = elementDefinitions[slug];
+ const definition = getElementDefinition(slug);
const element = productionElements.find((entry) => entry.name === slug);
if (!element) {
throw new Error(`Could not find Element source for ${slug}`);
@@ -837,7 +878,7 @@ describe('Element preview definitions', () => {
test('Social Safe Zones keeps its calibrated 9:16 dimensions in Studio and the docs preview', () => {
const slug = 'overlays/social-safe-zones';
- const definition = elementDefinitions[slug];
+ const definition = getElementDefinition(slug);
const element = productionElements.find((entry) => entry.name === slug);
if (!element) {
throw new Error(`Could not find Element source for ${slug}`);
diff --git a/packages/docs/src/test/replace-raw-markdown-components.test.ts b/packages/docs/src/test/replace-raw-markdown-components.test.ts
index 5970258eaa..45c432621f 100644
--- a/packages/docs/src/test/replace-raw-markdown-components.test.ts
+++ b/packages/docs/src/test/replace-raw-markdown-components.test.ts
@@ -46,7 +46,7 @@ test('expands the actual Element overview into categorized Markdown', () => {
expect(output).toContain(`## ${section.label}`);
}
- for (const definition of Object.values(elementDefinitions)) {
+ for (const definition of elementDefinitions) {
expect(output).toContain(
`[${definition.displayName}](${getElementDocumentationUrl(definition)})`,
);
@@ -72,7 +72,7 @@ test('expands the actual Element category indexes without unrelated entries', ()
});
expect(output).not.toContain('ElementLibrary');
- for (const definition of Object.values(elementDefinitions)) {
+ for (const definition of elementDefinitions) {
const elementLink = `[${definition.displayName}](${getElementDocumentationUrl(definition)})`;
if (definition.category === section.category) {
expect(output).toContain(elementLink);
diff --git a/packages/docs/src/test/upload-element-preview.test.ts b/packages/docs/src/test/upload-element-preview.test.ts
index 28d53ed2da..8982feb4b8 100644
--- a/packages/docs/src/test/upload-element-preview.test.ts
+++ b/packages/docs/src/test/upload-element-preview.test.ts
@@ -30,15 +30,15 @@ test('upload-element-preview only overwrites the exact hosted preview URLs', ()
writeFileSync(runnerPath, runnerSource);
writeFileSync(
path.join(temporaryDirectory, 'element-definitions.ts'),
- `export const elementDefinitions = {
- fixture: {
+ `export const elementDefinitions = [
+ {
slug: 'test/example',
preview: {
posterUrl: process.env.TEST_POSTER_URL,
videoUrl: process.env.TEST_VIDEO_URL,
},
},
-};
+];
`,
);
diff --git a/packages/docs/upload-element-preview.ts b/packages/docs/upload-element-preview.ts
index 77dc5d8fff..59ff6e5b00 100644
--- a/packages/docs/upload-element-preview.ts
+++ b/packages/docs/upload-element-preview.ts
@@ -41,7 +41,7 @@ if (source !== 'render' && source !== 'submission') {
}
const selectedElementSlug = elementArguments[0].slice('--element='.length);
-const definition = Object.values(elementDefinitions).find(
+const definition = elementDefinitions.find(
(candidate) => candidate.slug === selectedElementSlug,
);
if (!definition) {