@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
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { SidebarTabName } from "../../types";
3
+ export declare const SidebarTab: {
4
+ ({ tab, children, ...rest }: {
5
+ tab: SidebarTabName;
6
+ children: React.ReactNode;
7
+ } & import("react").HTMLAttributes<HTMLDivElement>): JSX.Element;
8
+ displayName: string;
9
+ };
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { SidebarTabName } from "../../types";
3
+ export declare const SidebarTabTrigger: {
4
+ ({ children, tab, onSelect, ...rest }: {
5
+ children: React.ReactNode;
6
+ tab: SidebarTabName;
7
+ onSelect?: React.ReactEventHandler<HTMLButtonElement> | undefined;
8
+ } & Omit<import("react").HTMLAttributes<HTMLButtonElement>, "onSelect">): JSX.Element;
9
+ displayName: string;
10
+ };
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare const SidebarTabTriggers: {
3
+ ({ children, ...rest }: {
4
+ children: React.ReactNode;
5
+ } & Omit<import("react").RefAttributes<HTMLDivElement>, "onSelect">): JSX.Element;
6
+ displayName: string;
7
+ };
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare const SidebarTabs: {
3
+ ({ children, ...rest }: {
4
+ children: React.ReactNode;
5
+ } & Omit<import("react").RefAttributes<HTMLDivElement>, "onSelect">): JSX.Element | null;
6
+ displayName: string;
7
+ };
@@ -0,0 +1,6 @@
1
+ import { SidebarTriggerProps } from "./common";
2
+ import "./SidebarTrigger.scss";
3
+ export declare const SidebarTrigger: {
4
+ ({ name, tab, icon, title, children, onToggle, className, style, }: SidebarTriggerProps): JSX.Element;
5
+ displayName: string;
6
+ };
@@ -1,16 +1,33 @@
1
1
  import React from "react";
