@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,774 +0,0 @@
|
|
|
1
|
-
import { commonRootOfPathsToProps } from '@tomorrowevening/theatre-shared/utils/addresses';
|
|
2
|
-
import { encodePathToProp } from '@tomorrowevening/theatre-shared/utils/addresses';
|
|
3
|
-
import { generateKeyframeId, generateSequenceTrackId, } from '@tomorrowevening/theatre-shared/utils/ids';
|
|
4
|
-
import removePathFromObject from '@tomorrowevening/theatre-shared/utils/removePathFromObject';
|
|
5
|
-
import { transformNumber } from '@tomorrowevening/theatre-shared/utils/transformNumber';
|
|
6
|
-
import { current } from 'immer';
|
|
7
|
-
import findLastIndex from 'lodash-es/findLastIndex';
|
|
8
|
-
import keyBy from 'lodash-es/keyBy';
|
|
9
|
-
import pullFromArray from 'lodash-es/pull';
|
|
10
|
-
import set from 'lodash-es/set';
|
|
11
|
-
import sortBy from 'lodash-es/sortBy';
|
|
12
|
-
import { graphEditorColors } from '@tomorrowevening/theatre-studio/panels/SequenceEditorPanel/GraphEditor/GraphEditor';
|
|
13
|
-
import { clamp, uniq } from 'lodash-es';
|
|
14
|
-
import { isProject, isSheet, isSheetObject, isSheetObjectTemplate, isSheetTemplate, } from '@tomorrowevening/theatre-shared/instanceTypes';
|
|
15
|
-
import { pointableSetUtil } from '@tomorrowevening/theatre-shared/utils/PointableSet';
|
|
16
|
-
export const setDrafts__onlyMeantToBeCalledByTransaction = (drafts) => {
|
|
17
|
-
currentDrafts = drafts;
|
|
18
|
-
return stateEditors;
|
|
19
|
-
};
|
|
20
|
-
let currentDrafts;
|
|
21
|
-
const drafts = () => {
|
|
22
|
-
if (currentDrafts === undefined) {
|
|
23
|
-
throw new Error(`Calling stateEditors outside of a transaction is not allowed.`);
|
|
24
|
-
}
|
|
25
|
-
return currentDrafts;
|
|
26
|
-
};
|
|
27
|
-
var stateEditors;
|
|
28
|
-
(function (stateEditors) {
|
|
29
|
-
let studio;
|
|
30
|
-
(function (studio) {
|
|
31
|
-
let historic;
|
|
32
|
-
(function (historic) {
|
|
33
|
-
let panelPositions;
|
|
34
|
-
(function (panelPositions) {
|
|
35
|
-
function setPanelPosition(p) {
|
|
36
|
-
const h = drafts().historic;
|
|
37
|
-
h.panelPositions ??= {};
|
|
38
|
-
h.panelPositions[p.panelId] = p.position;
|
|
39
|
-
}
|
|
40
|
-
panelPositions.setPanelPosition = setPanelPosition;
|
|
41
|
-
})(panelPositions = historic.panelPositions || (historic.panelPositions = {}));
|
|
42
|
-
let panels;
|
|
43
|
-
(function (panels_1) {
|
|
44
|
-
function _ensure() {
|
|
45
|
-
drafts().historic.panels ??= {};
|
|
46
|
-
return drafts().historic.panels;
|
|
47
|
-
}
|
|
48
|
-
panels_1._ensure = _ensure;
|
|
49
|
-
let outline;
|
|
50
|
-
(function (outline) {
|
|
51
|
-
function _ensure() {
|
|
52
|
-
const panels = stateEditors.studio.historic.panels._ensure();
|
|
53
|
-
panels.outlinePanel ??= {};
|
|
54
|
-
return panels.outlinePanel;
|
|
55
|
-
}
|
|
56
|
-
outline._ensure = _ensure;
|
|
57
|
-
let selection;
|
|
58
|
-
(function (selection_1) {
|
|
59
|
-
function set(selection) {
|
|
60
|
-
const newSelectionState = [];
|
|
61
|
-
for (const item of uniq(selection)) {
|
|
62
|
-
if (isProject(item)) {
|
|
63
|
-
newSelectionState.push({ type: 'Project', ...item.address });
|
|
64
|
-
}
|
|
65
|
-
else if (isSheet(item)) {
|
|
66
|
-
newSelectionState.push({
|
|
67
|
-
type: 'Sheet',
|
|
68
|
-
...item.template.address,
|
|
69
|
-
});
|
|
70
|
-
stateEditors.studio.historic.projects.stateByProjectId.stateBySheetId.setSelectedInstanceId(item.address);
|
|
71
|
-
}
|
|
72
|
-
else if (isSheetTemplate(item)) {
|
|
73
|
-
newSelectionState.push({ type: 'Sheet', ...item.address });
|
|
74
|
-
}
|
|
75
|
-
else if (isSheetObject(item)) {
|
|
76
|
-
newSelectionState.push({
|
|
77
|
-
type: 'SheetObject',
|
|
78
|
-
...item.template.address,
|
|
79
|
-
});
|
|
80
|
-
stateEditors.studio.historic.projects.stateByProjectId.stateBySheetId.setSelectedInstanceId(item.sheet.address);
|
|
81
|
-
}
|
|
82
|
-
else if (isSheetObjectTemplate(item)) {
|
|
83
|
-
newSelectionState.push({ type: 'SheetObject', ...item.address });
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
outline._ensure().selection = newSelectionState;
|
|
87
|
-
}
|
|
88
|
-
selection_1.set = set;
|
|
89
|
-
function unset() {
|
|
90
|
-
outline._ensure().selection = [];
|
|
91
|
-
}
|
|
92
|
-
selection_1.unset = unset;
|
|
93
|
-
})(selection = outline.selection || (outline.selection = {}));
|
|
94
|
-
})(outline = panels_1.outline || (panels_1.outline = {}));
|
|
95
|
-
let sequenceEditor;
|
|
96
|
-
(function (sequenceEditor) {
|
|
97
|
-
function _ensure() {
|
|
98
|
-
const panels = stateEditors.studio.historic.panels._ensure();
|
|
99
|
-
panels.sequenceEditor ??= {};
|
|
100
|
-
return panels.sequenceEditor;
|
|
101
|
-
}
|
|
102
|
-
sequenceEditor._ensure = _ensure;
|
|
103
|
-
let graphEditor;
|
|
104
|
-
(function (graphEditor) {
|
|
105
|
-
function _ensure() {
|
|
106
|
-
const s = sequenceEditor._ensure();
|
|
107
|
-
s.graphEditor ??= { height: 0.5, isOpen: false };
|
|
108
|
-
return s.graphEditor;
|
|
109
|
-
}
|
|
110
|
-
function setIsOpen(p) {
|
|
111
|
-
_ensure().isOpen = p.isOpen;
|
|
112
|
-
}
|
|
113
|
-
graphEditor.setIsOpen = setIsOpen;
|
|
114
|
-
})(graphEditor = sequenceEditor.graphEditor || (sequenceEditor.graphEditor = {}));
|
|
115
|
-
})(sequenceEditor = panels_1.sequenceEditor || (panels_1.sequenceEditor = {}));
|
|
116
|
-
})(panels = historic.panels || (historic.panels = {}));
|
|
117
|
-
let projects;
|
|
118
|
-
(function (projects) {
|
|
119
|
-
let stateByProjectId;
|
|
120
|
-
(function (stateByProjectId) {
|
|
121
|
-
function _ensure(p) {
|
|
122
|
-
const s = drafts().historic;
|
|
123
|
-
if (!s.projects.stateByProjectId[p.projectId]) {
|
|
124
|
-
s.projects.stateByProjectId[p.projectId] = {
|
|
125
|
-
stateBySheetId: {},
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
return s.projects.stateByProjectId[p.projectId];
|
|
129
|
-
}
|
|
130
|
-
stateByProjectId._ensure = _ensure;
|
|
131
|
-
let stateBySheetId;
|
|
132
|
-
(function (stateBySheetId) {
|
|
133
|
-
function _ensure(p) {
|
|
134
|
-
const projectState = stateEditors.studio.historic.projects.stateByProjectId._ensure(p);
|
|
135
|
-
if (!projectState.stateBySheetId[p.sheetId]) {
|
|
136
|
-
projectState.stateBySheetId[p.sheetId] = {
|
|
137
|
-
selectedInstanceId: undefined,
|
|
138
|
-
sequenceEditor: {
|
|
139
|
-
selectedPropsByObject: {},
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
return projectState.stateBySheetId[p.sheetId];
|
|
144
|
-
}
|
|
145
|
-
stateBySheetId._ensure = _ensure;
|
|
146
|
-
function setSelectedInstanceId(p) {
|
|
147
|
-
stateEditors.studio.historic.projects.stateByProjectId.stateBySheetId._ensure(p).selectedInstanceId = p.sheetInstanceId;
|
|
148
|
-
}
|
|
149
|
-
stateBySheetId.setSelectedInstanceId = setSelectedInstanceId;
|
|
150
|
-
let sequenceEditor;
|
|
151
|
-
(function (sequenceEditor_1) {
|
|
152
|
-
function addPropToGraphEditor(p) {
|
|
153
|
-
const { selectedPropsByObject } = stateBySheetId._ensure(p).sequenceEditor;
|
|
154
|
-
if (!selectedPropsByObject[p.objectKey]) {
|
|
155
|
-
selectedPropsByObject[p.objectKey] = {};
|
|
156
|
-
}
|
|
157
|
-
const selectedProps = selectedPropsByObject[p.objectKey];
|
|
158
|
-
const path = encodePathToProp(p.pathToProp);
|
|
159
|
-
const possibleColors = new Set(Object.keys(graphEditorColors));
|
|
160
|
-
for (const [_, selectedProps] of Object.entries(current(selectedPropsByObject))) {
|
|
161
|
-
// debugger
|
|
162
|
-
for (const [_, takenColor] of Object.entries(selectedProps)) {
|
|
163
|
-
possibleColors.delete(takenColor);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
const color = possibleColors.size > 0
|
|
167
|
-
? possibleColors.values().next().value
|
|
168
|
-
: Object.keys(graphEditorColors)[0];
|
|
169
|
-
selectedProps[path] = color;
|
|
170
|
-
}
|
|
171
|
-
sequenceEditor_1.addPropToGraphEditor = addPropToGraphEditor;
|
|
172
|
-
function removePropFromGraphEditor(p) {
|
|
173
|
-
const { selectedPropsByObject } = stateBySheetId._ensure(p).sequenceEditor;
|
|
174
|
-
if (!selectedPropsByObject[p.objectKey]) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
const selectedProps = selectedPropsByObject[p.objectKey];
|
|
178
|
-
const path = encodePathToProp(p.pathToProp);
|
|
179
|
-
if (selectedProps[path]) {
|
|
180
|
-
removePathFromObject(selectedPropsByObject, [
|
|
181
|
-
p.objectKey,
|
|
182
|
-
path,
|
|
183
|
-
]);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
sequenceEditor_1.removePropFromGraphEditor = removePropFromGraphEditor;
|
|
187
|
-
function _ensureMarkers(sheetAddress) {
|
|
188
|
-
const sequenceEditor = stateEditors.studio.historic.projects.stateByProjectId.stateBySheetId._ensure(sheetAddress).sequenceEditor;
|
|
189
|
-
if (!sequenceEditor.markerSet) {
|
|
190
|
-
sequenceEditor.markerSet = pointableSetUtil.create();
|
|
191
|
-
}
|
|
192
|
-
return sequenceEditor.markerSet;
|
|
193
|
-
}
|
|
194
|
-
function replaceMarkers(p) {
|
|
195
|
-
const currentMarkerSet = _ensureMarkers(p.sheetAddress);
|
|
196
|
-
const sanitizedMarkers = p.markers
|
|
197
|
-
.filter((marker) => {
|
|
198
|
-
if (!isFinite(marker.position))
|
|
199
|
-
return false;
|
|
200
|
-
return true; // marker looks valid
|
|
201
|
-
})
|
|
202
|
-
.map((marker) => ({
|
|
203
|
-
...marker,
|
|
204
|
-
position: p.snappingFunction(marker.position),
|
|
205
|
-
}));
|
|
206
|
-
const newMarkersById = keyBy(sanitizedMarkers, 'id');
|
|
207
|
-
/** Usually starts as the "unselected" markers */
|
|
208
|
-
let markersThatArentBeingReplaced = pointableSetUtil.filter(currentMarkerSet, (marker) => marker && !newMarkersById[marker.id]);
|
|
209
|
-
const markersThatArentBeingReplacedByPosition = keyBy(Object.values(markersThatArentBeingReplaced.byId), 'position');
|
|
210
|
-
// If the new transformed markers overlap with any existing markers,
|
|
211
|
-
// we remove the overlapped markers
|
|
212
|
-
sanitizedMarkers.forEach(({ position }) => {
|
|
213
|
-
const existingMarkerAtThisPosition = markersThatArentBeingReplacedByPosition[position];
|
|
214
|
-
if (existingMarkerAtThisPosition) {
|
|
215
|
-
markersThatArentBeingReplaced = pointableSetUtil.remove(markersThatArentBeingReplaced, existingMarkerAtThisPosition.id);
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
Object.assign(currentMarkerSet, pointableSetUtil.merge([
|
|
219
|
-
markersThatArentBeingReplaced,
|
|
220
|
-
pointableSetUtil.create(sanitizedMarkers.map((marker) => [marker.id, marker])),
|
|
221
|
-
]));
|
|
222
|
-
}
|
|
223
|
-
sequenceEditor_1.replaceMarkers = replaceMarkers;
|
|
224
|
-
function removeMarker(options) {
|
|
225
|
-
const currentMarkerSet = _ensureMarkers(options.sheetAddress);
|
|
226
|
-
Object.assign(currentMarkerSet, pointableSetUtil.remove(currentMarkerSet, options.markerId));
|
|
227
|
-
}
|
|
228
|
-
sequenceEditor_1.removeMarker = removeMarker;
|
|
229
|
-
function updateMarker(options) {
|
|
230
|
-
const currentMarkerSet = _ensureMarkers(options.sheetAddress);
|
|
231
|
-
const marker = currentMarkerSet.byId[options.markerId];
|
|
232
|
-
if (marker !== undefined)
|
|
233
|
-
marker.label = options.label;
|
|
234
|
-
}
|
|
235
|
-
sequenceEditor_1.updateMarker = updateMarker;
|
|
236
|
-
})(sequenceEditor = stateBySheetId.sequenceEditor || (stateBySheetId.sequenceEditor = {}));
|
|
237
|
-
})(stateBySheetId = stateByProjectId.stateBySheetId || (stateByProjectId.stateBySheetId = {}));
|
|
238
|
-
})(stateByProjectId = projects.stateByProjectId || (projects.stateByProjectId = {}));
|
|
239
|
-
})(projects = historic.projects || (historic.projects = {}));
|
|
240
|
-
})(historic = studio.historic || (studio.historic = {}));
|
|
241
|
-
let ephemeral;
|
|
242
|
-
(function (ephemeral) {
|
|
243
|
-
function setShowOutline(showOutline) {
|
|
244
|
-
drafts().ephemeral.showOutline = showOutline;
|
|
245
|
-
}
|
|
246
|
-
ephemeral.setShowOutline = setShowOutline;
|
|
247
|
-
let projects;
|
|
248
|
-
(function (projects) {
|
|
249
|
-
let stateByProjectId;
|
|
250
|
-
(function (stateByProjectId) {
|
|
251
|
-
function _ensure(p) {
|
|
252
|
-
const s = drafts().ephemeral;
|
|
253
|
-
if (!s.projects.stateByProjectId[p.projectId]) {
|
|
254
|
-
s.projects.stateByProjectId[p.projectId] = {
|
|
255
|
-
stateBySheetId: {},
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
return s.projects.stateByProjectId[p.projectId];
|
|
259
|
-
}
|
|
260
|
-
stateByProjectId._ensure = _ensure;
|
|
261
|
-
let stateBySheetId;
|
|
262
|
-
(function (stateBySheetId) {
|
|
263
|
-
function _ensure(p) {
|
|
264
|
-
const projectState = stateEditors.studio.ephemeral.projects.stateByProjectId._ensure(p);
|
|
265
|
-
if (!projectState.stateBySheetId[p.sheetId]) {
|
|
266
|
-
projectState.stateBySheetId[p.sheetId] = {
|
|
267
|
-
stateByObjectKey: {},
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
return projectState.stateBySheetId[p.sheetId];
|
|
271
|
-
}
|
|
272
|
-
stateBySheetId._ensure = _ensure;
|
|
273
|
-
let stateByObjectKey;
|
|
274
|
-
(function (stateByObjectKey) {
|
|
275
|
-
function _ensure(p) {
|
|
276
|
-
const s = stateEditors.studio.ephemeral.projects.stateByProjectId.stateBySheetId._ensure(p).stateByObjectKey;
|
|
277
|
-
s[p.objectKey] ??= {};
|
|
278
|
-
return s[p.objectKey];
|
|
279
|
-
}
|
|
280
|
-
stateByObjectKey._ensure = _ensure;
|
|
281
|
-
let propsBeingScrubbed;
|
|
282
|
-
(function (propsBeingScrubbed) {
|
|
283
|
-
function _ensure(p) {
|
|
284
|
-
const s = stateEditors.studio.ephemeral.projects.stateByProjectId.stateBySheetId.stateByObjectKey._ensure(p);
|
|
285
|
-
s.valuesBeingScrubbed ??= {};
|
|
286
|
-
return s.valuesBeingScrubbed;
|
|
287
|
-
}
|
|
288
|
-
propsBeingScrubbed._ensure = _ensure;
|
|
289
|
-
function flag(p) {
|
|
290
|
-
set(_ensure(p), p.pathToProp, true);
|
|
291
|
-
}
|
|
292
|
-
propsBeingScrubbed.flag = flag;
|
|
293
|
-
})(propsBeingScrubbed = stateByObjectKey.propsBeingScrubbed || (stateByObjectKey.propsBeingScrubbed = {}));
|
|
294
|
-
})(stateByObjectKey = stateBySheetId.stateByObjectKey || (stateBySheetId.stateByObjectKey = {}));
|
|
295
|
-
})(stateBySheetId = stateByProjectId.stateBySheetId || (stateByProjectId.stateBySheetId = {}));
|
|
296
|
-
})(stateByProjectId = projects.stateByProjectId || (projects.stateByProjectId = {}));
|
|
297
|
-
})(projects = ephemeral.projects || (ephemeral.projects = {}));
|
|
298
|
-
})(ephemeral = studio.ephemeral || (studio.ephemeral = {}));
|
|
299
|
-
let ahistoric;
|
|
300
|
-
(function (ahistoric) {
|
|
301
|
-
function setPinOutline(pinOutline) {
|
|
302
|
-
drafts().ahistoric.pinOutline = pinOutline;
|
|
303
|
-
}
|
|
304
|
-
ahistoric.setPinOutline = setPinOutline;
|
|
305
|
-
function setPinDetails(pinDetails) {
|
|
306
|
-
drafts().ahistoric.pinDetails = pinDetails;
|
|
307
|
-
}
|
|
308
|
-
ahistoric.setPinDetails = setPinDetails;
|
|
309
|
-
function setPinNotifications(pinNotifications) {
|
|
310
|
-
drafts().ahistoric.pinNotifications = pinNotifications;
|
|
311
|
-
}
|
|
312
|
-
ahistoric.setPinNotifications = setPinNotifications;
|
|
313
|
-
function setVisibilityState(visibilityState) {
|
|
314
|
-
drafts().ahistoric.visibilityState = visibilityState;
|
|
315
|
-
}
|
|
316
|
-
ahistoric.setVisibilityState = setVisibilityState;
|
|
317
|
-
function setClipboardKeyframes(keyframes) {
|
|
318
|
-
const commonPath = commonRootOfPathsToProps(keyframes.map((kf) => kf.pathToProp));
|
|
319
|
-
const keyframesWithCommonRootPath = keyframes.map(({ keyframe, pathToProp }) => ({
|
|
320
|
-
keyframe,
|
|
321
|
-
pathToProp: pathToProp.slice(commonPath.length),
|
|
322
|
-
}));
|
|
323
|
-
// save selection
|
|
324
|
-
const draft = drafts();
|
|
325
|
-
if (draft.ahistoric.clipboard) {
|
|
326
|
-
draft.ahistoric.clipboard.keyframesWithRelativePaths =
|
|
327
|
-
keyframesWithCommonRootPath;
|
|
328
|
-
}
|
|
329
|
-
else {
|
|
330
|
-
draft.ahistoric.clipboard = {
|
|
331
|
-
keyframesWithRelativePaths: keyframesWithCommonRootPath,
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
ahistoric.setClipboardKeyframes = setClipboardKeyframes;
|
|
336
|
-
let projects;
|
|
337
|
-
(function (projects) {
|
|
338
|
-
let stateByProjectId;
|
|
339
|
-
(function (stateByProjectId) {
|
|
340
|
-
function _ensure(p) {
|
|
341
|
-
const s = drafts().ahistoric;
|
|
342
|
-
if (!s.projects.stateByProjectId[p.projectId]) {
|
|
343
|
-
s.projects.stateByProjectId[p.projectId] = {
|
|
344
|
-
stateBySheetId: {},
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
return s.projects.stateByProjectId[p.projectId];
|
|
348
|
-
}
|
|
349
|
-
stateByProjectId._ensure = _ensure;
|
|
350
|
-
let collapsedItemsInOutline;
|
|
351
|
-
(function (collapsedItemsInOutline_1) {
|
|
352
|
-
function _ensure(p) {
|
|
353
|
-
const projectState = stateEditors.studio.ahistoric.projects.stateByProjectId._ensure(p);
|
|
354
|
-
if (!projectState.collapsedItemsInOutline) {
|
|
355
|
-
projectState.collapsedItemsInOutline = {};
|
|
356
|
-
}
|
|
357
|
-
return projectState.collapsedItemsInOutline;
|
|
358
|
-
}
|
|
359
|
-
collapsedItemsInOutline_1._ensure = _ensure;
|
|
360
|
-
function set(p) {
|
|
361
|
-
const collapsedItemsInOutline = stateEditors.studio.ahistoric.projects.stateByProjectId.collapsedItemsInOutline._ensure(p);
|
|
362
|
-
if (p.isCollapsed) {
|
|
363
|
-
collapsedItemsInOutline[p.itemKey] = true;
|
|
364
|
-
}
|
|
365
|
-
else {
|
|
366
|
-
delete collapsedItemsInOutline[p.itemKey];
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
collapsedItemsInOutline_1.set = set;
|
|
370
|
-
})(collapsedItemsInOutline = stateByProjectId.collapsedItemsInOutline || (stateByProjectId.collapsedItemsInOutline = {}));
|
|
371
|
-
let stateBySheetId;
|
|
372
|
-
(function (stateBySheetId) {
|
|
373
|
-
function _ensure(p) {
|
|
374
|
-
const projectState = stateEditors.studio.ahistoric.projects.stateByProjectId._ensure(p);
|
|
375
|
-
if (!projectState.stateBySheetId[p.sheetId]) {
|
|
376
|
-
projectState.stateBySheetId[p.sheetId] = {};
|
|
377
|
-
}
|
|
378
|
-
return projectState.stateBySheetId[p.sheetId];
|
|
379
|
-
}
|
|
380
|
-
stateBySheetId._ensure = _ensure;
|
|
381
|
-
let sequence;
|
|
382
|
-
(function (sequence) {
|
|
383
|
-
function _ensure(p) {
|
|
384
|
-
const sheetState = stateEditors.studio.ahistoric.projects.stateByProjectId.stateBySheetId._ensure(p);
|
|
385
|
-
if (!sheetState.sequence) {
|
|
386
|
-
sheetState.sequence = {};
|
|
387
|
-
}
|
|
388
|
-
return sheetState.sequence;
|
|
389
|
-
}
|
|
390
|
-
sequence._ensure = _ensure;
|
|
391
|
-
let focusRange;
|
|
392
|
-
(function (focusRange) {
|
|
393
|
-
function set(p) {
|
|
394
|
-
stateEditors.studio.ahistoric.projects.stateByProjectId.stateBySheetId.sequence._ensure(p).focusRange = { range: p.range, enabled: p.enabled };
|
|
395
|
-
}
|
|
396
|
-
focusRange.set = set;
|
|
397
|
-
function unset(p) {
|
|
398
|
-
stateEditors.studio.ahistoric.projects.stateByProjectId.stateBySheetId.sequence._ensure(p).focusRange = undefined;
|
|
399
|
-
}
|
|
400
|
-
focusRange.unset = unset;
|
|
401
|
-
})(focusRange = sequence.focusRange || (sequence.focusRange = {}));
|
|
402
|
-
let clippedSpaceRange;
|
|
403
|
-
(function (clippedSpaceRange) {
|
|
404
|
-
function set(p) {
|
|
405
|
-
stateEditors.studio.ahistoric.projects.stateByProjectId.stateBySheetId.sequence._ensure(p).clippedSpaceRange = { ...p.range };
|
|
406
|
-
}
|
|
407
|
-
clippedSpaceRange.set = set;
|
|
408
|
-
})(clippedSpaceRange = sequence.clippedSpaceRange || (sequence.clippedSpaceRange = {}));
|
|
409
|
-
let sequenceEditorCollapsableItems;
|
|
410
|
-
(function (sequenceEditorCollapsableItems) {
|
|
411
|
-
function _ensure(p) {
|
|
412
|
-
const seq = stateEditors.studio.ahistoric.projects.stateByProjectId.stateBySheetId.sequence._ensure(p);
|
|
413
|
-
let existing = seq.collapsableItems;
|
|
414
|
-
if (!existing) {
|
|
415
|
-
existing = seq.collapsableItems = pointableSetUtil.create();
|
|
416
|
-
}
|
|
417
|
-
return existing;
|
|
418
|
-
}
|
|
419
|
-
function set(p) {
|
|
420
|
-
const collapsableSet = _ensure(p);
|
|
421
|
-
Object.assign(collapsableSet, pointableSetUtil.add(collapsableSet, p.studioSheetItemKey, {
|
|
422
|
-
isCollapsed: p.isCollapsed,
|
|
423
|
-
}));
|
|
424
|
-
}
|
|
425
|
-
sequenceEditorCollapsableItems.set = set;
|
|
426
|
-
})(sequenceEditorCollapsableItems = sequence.sequenceEditorCollapsableItems || (sequence.sequenceEditorCollapsableItems = {}));
|
|
427
|
-
})(sequence = stateBySheetId.sequence || (stateBySheetId.sequence = {}));
|
|
428
|
-
})(stateBySheetId = stateByProjectId.stateBySheetId || (stateByProjectId.stateBySheetId = {}));
|
|
429
|
-
})(stateByProjectId = projects.stateByProjectId || (projects.stateByProjectId = {}));
|
|
430
|
-
})(projects = ahistoric.projects || (ahistoric.projects = {}));
|
|
431
|
-
})(ahistoric = studio.ahistoric || (studio.ahistoric = {}));
|
|
432
|
-
})(studio = stateEditors.studio || (stateEditors.studio = {}));
|
|
433
|
-
let coreByProject;
|
|
434
|
-
(function (coreByProject) {
|
|
435
|
-
let historic;
|
|
436
|
-
(function (historic) {
|
|
437
|
-
let revisionHistory;
|
|
438
|
-
(function (revisionHistory_1) {
|
|
439
|
-
function add(p) {
|
|
440
|
-
const revisionHistory = drafts().historic.coreByProject[p.projectId].revisionHistory;
|
|
441
|
-
const maxNumOfRevisionsToKeep = 50;
|
|
442
|
-
revisionHistory.unshift(p.revision);
|
|
443
|
-
if (revisionHistory.length > maxNumOfRevisionsToKeep) {
|
|
444
|
-
revisionHistory.length = maxNumOfRevisionsToKeep;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
revisionHistory_1.add = add;
|
|
448
|
-
})(revisionHistory = historic.revisionHistory || (historic.revisionHistory = {}));
|
|
449
|
-
let sheetsById;
|
|
450
|
-
(function (sheetsById_1) {
|
|
451
|
-
function _ensure(p) {
|
|
452
|
-
const sheetsById = drafts().historic.coreByProject[p.projectId].sheetsById;
|
|
453
|
-
if (!sheetsById[p.sheetId]) {
|
|
454
|
-
sheetsById[p.sheetId] = { staticOverrides: { byObject: {} } };
|
|
455
|
-
}
|
|
456
|
-
return sheetsById[p.sheetId];
|
|
457
|
-
}
|
|
458
|
-
sheetsById_1._ensure = _ensure;
|
|
459
|
-
function forgetObject(p) {
|
|
460
|
-
const sheetState = drafts().historic.coreByProject[p.projectId].sheetsById[p.sheetId];
|
|
461
|
-
if (!sheetState)
|
|
462
|
-
return;
|
|
463
|
-
delete sheetState.staticOverrides.byObject[p.objectKey];
|
|
464
|
-
const sequence = sheetState.sequence;
|
|
465
|
-
if (!sequence)
|
|
466
|
-
return;
|
|
467
|
-
delete sequence.tracksByObject[p.objectKey];
|
|
468
|
-
}
|
|
469
|
-
sheetsById_1.forgetObject = forgetObject;
|
|
470
|
-
function forgetSheet(p) {
|
|
471
|
-
const sheetState = drafts().historic.coreByProject[p.projectId].sheetsById[p.sheetId];
|
|
472
|
-
if (sheetState) {
|
|
473
|
-
delete drafts().historic.coreByProject[p.projectId].sheetsById[p.sheetId];
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
sheetsById_1.forgetSheet = forgetSheet;
|
|
477
|
-
let sequence;
|
|
478
|
-
(function (sequence) {
|
|
479
|
-
function _ensure(p) {
|
|
480
|
-
const s = stateEditors.coreByProject.historic.sheetsById._ensure(p);
|
|
481
|
-
s.sequence ??= {
|
|
482
|
-
subUnitsPerUnit: 30,
|
|
483
|
-
length: 10,
|
|
484
|
-
type: 'PositionalSequence',
|
|
485
|
-
tracksByObject: {},
|
|
486
|
-
};
|
|
487
|
-
return s.sequence;
|
|
488
|
-
}
|
|
489
|
-
sequence._ensure = _ensure;
|
|
490
|
-
function setLength(p) {
|
|
491
|
-
_ensure(p).length = clamp(parseFloat(p.length.toFixed(2)), 0.01, Infinity);
|
|
492
|
-
}
|
|
493
|
-
sequence.setLength = setLength;
|
|
494
|
-
function setSubUnitsPerUnit(p) {
|
|
495
|
-
_ensure(p).subUnitsPerUnit = clamp(p.subUnitsPerUnit, 1, 2 ** 12);
|
|
496
|
-
}
|
|
497
|
-
sequence.setSubUnitsPerUnit = setSubUnitsPerUnit;
|
|
498
|
-
function _ensureTracksOfObject(p) {
|
|
499
|
-
const s = stateEditors.coreByProject.historic.sheetsById.sequence._ensure(p).tracksByObject;
|
|
500
|
-
s[p.objectKey] ??= { trackData: {}, trackIdByPropPath: {} };
|
|
501
|
-
return s[p.objectKey];
|
|
502
|
-
}
|
|
503
|
-
function setPrimitivePropAsSequenced(p, config) {
|
|
504
|
-
const tracks = _ensureTracksOfObject(p);
|
|
505
|
-
const pathEncoded = encodePathToProp(p.pathToProp);
|
|
506
|
-
const possibleTrackId = tracks.trackIdByPropPath[pathEncoded];
|
|
507
|
-
if (typeof possibleTrackId === 'string')
|
|
508
|
-
return;
|
|
509
|
-
const trackId = generateSequenceTrackId();
|
|
510
|
-
const track = {
|
|
511
|
-
type: 'BasicKeyframedTrack',
|
|
512
|
-
__debugName: `${p.objectKey}:${pathEncoded}`,
|
|
513
|
-
keyframes: [],
|
|
514
|
-
};
|
|
515
|
-
tracks.trackData[trackId] = track;
|
|
516
|
-
tracks.trackIdByPropPath[pathEncoded] = trackId;
|
|
517
|
-
}
|
|
518
|
-
sequence.setPrimitivePropAsSequenced = setPrimitivePropAsSequenced;
|
|
519
|
-
function setPrimitivePropAsStatic(p) {
|
|
520
|
-
const tracks = _ensureTracksOfObject(p);
|
|
521
|
-
const encodedPropPath = encodePathToProp(p.pathToProp);
|
|
522
|
-
const trackId = tracks.trackIdByPropPath[encodedPropPath];
|
|
523
|
-
if (typeof trackId !== 'string')
|
|
524
|
-
return;
|
|
525
|
-
delete tracks.trackIdByPropPath[encodedPropPath];
|
|
526
|
-
delete tracks.trackData[trackId];
|
|
527
|
-
stateEditors.coreByProject.historic.sheetsById.staticOverrides.byObject.setValueOfPrimitiveProp(p);
|
|
528
|
-
}
|
|
529
|
-
sequence.setPrimitivePropAsStatic = setPrimitivePropAsStatic;
|
|
530
|
-
function setCompoundPropAsStatic(p) {
|
|
531
|
-
const tracks = _ensureTracksOfObject(p);
|
|
532
|
-
for (const encodedPropPath of Object.keys(tracks.trackIdByPropPath)) {
|
|
533
|
-
const propPath = JSON.parse(encodedPropPath);
|
|
534
|
-
const isSubOfTargetPath = p.pathToProp.every((key, i) => propPath[i] === key);
|
|
535
|
-
if (isSubOfTargetPath) {
|
|
536
|
-
const trackId = tracks.trackIdByPropPath[encodedPropPath];
|
|
537
|
-
if (typeof trackId !== 'string')
|
|
538
|
-
continue;
|
|
539
|
-
delete tracks.trackIdByPropPath[encodedPropPath];
|
|
540
|
-
delete tracks.trackData[trackId];
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
stateEditors.coreByProject.historic.sheetsById.staticOverrides.byObject.setValueOfCompoundProp(p);
|
|
544
|
-
}
|
|
545
|
-
sequence.setCompoundPropAsStatic = setCompoundPropAsStatic;
|
|
546
|
-
function _getTrack(p) {
|
|
547
|
-
return _ensureTracksOfObject(p).trackData[p.trackId];
|
|
548
|
-
}
|
|
549
|
-
function _getKeyframeById(p) {
|
|
550
|
-
const track = _getTrack(p);
|
|
551
|
-
if (!track)
|
|
552
|
-
return;
|
|
553
|
-
return track.keyframes.find((kf) => kf.id === p.keyframeId);
|
|
554
|
-
}
|
|
555
|
-
/**
|
|
556
|
-
* Sets a keyframe at the exact specified position.
|
|
557
|
-
* Any position snapping should be done by the caller.
|
|
558
|
-
*/
|
|
559
|
-
function setKeyframeAtPosition(p) {
|
|
560
|
-
const position = p.snappingFunction(p.position);
|
|
561
|
-
const track = _getTrack(p);
|
|
562
|
-
if (!track)
|
|
563
|
-
return;
|
|
564
|
-
const { keyframes } = track;
|
|
565
|
-
const existingKeyframeIndex = keyframes.findIndex((kf) => kf.position === position);
|
|
566
|
-
if (existingKeyframeIndex !== -1) {
|
|
567
|
-
const kf = keyframes[existingKeyframeIndex];
|
|
568
|
-
kf.value = p.value;
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
const indexOfLeftKeyframe = findLastIndex(keyframes, (kf) => kf.position < position);
|
|
572
|
-
if (indexOfLeftKeyframe === -1) {
|
|
573
|
-
keyframes.unshift({
|
|
574
|
-
// generating the keyframe within the `setKeyframeAtPosition` makes it impossible for us
|
|
575
|
-
// to make this business logic deterministic, which is important to guarantee for collaborative
|
|
576
|
-
// editing.
|
|
577
|
-
id: generateKeyframeId(),
|
|
578
|
-
position,
|
|
579
|
-
connectedRight: true,
|
|
580
|
-
handles: p.handles || [0.5, 1, 0.5, 0],
|
|
581
|
-
type: p.type || 'bezier',
|
|
582
|
-
value: p.value,
|
|
583
|
-
});
|
|
584
|
-
return;
|
|
585
|
-
}
|
|
586
|
-
const leftKeyframe = keyframes[indexOfLeftKeyframe];
|
|
587
|
-
keyframes.splice(indexOfLeftKeyframe + 1, 0, {
|
|
588
|
-
id: generateKeyframeId(),
|
|
589
|
-
position,
|
|
590
|
-
connectedRight: leftKeyframe.connectedRight,
|
|
591
|
-
handles: p.handles || [0.5, 1, 0.5, 0],
|
|
592
|
-
type: p.type || 'bezier',
|
|
593
|
-
value: p.value,
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
sequence.setKeyframeAtPosition = setKeyframeAtPosition;
|
|
597
|
-
function unsetKeyframeAtPosition(p) {
|
|
598
|
-
const track = _getTrack(p);
|
|
599
|
-
if (!track)
|
|
600
|
-
return;
|
|
601
|
-
const { keyframes } = track;
|
|
602
|
-
const index = keyframes.findIndex((kf) => kf.position === p.position);
|
|
603
|
-
if (index === -1)
|
|
604
|
-
return;
|
|
605
|
-
keyframes.splice(index, 1);
|
|
606
|
-
}
|
|
607
|
-
sequence.unsetKeyframeAtPosition = unsetKeyframeAtPosition;
|
|
608
|
-
function transformKeyframes(p) {
|
|
609
|
-
const track = _getTrack(p);
|
|
610
|
-
if (!track)
|
|
611
|
-
return;
|
|
612
|
-
const initialKeyframes = current(track.keyframes);
|
|
613
|
-
const selectedKeyframes = initialKeyframes.filter((kf) => p.keyframeIds.includes(kf.id));
|
|
614
|
-
const transformed = selectedKeyframes.map((untransformedKf) => {
|
|
615
|
-
const oldPosition = untransformedKf.position;
|
|
616
|
-
const newPosition = p.snappingFunction(transformNumber(oldPosition, p));
|
|
617
|
-
return { ...untransformedKf, position: newPosition };
|
|
618
|
-
});
|
|
619
|
-
replaceKeyframes({ ...p, keyframes: transformed });
|
|
620
|
-
}
|
|
621
|
-
sequence.transformKeyframes = transformKeyframes;
|
|
622
|
-
/**
|
|
623
|
-
* Sets the easing between keyframes
|
|
624
|
-
*
|
|
625
|
-
* X = in keyframeIds
|
|
626
|
-
* * = not in keyframeIds
|
|
627
|
-
* + = modified handle
|
|
628
|
-
* ```
|
|
629
|
-
* X- --- -*- --- -X
|
|
630
|
-
* X+ --- +*- --- -X+
|
|
631
|
-
* ```
|
|
632
|
-
*
|
|
633
|
-
* TODO - explain further
|
|
634
|
-
*/
|
|
635
|
-
function setTweenBetweenKeyframes(p) {
|
|
636
|
-
const track = _getTrack(p);
|
|
637
|
-
if (!track)
|
|
638
|
-
return;
|
|
639
|
-
track.keyframes = track.keyframes.map((kf, i) => {
|
|
640
|
-
const prevKf = track.keyframes[i - 1];
|
|
641
|
-
const isBeingEdited = p.keyframeIds.includes(kf.id);
|
|
642
|
-
const isAfterEditedKeyframe = p.keyframeIds.includes(prevKf?.id);
|
|
643
|
-
if (isBeingEdited && !isAfterEditedKeyframe) {
|
|
644
|
-
return {
|
|
645
|
-
...kf,
|
|
646
|
-
handles: [
|
|
647
|
-
kf.handles[0],
|
|
648
|
-
kf.handles[1],
|
|
649
|
-
p.handles[0],
|
|
650
|
-
p.handles[1],
|
|
651
|
-
],
|
|
652
|
-
};
|
|
653
|
-
}
|
|
654
|
-
else if (isBeingEdited && isAfterEditedKeyframe) {
|
|
655
|
-
return {
|
|
656
|
-
...kf,
|
|
657
|
-
handles: [
|
|
658
|
-
p.handles[2],
|
|
659
|
-
p.handles[3],
|
|
660
|
-
p.handles[0],
|
|
661
|
-
p.handles[1],
|
|
662
|
-
],
|
|
663
|
-
};
|
|
664
|
-
}
|
|
665
|
-
else if (isAfterEditedKeyframe) {
|
|
666
|
-
return {
|
|
667
|
-
...kf,
|
|
668
|
-
handles: [
|
|
669
|
-
p.handles[2],
|
|
670
|
-
p.handles[3],
|
|
671
|
-
kf.handles[2],
|
|
672
|
-
kf.handles[3],
|
|
673
|
-
],
|
|
674
|
-
};
|
|
675
|
-
}
|
|
676
|
-
else {
|
|
677
|
-
return kf;
|
|
678
|
-
}
|
|
679
|
-
});
|
|
680
|
-
}
|
|
681
|
-
sequence.setTweenBetweenKeyframes = setTweenBetweenKeyframes;
|
|
682
|
-
function setHandlesForKeyframe(p) {
|
|
683
|
-
const keyframe = _getKeyframeById(p);
|
|
684
|
-
if (keyframe) {
|
|
685
|
-
keyframe.handles = [
|
|
686
|
-
p.end?.[0] ?? keyframe.handles[0],
|
|
687
|
-
p.end?.[1] ?? keyframe.handles[1],
|
|
688
|
-
p.start?.[0] ?? keyframe.handles[2],
|
|
689
|
-
p.start?.[1] ?? keyframe.handles[3],
|
|
690
|
-
];
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
sequence.setHandlesForKeyframe = setHandlesForKeyframe;
|
|
694
|
-
function deleteKeyframes(p) {
|
|
695
|
-
const track = _getTrack(p);
|
|
696
|
-
if (!track)
|
|
697
|
-
return;
|
|
698
|
-
track.keyframes = track.keyframes.filter((kf) => p.keyframeIds.indexOf(kf.id) === -1);
|
|
699
|
-
}
|
|
700
|
-
sequence.deleteKeyframes = deleteKeyframes;
|
|
701
|
-
function setKeyframeType(p) {
|
|
702
|
-
const kf = _getKeyframeById(p);
|
|
703
|
-
if (kf) {
|
|
704
|
-
kf.type = p.keyframeType;
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
sequence.setKeyframeType = setKeyframeType;
|
|
708
|
-
// Future: consider whether a list of "partial" keyframes requiring `id` is possible to accept
|
|
709
|
-
// * Consider how common this pattern is, as this sort of concept would best be encountered
|
|
710
|
-
// a few times to start to see an opportunity for improved ergonomics / crdt.
|
|
711
|
-
function replaceKeyframes(p) {
|
|
712
|
-
const track = _getTrack(p);
|
|
713
|
-
if (!track)
|
|
714
|
-
return;
|
|
715
|
-
const initialKeyframes = current(track.keyframes);
|
|
716
|
-
const sanitizedKeyframes = p.keyframes
|
|
717
|
-
.filter((kf) => {
|
|
718
|
-
if (typeof kf.value === 'number' && !isFinite(kf.value))
|
|
719
|
-
return false;
|
|
720
|
-
if (!kf.handles.every((handleValue) => isFinite(handleValue)))
|
|
721
|
-
return false;
|
|
722
|
-
return true;
|
|
723
|
-
})
|
|
724
|
-
.map((kf) => ({ ...kf, position: p.snappingFunction(kf.position) }));
|
|
725
|
-
const newKeyframesById = keyBy(sanitizedKeyframes, 'id');
|
|
726
|
-
const unselected = initialKeyframes.filter((kf) => !newKeyframesById[kf.id]);
|
|
727
|
-
const unselectedByPosition = keyBy(unselected, 'position');
|
|
728
|
-
// If the new transformed keyframes overlap with any existing keyframes,
|
|
729
|
-
// we remove the overlapped keyframes
|
|
730
|
-
sanitizedKeyframes.forEach(({ position }) => {
|
|
731
|
-
const existingKeyframeAtThisPosition = unselectedByPosition[position];
|
|
732
|
-
if (existingKeyframeAtThisPosition) {
|
|
733
|
-
pullFromArray(unselected, existingKeyframeAtThisPosition);
|
|
734
|
-
}
|
|
735
|
-
});
|
|
736
|
-
const sorted = sortBy([...unselected, ...sanitizedKeyframes], 'position');
|
|
737
|
-
track.keyframes = sorted;
|
|
738
|
-
}
|
|
739
|
-
sequence.replaceKeyframes = replaceKeyframes;
|
|
740
|
-
})(sequence = sheetsById_1.sequence || (sheetsById_1.sequence = {}));
|
|
741
|
-
let staticOverrides;
|
|
742
|
-
(function (staticOverrides) {
|
|
743
|
-
let byObject;
|
|
744
|
-
(function (byObject_1) {
|
|
745
|
-
function _ensure(p) {
|
|
746
|
-
const byObject = stateEditors.coreByProject.historic.sheetsById._ensure(p)
|
|
747
|
-
.staticOverrides.byObject;
|
|
748
|
-
byObject[p.objectKey] ??= {};
|
|
749
|
-
return byObject[p.objectKey];
|
|
750
|
-
}
|
|
751
|
-
function setValueOfCompoundProp(p) {
|
|
752
|
-
const existingOverrides = _ensure(p);
|
|
753
|
-
set(existingOverrides, p.pathToProp, p.value);
|
|
754
|
-
}
|
|
755
|
-
byObject_1.setValueOfCompoundProp = setValueOfCompoundProp;
|
|
756
|
-
function setValueOfPrimitiveProp(p) {
|
|
757
|
-
const existingOverrides = _ensure(p);
|
|
758
|
-
set(existingOverrides, p.pathToProp, p.value);
|
|
759
|
-
}
|
|
760
|
-
byObject_1.setValueOfPrimitiveProp = setValueOfPrimitiveProp;
|
|
761
|
-
function unsetValueOfPrimitiveProp(p) {
|
|
762
|
-
const existingStaticOverrides = stateEditors.coreByProject.historic.sheetsById._ensure(p)
|
|
763
|
-
.staticOverrides.byObject[p.objectKey];
|
|
764
|
-
if (!existingStaticOverrides)
|
|
765
|
-
return;
|
|
766
|
-
removePathFromObject(existingStaticOverrides, p.pathToProp);
|
|
767
|
-
}
|
|
768
|
-
byObject_1.unsetValueOfPrimitiveProp = unsetValueOfPrimitiveProp;
|
|
769
|
-
})(byObject = staticOverrides.byObject || (staticOverrides.byObject = {}));
|
|
770
|
-
})(staticOverrides = sheetsById_1.staticOverrides || (sheetsById_1.staticOverrides = {}));
|
|
771
|
-
})(sheetsById = historic.sheetsById || (historic.sheetsById = {}));
|
|
772
|
-
})(historic = coreByProject.historic || (coreByProject.historic = {}));
|
|
773
|
-
})(coreByProject = stateEditors.coreByProject || (stateEditors.coreByProject = {}));
|
|
774
|
-
})(stateEditors || (stateEditors = {}));
|