@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,18 +0,0 @@
1
- import { usePrism } from '@tomorrowevening/theatre-react';
2
- import React from 'react';
3
- import PrimitivePropRow from './PrimitivePropRow';
4
- import RightRow from './Row';
5
- import AggregatedKeyframeTrack from './AggregatedKeyframeTrack/AggregatedKeyframeTrack';
6
- import { collectAggregateKeyframesInPrism } from './collectAggregateKeyframes';
7
- import { ProvideLogger, useLogger } from '@tomorrowevening/theatre-studio/uiComponents/useLogger';
8
- export const decideRowByPropType = (leaf, layoutP) => leaf.type === 'propWithChildren' ? (React.createElement(RightPropWithChildrenRow, { layoutP: layoutP, viewModel: leaf, key: 'prop' + leaf.pathToProp[leaf.pathToProp.length - 1] })) : (React.createElement(PrimitivePropRow, { layoutP: layoutP, leaf: leaf, key: 'prop' + leaf.pathToProp[leaf.pathToProp.length - 1] }));
9
- const RightPropWithChildrenRow = ({ viewModel, layoutP }) => {
10
- const logger = useLogger('RightPropWithChildrenRow', viewModel.pathToProp.join());
11
- return usePrism(() => {
12
- const aggregatedKeyframes = collectAggregateKeyframesInPrism(viewModel);
13
- const node = (React.createElement(AggregatedKeyframeTrack, { layoutP: layoutP, aggregatedKeyframes: aggregatedKeyframes, viewModel: viewModel }));
14
- return (React.createElement(ProvideLogger, { logger: logger },
15
- React.createElement(RightRow, { leaf: viewModel, node: node, isCollapsed: viewModel.isCollapsed }, viewModel.children.map((propLeaf) => decideRowByPropType(propLeaf, layoutP)))));
16
- }, [viewModel, layoutP]);
17
- };
18
- export default RightPropWithChildrenRow;
@@ -1,30 +0,0 @@
1
- import { usePrism } from '@tomorrowevening/theatre-react';
2
- import { val } from '@tomorrowevening/theatre-dataverse';
3
- import React from 'react';
4
- import styled from 'styled-components';
5
- import DopeSheetSelectionView from './DopeSheetSelectionView';
6
- import HorizontallyScrollableArea from './HorizontallyScrollableArea';
7
- import SheetRow from './SheetRow';
8
- export const contentWidth = 1000000;
9
- const ListContainer = styled.ul `
10
- margin: 0;
11
- padding: 0;
12
- list-style: none;
13
- position: absolute;
14
- left: 0;
15
- width: ${contentWidth}px;
16
- `;
17
- const Right = ({ layoutP }) => {
18
- return usePrism(() => {
19
- const tree = val(layoutP.tree);
20
- const height = val(layoutP.tree.top) +
21
- // stretch the height of the dope sheet in case the rows don't cover its whole vertical space
22
- Math.max(val(layoutP.tree.heightIncludingChildren), val(layoutP.dopeSheetDims.height));
23
- return (React.createElement(React.Fragment, null,
24
- React.createElement(HorizontallyScrollableArea, { layoutP: layoutP, height: height },
25
- React.createElement(DopeSheetSelectionView, { layoutP: layoutP, height: height },
26
- React.createElement(ListContainer, { style: { top: tree.top + 'px' } },
27
- React.createElement(SheetRow, { leaf: tree, layoutP: layoutP }))))));
28
- }, [layoutP]);
29
- };
30
- export default Right;
@@ -1,50 +0,0 @@
1
- import React from 'react';
2
- import styled from 'styled-components';
3
- const RightRowContainer = styled.li `
4
- margin: 0;
5
- padding: 0;
6
- list-style: none;
7
- box-sizing: border-box;
8
- position: relative;
9
- `;
10
- const RightRowNodeWrapper = styled.div `
11
- box-sizing: border-box;
12
- width: 100%;
13
- position: relative;
14
-
15
- &:before {
16
- position: absolute;
17
- display: block;
18
- content: ' ';
19
- left: -40px;
20
- top: 0;
21
- bottom: 0;
22
- right: 0;
23
- box-sizing: border-box;
24
- border-bottom: 1px solid #252b3869;
25
- background: ${(props) => (props.isEven ? 'transparent' : '#6b8fb505')};
26
- }
27
- `;
28
- const RightRowChildren = styled.ul `
29
- margin: 0;
30
- padding: 0;
31
- list-style: none;
32
- `;
33
- /**
34
- * @remarks
35
- * Right now, we're rendering a hierarchical dom tree that reflects the hierarchy of
36
- * objects, compound props, and their subs. This is not necessary and makes styling complicated.
37
- * Instead of this, we can simply render a list. This should be easy to do, since the view model
38
- * in {@link calculateSequenceEditorTree} already includes all the vertical placement information
39
- * (height and top) we need to render the nodes as a list.
40
- *
41
- * Note that we don't need to change {@link calculateSequenceEditorTree} to be list-based. It can
42
- * retain its hierarchy. It's just the DOM tree that should be list-based.
43
- */
44
- const RightRow = ({ leaf, children, node, isCollapsed }) => {
45
- const hasChildren = Array.isArray(children) && children.length > 0;
46
- return leaf.shouldRender ? (React.createElement(RightRowContainer, null,
47
- React.createElement(RightRowNodeWrapper, { style: { height: leaf.nodeHeight + 'px' }, isEven: leaf.n % 2 === 0 }, node),
48
- hasChildren && React.createElement(RightRowChildren, null, children))) : null;
49
- };
50
- export default RightRow;
@@ -1,14 +0,0 @@
1
- import { usePrism } from '@tomorrowevening/theatre-react';
2
- import React from 'react';
3
- import { decideRowByPropType } from './PropWithChildrenRow';
4
- import RightRow from './Row';
5
- import { collectAggregateKeyframesInPrism } from './collectAggregateKeyframes';
6
- import AggregatedKeyframeTrack from './AggregatedKeyframeTrack/AggregatedKeyframeTrack';
7
- const RightSheetObjectRow = ({ leaf, layoutP }) => {
8
- return usePrism(() => {
9
- const aggregatedKeyframes = collectAggregateKeyframesInPrism(leaf);
10
- const node = (React.createElement(AggregatedKeyframeTrack, { layoutP: layoutP, aggregatedKeyframes: aggregatedKeyframes, viewModel: leaf }));
11
- return (React.createElement(RightRow, { leaf: leaf, node: node, isCollapsed: leaf.isCollapsed }, leaf.children.map((leaf) => decideRowByPropType(leaf, layoutP))));
12
- }, [leaf, layoutP]);
13
- };
14
- export default RightSheetObjectRow;
@@ -1,14 +0,0 @@
1
- import { usePrism } from '@tomorrowevening/theatre-react';
2
- import React from 'react';
3
- import RightSheetObjectRow from './SheetObjectRow';
4
- import RightRow from './Row';
5
- import { collectAggregateKeyframesInPrism } from './collectAggregateKeyframes';
6
- import AggregatedKeyframeTrack from './AggregatedKeyframeTrack/AggregatedKeyframeTrack';
7
- const SheetRow = ({ leaf, layoutP }) => {
8
- return usePrism(() => {
9
- const aggregatedKeyframes = collectAggregateKeyframesInPrism(leaf);
10
- const node = (React.createElement(AggregatedKeyframeTrack, { layoutP: layoutP, aggregatedKeyframes: aggregatedKeyframes, viewModel: leaf }));
11
- return (React.createElement(RightRow, { leaf: leaf, node: node, isCollapsed: leaf.isCollapsed }, leaf.children.map((sheetObjectLeaf) => (React.createElement(RightSheetObjectRow, { layoutP: layoutP, key: 'sheetObject-' + sheetObjectLeaf.sheetObject.address.objectKey, leaf: sheetObjectLeaf })))));
12
- }, [leaf, layoutP]);
13
- };
14
- export default SheetRow;
@@ -1,92 +0,0 @@
1
- import getStudio from '@tomorrowevening/theatre-studio/getStudio';
2
- import { val } from '@tomorrowevening/theatre-dataverse';
3
- import { createStudioSheetItemKey } from '@tomorrowevening/theatre-shared/utils/ids';
4
- import { encodePathToProp } from '@tomorrowevening/theatre-shared/utils/addresses';
5
- import { uniq } from 'lodash-es';
6
- /**
7
- * Collect {@link AggregatedKeyframes} information from the given tree row with children.
8
- *
9
- * Must be called within a `prism` context.
10
- *
11
- * Implementation progress 2/10:
12
- * - This currently does a lot of duplicate work for each compound rows' compound rows.
13
- * - This appears to have O(N) complexity with N being the number of "things" in the
14
- * tree, thus we don't see an immediate need to cache it further.
15
- * - If concerned, consider making a playground with a lot of objects to test this kind of thing.
16
- *
17
- * Note that we do not need to filter to only tracks that should be displayed, because we
18
- * do not do anything counting or iterating over all tracks.
19
- *
20
- * Furthermore, we _could_ have been traversing the tree of the sheet and producing
21
- * an aggreagte from that, but _that_ aggregate would not take into account
22
- * things like filters in the `SequenceEditorPanel`, where the filter would exclude
23
- * certain objects and props from the tree.
24
- *
25
- */
26
- export function collectAggregateKeyframesInPrism(leaf) {
27
- const tracks = leaf.type === 'sheet'
28
- ? collectAggregateKeyframesSheet(leaf)
29
- : collectAggregateKeyframesCompoundOrObject(leaf);
30
- return {
31
- byPosition: keyframesByPositionFromTrackWithIds(tracks),
32
- tracks,
33
- };
34
- }
35
- function keyframesByPositionFromTrackWithIds(tracks) {
36
- const byPosition = new Map();
37
- for (const track of tracks) {
38
- for (const kf of track.data.keyframes) {
39
- let existing = byPosition.get(kf.position);
40
- if (!existing) {
41
- existing = [];
42
- byPosition.set(kf.position, existing);
43
- }
44
- existing.push({
45
- kf,
46
- track,
47
- itemKey: createStudioSheetItemKey.forTrackKeyframe(track.sheetObject, track.id, kf.id),
48
- });
49
- }
50
- }
51
- return byPosition;
52
- }
53
- function collectAggregateKeyframesSheet(leaf) {
54
- return leaf.children.flatMap(collectAggregateKeyframesCompoundOrObject);
55
- }
56
- function collectAggregateKeyframesCompoundOrObject(leaf) {
57
- return leaf.children.flatMap((childLeaf) => childLeaf.type === 'propWithChildren'
58
- ? collectAggregateKeyframesCompoundOrObject(childLeaf)
59
- : collectAggregateKeyframesPrimitiveProp(childLeaf));
60
- }
61
- function collectAggregateKeyframesPrimitiveProp(leaf) {
62
- const sheetObject = leaf.sheetObject;
63
- const projectId = sheetObject.address.projectId;
64
- const sheetObjectTracksP = getStudio().atomP.historic.coreByProject[projectId].sheetsById[sheetObject.address.sheetId].sequence.tracksByObject[sheetObject.address.objectKey];
65
- const trackId = val(sheetObjectTracksP.trackIdByPropPath[encodePathToProp(leaf.pathToProp)]);
66
- if (!trackId)
67
- return [];
68
- const trackData = val(sheetObjectTracksP.trackData[trackId]);
69
- if (!trackData)
70
- return [];
71
- return [{ id: trackId, data: trackData, sheetObject }];
72
- }
73
- /**
74
- * Collects all the snap positions for an aggregate track.
75
- */
76
- export function collectAggregateSnapPositionsSheet(leaf, snapTargetPositions) {
77
- return uniq(leaf.children.flatMap((childLeaf) => collectAggregateSnapPositionsObjectOrCompound(childLeaf, snapTargetPositions)));
78
- }
79
- export function collectAggregateSnapPositionsObjectOrCompound(leaf, snapTargetPositions) {
80
- return uniq(leaf.children.flatMap((childLeaf) => childLeaf.type === 'propWithChildren'
81
- ? collectAggregateSnapPositionsObjectOrCompound(childLeaf, snapTargetPositions)
82
- : collectAggregateSnapPositionsPrimitiveProp(childLeaf, snapTargetPositions)));
83
- }
84
- function collectAggregateSnapPositionsPrimitiveProp(leaf, snapTargetPositions) {
85
- const sheetObject = leaf.sheetObject;
86
- const projectId = sheetObject.address.projectId;
87
- const sheetObjectTracksP = getStudio().atomP.historic.coreByProject[projectId].sheetsById[sheetObject.address.sheetId].sequence.tracksByObject[sheetObject.address.objectKey];
88
- const trackId = val(sheetObjectTracksP.trackIdByPropPath[encodePathToProp(leaf.pathToProp)]);
89
- if (!trackId)
90
- return [];
91
- return snapTargetPositions[sheetObject.address.objectKey]?.[trackId] ?? [];
92
- }
@@ -1,62 +0,0 @@
1
- import { lighten, saturate } from 'polished';
2
- import React from 'react';
3
- import styled from 'styled-components';
4
- import { DOT_SIZE_PX } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/SingleKeyframeDot';
5
- const CONNECTOR_HEIGHT = DOT_SIZE_PX / 2 + 1;
6
- const CONNECTOR_WIDTH_UNSCALED = 1000;
7
- export const CONNECTOR_THEME = {
8
- normalColor: `#365b59`,
9
- selectedColor: `#8A7842`,
10
- barColor: (values) => {
11
- const base = values.isSelected
12
- ? CONNECTOR_THEME.selectedColor
13
- : CONNECTOR_THEME.normalColor;
14
- return values.isPopoverOpen ? saturate(0.2, lighten(0.2, base)) : base;
15
- },
16
- hoverColor: (values) => {
17
- const base = values.isSelected
18
- ? CONNECTOR_THEME.selectedColor
19
- : CONNECTOR_THEME.normalColor;
20
- return values.isPopoverOpen
21
- ? saturate(0.2, lighten(0.2, base))
22
- : saturate(0.1, lighten(0.1, base));
23
- },
24
- };
25
- const Container = styled.div `
26
- position: absolute;
27
- background: ${CONNECTOR_THEME.barColor};
28
- height: ${CONNECTOR_HEIGHT}px;
29
- width: ${CONNECTOR_WIDTH_UNSCALED}px;
30
-
31
- left: 0;
32
- top: -${CONNECTOR_HEIGHT / 2}px;
33
- transform-origin: top left;
34
- z-index: 0;
35
- cursor: ew-resize;
36
-
37
- &:after {
38
- display: block;
39
- position: absolute;
40
- content: ' ';
41
- top: -4px;
42
- bottom: -4px;
43
- left: 0;
44
- right: 0;
45
- }
46
-
47
- &:hover {
48
- background: ${CONNECTOR_THEME.hoverColor};
49
- }
50
- `;
51
- export const ConnectorLine = React.forwardRef((props, ref) => {
52
- const themeValues = {
53
- isPopoverOpen: props.isPopoverOpen,
54
- isSelected: props.isSelected,
55
- };
56
- return (React.createElement(Container, { ...themeValues, ref: ref, style: {
57
- // Previously we used scale3d, which had weird fuzzy rendering look in both FF & Chrome
58
- transform: `scaleX(calc(var(--unitSpaceToScaledSpaceMultiplier) * ${props.connectorLengthInUnitSpace / CONNECTOR_WIDTH_UNSCALED}))`,
59
- }, onClick: (e) => {
60
- props.openPopover?.(e);
61
- } }, props.children));
62
- });
@@ -1,149 +0,0 @@
1
- import { prism, val } from '@tomorrowevening/theatre-dataverse';
2
- import getStudio from '@tomorrowevening/theatre-studio/getStudio';
3
- import { commonRootOfPathsToProps, decodePathToProp, } from '@tomorrowevening/theatre-shared/utils/addresses';
4
- /**
5
- * Keyframe connections are considered to be selected if the first
6
- * keyframe in the connection is selected
7
- */
8
- export function isKeyframeConnectionInSelection(keyframeConnection, selection) {
9
- for (const { keyframeId } of flatSelectionKeyframeIds(selection)) {
10
- if (keyframeConnection.left.id === keyframeId)
11
- return true;
12
- }
13
- return false;
14
- }
15
- /**
16
- * Returns an array of all the selected keyframes
17
- * that are connected to one another. Useful for changing
18
- * the tweening in between keyframes.
19
- *
20
- * TODO - rename to selectedKeyframeConnectionsD(), or better yet,
21
- * make it a `prism.ensurePrism()` function, rather than returning
22
- * a prism.
23
- */
24
- export function selectedKeyframeConnections(projectId, sheetId, selection) {
25
- return prism(() => {
26
- if (selection === undefined)
27
- return [];
28
- let ckfs = [];
29
- for (const { objectKey, trackId } of flatSelectionTrackIds(selection)) {
30
- const track = val(getStudio().atomP.historic.coreByProject[projectId].sheetsById[sheetId]
31
- .sequence.tracksByObject[objectKey].trackData[trackId]);
32
- if (track) {
33
- ckfs = ckfs.concat(keyframeConnections(track.keyframes)
34
- .filter((kfc) => isKeyframeConnectionInSelection(kfc, selection))
35
- .map(({ left, right }) => ({
36
- left,
37
- right,
38
- trackId,
39
- objectKey,
40
- sheetId,
41
- projectId,
42
- })));
43
- }
44
- }
45
- return ckfs;
46
- });
47
- }
48
- /**
49
- * Given a selection, returns a list of keyframes and paths
50
- * that are relative to a common root path. For example, if
51
- * the selection contains a keyframe on both the following tracks:
52
- * - exObject.transform.position.x
53
- * - exObject.transform.position.y
54
- * then the result will be
55
- * ```
56
- * [{ keyframe, pathToProp: ['x']}, { keyframe, pathToProp: ['y']}]
57
- * ```
58
- *
59
- * If the selection contains a keyframe on
60
- * all the following tracks:
61
- * - exObject.transform.position.x
62
- * - exObject.transform.position.y
63
- * - exObject.transform.scale.x
64
- * then the result will be
65
- * ```
66
- * [
67
- * {keyframe, pathToProp: ['position', 'x']},
68
- * {keyframe, pathToProp: ['position', 'y']},
69
- * {keyframe, pathToProp: ['scale', 'x']},
70
- * ]
71
- * ```
72
- */
73
- export function copyableKeyframesFromSelection(projectId, sheetId, selection) {
74
- if (selection === undefined)
75
- return [];
76
- let kfs = [];
77
- for (const { objectKey, trackId, keyframeIds } of flatSelectionTrackIds(selection)) {
78
- kfs = kfs.concat(keyframesWithPaths({
79
- projectId,
80
- sheetId,
81
- objectKey,
82
- trackId,
83
- keyframeIds,
84
- }) ?? []);
85
- }
86
- const commonPath = commonRootOfPathsToProps(kfs.map((kf) => kf.pathToProp));
87
- const keyframesWithCommonRootPath = kfs.map(({ keyframe, pathToProp }) => ({
88
- keyframe,
89
- pathToProp: pathToProp.slice(commonPath.length),
90
- }));
91
- return keyframesWithCommonRootPath;
92
- }
93
- /**
94
- * @see copyableKeyframesFromSelection
95
- */
96
- export function keyframesWithPaths({ projectId, sheetId, objectKey, trackId, keyframeIds, }) {
97
- const tracksByObject = val(getStudio().atomP.historic.coreByProject[projectId].sheetsById[sheetId]
98
- .sequence.tracksByObject[objectKey]);
99
- const track = tracksByObject?.trackData[trackId];
100
- if (!track)
101
- return null;
102
- const propPathByTrackId = swapKeyAndValue(tracksByObject?.trackIdByPropPath || {});
103
- const encodedPropPath = propPathByTrackId[trackId];
104
- if (!encodedPropPath)
105
- return null;
106
- const pathToProp = [objectKey, ...decodePathToProp(encodedPropPath)];
107
- return keyframeIds
108
- .map((keyframeId) => ({
109
- keyframe: track.keyframes.find((keyframe) => keyframe.id === keyframeId),
110
- pathToProp,
111
- }))
112
- .filter(({ keyframe }) => keyframe !== undefined);
113
- }
114
- function swapKeyAndValue(obj) {
115
- const result = {};
116
- for (const [key, value] of Object.entries(obj)) {
117
- result[value] = key;
118
- }
119
- return result;
120
- }
121
- export function keyframeConnections(keyframes) {
122
- return keyframes
123
- .map((kf, i) => ({ left: kf, right: keyframes[i + 1] }))
124
- .slice(0, -1); // remmove the last entry because it is { left: kf, right: undefined }
125
- }
126
- export function flatSelectionKeyframeIds(selection) {
127
- const result = [];
128
- for (const [objectKey, maybeObjectRecord] of Object.entries(selection?.byObjectKey ?? {})) {
129
- for (const [trackId, maybeTrackRecord] of Object.entries(maybeObjectRecord?.byTrackId ?? {})) {
130
- for (const keyframeId of Object.keys(maybeTrackRecord?.byKeyframeId ?? {})) {
131
- result.push({ objectKey, trackId, keyframeId });
132
- }
133
- }
134
- }
135
- return result;
136
- }
137
- export function flatSelectionTrackIds(selection) {
138
- const result = [];
139
- for (const [objectKey, maybeObjectRecord] of Object.entries(selection?.byObjectKey ?? {})) {
140
- for (const [trackId, maybeTrackRecord] of Object.entries(maybeObjectRecord?.byTrackId ?? {})) {
141
- result.push({
142
- objectKey,
143
- trackId,
144
- keyframeIds: Object.keys(maybeTrackRecord?.byKeyframeId ?? {}),
145
- });
146
- }
147
- }
148
- return result;
149
- }
@@ -1,10 +0,0 @@
1
- import getStudio from '@tomorrowevening/theatre-studio/getStudio';
2
- export function setCollapsedSheetItem(isCollapsed, toCollapse) {
3
- getStudio().transaction(({ stateEditors }) => {
4
- stateEditors.studio.ahistoric.projects.stateByProjectId.stateBySheetId.sequence.sequenceEditorCollapsableItems.set({
5
- ...toCollapse.sheetAddress,
6
- studioSheetItemKey: toCollapse.sheetItemKey,
7
- isCollapsed,
8
- });
9
- });
10
- }
@@ -1,92 +0,0 @@
1
- import { prism, val } from '@tomorrowevening/theatre-dataverse';
2
- import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
3
- import styled from 'styled-components';
4
- import createGrid from './createGrid';
5
- import getStudio from '@tomorrowevening/theatre-studio/getStudio';
6
- const Container = styled.div `
7
- position: absolute;
8
- top: 0;
9
- left: 0;
10
- height: 100%;
11
- pointer-events: none;
12
- `;
13
- const TheCanvas = styled.canvas `
14
- position: relative;
15
- left: 0;
16
- `;
17
- /**
18
- * from https://github.com/jonobr1/two.js/blob/758672c280278da2980b57e42ecb96eab4fe7a95/src/utils/get-ratio.js#L20
19
- */
20
- const getBackingStoreRatio = (ctx) => {
21
- const _ctx = ctx;
22
- return (_ctx.webkitBackingStorePixelRatio ||
23
- _ctx.mozBackingStorePixelRatio ||
24
- _ctx.msBackingStorePixelRatio ||
25
- _ctx.oBackingStorePixelRatio ||
26
- _ctx.backingStorePixelRatio ||
27
- 1);
28
- };
29
- const getDevicePixelRatio = () => window.devicePixelRatio || 1;
30
- const getRatio = (ctx) => {
31
- return getDevicePixelRatio() / getBackingStoreRatio(ctx);
32
- };
33
- const FrameGrid = ({ layoutP, width, height }) => {
34
- const containerRef = useRef(null);
35
- const [canvas, canvasRef] = useState(null);
36
- const { ctx, ratio } = useMemo(() => {
37
- if (!canvas)
38
- return {};
39
- const ctx = canvas.getContext('2d');
40
- const ratio = getRatio(ctx);
41
- return { ctx, ratio };
42
- }, [canvas]);
43
- useLayoutEffect(() => {
44
- if (!ctx)
45
- return;
46
- canvas.width = width * ratio;
47
- canvas.height = height * ratio;
48
- const untap = prism(() => {
49
- const sequence = val(layoutP.sheet).getSequence();
50
- return {
51
- ctx,
52
- clippedSpaceRange: val(layoutP.clippedSpace.range),
53
- clippedSpaceWidth: val(layoutP.clippedSpace.width),
54
- unitSpaceToClippedSpace: val(layoutP.clippedSpace.fromUnitSpace),
55
- height,
56
- leftPadding: val(layoutP.scaledSpace.leftPadding),
57
- fps: sequence.subUnitsPerUnit,
58
- snapToGrid: (n) => sequence.closestGridPosition(n),
59
- };
60
- }).onChange(getStudio().ticker, (p) => {
61
- ctx.save();
62
- ctx.scale(ratio, ratio);
63
- drawGrid(p);
64
- ctx.restore();
65
- }, true);
66
- return () => {
67
- untap();
68
- };
69
- }, [ctx, width, height, layoutP]);
70
- return (React.createElement(Container, { ref: containerRef, style: { width: width + 'px' } },
71
- React.createElement(TheCanvas, { ref: canvasRef, style: {
72
- width: width + 'px',
73
- height: height + 'px',
74
- } })));
75
- };
76
- export default FrameGrid;
77
- function drawGrid(opts) {
78
- const { clippedSpaceWidth, height, ctx, unitSpaceToClippedSpace, snapToGrid } = opts;
79
- ctx.clearRect(0, 0, clippedSpaceWidth, height);
80
- createGrid(opts, (_posInUnitSpace, isFullSecond) => {
81
- const posInUnitSpace = snapToGrid(_posInUnitSpace);
82
- const posInClippedSpace = Math.floor(unitSpaceToClippedSpace(posInUnitSpace));
83
- ctx.strokeStyle = isFullSecond
84
- ? 'rgba(225, 225, 225, 0.04)'
85
- : 'rgba(255, 255, 255, 0.01)';
86
- ctx.beginPath();
87
- ctx.moveTo(posInClippedSpace, 0);
88
- ctx.lineTo(posInClippedSpace, height);
89
- ctx.stroke();
90
- ctx.closePath();
91
- });
92
- }
@@ -1,99 +0,0 @@
1
- import { prism, val } from '@tomorrowevening/theatre-dataverse';
2
- import { darken } from 'polished';
3
- import React, { useLayoutEffect, useRef, useState } from 'react';
4
- import styled from 'styled-components';
5
- import createGrid from './createGrid';
6
- import getStudio from '@tomorrowevening/theatre-studio/getStudio';
7
- const Container = styled.div `
8
- position: absolute;
9
- top: 0;
10
- left: 0;
11
- height: 100%;
12
- pointer-events: none;
13
- `;
14
- export const stampsGridTheme = {
15
- fullUnitStampColor: `#6a6a6a`,
16
- stampFontSize: '10px',
17
- get subUnitStampColor() {
18
- return darken(0.2, stampsGridTheme.fullUnitStampColor);
19
- },
20
- };
21
- const TheStamps = styled.div `
22
- position: absolute;
23
- top: 0;
24
- height: 100%;
25
- left: 0;
26
- overflow: hidden;
27
- z-index: 2;
28
- will-change: transform;
29
- pointer-events: none;
30
- `;
31
- const FullSecondStampsContainer = styled.div `
32
- position: absolute;
33
- top: 0;
34
- left: 0;
35
-
36
- & > span {
37
- position: absolute;
38
- display: block;
39
- top: 9px;
40
- left: -10px;
41
- color: ${stampsGridTheme.fullUnitStampColor};
42
- text-align: center;
43
- font-size: ${stampsGridTheme.stampFontSize};
44
- width: 20px;
45
-
46
- &.full-unit {
47
- color: ${stampsGridTheme.fullUnitStampColor};
48
- }
49
-
50
- &.sub-unit {
51
- color: ${stampsGridTheme.subUnitStampColor};
52
- }
53
- }
54
-
55
- pointer-events: none;
56
- `;
57
- const StampsGrid = ({ layoutP, width }) => {
58
- const containerRef = useRef(null);
59
- const [fullSecondStampsContainer, fullSecondStampsContainerRef] = useState(null);
60
- useLayoutEffect(() => {
61
- if (!fullSecondStampsContainer)
62
- return;
63
- return prism(() => {
64
- const sequence = val(layoutP.sheet).getSequence();
65
- return {
66
- fullSecondStampsContainer,
67
- clippedSpaceRange: val(layoutP.clippedSpace.range),
68
- clippedSpaceWidth: val(layoutP.clippedSpace.width),
69
- unitSpaceToClippedSpace: val(layoutP.clippedSpace.fromUnitSpace),
70
- leftPadding: val(layoutP.scaledSpace.leftPadding),
71
- fps: sequence.subUnitsPerUnit,
72
- sequencePositionFormatter: sequence.positionFormatter,
73
- snapToGrid: (n) => sequence.closestGridPosition(n),
74
- };
75
- }).onChange(getStudio().ticker, drawStamps, true);
76
- }, [fullSecondStampsContainer, width, layoutP]);
77
- return (React.createElement(Container, { ref: containerRef, style: { width: width + 'px' } },
78
- React.createElement(TheStamps, { style: { width: width + 'px' } },
79
- React.createElement(FullSecondStampsContainer, { ref: fullSecondStampsContainerRef }))));
80
- };
81
- export default StampsGrid;
82
- function drawStamps(opts) {
83
- const { fullSecondStampsContainer, sequencePositionFormatter, snapToGrid, unitSpaceToClippedSpace, } = opts;
84
- let innerHTML = '';
85
- createGrid(opts, (_posInUnitSpace, isFullUnit) => {
86
- const posInUnitSpace = snapToGrid(_posInUnitSpace);
87
- const posInClippedSpace = unitSpaceToClippedSpace(posInUnitSpace);
88
- if (isFullUnit) {
89
- innerHTML += createStampClass(sequencePositionFormatter.formatFullUnitForGrid(posInUnitSpace), posInClippedSpace, 'full-unit');
90
- }
91
- else {
92
- innerHTML += createStampClass(sequencePositionFormatter.formatSubUnitForGrid(posInUnitSpace), posInClippedSpace, 'sub-unit');
93
- }
94
- });
95
- fullSecondStampsContainer.innerHTML = innerHTML;
96
- }
97
- function createStampClass(pos, x, type) {
98
- return `<span class="${type}" style="transform: translate3d(${x.toFixed(1)}px, -50%, 0);">${pos}</span>`;
99
- }