@excalidraw/element 0.18.0-2a82821 → 0.18.0-2b1c2a9

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 (160) hide show
  1. package/dist/dev/index.js +5570 -3546
  2. package/dist/dev/index.js.map +4 -4
  3. package/dist/prod/index.js +12 -12
  4. package/dist/types/common/src/colors.d.ts +19 -0
  5. package/dist/types/common/src/constants.d.ts +3 -0
  6. package/dist/types/common/src/keys.d.ts +2 -0
  7. package/dist/types/common/src/points.d.ts +1 -1
  8. package/dist/types/common/src/utils.d.ts +1 -43
  9. package/dist/types/element/src/Scene.d.ts +1 -1
  10. package/dist/types/element/src/align.d.ts +2 -2
  11. package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
  12. package/dist/types/element/src/arrows/focus.d.ts +5 -2
  13. package/dist/types/element/src/binding.d.ts +17 -8
  14. package/dist/types/element/src/bounds.d.ts +5 -9
  15. package/dist/types/element/src/bucketFill.d.ts +110 -0
  16. package/dist/types/element/src/collision.d.ts +1 -1
  17. package/dist/types/element/src/comparisons.d.ts +4 -4
  18. package/dist/types/element/src/convertToShape.d.ts +23 -0
  19. package/dist/types/element/src/distribute.d.ts +2 -2
  20. package/dist/types/element/src/dragElements.d.ts +27 -0
  21. package/dist/types/element/src/duplicate.d.ts +3 -3
  22. package/dist/types/element/src/embeddable.d.ts +2 -2
  23. package/dist/types/element/src/flowchart.d.ts +7 -7
  24. package/dist/types/element/src/fractionalIndex.d.ts +2 -2
  25. package/dist/types/element/src/frame.d.ts +4 -4
  26. package/dist/types/element/src/groups.d.ts +9 -9
  27. package/dist/types/element/src/index.d.ts +4 -1
  28. package/dist/types/element/src/linearElementEditor.d.ts +27 -10
  29. package/dist/types/element/src/newElement.d.ts +14 -0
  30. package/dist/types/element/src/renderElement.d.ts +0 -3
  31. package/dist/types/element/src/resizeElements.d.ts +2 -2
  32. package/dist/types/element/src/selection.d.ts +5 -5
  33. package/dist/types/element/src/shape.d.ts +12 -0
  34. package/dist/types/element/src/sortElements.d.ts +10 -0
  35. package/dist/types/element/src/textElement.d.ts +13 -9
  36. package/dist/types/element/src/transform.d.ts +2 -2
  37. package/dist/types/element/src/typeChecks.d.ts +25 -25
  38. package/dist/types/element/src/types.d.ts +9 -1
  39. package/dist/types/element/src/utils.d.ts +7 -3
  40. package/dist/types/element/src/zindex.d.ts +2 -2
  41. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +36 -12
  42. package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
  43. package/dist/types/excalidraw/actions/actionBoundText.d.ts +24 -8
  44. package/dist/types/excalidraw/actions/actionCanvas.d.ts +146 -931
  45. package/dist/types/excalidraw/actions/actionClipboard.d.ts +24 -8
  46. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +12 -4
  47. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +38 -13
  48. package/dist/types/excalidraw/actions/actionDeselect.d.ts +9 -4
  49. package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
  50. package/dist/types/excalidraw/actions/actionElementLink.d.ts +12 -4
  51. package/dist/types/excalidraw/actions/actionElementLock.d.ts +25 -9
  52. package/dist/types/excalidraw/actions/actionExport.d.ts +26 -10
  53. package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
  54. package/dist/types/excalidraw/actions/actionFrame.d.ts +48 -197
  55. package/dist/types/excalidraw/actions/actionGroup.d.ts +39 -23
  56. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +16 -6
  57. package/dist/types/excalidraw/actions/actionLink.d.ts +13 -5
  58. package/dist/types/excalidraw/actions/actionMenu.d.ts +12 -4
  59. package/dist/types/excalidraw/actions/actionProperties.d.ts +43 -24
  60. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +17 -9
  61. package/dist/types/excalidraw/actions/actionStyles.d.ts +12 -4
  62. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
  63. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +13 -5
  64. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +16 -9
  65. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +13 -5
  66. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +13 -5
  67. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +16 -9
  68. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
  69. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +13 -5
  70. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +14 -6
  71. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +13 -5
  72. package/dist/types/excalidraw/actions/index.d.ts +1 -2
  73. package/dist/types/excalidraw/actions/manager.d.ts +1 -0
  74. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  75. package/dist/types/excalidraw/actions/types.d.ts +8 -4
  76. package/dist/types/excalidraw/appState.d.ts +9 -4
  77. package/dist/types/excalidraw/components/Actions.d.ts +17 -12
  78. package/dist/types/excalidraw/components/App.arrowText.d.ts +104 -0
  79. package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
  80. package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
  81. package/dist/types/excalidraw/components/App.d.ts +372 -67
  82. package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
  83. package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
  84. package/dist/types/excalidraw/components/App.viewport.d.ts +73 -0
  85. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -3
  86. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
  87. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +3 -1
  88. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +9 -2
  89. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +4 -2
  90. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
  91. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -1
  92. package/dist/types/excalidraw/components/ColorPicker/topPicksDnD.d.ts +31 -0
  93. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +1 -1
  94. package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
  95. package/dist/types/excalidraw/components/{ToolButton.d.ts → IconButton.d.ts} +16 -19
  96. package/dist/types/excalidraw/components/Island.d.ts +7 -0
  97. package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
  98. package/dist/types/excalidraw/components/LayerUI.d.ts +5 -2
  99. package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
  100. package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
  101. package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
  102. package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
  103. package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
  104. package/dist/types/excalidraw/components/Popover.d.ts +1 -3
  105. package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
  106. package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
  107. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
  108. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -2
  109. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
  110. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
  111. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
  112. package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
  113. package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
  114. package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
  115. package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
  116. package/dist/types/excalidraw/components/Tools.d.ts +146 -0
  117. package/dist/types/excalidraw/components/UserList.d.ts +3 -2
  118. package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
  119. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -0
  120. package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
  121. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -2
  122. package/dist/types/excalidraw/components/icons.d.ts +4 -1
  123. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +1 -1
  124. package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
  125. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
  126. package/dist/types/excalidraw/data/blob.d.ts +28 -12
  127. package/dist/types/excalidraw/data/index.d.ts +4 -4
  128. package/dist/types/excalidraw/data/json.d.ts +20 -12
  129. package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
  130. package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -2
  131. package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
  132. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
  133. package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
  134. package/dist/types/excalidraw/renderer/animation.d.ts +1 -0
  135. package/dist/types/excalidraw/renderer/helpers.d.ts +7 -0
  136. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -3
  137. package/dist/types/excalidraw/scene/Renderer.d.ts +12 -11
  138. package/dist/types/excalidraw/scene/export.d.ts +3 -3
  139. package/dist/types/excalidraw/scene/index.d.ts +1 -1
  140. package/dist/types/excalidraw/scene/types.d.ts +4 -3
  141. package/dist/types/excalidraw/snapping.d.ts +7 -7
  142. package/dist/types/excalidraw/types.d.ts +410 -20
  143. package/dist/types/excalidraw/viewport.d.ts +275 -0
  144. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +2 -3
  145. package/dist/types/laser-pointer/src/state.d.ts +1 -0
  146. package/dist/types/math/src/curve.d.ts +19 -12
  147. package/dist/types/math/src/index.d.ts +1 -0
  148. package/dist/types/math/src/pca.d.ts +79 -0
  149. package/dist/types/math/src/polygon.d.ts +25 -1
  150. package/dist/types/math/src/segment.d.ts +6 -0
  151. package/dist/types/utils/src/export.d.ts +3 -3
  152. package/package.json +4 -4
  153. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -172
  154. package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
  155. package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
  156. package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -10
  157. package/dist/types/excalidraw/components/shapes.d.ts +0 -270
  158. package/dist/types/excalidraw/cursor.d.ts +0 -5
  159. package/dist/types/excalidraw/scene/scroll.d.ts +0 -18
  160. package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
