@remotion/studio 4.0.502 → 4.0.503
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/components/AssetSelectorItem.js +2 -2
- package/dist/components/Canvas.js +34 -54
- package/dist/components/ColorPicker/AlphaSlider.js +14 -10
- package/dist/components/ColorPicker/HueSlider.js +14 -10
- package/dist/components/ColorPicker/SaturationValueArea.js +14 -12
- package/dist/components/CompositionContextButton.js +1 -1
- package/dist/components/ConfigureDefaultEditorModal.d.ts +2 -0
- package/dist/components/ConfigureDefaultEditorModal.js +151 -0
- package/dist/components/ConfirmationDialog.js +6 -3
- package/dist/components/ContextMenu.js +0 -2
- package/dist/components/Editor.js +1 -4
- package/dist/components/EditorGuides/Guide.js +48 -74
- package/dist/components/EditorRuler/Ruler.d.ts +1 -0
- package/dist/components/EditorRuler/Ruler.js +3 -1
- package/dist/components/EditorRuler/index.js +26 -23
- package/dist/components/ElementInstallConfirmation.d.ts +12 -0
- package/dist/components/ElementInstallConfirmation.js +205 -0
- package/dist/components/ForceSpecificCursor.js +14 -0
- package/dist/components/InlineAction.d.ts +2 -1
- package/dist/components/InlineAction.js +3 -3
- package/dist/components/InspectorLocationCopy.d.ts +1 -0
- package/dist/components/InspectorLocationCopy.js +7 -3
- package/dist/components/InspectorOpenInEditor.d.ts +5 -0
- package/dist/components/InspectorOpenInEditor.js +135 -0
- package/dist/components/InspectorPanel/AlignmentControls.js +1 -1
- package/dist/components/InspectorPanel/CompositionInspectorHeader.js +3 -3
- package/dist/components/InspectorPanel/CompositionMetadata.js +1 -1
- package/dist/components/InspectorPanel/KeyframeEasingNavigator.js +2 -2
- package/dist/components/InspectorPanel/SequenceInspectorHeader.js +2 -2
- package/dist/components/InspectorSequenceSection.js +2 -2
- package/dist/components/Menu/MenuItem.js +13 -6
- package/dist/components/Menu/MenuSubItem.js +3 -1
- package/dist/components/MenuBuildIndicator.js +1 -1
- package/dist/components/MenuCompositionName.js +1 -1
- package/dist/components/MobilePanel.js +5 -1
- package/dist/components/ModalContainer.js +1 -1
- package/dist/components/ModalFooter.d.ts +1 -0
- package/dist/components/ModalFooter.js +2 -2
- package/dist/components/Modals.js +11 -2
- package/dist/components/NewComposition/InputDragger.js +19 -29
- package/dist/components/PreviewToolbarOverflowButton.js +1 -1
- package/dist/components/RenderModal/InlineEyeIcon.js +1 -1
- package/dist/components/RenderModal/InlineRemoveButton.js +1 -1
- package/dist/components/RenderModal/RenderModalOutputName.js +1 -1
- package/dist/components/RenderModal/SchemaEditor/SchemaResetButton.js +1 -1
- package/dist/components/RenderQueue/RenderQueueCopyToClipboard.js +1 -1
- package/dist/components/RenderQueue/RenderQueueDownloadItem.js +1 -1
- package/dist/components/RenderQueue/RenderQueueItemCancelButton.js +1 -1
- package/dist/components/RenderQueue/RenderQueueOpenInFolder.js +1 -1
- package/dist/components/RenderQueue/RenderQueueRemoveItem.js +1 -1
- package/dist/components/RenderQueue/RenderQueueRepeat.js +1 -1
- package/dist/components/SelectedOutlineCropControls.js +7 -6
- package/dist/components/SelectedOutlineElement.js +28 -26
- package/dist/components/SelectedOutlineUvControls.js +25 -24
- package/dist/components/ShowGuidesProvider.js +2 -0
- package/dist/components/SidebarCollapserControls.js +2 -2
- package/dist/components/SidebarRenderButton.js +1 -1
- package/dist/components/Splitter/SplitterHandle.js +17 -68
- package/dist/components/Timeline/EasingEditorModal.js +27 -19
- package/dist/components/Timeline/TimelineAssetField.js +1 -1
- package/dist/components/Timeline/TimelineDragHandler.js +38 -7
- package/dist/components/Timeline/TimelineInOutDragHandler.js +26 -11
- package/dist/components/Timeline/TimelineLayerEye.js +36 -4
- package/dist/components/Timeline/TimelineSelection.js +14 -21
- package/dist/components/Timeline/TimelineSequence.js +7 -3
- package/dist/components/Timeline/TimelineSequenceItem.js +24 -18
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.d.ts +1 -1
- package/dist/components/Timeline/TimelineSequenceRightEdgeDragHandle.js +76 -43
- package/dist/components/Timeline/TimelineStack/get-stack.js +7 -2
- package/dist/components/Timeline/get-sequence-context-menu-items.d.ts +4 -2
- package/dist/components/Timeline/get-sequence-context-menu-items.js +38 -2
- package/dist/components/Timeline/should-subscribe-to-source-file.d.ts +1 -0
- package/dist/components/Timeline/should-subscribe-to-source-file.js +11 -0
- package/dist/components/Timeline/use-open-sequence-in-editor.d.ts +3 -1
- package/dist/components/Timeline/use-open-sequence-in-editor.js +5 -2
- package/dist/components/Timeline/use-sequence-props-subscription.js +2 -0
- package/dist/components/Timeline/use-timeline-asset-drop.js +0 -4
- package/dist/components/Timeline/use-timeline-keyframe-drag.js +31 -16
- package/dist/components/UndoRedoButtons.js +1 -1
- package/dist/components/UpdateCheck.d.ts +2 -0
- package/dist/components/UpdateCheck.js +12 -7
- package/dist/components/UpdateModal/UpdateModal.js +26 -10
- package/dist/components/VisualControls/ClickableFileName.js +5 -2
- package/dist/components/composition-menu-items.js +1 -1
- package/dist/components/element-install-request.d.ts +3 -0
- package/dist/components/element-install-request.js +17 -0
- package/dist/components/folder-menu-items.js +1 -1
- package/dist/components/handle-drop.d.ts +2 -3
- package/dist/components/handle-drop.js +11 -4
- package/dist/components/import-assets.d.ts +5 -5
- package/dist/components/import-assets.js +4 -15
- package/dist/components/use-default-editor-info.d.ts +4 -0
- package/dist/components/use-default-editor-info.js +47 -0
- package/dist/error-overlay/remotion-overlay/OpenInEditor.js +1 -1
- package/dist/error-overlay/remotion-overlay/StackFrame.js +1 -1
- package/dist/esm/{chunk-fjv75ty4.js → chunk-bj1r1hh5.js} +7068 -6120
- package/dist/esm/internals.mjs +7068 -6120
- package/dist/esm/previewEntry.mjs +7077 -6129
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/inject-css.js +18 -44
- package/dist/helpers/open-in-editor.d.ts +3 -3
- package/dist/helpers/open-in-editor.js +10 -6
- package/dist/helpers/pointer-session.d.ts +9 -0
- package/dist/helpers/pointer-session.js +94 -0
- package/dist/helpers/use-menu-structure.js +24 -2
- package/dist/icons/custom-editor.d.ts +4 -0
- package/dist/icons/custom-editor.js +11 -0
- package/dist/icons/editor.d.ts +6 -0
- package/dist/icons/editor.js +52 -0
- package/dist/state/editor-guides.d.ts +1 -0
- package/dist/state/editor-guides.js +1 -0
- package/dist/state/modals.d.ts +2 -0
- package/dist/state/z-index.d.ts +1 -0
- package/dist/state/z-index.js +34 -18
- package/package.json +12 -13
- package/dist/components/StudioCanvasCapture.d.ts +0 -5
- package/dist/components/StudioCanvasCapture.js +0 -40
- package/dist/components/canvas-capture-enabled.d.ts +0 -1
- package/dist/components/canvas-capture-enabled.js +0 -4
- package/dist/components/use-element-overwrite-confirmation.d.ts +0 -2
- package/dist/components/use-element-overwrite-confirmation.js +0 -73
|
@@ -4,6 +4,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const no_react_1 = require("remotion/no-react");
|
|
6
6
|
const editor_guide_selection_1 = require("../../helpers/editor-guide-selection");
|
|
7
|
+
const pointer_session_1 = require("../../helpers/pointer-session");
|
|
7
8
|
const editor_guides_1 = require("../../state/editor-guides");
|
|
8
9
|
const editor_rulers_1 = require("../../state/editor-rulers");
|
|
9
10
|
const ContextMenu_1 = require("../ContextMenu");
|
|
@@ -12,7 +13,7 @@ const should_clear_selection_on_pointer_down_1 = require("../Timeline/should-cle
|
|
|
12
13
|
const TimelineSelection_1 = require("../Timeline/TimelineSelection");
|
|
13
14
|
const PADDING_FOR_EASY_DRAG = 4;
|
|
14
15
|
const GuideComp = ({ guide, canvasDimensions, scale }) => {
|
|
15
|
-
const { shouldCreateGuideRef, shouldDeleteGuideRef, setGuidesList, setDraggingGuideId, setHoveredGuideId, hoveredGuideId, draggingGuideId, } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
|
|
16
|
+
const { shouldCreateGuideRef, shouldDeleteGuideRef, setGuidesList, setDraggingGuideId, setHoveredGuideId, hoveredGuideId, draggingGuideId, moveGuidePointerRef, } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
|
|
16
17
|
const { clearSelection, onSelect, selected } = (0, TimelineSelection_1.useTimelineGuideSelection)(guide.id);
|
|
17
18
|
const pointerDownPositionRef = (0, react_1.useRef)(null);
|
|
18
19
|
const hasMovedGuideRef = (0, react_1.useRef)(false);
|
|
@@ -61,36 +62,6 @@ const GuideComp = ({ guide, canvasDimensions, scale }) => {
|
|
|
61
62
|
selected,
|
|
62
63
|
draggingGuideId,
|
|
63
64
|
]);
|
|
64
|
-
const onPointerDown = (0, react_1.useCallback)((e) => {
|
|
65
|
-
if (e.button !== 0) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
e.stopPropagation();
|
|
69
|
-
e.currentTarget.setPointerCapture(e.pointerId);
|
|
70
|
-
hasMovedGuideRef.current = false;
|
|
71
|
-
pointerDownPositionRef.current = {
|
|
72
|
-
guideId: guide.id,
|
|
73
|
-
clientX: e.clientX,
|
|
74
|
-
clientY: e.clientY,
|
|
75
|
-
};
|
|
76
|
-
shouldCreateGuideRef.current = false;
|
|
77
|
-
setDraggingGuideId(() => guide.id);
|
|
78
|
-
}, [guide.id, setDraggingGuideId, shouldCreateGuideRef]);
|
|
79
|
-
const onMouseDown = (0, react_1.useCallback)((e) => {
|
|
80
|
-
if (e.button !== 0) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
e.preventDefault();
|
|
84
|
-
e.stopPropagation();
|
|
85
|
-
hasMovedGuideRef.current = false;
|
|
86
|
-
pointerDownPositionRef.current = {
|
|
87
|
-
guideId: guide.id,
|
|
88
|
-
clientX: e.clientX,
|
|
89
|
-
clientY: e.clientY,
|
|
90
|
-
};
|
|
91
|
-
shouldCreateGuideRef.current = false;
|
|
92
|
-
setDraggingGuideId(() => guide.id);
|
|
93
|
-
}, [guide.id, setDraggingGuideId, shouldCreateGuideRef]);
|
|
94
65
|
const updateHasMovedGuide = (0, react_1.useCallback)((clientX, clientY) => {
|
|
95
66
|
const pointerDownPosition = pointerDownPositionRef.current;
|
|
96
67
|
if (pointerDownPosition === null) {
|
|
@@ -105,12 +76,6 @@ const GuideComp = ({ guide, canvasDimensions, scale }) => {
|
|
|
105
76
|
hasMovedGuideRef.current = true;
|
|
106
77
|
}
|
|
107
78
|
}, [guide.id]);
|
|
108
|
-
const onPointerMove = (0, react_1.useCallback)((e) => {
|
|
109
|
-
updateHasMovedGuide(e.clientX, e.clientY);
|
|
110
|
-
}, [updateHasMovedGuide]);
|
|
111
|
-
const onMouseMove = (0, react_1.useCallback)((e) => {
|
|
112
|
-
updateHasMovedGuide(e.clientX, e.clientY);
|
|
113
|
-
}, [updateHasMovedGuide]);
|
|
114
79
|
const finishGuideInteraction = (0, react_1.useCallback)(() => {
|
|
115
80
|
const shouldDeleteGuide = shouldDeleteGuideRef.current;
|
|
116
81
|
setGuidesList((prevState) => {
|
|
@@ -136,43 +101,56 @@ const GuideComp = ({ guide, canvasDimensions, scale }) => {
|
|
|
136
101
|
shouldCreateGuideRef,
|
|
137
102
|
shouldDeleteGuideRef,
|
|
138
103
|
]);
|
|
139
|
-
const
|
|
140
|
-
if (e.
|
|
141
|
-
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
142
|
-
}
|
|
143
|
-
const pointerDownPosition = pointerDownPositionRef.current;
|
|
144
|
-
pointerDownPositionRef.current = null;
|
|
145
|
-
const shouldDeleteGuide = shouldDeleteGuideRef.current;
|
|
146
|
-
finishGuideInteraction();
|
|
147
|
-
if (shouldDeleteGuide) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
if ((0, editor_guide_selection_1.isGuidePointerUpAClick)({
|
|
151
|
-
pointerDownPosition,
|
|
152
|
-
guideId: guide.id,
|
|
153
|
-
clientX: e.clientX,
|
|
154
|
-
clientY: e.clientY,
|
|
155
|
-
})) {
|
|
156
|
-
onSelect();
|
|
157
|
-
}
|
|
158
|
-
}, [finishGuideInteraction, guide.id, onSelect, shouldDeleteGuideRef]);
|
|
159
|
-
const onMouseUp = (0, react_1.useCallback)((e) => {
|
|
160
|
-
const pointerDownPosition = pointerDownPositionRef.current;
|
|
161
|
-
pointerDownPositionRef.current = null;
|
|
162
|
-
const shouldDeleteGuide = shouldDeleteGuideRef.current;
|
|
163
|
-
finishGuideInteraction();
|
|
164
|
-
if (shouldDeleteGuide) {
|
|
104
|
+
const onPointerDown = (0, react_1.useCallback)((e) => {
|
|
105
|
+
if (e.button !== 0) {
|
|
165
106
|
return;
|
|
166
107
|
}
|
|
167
|
-
|
|
168
|
-
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
e.stopPropagation();
|
|
110
|
+
hasMovedGuideRef.current = false;
|
|
111
|
+
pointerDownPositionRef.current = {
|
|
169
112
|
guideId: guide.id,
|
|
170
113
|
clientX: e.clientX,
|
|
171
114
|
clientY: e.clientY,
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
115
|
+
};
|
|
116
|
+
shouldCreateGuideRef.current = false;
|
|
117
|
+
setDraggingGuideId(() => guide.id);
|
|
118
|
+
(0, pointer_session_1.startPointerSession)({
|
|
119
|
+
event: e.nativeEvent,
|
|
120
|
+
target: e.currentTarget,
|
|
121
|
+
onMove: (moveEvent) => {
|
|
122
|
+
var _a;
|
|
123
|
+
updateHasMovedGuide(moveEvent.clientX, moveEvent.clientY);
|
|
124
|
+
(_a = moveGuidePointerRef.current) === null || _a === void 0 ? void 0 : _a.call(moveGuidePointerRef, moveEvent);
|
|
125
|
+
},
|
|
126
|
+
onEnd: (reason, endEvent) => {
|
|
127
|
+
const pointerDownPosition = pointerDownPositionRef.current;
|
|
128
|
+
pointerDownPositionRef.current = null;
|
|
129
|
+
const shouldDeleteGuide = shouldDeleteGuideRef.current;
|
|
130
|
+
finishGuideInteraction();
|
|
131
|
+
if (shouldDeleteGuide || reason !== 'pointerup' || !endEvent) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if ((0, editor_guide_selection_1.isGuidePointerUpAClick)({
|
|
135
|
+
pointerDownPosition,
|
|
136
|
+
guideId: guide.id,
|
|
137
|
+
clientX: endEvent.clientX,
|
|
138
|
+
clientY: endEvent.clientY,
|
|
139
|
+
})) {
|
|
140
|
+
onSelect();
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
}, [
|
|
145
|
+
finishGuideInteraction,
|
|
146
|
+
guide.id,
|
|
147
|
+
moveGuidePointerRef,
|
|
148
|
+
onSelect,
|
|
149
|
+
setDraggingGuideId,
|
|
150
|
+
shouldCreateGuideRef,
|
|
151
|
+
shouldDeleteGuideRef,
|
|
152
|
+
updateHasMovedGuide,
|
|
153
|
+
]);
|
|
176
154
|
const onClick = (0, react_1.useCallback)((e) => {
|
|
177
155
|
if (e.button !== 0) {
|
|
178
156
|
return;
|
|
@@ -180,10 +158,6 @@ const GuideComp = ({ guide, canvasDimensions, scale }) => {
|
|
|
180
158
|
e.preventDefault();
|
|
181
159
|
e.stopPropagation();
|
|
182
160
|
}, []);
|
|
183
|
-
const onPointerCancel = (0, react_1.useCallback)(() => {
|
|
184
|
-
pointerDownPositionRef.current = null;
|
|
185
|
-
finishGuideInteraction();
|
|
186
|
-
}, [finishGuideInteraction]);
|
|
187
161
|
const isActive = selected || hoveredGuideId === guide.id;
|
|
188
162
|
const activeClassName = isActive ? '__remotion_editor_guide_selected' : null;
|
|
189
163
|
const guideClassName = (0, react_1.useMemo)(() => {
|
|
@@ -217,6 +191,6 @@ const GuideComp = ({ guide, canvasDimensions, scale }) => {
|
|
|
217
191
|
},
|
|
218
192
|
];
|
|
219
193
|
}, [clearSelection, guide.id, selected, setGuidesList]);
|
|
220
|
-
return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: values, onOpen: null, children: jsx_runtime_1.jsx("div", { style: guideStyle, onPointerDown: onPointerDown,
|
|
194
|
+
return (jsx_runtime_1.jsx(ContextMenu_1.ContextMenu, { values: values, onOpen: null, children: jsx_runtime_1.jsx("div", { style: guideStyle, onPointerDown: onPointerDown, onClick: onClick, className: "__remotion_editor_guide", [should_clear_selection_on_pointer_down_1.PREVENT_CLEAR_SELECTION_ON_POINTER_DOWN_ATTR]: 'true', onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, children: jsx_runtime_1.jsx("div", { style: guideContentStyle, className: guideClassName }) }) }));
|
|
221
195
|
};
|
|
222
196
|
exports.default = (0, react_1.memo)(GuideComp);
|
|
@@ -12,6 +12,7 @@ interface RulerProps {
|
|
|
12
12
|
readonly markingGaps: number;
|
|
13
13
|
readonly orientation: 'horizontal' | 'vertical';
|
|
14
14
|
readonly size: Size;
|
|
15
|
+
readonly onPointerSessionStart: (event: React.PointerEvent<HTMLCanvasElement>, guideId: string) => void;
|
|
15
16
|
}
|
|
16
17
|
declare const Ruler: React.FC<RulerProps>;
|
|
17
18
|
export default Ruler;
|
|
@@ -14,7 +14,7 @@ const TimelineSelection_1 = require("../Timeline/TimelineSelection");
|
|
|
14
14
|
const makeGuideId = () => {
|
|
15
15
|
return Math.random().toString(36).substring(7);
|
|
16
16
|
};
|
|
17
|
-
const Ruler = ({ scale, points, originOffset, startMarking, size, markingGaps, orientation, }) => {
|
|
17
|
+
const Ruler = ({ scale, points, originOffset, startMarking, size, markingGaps, orientation, onPointerSessionStart, }) => {
|
|
18
18
|
const rulerCanvasRef = (0, react_1.useRef)(null);
|
|
19
19
|
const isVerticalRuler = orientation === 'vertical';
|
|
20
20
|
const { shouldCreateGuideRef, setGuidesList, draggingGuideId, hoveredGuideId, setDraggingGuideId, guidesList, setEditorShowGuides, } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
|
|
@@ -94,6 +94,7 @@ const Ruler = ({ scale, points, originOffset, startMarking, size, markingGaps, o
|
|
|
94
94
|
},
|
|
95
95
|
];
|
|
96
96
|
});
|
|
97
|
+
onPointerSessionStart(e, guideId);
|
|
97
98
|
}, [
|
|
98
99
|
shouldCreateGuideRef,
|
|
99
100
|
setEditorShowGuides,
|
|
@@ -103,6 +104,7 @@ const Ruler = ({ scale, points, originOffset, startMarking, size, markingGaps, o
|
|
|
103
104
|
originOffset,
|
|
104
105
|
unsafeVideoConfig.id,
|
|
105
106
|
cursor,
|
|
107
|
+
onPointerSessionStart,
|
|
106
108
|
]);
|
|
107
109
|
return (jsx_runtime_1.jsx("canvas", { ref: rulerCanvasRef, width: rulerWidth * window.devicePixelRatio, height: rulerHeight * window.devicePixelRatio, style: rulerStyle, [should_clear_selection_on_pointer_down_1.PREVENT_CLEAR_SELECTION_ON_POINTER_DOWN_ATTR]: 'true', onPointerDown: onPointerDown }));
|
|
108
110
|
};
|
|
@@ -8,6 +8,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
8
8
|
const react_1 = require("react");
|
|
9
9
|
const colors_1 = require("../../helpers/colors");
|
|
10
10
|
const editor_ruler_1 = require("../../helpers/editor-ruler");
|
|
11
|
+
const pointer_session_1 = require("../../helpers/pointer-session");
|
|
11
12
|
const use_studio_canvas_dimensions_1 = require("../../helpers/use-studio-canvas-dimensions");
|
|
12
13
|
const editor_guides_1 = require("../../state/editor-guides");
|
|
13
14
|
const editor_rulers_1 = require("../../state/editor-rulers");
|
|
@@ -30,7 +31,7 @@ const EditorRulers = ({ contentDimensions, canvasSize, assetMetadata, containerR
|
|
|
30
31
|
contentDimensions,
|
|
31
32
|
assetMetadata,
|
|
32
33
|
});
|
|
33
|
-
const { shouldCreateGuideRef, shouldDeleteGuideRef, setGuidesList, draggingGuideId, setDraggingGuideId, } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
|
|
34
|
+
const { shouldCreateGuideRef, shouldDeleteGuideRef, setGuidesList, draggingGuideId, moveGuidePointerRef, setDraggingGuideId, } = (0, react_1.useContext)(editor_guides_1.EditorShowGuidesContext);
|
|
34
35
|
const { clearSelection, selectedItems } = (0, TimelineSelection_1.useTimelineSelection)();
|
|
35
36
|
const rulerMarkingGaps = (0, react_1.useMemo)(() => {
|
|
36
37
|
const minimumGap = editor_rulers_1.MINIMUM_RULER_MARKING_GAP_PX;
|
|
@@ -58,7 +59,7 @@ const EditorRulers = ({ contentDimensions, canvasSize, assetMetadata, containerR
|
|
|
58
59
|
scale,
|
|
59
60
|
}), [verticalRulerScaleRange, rulerMarkingGaps, scale]);
|
|
60
61
|
const requestAnimationFrameRef = (0, react_1.useRef)(null);
|
|
61
|
-
const onMouseMove = (0, react_1.useCallback)((e) => {
|
|
62
|
+
const onMouseMove = (0, react_1.useCallback)((e, guideId) => {
|
|
62
63
|
if (requestAnimationFrameRef.current) {
|
|
63
64
|
cancelAnimationFrame(requestAnimationFrameRef.current);
|
|
64
65
|
}
|
|
@@ -75,7 +76,7 @@ const EditorRulers = ({ contentDimensions, canvasSize, assetMetadata, containerR
|
|
|
75
76
|
}
|
|
76
77
|
setGuidesList((prevState) => {
|
|
77
78
|
const newGuides = prevState.map((guide) => {
|
|
78
|
-
if (guide.id !==
|
|
79
|
+
if (guide.id !== guideId) {
|
|
79
80
|
return guide;
|
|
80
81
|
}
|
|
81
82
|
const desiredCursor = guide.orientation === 'vertical' ? 'ew-resize' : 'ns-resize';
|
|
@@ -96,7 +97,7 @@ const EditorRulers = ({ contentDimensions, canvasSize, assetMetadata, containerR
|
|
|
96
97
|
setGuidesList((prevState) => {
|
|
97
98
|
// Intentionally no persist, only persist on mouse up
|
|
98
99
|
return prevState.map((guide) => {
|
|
99
|
-
if (guide.id !==
|
|
100
|
+
if (guide.id !== guideId) {
|
|
100
101
|
return guide;
|
|
101
102
|
}
|
|
102
103
|
const position = guide.orientation === 'vertical'
|
|
@@ -119,24 +120,27 @@ const EditorRulers = ({ contentDimensions, canvasSize, assetMetadata, containerR
|
|
|
119
120
|
containerRef,
|
|
120
121
|
shouldDeleteGuideRef,
|
|
121
122
|
setGuidesList,
|
|
122
|
-
draggingGuideId,
|
|
123
123
|
scale,
|
|
124
124
|
canvasPosition.left,
|
|
125
125
|
canvasPosition.top,
|
|
126
126
|
]);
|
|
127
|
-
const
|
|
127
|
+
const finishGuideInteraction = (0, react_1.useCallback)((guideId) => {
|
|
128
|
+
if (requestAnimationFrameRef.current) {
|
|
129
|
+
cancelAnimationFrame(requestAnimationFrameRef.current);
|
|
130
|
+
requestAnimationFrameRef.current = null;
|
|
131
|
+
}
|
|
128
132
|
const shouldDeleteGuide = shouldDeleteGuideRef.current;
|
|
129
133
|
setGuidesList((prevState) => {
|
|
130
134
|
const newGuides = prevState.filter((selected) => {
|
|
131
135
|
if (!shouldDeleteGuide) {
|
|
132
136
|
return true;
|
|
133
137
|
}
|
|
134
|
-
return selected.id !==
|
|
138
|
+
return selected.id !== guideId;
|
|
135
139
|
});
|
|
136
140
|
(0, editor_guides_1.persistGuidesList)(newGuides);
|
|
137
141
|
return newGuides;
|
|
138
142
|
});
|
|
139
|
-
const deletedGuideWasSelected = selectedItems.some((item) => item.type === 'guide' && item.guideId ===
|
|
143
|
+
const deletedGuideWasSelected = selectedItems.some((item) => item.type === 'guide' && item.guideId === guideId);
|
|
140
144
|
if (shouldDeleteGuide && deletedGuideWasSelected) {
|
|
141
145
|
clearSelection();
|
|
142
146
|
}
|
|
@@ -144,36 +148,35 @@ const EditorRulers = ({ contentDimensions, canvasSize, assetMetadata, containerR
|
|
|
144
148
|
(0, ForceSpecificCursor_1.stopForcingSpecificCursor)();
|
|
145
149
|
shouldCreateGuideRef.current = false;
|
|
146
150
|
setDraggingGuideId(() => null);
|
|
147
|
-
document.removeEventListener('pointerup', onMouseUp);
|
|
148
|
-
document.removeEventListener('pointercancel', onMouseUp);
|
|
149
|
-
document.removeEventListener('pointermove', onMouseMove);
|
|
150
151
|
}, [
|
|
151
152
|
clearSelection,
|
|
152
|
-
draggingGuideId,
|
|
153
153
|
shouldCreateGuideRef,
|
|
154
154
|
shouldDeleteGuideRef,
|
|
155
155
|
setDraggingGuideId,
|
|
156
156
|
setGuidesList,
|
|
157
|
-
onMouseMove,
|
|
158
157
|
selectedItems,
|
|
159
158
|
]);
|
|
160
159
|
(0, react_1.useLayoutEffect)(() => {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
document.addEventListener('pointercancel', onMouseUp);
|
|
165
|
-
}
|
|
160
|
+
moveGuidePointerRef.current = (event) => {
|
|
161
|
+
onMouseMove(event, draggingGuideId);
|
|
162
|
+
};
|
|
166
163
|
return () => {
|
|
167
|
-
|
|
168
|
-
document.removeEventListener('pointerup', onMouseUp);
|
|
169
|
-
document.removeEventListener('pointercancel', onMouseUp);
|
|
164
|
+
moveGuidePointerRef.current = null;
|
|
170
165
|
if (requestAnimationFrameRef.current) {
|
|
171
166
|
cancelAnimationFrame(requestAnimationFrameRef.current);
|
|
172
167
|
}
|
|
173
168
|
};
|
|
174
|
-
}, [draggingGuideId,
|
|
169
|
+
}, [draggingGuideId, moveGuidePointerRef, onMouseMove]);
|
|
170
|
+
const onPointerSessionStart = (0, react_1.useCallback)((event, guideId) => {
|
|
171
|
+
(0, pointer_session_1.startPointerSession)({
|
|
172
|
+
event: event.nativeEvent,
|
|
173
|
+
target: event.currentTarget,
|
|
174
|
+
onMove: (moveEvent) => onMouseMove(moveEvent, guideId),
|
|
175
|
+
onEnd: () => finishGuideInteraction(guideId),
|
|
176
|
+
});
|
|
177
|
+
}, [finishGuideInteraction, onMouseMove]);
|
|
175
178
|
return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [
|
|
176
|
-
jsx_runtime_1.jsx("div", { style: originBlockStyles }), jsx_runtime_1.jsx(Ruler_1.default, { orientation: "horizontal", scale: scale, points: horizontalRulerPoints, startMarking: horizontalRulerStartMarking, markingGaps: rulerMarkingGaps, originOffset: canvasPosition.left, size: canvasSize }), jsx_runtime_1.jsx(Ruler_1.default, { orientation: "vertical", scale: scale, points: verticalRulerPoints, startMarking: verticalRulerStartMarking, markingGaps: rulerMarkingGaps, originOffset: canvasPosition.top, size: canvasSize })
|
|
179
|
+
jsx_runtime_1.jsx("div", { style: originBlockStyles }), jsx_runtime_1.jsx(Ruler_1.default, { orientation: "horizontal", scale: scale, points: horizontalRulerPoints, startMarking: horizontalRulerStartMarking, markingGaps: rulerMarkingGaps, originOffset: canvasPosition.left, size: canvasSize, onPointerSessionStart: onPointerSessionStart }), jsx_runtime_1.jsx(Ruler_1.default, { orientation: "vertical", scale: scale, points: verticalRulerPoints, startMarking: verticalRulerStartMarking, markingGaps: rulerMarkingGaps, originOffset: canvasPosition.top, size: canvasSize, onPointerSessionStart: onPointerSessionStart })
|
|
177
180
|
] }));
|
|
178
181
|
};
|
|
179
182
|
exports.EditorRulers = EditorRulers;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const ElementInstallConfirmation: React.FC<{
|
|
3
|
+
readonly displayName: string;
|
|
4
|
+
readonly sourceLabel: string;
|
|
5
|
+
readonly sourceIsUnverified: boolean;
|
|
6
|
+
readonly compositionId: string;
|
|
7
|
+
readonly filePath: string;
|
|
8
|
+
readonly overwritesExistingFile: boolean;
|
|
9
|
+
readonly dependenciesToReview: string[];
|
|
10
|
+
readonly missingPackages: string[];
|
|
11
|
+
readonly sourceCode: string;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ElementInstallConfirmation = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const colors_1 = require("../helpers/colors");
|
|
6
|
+
const ValidationMessage_1 = require("./NewComposition/ValidationMessage");
|
|
7
|
+
const container = {
|
|
8
|
+
display: 'flex',
|
|
9
|
+
flexDirection: 'column',
|
|
10
|
+
gap: 20,
|
|
11
|
+
color: colors_1.WHITE,
|
|
12
|
+
fontFamily: 'sans-serif',
|
|
13
|
+
fontSize: 13,
|
|
14
|
+
lineHeight: 1.5,
|
|
15
|
+
};
|
|
16
|
+
const sectionStyle = {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
flexDirection: 'column',
|
|
19
|
+
gap: 10,
|
|
20
|
+
};
|
|
21
|
+
const sectionTitleStyle = {
|
|
22
|
+
margin: 0,
|
|
23
|
+
color: colors_1.WHITE,
|
|
24
|
+
fontFamily: 'sans-serif',
|
|
25
|
+
fontSize: 13,
|
|
26
|
+
fontWeight: 600,
|
|
27
|
+
lineHeight: 1.5,
|
|
28
|
+
};
|
|
29
|
+
const metadataStyle = {
|
|
30
|
+
display: 'flex',
|
|
31
|
+
flexDirection: 'column',
|
|
32
|
+
gap: 8,
|
|
33
|
+
margin: 0,
|
|
34
|
+
};
|
|
35
|
+
const metadataRowStyle = {
|
|
36
|
+
display: 'grid',
|
|
37
|
+
gridTemplateColumns: '100px minmax(0, 1fr)',
|
|
38
|
+
alignItems: 'baseline',
|
|
39
|
+
gap: 12,
|
|
40
|
+
};
|
|
41
|
+
const metadataTermStyle = {
|
|
42
|
+
color: colors_1.LIGHT_TEXT,
|
|
43
|
+
fontFamily: 'sans-serif',
|
|
44
|
+
fontSize: 13,
|
|
45
|
+
fontWeight: 500,
|
|
46
|
+
lineHeight: 1.5,
|
|
47
|
+
};
|
|
48
|
+
const metadataDescriptionStyle = {
|
|
49
|
+
margin: 0,
|
|
50
|
+
minWidth: 0,
|
|
51
|
+
color: colors_1.WHITE,
|
|
52
|
+
fontFamily: 'sans-serif',
|
|
53
|
+
fontSize: 13,
|
|
54
|
+
fontWeight: 400,
|
|
55
|
+
lineHeight: 1.5,
|
|
56
|
+
overflowWrap: 'anywhere',
|
|
57
|
+
};
|
|
58
|
+
const unverifiedSourceStyle = {
|
|
59
|
+
...metadataDescriptionStyle,
|
|
60
|
+
color: colors_1.WARNING_COLOR,
|
|
61
|
+
};
|
|
62
|
+
const codeStyle = {
|
|
63
|
+
color: 'inherit',
|
|
64
|
+
fontFamily: 'monospace',
|
|
65
|
+
fontSize: 13,
|
|
66
|
+
lineHeight: 1.5,
|
|
67
|
+
};
|
|
68
|
+
const overwriteStyle = {
|
|
69
|
+
margin: 0,
|
|
70
|
+
color: colors_1.WARNING_COLOR,
|
|
71
|
+
fontFamily: 'sans-serif',
|
|
72
|
+
fontSize: 13,
|
|
73
|
+
fontWeight: 500,
|
|
74
|
+
lineHeight: 1.5,
|
|
75
|
+
};
|
|
76
|
+
const dependencyListStyle = {
|
|
77
|
+
display: 'flex',
|
|
78
|
+
flexDirection: 'column',
|
|
79
|
+
gap: 8,
|
|
80
|
+
margin: 0,
|
|
81
|
+
padding: 0,
|
|
82
|
+
listStyleType: 'none',
|
|
83
|
+
};
|
|
84
|
+
const dependencyRowStyle = {
|
|
85
|
+
display: 'flex',
|
|
86
|
+
alignItems: 'baseline',
|
|
87
|
+
justifyContent: 'space-between',
|
|
88
|
+
gap: 16,
|
|
89
|
+
minWidth: 0,
|
|
90
|
+
};
|
|
91
|
+
const dependencyNameStyle = {
|
|
92
|
+
minWidth: 0,
|
|
93
|
+
color: colors_1.WHITE,
|
|
94
|
+
fontFamily: 'monospace',
|
|
95
|
+
fontSize: 13,
|
|
96
|
+
lineHeight: 1.5,
|
|
97
|
+
overflowWrap: 'anywhere',
|
|
98
|
+
};
|
|
99
|
+
const dependencyInstallStatusStyle = {
|
|
100
|
+
flexShrink: 0,
|
|
101
|
+
color: colors_1.WARNING_COLOR,
|
|
102
|
+
fontFamily: 'sans-serif',
|
|
103
|
+
fontSize: 13,
|
|
104
|
+
fontWeight: 500,
|
|
105
|
+
lineHeight: 1.5,
|
|
106
|
+
};
|
|
107
|
+
const dependencyInstalledStatusStyle = {
|
|
108
|
+
...dependencyInstallStatusStyle,
|
|
109
|
+
color: colors_1.LIGHT_TEXT,
|
|
110
|
+
};
|
|
111
|
+
const warningStyle = {
|
|
112
|
+
display: 'flex',
|
|
113
|
+
alignItems: 'flex-start',
|
|
114
|
+
gap: 10,
|
|
115
|
+
minWidth: 0,
|
|
116
|
+
};
|
|
117
|
+
const warningIconStyle = {
|
|
118
|
+
width: 16,
|
|
119
|
+
height: 16,
|
|
120
|
+
marginTop: 1,
|
|
121
|
+
flexShrink: 0,
|
|
122
|
+
fill: colors_1.WARNING_COLOR,
|
|
123
|
+
};
|
|
124
|
+
const warningDescriptionStyle = {
|
|
125
|
+
margin: 0,
|
|
126
|
+
minWidth: 0,
|
|
127
|
+
color: colors_1.LIGHT_TEXT,
|
|
128
|
+
fontFamily: 'sans-serif',
|
|
129
|
+
fontSize: 13,
|
|
130
|
+
fontWeight: 400,
|
|
131
|
+
lineHeight: 1.5,
|
|
132
|
+
};
|
|
133
|
+
const sourceDetailsStyle = {
|
|
134
|
+
paddingTop: 2,
|
|
135
|
+
fontFamily: 'sans-serif',
|
|
136
|
+
fontSize: 13,
|
|
137
|
+
lineHeight: 1.5,
|
|
138
|
+
};
|
|
139
|
+
const sourceSummaryStyle = {
|
|
140
|
+
cursor: 'pointer',
|
|
141
|
+
color: colors_1.WHITE,
|
|
142
|
+
fontFamily: 'sans-serif',
|
|
143
|
+
fontSize: 13,
|
|
144
|
+
fontWeight: 500,
|
|
145
|
+
lineHeight: 1.5,
|
|
146
|
+
};
|
|
147
|
+
const sourceCodeBlockStyle = {
|
|
148
|
+
marginTop: 10,
|
|
149
|
+
marginBottom: 0,
|
|
150
|
+
maxHeight: 240,
|
|
151
|
+
overflow: 'auto',
|
|
152
|
+
padding: 12,
|
|
153
|
+
border: `1px solid ${colors_1.WHITE_ALPHA_12}`,
|
|
154
|
+
borderRadius: 6,
|
|
155
|
+
backgroundColor: colors_1.INPUT_BACKGROUND,
|
|
156
|
+
color: colors_1.WHITE,
|
|
157
|
+
fontFamily: 'monospace',
|
|
158
|
+
fontSize: 12,
|
|
159
|
+
lineHeight: 1.5,
|
|
160
|
+
whiteSpace: 'pre',
|
|
161
|
+
};
|
|
162
|
+
const sourceCodeStyle = {
|
|
163
|
+
color: 'inherit',
|
|
164
|
+
fontFamily: 'inherit',
|
|
165
|
+
fontSize: 'inherit',
|
|
166
|
+
lineHeight: 'inherit',
|
|
167
|
+
};
|
|
168
|
+
const makeSourceControlsVisible = (sourceCode) => {
|
|
169
|
+
return sourceCode.replace(/[\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff]/g, (character) => {
|
|
170
|
+
var _a;
|
|
171
|
+
return `\\u${(_a = character.codePointAt(0)) === null || _a === void 0 ? void 0 : _a.toString(16).padStart(4, '0')}`;
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
const ElementInstallConfirmation = ({ displayName, sourceLabel, sourceIsUnverified, compositionId, filePath, overwritesExistingFile, dependenciesToReview, missingPackages, sourceCode, }) => {
|
|
175
|
+
return (jsx_runtime_1.jsxs("div", { style: container, children: [
|
|
176
|
+
jsx_runtime_1.jsxs("dl", { style: metadataStyle, "aria-label": "Installation details", children: [
|
|
177
|
+
jsx_runtime_1.jsxs("div", { style: metadataRowStyle, children: [
|
|
178
|
+
jsx_runtime_1.jsx("dt", { style: metadataTermStyle, children: "Element" }), jsx_runtime_1.jsx("dd", { style: metadataDescriptionStyle, children: displayName })
|
|
179
|
+
] }), jsx_runtime_1.jsxs("div", { style: metadataRowStyle, children: [
|
|
180
|
+
jsx_runtime_1.jsx("dt", { style: metadataTermStyle, children: "Request source" }), jsx_runtime_1.jsx("dd", { style: sourceIsUnverified
|
|
181
|
+
? unverifiedSourceStyle
|
|
182
|
+
: metadataDescriptionStyle, children: sourceLabel })
|
|
183
|
+
] }), jsx_runtime_1.jsxs("div", { style: metadataRowStyle, children: [
|
|
184
|
+
jsx_runtime_1.jsx("dt", { style: metadataTermStyle, children: "Composition" }), jsx_runtime_1.jsx("dd", { style: metadataDescriptionStyle, children: jsx_runtime_1.jsx("code", { style: codeStyle, children: compositionId }) })
|
|
185
|
+
] }), jsx_runtime_1.jsxs("div", { style: metadataRowStyle, children: [
|
|
186
|
+
jsx_runtime_1.jsx("dt", { style: metadataTermStyle, children: "Destination" }), jsx_runtime_1.jsx("dd", { style: metadataDescriptionStyle, children: jsx_runtime_1.jsx("code", { style: codeStyle, children: filePath }) })
|
|
187
|
+
] }), overwritesExistingFile ? (jsx_runtime_1.jsxs("div", { style: metadataRowStyle, children: [
|
|
188
|
+
jsx_runtime_1.jsx("dt", { style: metadataTermStyle, children: "File change" }), jsx_runtime_1.jsx("dd", { style: overwriteStyle, children: "Replace existing source file" })
|
|
189
|
+
] })) : null] }), dependenciesToReview.length > 0 ? (jsx_runtime_1.jsxs("section", { style: sectionStyle, "aria-labelledby": "element-install-dependencies", children: [
|
|
190
|
+
jsx_runtime_1.jsx("h3", { id: "element-install-dependencies", style: sectionTitleStyle, children: "Dependencies" }), jsx_runtime_1.jsx("ul", { style: dependencyListStyle, role: "list", children: dependenciesToReview.map((packageName) => {
|
|
191
|
+
const willInstall = missingPackages.includes(packageName);
|
|
192
|
+
return (jsx_runtime_1.jsxs("li", { style: dependencyRowStyle, children: [
|
|
193
|
+
jsx_runtime_1.jsx("div", { style: dependencyNameStyle, children: packageName }), jsx_runtime_1.jsx("div", { style: willInstall
|
|
194
|
+
? dependencyInstallStatusStyle
|
|
195
|
+
: dependencyInstalledStatusStyle, children: willInstall ? 'Will be installed' : 'Installed' })
|
|
196
|
+
] }, packageName));
|
|
197
|
+
}) })
|
|
198
|
+
] })) : null, jsx_runtime_1.jsxs("div", { style: warningStyle, children: [
|
|
199
|
+
jsx_runtime_1.jsx(ValidationMessage_1.WarningTriangle, { style: warningIconStyle }), jsx_runtime_1.jsx("p", { style: warningDescriptionStyle, children: "This adds executable source code to your project. Package lifecycle scripts may also run during installation, with access to your files and the network." })
|
|
200
|
+
] }), jsx_runtime_1.jsxs("details", { style: sourceDetailsStyle, children: [
|
|
201
|
+
jsx_runtime_1.jsx("summary", { style: sourceSummaryStyle, children: "Source code" }), jsx_runtime_1.jsx("pre", { style: sourceCodeBlockStyle, children: jsx_runtime_1.jsx("code", { style: sourceCodeStyle, children: makeSourceControlsVisible(sourceCode) }) })
|
|
202
|
+
] })
|
|
203
|
+
] }));
|
|
204
|
+
};
|
|
205
|
+
exports.ElementInstallConfirmation = ElementInstallConfirmation;
|
|
@@ -40,7 +40,19 @@ const ref = react_1.default.createRef();
|
|
|
40
40
|
const removeAutomaticCleanupListeners = () => {
|
|
41
41
|
window.removeEventListener('pointerup', exports.stopForcingSpecificCursor, true);
|
|
42
42
|
window.removeEventListener('pointercancel', exports.stopForcingSpecificCursor, true);
|
|
43
|
+
window.removeEventListener('pointermove', stopIfNoButtonsArePressed, true);
|
|
43
44
|
window.removeEventListener('blur', exports.stopForcingSpecificCursor, true);
|
|
45
|
+
document.removeEventListener('visibilitychange', stopIfDocumentIsHidden);
|
|
46
|
+
};
|
|
47
|
+
const stopIfNoButtonsArePressed = (event) => {
|
|
48
|
+
if (event.buttons === 0) {
|
|
49
|
+
(0, exports.stopForcingSpecificCursor)();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const stopIfDocumentIsHidden = () => {
|
|
53
|
+
if (document.visibilityState === 'hidden') {
|
|
54
|
+
(0, exports.stopForcingSpecificCursor)();
|
|
55
|
+
}
|
|
44
56
|
};
|
|
45
57
|
const forceSpecificCursor = (cursor) => {
|
|
46
58
|
if (!ref.current) {
|
|
@@ -53,7 +65,9 @@ const forceSpecificCursor = (cursor) => {
|
|
|
53
65
|
// initiator so the cursor overlay can never remain stuck.
|
|
54
66
|
window.addEventListener('pointerup', exports.stopForcingSpecificCursor, true);
|
|
55
67
|
window.addEventListener('pointercancel', exports.stopForcingSpecificCursor, true);
|
|
68
|
+
window.addEventListener('pointermove', stopIfNoButtonsArePressed, true);
|
|
56
69
|
window.addEventListener('blur', exports.stopForcingSpecificCursor, true);
|
|
70
|
+
document.addEventListener('visibilitychange', stopIfDocumentIsHidden);
|
|
57
71
|
};
|
|
58
72
|
exports.forceSpecificCursor = forceSpecificCursor;
|
|
59
73
|
const stopForcingSpecificCursor = () => {
|
|
@@ -6,5 +6,6 @@ export type InlineActionProps = {
|
|
|
6
6
|
readonly renderAction: RenderInlineAction;
|
|
7
7
|
readonly title?: string;
|
|
8
8
|
readonly unhoveredColor?: string;
|
|
9
|
+
readonly variant: 'compact' | null;
|
|
9
10
|
};
|
|
10
|
-
export declare const InlineAction: ({ renderAction, onClick, disabled, title, unhoveredColor, }: InlineActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const InlineAction: ({ renderAction, onClick, disabled, title, unhoveredColor, variant, }: InlineActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const colors_1 = require("../helpers/colors");
|
|
7
7
|
const z_index_1 = require("../state/z-index");
|
|
8
|
-
const InlineAction = ({ renderAction, onClick, disabled, title, unhoveredColor = colors_1.LIGHT_TEXT, }) => {
|
|
8
|
+
const InlineAction = ({ renderAction, onClick, disabled, title, unhoveredColor = colors_1.LIGHT_TEXT, variant, }) => {
|
|
9
9
|
const { tabIndex } = (0, z_index_1.useZIndex)();
|
|
10
10
|
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
11
11
|
const onPointerEnter = (0, react_1.useCallback)(() => {
|
|
@@ -21,7 +21,7 @@ const InlineAction = ({ renderAction, onClick, disabled, title, unhoveredColor =
|
|
|
21
21
|
? colors_1.TRANSPARENT
|
|
22
22
|
: (0, colors_1.getBackgroundFromHoverState)({ hovered, selected: false }),
|
|
23
23
|
height: 24,
|
|
24
|
-
width: 24,
|
|
24
|
+
width: variant === 'compact' ? 14 : 24,
|
|
25
25
|
padding: 0,
|
|
26
26
|
display: 'inline-flex',
|
|
27
27
|
justifyContent: 'center',
|
|
@@ -30,7 +30,7 @@ const InlineAction = ({ renderAction, onClick, disabled, title, unhoveredColor =
|
|
|
30
30
|
opacity: disabled ? 0.5 : 1,
|
|
31
31
|
pointerEvents: disabled ? 'none' : 'auto',
|
|
32
32
|
};
|
|
33
|
-
}, [disabled, hovered]);
|
|
33
|
+
}, [disabled, hovered, variant]);
|
|
34
34
|
return (jsx_runtime_1.jsx("button", { type: "button", disabled: disabled, onPointerEnter: onPointerEnter, onPointerLeave: onPointerLeave, onClick: onClick, style: style, tabIndex: tabIndex, title: title, "aria-label": title, children: renderAction(hovered ? colors_1.WHITE : unhoveredColor) }));
|
|
35
35
|
};
|
|
36
36
|
exports.InlineAction = InlineAction;
|
|
@@ -6,6 +6,7 @@ const react_1 = require("react");
|
|
|
6
6
|
const format_file_location_1 = require("../helpers/format-file-location");
|
|
7
7
|
const clipboard_1 = require("../icons/clipboard");
|
|
8
8
|
const InlineAction_1 = require("./InlineAction");
|
|
9
|
+
const InspectorOpenInEditor_1 = require("./InspectorOpenInEditor");
|
|
9
10
|
const NotificationCenter_1 = require("./Notifications/NotificationCenter");
|
|
10
11
|
const row = {
|
|
11
12
|
alignItems: 'center',
|
|
@@ -22,6 +23,8 @@ const content = {
|
|
|
22
23
|
overflow: 'hidden',
|
|
23
24
|
};
|
|
24
25
|
const action = {
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
display: 'flex',
|
|
25
28
|
flexShrink: 0,
|
|
26
29
|
height: 24,
|
|
27
30
|
marginLeft: 0,
|
|
@@ -32,7 +35,7 @@ const icon = {
|
|
|
32
35
|
height: 12,
|
|
33
36
|
width: 12,
|
|
34
37
|
};
|
|
35
|
-
const InspectorLocationCopy = ({ children, location, name }) => {
|
|
38
|
+
const InspectorLocationCopy = ({ children, location, name, openInEditorLocation }) => {
|
|
36
39
|
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
37
40
|
const [focusedWithin, setFocusedWithin] = (0, react_1.useState)(false);
|
|
38
41
|
const textToCopy = (0, react_1.useMemo)(() => {
|
|
@@ -56,10 +59,11 @@ const InspectorLocationCopy = ({ children, location, name }) => {
|
|
|
56
59
|
}, [textToCopy]);
|
|
57
60
|
const showAction = hovered || focusedWithin;
|
|
58
61
|
return (jsx_runtime_1.jsxs("div", { style: row, onPointerEnter: () => setHovered(true), onPointerLeave: () => setHovered(false), onFocus: () => setFocusedWithin(true), onBlur: () => setFocusedWithin(false), children: [
|
|
59
|
-
jsx_runtime_1.jsx("div", { style: content, children: children }), textToCopy ? (jsx_runtime_1.
|
|
62
|
+
jsx_runtime_1.jsx("div", { style: content, children: children }), textToCopy || openInEditorLocation ? (jsx_runtime_1.jsxs("div", { style: {
|
|
60
63
|
...action,
|
|
61
64
|
opacity: showAction ? 1 : 0,
|
|
62
65
|
pointerEvents: showAction ? 'auto' : 'none',
|
|
63
|
-
}, children:
|
|
66
|
+
}, children: [
|
|
67
|
+
jsx_runtime_1.jsx(InspectorOpenInEditor_1.InspectorOpenInEditor, { location: openInEditorLocation }), textToCopy ? (jsx_runtime_1.jsx(InlineAction_1.InlineAction, { variant: null, onClick: onCopy, renderAction: renderCopyAction, title: "Copy location for agents" })) : null] })) : null] }));
|
|
64
68
|
};
|
|
65
69
|
exports.InspectorLocationCopy = InspectorLocationCopy;
|