@remotion/studio-server 4.0.496 → 4.0.497

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.
Files changed (29) hide show
  1. package/dist/better-opn/index.d.ts +6 -0
  2. package/dist/better-opn/index.js +46 -18
  3. package/dist/codemods/update-sequence-props/update-sequence-props.js +47 -0
  4. package/dist/helpers/css-shorthand-properties.d.ts +27 -0
  5. package/dist/helpers/css-shorthand-properties.js +43 -0
  6. package/dist/helpers/package-manager-spawn-options.d.ts +2 -0
  7. package/dist/helpers/package-manager-spawn-options.js +7 -0
  8. package/dist/helpers/parse-background-shorthand.d.ts +11 -0
  9. package/dist/helpers/parse-background-shorthand.js +41 -0
  10. package/dist/helpers/parse-border-shorthand.d.ts +6 -0
  11. package/dist/helpers/parse-border-shorthand.js +135 -0
  12. package/dist/helpers/resolve-composition-component.d.ts +3 -1
  13. package/dist/helpers/resolve-composition-component.js +38 -9
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.js +2 -0
  16. package/dist/open-browser-shortcut.js +26 -16
  17. package/dist/preview-server/routes/can-update-sequence-props.js +54 -3
  18. package/dist/preview-server/routes/download-remote-asset.js +1 -0
  19. package/dist/preview-server/routes/insert-element.js +7 -1
  20. package/dist/preview-server/routes/insert-jsx-element.js +9 -1
  21. package/dist/preview-server/routes/install-dependency.js +5 -1
  22. package/dist/preview-server/routes/save-sequence-props.js +90 -22
  23. package/package.json +6 -6
  24. package/dist/preview-server/routes/delete-effect-keyframe.d.ts +0 -3
  25. package/dist/preview-server/routes/delete-effect-keyframe.js +0 -89
  26. package/dist/preview-server/routes/delete-sequence-keyframe.d.ts +0 -3
  27. package/dist/preview-server/routes/delete-sequence-keyframe.js +0 -82
  28. package/dist/preview-server/routes/save-props-mutex.d.ts +0 -1
  29. package/dist/preview-server/routes/save-props-mutex.js +0 -11
@@ -1,8 +1,14 @@
1
1
  export declare const getChromiumBrowsersToTry: (processes: string) => ("Arc" | "Brave Browser" | "Chromium" | "Google Chrome" | "Google Chrome Canary" | "Microsoft Edge" | "Vivaldi")[];
2
2
  export declare const getFocusBrowserTabAppleScript: (chromiumBrowser: "Arc" | "Brave Browser" | "Chromium" | "Google Chrome" | "Google Chrome Canary" | "Microsoft Edge" | "Vivaldi") => string;
3
+ export declare const getFocusBrowserTabByOriginAppleScript: (chromiumBrowser: "Arc" | "Brave Browser" | "Chromium" | "Google Chrome" | "Google Chrome Canary" | "Microsoft Edge" | "Vivaldi") => string;
3
4
  export declare const focusBrowserTab: ({ url }: {
4
5
  url: string;
5
6
  }) => Promise<boolean>;
