@tomorrowevening/theatre-studio 1.0.5 → 1.0.6

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 (274) hide show
  1. package/dist/index.js +105 -56
  2. package/package.json +1 -1
  3. package/dist/IDBStorage.js +0 -19
  4. package/dist/PaneManager.js +0 -112
  5. package/dist/Scrub.js +0 -134
  6. package/dist/Studio.js +0 -405
  7. package/dist/StudioBundle.js +0 -21
  8. package/dist/StudioStore/StudioStore.js +0 -163
  9. package/dist/StudioStore/createTransactionPrivateApi.js +0 -204
  10. package/dist/StudioStore/generateDiskStateRevision.js +0 -4
  11. package/dist/StudioStore/persistStateOfStudio.js +0 -61
  12. package/dist/TheatreStudio.js +0 -154
  13. package/dist/UI/UI.js +0 -65
  14. package/dist/UI/UINonSSRBits.js +0 -60
  15. package/dist/UIRoot/PanelsRoot.js +0 -19
  16. package/dist/UIRoot/PointerCapturing.js +0 -96
  17. package/dist/UIRoot/ProvideTheme.js +0 -9
  18. package/dist/UIRoot/UIRoot.js +0 -79
  19. package/dist/UIRoot/useKeyboardShortcuts.js +0 -158
  20. package/dist/checkForUpdates.js +0 -86
  21. package/dist/css.js +0 -116
  22. package/dist/getStudio.js +0 -10
  23. package/dist/notify.js +0 -328
  24. package/dist/panels/BasePanel/BasePanel.js +0 -74
  25. package/dist/panels/BasePanel/ExtensionPaneWrapper.js +0 -138
  26. package/dist/panels/BasePanel/PanelDragZone.js +0 -88
  27. package/dist/panels/BasePanel/PanelResizeHandle.js +0 -184
  28. package/dist/panels/BasePanel/PanelResizers.js +0 -14
  29. package/dist/panels/BasePanel/PanelWrapper.js +0 -34
  30. package/dist/panels/BasePanel/common.js +0 -52
  31. package/dist/panels/DetailPanel/DetailPanel.js +0 -146
  32. package/dist/panels/DetailPanel/DeterminePropEditorForDetail/DetailCompoundPropEditor.js +0 -169
  33. package/dist/panels/DetailPanel/DeterminePropEditorForDetail/DetailSimplePropEditor.js +0 -22
  34. package/dist/panels/DetailPanel/DeterminePropEditorForDetail/SingleRowPropEditor.js +0 -89
  35. package/dist/panels/DetailPanel/DeterminePropEditorForDetail/getDetailRowHighlightBackground.js +0 -7
  36. package/dist/panels/DetailPanel/DeterminePropEditorForDetail/rowIndentationFormulaCSS.js +0 -1
  37. package/dist/panels/DetailPanel/DeterminePropEditorForDetail.js +0 -28
  38. package/dist/panels/DetailPanel/EmptyState.js +0 -36
  39. package/dist/panels/DetailPanel/ObjectDetails.js +0 -52
  40. package/dist/panels/DetailPanel/ProjectDetails/StateConflictRow.js +0 -86
  41. package/dist/panels/DetailPanel/ProjectDetails.js +0 -98
  42. package/dist/panels/OutlinePanel/BaseItem.js +0 -136
  43. package/dist/panels/OutlinePanel/ObjectsList/ObjectItem.js +0 -14
  44. package/dist/panels/OutlinePanel/ObjectsList/ObjectsList.js +0 -85
  45. package/dist/panels/OutlinePanel/OutlinePanel.js +0 -73
  46. package/dist/panels/OutlinePanel/ProjectsList/ProjectListItem.js +0 -38
  47. package/dist/panels/OutlinePanel/ProjectsList/ProjectsList.js +0 -22
  48. package/dist/panels/OutlinePanel/SheetsList/SheetInstanceItem.js +0 -36
  49. package/dist/panels/OutlinePanel/SheetsList/SheetItem.js +0 -23
  50. package/dist/panels/OutlinePanel/SheetsList/SheetsList.js +0 -15
  51. package/dist/panels/OutlinePanel/outlinePanelUtils.js +0 -23
  52. package/dist/panels/SequenceEditorPanel/DopeSheet/DopeSheet.js +0 -21
  53. package/dist/panels/SequenceEditorPanel/DopeSheet/Left/AnyCompositeRow.js +0 -74
  54. package/dist/panels/SequenceEditorPanel/DopeSheet/Left/Left.js +0 -25
  55. package/dist/panels/SequenceEditorPanel/DopeSheet/Left/PrimitivePropRow.js +0 -97
  56. package/dist/panels/SequenceEditorPanel/DopeSheet/Left/PropWithChildrenRow.js +0 -15
  57. package/dist/panels/SequenceEditorPanel/DopeSheet/Left/SheetObjectRow.js +0 -19
  58. package/dist/panels/SequenceEditorPanel/DopeSheet/Left/SheetRow.js +0 -20
  59. package/dist/panels/SequenceEditorPanel/DopeSheet/Left/usePropHighlightMouseEnter.js +0 -33
  60. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/AggregateKeyframeConnector.js +0 -187
  61. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/AggregateKeyframeDot.js +0 -158
  62. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/AggregateKeyframeEditor.js +0 -32
  63. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/AggregateKeyframeVisualDot.js +0 -61
  64. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/iif.js +0 -3
  65. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/useAggregateKeyframeEditorUtils.js +0 -73
  66. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregatedKeyframeTrack.js +0 -407
  67. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/BasicKeyframedTrack.js +0 -108
  68. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/BasicKeyframeConnector.js +0 -185
  69. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/CurveEditorPopover.js +0 -397
  70. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/CurveSegmentEditor.js +0 -136
  71. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/EasingOption.js +0 -52
  72. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/SVGCurveSegment.js +0 -43
  73. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/colors.js +0 -3
  74. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/shared.js +0 -84
  75. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/useFreezableMemo.js +0 -16
  76. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/useUIOptionGrid.js +0 -82
  77. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/DeterminePropEditorForSingleKeyframe.js +0 -93
  78. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/SingleKeyframeDot.js +0 -254
  79. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/SingleKeyframeEditor.js +0 -22
  80. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/useSingleKeyframeInlineEditorPopover.js +0 -11
  81. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/useTempTransactionEditingTools.js +0 -43
  82. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/DopeSheetBackground.js +0 -24
  83. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/DopeSheetSelectionView.js +0 -272
  84. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/FocusRangeCurtains.js +0 -88
  85. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/HorizontallyScrollableArea.js +0 -215
  86. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/KeyframeSnapTarget.js +0 -55
  87. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/LengthIndicator/LengthEditorPopover.js +0 -69
  88. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/LengthIndicator/LengthIndicator.js +0 -217
  89. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/PrimitivePropRow.js +0 -25
  90. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/PropWithChildrenRow.js +0 -18
  91. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/Right.js +0 -30
  92. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/Row.js +0 -50
  93. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/SheetObjectRow.js +0 -14
  94. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/SheetRow.js +0 -14
  95. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/collectAggregateKeyframes.js +0 -92
  96. package/dist/panels/SequenceEditorPanel/DopeSheet/Right/keyframeRowUI/ConnectorLine.js +0 -62
  97. package/dist/panels/SequenceEditorPanel/DopeSheet/selections.js +0 -149
  98. package/dist/panels/SequenceEditorPanel/DopeSheet/setCollapsedSheetObjectOrCompoundProp.js +0 -10
  99. package/dist/panels/SequenceEditorPanel/FrameGrid/FrameGrid.js +0 -92
  100. package/dist/panels/SequenceEditorPanel/FrameGrid/StampsGrid.js +0 -99
  101. package/dist/panels/SequenceEditorPanel/FrameGrid/createGrid.js +0 -49
  102. package/dist/panels/SequenceEditorPanel/FrameStampPositionProvider.js +0 -189
  103. package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/BasicKeyframedTrack.js +0 -91
  104. package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/Curve.js +0 -87
  105. package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/CurveHandle.js +0 -186
  106. package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/GraphEditorDotNonScalar.js +0 -162
  107. package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/GraphEditorDotScalar.js +0 -209
  108. package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/GraphEditorNonScalarDash.js +0 -23
  109. package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/KeyframeEditor.js +0 -30
  110. package/dist/panels/SequenceEditorPanel/GraphEditor/GraphEditor.js +0 -73
  111. package/dist/panels/SequenceEditorPanel/GraphEditor/PrimitivePropGraph.js +0 -20
  112. package/dist/panels/SequenceEditorPanel/GraphEditorToggle.js +0 -59
  113. package/dist/panels/SequenceEditorPanel/RightOverlay/DopeSnap.js +0 -36
  114. package/dist/panels/SequenceEditorPanel/RightOverlay/DopeSnapHitZoneUI.js +0 -57
  115. package/dist/panels/SequenceEditorPanel/RightOverlay/FocusRangeZone/FocusRangeStrip.js +0 -233
  116. package/dist/panels/SequenceEditorPanel/RightOverlay/FocusRangeZone/FocusRangeThumb.js +0 -217
  117. package/dist/panels/SequenceEditorPanel/RightOverlay/FocusRangeZone/FocusRangeZone.js +0 -181
  118. package/dist/panels/SequenceEditorPanel/RightOverlay/FrameStamp.js +0 -65
  119. package/dist/panels/SequenceEditorPanel/RightOverlay/HorizontalScrollbar.js +0 -235
  120. package/dist/panels/SequenceEditorPanel/RightOverlay/Markers/MarkerDot.js +0 -184
  121. package/dist/panels/SequenceEditorPanel/RightOverlay/Markers/MarkerEditorPopover.js +0 -65
  122. package/dist/panels/SequenceEditorPanel/RightOverlay/Markers/Markers.js +0 -13
  123. package/dist/panels/SequenceEditorPanel/RightOverlay/Playhead.js +0 -265
  124. package/dist/panels/SequenceEditorPanel/RightOverlay/PlayheadPositionPopover.js +0 -64
  125. package/dist/panels/SequenceEditorPanel/RightOverlay/RightOverlay.js +0 -35
  126. package/dist/panels/SequenceEditorPanel/RightOverlay/TopStrip.js +0 -31
  127. package/dist/panels/SequenceEditorPanel/SequenceEditorPanel.js +0 -179
  128. package/dist/panels/SequenceEditorPanel/VerticalScrollContainer.js +0 -42
  129. package/dist/panels/SequenceEditorPanel/layout/layout.js +0 -166
  130. package/dist/panels/SequenceEditorPanel/layout/tree.js +0 -139
  131. package/dist/panels/SequenceEditorPanel/whatPropIsHighlighted.js +0 -58
  132. package/dist/propEditors/DefaultValueIndicator.js +0 -64
  133. package/dist/propEditors/NextPrevKeyframeCursors.js +0 -135
  134. package/dist/propEditors/getNearbyKeyframesOfTrack.js +0 -46
  135. package/dist/propEditors/simpleEditors/BooleanPropEditor.js +0 -17
  136. package/dist/propEditors/simpleEditors/FilePropEditor.js +0 -118
  137. package/dist/propEditors/simpleEditors/ISimplePropEditorReactProps.js +0 -1
  138. package/dist/propEditors/simpleEditors/ImagePropEditor.js +0 -126
  139. package/dist/propEditors/simpleEditors/NumberPropEditor.js +0 -9
  140. package/dist/propEditors/simpleEditors/RgbaPropEditor.js +0 -73
  141. package/dist/propEditors/simpleEditors/StringLiteralPropEditor.js +0 -10
  142. package/dist/propEditors/simpleEditors/StringPropEditor.js +0 -6
  143. package/dist/propEditors/simpleEditors/simplePropEditorByPropType.js +0 -16
  144. package/dist/propEditors/useEditingToolsForCompoundProp.js +0 -228
  145. package/dist/propEditors/useEditingToolsForSimpleProp.js +0 -229
  146. package/dist/propEditors/utils/IEditingTools.js +0 -1
  147. package/dist/propEditors/utils/PropConfigForType.js +0 -1
  148. package/dist/propEditors/utils/getPropTypeByPointer.js +0 -48
  149. package/dist/propEditors/utils/propNameTextCSS.js +0 -7
  150. package/dist/selectors.js +0 -63
  151. package/dist/store/index.js +0 -184
  152. package/dist/store/stateEditors.js +0 -774
  153. package/dist/store/types/ahistoric.js +0 -1
  154. package/dist/store/types/ephemeral.js +0 -1
  155. package/dist/store/types/historic.js +0 -1
  156. package/dist/store/types/index.js +0 -3
  157. package/dist/toolbars/ExtensionToolbar/ExtensionToolbar.js +0 -51
  158. package/dist/toolbars/ExtensionToolbar/Toolset.js +0 -27
  159. package/dist/toolbars/ExtensionToolbar/tools/ExtensionFlyoutMenu.js +0 -51
  160. package/dist/toolbars/ExtensionToolbar/tools/IconButton.js +0 -16
  161. package/dist/toolbars/ExtensionToolbar/tools/Switch.js +0 -20
  162. package/dist/toolbars/GlobalToolbar.js +0 -142
  163. package/dist/toolbars/MoreMenu/MoreMenu.js +0 -133
  164. package/dist/toolbars/PinButton.js +0 -26
  165. package/dist/uiComponents/DetailPanelButton.js +0 -21
  166. package/dist/uiComponents/PointerEventsHandler.js +0 -80
  167. package/dist/uiComponents/Popover/ArrowContext.js +0 -3
  168. package/dist/uiComponents/Popover/BasicPopover.js +0 -35
  169. package/dist/uiComponents/Popover/BasicTooltip.js +0 -10
  170. package/dist/uiComponents/Popover/ErrorTooltip.js +0 -9
  171. package/dist/uiComponents/Popover/MinimalTooltip.js +0 -6
  172. package/dist/uiComponents/Popover/PopoverArrow.js +0 -38
  173. package/dist/uiComponents/Popover/TooltipContext.js +0 -46
  174. package/dist/uiComponents/Popover/TooltipWrapper.js +0 -103
  175. package/dist/uiComponents/Popover/usePopover.js +0 -132
  176. package/dist/uiComponents/Popover/useTooltip.js +0 -33
  177. package/dist/uiComponents/RoomToClick.js +0 -10
  178. package/dist/uiComponents/SVGIcon.js +0 -19
  179. package/dist/uiComponents/ShowMousePosition.js +0 -30
  180. package/dist/uiComponents/colorPicker/components/EditingProvider.js +0 -15
  181. package/dist/uiComponents/colorPicker/components/RgbaColorPicker.js +0 -31
  182. package/dist/uiComponents/colorPicker/components/common/Alpha.js +0 -54
  183. package/dist/uiComponents/colorPicker/components/common/AlphaColorPicker.js +0 -28
  184. package/dist/uiComponents/colorPicker/components/common/Hue.js +0 -41
  185. package/dist/uiComponents/colorPicker/components/common/Interactive.js +0 -142
  186. package/dist/uiComponents/colorPicker/components/common/Pointer.js +0 -39
  187. package/dist/uiComponents/colorPicker/components/common/Saturation.js +0 -44
  188. package/dist/uiComponents/colorPicker/hooks/useColorManipulation.js +0 -77
  189. package/dist/uiComponents/colorPicker/hooks/useEventCallback.js +0 -10
  190. package/dist/uiComponents/colorPicker/hooks/useIsomorphicLayoutEffect.js +0 -5
  191. package/dist/uiComponents/colorPicker/index.js +0 -1
  192. package/dist/uiComponents/colorPicker/types.js +0 -1
  193. package/dist/uiComponents/colorPicker/utils/clamp.js +0 -6
  194. package/dist/uiComponents/colorPicker/utils/compare.js +0 -25
  195. package/dist/uiComponents/colorPicker/utils/convert.js +0 -165
  196. package/dist/uiComponents/colorPicker/utils/round.js +0 -3
  197. package/dist/uiComponents/colorPicker/utils/validate.js +0 -10
  198. package/dist/uiComponents/createCursorLock.js +0 -2
  199. package/dist/uiComponents/form/BasicCheckbox.js +0 -5
  200. package/dist/uiComponents/form/BasicNumberInput.js +0 -261
  201. package/dist/uiComponents/form/BasicSelect.js +0 -58
  202. package/dist/uiComponents/form/BasicStringInput.js +0 -151
  203. package/dist/uiComponents/form/BasicSwitch.js +0 -60
  204. package/dist/uiComponents/icons/AddImage.js +0 -6
  205. package/dist/uiComponents/icons/ArrowClockwise.js +0 -6
  206. package/dist/uiComponents/icons/ArrowsOutCardinal.js +0 -6
  207. package/dist/uiComponents/icons/Bell.js +0 -6
  208. package/dist/uiComponents/icons/Camera.js +0 -7
  209. package/dist/uiComponents/icons/ChevronDown.js +0 -6
  210. package/dist/uiComponents/icons/ChevronLeft.js +0 -6
  211. package/dist/uiComponents/icons/ChevronRight.js +0 -6
  212. package/dist/uiComponents/icons/Cube.js +0 -6
  213. package/dist/uiComponents/icons/CubeFull.js +0 -6
  214. package/dist/uiComponents/icons/CubeHalf.js +0 -6
  215. package/dist/uiComponents/icons/CubeRendered.js +0 -7
  216. package/dist/uiComponents/icons/Details.js +0 -6
  217. package/dist/uiComponents/icons/DoubleChevronLeft.js +0 -6
  218. package/dist/uiComponents/icons/DoubleChevronRight.js +0 -6
  219. package/dist/uiComponents/icons/Ellipsis.js +0 -6
  220. package/dist/uiComponents/icons/EllipsisFill.js +0 -6
  221. package/dist/uiComponents/icons/GlobeSimple.js +0 -6
  222. package/dist/uiComponents/icons/Outline.js +0 -6
  223. package/dist/uiComponents/icons/Package.js +0 -6
  224. package/dist/uiComponents/icons/Resize.js +0 -7
  225. package/dist/uiComponents/icons/Trash.js +0 -6
  226. package/dist/uiComponents/icons/index.js +0 -20
  227. package/dist/uiComponents/isSafari.js +0 -2
  228. package/dist/uiComponents/onPointerOutside.js +0 -19
  229. package/dist/uiComponents/selects/BasicSelect.js +0 -24
  230. package/dist/uiComponents/simpleContextMenu/ContextMenu/BaseMenu.js +0 -40
  231. package/dist/uiComponents/simpleContextMenu/ContextMenu/ContextMenu.js +0 -87
  232. package/dist/uiComponents/simpleContextMenu/ContextMenu/Item.js +0 -37
  233. package/dist/uiComponents/simpleContextMenu/useContextMenu.js +0 -20
  234. package/dist/uiComponents/simpleContextMenu/useRequestContextMenu.js +0 -22
  235. package/dist/uiComponents/toolbar/ToolbarDropdownSelect.js +0 -7
  236. package/dist/uiComponents/toolbar/ToolbarIconButton.js +0 -74
  237. package/dist/uiComponents/toolbar/ToolbarSwitchSelect.js +0 -12
  238. package/dist/uiComponents/toolbar/ToolbarSwitchSelectContainer.js +0 -9
  239. package/dist/uiComponents/useBoundingClientRect.js +0 -13
  240. package/dist/uiComponents/useDebugRefreshEvery.js +0 -19
  241. package/dist/uiComponents/useDrag.js +0 -199
  242. package/dist/uiComponents/useHotspot.js +0 -30
  243. package/dist/uiComponents/useHover.js +0 -23
  244. package/dist/uiComponents/useHoverWithoutDescendants.js +0 -33
  245. package/dist/uiComponents/useKeyDown.js +0 -9
  246. package/dist/uiComponents/useKeyDownCallback.js +0 -28
  247. package/dist/uiComponents/useLockSet.js +0 -17
  248. package/dist/uiComponents/useLogger.js +0 -16
  249. package/dist/uiComponents/useOnClickOutside.js +0 -25
  250. package/dist/uiComponents/useOnKeyDown.js +0 -12
  251. package/dist/uiComponents/usePresence.js +0 -156
  252. package/dist/uiComponents/useValToAtom.js +0 -11
  253. package/dist/utils/absoluteDims.js +0 -7
  254. package/dist/utils/contextualWebComponents.js +0 -44
  255. package/dist/utils/copyToClipboard.js +0 -28
  256. package/dist/utils/derive-utils.js +0 -61
  257. package/dist/utils/devStringify.js +0 -20
  258. package/dist/utils/invariant.js +0 -79
  259. package/dist/utils/isMac.js +0 -2
  260. package/dist/utils/keyboardUtils.js +0 -23
  261. package/dist/utils/mousePositionD.js +0 -18
  262. package/dist/utils/redux/actionCreator.js +0 -15
  263. package/dist/utils/redux/actionCreator.test.js +0 -35
  264. package/dist/utils/redux/actionReducersBundle.js +0 -18
  265. package/dist/utils/redux/atomFromReduxStore.js +0 -11
  266. package/dist/utils/redux/configureStore.js +0 -18
  267. package/dist/utils/redux/pointerFriendlySelector.js +0 -8
  268. package/dist/utils/redux/withHistory/withBatchActions.js +0 -13
  269. package/dist/utils/redux/withHistory/withHistory.js +0 -157
  270. package/dist/utils/renderInPortalInContext.js +0 -38
  271. package/dist/utils/selectClosestHTMLAncestor.js +0 -13
  272. package/dist/utils/tightJsonStringify.js +0 -27
  273. package/dist/utils/tightJsonStringify.test.js +0 -25
  274. package/dist/utils/useRefAndState.js +0 -32
