@zsviczian/excalidraw 0.15.2-obsidian-1 → 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 (63) hide show
  1. package/dist/excalidraw.development.js +462 -198
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/package.json +1 -1
  4. package/types/actions/actionAddToLibrary.d.ts +15 -6
  5. package/types/actions/actionBoundText.d.ts +10 -4
  6. package/types/actions/actionCanvas.d.ts +50 -20
  7. package/types/actions/actionClipboard.d.ts +25 -10
  8. package/types/actions/actionDeleteSelected.d.ts +15 -6
  9. package/types/actions/actionExport.d.ts +45 -18
  10. package/types/actions/actionFinalize.d.ts +10 -4
  11. package/types/actions/actionLinearEditor.d.ts +5 -2
  12. package/types/actions/actionMenu.d.ts +15 -6
  13. package/types/actions/actionProperties.d.ts +65 -26
  14. package/types/actions/actionStyles.d.ts +5 -2
  15. package/types/actions/actionToggleGridMode.d.ts +5 -2
  16. package/types/actions/actionToggleLock.d.ts +5 -2
  17. package/types/actions/actionToggleStats.d.ts +5 -2
  18. package/types/actions/actionToggleViewMode.d.ts +5 -2
  19. package/types/actions/actionToggleZenMode.d.ts +5 -2
  20. package/types/appState.d.ts +5 -2
  21. package/types/clipboard.d.ts +2 -2
  22. package/types/components/Actions.d.ts +5 -5
  23. package/types/components/App.d.ts +10 -3
  24. package/types/components/Button.d.ts +3 -1
  25. package/types/components/DefaultSidebar.d.ts +30 -0
  26. package/types/components/HintViewer.d.ts +2 -2
  27. package/types/components/ImageExportDialog.d.ts +4 -4
  28. package/types/components/JSONExportDialog.d.ts +3 -3
  29. package/types/components/LayerUI.d.ts +3 -10
  30. package/types/components/LibraryMenu.d.ts +32 -13
  31. package/types/components/LibraryMenuBrowseButton.d.ts +2 -2
  32. package/types/components/LibraryMenuControlButtons.d.ts +9 -0
  33. package/types/components/LibraryMenuHeaderContent.d.ts +9 -28
  34. package/types/components/LibraryMenuItems.d.ts +2 -2
  35. package/types/components/MobileMenu.d.ts +3 -3
  36. package/types/components/PasteChartDialog.d.ts +4 -5
  37. package/types/components/PublishLibrary.d.ts +2 -2
  38. package/types/components/Sidebar/Sidebar.d.ts +68 -45
  39. package/types/components/Sidebar/SidebarHeader.d.ts +6 -19
  40. package/types/components/Sidebar/SidebarTab.d.ts +9 -0
  41. package/types/components/Sidebar/SidebarTabTrigger.d.ts +10 -0
  42. package/types/components/Sidebar/SidebarTabTriggers.d.ts +7 -0
  43. package/types/components/Sidebar/SidebarTabs.d.ts +7 -0
  44. package/types/components/Sidebar/SidebarTrigger.d.ts +6 -0
  45. package/types/components/Sidebar/common.d.ts +23 -6
  46. package/types/components/Stats.d.ts +3 -3
  47. package/types/components/Trans.d.ts +8 -0
  48. package/types/components/footer/Footer.d.ts +2 -2
  49. package/types/constants.d.ts +5 -0
  50. package/types/context/tunnels.d.ts +18 -0
  51. package/types/context/ui-appState.d.ts +4 -0
  52. package/types/data/types.d.ts +2 -4
  53. package/types/element/Hyperlink.d.ts +7 -4
  54. package/types/element/linearElementEditor.d.ts +5 -2
  55. package/types/element/newElement.d.ts +6 -1
  56. package/types/element/showSelectedShapeActions.d.ts +2 -2
  57. package/types/element/textElement.d.ts +2 -2
  58. package/types/hooks/useOutsideClick.d.ts +1 -1
  59. package/types/packages/excalidraw/index.d.ts +2 -1
  60. package/types/packages/utils.d.ts +1 -1
  61. package/types/scene/selection.d.ts +4 -4
  62. package/types/types.d.ts +23 -12
  63. package/types/utils.d.ts +2 -2
@@ -82,9 +82,12 @@ export declare const actionChangeFillStyle: {
82
82
  }>;
83
83
  openMenu: "canvas" | "shape" | null;
