@excalidraw/element 0.18.0-7ea3229 → 0.18.0-816c81c

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.
Files changed (90) hide show
  1. package/dist/dev/index.js +359 -152
  2. package/dist/dev/index.js.map +4 -4
  3. package/dist/prod/index.js +11 -11
  4. package/dist/types/common/src/appEventBus.d.ts +27 -0
  5. package/dist/types/common/src/colors.d.ts +1 -1
  6. package/dist/types/common/src/index.d.ts +2 -0
  7. package/dist/types/common/src/utils.d.ts +1 -3
  8. package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
  9. package/dist/types/element/src/Scene.d.ts +2 -0
  10. package/dist/types/element/src/arrowheads.d.ts +3 -0
  11. package/dist/types/element/src/binding.d.ts +3 -4
  12. package/dist/types/element/src/bounds.d.ts +1 -1
  13. package/dist/types/element/src/elbowArrow.d.ts +2 -0
  14. package/dist/types/element/src/index.d.ts +1 -0
  15. package/dist/types/element/src/linearElementEditor.d.ts +3 -0
  16. package/dist/types/element/src/mutateElement.d.ts +2 -0
  17. package/dist/types/element/src/types.d.ts +5 -2
  18. package/dist/types/element/src/utils.d.ts +1 -1
  19. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +23 -29
  20. package/dist/types/excalidraw/actions/actionBoundText.d.ts +16 -20
  21. package/dist/types/excalidraw/actions/actionCanvas.d.ts +97 -121
  22. package/dist/types/excalidraw/actions/actionClipboard.d.ts +16 -20
  23. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +8 -10
  24. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +24 -30
  25. package/dist/types/excalidraw/actions/actionElementLink.d.ts +4 -10
  26. package/dist/types/excalidraw/actions/actionElementLock.d.ts +16 -20
  27. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +8 -10
  28. package/dist/types/excalidraw/actions/actionExport.d.ts +60 -344
  29. package/dist/types/excalidraw/actions/actionFrame.d.ts +32 -40
  30. package/dist/types/excalidraw/actions/actionGroup.d.ts +16 -20
  31. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +8 -10
  32. package/dist/types/excalidraw/actions/actionLink.d.ts +8 -10
  33. package/dist/types/excalidraw/actions/actionMenu.d.ts +4 -10
  34. package/dist/types/excalidraw/actions/actionProperties.d.ts +16 -20
  35. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +8 -10
  36. package/dist/types/excalidraw/actions/actionStyles.d.ts +7 -9
  37. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +172 -0
  38. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +8 -10
  39. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +172 -0
  40. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +8 -10
  41. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +4 -10
  42. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +8 -10
  43. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +8 -10
  44. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +8 -10
  45. package/dist/types/excalidraw/actions/index.d.ts +2 -0
  46. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  47. package/dist/types/excalidraw/appState.d.ts +4 -2
  48. package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -0
  49. package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
  50. package/dist/types/excalidraw/charts/charts.helpers.d.ts +32 -0
  51. package/dist/types/excalidraw/charts/charts.line.d.ts +2 -0
  52. package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
  53. package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -0
  54. package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
  55. package/dist/types/excalidraw/charts/index.d.ts +7 -0
  56. package/dist/types/excalidraw/clipboard.d.ts +2 -5
  57. package/dist/types/excalidraw/components/App.d.ts +33 -11
  58. package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
  59. package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
  60. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
  61. package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
  62. package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
  63. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +4 -1
  64. package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
  65. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
  66. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
  67. package/dist/types/excalidraw/components/Toast.d.ts +8 -4
  68. package/dist/types/excalidraw/components/icons.d.ts +17 -8
  69. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +2 -0
  70. package/dist/types/excalidraw/data/blob.d.ts +25 -30
  71. package/dist/types/excalidraw/data/filesystem.d.ts +3 -5
  72. package/dist/types/excalidraw/data/index.d.ts +2 -3
  73. package/dist/types/excalidraw/data/json.d.ts +28 -22
  74. package/dist/types/excalidraw/data/resave.d.ts +7 -2
  75. package/dist/types/excalidraw/types.d.ts +84 -13
  76. package/package.json +3 -3
  77. package/dist/types/excalidraw/charts.d.ts +0 -27
  78. package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
  79. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -15
  80. package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
  81. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -8
  82. package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +0 -24
  83. package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
  84. package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -11
  85. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
  86. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
  87. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -84
  88. package/dist/types/excalidraw/data/reconcile.d.ts +0 -7
  89. package/dist/types/excalidraw/index.d.ts +0 -47
  90. package/dist/types/excalidraw/polyfill.d.ts +0 -2
package/dist/dev/index.js CHANGED
@@ -3124,7 +3124,7 @@ import {
3124
3124
  } from "@excalidraw/math";
