@excalidraw/element 0.18.0-2874f9e → 0.18.0-2a82821

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 (144) hide show
  1. package/dist/dev/index.js +5228 -4610
  2. package/dist/dev/index.js.map +4 -4
  3. package/dist/prod/index.js +19 -18
  4. package/dist/types/common/src/appEventBus.d.ts +27 -0
  5. package/dist/types/common/src/colors.d.ts +2 -2
  6. package/dist/types/common/src/constants.d.ts +9 -7
  7. package/dist/types/common/src/index.d.ts +2 -0
  8. package/dist/types/common/src/utils.d.ts +1 -3
  9. package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
  10. package/dist/types/element/src/Scene.d.ts +7 -3
  11. package/dist/types/element/src/arrowheads.d.ts +3 -0
  12. package/dist/types/element/src/binding.d.ts +3 -4
  13. package/dist/types/element/src/bounds.d.ts +22 -3
  14. package/dist/types/element/src/comparisons.d.ts +1 -0
  15. package/dist/types/element/src/duplicate.d.ts +1 -0
  16. package/dist/types/element/src/elbowArrow.d.ts +2 -0
  17. package/dist/types/element/src/frame.d.ts +7 -6
  18. package/dist/types/element/src/index.d.ts +1 -0
  19. package/dist/types/element/src/linearElementEditor.d.ts +5 -2
  20. package/dist/types/element/src/mutateElement.d.ts +2 -0
  21. package/dist/types/element/src/newElement.d.ts +1 -0
  22. package/dist/types/element/src/selection.d.ts +7 -3
  23. package/dist/types/element/src/shape.d.ts +1 -1
  24. package/dist/types/element/src/textElement.d.ts +1 -1
  25. package/dist/types/element/src/textWrapping.d.ts +26 -0
  26. package/dist/types/element/src/typeChecks.d.ts +1 -0
  27. package/dist/types/element/src/types.d.ts +11 -2
  28. package/dist/types/element/src/utils.d.ts +2 -2
  29. package/dist/types/element/src/visualdebug.d.ts +1 -2
  30. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +35 -38
  31. package/dist/types/excalidraw/actions/actionBoundText.d.ts +25 -27
  32. package/dist/types/excalidraw/actions/actionCanvas.d.ts +144 -156
  33. package/dist/types/excalidraw/actions/actionClipboard.d.ts +24 -26
  34. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +12 -13
  35. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +36 -39
  36. package/dist/types/excalidraw/actions/actionDeselect.d.ts +160 -0
  37. package/dist/types/excalidraw/actions/actionElementLink.d.ts +8 -13
  38. package/dist/types/excalidraw/actions/actionElementLock.d.ts +24 -26
  39. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +12 -13
  40. package/dist/types/excalidraw/actions/actionExport.d.ts +67 -349
  41. package/dist/types/excalidraw/actions/actionFrame.d.ts +49 -52
  42. package/dist/types/excalidraw/actions/actionGroup.d.ts +25 -27
  43. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +13 -13
  44. package/dist/types/excalidraw/actions/actionLink.d.ts +12 -13
  45. package/dist/types/excalidraw/actions/actionMenu.d.ts +8 -13
  46. package/dist/types/excalidraw/actions/actionProperties.d.ts +36 -29
  47. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +12 -13
  48. package/dist/types/excalidraw/actions/actionStyles.d.ts +12 -12
  49. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
  50. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +173 -0
  51. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +12 -13
  52. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +173 -0
  53. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +12 -13
  54. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +8 -13
  55. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +12 -13
  56. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +12 -13
  57. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +12 -13
  58. package/dist/types/excalidraw/actions/index.d.ts +4 -1
  59. package/dist/types/excalidraw/actions/types.d.ts +1 -1
  60. package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
  61. package/dist/types/excalidraw/appState.d.ts +6 -2
  62. package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -0
  63. package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
  64. package/dist/types/excalidraw/charts/charts.helpers.d.ts +32 -0
  65. package/dist/types/excalidraw/charts/charts.line.d.ts +2 -0
  66. package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
  67. package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -0
  68. package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
  69. package/dist/types/excalidraw/charts/index.d.ts +7 -0
  70. package/dist/types/excalidraw/clipboard.d.ts +2 -5
  71. package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
  72. package/dist/types/excalidraw/components/App.d.ts +54 -14
  73. package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
  74. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
  75. package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
  76. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +1 -1
  77. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
  78. package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
  79. package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
  80. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
  81. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
  82. package/dist/types/excalidraw/components/Range.d.ts +10 -4
  83. package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
  84. package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
  85. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
  86. package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
  87. package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +4 -4
  88. package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
  89. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +4 -1
  90. package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
  91. package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +3 -3
  92. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
  93. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
  94. package/dist/types/excalidraw/components/Toast.d.ts +8 -4
  95. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -1
  96. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +1 -0
  97. package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
  98. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -1
  99. package/dist/types/excalidraw/components/icons.d.ts +19 -8
  100. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +9 -3
  101. package/dist/types/excalidraw/components/shapes.d.ts +7 -0
  102. package/dist/types/excalidraw/data/blob.d.ts +31 -34
  103. package/dist/types/excalidraw/data/filesystem.d.ts +3 -5
  104. package/dist/types/excalidraw/data/index.d.ts +2 -3
  105. package/dist/types/excalidraw/data/json.d.ts +30 -23
  106. package/dist/types/excalidraw/data/library.d.ts +1 -1
  107. package/dist/types/excalidraw/data/resave.d.ts +7 -2
  108. package/dist/types/excalidraw/eraser/index.d.ts +2 -3
  109. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
  110. package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
  111. package/dist/types/excalidraw/lasso/index.d.ts +2 -3
  112. package/dist/types/excalidraw/renderer/animation.d.ts +4 -1
  113. package/dist/types/excalidraw/scene/Renderer.d.ts +426 -19
  114. package/dist/types/excalidraw/scene/index.d.ts +1 -1
  115. package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
  116. package/dist/types/excalidraw/types.d.ts +110 -18
  117. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +5 -1
  118. package/dist/types/fractional-indexing/src/index.d.ts +29 -0
  119. package/dist/types/laser-pointer/src/index.d.ts +2 -0
  120. package/dist/types/laser-pointer/src/math.d.ts +16 -0
  121. package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
  122. package/dist/types/laser-pointer/src/state.d.ts +35 -0
  123. package/dist/types/math/src/constants.d.ts +0 -1
  124. package/dist/types/math/src/curve.d.ts +4 -1
  125. package/dist/types/math/src/point.d.ts +2 -1
  126. package/dist/types/utils/src/index.d.ts +1 -2
  127. package/package.json +4 -3
  128. package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
  129. package/dist/types/excalidraw/charts.d.ts +0 -27
  130. package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
  131. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -15
  132. package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
  133. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -8
  134. package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +0 -24
  135. package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
  136. package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -11
  137. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
  138. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
  139. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -84
  140. package/dist/types/excalidraw/data/reconcile.d.ts +0 -7
  141. package/dist/types/excalidraw/index.d.ts +0 -47
  142. package/dist/types/excalidraw/polyfill.d.ts +0 -2
  143. package/dist/types/utils/src/bbox.d.ts +0 -9
  144. package/dist/types/utils/src/withinBounds.d.ts +0 -19
