@remotion/studio 4.0.472 → 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 (165) hide show
  1. package/dist/api/rename-static-file.d.ts +6 -0
  2. package/dist/api/rename-static-file.js +18 -0
  3. package/dist/components/AssetSelector.js +45 -4
  4. package/dist/components/AssetSelectorItem.js +177 -27
  5. package/dist/components/Canvas.js +131 -11
  6. package/dist/components/ConfirmationDialog-types.d.ts +8 -0
  7. package/dist/components/ConfirmationDialog-types.js +2 -0
  8. package/dist/components/ConfirmationDialog.d.ts +7 -0
  9. package/dist/components/ConfirmationDialog.js +103 -0
  10. package/dist/components/ContextMenu.d.ts +9 -1
  11. package/dist/components/ContextMenu.js +49 -5
  12. package/dist/components/CurrentAsset.d.ts +1 -0
  13. package/dist/components/CurrentAsset.js +13 -2
  14. package/dist/components/EditorContent.js +15 -2
  15. package/dist/components/EditorContexts.js +2 -1
  16. package/dist/components/EditorRuler/Ruler.js +2 -0
  17. package/dist/components/ExplorerPanel.d.ts +0 -4
  18. package/dist/components/ExplorerPanel.js +8 -4
  19. package/dist/components/ExplorerPanelRef.d.ts +4 -0
  20. package/dist/components/ExplorerPanelRef.js +5 -0
  21. package/dist/components/FilePreview.d.ts +1 -1
  22. package/dist/components/InitialCompositionLoader.d.ts +0 -1
  23. package/dist/components/InitialCompositionLoader.js +5 -27
  24. package/dist/components/Menu/MenuItem.js +7 -1
  25. package/dist/components/Menu/SubMenu.js +5 -1
  26. package/dist/components/Menu/portals.js +17 -8
  27. package/dist/components/MenuToolbar.js +5 -1
  28. package/dist/components/ModalContainer.js +6 -1
  29. package/dist/components/Modals.js +5 -2
  30. package/dist/components/NewComposition/ComboBox.js +8 -2
  31. package/dist/components/NewComposition/InputDragger.d.ts +1 -0
  32. package/dist/components/NewComposition/InputDragger.js +9 -6
  33. package/dist/components/NewComposition/RenameStaticFile.d.ts +4 -0
  34. package/dist/components/NewComposition/RenameStaticFile.js +118 -0
  35. package/dist/components/OptionsPanel.js +5 -1
  36. package/dist/components/OutlineToggle.d.ts +2 -0
  37. package/dist/components/OutlineToggle.js +20 -0
  38. package/dist/components/Preview.d.ts +0 -2
  39. package/dist/components/Preview.js +23 -33
  40. package/dist/components/PreviewToolbar.js +19 -6
  41. package/dist/components/RenderButton.js +8 -2
  42. package/dist/components/RenderPreview.js +2 -2
  43. package/dist/components/SelectedOutlineOverlay.d.ts +29 -3
  44. package/dist/components/SelectedOutlineOverlay.js +259 -80
  45. package/dist/components/ShowOutlinesProvider.d.ts +4 -0
  46. package/dist/components/ShowOutlinesProvider.js +24 -0
  47. package/dist/components/SizeSelector.js +3 -3
  48. package/dist/components/Splitter/SplitterHandle.js +2 -0
  49. package/dist/components/StaticFilePreview.js +2 -2
  50. package/dist/components/Timeline/KeyframeSettingsModal.d.ts +15 -0
  51. package/dist/components/Timeline/KeyframeSettingsModal.js +150 -0
  52. package/dist/components/Timeline/SequencePropsObserver.js +3 -3
  53. package/dist/components/Timeline/Timeline.js +3 -13
  54. package/dist/components/Timeline/TimelineClipboardKeybindings.d.ts +26 -3
  55. package/dist/components/Timeline/TimelineClipboardKeybindings.js +242 -25
  56. package/dist/components/Timeline/TimelineDeleteKeybindings.js +23 -11
  57. package/dist/components/Timeline/TimelineEffectItem.js +8 -7
  58. package/dist/components/Timeline/TimelineEffectPropItem.js +69 -19
  59. package/dist/components/Timeline/TimelineExpandedKeyframeRow.js +6 -1
  60. package/dist/components/Timeline/TimelineExpandedSection.js +5 -5
  61. package/dist/components/Timeline/TimelineKeyframeControls.js +13 -23
  62. package/dist/components/Timeline/TimelineKeyframeDiamond.js +24 -22
  63. package/dist/components/Timeline/TimelineKeyframeDiamondIcon.d.ts +6 -0
  64. package/dist/components/Timeline/TimelineKeyframeDiamondIcon.js +14 -0
  65. package/dist/components/Timeline/TimelineKeyframeDragState.d.ts +17 -0
  66. package/dist/components/Timeline/TimelineKeyframeDragState.js +39 -0
  67. package/dist/components/Timeline/TimelineKeyframeEasingLine.d.ts +9 -0
  68. package/dist/components/Timeline/TimelineKeyframeEasingLine.js +120 -0
  69. package/dist/components/Timeline/TimelineKeyframedValue.js +1 -1
  70. package/dist/components/Timeline/TimelineList.js +2 -2
  71. package/dist/components/Timeline/TimelineMediaInfo.d.ts +0 -13
  72. package/dist/components/Timeline/TimelineMediaInfo.js +8 -73
  73. package/dist/components/Timeline/TimelineNumberField.js +15 -7
  74. package/dist/components/Timeline/TimelineRotationField.js +17 -11
  75. package/dist/components/Timeline/TimelineScaleField.js +17 -13
  76. package/dist/components/Timeline/TimelineSelection.d.ts +15 -0
  77. package/dist/components/Timeline/TimelineSelection.js +26 -1
  78. package/dist/components/Timeline/TimelineSequence.js +6 -6
  79. package/dist/components/Timeline/TimelineSequenceItem.d.ts +1 -0
  80. package/dist/components/Timeline/TimelineSequenceItem.js +297 -36
  81. package/dist/components/Timeline/TimelineSequencePropItem.js +113 -48
  82. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +5 -5
  83. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +69 -70
  84. package/dist/components/Timeline/TimelineTranslateField.js +24 -19
  85. package/dist/components/Timeline/TimelineUvCoordinateField.js +18 -12
  86. package/dist/components/Timeline/apply-effect-response-to-prop-statuses.d.ts +5 -0
  87. package/dist/components/Timeline/apply-effect-response-to-prop-statuses.js +19 -0
  88. package/dist/components/Timeline/call-add-keyframe.d.ts +5 -5
  89. package/dist/components/Timeline/call-add-keyframe.js +6 -4
  90. package/dist/components/Timeline/call-delete-keyframe.d.ts +7 -7
  91. package/dist/components/Timeline/call-delete-keyframe.js +7 -7
  92. package/dist/components/Timeline/call-move-keyframe.d.ts +19 -0
  93. package/dist/components/Timeline/call-move-keyframe.js +71 -0
  94. package/dist/components/Timeline/call-update-keyframe-settings.d.ts +22 -0
  95. package/dist/components/Timeline/call-update-keyframe-settings.js +52 -0
  96. package/dist/components/Timeline/delete-selected-keyframe.d.ts +5 -5
  97. package/dist/components/Timeline/delete-selected-keyframe.js +5 -5
  98. package/dist/components/Timeline/delete-selected-timeline-item.d.ts +10 -7
  99. package/dist/components/Timeline/delete-selected-timeline-item.js +37 -23
  100. package/dist/components/Timeline/duplicate-selected-timeline-item.d.ts +4 -2
  101. package/dist/components/Timeline/duplicate-selected-timeline-item.js +39 -34
  102. package/dist/components/Timeline/get-bounded-keyframe-drag-delta.d.ts +8 -0
  103. package/dist/components/Timeline/get-bounded-keyframe-drag-delta.js +12 -0
  104. package/dist/components/Timeline/get-keyframe-navigation.d.ts +2 -2
  105. package/dist/components/Timeline/get-keyframe-navigation.js +14 -6
  106. package/dist/components/Timeline/get-node-keyframes.d.ts +3 -3
  107. package/dist/components/Timeline/get-node-keyframes.js +4 -4
  108. package/dist/components/Timeline/get-timeline-easing-segments.d.ts +9 -0
  109. package/dist/components/Timeline/get-timeline-easing-segments.js +19 -0
  110. package/dist/components/Timeline/reset-selected-timeline-props.d.ts +7 -7
  111. package/dist/components/Timeline/reset-selected-timeline-props.js +13 -12
  112. package/dist/components/Timeline/save-effect-prop.d.ts +16 -5
  113. package/dist/components/Timeline/save-effect-prop.js +37 -19
  114. package/dist/components/Timeline/save-prop-queue.d.ts +4 -3
  115. package/dist/components/Timeline/save-prop-queue.js +6 -3
  116. package/dist/components/Timeline/save-sequence-prop.d.ts +5 -10
  117. package/dist/components/Timeline/save-sequence-prop.js +35 -32
  118. package/dist/components/Timeline/should-clear-selection-on-pointer-down.d.ts +3 -0
  119. package/dist/components/Timeline/should-clear-selection-on-pointer-down.js +7 -0
  120. package/dist/components/Timeline/timeline-asset-link.d.ts +13 -0
  121. package/dist/components/Timeline/timeline-asset-link.js +37 -0
  122. package/dist/components/Timeline/timeline-field-utils.d.ts +10 -0
  123. package/dist/components/Timeline/timeline-field-utils.js +26 -5
  124. package/dist/components/Timeline/timeline-translate-utils.d.ts +1 -1
  125. package/dist/components/Timeline/timeline-translate-utils.js +6 -4
  126. package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +7 -7
  127. package/dist/components/Timeline/use-sequence-props-subscription.js +3 -3
  128. package/dist/components/Timeline/use-timeline-height.js +3 -3
  129. package/dist/components/Timeline/use-timeline-keyframe-drag.d.ts +10 -0
  130. package/dist/components/Timeline/use-timeline-keyframe-drag.js +380 -0
  131. package/dist/components/import-assets.d.ts +31 -0
  132. package/dist/components/import-assets.js +216 -17
  133. package/dist/components/load-canvas-content-from-url.d.ts +1 -0
  134. package/dist/components/load-canvas-content-from-url.js +9 -3
  135. package/dist/components/use-select-asset.d.ts +1 -0
  136. package/dist/components/use-select-asset.js +30 -0
  137. package/dist/error-overlay/error-origin.d.ts +3 -0
  138. package/dist/error-overlay/error-origin.js +42 -0
  139. package/dist/error-overlay/react-overlay/listen-to-runtime-errors.js +6 -2
  140. package/dist/error-overlay/remotion-overlay/ErrorLoader.js +38 -0
  141. package/dist/error-overlay/remotion-overlay/ShortcutHint.js +1 -1
  142. package/dist/error-overlay/remotion-overlay/log-studio-error.d.ts +3 -0
  143. package/dist/error-overlay/remotion-overlay/log-studio-error.js +27 -0
  144. package/dist/esm/{chunk-48grt472.js → chunk-xjvc8qen.js} +21838 -18862
  145. package/dist/esm/internals.mjs +21838 -18862
  146. package/dist/esm/previewEntry.mjs +21127 -18127
  147. package/dist/esm/renderEntry.mjs +1 -1
  148. package/dist/helpers/get-asset-metadata.js +2 -2
  149. package/dist/helpers/get-preview-file-type.d.ts +2 -0
  150. package/dist/helpers/get-preview-file-type.js +33 -0
  151. package/dist/helpers/install-required-package.d.ts +1 -0
  152. package/dist/helpers/install-required-package.js +39 -0
  153. package/dist/helpers/remote-asset-drag.d.ts +4 -0
  154. package/dist/helpers/remote-asset-drag.js +73 -0
  155. package/dist/helpers/timeline-layout.d.ts +6 -6
  156. package/dist/helpers/timeline-layout.js +5 -5
  157. package/dist/helpers/use-asset-drag-events.d.ts +5 -2
  158. package/dist/helpers/use-asset-drag-events.js +13 -2
  159. package/dist/hot-middleware-client/client.js +6 -0
  160. package/dist/state/editor-outlines.d.ts +8 -0
  161. package/dist/state/editor-outlines.js +18 -0
  162. package/dist/state/modals.d.ts +16 -2
  163. package/package.json +10 -10
  164. package/dist/helpers/detect-file-type.d.ts +0 -69
  165. package/dist/helpers/detect-file-type.js +0 -278
