@remotion/studio-server 4.0.469 → 4.0.471

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 (68) hide show
  1. package/dist/codemods/add-effect.d.ts +15 -0
  2. package/dist/codemods/add-effect.js +231 -0
  3. package/dist/codemods/delete-effect.d.ts +18 -0
  4. package/dist/codemods/delete-effect.js +95 -21
  5. package/dist/codemods/delete-jsx-node.d.ts +10 -0
  6. package/dist/codemods/delete-jsx-node.js +38 -14
  7. package/dist/codemods/reorder-effect.d.ts +13 -0
  8. package/dist/codemods/reorder-effect.js +61 -0
  9. package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.d.ts +4 -0
  10. package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.js +152 -0
  11. package/dist/codemods/update-keyframes/update-keyframes.d.ts +12 -0
  12. package/dist/codemods/update-keyframes/update-keyframes.js +116 -31
  13. package/dist/codemods/update-sequence-props/update-sequence-props.d.ts +32 -10
  14. package/dist/codemods/update-sequence-props/update-sequence-props.js +39 -7
  15. package/dist/helpers/open-in-editor.d.ts +2 -2
  16. package/dist/helpers/open-in-editor.js +35 -2
  17. package/dist/helpers/resolve-composition-component.d.ts +15 -0
  18. package/dist/helpers/resolve-composition-component.js +269 -31
  19. package/dist/index.d.ts +2 -1
  20. package/dist/preview-server/api-routes.js +20 -0
  21. package/dist/preview-server/routes/add-effect-keyframe.d.ts +3 -0
  22. package/dist/preview-server/routes/add-effect-keyframe.js +91 -0
  23. package/dist/preview-server/routes/add-effect.d.ts +3 -0
  24. package/dist/preview-server/routes/add-effect.js +68 -0
  25. package/dist/preview-server/routes/add-sequence-keyframe.d.ts +3 -0
  26. package/dist/preview-server/routes/add-sequence-keyframe.js +87 -0
  27. package/dist/preview-server/routes/apply-codemod.js +1 -0
  28. package/dist/preview-server/routes/apply-visual-control-change.js +1 -0
  29. package/dist/preview-server/routes/can-update-sequence-props.d.ts +1 -0
  30. package/dist/preview-server/routes/can-update-sequence-props.js +48 -14
  31. package/dist/preview-server/routes/composition-component-info.d.ts +3 -0
  32. package/dist/preview-server/routes/composition-component-info.js +26 -0
  33. package/dist/preview-server/routes/delete-effect-keyframe.d.ts +3 -0
  34. package/dist/preview-server/routes/delete-effect-keyframe.js +89 -0
  35. package/dist/preview-server/routes/delete-effect.js +76 -37
  36. package/dist/preview-server/routes/delete-jsx-node.js +67 -36
  37. package/dist/preview-server/routes/delete-keyframes.d.ts +13 -0
  38. package/dist/preview-server/routes/delete-keyframes.js +263 -0
  39. package/dist/preview-server/routes/delete-sequence-keyframe.d.ts +3 -0
  40. package/dist/preview-server/routes/delete-sequence-keyframe.js +82 -0
  41. package/dist/preview-server/routes/duplicate-jsx-node.js +1 -0
  42. package/dist/preview-server/routes/insert-jsx-element.d.ts +3 -0
  43. package/dist/preview-server/routes/insert-jsx-element.js +79 -0
  44. package/dist/preview-server/routes/open-in-editor.d.ts +4 -0
  45. package/dist/preview-server/routes/open-in-editor.js +40 -0
  46. package/dist/preview-server/routes/register-client-render.d.ts +3 -0
  47. package/dist/preview-server/routes/register-client-render.js +11 -0
  48. package/dist/preview-server/routes/reorder-effect.d.ts +3 -0
  49. package/dist/preview-server/routes/reorder-effect.js +67 -0
  50. package/dist/preview-server/routes/save-effect-props.js +1 -0
  51. package/dist/preview-server/routes/save-sequence-props.js +158 -72
  52. package/dist/preview-server/routes/subscribe-to-sequence-props.js +2 -1
  53. package/dist/preview-server/routes/unregister-client-render.d.ts +4 -0
  54. package/dist/preview-server/routes/unregister-client-render.js +11 -0
  55. package/dist/preview-server/routes/update-default-props.js +1 -0
  56. package/dist/preview-server/sequence-props-watchers.d.ts +2 -1
  57. package/dist/preview-server/sequence-props-watchers.js +22 -2
  58. package/dist/preview-server/start-server.d.ts +1 -0
  59. package/dist/preview-server/start-server.js +1 -0
  60. package/dist/preview-server/undo-stack.d.ts +35 -4
  61. package/dist/preview-server/undo-stack.js +130 -42
  62. package/dist/preview-server/validate-same-origin.d.ts +2 -0
  63. package/dist/preview-server/validate-same-origin.js +13 -0
  64. package/dist/routes.d.ts +2 -1
  65. package/dist/routes.js +9 -136
  66. package/dist/start-studio.d.ts +2 -1
  67. package/dist/start-studio.js +2 -1
  68. package/package.json +6 -6
