@zsviczian/excalidraw 0.18.0-6 → 0.18.0-60

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 (199) hide show
  1. package/dist/excalidraw.development.js +757 -504
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/dist/excalidraw.production.min.js.LICENSE.txt +0 -2
  4. package/dist/styles.development.css +1080 -437
  5. package/dist/styles.production.css +26 -22
  6. package/package.json +15 -4
  7. package/types/common/src/commonObsidianUtils.d.ts +20 -0
  8. package/types/common/src/constants.d.ts +42 -18
  9. package/types/common/src/editorInterface.d.ts +35 -0
  10. package/types/{excalidraw → common/src}/emitter.d.ts +1 -1
  11. package/types/common/src/font-metadata.d.ts +4 -2
  12. package/types/common/src/index.d.ts +4 -0
  13. package/types/common/src/utility-types.d.ts +5 -0
  14. package/types/common/src/utils.d.ts +25 -6
  15. package/types/{excalidraw → common/src}/visualdebug.d.ts +2 -2
  16. package/types/{excalidraw/scene → element/src}/Scene.d.ts +16 -15
  17. package/types/element/src/align.d.ts +4 -3
  18. package/types/element/src/binding.d.ts +62 -41
  19. package/types/element/src/bounds.d.ts +14 -6
  20. package/types/element/src/collision.d.ts +23 -13
  21. package/types/element/src/cropElement.d.ts +1 -1
  22. package/types/{excalidraw/change.d.ts → element/src/delta.d.ts} +77 -40
  23. package/types/element/src/distance.d.ts +2 -2
  24. package/types/element/src/distribute.d.ts +2 -1
  25. package/types/element/src/dragElements.d.ts +3 -2
  26. package/types/element/src/duplicate.d.ts +10 -13
  27. package/types/element/src/elbowArrow.d.ts +1 -1
  28. package/types/element/src/flowchart.d.ts +3 -2
  29. package/types/element/src/fractionalIndex.d.ts +9 -3
  30. package/types/element/src/frame.d.ts +5 -4
  31. package/types/element/src/groups.d.ts +1 -0
  32. package/types/element/src/index.d.ts +44 -5
  33. package/types/element/src/linearElementEditor.d.ts +34 -50
  34. package/types/element/src/mutateElement.d.ts +11 -3
  35. package/types/element/src/newElement.d.ts +6 -4
  36. package/types/element/src/positionElementsOnGrid.d.ts +2 -0
  37. package/types/element/src/renderElement.d.ts +5 -2
  38. package/types/element/src/resizeElements.d.ts +6 -5
  39. package/types/element/src/resizeTest.d.ts +5 -4
  40. package/types/element/src/selection.d.ts +11 -5
  41. package/types/element/src/shape.d.ts +42 -0
  42. package/types/element/src/sizeHelpers.d.ts +2 -2
  43. package/types/element/src/store.d.ts +237 -0
  44. package/types/element/src/textElement.d.ts +4 -3
  45. package/types/element/src/transformHandles.d.ts +5 -4
  46. package/types/element/src/typeChecks.d.ts +20 -3
  47. package/types/element/src/types.d.ts +31 -12
  48. package/types/element/src/utils.d.ts +17 -6
  49. package/types/element/src/zindex.d.ts +8 -2
  50. package/types/excalidraw/actions/actionAddToLibrary.d.ts +88 -58
  51. package/types/excalidraw/actions/actionAlign.d.ts +6 -6
  52. package/types/excalidraw/actions/actionBoundText.d.ts +61 -41
  53. package/types/excalidraw/actions/actionCanvas.d.ts +430 -519
  54. package/types/excalidraw/actions/actionClipboard.d.ts +81 -944
  55. package/types/excalidraw/actions/actionCropEditor.d.ts +30 -20
  56. package/types/excalidraw/actions/actionDeleteSelected.d.ts +97 -68
  57. package/types/excalidraw/actions/actionDistribute.d.ts +2 -2
  58. package/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
  59. package/types/excalidraw/actions/actionElementLink.d.ts +28 -20
  60. package/types/excalidraw/actions/actionElementLock.d.ts +73 -54
  61. package/types/excalidraw/actions/actionEmbeddable.d.ts +30 -20
  62. package/types/excalidraw/actions/actionExport.d.ts +142 -1185
  63. package/types/excalidraw/actions/actionFinalize.d.ts +10 -424
  64. package/types/excalidraw/actions/actionFlip.d.ts +2 -2
  65. package/types/excalidraw/actions/actionFrame.d.ts +176 -129
  66. package/types/excalidraw/actions/actionGroup.d.ts +60 -40
  67. package/types/excalidraw/actions/actionHistory.d.ts +1 -2
  68. package/types/excalidraw/actions/actionLinearEditor.d.ts +564 -22
  69. package/types/excalidraw/actions/actionLink.d.ts +27 -17
  70. package/types/excalidraw/actions/actionMenu.d.ts +27 -457
  71. package/types/excalidraw/actions/actionNavigate.d.ts +21 -431
  72. package/types/excalidraw/actions/actionProperties.d.ts +169 -2702
  73. package/types/excalidraw/actions/actionSelectAll.d.ts +30 -20
  74. package/types/excalidraw/actions/actionStyles.d.ts +31 -21
  75. package/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
  76. package/types/excalidraw/actions/actionToggleGridMode.d.ts +29 -19
  77. package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +29 -19
  78. package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +27 -224
  79. package/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
  80. package/types/excalidraw/actions/actionToggleStats.d.ts +29 -19
  81. package/types/excalidraw/actions/actionToggleViewMode.d.ts +30 -20
  82. package/types/excalidraw/actions/actionToggleZenMode.d.ts +30 -20
  83. package/types/excalidraw/actions/actionTrayMenu.d.ts +229 -0
  84. package/types/excalidraw/actions/actionZindex.d.ts +2 -2
  85. package/types/excalidraw/actions/index.d.ts +4 -2
  86. package/types/excalidraw/actions/manager.d.ts +1 -1
  87. package/types/excalidraw/actions/register.d.ts +1 -1
  88. package/types/excalidraw/actions/types.d.ts +7 -6
  89. package/types/excalidraw/appState.d.ts +22 -7
  90. package/types/excalidraw/clipboard.d.ts +68 -5
  91. package/types/excalidraw/components/Actions.d.ts +20 -7
  92. package/types/excalidraw/components/App.d.ts +68 -46
  93. package/types/excalidraw/components/ButtonIcon.d.ts +1 -0
  94. package/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -1
  95. package/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +5 -1
  96. package/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +1 -1
  97. package/types/excalidraw/components/ColorPicker/Picker.d.ts +4 -3
  98. package/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +3 -3
  99. package/types/excalidraw/components/ColorPicker/ShadeList.d.ts +3 -2
  100. package/types/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
  101. package/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
  102. package/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +1 -1
  103. package/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
  104. package/types/excalidraw/components/CommandPalette/types.d.ts +1 -2
  105. package/types/excalidraw/components/ConvertElementTypePopup.d.ts +23 -0
  106. package/types/excalidraw/components/ElementLinkDialog.d.ts +4 -3
  107. package/types/excalidraw/components/Ellipsify.d.ts +3 -0
  108. package/types/excalidraw/components/ExcalidrawLogo.d.ts +1 -1
  109. package/types/excalidraw/components/FilledButton.d.ts +1 -1
  110. package/types/excalidraw/components/FixedSideContainer.d.ts +2 -1
  111. package/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
  112. package/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
  113. package/types/excalidraw/components/HintViewer.d.ts +4 -3
  114. package/types/excalidraw/components/InlineIcon.d.ts +3 -1
  115. package/types/excalidraw/components/LayerUI.d.ts +2 -1
  116. package/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
  117. package/types/excalidraw/components/LinkButton.d.ts +4 -0
  118. package/types/excalidraw/components/MobileMenu.d.ts +4 -5
  119. package/types/excalidraw/components/MobileToolBar.d.ts +10 -0
  120. package/types/excalidraw/components/Popover.d.ts +2 -1
  121. package/types/excalidraw/components/PropertiesPopover.d.ts +1 -0
  122. package/types/excalidraw/components/{ButtonIconSelect.d.ts → RadioSelection.d.ts} +1 -1
  123. package/types/excalidraw/components/Range.d.ts +3 -3
  124. package/types/excalidraw/components/Section.d.ts +1 -0
  125. package/types/excalidraw/components/Stats/Angle.d.ts +1 -1
  126. package/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
  127. package/types/excalidraw/components/Stats/CanvasGridSize.d.ts +1 -1
  128. package/types/excalidraw/components/Stats/Collapsible.d.ts +2 -1
  129. package/types/excalidraw/components/Stats/Dimension.d.ts +1 -1
  130. package/types/excalidraw/components/Stats/DragInput.d.ts +12 -2
  131. package/types/excalidraw/components/Stats/FontSize.d.ts +1 -1
  132. package/types/excalidraw/components/Stats/MultiAngle.d.ts +1 -1
  133. package/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -1
  134. package/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -1
  135. package/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -1
  136. package/types/excalidraw/components/Stats/Position.d.ts +1 -1
  137. package/types/excalidraw/components/Stats/utils.d.ts +4 -11
  138. package/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -2
  139. package/types/excalidraw/components/TextField.d.ts +1 -0
  140. package/types/excalidraw/components/ToolPopover.d.ts +25 -0
  141. package/types/excalidraw/components/TrayMenu.d.ts +26 -0
  142. package/types/excalidraw/components/UnlockPopup.d.ts +8 -0
  143. package/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +7 -3
  144. package/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +4 -2
  145. package/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +2 -1
  146. package/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
  147. package/types/excalidraw/components/hyperlink/helpers.d.ts +2 -1
  148. package/types/excalidraw/components/icons.d.ts +17 -0
  149. package/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +14 -1
  150. package/types/excalidraw/components/main-menu/MainMenu.d.ts +0 -3
  151. package/types/excalidraw/components/shapes.d.ts +115 -5
  152. package/types/excalidraw/data/blob.d.ts +3 -7
  153. package/types/excalidraw/data/reconcile.d.ts +1 -0
  154. package/types/excalidraw/data/restore.d.ts +7 -2
  155. package/types/excalidraw/data/transform.d.ts +1 -1
  156. package/types/excalidraw/data/types.d.ts +4 -1
  157. package/types/excalidraw/editor-jotai.d.ts +6 -6
  158. package/types/excalidraw/eraser/index.d.ts +0 -2
  159. package/types/excalidraw/fonts/Fonts.d.ts +1 -1
  160. package/types/excalidraw/history.d.ts +30 -22
  161. package/types/excalidraw/hooks/useEmitter.d.ts +1 -1
  162. package/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
  163. package/types/excalidraw/hooks/useOutsideClick.d.ts +3 -1
  164. package/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  165. package/types/excalidraw/index.d.ts +16 -15
  166. package/types/excalidraw/lasso/index.d.ts +1 -0
  167. package/types/excalidraw/lasso/utils.d.ts +2 -1
  168. package/types/excalidraw/obsidianUtils.d.ts +22 -9
  169. package/types/excalidraw/renderer/animation.d.ts +12 -0
  170. package/types/excalidraw/renderer/helpers.d.ts +3 -2
  171. package/types/excalidraw/renderer/interactiveScene.d.ts +5 -13
  172. package/types/excalidraw/renderer/staticScene.d.ts +4 -1
  173. package/types/excalidraw/scene/Renderer.d.ts +1 -2
  174. package/types/excalidraw/scene/index.d.ts +2 -2
  175. package/types/excalidraw/scene/scrollbars.d.ts +2 -3
  176. package/types/excalidraw/scene/types.d.ts +17 -3
  177. package/types/excalidraw/shortcut.d.ts +1 -0
  178. package/types/excalidraw/snapping.d.ts +2 -2
  179. package/types/excalidraw/types.d.ts +83 -33
  180. package/types/excalidraw/webpack.dev.config.d.ts +2 -0
  181. package/types/excalidraw/webpack.prod.config.d.ts +2 -0
  182. package/types/excalidraw/wysiwyg/textWysiwyg.d.ts +3 -1
  183. package/types/math/src/angle.d.ts +2 -0
  184. package/types/math/src/constants.d.ts +3 -0
  185. package/types/math/src/curve.d.ts +34 -0
  186. package/types/math/src/index.d.ts +1 -0
  187. package/types/math/src/point.d.ts +1 -1
  188. package/types/math/src/rectangle.d.ts +2 -0
  189. package/types/math/src/segment.d.ts +1 -0
  190. package/types/math/src/vector.d.ts +8 -2
  191. package/types/utils/src/bbox.d.ts +1 -1
  192. package/types/utils/src/index.d.ts +1 -1
  193. package/types/utils/src/withinBounds.d.ts +1 -1
  194. package/types/element/src/Shape.d.ts +0 -17
  195. package/types/element/src/ShapeCache.d.ts +0 -25
  196. package/types/element/src/shapes.d.ts +0 -23
  197. package/types/excalidraw/components/ButtonSelect.d.ts +0 -9
  198. package/types/excalidraw/store.d.ts +0 -129
  199. package/types/utils/src/collision.d.ts +0 -8