@@ -1,11 +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
+ applyServerResponse?: (prev: CanUpdateSequencePropsResponse, response: TResponse) => CanUpdateSequencePropsResponse;
7
8
  apiCall: () => Promise<TResponse>;
8
9
  errorLabel: string;
9
10
  };
10
- export declare const enqueueSavePropChange: <TResponse>({ nodePath, setCodeValues, applyOptimistic, apiCall, errorLabel, }: EnqueueSaveOptions<TResponse>) => Promise<void>;
11
+ export declare const enqueueSavePropChange: <TResponse>({ nodePath, setPropStatuses, applyOptimistic, applyServerResponse, apiCall, errorLabel, }: EnqueueSaveOptions<TResponse>) => Promise<void>;
11
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, 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;
@@ -33,12 +33,15 @@ const enqueueSavePropChange = ({ nodePath, setCodeValues, applyOptimistic, apiCa
33
33
  return;
34
34
  }
35
35
  try {
36
- await apiCall();
36
+ const response = await apiCall();
37
37
  if (myQueue.cancelled) {
38
38
  return;
39
39
  }
40
40
  // If nothing more is queued, reset baseline so the next round starts fresh.
41
41
  if (myQueue.chain === next) {
42
+ if (applyServerResponse) {
43
+ setPropStatuses(nodePath, (prev) => applyServerResponse(prev, response));
44
+ }
42
45
  dropQueue(nodePath, myQueue);
43
46
  }
44
47
  }
@@ -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,15 +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
- undoLabel: string | null;
16
- redoLabel: string | null;
15
+ undoLabel: string;
16
+ redoLabel: string;
17
17
  };
