@excalidraw/excalidraw 0.13.0-6184422 → 0.13.0-893c487

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excalidraw/excalidraw",
3
- "version": "0.13.0-6184422",
3
+ "version": "0.13.0-893c487",
4
4
  "main": "main.js",
5
5
  "types": "types/packages/excalidraw/index.d.ts",
6
6
  "files": [
@@ -7,16 +7,16 @@ import History from "../history";
7
7
  import Scene from "../scene/Scene";
8
8
  import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device } from "../types";
9
9
  import { FileSystemHandle } from "../data/filesystem";
10
+ export declare const ExcalidrawContainerContext: React.Context<{
11
+ container: HTMLDivElement | null;
12
+ id: string | null;
13
+ }>;
10
14
  export declare const useDevice: () => Readonly<{
11
15
  isSmScreen: boolean;
12
16
  isMobile: boolean;
13
17
  isTouchScreen: boolean;
14
18
  canDeviceFitSidebar: boolean;
15
19
  }>;
16
- export declare const ExcalidrawContainerContext: React.Context<{
17
- container: HTMLDivElement | null;
18
- id: string | null;
19
- }>;
20
20
  export declare const useExcalidrawContainer: () => {
21
21
  container: HTMLDivElement | null;
22
22
  id: string | null;
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import "./Button.scss";
3
+ interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
4
+ type?: "button" | "submit" | "reset";
5
+ onSelect: () => any;
6
+ children: React.ReactNode;
7
+ className?: string;
8
+ }
9
+ /**
10
+ * A generic button component that follows Excalidraw's design system.
11
+ * Style can be customised using `className` or `style` prop.
12
+ * Accepts all props that a regular `button` element accepts.
13
+ */
14
+ export declare const Button: ({ type, onSelect, children, className, ...rest }: ButtonProps) => JSX.Element;
15
+ export {};
@@ -13,7 +13,6 @@ interface LayerUIProps {
13
13
  canvas: HTMLCanvasElement | null;
14
14
  setAppState: React.Component<any, AppState>["setState"];
15
15
  elements: readonly NonDeletedExcalidrawElement[];
16
- onCollabButtonClick?: () => void;
17
16
  onLockToggle: () => void;
18
17
  onPenModeToggle: () => void;
19
18
  onInsertElements: (elements: readonly NonDeletedExcalidrawElement[]) => void;
@@ -34,5 +33,5 @@ interface LayerUIProps {
34
33
  renderWelcomeScreen: boolean;
35
34
  children?: React.ReactNode;
36
35
  }
37
- declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onCollabButtonClick, onLockToggle, onPenModeToggle, onInsertElements, showExitZenModeBtn, isCollaborating, renderTopRightUI, renderCustomStats, renderCustomSidebar, libraryReturnUrl, UIOptions, focusContainer, library, id, onImageAction, renderWelcomeScreen, children, }: LayerUIProps) => JSX.Element>;
36
+ declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onPenModeToggle, onInsertElements, showExitZenModeBtn, isCollaborating, renderTopRightUI, renderCustomStats, renderCustomSidebar, libraryReturnUrl, UIOptions, focusContainer, library, id, onImageAction, renderWelcomeScreen, children, }: LayerUIProps) => JSX.Element>;
38
37
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { AppState, Device, ExcalidrawProps } from "../types";
2
+ import { AppState, Device, ExcalidrawProps, UIWelcomeScreenComponents } from "../types";
3
3
  import { ActionManager } from "../actions/manager";
4
4
  import { NonDeletedExcalidrawElement } from "../element/types";
5
5
  declare type MobileMenuProps = {
@@ -9,11 +9,9 @@ declare type MobileMenuProps = {
9
9
  renderImageExportDialog: () => React.ReactNode;
10
10
  setAppState: React.Component<any, AppState>["setState"];
11
11
  elements: readonly NonDeletedExcalidrawElement[];
12
- onCollabButtonClick?: () => void;
13
12
  onLockToggle: () => void;
14
13
  onPenModeToggle: () => void;
15
14
  canvas: HTMLCanvasElement | null;
16
- isCollaborating: boolean;
17
15
  onImageAction: (data: {
18
16
  insertOnCanvasDirectly: boolean;
19
17
  }) => void;
@@ -21,8 +19,8 @@ declare type MobileMenuProps = {
21
19
  renderCustomStats?: ExcalidrawProps["renderCustomStats"];
22
20
  renderSidebars: () => JSX.Element | null;
23
21
  device: Device;
24
- renderWelcomeScreen?: boolean;
25
22
  renderMenu: () => React.ReactNode;
23
+ welcomeScreenCenter: UIWelcomeScreenComponents["Center"];
26
24
  };
27
- export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onPenModeToggle, canvas, isCollaborating, onImageAction, renderTopRightUI, renderCustomStats, renderSidebars, device, renderWelcomeScreen, renderMenu, }: MobileMenuProps) => JSX.Element;
25
+ export declare const MobileMenu: ({ appState, elements, actionManager, setAppState, onLockToggle, onPenModeToggle, canvas, onImageAction, renderTopRightUI, renderCustomStats, renderSidebars, device, renderMenu, welcomeScreenCenter, }: MobileMenuProps) => JSX.Element;
28
26
  export {};