@@ -1,7 +1,7 @@
1
- import type { UserIdleState } from "@excalidraw/common";
1
+ import type { UserIdleState, EditorInterface } from "@excalidraw/common";
2
2
  import type { ExcalidrawElement, NonDeletedElementsMap, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
3
3
  import type { MakeBrand } from "@excalidraw/common/utility-types";
4
- import type { AppClassProperties, AppState, EmbedsValidationStatus, ElementsPendingErasure, InteractiveCanvasAppState, StaticCanvasAppState, SocketId, Device, PendingExcalidrawElements } from "../types";
4
+ import type { AppClassProperties, AppState, EmbedsValidationStatus, ElementsPendingErasure, InteractiveCanvasAppState, StaticCanvasAppState, SocketId, PendingExcalidrawElements } from "../types";
5
5
  import type { RoughCanvas } from "roughjs/bin/canvas";
6
6
  import type { Drawable } from "roughjs/bin/core";
7
7
  export type RenderableElementsMap = NonDeletedElementsMap & MakeBrand<"RenderableElementsMap">;
@@ -45,6 +45,10 @@ export type InteractiveCanvasRenderConfig = {
45
45
  remotePointerUsernames: Map<SocketId, string>;
46
46
  remotePointerButton: Map<SocketId, string | undefined>;
47
47
  selectionColor: string;
48
+ lastViewportPosition: {
49
+ x: number;
50
+ y: number;
51
+ };
48
52
  renderScrollbars?: boolean;
49
53
  };
50
54
  export type RenderInteractiveSceneCallback = {
@@ -62,7 +66,13 @@ export type StaticSceneRenderConfig = {
62
66
  appState: StaticCanvasAppState;
63
67
  renderConfig: StaticCanvasRenderConfig;
64
68
  };
69
+ export type InteractiveSceneRenderAnimationState = {
70
+ bindingHighlight: {
71
+ runtime: number;
72
+ } | undefined;
73
+ };
65
74
  export type InteractiveSceneRenderConfig = {
75
+ app: AppClassProperties;
66
76
  canvas: HTMLCanvasElement | null;
67
77
  elementsMap: RenderableElementsMap;
68
78
  visibleElements: readonly NonDeletedExcalidrawElement[];
@@ -71,8 +81,10 @@ export type InteractiveSceneRenderConfig = {
71
81
  scale: number;
72
82
  appState: InteractiveCanvasAppState;
73
83
  renderConfig: InteractiveCanvasRenderConfig;
74
- device: Device;
84
+ editorInterface: EditorInterface;
75
85
  callback: (data: RenderInteractiveSceneCallback) => void;
86
+ animationState?: InteractiveSceneRenderAnimationState;
87
+ deltaTime: number;
76
88
  };
77
89
  export type NewElementSceneRenderConfig = {
78
90
  canvas: HTMLCanvasElement | null;
@@ -95,12 +107,14 @@ export type ScrollBars = {
95
107
  y: number;
96
108
  width: number;
97
109
  height: number;
110
+ deltaMultiplier: number;
98
111
  } | null;
99
112
  vertical: {
100
113
  x: number;
101
114
  y: number;
102
115
  width: number;
103
116
  height: number;
117
+ deltaMultiplier: number;
104
118
  } | null;
105
119
  };
106
120
  export type ElementShape = Drawable | Drawable[] | null;
@@ -0,0 +1 @@
1
+ export declare const getShortcutKey: (shortcut: string) => string;
@@ -1,7 +1,7 @@
1
1
  import { type GlobalPoint } from "@excalidraw/math";
2
2
  import type { InclusiveRange } from "@excalidraw/math";
3
- import type { Bounds } from "@excalidraw/element/bounds";
4
- import type { MaybeTransformHandleType } from "@excalidraw/element/transformHandles";
3
+ import type { Bounds } from "@excalidraw/element";
4
+ import type { MaybeTransformHandleType } from "@excalidraw/element";
5
5
  import type { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
6
6
  import type { AppClassProperties, AppState, KeyboardModifiersObject } from "./types";
7
7
  export declare const getSnapDistance: (zoomValue: number) => number;
@@ -1,9 +1,9 @@
1
- import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, ColorPaletteCustom } from "@excalidraw/common";
2
- import type { SuggestedBinding } from "@excalidraw/element/binding";
3
- import type { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
4
- import type { MaybeTransformHandleType } from "@excalidraw/element/transformHandles";
5
- import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, ExcalidrawImageElement, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement } from "@excalidraw/element/types";
1
+ import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, ColorPaletteCustom, EditorInterface } from "@excalidraw/common";
2
+ import type { LinearElementEditor } from "@excalidraw/element";
3
+ import type { MaybeTransformHandleType } from "@excalidraw/element";
4
+ import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, BindMode } from "@excalidraw/element/types";
6
5
  import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
6
+ import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
7
7
  import type { Action } from "./actions/types";
8
8
  import type { Spreadsheet } from "./charts";
9
9
  import type { ClipboardData } from "./clipboard";
@@ -12,7 +12,6 @@ import type Library from "./data/library";
12
12
  import type { FileSystemHandle } from "./data/filesystem";
13
13
  import type { ContextMenuItems } from "./components/ContextMenu";
14
14
  import type { SnapLine } from "./snapping";
15
- import type { CaptureUpdateActionType } from "./store";
16
15
  import type { ImportedDataState } from "./data/types";
17
16
  import type { Language } from "./i18n";
18
17
  import type { isOverScrollBars } from "./scene/scrollbars";
@@ -113,7 +112,6 @@ type _CommonCanvasAppState = {
113
112
  offsetLeft: AppState["offsetLeft"];
114
113
  offsetTop: AppState["offsetTop"];
115
114
  theme: AppState["theme"];
116
- pendingImageElementId: AppState["pendingImageElementId"];
117
115
  };
118
116
  export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
119
117
  shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
@@ -126,31 +124,41 @@ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
126
124
  frameRendering: AppState["frameRendering"];
127
125
  linkOpacity: AppState["linkOpacity"];
128
126
  gridColor: AppState["gridColor"];
127
+ gridDirection: AppState["gridDirection"];
129
128
  frameColor: AppState["frameColor"];
130
129
  currentHoveredFontFamily: AppState["currentHoveredFontFamily"];
131
130
  hoveredElementIds: AppState["hoveredElementIds"];
131
+ suggestedBinding: AppState["suggestedBinding"];
132
132
  croppingElementId: AppState["croppingElementId"];
133
133
  }>;
