@excalidraw/excalidraw 0.17.1-c0b80a0 → 0.17.1-c329470
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/browser/dev/excalidraw-assets-dev/{chunk-JGDL4H2X.js → chunk-3DLVY5XU.js} +8272 -6864
- package/dist/browser/dev/excalidraw-assets-dev/chunk-3DLVY5XU.js.map +7 -0
- package/dist/browser/dev/excalidraw-assets-dev/{chunk-V7NFEZA6.js → chunk-NOAEU4NM.js} +9 -2
- package/dist/browser/dev/excalidraw-assets-dev/chunk-NOAEU4NM.js.map +7 -0
- package/dist/browser/dev/excalidraw-assets-dev/{en-ZSVWGT55.js → en-7IBTMWBG.js} +2 -2
- package/dist/browser/dev/excalidraw-assets-dev/{image-RJG3J34Y.js → image-N5AC7SEK.js} +2 -6
- package/dist/browser/dev/index.css +85 -50
- package/dist/browser/dev/index.css.map +3 -3
- package/dist/browser/dev/index.js +4375 -3766
- package/dist/browser/dev/index.js.map +4 -4
- package/dist/browser/prod/excalidraw-assets/{chunk-LDVEIXGO.js → chunk-7CSIPVOW.js} +2 -2
- package/dist/browser/prod/excalidraw-assets/chunk-TX3BU7T2.js +47 -0
- package/dist/browser/prod/excalidraw-assets/{en-UPNEHLDS.js → en-LOGQBETY.js} +1 -1
- package/dist/browser/prod/excalidraw-assets/image-3V4U7GZE.js +1 -0
- package/dist/browser/prod/index.css +1 -1
- package/dist/browser/prod/index.js +40 -40
- package/dist/dev/index.css +85 -50
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +8688 -6706
- package/dist/dev/index.js.map +4 -4
- package/dist/{prod/locales/en-ZXYG7GCR.json → dev/locales/en-V6KXFSCK.json} +8 -1
- package/dist/excalidraw/actions/actionAlign.d.ts +7 -6
- package/dist/excalidraw/actions/actionAlign.js +14 -14
- package/dist/excalidraw/actions/actionClipboard.d.ts +7 -3
- package/dist/excalidraw/actions/actionDeleteSelected.d.ts +7 -3
- package/dist/excalidraw/actions/actionDeleteSelected.js +103 -34
- package/dist/excalidraw/actions/actionDuplicateSelection.js +105 -95
- package/dist/excalidraw/actions/actionFlip.js +16 -7
- package/dist/excalidraw/actions/actionFrame.d.ts +493 -0
- package/dist/excalidraw/actions/actionFrame.js +45 -2
- package/dist/excalidraw/actions/actionGroup.js +6 -4
- package/dist/excalidraw/actions/actionProperties.js +145 -116
- package/dist/excalidraw/actions/actionSelectAll.js +4 -3
- package/dist/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/excalidraw/actions/shortcuts.js +1 -0
- package/dist/excalidraw/actions/types.d.ts +1 -1
- package/dist/excalidraw/align.d.ts +2 -1
- package/dist/excalidraw/align.js +15 -6
- package/dist/excalidraw/clipboard.d.ts +27 -5
- package/dist/excalidraw/clipboard.js +55 -28
- package/dist/excalidraw/components/Actions.d.ts +2 -1
- package/dist/excalidraw/components/Actions.js +4 -2
- package/dist/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
- package/dist/excalidraw/components/ActiveConfirmDialog.js +2 -3
- package/dist/excalidraw/components/App.d.ts +1 -0
- package/dist/excalidraw/components/App.js +216 -111
- package/dist/excalidraw/components/ColorPicker/ColorInput.js +2 -3
- package/dist/excalidraw/components/ColorPicker/ColorPicker.js +2 -3
- package/dist/excalidraw/components/ColorPicker/CustomColorList.js +1 -1
- package/dist/excalidraw/components/ColorPicker/Picker.js +1 -1
- package/dist/excalidraw/components/ColorPicker/PickerColorList.js +1 -1
- package/dist/excalidraw/components/ColorPicker/ShadeList.js +1 -1
- package/dist/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
- package/dist/excalidraw/components/ColorPicker/colorPickerUtils.js +1 -1
- package/dist/excalidraw/components/CommandPalette/CommandPalette.js +3 -3
- package/dist/excalidraw/components/ConfirmDialog.js +17 -5
- package/dist/excalidraw/components/Dialog.js +2 -3
- package/dist/excalidraw/components/EyeDropper.d.ts +1 -1
- package/dist/excalidraw/components/EyeDropper.js +1 -1
- package/dist/excalidraw/components/IconPicker.d.ts +2 -2
- package/dist/excalidraw/components/IconPicker.js +56 -53
- package/dist/excalidraw/components/LayerUI.js +6 -6
- package/dist/excalidraw/components/LibraryMenu.d.ts +2 -16
- package/dist/excalidraw/components/LibraryMenu.js +70 -28
- package/dist/excalidraw/components/LibraryMenuHeaderContent.js +4 -5
- package/dist/excalidraw/components/MobileMenu.js +1 -1
- package/dist/excalidraw/components/OverwriteConfirm/OverwriteConfirm.js +2 -3
- package/dist/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
- package/dist/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.js +2 -3
- package/dist/excalidraw/components/Range.d.ts +9 -0
- package/dist/excalidraw/components/Range.js +24 -0
- package/dist/excalidraw/components/SearchMenu.d.ts +1 -1
- package/dist/excalidraw/components/SearchMenu.js +3 -4
- package/dist/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
- package/dist/excalidraw/components/Sidebar/Sidebar.js +2 -3
- package/dist/excalidraw/components/Stats/Collapsible.d.ts +2 -1
- package/dist/excalidraw/components/Stats/Collapsible.js +2 -2
- package/dist/excalidraw/components/Stats/Dimension.js +94 -8
- package/dist/excalidraw/components/Stats/MultiDimension.js +8 -5
- package/dist/excalidraw/components/Stats/Position.js +63 -3
- package/dist/excalidraw/components/Stats/index.js +21 -4
- package/dist/excalidraw/components/Stats/utils.d.ts +1 -1
- package/dist/excalidraw/components/Stats/utils.js +2 -55
- package/dist/excalidraw/components/TTDDialog/TTDDialog.js +1 -1
- package/dist/excalidraw/components/ToolButton.js +4 -9
- package/dist/excalidraw/components/hoc/withInternalFallback.js +3 -3
- package/dist/excalidraw/components/hyperlink/Hyperlink.js +6 -12
- package/dist/excalidraw/components/icons.d.ts +9 -0
- package/dist/excalidraw/components/icons.js +4 -4
- package/dist/excalidraw/components/main-menu/DefaultItems.js +2 -3
- package/dist/excalidraw/constants.d.ts +5 -1
- package/dist/excalidraw/constants.js +9 -1
- package/dist/excalidraw/context/tunnels.d.ts +2 -1
- package/dist/excalidraw/context/tunnels.js +3 -1
- package/dist/excalidraw/data/blob.d.ts +1 -0
- package/dist/excalidraw/data/blob.js +7 -3
- package/dist/excalidraw/data/filesystem.d.ts +2 -1
- package/dist/excalidraw/data/filesystem.js +1 -0
- package/dist/excalidraw/data/image.d.ts +0 -6
- package/dist/excalidraw/data/image.js +1 -43
- package/dist/excalidraw/data/index.js +6 -6
- package/dist/excalidraw/data/library.d.ts +9 -3
- package/dist/excalidraw/data/library.js +43 -6
- package/dist/excalidraw/data/restore.js +26 -8
- package/dist/excalidraw/data/url.d.ts +0 -1
- package/dist/excalidraw/data/url.js +2 -4
- package/dist/excalidraw/editor-jotai.d.ts +56 -0
- package/dist/excalidraw/editor-jotai.js +8 -0
- package/dist/excalidraw/element/binding.d.ts +9 -6
- package/dist/excalidraw/element/binding.js +124 -44
- package/dist/excalidraw/element/bounds.js +10 -0
- package/dist/excalidraw/element/cropElement.d.ts +5 -0
- package/dist/excalidraw/element/cropElement.js +28 -1
- package/dist/excalidraw/element/dragElements.js +13 -7
- package/dist/excalidraw/element/elbowArrow.d.ts +16 -0
- package/dist/excalidraw/element/elbowArrow.js +1268 -0
- package/dist/excalidraw/element/embeddable.js +4 -5
- package/dist/excalidraw/element/flowchart.d.ts +1 -1
- package/dist/excalidraw/element/flowchart.js +25 -9
- package/dist/excalidraw/element/heading.d.ts +5 -1
- package/dist/excalidraw/element/heading.js +5 -1
- package/dist/excalidraw/element/image.js +19 -5
- package/dist/excalidraw/element/linearElementEditor.d.ts +9 -10
- package/dist/excalidraw/element/linearElementEditor.js +97 -38
- package/dist/excalidraw/element/mutateElement.d.ts +3 -1
- package/dist/excalidraw/element/mutateElement.js +31 -4
- package/dist/excalidraw/element/newElement.d.ts +8 -12
- package/dist/excalidraw/element/newElement.js +36 -21
- package/dist/excalidraw/element/resizeElements.d.ts +20 -5
- package/dist/excalidraw/element/resizeElements.js +593 -361
- package/dist/excalidraw/element/sortElements.js +1 -4
- package/dist/excalidraw/element/types.d.ts +23 -1
- package/dist/excalidraw/fonts/Fonts.d.ts +0 -16
- package/dist/excalidraw/fonts/Fonts.js +6 -31
- package/dist/excalidraw/frame.d.ts +11 -5
- package/dist/excalidraw/frame.js +146 -35
- package/dist/excalidraw/groups.js +3 -0
- package/dist/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/dist/excalidraw/hooks/useLibraryItemSvg.js +2 -3
- package/dist/excalidraw/hooks/useScrollPosition.js +1 -1
- package/dist/excalidraw/i18n.js +3 -4
- package/dist/excalidraw/index.js +3 -4
- package/dist/excalidraw/locales/en.json +8 -1
- package/dist/excalidraw/renderer/interactiveScene.js +43 -32
- package/dist/excalidraw/renderer/staticScene.js +6 -4
- package/dist/excalidraw/renderer/staticSvgScene.js +1 -1
- package/dist/excalidraw/scene/Shape.js +40 -17
- package/dist/excalidraw/scene/comparisons.d.ts +0 -477
- package/dist/excalidraw/scene/comparisons.js +0 -37
- package/dist/excalidraw/scene/export.d.ts +7 -0
- package/dist/excalidraw/scene/export.js +107 -43
- package/dist/excalidraw/scene/index.d.ts +1 -1
- package/dist/excalidraw/scene/index.js +1 -1
- package/dist/excalidraw/scene/selection.js +4 -1
- package/dist/excalidraw/types.d.ts +15 -0
- package/dist/excalidraw/utility-types.d.ts +1 -0
- package/dist/excalidraw/utils.d.ts +8 -1
- package/dist/excalidraw/utils.js +9 -0
- package/dist/excalidraw/visualdebug.d.ts +8 -1
- package/dist/excalidraw/visualdebug.js +3 -0
- package/dist/math/line.d.ts +19 -0
- package/dist/math/line.js +32 -3
- package/dist/math/point.d.ts +10 -0
- package/dist/math/point.js +12 -1
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +29 -44
- package/dist/{dev/locales/en-ZXYG7GCR.json → prod/locales/en-V6KXFSCK.json} +8 -1
- package/package.json +5 -2
- package/dist/browser/dev/excalidraw-assets-dev/chunk-JGDL4H2X.js.map +0 -7
- package/dist/browser/dev/excalidraw-assets-dev/chunk-V7NFEZA6.js.map +0 -7
- package/dist/browser/prod/excalidraw-assets/chunk-S2XKB3DE.js +0 -62
- package/dist/browser/prod/excalidraw-assets/image-OFI2YYMP.js +0 -1
- package/dist/excalidraw/element/routing.d.ts +0 -12
- package/dist/excalidraw/element/routing.js +0 -642
- package/dist/excalidraw/jotai.d.ts +0 -34
- package/dist/excalidraw/jotai.js +0 -18
- /package/dist/browser/dev/excalidraw-assets-dev/{en-ZSVWGT55.js.map → en-7IBTMWBG.js.map} +0 -0
- /package/dist/browser/dev/excalidraw-assets-dev/{image-RJG3J34Y.js.map → image-N5AC7SEK.js.map} +0 -0
|
@@ -329,6 +329,10 @@ export const getArrowheadSize = (arrowhead) => {
|
|
|
329
329
|
case "diamond":
|
|
330
330
|
case "diamond_outline":
|
|
331
331
|
return 12;
|
|
332
|
+
case "crowfoot_many":
|
|
333
|
+
case "crowfoot_one":
|
|
334
|
+
case "crowfoot_one_or_many":
|
|
335
|
+
return 20;
|
|
332
336
|
default:
|
|
333
337
|
return 15;
|
|
334
338
|
}
|
|
@@ -413,6 +417,12 @@ export const getArrowheadPoints = (element, shape, position, arrowhead) => {
|
|
|
413
417
|
return [x2, y2, diameter];
|
|
414
418
|
}
|
|
415
419
|
const angle = getArrowheadAngle(arrowhead);
|
|
420
|
+
if (arrowhead === "crowfoot_many" || arrowhead === "crowfoot_one_or_many") {
|
|
421
|
+
// swap (xs, ys) with (x2, y2)
|
|
422
|
+
const [x3, y3] = pointRotateRads(pointFrom(x2, y2), pointFrom(xs, ys), degreesToRadians(-angle));
|
|
423
|
+
const [x4, y4] = pointRotateRads(pointFrom(x2, y2), pointFrom(xs, ys), degreesToRadians(angle));
|
|
424
|
+
return [xs, ys, x3, y3, x4, y4];
|
|
425
|
+
}
|
|
416
426
|
// Return points
|
|
417
427
|
const [x3, y3] = pointRotateRads(pointFrom(xs, ys), pointFrom(x2, y2), ((-angle * Math.PI) / 180));
|
|
418
428
|
const [x4, y4] = pointRotateRads(pointFrom(xs, ys), pointFrom(x2, y2), degreesToRadians(angle));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TransformHandleType } from "./transformHandles";
|
|
2
2
|
import type { ElementsMap, ExcalidrawImageElement, ImageCrop } from "./types";
|
|
3
|
+
export declare const MINIMAL_CROP_SIZE = 10;
|
|
3
4
|
export declare const cropElement: (element: ExcalidrawImageElement, transformHandle: TransformHandleType, naturalWidth: number, naturalHeight: number, pointerX: number, pointerY: number, widthAspectRatio?: number) => {
|
|
4
5
|
x: number;
|
|
5
6
|
y: number;
|
|
@@ -12,3 +13,7 @@ export declare const getUncroppedWidthAndHeight: (element: ExcalidrawImageElemen
|
|
|
12
13
|
width: number;
|
|
13
14
|
height: number;
|
|
14
15
|
};
|
|
16
|
+
export declare const getFlipAdjustedCropPosition: (element: ExcalidrawImageElement, natural?: boolean) => {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
} | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { pointFrom, pointCenter, pointRotateRads, vectorFromPoint, vectorNormalize, vectorSubtract, vectorAdd, vectorScale, pointFromVector, clamp, isCloseTo, } from "../../math";
|
|
2
2
|
import { getElementAbsoluteCoords, getResizedElementAbsoluteCoords, } from "./bounds";
|
|
3
|
-
const MINIMAL_CROP_SIZE = 10;
|
|
3
|
+
export const MINIMAL_CROP_SIZE = 10;
|
|
4
4
|
export const cropElement = (element, transformHandle, naturalWidth, naturalHeight, pointerX, pointerY, widthAspectRatio) => {
|
|
5
5
|
const { width: uncroppedWidth, height: uncroppedHeight } = getUncroppedWidthAndHeight(element);
|
|
6
6
|
const naturalWidthToUncropped = naturalWidth / uncroppedWidth;
|
|
@@ -335,3 +335,30 @@ const adjustCropPosition = (crop, scale) => {
|
|
|
335
335
|
cropY,
|
|
336
336
|
};
|
|
337
337
|
};
|
|
338
|
+
export const getFlipAdjustedCropPosition = (element, natural = false) => {
|
|
339
|
+
const crop = element.crop;
|
|
340
|
+
if (!crop) {
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
const isFlippedByX = element.scale[0] === -1;
|
|
344
|
+
const isFlippedByY = element.scale[1] === -1;
|
|
345
|
+
let cropX = crop.x;
|
|
346
|
+
let cropY = crop.y;
|
|
347
|
+
if (isFlippedByX) {
|
|
348
|
+
cropX = crop.naturalWidth - crop.width - crop.x;
|
|
349
|
+
}
|
|
350
|
+
if (isFlippedByY) {
|
|
351
|
+
cropY = crop.naturalHeight - crop.height - crop.y;
|
|
352
|
+
}
|
|
353
|
+
if (natural) {
|
|
354
|
+
return {
|
|
355
|
+
x: cropX,
|
|
356
|
+
y: cropY,
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
const { width, height } = getUncroppedWidthAndHeight(element);
|
|
360
|
+
return {
|
|
361
|
+
x: cropX / (crop.naturalWidth / width),
|
|
362
|
+
y: cropY / (crop.naturalHeight / height),
|
|
363
|
+
};
|
|
364
|
+
};
|
|
@@ -13,7 +13,14 @@ export const dragSelectedElements = (pointerDownState, _selectedElements, offset
|
|
|
13
13
|
(_selectedElements[0].startBinding || _selectedElements[0].endBinding)) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
const selectedElements = _selectedElements.filter((
|
|
16
|
+
const selectedElements = _selectedElements.filter((element) => {
|
|
17
|
+
if (isElbowArrow(element) && element.startBinding && element.endBinding) {
|
|
18
|
+
const startElement = _selectedElements.find((el) => el.id === element.startBinding?.elementId);
|
|
19
|
+
const endElement = _selectedElements.find((el) => el.id === element.endBinding?.elementId);
|
|
20
|
+
return startElement && endElement;
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
});
|
|
17
24
|
// we do not want a frame and its elements to be selected at the same time
|
|
18
25
|
// but when it happens (due to some bug), we want to avoid updating element
|
|
19
26
|
// in the frame twice, hence the use of set
|
|
@@ -32,17 +39,16 @@ export const dragSelectedElements = (pointerDownState, _selectedElements, offset
|
|
|
32
39
|
const adjustedOffset = calculateOffset(commonBounds, offset, snapOffset, gridSize);
|
|
33
40
|
elementsToUpdate.forEach((element) => {
|
|
34
41
|
updateElementCoords(pointerDownState, element, adjustedOffset);
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
!isArrowElement(element)) {
|
|
42
|
+
if (!isArrowElement(element)) {
|
|
43
|
+
// skip arrow labels since we calculate its position during render
|
|
38
44
|
const textElement = getBoundTextElement(element, scene.getNonDeletedElementsMap());
|
|
39
45
|
if (textElement) {
|
|
40
46
|
updateElementCoords(pointerDownState, textElement, adjustedOffset);
|
|
41
47
|
}
|
|
48
|
+
updateBoundElements(element, scene.getElementsMapIncludingDeleted(), {
|
|
49
|
+
simultaneouslyUpdated: Array.from(elementsToUpdate),
|
|
50
|
+
});
|
|
42
51
|
}
|
|
43
|
-
updateBoundElements(element, scene.getElementsMapIncludingDeleted(), {
|
|
44
|
-
simultaneouslyUpdated: Array.from(elementsToUpdate),
|
|
45
|
-
});
|
|
46
52
|
});
|
|
47
53
|
};
|
|
48
54
|
const calculateOffset = (commonBounds, dragOffset, snapOffset, gridSize) => {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type LocalPoint } from "../../math";
|
|
2
|
+
import { type ElementUpdate } from "./mutateElement";
|
|
3
|
+
import { type ExcalidrawElbowArrowElement, type NonDeletedSceneElementsMap, type SceneElementsMap } from "./types";
|
|
4
|
+
import type { FixedPointBinding, FixedSegment } from "./types";
|
|
5
|
+
export declare const BASE_PADDING = 40;
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export declare const updateElbowArrowPoints: (arrow: Readonly<ExcalidrawElbowArrowElement>, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap, updates: {
|
|
10
|
+
points?: readonly LocalPoint[];
|
|
11
|
+
fixedSegments?: FixedSegment[] | null;
|
|
12
|
+
startBinding?: FixedPointBinding | null;
|
|
13
|
+
endBinding?: FixedPointBinding | null;
|
|
14
|
+
}, options?: {
|
|
15
|
+
isDragging?: boolean;
|
|
16
|
+
}) => ElementUpdate<ExcalidrawElbowArrowElement>;
|