@zsviczian/excalidraw 0.13.0-obsidian-2 → 0.14.0-obsidian

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 (74) hide show
  1. package/README.md +417 -19
  2. package/dist/excalidraw.development.js +491 -1096
  3. package/dist/excalidraw.production.min.js +1 -1
  4. package/dist/excalidraw.production.min.js.LICENSE.txt +0 -102
  5. package/package.json +1 -1
  6. package/types/actions/actionAddToLibrary.d.ts +18 -3
  7. package/types/actions/actionAlign.d.ts +6 -18
  8. package/types/actions/actionBoundText.d.ts +8 -3
  9. package/types/actions/actionCanvas.d.ts +62 -30
  10. package/types/actions/actionClipboard.d.ts +49 -6
  11. package/types/actions/actionDeleteSelected.d.ts +19 -6
  12. package/types/actions/actionDistribute.d.ts +2 -6
  13. package/types/actions/actionDuplicateSelection.d.ts +1 -3
  14. package/types/actions/actionExport.d.ts +62 -33
  15. package/types/actions/actionFinalize.d.ts +13 -5
  16. package/types/actions/actionFlip.d.ts +2 -2
  17. package/types/actions/actionGroup.d.ts +4 -8
  18. package/types/actions/actionLinearEditor.d.ts +7 -2
  19. package/types/actions/actionMenu.d.ts +19 -11
  20. package/types/actions/actionNavigate.d.ts +1 -3
  21. package/types/actions/actionProperties.d.ts +91 -52
  22. package/types/actions/actionStyles.d.ts +6 -1
  23. package/types/actions/actionToggleGridMode.d.ts +7 -1
  24. package/types/actions/actionToggleLock.d.ts +6 -1
  25. package/types/actions/actionToggleStats.d.ts +6 -1
  26. package/types/actions/actionToggleViewMode.d.ts +7 -1
  27. package/types/actions/actionToggleZenMode.d.ts +7 -1
  28. package/types/actions/actionZindex.d.ts +4 -12
  29. package/types/actions/manager.d.ts +2 -1
  30. package/types/actions/types.d.ts +2 -4
  31. package/types/components/App.d.ts +7 -50
  32. package/types/components/Button.d.ts +15 -0
  33. package/types/components/CollabButton.d.ts +1 -2
  34. package/types/components/ContextMenu.d.ts +8 -20
  35. package/types/components/JSONExportDialog.d.ts +3 -1
  36. package/types/components/LayerUI.d.ts +2 -3
  37. package/types/components/LibraryMenuHeaderContent.d.ts +23 -0
  38. package/types/components/MobileMenu.d.ts +4 -6
  39. package/types/components/UserList.d.ts +0 -2
  40. package/types/components/dropdownMenu/DropdownMenu.d.ts +64 -0
  41. package/types/components/dropdownMenu/DropdownMenuContent.d.ts +11 -0
  42. package/types/components/dropdownMenu/DropdownMenuGroup.d.ts +11 -0
  43. package/types/components/dropdownMenu/DropdownMenuItem.d.ts +13 -0
  44. package/types/components/dropdownMenu/DropdownMenuItemContent.d.ts +6 -0
  45. package/types/components/dropdownMenu/DropdownMenuItemCustom.d.ts +6 -0
  46. package/types/components/dropdownMenu/DropdownMenuItemLink.d.ts +12 -0
  47. package/types/components/dropdownMenu/DropdownMenuSeparator.d.ts +5 -0
  48. package/types/components/dropdownMenu/DropdownMenuTrigger.d.ts +9 -0
  49. package/types/components/dropdownMenu/dropdownMenuUtils.d.ts +3 -0
  50. package/types/components/footer/Footer.d.ts +13 -0
  51. package/types/components/footer/FooterCenter.d.ts +8 -0
  52. package/types/components/icons.d.ts +1 -1
  53. package/types/components/live-collaboration/LiveCollaborationTrigger.d.ts +10 -0
  54. package/types/components/main-menu/DefaultItems.d.ts +44 -0
  55. package/types/components/main-menu/MainMenu.d.ts +55 -0
  56. package/types/components/mainMenu/DefaultItems.d.ts +44 -0
  57. package/types/components/mainMenu/MainMenu.d.ts +63 -0
  58. package/types/components/welcome-screen/WelcomeScreen.Center.d.ts +58 -0
  59. package/types/components/welcome-screen/WelcomeScreen.Hints.d.ts +19 -0
  60. package/types/components/welcome-screen/WelcomeScreen.d.ts +85 -0
  61. package/types/constants.d.ts +0 -3
  62. package/types/element/Hyperlink.d.ts +8 -5
  63. package/types/element/linearElementEditor.d.ts +6 -1
  64. package/types/element/textElement.d.ts +7 -0
  65. package/types/element/textWysiwyg.d.ts +6 -1
  66. package/types/excalidraw-app/data/index.d.ts +5 -0
  67. package/types/excalidraw-app/data/localStorage.d.ts +5 -0
  68. package/types/keys.d.ts +2 -0
  69. package/types/packages/excalidraw/example/CustomFooter.d.ts +5 -0
  70. package/types/packages/excalidraw/example/MobileFooter.d.ts +5 -0
  71. package/types/packages/excalidraw/index.d.ts +10 -0
  72. package/types/renderer/easingFunctions.d.ts +6 -0
  73. package/types/types.d.ts +41 -19
  74. package/types/utils.d.ts +17 -0
