@remotion/studio 4.0.527 → 4.0.528

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 (258) hide show
  1. package/dist/components/AgentPrompt.js +1 -2
  2. package/dist/components/AudioWaveform.d.ts +1 -0
  3. package/dist/components/AudioWaveform.js +10 -14
  4. package/dist/components/CodeFrame.js +1 -1
  5. package/dist/components/ColorPicker/checker.d.ts +1 -1
  6. package/dist/components/CurrentAsset.js +3 -2
  7. package/dist/components/EditorRuler/Ruler.js +6 -3
  8. package/dist/components/EffectPickerModal.js +69 -43
  9. package/dist/components/ElementInstallConfirmation.js +3 -3
  10. package/dist/components/ElementLibrariesSettings.d.ts +2 -0
  11. package/dist/components/ElementLibrariesSettings.js +200 -0
  12. package/dist/components/InitialCompositionLoader.js +3 -1
  13. package/dist/components/InspectorOpenInEditor.js +13 -0
  14. package/dist/components/InspectorPanel/AlignmentControls.js +28 -9
  15. package/dist/components/InspectorPanel/CollapsibleInspectorSectionHeader.js +1 -1
  16. package/dist/components/InspectorPanel/EasingInspector.js +6 -2
  17. package/dist/components/InspectorPanel/ElementLibraryButton.js +1 -1
  18. package/dist/components/InspectorPanel/KeyframeEasingNavigator.js +1 -1
  19. package/dist/components/InspectorPanel/KeyframeInspector.js +28 -24
  20. package/dist/components/InspectorPanel/MultiSequenceNumberField.js +1 -1
  21. package/dist/components/InspectorPanel/SequenceInspectorHeader.d.ts +3 -1
  22. package/dist/components/InspectorPanel/SequenceSelectionInspector.js +30 -2
  23. package/dist/components/InspectorPanel/SequenceWrapAction.d.ts +8 -0
  24. package/dist/components/InspectorPanel/SequenceWrapAction.js +151 -0
  25. package/dist/components/InspectorPanel/easing-inspector-selection.d.ts +2 -1
  26. package/dist/components/InspectorPanel/easing-inspector-selection.js +4 -3
  27. package/dist/components/InspectorPanel/keyframe-inspector-frame.d.ts +2 -1
  28. package/dist/components/InspectorPanel/keyframe-inspector-frame.js +2 -2
  29. package/dist/components/InspectorSequenceSection.d.ts +1 -0
  30. package/dist/components/InspectorSequenceSection.js +7 -5
  31. package/dist/components/KeyboardShortcutsSettings.js +1 -1
  32. package/dist/components/Menu/styles.d.ts +2 -2
  33. package/dist/components/Modals.js +7 -6
  34. package/dist/components/ModelManager.js +10 -9
  35. package/dist/components/NewComposition/CancelButton.js +10 -4
  36. package/dist/components/NewComposition/InputDragger.d.ts +3 -1
  37. package/dist/components/NewComposition/InputDragger.js +28 -9
  38. package/dist/components/NewComposition/NewComposition.js +7 -6
  39. package/dist/components/NewComposition/RemInput.d.ts +1 -1
  40. package/dist/components/NewComposition/menu-typeahead.js +1 -1
  41. package/dist/components/Preview.js +3 -2
  42. package/dist/components/RenderModal/SchemaEditor/create-zod-values.js +1 -2
  43. package/dist/components/RenderModal/WebRenderModalPicture.js +1 -2
  44. package/dist/components/RenderQueue/CaptionQueueItem.js +14 -5
  45. package/dist/components/RenderQueue/CaptionQueueProcessor.js +30 -7
  46. package/dist/components/RenderQueue/QueueJobError.d.ts +8 -0
  47. package/dist/components/RenderQueue/QueueJobError.js +24 -0
  48. package/dist/components/RenderQueue/QueueJobErrorModal.d.ts +8 -0
  49. package/dist/components/RenderQueue/QueueJobErrorModal.js +63 -0
  50. package/dist/components/RenderQueue/RenderQueueItemCancelButton.d.ts +3 -1
  51. package/dist/components/RenderQueue/RenderQueueItemCancelButton.js +11 -4
  52. package/dist/components/RenderQueue/RenderQueueRepeat.d.ts +3 -1
  53. package/dist/components/RenderQueue/RenderQueueRepeat.js +20 -3
  54. package/dist/components/RenderQueue/VideoMattingQueueItem.js +24 -27
  55. package/dist/components/RenderQueue/VideoMattingQueueProcessor.js +68 -28
  56. package/dist/components/RenderQueue/caption-job-types.d.ts +3 -1
  57. package/dist/components/RenderQueue/context.d.ts +4 -0
  58. package/dist/components/RenderQueue/context.js +58 -8
  59. package/dist/components/RenderQueue/index.js +2 -3
  60. package/dist/components/RenderQueue/load-model-for-job.d.ts +2 -1
  61. package/dist/components/RenderQueue/load-model-for-job.js +5 -1
  62. package/dist/components/RenderQueue/video-matting-job-types.d.ts +13 -6
  63. package/dist/components/SelectedOutlineCropControls.js +2 -1
  64. package/dist/components/SelectedOutlineEditingHandles.js +9 -2
  65. package/dist/components/SelectedOutlineElement.js +9 -3
  66. package/dist/components/SelectedOutlineKeyboardControls.d.ts +2 -4
  67. package/dist/components/SelectedOutlineKeyboardControls.js +4 -22
  68. package/dist/components/SelectedOutlineOverlay.js +152 -106
  69. package/dist/components/SelectedOutlinePathPoints.d.ts +8 -0
  70. package/dist/components/SelectedOutlinePathPoints.js +433 -0
  71. package/dist/components/SelectedOutlinePolygon.js +21 -46
  72. package/dist/components/SelectedOutlineRenderer.d.ts +3 -5
  73. package/dist/components/SelectedOutlineRenderer.js +32 -136
  74. package/dist/components/SelectedOutlineTransformOriginHandle.js +3 -2
  75. package/dist/components/SelectedOutlineUvControls.js +12 -7
  76. package/dist/components/SettingsModal.js +30 -3
  77. package/dist/components/SettingsModalFooter.d.ts +1 -0
  78. package/dist/components/SettingsModalFooter.js +7 -3
  79. package/dist/components/ShowOutlinesProvider.js +1 -1
  80. package/dist/components/SkillsSettings.d.ts +0 -1
  81. package/dist/components/SkillsSettings.js +13 -14
  82. package/dist/components/Splitter/SplitterElement.js +1 -2
  83. package/dist/components/TimeValue.js +1 -1
  84. package/dist/components/Timeline/LoopedTimelineIndicators.d.ts +1 -0
  85. package/dist/components/Timeline/LoopedTimelineIndicators.js +7 -6
  86. package/dist/components/Timeline/TimelineArrayField.js +1 -1
  87. package/dist/components/Timeline/TimelineClipboardKeybindings.js +0 -1
  88. package/dist/components/Timeline/TimelineColorField.js +1 -1
  89. package/dist/components/Timeline/TimelineDragHandler.js +1 -1
  90. package/dist/components/Timeline/TimelineEffectPropItem.d.ts +1 -0
  91. package/dist/components/Timeline/TimelineEffectPropItem.js +12 -5
  92. package/dist/components/Timeline/TimelineExpandedRow.d.ts +1 -0
  93. package/dist/components/Timeline/TimelineExpandedRow.js +5 -4
  94. package/dist/components/Timeline/TimelineExpandedSection.d.ts +1 -0
  95. package/dist/components/Timeline/TimelineExpandedSection.js +2 -2
  96. package/dist/components/Timeline/TimelineExpandedTrackKeyframes.d.ts +1 -0
  97. package/dist/components/Timeline/TimelineExpandedTrackKeyframes.js +3 -1
  98. package/dist/components/Timeline/TimelineFontFamilyField.js +12 -12
  99. package/dist/components/Timeline/TimelineKeyframeControls.d.ts +1 -0
  100. package/dist/components/Timeline/TimelineKeyframeControls.js +39 -28
  101. package/dist/components/Timeline/TimelineLayerChildren.js +1 -1
  102. package/dist/components/Timeline/TimelineList.js +1 -1
  103. package/dist/components/Timeline/TimelineNumberField.js +2 -4
  104. package/dist/components/Timeline/TimelinePrimitiveFieldValue.js +1 -1
  105. package/dist/components/Timeline/TimelineSelection.d.ts +9 -9
  106. package/dist/components/Timeline/TimelineSelection.js +16 -9
  107. package/dist/components/Timeline/TimelineSequence.d.ts +3 -1
  108. package/dist/components/Timeline/TimelineSequence.js +39 -21
  109. package/dist/components/Timeline/TimelineSequenceItem.d.ts +1 -0
  110. package/dist/components/Timeline/TimelineSequenceItem.js +18 -8
  111. package/dist/components/Timeline/TimelineSequencePropItem.d.ts +3 -0
  112. package/dist/components/Timeline/TimelineSequencePropItem.js +262 -25
  113. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +11 -13
  114. package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +98 -77
  115. package/dist/components/Timeline/TimelineTextContentField.js +27 -4
  116. package/dist/components/Timeline/TimelineTimeIndicators.js +10 -5
  117. package/dist/components/Timeline/TimelineTrack.js +1 -1
  118. package/dist/components/Timeline/TimelineTrimTooltip.d.ts +11 -0
  119. package/dist/components/Timeline/TimelineTrimTooltip.js +41 -0
  120. package/dist/components/Timeline/TimelineVideoInfo.d.ts +1 -0
  121. package/dist/components/Timeline/TimelineVideoInfo.js +13 -10
  122. package/dist/components/Timeline/delete-selected-keyframe.js +22 -8
  123. package/dist/components/Timeline/delete-selected-timeline-item.d.ts +1 -5
  124. package/dist/components/Timeline/delete-selected-timeline-item.js +7 -93
  125. package/dist/components/Timeline/get-animation-item-selection-for-frame.d.ts +2 -1
  126. package/dist/components/Timeline/get-animation-item-selection-for-frame.js +7 -5
  127. package/dist/components/Timeline/get-keyframed-sequence-drag-targets.d.ts +23 -0
  128. package/dist/components/Timeline/get-keyframed-sequence-drag-targets.js +57 -0
  129. package/dist/components/Timeline/get-node-keyframes.d.ts +2 -1
  130. package/dist/components/Timeline/get-node-keyframes.js +6 -4
  131. package/dist/components/Timeline/get-playback-rate-keyframe-changes.d.ts +21 -0
  132. package/dist/components/Timeline/get-playback-rate-keyframe-changes.js +142 -0
  133. package/dist/components/Timeline/get-timeline-keyframes.d.ts +15 -2
  134. package/dist/components/Timeline/get-timeline-keyframes.js +44 -6
  135. package/dist/components/Timeline/keyframe-clipboard.js +17 -3
  136. package/dist/components/Timeline/split-selected-timeline-item.js +4 -1
  137. package/dist/components/Timeline/timeline-field-display-utils.js +1 -0
  138. package/dist/components/Timeline/timeline-field-row-layout.js +1 -0
  139. package/dist/components/Timeline/use-delete-timeline-items.js +17 -11
  140. package/dist/components/Timeline/use-expanded-track-keyframe-rows.d.ts +2 -1
  141. package/dist/components/Timeline/use-expanded-track-keyframe-rows.js +3 -1
  142. package/dist/components/Timeline/use-sequence-freeze-frame-menu-item.js +7 -3
  143. package/dist/components/Timeline/use-timeline-keyframe-drag.js +28 -19
  144. package/dist/components/Transcription/Models.js +1 -1
  145. package/dist/components/Transcription/TranscriptionModal.js +3 -1
  146. package/dist/components/Transcription/resample-media-to-16-khz.d.ts +2 -1
  147. package/dist/components/Transcription/resample-media-to-16-khz.js +20 -2
  148. package/dist/components/UpdatesSettings.js +2 -0
  149. package/dist/components/VideoMatting/Models.js +1 -1
  150. package/dist/components/VideoMatting/VideoMattingModal.js +30 -47
  151. package/dist/components/VideoMatting/VideoMattingModalWithOptionalPackage.js +1 -1
  152. package/dist/components/WebMcp.js +22 -40
  153. package/dist/components/composition-drop-preview.js +1 -0
  154. package/dist/components/effect-drag-and-drop.d.ts +13 -5
  155. package/dist/components/effect-drag-and-drop.js +19 -4
  156. package/dist/components/get-open-in-menu-items.d.ts +2 -1
  157. package/dist/components/get-open-in-menu-items.js +17 -1
  158. package/dist/components/selected-outline-drag.d.ts +1 -6
  159. package/dist/components/selected-outline-drag.js +22 -6
  160. package/dist/components/selected-outline-geometry.d.ts +2 -18
  161. package/dist/components/selected-outline-measurement.d.ts +23 -41
  162. package/dist/components/selected-outline-measurement.js +14 -252
  163. package/dist/components/selected-outline-order.d.ts +4 -11
  164. package/dist/components/selected-outline-order.js +2 -254
  165. package/dist/components/selected-outline-snap.d.ts +1 -1
  166. package/dist/components/selected-outline-snap.js +2 -1
  167. package/dist/components/selected-outline-types.d.ts +18 -28
  168. package/dist/components/selected-outline-uv.d.ts +4 -4
  169. package/dist/components/selected-outline-uv.js +6 -111
  170. package/dist/components/sequence-props-api.js +0 -10
  171. package/dist/components/use-selected-outline-control-target.js +12 -21
  172. package/dist/components/wrap-jsx-node-api.d.ts +2 -0
  173. package/dist/components/wrap-jsx-node-api.js +13 -0
  174. package/dist/error-overlay/remotion-overlay/OpenInEditor.js +45 -2
  175. package/dist/error-overlay/remotion-overlay/StackFrame.js +32 -3
  176. package/dist/esm/{CaptionQueueProcessor-npa6szn1.mjs → CaptionQueueProcessor-nr7hjcga.mjs} +63 -17
  177. package/dist/esm/LazyModels-ajkn7fs3.mjs +12 -0
  178. package/dist/esm/LazyModels-g1g7cf4e.mjs +12 -0
  179. package/dist/esm/{TranscriptionModal-79m5wgcj.mjs → TranscriptionModal-e18bzbkb.mjs} +15 -15
  180. package/dist/esm/{VideoMattingModal-31pew0xj.mjs → VideoMattingModal-5bz2s4rs.mjs} +47 -65
  181. package/dist/esm/{VideoMattingQueueProcessor-t1hgm2rm.mjs → VideoMattingQueueProcessor-4tkj0f4k.mjs} +69 -26
  182. package/dist/esm/{index-v4tr1bft.mjs → index-09txs1bj.mjs} +5 -0
  183. package/dist/esm/{index-n5gmcvhz.mjs → index-5ycb9e9q.mjs} +2 -4
  184. package/dist/esm/{index-5t2dwxsk.mjs → index-890dd9b3.mjs} +259 -21
  185. package/dist/esm/{index-ac5550e7.mjs → index-8nt6a0mw.mjs} +3 -3
  186. package/dist/esm/{index-614tdz2q.mjs → index-9q9w8v9p.mjs} +3 -3
  187. package/dist/esm/{index-s7qa3xbw.mjs → index-c2wabcdt.mjs} +6 -6
  188. package/dist/esm/{index-r1gr3j3a.mjs → index-dfy1t576.mjs} +50 -1
  189. package/dist/esm/{index-21hxsfaa.mjs → index-dh3zk2hv.mjs} +6 -25
  190. package/dist/esm/{index-4zen9prq.mjs → index-dpyss74p.mjs} +6563 -5485
  191. package/dist/esm/{index-9x6e1dq0.mjs → index-hqxc6tzp.mjs} +40 -6
  192. package/dist/esm/{index-9xxg6218.mjs → index-qve7mdfp.mjs} +19 -1
  193. package/dist/esm/{index-e855w59j.mjs → index-s6qya2gg.mjs} +3 -5
  194. package/dist/esm/index-t7tbt980.mjs +103 -0
  195. package/dist/esm/{index-r0ejh5sy.mjs → index-t7xnxdf8.mjs} +44 -26
  196. package/dist/esm/index-wqc43mw0.mjs +158 -0
  197. package/dist/esm/{index-ppspzgn9.mjs → index-x6r9bn12.mjs} +4026 -4761
  198. package/dist/esm/{index-vxwg66ar.mjs → index-xac20sv4.mjs} +44 -57
  199. package/dist/esm/index.mjs +4 -5
  200. package/dist/esm/internals.mjs +13 -13
  201. package/dist/esm/previewEntry.mjs +18 -15
  202. package/dist/esm/renderEntry.mjs +5 -1
  203. package/dist/helpers/calculate-timeline.d.ts +5 -1
  204. package/dist/helpers/calculate-timeline.js +1 -1
  205. package/dist/helpers/checkerboard-background.d.ts +2 -2
  206. package/dist/helpers/colors.d.ts +132 -112
  207. package/dist/helpers/colors.js +117 -95
  208. package/dist/helpers/create-folder-tree.js +2 -1
  209. package/dist/helpers/editor-guide-selection.d.ts +1 -1
  210. package/dist/helpers/editor-ruler.js +23 -12
  211. package/dist/helpers/get-connected-compositions.d.ts +6 -1
  212. package/dist/helpers/get-connected-compositions.js +1 -1
  213. package/dist/helpers/get-sequence-double-click-action.js +1 -1
  214. package/dist/helpers/get-sequence-visible-range.d.ts +1 -1
  215. package/dist/helpers/get-sequence-visible-range.js +2 -5
  216. package/dist/helpers/get-timeline-nestedness.d.ts +1 -1
  217. package/dist/helpers/get-timeline-nestedness.js +1 -1
  218. package/dist/helpers/get-timeline-sequence-sort-key.d.ts +1 -1
  219. package/dist/helpers/get-timeline-sequence-sort-key.js +1 -1
  220. package/dist/helpers/hoverable.js +4 -4
  221. package/dist/helpers/inject-css.js +5 -7
  222. package/dist/helpers/prism-vsc-dark-plus.d.ts +1 -1
  223. package/dist/helpers/prism-vsc-dark-plus.js +52 -51
  224. package/dist/helpers/resolve-studio-color.d.ts +1 -0
  225. package/dist/helpers/resolve-studio-color.js +11 -0
  226. package/dist/helpers/studio-css-variables.d.ts +1 -0
  227. package/dist/helpers/studio-css-variables.js +105 -0
  228. package/dist/helpers/studio-pixel-ratio.d.ts +1 -0
  229. package/dist/helpers/studio-pixel-ratio.js +7 -0
  230. package/dist/helpers/timeline-node-path-key.d.ts +1 -1
  231. package/dist/helpers/timeline-node-path-key.js +2 -2
  232. package/dist/helpers/use-runtime-values.js +2 -28
  233. package/dist/hot-middleware-client/client.js +5 -3
  234. package/dist/icons/align-center-horizontal.js +2 -1
  235. package/dist/icons/align-left.js +2 -1
  236. package/dist/icons/align-right.js +2 -1
  237. package/dist/icons/{separation.d.ts → background-removal.d.ts} +1 -1
  238. package/dist/icons/background-removal.js +9 -0
  239. package/dist/icons/wrap.d.ts +4 -0
  240. package/dist/icons/wrap.js +10 -0
  241. package/dist/previewEntry.js +2 -0
  242. package/dist/renderEntry.js +2 -0
  243. package/dist/state/modals.d.ts +15 -1
  244. package/dist/state/timeline-sequence-hover.d.ts +6 -16
  245. package/dist/state/timeline-sequence-hover.js +6 -67
  246. package/package.json +20 -19
  247. package/dist/components/Timeline/get-easing-selection-after-keyframe-delete.d.ts +0 -15
  248. package/dist/components/Timeline/get-easing-selection-after-keyframe-delete.js +0 -31
  249. package/dist/esm/LazyModels-nh3c8h9p.mjs +0 -12
  250. package/dist/esm/LazyModels-rr5v8h5y.mjs +0 -12
  251. package/dist/esm/index-cw0pnpg5.mjs +0 -50
  252. package/dist/esm/index-k426ye99.mjs +0 -139
  253. package/dist/helpers/get-box-quads-polyfill-internals.d.ts +0 -82
  254. package/dist/helpers/get-box-quads-polyfill-internals.js +0 -2403
  255. package/dist/helpers/get-box-quads-ponyfill.d.ts +0 -10
  256. package/dist/helpers/get-box-quads-ponyfill.js +0 -23
  257. package/dist/icons/separation.js +0 -7
  258. /package/dist/esm/{resolve-composition-component-location-qrp05g62.mjs → resolve-composition-component-location-2hgf6g0a.mjs} +0 -0
