@zsviczian/excalidraw 0.18.0-11 → 0.18.0-13

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 (74) hide show
  1. package/dist/excalidraw.development.js +103 -70
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/dist/styles.development.css +16 -0
  4. package/dist/styles.production.css +1 -0
  5. package/package.json +1 -1
  6. package/types/common/src/constants.d.ts +1 -0
  7. package/types/{excalidraw/scene → element/src}/Scene.d.ts +8 -11
  8. package/types/element/src/align.d.ts +3 -3
  9. package/types/element/src/binding.d.ts +18 -10
  10. package/types/element/src/dragElements.d.ts +3 -2
  11. package/types/element/src/elbowArrow.d.ts +1 -1
  12. package/types/element/src/flowchart.d.ts +3 -2
  13. package/types/element/src/fractionalIndex.d.ts +2 -2
  14. package/types/element/src/frame.d.ts +1 -1
  15. package/types/element/src/linearElementEditor.d.ts +13 -13
  16. package/types/element/src/mutateElement.d.ts +10 -2
  17. package/types/element/src/newElement.d.ts +2 -2
  18. package/types/element/src/resizeElements.d.ts +5 -5
  19. package/types/element/src/sizeHelpers.d.ts +0 -1
  20. package/types/element/src/textElement.d.ts +4 -3
  21. package/types/element/src/typeChecks.d.ts +3 -0
  22. package/types/element/src/types.d.ts +3 -0
  23. package/types/element/src/zindex.d.ts +3 -3
  24. package/types/excalidraw/actions/actionAddToLibrary.d.ts +3 -3
  25. package/types/excalidraw/actions/actionBoundText.d.ts +2 -2
  26. package/types/excalidraw/actions/actionCanvas.d.ts +30 -30
  27. package/types/excalidraw/actions/actionClipboard.d.ts +6 -6
  28. package/types/excalidraw/actions/actionCropEditor.d.ts +1 -1
  29. package/types/excalidraw/actions/actionDeleteSelected.d.ts +3 -3
  30. package/types/excalidraw/actions/actionElementLink.d.ts +1 -1
  31. package/types/excalidraw/actions/actionElementLock.d.ts +2 -2
  32. package/types/excalidraw/actions/actionEmbeddable.d.ts +1 -1
  33. package/types/excalidraw/actions/actionExport.d.ts +32 -32
  34. package/types/excalidraw/actions/actionFinalize.d.ts +2 -2
  35. package/types/excalidraw/actions/actionFrame.d.ts +6 -6
  36. package/types/excalidraw/actions/actionGroup.d.ts +2 -2
  37. package/types/excalidraw/actions/actionLinearEditor.d.ts +1 -1
  38. package/types/excalidraw/actions/actionMenu.d.ts +1 -1
  39. package/types/excalidraw/actions/actionNavigate.d.ts +1 -1
  40. package/types/excalidraw/actions/actionProperties.d.ts +17 -17
  41. package/types/excalidraw/actions/actionSelectAll.d.ts +1 -1
  42. package/types/excalidraw/actions/actionStyles.d.ts +1 -1
  43. package/types/excalidraw/actions/actionToggleGridMode.d.ts +1 -1
  44. package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +1 -1
  45. package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +2 -2
  46. package/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
  47. package/types/excalidraw/actions/actionToggleStats.d.ts +1 -1
  48. package/types/excalidraw/actions/actionToggleViewMode.d.ts +1 -1
  49. package/types/excalidraw/actions/actionToggleZenMode.d.ts +1 -1
  50. package/types/excalidraw/actions/actionZindex.d.ts +2 -2
  51. package/types/excalidraw/actions/types.d.ts +2 -2
  52. package/types/excalidraw/appState.d.ts +15 -15
  53. package/types/excalidraw/components/App.d.ts +6 -1
  54. package/types/excalidraw/components/ConvertElementTypePopup.d.ts +49 -0
  55. package/types/excalidraw/components/ElementLinkDialog.d.ts +4 -3
  56. package/types/excalidraw/components/Stats/Angle.d.ts +1 -1
  57. package/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
  58. package/types/excalidraw/components/Stats/CanvasGridSize.d.ts +1 -1
  59. package/types/excalidraw/components/Stats/Dimension.d.ts +1 -1
  60. package/types/excalidraw/components/Stats/DragInput.d.ts +1 -1
  61. package/types/excalidraw/components/Stats/FontSize.d.ts +1 -1
  62. package/types/excalidraw/components/Stats/MultiAngle.d.ts +1 -1
  63. package/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -1
  64. package/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -1
  65. package/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -1
  66. package/types/excalidraw/components/Stats/Position.d.ts +1 -1
  67. package/types/excalidraw/components/Stats/utils.d.ts +4 -11
  68. package/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
  69. package/types/excalidraw/editor-jotai.d.ts +6 -6
  70. package/types/excalidraw/fonts/Fonts.d.ts +1 -1
  71. package/types/excalidraw/scene/Renderer.d.ts +1 -1
  72. package/types/excalidraw/scene/types.d.ts +2 -0
  73. package/types/excalidraw/types.d.ts +2 -0
  74. package/types/excalidraw/wysiwyg/textWysiwyg.d.ts +3 -1