7
+ export declare const focusBrowserTabByOrigin: ({ url, browserFlag, browserArgs, }: {
8
+ url: string;
9
+ browserFlag: string | undefined;
10
+ browserArgs: string | undefined;
11
+ }) => false | Promise<boolean>;
6
12
  export declare const openBrowser: ({ url, browserFlag, browserArgs, }: {
7
13
  url: string;
8
14
  browserFlag: string | undefined;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // Copied from https://github.com/michaellzc/better-opn#readme
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.openBrowser = exports.focusBrowserTab = exports.getFocusBrowserTabAppleScript = exports.getChromiumBrowsersToTry = void 0;
4
+ exports.openBrowser = exports.focusBrowserTabByOrigin = exports.focusBrowserTab = exports.getFocusBrowserTabByOriginAppleScript = exports.getFocusBrowserTabAppleScript = exports.getChromiumBrowsersToTry = void 0;
5
5
  const node_child_process_1 = require("node:child_process");
6
6
  const open = require("open");
7
7
  const supportedChromiumBrowsers = [
@@ -96,7 +96,21 @@ const normalizeURLToMatch = (target) => {
96
96
  return target;
97
97
  }
98
98
  };
99
- const getFocusBrowserTabAppleScript = (chromiumBrowser) => {
99
+ const getBrowserArgs = (browserArgs) => {
100
+ if (browserArgs) {
101
+ return browserArgs.split(' ');
102
+ }
103
+ if (process.env.BROWSER_ARGS) {
104
+ return process.env.BROWSER_ARGS.split(' ');
105
+ }
106
+ return [];
107
+ };
108
+ const shouldTryOpenChromiumWithAppleScript = ({ browser, args, }) => {
109
+ return (process.platform === 'darwin' &&
110
+ args.length === 0 &&
111
+ (!browser || browser === 'google chrome' || browser === 'chrome'));
112
+ };
113
+ const getFocusBrowserTabAppleScriptWithCondition = (chromiumBrowser, condition) => {
100
114
  return `
101
115
  property targetTabIndex: -1
102
116
  property targetWindow: null
@@ -128,7 +142,7 @@ on lookupTabWithUrl(lookupUrl)
128
142
  set theTabIndex to 0
129
143
  repeat with theTab in every tab of theWindow
130
144
  set theTabIndex to theTabIndex + 1
131
- if (theTab's URL as string) is lookupUrl then
145
+ ${condition}
132
146
  set targetTabIndex to theTabIndex
133
147
  set targetWindow to theWindow
134
148
  set found to true
@@ -146,8 +160,16 @@ on lookupTabWithUrl(lookupUrl)
146
160
  end lookupTabWithUrl
147
161
  `.trim();
148
162
  };
163
+ const getFocusBrowserTabAppleScript = (chromiumBrowser) => {
164
+ return getFocusBrowserTabAppleScriptWithCondition(chromiumBrowser, "if (theTab's URL as string) is lookupUrl then");
165
+ };
149
166
  exports.getFocusBrowserTabAppleScript = getFocusBrowserTabAppleScript;
150
- const focusBrowserTab = async ({ url }) => {
167
+ const getFocusBrowserTabByOriginAppleScript = (chromiumBrowser) => {
168
+ return getFocusBrowserTabAppleScriptWithCondition(chromiumBrowser, `set tabURL to theTab's URL as string
169
+ if tabURL is lookupUrl or tabURL starts with lookupUrl & "/" or tabURL starts with lookupUrl & "?" or tabURL starts with lookupUrl & "#" then`);
170
+ };
171
+ exports.getFocusBrowserTabByOriginAppleScript = getFocusBrowserTabByOriginAppleScript;
172
+ const focusBrowserTabWithAppleScript = async ({ url, getAppleScript, }) => {
151
173
  if (process.platform !== 'darwin') {
152
174
  return false;
153
175
  }
@@ -161,7 +183,7 @@ const focusBrowserTab = async ({ url }) => {
161
183
  for (const chromiumBrowser of browsersToTry) {
162
184
  try {
163
185
  const result = await runAppleScript({
164
- appleScript: (0, exports.getFocusBrowserTabAppleScript)(chromiumBrowser),
186
+ appleScript: getAppleScript(chromiumBrowser),
165
187
  args: [url],
166
188
  });
167
189
  if (result.trim() === 'true') {
@@ -176,15 +198,30 @@ const focusBrowserTab = async ({ url }) => {
176
198
  }
177
199
  return false;
178
200
  };
201
+ const focusBrowserTab = ({ url }) => {
202
+ return focusBrowserTabWithAppleScript({
203
+ url,
204
+ getAppleScript: exports.getFocusBrowserTabAppleScript,
205
+ });
206
+ };
179
207
  exports.focusBrowserTab = focusBrowserTab;
208
+ const focusBrowserTabByOrigin = ({ url, browserFlag, browserArgs, }) => {
209
+ const args = getBrowserArgs(browserArgs);
210
+ const browser = browserFlag !== null && browserFlag !== void 0 ? browserFlag : process.env.BROWSER;
211
+ if (!shouldTryOpenChromiumWithAppleScript({ browser, args })) {
212
+ return false;
213
+ }
214
+ return focusBrowserTabWithAppleScript({
215
+ url: normalizeURLToMatch(url),
216
+ getAppleScript: exports.getFocusBrowserTabByOriginAppleScript,
217
+ });
218
+ };
219
+ exports.focusBrowserTabByOrigin = focusBrowserTabByOrigin;
180
220
  // Copy from
181
221
  // https://github.com/facebook/create-react-app/blob/master/packages/react-dev-utils/openBrowser.js#L64
182
222
  const startBrowserProcess = async ({ browser, url, args, }) => {
183
223
  const tryNewInstance = args.length > 0;
184
- const shouldTryOpenChromiumWithAppleScript = process.platform === 'darwin' &&
185
- !tryNewInstance &&
186
- (!browser || browser === 'google chrome' || browser === 'chrome');
187
- if (shouldTryOpenChromiumWithAppleScript) {
224
+ if (shouldTryOpenChromiumWithAppleScript({ browser, args })) {
188
225
  let appleScriptDenied = false;
189
226
  // Will use the first open browser found from list
190
227
  const browsersToTry = await getRunningChromiumBrowsers();
@@ -308,15 +345,6 @@ const startBrowserProcess = async ({ browser, url, args, }) => {
308
345
  wait: false,
309
346
  });
310
347
  };
311
- const getBrowserArgs = (browserArgs) => {
312
- if (browserArgs) {
313
- return browserArgs.split(' ');
314
- }
315
- if (process.env.BROWSER_ARGS) {
316
- return process.env.BROWSER_ARGS.split(' ');
317
- }
318
- return [];
319
- };
320
348
  const openBrowser = ({ url, browserFlag, browserArgs, }) => {
321
349
  return startBrowserProcess({
322
350
  browser: browserFlag !== null && browserFlag !== void 0 ? browserFlag : process.env.BROWSER,
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.updateSequenceProps = exports.updateMultipleSequenceProps = exports.updateSequencePropsAst = void 0;
37
37
  const recast = __importStar(require("recast"));
38
38
  const no_react_1 = require("remotion/no-react");
39
+ const css_shorthand_properties_1 = require("../../helpers/css-shorthand-properties");
39
40
  const video_config_numeric_expression_1 = require("../../helpers/video-config-numeric-expression");
40
41
  const video_config_values_1 = require("../../helpers/video-config-values");
41
42
  const can_update_sequence_props_1 = require("../../preview-server/routes/can-update-sequence-props");
@@ -474,11 +475,57 @@ const applyGoogleFontSourceEdits = ({ ast, updates, }) => {
474
475
  removeUnusedGoogleFontSourceEdits(ast);
475
476
  }
476
477
  };
478
+ const migrateCssShorthand = ({ node, cssShorthand, }) => {
479
+ var _a, _b, _c;
480
+ var _d;
481
+ const styleAttribute = (_a = node.attributes) === null || _a === void 0 ? void 0 : _a.find((attribute) => attribute.type === 'JSXAttribute' &&
482
+ attribute.name.type === 'JSXIdentifier' &&
483
+ attribute.name.name === 'style');
484
+ if ((styleAttribute === null || styleAttribute === void 0 ? void 0 : styleAttribute.type) !== 'JSXAttribute' ||
485
+ ((_b = styleAttribute.value) === null || _b === void 0 ? void 0 : _b.type) !== 'JSXExpressionContainer' ||
486
+ styleAttribute.value.expression.type !== 'ObjectExpression') {
487
+ return;
488
+ }
489
+ const { properties } = styleAttribute.value.expression;
490
+ for (let index = 0; index < properties.length; index++) {
491
+ const property = properties[index];
492
+ if (property.type !== 'ObjectProperty' ||
493
+ !((property.key.type === 'Identifier' &&
494
+ property.key.name === cssShorthand.shorthand) ||
495
+ (property.key.type === 'StringLiteral' &&
496
+ property.key.value === cssShorthand.shorthand))) {
497
+ continue;
498
+ }
499
+ const shorthandValue = property.value.type === 'StringLiteral'
500
+ ? property.value.value
501
+ : property.value.type === 'TemplateLiteral' &&
502
+ property.value.expressions.length === 0
503
+ ? ((_d = (_c = property.value.quasis[0]) === null || _c === void 0 ? void 0 : _c.value.cooked) !== null && _d !== void 0 ? _d : null)
504
+ : null;
505
+ if (shorthandValue === null) {
506
+ continue;
507
+ }
508
+ const parsed = cssShorthand.parse(shorthandValue);
509
+ if (!parsed) {
510
+ continue;
511
+ }
512
+ properties.splice(index, 1, ...cssShorthand.longhands.map((longhand) => {
513
+ const value = parsed[longhand];
514
+ return b.objectProperty(b.identifier(longhand), typeof value === 'number'
515
+ ? b.numericLiteral(value)
516
+ : b.stringLiteral(value));
517
+ }));
518
+ index += cssShorthand.longhands.length - 1;
519
+ }
520
+ };
477
521
  const updateSequencePropsNode = ({ jsxElement, updates, schema, videoConfigValues, }) => {
478
522
  var _a, _b, _c, _d;
479
523
  var _e, _f;
480
524
  const node = jsxElement.openingElement;
481
525
  const logLine = (_e = (_a = node.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _e !== void 0 ? _e : 1;
526
+ for (const cssShorthand of (0, css_shorthand_properties_1.getCssShorthandsForUpdates)(updates.map((update) => update.key))) {
527
+ migrateCssShorthand({ node, cssShorthand });
528
+ }
482
529
  const oldValueStrings = [];
483
530
  const initialAttrs = snapshotTopLevelAttrs(node);
484
531
  const updatedTopLevelKeys = new Set(updates.map(({ key }) => {
@@ -0,0 +1,27 @@
1
+ type ParsedCssShorthand = Readonly<Record<string, string | number>>;
2
+ export type CssShorthandProperty = {
3
+ readonly parentKey: string;
4
+ readonly shorthand: string;
5
+ readonly longhands: readonly string[];
6
+ readonly parse: (value: string) => ParsedCssShorthand | null;
7
+ readonly isUnsupportedProperty: (propertyName: string) => boolean;
8
+ };
9
+ export declare const cssShorthandProperties: readonly [{
10
+ readonly parentKey: "style";
11
+ readonly shorthand: "background";
12
+ readonly longhands: readonly ["backgroundColor", "backgroundImage", "backgroundPosition", "backgroundSize", "backgroundRepeat", "backgroundOrigin", "backgroundClip", "backgroundAttachment"];
13
+ readonly parse: (value: string) => import("./parse-background-shorthand").ParsedBackgroundShorthand | null;
14
+ readonly isUnsupportedProperty: () => false;
15
+ }, {
16
+ readonly parentKey: "style";
17
+ readonly shorthand: "border";
18
+ readonly longhands: readonly ["borderWidth", "borderStyle", "borderColor"];
19
+ readonly parse: (value: string) => import("./parse-border-shorthand").ParsedBorderShorthand | null;
20
+ readonly isUnsupportedProperty: (propertyName: string) => boolean;
21
+ }];
22
+ export declare const getCssShorthandForLonghand: ({ parentKey, longhand, }: {
23
+ parentKey: string;
24
+ longhand: string;
25
+ }) => CssShorthandProperty | null;
26
+ export declare const getCssShorthandsForUpdates: (updateKeys: readonly string[]) => CssShorthandProperty[];
27
+ export {};
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCssShorthandsForUpdates = exports.getCssShorthandForLonghand = exports.cssShorthandProperties = void 0;
4
+ const parse_background_shorthand_1 = require("./parse-background-shorthand");
5
+ const parse_border_shorthand_1 = require("./parse-border-shorthand");
6
+ const borderSidePropertyRegex = /^border(?:Top|Right|Bottom|Left)(?:Width|Style|Color)?$/;
7
+ const borderShorthand = {
8
+ parentKey: 'style',
9
+ shorthand: 'border',
10
+ longhands: ['borderWidth', 'borderStyle', 'borderColor'],
11
+ parse: parse_border_shorthand_1.parseBorderShorthand,
12
+ isUnsupportedProperty: (propertyName) => borderSidePropertyRegex.test(propertyName),
13
+ };
14
+ const backgroundShorthand = {
15
+ parentKey: 'style',
16
+ shorthand: 'background',
17
+ longhands: [
18
+ 'backgroundColor',
19
+ 'backgroundImage',
20
+ 'backgroundPosition',
21
+ 'backgroundSize',
22
+ 'backgroundRepeat',
23
+ 'backgroundOrigin',
24
+ 'backgroundClip',
25
+ 'backgroundAttachment',
26
+ ],
27
+ parse: parse_background_shorthand_1.parseBackgroundShorthand,
28
+ isUnsupportedProperty: () => false,
29
+ };
30
+ exports.cssShorthandProperties = [
31
+ backgroundShorthand,
32
+ borderShorthand,
33
+ ];
34
+ const getCssShorthandForLonghand = ({ parentKey, longhand, }) => {
35
+ var _a;
36
+ return ((_a = exports.cssShorthandProperties.find((property) => property.parentKey === parentKey &&
37
+ property.longhands.includes(longhand))) !== null && _a !== void 0 ? _a : null);
38
+ };
39
+ exports.getCssShorthandForLonghand = getCssShorthandForLonghand;
40
+ const getCssShorthandsForUpdates = (updateKeys) => {
41
+ return exports.cssShorthandProperties.filter((property) => updateKeys.some((key) => property.longhands.some((longhand) => key === `${property.parentKey}.${longhand}`)));
42
+ };
43
+ exports.getCssShorthandsForUpdates = getCssShorthandsForUpdates;
@@ -0,0 +1,2 @@
1
+ import type { SpawnOptionsWithoutStdio } from 'node:child_process';
2
+ export declare const getPackageManagerSpawnOptions: () => Pick<SpawnOptionsWithoutStdio, "shell">;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPackageManagerSpawnOptions = void 0;
4
+ const getPackageManagerSpawnOptions = () => {
5
+ return process.platform === 'win32' ? { shell: true } : {};
6
+ };
7
+ exports.getPackageManagerSpawnOptions = getPackageManagerSpawnOptions;
@@ -0,0 +1,11 @@
1
+ export type ParsedBackgroundShorthand = {
2
+ backgroundAttachment: string;
3
+ backgroundClip: string;
4
+ backgroundColor: string;
5
+ backgroundImage: string;
6
+ backgroundOrigin: string;
7
+ backgroundPosition: string;
8
+ backgroundRepeat: string;
9
+ backgroundSize: string;
10
+ };
11
+ export declare const parseBackgroundShorthand: (value: string) => ParsedBackgroundShorthand | null;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseBackgroundShorthand = void 0;
4
+ const no_react_1 = require("remotion/no-react");
5
+ const CSS_WIDE_KEYWORDS = new Set([
6
+ 'inherit',
7
+ 'initial',
8
+ 'revert',
9
+ 'revert-layer',
10
+ 'unset',
11
+ ]);
12
+ const makeColorOnlyBackground = (backgroundColor) => {
13
+ return {
14
+ backgroundColor,
15
+ backgroundImage: 'none',
16
+ backgroundPosition: '0% 0%',
17
+ backgroundSize: 'auto auto',
18
+ backgroundRepeat: 'repeat',
19
+ backgroundOrigin: 'padding-box',
20
+ backgroundClip: 'border-box',
21
+ backgroundAttachment: 'scroll',
22
+ };
23
+ };
24
+ const parseBackgroundShorthand = (value) => {
25
+ const trimmed = value.trim();
26
+ const lowerCaseValue = trimmed.toLowerCase();
27
+ if (trimmed === '' || CSS_WIDE_KEYWORDS.has(lowerCaseValue)) {
28
+ return null;
29
+ }
30
+ if (lowerCaseValue === 'none') {
31
+ return makeColorOnlyBackground('transparent');
32
+ }
33
+ try {
34
+ no_react_1.NoReactInternals.processColor(trimmed);
35
+ return makeColorOnlyBackground(trimmed);
36
+ }
37
+ catch (_a) {
38
+ return null;
39
+ }
40
+ };
41
+ exports.parseBackgroundShorthand = parseBackgroundShorthand;
@@ -0,0 +1,6 @@
1
+ export type ParsedBorderShorthand = {
2
+ borderWidth: number;
3
+ borderStyle: string;
4
+ borderColor: string;
5
+ };
6
+ export declare const parseBorderShorthand: (value: string) => ParsedBorderShorthand | null;
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseBorderShorthand = void 0;
4
+ const BORDER_STYLES = new Set([
5
+ 'none',
6
+ 'hidden',
7
+ 'dotted',
8
+ 'dashed',
9
+ 'solid',
10
+ 'double',
11
+ 'groove',
12
+ 'ridge',
13
+ 'inset',
14
+ 'outset',
15
+ ]);
16
+ const CSS_WIDE_KEYWORDS = new Set([
17
+ 'inherit',
18
+ 'initial',
19
+ 'revert',
20
+ 'revert-layer',
21
+ 'unset',
22
+ ]);
23
+ const BORDER_WIDTH_KEYWORDS = {
24
+ // Chromium resolves these CSS keywords to these pixel values.
25
+ thin: 1,
26
+ medium: 3,
27
+ thick: 5,
28
+ };
29
+ const splitCssWhitespace = (value) => {
30
+ const parts = [];
31
+ let current = '';
32
+ let parenthesisDepth = 0;
33
+ let quote = null;
34
+ for (const char of value.trim()) {
35
+ if (quote !== null) {
36
+ current += char;
37
+ if (char === quote) {
38
+ quote = null;
39
+ }
40
+ continue;
41
+ }
42
+ if (char === '"' || char === "'") {
43
+ quote = char;
44
+ current += char;
45
+ continue;
46
+ }
47
+ if (char === '(') {
48
+ parenthesisDepth++;
49
+ current += char;
50
+ continue;
51
+ }
52
+ if (char === ')') {
53
+ parenthesisDepth--;
54
+ if (parenthesisDepth < 0) {
55
+ return null;
56
+ }
57
+ current += char;
58
+ continue;
59
+ }
60
+ if (/\s/.test(char) && parenthesisDepth === 0) {
61
+ if (current !== '') {
62
+ parts.push(current);
63
+ current = '';
64
+ }
65
+ continue;
66
+ }
67
+ current += char;
68
+ }
69
+ if (quote !== null || parenthesisDepth !== 0) {
70
+ return null;
71
+ }
72
+ if (current !== '') {
73
+ parts.push(current);
74
+ }
75
+ return parts;
76
+ };
77
+ const parsePixelWidth = (token) => {
78
+ if (token === '0') {
79
+ return 0;
80
+ }
81
+ const match = token.match(/^(\d+(?:\.\d+)?|\.\d+)px$/i);
82
+ if (!match) {
83
+ return null;
84
+ }
85
+ return Number(match[1]);
86
+ };
87
+ const parseBorderShorthand = (value) => {
88
+ const tokens = splitCssWhitespace(value);
89
+ if (!tokens || tokens.length === 0) {
90
+ return null;
91
+ }
92
+ let borderWidth = null;
93
+ let borderStyle = null;
94
+ let borderColor = null;
95
+ for (const token of tokens) {
96
+ const lowerCaseToken = token.toLowerCase();
97
+ if (CSS_WIDE_KEYWORDS.has(lowerCaseToken)) {
98
+ return null;
99
+ }
100
+ if (BORDER_STYLES.has(lowerCaseToken)) {
101
+ if (borderStyle !== null) {
102
+ return null;
103
+ }
104
+ borderStyle = lowerCaseToken;
105
+ continue;
106
+ }
107
+ const width = parsePixelWidth(token);
108
+ if (width !== null) {
109
+ if (borderWidth !== null) {
110
+ return null;
111
+ }
112
+ borderWidth = width;
113
+ continue;
114
+ }
115
+ const keywordWidth = BORDER_WIDTH_KEYWORDS[lowerCaseToken];
116
+ if (keywordWidth !== undefined) {
117
+ if (borderWidth !== null) {
118
+ return null;
119
+ }
120
+ borderWidth = keywordWidth;
121
+ continue;
122
+ }
123
+ if (borderColor === null) {
124
+ borderColor = token;
125
+ continue;
126
+ }
127
+ return null;
128
+ }
129
+ return {
130
+ borderWidth: borderWidth !== null && borderWidth !== void 0 ? borderWidth : BORDER_WIDTH_KEYWORDS.medium,
131
+ borderStyle: borderStyle !== null && borderStyle !== void 0 ? borderStyle : 'none',
132
+ borderColor: borderColor !== null && borderColor !== void 0 ? borderColor : 'currentColor',
133
+ };
134
+ };
135
+ exports.parseBorderShorthand = parseBorderShorthand;
@@ -19,11 +19,12 @@ export declare const resolveCompositionComponent: ({ remotionRoot, compositionFi
19
19
  compositionFile: string;
20
20
  compositionId: string;
21
21
  }) => Promise<ResolvedCompositionComponent>;
22
- export declare const insertJsxElementIntoComposition: ({ remotionRoot, compositionFile, compositionId, element, prettierConfigOverride, wrapInSequence, }: {
22
+ export declare const insertJsxElementIntoComposition: ({ remotionRoot, compositionFile, compositionId, element, from, prettierConfigOverride, wrapInSequence, }: {
23
23
  remotionRoot: string;
24
24
  compositionFile: string;
25
25
  compositionId: string;
26
26
  element: InsertableCompositionElement;
27
+ from: number | null;
27
28
  prettierConfigOverride: Record<string, unknown> | null;
28
29
  wrapInSequence?: {
29
30
  dimensions: {
@@ -31,6 +32,7 @@ export declare const insertJsxElementIntoComposition: ({ remotionRoot, compositi
31
32
  height: number;
32
33
  } | null;
33
34
  durationInFrames?: number | null | undefined;
35
+ from: number | null;
34
36
  name: string | null;
35
37
  position: InsertableCompositionElementPosition | null;
36
38
  } | null | undefined;
@@ -578,16 +578,18 @@ const createSolidElement = ({ localName, width, height, position, }) => {
578
578
  createPositionAbsoluteStyleAttribute(position),
579
579
  ], true), null, []);
580
580
  };
581
- const createComponentElement = ({ addPositionStyle, localName, props, position, }) => {
581
+ const createComponentElement = ({ addPositionStyle, from, localName, props, position, }) => {
582
582
  return recast.types.builders.jsxElement(recast.types.builders.jsxOpeningElement(recast.types.builders.jsxIdentifier(localName), [
583
583
  ...props.map(createComponentProp),
584
+ ...(from === null ? [] : [createNumberAttribute('from', from)]),
584
585
  ...(addPositionStyle
585
586
  ? [createPositionAbsoluteStyleAttribute(position)]
586
587
  : []),
587
588
  ], true), null, []);
588
589
  };
589
- const createSequenceWrappedElement = ({ child, dimensions, durationInFrames, name, position, sequenceLocalName, }) => {
590
+ const createSequenceWrappedElement = ({ child, dimensions, durationInFrames, from, name, position, sequenceLocalName, }) => {
590
591
  return recast.types.builders.jsxElement(recast.types.builders.jsxOpeningElement(recast.types.builders.jsxIdentifier(sequenceLocalName), [
592
+ ...(from === null ? [] : [createNumberAttribute('from', from)]),
591
593
  ...(name === null ? [] : [createStringAttribute('name', name)]),
592
594
  ...(dimensions !== null
593
595
  ? [
@@ -601,22 +603,29 @@ const createSequenceWrappedElement = ({ child, dimensions, durationInFrames, nam
601
603
  createPositionAbsoluteStyleAttribute(position),
602
604
  ], false), recast.types.builders.jsxClosingElement(recast.types.builders.jsxIdentifier(sequenceLocalName)), [child]);
603
605
  };
604
- const createAssetElement = ({ addPositionStyle, localName, staticFileLocalName, src, dimensions, position, }) => {
606
+ const createAssetElement = ({ addPositionStyle, durationInFrames, from, localName, staticFileLocalName, src, dimensions, position, }) => {
605
607
  return recast.types.builders.jsxElement(recast.types.builders.jsxOpeningElement(recast.types.builders.jsxIdentifier(localName), [
606
608
  staticFileLocalName === null
607
609
  ? createStringSrcAttribute(src)
608
610
  : createStaticFileSrcAttribute({ staticFileLocalName, src }),
611
+ ...(durationInFrames === null
612
+ ? []
613
+ : [createNumberAttribute('durationInFrames', durationInFrames)]),
614
+ ...(from === null ? [] : [createNumberAttribute('from', from)]),
609
615
  ...(addPositionStyle
610
616
  ? [createAssetStyleAttribute({ dimensions, position })]
611
617
  : []),
612
618
  ], true), null, []);
613
619
  };
614
- const createSvgElement = async ({ interactiveLocalName, markup, position, }) => {
620
+ const createSvgElement = async ({ from, interactiveLocalName, markup, position, }) => {
615
621
  var _a;
616
622
  var _b;
617
623
  const svgElement = await (0, svg_to_jsx_1.svgMarkupToJsx)(markup);
618
624
  const attributes = (_b = svgElement.openingElement.attributes) !== null && _b !== void 0 ? _b : [];
619
625
  svgElement.openingElement.attributes = attributes;
626
+ if (from !== null) {
627
+ attributes.push(createNumberAttribute('from', from));
628
+ }
620
629
  const styleAttribute = attributes.find((attribute) => attribute.type === 'JSXAttribute' &&
621
630
  attribute.name.type === 'JSXIdentifier' &&
622
631
  attribute.name.name === 'style');
@@ -1317,7 +1326,7 @@ const resolveCompositionComponent = async ({ remotionRoot, compositionFile, comp
1317
1326
  };
1318
1327
  };
1319
1328
  exports.resolveCompositionComponent = resolveCompositionComponent;
1320
- const createInsertableJsxElement = ({ addPositionStyleToComponent, ast, destinationFileName, element, remotionRoot, }) => {
1329
+ const createInsertableJsxElement = ({ addPositionStyleToComponent, ast, destinationFileName, element, from, remotionRoot, }) => {
1321
1330
  if (element.type === 'solid') {
1322
1331
  const solidLocalName = ensureSolidImport(ast);
1323
1332
  return createSolidElement({
@@ -1336,6 +1345,7 @@ const createInsertableJsxElement = ({ addPositionStyleToComponent, ast, destinat
1336
1345
  });
1337
1346
  return createComponentElement({
1338
1347
  addPositionStyle: addPositionStyleToComponent,
1348
+ from,
1339
1349
  localName: componentLocalName,
1340
1350
  props: element.props,
1341
1351
  position: element.position,
@@ -1343,6 +1353,7 @@ const createInsertableJsxElement = ({ addPositionStyleToComponent, ast, destinat
1343
1353
  }
1344
1354
  if (element.type === 'svg') {
1345
1355
  return createSvgElement({
1356
+ from,
1346
1357
  interactiveLocalName: ensureInteractiveImport(ast),
1347
1358
  markup: element.markup,
1348
1359
  position: element.position,
@@ -1388,17 +1399,21 @@ const createInsertableJsxElement = ({ addPositionStyleToComponent, ast, destinat
1388
1399
  throw new Error('Unsupported asset type');
1389
1400
  }
1390
1401
  return createAssetElement({
1391
- addPositionStyle: element.assetType !== 'audio',
1402
+ addPositionStyle: addPositionStyleToComponent && element.assetType !== 'audio',
1403
+ durationInFrames: element.assetType === 'image' ? null : element.durationInFrames,
1404
+ from,
1392
1405
  localName,
1393
1406
  staticFileLocalName,
1394
1407
  src: element.src,
1395
- dimensions: element.dimensions,
1408
+ dimensions: element.assetType === 'image' && from !== null
1409
+ ? null
1410
+ : element.dimensions,
1396
1411
  position: element.position,
1397
1412
  });
1398
1413
  }
1399
1414
  throw new Error('Unsupported element type');
1400
1415
  };
1401
- const insertJsxElementIntoComposition = async ({ remotionRoot, compositionFile, compositionId, element, prettierConfigOverride, wrapInSequence = null, }) => {
1416
+ const insertJsxElementIntoComposition = async ({ remotionRoot, compositionFile, compositionId, element, from, prettierConfigOverride, wrapInSequence = null, }) => {
1402
1417
  var _a;
1403
1418
  const location = await (0, exports.resolveCompositionComponentWithFile)({
1404
1419
  remotionRoot,
@@ -1423,13 +1438,26 @@ const insertJsxElementIntoComposition = async ({ remotionRoot, compositionFile,
1423
1438
  durationInFrames: element.durationInFrames,
1424
1439
  name: element.compositionId,
1425
1440
  position: element.position,
1441
+ from,
1426
1442
  }
1427
- : wrapInSequence;
1443
+ : from === null ||
1444
+ element.type === 'asset' ||
1445
+ element.type === 'svg' ||
1446
+ element.type === 'component'
1447
+ ? wrapInSequence
1448
+ : {
1449
+ dimensions: null,
1450
+ durationInFrames: null,
1451
+ name: null,
1452
+ position: element.position,
1453
+ from,
1454
+ };
1428
1455
  const elementToInsert = await createInsertableJsxElement({
1429
1456
  addPositionStyleToComponent: sequenceWrapper === null,
1430
1457
  ast,
1431
1458
  destinationFileName: location.fileName,
1432
1459
  element,
1460
+ from,
1433
1461
  remotionRoot,
1434
1462
  });
1435
1463
  const finalElementToInsert = sequenceWrapper
@@ -1437,6 +1465,7 @@ const insertJsxElementIntoComposition = async ({ remotionRoot, compositionFile,
1437
1465
  child: elementToInsert,
1438
1466
  dimensions: sequenceWrapper.dimensions,
1439
1467
  durationInFrames: (_a = sequenceWrapper.durationInFrames) !== null && _a !== void 0 ? _a : null,
1468
+ from: sequenceWrapper.from,
1440
1469
  name: sequenceWrapper.name,
1441
1470
  position: sequenceWrapper.position,
1442
1471
  sequenceLocalName: ensureSequenceImport(ast),
package/dist/index.d.ts CHANGED
@@ -115,6 +115,7 @@ export declare const StudioServerInternals: {
115
115
  version: string;
116
116
  additionalArgs: string[];
117
117
  }) => string[];
118
+ getPackageManagerSpawnOptions: () => Pick<import("child_process").SpawnOptionsWithoutStdio, "shell">;
118
119
  addCompletedClientRender: ({ render, remotionRoot, }: {
119
120
  render: import("@remotion/studio-shared").CompletedClientRender;
120
121
  remotionRoot: string;
package/dist/index.js CHANGED
@@ -13,6 +13,7 @@ const file_watcher_1 = require("./file-watcher");
13
13
  const get_latest_remotion_version_1 = require("./get-latest-remotion-version");
14
14
  const get_installed_dependencies_1 = require("./helpers/get-installed-dependencies");
15
15
  const install_command_1 = require("./helpers/install-command");
16
+ const package_manager_spawn_options_1 = require("./helpers/package-manager-spawn-options");
16
17
  const max_timeline_tracks_1 = require("./max-timeline-tracks");
17
18
  const get_package_manager_1 = require("./preview-server/get-package-manager");
18
19
  const live_events_1 = require("./preview-server/live-events");
@@ -41,6 +42,7 @@ exports.StudioServerInternals = {
41
42
  getInstalledDependencies: get_installed_dependencies_1.getInstalledDependencies,
42
43
  getInstalledDependenciesWithVersions: get_installed_dependencies_1.getInstalledDependenciesWithVersions,
43
44
  getInstallCommand: install_command_1.getInstallCommand,
45
+ getPackageManagerSpawnOptions: package_manager_spawn_options_1.getPackageManagerSpawnOptions,
44
46
  addCompletedClientRender: client_render_queue_1.addCompletedClientRender,
45
47
  getCompletedClientRenders: client_render_queue_1.getCompletedClientRenders,
46
48
  removeCompletedClientRender: client_render_queue_1.removeCompletedClientRender,