@@ -1,6 +1,26 @@
1
1
  import type { OverrideIdToNodePaths, TSequence } from 'remotion';
2
2
  import type { OutlinePoint, SelectedOutline } from './selected-outline-geometry';
3
- import type { SelectedOutlineLayoutTarget, SequenceWithSelectedOutline } from './selected-outline-types';
3
+ export declare const getOutlineSelectionInteraction: ({ shiftKey, metaKey, ctrlKey, }: {
4
+ readonly shiftKey: boolean;
5
+ readonly metaKey: boolean;
6
+ readonly ctrlKey: boolean;
7
+ }) => import("@remotion/canvas").CanvasSelectionInteraction, getSelectedSequenceKeys: (selectedItems: readonly import("@remotion/canvas").CanvasSelectionItem[]) => Set<string>, getSequenceKeysContainingSelection: (selectedItems: readonly import("@remotion/canvas").CanvasSelectionItem[]) => Set<string>, cropOutlinePoints: (points: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint], crop: import("@remotion/canvas").CanvasOutlineCrop) => readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint], getTransformedSvgViewportPoints: ({ viewport, ctm, containerRect, }: {
8
+ readonly viewport: {
9
+ readonly x: number;
10
+ readonly y: number;
11
+ readonly width: number;
12
+ readonly height: number;
13
+ };
14
+ readonly ctm: {
15
+ readonly a: number;
16
+ readonly b: number;
17
+ readonly c: number;
18
+ readonly d: number;
19
+ readonly e: number;
20
+ readonly f: number;
21
+ };
22
+ readonly containerRect: Pick<DOMRect, "left" | "top">;
23
+ }) => readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint], measureOutlineTargets: (container: Element, targets: readonly import("@remotion/canvas").CanvasOutlineTarget[]) => SelectedOutline[];
4
24
  export declare const pointToString: (point: OutlinePoint) => string;
