@excalidraw/excalidraw 0.18.0-a18b139 → 0.18.0-a30e1b2

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 (97) hide show
  1. package/dist/dev/{chunk-X3RYHLJU.js → chunk-CARD3WJZ.js} +9 -4
  2. package/dist/dev/chunk-CARD3WJZ.js.map +7 -0
  3. package/dist/dev/{chunk-U3G3LY5D.js → chunk-ETWEPOFC.js} +7284 -6864
  4. package/dist/dev/chunk-ETWEPOFC.js.map +7 -0
  5. package/dist/dev/{chunk-MJMGTOVG.js → chunk-RS23HYC4.js} +2 -2
  6. package/dist/dev/data/{image-Y366K5SN.js → image-AYLHSOBV.js} +3 -3
  7. package/dist/dev/index.css +43 -2
  8. package/dist/dev/index.css.map +3 -3
  9. package/dist/dev/index.js +2959 -1807
  10. package/dist/dev/index.js.map +4 -4
  11. package/dist/dev/locales/{en-CKWC2GMK.js → en-E3O5XSXJ.js} +2 -2
  12. package/dist/dev/subset-shared.chunk.js +1 -1
  13. package/dist/dev/subset-worker.chunk.js +1 -1
  14. package/dist/prod/chunk-6BSJPDKJ.js +33 -0
  15. package/dist/prod/{chunk-IUH5AXLB.js → chunk-FGHASORR.js} +4 -4
  16. package/dist/prod/{chunk-VQA74LVG.js → chunk-SBKTMZM7.js} +1 -1
  17. package/dist/prod/data/image-VAYKYPXV.js +1 -0
  18. package/dist/prod/index.css +1 -1
  19. package/dist/prod/index.js +19 -18
  20. package/dist/prod/locales/{en-SBO6ZHT2.js → en-44IKVKYT.js} +1 -1
  21. package/dist/prod/subset-shared.chunk.js +1 -1
  22. package/dist/prod/subset-worker.chunk.js +1 -1
  23. package/dist/types/common/src/constants.d.ts +2 -0
  24. package/dist/types/{excalidraw → common/src}/emitter.d.ts +1 -1
  25. package/dist/types/common/src/font-metadata.d.ts +4 -2
  26. package/dist/types/common/src/index.d.ts +1 -0
  27. package/dist/types/common/src/utility-types.d.ts +5 -0
  28. package/dist/types/common/src/utils.d.ts +9 -0
  29. package/dist/types/element/src/binding.d.ts +10 -2
  30. package/dist/types/element/src/bounds.d.ts +1 -1
  31. package/dist/types/{excalidraw/change.d.ts → element/src/delta.d.ts} +40 -35
  32. package/dist/types/element/src/frame.d.ts +1 -0
  33. package/dist/types/element/src/index.d.ts +2 -2
  34. package/dist/types/element/src/linearElementEditor.d.ts +3 -7
  35. package/dist/types/element/src/newElement.d.ts +2 -2
  36. package/dist/types/element/src/store.d.ts +227 -0
  37. package/dist/types/element/src/transformHandles.d.ts +2 -2
  38. package/dist/types/element/src/typeChecks.d.ts +3 -0
  39. package/dist/types/element/src/types.d.ts +7 -0
  40. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +18 -36
  41. package/dist/types/excalidraw/actions/actionAlign.d.ts +8 -8
  42. package/dist/types/excalidraw/actions/actionBoundText.d.ts +12 -24
  43. package/dist/types/excalidraw/actions/actionCanvas.d.ts +107 -185
  44. package/dist/types/excalidraw/actions/actionClipboard.d.ts +39 -75
  45. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +6 -12
  46. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +19 -37
  47. package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -4
  48. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
  49. package/dist/types/excalidraw/actions/actionElementLink.d.ts +5 -11
  50. package/dist/types/excalidraw/actions/actionElementLock.d.ts +14 -26
  51. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +6 -12
  52. package/dist/types/excalidraw/actions/actionExport.d.ts +81 -135
  53. package/dist/types/excalidraw/actions/actionFinalize.d.ts +13 -25
  54. package/dist/types/excalidraw/actions/actionFlip.d.ts +4 -4
  55. package/dist/types/excalidraw/actions/actionFrame.d.ts +26 -50
  56. package/dist/types/excalidraw/actions/actionGroup.d.ts +16 -28
  57. package/dist/types/excalidraw/actions/actionHistory.d.ts +1 -2
  58. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +6 -12
  59. package/dist/types/excalidraw/actions/actionLink.d.ts +8 -14
  60. package/dist/types/excalidraw/actions/actionMenu.d.ts +19 -37
  61. package/dist/types/excalidraw/actions/actionNavigate.d.ts +12 -24
  62. package/dist/types/excalidraw/actions/actionProperties.d.ts +96 -186
  63. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +8 -14
  64. package/dist/types/excalidraw/actions/actionStyles.d.ts +10 -16
  65. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +8 -14
  66. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +8 -14
  67. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +7 -186
  68. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
  69. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +8 -14
  70. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +8 -14
  71. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +8 -14
  72. package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -8
  73. package/dist/types/excalidraw/actions/types.d.ts +3 -3
  74. package/dist/types/excalidraw/appState.d.ts +14 -14
  75. package/dist/types/excalidraw/components/App.d.ts +5 -3
  76. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +49 -0
  77. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +2 -1
  78. package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -8
  79. package/dist/types/excalidraw/editor-jotai.d.ts +6 -6
  80. package/dist/types/excalidraw/history.d.ts +14 -22
  81. package/dist/types/excalidraw/hooks/useEmitter.d.ts +1 -1
  82. package/dist/types/excalidraw/index.d.ts +1 -1
  83. package/dist/types/excalidraw/renderer/helpers.d.ts +6 -1
  84. package/dist/types/excalidraw/types.d.ts +11 -3
  85. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +3 -1
  86. package/dist/types/math/src/curve.d.ts +2 -0
  87. package/dist/types/math/src/vector.d.ts +4 -0
  88. package/history.ts +68 -94
  89. package/package.json +3 -3
  90. package/dist/dev/chunk-U3G3LY5D.js.map +0 -7
  91. package/dist/dev/chunk-X3RYHLJU.js.map +0 -7
  92. package/dist/prod/chunk-PUQLEN73.js +0 -33
  93. package/dist/prod/data/image-WY2VMQLG.js +0 -1
  94. package/dist/types/excalidraw/store.d.ts +0 -129
  95. /package/dist/dev/{chunk-MJMGTOVG.js.map → chunk-RS23HYC4.js.map} +0 -0
  96. /package/dist/dev/data/{image-Y366K5SN.js.map → image-AYLHSOBV.js.map} +0 -0
  97. /package/dist/dev/locales/{en-CKWC2GMK.js.map → en-E3O5XSXJ.js.map} +0 -0
