@excalidraw/math 0.18.0-c141960 → 0.18.0-c158187

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 (171) hide show
  1. package/dist/types/common/src/bounds.d.ts +10 -0
  2. package/dist/types/common/src/colors.d.ts +5 -2
  3. package/dist/types/common/src/constants.d.ts +13 -11
  4. package/dist/types/common/src/font-metadata.d.ts +1 -3
  5. package/dist/types/common/src/index.d.ts +1 -0
  6. package/dist/types/common/src/keys.d.ts +1 -1
  7. package/dist/types/common/src/utility-types.d.ts +0 -1
  8. package/dist/types/common/src/utils.d.ts +43 -33
  9. package/dist/types/common/src/visualdebug.d.ts +1 -1
  10. package/dist/types/element/src/Scene.d.ts +3 -3
  11. package/dist/types/element/src/binding.d.ts +6 -4
  12. package/dist/types/element/src/bounds.d.ts +2 -10
  13. package/dist/types/element/src/collision.d.ts +2 -2
  14. package/dist/types/element/src/comparisons.d.ts +7 -7
  15. package/dist/types/element/src/dragElements.d.ts +3 -3
  16. package/dist/types/element/src/duplicate.d.ts +3 -3
  17. package/dist/types/element/src/fractionalIndex.d.ts +2 -2
  18. package/dist/types/element/src/frame.d.ts +5 -1
  19. package/dist/types/element/src/heading.d.ts +2 -1
  20. package/dist/types/element/src/image.d.ts +1 -11
  21. package/dist/types/element/src/index.d.ts +1 -0
  22. package/dist/types/element/src/linearElementEditor.d.ts +1 -2
  23. package/dist/types/element/src/mutateElement.d.ts +3 -1
  24. package/dist/types/element/src/newElement.d.ts +6 -6
  25. package/dist/types/element/src/renderElement.d.ts +0 -6
  26. package/dist/types/element/src/resizeElements.d.ts +10 -10
  27. package/dist/types/element/src/resizeTest.d.ts +1 -1
  28. package/dist/types/element/src/selection.d.ts +3 -7
  29. package/dist/types/element/src/shape.d.ts +8 -7
  30. package/dist/types/element/src/textMeasurements.d.ts +1 -3
  31. package/dist/types/{excalidraw/data → element/src}/transform.d.ts +3 -3
  32. package/dist/types/element/src/transformHandles.d.ts +3 -23
  33. package/dist/types/element/src/typeChecks.d.ts +2 -4
  34. package/dist/types/element/src/utils.d.ts +3 -1
  35. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +114 -178
  36. package/dist/types/excalidraw/actions/actionAlign.d.ts +0 -1
  37. package/dist/types/excalidraw/actions/actionBoundText.d.ts +44 -87
  38. package/dist/types/excalidraw/actions/actionCanvas.d.ts +263 -510
  39. package/dist/types/excalidraw/actions/actionClipboard.d.ts +85 -128
  40. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +21 -43
  41. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +68 -136
  42. package/dist/types/excalidraw/actions/actionDistribute.d.ts +0 -1
  43. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -3
  44. package/dist/types/excalidraw/actions/actionElementLink.d.ts +41 -63
  45. package/dist/types/excalidraw/actions/actionElementLock.d.ts +45 -88
  46. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +41 -63
  47. package/dist/types/excalidraw/actions/actionExport.d.ts +85 -170
  48. package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -2
  49. package/dist/types/excalidraw/actions/actionFlip.d.ts +0 -1
  50. package/dist/types/excalidraw/actions/actionFrame.d.ts +167 -288
  51. package/dist/types/excalidraw/actions/actionGroup.d.ts +48 -99
  52. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +102 -160
  53. package/dist/types/excalidraw/actions/actionLink.d.ts +43 -65
  54. package/dist/types/excalidraw/actions/actionMenu.d.ts +35 -57
  55. package/dist/types/excalidraw/actions/actionNavigate.d.ts +14 -17
  56. package/dist/types/excalidraw/actions/actionProperties.d.ts +59 -102
  57. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +24 -50
  58. package/dist/types/excalidraw/actions/actionStyles.d.ts +20 -42
  59. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
  60. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +41 -63
  61. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +41 -63
  62. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +35 -57
  63. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +40 -62
  64. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +41 -63
  65. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +41 -63
  66. package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -9
  67. package/dist/types/excalidraw/actions/manager.d.ts +1 -1
  68. package/dist/types/excalidraw/actions/register.d.ts +2 -2
  69. package/dist/types/excalidraw/appState.d.ts +12 -12
  70. package/dist/types/excalidraw/clipboard.d.ts +7 -31
  71. package/dist/types/excalidraw/components/Actions.d.ts +1 -1
  72. package/dist/types/excalidraw/components/App.d.ts +33 -41
  73. package/dist/types/excalidraw/components/Card.d.ts +0 -1
  74. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +7 -4
  75. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +0 -1
  76. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +0 -1
  77. package/dist/types/excalidraw/components/CommandPalette/types.d.ts +0 -1
  78. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -2
  79. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
  80. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +9 -13
  81. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +1 -1
  82. package/dist/types/excalidraw/components/Ellipsify.d.ts +1 -2
  83. package/dist/types/excalidraw/components/ErrorDialog.d.ts +1 -1
  84. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -1
  85. package/dist/types/excalidraw/components/EyeDropper.d.ts +0 -1
  86. package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +0 -1
  87. package/dist/types/excalidraw/components/HelpDialog.d.ts +1 -1
  88. package/dist/types/excalidraw/components/InlineIcon.d.ts +2 -2
  89. package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -1
  90. package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -2
  91. package/dist/types/excalidraw/components/LibraryUnit.d.ts +2 -3
  92. package/dist/types/excalidraw/components/LoadingMessage.d.ts +0 -1
  93. package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -1
  94. package/dist/types/excalidraw/components/Modal.d.ts +0 -1
  95. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +1 -1
  96. package/dist/types/excalidraw/components/RadioGroup.d.ts +0 -1
  97. package/dist/types/excalidraw/components/RadioSelection.d.ts +4 -4
  98. package/dist/types/excalidraw/components/ScrollableList.d.ts +0 -1
  99. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +15 -21
  100. package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +1 -1
  101. package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -2
  102. package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -2
  103. package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +1 -2
  104. package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +1 -2
  105. package/dist/types/excalidraw/components/Spinner.d.ts +4 -4
  106. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +0 -1
  107. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +0 -1
  108. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +0 -1
  109. package/dist/types/excalidraw/components/Stats/index.d.ts +7 -8
  110. package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +1 -2
  111. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +0 -1
  112. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +1 -2
  113. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +1 -2
  114. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +1 -2
  115. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -1
  116. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +2 -3
  117. package/dist/types/excalidraw/components/Toast.d.ts +3 -3
  118. package/dist/types/excalidraw/components/Trans.d.ts +2 -2
  119. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +28 -32
  120. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +5 -5
  121. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +3 -3
  122. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +10 -18
  123. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +3 -3
  124. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +0 -1
  125. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -2
  126. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +6 -6
  127. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +3 -4
  128. package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +1 -1
  129. package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +1 -1
  130. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +1 -1
  131. package/dist/types/excalidraw/components/icons.d.ts +11 -11
  132. package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +2 -13
  133. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +2 -2
  134. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +26 -28
  135. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +6 -6
  136. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +15 -16
  137. package/dist/types/excalidraw/data/blob.d.ts +321 -3
  138. package/dist/types/excalidraw/data/encode.d.ts +4 -4
  139. package/dist/types/excalidraw/data/encryption.d.ts +5 -5
  140. package/dist/types/excalidraw/data/filesystem.d.ts +2 -2
  141. package/dist/types/excalidraw/data/index.d.ts +3 -3
  142. package/dist/types/excalidraw/data/json.d.ts +159 -2
  143. package/dist/types/excalidraw/data/library.d.ts +24 -9
  144. package/dist/types/excalidraw/data/restore.d.ts +25 -10
  145. package/dist/types/excalidraw/editor-jotai.d.ts +11 -11
  146. package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +1 -2
  147. package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -2
  148. package/dist/types/excalidraw/i18n.d.ts +2 -2
  149. package/dist/types/excalidraw/index.d.ts +2 -4
  150. package/dist/types/excalidraw/renderer/helpers.d.ts +6 -4
  151. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +8 -6
  152. package/dist/types/excalidraw/scene/Renderer.d.ts +5 -2
  153. package/dist/types/excalidraw/scene/export.d.ts +2 -2
  154. package/dist/types/excalidraw/scene/scroll.d.ts +1 -6
  155. package/dist/types/excalidraw/scene/types.d.ts +7 -2
  156. package/dist/types/excalidraw/snapping.d.ts +5 -5
  157. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +1 -1
  158. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +1 -1
  159. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +1 -1
  160. package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +2 -2
  161. package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +1 -1
  162. package/dist/types/excalidraw/types.d.ts +1 -1
  163. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +2 -2
  164. package/dist/types/math/src/polygon.d.ts +2 -2
  165. package/dist/types/math/src/range.d.ts +1 -3
  166. package/dist/types/math/src/segment.d.ts +3 -3
  167. package/dist/types/utils/src/bbox.d.ts +1 -1
  168. package/dist/types/utils/src/export.d.ts +5 -5
  169. package/dist/types/utils/src/shape.d.ts +6 -6
  170. package/dist/types/utils/src/withinBounds.d.ts +2 -2
  171. package/package.json +2 -2
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const actionSendBackward: {
3
2
  name: "sendBackward";
4
3
  label: string;
@@ -7,8 +6,8 @@ export declare const actionSendBackward: {
7
6
  trackEvent: {
8
7
  category: "element";
9
8
  };
10
- perform: (elements: readonly import("../../element/src/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>, value: unknown, app: import("../types").AppClassProperties) => {
11
- elements: readonly import("../../element/src/types").ExcalidrawElement[];
9
+ perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>, value: unknown, app: import("../types").AppClassProperties) => {
10
+ elements: readonly import("@excalidraw/element/types").ExcalidrawElement[];
12
11
  appState: Readonly<import("../types").AppState>;
13
12
  captureUpdate: "IMMEDIATELY";
14
13
  };
@@ -26,8 +25,8 @@ export declare const actionBringForward: {
26
25
  trackEvent: {
27
26
  category: "element";
28
27
  };
29
- perform: (elements: readonly import("../../element/src/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>, value: unknown, app: import("../types").AppClassProperties) => {
30
- elements: readonly import("../../element/src/types").ExcalidrawElement[];
28
+ perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>, value: unknown, app: import("../types").AppClassProperties) => {
29
+ elements: readonly import("@excalidraw/element/types").ExcalidrawElement[];
31
30
  appState: Readonly<import("../types").AppState>;
32
31
  captureUpdate: "IMMEDIATELY";
33
32
  };
@@ -45,8 +44,8 @@ export declare const actionSendToBack: {
45
44
  trackEvent: {
46
45
  category: "element";
47
46
  };
48
- perform: (elements: readonly import("../../element/src/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
49
- elements: readonly import("../../element/src/types").ExcalidrawElement[] | import("../../element/src/types").ExcalidrawElement[];
47
+ perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
48
+ elements: readonly import("@excalidraw/element/types").ExcalidrawElement[] | import("@excalidraw/element/types").ExcalidrawElement[];
50
49
  appState: Readonly<import("../types").AppState>;
51
50
  captureUpdate: "IMMEDIATELY";
52
51
  };
@@ -63,8 +62,8 @@ export declare const actionBringToFront: {
63
62
  trackEvent: {
64
63
  category: "element";
65
64
  };
66
- perform: (elements: readonly import("../../element/src/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
67
- elements: readonly import("../../element/src/types").ExcalidrawElement[] | import("../../element/src/types").ExcalidrawElement[];
65
+ perform: (elements: readonly import("@excalidraw/element/types").OrderedExcalidrawElement[], appState: Readonly<import("../types").AppState>) => {
66
+ elements: readonly import("@excalidraw/element/types").ExcalidrawElement[] | import("@excalidraw/element/types").ExcalidrawElement[];
68
67
  appState: Readonly<import("../types").AppState>;
69
68
  captureUpdate: "IMMEDIATELY";
70
69
  };
@@ -3,7 +3,7 @@ import type { OrderedExcalidrawElement } from "@excalidraw/element/types";
3
3
  import type { AppClassProperties, AppState } from "../types";
4
4
  import type { Action, UpdaterFn, ActionName, ActionResult, PanelComponentProps, ActionSource } from "./types";
5
5
  export declare class ActionManager {
6
- actions: Record<ActionName, Action<any>>;
6
+ actions: Record<ActionName, Action>;
7
7
  updater: (actionResult: ActionResult | Promise<ActionResult>) => void;
8
8
  getAppState: () => Readonly<AppState>;
9
9
  getElementsIncludingDeleted: () => readonly OrderedExcalidrawElement[];
@@ -1,5 +1,5 @@
1
1
  import type { Action } from "./types";
2
2
  export declare let actions: readonly Action[];
3
- export declare const register: <TData extends unknown, T extends Action<TData> = Action<TData>>(action: T) => T & {
4
- keyTest?: (unknown extends T["keyTest"] ? never : T["keyTest"]) | undefined;
3
+ export declare const register: <TData extends any, T extends Action<TData> = Action<TData>>(action: T) => T & {
4
+ keyTest?: unknown extends T["keyTest"] ? never : T["keyTest"];
5
5
  };
@@ -2,6 +2,7 @@ import type { AppState, NormalizedZoomValue } from "./types";
2
2
  export declare const getDefaultAppState: () => Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
3
3
  export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>) => {
4
4
  viewBackgroundColor?: string | undefined;
5
+ theme?: import("@excalidraw/element/types").Theme | undefined;
5
6
  name?: string | null | undefined;
6
7
  zoom?: Readonly<{
7
8
  value: NormalizedZoomValue;
@@ -12,15 +13,14 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
12
13
  selectedElementIds?: Readonly<{
13
14
  [id: string]: true;
14
15
  }> | undefined;
15
- theme?: import("../element/src/types").Theme | undefined;
16
16
  selectedGroupIds?: {
17
17
  [groupId: string]: boolean;
18
18
  } | undefined;
19
- selectedLinearElement?: import("../element/src").LinearElementEditor | null | undefined;
19
+ selectedLinearElement?: import("@excalidraw/element").LinearElementEditor | null | undefined;
20
20
  zenModeEnabled?: boolean | undefined;
21
21
  shouldCacheIgnoreZoom?: boolean | undefined;
22
22
  exportScale?: number | undefined;
23
- bindMode?: import("../element/src/types").BindMode | undefined;
23
+ bindMode?: import("@excalidraw/element/types").BindMode | undefined;
24
24
  gridSize?: number | undefined;
25
25
  showWelcomeScreen?: boolean | undefined;
26
26
  activeTool?: ({
@@ -39,27 +39,27 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
39
39
  exportWithDarkMode?: boolean | undefined;
40
40
  currentItemStrokeColor?: string | undefined;
41
41
  currentItemBackgroundColor?: string | undefined;
42
- currentItemFillStyle?: import("../element/src/types").FillStyle | undefined;
42
+ currentItemFillStyle?: import("@excalidraw/element/types").FillStyle | undefined;
43
43
  currentItemStrokeWidth?: number | undefined;
44
- currentItemStrokeStyle?: import("../element/src/types").StrokeStyle | undefined;
44
+ currentItemStrokeStyle?: import("@excalidraw/element/types").StrokeStyle | undefined;
45
45
  currentItemRoughness?: number | undefined;
46
46
  currentItemOpacity?: number | undefined;
47
47
  currentItemFontFamily?: number | undefined;
48
48
  currentItemFontSize?: number | undefined;
49
49
  currentItemTextAlign?: string | undefined;
50
- currentItemStartArrowhead?: import("../element/src/types").Arrowhead | null | undefined;
51
- currentItemEndArrowhead?: import("../element/src/types").Arrowhead | null | undefined;
52
- currentItemRoundness?: import("../element/src/types").StrokeRoundness | undefined;
50
+ currentItemStartArrowhead?: import("@excalidraw/element/types").Arrowhead | null | undefined;
51
+ currentItemEndArrowhead?: import("@excalidraw/element/types").Arrowhead | null | undefined;
52
+ currentItemRoundness?: import("@excalidraw/element/types").StrokeRoundness | undefined;
53
53
  currentItemArrowType?: "round" | "sharp" | "elbow" | undefined;
54
54
  cursorButton?: "up" | "down" | undefined;
55
55
  scrolledOutside?: boolean | undefined;
56
56
  openMenu?: "canvas" | null | undefined;
57
57
  openSidebar?: {
58
- name: string;
59
- tab?: string | undefined;
58
+ name: import("./types").SidebarName;
59
+ tab?: import("./types").SidebarTabName;
60
60
  } | null | undefined;
61
61
  defaultSidebarDockedPreference?: boolean | undefined;
62
- lastPointerDownWith?: import("../element/src/types").PointerType | undefined;
62
+ lastPointerDownWith?: import("@excalidraw/element/types").PointerType | undefined;
63
63
  previousSelectedElementIds?: {
64
64
  [id: string]: true;
65
65
  } | undefined;
@@ -69,7 +69,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
69
69
  open: boolean;
70
70
  panels: number;
71
71
  } | undefined;
72
- currentChartType?: import("../element/src/types").ChartType | undefined;
72
+ currentChartType?: import("@excalidraw/element/types").ChartType | undefined;
73
73
  objectsSnapModeEnabled?: boolean | undefined;
74
74
  lockedMultiSelections?: {
75
75
  [groupId: string]: true;
@@ -23,26 +23,16 @@ export declare const probablySupportsClipboardReadText: boolean;
23
23
  export declare const probablySupportsClipboardWriteText: boolean;
24
24
  export declare const probablySupportsClipboardBlob: boolean;
25
25
  export declare const createPasteEvent: ({ types, files, }: {
26
- types?: {
27
- "text/plain"?: string | File | undefined;
28
- "text/html"?: string | File | undefined;
29
- "image/svg+xml"?: string | File | undefined;
30
- "image/png"?: string | File | undefined;
31
- "image/jpeg"?: string | File | undefined;
32
- "image/gif"?: string | File | undefined;
33
- "image/webp"?: string | File | undefined;
34
- "image/bmp"?: string | File | undefined;
35
- "image/x-icon"?: string | File | undefined;
36
- "image/avif"?: string | File | undefined;
37
- "image/jfif"?: string | File | undefined;
38
- } | undefined;
39
- files?: File[] | undefined;
26
+ types?: { [key in AllowedPasteMimeTypes]?: string | File; };
27
+ files?: File[];
40
28
  }) => ClipboardEvent;
41
29
  export declare const serializeAsClipboardJSON: ({ elements, files, }: {
42
30
  elements: readonly NonDeletedExcalidrawElement[];
43
31
  files: BinaryFiles | null;
44
32
  }) => string;
45
- export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], files: BinaryFiles | null, clipboardEvent?: ClipboardEvent | null) => Promise<void>;
33
+ export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], files: BinaryFiles | null,
34
+ /** supply if available to make the operation more certain to succeed */
35
+ clipboardEvent?: ClipboardEvent | null) => Promise<void>;
46
36
  /**
47
37
  * Reads OS clipboard programmatically. May not work on all browsers.
48
38
  * Will prompt user for permission if not granted.
@@ -101,22 +91,8 @@ type ParsedDataTranferList = ParsedDataTransferItem[] & {
101
91
  getData: typeof getDataTransferItemData;
102
92
  getFiles: typeof getDataTransferFiles;
103
93
  };
104
- declare const findDataTransferItemType: <T extends ValueOf<{
105
- readonly text: "text/plain";
106
- readonly html: "text/html";
107
- readonly json: "application/json";
108
- readonly excalidraw: "application/vnd.excalidraw+json";
109
- readonly excalidrawlib: "application/vnd.excalidrawlib+json";
110
- readonly excalidrawlibIds: "application/vnd.excalidrawlib.ids+json";
111
- }>>(this: ParsedDataTranferList, type: T) => ParsedDataTransferItemType<T> | null;
112
- declare const getDataTransferItemData: <T extends ValueOf<{
113
- readonly text: "text/plain";
114
- readonly html: "text/html";
115
- readonly json: "application/json";
116
- readonly excalidraw: "application/vnd.excalidraw+json";
117
- readonly excalidrawlib: "application/vnd.excalidrawlib+json";
118
- readonly excalidrawlibIds: "application/vnd.excalidrawlib.ids+json";
119
- }>>(this: ParsedDataTranferList, type: T) => ParsedDataTransferItemType<ValueOf<typeof STRING_MIME_TYPES>>["value"] | null;
94
+ declare const findDataTransferItemType: <T extends ValueOf<typeof STRING_MIME_TYPES>>(this: ParsedDataTranferList, type: T) => ParsedDataTransferItemType<T> | null;
95
+ declare const getDataTransferItemData: <T extends ValueOf<typeof STRING_MIME_TYPES>>(this: ParsedDataTranferList, type: T) => ParsedDataTransferItemType<ValueOf<typeof STRING_MIME_TYPES>>["value"] | null;
120
96
  declare const getDataTransferFiles: (this: ParsedDataTranferList) => ParsedDataTransferFile[];
121
97
  export declare const parseDataTransferEvent: (event: ClipboardEvent | DragEvent | React.DragEvent<HTMLDivElement>) => Promise<ParsedDataTranferList>;
122
98
  /**
@@ -36,7 +36,7 @@ export declare const ZoomActions: ({ renderAction, zoom, }: {
36
36
  }) => import("react/jsx-runtime").JSX.Element;
37
37
  export declare const UndoRedoActions: ({ renderAction, className, }: {
38
38
  renderAction: ActionManager["renderAction"];
39
- className?: string | undefined;
39
+ className?: string;
40
40
  }) => import("react/jsx-runtime").JSX.Element;
41
41
  export declare const ExitZenModeButton: ({ actionManager, showExitZenModeBtn, }: {
42
42
  actionManager: ActionManager;
@@ -10,6 +10,7 @@ import { Fonts } from "../fonts";
10
10
  import { type WritableAtom } from "../editor-jotai";
11
11
  import { Renderer } from "../scene/Renderer";
12
12
  import { LaserTrails } from "../laser-trails";
13
+ import { isOverScrollBars } from "../scene/scrollbars";
13
14
  import { LassoTrail } from "../lasso";
14
15
  import { EraserTrail } from "../eraser";
15
16
  import type { ExportedElements } from "../data";
@@ -28,7 +29,7 @@ export declare const useEditorInterface: () => Readonly<{
28
29
  desktopUIMode: "compact" | "full";
29
30
  userAgent: Readonly<{
30
31
  isMobileDevice: boolean;
31
- platform: "other" | "ios" | "android" | "unknown";
32
+ platform: "ios" | "android" | "other" | "unknown";
32
33
  }>;
33
34
  isTouchScreen: boolean;
34
35
  canFitSidebar: boolean;
@@ -114,11 +115,7 @@ declare class App extends React.Component<AppProps, AppState> {
114
115
  x: number;
115
116
  y: number;
116
117
  }>;
117
- scrollbars: {
118
- isOverEither: boolean;
119
- isOverHorizontal: boolean;
120
- isOverVertical: boolean;
121
- };
118
+ scrollbars: ReturnType<typeof isOverScrollBars>;
122
119
  lastCoords: {
123
120
  x: number;
124
121
  y: number;
@@ -131,7 +128,7 @@ declare class App extends React.Component<AppProps, AppState> {
131
128
  x: number;
132
129
  y: number;
133
130
  };
134
- arrowDirection: "end" | "origin";
131
+ arrowDirection: "origin" | "end";
135
132
  center: {
136
133
  x: number;
137
134
  y: number;
@@ -158,14 +155,10 @@ declare class App extends React.Component<AppProps, AppState> {
158
155
  blockDragging: boolean;
159
156
  };
160
157
  eventListeners: {
161
- onMove: {
162
- (...args: any[]): void;
163
- flush(): void;
164
- cancel(): void;
165
- } | null;
166
- onUp: ((event: PointerEvent) => void) | null;
167
- onKeyDown: ((event: KeyboardEvent) => void) | null;
168
- onKeyUp: ((event: KeyboardEvent) => void) | null;
158
+ onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
159
+ onUp: null | ((event: PointerEvent) => void);
160
+ onKeyDown: null | ((event: KeyboardEvent) => void);
161
+ onKeyUp: null | ((event: KeyboardEvent) => void);
169
162
  };
170
163
  boxSelection: {
171
164
  hasOccurred: boolean;
@@ -184,11 +177,7 @@ declare class App extends React.Component<AppProps, AppState> {
184
177
  x: number;
185
178
  y: number;
186
179
  }>;
187
- scrollbars: {
188
- isOverEither: boolean;
189
- isOverHorizontal: boolean;
190
- isOverVertical: boolean;
191
- };
180
+ scrollbars: ReturnType<typeof isOverScrollBars>;
192
181
  lastCoords: {
193
182
  x: number;
194
183
  y: number;
@@ -201,7 +190,7 @@ declare class App extends React.Component<AppProps, AppState> {
201
190
  x: number;
202
191
  y: number;
203
192
  };
204
- arrowDirection: "end" | "origin";
193
+ arrowDirection: "origin" | "end";
205
194
  center: {
206
195
  x: number;
207
196
  y: number;
@@ -228,14 +217,10 @@ declare class App extends React.Component<AppProps, AppState> {
228
217
  blockDragging: boolean;
229
218
  };
230
219
  eventListeners: {
231
- onMove: {
232
- (...args: any[]): void;
233
- flush(): void;
234
- cancel(): void;
235
- } | null;
236
- onUp: ((event: PointerEvent) => void) | null;
237
- onKeyDown: ((event: KeyboardEvent) => void) | null;
238
- onKeyUp: ((event: KeyboardEvent) => void) | null;
220
+ onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
221
+ onUp: null | ((event: PointerEvent) => void);
222
+ onKeyDown: null | ((event: KeyboardEvent) => void);
223
+ onKeyUp: null | ((event: KeyboardEvent) => void);
239
224
  };
240
225
  boxSelection: {
241
226
  hasOccurred: boolean;
@@ -274,7 +259,7 @@ declare class App extends React.Component<AppProps, AppState> {
274
259
  render(): import("react/jsx-runtime").JSX.Element;
275
260
  focusContainer: AppClassProperties["focusContainer"];
276
261
  getSceneElementsIncludingDeleted: () => readonly import("@excalidraw/element/types").OrderedExcalidrawElement[];
277
- getSceneElementsMapIncludingDeleted: () => Map<string, Ordered<ExcalidrawElement>> & import("@excalidraw/common/utility-types").MakeBrand<"SceneElementsMap">;
262
+ getSceneElementsMapIncludingDeleted: () => SceneElementsMap;
278
263
  getSceneElements: () => readonly Ordered<NonDeletedExcalidrawElement>[];
279
264
  onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
280
265
  onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
@@ -343,20 +328,27 @@ declare class App extends React.Component<AppProps, AppState> {
343
328
  setAppState: React.Component<any, AppState>["setState"];
344
329
  removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
345
330
  toggleLock: (source?: "keyboard" | "ui") => void;
346
- updateFrameRendering: (opts: Partial<{
347
- enabled: boolean;
348
- name: boolean;
349
- outline: boolean;
350
- clip: boolean;
351
- }> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
331
+ updateFrameRendering: (opts: Partial<AppState["frameRendering"]> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
352
332
  togglePenMode: (force: boolean | null) => void;
353
333
  onHandToolToggle: () => void;
354
334
  /**
355
335
  * Zooms on canvas viewport center
356
336
  */
357
- zoomCanvas: (value: number) => void;
337
+ zoomCanvas: (
338
+ /**
339
+ * Decimal fraction, auto-clamped between MIN_ZOOM and MAX_ZOOM.
340
+ * 1 = 100% zoom, 2 = 200% zoom, 0.5 = 50% zoom
341
+ */
342
+ value: number) => void;
358
343
  private cancelInProgressAnimation;
359
- scrollToContent: (target?: string | ExcalidrawElement | readonly ExcalidrawElement[], opts?: ({
344
+ scrollToContent: (
345
+ /**
346
+ * target to scroll to
347
+ *
348
+ * - string - id of element or group, or url containing elementLink
349
+ * - ExcalidrawElement | ExcalidrawElement[] - element(s) objects
350
+ */
351
+ target?: string | ExcalidrawElement | readonly ExcalidrawElement[], opts?: ({
360
352
  fitToContent?: boolean;
361
353
  fitToViewport?: never;
362
354
  viewportZoomFactor?: number;
@@ -393,7 +385,7 @@ declare class App extends React.Component<AppProps, AppState> {
393
385
  private addMissingFiles;
394
386
  updateScene: <K extends keyof AppState>(sceneData: {
395
387
  elements?: SceneData["elements"];
396
- appState?: Pick<AppState, K> | null | undefined;
388
+ appState?: Pick<AppState, K> | null;
397
389
  collaborators?: SceneData["collaborators"];
398
390
  /**
399
391
  * Controls which updates should be captured by the `Store`. Captured updates are emmitted and listened to by other components, such as `History` for undo / redo purposes.
@@ -416,8 +408,8 @@ declare class App extends React.Component<AppProps, AppState> {
416
408
  */
417
409
  toggleSidebar: ({ name, tab, force, }: {
418
410
  name: SidebarName | null;
419
- tab?: string | undefined;
420
- force?: boolean | undefined;
411
+ tab?: SidebarTabName;
412
+ force?: boolean;
421
413
  }) => boolean;
422
414
  private updateCurrentCursorPosition;
423
415
  getEditorUIOffsets: () => Offsets;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import OpenColor from "open-color";
3
2
  import "./Card.scss";
4
3
  export declare const Card: React.FC<{
@@ -1,10 +1,13 @@
1
1
  import type { ColorPickerType } from "./colorPickerUtils";
2
- interface ColorInputProps {
2
+ /**
3
+ * tries to keep the input color as-is if it's valid, making minimal adjustments
4
+ * (trimming whitespace or adding `#` to hex colors)
5
+ */
6
+ export declare const normalizeInputColor: (color: string) => string | null;
7
+ export declare const ColorInput: ({ color, onChange, label, colorPickerType, placeholder, }: {
3
8
  color: string;
4
9
  onChange: (color: string) => void;
5
10
  label: string;
6
11
  colorPickerType: ColorPickerType;
7
12
  placeholder?: string;
8
- }
9
- export declare const ColorInput: ({ color, onChange, label, colorPickerType, placeholder, }: ColorInputProps) => import("react/jsx-runtime").JSX.Element;
10
- export {};
13
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -3,7 +3,6 @@ import type { ExcalidrawElement } from "@excalidraw/element/types";
3
3
  import "./ColorPicker.scss";
4
4
  import type { ColorPickerType } from "./colorPickerUtils";
5
5
  import type { AppState } from "../../types";
6
- export declare const getColor: (color: string) => string | null;
7
6
  interface ColorPickerProps {
8
7
  type: ColorPickerType;
9
8
  /**
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { ColorPaletteCustom } from "@excalidraw/common";
3
2
  import type { ActiveColorPickerSectionAtomType } from "./colorPickerUtils";
4
3
  interface ColorPickerKeyNavHandlerProps {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { ActionManager } from "../../actions/manager";
3
2
  import type { Action } from "../../actions/types";
4
3
  export type CommandPaletteItem = {
@@ -16,8 +16,8 @@ export declare const adjustBoundTextSize: (container: ExcalidrawTextContainer, b
16
16
  type ConversionType = "generic" | "linear" | null;
17
17
  export declare const convertElementTypes: (app: App, { conversionType, nextType, direction, }: {
18
18
  conversionType: ConversionType;
19
- nextType?: ConvertibleTypes | undefined;
20
- direction?: "left" | "right" | undefined;
19
+ nextType?: ConvertibleTypes;
20
+ direction?: "left" | "right";
21
21
  }) => boolean;
22
22
  export declare const getConversionTypeFromElements: (elements: ExcalidrawElement[]) => ConversionType;
23
23
  export default ConvertElementTypePopup;
@@ -3,5 +3,5 @@ import "./ToolIcon.scss";
3
3
  export declare const DarkModeToggle: (props: {
4
4
  value: Theme;
5
5
  onChange: (value: Theme) => void;
6
- title?: string | undefined;
6
+ title?: string;
7
7
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,26 +1,22 @@
1
- /// <reference types="react" />
2
1
  import type { MarkOptional } from "@excalidraw/common/utility-types";
3
2
  import "../components/dropdownMenu/DropdownMenu.scss";
4
3
  import type { SidebarProps, SidebarTriggerProps } from "./Sidebar/common";
5
4
  export declare const DefaultSidebar: import("react").FC<Omit<MarkOptional<Omit<{
6
- name: string;
7
- children: import("react").ReactNode;
8
- onStateChange?: ((state: {
9
- name: string;
10
- tab?: string | undefined;
11
- } | null) => void) | undefined;
12
- onDock?: ((docked: boolean) => void) | undefined;
13
- docked?: boolean | undefined;
14
- className?: string | undefined;
15
- __fallback?: boolean | undefined;
5
+ name: import("../types").SidebarName;
6
+ children: React.ReactNode;
7
+ onStateChange?: (state: import("../types").AppState["openSidebar"]) => void;
8
+ onDock?: (docked: boolean) => void;
9
+ docked?: boolean;
10
+ className?: string;
11
+ __fallback?: boolean;
16
12
  }, "name">, "children">, "onDock"> & {
17
13
  /** pass `false` to disable docking */
18
14
  onDock?: SidebarProps["onDock"] | false;
19
15
  } & {
20
- __fallback?: boolean | undefined;
16
+ __fallback?: boolean;
21
17
  }> & {
22
18
  Trigger: import("react").FC<Omit<SidebarTriggerProps, "name"> & import("react").HTMLAttributes<HTMLDivElement> & {
23
- __fallback?: boolean | undefined;
19
+ __fallback?: boolean;
24
20
  }>;
25
21
  TabTriggers: {
26
22
  ({ children }: {
@@ -6,7 +6,7 @@ declare const ElementLinkDialog: ({ sourceElementId, onClose, appState, scene, g
6
6
  sourceElementId: ExcalidrawElement["id"];
7
7
  appState: UIAppState;
8
8
  scene: Scene;
9
- onClose?: (() => void) | undefined;
9
+ onClose?: () => void;
10
10
  generateLinkForSelection: AppProps["generateLinkForSelection"];
11
11
  }) => import("react/jsx-runtime").JSX.Element;
12
12
  export default ElementLinkDialog;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Ellipsify: ({ children, ...rest }: {
3
2
  children: React.ReactNode;
4
- } & import("react").HTMLAttributes<HTMLSpanElement>) => import("react/jsx-runtime").JSX.Element;
3
+ } & React.HTMLAttributes<HTMLSpanElement>) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
2
  export declare const ErrorDialog: ({ children, onClose, }: {
3
3
  children?: React.ReactNode;
4
- onClose?: (() => void) | undefined;
4
+ onClose?: () => void;
5
5
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import "./ExcalidrawLogo.scss";
3
2
  type LogoSize = "xs" | "small" | "normal" | "large" | "custom" | "mobile";
4
3
  interface LogoProps {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { ExcalidrawElement } from "@excalidraw/element/types";
3
2
  import "./EyeDropper.scss";
4
3
  import type { ColorPickerType } from "./ColorPicker/colorPickerUtils";
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Node } from "@excalidraw/common";
3
2
  import { type FontDescriptor } from "./FontPickerList";
4
3
  interface FontPickerKeyNavHandlerProps {
@@ -1,4 +1,4 @@
1
1
  import "./HelpDialog.scss";
2
2
  export declare const HelpDialog: ({ onClose }: {
3
- onClose?: (() => void) | undefined;
3
+ onClose?: () => void;
4
4
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  export declare const InlineIcon: ({ className, icon, size, }: {
2
- className?: string | undefined;
2
+ className?: string;
3
3
  icon: React.ReactNode;
4
- size?: string | undefined;
4
+ size?: string;
5
5
  }) => import("react/jsx-runtime").JSX.Element;
@@ -5,5 +5,5 @@ export declare const LibraryMenuControlButtons: ({ libraryReturnUrl, theme, id,
5
5
  id: string;
6
6
  style: React.CSSProperties;
7
7
  children?: React.ReactNode;
8
- className?: string | undefined;
8
+ className?: string;
9
9
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type Library from "../data/library";
3
2
  import type { LibraryItem, UIAppState } from "../types";
4
3
  export declare const LibraryDropdownMenuButton: React.FC<{
@@ -14,5 +13,5 @@ export declare const LibraryDropdownMenuButton: React.FC<{
14
13
  export declare const LibraryDropdownMenu: ({ selectedItems, onSelectItems, className, }: {
15
14
  selectedItems: LibraryItem["id"][];
16
15
  onSelectItems: (id: LibraryItem["id"][]) => void;
17
- className?: string | undefined;
16
+ className?: string;
18
17
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,10 @@
1
- /// <reference types="react" />
2
1
  import "./LibraryUnit.scss";
3
2
  import type { LibraryItem } from "../types";
4
3
  import type { SvgCache } from "../hooks/useLibraryItemSvg";
5
4
  export declare const LibraryUnit: import("react").MemoExoticComponent<({ id, elements, isPending, onClick, selected, onToggle, onDrag, svgCache, }: {
6
5
  id: LibraryItem["id"] | /** for pending item */ null;
7
- elements?: readonly import("../../element/src/types").NonDeleted<import("../../element/src/types").ExcalidrawElement>[] | undefined;
8
- isPending?: boolean | undefined;
6
+ elements?: LibraryItem["elements"];
7
+ isPending?: boolean;
9
8
  onClick: (id: LibraryItem["id"] | null) => void;
10
9
  selected: boolean;
11
10
  onToggle: (id: string, event: React.MouseEvent) => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Theme } from "@excalidraw/element/types";
3
2
  export declare const LoadingMessage: React.FC<{
4
3
  delay?: number;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import "./ToolIcon.scss";
3
2
  import "./MobileToolBar.scss";
4
3
  import type { AppClassProperties, UIAppState } from "../types";
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import "./Modal.scss";
3
2
  import type { AppState } from "../types";
4
3
  export declare const Modal: React.FC<{
@@ -4,7 +4,7 @@ export type OverwriteConfirmDialogProps = {
4
4
  children: React.ReactNode;
5
5
  };
6
6
  declare const OverwriteConfirmDialog: React.FC<OverwriteConfirmDialogProps & {
7
- __fallback?: boolean | undefined;
7
+ __fallback?: boolean;
8
8
  }> & {
9
9
  Actions: (({ children }: {
10
10
  children: React.ReactNode;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import "./RadioGroup.scss";
3
2
  export type RadioGroupChoice<T> = {
4
3
  value: T;
@@ -4,14 +4,14 @@ export declare const RadioSelection: <T extends Object>(props: {
4
4
  value: T;
5
5
  text: string;
6
6
  icon: JSX.Element;
7
- testId?: string | undefined;
7
+ testId?: string;
8
8
  /** if not supplied, defaults to value identity check */
9
- active?: boolean | undefined;
9
+ active?: boolean;
10
10
  }[];
11
11
  value: T | null;
12
- type?: "button" | "radio" | undefined;
12
+ type?: "radio" | "button";
13
13
  } & ({
14
- type?: "radio" | undefined;
14
+ type?: "radio";
15
15
  group: string;
16
16
  onChange: (value: T) => void;
17
17
  } | {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import "./ScrollableList.scss";
3
2
  interface ScrollableListProps {
4
3
  className?: string;