@@ -0,0 +1,27 @@
1
+ import type { UnsubscribeCallback } from "@excalidraw/excalidraw/types";
2
+ export type AppEventPayloadMap = Record<string, unknown[]>;
3
+ export type AppEventBehavior = {
4
+ cardinality: "once" | "many";
5
+ replay: "none" | "last";
6
+ };
7
+ export type AppEventBehaviorMap<Events extends AppEventPayloadMap> = {
8
+ [K in keyof Events]: AppEventBehavior;
9
+ };
10
+ type AwaitableAppEventKeys<Events extends AppEventPayloadMap, Behavior extends AppEventBehaviorMap<Events>> = {
11
+ [K in keyof Events]: Behavior[K]["cardinality"] extends "once" ? Behavior[K]["replay"] extends "last" ? K : never : never;
12
+ }[keyof Events];
13
+ type AppEventPromiseValue<Args extends any[]> = Args extends [infer Only] ? Only : Args;
14
+ export declare class AppEventBus<Events extends AppEventPayloadMap, Behavior extends AppEventBehaviorMap<Events>> {
15
+ private readonly behavior;
16
+ private readonly emitters;
17
+ private readonly lastPayload;
18
+ private readonly emittedOnce;
19
+ constructor(behavior: Behavior);
20
+ private getEmitter;
21
+ private toPromiseValue;
22
+ on<K extends keyof Events>(name: K, callback: (...args: Events[K]) => void): UnsubscribeCallback;
23
+ on<K extends AwaitableAppEventKeys<Events, Behavior>>(name: K): Promise<AppEventPromiseValue<Events[K]>>;
24
+ emit<K extends keyof Events>(name: K, ...args: Events[K]): void;
25
+ clear(): void;
26
+ }
27
+ export {};
@@ -1,4 +1,4 @@
1
- export declare const applyDarkModeFilter: (color: string) => string;
1
+ export declare const applyDarkModeFilter: (color: string, enable?: boolean) => string;
2
2
  export type ColorTuple = readonly [string, string, string, string, string];
