@excalidraw/excalidraw 0.15.2-bb985eb → 0.15.2-d73cd14

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 (45) hide show
  1. package/dist/excalidraw.development.js +156 -79
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/dist/excalidraw.production.min.js.LICENSE.txt +0 -15
  4. package/package.json +3 -3
  5. package/types/actions/actionFinalize.d.ts +1 -1
  6. package/types/actions/actionGroup.d.ts +241 -3
  7. package/types/actions/actionProperties.d.ts +2 -0
  8. package/types/actions/actionSelectAll.d.ts +121 -1
  9. package/types/clipboard.d.ts +1 -0
  10. package/types/components/Actions.d.ts +2 -2
  11. package/types/components/App.d.ts +8 -6
  12. package/types/components/ExcalidrawLogo.d.ts +15 -0
  13. package/types/components/JSONExportDialog.d.ts +1 -1
  14. package/types/components/LayerUI.d.ts +3 -2
  15. package/types/components/MobileMenu.d.ts +2 -2
  16. package/types/components/canvases/InteractiveCanvas.d.ts +27 -0
  17. package/types/components/canvases/StaticCanvas.d.ts +18 -0
  18. package/types/components/canvases/index.d.ts +3 -0
  19. package/types/constants.d.ts +1 -0
  20. package/types/data/transform.d.ts +71 -0
  21. package/types/element/Hyperlink.d.ts +1 -1
  22. package/types/element/binding.d.ts +1 -0
  23. package/types/element/linearElementEditor.d.ts +4 -4
  24. package/types/element/newElement.d.ts +10 -6
  25. package/types/element/sizeHelpers.d.ts +8 -1
  26. package/types/element/textElement.d.ts +3 -1
  27. package/types/element/textWysiwyg.d.ts +1 -1
  28. package/types/element/transformHandles.d.ts +2 -2
  29. package/types/element/types.d.ts +5 -5
  30. package/types/frame.d.ts +4 -4
  31. package/types/groups.d.ts +11 -11
  32. package/types/packages/excalidraw/example/initialData.d.ts +182 -70
  33. package/types/packages/excalidraw/index.d.ts +1 -0
  34. package/types/renderer/renderElement.d.ts +9 -21
  35. package/types/renderer/renderScene.d.ts +16 -36
  36. package/types/scene/Renderer.d.ts +25 -0
  37. package/types/scene/Scene.d.ts +2 -0
  38. package/types/scene/Shape.d.ts +12 -0
  39. package/types/scene/ShapeCache.d.ts +20 -0
  40. package/types/scene/scroll.d.ts +1 -1
  41. package/types/scene/scrollbars.d.ts +2 -6
  42. package/types/scene/selection.d.ts +2 -2
  43. package/types/scene/types.d.ts +57 -24
  44. package/types/types.d.ts +43 -3
  45. package/types/utils.d.ts +12 -4
@@ -1,37 +1,25 @@
1
1
  import { ExcalidrawElement, ExcalidrawTextElement, NonDeletedExcalidrawElement, ExcalidrawFreeDrawElement } from "../element/types";
2
- import { RoughCanvas } from "roughjs/bin/canvas";
3
- import { Drawable, Options } from "roughjs/bin/core";
4
- import { RoughSVG } from "roughjs/bin/svg";
5
- import { RenderConfig } from "../scene/types";
6
- import { AppState, BinaryFiles } from "../types";
2
+ import type { RoughCanvas } from "roughjs/bin/canvas";
3
+ import type { RoughSVG } from "roughjs/bin/svg";
4
+ import { StaticCanvasRenderConfig } from "../scene/types";
5
+ import { AppState, StaticCanvasAppState, BinaryFiles, InteractiveCanvasAppState } from "../types";
7
6
  export interface ExcalidrawElementWithCanvas {
8
7
  element: ExcalidrawElement | ExcalidrawTextElement;
9
8
  canvas: HTMLCanvasElement;
10
- theme: RenderConfig["theme"];
9
+ theme: AppState["theme"];
11
10
  scale: number;
12
- zoomValue: RenderConfig["zoom"]["value"];
11
+ zoomValue: AppState["zoom"]["value"];
13
12
  canvasOffsetX: number;
14
13
  canvasOffsetY: number;
15
14
  boundTextElementVersion: number | null;
16
15
  containingFrameOpacity: number;
17
16
  }
