@excalidraw/element 0.18.0-ec07091 → 0.18.0-f2600fe
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/dev/index.js +21 -24
- package/dist/dev/index.js.map +2 -2
- package/dist/prod/index.js +9 -9
- package/dist/types/common/src/constants.d.ts +3 -16
- package/dist/types/common/src/editorInterface.d.ts +34 -0
- package/dist/types/common/src/index.d.ts +1 -0
- package/dist/types/common/src/utils.d.ts +0 -2
- package/dist/types/element/src/resizeTest.d.ts +5 -4
- package/dist/types/element/src/transformHandles.d.ts +5 -4
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +18 -9
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +12 -6
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +78 -39
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +36 -18
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +6 -3
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +19 -10
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +6 -3
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +12 -6
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +6 -3
- package/dist/types/excalidraw/actions/actionExport.d.ts +54 -27
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +12 -6
- package/dist/types/excalidraw/actions/actionFrame.d.ts +24 -12
- package/dist/types/excalidraw/actions/actionGroup.d.ts +12 -6
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +6 -3
- package/dist/types/excalidraw/actions/actionLink.d.ts +4 -1
- package/dist/types/excalidraw/actions/actionMenu.d.ts +7 -372
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +12 -6
- package/dist/types/excalidraw/actions/actionProperties.d.ts +91 -46
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +6 -3
- package/dist/types/excalidraw/actions/actionStyles.d.ts +6 -3
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +6 -3
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +6 -3
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +6 -3
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +6 -3
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +6 -3
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +7 -4
- package/dist/types/excalidraw/actions/index.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +1 -1
- package/dist/types/excalidraw/appState.d.ts +5 -2
- package/dist/types/excalidraw/components/Actions.d.ts +13 -3
- package/dist/types/excalidraw/components/App.d.ts +19 -17
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +1 -2
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -0
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -1
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -1
- package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +1 -1
- package/dist/types/excalidraw/components/FilledButton.d.ts +1 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +2 -1
- package/dist/types/excalidraw/components/HintViewer.d.ts +4 -3
- package/dist/types/excalidraw/components/LayerUI.d.ts +2 -1
- package/dist/types/excalidraw/components/MobileMenu.d.ts +3 -5
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +11 -0
- package/dist/types/excalidraw/components/Popover.d.ts +2 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -2
- package/dist/types/excalidraw/components/ToolPopover.d.ts +25 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +3 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +4 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +2 -1
- package/dist/types/excalidraw/components/icons.d.ts +5 -1
- package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +13 -1
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +0 -3
- package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +3 -1
- package/dist/types/excalidraw/index.d.ts +2 -3
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
- package/dist/types/excalidraw/scene/types.d.ts +3 -3
- package/dist/types/excalidraw/shortcut.d.ts +1 -0
- package/dist/types/excalidraw/types.d.ts +16 -17
- package/package.json +3 -3
package/dist/dev/index.js
CHANGED
|
@@ -11310,7 +11310,7 @@ function getSvgPathFromStroke(points) {
|
|
|
11310
11310
|
// src/comparisons.ts
|
|
11311
11311
|
init_define_import_meta_env();
|
|
11312
11312
|
var hasBackground = (type) => type === "rectangle" || type === "iframe" || type === "embeddable" || type === "ellipse" || type === "diamond" || type === "line" || type === "freedraw";
|
|
11313
|
-
var hasStrokeColor = (type) => type
|
|
11313
|
+
var hasStrokeColor = (type) => type === "rectangle" || type === "ellipse" || type === "diamond" || type === "freedraw" || type === "arrow" || type === "line" || type === "text";
|
|
11314
11314
|
var hasStrokeWidth = (type) => type === "rectangle" || type === "iframe" || type === "embeddable" || type === "ellipse" || type === "diamond" || type === "freedraw" || type === "arrow" || type === "line";
|
|
11315
11315
|
var hasStrokeStyle = (type) => type === "rectangle" || type === "iframe" || type === "embeddable" || type === "ellipse" || type === "diamond" || type === "arrow" || type === "line";
|
|
11316
11316
|
var canChangeRoundness = (type) => type === "rectangle" || type === "iframe" || type === "embeddable" || type === "line" || type === "diamond" || type === "image";
|
|
@@ -18616,14 +18616,14 @@ import {
|
|
|
18616
18616
|
pointOnLineSegment,
|
|
18617
18617
|
pointRotateRads as pointRotateRads15
|
|
18618
18618
|
} from "@excalidraw/math";
|
|
18619
|
-
import {
|
|
18619
|
+
import {
|
|
18620
|
+
SIDE_RESIZING_THRESHOLD
|
|
18621
|
+
} from "@excalidraw/common";
|
|
18620
18622
|
|
|
18621
18623
|
// src/transformHandles.ts
|
|
18622
18624
|
init_define_import_meta_env();
|
|
18623
18625
|
import {
|
|
18624
|
-
DEFAULT_TRANSFORM_HANDLE_SPACING
|
|
18625
|
-
isAndroid,
|
|
18626
|
-
isIOS
|
|
18626
|
+
DEFAULT_TRANSFORM_HANDLE_SPACING
|
|
18627
18627
|
} from "@excalidraw/common";
|
|
18628
18628
|
import { pointFrom as pointFrom17, pointRotateRads as pointRotateRads14 } from "@excalidraw/math";
|
|
18629
18629
|
var transformHandleSizes = {
|
|
@@ -18673,17 +18673,14 @@ var generateTransformHandle = (x, y, width, height, cx, cy, angle) => {
|
|
|
18673
18673
|
);
|
|
18674
18674
|
return [xx - width / 2, yy - height / 2, width, height];
|
|
18675
18675
|
};
|
|
18676
|
-
var canResizeFromSides = (
|
|
18677
|
-
if (
|
|
18678
|
-
return false;
|
|
18679
|
-
}
|
|
18680
|
-
if (device.isTouchScreen && (isAndroid || isIOS)) {
|
|
18676
|
+
var canResizeFromSides = (editorInterface) => {
|
|
18677
|
+
if (editorInterface.formFactor === "phone" && editorInterface.userAgent.isMobileDevice) {
|
|
18681
18678
|
return false;
|
|
18682
18679
|
}
|
|
18683
18680
|
return true;
|
|
18684
18681
|
};
|
|
18685
|
-
var
|
|
18686
|
-
if (canResizeFromSides(
|
|
18682
|
+
var getOmitSidesForEditorInterface = (editorInterface) => {
|
|
18683
|
+
if (canResizeFromSides(editorInterface)) {
|
|
18687
18684
|
return DEFAULT_OMIT_SIDES;
|
|
18688
18685
|
}
|
|
18689
18686
|
return {};
|
|
@@ -18833,7 +18830,7 @@ var getTransformHandles = (element, zoom, elementsMap, pointerType = "mouse", om
|
|
|
18833
18830
|
isImageElement(element) ? 0 : void 0
|
|
18834
18831
|
);
|
|
18835
18832
|
};
|
|
18836
|
-
var
|
|
18833
|
+
var hasBoundingBox = (elements, appState, editorInterface) => {
|
|
18837
18834
|
if (appState.selectedLinearElement?.isEditing) {
|
|
18838
18835
|
return false;
|
|
18839
18836
|
}
|
|
@@ -18847,12 +18844,12 @@ var shouldShowBoundingBox = (elements, appState) => {
|
|
|
18847
18844
|
if (!isLinearElement(element)) {
|
|
18848
18845
|
return true;
|
|
18849
18846
|
}
|
|
18850
|
-
return element.points.length > 2;
|
|
18847
|
+
return element.points.length > 2 && !editorInterface.userAgent.isMobileDevice;
|
|
18851
18848
|
};
|
|
18852
18849
|
|
|
18853
18850
|
// src/resizeTest.ts
|
|
18854
18851
|
var isInsideTransformHandle = (transformHandle, x, y) => x >= transformHandle[0] && x <= transformHandle[0] + transformHandle[2] && y >= transformHandle[1] && y <= transformHandle[1] + transformHandle[3];
|
|
18855
|
-
var resizeTest = (element, elementsMap, appState, x, y, zoom, pointerType,
|
|
18852
|
+
var resizeTest = (element, elementsMap, appState, x, y, zoom, pointerType, editorInterface) => {
|
|
18856
18853
|
if (!appState.selectedElementIds[element.id]) {
|
|
18857
18854
|
return false;
|
|
18858
18855
|
}
|
|
@@ -18861,7 +18858,7 @@ var resizeTest = (element, elementsMap, appState, x, y, zoom, pointerType, devic
|
|
|
18861
18858
|
zoom,
|
|
18862
18859
|
elementsMap,
|
|
18863
18860
|
pointerType,
|
|
18864
|
-
|
|
18861
|
+
getOmitSidesForEditorInterface(editorInterface)
|
|
18865
18862
|
);
|
|
18866
18863
|
if (rotationTransformHandle && isInsideTransformHandle(rotationTransformHandle, x, y)) {
|
|
18867
18864
|
return "rotation";
|
|
@@ -18876,7 +18873,7 @@ var resizeTest = (element, elementsMap, appState, x, y, zoom, pointerType, devic
|
|
|
18876
18873
|
if (filter.length > 0) {
|
|
18877
18874
|
return filter[0];
|
|
18878
18875
|
}
|
|
18879
|
-
if (canResizeFromSides(
|
|
18876
|
+
if (canResizeFromSides(editorInterface)) {
|
|
18880
18877
|
const [x1, y1, x2, y2, cx, cy] = getElementAbsoluteCoords2(
|
|
18881
18878
|
element,
|
|
18882
18879
|
elementsMap
|
|
@@ -18903,7 +18900,7 @@ var resizeTest = (element, elementsMap, appState, x, y, zoom, pointerType, devic
|
|
|
18903
18900
|
}
|
|
18904
18901
|
return false;
|
|
18905
18902
|
};
|
|
18906
|
-
var getElementWithTransformHandleType = (elements, appState, scenePointerX, scenePointerY, zoom, pointerType, elementsMap,
|
|
18903
|
+
var getElementWithTransformHandleType = (elements, appState, scenePointerX, scenePointerY, zoom, pointerType, elementsMap, editorInterface) => {
|
|
18907
18904
|
return elements.reduce((result, element) => {
|
|
18908
18905
|
if (result) {
|
|
18909
18906
|
return result;
|
|
@@ -18916,18 +18913,18 @@ var getElementWithTransformHandleType = (elements, appState, scenePointerX, scen
|
|
|
18916
18913
|
scenePointerY,
|
|
18917
18914
|
zoom,
|
|
18918
18915
|
pointerType,
|
|
18919
|
-
|
|
18916
|
+
editorInterface
|
|
18920
18917
|
);
|
|
18921
18918
|
return transformHandleType ? { element, transformHandleType } : null;
|
|
18922
18919
|
}, null);
|
|
18923
18920
|
};
|
|
18924
|
-
var getTransformHandleTypeFromCoords = ([x1, y1, x2, y2], scenePointerX, scenePointerY, zoom, pointerType,
|
|
18921
|
+
var getTransformHandleTypeFromCoords = ([x1, y1, x2, y2], scenePointerX, scenePointerY, zoom, pointerType, editorInterface) => {
|
|
18925
18922
|
const transformHandles = getTransformHandlesFromCoords(
|
|
18926
18923
|
[x1, y1, x2, y2, (x1 + x2) / 2, (y1 + y2) / 2],
|
|
18927
18924
|
0,
|
|
18928
18925
|
zoom,
|
|
18929
18926
|
pointerType,
|
|
18930
|
-
|
|
18927
|
+
getOmitSidesForEditorInterface(editorInterface)
|
|
18931
18928
|
);
|
|
18932
18929
|
const found = Object.keys(transformHandles).find((key) => {
|
|
18933
18930
|
const transformHandle = transformHandles[key];
|
|
@@ -18936,7 +18933,7 @@ var getTransformHandleTypeFromCoords = ([x1, y1, x2, y2], scenePointerX, scenePo
|
|
|
18936
18933
|
if (found) {
|
|
18937
18934
|
return found;
|
|
18938
18935
|
}
|
|
18939
|
-
if (canResizeFromSides(
|
|
18936
|
+
if (canResizeFromSides(editorInterface)) {
|
|
18940
18937
|
const cx = (x1 + x2) / 2;
|
|
18941
18938
|
const cy = (y1 + y2) / 2;
|
|
18942
18939
|
const SPACING = SIDE_RESIZING_THRESHOLD / zoom.value;
|
|
@@ -19572,7 +19569,7 @@ export {
|
|
|
19572
19569
|
getNonDeletedGroupIds,
|
|
19573
19570
|
getNormalizedDimensions,
|
|
19574
19571
|
getObservedAppState,
|
|
19575
|
-
|
|
19572
|
+
getOmitSidesForEditorInterface,
|
|
19576
19573
|
getOriginalContainerHeightFromCache,
|
|
19577
19574
|
getPerfectElementSize,
|
|
19578
19575
|
getPredecessors,
|
|
@@ -19610,6 +19607,7 @@ export {
|
|
|
19610
19607
|
handleBindTextResize,
|
|
19611
19608
|
hasBackground,
|
|
19612
19609
|
hasBoundTextElement,
|
|
19610
|
+
hasBoundingBox,
|
|
19613
19611
|
hasStrokeColor,
|
|
19614
19612
|
hasStrokeStyle,
|
|
19615
19613
|
hasStrokeWidth,
|
|
@@ -19738,7 +19736,6 @@ export {
|
|
|
19738
19736
|
shouldAllowVerticalAlign,
|
|
19739
19737
|
shouldApplyFrameClip,
|
|
19740
19738
|
shouldEnableBindingForPointerEvent,
|
|
19741
|
-
shouldShowBoundingBox,
|
|
19742
19739
|
shouldTestInside,
|
|
19743
19740
|
showSelectedShapeActions,
|
|
19744
19741
|
snapToMid,
|