@zsviczian/excalidraw 0.17.1-obsidian-19 → 0.17.1-obsidian-20

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 (56) hide show
  1. package/dist/excalidraw.development.js +122 -57
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/dist/styles.development.css +1042 -821
  4. package/dist/styles.production.css +12 -11
  5. package/package.json +4 -3
  6. package/types/excalidraw/actions/actionAddToLibrary.d.ts +16 -1
  7. package/types/excalidraw/actions/actionAlign.d.ts +19 -7
  8. package/types/excalidraw/actions/actionBoundText.d.ts +13 -3
  9. package/types/excalidraw/actions/actionCanvas.d.ts +111 -15
  10. package/types/excalidraw/actions/actionClipboard.d.ts +48 -6
  11. package/types/excalidraw/actions/actionDeleteSelected.d.ts +17 -1
  12. package/types/excalidraw/actions/actionDistribute.d.ts +2 -0
  13. package/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -1
  14. package/types/excalidraw/actions/actionElementLock.d.ts +16 -3
  15. package/types/excalidraw/actions/actionExport.d.ts +53 -0
  16. package/types/excalidraw/actions/actionFinalize.d.ts +11 -0
  17. package/types/excalidraw/actions/actionFlip.d.ts +4 -2
  18. package/types/excalidraw/actions/actionFrame.d.ts +21 -3
  19. package/types/excalidraw/actions/actionGroup.d.ts +14 -2
  20. package/types/excalidraw/actions/actionLinearEditor.d.ts +7 -1
  21. package/types/excalidraw/actions/actionLink.d.ts +7 -1
  22. package/types/excalidraw/actions/actionMenu.d.ts +17 -0
  23. package/types/excalidraw/actions/actionNavigate.d.ts +11 -0
  24. package/types/excalidraw/actions/actionProperties.d.ts +82 -0
  25. package/types/excalidraw/actions/actionSelectAll.d.ts +8 -1
  26. package/types/excalidraw/actions/actionStyles.d.ts +9 -2
  27. package/types/excalidraw/actions/actionToggleGridMode.d.ts +6 -1
  28. package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +8 -2
  29. package/types/excalidraw/actions/actionToggleStats.d.ts +8 -1
  30. package/types/excalidraw/actions/actionToggleViewMode.d.ts +8 -1
  31. package/types/excalidraw/actions/actionToggleZenMode.d.ts +8 -1
  32. package/types/excalidraw/actions/actionZindex.d.ts +8 -4
  33. package/types/excalidraw/actions/shortcuts.d.ts +2 -2
  34. package/types/excalidraw/actions/types.d.ts +6 -4
  35. package/types/excalidraw/clients.d.ts +10 -1
  36. package/types/excalidraw/components/Actions.d.ts +3 -1
  37. package/types/excalidraw/components/App.d.ts +1 -1
  38. package/types/excalidraw/components/Avatar.d.ts +2 -3
  39. package/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +18 -0
  40. package/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +2 -0
  41. package/types/excalidraw/components/CommandPalette/types.d.ts +25 -0
  42. package/types/excalidraw/components/InlineIcon.d.ts +1 -1
  43. package/types/excalidraw/components/UserList.d.ts +3 -7
  44. package/types/excalidraw/components/hyperlink/Hyperlink.d.ts +2 -2
  45. package/types/excalidraw/components/icons.d.ts +22 -1
  46. package/types/excalidraw/components/main-menu/DefaultItems.d.ts +4 -0
  47. package/types/excalidraw/constants.d.ts +5 -0
  48. package/types/excalidraw/deburr.d.ts +1 -0
  49. package/types/excalidraw/element/embeddable.d.ts +7 -0
  50. package/types/excalidraw/element/linearElementEditor.d.ts +5 -0
  51. package/types/excalidraw/element/textElement.d.ts +0 -5
  52. package/types/excalidraw/hooks/useStableCallback.d.ts +4 -0
  53. package/types/excalidraw/index.d.ts +1 -1
  54. package/types/excalidraw/keys.d.ts +1 -0
  55. package/types/excalidraw/scene/types.d.ts +10 -20
  56. package/types/excalidraw/types.d.ts +21 -2
@@ -1,6 +1,8 @@
1
1
  import React from "react";