@@ -1,18 +1,13 @@
1
1
  import type { AppState, NormalizedZoomValue } from "./types";
2
2
  export declare const getDefaultAppState: () => Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
3
3
  export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>) => {
4
+ viewBackgroundColor?: string | undefined;
4
5
  name?: string | null | undefined;
5
- activeTool?: ({
6
- lastActiveTool: import("./types").ActiveTool | null;
7
- locked: boolean;
8
- fromSelection: boolean;
9
- } & import("./types").ActiveTool) | undefined;
10
6
  zoom?: Readonly<{
11
7
  value: NormalizedZoomValue;
12
8
  }> | undefined;
13
9
  scrollX?: number | undefined;
14
10
  scrollY?: number | undefined;
15
- viewBackgroundColor?: string | undefined;
16
11
  editingGroupId?: string | null | undefined;
17
12
  selectedElementIds?: Readonly<{
18
13
  [id: string]: true;
@@ -23,13 +18,23 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
23
18
  } | undefined;
24
19
  selectedLinearElement?: import("@excalidraw/element/linearElementEditor").LinearElementEditor | null | undefined;
25
20
  zenModeEnabled?: boolean | undefined;
21
+ activeTool?: ({
22
+ lastActiveTool: import("./types").ActiveTool | null;
23
+ locked: boolean;
24
+ fromSelection: boolean;
25
+ } & import("./types").ActiveTool) | undefined;
26
+ gridModeEnabled?: boolean | undefined;
27
+ objectsSnapModeEnabled?: boolean | undefined;
28
+ shouldCacheIgnoreZoom?: boolean | undefined;
29
+ exportScale?: number | undefined;
30
+ gridSize?: number | undefined;
31
+ gridStep?: number | undefined;
26
32
  showWelcomeScreen?: boolean | undefined;
27
33
  penMode?: boolean | undefined;
28
34
  penDetected?: boolean | undefined;
29
35
  exportBackground?: boolean | undefined;
30
36
  exportEmbedScene?: boolean | undefined;
31
37
  exportWithDarkMode?: boolean | undefined;
32
- exportScale?: number | undefined;
33
38
  currentItemStrokeColor?: string | undefined;
34
39
  currentItemBackgroundColor?: string | undefined;
35
40
  currentItemFillStyle?: import("@excalidraw/element/types").FillStyle | undefined;
@@ -56,28 +61,23 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
56
61
  previousSelectedElementIds?: {
57
62
  [id: string]: true;
58
63
  } | undefined;
59
- shouldCacheIgnoreZoom?: boolean | undefined;
60
- gridSize?: number | undefined;
61
- gridStep?: number | undefined;
62
- gridModeEnabled?: boolean | undefined;
63
64
  stats?: {
64
65
  open: boolean;
65
66
  panels: number;
66
67
  } | undefined;
67
68
  currentChartType?: import("@excalidraw/element/types").ChartType | undefined;
68
- objectsSnapModeEnabled?: boolean | undefined;
69
69
  };
