@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,185 +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 React from 'react';
7
- import { useMemo, useRef } from 'react';
8
- import usePopover from '@tomorrowevening/theatre-studio/uiComponents/Popover/usePopover';
9
- import BasicPopover from '@tomorrowevening/theatre-studio/uiComponents/Popover/BasicPopover';
10
- import CurveEditorPopover, { isConnectionEditingInCurvePopover, } from './CurveEditorPopover/CurveEditorPopover';
11
- import { ConnectorLine } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/Right/keyframeRowUI/ConnectorLine';
12
- import { COLOR_POPOVER_BACK } from './CurveEditorPopover/colors';
13
- import { usePrism } from '@tomorrowevening/theatre-react';
14
- import { copyableKeyframesFromSelection } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/selections';
15
- import { selectedKeyframeConnections } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/selections';
16
- import styled from 'styled-components';
17
- const POPOVER_MARGIN = 5;
18
- const EasingPopover = styled(BasicPopover) `
19
- --popover-outer-stroke: transparent;
20
- --popover-inner-stroke: ${COLOR_POPOVER_BACK};
21
- `;
22
- const BasicKeyframeConnector = (props) => {
23
- const { index, track } = props;
24
- const cur = track.data.keyframes[index];
25
- const next = track.data.keyframes[index + 1];
26
- const [nodeRef, node] = useRefAndState(null);
27
- const { node: popoverNode, toggle: togglePopover, close: closePopover, } = usePopover(() => {
28
- const rightDims = val(props.layoutP.rightDims);
29
- return {
30
- debugName: 'Connector',
31
- constraints: {
32
- minX: rightDims.screenX + POPOVER_MARGIN,
33
- maxX: rightDims.screenX + rightDims.width - POPOVER_MARGIN,
34
- },
35
- };
36
- }, () => React.createElement(SingleCurveEditorPopover, { ...props, closePopover: closePopover }));
37
- const [contextMenu] = useConnectorContextMenu(props, node, cur, next);
38
- useDragKeyframe(node, props);
39
- const connectorLengthInUnitSpace = next.position - cur.position;
40
- const isInCurveEditorPopoverSelection = usePrism(() => isConnectionEditingInCurvePopover({
41
- ...props.leaf.sheetObject.address,
42
- trackId: props.leaf.trackId,
43
- left: cur,
44
- right: next,
45
- }), [props.leaf.sheetObject.address, props.leaf.trackId, cur, next]);
46
- const themeValues = {
47
- isPopoverOpen: isInCurveEditorPopoverSelection,
48
- isSelected: props.selection !== undefined,
49
- };
50
- return (React.createElement(React.Fragment, null,
51
- React.createElement(ConnectorLine, { ref: nodeRef, connectorLengthInUnitSpace: connectorLengthInUnitSpace, ...themeValues, openPopover: (e) => {
52
- if (node)
53
- togglePopover(e, node);
54
- } }, popoverNode),
55
- contextMenu));
56
- };
57
- export default BasicKeyframeConnector;
58
- const SingleCurveEditorPopover = React.forwardRef((props, ref) => {
59
- const { index, track: { data: trackData }, selection, } = props;
60
- const cur = trackData.keyframes[index];
61
- const next = trackData.keyframes[index + 1];
62
- const trackId = props.leaf.trackId;
63
- const address = props.leaf.sheetObject.address;
64
- const selectedConnections = usePrism(() => selectedKeyframeConnections(address.projectId, address.sheetId, selection).getValue(), [address, selection]);
65
- const curveConnection = {
66
- left: cur,
67
- right: next,
68
- trackId,
69
- ...address,
70
- };
71
- return (React.createElement(EasingPopover, { showPopoverEdgeTriangle: false,
72
- // @ts-ignore @todo
73
- ref: ref },
74
- React.createElement(CurveEditorPopover, { curveConnection: curveConnection, additionalConnections: selectedConnections, onRequestClose: props.closePopover })));
75
- });
76
- function useDragKeyframe(node, props) {
77
- const propsRef = useRef(props);
78
- propsRef.current = props;
79
- const gestureHandlers = useMemo(() => {
80
- return {
81
- debugName: 'useDragKeyframe',
82
- lockCSSCursorTo: 'ew-resize',
83
- onDragStart(event) {
84
- const props = propsRef.current;
85
- let tempTransaction;
86
- if (props.selection) {
87
- const { selection, leaf } = props;
88
- const { sheetObject } = leaf;
89
- return selection
90
- .getDragHandlers({
91
- ...sheetObject.address,
92
- domNode: node,
93
- positionAtStartOfDrag: props.track.data.keyframes[props.index].position,
94
- })
95
- .onDragStart(event);
96
- }
97
- const propsAtStartOfDrag = props;
98
- const sequence = val(propsAtStartOfDrag.layoutP.sheet).getSequence();
99
- const toUnitSpace = val(propsAtStartOfDrag.layoutP.scaledSpace.toUnitSpace);
100
- return {
101
- onDrag(dx, dy, event) {
102
- const delta = toUnitSpace(dx);
103
- if (tempTransaction) {
104
- tempTransaction.discard();
105
- tempTransaction = undefined;
106
- }
107
- tempTransaction = getStudio().tempTransaction(({ stateEditors }) => {
108
- stateEditors.coreByProject.historic.sheetsById.sequence.transformKeyframes({
109
- ...propsAtStartOfDrag.leaf.sheetObject.address,
110
- trackId: propsAtStartOfDrag.leaf.trackId,
111
- keyframeIds: [
112
- propsAtStartOfDrag.keyframe.id,
113
- propsAtStartOfDrag.track.data.keyframes[propsAtStartOfDrag.index + 1].id,
114
- ],
115
- translate: delta,
116
- scale: 1,
117
- origin: 0,
118
- snappingFunction: sequence.closestGridPosition,
119
- });
120
- });
121
- },
122
- onDragEnd(dragHappened) {
123
- if (dragHappened) {
124
- if (tempTransaction) {
125
- tempTransaction.commit();
126
- }
127
- }
128
- else {
129
- if (tempTransaction) {
130
- tempTransaction.discard();
131
- }
132
- }
133
- },
134
- };
135
- },
136
- };
137
- }, []);
138
- useDrag(node, gestureHandlers);
139
- }
140
- function useConnectorContextMenu(props, node, cur, next) {
141
- // TODO?: props.selection is undefined if only one of the connected keyframes is selected
142
- return useContextMenu(node, {
143
- displayName: 'Tween',
144
- menuItems: () => {
145
- const copyableKeyframes = copyableKeyframesFromSelection(props.leaf.sheetObject.address.projectId, props.leaf.sheetObject.address.sheetId, props.selection);
146
- return [
147
- {
148
- label: copyableKeyframes.length > 0 ? 'Copy (selection)' : 'Copy',
149
- callback: () => {
150
- if (copyableKeyframes.length > 0) {
151
- getStudio().transaction((api) => {
152
- api.stateEditors.studio.ahistoric.setClipboardKeyframes(copyableKeyframes);
153
- });
154
- }
155
- else {
156
- getStudio().transaction((api) => {
157
- api.stateEditors.studio.ahistoric.setClipboardKeyframes([
158
- { keyframe: cur, pathToProp: props.leaf.pathToProp },
159
- { keyframe: next, pathToProp: props.leaf.pathToProp },
160
- ]);
161
- });
162
- }
163
- },
164
- },
165
- {
166
- label: props.selection ? 'Delete (selection)' : 'Delete',
167
- callback: () => {
168
- if (props.selection) {
169
- props.selection.delete();
170
- }
171
- else {
172
- getStudio().transaction(({ stateEditors }) => {
173
- stateEditors.coreByProject.historic.sheetsById.sequence.deleteKeyframes({
174
- ...props.leaf.sheetObject.address,
175
- keyframeIds: [cur.id, next.id],
176
- trackId: props.leaf.trackId,
177
- });
178
- });
179
- }
180
- },
181
- },
182
- ];
183
- },
184
- });
185
- }
@@ -1,397 +0,0 @@
1
- import { Atom, prism } from '@tomorrowevening/theatre-dataverse';
2
- import React, { useEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
3
- import styled from 'styled-components';
4
- import fuzzy from 'fuzzy';
5
- import getStudio from '@tomorrowevening/theatre-studio/getStudio';
6
- import CurveSegmentEditor from './CurveSegmentEditor';
7
- import EasingOption from './EasingOption';
8
- import { cssCubicBezierArgsFromHandles, handlesFromCssCubicBezierArgs, EASING_PRESETS, areEasingsSimilar, } from './shared';
9
- import { COLOR_BASE, COLOR_POPOVER_BACK } from './colors';
10
- import useRefAndState from '@tomorrowevening/theatre-studio/utils/useRefAndState';
11
- import { useUIOptionGrid, Outcome } from './useUIOptionGrid';
12
- const PRESET_COLUMNS = 3;
13
- const PRESET_SIZE = 53;
14
- const APPROX_TOOLTIP_HEIGHT = 25;
15
- const Grid = styled.div `
16
- background: ${COLOR_POPOVER_BACK};
17
- display: grid;
18
- grid-template-areas:
19
- 'search tween'
20
- 'presets tween';
21
- grid-template-rows: 32px 1fr;
22
- grid-template-columns: ${PRESET_COLUMNS * PRESET_SIZE}px 120px;
23
- gap: 1px;
24
- height: 120px;
25
- `;
26
- const OptionsContainer = styled.div `
27
- overflow: auto;
28
- grid-area: presets;
29
-
30
- display: grid;
31
- grid-template-columns: repeat(${PRESET_COLUMNS}, 1fr);
32
- grid-auto-rows: min-content;
33
- gap: 1px;
34
-
35
- overflow-y: scroll;
36
- scrollbar-width: none; /* Firefox */
37
- -ms-overflow-style: none; /* Internet Explorer 10+ */
38
- &::-webkit-scrollbar {
39
- /* WebKit */
40
- width: 0;
41
- height: 0;
42
- }
43
- `;
44
- const SearchBox = styled.input.attrs({ type: 'text' }) `
45
- background-color: ${COLOR_BASE};
46
- border: none;
47
- border-radius: 2px;
48
- color: rgba(255, 255, 255, 0.8);
49
- padding: 6px;
50
- font-size: 12px;
51
- outline: none;
52
- cursor: text;
53
- text-align: left;
54
- width: 100%;
55
- height: 100%;
56
- box-sizing: border-box;
57
-
58
- grid-area: search;
59
-
60
- &:hover {
61
- background-color: #212121;
62
- }
63
-
64
- &:focus {
65
- background-color: rgba(16, 16, 16, 0.26);
66
- outline: 1px solid rgba(0, 0, 0, 0.35);
67
- }
68
- `;
69
- const CurveEditorContainer = styled.div `
70
- grid-area: tween;
71
- background: ${COLOR_BASE};
72
- `;
73
- const NoResultsFoundContainer = styled.div `
74
- grid-column: 1 / 4;
75
- padding: 6px;
76
- color: #888888;
77
- `;
78
- /**
79
- * Tracking for what kinds of events are allowed to change the input's value.
80
- */
81
- var TextInputMode;
82
- (function (TextInputMode) {
83
- /**
84
- * Initial mode, don't try to override the value.
85
- */
86
- TextInputMode[TextInputMode["init"] = 0] = "init";
87
- /**
88
- * In `user` mode, the text input field does not update when the curve
89
- * changes so that the user's search is preserved.
90
- */
91
- TextInputMode[TextInputMode["user"] = 1] = "user";
92
- /**
93
- * In `auto` mode, the text input field is continually updated to
94
- * a CSS cubic bezier args string to reflect the state of the curve.
95
- */
96
- TextInputMode[TextInputMode["auto"] = 2] = "auto";
97
- TextInputMode[TextInputMode["multipleValues"] = 3] = "multipleValues";
98
- })(TextInputMode || (TextInputMode = {}));
99
- const CurveEditorPopover = (props) => {
100
- const allConnections = useMemo(() => [props.curveConnection, ...props.additionalConnections], [props.curveConnection, ...props.additionalConnections]);
101
- ////// `tempTransaction` //////
102
- /*
103
- * `tempTransaction` is used for all edits in this popover. The transaction
104
- * is discared if the user presses escape, otherwise it is committed when the
105
- * popover closes.
106
- */
107
- const tempTransaction = useRef(null);
108
- useEffect(() => {
109
- const unlock = getLock(allConnections);
110
- // Clean-up function, called when this React component unmounts.
111
- // When it unmounts, we want to commit edits that are outstanding
112
- return () => {
113
- unlock();
114
- tempTransaction.current?.commit();
115
- };
116
- }, [tempTransaction]);
117
- ////// Keyframe and trackdata //////
118
- const easing = [
119
- props.curveConnection.left.handles[2],
120
- props.curveConnection.left.handles[3],
121
- props.curveConnection.right.handles[0],
122
- props.curveConnection.right.handles[1],
123
- ];
124
- ////// Text input data and reactivity //////
125
- const inputRef = useRef(null);
126
- // Select the easing string on popover open for quick copy&paste
127
- useLayoutEffect(() => {
128
- inputRef.current?.select();
129
- inputRef.current?.focus();
130
- }, [inputRef.current]);
131
- const [inputValue, setInputValue] = useState(cssCubicBezierArgsFromHandles(easing));
132
- const onInputChange = (e) => {
133
- if (e === undefined)
134
- return;
135
- setTextInputMode(TextInputMode.user);
136
- setInputValue(e.target.value);
137
- const maybeHandles = handlesFromCssCubicBezierArgs(e.target.value);
138
- if (maybeHandles)
139
- setEdit(e.target.value);
140
- };
141
- const onSearchKeyDown = (e) => {
142
- setTextInputMode(TextInputMode.user);
143
- // Prevent scrolling on arrow key press
144
- if (e.key === 'ArrowDown' || e.key === 'ArrowUp')
145
- e.preventDefault();
146
- if (e.key === 'ArrowDown') {
147
- grid.focusFirstItem();
148
- optionsRef.current[displayedPresets[0].label]?.current?.focus();
149
- }
150
- else if (e.key === 'Escape') {
151
- discardTempValue(tempTransaction);
152
- props.onRequestClose('key Escape');
153
- }
154
- else if (e.key === 'Enter') {
155
- props.onRequestClose('key Enter');
156
- }
157
- };
158
- const [textInputMode, setTextInputMode] = useState(TextInputMode.init);
159
- useEffect(() => {
160
- if (textInputMode === TextInputMode.auto) {
161
- setInputValue(cssCubicBezierArgsFromHandles(easing));
162
- }
163
- else if (textInputMode === TextInputMode.multipleValues) {
164
- if (inputValue !== '')
165
- setInputValue('');
166
- }
167
- }, allConnections);
168
- // `edit` keeps track of the current edited state of the curve.
169
- const [edit, setEdit] = useState(cssCubicBezierArgsFromHandles(easing));
170
- // `preview` is used when hovering over a curve to preview it.
171
- const [preview, setPreview] = useState(null);
172
- // When `preview` or `edit` change, use the `tempTransaction` to change the
173
- // curve in Theate's data.
174
- useEffect(() => {
175
- if (textInputMode !== TextInputMode.init &&
176
- textInputMode !== TextInputMode.multipleValues)
177
- setTempValue(tempTransaction, allConnections, preview ?? edit ?? '');
178
- }, [preview, edit, textInputMode]);
179
- ////// selection stuff //////
180
- if (allConnections.some(areConnectedKeyframesTheSameAs(props.curveConnection)) &&
181
- textInputMode === TextInputMode.init) {
182
- setTextInputMode(TextInputMode.multipleValues);
183
- }
184
- ////// Curve editing reactivity //////
185
- const onCurveChange = (newHandles) => {
186
- setTextInputMode(TextInputMode.auto);
187
- const value = cssCubicBezierArgsFromHandles(newHandles);
188
- setInputValue(value);
189
- setEdit(value);
190
- // ensure that the text input is selected when curve is changing.
191
- inputRef.current?.select();
192
- inputRef.current?.focus();
193
- };
194
- const onCancelCurveChange = () => { };
195
- ////// Preset reactivity //////
196
- const displayedPresets = useMemo(() => {
197
- const isInputValueAQuery = /^[A-Za-z]/.test(inputValue);
198
- if (isInputValueAQuery) {
199
- return fuzzy
200
- .filter(inputValue, EASING_PRESETS, {
201
- extract: (el) => el.label,
202
- })
203
- .map((result) => result.original);
204
- }
205
- else {
206
- return EASING_PRESETS;
207
- }
208
- }, [inputValue]);
209
- // Use the first preset in the search when the displayed presets change
210
- useEffect(() => {
211
- if (textInputMode === TextInputMode.user && displayedPresets[0])
212
- setEdit(displayedPresets[0].value);
213
- }, [displayedPresets]);
214
- ////// Option grid specification and reactivity //////
215
- const onEasingOptionKeydown = (e) => {
216
- if (e.key === 'Escape') {
217
- discardTempValue(tempTransaction);
218
- props.onRequestClose('key Escape');
219
- e.stopPropagation();
220
- }
221
- else if (e.key === 'Enter') {
222
- props.onRequestClose('key Enter');
223
- e.stopPropagation();
224
- }
225
- };
226
- const onEasingOptionMouseOver = (item) => {
227
- // Set the `textInputMode` to `auto` if it was `init` before
228
- // to enable the easing previews
229
- if (textInputMode === TextInputMode.init)
230
- setTextInputMode(TextInputMode.auto);
231
- setPreview(item.value);
232
- };
233
- const onEasingOptionMouseOut = () => setPreview(null);
234
- const onSelectEasingOption = (item) => {
235
- setTempValue(tempTransaction, allConnections, item.value);
236
- props.onRequestClose('selected easing option');
237
- return Outcome.Handled;
238
- };
239
- // A map to store all html elements corresponding to easing options
240
- const optionsRef = useRef(EASING_PRESETS.reduce((acc, curr) => {
241
- acc[curr.label] = { current: null };
242
- return acc;
243
- }, {}));
244
- const [optionsContainerRef, optionsContainer] = useRefAndState(null);
245
- // Keep track of option container scroll position
246
- const [optionsScrollPosition, setOptionsScrollPosition] = useState(0);
247
- useEffect(() => {
248
- const listener = () => {
249
- setOptionsScrollPosition(optionsContainer?.scrollTop ?? 0);
250
- };
251
- optionsContainer?.addEventListener('scroll', listener);
252
- return () => optionsContainer?.removeEventListener('scroll', listener);
253
- }, [optionsContainer]);
254
- const grid = useUIOptionGrid({
255
- items: displayedPresets,
256
- uiColumns: 3,
257
- onSelectItem: onSelectEasingOption,
258
- canVerticleExit(exitSide) {
259
- if (exitSide === 'top') {
260
- inputRef.current?.select();
261
- inputRef.current?.focus();
262
- return Outcome.Handled;
263
- }
264
- return Outcome.Passthrough;
265
- },
266
- renderItem: ({ item: preset, select }) => (React.createElement(EasingOption, { key: preset.label, easing: preset, tabIndex: 0, onKeyDown: onEasingOptionKeydown, ref: optionsRef.current[preset.label], onMouseOver: () => onEasingOptionMouseOver(preset), onMouseOut: onEasingOptionMouseOut, onClick: select, tooltipPlacement: (optionsRef.current[preset.label].current?.offsetTop ?? 0) -
267
- (optionsScrollPosition ?? 0) <
268
- PRESET_SIZE + APPROX_TOOLTIP_HEIGHT
269
- ? 'bottom'
270
- : 'top', isSelected: areEasingsSimilar(easing, handlesFromCssCubicBezierArgs(preset.value)) })),
271
- });
272
- // When the user navigates highlight between presets, focus the preset el and set the
273
- // easing data to match the highlighted preset
274
- useLayoutEffect(() => {
275
- if (grid.currentSelection !== null &&
276
- document.activeElement !== inputRef.current // prevents taking focus away from input
277
- ) {
278
- const maybePresetEl = optionsRef.current?.[grid.currentSelection.label]?.current;
279
- maybePresetEl?.focus();
280
- setEdit(grid.currentSelection.value);
281
- const isInputValueAQuery = /^[A-Za-z]/.test(inputValue);
282
- if (!isInputValueAQuery) {
283
- setInputValue(grid.currentSelection.value);
284
- }
285
- }
286
- }, [grid.currentSelection]);
287
- return (React.createElement(Grid, null,
288
- React.createElement(SearchBox, { value: inputValue, placeholder: textInputMode === TextInputMode.multipleValues
289
- ? 'Multiple easings selected'
290
- : 'Search presets...', onPaste: setTimeoutFunction(onInputChange), onChange: onInputChange, ref: inputRef, onKeyDown: onSearchKeyDown }),
291
- React.createElement(OptionsContainer, { ref: optionsContainerRef, onKeyDown: (evt) => grid.onParentEltKeyDown(evt) },
292
- grid.gridItems,
293
- grid.gridItems.length === 0 ? (React.createElement(NoResultsFoundContainer, null, "No results found")) : undefined),
294
- React.createElement(CurveEditorContainer, { onClick: () => inputRef.current?.focus() },
295
- React.createElement(CurveSegmentEditor, { curveConnection: props.curveConnection, backgroundConnections: props.additionalConnections, onCurveChange: onCurveChange, onCancelCurveChange: onCancelCurveChange }))));
296
- };
297
- export default CurveEditorPopover;
298
- function setTempValue(tempTransaction, keyframeConnections, newCurveCssCubicBezier) {
299
- tempTransaction.current?.discard();
300
- tempTransaction.current = null;
301
- const handles = handlesFromCssCubicBezierArgs(newCurveCssCubicBezier);
302
- if (handles === null) {
303
- tempTransaction.current = transactionSetHold(keyframeConnections);
304
- }
305
- else {
306
- tempTransaction.current = transactionSetCubicBezier(keyframeConnections, handles);
307
- }
308
- }
309
- function discardTempValue(tempTransaction) {
310
- tempTransaction.current?.discard();
311
- tempTransaction.current = null;
312
- }
313
- function transactionSetCubicBezier(keyframeConnections, handles) {
314
- return getStudio().tempTransaction(({ stateEditors }) => {
315
- const { setHandlesForKeyframe, setKeyframeType: setKeyframeType } = stateEditors.coreByProject.historic.sheetsById.sequence;
316
- for (const { projectId, sheetId, objectKey, trackId, left, right, } of keyframeConnections) {
317
- setHandlesForKeyframe({
318
- projectId,
319
- sheetId,
320
- objectKey,
321
- trackId,
322
- keyframeId: left.id,
323
- start: [handles[0], handles[1]],
324
- });
325
- setHandlesForKeyframe({
326
- projectId,
327
- sheetId,
328
- objectKey,
329
- trackId,
330
- keyframeId: right.id,
331
- end: [handles[2], handles[3]],
332
- });
333
- setKeyframeType({
334
- projectId,
335
- sheetId,
336
- objectKey,
337
- trackId,
338
- keyframeId: left.id,
339
- keyframeType: 'bezier',
340
- });
341
- }
342
- });
343
- }
344
- function transactionSetHold(keyframeConnections) {
345
- return getStudio().tempTransaction(({ stateEditors }) => {
346
- const { setKeyframeType: setKeyframeType } = stateEditors.coreByProject.historic.sheetsById.sequence;
347
- for (const { projectId, sheetId, objectKey, trackId, left, } of keyframeConnections) {
348
- setKeyframeType({
349
- projectId,
350
- sheetId,
351
- objectKey,
352
- trackId,
353
- keyframeId: left.id,
354
- keyframeType: 'hold',
355
- });
356
- }
357
- });
358
- }
359
- /**
360
- * n mod m without negative results e.g. `mod(-1,5) = 4` contrasted with `-1 % 5 = -1`.
361
- *
362
- * ref: https://web.archive.org/web/20090717035140if_/javascript.about.com/od/problemsolving/a/modulobug.htm
363
- */
364
- export function mod(n, m) {
365
- return ((n % m) + m) % m;
366
- }
367
- function setTimeoutFunction(f, timeout) {
368
- return () => setTimeout(f, timeout);
369
- }
370
- function areConnectedKeyframesTheSameAs({ left: left1, right: right1, }) {
371
- return ({ left: left2, right: right2 }) => left1.handles[2] !== left2.handles[2] ||
372
- left1.handles[3] !== left2.handles[3] ||
373
- right1.handles[0] !== right2.handles[0] ||
374
- right1.handles[1] !== right2.handles[1];
375
- }
376
- const { isCurveEditorOpenD, isConnectionEditingInCurvePopover, getLock } = (() => {
377
- const connectionsInCurvePopoverEdit = new Atom([]);
378
- return {
379
- getLock(connections) {
380
- connectionsInCurvePopoverEdit.set(connections);
381
- return function unlock() {
382
- connectionsInCurvePopoverEdit.set([]);
383
- };
384
- },
385
- isCurveEditorOpenD: prism(() => {
386
- return connectionsInCurvePopoverEdit.prism.getValue().length > 0;
387
- }),
388
- // must be run in a prism
389
- isConnectionEditingInCurvePopover(con) {
390
- prism.ensurePrism();
391
- return connectionsInCurvePopoverEdit.prism
392
- .getValue()
393
- .some(({ left, right }) => con.left.id === left.id && con.right.id === right.id);
394
- },
395
- };
396
- })();
397
- export { isCurveEditorOpenD, isConnectionEditingInCurvePopover };