@zsviczian/excalidraw 0.12.0-obsidian-11 → 0.13.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 (45) hide show
  1. package/README.md +68 -14
  2. package/dist/excalidraw.development.js +138 -61
  3. package/dist/excalidraw.production.min.js +1 -1
  4. package/package.json +1 -1
  5. package/types/actions/actionAddToLibrary.d.ts +6 -6
  6. package/types/actions/actionBoundText.d.ts +2 -2
  7. package/types/actions/actionCanvas.d.ts +18 -18
  8. package/types/actions/actionClipboard.d.ts +10 -10
  9. package/types/actions/actionDeleteSelected.d.ts +6 -6
  10. package/types/actions/actionExport.d.ts +18 -18
  11. package/types/actions/actionFinalize.d.ts +4 -4
  12. package/types/actions/actionLinearEditor.d.ts +2 -2
  13. package/types/actions/actionMenu.d.ts +6 -6
  14. package/types/actions/actionProperties.d.ts +26 -26
  15. package/types/actions/actionStyles.d.ts +2 -2
  16. package/types/actions/actionToggleGridMode.d.ts +2 -2
  17. package/types/actions/actionToggleLock.d.ts +2 -2
  18. package/types/actions/actionToggleStats.d.ts +2 -2
  19. package/types/actions/actionToggleViewMode.d.ts +2 -2
  20. package/types/actions/actionToggleZenMode.d.ts +2 -2
  21. package/types/appState.d.ts +2 -2
  22. package/types/components/App.d.ts +6 -1
  23. package/types/components/HintViewer.d.ts +3 -2
  24. package/types/components/LayerUI.d.ts +2 -1
  25. package/types/components/LibraryMenu.d.ts +14 -5
  26. package/types/components/LibraryMenuHeaderContent.d.ts +12 -0
  27. package/types/components/LibraryMenuItems.d.ts +2 -14
  28. package/types/components/LibraryUnit.d.ts +2 -3
  29. package/types/components/MobileMenu.d.ts +4 -3
  30. package/types/components/Sidebar/Sidebar.d.ts +73 -0
  31. package/types/components/Sidebar/SidebarHeader.d.ts +20 -0
  32. package/types/components/Sidebar/common.d.ts +15 -0
  33. package/types/components/hoc/withUpstreamOverride.d.ts +10 -0
  34. package/types/data/restore.d.ts +1 -1
  35. package/types/data/types.d.ts +16 -1
  36. package/types/element/Hyperlink.d.ts +2 -2
  37. package/types/element/index.d.ts +1 -1
  38. package/types/element/linearElementEditor.d.ts +2 -2
  39. package/types/element/newElement.d.ts +8 -0
  40. package/types/keys.d.ts +3 -3
  41. package/types/packages/excalidraw/example/App.d.ts +2 -1
  42. package/types/packages/excalidraw/example/sidebar/ExampleSidebar.d.ts +5 -0
  43. package/types/packages/excalidraw/index.d.ts +1 -0
  44. package/types/scene/scrollbars.d.ts +1 -1
  45. package/types/types.d.ts +8 -2
@@ -78,6 +78,8 @@ export declare const actionChangeFillStyle: {
78
78
  }>;
79
79
  openMenu: "canvas" | "shape" | null;
80
80
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
81
+ openSidebar: "library" | "customSidebar" | null;
82
+ isSidebarDocked: boolean;
81
83
  lastPointerDownWith: import("../element/types").PointerType;
