@zsviczian/excalidraw 0.14.2-obsidian-5 → 0.15.2-obsidian-2

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 (70) hide show
  1. package/README.md +2 -2
  2. package/dist/excalidraw.development.js +469 -226
  3. package/dist/excalidraw.production.min.js +1 -1
  4. package/package.json +1 -1
  5. package/types/actions/actionAddToLibrary.d.ts +18 -6
  6. package/types/actions/actionBoundText.d.ts +14 -6
  7. package/types/actions/actionCanvas.d.ts +60 -20
  8. package/types/actions/actionClipboard.d.ts +30 -10
  9. package/types/actions/actionDeleteSelected.d.ts +18 -6
  10. package/types/actions/actionExport.d.ts +54 -18
  11. package/types/actions/actionFinalize.d.ts +12 -4
  12. package/types/actions/actionLinearEditor.d.ts +6 -2
  13. package/types/actions/actionMenu.d.ts +20 -8
  14. package/types/actions/actionProperties.d.ts +78 -26
  15. package/types/actions/actionStyles.d.ts +6 -2
  16. package/types/actions/actionToggleGridMode.d.ts +6 -2
  17. package/types/actions/actionToggleLock.d.ts +6 -2
  18. package/types/actions/actionToggleStats.d.ts +6 -2
  19. package/types/actions/actionToggleViewMode.d.ts +6 -2
  20. package/types/actions/actionToggleZenMode.d.ts +6 -2
  21. package/types/actions/types.d.ts +1 -1
  22. package/types/appState.d.ts +5 -2
  23. package/types/clipboard.d.ts +2 -2
  24. package/types/components/Actions.d.ts +5 -5
  25. package/types/components/App.d.ts +10 -3
  26. package/types/components/Button.d.ts +3 -1
  27. package/types/components/DefaultSidebar.d.ts +30 -0
  28. package/types/components/HintViewer.d.ts +2 -2
  29. package/types/components/ImageExportDialog.d.ts +4 -4
  30. package/types/components/JSONExportDialog.d.ts +3 -3
  31. package/types/components/LayerUI.d.ts +3 -10
  32. package/types/components/LibraryMenu.d.ts +32 -13
  33. package/types/components/LibraryMenuBrowseButton.d.ts +2 -2
  34. package/types/components/LibraryMenuControlButtons.d.ts +9 -0
  35. package/types/components/LibraryMenuHeaderContent.d.ts +9 -28
  36. package/types/components/LibraryMenuItems.d.ts +2 -2
  37. package/types/components/MobileMenu.d.ts +3 -3
  38. package/types/components/PasteChartDialog.d.ts +4 -5
  39. package/types/components/PublishLibrary.d.ts +2 -2
  40. package/types/components/Sidebar/Sidebar.d.ts +68 -45
  41. package/types/components/Sidebar/SidebarHeader.d.ts +6 -19
  42. package/types/components/Sidebar/SidebarTab.d.ts +9 -0
  43. package/types/components/Sidebar/SidebarTabTrigger.d.ts +10 -0
  44. package/types/components/Sidebar/SidebarTabTriggers.d.ts +7 -0
  45. package/types/components/Sidebar/SidebarTabs.d.ts +7 -0
  46. package/types/components/Sidebar/SidebarTrigger.d.ts +6 -0
  47. package/types/components/Sidebar/common.d.ts +23 -6
  48. package/types/components/Stats.d.ts +3 -3
  49. package/types/components/Trans.d.ts +8 -0
  50. package/types/components/footer/Footer.d.ts +2 -2
  51. package/types/constants.d.ts +34 -7
  52. package/types/context/tunnels.d.ts +18 -0
  53. package/types/context/ui-appState.d.ts +4 -0
  54. package/types/data/blob.d.ts +2 -2
  55. package/types/data/filesystem.d.ts +2 -1
  56. package/types/data/types.d.ts +2 -4
  57. package/types/element/Hyperlink.d.ts +8 -4
  58. package/types/element/image.d.ts +11 -1
  59. package/types/element/linearElementEditor.d.ts +7 -6
  60. package/types/element/newElement.d.ts +31 -7
  61. package/types/element/showSelectedShapeActions.d.ts +2 -2
  62. package/types/element/textElement.d.ts +3 -2
  63. package/types/hooks/useOutsideClick.d.ts +1 -1
  64. package/types/packages/excalidraw/index.d.ts +2 -1
  65. package/types/packages/utils.d.ts +1 -1
  66. package/types/renderer/renderElement.d.ts +1 -0
  67. package/types/scene/export.d.ts +4 -1
  68. package/types/scene/selection.d.ts +4 -4
  69. package/types/types.d.ts +28 -16
  70. package/types/utils.d.ts +2 -2
