π₯ Make videos programmatically with React
cc first iteration
JonnyBurger677ea6b12d0c
diff --git a/.claude/skills/add-new-package/SKILL.md b/.claude/skills/add-new-package/SKILL.mdnew file mode 100644index 0000000000..0ba78d15de--- /dev/null+++ b/.claude/skills/add-new-package/SKILL.md@@ -0,0 +1,45 @@+# Add a new Remotion package++## Steps++1. **Create `packages/<name>/`** with these files:+ - `package.json` β copy from `@remotion/motion-blur` as template; update name, description, homepage, dependencies+ - `tsconfig.json` β extends `../tsconfig.settings.json`, rootDir `src`, outDir `dist/cjs`, reference `../core`+ - `src/index.ts` β exports+ - `bundle.ts` β Bun build script, externalize `react`, `remotion`, `remotion/no-react`, `react/jsx-runtime`+ - `eslint.config.mjs` β use `remotionFlatConfig({react: true})` if React, `{react: false}` otherwise+ - `.npmignore` β copy from `@remotion/noise`+ - `README.md` β package name, description, install command, link to docs++2. **Register in monorepo:**+ - `tsconfig.json` (root) β add `{"path": "./packages/<name>"}` to references+ - `packages/cli/src/list-of-remotion-packages.ts` β add `'@remotion/<name>'`+ - `packages/create-video/src/list-of-remotion-packages.ts` β add `'@remotion/<name>'`+ - `packages/studio-shared/src/package-info.ts` β add to `packages`, `descriptions`, `installableMap`, `apiDocs`++3. **Documentation (`packages/docs/docs/<name>/`):**+ - `index.mdx` β install tabs, table of contents, license+ - `table-of-contents.tsx` β TOCItem grid linking to component/function pages+ - Individual component/function `.mdx` pages+ - Edit `packages/docs/sidebars.ts` β add category+ - Edit `packages/docs/src/data/articles.ts` β add entries alphabetically++4. **Example usage:**+ - Add `"@remotion/<name>": "workspace:*"` to `packages/example/package.json`+ - Create `packages/example/src/<Name>/index.tsx`+ - Register `<Composition>` in `packages/example/src/Root.tsx`++5. **Run `bun i`** to install dependencies++6. **Build:** `cd packages/<name> && bun run make`++## Version++Use the current version from `packages/core/src/version.ts`.++## Patterns++- Use `"workspace:*"` for internal dependencies+- Use `"catalog:"` for shared external dependency versions+- The `make` script is: `tsc -d && bun --env-file=../.env.bundle bundle.ts`+- Packages with React components need `peerDependencies` for `react` and `react-dom`diff --git a/bun.lock b/bun.lockindex 8a03282acc..74bc23aec3 100644--- a/bun.lock+++ b/bun.lock@@ -589,6 +589,7 @@"@remotion/lambda": "workspace:*","@remotion/lambda-client": "workspace:*","@remotion/layout-utils": "workspace:*",+ "@remotion/light-leaks": "workspace:*","@remotion/lottie": "workspace:*","@remotion/media": "workspace:*","@remotion/media-parser": "workspace:*",@@ -881,6 +882,24 @@"remotion": "workspace:*",},},+ "packages/light-leaks": {+ "name": "@remotion/light-leaks",+ "version": "4.0.414",+ "dependencies": {+ "remotion": "workspace:*",+ },+ "devDependencies": {+ "@remotion/eslint-config-internal": "workspace:*",+ "eslint": "catalog:",+ "react": "catalog:",+ "react-dom": "catalog:",+ "remotion": "workspace:*",+ },+ "peerDependencies": {+ "react": ">=16.8.0",+ "react-dom": ">=16.8.0",+ },+ },"packages/lottie": {"name": "@remotion/lottie","version": "4.0.414",@@ -3548,6 +3567,8 @@"@remotion/licensing": ["@remotion/licensing@workspace:packages/licensing"],+ "@remotion/light-leaks": ["@remotion/light-leaks@workspace:packages/light-leaks"],+"@remotion/lottie": ["@remotion/lottie@workspace:packages/lottie"],"@remotion/mcp": ["@remotion/mcp@workspace:packages/mcp"],diff --git a/packages/cli/src/list-of-remotion-packages.ts b/packages/cli/src/list-of-remotion-packages.tsindex 20ab0fe226..b89083c659 100644--- a/packages/cli/src/list-of-remotion-packages.ts+++ b/packages/cli/src/list-of-remotion-packages.ts@@ -83,4 +83,5 @@ export const listOfRemotionPackages = ['@remotion/media','@remotion/web-renderer','@remotion/design',+ '@remotion/light-leaks',];diff --git a/packages/create-video/src/list-of-remotion-packages.ts b/packages/create-video/src/list-of-remotion-packages.tsindex 20ab0fe226..b89083c659 100644--- a/packages/create-video/src/list-of-remotion-packages.ts+++ b/packages/create-video/src/list-of-remotion-packages.ts@@ -83,4 +83,5 @@ export const listOfRemotionPackages = ['@remotion/media','@remotion/web-renderer','@remotion/design',+ '@remotion/light-leaks',];diff --git a/packages/docs/docs/light-leaks/index.mdx b/packages/docs/docs/light-leaks/index.mdxnew file mode 100644index 0000000000..87b4a415e4--- /dev/null+++ b/packages/docs/docs/light-leaks/index.mdx@@ -0,0 +1,53 @@+---+image: /generated/articles-docs-light-leaks-index.png+title: '@remotion/light-leaks'+---++<AvailableFrom v="4.0.414" />++Light leak effects for Remotion videos.++import Tabs from '@theme/Tabs';+import TabItem from '@theme/TabItem';+import {TableOfContents} from './table-of-contents';++<Tabs+defaultValue="npm"+values={[+{ label: 'npm', value: 'npm', },+{ label: 'pnpm', value: 'pnpm', },+{ label: 'yarn', value: 'yarn', },+]+}>+<TabItem value="npm">++```bash+npm i @remotion/light-leaks+```++ </TabItem>++ <TabItem value="pnpm">++```bash+pnpm i @remotion/light-leaks+```++ </TabItem>++ <TabItem value="yarn">++```bash+yarn add @remotion/light-leaks+```++ </TabItem>+</Tabs>++## Components++<TableOfContents />++## License++MITdiff --git a/packages/docs/docs/light-leaks/light-leak.mdx b/packages/docs/docs/light-leaks/light-leak.mdxnew file mode 100644index 0000000000..42116eef9e--- /dev/null+++ b/packages/docs/docs/light-leaks/light-leak.mdx@@ -0,0 +1,29 @@+---+image: /generated/articles-docs-light-leaks-light-leak.png+title: '<LightLeak>'+---++<AvailableFrom v="4.0.414" />++A component that renders a light leak effect as a [`<Sequence>`](/docs/sequence).++## API++The `<LightLeak>` component accepts all props that [`<Sequence>`](/docs/sequence) accepts.++```tsx twoslash+import {LightLeak} from '@remotion/light-leaks';++const MyVideo = () => {+ return (+ <LightLeak durationInFrames={60}>+ <div>My content</div>+ </LightLeak>+ );+};+```++## See also++- [Source code for this component](https://github.com/remotion-dev/remotion/blob/main/packages/light-leaks/src/LightLeak.tsx)+- [`<Sequence>`](/docs/sequence)diff --git a/packages/docs/docs/light-leaks/table-of-contents.tsx b/packages/docs/docs/light-leaks/table-of-contents.tsxnew file mode 100644index 0000000000..61476d09cf--- /dev/null+++ b/packages/docs/docs/light-leaks/table-of-contents.tsx@@ -0,0 +1,16 @@+import React from "react";+import { Grid } from "../../components/TableOfContents/Grid";+import { TOCItem } from "../../components/TableOfContents/TOCItem";++export const TableOfContents: React.FC = () => {+ return (+ <div>+ <Grid>+ <TOCItem link="/docs/light-leaks/light-leak">+ <strong>{"<LightLeak>"}</strong>+ <div>Render a light leak effect</div>+ </TOCItem>+ </Grid>+ </div>+ );+};diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.tsindex bfa217509c..e63f3254dc 100644--- a/packages/docs/sidebars.ts+++ b/packages/docs/sidebars.ts@@ -478,6 +478,15 @@ const sidebars: SidebarsConfig = {},items: ['noise/noise-2d', 'noise/noise-3d', 'noise/noise-4d'],},+ {+ type: 'category',+ label: '@remotion/light-leaks',+ link: {+ type: 'doc',+ id: 'light-leaks/index',+ },+ items: ['light-leaks/light-leak'],+ },{type: 'category',label: '@remotion/openai-whisper',diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.tsindex d6b69730d7..f4273396c2 100644--- a/packages/docs/src/data/articles.ts+++ b/packages/docs/src/data/articles.ts@@ -3122,6 +3122,24 @@ export const articles = [noAi: false,slug: 'lottie/getlottiemetadata',},+ {+ id: 'light-leaks/index',+ title: '@remotion/light-leaks',+ relativePath: 'docs/light-leaks/index.mdx',+ compId: 'articles-docs-light-leaks-index',+ crumb: null,+ noAi: false,+ slug: 'light-leaks/index',+ },+ {+ id: 'light-leaks/light-leak',+ title: '<LightLeak>',+ relativePath: 'docs/light-leaks/light-leak.mdx',+ compId: 'articles-docs-light-leaks-light-leak',+ crumb: '@remotion/light-leaks',+ noAi: false,+ slug: 'light-leaks/light-leak',+ },{id: 'lottie-index',title: '@remotion/lottie',diff --git a/packages/example/package.json b/packages/example/package.jsonindex d8f666dffd..f12a8b041a 100644--- a/packages/example/package.json+++ b/packages/example/package.json@@ -52,6 +52,7 @@"@remotion/lottie": "workspace:*","@remotion/media-utils": "workspace:*","@remotion/motion-blur": "workspace:*",+ "@remotion/light-leaks": "workspace:*","@remotion/noise": "workspace:*","@remotion/paths": "workspace:*","@remotion/player": "workspace:*",diff --git a/packages/example/src/LightLeak/index.tsx b/packages/example/src/LightLeak/index.tsxnew file mode 100644index 0000000000..c385da3a5a--- /dev/null+++ b/packages/example/src/LightLeak/index.tsx@@ -0,0 +1,17 @@+import {LightLeak} from '@remotion/light-leaks';+import React from 'react';+import {AbsoluteFill} from 'remotion';++export const LightLeakExample: React.FC = () => {+ return (+ <AbsoluteFill>+ <LightLeak durationInFrames={60}>+ <AbsoluteFill+ style={{backgroundColor: 'white', justifyContent: 'center', alignItems: 'center'}}+ >+ <h1 style={{fontSize: 60}}>Light Leak Effect</h1>+ </AbsoluteFill>+ </LightLeak>+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsxindex c00291f889..d70461bb85 100644--- a/packages/example/src/Root.tsx+++ b/packages/example/src/Root.tsx@@ -155,6 +155,7 @@ import {VideoTestingTrim} from './VideoTesting/trim';import {RemotionMediaVideoTexture} from './VideoTexture';import {VisualControls} from './VisualControls';import {VoiceVisualization} from './voice-visualization';+import {LightLeakExample} from './LightLeak';import {WhisperWeb} from './WhisperWeb';class Vector2 {@@ -1812,6 +1813,14 @@ export const Index: React.FC = () => {fps={30}durationInFrames={600}/>+ <Composition+ id="light-leak"+ component={LightLeakExample}+ width={1080}+ height={1080}+ fps={30}+ durationInFrames={90}+ /><ChangingTrimBeforeValue /><Compositionid="browser-test"diff --git a/packages/light-leaks/.npmignore b/packages/light-leaks/.npmignorenew file mode 100644index 0000000000..71352c3fd9--- /dev/null+++ b/packages/light-leaks/.npmignore@@ -0,0 +1,10 @@+dist/test/**+src+eslint.config.mjs+tsconfig.tsbuildinfo+*.tgz+.turbo+tsconfig.json+.prettierrc.js+bundle.ts+dist/cjs/test\ No newline at end of filediff --git a/packages/light-leaks/README.md b/packages/light-leaks/README.mdnew file mode 100644index 0000000000..1e755a0912--- /dev/null+++ b/packages/light-leaks/README.md@@ -0,0 +1,18 @@+# @remotion/light-leaks++Light leak effects for Remotion++[](https://npmcharts.com/compare/@remotion/light-leaks?minimal=true)++## Installation++```bash+npm install @remotion/light-leaks --save-exact+```++When installing a Remotion package, make sure to align the version of all `remotion` and `@remotion/*` packages to the same version.+Remove the `^` character from the version number to use the exact version.++## Usage++See the [documentation](https://www.remotion.dev/docs/light-leaks) for more information.diff --git a/packages/light-leaks/bundle.ts b/packages/light-leaks/bundle.tsnew file mode 100644index 0000000000..b6fef6a414--- /dev/null+++ b/packages/light-leaks/bundle.ts@@ -0,0 +1,14 @@+import {build} from 'bun';++const output = await build({+ entrypoints: ['src/index.ts'],+ naming: '[name].mjs',+ external: ['react', 'remotion', 'remotion/no-react', 'react/jsx-runtime'],+});++const [file] = output.outputs;+const text = await file.text();++await Bun.write('dist/esm/index.mjs', text);++export {};diff --git a/packages/light-leaks/eslint.config.mjs b/packages/light-leaks/eslint.config.mjsnew file mode 100644index 0000000000..ab29acaba0--- /dev/null+++ b/packages/light-leaks/eslint.config.mjs@@ -0,0 +1,7 @@+import {remotionFlatConfig} from '@remotion/eslint-config-internal';++const config = remotionFlatConfig({react: true});++export default {+ ...config,+};diff --git a/packages/light-leaks/package.json b/packages/light-leaks/package.jsonnew file mode 100644index 0000000000..c752fe9dda--- /dev/null+++ b/packages/light-leaks/package.json@@ -0,0 +1,54 @@+{+ "repository": {+ "url": "https://github.com/remotion-dev/remotion/tree/main/packages/light-leaks"+ },+ "name": "@remotion/light-leaks",+ "version": "4.0.414",+ "description": "Light leak effects for Remotion",+ "main": "dist/cjs/index.js",+ "types": "dist/cjs/index.d.ts",+ "module": "dist/esm/index.mjs",+ "sideEffects": false,+ "scripts": {+ "formatting": "prettier --experimental-cli src --check",+ "lint": "eslint src",+ "make": "tsc -d && bun --env-file=../.env.bundle bundle.ts"+ },+ "author": "Jonny Burger <[email protected]>",+ "contributors": [],+ "license": "MIT",+ "bugs": {+ "url": "https://github.com/remotion-dev/remotion/issues"+ },+ "dependencies": {+ "remotion": "workspace:*"+ },+ "peerDependencies": {+ "react": ">=16.8.0",+ "react-dom": ">=16.8.0"+ },+ "exports": {+ "./package.json": "./package.json",+ ".": {+ "types": "./dist/cjs/index.d.ts",+ "module": "./dist/esm/index.mjs",+ "import": "./dist/esm/index.mjs",+ "require": "./dist/cjs/index.js"+ }+ },+ "devDependencies": {+ "react": "catalog:",+ "react-dom": "catalog:",+ "remotion": "workspace:*",+ "@remotion/eslint-config-internal": "workspace:*",+ "eslint": "catalog:"+ },+ "keywords": [+ "remotion",+ "light-leaks"+ ],+ "publishConfig": {+ "access": "public"+ },+ "homepage": "https://www.remotion.dev/docs/light-leaks"+}diff --git a/packages/light-leaks/src/LightLeak.tsx b/packages/light-leaks/src/LightLeak.tsxnew file mode 100644index 0000000000..eff03a0ed4--- /dev/null+++ b/packages/light-leaks/src/LightLeak.tsx@@ -0,0 +1,15 @@+import React from 'react';+import type {SequenceProps} from 'remotion';+import {Sequence} from 'remotion';++export type LightLeakProps = Omit<SequenceProps, 'children'> & {+ children: React.ReactNode;+};++/*+ * @description Renders a light leak effect as a Sequence.+ * @see [Documentation](https://www.remotion.dev/docs/light-leaks/light-leak)+ */+export const LightLeak: React.FC<LightLeakProps> = ({children, ...props}) => {+ return <Sequence {...props}>{children}</Sequence>;+};diff --git a/packages/light-leaks/src/index.ts b/packages/light-leaks/src/index.tsnew file mode 100644index 0000000000..c0831fc374--- /dev/null+++ b/packages/light-leaks/src/index.ts@@ -0,0 +1,2 @@+export {LightLeak} from './LightLeak';+export type {LightLeakProps} from './LightLeak';diff --git a/packages/light-leaks/tsconfig.json b/packages/light-leaks/tsconfig.jsonnew file mode 100644index 0000000000..fe046539de--- /dev/null+++ b/packages/light-leaks/tsconfig.json@@ -0,0 +1,14 @@+{+ "extends": "../tsconfig.settings.json",+ "compilerOptions": {+ "rootDir": "src",+ "outDir": "dist/cjs",+ "skipLibCheck": true+ },+ "include": ["src"],+ "references": [+ {+ "path": "../core"+ }+ ]+}diff --git a/packages/studio-shared/src/package-info.ts b/packages/studio-shared/src/package-info.tsindex 1d1bab9c74..cbcff84e5d 100644--- a/packages/studio-shared/src/package-info.ts+++ b/packages/studio-shared/src/package-info.ts@@ -82,6 +82,7 @@ export const packages = ['media','web-renderer','design',+ 'light-leaks',] as const;export type Pkgs = (typeof packages)[number];@@ -197,6 +198,7 @@ export const descriptions: {[key in Pkgs]: string | null} = {media: 'Experimental WebCodecs-based media tags','web-renderer': 'Render videos in the browser (not yet released)',design: 'Design system',+ 'light-leaks': 'Light leak effects for Remotion',};export const installableMap: {[key in Pkgs]: boolean} = {'svg-3d-engine': false,@@ -282,6 +284,7 @@ export const installableMap: {[key in Pkgs]: boolean} = {media: true,'web-renderer': false,design: false,+ 'light-leaks': true,};export const apiDocs: {[key in Pkgs]: string | null} = {@@ -371,4 +374,5 @@ export const apiDocs: {[key in Pkgs]: string | null} = {media: 'https://remotion.dev/docs/media','web-renderer': 'https://www.remotion.dev/docs/web-renderer/',design: 'https://www.remotion.dev/design',+ 'light-leaks': 'https://www.remotion.dev/docs/light-leaks',};diff --git a/tsconfig.json b/tsconfig.jsonindex c5700c3665..3a00eda423 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -248,6 +248,9 @@},{"path": "./packages/rounded-text-box"+ },+ {+ "path": "./packages/light-leaks"}]}