2
2
  export declare const actionSendBackward: {
3
3
  name: "sendBackward";
4
+ label: string;
5
+ icon: import("react/jsx-runtime").JSX.Element;
4
6
  trackEvent: {
5
7
  category: "element";
6
8
  };
@@ -9,7 +11,6 @@ export declare const actionSendBackward: {
9
11
  appState: Readonly<import("../types").AppState>;
10
12
  commitToHistory: true;
11
13
  };
12
- contextItemLabel: string;
13
14
  keyPriority: number;
14
15
  keyTest: (event: React.KeyboardEvent<Element> | KeyboardEvent) => boolean;
15
16
  PanelComponent: ({ updateData, appState }: import("./types").PanelComponentProps) => import("react/jsx-runtime").JSX.Element;
@@ -18,6 +19,8 @@ export declare const actionSendBackward: {
18
19
  };
19
20
  export declare const actionBringForward: {
20
21
  name: "bringForward";
22
+ label: string;
23
+ icon: import("react/jsx-runtime").JSX.Element;
21
24
  trackEvent: {
22
25
  category: "element";
23
26
  };
@@ -26,7 +29,6 @@ export declare const actionBringForward: {
26
29
  appState: Readonly<import("../types").AppState>;
27
30
  commitToHistory: true;
28
31
  };
29
- contextItemLabel: string;
30
32
  keyPriority: number;
31
33
  keyTest: (event: React.KeyboardEvent<Element> | KeyboardEvent) => boolean;
32
34
  PanelComponent: ({ updateData, appState }: import("./types").PanelComponentProps) => import("react/jsx-runtime").JSX.Element;
@@ -35,6 +37,8 @@ export declare const actionBringForward: {
35
37
  };
36
38
  export declare const actionSendToBack: {
37
39
  name: "sendToBack";
40
+ label: string;
41
+ icon: import("react/jsx-runtime").JSX.Element;
38
42
  trackEvent: {
39
43
  category: "element";
40
44
  };
@@ -43,7 +47,6 @@ export declare const actionSendToBack: {
43
47
  appState: Readonly<import("../types").AppState>;
44
48
  commitToHistory: true;
45
49
  };
46
- contextItemLabel: string;
47
50
  keyTest: (event: React.KeyboardEvent<Element> | KeyboardEvent) => boolean;
48
51
  PanelComponent: ({ updateData, appState }: import("./types").PanelComponentProps) => import("react/jsx-runtime").JSX.Element;
49
52
  } & {
@@ -51,6 +54,8 @@ export declare const actionSendToBack: {
51
54
  };
52
55
  export declare const actionBringToFront: {
53
56
  name: "bringToFront";
57
+ label: string;
58
+ icon: import("react/jsx-runtime").JSX.Element;
54
59
  trackEvent: {
55
60
  category: "element";
56
61
  };
@@ -59,7 +64,6 @@ export declare const actionBringToFront: {
59
64
  appState: Readonly<import("../types").AppState>;
60
65
  commitToHistory: true;
61
66
  };
62
- contextItemLabel: string;
63
67
  keyTest: (event: React.KeyboardEvent<Element> | KeyboardEvent) => boolean;
64
68
  PanelComponent: ({ updateData, appState }: import("./types").PanelComponentProps) => import("react/jsx-runtime").JSX.Element;
65
69
  } & {
@@ -1,4 +1,4 @@
1
1
  import { SubtypeOf } from "../utility-types";
2
2
  import { ActionName } from "./types";
3
- export type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "clearCanvas" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "copyAsSvg" | "group" | "ungroup" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleElementLock" | "toggleLaserPointerTool"> | "saveScene" | "imageExport";
4
- export declare const getShortcutFromShortcutName: (name: ShortcutName) => string;
3
+ export type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "clearCanvas" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "copyAsSvg" | "group" | "ungroup" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink" | "toggleElementLock" | "toggleLaserPointerTool" | "resetZoom" | "zoomOut" | "zoomIn" | "zoomToFit" | "zoomToFitSelectionInViewport" | "zoomToFitSelection" | "toggleEraserTool" | "toggleHandTool" | "setFrameAsActiveTool" | "saveFileToDisk" | "saveToActiveFile" | "toggleShortcuts"> | "saveScene" | "imageExport" | "commandPalette";
4
+ export declare const getShortcutFromShortcutName: (name: ShortcutName, idx?: number) => string;
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import { ExcalidrawElement } from "../element/types";
3
- import { AppClassProperties, AppState, ExcalidrawProps, BinaryFiles } from "../types";
3
+ import { AppClassProperties, AppState, ExcalidrawProps, BinaryFiles, UIAppState } from "../types";
4
4
  import { MarkOptional } from "../utility-types";
5
- export type ActionSource = "ui" | "keyboard" | "contextMenu" | "api";
5
+ export type ActionSource = "ui" | "keyboard" | "contextMenu" | "api" | "commandPalette";
6
6
  /** if false, the action should be prevented */
7
7
  export type ActionResult = {
8
8
  elements?: readonly ExcalidrawElement[] | null;
@@ -15,7 +15,7 @@ export type ActionResult = {
15
15
  type ActionFn = (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
16
16
  export type UpdaterFn = (res: ActionResult) => void;
17
17
  export type ActionFilterFn = (action: Action) => void;
18
- export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "createContainerFromText" | "wrapTextInContainer" | "toggleLaserPointerTool";
18
+ export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "createContainerFromText" | "wrapTextInContainer" | "toggleLaserPointerTool" | "commandPalette";
19
19
  export type PanelComponentProps = {
20
20
  elements: readonly ExcalidrawElement[];
21
21
  appState: AppState;
@@ -26,11 +26,13 @@ export type PanelComponentProps = {
26
26
  };
27
27
  export interface Action {
28
28
  name: ActionName;
29
+ label: string | ((elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, app: AppClassProperties) => string);
30
+ keywords?: string[];
31
+ icon?: React.ReactNode | ((appState: UIAppState, elements: readonly ExcalidrawElement[]) => React.ReactNode);
29
32
  PanelComponent?: React.FC<PanelComponentProps>;
30
33
  perform: ActionFn;
31
34
  keyPriority?: number;
32
35
  keyTest?: (event: React.KeyboardEvent | KeyboardEvent, appState: AppState, elements: readonly ExcalidrawElement[], app: AppClassProperties) => boolean;
33
- contextItemLabel?: string | ((elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, app: AppClassProperties) => string);
34
36
  predicate?: (elements: readonly ExcalidrawElement[], appState: AppState, appProps: ExcalidrawProps, app: AppClassProperties) => boolean;
35
37
  checked?: (appState: Readonly<AppState>) => boolean;
36
38
  trackEvent: false | {
@@ -1,5 +1,14 @@
1
- export declare const getClientColor: (id: string) => string;
1
+ import { InteractiveCanvasRenderConfig } from "./scene/types";
2
+ import { Collaborator, InteractiveCanvasAppState, SocketId } from "./types";
3
+ export declare const getClientColor: (socketId: SocketId, collaborator: Collaborator | undefined) => string;
2
4
  /**
3
5
  * returns first char, capitalized
4
6
  */
5
7
  export declare const getNameInitial: (name?: string | null) => string;
8
+ export declare const renderRemoteCursors: ({ context, renderConfig, appState, normalizedWidth, normalizedHeight, }: {
9
+ context: CanvasRenderingContext2D;
10
+ renderConfig: InteractiveCanvasRenderConfig;
11
+ appState: InteractiveCanvasAppState;
12
+ normalizedWidth: number;
13
+ normalizedHeight: number;
14
+ }) => void;
@@ -1,7 +1,9 @@
1
1
  import { ActionManager } from "../actions/manager";
2
- import { NonDeletedElementsMap, NonDeletedSceneElementsMap } from "../element/types";
2
+ import { ExcalidrawElement, NonDeletedElementsMap, NonDeletedSceneElementsMap } from "../element/types";
3
3
  import { AppClassProperties, AppProps, UIAppState, Zoom } from "../types";
4
4
  import "./Actions.scss";
5
+ export declare const canChangeStrokeColor: (appState: UIAppState, targetElements: ExcalidrawElement[]) => boolean;
6
+ export declare const canChangeBackgroundColor: (appState: UIAppState, targetElements: ExcalidrawElement[]) => boolean;
5
7
  export declare const SelectedShapeActions: ({ appState, elementsMap, renderAction, }: {
6
8
  appState: UIAppState;
7
9
  elementsMap: NonDeletedElementsMap | NonDeletedSceneElementsMap;
@@ -359,7 +359,7 @@ declare class App extends React.Component<AppProps, AppState> {
359
359
  * @returns whether the menu was toggled on or off
360
360
  */
361
361
  toggleSidebar: ({ name, tab, force, }: {
362
- name: SidebarName;
362
+ name: SidebarName | null;
363
363
  tab?: string | undefined;
364
364
  force?: boolean | undefined;
365
365
  }) => boolean;
@@ -5,8 +5,7 @@ type AvatarProps = {
5
5
  color: string;
6
6
  name: string;
7
7
  src?: string;
8
- isBeingFollowed?: boolean;
9
- isCurrentUser: boolean;
8
+ className?: string;
10
9
  };
11
- export declare const Avatar: ({ color, onClick, name, src, isBeingFollowed, isCurrentUser, }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const Avatar: ({ color, onClick, name, src, className, }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
12
11
  export {};
@@ -0,0 +1,18 @@
1
+ import { CommandPaletteItem } from "./types";
2
+ import * as defaultItems from "./defaultCommandPaletteItems";
3
+ import "./CommandPalette.scss";
4
+ export declare const DEFAULT_CATEGORIES: {
5
+ app: string;
6
+ export: string;
7
+ tools: string;
8
+ editor: string;
9
+ elements: string;
10
+ links: string;
11
+ };
12
+ type CommandPaletteProps = {
13
+ customCommandPaletteItems?: CommandPaletteItem[];
14
+ };
15
+ export declare const CommandPalette: ((props: CommandPaletteProps) => import("react/jsx-runtime").JSX.Element | null) & {
16
+ defaultItems: typeof defaultItems;
17
+ };
18
+ export {};
@@ -0,0 +1,2 @@
1
+ import { CommandPaletteItem } from "./types";
2
+ export declare const toggleTheme: CommandPaletteItem;
@@ -0,0 +1,25 @@
1
+ import { ActionManager } from "../../actions/manager";
2
+ import { Action } from "../../actions/types";
3
+ import { UIAppState } from "../../types";
4
+ export type CommandPaletteItem = {
5
+ label: string;
6
+ /** additional keywords to match against
7
+ * (appended to haystack, not displayed) */
8
+ keywords?: string[];
9
+ /**
10
+ * string we should match against when searching
11
+ * (deburred name + keywords)
12
+ */
13
+ haystack?: string;
14
+ icon?: React.ReactNode | ((appState: UIAppState) => React.ReactNode);
15
+ category: string;
16
+ order?: number;
17
+ predicate?: boolean | Action["predicate"];
18
+ shortcut?: string;
19
+ /** if false, command will not show while in view mode */
20
+ viewMode?: boolean;
21
+ perform: (data: {
22
+ actionManager: ActionManager;
23
+ event: React.MouseEvent | React.KeyboardEvent | KeyboardEvent;
24
+ }) => void;
25
+ };
@@ -1,3 +1,3 @@
1
1
  export declare const InlineIcon: ({ icon }: {
2
- icon: JSX.Element;
2
+ icon: React.ReactNode;
3
3
  }) => import("react/jsx-runtime").JSX.Element;
@@ -2,21 +2,17 @@ import "./UserList.scss";
2
2
  import React from "react";
3
3
  import { Collaborator, SocketId } from "../types";
4
4
  export type GoToCollaboratorComponentProps = {
5
- clientId: ClientId;
5
+ socketId: SocketId;
6
6
  collaborator: Collaborator;
7
7
  withName: boolean;
8
8
  isBeingFollowed: boolean;
9
9
  };
10
- /** collaborator user id or socket id (fallback) */
11
- type ClientId = string & {
12
- _brand: "UserId";
13
- };
14
- type UserListUserObject = Pick<Collaborator, "avatarUrl" | "id" | "socketId" | "username">;
10
+ type UserListUserObject = Pick<Collaborator, "avatarUrl" | "id" | "socketId" | "username" | "isInCall" | "isSpeaking" | "isMuted">;
15
11
  type UserListProps = {
16
12
  className?: string;
17
13
  mobile?: boolean;
18
14
  collaborators: Map<SocketId, UserListUserObject>;
19
15
  userToFollow: SocketId | null;
20
16
  };
21
- export declare const UserList: React.MemoExoticComponent<({ className, mobile, collaborators, userToFollow }: UserListProps) => import("react/jsx-runtime").JSX.Element | null>;
17
+ export declare const UserList: React.MemoExoticComponent<({ className, mobile, collaborators, userToFollow }: UserListProps) => import("react/jsx-runtime").JSX.Element>;
22
18
  export {};
@@ -1,4 +1,4 @@
1
- import { AppState, ExcalidrawProps } from "../../types";
1
+ import { AppState, ExcalidrawProps, UIAppState } from "../../types";
2
2
  import { ElementsMap, ExcalidrawEmbeddableElement, NonDeletedExcalidrawElement } from "../../element/types";
3
3
  import "./Hyperlink.scss";
4
4
  export declare const Hyperlink: ({ element, elementsMap, setAppState, onLinkOpen, setToast, updateEmbedValidationStatus, }: {
@@ -13,6 +13,6 @@ export declare const Hyperlink: ({ element, elementsMap, setAppState, onLinkOpen
13
13
  } | null) => void;
14
14
  updateEmbedValidationStatus: (element: ExcalidrawEmbeddableElement, status: boolean) => void;
15
15
  }) => import("react/jsx-runtime").JSX.Element | null;
16
- export declare const getContextMenuLabel: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => "labels.link.editEmbed" | "labels.link.edit" | "labels.link.createEmbed" | "labels.link.create";
16
+ export declare const getContextMenuLabel: (elements: readonly NonDeletedExcalidrawElement[], appState: UIAppState) => "labels.link.editEmbed" | "labels.link.edit" | "labels.link.createEmbed" | "labels.link.create";
17
17
  export declare const showHyperlinkTooltip: (element: NonDeletedExcalidrawElement, appState: AppState, elementsMap: ElementsMap) => void;
18
18
  export declare const hideHyperlinkToolip: () => void;
@@ -31,6 +31,7 @@ export declare const ImageIcon: import("react/jsx-runtime").JSX.Element;
31
31
  export declare const EraserIcon: import("react/jsx-runtime").JSX.Element;
32
32
  export declare const ZoomInIcon: import("react/jsx-runtime").JSX.Element;
33
33
  export declare const ZoomOutIcon: import("react/jsx-runtime").JSX.Element;
34
+ export declare const ZoomResetIcon: import("react/jsx-runtime").JSX.Element;
34
35
  export declare const TrashIcon: import("react/jsx-runtime").JSX.Element;
35
36
  export declare const EmbedIcon: import("react/jsx-runtime").JSX.Element;
36
37
  export declare const DuplicateIcon: import("react/jsx-runtime").JSX.Element;
@@ -39,6 +40,7 @@ export declare const SunIcon: import("react/jsx-runtime").JSX.Element;
39
40
  export declare const HamburgerMenuIcon: import("react/jsx-runtime").JSX.Element;
40
41
  export declare const ExportIcon: import("react/jsx-runtime").JSX.Element;
41
42
  export declare const HelpIcon: import("react/jsx-runtime").JSX.Element;
43
+ export declare const HelpIconThin: import("react/jsx-runtime").JSX.Element;
42
44
  export declare const ExternalLinkIcon: import("react/jsx-runtime").JSX.Element;
43
45
  export declare const GithubIcon: import("react/jsx-runtime").JSX.Element;
44
46
  export declare const DiscordIcon: import("react/jsx-runtime").JSX.Element;
@@ -50,6 +52,7 @@ export declare const saveAs: import("react/jsx-runtime").JSX.Element;
50
52
  export declare const LoadIcon: import("react/jsx-runtime").JSX.Element;
51
53
  export declare const clipboard: import("react/jsx-runtime").JSX.Element;
52
54
  export declare const palette: import("react/jsx-runtime").JSX.Element;
55
+ export declare const bucketFillIcon: import("react/jsx-runtime").JSX.Element;
53
56
  export declare const ExportImageIcon: import("react/jsx-runtime").JSX.Element;
54
57
  export declare const exportToFileIcon: import("react/jsx-runtime").JSX.Element;
55
58
  export declare const zoomIn: import("react/jsx-runtime").JSX.Element;
@@ -62,6 +65,7 @@ export declare const questionCircle: import("react/jsx-runtime").JSX.Element;
62
65
  export declare const share: import("react/jsx-runtime").JSX.Element;
63
66
  export declare const warning: import("react/jsx-runtime").JSX.Element;
64
67
  export declare const shareIOS: import("react/jsx-runtime").JSX.Element;
68
+ export declare const exportToPlus: import("react/jsx-runtime").JSX.Element;
65
69
  export declare const shareWindows: import("react/jsx-runtime").JSX.Element;
66
70
  export declare const resetZoom: import("react/jsx-runtime").JSX.Element;
67
71
  export declare const BringForwardIcon: import("react/jsx-runtime").JSX.Element;
@@ -80,7 +84,6 @@ export declare const usersIcon: import("react/jsx-runtime").JSX.Element;
80
84
  export declare const start: import("react/jsx-runtime").JSX.Element;
81
85
  export declare const stop: import("react/jsx-runtime").JSX.Element;
82
86
  export declare const CloseIcon: import("react/jsx-runtime").JSX.Element;
83
- export declare const back: import("react/jsx-runtime").JSX.Element;
84
87
  export declare const clone: import("react/jsx-runtime").JSX.Element;
85
88
  export declare const shield: import("react/jsx-runtime").JSX.Element;
86
89
  export declare const file: import("react/jsx-runtime").JSX.Element;
@@ -137,6 +140,7 @@ export declare const FontSizeSmallIcon: import("react/jsx-runtime").JSX.Element;
137
140
  export declare const FontSizeMediumIcon: import("react/jsx-runtime").JSX.Element;
138
141
  export declare const FontSizeLargeIcon: import("react/jsx-runtime").JSX.Element;
139
142
  export declare const FontSizeExtraLargeIcon: import("react/jsx-runtime").JSX.Element;
143
+ export declare const fontSizeIcon: import("react/jsx-runtime").JSX.Element;
140
144
  export declare const FontFamilyNormalIcon: import("react/jsx-runtime").JSX.Element;
141
145
  export declare const FontFamilyCodeIcon: import("react/jsx-runtime").JSX.Element;
142
146
  export declare const FontFamilyLocalFontIcon: import("react/jsx-runtime").JSX.Element;
@@ -157,6 +161,7 @@ export declare const eraser: import("react/jsx-runtime").JSX.Element;
157
161
  export declare const handIcon: import("react/jsx-runtime").JSX.Element;
158
162
  export declare const downloadIcon: import("react/jsx-runtime").JSX.Element;
159
163
  export declare const copyIcon: import("react/jsx-runtime").JSX.Element;
164
+ export declare const cutIcon: import("react/jsx-runtime").JSX.Element;
160
165
  export declare const helpIcon: import("react/jsx-runtime").JSX.Element;
161
166
  export declare const playerPlayIcon: import("react/jsx-runtime").JSX.Element;
162
167
  export declare const playerStopFilledIcon: import("react/jsx-runtime").JSX.Element;
@@ -169,10 +174,26 @@ export declare const mermaidLogoIcon: import("react/jsx-runtime").JSX.Element;
169
174
  export declare const ArrowRightIcon: import("react/jsx-runtime").JSX.Element;
170
175
  export declare const laserPointerToolIcon: import("react/jsx-runtime").JSX.Element;
171
176
  export declare const MagicIcon: import("react/jsx-runtime").JSX.Element;
177
+ export declare const MagicIconThin: import("react/jsx-runtime").JSX.Element;
172
178
  export declare const OpenAIIcon: import("react/jsx-runtime").JSX.Element;
173
179
  export declare const fullscreenIcon: import("react/jsx-runtime").JSX.Element;
174
180
  export declare const eyeIcon: import("react/jsx-runtime").JSX.Element;
175
181
  export declare const eyeClosedIcon: import("react/jsx-runtime").JSX.Element;
176
182
  export declare const brainIcon: import("react/jsx-runtime").JSX.Element;
183
+ export declare const brainIconThin: import("react/jsx-runtime").JSX.Element;
177
184
  export declare const searchIcon: import("react/jsx-runtime").JSX.Element;
185
+ export declare const clockIcon: import("react/jsx-runtime").JSX.Element;
186
+ export declare const microphoneIcon: import("react/jsx-runtime").JSX.Element;
187
+ export declare const microphoneMutedIcon: import("react/jsx-runtime").JSX.Element;
188
+ export declare const boltIcon: import("react/jsx-runtime").JSX.Element;
189
+ export declare const selectAllIcon: import("react/jsx-runtime").JSX.Element;
190
+ export declare const abacusIcon: import("react/jsx-runtime").JSX.Element;
191
+ export declare const flipVertical: import("react/jsx-runtime").JSX.Element;
192
+ export declare const flipHorizontal: import("react/jsx-runtime").JSX.Element;
193
+ export declare const paintIcon: import("react/jsx-runtime").JSX.Element;
194
+ export declare const zoomAreaIcon: import("react/jsx-runtime").JSX.Element;
195
+ export declare const svgIcon: import("react/jsx-runtime").JSX.Element;
196
+ export declare const pngIcon: import("react/jsx-runtime").JSX.Element;
197
+ export declare const magnetIcon: import("react/jsx-runtime").JSX.Element;
198
+ export declare const coffeeIcon: import("react/jsx-runtime").JSX.Element;
178
199
  export {};
@@ -11,6 +11,10 @@ export declare const SaveAsImage: {
11
11
  (): import("react/jsx-runtime").JSX.Element;
12
12
  displayName: string;
13
13
  };
14
+ export declare const CommandPalette: {
15
+ (): import("react/jsx-runtime").JSX.Element;
16
+ displayName: string;
17
+ };
14
18
  export declare const Help: {
15
19
  (): import("react/jsx-runtime").JSX.Element;
16
20
  displayName: string;
@@ -8,6 +8,7 @@ export declare const isChrome: boolean;
8
8
  export declare const isSafari: boolean;
9
9
  export declare const isIOS: boolean;
10
10
  export declare const isBrave: () => boolean;
11
+ export declare const supportsResizeObserver: boolean;
11
12
  export declare const APP_NAME = "Excalidraw";
12
13
  export declare const DRAGGING_THRESHOLD = 10;
13
14
  export declare const LINE_CONFIRM_THRESHOLD = 8;
@@ -15,6 +16,7 @@ export declare const ELEMENT_SHIFT_TRANSLATE_AMOUNT = 5;
15
16
  export declare const ELEMENT_TRANSLATE_AMOUNT = 1;
16
17
  export declare const TEXT_TO_CENTER_SNAP_THRESHOLD = 30;
17
18
  export declare const SHIFT_LOCKING_ANGLE: number;
19
+ export declare const DEFAULT_LASER_COLOR = "red";
18
20
  export declare const CURSOR_TYPE: {
19
21
  TEXT: string;
20
22
  CROSSHAIR: string;
@@ -122,6 +124,9 @@ export declare const DEFAULT_TEXT_ALIGN = "left";
122
124
  export declare const DEFAULT_VERTICAL_ALIGN = "top";
123
125
  export declare const DEFAULT_VERSION = "{version}";
124
126
  export declare const DEFAULT_TRANSFORM_HANDLE_SPACING = 2;
127
+ export declare const COLOR_WHITE = "#ffffff";
128
+ export declare const COLOR_CHARCOAL_BLACK = "#1e1e1e";
129
+ export declare const COLOR_VOICE_CALL = "#a2f1a6";
125
130
  export declare const CANVAS_ONLY_ACTIONS: string[];
126
131
  export declare const GRID_SIZE = 20;
127
132
  export declare const IMAGE_MIME_TYPES: {
@@ -0,0 +1 @@
1
+ export declare const deburr: (str: string) => string;
@@ -8,6 +8,8 @@ export declare const actionSetEmbeddableAsActiveTool: {
8
8
  trackEvent: {
9
9
  category: "toolbar";
10
10
  };
11
+ target: string;
12
+ label: string;
11
13
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<import("../types").AppState>, _: any, app: import("../types").AppClassProperties) => {
12
14
  elements: readonly ExcalidrawElement[];
13
15
  appState: {
@@ -90,6 +92,8 @@ export declare const actionSetEmbeddableAsActiveTool: {
90
92
  } | {
91
93
  name: "ttd";
92
94
  tab: "mermaid" | "text-to-diagram";
95
+ } | {
96
+ name: "commandPalette";
93
97
  } | null;
94
98
  defaultSidebarDockedPreference: boolean;
95
99
  lastPointerDownWith: import("./types").PointerType;
@@ -136,6 +140,9 @@ export declare const actionSetEmbeddableAsActiveTool: {
136
140
  id?: string | undefined;
137
141
  socketId?: import("../types").SocketId | undefined;
138
142
  isCurrentUser?: boolean | undefined;
143
+ isInCall?: boolean | undefined;
144
+ isSpeaking?: boolean | undefined;
145
+ isMuted?: boolean | undefined;
139
146
  }>>;
140
147
  showStats: boolean;
141
148
  currentChartType: import("./types").ChartType;
@@ -201,6 +201,8 @@ export declare class LinearElementEditor {
201
201
  } | {
202
202
  name: "ttd";
203
203
  tab: "mermaid" | "text-to-diagram";
204
+ } | {
205
+ name: "commandPalette";
204
206
  } | null;
205
207
  defaultSidebarDockedPreference: boolean;
206
208
  lastPointerDownWith: import("./types").PointerType;
@@ -247,6 +249,9 @@ export declare class LinearElementEditor {
247
249
  id?: string | undefined;
248
250
  socketId?: import("../types").SocketId | undefined;
249
251
  isCurrentUser?: boolean | undefined;
252
+ isInCall?: boolean | undefined;
253
+ isSpeaking?: boolean | undefined;
254
+ isMuted?: boolean | undefined;
250
255
  }>>;
251
256
  showStats: boolean;
252
257
  currentChartType: import("./types").ChartType;
@@ -11,13 +11,8 @@ export declare const computeBoundTextPosition: (container: ExcalidrawElement, bo
11
11
  y: number;
12
12
  };
13
13
  export declare const measureText: (text: string, font: FontString, lineHeight: ExcalidrawTextElement["lineHeight"]) => {
14
- baseline: number;
15
- height: number;
16
- width: number;
17
- } | {
18
14
  width: number;
19
15
  height: number;
20
- baseline?: undefined;
21
16
  };
22
17
  /**
23
18
  * To get unitless line-height (if unknown) we can calculate it by dividing
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Returns a stable function of the same type.
3
+ */
4
+ export declare const useStableCallback: <T extends (...args: any[]) => any>(userFn: T) => T;
@@ -26,7 +26,7 @@ export { loadFromBlob, loadSceneOrLibraryFromBlob, loadLibraryFromBlob, } from "
26
26
  export { getFreeDrawSvgPath } from "./renderer/renderElement";
27
27
  export { mergeLibraryItems, getLibraryItemsHash } from "./data/library";
28
28
  export { isLinearElement } from "./element/typeChecks";
29
- export { FONT_FAMILY, THEME, MIME_TYPES, ROUNDNESS } from "./constants";
29
+ export { FONT_FAMILY, THEME, MIME_TYPES, ROUNDNESS, DEFAULT_LASER_COLOR, } from "./constants";
30
30
  export { mutateElement, newElementWith, bumpVersion, } from "./element/mutateElement";
31
31
  export { parseLibraryTokensFromUrl, useHandleLibrary } from "./data/library";
32
32
  export { sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, } from "./utils";
@@ -42,6 +42,7 @@ export declare const KEYS: {
42
42
  readonly PERIOD: ".";
43
43
  readonly COMMA: ",";
44
44
  readonly SUBTRACT: "-";
45
+ readonly SLASH: "/";
45
46
  readonly A: "a";
46
47
  readonly C: "c";
47
48
  readonly D: "d";
@@ -1,7 +1,7 @@
1
1
  import type { RoughCanvas } from "roughjs/bin/canvas";
2
2
  import { Drawable } from "roughjs/bin/core";
3
- import { ExcalidrawTextElement, NonDeletedElementsMap, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "../element/types";
4
- import { AppClassProperties, AppState, EmbedsValidationStatus, ElementsPendingErasure, InteractiveCanvasAppState, StaticCanvasAppState } from "../types";
3
+ import { ExcalidrawElement, ExcalidrawTextElement, NonDeletedElementsMap, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "../element/types";
4
+ import { AppClassProperties, AppState, EmbedsValidationStatus, ElementsPendingErasure, InteractiveCanvasAppState, StaticCanvasAppState, SocketId, UserIdleState } from "../types";
5
5
  import { MakeBrand } from "../utility-types";
6
6
  export type RenderableElementsMap = NonDeletedElementsMap & MakeBrand<"RenderableElementsMap">;
7
7
  export type StaticCanvasRenderConfig = {
@@ -26,24 +26,14 @@ export type SVGRenderConfig = {
26
26
  embedsValidationStatus: EmbedsValidationStatus;
27
27
  };
28
28
  export type InteractiveCanvasRenderConfig = {
29
- remoteSelectedElementIds: {
30
- [elementId: string]: string[];
31
- };
32
- remotePointerViewportCoords: {
33
- [id: string]: {
34
- x: number;
35
- y: number;
36
- };
37
- };
38
- remotePointerUserStates: {
39
- [id: string]: string;
40
- };
41
- remotePointerUsernames: {
42
- [id: string]: string;
43
- };
44
- remotePointerButton?: {
45
- [id: string]: string | undefined;
46
- };
29
+ remoteSelectedElementIds: Map<ExcalidrawElement["id"], SocketId[]>;
30
+ remotePointerViewportCoords: Map<SocketId, {
31
+ x: number;
32
+ y: number;
33
+ }>;
34
+ remotePointerUserStates: Map<SocketId, UserIdleState>;
35
+ remotePointerUsernames: Map<SocketId, string>;
36
+ remotePointerButton: Map<SocketId, string | undefined>;
47
37
  selectionColor?: string;
48
38
  renderScrollbars?: boolean;
49
39
  };
@@ -37,11 +37,27 @@ export type Collaborator = Readonly<{
37
37
  id?: string;
38
38
  socketId?: SocketId;
39
39
  isCurrentUser?: boolean;
40
+ isInCall?: boolean;
41
+ isSpeaking?: boolean;
42
+ isMuted?: boolean;
40
43
  }>;
41
44
  export type CollaboratorPointer = {
42
45
  x: number;
43
46
  y: number;
44
47
  tool: "pointer" | "laser";
48
+ /**
49
+ * Whether to render cursor + username. Useful when you only want to render
50
+ * laser trail.
51
+ *
52
+ * @default true
53
+ */
54
+ renderCursor?: boolean;
55
+ /**
56
+ * Explicit laser color.
57
+ *
58
+ * @default string collaborator's cursor color
59
+ */
60
+ laserColor?: string;
45
61
  };
46
62
  export type DataURL = string & {
47
63
  _brand: "DataURL";
@@ -204,6 +220,8 @@ export interface AppState {
204
220
  } | {
205
221
  name: "ttd";
206
222
  tab: "text-to-diagram" | "mermaid";
223
+ } | {
224
+ name: "commandPalette";
207
225
  };
208
226
  /**
209
227
  * Reflects user preference for whether the default sidebar should be docked.
@@ -296,9 +314,9 @@ export interface AppState {
296
314
  y: number;
297
315
  } | null;
298
316
  objectsSnapModeEnabled: boolean;
299
- /** the user's clientId & username who is being followed on the canvas */
317
+ /** the user's socket id & username who is being followed on the canvas */
300
318
  userToFollow: UserToFollow | null;
301
- /** the clientIds of the users following the current user */
319
+ /** the socket ids of the users following the current user */
302
320
  followedBy: Set<SocketId>;
303
321
  }
304
322
  export type UIAppState = Omit<AppState, "suggestedBindings" | "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
@@ -476,6 +494,7 @@ export type AppClassProperties = {
476
494
  addElementsFromPasteOrLibrary: App["addElementsFromPasteOrLibrary"];
477
495
  setSelection: App["setSelection"];
478
496
  togglePenMode: App["togglePenMode"];
497
+ toggleLock: App["toggleLock"];
479
498
  setActiveTool: App["setActiveTool"];
480
499
  setOpenDialog: App["setOpenDialog"];
481
500
  insertEmbeddableElement: App["insertEmbeddableElement"];