@zsviczian/excalidraw 0.15.2-obsidian-2 → 0.15.2-obsidian-4

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 (108) hide show
  1. package/dist/excalidraw.development.js +1022 -158
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/package.json +2 -2
  4. package/types/actions/actionAddToLibrary.d.ts +33 -18
  5. package/types/actions/actionBoundText.d.ts +22 -12
  6. package/types/actions/actionCanvas.d.ts +110 -60
  7. package/types/actions/actionClipboard.d.ts +55 -30
  8. package/types/actions/actionDeleteSelected.d.ts +33 -18
  9. package/types/actions/actionElementLock.d.ts +287 -0
  10. package/types/actions/actionExport.d.ts +100 -55
  11. package/types/actions/actionFinalize.d.ts +22 -12
  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 +11 -6
  15. package/types/actions/actionMenu.d.ts +33 -18
  16. package/types/actions/actionProperties.d.ts +145 -80
  17. package/types/actions/actionStyles.d.ts +11 -6
  18. package/types/actions/actionToggleGridMode.d.ts +11 -6
  19. package/types/actions/actionToggleStats.d.ts +11 -6
  20. package/types/actions/actionToggleViewMode.d.ts +11 -6
  21. package/types/actions/actionToggleZenMode.d.ts +11 -6
  22. package/types/actions/index.d.ts +1 -1
  23. package/types/actions/manager.d.ts +1 -1
  24. package/types/actions/shortcuts.d.ts +1 -1
  25. package/types/actions/types.d.ts +7 -7
  26. package/types/charts.d.ts +2 -2
  27. package/types/clients.d.ts +4 -1
  28. package/types/colors.d.ts +60 -5
  29. package/types/components/ActiveConfirmDialog.d.ts +1 -21
  30. package/types/components/App.d.ts +6 -2
  31. package/types/components/Avatar.d.ts +1 -1
  32. package/types/components/ColorPicker/ColorInput.d.ts +7 -0
  33. package/types/components/ColorPicker/ColorPicker.d.ts +19 -0
  34. package/types/components/ColorPicker/CustomColorList.d.ts +8 -0
  35. package/types/components/ColorPicker/HotkeyLabel.d.ts +8 -0
  36. package/types/components/ColorPicker/Picker.d.ts +18 -0
  37. package/types/components/ColorPicker/PickerColorList.d.ts +10 -0
  38. package/types/components/ColorPicker/PickerHeading.d.ts +5 -0
  39. package/types/components/ColorPicker/ShadeList.d.ts +8 -0
  40. package/types/components/ColorPicker/TopPicks.d.ts +9 -0
  41. package/types/components/ColorPicker/colorPickerUtils.d.ts +21 -0
  42. package/types/components/ColorPicker/keyboardNavHandlers.d.ts +21 -0
  43. package/types/components/ContextMenu.d.ts +3 -3
  44. package/types/components/Dialog.d.ts +2 -4
  45. package/types/components/EyeDropper.d.ts +18 -0
  46. package/types/components/FilledButton.d.ts +16 -0
  47. package/types/components/FixedSideContainer.d.ts +1 -1
  48. package/types/components/HandButton.d.ts +1 -1
  49. package/types/components/HelpButton.d.ts +1 -1
  50. package/types/components/ImageExportDialog.d.ts +7 -12
  51. package/types/components/Island.d.ts +1 -1
  52. package/types/components/JSONExportDialog.d.ts +1 -1
  53. package/types/components/LayerUI.d.ts +3 -2
  54. package/types/components/LibraryMenu.d.ts +3 -23
  55. package/types/components/LibraryMenuControlButtons.d.ts +4 -4
  56. package/types/components/LibraryMenuHeaderContent.d.ts +3 -1
  57. package/types/components/LibraryMenuItems.d.ts +4 -5
  58. package/types/components/LibraryMenuSection.d.ts +22 -0
  59. package/types/components/LibraryUnit.d.ts +7 -3
  60. package/types/components/LockButton.d.ts +1 -1
  61. package/types/components/MobileMenu.d.ts +1 -1
  62. package/types/components/PenModeButton.d.ts +1 -1
  63. package/types/components/Popover.d.ts +1 -1
  64. package/types/components/ProjectName.d.ts +2 -1
  65. package/types/components/RadioGroup.d.ts +12 -0
  66. package/types/components/Sidebar/Sidebar.d.ts +1 -21
  67. package/types/components/Sidebar/common.d.ts +3 -3
  68. package/types/components/Spinner.d.ts +2 -1
  69. package/types/components/Stack.d.ts +4 -3
  70. package/types/components/Switch.d.ts +9 -0
  71. package/types/components/ToolButton.d.ts +3 -3
  72. package/types/components/Tooltip.d.ts +1 -1
  73. package/types/components/icons.d.ts +8 -1
  74. package/types/constants.d.ts +6 -0
  75. package/types/context/tunnels.d.ts +2 -2
  76. package/types/data/encode.d.ts +1 -1
  77. package/types/data/filesystem.d.ts +1 -1
  78. package/types/data/library.d.ts +3 -45
  79. package/types/data/restore.d.ts +2 -2
  80. package/types/data/types.d.ts +1 -1
  81. package/types/element/Hyperlink.d.ts +11 -6
  82. package/types/element/binding.d.ts +2 -2
  83. package/types/element/bounds.d.ts +1 -1
  84. package/types/element/linearElementEditor.d.ts +11 -6
  85. package/types/element/mutateElement.d.ts +1 -1
  86. package/types/element/newElement.d.ts +1 -1
  87. package/types/element/resizeElements.d.ts +1 -0
  88. package/types/element/transformHandles.d.ts +5 -5
  89. package/types/element/types.d.ts +35 -35
  90. package/types/errors.d.ts +1 -1
  91. package/types/ga.d.ts +5 -5
  92. package/types/hooks/useCreatePortalContainer.d.ts +5 -0
  93. package/types/hooks/useLibraryItemSvg.d.ts +11 -0
  94. package/types/hooks/useOutsideClick.d.ts +19 -1
  95. package/types/hooks/useScrollPosition.d.ts +2 -0
  96. package/types/hooks/useTransition.d.ts +2 -0
  97. package/types/i18n.d.ts +2 -2
  98. package/types/jotai.d.ts +16 -104
  99. package/types/keys.d.ts +1 -1
  100. package/types/packages/excalidraw/index.d.ts +1 -1
  101. package/types/packages/utils.d.ts +2 -2
  102. package/types/renderer/easingFunctions.d.ts +1 -1
  103. package/types/renderer/renderElement.d.ts +2 -2
  104. package/types/scene/Scene.d.ts +4 -4
  105. package/types/scene/types.d.ts +4 -4
  106. package/types/types.d.ts +46 -37
  107. package/types/utility-types.d.ts +13 -13
  108. package/types/utils.d.ts +3 -3