@@ -1,187 +0,0 @@
1
- import { val } from '@tomorrowevening/theatre-dataverse';
2
- import React, { useMemo, useRef } from 'react';
3
- import { ConnectorLine } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/Right/keyframeRowUI/ConnectorLine';
4
- import { AggregateKeyframePositionIsSelected } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregatedKeyframeTrack';
5
- import usePopover from '@tomorrowevening/theatre-studio/uiComponents/Popover/usePopover';
6
- import useRefAndState from '@tomorrowevening/theatre-studio/utils/useRefAndState';
7
- import getStudio from '@tomorrowevening/theatre-studio/getStudio';
8
- import useDrag from '@tomorrowevening/theatre-studio/uiComponents/useDrag';
9
- import CurveEditorPopover from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/CurveEditorPopover';
10
- import { useAggregateKeyframeEditorUtils } from './useAggregateKeyframeEditorUtils';
11
- import styled from 'styled-components';
12
- import BasicPopover from '@tomorrowevening/theatre-studio/uiComponents/Popover/BasicPopover';
13
- import { copyableKeyframesFromSelection, keyframesWithPaths, } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/selections';
14
- import useContextMenu from '@tomorrowevening/theatre-studio/uiComponents/simpleContextMenu/useContextMenu';
15
- import { commonRootOfPathsToProps } from '@tomorrowevening/theatre-shared/utils/addresses';
16
- const POPOVER_MARGIN_PX = 5;
17
- const EasingPopoverWrapper = styled(BasicPopover) `
18
- --popover-outer-stroke: transparent;
19
- --popover-inner-stroke: rgba(26, 28, 30, 0.97);
20
- `;
21
- export const AggregateCurveEditorPopover = React.forwardRef((props, ref) => {
22
- const { allConnections } = useAggregateKeyframeEditorUtils(props);
23
- return (React.createElement(EasingPopoverWrapper, { showPopoverEdgeTriangle: false,
24
- // @ts-ignore @todo
25
- ref: ref },
26
- React.createElement(CurveEditorPopover, { curveConnection: allConnections[0], additionalConnections: allConnections, onRequestClose: props.closePopover })));
27
- });
28
- export const AggregateKeyframeConnector = (props) => {
29
- const [nodeRef, node] = useRefAndState(null);
30
- const { editorProps } = props;
31
- const [contextMenu] = useConnectorContextMenu(props, node);
32
- const [isDragging] = useDragKeyframe(node, props.editorProps);
33
- const { node: popoverNode, toggle: togglePopover, close: closePopover, } = usePopover(() => {
34
- const rightDims = val(editorProps.layoutP.rightDims);
35
- return {
36
- debugName: 'Connector',
37
- constraints: {
38
- minX: rightDims.screenX + POPOVER_MARGIN_PX,
39
- maxX: rightDims.screenX + rightDims.width - POPOVER_MARGIN_PX,
40
- },
41
- };
42
- }, () => {
43
- return (React.createElement(AggregateCurveEditorPopover, { ...editorProps, closePopover: closePopover }));
44
- });
45
- const { connected, isAggregateEditingInCurvePopover } = props.utils;
46
- // We don't want to interrupt an existing drag, so in order to persist the dragged
47
- // html node, we just set the connector length to 0, but we don't remove it yet.
48
- return connected || isDragging ? (React.createElement(React.Fragment, null,
49
- React.createElement(ConnectorLine, { ref: nodeRef, connectorLengthInUnitSpace: connected ? connected.length : 0, isSelected: connected ? connected.selected : false, isPopoverOpen: isAggregateEditingInCurvePopover, openPopover: (e) => {
50
- if (node)
51
- togglePopover(e, node);
52
- } }),
53
- popoverNode,
54
- contextMenu)) : (React.createElement(React.Fragment, null));
55
- };
56
- function useDragKeyframe(node, editorProps) {
57
- const propsRef = useRef(editorProps);
58
- propsRef.current = editorProps;
59
- const gestureHandlers = useMemo(() => {
60
- return {
61
- debugName: 'useDragKeyframe',
62
- lockCSSCursorTo: 'ew-resize',
63
- onDragStart(event) {
64
- const props = propsRef.current;
65
- let tempTransaction;
66
- const keyframes = props.aggregateKeyframes[props.index].keyframes;
67
- const { selection, viewModel } = props;
68
- const address = viewModel.type === 'sheet'
69
- ? viewModel.sheet.address
70
- : viewModel.sheetObject.address;
71
- if (selection &&
72
- props.aggregateKeyframes[props.index].selected ===
73
- AggregateKeyframePositionIsSelected.AllSelected) {
74
- return selection
75
- .getDragHandlers({
76
- ...address,
77
- domNode: node,
78
- positionAtStartOfDrag: props.aggregateKeyframes[props.index].position,
79
- })
80
- .onDragStart(event);
81
- }
82
- const propsAtStartOfDrag = props;
83
- const sequence = val(propsAtStartOfDrag.layoutP.sheet).getSequence();
84
- const toUnitSpace = val(propsAtStartOfDrag.layoutP.scaledSpace.toUnitSpace);
85
- return {
86
- onDrag(dx, dy, event) {
87
- const delta = toUnitSpace(dx);
88
- if (tempTransaction) {
89
- tempTransaction.discard();
90
- tempTransaction = undefined;
91
- }
92
- tempTransaction = getStudio().tempTransaction(({ stateEditors }) => {
93
- for (const keyframe of keyframes) {
94
- stateEditors.coreByProject.historic.sheetsById.sequence.transformKeyframes({
95
- ...keyframe.track.sheetObject.address,
96
- trackId: keyframe.track.id,
97
- keyframeIds: [
98
- keyframe.kf.id,
99
- keyframe.track.data.keyframes[keyframe.track.data.keyframes.indexOf(keyframe.kf) + 1].id,
100
- ],
101
- translate: delta,
102
- scale: 1,
103
- origin: 0,
104
- snappingFunction: sequence.closestGridPosition,
105
- });
106
- }
107
- });
108
- },
109
- onDragEnd(dragHappened) {
110
- if (dragHappened) {
111
- if (tempTransaction) {
112
- tempTransaction.commit();
113
- }
114
- }
115
- else {
116
- if (tempTransaction) {
117
- tempTransaction.discard();
118
- }
119
- }
120
- },
121
- };
122
- },
123
- };
124
- }, []);
125
- return useDrag(node, gestureHandlers);
126
- }
127
- function useConnectorContextMenu(props, node) {
128
- return useContextMenu(node, {
129
- displayName: 'Aggregate Tween',
130
- menuItems: () => {
131
- // see AGGREGATE_COPY_PASTE.md for explanation of this
132
- // code that makes some keyframes with paths for copying
133
- // to clipboard
134
- const kfs = props.utils.allConnections.reduce((acc, con) => acc.concat(keyframesWithPaths({
135
- ...con,
136
- keyframeIds: [con.left.id, con.right.id],
137
- }) ?? []), []);
138
- const commonPath = commonRootOfPathsToProps(kfs.map((kf) => kf.pathToProp));
139
- const keyframesWithCommonRootPath = kfs.map(({ keyframe, pathToProp }) => ({
140
- keyframe,
141
- pathToProp: pathToProp.slice(commonPath.length),
142
- }));
143
- const viewModel = props.editorProps.viewModel;
144
- const address = viewModel.type === 'sheet'
145
- ? viewModel.sheet.address
146
- : viewModel.sheetObject.address;
147
- return [
148
- {
149
- label: 'Copy',
150
- callback: () => {
151
- if (props.editorProps.selection) {
152
- const copyableKeyframes = copyableKeyframesFromSelection(address.projectId, address.sheetId, props.editorProps.selection);
153
- getStudio().transaction((api) => {
154
- api.stateEditors.studio.ahistoric.setClipboardKeyframes(copyableKeyframes);
155
- });
156
- }
157
- else {
158
- getStudio().transaction((api) => {
159
- api.stateEditors.studio.ahistoric.setClipboardKeyframes(keyframesWithCommonRootPath);
160
- });
161
- }
162
- },
163
- },
164
- {
165
- label: 'Delete',
166
- callback: () => {
167
- if (props.editorProps.selection) {
168
- props.editorProps.selection.delete();
169
- }
170
- else {
171
- getStudio().transaction(({ stateEditors }) => {
172
- for (const con of props.utils.allConnections) {
173
- stateEditors.coreByProject.historic.sheetsById.sequence.deleteKeyframes({
174
- ...address,
175
- objectKey: con.objectKey,
176
- keyframeIds: [con.left.id, con.right.id],
177
- trackId: con.trackId,
178
- });
179
- }
180
- });
181
- }
182
- },
183
- },
184
- ];
185
- },
186
- });
187
- }
@@ -1,158 +0,0 @@
1
- import React from 'react';
2
- import useRefAndState from '@tomorrowevening/theatre-studio/utils/useRefAndState';
3
- import usePresence, { PresenceFlag, } from '@tomorrowevening/theatre-studio/uiComponents/usePresence';
4
- import useContextMenu from '@tomorrowevening/theatre-studio/uiComponents/simpleContextMenu/useContextMenu';
5
- import { AggregateKeyframeVisualDot, HitZone } from './AggregateKeyframeVisualDot';
6
- import getStudio from '@tomorrowevening/theatre-studio/getStudio';
7
- import { copyableKeyframesFromSelection, keyframesWithPaths, } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/selections';
8
- import { commonRootOfPathsToProps } from '@tomorrowevening/theatre-shared/utils/addresses';
9
- import DopeSnap from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/RightOverlay/DopeSnap';
10
- import { useKeyframeInlineEditorPopover } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/useSingleKeyframeInlineEditorPopover';
11
- const isOptionsTreeNodeNotNull = (a) => a !== null;
12
- function sheetObjectBuild(viewModel, keyframes) {
13
- const children = viewModel.children
14
- .map((a) => a.type === 'propWithChildren'
15
- ? propWithChildrenBuild(a, keyframes)
16
- : primitivePropBuild(a, keyframes))
17
- .filter(isOptionsTreeNodeNotNull);
18
- if (children.length === 0)
19
- return null;
20
- return {
21
- type: 'sheetObject',
22
- sheetObject: viewModel.sheetObject,
23
- children,
24
- };
25
- }
26
- function propWithChildrenBuild(viewModel, keyframes) {
27
- const children = viewModel.children
28
- .map((a) => a.type === 'propWithChildren'
29
- ? propWithChildrenBuild(a, keyframes)
30
- : primitivePropBuild(a, keyframes))
31
- .filter(isOptionsTreeNodeNotNull);
32
- if (children.length === 0)
33
- return null;
34
- return {
35
- type: 'propWithChildren',
36
- pathToProp: viewModel.pathToProp,
37
- propConfig: viewModel.propConf,
38
- children,
39
- };
40
- }
41
- function primitivePropBuild(viewModelLeaf, keyframes) {
42
- const keyframe = keyframes.find((kf) => kf.track.id === viewModelLeaf.trackId);
43
- if (!keyframe)
44
- return null;
45
- return {
46
- type: 'primitiveProp',
47
- keyframe: keyframe.kf,
48
- pathToProp: viewModelLeaf.pathToProp,
49
- propConfig: viewModelLeaf.propConf,
50
- sheetObject: viewModelLeaf.sheetObject,
51
- trackId: viewModelLeaf.trackId,
52
- };
53
- }
54
- export function AggregateKeyframeDot(props) {
55
- const { cur } = props.utils;
56
- const inlineEditorPopover = useKeyframeInlineEditorPopover(props.editorProps.viewModel.type === 'sheet'
57
- ? null
58
- : props.editorProps.viewModel.type === 'sheetObject'
59
- ? sheetObjectBuild(props.editorProps.viewModel, cur.keyframes)
60
- ?.children ?? null
61
- : propWithChildrenBuild(props.editorProps.viewModel, cur.keyframes)
62
- ?.children ?? null);
63
- const presence = usePresence(props.utils.itemKey);
64
- presence.useRelations(() => cur.keyframes.map((kf) => ({
65
- affects: kf.itemKey,
66
- flag: PresenceFlag.Primary,
67
- })), [
68
- // Hmm: Is this a valid fix for the changing size of the useEffect's dependency array?
69
- // also: does it work properly with selections?
70
- cur.keyframes
71
- .map((keyframeWithTrack) => keyframeWithTrack.track.id)
72
- .join('-'),
73
- ]);
74
- const [ref, node] = useRefAndState(null);
75
- const [contextMenu] = useAggregateKeyframeContextMenu(props, node);
76
- return (React.createElement(React.Fragment, null,
77
- React.createElement(HitZone, { ref: ref, ...presence.attrs, ...DopeSnap.includePositionSnapAttrs(cur.position), onClick: (e) => props.editorProps.viewModel.type !== 'sheet'
78
- ? inlineEditorPopover.open(e, ref.current)
79
- : null }),
80
- React.createElement(AggregateKeyframeVisualDot, { flag: presence.flag, isAllHere: cur.allHere, isSelected: cur.selected }),
81
- contextMenu,
82
- inlineEditorPopover.node));
83
- }
84
- function useAggregateKeyframeContextMenu(props, target) {
85
- return useContextMenu(target, {
86
- displayName: 'Aggregate Keyframe',
87
- menuItems: () => {
88
- const viewModel = props.editorProps.viewModel;
89
- const selection = props.editorProps.selection;
90
- return [
91
- {
92
- label: selection ? 'Copy (selection)' : 'Copy',
93
- callback: () => {
94
- // see AGGREGATE_COPY_PASTE.md for explanation of this
95
- // code that makes some keyframes with paths for copying
96
- // to clipboard
97
- if (selection) {
98
- const { projectId, sheetId } = viewModel.type === 'sheet'
99
- ? viewModel.sheet.address
100
- : viewModel.sheetObject.address;
101
- const copyableKeyframes = copyableKeyframesFromSelection(projectId, sheetId, selection);
102
- getStudio().transaction((api) => {
103
- api.stateEditors.studio.ahistoric.setClipboardKeyframes(copyableKeyframes);
104
- });
105
- }
106
- else {
107
- const kfs = props.utils.cur.keyframes.flatMap((kfWithTrack) => keyframesWithPaths({
108
- ...kfWithTrack.track.sheetObject.address,
109
- trackId: kfWithTrack.track.id,
110
- keyframeIds: [kfWithTrack.kf.id],
111
- }) ?? []);
112
- const basePathRelativeToSheet = viewModel.type === 'sheet'
113
- ? []
114
- : viewModel.type === 'sheetObject'
115
- ? [viewModel.sheetObject.address.objectKey]
116
- : viewModel.type === 'propWithChildren'
117
- ? [
118
- viewModel.sheetObject.address.objectKey,
119
- ...viewModel.pathToProp,
120
- ]
121
- : []; // should be unreachable unless new viewModel/leaf types are added
122
- const commonPath = commonRootOfPathsToProps([
123
- basePathRelativeToSheet,
124
- ...kfs.map((kf) => kf.pathToProp),
125
- ]);
126
- const keyframesWithCommonRootPath = kfs.map(({ keyframe, pathToProp }) => ({
127
- keyframe,
128
- pathToProp: pathToProp.slice(commonPath.length),
129
- }));
130
- getStudio().transaction((api) => {
131
- api.stateEditors.studio.ahistoric.setClipboardKeyframes(keyframesWithCommonRootPath);
132
- });
133
- }
134
- },
135
- },
136
- {
137
- label: selection ? 'Delete (selection)' : 'Delete',
138
- callback: () => {
139
- if (selection) {
140
- selection.delete();
141
- }
142
- else {
143
- getStudio().transaction(({ stateEditors }) => {
144
- for (const kfWithTrack of props.utils.cur.keyframes) {
145
- stateEditors.coreByProject.historic.sheetsById.sequence.deleteKeyframes({
146
- ...kfWithTrack.track.sheetObject.address,
147
- keyframeIds: [kfWithTrack.kf.id],
148
- trackId: kfWithTrack.track.id,
149
- });
150
- }
151
- });
152
- }
153
- },
154
- },
155
- ];
156
- },
157
- });
158
- }
@@ -1,32 +0,0 @@
1
- import { val } from '@tomorrowevening/theatre-dataverse';
2
- import React from 'react';
3
- import styled from 'styled-components';
4
- import { AggregateKeyframeConnector } from './AggregateKeyframeConnector';
5
- import { useAggregateKeyframeEditorUtils } from './useAggregateKeyframeEditorUtils';
6
- import { AggregateKeyframeDot } from './AggregateKeyframeDot';
7
- const AggregateKeyframeEditorContainer = styled.div `
8
- position: absolute;
9
- `;
10
- /**
11
- * TODO we're spending a lot of cycles on each render of each aggreagte keyframes.
12
- *
13
- * Each keyframe node is doing O(N) operations, N being the number of underlying
14
- * keyframes it represetns.
15
- *
16
- * The biggest example is the `isConnectionEditingInCurvePopover()` call which is run
17
- * for every underlying keyframe, every time this component is rendered.
18
- *
19
- * We can optimize this away by doing all of this work _once_ when a curve editor popover
20
- * is open. This would require having some kind of stable identity for each aggregate row.
21
- * Let's defer that work until other interactive keyframe editing PRs are merged in.
22
- */
23
- const AggregateKeyframeEditor = React.memo((props) => {
24
- const utils = useAggregateKeyframeEditorUtils(props);
25
- return (React.createElement(AggregateKeyframeEditorContainer, { style: {
26
- top: `${props.viewModel.nodeHeight / 2}px`,
27
- left: `calc(${val(props.layoutP.scaledSpace.leftPadding)}px + calc(var(--unitSpaceToScaledSpaceMultiplier) * ${utils.cur.position}px))`,
28
- } },
29
- React.createElement(AggregateKeyframeDot, { editorProps: props, utils: utils }),
30
- React.createElement(AggregateKeyframeConnector, { editorProps: props, utils: utils })));
31
- });
32
- export default AggregateKeyframeEditor;
@@ -1,61 +0,0 @@
1
- import React from 'react';
2
- import { AggregateKeyframePositionIsSelected } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregatedKeyframeTrack';
3
- import { PresenceFlag } from '@tomorrowevening/theatre-studio/uiComponents/usePresence';
4
- import styled from 'styled-components';
5
- import { absoluteDims } from '@tomorrowevening/theatre-studio/utils/absoluteDims';
6
- import { pointerEventsAutoInNormalMode } from '@tomorrowevening/theatre-studio/css';
7
- const DOT_SIZE_PX = 16;
8
- const DOT_HOVER_SIZE_PX = DOT_SIZE_PX + 2;
9
- /** The keyframe diamond ◆ */
10
- const DotContainer = styled.div `
11
- position: absolute;
12
- ${absoluteDims(DOT_SIZE_PX)}
13
- z-index: 1;
14
- `;
15
- // hmm kinda weird to organize like this (exporting `HitZone`). Maybe there's a way to re-use
16
- // this interpolation of `DotContainer` using something like extended components or something.
17
- export const HitZone = styled.div `
18
- z-index: 2;
19
- cursor: ew-resize;
20
-
21
- position: absolute;
22
- ${absoluteDims(12)};
23
- ${pointerEventsAutoInNormalMode};
24
-
25
- &:hover
26
- + ${DotContainer},
27
- #pointer-root.draggingPositionInSequenceEditor
28
- &:hover
29
- + ${DotContainer} {
30
- ${absoluteDims(DOT_HOVER_SIZE_PX)}
31
- }
32
- `;
33
- export function AggregateKeyframeVisualDot(props) {
34
- const theme = {
35
- isSelected: props.isSelected,
36
- flag: props.flag,
37
- };
38
- return (React.createElement(DotContainer, null, props.isAllHere ? (React.createElement(AggregateDotAllHereSvg, { ...theme })) : (React.createElement(AggregateDotSomeHereSvg, { ...theme }))));
39
- }
40
- const SELECTED_COLOR = '#F2C95C';
41
- const DEFAULT_PRIMARY_COLOR = '#40AAA4';
42
- const DEFAULT_SECONDARY_COLOR = '#45747C';
43
- const selectionColorAll = (theme) => theme.isSelected === AggregateKeyframePositionIsSelected.AllSelected
44
- ? SELECTED_COLOR
45
- : theme.isSelected ===
46
- AggregateKeyframePositionIsSelected.AtLeastOneUnselected
47
- ? DEFAULT_PRIMARY_COLOR
48
- : DEFAULT_SECONDARY_COLOR;
49
- const selectionColorSome = (theme) => theme.isSelected === AggregateKeyframePositionIsSelected.AllSelected
50
- ? SELECTED_COLOR
51
- : theme.isSelected ===
52
- AggregateKeyframePositionIsSelected.AtLeastOneUnselected
53
- ? DEFAULT_PRIMARY_COLOR
54
- : DEFAULT_SECONDARY_COLOR;
55
- const AggregateDotAllHereSvg = (theme) => (React.createElement("svg", { width: "100%", height: "100%", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
56
- React.createElement("rect", { x: "4.46443", y: "10.0078", width: "5", height: "5", transform: "rotate(-45 4.46443 10.0078)", fill: "#212327" // background knockout fill
57
- , stroke: selectionColorSome(theme) }),
58
- React.createElement("rect", { x: "3.75732", y: "6.01953", width: "6", height: "6", transform: "rotate(-45 3.75732 6.01953)", fill: selectionColorAll(theme), stroke: theme.flag === PresenceFlag.Primary ? 'white' : undefined, strokeWidth: theme.flag === PresenceFlag.Primary ? '2px' : undefined })));
59
- // when the aggregate keyframes are sparse across tracks at this position
60
- const AggregateDotSomeHereSvg = (theme) => (React.createElement("svg", { width: "100%", height: "100%", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
61
- React.createElement("rect", { x: "4.46443", y: "8", width: "5", height: "5", transform: "rotate(-45 4.46443 8)", fill: "#23262B", stroke: theme.flag === PresenceFlag.Primary ? 'white' : selectionColorAll(theme), strokeWidth: theme.flag === PresenceFlag.Primary ? '2px' : undefined })));
@@ -1,73 +0,0 @@
1
- import { prism } from '@tomorrowevening/theatre-dataverse';
2
- import { createStudioSheetItemKey } from '@tomorrowevening/theatre-shared/utils/ids';
3
- import { AggregateKeyframePositionIsSelected } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregatedKeyframeTrack';
4
- import { isConnectionEditingInCurvePopover } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/CurveEditorPopover';
5
- import { usePrism } from '@tomorrowevening/theatre-react';
6
- import { selectedKeyframeConnections } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/selections';
7
- import { iif } from './iif';
8
- // I think this was pulled out for performance
9
- // 1/10: Not sure this is properly split up
10
- export function useAggregateKeyframeEditorUtils(props) {
11
- const { index, aggregateKeyframes, selection } = props;
12
- return usePrism(getAggregateKeyframeEditorUtilsPrismFn(props), [
13
- index,
14
- aggregateKeyframes,
15
- selection,
16
- props.viewModel,
17
- ]);
18
- }
19
- // I think this was pulled out for performance
20
- // 1/10: Not sure this is properly split up
21
- export function getAggregateKeyframeEditorUtilsPrismFn(props) {
22
- const { index, aggregateKeyframes, selection } = props;
23
- const { projectId, sheetId } = props.viewModel.type === 'sheet'
24
- ? props.viewModel.sheet.address
25
- : props.viewModel.sheetObject.address;
26
- return () => {
27
- const cur = aggregateKeyframes[index];
28
- const next = aggregateKeyframes[index + 1];
29
- const curAndNextAggregateKeyframesMatch = next &&
30
- cur.keyframes.length === next.keyframes.length &&
31
- cur.keyframes.every(({ track }, ind) => next.keyframes[ind].track === track);
32
- const connected = curAndNextAggregateKeyframesMatch
33
- ? {
34
- length: next.position - cur.position,
35
- selected: cur.selected === AggregateKeyframePositionIsSelected.AllSelected &&
36
- next.selected === AggregateKeyframePositionIsSelected.AllSelected,
37
- }
38
- : null;
39
- const aggregatedConnections = !connected
40
- ? []
41
- : cur.keyframes.map(({ kf, track }, i) => ({
42
- ...track.sheetObject.address,
43
- trackId: track.id,
44
- left: kf,
45
- right: next.keyframes[i].kf,
46
- }));
47
- const allConnections = iif(() => {
48
- const selectedConnections = prism
49
- .memo('selectedConnections', () => selectedKeyframeConnections(projectId, sheetId, selection), [projectId, sheetId, selection])
50
- .getValue();
51
- return [...aggregatedConnections, ...selectedConnections];
52
- });
53
- const isAggregateEditingInCurvePopover = aggregatedConnections.every((con) => isConnectionEditingInCurvePopover(con));
54
- const itemKey = prism.memo('itemKey', () => {
55
- if (props.viewModel.type === 'sheet') {
56
- return createStudioSheetItemKey.forSheetAggregateKeyframe(props.viewModel.sheet, cur.position);
57
- }
58
- else if (props.viewModel.type === 'sheetObject') {
59
- return createStudioSheetItemKey.forSheetObjectAggregateKeyframe(props.viewModel.sheetObject, cur.position);
60
- }
61
- else {
62
- return createStudioSheetItemKey.forCompoundPropAggregateKeyframe(props.viewModel.sheetObject, props.viewModel.pathToProp, cur.position);
63
- }
64
- }, [props.viewModel, cur.position]);
65
- return {
66
- itemKey,
67
- cur,
68
- connected,
69
- isAggregateEditingInCurvePopover,
70
- allConnections,
71
- };
72
- };
73
- }