@@ -0,0 +1,55 @@
1
+ import React from "react";
2
+ import * as DefaultItems from "./DefaultItems";
3
+ declare const MainMenu: {
4
+ ({ children }: {
5
+ children?: React.ReactNode;
6
+ }): JSX.Element;
7
+ Trigger: {
8
+ ({ className, children, onToggle, }: {
9
+ className?: string | undefined;
10
+ children: React.ReactNode;
11
+ onToggle: () => void;
12
+ }): JSX.Element;
13
+ displayName: string;
14
+ };
15
+ Item: {
16
+ ({ icon, onSelect, children, shortcut, className, ...rest }: {
17
+ icon?: JSX.Element | undefined;
18
+ onSelect: () => void;
19
+ children: React.ReactNode;
20
+ shortcut?: string | undefined;
21
+ className?: string | undefined;
22
+ } & React.ButtonHTMLAttributes<HTMLButtonElement>): JSX.Element;
23
+ displayName: string;
24
+ };
25
+ ItemLink: {
26
+ ({ icon, shortcut, href, children, className, ...rest }: {
27
+ icon?: JSX.Element | undefined;
28
+ children: React.ReactNode;
29
+ shortcut?: string | undefined;
30
+ className?: string | undefined;
31
+ href: string;
32
+ } & React.AnchorHTMLAttributes<HTMLAnchorElement>): JSX.Element;
33
+ displayName: string;
34
+ };
35
+ ItemCustom: ({ children, className, ...rest }: {
36
+ children: React.ReactNode;
37
+ className?: string | undefined;
38
+ } & React.HTMLAttributes<HTMLDivElement>) => JSX.Element;
39
+ Group: {
40
+ ({ children, className, style, title, }: {
41
+ children: React.ReactNode;
42
+ className?: string | undefined;
43
+ style?: React.CSSProperties | undefined;
44
+ title?: string | undefined;
45
+ }): JSX.Element;
46
+ displayName: string;
47
+ };
48
+ Separator: {
49
+ (): JSX.Element;
50
+ displayName: string;
51
+ };
52
+ DefaultItems: typeof DefaultItems;
53
+ displayName: string;
54
+ };
55
+ export default MainMenu;
@@ -0,0 +1,44 @@
1
+ import "./DefaultItems.scss";
2
+ export declare const LoadScene: {
3
+ (): JSX.Element | null;
4
+ displayName: string;
5
+ };
6
+ export declare const SaveToActiveFile: {
7
+ (): JSX.Element | null;
8
+ displayName: string;
9
+ };
10
+ export declare const SaveAsImage: {
11
+ (): JSX.Element;
12
+ displayName: string;
13
+ };
14
+ export declare const Help: {
15
+ (): JSX.Element;
16
+ displayName: string;
17
+ };
18
+ export declare const ClearCanvas: {
19
+ (): JSX.Element | null;
20
+ displayName: string;
21
+ };
22
+ export declare const ToggleTheme: {
23
+ (): JSX.Element | null;
24
+ displayName: string;
25
+ };
26
+ export declare const ChangeCanvasBackground: {
27
+ (): JSX.Element | null;
28
+ displayName: string;
29
+ };
30
+ export declare const Export: {
31
+ (): JSX.Element;
32
+ displayName: string;
33
+ };
34
+ export declare const Socials: {
35
+ (): JSX.Element;
36
+ displayName: string;
37
+ };
38
+ export declare const LiveCollaboration: {
39
+ ({ onSelect, isCollaborating, }: {
40
+ onSelect: () => void;
41
+ isCollaborating: boolean;
42
+ }): JSX.Element;
43
+ displayName: string;
44
+ };
@@ -0,0 +1,63 @@
1
+ import React from "react";
2
+ import * as DefaultItems from "./DefaultItems";
3
+ declare const MainMenu: {
4
+ ({ children }: {
5
+ children?: React.ReactNode;
6
+ }): JSX.Element;
7
+ Trigger: {
8
+ ({ className, children, onToggle, }: {
9
+ className?: string | undefined;
10
+ children: React.ReactNode;
11
+ onToggle: () => void;
12
+ }): JSX.Element;
13
+ displayName: string;
14
+ };
15
+ Item: {
16
+ ({ icon, onSelect, children, dataTestId, shortcut, className, style, ariaLabel, }: {
17
+ icon?: JSX.Element | undefined;
18
+ onSelect: () => void;
19
+ children: React.ReactNode;
20
+ dataTestId?: string | undefined;
21
+ shortcut?: string | undefined;
22
+ className?: string | undefined;
23
+ style?: React.CSSProperties | undefined;
24
+ ariaLabel?: string | undefined;
25
+ }): JSX.Element;
26
+ displayName: string;
27
+ };
28
+ ItemLink: {
29
+ ({ icon, dataTestId, shortcut, href, children, className, style, ariaLabel, }: {
30
+ icon?: JSX.Element | undefined;
31
+ children: React.ReactNode;
32
+ dataTestId?: string | undefined;
33
+ shortcut?: string | undefined;
34
+ className?: string | undefined;
35
+ href: string;
36
+ style?: React.CSSProperties | undefined;
37
+ ariaLabel?: string | undefined;
38
+ }): JSX.Element;
39
+ displayName: string;
40
+ };
41
+ ItemCustom: ({ children, className, style, dataTestId, }: {
42
+ children: React.ReactNode;
43
+ className?: string | undefined;
44
+ style?: React.CSSProperties | undefined;
45
+ dataTestId?: string | undefined;
46
+ }) => JSX.Element;
47
+ Group: {
48
+ ({ children, className, style, title, }: {
49
+ children: React.ReactNode;
50
+ className?: string | undefined;
51
+ style?: React.CSSProperties | undefined;
52
+ title?: string | undefined;
53
+ }): JSX.Element;
54
+ displayName: string;
55
+ };
56
+ Separator: {
57
+ (): JSX.Element;
58
+ displayName: string;
59
+ };
60
+ DefaultItems: typeof DefaultItems;
61
+ displayName: string;
62
+ };
63
+ export default MainMenu;
@@ -0,0 +1,58 @@
1
+ /// <reference types="react" />
2
+ declare const Center: {
3
+ ({ children }: {
4
+ children?: React.ReactNode;
5
+ }): JSX.Element;
6
+ displayName: string;
7
+ Logo: {
8
+ ({ children }: {
9
+ children?: React.ReactNode;
10
+ }): JSX.Element;
11
+ displayName: string;
12
+ };
13
+ Heading: {
14
+ ({ children }: {
15
+ children: React.ReactNode;
16
+ }): JSX.Element;
17
+ displayName: string;
18
+ };
19
+ Menu: {
20
+ ({ children }: {
21
+ children?: React.ReactNode;
22
+ }): JSX.Element;
23
+ displayName: string;
24
+ };
25
+ MenuItem: {
26
+ ({ onSelect, children, icon, shortcut, className, ...props }: {
27
+ onSelect: () => void;
28
+ children: React.ReactNode;
29
+ icon?: JSX.Element | undefined;
30
+ shortcut?: string | null | undefined;
31
+ } & import("react").ButtonHTMLAttributes<HTMLButtonElement>): JSX.Element;
32
+ displayName: string;
33
+ };
34
+ MenuItemLink: {
35
+ ({ children, href, icon, shortcut, className, ...props }: {
36
+ children: React.ReactNode;
37
+ href: string;
38
+ icon?: JSX.Element | undefined;
39
+ shortcut?: string | null | undefined;
40
+ } & import("react").AnchorHTMLAttributes<HTMLAnchorElement>): JSX.Element;
41
+ displayName: string;
42
+ };
43
+ MenuItemHelp: {
44
+ (): JSX.Element;
45
+ displayName: string;
46
+ };
47
+ MenuItemLoadScene: {
48
+ (): JSX.Element | null;
49
+ displayName: string;
50
+ };
51
+ MenuItemLiveCollaborationTrigger: {
52
+ ({ onSelect, }: {
53
+ onSelect: () => any;
54
+ }): JSX.Element;
55
+ displayName: string;
56
+ };
57
+ };
58
+ export { Center };
@@ -0,0 +1,19 @@
1
+ declare const MenuHint: {
2
+ ({ children }: {
3
+ children?: React.ReactNode;
4
+ }): JSX.Element;
5
+ displayName: string;
6
+ };
7
+ declare const ToolbarHint: {
8
+ ({ children }: {
9
+ children?: React.ReactNode;
10
+ }): JSX.Element;
11
+ displayName: string;
12
+ };
13
+ declare const HelpHint: {
14
+ ({ children }: {
15
+ children?: React.ReactNode;
16
+ }): JSX.Element;
17
+ displayName: string;
18
+ };
19
+ export { HelpHint, MenuHint, ToolbarHint };
@@ -0,0 +1,85 @@
1
+ /// <reference types="react" />
2
+ import "./WelcomeScreen.scss";
3
+ declare const WelcomeScreen: {
4
+ (props: {
5
+ children: React.ReactNode;
6
+ }): null;
7
+ displayName: string;
8
+ Center: {
9
+ ({ children }: {
10
+ children?: import("react").ReactNode;
11
+ }): JSX.Element;
12
+ displayName: string;
13
+ Logo: {
14
+ ({ children }: {
15
+ children?: import("react").ReactNode;
16
+ }): JSX.Element;
17
+ displayName: string;
18
+ };
19
+ Heading: {
20
+ ({ children }: {
21
+ children: import("react").ReactNode;
22
+ }): JSX.Element;
23
+ displayName: string;
24
+ };
25
+ Menu: {
26
+ ({ children }: {
27
+ children?: import("react").ReactNode;
28
+ }): JSX.Element;
29
+ displayName: string;
30
+ };
31
+ MenuItem: {
32
+ ({ onSelect, children, icon, shortcut, className, ...props }: {
33
+ onSelect: () => void;
34
+ children: import("react").ReactNode;
35
+ icon?: JSX.Element | undefined;
36
+ shortcut?: string | null | undefined;
37
+ } & import("react").ButtonHTMLAttributes<HTMLButtonElement>): JSX.Element;
38
+ displayName: string;
39
+ };
40
+ MenuItemLink: {
41
+ ({ children, href, icon, shortcut, className, ...props }: {
42
+ children: import("react").ReactNode;
43
+ href: string;
44
+ icon?: JSX.Element | undefined;
45
+ shortcut?: string | null | undefined;
46
+ } & import("react").AnchorHTMLAttributes<HTMLAnchorElement>): JSX.Element;
47
+ displayName: string;
48
+ };
49
+ MenuItemHelp: {
50
+ (): JSX.Element;
51
+ displayName: string;
52
+ };
53
+ MenuItemLoadScene: {
54
+ (): JSX.Element | null;
55
+ displayName: string;
56
+ };
57
+ MenuItemLiveCollaborationTrigger: {
58
+ ({ onSelect, }: {
59
+ onSelect: () => any;
60
+ }): JSX.Element;
61
+ displayName: string;
62
+ };
63
+ };
64
+ Hints: {
65
+ MenuHint: {
66
+ ({ children }: {
67
+ children?: import("react").ReactNode;
68
+ }): JSX.Element;
69
+ displayName: string;
70
+ };
71
+ ToolbarHint: {
72
+ ({ children }: {
73
+ children?: import("react").ReactNode;
74
+ }): JSX.Element;
75
+ displayName: string;
76
+ };
77
+ HelpHint: {
78
+ ({ children }: {
79
+ children?: import("react").ReactNode;
80
+ }): JSX.Element;
81
+ displayName: string;
82
+ };
83
+ };
84
+ };
85
+ export default WelcomeScreen;
@@ -154,9 +154,6 @@ export declare const ROUNDNESS: {
154
154
  readonly PROPORTIONAL_RADIUS: 2;
155
155
  readonly ADAPTIVE_RADIUS: 3;
156
156
  };