70
70
  export declare const cleanAppStateForExport: (appState: Partial<AppState>) => {
71
71
  viewBackgroundColor?: string | undefined;
72
+ gridModeEnabled?: boolean | undefined;
72
73
  gridSize?: number | undefined;
73
74
  gridStep?: number | undefined;
74
- gridModeEnabled?: boolean | undefined;
75
75
  };
76
76
  export declare const clearAppStateForDatabase: (appState: Partial<AppState>) => {
77
77
  viewBackgroundColor?: string | undefined;
78
+ gridModeEnabled?: boolean | undefined;
78
79
  gridSize?: number | undefined;
79
80
  gridStep?: number | undefined;
80
- gridModeEnabled?: boolean | undefined;
81
81
  };
82
82
  export declare const isEraserActive: ({ activeTool, }: {
83
83
  activeTool: AppState["activeTool"];
@@ -1,8 +1,9 @@
1
1
  import React from "react";
2
- import { type EXPORT_IMAGE_TYPES } from "@excalidraw/common";
2
+ import { type EXPORT_IMAGE_TYPES, Emitter } from "@excalidraw/common";
3
3
  import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
4
4
  import { FlowChartCreator } from "@excalidraw/element/flowchart";
5
5
  import Scene from "@excalidraw/element/Scene";
6
+ import { Store } from "@excalidraw/element/store";
6
7
  import type { ElementUpdate } from "@excalidraw/element/mutateElement";
7
8
  import type { ExcalidrawElement, NonDeleted, InitializedExcalidrawImageElement, ExcalidrawImageElement, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered } from "@excalidraw/element/types";
8
9
  import type { Mutable } from "@excalidraw/common/utility-types";
@@ -10,9 +11,8 @@ import { ActionManager } from "../actions/manager";
10
11
  import { AnimationFrameHandler } from "../animation-frame-handler";
11
12
  import { History } from "../history";
12
13
  import { Fonts } from "../fonts";
14
+ import { type WritableAtom } from "../editor-jotai";
13
15
  import { Renderer } from "../scene/Renderer";
14
- import { Emitter } from "../emitter";
15
- import { Store } from "../store";
16
16
  import { LaserTrails } from "../laser-trails";
17
17
  import { LassoTrail } from "../lasso";
18
18
  import { EraserTrail } from "../eraser";
@@ -247,6 +247,7 @@ declare class App extends React.Component<AppProps, AppState> {
247
247
  missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
248
248
  onRemoveEventListenersEmitter: Emitter<[]>;
249
249
  constructor(props: AppProps);
250
+ updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
250
251
  private onWindowMessage;
251
252
  private cacheEmbeddableRef;
252
253
  /**
@@ -268,6 +269,7 @@ declare class App extends React.Component<AppProps, AppState> {
268
269
  render(): import("react/jsx-runtime").JSX.Element;
269
270
  focusContainer: AppClassProperties["focusContainer"];
270
271
  getSceneElementsIncludingDeleted: () => readonly import("@excalidraw/element/types").OrderedExcalidrawElement[];
272
+ getSceneElementsMapIncludingDeleted: () => Map<string, Ordered<ExcalidrawElement>> & import("@excalidraw/common/utility-types").MakeBrand<"SceneElementsMap">;
271
273
  getSceneElements: () => readonly Ordered<NonDeletedExcalidrawElement>[];
272
274
  onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
273
275
  onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
@@ -0,0 +1,49 @@
1
+ import type { ConvertibleGenericTypes, ConvertibleLinearTypes, ConvertibleTypes, ExcalidrawElbowArrowElement, ExcalidrawElement, ExcalidrawLinearElement, ExcalidrawTextContainer, ExcalidrawTextElementWithContainer } from "@excalidraw/element/types";
2
+ import type Scene from "@excalidraw/element/Scene";
3
+ import "./ConvertElementTypePopup.scss";
4
+ import type App from "./App";
5
+ export declare const convertElementTypePopupAtom: import("jotai/vanilla/atom").PrimitiveAtom<{
6
+ type: "panel";
7
+ } | null> & {
8
+ init: {
9
+ type: "panel";
10
+ } | null;
11
+ };
12
+ export declare const fontSize_conversionCacheAtom: import("jotai/vanilla/atom").PrimitiveAtom<{
13
+ [id: string]: {
14
+ fontSize: number;
15
+ elementType: ConvertibleGenericTypes;
16
+ };
17
+ } | null> & {
18
+ init: {
19
+ [id: string]: {
20
+ fontSize: number;
21
+ elementType: ConvertibleGenericTypes;
22
+ };
23
+ } | null;
24
+ };
25
+ export declare const linearElement_conversionCacheAtom: import("jotai/vanilla/atom").PrimitiveAtom<{
26
+ [id: string]: {
27
+ properties: Partial<ExcalidrawLinearElement> | Partial<ExcalidrawElbowArrowElement>;
28
+ initialType: ConvertibleLinearTypes;
29
+ };
30
+ } | null> & {
31
+ init: {
32
+ [id: string]: {
33
+ properties: Partial<ExcalidrawLinearElement> | Partial<ExcalidrawElbowArrowElement>;
34
+ initialType: ConvertibleLinearTypes;
35
+ };
36
+ } | null;
37
+ };
38
+ declare const ConvertElementTypePopup: ({ app }: {
39
+ app: App;
40
+ }) => import("react/jsx-runtime").JSX.Element;
41
+ export declare const adjustBoundTextSize: (container: ExcalidrawTextContainer, boundText: ExcalidrawTextElementWithContainer, scene: Scene) => void;
42
+ type ConversionType = "generic" | "linear" | null;
43
+ export declare const convertElementTypes: (app: App, { conversionType, nextType, direction, }: {
44
+ conversionType: ConversionType;
45
+ nextType?: ConvertibleTypes | undefined;
46
+ direction?: "left" | "right" | undefined;
47
+ }) => boolean;
48
+ export declare const getConversionTypeFromElements: (elements: ExcalidrawElement[]) => ConversionType;
49
+ export default ConvertElementTypePopup;
@@ -5,6 +5,7 @@ interface CollapsibleProps {
5
5
  openTrigger: () => void;
6
6
  children: React.ReactNode;
7
7
  className?: string;
8
+ showCollapsedIcon?: boolean;
8
9
  }
9
- declare const Collapsible: ({ label, open, openTrigger, children, className, }: CollapsibleProps) => import("react/jsx-runtime").JSX.Element;
10
+ declare const Collapsible: ({ label, open, openTrigger, children, className, showCollapsedIcon, }: CollapsibleProps) => import("react/jsx-runtime").JSX.Element;
10
11
  export default Collapsible;
@@ -3,6 +3,7 @@ import type Scene from "@excalidraw/element/Scene";
3
3
  import type { AppState } from "../../types";
4
4
  export type StatsInputProperty = "x" | "y" | "width" | "height" | "angle" | "fontSize" | "gridStep";
5
5
  export declare const SMALLEST_DELTA = 0.01;
6
+ export declare const STEP_SIZE = 10;
6
7
  export declare const isPropertyEditable: (element: ExcalidrawElement, property: keyof ExcalidrawElement) => boolean;
7
8
  export declare const getStepSizedValue: (value: number, stepSize: number) => number;
8
9
  export type AtomicUnit = Record<string, true>;
@@ -16,11 +17,3 @@ export declare const newOrigin: (x1: number, y1: number, w1: number, h1: number,
16
17
  };
17
18
  export declare const moveElement: (newTopLeftX: number, newTopLeftY: number, originalElement: ExcalidrawElement, scene: Scene, originalElementsMap: ElementsMap, shouldInformMutation?: boolean) => void;
18
19
  export declare const getAtomicUnits: (targetElements: readonly ExcalidrawElement[], appState: AppState) => AtomicUnit[];
19
- export declare const updateBindings: (latestElement: ExcalidrawElement, scene: Scene, options?: {
20
- simultaneouslyUpdated?: readonly ExcalidrawElement[];
21
- newSize?: {
22
- width: number;
23
- height: number;
24
- };
25
- zoom?: AppState["zoom"];
26
- }) => void;
@@ -1,14 +1,14 @@
1
- import { atom, createStore, type PrimitiveAtom } from "jotai";
1
+ import { atom, createStore, type PrimitiveAtom, type WritableAtom } from "jotai";
2
2
  import { createIsolation } from "jotai-scope";
3
- export { atom, PrimitiveAtom };
3
+ export { atom, PrimitiveAtom, WritableAtom };
4
4
  export declare const useAtom: typeof import("jotai").useAtom, useSetAtom: typeof import("jotai").useSetAtom, useAtomValue: typeof import("jotai").useAtomValue, useStore: (options?: {
5
5
  store?: {
6
6
  get: <Value>(atom: import("jotai").Atom<Value>) => Value;
7
- set: <Value_1, Args extends unknown[], Result>(atom: import("jotai").WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
7
+ set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
8
8
  sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
9
9
  } | ({
10
10
  get: <Value_2>(atom: import("jotai").Atom<Value_2>) => Value_2;
11
- set: <Value_1_1, Args_1 extends unknown[], Result_1>(atom: import("jotai").WritableAtom<Value_1_1, Args_1, Result_1>, ...args: Args_1) => Result_1;
11
+ set: <Value_1_1, Args_1 extends unknown[], Result_1>(atom: WritableAtom<Value_1_1, Args_1, Result_1>, ...args: Args_1) => Result_1;
12
12
  sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
13
13
  } & {
14
14
  dev4_get_internal_weak_map: () => WeakMap<import("jotai").Atom<unknown>, {
@@ -29,11 +29,11 @@ export declare const useAtom: typeof import("jotai").useAtom, useSetAtom: typeof
29
29
  }) | undefined;
30
30
  } | undefined) => {
31
31
  get: <Value_3>(atom: import("jotai").Atom<Value_3>) => Value_3;
32
- set: <Value_1_2, Args_2 extends unknown[], Result_2>(atom: import("jotai").WritableAtom<Value_1_2, Args_2, Result_2>, ...args: Args_2) => Result_2;
32
+ set: <Value_1_2, Args_2 extends unknown[], Result_2>(atom: WritableAtom<Value_1_2, Args_2, Result_2>, ...args: Args_2) => Result_2;
33
33
  sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
34
34
  } | ({
35
35
  get: <Value_4>(atom: import("jotai").Atom<Value_4>) => Value_4;
36
- set: <Value_1_3, Args_3 extends unknown[], Result_3>(atom: import("jotai").WritableAtom<Value_1_3, Args_3, Result_3>, ...args: Args_3) => Result_3;
36
+ set: <Value_1_3, Args_3 extends unknown[], Result_3>(atom: WritableAtom<Value_1_3, Args_3, Result_3>, ...args: Args_3) => Result_3;
37
37
  sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
38
38
  } & {
39
39
  dev4_get_internal_weak_map: () => WeakMap<import("jotai").Atom<unknown>, {
@@ -1,40 +1,32 @@
1
+ import { Emitter } from "@excalidraw/common";
2
+ import { StoreDelta, type Store } from "@excalidraw/element/store";
1
3
  import type { SceneElementsMap } from "@excalidraw/element/types";
2
- import { Emitter } from "./emitter";
3
- import type { AppStateChange, ElementsChange } from "./change";
4
- import type { Snapshot } from "./store";
5
4
  import type { AppState } from "./types";
5
+ declare class HistoryEntry extends StoreDelta {
6
+ }
6
7
  export declare class HistoryChangedEvent {
7
8
  readonly isUndoStackEmpty: boolean;
8
9
  readonly isRedoStackEmpty: boolean;
9
10
  constructor(isUndoStackEmpty?: boolean, isRedoStackEmpty?: boolean);
10
11
  }
11
12
  export declare class History {
13
+ private readonly store;
12
14
  readonly onHistoryChangedEmitter: Emitter<[HistoryChangedEvent]>;
13
- private readonly undoStack;
14
- private readonly redoStack;
15
+ readonly undoStack: HistoryEntry[];
16
+ readonly redoStack: HistoryEntry[];
15
17
  get isUndoStackEmpty(): boolean;
16
18
  get isRedoStackEmpty(): boolean;
19
+ constructor(store: Store);
17
20
  clear(): void;
18
21
  /**
19
- * Record a local change which will go into the history
22
+ * Record a non-empty local durable increment, which will go into the undo stack..
23
+ * Do not re-record history entries, which were already pushed to undo / redo stack, as part of history action.
20
24
  */
21
- record(elementsChange: ElementsChange, appStateChange: AppStateChange): void;
22
- undo(elements: SceneElementsMap, appState: AppState, snapshot: Readonly<Snapshot>): void | [SceneElementsMap, AppState];
23
- redo(elements: SceneElementsMap, appState: AppState, snapshot: Readonly<Snapshot>): void | [SceneElementsMap, AppState];
25
+ record(delta: StoreDelta): void;
26
+ undo(elements: SceneElementsMap, appState: AppState): void | [SceneElementsMap, AppState];
27
+ redo(elements: SceneElementsMap, appState: AppState): void | [SceneElementsMap, AppState];
24
28
  private perform;
25
29
  private static pop;
26
30
  private static push;
27
31
  }
28
- export declare class HistoryEntry {
29
- readonly appStateChange: AppStateChange;
30
- readonly elementsChange: ElementsChange;
31
- private constructor();
32
- static create(appStateChange: AppStateChange, elementsChange: ElementsChange): HistoryEntry;
33
- inverse(): HistoryEntry;
34
- applyTo(elements: SceneElementsMap, appState: AppState, snapshot: Readonly<Snapshot>): [SceneElementsMap, AppState, boolean];
35
- /**
36
- * Apply latest (remote) changes to the history entry, creates new instance of `HistoryEntry`.
37
- */
38
- applyLatestChanges(elements: SceneElementsMap): HistoryEntry;
39
- isEmpty(): boolean;
40
- }
32
+ export {};
@@ -1,2 +1,2 @@
1
- import type { Emitter } from "../emitter";
1
+ import type { Emitter } from "@excalidraw/common";
2
2
  export declare const useEmitter: <TEvent extends unknown>(emitter: Emitter<[TEvent]>, initialState: TEvent) => TEvent;
@@ -22,7 +22,7 @@ export { mergeLibraryItems, getLibraryItemsHash } from "./data/library";
22
22
  export { isLinearElement } from "@excalidraw/element/typeChecks";
23
23
  export { FONT_FAMILY, THEME, MIME_TYPES, ROUNDNESS, DEFAULT_LASER_COLOR, UserIdleState, normalizeLink, } from "@excalidraw/common";
24
24
  export { mutateElement, newElementWith, bumpVersion, } from "@excalidraw/element/mutateElement";
25
- export { CaptureUpdateAction } from "./store";
25
+ export { CaptureUpdateAction } from "@excalidraw/element/store";
26
26
  export { parseLibraryTokensFromUrl, useHandleLibrary } from "./data/library";
27
27
  export { sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, } from "@excalidraw/common";
28
28
  export { Sidebar } from "./components/Sidebar/Sidebar";
@@ -1,5 +1,6 @@
1
+ import type { ExcalidrawDiamondElement, ExcalidrawRectanguloidElement } from "@excalidraw/element/types";
1
2
  import type { StaticCanvasRenderConfig } from "../scene/types";
2
- import type { StaticCanvasAppState, AppState } from "../types";
3
+ import type { AppState, StaticCanvasAppState } from "../types";
3
4
  export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke?: boolean) => void;
4
5
  export declare const getNormalizedCanvasDimensions: (canvas: HTMLCanvasElement, scale: number) => [number, number];
5
6
  export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normalizedHeight, theme, isExporting, viewBackgroundColor, }: {
@@ -11,3 +12,7 @@ export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normali
11
12
  isExporting?: boolean | undefined;
12
13
  viewBackgroundColor?: string | null | undefined;
13
14
  }) => CanvasRenderingContext2D;