5
25
  export declare const midpoint: (from: OutlinePoint, to: OutlinePoint) => OutlinePoint;
6
26
  export declare const getOutlineCenter: (points: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint]) => OutlinePoint;
@@ -28,31 +48,6 @@ export declare const getSelectedOutlineRotationPivot: ({ dimensions, points, tra
28
48
  readonly points: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint];
29
49
  readonly transformOriginValue: string;
30
50
  }) => OutlinePoint;
31
- type SvgViewport = {
32
- readonly x: number;
33
- readonly y: number;
34
- readonly width: number;
35
- readonly height: number;
36
- };
37
- type SvgScreenCtm = Pick<DOMMatrixReadOnly, 'a' | 'b' | 'c' | 'd' | 'e' | 'f'>;
38
- export declare const getTransformedSvgViewportPoints: ({ viewport, ctm, containerRect, }: {
39
- readonly viewport: SvgViewport;
40
- readonly ctm: SvgScreenCtm;
41
- readonly containerRect: Pick<DOMRect, "left" | "top">;
42
- }) => readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint];
43
- export declare const cropOutlinePoints: (points: readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint], crop: {
44
- readonly left: number;
45
- readonly right: number;
46
- readonly top: number;
47
- readonly bottom: number;
48
- }) => readonly [OutlinePoint, OutlinePoint, OutlinePoint, OutlinePoint];
49
- export declare const getSelectedSequenceKeys: (selectedItems: readonly import("@remotion/canvas").CanvasSelectionItem[]) => Set<string>;
50
- export declare const getSequenceKeysContainingSelection: (selectedItems: readonly import("@remotion/canvas").CanvasSelectionItem[]) => Set<string>;
51
- export declare const getOutlineSelectionInteraction: ({ shiftKey, metaKey, ctrlKey, }: {
52
- readonly shiftKey: boolean;
53
- readonly metaKey: boolean;
54
- readonly ctrlKey: boolean;
55
- }) => import("@remotion/canvas").CanvasSelectionInteraction;
56
51
  type SelectedEffectFields = {
57
52
  allFields: boolean;
58
53
  fieldKeys: Set<string>;
@@ -77,19 +72,6 @@ export declare const getSequencesWithSelectableOutlines: ({ sequences, overrideI
77
72
  readonly sequences: readonly TSequence[];
78
73
  readonly overrideIdsToNodePaths: OverrideIdToNodePaths;
79
74
  readonly compositions?: readonly import("remotion").AnyComposition[] | undefined;
80
- readonly timelinePosition: number;
81
- }) => SequenceWithSelectedOutline[];
82
- export declare const measureOutlines: (container: SVGSVGElement, targets: readonly SelectedOutlineLayoutTarget[], hoveredTimelineNodePathKey: string | null) => SelectedOutline[];
83
- export declare const measureOutlineTargets: (container: Element, targets: readonly {
84
- readonly crop: {
85
- readonly left: number;
86
- readonly right: number;
87
- readonly top: number;
88
- readonly bottom: number;
89
- };
90
- readonly includeOutsideContainer: boolean;
91
- readonly key: string;
92
- readonly ref: import("react").RefObject<Element | null>;
93
- }[]) => SelectedOutline[];
94
- export declare const outlinesAreEqual: (a: readonly SelectedOutline[], b: readonly SelectedOutline[]) => boolean;
75
+ readonly timelinePosition: number | null;
76
+ }) => import("@remotion/canvas").CanvasSelectableOutline[];
95
77
  export {};
