@remotion/cli 4.0.0-alpha6 → 4.0.0-alpha8

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 (131) hide show
  1. package/dist/benchmark.js +9 -4
  2. package/dist/chalk/index.d.ts +45 -54
  3. package/dist/chalk/index.js +2 -135
  4. package/dist/codemods/stringify-with-path.d.ts +5 -0
  5. package/dist/codemods/stringify-with-path.js +44 -0
  6. package/dist/codemods/update-default-props.d.ts +3 -1
  7. package/dist/codemods/update-default-props.js +3 -17
  8. package/dist/compositions.js +1 -0
  9. package/dist/config/log.d.ts +1 -3
  10. package/dist/config/log.js +2 -9
  11. package/dist/download-progress.d.ts +1 -1
  12. package/dist/download-progress.js +1 -5
  13. package/dist/editor/components/MenuBuildIndicator.js +20 -1
  14. package/dist/editor/components/Modals.js +1 -1
  15. package/dist/editor/components/NewComposition/ComboBox.js +2 -2
  16. package/dist/editor/components/NewComposition/MenuContent.js +1 -1
  17. package/dist/editor/components/NewComposition/RemInput.d.ts +1 -1
  18. package/dist/editor/components/NewComposition/RemInputTypeColor.d.ts +1 -1
  19. package/dist/editor/components/NewComposition/RemTextarea.d.ts +1 -1
  20. package/dist/editor/components/OpenEditorButton.d.ts +2 -0
  21. package/dist/editor/components/OpenEditorButton.js +52 -0
  22. package/dist/editor/components/RenderButton.js +5 -1
  23. package/dist/editor/components/RenderModal/CliCopyButton.js +7 -6
  24. package/dist/editor/components/RenderModal/OptionExplainer.js +1 -0
  25. package/dist/editor/components/RenderModal/RenderModal.d.ts +2 -0
  26. package/dist/editor/components/RenderModal/RenderModal.js +3 -3
  27. package/dist/editor/components/RenderModal/RenderModalData.js +55 -27
  28. package/dist/editor/components/RenderModal/RenderModalJSONPropsEditor.d.ts +2 -2
  29. package/dist/editor/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +1 -1
  30. package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +3 -2
  31. package/dist/editor/components/RenderModal/SchemaEditor/ZodArrayEditor.js +1 -1
  32. package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -1
  33. package/dist/editor/components/RenderModal/SchemaEditor/ZodBooleanEditor.js +1 -1
  34. package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +2 -1
  35. package/dist/editor/components/RenderModal/SchemaEditor/ZodColorEditor.js +8 -8
  36. package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +2 -1
  37. package/dist/editor/components/RenderModal/SchemaEditor/ZodDateEditor.js +5 -5
  38. package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +1 -1
  39. package/dist/editor/components/RenderModal/SchemaEditor/ZodEffectEditor.js +3 -2
  40. package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +3 -2
  41. package/dist/editor/components/RenderModal/SchemaEditor/ZodEnumEditor.js +4 -4
  42. package/dist/editor/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +1 -1
  43. package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +2 -1
  44. package/dist/editor/components/RenderModal/SchemaEditor/ZodNumberEditor.js +9 -6
  45. package/dist/editor/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +1 -1
  46. package/dist/editor/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +1 -1
  47. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +1 -1
  48. package/dist/editor/components/RenderModal/SchemaEditor/ZodOrNullishEditor.js +40 -7
  49. package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +16 -0
  50. package/dist/editor/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +73 -0
  51. package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +2 -1
  52. package/dist/editor/components/RenderModal/SchemaEditor/ZodStringEditor.js +5 -5
  53. package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +2 -1
  54. package/dist/editor/components/RenderModal/SchemaEditor/ZodSwitch.js +4 -0
  55. package/dist/editor/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +1 -1
  56. package/dist/editor/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +3 -0
  57. package/dist/editor/components/RenderModal/SchemaEditor/extract-enum-json-paths.js +126 -0
  58. package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.d.ts +14 -0
  59. package/dist/editor/components/RenderModal/SchemaEditor/input-props-serialization.js +42 -0
  60. package/dist/editor/components/RenderModal/get-render-modal-warnings.d.ts +6 -2
  61. package/dist/editor/components/RenderModal/get-render-modal-warnings.js +29 -3
  62. package/dist/editor/components/RenderQueue/actions.d.ts +2 -1
  63. package/dist/editor/components/RenderQueue/actions.js +8 -4
  64. package/dist/editor/components/SidebarRenderButton.js +2 -0
  65. package/dist/editor/components/Spinner.d.ts +4 -0
  66. package/dist/editor/components/Spinner.js +42 -0
  67. package/dist/editor/components/Timeline/TimelineSequence.js +6 -4
  68. package/dist/editor/helpers/calculate-timeline.js +1 -1
  69. package/dist/editor/state/modals.d.ts +2 -0
  70. package/dist/ffmpeg.js +6 -2
  71. package/dist/handle-common-errors.d.ts +2 -1
  72. package/dist/handle-common-errors.js +2 -2
  73. package/dist/index.d.ts +9 -5
  74. package/dist/index.js +4 -5
  75. package/dist/log.d.ts +5 -5
  76. package/dist/log.js +3 -42
  77. package/dist/parse-command-line.d.ts +1 -0
  78. package/dist/preview-server/dev-middleware/setup-hooks.js +2 -2
  79. package/dist/preview-server/render-queue/job.d.ts +2 -0
  80. package/dist/preview-server/render-queue/make-retry-payload.js +4 -0
  81. package/dist/preview-server/render-queue/queue.js +2 -1
  82. package/dist/preview-server/routes/can-update-default-props.js +1 -0
  83. package/dist/preview-server/routes/update-default-props.js +4 -3
  84. package/dist/print-error.d.ts +2 -1
  85. package/dist/print-error.js +8 -5
  86. package/dist/progress-bar.d.ts +5 -4
  87. package/dist/progress-bar.js +42 -29
  88. package/dist/render-flows/render.js +46 -19
  89. package/dist/render-flows/still.js +17 -12
  90. package/dist/setup-cache.d.ts +2 -1
  91. package/dist/setup-cache.js +8 -4
  92. package/dist/should-use-non-overlaying-logger.d.ts +4 -0
  93. package/dist/should-use-non-overlaying-logger.js +12 -0
  94. package/dist/user-passed-output-location.js +7 -2
  95. package/package.json +7 -7
  96. package/dist/ansi/ansi-regex.d.ts +0 -2
  97. package/dist/ansi/ansi-regex.js +0 -18
  98. package/dist/cloudrun-command.d.ts +0 -1
  99. package/dist/cloudrun-command.js +0 -27
  100. package/dist/config/ffmpeg-executable.d.ts +0 -5
  101. package/dist/config/ffmpeg-executable.js +0 -21
  102. package/dist/config/quality.d.ts +0 -2
  103. package/dist/config/quality.js +0 -17
  104. package/dist/editor/components/ClipboardIcon.d.ts +0 -2
  105. package/dist/editor/components/ClipboardIcon.js +0 -12
  106. package/dist/editor/components/CollapsedCompositionSelector.d.ts +0 -4
  107. package/dist/editor/components/CollapsedCompositionSelector.js +0 -39
  108. package/dist/editor/components/RenderModal/SchemaEditor/date-serialization.d.ts +0 -6
  109. package/dist/editor/components/RenderModal/SchemaEditor/date-serialization.js +0 -24
  110. package/dist/editor/components/RichTimelineToggle.d.ts +0 -2
  111. package/dist/editor/components/RichTimelineToggle.js +0 -29
  112. package/dist/editor/components/Thumbnail.d.ts +0 -8
  113. package/dist/editor/components/Thumbnail.js +0 -76
  114. package/dist/editor/helpers/use-compact-ui.d.ts +0 -1
  115. package/dist/editor/helpers/use-compact-ui.js +0 -18
  116. package/dist/editor/icons/film.d.ts +0 -3
  117. package/dist/editor/icons/film.js +0 -8
  118. package/dist/editor/icons/timeline.d.ts +0 -3
  119. package/dist/editor/icons/timeline.js +0 -9
  120. package/dist/editor/state/rich-timeline.d.ts +0 -9
  121. package/dist/editor/state/rich-timeline.js +0 -17
  122. package/dist/get-render-media-options.d.ts +0 -8
  123. package/dist/get-render-media-options.js +0 -55
  124. package/dist/install.d.ts +0 -2
  125. package/dist/install.js +0 -36
  126. package/dist/is-javascript.d.ts +0 -2
  127. package/dist/is-javascript.js +0 -9
  128. package/dist/preview-server/dev-middleware/is-color-supported.d.ts +0 -1
  129. package/dist/preview-server/dev-middleware/is-color-supported.js +0 -37
  130. package/dist/preview-server/hot-middleware/strip-ansi.d.ts +0 -1
  131. package/dist/preview-server/hot-middleware/strip-ansi.js +0 -21