3
3
  export type ColorPaletteCustom = {
4
4
  [key: string]: ColorTuple | string;
@@ -65,7 +65,7 @@ export declare const DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE: {
65
65
  readonly black: "#1e1e1e";
66
66
  readonly bronze: readonly ["#f8f1ee", "#eaddd7", "#d2bab0", "#a18072", "#846358"];
67
67
  };
68
- export declare const getAllColorsSpecificShade: (index: 0 | 1 | 2 | 3 | 4) => readonly ["#e3fafc" | "#99e9f2" | "#3bc9db" | "#15aabf" | "#0c8599", "#e7f5ff" | "#a5d8ff" | "#4dabf7" | "#228be6" | "#1971c2", "#f3f0ff" | "#d0bfff" | "#9775fa" | "#7950f2" | "#6741d9", "#f8f0fc" | "#eebefa" | "#da77f2" | "#be4bdb" | "#9c36b5", "#fff0f6" | "#fcc2d7" | "#f783ac" | "#e64980" | "#c2255c", "#ebfbee" | "#b2f2bb" | "#69db7c" | "#40c057" | "#2f9e44", "#e6fcf5" | "#96f2d7" | "#38d9a9" | "#12b886" | "#099268", "#fff9db" | "#ffec99" | "#ffd43b" | "#fab005" | "#f08c00", "#fff4e6" | "#ffd8a8" | "#ffa94d" | "#fd7e14" | "#e8590c", "#fff5f5" | "#ffc9c9" | "#ff8787" | "#fa5252" | "#e03131"];
68
+ export declare const getAllColorsSpecificShade: (index: 0 | 1 | 2 | 3 | 4) => ("#fff5f5" | "#ffc9c9" | "#ff8787" | "#fa5252" | "#e03131" | "#fff0f6" | "#fcc2d7" | "#f783ac" | "#e64980" | "#c2255c" | "#f8f0fc" | "#eebefa" | "#da77f2" | "#be4bdb" | "#9c36b5" | "#f3f0ff" | "#d0bfff" | "#9775fa" | "#7950f2" | "#6741d9" | "#e7f5ff" | "#a5d8ff" | "#4dabf7" | "#228be6" | "#1971c2" | "#e3fafc" | "#99e9f2" | "#3bc9db" | "#15aabf" | "#0c8599" | "#e6fcf5" | "#96f2d7" | "#38d9a9" | "#12b886" | "#099268" | "#ebfbee" | "#b2f2bb" | "#69db7c" | "#40c057" | "#2f9e44" | "#fff9db" | "#ffec99" | "#ffd43b" | "#fab005" | "#f08c00" | "#fff4e6" | "#ffd8a8" | "#ffa94d" | "#fd7e14" | "#e8590c")[];
69
69
  export declare const rgbToHex: (r: number, g: number, b: number, a?: number) => string;
70
70
  /**
71
71
  * @returns #RRGGBB or #RRGGBBAA based on color containing non-opaque alpha,
@@ -240,8 +240,7 @@ export declare const DEFAULT_UI_OPTIONS: AppProps["UIOptions"];
240
240
  export declare const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
241
241
  export declare const EXPORT_SCALES: number[];
242
242
  export declare const DEFAULT_EXPORT_PADDING = 10;
243
- export declare const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 1440;
244
- export declare const MAX_ALLOWED_FILE_BYTES: number;
243
+ export declare const DEFAULT_IMAGE_OPTIONS: AppProps["imageOptions"];
245
244
  export declare const SVG_NS = "http://www.w3.org/2000/svg";
246
245
  export declare const SVG_DOCUMENT_PREAMBLE = "<?xml version=\"1.0\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n";
247
246
  export declare const ENCRYPTION_KEY_BITS = 128;
@@ -275,11 +274,12 @@ export declare const ROUGHNESS: {
275
274
  readonly artist: 1;
276
275
  readonly cartoonist: 2;
277
276
  };
278
- export declare const STROKE_WIDTH: {
279
- readonly thin: 1;
280
- readonly bold: 2;
281
- readonly extraBold: 4;
282
- };
277
+ export type StrokeWidthKey = "thin" | "medium" | "bold";
278
+ export declare const STROKE_WIDTH_KEYS: readonly StrokeWidthKey[];
279
+ export declare const STROKE_WIDTH: Readonly<Record<StrokeWidthKey | "extraBold", ExcalidrawElement["strokeWidth"]>>;
280
+ export declare const FREEDRAW_STROKE_WIDTH: Readonly<Record<StrokeWidthKey | "extraBold", ExcalidrawElement["strokeWidth"]>>;
281
+ export declare const getStrokeWidthByKey: (elementType: ExcalidrawElement["type"], strokeWidthKey: StrokeWidthKey) => ExcalidrawElement["strokeWidth"];
282
+ export declare const DEFAULT_ELEMENT_STROKE_WIDTH_KEY: StrokeWidthKey;
283
283
  export declare const DEFAULT_ELEMENT_PROPS: {
284
284
  strokeColor: ExcalidrawElement["strokeColor"];
285
285
  backgroundColor: ExcalidrawElement["backgroundColor"];
@@ -353,3 +353,5 @@ export declare const BIND_MODE_TIMEOUT = 700;
353
353
  export declare const MOBILE_ACTION_BUTTON_BG: {
354
354
  readonly background: "var(--mobile-action-button-bg)";
355
355
  };
356
+ export declare const DEFAULT_STROKE_STREAMLINE = 0.5;
357
+ export declare const DEFAULT_STROKE_STREAMLINE_PRECISE = 0.2;
@@ -11,5 +11,7 @@ export * from "./random";
11
11
  export * from "./url";
12
12
  export * from "./utils";
13
13
  export * from "./emitter";
14
+ export * from "./appEventBus";
14
15
  export * from "./editorInterface";
16
+ export * from "./versionedSnapshotStore";
15
17
  export { Debug } from "../debug";
@@ -25,9 +25,7 @@ export declare const debounce: <T extends any[]>(fn: (...args: T) => void, timeo
25
25
  flush(): void;
26
26
  cancel(): void;
27
27
  };
28
- export declare const throttleRAF: <T extends any[]>(fn: (...args: T) => void, opts?: {
29
- trailing?: boolean;
30
- }) => {
28
+ export declare const throttleRAF: <T extends any[]>(fn: (...args: T) => void) => {
31
29
  (...args: T): void;
32
30
  flush(): void;
33
31
  cancel(): void;
@@ -0,0 +1,17 @@
1
+ export type VersionedSnapshot<T> = Readonly<{
2
+ version: number;
3
+ value: T;
4
+ }>;
5
+ export declare class VersionedSnapshotStore<T> {
6
+ private readonly isEqual;
7
+ private version;
8
+ private value;
9
+ private readonly waiters;
10
+ private readonly subscribers;
11
+ constructor(initialValue: T, isEqual?: (prev: T, next: T) => boolean);
12
+ getSnapshot(): VersionedSnapshot<T>;
13
+ set(nextValue: T): boolean;
14
+ update(updater: (prev: T) => T): boolean;
15
+ subscribe(subscriber: (snapshot: VersionedSnapshot<T>) => void): () => void;
16
+ pull(sinceVersion?: number): Promise<VersionedSnapshot<T>>;
17
+ }
@@ -63,10 +63,12 @@ export declare class Scene {
63
63
  triggerUpdate(): void;
64
64
  onUpdate(cb: SceneStateCallback): SceneStateCallbackRemover;
65
65
  destroy(): void;
66
- insertElementAtIndex(element: ExcalidrawElement, index: number): void;
67
- insertElementsAtIndex(elements: ExcalidrawElement[], index: number): void;
66
+ /** low-level - generally use app.insertNewElements() */
67
+ insertElementsAtIndex(elements: ExcalidrawElement[],
68
+ /** null indicates end of the array */
69
+ index: number | null): void;
70
+ /** low-level - generally use app.insertNewElement() */
68
71
  insertElement: (element: ExcalidrawElement) => void;
69
- insertElements: (elements: ExcalidrawElement[]) => void;
70
72
  getElementIndex(elementId: string): number;
71
73
  getContainerElement: (element: (ExcalidrawElement & {
72
74
  containerId: ExcalidrawElement["id"] | null;
@@ -75,6 +77,8 @@ export declare class Scene {
75
77
  mutateElement<TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, options?: {
76
78
  informMutation: boolean;
77
79
  isDragging: boolean;
80
+ isBindingEnabled?: boolean;
81
+ isMidpointSnappingEnabled?: boolean;
78
82
  }): TElement;
79
83
  }
80
84
  export {};
@@ -0,0 +1,3 @@
1
+ import type { Arrowhead, AnyArrowhead } from "./types";
2
+ export declare const normalizeArrowhead: (arrowhead: AnyArrowhead | null | undefined) => Arrowhead | null;
3
+ export declare const getArrowheadForPicker: (arrowhead: AnyArrowhead | null | undefined) => Arrowhead | null;
@@ -30,7 +30,6 @@ export declare const BASE_ARROW_MIN_LENGTH = 10;
30
30
  export declare const FOCUS_POINT_SIZE: number;
31
31
  export declare const getBindingGap: (bindTarget: ExcalidrawBindableElement, opts: Pick<ExcalidrawArrowElement, "elbowed">) => number;
32
32
  export declare const maxBindingDistance_simple: (zoom?: AppState["zoom"]) => number;
33
- export declare const shouldEnableBindingForPointerEvent: (event: React.PointerEvent<HTMLElement>) => boolean;
34
33
  export declare const isBindingEnabled: (appState: {
35
34
  isBindingEnabled: AppState["isBindingEnabled"];
36
35
  }) => boolean;
@@ -55,7 +54,7 @@ export declare const getBindingStrategyForDraggingBindingElementEndpoints: (arro
55
54
  end: BindingStrategy;
56
55
  };
57
56
  export declare const bindOrUnbindBindingElements: (selectedArrows: NonDeleted<ExcalidrawArrowElement>[], scene: Scene, appState: AppState) => void;
58
- export declare const bindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, hoveredElement: ExcalidrawBindableElement, mode: BindMode, startOrEnd: "start" | "end", scene: Scene, focusPoint?: GlobalPoint) => void;
57
+ export declare const bindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, hoveredElement: ExcalidrawBindableElement, mode: BindMode, startOrEnd: "start" | "end", scene: Scene, focusPoint?: GlobalPoint, shouldSnapToOutline?: boolean) => void;
59
58
  export declare const unbindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, startOrEnd: "start" | "end", scene: Scene) => ExcalidrawBindableElement["id"] | null;