134
134
  export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
135
135
  activeEmbeddable: AppState["activeEmbeddable"];
136
- editingLinearElement: AppState["editingLinearElement"];
137
136
  selectionElement: AppState["selectionElement"];
138
137
  selectedGroupIds: AppState["selectedGroupIds"];
139
138
  selectedLinearElement: AppState["selectedLinearElement"];
140
139
  multiElement: AppState["multiElement"];
140
+ newElement: AppState["newElement"];
141
141
  isBindingEnabled: AppState["isBindingEnabled"];
142
- suggestedBindings: AppState["suggestedBindings"];
142
+ suggestedBinding: AppState["suggestedBinding"];
143
143
  isRotating: AppState["isRotating"];
144
144
  elementsToHighlight: AppState["elementsToHighlight"];
145
145
  collaborators: AppState["collaborators"];
146
146
  snapLines: AppState["snapLines"];
147
147
  zenModeEnabled: AppState["zenModeEnabled"];
148
148
  editingTextElement: AppState["editingTextElement"];
149
+ viewBackgroundColor: AppState["viewBackgroundColor"];
149
150
  gridColor: AppState["gridColor"];
151
+ gridDirection: AppState["gridDirection"];
150
152
  highlightSearchResult: AppState["highlightSearchResult"];
151
153
  isCropping: AppState["isCropping"];
