🎥 Make videos programmatically with React
`@remotion/studio`: Add effect picker to sequence inspector (#8498)
Jonny Burger90211d613702
diff --git a/packages/docs/docs/effects/table-of-contents.tsx b/packages/docs/docs/effects/table-of-contents.tsxindex 54bc0c76b5..4cc4518e31 100644--- a/packages/docs/docs/effects/table-of-contents.tsx+++ b/packages/docs/docs/effects/table-of-contents.tsx@@ -1,376 +1,18 @@-import React from 'react';import {- makeEffectDragData,- setEffectDragData,-} from '../../components/effects-demos/effect-drag-data';-import {getInitialValuesFromSchema} from '../../components/effects-demos/get-default-props-from-schema';-import {effectsDemos} from '../../components/effects-demos/registry';+ EFFECT_CATALOG,+ getEffectCatalogCategories,+ getEffectDocumentationPath,+ getEffectPreviewAlt,+ getEffectPreviewSource,+ makeEffectDragDataFromCatalogItem,+ type EffectCatalogItem,+} from '@remotion/studio-shared';+import React from 'react';+import {setEffectDragData} from '../../components/effects-demos/effect-drag-data';import {Grid} from '../../components/TableOfContents/Grid';import {TOCItem} from '../../components/TableOfContents/TOCItem';-type Effect = {- readonly link: string;- readonly preview: string;- readonly alt: string;- readonly name: string;- readonly description: string;-};--const categories: {- readonly title: string;- readonly effects: Effect[];-}[] = [- {- title: 'Color',- effects: [- {- link: '/docs/effects/brightness',- preview: '/img/effects-brightness-preview.png',- alt: 'brightness effect preview',- name: 'brightness()',- description: 'Brightness adjustment effect',- },- {- link: '/docs/effects/contrast',- preview: '/img/effects-contrast-preview.png',- alt: 'contrast effect preview',- name: 'contrast()',- description: 'Contrast adjustment effect',- },- {- link: '/docs/effects/color-key',- preview: '/img/effects-color-key-preview.png',- alt: 'color key effect preview',- name: 'colorKey()',- description: 'Remove a key color (greenscreen)',- },- {- link: '/docs/effects/duotone',- preview: '/img/effects-duotone-preview.png',- alt: 'duotone effect preview',- name: 'duotone()',- description: 'Two-color threshold effect',- },- {- link: '/docs/effects/grayscale',- preview: '/img/effects-grayscale-preview.png',- alt: 'grayscale effect preview',- name: 'grayscale()',- description: 'Black-and-white effect',- },- {- link: '/docs/effects/hue',- preview: '/img/effects-hue-preview.png',- alt: 'hue effect preview',- name: 'hue()',- description: 'Hue rotation effect',- },- {- link: '/docs/effects/invert',- preview: '/img/effects-invert-preview.png',- alt: 'invert effect preview',- name: 'invert()',- description: 'Negative color effect',- },- {- link: '/docs/effects/saturation',- preview: '/img/effects-saturation-preview.png',- alt: 'saturation effect preview',- name: 'saturation()',- description: 'Saturation adjustment effect',- },- {- link: '/docs/effects/tint',- preview: '/img/effects-tint-preview.png',- alt: 'tint effect preview',- name: 'tint()',- description: 'Color tint effect',- },- ],- },- {- title: 'Blur & Shadow',- effects: [- {- link: '/docs/effects/blur',- preview: '/img/effects-blur-preview.png',- alt: 'blur effect preview',- name: 'blur()',- description: 'Gaussian blur effect',- },- {- link: '/docs/effects/linear-progressive-blur',- preview: '/img/effects-linear-progressive-blur-preview.png',- alt: 'linear progressive blur effect preview',- name: 'linearProgressiveBlur()',- description: 'Gradient-controlled blur effect',- },- {- link: '/docs/effects/drop-shadow',- preview: '/img/effects-drop-shadow-preview.png',- alt: 'drop shadow effect preview',- name: 'dropShadow()',- description: 'Blurred alpha shadow effect',- },- {- link: '/docs/effects/glow',- preview: '/img/effects-glow-preview.png',- alt: 'glow effect preview',- name: 'glow()',- description: 'Soft halo effect',- },- ],- },- {- title: 'Reveal',- effects: [- {- link: '/docs/effects/evolve',- preview: '/img/effects-evolve-preview.png',- alt: 'evolve effect preview',- name: 'evolve()',- description: 'Directional reveal effect',- },- ],- },- {- title: 'Transform',- effects: [- {- link: '/docs/effects/mirror',- preview: '/img/effects-mirror-preview.png',- alt: 'mirror effect preview',- name: 'mirror()',- description: 'Mirror reflection effect',- },- {- link: '/docs/effects/scale',- preview: '/img/effects-scale-preview.png',- alt: 'scale effect preview',- name: 'scale()',- description: 'Scale transform effect',- },- {- link: '/docs/effects/uv-translate',- preview: '/img/effects-uv-translate-preview.png',- alt: 'UV translate effect preview',- name: 'uvTranslate()',- description: 'UV-based translate effect',- },- {- link: '/docs/effects/xy-translate',- preview: '/img/effects-xy-translate-preview.png',- alt: 'XY translate effect preview',- name: 'xyTranslate()',- description: 'Pixel-based translate effect',- },- ],- },- {- title: 'Distort',- effects: [- {- link: '/docs/effects/barrel-distortion',- preview: '/img/effects-barrel-distortion-preview.png',- alt: 'barrel distortion effect preview',- name: 'barrelDistortion()',- description: 'Barrel distortion effect',- },- {- link: '/docs/effects/chromatic-aberration',- preview: '/img/effects-chromatic-aberration-preview.png',- alt: 'chromatic aberration effect preview',- name: 'chromaticAberration()',- description: 'RGB channel split effect',- },- {- link: '/docs/effects/fisheye',- preview: '/img/effects-fisheye-preview.png',- alt: 'fisheye effect preview',- name: 'fisheye()',- description: 'Ultra-wide-angle lens effect',- },- {- link: '/docs/effects/wave',- preview: '/img/effects-wave-preview.png',- alt: 'wave effect preview',- name: 'wave()',- description: 'Sine wave distortion',- },- ],- },- {- title: 'Stylize',- effects: [- {- link: '/docs/effects/burlap',- preview: '/img/effects-burlap-preview.png',- alt: 'burlap effect preview',- name: 'burlap()',- description: 'Procedural woven texture effect',- },- {- link: '/docs/effects/dot-grid',- preview: '/img/effects-dot-grid-preview.png',- alt: 'dot grid effect preview',- name: 'dotGrid()',- description: 'Source-color dot mask effect',- },- {- link: '/docs/effects/halftone',- preview: '/img/effects-halftone-preview.png',- alt: 'halftone effect preview',- name: 'halftone()',- description: 'Source-image halftone effect',- },- {- link: '/docs/effects/noise',- preview: '/img/effects-noise-preview.png',- alt: 'noise effect preview',- name: 'noise()',- description: 'Procedural grain effect',- },- {- link: '/docs/effects/noise-displacement',- preview: '/img/effects-noise-displacement-preview.png',- alt: 'noise displacement effect preview',- name: 'noiseDisplacement()',- description: 'Localized noisy displacement',- },- {- link: '/docs/effects/pattern',- preview: '/img/effects-pattern-preview.png',- alt: 'pattern effect preview',- name: 'pattern()',- description: 'Repeated source tile effect',- },- {- link: '/docs/effects/pixel-dissolve',- preview: '/img/effects-pixel-dissolve-preview.png',- alt: 'pixel dissolve effect preview',- name: 'pixelDissolve()',- description: 'Pixelated dissolve effect',- },- {- link:'/docs/effects/pixelate',- preview: '/img/effects-pixelate-preview.png',- alt: 'pixelate effect preview',- name: 'pixelate()',- description: 'Pixelation effect',- },- {- link: '/docs/effects/scanlines',- preview: '/img/effects-scanlines-preview.png',- alt: 'scanlines effect preview',- name: 'scanlines()',- description: 'Additive horizontal scanlines',- },- {- link: '/docs/effects/speckle',- preview: '/img/effects-speckle-preview.png',- alt: 'speckle effect preview',- name: 'speckle()',- description: 'Random alpha-hole effect',- },- {- link: '/docs/effects/shine',- preview: '/img/effects-shine-preview.png',- alt: 'shine effect preview',- name: 'shine()',- description: 'Glossy light sweep effect',- },- {- link: '/docs/effects/shrinkwrap',- preview: '/img/effects-shrinkwrap-preview.png',- alt: 'shrinkwrap effect preview',- name: 'shrinkwrap()',- description: 'Procedural plastic wrap effect',- },- {- link: '/docs/effects/vignette',- preview: '/img/effects-vignette-preview.png',- alt: 'vignette effect preview',- name: 'vignette()',- description: 'Edge darkening or transparency effect',- },- ],- },- {- title: 'Generate',- effects: [- {- link: '/docs/effects/contour-lines',- preview: '/img/effects-contour-lines-preview.png',- alt: 'contour lines effect preview',- name: 'contourLines()',- description: 'Topographic line overlay effect',- },- {- link: '/docs/effects/halftone-linear-gradient',- preview: '/img/effects-halftone-linear-gradient-preview.png',- alt: 'halftone linear gradient effect preview',- name: 'halftoneLinearGradient()',- description: 'Procedural dot gradient effect',- },- {- link: '/docs/effects/white-noise',- preview: '/img/effects-white-noise-preview.png',- alt: 'white noise effect preview',- name: 'whiteNoise()',- description: 'Random grayscale noise layer',- },- {- link: '/docs/effects/tv-signal-off',- preview: '/img/effects-tv-signal-off-preview.png',- alt: 'TV signal off effect preview',- name: 'tvSignalOff()',- description: 'TV color bars test pattern',- },- {- link: '/docs/effects/lines',- preview: '/img/effects-lines-preview.png',- alt: 'lines effect preview',- name: 'lines()',- description: 'Alternating line pattern effect',- },- {- link: '/docs/effects/rings',- preview: '/img/effects-rings-preview.png',- alt: 'rings effect preview',- name: 'rings()',- description: 'Concentric ring pattern effect',- },- {- link: '/docs/effects/waves',- preview: '/img/effects-waves-preview.png',- alt: 'waves effect preview',- name: 'waves()',- description: 'Wavy band pattern effect',- },- {- link: '/docs/effects/zigzag',- preview: '/img/effects-zigzag-preview.png',- alt: 'zigzag effect preview',- name: 'zigzag()',- description: 'Zig-zag band pattern effect',- },- {- link: '/docs/light-leaks/light-leak-effect',- preview: '/img/effects-light-leak-preview.png',- alt: 'light leak effect preview',- name: 'lightLeak()',- description: 'Light leak overlay effect',- },- {- link: '/docs/starburst/starburst-effect',- preview: '/img/effects-starburst-preview.png',- alt: 'starburst effect preview',- name: 'starburst()',- description: 'Starburst ray effect',- },- ],- },-];+const categories = getEffectCatalogCategories(EFFECT_CATALOG);const row: React.CSSProperties = {display: 'flex',@@ -386,62 +28,32 @@ const previewImage: React.CSSProperties = {flexShrink: 0,};-const getDemoIdFromLink = (link: string) => {- if (link.startsWith('/docs/effects/')) {- return `effects-${link.slice('/docs/effects/'.length)}`;- }-- if (link === '/docs/light-leaks/light-leak-effect') {- return 'effects-light-leak';- }-- if (link === '/docs/starburst/starburst-effect') {- return 'effects-starburst';- }-- return null;-};-const EffectCard: React.FC<{- readonly effect: Effect;+ readonly effect: EffectCatalogItem;}> = ({effect}) => {- const demo = effectsDemos.find(- (item) => item.id === getDemoIdFromLink(effect.link),- );- const dragData = demo- ? makeEffectDragData({- effectName: demo.effectName,- effectImportPath: demo.effectImportPath,- effectConfig: getInitialValuesFromSchema({- schema: demo.schema,- initialValues: demo.initialValues,- }),- })- : null;+ const dragData = makeEffectDragDataFromCatalogItem(effect);return (<TOCItem- link={effect.link}- draggable={dragData !== null}- onDragStart={- dragData === null- ? undefined- : (e) => {- setEffectDragData({- dataTransfer: e.dataTransfer,- dragData,- });- }- }- title={- dragData === null ? undefined : 'Drag this effect into Remotion Studio'- }+ link={getEffectDocumentationPath(effect)}+ draggable+ onDragStart={(e) => {+ setEffectDragData({+ dataTransfer: e.dataTransfer,+ dragData,+ });+ }}+ title="Drag this effect into Remotion Studio"><div style={row}>- <img src={effect.preview} alt={effect.alt} style={previewImage} />+ <img+ src={getEffectPreviewSource(effect)}+ alt={getEffectPreviewAlt(effect)}+ style={previewImage}+ /><div style={{flex: 1, marginLeft: 10}}><strong>- <code>{effect.name}</code>+ <code>{effect.label}</code></strong><div>{effect.description}</div></div>@@ -459,7 +71,7 @@ export const TableOfContents: React.FC = () => {<h3>{category.title}</h3><Grid>{category.effects.map((effect) => {- return <EffectCard key={effect.link} effect={effect} />;+ return <EffectCard key={effect.id} effect={effect} />;})}</Grid></React.Fragment>diff --git a/packages/studio-shared/src/effect-catalog.ts b/packages/studio-shared/src/effect-catalog.tsnew file mode 100644index 0000000000..e6c778700e--- /dev/null+++ b/packages/studio-shared/src/effect-catalog.ts@@ -0,0 +1,609 @@+import type {EffectDragData} from './effect-drag-data';++export type EffectCatalogItem = {+ readonly id: string;+ readonly category: string;+ readonly label: string;+ readonly description: string;+ readonly effect: EffectDragData['effect'];+};++export type EffectCatalogCategory = {+ readonly title: string;+ readonly effects: readonly EffectCatalogItem[];+};++export const getEffectDocumentationPath = (item: EffectCatalogItem) => {+ if (item.id === 'effects-light-leak') {+ return '/docs/light-leaks/light-leak-effect';+ }++ if (item.id === 'effects-starburst') {+ return '/docs/starburst/starburst-effect';+ }++ return `/docs/effects/${item.id.slice('effects-'.length)}`;+};++export const getEffectDocumentationLink = (item: EffectCatalogItem) => {+ return `https://www.remotion.dev${getEffectDocumentationPath(item)}`;+};++export const getEffectPreviewSource = (item: EffectCatalogItem) => {+ return `/img/${item.id}-preview.png`;+};++export const getEffectPreviewAlt = (item: EffectCatalogItem) => {+ const effectName = item.id+ .slice('effects-'.length)+ .replaceAll('-', ' ')+ .replace(/^uv /, 'UV ')+ .replace(/^xy /, 'XY ')+ .replace(/^tv /, 'TV ');++ return `${effectName} effect preview`;+};++export const makeEffectDragDataFromCatalogItem = (+ item: EffectCatalogItem,+): EffectDragData => {+ return {+ type: 'remotion-effect',+ version: 1,+ effect: item.effect,+ };+};++export const getEffectCatalogCategories = (+ items: readonly EffectCatalogItem[],+): readonly EffectCatalogCategory[] => {+ const categories: EffectCatalogCategory[] = [];++ for (const item of items) {+ const last = categories[categories.length - 1];+ if (last?.title === item.category) {+ categories[categories.length - 1] = {+ ...last,+ effects: [...last.effects, item],+ };+ continue;+ }++ categories.push({+ title: item.category,+ effects: [item],+ });+ }++ return categories;+};++export const EFFECT_CATALOG: readonly EffectCatalogItem[] = [+ {+ id: 'effects-brightness',+ category: 'Color',+ label: 'brightness()',+ description: 'Brightness adjustment effect',+ effect: {+ name: 'brightness',+ importPath: '@remotion/effects/brightness',+ config: {},+ },+ },+ {+ id: 'effects-contrast',+ category: 'Color',+ label: 'contrast()',+ description: 'Contrast adjustment effect',+ effect: {+ name: 'contrast',+ importPath: '@remotion/effects/contrast',+ config: {},+ },+ },+ {+ id: 'effects-color-key',+ category: 'Color',+ label: 'colorKey()',+ description: 'Remove a key color (greenscreen)',+ effect: {+ name: 'colorKey',+ importPath: '@remotion/effects/color-key',+ config: {+ similarity: 0.45,+ },+ },+ },+ {+ id: 'effects-duotone',+ category: 'Color',+ label: 'duotone()',+ description: 'Two-color threshold effect',+ effect: {+ name: 'duotone',+ importPath: '@remotion/effects/duotone',+ config: {},+ },+ },+ {+ id: 'effects-grayscale',+ category: 'Color',+ label: 'grayscale()',+ description: 'Black-and-white effect',+ effect: {+ name: 'grayscale',+ importPath: '@remotion/effects/grayscale',+ config: {},+ },+ },+ {+ id: 'effects-hue',+ category: 'Color',+ label: 'hue()',+ description: 'Hue rotation effect',+ effect: {+ name: 'hue',+ importPath: '@remotion/effects/hue',+ config: {},+ },+ },+ {+ id: 'effects-invert',+ category: 'Color',+ label: 'invert()',+ description: 'Negative color effect',+ effect: {+ name: 'invert',+ importPath: '@remotion/effects/invert',+ config: {},+ },+ },+ {+ id: 'effects-saturation',+ category: 'Color',+ label: 'saturation()',+ description: 'Saturation adjustment effect',+ effect: {+ name: 'saturation',+ importPath: '@remotion/effects/saturation',+ config: {},+ },+ },+ {+ id: 'effects-tint',+ category: 'Color',+ label: 'tint()',+ description: 'Color tint effect',+ effect: {+ name: 'tint',+ importPath: '@remotion/effects/tint',+ config: {+ color: '#1ec8ff',+ },+ },+ },+ {+ id: 'effects-blur',+ category: 'Blur & Shadow',+ label: 'blur()',+ description: 'Gaussian blur effect',+ effect: {+ name: 'blur',+ importPath: '@remotion/effects/blur',+ config: {+ radius: 40,+ },+ },+ },+ {+ id: 'effects-linear-progressive-blur',+ category: 'Blur & Shadow',+ label: 'linearProgressiveBlur()',+ description: 'Gradient-controlled blur effect',+ effect: {+ name: 'linearProgressiveBlur',+ importPath: '@remotion/effects/linear-progressive-blur',+ config: {},+ },+ },+ {+ id: 'effects-drop-shadow',+ category: 'Blur & Shadow',+ label: 'dropShadow()',+ description: 'Blurred alpha shadow effect',+ effect: {+ name: 'dropShadow',+ importPath: '@remotion/effects/drop-shadow',+ config: {},+ },+ },+ {+ id: 'effects-glow',+ category: 'Blur & Shadow',+ label: 'glow()',+ description: 'Soft halo effect',+ effect: {+ name: 'glow',+ importPath: '@remotion/effects/glow',+ config: {},+ },+ },+ {+ id: 'effects-evolve',+ category: 'Reveal',+ label: 'evolve()',+ description: 'Directional reveal effect',+ effect: {+ name: 'evolve',+ importPath: '@remotion/effects/evolve',+ config: {},+ },+ },+ {+ id: 'effects-mirror',+ category: 'Transform',+ label: 'mirror()',+ description: 'Mirror reflection effect',+ effect: {+ name: 'mirror',+ importPath: '@remotion/effects/mirror',+ config: {},+ },+ },+ {+ id: 'effects-scale',+ category: 'Transform',+ label: 'scale()',+ description: 'Scale transform effect',+ effect: {+ name: 'scale',+ importPath: '@remotion/effects/scale',+ config: {+ scale: 1,+ },+ },+ },+ {+ id: 'effects-uv-translate',+ category: 'Transform',+ label: 'uvTranslate()',+ description: 'UV-based translate effect',+ effect: {+ name: 'uvTranslate',+ importPath: '@remotion/effects/translate',+ config: {},+ },+ },+ {+ id: 'effects-xy-translate',+ category: 'Transform',+ label: 'xyTranslate()',+ description: 'Pixel-based translate effect',+ effect: {+ name: 'xyTranslate',+ importPath: '@remotion/effects/translate',+ config: {},+ },+ },+ {+ id: 'effects-barrel-distortion',+ category: 'Distort',+ label: 'barrelDistortion()',+ description: 'Barrel distortion effect',+ effect: {+ name: 'barrelDistortion',+ importPath: '@remotion/effects/barrel-distortion',+ config: {},+ },+ },+ {+ id: 'effects-chromatic-aberration',+ category: 'Distort',+ label: 'chromaticAberration()',+ description: 'RGB channel split effect',+ effect: {+ name: 'chromaticAberration',+ importPath: '@remotion/effects/chromatic-aberration',+ config: {},+ },+ },+ {+ id: 'effects-fisheye',+ category: 'Distort',+ label: 'fisheye()',+ description: 'Ultra-wide-angle lens effect',+ effect: {+ name: 'fisheye',+ importPath: '@remotion/effects/fisheye',+ config: {},+ },+ },+ {+ id: 'effects-wave',+ category: 'Distort',+ label: 'wave()',+ description: 'Sine wave distortion',+ effect: {+ name: 'wave',+ importPath: '@remotion/effects/wave',+ config: {},+ },+ },+ {+ id: 'effects-burlap',+ category: 'Stylize',+ label: 'burlap()',+ description: 'Procedural woven texture effect',+ effect: {+ name: 'burlap',+ importPath: '@remotion/effects/burlap',+ config: {},+ },+ },+ {+ id: 'effects-dot-grid',+ category: 'Stylize',+ label: 'dotGrid()',+ description: 'Source-color dot mask effect',+ effect: {+ name: 'dotGrid',+ importPath: '@remotion/effects/dot-grid',+ config: {},+ },+ },+ {+ id: 'effects-halftone',+ category: 'Stylize',+ label: 'halftone()',+ description: 'Source-image halftone effect',+ effect: {+ name: 'halftone',+ importPath: '@remotion/effects/halftone',+ config: {},+ },+ },+ {+ id: 'effects-noise',+ category: 'Stylize',+ label: 'noise()',+ description: 'Procedural grain effect',+ effect: {+ name: 'noise',+ importPath: '@remotion/effects/noise',+ config: {},+ },+ },+ {+ id: 'effects-noise-displacement',+ category: 'Stylize',+ label: 'noiseDisplacement()',+ description: 'Localized noisy displacement',+ effect: {+ name: 'noiseDisplacement',+ importPath: '@remotion/effects/noise-displacement',+ config: {+ center: [0.6124309308853857, 0.5010527449123625],+ radius: 0.41,+ strength: 15.5,+ seed: 78,+ grainSize: 0.9,+ passes: 12,+ blur: 0,+ feather: 1,+ biasDirection: 313,+ biasAmount: 1,+ },+ },+ },+ {+ id: 'effects-pattern',+ category: 'Stylize',+ label: 'pattern()',+ description: 'Repeated source tile effect',+ effect: {+ name: 'pattern',+ importPath: '@remotion/effects/pattern',+ config: {},+ },+ },+ {+ id: 'effects-pixel-dissolve',+ category: 'Stylize',+ label: 'pixelDissolve()',+ description: 'Pixelated dissolve effect',+ effect: {+ name: 'pixelDissolve',+ importPath: '@remotion/effects/pixel-dissolve',+ config: {},+ },+ },+ {+ id: 'effects-pixelate',+ category: 'Stylize',+ label: 'pixelate()',+ description: 'Pixelation effect',+ effect: {+ name: 'pixelate',+ importPath: '@remotion/effects/pixelate',+ config: {+ blockSize: 20,+ },+ },+ },+ {+ id: 'effects-scanlines',+ category: 'Stylize',+ label: 'scanlines()',+ description: 'Additive horizontal scanlines',+ effect: {+ name: 'scanlines',+ importPath: '@remotion/effects/scanlines',+ config: {},+ },+ },+ {+ id: 'effects-speckle',+ category: 'Stylize',+ label: 'speckle()',+ description: 'Random alpha-hole effect',+ effect: {+ name: 'speckle',+ importPath: '@remotion/effects/speckle',+ config: {},+ },+ },+ {+ id: 'effects-shine',+ category: 'Stylize',+ label: 'shine()',+ description: 'Glossy light sweep effect',+ effect: {+ name: 'shine',+ importPath: '@remotion/effects/shine',+ config: {},+ },+ },+ {+ id: 'effects-shrinkwrap',+ category: 'Stylize',+ label: 'shrinkwrap()',+ description: 'Procedural plastic wrap effect',+ effect: {+ name: 'shrinkwrap',+ importPath: '@remotion/effects/shrinkwrap',+ config: {+ amount: 0.94,+ displacement: 13.5,+ highlightIntensity: 1.54,+ wrinkleDensity: 0.87,+ edgeTension: 0.58,+ phase: 0,+ seed: 12,+ },+ },+ },+ {+ id: 'effects-vignette',+ category: 'Stylize',+ label: 'vignette()',+ description: 'Edge darkening or transparency effect',+ effect: {+ name: 'vignette',+ importPath: '@remotion/effects/vignette',+ config: {},+ },+ },+ {+ id: 'effects-contour-lines',+ category: 'Generate',+ label: 'contourLines()',+ description: 'Topographic line overlay effect',+ effect: {+ name: 'contourLines',+ importPath: '@remotion/effects/contour-lines',+ config: {},+ },+ },+ {+ id: 'effects-halftone-linear-gradient',+ category: 'Generate',+ label: 'halftoneLinearGradient()',+ description: 'Procedural dot gradient effect',+ effect: {+ name: 'halftoneLinearGradient',+ importPath: '@remotion/effects/halftone-linear-gradient',+ config: {},+ },+ },+ {+ id: 'effects-white-noise',+ category: 'Generate',+ label: 'whiteNoise()',+ description: 'Random grayscale noise layer',+ effect: {+ name: 'whiteNoise',+ importPath: '@remotion/effects/white-noise',+ config: {},+ },+ },+ {+ id: 'effects-tv-signal-off',+ category: 'Generate',+ label: 'tvSignalOff()',+ description: 'TV color bars test pattern',+ effect: {+ name: 'tvSignalOff',+ importPath: '@remotion/effects/tv-signal-off',+ config: {},+ },+ },+ {+ id: 'effects-lines',+ category: 'Generate',+ label: 'lines()',+ description: 'Alternating line pattern effect',+ effect: {+ name: 'lines',+ importPath: '@remotion/effects/lines',+ config: {},+ },+ },+ {+ id: 'effects-rings',+ category: 'Generate',+ label: 'rings()',+ description: 'Concentric ring pattern effect',+ effect: {+ name: 'rings',+ importPath: '@remotion/effects/rings',+ config: {},+ },+ },+ {+ id: 'effects-waves',+ category: 'Generate',+ label: 'waves()',+ description: 'Wavy band pattern effect',+ effect: {+ name: 'waves',+ importPath: '@remotion/effects/waves',+ config: {},+ },+ },+ {+ id: 'effects-zigzag',+ category: 'Generate',+ label: 'zigzag()',+ description: 'Zig-zag band pattern effect',+ effect: {+ name: 'zigzag',+ importPath: '@remotion/effects/zigzag',+ config: {},+ },+ },+ {+ id: 'effects-light-leak',+ category: 'Generate',+ label: 'lightLeak()',+ description: 'Light leak overlay effect',+ effect: {+ name: 'lightLeak',+ importPath: '@remotion/light-leaks',+ config: {},+ },+ },+ {+ id: 'effects-starburst',+ category: 'Generate',+ label: 'starburst()',+ description: 'Starburst ray effect',+ effect: {+ name: 'starburst',+ importPath: '@remotion/starburst',+ config: {+ rays: 16,+ colors: ['#ff6600', '#ffff00'],+ },+ },+ },+];diff --git a/packages/studio-shared/src/index.ts b/packages/studio-shared/src/index.tsindex ee80a5ba6d..7f893759c0 100644--- a/packages/studio-shared/src/index.ts+++ b/packages/studio-shared/src/index.ts@@ -164,6 +164,17 @@ export {parseEffectDragData,type EffectDragData,} from './effect-drag-data';+export {+ EFFECT_CATALOG,+ getEffectCatalogCategories,+ getEffectDocumentationLink,+ getEffectDocumentationPath,+ getEffectPreviewAlt,+ getEffectPreviewSource,+ makeEffectDragDataFromCatalogItem,+ type EffectCatalogCategory,+ type EffectCatalogItem,+} from './effect-catalog';export {EventSourceEvent} from './event-source-event';export {formatBytes} from './format-bytes';export {getAllSchemaKeys} from './get-all-keys';diff --git a/packages/studio/src/components/EffectPickerModal.tsx b/packages/studio/src/components/EffectPickerModal.tsxnew file mode 100644index 0000000000..0b23136fa5--- /dev/null+++ b/packages/studio/src/components/EffectPickerModal.tsx@@ -0,0 +1,281 @@+import {+ EFFECT_CATALOG,+ getEffectDocumentationLink,+ type EffectCatalogItem,+} from '@remotion/studio-shared';+import React, {+ useCallback,+ useContext,+ useEffect,+ useMemo,+ useRef,+ useState,+} from 'react';+import {LIGHT_TEXT, getBackgroundFromHoverState} from '../helpers/colors';+import {useKeybinding} from '../helpers/use-keybinding';+import {ModalsContext, type AddEffectModalState} from '../state/modals';+import {ContextMenu} from './ContextMenu';+import {addEffectToSequence} from './effect-drag-and-drop';+import {filterEffectCatalog} from './effect-picker-search';+import {Spacing} from './layout';+import {VERTICAL_SCROLLBAR_CLASSNAME} from './Menu/is-menu-item';+import type {ComboboxValue} from './NewComposition/ComboBox';+import {DismissableModal} from './NewComposition/DismissableModal';+import {RemotionInput} from './NewComposition/RemInput';+import {+ QUICK_SWITCHER_RESULT_LABEL_FONT_SIZE,+ loopIndex,+ useScrollIntoViewOnSelected,+} from './QuickSwitcher/shared';++const container: React.CSSProperties = {+ width: 500,+};++const content: React.CSSProperties = {+ padding: '12px 16px 10px',+};++const inputStyle: React.CSSProperties = {+ width: '100%',+};++const resultList: React.CSSProperties = {+ height: 320,+ overflowY: 'auto',+ paddingBottom: 10,+};++const noResults: React.CSSProperties = {+ color: LIGHT_TEXT,+ fontSize: 13,+ padding: '12px 16px',+};++const resultContainer: React.CSSProperties = {+ cursor: 'pointer',+ display: 'flex',+ flexDirection: 'row',+ alignItems: 'center',+ padding: '7px 16px',+};++const labelContainer: React.CSSProperties = {+ flex: 1,+ minWidth: 0,+};++const label: React.CSSProperties = {+ fontSize: QUICK_SWITCHER_RESULT_LABEL_FONT_SIZE,+ overflow: 'hidden',+ textOverflow: 'ellipsis',+ whiteSpace: 'nowrap',+};++const category: React.CSSProperties = {+ color: LIGHT_TEXT,+ fontSize: 11,+ flexShrink: 0,+};++const EffectPickerResult: React.FC<{+ readonly item: EffectCatalogItem;+ readonly selected: boolean;+ readonly onSelected: (item: EffectCatalogItem) => void;+}> = ({item, selected, onSelected}) => {+ const [hovered, setHovered] = useState(false);+ const ref = useRef<HTMLDivElement>(null);++ useScrollIntoViewOnSelected(ref, selected);++ const style = useMemo((): React.CSSProperties => {+ return {+ ...resultContainer,+ backgroundColor: getBackgroundFromHoverState({hovered, selected}),+ };+ }, [hovered, selected]);++ const labelStyle = useMemo((): React.CSSProperties => {+ return {+ ...label,+ color: selected || hovered ? 'white' : LIGHT_TEXT,+ };+ }, [hovered, selected]);++ const onClick = useCallback(() => {+ onSelected(item);+ }, [item, onSelected]);++ const contextMenuValues = useMemo((): ComboboxValue[] => {+ const documentationLink = getEffectDocumentationLink(item);++ return [+ {+ type: 'item',+ id: `open-${item.id}-docs`,+ keyHint: null,+ label: 'Open effect docs',+ leftItem: null,+ disabled: false,+ onClick: () => {+ window.open(documentationLink, '_blank', 'noopener,noreferrer');+ },+ quickSwitcherLabel: null,+ subMenu: null,+ value: `open-${item.id}-docs`,+ },+ ];+ }, [item]);++ return (+ <ContextMenu values={contextMenuValues} onOpen={null}>+ <div+ ref={ref}+ style={style}+ onClick={onClick}+ onMouseEnter={() => setHovered(true)}+ onMouseLeave={() => setHovered(false)}+ >+ <div style={labelContainer}>+ <div style={labelStyle}>{item.label}</div>+ </div>+ <Spacing x={1} />+ <div style={category}>{item.category}</div>+ </div>+ </ContextMenu>+ );+};++const EffectPickerContent: React.FC<{+ readonly state: AddEffectModalState;+}> = ({state}) => {+ const {setSelectedModal} = useContext(ModalsContext);+ const [query, setQuery] = useState('');+ const [selectedIndex, setSelectedIndex] = useState(0);+ const inputRef = useRef<HTMLInputElement>(null);+ const keybindings = useKeybinding();++ const results = useMemo(() => {+ return filterEffectCatalog({items: EFFECT_CATALOG, query});+ }, [query]);++ const selectedIndexRounded =+ results.length === 0 ? -1 : loopIndex(selectedIndex, results.length);++ const selectItem = useCallback(+ (item: EffectCatalogItem) => {+ setSelectedModal(null);+ addEffectToSequence({+ clientId: state.clientId,+ effect: item.effect,+ fileName: state.fileName,+ nodePath: state.nodePath,+ });+ },+ [setSelectedModal, state.clientId, state.fileName, state.nodePath],+ );++ const onArrowDown = useCallback(() => {+ setSelectedIndex((i) => i + 1);+ }, []);++ const onArrowUp = useCallback(() => {+ setSelectedIndex((i) => i - 1);+ }, []);++ const onEnter = useCallback(() => {+ if (selectedIndexRounded === -1) {+ return;+ }++ selectItem(results[selectedIndexRounded]);+ }, [results, selectItem, selectedIndexRounded]);++ useEffect(() => {+ const downBinding = keybindings.registerKeybinding({+ key: 'ArrowDown',+ callback: onArrowDown,+ commandCtrlKey: false,+ event: 'keydown',+ preventDefault: true,+ triggerIfInputFieldFocused: true,+ keepRegisteredWhenNotHighestContext: false,+ });+ const upBinding = keybindings.registerKeybinding({+ key: 'ArrowUp',+ callback: onArrowUp,+ commandCtrlKey: false,+ event: 'keydown',+ preventDefault: true,+ triggerIfInputFieldFocused: true,+ keepRegisteredWhenNotHighestContext: false,+ });+ const enterBinding = keybindings.registerKeybinding({+ key: 'Enter',+ callback: onEnter,+ commandCtrlKey: false,+ event: 'keydown',+ preventDefault: true,+ triggerIfInputFieldFocused: true,+ keepRegisteredWhenNotHighestContext: false,+ });++ return () => {+ downBinding.unregister();+ upBinding.unregister();+ enterBinding.unregister();+ };+ }, [keybindings, onArrowDown, onArrowUp, onEnter]);++ const onTextChange: React.ChangeEventHandler<HTMLInputElement> = useCallback(+ (e) => {+ setQuery(e.target.value);+ setSelectedIndex(0);+ },+ [],+ );++ return (+ <div style={container}>+ <div style={content}>+ <RemotionInput+ ref={inputRef}+ type="text"+ style={inputStyle}+ autoFocus+ status="ok"+ value={query}+ onChange={onTextChange}+ placeholder="Search effects..."+ rightAlign={false}+ />+ </div>+ <div style={resultList} className={VERTICAL_SCROLLBAR_CLASSNAME}>+ {results.length === 0 ? (+ <div style={noResults}>No effects found</div>+ ) : (+ results.map((item, i) => {+ return (+ <EffectPickerResult+ key={item.id}+ item={item}+ selected={selectedIndexRounded === i}+ onSelected={selectItem}+ />+ );+ })+ )}+ </div>+ </div>+ );+};++export const EffectPickerModal: React.FC<{+ readonly state: AddEffectModalState;+}> = ({state}) => {+ return (+ <DismissableModal>+ <EffectPickerContent state={state} />+ </DismissableModal>+ );+};diff --git a/packages/studio/src/components/InspectorSequenceSection.tsx b/packages/studio/src/components/InspectorSequenceSection.tsxindex 2674da3c5f..89993f63ed 100644--- a/packages/studio/src/components/InspectorSequenceSection.tsx+++ b/packages/studio/src/components/InspectorSequenceSection.tsx@@ -1,6 +1,7 @@-import React, {useCallback, useMemo, useState} from 'react';+import React, {useCallback, useContext, useMemo, useState} from 'react';import type {TSequence} from 'remotion';import type {CodePosition} from '../error-overlay/react-overlay/utils/get-source-map';+import {StudioServerConnectionCtx} from '../helpers/client-id';import {LIGHT_TEXT, LINE_COLOR} from '../helpers/colors';import type {SequenceNodePathInfo} from '../helpers/get-timeline-sequence-sort-key';import {@@ -8,6 +9,10 @@ import {type FlatTreeRow,type TimelineTreeNode,} from '../helpers/timeline-layout';+import {Plus} from '../icons/plus';+import {ModalsContext} from '../state/modals';+import {InlineAction} from './InlineAction';+import {sectionHeaderRow, sectionHeaderTitle} from './InspectorPanel/styles';import {TimelineExpandedRow} from './Timeline/TimelineExpandedRow';import {useTimelineExpandedTree} from './Timeline/use-timeline-expanded-tree';@@ -39,6 +44,16 @@ const controlsEffectsDivider: React.CSSProperties = {margin: '8px 0 4px',};+const effectsHeaderTitle: React.CSSProperties = {+ ...sectionHeaderTitle,+ flexShrink: 1,+};++const plusIcon: React.CSSProperties = {+ width: 15,+ height: 15,+};+const isEffectsRoot = (node: TimelineTreeNode,): node is Extract<TimelineTreeNode, {kind: 'group'}> => {@@ -84,6 +99,8 @@ export const InspectorSequenceSection: React.FC<{const [collapsedKeys, setCollapsedKeys] = useState<ReadonlySet<string>>(() => new Set(),);+ const {previewServerState} = useContext(StudioServerConnectionCtx);+ const {setSelectedModal} = useContext(ModalsContext);const getIsExpanded = useCallback((candidate: SequenceNodePathInfo) => {@@ -138,6 +155,43 @@ export const InspectorSequenceSection: React.FC<{nodePathInfo.supportsEffects || effectRows.length > 0;const showControlsEffectsDivider =controlRows.length > 0 && showEffectsSection;+ const canAddEffect =+ nodePathInfo.supportsEffects &&+ previewServerState.type === 'connected' &&+ Boolean(validatedLocation.source);++ const onAddEffect = useCallback(() => {+ if (!canAddEffect || previewServerState.type !== 'connected') {+ return;+ }++ setSelectedModal({+ type: 'add-effect',+ clientId: previewServerState.clientId,+ fileName: validatedLocation.source,+ nodePath: nodePathInfo.sequenceSubscriptionKey,+ });+ }, [+ canAddEffect,+ nodePathInfo.sequenceSubscriptionKey,+ previewServerState,+ setSelectedModal,+ validatedLocation.source,+ ]);++ const renderEffectsHeader = () => {+ return renderSectionHeader(+ <div style={sectionHeaderRow}>+ <div style={effectsHeaderTitle}>Effects</div>+ <InlineAction+ disabled={!canAddEffect}+ onClick={onAddEffect}+ title={canAddEffect ? 'Add effect' : undefined}+ renderAction={(color) => <Plus color={color} style={plusIcon} />}+ />+ </div>,+ );+ };const renderRow = ({node, depth}: FlatTreeRow) => {return (@@ -177,7 +231,7 @@ export const InspectorSequenceSection: React.FC<{{showControlsEffectsDivider ? (<div style={controlsEffectsDivider} />) : null}- {renderSectionHeader('Effects')}+ {renderEffectsHeader()}{effectRows.length === 0 ? (<div style={emptyState}>None</div>) : (diff --git a/packages/studio/src/components/Modals.tsx b/packages/studio/src/components/Modals.tsxindex 99cc212ad1..057cf91f54 100644--- a/packages/studio/src/components/Modals.tsx+++ b/packages/studio/src/components/Modals.tsx@@ -3,6 +3,7 @@ import {StudioServerConnectionCtx} from '../helpers/client-id';import {ModalsContext} from '../state/modals';import {AskAiModal} from './AskAiModal';import {ConfirmationDialog} from './ConfirmationDialog';+import {EffectPickerModal} from './EffectPickerModal';import {InstallPackageModal} from './InstallPackage';import {DeleteComposition} from './NewComposition/DeleteComposition';import {DeleteFolder} from './NewComposition/DeleteFolder';@@ -163,6 +164,9 @@ export const Modals: React.FC<{initialMode={modalContextType.mode}/>)}+ {modalContextType && modalContextType.type === 'add-effect' && (+ <EffectPickerModal state={modalContextType} />+ )}{modalContextType && modalContextType.type === 'confirmation-dialog' && (<ConfirmationDialog state={modalContextType} />)}diff --git a/packages/studio/src/components/QuickSwitcher/QuickSwitcherContent.tsx b/packages/studio/src/components/QuickSwitcher/QuickSwitcherContent.tsxindex 9e44ff5357..91c4e08325 100644--- a/packages/studio/src/components/QuickSwitcher/QuickSwitcherContent.tsx+++ b/packages/studio/src/components/QuickSwitcher/QuickSwitcherContent.tsx@@ -27,6 +27,7 @@ import type {QuickSwitcherMode} from './NoResults';import {QuickSwitcherNoResults} from './NoResults';import type {TQuickSwitcherResult} from './QuickSwitcherResult';import {QuickSwitcherResult} from './QuickSwitcherResult';+import {loopIndex} from './shared';const input: React.CSSProperties = {width: '100%',@@ -71,14 +72,6 @@ const content: React.CSSProperties = {alignItems: 'center',};-const loopIndex = (index: number, length: number) => {- if (index < 0) {- index += length;- }-- return index % length;-};-const stripQuery = (query: string) => {if (query.startsWith('>') || query.startsWith('?')) {return query.substring(1).trim();diff --git a/packages/studio/src/components/QuickSwitcher/QuickSwitcherResult.tsx b/packages/studio/src/components/QuickSwitcher/QuickSwitcherResult.tsxindex c4a33a8923..1f7fa823e7 100644--- a/packages/studio/src/components/QuickSwitcher/QuickSwitcherResult.tsx+++ b/packages/studio/src/components/QuickSwitcher/QuickSwitcherResult.tsx@@ -4,6 +4,10 @@ import {useKeybinding} from '../../helpers/use-keybinding';import {StillIcon} from '../../icons/still';import {FilmIcon} from '../../icons/video';import {Spacing} from '../layout';+import {+ QUICK_SWITCHER_RESULT_LABEL_FONT_SIZE,+ useScrollIntoViewOnSelected,+} from './shared';type QuickSwitcherResultDetail =| {@@ -104,14 +108,7 @@ export const QuickSwitcherResult: React.FC<{};}, [keybindings, result.onSelected, selected]);- useEffect(() => {- if (selected) {- ref.current?.scrollIntoView({- block: 'nearest',- inline: 'center',- });- }- }, [selected]);+ useScrollIntoViewOnSelected(ref, selected);const style = useMemo(() => {return {@@ -132,7 +129,7 @@ export const QuickSwitcherResult: React.FC<{: selected || hovered? 'white': LIGHT_TEXT,- fontSize: 15,+ fontSize: QUICK_SWITCHER_RESULT_LABEL_FONT_SIZE,};}, [hovered, result.type, selected]);diff --git a/packages/studio/src/components/QuickSwitcher/shared.ts b/packages/studio/src/components/QuickSwitcher/shared.tsnew file mode 100644index 0000000000..a5d3738829--- /dev/null+++ b/packages/studio/src/components/QuickSwitcher/shared.ts@@ -0,0 +1,25 @@+import {useEffect, type RefObject} from 'react';++export const QUICK_SWITCHER_RESULT_LABEL_FONT_SIZE = 15;++export const loopIndex = (index: number, length: number) => {+ if (index < 0) {+ index += length;+ }++ return index % length;+};++export const useScrollIntoViewOnSelected = <T extends HTMLElement>(+ ref: RefObject<T | null>,+ selected: boolean,+) => {+ useEffect(() => {+ if (selected) {+ ref.current?.scrollIntoView({+ block: 'nearest',+ inline: 'center',+ });+ }+ }, [ref, selected]);+};diff --git a/packages/studio/src/components/Timeline/TimelineDeleteKeybindings.tsx b/packages/studio/src/components/Timeline/TimelineDeleteKeybindings.tsxindex 9c52219a2b..5b7e9b2ea7 100644--- a/packages/studio/src/components/Timeline/TimelineDeleteKeybindings.tsx+++ b/packages/studio/src/components/Timeline/TimelineDeleteKeybindings.tsx@@ -9,7 +9,10 @@ import {persistGuidesList,} from '../../state/editor-guides';import {useConfirmationDialog} from '../ConfirmationDialog';-import {deleteSelectedTimelineItems} from './delete-selected-timeline-item';+import {+ deleteSelectedTimelineItems,+ getTimelineSelectionAfterDeletingItems,+} from './delete-selected-timeline-item';import {duplicateSelectedTimelineItems} from './duplicate-selected-timeline-item';import {resetSelectedTimelineProps} from './reset-selected-timeline-props';import {@@ -44,7 +47,8 @@ export const TimelineDeleteKeybindings: React.FC = () => {const {clientId} = previewServerState;const handleDelete = () => {- const {selectedItems, clearSelection} = currentSelection.current;+ const {selectedItems, clearSelection, selectItems} =+ currentSelection.current;const sequences = sequencesRef.current;const propStatuses = propStatusesRef.current;if (selectedItems.length === 0) {@@ -77,7 +81,13 @@ export const TimelineDeleteKeybindings: React.FC = () => {deletePromise.then((deleted) => {if (deleted) {- clearSelection();+ const nextSelection =+ getTimelineSelectionAfterDeletingItems(selectedItems);+ if (nextSelection.length === 0) {+ clearSelection();+ } else {+ selectItems(nextSelection);+ }}}).catch(() => undefined);diff --git a/packages/studio/src/components/Timeline/TimelineSelection.tsx b/packages/studio/src/components/Timeline/TimelineSelection.tsxindex 2521f8375c..1b61b2765f 100644--- a/packages/studio/src/components/Timeline/TimelineSelection.tsx+++ b/packages/studio/src/components/Timeline/TimelineSelection.tsx@@ -329,22 +329,30 @@ export const getTimelineSelectionAfterInteraction = ({export const getAvailableTimelineSelectionState = ({availableKeys,+ availableItemsByKey,state,}: {readonly availableKeys: ReadonlySet<string>;+ readonly availableItemsByKey?: ReadonlyMap<string, TimelineSelection>;readonly state: TimelineSelectionState;}): TimelineSelectionState => {if (state.selectedItems.length === 0 && state.anchor === null) {return state;}- const selectedItems = state.selectedItems.filter((item) =>- availableKeys.has(getTimelineSelectionKey(item)),- );- const anchor =- state.anchor && availableKeys.has(getTimelineSelectionKey(state.anchor))- ? state.anchor- : null;+ const getCurrentSelectionItem = (item: TimelineSelection) => {+ const key = getTimelineSelectionKey(item);+ if (!availableKeys.has(key)) {+ return null;+ }++ return availableItemsByKey?.get(key) ?? item;+ };++ const selectedItems = state.selectedItems+ .map(getCurrentSelectionItem)+ .filter((item): item is TimelineSelection => item !== null);+ const anchor = state.anchor ? getCurrentSelectionItem(state.anchor) : null;if (selectedItems.length === state.selectedItems.length &&@@ -761,6 +769,7 @@ export const TimelineSelectionProvider: React.FC<{return getAvailableTimelineSelectionState({availableKeys: new Set(selectableItems.current.keys()),+ availableItemsByKey: selectableItems.current,state: {selectedItems: currentSelectedItems,anchor: selectionAnchor.current,@@ -780,6 +789,7 @@ export const TimelineSelectionProvider: React.FC<{selectionScope.current === timelineSelectionScope? getAvailableTimelineSelectionState({availableKeys: new Set(selectableItems.current.keys()),+ availableItemsByKey: selectableItems.current,state: {selectedItems: currentSelectedItems,anchor: selectionAnchor.current,diff --git a/packages/studio/src/components/Timeline/delete-selected-timeline-item.ts b/packages/studio/src/components/Timeline/delete-selected-timeline-item.tsindex 82626708b7..c67915f42c 100644--- a/packages/studio/src/components/Timeline/delete-selected-timeline-item.ts+++ b/packages/studio/src/components/Timeline/delete-selected-timeline-item.ts@@ -8,7 +8,10 @@ import {deleteSelectedKeyframes,} from './delete-selected-keyframe';import type {SetPropStatuses} from './save-sequence-prop';-import type {TimelineSelection} from './TimelineSelection';+import {+ getTimelineSelectionKey,+ type TimelineSelection,+} from './TimelineSelection';const confirmDeletingDuplicatedSequences = (nodePathInfos: SequenceNodePathInfo[],@@ -217,6 +220,42 @@ const isKeyframeSelection = (type: 'keyframe';} => selection.type === 'keyframe';+const getSequenceSelectionAfterDeletingEffect = (+ selection: TimelineSelection,+): TimelineSelection | null => {+ if (+ selection.type !== 'sequence-effect' &&+ selection.type !== 'sequence-all-effects'+ ) {+ return null;+ }++ return {+ type: 'sequence',+ nodePathInfo: {+ ...selection.nodePathInfo,+ auxiliaryKeys: [],+ },+ };+};++export const getTimelineSelectionAfterDeletingItems = (+ selections: readonly TimelineSelection[],+): readonly TimelineSelection[] => {+ const nextSelections = new Map<string, TimelineSelection>();++ for (const selection of selections) {+ const nextSelection = getSequenceSelectionAfterDeletingEffect(selection);+ if (!nextSelection) {+ return [];+ }++ nextSelections.set(getTimelineSelectionKey(nextSelection), nextSelection);+ }++ return Array.from(nextSelections.values());+};+const areSelectionsOnlyOfType = (selections: readonly TimelineSelection[],type: TimelineSelection['type'],diff --git a/packages/studio/src/components/effect-drag-and-drop.ts b/packages/studio/src/components/effect-drag-and-drop.tsindex 95220b7ab3..c92fa0ebc3 100644--- a/packages/studio/src/components/effect-drag-and-drop.ts+++ b/packages/studio/src/components/effect-drag-and-drop.ts@@ -66,7 +66,7 @@ export const getEffectDragData = (return null;};-export const addEffectFromDragData = async ({+export const addEffectFromDragData = ({clientId,dragData,fileName,@@ -76,24 +76,43 @@ export const addEffectFromDragData = async ({readonly dragData: EffectDragData;readonly fileName: string;readonly nodePath: SequencePropsSubscriptionKey;+}) => {+ return addEffectToSequence({+ clientId,+ effect: dragData.effect,+ fileName,+ nodePath,+ });+};++export const addEffectToSequence = async ({+ clientId,+ effect,+ fileName,+ nodePath,+}: {+ readonly clientId: string;+ readonly effect: EffectDragData['effect'];+ readonly fileName: string;+ readonly nodePath: SequencePropsSubscriptionKey;}) => {try {const requiredPackage = getRequiredPackageForEffectImportPath(- dragData.effect.importPath,+ effect.importPath,);await installRequiredPackages(requiredPackage ? [requiredPackage] : []);const result = await callApi('/api/add-effect', {fileName,sequenceNodePath: nodePath,- effectName: dragData.effect.name,- effectImportPath: dragData.effect.importPath,- effectConfig: dragData.effect.config,+ effectName: effect.name,+ effectImportPath: effect.importPath,+ effectConfig: effect.config,clientId,});if (result.success) {- showNotification(`Added ${dragData.effect.name}()`, 2000);+ showNotification(`Added ${effect.name}()`, 2000);} else {showNotification(result.reason, 4000);}diff --git a/packages/studio/src/components/effect-picker-search.ts b/packages/studio/src/components/effect-picker-search.tsnew file mode 100644index 0000000000..e5f314b858--- /dev/null+++ b/packages/studio/src/components/effect-picker-search.ts@@ -0,0 +1,112 @@+import type {EffectCatalogItem} from '@remotion/studio-shared';++const normalize = (value: string) => value.trim().toLowerCase();++const compact = (value: string) => normalize(value).replace(/[^a-z0-9]/g, '');++const fuzzyMatches = (query: string, value: string) => {+ let index = -1;+ for (const character of query) {+ index = value.indexOf(character, index + 1);+ if (index === -1) {+ return false;+ }+ }++ return true;+};++const getMatchScore = (item: EffectCatalogItem, query: string) => {+ const normalizedQuery = normalize(query);+ const compactQuery = compact(query);++ if (normalizedQuery.length === 0) {+ return 0;+ }++ const label = normalize(item.label);+ const name = normalize(item.effect.name);+ const primary = [label, name];+ const compactPrimary = primary.map(compact);++ if (primary.some((field) => field === normalizedQuery)) {+ return 0;+ }++ if (compactQuery.length > 0) {+ if (compactPrimary.some((field) => field === compactQuery)) {+ return 1;+ }++ if (compactPrimary.some((field) => field.startsWith(compactQuery))) {+ return 2;+ }+ }++ if (primary.some((field) => field.startsWith(normalizedQuery))) {+ return 2;+ }++ if (compactQuery.length > 0) {+ if (compactPrimary.some((field) => field.includes(compactQuery))) {+ return 3;+ }+ }++ if (primary.some((field) => field.includes(normalizedQuery))) {+ return 3;+ }++ const importPath = normalize(item.effect.importPath);+ if (+ importPath.includes(normalizedQuery) ||+ (compactQuery.length > 0 && compact(importPath).includes(compactQuery))+ ) {+ return 4;+ }++ const secondary = [normalize(item.category), normalize(item.description)];+ const compactSecondary = secondary.map(compact);+ if (+ secondary.some((field) => field.includes(normalizedQuery)) ||+ (compactQuery.length > 0 &&+ compactSecondary.some((field) => field.includes(compactQuery)))+ ) {+ return 5;+ }++ if (+ compactQuery.length > 0 &&+ compactPrimary.some((field) => fuzzyMatches(compactQuery, field))+ ) {+ return 6;+ }++ return null;+};++export const filterEffectCatalog = ({+ items,+ query,+}: {+ readonly items: readonly EffectCatalogItem[];+ readonly query: string;+}) => {+ return items+ .map((item, index) => ({+ item,+ index,+ score: getMatchScore(item, query),+ }))+ .filter(+ (+ candidate,+ ): candidate is {+ readonly item: EffectCatalogItem;+ readonly index: number;+ readonly score: number;+ } => candidate.score !== null,+ )+ .sort((a, b) => a.score - b.score || a.index - b.index)+ .map(({item}) => item);+};diff --git a/packages/studio/src/state/modals.ts b/packages/studio/src/state/modals.tsindex 68bebb2e87..10d9b05142 100644--- a/packages/studio/src/state/modals.ts+++ b/packages/studio/src/state/modals.ts@@ -22,7 +22,7 @@ import type {} from '@remotion/web-renderer';import type React from 'react';import {createContext} from 'react';-import type {_InternalTypes} from 'remotion';+import type {SequencePropsSubscriptionKey, _InternalTypes} from 'remotion';import type {CompType} from '../components/NewComposition/DuplicateComposition';import type {QuickSwitcherMode} from '../components/QuickSwitcher/NoResults';import type {RenderType} from '../components/RenderModal/RenderModalAdvanced';@@ -120,6 +120,13 @@ export type ConfirmationDialogState = {onCancel: () => void;};+export type AddEffectModalState = {+ type: 'add-effect';+ fileName: string;+ nodePath: SequencePropsSubscriptionKey;+ clientId: string;+};+export type ModalState =| {type: 'duplicate-comp';@@ -174,6 +181,7 @@ export type ModalState =mode: QuickSwitcherMode;invocationTimestamp: number;}+ | AddEffectModalState| ConfirmationDialogState;export type ModalContextType = {diff --git a/packages/studio/src/test/effect-catalog.test.ts b/packages/studio/src/test/effect-catalog.test.tsnew file mode 100644index 0000000000..cc117695c9--- /dev/null+++ b/packages/studio/src/test/effect-catalog.test.ts@@ -0,0 +1,36 @@+import {expect, test} from 'bun:test';+import {+ EFFECT_CATALOG,+ getEffectDocumentationLink,+} from '@remotion/studio-shared';++test('effect catalog exposes documentation links for picker context menu', () => {+ const links = new Map(+ EFFECT_CATALOG.map((item) => [+ item.label,+ getEffectDocumentationLink(item),+ ]),+ );++ expect(links.get('brightness()')).toBe(+ 'https://www.remotion.dev/docs/effects/brightness',+ );+ expect(links.get('xyTranslate()')).toBe(+ 'https://www.remotion.dev/docs/effects/xy-translate',+ );+ expect(links.get('uvTranslate()')).toBe(+ 'https://www.remotion.dev/docs/effects/uv-translate',+ );+ expect(links.get('pixelate()')).toBe(+ 'https://www.remotion.dev/docs/effects/pixelate',+ );+ expect(links.get('shrinkwrap()')).toBe(+ 'https://www.remotion.dev/docs/effects/shrinkwrap',+ );+ expect(links.get('lightLeak()')).toBe(+ 'https://www.remotion.dev/docs/light-leaks/light-leak-effect',+ );+ expect(links.get('starburst()')).toBe(+ 'https://www.remotion.dev/docs/starburst/starburst-effect',+ );+});diff --git a/packages/studio/src/test/effect-picker-search.test.ts b/packages/studio/src/test/effect-picker-search.test.tsnew file mode 100644index 0000000000..9399346394--- /dev/null+++ b/packages/studio/src/test/effect-picker-search.test.ts@@ -0,0 +1,45 @@+import {expect, test} from 'bun:test';+import {EFFECT_CATALOG} from '@remotion/studio-shared';+import {filterEffectCatalog} from '../components/effect-picker-search';++test('effect picker search ranks exact effect names first', () => {+ const results = filterEffectCatalog({+ items: EFFECT_CATALOG,+ query: 'noise()',+ });++ expect(results.map((item) => item.label).slice(0, 3)).toEqual([+ 'noise()',+ 'noiseDisplacement()',+ 'whiteNoise()',+ ]);+ expect(results.map((item) => item.label)).not.toContain('brightness()');+ expect(results.map((item) => item.label)).not.toContain('colorKey()');+});++test('effect picker search handles punctuation-insensitive names', () => {+ expect(+ filterEffectCatalog({+ items: EFFECT_CATALOG,+ query: 'color key',+ })[0].label,+ ).toBe('colorKey()');++ expect(+ filterEffectCatalog({+ items: EFFECT_CATALOG,+ query: 'drop-shadow',+ })[0].label,+ ).toBe('dropShadow()');+});++test('effect picker search preserves table-of-contents order for empty queries', () => {+ expect(+ filterEffectCatalog({+ items: EFFECT_CATALOG,+ query: '',+ })+ .slice(0, 3)+ .map((item) => item.label),+ ).toEqual(['brightness()', 'contrast()', 'colorKey()']);+});diff --git a/packages/studio/src/test/timeline-selection.test.ts b/packages/studio/src/test/timeline-selection.test.tsindex aed84b1a00..9bc910e887 100644--- a/packages/studio/src/test/timeline-selection.test.ts+++ b/packages/studio/src/test/timeline-selection.test.ts@@ -51,7 +51,10 @@ import {type SelectedOutlineScaleDragState,} from '../components/SelectedOutlineOverlay';import {getSelectedOutlineUvHandleTimelineSelection} from '../components/SelectedOutlineUvControls';-import {deleteSelectedTimelineItems} from '../components/Timeline/delete-selected-timeline-item';+import {+ deleteSelectedTimelineItems,+ getTimelineSelectionAfterDeletingItems,+} from '../components/Timeline/delete-selected-timeline-item';import {isDuplicatableEffectSelection,isDuplicatableSequenceRowSelection,@@ -3608,6 +3611,57 @@ test('Deleting unsupported mixed timeline selection types returns null', () => {).toBe(null);});+test('Deleting selected effects keeps their parent sequence selected', () => {+ const effectNodePathInfo = makeNodePathInfo(['body', 0], ['effects', '1']);+ const result = getTimelineSelectionAfterDeletingItems([+ {+ type: 'sequence-effect',+ nodePathInfo: effectNodePathInfo,+ i: 1,+ },+ ]);++ expect(result).toEqual([+ {+ type: 'sequence',+ nodePathInfo: {+ ...effectNodePathInfo,+ auxiliaryKeys: [],+ },+ },+ ]);+});++test('Deleting selected all-effects rows keeps their parent sequence selected', () => {+ const effectsNodePathInfo = makeNodePathInfo(['body', 0], ['effects']);+ const result = getTimelineSelectionAfterDeletingItems([+ {+ type: 'sequence-all-effects',+ nodePathInfo: effectsNodePathInfo,+ },+ ]);++ expect(result).toEqual([+ {+ type: 'sequence',+ nodePathInfo: {+ ...effectsNodePathInfo,+ auxiliaryKeys: [],+ },+ },+ ]);+});++test('Deleting selected sequences still clears selection', () => {+ const sequenceNodePathInfo = makeNodePathInfo(['body', 0], []);++ expect(+ getTimelineSelectionAfterDeletingItems([+ {type: 'sequence', nodePathInfo: sequenceNodePathInfo},+ ]),+ ).toEqual([]);+});+test('Deleting selected keyframes ignores selected easings', async () => {const schema = {opacity: {type: 'number', default: 1, hiddenFromList: false},@@ -4168,6 +4222,33 @@ test('Unavailable timeline selections are removed from the active selection stat});});+test('Available timeline selections are refreshed with the latest selectable item', () => {+ const staleRow = {+ type: 'sequence' as const,+ nodePathInfo: makeNodePathInfo(['body', 0], [], true, [['oldEffect']]),+ };+ const currentRow = {+ type: 'sequence' as const,+ nodePathInfo: makeNodePathInfo(['body', 0], [], true, [+ ['oldEffect'],+ ['newEffect'],+ ]),+ };+ const currentRowKey = getTimelineSelectionKey(currentRow);++ const result = getAvailableTimelineSelectionState({+ availableKeys: new Set([currentRowKey]),+ availableItemsByKey: new Map([[currentRowKey, currentRow]]),+ state: {+ selectedItems: [staleRow],+ anchor: staleRow,+ },+ });++ expect(result.selectedItems[0]).toBe(currentRow);+ expect(result.anchor).toBe(currentRow);+});+test('Unavailable timeline selections become no active selection', () => {const unavailableRow = {type: 'sequence' as const,