@remotion/studio 4.0.473 → 4.0.474

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 (79) hide show
  1. package/dist/components/AssetSelectorItem.js +30 -6
  2. package/dist/components/Canvas.js +71 -0
  3. package/dist/components/Modals.js +1 -2
  4. package/dist/components/NewComposition/InputDragger.d.ts +1 -0
  5. package/dist/components/NewComposition/InputDragger.js +9 -6
  6. package/dist/components/SelectedOutlineOverlay.d.ts +7 -5
  7. package/dist/components/SelectedOutlineOverlay.js +78 -67
  8. package/dist/components/Timeline/KeyframeSettingsModal.js +4 -4
  9. package/dist/components/Timeline/SequencePropsObserver.js +3 -3
  10. package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +7 -7
  11. package/dist/components/Timeline/TimelineClipboardKeybindings.js +19 -16
  12. package/dist/components/Timeline/TimelineDeleteKeybindings.js +11 -9
  13. package/dist/components/Timeline/TimelineEffectItem.js +7 -7
  14. package/dist/components/Timeline/TimelineEffectPropItem.js +17 -17
  15. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +6 -1
  16. package/dist/components/Timeline/TimelineExpandedSection.js +5 -5
  17. package/dist/components/Timeline/TimelineKeyframeControls.js +8 -8
  18. package/dist/components/Timeline/TimelineKeyframeDiamond.js +0 -1
  19. package/dist/components/Timeline/TimelineKeyframeEasingLine.d.ts +9 -0
  20. package/dist/components/Timeline/TimelineKeyframeEasingLine.js +120 -0
  21. package/dist/components/Timeline/TimelineKeyframedValue.js +1 -1
  22. package/dist/components/Timeline/TimelineNumberField.js +15 -7
  23. package/dist/components/Timeline/TimelineRotationField.js +17 -11
  24. package/dist/components/Timeline/TimelineScaleField.js +16 -12
  25. package/dist/components/Timeline/TimelineSelection.d.ts +15 -0
  26. package/dist/components/Timeline/TimelineSelection.js +26 -1
  27. package/dist/components/Timeline/TimelineSequence.js +6 -6
  28. package/dist/components/Timeline/TimelineSequenceItem.js +21 -14
  29. package/dist/components/Timeline/TimelineSequencePropItem.js +37 -37
  30. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +5 -5
  31. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +46 -44
  32. package/dist/components/Timeline/TimelineTranslateField.js +24 -19
  33. package/dist/components/Timeline/TimelineUvCoordinateField.js +18 -12
  34. package/dist/components/Timeline/{apply-effect-response-to-code-values.d.ts → apply-effect-response-to-prop-statuses.d.ts} +1 -1
  35. package/dist/components/Timeline/{apply-effect-response-to-code-values.js → apply-effect-response-to-prop-statuses.js} +3 -3
  36. package/dist/components/Timeline/call-add-keyframe.d.ts +5 -5
  37. package/dist/components/Timeline/call-add-keyframe.js +6 -6
  38. package/dist/components/Timeline/call-delete-keyframe.d.ts +7 -7
  39. package/dist/components/Timeline/call-delete-keyframe.js +7 -7
  40. package/dist/components/Timeline/call-move-keyframe.d.ts +3 -3
  41. package/dist/components/Timeline/call-move-keyframe.js +3 -3
  42. package/dist/components/Timeline/call-update-keyframe-settings.d.ts +5 -5
  43. package/dist/components/Timeline/call-update-keyframe-settings.js +6 -6
  44. package/dist/components/Timeline/delete-selected-keyframe.d.ts +5 -5
  45. package/dist/components/Timeline/delete-selected-keyframe.js +5 -5
  46. package/dist/components/Timeline/delete-selected-timeline-item.d.ts +5 -5
  47. package/dist/components/Timeline/delete-selected-timeline-item.js +6 -4
  48. package/dist/components/Timeline/get-node-keyframes.d.ts +3 -3
  49. package/dist/components/Timeline/get-node-keyframes.js +4 -4
  50. package/dist/components/Timeline/get-timeline-easing-segments.d.ts +9 -0
  51. package/dist/components/Timeline/get-timeline-easing-segments.js +19 -0
  52. package/dist/components/Timeline/reset-selected-timeline-props.d.ts +7 -7
  53. package/dist/components/Timeline/reset-selected-timeline-props.js +10 -10
  54. package/dist/components/Timeline/save-effect-prop.d.ts +2 -2
  55. package/dist/components/Timeline/save-effect-prop.js +5 -5
  56. package/dist/components/Timeline/save-prop-queue.d.ts +3 -3
  57. package/dist/components/Timeline/save-prop-queue.js +3 -3
  58. package/dist/components/Timeline/save-sequence-prop.d.ts +3 -3
  59. package/dist/components/Timeline/save-sequence-prop.js +4 -4
  60. package/dist/components/Timeline/timeline-field-utils.d.ts +10 -0
  61. package/dist/components/Timeline/timeline-field-utils.js +26 -5
  62. package/dist/components/Timeline/timeline-translate-utils.d.ts +1 -1
  63. package/dist/components/Timeline/timeline-translate-utils.js +4 -5
  64. package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +7 -7
  65. package/dist/components/Timeline/use-sequence-props-subscription.js +3 -3
  66. package/dist/components/Timeline/use-timeline-height.js +3 -3
  67. package/dist/components/Timeline/use-timeline-keyframe-drag.js +13 -11
  68. package/dist/components/import-assets.d.ts +15 -0
  69. package/dist/components/import-assets.js +63 -1
  70. package/dist/esm/{chunk-q0jkt0zq.js → chunk-xjvc8qen.js} +1708 -1394
  71. package/dist/esm/internals.mjs +1708 -1394
  72. package/dist/esm/previewEntry.mjs +1711 -1397
  73. package/dist/esm/renderEntry.mjs +1 -1
  74. package/dist/helpers/timeline-layout.d.ts +6 -6
  75. package/dist/helpers/timeline-layout.js +5 -5
  76. package/dist/state/modals.d.ts +0 -3
  77. package/package.json +10 -10
  78. package/dist/components/NewComposition/DeleteStaticFile.d.ts +0 -4
  79. package/dist/components/NewComposition/DeleteStaticFile.js +0 -44
