@excalidraw/common 0.18.0-063e025 → 0.18.0-1acf66e

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 (94) hide show
  1. package/dist/dev/index.js +9 -5
  2. package/dist/dev/index.js.map +2 -2
  3. package/dist/prod/index.js +3 -3
  4. package/dist/types/common/src/constants.d.ts +2 -0
  5. package/dist/types/common/src/points.d.ts +1 -1
  6. package/dist/types/common/src/utils.d.ts +1 -1
  7. package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
  8. package/dist/types/element/src/arrows/focus.d.ts +5 -2
  9. package/dist/types/element/src/binding.d.ts +12 -3
  10. package/dist/types/element/src/comparisons.d.ts +4 -4
  11. package/dist/types/element/src/convertToShape.d.ts +23 -0
  12. package/dist/types/element/src/dragElements.d.ts +27 -0
  13. package/dist/types/element/src/flowchart.d.ts +6 -6
  14. package/dist/types/element/src/groups.d.ts +1 -1
  15. package/dist/types/element/src/index.d.ts +2 -0
  16. package/dist/types/element/src/linearElementEditor.d.ts +7 -0
  17. package/dist/types/element/src/newElement.d.ts +13 -0
  18. package/dist/types/element/src/selection.d.ts +1 -1
  19. package/dist/types/element/src/textElement.d.ts +6 -3
  20. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +15 -3
  21. package/dist/types/excalidraw/actions/actionBoundText.d.ts +10 -2
  22. package/dist/types/excalidraw/actions/actionCanvas.d.ts +99 -565
  23. package/dist/types/excalidraw/actions/actionClipboard.d.ts +10 -2
  24. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +5 -1
  25. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +16 -3
  26. package/dist/types/excalidraw/actions/actionDeselect.d.ts +2 -1
  27. package/dist/types/excalidraw/actions/actionElementLink.d.ts +5 -1
  28. package/dist/types/excalidraw/actions/actionElementLock.d.ts +10 -2
  29. package/dist/types/excalidraw/actions/actionExport.d.ts +15 -7
  30. package/dist/types/excalidraw/actions/actionFrame.d.ts +15 -178
  31. package/dist/types/excalidraw/actions/actionGroup.d.ts +10 -2
  32. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +6 -1
  33. package/dist/types/excalidraw/actions/actionLink.d.ts +5 -1
  34. package/dist/types/excalidraw/actions/actionMenu.d.ts +5 -1
  35. package/dist/types/excalidraw/actions/actionProperties.d.ts +10 -2
  36. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +5 -1
  37. package/dist/types/excalidraw/actions/actionStyles.d.ts +5 -1
  38. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
  39. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +5 -1
  40. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +5 -1
  41. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +5 -1
  42. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +5 -1
  43. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +5 -1
  44. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +5 -1
  45. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +6 -2
  46. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +5 -1
  47. package/dist/types/excalidraw/actions/index.d.ts +0 -1
  48. package/dist/types/excalidraw/actions/manager.d.ts +1 -0
  49. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  50. package/dist/types/excalidraw/actions/types.d.ts +5 -1
  51. package/dist/types/excalidraw/appState.d.ts +5 -5
  52. package/dist/types/excalidraw/components/Actions.d.ts +16 -10
  53. package/dist/types/excalidraw/components/App.arrowText.d.ts +72 -0
  54. package/dist/types/excalidraw/components/App.cursor.d.ts +31 -0
  55. package/dist/types/excalidraw/components/App.d.ts +322 -76
  56. package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
  57. package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
  58. package/dist/types/excalidraw/components/App.viewport.d.ts +73 -0
  59. package/dist/types/excalidraw/components/{ToolButton.d.ts → IconButton.d.ts} +16 -19
  60. package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
  61. package/dist/types/excalidraw/components/LayerUI.d.ts +4 -2
  62. package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
  63. package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
  64. package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
  65. package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
  66. package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
  67. package/dist/types/excalidraw/components/Popover.d.ts +1 -3
  68. package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
  69. package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
  70. package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
  71. package/dist/types/excalidraw/components/Tools.d.ts +145 -0
  72. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -0
  73. package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
  74. package/dist/types/excalidraw/components/icons.d.ts +1 -1
  75. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +1 -1
  76. package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
  77. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
  78. package/dist/types/excalidraw/data/blob.d.ts +20 -12
  79. package/dist/types/excalidraw/data/json.d.ts +10 -6
  80. package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
  81. package/dist/types/excalidraw/scene/types.d.ts +3 -0
  82. package/dist/types/excalidraw/types.d.ts +199 -13
  83. package/dist/types/excalidraw/viewport.d.ts +20 -64
  84. package/dist/types/laser-pointer/src/state.d.ts +1 -0
  85. package/dist/types/math/src/index.d.ts +1 -0
  86. package/dist/types/math/src/pca.d.ts +79 -0
  87. package/dist/types/math/src/polygon.d.ts +25 -1
  88. package/package.json +1 -1
  89. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -173
  90. package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
  91. package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -10
  92. package/dist/types/excalidraw/components/shapes.d.ts +0 -270
  93. package/dist/types/excalidraw/cursor.d.ts +0 -5
  94. package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
