@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.
- package/dist/index.js +105 -56
- package/package.json +1 -1
- package/dist/IDBStorage.js +0 -19
- package/dist/PaneManager.js +0 -112
- package/dist/Scrub.js +0 -134
- package/dist/Studio.js +0 -405
- package/dist/StudioBundle.js +0 -21
- package/dist/StudioStore/StudioStore.js +0 -163
- package/dist/StudioStore/createTransactionPrivateApi.js +0 -204
- package/dist/StudioStore/generateDiskStateRevision.js +0 -4
- package/dist/StudioStore/persistStateOfStudio.js +0 -61
- package/dist/TheatreStudio.js +0 -154
- package/dist/UI/UI.js +0 -65
- package/dist/UI/UINonSSRBits.js +0 -60
- package/dist/UIRoot/PanelsRoot.js +0 -19
- package/dist/UIRoot/PointerCapturing.js +0 -96
- package/dist/UIRoot/ProvideTheme.js +0 -9
- package/dist/UIRoot/UIRoot.js +0 -79
- package/dist/UIRoot/useKeyboardShortcuts.js +0 -158
- package/dist/checkForUpdates.js +0 -86
- package/dist/css.js +0 -116
- package/dist/getStudio.js +0 -10
- package/dist/notify.js +0 -328
- package/dist/panels/BasePanel/BasePanel.js +0 -74
- package/dist/panels/BasePanel/ExtensionPaneWrapper.js +0 -138
- package/dist/panels/BasePanel/PanelDragZone.js +0 -88
- package/dist/panels/BasePanel/PanelResizeHandle.js +0 -184
- package/dist/panels/BasePanel/PanelResizers.js +0 -14
- package/dist/panels/BasePanel/PanelWrapper.js +0 -34
- package/dist/panels/BasePanel/common.js +0 -52
- package/dist/panels/DetailPanel/DetailPanel.js +0 -146
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail/DetailCompoundPropEditor.js +0 -169
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail/DetailSimplePropEditor.js +0 -22
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail/SingleRowPropEditor.js +0 -89
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail/getDetailRowHighlightBackground.js +0 -7
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail/rowIndentationFormulaCSS.js +0 -1
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail.js +0 -28
- package/dist/panels/DetailPanel/EmptyState.js +0 -36
- package/dist/panels/DetailPanel/ObjectDetails.js +0 -52
- package/dist/panels/DetailPanel/ProjectDetails/StateConflictRow.js +0 -86
- package/dist/panels/DetailPanel/ProjectDetails.js +0 -98
- package/dist/panels/OutlinePanel/BaseItem.js +0 -136
- package/dist/panels/OutlinePanel/ObjectsList/ObjectItem.js +0 -14
- package/dist/panels/OutlinePanel/ObjectsList/ObjectsList.js +0 -85
- package/dist/panels/OutlinePanel/OutlinePanel.js +0 -73
- package/dist/panels/OutlinePanel/ProjectsList/ProjectListItem.js +0 -38
- package/dist/panels/OutlinePanel/ProjectsList/ProjectsList.js +0 -22
- package/dist/panels/OutlinePanel/SheetsList/SheetInstanceItem.js +0 -36
- package/dist/panels/OutlinePanel/SheetsList/SheetItem.js +0 -23
- package/dist/panels/OutlinePanel/SheetsList/SheetsList.js +0 -15
- package/dist/panels/OutlinePanel/outlinePanelUtils.js +0 -23
- package/dist/panels/SequenceEditorPanel/DopeSheet/DopeSheet.js +0 -21
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/AnyCompositeRow.js +0 -74
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/Left.js +0 -25
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/PrimitivePropRow.js +0 -97
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/PropWithChildrenRow.js +0 -15
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/SheetObjectRow.js +0 -19
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/SheetRow.js +0 -20
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/usePropHighlightMouseEnter.js +0 -33
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/AggregateKeyframeConnector.js +0 -187
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/AggregateKeyframeDot.js +0 -158
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/AggregateKeyframeEditor.js +0 -32
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/AggregateKeyframeVisualDot.js +0 -61
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/iif.js +0 -3
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/useAggregateKeyframeEditorUtils.js +0 -73
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregatedKeyframeTrack.js +0 -407
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/BasicKeyframedTrack.js +0 -108
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/BasicKeyframeConnector.js +0 -185
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/CurveEditorPopover.js +0 -397
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/CurveSegmentEditor.js +0 -136
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/EasingOption.js +0 -52
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/SVGCurveSegment.js +0 -43
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/colors.js +0 -3
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/shared.js +0 -84
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/useFreezableMemo.js +0 -16
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/useUIOptionGrid.js +0 -82
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/DeterminePropEditorForSingleKeyframe.js +0 -93
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/SingleKeyframeDot.js +0 -254
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/SingleKeyframeEditor.js +0 -22
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/useSingleKeyframeInlineEditorPopover.js +0 -11
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/useTempTransactionEditingTools.js +0 -43
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/DopeSheetBackground.js +0 -24
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/DopeSheetSelectionView.js +0 -272
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/FocusRangeCurtains.js +0 -88
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/HorizontallyScrollableArea.js +0 -215
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/KeyframeSnapTarget.js +0 -55
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/LengthIndicator/LengthEditorPopover.js +0 -69
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/LengthIndicator/LengthIndicator.js +0 -217
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/PrimitivePropRow.js +0 -25
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/PropWithChildrenRow.js +0 -18
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/Right.js +0 -30
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/Row.js +0 -50
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/SheetObjectRow.js +0 -14
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/SheetRow.js +0 -14
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/collectAggregateKeyframes.js +0 -92
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/keyframeRowUI/ConnectorLine.js +0 -62
- package/dist/panels/SequenceEditorPanel/DopeSheet/selections.js +0 -149
- package/dist/panels/SequenceEditorPanel/DopeSheet/setCollapsedSheetObjectOrCompoundProp.js +0 -10
- package/dist/panels/SequenceEditorPanel/FrameGrid/FrameGrid.js +0 -92
- package/dist/panels/SequenceEditorPanel/FrameGrid/StampsGrid.js +0 -99
- package/dist/panels/SequenceEditorPanel/FrameGrid/createGrid.js +0 -49
- package/dist/panels/SequenceEditorPanel/FrameStampPositionProvider.js +0 -189
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/BasicKeyframedTrack.js +0 -91
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/Curve.js +0 -87
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/CurveHandle.js +0 -186
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/GraphEditorDotNonScalar.js +0 -162
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/GraphEditorDotScalar.js +0 -209
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/GraphEditorNonScalarDash.js +0 -23
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/KeyframeEditor.js +0 -30
- package/dist/panels/SequenceEditorPanel/GraphEditor/GraphEditor.js +0 -73
- package/dist/panels/SequenceEditorPanel/GraphEditor/PrimitivePropGraph.js +0 -20
- package/dist/panels/SequenceEditorPanel/GraphEditorToggle.js +0 -59
- package/dist/panels/SequenceEditorPanel/RightOverlay/DopeSnap.js +0 -36
- package/dist/panels/SequenceEditorPanel/RightOverlay/DopeSnapHitZoneUI.js +0 -57
- package/dist/panels/SequenceEditorPanel/RightOverlay/FocusRangeZone/FocusRangeStrip.js +0 -233
- package/dist/panels/SequenceEditorPanel/RightOverlay/FocusRangeZone/FocusRangeThumb.js +0 -217
- package/dist/panels/SequenceEditorPanel/RightOverlay/FocusRangeZone/FocusRangeZone.js +0 -181
- package/dist/panels/SequenceEditorPanel/RightOverlay/FrameStamp.js +0 -65
- package/dist/panels/SequenceEditorPanel/RightOverlay/HorizontalScrollbar.js +0 -235
- package/dist/panels/SequenceEditorPanel/RightOverlay/Markers/MarkerDot.js +0 -184
- package/dist/panels/SequenceEditorPanel/RightOverlay/Markers/MarkerEditorPopover.js +0 -65
- package/dist/panels/SequenceEditorPanel/RightOverlay/Markers/Markers.js +0 -13
- package/dist/panels/SequenceEditorPanel/RightOverlay/Playhead.js +0 -265
- package/dist/panels/SequenceEditorPanel/RightOverlay/PlayheadPositionPopover.js +0 -64
- package/dist/panels/SequenceEditorPanel/RightOverlay/RightOverlay.js +0 -35
- package/dist/panels/SequenceEditorPanel/RightOverlay/TopStrip.js +0 -31
- package/dist/panels/SequenceEditorPanel/SequenceEditorPanel.js +0 -179
- package/dist/panels/SequenceEditorPanel/VerticalScrollContainer.js +0 -42
- package/dist/panels/SequenceEditorPanel/layout/layout.js +0 -166
- package/dist/panels/SequenceEditorPanel/layout/tree.js +0 -139
- package/dist/panels/SequenceEditorPanel/whatPropIsHighlighted.js +0 -58
- package/dist/propEditors/DefaultValueIndicator.js +0 -64
- package/dist/propEditors/NextPrevKeyframeCursors.js +0 -135
- package/dist/propEditors/getNearbyKeyframesOfTrack.js +0 -46
- package/dist/propEditors/simpleEditors/BooleanPropEditor.js +0 -17
- package/dist/propEditors/simpleEditors/FilePropEditor.js +0 -118
- package/dist/propEditors/simpleEditors/ISimplePropEditorReactProps.js +0 -1
- package/dist/propEditors/simpleEditors/ImagePropEditor.js +0 -126
- package/dist/propEditors/simpleEditors/NumberPropEditor.js +0 -9
- package/dist/propEditors/simpleEditors/RgbaPropEditor.js +0 -73
- package/dist/propEditors/simpleEditors/StringLiteralPropEditor.js +0 -10
- package/dist/propEditors/simpleEditors/StringPropEditor.js +0 -6
- package/dist/propEditors/simpleEditors/simplePropEditorByPropType.js +0 -16
- package/dist/propEditors/useEditingToolsForCompoundProp.js +0 -228
- package/dist/propEditors/useEditingToolsForSimpleProp.js +0 -229
- package/dist/propEditors/utils/IEditingTools.js +0 -1
- package/dist/propEditors/utils/PropConfigForType.js +0 -1
- package/dist/propEditors/utils/getPropTypeByPointer.js +0 -48
- package/dist/propEditors/utils/propNameTextCSS.js +0 -7
- package/dist/selectors.js +0 -63
- package/dist/store/index.js +0 -184
- package/dist/store/stateEditors.js +0 -774
- package/dist/store/types/ahistoric.js +0 -1
- package/dist/store/types/ephemeral.js +0 -1
- package/dist/store/types/historic.js +0 -1
- package/dist/store/types/index.js +0 -3
- package/dist/toolbars/ExtensionToolbar/ExtensionToolbar.js +0 -51
- package/dist/toolbars/ExtensionToolbar/Toolset.js +0 -27
- package/dist/toolbars/ExtensionToolbar/tools/ExtensionFlyoutMenu.js +0 -51
- package/dist/toolbars/ExtensionToolbar/tools/IconButton.js +0 -16
- package/dist/toolbars/ExtensionToolbar/tools/Switch.js +0 -20
- package/dist/toolbars/GlobalToolbar.js +0 -142
- package/dist/toolbars/MoreMenu/MoreMenu.js +0 -133
- package/dist/toolbars/PinButton.js +0 -26
- package/dist/uiComponents/DetailPanelButton.js +0 -21
- package/dist/uiComponents/PointerEventsHandler.js +0 -80
- package/dist/uiComponents/Popover/ArrowContext.js +0 -3
- package/dist/uiComponents/Popover/BasicPopover.js +0 -35
- package/dist/uiComponents/Popover/BasicTooltip.js +0 -10
- package/dist/uiComponents/Popover/ErrorTooltip.js +0 -9
- package/dist/uiComponents/Popover/MinimalTooltip.js +0 -6
- package/dist/uiComponents/Popover/PopoverArrow.js +0 -38
- package/dist/uiComponents/Popover/TooltipContext.js +0 -46
- package/dist/uiComponents/Popover/TooltipWrapper.js +0 -103
- package/dist/uiComponents/Popover/usePopover.js +0 -132
- package/dist/uiComponents/Popover/useTooltip.js +0 -33
- package/dist/uiComponents/RoomToClick.js +0 -10
- package/dist/uiComponents/SVGIcon.js +0 -19
- package/dist/uiComponents/ShowMousePosition.js +0 -30
- package/dist/uiComponents/colorPicker/components/EditingProvider.js +0 -15
- package/dist/uiComponents/colorPicker/components/RgbaColorPicker.js +0 -31
- package/dist/uiComponents/colorPicker/components/common/Alpha.js +0 -54
- package/dist/uiComponents/colorPicker/components/common/AlphaColorPicker.js +0 -28
- package/dist/uiComponents/colorPicker/components/common/Hue.js +0 -41
- package/dist/uiComponents/colorPicker/components/common/Interactive.js +0 -142
- package/dist/uiComponents/colorPicker/components/common/Pointer.js +0 -39
- package/dist/uiComponents/colorPicker/components/common/Saturation.js +0 -44
- package/dist/uiComponents/colorPicker/hooks/useColorManipulation.js +0 -77
- package/dist/uiComponents/colorPicker/hooks/useEventCallback.js +0 -10
- package/dist/uiComponents/colorPicker/hooks/useIsomorphicLayoutEffect.js +0 -5
- package/dist/uiComponents/colorPicker/index.js +0 -1
- package/dist/uiComponents/colorPicker/types.js +0 -1
- package/dist/uiComponents/colorPicker/utils/clamp.js +0 -6
- package/dist/uiComponents/colorPicker/utils/compare.js +0 -25
- package/dist/uiComponents/colorPicker/utils/convert.js +0 -165
- package/dist/uiComponents/colorPicker/utils/round.js +0 -3
- package/dist/uiComponents/colorPicker/utils/validate.js +0 -10
- package/dist/uiComponents/createCursorLock.js +0 -2
- package/dist/uiComponents/form/BasicCheckbox.js +0 -5
- package/dist/uiComponents/form/BasicNumberInput.js +0 -261
- package/dist/uiComponents/form/BasicSelect.js +0 -58
- package/dist/uiComponents/form/BasicStringInput.js +0 -151
- package/dist/uiComponents/form/BasicSwitch.js +0 -60
- package/dist/uiComponents/icons/AddImage.js +0 -6
- package/dist/uiComponents/icons/ArrowClockwise.js +0 -6
- package/dist/uiComponents/icons/ArrowsOutCardinal.js +0 -6
- package/dist/uiComponents/icons/Bell.js +0 -6
- package/dist/uiComponents/icons/Camera.js +0 -7
- package/dist/uiComponents/icons/ChevronDown.js +0 -6
- package/dist/uiComponents/icons/ChevronLeft.js +0 -6
- package/dist/uiComponents/icons/ChevronRight.js +0 -6
- package/dist/uiComponents/icons/Cube.js +0 -6
- package/dist/uiComponents/icons/CubeFull.js +0 -6
- package/dist/uiComponents/icons/CubeHalf.js +0 -6
- package/dist/uiComponents/icons/CubeRendered.js +0 -7
- package/dist/uiComponents/icons/Details.js +0 -6
- package/dist/uiComponents/icons/DoubleChevronLeft.js +0 -6
- package/dist/uiComponents/icons/DoubleChevronRight.js +0 -6
- package/dist/uiComponents/icons/Ellipsis.js +0 -6
- package/dist/uiComponents/icons/EllipsisFill.js +0 -6
- package/dist/uiComponents/icons/GlobeSimple.js +0 -6
- package/dist/uiComponents/icons/Outline.js +0 -6
- package/dist/uiComponents/icons/Package.js +0 -6
- package/dist/uiComponents/icons/Resize.js +0 -7
- package/dist/uiComponents/icons/Trash.js +0 -6
- package/dist/uiComponents/icons/index.js +0 -20
- package/dist/uiComponents/isSafari.js +0 -2
- package/dist/uiComponents/onPointerOutside.js +0 -19
- package/dist/uiComponents/selects/BasicSelect.js +0 -24
- package/dist/uiComponents/simpleContextMenu/ContextMenu/BaseMenu.js +0 -40
- package/dist/uiComponents/simpleContextMenu/ContextMenu/ContextMenu.js +0 -87
- package/dist/uiComponents/simpleContextMenu/ContextMenu/Item.js +0 -37
- package/dist/uiComponents/simpleContextMenu/useContextMenu.js +0 -20
- package/dist/uiComponents/simpleContextMenu/useRequestContextMenu.js +0 -22
- package/dist/uiComponents/toolbar/ToolbarDropdownSelect.js +0 -7
- package/dist/uiComponents/toolbar/ToolbarIconButton.js +0 -74
- package/dist/uiComponents/toolbar/ToolbarSwitchSelect.js +0 -12
- package/dist/uiComponents/toolbar/ToolbarSwitchSelectContainer.js +0 -9
- package/dist/uiComponents/useBoundingClientRect.js +0 -13
- package/dist/uiComponents/useDebugRefreshEvery.js +0 -19
- package/dist/uiComponents/useDrag.js +0 -199
- package/dist/uiComponents/useHotspot.js +0 -30
- package/dist/uiComponents/useHover.js +0 -23
- package/dist/uiComponents/useHoverWithoutDescendants.js +0 -33
- package/dist/uiComponents/useKeyDown.js +0 -9
- package/dist/uiComponents/useKeyDownCallback.js +0 -28
- package/dist/uiComponents/useLockSet.js +0 -17
- package/dist/uiComponents/useLogger.js +0 -16
- package/dist/uiComponents/useOnClickOutside.js +0 -25
- package/dist/uiComponents/useOnKeyDown.js +0 -12
- package/dist/uiComponents/usePresence.js +0 -156
- package/dist/uiComponents/useValToAtom.js +0 -11
- package/dist/utils/absoluteDims.js +0 -7
- package/dist/utils/contextualWebComponents.js +0 -44
- package/dist/utils/copyToClipboard.js +0 -28
- package/dist/utils/derive-utils.js +0 -61
- package/dist/utils/devStringify.js +0 -20
- package/dist/utils/invariant.js +0 -79
- package/dist/utils/isMac.js +0 -2
- package/dist/utils/keyboardUtils.js +0 -23
- package/dist/utils/mousePositionD.js +0 -18
- package/dist/utils/redux/actionCreator.js +0 -15
- package/dist/utils/redux/actionCreator.test.js +0 -35
- package/dist/utils/redux/actionReducersBundle.js +0 -18
- package/dist/utils/redux/atomFromReduxStore.js +0 -11
- package/dist/utils/redux/configureStore.js +0 -18
- package/dist/utils/redux/pointerFriendlySelector.js +0 -8
- package/dist/utils/redux/withHistory/withBatchActions.js +0 -13
- package/dist/utils/redux/withHistory/withHistory.js +0 -157
- package/dist/utils/renderInPortalInContext.js +0 -38
- package/dist/utils/selectClosestHTMLAncestor.js +0 -13
- package/dist/utils/tightJsonStringify.js +0 -27
- package/dist/utils/tightJsonStringify.test.js +0 -25
- package/dist/utils/useRefAndState.js +0 -32
package/dist/StudioBundle.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export default class StudioBundle {
|
|
2
|
-
_studio;
|
|
3
|
-
_coreBundle;
|
|
4
|
-
constructor(_studio) {
|
|
5
|
-
this._studio = _studio;
|
|
6
|
-
}
|
|
7
|
-
get type() {
|
|
8
|
-
return 'Theatre_StudioBundle';
|
|
9
|
-
}
|
|
10
|
-
registerCoreBundle(coreBundle) {
|
|
11
|
-
if (this._coreBundle) {
|
|
12
|
-
throw new Error(`StudioBundle.coreBundle is already registered. This is a bug.`);
|
|
13
|
-
}
|
|
14
|
-
this._coreBundle = coreBundle;
|
|
15
|
-
let coreBits;
|
|
16
|
-
coreBundle.getBitsForStudio(this._studio, (bits) => {
|
|
17
|
-
coreBits = bits;
|
|
18
|
-
});
|
|
19
|
-
this._studio.setCoreBits(coreBits);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { studioActions, studioReducer, tempActionGroup, } from '@tomorrowevening/theatre-studio/store';
|
|
2
|
-
import { setDrafts__onlyMeantToBeCalledByTransaction } from '@tomorrowevening/theatre-studio/store/stateEditors';
|
|
3
|
-
import { defer } from '@tomorrowevening/theatre-shared/utils/defer';
|
|
4
|
-
import atomFromReduxStore from '@tomorrowevening/theatre-studio/utils/redux/atomFromReduxStore';
|
|
5
|
-
import configureStore from '@tomorrowevening/theatre-studio/utils/redux/configureStore';
|
|
6
|
-
import { createDraft, finishDraft } from 'immer';
|
|
7
|
-
import { __experimental_clearPersistentStorage, persistStateOfStudio, } from './persistStateOfStudio';
|
|
8
|
-
import { generateDiskStateRevision } from './generateDiskStateRevision';
|
|
9
|
-
import cloneDeep from 'lodash-es/cloneDeep';
|
|
10
|
-
import createTransactionPrivateApi from './createTransactionPrivateApi';
|
|
11
|
-
export default class StudioStore {
|
|
12
|
-
_reduxStore;
|
|
13
|
-
_atom;
|
|
14
|
-
atomP;
|
|
15
|
-
constructor() {
|
|
16
|
-
this._reduxStore = configureStore({
|
|
17
|
-
rootReducer: studioReducer,
|
|
18
|
-
devtoolsOptions: { name: 'Theatre.js Studio' },
|
|
19
|
-
});
|
|
20
|
-
this._atom = atomFromReduxStore(this._reduxStore);
|
|
21
|
-
this.atomP = this._atom.pointer;
|
|
22
|
-
}
|
|
23
|
-
initialize(opts) {
|
|
24
|
-
const d = defer();
|
|
25
|
-
if (opts.usePersistentStorage === true) {
|
|
26
|
-
persistStateOfStudio(this._reduxStore, () => {
|
|
27
|
-
this.tempTransaction(({ drafts }) => {
|
|
28
|
-
drafts.ephemeral.initialised = true;
|
|
29
|
-
}).commit();
|
|
30
|
-
d.resolve();
|
|
31
|
-
}, opts.persistenceKey);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
this.tempTransaction(({ drafts }) => {
|
|
35
|
-
drafts.ephemeral.initialised = true;
|
|
36
|
-
}).commit();
|
|
37
|
-
d.resolve();
|
|
38
|
-
}
|
|
39
|
-
return d.promise;
|
|
40
|
-
}
|
|
41
|
-
getState() {
|
|
42
|
-
return this._reduxStore.getState();
|
|
43
|
-
}
|
|
44
|
-
__experimental_clearPersistentStorage(persistenceKey) {
|
|
45
|
-
__experimental_clearPersistentStorage(this._reduxStore, persistenceKey);
|
|
46
|
-
return this.getState();
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* This method causes the store to start the history from scratch. This is useful
|
|
50
|
-
* for testing and development where you want to explicitly provide a state to the
|
|
51
|
-
* store.
|
|
52
|
-
*/
|
|
53
|
-
__dev_startHistoryFromScratch(newHistoricPart) {
|
|
54
|
-
this._reduxStore.dispatch(studioActions.historic.startHistoryFromScratch(studioActions.reduceParts((s) => ({ ...s, historic: newHistoricPart }))));
|
|
55
|
-
}
|
|
56
|
-
tempTransaction(fn) {
|
|
57
|
-
const group = tempActionGroup();
|
|
58
|
-
let errorDuringTransaction = undefined;
|
|
59
|
-
const action = group.push(studioActions.reduceParts((wholeState) => {
|
|
60
|
-
const drafts = {
|
|
61
|
-
historic: createDraft(wholeState.historic),
|
|
62
|
-
ahistoric: createDraft(wholeState.ahistoric),
|
|
63
|
-
ephemeral: createDraft(wholeState.ephemeral),
|
|
64
|
-
};
|
|
65
|
-
let running = true;
|
|
66
|
-
let ensureRunning = () => {
|
|
67
|
-
if (!running) {
|
|
68
|
-
throw new Error(`You seem to have called the transaction api after studio.transaction() has finished running`);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
const stateEditors = setDrafts__onlyMeantToBeCalledByTransaction(drafts);
|
|
72
|
-
const api = createTransactionPrivateApi(ensureRunning, stateEditors, drafts);
|
|
73
|
-
try {
|
|
74
|
-
fn(api);
|
|
75
|
-
running = false;
|
|
76
|
-
return {
|
|
77
|
-
historic: finishDraft(drafts.historic),
|
|
78
|
-
ahistoric: finishDraft(drafts.ahistoric),
|
|
79
|
-
ephemeral: finishDraft(drafts.ephemeral),
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
catch (err) {
|
|
83
|
-
errorDuringTransaction = err;
|
|
84
|
-
return wholeState;
|
|
85
|
-
}
|
|
86
|
-
finally {
|
|
87
|
-
setDrafts__onlyMeantToBeCalledByTransaction(undefined);
|
|
88
|
-
}
|
|
89
|
-
}));
|
|
90
|
-
this._reduxStore.dispatch(action);
|
|
91
|
-
if (errorDuringTransaction) {
|
|
92
|
-
this._reduxStore.dispatch(group.discard());
|
|
93
|
-
// eslint-disable-next-line @typescript-eslint/no-throw-literal
|
|
94
|
-
throw errorDuringTransaction;
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
commit: () => {
|
|
98
|
-
this._reduxStore.dispatch(group.commit());
|
|
99
|
-
},
|
|
100
|
-
discard: () => {
|
|
101
|
-
this._reduxStore.dispatch(group.discard());
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
undo() {
|
|
106
|
-
this._reduxStore.dispatch(studioActions.historic.undo());
|
|
107
|
-
}
|
|
108
|
-
redo() {
|
|
109
|
-
this._reduxStore.dispatch(studioActions.historic.redo());
|
|
110
|
-
}
|
|
111
|
-
createContentOfSaveFile(projectId) {
|
|
112
|
-
const projectState = this._reduxStore.getState().$persistent.historic.innerState.coreByProject[projectId];
|
|
113
|
-
if (!projectState) {
|
|
114
|
-
throw new Error(`Project ${projectId} has not been initialized.`);
|
|
115
|
-
}
|
|
116
|
-
const revision = generateDiskStateRevision();
|
|
117
|
-
this.tempTransaction(({ stateEditors }) => {
|
|
118
|
-
stateEditors.coreByProject.historic.revisionHistory.add({
|
|
119
|
-
projectId,
|
|
120
|
-
revision,
|
|
121
|
-
});
|
|
122
|
-
}).commit();
|
|
123
|
-
const projectHistoricState = this._reduxStore.getState().$persistent.historic.innerState.coreByProject[projectId];
|
|
124
|
-
const studioState = this._reduxStore.getState().$persistent.historic.innerState.projects
|
|
125
|
-
?.stateByProjectId[projectId];
|
|
126
|
-
const generatedOnDiskState = cloneDeep(projectHistoricState);
|
|
127
|
-
// Copy markers from studio state to the exported state
|
|
128
|
-
if (studioState?.stateBySheetId) {
|
|
129
|
-
for (const [sheetId, sheetState] of Object.entries(studioState.stateBySheetId)) {
|
|
130
|
-
if (sheetState?.sequenceEditor?.markerSet) {
|
|
131
|
-
const markerSet = sheetState.sequenceEditor.markerSet;
|
|
132
|
-
if (markerSet.allIds && Object.keys(markerSet.allIds).length > 0) {
|
|
133
|
-
// Ensure the sheet exists in the generated state
|
|
134
|
-
if (!generatedOnDiskState.sheetsById[sheetId]) {
|
|
135
|
-
generatedOnDiskState.sheetsById[sheetId] = {
|
|
136
|
-
staticOverrides: { byObject: {} },
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
const sheet = generatedOnDiskState.sheetsById[sheetId];
|
|
140
|
-
if (sheet !== undefined) {
|
|
141
|
-
// Ensure the sequence exists
|
|
142
|
-
if (!sheet.sequence) {
|
|
143
|
-
sheet.sequence = {
|
|
144
|
-
type: 'PositionalSequence',
|
|
145
|
-
length: 10,
|
|
146
|
-
subUnitsPerUnit: 30,
|
|
147
|
-
tracksByObject: {},
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
// Convert PointableSet to array
|
|
151
|
-
const markers = Object.entries(markerSet.byId)
|
|
152
|
-
.map(([id, marker]) => marker)
|
|
153
|
-
.filter((marker) => marker !== undefined)
|
|
154
|
-
.sort((a, b) => a.position - b.position);
|
|
155
|
-
sheet.sequence.markers = markers;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return generatedOnDiskState;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import { isSequence, isSheetObject } from '@tomorrowevening/theatre-shared/instanceTypes';
|
|
2
|
-
import get from 'lodash-es/get';
|
|
3
|
-
import isInteger from 'lodash-es/isInteger';
|
|
4
|
-
import forEachPropDeep from '@tomorrowevening/theatre-shared/utils/forEachDeep';
|
|
5
|
-
import getDeep from '@tomorrowevening/theatre-shared/utils/getDeep';
|
|
6
|
-
import { getPointerParts } from '@tomorrowevening/theatre-dataverse';
|
|
7
|
-
import { getPropConfigByPath } from '@tomorrowevening/theatre-shared/propTypes/utils';
|
|
8
|
-
import { isPlainObject } from 'lodash-es';
|
|
9
|
-
import userReadableTypeOfValue from '@tomorrowevening/theatre-shared/utils/userReadableTypeOfValue';
|
|
10
|
-
/**
|
|
11
|
-
* Deep-clones a plain JS object or a `string | number | boolean`. In case of a plain
|
|
12
|
-
* object, all its sub-props that aren't `string | number | boolean` get pruned. Also,
|
|
13
|
-
* all empty objects (i.e. `{}`) get pruned.
|
|
14
|
-
*
|
|
15
|
-
* This is only used by {@link ITransactionPrivateApi.set} and it follows the global rule
|
|
16
|
-
* that values pointed to by `object.props[...]` are never `null | undefined` or an empty object.
|
|
17
|
-
*/
|
|
18
|
-
function cloneDeepSerializableAndPrune(v) {
|
|
19
|
-
if (typeof v === 'boolean' ||
|
|
20
|
-
typeof v === 'string' ||
|
|
21
|
-
typeof v === 'number') {
|
|
22
|
-
return v;
|
|
23
|
-
}
|
|
24
|
-
else if (isPlainObject(v)) {
|
|
25
|
-
const cloned = {};
|
|
26
|
-
let clonedAtLeastOneProp = false;
|
|
27
|
-
for (const [key, val] of Object.entries(v)) {
|
|
28
|
-
const clonedVal = cloneDeepSerializableAndPrune(val);
|
|
29
|
-
if (clonedVal !== undefined) {
|
|
30
|
-
cloned[key] = val;
|
|
31
|
-
clonedAtLeastOneProp = true;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (clonedAtLeastOneProp) {
|
|
35
|
-
return cloned;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* TODO replace with {@link iteratePropType}
|
|
44
|
-
*/
|
|
45
|
-
function forEachDeepSimplePropOfCompoundProp(propType, path, callback) {
|
|
46
|
-
for (const [key, subType] of Object.entries(propType.props)) {
|
|
47
|
-
if (subType.type === 'compound') {
|
|
48
|
-
forEachDeepSimplePropOfCompoundProp(subType, [...path, key], callback);
|
|
49
|
-
}
|
|
50
|
-
else if (subType.type === 'enum') {
|
|
51
|
-
throw new Error(`Not yet implemented`);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
callback(subType, [...path, key]);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
export default function createTransactionPrivateApi(ensureRunning, stateEditors, drafts) {
|
|
59
|
-
return {
|
|
60
|
-
set: (pointer, value) => {
|
|
61
|
-
ensureRunning();
|
|
62
|
-
const _value = cloneDeepSerializableAndPrune(value);
|
|
63
|
-
if (typeof _value === 'undefined')
|
|
64
|
-
return;
|
|
65
|
-
const { root, path } = getPointerParts(pointer);
|
|
66
|
-
if (isSheetObject(root)) {
|
|
67
|
-
const sequenceTracksTree = root.template
|
|
68
|
-
.getMapOfValidSequenceTracks_forStudio()
|
|
69
|
-
.getValue();
|
|
70
|
-
const propConfig = getPropConfigByPath(root.template.staticConfig, path);
|
|
71
|
-
if (!propConfig) {
|
|
72
|
-
throw new Error(`Object ${root.address.objectKey} does not have a prop at ${JSON.stringify(path)}`);
|
|
73
|
-
}
|
|
74
|
-
// if (isPropConfigComposite(propConfig)) {
|
|
75
|
-
// propConfig.validate(_value)
|
|
76
|
-
// } else {
|
|
77
|
-
// propConfig.validate(_value)
|
|
78
|
-
// }
|
|
79
|
-
const setStaticOrKeyframeProp = (value, propConfig, path) => {
|
|
80
|
-
if (value === undefined || value === null) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const deserialized = cloneDeepSerializableAndPrune(propConfig.deserializeAndSanitize(value));
|
|
84
|
-
if (deserialized === undefined) {
|
|
85
|
-
throw new Error(`Invalid value ${userReadableTypeOfValue(value)} for object.props${path
|
|
86
|
-
.map((key) => `[${JSON.stringify(key)}]`)
|
|
87
|
-
.join('')} is invalid`);
|
|
88
|
-
}
|
|
89
|
-
const propAddress = { ...root.address, pathToProp: path };
|
|
90
|
-
const trackId = get(sequenceTracksTree, path);
|
|
91
|
-
if (typeof trackId === 'string') {
|
|
92
|
-
const seq = root.sheet.getSequence();
|
|
93
|
-
seq.position = seq.closestGridPosition(seq.position);
|
|
94
|
-
stateEditors.coreByProject.historic.sheetsById.sequence.setKeyframeAtPosition({
|
|
95
|
-
...propAddress,
|
|
96
|
-
trackId,
|
|
97
|
-
position: seq.position,
|
|
98
|
-
value: value,
|
|
99
|
-
snappingFunction: seq.closestGridPosition,
|
|
100
|
-
type: 'bezier',
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
stateEditors.coreByProject.historic.sheetsById.staticOverrides.byObject.setValueOfPrimitiveProp({ ...propAddress, value: value });
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
if (propConfig.type === 'compound') {
|
|
108
|
-
const pathToTopPointer = getPointerParts(pointer).path;
|
|
109
|
-
const lengthOfTopPointer = pathToTopPointer.length;
|
|
110
|
-
// If we are dealing with a compound prop, we recurse through its
|
|
111
|
-
// nested properties.
|
|
112
|
-
forEachDeepSimplePropOfCompoundProp(propConfig, pathToTopPointer, (primitivePropConfig, pathToProp) => {
|
|
113
|
-
const pathToPropInProvidedValue = pathToProp.slice(lengthOfTopPointer);
|
|
114
|
-
const v = getDeep(_value, pathToPropInProvidedValue);
|
|
115
|
-
if (typeof v !== 'undefined') {
|
|
116
|
-
setStaticOrKeyframeProp(v, primitivePropConfig, pathToProp);
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
throw new Error(`Property object.props${pathToProp
|
|
120
|
-
.map((key) => `[${JSON.stringify(key)}]`)
|
|
121
|
-
.join('')} is required but not provided`);
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
else if (propConfig.type === 'enum') {
|
|
126
|
-
throw new Error(`Enums aren't implemented yet`);
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
setStaticOrKeyframeProp(_value, propConfig, path);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
else if (isSequence(root)) {
|
|
133
|
-
const [prop] = path;
|
|
134
|
-
if (prop === 'subUnitsPerUnit') {
|
|
135
|
-
if (typeof _value !== 'number' || !isInteger(_value) || _value < 1) {
|
|
136
|
-
throw new Error(`Value ${_value} is not an integer, which is required for setting sequence prop ${prop}`);
|
|
137
|
-
}
|
|
138
|
-
stateEditors.coreByProject.historic.sheetsById.sequence.setSubUnitsPerUnit({
|
|
139
|
-
...root.address,
|
|
140
|
-
subUnitsPerUnit: _value,
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
else if (prop === 'length') {
|
|
144
|
-
if (typeof _value !== 'number' || _value <= 0.001) {
|
|
145
|
-
throw new Error(`Value ${_value} is not a positive number, which is required for setting sequence prop ${prop}`);
|
|
146
|
-
}
|
|
147
|
-
stateEditors.coreByProject.historic.sheetsById.sequence.setLength({
|
|
148
|
-
...root.address,
|
|
149
|
-
length: _value,
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
throw new Error(`Setting sequence prop ${prop} is not supported`);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
throw new Error('Only setting props of SheetObject-s and sequences is supported in a transaction so far');
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
unset: (pointer) => {
|
|
161
|
-
ensureRunning();
|
|
162
|
-
const { root, path } = getPointerParts(pointer);
|
|
163
|
-
if (isSheetObject(root)) {
|
|
164
|
-
const sequenceTracksTree = root.template
|
|
165
|
-
.getMapOfValidSequenceTracks_forStudio()
|
|
166
|
-
.getValue();
|
|
167
|
-
const defaultValue = getDeep(root.template.getDefaultValues().getValue(), path);
|
|
168
|
-
const propConfig = getPropConfigByPath(root.template.staticConfig, path);
|
|
169
|
-
const unsetStaticOrKeyframeProp = (value, path) => {
|
|
170
|
-
const propAddress = { ...root.address, pathToProp: path };
|
|
171
|
-
const trackId = get(sequenceTracksTree, path);
|
|
172
|
-
if (typeof trackId === 'string') {
|
|
173
|
-
stateEditors.coreByProject.historic.sheetsById.sequence.unsetKeyframeAtPosition({
|
|
174
|
-
...propAddress,
|
|
175
|
-
trackId,
|
|
176
|
-
position: root.sheet.getSequence().positionSnappedToGrid,
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
else if (propConfig !== undefined) {
|
|
180
|
-
stateEditors.coreByProject.historic.sheetsById.staticOverrides.byObject.unsetValueOfPrimitiveProp(propAddress);
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
if (propConfig.type === 'compound') {
|
|
184
|
-
forEachPropDeep(defaultValue, (v, pathToProp) => {
|
|
185
|
-
unsetStaticOrKeyframeProp(v, pathToProp);
|
|
186
|
-
}, getPointerParts(pointer).path);
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
unsetStaticOrKeyframeProp(defaultValue, path);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
throw new Error('Only setting props of SheetObject-s is supported in a transaction so far');
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
get drafts() {
|
|
197
|
-
ensureRunning();
|
|
198
|
-
return drafts;
|
|
199
|
-
},
|
|
200
|
-
get stateEditors() {
|
|
201
|
-
return stateEditors;
|
|
202
|
-
},
|
|
203
|
-
};
|
|
204
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import logger from '@tomorrowevening/theatre-shared/logger';
|
|
2
|
-
import { studioActions } from '@tomorrowevening/theatre-studio/store';
|
|
3
|
-
import debounce from 'lodash-es/debounce';
|
|
4
|
-
const lastStateByStore = new WeakMap();
|
|
5
|
-
export const persistStateOfStudio = (reduxStore, onInitialize, localStoragePrefix) => {
|
|
6
|
-
const loadState = (s) => {
|
|
7
|
-
reduxStore.dispatch(studioActions.replacePersistentState(s));
|
|
8
|
-
};
|
|
9
|
-
const storageKey = getStorageKey(localStoragePrefix);
|
|
10
|
-
const getState = () => reduxStore.getState().$persistent;
|
|
11
|
-
loadFromPersistentStorage();
|
|
12
|
-
const persist = () => {
|
|
13
|
-
const newState = getState();
|
|
14
|
-
const lastState = lastStateByStore.get(reduxStore);
|
|
15
|
-
if (newState === lastState)
|
|
16
|
-
return;
|
|
17
|
-
lastStateByStore.set(reduxStore, newState);
|
|
18
|
-
localStorage.setItem(storageKey, JSON.stringify(newState));
|
|
19
|
-
};
|
|
20
|
-
reduxStore.subscribe(debounce(persist, 1000));
|
|
21
|
-
if (window) {
|
|
22
|
-
window.addEventListener('beforeunload', persist);
|
|
23
|
-
}
|
|
24
|
-
function loadFromPersistentStorage() {
|
|
25
|
-
const persistedS = localStorage.getItem(storageKey);
|
|
26
|
-
if (persistedS) {
|
|
27
|
-
let persistedObj;
|
|
28
|
-
let errored = true;
|
|
29
|
-
try {
|
|
30
|
-
persistedObj = JSON.parse(persistedS);
|
|
31
|
-
errored = false;
|
|
32
|
-
}
|
|
33
|
-
catch (e) {
|
|
34
|
-
logger.warn(`Could not parse Theatre's persisted state. This must be a bug. Please report it.`);
|
|
35
|
-
}
|
|
36
|
-
finally {
|
|
37
|
-
if (!errored) {
|
|
38
|
-
loadState(persistedObj);
|
|
39
|
-
}
|
|
40
|
-
onInitialize();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
onInitialize();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
export const __experimental_clearPersistentStorage = (reduxStore, localStoragePrefix) => {
|
|
49
|
-
// This removes the persisted state from localStorage,
|
|
50
|
-
// while also preventing the current state from being persisted on window unload.
|
|
51
|
-
// Once the new storage PR lands, this method won't be needed anymore.
|
|
52
|
-
const storageKey = getStorageKey(localStoragePrefix);
|
|
53
|
-
const currentState = reduxStore.getState().$persistent;
|
|
54
|
-
localStorage.removeItem(storageKey);
|
|
55
|
-
// prevent the current state from being persistent on window unload,
|
|
56
|
-
// unless further state changes are made.
|
|
57
|
-
lastStateByStore.set(reduxStore, currentState);
|
|
58
|
-
};
|
|
59
|
-
function getStorageKey(localStoragePrefix) {
|
|
60
|
-
return localStoragePrefix + '.persistent';
|
|
61
|
-
}
|
package/dist/TheatreStudio.js
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { prism } from '@tomorrowevening/theatre-dataverse';
|
|
2
|
-
import SimpleCache from '@tomorrowevening/theatre-shared/utils/SimpleCache';
|
|
3
|
-
import { isSheetObjectPublicAPI, isSheetPublicAPI, } from '@tomorrowevening/theatre-shared/instanceTypes';
|
|
4
|
-
import { getOutlineSelection } from './selectors';
|
|
5
|
-
import getStudio from './getStudio';
|
|
6
|
-
import { debounce } from 'lodash-es';
|
|
7
|
-
import { __experimental_disblePlayPauseKeyboardShortcut, __experimental_enablePlayPauseKeyboardShortcut, } from './UIRoot/useKeyboardShortcuts';
|
|
8
|
-
export default class TheatreStudio {
|
|
9
|
-
ui = {
|
|
10
|
-
hide() {
|
|
11
|
-
getStudio().ui.hide();
|
|
12
|
-
},
|
|
13
|
-
get isHidden() {
|
|
14
|
-
return getStudio().ui.isHidden;
|
|
15
|
-
},
|
|
16
|
-
restore() {
|
|
17
|
-
getStudio().ui.restore();
|
|
18
|
-
},
|
|
19
|
-
renderToolset(toolsetId, htmlNode) {
|
|
20
|
-
return getStudio().ui.renderToolset(toolsetId, htmlNode);
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
_cache = new SimpleCache();
|
|
24
|
-
__experimental = {
|
|
25
|
-
__experimental_disblePlayPauseKeyboardShortcut() {
|
|
26
|
-
// This is an experimental API to respond to this issue: https://discord.com/channels/870988717190426644/870988717190426647/1067906775602430062
|
|
27
|
-
// Ideally we need a coherent way for the user to control keyboard inputs, so we will remove this method in the future.
|
|
28
|
-
// Here is the procedure for removing it:
|
|
29
|
-
// 1. Replace this code with a `throw new Error("This is experimental method is now deprecated, and here is how to migrate: ...")`
|
|
30
|
-
// 2. Then keep it for a few months, and then remove it.
|
|
31
|
-
__experimental_disblePlayPauseKeyboardShortcut();
|
|
32
|
-
},
|
|
33
|
-
__experimental_enablePlayPauseKeyboardShortcut() {
|
|
34
|
-
// see __experimental_disblePlayPauseKeyboardShortcut()
|
|
35
|
-
__experimental_enablePlayPauseKeyboardShortcut();
|
|
36
|
-
},
|
|
37
|
-
__experimental_clearPersistentStorage(persistenceKey) {
|
|
38
|
-
return getStudio().clearPersistentStorage(persistenceKey);
|
|
39
|
-
},
|
|
40
|
-
__experimental_createContentOfSaveFileTyped(projectId) {
|
|
41
|
-
return getStudio().createContentOfSaveFile(projectId);
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
|
-
constructor(internals) { }
|
|
48
|
-
initialize(opts) {
|
|
49
|
-
const studio = getStudio();
|
|
50
|
-
return studio.initialize(opts);
|
|
51
|
-
}
|
|
52
|
-
extend(extension, opts) {
|
|
53
|
-
getStudio().extend(extension, opts);
|
|
54
|
-
}
|
|
55
|
-
transaction(fn) {
|
|
56
|
-
return getStudio().transaction(({ set, unset, stateEditors }) => {
|
|
57
|
-
const __experimental_forgetObject = (object) => {
|
|
58
|
-
if (!isSheetObjectPublicAPI(object)) {
|
|
59
|
-
throw new Error(`object in transactionApi.__experimental_forgetObject(object) must be the return type of sheet.object(...)`);
|
|
60
|
-
}
|
|
61
|
-
stateEditors.coreByProject.historic.sheetsById.forgetObject(object.address);
|
|
62
|
-
};
|
|
63
|
-
const __experimental_forgetSheet = (sheet) => {
|
|
64
|
-
if (!isSheetPublicAPI(sheet)) {
|
|
65
|
-
throw new Error(`sheet in transactionApi.__experimental_forgetSheet(sheet) must be the return type of project.sheet()`);
|
|
66
|
-
}
|
|
67
|
-
stateEditors.coreByProject.historic.sheetsById.forgetSheet(sheet.address);
|
|
68
|
-
};
|
|
69
|
-
return fn({
|
|
70
|
-
set,
|
|
71
|
-
unset,
|
|
72
|
-
__experimental_forgetObject,
|
|
73
|
-
__experimental_forgetSheet,
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
_getSelectionPrism() {
|
|
78
|
-
return this._cache.get('_getSelectionPrism()', () => prism(() => {
|
|
79
|
-
return getOutlineSelection()
|
|
80
|
-
.filter((s) => s.type === 'Theatre_SheetObject' || s.type === 'Theatre_Sheet')
|
|
81
|
-
.map((s) => s.publicApi);
|
|
82
|
-
}));
|
|
83
|
-
}
|
|
84
|
-
_getSelection() {
|
|
85
|
-
return this._getSelectionPrism().getValue();
|
|
86
|
-
}
|
|
87
|
-
setSelection(selection) {
|
|
88
|
-
const sanitizedSelection = [...selection]
|
|
89
|
-
.filter((s) => isSheetObjectPublicAPI(s) || isSheetPublicAPI(s))
|
|
90
|
-
.map((s) => getStudio().corePrivateAPI(s));
|
|
91
|
-
getStudio().transaction(({ stateEditors }) => {
|
|
92
|
-
stateEditors.studio.historic.panels.outline.selection.set(sanitizedSelection);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
onSelectionChange(fn) {
|
|
96
|
-
const studio = getStudio();
|
|
97
|
-
return this._getSelectionPrism().onChange(studio.ticker, fn, true);
|
|
98
|
-
}
|
|
99
|
-
get selection() {
|
|
100
|
-
return this._getSelection();
|
|
101
|
-
}
|
|
102
|
-
scrub() {
|
|
103
|
-
return getStudio().scrub();
|
|
104
|
-
}
|
|
105
|
-
getStudioProject() {
|
|
106
|
-
const core = getStudio().core;
|
|
107
|
-
if (!core) {
|
|
108
|
-
throw new Error(`You're calling studio.getStudioProject() before \`@tomorrowevening/theatre-core\` is loaded. To fix this:
|
|
109
|
-
1. Check if \`@tomorrowevening/theatre-core\` is import/required in your bundle.
|
|
110
|
-
2. Check the stack trace of this error and make sure the funciton that calls getStudioProject() is run after \`@tomorrowevening/theatre-core\` is loaded.`);
|
|
111
|
-
}
|
|
112
|
-
return getStudio().getStudioProject(core);
|
|
113
|
-
}
|
|
114
|
-
debouncedScrub(threshold = 1000) {
|
|
115
|
-
let currentScrub;
|
|
116
|
-
const scheduleCommit = debounce(() => {
|
|
117
|
-
const s = currentScrub;
|
|
118
|
-
if (!s)
|
|
119
|
-
return;
|
|
120
|
-
currentScrub = undefined;
|
|
121
|
-
s.commit();
|
|
122
|
-
}, threshold);
|
|
123
|
-
const capture = (arg) => {
|
|
124
|
-
if (!currentScrub) {
|
|
125
|
-
currentScrub = this.scrub();
|
|
126
|
-
}
|
|
127
|
-
let errored = true;
|
|
128
|
-
try {
|
|
129
|
-
currentScrub.capture(arg);
|
|
130
|
-
errored = false;
|
|
131
|
-
}
|
|
132
|
-
finally {
|
|
133
|
-
if (errored) {
|
|
134
|
-
const s = currentScrub;
|
|
135
|
-
currentScrub = undefined;
|
|
136
|
-
s.discard();
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
scheduleCommit();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
return { capture };
|
|
144
|
-
}
|
|
145
|
-
createPane(paneClass) {
|
|
146
|
-
return getStudio().paneManager.createPane(paneClass);
|
|
147
|
-
}
|
|
148
|
-
destroyPane(paneId) {
|
|
149
|
-
return getStudio().paneManager.destroyPane(paneId);
|
|
150
|
-
}
|
|
151
|
-
createContentOfSaveFile(projectId) {
|
|
152
|
-
return getStudio().createContentOfSaveFile(projectId);
|
|
153
|
-
}
|
|
154
|
-
}
|
package/dist/UI/UI.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { val } from '@tomorrowevening/theatre-dataverse';
|
|
2
|
-
const NonSSRBitsClass = typeof window !== 'undefined'
|
|
3
|
-
? import('./UINonSSRBits').then((M) => M.default)
|
|
4
|
-
: null;
|
|
5
|
-
export default class UI {
|
|
6
|
-
studio;
|
|
7
|
-
_rendered = false;
|
|
8
|
-
_nonSSRBits = NonSSRBitsClass
|
|
9
|
-
? NonSSRBitsClass.then((NonSSRBitsClass) => new NonSSRBitsClass())
|
|
10
|
-
: Promise.reject();
|
|
11
|
-
ready = this._nonSSRBits.then(() => undefined, () => undefined);
|
|
12
|
-
constructor(studio) {
|
|
13
|
-
this.studio = studio;
|
|
14
|
-
}
|
|
15
|
-
render() {
|
|
16
|
-
if (this._rendered) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
this._rendered = true;
|
|
20
|
-
this._nonSSRBits
|
|
21
|
-
.then((b) => {
|
|
22
|
-
b.render();
|
|
23
|
-
})
|
|
24
|
-
.catch((err) => {
|
|
25
|
-
console.error(err);
|
|
26
|
-
throw err;
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
hide() {
|
|
30
|
-
this.studio.transaction(({ drafts }) => {
|
|
31
|
-
drafts.ahistoric.visibilityState = 'everythingIsHidden';
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
restore() {
|
|
35
|
-
this.render();
|
|
36
|
-
this.studio.transaction(({ drafts }) => {
|
|
37
|
-
drafts.ahistoric.visibilityState = 'everythingIsVisible';
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
get isHidden() {
|
|
41
|
-
return (val(this.studio.atomP.ahistoric.visibilityState) === 'everythingIsHidden');
|
|
42
|
-
}
|
|
43
|
-
renderToolset(toolsetId, htmlNode) {
|
|
44
|
-
let shouldUnmount = false;
|
|
45
|
-
let unmount = null;
|
|
46
|
-
this._nonSSRBits
|
|
47
|
-
.then((nonSSRBits) => {
|
|
48
|
-
if (shouldUnmount)
|
|
49
|
-
return; // unmount requested before the toolset is mounted, so, abort
|
|
50
|
-
unmount = nonSSRBits.renderToolset(toolsetId, htmlNode);
|
|
51
|
-
})
|
|
52
|
-
.catch((err) => {
|
|
53
|
-
console.error(err);
|
|
54
|
-
});
|
|
55
|
-
return () => {
|
|
56
|
-
if (unmount) {
|
|
57
|
-
unmount();
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (shouldUnmount)
|
|
61
|
-
return;
|
|
62
|
-
shouldUnmount = true;
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
}
|