2
- export declare type SidebarProps<P = {}> = {
2
+ import { AppState, SidebarName, SidebarTabName } from "../../types";
3
+ export type SidebarTriggerProps = {
4
+ name: SidebarName;
5
+ tab?: SidebarTabName;
6
+ icon?: JSX.Element;
7
+ children?: React.ReactNode;
8
+ title?: string;
9
+ className?: string;
10
+ onToggle?: (open: boolean) => void;
11
+ style?: React.CSSProperties;
12
+ };
13
+ export type SidebarProps<P = {}> = {
14
+ name: SidebarName;
3
15
  children: React.ReactNode;
4
16
  /**
5
- * Called on sidebar close (either by user action or by the editor).
17
+ * Called on sidebar open/close or tab change.
18
+ */
19
+ onStateChange?: (state: AppState["openSidebar"]) => void;
20
+ /**
21
+ * supply alongside `docked` prop in order to make the Sidebar user-dockable
6
22
  */
7
- onClose?: () => void | boolean;
8
- /** if not supplied, sidebar won't be dockable */
9
23
  onDock?: (docked: boolean) => void;
10
24
  docked?: boolean;
11
- initialDockedState?: boolean;
12
- dockable?: boolean;
13
25
  className?: string;
26
+ /** @private internal */
27
+ __fallback?: boolean;
14
28
  } & P;
15
- export declare type SidebarPropsContextValue = Pick<SidebarProps, "onClose" | "onDock" | "docked" | "dockable">;
29
+ export type SidebarPropsContextValue = Pick<SidebarProps, "onDock" | "docked"> & {
30
+ onCloseRequest: () => void;
31
+ shouldRenderDockButton: boolean;
32
+ };
16
33
  export declare const SidebarPropsContext: React.Context<SidebarPropsContextValue>;
@@ -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;
@@ -1,10 +1,10 @@
1
1
  import React from "react";
2
2
  import { NonDeletedExcalidrawElement } from "../element/types";
3
- import { AppState, ExcalidrawProps } from "../types";
3
+ import { ExcalidrawProps, UIAppState } from "../types";
4
4
  import "./Stats.scss";
5
5
  export declare const Stats: (props: {
6
- appState: AppState;
7
- setAppState: React.Component<any, AppState>["setState"];
6
+ appState: UIAppState;
7
+ setAppState: React.Component<any, UIAppState>["setState"];
8
8
  elements: readonly NonDeletedExcalidrawElement[];
9
9
  onClose: () => void;
10
10
  renderCustomStats: ExcalidrawProps["renderCustomStats"];
@@ -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;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ declare const Trans: ({ i18nKey, children, ...props }: {
3
+ [key: string]: React.ReactNode | ((el: React.ReactNode) => React.ReactNode);
4
+ i18nKey: string;
5
+ }) => React.FunctionComponentElement<{
6
+ children?: React.ReactNode;
7
+ }>;
8
+ export default Trans;
@@ -1,8 +1,8 @@
1
1
  import { ActionManager } from "../../actions/manager";
2
- import { AppState } from "../../types";
2
+ import { UIAppState } from "../../types";
3
3
  declare const Footer: {
4
4
  ({ appState, actionManager, showExitZenModeBtn, renderWelcomeScreen, }: {
5
- appState: AppState;
5
+ appState: UIAppState;
6
6
  actionManager: ActionManager;
7
7
  showExitZenModeBtn: boolean;
8
8
  renderWelcomeScreen: 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,10 @@ 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;
143
149
  export {};
@@ -113,6 +113,11 @@ export declare const MIME_TYPES: {
113
113
  readonly "excalidraw.png": "image/png";
114
114
  readonly binary: "application/octet-stream";
115
115
  };
116
+ export declare const EXPORT_IMAGE_TYPES: {
117
+ readonly png: "png";
118
+ readonly svg: "svg";
119
+ readonly clipboard: "clipboard";
120
+ };
116
121
  export declare const EXPORT_DATA_TYPES: {
117
122
  readonly excalidraw: "excalidraw";
118
123
  readonly excalidrawClipboard: "excalidraw/clipboard";
@@ -190,3 +195,8 @@ export declare const DEFAULT_ELEMENT_PROPS: {
190
195
  opacity: ExcalidrawElement["opacity"];
191
196
  locked: ExcalidrawElement["locked"];
192
197
  };
198
+ export declare const LIBRARY_SIDEBAR_TAB = "library";
199
+ export declare const DEFAULT_SIDEBAR: {
200
+ readonly name: "default";
201
+ readonly defaultTab: "library";
202
+ };
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import tunnel from "tunnel-rat";
3
+ export type Tunnel = ReturnType<typeof tunnel>;
4
+ type TunnelsContextValue = {
5
+ MainMenuTunnel: Tunnel;
6
+ WelcomeScreenMenuHintTunnel: Tunnel;
7
+ WelcomeScreenToolbarHintTunnel: Tunnel;
8
+ WelcomeScreenHelpHintTunnel: Tunnel;
9
+ WelcomeScreenCenterTunnel: Tunnel;
10
+ FooterCenterTunnel: Tunnel;
11
+ DefaultSidebarTriggerTunnel: Tunnel;
12
+ DefaultSidebarTabTriggersTunnel: Tunnel;
13
+ jotaiScope: symbol;
14
+ };
15
+ export declare const TunnelsContext: React.Context<TunnelsContextValue>;
16
+ export declare const useTunnels: () => TunnelsContextValue;
17
+ export declare const useInitializeTunnels: () => TunnelsContextValue;
18
+ export {};
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { UIAppState } from "../types";
3
+ export declare const UIAppStateContext: React.Context<UIAppState>;
4
+ export declare const useUIAppState: () => UIAppState;
@@ -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;
@@ -70,6 +70,8 @@ declare class Library {
70
70
  private updateQueue;
71
71
  private getLastUpdateTask;
72
72
  private notifyListeners;
73
+ /** call on excalidraw instance unmount */
74
+ destroy: () => void;
73
75
  resetLibrary: () => Promise<LibraryItems>;
74
76
  /**
75
77
  * @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,11 +17,9 @@ 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 = {
21
- /** @deprecated #5663 TODO remove 22-12-15 */
22
- isLibraryOpen: [boolean, "openSidebar"];
23
- /** @deprecated #5663 TODO remove 22-12-15 */
24
- isLibraryMenuDocked: [boolean, "isSidebarDocked"];
20
+ export type LegacyAppState = {
21
+ /** @deprecated #6213 TODO remove 23-06-01 */
22
+ isSidebarDocked: [boolean, "defaultSidebarDockedPreference"];
25
23
  };
26
24
  export interface ImportedDataState {
27
25
  type?: string;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { AppState, ExcalidrawProps } from "../types";
2
+ import { AppState, ExcalidrawProps, UIAppState } from "../types";
3
3
  import { NonDeletedExcalidrawElement } from "./types";
4
4
  import { Bounds } from "./bounds";
5
5
  import "./Hyperlink.scss";
@@ -75,10 +75,13 @@ export declare const actionLink: {
75
75
  zoom: Readonly<{
76
76
  value: import("../types").NormalizedZoomValue;
77
77
  }>;
78
- openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
79
- openSidebar: "library" | "customSidebar" | null;
78
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
79
+ openSidebar: {
80
+ name: string;
81
+ tab?: string | undefined;
82
+ } | null;
80
83
  openDialog: "imageExport" | "help" | "jsonExport" | null;
81
- isSidebarDocked: boolean;
84
+ defaultSidebarDockedPreference: boolean;
82
85
  lastPointerDownWith: import("./types").PointerType;
83
86
  selectedElementIds: {
84
87
  [id: string]: boolean;
@@ -119,11 +122,16 @@ export declare const actionLink: {
119
122
  pendingImageElementId: string | null;
120
123
  linkOpacity: number;
121
124
  trayModeEnabled: boolean;
122
- colorPalette: {
123
- canvasBackground?: string[] | undefined;
124
- elementBackground?: string[] | undefined;
125
- elementStroke?: string[] | undefined;
126
- };
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;
127
135
  allowWheelZoom?: boolean | undefined;
128
136
  allowPinchZoom?: boolean | undefined;
129
137
  pinnedScripts?: string[] | undefined;
@@ -149,7 +157,7 @@ export declare const actionLink: {
149
157
  keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
150
158
  };
151
159
  export declare const getContextMenuLabel: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => "labels.link.edit" | "labels.link.create";
152
- export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState: AppState) => [x: number, y: number, width: number, height: number];
160
+ export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState: UIAppState) => [x: number, y: number, width: number, height: number];
153
161
  export declare const isPointHittingLinkIcon: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number], isMobile: boolean) => boolean;
154
162
  export declare const showHyperlinkTooltip: (element: NonDeletedExcalidrawElement, appState: AppState) => void;
155
163
  export declare const hideHyperlinkToolip: () => void;
@@ -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[];
@@ -180,10 +180,13 @@ export declare class LinearElementEditor {
180
180
  value: import("../types").NormalizedZoomValue;
181
181
  }>;
182
182
  openMenu: "canvas" | "shape" | null;
183
- openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
184
- openSidebar: "library" | "customSidebar" | null;
183
+ openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
184
+ openSidebar: {
185
+ name: string;
186
+ tab?: string | undefined;
187
+ } | null;
185
188
  openDialog: "imageExport" | "help" | "jsonExport" | null;
186
- isSidebarDocked: boolean;
189
+ defaultSidebarDockedPreference: boolean;
187
190
  lastPointerDownWith: import("./types").PointerType;
188
191
  selectedElementIds: {
189
192
  [id: string]: boolean;
@@ -225,11 +228,16 @@ export declare class LinearElementEditor {
225
228
  showHyperlinkPopup: false | "info" | "editor";
226
229
  linkOpacity: number;
227
230
  trayModeEnabled: boolean;
228
- colorPalette: {
229
- canvasBackground?: string[] | undefined;
230
- elementBackground?: string[] | undefined;
231
- elementStroke?: string[] | undefined;
232
- };
231
+ colorPalette?: {
232
+ canvasBackground: import("../colors").ColorPaletteCustom;
233
+ elementBackground: import("../colors").ColorPaletteCustom;
234
+ elementStroke: import("../colors").ColorPaletteCustom;
235
+ topPicks: {
236
+ canvasBackground: [string, string, string, string, string];
237
+ elementStroke: [string, string, string, string, string];
238
+ elementBackground: [string, string, string, string, string];
239
+ };
240
+ } | undefined;
233
241
  allowWheelZoom?: boolean | undefined;
234
242
  allowPinchZoom?: boolean | undefined;
235
243
  pinnedScripts?: string[] | undefined;
@@ -1,6 +1,6 @@
1
1
  import { ExcalidrawElement } from "./types";
2
2
  import { Mutable } from "../utility-types";
3
- declare type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TElement>, "id" | "version" | "versionNonce">;
3
+ type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TElement>, "id" | "version" | "versionNonce">;
4
4
  export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
5
5
  export declare const newElementWith: <TElement extends ExcalidrawElement>(element: TElement, updates: ElementUpdate<TElement>) => TElement;
6
6
  /**
@@ -1,7 +1,7 @@
1
1
  import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer } from "../element/types";
2
2
  import { AppState } from "../types";
3
3
  import { MarkOptional, Mutable } from "../utility-types";
4
- declare type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity">;
4
+ type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity">;
5
5
  export declare const newElement: (opts: {
6
6
  type: ExcalidrawGenericElement["type"];
7
7
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawGenericElement>;
@@ -80,6 +80,11 @@ export declare const duplicateElement: <TElement extends ExcalidrawElement>(edit
80
80
  * it's advised to supply the whole elements array, or sets of elements that
81
81
  * are encapsulated (such as library items), if the purpose is to retain
82
82
  * bindings to the cloned elements intact.
83
+ *
84
+ * NOTE by default does not randomize or regenerate anything except the id.
83
85
  */
84
- export declare const duplicateElements: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
86
+ export declare const duplicateElements: (elements: readonly ExcalidrawElement[], opts?: {
87
+ /** NOTE also updates version flags and `updated` */
88
+ randomizeSeed: boolean;
89
+ }) => ExcalidrawElement[];
85
90
  export {};
@@ -4,5 +4,6 @@ import { PointerDownState } from "../types";
4
4
  export declare const normalizeAngle: (angle: number) => number;
5
5
  export declare const transformElements: (pointerDownState: PointerDownState, transformHandleType: MaybeTransformHandleType, selectedElements: readonly NonDeletedExcalidrawElement[], resizeArrowDirection: "origin" | "end", shouldRotateWithDiscreteAngle: boolean, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number, centerX: number, centerY: number) => boolean;
6
6
  export declare const resizeSingleElement: (originalElements: PointerDownState["originalElements"], shouldMaintainAspectRatio: boolean, element: NonDeletedExcalidrawElement, transformHandleDirection: TransformHandleDirection, shouldResizeFromCenter: boolean, pointerX: number, pointerY: number) => void;
7
+ export declare const resizeMultipleElements: (pointerDownState: PointerDownState, selectedElements: readonly NonDeletedExcalidrawElement[], transformHandleType: "nw" | "ne" | "sw" | "se", shouldResizeFromCenter: boolean, pointerX: number, pointerY: number) => void;
7
8
  export declare const getResizeOffsetXY: (transformHandleType: MaybeTransformHandleType, selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
8
9
  export declare const getResizeArrowDirection: (transformHandleType: MaybeTransformHandleType, element: NonDeleted<ExcalidrawLinearElement>) => "origin" | "end";
@@ -1,3 +1,3 @@
1
- import { AppState } from "../types";
2
1
  import { NonDeletedExcalidrawElement } from "./types";
3
- export declare const showSelectedShapeActions: (appState: AppState, elements: readonly NonDeletedExcalidrawElement[]) => boolean;
2
+ import { UIAppState } from "../types";
3
+ export declare const showSelectedShapeActions: (appState: UIAppState, elements: readonly NonDeletedExcalidrawElement[]) => boolean;
@@ -71,8 +71,8 @@ export declare const getTextBindableContainerAtPosition: (elements: readonly Exc
71
71
  declare const VALID_CONTAINER_TYPES: Set<string>;
72
72
  export declare const isValidTextContainer: (element: ExcalidrawElement) => boolean;
73
73
  export declare const computeContainerDimensionForBoundText: (dimension: number, containerType: ExtractSetType<typeof VALID_CONTAINER_TYPES>, legacy?: boolean) => number;
74
- export declare const getMaxContainerWidth: (container: ExcalidrawElement) => number;
75
- export declare const getMaxContainerHeight: (container: ExcalidrawElement) => number;
74
+ export declare const getBoundTextMaxWidth: (container: ExcalidrawElement) => number;
75
+ export declare const getBoundTextMaxHeight: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer) => number;
76
76
  export declare const isMeasureTextSupported: () => boolean;
77
77
  export declare const getDefaultLineHeight: (fontFamily: FontFamilyValues) => number & {
78
78
  _brand: "unitlessLineHeight";
@@ -1,12 +1,12 @@
1
1
  import { ExcalidrawElement, NonDeletedExcalidrawElement, PointerType } from "./types";
2
2
  import { AppState, Zoom } from "../types";
3
- export declare type TransformHandleDirection = "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se";
4
- export declare type TransformHandleType = TransformHandleDirection | "rotation";
5
- export declare type TransformHandle = [number, number, number, number];
6
- export declare type TransformHandles = Partial<{
3
+ export type TransformHandleDirection = "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se";
4
+ export type TransformHandleType = TransformHandleDirection | "rotation";
5
+ export type TransformHandle = [number, number, number, number];
6
+ export type TransformHandles = Partial<{
7
7
  [T in TransformHandleType]: TransformHandle;
8
8
  }>;
9
- export declare type MaybeTransformHandleType = TransformHandleType | false;
9
+ export type MaybeTransformHandleType = TransformHandleType | false;
10
10
  export declare const OMIT_SIDES_FOR_MULTIPLE_ELEMENTS: {
11
11
  e: boolean;
12
12
  s: boolean;