@@ -69,9 +69,12 @@ export declare const actionToggleGridMode: {
69
69
  }>;
70
70
  openMenu: "canvas" | "shape" | null;
71
71
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
72
- openSidebar: "library" | "customSidebar" | null;
72
+ openSidebar: {
73
+ name: string;
74
+ tab?: string | undefined;
75
+ } | null;
73
76
  openDialog: "imageExport" | "help" | "jsonExport" | null;
74
- isSidebarDocked: boolean;
77
+ defaultSidebarDockedPreference: boolean;
75
78
  lastPointerDownWith: import("../element/types").PointerType;
76
79
  selectedElementIds: {
77
80
  [id: string]: boolean;
@@ -125,6 +128,7 @@ export declare const actionToggleGridMode: {
125
128
  resetCustomPen?: any;
126
129
  gridColor: string;
127
130
  dynamicStyle: string;
131
+ invertBindingBehaviour: boolean;
128
132
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
129
133
  };
130
134
  commitToHistory: false;
@@ -68,9 +68,12 @@ export declare const actionToggleLock: {
68
68
  }>;
69
69
  openMenu: "canvas" | "shape" | null;
70
70
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
71
- openSidebar: "library" | "customSidebar" | null;
71
+ openSidebar: {
72
+ name: string;
73
+ tab?: string | undefined;
74
+ } | null;
72
75
  openDialog: "imageExport" | "help" | "jsonExport" | null;
73
- isSidebarDocked: boolean;
76
+ defaultSidebarDockedPreference: boolean;
74
77
  lastPointerDownWith: import("../element/types").PointerType;
75
78
  selectedElementIds: {
76
79
  [id: string]: boolean;
@@ -125,6 +128,7 @@ export declare const actionToggleLock: {
125
128
  resetCustomPen?: any;
126
129
  gridColor: string;
127
130
  dynamicStyle: string;
131
+ invertBindingBehaviour: boolean;
128
132
  };
129
133
  commitToHistory: true;
130
134
  };
@@ -67,9 +67,12 @@ export declare const actionToggleStats: {
67
67
  }>;
68
68
  openMenu: "canvas" | "shape" | null;
69
69
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
70
- openSidebar: "library" | "customSidebar" | null;
70
+ openSidebar: {
71
+ name: string;
72
+ tab?: string | undefined;
73
+ } | null;
71
74
  openDialog: "imageExport" | "help" | "jsonExport" | null;
72
- isSidebarDocked: boolean;
75
+ defaultSidebarDockedPreference: boolean;
73
76
  lastPointerDownWith: import("../element/types").PointerType;
74
77
  selectedElementIds: {
75
78
  [id: string]: boolean;
@@ -123,6 +126,7 @@ export declare const actionToggleStats: {
123
126
  resetCustomPen?: any;
124
127
  gridColor: string;
125
128
  dynamicStyle: string;
129
+ invertBindingBehaviour: boolean;
126
130
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
127
131
  };
128
132
  commitToHistory: false;
@@ -68,9 +68,12 @@ export declare const actionToggleViewMode: {
68
68
  }>;
69
69
  openMenu: "canvas" | "shape" | null;
70
70
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
71
- openSidebar: "library" | "customSidebar" | null;
71
+ openSidebar: {
72
+ name: string;
73
+ tab?: string | undefined;
74
+ } | null;
72
75
  openDialog: "imageExport" | "help" | "jsonExport" | null;
73
- isSidebarDocked: boolean;
76
+ defaultSidebarDockedPreference: boolean;
74
77
  lastPointerDownWith: import("../element/types").PointerType;
75
78
  selectedElementIds: {
76
79
  [id: string]: boolean;
@@ -124,6 +127,7 @@ export declare const actionToggleViewMode: {
124
127
  resetCustomPen?: any;
125
128
  gridColor: string;
126
129
  dynamicStyle: string;
130
+ invertBindingBehaviour: boolean;
127
131
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
128
132
  };
129
133
  commitToHistory: false;
@@ -68,9 +68,12 @@ export declare const actionToggleZenMode: {
68
68
  }>;
69
69
  openMenu: "canvas" | "shape" | null;
70
70
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
71
- openSidebar: "library" | "customSidebar" | null;
71
+ openSidebar: {
72
+ name: string;
73
+ tab?: string | undefined;
74
+ } | null;
72
75
  openDialog: "imageExport" | "help" | "jsonExport" | null;
73
- isSidebarDocked: boolean;
76
+ defaultSidebarDockedPreference: boolean;
74
77
  lastPointerDownWith: import("../element/types").PointerType;
75
78
  selectedElementIds: {
76
79
  [id: string]: boolean;
@@ -124,6 +127,7 @@ export declare const actionToggleZenMode: {
124
127
  resetCustomPen?: any;
125
128
  gridColor: string;
126
129
  dynamicStyle: string;
130
+ invertBindingBehaviour: boolean;
127
131
  selectedLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
128
132
  };
129
133
  commitToHistory: false;
@@ -15,7 +15,7 @@ export declare type ActionResult = {
15
15
  declare type ActionFn = (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
16
16
  export declare type UpdaterFn = (res: ActionResult) => void;
17
17
  export declare type ActionFilterFn = (action: Action) => void;
18
- export declare type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "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" | "zoomToSelection" | "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" | "toggleLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "createContainerFromText";
18
+ export declare type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "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" | "zoomToSelection" | "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" | "toggleLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "wrapTextInContainer";
19
19
  export declare type PanelComponentProps = {
20
20
  elements: readonly ExcalidrawElement[];
21
21
  appState: AppState;
@@ -42,8 +42,11 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
42
42
  value: NormalizedZoomValue;
43
43
  }> | undefined;
44
44
  openMenu?: "canvas" | "shape" | null | undefined;
45
- openSidebar?: "library" | "customSidebar" | null | undefined;
46
- isSidebarDocked?: boolean | undefined;
45
+ openSidebar?: {
46
+ name: string;
47
+ tab?: string | undefined;
48
+ } | null | undefined;
49
+ defaultSidebarDockedPreference?: boolean | undefined;
47
50
  lastPointerDownWith?: import("./element/types").PointerType | undefined;
48
51
  selectedElementIds?: {
49
52
  [id: string]: boolean;
@@ -1,5 +1,5 @@
1
1
  import { ExcalidrawElement, NonDeletedExcalidrawElement } from "./element/types";
2
- import { AppState, BinaryFiles } from "./types";
2
+ import { BinaryFiles } from "./types";
3
3
  import { Spreadsheet } from "./charts";
4
4
  export interface ClipboardData {
5
5
  spreadsheet?: Spreadsheet;
@@ -11,7 +11,7 @@ export interface ClipboardData {
11
11
  export declare const probablySupportsClipboardReadText: boolean;
12
12
  export declare const probablySupportsClipboardWriteText: boolean;
13
13
  export declare const probablySupportsClipboardBlob: boolean;
14
- export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles | null) => Promise<void>;
14
+ export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], files: BinaryFiles | null) => Promise<string | undefined>;
15
15
  /**
16
16
  * Retrieves content from system clipboard (either from ClipboardEvent or
17
17
  * via async clipboard API if supported)
@@ -1,21 +1,21 @@
1
1
  import React from "react";
2
2
  import { ActionManager } from "../actions/manager";
3
3
  import { ExcalidrawElement, PointerType } from "../element/types";
4
- import { AppState, Zoom } from "../types";
4
+ import { UIAppState, Zoom } from "../types";
5
5
  import "./Actions.scss";
6
6
  export declare const SelectedShapeActions: ({ appState, elements, renderAction, }: {
7
- appState: AppState;
7
+ appState: UIAppState;
8
8
  elements: readonly ExcalidrawElement[];
9
9
  renderAction: ActionManager["renderAction"];
10
10
  }) => JSX.Element;
11
11
  export declare const ShapesSwitcher: ({ canvas, activeTool, setAppState, onImageAction, appState, }: {
12
12
  canvas: HTMLCanvasElement | null;
13
- activeTool: AppState["activeTool"];
14
- setAppState: React.Component<any, AppState>["setState"];
13
+ activeTool: UIAppState["activeTool"];
14
+ setAppState: React.Component<any, UIAppState>["setState"];
15
15
  onImageAction: (data: {
16
16
  pointerType: PointerType | null;
17
17
  }) => void;
18
- appState: AppState;
18
+ appState: UIAppState;
19
19
  }) => JSX.Element;
20
20
  export declare const ZoomActions: ({ renderAction, zoom, trayMode, }: {
21
21
  renderAction: ActionManager["renderAction"];
@@ -6,7 +6,7 @@ import { LinearElementEditor } from "../element/linearElementEditor";
6
6
  import { ExcalidrawElement, ExcalidrawLinearElement, NonDeletedExcalidrawElement } from "../element/types";
7
7
  import History from "../history";
8
8
  import Scene from "../scene/Scene";
9
- import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device } from "../types";
9
+ import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, SidebarName, SidebarTabName } from "../types";
10
10
  import { FileSystemHandle } from "../data/filesystem";
11
11
  import { ImportedDataState } from "../data/types";
12
12
  export declare let showFourthFont: boolean;
@@ -14,6 +14,8 @@ export declare const ExcalidrawContainerContext: React.Context<{
14
14
  container: HTMLDivElement | null;
15
15
  id: string | null;
16
16
  }>;
17
+ export declare const useApp: () => AppClassProperties;
18
+ export declare const useAppProps: () => AppProps;
17
19
  export declare const useDevice: () => Readonly<{
18
20
  isSmScreen: boolean;
19
21
  isMobile: boolean;
@@ -43,7 +45,7 @@ declare class App extends React.Component<AppProps, AppState> {
43
45
  private nearestScrollableContainer;
44
46
  library: AppClassProperties["library"];
45
47
  libraryItemsFromStorage: LibraryItems | undefined;
46
- private id;
48
+ id: string;
47
49
  private history;
48
50
  private excalidrawContainerValue;
49
51
  files: BinaryFiles;
@@ -62,6 +64,7 @@ declare class App extends React.Component<AppProps, AppState> {
62
64
  focusContainer: AppClassProperties["focusContainer"];
63
65
  getSceneElementsIncludingDeleted: () => readonly ExcalidrawElement[];
64
66
  getSceneElements: () => readonly NonDeletedExcalidrawElement[];
67
+ onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
65
68
  private syncActionResult;
66
69
  private onBlur;
67
70
  private onUnload;
@@ -138,7 +141,11 @@ declare class App extends React.Component<AppProps, AppState> {
138
141
  /**
139
142
  * @returns whether the menu was toggled on or off
140
143
  */
141
- toggleMenu: (type: "library" | "customSidebar", force?: boolean) => boolean;
144
+ toggleSidebar: ({ name, tab, force, }: {
145
+ name: SidebarName;
146
+ tab?: string | undefined;
147
+ force?: boolean | undefined;
148
+ }) => boolean;
142
149
  private updateCurrentCursorPosition;
143
150
  private onKeyDown;
144
151
  private onWheel;
@@ -3,6 +3,8 @@ import "./Button.scss";
3
3
  interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
4
4
  type?: "button" | "submit" | "reset";
5
5
  onSelect: () => any;
6
+ /** whether button is in active state */
7
+ selected?: boolean;
6
8
  children: React.ReactNode;
7
9
  className?: string;
8
10
  }
@@ -11,5 +13,5 @@ interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
11
13
  * Style can be customised using `className` or `style` prop.
12
14
  * Accepts all props that a regular `button` element accepts.
13
15
  */
14
- export declare const Button: ({ type, onSelect, children, className, ...rest }: ButtonProps) => JSX.Element;
16
+ export declare const Button: ({ type, onSelect, selected, children, className, ...rest }: ButtonProps) => JSX.Element;
15
17
  export {};
@@ -0,0 +1,30 @@
1
+ /// <reference types="react" />
2
+ import { MarkOptional } from "../utility-types";
3
+ import { SidebarProps, SidebarTriggerProps } from "./Sidebar/common";
4
+ export declare const DefaultSidebar: import("react").FC<Omit<MarkOptional<Omit<{
5
+ name: string;
6
+ children: import("react").ReactNode;
7
+ onStateChange?: ((state: {
8
+ name: string;
9
+ tab?: string | undefined;
10
+ } | null) => void) | undefined;
11
+ onDock?: ((docked: boolean) => void) | undefined;
12
+ docked?: boolean | undefined;
13
+ className?: string | undefined;
14
+ __fallback?: boolean | undefined;
15
+ }, "name">, "children">, "onDock"> & {
16
+ /** pass `false` to disable docking */
17
+ onDock?: SidebarProps["onDock"] | false;
18
+ } & {
19
+ __fallback?: boolean | undefined;
20
+ }> & {
21
+ Trigger: import("react").FC<Omit<SidebarTriggerProps, "name"> & import("react").HTMLAttributes<HTMLDivElement> & {
22
+ __fallback?: boolean | undefined;
23
+ }>;
24
+ TabTriggers: {
25
+ ({ children, ...rest }: {
26
+ children: React.ReactNode;
27
+ } & import("react").HTMLAttributes<HTMLDivElement>): JSX.Element;
28
+ displayName: string;
29
+ };
30
+ };
@@ -1,8 +1,8 @@
1
1
  import { NonDeletedExcalidrawElement } from "../element/types";
2
+ import { Device, UIAppState } from "../types";
2
3
  import "./HintViewer.scss";
3
- import { AppState, Device } from "../types";
4
4
  interface HintViewerProps {
5
- appState: AppState;
5
+ appState: UIAppState;
6
6
  elements: readonly NonDeletedExcalidrawElement[];
7
7
  isMobile: boolean;
8
8
  device: Device;
@@ -1,13 +1,13 @@
1
1
  import React from "react";
2
2
  import { NonDeletedExcalidrawElement } from "../element/types";
3
- import { AppState, BinaryFiles } from "../types";
4
- import "./ExportDialog.scss";
3
+ import { BinaryFiles, UIAppState } from "../types";
5
4
  import { ActionManager } from "../actions/manager";
5
+ import "./ExportDialog.scss";
6
6
  export declare const ErrorCanvasPreview: () => JSX.Element;
7
7
  export declare type ExportCB = (elements: readonly NonDeletedExcalidrawElement[], scale?: number) => void;
8
8
  export declare const ImageExportDialog: ({ elements, appState, setAppState, files, exportPadding, actionManager, onExportToPng, onExportToSvg, onExportToClipboard, }: {
9
- appState: AppState;
10
- setAppState: React.Component<any, AppState>["setState"];
9
+ appState: UIAppState;
10
+ setAppState: React.Component<any, UIAppState>["setState"];
11
11
  elements: readonly NonDeletedExcalidrawElement[];
12
12
  files: BinaryFiles;
13
13
  exportPadding?: number | undefined;
@@ -1,15 +1,15 @@
1
1
  import React from "react";
2
2
  import { NonDeletedExcalidrawElement } from "../element/types";
3
- import { AppState, ExportOpts, BinaryFiles } from "../types";
3
+ import { ExportOpts, BinaryFiles, UIAppState } from "../types";
4
4
  import "./ExportDialog.scss";
5
5
  import { ActionManager } from "../actions/manager";
6
6
  export declare type ExportCB = (elements: readonly NonDeletedExcalidrawElement[], scale?: number) => void;
7
7
  export declare const JSONExportDialog: ({ elements, appState, files, actionManager, exportOpts, canvas, setAppState, }: {
8
8
  elements: readonly NonDeletedExcalidrawElement[];
9
- appState: AppState;
9
+ appState: UIAppState;
10
10
  files: BinaryFiles;
11
11
  actionManager: ActionManager;
12
12
  exportOpts: ExportOpts;
13
13
  canvas: HTMLCanvasElement | null;
14
- setAppState: React.Component<any, AppState>["setState"];
14
+ setAppState: React.Component<any, UIAppState>["setState"];
15
15
  }) => JSX.Element;
@@ -2,13 +2,12 @@ import React from "react";
2
2
  import { ActionManager } from "../actions/manager";
3
3
  import { NonDeletedExcalidrawElement } from "../element/types";
4
4
  import { Language } from "../i18n";
5
- import { AppProps, AppState, ExcalidrawProps, BinaryFiles } from "../types";
6
- import Library from "../data/library";
5
+ import { AppProps, AppState, ExcalidrawProps, BinaryFiles, UIAppState } from "../types";
7
6
  import "./LayerUI.scss";
8
7
  import "./Toolbar.scss";
9
8
  interface LayerUIProps {
10
9
  actionManager: ActionManager;
11
- appState: AppState;
10
+ appState: UIAppState;
12
11
  files: BinaryFiles;
13
12
  canvas: HTMLCanvasElement | null;
14
13
  setAppState: React.Component<any, AppState>["setState"];
@@ -16,22 +15,16 @@ interface LayerUIProps {
16
15
  onLockToggle: () => void;
17
16
  onHandToolToggle: () => void;
18
17
  onPenModeToggle: () => void;
19
- onInsertElements: (elements: readonly NonDeletedExcalidrawElement[]) => void;
20
18
  showExitZenModeBtn: boolean;
21
19
  langCode: Language["code"];
22
20
  renderTopRightUI?: ExcalidrawProps["renderTopRightUI"];
23
21
  renderCustomStats?: ExcalidrawProps["renderCustomStats"];
24
- renderCustomSidebar?: ExcalidrawProps["renderSidebar"];
25
- libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
26
22
  UIOptions: AppProps["UIOptions"];
27
- focusContainer: () => void;
28
- library: Library;
29
- id: string;
30
23
  onImageAction: (data: {
31
24
  insertOnCanvasDirectly: boolean;
32
25
  }) => void;
33
26
  renderWelcomeScreen: boolean;
34
27
  children?: React.ReactNode;
35
28
  }
36
- declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, onInsertElements, showExitZenModeBtn, renderTopRightUI, renderCustomStats, renderCustomSidebar, libraryReturnUrl, UIOptions, focusContainer, library, id, onImageAction, renderWelcomeScreen, children, }: LayerUIProps) => JSX.Element>;
29
+ declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onImageAction, renderWelcomeScreen, children, }: LayerUIProps) => JSX.Element>;
37
30
  export default _default;
@@ -1,25 +1,44 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import Library from "../data/library";
3
- import { LibraryItems, LibraryItem, AppState, ExcalidrawProps } from "../types";
3
+ import { LibraryItems, LibraryItem, ExcalidrawProps, UIAppState } from "../types";
4
4
  import "./LibraryMenu.scss";
5
- import { NonDeletedExcalidrawElement } from "../element/types";
5
+ export declare const isLibraryMenuOpenAtom: import("jotai").Atom<boolean> & {
6
+ write: (get: {
7
+ <Value>(atom: import("jotai").Atom<Value | Promise<Value>>): Value;
8
+ <Value_1>(atom: import("jotai").Atom<Promise<Value_1>>): Value_1;
9
+ <Value_2>(atom: import("jotai").Atom<Value_2>): Value_2 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_2;
10
+ } & {
11
+ <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>, options: {
12
+ unstable_promise: true;
13
+ }): Value_3 | Promise<Value_3>;
14
+ <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>, options: {
15
+ unstable_promise: true;
16
+ }): Value_4 | Promise<Value_4>;
17
+ <Value_5>(atom: import("jotai").Atom<Value_5>, options: {
18
+ unstable_promise: true;
19
+ }): (Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5) | Promise<Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5>;
20
+ }, set: {
21
+ <Value_6, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_6, undefined, Result>): Result;
22
+ <Value_7, Update, Result_1 extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_7, Update, Result_1>, update: Update): Result_1;
23
+ }, update: boolean | ((prev: boolean) => boolean)) => void;
24
+ onMount?: (<S extends (update: boolean | ((prev: boolean) => boolean)) => void>(setAtom: S) => void | (() => void)) | undefined;
25
+ } & {
26
+ init: boolean;
27
+ };
6
28
  export declare const LibraryMenuContent: ({ onInsertLibraryItems, pendingElements, onAddToLibrary, setAppState, libraryReturnUrl, library, id, appState, selectedItems, onSelectItems, }: {
7
29
  pendingElements: LibraryItem["elements"];
8
30
  onInsertLibraryItems: (libraryItems: LibraryItems) => void;
9
31
  onAddToLibrary: () => void;
10
- setAppState: React.Component<any, AppState>["setState"];
32
+ setAppState: React.Component<any, UIAppState>["setState"];
11
33
  libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
12
34
  library: Library;
13
35
  id: string;
14
- appState: AppState;
36
+ appState: UIAppState;
15
37
  selectedItems: LibraryItem["id"][];
16
38
  onSelectItems: (id: LibraryItem["id"][]) => void;
17
39
  }) => JSX.Element;
18
- export declare const LibraryMenu: React.FC<{
19
- appState: AppState;
20
- onInsertElements: (elements: readonly NonDeletedExcalidrawElement[]) => void;
21
- libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
22
- focusContainer: () => void;
23
- library: Library;
24
- id: string;
25
- }>;
40
+ /**
41
+ * This component is meant to be rendered inside <Sidebar.Tab/> inside our
42
+ * <DefaultSidebar/> or host apps Sidebar components.
43
+ */
44
+ export declare const LibraryMenu: () => JSX.Element;
@@ -1,7 +1,7 @@
1
- import { AppState, ExcalidrawProps } from "../types";
1
+ import { ExcalidrawProps, UIAppState } from "../types";
2
2
  declare const LibraryMenuBrowseButton: ({ theme, id, libraryReturnUrl, }: {
3
3
  libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
4
- theme: AppState["theme"];
4
+ theme: UIAppState["theme"];
5
5
  id: string;
6
6
  }) => JSX.Element;
7
7
  export default LibraryMenuBrowseButton;
@@ -0,0 +1,9 @@
1
+ import { LibraryItem, ExcalidrawProps, UIAppState } from "../types";
2
+ export declare const LibraryMenuControlButtons: ({ selectedItems, onSelectItems, libraryReturnUrl, theme, id, style, }: {
3
+ selectedItems: LibraryItem["id"][];
4
+ onSelectItems: (id: LibraryItem["id"][]) => void;
5
+ libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
6
+ theme: UIAppState["theme"];
7
+ id: string;
8
+ style: React.CSSProperties;
9
+ }) => JSX.Element;
@@ -1,35 +1,16 @@
1
- import React from "react";
1
+ /// <reference types="react" />
2
+ import { LibraryItem, UIAppState } from "../types";
2
3
  import Library from "../data/library";
3
- import { AppState, LibraryItem } from "../types";
4
- export declare const isLibraryMenuOpenAtom: import("jotai").Atom<boolean> & {
5
- write: (get: {
6
- <Value>(atom: import("jotai").Atom<Value | Promise<Value>>): Value;
7
- <Value_1>(atom: import("jotai").Atom<Promise<Value_1>>): Value_1;
8
- <Value_2>(atom: import("jotai").Atom<Value_2>): Value_2 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_2;
9
- } & {
10
- <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>, options: {
11
- unstable_promise: true;
12
- }): Value_3 | Promise<Value_3>;
13
- <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>, options: {
14
- unstable_promise: true;
15
- }): Value_4 | Promise<Value_4>;
16
- <Value_5>(atom: import("jotai").Atom<Value_5>, options: {
17
- unstable_promise: true;
18
- }): (Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5) | Promise<Value_5 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_5>;
19
- }, set: {
20
- <Value_6, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_6, undefined, Result>): Result;
21
- <Value_7, Update, Result_1 extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_7, Update, Result_1>, update: Update): Result_1;
22
- }, update: boolean | ((prev: boolean) => boolean)) => void;
23
- onMount?: (<S extends (update: boolean | ((prev: boolean) => boolean)) => void>(setAtom: S) => void | (() => void)) | undefined;
24
- } & {
25
- init: boolean;
26
- };
27
- export declare const LibraryMenuHeader: React.FC<{
28
- setAppState: React.Component<any, AppState>["setState"];
4
+ export declare const LibraryDropdownMenuButton: React.FC<{
5
+ setAppState: React.Component<any, UIAppState>["setState"];
29
6
  selectedItems: LibraryItem["id"][];
30
7
  library: Library;
31
8
  onRemoveFromLibrary: () => void;
32
9
  resetLibrary: () => void;
33
10
  onSelectItems: (items: LibraryItem["id"][]) => void;
34
- appState: AppState;
11
+ appState: UIAppState;
35
12
  }>;
13
+ export declare const LibraryDropdownMenu: ({ selectedItems, onSelectItems, }: {
14
+ selectedItems: LibraryItem["id"][];
15
+ onSelectItems: (id: LibraryItem["id"][]) => void;
16
+ }) => JSX.Element;
@@ -1,4 +1,4 @@
1
- import { AppState, ExcalidrawProps, LibraryItem, LibraryItems } from "../types";
1
+ import { ExcalidrawProps, LibraryItem, LibraryItems, UIAppState } from "../types";
2
2
  import "./LibraryMenuItems.scss";
3
3
  declare const LibraryMenuItems: ({ isLoading, libraryItems, onAddToLibrary, onInsertLibraryItems, pendingElements, selectedItems, onSelectItems, theme, id, libraryReturnUrl, }: {
4
4
  isLoading: boolean;
@@ -9,7 +9,7 @@ declare const LibraryMenuItems: ({ isLoading, libraryItems, onAddToLibrary, onIn
9
9
  selectedItems: LibraryItem["id"][];
10
10
  onSelectItems: (id: LibraryItem["id"][]) => void;
11
11
  libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
12
- theme: AppState["theme"];
12
+ theme: UIAppState["theme"];
13
13
  id: string;
14
14
  }) => JSX.Element;
15
15
  export default LibraryMenuItems;
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- import { AppState, Device, ExcalidrawProps } from "../types";
2
+ import { AppState, Device, ExcalidrawProps, UIAppState } from "../types";
3
3
  import { ActionManager } from "../actions/manager";
4
4
  import { NonDeletedExcalidrawElement } from "../element/types";
5
5
  declare type MobileMenuProps = {
6
- appState: AppState;
6
+ appState: UIAppState;
7
7
  actionManager: ActionManager;
8
8
  renderJSONExportDialog: () => React.ReactNode;
9
9
  renderImageExportDialog: () => React.ReactNode;
@@ -16,7 +16,7 @@ declare type MobileMenuProps = {
16
16
  onImageAction: (data: {
17
17
  insertOnCanvasDirectly: boolean;
18
18
  }) => void;
19
- renderTopRightUI?: (isMobile: boolean, appState: AppState) => JSX.Element | null;
19
+ renderTopRightUI?: (isMobile: boolean, appState: UIAppState) => JSX.Element | null;
20
20
  renderCustomStats?: ExcalidrawProps["renderCustomStats"];
21
21
  renderSidebars: () => JSX.Element | null;
22
22
  device: Device;
@@ -1,9 +1,8 @@
1
1
  import React from "react";
2
- import { AppState, LibraryItem } from "../types";
2
+ import { UIAppState } from "../types";
3
3
  import "./PasteChartDialog.scss";
4
- export declare const PasteChartDialog: ({ setAppState, appState, onClose, onInsertChart, }: {
5
- appState: AppState;
4
+ export declare const PasteChartDialog: ({ setAppState, appState, onClose, }: {
5
+ appState: UIAppState;
6
6
  onClose: () => void;
7
- setAppState: React.Component<any, AppState>["setState"];
8
- onInsertChart: (elements: LibraryItem["elements"]) => void;
7
+ setAppState: React.Component<any, UIAppState>["setState"];
9
8
  }) => JSX.Element;
@@ -1,9 +1,9 @@
1
- import { AppState, LibraryItems } from "../types";
1
+ import { LibraryItems, UIAppState } from "../types";
2
2
  import "./PublishLibrary.scss";
3
3
  declare const PublishLibrary: ({ onClose, libraryItems, appState, onSuccess, onError, updateItemsInStorage, onRemove, }: {
4
4
  onClose: () => void;
5
5
  libraryItems: LibraryItems;
6
- appState: AppState;
6
+ appState: UIAppState;
7
7
  onSuccess: (data: {
8
8
  url: string;
9
9
  authorName: string;