@@ -23,37 +23,29 @@ declare const DropdownMenu: {
23
23
  displayName: string;
24
24
  };
25
25
  Item: {
26
- ({ icon, onSelect, children, dataTestId, shortcut, className, style, ariaLabel, }: {
26
+ ({ icon, onSelect, children, shortcut, className, ...rest }: {
27
27
  icon?: JSX.Element | undefined;
28
28
  onSelect: () => void;
29
29
  children: React.ReactNode;
30
- dataTestId?: string | undefined;
31
30
  shortcut?: string | undefined;
32
31
  className?: string | undefined;
33
- style?: React.CSSProperties | undefined;
34
- ariaLabel?: string | undefined;
35
- }): JSX.Element;
32
+ } & React.ButtonHTMLAttributes<HTMLButtonElement>): JSX.Element;
36
33
  displayName: string;
37
34
  };
38
35
  ItemLink: {
39
- ({ icon, dataTestId, shortcut, href, children, className, style, ariaLabel, }: {
36
+ ({ icon, shortcut, href, children, className, ...rest }: {
40
37
  icon?: JSX.Element | undefined;
41
38
  children: React.ReactNode;
42
- dataTestId?: string | undefined;
43
39
  shortcut?: string | undefined;
44
40
  className?: string | undefined;
45
41
  href: string;
46
- style?: React.CSSProperties | undefined;
47
- ariaLabel?: string | undefined;
48
- }): JSX.Element;
42
+ } & React.AnchorHTMLAttributes<HTMLAnchorElement>): JSX.Element;
49
43
  displayName: string;
50
44
  };
