@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,181 +0,0 @@
1
- import { prism, val } from '@tomorrowevening/theatre-dataverse';
2
- import { usePrism } from '@tomorrowevening/theatre-react';
3
- import getStudio from '@tomorrowevening/theatre-studio/getStudio';
4
- import { panelDimsToPanelPosition, usePanel, } from '@tomorrowevening/theatre-studio/panels/BasePanel/BasePanel';
5
- import { topStripHeight } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/RightOverlay/TopStrip';
6
- import { useCssCursorLock } from '@tomorrowevening/theatre-studio/uiComponents/PointerEventsHandler';
7
- import useDrag from '@tomorrowevening/theatre-studio/uiComponents/useDrag';
8
- import useHoverWithoutDescendants from '@tomorrowevening/theatre-studio/uiComponents/useHoverWithoutDescendants';
9
- import useKeyDown from '@tomorrowevening/theatre-studio/uiComponents/useKeyDown';
10
- import useRefAndState from '@tomorrowevening/theatre-studio/utils/useRefAndState';
11
- import { clamp } from 'lodash-es';
12
- import React, { useEffect, useMemo, useRef, useState } from 'react';
13
- import styled from 'styled-components';
14
- import FocusRangeStrip, { focusRangeStripTheme } from './FocusRangeStrip';
15
- import FocusRangeThumb from './FocusRangeThumb';
16
- import { minVisibleSize } from '@tomorrowevening/theatre-studio/panels/BasePanel/common';
17
- const Container = styled.div `
18
- position: absolute;
19
- height: ${() => topStripHeight}px;
20
- left: 0;
21
- right: 0;
22
- box-sizing: border-box;
23
- /* Use the "grab" cursor if the shift key is up, which is the one used on the top strip of the sequence editor */
24
- cursor: ${(props) => (props.isShiftDown ? 'ew-resize' : 'move')};
25
- `;
26
- const FocusRangeZone = ({ layoutP }) => {
27
- const [containerRef, containerNode] = useRefAndState(null);
28
- const panelStuff = usePanel();
29
- const panelStuffRef = useRef(panelStuff);
30
- panelStuffRef.current = panelStuff;
31
- const existingRangeD = useMemo(() => prism(() => {
32
- const { projectId, sheetId } = val(layoutP.sheet).address;
33
- const existingRange = val(getStudio().atomP.ahistoric.projects.stateByProjectId[projectId]
34
- .stateBySheetId[sheetId].sequence.focusRange);
35
- return existingRange;
36
- }), [layoutP]);
37
- useDrag(containerNode, usePanelDragZoneGestureHandlers(layoutP, panelStuffRef));
38
- const isShiftDown = useKeyDown('Shift');
39
- const isPointerHovering = useHoverWithoutDescendants(containerNode);
40
- useEffect(() => {
41
- if (!isShiftDown && isPointerHovering) {
42
- const unlock = panelStuffRef.current.addBoundsHighlightLock();
43
- return unlock;
44
- }
45
- }, [!isShiftDown && isPointerHovering]);
46
- return usePrism(() => {
47
- return (React.createElement(Container, { ref: containerRef, isShiftDown: isShiftDown },
48
- React.createElement(FocusRangeStrip, { layoutP: layoutP }),
49
- React.createElement(FocusRangeThumb, { thumbType: "start", layoutP: layoutP }),
50
- React.createElement(FocusRangeThumb, { thumbType: "end", layoutP: layoutP })));
51
- }, [layoutP, existingRangeD, isShiftDown]);
52
- };
53
- export default FocusRangeZone;
54
- function usePanelDragZoneGestureHandlers(layoutP, panelStuffRef) {
55
- const [mode, setMode] = useState('none');
56
- useCssCursorLock(mode !== 'none', 'dragging', mode === 'creating' ? 'ew-resize' : 'move');
57
- return useMemo(() => {
58
- const focusRangeCreationGestureHandlers = () => {
59
- return {
60
- debugName: 'FocusRangeZone/focusRangeCreationGestureHandlers',
61
- onDragStart(event) {
62
- let tempTransaction;
63
- const clippedSpaceToUnitSpace = val(layoutP.clippedSpace.toUnitSpace);
64
- const scaledSpaceToUnitSpace = val(layoutP.scaledSpace.toUnitSpace);
65
- const sheet = val(layoutP.sheet);
66
- const sequence = sheet.getSequence();
67
- const targetElement = event.target;
68
- const rect = targetElement.getBoundingClientRect();
69
- const startPosInUnitSpace = clippedSpaceToUnitSpace(event.clientX - rect.left);
70
- const minFocusRangeStripWidth = scaledSpaceToUnitSpace(focusRangeStripTheme.rangeStripMinWidth);
71
- return {
72
- onDrag(dx) {
73
- const deltaPos = scaledSpaceToUnitSpace(dx);
74
- let start = startPosInUnitSpace;
75
- let end = startPosInUnitSpace + deltaPos;
76
- [start, end] = [
77
- clamp(start, 0, sequence.length),
78
- clamp(end, 0, sequence.length),
79
- ].map((pos) => sequence.closestGridPosition(pos));
80
- if (end < start) {
81
- ;
82
- [start, end] = [
83
- Math.max(Math.min(end, start - minFocusRangeStripWidth), 0),
84
- start,
85
- ];
86
- }
87
- else if (dx > 0) {
88
- end = Math.min(Math.max(end, start + minFocusRangeStripWidth), sequence.length);
89
- }
90
- if (tempTransaction) {
91
- tempTransaction.discard();
92
- }
93
- tempTransaction = getStudio().tempTransaction(({ stateEditors }) => {
94
- stateEditors.studio.ahistoric.projects.stateByProjectId.stateBySheetId.sequence.focusRange.set({
95
- ...sheet.address,
96
- range: { start, end },
97
- enabled: true,
98
- });
99
- });
100
- },
101
- onDragEnd(dragHappened) {
102
- if (dragHappened && tempTransaction !== undefined) {
103
- tempTransaction.commit();
104
- }
105
- else if (tempTransaction) {
106
- tempTransaction.discard();
107
- }
108
- },
109
- };
110
- },
111
- lockCSSCursorTo: 'ew-resize',
112
- };
113
- };
114
- const panelMoveGestureHandlers = () => {
115
- return {
116
- debugName: 'FocusRangeZone/panelMoveGestureHandlers',
117
- onDragStart() {
118
- let tempTransaction;
119
- const stuffBeforeDrag = panelStuffRef.current;
120
- const unlock = panelStuffRef.current.addBoundsHighlightLock();
121
- return {
122
- onDrag(dx, dy) {
123
- const newDims = {
124
- ...stuffBeforeDrag.dims,
125
- top: clamp(stuffBeforeDrag.dims.top + dy, 0, window.innerHeight - minVisibleSize),
126
- left: clamp(stuffBeforeDrag.dims.left + dx, -stuffBeforeDrag.dims.width + minVisibleSize, window.innerWidth - minVisibleSize),
127
- };
128
- const position = panelDimsToPanelPosition(newDims, {
129
- width: window.innerWidth,
130
- height: window.innerHeight,
131
- });
132
- tempTransaction?.discard();
133
- tempTransaction = getStudio().tempTransaction(({ stateEditors }) => {
134
- stateEditors.studio.historic.panelPositions.setPanelPosition({
135
- position,
136
- panelId: stuffBeforeDrag.panelId,
137
- });
138
- });
139
- },
140
- onDragEnd(dragHappened) {
141
- unlock();
142
- if (dragHappened) {
143
- tempTransaction?.commit();
144
- }
145
- else {
146
- tempTransaction?.discard();
147
- }
148
- },
149
- };
150
- },
151
- lockCSSCursorTo: 'move',
152
- };
153
- };
154
- return {
155
- debugName: 'FocusRangeZone',
156
- onDragStart(event) {
157
- const [_mode, currentGestureHandlers] = event.shiftKey
158
- ? [
159
- 'creating',
160
- focusRangeCreationGestureHandlers().onDragStart(event),
161
- ]
162
- : [
163
- 'moving-panel',
164
- panelMoveGestureHandlers().onDragStart(event),
165
- ];
166
- setMode(_mode);
167
- if (currentGestureHandlers === false)
168
- return false;
169
- return {
170
- onDrag(dx, dy, event, ddx, ddy) {
171
- currentGestureHandlers.onDrag(dx, dy, event, ddx, ddy);
172
- },
173
- onDragEnd(dragHappened) {
174
- setMode('none');
175
- currentGestureHandlers.onDragEnd?.(dragHappened);
176
- },
177
- };
178
- },
179
- };
180
- }, [layoutP, panelStuffRef]);
181
- }
@@ -1,65 +0,0 @@
1
- import { usePrism, useVal } from '@tomorrowevening/theatre-react';
2
- import { val } from '@tomorrowevening/theatre-dataverse';
3
- import React from 'react';
4
- import styled from 'styled-components';
5
- import { stampsGridTheme } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/FrameGrid/StampsGrid';
6
- import { zIndexes } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/SequenceEditorPanel';
7
- import { topStripTheme } from './TopStrip';
8
- import { FrameStampPositionType, useFrameStampPositionD, } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/FrameStampPositionProvider';
9
- const Container = styled.div `
10
- position: absolute;
11
- top: 0;
12
- left: 0;
13
- margin-top: 0px;
14
- `;
15
- const Label = styled.div `
16
- position: absolute;
17
- top: 16px;
18
- font-size: ${stampsGridTheme.stampFontSize};
19
- color: ${stampsGridTheme.fullUnitStampColor};
20
- text-align: center;
21
- transform: translateX(-50%);
22
- background: ${topStripTheme.backgroundColor};
23
- padding: 1px 8px;
24
- font-variant-numeric: tabular-nums;
25
- pointer-events: none;
26
- z-index: ${() => zIndexes.currentFrameStamp};
27
- `;
28
- const Line = styled.div `
29
- position: absolute;
30
- top: 5px;
31
- left: -0px;
32
- bottom: 0;
33
- width: 0.5px;
34
- background: rgba(100, 100, 100, 0.2);
35
- pointer-events: none;
36
- `;
37
- const FrameStamp = React.memo(({ layoutP }) => {
38
- const [posInUnitSpace, posType] = useVal(useFrameStampPositionD());
39
- const unitSpaceToClippedSpace = useVal(layoutP.clippedSpace.fromUnitSpace);
40
- const { sequence, formatter, clippedSpaceWidth } = usePrism(() => {
41
- const sequence = val(layoutP.sheet).getSequence();
42
- const clippedSpaceWidth = val(layoutP.clippedSpace.width);
43
- return { sequence, formatter: sequence.positionFormatter, clippedSpaceWidth };
44
- }, [layoutP]);
45
- if (posInUnitSpace == -1) {
46
- return React.createElement(React.Fragment, null);
47
- }
48
- const snappedPosInUnitSpace = posType === FrameStampPositionType.free
49
- ? sequence.closestGridPosition(posInUnitSpace)
50
- : posInUnitSpace;
51
- const posInClippedSpace = unitSpaceToClippedSpace(snappedPosInUnitSpace);
52
- const isVisible = posInClippedSpace >= 0 && posInClippedSpace <= clippedSpaceWidth;
53
- return (React.createElement(React.Fragment, null,
54
- React.createElement(Container, null,
55
- React.createElement(Label, { style: {
56
- opacity: isVisible ? 1 : 0,
57
- transform: `translate3d(calc(${posInClippedSpace}px - 50%), 0, 0)`,
58
- } }, formatter.formatForPlayhead(snappedPosInUnitSpace)),
59
- React.createElement(Line, { posType: posType, style: {
60
- opacity: isVisible ? 1 : 0,
61
- transform: `translate3d(${posInClippedSpace}px, 0, 0)`,
62
- } })),
63
- ' '));
64
- });
65
- export default FrameStamp;
@@ -1,235 +0,0 @@
1
- import { useVal } from '@tomorrowevening/theatre-react';
2
- import { prism, val } from '@tomorrowevening/theatre-dataverse';
3
- import mapValues from 'lodash-es/mapValues';
4
- import { position } from 'polished';
5
- import React, { useCallback, useMemo, useState } from 'react';
6
- import styled from 'styled-components';
7
- import { zIndexes } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/SequenceEditorPanel';
8
- import { includeLockFrameStampAttrs } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/FrameStampPositionProvider';
9
- import { pointerEventsAutoInNormalMode } from '@tomorrowevening/theatre-studio/css';
10
- import useDrag from '@tomorrowevening/theatre-studio/uiComponents/useDrag';
11
- const Container = styled.div `
12
- --threadHeight: 6px;
13
- --bg-inactive: #32353b;
14
- --bg-active: #5b5c5d;
15
- position: absolute;
16
- height: 0;
17
- width: 100%;
18
- left: 12px;
19
- /* bottom: 8px; */
20
- z-index: ${() => zIndexes.horizontalScrollbar};
21
- ${pointerEventsAutoInNormalMode}
22
- `;
23
- const TimeThread = styled.div `
24
- position: relative;
25
- top: 0;
26
- left: 0;
27
- width: 100%;
28
- height: var(--threadHeight);
29
- `;
30
- const RangeBar = styled.div `
31
- position: absolute;
32
- height: 5px;
33
- background: var(--bg-inactive);
34
- cursor: ew-resize;
35
- z-index: 2;
36
-
37
- &:hover,
38
- &:active {
39
- background: var(--bg-active);
40
- }
41
-
42
- &:after {
43
- ${position('absolute', '-4px')};
44
- display: block;
45
- content: ' ';
46
- }
47
- `;
48
- const RangeHandle = styled.div `
49
- position: absolute;
50
- height: 5px;
51
- width: 7px;
52
- left: 0;
53
- z-index: 2;
54
- top: 0;
55
- bottom: 0;
56
- display: block;
57
-
58
- &:hover:before {
59
- background: var(--bg-active);
60
- }
61
-
62
- &:before {
63
- ${position('absolute', '0')};
64
- display: block;
65
- content: ' ';
66
- background: var(--bg-inactive);
67
- border-radius: 0 2px 2px 0;
68
- }
69
-
70
- &:after {
71
- ${position('absolute', '-4px')};
72
- display: block;
73
- content: ' ';
74
- }
75
- `;
76
- const RangeStartHandle = styled(RangeHandle) `
77
- left: calc(-1 * 7px);
78
- cursor: w-resize;
79
- &:before {
80
- transform: scaleX(-1);
81
- }
82
- `;
83
- const RangeEndHandle = styled(RangeHandle) `
84
- cursor: e-resize;
85
- left: 0px;
86
- `;
87
- const Tooltip = styled.div `
88
- display: ${(props) => (props.active ? 'block' : 'none')};
89
- position: absolute;
90
- top: -20px;
91
- left: 4px;
92
- padding: 0 4px;
93
- transform: translateX(-50%);
94
- background: #131d1f;
95
- border-radius: 4px;
96
- color: #fff;
97
- font-size: 10px;
98
- line-height: 18px;
99
- text-align: center;
100
-
101
- ${RangeStartHandle}:hover &,
102
- ${RangeEndHandle}:hover &,
103
- ${RangeBar}:hover ~ ${RangeStartHandle} &,
104
- ${RangeBar}:hover ~ ${RangeEndHandle} & {
105
- display: block;
106
- }
107
- `;
108
- /**
109
- * The little scrollbar on the bottom of the Right side
110
- */
111
- const HorizontalScrollbar = ({ layoutP }) => {
112
- const unitPosToHumanReadablePos = useCallback((n) => n.toFixed(2), []);
113
- // const dd = usePrism(() => val(layoutP.sheet).getSequence().positionFormatter.formatForPlayhead, [layoutP])
114
- const relevantValuesD = useMemo(() => prism(() => {
115
- const rightWidth = val(layoutP.rightDims.width) - 25;
116
- const clippedSpaceRange = val(layoutP.clippedSpace.range);
117
- const sequenceLength = val(layoutP.sheet).getSequence().length;
118
- const assumedLengthOfSequence = Math.max(clippedSpaceRange.end, sequenceLength);
119
- const rangeStartX = (clippedSpaceRange.start / assumedLengthOfSequence) * rightWidth;
120
- const rangeEndX = (clippedSpaceRange.end / assumedLengthOfSequence) * rightWidth;
121
- return {
122
- rightWidth,
123
- clippedSpaceRange,
124
- sequenceLength,
125
- assumedLengthOfSequence,
126
- rangeStartX,
127
- rangeEndX,
128
- bottom: val(layoutP.horizontalScrollbarDims.bottom),
129
- };
130
- }), [layoutP]);
131
- const { rangeStartX, rangeEndX, clippedSpaceRange, bottom } = useVal(relevantValuesD);
132
- const [beingDragged, setBeingDragged] = useState('nothing');
133
- const handles = useMemo(() => {
134
- let valuesBeforeDrag = val(relevantValuesD);
135
- let noteValuesBeforeDrag = () => {
136
- valuesBeforeDrag = val(relevantValuesD);
137
- };
138
- const deltaXToDeltaPos = (dx) => {
139
- const asAFractionOfRightWidth = dx / valuesBeforeDrag.rightWidth;
140
- return asAFractionOfRightWidth * valuesBeforeDrag.assumedLengthOfSequence;
141
- };
142
- const self = {
143
- onRangeDragStart() {
144
- noteValuesBeforeDrag();
145
- return {
146
- onDrag(dx) {
147
- setBeingDragged('both');
148
- const deltaPosInUnitSpace = deltaXToDeltaPos(dx);
149
- const newRange = mapValues(valuesBeforeDrag.clippedSpaceRange, (p) => p + deltaPosInUnitSpace);
150
- val(layoutP.clippedSpace.setRange)(newRange);
151
- },
152
- onDragEnd() {
153
- setBeingDragged('nothing');
154
- },
155
- };
156
- },
157
- onRangeStartDragStart() {
158
- noteValuesBeforeDrag();
159
- return {
160
- onDrag(dx) {
161
- setBeingDragged('start');
162
- const deltaPosInUnitSpace = deltaXToDeltaPos(dx);
163
- const newRange = {
164
- start: valuesBeforeDrag.clippedSpaceRange.start + deltaPosInUnitSpace,
165
- end: valuesBeforeDrag.clippedSpaceRange.end,
166
- };
167
- if (newRange.start > newRange.end - 1) {
168
- newRange.start = newRange.end - 1;
169
- }
170
- if (newRange.start <= 0) {
171
- newRange.start = 0;
172
- }
173
- val(layoutP.clippedSpace.setRange)(newRange);
174
- },
175
- onDragEnd() {
176
- setBeingDragged('nothing');
177
- },
178
- };
179
- },
180
- onRangeEndDragStart() {
181
- noteValuesBeforeDrag();
182
- return {
183
- onDrag(dx) {
184
- setBeingDragged('end');
185
- const deltaPosInUnitSpace = deltaXToDeltaPos(dx);
186
- const newRange = {
187
- start: valuesBeforeDrag.clippedSpaceRange.start,
188
- end: valuesBeforeDrag.clippedSpaceRange.end + deltaPosInUnitSpace,
189
- };
190
- if (newRange.end < newRange.start + 1) {
191
- newRange.end = newRange.start + 1;
192
- }
193
- if (newRange.end >= valuesBeforeDrag.assumedLengthOfSequence) {
194
- newRange.end = valuesBeforeDrag.assumedLengthOfSequence;
195
- }
196
- val(layoutP.clippedSpace.setRange)(newRange);
197
- },
198
- onDragEnd() {
199
- setBeingDragged('nothing');
200
- },
201
- };
202
- },
203
- };
204
- return self;
205
- }, [layoutP, relevantValuesD]);
206
- const [rangeDragNode, setRangeDragNode] = useState(null);
207
- useDrag(rangeDragNode, {
208
- debugName: 'HorizontalScrollbar/onRangeDrag',
209
- onDragStart: handles.onRangeDragStart,
210
- lockCSSCursorTo: 'ew-resize',
211
- });
212
- const [rangeStartDragNode, setRangeStartDragNode] = useState(null);
213
- useDrag(rangeStartDragNode, {
214
- debugName: 'HorizontalScrollbar/onRangeStartDrag',
215
- onDragStart: handles.onRangeStartDragStart,
216
- lockCSSCursorTo: 'w-resize',
217
- });
218
- const [rangeEndDragNode, setRangeEndDragNode] = useState(null);
219
- useDrag(rangeEndDragNode, {
220
- debugName: 'HorizontalScrollbar/onRangeEndDrag',
221
- onDragStart: handles.onRangeEndDragStart,
222
- lockCSSCursorTo: 'e-resize',
223
- });
224
- return (React.createElement(Container, { style: { bottom: bottom + 8 + 'px' }, ...includeLockFrameStampAttrs('hide') },
225
- React.createElement(TimeThread, null,
226
- React.createElement(RangeBar, { ref: setRangeDragNode, style: {
227
- width: `${rangeEndX - rangeStartX}px`,
228
- transform: `translate3d(${rangeStartX}px, 0, 0)`,
229
- } }),
230
- React.createElement(RangeStartHandle, { ref: setRangeStartDragNode, style: { transform: `translate3d(${rangeStartX}px, 0, 0)` } },
231
- React.createElement(Tooltip, { active: beingDragged === 'both' || beingDragged === 'start' }, unitPosToHumanReadablePos(clippedSpaceRange.start))),
232
- React.createElement(RangeEndHandle, { ref: setRangeEndDragNode, style: { transform: `translate3d(${rangeEndX}px, 0, 0)` } },
233
- React.createElement(Tooltip, { active: beingDragged === 'both' || beingDragged === 'end' }, unitPosToHumanReadablePos(clippedSpaceRange.end))))));
234
- };
235
- export default HorizontalScrollbar;
@@ -1,184 +0,0 @@
1
- import { val } from '@tomorrowevening/theatre-dataverse';
2
- import { useVal } from '@tomorrowevening/theatre-react';
3
- import getStudio from '@tomorrowevening/theatre-studio/getStudio';
4
- import { lockedCursorCssVarName, useCssCursorLock, } from '@tomorrowevening/theatre-studio/uiComponents/PointerEventsHandler';
5
- import useContextMenu from '@tomorrowevening/theatre-studio/uiComponents/simpleContextMenu/useContextMenu';
6
- import useRefAndState from '@tomorrowevening/theatre-studio/utils/useRefAndState';
7
- import React, { useMemo, useRef } from 'react';
8
- import styled from 'styled-components';
9
- import { useLockFrameStampPosition } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/FrameStampPositionProvider';
10
- import useDrag from '@tomorrowevening/theatre-studio/uiComponents/useDrag';
11
- import { zIndexes } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/SequenceEditorPanel';
12
- import DopeSnap from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/RightOverlay/DopeSnap';
13
- import { absoluteDims } from '@tomorrowevening/theatre-studio/utils/absoluteDims';
14
- import { DopeSnapHitZoneUI } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/RightOverlay/DopeSnapHitZoneUI';
15
- import { snapToAll, snapToNone, } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/Right/KeyframeSnapTarget';
16
- import usePopover from '@tomorrowevening/theatre-studio/uiComponents/Popover/usePopover';
17
- import BasicPopover from '@tomorrowevening/theatre-studio/uiComponents/Popover/BasicPopover';
18
- import MarkerEditorPopover from './MarkerEditorPopover';
19
- const MARKER_SIZE_W_PX = 12;
20
- const MARKER_SIZE_H_PX = 12;
21
- const MARKER_HOVER_SIZE_W_PX = MARKER_SIZE_W_PX * 2;
22
- const MARKER_HOVER_SIZE_H_PX = MARKER_SIZE_H_PX * 2;
23
- const MarkerDotContainer = styled.div `
24
- position: absolute;
25
- // below the sequence ruler "top bar"
26
- top: 18px;
27
- z-index: ${() => zIndexes.marker};
28
- `;
29
- const MarkerVisualDotSVGContainer = styled.div `
30
- position: absolute;
31
- ${absoluteDims(MARKER_SIZE_W_PX, MARKER_SIZE_H_PX)}
32
- pointer-events: none;
33
- `;
34
- // Attempted to optimize via memo + inline svg rather than background-url
35
- const MarkerVisualDot = React.memo(() => (React.createElement(MarkerVisualDotSVGContainer, { children: React.createElement("svg", { width: "100%", height: "100%", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
36
- React.createElement("path", { d: "M12 5H0V7H2.71973L5.96237 10.2426L9.20501 7H12V5Z", fill: "#40AAA4" })) })));
37
- const HitZone = styled.div `
38
- z-index: 1;
39
- cursor: ew-resize;
40
-
41
- ${DopeSnapHitZoneUI.CSS}
42
-
43
- // :not dragging marker to ensure that markers don't snap to other markers
44
- // this works because only one marker track (so this technique is not used by keyframes...)
45
- #pointer-root.draggingPositionInSequenceEditor:not(.draggingMarker) & {
46
- ${DopeSnapHitZoneUI.CSS_WHEN_SOMETHING_DRAGGING}
47
- }
48
-
49
- // "All instances of this component <Mark/> inside #pointer-root when it has the .draggingPositionInSequenceEditor class"
50
- // ref: https://styled-components.com/docs/basics#pseudoelements-pseudoselectors-and-nesting
51
- #pointer-root.draggingPositionInSequenceEditor:not(.draggingMarker) &,
52
- #pointer-root.draggingPositionInSequenceEditor
53
- &.${DopeSnapHitZoneUI.BEING_DRAGGED_CLASS} {
54
- pointer-events: auto;
55
- cursor: var(${lockedCursorCssVarName});
56
- }
57
-
58
- &:hover
59
- + ${MarkerVisualDotSVGContainer},
60
- // notice , "or" in CSS
61
- &.${DopeSnapHitZoneUI.BEING_DRAGGED_CLASS}
62
- + ${MarkerVisualDotSVGContainer} {
63
- ${absoluteDims(MARKER_HOVER_SIZE_W_PX, MARKER_HOVER_SIZE_H_PX)}
64
- }
65
- `;
66
- const MarkerDot = ({ layoutP, markerId }) => {
67
- const sheetAddress = useVal(layoutP.sheet.address);
68
- const marker = useVal(getStudio().atomP.historic.projects.stateByProjectId[sheetAddress.projectId]
69
- .stateBySheetId[sheetAddress.sheetId].sequenceEditor.markerSet.byId[markerId]);
70
- if (!marker) {
71
- // 1/10 maybe this is normal if React tries to re-render this with
72
- // out of date data. (e.g. Suspense / Transition stuff?)
73
- return null;
74
- }
75
- // check marker in viewable bounds
76
- const clippedSpaceWidth = useVal(layoutP.clippedSpace.width);
77
- const clippedSpaceFromUnitSpace = useVal(layoutP.clippedSpace.fromUnitSpace);
78
- const clippedSpaceMarkerX = clippedSpaceFromUnitSpace(marker.position);
79
- const outsideClipDims = clippedSpaceMarkerX <= 0 || clippedSpaceMarkerX > clippedSpaceWidth;
80
- // If outside the clip space, we want to hide the marker dot. We
81
- // hide the dot by translating it far away and scaling it to 0.
82
- // This method of hiding does not cause reflow/repaint.
83
- const translateX = outsideClipDims ? -10000 : clippedSpaceMarkerX;
84
- const scale = outsideClipDims ? 0 : 1;
85
- return (React.createElement(MarkerDotContainer, { style: {
86
- transform: `translateX(${translateX}px) scale(${scale})`,
87
- } },
88
- React.createElement(MarkerDotVisible, { marker: marker, layoutP: layoutP })));
89
- };
90
- export default MarkerDot;
91
- const MarkerDotVisible = ({ layoutP, marker, }) => {
92
- const sheetAddress = useVal(layoutP.sheet.address);
93
- const [markRef, markNode] = useRefAndState(null);
94
- const [contextMenu] = useMarkerContextMenu(markNode, {
95
- sheetAddress,
96
- markerId: marker.id,
97
- });
98
- const [isDragging] = useDragMarker(markNode, {
99
- layoutP,
100
- marker,
101
- });
102
- const { node: popoverNode, toggle: togglePopover, close: closePopover, } = usePopover({ debugName: 'MarkerPopover' }, () => {
103
- return (React.createElement(BasicPopover, null,
104
- React.createElement(MarkerEditorPopover, { marker: marker, layoutP: layoutP, onRequestClose: closePopover })));
105
- });
106
- return (React.createElement(React.Fragment, null,
107
- contextMenu,
108
- popoverNode,
109
- React.createElement(HitZone, { title: marker.label ? `Marker: ${marker.label}` : 'Marker', ref: markRef, onClick: (e) => {
110
- togglePopover(e, markRef.current);
111
- }, ...DopeSnapHitZoneUI.reactProps({
112
- isDragging,
113
- position: marker.position,
114
- }) }),
115
- React.createElement(MarkerVisualDot, null)));
116
- };
117
- function useMarkerContextMenu(node, options) {
118
- return useContextMenu(node, {
119
- menuItems() {
120
- return [
121
- {
122
- label: 'Remove marker',
123
- callback: () => {
124
- getStudio().transaction(({ stateEditors }) => {
125
- stateEditors.studio.historic.projects.stateByProjectId.stateBySheetId.sequenceEditor.removeMarker({
126
- sheetAddress: options.sheetAddress,
127
- markerId: options.markerId,
128
- });
129
- });
130
- },
131
- },
132
- ];
133
- },
134
- });
135
- }
136
- function useDragMarker(node, props) {
137
- const propsRef = useRef(props);
138
- propsRef.current = props;
139
- const useDragOpts = useMemo(() => {
140
- return {
141
- debugName: `MarkerDot/useDragMarker (${props.marker.id})`,
142
- onDragStart(_event) {
143
- const markerAtStartOfDrag = propsRef.current.marker;
144
- const toUnitSpace = val(props.layoutP.scaledSpace.toUnitSpace);
145
- let tempTransaction;
146
- snapToAll();
147
- return {
148
- onDrag(dx, _dy, event) {
149
- const original = markerAtStartOfDrag;
150
- const newPosition = Math.max(
151
- // check if our event hoversover a [data-pos] element
152
- DopeSnap.checkIfMouseEventSnapToPos(event, {
153
- ignore: node,
154
- }) ??
155
- // if we don't find snapping target, check the distance dragged + original position
156
- original.position + toUnitSpace(dx),
157
- // sanitize to minimum of zero
158
- 0);
159
- tempTransaction?.discard();
160
- tempTransaction = getStudio().tempTransaction(({ stateEditors }) => {
161
- stateEditors.studio.historic.projects.stateByProjectId.stateBySheetId.sequenceEditor.replaceMarkers({
162
- sheetAddress: val(props.layoutP.sheet.address),
163
- markers: [{ ...original, position: newPosition }],
164
- snappingFunction: val(props.layoutP.sheet).getSequence()
165
- .closestGridPosition,
166
- });
167
- });
168
- },
169
- onDragEnd(dragHappened) {
170
- if (dragHappened)
171
- tempTransaction?.commit();
172
- else
173
- tempTransaction?.discard();
174
- snapToNone();
175
- },
176
- };
177
- },
178
- };
179
- }, []);
180
- const [isDragging] = useDrag(node, useDragOpts);
181
- useLockFrameStampPosition(isDragging, props.marker.position);
182
- useCssCursorLock(isDragging, 'draggingPositionInSequenceEditor draggingMarker', 'ew-resize');
183
- return [isDragging];
184
- }