@@ -69,6 +69,10 @@ export declare const actionDecreaseFontSize: {
69
69
  element: NonDeleted<ExcalidrawBindableElement>;
70
70
  midPoint?: import("@excalidraw/math").GlobalPoint;
71
71
  } | null;
72
+ hoveredArrowTextAnchor: {
73
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
74
+ anchor: "start" | "end" | "label";
75
+ } | null;
72
76
  frameToHighlight: NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
73
77
  frameRendering: {
74
78
  enabled: boolean;
@@ -76,7 +80,7 @@ export declare const actionDecreaseFontSize: {
76
80
  outline: boolean;
77
81
  clip: boolean;
78
82
  };
79
- editingFrame: string | null;
83
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
80
84
  elementsToHighlight: readonly NonDeletedExcalidrawElement[] | null;
81
85
  editingTextElement: ExcalidrawTextElement | null;
82
86
  activeTool: {
@@ -241,6 +245,10 @@ export declare const actionIncreaseFontSize: {
241
245
  element: NonDeleted<ExcalidrawBindableElement>;
242
246
  midPoint?: import("@excalidraw/math").GlobalPoint;
243
247
  } | null;
248
+ hoveredArrowTextAnchor: {
249
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
250
+ anchor: "start" | "end" | "label";
251
+ } | null;
244
252
  frameToHighlight: NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
245
253
  frameRendering: {
246
254
  enabled: boolean;
@@ -248,7 +256,7 @@ export declare const actionIncreaseFontSize: {
248
256
  outline: boolean;
249
257
  clip: boolean;
250
258
  };
251
- editingFrame: string | null;
259
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
252
260
  elementsToHighlight: readonly NonDeletedExcalidrawElement[] | null;
253
261
  editingTextElement: ExcalidrawTextElement | null;
254
262
  activeTool: {
@@ -38,6 +38,10 @@ export declare const actionSelectAll: {
38
38
  element: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
39
39
  midPoint?: import("@excalidraw/math").GlobalPoint;
40
40
  } | null;
41
+ hoveredArrowTextAnchor: {
42
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
43
+ anchor: "start" | "end" | "label";
44
+ } | null;
41
45
  frameToHighlight: NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
42
46
  frameRendering: {
43
47
  enabled: boolean;
@@ -45,7 +49,7 @@ export declare const actionSelectAll: {
45
49
  outline: boolean;
46
50
  clip: boolean;
47
51
  };
48
- editingFrame: string | null;
52
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
49
53
  elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
50
54
  editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
51
55
  activeTool: {
@@ -36,6 +36,10 @@ export declare const actionCopyStyles: {
36
36
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
37
37
  midPoint?: import("@excalidraw/math").GlobalPoint;
38
38
  } | null;
39
+ hoveredArrowTextAnchor: {
40
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
41
+ anchor: "start" | "end" | "label";
42
+ } | null;
39
43
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
40
44
  frameRendering: {
41
45
  enabled: boolean;
@@ -43,7 +47,7 @@ export declare const actionCopyStyles: {
43
47
  outline: boolean;
44
48
  clip: boolean;
45
49
  };
46
- editingFrame: string | null;
50
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
47
51
  elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
48
52
  editingTextElement: ExcalidrawTextElement | null;
49
53
  activeTool: {
@@ -7,7 +7,7 @@ export declare const actionTextAutoResize: {
7
7
  category: "element";
8
8
  };
9
9
  predicate: (elements: readonly ExcalidrawElement[], appState: import("../types").AppState, _: unknown) => boolean;
10
- perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>, targetElement: unknown) => {
10
+ perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>, targetElement: unknown, app: import("../types").AppClassProperties) => false | {
11
11
  appState: Readonly<import("../types").AppState>;
12
12
  elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
13
13
  captureUpdate: "IMMEDIATELY";
@@ -32,6 +32,10 @@ export declare const actionToggleArrowBinding: {
32
32
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
33
33
  midPoint?: import("@excalidraw/math").GlobalPoint;
34
34
  } | null;
35
+ hoveredArrowTextAnchor: {
36
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
37
+ anchor: "start" | "end" | "label";
38
+ } | null;
35
39
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
36
40
  frameRendering: {
37
41
  enabled: boolean;
@@ -39,7 +43,7 @@ export declare const actionToggleArrowBinding: {
39
43
  outline: boolean;
40
44
  clip: boolean;
41
45
  };
42
- editingFrame: string | null;
46
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
43
47
  elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
44
48
  editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
45
49
  activeTool: {
@@ -36,6 +36,10 @@ export declare const actionToggleGridMode: {
36
36
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
37
37
  midPoint?: import("@excalidraw/math").GlobalPoint;
38
38
  } | null;
39
+ hoveredArrowTextAnchor: {
40
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
41
+ anchor: "start" | "end" | "label";
42
+ } | null;
39
43
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
40
44
  frameRendering: {
41
45
  enabled: boolean;
@@ -43,7 +47,7 @@ export declare const actionToggleGridMode: {
43
47
  outline: boolean;
44
48
  clip: boolean;
45
49
  };
46
- editingFrame: string | null;
50
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
47
51
  elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
48
52
  editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
49
53
  activeTool: {
@@ -32,6 +32,10 @@ export declare const actionToggleMidpointSnapping: {
32
32
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
33
33
  midPoint?: import("@excalidraw/math").GlobalPoint;
34
34
  } | null;
35
+ hoveredArrowTextAnchor: {
36
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
37
+ anchor: "start" | "end" | "label";
38
+ } | null;
35
39
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
36
40
  frameRendering: {
37
41
  enabled: boolean;
@@ -39,7 +43,7 @@ export declare const actionToggleMidpointSnapping: {
39
43
  outline: boolean;
40
44
  clip: boolean;
41
45
  };
42
- editingFrame: string | null;
46
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
43
47
  elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
44
48
  editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
45
49
  activeTool: {
@@ -35,6 +35,10 @@ export declare const actionToggleObjectsSnapMode: {
35
35
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
36
36
  midPoint?: import("@excalidraw/math").GlobalPoint;
37
37
  } | null;
38
+ hoveredArrowTextAnchor: {
39
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
40
+ anchor: "start" | "end" | "label";
41
+ } | null;
38
42
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
39
43
  frameRendering: {
40
44
  enabled: boolean;
@@ -42,7 +46,7 @@ export declare const actionToggleObjectsSnapMode: {
42
46
  outline: boolean;
43
47
  clip: boolean;
44
48
  };
45
- editingFrame: string | null;
49
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
46
50
  elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
47
51
  editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
48
52
  activeTool: {
@@ -40,6 +40,10 @@ export declare const actionToggleSearchMenu: {
40
40
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
41
41
  midPoint?: import("@excalidraw/math").GlobalPoint;
42
42
  } | null;
43
+ hoveredArrowTextAnchor: {
44
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
45
+ anchor: "start" | "end" | "label";
46
+ } | null;
43
47
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
44
48
  frameRendering: {
45
49
  enabled: boolean;
@@ -47,7 +51,7 @@ export declare const actionToggleSearchMenu: {
47
51
  outline: boolean;
48
52
  clip: boolean;
49
53
  };
50
- editingFrame: string | null;
54
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
51
55
  elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
52
56
  editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
53
57
  activeTool: {
@@ -37,6 +37,10 @@ export declare const actionToggleStats: {
37
37
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
38
38
  midPoint?: import("@excalidraw/math").GlobalPoint;
39
39
  } | null;
40
+ hoveredArrowTextAnchor: {
41
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
42
+ anchor: "start" | "end" | "label";
43
+ } | null;
40
44
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
41
45
  frameRendering: {
42
46
  enabled: boolean;
@@ -44,7 +48,7 @@ export declare const actionToggleStats: {
44
48
  outline: boolean;
45
49
  clip: boolean;
46
50
  };
47
- editingFrame: string | null;
51
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
48
52
  elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
49
53
  editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
50
54
  activeTool: {
@@ -34,6 +34,10 @@ export declare const actionToggleViewMode: {
34
34
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
35
35
  midPoint?: import("@excalidraw/math").GlobalPoint;
36
36
  } | null;
37
+ hoveredArrowTextAnchor: {
38
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
39
+ anchor: "start" | "end" | "label";
40
+ } | null;
37
41
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
38
42
  frameRendering: {
39
43
  enabled: boolean;
@@ -41,7 +45,7 @@ export declare const actionToggleViewMode: {
41
45
  outline: boolean;
42
46
  clip: boolean;
43
47
  };
44
- editingFrame: string | null;
48
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
45
49
  elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
46
50
  editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
47
51
  activeTool: {
@@ -170,7 +174,7 @@ export declare const actionToggleViewMode: {
170
174
  captureUpdate: "EVENTUALLY";
171
175
  };
172
176
  checked: (appState: Readonly<import("../types").UIAppState>) => boolean;
173
- predicate: (elements: readonly import("@excalidraw/element/types").ExcalidrawElement[], appState: import("../types").AppState, appProps: import("../types").ExcalidrawProps) => boolean;
177
+ predicate: (elements: readonly import("@excalidraw/element/types").ExcalidrawElement[], appState: import("../types").AppState, appProps: import("../types").ExcalidrawProps, app: import("../types").AppClassProperties) => boolean;
174
178
  keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
175
179
  } & {
176
180
  keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
@@ -34,6 +34,10 @@ export declare const actionToggleZenMode: {
34
34
  element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
35
35
  midPoint?: import("@excalidraw/math").GlobalPoint;
36
36
  } | null;
37
+ hoveredArrowTextAnchor: {
38
+ elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
39
+ anchor: "start" | "end" | "label";
40
+ } | null;
37
41
  frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
38
42
  frameRendering: {
39
43
  enabled: boolean;
@@ -41,7 +45,7 @@ export declare const actionToggleZenMode: {
41
45
  outline: boolean;
42
46
  clip: boolean;
43
47
  };
44
- editingFrame: string | null;
48
+ editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
45
49
  elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
46
50
  editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
47
51
  activeTool: {
@@ -4,7 +4,6 @@ export { actionSelectAll } from "./actionSelectAll";
4
4
  export { actionDuplicateSelection } from "./actionDuplicateSelection";
5
5
  export { actionChangeStrokeColor, actionChangeBackgroundColor, actionChangeStrokeWidth, actionChangeFillStyle, actionChangeSloppiness, actionChangeFreedrawMode, actionChangeOpacity, actionChangeFontSize, actionChangeFontFamily, actionChangeTextAlign, actionChangeVerticalAlign, actionChangeArrowProperties, } from "./actionProperties";
6
6
  export { actionChangeViewBackgroundColor, actionClearCanvas, actionZoomIn, actionZoomOut, actionResetZoom, actionZoomToFit, actionToggleTheme, } from "./actionCanvas";
7
- export { actionSetEmbeddableAsActiveTool } from "./actionEmbeddable";
8
7
  export { actionFinalize } from "./actionFinalize";
9
8
  export { actionDeselect } from "./actionDeselect";
10
9
  export { actionChangeProjectName, actionChangeExportBackground, actionSaveToActiveFile, actionSaveFileToDisk, actionLoadScene, } from "./actionExport";
@@ -11,6 +11,7 @@ export declare class ActionManager {
11
11
  constructor(updater: UpdaterFn, getAppState: () => AppState, getElementsIncludingDeleted: () => readonly OrderedExcalidrawElement[], app: AppClassProperties);
12
12
  registerAction(action: Action): void;
13
13
  registerAll(actions: readonly Action[]): void;
14
+ private isActionBlockedByViewportTransition;
14
15
  handleKeyDown(event: React.KeyboardEvent | KeyboardEvent): boolean;
15
16
  executeAction<T extends Action>(action: T, source?: ActionSource, value?: Parameters<T["perform"]>[2]): void;
16
17
  /**
@@ -1,4 +1,4 @@
1
1
  import type { SubtypeOf } from "@excalidraw/common/utility-types";
2
2
  import type { ActionName } from "./types";
3
- export type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "clearCanvas" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "group" | "ungroup" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleElementLock" | "resetZoom" | "zoomOut" | "zoomIn" | "zoomToFit" | "zoomToFitSelectionInViewport" | "zoomToFitSelection" | "toggleEraserTool" | "toggleHandTool" | "setFrameAsActiveTool" | "saveFileToDisk" | "saveToActiveFile" | "toggleShortcuts" | "wrapSelectionInFrame"> | "saveScene" | "imageExport" | "commandPalette" | "searchMenu" | "toolLock";
3
+ export type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "clearCanvas" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "group" | "ungroup" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleElementLock" | "resetZoom" | "zoomOut" | "zoomIn" | "zoomToFit" | "zoomToFitSelectionInViewport" | "zoomToFitSelection" | "saveFileToDisk" | "saveToActiveFile" | "toggleShortcuts" | "wrapSelectionInFrame"> | "saveScene" | "imageExport" | "commandPalette" | "searchMenu" | "toolLock";
4
4
  export declare const getShortcutFromShortcutName: (name: ShortcutName, idx?: number) => string;
@@ -14,7 +14,7 @@ export type ActionResult = {
14
14
  type ActionFn<TData = any> = (elements: readonly OrderedExcalidrawElement[], appState: Readonly<AppState>, formData: TData | undefined, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
15
15
  export type UpdaterFn = (res: ActionResult) => void;
16
16
  export type ActionFilterFn = (action: Action) => void;
17
- export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "arrowBinding" | "midpointSnapping" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeFreedrawMode" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeArrowProperties" | "changeOpacity" | "changeFontSize" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "deselect" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "createContainerFromText" | "wrapTextInContainer" | "commandPalette" | "autoResize" | "elementStats" | "searchMenu" | "copyElementLink" | "linkToElement" | "cropEditor" | "wrapSelectionInFrame" | "toggleLassoTool" | "toggleShapeSwitch" | "togglePolygon";
17
+ export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "arrowBinding" | "midpointSnapping" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeSloppiness" | "changeFreedrawMode" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeArrowProperties" | "changeOpacity" | "changeFontSize" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "deselect" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "createContainerFromText" | "wrapTextInContainer" | "commandPalette" | "autoResize" | "elementStats" | "searchMenu" | "copyElementLink" | "linkToElement" | "cropEditor" | "wrapSelectionInFrame" | "toggleShapeSwitch" | "togglePolygon";
18
18
  export type PanelComponentProps = {
19
19
  elements: readonly ExcalidrawElement[];
20
20
  appState: UIAppState;
@@ -43,5 +43,9 @@ export interface Action<TData = any> {
43
43
  /** if set to `true`, allow action to be performed in viewMode.
44
44
  * Defaults to `false` */
45
45
  viewMode?: boolean;
46
+ /** if set to `true`, the action counts as canvas navigation and remains
47
+ * available in the non-interactive editor when
48
+ * `interaction: { enabled: { navigation: true } }`. Defaults to `false` */
49
+ navigation?: boolean;
46
50
  }
47
51
  export {};
@@ -1,6 +1,11 @@
1
1
  import type { AppState, NormalizedZoomValue } from "./types";
2
2
  export declare const getDefaultAppState: () => Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
3
3
  export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>) => {
4
+ activeTool?: ({
5
+ lastActiveTool: import("./types").ActiveTool | null;
6
+ locked: boolean;
7
+ fromSelection: boolean;
8
+ } & import("./types").ActiveTool) | undefined;
4
9
  zenModeEnabled?: boolean | undefined;
5
10
  gridModeEnabled?: boolean | undefined;
6
11
  objectsSnapModeEnabled?: boolean | undefined;
@@ -8,11 +13,6 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
8
13
  name?: string | null | undefined;
9
14
  currentItemArrowType?: "round" | "sharp" | "elbow" | undefined;
10
15
  gridSize?: number | undefined;
11
- activeTool?: ({
12
- lastActiveTool: import("./types").ActiveTool | null;
13
- locked: boolean;
14
- fromSelection: boolean;
15
- } & import("./types").ActiveTool) | undefined;
16
16
  showWelcomeScreen?: boolean | undefined;
17
17
  isBindingEnabled?: boolean | undefined;
18
18
  boxSelectionMode?: import("./types").BoxSelectionMode | undefined;
@@ -1,15 +1,22 @@
1
- import type { ExcalidrawElement, NonDeletedElementsMap, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
1
+ import type { NonDeletedElementsMap, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
2
2
  import "./Actions.scss";
3
- import type { AppClassProperties, AppProps, UIAppState, AppState } from "../types";
3
+ import type { AppClassProperties, UIAppState, AppState } from "../types";
4
4
  import type { ActionManager } from "../actions/manager";
5
- export declare const canChangeStrokeColor: (appState: UIAppState, targetElements: ExcalidrawElement[]) => boolean;
6
- export declare const canChangeBackgroundColor: (appState: UIAppState, targetElements: ExcalidrawElement[]) => boolean;
5
+ export { canChangeStrokeColor, canChangeBackgroundColor, } from "./shapeActionPredicates";
6
+ /**
7
+ * Full styles panel: the wide, always-expanded layout used on desktop when the
8
+ * UI is in "full" mode.
9
+ */
7
10
  export declare const SelectedShapeActions: ({ appState, elementsMap, renderAction, app, }: {
8
11
  appState: UIAppState;
9
12
  elementsMap: NonDeletedElementsMap | NonDeletedSceneElementsMap;
10
13
  renderAction: ActionManager["renderAction"];
11
14
  app: AppClassProperties;
12
15
  }) => import("react/jsx-runtime").JSX.Element;
16
+ /**
17
+ * Compact styles panel — the collapsed, popover-driven layout used on tablets
18
+ * and on desktop when the UI is in "compact" mode.
19
+ */
13
20
  export declare const CompactShapeActions: ({ appState, elementsMap, renderAction, app, setAppState, }: {
14
21
  appState: UIAppState;
15
22
  elementsMap: NonDeletedElementsMap | NonDeletedSceneElementsMap;
@@ -17,6 +24,11 @@ export declare const CompactShapeActions: ({ appState, elementsMap, renderAction
17
24
  app: AppClassProperties;
18
25
  setAppState: React.Component<any, AppState>["setState"];
19
26
  }) => import("react/jsx-runtime").JSX.Element;
27
+ /**
28
+ * Mobile styles panel — the horizontal action bar used on phones, with an
29
+ * overflow measurement that promotes duplicate/delete out of the popover when
30
+ * there is room.
31
+ */
20
32
  export declare const MobileShapeActions: ({ appState, elementsMap, renderAction, app, setAppState, }: {
21
33
  appState: UIAppState;
22
34
  elementsMap: NonDeletedElementsMap | NonDeletedSceneElementsMap;
@@ -24,12 +36,6 @@ export declare const MobileShapeActions: ({ appState, elementsMap, renderAction,
24
36
  app: AppClassProperties;
25
37
  setAppState: React.Component<any, AppState>["setState"];
26
38
  }) => import("react/jsx-runtime").JSX.Element;
27
- export declare const ShapesSwitcher: ({ activeTool, setAppState, app, UIOptions, }: {
28
- activeTool: UIAppState["activeTool"];
29
- setAppState: React.Component<any, AppState>["setState"];
30
- app: AppClassProperties;
31
- UIOptions: AppProps["UIOptions"];
32
- }) => import("react/jsx-runtime").JSX.Element;
33
39
  export declare const ZoomActions: ({ renderAction, }: {
34
40
  renderAction: ActionManager["renderAction"];
35
41
  }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,72 @@
1
+ import type { ArrowEndpoint } from "@excalidraw/element";
2
+ import type { ExcalidrawElement, ExcalidrawTextElement, FixedPoint, NonDeleted } from "@excalidraw/element/types";
3
+ import type App from "./App";
4
+ import type { AppState } from "../types";
5
+ /**
6
+ * The text tool's interaction with arrows: the hover affordance showing where
7
+ * a click would attach text to an arrow — a free endpoint (binds the arrow to
8
+ * a new text element positioned against that endpoint) or the arrow's midpoint
9
+ * (adds a label bound to the arrow) — and the endpoint-bound flavor of
10
+ * drag-sizing a new text.
11
+ *
12
+ * The scene-level logic lives in `@excalidraw/element`'s `arrowEndpointText.ts`.
13
+ */
14
+ export declare class AppArrowText {
15
+ private app;
16
+ constructor(app: App);
17
+ /**
18
+ * With the text tool active, an arrow under the cursor is a target for
19
+ * attaching text. Returns where the text would land (if anywhere), and keeps
20
+ * `appState.hoveredArrowTextAnchor` — which drives the highlight — in sync.
21
+ */
22
+ updateHoveredAnchor: (scenePointer: {
23
+ x: number;
24
+ y: number;
25
+ }) => AppState["hoveredArrowTextAnchor"];
26
+ /**
27
+ * Re-evaluates the hovered anchor at the last known pointer position — for
28
+ * events that change what a click would do without the pointer moving,
29
+ * i.e. the ctrl/cmd binding toggle. (Events that invalidate the anchor
30
+ * wholesale — tool switches, finalize, deselect — clear it directly
31
+ * instead.)
32
+ */
33
+ refresh: () => void;
34
+ /**
35
+ * A free arrow endpoint a new text could be bound to. Binding an endpoint is
36
+ * an arrow binding, so it follows the binding toggle (ctrl/cmd) like every
37
+ * other one — holding it makes the text tool drop plain text instead.
38
+ */
39
+ getBindableEndpointAtPosition(x: number, y: number): ArrowEndpoint | null;
40
+ /**
41
+ * Mirrors what `handleTextOnPointerDown` would do at this position, so the
42
+ * highlight can't promise something the click won't deliver.
43
+ */
44
+ private getAnchorAtPosition;
45
+ /**
46
+ * How a text should be created to read as a label for this endpoint — the
47
+ * side midpoint to bind, the alignment that pins it, and the scene position
48
+ * it must sit at. `targetStrokeWidth` is the caller's to provide so it can
49
+ * guarantee it matches the stroke width the text is then created with — the
50
+ * binding gap derives from it (see `getTextBindingForArrowEndpoint`).
51
+ */
52
+ getTextBinding({ arrow, startOrEnd }: ArrowEndpoint, targetStrokeWidth: number): {
53
+ fixedPoint: FixedPoint;
54
+ textAlign: import("@excalidraw/element/types").TextAlign;
55
+ verticalAlign: import("@excalidraw/element/types").VerticalAlign;
56
+ anchor: import("@excalidraw/math").GlobalPoint;
57
+ } | null;
58
+ /**
59
+ * Binds the arrow endpoint to the created text, at the side midpoint the
60
+ * placement resolved (`getTextBinding`'s `fixedPoint`).
61
+ */
62
+ bindText({ arrow, startOrEnd }: ArrowEndpoint, text: NonDeleted<ExcalidrawTextElement>, fixedPoint: FixedPoint): void;
63
+ /**
64
+ * A text bound to an arrow endpoint can't be positioned by the drag — the
65
+ * binding already placed it — so only its width is dragged out. Returns
66
+ * whether it owned the drag.
67
+ */
68
+ maybeDragNewText(newElement: ExcalidrawElement, pointerCoords: {
69
+ x: number;
70
+ y: number;
71
+ }): boolean;
72
+ }
@@ -0,0 +1,31 @@
1
+ import type App from "./App";
2
+ import type { AppState } from "../types";
3
+ /**
4
+ * Captures all cursor management for the interactive canvas.
5
+ *
6
+ * The canvas cursor is set exclusively imperatively, through this class —
7
+ * never via inline styles or React-rendered `style.cursor`, which React
8
+ * would rewrite on rerender whenever the computed value changes, clobbering
9
+ * cursors set here.
10
+ */
11
+ export declare class AppCursor {
12
+ private app;
13
+ private eraserCanvasCache;
14
+ private eraserPreviewDataURL;
15
+ private drawShapeCanvasCache;
16
+ private drawShapePreviewDataURL;
17
+ constructor(app: App);
18
+ private get canvas();
19
+ set: (cursor: string) => void;
20
+ /**
21
+ * Resets to the resting cursor — the cursor shown when no interaction or
22
+ * hover affordance overrides it: the view-mode grab cursor when
23
+ * drag-to-pan applies, the active tool's cursor otherwise.
24
+ */
25
+ reset: () => void;
26
+ /** applies the given tool's cursor (defaults to the active tool) */
27
+ applyForTool: (activeTool?: AppState["activeTool"]) => void;
28
+ /** clears the inline cursor so the environment default (CSS) applies */
29
+ private clear;
30
+ private applyEraser;
31
+ }