157
- export declare const COOKIES: {
158
- readonly AUTH_STATE_COOKIE: "excplus-auth";
159
- };
160
157
  /** key containt id of precedeing elemnt id we use in reconciliation during
161
158
  * collaboration */
162
159
  export declare const PRECEDING_ELEMENT_KEY = "__precedingElement__";
@@ -18,6 +18,11 @@ export declare const actionLink: {
18
18
  appState: {
19
19
  showHyperlinkPopup: "editor";
20
20
  openMenu: null;
21
+ contextMenu: {
22
+ items: import("../components/ContextMenu").ContextMenuItems;
23
+ top: number;
24
+ left: number;
25
+ } | null;
21
26
  showWelcomeScreen: boolean;
22
27
  isLoading: boolean;
23
28
  errorMessage: string | null;
@@ -73,7 +78,7 @@ export declare const actionLink: {
73
78
  }>;
74
79
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
75
80
  openSidebar: "library" | "customSidebar" | null;
76
- openDialog: "imageExport" | "help" | null;
81
+ openDialog: "imageExport" | "help" | "jsonExport" | null;
77
82
  isSidebarDocked: boolean;
78
83
  lastPointerDownWith: import("./types").PointerType;
79
84
  selectedElementIds: {
@@ -129,10 +134,8 @@ export declare const actionLink: {
129
134
  };
130
135
  keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
131
136
  contextItemLabel: (elements: readonly import("./types").ExcalidrawElement[], appState: Readonly<AppState>) => "labels.link.edit" | "labels.link.create";
132
- contextItemPredicate: (elements: readonly import("./types").ExcalidrawElement[], appState: AppState) => boolean;
133
- PanelComponent: ({ elements, appState, updateData }: import("../actions/types").PanelComponentProps & {
134
- isInHamburgerMenu: boolean;
135
- }) => JSX.Element;
137
+ predicate: (elements: readonly import("./types").ExcalidrawElement[], appState: AppState) => boolean;
138
+ PanelComponent: ({ elements, appState, updateData }: import("../actions/types").PanelComponentProps) => JSX.Element;
136
139
  } & {
137
140
  keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
138
141
  };
@@ -123,6 +123,11 @@ export declare class LinearElementEditor {
123
123
  hoverPointIndex: number;
124
124
  segmentMidPointHoveredCoords: readonly [number, number] | null;
125
125
  };
126
+ contextMenu: {
127
+ items: import("../components/ContextMenu").ContextMenuItems;
128
+ top: number;
129
+ left: number;
130
+ } | null;
126
131
  showWelcomeScreen: boolean;
127
132
  isLoading: boolean;
128
133
  errorMessage: string | null;
@@ -178,7 +183,7 @@ export declare class LinearElementEditor {
178
183
  openMenu: "canvas" | "shape" | null;
179
184
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
180
185
  openSidebar: "library" | "customSidebar" | null;
181
- openDialog: "imageExport" | "help" | null;
186
+ openDialog: "imageExport" | "help" | "jsonExport" | null;
182
187
  isSidebarDocked: boolean;
183
188
  lastPointerDownWith: import("./types").PointerType;
184
189
  selectedElementIds: {
@@ -9,8 +9,15 @@ export declare const measureText: (text: string, font: FontString, maxWidth?: nu
9
9
  width: number;
10
10
  height: number;
11
11
  baseline: number;
12
+ container: HTMLDivElement;
13
+ } | {
14
+ width: number;
15
+ height: number;
16
+ baseline: number;
17
+ container?: undefined;
12
18
  };
13
19
  export declare const getApproxLineHeight: (font: FontString) => number;
20
+ export declare const getTextWidth: (text: string, font: FontString) => number;
14
21
  export declare const wrapText: (text: string, font: FontString, maxWidth: number) => string;
15
22
  export declare const charWidth: {
16
23
  calculate: (char: string, font: FontString) => number;
@@ -1,5 +1,10 @@
1
- import { ExcalidrawElement, ExcalidrawTextElement } from "./types";
1
+ import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawTextContainer } from "./types";
2
2
  import App from "../components/App";
3
+ export declare const updateOriginalContainerCache: (id: ExcalidrawTextContainer["id"], height: ExcalidrawTextContainer["height"]) => {
4
+ height: ExcalidrawTextContainer["height"];
5
+ };
6
+ export declare const resetOriginalContainerCache: (id: ExcalidrawTextContainer["id"]) => void;
7
+ export declare const getOriginalContainerHeightFromCache: (id: ExcalidrawTextContainer["id"]) => number | null;
3
8
  export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, app, }: {
4
9
  id: ExcalidrawElement["id"];
5
10
  onChange?: ((text: string) => void) | undefined;
@@ -91,6 +91,11 @@ export declare const loadScene: (id: string | null, privateKey: string | null, l
91
91
  lastActiveToolBeforeEraser: import("../../types").LastActiveToolBeforeEraser;
92
92
  locked: boolean;
93
93
  };
94
+ contextMenu: {
95
+ items: import("../../components/ContextMenu").ContextMenuItems;
96
+ top: number;
97
+ left: number;
98
+ } | null;
94
99
  showWelcomeScreen: boolean;
95
100
  isLoading: boolean;
96
101
  errorMessage: string | null;
@@ -65,6 +65,11 @@ export declare const importFromLocalStorage: () => {
65
65
  showStats: boolean;
66
66
  currentChartType: import("../../element/types").ChartType;
67
67
  selectedLinearElement: import("../../element/linearElementEditor").LinearElementEditor | null;
68
+ contextMenu: {
69
+ items: import("../../components/ContextMenu").ContextMenuItems;
70
+ top: number;
71
+ left: number;
72
+ } | null;
68
73
  isLoading: boolean;
69
74
  errorMessage: string | null;
70
75
  draggingElement: import("../../element/types").NonDeletedExcalidrawElement | null;
package/types/keys.d.ts CHANGED
@@ -27,6 +27,8 @@ export declare const KEYS: {
27
27
  readonly ARROW_LEFT: "ArrowLeft";
28
28
  readonly ARROW_RIGHT: "ArrowRight";
29
29
  readonly ARROW_UP: "ArrowUp";
30
+ readonly PAGE_UP: "PageUp";
31
+ readonly PAGE_DOWN: "PageDown";
30
32
  readonly BACKSPACE: "Backspace";
31
33
  readonly ALT: "Alt";
32
34
  readonly CTRL_OR_CMD: "metaKey" | "ctrlKey";
@@ -0,0 +1,5 @@
1
+ import { ExcalidrawImperativeAPI } from "../../../types";
2
+ declare const CustomFooter: ({ excalidrawAPI, }: {
3
+ excalidrawAPI: ExcalidrawImperativeAPI;
4
+ }) => JSX.Element;
5
+ export default CustomFooter;
@@ -0,0 +1,5 @@
1
+ import { ExcalidrawImperativeAPI } from "../../../types";
2
+ declare const MobileFooter: ({ excalidrawAPI, }: {
3
+ excalidrawAPI: ExcalidrawImperativeAPI;
4
+ }) => JSX.Element | null;
5
+ export default MobileFooter;
@@ -2,6 +2,10 @@ import React from "react";
2
2
  import "../../css/app.scss";
3
3
  import "../../css/styles.scss";
4
4
  import { ExcalidrawAPIRefValue, ExcalidrawProps } from "../../types";
5
+ import Footer from "../../components/footer/FooterCenter";
6
+ import MainMenu from "../../components/main-menu/MainMenu";
7
+ import WelcomeScreen from "../../components/welcome-screen/WelcomeScreen";
8
+ import LiveCollaborationTrigger from "../../components/live-collaboration/LiveCollaborationTrigger";
5
9
  declare type PublicExcalidrawProps = Omit<ExcalidrawProps, "forwardedRef">;
6
10
  export declare const Excalidraw: React.MemoExoticComponent<React.ForwardRefExoticComponent<PublicExcalidrawProps & React.RefAttributes<ExcalidrawAPIRefValue>>>;
7
11
  export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
@@ -22,3 +26,9 @@ export { mutateElement, newElementWith, bumpVersion, } from "../../element/mutat
22
26
  export { parseLibraryTokensFromUrl, useHandleLibrary, } from "../../data/library";
23
27
  export { sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, } from "../../utils";
24
28
  export { Sidebar } from "../../components/Sidebar/Sidebar";
29
+ export { Button } from "../../components/Button";
30
+ export { Footer };
31
+ export { MainMenu };
32
+ export { useDevice } from "../../components/App";
33
+ export { WelcomeScreen };
34
+ export { LiveCollaborationTrigger };
@@ -0,0 +1,6 @@
1
+ declare type EasingFunction = (progress: number) => number;
2
+ interface EasingDictionary {
3
+ [easing: string]: EasingFunction;
4
+ }
5
+ declare const easingsFunctions: EasingDictionary;
6
+ export default easingsFunctions;
package/types/types.d.ts CHANGED
@@ -15,6 +15,7 @@ import { MaybeTransformHandleType } from "./element/transformHandles";
15
15
  import Library from "./data/library";
16
16
  import type { FileSystemHandle } from "./data/filesystem";
17
17
  import type { ALLOWED_IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
18
+ import { ContextMenuItems } from "./components/ContextMenu";
18
19
  export declare type Point = Readonly<RoughPoint>;
19
20
  export declare type Collaborator = {
20
21
  pointer?: {
@@ -62,6 +63,11 @@ export declare type LastActiveToolBeforeEraser = {
62
63
  customType: string;
63
64
  } | null;
64
65
  export declare type AppState = {
66
+ contextMenu: {
67
+ items: ContextMenuItems;
68
+ top: number;
69
+ left: number;
70
+ } | null;
65
71
  showWelcomeScreen: boolean;
66
72
  isLoading: boolean;
67
73
  errorMessage: string | null;
@@ -116,7 +122,7 @@ export declare type AppState = {
116
122
  openMenu: "canvas" | "shape" | null;
117
123
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
118
124
  openSidebar: "library" | "customSidebar" | null;
119
- openDialog: "imageExport" | "help" | null;
125
+ openDialog: "imageExport" | "help" | "jsonExport" | null;
120
126
  isSidebarDocked: boolean;
121
127
  lastPointerDownWith: PointerType;
122
128
  selectedElementIds: {
@@ -220,7 +226,6 @@ export interface ExcalidrawProps {
220
226
  onChange?: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
221
227
  initialData?: ExcalidrawInitialDataState | null | Promise<ExcalidrawInitialDataState | null>;
222
228
  excalidrawRef?: ForwardRef<ExcalidrawAPIRefValue>;
223
- onCollabButtonClick?: () => void;
224
229
  isCollaborating?: boolean;
225
230
  onPointerUpdate?: (payload: {
226
231
  pointer: {
@@ -233,7 +238,6 @@ export interface ExcalidrawProps {
233
238
  onPaste?: (data: ClipboardData, event: ClipboardEvent | null) => Promise<boolean> | boolean;
234
239
  onDrop?: (event: React.DragEvent<HTMLDivElement>) => Promise<boolean> | boolean;
235
240
  renderTopRightUI?: (isMobile: boolean, appState: AppState) => JSX.Element | null;
236
- renderFooter?: (isMobile: boolean, appState: AppState) => JSX.Element | null;
237
241
  langCode?: Language["code"];
238
242
  viewModeEnabled?: boolean;
239
243
  zenModeEnabled?: boolean;
@@ -243,10 +247,7 @@ export interface ExcalidrawProps {
243
247
  theme?: Theme;
244
248
  name?: string;
245
249
  renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => JSX.Element;
246
- UIOptions?: {
247
- dockedSidebarBreakpoint?: number;
248
- canvasActions?: CanvasActions;
249
- };
250
+ UIOptions?: Partial<UIOptions>;
250
251
  detectScroll?: boolean;
251
252
  handleKeyboardGlobally?: boolean;
252
253
  onLibraryChange?: (libraryItems: LibraryItems) => void | Promise<any>;
@@ -266,6 +267,7 @@ export interface ExcalidrawProps {
266
267
  * Render function that renders custom <Sidebar /> component.
267
268
  */
268
269
  renderSidebar?: () => JSX.Element | null;
270
+ children?: React.ReactNode;
269
271
  }
270
272
  export declare type SceneData = {
271
273
  elements?: ImportedDataState["elements"];
@@ -283,22 +285,26 @@ export declare type ExportOpts = {
283
285
  onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, canvas: HTMLCanvasElement | null) => void;
284
286
  renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, canvas: HTMLCanvasElement | null) => JSX.Element;
285
287
  };
286
- declare type CanvasActions = {
287
- changeViewBackgroundColor?: boolean;
288
- clearCanvas?: boolean;
289
- export?: false | ExportOpts;
290
- loadScene?: boolean;
291
- saveToActiveFile?: boolean;
292
- toggleTheme?: boolean | null;
293
- saveAsImage?: boolean;
294
- };
288
+ declare type CanvasActions = Partial<{
289
+ changeViewBackgroundColor: boolean;
290
+ clearCanvas: boolean;
291
+ export: false | ExportOpts;
292
+ loadScene: boolean;
293
+ saveToActiveFile: boolean;
294
+ toggleTheme: boolean | null;
295
+ saveAsImage: boolean;
296
+ }>;
297
+ declare type UIOptions = Partial<{
298
+ dockedSidebarBreakpoint: number;
299
+ welcomeScreen: boolean;
300
+ canvasActions: CanvasActions;
301
+ }>;
295
302
  export declare type AppProps = Merge<ExcalidrawProps, {
296
- UIOptions: {
303
+ UIOptions: Merge<MarkRequired<UIOptions, "welcomeScreen">, {
297
304
  canvasActions: Required<CanvasActions> & {
298
305
  export: ExportOpts;
299
306
  };
300
- dockedSidebarBreakpoint?: number;
301
- };
307
+ }>;
302
308
  detectScroll: boolean;
303
309
  handleKeyboardGlobally: boolean;
304
310
  isCollaborating: boolean;
@@ -318,6 +324,7 @@ export declare type AppClassProperties = {
318
324
  files: BinaryFiles;
319
325
  device: App["device"];
320
326
  scene: App["scene"];
327
+ pasteFromClipboard: App["pasteFromClipboard"];
321
328
  };
322
329
  export declare type PointerDownState = Readonly<{
323
330
  origin: Readonly<{
@@ -417,4 +424,19 @@ export declare type Device = Readonly<{
417
424
  isTouchScreen: boolean;
418
425
  canDeviceFitSidebar: boolean;
419
426
  }>;
427
+ export declare type UIChildrenComponents = {
428
+ [k in "FooterCenter" | "Menu" | "WelcomeScreen"]?: React.ReactElement<{
429
+ children?: React.ReactNode;
430
+ }, React.JSXElementConstructor<any>>;
431
+ };
432
+ export declare type UIWelcomeScreenComponents = {
433
+ [k in "Center" | "MenuHint" | "ToolbarHint" | "HelpHint"]?: React.ReactElement<{
434
+ children?: React.ReactNode;
435
+ }, React.JSXElementConstructor<any>>;
436
+ };
437
+ export declare type UIWelcomeScreenCenterComponents = {
438
+ [k in "Logo" | "Heading" | "Menu" | "MenuItemLoadScene" | "MenuItemHelp"]?: React.ReactElement<{
439
+ children?: React.ReactNode;
440
+ }, React.JSXElementConstructor<any>>;
441
+ };
420
442
  export {};
package/types/utils.d.ts CHANGED
@@ -2,6 +2,7 @@ import { EVENT } from "./constants";
2
2
  import { FontFamilyValues, FontString } from "./element/types";
3
3
  import { AppState, LastActiveToolBeforeEraser, Zoom } from "./types";
4
4
  import { SHAPES } from "./shapes";
5
+ import React from "react";
5
6
  export declare const setDateTimeForTests: (dateTime: string) => void;
6
7
  export declare const getDateTime: () => string;
7
8
  export declare const capitalizeString: (str: string) => string;
@@ -134,3 +135,19 @@ export declare const isPrimitive: (val: any) => boolean;
134
135
  export declare const getFrame: () => "top" | "iframe";
135
136
  export declare const isPromiseLike: (value: any) => value is Promise<any>;
136
137
  export declare const queryFocusableElements: (container: HTMLElement | null) => HTMLElement[];
138
+ /**
139
+ * Partitions React children into named components and the rest of children.
140
+ *
141
+ * Returns known children as a dictionary of react children keyed by their
142
+ * displayName, and the rest children as an array.
143
+ *
144
+ * NOTE all named react components are included in the dictionary, irrespective
145
+ * of the supplied type parameter. This means you may be throwing away
146
+ * children that you aren't expecting, but should nonetheless be rendered.
147
+ * To guard against this (provided you care about the rest children at all),
148
+ * supply a second parameter with an object with keys of the expected children.
149
+ */
150
+ export declare const getReactChildren: <KnownChildren extends {
151
+ [x: string]: React.ReactNode;
152
+ }>(children: React.ReactNode, expectedComponents?: Record<keyof KnownChildren, any> | undefined) => readonly [Partial<KnownChildren>, React.ReactNode[]];
153
+ export declare const isShallowEqual: <T extends Record<string, any>>(objA: T, objB: T) => boolean;