@remotion/studio-shared 4.0.521 → 4.0.522

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,15 @@
1
- export declare const getDefinePluginDefinitions: ({ maxTimelineTracks, askAIEnabled, interactivityEnabled, keyboardShortcutsEnabled, bufferStateDelayInMilliseconds, }: {
1
+ export declare const getDefinePluginDefinitions: ({ maxTimelineTracks, askAIEnabled, interactivityEnabled, keyboardShortcutsEnabled, bufferStateDelayInMilliseconds, experimentalClientSideRenderingEnabled, }: {
2
2
  maxTimelineTracks: number | null;
3
3
  askAIEnabled: boolean;
4
4
  interactivityEnabled: boolean;
5
5
  keyboardShortcutsEnabled: boolean;
6
6
  bufferStateDelayInMilliseconds: number | null;
7
+ experimentalClientSideRenderingEnabled: boolean;
7
8
  }) => {
8
9
  'process.env.MAX_TIMELINE_TRACKS': number | null;
9
10
  'process.env.ASK_AI_ENABLED': boolean;
10
11
  'process.env.INTERACTIVITY_ENABLED': boolean;
11
12
  'process.env.KEYBOARD_SHORTCUTS_ENABLED': boolean;
12
13
  'process.env.BUFFER_STATE_DELAY_IN_MILLISECONDS': number | null;
14
+ 'process.env.EXPERIMENTAL_CLIENT_SIDE_RENDERING_ENABLED': boolean;
13
15
  };
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getDefinePluginDefinitions = void 0;
4
- const getDefinePluginDefinitions = ({ maxTimelineTracks, askAIEnabled, interactivityEnabled, keyboardShortcutsEnabled, bufferStateDelayInMilliseconds, }) => ({
4
+ const getDefinePluginDefinitions = ({ maxTimelineTracks, askAIEnabled, interactivityEnabled, keyboardShortcutsEnabled, bufferStateDelayInMilliseconds, experimentalClientSideRenderingEnabled, }) => ({
5
5
  'process.env.MAX_TIMELINE_TRACKS': maxTimelineTracks,
6
6
  'process.env.ASK_AI_ENABLED': askAIEnabled,
7
7
  'process.env.INTERACTIVITY_ENABLED': interactivityEnabled,
8
8
  'process.env.KEYBOARD_SHORTCUTS_ENABLED': keyboardShortcutsEnabled,
9
9
  'process.env.BUFFER_STATE_DELAY_IN_MILLISECONDS': bufferStateDelayInMilliseconds,
10
+ 'process.env.EXPERIMENTAL_CLIENT_SIDE_RENDERING_ENABLED': experimentalClientSideRenderingEnabled,
10
11
  });
11
12
  exports.getDefinePluginDefinitions = getDefinePluginDefinitions;
@@ -4,7 +4,6 @@ export type ElementDragData = {
4
4
  type: 'remotion-element';
5
5
  version: 1;
6
6
  element: {
7
- dependencies: string[];
8
7
  slug: string;
9
8
  displayName: string;
10
9
  sourceCode: string;
@@ -14,8 +13,7 @@ export type ElementDragData = {
14
13
  export declare const isLowercaseElementFileName: (value: unknown) => value is string;
15
14
  export declare const makeElementFileNameFromSlug: (slug: string) => string | null;
16
15
  export declare const getElementComponentNameFromSourceCode: (sourceCode: string) => string | null;
17
- export declare const makeElementDragData: ({ dependencies, dimensions, displayName, slug, sourceCode, }: {
18
- dependencies: string[];
16
+ export declare const makeElementDragData: ({ dimensions, displayName, slug, sourceCode, }: {
19
17
  slug: string;
20
18
  displayName: string;
21
19
  sourceCode: string;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseElementDragData = exports.makeElementDragData = exports.getElementComponentNameFromSourceCode = exports.makeElementFileNameFromSlug = exports.isLowercaseElementFileName = exports.ELEMENT_DRAG_MIME_TYPE = void 0;
4
4
  const component_drag_data_1 = require("./component-drag-data");
5
- const package_name_1 = require("./package-name");
6
5
  const drag_mime_types_1 = require("./drag-mime-types");
7
6
  Object.defineProperty(exports, "ELEMENT_DRAG_MIME_TYPE", { enumerable: true, get: function () { return drag_mime_types_1.ELEMENT_DRAG_MIME_TYPE; } });
8
7
  const isRecord = (value) => {
@@ -49,11 +48,6 @@ const isSourceCode = (value) => {
49
48
  value.trim().length > 0 &&
50
49
  value.length < 200000);
51
50
  };
52
- const isDependencies = (value) => {
53
- return (Array.isArray(value) &&
54
- value.length <= 100 &&
55
- value.every((dependency) => typeof dependency === 'string' && (0, package_name_1.isValidPackageName)(dependency)));
56
- };
57
51
  const isDimensions = (value) => {
58
52
  if (!isRecord(value)) {
59
53
  return false;
@@ -75,12 +69,11 @@ const getElementComponentNameFromSourceCode = (sourceCode) => {
75
69
  return (0, component_drag_data_1.isComponentIdentifier)(componentName) ? componentName : null;
76
70
  };
77
71
  exports.getElementComponentNameFromSourceCode = getElementComponentNameFromSourceCode;
78
- const makeElementDragData = ({ dependencies, dimensions, displayName, slug, sourceCode, }) => {
72
+ const makeElementDragData = ({ dimensions, displayName, slug, sourceCode, }) => {
79
73
  return {
80
74
  type: 'remotion-element',
81
75
  version: 1,
82
76
  element: {
83
- dependencies: Array.from(new Set(dependencies)),
84
77
  slug,
85
78
  displayName,
86
79
  sourceCode,
@@ -101,20 +94,18 @@ const parseElementDragData = (value) => {
101
94
  if (!isRecord(parsed.element)) {
102
95
  return null;
103
96
  }
104
- const { dependencies, dimensions, displayName, slug, sourceCode } = parsed.element;
97
+ const { dimensions, displayName, slug, sourceCode } = parsed.element;
105
98
  if (!isSlug(slug) ||
106
99
  !isDisplayName(displayName) ||
107
100
  !isSourceCode(sourceCode) ||
108
101
  (0, exports.getElementComponentNameFromSourceCode)(sourceCode) === null ||
109
102
  (0, exports.makeElementFileNameFromSlug)(slug) === null ||
110
- (dependencies !== undefined && !isDependencies(dependencies)) ||
111
103
  (dimensions !== undefined &&
112
104
  dimensions !== null &&
113
105
  !isDimensions(dimensions))) {
114
106
  return null;
115
107
  }
116
108
  return (0, exports.makeElementDragData)({
117
- dependencies: dependencies !== null && dependencies !== void 0 ? dependencies : [],
118
109
  slug,
119
110
  displayName,
120
111
  sourceCode,
@@ -0,0 +1,7 @@
1
+ import { type CanUpdateSequencePropsResponse, type SequenceSchema } from 'remotion';
2
+ export declare const optimisticUpdateForCodeValues: ({ previous, fieldKey, value, schema, }: {
3
+ previous: CanUpdateSequencePropsResponse;
4
+ fieldKey: string;
5
+ value: unknown;
6
+ schema: SequenceSchema;
7
+ }) => CanUpdateSequencePropsResponse;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.optimisticUpdateForCodeValues = void 0;
4
+ const no_react_1 = require("remotion/no-react");
5
+ const optimisticUpdateForCodeValues = ({ previous, fieldKey, value, schema, }) => {
6
+ var _a;
7
+ if (!previous.canUpdate) {
8
+ return previous;
9
+ }
10
+ const props = {
11
+ ...previous.props,
12
+ [fieldKey]: { status: 'static', codeValue: value },
13
+ };
14
+ if (((_a = schema[fieldKey]) === null || _a === void 0 ? void 0 : _a.type) === 'enum') {
15
+ const propsToDelete = no_react_1.NoReactInternals.findPropsToDelete({
16
+ schema,
17
+ key: fieldKey,
18
+ value,
19
+ });
20
+ for (const propToDelete of propsToDelete) {
21
+ delete props[propToDelete];
22
+ }
23
+ }
24
+ return {
25
+ canUpdate: true,
26
+ props,
27
+ effects: previous.effects,
28
+ };
29
+ };
30
+ exports.optimisticUpdateForCodeValues = optimisticUpdateForCodeValues;
@@ -0,0 +1,8 @@
1
+ import { type CanUpdateSequencePropsResponse, type SequenceSchema } from 'remotion';
2
+ export declare const optimisticUpdateForEffectCodeValues: ({ previous, effectIndex, fieldKey, value, schema, }: {
3
+ previous: CanUpdateSequencePropsResponse;
4
+ effectIndex: number;
5
+ fieldKey: string;
6
+ value: unknown;
7
+ schema: SequenceSchema;
8
+ }) => CanUpdateSequencePropsResponse;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.optimisticUpdateForEffectCodeValues = void 0;
4
+ const no_react_1 = require("remotion/no-react");
5
+ const optimisticUpdateForEffectCodeValues = ({ previous, effectIndex, fieldKey, value, schema, }) => {
6
+ var _a;
7
+ if (!previous.canUpdate) {
8
+ return previous;
9
+ }
10
+ const targetIndex = previous.effects.findIndex((e) => e.effectIndex === effectIndex);
11
+ if (targetIndex === -1) {
12
+ return previous;
13
+ }
14
+ const target = previous.effects[targetIndex];
15
+ if (!target.canUpdate) {
16
+ return previous;
17
+ }
18
+ const props = {
19
+ ...target.props,
20
+ [fieldKey]: { status: 'static', codeValue: value },
21
+ };
22
+ if (((_a = schema[fieldKey]) === null || _a === void 0 ? void 0 : _a.type) === 'enum') {
23
+ const propsToDelete = no_react_1.NoReactInternals.findPropsToDelete({
24
+ schema,
25
+ key: fieldKey,
26
+ value,
27
+ });
28
+ for (const propToDelete of propsToDelete) {
29
+ delete props[propToDelete];
30
+ }
31
+ }
32
+ const updatedEffect = {
33
+ ...target,
34
+ props,
35
+ };
36
+ const effects = [...previous.effects];
37
+ effects[targetIndex] = updatedEffect;
38
+ return {
39
+ ...previous,
40
+ effects,
41
+ };
42
+ };
43
+ exports.optimisticUpdateForEffectCodeValues = optimisticUpdateForEffectCodeValues;
@@ -0,0 +1,22 @@
1
+ export declare const SHAPE_DRAG_MIME_TYPE = "application/vnd.remotion.shape+json";
2
+ export declare const shapeNames: readonly ["Arrow", "Circle", "Ellipse", "Heart", "Pie", "Polygon", "Rect", "Star", "Triangle"];
3
+ export type ShapeName = (typeof shapeNames)[number];
4
+ export type ShapeAttribute = {
5
+ name: string;
6
+ value: string | number | boolean;
7
+ };
8
+ export type ShapeDragData = {
9
+ type: 'remotion-shape';
10
+ version: 1;
11
+ shape: ShapeName;
12
+ attributes: ShapeAttribute[];
13
+ };
14
+ export declare const isShapeName: (value: unknown) => value is "Arrow" | "Circle" | "Ellipse" | "Heart" | "Pie" | "Polygon" | "Rect" | "Star" | "Triangle";
15
+ export declare const isShapeAttributeName: (value: unknown) => value is string;
16
+ export declare const isShapeAttribute: (value: unknown) => value is ShapeAttribute;
17
+ export declare const areShapeAttributes: (value: unknown) => value is ShapeAttribute[];
18
+ export declare const makeShapeDragData: ({ attributes, shape, }: {
19
+ attributes: ShapeAttribute[];
20
+ shape: "Arrow" | "Circle" | "Ellipse" | "Heart" | "Pie" | "Polygon" | "Rect" | "Star" | "Triangle";
21
+ }) => ShapeDragData;
22
+ export declare const parseShapeDragData: (value: string) => ShapeDragData | null;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseShapeDragData = exports.makeShapeDragData = exports.areShapeAttributes = exports.isShapeAttribute = exports.isShapeAttributeName = exports.isShapeName = exports.shapeNames = exports.SHAPE_DRAG_MIME_TYPE = void 0;
4
+ exports.SHAPE_DRAG_MIME_TYPE = 'application/vnd.remotion.shape+json';
5
+ exports.shapeNames = [
6
+ 'Arrow',
7
+ 'Circle',
8
+ 'Ellipse',
9
+ 'Heart',
10
+ 'Pie',
11
+ 'Polygon',
12
+ 'Rect',
13
+ 'Star',
14
+ 'Triangle',
15
+ ];
16
+ const isRecord = (value) => {
17
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
18
+ };
19
+ const isShapeName = (value) => {
20
+ return typeof value === 'string' && exports.shapeNames.includes(value);
21
+ };
22
+ exports.isShapeName = isShapeName;
23
+ const isShapeAttributeName = (value) => {
24
+ return (typeof value === 'string' &&
25
+ value !== 'style' &&
26
+ /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value));
27
+ };
28
+ exports.isShapeAttributeName = isShapeAttributeName;
29
+ const isShapeAttribute = (value) => {
30
+ if (!isRecord(value)) {
31
+ return false;
32
+ }
33
+ if (!(0, exports.isShapeAttributeName)(value.name)) {
34
+ return false;
35
+ }
36
+ return (typeof value.value === 'string' ||
37
+ typeof value.value === 'boolean' ||
38
+ (typeof value.value === 'number' && Number.isFinite(value.value)));
39
+ };
40
+ exports.isShapeAttribute = isShapeAttribute;
41
+ const areShapeAttributes = (value) => {
42
+ if (!Array.isArray(value)) {
43
+ return false;
44
+ }
45
+ const seen = new Set();
46
+ for (const attribute of value) {
47
+ if (!(0, exports.isShapeAttribute)(attribute) || seen.has(attribute.name)) {
48
+ return false;
49
+ }
50
+ seen.add(attribute.name);
51
+ }
52
+ return true;
53
+ };
54
+ exports.areShapeAttributes = areShapeAttributes;
55
+ const makeShapeDragData = ({ attributes, shape, }) => {
56
+ return {
57
+ type: 'remotion-shape',
58
+ version: 1,
59
+ shape,
60
+ attributes,
61
+ };
62
+ };
63
+ exports.makeShapeDragData = makeShapeDragData;
64
+ const parseShapeDragData = (value) => {
65
+ try {
66
+ const parsed = JSON.parse(value);
67
+ if (!isRecord(parsed)) {
68
+ return null;
69
+ }
70
+ if (parsed.type !== 'remotion-shape' || parsed.version !== 1) {
71
+ return null;
72
+ }
73
+ if (!(0, exports.isShapeName)(parsed.shape)) {
74
+ return null;
75
+ }
76
+ if (!(0, exports.areShapeAttributes)(parsed.attributes)) {
77
+ return null;
78
+ }
79
+ return {
80
+ type: 'remotion-shape',
81
+ version: 1,
82
+ shape: parsed.shape,
83
+ attributes: parsed.attributes,
84
+ };
85
+ }
86
+ catch (_a) {
87
+ return null;
88
+ }
89
+ };
90
+ exports.parseShapeDragData = parseShapeDragData;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio-shared"
4
4
  },
5
5
  "name": "@remotion/studio-shared",
6
- "version": "4.0.521",
6
+ "version": "4.0.522",
7
7
  "description": "Internal package for shared objects between the Studio backend and frontend",
8
8
  "main": "dist",
9
9
  "module": "dist/esm/index.mjs",
@@ -21,11 +21,11 @@
21
21
  "url": "https://github.com/remotion-dev/remotion/issues"
22
22
  },
23
23
  "dependencies": {
24
- "remotion": "4.0.521"
24
+ "remotion": "4.0.522"
25
25
  },
26
26
  "devDependencies": {
27
- "@remotion/renderer": "4.0.521",
28
- "@remotion/eslint-config-internal": "4.0.521",
27
+ "@remotion/renderer": "4.0.522",
28
+ "@remotion/eslint-config-internal": "4.0.522",
29
29
  "eslint": "9.19.0",
30
30
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
31
31
  },