18
17
  export declare const DEFAULT_LINK_SIZE = 14;
19
- type ElementShape = Drawable | Drawable[] | null;
20
- type ElementShapes = {
21
- freedraw: Drawable | null;
22
- arrow: Drawable[];
23
- line: Drawable[];
24
- text: null;
25
- image: null;
26
- };
27
- export declare const getShapeForElement: <T extends ExcalidrawElement>(element: T) => T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : Drawable | null | undefined;
28
- export declare const setShapeForElement: <T extends ExcalidrawElement>(element: T, shape: T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable) => WeakMap<ExcalidrawElement, ElementShape>;
29
- export declare const invalidateShapeForElement: (element: ExcalidrawElement) => boolean;
30
- export declare const generateRoughOptions: (element: ExcalidrawElement, continuousPath?: boolean) => Options;
31
- export declare const renderElement: (element: NonDeletedExcalidrawElement, rc: RoughCanvas, context: CanvasRenderingContext2D, renderConfig: RenderConfig, appState: AppState) => void;
18
+ export declare const elementWithCanvasCache: WeakMap<ExcalidrawElement, ExcalidrawElementWithCanvas>;
19
+ export declare const renderSelectionElement: (element: NonDeletedExcalidrawElement, context: CanvasRenderingContext2D, appState: InteractiveCanvasAppState) => void;
20
+ export declare const renderElement: (element: NonDeletedExcalidrawElement, rc: RoughCanvas, context: CanvasRenderingContext2D, renderConfig: StaticCanvasRenderConfig, appState: StaticCanvasAppState) => void;
32
21
  export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX: number, offsetY: number, exportWithDarkMode?: boolean, exportingFrameId?: string | null, renderEmbeddables?: boolean) => void;
33
22
  export declare const pathsCache: WeakMap<ExcalidrawFreeDrawElement, Path2D>;
34
23
  export declare function generateFreeDrawShape(element: ExcalidrawFreeDrawElement): Path2D;
35
24
  export declare function getFreeDrawPath2D(element: ExcalidrawFreeDrawElement): Path2D | undefined;
36
25
  export declare function getFreeDrawSvgPath(element: ExcalidrawFreeDrawElement): string;
37
- export {};
@@ -1,47 +1,27 @@
1
- import { RoughCanvas } from "roughjs/bin/canvas";
2
1
  import { RoughSVG } from "roughjs/bin/svg";