@@ -14,10 +14,10 @@ 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" | "changeBucketFillBackgroundColor" | "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
- appState: AppState;
20
+ appState: UIAppState;
21
21
  updateData: <T = any>(formData?: T) => void;
22
22
  appProps: ExcalidrawProps;
23
23
  data?: Record<string, any>;
@@ -26,7 +26,7 @@ export type PanelComponentProps = {
26
26
  };
27
27
  export interface Action<TData = any> {
28
28
  name: ActionName;
29
- label: string | ((elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, app: AppClassProperties) => string);
29
+ label: string | ((elements: readonly ExcalidrawElement[], appState: Readonly<UIAppState>, app: AppClassProperties) => string);
30
30
  keywords?: string[];
31
31
  icon?: React.ReactNode | ((appState: UIAppState, elements: readonly ExcalidrawElement[]) => React.ReactNode);
32
32
  PanelComponent?: React.FC<PanelComponentProps>;
@@ -34,7 +34,7 @@ export interface Action<TData = any> {
34
34
  keyPriority?: number;
35
35
  keyTest?: (event: React.KeyboardEvent | KeyboardEvent, appState: AppState, elements: readonly ExcalidrawElement[], app: AppClassProperties) => boolean;
36
36
  predicate?: (elements: readonly ExcalidrawElement[], appState: AppState, appProps: ExcalidrawProps, app: AppClassProperties) => boolean;
37
- checked?: (appState: Readonly<AppState>) => boolean;
37
+ checked?: (appState: Readonly<UIAppState>) => boolean;
38
38
  trackEvent: false | {
39
39
  category: "toolbar" | "element" | "canvas" | "export" | "history" | "menu" | "collab" | "hyperlink" | "search_menu" | "shape_switch";
40
40
  action?: string;
@@ -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 {};
@@ -24,12 +24,13 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
24
24
  selectedLinearElement?: import("@excalidraw/element").LinearElementEditor | null | undefined;
25
25
  isBindingEnabled?: boolean | undefined;
26
26
  isMidpointSnappingEnabled?: boolean | undefined;
27
+ gridModeEnabled?: boolean | undefined;
27
28
  zenModeEnabled?: boolean | undefined;
28
29
  shouldCacheIgnoreZoom?: boolean | undefined;
29
30
  exportScale?: number | undefined;
30
31
  currentItemArrowType?: "round" | "sharp" | "elbow" | undefined;
31
- bindMode?: import("@excalidraw/element/types").BindMode | undefined;
32
32
  gridSize?: number | undefined;
33
+ bindMode?: import("@excalidraw/element/types").BindMode | undefined;
33
34
  showWelcomeScreen?: boolean | undefined;
34
35
  boxSelectionMode?: import("./types").BoxSelectionMode | undefined;
35
36
  bindingPreference?: "enabled" | "disabled" | undefined;
@@ -69,7 +70,6 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
69
70
  [id: string]: true;
70
71
  } | undefined;
71
72
  gridStep?: number | undefined;
72
- gridModeEnabled?: boolean | undefined;
73
73
  stats?: {
74
74
  open: boolean;
75
75
  panels: number;
@@ -78,21 +78,26 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
78
78
  lockedMultiSelections?: {
79
79
  [groupId: string]: true;
80
80
  } | undefined;
81
+ colorTopPicks?: {
82
+ elementStroke: readonly string[] | null;
83
+ elementBackground: readonly string[] | null;
84
+ bucketFill: readonly string[] | null;
85
+ } | undefined;
81
86
  };
82
87
  export declare const cleanAppStateForExport: (appState: Partial<AppState>) => {
83
88
  viewBackgroundColor?: string | undefined;
89
+ gridModeEnabled?: boolean | undefined;
84
90
  gridSize?: number | undefined;
85
91
  gridStep?: number | undefined;
86
- gridModeEnabled?: boolean | undefined;
87
92
  lockedMultiSelections?: {
88
93
  [groupId: string]: true;
89
94
  } | undefined;
90
95
  };
91
96
  export declare const clearAppStateForDatabase: (appState: Partial<AppState>) => {
92
97
  viewBackgroundColor?: string | undefined;
98
+ gridModeEnabled?: boolean | undefined;
93
99
  gridSize?: number | undefined;
94
100
  gridStep?: number | undefined;
95
- gridModeEnabled?: boolean | undefined;
96
101
  lockedMultiSelections?: {
97
102
  [groupId: string]: true;
98
103
  } | 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, Zoom, 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,15 +36,8 @@ 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
- export declare const ZoomActions: ({ renderAction, zoom, }: {
39
+ export declare const ZoomActions: ({ renderAction, }: {
34
40
  renderAction: ActionManager["renderAction"];
35
- zoom: Zoom;
36
41
  }) => import("react/jsx-runtime").JSX.Element;
37
42
  export declare const UndoRedoActions: ({ renderAction, className, }: {
38
43
  renderAction: ActionManager["renderAction"];
@@ -0,0 +1,104 @@
1
+ import { LinearElementEditor } from "@excalidraw/element";
2
+ import type { ArrowEndpoint } from "@excalidraw/element";
3
+ import type { ExcalidrawElement, ExcalidrawTextElement, FixedPoint, NonDeleted, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
4
+ import type App from "./App";
5
+ import type { AppState, PointerDownState } from "../types";
6
+ /**
7
+ * Text ↔ arrow interactions.
8
+ *
9
+ * With the text tool: the hover affordance showing where a click would attach
10
+ * text to an arrow — a free endpoint (binds the arrow to a new text element
11
+ * positioned against that endpoint) or the arrow's midpoint (adds a label
12
+ * bound to the arrow) — and the endpoint-bound flavor of drag-sizing a new
13
+ * text.
14
+ *
15
+ * With the selection tool: dragging an arrow's existing label along the arrow
16
+ * — the grab affordance, the drag itself, and where a double-click starts
17
+ * editing a label the drag has moved.
18
+ *
19
+ * The scene-level logic lives in `@excalidraw/element`'s
20
+ * `arrowEndpointText.ts` and `linearElementEditor.ts`.
21
+ */
22
+ export declare class AppArrowText {
23
+ private app;
24
+ constructor(app: App);
25
+ /**
26
+ * With the text tool active, an arrow under the cursor is a target for
27
+ * attaching text. Returns where the text would land (if anywhere), and keeps
28
+ * `appState.hoveredArrowTextAnchor` — which drives the highlight — in sync.
29
+ */
30
+ updateHoveredAnchor: (scenePointer: {
31
+ x: number;
32
+ y: number;
33
+ }) => AppState["hoveredArrowTextAnchor"];
34
+ /**
35
+ * Re-evaluates the hovered anchor at the last known pointer position — for
36
+ * events that change what a click would do without the pointer moving,
37
+ * i.e. the ctrl/cmd binding toggle. (Events that invalidate the anchor
38
+ * wholesale — tool switches, finalize, deselect — clear it directly
39
+ * instead.)
40
+ */
41
+ refresh: () => void;
42
+ /**
43
+ * A free arrow endpoint a new text could be bound to. Binding an endpoint is
44
+ * an arrow binding, so it follows the binding toggle (ctrl/cmd) like every
45
+ * other one — holding it makes the text tool drop plain text instead.
46
+ */
47
+ getBindableEndpointAtPosition(x: number, y: number): ArrowEndpoint | null;
48
+ /**
49
+ * Mirrors what `handleTextOnPointerDown` would do at this position, so the
50
+ * highlight can't promise something the click won't deliver.
51
+ */
52
+ private getAnchorAtPosition;
53
+ /**
54
+ * How a text should be created to read as a label for this endpoint — the
55
+ * side midpoint to bind, the alignment that pins it, and the scene position
56
+ * it must sit at. `targetStrokeWidth` is the caller's to provide so it can
57
+ * guarantee it matches the stroke width the text is then created with — the
58
+ * binding gap derives from it (see `getTextBindingForArrowEndpoint`).
59
+ */
60
+ getTextBinding({ arrow, startOrEnd }: ArrowEndpoint, targetStrokeWidth: number): {
61
+ fixedPoint: FixedPoint;
62
+ textAlign: import("@excalidraw/element/types").TextAlign;
63
+ verticalAlign: import("@excalidraw/element/types").VerticalAlign;
64
+ anchor: import("@excalidraw/math").GlobalPoint;
65
+ } | null;
66
+ /**
67
+ * Binds the arrow endpoint to the created text, at the side midpoint the
68
+ * placement resolved (`getTextBinding`'s `fixedPoint`).
69
+ */
70
+ bindText({ arrow, startOrEnd }: ArrowEndpoint, text: NonDeleted<ExcalidrawTextElement>, fixedPoint: FixedPoint): void;
71
+ /**
72
+ * A text bound to an arrow endpoint can't be positioned by the drag — the
73
+ * binding already placed it — so only its width is dragged out. Returns
74
+ * whether it owned the drag.
75
+ */
76
+ maybeDragNewText(newElement: ExcalidrawElement, pointerCoords: {
77
+ x: number;
78
+ y: number;
79
+ }): boolean;
80
+ /**
81
+ * Whether the arrow's label is what a grab at this position would pick up:
82
+ * the pointer is over the label, and no element stacked above the arrow
83
+ * owns the hit instead.
84
+ */
85
+ isBoundTextGrabbable(element: NonDeletedExcalidrawElement, x: number, y: number): boolean;
86
+ /**
87
+ * The pointer-move half of dragging a label along its arrow. Owns the move
88
+ * whenever the gesture started on the label (`pointerDownState.hit.arrowLabel`),
89
+ * dragging only once past the threshold. Returns whether it owned it.
90
+ */
91
+ maybeDragLabel(linearElementEditor: LinearElementEditor, pointerDownState: PointerDownState, pointerCoords: {
92
+ x: number;
93
+ y: number;
94
+ }): boolean;
95
+ /**
96
+ * Where a double-click on a labeled arrow should start text editing: the
97
+ * center of the label itself, which a label drag may have moved away from
98
+ * the arrow's midpoint. Null when the element is not a labeled arrow.
99
+ */
100
+ getLabelCenter(element: ExcalidrawElement): {
101
+ x: number;
102
+ y: number;
103
+ } | null;
104
+ }
@@ -0,0 +1,48 @@
1
+ import type { Theme } from "@excalidraw/element/types";
2
+ import type App from "./App";
3
+ type ScenePoint = {
4
+ x: number;
5
+ y: number;
6
+ };
7
+ /** Owns bucket-fill interaction and App-bound scene mutations. */
8
+ export declare class AppBucketFill {
9
+ private app;
10
+ constructor(app: App);
11
+ private temporaryEyeDropper;
12
+ /**
13
+ * The click armed on pointer down, committed on pointer up. Deferring the
14
+ * scene mutation to pointer up is what lets a pinch/pan second finger, a
15
+ * long-press context menu, or a pointercancel abort the fill — on pointer
16
+ * down the editor cannot yet know the gesture will stay a single-pointer
17
+ * click.
18
+ */
19
+ private pending;
20
+ /** Arm a fill at the pointer-down position; nothing mutates yet. */
21
+ handlePointerDown: (scenePointer: ScenePoint) => void;
22
+ /**
23
+ * Commit the armed fill, at the pointer-DOWN position (what the user
24
+ * aimed at). No-op when the gesture was aborted in the meantime.
25
+ */
26
+ handlePointerUp: () => void;
27
+ /** Abort the armed fill (second finger, context menu, pointercancel). */
28
+ cancel: () => void;
29
+ cycleBackgroundColor: () => void;
30
+ openTemporaryEyeDropper: () => void;
31
+ closeTemporaryEyeDropper: () => void;
32
+ /**
33
+ * Apply the current bucket fill settings to an existing fill-compatible
34
+ * element (no-op when nothing would change). One undoable step.
35
+ */
36
+ private restyle;
37
+ private fill;
38
+ /**
39
+ * The color the bucket fill tool actually fills with: the shared
40
+ * `currentItemBackgroundColor`, falling back to green when that is
41
+ * transparent (the tool's picker doesn't offer transparent, but the shared
42
+ * state can hold it from the generic shape picker).
43
+ */
44
+ getBucketFillBackgroundColor: (backgroundColor: string,
45
+ /** supply only for display purposes such as when applying to the cursor */
46
+ theme?: Theme) => string;
47
+ }
48
+ export {};
@@ -0,0 +1,38 @@
1
+ import type { AppState } from "../types";
2
+ import type App from "./App";
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 toolCursorMemo;
14
+ private eraserCanvasCache;
15
+ private eraserPreviewDataURL;
16
+ constructor(app: App);
17
+ private get canvas();
18
+ set: (cursor: string) => void;
19
+ /**
20
+ * Resets to the resting cursor — the cursor shown when no interaction or
21
+ * hover affordance overrides it: the view-mode grab cursor when
22
+ * drag-to-pan applies, the active tool's cursor otherwise.
23
+ */
24
+ reset: () => void;
25
+ /** applies the given tool's cursor (defaults to the active tool) */
26
+ applyForTool: (activeTool?: AppState["activeTool"]) => void;
27
+ /**
28
+ * Re-runs the hover cursor logic at the last known pointer position by
29
+ * re-dispatching a synthetic pointermove — for state changes that alter
30
+ * what hovering means without the pointer moving (e.g. the tool reverting
31
+ * to selection after an element is created). Mouse only: touch and pen
32
+ * have no resting hover to restore.
33
+ */
34
+ refreshHover: () => void;
35
+ /** clears the inline cursor so the environment default (CSS) applies */
36
+ private clear;
37
+ private applyEraser;
38
+ }