package/dist/benchmark.js CHANGED
@@ -16,6 +16,7 @@ const parse_command_line_1 = require("./parse-command-line");
16
16
  const progress_bar_1 = require("./progress-bar");
17
17
  const select_composition_1 = require("./select-composition");
18
18
  const setup_cache_1 = require("./setup-cache");
19
+ const should_use_non_overlaying_logger_1 = require("./should-use-non-overlaying-logger");
19
20
  const truthy_1 = require("./truthy");
20
21
  const DEFAULT_RUNS = 3;
21
22
  const getValidConcurrency = (cliConcurrency) => {
@@ -104,6 +105,7 @@ const benchmarkCommand = async (remotionRoot, args) => {
104
105
  shouldDumpIo: renderer_1.RenderInternals.isEqualOrBelowLogLevel(config_1.ConfigInternals.Logging.getLogLevel(), 'verbose'),
105
106
  chromiumOptions,
106
107
  forceDeviceScaleFactor: scale,
108
+ indent: false,
107
109
  });
108
110
  const { urlOrBundle: bundleLocation, cleanup: cleanupBundle } = await (0, setup_cache_1.bundleOnCliOrTakeServeUrl)({
109
111
  fullPath: fullEntryPoint,
@@ -117,6 +119,7 @@ const benchmarkCommand = async (remotionRoot, args) => {
117
119
  onDirectoryCreated: (dir) => {
118
120
  (0, cleanup_before_quit_1.registerCleanupJob)(() => renderer_1.RenderInternals.deleteDirectory(dir));
119
121
  },
122
+ quietProgress: false,
120
123
  });
121
124
  (0, cleanup_before_quit_1.registerCleanupJob)(() => cleanupBundle());
122
125
  const puppeteerInstance = await browserInstance;
@@ -154,7 +157,7 @@ const benchmarkCommand = async (remotionRoot, args) => {
154
157
  uiCodec: null,
155
158
  });
156
159
  for (const composition of compositions) {
157
- const { proResProfile, frameRange: defaultFrameRange, overwrite, jpegQuality, crf: configFileCrf, pixelFormat, scale: configFileScale, numberOfGifLoops, everyNthFrame, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, height, width, concurrency: unparsedConcurrency, } = await (0, get_cli_options_1.getCliOptions)({
160
+ const { proResProfile, frameRange: defaultFrameRange, overwrite, jpegQuality, crf: configFileCrf, pixelFormat, scale: configFileScale, numberOfGifLoops, everyNthFrame, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, height, width, concurrency: unparsedConcurrency, logLevel, } = await (0, get_cli_options_1.getCliOptions)({
158
161
  isLambda: false,
159
162
  type: 'series',
160
163
  remotionRoot,
@@ -165,6 +168,8 @@ const benchmarkCommand = async (remotionRoot, args) => {
165
168
  const benchmarkProgress = (0, progress_bar_1.createOverwriteableCliOutput)({
166
169
  quiet: (0, parse_command_line_1.quietFlagProvided)(),
167
170
  cancelSignal: null,
171
+ updatesDontOverwrite: (0, should_use_non_overlaying_logger_1.shouldUseNonOverlayingLogger)({ logLevel }),
172
+ indent: false,
168
173
  });
169
174
  log_1.Log.info();
170
175
  log_1.Log.info(`${chalk_1.chalk.bold(`Benchmark #${count++}:`)} ${chalk_1.chalk.gray(`composition=${composition.id} concurrency=${con} codec=${codec} (${codecReason})`)}`);
@@ -211,10 +216,10 @@ const benchmarkCommand = async (remotionRoot, args) => {
211
216
  run,
212
217
  doneIn: null,
213
218
  progress,
214
- }));
219
+ }), false);
215
220
  });