82
84
  selectedElementIds: {
83
85
  [id: string]: boolean;
@@ -104,8 +106,6 @@ export declare const actionChangeFillStyle: {
104
106
  height: number;
105
107
  offsetTop: number;
106
108
  offsetLeft: number;
107
- isLibraryOpen: boolean;
108
- isLibraryMenuDocked: boolean;
109
109
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
110
110
  collaborators: Map<string, import("../../src/types").Collaborator>;
111
111
  showStats: boolean;
@@ -195,6 +195,8 @@ export declare const actionChangeStrokeWidth: {
195
195
  }>;
196
196
  openMenu: "canvas" | "shape" | null;
197
197
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
198
+ openSidebar: "library" | "customSidebar" | null;
199
+ isSidebarDocked: boolean;
198
200
  lastPointerDownWith: import("../element/types").PointerType;
199
201
  selectedElementIds: {
200
202
  [id: string]: boolean;
@@ -221,8 +223,6 @@ export declare const actionChangeStrokeWidth: {
221
223
  height: number;
222
224
  offsetTop: number;
223
225
  offsetLeft: number;
224
- isLibraryOpen: boolean;
225
- isLibraryMenuDocked: boolean;
226
226
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
227
227
  collaborators: Map<string, import("../../src/types").Collaborator>;
228
228
  showStats: boolean;
@@ -312,6 +312,8 @@ export declare const actionChangeSloppiness: {
312
312
  }>;
313
313
  openMenu: "canvas" | "shape" | null;
314
314
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
315
+ openSidebar: "library" | "customSidebar" | null;
316
+ isSidebarDocked: boolean;
315
317
  lastPointerDownWith: import("../element/types").PointerType;
316
318
  selectedElementIds: {
317
319
  [id: string]: boolean;
@@ -338,8 +340,6 @@ export declare const actionChangeSloppiness: {
338
340
  height: number;
339
341
  offsetTop: number;
340
342
  offsetLeft: number;
341
- isLibraryOpen: boolean;
342
- isLibraryMenuDocked: boolean;
343
343
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
344
344
  collaborators: Map<string, import("../../src/types").Collaborator>;
345
345
  showStats: boolean;
@@ -429,6 +429,8 @@ export declare const actionChangeStrokeStyle: {
429
429
  }>;
430
430
  openMenu: "canvas" | "shape" | null;
431
431
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
432
+ openSidebar: "library" | "customSidebar" | null;
433
+ isSidebarDocked: boolean;
432
434
  lastPointerDownWith: import("../element/types").PointerType;
433
435
  selectedElementIds: {
434
436
  [id: string]: boolean;
@@ -455,8 +457,6 @@ export declare const actionChangeStrokeStyle: {
455
457
  height: number;
456
458
  offsetTop: number;
457
459
  offsetLeft: number;
458
- isLibraryOpen: boolean;
459
- isLibraryMenuDocked: boolean;
460
460
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
461
461
  collaborators: Map<string, import("../../src/types").Collaborator>;
462
462
  showStats: boolean;
@@ -546,6 +546,8 @@ export declare const actionChangeOpacity: {
546
546
  }>;
547
547
  openMenu: "canvas" | "shape" | null;
548
548
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
549
+ openSidebar: "library" | "customSidebar" | null;
550
+ isSidebarDocked: boolean;
549
551
  lastPointerDownWith: import("../element/types").PointerType;
550
552
  selectedElementIds: {
551
553
  [id: string]: boolean;
@@ -572,8 +574,6 @@ export declare const actionChangeOpacity: {
572
574
  height: number;
573
575
  offsetTop: number;
574
576
  offsetLeft: number;
575
- isLibraryOpen: boolean;
576
- isLibraryMenuDocked: boolean;
577
577
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
578
578
  collaborators: Map<string, import("../../src/types").Collaborator>;
579
579
  showStats: boolean;
@@ -663,6 +663,8 @@ export declare const actionChangeFontSize: {
663
663
  }>;
664
664
  openMenu: "canvas" | "shape" | null;
665
665
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
666
+ openSidebar: "library" | "customSidebar" | null;
667
+ isSidebarDocked: boolean;
666
668
  lastPointerDownWith: import("../element/types").PointerType;
667
669
  selectedElementIds: {
668
670
  [id: string]: boolean;
@@ -689,8 +691,6 @@ export declare const actionChangeFontSize: {
689
691
  height: number;
690
692
  offsetTop: number;
691
693
  offsetLeft: number;
692
- isLibraryOpen: boolean;
693
- isLibraryMenuDocked: boolean;
694
694
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
695
695
  collaborators: Map<string, import("../../src/types").Collaborator>;
696
696
  showStats: boolean;
@@ -780,6 +780,8 @@ export declare const actionDecreaseFontSize: {
780
780
  }>;
781
781
  openMenu: "canvas" | "shape" | null;
782
782
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
783
+ openSidebar: "library" | "customSidebar" | null;
784
+ isSidebarDocked: boolean;
783
785
  lastPointerDownWith: import("../element/types").PointerType;
784
786
  selectedElementIds: {
785
787
  [id: string]: boolean;
@@ -806,8 +808,6 @@ export declare const actionDecreaseFontSize: {
806
808
  height: number;
807
809
  offsetTop: number;
808
810
  offsetLeft: number;
809
- isLibraryOpen: boolean;
810
- isLibraryMenuDocked: boolean;
811
811
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
812
812
  collaborators: Map<string, import("../../src/types").Collaborator>;
813
813
  showStats: boolean;
@@ -897,6 +897,8 @@ export declare const actionIncreaseFontSize: {
897
897
  }>;
898
898
  openMenu: "canvas" | "shape" | null;
899
899
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
900
+ openSidebar: "library" | "customSidebar" | null;
901
+ isSidebarDocked: boolean;
900
902
  lastPointerDownWith: import("../element/types").PointerType;
901
903
  selectedElementIds: {
902
904
  [id: string]: boolean;
@@ -923,8 +925,6 @@ export declare const actionIncreaseFontSize: {
923
925
  height: number;
924
926
  offsetTop: number;
925
927
  offsetLeft: number;
926
- isLibraryOpen: boolean;
927
- isLibraryMenuDocked: boolean;
928
928
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
929
929
  collaborators: Map<string, import("../../src/types").Collaborator>;
930
930
  showStats: boolean;
@@ -1014,6 +1014,8 @@ export declare const actionChangeFontFamily: {
1014
1014
  }>;
1015
1015
  openMenu: "canvas" | "shape" | null;
1016
1016
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
1017
+ openSidebar: "library" | "customSidebar" | null;
1018
+ isSidebarDocked: boolean;
1017
1019
  lastPointerDownWith: import("../element/types").PointerType;
1018
1020
  selectedElementIds: {
1019
1021
  [id: string]: boolean;
@@ -1040,8 +1042,6 @@ export declare const actionChangeFontFamily: {
1040
1042
  height: number;
1041
1043
  offsetTop: number;
1042
1044
  offsetLeft: number;
1043
- isLibraryOpen: boolean;
1044
- isLibraryMenuDocked: boolean;
1045
1045
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
1046
1046
  collaborators: Map<string, import("../../src/types").Collaborator>;
1047
1047
  showStats: boolean;
@@ -1131,6 +1131,8 @@ export declare const actionChangeTextAlign: {
1131
1131
  }>;
1132
1132
  openMenu: "canvas" | "shape" | null;
1133
1133
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
1134
+ openSidebar: "library" | "customSidebar" | null;
1135
+ isSidebarDocked: boolean;
1134
1136
  lastPointerDownWith: import("../element/types").PointerType;
1135
1137
  selectedElementIds: {
1136
1138
  [id: string]: boolean;
@@ -1157,8 +1159,6 @@ export declare const actionChangeTextAlign: {
1157
1159
  height: number;
1158
1160
  offsetTop: number;
1159
1161
  offsetLeft: number;
1160
- isLibraryOpen: boolean;
1161
- isLibraryMenuDocked: boolean;
1162
1162
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
1163
1163
  collaborators: Map<string, import("../../src/types").Collaborator>;
1164
1164
  showStats: boolean;
@@ -1250,6 +1250,8 @@ export declare const actionChangeVerticalAlign: {
1250
1250
  }>;
1251
1251
  openMenu: "canvas" | "shape" | null;
1252
1252
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
1253
+ openSidebar: "library" | "customSidebar" | null;
1254
+ isSidebarDocked: boolean;
1253
1255
  lastPointerDownWith: import("../element/types").PointerType;
1254
1256
  selectedElementIds: {
1255
1257
  [id: string]: boolean;
@@ -1276,8 +1278,6 @@ export declare const actionChangeVerticalAlign: {
1276
1278
  height: number;
1277
1279
  offsetTop: number;
1278
1280
  offsetLeft: number;
1279
- isLibraryOpen: boolean;
1280
- isLibraryMenuDocked: boolean;
1281
1281
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
1282
1282
  collaborators: Map<string, import("../../src/types").Collaborator>;
1283
1283
  showStats: boolean;
@@ -1367,6 +1367,8 @@ export declare const actionChangeSharpness: {
1367
1367
  }>;
1368
1368
  openMenu: "canvas" | "shape" | null;
1369
1369
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
1370
+ openSidebar: "library" | "customSidebar" | null;
1371
+ isSidebarDocked: boolean;
1370
1372
  lastPointerDownWith: import("../element/types").PointerType;
1371
1373
  selectedElementIds: {
1372
1374
  [id: string]: boolean;
@@ -1393,8 +1395,6 @@ export declare const actionChangeSharpness: {
1393
1395
  height: number;
1394
1396
  offsetTop: number;
1395
1397
  offsetLeft: number;
1396
- isLibraryOpen: boolean;
1397
- isLibraryMenuDocked: boolean;
1398
1398
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
1399
1399
  collaborators: Map<string, import("../../src/types").Collaborator>;
1400
1400
  showStats: boolean;
@@ -1487,6 +1487,8 @@ export declare const actionChangeArrowhead: {
1487
1487
  }>;
1488
1488
  openMenu: "canvas" | "shape" | null;
1489
1489
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
1490
+ openSidebar: "library" | "customSidebar" | null;
1491
+ isSidebarDocked: boolean;
1490
1492
  lastPointerDownWith: import("../element/types").PointerType;
1491
1493
  selectedElementIds: {
1492
1494
  [id: string]: boolean;
@@ -1513,8 +1515,6 @@ export declare const actionChangeArrowhead: {
1513
1515
  height: number;
1514
1516
  offsetTop: number;
1515
1517
  offsetLeft: number;
1516
- isLibraryOpen: boolean;
1517
- isLibraryMenuDocked: boolean;
1518
1518
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
1519
1519
  collaborators: Map<string, import("../../src/types").Collaborator>;
1520
1520
  showStats: boolean;
@@ -65,6 +65,8 @@ export declare const actionCopyStyles: {
65
65
  }>;
66
66
  openMenu: "canvas" | "shape" | null;
67
67
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
68
+ openSidebar: "library" | "customSidebar" | null;
69
+ isSidebarDocked: boolean;
68
70
  lastPointerDownWith: import("../element/types").PointerType;
69
71
  selectedElementIds: {
70
72
  [id: string]: boolean;
@@ -86,8 +88,6 @@ export declare const actionCopyStyles: {
86
88
  height: number;
87
89
  offsetTop: number;
88
90
  offsetLeft: number;
89
- isLibraryOpen: boolean;
90
- isLibraryMenuDocked: boolean;
91
91
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
92
92
  collaborators: Map<string, import("../types").Collaborator>;
93
93
  showStats: boolean;
@@ -64,6 +64,8 @@ export declare const actionToggleGridMode: {
64
64
  }>;
65
65
  openMenu: "canvas" | "shape" | null;
66
66
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
67
+ openSidebar: "library" | "customSidebar" | null;
68
+ isSidebarDocked: boolean;
67
69
  lastPointerDownWith: import("../element/types").PointerType;
68
70
  selectedElementIds: {
69
71
  [id: string]: boolean;
@@ -89,8 +91,6 @@ export declare const actionToggleGridMode: {
89
91
  height: number;
90
92
  offsetTop: number;
91
93
  offsetLeft: number;
92
- isLibraryOpen: boolean;
93
- isLibraryMenuDocked: boolean;
94
94
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
95
95
  collaborators: Map<string, import("../types").Collaborator>;
96
96
  showStats: boolean;
@@ -64,6 +64,8 @@ export declare const actionToggleLock: {
64
64
  }>;
65
65
  openMenu: "canvas" | "shape" | null;
66
66
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
67
+ openSidebar: "library" | "customSidebar" | null;
68
+ isSidebarDocked: boolean;
67
69
  lastPointerDownWith: import("../element/types").PointerType;
68
70
  selectedElementIds: {
69
71
  [id: string]: boolean;
@@ -90,8 +92,6 @@ export declare const actionToggleLock: {
90
92
  height: number;
91
93
  offsetTop: number;
92
94
  offsetLeft: number;
93
- isLibraryOpen: boolean;
94
- isLibraryMenuDocked: boolean;
95
95
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
96
96
  collaborators: Map<string, import("../types").Collaborator>;
97
97
  showStats: boolean;
@@ -62,6 +62,8 @@ export declare const actionToggleStats: {
62
62
  }>;
63
63
  openMenu: "canvas" | "shape" | null;
64
64
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
65
+ openSidebar: "library" | "customSidebar" | null;
66
+ isSidebarDocked: boolean;
65
67
  lastPointerDownWith: import("../element/types").PointerType;
66
68
  selectedElementIds: {
67
69
  [id: string]: boolean;
@@ -88,8 +90,6 @@ export declare const actionToggleStats: {
88
90
  height: number;
89
91
  offsetTop: number;
90
92
  offsetLeft: number;
91
- isLibraryOpen: boolean;
92
- isLibraryMenuDocked: boolean;
93
93
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
94
94
  collaborators: Map<string, import("../types").Collaborator>;
95
95
  currentChartType: import("../element/types").ChartType;
@@ -63,6 +63,8 @@ export declare const actionToggleViewMode: {
63
63
  }>;
64
64
  openMenu: "canvas" | "shape" | null;
65
65
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
66
+ openSidebar: "library" | "customSidebar" | null;
67
+ isSidebarDocked: boolean;
66
68
  lastPointerDownWith: import("../element/types").PointerType;
67
69
  selectedElementIds: {
68
70
  [id: string]: boolean;
@@ -88,8 +90,6 @@ export declare const actionToggleViewMode: {
88
90
  height: number;
89
91
  offsetTop: number;
90
92
  offsetLeft: number;
91
- isLibraryOpen: boolean;
92
- isLibraryMenuDocked: boolean;
93
93
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
94
94
  collaborators: Map<string, import("../types").Collaborator>;
95
95
  showStats: boolean;
@@ -63,6 +63,8 @@ export declare const actionToggleZenMode: {
63
63
  }>;
64
64
  openMenu: "canvas" | "shape" | null;
65
65
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
66
+ openSidebar: "library" | "customSidebar" | null;
67
+ isSidebarDocked: boolean;
66
68
  lastPointerDownWith: import("../element/types").PointerType;
67
69
  selectedElementIds: {
68
70
  [id: string]: boolean;
@@ -88,8 +90,6 @@ export declare const actionToggleZenMode: {
88
90
  height: number;
89
91
  offsetTop: number;
90
92
  offsetLeft: number;
91
- isLibraryOpen: boolean;
92
- isLibraryMenuDocked: boolean;
93
93
  fileHandle: import("browser-fs-access").FileSystemHandle | null;
94
94
  collaborators: Map<string, import("../types").Collaborator>;
95
95
  showStats: boolean;
@@ -44,6 +44,8 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
44
44
  scrolledOutside?: boolean | undefined;
45
45
  name?: string | undefined;
46
46
  openMenu?: "canvas" | "shape" | null | undefined;
47
+ openSidebar?: "library" | "customSidebar" | null | undefined;
48
+ isSidebarDocked?: boolean | undefined;
47
49
  lastPointerDownWith?: import("./element/types").PointerType | undefined;
48
50
  selectedElementIds?: {
49
51
  [id: string]: boolean;
@@ -57,8 +59,6 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
57
59
  [groupId: string]: boolean;
58
60
  } | undefined;
59
61
  editingGroupId?: string | null | undefined;
60
- isLibraryOpen?: boolean | undefined;
61
- isLibraryMenuDocked?: boolean | undefined;
62
62
  showStats?: boolean | undefined;
63
63
  currentChartType?: import("./element/types").ChartType | undefined;
64
64
  selectedLinearElement?: import("./element/linearElementEditor").LinearElementEditor | null | undefined;
@@ -22,6 +22,7 @@ export declare const useExcalidrawContainer: () => {
22
22
  };
23
23
  export declare const useExcalidrawElements: () => readonly NonDeletedExcalidrawElement[];
24
24
  export declare const useExcalidrawAppState: () => AppState;
25
+ export declare const useExcalidrawSetAppState: () => <K extends keyof AppState>(state: AppState | ((prevState: Readonly<AppState>, props: Readonly<any>) => AppState | Pick<AppState, K> | null) | Pick<AppState, K> | null, callback?: (() => void) | undefined) => void;
25
26
  declare class App extends React.Component<AppProps, AppState> {
26
27
  canvas: AppClassProperties["canvas"];
27
28
  rc: RoughCanvas | null;
@@ -87,7 +88,7 @@ declare class App extends React.Component<AppProps, AppState> {
87
88
  private pasteFromClipboard;
88
89
  private addElementsFromPasteOrLibrary;
89
90
  private addTextFromPaste;
90
- setAppState: (obj: any) => void;
91
+ setAppState: React.Component<any, AppState>["setState"];
91
92
  removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
92
93
  toggleLock: (source?: "keyboard" | "ui") => void;
93
94
  togglePenMode: () => void;
@@ -117,6 +118,10 @@ declare class App extends React.Component<AppProps, AppState> {
117
118
  commitToHistory?: SceneData["commitToHistory"];
118
119
  }) => void;
119
120
  private onSceneUpdated;
121
+ /**
122
+ * @returns whether the menu was toggled on or off
123
+ */
124
+ toggleMenu: (type: "library" | "customSidebar", force?: boolean) => boolean;
120
125
  private updateCurrentCursorPosition;
121
126
  private onKeyDown;
122
127
  private onWheel;
@@ -1,10 +1,11 @@
1
1
  import { NonDeletedExcalidrawElement } from "../element/types";
2
2
  import "./HintViewer.scss";
3
- import { AppState } from "../types";
3
+ import { AppState, Device } from "../types";
4
4
  interface HintViewerProps {
5
5
  appState: AppState;
6
6
  elements: readonly NonDeletedExcalidrawElement[];
7
7
  isMobile: boolean;
8
+ device: Device;
8
9
  }
9
- export declare const HintViewer: ({ appState, elements, isMobile, }: HintViewerProps) => JSX.Element | null;
10
+ export declare const HintViewer: ({ appState, elements, isMobile, device, }: HintViewerProps) => JSX.Element | null;
10
11
  export {};
@@ -23,6 +23,7 @@ interface LayerUIProps {
23
23
  renderTopRightUI?: ExcalidrawProps["renderTopRightUI"];
24
24
  renderCustomFooter?: ExcalidrawProps["renderFooter"];
25
25
  renderCustomStats?: ExcalidrawProps["renderCustomStats"];
26
+ renderCustomSidebar?: ExcalidrawProps["renderSidebar"];
26
27
  libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
27
28
  UIOptions: AppProps["UIOptions"];
28
29
  focusContainer: () => void;
@@ -32,5 +33,5 @@ interface LayerUIProps {
32
33
  insertOnCanvasDirectly: boolean;
33
34
  }) => void;
34
35
  }
35
- declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onCollabButtonClick, onLockToggle, onPenModeToggle, onInsertElements, showExitZenModeBtn, isCollaborating, renderTopRightUI, renderCustomFooter, renderCustomStats, libraryReturnUrl, UIOptions, focusContainer, library, id, onImageAction, }: LayerUIProps) => JSX.Element>;
36
+ declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onCollabButtonClick, onLockToggle, onPenModeToggle, onInsertElements, showExitZenModeBtn, isCollaborating, renderTopRightUI, renderCustomFooter, renderCustomStats, renderCustomSidebar, libraryReturnUrl, UIOptions, focusContainer, library, id, onImageAction, }: LayerUIProps) => JSX.Element>;
36
37
  export default _default;
@@ -1,16 +1,25 @@
1
+ /// <reference types="react" />
1
2
  import Library from "../data/library";
2
- import { LibraryItems, LibraryItem, AppState, BinaryFiles, ExcalidrawProps } from "../types";
3
+ import { LibraryItems, LibraryItem, AppState, ExcalidrawProps } from "../types";
3
4
  import "./LibraryMenu.scss";
4
- export declare const LibraryMenu: ({ onClose, onInsertLibraryItems, pendingElements, onAddToLibrary, setAppState, files, libraryReturnUrl, focusContainer, library, id, appState, }: {
5
+ import { NonDeletedExcalidrawElement } from "../element/types";
6
+ export declare const LibraryMenuContent: ({ onInsertLibraryItems, pendingElements, onAddToLibrary, setAppState, libraryReturnUrl, library, id, appState, selectedItems, onSelectItems, }: {
5
7
  pendingElements: LibraryItem["elements"];
6
- onClose: () => void;
7
8
  onInsertLibraryItems: (libraryItems: LibraryItems) => void;
8
9
  onAddToLibrary: () => void;
9
- files: BinaryFiles;
10
10
  setAppState: React.Component<any, AppState>["setState"];
11
11
  libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
12
- focusContainer: () => void;
13
12
  library: Library;
14
13
  id: string;
15
14
  appState: AppState;
15
+ selectedItems: LibraryItem["id"][];
16
+ onSelectItems: (id: LibraryItem["id"][]) => void;
16
17
  }) => 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
+ }>;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import Library from "../data/library";
3
+ import { AppState, LibraryItem } from "../types";
4
+ export declare const LibraryMenuHeader: React.FC<{
5
+ setAppState: React.Component<any, AppState>["setState"];
6
+ selectedItems: LibraryItem["id"][];
7
+ library: Library;
8
+ onRemoveFromLibrary: () => void;
9
+ resetLibrary: () => void;
10
+ onSelectItems: (items: LibraryItem["id"][]) => void;
11
+ appState: AppState;
12
+ }>;
@@ -1,24 +1,12 @@
1
- import React from "react";
2
- import Library from "../data/library";
3
- import { AppState, BinaryFiles, ExcalidrawProps, LibraryItem, LibraryItems } from "../types";
1
+ import { LibraryItem, LibraryItems } from "../types";
4
2
  import "./LibraryMenuItems.scss";
5
- declare const LibraryMenuItems: ({ isLoading, libraryItems, onRemoveFromLibrary, onAddToLibrary, onInsertLibraryItems, pendingElements, theme, setAppState, appState, libraryReturnUrl, library, files, id, selectedItems, onSelectItems, onPublish, resetLibrary, }: {
3
+ declare const LibraryMenuItems: ({ isLoading, libraryItems, onAddToLibrary, onInsertLibraryItems, pendingElements, selectedItems, onSelectItems, }: {
6
4
  isLoading: boolean;
7
5
  libraryItems: LibraryItems;
8
6
  pendingElements: LibraryItem["elements"];
9
- onRemoveFromLibrary: () => void;
10
7
  onInsertLibraryItems: (libraryItems: LibraryItems) => void;
11
8
  onAddToLibrary: (elements: LibraryItem["elements"]) => void;
12
- theme: AppState["theme"];
13
- files: BinaryFiles;
14
- setAppState: React.Component<any, AppState>["setState"];
15
- appState: AppState;
16
- libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
17
- library: Library;
18
- id: string;
19
9
  selectedItems: LibraryItem["id"][];
20
10
  onSelectItems: (id: LibraryItem["id"][]) => void;
21
- onPublish: () => void;
22
- resetLibrary: () => void;
23
11
  }) => JSX.Element;
24
12
  export default LibraryMenuItems;
@@ -1,9 +1,8 @@
1
- import { BinaryFiles, LibraryItem } from "../types";
1
+ import { LibraryItem } from "../types";
2
2
  import "./LibraryUnit.scss";
3
- export declare const LibraryUnit: ({ id, elements, files, isPending, onClick, selected, onToggle, onDrag, }: {
3
+ export declare const LibraryUnit: ({ id, elements, isPending, onClick, selected, onToggle, onDrag, }: {
4
4
  id: LibraryItem["id"] | /** for pending item */ null;
5
5
  elements?: readonly import("../element/types").NonDeleted<import("../element/types").ExcalidrawElement>[] | undefined;
6
- files: BinaryFiles;
7
6
  isPending?: boolean | undefined;
8
7
  onClick: () => void;
9
8
  selected: boolean;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { AppState, ExcalidrawProps } from "../types";
2
+ import { AppState, Device, ExcalidrawProps } from "../types";
3
3
  import { ActionManager } from "../actions/manager";
4
4
  import { NonDeletedExcalidrawElement } from "../element/types";
5
5
  declare type MobileMenuProps = {
@@ -9,7 +9,6 @@ declare type MobileMenuProps = {
9
9
  renderImageExportDialog: () => React.ReactNode;
10
10
  setAppState: React.Component<any, AppState>["setState"];
11
11
  elements: readonly NonDeletedExcalidrawElement[];
12
- libraryMenu: JSX.Element | null;
13
12
  onCollabButtonClick?: () => void;
14
13
  onLockToggle: () => void;
15
14
  onPenModeToggle: () => void;
@@ -21,6 +20,8 @@ declare type MobileMenuProps = {
21
20
  }) => void;
22
21
  renderTopRightUI?: (isMobile: boolean, appState: AppState) => JSX.Element | null;
23
22
  renderCustomStats?: ExcalidrawProps["renderCustomStats"];
23
+ renderSidebars: () => JSX.Element | null;
24
+ device: Device;
24
25
  };
25
- export declare const MobileMenu: ({ appState, elements, libraryMenu, actionManager, renderJSONExportDialog, renderImageExportDialog, setAppState, onCollabButtonClick, onLockToggle, onPenModeToggle, canvas, isCollaborating, renderCustomFooter, onImageAction, renderTopRightUI, renderCustomStats, }: MobileMenuProps) => JSX.Element;
26
+ export declare const MobileMenu: ({ appState, elements, actionManager, renderJSONExportDialog, renderImageExportDialog, setAppState, onCollabButtonClick, onLockToggle, onPenModeToggle, canvas, isCollaborating, renderCustomFooter, onImageAction, renderTopRightUI, renderCustomStats, renderSidebars, device, }: MobileMenuProps) => JSX.Element;
26
27
  export {};
@@ -0,0 +1,73 @@
1
+ /// <reference types="react" />
2
+ import "./Sidebar.scss";
3
+ /** using a counter instead of boolean to handle race conditions where
4
+ * the host app may render (mount/unmount) multiple different sidebar */
5
+ export declare const hostSidebarCountersAtom: import("jotai").Atom<{
6
+ rendered: number;
7
+ docked: number;
8
+ }> & {
9
+ write: (get: {
10
+ <Value>(atom: import("jotai").Atom<Value | Promise<Value>>): Value;
11
+ <Value_1>(atom: import("jotai").Atom<Promise<Value_1>>): Value_1;
12
+ <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;
13
+ } & {
14
+ <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>, options: {
15
+ unstable_promise: true;
16
+ }): Value_3 | Promise<Value_3>;
17
+ <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>, options: {
18
+ unstable_promise: true;
19
+ }): Value_4 | Promise<Value_4>;
20
+ <Value_5>(atom: import("jotai").Atom<Value_5>, options: {
21
+ unstable_promise: true;
22
+ }): (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>;
23
+ }, set: {
24
+ <Value_6, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_6, undefined, Result>): Result;
25
+ <Value_7, Update, Result_1 extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_7, Update, Result_1>, update: Update): Result_1;
26
+ }, update: {
27
+ rendered: number;
28
+ docked: number;
29
+ } | ((prev: {
30
+ rendered: number;
31
+ docked: number;
32
+ }) => {
33
+ rendered: number;
34
+ docked: number;
35
+ })) => void;
36
+ onMount?: (<S extends (update: {
37
+ rendered: number;
38
+ docked: number;
39
+ } | ((prev: {
40
+ rendered: number;
41
+ docked: number;
42
+ }) => {
43
+ rendered: number;
44
+ docked: number;
45
+ })) => void>(setAtom: S) => void | (() => void)) | undefined;
46
+ } & {
47
+ /** @private internal */
48
+ init: {
49
+ rendered: number;
50
+ docked: number;
51
+ };
52
+ };
53
+ export declare const Sidebar: import("react").ForwardRefExoticComponent<{
54
+ children: import("react").ReactNode;
55
+ onClose?: (() => boolean | void) | undefined;
56
+ onDock?: ((docked: boolean) => void) | undefined;
57
+ docked?: boolean | undefined;
58
+ dockable?: boolean | undefined;
59
+ className?: string | undefined;
60
+ } & {
61
+ /** @private internal */
62
+ __isInternal?: boolean | undefined;
63
+ } & import("react").RefAttributes<HTMLDivElement>> & {
64
+ Header: {
65
+ (props: {
66
+ children?: import("react").ReactNode;
67
+ className?: string | undefined;
68
+ } & {
69
+ __isFallback?: boolean | undefined;
70
+ }): JSX.Element | null;
71
+ displayName: string;
72
+ };
73
+ };
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ export declare const SidebarDockButton: (props: {
3
+ checked: boolean;
4
+ onChange?(): void;
5
+ }) => JSX.Element;
6
+ /** @private */
7
+ export declare const SidebarHeaderComponents: {
8
+ Context: import("react").FC<{
9
+ children: import("react").ReactNode;
10
+ }>;
11
+ Component: {
12
+ (props: {
13
+ children?: React.ReactNode;
14
+ className?: string | undefined;
15
+ } & {
16
+ __isFallback?: boolean | undefined;
17
+ }): JSX.Element | null;
18
+ displayName: string;
19
+ };
20
+ };
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ export declare type SidebarProps<P = {}> = {
3
+ children: React.ReactNode;
4
+ /**
5
+ * Called on sidebar close (either by user action or by the editor).
6
+ */
7
+ onClose?: () => void | boolean;
8
+ /** if not supplied, sidebar won't be dockable */
9
+ onDock?: (docked: boolean) => void;
10
+ docked?: boolean;
11
+ dockable?: boolean;
12
+ className?: string;
13
+ } & P;
14
+ export declare type SidebarPropsContextValue = Pick<SidebarProps, "onClose" | "onDock" | "docked" | "dockable">;
15
+ export declare const SidebarPropsContext: React.Context<SidebarPropsContextValue>;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ export declare const withUpstreamOverride: <P>(Component: React.ComponentType<P>) => readonly [React.FC<{
3
+ children: React.ReactNode;
4
+ }>, {
5
+ (props: P & {
6
+ /** @private internal */
7
+ __isFallback?: boolean | undefined;
8
+ }): JSX.Element | null;
9
+ displayName: string;
10
+ }];