@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,89 +0,0 @@
1
- import { getPointerParts } from '@tomorrowevening/theatre-dataverse';
2
- import useContextMenu from '@tomorrowevening/theatre-studio/uiComponents/simpleContextMenu/useContextMenu';
3
- import useRefAndState from '@tomorrowevening/theatre-studio/utils/useRefAndState';
4
- import { last } from 'lodash-es';
5
- import React from 'react';
6
- import styled from 'styled-components';
7
- import { pointerEventsAutoInNormalMode } from '@tomorrowevening/theatre-studio/css';
8
- import { propNameTextCSS } from '@tomorrowevening/theatre-studio/propEditors/utils/propNameTextCSS';
9
- import { deriver } from '@tomorrowevening/theatre-studio/utils/derive-utils';
10
- import { rowIndentationFormulaCSS } from './rowIndentationFormulaCSS';
11
- import { getDetailRowHighlightBackground } from './getDetailRowHighlightBackground';
12
- const Container = deriver(styled.div `
13
- display: flex;
14
- height: 30px;
15
- justify-content: flex-start;
16
- align-items: stretch;
17
- // We cannot calculate both the container (details panel) width and the descendant
18
- // (this) width dynamically. This leads to the container width being calculated
19
- // without this percentage being taken into consideration leads to horizontal
20
- // clipping/scrolling--the same way as if we explicitly fixed either the container
21
- // width, or the descendant width.
22
- // The correct solution for tabulated UIs with dynamic container widths is to use
23
- // CSS grid. For now I fixed this issue by just giving a great enough width
24
- // to the details panel so most things don't break.
25
- --right-width: 60%;
26
- position: relative;
27
- ${pointerEventsAutoInNormalMode};
28
-
29
- /* background-color: ${getDetailRowHighlightBackground}; */
30
- `);
31
- const Left = styled.div `
32
- box-sizing: border-box;
33
- padding-left: ${rowIndentationFormulaCSS};
34
- padding-right: 4px;
35
- display: flex;
36
- flex-direction: row;
37
- justify-content: flex-start;
38
- align-items: stretch;
39
- gap: 4px;
40
- flex-grow: 0;
41
- flex-shrink: 0;
42
- width: calc(100% - var(--right-width));
43
- `;
44
- const PropNameContainer = deriver(styled.div `
45
- text-align: left;
46
- flex: 1 0;
47
- white-space: nowrap;
48
- overflow: hidden;
49
- text-overflow: ellipsis;
50
- display: flex;
51
- align-items: center;
52
- user-select: none;
53
- cursor: default;
54
-
55
- ${propNameTextCSS};
56
- &:hover {
57
- color: white;
58
- }
59
- `);
60
- const ControlsContainer = styled.div `
61
- flex-basis: 8px;
62
- flex: 0 0;
63
- display: flex;
64
- align-items: center;
65
- `;
66
- const InputContainer = styled.div `
67
- display: flex;
68
- align-items: center;
69
- justify-content: stretch;
70
- padding: 0 8px 0 2px;
71
- box-sizing: border-box;
72
- height: 100%;
73
- width: var(--right-width);
74
- flex-shrink: 0;
75
- flex-grow: 0;
76
- `;
77
- export function SingleRowPropEditor({ propConfig, pointerToProp, editingTools, children, isPropHighlightedD, }) {
78
- const label = propConfig.label ?? last(getPointerParts(pointerToProp).path);
79
- const [propNameContainerRef, propNameContainer] = useRefAndState(null);
80
- const [contextMenu] = useContextMenu(propNameContainer, {
81
- menuItems: editingTools.contextMenuItems,
82
- });
83
- return (React.createElement(Container, { isHighlighted: isPropHighlightedD },
84
- contextMenu,
85
- React.createElement(Left, null,
86
- React.createElement(ControlsContainer, null, editingTools.controlIndicators),
87
- React.createElement(PropNameContainer, { isHighlighted: isPropHighlightedD, ref: propNameContainerRef, title: ['obj', 'props', ...getPointerParts(pointerToProp).path].join('.') }, label)),
88
- React.createElement(InputContainer, null, children)));
89
- }
@@ -1,7 +0,0 @@
1
- export function getDetailRowHighlightBackground({ isHighlighted, }) {
2
- return isHighlighted === 'self'
3
- ? '#1857a4'
4
- : isHighlighted === 'descendent'
5
- ? '#0a2f5c'
6
- : 'initial';
7
- }
@@ -1 +0,0 @@
1
- export const rowIndentationFormulaCSS = `calc(var(--left-pad) + var(--depth) * var(--step))`;
@@ -1,28 +0,0 @@
1
- import React from 'react';
2
- import { simplePropEditorByPropType } from '@tomorrowevening/theatre-studio/propEditors/simpleEditors/simplePropEditorByPropType';
3
- import DetailCompoundPropEditor from './DeterminePropEditorForDetail/DetailCompoundPropEditor';
4
- import DetailSimplePropEditor from './DeterminePropEditorForDetail/DetailSimplePropEditor';
5
- /**
6
- * Given a propConfig, this function gives the corresponding prop editor for
7
- * use in the details panel. {@link DeterminePropEditorForKeyframe} does the
8
- * same thing for the dope sheet inline prop editor on a keyframe. The main difference
9
- * between this function and {@link DeterminePropEditorForKeyframe} is that this
10
- * one shows prop editors *with* keyframe navigation controls (that look
11
- * like `< ・ >`).
12
- *
13
- * @param p - propConfig object for any type of prop.
14
- */
15
- const DeterminePropEditorForDetail = ({ propConfig, visualIndentation, pointerToProp, obj }) => {
16
- if (propConfig.type === 'compound') {
17
- return (React.createElement(DetailCompoundPropEditor, { obj: obj, visualIndentation: visualIndentation, pointerToProp: pointerToProp, propConfig: propConfig }));
18
- }
19
- else if (propConfig.type === 'enum') {
20
- // notice: enums are not implemented, yet.
21
- return React.createElement(React.Fragment, null);
22
- }
23
- else {
24
- const PropEditor = simplePropEditorByPropType[propConfig.type];
25
- return (React.createElement(DetailSimplePropEditor, { SimpleEditorComponent: PropEditor, obj: obj, visualIndentation: visualIndentation, pointerToProp: pointerToProp, propConfig: propConfig }));
26
- }
27
- };
28
- export default DeterminePropEditorForDetail;
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import styled from 'styled-components';
3
- import { Outline } from '@tomorrowevening/theatre-studio/uiComponents/icons';
4
- const Container = styled.div `
5
- padding: 16px;
6
- display: flex;
7
- flex-direction: column;
8
- gap: 24px;
9
- `;
10
- const Message = styled.div `
11
- display: flex;
12
- flex-direction: column;
13
- gap: 11px;
14
- color: rgba(255, 255, 255, 0.9);
15
- `;
16
- const Icon = styled.div `
17
- color: rgba(145, 145, 145, 0.8);
18
- `;
19
- const LinkToDoc = styled.a `
20
- color: #919191;
21
- font-size: 10px;
22
- text-decoration-color: #40434a;
23
- text-underline-offset: 3px;
24
- `;
25
- const EmptyState = () => {
26
- return (React.createElement(Container, null,
27
- React.createElement(Message, null,
28
- React.createElement(Icon, null,
29
- React.createElement(Outline, null)),
30
- React.createElement("div", null,
31
- "Please select an object from the ",
32
- React.createElement("u", null, "Outline Menu"),
33
- " to see its properties.")),
34
- React.createElement(LinkToDoc, { href: "https://www.theatrejs.com/docs/latest/manual/objects", target: "_blank" }, "Learn more about Objects")));
35
- };
36
- export default EmptyState;
@@ -1,52 +0,0 @@
1
- import React from 'react';
2
- import DeterminePropEditorForDetail from './DeterminePropEditorForDetail';
3
- import { useVal } from '@tomorrowevening/theatre-react';
4
- import uniqueKeyForAnyObject from '@tomorrowevening/theatre-shared/utils/uniqueKeyForAnyObject';
5
- import styled from 'styled-components';
6
- const ActionButtonContainer = styled.div `
7
- display: flex;
8
- flex-direction: column;
9
- gap: 4px;
10
- padding: 8px;
11
- `;
12
- const ActionButton = styled.button `
13
- display: flex;
14
- align-items: center;
15
- justify-content: center;
16
- outline: none;
17
- border-radius: 2px;
18
-
19
- color: #a8a8a9;
20
- background: rgba(255, 255, 255, 0.1);
21
-
22
- border: none;
23
- height: 28px;
24
-
25
- &:hover {
26
- background: rgba(255, 255, 255, 0.15);
27
- }
28
-
29
- &:active {
30
- background: rgba(255, 255, 255, 0.2);
31
- }
32
- `;
33
- const ObjectDetails = ({ objects }) => {
34
- const obj = objects[0];
35
- const config = useVal(obj.template.configPointer);
36
- const actions = useVal(obj.template._temp_actionsPointer);
37
- return (React.createElement(React.Fragment, null,
38
- React.createElement(DeterminePropEditorForDetail
39
- // we don't use the object's address as the key because if a user calls `sheet.detachObject(key)` and later
40
- // calls `sheet.object(key)` with the same key, we want to re-render the object details panel.
41
- , {
42
- // we don't use the object's address as the key because if a user calls `sheet.detachObject(key)` and later
43
- // calls `sheet.object(key)` with the same key, we want to re-render the object details panel.
44
- key: uniqueKeyForAnyObject(obj), obj: obj, pointerToProp: obj.propsP, propConfig: config, visualIndentation: 1 }),
45
- React.createElement(ActionButtonContainer, null, actions &&
46
- Object.entries(actions).map(([actionName, action]) => {
47
- return (React.createElement(ActionButton, { key: actionName, onClick: () => {
48
- action(obj.publicApi);
49
- } }, actionName));
50
- }))));
51
- };
52
- export default ObjectDetails;
@@ -1,86 +0,0 @@
1
- import { useVal } from '@tomorrowevening/theatre-react';
2
- import getStudio from '@tomorrowevening/theatre-studio/getStudio';
3
- import React from 'react';
4
- import styled from 'styled-components';
5
- import { generateDiskStateRevision } from '@tomorrowevening/theatre-studio/StudioStore/generateDiskStateRevision';
6
- import useTooltip from '@tomorrowevening/theatre-studio/uiComponents/Popover/useTooltip';
7
- import BasicTooltip from '@tomorrowevening/theatre-studio/uiComponents/Popover/BasicTooltip';
8
- import DetailPanelButton from '@tomorrowevening/theatre-studio/uiComponents/DetailPanelButton';
9
- const Container = styled.div `
10
- padding: 8px 10px;
11
- position: relative;
12
- background-color: #6d232352;
13
- &:before {
14
- position: absolute;
15
- content: ' ';
16
- display: block;
17
- left: 0;
18
- top: 0;
19
- bottom: 0;
20
- width: 2px;
21
- background-color: #ff000070;
22
- }
23
- `;
24
- const Message = styled.div `
25
- margin-bottom: 1em;
26
- & a {
27
- color: inherit;
28
- }
29
- `;
30
- const ChooseStateRow = styled.div `
31
- display: flex;
32
- gap: 8px;
33
- `;
34
- const StateConflictRow = ({ projectId }) => {
35
- const loadingState = useVal(getStudio().atomP.ephemeral.coreByProject[projectId].loadingState);
36
- if (!loadingState)
37
- return null;
38
- if (loadingState.type === 'browserStateIsNotBasedOnDiskState') {
39
- return React.createElement(InConflict, { loadingState: loadingState, projectId: projectId });
40
- }
41
- else {
42
- return null;
43
- }
44
- };
45
- const InConflict = ({ projectId, loadingState }) => {
46
- /**
47
- * This stuff is not undo-safe, but once we switch to the new persistence
48
- * scheme, these will be unnecessary anyway.
49
- */
50
- const useBrowserState = () => {
51
- getStudio().transaction(({ drafts, stateEditors }) => {
52
- stateEditors.coreByProject.historic.revisionHistory.add({
53
- projectId,
54
- revision: loadingState.onDiskState.revisionHistory[0],
55
- });
56
- stateEditors.coreByProject.historic.revisionHistory.add({
57
- projectId,
58
- revision: generateDiskStateRevision(),
59
- });
60
- drafts.ephemeral.coreByProject[projectId].loadingState = {
61
- type: 'loaded',
62
- };
63
- });
64
- };
65
- const useOnDiskState = () => {
66
- getStudio().transaction(({ drafts }) => {
67
- drafts.historic.coreByProject[projectId] = loadingState.onDiskState;
68
- drafts.ephemeral.coreByProject[projectId].loadingState = {
69
- type: 'loaded',
70
- };
71
- });
72
- };
73
- const [browserStateNode, browserStateRef] = useTooltip({}, () => (React.createElement(BasicTooltip, null, "The browser's state will override the disk state.")));
74
- const [diskStateNode, diskStateRef] = useTooltip({}, () => (React.createElement(BasicTooltip, null, "The disk's state will override the browser's state.")));
75
- return (React.createElement(Container, null,
76
- React.createElement(Message, null,
77
- "Browser state is not based on disk state.",
78
- ' ',
79
- React.createElement("a", { href: "https://www.theatrejs.com/docs/latest/manual/projects#state", target: "_blank" }, "Learn more.")),
80
- React.createElement(ChooseStateRow, null,
81
- browserStateNode,
82
- React.createElement(DetailPanelButton, { onClick: useBrowserState, ref: browserStateRef }, "Use browser's state"),
83
- diskStateNode,
84
- React.createElement(DetailPanelButton, { onClick: useOnDiskState, ref: diskStateRef }, "Use disk state"))));
85
- };
86
- export default StateConflictRow;
@@ -1,98 +0,0 @@
1
- import getStudio from '@tomorrowevening/theatre-studio/getStudio';
2
- import BasicPopover from '@tomorrowevening/theatre-studio/uiComponents/Popover/BasicPopover';
3
- import usePopover from '@tomorrowevening/theatre-studio/uiComponents/Popover/usePopover';
4
- import React, { useCallback, useState } from 'react';
5
- import styled from 'styled-components';
6
- import DetailPanelButton from '@tomorrowevening/theatre-studio/uiComponents/DetailPanelButton';
7
- import StateConflictRow from './ProjectDetails/StateConflictRow';
8
- import JSZip from 'jszip';
9
- import { notify } from '@tomorrowevening/theatre-studio/notify';
10
- import { getAllPossibleAssetIDs } from '@tomorrowevening/theatre-shared/utils/assets';
11
- const Container = styled.div ``;
12
- const TheExportRow = styled.div `
13
- padding: 8px 10px;
14
- display: flex;
15
- flex-direction: column;
16
- align-items: stretch;
17
- `;
18
- const ExportTooltip = styled(BasicPopover) `
19
- display flex;
20
- flex-direction: column;
21
- gap: 1em;
22
- width: 280px;
23
- padding: 1em;
24
- `;
25
- /**
26
- * Initiates a file download for the provided data with the provided file name
27
- *
28
- * @param content - The content to save
29
- * @param fileName - The name of the file to save
30
- */
31
- function saveFile(content, fileName) {
32
- const file = new File([content], fileName);
33
- const objUrl = URL.createObjectURL(file);
34
- const a = Object.assign(document.createElement('a'), {
35
- href: objUrl,
36
- target: '_blank',
37
- rel: 'noopener',
38
- });
39
- a.setAttribute('download', fileName);
40
- a.click();
41
- setTimeout(() => {
42
- URL.revokeObjectURL(objUrl);
43
- }, 40000);
44
- }
45
- const ProjectDetails = ({ projects }) => {
46
- const project = projects[0];
47
- const projectId = project.address.projectId;
48
- const slugifiedProjectId = projectId.replace(/[^\w\d'_\-]+/g, ' ').trim();
49
- // const [dateString, _timeString] = new Date().toISOString().split('T')
50
- // e.g. `Butterfly.theatre-project-state.json`
51
- const suggestedFileName = `${slugifiedProjectId}.theatre-project-state.json`;
52
- const [downloaded, setDownloaded] = useState(false);
53
- const exportProject = useCallback(async () => {
54
- // get all possible asset ids referenced by either static props or keyframes
55
- const allValues = getAllPossibleAssetIDs(project);
56
- const blobs = new Map();
57
- try {
58
- // only export assets that are referenced by the project
59
- await Promise.all(allValues.map(async (value) => {
60
- const assetUrl = project.assetStorage.getAssetUrl(value);
61
- const response = await fetch(assetUrl);
62
- if (response.ok) {
63
- blobs.set(value, await response.blob());
64
- }
65
- }));
66
- }
67
- catch (e) {
68
- notify.error(`Failed to access assets`, `Export aborted. Failed to access assets at ${project.config.assets?.baseUrl ?? '/'}. This is likely due to a CORS issue.`);
69
- // abort the export
70
- return;
71
- }
72
- if (blobs.size > 0) {
73
- const zip = new JSZip();
74
- for (const [assetID, blob] of blobs) {
75
- zip.file(assetID, blob);
76
- }
77
- const assetsFile = await zip.generateAsync({ type: 'blob' });
78
- saveFile(assetsFile, `${slugifiedProjectId}.assets.zip`);
79
- }
80
- const str = JSON.stringify(getStudio().createContentOfSaveFile(project.address.projectId), null, 2);
81
- saveFile(str, suggestedFileName);
82
- setDownloaded(true);
83
- setTimeout(() => {
84
- setDownloaded(false);
85
- }, 2000);
86
- }, [project, suggestedFileName]);
87
- const exportTooltip = usePopover({ debugName: 'ProjectDetails', pointerDistanceThreshold: 50 }, () => (React.createElement(ExportTooltip, null,
88
- React.createElement("p", null, "This will create a JSON file with the state of your project. You can commit this file to your git repo and include it in your production bundle."),
89
- React.createElement("p", null, "If your project uses assets, this will also create a zip file with all the assets that you can unpack in your public folder."),
90
- React.createElement("a", { href: "https://www.theatrejs.com/docs/latest/manual/projects#state", target: "_blank" }, "Here is a quick guide on how to export to production."))));
91
- return (React.createElement(React.Fragment, null,
92
- exportTooltip.node,
93
- React.createElement(Container, null,
94
- React.createElement(StateConflictRow, { projectId: projectId }),
95
- React.createElement(TheExportRow, null,
96
- React.createElement(DetailPanelButton, { onMouseEnter: (e) => exportTooltip.open(e, e.target), onClick: !downloaded ? exportProject : undefined, disabled: downloaded }, downloaded ? '(Exported)' : `Export ${projectId} to JSON`)))));
97
- };
98
- export default ProjectDetails;
@@ -1,136 +0,0 @@
1
- import React from 'react';
2
- import styled, { css } from 'styled-components';
3
- import noop from '@tomorrowevening/theatre-shared/utils/noop';
4
- import { pointerEventsAutoInNormalMode } from '@tomorrowevening/theatre-studio/css';
5
- import { ChevronDown, Package } from '@tomorrowevening/theatre-studio/uiComponents/icons';
6
- export const Container = styled.li `
7
- margin: 0;
8
- padding: 0;
9
- list-style: none;
10
- display: flex;
11
- justify-content: flex-start;
12
- flex-direction: column;
13
- align-items: flex-start;
14
- `;
15
- export const BaseHeader = styled.div ``;
16
- const Header = styled(BaseHeader) `
17
- position: relative;
18
- margin-top: 2px;
19
- margin-bottom: 2px;
20
- margin-left: calc(4px + var(--depth) * 16px);
21
- padding-left: 4px;
22
- padding-right: 8px;
23
- gap: 4px;
24
- height: 21px;
25
- line-height: 0;
26
- box-sizing: border-box;
27
- display: flex;
28
- flex-wrap: nowrap;
29
- align-items: center;
30
- pointer-events: none;
31
- white-space: nowrap;
32
-
33
- border-radius: 2px;
34
- box-shadow: 0 3px 4px -1px rgba(0, 0, 0, 0.48);
35
-
36
- color: rgba(255, 255, 255, 0.9);
37
- background: rgba(40, 43, 47, 0.65);
38
- backdrop-filter: blur(14px);
39
- border-bottom: 1px solid rgba(255, 255, 255, 0.08);
40
-
41
- &.descendant-is-selected {
42
- background: rgba(29, 53, 59, 0.7);
43
- }
44
-
45
- ${pointerEventsAutoInNormalMode};
46
- &:not(.not-selectable):not(.selected):hover {
47
- background: rgba(59, 63, 69, 0.9);
48
-
49
- border-bottom: 1px solid rgba(255, 255, 255, 0.24);
50
- }
51
-
52
- &:not(.not-selectable):not(.selected):active {
53
- background: rgba(82, 88, 96, 0.9);
54
- border-bottom: 1px solid rgba(255, 255, 255, 0.24);
55
- }
56
-
57
- &.selected {
58
- background: rgba(30, 88, 102, 0.7);
59
- border-bottom: 1px solid rgba(255, 255, 255, 0.08);
60
- }
61
-
62
- @supports not (backdrop-filter: blur()) {
63
- background: rgba(40, 43, 47, 0.95);
64
- }
65
- `;
66
- export const outlineItemFont = css `
67
- font-weight: 500;
68
- font-size: 11px;
69
- & {
70
- }
71
- `;
72
- const Head_Label = styled.span `
73
- ${outlineItemFont};
74
-
75
- ${pointerEventsAutoInNormalMode};
76
- position: relative;
77
- // Compensate for border bottom
78
- top: 0.5px;
79
- display: flex;
80
- height: 20px;
81
- align-items: center;
82
- box-sizing: border-box;
83
- `;
84
- const Head_IconContainer = styled.div `
85
- font-weight: 500;
86
- display: flex;
87
- justify-content: center;
88
- align-items: center;
89
- position: relative;
90
- opacity: 0.99;
91
- `;
92
- const Head_Icon_WithDescendants = styled.span `
93
- font-size: 9px;
94
- position: relative;
95
- display: block;
96
- transition: transform 0.1s ease-out;
97
-
98
- &:hover {
99
- transform: rotate(-20deg);
100
- }
101
-
102
- ${Container}.collapsed & {
103
- transform: rotate(-90deg);
104
-
105
- &:hover {
106
- transform: rotate(-70deg);
107
- }
108
- }
109
- `;
110
- const ChildrenContainer = styled.ul `
111
- margin: 0;
112
- padding: 0;
113
- list-style: none;
114
-
115
- ${Container}.collapsed & {
116
- display: none;
117
- }
118
- `;
119
- const BaseItem = ({ label, children, depth, select, selectionStatus, labelDecoration, collapsed = false, setIsCollapsed, }) => {
120
- const canContainChildren = children !== undefined;
121
- return (React.createElement(Container, { style:
122
- /* @ts-ignore */
123
- { '--depth': depth }, className: collapsed ? 'collapsed' : '' },
124
- React.createElement(Header, { className: selectionStatus, onClick: select ?? noop, "data-header": true },
125
- React.createElement(Head_IconContainer, null, canContainChildren ? (React.createElement(Head_Icon_WithDescendants, { onClick: (evt) => {
126
- evt.stopPropagation();
127
- evt.preventDefault();
128
- setIsCollapsed?.(!collapsed);
129
- } },
130
- React.createElement(ChevronDown, null))) : (React.createElement(Package, null))),
131
- React.createElement(Head_Label, null,
132
- React.createElement("span", null, label)),
133
- labelDecoration),
134
- canContainChildren && React.createElement(ChildrenContainer, null, children)));
135
- };
136
- export default BaseItem;
@@ -1,14 +0,0 @@
1
- import getStudio from '@tomorrowevening/theatre-studio/getStudio';
2
- import React from 'react';
3
- import BaseItem from '@tomorrowevening/theatre-studio/panels/OutlinePanel/BaseItem';
4
- import { usePrism } from '@tomorrowevening/theatre-react';
5
- import { getOutlineSelection } from '@tomorrowevening/theatre-studio/selectors';
6
- export const ObjectItem = ({ sheetObject, depth, overrideLabel }) => {
7
- const select = () => {
8
- getStudio().transaction(({ stateEditors }) => {
9
- stateEditors.studio.historic.panels.outline.selection.set([sheetObject]);
10
- });
11
- };
12
- const selection = usePrism(() => getOutlineSelection(), []);
13
- return (React.createElement(BaseItem, { select: select, label: overrideLabel ?? sheetObject.address.objectKey, depth: depth, selectionStatus: selection.includes(sheetObject) ? 'selected' : 'not-selected' }));
14
- };
@@ -1,85 +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 { ObjectItem } from './ObjectItem';
6
- import BaseItem from '@tomorrowevening/theatre-studio/panels/OutlinePanel/BaseItem';
7
- import { useCollapseStateInOutlinePanel } from '@tomorrowevening/theatre-studio/panels/OutlinePanel/outlinePanelUtils';
8
- export const Li = styled.li `
9
- color: ${(props) => (props.isSelected ? 'white' : 'hsl(1, 1%, 80%)')};
10
- `;
11
- const ObjectsList = ({ sheet, depth }) => {
12
- return usePrism(() => {
13
- const objectsMap = val(sheet.objectsP);
14
- const objects = Object.values(objectsMap).filter((a) => a != null);
15
- const rootObject = new Map();
16
- objects.forEach((object) => {
17
- addToNamespace(rootObject, object);
18
- });
19
- return (React.createElement(NamespaceTree, { namespace: rootObject, visualIndentation: depth, path: [], sheet: sheet }));
20
- }, [sheet, depth]);
21
- };
22
- function NamespaceTree(props) {
23
- return (React.createElement(React.Fragment, null, [...props.namespace.entries()].map(([label, { object, nested }]) => {
24
- return (React.createElement(Namespace, { key: label, label: label, object: object, nested: nested, visualIndentation: props.visualIndentation, path: props.path, sheet: props.sheet }));
25
- })));
26
- }
27
- function Namespace(props) {
28
- const { nested, label, object, sheet } = props;
29
- const { collapsed, setCollapsed } = useCollapseStateInOutlinePanel({
30
- type: 'namespace',
31
- sheet,
32
- path: [...props.path, label],
33
- });
34
- const nestedChildrenElt = nested && (React.createElement(NamespaceTree, { namespace: nested, path: [...props.path, label],
35
- // Question: will there be key conflict if two components have the same labels?
36
- key: 'namespaceTree(' + label + ')', visualIndentation: props.visualIndentation + 1, sheet: sheet }));
37
- const sameNameElt = object && (React.createElement(ObjectItem, { depth: props.visualIndentation,
38
- // key is useful for navigating react dev component tree
39
- key: 'objectPath(' + object.address.objectKey + ')',
40
- // object entries should not allow this to be undefined
41
- sheetObject: object, overrideLabel: label }));
42
- return (React.createElement(React.Fragment, { key: `${label} - ${props.visualIndentation}` },
43
- sameNameElt,
44
- nestedChildrenElt && (React.createElement(BaseItem, { selectionStatus: "not-selectable", label: label,
45
- // key necessary for no duplicate keys (next to other React.Fragments)
46
- key: `baseItem(${label})`, depth: props.visualIndentation, children: nestedChildrenElt, collapsed: collapsed, setIsCollapsed: setCollapsed }))));
47
- }
48
- export default ObjectsList;
49
- function addToNamespace(mutObjects, object, path = getObjectNamespacePath(object)) {
50
- const [next, ...rest] = path;
51
- let existing = mutObjects.get(next);
52
- if (!existing) {
53
- existing = {
54
- nested: undefined,
55
- object: undefined,
56
- path: [...path],
57
- };
58
- mutObjects.set(next, existing);
59
- }
60
- if (rest.length === 0) {
61
- console.assert(!existing.object, 'expect not to have existing object with same name', { existing, object });
62
- existing.object = object;
63
- }
64
- else {
65
- if (!existing.nested) {
66
- existing.nested = new Map();
67
- }
68
- addToNamespace(existing.nested, object, rest);
69
- }
70
- }
71
- function getObjectNamespacePath(object) {
72
- let existing = OBJECT_SPLITS_MEMO.get(object);
73
- if (!existing) {
74
- existing = object.address.objectKey.split(RE_SPLIT_BY_SLASH_WITHOUT_WHITESPACE);
75
- console.assert(existing.length > 0, 'expected not empty');
76
- OBJECT_SPLITS_MEMO.set(object, existing);
77
- }
78
- return existing;
79
- }
80
- /**
81
- * Relying on the fact we try to "sanitize paths" earlier.
82
- * Go look for `sanifySlashedPath` in a `utils/slashedPaths.ts`.
83
- */
84
- const RE_SPLIT_BY_SLASH_WITHOUT_WHITESPACE = /\s*\/\s*/g;
85
- const OBJECT_SPLITS_MEMO = new WeakMap();