216
- benchmarkProgress.update('');
217
- benchmarkProgress.update(getResults(timeTaken, runs));
221
+ benchmarkProgress.update('', false);
222
+ benchmarkProgress.update(getResults(timeTaken, runs), false);
218
223
  benchmark[composition.id][`${con}`] = timeTaken;
219
224
  }
220
225
  }
@@ -1,58 +1,49 @@
1
- declare type Style = {
2
- codes: [number, number];
3
- name: string;
4
- wrap?: (input: string, newline: boolean) => string;
5
- };
6
- declare type Method = (str: string) => string;
7
- declare type Colors = {
1
+ export declare const chalk: {
8
2
  enabled: boolean;
9
3
  visible: boolean;
10
- styles: Record<string, Style>;
4
+ styles: Record<string, {
5
+ codes: [number, number];
6
+ name: string;
7
+ wrap?: ((input: string, newline: boolean) => string) | undefined;
8
+ }>;
11
9
  keys: Record<string, string[]>;
12
- alias?: (name: string, col: string) => void;
13
- };
14
- declare type ColorsWithMethods = Colors & {
15
- reset: Method;
16
- bold: Method;
17
- dim: Method;
18
- italic: Method;
19
- underline: Method;
20
- inverse: Method;
21
- hidden: Method;
22
- strikethrough: Method;
23
- black: Method;
24
- red: Method;
25
- green: Method;
26
- yellow: Method;
27
- blue: Method;
28
- magenta: Method;
29
- cyan: Method;
30
- white: Method;
31
- gray: Method;
32
- bgBlack: Method;
33
- bgRed: Method;
34
- bgGreen: Method;
35
- bgYellow: Method;
36
- bgBlue: Method;
37
- bgMagenta: Method;
38
- bgCyan: Method;
39
- bgWhite: Method;
40
- blackBright: Method;
41
- redBright: Method;
42
- greenBright: Method;
43
- yellowBright: Method;
44
- blueBright: Method;
45
- magentaBright: Method;
46
- cyanBright: Method;
47
- whiteBright: Method;
48
- bgBlackBright: Method;
49
- bgRedBright: Method;
50
- bgGreenBright: Method;
51
- bgYellowBright: Method;
52
- bgBlueBright: Method;
53
- bgMagentaBright: Method;
54
- bgCyanBright: Method;
55
- bgWhiteBright: Method;
10
+ alias?: ((name: string, col: string) => void) | undefined;
11
+ } & {
12
+ reset: (str: string) => string;
13
+ bold: (str: string) => string;
14
+ dim: (str: string) => string;
15
+ italic: (str: string) => string;
16
+ underline: (str: string) => string;
17
+ inverse: (str: string) => string;
18
+ hidden: (str: string) => string;
19
+ strikethrough: (str: string) => string;
20
+ black: (str: string) => string;
21
+ red: (str: string) => string;
22
+ green: (str: string) => string;
23
+ yellow: (str: string) => string;
24
+ blue: (str: string) => string;
25
+ magenta: (str: string) => string;
26
+ white: (str: string) => string;
27
+ gray: (str: string) => string;
28
+ bgBlack: (str: string) => string;
29
+ bgRed: (str: string) => string;
30
+ bgGreen: (str: string) => string;
31
+ bgYellow: (str: string) => string;
32
+ bgBlue: (str: string) => string;
33
+ bgMagenta: (str: string) => string;
34
+ bgWhite: (str: string) => string;
35
+ blackBright: (str: string) => string;
36
+ redBright: (str: string) => string;
37
+ greenBright: (str: string) => string;
38
+ yellowBright: (str: string) => string;
39
+ blueBright: (str: string) => string;
40
+ magentaBright: (str: string) => string;
41
+ whiteBright: (str: string) => string;
42
+ bgBlackBright: (str: string) => string;
43
+ bgRedBright: (str: string) => string;
44
+ bgGreenBright: (str: string) => string;
45
+ bgYellowBright: (str: string) => string;
46
+ bgBlueBright: (str: string) => string;
47
+ bgMagentaBright: (str: string) => string;
48
+ bgWhiteBright: (str: string) => string;
56
49
  };
57
- export declare const chalk: ColorsWithMethods;
58
- export {};
@@ -1,138 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.chalk = void 0;
4
- const hasColor = () => {
5
- if (typeof process !== 'undefined') {
6
- return process.env.FORCE_COLOR !== '0';
7
- }
8
- return false;
9
- };
10
- exports.chalk = (() => {
11
- const colors = {
12
- enabled: hasColor(),
13
- visible: true,
14
- styles: {},
15
- keys: {},
16
- };
17
- const ansi = (st) => {
18
- const open = `\u001b[${st.codes[0]}m`;
19
- const close = `\u001b[${st.codes[1]}m`;
20
- const regex = new RegExp(`\\u001b\\[${st.codes[1]}m`, 'g');
21
- st.wrap = (input, newline) => {
22
- if (input.includes(close))
23
- input = input.replace(regex, close + open);
24
- const output = open + input + close;
25
- // see https://github.com/chalk/chalk/pull/92, thanks to the
26
- // chalk contributors for this fix. However, we've confirmed that
27
- // this issue is also present in Windows terminals
28
- return newline ? output.replace(/\r*\n/g, `${close}$&${open}`) : output;
29
- };
30
- return st;
31
- };
32
- const wrap = (sty, input, newline) => {
33
- var _a;
34
- return (_a = sty.wrap) === null || _a === void 0 ? void 0 : _a.call(sty, input, newline);
35
- };
36
- const style = (input, stack) => {
37
- if (input === '' || input === null || input === undefined)
38
- return '';
39
- if (colors.enabled === false)
40
- return input;
41
- if (colors.visible === false)
42
- return '';
43
- let str = String(input);
44
- const nl = str.includes('\n');
45
- let n = stack.length;
46
- while (n-- > 0)
47
- str = wrap(colors.styles[stack[n]], str, nl);
48
- return str;
49
- };
50
- const define = (name, codes, type) => {
51
- colors.styles[name] = ansi({ name, codes });
52
- const keys = colors.keys[type] || (colors.keys[type] = []);
53
- keys.push(name);
54
- Reflect.defineProperty(colors, name, {
55
- configurable: true,
56
- enumerable: true,
57
- set(value) {
58
- var _a;
59
- (_a = colors.alias) === null || _a === void 0 ? void 0 : _a.call(colors, name, value);
60
- },
61
- get() {
62
- const color = (input) => style(input, color.stack);
63
- Reflect.setPrototypeOf(color, colors);
64
- color.stack = this.stack ? this.stack.concat(name) : [name];
65
- return color;
66
- },
67
- });
68
- };
69
- define('reset', [0, 0], 'modifier');
70
- define('bold', [1, 22], 'modifier');
71
- define('dim', [2, 22], 'modifier');
72
- define('italic', [3, 23], 'modifier');
73
- define('underline', [4, 24], 'modifier');
74
- define('inverse', [7, 27], 'modifier');
75
- define('hidden', [8, 28], 'modifier');
76
- define('strikethrough', [9, 29], 'modifier');
77
- define('black', [30, 39], 'color');
78
- define('red', [31, 39], 'color');
79
- define('green', [32, 39], 'color');
80
- define('yellow', [33, 39], 'color');
81
- define('blue', [34, 39], 'color');
82
- define('magenta', [35, 39], 'color');
83
- define('cyan', [36, 39], 'color');
84
- define('white', [37, 39], 'color');
85
- define('gray', [90, 39], 'color');
86
- define('grey', [90, 39], 'color');
87
- define('bgBlack', [40, 49], 'bg');
88
- define('bgRed', [41, 49], 'bg');
89
- define('bgGreen', [42, 49], 'bg');
90
- define('bgYellow', [43, 49], 'bg');
91
- define('bgBlue', [44, 49], 'bg');
92
- define('bgMagenta', [45, 49], 'bg');
93
- define('bgCyan', [46, 49], 'bg');
94
- define('bgWhite', [47, 49], 'bg');
95
- define('blackBright', [90, 39], 'bright');
96
- define('redBright', [91, 39], 'bright');
97
- define('greenBright', [92, 39], 'bright');
98
- define('yellowBright', [93, 39], 'bright');
99
- define('blueBright', [94, 39], 'bright');
100
- define('magentaBright', [95, 39], 'bright');
101
- define('cyanBright', [96, 39], 'bright');
102
- define('whiteBright', [97, 39], 'bright');
103
- define('bgBlackBright', [100, 49], 'bgBright');
104
- define('bgRedBright', [101, 49], 'bgBright');
105
- define('bgGreenBright', [102, 49], 'bgBright');
106
- define('bgYellowBright', [103, 49], 'bgBright');
107
- define('bgBlueBright', [104, 49], 'bgBright');
108
- define('bgMagentaBright', [105, 49], 'bgBright');
109
- define('bgCyanBright', [106, 49], 'bgBright');
110
- define('bgWhiteBright', [107, 49], 'bgBright');
111
- colors.alias = (name, color) => {
112
- // @ts-expect-error
113
- const fn = colors[color];
114
- if (typeof fn !== 'function') {
115
- throw new TypeError('Expected alias to be the name of an existing color (string) or a function');
116
- }
117
- if (!fn.stack) {
118
- Reflect.defineProperty(fn, 'name', { value: name });
119
- colors.styles[name] = fn;
120
- fn.stack = [name];
121
- }
122
- Reflect.defineProperty(colors, name, {
123
- configurable: true,
124
- enumerable: true,
125
- set(value) {
126
- var _a;
127
- (_a = colors.alias) === null || _a === void 0 ? void 0 : _a.call(colors, name, value);
128
- },
129
- get() {
130
- const col = (input) => style(input, col.stack);
131
- Reflect.setPrototypeOf(col, colors);
132
- col.stack = this.stack ? this.stack.concat(fn.stack) : fn.stack;
133
- return col;
134
- },
135
- });
136
- };
137
- return colors;
138
- })();
4
+ const renderer_1 = require("@remotion/renderer");
5
+ exports.chalk = renderer_1.RenderInternals.chalk;
@@ -0,0 +1,5 @@
1
+ import type { EnumPath } from '../editor/components/RenderModal/SchemaEditor/extract-enum-json-paths';
2
+ export declare const stringifyDefaultProps: ({ props, enumPaths, }: {
3
+ props: unknown;
4
+ enumPaths: EnumPath[];
5
+ }) => string;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stringifyDefaultProps = void 0;
4
+ const input_props_serialization_1 = require("../editor/components/RenderModal/SchemaEditor/input-props-serialization");
5
+ const doesMatchPath = (path1, enumPaths) => {
6
+ return enumPaths.some((p) => path1.every((item, index) => {
7
+ if (p[index] === '[]' && !Number.isNaN(Number(item))) {
8
+ return true;
9
+ }
10
+ if (p[index] === '{}' && typeof item === 'string') {
11
+ return true;
12
+ }
13
+ return item === p[index];
14
+ }));
15
+ };
16
+ const stringifyDefaultProps = ({ props, enumPaths, }) => JSON.stringify(props, replacerWithPath(function (key, value, path) {
17
+ /* Don't replace with arrow function */ const item = this[key];
18
+ if (item instanceof Date) {
19
+ return `__REMOVEQUOTE__new Date('${item.toISOString()}')__REMOVEQUOTE__`;
20
+ }
21
+ if (typeof item === 'string' && doesMatchPath(path, enumPaths)) {
22
+ return `${item}__ADD_AS_CONST__`;
23
+ }
24
+ if (typeof item === 'string' && item.startsWith(input_props_serialization_1.FILE_TOKEN)) {
25
+ return `__REMOVEQUOTE____WRAP_IN_STATIC_FILE_START__${decodeURIComponent(item.replace(input_props_serialization_1.FILE_TOKEN, ''))}__WRAP_IN_STATIC_FILE_END____REMOVEQUOTE__`;
26
+ }
27
+ return value;
28
+ }))
29
+ .replace(/"__REMOVEQUOTE__/g, '')
30
+ .replace(/__REMOVEQUOTE__"/g, '')
31
+ .replace(/__ADD_AS_CONST__"/g, '" as const')
32
+ .replace(/__WRAP_IN_STATIC_FILE_START__/g, 'staticFile("')
33
+ .replace(/__WRAP_IN_STATIC_FILE_END__/g, '")');
34
+ exports.stringifyDefaultProps = stringifyDefaultProps;
35
+ function replacerWithPath(replacer) {
36
+ const m = new Map();
37
+ return function (field, value) {
38
+ const path = [m.get(this), field].flat(1);
39
+ if (value === Object(value)) {
40
+ m.set(value, path);
41
+ }
42
+ return replacer.call(this, field, value, path.filter((item) => typeof item !== 'undefined' && item !== ''));
43
+ };
44
+ }
@@ -1,5 +1,7 @@
1
- export declare const updateDefaultProps: ({ input, compositionId, newDefaultProps, }: {
1
+ import type { EnumPath } from '../editor/components/RenderModal/SchemaEditor/extract-enum-json-paths';
2
+ export declare const updateDefaultProps: ({ input, compositionId, newDefaultProps, enumPaths, }: {
2
3
  input: string;
3
4
  compositionId: string;
4
5
  newDefaultProps: unknown;
6
+ enumPaths: EnumPath[];
5
7
  }) => Promise<string>;
@@ -24,6 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.updateDefaultProps = void 0;
27
+ const stringify_with_path_1 = require("./stringify-with-path");
27
28
  const findStarter = ({ input, compositionId, }) => {
28
29
  const format1 = input.indexOf(`id="${compositionId}"`);
29
30
  if (format1 > -1) {
@@ -85,23 +86,8 @@ const findTerminators = (input, position) => {
85
86
  }
86
87
  return Infinity;
87
88
  };
88
- const stringifyDefaultProps = (props) => {
89
- // Don't replace with arrow function
90
- return JSON.stringify(props, function (key, value) {
91
- if (this[key] instanceof Date) {
92
- return `__REMOVEQUOTE__new Date('${new Date(this[key]).toISOString()}')__REMOVEQUOTE__`;
93
- }
94
- if (typeof this[key] === 'string') {
95
- return `${this[key]}__ADD_AS_CONST__`;
96
- }
97
- return value;
98
- })
99
- .replace(/"__REMOVEQUOTE__/g, '')
100
- .replace(/__REMOVEQUOTE__"/g, '')
101
- .replace(/__ADD_AS_CONST__"/g, '" as const');
102
- };
103
89
  // TODO: Add more sanity checks
104
- const updateDefaultProps = async ({ input, compositionId, newDefaultProps, }) => {
90
+ const updateDefaultProps = async ({ input, compositionId, newDefaultProps, enumPaths, }) => {
105
91
  const starter = findStarter({ input, compositionId });
106
92
  const START_TOKEN = 'defaultProps={';
107
93
  const start = input.indexOf(START_TOKEN, starter);
@@ -120,7 +106,7 @@ const updateDefaultProps = async ({ input, compositionId, newDefaultProps, }) =>
120
106
  }
121
107
  const { format, resolveConfig, resolveConfigFile } = prettier;
122
108
  const newFile = input.substring(0, startPos) +
123
- stringifyDefaultProps(newDefaultProps) +
109
+ (0, stringify_with_path_1.stringifyDefaultProps)({ props: newDefaultProps, enumPaths }) +
124
110
  input.substring(endPos);
125
111
  const configFilePath = await resolveConfigFile();
126
112
  if (!configFilePath) {
@@ -39,6 +39,7 @@ const listCompositionsCommand = async (remotionRoot, args) => {
39
39
  onDirectoryCreated: (dir) => {
40
40
  (0, cleanup_before_quit_1.registerCleanupJob)(() => renderer_1.RenderInternals.deleteDirectory(dir));
41
41
  },
42
+ quietProgress: false,
42
43
  });
43
44
  (0, cleanup_before_quit_1.registerCleanupJob)(() => cleanupBundle());
44
45
  const compositions = await (0, renderer_1.getCompositions)(bundled, {
@@ -1,3 +1 @@
1
- import type { LogLevel } from '@remotion/renderer';
2
- export declare const getLogLevel: () => "verbose" | "info" | "warn" | "error";
3
- export declare const setLogLevel: (newLogLevel: LogLevel) => void;
1
+ export declare const getLogLevel: () => "verbose" | "info" | "warn" | "error", setLogLevel: (newLogLevel: "verbose" | "info" | "warn" | "error") => void;
@@ -1,12 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setLogLevel = exports.getLogLevel = void 0;
4
- let logLevel = 'info';
5
- const getLogLevel = () => {
6
- return logLevel;
7
- };
8
- exports.getLogLevel = getLogLevel;
9
- const setLogLevel = (newLogLevel) => {
10
- logLevel = newLogLevel;
11
- };
12
- exports.setLogLevel = setLogLevel;
4
+ const renderer_1 = require("@remotion/renderer");
5
+ exports.getLogLevel = renderer_1.RenderInternals.getLogLevel, exports.setLogLevel = renderer_1.RenderInternals.setLogLevel;
@@ -1,3 +1,3 @@
1
1
  import type { DownloadProgress } from './progress-types';
2
2
  export declare const getFileSizeDownloadBar: (downloaded: number) => string;
3
- export declare const makeMultiDownloadProgress: (progresses: DownloadProgress[], indent: boolean) => string | null;
3
+ export declare const makeMultiDownloadProgress: (progresses: DownloadProgress[]) => string | null;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeMultiDownloadProgress = exports.getFileSizeDownloadBar = void 0;
4
4
  const format_bytes_1 = require("./format-bytes");
5
- const log_1 = require("./log");
6
5
  const make_progress_bar_1 = require("./make-progress-bar");
7
6
  const truthy_1 = require("./truthy");
8
7
  const getFileSizeDownloadBar = (downloaded) => {
@@ -10,7 +9,7 @@ const getFileSizeDownloadBar = (downloaded) => {
10
9
  return `[${(0, format_bytes_1.formatBytes)(downloaded).padEnd(desiredLength - 2, ' ')}]`;
11
10
  };
12
11
  exports.getFileSizeDownloadBar = getFileSizeDownloadBar;
13
- const makeMultiDownloadProgress = (progresses, indent) => {
12
+ const makeMultiDownloadProgress = (progresses) => {
14
13
  if (progresses.length === 0) {
15
14
  return null;
16
15
  }
@@ -20,7 +19,6 @@ const makeMultiDownloadProgress = (progresses, indent) => {
20
19
  ? progress.name.substring(0, 57) + '...'
21
20
  : progress.name;
22
21
  return [
23
- indent ? log_1.INDENT_TOKEN : null,
24
22
  ` +`,
25
23
  progress.progress
26
24
  ? (0, make_progress_bar_1.makeProgressBar)(progress.progress)
@@ -32,8 +30,6 @@ const makeMultiDownloadProgress = (progresses, indent) => {
32
30
  }
33
31
  const everyFileHasContentLength = progresses.every((p) => p.totalBytes !== null);
34
32
  return [
35
- indent ? log_1.INDENT_TOKEN : null,
36
- // TODO: Shifted 1 character to the right in v4
37
33
  ` +`,
38
34
  everyFileHasContentLength
39
35
  ? (0, make_progress_bar_1.makeProgressBar)(progresses.reduce((a, b) => a + b.progress, 0) /
@@ -3,12 +3,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MenuBuildIndicator = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
+ const client_id_1 = require("../helpers/client-id");
7
+ const layout_1 = require("./layout");
8
+ const OpenEditorButton_1 = require("./OpenEditorButton");
9
+ const Spinner_1 = require("./Spinner");
6
10
  const cwd = {
7
11
  fontSize: 13,
8
12
  opacity: 0.8,
13
+ display: 'flex',
14
+ alignItems: 'center',
15
+ justifyContent: 'center',
16
+ };
17
+ const spinnerSize = 14;
18
+ const spinner = {
19
+ position: 'relative',
20
+ width: spinnerSize,
21
+ marginTop: 4,
22
+ };
23
+ const noSpinner = {
24
+ position: 'relative',
25
+ width: spinnerSize,
9
26
  };
10
27
  const MenuBuildIndicator = () => {
11
28
  const [isBuilding, setIsBuilding] = (0, react_1.useState)(false);
29
+ const ctx = (0, react_1.useContext)(client_id_1.PreviewServerConnectionCtx);
30
+ const showButton = window.remotion_editorName && ctx.type === 'connected';
12
31
  (0, react_1.useEffect)(() => {
13
32
  window.remotion_isBuilding = () => {
14
33
  setIsBuilding(true);
@@ -21,6 +40,6 @@ const MenuBuildIndicator = () => {
21
40
  window.remotion_finishedBuilding = undefined;
22
41
  };
23
42
  }, []);
24
- return ((0, jsx_runtime_1.jsx)("div", { style: cwd, title: window.remotion_cwd, children: isBuilding ? 'Building...' : window.remotion_projectName }));
43
+ return ((0, jsx_runtime_1.jsxs)("div", { style: cwd, title: window.remotion_cwd, children: [showButton ? (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 2 }) : null, isBuilding ? ((0, jsx_runtime_1.jsx)("div", { style: spinner, children: (0, jsx_runtime_1.jsx)(Spinner_1.Spinner, { size: spinnerSize }) })) : ((0, jsx_runtime_1.jsx)("div", { style: noSpinner })), showButton ? (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 0.5 }) : null, window.remotion_projectName, showButton ? (0, jsx_runtime_1.jsx)(OpenEditorButton_1.OpenEditorButton, {}) : null] }));
25
44
  };
26
45
  exports.MenuBuildIndicator = MenuBuildIndicator;
@@ -16,7 +16,7 @@ const UpdateModal_1 = require("./UpdateModal/UpdateModal");
16
16
  const Modals = () => {
17
17
  const { selectedModal: modalContextType } = (0, react_1.useContext)(modals_1.ModalsContext);
18
18
  const canRender = (0, react_1.useContext)(client_id_1.PreviewServerConnectionCtx).type === 'connected';
19
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [modalContextType && modalContextType.type === 'new-comp' && ((0, jsx_runtime_1.jsx)(NewComposition_1.default, { initialCompType: modalContextType.compType })), modalContextType && canRender && modalContextType.type === 'render' && ((0, jsx_runtime_1.jsx)(RenderModal_1.RenderModal, { initialFrame: modalContextType.initialFrame, compositionId: modalContextType.compositionId, initialVideoImageFormat: modalContextType.initialVideoImageFormat, initialJpegQuality: modalContextType.initialJpegQuality, initialOutName: modalContextType.initialOutName, initialScale: modalContextType.initialScale, initialVerbose: modalContextType.initialVerbose, initialRenderType: modalContextType.initialRenderType, initialVideoCodecForAudioTab: modalContextType.initialVideoCodecForAudioTab, initialVideoCodecForVideoTab: modalContextType.initialVideoCodecForVideoTab, initialConcurrency: modalContextType.initialConcurrency, maxConcurrency: modalContextType.maxConcurrency, minConcurrency: modalContextType.minConcurrency, initialStillImageFormat: modalContextType.initialStillImageFormat, initialMuted: modalContextType.initialMuted, initialEnforceAudioTrack: modalContextType.initialEnforceAudioTrack, initialProResProfile: modalContextType.initialProResProfile, initialPixelFormat: modalContextType.initialPixelFormat, initialAudioBitrate: modalContextType.initialAudioBitrate, initialVideoBitrate: modalContextType.initialVideoBitrate, initialEveryNthFrame: modalContextType.initialEveryNthFrame, initialNumberOfGifLoops: modalContextType.initialNumberOfGifLoops, initialDelayRenderTimeout: modalContextType.initialDelayRenderTimeout, initialAudioCodec: modalContextType.initialAudioCodec, initialEnvVariables: modalContextType.initialEnvVariables, initialDisableWebSecurity: modalContextType.initialDisableWebSecurity, initialGl: modalContextType.initialOpenGlRenderer, initialHeadless: modalContextType.initialHeadless, initialIgnoreCertificateErrors: modalContextType.initialIgnoreCertificateErrors, defaultProps: modalContextType.defaultProps })), modalContextType &&
19
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [modalContextType && modalContextType.type === 'new-comp' && ((0, jsx_runtime_1.jsx)(NewComposition_1.default, { initialCompType: modalContextType.compType })), modalContextType && canRender && modalContextType.type === 'render' && ((0, jsx_runtime_1.jsx)(RenderModal_1.RenderModal, { initialFrame: modalContextType.initialFrame, compositionId: modalContextType.compositionId, initialVideoImageFormat: modalContextType.initialVideoImageFormat, initialJpegQuality: modalContextType.initialJpegQuality, initialOutName: modalContextType.initialOutName, initialScale: modalContextType.initialScale, initialVerbose: modalContextType.initialVerbose, initialRenderType: modalContextType.initialRenderType, initialVideoCodecForAudioTab: modalContextType.initialVideoCodecForAudioTab, initialVideoCodecForVideoTab: modalContextType.initialVideoCodecForVideoTab, initialConcurrency: modalContextType.initialConcurrency, maxConcurrency: modalContextType.maxConcurrency, minConcurrency: modalContextType.minConcurrency, initialStillImageFormat: modalContextType.initialStillImageFormat, initialMuted: modalContextType.initialMuted, initialEnforceAudioTrack: modalContextType.initialEnforceAudioTrack, initialProResProfile: modalContextType.initialProResProfile, initialPixelFormat: modalContextType.initialPixelFormat, initialAudioBitrate: modalContextType.initialAudioBitrate, initialVideoBitrate: modalContextType.initialVideoBitrate, initialEveryNthFrame: modalContextType.initialEveryNthFrame, initialNumberOfGifLoops: modalContextType.initialNumberOfGifLoops, initialDelayRenderTimeout: modalContextType.initialDelayRenderTimeout, initialAudioCodec: modalContextType.initialAudioCodec, initialEnvVariables: modalContextType.initialEnvVariables, initialDisableWebSecurity: modalContextType.initialDisableWebSecurity, initialGl: modalContextType.initialOpenGlRenderer, initialHeadless: modalContextType.initialHeadless, initialIgnoreCertificateErrors: modalContextType.initialIgnoreCertificateErrors, defaultProps: modalContextType.defaultProps, inFrameMark: modalContextType.inFrameMark, outFrameMark: modalContextType.outFrameMark })), modalContextType &&
20
20
  canRender &&
21
21
  modalContextType.type === 'render-progress' && ((0, jsx_runtime_1.jsx)(RenderStatusModal_1.RenderStatusModal, { jobId: modalContextType.jobId })), modalContextType && modalContextType.type === 'update' && ((0, jsx_runtime_1.jsx)(UpdateModal_1.UpdateModal, { info: modalContextType.info })), modalContextType && modalContextType.type === 'quick-switcher' && ((0, jsx_runtime_1.jsx)(QuickSwitcher_1.default, { invocationTimestamp: modalContextType.invocationTimestamp, initialMode: modalContextType.mode }))] }));
22
22
  };
@@ -137,8 +137,8 @@ const Combobox = ({ values, selectedId, style: customStyle, title }) => {
137
137
  : colors_1.INPUT_BORDER_COLOR_UNHOVERED,
138
138
  };
139
139
  }, [customStyle, hovered, opened]);
140
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("button", { ref: ref, title: title, tabIndex: tabIndex, type: "button", style: style, className: is_menu_item_1.MENU_INITIATOR_CLASSNAME, children: [(0, jsx_runtime_1.jsx)("div", { title: typeof selected.label === 'string' ? selected.label : undefined, style: label, children: selected === null || selected === void 0 ? void 0 : selected.label }), (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), " ", (0, jsx_runtime_1.jsx)(caret_1.CaretDown, {})] }), portalStyle
141
- ? react_dom_1.default.createPortal((0, jsx_runtime_1.jsx)("div", { style: styles_1.fullScreenOverlay, children: (0, jsx_runtime_1.jsx)("div", { style: styles_1.outerPortal, className: "css-reset", children: (0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onOutsideClick: onHide, onEscape: onHide, children: (0, jsx_runtime_1.jsx)("div", { style: portalStyle, children: (0, jsx_runtime_1.jsx)(MenuContent_1.MenuContent, { onNextMenu: noop_1.noop, onPreviousMenu: noop_1.noop, values: values, onHide: onHide, leaveLeftSpace: true, preselectIndex: values.findIndex((v) => v.id === selected.id), topItemCanBeUnselected: false }) }) }) }) }), (0, portals_1.getPortal)(currentZIndex))
140
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("button", { ref: ref, title: title, tabIndex: tabIndex, type: "button", style: style, className: is_menu_item_1.MENU_INITIATOR_CLASSNAME, children: [selected ? ((0, jsx_runtime_1.jsx)("div", { title: typeof selected.label === 'string' ? selected.label : undefined, style: label, children: selected === null || selected === void 0 ? void 0 : selected.label })) : null, (0, jsx_runtime_1.jsx)(layout_1.Spacing, { x: 1 }), " ", (0, jsx_runtime_1.jsx)(caret_1.CaretDown, {})] }), portalStyle
141
+ ? react_dom_1.default.createPortal((0, jsx_runtime_1.jsx)("div", { style: styles_1.fullScreenOverlay, children: (0, jsx_runtime_1.jsx)("div", { style: styles_1.outerPortal, className: "css-reset", children: (0, jsx_runtime_1.jsx)(z_index_1.HigherZIndex, { onOutsideClick: onHide, onEscape: onHide, children: (0, jsx_runtime_1.jsx)("div", { style: portalStyle, children: (0, jsx_runtime_1.jsx)(MenuContent_1.MenuContent, { onNextMenu: noop_1.noop, onPreviousMenu: noop_1.noop, values: values, onHide: onHide, leaveLeftSpace: true, preselectIndex: values.findIndex((v) => selected && v.id === selected.id), topItemCanBeUnselected: false }) }) }) }) }), (0, portals_1.getPortal)(currentZIndex))
142
142
  : null] }));
143
143
  };
144
144
  exports.Combobox = Combobox;
@@ -28,7 +28,7 @@ const MenuContent = ({ onHide, values, preselectIndex, onNextMenu, onPreviousMen
28
28
  if (values[0].type === 'divider') {
29
29
  throw new Error('first value cant be divide');
30
30
  }
31
- const [selectedItem, setSelectedItem] = (0, react_1.useState)(typeof preselectIndex === 'number'
31
+ const [selectedItem, setSelectedItem] = (0, react_1.useState)(typeof preselectIndex === 'number' && preselectIndex >= 0
32
32
  ? values[preselectIndex].id
33
33
  : null);
34
34
  const onEscape = (0, react_1.useCallback)(() => {
@@ -13,5 +13,5 @@ export declare const getInputBorderColor: ({ status, isFocused, isHovered, }: {
13
13
  isFocused: boolean;
14
14
  isHovered: boolean;
15
15
  }) => "hsla(0, 0%, 100%, 0.15)" | "rgba(0, 0, 0, 0.6)" | "rgba(255, 255, 255, 0.05)" | "#ff3232" | "#f1c40f";
16
- export declare const RemotionInput: React.ForwardRefExoticComponent<Pick<Props, "key" | "status" | "rightAlign" | keyof React.InputHTMLAttributes<HTMLInputElement>> & React.RefAttributes<HTMLInputElement>>;
16
+ export declare const RemotionInput: React.ForwardRefExoticComponent<Pick<Props, "status" | "key" | "rightAlign" | keyof React.InputHTMLAttributes<HTMLInputElement>> & React.RefAttributes<HTMLInputElement>>;
17
17
  export {};
@@ -3,5 +3,5 @@ import type { RemInputStatus } from './RemInput';
3
3
  declare type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> & {
4
4
  status: RemInputStatus;
5
5
  };
6
- export declare const RemInputTypeColor: React.ForwardRefExoticComponent<Pick<Props, "key" | "status" | keyof React.InputHTMLAttributes<HTMLInputElement>> & React.RefAttributes<HTMLInputElement>>;
6
+ export declare const RemInputTypeColor: React.ForwardRefExoticComponent<Pick<Props, "status" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> & React.RefAttributes<HTMLInputElement>>;
7
7
  export {};
@@ -3,5 +3,5 @@ declare type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLTextA
3
3
  status: 'error' | 'warning' | 'ok';
4
4
  };
5
5
  export declare const inputBaseStyle: React.CSSProperties;
6
- export declare const RemTextarea: React.ForwardRefExoticComponent<Pick<Props, "key" | "status" | keyof React.InputHTMLAttributes<HTMLTextAreaElement>> & React.RefAttributes<HTMLTextAreaElement>>;
6
+ export declare const RemTextarea: React.ForwardRefExoticComponent<Pick<Props, "status" | "key" | keyof React.InputHTMLAttributes<HTMLTextAreaElement>> & React.RefAttributes<HTMLTextAreaElement>>;
7
7
  export {};
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const OpenEditorButton: React.FC<{}>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenEditorButton = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const colors_1 = require("../helpers/colors");
7
+ const open_in_editor_1 = require("../helpers/open-in-editor");
8
+ const NotificationCenter_1 = require("./Notifications/NotificationCenter");
9
+ const svgStyle = {
10
+ width: '11px',
11
+ height: '11px',
12
+ };
13
+ const buttonStyle = {
14
+ border: 'none',
15
+ width: '25px',
16
+ height: '25px',
17
+ };
18
+ const OpenEditorButton = () => {
19
+ const [hovered, setHovered] = (0, react_1.useState)(false);
20
+ const svgFillColor = (0, react_1.useMemo)(() => {
21
+ return hovered ? 'white' : colors_1.LIGHT_TEXT;
22
+ }, [hovered]);
23
+ const handleClick = async () => {
24
+ await (0, open_in_editor_1.openInEditor)({
25
+ originalFileName: `${window.remotion_cwd}`,
26
+ originalLineNumber: 1,
27
+ originalColumnNumber: 1,
28
+ originalFunctionName: null,
29
+ originalScriptCode: null,
30
+ })
31
+ .then((res) => res.json())
32
+ .then(({ success }) => {
33
+ if (!success) {
34
+ (0, NotificationCenter_1.sendErrorNotification)(`Could not open ${window.remotion_editorName}`);
35
+ }
36
+ })
37
+ .catch((err) => {
38
+ console.error(err);
39
+ (0, NotificationCenter_1.sendErrorNotification)(`Could not open ${window.remotion_editorName}`);
40
+ });
41
+ };
42
+ const buttonTooltip = `Open in ${window.remotion_editorName}`;
43
+ const openInEditorSvg = ((0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 512 512", style: svgStyle, children: (0, jsx_runtime_1.jsx)("path", { fill: svgFillColor, d: "M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32h82.7L201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3V192c0 17.7 14.3 32 32 32s32-14.3 32-32V32c0-17.7-14.3-32-32-32H320zM80 32C35.8 32 0 67.8 0 112V432c0 44.2 35.8 80 80 80H400c44.2 0 80-35.8 80-80V320c0-17.7-14.3-32-32-32s-32 14.3-32 32V432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16H192c17.7 0 32-14.3 32-32s-14.3-32-32-32H80z" }) }));
44
+ const onPointerEnter = (0, react_1.useCallback)(() => {
45
+ setHovered(true);
46
+ }, []);
47
+ const onPointerLeave = (0, react_1.useCallback)(() => {
48
+ setHovered(false);
49
+ }, []);
50
+ return ((0, jsx_runtime_1.jsx)("button", { title: buttonTooltip, type: "button", onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, style: buttonStyle, onClick: handleClick, children: openInEditorSvg }));
51
+ };
52
+ exports.OpenEditorButton = OpenEditorButton;