18
- type SaveSequencePropOptions = SaveSequencePropChange & {
19
- setCodeValues: SetCodeValues;
20
- clientId: string;
21
- };
22
- export declare const saveSequenceProps: ({ changes, setCodeValues, clientId, undoLabel, redoLabel, }: SaveSequencePropsOptions) => Promise<void>;
23
- export declare const saveSequenceProp: ({ fileName, nodePath, fieldKey, value, defaultValue, schema, setCodeValues, clientId, }: SaveSequencePropOptions) => Promise<void>;
18
+ export declare const saveSequenceProps: ({ changes, setPropStatuses, clientId, undoLabel, redoLabel, }: SaveSequencePropsOptions) => Promise<void>;
24
19
  export {};
@@ -1,15 +1,47 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.saveSequenceProp = exports.saveSequenceProps = void 0;
3
+ 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
  }
11
+ if (changes.length === 1) {
12
+ const change = changes[0];
13
+ if (change === undefined) {
14
+ throw new Error('Expected a sequence prop change');
15
+ }
16
+ return (0, save_prop_queue_1.enqueueSavePropChange)({
17
+ nodePath: change.nodePath,
18
+ setPropStatuses,
19
+ applyOptimistic: (prev) => (0, studio_shared_1.optimisticUpdateForPropStatuses)({
20
+ previous: prev,
21
+ fieldKey: change.fieldKey,
22
+ value: change.value,
23
+ schema: change.schema,
24
+ }),
25
+ apiCall: () => (0, call_api_1.callApi)('/api/save-sequence-props', {
26
+ edits: [
27
+ {
28
+ fileName: change.fileName,
29
+ nodePath: change.nodePath,
30
+ key: change.fieldKey,
31
+ value: JSON.stringify(change.value),
32
+ defaultValue: change.defaultValue,
33
+ schema: change.schema,
34
+ },
35
+ ],
36
+ clientId,
37
+ undoLabel,
38
+ redoLabel,
39
+ }),
40
+ errorLabel: 'Could not save sequence prop',
41
+ });
42
+ }
11
43
  for (const change of changes) {
12
- setCodeValues(change.nodePath, (prev) => (0, studio_shared_1.optimisticUpdateForCodeValues)({
44
+ setPropStatuses(change.nodePath, (prev) => (0, studio_shared_1.optimisticUpdateForPropStatuses)({
13
45
  previous: prev,
14
46
  fieldKey: change.fieldKey,
15
47
  value: change.value,
@@ -33,32 +65,3 @@ const saveSequenceProps = ({ changes, setCodeValues, clientId, undoLabel, redoLa
33
65
  }).then(() => undefined);
34
66
  };
35
67
  exports.saveSequenceProps = saveSequenceProps;
36
- const saveSequenceProp = ({ fileName, nodePath, fieldKey, value, defaultValue, schema, setCodeValues, clientId, }) => {
37
- return (0, save_prop_queue_1.enqueueSavePropChange)({
38
- nodePath,
39
- setCodeValues,
40
- applyOptimistic: (prev) => (0, studio_shared_1.optimisticUpdateForCodeValues)({
41
- previous: prev,
42
- fieldKey,
43
- value,
44
- schema,
45
- }),
46
- apiCall: () => (0, call_api_1.callApi)('/api/save-sequence-props', {
47
- edits: [
48
- {
49
- fileName,
50
- nodePath,
51
- key: fieldKey,
52
- value: JSON.stringify(value),
53
- defaultValue,
54
- schema,
55
- },
56
- ],
57
- clientId,
58
- undoLabel: null,
59
- redoLabel: null,
60
- }),
61
- errorLabel: 'Could not save sequence prop',
62
- });
63
- };
64
- exports.saveSequenceProp = saveSequenceProp;
@@ -0,0 +1,3 @@
1
+ export declare const shouldClearSelectionOnPointerDown: (event: {
2
+ readonly button: number;
3
+ }) => boolean;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shouldClearSelectionOnPointerDown = void 0;
4
+ const shouldClearSelectionOnPointerDown = (event) => {
5
+ return event.button === 0;
6
+ };
7
+ exports.shouldClearSelectionOnPointerDown = shouldClearSelectionOnPointerDown;
@@ -0,0 +1,13 @@
1
+ type LinkInfo = {
2
+ kind: 'local';
3
+ assetPath: string;
4
+ title: string;
5
+ } | {
6
+ kind: 'remote';
7
+ href: string;
8
+ title: string;
9
+ } | null;
10
+ export type TimelineAssetLinkInfo = Exclude<LinkInfo, null>;
11
+ export declare const getTimelineAssetLinkInfo: (src: string) => LinkInfo;
12
+ export declare const openTimelineAssetLink: (linkInfo: TimelineAssetLinkInfo, selectAsset: (asset: string) => void) => void;
13
+ export {};
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.openTimelineAssetLink = exports.getTimelineAssetLinkInfo = void 0;
4
+ const url_state_1 = require("../../helpers/url-state");
5
+ const getTimelineAssetLinkInfo = (src) => {
6
+ const staticBase = typeof window === 'undefined' ? null : window.remotion_staticBase;
7
+ if (staticBase && src.startsWith(staticBase + '/')) {
8
+ const assetPath = src.slice(staticBase.length + 1);
9
+ return {
10
+ kind: 'local',
11
+ assetPath: decodeURIComponent(assetPath),
12
+ title: decodeURIComponent(assetPath),
13
+ };
14
+ }
15
+ if (src.startsWith('http://') ||
16
+ src.startsWith('https://') ||
17
+ src.startsWith('//')) {
18
+ try {
19
+ const url = new URL(src.startsWith('//') ? 'https:' + src : src);
20
+ return { kind: 'remote', href: src, title: url.hostname };
21
+ }
22
+ catch (_a) {
23
+ return { kind: 'remote', href: src, title: src };
24
+ }
25
+ }
26
+ return null;
27
+ };
28
+ exports.getTimelineAssetLinkInfo = getTimelineAssetLinkInfo;
29
+ const openTimelineAssetLink = (linkInfo, selectAsset) => {
30
+ if (linkInfo.kind === 'local') {
31
+ selectAsset(linkInfo.assetPath);
32
+ (0, url_state_1.pushUrl)(`/assets/${linkInfo.assetPath}`);
33
+ return;
34
+ }
35
+ window.open(linkInfo.href, '_blank', 'noopener,noreferrer');
36
+ };
37
+ exports.openTimelineAssetLink = openTimelineAssetLink;
@@ -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;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.serializeTranslate = exports.parseTranslate = void 0;
4
4
  const timeline_field_utils_1 = require("./timeline-field-utils");
5
5
  const PIXEL_PATTERN = /^(-?\d+(?:\.\d+)?)px(?:\s+(-?\d+(?:\.\d+)?)px)?$/;
6
+ const translateDecimalPlaces = 1;
6
7
  const parseTranslate = (value) => {
7
8
  const m = value.match(PIXEL_PATTERN);
8
9
  if (!m) {
@@ -14,11 +15,12 @@ const parseTranslate = (value) => {
14
15
  ];
15
16
  };
16
17
  exports.parseTranslate = parseTranslate;
17
- const formatTranslateCoordinate = (value) => {
18
- const rounded = (0, timeline_field_utils_1.normalizeTimelineNumber)(value);
18
+ const formatTranslateCoordinate = (value, decimalPlaces) => {
19
+ const normalized = (0, timeline_field_utils_1.normalizeTimelineNumber)(value);
20
+ const rounded = (0, timeline_field_utils_1.roundToDecimalPlaces)(normalized, decimalPlaces);
19
21
  return String(Object.is(rounded, -0) ? 0 : rounded);
20
22
  };
21
- const serializeTranslate = (x, y) => {
22
- return `${formatTranslateCoordinate(x)}px ${formatTranslateCoordinate(y)}px`;
23
+ const serializeTranslate = (x, y, decimalPlaces = translateDecimalPlaces) => {
24
+ return `${formatTranslateCoordinate(x, decimalPlaces)}px ${formatTranslateCoordinate(y, decimalPlaces)}px`;
23
25
  };
24
26
  exports.serializeTranslate = serializeTranslate;
@@ -9,7 +9,7 @@ const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
9
9
  const get_node_keyframes_1 = require("./get-node-keyframes");
10
10
  const useExpandedTrackKeyframeRows = ({ sequence, nodePathInfo, keyframeDisplayOffset, }) => {
11
11
  const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
12
- const { codeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
12
+ const { propStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
13
13
  const { getDragOverrides, getEffectDragOverrides } = (0, react_1.useContext)(remotion_1.Internals.VisualModeDragOverridesContext);
14
14
  const timelinePosition = remotion_1.Internals.Timeline.useTimelinePosition();
15
15
  const tree = (0, react_1.useMemo)(() => (0, timeline_layout_1.buildTimelineTree)({
@@ -17,9 +17,9 @@ const useExpandedTrackKeyframeRows = ({ sequence, nodePathInfo, keyframeDisplayO
17
17
  nodePathInfo,
18
18
  getDragOverrides,
19
19
  getEffectDragOverrides,
20
- codeValues,
20
+ propStatuses,
21
21
  }), [
22
- codeValues,
22
+ propStatuses,
23
23
  getDragOverrides,
24
24
  getEffectDragOverrides,
25
25
  nodePathInfo,
@@ -30,14 +30,14 @@ const useExpandedTrackKeyframeRows = ({ sequence, nodePathInfo, keyframeDisplayO
30
30
  sequence,
31
31
  nodePathInfo,
32
32
  getIsExpanded,
33
- codeValues,
34
- }), [codeValues, getIsExpanded, nodePathInfo, sequence]);
33
+ propStatuses,
34
+ }), [propStatuses, getIsExpanded, nodePathInfo, sequence]);
35
35
  const rows = (0, react_1.useMemo)(() => flat.map(({ node }) => ({
36
36
  height: (0, timeline_layout_1.getTreeRowHeight)(node),
37
37
  keyframes: (0, get_node_keyframes_1.getNodeKeyframes)({
38
38
  node,
39
39
  nodePath: nodePathInfo.sequenceSubscriptionKey,
40
- codeValues,
40
+ propStatuses,
41
41
  keyframeDisplayOffset,
42
42
  getDragOverrides,
43
43
  getEffectDragOverrides,
@@ -46,7 +46,7 @@ const useExpandedTrackKeyframeRows = ({ sequence, nodePathInfo, keyframeDisplayO
46
46
  rowKey: (0, timeline_node_path_key_1.timelineNodePathInfoToKey)(node.nodePathInfo),
47
47
  nodePathInfo: node.nodePathInfo,
48
48
  })), [
49
- codeValues,
49
+ propStatuses,
50
50
  flat,
51
51
  getDragOverrides,
52
52
  getEffectDragOverrides,
@@ -9,7 +9,7 @@ const ExpandedTracksProvider_1 = require("../ExpandedTracksProvider");
9
9
  const sequence_props_subscription_store_1 = require("./sequence-props-subscription-store");
10
10
  const useSequencePropsSubscription = ({ originalLocation, overrideId, schema, effects, }) => {
11
11
  var _a, _b, _c;
12
- const { setCodeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
12
+ const { setPropStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModeSettersContext);
13
13
  const { setOverrideIdToNodePath } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsSettersContext);
14
14
  const { overrideIdToNodePathMappings } = (0, react_1.useContext)(remotion_1.Internals.OverrideIdsToNodePathsGettersContext);
15
15
  const { migrateExpandedTracksForSubscriptionKey } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksSetterContext);
@@ -57,7 +57,7 @@ const useSequencePropsSubscription = ({ originalLocation, overrideId, schema, ef
57
57
  if (!result.success) {
58
58
  return;
59
59
  }
60
- setCodeValues(result.nodePath, () => result.status);
60
+ setPropStatuses(result.nodePath, () => result.status);
61
61
  },
62
62
  applyEach: (result) => {
63
63
  var _a;
@@ -93,7 +93,7 @@ const useSequencePropsSubscription = ({ originalLocation, overrideId, schema, ef
93
93
  migrateExpandedTracksForSubscriptionKey,
94
94
  overrideId,
95
95
  schema,
96
- setCodeValues,
96
+ setPropStatuses,
97
97
  setOverrideIdToNodePath,
98
98
  ]);
99
99
  };
@@ -11,7 +11,7 @@ const TimelineTimeIndicators_1 = require("./TimelineTimeIndicators");
11
11
  const useTimelineHeight = ({ shown, hasBeenCut, }) => {
12
12
  const { getIsExpanded } = (0, react_1.useContext)(ExpandedTracksProvider_1.ExpandedTracksGetterContext);
13
13
  const { previewServerState } = (0, react_1.useContext)(client_id_1.StudioServerConnectionCtx);
14
- const { codeValues } = (0, react_1.useContext)(remotion_1.Internals.VisualModeCodeValuesContext);
14
+ const { propStatuses } = (0, react_1.useContext)(remotion_1.Internals.VisualModePropStatusesContext);
15
15
  const previewServerConnected = previewServerState.type === 'connected';
16
16
  return (0, react_1.useMemo)(() => {
17
17
  const tracksHeight = shown.reduce((acc, track) => {
@@ -25,7 +25,7 @@ const useTimelineHeight = ({ shown, hasBeenCut, }) => {
25
25
  sequence: track.sequence,
26
26
  nodePathInfo: track.nodePathInfo,
27
27
  getIsExpanded,
28
- codeValues,
28
+ propStatuses,
29
29
  }) + timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM
30
30
  : 0;
31
31
  return acc + layerHeight + expandedHeight;
@@ -34,6 +34,6 @@ const useTimelineHeight = ({ shown, hasBeenCut, }) => {
34
34
  timeline_layout_1.TIMELINE_ITEM_BORDER_BOTTOM +
35
35
  (hasBeenCut ? MaxTimelineTracks_1.MAX_TIMELINE_TRACKS_NOTICE_HEIGHT : 0) +
36
36
  TimelineTimeIndicators_1.TIMELINE_TIME_INDICATOR_HEIGHT);
37
- }, [shown, hasBeenCut, previewServerConnected, getIsExpanded, codeValues]);
37
+ }, [shown, hasBeenCut, previewServerConnected, getIsExpanded, propStatuses]);
38
38
  };
39
39
  exports.useTimelineHeight = useTimelineHeight;
@@ -0,0 +1,10 @@
1
+ import type React from 'react';
2
+ import type { SequenceNodePathInfo } from '../../helpers/get-timeline-sequence-sort-key';
3
+ import { type TimelineSelectionInteraction } from './TimelineSelection';
4
+ export declare const useTimelineKeyframeDrag: ({ frame, nodePathInfo, onSelect, selectable, selected, }: {
5
+ readonly frame: number;
6
+ readonly nodePathInfo: SequenceNodePathInfo;
7
+ readonly onSelect: (interaction?: TimelineSelectionInteraction | undefined) => void;
8
+ readonly selectable: boolean;
9
+ readonly selected: boolean;
10
+ }) => (e: React.PointerEvent<HTMLButtonElement>) => void;