51
- ItemCustom: ({ children, className, style, dataTestId, }: {
45
+ ItemCustom: ({ children, className, ...rest }: {
52
46
  children: React.ReactNode;
53
47
  className?: string | undefined;
54
- style?: React.CSSProperties | undefined;
55
- dataTestId?: string | undefined;
56
- }) => JSX.Element;
48
+ } & React.HTMLAttributes<HTMLDivElement>) => JSX.Element;
57
49
  Group: {
58
50
  ({ children, className, style, title, }: {
59
51
  children: React.ReactNode;
@@ -1,16 +1,13 @@
1
1
  import React from "react";
2
2
  export declare const getDrodownMenuItemClassName: (className?: string) => string;
3
3
  declare const DropdownMenuItem: {
4
- ({ icon, onSelect, children, dataTestId, shortcut, className, style, ariaLabel, }: {
4
+ ({ icon, onSelect, children, shortcut, className, ...rest }: {
5
5
  icon?: JSX.Element | undefined;
6
6
  onSelect: () => void;
7
7
  children: React.ReactNode;
8
- dataTestId?: string | undefined;
9
8
  shortcut?: string | undefined;
10
9
  className?: string | undefined;
11
- style?: React.CSSProperties | undefined;
12
- ariaLabel?: string | undefined;
13
- }): JSX.Element;
10
+ } & React.ButtonHTMLAttributes<HTMLButtonElement>): JSX.Element;
14
11
  displayName: string;
15
12
  };
16
13
  export default DropdownMenuItem;
@@ -1,8 +1,6 @@
1
- /// <reference types="react" />
2
- declare const DropdownMenuItemCustom: ({ children, className, style, dataTestId, }: {
1
+ import React from "react";
2
+ declare const DropdownMenuItemCustom: ({ children, className, ...rest }: {
3
3
  children: React.ReactNode;
4
4
  className?: string | undefined;
5
- style?: import("react").CSSProperties | undefined;
6
- dataTestId?: string | undefined;
7
- }) => JSX.Element;
5
+ } & React.HTMLAttributes<HTMLDivElement>) => JSX.Element;
8
6
  export default DropdownMenuItemCustom;
@@ -1,15 +1,12 @@
1
1
  import React from "react";
2
2
  declare const DropdownMenuItemLink: {
3
- ({ icon, dataTestId, shortcut, href, children, className, style, ariaLabel, }: {
3
+ ({ icon, shortcut, href, children, className, ...rest }: {
4
4
  icon?: JSX.Element | undefined;
5
5
  children: React.ReactNode;
6
- dataTestId?: string | undefined;
7
6
  shortcut?: string | undefined;
8
7
  className?: string | undefined;
9
8
  href: string;
10
- style?: React.CSSProperties | undefined;
11
- ariaLabel?: string | undefined;
12
- }): JSX.Element;
9
+ } & React.AnchorHTMLAttributes<HTMLAnchorElement>): JSX.Element;
13
10
  displayName: string;
14
11
  };
15
12
  export default DropdownMenuItemLink;
@@ -1,12 +1,12 @@
1
1
  import { ActionManager } from "../../actions/manager";
2
- import { AppState, UIChildrenComponents } from "../../types";
2
+ import { AppState, UIChildrenComponents, UIWelcomeScreenComponents } from "../../types";
3
3
  declare const Footer: {
4
- ({ appState, actionManager, showExitZenModeBtn, renderWelcomeScreen, footerCenter, }: {
4
+ ({ appState, actionManager, showExitZenModeBtn, footerCenter, welcomeScreenHelp, }: {
5
5
  appState: AppState;
6
6
  actionManager: ActionManager;
7
7
  showExitZenModeBtn: boolean;
8
- renderWelcomeScreen: boolean;
9
8
  footerCenter: UIChildrenComponents["FooterCenter"];
9
+ welcomeScreenHelp: UIWelcomeScreenComponents["HelpHint"];
10
10
  }): JSX.Element;
11
11
  displayName: string;
12
12
  };
@@ -73,7 +73,7 @@ export declare const DistributeHorizontallyIcon: JSX.Element;
73
73
  export declare const DistributeVerticallyIcon: JSX.Element;
74
74
  export declare const CenterVerticallyIcon: JSX.Element;
75
75
  export declare const CenterHorizontallyIcon: JSX.Element;
76
- export declare const UsersIcon: JSX.Element;
76
+ export declare const usersIcon: JSX.Element;
77
77
  export declare const start: JSX.Element;
78
78
  export declare const stop: JSX.Element;
79
79
  export declare const CloseIcon: JSX.Element;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import "./LiveCollaborationTrigger.scss";
3
+ declare const LiveCollaborationTrigger: {
4
+ ({ isCollaborating, onSelect, ...rest }: {
5
+ isCollaborating: boolean;
6
+ onSelect: () => void;
7
+ } & import("react").ButtonHTMLAttributes<HTMLButtonElement>): JSX.Element;
8
+ displayName: string;
9
+ };
10
+ export default LiveCollaborationTrigger;
@@ -35,7 +35,7 @@ export declare const Socials: {
35
35
  (): JSX.Element;
36
36
  displayName: string;
37
37
  };
38
- export declare const LiveCollaboration: {
38
+ export declare const LiveCollaborationTrigger: {
39
39
  ({ onSelect, isCollaborating, }: {
40
40
  onSelect: () => void;
41
41
  isCollaborating: boolean;
@@ -13,37 +13,29 @@ declare const MainMenu: {
13
13
  displayName: string;
14
14
  };
15
15
  Item: {
16
- ({ icon, onSelect, children, dataTestId, shortcut, className, style, ariaLabel, }: {
16
+ ({ icon, onSelect, children, shortcut, className, ...rest }: {
17
17
  icon?: JSX.Element | undefined;
18
18
  onSelect: () => void;
19
19
  children: React.ReactNode;
20
- dataTestId?: string | undefined;
21
20
  shortcut?: string | undefined;
22
21
  className?: string | undefined;
23
- style?: React.CSSProperties | undefined;
24
- ariaLabel?: string | undefined;
25
- }): JSX.Element;
22
+ } & React.ButtonHTMLAttributes<HTMLButtonElement>): JSX.Element;
26
23
  displayName: string;
27
24
  };
28
25
  ItemLink: {
29
- ({ icon, dataTestId, shortcut, href, children, className, style, ariaLabel, }: {
26
+ ({ icon, shortcut, href, children, className, ...rest }: {
30
27
  icon?: JSX.Element | undefined;
31
28
  children: React.ReactNode;
32
- dataTestId?: string | undefined;
33
29
  shortcut?: string | undefined;
34
30
  className?: string | undefined;
35
31
  href: string;
36
- style?: React.CSSProperties | undefined;
37
- ariaLabel?: string | undefined;
38
- }): JSX.Element;
32
+ } & React.AnchorHTMLAttributes<HTMLAnchorElement>): JSX.Element;
39
33
  displayName: string;
40
34
  };
41
- ItemCustom: ({ children, className, style, dataTestId, }: {
35
+ ItemCustom: ({ children, className, ...rest }: {
42
36
  children: React.ReactNode;
43
37
  className?: string | undefined;
44
- style?: React.CSSProperties | undefined;
45
- dataTestId?: string | undefined;
46
- }) => JSX.Element;
38
+ } & React.HTMLAttributes<HTMLDivElement>) => JSX.Element;
47
39
  Group: {
48
40
  ({ children, className, style, title, }: {
49
41
  children: React.ReactNode;
@@ -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;
@@ -151,10 +151,6 @@ export declare const ROUNDNESS: {
151
151
  readonly PROPORTIONAL_RADIUS: 2;
152
152
  readonly ADAPTIVE_RADIUS: 3;
153
153
  };
154
- export declare const COOKIES: {
155
- readonly AUTH_STATE_COOKIE: "excplus-auth";
156
- };
157
154
  /** key containt id of precedeing elemnt id we use in reconciliation during
158
155
  * collaboration */
159
156
  export declare const PRECEDING_ELEMENT_KEY = "__precedingElement__";
160
- export declare const isExcalidrawPlusSignedUser: boolean;
@@ -3,7 +3,9 @@ import "../../css/app.scss";
3
3
  import "../../css/styles.scss";
4
4
  import { ExcalidrawAPIRefValue, ExcalidrawProps } from "../../types";
5
5
  import Footer from "../../components/footer/FooterCenter";
6
- import MainMenu from "../../components/mainMenu/MainMenu";
6
+ import MainMenu from "../../components/main-menu/MainMenu";
7
+ import WelcomeScreen from "../../components/welcome-screen/WelcomeScreen";
8
+ import LiveCollaborationTrigger from "../../components/live-collaboration/LiveCollaborationTrigger";
7
9
  declare type PublicExcalidrawProps = Omit<ExcalidrawProps, "forwardedRef">;
8
10
  export declare const Excalidraw: React.MemoExoticComponent<React.ForwardRefExoticComponent<PublicExcalidrawProps & React.RefAttributes<ExcalidrawAPIRefValue>>>;
9
11
  export { getSceneVersion, isInvisiblySmallElement, getNonDeletedElements, } from "../../element";
@@ -16,6 +18,9 @@ export { mutateElement, newElementWith, bumpVersion, } from "../../element/mutat
16
18
  export { parseLibraryTokensFromUrl, useHandleLibrary, } from "../../data/library";
17
19
  export { sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, } from "../../utils";
18
20
  export { Sidebar } from "../../components/Sidebar/Sidebar";
21
+ export { Button } from "../../components/Button";
19
22
  export { Footer };
20
23
  export { MainMenu };
21
24
  export { useDevice } from "../../components/App";
25
+ export { WelcomeScreen };
26
+ export { LiveCollaborationTrigger };
package/types/types.d.ts CHANGED
@@ -219,7 +219,6 @@ export interface ExcalidrawProps {
219
219
  onChange?: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
220
220
  initialData?: ExcalidrawInitialDataState | null | Promise<ExcalidrawInitialDataState | null>;
221
221
  excalidrawRef?: ForwardRef<ExcalidrawAPIRefValue>;
222
- onCollabButtonClick?: () => void;
223
222
  isCollaborating?: boolean;
224
223
  onPointerUpdate?: (payload: {
225
224
  pointer: {
@@ -239,10 +238,7 @@ export interface ExcalidrawProps {
239
238
  theme?: Theme;
240
239
  name?: string;
241
240
  renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => JSX.Element;
242
- UIOptions?: {
243
- dockedSidebarBreakpoint?: number;
244
- canvasActions?: CanvasActions;
245
- };
241
+ UIOptions?: Partial<UIOptions>;
246
242
  detectScroll?: boolean;
247
243
  handleKeyboardGlobally?: boolean;
248
244
  onLibraryChange?: (libraryItems: LibraryItems) => void | Promise<any>;
@@ -275,22 +271,26 @@ export declare type ExportOpts = {
275
271
  onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, canvas: HTMLCanvasElement | null) => void;
276
272
  renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, canvas: HTMLCanvasElement | null) => JSX.Element;
277
273
  };
278
- declare type CanvasActions = {
279
- changeViewBackgroundColor?: boolean;
280
- clearCanvas?: boolean;
281
- export?: false | ExportOpts;
282
- loadScene?: boolean;
283
- saveToActiveFile?: boolean;
284
- toggleTheme?: boolean | null;
285
- saveAsImage?: boolean;
286
- };
274
+ declare type CanvasActions = Partial<{
275
+ changeViewBackgroundColor: boolean;
276
+ clearCanvas: boolean;
277
+ export: false | ExportOpts;
278
+ loadScene: boolean;
279
+ saveToActiveFile: boolean;
280
+ toggleTheme: boolean | null;
281
+ saveAsImage: boolean;
282
+ }>;
283
+ declare type UIOptions = Partial<{
284
+ dockedSidebarBreakpoint: number;
285
+ welcomeScreen: boolean;
286
+ canvasActions: CanvasActions;
287
+ }>;
287
288
  export declare type AppProps = Merge<ExcalidrawProps, {
288
- UIOptions: {
289
+ UIOptions: Merge<MarkRequired<UIOptions, "welcomeScreen">, {
289
290
  canvasActions: Required<CanvasActions> & {
290
291
  export: ExportOpts;
291
292
  };
292
- dockedSidebarBreakpoint?: number;
293
- };
293
+ }>;
294
294
  detectScroll: boolean;
295
295
  handleKeyboardGlobally: boolean;
296
296
  isCollaborating: boolean;
@@ -401,6 +401,18 @@ export declare type Device = Readonly<{
401
401
  canDeviceFitSidebar: boolean;
402
402
  }>;
403
403
  export declare type UIChildrenComponents = {
404
- [k in "FooterCenter" | "Menu"]?: React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
404
+ [k in "FooterCenter" | "Menu" | "WelcomeScreen"]?: React.ReactElement<{
405
+ children?: React.ReactNode;
406
+ }, React.JSXElementConstructor<any>>;
407
+ };
408
+ export declare type UIWelcomeScreenComponents = {
409
+ [k in "Center" | "MenuHint" | "ToolbarHint" | "HelpHint"]?: React.ReactElement<{
410
+ children?: React.ReactNode;
411
+ }, React.JSXElementConstructor<any>>;
412
+ };
413
+ export declare type UIWelcomeScreenCenterComponents = {
414
+ [k in "Logo" | "Heading" | "Menu" | "MenuItemLoadScene" | "MenuItemHelp"]?: React.ReactElement<{
415
+ children?: React.ReactNode;
416
+ }, React.JSXElementConstructor<any>>;
405
417
  };
406
418
  export {};
package/types/utils.d.ts CHANGED
@@ -135,7 +135,19 @@ export declare const isPrimitive: (val: any) => boolean;
135
135
  export declare const getFrame: () => "top" | "iframe";
136
136
  export declare const isPromiseLike: (value: any) => value is Promise<any>;
137
137
  export declare const queryFocusableElements: (container: HTMLElement | null) => HTMLElement[];
138
- export declare const ReactChildrenToObject: <T extends {
139
- [x: string]: React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | undefined;
140
- }>(children: React.ReactNode) => Partial<T>;
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[]];
141
153
  export declare const isShallowEqual: <T extends Record<string, any>>(objA: T, objB: T) => boolean;
@@ -1,7 +0,0 @@
1
- import "./CollabButton.scss";
2
- declare const CollabButton: ({ isCollaborating, collaboratorCount, onClick, }: {
3
- isCollaborating: boolean;
4
- collaboratorCount: number;
5
- onClick: () => void;
6
- }) => JSX.Element;
7
- export default CollabButton;
@@ -1,8 +0,0 @@
1
- import { ActionManager } from "../actions/manager";
2
- import { AppState } from "../types";
3
- import "./WelcomeScreen.scss";
4
- declare const WelcomeScreen: ({ appState, actionManager, }: {
5
- appState: AppState;
6
- actionManager: ActionManager;
7
- }) => JSX.Element;
8
- export default WelcomeScreen;
@@ -1,6 +0,0 @@
1
- import { ReactNode } from "react";
2
- declare const WelcomeScreenDecor: ({ children, shouldRender, }: {
3
- children: ReactNode;
4
- shouldRender: boolean;
5
- }) => JSX.Element | null;
6
- export default WelcomeScreenDecor;