60
59
  export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, scene: Scene, options?: {
61
60
  simultaneouslyUpdated?: readonly ExcalidrawElement[];
@@ -69,11 +68,11 @@ export declare const updateBindings: (latestElement: ExcalidrawElement, scene: S
69
68
  };
70
69
  }) => void;
71
70
  export declare const getHeadingForElbowArrowSnap: (p: Readonly<GlobalPoint>, otherPoint: Readonly<GlobalPoint>, bindableElement: ExcalidrawBindableElement | undefined | null, aabb: Bounds | undefined | null, origPoint: GlobalPoint, elementsMap: ElementsMap, zoom?: AppState["zoom"]) => Heading;
72
- export declare const bindPointToSnapToElementOutline: (arrowElement: ExcalidrawArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, customIntersector?: LineSegment<GlobalPoint>) => GlobalPoint;
71
+ export declare const bindPointToSnapToElementOutline: (arrowElement: ExcalidrawArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, customIntersector?: LineSegment<GlobalPoint>, isMidpointSnappingEnabled?: boolean) => GlobalPoint;
73
72
  export declare const avoidRectangularCorner: (arrowElement: ExcalidrawArrowElement, bindTarget: ExcalidrawBindableElement, elementsMap: ElementsMap, p: GlobalPoint) => GlobalPoint;
74
73
  export declare const snapToMid: (bindTarget: ExcalidrawBindableElement, elementsMap: ElementsMap, p: GlobalPoint, tolerance?: number, arrowElement?: ExcalidrawArrowElement) => GlobalPoint | undefined;
75
74
  export declare const updateBoundPoint: (arrow: NonDeleted<ExcalidrawArrowElement>, startOrEnd: "startBinding" | "endBinding", binding: FixedPointBinding | null | undefined, bindableElement: ExcalidrawBindableElement, elementsMap: ElementsMap, dragging?: boolean) => LocalPoint | null;
76
- export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap) => {
75
+ export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, shouldSnapToOutline?: boolean, isMidpointSnappingEnabled?: boolean) => {
77
76
  fixedPoint: FixedPoint;
78
77
  };
