Skip to content

🎥 Make videos programmatically with React

`@remotion/studio-protocol`: Rename the drag-and-drop package (#9877)

Igor Samokhovetse27c9ee03ce8
diff --git a/bun.lock b/bun.lock
index 44990a657b..e015023ba6 100644
--- a/bun.lock
+++ b/bun.lock
@@ -500,7 +500,6 @@
"@remotion/convert": "workspace:*",
"@remotion/design": "workspace:*",
"@remotion/docusaurus-plugin": "workspace:*",
- "@remotion/drag-and-drop": "workspace:*",
"@remotion/effects": "workspace:*",
"@remotion/elevenlabs": "workspace:*",
"@remotion/enable-scss": "workspace:*",
@@ -534,6 +533,7 @@
"@remotion/skia": "workspace:*",
"@remotion/starburst": "workspace:*",
"@remotion/studio": "workspace:*",
+ "@remotion/studio-protocol": "workspace:*",
"@remotion/studio-shared": "workspace:*",
"@remotion/svg-3d-engine": "workspace:*",
"@remotion/tailwind": "workspace:*",
@@ -617,15 +617,6 @@
"eslint": "catalog:",
},
},
- "packages/drag-and-drop": {
- "name": "@remotion/drag-and-drop",
- "version": "4.0.501",
- "devDependencies": {
- "@remotion/eslint-config-internal": "workspace:*",
- "@typescript/native-preview": "catalog:",
- "eslint": "catalog:",
- },
- },
"packages/effects": {
"name": "@remotion/effects",
"version": "4.0.501",
@@ -759,7 +750,6 @@
"@remotion/captions": "workspace:*",
"@remotion/cli": "workspace:*",
"@remotion/cloudrun": "workspace:*",
- "@remotion/drag-and-drop": "workspace:*",
"@remotion/effects": "workspace:*",
"@remotion/enable-scss": "workspace:*",
"@remotion/eslint-config-flat": "workspace:*",
@@ -789,6 +779,7 @@
"@remotion/skia": "workspace:*",
"@remotion/starburst": "workspace:*",
"@remotion/studio": "workspace:*",
+ "@remotion/studio-protocol": "workspace:*",
"@remotion/studio-shared": "workspace:*",
"@remotion/svg-3d-engine": "workspace:*",
"@remotion/tailwind-v4": "workspace:*",
@@ -1678,10 +1669,10 @@
"@jridgewell/trace-mapping": "0.3.31",
"@remotion/canvas-capture": "workspace:*",
"@remotion/captions": "workspace:*",
- "@remotion/drag-and-drop": "workspace:*",
"@remotion/media-utils": "workspace:*",
"@remotion/player": "workspace:*",
"@remotion/renderer": "workspace:*",
+ "@remotion/studio-protocol": "workspace:*",
"@remotion/studio-shared": "workspace:*",
"@remotion/timeline-utils": "workspace:*",
"@remotion/web-renderer": "workspace:*",
@@ -1723,6 +1714,15 @@
"eslint": "catalog:",
},
},
+ "packages/studio-protocol": {
+ "name": "@remotion/studio-protocol",
+ "version": "4.0.501",
+ "devDependencies": {
+ "@remotion/eslint-config-internal": "workspace:*",
+ "@typescript/native-preview": "catalog:",
+ "eslint": "catalog:",
+ },
+ },
"packages/studio-server": {
"name": "@remotion/studio-server",
"version": "4.0.501",
@@ -1730,9 +1730,9 @@
"@babel/parser": "7.24.1",
"@babel/types": "7.24.0",
"@remotion/bundler": "workspace:*",
- "@remotion/drag-and-drop": "workspace:*",
"@remotion/renderer": "workspace:*",
"@remotion/studio-codemods": "workspace:*",
+ "@remotion/studio-protocol": "workspace:*",
"@remotion/studio-shared": "workspace:*",
"@svgr/core": "8.1.0",
"@svgr/plugin-jsx": "8.1.0",
@@ -1758,7 +1758,7 @@
"name": "@remotion/studio-shared",
"version": "4.0.501",
"dependencies": {
- "@remotion/drag-and-drop": "workspace:*",
+ "@remotion/studio-protocol": "workspace:*",
"remotion": "workspace:*",
},
"devDependencies": {
@@ -4111,8 +4111,6 @@
"@remotion/docusaurus-plugin": ["@remotion/docusaurus-plugin@workspace:packages/docusaurus-plugin"],
- "@remotion/drag-and-drop": ["@remotion/drag-and-drop@workspace:packages/drag-and-drop"],
-
"@remotion/effects": ["@remotion/effects@workspace:packages/effects"],
"@remotion/elevenlabs": ["@remotion/elevenlabs@workspace:packages/elevenlabs"],
@@ -4227,6 +4225,8 @@
"@remotion/studio-codemods": ["@remotion/studio-codemods@workspace:packages/studio-codemods"],
+ "@remotion/studio-protocol": ["@remotion/studio-protocol@workspace:packages/studio-protocol"],
+
"@remotion/studio-server": ["@remotion/studio-server@workspace:packages/studio-server"],
"@remotion/studio-shared": ["@remotion/studio-shared@workspace:packages/studio-shared"],
diff --git a/packages/STATS.md b/packages/STATS.md
index 598f403475..e7b6082f52 100644
--- a/packages/STATS.md
+++ b/packages/STATS.md
@@ -20,7 +20,7 @@ Monthly downloads of Remotion packages
[![NPM Downloads](https://img.shields.io/npm/dm/remotion.svg?style=flat&color=black&label=remotion)](https://npmcharts.com/compare/remotion?minimal=true)
[![NPM Downloads](https://img.shields.io/npm/dm/create-video.svg?style=flat&color=black&label=create-video)](https://npmcharts.com/compare/create-video?minimal=true)
[![NPM Downloads](https://img.shields.io/npm/dm/@remotion/design.svg?style=flat&color=black&label=@remotion/design)](https://npmcharts.com/compare/@remotion/design?minimal=true)
-[![NPM Downloads](https://img.shields.io/npm/dm/@remotion/drag-and-drop.svg?style=flat&color=black&label=@remotion/drag-and-drop)](https://npmcharts.com/compare/@remotion/drag-and-drop?minimal=true)
+[![NPM Downloads](https://img.shields.io/npm/dm/@remotion/studio-protocol.svg?style=flat&color=black&label=@remotion/studio-protocol)](https://npmcharts.com/compare/@remotion/studio-protocol?minimal=true)<br />
[![NPM Downloads](https://img.shields.io/npm/dm/@remotion/effects.svg?style=flat&color=black&label=@remotion/effects)](https://npmcharts.com/compare/@remotion/effects?minimal=true)
[![NPM Downloads](https://img.shields.io/npm/dm/@remotion/elevenlabs.svg?style=flat&color=black&label=@remotion/elevenlabs)](https://npmcharts.com/compare/@remotion/elevenlabs?minimal=true)
[![NPM Downloads](https://img.shields.io/npm/dm/@remotion/enable-scss.svg?style=flat&color=black&label=@remotion/enable-scss)](https://npmcharts.com/compare/@remotion/enable-scss?minimal=true)
diff --git a/packages/cli/src/list-of-remotion-packages.ts b/packages/cli/src/list-of-remotion-packages.ts
index e2a2fd6b1e..c7a50fc9a1 100644
--- a/packages/cli/src/list-of-remotion-packages.ts
+++ b/packages/cli/src/list-of-remotion-packages.ts
@@ -95,7 +95,7 @@ export const listOfRemotionPackages = [
'@remotion/remotion-media',
'@remotion/web-renderer',
'@remotion/design',
- '@remotion/drag-and-drop',
+ '@remotion/studio-protocol',
'@remotion/light-leaks',
'@remotion/rough-notation',
'@remotion/starburst',
diff --git a/packages/create-video/src/list-of-remotion-packages.ts b/packages/create-video/src/list-of-remotion-packages.ts
index e2a2fd6b1e..c7a50fc9a1 100644
--- a/packages/create-video/src/list-of-remotion-packages.ts
+++ b/packages/create-video/src/list-of-remotion-packages.ts
@@ -95,7 +95,7 @@ export const listOfRemotionPackages = [
'@remotion/remotion-media',
'@remotion/web-renderer',
'@remotion/design',
- '@remotion/drag-and-drop',
+ '@remotion/studio-protocol',
'@remotion/light-leaks',
'@remotion/rough-notation',
'@remotion/starburst',
diff --git a/packages/docs/components/effects-demos/effect-drag-data.ts b/packages/docs/components/effects-demos/effect-drag-data.ts
index ea24568bed..0a9a9a16fa 100644
--- a/packages/docs/components/effects-demos/effect-drag-data.ts
+++ b/packages/docs/components/effects-demos/effect-drag-data.ts
@@ -1,7 +1,7 @@
import type {
ConstructedDragData,
EffectDragData,
-} from '@remotion/drag-and-drop';
+} from '@remotion/studio-protocol';
const FX_ICON_PATH =
'M4.405 4.48C4.575 3.82 4.865 3.325 5.275 2.995C5.695 2.665 6.25 2.5 6.94 2.5H9.235V4.06H7.045C6.555 4.06 6.235 4.3 6.085 4.78L5.83 5.68H7.975V7.255H5.395L3.805 13H2.02L3.625 7.255H1.96V5.68H4.075L4.405 4.48ZM8.57102 9.085L6.87602 5.68H8.79602L9.86102 7.99L11.991 5.68H14.331L10.686 9.415L12.426 13H10.491L9.35102 10.585L7.02602 13H4.68602L8.57102 9.085Z';
diff --git a/packages/docs/components/effects-demos/index.tsx b/packages/docs/components/effects-demos/index.tsx
index bbb91fa83a..f98efdab87 100644
--- a/packages/docs/components/effects-demos/index.tsx
+++ b/packages/docs/components/effects-demos/index.tsx
@@ -1,5 +1,5 @@
import {useColorMode} from '@docusaurus/theme-common';
-import {DragAndDropInternals} from '@remotion/drag-and-drop';
+import {StudioProtocolInternals} from '@remotion/studio-protocol';
import {Player} from '@remotion/player';
import React, {useCallback, useMemo, useState} from 'react';
import {AbsoluteFill} from 'remotion';
@@ -49,7 +49,7 @@ export const EffectsDemo: React.FC<{
}, [initialState]);
const dragData = useMemo(() => {
- return DragAndDropInternals.makeDragData({
+ return StudioProtocolInternals.makeDragData({
type: 'effect',
name: demo.effectName,
importPath: demo.effectImportPath,
diff --git a/packages/docs/components/sfx-demos/sfx-drag-data.ts b/packages/docs/components/sfx-demos/sfx-drag-data.ts
index f108001b3b..2aa85562c4 100644
--- a/packages/docs/components/sfx-demos/sfx-drag-data.ts
+++ b/packages/docs/components/sfx-demos/sfx-drag-data.ts
@@ -1,4 +1,4 @@
-import type {ConstructedDragData, SfxDragData} from '@remotion/drag-and-drop';
+import type {ConstructedDragData, SfxDragData} from '@remotion/studio-protocol';
export const getSfxNameFromUrl = (src: string): string => {
try {
diff --git a/packages/docs/components/shapes/shape-component-drag-data.ts b/packages/docs/components/shapes/shape-component-drag-data.ts
index a41871b966..46a02f484a 100644
--- a/packages/docs/components/shapes/shape-component-drag-data.ts
+++ b/packages/docs/components/shapes/shape-component-drag-data.ts
@@ -1,9 +1,9 @@
import {
- DragAndDropInternals,
+ StudioProtocolInternals,
type ComponentDragData,
type ComponentProp,
type ConstructedDragData,
-} from '@remotion/drag-and-drop';
+} from '@remotion/studio-protocol';
import {getShapeDragInfo} from './shape-drag-info';
import type {ShapeName} from './shapes-info';
@@ -164,7 +164,7 @@ const makeShapeComponentDragData = ({
} satisfies ComponentDragData['component'];
const shapeInfo = getShapeDragInfo(component);
- return DragAndDropInternals.makeDragData({
+ return StudioProtocolInternals.makeDragData({
type: 'component',
...component,
dimensions: shapeInfo
diff --git a/packages/docs/components/shapes/shape-drag-info.ts b/packages/docs/components/shapes/shape-drag-info.ts
index a02f14e73b..ee82efbaf1 100644
--- a/packages/docs/components/shapes/shape-drag-info.ts
+++ b/packages/docs/components/shapes/shape-drag-info.ts
@@ -1,4 +1,4 @@
-import type {ComponentDragData} from '@remotion/drag-and-drop';
+import type {ComponentDragData} from '@remotion/studio-protocol';
import {
makeArrow,
makeCallout,
diff --git a/packages/docs/components/shapes/shape-drag-preview.tsx b/packages/docs/components/shapes/shape-drag-preview.tsx
index f0d66fc2de..b06e7a9714 100644
--- a/packages/docs/components/shapes/shape-drag-preview.tsx
+++ b/packages/docs/components/shapes/shape-drag-preview.tsx
@@ -1,7 +1,7 @@
import type {
ComponentDragData,
ConstructedDragData,
-} from '@remotion/drag-and-drop';
+} from '@remotion/studio-protocol';
import React from 'react';
import {getShapeDragInfo} from './shape-drag-info';
diff --git a/packages/docs/docs/effects/table-of-contents.tsx b/packages/docs/docs/effects/table-of-contents.tsx
index 4521052d40..a453a0c097 100644
--- a/packages/docs/docs/effects/table-of-contents.tsx
+++ b/packages/docs/docs/effects/table-of-contents.tsx
@@ -1,4 +1,4 @@
-import {DragAndDropInternals} from '@remotion/drag-and-drop';
+import {StudioProtocolInternals} from '@remotion/studio-protocol';
import {
EFFECT_CATALOG,
getEffectCatalogCategories,
@@ -34,7 +34,7 @@ const previewImage: React.CSSProperties = {
const EffectCard: React.FC<{
readonly effect: EffectCatalogItem;
}> = ({effect}) => {
- const dragData = DragAndDropInternals.makeDragData({
+ const dragData = StudioProtocolInternals.makeDragData({
type: 'effect',
...effect.effect,
});
diff --git a/packages/docs/docs/sfx/PlayButton.tsx b/packages/docs/docs/sfx/PlayButton.tsx
index 8518c8fa81..fd9bc9bb94 100644
--- a/packages/docs/docs/sfx/PlayButton.tsx
+++ b/packages/docs/docs/sfx/PlayButton.tsx
@@ -1,5 +1,5 @@
import {Button} from '@remotion/design';
-import {DragAndDropInternals} from '@remotion/drag-and-drop';
+import {StudioProtocolInternals} from '@remotion/studio-protocol';
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
import {
getSfxNameFromUrl,
@@ -159,7 +159,7 @@ const setDragDataForSfx = ({
}) => {
setSfxDragData({
dataTransfer,
- dragData: DragAndDropInternals.makeDragData({
+ dragData: StudioProtocolInternals.makeDragData({
type: 'sfx',
name,
url: src,
diff --git a/packages/docs/package.json b/packages/docs/package.json
index b9f6e0033f..b5059db20f 100644
--- a/packages/docs/package.json
+++ b/packages/docs/package.json
@@ -23,7 +23,7 @@
"render-element-previews": "bun run render-element-previews.ts"
},
"dependencies": {
- "@remotion/drag-and-drop": "workspace:*",
+ "@remotion/studio-protocol": "workspace:*",
"@aws-sdk/s3-request-presigner": "catalog:",
"@babel/parser": "7.24.1",
"@babel/plugin-transform-modules-commonjs": "7.27.1",
diff --git a/packages/docs/src/components/Elements/ElementPage.tsx b/packages/docs/src/components/Elements/ElementPage.tsx
index b5ece36317..0c0598b788 100644
--- a/packages/docs/src/components/Elements/ElementPage.tsx
+++ b/packages/docs/src/components/Elements/ElementPage.tsx
@@ -1,7 +1,7 @@
import {
- DragAndDropInternals,
+ StudioProtocolInternals,
type ComponentDimensions,
-} from '@remotion/drag-and-drop';
+} from '@remotion/studio-protocol';
import React, {
useCallback,
useId,
@@ -70,7 +70,7 @@ export const ElementPage: React.FC<ElementPageProps> = ({
}
: null;
- return DragAndDropInternals.makeDragData({
+ return StudioProtocolInternals.makeDragData({
type: 'element',
dependencies,
dimensions,
@@ -95,7 +95,7 @@ export const ElementPage: React.FC<ElementPageProps> = ({
}
setInstallStatus({type: 'installing'});
- const result = await DragAndDropInternals.installInStudio(dragData);
+ const result = await StudioProtocolInternals.installInStudio(dragData);
if (!result.success) {
setInstallStatus({
type: 'error',
diff --git a/packages/docs/src/components/Elements/element-drag-data.ts b/packages/docs/src/components/Elements/element-drag-data.ts
index 00d4bf3256..cf1eb27359 100644
--- a/packages/docs/src/components/Elements/element-drag-data.ts
+++ b/packages/docs/src/components/Elements/element-drag-data.ts
@@ -1,4 +1,4 @@
-import type {ConstructedDragData} from '@remotion/drag-and-drop';
+import type {ConstructedDragData} from '@remotion/studio-protocol';
const ELEMENT_ICON_PATH =
'M3 3.5C3 2.67157 3.67157 2 4.5 2H11.5C12.3284 2 13 2.67157 13 3.5V12.5C13 13.3284 12.3284 14 11.5 14H4.5C3.67157 14 3 13.3284 3 12.5V3.5ZM4.5 3.5V6H11.5V3.5H4.5ZM11.5 7.5H4.5V12.5H11.5V7.5Z';
diff --git a/packages/docs/tsconfig.json b/packages/docs/tsconfig.json
index 9055bfb119..ceaa5ec2f8 100644
--- a/packages/docs/tsconfig.json
+++ b/packages/docs/tsconfig.json
@@ -25,7 +25,7 @@
"references": [
{"path": "../player"},
{"path": "../core"},
- {"path": "../drag-and-drop"},
+ {"path": "../studio-protocol"},
{"path": "../media-utils"},
{"path": "../browser-studio"},
{"path": "../docusaurus-plugin"},
diff --git a/packages/drag-and-drop/README.md b/packages/drag-and-drop/README.md
deleted file mode 100644
index bc39fa8f7d..0000000000
--- a/packages/drag-and-drop/README.md
+++ /dev/null
@@ -1,18 +0,0 @@
-# @remotion/drag-and-drop
-
-Construct and parse drag-and-drop payloads for Remotion
-
-[![NPM Downloads](https://img.shields.io/npm/dm/@remotion/drag-and-drop.svg?style=flat&color=black&label=Downloads)](https://npmcharts.com/compare/@remotion/drag-and-drop?minimal=true)
-
-## Installation
-
-```bash
-npm install @remotion/drag-and-drop --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/drag-and-drop) for more information.
diff --git a/packages/example/package.json b/packages/example/package.json
index e59990b608..ad7fa06c43 100644
--- a/packages/example/package.json
+++ b/packages/example/package.json
@@ -32,7 +32,7 @@
},
"dependencies": {
"@maptiler/sdk": "4.0.2",
- "@remotion/drag-and-drop": "workspace:*",
+ "@remotion/studio-protocol": "workspace:*",
"@mdx-js/loader": "2.3.0",
"@mdx-js/react": "2.3.0",
"@mediabunny/ac3": "catalog:",
diff --git a/packages/example/src/DragAndDrop/index.tsx b/packages/example/src/DragAndDrop/index.tsx
index 7e6f3532d1..febb50a4b9 100644
--- a/packages/example/src/DragAndDrop/index.tsx
+++ b/packages/example/src/DragAndDrop/index.tsx
@@ -1,23 +1,23 @@
-import {DragAndDropInternals} from '@remotion/drag-and-drop';
+import {StudioProtocolInternals} from '@remotion/studio-protocol';
import React from 'react';
import {AbsoluteFill} from 'remotion';
const payloads = [
- DragAndDropInternals.makeDragData({
+ StudioProtocolInternals.makeDragData({
type: 'asset',
assetPath: 'images/logo.png',
width: null,
height: null,
durationInSeconds: null,
}),
- DragAndDropInternals.makeDragData({
+ StudioProtocolInternals.makeDragData({
type: 'component',
componentName: 'Circle',
importName: 'Circle',
importPath: '@remotion/shapes',
props: [{name: 'radius', value: 100}],
}),
- DragAndDropInternals.makeDragData({
+ StudioProtocolInternals.makeDragData({
type: 'composition',
compositionId: 'MyVideo',
compositionFile: 'src/Root.tsx',
@@ -25,13 +25,13 @@ const payloads = [
height: null,
durationInFrames: null,
}),
- DragAndDropInternals.makeDragData({
+ StudioProtocolInternals.makeDragData({
type: 'effect',
name: 'brightness',
importPath: '@remotion/effects/brightness',
config: {brightness: 1.2},
}),
- DragAndDropInternals.makeDragData({
+ StudioProtocolInternals.makeDragData({
type: 'element',
dependencies: [],
slug: 'titles/lower-third',
@@ -40,7 +40,7 @@ const payloads = [
dimensions: {width: 900, height: 260},
durationInFrames: 90,
}),
- DragAndDropInternals.makeDragData({
+ StudioProtocolInternals.makeDragData({
type: 'sfx',
name: 'Whip',
url: 'https://remotion.media/whip.wav',
diff --git a/packages/example/tsconfig.json b/packages/example/tsconfig.json
index ff0f87e8f6..6e7b9079c6 100644
--- a/packages/example/tsconfig.json
+++ b/packages/example/tsconfig.json
@@ -42,7 +42,7 @@
{"path": "../media-parser"},
{"path": "../webcodecs"},
{"path": "../whisper-web"},
- {"path": "../drag-and-drop"},
+ {"path": "../studio-protocol"},
{"path": "../light-leaks"},
{"path": "../starburst"},
{"path": "../sfx"},
diff --git a/packages/drag-and-drop/.npmignore b/packages/studio-protocol/.npmignore
similarity index 100%
rename from packages/drag-and-drop/.npmignore
rename to packages/studio-protocol/.npmignore
diff --git a/packages/studio-protocol/README.md b/packages/studio-protocol/README.md
new file mode 100644
index 0000000000..bbb8f5d24b
--- /dev/null
+++ b/packages/studio-protocol/README.md
@@ -0,0 +1,18 @@
+# @remotion/studio-protocol
+
+Construct and parse drag-and-drop payloads for Remotion
+
+[![NPM Downloads](https://img.shields.io/npm/dm/@remotion/studio-protocol.svg?style=flat&color=black&label=Downloads)](https://npmcharts.com/compare/@remotion/studio-protocol?minimal=true)
+
+## Installation
+
+```bash
+npm install @remotion/studio-protocol --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/studio-protocol) for more information.
diff --git a/packages/drag-and-drop/bundle.ts b/packages/studio-protocol/bundle.ts
similarity index 100%
rename from packages/drag-and-drop/bundle.ts
rename to packages/studio-protocol/bundle.ts
diff --git a/packages/drag-and-drop/eslint.config.mjs b/packages/studio-protocol/eslint.config.mjs
similarity index 100%
rename from packages/drag-and-drop/eslint.config.mjs
rename to packages/studio-protocol/eslint.config.mjs
diff --git a/packages/drag-and-drop/package.json b/packages/studio-protocol/package.json
similarity index 90%
rename from packages/drag-and-drop/package.json
rename to packages/studio-protocol/package.json
index d17b6ac3ed..400c4b5481 100644
--- a/packages/drag-and-drop/package.json
+++ b/packages/studio-protocol/package.json
@@ -1,12 +1,12 @@
{
- "name": "@remotion/drag-and-drop",
+ "name": "@remotion/studio-protocol",
"version": "4.0.501",
"description": "Construct and parse drag-and-drop payloads for Remotion",
"main": "dist/index.cjs",
"types": "dist/index.d.ts",
"module": "dist/esm/index.mjs",
"repository": {
- "url": "https://github.com/remotion-dev/remotion/tree/main/packages/drag-and-drop"
+ "url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio-protocol"
},
"type": "module",
"scripts": {
@@ -44,5 +44,5 @@
"publishConfig": {
"access": "public"
},
- "homepage": "https://www.remotion.dev/docs/drag-and-drop"
+ "homepage": "https://www.remotion.dev/docs/studio-protocol"
}
diff --git a/packages/drag-and-drop/src/asset-drag-data.ts b/packages/studio-protocol/src/asset-drag-data.ts
similarity index 100%
rename from packages/drag-and-drop/src/asset-drag-data.ts
rename to packages/studio-protocol/src/asset-drag-data.ts
diff --git a/packages/drag-and-drop/src/component-drag-data.ts b/packages/studio-protocol/src/component-drag-data.ts
similarity index 100%
rename from packages/drag-and-drop/src/component-drag-data.ts
rename to packages/studio-protocol/src/component-drag-data.ts
diff --git a/packages/drag-and-drop/src/composition-drag-data.ts b/packages/studio-protocol/src/composition-drag-data.ts
similarity index 100%
rename from packages/drag-and-drop/src/composition-drag-data.ts
rename to packages/studio-protocol/src/composition-drag-data.ts
diff --git a/packages/drag-and-drop/src/drag-data.ts b/packages/studio-protocol/src/drag-data.ts
similarity index 100%
rename from packages/drag-and-drop/src/drag-data.ts
rename to packages/studio-protocol/src/drag-data.ts
diff --git a/packages/drag-and-drop/src/drag-preview-metadata.ts b/packages/studio-protocol/src/drag-preview-metadata.ts
similarity index 100%
rename from packages/drag-and-drop/src/drag-preview-metadata.ts
rename to packages/studio-protocol/src/drag-preview-metadata.ts
diff --git a/packages/drag-and-drop/src/effect-drag-data.ts b/packages/studio-protocol/src/effect-drag-data.ts
similarity index 100%
rename from packages/drag-and-drop/src/effect-drag-data.ts
rename to packages/studio-protocol/src/effect-drag-data.ts
diff --git a/packages/drag-and-drop/src/element-drag-data.ts b/packages/studio-protocol/src/element-drag-data.ts
similarity index 100%
rename from packages/drag-and-drop/src/element-drag-data.ts
rename to packages/studio-protocol/src/element-drag-data.ts
diff --git a/packages/drag-and-drop/src/index.ts b/packages/studio-protocol/src/index.ts
similarity index 97%
rename from packages/drag-and-drop/src/index.ts
rename to packages/studio-protocol/src/index.ts
index f3a493405e..73ab29679e 100644
--- a/packages/drag-and-drop/src/index.ts
+++ b/packages/studio-protocol/src/index.ts
@@ -50,7 +50,7 @@ export type {
StudioInstallTarget,
} from './install-in-studio';
-export const DragAndDropInternals = {
+export const StudioProtocolInternals = {
areComponentProps,
getDragPreviewMetadata,
getElementComponentNameFromSourceCode,
diff --git a/packages/drag-and-drop/src/install-in-studio.ts b/packages/studio-protocol/src/install-in-studio.ts
similarity index 100%
rename from packages/drag-and-drop/src/install-in-studio.ts
rename to packages/studio-protocol/src/install-in-studio.ts
diff --git a/packages/drag-and-drop/src/sfx-drag-data.ts b/packages/studio-protocol/src/sfx-drag-data.ts
similarity index 100%
rename from packages/drag-and-drop/src/sfx-drag-data.ts
rename to packages/studio-protocol/src/sfx-drag-data.ts
diff --git a/packages/drag-and-drop/src/test/drag-data.test.ts b/packages/studio-protocol/src/test/drag-data.test.ts
similarity index 82%
rename from packages/drag-and-drop/src/test/drag-data.test.ts
rename to packages/studio-protocol/src/test/drag-data.test.ts
index 1a7c988aa6..0587fbef03 100644
--- a/packages/drag-and-drop/src/test/drag-data.test.ts
+++ b/packages/studio-protocol/src/test/drag-data.test.ts
@@ -1,6 +1,6 @@
import {expect, test} from 'bun:test';
import {
- DragAndDropInternals,
+ StudioProtocolInternals,
type MakeCompositionDragDataInput,
type MakeDragDataInput,
type MakeElementDragDataInput,
@@ -55,8 +55,8 @@ const inputs: MakeDragDataInput[] = [
test('constructs and parses all drag data families', () => {
for (const input of inputs) {
- const constructed = DragAndDropInternals.makeDragData(input);
- const parsed = DragAndDropInternals.parseDragData(constructed);
+ const constructed = StudioProtocolInternals.makeDragData(input);
+ const parsed = StudioProtocolInternals.parseDragData(constructed);
expect(parsed?.type).toBe(input.type);
expect(constructed.mimeType).toStartWith(
@@ -67,7 +67,7 @@ test('constructs and parses all drag data families', () => {
});
test('puts preview metadata in the same MIME type as the payload', () => {
- const constructed = DragAndDropInternals.makeDragData({
+ const constructed = StudioProtocolInternals.makeDragData({
type: 'composition',
compositionFile: 'src/Root.tsx',
compositionId: 'MyVideo',
@@ -80,7 +80,7 @@ test('puts preview metadata in the same MIME type as the payload', () => {
'application/vnd.remotion.drag+json;v=1;type=composition;width=1920;height=1080;duration=150',
);
expect(
- DragAndDropInternals.getDragPreviewMetadata([
+ StudioProtocolInternals.getDragPreviewMetadata([
'text/plain',
constructed.mimeType,
]),
@@ -91,7 +91,7 @@ test('puts preview metadata in the same MIME type as the payload', () => {
height: 1080,
durationInFrames: 150,
});
- expect(DragAndDropInternals.parseDragData(constructed)).toEqual({
+ expect(StudioProtocolInternals.parseDragData(constructed)).toEqual({
type: 'composition',
data: {
type: 'remotion-composition',
@@ -109,7 +109,7 @@ test('puts preview metadata in the same MIME type as the payload', () => {
});
test('accepts explicit null composition metadata', () => {
- const constructed = DragAndDropInternals.makeDragData({
+ const constructed = StudioProtocolInternals.makeDragData({
type: 'composition',
compositionFile: null,
compositionId: 'UnresolvedVideo',
@@ -121,18 +121,18 @@ test('accepts explicit null composition metadata', () => {
expect(constructed.mimeType).toBe(
'application/vnd.remotion.drag+json;v=1;type=composition',
);
- expect(DragAndDropInternals.parseDragData(constructed)?.preview).toEqual({
+ expect(StudioProtocolInternals.parseDragData(constructed)?.preview).toEqual({
type: 'composition',
});
expect(() =>
- DragAndDropInternals.makeDragData({
+ StudioProtocolInternals.makeDragData({
type: 'composition',
compositionFile: null,
compositionId: 'MissingMetadata',
} as MakeCompositionDragDataInput),
).toThrow('must be set to a value or null');
expect(() =>
- DragAndDropInternals.makeDragData({
+ StudioProtocolInternals.makeDragData({
type: 'composition',
compositionFile: null,
compositionId: 'PartiallyResolvedDimensions',
@@ -144,7 +144,7 @@ test('accepts explicit null composition metadata', () => {
});
test('requires asset metadata and accepts explicit null values', () => {
- const constructed = DragAndDropInternals.makeDragData({
+ const constructed = StudioProtocolInternals.makeDragData({
type: 'asset',
assetPath: 'unresolved.png',
width: null,
@@ -155,17 +155,17 @@ test('requires asset metadata and accepts explicit null values', () => {
expect(constructed.mimeType).toBe(
'application/vnd.remotion.drag+json;v=1;type=asset',
);
- expect(DragAndDropInternals.parseDragData(constructed)?.preview).toEqual({
+ expect(StudioProtocolInternals.parseDragData(constructed)?.preview).toEqual({
type: 'asset',
});
expect(() =>
- DragAndDropInternals.makeDragData({
+ StudioProtocolInternals.makeDragData({
type: 'asset',
assetPath: 'missing-metadata.png',
} as MakeAssetDragDataInput),
).toThrow('must be set to a value or null');
expect(() =>
- DragAndDropInternals.makeDragData({
+ StudioProtocolInternals.makeDragData({
type: 'asset',
assetPath: 'partially-resolved.png',
width: 1920,
@@ -176,7 +176,7 @@ test('requires asset metadata and accepts explicit null values', () => {
});
test('requires a duration for element drags', () => {
- const constructed = DragAndDropInternals.makeDragData({
+ const constructed = StudioProtocolInternals.makeDragData({
type: 'element',
dependencies: [],
slug: 'titles/lower-third',
@@ -188,13 +188,13 @@ test('requires a duration for element drags', () => {
expect(constructed.mimeType).toContain(';duration=90');
expect(
- DragAndDropInternals.parseDragData({
+ StudioProtocolInternals.parseDragData({
mimeType: 'application/vnd.remotion.drag+json;v=1;type=element',
payload: constructed.payload,
}),
).toBe(null);
expect(() =>
- DragAndDropInternals.makeDragData({
+ StudioProtocolInternals.makeDragData({
type: 'element',
dependencies: [],
slug: 'titles/lower-third',
@@ -207,7 +207,7 @@ test('requires a duration for element drags', () => {
test('rejects malformed and mismatched drag data', () => {
expect(
- DragAndDropInternals.parseDragData({
+ StudioProtocolInternals.parseDragData({
mimeType:
'application/vnd.remotion.drag+json;v=1;type=component;width=10;height=10',
payload: JSON.stringify({
@@ -233,9 +233,11 @@ test('rejects malformed and mismatched drag data', () => {
];
for (const mimeType of invalidMimeTypes) {
- expect(DragAndDropInternals.getDragPreviewMetadata([mimeType])).toBe(null);
- expect(DragAndDropInternals.parseDragData({mimeType, payload: '{}'})).toBe(
+ expect(StudioProtocolInternals.getDragPreviewMetadata([mimeType])).toBe(
null,
);
+ expect(
+ StudioProtocolInternals.parseDragData({mimeType, payload: '{}'}),
+ ).toBe(null);
}
});
diff --git a/packages/drag-and-drop/src/test/install-in-studio.test.ts b/packages/studio-protocol/src/test/install-in-studio.test.ts
similarity index 100%
rename from packages/drag-and-drop/src/test/install-in-studio.test.ts
rename to packages/studio-protocol/src/test/install-in-studio.test.ts
diff --git a/packages/drag-and-drop/src/validation.ts b/packages/studio-protocol/src/validation.ts
similarity index 100%
rename from packages/drag-and-drop/src/validation.ts
rename to packages/studio-protocol/src/validation.ts
diff --git a/packages/drag-and-drop/tsconfig.json b/packages/studio-protocol/tsconfig.json
similarity index 100%
rename from packages/drag-and-drop/tsconfig.json
rename to packages/studio-protocol/tsconfig.json
diff --git a/packages/studio-server/package.json b/packages/studio-server/package.json
index cb3cfae49f..28ad1c6ae0 100644
--- a/packages/studio-server/package.json
+++ b/packages/studio-server/package.json
@@ -23,7 +23,7 @@
"access": "public"
},
"dependencies": {
- "@remotion/drag-and-drop": "workspace:*",
+ "@remotion/studio-protocol": "workspace:*",
"@babel/types": "7.24.0",
"@babel/parser": "7.24.1",
"@svgr/core": "8.1.0",
diff --git a/packages/studio-server/src/helpers/resolve-composition-component.ts b/packages/studio-server/src/helpers/resolve-composition-component.ts
index c05e7c2f1f..8de59d8371 100644
--- a/packages/studio-server/src/helpers/resolve-composition-component.ts
+++ b/packages/studio-server/src/helpers/resolve-composition-component.ts
@@ -16,8 +16,8 @@ import type {
ObjectProperty,
VariableDeclaration,
} from '@babel/types';
-import type {ComponentProp} from '@remotion/drag-and-drop';
import {insertSolidIntoSource} from '@remotion/studio-codemods';
+import type {ComponentProp} from '@remotion/studio-protocol';
import {
isUrl,
type InsertableCompositionElement,
diff --git a/packages/studio-server/src/preview-server/routes/insert-element.ts b/packages/studio-server/src/preview-server/routes/insert-element.ts
index 56b442c223..510dd0629b 100644
--- a/packages/studio-server/src/preview-server/routes/insert-element.ts
+++ b/packages/studio-server/src/preview-server/routes/insert-element.ts
@@ -1,7 +1,7 @@
import {existsSync, readFileSync} from 'node:fs';
import path from 'node:path';
-import {DragAndDropInternals} from '@remotion/drag-and-drop';
import {RenderInternals} from '@remotion/renderer';
+import {StudioProtocolInternals} from '@remotion/studio-protocol';
import {
type InsertElementRequest,
type InsertElementResponse,
@@ -88,7 +88,9 @@ const validateDimensions = (
};
const validateElement = (element: InsertElementRequest['element']) => {
- if (DragAndDropInternals.makeElementFileNameFromSlug(element.slug) === null) {
+ if (
+ StudioProtocolInternals.makeElementFileNameFromSlug(element.slug) === null
+ ) {
throw new Error(
'Element slug must produce a safe lowercase .tsx file name',
);
@@ -103,7 +105,7 @@ const validateElement = (element: InsertElementRequest['element']) => {
}
if (
- DragAndDropInternals.getElementComponentNameFromSourceCode(
+ StudioProtocolInternals.getElementComponentNameFromSourceCode(
element.sourceCode,
) === null
) {
@@ -140,7 +142,7 @@ export const insertElementHandler: ApiHandler<
}
const componentName =
- DragAndDropInternals.getElementComponentNameFromSourceCode(
+ StudioProtocolInternals.getElementComponentNameFromSourceCode(
element.sourceCode,
);
if (componentName === null) {
@@ -166,7 +168,7 @@ export const insertElementHandler: ApiHandler<
}
const derivedElementFileName =
- DragAndDropInternals.makeElementFileNameFromSlug(element.slug);
+ StudioProtocolInternals.makeElementFileNameFromSlug(element.slug);
if (derivedElementFileName === null) {
throw new Error(
'Element slug must produce a safe lowercase .tsx file name',
diff --git a/packages/studio-server/src/preview-server/routes/insert-jsx-element.ts b/packages/studio-server/src/preview-server/routes/insert-jsx-element.ts
index 6e9c06f531..d30da18537 100644
--- a/packages/studio-server/src/preview-server/routes/insert-jsx-element.ts
+++ b/packages/studio-server/src/preview-server/routes/insert-jsx-element.ts
@@ -1,6 +1,6 @@
import path from 'node:path';
-import {DragAndDropInternals} from '@remotion/drag-and-drop';
import {RenderInternals} from '@remotion/renderer';
+import {StudioProtocolInternals} from '@remotion/studio-protocol';
import {
isUrl,
type InsertJsxElementRequest,
@@ -118,19 +118,19 @@ const validateElement = (
}
if (element.type === 'component') {
- if (!DragAndDropInternals.isComponentIdentifier(element.componentName)) {
+ if (!StudioProtocolInternals.isComponentIdentifier(element.componentName)) {
throw new Error('Unsupported component name');
}
- if (!DragAndDropInternals.isComponentIdentifier(element.importName)) {
+ if (!StudioProtocolInternals.isComponentIdentifier(element.importName)) {
throw new Error('Unsupported component import name');
}
- if (!DragAndDropInternals.isComponentImportPath(element.importPath)) {
+ if (!StudioProtocolInternals.isComponentImportPath(element.importPath)) {
throw new Error('Unsupported component import path');
}
- if (!DragAndDropInternals.areComponentProps(element.props)) {
+ if (!StudioProtocolInternals.areComponentProps(element.props)) {
throw new Error('Unsupported component props');
}
diff --git a/packages/studio-server/src/routes.ts b/packages/studio-server/src/routes.ts
index 3271937315..24d1934794 100644
--- a/packages/studio-server/src/routes.ts
+++ b/packages/studio-server/src/routes.ts
@@ -4,9 +4,9 @@ import type {IncomingMessage, ServerResponse} from 'node:http';
import path, {join} from 'node:path';
import {URLSearchParams} from 'node:url';
import {BundlerInternals} from '@remotion/bundler';
-import {DragAndDropInternals} from '@remotion/drag-and-drop';
import type {LogLevel} from '@remotion/renderer';
import {RenderInternals} from '@remotion/renderer';
+import {StudioProtocolInternals} from '@remotion/studio-protocol';
import type {
ApiRoutes,
ElementInstallRequest,
@@ -213,7 +213,7 @@ const handleRequestElementInstall = async ({
};
const parsed =
typeof mimeType === 'string' && typeof payload === 'string'
- ? DragAndDropInternals.parseDragData({mimeType, payload})
+ ? StudioProtocolInternals.parseDragData({mimeType, payload})
: null;
if (parsed?.type !== 'element') {
diff --git a/packages/studio-server/tsconfig.json b/packages/studio-server/tsconfig.json
index 0ecedd46b3..f7472e4339 100644
--- a/packages/studio-server/tsconfig.json
+++ b/packages/studio-server/tsconfig.json
@@ -16,7 +16,7 @@
"path": "../core"
},
{
- "path": "../drag-and-drop"
+ "path": "../studio-protocol"
},
{
"path": "../media-utils"
diff --git a/packages/studio-shared/package.json b/packages/studio-shared/package.json
index 16efe665cf..68a9e875dd 100644
--- a/packages/studio-shared/package.json
+++ b/packages/studio-shared/package.json
@@ -20,7 +20,7 @@
"url": "https://github.com/remotion-dev/remotion/issues"
},
"dependencies": {
- "@remotion/drag-and-drop": "workspace:*",
+ "@remotion/studio-protocol": "workspace:*",
"remotion": "workspace:*"
},
"devDependencies": {
diff --git a/packages/studio-shared/src/api-requests.ts b/packages/studio-shared/src/api-requests.ts
index 5bc2e4bce9..85bc630dfd 100644
--- a/packages/studio-shared/src/api-requests.ts
+++ b/packages/studio-shared/src/api-requests.ts
@@ -1,4 +1,3 @@
-import type {ComponentProp, ElementDragData} from '@remotion/drag-and-drop';
import type {
AudioCodec,
ChromeMode,
@@ -11,6 +10,7 @@ import type {
X264Preset,
} from '@remotion/renderer';
import type {HardwareAccelerationOption} from '@remotion/renderer/client';
+import type {ComponentProp, ElementDragData} from '@remotion/studio-protocol';
import type {
_InternalTypes,
CannotUpdateSequenceReason,
diff --git a/packages/studio-shared/src/composition-drag-data.ts b/packages/studio-shared/src/composition-drag-data.ts
index bdaa2e32dd..b66c259054 100644
--- a/packages/studio-shared/src/composition-drag-data.ts
+++ b/packages/studio-shared/src/composition-drag-data.ts
@@ -1,4 +1,4 @@
-import type {CompositionDragData} from '@remotion/drag-and-drop';
+import type {CompositionDragData} from '@remotion/studio-protocol';
import type {SymbolicatedStackFrame} from './stack-types';
export const compositionDragDataToSymbolicatedStack = (
diff --git a/packages/studio-shared/src/effect-catalog.ts b/packages/studio-shared/src/effect-catalog.ts
index a443ed4bb1..040d85fd00 100644
--- a/packages/studio-shared/src/effect-catalog.ts
+++ b/packages/studio-shared/src/effect-catalog.ts
@@ -1,4 +1,4 @@
-import type {EffectDragData} from '@remotion/drag-and-drop';
+import type {EffectDragData} from '@remotion/studio-protocol';
export type EffectCatalogItem = {
readonly id: string;
diff --git a/packages/studio-shared/src/package-info.ts b/packages/studio-shared/src/package-info.ts
index fd5ad45d82..569099fc29 100644
--- a/packages/studio-shared/src/package-info.ts
+++ b/packages/studio-shared/src/package-info.ts
@@ -97,7 +97,7 @@ const allPackages = [
'remotion-media',
'web-renderer',
'design',
- 'drag-and-drop',
+ 'studio-protocol',
'light-leaks',
'rough-notation',
'starburst',
@@ -249,7 +249,7 @@ export const descriptions: {[key in Pkgs]: string | null} = {
'remotion-media': null,
'web-renderer': 'Render videos in the browser',
design: 'Design system',
- 'drag-and-drop': 'Construct and parse drag-and-drop payloads for Remotion',
+ 'studio-protocol': 'Construct and parse drag-and-drop payloads for Remotion',
'light-leaks': 'Light leak effects for Remotion',
'rough-notation': 'Rough annotation primitives for Remotion',
'player-a11y': 'Internal accessibility wrapper around @remotion/player',
@@ -360,7 +360,7 @@ export const installableMap: {[key in Pkgs]: boolean} = {
'remotion-media': false,
'web-renderer': false,
design: false,
- 'drag-and-drop': true,
+ 'studio-protocol': true,
'light-leaks': shouldReleasePackage({
packageName: '@remotion/light-leaks',
releaseVersion: VERSION,
@@ -474,7 +474,7 @@ 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',
- 'drag-and-drop': 'https://www.remotion.dev/docs/drag-and-drop',
+ 'studio-protocol': 'https://www.remotion.dev/docs/studio-protocol',
'light-leaks': 'https://www.remotion.dev/docs/light-leaks',
'rough-notation': 'https://www.remotion.dev/docs/rough-notation',
starburst: 'https://www.remotion.dev/docs/starburst',
diff --git a/packages/studio-shared/src/test/asset-drag-data.test.ts b/packages/studio-shared/src/test/asset-drag-data.test.ts
index b0ab8a137c..2255b9f337 100644
--- a/packages/studio-shared/src/test/asset-drag-data.test.ts
+++ b/packages/studio-shared/src/test/asset-drag-data.test.ts
@@ -1,7 +1,7 @@
import {expect, test} from 'bun:test';
-import {DragAndDropInternals} from '@remotion/drag-and-drop';
+import {StudioProtocolInternals} from '@remotion/studio-protocol';
-const assetMimeType = DragAndDropInternals.makeDragData({
+const assetMimeType = StudioProtocolInternals.makeDragData({
type: 'asset',
assetPath: 'asset',
width: null,
@@ -9,7 +9,7 @@ const assetMimeType = DragAndDropInternals.makeDragData({
durationInSeconds: null,
}).mimeType;
const makeAssetDragData = (assetPath: string) =>
- DragAndDropInternals.makeDragData({
+ StudioProtocolInternals.makeDragData({
type: 'asset',
assetPath,
width: null,
@@ -17,7 +17,7 @@ const makeAssetDragData = (assetPath: string) =>
durationInSeconds: null,
}).data;
const parseAssetDragData = (payload: string) => {
- const parsed = DragAndDropInternals.parseDragData({
+ const parsed = StudioProtocolInternals.parseDragData({
mimeType: assetMimeType,
payload,
});
diff --git a/packages/studio-shared/src/test/component-drag-data.test.ts b/packages/studio-shared/src/test/component-drag-data.test.ts
index e0a3a6d7fe..c4e24746ea 100644
--- a/packages/studio-shared/src/test/component-drag-data.test.ts
+++ b/packages/studio-shared/src/test/component-drag-data.test.ts
@@ -1,12 +1,12 @@
import {expect, test} from 'bun:test';
import {
- DragAndDropInternals,
+ StudioProtocolInternals,
type MakeComponentDragDataInput,
-} from '@remotion/drag-and-drop';
+} from '@remotion/studio-protocol';
const makeComponentDragData = (
input: Omit<MakeComponentDragDataInput, 'type'>,
-) => DragAndDropInternals.makeDragData({type: 'component', ...input}).data;
+) => StudioProtocolInternals.makeDragData({type: 'component', ...input}).data;
const parseComponentDragData = (payload: string) => {
let dimensions: MakeComponentDragDataInput['dimensions'];
try {
@@ -23,7 +23,7 @@ const parseComponentDragData = (payload: string) => {
// The unified parser handles the malformed payload below.
}
- const {mimeType} = DragAndDropInternals.makeDragData({
+ const {mimeType} = StudioProtocolInternals.makeDragData({
type: 'component',
componentName: 'Test',
dimensions,
@@ -31,7 +31,7 @@ const parseComponentDragData = (payload: string) => {
importPath: 'test',
props: [],
});
- const parsed = DragAndDropInternals.parseDragData({mimeType, payload});
+ const parsed = StudioProtocolInternals.parseDragData({mimeType, payload});
return parsed?.type === 'component' ? parsed.data : null;
};
diff --git a/packages/studio-shared/src/test/composition-drag-data.test.ts b/packages/studio-shared/src/test/composition-drag-data.test.ts
index f2fd7dcaef..36fd07c441 100644
--- a/packages/studio-shared/src/test/composition-drag-data.test.ts
+++ b/packages/studio-shared/src/test/composition-drag-data.test.ts
@@ -1,8 +1,8 @@
import {expect, test} from 'bun:test';
-import {DragAndDropInternals} from '@remotion/drag-and-drop';
+import {StudioProtocolInternals} from '@remotion/studio-protocol';
import {compositionDragDataToSymbolicatedStack} from '../composition-drag-data';
-const compositionMimeType = DragAndDropInternals.makeDragData({
+const compositionMimeType = StudioProtocolInternals.makeDragData({
type: 'composition',
compositionFile: null,
compositionId: 'Test',
@@ -17,7 +17,7 @@ const makeCompositionDragData = ({
compositionFile: string | null;
compositionId: string;
}) =>
- DragAndDropInternals.makeDragData({
+ StudioProtocolInternals.makeDragData({
type: 'composition',
compositionFile,
compositionId,
@@ -26,7 +26,7 @@ const makeCompositionDragData = ({
durationInFrames: null,
}).data;
const parseCompositionDragData = (payload: string) => {
- const parsed = DragAndDropInternals.parseDragData({
+ const parsed = StudioProtocolInternals.parseDragData({
mimeType: compositionMimeType,
payload,
});
diff --git a/packages/studio-shared/src/test/element-drag-data.test.ts b/packages/studio-shared/src/test/element-drag-data.test.ts
index 74e1cb610a..1167929c58 100644
--- a/packages/studio-shared/src/test/element-drag-data.test.ts
+++ b/packages/studio-shared/src/test/element-drag-data.test.ts
@@ -1,5 +1,5 @@
import {expect, test} from 'bun:test';
-import {DragAndDropInternals} from '@remotion/drag-and-drop';
+import {StudioProtocolInternals} from '@remotion/studio-protocol';
const validElement = {
dependencies: ['@remotion/google-fonts'],
@@ -19,7 +19,7 @@ const makeElementDragData = (
dimensions: null;
},
) =>
- DragAndDropInternals.makeDragData({
+ StudioProtocolInternals.makeDragData({
type: 'element',
...element,
durationInFrames: 120,
@@ -40,13 +40,13 @@ const parseElementDragData = (payload: string) => {
// The unified parser handles the malformed payload below.
}
- const {mimeType} = DragAndDropInternals.makeDragData({
+ const {mimeType} = StudioProtocolInternals.makeDragData({
type: 'element',
...validElement,
dimensions,
durationInFrames: 120,
});
- const parsed = DragAndDropInternals.parseDragData({mimeType, payload});
+ const parsed = StudioProtocolInternals.parseDragData({mimeType, payload});
return parsed?.type === 'element' ? parsed.data : null;
};
@@ -93,13 +93,15 @@ test('accepts element drag data with null dimensions', () => {
test('derives element file name from slug', () => {
expect(
- DragAndDropInternals.makeElementFileNameFromSlug('overlays/lower-third'),
+ StudioProtocolInternals.makeElementFileNameFromSlug('overlays/lower-third'),
).toBe('lower-third.element.tsx');
- expect(DragAndDropInternals.makeElementFileNameFromSlug('LowerThird')).toBe(
- null,
- );
expect(
- DragAndDropInternals.makeElementFileNameFromSlug('overlays/../lower-third'),
+ StudioProtocolInternals.makeElementFileNameFromSlug('LowerThird'),
+ ).toBe(null);
+ expect(
+ StudioProtocolInternals.makeElementFileNameFromSlug(
+ 'overlays/../lower-third',
+ ),
).toBe(null);
});
diff --git a/packages/studio-shared/src/test/sfx-drag-data.test.ts b/packages/studio-shared/src/test/sfx-drag-data.test.ts
index 5e1f3ab36a..85fb70285c 100644
--- a/packages/studio-shared/src/test/sfx-drag-data.test.ts
+++ b/packages/studio-shared/src/test/sfx-drag-data.test.ts
@@ -1,14 +1,17 @@
import {expect, test} from 'bun:test';
-import {DragAndDropInternals, type SfxDragData} from '@remotion/drag-and-drop';
+import {
+ StudioProtocolInternals,
+ type SfxDragData,
+} from '@remotion/studio-protocol';
import {isUrl} from '../url';
-const sfxMimeType = DragAndDropInternals.makeDragData({
+const sfxMimeType = StudioProtocolInternals.makeDragData({
type: 'sfx',
name: 'Test',
url: 'https://remotion.media/test.wav',
}).mimeType;
const parseSfxDragData = (payload: string) => {
- const parsed = DragAndDropInternals.parseDragData({
+ const parsed = StudioProtocolInternals.parseDragData({
mimeType: sfxMimeType,
payload,
});
diff --git a/packages/studio-shared/tsconfig.json b/packages/studio-shared/tsconfig.json
index f17fb8c42a..1fe83c1c7b 100644
--- a/packages/studio-shared/tsconfig.json
+++ b/packages/studio-shared/tsconfig.json
@@ -9,7 +9,7 @@
"include": ["src"],
"references": [
{
- "path": "../drag-and-drop"
+ "path": "../studio-protocol"
},
{
"path": "../renderer"
diff --git a/packages/studio/package.json b/packages/studio/package.json
index 48b74a6044..cdae7c0d80 100644
--- a/packages/studio/package.json
+++ b/packages/studio/package.json
@@ -24,7 +24,7 @@
"react-dom": ">=16.8.0"
},
"dependencies": {
- "@remotion/drag-and-drop": "workspace:*",
+ "@remotion/studio-protocol": "workspace:*",
"semver": "7.5.3",
"remotion": "workspace:*",
"@remotion/canvas-capture": "workspace:*",
diff --git a/packages/studio/src/components/AssetSelectorItem.tsx b/packages/studio/src/components/AssetSelectorItem.tsx
index cc7babd70b..3850ca0fc1 100644
--- a/packages/studio/src/components/AssetSelectorItem.tsx
+++ b/packages/studio/src/components/AssetSelectorItem.tsx
@@ -1,4 +1,4 @@
-import {DragAndDropInternals} from '@remotion/drag-and-drop';
+import {StudioProtocolInternals} from '@remotion/studio-protocol';
import React, {
useCallback,
useContext,
@@ -505,7 +505,7 @@ const AssetSelectorItem: React.FC<{
? mediaMetadata.duration
: null;
- const dragData = DragAndDropInternals.makeDragData({
+ const dragData = StudioProtocolInternals.makeDragData({
type: 'asset',
assetPath: relativePath,
width: hasDimensions ? width : null,
diff --git a/packages/studio/src/components/Canvas.tsx b/packages/studio/src/components/Canvas.tsx
index 6736259f32..d6ef653d3f 100644
--- a/packages/studio/src/components/Canvas.tsx
+++ b/packages/studio/src/components/Canvas.tsx
@@ -1,5 +1,5 @@
-import {DragAndDropInternals} from '@remotion/drag-and-drop';
import type {Size} from '@remotion/player';
+import {StudioProtocolInternals} from '@remotion/studio-protocol';
import type {ElementInstallRequest} from '@remotion/studio-shared';
import React, {
useCallback,
@@ -989,7 +989,7 @@ export const Canvas: React.FC<{
return;
}
- const metadata = DragAndDropInternals.getDragPreviewMetadata(
+ const metadata = StudioProtocolInternals.getDragPreviewMetadata(
event.dataTransfer?.types ?? [],
);
if (
@@ -1126,7 +1126,7 @@ export const Canvas: React.FC<{
setIsAddingAsset(true);
try {
- const metadata = DragAndDropInternals.getDragPreviewMetadata(
+ const metadata = StudioProtocolInternals.getDragPreviewMetadata(
event.dataTransfer?.types ?? [],
);
const isComposition = metadata?.type === 'composition';
diff --git a/packages/studio/src/components/CompositionSelector.tsx b/packages/studio/src/components/CompositionSelector.tsx
index f5886373f2..fc616affbd 100644
--- a/packages/studio/src/components/CompositionSelector.tsx
+++ b/packages/studio/src/components/CompositionSelector.tsx
@@ -1,4 +1,4 @@
-import {DragAndDropInternals} from '@remotion/drag-and-drop';
+import {StudioProtocolInternals} from '@remotion/studio-protocol';
import {compositionDragDataToSymbolicatedStack} from '@remotion/studio-shared';
import React, {
useCallback,
@@ -230,7 +230,7 @@ export const CompositionSelector: React.FC = () => {
(event: React.DragEvent<HTMLElement>) => {
if (
window.remotion_isReadOnlyStudio ||
- DragAndDropInternals.getDragPreviewMetadata(event.dataTransfer.types)
+ StudioProtocolInternals.getDragPreviewMetadata(event.dataTransfer.types)
?.type !== 'composition'
) {
stopCompositionListAutoScroll();
@@ -257,7 +257,7 @@ export const CompositionSelector: React.FC = () => {
const onRootDragOver = useCallback((event: React.DragEvent<HTMLElement>) => {
if (
window.remotion_isReadOnlyStudio ||
- DragAndDropInternals.getDragPreviewMetadata(event.dataTransfer.types)
+ StudioProtocolInternals.getDragPreviewMetadata(event.dataTransfer.types)
?.type !== 'composition'
) {
return;
@@ -290,7 +290,7 @@ export const CompositionSelector: React.FC = () => {
return;
}
- const parsed = DragAndDropInternals.parseDragData(event.dataTransfer);
+ const parsed = StudioProtocolInternals.parseDragData(event.dataTransfer);
if (parsed?.type !== 'composition') {
return;
}
diff --git a/packages/studio/src/components/CompositionSelectorItem.tsx b/packages/studio/src/components/CompositionSelectorItem.tsx
index 2b33bf0d28..3b62ee2067 100644
--- a/packages/studio/src/components/CompositionSelectorItem.tsx
+++ b/packages/studio/src/components/CompositionSelectorItem.tsx
@@ -1,4 +1,4 @@
-import {DragAndDropInternals} from '@remotion/drag-and-drop';
+import {StudioProtocolInternals} from '@remotion/studio-protocol';
import {compositionDragDataToSymbolicatedStack} from '@remotion/studio-shared';
import type {DragEvent, KeyboardEvent, MouseEvent} from 'react';
import React, {
@@ -229,7 +229,7 @@ export const CompositionSelectorItem: React.FC<{
setIsDragging(true);
event.dataTransfer.effectAllowed = 'copyMove';
- const dragData = DragAndDropInternals.makeDragData({
+ const dragData = StudioProtocolInternals.makeDragData({
type: 'composition',
compositionFile: resolvedLocation?.source ?? null,
compositionId: item.composition.id,
@@ -250,7 +250,7 @@ export const CompositionSelectorItem: React.FC<{
if (
item.type !== 'folder' ||
window.remotion_isReadOnlyStudio ||
- DragAndDropInternals.getDragPreviewMetadata(event.dataTransfer.types)
+ StudioProtocolInternals.getDragPreviewMetadata(event.dataTransfer.types)
?.type !== 'composition'
) {
return;
@@ -274,7 +274,7 @@ export const CompositionSelectorItem: React.FC<{
if (
item.type !== 'folder' ||
window.remotion_isReadOnlyStudio ||
- DragAndDropInternals.getDragPreviewMetadata(event.dataTransfer.types)
+ StudioProtocolInternals.getDragPreviewMetadata(event.dataTransfer.types)
?.type !== 'composition'
) {
return;
@@ -294,7 +294,7 @@ export const CompositionSelectorItem: React.FC<{
return;
}
- const parsed = DragAndDropInternals.parseDragData(event.dataTransfer);
+ const parsed = StudioProtocolInternals.parseDragData(event.dataTransfer);
if (parsed?.type !== 'composition') {
return;
}
diff --git a/packages/studio/src/components/InspectorPanel/use-composition-actions.ts b/packages/studio/src/components/InspectorPanel/use-composition-actions.ts
index fce1b088c4..f9ea4f01ea 100644
--- a/packages/studio/src/components/InspectorPanel/use-composition-actions.ts
+++ b/packages/studio/src/components/InspectorPanel/use-composition-actions.ts
@@ -1,4 +1,4 @@
-import {DragAndDropInternals} from '@remotion/drag-and-drop';
+import {StudioProtocolInternals} from '@remotion/studio-protocol';
import type {InsertJsxElementRequest} from '@remotion/studio-shared';
import {useCallback, useContext, useMemo, useState} from 'react';
import {Internals, type _InternalTypes} from 'remotion';
@@ -226,7 +226,7 @@ export const useCompositionActions = () => {
resolvedLocation?.source ??
browserStudioOperations?.getCompositionFile(composition.id) ??
null;
- const compositionDragData = DragAndDropInternals.makeDragData({
+ const compositionDragData = StudioProtocolInternals.makeDragData({
type: 'composition',
compositionFile: selectedCompositionFile,
compositionId: composition.id,
diff --git a/packages/studio/src/components/drop-handler-data.ts b/packages/studio/src/components/drop-handler-data.ts
index 2d3698e673..6354c0d007 100644
--- a/packages/studio/src/components/drop-handler-data.ts
+++ b/packages/studio/src/components/drop-handler-data.ts
@@ -1,9 +1,9 @@
import {
- DragAndDropInternals,
+ StudioProtocolInternals,
type ComponentDragData,
type CompositionDragData,
type DragPreviewMetadata,
-} from '@remotion/drag-and-drop';
+} from '@remotion/studio-protocol';
import {hasRemoteAssetDragData} from '../helpers/remote-asset-drag';
export const isFileDragEvent = (event: DragEvent): boolean => {
@@ -15,8 +15,9 @@ const isRemotionDragEvent = (
type: DragPreviewMetadata['type'],
) => {
return (
- DragAndDropInternals.getDragPreviewMetadata(event.dataTransfer?.types ?? [])
- ?.type === type
+ StudioProtocolInternals.getDragPreviewMetadata(
+ event.dataTransfer?.types ?? [],
+ )?.type === type
);
};
@@ -66,7 +67,7 @@ export const isSupportedDropEvent = (event: DragEvent): boolean => {
export const getAssetDragPath = (event: DragEvent): string | null => {
const parsed = event.dataTransfer
- ? DragAndDropInternals.parseDragData(event.dataTransfer)
+ ? StudioProtocolInternals.parseDragData(event.dataTransfer)
: null;
return parsed?.type === 'asset' ? parsed.data.assetPath : null;
};
@@ -75,7 +76,7 @@ export const getCompositionDragData = (
event: DragEvent,
): CompositionDragData | null => {
const parsed = event.dataTransfer
- ? DragAndDropInternals.parseDragData(event.dataTransfer)
+ ? StudioProtocolInternals.parseDragData(event.dataTransfer)
: null;
return parsed?.type === 'composition' ? parsed.data : null;
};
@@ -84,14 +85,14 @@ export const getComponentDragData = (
event: DragEvent,
): ComponentDragData | null => {
const parsed = event.dataTransfer
- ? DragAndDropInternals.parseDragData(event.dataTransfer)
+ ? StudioProtocolInternals.parseDragData(event.dataTransfer)
: null;
return parsed?.type === 'component' ? parsed.data : null;
};
export const getSfxDragUrl = (event: DragEvent): string | null => {
const parsed = event.dataTransfer
- ? DragAndDropInternals.parseDragData(event.dataTransfer)
+ ? StudioProtocolInternals.parseDragData(event.dataTransfer)
: null;
return parsed?.type === 'sfx' ? parsed.data.sfx.url : null;
};
diff --git a/packages/studio/src/components/effect-drag-and-drop.ts b/packages/studio/src/components/effect-drag-and-drop.ts
index 58540f41a8..6895669d8e 100644
--- a/packages/studio/src/components/effect-drag-and-drop.ts
+++ b/packages/studio/src/components/effect-drag-and-drop.ts
@@ -1,7 +1,7 @@
import {
- DragAndDropInternals,
+ StudioProtocolInternals,
type EffectDragData,
-} from '@remotion/drag-and-drop';
+} from '@remotion/studio-protocol';
import {getRequiredPackageForEffectImportPath} from '@remotion/studio-shared';
import type {SequencePropsSubscriptionKey} from 'remotion';
import {installRequiredPackages} from '../helpers/install-required-package';
@@ -10,7 +10,7 @@ import {showNotification} from './Notifications/NotificationCenter';
export const hasEffectDragType = (dataTransfer: DataTransfer) => {
return (
- DragAndDropInternals.getDragPreviewMetadata(dataTransfer.types)?.type ===
+ StudioProtocolInternals.getDragPreviewMetadata(dataTransfer.types)?.type ===
'effect'
);
};
@@ -22,7 +22,7 @@ export const hasExplicitEffectDragType = (dataTransfer: DataTransfer) => {
export const getEffectDragData = (
dataTransfer: DataTransfer,
): EffectDragData | null => {
- const parsed = DragAndDropInternals.parseDragData(dataTransfer);
+ const parsed = StudioProtocolInternals.parseDragData(dataTransfer);
return parsed?.type === 'effect' ? parsed.data : null;
};
diff --git a/packages/studio/src/components/element-drag-and-drop.ts b/packages/studio/src/components/element-drag-and-drop.ts
index 901c2b0508..2f6539fcb7 100644
--- a/packages/studio/src/components/element-drag-and-drop.ts
+++ b/packages/studio/src/components/element-drag-and-drop.ts
@@ -1,11 +1,11 @@
import {
- DragAndDropInternals,
+ StudioProtocolInternals,
type ElementDragData,
-} from '@remotion/drag-and-drop';
+} from '@remotion/studio-protocol';
export const hasElementDragType = (dataTransfer: DataTransfer | null) => {
return (
- DragAndDropInternals.getDragPreviewMetadata(dataTransfer?.types ?? [])
+ StudioProtocolInternals.getDragPreviewMetadata(dataTransfer?.types ?? [])
?.type === 'element'
);
};
@@ -17,6 +17,6 @@ export const getElementDragData = (
return null;
}
- const parsed = DragAndDropInternals.parseDragData(dataTransfer);
+ const parsed = StudioProtocolInternals.parseDragData(dataTransfer);
return parsed?.type === 'element' ? parsed.data : null;
};
diff --git a/packages/studio/src/components/import-assets.ts b/packages/studio/src/components/import-assets.ts
index 01b1b83ac9..667634eef1 100644
--- a/packages/studio/src/components/import-assets.ts
+++ b/packages/studio/src/components/import-assets.ts
@@ -3,7 +3,7 @@ import {
type CompositionDragData,
type ComponentProp,
type ElementDragData,
-} from '@remotion/drag-and-drop';
+} from '@remotion/studio-protocol';
import {
detectFileType,
getRequiredPackageForInsertableElement,
diff --git a/packages/studio/src/test/effect-drag-and-drop.test.ts b/packages/studio/src/test/effect-drag-and-drop.test.ts
index 4a0bc70fab..65b6880303 100644
--- a/packages/studio/src/test/effect-drag-and-drop.test.ts
+++ b/packages/studio/src/test/effect-drag-and-drop.test.ts
@@ -1,15 +1,15 @@
import {expect, test} from 'bun:test';
import {
- DragAndDropInternals,
+ StudioProtocolInternals,
type MakeDragDataInput,
-} from '@remotion/drag-and-drop';
+} from '@remotion/studio-protocol';
import {
getEffectDragData,
hasEffectDragType,
} from '../components/effect-drag-and-drop';
const makeDataTransfer = (
- constructed: ReturnType<typeof DragAndDropInternals.makeDragData>,
+ constructed: ReturnType<typeof StudioProtocolInternals.makeDragData>,
): DataTransfer => {
return {
types: [constructed.mimeType],
@@ -19,7 +19,7 @@ const makeDataTransfer = (
};
test('detects and parses effect drags', () => {
- const effect = DragAndDropInternals.makeDragData({
+ const effect = StudioProtocolInternals.makeDragData({
type: 'effect',
name: 'Opacity',
importPath: '@remotion/effects',
@@ -70,7 +70,7 @@ for (const input of nonEffectInputs) {
test(`does not treat ${input.type} drags as effect drags`, () => {
expect(
hasEffectDragType(
- makeDataTransfer(DragAndDropInternals.makeDragData(input)),
+ makeDataTransfer(StudioProtocolInternals.makeDragData(input)),
),
).toBe(false);
});
diff --git a/packages/studio/tsconfig.json b/packages/studio/tsconfig.json
index 4172579da8..d2fea682db 100644
--- a/packages/studio/tsconfig.json
+++ b/packages/studio/tsconfig.json
@@ -19,7 +19,7 @@
"path": "../media-utils"
},
{
- "path": "../drag-and-drop"
+ "path": "../studio-protocol"
},
{
"path": "../studio-shared"
diff --git a/tsconfig.json b/tsconfig.json
index 39696e9574..f5a7951149 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -265,7 +265,7 @@
"path": "./packages/canvas-capture"
},
{
- "path": "./packages/drag-and-drop"
+ "path": "./packages/studio-protocol"
},
{
"path": "./packages/light-leaks"