@zsviczian/excalidraw 0.15.2-obsidian-1 → 0.15.2-obsidian-3

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 (127) hide show
  1. package/dist/excalidraw.development.js +1438 -364
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/package.json +2 -2
  4. package/types/actions/actionAddToLibrary.d.ts +48 -24
  5. package/types/actions/actionBoundText.d.ts +32 -16
  6. package/types/actions/actionCanvas.d.ts +160 -80
  7. package/types/actions/actionClipboard.d.ts +80 -40
  8. package/types/actions/actionDeleteSelected.d.ts +48 -24
  9. package/types/actions/actionElementLock.d.ts +287 -0
  10. package/types/actions/actionExport.d.ts +145 -73
  11. package/types/actions/actionFinalize.d.ts +32 -16
  12. package/types/actions/actionFlip.d.ts +2 -4
  13. package/types/actions/actionHistory.d.ts +1 -1
  14. package/types/actions/actionLinearEditor.d.ts +16 -8
  15. package/types/actions/actionMenu.d.ts +48 -24
  16. package/types/actions/actionProperties.d.ts +210 -106
  17. package/types/actions/actionStyles.d.ts +16 -8
  18. package/types/actions/actionToggleGridMode.d.ts +16 -8
  19. package/types/actions/actionToggleLock.d.ts +5 -2
  20. package/types/actions/actionToggleStats.d.ts +16 -8
  21. package/types/actions/actionToggleViewMode.d.ts +16 -8
  22. package/types/actions/actionToggleZenMode.d.ts +16 -8
  23. package/types/actions/index.d.ts +1 -1
  24. package/types/actions/manager.d.ts +1 -1
  25. package/types/actions/shortcuts.d.ts +1 -1
  26. package/types/actions/types.d.ts +7 -7
  27. package/types/appState.d.ts +5 -2
  28. package/types/charts.d.ts +2 -2
  29. package/types/clients.d.ts +4 -1
  30. package/types/clipboard.d.ts +2 -2
  31. package/types/colors.d.ts +59 -5
  32. package/types/components/Actions.d.ts +5 -5
  33. package/types/components/App.d.ts +13 -3
  34. package/types/components/Avatar.d.ts +1 -1
  35. package/types/components/Button.d.ts +3 -1
  36. package/types/components/ColorPicker/ColorInput.d.ts +7 -0
  37. package/types/components/ColorPicker/ColorPicker.d.ts +18 -0
  38. package/types/components/ColorPicker/CustomColorList.d.ts +8 -0
  39. package/types/components/ColorPicker/HotkeyLabel.d.ts +8 -0
  40. package/types/components/ColorPicker/Picker.d.ts +16 -0
  41. package/types/components/ColorPicker/PickerColorList.d.ts +10 -0
  42. package/types/components/ColorPicker/PickerHeading.d.ts +5 -0
  43. package/types/components/ColorPicker/ShadeList.d.ts +8 -0
  44. package/types/components/ColorPicker/TopPicks.d.ts +9 -0
  45. package/types/components/ColorPicker/colorPickerUtils.d.ts +41 -0
  46. package/types/components/ColorPicker/keyboardNavHandlers.d.ts +16 -0
  47. package/types/components/ContextMenu.d.ts +3 -3
  48. package/types/components/DefaultSidebar.d.ts +30 -0
  49. package/types/components/Dialog.d.ts +2 -2
  50. package/types/components/FilledButton.d.ts +16 -0
  51. package/types/components/FixedSideContainer.d.ts +1 -1
  52. package/types/components/HandButton.d.ts +1 -1
  53. package/types/components/HelpButton.d.ts +1 -1
  54. package/types/components/HintViewer.d.ts +2 -2
  55. package/types/components/ImageExportDialog.d.ts +8 -13
  56. package/types/components/Island.d.ts +1 -1
  57. package/types/components/JSONExportDialog.d.ts +4 -4
  58. package/types/components/LayerUI.d.ts +4 -10
  59. package/types/components/LibraryMenu.d.ts +33 -14
  60. package/types/components/LibraryMenuBrowseButton.d.ts +2 -2
  61. package/types/components/LibraryMenuControlButtons.d.ts +9 -0
  62. package/types/components/LibraryMenuHeaderContent.d.ts +11 -28
  63. package/types/components/LibraryMenuItems.d.ts +6 -7
  64. package/types/components/LibraryMenuSection.d.ts +22 -0
  65. package/types/components/LibraryUnit.d.ts +7 -3
  66. package/types/components/LockButton.d.ts +1 -1
  67. package/types/components/MobileMenu.d.ts +4 -4
  68. package/types/components/PasteChartDialog.d.ts +4 -5
  69. package/types/components/PenModeButton.d.ts +1 -1
  70. package/types/components/Popover.d.ts +1 -1
  71. package/types/components/ProjectName.d.ts +2 -1
  72. package/types/components/PublishLibrary.d.ts +2 -2
  73. package/types/components/RadioGroup.d.ts +12 -0
  74. package/types/components/Sidebar/Sidebar.d.ts +68 -45
  75. package/types/components/Sidebar/SidebarHeader.d.ts +6 -19
  76. package/types/components/Sidebar/SidebarTab.d.ts +9 -0
  77. package/types/components/Sidebar/SidebarTabTrigger.d.ts +10 -0
  78. package/types/components/Sidebar/SidebarTabTriggers.d.ts +7 -0
  79. package/types/components/Sidebar/SidebarTabs.d.ts +7 -0
  80. package/types/components/Sidebar/SidebarTrigger.d.ts +6 -0
  81. package/types/components/Sidebar/common.d.ts +24 -7
  82. package/types/components/Spinner.d.ts +2 -1
  83. package/types/components/Stack.d.ts +4 -3
  84. package/types/components/Stats.d.ts +3 -3
  85. package/types/components/Switch.d.ts +9 -0
  86. package/types/components/ToolButton.d.ts +3 -3
  87. package/types/components/Tooltip.d.ts +1 -1
  88. package/types/components/Trans.d.ts +8 -0
  89. package/types/components/footer/Footer.d.ts +2 -2
  90. package/types/components/icons.d.ts +7 -1
  91. package/types/constants.d.ts +10 -0
  92. package/types/context/tunnels.d.ts +18 -0
  93. package/types/context/ui-appState.d.ts +4 -0
  94. package/types/data/encode.d.ts +1 -1
  95. package/types/data/filesystem.d.ts +1 -1
  96. package/types/data/library.d.ts +2 -0
  97. package/types/data/restore.d.ts +2 -2
  98. package/types/data/types.d.ts +3 -5
  99. package/types/element/Hyperlink.d.ts +18 -10
  100. package/types/element/binding.d.ts +2 -2
  101. package/types/element/bounds.d.ts +1 -1
  102. package/types/element/linearElementEditor.d.ts +16 -8
  103. package/types/element/mutateElement.d.ts +1 -1
  104. package/types/element/newElement.d.ts +7 -2
  105. package/types/element/resizeElements.d.ts +1 -0
  106. package/types/element/showSelectedShapeActions.d.ts +2 -2
  107. package/types/element/textElement.d.ts +2 -2
  108. package/types/element/transformHandles.d.ts +5 -5
  109. package/types/element/types.d.ts +35 -35
  110. package/types/errors.d.ts +1 -1
  111. package/types/ga.d.ts +5 -5
  112. package/types/hooks/useLibraryItemSvg.d.ts +31 -0
  113. package/types/hooks/useOutsideClick.d.ts +1 -1
  114. package/types/hooks/useScrollPosition.d.ts +2 -0
  115. package/types/hooks/useTransition.d.ts +2 -0
  116. package/types/i18n.d.ts +2 -2
  117. package/types/keys.d.ts +1 -1
  118. package/types/packages/excalidraw/index.d.ts +3 -2
  119. package/types/packages/utils.d.ts +3 -3
  120. package/types/renderer/easingFunctions.d.ts +1 -1
  121. package/types/renderer/renderElement.d.ts +2 -2
  122. package/types/scene/Scene.d.ts +4 -4
  123. package/types/scene/selection.d.ts +4 -4
  124. package/types/scene/types.d.ts +4 -4
  125. package/types/types.d.ts +65 -46
  126. package/types/utility-types.d.ts +13 -13
  127. package/types/utils.d.ts +5 -5