79
78
  export declare const calculateFixedPointForNonElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, focusPoint?: GlobalPoint) => {
@@ -2,7 +2,7 @@ import { type Bounds } from "@excalidraw/common";
2
2
  import type { Degrees, GlobalPoint, LineSegment, LocalPoint } from "@excalidraw/math";
3
3
  import type { AppState } from "@excalidraw/excalidraw/types";
4
4
  import type { Drawable, Op } from "roughjs/bin/core";
5
- import type { Arrowhead, ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawFreeDrawElement, ExcalidrawLinearElement, NonDeleted } from "./types";
5
+ import type { Arrowhead, ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawLinearElement, NonDeleted, NonDeletedExcalidrawElement } from "./types";
6
6
  export type RectangleBox = {
7
7
  x: number;
8
8
  y: number;
@@ -38,12 +38,12 @@ export declare const getRectangleBoxAbsoluteCoords: (boxSceneCoords: RectangleBo
38
38
  export declare const getDiamondPoints: (element: ExcalidrawElement) => number[];
39
39
  export declare const getCubicBezierCurveBound: (p0: GlobalPoint, p1: GlobalPoint, p2: GlobalPoint, p3: GlobalPoint) => Bounds;
40
40
  export declare const getMinMaxXYFromCurvePathOps: (ops: Op[], transformXY?: (p: GlobalPoint) => GlobalPoint) => Bounds;
41
- export declare const getBoundsFromPoints: (points: ExcalidrawFreeDrawElement["points"]) => Bounds;
41
+ export declare const getBoundsFromPoints: <P extends GlobalPoint | LocalPoint>(points: readonly P[], padding?: number) => Bounds;
42
42
  /** @returns number in pixels */
43
43
  export declare const getArrowheadSize: (arrowhead: Arrowhead) => number;
44
44
  /** @returns number in degrees */
45
45
  export declare const getArrowheadAngle: (arrowhead: Arrowhead) => Degrees;
46
- export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead) => number[] | null;
46
+ export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead, offsetMultiplier?: number) => number[] | null;
47
47
  export declare const getElementBounds: (element: ExcalidrawElement, elementsMap: ElementsMap, nonRotated?: boolean) => Bounds;
48
48
  export declare const getCommonBounds: (elements: ElementsMapOrArray, elementsMap?: ElementsMap) => Bounds;
49
49
  export declare const getDraggedElementsBounds: (elements: ExcalidrawElement[], dragOffset: {
@@ -77,5 +77,24 @@ export declare const getCenterForBounds: (bounds: Bounds) => GlobalPoint;
77
77
  */
78
78
  export declare const aabbForElement: (element: Readonly<ExcalidrawElement>, elementsMap: ElementsMap, offset?: [number, number, number, number]) => Bounds;
79
79
  export declare const pointInsideBounds: <P extends GlobalPoint | LocalPoint>(p: P, bounds: Bounds) => boolean;
80
+ export declare const pointInsideBoundsInclusive: <P extends GlobalPoint | LocalPoint>(p: P, bounds: Bounds) => boolean;
80
81
  export declare const doBoundsIntersect: (bounds1: Bounds | null, bounds2: Bounds | null) => boolean;
82
+ export declare const boundsContainBounds: (outerBounds: Bounds, innerBounds: Bounds) => boolean;
83
+ /**
84
+ * High level helper to get elements overlapping a bounding box.
85
+ * It can be used to get elements overlapping a selection box, for example.
86
+ *
87
+ */
88
+ export declare const elementsOverlappingBBox: ({ elements, elementsMap, bounds, type, excludeElementsInFrames, shouldIgnoreElementFromSelection, }: {
89
+ elements: readonly NonDeletedExcalidrawElement[];
90
+ elementsMap?: ElementsMap;
91
+ bounds: Bounds | ExcalidrawElement;
92
+ /**
93
+ * - overlap: elements overlapping or inside bounds
94
+ * - contain: elements inside bounds
95
+ **/
96
+ type: "contain" | "overlap";
97
+ excludeElementsInFrames?: boolean;
98
+ shouldIgnoreElementFromSelection?: (element: NonDeletedExcalidrawElement) => boolean;
99
+ }) => NonDeletedExcalidrawElement[];
81
100
  export declare const elementCenterPoint: (element: ExcalidrawElement, elementsMap: ElementsMap, xOffset?: number, yOffset?: number) => GlobalPoint;
@@ -3,6 +3,7 @@ export declare const hasBackground: (type: ElementOrToolType) => type is "line"
3
3
  export declare const hasStrokeColor: (type: ElementOrToolType) => type is "line" | "arrow" | "text" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "freedraw";
4
4
  export declare const hasStrokeWidth: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw";
5
5
  export declare const hasStrokeStyle: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe";
6
+ export declare const hasFreedrawMode: (type: ElementOrToolType) => type is "freedraw";
6
7
  export declare const canChangeRoundness: (type: ElementOrToolType) => type is "line" | "rectangle" | "diamond" | "embeddable" | "iframe" | "image";
7
8
  export declare const toolIsArrow: (type: ElementOrToolType) => type is "arrow";
8
9
  export declare const canHaveArrowheads: (type: ElementOrToolType) => type is "arrow";
@@ -31,6 +31,7 @@ export declare const duplicateElements: (opts: {
31
31
  * user interaction.
32
32
  */
33
33
  type: "everything";
34
+ preserveFrameChildrenOrder?: boolean;
34
35
  } | {
35
36
  /**
36
37
  * Duplicates specified elements and inserts them back into the array
@@ -13,5 +13,7 @@ export declare const updateElbowArrowPoints: (arrow: Readonly<ExcalidrawElbowArr
13
13
  endBinding?: FixedPointBinding | null;
14
14
  }, options?: {
15
15
  isDragging?: boolean;
16
+ isBindingEnabled?: boolean;
17
+ isMidpointSnappingEnabled?: boolean;
16
18
  }) => ElementUpdate<ExcalidrawElbowArrowElement>;
17
19
  export declare const validateElbowPoints: <P extends GlobalPoint | LocalPoint>(points: readonly P[], tolerance?: number) => boolean;
@@ -36,17 +36,18 @@ export declare const omitPartialGroups: (elements: ExcalidrawElement[], frame: E
36
36
  export declare const getContainingFrame: (element: ExcalidrawElement, elementsMap: ElementsMap) => ExcalidrawFrameLikeElement | null;
37
37
  /** */
38
38
  export declare const filterElementsEligibleAsFrameChildren: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => ExcalidrawElement[];
39
+ export declare const getCommonFrameId: (elements: readonly ExcalidrawElement[]) => string | null;
40
+ export declare const getFrameChildrenInsertionIndex: (elements: readonly ExcalidrawElement[], frameId: ExcalidrawFrameLikeElement["id"]) => number | null;
39
41
  /**
40
- * Retains (or repairs for target frame) the ordering invriant where children
41
- * elements come right before the parent frame:
42
- * [el, el, child, child, frame, el]
42
+ * Adds elements and their bound elements to frame. Reorders added elements to
43
+ * be just below frame, or just above its highest child (whichever is higher).
43
44
  *
44
45
  * @returns mutated allElements (same data structure)
45
46
  */
46
- export declare const addElementsToFrame: <T extends ElementsMapOrArray>(allElements: T, elementsToAdd: NonDeletedExcalidrawElement[], frame: ExcalidrawFrameLikeElement, appState: AppState) => T;
47
+ export declare const addElementsToFrame: <T extends ElementsMapOrArray>(allElements: T, elementsToAdd: NonDeletedExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => T;
47
48
  export declare const removeElementsFromFrame: (elementsToRemove: ReadonlySetLike<NonDeletedExcalidrawElement>, elementsMap: ElementsMap) => void;
48
49
  export declare const removeAllElementsFromFrame: <T extends ExcalidrawElement>(allElements: readonly T[], frame: ExcalidrawFrameLikeElement) => readonly T[];
49
- export declare const replaceAllElementsInFrame: <T extends ExcalidrawElement>(allElements: readonly T[], nextElementsInFrame: ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, app: AppClassProperties) => T[];
50
+ export declare const replaceAllElementsInFrame: <T extends ExcalidrawElement>(allElements: readonly T[], nextElementsInFrame: ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => T[];
50
51
  /** does not mutate elements, but returns new ones */
51
52
  export declare const updateFrameMembershipOfSelectedElements: <T extends ElementsMapOrArray>(allElements: T, appState: AppState, app: AppClassProperties) => T;
52
53
  /**
@@ -70,5 +71,5 @@ export declare const isElementInFrame: (element: ExcalidrawElement, allElementsM
70
71
  export declare const shouldApplyFrameClip: (element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement, appState: StaticCanvasAppState, elementsMap: ElementsMap, checkedGroups?: Map<string, boolean>) => boolean;
71
72
  export declare const getDefaultFrameName: (element: ExcalidrawFrameLikeElement) => "Frame" | "AI Frame";
72
73
  export declare const getFrameLikeTitle: (element: ExcalidrawFrameLikeElement) => string;
73
- export declare const getElementsOverlappingFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => NonDeletedExcalidrawElement[];
74
+ export declare const getElementsOverlappingFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => ExcalidrawElement[];
74
75
  export declare const frameAndChildrenSelectedTogether: (selectedElements: readonly ExcalidrawElement[]) => boolean;
@@ -56,3 +56,4 @@ export * from "./typeChecks";
56
56
  export * from "./utils";
57
57
  export * from "./zindex";
58
58
  export * from "./arrows/helpers";
59
+ export * from "./arrowheads";
@@ -55,8 +55,8 @@ export declare class LinearElementEditor {
55
55
  x: number;
56
56
  y: number;
57
57
  }, appState: AppState, elementsMap: ElementsMap) => GlobalPoint | null;
58
- static isSegmentTooShort<P extends GlobalPoint | LocalPoint>(element: NonDeleted<ExcalidrawLinearElement>, startPoint: P, endPoint: P, index: number, zoom: Zoom): boolean;
59
- static getSegmentMidPoint(element: NonDeleted<ExcalidrawLinearElement>, index: number): GlobalPoint;
58
+ static isSegmentTooShort<P extends GlobalPoint | LocalPoint>(element: NonDeleted<ExcalidrawLinearElement>, startPoint: P, endPoint: P, index: number, zoom: Zoom, elementsMap: ElementsMap): boolean;
59
+ static getSegmentMidPoint(element: NonDeleted<ExcalidrawLinearElement>, index: number, elementsMap: ElementsMap): GlobalPoint;
60
60
  static getSegmentMidPointIndex(linearElementEditor: LinearElementEditor, appState: AppState, midPoint: GlobalPoint, elementsMap: ElementsMap): number;
61
61
  static handlePointerDown(event: React.PointerEvent<HTMLElement>, app: AppClassProperties, store: Store, scenePointer: {
62
62
  x: number;
@@ -96,6 +96,9 @@ export declare class LinearElementEditor {
96
96
  startBinding?: FixedPointBinding | null;
97
97
  endBinding?: FixedPointBinding | null;
98
98
  moveMidPointsWithElement?: boolean | null;
99
+ }, options?: {
100
+ isBindingEnabled?: boolean;
101
+ isMidpointSnappingEnabled?: boolean;
99
102
  }): void;
100
103
  static shouldAddMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState, elementsMap: ElementsMap): boolean;
101
104
  static addMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, app: AppClassProperties, snapToGrid: boolean, scene: Scene): {
@@ -11,6 +11,8 @@ export type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TEl
11
11
  */
12
12
  export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, elementsMap: ElementsMap, updates: ElementUpdate<TElement>, options?: {
13
13
  isDragging?: boolean;
14
+ isBindingEnabled?: boolean;
15
+ isMidpointSnappingEnabled?: boolean;
14
16
  }) => TElement;
15
17
  export declare const newElementWith: <TElement extends ExcalidrawElement>(element: TElement, updates: ElementUpdate<TElement>,
16
18
  /** pass `true` to always regenerate */
@@ -38,6 +38,7 @@ export declare const newFreeDrawElement: (opts: {
38
38
  type: "freedraw";
39
39
  points?: ExcalidrawFreeDrawElement["points"];
40
40
  simulatePressure: boolean;
41
+ strokeOptions?: ExcalidrawFreeDrawElement["strokeOptions"];
41
42
  pressures?: ExcalidrawFreeDrawElement["pressures"];
42
43
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawFreeDrawElement>;
43
44
  export declare const newLinearElement: (opts: {
@@ -1,6 +1,6 @@
1
- import type { AppState, InteractiveCanvasAppState } from "@excalidraw/excalidraw/types";
1
+ import type { AppState, BoxSelectionMode, InteractiveCanvasAppState } from "@excalidraw/excalidraw/types";
2
2
  import { LinearElementEditor } from "./linearElementEditor";
3
- import type { ElementsMap, ElementsMapOrArray, ExcalidrawElement, NonDeletedExcalidrawElement } from "./types";
3
+ import type { ElementsMap, ElementsMapOrArray, ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement } from "./types";
4
4
  /**
5
5
  * Frames and their containing elements are not to be selected at the same time.
6
6
  * Given an array of selected elements, if there are frames and their containing elements
@@ -8,7 +8,7 @@ import type { ElementsMap, ElementsMapOrArray, ExcalidrawElement, NonDeletedExca
8
8
  * @param selectedElements
9
9
  */
10
10
  export declare const excludeElementsInFramesFromSelection: <T extends ExcalidrawElement>(selectedElements: readonly T[]) => T[];
11
- export declare const getElementsWithinSelection: (elements: readonly NonDeletedExcalidrawElement[], selection: NonDeletedExcalidrawElement, elementsMap: ElementsMap, excludeElementsInFrames?: boolean) => NonDeletedExcalidrawElement[];
11
+ export declare const getElementsWithinSelection: (elements: readonly NonDeletedExcalidrawElement[], selection: NonDeletedExcalidrawElement, elementsMap: ElementsMap, excludeElementsInFrames?: boolean, boxSelectionMode?: BoxSelectionMode) => NonDeletedExcalidrawElement[];
12
12
  export declare const getVisibleAndNonSelectedElements: (elements: readonly NonDeletedExcalidrawElement[], selectedElements: readonly NonDeletedExcalidrawElement[], appState: AppState, elementsMap: ElementsMap) => NonDeletedExcalidrawElement[];
13
13
  export declare const isSomeElementSelected: {
14
14
  (elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds">): boolean;
@@ -32,3 +32,7 @@ export declare const getSelectionStateForElements: (targetElements: readonly Exc
32
32
  selectedGroupIds: AppState["selectedGroupIds"];
33
33
  selectedLinearElement: LinearElementEditor | null;
34
34
  };
35
+ /**
36
+ * Returns editing or single-selected text element, if any.
37
+ */
38
+ export declare const getActiveTextElement: (selectedElements: readonly NonDeleted<ExcalidrawElement>[], appState: Pick<AppState, "editingTextElement">) => import("./types").ExcalidrawTextElement | null;
@@ -27,7 +27,7 @@ export declare class ShapeCache {
27
27
  } | null) => ((T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : ElementShape | undefined) & {}) | (T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable | null);
28
28
  }
29
29
  export declare const generateRoughOptions: (element: ExcalidrawElement, continuousPath?: boolean, isDarkMode?: boolean) => Options;
30
- export declare const generateLinearCollisionShape: (element: ExcalidrawLinearElement | ExcalidrawFreeDrawElement) => {
30
+ export declare const generateLinearCollisionShape: (element: ExcalidrawLinearElement | ExcalidrawFreeDrawElement, elementsMap: ElementsMap) => {
31
31
  op: string;
32
32
  data: number[];
33
33
  }[];
@@ -31,7 +31,7 @@ export declare const suppportsHorizontalAlign: (selectedElements: NonDeletedExca
31
31
  declare const VALID_CONTAINER_TYPES: Set<string>;
32
32
  export declare const isValidTextContainer: (element: {
33
33
  type: ExcalidrawElementType;
34
- }) => boolean;
34
+ }) => element is ExcalidrawTextContainer;
35
35
  export declare const computeContainerDimensionForBoundText: (dimension: number, containerType: ExtractSetType<typeof VALID_CONTAINER_TYPES>) => number;
36
36
  export declare const getBoundTextMaxWidth: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElement | null) => number;
37
37
  export declare const getBoundTextMaxHeight: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer) => number;
@@ -5,9 +5,35 @@ import type { FontString } from "./types";
5
5
  export declare const containsCJK: (text: string) => boolean;
6
6
  /**
7
7
  * Breaks the line into the tokens based on the found line break opporutnities.
8
+ *
9
+ * Note: tokenization normalizes to NFC first so decomposed graphemes are treated as
10
+ * their composed variants for wrapping. Any code that needs exact source offsets should
11
+ * keep in mind that this assumes the input text is already NFC-normalized.
8
12
  */
9
13
  export declare const parseTokens: (line: string) => string[];
10
14
  /**
11
15
  * Wraps the original text into the lines based on the given width.
16
+ *
17
+ * This is a convenience adapter over `getWrappedTextLines()` for call sites
18
+ * that only need the rendered wrapped string and not the source offsets.
12
19
  */
13
20
  export declare const wrapText: (text: string, font: FontString, maxWidth: number) => string;
21
+ /**
22
+ * A single rendered visual line produced from the original text.
23
+ *
24
+ * `start` and `end` are end-exclusive code-unit offsets into the original text, and do
25
+ * not include synthetic soft line breaks inserted by this module. If trailing whitespace
26
+ * was trimmed away at a wrap boundary, `end` points to the last rendered character.
27
+ */
28
+ export type WrappedTextLine = {
29
+ text: string;
30
+ start: number;
31
+ end: number;
32
+ };
33
+ /**
34
+ * Returns the rendered visual lines together with their source offsets.
35
+ *
36
+ * This is the source-of-truth wrapping pipeline for callers that need more than the
37
+ * final wrapped string, for example caret placement or future editor/rich-text mapping.
38
+ */
39
+ export declare const getWrappedTextLines: (text: string, font: FontString, maxWidth: number) => WrappedTextLine[];
@@ -52,3 +52,4 @@ export declare const getLinearElementSubType: (element: ExcalidrawLinearElement)
52
52
  */
53
53
  export declare const isValidPolygon: (points: ExcalidrawLineElement["points"]) => boolean;
54
54
  export declare const canBecomePolygon: (points: ExcalidrawLineElement["points"]) => boolean;
55
+ export declare const isEligibleFrameChildType: (type: ElementOrToolType) => boolean;
@@ -1,7 +1,7 @@
1
1
  import type { LocalPoint, Radians } from "@excalidraw/math";
2
2
  import type { FONT_FAMILY, ROUNDNESS, TEXT_ALIGN, THEME, VERTICAL_ALIGN } from "@excalidraw/common";
3
3
  import type { MakeBrand, MarkNonNullable, Merge, ValueOf } from "@excalidraw/common/utility-types";
4
- export type ChartType = "bar" | "line";
4
+ export type ChartType = "bar" | "line" | "radar";
5
5
  export type FillStyle = "hachure" | "cross-hatch" | "solid" | "zigzag";
6
6
  export type FontFamilyKeys = keyof typeof FONT_FAMILY;
7
7
  export type FontFamilyValues = typeof FONT_FAMILY[FontFamilyKeys];
@@ -208,7 +208,10 @@ export type PointsPositionUpdates = Map<Index, {
208
208
  point: LocalPoint;
209
209
  isDragging?: boolean;
210
210
  }>;
211
- export type Arrowhead = "arrow" | "bar" | "dot" | "circle" | "circle_outline" | "triangle" | "triangle_outline" | "diamond" | "diamond_outline" | "crowfoot_one" | "crowfoot_many" | "crowfoot_one_or_many";
211
+ export type CardinalityArrowhead = "cardinality_one" | "cardinality_many" | "cardinality_one_or_many" | "cardinality_exactly_one" | "cardinality_zero_or_one" | "cardinality_zero_or_many";
212
+ export type ArrowheadLegacy = "dot" | "crowfoot_one" | "crowfoot_many" | "crowfoot_one_or_many";
213
+ export type Arrowhead = "arrow" | "bar" | "circle" | "circle_outline" | "triangle" | "triangle_outline" | "diamond" | "diamond_outline" | CardinalityArrowhead;
214
+ export type AnyArrowhead = Arrowhead | ArrowheadLegacy;
212
215
  export type ExcalidrawLinearElement = _ExcalidrawElementBase & Readonly<{
213
216
  type: "line" | "arrow";
214
217
  points: readonly LocalPoint[];
@@ -252,11 +255,17 @@ export type ExcalidrawElbowArrowElement = Merge<ExcalidrawArrowElement, {
252
255
  */
253
256
  endIsSpecial: boolean | null;
254
257
  }>;
258
+ export type StrokeVariability = "variable" | "constant";
259
+ export type StrokeOptions = Readonly<{
260
+ variability: StrokeVariability;
261
+ streamline: number;
262
+ }>;
255
263
  export type ExcalidrawFreeDrawElement = _ExcalidrawElementBase & Readonly<{
256
264
  type: "freedraw";
257
265
  points: readonly LocalPoint[];
258
266
  pressures: readonly number[];
259
267
  simulatePressure: boolean;
268
+ strokeOptions: StrokeOptions;
260
269
  }>;
261
270
  export type FileId = string & {
262
271
  _brand: "FileId";
@@ -8,7 +8,7 @@ import type { ElementsMap, ExcalidrawArrowElement, ExcalidrawBindableElement, Ex
8
8
  * @param element The linear element to deconstruct
9
9
  * @returns The rotated in components.
10
10
  */
11
- export declare function deconstructLinearOrFreeDrawElement(element: ExcalidrawLinearElement | ExcalidrawFreeDrawElement): [LineSegment<GlobalPoint>[], Curve<GlobalPoint>[]];
11
+ export declare function deconstructLinearOrFreeDrawElement(element: ExcalidrawLinearElement | ExcalidrawFreeDrawElement, elementsMap: ElementsMap): [LineSegment<GlobalPoint>[], Curve<GlobalPoint>[]];
12
12
  /**
13
13
  * Get the building components of a rectanguloid element in the form of
14
14
  * line segments and curves **unrotated**.
@@ -33,4 +33,4 @@ export declare const isPathALoop: (points: ExcalidrawLinearElement["points"],
33
33
  zoomValue?: Zoom["value"]) => boolean;
34
34
  export declare const getCornerRadius: (x: number, element: ExcalidrawElement) => number;
35
35
  export declare const getSnapOutlineMidPoint: (point: GlobalPoint, element: ExcalidrawBindableElement, elementsMap: ElementsMap, zoom: AppState["zoom"]) => GlobalPoint | undefined;
36
- export declare const projectFixedPointOntoDiagonal: (arrow: ExcalidrawArrowElement, point: GlobalPoint, element: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, zoom: AppState["zoom"]) => GlobalPoint | null;
36
+ export declare const projectFixedPointOntoDiagonal: (arrow: ExcalidrawArrowElement, point: GlobalPoint, element: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap, zoom: AppState["zoom"], isMidpointSnappingEnabled?: boolean) => GlobalPoint | null;
@@ -1,8 +1,7 @@
1
- import { type GlobalPoint, type LocalPoint } from "@excalidraw/math";
1
+ import { type GlobalPoint, type LocalPoint, type LineSegment } from "@excalidraw/math";
2
2
  import { type Bounds } from "@excalidraw/common";
3
3
  import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
4
4
  import type { Curve } from "@excalidraw/math";
5
- import type { LineSegment } from "@excalidraw/utils";
6
5
  declare global {
7
6
  interface Window {
8
7
  visualDebug?: {