@@ -1,17 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.outlinesAreEqual = exports.measureOutlineTargets = exports.measureOutlines = exports.getSequencesWithSelectableOutlines = exports.getSelectedRotationInfo = exports.getSelectedTransformOriginInfo = exports.getSelectedCropInfo = exports.getSelectedEffectFieldsBySequenceKey = exports.getOutlineSelectionInteraction = exports.getSequenceKeysContainingSelection = exports.getSelectedSequenceKeys = exports.cropOutlinePoints = exports.getTransformedSvgViewportPoints = exports.getSelectedOutlineRotationPivot = exports.getSelectedOutlineRotationCornerInfo = exports.getRotationCursor = exports.getSelectedOutlineRotationDeltaDegrees = exports.getAngleDegrees = exports.vectorBetween = exports.vectorLength = exports.dot = exports.getOutlineCenter = exports.midpoint = exports.pointToString = void 0;
3
+ exports.getSequencesWithSelectableOutlines = exports.getSelectedRotationInfo = exports.getSelectedTransformOriginInfo = exports.getSelectedCropInfo = exports.getSelectedEffectFieldsBySequenceKey = exports.getSelectedOutlineRotationPivot = exports.getSelectedOutlineRotationCornerInfo = exports.getRotationCursor = exports.getSelectedOutlineRotationDeltaDegrees = exports.getAngleDegrees = exports.vectorBetween = exports.vectorLength = exports.dot = exports.getOutlineCenter = exports.midpoint = exports.pointToString = exports.measureOutlineTargets = exports.getTransformedSvgViewportPoints = exports.cropOutlinePoints = exports.getSequenceKeysContainingSelection = exports.getSelectedSequenceKeys = exports.getOutlineSelectionInteraction = void 0;
4
+ const canvas_1 = require("@remotion/canvas");
4
5
  const calculate_timeline_1 = require("../helpers/calculate-timeline");
5
6
  const colors_1 = require("../helpers/colors");
6
- const get_box_quads_polyfill_internals_js_1 = require("../helpers/get-box-quads-polyfill-internals.js");
7
- const get_box_quads_ponyfill_1 = require("../helpers/get-box-quads-ponyfill");
8
- const timeline_node_path_key_1 = require("../helpers/timeline-node-path-key");
7
+ const studio_css_variables_1 = require("../helpers/studio-css-variables");
9
8
  const selected_outline_geometry_1 = require("./selected-outline-geometry");
10
9
  const selected_outline_types_1 = require("./selected-outline-types");
11
10
  const selected_outline_uv_1 = require("./selected-outline-uv");
12
11
  const parse_keyframe_field_from_node_path_1 = require("./Timeline/parse-keyframe-field-from-node-path");
13
12
  const TimelineSelection_1 = require("./Timeline/TimelineSelection");
14
13
  const transform_origin_utils_1 = require("./Timeline/transform-origin-utils");
14
+ const { getCanvasSelectableOutlines } = canvas_1.CanvasInternals;
15
+ ({ getCanvasOutlineSelectionInteraction: exports.getOutlineSelectionInteraction, getCanvasSelectedSequenceKeys: exports.getSelectedSequenceKeys, getCanvasSequenceKeysContainingSelection: exports.getSequenceKeysContainingSelection, cropCanvasOutlinePoints: exports.cropOutlinePoints, getTransformedSvgViewportPoints: exports.getTransformedSvgViewportPoints, measureCanvasOutlineTargets: exports.measureOutlineTargets } = canvas_1.CanvasInternals);
15
16
  const pointToString = (point) => `${point.x},${point.y}`;
16
17
  exports.pointToString = pointToString;