@@ -136,6 +136,15 @@ const editorNames = [
136
136
  '/Applications/Windsurf.app/Contents/MacOS/Windsurf',
137
137
  'Windsurf.exe',
138
138
  'zed',
139
+ 'zedit',
140
+ 'zeditor',
141
+ 'zed-editor',
142
+ '/Applications/Zed.app/Contents/MacOS/zed',
143
+ '/Applications/Zed.app/Contents/MacOS/cli',
144
+ '/Applications/Zed Preview.app/Contents/MacOS/zed',
145
+ '/Applications/Zed Preview.app/Contents/MacOS/cli',
146
+ '/Applications/Zed Preview.app/Contents/MacOS/Zed Preview',
147
+ 'Zed.exe',
139
148
  ];
140
149
  const displayNameForEditor = {
141
150
  '/Applications/AppCode.app/Contents/MacOS/appcode': 'AppCode',
@@ -159,6 +168,7 @@ const displayNameForEditor = {
159
168
  'Code.exe': 'VS Code',
160
169
  'Cursor.exe': 'Cursor',
161
170
  'Windsurf.exe': 'Windsurf',
171
+ 'Zed.exe': 'Zed',
162
172
  'VSCodium.exe': 'VS Codium',
163
173
  'atom.exe': 'Atom',
164
174
  'clion.exe': 'CLion',
@@ -186,6 +196,14 @@ const displayNameForEditor = {
186
196
  cursor: 'Cursor',
187
197
  windsurf: 'Windsurf',
188
198
  zed: 'Zed',
199
+ zedit: 'Zed',
200
+ zeditor: 'Zed',
201
+ 'zed-editor': 'Zed',
202
+ '/Applications/Zed.app/Contents/MacOS/zed': 'Zed',
203
+ '/Applications/Zed.app/Contents/MacOS/cli': 'Zed',
204
+ '/Applications/Zed Preview.app/Contents/MacOS/zed': 'Zed Preview',
205
+ '/Applications/Zed Preview.app/Contents/MacOS/cli': 'Zed Preview',
206
+ '/Applications/Zed Preview.app/Contents/MacOS/Zed Preview': 'Zed Preview',
189
207
  emacs: 'emacs',
190
208
  goland: 'GoLand',
191
209
  gvim: 'GVim',
@@ -228,6 +246,9 @@ const COMMON_EDITORS_OSX = {
228
246
  '/Applications/VSCodium.app/Contents/MacOS/Electron': 'vscodium',
229
247
  '/Applications/Cursor.app/Contents/MacOS/Cursor': 'cursor',
230
248
  '/Applications/Windsurf.app/Contents/MacOS/Electron': 'windsurf',
249
+ '/Applications/Zed.app/Contents/MacOS/zed': '/Applications/Zed.app/Contents/MacOS/cli',
250
+ '/Applications/Zed Preview.app/Contents/MacOS/zed': '/Applications/Zed Preview.app/Contents/MacOS/cli',
251
+ '/Applications/Zed Preview.app/Contents/MacOS/Zed Preview': '/Applications/Zed Preview.app/Contents/MacOS/cli',
231
252
  '/Applications/AppCode.app/Contents/MacOS/appcode': '/Applications/AppCode.app/Contents/MacOS/appcode',
232
253
  '/Applications/CLion.app/Contents/MacOS/clion': '/Applications/CLion.app/Contents/MacOS/clion',
233
254
  '/Applications/IntelliJ IDEA.app/Contents/MacOS/idea': '/Applications/IntelliJ IDEA.app/Contents/MacOS/idea',
@@ -248,6 +269,9 @@ const COMMON_EDITORS_LINUX = {
248
269
  cursor: 'cursor',
249
270
  windsurf: 'windsurf',
250
271
  zed: 'zed',
272
+ zedit: 'zedit',
273
+ zeditor: 'zeditor',
274
+ 'zed-editor': 'zed-editor',
251
275
  vscodium: 'vscodium',
252
276
  emacs: 'emacs',
253
277
  gvim: 'gvim',
@@ -268,6 +292,7 @@ const COMMON_EDITORS_WIN = [
268
292
  'VSCodium.exe',
269
293
  'Cursor.exe',
270
294
  'Windsurf.exe',
295
+ 'Zed.exe',
271
296
  'atom.exe',
272
297
  'sublime_text.exe',
273
298
  'notepad++.exe',
@@ -294,7 +319,17 @@ const COMMON_EDITORS_WIN = [
294
319
  const WINDOWS_FILE_NAME_WHITELIST = /^([A-Za-z]:[/\\])?(?:[\x2D-9A-Z\\_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7B9\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFF1]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D])+$/;
295
320
  function getArgumentsForLineNumber(editor, fileName, lineNumber, colNumber) {
296
321
  const editorBasename = node_path_1.default.basename(editor).replace(/\.(exe|cmd|bat)$/i, '');
322
+ const isZedEditor = editor === 'zed' ||
323
+ editor === 'zedit' ||
324
+ editor === 'zeditor' ||
325
+ editor === 'zed-editor' ||
326
+ editor === 'Zed.exe' ||
327
+ editor.endsWith('/Zed.app/Contents/MacOS/cli') ||
328
+ editor.endsWith('/Zed Preview.app/Contents/MacOS/cli');
297
329
  const isFolder = node_fs_1.default.existsSync(fileName) && node_fs_1.default.lstatSync(fileName).isDirectory();
330
+ if (isZedEditor) {
331
+ return [fileName + ':' + lineNumber + ':' + colNumber];
332
+ }
298
333
  switch (editorBasename) {
299
334
  case 'atom':
300
335
  case 'Atom':
@@ -333,8 +368,6 @@ function getArgumentsForLineNumber(editor, fileName, lineNumber, colNumber) {
333
368
  case 'windsurf':
334
369
  case 'Windsurf':
335
370
  return ['-g', fileName + ':' + lineNumber + ':' + colNumber];
336
- case 'zed':
337
- return ['--new', fileName + ':' + lineNumber + ':' + colNumber];
338
371
  case 'appcode':
339
372
  case 'clion':
340
373
  case 'clion64':
@@ -1,3 +1,4 @@
1
+ import type { InsertableCompositionElement } from '@remotion/studio-shared';
1
2
  export type ResolvedCompositionComponent = {
2
3
  source: string;
3
4
  line: number;
@@ -9,3 +10,17 @@ export declare const resolveCompositionComponent: ({ remotionRoot, compositionFi
9
10
  compositionFile: string;
10
11
  compositionId: string;
11
12
  }) => Promise<ResolvedCompositionComponent>;
13
+ export declare const insertJsxElementIntoComposition: ({ remotionRoot, compositionFile, compositionId, element, prettierConfigOverride, }: {
14
+ remotionRoot: string;
15
+ compositionFile: string;
16
+ compositionId: string;
17
+ element: InsertableCompositionElement;
18
+ prettierConfigOverride: Record<string, unknown> | null;
19
+ }) => Promise<{
20
+ fileName: string;
21
+ source: string;
22
+ oldContents: string;
23
+ output: string;
24
+ formatted: boolean;
25
+ logLine: number;
26
+ }>;
@@ -36,10 +36,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.resolveCompositionComponent = void 0;
39
+ exports.insertJsxElementIntoComposition = exports.resolveCompositionComponent = void 0;
40
40
  const node_fs_1 = __importDefault(require("node:fs"));
41
41
  const node_path_1 = __importDefault(require("node:path"));
42
42
  const recast = __importStar(require("recast"));
43
+ const format_file_content_1 = require("../codemods/format-file-content");
43
44
  const parse_ast_1 = require("../codemods/parse-ast");
44
45
  const allowedFileExtensions = new Set(['.tsx', '.ts', '.jsx', '.js']);
45
46
  const extensionsToProbe = ['.tsx', '.ts', '.jsx', '.js'];
@@ -503,6 +504,205 @@ const getComponentRootNode = (declaration) => {
503
504
  const createSequenceElement = () => {
504
505
  return recast.types.builders.jsxElement(recast.types.builders.jsxOpeningElement(recast.types.builders.jsxIdentifier('Sequence'), []), recast.types.builders.jsxClosingElement(recast.types.builders.jsxIdentifier('Sequence')), []);
505
506
  };
507
+ const createNumberAttribute = (name, value) => {
508
+ return recast.types.builders.jsxAttribute(recast.types.builders.jsxIdentifier(name), recast.types.builders.jsxExpressionContainer(recast.types.builders.numericLiteral(value)));
509
+ };
510
+ const createSolidElement = ({ localName, width, height, }) => {
511
+ return recast.types.builders.jsxElement(recast.types.builders.jsxOpeningElement(recast.types.builders.jsxIdentifier(localName), [
512
+ createNumberAttribute('width', width),
513
+ createNumberAttribute('height', height),
514
+ recast.types.builders.jsxAttribute(recast.types.builders.jsxIdentifier('style'), recast.types.builders.jsxExpressionContainer(recast.types.builders.objectExpression([
515
+ recast.types.builders.objectProperty(recast.types.builders.identifier('position'), recast.types.builders.stringLiteral('absolute')),
516
+ ]))),
517
+ ], true), null, []);
518
+ };
519
+ const createFragmentWithElement = (element) => {
520
+ return recast.types.builders.jsxFragment(recast.types.builders.jsxOpeningFragment(), recast.types.builders.jsxClosingFragment(), [element]);
521
+ };
522
+ const replaceNullReturnInFunctionLike = ({ fn, element, }) => {
523
+ var _a, _b;
524
+ var _c, _d;
525
+ if (fn.type === 'ArrowFunctionExpression' && fn.body.type === 'NullLiteral') {
526
+ fn.body = createFragmentWithElement(element);
527
+ return (_c = (_a = fn.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _c !== void 0 ? _c : 1;
528
+ }
529
+ if (fn.body.type !== 'BlockStatement') {
530
+ return null;
531
+ }
532
+ const returnStatement = getTopLevelReturnStatement(fn.body.body);
533
+ if (!(returnStatement === null || returnStatement === void 0 ? void 0 : returnStatement.argument) ||
534
+ returnStatement.argument.type !== 'NullLiteral') {
535
+ return null;
536
+ }
537
+ returnStatement.argument = createFragmentWithElement(element);
538
+ return (_d = (_b = returnStatement.loc) === null || _b === void 0 ? void 0 : _b.start.line) !== null && _d !== void 0 ? _d : 1;
539
+ };
540
+ const addElementToNullComponentReturn = ({ declaration, element, }) => {
541
+ var _a;
542
+ var _b;
543
+ if (declaration.type === 'VariableDeclarator') {
544
+ if (!declaration.init ||
545
+ (declaration.init.type !== 'ArrowFunctionExpression' &&
546
+ declaration.init.type !== 'FunctionExpression')) {
547
+ return null;
548
+ }
549
+ return replaceNullReturnInFunctionLike({ fn: declaration.init, element });
550
+ }
551
+ if (declaration.type === 'ArrowFunctionExpression' ||
552
+ declaration.type === 'FunctionExpression' ||
553
+ declaration.type === 'FunctionDeclaration') {
554
+ return replaceNullReturnInFunctionLike({ fn: declaration, element });
555
+ }
556
+ if (declaration.type !== 'ClassDeclaration') {
557
+ return null;
558
+ }
559
+ const renderMethod = findRenderMethod(declaration);
560
+ if (!renderMethod) {
561
+ return null;
562
+ }
563
+ const returnStatement = getTopLevelReturnStatement(renderMethod.body.body);
564
+ if (!(returnStatement === null || returnStatement === void 0 ? void 0 : returnStatement.argument) ||
565
+ returnStatement.argument.type !== 'NullLiteral') {
566
+ return null;
567
+ }
568
+ returnStatement.argument = createFragmentWithElement(element);
569
+ return (_b = (_a = returnStatement.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _b !== void 0 ? _b : 1;
570
+ };
571
+ const getImportedName = (specifier) => {
572
+ if (specifier.imported.type === 'Identifier') {
573
+ return specifier.imported.name;
574
+ }
575
+ return specifier.imported.value;
576
+ };
577
+ const declarationBindsName = (declaration, name) => {
578
+ var _a;
579
+ if (declaration.type === 'FunctionDeclaration' ||
580
+ declaration.type === 'ClassDeclaration') {
581
+ return ((_a = declaration.id) === null || _a === void 0 ? void 0 : _a.name) === name;
582
+ }
583
+ return declaration.declarations.some((variableDeclaration) => {
584
+ return (variableDeclaration.id.type === 'Identifier' &&
585
+ variableDeclaration.id.name === name);
586
+ });
587
+ };
588
+ const hasTopLevelBinding = ({ ast, name }) => {
589
+ return ast.program.body.some((node) => {
590
+ var _a;
591
+ if (node.type === 'FunctionDeclaration' ||
592
+ node.type === 'ClassDeclaration' ||
593
+ node.type === 'VariableDeclaration') {
594
+ return declarationBindsName(node, name);
595
+ }
596
+ if (node.type === 'ExportNamedDeclaration' &&
597
+ node.declaration &&
598
+ (node.declaration.type === 'FunctionDeclaration' ||
599
+ node.declaration.type === 'ClassDeclaration' ||
600
+ node.declaration.type === 'VariableDeclaration')) {
601
+ return declarationBindsName(node.declaration, name);
602
+ }
603
+ if (node.type !== 'ImportDeclaration') {
604
+ return false;
605
+ }
606
+ return (_a = node.specifiers) === null || _a === void 0 ? void 0 : _a.some((specifier) => {
607
+ var _a;
608
+ return ((_a = specifier.local) === null || _a === void 0 ? void 0 : _a.name) === name;
609
+ });
610
+ });
611
+ };
612
+ const getAvailableSolidLocalName = (ast) => {
613
+ const candidates = ['Solid', 'RemotionSolid'];
614
+ const available = candidates.find((candidate) => {
615
+ return !hasTopLevelBinding({ ast, name: candidate });
616
+ });
617
+ if (!available) {
618
+ throw new Error('Cannot add <Solid> because Solid is already defined');
619
+ }
620
+ return available;
621
+ };
622
+ const insertImportDeclaration = (ast, importDeclaration) => {
623
+ const { body } = ast.program;
624
+ let lastImportIndex = -1;
625
+ for (let i = 0; i < body.length; i++) {
626
+ if (body[i].type === 'ImportDeclaration') {
627
+ lastImportIndex = i;
628
+ }
629
+ }
630
+ body.splice(lastImportIndex + 1, 0, importDeclaration);
631
+ };
632
+ const addSolidImport = ({ ast, localName, remotionImport, }) => {
633
+ var _a;
634
+ var _b;
635
+ const imported = recast.types.builders.identifier('Solid');
636
+ const local = localName === 'Solid' ? null : recast.types.builders.identifier(localName);
637
+ const specifier = recast.types.builders.importSpecifier(imported, local);
638
+ const canAddToExistingRemotionImport = remotionImport &&
639
+ !((_a = remotionImport.specifiers) === null || _a === void 0 ? void 0 : _a.some((importSpecifier) => importSpecifier.type === 'ImportNamespaceSpecifier'));
640
+ if (canAddToExistingRemotionImport) {
641
+ remotionImport.specifiers = [
642
+ ...((_b = remotionImport.specifiers) !== null && _b !== void 0 ? _b : []),
643
+ specifier,
644
+ ];
645
+ return;
646
+ }
647
+ const importDeclaration = recast.types.builders.importDeclaration([], recast.types.builders.stringLiteral('remotion'));
648
+ importDeclaration.specifiers = [specifier];
649
+ insertImportDeclaration(ast, importDeclaration);
650
+ };
651
+ const ensureSolidImport = (ast) => {
652
+ var _a, _b;
653
+ let remotionImport = null;
654
+ for (const node of ast.program.body) {
655
+ if (node.type !== 'ImportDeclaration' || node.source.value !== 'remotion') {
656
+ continue;
657
+ }
658
+ remotionImport = node;
659
+ const solidSpecifier = (_a = node.specifiers) === null || _a === void 0 ? void 0 : _a.find((specifier) => {
660
+ return (specifier.type === 'ImportSpecifier' &&
661
+ getImportedName(specifier) === 'Solid');
662
+ });
663
+ if ((_b = solidSpecifier === null || solidSpecifier === void 0 ? void 0 : solidSpecifier.local) === null || _b === void 0 ? void 0 : _b.name) {
664
+ return solidSpecifier.local.name;
665
+ }
666
+ }
667
+ const localName = getAvailableSolidLocalName(ast);
668
+ addSolidImport({ ast, localName, remotionImport });
669
+ return localName;
670
+ };
671
+ const addElementToComponentRoot = ({ ast, exportName, element, }) => {
672
+ var _a;
673
+ var _b;
674
+ const declaration = getDeclarationByExportName({ ast, exportName });
675
+ if (!declaration) {
676
+ throw new Error('Could not find composition component declaration');
677
+ }
678
+ const rootNode = getComponentRootNode(declaration);
679
+ if (!rootNode) {
680
+ const insertedAt = addElementToNullComponentReturn({ declaration, element });
681
+ if (insertedAt !== null) {
682
+ return insertedAt;
683
+ }
684
+ throw new Error('Composition component does not return JSX');
685
+ }
686
+ if (rootNode.type === 'JSXElement' && rootNode.openingElement.selfClosing) {
687
+ throw new Error('Cannot insert into a self-closing root JSX element');
688
+ }
689
+ const CANVAS_ROOT_ELEMENTS = [
690
+ 'ThreeCanvas',
691
+ 'RiveCanvas',
692
+ 'SkiaCanvas',
693
+ 'canvas',
694
+ ];
695
+ if (rootNode.type === 'JSXElement' &&
696
+ rootNode.openingElement.name.type === 'JSXIdentifier' &&
697
+ CANVAS_ROOT_ELEMENTS.includes(rootNode.openingElement.name.name)) {
698
+ throw new Error(`Cannot insert a <Solid> into a composition whose root element is <${rootNode.openingElement.name.name}>`);
699
+ }
700
+ if (!rootNode.children) {
701
+ throw new Error('Composition component root does not accept children');
702
+ }
703
+ rootNode.children.push(element);
704
+ return (_b = (_a = rootNode.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _b !== void 0 ? _b : 1;
705
+ };
506
706
  const getDefaultExportDeclaration = (ast) => {
507
707
  let declaration = null;
508
708
  let identifierName = null;
@@ -532,39 +732,16 @@ const getDeclarationByExportName = ({ ast, exportName, }) => {
532
732
  return findLocalComponentDeclaration({ ast, name: exportName });
533
733
  };
534
734
  const canAddSequenceToComponent = ({ ast, exportName, }) => {
535
- const declaration = getDeclarationByExportName({ ast, exportName });
536
- if (!declaration) {
537
- return false;
538
- }
539
- const rootNode = getComponentRootNode(declaration);
540
- if (!rootNode) {
541
- return false;
542
- }
543
- if (rootNode.type === 'JSXElement') {
544
- if (rootNode.openingElement.selfClosing) {
545
- return false;
546
- }
547
- if (!rootNode.children) {
548
- return false;
549
- }
550
- rootNode.children.push(createSequenceElement());
551
- try {
552
- recast.print(ast);
553
- return true;
554
- }
555
- catch (_a) {
556
- return false;
557
- }
558
- }
559
- if (!rootNode.children) {
560
- return false;
561
- }
562
- rootNode.children.push(createSequenceElement());
563
735
  try {
736
+ addElementToComponentRoot({
737
+ ast,
738
+ exportName,
739
+ element: createSequenceElement(),
740
+ });
564
741
  recast.print(ast);
565
742
  return true;
566
743
  }
567
- catch (_b) {
744
+ catch (_a) {
568
745
  return false;
569
746
  }
570
747
  };
@@ -582,6 +759,8 @@ const getComponentLocationInFile = async ({ remotionRoot, fileName, exportName,
582
759
  });
583
760
  return {
584
761
  source: node_path_1.default.relative(remotionRoot, fileName),
762
+ fileName,
763
+ exportName,
585
764
  line: (_a = location === null || location === void 0 ? void 0 : location.line) !== null && _a !== void 0 ? _a : 1,
586
765
  column: (_b = location === null || location === void 0 ? void 0 : location.column) !== null && _b !== void 0 ? _b : 0,
587
766
  canAddSequence,
@@ -641,7 +820,7 @@ const getComponentLocationRecursively = async ({ remotionRoot, fileName, exportN
641
820
  visited.delete(key);
642
821
  }
643
822
  };
644
- const resolveCompositionComponent = async ({ remotionRoot, compositionFile, compositionId, }) => {
823
+ const resolveCompositionComponentWithFile = async ({ remotionRoot, compositionFile, compositionId, }) => {
645
824
  const compositionFileName = node_path_1.default.resolve(remotionRoot, compositionFile);
646
825
  const input = await readSourceFile({
647
826
  remotionRoot,
@@ -688,4 +867,63 @@ const resolveCompositionComponent = async ({ remotionRoot, compositionFile, comp
688
867
  visited: new Set(),
689
868
  });
690
869
  };
870
+ const resolveCompositionComponent = async ({ remotionRoot, compositionFile, compositionId, }) => {
871
+ const { source, line, column, canAddSequence } = await resolveCompositionComponentWithFile({
872
+ remotionRoot,
873
+ compositionFile,
874
+ compositionId,
875
+ });
876
+ return {
877
+ source,
878
+ line,
879
+ column,
880
+ canAddSequence,
881
+ };
882
+ };
691
883
  exports.resolveCompositionComponent = resolveCompositionComponent;
884
+ const createInsertableJsxElement = ({ ast, element, }) => {
885
+ if (element.type === 'solid') {
886
+ const solidLocalName = ensureSolidImport(ast);
887
+ return createSolidElement({
888
+ localName: solidLocalName,
889
+ width: element.width,
890
+ height: element.height,
891
+ });
892
+ }
893
+ throw new Error('Unsupported element type');
894
+ };
895
+ const insertJsxElementIntoComposition = async ({ remotionRoot, compositionFile, compositionId, element, prettierConfigOverride, }) => {
896
+ const location = await resolveCompositionComponentWithFile({
897
+ remotionRoot,
898
+ compositionFile,
899
+ compositionId,
900
+ });
901
+ if (!location.canAddSequence) {
902
+ throw new Error('Cannot insert JSX element into this composition component');
903
+ }
904
+ const input = await readSourceFile({
905
+ remotionRoot,
906
+ fileName: location.fileName,
907
+ });
908
+ const ast = (0, parse_ast_1.parseAst)(input);
909
+ const elementToInsert = createInsertableJsxElement({ ast, element });
910
+ const logLine = addElementToComponentRoot({
911
+ ast,
912
+ exportName: location.exportName,
913
+ element: elementToInsert,
914
+ });
915
+ const finalFile = (0, parse_ast_1.serializeAst)(ast);
916
+ const { output, formatted } = await (0, format_file_content_1.formatFileContent)({
917
+ input: finalFile,
918
+ prettierConfigOverride,
919
+ });
920
+ return {
921
+ fileName: location.fileName,
922
+ source: location.source,
923
+ oldContents: input,
924
+ output,
925
+ formatted,
926
+ logLine,
927
+ };
928
+ };
929
+ exports.insertJsxElementIntoComposition = insertJsxElementIntoComposition;
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { ApiRoutes, CopyStillToClipboardRequest, getDefaultOutLocation, OpenInFi
2
2
  export type { AggregateRenderProgress, BundlingState, CopyingState, DownloadProgress, HotMiddlewareOptions, JobProgressCallback, ModuleMap, PackageManager, ProjectInfo, RenderingProgressInput, RenderJob, RenderJobWithCleanup, RequiredChromiumOptions, StitchingProgressInput, UiOpenGlOptions, } from '@remotion/studio-shared';
3
3
  import { AnsiDiff } from './ansi-diff';
4
4
  export declare const StudioServerInternals: {
5
- startStudio: ({ browserArgs, browserFlag, shouldOpenBrowser, fullEntryPath, logLevel, getCurrentInputProps, getEnvVariables, desiredPort, maxTimelineTracks, remotionRoot, keyboardShortcutsEnabled, experimentalClientSideRenderingEnabled, relativePublicDir, webpackOverride, poll, getRenderDefaults, getRenderQueue, numberOfAudioTags, queueMethods, previewEntry, gitSource, bufferStateDelayInMilliseconds, binariesDirectory, forceIPv4, audioLatencyHint, enableCrossSiteIsolation, askAIEnabled, forceNew, rspack, }: {
5
+ startStudio: ({ browserArgs, browserFlag, shouldOpenBrowser, fullEntryPath, logLevel, getCurrentInputProps, getEnvVariables, desiredPort, maxTimelineTracks, remotionRoot, keyboardShortcutsEnabled, experimentalClientSideRenderingEnabled, relativePublicDir, webpackOverride, poll, getRenderDefaults, getRenderQueue, numberOfAudioTags, queueMethods, previewEntry, gitSource, bufferStateDelayInMilliseconds, binariesDirectory, forceIPv4, audioLatencyHint, previewSampleRate, enableCrossSiteIsolation, askAIEnabled, forceNew, rspack, }: {
6
6
  browserArgs: string;
7
7
  browserFlag: string;
8
8
  logLevel: "error" | "info" | "trace" | "verbose" | "warn";
@@ -23,6 +23,7 @@ export declare const StudioServerInternals: {
23
23
  getRenderQueue: () => import("@remotion/studio-shared").RenderJob[];
24
24
  numberOfAudioTags: number;
25
25
  audioLatencyHint: AudioContextLatencyCategory | null;
26
+ previewSampleRate: number | null;
26
27
  enableCrossSiteIsolation: boolean;
27
28
  queueMethods: import("./preview-server/api-types").QueueMethods;
28
29
  previewEntry: string;
@@ -1,19 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.allApiRoutes = void 0;
4
+ const add_effect_1 = require("./routes/add-effect");
5
+ const add_effect_keyframe_1 = require("./routes/add-effect-keyframe");
4
6
  const add_render_1 = require("./routes/add-render");
7
+ const add_sequence_keyframe_1 = require("./routes/add-sequence-keyframe");
5
8
  const apply_codemod_1 = require("./routes/apply-codemod");
6
9
  const apply_visual_control_change_1 = require("./routes/apply-visual-control-change");
7
10
  const cancel_render_1 = require("./routes/cancel-render");
11
+ const composition_component_info_1 = require("./routes/composition-component-info");
8
12
  const delete_effect_1 = require("./routes/delete-effect");
9
13
  const delete_jsx_node_1 = require("./routes/delete-jsx-node");
14
+ const delete_keyframes_1 = require("./routes/delete-keyframes");
10
15
  const delete_static_file_1 = require("./routes/delete-static-file");
11
16
  const duplicate_jsx_node_1 = require("./routes/duplicate-jsx-node");
17
+ const insert_jsx_element_1 = require("./routes/insert-jsx-element");
12
18
  const install_dependency_1 = require("./routes/install-dependency");
19
+ const open_in_editor_1 = require("./routes/open-in-editor");
13
20
  const open_in_file_explorer_1 = require("./routes/open-in-file-explorer");
14
21
  const project_info_1 = require("./routes/project-info");
15
22
  const redo_1 = require("./routes/redo");
23
+ const register_client_render_1 = require("./routes/register-client-render");
16
24
  const remove_render_1 = require("./routes/remove-render");
25
+ const reorder_effect_1 = require("./routes/reorder-effect");
17
26
  const restart_studio_1 = require("./routes/restart-studio");
18
27
  const save_effect_props_1 = require("./routes/save-effect-props");
19
28
  const save_sequence_props_1 = require("./routes/save-sequence-props");
@@ -21,18 +30,23 @@ const subscribe_to_default_props_1 = require("./routes/subscribe-to-default-prop
21
30
  const subscribe_to_file_existence_1 = require("./routes/subscribe-to-file-existence");
22
31
  const subscribe_to_sequence_props_1 = require("./routes/subscribe-to-sequence-props");
23
32
  const undo_1 = require("./routes/undo");
33
+ const unregister_client_render_1 = require("./routes/unregister-client-render");
24
34
  const unsubscribe_from_default_props_1 = require("./routes/unsubscribe-from-default-props");
25
35
  const unsubscribe_from_file_existence_1 = require("./routes/unsubscribe-from-file-existence");
26
36
  const unsubscribe_from_sequence_props_1 = require("./routes/unsubscribe-from-sequence-props");
27
37
  const update_available_1 = require("./routes/update-available");
28
38
  const update_default_props_1 = require("./routes/update-default-props");
29
39
  exports.allApiRoutes = {
40
+ '/api/composition-component-info': composition_component_info_1.compositionComponentInfoHandler,
30
41
  '/api/cancel': cancel_render_1.handleCancelRender,
31
42
  '/api/render': add_render_1.handleAddRender,
32
43
  '/api/unsubscribe-from-file-existence': unsubscribe_from_file_existence_1.unsubscribeFromFileExistence,
33
44
  '/api/subscribe-to-file-existence': subscribe_to_file_existence_1.subscribeToFileExistence,
34
45
  '/api/remove-render': remove_render_1.handleRemoveRender,
46
+ '/api/open-in-editor': open_in_editor_1.openInEditorHandler,
35
47
  '/api/open-in-file-explorer': open_in_file_explorer_1.handleOpenInFileExplorer,
48
+ '/api/register-client-render': register_client_render_1.registerClientRenderHandler,
49
+ '/api/unregister-client-render': unregister_client_render_1.unregisterClientRenderHandler,
36
50
  '/api/update-default-props': update_default_props_1.updateDefaultPropsHandler,
37
51
  '/api/apply-visual-control-change': apply_visual_control_change_1.applyVisualControlHandler,
38
52
  '/api/apply-codemod': apply_codemod_1.applyCodemodHandler,
@@ -42,6 +56,11 @@ exports.allApiRoutes = {
42
56
  '/api/unsubscribe-from-sequence-props': unsubscribe_from_sequence_props_1.unsubscribeFromSequenceProps,
43
57
  '/api/save-sequence-props': save_sequence_props_1.saveSequencePropsHandler,
44
58
  '/api/save-effect-props': save_effect_props_1.saveEffectPropsHandler,
59
+ '/api/add-effect': add_effect_1.addEffectHandler,
60
+ '/api/reorder-effect': reorder_effect_1.reorderEffectHandler,
61
+ '/api/delete-keyframes': delete_keyframes_1.deleteKeyframesHandler,
62
+ '/api/add-sequence-keyframe': add_sequence_keyframe_1.addSequenceKeyframeHandler,
63
+ '/api/add-effect-keyframe': add_effect_keyframe_1.addEffectKeyframeHandler,
45
64
  '/api/delete-effect': delete_effect_1.deleteEffectHandler,
46
65
  '/api/delete-jsx-node': delete_jsx_node_1.deleteJsxNodeHandler,
47
66
  '/api/duplicate-jsx-node': duplicate_jsx_node_1.duplicateJsxNodeHandler,
@@ -50,6 +69,7 @@ exports.allApiRoutes = {
50
69
  '/api/delete-static-file': delete_static_file_1.deleteStaticFileHandler,
51
70
  '/api/restart-studio': restart_studio_1.handleRestartStudio,
52
71
  '/api/install-package': install_dependency_1.handleInstallPackage,
72
+ '/api/insert-jsx-element': insert_jsx_element_1.insertJsxElementHandler,
53
73
  '/api/undo': undo_1.undoHandler,
54
74
  '/api/redo': redo_1.redoHandler,
55
75
  };
@@ -0,0 +1,3 @@
1
+ import type { AddEffectKeyframeRequest, AddEffectKeyframeResponse } from '@remotion/studio-shared';
2
+ import type { ApiHandler } from '../api-types';
3
+ export declare const addEffectKeyframeHandler: ApiHandler<AddEffectKeyframeRequest, AddEffectKeyframeResponse>;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addEffectKeyframeHandler = void 0;
4
+ const node_fs_1 = require("node:fs");
5
+ const renderer_1 = require("@remotion/renderer");
6
+ const studio_shared_1 = require("@remotion/studio-shared");
7
+ const parse_ast_1 = require("../../codemods/parse-ast");
8
+ const update_keyframes_1 = require("../../codemods/update-keyframes/update-keyframes");
9
+ const file_watcher_1 = require("../../file-watcher");
10
+ const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
11
+ const undo_stack_1 = require("../undo-stack");
12
+ const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
13
+ const can_update_effect_props_1 = require("./can-update-effect-props");
14
+ const can_update_sequence_props_1 = require("./can-update-sequence-props");
15
+ const log_effect_update_1 = require("./log-updates/log-effect-update");
16
+ const save_props_mutex_1 = require("./save-props-mutex");
17
+ const addEffectKeyframeHandler = ({ input: { fileName, sequenceNodePath, effectIndex, key, frame, value, schema, clientId, }, remotionRoot, logLevel, }) => (0, save_props_mutex_1.withSavePropsLock)(async () => {
18
+ renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[add-effect-keyframe] Received request for fileName="${fileName}" effectIndex=${effectIndex} key="${key}" frame=${frame}`);
19
+ const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
20
+ remotionRoot,
21
+ fileName,
22
+ action: 'modify',
23
+ });
24
+ const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
25
+ const parsedValue = JSON.parse(value);
26
+ const { output, oldValueStrings, newValueStrings, formatted, logLine, effectCallee, updatedSequenceNodePath, } = await (0, update_keyframes_1.updateEffectKeyframes)({
27
+ input: fileContents,
28
+ sequenceNodePath: sequenceNodePath.nodePath,
29
+ effectIndex,
30
+ updates: [
31
+ {
32
+ key,
33
+ operation: {
34
+ type: 'add',
35
+ frame,
36
+ value: parsedValue,
37
+ },
38
+ },
39
+ ],
40
+ });
41
+ const oldValueString = oldValueStrings[0];
42
+ const newValueString = newValueStrings[0];
43
+ const undoPropChange = `${key} keyframe removed at frame ${frame}`;
44
+ const redoPropChange = `${key} keyframe added at frame ${frame}`;
45
+ (0, undo_stack_1.pushToUndoStack)({
46
+ filePath: absolutePath,
47
+ oldContents: fileContents,
48
+ newContents: null,
49
+ logLevel,
50
+ remotionRoot,
51
+ logLine,
52
+ description: {
53
+ undoMessage: `↩️ ${undoPropChange}`,
54
+ redoMessage: `↪️ ${redoPropChange}`,
55
+ },
56
+ entryType: 'effect-props',
57
+ suppressHmrOnFileRestore: true,
58
+ });
59
+ (0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
60
+ (0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(absolutePath);
61
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
62
+ (0, log_effect_update_1.logEffectUpdate)({
63
+ fileRelativeToRoot,
64
+ line: logLine,
65
+ effectName: effectCallee,
66
+ propKey: key,
67
+ oldValueString,
68
+ newValueString,
69
+ defaultValueString: null,
70
+ formatted,
71
+ logLevel,
72
+ removedProps: [],
73
+ addedProps: [],
74
+ });
75
+ (0, undo_stack_1.printUndoHint)(logLevel);
76
+ const ast = (0, parse_ast_1.parseAst)((0, node_fs_1.readFileSync)(absolutePath, 'utf-8'));
77
+ const jsx = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, updatedSequenceNodePath);
78
+ if (!jsx) {
79
+ return {
80
+ canUpdate: false,
81
+ effectIndex,
82
+ reason: 'not-found',
83
+ };
84
+ }
85
+ return (0, can_update_effect_props_1.computeEffectPropStatus)({
86
+ jsx,
87
+ effectIndex,
88
+ keys: (0, studio_shared_1.getAllSchemaKeys)(schema),
89
+ });
90
+ });
91
+ exports.addEffectKeyframeHandler = addEffectKeyframeHandler;
@@ -0,0 +1,3 @@
1
+ import type { AddEffectRequest, AddEffectResponse } from '@remotion/studio-shared';
2
+ import type { ApiHandler } from '../api-types';
3
+ export declare const addEffectHandler: ApiHandler<AddEffectRequest, AddEffectResponse>;