84
84
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
85
- openSidebar: "library" | "customSidebar" | null;
85
+ openSidebar: {
86
+ name: string;
87
+ tab?: string | undefined;
88
+ } | null;
86
89
  openDialog: "imageExport" | "help" | "jsonExport" | null;
87
- isSidebarDocked: boolean;
90
+ defaultSidebarDockedPreference: boolean;
88
91
  lastPointerDownWith: import("../element/types").PointerType;
89
92
  selectedElementIds: {
90
93
  [id: string]: boolean;
@@ -213,9 +216,12 @@ export declare const actionChangeStrokeWidth: {
213
216
  }>;
214
217
  openMenu: "canvas" | "shape" | null;
215
218
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
216
- openSidebar: "library" | "customSidebar" | null;
219
+ openSidebar: {
220
+ name: string;
221
+ tab?: string | undefined;
222
+ } | null;
217
223
  openDialog: "imageExport" | "help" | "jsonExport" | null;
218
- isSidebarDocked: boolean;
224
+ defaultSidebarDockedPreference: boolean;
219
225
  lastPointerDownWith: import("../element/types").PointerType;
220
226
  selectedElementIds: {
221
227
  [id: string]: boolean;
@@ -344,9 +350,12 @@ export declare const actionChangeSloppiness: {
344
350
  }>;
345
351
  openMenu: "canvas" | "shape" | null;
346
352
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
347
- openSidebar: "library" | "customSidebar" | null;
353
+ openSidebar: {
354
+ name: string;
355
+ tab?: string | undefined;
356
+ } | null;
348
357
  openDialog: "imageExport" | "help" | "jsonExport" | null;
349
- isSidebarDocked: boolean;
358
+ defaultSidebarDockedPreference: boolean;
350
359
  lastPointerDownWith: import("../element/types").PointerType;
351
360
  selectedElementIds: {
352
361
  [id: string]: boolean;
@@ -475,9 +484,12 @@ export declare const actionChangeStrokeStyle: {
475
484
  }>;
476
485
  openMenu: "canvas" | "shape" | null;
477
486
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
478
- openSidebar: "library" | "customSidebar" | null;
487
+ openSidebar: {
488
+ name: string;
489
+ tab?: string | undefined;
490
+ } | null;
479
491
  openDialog: "imageExport" | "help" | "jsonExport" | null;
480
- isSidebarDocked: boolean;
492
+ defaultSidebarDockedPreference: boolean;
481
493
  lastPointerDownWith: import("../element/types").PointerType;
482
494
  selectedElementIds: {
483
495
  [id: string]: boolean;
@@ -606,9 +618,12 @@ export declare const actionChangeOpacity: {
606
618
  }>;
607
619
  openMenu: "canvas" | "shape" | null;
608
620
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
609
- openSidebar: "library" | "customSidebar" | null;
621
+ openSidebar: {
622
+ name: string;
623
+ tab?: string | undefined;
624
+ } | null;
610
625
  openDialog: "imageExport" | "help" | "jsonExport" | null;
611
- isSidebarDocked: boolean;
626
+ defaultSidebarDockedPreference: boolean;
612
627
  lastPointerDownWith: import("../element/types").PointerType;
613
628
  selectedElementIds: {
614
629
  [id: string]: boolean;
@@ -737,9 +752,12 @@ export declare const actionChangeFontSize: {
737
752
  }>;
738
753
  openMenu: "canvas" | "shape" | null;
739
754
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
740
- openSidebar: "library" | "customSidebar" | null;
755
+ openSidebar: {
756
+ name: string;
757
+ tab?: string | undefined;
758
+ } | null;
741
759
  openDialog: "imageExport" | "help" | "jsonExport" | null;
742
- isSidebarDocked: boolean;
760
+ defaultSidebarDockedPreference: boolean;
743
761
  lastPointerDownWith: import("../element/types").PointerType;
744
762
  selectedElementIds: {
745
763
  [id: string]: boolean;
@@ -868,9 +886,12 @@ export declare const actionDecreaseFontSize: {
868
886
  }>;
869
887
  openMenu: "canvas" | "shape" | null;
870
888
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
871
- openSidebar: "library" | "customSidebar" | null;
889
+ openSidebar: {
890
+ name: string;
891
+ tab?: string | undefined;
892
+ } | null;
872
893
  openDialog: "imageExport" | "help" | "jsonExport" | null;
873
- isSidebarDocked: boolean;
894
+ defaultSidebarDockedPreference: boolean;
874
895
  lastPointerDownWith: import("../element/types").PointerType;
875
896
  selectedElementIds: {
876
897
  [id: string]: boolean;
@@ -999,9 +1020,12 @@ export declare const actionIncreaseFontSize: {
999
1020
  }>;
1000
1021
  openMenu: "canvas" | "shape" | null;
1001
1022
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
1002
- openSidebar: "library" | "customSidebar" | null;
1023
+ openSidebar: {
1024
+ name: string;
1025
+ tab?: string | undefined;
1026
+ } | null;
1003
1027
  openDialog: "imageExport" | "help" | "jsonExport" | null;
1004
- isSidebarDocked: boolean;
1028
+ defaultSidebarDockedPreference: boolean;
1005
1029
  lastPointerDownWith: import("../element/types").PointerType;
1006
1030
  selectedElementIds: {
1007
1031
  [id: string]: boolean;
@@ -1130,9 +1154,12 @@ export declare const actionChangeFontFamily: {
1130
1154
  }>;
1131
1155
  openMenu: "canvas" | "shape" | null;
1132
1156
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
1133
- openSidebar: "library" | "customSidebar" | null;
1157
+ openSidebar: {
1158
+ name: string;
1159
+ tab?: string | undefined;
1160
+ } | null;
1134
1161
  openDialog: "imageExport" | "help" | "jsonExport" | null;
1135
- isSidebarDocked: boolean;
1162
+ defaultSidebarDockedPreference: boolean;
1136
1163
  lastPointerDownWith: import("../element/types").PointerType;
1137
1164
  selectedElementIds: {
1138
1165
  [id: string]: boolean;
@@ -1261,9 +1288,12 @@ export declare const actionChangeTextAlign: {
1261
1288
  }>;
1262
1289
  openMenu: "canvas" | "shape" | null;
1263
1290
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
1264
- openSidebar: "library" | "customSidebar" | null;
1291
+ openSidebar: {
1292
+ name: string;
1293
+ tab?: string | undefined;
1294
+ } | null;
1265
1295
  openDialog: "imageExport" | "help" | "jsonExport" | null;
1266
- isSidebarDocked: boolean;
1296
+ defaultSidebarDockedPreference: boolean;
1267
1297
  lastPointerDownWith: import("../element/types").PointerType;
1268
1298
  selectedElementIds: {
1269
1299
  [id: string]: boolean;
@@ -1394,9 +1424,12 @@ export declare const actionChangeVerticalAlign: {
1394
1424
  }>;
1395
1425
  openMenu: "canvas" | "shape" | null;
1396
1426
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
1397
- openSidebar: "library" | "customSidebar" | null;
1427
+ openSidebar: {
1428
+ name: string;
1429
+ tab?: string | undefined;
1430
+ } | null;
1398
1431
  openDialog: "imageExport" | "help" | "jsonExport" | null;
1399
- isSidebarDocked: boolean;
1432
+ defaultSidebarDockedPreference: boolean;
1400
1433
  lastPointerDownWith: import("../element/types").PointerType;
1401
1434
  selectedElementIds: {
1402
1435
  [id: string]: boolean;
@@ -1525,9 +1558,12 @@ export declare const actionChangeRoundness: {
1525
1558
  }>;
1526
1559
  openMenu: "canvas" | "shape" | null;
1527
1560
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
1528
- openSidebar: "library" | "customSidebar" | null;
1561
+ openSidebar: {
1562
+ name: string;
1563
+ tab?: string | undefined;
1564
+ } | null;
1529
1565
  openDialog: "imageExport" | "help" | "jsonExport" | null;
1530
- isSidebarDocked: boolean;
1566
+ defaultSidebarDockedPreference: boolean;
1531
1567
  lastPointerDownWith: import("../element/types").PointerType;
1532
1568
  selectedElementIds: {
1533
1569
  [id: string]: boolean;
@@ -1659,9 +1695,12 @@ export declare const actionChangeArrowhead: {
1659
1695
  }>;
1660
1696
  openMenu: "canvas" | "shape" | null;
1661
1697
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
1662
- openSidebar: "library" | "customSidebar" | null;
1698
+ openSidebar: {
1699
+ name: string;
1700
+ tab?: string | undefined;
1701
+ } | null;
1663
1702
  openDialog: "imageExport" | "help" | "jsonExport" | null;
1664
- isSidebarDocked: boolean;
1703
+ defaultSidebarDockedPreference: boolean;
1665
1704
  lastPointerDownWith: import("../element/types").PointerType;
1666
1705
  selectedElementIds: {
1667
1706
  [id: string]: boolean;
@@ -69,9 +69,12 @@ export declare const actionCopyStyles: {
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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;