@@ -1,22 +1,22 @@
1
1
  import { type KeyframeSettings } from '@remotion/studio-shared';
2
2
  import type { SequencePropsSubscriptionKey, SequenceSchema } from 'remotion';
3
- import type { SetCodeValues } from './save-sequence-prop';
4
- export declare const callUpdateSequenceKeyframeSettings: ({ fileName, nodePath, fieldKey, settings, schema, setCodeValues, clientId, }: {
3
+ import type { SetPropStatuses } from './save-sequence-prop';
4
+ export declare const callUpdateSequenceKeyframeSettings: ({ fileName, nodePath, fieldKey, settings, schema, setPropStatuses, clientId, }: {
5
5
  fileName: string;
6
6
  nodePath: SequencePropsSubscriptionKey;
7
7
  fieldKey: string;
8
8
  settings: KeyframeSettings;
9
9
  schema: SequenceSchema;
10
- setCodeValues: SetCodeValues;
10
+ setPropStatuses: SetPropStatuses;
11
11
  clientId: string;
12
12
  }) => Promise<void>;
13
- export declare const callUpdateEffectKeyframeSettings: ({ fileName, nodePath, effectIndex, fieldKey, settings, schema, setCodeValues, clientId, }: {
13
+ export declare const callUpdateEffectKeyframeSettings: ({ fileName, nodePath, effectIndex, fieldKey, settings, schema, setPropStatuses, clientId, }: {
14
14
  fileName: string;
15
15
  nodePath: SequencePropsSubscriptionKey;
16
16
  effectIndex: number;
17
17
  fieldKey: string;
18
18
  settings: KeyframeSettings;
19
19
  schema: SequenceSchema;
20
- setCodeValues: SetCodeValues;
20
+ setPropStatuses: SetPropStatuses;
21
21
  clientId: string;
22
22
  }) => Promise<void>;
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.callUpdateEffectKeyframeSettings = exports.callUpdateSequenceKeyframeSettings = void 0;
4
4
  const studio_shared_1 = require("@remotion/studio-shared");
5
5
  const call_api_1 = require("../call-api");
6
- const apply_effect_response_to_code_values_1 = require("./apply-effect-response-to-code-values");
6
+ const apply_effect_response_to_prop_statuses_1 = require("./apply-effect-response-to-prop-statuses");
7
7
  const save_prop_queue_1 = require("./save-prop-queue");
8
- const callUpdateSequenceKeyframeSettings = ({ fileName, nodePath, fieldKey, settings, schema, setCodeValues, clientId, }) => {
8
+ const callUpdateSequenceKeyframeSettings = ({ fileName, nodePath, fieldKey, settings, schema, setPropStatuses, clientId, }) => {
9
9
  return (0, save_prop_queue_1.enqueueSavePropChange)({
10
10
  nodePath,
11
- setCodeValues,
11
+ setPropStatuses,
12
12
  applyOptimistic: (prev) => (0, studio_shared_1.optimisticUpdateSequenceKeyframeSettings)({
13
13
  previous: prev,
14
14
  fieldKey,
@@ -26,17 +26,17 @@ const callUpdateSequenceKeyframeSettings = ({ fileName, nodePath, fieldKey, sett
26
26
  });
27
27
  };
28
28
  exports.callUpdateSequenceKeyframeSettings = callUpdateSequenceKeyframeSettings;
29
- const callUpdateEffectKeyframeSettings = ({ fileName, nodePath, effectIndex, fieldKey, settings, schema, setCodeValues, clientId, }) => {
29
+ const callUpdateEffectKeyframeSettings = ({ fileName, nodePath, effectIndex, fieldKey, settings, schema, setPropStatuses, clientId, }) => {
30
30
  return (0, save_prop_queue_1.enqueueSavePropChange)({
31
31
  nodePath,
32
- setCodeValues,
32
+ setPropStatuses,
33
33
  applyOptimistic: (prev) => (0, studio_shared_1.optimisticUpdateEffectKeyframeSettings)({
34
34
  previous: prev,
35
35
  effectIndex,
36
36
  fieldKey,
37
37
  settings,
38
38
  }),
39
- applyServerResponse: (prev, response) => (0, apply_effect_response_to_code_values_1.applyEffectResponseToCodeValues)({ previous: prev, response }),
39
+ applyServerResponse: (prev, response) => (0, apply_effect_response_to_prop_statuses_1.applyEffectResponseToPropStatuses)({ previous: prev, response }),
40
40
  apiCall: () => (0, call_api_1.callApi)('/api/update-effect-keyframe-settings', {
41
41
  fileName,
42
42
  sequenceNodePath: nodePath,
@@ -1,21 +1,21 @@
1
1
  import type { OverrideIdToNodePaths, TSequence } from 'remotion';
2
2
  import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
3
- import type { SetCodeValues } from './save-sequence-prop';
4
- export declare const deleteSelectedKeyframe: ({ nodePathInfo, frame, sequences, overrideIdsToNodePaths, setCodeValues, clientId, }: {
3
+ import type { SetPropStatuses } from './save-sequence-prop';
4
+ export declare const deleteSelectedKeyframe: ({ nodePathInfo, frame, sequences, overrideIdsToNodePaths, setPropStatuses, clientId, }: {
5
5
  nodePathInfo: SequenceNodePathInfo;
6
6
  frame: number;
7
7
  sequences: TSequence[];
8
8
  overrideIdsToNodePaths: OverrideIdToNodePaths;
9
- setCodeValues: SetCodeValues;
9
+ setPropStatuses: SetPropStatuses;
10
10
  clientId: string;
11
11
  }) => Promise<void> | null;
12
- export declare const deleteSelectedKeyframes: ({ keyframes, sequences, overrideIdsToNodePaths, setCodeValues, clientId, }: {
12
+ export declare const deleteSelectedKeyframes: ({ keyframes, sequences, overrideIdsToNodePaths, setPropStatuses, clientId, }: {
13
13
  keyframes: {
14
14
  nodePathInfo: SequenceNodePathInfo;
15
15
  frame: number;
16
16
  }[];
17
17
  sequences: TSequence[];
18
18
  overrideIdsToNodePaths: OverrideIdToNodePaths;
19
- setCodeValues: SetCodeValues;
19
+ setPropStatuses: SetPropStatuses;
20
20
  clientId: string;
21
21
  }) => Promise<void> | null;
@@ -46,7 +46,7 @@ const getSelectedKeyframeDeletion = ({ nodePathInfo, frame, sequences, overrideI
46
46
  schema: sequence.controls.schema,
47
47
  };
48
48
  };
49
- const deleteSelectedKeyframe = ({ nodePathInfo, frame, sequences, overrideIdsToNodePaths, setCodeValues, clientId, }) => {
49
+ const deleteSelectedKeyframe = ({ nodePathInfo, frame, sequences, overrideIdsToNodePaths, setPropStatuses, clientId, }) => {
50
50
  const deletion = getSelectedKeyframeDeletion({
51
51
  nodePathInfo,
52
52
  frame,
@@ -59,18 +59,18 @@ const deleteSelectedKeyframe = ({ nodePathInfo, frame, sequences, overrideIdsToN
59
59
  if (deletion.type === 'effect') {
60
60
  return (0, call_delete_keyframe_1.callDeleteEffectKeyframe)({
61
61
  ...deletion,
62
- setCodeValues,
62
+ setPropStatuses,
63
63
  clientId,
64
64
  });
65
65
  }
66
66
  return (0, call_delete_keyframe_1.callDeleteSequenceKeyframe)({
67
67
  ...deletion,
68
- setCodeValues,
68
+ setPropStatuses,
69
69
  clientId,
70
70
  });
71
71
  };
72
72
  exports.deleteSelectedKeyframe = deleteSelectedKeyframe;
73
- const deleteSelectedKeyframes = ({ keyframes, sequences, overrideIdsToNodePaths, setCodeValues, clientId, }) => {
73
+ const deleteSelectedKeyframes = ({ keyframes, sequences, overrideIdsToNodePaths, setPropStatuses, clientId, }) => {
74
74
  const deletions = keyframes
75
75
  .map((keyframe) => getSelectedKeyframeDeletion({
76
76
  nodePathInfo: keyframe.nodePathInfo,
@@ -85,7 +85,7 @@ const deleteSelectedKeyframes = ({ keyframes, sequences, overrideIdsToNodePaths,
85
85
  return (0, call_delete_keyframe_1.callDeleteKeyframes)({
86
86
  sequenceKeyframes: deletions.filter((deletion) => deletion.type === 'sequence'),
87
87
  effectKeyframes: deletions.filter((deletion) => deletion.type === 'effect'),
88
- setCodeValues,
88
+ setPropStatuses,
89
89
  clientId,
90
90
  });
91
91
  };
@@ -1,20 +1,20 @@
1
1
  import type { OverrideIdToNodePaths, TSequence } from 'remotion';
2
2
  import type { ConfirmationDialogFunction } from '../ConfirmationDialog-types';
3
- import type { SetCodeValues } from './save-sequence-prop';
3
+ import type { SetPropStatuses } from './save-sequence-prop';
4
4
  import type { TimelineSelection } from './TimelineSelection';
5
- export declare const deleteSelectedTimelineItem: ({ selection, sequences, overrideIdsToNodePaths, setCodeValues, clientId, confirm, }: {
5
+ export declare const deleteSelectedTimelineItem: ({ selection, sequences, overrideIdsToNodePaths, setPropStatuses, clientId, confirm, }: {
6
6
  selection: TimelineSelection;
7
7
  sequences: TSequence[];
8
8
  overrideIdsToNodePaths: OverrideIdToNodePaths;
9
- setCodeValues: SetCodeValues;
9
+ setPropStatuses: SetPropStatuses;
10
10
  clientId: string;
11
11
  confirm: ConfirmationDialogFunction;
12
12
  }) => Promise<boolean> | null;
13
- export declare const deleteSelectedTimelineItems: ({ selections, sequences, overrideIdsToNodePaths, setCodeValues, clientId, confirm, }: {
13
+ export declare const deleteSelectedTimelineItems: ({ selections, sequences, overrideIdsToNodePaths, setPropStatuses, clientId, confirm, }: {
14
14
  selections: readonly TimelineSelection[];
15
15
  sequences: TSequence[];
16
16
  overrideIdsToNodePaths: OverrideIdToNodePaths;
17
- setCodeValues: SetCodeValues;
17
+ setPropStatuses: SetPropStatuses;
18
18
  clientId: string;
19
19
  confirm: ConfirmationDialogFunction;
20
20
  }) => Promise<boolean> | null;
@@ -93,7 +93,7 @@ const deleteEffects = (effects) => {
93
93
  return true;
94
94
  });
95
95
  };
96
- const deleteSelectedTimelineItem = ({ selection, sequences, overrideIdsToNodePaths, setCodeValues, clientId, confirm, }) => {
96
+ const deleteSelectedTimelineItem = ({ selection, sequences, overrideIdsToNodePaths, setPropStatuses, clientId, confirm, }) => {
97
97
  var _a;
98
98
  if (selection.type === 'keyframe') {
99
99
  const promise = (0, delete_selected_keyframe_1.deleteSelectedKeyframe)({
@@ -101,7 +101,7 @@ const deleteSelectedTimelineItem = ({ selection, sequences, overrideIdsToNodePat
101
101
  frame: selection.frame,
102
102
  sequences,
103
103
  overrideIdsToNodePaths,
104
- setCodeValues,
104
+ setPropStatuses,
105
105
  clientId,
106
106
  });
107
107
  return (_a = promise === null || promise === void 0 ? void 0 : promise.then(() => true)) !== null && _a !== void 0 ? _a : null;
@@ -119,6 +119,7 @@ const deleteSelectedTimelineItem = ({ selection, sequences, overrideIdsToNodePat
119
119
  ]);
120
120
  case 'sequence-prop':
121
121
  case 'sequence-effect-prop':
122
+ case 'easing':
122
123
  return null;
123
124
  case 'sequence-all-effects':
124
125
  return deleteEffects([
@@ -144,7 +145,7 @@ const assertTimelineSelectionsHaveSameType = (selections) => {
144
145
  }
145
146
  }
146
147
  };
147
- const deleteSelectedTimelineItems = ({ selections, sequences, overrideIdsToNodePaths, setCodeValues, clientId, confirm, }) => {
148
+ const deleteSelectedTimelineItems = ({ selections, sequences, overrideIdsToNodePaths, setPropStatuses, clientId, confirm, }) => {
148
149
  var _a;
149
150
  const firstSelection = selections[0];
150
151
  if (!firstSelection) {
@@ -170,13 +171,14 @@ const deleteSelectedTimelineItems = ({ selections, sequences, overrideIdsToNodeP
170
171
  })),
171
172
  sequences,
172
173
  overrideIdsToNodePaths,
173
- setCodeValues,
174
+ setPropStatuses,
174
175
  clientId,
175
176
  });
176
177
  return (_a = promise === null || promise === void 0 ? void 0 : promise.then(() => true)) !== null && _a !== void 0 ? _a : null;
177
178
  }
178
179
  case 'sequence-prop':
179
180
  case 'sequence-effect-prop':
181
+ case 'easing':
180
182
  return null;
181
183
  case 'sequence-all-effects':
182
184
  return deleteEffects(selections.filter(isSequenceAllEffectsSelection).map((selection) => ({
@@ -1,9 +1,9 @@
1
- import { type CodeValues, type GetDragOverrides, type GetEffectDragOverrides, type SequencePropsSubscriptionKey } from 'remotion';
1
+ import { type GetDragOverrides, type GetEffectDragOverrides, type PropStatuses, type SequencePropsSubscriptionKey } from 'remotion';
2
2
  import type { TimelineTreeNode } from '../../helpers/timeline-layout';
3
- export declare const getNodeKeyframes: ({ node, nodePath, codeValues, keyframeDisplayOffset, getDragOverrides, getEffectDragOverrides, timelinePosition, }: {
3
+ export declare const getNodeKeyframes: ({ node, nodePath, propStatuses, keyframeDisplayOffset, getDragOverrides, getEffectDragOverrides, timelinePosition, }: {
4
4
  node: TimelineTreeNode;
5
5
  nodePath: SequencePropsSubscriptionKey;
6
- codeValues: CodeValues;
6
+ propStatuses: PropStatuses;
7
7
  keyframeDisplayOffset: number;
8
8
  getDragOverrides: GetDragOverrides;
9
9
  getEffectDragOverrides: GetEffectDragOverrides;
@@ -22,7 +22,7 @@ const withDragOverrideKeyframe = ({ propStatus, keyframeDisplayOffset, timelineP
22
22
  }
23
23
  return [...keyframes, dragKeyframe].sort((first, second) => first.frame - second.frame);
24
24
  };
25
- const getNodeKeyframes = ({ node, nodePath, codeValues, keyframeDisplayOffset, getDragOverrides, getEffectDragOverrides, timelinePosition, }) => {
25
+ const getNodeKeyframes = ({ node, nodePath, propStatuses, keyframeDisplayOffset, getDragOverrides, getEffectDragOverrides, timelinePosition, }) => {
26
26
  var _a, _b;
27
27
  if (node.kind !== 'field' || node.field === null) {
28
28
  return [];
@@ -30,15 +30,15 @@ const getNodeKeyframes = ({ node, nodePath, codeValues, keyframeDisplayOffset, g
30
30
  if (node.field.kind === 'sequence-field') {
31
31
  const dragOverrides = getDragOverrides(nodePath);
32
32
  return withDragOverrideKeyframe({
33
- propStatus: (_a = remotion_1.Internals.getCodeValuesCtx(codeValues, nodePath)) === null || _a === void 0 ? void 0 : _a[node.field.key],
33
+ propStatus: (_a = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)) === null || _a === void 0 ? void 0 : _a[node.field.key],
34
34
  keyframeDisplayOffset,
35
35
  timelinePosition,
36
36
  dragOverrideValue: dragOverrides[node.field.key],
37
37
  hasDragOverride: hasOverride(dragOverrides, node.field.key),
38
38
  });
39
39
  }
40
- const effectStatus = remotion_1.Internals.getEffectCodeValuesCtx({
41
- codeValues,
40
+ const effectStatus = remotion_1.Internals.getEffectPropStatusesCtx({
41
+ propStatuses,
42
42
  nodePath,
43
43
  effectIndex: node.field.effectIndex,
44
44
  });
@@ -0,0 +1,9 @@
1
+ export type TimelineEasingSegment = {
2
+ readonly fromFrame: number;
3
+ readonly toFrame: number;
4
+ readonly segmentIndex: number;
5
+ };
6
+ export declare const getTimelineEasingSegments: (keyframes: {
7
+ frame: number;
8
+ value: unknown;
9
+ }[]) => TimelineEasingSegment[];
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTimelineEasingSegments = void 0;
4
+ const getTimelineEasingSegments = (keyframes) => {
5
+ return keyframes.flatMap((keyframe, index) => {
6
+ const nextKeyframe = keyframes[index + 1];
7
+ if (!nextKeyframe) {
8
+ return [];
9
+ }
10
+ return [
11
+ {
12
+ fromFrame: keyframe.frame,
13
+ toFrame: nextKeyframe.frame,
14
+ segmentIndex: index,
15
+ },
16
+ ];
17
+ });
18
+ };
19
+ exports.getTimelineEasingSegments = getTimelineEasingSegments;
@@ -1,5 +1,5 @@
1
- import type { CodeValues, OverrideIdToNodePaths, SequencePropsSubscriptionKey, SequenceSchema, TSequence } from 'remotion';
2
- import type { SetCodeValues } from './save-sequence-prop';
1
+ import type { OverrideIdToNodePaths, PropStatuses, SequencePropsSubscriptionKey, SequenceSchema, TSequence } from 'remotion';
2
+ import type { SetPropStatuses } from './save-sequence-prop';
3
3
  import type { TimelineSelection } from './TimelineSelection';
4
4
  type SequencePropResetTarget = {
5
5
  readonly type: 'sequence-prop';
@@ -21,18 +21,18 @@ type EffectPropResetTarget = {
21
21
  readonly schema: SequenceSchema;
22
22
  };
23
23
  type TimelinePropResetTarget = SequencePropResetTarget | EffectPropResetTarget;
24
- export declare const getTimelinePropResetTargets: ({ selections, sequences, overrideIdsToNodePaths, codeValues, }: {
24
+ export declare const getTimelinePropResetTargets: ({ selections, sequences, overrideIdsToNodePaths, propStatuses, }: {
25
25
  readonly selections: readonly TimelineSelection[];
26
26
  readonly sequences: TSequence[];
27
27
  readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
28
- readonly codeValues: CodeValues;
28
+ readonly propStatuses: PropStatuses;
29
29
  }) => TimelinePropResetTarget[] | null;
30
- export declare const resetSelectedTimelineProps: ({ selections, sequences, overrideIdsToNodePaths, codeValues, setCodeValues, clientId, }: {
30
+ export declare const resetSelectedTimelineProps: ({ selections, sequences, overrideIdsToNodePaths, propStatuses, setPropStatuses, clientId, }: {
31
31
  readonly selections: readonly TimelineSelection[];
32
32
  readonly sequences: TSequence[];
33
33
  readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
34
- readonly codeValues: CodeValues;
35
- readonly setCodeValues: SetCodeValues;
34
+ readonly propStatuses: PropStatuses;
35
+ readonly setPropStatuses: SetPropStatuses;
36
36
  readonly clientId: string;
37
37
  }) => Promise<void> | null;
38
38
  export {};
@@ -8,7 +8,7 @@ const save_sequence_prop_1 = require("./save-sequence-prop");
8
8
  const isPropResetSelection = (selection) => selection.type === 'sequence-prop' ||
9
9
  selection.type === 'sequence-effect-prop';
10
10
  const isVisibleFieldSchema = (fieldSchema) => fieldSchema !== undefined && fieldSchema.type !== 'hidden';
11
- const isNonDefaultCodeValue = ({ codeValue, defaultValue, }) => JSON.stringify(codeValue !== null && codeValue !== void 0 ? codeValue : defaultValue) !== JSON.stringify(defaultValue);
11
+ const isNonDefaultCodeValue = ({ propStatus, defaultValue, }) => JSON.stringify(propStatus !== null && propStatus !== void 0 ? propStatus : defaultValue) !== JSON.stringify(defaultValue);
12
12
  const isResettablePropStatus = ({ propStatus, defaultValue, }) => {
13
13
  if (!propStatus || propStatus.status === 'computed') {
14
14
  return false;
@@ -20,14 +20,14 @@ const isResettablePropStatus = ({ propStatus, defaultValue, }) => {
20
20
  return true;
21
21
  }
22
22
  return isNonDefaultCodeValue({
23
- codeValue: propStatus.codeValue,
23
+ propStatus: propStatus.codeValue,
24
24
  defaultValue,
25
25
  });
26
26
  };
27
27
  const getDefaultValue = (fieldSchema) => fieldSchema.default !== undefined
28
28
  ? JSON.stringify(fieldSchema.default)
29
29
  : null;
30
- const getTimelinePropResetTargets = ({ selections, sequences, overrideIdsToNodePaths, codeValues, }) => {
30
+ const getTimelinePropResetTargets = ({ selections, sequences, overrideIdsToNodePaths, propStatuses, }) => {
31
31
  var _a;
32
32
  var _b;
33
33
  const firstSelection = selections[0];
@@ -54,7 +54,7 @@ const getTimelinePropResetTargets = ({ selections, sequences, overrideIdsToNodeP
54
54
  continue;
55
55
  }
56
56
  const sequenceFieldSchema = sequence.controls.schema[selection.key];
57
- const sequencePropStatus = (_a = remotion_1.Internals.getCodeValuesCtx(codeValues, nodePath)) === null || _a === void 0 ? void 0 : _a[selection.key];
57
+ const sequencePropStatus = (_a = remotion_1.Internals.getPropStatusesCtx(propStatuses, nodePath)) === null || _a === void 0 ? void 0 : _a[selection.key];
58
58
  if (!isVisibleFieldSchema(sequenceFieldSchema) ||
59
59
  !isResettablePropStatus({
60
60
  propStatus: sequencePropStatus,
@@ -75,8 +75,8 @@ const getTimelinePropResetTargets = ({ selections, sequences, overrideIdsToNodeP
75
75
  }
76
76
  const effect = sequence.effects[selection.i];
77
77
  const fieldSchema = effect === null || effect === void 0 ? void 0 : effect.schema[selection.key];
78
- const effectStatus = remotion_1.Internals.getEffectCodeValuesCtx({
79
- codeValues,
78
+ const effectStatus = remotion_1.Internals.getEffectPropStatusesCtx({
79
+ propStatuses,
80
80
  nodePath,
81
81
  effectIndex: selection.i,
82
82
  });
@@ -105,12 +105,12 @@ const getTimelinePropResetTargets = ({ selections, sequences, overrideIdsToNodeP
105
105
  return resetTargets;
106
106
  };
107
107
  exports.getTimelinePropResetTargets = getTimelinePropResetTargets;
108
- const resetSelectedTimelineProps = ({ selections, sequences, overrideIdsToNodePaths, codeValues, setCodeValues, clientId, }) => {
108
+ const resetSelectedTimelineProps = ({ selections, sequences, overrideIdsToNodePaths, propStatuses, setPropStatuses, clientId, }) => {
109
109
  const resetTargets = (0, exports.getTimelinePropResetTargets)({
110
110
  selections,
111
111
  sequences,
112
112
  overrideIdsToNodePaths,
113
- codeValues,
113
+ propStatuses,
114
114
  });
115
115
  if (resetTargets === null || resetTargets.length === 0) {
116
116
  return null;
@@ -128,7 +128,7 @@ const resetSelectedTimelineProps = ({ selections, sequences, overrideIdsToNodePa
128
128
  defaultValue: target.defaultValue,
129
129
  schema: target.schema,
130
130
  })),
131
- setCodeValues,
131
+ setPropStatuses,
132
132
  clientId,
133
133
  undoLabel: sequencePropTargets.length > 1
134
134
  ? 'Reset selected sequence props'
@@ -148,7 +148,7 @@ const resetSelectedTimelineProps = ({ selections, sequences, overrideIdsToNodePa
148
148
  value: target.value,
149
149
  defaultValue: target.defaultValue,
150
150
  schema: target.schema,
151
- setCodeValues,
151
+ setPropStatuses,
152
152
  clientId,
153
153
  }));
154
154
  }
@@ -1,6 +1,6 @@
1
1
  import { type EffectClipboardParam } from '@remotion/studio-shared';
2
2
  import type { SequencePropsSubscriptionKey, SequenceSchema } from 'remotion';
3
- import type { SetCodeValues } from './save-sequence-prop';
3
+ import type { SetPropStatuses } from './save-sequence-prop';
4
4
  type SaveEffectPropBase = {
5
5
  fileName: string;
6
6
  nodePath: SequencePropsSubscriptionKey;
@@ -8,7 +8,7 @@ type SaveEffectPropBase = {
8
8
  fieldKey: string;
9
9
  defaultValue: string | null;
10
10
  schema: SequenceSchema;
11
- setCodeValues: SetCodeValues;
11
+ setPropStatuses: SetPropStatuses;
12
12
  clientId: string;
13
13
  };
14
14
  type SaveEffectPropValue = SaveEffectPropBase & {
@@ -3,23 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.saveEffectProp = void 0;
4
4
  const studio_shared_1 = require("@remotion/studio-shared");
5
5
  const call_api_1 = require("../call-api");
6
- const apply_effect_response_to_code_values_1 = require("./apply-effect-response-to-code-values");
6
+ const apply_effect_response_to_prop_statuses_1 = require("./apply-effect-response-to-prop-statuses");
7
7
  const save_prop_queue_1 = require("./save-prop-queue");
8
8
  const saveEffectProp = (input) => {
9
- const { fileName, nodePath, effectIndex, fieldKey, defaultValue, schema, setCodeValues, clientId, } = input;
9
+ const { fileName, nodePath, effectIndex, fieldKey, defaultValue, schema, setPropStatuses, clientId, } = input;
10
10
  return (0, save_prop_queue_1.enqueueSavePropChange)({
11
11
  nodePath,
12
- setCodeValues,
12
+ setPropStatuses,
13
13
  applyOptimistic: (prev) => input.type === 'effect-param'
14
14
  ? prev
15
- : (0, studio_shared_1.optimisticUpdateForEffectCodeValues)({
15
+ : (0, studio_shared_1.optimisticUpdateForEffectPropStatuses)({
16
16
  previous: prev,
17
17
  effectIndex,
18
18
  fieldKey,
19
19
  value: input.value,
20
20
  schema,
21
21
  }),
22
- applyServerResponse: (prev, response) => (0, apply_effect_response_to_code_values_1.applyEffectResponseToCodeValues)({ previous: prev, response }),
22
+ applyServerResponse: (prev, response) => (0, apply_effect_response_to_prop_statuses_1.applyEffectResponseToPropStatuses)({ previous: prev, response }),
23
23
  apiCall: () => (0, call_api_1.callApi)('/api/save-effect-props', input.type === 'effect-param'
24
24
  ? {
25
25
  type: 'effect-param',
@@ -1,12 +1,12 @@
1
1
  import type { CanUpdateSequencePropsResponse, SequencePropsSubscriptionKey } from 'remotion';
2
- type SetCodeValues = (nodePath: SequencePropsSubscriptionKey, values: (prev: CanUpdateSequencePropsResponse) => CanUpdateSequencePropsResponse) => void;
2
+ type SetPropStatuses = (nodePath: SequencePropsSubscriptionKey, values: (prev: CanUpdateSequencePropsResponse) => CanUpdateSequencePropsResponse) => void;
3
3
  export type EnqueueSaveOptions<TResponse> = {
4
4
  nodePath: SequencePropsSubscriptionKey;
5
- setCodeValues: SetCodeValues;
5
+ setPropStatuses: SetPropStatuses;
6
6
  applyOptimistic: (prev: CanUpdateSequencePropsResponse) => CanUpdateSequencePropsResponse;
7
7
  applyServerResponse?: (prev: CanUpdateSequencePropsResponse, response: TResponse) => CanUpdateSequencePropsResponse;
8
8
  apiCall: () => Promise<TResponse>;
9
9
  errorLabel: string;
10
10
  };
11
- export declare const enqueueSavePropChange: <TResponse>({ nodePath, setCodeValues, applyOptimistic, applyServerResponse, apiCall, errorLabel, }: EnqueueSaveOptions<TResponse>) => Promise<void>;
11
+ export declare const enqueueSavePropChange: <TResponse>({ nodePath, setPropStatuses, applyOptimistic, applyServerResponse, apiCall, errorLabel, }: EnqueueSaveOptions<TResponse>) => Promise<void>;
12
12
  export {};
@@ -19,12 +19,12 @@ const dropQueue = (nodePath, q) => {
19
19
  queues.delete(key);
20
20
  }
21
21
  };
22
- const enqueueSavePropChange = ({ nodePath, setCodeValues, applyOptimistic, applyServerResponse, apiCall, errorLabel, }) => {
22
+ const enqueueSavePropChange = ({ nodePath, setPropStatuses, applyOptimistic, applyServerResponse, apiCall, errorLabel, }) => {
23
23
  const q = getQueue(nodePath);
24
24
  if (q.cancelled) {
25
25
  return Promise.resolve();
26
26
  }
27
- setCodeValues(nodePath, (prev) => {
27
+ setPropStatuses(nodePath, (prev) => {
28
28
  return applyOptimistic(prev);
29
29
  });
30
30
  const myQueue = q;
@@ -40,7 +40,7 @@ const enqueueSavePropChange = ({ nodePath, setCodeValues, applyOptimistic, apply
40
40
  // If nothing more is queued, reset baseline so the next round starts fresh.
41
41
  if (myQueue.chain === next) {
42
42
  if (applyServerResponse) {
43
- setCodeValues(nodePath, (prev) => applyServerResponse(prev, response));
43
+ setPropStatuses(nodePath, (prev) => applyServerResponse(prev, response));
44
44
  }
45
45
  dropQueue(nodePath, myQueue);
46
46
  }
@@ -1,5 +1,5 @@
1
1
  import type { CanUpdateSequencePropsResponse, SequencePropsSubscriptionKey, SequenceSchema } from 'remotion';
2
- export type SetCodeValues = (nodePath: SequencePropsSubscriptionKey, values: (prev: CanUpdateSequencePropsResponse) => CanUpdateSequencePropsResponse) => void;
2
+ export type SetPropStatuses = (nodePath: SequencePropsSubscriptionKey, values: (prev: CanUpdateSequencePropsResponse) => CanUpdateSequencePropsResponse) => void;
3
3
  export type SaveSequencePropChange = {
4
4
  fileName: string;
5
5
  nodePath: SequencePropsSubscriptionKey;
@@ -10,10 +10,10 @@ export type SaveSequencePropChange = {
10
10
  };
11
11
  type SaveSequencePropsOptions = {
12
12
  changes: SaveSequencePropChange[];
13
- setCodeValues: SetCodeValues;
13
+ setPropStatuses: SetPropStatuses;
14
14
  clientId: string;
15
15
  undoLabel: string;
16
16
  redoLabel: string;
17
17
  };
18
- export declare const saveSequenceProps: ({ changes, setCodeValues, clientId, undoLabel, redoLabel, }: SaveSequencePropsOptions) => Promise<void>;
18
+ export declare const saveSequenceProps: ({ changes, setPropStatuses, clientId, undoLabel, redoLabel, }: SaveSequencePropsOptions) => Promise<void>;
19
19
  export {};
@@ -4,7 +4,7 @@ exports.saveSequenceProps = void 0;
4
4
  const studio_shared_1 = require("@remotion/studio-shared");
5
5
  const call_api_1 = require("../call-api");
6
6
  const save_prop_queue_1 = require("./save-prop-queue");
7
- const saveSequenceProps = ({ changes, setCodeValues, clientId, undoLabel, redoLabel, }) => {
7
+ const saveSequenceProps = ({ changes, setPropStatuses, clientId, undoLabel, redoLabel, }) => {
8
8
  if (changes.length === 0) {
9
9
  return Promise.resolve();
10
10
  }
@@ -15,8 +15,8 @@ const saveSequenceProps = ({ changes, setCodeValues, clientId, undoLabel, redoLa
15
15
  }
16
16
  return (0, save_prop_queue_1.enqueueSavePropChange)({
17
17
  nodePath: change.nodePath,
18
- setCodeValues,
19
- applyOptimistic: (prev) => (0, studio_shared_1.optimisticUpdateForCodeValues)({
18
+ setPropStatuses,
19
+ applyOptimistic: (prev) => (0, studio_shared_1.optimisticUpdateForPropStatuses)({
20
20
  previous: prev,
21
21
  fieldKey: change.fieldKey,
22
22
  value: change.value,
@@ -41,7 +41,7 @@ const saveSequenceProps = ({ changes, setCodeValues, clientId, undoLabel, redoLa
41
41
  });
42
42
  }
43
43
  for (const change of changes) {
44
- setCodeValues(change.nodePath, (prev) => (0, studio_shared_1.optimisticUpdateForCodeValues)({
44
+ setPropStatuses(change.nodePath, (prev) => (0, studio_shared_1.optimisticUpdateForPropStatuses)({
45
45
  previous: prev,
46
46
  fieldKey: change.fieldKey,
47
47
  value: change.value,
@@ -1,3 +1,13 @@
1
1
  export declare const getDecimalPlaces: (num: number) => number;
2
+ export declare const getTimelineDisplayDecimalPlaces: ({ defaultDecimalPlaces, step, }: {
3
+ readonly defaultDecimalPlaces: number;
4
+ readonly step: number | undefined;
5
+ }) => number;
6
+ export declare const roundToDecimalPlaces: (value: number, decimalPlaces: number) => number;
7
+ export declare const formatTimelineNumber: ({ decimalPlaces, fixed, value, }: {
8
+ readonly decimalPlaces: number;
9
+ readonly fixed: boolean;
10
+ readonly value: string | number;
11
+ }) => string;
2
12
  export declare const normalizeTimelineNumber: (value: number) => number;
3
13
  export declare const draggerStyle: React.CSSProperties;
@@ -1,14 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.draggerStyle = exports.normalizeTimelineNumber = exports.getDecimalPlaces = void 0;
3
+ exports.draggerStyle = exports.normalizeTimelineNumber = exports.formatTimelineNumber = exports.roundToDecimalPlaces = exports.getTimelineDisplayDecimalPlaces = exports.getDecimalPlaces = void 0;
4
4
  const getDecimalPlaces = (num) => {
5
- const str = String(num);
6
- const decimalIndex = str.indexOf('.');
7
- return decimalIndex === -1 ? 0 : str.length - decimalIndex - 1;
5
+ const [coefficient, exponent] = String(num).toLowerCase().split('e');
6
+ const decimalIndex = coefficient.indexOf('.');
7
+ const coefficientDecimals = decimalIndex === -1 ? 0 : coefficient.length - decimalIndex - 1;
8
+ if (exponent === undefined) {
9
+ return coefficientDecimals;
10
+ }
11
+ return Math.max(0, coefficientDecimals - Number(exponent));
8
12
  };
9
13
  exports.getDecimalPlaces = getDecimalPlaces;
14
+ const getTimelineDisplayDecimalPlaces = ({ defaultDecimalPlaces, step, }) => {
15
+ return Math.max(defaultDecimalPlaces, step === undefined ? 0 : (0, exports.getDecimalPlaces)(step));
16
+ };
17
+ exports.getTimelineDisplayDecimalPlaces = getTimelineDisplayDecimalPlaces;
18
+ const roundToDecimalPlaces = (value, decimalPlaces) => {
19
+ const factor = 10 ** decimalPlaces;
20
+ const rounded = Math.round(value * factor) / factor;
21
+ return Object.is(rounded, -0) ? 0 : rounded;
22
+ };
23
+ exports.roundToDecimalPlaces = roundToDecimalPlaces;
24
+ const formatTimelineNumber = ({ decimalPlaces, fixed, value, }) => {
25
+ const rounded = (0, exports.roundToDecimalPlaces)(Number(value), decimalPlaces);
26
+ return fixed && decimalPlaces > 0
27
+ ? rounded.toFixed(decimalPlaces)
28
+ : String(rounded);
29
+ };
30
+ exports.formatTimelineNumber = formatTimelineNumber;
10
31
  const normalizeTimelineNumber = (value) => {
11
- return Math.round(value * 1000000) / 1000000;
32
+ return (0, exports.roundToDecimalPlaces)(value, 6);
12
33
  };
13
34
  exports.normalizeTimelineNumber = normalizeTimelineNumber;
14
35
  exports.draggerStyle = {
@@ -1,2 +1,2 @@
1
1
  export declare const parseTranslate: (value: string) => [number, number];
2
- export declare const serializeTranslate: (x: number, y: number) => string;
2
+ export declare const serializeTranslate: (x: number, y: number, decimalPlaces?: number) => string;
@@ -15,13 +15,12 @@ const parseTranslate = (value) => {
15
15
  ];
16
16
  };
17
17
  exports.parseTranslate = parseTranslate;
18
- const formatTranslateCoordinate = (value) => {
18
+ const formatTranslateCoordinate = (value, decimalPlaces) => {
19
19
  const normalized = (0, timeline_field_utils_1.normalizeTimelineNumber)(value);
20
- const factor = 10 ** translateDecimalPlaces;
21
- const rounded = Math.round(normalized * factor) / factor;
20
+ const rounded = (0, timeline_field_utils_1.roundToDecimalPlaces)(normalized, decimalPlaces);
22
21
  return String(Object.is(rounded, -0) ? 0 : rounded);
23
22
  };
24
- const serializeTranslate = (x, y) => {
25
- return `${formatTranslateCoordinate(x)}px ${formatTranslateCoordinate(y)}px`;
23
+ const serializeTranslate = (x, y, decimalPlaces = translateDecimalPlaces) => {
24
+ return `${formatTranslateCoordinate(x, decimalPlaces)}px ${formatTranslateCoordinate(y, decimalPlaces)}px`;
26
25
  };
27
26
  exports.serializeTranslate = serializeTranslate;