3
- import { AppState, BinaryFiles, Zoom } from "../types";
4
- import { ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
5
- import { RenderConfig } from "../scene/types";
2
+ import { BinaryFiles } from "../types";
3
+ import { NonDeletedExcalidrawElement } from "../element/types";
4
+ import { InteractiveSceneRenderConfig, StaticSceneRenderConfig } from "../scene/types";
6
5
  import "canvas-roundrect-polyfill";
7
6
  export declare const DEFAULT_SPACING = 2;
8
- export declare const _renderScene: ({ elements, appState, scale, rc, canvas, renderConfig, }: {
9
- elements: readonly NonDeletedExcalidrawElement[];
10
- appState: AppState;
11
- scale: number;
12
- rc: RoughCanvas;
13
- canvas: HTMLCanvasElement;
14
- renderConfig: RenderConfig;
15
- }) => {
7
+ /**
8
+ * Interactive scene is the ui-canvas where we render boundinb boxes, selections
9
+ * and other ui stuff.
10
+ */
11
+ export declare const renderInteractiveScene: <U extends ({ canvas, elements, visibleElements, selectedElements, scale, appState, renderConfig, }: InteractiveSceneRenderConfig) => {
16
12
  atLeastOneVisibleElement: boolean;
17
- scrollBars?: undefined;
18
- } | {
19
- atLeastOneVisibleElement: boolean;
20
- scrollBars: import("../scene/types").ScrollBars | undefined;
21
- };
22
- /** renderScene throttled to animation framerate */
23
- export declare const renderScene: <T extends boolean = false>(config: {
24
13
  elements: readonly NonDeletedExcalidrawElement[];
25
- appState: AppState;
26
- scale: number;
27
- rc: RoughCanvas;
28
- canvas: HTMLCanvasElement;
29
- renderConfig: RenderConfig;
30
- callback?: ((data: ReturnType<typeof _renderScene>) => void) | undefined;
31
- }, throttle?: T | undefined) => T extends true ? void : {
32
- atLeastOneVisibleElement: boolean;
33
14
  scrollBars?: undefined;
34
15
  } | {
35
- atLeastOneVisibleElement: boolean;
36
16
  scrollBars: import("../scene/types").ScrollBars | undefined;
37
- };
38
- export declare const isVisibleElement: (element: ExcalidrawElement, canvasWidth: number, canvasHeight: number, viewTransformations: {
39
- zoom: Zoom;
40
- offsetLeft: number;
41
- offsetTop: number;
42
- scrollX: number;
43
- scrollY: number;
44
- }) => boolean;
17
+ atLeastOneVisibleElement: boolean;
18
+ elements: readonly NonDeletedExcalidrawElement[];
19
+ }, T extends boolean = false>(renderConfig: InteractiveSceneRenderConfig, throttle?: T | undefined) => T extends true ? void : ReturnType<U>;
20
+ /**
21
+ * Static scene is the non-ui canvas where we render elements.
22
+ */
23
+ export declare const renderStaticScene: (renderConfig: StaticSceneRenderConfig, throttle?: boolean) => void;
24
+ export declare const cancelRender: () => void;
45
25
  export declare const renderSceneToSvg: (elements: readonly NonDeletedExcalidrawElement[], rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, { offsetX, offsetY, exportWithDarkMode, exportingFrameId, renderEmbeddables, }?: {
46
26
  offsetX?: number | undefined;
47
27
  offsetY?: number | undefined;
@@ -0,0 +1,25 @@
1
+ import { NonDeletedExcalidrawElement } from "../element/types";
2
+ import { AppState } from "../types";
3
+ import Scene from "./Scene";
4
+ export declare class Renderer {
5
+ private scene;
6
+ constructor(scene: Scene);
7
+ getRenderableElements: ((opts: {
8
+ zoom: AppState["zoom"];
9
+ offsetLeft: AppState["offsetLeft"];
10
+ offsetTop: AppState["offsetTop"];
11
+ scrollX: AppState["scrollX"];
12
+ scrollY: AppState["scrollY"];
13
+ height: AppState["height"];
14
+ width: AppState["width"];
15
+ editingElement: AppState["editingElement"];
16
+ pendingImageElementId: AppState["pendingImageElementId"];
17
+ versionNonce: ReturnType<InstanceType<typeof Scene>["getVersionNonce"]>;
18
+ }) => {
19
+ canvasElements: NonDeletedExcalidrawElement[];
20
+ visibleElements: readonly NonDeletedExcalidrawElement[];
21
+ }) & {
22
+ clear: () => void;
23
+ };
24
+ destroy(): void;
25
+ }
@@ -18,6 +18,7 @@ declare class Scene {
18
18
  private frames;
19
19
  private elementsMap;
20
20
  private selectedElementsCache;
21
+ private versionNonce;
21
22
  getElementsIncludingDeleted(): readonly ExcalidrawElement[];
22
23
  getNonDeletedElements(): readonly NonDeletedExcalidrawElement[];
23
24
  getFramesIncludingDeleted(): readonly ExcalidrawFrameElement[];
@@ -34,6 +35,7 @@ declare class Scene {
34
35
  }): NonDeleted<ExcalidrawElement>[];
35
36
  getNonDeletedFrames(): readonly NonDeleted<ExcalidrawFrameElement>[];
36
37
  getElement<T extends ExcalidrawElement>(id: T["id"]): T | null;
38
+ getVersionNonce(): number | undefined;
37
39
  getNonDeletedElement(id: ExcalidrawElement["id"]): NonDeleted<ExcalidrawElement> | null;
38
40
  /**
39
41
  * A utility method to help with updating all scene elements, with the added
@@ -0,0 +1,12 @@
1
+ import type { Drawable, Options } from "roughjs/bin/core";
2
+ import type { RoughGenerator } from "roughjs/bin/generator";
3
+ import type { ExcalidrawElement, NonDeletedExcalidrawElement, ExcalidrawSelectionElement } from "../element/types";
4
+ export declare const generateRoughOptions: (element: ExcalidrawElement, continuousPath?: boolean) => Options;
5
+ /**
6
+ * Generates the roughjs shape for given element.
7
+ *
8
+ * Low-level. Use `ShapeCache.generateElementShape` instead.
9
+ *
10
+ * @private
11
+ */
12
+ export declare const _generateElementShape: (element: Exclude<NonDeletedExcalidrawElement, ExcalidrawSelectionElement>, generator: RoughGenerator, isExporting?: boolean) => Drawable | Drawable[] | null;
@@ -0,0 +1,20 @@
1
+ import { Drawable } from "roughjs/bin/core";
2
+ import { ExcalidrawElement } from "../element/types";
3
+ import { ElementShape, ElementShapes } from "./types";
4
+ export declare class ShapeCache {
5
+ private static rg;
6
+ private static cache;
7
+ /**
8
+ * Retrieves shape from cache if available. Use this only if shape
9
+ * is optional and you have a fallback in case it's not cached.
10
+ */
11
+ static get: <T extends ExcalidrawElement>(element: T) => T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : ElementShape | undefined;
12
+ static set: <T extends ExcalidrawElement>(element: T, shape: T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable) => WeakMap<ExcalidrawElement, ElementShape>;
13
+ static delete: (element: ExcalidrawElement) => boolean;
14
+ static destroy: () => void;
15
+ /**
16
+ * Generates & caches shape for element if not already cached, otherwise
17
+ * returns cached shape.
18
+ */
19
+ static generateElementShape: <T extends import("../element/types").ExcalidrawLinearElement | import("../element/types").ExcalidrawRectangleElement | import("../element/types").ExcalidrawDiamondElement | import("../element/types").ExcalidrawEllipseElement | import("../element/types").ExcalidrawEmbeddableElement | import("../element/types").ExcalidrawImageElement | import("../element/types").ExcalidrawFrameElement | import("../element/types").ExcalidrawTextElement | import("../element/types").ExcalidrawFreeDrawElement>(element: T, isExporting?: boolean) => ((T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] | undefined : ElementShape | undefined) & ({} | null)) | (T["type"] extends keyof ElementShapes ? ElementShapes[T["type"]] : Drawable | null);
20
+ }
@@ -11,7 +11,7 @@ export declare const centerScrollOn: ({ scenePoint, viewportDimensions, zoom, }:
11
11
  scrollX: number;
12
12
  scrollY: number;
13
13
  };
14
- export declare const calculateScrollCenter: (elements: readonly ExcalidrawElement[], appState: AppState, canvas: HTMLCanvasElement | null) => {
14
+ export declare const calculateScrollCenter: (elements: readonly ExcalidrawElement[], appState: AppState) => {
15
15
  scrollX: number;
16
16
  scrollY: number;
17
17
  };
@@ -1,14 +1,10 @@
1
1
  import { ExcalidrawElement } from "../element/types";
2
- import { Zoom } from "../types";
2
+ import { InteractiveCanvasAppState } from "../types";
3
3
  import { ScrollBars } from "./types";
4
4
  export declare const SCROLLBAR_MARGIN = 4;
5
5
  export declare const SCROLLBAR_WIDTH = 6;
6
6
  export declare const SCROLLBAR_COLOR = "rgba(0,0,0,0.3)";
7
- export declare const getScrollBars: (elements: readonly ExcalidrawElement[], viewportWidth: number, viewportHeight: number, { scrollX, scrollY, zoom, }: {
8
- scrollX: number;
9
- scrollY: number;
10
- zoom: Zoom;
11
- }) => ScrollBars;
7
+ export declare const getScrollBars: (elements: readonly ExcalidrawElement[], viewportWidth: number, viewportHeight: number, appState: InteractiveCanvasAppState) => ScrollBars;
12
8
  export declare const isOverScrollBars: (scrollBars: ScrollBars, x: number, y: number) => {
13
9
  isOverEither: boolean;
14
10
  isOverHorizontal: boolean;
@@ -1,5 +1,5 @@
1
1
  import { ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
2
- import { AppState } from "../types";
2
+ import { AppState, InteractiveCanvasAppState } from "../types";
3
3
  /**
4
4
  * Frames and their containing elements are not to be selected at the same time.
5
5
  * Given an array of selected elements, if there are frames and their containing elements
@@ -17,7 +17,7 @@ export declare const isSomeElementSelected: {
17
17
  * elements. If elements don't share the same value, returns `null`.
18
18
  */
19
19
  export declare const getCommonAttributeOfSelectedElements: <T>(elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds">, getAttribute: (element: ExcalidrawElement) => T) => T | null;
20
- export declare const getSelectedElements: (elements: readonly NonDeletedExcalidrawElement[], appState: Pick<AppState, "selectedElementIds">, opts?: {
20
+ export declare const getSelectedElements: (elements: readonly NonDeletedExcalidrawElement[], appState: Pick<InteractiveCanvasAppState, "selectedElementIds">, opts?: {
21
21
  includeBoundTextElement?: boolean;
22
22
  includeElementsInFrames?: boolean;
23
23
  }) => ExcalidrawElement[];
@@ -1,39 +1,59 @@
1
- import { ExcalidrawTextElement } from "../element/types";
2
- import { AppClassProperties, AppState } from "../types";
3
- export type RenderConfig = {
4
- scrollX: AppState["scrollX"];
5
- scrollY: AppState["scrollY"];
6
- /** null indicates transparent bg */
7
- viewBackgroundColor: AppState["viewBackgroundColor"] | null;
8
- zoom: AppState["zoom"];
9
- shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
10
- theme: AppState["theme"];
1
+ import type { RoughCanvas } from "roughjs/bin/canvas";
2
+ import { Drawable } from "roughjs/bin/core";
3
+ import { ExcalidrawTextElement, NonDeletedExcalidrawElement } from "../element/types";
4
+ import { AppClassProperties, InteractiveCanvasAppState, StaticCanvasAppState } from "../types";
5
+ export type StaticCanvasRenderConfig = {
6
+ imageCache: AppClassProperties["imageCache"];
7
+ renderGrid: boolean;
8
+ /** when exporting the behavior is slightly different (e.g. we can't use
9
+ CSS filters), and we disable render optimizations for best output */
10
+ isExporting: boolean;
11
+ };
12
+ export type InteractiveCanvasRenderConfig = {
13
+ remoteSelectedElementIds: {
14
+ [elementId: string]: string[];
15
+ };
11
16
  remotePointerViewportCoords: {
12
17
  [id: string]: {
13
18
  x: number;
14
19
  y: number;
15
20
  };
16
21
  };
17
- remotePointerButton?: {
18
- [id: string]: string | undefined;
19
- };
20
- remoteSelectedElementIds: {
21
- [elementId: string]: string[];
22
+ remotePointerUserStates: {
23
+ [id: string]: string;
22
24
  };
23
25
  remotePointerUsernames: {
24
26
  [id: string]: string;
25
27
  };
26
- remotePointerUserStates: {
27
- [id: string]: string;
28
+ remotePointerButton?: {
29
+ [id: string]: string | undefined;
28
30
  };
29
- imageCache: AppClassProperties["imageCache"];
30
- renderScrollbars?: boolean;
31
- renderSelection?: boolean;
32
- renderGrid?: boolean;
33
- /** when exporting the behavior is slightly different (e.g. we can't use
34
- CSS filters), and we disable render optimizations for best output */
35
- isExporting: boolean;
36
31
  selectionColor?: string;
32
+ renderScrollbars?: boolean;
33
+ };
34
+ export type RenderInteractiveSceneCallback = {
35
+ atLeastOneVisibleElement: boolean;
36
+ elements: readonly NonDeletedExcalidrawElement[];
37
+ scrollBars?: ScrollBars;
38
+ };
39
+ export type StaticSceneRenderConfig = {
40
+ canvas: HTMLCanvasElement;
41
+ rc: RoughCanvas;
42
+ elements: readonly NonDeletedExcalidrawElement[];
43
+ visibleElements: readonly NonDeletedExcalidrawElement[];
44
+ scale: number;
45
+ appState: StaticCanvasAppState;
46
+ renderConfig: StaticCanvasRenderConfig;
47
+ };
48
+ export type InteractiveSceneRenderConfig = {
49
+ canvas: HTMLCanvasElement | null;
50
+ elements: readonly NonDeletedExcalidrawElement[];
51
+ visibleElements: readonly NonDeletedExcalidrawElement[];
52
+ selectedElements: readonly NonDeletedExcalidrawElement[];
53
+ scale: number;
54
+ appState: InteractiveCanvasAppState;
55
+ renderConfig: InteractiveCanvasRenderConfig;
56
+ callback: (data: RenderInteractiveSceneCallback) => void;
37
57
  };
38
58
  export type SceneScroll = {
39
59
  scrollX: number;
@@ -57,3 +77,16 @@ export type ScrollBars = {
57
77
  height: number;
58
78
  } | null;
59
79
  };
80
+ export type ElementShape = Drawable | Drawable[] | null;
81
+ export type ElementShapes = {
82
+ rectangle: Drawable;
83
+ ellipse: Drawable;
84
+ diamond: Drawable;
85
+ embeddable: Drawable;
86
+ freedraw: Drawable | null;
87
+ arrow: Drawable[];
88
+ line: Drawable[];
89
+ text: null;
90
+ image: null;
91
+ frame: null;
92
+ };
package/types/types.d.ts CHANGED
@@ -65,6 +65,45 @@ export type LastActiveTool = {
65
65
  } | null;
66
66
  export type SidebarName = string;
67
67
  export type SidebarTabName = string;
68
+ type _CommonCanvasAppState = {
69
+ zoom: AppState["zoom"];
70
+ scrollX: AppState["scrollX"];
71
+ scrollY: AppState["scrollY"];
72
+ width: AppState["width"];
73
+ height: AppState["height"];
74
+ viewModeEnabled: AppState["viewModeEnabled"];
75
+ editingGroupId: AppState["editingGroupId"];
76
+ selectedElementIds: AppState["selectedElementIds"];
77
+ frameToHighlight: AppState["frameToHighlight"];
78
+ offsetLeft: AppState["offsetLeft"];
79
+ offsetTop: AppState["offsetTop"];
80
+ theme: AppState["theme"];
81
+ pendingImageElementId: AppState["pendingImageElementId"];
82
+ };
83
+ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
84
+ shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
85
+ /** null indicates transparent bg */
86
+ viewBackgroundColor: AppState["viewBackgroundColor"] | null;
87
+ exportScale: AppState["exportScale"];
88
+ selectedElementsAreBeingDragged: AppState["selectedElementsAreBeingDragged"];
89
+ gridSize: AppState["gridSize"];
90
+ frameRendering: AppState["frameRendering"];
91
+ }>;
92
+ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
93
+ activeEmbeddable: AppState["activeEmbeddable"];
94
+ editingLinearElement: AppState["editingLinearElement"];
95
+ selectionElement: AppState["selectionElement"];
96
+ selectedGroupIds: AppState["selectedGroupIds"];
97
+ selectedLinearElement: AppState["selectedLinearElement"];
98
+ multiElement: AppState["multiElement"];
99
+ isBindingEnabled: AppState["isBindingEnabled"];
100
+ suggestedBindings: AppState["suggestedBindings"];
101
+ isRotating: AppState["isRotating"];
102
+ elementsToHighlight: AppState["elementsToHighlight"];
103
+ openSidebar: AppState["openSidebar"];
104
+ showHyperlinkPopup: AppState["showHyperlinkPopup"];
105
+ collaborators: AppState["collaborators"];
106
+ }>;
68
107
  export type AppState = {
69
108
  contextMenu: {
70
109
  items: ContextMenuItems;
@@ -297,8 +336,8 @@ export declare enum UserIdleState {
297
336
  }
298
337
  export type ExportOpts = {
299
338
  saveFileToDisk?: boolean;
300
- onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement | null) => void;
301
- renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement | null) => JSX.Element;
339
+ onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => void;
340
+ renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => JSX.Element;
302
341
  };
303
342
  type CanvasActions = Partial<{
304
343
  changeViewBackgroundColor: boolean;
@@ -330,7 +369,8 @@ export type AppProps = Merge<ExcalidrawProps, {
330
369
  * in the app, eg Manager. Factored out into a separate type to keep DRY. */
331
370
  export type AppClassProperties = {
332
371
  props: AppProps;
333
- canvas: HTMLCanvasElement | null;
372
+ canvas: HTMLCanvasElement;
373
+ interactiveCanvas: HTMLCanvasElement | null;
334
374
  focusContainer(): void;
335
375
  library: Library;
336
376
  imageCache: Map<FileId, {
package/types/utils.d.ts CHANGED
@@ -88,10 +88,10 @@ export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">,
88
88
  }) & {
89
89
  lastActiveToolBeforeEraser?: LastActiveTool;
90
90
  }) => AppState["activeTool"];
91
- export declare const resetCursor: (canvas: HTMLCanvasElement | null) => void;
92
- export declare const setCursor: (canvas: HTMLCanvasElement | null, cursor: string) => void;
93
- export declare const setEraserCursor: (canvas: HTMLCanvasElement | null, theme: AppState["theme"]) => void;
94
- export declare const setCursorForShape: (canvas: HTMLCanvasElement | null, appState: Pick<AppState, "activeTool" | "theme">) => void;
91
+ export declare const resetCursor: (interactiveCanvas: HTMLCanvasElement | null) => void;
92
+ export declare const setCursor: (interactiveCanvas: HTMLCanvasElement | null, cursor: string) => void;
93
+ export declare const setEraserCursor: (interactiveCanvas: HTMLCanvasElement | null, theme: AppState["theme"]) => void;
94
+ export declare const setCursorForShape: (interactiveCanvas: HTMLCanvasElement | null, appState: Pick<AppState, "activeTool" | "theme">) => void;
95
95
  export declare const isFullScreen: () => boolean;
96
96
  export declare const allowFullScreen: () => Promise<void>;
97
97
  export declare const exitFullScreen: () => Promise<void>;
@@ -190,3 +190,11 @@ export declare const composeEventHandlers: <E>(originalEventHandler?: ((event: E
190
190
  checkForDefaultPrevented?: boolean | undefined;
191
191
  }) => (event: E) => void;
192
192
  export declare const isOnlyExportingSingleFrame: (elements: readonly NonDeletedExcalidrawElement[]) => boolean;
193
+ export declare const assertNever: (value: never, message: string, softAssert?: boolean) => never;
194
+ /**
195
+ * Memoizes on values of `opts` object (strict equality).
196
+ */
197
+ export declare const memoize: <T extends Record<string, any>, R extends unknown>(func: (opts: T) => R) => ((opts: T) => R) & {
198
+ clear: () => void;
199
+ };
200
+ export declare const isRenderThrottlingEnabled: () => boolean;