@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
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import get from 'lodash-es/get';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { getPointerParts, prism, val } from '@tomorrowevening/theatre-dataverse';
|
|
4
|
-
import getStudio from '@tomorrowevening/theatre-studio/getStudio';
|
|
5
|
-
import getDeep from '@tomorrowevening/theatre-shared/utils/getDeep';
|
|
6
|
-
import { usePrismInstance } from '@tomorrowevening/theatre-react';
|
|
7
|
-
import { isPropConfSequencable } from '@tomorrowevening/theatre-shared/propTypes/utils';
|
|
8
|
-
import DefaultOrStaticValueIndicator from './DefaultValueIndicator';
|
|
9
|
-
import { getNearbyKeyframesOfTrack } from './getNearbyKeyframesOfTrack';
|
|
10
|
-
import NextPrevKeyframeCursors from './NextPrevKeyframeCursors';
|
|
11
|
-
const cache = new WeakMap();
|
|
12
|
-
/**
|
|
13
|
-
* Note: we're able to get `obj` and `propConfig` from `pointerToProp`,
|
|
14
|
-
* so the only reason they're still in the arguments list is that
|
|
15
|
-
*/
|
|
16
|
-
function createPrism(pointerToProp, obj, propConfig) {
|
|
17
|
-
return prism(() => {
|
|
18
|
-
const pathToProp = getPointerParts(pointerToProp).path;
|
|
19
|
-
const final = obj.getValueByPointer(pointerToProp);
|
|
20
|
-
const editPropValue = prism.memo('editPropValue', () => {
|
|
21
|
-
let currentScrub = null;
|
|
22
|
-
return {
|
|
23
|
-
temporarilySetValue(v) {
|
|
24
|
-
if (!currentScrub) {
|
|
25
|
-
currentScrub = getStudio().scrub();
|
|
26
|
-
}
|
|
27
|
-
currentScrub.capture((api) => {
|
|
28
|
-
api.set(pointerToProp, v);
|
|
29
|
-
});
|
|
30
|
-
},
|
|
31
|
-
discardTemporaryValue() {
|
|
32
|
-
if (currentScrub) {
|
|
33
|
-
currentScrub.discard();
|
|
34
|
-
currentScrub = null;
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
permanentlySetValue(v) {
|
|
38
|
-
if (currentScrub) {
|
|
39
|
-
currentScrub.capture((api) => {
|
|
40
|
-
api.set(pointerToProp, v);
|
|
41
|
-
});
|
|
42
|
-
currentScrub.commit();
|
|
43
|
-
currentScrub = null;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
getStudio().transaction((api) => {
|
|
47
|
-
api.set(pointerToProp, v);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
}, []);
|
|
53
|
-
const editAssets = {
|
|
54
|
-
createAsset: (asset) => obj.sheet.project.assetStorage.createAsset(asset),
|
|
55
|
-
getAssetUrl: (asset) => asset.id
|
|
56
|
-
? obj.sheet.project.assetStorage.getAssetUrl(asset.id)
|
|
57
|
-
: undefined,
|
|
58
|
-
};
|
|
59
|
-
const beingScrubbed = val(get(getStudio().atomP.ephemeral.projects.stateByProjectId[obj.address.projectId].stateBySheetId[obj.address.sheetId].stateByObjectKey[obj.address.objectKey].valuesBeingScrubbed, getPointerParts(pointerToProp).path)) === true;
|
|
60
|
-
const contextMenuItems = [];
|
|
61
|
-
const common = {
|
|
62
|
-
...editPropValue,
|
|
63
|
-
...editAssets,
|
|
64
|
-
value: final,
|
|
65
|
-
beingScrubbed,
|
|
66
|
-
contextMenuItems,
|
|
67
|
-
controlIndicators: React.createElement(React.Fragment, null),
|
|
68
|
-
};
|
|
69
|
-
const isSequencable = isPropConfSequencable(propConfig);
|
|
70
|
-
if (isSequencable) {
|
|
71
|
-
const validSequencedTracks = val(obj.template.getMapOfValidSequenceTracks_forStudio());
|
|
72
|
-
const possibleSequenceTrackId = getDeep(validSequencedTracks, pathToProp);
|
|
73
|
-
const isSequenced = typeof possibleSequenceTrackId === 'string';
|
|
74
|
-
if (isSequenced) {
|
|
75
|
-
contextMenuItems.push({
|
|
76
|
-
label: 'Make static',
|
|
77
|
-
callback: () => {
|
|
78
|
-
getStudio().transaction(({ stateEditors }) => {
|
|
79
|
-
const propAddress = { ...obj.address, pathToProp };
|
|
80
|
-
stateEditors.coreByProject.historic.sheetsById.sequence.setPrimitivePropAsStatic({
|
|
81
|
-
...propAddress,
|
|
82
|
-
value: obj.getValueByPointer(pointerToProp),
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
const sequenceTrackId = possibleSequenceTrackId;
|
|
88
|
-
const nearbyKeyframes = prism.sub('lcr', () => {
|
|
89
|
-
const track = val(obj.template.project.pointers.historic.sheetsById[obj.address.sheetId].sequence.tracksByObject[obj.address.objectKey].trackData[sequenceTrackId]);
|
|
90
|
-
const sequencePosition = val(obj.sheet.getSequence().positionPrism);
|
|
91
|
-
return getNearbyKeyframesOfTrack(obj, track && {
|
|
92
|
-
data: track,
|
|
93
|
-
id: sequenceTrackId,
|
|
94
|
-
sheetObject: obj,
|
|
95
|
-
}, sequencePosition);
|
|
96
|
-
}, [sequenceTrackId]);
|
|
97
|
-
let shade;
|
|
98
|
-
if (common.beingScrubbed) {
|
|
99
|
-
shade = 'Sequenced_OnKeyframe_BeingScrubbed';
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
if (nearbyKeyframes.cur) {
|
|
103
|
-
shade = 'Sequenced_OnKeyframe';
|
|
104
|
-
}
|
|
105
|
-
else if (nearbyKeyframes.prev?.kf.connectedRight === true) {
|
|
106
|
-
shade = 'Sequenced_BeingInterpolated';
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
shade = 'Sequened_NotBeingInterpolated';
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
const toggle = () => {
|
|
113
|
-
if (nearbyKeyframes.cur) {
|
|
114
|
-
getStudio().transaction((api) => {
|
|
115
|
-
api.unset(pointerToProp);
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
getStudio().transaction((api) => {
|
|
120
|
-
api.set(pointerToProp, common.value);
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
const controls = {
|
|
125
|
-
cur: nearbyKeyframes.cur
|
|
126
|
-
? {
|
|
127
|
-
type: 'on',
|
|
128
|
-
itemKey: nearbyKeyframes.cur.itemKey,
|
|
129
|
-
toggle,
|
|
130
|
-
}
|
|
131
|
-
: {
|
|
132
|
-
type: 'off',
|
|
133
|
-
toggle,
|
|
134
|
-
},
|
|
135
|
-
prev: nearbyKeyframes.prev !== undefined
|
|
136
|
-
? {
|
|
137
|
-
itemKey: nearbyKeyframes.prev.itemKey,
|
|
138
|
-
position: nearbyKeyframes.prev.kf.position,
|
|
139
|
-
jump: () => {
|
|
140
|
-
obj.sheet.getSequence().position =
|
|
141
|
-
nearbyKeyframes.prev.kf.position;
|
|
142
|
-
},
|
|
143
|
-
}
|
|
144
|
-
: undefined,
|
|
145
|
-
next: nearbyKeyframes.next !== undefined
|
|
146
|
-
? {
|
|
147
|
-
itemKey: nearbyKeyframes.next.itemKey,
|
|
148
|
-
position: nearbyKeyframes.next.kf.position,
|
|
149
|
-
jump: () => {
|
|
150
|
-
obj.sheet.getSequence().position =
|
|
151
|
-
nearbyKeyframes.next.kf.position;
|
|
152
|
-
},
|
|
153
|
-
}
|
|
154
|
-
: undefined,
|
|
155
|
-
};
|
|
156
|
-
const nextPrevKeyframeCursors = (React.createElement(NextPrevKeyframeCursors, { ...controls }));
|
|
157
|
-
const ret = {
|
|
158
|
-
...common,
|
|
159
|
-
type: 'Sequenced',
|
|
160
|
-
shade,
|
|
161
|
-
nearbyKeyframes,
|
|
162
|
-
controlIndicators: nextPrevKeyframeCursors,
|
|
163
|
-
};
|
|
164
|
-
return ret;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
const allStaticOverrides = val(obj.template.getStaticValues());
|
|
168
|
-
const staticOverride = getDeep(allStaticOverrides, pathToProp);
|
|
169
|
-
if (typeof staticOverride !== 'undefined') {
|
|
170
|
-
contextMenuItems.push({
|
|
171
|
-
label: 'Reset to default',
|
|
172
|
-
callback: () => {
|
|
173
|
-
getStudio().transaction(({ unset: unset }) => {
|
|
174
|
-
unset(pointerToProp);
|
|
175
|
-
});
|
|
176
|
-
},
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
if (isSequencable) {
|
|
180
|
-
contextMenuItems.push({
|
|
181
|
-
label: 'Sequence',
|
|
182
|
-
callback: () => {
|
|
183
|
-
getStudio().transaction(({ stateEditors }) => {
|
|
184
|
-
const propAddress = { ...obj.address, pathToProp };
|
|
185
|
-
stateEditors.coreByProject.historic.sheetsById.sequence.setPrimitivePropAsSequenced(propAddress, propConfig);
|
|
186
|
-
});
|
|
187
|
-
},
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
if (typeof staticOverride !== 'undefined') {
|
|
191
|
-
const ret = {
|
|
192
|
-
...common,
|
|
193
|
-
type: 'Static',
|
|
194
|
-
shade: common.beingScrubbed ? 'Static_BeingScrubbed' : 'Static',
|
|
195
|
-
controlIndicators: (React.createElement(DefaultOrStaticValueIndicator, { hasStaticOverride: true, obj: obj, pathToProp: pathToProp, propConfig: propConfig })),
|
|
196
|
-
};
|
|
197
|
-
return ret;
|
|
198
|
-
}
|
|
199
|
-
const ret = {
|
|
200
|
-
...common,
|
|
201
|
-
type: 'Default',
|
|
202
|
-
shade: 'Default',
|
|
203
|
-
controlIndicators: (React.createElement(DefaultOrStaticValueIndicator, { hasStaticOverride: true, obj: obj, pathToProp: pathToProp, propConfig: propConfig })),
|
|
204
|
-
};
|
|
205
|
-
return ret;
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
function getPrism(pointerToProp, obj, propConfig) {
|
|
209
|
-
if (cache.has(pointerToProp)) {
|
|
210
|
-
return cache.get(pointerToProp);
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
const d = createPrism(pointerToProp, obj, propConfig);
|
|
214
|
-
cache.set(pointerToProp, d);
|
|
215
|
-
return d;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Notably, this uses the {@link Scrub} API to support
|
|
220
|
-
* indicating in the UI which pointers (values/props) are being
|
|
221
|
-
* scrubbed. See how impl of {@link Scrub} manages
|
|
222
|
-
* `state.flagsTransaction` to keep a list of these touched paths
|
|
223
|
-
* for the UI to be able to recognize. (e.g. to highlight the
|
|
224
|
-
* item in r3f as you change its scale).
|
|
225
|
-
*/
|
|
226
|
-
export function useEditingToolsForSimplePropInDetailsPanel(pointerToProp, obj, propConfig) {
|
|
227
|
-
const der = getPrism(pointerToProp, obj, propConfig);
|
|
228
|
-
return usePrismInstance(der);
|
|
229
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { getPointerParts } from '@tomorrowevening/theatre-dataverse';
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated because it uses obj.template.staticConfig
|
|
4
|
-
*
|
|
5
|
-
* Returns the PropTypeConfig by path. Assumes `path` is a valid prop path and that
|
|
6
|
-
* it exists in obj.
|
|
7
|
-
*
|
|
8
|
-
* Example usage:
|
|
9
|
-
* ```
|
|
10
|
-
* const propConfig = getPropTypeByPointer(propP, sheetObject)
|
|
11
|
-
*
|
|
12
|
-
* if (propConfig.type === 'number') {
|
|
13
|
-
* //... etc.
|
|
14
|
-
* }
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export function getPropTypeByPointer(pointerToProp, obj) {
|
|
18
|
-
const rootConf = obj.template.staticConfig;
|
|
19
|
-
const p = getPointerParts(pointerToProp).path;
|
|
20
|
-
let conf = rootConf;
|
|
21
|
-
while (p.length !== 0) {
|
|
22
|
-
const key = p.shift();
|
|
23
|
-
if (typeof key === 'string') {
|
|
24
|
-
if (conf.type === 'compound') {
|
|
25
|
-
conf = conf.props[key];
|
|
26
|
-
if (!conf) {
|
|
27
|
-
throw new Error(`getPropTypeConfigByPath() is called with an invalid path.`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
else if (conf.type === 'enum') {
|
|
31
|
-
conf = conf.cases[key];
|
|
32
|
-
if (!conf) {
|
|
33
|
-
throw new Error(`getPropTypeConfigByPath() is called with an invalid path.`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
throw new Error(`getPropTypeConfigByPath() is called with an invalid path.`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
else if (typeof key === 'number') {
|
|
41
|
-
throw new Error(`Number indexes are not implemented yet. @todo`);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
throw new Error(`getPropTypeConfigByPath() is called with an invalid path.`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return conf;
|
|
48
|
-
}
|
package/dist/selectors.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { val } from '@tomorrowevening/theatre-dataverse';
|
|
2
|
-
import { isSheet, isSheetObject } from '@tomorrowevening/theatre-shared/instanceTypes';
|
|
3
|
-
import { uniq } from 'lodash-es';
|
|
4
|
-
import getStudio from './getStudio';
|
|
5
|
-
export const getOutlineSelection = () => {
|
|
6
|
-
const projects = val(getStudio().projectsP);
|
|
7
|
-
const mapped = (val(getStudio().atomP.historic.panels.outlinePanel.selection) ?? []).map((s) => {
|
|
8
|
-
const project = projects[s.projectId];
|
|
9
|
-
if (!project)
|
|
10
|
-
return;
|
|
11
|
-
if (s.type === 'Project')
|
|
12
|
-
return project;
|
|
13
|
-
const sheetTemplate = val(project.sheetTemplatesP[s.sheetId]);
|
|
14
|
-
if (!sheetTemplate) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const sheetInstance = getSelectedInstanceOfSheetId(project, s.sheetId);
|
|
18
|
-
if (!sheetInstance)
|
|
19
|
-
return;
|
|
20
|
-
if (s.type === 'Sheet') {
|
|
21
|
-
return sheetInstance;
|
|
22
|
-
}
|
|
23
|
-
const obj = val(sheetInstance.objectsP[s.objectKey]);
|
|
24
|
-
if (!obj)
|
|
25
|
-
return;
|
|
26
|
-
return obj;
|
|
27
|
-
});
|
|
28
|
-
return uniq(mapped.filter((s) => typeof s !== 'undefined'));
|
|
29
|
-
};
|
|
30
|
-
export const getSelectedInstanceOfSheetId = (project, selectedSheetId) => {
|
|
31
|
-
const projectStateP = getStudio().atomP.historic.projects.stateByProjectId[project.address.projectId];
|
|
32
|
-
const instanceId = val(projectStateP.stateBySheetId[selectedSheetId].selectedInstanceId);
|
|
33
|
-
const template = val(project.sheetTemplatesP[selectedSheetId]);
|
|
34
|
-
if (!template)
|
|
35
|
-
return undefined;
|
|
36
|
-
if (instanceId) {
|
|
37
|
-
return val(template.instancesP[instanceId]);
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
// @todo #perf this will update every time an instance is added/removed.
|
|
41
|
-
const allInstances = val(template.instancesP);
|
|
42
|
-
return allInstances[keys(allInstances)[0]];
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
function keys(obj) {
|
|
46
|
-
return Object.keys(obj);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* component instances could come and go all the time. This hook
|
|
50
|
-
* makes sure we don't cause re-renders
|
|
51
|
-
*/
|
|
52
|
-
export function getRegisteredSheetIds(project) {
|
|
53
|
-
return Object.keys(val(project.sheetTemplatesP));
|
|
54
|
-
}
|
|
55
|
-
export function getSelectedSequence() {
|
|
56
|
-
const selectedSheets = uniq(getOutlineSelection()
|
|
57
|
-
.filter((s) => isSheet(s) || isSheetObject(s))
|
|
58
|
-
.map((s) => (isSheetObject(s) ? s.sheet : s)));
|
|
59
|
-
const sheet = selectedSheets[0];
|
|
60
|
-
if (!sheet)
|
|
61
|
-
return;
|
|
62
|
-
return sheet.getSequence();
|
|
63
|
-
}
|
package/dist/store/index.js
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import actionCreator from '@tomorrowevening/theatre-studio/utils/redux/actionCreator';
|
|
2
|
-
import { historicActions, withHistory, } from '@tomorrowevening/theatre-studio/utils/redux/withHistory/withHistory';
|
|
3
|
-
import logger from '@tomorrowevening/theatre-shared/logger';
|
|
4
|
-
const initialState = {
|
|
5
|
-
ahistoric: {
|
|
6
|
-
visibilityState: 'everythingIsVisible',
|
|
7
|
-
theTrigger: {
|
|
8
|
-
position: {
|
|
9
|
-
closestCorner: 'bottomLeft',
|
|
10
|
-
distanceFromHorizontalEdge: 0.02,
|
|
11
|
-
distanceFromVerticalEdge: 0.02,
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
coreByProject: {},
|
|
15
|
-
projects: {
|
|
16
|
-
stateByProjectId: {},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
historic: {
|
|
20
|
-
projects: {
|
|
21
|
-
stateByProjectId: {},
|
|
22
|
-
},
|
|
23
|
-
autoKey: true,
|
|
24
|
-
coreByProject: {},
|
|
25
|
-
panelInstanceDesceriptors: {},
|
|
26
|
-
},
|
|
27
|
-
ephemeral: {
|
|
28
|
-
initialised: false,
|
|
29
|
-
coreByProject: {},
|
|
30
|
-
projects: {
|
|
31
|
-
stateByProjectId: {},
|
|
32
|
-
},
|
|
33
|
-
extensions: {
|
|
34
|
-
byId: {},
|
|
35
|
-
paneClasses: {},
|
|
36
|
-
},
|
|
37
|
-
showOutline: false,
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
const replacePersistentState = actionCreator('@storeBundle/replacePersistentState', (s) => s);
|
|
41
|
-
const reduceParts = actionCreator('@storeBundle/reduceParts', (fn) => fn);
|
|
42
|
-
export const studioActions = {
|
|
43
|
-
historic: historicActions,
|
|
44
|
-
replacePersistentState,
|
|
45
|
-
reduceParts,
|
|
46
|
-
};
|
|
47
|
-
const setInnerHistoricState = actionCreator('@storeBundle/setInnerHistoricState', (s) => s);
|
|
48
|
-
const historicInnerReducer = (s = initialState.historic, action) => {
|
|
49
|
-
if (setInnerHistoricState.is(action)) {
|
|
50
|
-
return action.payload;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
return s;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
const historicWrappedReducer = withHistory(historicInnerReducer);
|
|
57
|
-
const permanentReducer = (prevState, action) => {
|
|
58
|
-
if (replacePersistentState.is(action)) {
|
|
59
|
-
const { historic, ahistoric } = action.payload;
|
|
60
|
-
const ephemeral = prevState?.ephemeral || initialState.ephemeral;
|
|
61
|
-
return {
|
|
62
|
-
$persistent: { historic, ahistoric },
|
|
63
|
-
ephemeral,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
else if (!prevState) {
|
|
67
|
-
const historic = historicWrappedReducer(undefined, {});
|
|
68
|
-
const ahistoric = initialState.ahistoric;
|
|
69
|
-
const ephemeral = initialState.ephemeral;
|
|
70
|
-
return {
|
|
71
|
-
$persistent: { historic, ahistoric },
|
|
72
|
-
ephemeral,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
let { historic, ahistoric } = prevState.$persistent;
|
|
77
|
-
let { ephemeral } = prevState;
|
|
78
|
-
if (reduceParts.is(action)) {
|
|
79
|
-
const wholeState = {
|
|
80
|
-
historic: prevState.$persistent.historic.innerState,
|
|
81
|
-
ahistoric: prevState.$persistent.ahistoric,
|
|
82
|
-
ephemeral: prevState.ephemeral,
|
|
83
|
-
};
|
|
84
|
-
const reduced = action.payload(wholeState);
|
|
85
|
-
if (reduced === wholeState)
|
|
86
|
-
return prevState;
|
|
87
|
-
if (historic.innerState !== reduced.historic) {
|
|
88
|
-
historic = historicWrappedReducer(historic, setInnerHistoricState(reduced.historic));
|
|
89
|
-
}
|
|
90
|
-
ahistoric = reduced.ahistoric;
|
|
91
|
-
ephemeral = reduced.ephemeral;
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
const newHistoric = historicWrappedReducer(historic, action);
|
|
95
|
-
if (newHistoric === historic)
|
|
96
|
-
return prevState;
|
|
97
|
-
historic = newHistoric;
|
|
98
|
-
}
|
|
99
|
-
const persistent = historic === prevState.$persistent.historic &&
|
|
100
|
-
ahistoric === prevState.$persistent.ahistoric
|
|
101
|
-
? prevState.$persistent
|
|
102
|
-
: { historic, ahistoric };
|
|
103
|
-
return {
|
|
104
|
-
$persistent: persistent,
|
|
105
|
-
ephemeral,
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
export const _pushTemporaryAction = actionCreator('@history/pushTempAction', (input) => input);
|
|
110
|
-
export const _discardTemporaryAction = actionCreator('@history/discardTempAction', (id) => id);
|
|
111
|
-
export const _commitTemporaryAction = actionCreator('@history/commitTempAction', (id) => id);
|
|
112
|
-
let lastTempActionGroupId = 0;
|
|
113
|
-
export const tempActionGroup = () => {
|
|
114
|
-
const id = lastTempActionGroupId++;
|
|
115
|
-
const push = (originalAction) => _pushTemporaryAction({
|
|
116
|
-
id,
|
|
117
|
-
originalAction: originalAction,
|
|
118
|
-
});
|
|
119
|
-
const discard = () => _discardTemporaryAction(id);
|
|
120
|
-
const commit = () => _commitTemporaryAction(id);
|
|
121
|
-
return {
|
|
122
|
-
push,
|
|
123
|
-
discard,
|
|
124
|
-
commit,
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
export const studioReducer = (prevState, action) => {
|
|
128
|
-
if (!prevState) {
|
|
129
|
-
const permanent = permanentReducer(undefined, action);
|
|
130
|
-
return {
|
|
131
|
-
$temps: {
|
|
132
|
-
permanent: permanent,
|
|
133
|
-
tempActions: [],
|
|
134
|
-
},
|
|
135
|
-
$persistent: permanent.$persistent,
|
|
136
|
-
historic: permanent.$persistent.historic.innerState,
|
|
137
|
-
ahistoric: permanent.$persistent.ahistoric,
|
|
138
|
-
ephemeral: permanent.ephemeral,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
let { tempActions, permanent } = prevState.$temps;
|
|
143
|
-
let actionToPassInToPermanentReducer = undefined;
|
|
144
|
-
if (_pushTemporaryAction.is(action)) {
|
|
145
|
-
tempActions = [...tempActions, action];
|
|
146
|
-
}
|
|
147
|
-
else if (_commitTemporaryAction.is(action)) {
|
|
148
|
-
const toCommit = tempActions.find((a) => a.payload.id === action.payload);
|
|
149
|
-
if (!toCommit) {
|
|
150
|
-
logger.error(`Comitting temp action group ${action.payload} isn't possible as this group doesn't exist`);
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
actionToPassInToPermanentReducer = toCommit.payload.originalAction;
|
|
154
|
-
tempActions = tempActions.filter((a) => a.payload.id !== action.payload);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
else if (_discardTemporaryAction.is(action)) {
|
|
158
|
-
tempActions = tempActions.filter((a) => a.payload.id !== action.payload);
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
actionToPassInToPermanentReducer = action;
|
|
162
|
-
}
|
|
163
|
-
if (actionToPassInToPermanentReducer) {
|
|
164
|
-
permanent = permanentReducer(prevState.$temps.permanent, actionToPassInToPermanentReducer);
|
|
165
|
-
}
|
|
166
|
-
let surface = {
|
|
167
|
-
historic: permanent.$persistent.historic.innerState,
|
|
168
|
-
ahistoric: permanent.$persistent.ahistoric,
|
|
169
|
-
ephemeral: permanent.ephemeral,
|
|
170
|
-
};
|
|
171
|
-
for (const tempAction of tempActions) {
|
|
172
|
-
const orig = tempAction.payload.originalAction;
|
|
173
|
-
surface = orig.payload(surface);
|
|
174
|
-
}
|
|
175
|
-
return {
|
|
176
|
-
$temps: {
|
|
177
|
-
tempActions,
|
|
178
|
-
permanent,
|
|
179
|
-
},
|
|
180
|
-
$persistent: permanent.$persistent,
|
|
181
|
-
...surface,
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
};
|