15
+ export declare const drawHighlightForRectWithRotation: (context: CanvasRenderingContext2D, element: ExcalidrawRectanguloidElement, padding: number) => void;
16
+ export declare const strokeEllipseWithRotation: (context: CanvasRenderingContext2D, width: number, height: number, cx: number, cy: number, angle: number) => void;
17
+ export declare const strokeRectWithRotation: (context: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, cx: number, cy: number, angle: number, fill?: boolean, radius?: number) => void;
18
+ export declare const drawHighlightForDiamondWithRotation: (context: CanvasRenderingContext2D, padding: number, element: ExcalidrawDiamondElement) => void;
@@ -4,6 +4,7 @@ import type { LinearElementEditor } from "@excalidraw/element/linearElementEdito
4
4
  import type { MaybeTransformHandleType } from "@excalidraw/element/transformHandles";
5
5
  import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, FileId, ExcalidrawImageElement, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement } from "@excalidraw/element/types";
6
6
  import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
7
+ import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element/store";
7
8
  import type { Action } from "./actions/types";
8
9
  import type { Spreadsheet } from "./charts";
9
10
  import type { ClipboardData } from "./clipboard";
@@ -12,7 +13,6 @@ import type Library from "./data/library";
12
13
  import type { FileSystemHandle } from "./data/filesystem";