@@ -1,4 +1,4 @@
1
- declare type HelpButtonProps = {
1
+ type HelpButtonProps = {
2
2
  name?: string;
3
3
  id?: string;
4
4
  onClick?(): void;
@@ -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 { BinaryFiles, UIAppState } from "../types";
4
- import { ActionManager } from "../actions/manager";
5
- import "./ExportDialog.scss";
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, }: {
6
+ export declare const ImageExportDialog: ({ elements, appState, files, actionManager, onExportImage, onCloseRequest, }: {
9
7
  appState: UIAppState;
10
- setAppState: React.Component<any, UIAppState>["setState"];
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;
@@ -3,7 +3,7 @@ import { NonDeletedExcalidrawElement } from "../element/types";
3
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
9
  appState: UIAppState;
@@ -2,7 +2,7 @@ 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, UIAppState } from "../types";
5
+ import { AppProps, AppState, ExcalidrawProps, BinaryFiles, UIAppState, AppClassProperties } from "../types";
6
6
  import "./LayerUI.scss";
7
7
  import "./Toolbar.scss";
8
8
  interface LayerUIProps {
@@ -23,8 +23,9 @@ interface LayerUIProps {
23
23
  onImageAction: (data: {
24
24
  insertOnCanvasDirectly: boolean;
25
25
  }) => void;
26
+ onExportImage: AppClassProperties["onExportImage"];
26
27
  renderWelcomeScreen: boolean;
27
28
  children?: React.ReactNode;
28
29
  }
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>;
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>;
30
31
  export default _default;
@@ -2,30 +2,10 @@ import React from "react";
2
2
  import Library from "../data/library";
3
3
  import { LibraryItems, LibraryItem, ExcalidrawProps, UIAppState } from "../types";
4
4
  import "./LibraryMenu.scss";
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
- } & {
5
+ export declare const isLibraryMenuOpenAtom: import("jotai").PrimitiveAtom<boolean> & {
26
6
  init: boolean;
27
7
  };
28
- export declare const LibraryMenuContent: ({ onInsertLibraryItems, pendingElements, onAddToLibrary, setAppState, libraryReturnUrl, library, id, appState, selectedItems, onSelectItems, }: {
8
+ export declare const LibraryMenuContent: ({ onInsertLibraryItems, pendingElements, onAddToLibrary, setAppState, libraryReturnUrl, library, id, theme, selectedItems, onSelectItems, }: {
29
9
  pendingElements: LibraryItem["elements"];
30
10
  onInsertLibraryItems: (libraryItems: LibraryItems) => void;
31
11
  onAddToLibrary: () => void;
@@ -33,7 +13,7 @@ export declare const LibraryMenuContent: ({ onInsertLibraryItems, pendingElement
33
13
  libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
34
14
  library: Library;
35
15
  id: string;
36
- appState: UIAppState;
16
+ theme: UIAppState["theme"];
37
17
  selectedItems: LibraryItem["id"][];
38
18
  onSelectItems: (id: LibraryItem["id"][]) => void;
39
19
  }) => JSX.Element;
@@ -1,9 +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;
1
+ import { ExcalidrawProps, UIAppState } from "../types";
2
+ export declare const LibraryMenuControlButtons: ({ libraryReturnUrl, theme, id, style, children, className, }: {
5
3
  libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
6
4
  theme: UIAppState["theme"];
7
5
  id: string;
8
6
  style: React.CSSProperties;
7
+ children?: React.ReactNode;
8
+ className?: string | undefined;
9
9
  }) => JSX.Element;
@@ -9,8 +9,10 @@ export declare const LibraryDropdownMenuButton: React.FC<{
9
9
  resetLibrary: () => void;
10
10
  onSelectItems: (items: LibraryItem["id"][]) => void;
11
11
  appState: UIAppState;
12
+ className?: string;
12
13
  }>;
13
- export declare const LibraryDropdownMenu: ({ selectedItems, onSelectItems, }: {
14
+ export declare const LibraryDropdownMenu: ({ selectedItems, onSelectItems, className, }: {
14
15
  selectedItems: LibraryItem["id"][];
15
16
  onSelectItems: (id: LibraryItem["id"][]) => void;
17
+ className?: string | undefined;
16
18
  }) => JSX.Element;
@@ -1,15 +1,14 @@
1
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
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;
@@ -2,7 +2,7 @@ import React from "react";
2
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 = {
5
+ type MobileMenuProps = {
6
6
  appState: UIAppState;
7
7
  actionManager: ActionManager;
8
8
  renderJSONExportDialog: () => React.ReactNode;
@@ -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 {};
@@ -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;
@@ -8,27 +8,7 @@ import "./Sidebar.scss";
8
8
  *
9
9
  * Since we can only render one Sidebar at a time, we can use a simple flag.
10
10
  */
11
- export declare const isSidebarDockedAtom: import("jotai").Atom<boolean> & {
12
- write: (get: {
13
- <Value>(atom: import("jotai").Atom<Value | Promise<Value>>): Value;
14
- <Value_1>(atom: import("jotai").Atom<Promise<Value_1>>): Value_1;
15
- <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;
16
- } & {
17
- <Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>, options: {
18
- unstable_promise: true;
19
- }): Value_3 | Promise<Value_3>;
20
- <Value_4>(atom: import("jotai").Atom<Promise<Value_4>>, options: {
21
- unstable_promise: true;
22
- }): Value_4 | Promise<Value_4>;
23
- <Value_5>(atom: import("jotai").Atom<Value_5>, options: {
24
- unstable_promise: true;
25
- }): (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>;
26
- }, set: {
27
- <Value_6, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_6, undefined, Result>): Result;
28
- <Value_7, Update, Result_1 extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_7, Update, Result_1>, update: Update): Result_1;
29
- }, update: boolean | ((prev: boolean) => boolean)) => void;
30
- onMount?: (<S extends (update: boolean | ((prev: boolean) => boolean)) => void>(setAtom: S) => void | (() => void)) | undefined;
31
- } & {
11
+ export declare const isSidebarDockedAtom: import("jotai").PrimitiveAtom<boolean> & {
32
12
  init: boolean;
33
13
  };
34
14
  export declare const SidebarInner: React.ForwardRefExoticComponent<Pick<{
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { AppState, SidebarName, SidebarTabName } from "../../types";
3
- export declare type SidebarTriggerProps = {
3
+ export type SidebarTriggerProps = {
4
4
  name: SidebarName;
5
5
  tab?: SidebarTabName;
6
6
  icon?: JSX.Element;
@@ -10,7 +10,7 @@ export declare type SidebarTriggerProps = {
10
10
  onToggle?: (open: boolean) => void;
11
11
  style?: React.CSSProperties;
12
12
  };
13
- export declare type SidebarProps<P = {}> = {
13
+ export type SidebarProps<P = {}> = {
14
14
  name: SidebarName;
15
15
  children: React.ReactNode;
16
16
  /**
@@ -26,7 +26,7 @@ export declare type SidebarProps<P = {}> = {
26
26
  /** @private internal */
27
27
  __fallback?: boolean;
28
28
  } & P;
29
- export declare type SidebarPropsContextValue = Pick<SidebarProps, "onDock" | "docked"> & {
29
+ export type SidebarPropsContextValue = Pick<SidebarProps, "onDock" | "docked"> & {
30
30
  onCloseRequest: () => void;
31
31
  shouldRenderDockButton: boolean;
32
32
  };
@@ -1,6 +1,7 @@
1
1
  import "./Spinner.scss";
2
- declare const Spinner: ({ size, circleWidth, }: {
2
+ declare const Spinner: ({ size, circleWidth, synchronized, }: {
3
3
  size?: string | number | undefined;
4
4
  circleWidth?: number | undefined;
5
+ synchronized?: boolean | undefined;
5
6
  }) => JSX.Element;
6
7
  export default Spinner;
@@ -1,15 +1,16 @@
1
1
  import "./Stack.scss";
2
2
  import React from "react";
3
- declare type StackProps = {
3
+ type StackProps = {
4
4
  children: React.ReactNode;
5
5
  gap?: number;
6
6
  align?: "start" | "center" | "end" | "baseline";
7
7
  justifyContent?: "center" | "space-around" | "space-between";
8
8
  className?: string | boolean;
9
9
  style?: React.CSSProperties;
10
+ ref: React.RefObject<HTMLDivElement>;
10
11
  };
11
12
  declare const _default: {
12
- Row: ({ children, gap, align, justifyContent, className, style, }: StackProps) => JSX.Element;
13
- Col: ({ children, gap, align, justifyContent, className, style, }: StackProps) => JSX.Element;
13
+ Row: React.ForwardRefExoticComponent<Pick<StackProps, "style" | "className" | "children" | "gap" | "justifyContent" | "align"> & React.RefAttributes<HTMLDivElement>>;
14
+ Col: React.ForwardRefExoticComponent<Pick<StackProps, "style" | "className" | "children" | "gap" | "justifyContent" | "align"> & React.RefAttributes<HTMLDivElement>>;
14
15
  };
15
16
  export default _default;
@@ -0,0 +1,9 @@
1
+ import "./Switch.scss";
2
+ export type SwitchProps = {
3
+ name: string;
4
+ checked: boolean;
5
+ title?: string;
6
+ onChange: (value: boolean) => void;
7
+ disabled?: boolean;
8
+ };
9
+ export declare const Switch: ({ title, name, checked, onChange, disabled, }: SwitchProps) => JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import "./ToolIcon.scss";
2
2
  import React from "react";
3
3
  import { PointerType } from "../element/types";
4
- export declare type ToolButtonSize = "small" | "medium";
5
- declare type ToolButtonBaseProps = {
4
+ export type ToolButtonSize = "small" | "medium";
5
+ type ToolButtonBaseProps = {
6
6
  icon?: React.ReactNode;
7
7
  "aria-label": string;
8
8
  "aria-keyshortcuts"?: string;
@@ -20,7 +20,7 @@ declare type ToolButtonBaseProps = {
20
20
  className?: string;
21
21
  isLoading?: boolean;
22
22
  };
23
- declare type ToolButtonProps = (ToolButtonBaseProps & {
23
+ type ToolButtonProps = (ToolButtonBaseProps & {
24
24
  type: "button";
25
25
  children?: React.ReactNode;
26
26
  onClick?(event: React.MouseEvent): void;
@@ -7,7 +7,7 @@ export declare const updateTooltipPosition: (tooltip: HTMLDivElement, item: {
7
7
  width: number;
8
8
  height: number;
9
9
  }, position?: "bottom" | "top") => void;
10
- declare type TooltipProps = {
10
+ type TooltipProps = {
11
11
  children: React.ReactNode;
12
12
  label: string;
13
13
  long?: boolean;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { Theme } from "../element/types";
3
- declare type Opts = {
3
+ type Opts = {
4
4
  width?: number;
5
5
  height?: number;
6
6
  mirror?: true;
@@ -140,4 +140,11 @@ export declare const TextAlignMiddleIcon: React.MemoExoticComponent<({ theme }:
140
140
  export declare const publishIcon: JSX.Element;
141
141
  export declare const eraser: JSX.Element;
142
142
  export declare const handIcon: JSX.Element;
143
+ export declare const downloadIcon: JSX.Element;
144
+ export declare const copyIcon: JSX.Element;
145
+ export declare const helpIcon: JSX.Element;
146
+ export declare const playerPlayIcon: JSX.Element;
147
+ export declare const playerStopFilledIcon: JSX.Element;
148
+ export declare const tablerCheckIcon: JSX.Element;
149
+ export declare const eyeDropperIcon: JSX.Element;
143
150
  export {};
@@ -47,6 +47,7 @@ export declare enum EVENT {
47
47
  GESTURE_START = "gesturestart",
48
48
  GESTURE_CHANGE = "gesturechange",
49
49
  POINTER_MOVE = "pointermove",
50
+ POINTER_DOWN = "pointerdown",
50
51
  POINTER_UP = "pointerup",
51
52
  STATE_CHANGE = "statechange",
52
53
  WHEEL = "wheel",
@@ -113,6 +114,11 @@ export declare const MIME_TYPES: {
113
114
  readonly "excalidraw.png": "image/png";
114
115
  readonly binary: "application/octet-stream";
115
116
  };
117
+ export declare const EXPORT_IMAGE_TYPES: {
118
+ readonly png: "png";
119
+ readonly svg: "svg";
120
+ readonly clipboard: "clipboard";
121
+ };
116
122
  export declare const EXPORT_DATA_TYPES: {
117
123
  readonly excalidraw: "excalidraw";
118
124
  readonly excalidrawClipboard: "excalidraw/clipboard";
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import tunnel from "tunnel-rat";
3
- export declare type Tunnel = ReturnType<typeof tunnel>;
4
- declare type TunnelsContextValue = {
3
+ export type Tunnel = ReturnType<typeof tunnel>;
4
+ type TunnelsContextValue = {
5
5
  MainMenuTunnel: Tunnel;
6
6
  WelcomeScreenMenuHintTunnel: Tunnel;
7
7
  WelcomeScreenToolbarHintTunnel: Tunnel;
@@ -5,7 +5,7 @@ export declare const toByteString: (data: string | Uint8Array | ArrayBuffer) =>
5
5
  */
6
6
  export declare const stringToBase64: (str: string, isByteString?: boolean) => Promise<string>;
7
7
  export declare const base64ToString: (base64: string, isByteString?: boolean) => Promise<string>;
8
- declare type EncodedData = {
8
+ type EncodedData = {
9
9
  encoded: string;
10
10
  encoding: "bstring";
11
11
  /** whether text is compressed (zlib) */
@@ -1,6 +1,6 @@
1
1
  import { FileSystemHandle, supported as nativeFileSystemSupported } from "browser-fs-access";
2
2
  import { MIME_TYPES } from "../constants";
3
- declare type FILE_EXTENSION = Exclude<keyof typeof MIME_TYPES, "binary">;
3
+ type FILE_EXTENSION = Exclude<keyof typeof MIME_TYPES, "binary">;
4
4
  export declare const fileOpen: <M extends boolean | undefined = false>(opts: {
5
5
  extensions?: FILE_EXTENSION[] | undefined;
6
6
  description: string;
@@ -1,55 +1,11 @@
1
1
  import { LibraryItems, ExcalidrawImperativeAPI, LibraryItemsSource } from "../types";
2
2
  import type App from "../components/App";
3
3
  import { ExcalidrawElement } from "../element/types";
4
- export declare const libraryItemsAtom: import("jotai").Atom<{
4
+ export declare const libraryItemsAtom: import("jotai").PrimitiveAtom<{
5
5
  status: "loading" | "loaded";
6
6
  isInitialized: boolean;
7
7
  libraryItems: LibraryItems;
8
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
- status: "loading" | "loaded";
28
- isInitialized: boolean;
29
- libraryItems: LibraryItems;
30
- } | ((prev: {
31
- status: "loading" | "loaded";
32
- isInitialized: boolean;
33
- libraryItems: LibraryItems;
34
- }) => {
35
- status: "loading" | "loaded";
36
- isInitialized: boolean;
37
- libraryItems: LibraryItems;
38
- })) => void;
39
- onMount?: (<S extends (update: {
40
- status: "loading" | "loaded";
41
- isInitialized: boolean;
42
- libraryItems: LibraryItems;
43
- } | ((prev: {
44
- status: "loading" | "loaded";
45
- isInitialized: boolean;
46
- libraryItems: LibraryItems;
47
- }) => {
48
- status: "loading" | "loaded";
49
- isInitialized: boolean;
50
- libraryItems: LibraryItems;
51
- })) => void>(setAtom: S) => void | (() => void)) | undefined;
52
- } & {
53
9
  init: {
54
10
  status: "loading" | "loaded";
55
11
  isInitialized: boolean;
@@ -70,6 +26,8 @@ declare class Library {
70
26
  private updateQueue;
71
27
  private getLastUpdateTask;
72
28
  private notifyListeners;
29
+ /** call on excalidraw instance unmount */
30
+ destroy: () => void;
73
31
  resetLibrary: () => Promise<LibraryItems>;
74
32
  /**
75
33
  * @returns latest cloned libraryItems. Awaits all in-progress updates first.
@@ -1,9 +1,9 @@
1
1
  import { ExcalidrawElement } from "../element/types";
2
2
  import { AppState, BinaryFiles, LibraryItem } from "../types";
3
3
  import { ImportedDataState } from "./types";
4
- declare type RestoredAppState = Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
4
+ type RestoredAppState = Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
5
5
  export declare const AllowedExcalidrawActiveTools: Record<AppState["activeTool"]["type"], boolean>;
6
- export declare type RestoredDataState = {
6
+ export type RestoredDataState = {
7
7
  elements: ExcalidrawElement[];
8
8
  appState: RestoredAppState;
9
9
  files: BinaryFiles;
@@ -17,7 +17,7 @@ export interface ExportedDataState {
17
17
  * This is a helper type used in downstream abstractions.
18
18
  * Don't consume on its own.
19
19
  */
20
- export declare type LegacyAppState = {
20
+ export type LegacyAppState = {
21
21
  /** @deprecated #6213 TODO remove 23-06-01 */
22
22
  isSidebarDocked: [boolean, "defaultSidebarDockedPreference"];
23
23
  };
@@ -75,7 +75,7 @@ export declare const actionLink: {
75
75
  zoom: Readonly<{
76
76
  value: import("../types").NormalizedZoomValue;
77
77
  }>;
78
- openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
78
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
79
79
  openSidebar: {
80
80
  name: string;
81
81
  tab?: string | undefined;
@@ -122,11 +122,16 @@ export declare const actionLink: {
122
122
  pendingImageElementId: string | null;
123
123
  linkOpacity: number;
124
124
  trayModeEnabled: boolean;
125
- colorPalette: {
126
- canvasBackground?: string[] | undefined;
127
- elementBackground?: string[] | undefined;
128
- elementStroke?: string[] | undefined;
129
- };
125
+ colorPalette?: {
126
+ canvasBackground: import("../colors").ColorPaletteCustom;
127
+ elementBackground: import("../colors").ColorPaletteCustom;
128
+ elementStroke: import("../colors").ColorPaletteCustom;
129
+ topPicks: {
130
+ canvasBackground: [string, string, string, string, string];
131
+ elementStroke: [string, string, string, string, string];
132
+ elementBackground: [string, string, string, string, string];
133
+ };
134
+ } | undefined;
130
135
  allowWheelZoom?: boolean | undefined;
131
136
  allowPinchZoom?: boolean | undefined;
132
137
  pinnedScripts?: string[] | undefined;
@@ -1,8 +1,8 @@
1
1
  import { ExcalidrawLinearElement, ExcalidrawBindableElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawElement } from "./types";
2
2
  import { AppState } from "../types";
3
3
  import Scene from "../scene/Scene";
4
- export declare type SuggestedBinding = NonDeleted<ExcalidrawBindableElement> | SuggestedPointBinding;
5
- export declare type SuggestedPointBinding = [
4
+ export type SuggestedBinding = NonDeleted<ExcalidrawBindableElement> | SuggestedPointBinding;
5
+ export type SuggestedPointBinding = [
6
6
  NonDeleted<ExcalidrawLinearElement>,
7
7
  "start" | "end" | "both",
8
8
  NonDeleted<ExcalidrawBindableElement>
@@ -1,6 +1,6 @@
1
1
  import { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead, NonDeleted } from "./types";
2
2
  import { Drawable, Op } from "roughjs/bin/core";
3
- export declare type Bounds = readonly [number, number, number, number];
3
+ export type Bounds = readonly [number, number, number, number];
4
4
  export declare const getElementAbsoluteCoords: (element: ExcalidrawElement, includeBoundText?: boolean) => [number, number, number, number, number, number];
5
5
  export declare const pointRelativeTo: (element: ExcalidrawElement, absoluteCoords: readonly [number, number]) => readonly [number, number];
6
6
  export declare const getDiamondPoints: (element: ExcalidrawElement) => number[];