@myoc/excalidraw 0.19.503 → 0.19.504
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/CHANGELOG.md +70 -13
- package/dist/dev/{chunk-YVUPBWS6.js → chunk-Z5DMFRJ5.js} +4 -4
- package/dist/dev/{chunk-YVUPBWS6.js.map → chunk-Z5DMFRJ5.js.map} +1 -1
- package/dist/dev/data/{image-I24D3FB6.js → image-ZR5DXOGS.js} +2 -2
- package/dist/dev/index.css.map +2 -2
- package/dist/dev/index.js +334 -372
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/{chunk-2VV6LBBJ.js → chunk-44LLHLSZ.js} +2 -2
- package/dist/prod/data/{image-IFJHSHJP.js → image-XPYUWCHN.js} +1 -1
- package/dist/prod/index.js +19 -19
- package/dist/types/element/src/arrange-algorithms/maxRects.d.ts +16 -0
- package/dist/types/element/src/linearElementEditor.d.ts +1 -1
- package/dist/types/element/src/types.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionAlign.d.ts +8 -8
- package/dist/types/excalidraw/actions/actionArrange.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +16 -16
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionExport.d.ts +12 -12
- package/dist/types/excalidraw/actions/actionFlip.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionFrame.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionGroup.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionLink.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionMenu.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionProperties.d.ts +5 -5
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionSmartZoom.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionStyles.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -8
- package/dist/types/excalidraw/appState.d.ts +7 -7
- package/dist/types/excalidraw/components/App.d.ts +2 -1
- package/dist/types/excalidraw/components/shapes.d.ts +263 -0
- package/dist/types/excalidraw/data/blob.d.ts +12 -12
- package/dist/types/excalidraw/data/json.d.ts +6 -6
- package/dist/types/excalidraw/editorPreferences.d.ts +11 -0
- package/dist/types/excalidraw/index.d.ts +1 -0
- package/dist/types/excalidraw/types.d.ts +21 -0
- package/package.json +4 -4
- /package/dist/dev/data/{image-I24D3FB6.js.map → image-ZR5DXOGS.js.map} +0 -0
package/dist/dev/index.js
CHANGED
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
serializeAsJSON,
|
|
65
65
|
serializeLibraryAsJSON,
|
|
66
66
|
strokeRectWithRotation_simple
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-Z5DMFRJ5.js";
|
|
68
68
|
import {
|
|
69
69
|
define_import_meta_env_default
|
|
70
70
|
} from "./chunk-OF725VHI.js";
|
|
@@ -177,7 +177,7 @@ import {
|
|
|
177
177
|
normalizeEOL as normalizeEOL2,
|
|
178
178
|
getDateTime,
|
|
179
179
|
isShallowEqual as isShallowEqual9,
|
|
180
|
-
arrayToMap as
|
|
180
|
+
arrayToMap as arrayToMap30,
|
|
181
181
|
applyDarkModeFilter as applyDarkModeFilter4,
|
|
182
182
|
AppEventBus,
|
|
183
183
|
randomInteger as randomInteger4,
|
|
@@ -208,7 +208,6 @@ import {
|
|
|
208
208
|
getHoveredElementForBinding as getHoveredElementForBinding2,
|
|
209
209
|
isBindingEnabled as isBindingEnabled2,
|
|
210
210
|
updateBoundElements as updateBoundElements4,
|
|
211
|
-
LinearElementEditor as LinearElementEditor11,
|
|
212
211
|
newElementWith as newElementWith10,
|
|
213
212
|
newFrameElement as newFrameElement2,
|
|
214
213
|
newFreeDrawElement,
|
|
@@ -248,7 +247,7 @@ import {
|
|
|
248
247
|
isElementInViewport as isElementInViewport3,
|
|
249
248
|
isInvisiblySmallElement as isInvisiblySmallElement3,
|
|
250
249
|
getCornerRadius as getCornerRadius2,
|
|
251
|
-
isPathALoop as
|
|
250
|
+
isPathALoop as isPathALoop3,
|
|
252
251
|
createSrcDoc,
|
|
253
252
|
embeddableURLValidator as embeddableURLValidator2,
|
|
254
253
|
maybeParseEmbedSrc,
|
|
@@ -304,7 +303,7 @@ import {
|
|
|
304
303
|
isSelectedViaGroup as isSelectedViaGroup2,
|
|
305
304
|
selectGroupsForSelectedElements as selectGroupsForSelectedElements6,
|
|
306
305
|
syncInvalidIndices,
|
|
307
|
-
syncMovedIndices as
|
|
306
|
+
syncMovedIndices as syncMovedIndices5,
|
|
308
307
|
excludeElementsInFramesFromSelection,
|
|
309
308
|
getSelectionStateForElements as getSelectionStateForElements2,
|
|
310
309
|
makeNextSelectedElementIds as makeNextSelectedElementIds2,
|
|
@@ -343,6 +342,8 @@ import {
|
|
|
343
342
|
getUncroppedWidthAndHeight as getUncroppedWidthAndHeight4,
|
|
344
343
|
getActiveTextElement as getActiveTextElement2
|
|
345
344
|
} from "@excalidraw/element";
|
|
345
|
+
import { LinearElementEditor as LinearElementEditor11 } from "@excalidraw/element/linearElementEditor";
|
|
346
|
+
import { findShapeByKey } from "@excalidraw/element/shapes";
|
|
346
347
|
|
|
347
348
|
// actions/actionDeleteSelected.tsx
|
|
348
349
|
import {
|
|
@@ -352,7 +353,7 @@ import {
|
|
|
352
353
|
} from "@excalidraw/common";
|
|
353
354
|
import { getNonDeletedElements } from "@excalidraw/element";
|
|
354
355
|
import { fixBindingsAfterDeletion } from "@excalidraw/element";
|
|
355
|
-
import { LinearElementEditor } from "@excalidraw/element";
|
|
356
|
+
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
|
356
357
|
import { newElementWith } from "@excalidraw/element";
|
|
357
358
|
import { getContainerElement } from "@excalidraw/element";
|
|
358
359
|
import {
|
|
@@ -3535,7 +3536,7 @@ var actionBringToFront = register({
|
|
|
3535
3536
|
|
|
3536
3537
|
// actions/actionSelectAll.ts
|
|
3537
3538
|
import { getNonDeletedElements as getNonDeletedElements2 } from "@excalidraw/element";
|
|
3538
|
-
import { LinearElementEditor as LinearElementEditor2 } from "@excalidraw/element";
|
|
3539
|
+
import { LinearElementEditor as LinearElementEditor2 } from "@excalidraw/element/linearElementEditor";
|
|
3539
3540
|
import { isLinearElement, isTextElement } from "@excalidraw/element";
|
|
3540
3541
|
import { arrayToMap, KEYS as KEYS3 } from "@excalidraw/common";
|
|
3541
3542
|
import { selectGroupsForSelectedElements as selectGroupsForSelectedElements2 } from "@excalidraw/element";
|
|
@@ -3587,7 +3588,7 @@ import {
|
|
|
3587
3588
|
arrayToMap as arrayToMap2
|
|
3588
3589
|
} from "@excalidraw/common";
|
|
3589
3590
|
import { getNonDeletedElements as getNonDeletedElements3 } from "@excalidraw/element";
|
|
3590
|
-
import { LinearElementEditor as LinearElementEditor3 } from "@excalidraw/element";
|
|
3591
|
+
import { LinearElementEditor as LinearElementEditor3 } from "@excalidraw/element/linearElementEditor";
|
|
3591
3592
|
import {
|
|
3592
3593
|
getSelectedElements as getSelectedElements2,
|
|
3593
3594
|
getSelectionStateForElements
|
|
@@ -3718,7 +3719,7 @@ import {
|
|
|
3718
3719
|
calculateFixedPointForElbowArrowBinding,
|
|
3719
3720
|
updateBoundElements
|
|
3720
3721
|
} from "@excalidraw/element";
|
|
3721
|
-
import { LinearElementEditor as LinearElementEditor4 } from "@excalidraw/element";
|
|
3722
|
+
import { LinearElementEditor as LinearElementEditor4 } from "@excalidraw/element/linearElementEditor";
|
|
3722
3723
|
import { newElementWith as newElementWith2 } from "@excalidraw/element";
|
|
3723
3724
|
import { getArrowheadForPicker } from "@excalidraw/element";
|
|
3724
3725
|
import {
|
|
@@ -8543,11 +8544,8 @@ var actionSetEmbeddableAsActiveTool = register({
|
|
|
8543
8544
|
// actions/actionFinalize.tsx
|
|
8544
8545
|
import { pointFrom as pointFrom2 } from "@excalidraw/math";
|
|
8545
8546
|
import { bindOrUnbindBindingElement } from "@excalidraw/element/binding";
|
|
8546
|
-
import {
|
|
8547
|
-
|
|
8548
|
-
LinearElementEditor as LinearElementEditor5,
|
|
8549
|
-
newElementWith as newElementWith3
|
|
8550
|
-
} from "@excalidraw/element";
|
|
8547
|
+
import { isValidPolygon, newElementWith as newElementWith3 } from "@excalidraw/element";
|
|
8548
|
+
import { LinearElementEditor as LinearElementEditor5 } from "@excalidraw/element/linearElementEditor";
|
|
8551
8549
|
import {
|
|
8552
8550
|
isBindingElement,
|
|
8553
8551
|
isFreeDrawElement,
|
|
@@ -9504,7 +9502,7 @@ var exportCanvas = async (type, elements, appState, files, {
|
|
|
9504
9502
|
let blob = canvasToBlob(tempCanvas);
|
|
9505
9503
|
if (appState.exportEmbedScene) {
|
|
9506
9504
|
blob = blob.then(
|
|
9507
|
-
(blob2) => import("./data/image-
|
|
9505
|
+
(blob2) => import("./data/image-ZR5DXOGS.js").then(
|
|
9508
9506
|
({ encodePngMetadata: encodePngMetadata2 }) => encodePngMetadata2({
|
|
9509
9507
|
blob: blob2,
|
|
9510
9508
|
metadata: serializeAsJSON(elements, appState, files, "local")
|
|
@@ -11094,16 +11092,46 @@ import { arrayToMap as arrayToMap9, KEYS as KEYS21, matchKey } from "@excalidraw
|
|
|
11094
11092
|
import { CaptureUpdateAction as CaptureUpdateAction17 } from "@excalidraw/element";
|
|
11095
11093
|
import { updateFrameMembershipOfSelectedElements as updateFrameMembershipOfSelectedElements3 } from "@excalidraw/element/frame";
|
|
11096
11094
|
import { arrangeElements } from "@excalidraw/element/arrange";
|
|
11095
|
+
|
|
11096
|
+
// editorPreferences.ts
|
|
11097
|
+
var DEFAULT_SMART_ZOOM_PREFERENCES = {
|
|
11098
|
+
fitToViewport: true,
|
|
11099
|
+
animate: true,
|
|
11100
|
+
duration: 200,
|
|
11101
|
+
viewportZoomFactor: 0.8
|
|
11102
|
+
};
|
|
11103
|
+
var getEffectiveEditorPreferences = (appState, editorPreferences) => {
|
|
11104
|
+
return {
|
|
11105
|
+
smartZoom: {
|
|
11106
|
+
...DEFAULT_SMART_ZOOM_PREFERENCES,
|
|
11107
|
+
...editorPreferences?.smartZoom
|
|
11108
|
+
},
|
|
11109
|
+
arrange: {
|
|
11110
|
+
...appState.arrangeConfiguration,
|
|
11111
|
+
...editorPreferences?.arrange
|
|
11112
|
+
},
|
|
11113
|
+
normalise: {
|
|
11114
|
+
...appState.normaliseConfiguration,
|
|
11115
|
+
...editorPreferences?.normalise
|
|
11116
|
+
}
|
|
11117
|
+
};
|
|
11118
|
+
};
|
|
11119
|
+
|
|
11120
|
+
// actions/actionArrange.tsx
|
|
11097
11121
|
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
11098
11122
|
var arrangeSelectedElements = (elements, appState, app) => {
|
|
11099
11123
|
const selectedElements = app.scene.getSelectedElements(appState);
|
|
11100
11124
|
const elementsMap = arrayToMap9(elements);
|
|
11125
|
+
const { arrange } = getEffectiveEditorPreferences(
|
|
11126
|
+
appState,
|
|
11127
|
+
app.props.editorPreferences
|
|
11128
|
+
);
|
|
11101
11129
|
const updatedElements = arrangeElements(
|
|
11102
11130
|
app.scene,
|
|
11103
11131
|
selectedElements,
|
|
11104
11132
|
elementsMap,
|
|
11105
|
-
|
|
11106
|
-
|
|
11133
|
+
arrange.algorithm,
|
|
11134
|
+
arrange.gap
|
|
11107
11135
|
);
|
|
11108
11136
|
const updatedElementsMap = arrayToMap9(updatedElements);
|
|
11109
11137
|
return updateFrameMembershipOfSelectedElements3(
|
|
@@ -11150,12 +11178,16 @@ import { jsx as jsx49 } from "react/jsx-runtime";
|
|
|
11150
11178
|
var normaliseSelectedElements = (elements, appState, app) => {
|
|
11151
11179
|
const selectedElements = app.scene.getSelectedElements(appState);
|
|
11152
11180
|
const elementsMap = arrayToMap10(elements);
|
|
11181
|
+
const { normalise } = getEffectiveEditorPreferences(
|
|
11182
|
+
appState,
|
|
11183
|
+
app.props.editorPreferences
|
|
11184
|
+
);
|
|
11153
11185
|
const updatedElements = normaliseElements(
|
|
11154
11186
|
app.scene,
|
|
11155
11187
|
selectedElements,
|
|
11156
11188
|
elementsMap,
|
|
11157
|
-
|
|
11158
|
-
|
|
11189
|
+
normalise.mode,
|
|
11190
|
+
normalise.metric
|
|
11159
11191
|
);
|
|
11160
11192
|
const updatedElementsMap = arrayToMap10(updatedElements);
|
|
11161
11193
|
return updateFrameMembershipOfSelectedElements4(
|
|
@@ -12545,7 +12577,7 @@ import {
|
|
|
12545
12577
|
isLinearElement as isLinearElement8,
|
|
12546
12578
|
isLineElement as isLineElement4
|
|
12547
12579
|
} from "@excalidraw/element";
|
|
12548
|
-
import { arrayToMap as
|
|
12580
|
+
import { arrayToMap as arrayToMap24, invariant as invariant14 } from "@excalidraw/common";
|
|
12549
12581
|
import {
|
|
12550
12582
|
toggleLinePolygonState as toggleLinePolygonState3,
|
|
12551
12583
|
CaptureUpdateAction as CaptureUpdateAction33
|
|
@@ -12607,7 +12639,7 @@ import {
|
|
|
12607
12639
|
updateActiveTool as updateActiveTool5
|
|
12608
12640
|
} from "@excalidraw/common";
|
|
12609
12641
|
import { measureText as measureText2 } from "@excalidraw/element";
|
|
12610
|
-
import { LinearElementEditor as LinearElementEditor6 } from "@excalidraw/element";
|
|
12642
|
+
import { LinearElementEditor as LinearElementEditor6 } from "@excalidraw/element/linearElementEditor";
|
|
12611
12643
|
import {
|
|
12612
12644
|
newArrowElement,
|
|
12613
12645
|
newElement as newElement2,
|
|
@@ -17602,10 +17634,7 @@ var ShapesSwitcher = ({
|
|
|
17602
17634
|
title: capitalizeString2(t("toolBar.lasso"))
|
|
17603
17635
|
}
|
|
17604
17636
|
];
|
|
17605
|
-
const frameToolSelected = activeTool.type === "frame";
|
|
17606
|
-
const laserToolSelected = activeTool.type === "laser";
|
|
17607
17637
|
const lassoToolSelected = isFullStylesPanel && activeTool.type === "lasso" && app.state.preferredSelectionTool.type !== "lasso";
|
|
17608
|
-
const embeddableToolSelected = activeTool.type === "embeddable";
|
|
17609
17638
|
const simplifiedShapeTools = SHAPES.filter(
|
|
17610
17639
|
(s) => s.myocSimplifiedMode === false
|
|
17611
17640
|
);
|
|
@@ -18686,7 +18715,7 @@ import {
|
|
|
18686
18715
|
// ../element/src/bounds.ts
|
|
18687
18716
|
import rough from "roughjs/bin/rough";
|
|
18688
18717
|
import {
|
|
18689
|
-
arrayToMap as
|
|
18718
|
+
arrayToMap as arrayToMap23,
|
|
18690
18719
|
invariant as invariant12,
|
|
18691
18720
|
rescalePoints,
|
|
18692
18721
|
sizeOf
|
|
@@ -18695,20 +18724,20 @@ import {
|
|
|
18695
18724
|
degreesToRadians,
|
|
18696
18725
|
lineSegment as lineSegment5,
|
|
18697
18726
|
pointDistance as pointDistance6,
|
|
18698
|
-
pointFrom as
|
|
18727
|
+
pointFrom as pointFrom15,
|
|
18699
18728
|
pointFromArray as pointFromArray3,
|
|
18700
|
-
pointRotateRads as
|
|
18729
|
+
pointRotateRads as pointRotateRads11
|
|
18701
18730
|
} from "@excalidraw/math";
|
|
18702
18731
|
import { pointsOnBezierCurves as pointsOnBezierCurves2 } from "points-on-curve";
|
|
18703
18732
|
|
|
18704
18733
|
// ../element/src/linearElementEditor.ts
|
|
18705
18734
|
import {
|
|
18706
18735
|
pointCenter,
|
|
18707
|
-
pointFrom as
|
|
18708
|
-
pointRotateRads as
|
|
18736
|
+
pointFrom as pointFrom14,
|
|
18737
|
+
pointRotateRads as pointRotateRads10,
|
|
18709
18738
|
pointsEqual as pointsEqual7,
|
|
18710
18739
|
pointDistance as pointDistance5,
|
|
18711
|
-
vectorFromPoint as
|
|
18740
|
+
vectorFromPoint as vectorFromPoint8,
|
|
18712
18741
|
curveLength,
|
|
18713
18742
|
curvePointAtLength
|
|
18714
18743
|
} from "@excalidraw/math";
|
|
@@ -18718,16 +18747,9 @@ import {
|
|
|
18718
18747
|
shouldRotateWithDiscreteAngle as shouldRotateWithDiscreteAngle2,
|
|
18719
18748
|
getGridPoint,
|
|
18720
18749
|
invariant as invariant11,
|
|
18721
|
-
isShallowEqual as
|
|
18750
|
+
isShallowEqual as isShallowEqual3,
|
|
18722
18751
|
getFeatureFlag as getFeatureFlag2
|
|
18723
18752
|
} from "@excalidraw/common";
|
|
18724
|
-
import {
|
|
18725
|
-
deconstructLinearOrFreeDrawElement as deconstructLinearOrFreeDrawElement2,
|
|
18726
|
-
getSnapOutlineMidPoint,
|
|
18727
|
-
isPathALoop as isPathALoop3,
|
|
18728
|
-
moveArrowAboveBindable,
|
|
18729
|
-
projectFixedPointOntoDiagonal as projectFixedPointOntoDiagonal2
|
|
18730
|
-
} from "@excalidraw/element";
|
|
18731
18753
|
|
|
18732
18754
|
// ../element/src/binding.ts
|
|
18733
18755
|
import {
|
|
@@ -18968,172 +18990,24 @@ import {
|
|
|
18968
18990
|
} from "@excalidraw/math";
|
|
18969
18991
|
import { pointsEqual as pointsEqual6 } from "@excalidraw/math";
|
|
18970
18992
|
|
|
18971
|
-
// ../element/src/
|
|
18972
|
-
|
|
18973
|
-
const topX = Math.floor(element.width / 2) + 1;
|
|
18974
|
-
const topY = 0;
|
|
18975
|
-
const rightX = element.width;
|
|
18976
|
-
const rightY = Math.floor(element.height / 2) + 1;
|
|
18977
|
-
const bottomX = topX;
|
|
18978
|
-
const bottomY = element.height;
|
|
18979
|
-
const leftX = 0;
|
|
18980
|
-
const leftY = rightY;
|
|
18981
|
-
return [topX, topY, rightX, rightY, bottomX, bottomY, leftX, leftY];
|
|
18982
|
-
};
|
|
18983
|
-
var CARDINALITY_MARKER_SIZE = 20;
|
|
18984
|
-
var CROWFOOT_ARROWHEAD_SIZE = 15;
|
|
18985
|
-
var getArrowheadSize = (arrowhead) => {
|
|
18986
|
-
switch (arrowhead) {
|
|
18987
|
-
case "arrow":
|
|
18988
|
-
return 25;
|
|
18989
|
-
case "diamond":
|
|
18990
|
-
case "diamond_outline":
|
|
18991
|
-
return 12;
|
|
18992
|
-
case "cardinality_many":
|
|
18993
|
-
case "cardinality_one_or_many":
|
|
18994
|
-
case "cardinality_zero_or_many":
|
|
18995
|
-
return CROWFOOT_ARROWHEAD_SIZE;
|
|
18996
|
-
case "cardinality_one":
|
|
18997
|
-
case "cardinality_exactly_one":
|
|
18998
|
-
case "cardinality_zero_or_one":
|
|
18999
|
-
return CARDINALITY_MARKER_SIZE;
|
|
19000
|
-
default:
|
|
19001
|
-
return 15;
|
|
19002
|
-
}
|
|
19003
|
-
};
|
|
19004
|
-
var getArrowheadAngle = (arrowhead) => {
|
|
19005
|
-
switch (arrowhead) {
|
|
19006
|
-
case "bar":
|
|
19007
|
-
return 90;
|
|
19008
|
-
case "arrow":
|
|
19009
|
-
return 20;
|
|
19010
|
-
default:
|
|
19011
|
-
return 25;
|
|
19012
|
-
}
|
|
19013
|
-
};
|
|
19014
|
-
var getArrowheadPoints = (element, shape, position, arrowhead, offsetMultiplier = 0) => {
|
|
19015
|
-
if (arrowhead === null) {
|
|
19016
|
-
return null;
|
|
19017
|
-
}
|
|
19018
|
-
if (shape.length < 1) {
|
|
19019
|
-
return null;
|
|
19020
|
-
}
|
|
19021
|
-
const ops = getCurvePathOps(shape[0]);
|
|
19022
|
-
if (ops.length < 1) {
|
|
19023
|
-
return null;
|
|
19024
|
-
}
|
|
19025
|
-
const index = position === "start" ? 1 : ops.length - 1;
|
|
19026
|
-
const data = ops[index].data;
|
|
19027
|
-
invariant12(data.length === 6, "Op data length is not 6");
|
|
19028
|
-
const p3 = pointFrom13(data[4], data[5]);
|
|
19029
|
-
const p2 = pointFrom13(data[2], data[3]);
|
|
19030
|
-
const p1 = pointFrom13(data[0], data[1]);
|
|
19031
|
-
const prevOp = ops[index - 1];
|
|
19032
|
-
let p0 = pointFrom13(0, 0);
|
|
19033
|
-
if (prevOp.op === "move") {
|
|
19034
|
-
const p = pointFromArray3(prevOp.data);
|
|
19035
|
-
invariant12(p != null, "Op data is not a point");
|
|
19036
|
-
p0 = p;
|
|
19037
|
-
} else if (prevOp.op === "bcurveTo") {
|
|
19038
|
-
p0 = pointFrom13(prevOp.data[4], prevOp.data[5]);
|
|
19039
|
-
}
|
|
19040
|
-
const equation = (t2, idx) => Math.pow(1 - t2, 3) * p3[idx] + 3 * t2 * Math.pow(1 - t2, 2) * p2[idx] + 3 * Math.pow(t2, 2) * (1 - t2) * p1[idx] + p0[idx] * Math.pow(t2, 3);
|
|
19041
|
-
const [x2, y2] = position === "start" ? p0 : p3;
|
|
19042
|
-
const [x1, y1] = [equation(0.3, 0), equation(0.3, 1)];
|
|
19043
|
-
const distance3 = Math.hypot(x2 - x1, y2 - y1);
|
|
19044
|
-
const nx = (x2 - x1) / distance3;
|
|
19045
|
-
const ny = (y2 - y1) / distance3;
|
|
19046
|
-
const size = getArrowheadSize(arrowhead);
|
|
19047
|
-
let length = 0;
|
|
19048
|
-
{
|
|
19049
|
-
const [cx, cy] = position === "end" ? element.points[element.points.length - 1] : element.points[0];
|
|
19050
|
-
const [px, py] = element.points.length > 1 ? position === "end" ? element.points[element.points.length - 2] : element.points[1] : [0, 0];
|
|
19051
|
-
length = Math.hypot(cx - px, cy - py);
|
|
19052
|
-
}
|
|
19053
|
-
const lengthMultiplier = arrowhead === "diamond" || arrowhead === "diamond_outline" ? 0.25 : 0.5;
|
|
19054
|
-
const minSize = Math.min(size, length * lengthMultiplier);
|
|
19055
|
-
const tx = x2 - nx * minSize * offsetMultiplier;
|
|
19056
|
-
const ty = y2 - ny * minSize * offsetMultiplier;
|
|
19057
|
-
const xs = tx - nx * minSize;
|
|
19058
|
-
const ys = ty - ny * minSize;
|
|
19059
|
-
if (arrowhead === "circle" || arrowhead === "circle_outline") {
|
|
19060
|
-
const diameter = Math.hypot(ys - ty, xs - tx) + element.strokeWidth - 2;
|
|
19061
|
-
return [tx, ty, diameter];
|
|
19062
|
-
}
|
|
19063
|
-
const angle = getArrowheadAngle(arrowhead);
|
|
19064
|
-
if (arrowhead === "cardinality_many" || arrowhead === "cardinality_one_or_many") {
|
|
19065
|
-
const [x32, y32] = pointRotateRads10(
|
|
19066
|
-
pointFrom13(tx, ty),
|
|
19067
|
-
pointFrom13(xs, ys),
|
|
19068
|
-
degreesToRadians(-angle)
|
|
19069
|
-
);
|
|
19070
|
-
const [x42, y42] = pointRotateRads10(
|
|
19071
|
-
pointFrom13(tx, ty),
|
|
19072
|
-
pointFrom13(xs, ys),
|
|
19073
|
-
degreesToRadians(angle)
|
|
19074
|
-
);
|
|
19075
|
-
return [xs, ys, x32, y32, x42, y42];
|
|
19076
|
-
}
|
|
19077
|
-
const [x3, y3] = pointRotateRads10(
|
|
19078
|
-
pointFrom13(xs, ys),
|
|
19079
|
-
pointFrom13(tx, ty),
|
|
19080
|
-
-angle * Math.PI / 180
|
|
19081
|
-
);
|
|
19082
|
-
const [x4, y4] = pointRotateRads10(
|
|
19083
|
-
pointFrom13(xs, ys),
|
|
19084
|
-
pointFrom13(tx, ty),
|
|
19085
|
-
degreesToRadians(angle)
|
|
19086
|
-
);
|
|
19087
|
-
if (arrowhead === "diamond" || arrowhead === "diamond_outline") {
|
|
19088
|
-
let ox;
|
|
19089
|
-
let oy;
|
|
19090
|
-
if (position === "start") {
|
|
19091
|
-
const [px, py] = element.points.length > 1 ? element.points[1] : [0, 0];
|
|
19092
|
-
[ox, oy] = pointRotateRads10(
|
|
19093
|
-
pointFrom13(tx + minSize * 2, ty),
|
|
19094
|
-
pointFrom13(tx, ty),
|
|
19095
|
-
Math.atan2(py - ty, px - tx)
|
|
19096
|
-
);
|
|
19097
|
-
} else {
|
|
19098
|
-
const [px, py] = element.points.length > 1 ? element.points[element.points.length - 2] : [0, 0];
|
|
19099
|
-
[ox, oy] = pointRotateRads10(
|
|
19100
|
-
pointFrom13(tx - minSize * 2, ty),
|
|
19101
|
-
pointFrom13(tx, ty),
|
|
19102
|
-
Math.atan2(ty - py, tx - px)
|
|
19103
|
-
);
|
|
19104
|
-
}
|
|
19105
|
-
return [tx, ty, x3, y3, ox, oy, x4, y4];
|
|
19106
|
-
}
|
|
19107
|
-
return [tx, ty, x3, y3, x4, y4];
|
|
19108
|
-
};
|
|
18993
|
+
// ../element/src/zindex.ts
|
|
18994
|
+
import { arrayToMap as arrayToMap22, findIndex, findLastIndex } from "@excalidraw/common";
|
|
19109
18995
|
|
|
19110
|
-
// ../element/src/
|
|
19111
|
-
import {
|
|
19112
|
-
pointFrom as pointFrom14,
|
|
19113
|
-
pointCenter as pointCenter2,
|
|
19114
|
-
pointRotateRads as pointRotateRads11,
|
|
19115
|
-
vectorFromPoint as vectorFromPoint8,
|
|
19116
|
-
vectorNormalize as vectorNormalize4,
|
|
19117
|
-
vectorSubtract,
|
|
19118
|
-
vectorAdd as vectorAdd2,
|
|
19119
|
-
vectorScale as vectorScale7,
|
|
19120
|
-
pointFromVector as pointFromVector6,
|
|
19121
|
-
clamp as clamp4,
|
|
19122
|
-
isCloseTo
|
|
19123
|
-
} from "@excalidraw/math";
|
|
18996
|
+
// ../element/src/selection.ts
|
|
18997
|
+
import { arrayToMap as arrayToMap20, isShallowEqual as isShallowEqual2 } from "@excalidraw/common";
|
|
19124
18998
|
|
|
19125
18999
|
// ../element/src/frame.ts
|
|
19126
|
-
import { arrayToMap as
|
|
19127
|
-
import { isPointWithinBounds as isPointWithinBounds2, pointFrom as
|
|
19000
|
+
import { arrayToMap as arrayToMap19 } from "@excalidraw/common";
|
|
19001
|
+
import { isPointWithinBounds as isPointWithinBounds2, pointFrom as pointFrom13 } from "@excalidraw/math";
|
|
19128
19002
|
|
|
19129
19003
|
// ../utils/src/bbox.ts
|
|
19130
19004
|
import {
|
|
19131
19005
|
vectorCross as vectorCross3,
|
|
19132
|
-
vectorFromPoint as
|
|
19006
|
+
vectorFromPoint as vectorFromPoint7
|
|
19133
19007
|
} from "@excalidraw/math";
|
|
19134
19008
|
|
|
19135
19009
|
// ../utils/src/withinBounds.ts
|
|
19136
|
-
import { arrayToMap as
|
|
19010
|
+
import { arrayToMap as arrayToMap18 } from "@excalidraw/common";
|
|
19137
19011
|
import { getElementBounds as getElementBounds2 } from "@excalidraw/element";
|
|
19138
19012
|
import {
|
|
19139
19013
|
isArrowElement as isArrowElement8,
|
|
@@ -19144,24 +19018,24 @@ import {
|
|
|
19144
19018
|
} from "@excalidraw/element";
|
|
19145
19019
|
import {
|
|
19146
19020
|
rangeIncludesValue,
|
|
19147
|
-
pointFrom as
|
|
19148
|
-
pointRotateRads as
|
|
19021
|
+
pointFrom as pointFrom12,
|
|
19022
|
+
pointRotateRads as pointRotateRads9,
|
|
19149
19023
|
rangeInclusive
|
|
19150
19024
|
} from "@excalidraw/math";
|
|
19151
19025
|
var getNonLinearElementRelativePoints = (element) => {
|
|
19152
19026
|
if (element.type === "diamond") {
|
|
19153
19027
|
return [
|
|
19154
|
-
|
|
19155
|
-
|
|
19156
|
-
|
|
19157
|
-
|
|
19028
|
+
pointFrom12(element.width / 2, 0),
|
|
19029
|
+
pointFrom12(element.width, element.height / 2),
|
|
19030
|
+
pointFrom12(element.width / 2, element.height),
|
|
19031
|
+
pointFrom12(0, element.height / 2)
|
|
19158
19032
|
];
|
|
19159
19033
|
}
|
|
19160
19034
|
return [
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
|
|
19164
|
-
|
|
19035
|
+
pointFrom12(0, 0),
|
|
19036
|
+
pointFrom12(0 + element.width, 0),
|
|
19037
|
+
pointFrom12(0 + element.width, element.height),
|
|
19038
|
+
pointFrom12(0, element.height)
|
|
19165
19039
|
];
|
|
19166
19040
|
};
|
|
19167
19041
|
var getElementRelativePoints = (element) => {
|
|
@@ -19195,9 +19069,9 @@ var getMinMaxPoints = (points) => {
|
|
|
19195
19069
|
var getRotatedBBox = (element) => {
|
|
19196
19070
|
const points = getElementRelativePoints(element);
|
|
19197
19071
|
const { cx, cy } = getMinMaxPoints(points);
|
|
19198
|
-
const centerPoint =
|
|
19072
|
+
const centerPoint = pointFrom12(cx, cy);
|
|
19199
19073
|
const rotatedPoints = points.map(
|
|
19200
|
-
(p) =>
|
|
19074
|
+
(p) => pointRotateRads9(p, centerPoint, element.angle)
|
|
19201
19075
|
);
|
|
19202
19076
|
const { minX, minY, maxX, maxY } = getMinMaxPoints(rotatedPoints);
|
|
19203
19077
|
return [
|
|
@@ -19235,7 +19109,7 @@ var elementsOverlappingBBox = ({
|
|
|
19235
19109
|
errorMargin = 0
|
|
19236
19110
|
}) => {
|
|
19237
19111
|
if (isExcalidrawElement2(bounds)) {
|
|
19238
|
-
bounds = getElementBounds2(bounds,
|
|
19112
|
+
bounds = getElementBounds2(bounds, arrayToMap18(elements));
|
|
19239
19113
|
}
|
|
19240
19114
|
const adjustedBBox = [
|
|
19241
19115
|
bounds[0] - errorMargin,
|
|
@@ -19272,8 +19146,75 @@ var elementsOverlappingBBox = ({
|
|
|
19272
19146
|
return elements.filter((element) => includedElementSet.has(element.id));
|
|
19273
19147
|
};
|
|
19274
19148
|
|
|
19149
|
+
// ../element/src/frame.ts
|
|
19150
|
+
var getFrameChildren2 = (allElements, frameId) => {
|
|
19151
|
+
const frameChildren = [];
|
|
19152
|
+
for (const element of allElements.values()) {
|
|
19153
|
+
if (element.frameId === frameId) {
|
|
19154
|
+
frameChildren.push(element);
|
|
19155
|
+
}
|
|
19156
|
+
}
|
|
19157
|
+
return frameChildren;
|
|
19158
|
+
};
|
|
19159
|
+
|
|
19275
19160
|
// ../element/src/selection.ts
|
|
19276
|
-
|
|
19161
|
+
var isSomeElementSelected2 = function() {
|
|
19162
|
+
let lastElements = null;
|
|
19163
|
+
let lastSelectedElementIds = null;
|
|
19164
|
+
let isSelected = null;
|
|
19165
|
+
const ret = (elements, appState) => {
|
|
19166
|
+
if (isSelected != null && elements === lastElements && appState.selectedElementIds === lastSelectedElementIds) {
|
|
19167
|
+
return isSelected;
|
|
19168
|
+
}
|
|
19169
|
+
isSelected = elements.some(
|
|
19170
|
+
(element) => appState.selectedElementIds[element.id]
|
|
19171
|
+
);
|
|
19172
|
+
lastElements = elements;
|
|
19173
|
+
lastSelectedElementIds = appState.selectedElementIds;
|
|
19174
|
+
return isSelected;
|
|
19175
|
+
};
|
|
19176
|
+
ret.clearCache = () => {
|
|
19177
|
+
lastElements = null;
|
|
19178
|
+
lastSelectedElementIds = null;
|
|
19179
|
+
isSelected = null;
|
|
19180
|
+
};
|
|
19181
|
+
return ret;
|
|
19182
|
+
}();
|
|
19183
|
+
var getSelectedElements3 = (elements, appState, opts) => {
|
|
19184
|
+
const addedElements = /* @__PURE__ */ new Set();
|
|
19185
|
+
const selectedElements = [];
|
|
19186
|
+
for (const element of elements.values()) {
|
|
19187
|
+
if (appState.selectedElementIds[element.id]) {
|
|
19188
|
+
selectedElements.push(element);
|
|
19189
|
+
addedElements.add(element.id);
|
|
19190
|
+
continue;
|
|
19191
|
+
}
|
|
19192
|
+
if (opts?.includeBoundTextElement && isBoundToContainer5(element) && appState.selectedElementIds[element?.containerId]) {
|
|
19193
|
+
selectedElements.push(element);
|
|
19194
|
+
addedElements.add(element.id);
|
|
19195
|
+
continue;
|
|
19196
|
+
}
|
|
19197
|
+
}
|
|
19198
|
+
if (opts?.includeElementsInFrames) {
|
|
19199
|
+
const elementsToInclude = [];
|
|
19200
|
+
selectedElements.forEach((element) => {
|
|
19201
|
+
if (isFrameLikeElement7(element)) {
|
|
19202
|
+
getFrameChildren2(elements, element.id).forEach(
|
|
19203
|
+
(e) => !addedElements.has(e.id) && elementsToInclude.push(e)
|
|
19204
|
+
);
|
|
19205
|
+
}
|
|
19206
|
+
elementsToInclude.push(element);
|
|
19207
|
+
});
|
|
19208
|
+
return elementsToInclude;
|
|
19209
|
+
}
|
|
19210
|
+
return selectedElements;
|
|
19211
|
+
};
|
|
19212
|
+
var makeNextSelectedElementIds = (nextSelectedElementIds, prevState) => {
|
|
19213
|
+
if (isShallowEqual2(prevState.selectedElementIds, nextSelectedElementIds)) {
|
|
19214
|
+
return prevState.selectedElementIds;
|
|
19215
|
+
}
|
|
19216
|
+
return nextSelectedElementIds;
|
|
19217
|
+
};
|
|
19277
19218
|
|
|
19278
19219
|
// ../element/src/groups.ts
|
|
19279
19220
|
var selectGroupsForSelectedElements4 = function() {
|
|
@@ -19365,76 +19306,164 @@ var selectGroupsForSelectedElements4 = function() {
|
|
|
19365
19306
|
return selectGroupsForSelectedElements7;
|
|
19366
19307
|
}();
|
|
19367
19308
|
|
|
19368
|
-
// ../element/src/
|
|
19369
|
-
|
|
19370
|
-
|
|
19371
|
-
|
|
19372
|
-
|
|
19373
|
-
|
|
19374
|
-
|
|
19375
|
-
|
|
19376
|
-
|
|
19377
|
-
|
|
19378
|
-
|
|
19379
|
-
|
|
19380
|
-
|
|
19381
|
-
|
|
19382
|
-
|
|
19383
|
-
|
|
19384
|
-
|
|
19385
|
-
|
|
19386
|
-
|
|
19387
|
-
|
|
19388
|
-
|
|
19389
|
-
|
|
19390
|
-
|
|
19391
|
-
|
|
19392
|
-
|
|
19393
|
-
|
|
19394
|
-
|
|
19395
|
-
|
|
19396
|
-
|
|
19397
|
-
|
|
19398
|
-
|
|
19399
|
-
|
|
19400
|
-
|
|
19401
|
-
|
|
19402
|
-
|
|
19403
|
-
continue;
|
|
19404
|
-
}
|
|
19405
|
-
}
|
|
19406
|
-
if (opts?.includeElementsInFrames) {
|
|
19407
|
-
const elementsToInclude = [];
|
|
19408
|
-
selectedElements.forEach((element) => {
|
|
19409
|
-
if (isFrameLikeElement7(element)) {
|
|
19410
|
-
getFrameChildren2(elements, element.id).forEach(
|
|
19411
|
-
(e) => !addedElements.has(e.id) && elementsToInclude.push(e)
|
|
19412
|
-
);
|
|
19413
|
-
}
|
|
19414
|
-
elementsToInclude.push(element);
|
|
19415
|
-
});
|
|
19416
|
-
return elementsToInclude;
|
|
19309
|
+
// ../element/src/fractionalIndex.ts
|
|
19310
|
+
import { generateNKeysBetween } from "fractional-indexing";
|
|
19311
|
+
import { arrayToMap as arrayToMap21 } from "@excalidraw/common";
|
|
19312
|
+
|
|
19313
|
+
// ../element/src/bounds.ts
|
|
19314
|
+
var getDiamondPoints = (element) => {
|
|
19315
|
+
const topX = Math.floor(element.width / 2) + 1;
|
|
19316
|
+
const topY = 0;
|
|
19317
|
+
const rightX = element.width;
|
|
19318
|
+
const rightY = Math.floor(element.height / 2) + 1;
|
|
19319
|
+
const bottomX = topX;
|
|
19320
|
+
const bottomY = element.height;
|
|
19321
|
+
const leftX = 0;
|
|
19322
|
+
const leftY = rightY;
|
|
19323
|
+
return [topX, topY, rightX, rightY, bottomX, bottomY, leftX, leftY];
|
|
19324
|
+
};
|
|
19325
|
+
var CARDINALITY_MARKER_SIZE = 20;
|
|
19326
|
+
var CROWFOOT_ARROWHEAD_SIZE = 15;
|
|
19327
|
+
var getArrowheadSize = (arrowhead) => {
|
|
19328
|
+
switch (arrowhead) {
|
|
19329
|
+
case "arrow":
|
|
19330
|
+
return 25;
|
|
19331
|
+
case "diamond":
|
|
19332
|
+
case "diamond_outline":
|
|
19333
|
+
return 12;
|
|
19334
|
+
case "cardinality_many":
|
|
19335
|
+
case "cardinality_one_or_many":
|
|
19336
|
+
case "cardinality_zero_or_many":
|
|
19337
|
+
return CROWFOOT_ARROWHEAD_SIZE;
|
|
19338
|
+
case "cardinality_one":
|
|
19339
|
+
case "cardinality_exactly_one":
|
|
19340
|
+
case "cardinality_zero_or_one":
|
|
19341
|
+
return CARDINALITY_MARKER_SIZE;
|
|
19342
|
+
default:
|
|
19343
|
+
return 15;
|
|
19417
19344
|
}
|
|
19418
|
-
return selectedElements;
|
|
19419
19345
|
};
|
|
19420
|
-
var
|
|
19421
|
-
|
|
19422
|
-
|
|
19346
|
+
var getArrowheadAngle = (arrowhead) => {
|
|
19347
|
+
switch (arrowhead) {
|
|
19348
|
+
case "bar":
|
|
19349
|
+
return 90;
|
|
19350
|
+
case "arrow":
|
|
19351
|
+
return 20;
|
|
19352
|
+
default:
|
|
19353
|
+
return 25;
|
|
19423
19354
|
}
|
|
19424
|
-
return nextSelectedElementIds;
|
|
19425
19355
|
};
|
|
19426
|
-
|
|
19427
|
-
|
|
19428
|
-
|
|
19429
|
-
|
|
19430
|
-
|
|
19431
|
-
|
|
19432
|
-
|
|
19356
|
+
var getArrowheadPoints = (element, shape, position, arrowhead, offsetMultiplier = 0) => {
|
|
19357
|
+
if (arrowhead === null) {
|
|
19358
|
+
return null;
|
|
19359
|
+
}
|
|
19360
|
+
if (shape.length < 1) {
|
|
19361
|
+
return null;
|
|
19362
|
+
}
|
|
19363
|
+
const ops = getCurvePathOps(shape[0]);
|
|
19364
|
+
if (ops.length < 1) {
|
|
19365
|
+
return null;
|
|
19366
|
+
}
|
|
19367
|
+
const index = position === "start" ? 1 : ops.length - 1;
|
|
19368
|
+
const data = ops[index].data;
|
|
19369
|
+
invariant12(data.length === 6, "Op data length is not 6");
|
|
19370
|
+
const p3 = pointFrom15(data[4], data[5]);
|
|
19371
|
+
const p2 = pointFrom15(data[2], data[3]);
|
|
19372
|
+
const p1 = pointFrom15(data[0], data[1]);
|
|
19373
|
+
const prevOp = ops[index - 1];
|
|
19374
|
+
let p0 = pointFrom15(0, 0);
|
|
19375
|
+
if (prevOp.op === "move") {
|
|
19376
|
+
const p = pointFromArray3(prevOp.data);
|
|
19377
|
+
invariant12(p != null, "Op data is not a point");
|
|
19378
|
+
p0 = p;
|
|
19379
|
+
} else if (prevOp.op === "bcurveTo") {
|
|
19380
|
+
p0 = pointFrom15(prevOp.data[4], prevOp.data[5]);
|
|
19381
|
+
}
|
|
19382
|
+
const equation = (t2, idx) => Math.pow(1 - t2, 3) * p3[idx] + 3 * t2 * Math.pow(1 - t2, 2) * p2[idx] + 3 * Math.pow(t2, 2) * (1 - t2) * p1[idx] + p0[idx] * Math.pow(t2, 3);
|
|
19383
|
+
const [x2, y2] = position === "start" ? p0 : p3;
|
|
19384
|
+
const [x1, y1] = [equation(0.3, 0), equation(0.3, 1)];
|
|
19385
|
+
const distance3 = Math.hypot(x2 - x1, y2 - y1);
|
|
19386
|
+
const nx = (x2 - x1) / distance3;
|
|
19387
|
+
const ny = (y2 - y1) / distance3;
|
|
19388
|
+
const size = getArrowheadSize(arrowhead);
|
|
19389
|
+
let length = 0;
|
|
19390
|
+
{
|
|
19391
|
+
const [cx, cy] = position === "end" ? element.points[element.points.length - 1] : element.points[0];
|
|
19392
|
+
const [px, py] = element.points.length > 1 ? position === "end" ? element.points[element.points.length - 2] : element.points[1] : [0, 0];
|
|
19393
|
+
length = Math.hypot(cx - px, cy - py);
|
|
19394
|
+
}
|
|
19395
|
+
const lengthMultiplier = arrowhead === "diamond" || arrowhead === "diamond_outline" ? 0.25 : 0.5;
|
|
19396
|
+
const minSize = Math.min(size, length * lengthMultiplier);
|
|
19397
|
+
const tx = x2 - nx * minSize * offsetMultiplier;
|
|
19398
|
+
const ty = y2 - ny * minSize * offsetMultiplier;
|
|
19399
|
+
const xs = tx - nx * minSize;
|
|
19400
|
+
const ys = ty - ny * minSize;
|
|
19401
|
+
if (arrowhead === "circle" || arrowhead === "circle_outline") {
|
|
19402
|
+
const diameter = Math.hypot(ys - ty, xs - tx) + element.strokeWidth - 2;
|
|
19403
|
+
return [tx, ty, diameter];
|
|
19404
|
+
}
|
|
19405
|
+
const angle = getArrowheadAngle(arrowhead);
|
|
19406
|
+
if (arrowhead === "cardinality_many" || arrowhead === "cardinality_one_or_many") {
|
|
19407
|
+
const [x32, y32] = pointRotateRads11(
|
|
19408
|
+
pointFrom15(tx, ty),
|
|
19409
|
+
pointFrom15(xs, ys),
|
|
19410
|
+
degreesToRadians(-angle)
|
|
19411
|
+
);
|
|
19412
|
+
const [x42, y42] = pointRotateRads11(
|
|
19413
|
+
pointFrom15(tx, ty),
|
|
19414
|
+
pointFrom15(xs, ys),
|
|
19415
|
+
degreesToRadians(angle)
|
|
19416
|
+
);
|
|
19417
|
+
return [xs, ys, x32, y32, x42, y42];
|
|
19418
|
+
}
|
|
19419
|
+
const [x3, y3] = pointRotateRads11(
|
|
19420
|
+
pointFrom15(xs, ys),
|
|
19421
|
+
pointFrom15(tx, ty),
|
|
19422
|
+
-angle * Math.PI / 180
|
|
19423
|
+
);
|
|
19424
|
+
const [x4, y4] = pointRotateRads11(
|
|
19425
|
+
pointFrom15(xs, ys),
|
|
19426
|
+
pointFrom15(tx, ty),
|
|
19427
|
+
degreesToRadians(angle)
|
|
19428
|
+
);
|
|
19429
|
+
if (arrowhead === "diamond" || arrowhead === "diamond_outline") {
|
|
19430
|
+
let ox;
|
|
19431
|
+
let oy;
|
|
19432
|
+
if (position === "start") {
|
|
19433
|
+
const [px, py] = element.points.length > 1 ? element.points[1] : [0, 0];
|
|
19434
|
+
[ox, oy] = pointRotateRads11(
|
|
19435
|
+
pointFrom15(tx + minSize * 2, ty),
|
|
19436
|
+
pointFrom15(tx, ty),
|
|
19437
|
+
Math.atan2(py - ty, px - tx)
|
|
19438
|
+
);
|
|
19439
|
+
} else {
|
|
19440
|
+
const [px, py] = element.points.length > 1 ? element.points[element.points.length - 2] : [0, 0];
|
|
19441
|
+
[ox, oy] = pointRotateRads11(
|
|
19442
|
+
pointFrom15(tx - minSize * 2, ty),
|
|
19443
|
+
pointFrom15(tx, ty),
|
|
19444
|
+
Math.atan2(ty - py, tx - px)
|
|
19445
|
+
);
|
|
19433
19446
|
}
|
|
19447
|
+
return [tx, ty, x3, y3, ox, oy, x4, y4];
|
|
19434
19448
|
}
|
|
19435
|
-
return
|
|
19449
|
+
return [tx, ty, x3, y3, x4, y4];
|
|
19436
19450
|
};
|
|
19437
19451
|
|
|
19452
|
+
// ../element/src/cropElement.ts
|
|
19453
|
+
import {
|
|
19454
|
+
pointFrom as pointFrom16,
|
|
19455
|
+
pointCenter as pointCenter2,
|
|
19456
|
+
pointRotateRads as pointRotateRads12,
|
|
19457
|
+
vectorFromPoint as vectorFromPoint9,
|
|
19458
|
+
vectorNormalize as vectorNormalize4,
|
|
19459
|
+
vectorSubtract,
|
|
19460
|
+
vectorAdd as vectorAdd2,
|
|
19461
|
+
vectorScale as vectorScale7,
|
|
19462
|
+
pointFromVector as pointFromVector6,
|
|
19463
|
+
clamp as clamp4,
|
|
19464
|
+
isCloseTo
|
|
19465
|
+
} from "@excalidraw/math";
|
|
19466
|
+
|
|
19438
19467
|
// ../element/src/renderElement.ts
|
|
19439
19468
|
var IMAGE_PLACEHOLDER_IMG = typeof document !== "undefined" ? document.createElement("img") : { src: "" };
|
|
19440
19469
|
IMAGE_PLACEHOLDER_IMG.src = `data:${MIME_TYPES7.svg},${encodeURIComponent(
|
|
@@ -20207,7 +20236,7 @@ var actionTogglePolygon = register({
|
|
|
20207
20236
|
}
|
|
20208
20237
|
const targetElements = selectedElements;
|
|
20209
20238
|
const nextPolygonState = targetElements.some((element) => !element.polygon);
|
|
20210
|
-
const targetElementsMap =
|
|
20239
|
+
const targetElementsMap = arrayToMap24(targetElements);
|
|
20211
20240
|
return {
|
|
20212
20241
|
elements: elements.map((element) => {
|
|
20213
20242
|
if (!targetElementsMap.has(element.id) || !isLineElement4(element)) {
|
|
@@ -20523,7 +20552,7 @@ import {
|
|
|
20523
20552
|
isWindows,
|
|
20524
20553
|
KEYS as KEYS40,
|
|
20525
20554
|
matchKey as matchKey2,
|
|
20526
|
-
arrayToMap as
|
|
20555
|
+
arrayToMap as arrayToMap25,
|
|
20527
20556
|
MOBILE_ACTION_BUTTON_BG as MOBILE_ACTION_BUTTON_BG4
|
|
20528
20557
|
} from "@excalidraw/common";
|
|
20529
20558
|
import { CaptureUpdateAction as CaptureUpdateAction38 } from "@excalidraw/element";
|
|
@@ -20750,7 +20779,7 @@ var createUndoAction = (history) => ({
|
|
|
20750
20779
|
perform: (elements, appState, value, app) => executeHistoryAction(
|
|
20751
20780
|
app,
|
|
20752
20781
|
appState,
|
|
20753
|
-
() => history.undo(
|
|
20782
|
+
() => history.undo(arrayToMap25(elements), appState)
|
|
20754
20783
|
),
|
|
20755
20784
|
keyTest: (event) => event[KEYS40.CTRL_OR_CMD] && matchKey2(event, KEYS40.Z) && !event.shiftKey,
|
|
20756
20785
|
PanelComponent: ({ appState, updateData, data, app }) => {
|
|
@@ -20788,7 +20817,7 @@ var createRedoAction = (history) => ({
|
|
|
20788
20817
|
perform: (elements, appState, __, app) => executeHistoryAction(
|
|
20789
20818
|
app,
|
|
20790
20819
|
appState,
|
|
20791
|
-
() => history.redo(
|
|
20820
|
+
() => history.redo(arrayToMap25(elements), appState)
|
|
20792
20821
|
),
|
|
20793
20822
|
keyTest: (event) => event[KEYS40.CTRL_OR_CMD] && event.shiftKey && matchKey2(event, KEYS40.Z) || isWindows && event.ctrlKey && !event.shiftKey && matchKey2(event, KEYS40.Y),
|
|
20794
20823
|
PanelComponent: ({ appState, updateData, data, app }) => {
|
|
@@ -22513,7 +22542,7 @@ import {
|
|
|
22513
22542
|
updateBoundElements as updateBoundElements2,
|
|
22514
22543
|
updateOriginalContainerCache as updateOriginalContainerCache3
|
|
22515
22544
|
} from "@excalidraw/element";
|
|
22516
|
-
import { LinearElementEditor as LinearElementEditor8 } from "@excalidraw/element";
|
|
22545
|
+
import { LinearElementEditor as LinearElementEditor8 } from "@excalidraw/element/linearElementEditor";
|
|
22517
22546
|
import { bumpVersion as bumpVersion2 } from "@excalidraw/element";
|
|
22518
22547
|
import {
|
|
22519
22548
|
getBoundTextElementId,
|
|
@@ -23283,7 +23312,7 @@ import {
|
|
|
23283
23312
|
pointFrom as pointFrom22
|
|
23284
23313
|
} from "@excalidraw/math";
|
|
23285
23314
|
import { getElementLineSegments as getElementLineSegments2 } from "@excalidraw/element";
|
|
23286
|
-
import { LinearElementEditor as LinearElementEditor9 } from "@excalidraw/element";
|
|
23315
|
+
import { LinearElementEditor as LinearElementEditor9 } from "@excalidraw/element/linearElementEditor";
|
|
23287
23316
|
import {
|
|
23288
23317
|
isFrameLikeElement as isFrameLikeElement9,
|
|
23289
23318
|
isLinearElement as isLinearElement9,
|
|
@@ -23292,7 +23321,7 @@ import {
|
|
|
23292
23321
|
import { getFrameChildren as getFrameChildren4 } from "@excalidraw/element";
|
|
23293
23322
|
import { selectGroupsForSelectedElements as selectGroupsForSelectedElements5 } from "@excalidraw/element";
|
|
23294
23323
|
import { getContainerElement as getContainerElement4 } from "@excalidraw/element";
|
|
23295
|
-
import { arrayToMap as
|
|
23324
|
+
import { arrayToMap as arrayToMap26, easeOut as easeOut2, isShallowEqual as isShallowEqual4 } from "@excalidraw/common";
|
|
23296
23325
|
|
|
23297
23326
|
// lasso/utils.ts
|
|
23298
23327
|
import { simplify as simplify2 } from "points-on-curve";
|
|
@@ -23488,7 +23517,7 @@ var LassoTrail = class extends AnimatedTrail {
|
|
|
23488
23517
|
if (!this.elementsSegments || !isShallowEqual4(currentCanvasTranslate, this.canvasTranslate ?? {})) {
|
|
23489
23518
|
this.canvasTranslate = currentCanvasTranslate;
|
|
23490
23519
|
this.elementsSegments = /* @__PURE__ */ new Map();
|
|
23491
|
-
const visibleElementsMap =
|
|
23520
|
+
const visibleElementsMap = arrayToMap26(this.app.visibleElements);
|
|
23492
23521
|
for (const element of this.app.visibleElements) {
|
|
23493
23522
|
const segments = getElementLineSegments2(element, visibleElementsMap);
|
|
23494
23523
|
this.elementsSegments.set(element.id, segments);
|
|
@@ -23533,6 +23562,7 @@ var LassoTrail = class extends AnimatedTrail {
|
|
|
23533
23562
|
|
|
23534
23563
|
// actions/actionSmartZoom.tsx
|
|
23535
23564
|
import { KEYS as KEYS43 } from "@excalidraw/common";
|
|
23565
|
+
import { CaptureUpdateAction as CaptureUpdateAction40 } from "@excalidraw/element/store";
|
|
23536
23566
|
import { jsx as jsx86 } from "react/jsx-runtime";
|
|
23537
23567
|
var actionSmartZoom = register({
|
|
23538
23568
|
name: "smartZoom",
|
|
@@ -23541,12 +23571,10 @@ var actionSmartZoom = register({
|
|
|
23541
23571
|
icon: arrowsToEyeIcon,
|
|
23542
23572
|
viewMode: true,
|
|
23543
23573
|
perform: (elements, appState, _, app) => {
|
|
23544
|
-
const settings =
|
|
23545
|
-
|
|
23546
|
-
|
|
23547
|
-
|
|
23548
|
-
viewportZoomFactor: 0.8
|
|
23549
|
-
};
|
|
23574
|
+
const settings = getEffectiveEditorPreferences(
|
|
23575
|
+
appState,
|
|
23576
|
+
app.props.editorPreferences
|
|
23577
|
+
).smartZoom;
|
|
23550
23578
|
const selectedElements = getSelectedElements(elements, appState);
|
|
23551
23579
|
if (selectedElements.length < 1) {
|
|
23552
23580
|
app.scrollToContent(elements, settings);
|
|
@@ -23573,7 +23601,7 @@ var actionSmartZoom = register({
|
|
|
23573
23601
|
});
|
|
23574
23602
|
|
|
23575
23603
|
// eraser/index.ts
|
|
23576
|
-
import { arrayToMap as
|
|
23604
|
+
import { arrayToMap as arrayToMap27, easeOut as easeOut3, THEME as THEME12 } from "@excalidraw/common";
|
|
23577
23605
|
import {
|
|
23578
23606
|
computeBoundTextPosition as computeBoundTextPosition4,
|
|
23579
23607
|
doBoundsIntersect as doBoundsIntersect3,
|
|
@@ -23642,7 +23670,7 @@ var EraserTrail = class extends AnimatedTrail {
|
|
|
23642
23670
|
const candidateElements = this.app.visibleElements.filter(
|
|
23643
23671
|
(el) => !el.locked
|
|
23644
23672
|
);
|
|
23645
|
-
const candidateElementsMap =
|
|
23673
|
+
const candidateElementsMap = arrayToMap27(candidateElements);
|
|
23646
23674
|
for (const element of candidateElements) {
|
|
23647
23675
|
if (restoreToErase && this.elementsToErase.has(element.id)) {
|
|
23648
23676
|
const intersects = eraserTest(
|
|
@@ -25116,7 +25144,7 @@ import {
|
|
|
25116
25144
|
CLASSES as CLASSES10,
|
|
25117
25145
|
DEFAULT_SIDEBAR as DEFAULT_SIDEBAR6,
|
|
25118
25146
|
TOOL_TYPE as TOOL_TYPE2,
|
|
25119
|
-
arrayToMap as
|
|
25147
|
+
arrayToMap as arrayToMap28,
|
|
25120
25148
|
capitalizeString as capitalizeString5,
|
|
25121
25149
|
isShallowEqual as isShallowEqual6
|
|
25122
25150
|
} from "@excalidraw/common";
|
|
@@ -32200,7 +32228,7 @@ var LayerUI = ({
|
|
|
32200
32228
|
}
|
|
32201
32229
|
if (selectedElements.length) {
|
|
32202
32230
|
for (const element of selectedElements) {
|
|
32203
|
-
mutateElement5(element,
|
|
32231
|
+
mutateElement5(element, arrayToMap28(elements), {
|
|
32204
32232
|
[altKey && eyeDropperState.swapPreviewOnAlt ? colorPickerType === "elementBackground" ? "strokeColor" : "backgroundColor" : colorPickerType === "elementBackground" ? "backgroundColor" : "strokeColor"]: color
|
|
32205
32233
|
});
|
|
32206
32234
|
ShapeCache3.delete(element);
|
|
@@ -32421,7 +32449,7 @@ import {
|
|
|
32421
32449
|
pointDistance as pointDistance8
|
|
32422
32450
|
} from "@excalidraw/math";
|
|
32423
32451
|
import {
|
|
32424
|
-
arrayToMap as
|
|
32452
|
+
arrayToMap as arrayToMap29,
|
|
32425
32453
|
BIND_MODE_TIMEOUT,
|
|
32426
32454
|
DEFAULT_TRANSFORM_HANDLE_SPACING as DEFAULT_TRANSFORM_HANDLE_SPACING2,
|
|
32427
32455
|
FRAME_STYLE as FRAME_STYLE3,
|
|
@@ -32449,9 +32477,9 @@ import {
|
|
|
32449
32477
|
isLineElement as isLineElement7,
|
|
32450
32478
|
maxBindingDistance_simple as maxBindingDistance_simple2,
|
|
32451
32479
|
isTextElement as isTextElement18,
|
|
32452
|
-
LinearElementEditor as LinearElementEditor10,
|
|
32453
32480
|
getActiveTextElement
|
|
32454
32481
|
} from "@excalidraw/element";
|
|
32482
|
+
import { LinearElementEditor as LinearElementEditor10 } from "@excalidraw/element/linearElementEditor";
|
|
32455
32483
|
import { renderSelectionElement } from "@excalidraw/element";
|
|
32456
32484
|
import {
|
|
32457
32485
|
getElementsInGroup as getElementsInGroup7,
|
|
@@ -33800,7 +33828,7 @@ var _renderInteractiveScene = ({
|
|
|
33800
33828
|
}
|
|
33801
33829
|
const selectionColor = renderConfig.selectionColor || "#000";
|
|
33802
33830
|
if (showBoundingBox) {
|
|
33803
|
-
const locallySelectedIds =
|
|
33831
|
+
const locallySelectedIds = arrayToMap29(selectedElements);
|
|
33804
33832
|
const selections = [];
|
|
33805
33833
|
for (const element of elementsMap.values()) {
|
|
33806
33834
|
const selectionColors = [];
|
|
@@ -34582,9 +34610,6 @@ var AppStateObserver = class {
|
|
|
34582
34610
|
}
|
|
34583
34611
|
};
|
|
34584
34612
|
|
|
34585
|
-
// components/App.tsx
|
|
34586
|
-
import { findShapeByKey } from "@excalidraw/element/shapes";
|
|
34587
|
-
|
|
34588
34613
|
// components/UnlockPopup.tsx
|
|
34589
34614
|
import {
|
|
34590
34615
|
getCommonBounds as getCommonBounds10,
|
|
@@ -34710,35 +34735,6 @@ var YOUTUBE_VIDEO_STATES = /* @__PURE__ */ new Map();
|
|
|
34710
34735
|
var IS_PLAIN_PASTE = false;
|
|
34711
34736
|
var IS_PLAIN_PASTE_TIMER = 0;
|
|
34712
34737
|
var PLAIN_PASTE_TOAST_SHOWN = false;
|
|
34713
|
-
var MERMAID_TO_EXCALIDRAW_MODULE = "@excalidraw/mermaid-to-excalidraw";
|
|
34714
|
-
var MERMAID_DEFINITION_PREFIXES = [
|
|
34715
|
-
"flowchart",
|
|
34716
|
-
"graph",
|
|
34717
|
-
"sequenceDiagram",
|
|
34718
|
-
"classDiagram",
|
|
34719
|
-
"stateDiagram",
|
|
34720
|
-
"erDiagram",
|
|
34721
|
-
"journey",
|
|
34722
|
-
"gantt",
|
|
34723
|
-
"pie",
|
|
34724
|
-
"mindmap",
|
|
34725
|
-
"timeline",
|
|
34726
|
-
"gitGraph",
|
|
34727
|
-
"quadrantChart",
|
|
34728
|
-
"xychart-beta",
|
|
34729
|
-
"C4Context",
|
|
34730
|
-
"C4Container",
|
|
34731
|
-
"C4Component",
|
|
34732
|
-
"C4Dynamic",
|
|
34733
|
-
"C4Deployment",
|
|
34734
|
-
"requirementDiagram"
|
|
34735
|
-
];
|
|
34736
|
-
var isMaybeMermaidDefinition = (text) => {
|
|
34737
|
-
const trimmedText = text.trimStart();
|
|
34738
|
-
return MERMAID_DEFINITION_PREFIXES.some(
|
|
34739
|
-
(prefix) => trimmedText.startsWith(prefix)
|
|
34740
|
-
);
|
|
34741
|
-
};
|
|
34742
34738
|
var lastPointerUp = null;
|
|
34743
34739
|
var gesture = {
|
|
34744
34740
|
pointers: /* @__PURE__ */ new Map(),
|
|
@@ -35671,7 +35667,7 @@ var App = class _App extends React44.Component {
|
|
|
35671
35667
|
prevElements
|
|
35672
35668
|
);
|
|
35673
35669
|
nextElements = mappedNewSceneElements || nextElements;
|
|
35674
|
-
|
|
35670
|
+
syncMovedIndices5(nextElements, arrayToMap30(duplicatedElements));
|
|
35675
35671
|
const topLayerFrame = this.getTopLayerFrameAtSceneCoords({ x, y });
|
|
35676
35672
|
if (topLayerFrame) {
|
|
35677
35673
|
const eligibleElements = filterElementsEligibleAsFrameChildren(
|
|
@@ -37446,7 +37442,7 @@ var App = class _App extends React44.Component {
|
|
|
37446
37442
|
}
|
|
37447
37443
|
});
|
|
37448
37444
|
} else {
|
|
37449
|
-
if (
|
|
37445
|
+
if (isPathALoop3(points, this.state.zoom.value)) {
|
|
37450
37446
|
setCursor(this.interactiveCanvas, CURSOR_TYPE4.POINTER);
|
|
37451
37447
|
}
|
|
37452
37448
|
const elementsMap = this.scene.getNonDeletedElementsMap();
|
|
@@ -38629,7 +38625,7 @@ var App = class _App extends React44.Component {
|
|
|
38629
38625
|
selectedLinearElement,
|
|
38630
38626
|
"selectedLinearElement is expected to be set"
|
|
38631
38627
|
);
|
|
38632
|
-
if (multiElement.type === "line" &&
|
|
38628
|
+
if (multiElement.type === "line" && isPathALoop3(multiElement.points, this.state.zoom.value)) {
|
|
38633
38629
|
flushSync3(() => {
|
|
38634
38630
|
this.setState({
|
|
38635
38631
|
selectedLinearElement: {
|
|
@@ -39220,14 +39216,14 @@ var App = class _App extends React44.Component {
|
|
|
39220
39216
|
}
|
|
39221
39217
|
})
|
|
39222
39218
|
);
|
|
39223
|
-
const initializedMap =
|
|
39219
|
+
const initializedMap = arrayToMap30(initialized);
|
|
39224
39220
|
const positioned = positionElementsOnGrid(
|
|
39225
39221
|
initialized.filter((el) => !el.isDeleted),
|
|
39226
39222
|
sceneX,
|
|
39227
39223
|
sceneY,
|
|
39228
39224
|
gridPadding
|
|
39229
39225
|
);
|
|
39230
|
-
const positionedMap =
|
|
39226
|
+
const positionedMap = arrayToMap30(positioned);
|
|
39231
39227
|
const nextElements = this.scene.getElementsIncludingDeleted().map((el) => positionedMap.get(el.id) ?? initializedMap.get(el.id) ?? el);
|
|
39232
39228
|
this.updateScene({
|
|
39233
39229
|
appState: {
|
|
@@ -40715,25 +40711,6 @@ var App = class _App extends React44.Component {
|
|
|
40715
40711
|
},
|
|
40716
40712
|
firstSelectedElement.id
|
|
40717
40713
|
),
|
|
40718
|
-
!!this.plugins.diagramToCode && selectedElements.length === 1 && isMagicFrameElement2(firstSelectedElement) && /* @__PURE__ */ jsx147(
|
|
40719
|
-
ElementCanvasButtons,
|
|
40720
|
-
{
|
|
40721
|
-
element: firstSelectedElement,
|
|
40722
|
-
elementsMap,
|
|
40723
|
-
children: /* @__PURE__ */ jsx147(
|
|
40724
|
-
ElementCanvasButton,
|
|
40725
|
-
{
|
|
40726
|
-
title: t("labels.convertToCode"),
|
|
40727
|
-
icon: MagicIcon,
|
|
40728
|
-
checked: false,
|
|
40729
|
-
onChange: () => this.onMagicFrameGenerate(
|
|
40730
|
-
firstSelectedElement,
|
|
40731
|
-
"button"
|
|
40732
|
-
)
|
|
40733
|
-
}
|
|
40734
|
-
)
|
|
40735
|
-
}
|
|
40736
|
-
),
|
|
40737
40714
|
selectedElements.length === 1 && isIframeElement2(firstSelectedElement) && firstSelectedElement.customData?.generationData?.status === "done" && /* @__PURE__ */ jsxs77(
|
|
40738
40715
|
ElementCanvasButtons,
|
|
40739
40716
|
{
|
|
@@ -41414,25 +41391,6 @@ var App = class _App extends React44.Component {
|
|
|
41414
41391
|
if (!data.text) {
|
|
41415
41392
|
return;
|
|
41416
41393
|
}
|
|
41417
|
-
if (!isPlainPaste && isMaybeMermaidDefinition(data.text)) {
|
|
41418
|
-
try {
|
|
41419
|
-
const api = await import(MERMAID_TO_EXCALIDRAW_MODULE);
|
|
41420
|
-
const { elements: skeletonElements, files } = await api.parseMermaidToExcalidraw(data.text);
|
|
41421
|
-
const elements = convertToExcalidrawElements([...skeletonElements], {
|
|
41422
|
-
regenerateIds: true
|
|
41423
|
-
});
|
|
41424
|
-
this.addElementsFromPasteOrLibrary({
|
|
41425
|
-
elements,
|
|
41426
|
-
files,
|
|
41427
|
-
position: this.editorInterface.formFactor === "desktop" ? "cursor" : "center"
|
|
41428
|
-
});
|
|
41429
|
-
return;
|
|
41430
|
-
} catch (err) {
|
|
41431
|
-
console.warn(
|
|
41432
|
-
`parsing pasted text as mermaid definition failed: ${err.message}`
|
|
41433
|
-
);
|
|
41434
|
-
}
|
|
41435
|
-
}
|
|
41436
41394
|
const nonEmptyLines = normalizeEOL2(data.text).split(/\n+/).map((s) => s.trim()).filter(Boolean);
|
|
41437
41395
|
const embbeddableUrls = nonEmptyLines.map((str) => maybeParseEmbedSrc(str)).filter(
|
|
41438
41396
|
(string) => embeddableURLValidator2(string, this.props.validateEmbeddable) && (/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(string) || getEmbedLink2(string)?.type === "video")
|
|
@@ -42539,9 +42497,9 @@ var App = class _App extends React44.Component {
|
|
|
42539
42497
|
mappedClonedElements,
|
|
42540
42498
|
elements
|
|
42541
42499
|
);
|
|
42542
|
-
const elementsWithIndices =
|
|
42500
|
+
const elementsWithIndices = syncMovedIndices5(
|
|
42543
42501
|
mappedNewSceneElements || mappedClonedElements,
|
|
42544
|
-
|
|
42502
|
+
arrayToMap30(duplicatedElements)
|
|
42545
42503
|
);
|
|
42546
42504
|
flushSync3(() => {
|
|
42547
42505
|
if (pointerDownState.hit.element) {
|
|
@@ -44007,7 +43965,7 @@ import { isInvisiblySmallElement as isInvisiblySmallElement4 } from "@excalidraw
|
|
|
44007
43965
|
|
|
44008
43966
|
// data/reconcile.ts
|
|
44009
43967
|
import throttle4 from "lodash.throttle";
|
|
44010
|
-
import { arrayToMap as
|
|
43968
|
+
import { arrayToMap as arrayToMap31, isDevEnv as isDevEnv10, isTestEnv as isTestEnv6 } from "@excalidraw/common";
|
|
44011
43969
|
import {
|
|
44012
43970
|
orderByFractionalIndex as orderByFractionalIndex2,
|
|
44013
43971
|
syncInvalidIndices as syncInvalidIndices2,
|
|
@@ -44044,7 +44002,7 @@ var validateIndicesThrottled = throttle4(
|
|
|
44044
44002
|
{ leading: true, trailing: false }
|
|
44045
44003
|
);
|
|
44046
44004
|
var reconcileElements = (localElements, remoteElements, localAppState) => {
|
|
44047
|
-
const localElementsMap =
|
|
44005
|
+
const localElementsMap = arrayToMap31(localElements);
|
|
44048
44006
|
const reconciledElements = [];
|
|
44049
44007
|
const added = /* @__PURE__ */ new Set();
|
|
44050
44008
|
for (const remoteElement of remoteElements) {
|
|
@@ -44096,7 +44054,7 @@ import {
|
|
|
44096
44054
|
newElementWith as newElementWith11,
|
|
44097
44055
|
bumpVersion as bumpVersion3
|
|
44098
44056
|
} from "@excalidraw/element";
|
|
44099
|
-
import { CaptureUpdateAction as
|
|
44057
|
+
import { CaptureUpdateAction as CaptureUpdateAction43 } from "@excalidraw/element";
|
|
44100
44058
|
import {
|
|
44101
44059
|
getCommonBounds as getCommonBounds12,
|
|
44102
44060
|
getVisibleSceneBounds as getVisibleSceneBounds2,
|
|
@@ -44148,6 +44106,8 @@ var ExcalidrawBase = (props) => {
|
|
|
44148
44106
|
theme,
|
|
44149
44107
|
name,
|
|
44150
44108
|
renderCustomStats,
|
|
44109
|
+
editorPreferences,
|
|
44110
|
+
onEditorPreferencesChange,
|
|
44151
44111
|
onPaste,
|
|
44152
44112
|
detectScroll = true,
|
|
44153
44113
|
handleKeyboardGlobally = false,
|
|
@@ -44236,6 +44196,8 @@ var ExcalidrawBase = (props) => {
|
|
|
44236
44196
|
theme,
|
|
44237
44197
|
name,
|
|
44238
44198
|
renderCustomStats,
|
|
44199
|
+
editorPreferences,
|
|
44200
|
+
onEditorPreferencesChange,
|
|
44239
44201
|
UIOptions,
|
|
44240
44202
|
onPaste,
|
|
44241
44203
|
detectScroll,
|
|
@@ -44305,7 +44267,7 @@ function useExcalidrawStateValue(selector) {
|
|
|
44305
44267
|
}
|
|
44306
44268
|
export {
|
|
44307
44269
|
Button,
|
|
44308
|
-
|
|
44270
|
+
CaptureUpdateAction43 as CaptureUpdateAction,
|
|
44309
44271
|
CommandPalette,
|
|
44310
44272
|
DEFAULT_LASER_COLOR2 as DEFAULT_LASER_COLOR,
|
|
44311
44273
|
DefaultSidebar,
|