@@ -76,7 +76,7 @@ export declare const actionGoToCollaborator: {
76
76
  zoom: Readonly<{
77
77
  value: import("../types").NormalizedZoomValue;
78
78
  }>;
79
- openMenu: "shape" | "canvas" | null;
79
+ openMenu: "canvas" | "shape" | null;
80
80
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
81
81
  openSidebar: {
82
82
  name: string;
@@ -95,7 +95,7 @@ export declare const actionChangeFillStyle: {
95
95
  zoom: Readonly<{
96
96
  value: import("../types").NormalizedZoomValue;
97
97
  }>;
98
- openMenu: "shape" | "canvas" | null;
98
+ openMenu: "canvas" | "shape" | null;
99
99
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
100
100
  openSidebar: {
101
101
  name: string;
@@ -317,7 +317,7 @@ export declare const actionChangeStrokeWidth: {
317
317
  zoom: Readonly<{
318
318
  value: import("../types").NormalizedZoomValue;
319
319
  }>;
320
- openMenu: "shape" | "canvas" | null;
320
+ openMenu: "canvas" | "shape" | null;
321
321
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
322
322
  openSidebar: {
323
323
  name: string;
@@ -539,7 +539,7 @@ export declare const actionChangeSloppiness: {
539
539
  zoom: Readonly<{
540
540
  value: import("../types").NormalizedZoomValue;
541
541
  }>;
542
- openMenu: "shape" | "canvas" | null;
542
+ openMenu: "canvas" | "shape" | null;
543
543
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
544
544
  openSidebar: {
545
545
  name: string;
@@ -761,7 +761,7 @@ export declare const actionChangeStrokeStyle: {
761
761
  zoom: Readonly<{
762
762
  value: import("../types").NormalizedZoomValue;
763
763
  }>;
764
- openMenu: "shape" | "canvas" | null;
764
+ openMenu: "canvas" | "shape" | null;
765
765
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
766
766
  openSidebar: {
767
767
  name: string;
@@ -983,7 +983,7 @@ export declare const actionChangeOpacity: {
983
983
  zoom: Readonly<{
984
984
  value: import("../types").NormalizedZoomValue;
985
985
  }>;
986
- openMenu: "shape" | "canvas" | null;
986
+ openMenu: "canvas" | "shape" | null;
987
987
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
988
988
  openSidebar: {
989
989
  name: string;
@@ -1206,7 +1206,7 @@ export declare const actionChangeFontSize: {
1206
1206
  zoom: Readonly<{
1207
1207
  value: import("../types").NormalizedZoomValue;
1208
1208
  }>;
1209
- openMenu: "shape" | "canvas" | null;
1209
+ openMenu: "canvas" | "shape" | null;
1210
1210
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
1211
1211
  openSidebar: {
1212
1212
  name: string;
@@ -1429,7 +1429,7 @@ export declare const actionDecreaseFontSize: {
1429
1429
  zoom: Readonly<{
1430
1430
  value: import("../types").NormalizedZoomValue;
1431
1431
  }>;
1432
- openMenu: "shape" | "canvas" | null;
1432
+ openMenu: "canvas" | "shape" | null;
1433
1433
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
1434
1434
  openSidebar: {
1435
1435
  name: string;
@@ -1652,7 +1652,7 @@ export declare const actionIncreaseFontSize: {
1652
1652
  zoom: Readonly<{
1653
1653
  value: import("../types").NormalizedZoomValue;
1654
1654
  }>;
1655
- openMenu: "shape" | "canvas" | null;
1655
+ openMenu: "canvas" | "shape" | null;
1656
1656
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
1657
1657
  openSidebar: {
1658
1658
  name: string;
@@ -1806,8 +1806,8 @@ export declare const actionChangeFontFamily: {
1806
1806
  trackEvent: false;
1807
1807
  perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<AppState>, value: any, app: AppClassProperties) => {
1808
1808
  appState: {
1809
- currentHoveredFontFamily: number | null;
1810
1809
  currentItemFontFamily: number;
1810
+ currentHoveredFontFamily: number | null;
1811
1811
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
1812
1812
  contextMenu: {
1813
1813
  items: import("../components/ContextMenu").ContextMenuItems;
@@ -1874,7 +1874,7 @@ export declare const actionChangeFontFamily: {
1874
1874
  zoom: Readonly<{
1875
1875
  value: import("../types").NormalizedZoomValue;
1876
1876
  }>;
1877
- openMenu: "shape" | "canvas" | null;
1877
+ openMenu: "canvas" | "shape" | null;
1878
1878
  openSidebar: {
1879
1879
  name: string;
1880
1880
  tab?: string | undefined;
@@ -2019,8 +2019,8 @@ export declare const actionChangeFontFamily: {
2019
2019
  } | {
2020
2020
  elements: ExcalidrawElement[];
2021
2021
  appState: {
2022
- currentHoveredFontFamily: number | null;
2023
2022
  currentItemFontFamily: number;
2023
+ currentHoveredFontFamily: number | null;
2024
2024
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
2025
2025
  contextMenu: {
2026
2026
  items: import("../components/ContextMenu").ContextMenuItems;
@@ -2087,7 +2087,7 @@ export declare const actionChangeFontFamily: {
2087
2087
  zoom: Readonly<{
2088
2088
  value: import("../types").NormalizedZoomValue;
2089
2089
  }>;
2090
- openMenu: "shape" | "canvas" | null;
2090
+ openMenu: "canvas" | "shape" | null;
2091
2091
  openSidebar: {
2092
2092
  name: string;
2093
2093
  tab?: string | undefined;
@@ -2308,7 +2308,7 @@ export declare const actionChangeTextAlign: {
2308
2308
  zoom: Readonly<{
2309
2309
  value: import("../types").NormalizedZoomValue;
2310
2310
  }>;
2311
- openMenu: "shape" | "canvas" | null;
2311
+ openMenu: "canvas" | "shape" | null;
2312
2312
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
2313
2313
  openSidebar: {
2314
2314
  name: string;
@@ -2532,7 +2532,7 @@ export declare const actionChangeVerticalAlign: {
2532
2532
  zoom: Readonly<{
2533
2533
  value: import("../types").NormalizedZoomValue;
2534
2534
  }>;
2535
- openMenu: "shape" | "canvas" | null;
2535
+ openMenu: "canvas" | "shape" | null;
2536
2536
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
2537
2537
  openSidebar: {
2538
2538
  name: string;
@@ -2754,7 +2754,7 @@ export declare const actionChangeRoundness: {
2754
2754
  zoom: Readonly<{
2755
2755
  value: import("../types").NormalizedZoomValue;
2756
2756
  }>;
2757
- openMenu: "shape" | "canvas" | null;
2757
+ openMenu: "canvas" | "shape" | null;
2758
2758
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
2759
2759
  openSidebar: {
2760
2760
  name: string;
@@ -2979,7 +2979,7 @@ export declare const actionChangeArrowhead: {
2979
2979
  zoom: Readonly<{
2980
2980
  value: import("../types").NormalizedZoomValue;
2981
2981
  }>;
2982
- openMenu: "shape" | "canvas" | null;
2982
+ openMenu: "canvas" | "shape" | null;
2983
2983
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
2984
2984
  openSidebar: {
2985
2985
  name: string;
@@ -3201,7 +3201,7 @@ export declare const actionChangeArrowType: {
3201
3201
  zoom: Readonly<{
3202
3202
  value: import("../types").NormalizedZoomValue;
3203
3203
  }>;
3204
- openMenu: "shape" | "canvas" | null;
3204
+ openMenu: "canvas" | "shape" | null;
3205
3205
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
3206
3206
  openSidebar: {
3207
3207
  name: string;
@@ -85,7 +85,7 @@ export declare const actionSelectAll: {
85
85
  zoom: Readonly<{
86
86
  value: import("../types").NormalizedZoomValue;
87
87
  }>;
88
- openMenu: "shape" | "canvas" | null;
88
+ openMenu: "canvas" | "shape" | null;
89
89
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
90
90
  openSidebar: {
91
91
  name: string;
@@ -78,7 +78,7 @@ export declare const actionCopyStyles: {
78
78
  zoom: Readonly<{
79
79
  value: import("../types").NormalizedZoomValue;
80
80
  }>;
81
- openMenu: "shape" | "canvas" | null;
81
+ openMenu: "canvas" | "shape" | null;
82
82
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
83
83
  openSidebar: {
84
84
  name: string;
@@ -80,7 +80,7 @@ export declare const actionToggleGridMode: {
80
80
  zoom: Readonly<{
81
81
  value: import("../types").NormalizedZoomValue;
82
82
  }>;
83
- openMenu: "shape" | "canvas" | null;
83
+ openMenu: "canvas" | "shape" | null;
84
84
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
85
85
  openSidebar: {
86
86
  name: string;
@@ -78,7 +78,7 @@ export declare const actionToggleObjectsSnapMode: {
78
78
  zoom: Readonly<{
79
79
  value: import("../types").NormalizedZoomValue;
80
80
  }>;
81
- openMenu: "shape" | "canvas" | null;
81
+ openMenu: "canvas" | "shape" | null;
82
82
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
83
83
  openSidebar: {
84
84
  name: string;
@@ -80,7 +80,7 @@ export declare const actionToggleSearchMenu: {
80
80
  zoom: Readonly<{
81
81
  value: import("../types").NormalizedZoomValue;
82
82
  }>;
83
- openMenu: "shape" | "canvas" | null;
83
+ openMenu: "canvas" | "shape" | null;
84
84
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
85
85
  openDialog: {
86
86
  name: "help" | "imageExport" | "jsonExport";
@@ -293,7 +293,7 @@ export declare const actionToggleSearchMenu: {
293
293
  zoom: Readonly<{
294
294
  value: import("../types").NormalizedZoomValue;
295
295
  }>;
296
- openMenu: "shape" | "canvas" | null;
296
+ openMenu: "canvas" | "shape" | null;
297
297
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
298
298
  defaultSidebarDockedPreference: boolean;
299
299
  lastPointerDownWith: import("@excalidraw/element/types").PointerType;
@@ -0,0 +1,19 @@
1
+ import type { ExcalidrawElement } from "@excalidraw/element/types";
2
+ export declare const actionToggleShapeSwitch: {
3
+ name: "toggleShapeSwitch";
4
+ label: string;
5
+ icon: () => null;
6
+ viewMode: true;
7
+ trackEvent: {
8
+ category: "shape_switch";
9
+ action: string;
10
+ };
11
+ keywords: string[];
12
+ perform(elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>, _: any, app: import("../types").AppClassProperties): {
13
+ captureUpdate: "NEVER";
14
+ };
15
+ checked: (appState: Readonly<import("../types").AppState>) => boolean;
16
+ predicate: (elements: readonly ExcalidrawElement[], appState: import("../types").AppState, props: import("../types").ExcalidrawProps) => boolean;
17
+ } & {
18
+ keyTest?: undefined;
19
+ };
@@ -80,7 +80,7 @@ export declare const actionToggleStats: {
80
80
  zoom: Readonly<{
81
81
  value: import("../types").NormalizedZoomValue;
82
82
  }>;
83
- openMenu: "shape" | "canvas" | null;
83
+ openMenu: "canvas" | "shape" | null;
84
84
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
85
85
  openSidebar: {
86
86
  name: string;
@@ -77,7 +77,7 @@ export declare const actionToggleViewMode: {
77
77
  zoom: Readonly<{
78
78
  value: import("../types").NormalizedZoomValue;
79
79
  }>;
80
- openMenu: "shape" | "canvas" | null;
80
+ openMenu: "canvas" | "shape" | null;
81
81
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
82
82
  openSidebar: {
83
83
  name: string;
@@ -77,7 +77,7 @@ export declare const actionToggleZenMode: {
77
77
  zoom: Readonly<{
78
78
  value: import("../types").NormalizedZoomValue;
79
79
  }>;
80
- openMenu: "shape" | "canvas" | null;
80
+ openMenu: "canvas" | "shape" | null;
81
81
  openPopup: "fontFamily" | "canvasBackground" | "elementBackground" | "elementStroke" | null;
82
82
  openSidebar: {
83
83
  name: string;
@@ -45,7 +45,7 @@ export declare const actionSendToBack: {
45
45
  category: "element";
46
46
  };
47
47
  perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
48
- elements: readonly import("@excalidraw/element/types").ExcalidrawElement[] | import("@excalidraw/element/types").ExcalidrawElement[];
48
+ elements: import("@excalidraw/element/types").ExcalidrawElement[] | readonly import("@excalidraw/element/types").ExcalidrawElement[];
49
49
  appState: Readonly<import("../types").AppState>;
50
50
  captureUpdate: "IMMEDIATELY";
51
51
  };
@@ -63,7 +63,7 @@ export declare const actionBringToFront: {
63
63
  category: "element";
64
64
  };
65
65
  perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
66
- elements: readonly import("@excalidraw/element/types").ExcalidrawElement[] | import("@excalidraw/element/types").ExcalidrawElement[];
66
+ elements: import("@excalidraw/element/types").ExcalidrawElement[] | readonly import("@excalidraw/element/types").ExcalidrawElement[];
67
67
  appState: Readonly<import("../types").AppState>;
68
68
  captureUpdate: "IMMEDIATELY";
69
69
  };
@@ -14,7 +14,7 @@ export type ActionResult = {
14
14
  type ActionFn = (elements: readonly OrderedExcalidrawElement[], appState: Readonly<AppState>, formData: any, 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" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "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" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "createContainerFromText" | "wrapTextInContainer" | "toggleLaserPointerTool" | "commandPalette" | "autoResize" | "elementStats" | "searchMenu" | "copyElementLink" | "linkToElement" | "cropEditor" | "wrapSelectionInFrame" | "toggleLassoTool";
17
+ export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "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" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "createContainerFromText" | "wrapTextInContainer" | "toggleLaserPointerTool" | "commandPalette" | "autoResize" | "elementStats" | "searchMenu" | "copyElementLink" | "linkToElement" | "cropEditor" | "wrapSelectionInFrame" | "toggleLassoTool" | "toggleShapeSwitch";
18
18
  export type PanelComponentProps = {
19
19
  elements: readonly ExcalidrawElement[];
20
20
  appState: AppState;
@@ -35,7 +35,7 @@ export interface Action {
35
35
  predicate?: (elements: readonly ExcalidrawElement[], appState: AppState, appProps: ExcalidrawProps, app: AppClassProperties) => boolean;
36
36
  checked?: (appState: Readonly<AppState>) => boolean;
37
37
  trackEvent: false | {
38
- category: "toolbar" | "element" | "canvas" | "export" | "history" | "menu" | "collab" | "hyperlink" | "search_menu";
38
+ category: "toolbar" | "element" | "canvas" | "export" | "history" | "menu" | "collab" | "hyperlink" | "search_menu" | "shape_switch";
39
39
  action?: string;
40
40
  predicate?: (appState: Readonly<AppState>, elements: readonly ExcalidrawElement[], value: any) => boolean;
41
41
  };
@@ -1,13 +1,18 @@
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
- viewBackgroundColor?: string | undefined;
5
4
  name?: string | null | undefined;
5
+ activeTool?: ({
6
+ lastActiveTool: import("./types").ActiveTool | null;
7
+ locked: boolean;
8
+ fromSelection: boolean;
9
+ } & import("./types").ActiveTool) | undefined;
6
10
  zoom?: Readonly<{
7
11
  value: NormalizedZoomValue;
8
12
  }> | undefined;
9
13
  scrollX?: number | undefined;
10
14
  scrollY?: number | undefined;
15
+ viewBackgroundColor?: string | undefined;
11
16
  editingGroupId?: string | null | undefined;
12
17
  selectedElementIds?: Readonly<{
13
18
  [id: string]: true;
@@ -18,23 +23,13 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
18
23
  } | undefined;
19
24
  selectedLinearElement?: import("@excalidraw/element/linearElementEditor").LinearElementEditor | null | undefined;
20
25
  zenModeEnabled?: boolean | undefined;
21
- gridModeEnabled?: boolean | undefined;
22
- objectsSnapModeEnabled?: boolean | undefined;
23
- shouldCacheIgnoreZoom?: boolean | undefined;
24
- exportScale?: number | undefined;
25
- gridSize?: number | undefined;
26
- gridStep?: number | undefined;
27
26
  showWelcomeScreen?: boolean | undefined;
28
- activeTool?: ({
29
- lastActiveTool: import("./types").ActiveTool | null;
30
- locked: boolean;
31
- fromSelection: boolean;
32
- } & import("./types").ActiveTool) | undefined;
33
27
  penMode?: boolean | undefined;
34
28
  penDetected?: boolean | undefined;
35
29
  exportBackground?: boolean | undefined;
36
30
  exportEmbedScene?: boolean | undefined;
37
31
  exportWithDarkMode?: boolean | undefined;
32
+ exportScale?: number | undefined;
38
33
  currentItemStrokeColor?: string | undefined;
39
34
  currentItemBackgroundColor?: string | undefined;
40
35
  currentItemFillStyle?: import("@excalidraw/element/types").FillStyle | undefined;
@@ -51,7 +46,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
51
46
  currentItemArrowType?: "round" | "sharp" | "elbow" | undefined;
52
47
  cursorButton?: "up" | "down" | undefined;
53
48
  scrolledOutside?: boolean | undefined;
54
- openMenu?: "shape" | "canvas" | null | undefined;
49
+ openMenu?: "canvas" | "shape" | null | undefined;
55
50
  openSidebar?: {
56
51
  name: string;
57
52
  tab?: string | undefined;
@@ -61,23 +56,28 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
61
56
  previousSelectedElementIds?: {
62
57
  [id: string]: true;
63
58
  } | undefined;
59
+ shouldCacheIgnoreZoom?: boolean | undefined;
60
+ gridSize?: number | undefined;
61
+ gridStep?: number | undefined;
62
+ gridModeEnabled?: boolean | undefined;
64
63
  stats?: {
65
64
  open: boolean;
66
65
  panels: number;
67
66
  } | undefined;
68
67
  currentChartType?: import("@excalidraw/element/types").ChartType | undefined;
68
+ objectsSnapModeEnabled?: boolean | undefined;
69
69
  };
70
70
  export declare const cleanAppStateForExport: (appState: Partial<AppState>) => {
71
71
  viewBackgroundColor?: string | undefined;
72
- gridModeEnabled?: boolean | undefined;
73
72
  gridSize?: number | undefined;
74
73
  gridStep?: number | undefined;
74
+ gridModeEnabled?: boolean | undefined;
75
75
  };
76
76
  export declare const clearAppStateForDatabase: (appState: Partial<AppState>) => {
77
77
  viewBackgroundColor?: string | undefined;
78
- gridModeEnabled?: boolean | undefined;
79
78
  gridSize?: number | undefined;
80
79
  gridStep?: number | undefined;
80
+ gridModeEnabled?: boolean | undefined;
81
81
  };
82
82
  export declare const isEraserActive: ({ activeTool, }: {
83
83
  activeTool: AppState["activeTool"];
@@ -2,11 +2,14 @@ import React from "react";
2
2
  import { type EXPORT_IMAGE_TYPES } from "@excalidraw/common";
3
3
  import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
4
4
  import { FlowChartCreator } from "@excalidraw/element/flowchart";
5
+ import Scene from "@excalidraw/element/Scene";
6
+ import type { ElementUpdate } from "@excalidraw/element/mutateElement";
5
7
  import type { ExcalidrawElement, ExcalidrawLinearElement, NonDeleted, InitializedExcalidrawImageElement, ExcalidrawImageElement, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered } from "@excalidraw/element/types";
8
+ import type { Mutable } from "@excalidraw/common/utility-types";
6
9
  import { ActionManager } from "../actions/manager";
7
10
  import { AnimationFrameHandler } from "../animation-frame-handler";
8
- import Scene from "../scene/Scene";
9
11
  import { Fonts } from "../fonts";
12
+ import { type WritableAtom } from "../editor-jotai";
10
13
  import { Renderer } from "../scene/Renderer";
11
14
  import { Emitter } from "../emitter";
12
15
  import { LaserTrails } from "../laser-trails";
@@ -245,6 +248,7 @@ declare class App extends React.Component<AppProps, AppState> {
245
248
  missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
246
249
  onRemoveEventListenersEmitter: Emitter<[]>;
247
250
  constructor(props: AppProps);
251
+ updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
248
252
  private onWindowMessage;
249
253
  private cacheEmbeddableRef;
250
254
  /**
@@ -412,6 +416,7 @@ declare class App extends React.Component<AppProps, AppState> {
412
416
  captureUpdate?: SceneData["captureUpdate"];
413
417
  forceFlushSync?: boolean | undefined;
414
418
  }) => void;
419
+ mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
415
420
  private triggerRender;
416
421
  /**
417
422
  * @returns whether the menu was toggled on or off
@@ -0,0 +1,49 @@
1
+ import type { ConvertibleGenericTypes, ConvertibleLinearTypes, ConvertibleTypes, ExcalidrawElbowArrowElement, ExcalidrawElement, ExcalidrawLinearElement, ExcalidrawTextContainer, ExcalidrawTextElementWithContainer } from "@excalidraw/element/types";
2
+ import type Scene from "@excalidraw/element/Scene";
3
+ import "./ConvertElementTypePopup.scss";
4
+ import type App from "./App";
5
+ export declare const convertElementTypePopupAtom: import("jotai/vanilla/atom").PrimitiveAtom<{
6
+ type: "panel";
7
+ } | null> & {
8
+ init: {
9
+ type: "panel";
10
+ } | null;
11
+ };
12
+ export declare const fontSize_conversionCacheAtom: import("jotai/vanilla/atom").PrimitiveAtom<{
13
+ [id: string]: {
14
+ fontSize: number;
15
+ elementType: ConvertibleGenericTypes;
16
+ };
17
+ } | null> & {
18
+ init: {
19
+ [id: string]: {
20
+ fontSize: number;
21
+ elementType: ConvertibleGenericTypes;
22
+ };
23
+ } | null;
24
+ };
25
+ export declare const linearElement_conversionCacheAtom: import("jotai/vanilla/atom").PrimitiveAtom<{
26
+ [id: string]: {
27
+ properties: Partial<ExcalidrawLinearElement> | Partial<ExcalidrawElbowArrowElement>;
28
+ initialType: ConvertibleLinearTypes;
29
+ };
30
+ } | null> & {
31
+ init: {
32
+ [id: string]: {
33
+ properties: Partial<ExcalidrawLinearElement> | Partial<ExcalidrawElbowArrowElement>;
34
+ initialType: ConvertibleLinearTypes;
35
+ };
36
+ } | null;
37
+ };
38
+ declare const ConvertElementTypePopup: ({ app }: {
39
+ app: App;
40
+ }) => import("react/jsx-runtime").JSX.Element;
41
+ export declare const adjustBoundTextSize: (container: ExcalidrawTextContainer, boundText: ExcalidrawTextElementWithContainer, scene: Scene) => void;
42
+ type ConversionType = "generic" | "linear" | null;
43
+ export declare const convertElementTypes: (app: App, { conversionType, nextType, direction, }: {
44
+ conversionType: ConversionType;
45
+ nextType?: ConvertibleTypes | undefined;
46
+ direction?: "left" | "right" | undefined;
47
+ }) => boolean;
48
+ export declare const getConversionTypeFromElements: (elements: ExcalidrawElement[]) => ConversionType;
49
+ export default ConvertElementTypePopup;
@@ -1,10 +1,11 @@
1
- import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
1
+ import type { ExcalidrawElement } from "@excalidraw/element/types";
2
+ import type Scene from "@excalidraw/element/Scene";
2
3
  import "./ElementLinkDialog.scss";
3
4
  import type { AppProps, UIAppState } from "../types";
4
- declare const ElementLinkDialog: ({ sourceElementId, onClose, elementsMap, appState, generateLinkForSelection, }: {
5
+ declare const ElementLinkDialog: ({ sourceElementId, onClose, appState, scene, generateLinkForSelection, }: {
5
6
  sourceElementId: ExcalidrawElement["id"];
6
- elementsMap: ElementsMap;
7
7
  appState: UIAppState;
8
+ scene: Scene;
8
9
  onClose?: (() => void) | undefined;
9
10
  generateLinkForSelection: AppProps["generateLinkForSelection"];
10
11
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import type { ExcalidrawElement } from "@excalidraw/element/types";
2
- import type Scene from "../../scene/Scene";
2
+ import type Scene from "@excalidraw/element/Scene";
3
3
  import type { AppState } from "../../types";
4
4
  interface AngleProps {
5
5
  element: ExcalidrawElement;
@@ -1,4 +1,4 @@
1
- import type Scene from "../../scene/Scene";
1
+ import type Scene from "@excalidraw/element/Scene";
2
2
  import type { AppState } from "../../types";
3
3
  interface PositionProps {
4
4
  property: "gridStep";
@@ -1,4 +1,4 @@
1
- import type Scene from "../../scene/Scene";
1
+ import type Scene from "@excalidraw/element/Scene";
2
2
  import type { AppState } from "../../types";
3
3
  interface PositionProps {
4
4
  property: "gridSize";
@@ -1,5 +1,5 @@
1
1
  import type { ExcalidrawElement } from "@excalidraw/element/types";
2
- import type Scene from "../../scene/Scene";
2
+ import type Scene from "@excalidraw/element/Scene";
3
3
  import type { AppState } from "../../types";
4
4
  interface DimensionDragInputProps {
5
5
  property: "width" | "height";
@@ -1,7 +1,7 @@
1
1
  import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
2
+ import type Scene from "@excalidraw/element/Scene";
2
3
  import "./DragInput.scss";
3
4
  import type { StatsInputProperty } from "./utils";
4
- import type Scene from "../../scene/Scene";
5
5
  import type { AppState } from "../../types";
6
6
  export type DragInputCallbackType<P extends StatsInputProperty, E = ExcalidrawElement> = (props: {
7
7
  accumulatedChange: number;
@@ -1,5 +1,5 @@
1
1
  import type { ExcalidrawElement } from "@excalidraw/element/types";
2
- import type Scene from "../../scene/Scene";
2
+ import type Scene from "@excalidraw/element/Scene";
3
3
  import type { AppState } from "../../types";
4
4
  interface FontSizeProps {
5
5
  element: ExcalidrawElement;
@@ -1,5 +1,5 @@
1
1
  import type { ExcalidrawElement } from "@excalidraw/element/types";
2
- import type Scene from "../../scene/Scene";
2
+ import type Scene from "@excalidraw/element/Scene";
3
3
  import type { AppState } from "../../types";
4
4
  interface MultiAngleProps {
5
5
  elements: readonly ExcalidrawElement[];
@@ -1,6 +1,6 @@
1
1
  import type { ExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
2
+ import type Scene from "@excalidraw/element/Scene";
2
3
  import type { AtomicUnit } from "./utils";
3
- import type Scene from "../../scene/Scene";
4
4
  import type { AppState } from "../../types";
5
5
  interface MultiDimensionProps {
6
6
  property: "width" | "height";
@@ -1,5 +1,5 @@
1
1
  import type { ExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
2
- import type Scene from "../../scene/Scene";
2
+ import type Scene from "@excalidraw/element/Scene";
3
3
  import type { AppState } from "../../types";
4
4
  interface MultiFontSizeProps {
5
5
  elements: readonly ExcalidrawElement[];
@@ -1,6 +1,6 @@
1
1
  import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
2
+ import type Scene from "@excalidraw/element/Scene";
2
3
  import type { AtomicUnit } from "./utils";
3
- import type Scene from "../../scene/Scene";
4
4
  import type { AppState } from "../../types";
5
5
  interface MultiPositionProps {
6
6
  property: "x" | "y";
@@ -1,5 +1,5 @@
1
1
  import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
2
- import type Scene from "../../scene/Scene";
2
+ import type Scene from "@excalidraw/element/Scene";
3
3
  import type { AppState } from "../../types";
4
4
  interface PositionProps {
5
5
  property: "x" | "y";
@@ -1,8 +1,9 @@
1
- import type { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
2
- import type Scene from "../../scene/Scene";
1
+ import type { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
+ import type Scene from "@excalidraw/element/Scene";
3
3
  import type { AppState } from "../../types";
4
4
  export type StatsInputProperty = "x" | "y" | "width" | "height" | "angle" | "fontSize" | "gridStep" | "gridSize";
5
5
  export declare const SMALLEST_DELTA = 0.01;
6
+ export declare const STEP_SIZE = 10;
6
7
  export declare const isPropertyEditable: (element: ExcalidrawElement, property: keyof ExcalidrawElement) => boolean;
7
8
  export declare const getStepSizedValue: (value: number, stepSize: number) => number;
8
9
  export type AtomicUnit = Record<string, true>;
@@ -14,13 +15,5 @@ export declare const newOrigin: (x1: number, y1: number, w1: number, h1: number,
14
15
  x: number;
15
16
  y: number;
16
17
  };
17
- export declare const moveElement: (newTopLeftX: number, newTopLeftY: number, originalElement: ExcalidrawElement, elementsMap: NonDeletedSceneElementsMap, elements: readonly NonDeletedExcalidrawElement[], scene: Scene, originalElementsMap: ElementsMap, shouldInformMutation?: boolean) => void;
18
+ export declare const moveElement: (newTopLeftX: number, newTopLeftY: number, originalElement: ExcalidrawElement, scene: Scene, originalElementsMap: ElementsMap, shouldInformMutation?: boolean) => void;
18
19
  export declare const getAtomicUnits: (targetElements: readonly ExcalidrawElement[], appState: AppState) => AtomicUnit[];
19
- export declare const updateBindings: (latestElement: ExcalidrawElement, elementsMap: NonDeletedSceneElementsMap, elements: readonly NonDeletedExcalidrawElement[], scene: Scene, options?: {
20
- simultaneouslyUpdated?: readonly ExcalidrawElement[];
21
- newSize?: {
22
- width: number;
23
- height: number;
24
- };
25
- zoom?: AppState["zoom"];
26
- }) => void;