@tomorrowevening/theatre-studio 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +105 -56
- package/package.json +1 -1
- package/dist/IDBStorage.js +0 -19
- package/dist/PaneManager.js +0 -112
- package/dist/Scrub.js +0 -134
- package/dist/Studio.js +0 -405
- package/dist/StudioBundle.js +0 -21
- package/dist/StudioStore/StudioStore.js +0 -163
- package/dist/StudioStore/createTransactionPrivateApi.js +0 -204
- package/dist/StudioStore/generateDiskStateRevision.js +0 -4
- package/dist/StudioStore/persistStateOfStudio.js +0 -61
- package/dist/TheatreStudio.js +0 -154
- package/dist/UI/UI.js +0 -65
- package/dist/UI/UINonSSRBits.js +0 -60
- package/dist/UIRoot/PanelsRoot.js +0 -19
- package/dist/UIRoot/PointerCapturing.js +0 -96
- package/dist/UIRoot/ProvideTheme.js +0 -9
- package/dist/UIRoot/UIRoot.js +0 -79
- package/dist/UIRoot/useKeyboardShortcuts.js +0 -158
- package/dist/checkForUpdates.js +0 -86
- package/dist/css.js +0 -116
- package/dist/getStudio.js +0 -10
- package/dist/notify.js +0 -328
- package/dist/panels/BasePanel/BasePanel.js +0 -74
- package/dist/panels/BasePanel/ExtensionPaneWrapper.js +0 -138
- package/dist/panels/BasePanel/PanelDragZone.js +0 -88
- package/dist/panels/BasePanel/PanelResizeHandle.js +0 -184
- package/dist/panels/BasePanel/PanelResizers.js +0 -14
- package/dist/panels/BasePanel/PanelWrapper.js +0 -34
- package/dist/panels/BasePanel/common.js +0 -52
- package/dist/panels/DetailPanel/DetailPanel.js +0 -146
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail/DetailCompoundPropEditor.js +0 -169
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail/DetailSimplePropEditor.js +0 -22
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail/SingleRowPropEditor.js +0 -89
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail/getDetailRowHighlightBackground.js +0 -7
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail/rowIndentationFormulaCSS.js +0 -1
- package/dist/panels/DetailPanel/DeterminePropEditorForDetail.js +0 -28
- package/dist/panels/DetailPanel/EmptyState.js +0 -36
- package/dist/panels/DetailPanel/ObjectDetails.js +0 -52
- package/dist/panels/DetailPanel/ProjectDetails/StateConflictRow.js +0 -86
- package/dist/panels/DetailPanel/ProjectDetails.js +0 -98
- package/dist/panels/OutlinePanel/BaseItem.js +0 -136
- package/dist/panels/OutlinePanel/ObjectsList/ObjectItem.js +0 -14
- package/dist/panels/OutlinePanel/ObjectsList/ObjectsList.js +0 -85
- package/dist/panels/OutlinePanel/OutlinePanel.js +0 -73
- package/dist/panels/OutlinePanel/ProjectsList/ProjectListItem.js +0 -38
- package/dist/panels/OutlinePanel/ProjectsList/ProjectsList.js +0 -22
- package/dist/panels/OutlinePanel/SheetsList/SheetInstanceItem.js +0 -36
- package/dist/panels/OutlinePanel/SheetsList/SheetItem.js +0 -23
- package/dist/panels/OutlinePanel/SheetsList/SheetsList.js +0 -15
- package/dist/panels/OutlinePanel/outlinePanelUtils.js +0 -23
- package/dist/panels/SequenceEditorPanel/DopeSheet/DopeSheet.js +0 -21
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/AnyCompositeRow.js +0 -74
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/Left.js +0 -25
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/PrimitivePropRow.js +0 -97
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/PropWithChildrenRow.js +0 -15
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/SheetObjectRow.js +0 -19
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/SheetRow.js +0 -20
- package/dist/panels/SequenceEditorPanel/DopeSheet/Left/usePropHighlightMouseEnter.js +0 -33
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/AggregateKeyframeConnector.js +0 -187
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/AggregateKeyframeDot.js +0 -158
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/AggregateKeyframeEditor.js +0 -32
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/AggregateKeyframeVisualDot.js +0 -61
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/iif.js +0 -3
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregateKeyframeEditor/useAggregateKeyframeEditorUtils.js +0 -73
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/AggregatedKeyframeTrack/AggregatedKeyframeTrack.js +0 -407
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/BasicKeyframedTrack.js +0 -108
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/BasicKeyframeConnector.js +0 -185
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/CurveEditorPopover.js +0 -397
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/CurveSegmentEditor.js +0 -136
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/EasingOption.js +0 -52
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/SVGCurveSegment.js +0 -43
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/colors.js +0 -3
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/shared.js +0 -84
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/useFreezableMemo.js +0 -16
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/CurveEditorPopover/useUIOptionGrid.js +0 -82
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/DeterminePropEditorForSingleKeyframe.js +0 -93
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/SingleKeyframeDot.js +0 -254
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/SingleKeyframeEditor.js +0 -22
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/useSingleKeyframeInlineEditorPopover.js +0 -11
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/BasicKeyframedTrack/KeyframeEditor/useTempTransactionEditingTools.js +0 -43
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/DopeSheetBackground.js +0 -24
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/DopeSheetSelectionView.js +0 -272
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/FocusRangeCurtains.js +0 -88
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/HorizontallyScrollableArea.js +0 -215
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/KeyframeSnapTarget.js +0 -55
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/LengthIndicator/LengthEditorPopover.js +0 -69
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/LengthIndicator/LengthIndicator.js +0 -217
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/PrimitivePropRow.js +0 -25
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/PropWithChildrenRow.js +0 -18
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/Right.js +0 -30
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/Row.js +0 -50
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/SheetObjectRow.js +0 -14
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/SheetRow.js +0 -14
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/collectAggregateKeyframes.js +0 -92
- package/dist/panels/SequenceEditorPanel/DopeSheet/Right/keyframeRowUI/ConnectorLine.js +0 -62
- package/dist/panels/SequenceEditorPanel/DopeSheet/selections.js +0 -149
- package/dist/panels/SequenceEditorPanel/DopeSheet/setCollapsedSheetObjectOrCompoundProp.js +0 -10
- package/dist/panels/SequenceEditorPanel/FrameGrid/FrameGrid.js +0 -92
- package/dist/panels/SequenceEditorPanel/FrameGrid/StampsGrid.js +0 -99
- package/dist/panels/SequenceEditorPanel/FrameGrid/createGrid.js +0 -49
- package/dist/panels/SequenceEditorPanel/FrameStampPositionProvider.js +0 -189
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/BasicKeyframedTrack.js +0 -91
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/Curve.js +0 -87
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/CurveHandle.js +0 -186
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/GraphEditorDotNonScalar.js +0 -162
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/GraphEditorDotScalar.js +0 -209
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/GraphEditorNonScalarDash.js +0 -23
- package/dist/panels/SequenceEditorPanel/GraphEditor/BasicKeyframedTrack/KeyframeEditor/KeyframeEditor.js +0 -30
- package/dist/panels/SequenceEditorPanel/GraphEditor/GraphEditor.js +0 -73
- package/dist/panels/SequenceEditorPanel/GraphEditor/PrimitivePropGraph.js +0 -20
- package/dist/panels/SequenceEditorPanel/GraphEditorToggle.js +0 -59
- package/dist/panels/SequenceEditorPanel/RightOverlay/DopeSnap.js +0 -36
- package/dist/panels/SequenceEditorPanel/RightOverlay/DopeSnapHitZoneUI.js +0 -57
- package/dist/panels/SequenceEditorPanel/RightOverlay/FocusRangeZone/FocusRangeStrip.js +0 -233
- package/dist/panels/SequenceEditorPanel/RightOverlay/FocusRangeZone/FocusRangeThumb.js +0 -217
- package/dist/panels/SequenceEditorPanel/RightOverlay/FocusRangeZone/FocusRangeZone.js +0 -181
- package/dist/panels/SequenceEditorPanel/RightOverlay/FrameStamp.js +0 -65
- package/dist/panels/SequenceEditorPanel/RightOverlay/HorizontalScrollbar.js +0 -235
- package/dist/panels/SequenceEditorPanel/RightOverlay/Markers/MarkerDot.js +0 -184
- package/dist/panels/SequenceEditorPanel/RightOverlay/Markers/MarkerEditorPopover.js +0 -65
- package/dist/panels/SequenceEditorPanel/RightOverlay/Markers/Markers.js +0 -13
- package/dist/panels/SequenceEditorPanel/RightOverlay/Playhead.js +0 -265
- package/dist/panels/SequenceEditorPanel/RightOverlay/PlayheadPositionPopover.js +0 -64
- package/dist/panels/SequenceEditorPanel/RightOverlay/RightOverlay.js +0 -35
- package/dist/panels/SequenceEditorPanel/RightOverlay/TopStrip.js +0 -31
- package/dist/panels/SequenceEditorPanel/SequenceEditorPanel.js +0 -179
- package/dist/panels/SequenceEditorPanel/VerticalScrollContainer.js +0 -42
- package/dist/panels/SequenceEditorPanel/layout/layout.js +0 -166
- package/dist/panels/SequenceEditorPanel/layout/tree.js +0 -139
- package/dist/panels/SequenceEditorPanel/whatPropIsHighlighted.js +0 -58
- package/dist/propEditors/DefaultValueIndicator.js +0 -64
- package/dist/propEditors/NextPrevKeyframeCursors.js +0 -135
- package/dist/propEditors/getNearbyKeyframesOfTrack.js +0 -46
- package/dist/propEditors/simpleEditors/BooleanPropEditor.js +0 -17
- package/dist/propEditors/simpleEditors/FilePropEditor.js +0 -118
- package/dist/propEditors/simpleEditors/ISimplePropEditorReactProps.js +0 -1
- package/dist/propEditors/simpleEditors/ImagePropEditor.js +0 -126
- package/dist/propEditors/simpleEditors/NumberPropEditor.js +0 -9
- package/dist/propEditors/simpleEditors/RgbaPropEditor.js +0 -73
- package/dist/propEditors/simpleEditors/StringLiteralPropEditor.js +0 -10
- package/dist/propEditors/simpleEditors/StringPropEditor.js +0 -6
- package/dist/propEditors/simpleEditors/simplePropEditorByPropType.js +0 -16
- package/dist/propEditors/useEditingToolsForCompoundProp.js +0 -228
- package/dist/propEditors/useEditingToolsForSimpleProp.js +0 -229
- package/dist/propEditors/utils/IEditingTools.js +0 -1
- package/dist/propEditors/utils/PropConfigForType.js +0 -1
- package/dist/propEditors/utils/getPropTypeByPointer.js +0 -48
- package/dist/propEditors/utils/propNameTextCSS.js +0 -7
- package/dist/selectors.js +0 -63
- package/dist/store/index.js +0 -184
- package/dist/store/stateEditors.js +0 -774
- package/dist/store/types/ahistoric.js +0 -1
- package/dist/store/types/ephemeral.js +0 -1
- package/dist/store/types/historic.js +0 -1
- package/dist/store/types/index.js +0 -3
- package/dist/toolbars/ExtensionToolbar/ExtensionToolbar.js +0 -51
- package/dist/toolbars/ExtensionToolbar/Toolset.js +0 -27
- package/dist/toolbars/ExtensionToolbar/tools/ExtensionFlyoutMenu.js +0 -51
- package/dist/toolbars/ExtensionToolbar/tools/IconButton.js +0 -16
- package/dist/toolbars/ExtensionToolbar/tools/Switch.js +0 -20
- package/dist/toolbars/GlobalToolbar.js +0 -142
- package/dist/toolbars/MoreMenu/MoreMenu.js +0 -133
- package/dist/toolbars/PinButton.js +0 -26
- package/dist/uiComponents/DetailPanelButton.js +0 -21
- package/dist/uiComponents/PointerEventsHandler.js +0 -80
- package/dist/uiComponents/Popover/ArrowContext.js +0 -3
- package/dist/uiComponents/Popover/BasicPopover.js +0 -35
- package/dist/uiComponents/Popover/BasicTooltip.js +0 -10
- package/dist/uiComponents/Popover/ErrorTooltip.js +0 -9
- package/dist/uiComponents/Popover/MinimalTooltip.js +0 -6
- package/dist/uiComponents/Popover/PopoverArrow.js +0 -38
- package/dist/uiComponents/Popover/TooltipContext.js +0 -46
- package/dist/uiComponents/Popover/TooltipWrapper.js +0 -103
- package/dist/uiComponents/Popover/usePopover.js +0 -132
- package/dist/uiComponents/Popover/useTooltip.js +0 -33
- package/dist/uiComponents/RoomToClick.js +0 -10
- package/dist/uiComponents/SVGIcon.js +0 -19
- package/dist/uiComponents/ShowMousePosition.js +0 -30
- package/dist/uiComponents/colorPicker/components/EditingProvider.js +0 -15
- package/dist/uiComponents/colorPicker/components/RgbaColorPicker.js +0 -31
- package/dist/uiComponents/colorPicker/components/common/Alpha.js +0 -54
- package/dist/uiComponents/colorPicker/components/common/AlphaColorPicker.js +0 -28
- package/dist/uiComponents/colorPicker/components/common/Hue.js +0 -41
- package/dist/uiComponents/colorPicker/components/common/Interactive.js +0 -142
- package/dist/uiComponents/colorPicker/components/common/Pointer.js +0 -39
- package/dist/uiComponents/colorPicker/components/common/Saturation.js +0 -44
- package/dist/uiComponents/colorPicker/hooks/useColorManipulation.js +0 -77
- package/dist/uiComponents/colorPicker/hooks/useEventCallback.js +0 -10
- package/dist/uiComponents/colorPicker/hooks/useIsomorphicLayoutEffect.js +0 -5
- package/dist/uiComponents/colorPicker/index.js +0 -1
- package/dist/uiComponents/colorPicker/types.js +0 -1
- package/dist/uiComponents/colorPicker/utils/clamp.js +0 -6
- package/dist/uiComponents/colorPicker/utils/compare.js +0 -25
- package/dist/uiComponents/colorPicker/utils/convert.js +0 -165
- package/dist/uiComponents/colorPicker/utils/round.js +0 -3
- package/dist/uiComponents/colorPicker/utils/validate.js +0 -10
- package/dist/uiComponents/createCursorLock.js +0 -2
- package/dist/uiComponents/form/BasicCheckbox.js +0 -5
- package/dist/uiComponents/form/BasicNumberInput.js +0 -261
- package/dist/uiComponents/form/BasicSelect.js +0 -58
- package/dist/uiComponents/form/BasicStringInput.js +0 -151
- package/dist/uiComponents/form/BasicSwitch.js +0 -60
- package/dist/uiComponents/icons/AddImage.js +0 -6
- package/dist/uiComponents/icons/ArrowClockwise.js +0 -6
- package/dist/uiComponents/icons/ArrowsOutCardinal.js +0 -6
- package/dist/uiComponents/icons/Bell.js +0 -6
- package/dist/uiComponents/icons/Camera.js +0 -7
- package/dist/uiComponents/icons/ChevronDown.js +0 -6
- package/dist/uiComponents/icons/ChevronLeft.js +0 -6
- package/dist/uiComponents/icons/ChevronRight.js +0 -6
- package/dist/uiComponents/icons/Cube.js +0 -6
- package/dist/uiComponents/icons/CubeFull.js +0 -6
- package/dist/uiComponents/icons/CubeHalf.js +0 -6
- package/dist/uiComponents/icons/CubeRendered.js +0 -7
- package/dist/uiComponents/icons/Details.js +0 -6
- package/dist/uiComponents/icons/DoubleChevronLeft.js +0 -6
- package/dist/uiComponents/icons/DoubleChevronRight.js +0 -6
- package/dist/uiComponents/icons/Ellipsis.js +0 -6
- package/dist/uiComponents/icons/EllipsisFill.js +0 -6
- package/dist/uiComponents/icons/GlobeSimple.js +0 -6
- package/dist/uiComponents/icons/Outline.js +0 -6
- package/dist/uiComponents/icons/Package.js +0 -6
- package/dist/uiComponents/icons/Resize.js +0 -7
- package/dist/uiComponents/icons/Trash.js +0 -6
- package/dist/uiComponents/icons/index.js +0 -20
- package/dist/uiComponents/isSafari.js +0 -2
- package/dist/uiComponents/onPointerOutside.js +0 -19
- package/dist/uiComponents/selects/BasicSelect.js +0 -24
- package/dist/uiComponents/simpleContextMenu/ContextMenu/BaseMenu.js +0 -40
- package/dist/uiComponents/simpleContextMenu/ContextMenu/ContextMenu.js +0 -87
- package/dist/uiComponents/simpleContextMenu/ContextMenu/Item.js +0 -37
- package/dist/uiComponents/simpleContextMenu/useContextMenu.js +0 -20
- package/dist/uiComponents/simpleContextMenu/useRequestContextMenu.js +0 -22
- package/dist/uiComponents/toolbar/ToolbarDropdownSelect.js +0 -7
- package/dist/uiComponents/toolbar/ToolbarIconButton.js +0 -74
- package/dist/uiComponents/toolbar/ToolbarSwitchSelect.js +0 -12
- package/dist/uiComponents/toolbar/ToolbarSwitchSelectContainer.js +0 -9
- package/dist/uiComponents/useBoundingClientRect.js +0 -13
- package/dist/uiComponents/useDebugRefreshEvery.js +0 -19
- package/dist/uiComponents/useDrag.js +0 -199
- package/dist/uiComponents/useHotspot.js +0 -30
- package/dist/uiComponents/useHover.js +0 -23
- package/dist/uiComponents/useHoverWithoutDescendants.js +0 -33
- package/dist/uiComponents/useKeyDown.js +0 -9
- package/dist/uiComponents/useKeyDownCallback.js +0 -28
- package/dist/uiComponents/useLockSet.js +0 -17
- package/dist/uiComponents/useLogger.js +0 -16
- package/dist/uiComponents/useOnClickOutside.js +0 -25
- package/dist/uiComponents/useOnKeyDown.js +0 -12
- package/dist/uiComponents/usePresence.js +0 -156
- package/dist/uiComponents/useValToAtom.js +0 -11
- package/dist/utils/absoluteDims.js +0 -7
- package/dist/utils/contextualWebComponents.js +0 -44
- package/dist/utils/copyToClipboard.js +0 -28
- package/dist/utils/derive-utils.js +0 -61
- package/dist/utils/devStringify.js +0 -20
- package/dist/utils/invariant.js +0 -79
- package/dist/utils/isMac.js +0 -2
- package/dist/utils/keyboardUtils.js +0 -23
- package/dist/utils/mousePositionD.js +0 -18
- package/dist/utils/redux/actionCreator.js +0 -15
- package/dist/utils/redux/actionCreator.test.js +0 -35
- package/dist/utils/redux/actionReducersBundle.js +0 -18
- package/dist/utils/redux/atomFromReduxStore.js +0 -11
- package/dist/utils/redux/configureStore.js +0 -18
- package/dist/utils/redux/pointerFriendlySelector.js +0 -8
- package/dist/utils/redux/withHistory/withBatchActions.js +0 -13
- package/dist/utils/redux/withHistory/withHistory.js +0 -157
- package/dist/utils/renderInPortalInContext.js +0 -38
- package/dist/utils/selectClosestHTMLAncestor.js +0 -13
- package/dist/utils/tightJsonStringify.js +0 -27
- package/dist/utils/tightJsonStringify.test.js +0 -25
- package/dist/utils/useRefAndState.js +0 -32
package/dist/notify.js
DELETED
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
import React, { Fragment } from 'react';
|
|
2
|
-
import toast, { useToaster } from 'react-hot-toast/headless';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { pointerEventsAutoInNormalMode } from './css';
|
|
5
|
-
import { useVal } from '@tomorrowevening/theatre-react';
|
|
6
|
-
import getStudio from './getStudio';
|
|
7
|
-
import { marked } from 'marked';
|
|
8
|
-
import useTooltip from './uiComponents/Popover/useTooltip';
|
|
9
|
-
import MinimalTooltip from './uiComponents/Popover/MinimalTooltip';
|
|
10
|
-
/**
|
|
11
|
-
* Creates a string key unique to a notification with a certain title and message.
|
|
12
|
-
*/
|
|
13
|
-
const hashNotification = ({ title, message }) => `${title} ${message}`;
|
|
14
|
-
/**
|
|
15
|
-
* Used to check if a notification with a certain title and message is already displayed.
|
|
16
|
-
*/
|
|
17
|
-
const notificationUniquenessChecker = (() => {
|
|
18
|
-
const map = new Map();
|
|
19
|
-
return {
|
|
20
|
-
add: (notification) => {
|
|
21
|
-
const key = hashNotification(notification);
|
|
22
|
-
if (map.has(key)) {
|
|
23
|
-
map.set(key, map.get(key) + 1);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
map.set(key, 1);
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
delete: (notification) => {
|
|
30
|
-
const key = hashNotification(notification);
|
|
31
|
-
if (map.has(key) && map.get(key) > 1) {
|
|
32
|
-
map.set(key, map.get(key) - 1);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
map.delete(key);
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
clear: () => {
|
|
39
|
-
map.clear();
|
|
40
|
-
},
|
|
41
|
-
check: (notification) => map.has(hashNotification(notification)),
|
|
42
|
-
};
|
|
43
|
-
})();
|
|
44
|
-
/**
|
|
45
|
-
* Used to check if a notification with a certain type is already displayed.
|
|
46
|
-
*
|
|
47
|
-
* Massive hack, we should be able to attach this info to toasts.
|
|
48
|
-
*/
|
|
49
|
-
const notificationTypeChecker = (() => {
|
|
50
|
-
const map = new Map();
|
|
51
|
-
return {
|
|
52
|
-
add: (type) => {
|
|
53
|
-
if (map.has(type)) {
|
|
54
|
-
map.set(type, map.get(type) + 1);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
map.set(type, 1);
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
delete: (type) => {
|
|
61
|
-
if (map.has(type) && map.get(type) > 1) {
|
|
62
|
-
map.set(type, map.get(type) - 1);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
map.delete(type);
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
clear: () => {
|
|
69
|
-
map.clear();
|
|
70
|
-
},
|
|
71
|
-
check: (type) => map.has(type),
|
|
72
|
-
get types() {
|
|
73
|
-
return Array.of(...map.keys());
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
})();
|
|
77
|
-
//region Styles
|
|
78
|
-
const NotificationContainer = styled.div `
|
|
79
|
-
width: 100%;
|
|
80
|
-
border-radius: 4px;
|
|
81
|
-
display: flex;
|
|
82
|
-
gap: 12px;
|
|
83
|
-
${pointerEventsAutoInNormalMode};
|
|
84
|
-
background-color: rgba(40, 43, 47, 0.8);
|
|
85
|
-
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.15);
|
|
86
|
-
backdrop-filter: blur(14px);
|
|
87
|
-
|
|
88
|
-
@supports not (backdrop-filter: blur()) {
|
|
89
|
-
background: rgba(40, 43, 47, 0.95);
|
|
90
|
-
}
|
|
91
|
-
`;
|
|
92
|
-
const NotificationTitle = styled.div `
|
|
93
|
-
font-size: 14px;
|
|
94
|
-
font-weight: bold;
|
|
95
|
-
color: #fff;
|
|
96
|
-
`;
|
|
97
|
-
const NotificationMain = styled.div `
|
|
98
|
-
flex: 1;
|
|
99
|
-
flex-direction: column;
|
|
100
|
-
width: 0;
|
|
101
|
-
display: flex;
|
|
102
|
-
padding: 16px 0;
|
|
103
|
-
gap: 12px;
|
|
104
|
-
`;
|
|
105
|
-
const NotificationMessage = styled.div `
|
|
106
|
-
color: #b4b4b4;
|
|
107
|
-
font-size: 12px;
|
|
108
|
-
line-height: 1.4;
|
|
109
|
-
|
|
110
|
-
a {
|
|
111
|
-
color: rgba(255, 255, 255, 0.9);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
em {
|
|
115
|
-
font-style: italic;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
strong {
|
|
119
|
-
font-weight: bold;
|
|
120
|
-
color: #d5d5d5;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
p {
|
|
124
|
-
margin-bottom: 8px;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
code {
|
|
128
|
-
font-family: monospace;
|
|
129
|
-
background: rgba(0, 0, 0, 0.3);
|
|
130
|
-
padding: 1px 1px 2px;
|
|
131
|
-
border-radius: 4px;
|
|
132
|
-
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
133
|
-
white-space: pre-wrap;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
pre > code {
|
|
137
|
-
white-space: pre;
|
|
138
|
-
display: block;
|
|
139
|
-
overflow: auto;
|
|
140
|
-
padding: 4px;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
pre {
|
|
144
|
-
white-space: pre-wrap;
|
|
145
|
-
margin-bottom: 8px;
|
|
146
|
-
}
|
|
147
|
-
`;
|
|
148
|
-
const DismissButton = styled.button `
|
|
149
|
-
color: rgba(255, 255, 255, 0.9);
|
|
150
|
-
font-weight: 500;
|
|
151
|
-
display: flex;
|
|
152
|
-
align-items: center;
|
|
153
|
-
justify-content: center;
|
|
154
|
-
background: none;
|
|
155
|
-
border: none;
|
|
156
|
-
padding-left: 12px;
|
|
157
|
-
padding-right: 12px;
|
|
158
|
-
border-left: 1px solid rgba(255, 255, 255, 0.05);
|
|
159
|
-
|
|
160
|
-
&:hover {
|
|
161
|
-
background: rgba(255, 255, 255, 0.05);
|
|
162
|
-
}
|
|
163
|
-
`;
|
|
164
|
-
const COLORS = {
|
|
165
|
-
info: '#3b82f6',
|
|
166
|
-
success: '#10b981',
|
|
167
|
-
warning: '#f59e0b',
|
|
168
|
-
error: '#ef4444',
|
|
169
|
-
};
|
|
170
|
-
const IndicatorDot = styled.div `
|
|
171
|
-
display: flex;
|
|
172
|
-
justify-content: center;
|
|
173
|
-
margin-left: 12px;
|
|
174
|
-
padding-top: 21px;
|
|
175
|
-
|
|
176
|
-
::before {
|
|
177
|
-
content: '';
|
|
178
|
-
width: 8px;
|
|
179
|
-
height: 8px;
|
|
180
|
-
border-radius: 999999px;
|
|
181
|
-
background-color: ${({ type }) => COLORS[type]};
|
|
182
|
-
}
|
|
183
|
-
`;
|
|
184
|
-
//endregion
|
|
185
|
-
/**
|
|
186
|
-
* Creates handlers for different types of notifications.
|
|
187
|
-
*/
|
|
188
|
-
const createHandler = (type) => (title, message, docs = [], allowDuplicates = false) => {
|
|
189
|
-
// We can disallow duplicates. We do this through checking the notification contents
|
|
190
|
-
// against a registry of already displayed notifications.
|
|
191
|
-
if (allowDuplicates ||
|
|
192
|
-
!notificationUniquenessChecker.check({ title, message })) {
|
|
193
|
-
notificationUniquenessChecker.add({ title, message });
|
|
194
|
-
// We have not way sadly to attach custom notification types to react-hot-toast toasts,
|
|
195
|
-
// so we use our own data structure for it.
|
|
196
|
-
notificationTypeChecker.add(type);
|
|
197
|
-
toast.custom((t) => (React.createElement(NotificationContainer, null,
|
|
198
|
-
React.createElement(IndicatorDot, { type: type }),
|
|
199
|
-
React.createElement(NotificationMain, null,
|
|
200
|
-
React.createElement(NotificationTitle, null, title),
|
|
201
|
-
React.createElement(NotificationMessage, { dangerouslySetInnerHTML: {
|
|
202
|
-
__html: marked.parse(message),
|
|
203
|
-
} }),
|
|
204
|
-
docs.length > 0 && (React.createElement(NotificationMessage, null,
|
|
205
|
-
React.createElement("span", null,
|
|
206
|
-
"Docs:",
|
|
207
|
-
' ',
|
|
208
|
-
docs.map((doc, i) => (React.createElement(Fragment, { key: i },
|
|
209
|
-
i > 0 && ', ',
|
|
210
|
-
React.createElement("a", { target: "_blank", href: doc.url }, doc.title)))))))),
|
|
211
|
-
React.createElement(DismissButton, { onClick: () => {
|
|
212
|
-
toast.remove(t.id);
|
|
213
|
-
notificationUniquenessChecker.delete({ title, message });
|
|
214
|
-
notificationTypeChecker.delete(type);
|
|
215
|
-
} }, "Close"))), { duration: Infinity });
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
export const notify = {
|
|
219
|
-
warning: createHandler('warning'),
|
|
220
|
-
success: createHandler('success'),
|
|
221
|
-
info: createHandler('info'),
|
|
222
|
-
error: createHandler('error'),
|
|
223
|
-
};
|
|
224
|
-
//region Styles
|
|
225
|
-
const ButtonContainer = styled.div `
|
|
226
|
-
display: flex;
|
|
227
|
-
justify-content: ${({ align }) => (align === 'center' ? 'center' : 'flex-end')};
|
|
228
|
-
gap: 12px;
|
|
229
|
-
`;
|
|
230
|
-
const Button = styled.button `
|
|
231
|
-
position: relative;
|
|
232
|
-
border-radius: 4px;
|
|
233
|
-
display: flex;
|
|
234
|
-
align-items: center;
|
|
235
|
-
gap: 12px;
|
|
236
|
-
${pointerEventsAutoInNormalMode};
|
|
237
|
-
background-color: rgba(40, 43, 47, 0.8);
|
|
238
|
-
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.15);
|
|
239
|
-
backdrop-filter: blur(14px);
|
|
240
|
-
border: none;
|
|
241
|
-
padding: 12px;
|
|
242
|
-
color: #fff;
|
|
243
|
-
overflow: hidden;
|
|
244
|
-
|
|
245
|
-
::before {
|
|
246
|
-
content: '';
|
|
247
|
-
position: absolute;
|
|
248
|
-
inset: 0;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
:hover::before {
|
|
252
|
-
background: ${({ danger }) => danger ? 'rgba(255, 0, 0, 0.1)' : 'rgba(255, 255, 255, 0.1)'};
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
@supports not (backdrop-filter: blur()) {
|
|
256
|
-
background: rgba(40, 43, 47, 0.95);
|
|
257
|
-
}
|
|
258
|
-
`;
|
|
259
|
-
const NotifierContainer = styled.div `
|
|
260
|
-
z-index: 10;
|
|
261
|
-
display: flex;
|
|
262
|
-
flex-direction: column;
|
|
263
|
-
gap: 8px;
|
|
264
|
-
position: fixed;
|
|
265
|
-
right: 92px;
|
|
266
|
-
top: 50px;
|
|
267
|
-
width: 500px;
|
|
268
|
-
height: 85vh;
|
|
269
|
-
min-height: 400px;
|
|
270
|
-
`;
|
|
271
|
-
const NotificationScroller = styled.div `
|
|
272
|
-
overflow: hidden;
|
|
273
|
-
pointer-events: auto;
|
|
274
|
-
border-radius: 4px;
|
|
275
|
-
|
|
276
|
-
& > div {
|
|
277
|
-
display: flex;
|
|
278
|
-
flex-direction: column-reverse;
|
|
279
|
-
gap: 8px;
|
|
280
|
-
overflow: scroll;
|
|
281
|
-
height: 100%;
|
|
282
|
-
}
|
|
283
|
-
`;
|
|
284
|
-
const EmptyState = styled.div `
|
|
285
|
-
width: fit-content;
|
|
286
|
-
padding: 8px;
|
|
287
|
-
border-radius: 4px;
|
|
288
|
-
display: flex;
|
|
289
|
-
flex-direction: column;
|
|
290
|
-
gap: 12px;
|
|
291
|
-
color: #b4b4b4;
|
|
292
|
-
font-size: 12px;
|
|
293
|
-
line-height: 1.4;
|
|
294
|
-
`;
|
|
295
|
-
//endregion
|
|
296
|
-
export const useEmptyNotificationsTooltip = () => {
|
|
297
|
-
const { hasNotifications } = useNotifications();
|
|
298
|
-
return useTooltip({ enabled: !hasNotifications }, () => (React.createElement(MinimalTooltip, null,
|
|
299
|
-
React.createElement(EmptyState, null,
|
|
300
|
-
React.createElement(NotificationTitle, null, "No notifications"),
|
|
301
|
-
"Notifications will appear here when you get them."))));
|
|
302
|
-
};
|
|
303
|
-
/**
|
|
304
|
-
* The component responsible for rendering the notifications.
|
|
305
|
-
*/
|
|
306
|
-
export const Notifier = () => {
|
|
307
|
-
const { toasts, handlers } = useToaster();
|
|
308
|
-
const { startPause, endPause } = handlers;
|
|
309
|
-
const pinNotifications = useVal(getStudio().atomP.ahistoric.pinNotifications) ?? false;
|
|
310
|
-
return (React.createElement(NotifierContainer, null,
|
|
311
|
-
!pinNotifications
|
|
312
|
-
? null
|
|
313
|
-
: toasts.length > 0 && (React.createElement(NotificationScroller, { onMouseEnter: startPause, onMouseLeave: endPause },
|
|
314
|
-
React.createElement("div", null, toasts.map((toast) => {
|
|
315
|
-
return (React.createElement("div", { key: toast.id }, toast.message(toast)));
|
|
316
|
-
})))),
|
|
317
|
-
React.createElement(ButtonContainer, { align: "side" }, pinNotifications && toasts.length > 0 && (React.createElement(Button, { onClick: () => {
|
|
318
|
-
notificationTypeChecker.clear();
|
|
319
|
-
notificationUniquenessChecker.clear();
|
|
320
|
-
toast.remove();
|
|
321
|
-
}, danger: true }, "Clear")))));
|
|
322
|
-
};
|
|
323
|
-
export const useNotifications = () => {
|
|
324
|
-
const { toasts } = useToaster();
|
|
325
|
-
return {
|
|
326
|
-
hasNotifications: toasts.length > 0,
|
|
327
|
-
};
|
|
328
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { prism, val } from '@tomorrowevening/theatre-dataverse';
|
|
2
|
-
import { usePrism } from '@tomorrowevening/theatre-react';
|
|
3
|
-
import getStudio from '@tomorrowevening/theatre-studio/getStudio';
|
|
4
|
-
import useLockSet from '@tomorrowevening/theatre-studio/uiComponents/useLockSet';
|
|
5
|
-
import React, { useContext } from 'react';
|
|
6
|
-
import useWindowSize from 'react-use/esm/useWindowSize';
|
|
7
|
-
export const panelDimsToPanelPosition = (dims, windowDims) => {
|
|
8
|
-
const left = dims.left / windowDims.width;
|
|
9
|
-
const right = (dims.left + dims.width) / windowDims.width;
|
|
10
|
-
const top = dims.top / windowDims.height;
|
|
11
|
-
const bottom = (dims.height + dims.top) / windowDims.height;
|
|
12
|
-
const position = {
|
|
13
|
-
edges: {
|
|
14
|
-
left: left <= 0.5
|
|
15
|
-
? { from: 'screenLeft', distance: left }
|
|
16
|
-
: { from: 'screenRight', distance: 1 - left },
|
|
17
|
-
right: right <= 0.5
|
|
18
|
-
? { from: 'screenLeft', distance: right }
|
|
19
|
-
: { from: 'screenRight', distance: 1 - right },
|
|
20
|
-
top: top <= 0.5
|
|
21
|
-
? { from: 'screenTop', distance: top }
|
|
22
|
-
: { from: 'screenBottom', distance: 1 - top },
|
|
23
|
-
bottom: bottom <= 0.5
|
|
24
|
-
? { from: 'screenTop', distance: bottom }
|
|
25
|
-
: { from: 'screenBottom', distance: 1 - bottom },
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
return position;
|
|
29
|
-
};
|
|
30
|
-
const PanelContext = React.createContext(null);
|
|
31
|
-
export const usePanel = () => useContext(PanelContext);
|
|
32
|
-
const BasePanel = ({ panelId, children, defaultPosition, minDims }) => {
|
|
33
|
-
const windowSize = useWindowSize(800, 200);
|
|
34
|
-
const [boundsHighlighted, addBoundsHighlightLock] = useLockSet();
|
|
35
|
-
const { stuff } = usePrism(() => {
|
|
36
|
-
const { edges } = val(getStudio().atomP.historic.panelPositions[panelId]) ??
|
|
37
|
-
defaultPosition;
|
|
38
|
-
const left = Math.floor(windowSize.width *
|
|
39
|
-
(edges.left.from === 'screenLeft'
|
|
40
|
-
? edges.left.distance
|
|
41
|
-
: 1 - edges.left.distance));
|
|
42
|
-
const right = Math.floor(windowSize.width *
|
|
43
|
-
(edges.right.from === 'screenLeft'
|
|
44
|
-
? edges.right.distance
|
|
45
|
-
: 1 - edges.right.distance));
|
|
46
|
-
const top = Math.floor(windowSize.height *
|
|
47
|
-
(edges.top.from === 'screenTop'
|
|
48
|
-
? edges.top.distance
|
|
49
|
-
: 1 - edges.top.distance));
|
|
50
|
-
const bottom = Math.floor(windowSize.height *
|
|
51
|
-
(edges.bottom.from === 'screenTop'
|
|
52
|
-
? edges.bottom.distance
|
|
53
|
-
: 1 - edges.bottom.distance));
|
|
54
|
-
const width = Math.max(right - left, minDims.width);
|
|
55
|
-
const height = Math.max(bottom - top, minDims.height);
|
|
56
|
-
// memo-ing dims so its ref can be used as a cache key
|
|
57
|
-
const dims = prism.memo('dims', () => ({
|
|
58
|
-
width,
|
|
59
|
-
left,
|
|
60
|
-
top,
|
|
61
|
-
height,
|
|
62
|
-
}), [width, left, top, height]);
|
|
63
|
-
const stuff = {
|
|
64
|
-
dims: dims,
|
|
65
|
-
panelId,
|
|
66
|
-
minDims,
|
|
67
|
-
boundsHighlighted,
|
|
68
|
-
addBoundsHighlightLock,
|
|
69
|
-
};
|
|
70
|
-
return { stuff };
|
|
71
|
-
}, [panelId, windowSize, boundsHighlighted, addBoundsHighlightLock]);
|
|
72
|
-
return React.createElement(PanelContext.Provider, { value: stuff }, children);
|
|
73
|
-
};
|
|
74
|
-
export default BasePanel;
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useLayoutEffect, useState } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { F2 as F2Impl, TitleBar } from './common';
|
|
4
|
-
import BasePanel from './BasePanel';
|
|
5
|
-
import PanelDragZone from './PanelDragZone';
|
|
6
|
-
import PanelWrapper from './PanelWrapper';
|
|
7
|
-
import { ErrorBoundary } from 'react-error-boundary';
|
|
8
|
-
import { IoClose } from 'react-icons/all';
|
|
9
|
-
import getStudio from '@tomorrowevening/theatre-studio/getStudio';
|
|
10
|
-
import { panelZIndexes } from '@tomorrowevening/theatre-studio/panels/BasePanel/common';
|
|
11
|
-
import { useVal } from '@tomorrowevening/theatre-react';
|
|
12
|
-
const defaultPosition = {
|
|
13
|
-
edges: {
|
|
14
|
-
left: { from: 'screenLeft', distance: 0.3 },
|
|
15
|
-
right: { from: 'screenRight', distance: 0.3 },
|
|
16
|
-
top: { from: 'screenTop', distance: 0.3 },
|
|
17
|
-
bottom: { from: 'screenBottom', distance: 0.3 },
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
const minDims = { width: 300, height: 300 };
|
|
21
|
-
const ExtensionPaneWrapper = ({ paneInstance }) => {
|
|
22
|
-
return (React.createElement(BasePanel, { panelId: `pane-${paneInstance.instanceId}`, defaultPosition: defaultPosition, minDims: minDims },
|
|
23
|
-
React.createElement(Content, { paneInstance: paneInstance })));
|
|
24
|
-
};
|
|
25
|
-
const Container = styled(PanelWrapper) `
|
|
26
|
-
display: flex;
|
|
27
|
-
flex-direction: column;
|
|
28
|
-
|
|
29
|
-
box-shadow: 0px 5px 12px -4px rgb(0 0 0 / 22%);
|
|
30
|
-
z-index: ${(props) => props.$zIndex};
|
|
31
|
-
`;
|
|
32
|
-
const Title = styled.div `
|
|
33
|
-
width: 100%;
|
|
34
|
-
`;
|
|
35
|
-
const PaneTools = styled.div `
|
|
36
|
-
display: flex;
|
|
37
|
-
align-items: center;
|
|
38
|
-
opacity: 1;
|
|
39
|
-
position: absolute;
|
|
40
|
-
right: 4px;
|
|
41
|
-
top: 0;
|
|
42
|
-
bottom: 0;
|
|
43
|
-
`;
|
|
44
|
-
const ClosePanelButton = styled.button `
|
|
45
|
-
display: flex;
|
|
46
|
-
align-items: center;
|
|
47
|
-
justify-content: center;
|
|
48
|
-
border-radius: 2px;
|
|
49
|
-
font-size: 11px;
|
|
50
|
-
height: 10px;
|
|
51
|
-
width: 18px;
|
|
52
|
-
color: #adadadb3;
|
|
53
|
-
background: transparent;
|
|
54
|
-
border: none;
|
|
55
|
-
cursor: pointer;
|
|
56
|
-
&:hover {
|
|
57
|
-
color: white;
|
|
58
|
-
}
|
|
59
|
-
`;
|
|
60
|
-
/**
|
|
61
|
-
* The &:after part blocks pointer events from reaching the content of the
|
|
62
|
-
* pane when a drag gesture is active in theatre's UI. It's a hack and its downside
|
|
63
|
-
* is that pane content cannot interact with the rest of theatre's UI while a drag
|
|
64
|
-
* gesture is active.
|
|
65
|
-
* TODO find a less hacky way?
|
|
66
|
-
*/
|
|
67
|
-
const F2 = styled(F2Impl) `
|
|
68
|
-
position: relative;
|
|
69
|
-
overflow: hidden;
|
|
70
|
-
|
|
71
|
-
&:after {
|
|
72
|
-
z-index: 10;
|
|
73
|
-
position: absolute;
|
|
74
|
-
inset: 0;
|
|
75
|
-
display: block;
|
|
76
|
-
content: ' ';
|
|
77
|
-
pointer-events: none;
|
|
78
|
-
|
|
79
|
-
#pointer-root:not(.normal) & {
|
|
80
|
-
pointer-events: auto;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
`;
|
|
84
|
-
const ErrorContainer = styled.div `
|
|
85
|
-
padding: 12px;
|
|
86
|
-
|
|
87
|
-
& > pre {
|
|
88
|
-
border: 1px solid #ff62624f;
|
|
89
|
-
background-color: rgb(255 0 0 / 5%);
|
|
90
|
-
margin: 8px 0;
|
|
91
|
-
padding: 8px;
|
|
92
|
-
font-family: monospace;
|
|
93
|
-
overflow: scroll;
|
|
94
|
-
color: #ff9896;
|
|
95
|
-
}
|
|
96
|
-
`;
|
|
97
|
-
const ErrorFallback = (props) => {
|
|
98
|
-
return (React.createElement(ErrorContainer, null,
|
|
99
|
-
"An Error occurred rendering this pane. Open the console for more info.",
|
|
100
|
-
React.createElement("pre", null, JSON.stringify({ message: props.error.message, stack: props.error.stack }, null, 2))));
|
|
101
|
-
};
|
|
102
|
-
const Content = ({ paneInstance, }) => {
|
|
103
|
-
const [mountingPoint, setMountingPoint] = useState(null);
|
|
104
|
-
const mount = paneInstance.definition.mount;
|
|
105
|
-
useLayoutEffect(() => {
|
|
106
|
-
if (!mountingPoint)
|
|
107
|
-
return;
|
|
108
|
-
const unmount = mount({
|
|
109
|
-
paneId: paneInstance.instanceId,
|
|
110
|
-
node: mountingPoint,
|
|
111
|
-
});
|
|
112
|
-
if (typeof unmount === 'function') {
|
|
113
|
-
return unmount;
|
|
114
|
-
}
|
|
115
|
-
}, [mountingPoint, mount, paneInstance.instanceId]);
|
|
116
|
-
const closePane = useCallback(() => {
|
|
117
|
-
getStudio().paneManager.destroyPane(paneInstance.instanceId);
|
|
118
|
-
}, [paneInstance]);
|
|
119
|
-
const bringToFront = useCallback(() => {
|
|
120
|
-
getStudio().paneManager.bringPaneToFront(paneInstance.instanceId);
|
|
121
|
-
}, [paneInstance]);
|
|
122
|
-
// Calculate z-index based on focus order
|
|
123
|
-
const focusOrder = useVal(getStudio().atomP.historic.paneFocusOrder) ?? [];
|
|
124
|
-
const focusIndex = focusOrder.indexOf(paneInstance.instanceId);
|
|
125
|
-
const zIndex = focusIndex >= 0
|
|
126
|
-
? panelZIndexes.pluginPanes + focusIndex
|
|
127
|
-
: panelZIndexes.pluginPanes;
|
|
128
|
-
return (React.createElement(Container, { "data-testid": `theatre-pane-wrapper-${paneInstance.instanceId}`, "$zIndex": zIndex, onMouseDown: bringToFront },
|
|
129
|
-
React.createElement(PanelDragZone, null,
|
|
130
|
-
React.createElement(TitleBar, null,
|
|
131
|
-
React.createElement(PaneTools, null,
|
|
132
|
-
React.createElement(ClosePanelButton, { onClick: closePane, title: 'Close Pane' },
|
|
133
|
-
React.createElement(IoClose, null))),
|
|
134
|
-
React.createElement(Title, null, paneInstance.instanceId))),
|
|
135
|
-
React.createElement(ErrorBoundary, { FallbackComponent: ErrorFallback },
|
|
136
|
-
React.createElement(F2, { "data-testid": `theatre-pane-content-${paneInstance.instanceId}`, ref: setMountingPoint }))));
|
|
137
|
-
};
|
|
138
|
-
export default ExtensionPaneWrapper;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import useRefAndState from '@tomorrowevening/theatre-studio/utils/useRefAndState';
|
|
2
|
-
import getStudio from '@tomorrowevening/theatre-studio/getStudio';
|
|
3
|
-
import useDrag from '@tomorrowevening/theatre-studio/uiComponents/useDrag';
|
|
4
|
-
import React, { useMemo, useRef } from 'react';
|
|
5
|
-
import styled from 'styled-components';
|
|
6
|
-
import { panelDimsToPanelPosition, usePanel } from './BasePanel';
|
|
7
|
-
import { useCssCursorLock } from '@tomorrowevening/theatre-studio/uiComponents/PointerEventsHandler';
|
|
8
|
-
import { clamp } from 'lodash-es';
|
|
9
|
-
import { minVisibleSize } from './common';
|
|
10
|
-
const Container = styled.div `
|
|
11
|
-
cursor: move;
|
|
12
|
-
`;
|
|
13
|
-
const PanelDragZone = (props) => {
|
|
14
|
-
const panelStuff = usePanel();
|
|
15
|
-
const panelStuffRef = useRef(panelStuff);
|
|
16
|
-
panelStuffRef.current = panelStuff;
|
|
17
|
-
const [ref, node] = useRefAndState(null);
|
|
18
|
-
const dragOpts = useMemo(() => {
|
|
19
|
-
return {
|
|
20
|
-
debugName: 'PanelDragZone',
|
|
21
|
-
lockCursorTo: 'move',
|
|
22
|
-
onDragStart() {
|
|
23
|
-
const stuffBeforeDrag = panelStuffRef.current;
|
|
24
|
-
let tempTransaction;
|
|
25
|
-
const unlock = panelStuff.addBoundsHighlightLock();
|
|
26
|
-
// Bring pane to front when starting to drag
|
|
27
|
-
const panelId = stuffBeforeDrag.panelId;
|
|
28
|
-
if (panelId.startsWith('pane-')) {
|
|
29
|
-
const paneInstanceId = panelId.slice(5); // Remove 'pane-' prefix
|
|
30
|
-
getStudio().paneManager.bringPaneToFront(paneInstanceId);
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
onDrag(dx, dy) {
|
|
34
|
-
const newDims = {
|
|
35
|
-
...stuffBeforeDrag.dims,
|
|
36
|
-
top: clamp(stuffBeforeDrag.dims.top + dy, 0, window.innerHeight - minVisibleSize),
|
|
37
|
-
left: clamp(stuffBeforeDrag.dims.left + dx, -stuffBeforeDrag.dims.width + minVisibleSize, window.innerWidth - minVisibleSize),
|
|
38
|
-
};
|
|
39
|
-
const position = panelDimsToPanelPosition(newDims, {
|
|
40
|
-
width: window.innerWidth,
|
|
41
|
-
height: window.innerHeight,
|
|
42
|
-
});
|
|
43
|
-
tempTransaction?.discard();
|
|
44
|
-
tempTransaction = getStudio().tempTransaction(({ stateEditors }) => {
|
|
45
|
-
stateEditors.studio.historic.panelPositions.setPanelPosition({
|
|
46
|
-
position,
|
|
47
|
-
panelId: stuffBeforeDrag.panelId,
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
},
|
|
51
|
-
onDragEnd(dragHappened) {
|
|
52
|
-
unlock();
|
|
53
|
-
if (dragHappened) {
|
|
54
|
-
tempTransaction?.commit();
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
tempTransaction?.discard();
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
}, []);
|
|
64
|
-
const [isDragging] = useDrag(node, dragOpts);
|
|
65
|
-
useCssCursorLock(isDragging, 'dragging', 'move');
|
|
66
|
-
const [onMouseEnter, onMouseLeave] = useMemo(() => {
|
|
67
|
-
let unlock;
|
|
68
|
-
return [
|
|
69
|
-
function onMouseEnter() {
|
|
70
|
-
if (unlock) {
|
|
71
|
-
const u = unlock;
|
|
72
|
-
unlock = undefined;
|
|
73
|
-
u();
|
|
74
|
-
}
|
|
75
|
-
unlock = panelStuff.addBoundsHighlightLock();
|
|
76
|
-
},
|
|
77
|
-
function onMouseLeave() {
|
|
78
|
-
if (unlock) {
|
|
79
|
-
const u = unlock;
|
|
80
|
-
unlock = undefined;
|
|
81
|
-
u();
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
];
|
|
85
|
-
}, []);
|
|
86
|
-
return (React.createElement(Container, { ...props, ref: ref, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave }));
|
|
87
|
-
};
|
|
88
|
-
export default PanelDragZone;
|