@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,49 +0,0 @@
1
- import { memoize } from 'lodash-es';
2
- const getFactorsOfNumber = memoize((divisionsPerUnit) => {
3
- const factors = [];
4
- for (let i = 1; i <= divisionsPerUnit; i++) {
5
- if (divisionsPerUnit % i === 0) {
6
- factors.push(i);
7
- }
8
- }
9
- return factors;
10
- });
11
- /**
12
- * Calls cb() for every grid line that must be drawn.
13
- *
14
- * @remarks
15
- * For the sake of simplicity, I've named the variables as if the sequence's
16
- * length is counted in seconds, and the sub-unit is called fps
17
- * (frames per second). But the algorithm should work for any fps rate, and also
18
- * non-time-based sequences.
19
- */
20
- export default function createGrid({ clippedSpaceRange, clippedSpaceWidth, fps, gapWidth = 120, }, cb) {
21
- // If fps is 60, then frameLengthInSeconeds would be 1/60 => 0.033
22
- const frameLengthInSeconeds = 1 / fps;
23
- // how much of the timeline is visible.
24
- const clippedSpaceLengthInSeconds = clippedSpaceRange.end - clippedSpaceRange.start; // eg: if start: 1 AND end: 3 THEN length = 2
25
- // how many pixels of space does one frame take
26
- const frameWidthInScreenSpace = clippedSpaceWidth / (fps * clippedSpaceLengthInSeconds);
27
- // Number of frames that fit in the smallest cell possible.
28
- // a cell is basically the space between two grid lines
29
- const numberOfFramesFittingInMinimumCellWidth = Math.floor(gapWidth / frameWidthInScreenSpace);
30
- // Number of frames in each cell, so that lines would be drawn at full seconds
31
- const numberOfFramesPerCell =
32
- // if we can't fit a full 60 frames in a cell (or a multiple of 60 frames),
33
- numberOfFramesFittingInMinimumCellWidth < fps
34
- ? getFactorsOfNumber(fps).find(
35
- // then try fitting 30 frames, or 20, or 15, and other factors of 60
36
- (factor) => factor >= numberOfFramesFittingInMinimumCellWidth)
37
- : // otherwise, determine how many full seconds we can fit in a cell
38
- fps * Math.floor(numberOfFramesFittingInMinimumCellWidth / fps);
39
- const cellLengthInSeconds = numberOfFramesPerCell * frameLengthInSeconeds;
40
- // the number of the first cell we'll draw
41
- const startCell = Math.floor(clippedSpaceRange.start / cellLengthInSeconds);
42
- // and the last one
43
- const endCell = Math.ceil(clippedSpaceRange.end / cellLengthInSeconds);
44
- for (let cell = startCell; cell <= endCell; cell++) {
45
- const posInUnitSpace = cell * cellLengthInSeconds;
46
- const isFullSecond = posInUnitSpace % 1 === 0;
47
- cb(posInUnitSpace, isFullSecond);
48
- }
49
- }
@@ -1,189 +0,0 @@
1
- import { Atom, prism, val } from '@tomorrowevening/theatre-dataverse';
2
- import mousePositionD from '@tomorrowevening/theatre-studio/utils/mousePositionD';
3
- import { inRange, last } from 'lodash-es';
4
- import React, { createContext, useCallback, useContext, useLayoutEffect, useMemo, useRef, } from 'react';
5
- export var FrameStampPositionType;
6
- (function (FrameStampPositionType) {
7
- FrameStampPositionType[FrameStampPositionType["hidden"] = 0] = "hidden";
8
- FrameStampPositionType[FrameStampPositionType["locked"] = 1] = "locked";
9
- FrameStampPositionType[FrameStampPositionType["snapped"] = 2] = "snapped";
10
- FrameStampPositionType[FrameStampPositionType["free"] = 3] = "free";
11
- })(FrameStampPositionType || (FrameStampPositionType = {}));
12
- const context = createContext(null);
13
- let lastLockId = 0;
14
- /**
15
- * Provides snapping positions to "stamps".
16
- *
17
- * One example of a stamp includes the "Keyframe Dot" which show a `⌜⌞⌝⌟` kinda UI
18
- * around the dot when dragged over.
19
- */
20
- const FrameStampPositionProvider = ({ children, layoutP }) => {
21
- const locksAtom = useMemo(() => new Atom([]), []);
22
- const currentD = useMemo(() => prism(() => {
23
- const pointerPos = prism
24
- .memo('p', () => pointerPositionInUnitSpace(layoutP), [layoutP])
25
- .getValue();
26
- const locks = val(locksAtom.pointer);
27
- if (locks.length > 0) {
28
- return last(locks).position;
29
- }
30
- else {
31
- return pointerPos;
32
- }
33
- }), [layoutP]);
34
- const getLock = useCallback(() => {
35
- const id = lastLockId++;
36
- locksAtom.reduce((list) => [
37
- ...list,
38
- {
39
- id,
40
- position: [-1, FrameStampPositionType.hidden],
41
- },
42
- ]);
43
- const unlock = () => {
44
- locksAtom.reduce((list) => list.filter((lock) => lock.id !== id));
45
- };
46
- const set = (posInUnitSpace) => {
47
- locksAtom.reduce((list) => {
48
- const index = list.findIndex((lock) => lock.id === id);
49
- if (index === -1) {
50
- console.warn(`Lock is already freed. This is a bug.`);
51
- return list;
52
- }
53
- const newList = [...list];
54
- newList.splice(index, 1, {
55
- id,
56
- position: [
57
- posInUnitSpace,
58
- posInUnitSpace === -1
59
- ? FrameStampPositionType.hidden
60
- : FrameStampPositionType.locked,
61
- ],
62
- });
63
- return newList;
64
- });
65
- };
66
- return {
67
- set,
68
- unlock,
69
- };
70
- }, []);
71
- const value = {
72
- currentD,
73
- getLock,
74
- };
75
- return React.createElement(context.Provider, { value: value }, children);
76
- };
77
- export const useFrameStampPositionD = () => useContext(context).currentD;
78
- /** Version of {@link useLockFrameStampPosition} which allows you to directly set status of a lock. */
79
- export const useLockFrameStampPositionRef = () => {
80
- const { getLock } = useContext(context);
81
- const lockRef = useRef();
82
- useLayoutEffect(() => {
83
- return () => {
84
- lockRef.current?.unlock();
85
- };
86
- }, []);
87
- return useMemo(() => {
88
- let prevLock = undefined;
89
- return (shouldLock, posValue) => {
90
- // Do if shouldLock changed
91
- if (prevLock?.shouldLock !== shouldLock) {
92
- if (shouldLock) {
93
- lockRef.current = getLock();
94
- }
95
- else {
96
- lockRef.current?.unlock();
97
- }
98
- }
99
- // Do if position changed
100
- if (prevLock?.pos !== posValue) {
101
- if (shouldLock) {
102
- lockRef.current?.set(posValue);
103
- }
104
- }
105
- // Set arguments we are going to diff against next time
106
- prevLock = { shouldLock, pos: posValue };
107
- };
108
- }, [getLock]);
109
- };
110
- export const useLockFrameStampPosition = (shouldLock, val) => {
111
- const { getLock } = useContext(context);
112
- const lockRef = useRef();
113
- useLayoutEffect(() => {
114
- if (!shouldLock)
115
- return;
116
- lockRef.current = getLock();
117
- return () => {
118
- lockRef.current.unlock();
119
- };
120
- }, [shouldLock, getLock]);
121
- useLayoutEffect(() => {
122
- if (shouldLock) {
123
- lockRef.current.set(val);
124
- }
125
- }, [val, shouldLock]);
126
- };
127
- /**
128
- * This attribute is used so that when the cursor hovers over a keyframe,
129
- * the framestamp snaps to the position of that keyframe.
130
- *
131
- * Use as a spread in a React element.
132
- *
133
- * @example
134
- * ```tsx
135
- * <div {...includeLockFrameStampAttrs(10)}/>
136
- * ```
137
- *
138
- * @remarks
139
- * Elements that need this behavior must set a data attribute like so:
140
- * <div data-theatre-lock-framestamp-to="120.55" />
141
- * Setting this attribute to "hide" hides the stamp.
142
- *
143
- * @see lockedCursorCssVarName - CSS variable used to set the cursor on an element that
144
- * should lock the framestamp. Look for usages.
145
- * @see pointerEventsAutoInNormalMode - CSS snippet used to correctly set
146
- * `pointer-events` on an element that should lock the framestamp.
147
- *
148
- * See {@link FrameStampPositionProvider}
149
- *
150
- */
151
- export const includeLockFrameStampAttrs = (value) => ({
152
- [ATTR_LOCK_FRAMESTAMP]: value === 'hide' ? value : value.toFixed(3),
153
- });
154
- const ATTR_LOCK_FRAMESTAMP = 'data-theatre-lock-framestamp-to';
155
- const pointerPositionInUnitSpace = (layoutP) => {
156
- return prism(() => {
157
- const rightDims = val(layoutP.rightDims);
158
- const clippedSpaceToUnitSpace = val(layoutP.clippedSpace.toUnitSpace);
159
- const mousePos = val(mousePositionD);
160
- if (!mousePos)
161
- return [-1, FrameStampPositionType.hidden];
162
- for (const el of mousePos.composedPath()) {
163
- if (!(el instanceof HTMLElement || el instanceof SVGElement))
164
- break;
165
- if (el.hasAttribute(ATTR_LOCK_FRAMESTAMP)) {
166
- const val = el.getAttribute(ATTR_LOCK_FRAMESTAMP);
167
- if (typeof val !== 'string')
168
- continue;
169
- if (val === 'hide')
170
- return [-1, FrameStampPositionType.hidden];
171
- const double = parseFloat(val);
172
- if (isFinite(double) && double >= 0)
173
- return [double, FrameStampPositionType.snapped];
174
- }
175
- }
176
- const { clientX, clientY } = mousePos;
177
- const { screenX: x, screenY: y, width: rightWidth, height } = rightDims;
178
- if (inRange(clientX, x, x + rightWidth) &&
179
- inRange(clientY, y + 16 /* leaving a bit of space for the top stip here */, y + height)) {
180
- const posInRightDims = clientX - x;
181
- const posInUnitSpace = clippedSpaceToUnitSpace(posInRightDims);
182
- return [posInUnitSpace, FrameStampPositionType.free];
183
- }
184
- else {
185
- return [-1, FrameStampPositionType.hidden];
186
- }
187
- });
188
- };
189
- export default FrameStampPositionProvider;
@@ -1,91 +0,0 @@
1
- import { createStudioSheetItemKey } from '@tomorrowevening/theatre-shared/utils/ids';
2
- import React, { useMemo, useRef, useState } from 'react';
3
- import { graphEditorColors } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/GraphEditor/GraphEditor';
4
- import KeyframeEditor from './KeyframeEditor/KeyframeEditor';
5
- import { getPropConfigByPath, isPropConfigComposite, valueInProp, } from '@tomorrowevening/theatre-shared/propTypes/utils';
6
- import { useVal } from '@tomorrowevening/theatre-react';
7
- const BasicKeyframedTrack = React.memo(({ layoutP, trackData, sheetObject, trackId, color, pathToProp }) => {
8
- const propConfig = getPropConfigByPath(useVal(sheetObject.template.configPointer), pathToProp);
9
- if (isPropConfigComposite(propConfig)) {
10
- console.error(`Composite prop types cannot be keyframed`);
11
- return React.createElement(React.Fragment, null);
12
- }
13
- const [areExtremumsLocked, setAreExtremumsLocked] = useState(false);
14
- const lockExtremums = useMemo(() => {
15
- const locks = new Set();
16
- return function lockExtremums() {
17
- const shouldLock = locks.size === 0;
18
- locks.add(unlock);
19
- if (shouldLock)
20
- setAreExtremumsLocked(true);
21
- function unlock() {
22
- const wasLocked = locks.size > 0;
23
- locks.delete(unlock);
24
- if (wasLocked && locks.size === 0)
25
- setAreExtremumsLocked(false);
26
- }
27
- return unlock;
28
- };
29
- }, []);
30
- const extremumSpace = useMemo(() => {
31
- const extremums = propConfig.type === 'number'
32
- ? calculateScalarExtremums(trackData.keyframes, propConfig)
33
- : calculateNonScalarExtremums(trackData.keyframes);
34
- const fromValueSpace = (val) => (val - extremums[0]) / (extremums[1] - extremums[0]);
35
- const toValueSpace = (ex) => extremums[0] + deltaToValueSpace(ex);
36
- const deltaToValueSpace = (ex) => ex * (extremums[1] - extremums[0]);
37
- return {
38
- fromValueSpace,
39
- toValueSpace,
40
- deltaToValueSpace,
41
- lock: lockExtremums,
42
- };
43
- }, [trackData.keyframes]);
44
- const cachedExtremumSpace = useRef(undefined);
45
- if (!areExtremumsLocked) {
46
- cachedExtremumSpace.current = extremumSpace;
47
- }
48
- const keyframeEditors = trackData.keyframes.map((kf, index) => (React.createElement(KeyframeEditor, { pathToProp: pathToProp, propConfig: propConfig, itemKey: createStudioSheetItemKey.forTrackKeyframe(sheetObject, trackId, kf.id), keyframe: kf, index: index, trackData: trackData, layoutP: layoutP, sheetObject: sheetObject, trackId: trackId, isScalar: propConfig.type === 'number', key: kf.id, extremumSpace: cachedExtremumSpace.current, color: color })));
49
- return (React.createElement("g", { style: {
50
- // @ts-ignore
51
- '--main-color': graphEditorColors[color].iconColor,
52
- } }, keyframeEditors));
53
- });
54
- export default BasicKeyframedTrack;
55
- function calculateScalarExtremums(keyframes, propConfig) {
56
- let min = Infinity, max = -Infinity;
57
- function check(n) {
58
- min = Math.min(n, min);
59
- max = Math.max(n, max);
60
- }
61
- keyframes.forEach((cur, i) => {
62
- const curVal = valueInProp(cur.value, propConfig);
63
- check(curVal);
64
- if (!cur.connectedRight)
65
- return;
66
- const next = keyframes[i + 1];
67
- if (!next)
68
- return;
69
- const diff = (typeof next.value === 'number' ? next.value : 1) - curVal;
70
- check(curVal + cur.handles[3] * diff);
71
- check(curVal + next.handles[1] * diff);
72
- });
73
- return [min, max];
74
- }
75
- function calculateNonScalarExtremums(keyframes) {
76
- let min = 0, max = 1;
77
- function check(n) {
78
- min = Math.min(n, min);
79
- max = Math.max(n, max);
80
- }
81
- keyframes.forEach((cur, i) => {
82
- if (!cur.connectedRight)
83
- return;
84
- const next = keyframes[i + 1];
85
- if (!next)
86
- return;
87
- check(cur.handles[3]);
88
- check(next.handles[1]);
89
- });
90
- return [min, max];
91
- }
@@ -1,87 +0,0 @@
1
- import { valueInProp } from '@tomorrowevening/theatre-shared/propTypes/utils';
2
- import getStudio from '@tomorrowevening/theatre-studio/getStudio';
3
- import useContextMenu from '@tomorrowevening/theatre-studio/uiComponents/simpleContextMenu/useContextMenu';
4
- import useRefAndState from '@tomorrowevening/theatre-studio/utils/useRefAndState';
5
- import React from 'react';
6
- import styled from 'styled-components';
7
- const SVGPath = styled.path `
8
- stroke-width: 2;
9
- stroke: var(--main-color);
10
- fill: none;
11
- vector-effect: non-scaling-stroke;
12
- `;
13
- // for keyframe.type === 'hold'
14
- const pathForHoldType = `M 0 0 L 1 0 L 1 1`;
15
- const Curve = (props) => {
16
- const { index, trackData } = props;
17
- const cur = trackData.keyframes[index];
18
- const next = trackData.keyframes[index + 1];
19
- const connectorLengthInUnitSpace = next.position - cur.position;
20
- const [nodeRef, node] = useRefAndState(null);
21
- const [contextMenu] = useConnectorContextMenu(node, props);
22
- const curValue = props.isScalar
23
- ? valueInProp(cur.value, props.propConfig)
24
- : 0;
25
- const nextValue = props.isScalar
26
- ? valueInProp(next.value, props.propConfig)
27
- : 1;
28
- const leftYInExtremumSpace = props.extremumSpace.fromValueSpace(curValue);
29
- const rightYInExtremumSpace = props.extremumSpace.fromValueSpace(nextValue);
30
- const heightInExtremumSpace = rightYInExtremumSpace - leftYInExtremumSpace;
31
- const transform = transformBox(cur.position, leftYInExtremumSpace, connectorLengthInUnitSpace, heightInExtremumSpace);
32
- const x1 = cur.handles[2];
33
- const y1 = cur.handles[3];
34
- const x2 = next.handles[0];
35
- const y2 = next.handles[1];
36
- const pathD = `M 0 0 C ${x1} ${y1} ${x2} ${y2} 1 1`;
37
- return (React.createElement(React.Fragment, null,
38
- React.createElement(SVGPath, { ref: nodeRef, d: !cur.type || cur.type === 'bezier' ? pathD : pathForHoldType, style: {
39
- transform,
40
- } }),
41
- contextMenu));
42
- };
43
- /**
44
- * Assuming a box such that: `{x: 0, y: 0, width: 1px, height: 1px}`
45
- * and given the desired coordinates of:
46
- * `{x: xInUnitSpace, y: yInExtremumSpace, width: widthInUnitSpace, height: heightInExtremumSpace}`,
47
- * `transformBox()` returns a CSS transform that transforms the box into its right dimensions
48
- * in the GraphEditor space.
49
- */
50
- export function transformBox(xInUnitSpace, yInExtremumSpace, widthInUnitSpace, heightInExtremumSpace) {
51
- const translateX = `calc(var(--unitSpaceToScaledSpaceMultiplier) * ${xInUnitSpace}px)`;
52
- const translateY = `calc((var(--graphEditorVerticalSpace) - var(--graphEditorVerticalSpace) * ${yInExtremumSpace}) * 1px)`;
53
- if (widthInUnitSpace === 0) {
54
- widthInUnitSpace = 0.0001;
55
- }
56
- const scaleX = `calc(var(--unitSpaceToScaledSpaceMultiplier) * ${widthInUnitSpace})`;
57
- if (heightInExtremumSpace === 0) {
58
- heightInExtremumSpace = 0.001;
59
- }
60
- const scaleY = `calc(var(--graphEditorVerticalSpace) * ${heightInExtremumSpace * -1})`;
61
- return `translate(${translateX}, ${translateY}) scale(${scaleX}, ${scaleY})`;
62
- }
63
- export default Curve;
64
- function useConnectorContextMenu(node, props) {
65
- const { index, trackData } = props;
66
- const cur = trackData.keyframes[index];
67
- const next = trackData.keyframes[index + 1];
68
- return useContextMenu(node, {
69
- menuItems: () => {
70
- return [
71
- {
72
- label: 'Delete',
73
- callback: () => {
74
- getStudio().transaction(({ stateEditors }) => {
75
- const { deleteKeyframes } = stateEditors.coreByProject.historic.sheetsById.sequence;
76
- deleteKeyframes({
77
- ...props.sheetObject.address,
78
- trackId: props.trackId,
79
- keyframeIds: [cur.id, next.id],
80
- });
81
- });
82
- },
83
- },
84
- ];
85
- },
86
- });
87
- }
@@ -1,186 +0,0 @@
1
- import getStudio from '@tomorrowevening/theatre-studio/getStudio';
2
- import useContextMenu from '@tomorrowevening/theatre-studio/uiComponents/simpleContextMenu/useContextMenu';
3
- import useDrag from '@tomorrowevening/theatre-studio/uiComponents/useDrag';
4
- import useRefAndState from '@tomorrowevening/theatre-studio/utils/useRefAndState';
5
- import { val } from '@tomorrowevening/theatre-dataverse';
6
- import { clamp } from 'lodash-es';
7
- import React, { useMemo, useRef } from 'react';
8
- import styled from 'styled-components';
9
- import { transformBox } from './Curve';
10
- import { pointerEventsAutoInNormalMode } from '@tomorrowevening/theatre-studio/css';
11
- export const dotSize = 6;
12
- const Circle = styled.circle `
13
- stroke-width: 1px;
14
- vector-effect: non-scaling-stroke;
15
- fill: var(--main-color);
16
- r: 2px;
17
- pointer-events: none;
18
- `;
19
- const HitZone = styled.circle `
20
- stroke-width: 6px;
21
- vector-effect: non-scaling-stroke;
22
- r: 6px;
23
- fill: transparent;
24
- cursor: move;
25
- ${pointerEventsAutoInNormalMode};
26
- &:hover {
27
- }
28
- &:hover + ${Circle} {
29
- r: 6px;
30
- }
31
- `;
32
- const Line = styled.path `
33
- stroke-width: 1;
34
- stroke: var(--main-color);
35
- /* stroke: gray; */
36
- fill: none;
37
- vector-effect: non-scaling-stroke;
38
- `;
39
- const CurveHandle = (props) => {
40
- const [ref, node] = useRefAndState(null);
41
- const { index, trackData } = props;
42
- const cur = trackData.keyframes[index];
43
- const next = trackData.keyframes[index + 1];
44
- const [contextMenu] = useOurContextMenu(node, props);
45
- useOurDrags(node, props);
46
- const posInDiffSpace = props.which === 'left' ? cur.handles[2] : next.handles[0];
47
- const posInUnitSpace = cur.position + (next.position - cur.position) * posInDiffSpace;
48
- const valInDiffSpace = props.which === 'left' ? cur.handles[3] : next.handles[1];
49
- const curValue = props.isScalar ? cur.value : 0;
50
- const nextValue = props.isScalar ? next.value : 1;
51
- const value = curValue + (nextValue - curValue) * valInDiffSpace;
52
- const valInExtremumSpace = props.extremumSpace.fromValueSpace(value);
53
- const heightInExtremumSpace = valInExtremumSpace -
54
- props.extremumSpace.fromValueSpace(props.which === 'left' ? curValue : nextValue);
55
- const lineTransform = transformBox(props.which === 'left' ? cur.position : next.position, props.extremumSpace.fromValueSpace(props.which === 'left' ? curValue : nextValue), posInUnitSpace - (props.which === 'left' ? cur.position : next.position), heightInExtremumSpace);
56
- return (React.createElement("g", null,
57
- React.createElement(HitZone, { ref: ref, style: {
58
- // @ts-ignore
59
- cx: `calc(var(--unitSpaceToScaledSpaceMultiplier) * ${posInUnitSpace} * 1px)`,
60
- cy: `calc((var(--graphEditorVerticalSpace) - var(--graphEditorVerticalSpace) * ${valInExtremumSpace}) * 1px)`,
61
- } }),
62
- React.createElement(Circle, { style: {
63
- // @ts-ignore
64
- cx: `calc(var(--unitSpaceToScaledSpaceMultiplier) * ${posInUnitSpace} * 1px)`,
65
- cy: `calc((var(--graphEditorVerticalSpace) - var(--graphEditorVerticalSpace) * ${valInExtremumSpace}) * 1px)`,
66
- } }),
67
- React.createElement(Line, { d: "M 0 0 L 1 1", style: {
68
- transform: lineTransform,
69
- } }),
70
- contextMenu));
71
- };
72
- export default CurveHandle;
73
- function useOurDrags(node, props) {
74
- const propsRef = useRef(props);
75
- propsRef.current = props;
76
- const handlers = useMemo(() => {
77
- return {
78
- debugName: 'CurveHandler/useOurDrags',
79
- lockCSSCursorTo: 'move',
80
- onDragStart() {
81
- let tempTransaction;
82
- const propsAtStartOfDrag = propsRef.current;
83
- const scaledToUnitSpace = val(propsAtStartOfDrag.layoutP.scaledSpace.toUnitSpace);
84
- const verticalToExtremumSpace = val(propsAtStartOfDrag.layoutP.graphEditorVerticalSpace.toExtremumSpace);
85
- const unlockExtremums = propsAtStartOfDrag.extremumSpace.lock();
86
- return {
87
- onDrag(dxInScaledSpace, dy) {
88
- if (tempTransaction) {
89
- tempTransaction.discard();
90
- tempTransaction = undefined;
91
- }
92
- const { index, trackData } = propsAtStartOfDrag;
93
- const cur = trackData.keyframes[index];
94
- const next = trackData.keyframes[index + 1];
95
- const dPosInUnitSpace = scaledToUnitSpace(dxInScaledSpace);
96
- let dPosInKeyframeDiffSpace = dPosInUnitSpace / (next.position - cur.position);
97
- const dyInVerticalSpace = -dy;
98
- const dYInExtremumSpace = verticalToExtremumSpace(dyInVerticalSpace);
99
- const dYInValueSpace = propsAtStartOfDrag.extremumSpace.deltaToValueSpace(dYInExtremumSpace);
100
- const curValue = props.isScalar ? cur.value : 0;
101
- const nextValue = props.isScalar ? next.value : 1;
102
- const dyInKeyframeDiffSpace = dYInValueSpace / (nextValue - curValue);
103
- if (propsAtStartOfDrag.which === 'left') {
104
- const handleX = clamp(cur.handles[2] + dPosInKeyframeDiffSpace, 0, 1);
105
- const handleY = cur.handles[3] + dyInKeyframeDiffSpace;
106
- tempTransaction = getStudio().tempTransaction(({ stateEditors }) => {
107
- stateEditors.coreByProject.historic.sheetsById.sequence.replaceKeyframes({
108
- ...propsAtStartOfDrag.sheetObject.address,
109
- snappingFunction: val(propsAtStartOfDrag.layoutP.sheet).getSequence().closestGridPosition,
110
- trackId: propsAtStartOfDrag.trackId,
111
- keyframes: [
112
- {
113
- ...cur,
114
- handles: [
115
- cur.handles[0],
116
- cur.handles[1],
117
- handleX,
118
- handleY,
119
- ],
120
- },
121
- ],
122
- });
123
- });
124
- }
125
- else {
126
- const handleX = clamp(next.handles[0] + dPosInKeyframeDiffSpace, 0, 1);
127
- const handleY = next.handles[1] + dyInKeyframeDiffSpace;
128
- tempTransaction = getStudio().tempTransaction(({ stateEditors }) => {
129
- stateEditors.coreByProject.historic.sheetsById.sequence.replaceKeyframes({
130
- ...propsAtStartOfDrag.sheetObject.address,
131
- trackId: propsAtStartOfDrag.trackId,
132
- snappingFunction: val(propsAtStartOfDrag.layoutP.sheet).getSequence().closestGridPosition,
133
- keyframes: [
134
- {
135
- ...next,
136
- handles: [
137
- handleX,
138
- handleY,
139
- next.handles[2],
140
- next.handles[3],
141
- ],
142
- },
143
- ],
144
- });
145
- });
146
- }
147
- },
148
- onDragEnd(dragHappened) {
149
- unlockExtremums();
150
- if (dragHappened) {
151
- if (tempTransaction) {
152
- tempTransaction.commit();
153
- }
154
- }
155
- else {
156
- if (tempTransaction) {
157
- tempTransaction.discard();
158
- }
159
- }
160
- },
161
- };
162
- },
163
- };
164
- }, []);
165
- useDrag(node, handlers);
166
- }
167
- function useOurContextMenu(node, props) {
168
- return useContextMenu(node, {
169
- menuItems: () => {
170
- return [
171
- {
172
- label: 'Delete',
173
- callback: () => {
174
- getStudio().transaction(({ stateEditors }) => {
175
- stateEditors.coreByProject.historic.sheetsById.sequence.deleteKeyframes({
176
- ...props.sheetObject.address,
177
- keyframeIds: [props.keyframe.id],
178
- trackId: props.trackId,
179
- });
180
- });
181
- },
182
- },
183
- ];
184
- },
185
- });
186
- }