17
18
  const midpoint = (from, to) => {
@@ -56,7 +57,7 @@ const getRotationCursor = (rotation) => {
56
57
  ? ''
57
58
  : `<g transform="rotate(${normalizedRotation} 32 32)">`;
58
59
  const transformEnd = normalizedRotation === 0 ? '' : '</g>';
59
- const svg = `<svg width="24" height="24" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">${transform}<g transform="scale(0.876712329)" filter="url(#filter0_d_1_14)"><path d="M10.9111 17.7687C10.3413 18.3701 10.367 19.3195 10.9684 19.8893L20.7687 29.1738C21.3701 29.7436 22.3195 29.7179 22.8893 29.1165C23.459 28.5151 23.4334 27.5657 22.832 26.996L14.1206 18.7431L22.3735 10.0316C22.9432 9.43022 22.9176 8.48082 22.3162 7.91107C21.7148 7.34133 20.7654 7.36699 20.1956 7.96839L10.9111 17.7687ZM49.3923 58.3118C49.9509 58.9235 50.8996 58.9667 51.5114 58.4081L61.481 49.3055C62.0927 48.7469 62.1359 47.7981 61.5773 47.1863C61.0187 46.5745 60.0699 46.5314 59.4581 47.09L50.5963 55.1812L42.5051 46.3194C41.9465 45.7076 40.9977 45.6645 40.386 46.2231C39.7742 46.7817 39.7311 47.7304 40.2896 48.3422L49.3923 58.3118ZM12.6747 18.7431L13 19.8893C22.1283 19.6426 30.7584 21.4283 37.8564 26.6927C44.8518 31.8809 49.734 39.8538 49 56H50.5963H51.5114C52.2774 39.1461 47.6482 30.2198 39.6436 24.2831C31.7416 18.4224 22.3717 17.2467 13 17.5L12.6747 18.7431Z" fill="${colors_1.BLACK}"/><path d="M19.1064 6.93652C20.2459 5.73379 22.1448 5.68278 23.3477 6.82227C24.5505 7.96181 24.6022 9.86076 23.4629 11.0635L18.7373 16.0508C26.3487 16.4239 33.9128 18.1651 40.5371 23.0781C44.7339 26.1907 48.0794 30.1189 50.2568 35.4834C51.9666 39.6958 52.9327 44.7395 53.0742 50.8867L58.4463 45.9824C59.6697 44.8654 61.5673 44.9514 62.6846 46.1748C63.8018 47.3985 63.7155 49.296 62.4922 50.4131L52.5225 59.5156C51.337 60.5979 49.5196 60.5507 48.3916 59.4346L48.2842 59.3232L39.1816 49.3535C38.0648 48.1301 38.1507 46.2324 39.374 45.1152C40.5975 43.9979 42.4961 44.0841 43.6133 45.3076L47.4756 49.5381C47.1908 44.7613 46.2876 40.9448 44.9482 37.8291C43.0666 33.4521 40.2851 30.3614 36.9629 27.8975C31.8259 24.0875 25.8071 22.1663 19.2891 21.5732L23.8633 25.9072C25.0662 27.0468 25.1178 28.9457 23.9785 30.1484C22.8746 31.3135 21.0576 31.3982 19.8516 30.3662L19.7373 30.2627L9.93652 20.9785C8.73384 19.839 8.6828 17.9401 9.82227 16.7373L19.1064 6.93652Z" stroke="${colors_1.WHITE}" stroke-width="3"/></g>${transformEnd}<defs><filter id="filter0_d_1_14" x="0" y="0" width="72.4696" height="72.3004" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="3"/><feGaussianBlur stdDeviation="3.75"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1_14"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1_14" result="shape"/></filter></defs></svg>`;
60
+ const svg = `<svg width="24" height="24" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg"><style>${studio_css_variables_1.studioCssVariables}</style>${transform}<g transform="scale(0.876712329)" filter="url(#filter0_d_1_14)"><path d="M10.9111 17.7687C10.3413 18.3701 10.367 19.3195 10.9684 19.8893L20.7687 29.1738C21.3701 29.7436 22.3195 29.7179 22.8893 29.1165C23.459 28.5151 23.4334 27.5657 22.832 26.996L14.1206 18.7431L22.3735 10.0316C22.9432 9.43022 22.9176 8.48082 22.3162 7.91107C21.7148 7.34133 20.7654 7.36699 20.1956 7.96839L10.9111 17.7687ZM49.3923 58.3118C49.9509 58.9235 50.8996 58.9667 51.5114 58.4081L61.481 49.3055C62.0927 48.7469 62.1359 47.7981 61.5773 47.1863C61.0187 46.5745 60.0699 46.5314 59.4581 47.09L50.5963 55.1812L42.5051 46.3194C41.9465 45.7076 40.9977 45.6645 40.386 46.2231C39.7742 46.7817 39.7311 47.7304 40.2896 48.3422L49.3923 58.3118ZM12.6747 18.7431L13 19.8893C22.1283 19.6426 30.7584 21.4283 37.8564 26.6927C44.8518 31.8809 49.734 39.8538 49 56H50.5963H51.5114C52.2774 39.1461 47.6482 30.2198 39.6436 24.2831C31.7416 18.4224 22.3717 17.2467 13 17.5L12.6747 18.7431Z" fill="${colors_1.BLACK}"/><path d="M19.1064 6.93652C20.2459 5.73379 22.1448 5.68278 23.3477 6.82227C24.5505 7.96181 24.6022 9.86076 23.4629 11.0635L18.7373 16.0508C26.3487 16.4239 33.9128 18.1651 40.5371 23.0781C44.7339 26.1907 48.0794 30.1189 50.2568 35.4834C51.9666 39.6958 52.9327 44.7395 53.0742 50.8867L58.4463 45.9824C59.6697 44.8654 61.5673 44.9514 62.6846 46.1748C63.8018 47.3985 63.7155 49.296 62.4922 50.4131L52.5225 59.5156C51.337 60.5979 49.5196 60.5507 48.3916 59.4346L48.2842 59.3232L39.1816 49.3535C38.0648 48.1301 38.1507 46.2324 39.374 45.1152C40.5975 43.9979 42.4961 44.0841 43.6133 45.3076L47.4756 49.5381C47.1908 44.7613 46.2876 40.9448 44.9482 37.8291C43.0666 33.4521 40.2851 30.3614 36.9629 27.8975C31.8259 24.0875 25.8071 22.1663 19.2891 21.5732L23.8633 25.9072C25.0662 27.0468 25.1178 28.9457 23.9785 30.1484C22.8746 31.3135 21.0576 31.3982 19.8516 30.3662L19.7373 30.2627L9.93652 20.9785C8.73384 19.839 8.6828 17.9401 9.82227 16.7373L19.1064 6.93652Z" stroke="${colors_1.WHITE}" stroke-width="3"/></g>${transformEnd}<defs><filter id="filter0_d_1_14" x="0" y="0" width="72.4696" height="72.3004" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="3"/><feGaussianBlur stdDeviation="3.75"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1_14"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1_14" result="shape"/></filter></defs></svg>`;
60
61
  return `url("data:image/svg+xml,${encodeURIComponent(svg)}") 12 12, alias`;
61
62
  };
62
63
  exports.getRotationCursor = getRotationCursor;
@@ -108,145 +109,6 @@ const getSelectedOutlineRotationPivot = ({ dimensions, points, transformOriginVa
108
109
  return (0, selected_outline_uv_1.getUvHandlePosition)(points, uv);
109
110
  };
110
111
  exports.getSelectedOutlineRotationPivot = getSelectedOutlineRotationPivot;
111
- const rectToPoints = (elementRect, containerRect) => {
112
- const left = elementRect.left - containerRect.left;
113
- const top = elementRect.top - containerRect.top;
114
- const right = elementRect.right - containerRect.left;
115
- const bottom = elementRect.bottom - containerRect.top;
116
- return [
117
- { x: left, y: top },
118
- { x: right, y: top },
119
- { x: right, y: bottom },
120
- { x: left, y: bottom },
121
- ];
122
- };
123
- const getTransformedSvgViewportPoints = ({ viewport, ctm, containerRect, }) => {
124
- const transformPoint = (x, y) => ({
125
- x: ctm.a * x + ctm.c * y + ctm.e - containerRect.left,
126
- y: ctm.b * x + ctm.d * y + ctm.f - containerRect.top,
127
- });
128
- const left = viewport.x;
129
- const top = viewport.y;
130
- const right = viewport.x + viewport.width;
131
- const bottom = viewport.y + viewport.height;
132
- return [
133
- transformPoint(left, top),
134
- transformPoint(right, top),
135
- transformPoint(right, bottom),
136
- transformPoint(left, bottom),
137
- ];
138
- };
139
- exports.getTransformedSvgViewportPoints = getTransformedSvgViewportPoints;
140
- const quadToPoints = (quad, containerRect) => {
141
- // `getBoxQuads`/the ponyfill returns the quad in viewport coordinates.
142
- // The overlay <svg> is unscaled (the canvas `scale()`/pan live on a sibling
143
- // container, not the svg), so 1 user unit == 1 px and we only need to move
144
- // the quad into the svg's local space by subtracting its viewport origin.
145
- // We deliberately do not pass `relativeTo` to the ponyfill: when the target
146
- // is not an ancestor of the element, the polyfill cannot resolve the
147
- // coordinate space and leaves the quad in viewport coordinates.
148
- return [
149
- { x: quad.p1.x - containerRect.left, y: quad.p1.y - containerRect.top },
150
- { x: quad.p2.x - containerRect.left, y: quad.p2.y - containerRect.top },
151
- { x: quad.p3.x - containerRect.left, y: quad.p3.y - containerRect.top },
152
- { x: quad.p4.x - containerRect.left, y: quad.p4.y - containerRect.top },
153
- ];
154
- };
155
- const isSvgSvgElement = (element) => {
156
- var _a;
157
- const ownerSvgSvgElement = (_a = element.ownerDocument.defaultView) === null || _a === void 0 ? void 0 : _a.SVGSVGElement;
158
- return ((typeof SVGSVGElement !== 'undefined' &&
159
- element instanceof SVGSVGElement) ||
160
- (ownerSvgSvgElement !== undefined && element instanceof ownerSvgSvgElement));
161
- };
162
- const getSvgSvgElementViewport = (element) => {
163
- const viewBox = element.viewBox.baseVal;
164
- if (viewBox.width > 0 && viewBox.height > 0) {
165
- return {
166
- x: viewBox.x,
167
- y: viewBox.y,
168
- width: viewBox.width,
169
- height: viewBox.height,
170
- };
171
- }
172
- return {
173
- x: 0,
174
- y: 0,
175
- width: element.width.baseVal.value,
176
- height: element.height.baseVal.value,
177
- };
178
- };
179
- const getSvgSvgElementOutlinePoints = (element, containerRect) => {
180
- const ctm = element.getScreenCTM();
181
- const viewport = getSvgSvgElementViewport(element);
182
- if (ctm === null || (viewport.width === 0 && viewport.height === 0)) {
183
- return null;
184
- }
185
- return (0, exports.getTransformedSvgViewportPoints)({
186
- viewport,
187
- ctm,
188
- containerRect,
189
- });
190
- };
191
- const getElementOutlinePoints = (element, containerRect, includeOutsideContainer) => {
192
- const elementRect = element.getBoundingClientRect();
193
- if (elementRect.width === 0 && elementRect.height === 0) {
194
- return null;
195
- }
196
- if (!includeOutsideContainer &&
197
- (elementRect.right <= containerRect.left ||
198
- elementRect.left >= containerRect.right ||
199
- elementRect.bottom <= containerRect.top ||
200
- elementRect.top >= containerRect.bottom)) {
201
- return null;
202
- }
203
- if (isSvgSvgElement(element)) {
204
- return getSvgSvgElementOutlinePoints(element, containerRect);
205
- }
206
- const quads = (0, get_box_quads_ponyfill_1.getBoxQuadsPonyfill)(element, {
207
- box: 'border',
208
- });
209
- const quad = quads === null || quads === void 0 ? void 0 : quads[0];
210
- if (!quad) {
211
- return rectToPoints(elementRect, containerRect);
212
- }
213
- return quadToPoints(quad, containerRect);
214
- };
215
- const cropOutlinePoints = (points, crop) => {
216
- if (crop.left === 0 &&
217
- crop.right === 0 &&
218
- crop.top === 0 &&
219
- crop.bottom === 0) {
220
- return points;
221
- }
222
- const { left, top } = crop;
223
- const right = 1 - crop.right;
224
- const bottom = 1 - crop.bottom;
225
- return [
226
- (0, selected_outline_uv_1.getUvHandlePosition)(points, [left, top]),
227
- (0, selected_outline_uv_1.getUvHandlePosition)(points, [right, top]),
228
- (0, selected_outline_uv_1.getUvHandlePosition)(points, [right, bottom]),
229
- (0, selected_outline_uv_1.getUvHandlePosition)(points, [left, bottom]),
230
- ];
231
- };
232
- exports.cropOutlinePoints = cropOutlinePoints;
233
- const getSelectedSequenceKeys = (selectedItems) => {
234
- return new Set(selectedItems
235
- .filter((item) => item.type === 'sequence')
236
- .map((item) => (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(item.nodePathInfo)));
237
- };
238
- exports.getSelectedSequenceKeys = getSelectedSequenceKeys;
239
- const getSequenceKeysContainingSelection = (selectedItems) => {
240
- return new Set(selectedItems
241
- .filter((item) => item.type !== 'guide')
242
- .map((item) => (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(item.nodePathInfo)));
243
- };
244
- exports.getSequenceKeysContainingSelection = getSequenceKeysContainingSelection;
245
- const getOutlineSelectionInteraction = ({ shiftKey, metaKey, ctrlKey, }) => ({
246
- shiftKey,
247
- toggleKey: metaKey || ctrlKey,
248
- });
249
- exports.getOutlineSelectionInteraction = getOutlineSelectionInteraction;
250
112
  const getKeyframeOrEasingField = (item) => {
251
113
  if (item.type !== 'keyframe' && item.type !== 'easing') {
252
114
  return null;
@@ -389,114 +251,14 @@ const getSelectedRotationInfo = (selectedItems) => {
389
251
  };
390
252
  exports.getSelectedRotationInfo = getSelectedRotationInfo;
391
253
  const getSequencesWithSelectableOutlines = ({ sequences, overrideIdsToNodePaths, compositions = [], timelinePosition, }) => {
392
- return (0, calculate_timeline_1.calculateTimeline)({
393
- sequences: [...sequences],
394
- overrideIdsToNodePaths,
395
- compositions,
396
- })
397
- .filter((track) => {
398
- if (track.nodePathInfo === null) {
399
- return false;
400
- }
401
- return (track.sequence.showInTimeline &&
402
- timelinePosition >= track.sequence.from &&
403
- timelinePosition < track.sequence.from + track.sequence.duration &&
404
- track.nodePathInfo.auxiliaryKeys.length === 0);
405
- })
406
- .filter((track) => track.sequence.refForOutline !== null)
407
- .sort((a, b) => a.depth - b.depth)
408
- .map((track) => {
409
- if (track.nodePathInfo === null) {
410
- throw new Error('Expected selected outline to have a node path');
411
- }
412
- return {
413
- depth: track.depth,
414
- keyframeDisplayOffset: track.keyframeDisplayOffset,
415
- key: (0, TimelineSelection_1.getTimelineSequenceSelectionKey)(track.nodePathInfo),
416
- nodePathInfo: track.nodePathInfo,
417
- sequence: track.sequence,
418
- };
254
+ return getCanvasSelectableOutlines({
255
+ tracks: (0, calculate_timeline_1.calculateTimeline)({
256
+ sequences: [...sequences],
257
+ overrideIdsToNodePaths,
258
+ compositions,
259
+ }),
260
+ timelinePosition,
261
+ resolveSequenceNodePathInfo: null,
419
262
  });
420
263
  };
421
264
  exports.getSequencesWithSelectableOutlines = getSequencesWithSelectableOutlines;
422
- const measureOutlines = (container, targets, hoveredTimelineNodePathKey) => {
423
- return (0, exports.measureOutlineTargets)(container, targets.map((target) => ({
424
- crop: target.crop,
425
- includeOutsideContainer: target.showSelectedOutline ||
426
- (0, timeline_node_path_key_1.timelineSequenceNodePathToKey)(target.nodePathInfo.sequenceSubscriptionKey) === hoveredTimelineNodePathKey,
427
- key: target.key,
428
- ref: target.ref,
429
- })));
430
- };
431
- exports.measureOutlines = measureOutlines;
432
- const measureOutlineTargets = (container, targets) => {
433
- // Reuse shared ancestor geometry within this synchronous batch only.
434
- (0, get_box_quads_polyfill_internals_js_1.useCache)();
435
- const containerRect = container.getBoundingClientRect();
436
- const outlines = [];
437
- for (const target of targets) {
438
- const element = target.ref.current;
439
- if (element === null) {
440
- continue;
441
- }
442
- const uncroppedPoints = getElementOutlinePoints(element, containerRect, target.includeOutsideContainer);
443
- if (uncroppedPoints === null) {
444
- continue;
445
- }
446
- const points = (0, exports.cropOutlinePoints)(uncroppedPoints, target.crop);
447
- outlines.push({
448
- key: target.key,
449
- dimensions: element instanceof HTMLElement
450
- ? {
451
- width: element.offsetWidth,
452
- height: element.offsetHeight,
453
- }
454
- : element instanceof SVGSVGElement
455
- ? {
456
- width: element.width.baseVal.value,
457
- height: element.height.baseVal.value,
458
- }
459
- : null,
460
- uncroppedPoints,
461
- points,
462
- });
463
- }
464
- return outlines;
465
- };
466
- exports.measureOutlineTargets = measureOutlineTargets;
467
- const outlinesAreEqual = (a, b) => {
468
- var _a, _b, _c, _d;
469
- if (a.length !== b.length) {
470
- return false;
471
- }
472
- for (let i = 0; i < a.length; i++) {
473
- if (a[i].key !== b[i].key) {
474
- return false;
475
- }
476
- if (((_a = a[i].dimensions) === null || _a === void 0 ? void 0 : _a.width) !== ((_b = b[i].dimensions) === null || _b === void 0 ? void 0 : _b.width) ||
477
- ((_c = a[i].dimensions) === null || _c === void 0 ? void 0 : _c.height) !== ((_d = b[i].dimensions) === null || _d === void 0 ? void 0 : _d.height)) {
478
- return false;
479
- }
480
- const aUncropped = a[i].uncroppedPoints;
481
- const bUncropped = b[i].uncroppedPoints;
482
- if ((aUncropped === null) !== (bUncropped === null)) {
483
- return false;
484
- }
485
- if (aUncropped !== null && bUncropped !== null) {
486
- for (let j = 0; j < aUncropped.length; j++) {
487
- if (Math.abs(aUncropped[j].x - bUncropped[j].x) > 0.01 ||
488
- Math.abs(aUncropped[j].y - bUncropped[j].y) > 0.01) {
489
- return false;
490
- }
491
- }
492
- }
493
- for (let j = 0; j < a[i].points.length; j++) {
494
- if (Math.abs(a[i].points[j].x - b[i].points[j].x) > 0.01 ||
495
- Math.abs(a[i].points[j].y - b[i].points[j].y) > 0.01) {
496
- return false;
497
- }
498
- }
499
- }
500
- return true;
501
- };
502
- exports.outlinesAreEqual = outlinesAreEqual;
@@ -1,12 +1,5 @@
1
- import type { SelectedOutline } from './selected-outline-geometry';
2
- import type { SelectedOutlineLayoutTarget } from './selected-outline-types';
3
- type OutlineSequenceParent = {
4
- readonly id: string;
5
- readonly parent: string | null;
6
- };
7
1
  export declare const orderOutlinesForRendering: ({ outlines, sequences, targetsByKey, }: {
8
- readonly outlines: readonly SelectedOutline[];
9
- readonly sequences: readonly OutlineSequenceParent[];
10
- readonly targetsByKey: ReadonlyMap<string, SelectedOutlineLayoutTarget>;
11
- }) => readonly SelectedOutline[];
12
- export {};
2
+ readonly outlines: readonly import("@remotion/canvas").CanvasOutline[];
3
+ readonly sequences: readonly import("@remotion/canvas").CanvasOutlineSequenceParent[];
4
+ readonly targetsByKey: ReadonlyMap<string, import("@remotion/canvas").CanvasOutlineOrderTarget>;
5
+ }) => readonly import("@remotion/canvas").CanvasOutline[];
@@ -1,257 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.orderOutlinesForRendering = void 0;
4
- const outlinePointEqualityTolerance = 0.5;
5
- const outlineAreaEqualityTolerance = 0.5;
6
- const outlineBoundsOverlapTolerance = 0.5;
7
- const outlinePointsAreEquivalent = (a, b) => {
8
- return (Math.abs(a.x - b.x) <= outlinePointEqualityTolerance &&
9
- Math.abs(a.y - b.y) <= outlinePointEqualityTolerance);
10
- };
11
- const outlinesHaveEquivalentHitArea = (a, b) => {
12
- if (a.points.length !== b.points.length) {
13
- return false;
14
- }
15
- for (let startIndex = 0; startIndex < b.points.length; startIndex++) {
16
- for (const direction of [1, -1]) {
17
- const pointsMatch = a.points.every((point, index) => {
18
- const bIndex = (startIndex + direction * index + b.points.length) % b.points.length;
19
- return outlinePointsAreEquivalent(point, b.points[bIndex]);
20
- });
21
- if (pointsMatch) {
22
- return true;
23
- }
24
- }
25
- }
26
- return false;
27
- };
28
- const getOutlineHitArea = (outline) => {
29
- let area = 0;
30
- for (let i = 0; i < outline.points.length; i++) {
31
- const current = outline.points[i];
32
- const next = outline.points[(i + 1) % outline.points.length];
33
- area += current.x * next.y - next.x * current.y;
34
- }
35
- return Math.abs(area) / 2;
36
- };
37
- const getOutlineBounds = (outline) => {
38
- const xs = outline.points.map((point) => point.x);
39
- const ys = outline.points.map((point) => point.y);
40
- return {
41
- maxX: Math.max(...xs),
42
- maxY: Math.max(...ys),
43
- minX: Math.min(...xs),
44
- minY: Math.min(...ys),
45
- };
46
- };
47
- const outlineBoundsOverlap = (aBounds, bBounds) => {
48
- return (aBounds.minX <= bBounds.maxX + outlineBoundsOverlapTolerance &&
49
- aBounds.maxX + outlineBoundsOverlapTolerance >= bBounds.minX &&
50
- aBounds.minY <= bBounds.maxY + outlineBoundsOverlapTolerance &&
51
- aBounds.maxY + outlineBoundsOverlapTolerance >= bBounds.minY);
52
- };
53
- const getSequenceId = (target) => {
54
- var _a;
55
- var _b;
56
- return (_b = (_a = target === null || target === void 0 ? void 0 : target.sequence) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null;
57
- };
58
- const getParentBySequenceId = ({ sequences, targetsByKey, }) => {
59
- const parentBySequenceId = new Map();
60
- for (const sequence of sequences) {
61
- parentBySequenceId.set(sequence.id, sequence.parent);
62
- }
63
- for (const target of targetsByKey.values()) {
64
- const sequenceId = getSequenceId(target);
65
- if (sequenceId !== null && !parentBySequenceId.has(sequenceId)) {
66
- parentBySequenceId.set(sequenceId, target.sequence.parent);
67
- }
68
- }
69
- return parentBySequenceId;
70
- };
71
- const isAncestorTarget = ({ ancestor, descendant, parentBySequenceId, }) => {
72
- var _a;
73
- var _b, _c;
74
- const ancestorId = getSequenceId(ancestor);
75
- if (ancestorId === null) {
76
- return false;
77
- }
78
- let parentId = (_b = (_a = descendant.sequence) === null || _a === void 0 ? void 0 : _a.parent) !== null && _b !== void 0 ? _b : null;
79
- while (parentId !== null) {
80
- if (parentId === ancestorId) {
81
- return true;
82
- }
83
- parentId = (_c = parentBySequenceId.get(parentId)) !== null && _c !== void 0 ? _c : null;
84
- }
85
- return false;
86
- };
87
- const orderOutlineGroup = ({ outlines, parentBySequenceId, targetsByKey, }) => {
88
- var _a;
89
- var _b, _c, _d, _e;
90
- const incomingEdges = new Map();
91
- const outgoingEdges = new Map();
92
- const outlinesByKey = new Map(outlines.map((outline) => [outline.key, outline]));
93
- for (const outline of outlines) {
94
- incomingEdges.set(outline.key, new Set());
95
- outgoingEdges.set(outline.key, new Set());
96
- }
97
- const hasPath = ({ fromKey, seen, toKey, }) => {
98
- var _a;
99
- if (fromKey === toKey) {
100
- return true;
101
- }
102
- if (seen.has(fromKey)) {
103
- return false;
104
- }
105
- seen.add(fromKey);
106
- for (const nextKey of (_a = outgoingEdges.get(fromKey)) !== null && _a !== void 0 ? _a : []) {
107
- if (hasPath({ fromKey: nextKey, seen, toKey })) {
108
- return true;
109
- }
110
- }
111
- return false;
112
- };
113
- const addEdge = (before, after, options) => {
114
- if (before.key === after.key) {
115
- return;
116
- }
117
- const incoming = incomingEdges.get(after.key);
118
- const outgoing = outgoingEdges.get(before.key);
119
- if (incoming === undefined || outgoing === undefined) {
120
- throw new Error('Expected outline to be registered before adding edge');
121
- }
122
- if (outgoing.has(after.key)) {
123
- return;
124
- }
125
- if (hasPath({ fromKey: after.key, seen: new Set(), toKey: before.key })) {
126
- if (options === null || options === void 0 ? void 0 : options.skipIfCycle) {
127
- return;
128
- }
129
- throw new Error('Could not determine a stable outline rendering order');
130
- }
131
- incoming.add(before.key);
132
- outgoing.add(after.key);
133
- };
134
- const addAncestorConstraint = ({ ancestor, descendant, descendantContainsSelection, equivalentHitArea, }) => {
135
- // Usually, children should be above parents so nested elements are directly
136
- // selectable. If an unselected child has the same hit area as its parent, put
137
- // it below the parent so the wrapper can be selected. Once the child or
138
- // one of its properties is selected, keep it above the parent so it remains
139
- // directly draggable.
140
- if (equivalentHitArea && !descendantContainsSelection) {
141
- addEdge(descendant, ancestor);
142
- }
143
- else {
144
- addEdge(ancestor, descendant);
145
- }
146
- };
147
- const outlineBySequenceId = new Map();
148
- for (const outline of outlines) {
149
- const sequenceId = getSequenceId(targetsByKey.get(outline.key));
150
- if (sequenceId !== null) {
151
- outlineBySequenceId.set(sequenceId, outline);
152
- }
153
- }
154
- // Only constrain each outline against its nearest rendered ancestor. The
155
- // resulting graph follows the sequence tree, so pairwise subpixel equivalence
156
- // cannot introduce contradictory edges across three nested outlines.
157
- for (const descendant of outlines) {
158
- const descendantTarget = targetsByKey.get(descendant.key);
159
- let parentId = (_b = (_a = descendantTarget === null || descendantTarget === void 0 ? void 0 : descendantTarget.sequence) === null || _a === void 0 ? void 0 : _a.parent) !== null && _b !== void 0 ? _b : null;
160
- while (parentId !== null) {
161
- const ancestor = outlineBySequenceId.get(parentId);
162
- if (ancestor !== undefined) {
163
- addAncestorConstraint({
164
- ancestor,
165
- descendant,
166
- descendantContainsSelection: ((_c = descendantTarget === null || descendantTarget === void 0 ? void 0 : descendantTarget.selected) !== null && _c !== void 0 ? _c : false) ||
167
- ((_d = descendantTarget === null || descendantTarget === void 0 ? void 0 : descendantTarget.containsSelection) !== null && _d !== void 0 ? _d : false),
168
- equivalentHitArea: outlinesHaveEquivalentHitArea(ancestor, descendant),
169
- });
170
- break;
171
- }
172
- parentId = (_e = parentBySequenceId.get(parentId)) !== null && _e !== void 0 ? _e : null;
173
- }
174
- }
175
- // For unrelated overlapping outlines, put broader hit targets below
176
- // smaller ones so a large selected sequence cannot swallow clicks on
177
- // a more specific element in the same canvas area.
178
- const bounds = outlines.map(getOutlineBounds);
179
- const areas = outlines.map(getOutlineHitArea);
180
- for (let i = 0; i < outlines.length; i++) {
181
- const a = outlines[i];
182
- const aTarget = targetsByKey.get(a.key);
183
- if (aTarget === undefined) {
184
- continue;
185
- }
186
- for (let j = i + 1; j < outlines.length; j++) {
187
- if (!outlineBoundsOverlap(bounds[i], bounds[j])) {
188
- continue;
189
- }
190
- const aArea = areas[i];
191
- const bArea = areas[j];
192
- if (Math.abs(aArea - bArea) <= outlineAreaEqualityTolerance) {
193
- continue;
194
- }
195
- const b = outlines[j];
196
- const bTarget = targetsByKey.get(b.key);
197
- if (bTarget === undefined) {
198
- continue;
199
- }
200
- const aAncestorOfB = isAncestorTarget({
201
- ancestor: aTarget,
202
- descendant: bTarget,
203
- parentBySequenceId,
204
- });
205
- const bAncestorOfA = isAncestorTarget({
206
- ancestor: bTarget,
207
- descendant: aTarget,
208
- parentBySequenceId,
209
- });
210
- if (aAncestorOfB || bAncestorOfA) {
211
- continue;
212
- }
213
- if (aArea > bArea) {
214
- addEdge(a, b, { skipIfCycle: true });
215
- }
216
- else {
217
- addEdge(b, a, { skipIfCycle: true });
218
- }
219
- }
220
- }
221
- const emitted = new Set();
222
- const visiting = new Set();
223
- const ordered = [];
224
- const visit = (outline) => {
225
- var _a;
226
- if (emitted.has(outline.key)) {
227
- return;
228
- }
229
- if (visiting.has(outline.key)) {
230
- throw new Error('Could not determine a stable outline rendering order');
231
- }
232
- visiting.add(outline.key);
233
- for (const dependencyKey of (_a = incomingEdges.get(outline.key)) !== null && _a !== void 0 ? _a : []) {
234
- const dependency = outlinesByKey.get(dependencyKey);
235
- if (dependency === undefined) {
236
- throw new Error('Expected outline dependency to exist');
237
- }
238
- visit(dependency);
239
- }
240
- visiting.delete(outline.key);
241
- emitted.add(outline.key);
242
- ordered.push(outline);
243
- };
244
- for (const outline of outlines) {
245
- visit(outline);
246
- }
247
- return ordered;
248
- };
249
- const orderOutlinesForRendering = ({ outlines, sequences, targetsByKey, }) => {
250
- const parentBySequenceId = getParentBySequenceId({ sequences, targetsByKey });
251
- return orderOutlineGroup({
252
- outlines,
253
- parentBySequenceId,
254
- targetsByKey,
255
- });
256
- };
257
- exports.orderOutlinesForRendering = orderOutlinesForRendering;
4
+ const canvas_1 = require("@remotion/canvas");
5
+ ({ orderCanvasOutlinesForRendering: exports.orderOutlinesForRendering } = canvas_1.CanvasInternals);