3125
3125
  import {
3126
3126
  DRAGGING_THRESHOLD,
3127
- KEYS as KEYS2,
3127
+ KEYS,
3128
3128
  shouldRotateWithDiscreteAngle,
3129
3129
  getGridPoint,
3130
3130
  invariant as invariant8,
@@ -3142,7 +3142,6 @@ import {
3142
3142
  // src/binding.ts
3143
3143
  init_define_import_meta_env();
3144
3144
  import {
3145
- KEYS,
3146
3145
  arrayToMap as arrayToMap2,
3147
3146
  getFeatureFlag,
3148
3147
  invariant as invariant7,
@@ -3831,19 +3830,21 @@ var getSnapOutlineMidPoint = (point, element, elementsMap, zoom) => {
3831
3830
  );
3832
3831
  return candidate;
3833
3832
  };
3834
- var projectFixedPointOntoDiagonal = (arrow, point, element, startOrEnd, elementsMap, zoom) => {
3833
+ var projectFixedPointOntoDiagonal = (arrow, point, element, startOrEnd, elementsMap, zoom, isMidpointSnappingEnabled = true) => {
3835
3834
  invariant2(arrow.points.length >= 2, "Arrow must have at least two points");
3836
3835
  if (arrow.width < 3 && arrow.height < 3) {
3837
3836
  return null;
3838
3837
  }
3839
- const sideMidPoint = getSnapOutlineMidPoint(
3840
- point,
3841
- element,
3842
- elementsMap,
3843
- zoom
3844
- );
3845
- if (sideMidPoint) {
3846
- return sideMidPoint;
3838
+ if (isMidpointSnappingEnabled) {
3839
+ const sideMidPoint = getSnapOutlineMidPoint(
3840
+ point,
3841
+ element,
3842
+ elementsMap,
3843
+ zoom
3844
+ );
3845
+ if (sideMidPoint) {
3846
+ return sideMidPoint;
3847
+ }
3847
3848
  }
3848
3849
  const [diagonalOne, diagonalTwo] = getDiagonalsForBindableElement(
3849
3850
  element,
@@ -6242,7 +6243,7 @@ var getElbowArrowData = (arrow, elementsMap, nextPoints, options) => {
6242
6243
  const origEndGlobalPoint = pointTranslate2(nextPoints[nextPoints.length - 1], vector2(arrow.x, arrow.y));
6243
6244
  let hoveredStartElement = null;
6244
6245
  let hoveredEndElement = null;
6245
- if (options?.isDragging) {
6246
+ if (options?.isDragging && options?.isBindingEnabled !== false) {
6246
6247
  const elements = Array.from(elementsMap.values());
6247
6248
  hoveredStartElement = getHoveredElement(
6248
6249
  origStartGlobalPoint,
@@ -6273,7 +6274,9 @@ var getElbowArrowData = (arrow, elementsMap, nextPoints, options) => {
6273
6274
  origStartGlobalPoint,
6274
6275
  hoveredStartElement,
6275
6276
  elementsMap,
6276
- options?.isDragging
6277
+ options?.isDragging,
6278
+ options?.isBindingEnabled,
6279
+ options?.isMidpointSnappingEnabled
6277
6280
  );
6278
6281
  const endGlobalPoint = getGlobalPoint(
6279
6282
  {
@@ -6288,7 +6291,9 @@ var getElbowArrowData = (arrow, elementsMap, nextPoints, options) => {
6288
6291
  origEndGlobalPoint,
6289
6292
  hoveredEndElement,
6290
6293
  elementsMap,
6291
- options?.isDragging
6294
+ options?.isDragging,
6295
+ options?.isBindingEnabled,
6296
+ options?.isMidpointSnappingEnabled
6292
6297
  );
6293
6298
  const startHeading = getBindPointHeading(
6294
6299
  startGlobalPoint,
@@ -6911,14 +6916,16 @@ var neighborIndexToHeading = (idx) => {
6911
6916
  }
6912
6917
  return HEADING_LEFT;
6913
6918
  };
6914
- var getGlobalPoint = (arrow, startOrEnd, fixedPointRatio, initialPoint, element, elementsMap, isDragging) => {
6919
+ var getGlobalPoint = (arrow, startOrEnd, fixedPointRatio, initialPoint, element, elementsMap, isDragging, isBindingEnabled2 = true, isMidpointSnappingEnabled = true) => {
6915
6920
  if (isDragging) {
6916
- if (element && elementsMap) {
6921
+ if (isBindingEnabled2 && element && elementsMap) {
6917
6922
  return bindPointToSnapToElementOutline(
6918
6923
  arrow,
6919
6924
  element,
6920
6925
  startOrEnd,
6921
- elementsMap
6926
+ elementsMap,
6927
+ void 0,
6928
+ isMidpointSnappingEnabled
6922
6929
  );
6923
6930
  }
6924
6931
  return initialPoint;
@@ -7079,9 +7086,6 @@ var maxBindingDistance_simple = (zoom) => {
7079
7086
  BASE_BINDING_DISTANCE * 2
7080
7087
  );
7081
7088
  };
7082
- var shouldEnableBindingForPointerEvent = (event) => {
7083
- return !event[KEYS.CTRL_OR_CMD];
7084
- };
7085
7089
  var isBindingEnabled = (appState) => {
7086
7090
  return appState.isBindingEnabled;
7087
7091
  };
@@ -7099,8 +7103,20 @@ var bindOrUnbindBindingElement = (arrow, draggingPoints, scenePointerX, scenePoi
7099
7103
  finalize: true
7100
7104
  }
7101
7105
  );
7102
- bindOrUnbindBindingElementEdge(arrow, start, "start", scene);
7103
- bindOrUnbindBindingElementEdge(arrow, end, "end", scene);
7106
+ bindOrUnbindBindingElementEdge(
7107
+ arrow,
7108
+ start,
7109
+ "start",
7110
+ scene,
7111
+ appState.isBindingEnabled
7112
+ );
7113
+ bindOrUnbindBindingElementEdge(
7114
+ arrow,
7115
+ end,
7116
+ "end",
7117
+ scene,
7118
+ appState.isBindingEnabled
7119
+ );
7104
7120
  if (start.focusPoint || end.focusPoint) {
7105
7121
  const updates = /* @__PURE__ */ new Map();
7106
7122
  if (start.focusPoint) {
@@ -7129,11 +7145,19 @@ var bindOrUnbindBindingElement = (arrow, draggingPoints, scenePointerX, scenePoi
7129
7145
  }
7130
7146
  return { start, end };
7131
7147
  };
7132
- var bindOrUnbindBindingElementEdge = (arrow, { mode, element, focusPoint }, startOrEnd, scene) => {
7148
+ var bindOrUnbindBindingElementEdge = (arrow, { mode, element, focusPoint }, startOrEnd, scene, shouldSnapToOutline = true) => {
7133
7149
  if (mode === null) {
7134
7150
  unbindBindingElement(arrow, startOrEnd, scene);
7135
7151
  } else if (mode !== void 0) {
7136
- bindBindingElement(arrow, element, mode, startOrEnd, scene, focusPoint);
7152
+ bindBindingElement(
7153
+ arrow,
7154
+ element,
7155
+ mode,
7156
+ startOrEnd,
7157
+ scene,
7158
+ focusPoint,
7159
+ shouldSnapToOutline
7160
+ );
7137
7161
  }
7138
7162
  };
7139
7163
  var bindingStrategyForElbowArrowEndpointDragging = (arrow, draggingPoints, elementsMap, elements, zoom) => {
@@ -7487,7 +7511,8 @@ var getBindingStrategyForDraggingBindingElementEndpoints_simple = (arrow, draggi
7487
7511
  hit,
7488
7512
  startDragged ? "start" : "end",
7489
7513
  elementsMap,
7490
- appState.zoom
7514
+ appState.zoom,
7515
+ appState.isMidpointSnappingEnabled
7491
7516
  ) || globalPoint
7492
7517
  } : { mode: null };
7493
7518
  const otherEndpoint = LinearElementEditor.getPointAtIndexGlobalCoordinates(
@@ -7516,7 +7541,8 @@ var getBindingStrategyForDraggingBindingElementEndpoints_simple = (arrow, draggi
7516
7541
  otherBindableElement,
7517
7542
  startDragged ? "end" : "start",
7518
7543
  elementsMap,
7519
- appState.zoom
7544
+ appState.zoom,
7545
+ appState.isMidpointSnappingEnabled
7520
7546
  ) || otherEndpoint
7521
7547
  } : { mode: void 0 } : { mode: void 0 };
7522
7548
  return {
@@ -7626,7 +7652,7 @@ var bindOrUnbindBindingElements = (selectedArrows, scene, appState) => {
7626
7652
  );
7627
7653
  });
7628
7654
  };
7629
- var bindBindingElement = (arrow, hoveredElement, mode, startOrEnd, scene, focusPoint) => {
7655
+ var bindBindingElement = (arrow, hoveredElement, mode, startOrEnd, scene, focusPoint, shouldSnapToOutline = true) => {
7630
7656
  const elementsMap = scene.getNonDeletedElementsMap();
7631
7657
  let binding;
7632
7658
  if (isElbowArrow(arrow)) {
@@ -7637,7 +7663,8 @@ var bindBindingElement = (arrow, hoveredElement, mode, startOrEnd, scene, focusP
7637
7663
  arrow,
7638
7664
  hoveredElement,
7639
7665
  startOrEnd,
7640
- elementsMap
7666
+ elementsMap,
7667
+ shouldSnapToOutline
7641
7668
  )
7642
7669
  };
7643
7670
  } else {
@@ -7849,7 +7876,7 @@ var getDistanceForBinding = (point, bindableElement, elementsMap, zoom) => {
7849
7876
  const bindDistance = maxBindingDistance_simple(zoom);
7850
7877
  return distance3 > bindDistance ? null : distance3;
7851
7878
  };
7852
- var bindPointToSnapToElementOutline = (arrowElement, bindableElement, startOrEnd, elementsMap, customIntersector) => {
7879
+ var bindPointToSnapToElementOutline = (arrowElement, bindableElement, startOrEnd, elementsMap, customIntersector, isMidpointSnappingEnabled = true) => {
7853
7880
  const elbowed = isElbowArrow(arrowElement);
7854
7881
  const point = LinearElementEditor.getPointAtIndexGlobalCoordinates(
7855
7882
  arrowElement,
@@ -7878,13 +7905,7 @@ var bindPointToSnapToElementOutline = (arrowElement, bindableElement, startOrEnd
7878
7905
  const isHorizontal = headingIsHorizontal(
7879
7906
  headingForPointFromElement(bindableElement, aabb, point)
7880
7907
  );
7881
- const snapPoint = snapToMid(
7882
- bindableElement,
7883
- elementsMap,
7884
- edgePoint,
7885
- 0.05,
7886
- arrowElement
7887
- );
7908
+ const snapPoint = isMidpointSnappingEnabled ? snapToMid(bindableElement, elementsMap, edgePoint, 0.05, arrowElement) : void 0;
7888
7909
  const resolved = snapPoint || point;
7889
7910
  const otherPoint = pointFrom8(
7890
7911
  isHorizontal ? bindableCenter[0] : resolved[0],
@@ -8148,10 +8169,10 @@ var updateBoundPoint = (arrow, startOrEnd, binding, bindableElement, elementsMap
8148
8169
  );
8149
8170
  const otherArrowPoint = LinearElementEditor.getPointAtIndexGlobalCoordinates(
8150
8171
  arrow,
8151
- startOrEnd === "startBinding" ? -1 : 0,
8172
+ startOrEnd === "startBinding" ? 1 : -2,
8152
8173
  elementsMap
8153
8174
  );
8154
- const otherFocusPointOrArrowPoint = otherFocusPoint || otherArrowPoint;
8175
+ const otherFocusPointOrArrowPoint = arrow.points.length === 2 ? otherFocusPoint || otherArrowPoint : otherArrowPoint;
8155
8176
  const intersector = otherFocusPointOrArrowPoint && lineSegment4(focusPoint, otherFocusPointOrArrowPoint);
8156
8177
  const otherOutlinePoint = otherBindable && intersector && intersectElementWithLineSegment(
8157
8178
  otherBindable,
@@ -8216,17 +8237,23 @@ var updateBoundPoint = (arrow, startOrEnd, binding, bindableElement, elementsMap
8216
8237
  null
8217
8238
  );
8218
8239
  };
8219
- var calculateFixedPointForElbowArrowBinding = (linearElement, hoveredElement, startOrEnd, elementsMap) => {
8240
+ var calculateFixedPointForElbowArrowBinding = (linearElement, hoveredElement, startOrEnd, elementsMap, shouldSnapToOutline = true, isMidpointSnappingEnabled = true) => {
8220
8241
  const bounds = [
8221
8242
  hoveredElement.x,
8222
8243
  hoveredElement.y,
8223
8244
  hoveredElement.x + hoveredElement.width,
8224
8245
  hoveredElement.y + hoveredElement.height
8225
8246
  ];
8226
- const snappedPoint = bindPointToSnapToElementOutline(
8247
+ const snappedPoint = shouldSnapToOutline ? bindPointToSnapToElementOutline(
8227
8248
  linearElement,
8228
8249
  hoveredElement,
8229
8250
  startOrEnd,
8251
+ elementsMap,
8252
+ void 0,
8253
+ isMidpointSnappingEnabled
8254
+ ) : LinearElementEditor.getPointAtIndexGlobalCoordinates(
8255
+ linearElement,
8256
+ startOrEnd === "start" ? 0 : -1,
8230
8257
  elementsMap
8231
8258
  );
8232
8259
  const globalMidPoint = pointFrom8(
@@ -9083,7 +9110,7 @@ var LinearElementEditor = class _LinearElementEditor {
9083
9110
  elementsMap,
9084
9111
  pivotPoint,
9085
9112
  pointFrom9(scenePointerX, scenePointerY),
9086
- event[KEYS2.CTRL_OR_CMD] ? null : app.getEffectiveGridSize(),
9113
+ event[KEYS.CTRL_OR_CMD] ? null : app.getEffectiveGridSize(),
9087
9114
  customLineAngle
9088
9115
  );
9089
9116
  const target = pointFrom9(
@@ -9098,7 +9125,7 @@ var LinearElementEditor = class _LinearElementEditor {
9098
9125
  elementsMap,
9099
9126
  scenePointerX - linearElementEditor.pointerOffset.x,
9100
9127
  scenePointerY - linearElementEditor.pointerOffset.y,
9101
- event[KEYS2.CTRL_OR_CMD] ? null : app.getEffectiveGridSize()
9128
+ event[KEYS.CTRL_OR_CMD] ? null : app.getEffectiveGridSize()
9102
9129
  );
9103
9130
  deltaX = newDraggingPointPosition[0] - point[0];
9104
9131
  deltaY = newDraggingPointPosition[1] - point[1];
@@ -9118,11 +9145,20 @@ var LinearElementEditor = class _LinearElementEditor {
9118
9145
  event.altKey,
9119
9146
  linearElementEditor
9120
9147
  );
9121
- _LinearElementEditor.movePoints(element, app.scene, positions, {
9122
- startBinding: updates?.startBinding,
9123
- endBinding: updates?.endBinding,
9124
- moveMidPointsWithElement: updates?.moveMidPointsWithElement
9125
- });
9148
+ _LinearElementEditor.movePoints(
9149
+ element,
9150
+ app.scene,
9151
+ positions,
9152
+ {
9153
+ startBinding: updates?.startBinding,
9154
+ endBinding: updates?.endBinding,
9155
+ moveMidPointsWithElement: updates?.moveMidPointsWithElement
9156
+ },
9157
+ {
9158
+ isBindingEnabled: app.state.isBindingEnabled,
9159
+ isMidpointSnappingEnabled: app.state.isMidpointSnappingEnabled
9160
+ }
9161
+ );
9126
9162
  if (isBindingElement(element, false)) {
9127
9163
  if (isBindingEnabled(app.state)) {
9128
9164
  suggestedBinding = updates?.suggestedBinding ?? null;
@@ -9158,7 +9194,8 @@ var LinearElementEditor = class _LinearElementEditor {
9158
9194
  startBindingElement,
9159
9195
  "start",
9160
9196
  elementsMap,
9161
- app.state.zoom
9197
+ app.state.zoom,
9198
+ app.state.isMidpointSnappingEnabled
9162
9199
  ) : linearElementEditor.initialState.altFocusPoint
9163
9200
  }
9164
9201
  };
@@ -9214,7 +9251,7 @@ var LinearElementEditor = class _LinearElementEditor {
9214
9251
  elementsMap,
9215
9252
  pivotPoint,
9216
9253
  pointFrom9(scenePointerX, scenePointerY),
9217
- event[KEYS2.CTRL_OR_CMD] ? null : app.getEffectiveGridSize(),
9254
+ event[KEYS.CTRL_OR_CMD] ? null : app.getEffectiveGridSize(),
9218
9255
  customLineAngle
9219
9256
  );
9220
9257
  const target = pointFrom9(
@@ -9229,7 +9266,7 @@ var LinearElementEditor = class _LinearElementEditor {
9229
9266
  elementsMap,
9230
9267
  scenePointerX - linearElementEditor.pointerOffset.x,
9231
9268
  scenePointerY - linearElementEditor.pointerOffset.y,
9232
- event[KEYS2.CTRL_OR_CMD] ? null : app.getEffectiveGridSize()
9269
+ event[KEYS.CTRL_OR_CMD] ? null : app.getEffectiveGridSize()
9233
9270
  );
9234
9271
  deltaX = newDraggingPointPosition[0] - draggingPoint[0];
9235
9272
  deltaY = newDraggingPointPosition[1] - draggingPoint[1];
@@ -9249,11 +9286,20 @@ var LinearElementEditor = class _LinearElementEditor {
9249
9286
  event.altKey,
9250
9287
  linearElementEditor
9251
9288
  );
9252
- _LinearElementEditor.movePoints(element, app.scene, positions, {
9253
- startBinding: updates?.startBinding,
9254
- endBinding: updates?.endBinding,
9255
- moveMidPointsWithElement: updates?.moveMidPointsWithElement
9256
- });
9289
+ _LinearElementEditor.movePoints(
9290
+ element,
9291
+ app.scene,
9292
+ positions,
9293
+ {
9294
+ startBinding: updates?.startBinding,
9295
+ endBinding: updates?.endBinding,
9296
+ moveMidPointsWithElement: updates?.moveMidPointsWithElement
9297
+ },
9298
+ {
9299
+ isBindingEnabled: app.state.isBindingEnabled,
9300
+ isMidpointSnappingEnabled: app.state.isMidpointSnappingEnabled
9301
+ }
9302
+ );
9257
9303
  if (isBindingElement(element, false)) {
9258
9304
  if (isBindingEnabled(app.state) && (startIsSelected || endIsSelected)) {
9259
9305
  suggestedBinding = updates?.suggestedBinding ?? null;
@@ -9306,7 +9352,8 @@ var LinearElementEditor = class _LinearElementEditor {
9306
9352
  altFocusPointBindableElement,
9307
9353
  "start",
9308
9354
  elementsMap,
9309
- app.state.zoom
9355
+ app.state.zoom,
9356
+ app.state.isMidpointSnappingEnabled
9310
9357
  ) : linearElementEditor.initialState.altFocusPoint
9311
9358
  },
9312
9359
  segmentMidPointHoveredCoords: newSelectedMidPointHoveredCoords,
@@ -9586,7 +9633,7 @@ var LinearElementEditor = class _LinearElementEditor {
9586
9633
  elementsMap,
9587
9634
  scenePointer.x,
9588
9635
  scenePointer.y,
9589
- event[KEYS2.CTRL_OR_CMD] ? null : app.getEffectiveGridSize()
9636
+ event[KEYS.CTRL_OR_CMD] ? null : app.getEffectiveGridSize()
9590
9637
  )
9591
9638
  ]
9592
9639
  });
@@ -9699,7 +9746,7 @@ var LinearElementEditor = class _LinearElementEditor {
9699
9746
  elementsMap,
9700
9747
  anchor,
9701
9748
  pointFrom9(scenePointerX, scenePointerY),
9702
- event[KEYS2.CTRL_OR_CMD] ? null : app.getEffectiveGridSize()
9749
+ event[KEYS.CTRL_OR_CMD] ? null : app.getEffectiveGridSize()
9703
9750
  );
9704
9751
  newPoint = pointFrom9(width + anchor[0], height + anchor[1]);
9705
9752
  } else {
@@ -9708,7 +9755,7 @@ var LinearElementEditor = class _LinearElementEditor {
9708
9755
  elementsMap,
9709
9756
  scenePointerX - appState.selectedLinearElement.pointerOffset.x,
9710
9757
  scenePointerY - appState.selectedLinearElement.pointerOffset.y,
9711
- event[KEYS2.CTRL_OR_CMD] || isElbowArrow(element) ? null : app.getEffectiveGridSize()
9758
+ event[KEYS.CTRL_OR_CMD] || isElbowArrow(element) ? null : app.getEffectiveGridSize()
9712
9759
  );
9713
9760
  }
9714
9761
  if (lastPoint === lastUncommittedPoint) {
@@ -9936,7 +9983,7 @@ var LinearElementEditor = class _LinearElementEditor {
9936
9983
  offsetY
9937
9984
  );
9938
9985
  }
9939
- static movePoints(element, scene, pointUpdates, otherUpdates) {
9986
+ static movePoints(element, scene, pointUpdates, otherUpdates, options) {
9940
9987
  const { points } = element;
9941
9988
  if (isLineElement(element) && element.polygon) {
9942
9989
  const firstPointUpdate = pointUpdates.get(0);
@@ -9979,7 +10026,9 @@ var LinearElementEditor = class _LinearElementEditor {
9979
10026
  offsetY,
9980
10027
  otherUpdates,
9981
10028
  {
9982
- isDragging: Array.from(pointUpdates.values()).some((t) => t.isDragging)
10029
+ isDragging: Array.from(pointUpdates.values()).some((t) => t.isDragging),
10030
+ isBindingEnabled: options?.isBindingEnabled,
10031
+ isMidpointSnappingEnabled: options?.isMidpointSnappingEnabled
9983
10032
  }
9984
10033
  );
9985
10034
  }
@@ -10058,7 +10107,9 @@ var LinearElementEditor = class _LinearElementEditor {
10058
10107
  updates.points = Array.from(nextPoints);
10059
10108
  scene.mutateElement(element, updates, {
10060
10109
  informMutation: true,
10061
- isDragging: options?.isDragging ?? false
10110
+ isDragging: options?.isDragging ?? false,
10111
+ isBindingEnabled: options?.isBindingEnabled,
10112
+ isMidpointSnappingEnabled: options?.isMidpointSnappingEnabled
10062
10113
  });
10063
10114
  } else {
10064
10115
  const nextCoords = getElementPointsCoords(element, nextPoints);
@@ -10365,14 +10416,14 @@ var pointDraggingUpdates = (selectedPointsIndices, deltaX, deltaY, scenePointerX
10365
10416
  updates: {
10366
10417
  suggestedBinding: suggestedBindingElement ? {
10367
10418
  element: suggestedBindingElement,
10368
- midPoint: snapToMid(
10419
+ midPoint: app.state.isMidpointSnappingEnabled ? snapToMid(
10369
10420
  suggestedBindingElement,
10370
10421
  elementsMap,
10371
10422
  pointFrom9(
10372
10423
  scenePointerX - linearElementEditor.pointerOffset.x,
10373
10424
  scenePointerY - linearElementEditor.pointerOffset.y
10374
10425
  )
10375
- )
10426
+ ) : void 0
10376
10427
  } : null
10377
10428
  }
10378
10429
  };
@@ -12520,44 +12571,87 @@ var modifyIframeLikeForRoughOptions = (element, isExporting, embedsValidationSta
12520
12571
  }
12521
12572
  return element;
12522
12573
  };
12523
- var getArrowheadShapes = (element, shape, position, arrowhead, generator, options, canvasBackgroundColor, isDarkMode) => {
12524
- const arrowheadPoints = getArrowheadPoints(
12525
- element,
12526
- shape,
12527
- position,
12528
- arrowhead
12529
- );
12574
+ var generateArrowheadCardinalityOne = (generator, arrowheadPoints, lineOptions) => {
12530
12575
  if (arrowheadPoints === null) {
12531
12576
  return [];
12532
12577
  }
12533
- const generateCrowfootOne = (arrowheadPoints2, options2) => {
12534
- if (arrowheadPoints2 === null) {
12535
- return [];
12536
- }
12537
- const [, , x3, y3, x4, y4] = arrowheadPoints2;
12538
- return [generator.line(x3, y3, x4, y4, options2)];
12578
+ const [, , x3, y3, x4, y4] = arrowheadPoints;
12579
+ return [generator.line(x3, y3, x4, y4, lineOptions)];
12580
+ };
12581
+ var generateArrowheadLinesToTip = (generator, arrowheadPoints, lineOptions) => {
12582
+ if (arrowheadPoints === null) {
12583
+ return [];
12584
+ }
12585
+ const [x2, y2, x3, y3, x4, y4] = arrowheadPoints;
12586
+ return [
12587
+ generator.line(x3, y3, x2, y2, lineOptions),
12588
+ generator.line(x4, y4, x2, y2, lineOptions)
12589
+ ];
12590
+ };
12591
+ var getArrowheadLineOptions = (element, options) => {
12592
+ const lineOptions = { ...options };
12593
+ if (element.strokeStyle === "dotted") {
12594
+ const dash = getDashArrayDotted(element.strokeWidth - 1);
12595
+ lineOptions.strokeLineDash = [dash[0], dash[1] - 1];
12596
+ } else {
12597
+ delete lineOptions.strokeLineDash;
12598
+ }
12599
+ lineOptions.roughness = Math.min(1, lineOptions.roughness || 0);
12600
+ return lineOptions;
12601
+ };
12602
+ var generateArrowheadOutlineCircle = (generator, options, strokeColor, arrowheadPoints, fill, diameterScale = 1) => {
12603
+ if (arrowheadPoints === null) {
12604
+ return [];
12605
+ }
12606
+ const [x, y, diameter] = arrowheadPoints;
12607
+ const circleOptions = {
12608
+ ...options,
12609
+ fill,
12610
+ fillStyle: "solid",
12611
+ stroke: strokeColor,
12612
+ roughness: Math.min(0.5, options.roughness || 0)
12539
12613
  };
12614
+ delete circleOptions.strokeLineDash;
12615
+ return [generator.circle(x, y, diameter * diameterScale, circleOptions)];
12616
+ };
12617
+ var getArrowheadShapes = (element, shape, position, arrowhead, generator, options, canvasBackgroundColor, isDarkMode) => {
12618
+ if (arrowhead === null) {
12619
+ return [];
12620
+ }
12540
12621
  const strokeColor = isDarkMode ? applyDarkModeFilter2(element.strokeColor) : element.strokeColor;
12622
+ const backgroundFillColor = isDarkMode ? applyDarkModeFilter2(canvasBackgroundColor) : canvasBackgroundColor;
12623
+ const cardinalityOneOrManyOffset = -0.25;
12624
+ const cardinalityZeroCircleScale = 0.8;
12541
12625
  switch (arrowhead) {
12542
- case "dot":
12543
12626
  case "circle":
12544
12627
  case "circle_outline": {
12545
- const [x, y, diameter] = arrowheadPoints;
12546
- delete options.strokeLineDash;
12547
- return [
12548
- generator.circle(x, y, diameter, {
12549
- ...options,
12550
- fill: arrowhead === "circle_outline" ? canvasBackgroundColor : strokeColor,
12551
- fillStyle: "solid",
12552
- stroke: strokeColor,
12553
- roughness: Math.min(0.5, options.roughness || 0)
12554
- })
12555
- ];
12628
+ return generateArrowheadOutlineCircle(
12629
+ generator,
12630
+ options,
12631
+ strokeColor,
12632
+ getArrowheadPoints(element, shape, position, arrowhead),
12633
+ arrowhead === "circle_outline" ? backgroundFillColor : strokeColor
12634
+ );
12556
12635
  }
12557
12636
  case "triangle":
12558
12637
  case "triangle_outline": {
12638
+ const arrowheadPoints = getArrowheadPoints(
12639
+ element,
12640
+ shape,
12641
+ position,
12642
+ arrowhead
12643
+ );
12644
+ if (arrowheadPoints === null) {
12645
+ return [];
12646
+ }
12559
12647
  const [x, y, x2, y2, x3, y3] = arrowheadPoints;
12560
- delete options.strokeLineDash;
12648
+ const triangleOptions = {
12649
+ ...options,
12650
+ fill: arrowhead === "triangle_outline" ? backgroundFillColor : strokeColor,
12651
+ fillStyle: "solid",
12652
+ roughness: Math.min(1, options.roughness || 0)
12653
+ };
12654
+ delete triangleOptions.strokeLineDash;
12561
12655
  return [
12562
12656
  generator.polygon(
12563
12657
  [
@@ -12566,19 +12660,29 @@ var getArrowheadShapes = (element, shape, position, arrowhead, generator, option
12566
12660
  [x3, y3],
12567
12661
  [x, y]
12568
12662
  ],
12569
- {
12570
- ...options,
12571
- fill: arrowhead === "triangle_outline" ? canvasBackgroundColor : strokeColor,
12572
- fillStyle: "solid",
12573
- roughness: Math.min(1, options.roughness || 0)
12574
- }
12663
+ triangleOptions
12575
12664
  )
12576
12665
  ];
12577
12666
  }
12578
12667
  case "diamond":
12579
12668
  case "diamond_outline": {
12669
+ const arrowheadPoints = getArrowheadPoints(
12670
+ element,
12671
+ shape,
12672
+ position,
12673
+ arrowhead
12674
+ );
12675
+ if (arrowheadPoints === null) {
12676
+ return [];
12677
+ }
12580
12678
  const [x, y, x2, y2, x3, y3, x4, y4] = arrowheadPoints;
12581
- delete options.strokeLineDash;
12679
+ const diamondOptions = {
12680
+ ...options,
12681
+ fill: arrowhead === "diamond_outline" ? backgroundFillColor : strokeColor,
12682
+ fillStyle: "solid",
12683
+ roughness: Math.min(1, options.roughness || 0)
12684
+ };
12685
+ delete diamondOptions.strokeLineDash;
12582
12686
  return [
12583
12687
  generator.polygon(
12584
12688
  [
@@ -12588,38 +12692,102 @@ var getArrowheadShapes = (element, shape, position, arrowhead, generator, option
12588
12692
  [x4, y4],
12589
12693
  [x, y]
12590
12694
  ],
12591
- {
12592
- ...options,
12593
- fill: arrowhead === "diamond_outline" ? canvasBackgroundColor : strokeColor,
12594
- fillStyle: "solid",
12595
- roughness: Math.min(1, options.roughness || 0)
12596
- }
12695
+ diamondOptions
12696
+ )
12697
+ ];
12698
+ }
12699
+ case "cardinality_one":
12700
+ return generateArrowheadCardinalityOne(
12701
+ generator,
12702
+ getArrowheadPoints(element, shape, position, arrowhead),
12703
+ getArrowheadLineOptions(element, options)
12704
+ );
12705
+ case "cardinality_many":
12706
+ return generateArrowheadLinesToTip(
12707
+ generator,
12708
+ getArrowheadPoints(element, shape, position, arrowhead),
12709
+ getArrowheadLineOptions(element, options)
12710
+ );
12711
+ case "cardinality_one_or_many": {
12712
+ const lineOptions = getArrowheadLineOptions(element, options);
12713
+ return [
12714
+ ...generateArrowheadLinesToTip(
12715
+ generator,
12716
+ getArrowheadPoints(element, shape, position, "cardinality_many"),
12717
+ lineOptions
12718
+ ),
12719
+ ...generateArrowheadCardinalityOne(
12720
+ generator,
12721
+ getArrowheadPoints(
12722
+ element,
12723
+ shape,
12724
+ position,
12725
+ "cardinality_one",
12726
+ cardinalityOneOrManyOffset
12727
+ ),
12728
+ lineOptions
12729
+ )
12730
+ ];
12731
+ }
12732
+ case "cardinality_exactly_one": {
12733
+ const lineOptions = getArrowheadLineOptions(element, options);
12734
+ return [
12735
+ ...generateArrowheadCardinalityOne(
12736
+ generator,
12737
+ getArrowheadPoints(element, shape, position, "cardinality_one", -0.5),
12738
+ lineOptions
12739
+ ),
12740
+ ...generateArrowheadCardinalityOne(
12741
+ generator,
12742
+ getArrowheadPoints(element, shape, position, "cardinality_one"),
12743
+ lineOptions
12744
+ )
12745
+ ];
12746
+ }
12747
+ case "cardinality_zero_or_one": {
12748
+ const lineOptions = getArrowheadLineOptions(element, options);
12749
+ return [
12750
+ ...generateArrowheadOutlineCircle(
12751
+ generator,
12752
+ options,
12753
+ strokeColor,
12754
+ getArrowheadPoints(element, shape, position, "circle_outline", 1.5),
12755
+ backgroundFillColor,
12756
+ cardinalityZeroCircleScale
12757
+ ),
12758
+ ...generateArrowheadCardinalityOne(
12759
+ generator,
12760
+ getArrowheadPoints(element, shape, position, "cardinality_one", -0.5),
12761
+ lineOptions
12762
+ )
12763
+ ];
12764
+ }
12765
+ case "cardinality_zero_or_many": {
12766
+ const lineOptions = getArrowheadLineOptions(element, options);
12767
+ return [
12768
+ ...generateArrowheadLinesToTip(
12769
+ generator,
12770
+ getArrowheadPoints(element, shape, position, "cardinality_many"),
12771
+ lineOptions
12772
+ ),
12773
+ ...generateArrowheadOutlineCircle(
12774
+ generator,
12775
+ options,
12776
+ strokeColor,
12777
+ getArrowheadPoints(element, shape, position, "circle_outline", 1.5),
12778
+ backgroundFillColor,
12779
+ cardinalityZeroCircleScale
12597
12780
  )
12598
12781
  ];
12599
12782
  }
12600
- case "crowfoot_one":
12601
- return generateCrowfootOne(arrowheadPoints, options);
12602
12783
  case "bar":
12603
12784
  case "arrow":
12604
- case "crowfoot_many":
12605
- case "crowfoot_one_or_many":
12606
12785
  default: {
12607
- const [x2, y2, x3, y3, x4, y4] = arrowheadPoints;
12608
- if (element.strokeStyle === "dotted") {
12609
- const dash = getDashArrayDotted(element.strokeWidth - 1);
12610
- options.strokeLineDash = [dash[0], dash[1] - 1];
12611
- } else {
12612
- delete options.strokeLineDash;
12613
- }
12614
- options.roughness = Math.min(1, options.roughness || 0);
12615
- return [
12616
- generator.line(x3, y3, x2, y2, options),
12617
- generator.line(x4, y4, x2, y2, options),
12618
- ...arrowhead === "crowfoot_one_or_many" ? generateCrowfootOne(
12619
- getArrowheadPoints(element, shape, position, "crowfoot_one"),
12620
- options
12621
- ) : []
12622
- ];
12786
+ return generateArrowheadLinesToTip(
12787
+ generator,
12788
+ getArrowheadPoints(element, shape, position, arrowhead),
12789
+ getArrowheadLineOptions(element, options)
12790
+ );
12623
12791
  }
12624
12792
  }
12625
12793
  };
@@ -13557,6 +13725,8 @@ var getFreeDrawElementAbsoluteCoords = (element) => {
13557
13725
  const y2 = maxY + element.y;
13558
13726
  return [x1, y1, x2, y2, (x1 + x2) / 2, (y1 + y2) / 2];
13559
13727
  };
13728
+ var CARDINALITY_MARKER_SIZE = 20;
13729
+ var CROWFOOT_ARROWHEAD_SIZE = 15;
13560
13730
  var getArrowheadSize = (arrowhead) => {
13561
13731
  switch (arrowhead) {
13562
13732
  case "arrow":
@@ -13564,10 +13734,14 @@ var getArrowheadSize = (arrowhead) => {
13564
13734
  case "diamond":
13565
13735
  case "diamond_outline":
13566
13736
  return 12;
13567
- case "crowfoot_many":
13568
- case "crowfoot_one":
13569
- case "crowfoot_one_or_many":
13570
- return 20;
13737
+ case "cardinality_many":
13738
+ case "cardinality_one_or_many":
13739
+ case "cardinality_zero_or_many":
13740
+ return CROWFOOT_ARROWHEAD_SIZE;
13741
+ case "cardinality_one":
13742
+ case "cardinality_exactly_one":
13743
+ case "cardinality_zero_or_one":
13744
+ return CARDINALITY_MARKER_SIZE;
13571
13745
  default:
13572
13746
  return 15;
13573
13747
  }
@@ -13582,7 +13756,10 @@ var getArrowheadAngle = (arrowhead) => {
13582
13756
  return 25;
13583
13757
  }
13584
13758
  };
13585
- var getArrowheadPoints = (element, shape, position, arrowhead) => {
13759
+ var getArrowheadPoints = (element, shape, position, arrowhead, offsetMultiplier = 0) => {
13760
+ if (arrowhead === null) {
13761
+ return null;
13762
+ }
13586
13763
  if (shape.length < 1) {
13587
13764
  return null;
13588
13765
  }
@@ -13620,21 +13797,23 @@ var getArrowheadPoints = (element, shape, position, arrowhead) => {
13620
13797
  }
13621
13798
  const lengthMultiplier = arrowhead === "diamond" || arrowhead === "diamond_outline" ? 0.25 : 0.5;
13622
13799
  const minSize = Math.min(size, length * lengthMultiplier);
13623
- const xs = x2 - nx * minSize;
13624
- const ys = y2 - ny * minSize;
13625
- if (arrowhead === "dot" || arrowhead === "circle" || arrowhead === "circle_outline") {
13626
- const diameter = Math.hypot(ys - y2, xs - x2) + element.strokeWidth - 2;
13627
- return [x2, y2, diameter];
13800
+ const tx = x2 - nx * minSize * offsetMultiplier;
13801
+ const ty = y2 - ny * minSize * offsetMultiplier;
13802
+ const xs = tx - nx * minSize;
13803
+ const ys = ty - ny * minSize;
13804
+ if (arrowhead === "circle" || arrowhead === "circle_outline") {
13805
+ const diameter = Math.hypot(ys - ty, xs - tx) + element.strokeWidth - 2;
13806
+ return [tx, ty, diameter];
13628
13807
  }
13629
13808
  const angle = getArrowheadAngle(arrowhead);
13630
- if (arrowhead === "crowfoot_many" || arrowhead === "crowfoot_one_or_many") {
13809
+ if (arrowhead === "cardinality_many" || arrowhead === "cardinality_one_or_many") {
13631
13810
  const [x32, y32] = pointRotateRads13(
13632
- pointFrom14(x2, y2),
13811
+ pointFrom14(tx, ty),
13633
13812
  pointFrom14(xs, ys),
13634
13813
  degreesToRadians(-angle)
13635
13814
  );
13636
13815
  const [x42, y42] = pointRotateRads13(
13637
- pointFrom14(x2, y2),
13816
+ pointFrom14(tx, ty),
13638
13817
  pointFrom14(xs, ys),
13639
13818
  degreesToRadians(angle)
13640
13819
  );
@@ -13642,12 +13821,12 @@ var getArrowheadPoints = (element, shape, position, arrowhead) => {
13642
13821
  }
13643
13822
  const [x3, y3] = pointRotateRads13(
13644
13823
  pointFrom14(xs, ys),
13645
- pointFrom14(x2, y2),
13824
+ pointFrom14(tx, ty),
13646
13825
  -angle * Math.PI / 180
13647
13826
  );
13648
13827
  const [x4, y4] = pointRotateRads13(
13649
13828
  pointFrom14(xs, ys),
13650
- pointFrom14(x2, y2),
13829
+ pointFrom14(tx, ty),
13651
13830
  degreesToRadians(angle)
13652
13831
  );
13653
13832
  if (arrowhead === "diamond" || arrowhead === "diamond_outline") {
@@ -13656,21 +13835,21 @@ var getArrowheadPoints = (element, shape, position, arrowhead) => {
13656
13835
  if (position === "start") {
13657
13836
  const [px, py] = element.points.length > 1 ? element.points[1] : [0, 0];
13658
13837
  [ox, oy] = pointRotateRads13(
13659
- pointFrom14(x2 + minSize * 2, y2),
13660
- pointFrom14(x2, y2),
13661
- Math.atan2(py - y2, px - x2)
13838
+ pointFrom14(tx + minSize * 2, ty),
13839
+ pointFrom14(tx, ty),
13840
+ Math.atan2(py - ty, px - tx)
13662
13841
  );
13663
13842
  } else {
13664
13843
  const [px, py] = element.points.length > 1 ? element.points[element.points.length - 2] : [0, 0];
13665
13844
  [ox, oy] = pointRotateRads13(
13666
- pointFrom14(x2 - minSize * 2, y2),
13667
- pointFrom14(x2, y2),
13668
- Math.atan2(y2 - py, x2 - px)
13845
+ pointFrom14(tx - minSize * 2, ty),
13846
+ pointFrom14(tx, ty),
13847
+ Math.atan2(ty - py, tx - px)
13669
13848
  );
13670
13849
  }
13671
- return [x2, y2, x3, y3, ox, oy, x4, y4];
13850
+ return [tx, ty, x3, y3, ox, oy, x4, y4];
13672
13851
  }
13673
- return [x2, y2, x3, y3, x4, y4];
13852
+ return [tx, ty, x3, y3, x4, y4];
13674
13853
  };
13675
13854
  var generateLinearElementShape = (element) => {
13676
13855
  const generator = rough_default.generator();
@@ -18252,19 +18431,19 @@ var embeddableURLValidator = (url, validateEmbeddable) => {
18252
18431
 
18253
18432
  // src/flowchart.ts
18254
18433
  init_define_import_meta_env();
18255
- import { KEYS as KEYS3, invariant as invariant11, toBrandedType as toBrandedType2 } from "@excalidraw/common";
18434
+ import { KEYS as KEYS2, invariant as invariant11, toBrandedType as toBrandedType2 } from "@excalidraw/common";
18256
18435
  import { pointFrom as pointFrom15 } from "@excalidraw/math";
18257
18436
  var VERTICAL_OFFSET = 100;
18258
18437
  var HORIZONTAL_OFFSET = 100;
18259
18438
  var getLinkDirectionFromKey = (key) => {
18260
18439
  switch (key) {
18261
- case KEYS3.ARROW_UP:
18440
+ case KEYS2.ARROW_UP:
18262
18441
  return "up";
18263
- case KEYS3.ARROW_DOWN:
18442
+ case KEYS2.ARROW_DOWN:
18264
18443
  return "down";
18265
- case KEYS3.ARROW_RIGHT:
18444
+ case KEYS2.ARROW_RIGHT:
18266
18445
  return "right";
18267
- case KEYS3.ARROW_LEFT:
18446
+ case KEYS2.ARROW_LEFT:
18268
18447
  return "left";
18269
18448
  default:
18270
18449
  return "right";
@@ -21559,6 +21738,33 @@ var maybeHandleArrowPointlikeDrag = ({
21559
21738
  return false;
21560
21739
  };
21561
21740
 
21741
+ // src/arrowheads.ts
21742
+ init_define_import_meta_env();
21743
+ var normalizeArrowhead = (arrowhead) => {
21744
+ switch (arrowhead) {
21745
+ case void 0:
21746
+ case null:
21747
+ return null;
21748
+ case "dot":
21749
+ return "circle";
21750
+ case "crowfoot_one":
21751
+ return "cardinality_one";
21752
+ case "crowfoot_many":
21753
+ return "cardinality_many";
21754
+ case "crowfoot_one_or_many":
21755
+ return "cardinality_one_or_many";
21756
+ default:
21757
+ return arrowhead;
21758
+ }
21759
+ };
21760
+ var getArrowheadForPicker = (arrowhead) => {
21761
+ const normalizedArrowhead = normalizeArrowhead(arrowhead);
21762
+ if (normalizedArrowhead === null) {
21763
+ return null;
21764
+ }
21765
+ return normalizedArrowhead;
21766
+ };
21767
+
21562
21768
  // src/index.ts
21563
21769
  var getSceneVersion = (elements) => elements.reduce((acc, el) => acc + el.version, 0);
21564
21770
  var hashElementsVersion = (elements) => {
@@ -21680,6 +21886,7 @@ export {
21680
21886
  getApproxMinLineWidth,
21681
21887
  getArrowLocalFixedPoints,
21682
21888
  getArrowheadAngle,
21889
+ getArrowheadForPicker,
21683
21890
  getArrowheadPoints,
21684
21891
  getArrowheadSize,
21685
21892
  getBindingGap,
@@ -21887,6 +22094,7 @@ export {
21887
22094
  newLinearElement,
21888
22095
  newMagicFrameElement,
21889
22096
  newTextElement,
22097
+ normalizeArrowhead,
21890
22098
  normalizeElementOrder,
21891
22099
  normalizeFixedPoint,
21892
22100
  normalizeSVG,
@@ -21920,7 +22128,6 @@ export {
21920
22128
  setCustomTextMetricsProvider,
21921
22129
  shouldAllowVerticalAlign,
21922
22130
  shouldApplyFrameClip,
21923
- shouldEnableBindingForPointerEvent,
21924
22131
  shouldTestInside,
21925
22132
  showSelectedShapeActions,
21926
22133
  snapToMid,