@@ -4,9 +4,9 @@ import { AppState } from "../types";
4
4
  export interface DialogProps {
5
5
  children: React.ReactNode;
6
6
  className?: string;
7
- small?: boolean;
7
+ size?: "small" | "regular" | "wide";
8
8
  onCloseRequest(): void;
9
- title: React.ReactNode;
9
+ title: React.ReactNode | false;
10
10
  autofocus?: boolean;
11
11
  theme?: AppState["theme"];
12
12
  closeOnClickOutside?: boolean;
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ import "./FilledButton.scss";
3
+ export type ButtonVariant = "filled" | "outlined" | "icon";
4
+ export type ButtonColor = "primary" | "danger";
5
+ export type ButtonSize = "medium" | "large";
6
+ export type FilledButtonProps = {
7
+ label: string;
8
+ children?: React.ReactNode;
9
+ onClick?: () => void;
10
+ variant?: ButtonVariant;
11
+ color?: ButtonColor;
12
+ size?: ButtonSize;
13
+ className?: string;
14
+ startIcon?: React.ReactNode;
15
+ };
16
+ export declare const FilledButton: React.ForwardRefExoticComponent<FilledButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -1,6 +1,6 @@
1
1
  import "./FixedSideContainer.scss";
2
2
  import React from "react";
3
- declare type FixedSideContainerProps = {
3
+ type FixedSideContainerProps = {
4
4
  children: React.ReactNode;
5
5
  side: "top" | "left" | "right";
6
6
  className?: string;
@@ -1,5 +1,5 @@
1
1
  import "./ToolIcon.scss";
2
- declare type LockIconProps = {
2
+ type LockIconProps = {
3
3
  title?: string;
4
4
  name?: string;
5
5
  checked: boolean;
@@ -1,4 +1,4 @@
1
- declare type HelpButtonProps = {
1
+ type HelpButtonProps = {
2
2
  name?: string;
3
3
  id?: string;
4
4
  onClick?(): void;
@@ -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,18 +1,13 @@
1
- import React from "react";
1
+ import type { ActionManager } from "../actions/manager";
2
+ import type { AppClassProperties, BinaryFiles, UIAppState } from "../types";
2
3
  import { NonDeletedExcalidrawElement } from "../element/types";
3
- import { AppState, BinaryFiles } from "../types";
4
- import "./ExportDialog.scss";
5
- import { ActionManager } from "../actions/manager";
4
+ import "./ImageExportDialog.scss";
6
5
  export declare const ErrorCanvasPreview: () => JSX.Element;
7
- export declare type ExportCB = (elements: readonly NonDeletedExcalidrawElement[], scale?: number) => void;
8
- export declare const ImageExportDialog: ({ elements, appState, setAppState, files, exportPadding, actionManager, onExportToPng, onExportToSvg, onExportToClipboard, }: {
9
- appState: AppState;
10
- setAppState: React.Component<any, AppState>["setState"];
6
+ export declare const ImageExportDialog: ({ elements, appState, files, actionManager, onExportImage, onCloseRequest, }: {
7
+ appState: UIAppState;
11
8
  elements: readonly NonDeletedExcalidrawElement[];
12
9
  files: BinaryFiles;
13
- exportPadding?: number | undefined;
14
10
  actionManager: ActionManager;
15
- onExportToPng: ExportCB;
16
- onExportToSvg: ExportCB;
17
- onExportToClipboard: ExportCB;
18
- }) => JSX.Element;
11
+ onExportImage: AppClassProperties["onExportImage"];
12
+ onCloseRequest: () => void;
13
+ }) => JSX.Element | null;
@@ -1,6 +1,6 @@
1
1
  import "./Island.scss";
2
2
  import React from "react";
3
- declare type IslandProps = {
3
+ type IslandProps = {
4
4
  children: React.ReactNode;
5
5
  padding?: number;
6
6
  className?: string | boolean;
@@ -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
- export declare type ExportCB = (elements: readonly NonDeletedExcalidrawElement[], scale?: number) => void;
6
+ export 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, AppClassProperties } 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,17 @@ 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;
26
+ onExportImage: AppClassProperties["onExportImage"];
33
27
  renderWelcomeScreen: boolean;
34
28
  children?: React.ReactNode;
35
29
  }
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>;
30
+ declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onImageAction, onExportImage, renderWelcomeScreen, children, }: LayerUIProps) => JSX.Element>;
37
31
  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";
6
- export declare const LibraryMenuContent: ({ onInsertLibraryItems, pendingElements, onAddToLibrary, setAppState, libraryReturnUrl, library, id, appState, selectedItems, onSelectItems, }: {
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
+ };
28
+ export declare const LibraryMenuContent: ({ onInsertLibraryItems, pendingElements, onAddToLibrary, setAppState, libraryReturnUrl, library, id, theme, 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
+ theme: UIAppState["theme"];
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 { ExcalidrawProps, UIAppState } from "../types";
2
+ export declare const LibraryMenuControlButtons: ({ libraryReturnUrl, theme, id, style, children, className, }: {
3
+ libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
4
+ theme: UIAppState["theme"];
5
+ id: string;
6
+ style: React.CSSProperties;
7
+ children?: React.ReactNode;
8
+ className?: string | undefined;
9
+ }) => JSX.Element;
@@ -1,35 +1,18 @@
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;
12
+ className?: string;
35
13
  }>;
14
+ export declare const LibraryDropdownMenu: ({ selectedItems, onSelectItems, className, }: {
15
+ selectedItems: LibraryItem["id"][];
16
+ onSelectItems: (id: LibraryItem["id"][]) => void;
17
+ className?: string | undefined;
18
+ }) => JSX.Element;
@@ -1,15 +1,14 @@
1
- import { AppState, ExcalidrawProps, LibraryItem, LibraryItems } from "../types";
1
+ import { ExcalidrawProps, LibraryItem, LibraryItems, UIAppState } from "../types";
2
2
  import "./LibraryMenuItems.scss";
3
- declare const LibraryMenuItems: ({ isLoading, libraryItems, onAddToLibrary, onInsertLibraryItems, pendingElements, selectedItems, onSelectItems, theme, id, libraryReturnUrl, }: {
3
+ export default function LibraryMenuItems({ isLoading, libraryItems, onAddToLibrary, onInsertLibraryItems, pendingElements, theme, id, libraryReturnUrl, onSelectItems, selectedItems, }: {
4
4
  isLoading: boolean;
5
5
  libraryItems: LibraryItems;
6
6
  pendingElements: LibraryItem["elements"];
7
7
  onInsertLibraryItems: (libraryItems: LibraryItems) => void;
8
8
  onAddToLibrary: (elements: LibraryItem["elements"]) => void;
9
- selectedItems: LibraryItem["id"][];
10
- onSelectItems: (id: LibraryItem["id"][]) => void;
11
9
  libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
12
- theme: AppState["theme"];
10
+ theme: UIAppState["theme"];
13
11
  id: string;
14
- }) => JSX.Element;
15
- export default LibraryMenuItems;
12
+ selectedItems: LibraryItem["id"][];
13
+ onSelectItems: (id: LibraryItem["id"][]) => void;
14
+ }): JSX.Element;
@@ -0,0 +1,22 @@
1
+ import React, { ReactNode } from "react";
2
+ import { LibraryItem } from "../types";
3
+ import { ExcalidrawElement, NonDeleted } from "../element/types";
4
+ import { SvgCache } from "../hooks/useLibraryItemSvg";
5
+ type LibraryOrPendingItem = (LibraryItem | /* pending library item */ {
6
+ id: null;
7
+ elements: readonly NonDeleted<ExcalidrawElement>[];
8
+ })[];
9
+ interface Props {
10
+ items: LibraryOrPendingItem;
11
+ onClick: (id: LibraryItem["id"] | null) => void;
12
+ onItemSelectToggle: (id: LibraryItem["id"], event: React.MouseEvent) => void;
13
+ onItemDrag: (id: LibraryItem["id"], event: React.DragEvent) => void;
14
+ isItemSelected: (id: LibraryItem["id"] | null) => boolean;
15
+ svgCache: SvgCache;
16
+ itemsRenderedPerBatch: number;
17
+ }
18
+ export declare const LibraryMenuSectionGrid: ({ children, }: {
19
+ children: ReactNode;
20
+ }) => JSX.Element;
21
+ export declare const LibraryMenuSection: React.MemoExoticComponent<({ items, onItemSelectToggle, onItemDrag, isItemSelected, onClick, svgCache, itemsRenderedPerBatch, }: Props) => JSX.Element>;
22
+ export {};
@@ -1,11 +1,15 @@
1
+ /// <reference types="react" />
1
2
  import { LibraryItem } from "../types";
2
3
  import "./LibraryUnit.scss";
3
- export declare const LibraryUnit: ({ id, elements, isPending, onClick, selected, onToggle, onDrag, }: {
4
+ import { SvgCache } from "../hooks/useLibraryItemSvg";
5
+ export declare const LibraryUnit: import("react").MemoExoticComponent<({ id, elements, isPending, onClick, selected, onToggle, onDrag, svgCache, }: {
4
6
  id: LibraryItem["id"] | /** for pending item */ null;
5
7
  elements?: readonly import("../element/types").NonDeleted<import("../element/types").ExcalidrawElement>[] | undefined;
6
8
  isPending?: boolean | undefined;
7
- onClick: () => void;
9
+ onClick: (id: LibraryItem["id"] | null) => void;
8
10
  selected: boolean;
9
11
  onToggle: (id: string, event: React.MouseEvent) => void;
10
12
  onDrag: (id: string, event: React.DragEvent) => void;
11
- }) => JSX.Element;
13
+ svgCache: SvgCache;
14
+ }) => JSX.Element>;
15
+ export declare const EmptyLibraryUnit: () => JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import "./ToolIcon.scss";
2
- declare type LockIconProps = {
2
+ type LockIconProps = {
3
3
  title?: string;
4
4
  name?: string;
5
5
  checked: boolean;
@@ -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
- declare type MobileMenuProps = {
6
- appState: AppState;
5
+ type MobileMenuProps = {
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,5 +1,5 @@
1
1
  import "./ToolIcon.scss";
2
- declare type PenModeIconProps = {
2
+ type PenModeIconProps = {
3
3
  title?: string;
4
4
  name?: string;
5
5
  checked: boolean;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import "./Popover.scss";
3
- declare type Props = {
3
+ type Props = {
4
4
  top?: number;
5
5
  left?: number;
6
6
  children?: React.ReactNode;
@@ -1,10 +1,11 @@
1
1
  import "./TextInput.scss";
2
2
  import "./ProjectName.scss";
3
- declare type Props = {
3
+ type Props = {
4
4
  value: string;
5
5
  onChange: (value: string) => void;
6
6
  label: string;
7
7
  isNameEditable: boolean;
8
+ ignoreFocus?: boolean;
8
9
  };
9
10
  export declare const ProjectName: (props: Props) => JSX.Element;
10
11
  export {};
@@ -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;
@@ -0,0 +1,12 @@
1
+ import "./RadioGroup.scss";
2
+ export type RadioGroupChoice<T> = {
3
+ value: T;
4
+ label: string;
5
+ };
6
+ export type RadioGroupProps<T> = {
7
+ choices: RadioGroupChoice<T>[];
8
+ value: T;
9
+ onChange: (value: T) => void;
10
+ name: string;
11
+ };
12
+ export declare const RadioGroup: <T>({ onChange, value, choices, name, }: RadioGroupProps<T>) => JSX.Element;
@@ -1,11 +1,14 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
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
- }> & {
3
+ /**
4
+ * Flags whether the currently rendered Sidebar is docked or not, for use
5
+ * in upstream components that need to act on this (e.g. LayerUI to shift the
6
+ * UI). We use an atom because of potential host app sidebars (for the default
7
+ * sidebar we could just read from appState.defaultSidebarDockedPreference).
8
+ *
9
+ * Since we can only render one Sidebar at a time, we can use a simple flag.
10
+ */
11
+ export declare const isSidebarDockedAtom: import("jotai").Atom<boolean> & {
9
12
  write: (get: {
10
13
  <Value>(atom: import("jotai").Atom<Value | Promise<Value>>): Value;
11
14
  <Value_1>(atom: import("jotai").Atom<Promise<Value_1>>): Value_1;
@@ -23,51 +26,71 @@ export declare const hostSidebarCountersAtom: import("jotai").Atom<{
23
26
  }, set: {
24
27
  <Value_6, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_6, undefined, Result>): Result;
25
28
  <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;
29
+ }, update: boolean | ((prev: boolean) => boolean)) => void;
30
+ onMount?: (<S extends (update: boolean | ((prev: boolean) => boolean)) => void>(setAtom: S) => void | (() => void)) | undefined;
46
31
  } & {
47
- init: {
48
- rendered: number;
49
- docked: number;
50
- };
32
+ init: boolean;
51
33
  };
52
- export declare const Sidebar: import("react").ForwardRefExoticComponent<{
53
- children: import("react").ReactNode;
54
- onClose?: (() => boolean | void) | undefined;
34
+ export declare const SidebarInner: React.ForwardRefExoticComponent<Pick<{
35
+ name: string;
36
+ children: React.ReactNode;
37
+ onStateChange?: ((state: {
38
+ name: string;
39
+ tab?: string | undefined;
40
+ } | null) => void) | undefined;
55
41
  onDock?: ((docked: boolean) => void) | undefined;
56
42
  docked?: boolean | undefined;
57
- initialDockedState?: boolean | undefined;
58
- dockable?: boolean | undefined;
59
43
  className?: string | undefined;
60
- } & {
61
- /** @private internal */
62
- __isInternal?: boolean | undefined;
63
- } & import("react").RefAttributes<HTMLDivElement>> & {
44
+ __fallback?: boolean | undefined;
45
+ } & Omit<React.RefAttributes<HTMLDivElement>, "onSelect">, "className" | "name" | "children" | "key" | "onDock" | "docked" | "onStateChange" | "__fallback"> & React.RefAttributes<HTMLDivElement>>;
46
+ export declare const Sidebar: React.ForwardRefExoticComponent<{
47
+ name: string;
48
+ children: React.ReactNode;
49
+ onStateChange?: ((state: {
50
+ name: string;
51
+ tab?: string | undefined;
52
+ } | null) => void) | undefined;
53
+ onDock?: ((docked: boolean) => void) | undefined;
54
+ docked?: boolean | undefined;
55
+ className?: string | undefined;
56
+ __fallback?: boolean | undefined;
57
+ } & React.RefAttributes<HTMLDivElement>> & {
64
58
  Header: {
65
- (props: {
66
- children?: import("react").ReactNode;
59
+ ({ children, className, }: {
60
+ children?: React.ReactNode;
67
61
  className?: string | undefined;
68
- } & {
69
- __isFallback?: boolean | undefined;
70
- }): JSX.Element | null;
62
+ }): JSX.Element;
63
+ displayName: string;
64
+ };
65
+ TabTriggers: {
66
+ ({ children, ...rest }: {
67
+ children: React.ReactNode;
68
+ } & Omit<React.RefAttributes<HTMLDivElement>, "onSelect">): JSX.Element;
69
+ displayName: string;
70
+ };
71
+ TabTrigger: {
72
+ ({ children, tab, onSelect, ...rest }: {
73
+ children: React.ReactNode;
74
+ tab: string;
75
+ onSelect?: React.ReactEventHandler<HTMLButtonElement> | undefined;
76
+ } & Omit<React.HTMLAttributes<HTMLButtonElement>, "onSelect">): JSX.Element;
77
+ displayName: string;
78
+ };
79
+ Tabs: {
80
+ ({ children, ...rest }: {
81
+ children: React.ReactNode;
82
+ } & Omit<React.RefAttributes<HTMLDivElement>, "onSelect">): JSX.Element | null;
83
+ displayName: string;
84
+ };
85
+ Tab: {
86
+ ({ tab, children, ...rest }: {
87
+ tab: string;
88
+ children: React.ReactNode;
89
+ } & React.HTMLAttributes<HTMLDivElement>): JSX.Element;
90
+ displayName: string;
91
+ };
92
+ Trigger: {
93
+ ({ name, tab, icon, title, children, onToggle, className, style, }: import("./common").SidebarTriggerProps): JSX.Element;
71
94
  displayName: string;
72
95
  };
73
96
  };
@@ -1,20 +1,7 @@
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
- };
1
+ export declare const SidebarHeader: {
2
+ ({ children, className, }: {
3
+ children?: React.ReactNode;
4
+ className?: string | undefined;
5
+ }): JSX.Element;
6
+ displayName: string;
20
7
  };