152
154
  croppingElementId: AppState["croppingElementId"];
153
155
  searchMatches: AppState["searchMatches"];
156
+ activeLockedId: AppState["activeLockedId"];
157
+ hoveredElementIds: AppState["hoveredElementIds"];
158
+ frameRendering: AppState["frameRendering"];
159
+ frameColor: AppState["frameColor"];
160
+ shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
161
+ exportScale: AppState["exportScale"];
154
162
  }>;
155
163
  export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
156
164
  export type ObservedStandaloneAppState = {
@@ -161,9 +169,13 @@ export type ObservedElementsAppState = {
161
169
  editingGroupId: AppState["editingGroupId"];
162
170
  selectedElementIds: AppState["selectedElementIds"];
163
171
  selectedGroupIds: AppState["selectedGroupIds"];
164
- editingLinearElementId: LinearElementEditor["elementId"] | null;
165
- selectedLinearElementId: LinearElementEditor["elementId"] | null;
172
+ selectedLinearElement: {
173
+ elementId: LinearElementEditor["elementId"];
174
+ isEditing: boolean;
175
+ } | null;
166
176
  croppingElementId: AppState["croppingElementId"];
177
+ lockedMultiSelections: AppState["lockedMultiSelections"];
178
+ activeLockedId: AppState["activeLockedId"];
167
179
  };
168
180
  export interface AppState {
169
181
  contextMenu: {
@@ -200,13 +212,15 @@ export interface AppState {
200
212
  selectionElement: NonDeletedExcalidrawElement | null;
201
213
  isBindingEnabled: boolean;
202
214
  startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
203
- suggestedBindings: SuggestedBinding[];
215
+ suggestedBinding: NonDeleted<ExcalidrawBindableElement> | null;
204
216
  frameToHighlight: NonDeleted<ExcalidrawFrameLikeElement> | null;
205
217
  frameRendering: {
206
218
  enabled: boolean;
207
219
  name: boolean;
208
220
  outline: boolean;
209
221
  clip: boolean;
222
+ markerName: boolean;
223
+ markerEnabled: boolean;
210
224
  };
211
225
  editingFrame: string | null;
212
226
  elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
@@ -214,7 +228,6 @@ export interface AppState {
214
228
  * set when a new text is created or when an existing text is being edited
215
229
  */
216
230
  editingTextElement: NonDeletedExcalidrawElement | null;
217
- editingLinearElement: LinearElementEditor | null;
218
231
  activeTool: {
219
232
  /**
220
233
  * indicates a previous tool we should revert back to if we deselect the
@@ -224,6 +237,10 @@ export interface AppState {
224
237
  locked: boolean;
225
238
  fromSelection: boolean;
226
239
  } & ActiveTool;
240
+ preferredSelectionTool: {
241
+ type: "selection" | "lasso";
242
+ initialized: boolean;
243
+ };
227
244
  penMode: boolean;
228
245
  penDetected: boolean;
229
246
  exportBackground: boolean;
@@ -245,6 +262,7 @@ export interface AppState {
245
262
  currentHoveredFontFamily: FontFamilyValues | null;
246
263
  currentItemRoundness: StrokeRoundness;
247
264
  currentItemArrowType: "sharp" | "round" | "elbow";
265
+ currentItemFrameRole: ExcalidrawFrameLikeElement["frameRole"] | null;
248
266
  viewBackgroundColor: string;
249
267
  scrollX: number;
250
268
  scrollY: number;
@@ -255,7 +273,7 @@ export interface AppState {
255
273
  isRotating: boolean;
256
274
  zoom: Zoom;
257
275
  openMenu: "canvas" | "shape" | null;
258
- openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | null;
276
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
259
277
  openSidebar: {
260
278
  name: SidebarName;
261
279
  tab?: SidebarTabName;
@@ -267,6 +285,8 @@ export interface AppState {
267
285
  tab: "text-to-diagram" | "mermaid";
268
286
  } | {
269
287
  name: "commandPalette";
288
+ } | {
289
+ name: "settings";
270
290
  } | {
271
291
  name: "elementLinkSelector";
272
292
  sourceElementId: ExcalidrawElement["id"];
@@ -329,11 +349,8 @@ export interface AppState {
329
349
  shown: true;
330
350
  data: Spreadsheet;
331
351
  };
332
- /** imageElement waiting to be placed on canvas */
333
- pendingImageElementId: ExcalidrawImageElement["id"] | null;
334
352
  showHyperlinkPopup: false | "info" | "editor";
335
353
  linkOpacity: number;
336
- trayModeEnabled: boolean;
337
354
  colorPalette?: {
338
355
  canvasBackground: ColorPaletteCustom;
339
356
  elementBackground: ColorPaletteCustom;
@@ -346,6 +363,7 @@ export interface AppState {
346
363
  };
347
364
  allowWheelZoom?: boolean;
348
365
  allowPinchZoom?: boolean;
366
+ disableContextMenu: boolean;
349
367
  pinnedScripts?: string[];
350
368
  customPens?: any[];
351
369
  currentStrokeOptions?: any;
@@ -354,6 +372,10 @@ export interface AppState {
354
372
  Bold: string;
355
373
  Regular: string;
356
374
  };
375
+ gridDirection: {
376
+ horizontal: boolean;
377
+ vertical: boolean;
378
+ };
357
379
  highlightSearchResult: boolean;
358
380
  dynamicStyle: {
359
381
  [x: string]: string;
@@ -378,9 +400,19 @@ export interface AppState {
378
400
  /** image cropping */
379
401
  isCropping: boolean;
380
402
  croppingElementId: ExcalidrawElement["id"] | null;
381
- searchMatches: readonly SearchMatch[];
403
+ /** null if no search matches found / search closed */
404
+ searchMatches: Readonly<{
405
+ focusedId: ExcalidrawElement["id"] | null;
406
+ matches: readonly SearchMatch[];
407
+ }> | null;
408
+ /** the locked element/group that's active and shows unlock popup */
409
+ activeLockedId: string | null;
410
+ lockedMultiSelections: {
411
+ [groupId: string]: true;
412
+ };
413
+ bindMode: BindMode;
382
414
  }
383
- type SearchMatch = {
415
+ export type SearchMatch = {
384
416
  id: string;
385
417
  focus: boolean;
386
418
  matchedLines: {
@@ -388,9 +420,10 @@ type SearchMatch = {
388
420
  offsetY: number;
389
421
  width: number;
390
422
  height: number;
423
+ showOnCanvas: boolean;
391
424
  }[];
392
425
  };
393
- export type UIAppState = Omit<AppState, "suggestedBindings" | "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
426
+ export type UIAppState = Omit<AppState, "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
394
427
  export type NormalizedZoomValue = number & {
395
428
  _brand: "normalizedZoom";
396
429
  };
@@ -440,6 +473,7 @@ export type OnUserFollowedPayload = {
440
473
  };
441
474
  export interface ExcalidrawProps {
442
475
  onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
476
+ onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
443
477
  initialData?: (() => MaybePromise<ExcalidrawInitialDataState | null>) | MaybePromise<ExcalidrawInitialDataState | null>;
444
478
  excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
445
479
  isCollaborating?: boolean;
@@ -468,6 +502,7 @@ export interface ExcalidrawProps {
468
502
  onDuplicate?: (nextElements: readonly ExcalidrawElement[],
469
503
  /** excludes the duplicated elements */
470
504
  prevElements: readonly ExcalidrawElement[]) => ExcalidrawElement[] | void;
505
+ renderTopLeftUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
471
506
  renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
472
507
  langCode?: Language["code"];
473
508
  viewModeEnabled?: boolean;
@@ -512,6 +547,7 @@ export interface ExcalidrawProps {
512
547
  aiEnabled?: boolean;
513
548
  showDeprecatedFonts?: boolean;
514
549
  insertLinkAction?: (linkVal: string) => void;
550
+ renderScrollbars?: boolean;
515
551
  }
516
552
  export type SceneData = {
517
553
  elements?: ImportedDataState["elements"];
@@ -539,6 +575,12 @@ export type UIOptions = Partial<{
539
575
  tools: {
540
576
  image: boolean;
541
577
  };
578
+ /**
579
+ * Optionally control the editor form factor and desktop UI mode from the host app.
580
+ * If not provided, we will take care of it internally.
581
+ */
582
+ formFactor?: EditorInterface["formFactor"];
583
+ desktopUIMode?: EditorInterface["desktopUIMode"];
542
584
  /** @deprecated does nothing. Will be removed in 0.15 */
543
585
  welcomeScreen?: boolean;
544
586
  }>;
@@ -569,7 +611,7 @@ export type AppClassProperties = {
569
611
  mimeType: ValueOf<typeof IMAGE_MIME_TYPES>;
570
612
  }>;
571
613
  files: BinaryFiles;
572
- device: App["device"];
614
+ editorInterface: App["editorInterface"];
573
615
  scene: App["scene"];
574
616
  syncActionResult: App["syncActionResult"];
575
617
  fonts: App["fonts"];
@@ -598,6 +640,9 @@ export type AppClassProperties = {
598
640
  visibleElements: App["visibleElements"];
599
641
  excalidrawContainerValue: App["excalidrawContainerValue"];
600
642
  onPointerUpEmitter: App["onPointerUpEmitter"];
643
+ updateEditorAtom: App["updateEditorAtom"];
644
+ onPointerDownEmitter: App["onPointerDownEmitter"];
645
+ bindModeHandler: App["bindModeHandler"];
601
646
  };
602
647
  export type PointerDownState = Readonly<{
603
648
  origin: Readonly<{
@@ -641,6 +686,11 @@ export type PointerDownState = Readonly<{
641
686
  x: number;
642
687
  y: number;
643
688
  } | null;
689
+ origin: {
690
+ x: number;
691
+ y: number;
692
+ };
693
+ blockDragging: boolean;
644
694
  };
645
695
  eventListeners: {
646
696
  onMove: null | ReturnType<typeof throttleRAF>;
@@ -655,13 +705,23 @@ export type PointerDownState = Readonly<{
655
705
  export type UnsubscribeCallback = () => void;
656
706
  export interface ExcalidrawImperativeAPI {
657
707
  updateScene: InstanceType<typeof App>["updateScene"];
708
+ applyDeltas: InstanceType<typeof App>["applyDeltas"];
709
+ mutateElement: InstanceType<typeof App>["mutateElement"];
658
710
  updateLibrary: InstanceType<typeof Library>["updateLibrary"];
659
711
  resetScene: InstanceType<typeof App>["resetScene"];
660
712
  getSceneElementsIncludingDeleted: InstanceType<typeof App>["getSceneElementsIncludingDeleted"];
713
+ getSceneElementsMapIncludingDeleted: InstanceType<typeof App>["getSceneElementsMapIncludingDeleted"];
661
714
  history: {
662
715
  clear: InstanceType<typeof App>["resetHistory"];
663
716
  };
717
+ setForceRenderAllEmbeddables: InstanceType<typeof App>["setForceRenderAllEmbeddables"];
664
718
  zoomToFit: InstanceType<typeof App>["zoomToFit"];
719
+ refreshEditorInterface: InstanceType<typeof App>["refreshEditorInterface"];
720
+ isTouchScreen: InstanceType<typeof App>["isTouchScreen"];
721
+ setTrayModeEnabled: InstanceType<typeof App>["setTrayModeEnabled"];
722
+ setDesktopUIMode: InstanceType<typeof App>["setDesktopUIMode"];
723
+ setMobileModeAllowed: InstanceType<typeof App>["setMobileModeAllowed"];
724
+ isTrayModeEnabled: InstanceType<typeof App>["isTrayModeEnabled"];
665
725
  getColorAtScenePoint: InstanceType<typeof App>["getColorAtScenePoint"];
666
726
  startLineEditor: InstanceType<typeof App>["startLineEditor"];
667
727
  getSceneElements: InstanceType<typeof App>["getSceneElements"];
@@ -680,12 +740,12 @@ export interface ExcalidrawImperativeAPI {
680
740
  bringForward: (elements: readonly ExcalidrawElement[]) => void;
681
741
  sendToBack: (elements: readonly ExcalidrawElement[]) => void;
682
742
  bringToFront: (elements: readonly ExcalidrawElement[]) => void;
683
- setMobileModeAllowed: (allow: boolean) => void;
684
743
  setActiveTool: InstanceType<typeof App>["setActiveTool"];
685
744
  setCursor: InstanceType<typeof App>["setCursor"];
686
745
  resetCursor: InstanceType<typeof App>["resetCursor"];
687
746
  toggleSidebar: InstanceType<typeof App>["toggleSidebar"];
688
747
  getHTMLIFrameElement: InstanceType<typeof App>["getHTMLIFrameElement"];
748
+ getEditorInterface: () => EditorInterface;
689
749
  /**
690
750
  * Disables rendering of frames (including element clipping), but currently
691
751
  * the frames are still interactive in edit mode. As such, this API should be
@@ -693,22 +753,12 @@ export interface ExcalidrawImperativeAPI {
693
753
  */
694
754
  updateFrameRendering: InstanceType<typeof App>["updateFrameRendering"];
695
755
  onChange: (callback: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void) => UnsubscribeCallback;
756
+ onIncrement: (callback: (event: DurableIncrement | EphemeralIncrement) => void) => UnsubscribeCallback;
696
757
  onPointerDown: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: React.PointerEvent<HTMLElement>) => void) => UnsubscribeCallback;
697
758
  onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
698
759
  onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
699
760
  onUserFollow: (callback: (payload: OnUserFollowedPayload) => void) => UnsubscribeCallback;
700
761
  }
701
- export type Device = Readonly<{
702
- viewport: {
703
- isMobile: boolean;
704
- isLandscape: boolean;
705
- };
706
- editor: {
707
- isMobile: boolean;
708
- canFitSidebar: boolean;
709
- };
710
- isTouchScreen: boolean;
711
- }>;
712
762
  export type FrameNameBounds = {
713
763
  x: number;
714
764
  y: number;
@@ -14,6 +14,8 @@ export namespace output {
14
14
  }
15
15
  export namespace resolve {
16
16
  const extensions: string[];
17
+ const mainFields: string[];
18
+ const mainFiles: string[];
17
19
  const alias: {
18
20
  "@excalidraw/excalidraw": string;
19
21
  "@excalidraw/utils": string;
@@ -15,6 +15,8 @@ export namespace output {
15
15
  }
16
16
  export namespace resolve {
17
17
  const extensions: string[];
18
+ const mainFields: string[];
19
+ const mainFiles: string[];
18
20
  const alias: {
19
21
  "@excalidraw/excalidraw": string;
20
22
  "@excalidraw/utils": string;
@@ -1,5 +1,6 @@
1
1
  import type { ExcalidrawElement, ExcalidrawTextElement } from "@excalidraw/element/types";
2
2
  import type App from "../components/App";
3
+ type SubmitHandler = () => void;
3
4
  export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, app, autoSelect, }: {
4
5
  id: ExcalidrawElement["id"];
5
6
  /**
@@ -19,4 +20,5 @@ export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords,
19
20
  excalidrawContainer: HTMLDivElement | null;
20
21
  app: App;
21
22
  autoSelect?: boolean | undefined;
22
- }) => void;
23
+ }) => SubmitHandler;
24
+ export {};
@@ -15,3 +15,5 @@ export declare function radiansToDegrees(degrees: Radians): Degrees;
15
15
  * @returns TRUE if the provided angle is a right angle
16
16
  */
17
17
  export declare function isRightAngleRads(rads: Radians): boolean;
18
+ export declare function radiansBetweenAngles(a: Radians, min: Radians, max: Radians): boolean;
19
+ export declare function radiansDifference(a: Radians, b: Radians): Radians;
@@ -0,0 +1,3 @@
1
+ export declare const PRECISION = 0.0001;
2
+ export declare const LegendreGaussN24TValues: number[];
3
+ export declare const LegendreGaussN24CValues: number[];
@@ -8,6 +8,7 @@ import type { Curve, GlobalPoint, LineSegment, LocalPoint } from "./types";
8
8
  * @returns
9
9
  */
10
10
  export declare function curve<Point extends GlobalPoint | LocalPoint>(a: Point, b: Point, c: Point, d: Point): Curve<Point>;
11
+ export declare const bezierEquation: <Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, t: number) => Point;
11
12
  /**
12
13
  * Computes the intersection between a cubic spline and a line segment.
13
14
  */
@@ -38,3 +39,36 @@ export declare function curvePointDistance<Point extends GlobalPoint | LocalPoin
38
39
  * Determines if the parameter is a Curve
39
40
  */
40
41
  export declare function isCurve<P extends GlobalPoint | LocalPoint>(v: unknown): v is Curve<P>;
42
+ export declare function curveTangent<Point extends GlobalPoint | LocalPoint>([p0, p1, p2, p3]: Curve<Point>, t: number): import("./types").Vector;
43
+ export declare function curveCatmullRomQuadraticApproxPoints(points: GlobalPoint[], tension?: number): [GlobalPoint, GlobalPoint][] | undefined;
44
+ export declare function curveCatmullRomCubicApproxPoints<Point extends GlobalPoint | LocalPoint>(points: Point[], tension?: number): Curve<Point>[] | undefined;
45
+ export declare function curveOffsetPoints([p0, p1, p2, p3]: Curve<GlobalPoint>, offset: number, steps?: number): GlobalPoint[];
46
+ export declare function offsetPointsForQuadraticBezier(p0: GlobalPoint, p1: GlobalPoint, p2: GlobalPoint, offsetDist: number, steps?: number): GlobalPoint[];
47
+ /**
48
+ * Implementation based on Legendre-Gauss quadrature for more accurate arc
49
+ * length calculation.
50
+ *
51
+ * Reference: https://pomax.github.io/bezierinfo/#arclength
52
+ *
53
+ * @param c The curve to calculate the length of
54
+ * @returns The approximated length of the curve
55
+ */
56
+ export declare function curveLength<P extends GlobalPoint | LocalPoint>(c: Curve<P>): number;
57
+ /**
58
+ * Calculates the curve length from t=0 to t=parameter using the same
59
+ * Legendre-Gauss quadrature method used in curveLength
60
+ *
61
+ * @param c The curve to calculate the partial length for
62
+ * @param t The parameter value (0 to 1) to calculate length up to
63
+ * @returns The length of the curve from beginning to parameter t
64
+ */
65
+ export declare function curveLengthAtParameter<P extends GlobalPoint | LocalPoint>(c: Curve<P>, t: number): number;
66
+ /**
67
+ * Calculates the point at a specific percentage of a curve's total length
68
+ * using binary search for improved efficiency and accuracy.
69
+ *
70
+ * @param c The curve to calculate point on
71
+ * @param percent A value between 0 and 1 representing the percentage of the curve's length
72
+ * @returns The point at the specified percentage of curve length
73
+ */
74
+ export declare function curvePointAtLength<P extends GlobalPoint | LocalPoint>(c: Curve<P>, percent: number): P;
@@ -1,5 +1,6 @@
1
1
  export * from "./angle";
2
2
  export * from "./curve";
3
+ export * from "./ellipse";
3
4
  export * from "./line";
4
5
  export * from "./point";
5
6
  export * from "./polygon";
@@ -43,7 +43,7 @@ export declare function isPoint(p: unknown): p is LocalPoint | GlobalPoint;
43
43
  * @param b Point The second point to compare
44
44
  * @returns TRUE if the points are sufficiently close to each other
45
45
  */
46
- export declare function pointsEqual<Point extends GlobalPoint | LocalPoint>(a: Point, b: Point): boolean;
46
+ export declare function pointsEqual<Point extends GlobalPoint | LocalPoint>(a: Point, b: Point, tolerance?: number): boolean;
47
47
  /**
48
48
  * Rotate a point by [angle] radians.
49
49
  *
@@ -1,3 +1,5 @@
1
1
  import type { GlobalPoint, LineSegment, LocalPoint, Rectangle } from "./types";
2
2
  export declare function rectangle<P extends GlobalPoint | LocalPoint>(topLeft: P, bottomRight: P): Rectangle<P>;
3
+ export declare function rectangleFromNumberSequence<Point extends LocalPoint | GlobalPoint>(minX: number, minY: number, maxX: number, maxY: number): Rectangle<Point>;
3
4
  export declare function rectangleIntersectLineSegment<Point extends LocalPoint | GlobalPoint>(r: Rectangle<Point>, l: LineSegment<Point>): Point[];
5
+ export declare function rectangleIntersectRectangle<Point extends LocalPoint | GlobalPoint>(rectangle1: Rectangle<Point>, rectangle2: Rectangle<Point>): boolean;
@@ -37,3 +37,4 @@ export declare const distanceToLineSegment: <Point extends GlobalPoint | LocalPo
37
37
  * @returns
38
38
  */
39
39
  export declare function lineSegmentIntersectionPoints<Point extends GlobalPoint | LocalPoint>(l: LineSegment<Point>, s: LineSegment<Point>, threshold?: number): Point | null;
40
+ export declare function lineSegmentsDistance<Point extends GlobalPoint | LocalPoint>(s1: LineSegment<Point>, s2: LineSegment<Point>): number;
@@ -12,9 +12,11 @@ export declare function vector(x: number, y: number, originX?: number, originY?:
12
12
  *
13
13
  * @param p The point to turn into a vector
14
14
  * @param origin The origin point in a given coordiante system
15
- * @returns The created vector from the point and the origin
15
+ * @param threshold The threshold to consider the vector as 'undefined'
16
+ * @param defaultValue The default value to return if the vector is 'undefined'
17
+ * @returns The created vector from the point and the origin or default
16
18
  */
17
- export declare function vectorFromPoint<Point extends GlobalPoint | LocalPoint>(p: Point, origin?: Point): Vector;
19
+ export declare function vectorFromPoint<Point extends GlobalPoint | LocalPoint>(p: Point, origin?: Point, threshold?: number, defaultValue?: Vector): Vector;
18
20
  /**
19
21
  * Cross product is a binary operation on two vectors in 2D space.
20
22
  * It results in a vector that is perpendicular to both vectors.
@@ -86,3 +88,7 @@ export declare function vectorMagnitude(v: Vector): number;
86
88
  * @returns The new normalized vector
87
89
  */
88
90
  export declare const vectorNormalize: (v: Vector) => Vector;
91
+ /**
92
+ * Calculate the right-hand normal of the vector.
93
+ */
94
+ export declare const vectorNormal: (v: Vector) => Vector;
@@ -1,5 +1,5 @@
1
1
  import { type GlobalPoint, type LocalPoint } from "@excalidraw/math";
2
- import type { Bounds } from "@excalidraw/element/bounds";
2
+ import type { Bounds } from "@excalidraw/element";
3
3
  export type LineSegment<P extends LocalPoint | GlobalPoint> = [P, P];
4
4
  export declare function getBBox<P extends LocalPoint | GlobalPoint>(line: LineSegment<P>): Bounds;
5
5
  export declare function doBBoxesIntersect(a: Bounds, b: Bounds): boolean;
@@ -1,4 +1,4 @@
1
1
  export * from "./export";
2
2
  export * from "./withinBounds";
3
3
  export * from "./bbox";
4
- export { getCommonBounds } from "@excalidraw/element/bounds";
4
+ export { getCommonBounds } from "@excalidraw/element";
@@ -1,4 +1,4 @@
1
- import type { Bounds } from "@excalidraw/element/bounds";
1
+ import type { Bounds } from "@excalidraw/element";
2
2
  import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
3
3
  type Element = NonDeletedExcalidrawElement;
4
4
  type Elements = readonly NonDeletedExcalidrawElement[];
@@ -1,17 +0,0 @@
1
- import type { EmbedsValidationStatus } from "@excalidraw/excalidraw/types";
2
- import type { ExcalidrawElement, NonDeletedExcalidrawElement, ExcalidrawSelectionElement } from "./types";
3
- import type { Drawable, Options } from "roughjs/bin/core";
4
- import type { RoughGenerator } from "roughjs/bin/generator";
5
- export declare const generateRoughOptions: (element: ExcalidrawElement, continuousPath?: boolean) => Options;
6
- /**
7
- * Generates the roughjs shape for given element.
8
- *
9
- * Low-level. Use `ShapeCache.generateElementShape` instead.
10
- *
11
- * @private
12
- */
13
- export declare const _generateElementShape: (element: Exclude<NonDeletedExcalidrawElement, ExcalidrawSelectionElement>, generator: RoughGenerator, { isExporting, canvasBackgroundColor, embedsValidationStatus, }: {
14
- isExporting: boolean;
15
- canvasBackgroundColor: string;
16
- embedsValidationStatus: EmbedsValidationStatus | null;
17
- }) => Drawable | Drawable[] | null;
@@ -1,25 +0,0 @@
1
- import type { AppState, EmbedsValidationStatus } from "@excalidraw/excalidraw/types";
2
- import type { ElementShape, ElementShapes } from "@excalidraw/excalidraw/scene/types";
3
- import type { ExcalidrawElement } from "./types";
4
- import type { Drawable } from "roughjs/bin/core";
5
- export declare class ShapeCache {
6
- private static rg;
7
- private static cache;
8
- /**
9
- * Retrieves shape from cache if available. Use this only if shape
10
- * is optional and you have a fallback in case it's not cached.
11
- */
12
- static get: <T extends ExcalidrawElement>(element: T) => T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : ElementShape | undefined;
13
- static set: <T extends ExcalidrawElement>(element: T, shape: T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable) => WeakMap<ExcalidrawElement, ElementShape>;
14
- static delete: (element: ExcalidrawElement) => boolean;
15
- static destroy: () => void;
16
- /**
17
- * Generates & caches shape for element if not already cached, otherwise
18
- * returns cached shape.
19
- */
20
- static generateElementShape: <T extends import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawEmbeddableElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawTextElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawLinearElement | import("./types").ExcalidrawArrowElement | import("./types").ExcalidrawFreeDrawElement>(element: T, renderConfig: {
21
- isExporting: boolean;
22
- canvasBackgroundColor: AppState["viewBackgroundColor"];
23
- embedsValidationStatus: EmbedsValidationStatus;
24
- } | null) => ((T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : ElementShape | undefined) & ({} | null)) | (T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable | null);
25
- }