13
14
  import type { ContextMenuItems } from "./components/ContextMenu";
14
15
  import type { SnapLine } from "./snapping";
15
- import type { CaptureUpdateActionType } from "./store";
16
16
  import type { ImportedDataState } from "./data/types";
17
17
  import type { Language } from "./i18n";
18
18
  import type { isOverScrollBars } from "./scene/scrollbars";
@@ -341,9 +341,13 @@ export interface AppState {
341
341
  /** image cropping */
342
342
  isCropping: boolean;
343
343
  croppingElementId: ExcalidrawElement["id"] | null;
344
- searchMatches: readonly SearchMatch[];
344
+ /** null if no search matches found / search closed */
345
+ searchMatches: Readonly<{
346
+ focusedId: ExcalidrawElement["id"] | null;
347
+ matches: readonly SearchMatch[];
348
+ }> | null;
345
349
  }
346
- type SearchMatch = {
350
+ export type SearchMatch = {
347
351
  id: string;
348
352
  focus: boolean;
349
353
  matchedLines: {
@@ -351,6 +355,7 @@ type SearchMatch = {
351
355
  offsetY: number;
352
356
  width: number;
353
357
  height: number;
358
+ showOnCanvas: boolean;
354
359
  }[];
355
360
  };
356
361
  export type UIAppState = Omit<AppState, "suggestedBindings" | "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
@@ -403,6 +408,7 @@ export type OnUserFollowedPayload = {
403
408
  };
404
409
  export interface ExcalidrawProps {
405
410
  onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
411
+ onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
406
412
  initialData?: (() => MaybePromise<ExcalidrawInitialDataState | null>) | MaybePromise<ExcalidrawInitialDataState | null>;
407
413
  excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
408
414
  isCollaborating?: boolean;
@@ -545,6 +551,7 @@ export type AppClassProperties = {
545
551
  visibleElements: App["visibleElements"];
546
552
  excalidrawContainerValue: App["excalidrawContainerValue"];
547
553
  onPointerUpEmitter: App["onPointerUpEmitter"];
554
+ updateEditorAtom: App["updateEditorAtom"];
548
555
  };
549
556
  export type PointerDownState = Readonly<{
550
557
  origin: Readonly<{
@@ -634,6 +641,7 @@ export interface ExcalidrawImperativeAPI {
634
641
  */
635
642
  updateFrameRendering: InstanceType<typeof App>["updateFrameRendering"];
636
643
  onChange: (callback: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void) => UnsubscribeCallback;
644
+ onIncrement: (callback: (event: DurableIncrement | EphemeralIncrement) => void) => UnsubscribeCallback;
637
645
  onPointerDown: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: React.PointerEvent<HTMLElement>) => void) => UnsubscribeCallback;
638
646
  onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
639
647
  onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
@@ -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 {};
@@ -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,4 @@ 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;
@@ -86,3 +86,7 @@ export declare function vectorMagnitude(v: Vector): number;
86
86
  * @returns The new normalized vector
87
87
  */
88
88
  export declare const vectorNormalize: (v: Vector) => Vector;
89
+ /**
90
+ * Calculate the right-hand normal of the vector.
91
+ */
92
+ export declare const vectorNormal: (v: Vector) => Vector;