@dwelle/excalidraw 0.4.0-e1bdbb6 → 0.4.0-e587816

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 (240) hide show
  1. package/CHANGELOG.md +714 -0
  2. package/README.md +18 -1422
  3. package/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.js → vendor-d415b28e9024dee4bb1b.js} +2 -2
  4. package/dist/excalidraw-assets-dev/{vendor-e6df8519da951026ff69.js → vendor-a14cd58fa2db417e42b2.js} +6 -6
  5. package/dist/excalidraw.development.js +3257 -1444
  6. package/dist/excalidraw.production.min.js +1 -1
  7. package/dist/excalidraw.production.min.js.LICENSE.txt +20 -0
  8. package/main.js +1 -8
  9. package/package.json +9 -4
  10. package/types/actions/actionAddToLibrary.d.ts +124 -64
  11. package/types/actions/actionAlign.d.ts +33 -40
  12. package/types/actions/actionBoundText.d.ts +182 -25
  13. package/types/actions/actionCanvas.d.ts +754 -220
  14. package/types/actions/actionClipboard.d.ts +236 -115
  15. package/types/actions/actionDeleteSelected.d.ts +133 -72
  16. package/types/actions/actionDistribute.d.ts +11 -16
  17. package/types/actions/actionDuplicateSelection.d.ts +4 -7
  18. package/types/actions/actionElementLock.d.ts +271 -0
  19. package/types/actions/actionExport.d.ts +440 -277
  20. package/types/actions/actionFinalize.d.ts +85 -51
  21. package/types/actions/actionFlip.d.ts +8 -11
  22. package/types/actions/actionFrame.d.ts +423 -0
  23. package/types/actions/actionGroup.d.ts +252 -19
  24. package/types/actions/actionHistory.d.ts +1 -1
  25. package/types/actions/actionLinearEditor.d.ts +44 -24
  26. package/types/actions/actionMenu.d.ts +132 -79
  27. package/types/actions/actionNavigate.d.ts +2 -3
  28. package/types/actions/actionProperties.d.ts +569 -334
  29. package/types/actions/actionSelectAll.d.ts +123 -4
  30. package/types/actions/actionStyles.d.ts +46 -27
  31. package/types/actions/actionToggleGridMode.d.ts +46 -25
  32. package/types/actions/{actionToggleLock.d.ts → actionToggleObjectsSnapMode.d.ts} +56 -35
  33. package/types/actions/actionToggleStats.d.ts +45 -25
  34. package/types/actions/actionToggleViewMode.d.ts +46 -25
  35. package/types/actions/actionToggleZenMode.d.ts +46 -25
  36. package/types/actions/actionZindex.d.ts +16 -24
  37. package/types/actions/index.d.ts +2 -1
  38. package/types/actions/manager.d.ts +3 -2
  39. package/types/actions/shortcuts.d.ts +2 -1
  40. package/types/actions/types.d.ts +16 -13
  41. package/types/appState.d.ts +27 -28
  42. package/types/charts.d.ts +2 -2
  43. package/types/clients.d.ts +5 -6
  44. package/types/clipboard.d.ts +9 -3
  45. package/types/colors.d.ts +60 -5
  46. package/types/components/Actions.d.ts +7 -12
  47. package/types/components/ActiveConfirmDialog.d.ts +4 -0
  48. package/types/components/App.d.ts +102 -86
  49. package/types/components/Avatar.d.ts +1 -2
  50. package/types/components/BraveMeasureTextError.d.ts +2 -0
  51. package/types/components/Button.d.ts +16 -0
  52. package/types/components/ButtonIconSelect.d.ts +11 -3
  53. package/types/components/Card.d.ts +6 -0
  54. package/types/components/ColorPicker/ColorInput.d.ts +9 -0
  55. package/types/components/ColorPicker/ColorPicker.d.ts +19 -0
  56. package/types/components/ColorPicker/CustomColorList.d.ts +8 -0
  57. package/types/components/ColorPicker/HotkeyLabel.d.ts +8 -0
  58. package/types/components/ColorPicker/Picker.d.ts +18 -0
  59. package/types/components/ColorPicker/PickerColorList.d.ts +10 -0
  60. package/types/components/ColorPicker/PickerHeading.d.ts +5 -0
  61. package/types/components/ColorPicker/ShadeList.d.ts +8 -0
  62. package/types/components/ColorPicker/TopPicks.d.ts +9 -0
  63. package/types/components/ColorPicker/colorPickerUtils.d.ts +21 -0
  64. package/types/components/ColorPicker/keyboardNavHandlers.d.ts +20 -0
  65. package/types/components/ContextMenu.d.ts +9 -22
  66. package/types/components/DefaultSidebar.d.ts +29 -0
  67. package/types/components/Dialog.d.ts +3 -4
  68. package/types/components/ErrorDialog.d.ts +3 -2
  69. package/types/components/ExcalidrawLogo.d.ts +15 -0
  70. package/types/components/EyeDropper.d.ts +28 -0
  71. package/types/components/FilledButton.d.ts +17 -0
  72. package/types/components/FixedSideContainer.d.ts +1 -1
  73. package/types/components/HandButton.d.ts +10 -0
  74. package/types/components/HelpButton.d.ts +1 -2
  75. package/types/components/HintViewer.d.ts +4 -5
  76. package/types/components/HomeButton.d.ts +1 -1
  77. package/types/components/ImageExportDialog.d.ts +8 -13
  78. package/types/components/Island.d.ts +1 -1
  79. package/types/components/JSONExportDialog.d.ts +7 -5
  80. package/types/components/LaserTool/LaserPathManager.d.ts +28 -0
  81. package/types/components/LaserTool/LaserPointerButton.d.ts +10 -0
  82. package/types/components/LaserTool/LaserTool.d.ts +7 -0
  83. package/types/components/LayerUI.d.ts +11 -19
  84. package/types/components/LibraryMenu.d.ts +13 -14
  85. package/types/components/LibraryMenuBrowseButton.d.ts +2 -2
  86. package/types/components/LibraryMenuControlButtons.d.ts +9 -0
  87. package/types/components/LibraryMenuHeaderContent.d.ts +10 -5
  88. package/types/components/LibraryMenuItems.d.ts +6 -7
  89. package/types/components/LibraryMenuSection.d.ts +22 -0
  90. package/types/components/LibraryUnit.d.ts +6 -3
  91. package/types/components/LoadingMessage.d.ts +0 -1
  92. package/types/components/LockButton.d.ts +1 -2
  93. package/types/components/MobileMenu.d.ts +9 -15
  94. package/types/components/OverwriteConfirm/OverwriteConfirm.d.ts +17 -0
  95. package/types/components/OverwriteConfirm/OverwriteConfirmActions.d.ts +17 -0
  96. package/types/components/OverwriteConfirm/OverwriteConfirmState.d.ts +22 -0
  97. package/types/components/PasteChartDialog.d.ts +4 -5
  98. package/types/components/PenModeButton.d.ts +1 -1
  99. package/types/components/Popover.d.ts +1 -1
  100. package/types/components/ProjectName.d.ts +2 -1
  101. package/types/components/PublishLibrary.d.ts +2 -2
  102. package/types/components/RadioGroup.d.ts +12 -0
  103. package/types/components/Section.d.ts +1 -1
  104. package/types/components/Sidebar/Sidebar.d.ts +66 -63
  105. package/types/components/Sidebar/SidebarHeader.d.ts +6 -19
  106. package/types/components/Sidebar/SidebarTab.d.ts +8 -0
  107. package/types/components/Sidebar/SidebarTabTrigger.d.ts +9 -0
  108. package/types/components/Sidebar/SidebarTabTriggers.d.ts +6 -0
  109. package/types/components/Sidebar/SidebarTabs.d.ts +6 -0
  110. package/types/components/Sidebar/SidebarTrigger.d.ts +6 -0
  111. package/types/components/Sidebar/common.d.ts +24 -7
  112. package/types/components/Spinner.d.ts +2 -1
  113. package/types/components/Stack.d.ts +4 -3
  114. package/types/components/Stats.d.ts +3 -3
  115. package/types/components/Switch.d.ts +9 -0
  116. package/types/components/ToolButton.d.ts +6 -5
  117. package/types/components/Tooltip.d.ts +1 -1
  118. package/types/components/Trans.d.ts +9 -0
  119. package/types/components/UserList.d.ts +0 -2
  120. package/types/components/canvases/InteractiveCanvas.d.ts +27 -0
  121. package/types/components/canvases/StaticCanvas.d.ts +18 -0
  122. package/types/components/canvases/index.d.ts +3 -0
  123. package/types/components/dropdownMenu/DropdownMenu.d.ts +70 -0
  124. package/types/components/dropdownMenu/DropdownMenuContent.d.ts +15 -0
  125. package/types/components/dropdownMenu/DropdownMenuGroup.d.ts +11 -0
  126. package/types/components/dropdownMenu/DropdownMenuItem.d.ts +13 -0
  127. package/types/components/dropdownMenu/DropdownMenuItemContent.d.ts +6 -0
  128. package/types/components/dropdownMenu/DropdownMenuItemCustom.d.ts +7 -0
  129. package/types/components/dropdownMenu/DropdownMenuItemLink.d.ts +14 -0
  130. package/types/components/dropdownMenu/DropdownMenuSeparator.d.ts +5 -0
  131. package/types/components/dropdownMenu/DropdownMenuTrigger.d.ts +10 -0
  132. package/types/components/dropdownMenu/common.d.ts +6 -0
  133. package/types/components/dropdownMenu/dropdownMenuUtils.d.ts +3 -0
  134. package/types/components/footer/Footer.d.ts +12 -0
  135. package/types/components/footer/FooterCenter.d.ts +8 -0
  136. package/types/components/hoc/withInternalFallback.d.ts +4 -0
  137. package/types/components/icons.d.ts +17 -2
  138. package/types/components/live-collaboration/LiveCollaborationTrigger.d.ts +9 -0
  139. package/types/components/main-menu/DefaultItems.d.ts +47 -0
  140. package/types/components/main-menu/MainMenu.d.ts +64 -0
  141. package/types/components/welcome-screen/WelcomeScreen.Center.d.ts +57 -0
  142. package/types/components/welcome-screen/WelcomeScreen.Hints.d.ts +19 -0
  143. package/types/components/welcome-screen/WelcomeScreen.d.ts +84 -0
  144. package/types/constants.d.ts +105 -18
  145. package/types/context/tunnels.d.ts +19 -0
  146. package/types/context/ui-appState.d.ts +4 -0
  147. package/types/cursor.d.ts +5 -0
  148. package/types/data/blob.d.ts +5 -3
  149. package/types/data/encode.d.ts +1 -1
  150. package/types/data/filesystem.d.ts +2 -1
  151. package/types/data/index.d.ts +1 -1
  152. package/types/data/library.d.ts +3 -45
  153. package/types/data/restore.d.ts +10 -4
  154. package/types/data/transform.d.ts +73 -0
  155. package/types/data/types.d.ts +3 -5
  156. package/types/data/url.d.ts +7 -0
  157. package/types/element/Hyperlink.d.ts +57 -36
  158. package/types/element/binding.d.ts +4 -3
  159. package/types/element/bounds.d.ts +41 -10
  160. package/types/element/collision.d.ts +7 -7
  161. package/types/element/dragElements.d.ts +12 -2
  162. package/types/element/embeddable.d.ts +153 -0
  163. package/types/element/image.d.ts +11 -1
  164. package/types/element/index.d.ts +3 -2
  165. package/types/element/linearElementEditor.d.ts +77 -30
  166. package/types/element/mutateElement.d.ts +3 -2
  167. package/types/element/newElement.d.ts +48 -15
  168. package/types/element/resizeElements.d.ts +3 -3
  169. package/types/element/resizeTest.d.ts +2 -1
  170. package/types/element/showSelectedShapeActions.d.ts +2 -2
  171. package/types/element/sizeHelpers.d.ts +8 -1
  172. package/types/element/sortElements.d.ts +2 -0
  173. package/types/element/textElement.d.ts +57 -9
  174. package/types/element/textWysiwyg.d.ts +7 -2
  175. package/types/element/transformHandles.d.ts +15 -8
  176. package/types/element/typeChecks.d.ts +14 -2
  177. package/types/element/types.d.ts +66 -35
  178. package/types/emitter.d.ts +1 -2
  179. package/types/errors.d.ts +1 -1
  180. package/types/frame.d.ts +46 -0
  181. package/types/ga.d.ts +5 -5
  182. package/types/groups.d.ts +15 -11
  183. package/types/history.d.ts +3 -3
  184. package/types/hooks/useCreatePortalContainer.d.ts +4 -0
  185. package/types/hooks/useLibraryItemSvg.d.ts +11 -0
  186. package/types/hooks/useOutsideClick.d.ts +19 -2
  187. package/types/hooks/useScrollPosition.d.ts +1 -0
  188. package/types/hooks/useStable.d.ts +1 -0
  189. package/types/hooks/useTransition.d.ts +2 -0
  190. package/types/i18n.d.ts +11 -2
  191. package/types/jotai.d.ts +20 -108
  192. package/types/keys.d.ts +7 -4
  193. package/types/math.d.ts +7 -1
  194. package/types/packages/bbox.d.ts +11 -0
  195. package/types/packages/excalidraw/example/App.d.ts +7 -1
  196. package/types/packages/excalidraw/example/CustomFooter.d.ts +5 -0
  197. package/types/packages/excalidraw/example/MobileFooter.d.ts +5 -0
  198. package/types/packages/excalidraw/example/initialData.d.ts +182 -64
  199. package/types/packages/excalidraw/index.d.ts +22 -4
  200. package/types/packages/excalidraw/main.d.ts +3 -1
  201. package/types/packages/excalidraw/webpack.dev.config.d.ts +5 -2
  202. package/types/packages/excalidraw/webpack.prod.config.d.ts +3 -0
  203. package/types/packages/utils.d.ts +30 -24
  204. package/types/packages/withinBounds.d.ts +19 -0
  205. package/types/renderer/renderElement.d.ts +13 -22
  206. package/types/renderer/renderScene.d.ts +19 -29
  207. package/types/renderer/renderSnaps.d.ts +2 -0
  208. package/types/renderer/roundRect.d.ts +1 -1
  209. package/types/scene/Fonts.d.ts +21 -0
  210. package/types/scene/Renderer.d.ts +25 -0
  211. package/types/scene/Scene.d.ts +42 -5
  212. package/types/scene/Shape.d.ts +12 -0
  213. package/types/scene/ShapeCache.d.ts +20 -0
  214. package/types/scene/comparisons.d.ts +2 -4
  215. package/types/scene/export.d.ts +183 -10
  216. package/types/scene/index.d.ts +1 -1
  217. package/types/scene/scroll.d.ts +1 -1
  218. package/types/scene/scrollbars.d.ts +2 -6
  219. package/types/scene/selection.d.ts +27 -6
  220. package/types/scene/types.d.ts +70 -26
  221. package/types/snapping.d.ts +108 -0
  222. package/types/types.d.ts +227 -91
  223. package/types/utility-types.d.ts +24 -0
  224. package/types/utils.d.ts +75 -14
  225. package/types/zindex.d.ts +4 -4
  226. package/types/components/ActiveFile.d.ts +0 -7
  227. package/types/components/ClearCanvas.d.ts +0 -4
  228. package/types/components/CollabButton.d.ts +0 -6
  229. package/types/components/ColorPicker.d.ts +0 -14
  230. package/types/components/Footer.d.ts +0 -10
  231. package/types/components/LibraryButton.d.ts +0 -8
  232. package/types/components/MenuItem.d.ts +0 -11
  233. package/types/components/MenuUtils.d.ts +0 -1
  234. package/types/components/SingleLibraryItem.d.ts +0 -10
  235. package/types/components/WelcomeScreen.d.ts +0 -10
  236. package/types/components/WelcomeScreenDecor.d.ts +0 -6
  237. package/types/components/hoc/withUpstreamOverride.d.ts +0 -10
  238. /package/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.js.LICENSE.txt → vendor-d415b28e9024dee4bb1b.js.LICENSE.txt} +0 -0
  239. /package/types/packages/excalidraw/dist/excalidraw-assets/{vendor-2002fe1b8862917b36c1.d.ts → vendor-d415b28e9024dee4bb1b.d.ts} +0 -0
  240. /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-e6df8519da951026ff69.d.ts → vendor-a14cd58fa2db417e42b2.d.ts} +0 -0
@@ -1,5 +1,12 @@
1
- import { AppProps } from "./types";
2
- import { FontFamilyValues } from "./element/types";
1
+ import { AppProps, NormalizedZoomValue } from "./types";
2
+ import { ExcalidrawElement, FontFamilyValues } from "./element/types";
3
+ export declare const isDarwin: boolean;
4
+ export declare const isWindows: boolean;
5
+ export declare const isAndroid: boolean;
6
+ export declare const isFirefox: boolean;
7
+ export declare const isChrome: boolean;
8
+ export declare const isSafari: boolean;
9
+ export declare const isBrave: () => boolean;
3
10
  export declare const APP_NAME = "Excalidraw";
4
11
  export declare const DRAGGING_THRESHOLD = 10;
5
12
  export declare const LINE_CONFIRM_THRESHOLD = 8;
@@ -7,6 +14,7 @@ export declare const ELEMENT_SHIFT_TRANSLATE_AMOUNT = 5;
7
14
  export declare const ELEMENT_TRANSLATE_AMOUNT = 1;
8
15
  export declare const TEXT_TO_CENTER_SNAP_THRESHOLD = 30;
9
16
  export declare const SHIFT_LOCKING_ANGLE: number;
17
+ export declare const DEFAULT_LASER_COLOR = "red";
10
18
  export declare const CURSOR_TYPE: {
11
19
  TEXT: string;
12
20
  CROSSHAIR: string;
@@ -22,6 +30,11 @@ export declare const POINTER_BUTTON: {
22
30
  readonly SECONDARY: 2;
23
31
  readonly TOUCH: -1;
24
32
  };
33
+ export declare const POINTER_EVENTS: {
34
+ readonly enabled: "all";
35
+ readonly disabled: "none";
36
+ readonly inheritFromUI: any;
37
+ };
25
38
  export declare enum EVENT {
26
39
  COPY = "copy",
27
40
  PASTE = "paste",
@@ -40,6 +53,7 @@ export declare enum EVENT {
40
53
  GESTURE_START = "gesturestart",
41
54
  GESTURE_CHANGE = "gesturechange",
42
55
  POINTER_MOVE = "pointermove",
56
+ POINTER_DOWN = "pointerdown",
43
57
  POINTER_UP = "pointerup",
44
58
  STATE_CHANGE = "statechange",
45
59
  WHEEL = "wheel",
@@ -48,11 +62,22 @@ export declare enum EVENT {
48
62
  HASHCHANGE = "hashchange",
49
63
  VISIBILITY_CHANGE = "visibilitychange",
50
64
  SCROLL = "scroll",
51
- EXCALIDRAW_LINK = "excalidraw-link"
65
+ EXCALIDRAW_LINK = "excalidraw-link",
66
+ MENU_ITEM_SELECT = "menu.itemSelect",
67
+ MESSAGE = "message"
52
68
  }
69
+ export declare const YOUTUBE_STATES: {
70
+ readonly UNSTARTED: -1;
71
+ readonly ENDED: 0;
72
+ readonly PLAYING: 1;
73
+ readonly PAUSED: 2;
74
+ readonly BUFFERING: 3;
75
+ readonly CUED: 5;
76
+ };
53
77
  export declare const ENV: {
54
78
  TEST: string;
55
79
  DEVELOPMENT: string;
80
+ PRODUCTION: string;
56
81
  };
57
82
  export declare const CLASSES: {
58
83
  SHAPE_ACTIONS_MENU: string;
@@ -63,36 +88,72 @@ export declare const FONT_FAMILY: {
63
88
  Cascadia: number;
64
89
  };
65
90
  export declare const THEME: {
66
- LIGHT: string;
67
- DARK: string;
91
+ readonly LIGHT: "light";
92
+ readonly DARK: "dark";
93
+ };
94
+ export declare const FRAME_STYLE: {
95
+ strokeColor: string;
96
+ strokeWidth: number;
97
+ strokeStyle: import("./element/types").StrokeStyle;
98
+ fillStyle: import("./element/types").FillStyle;
99
+ roughness: number;
100
+ roundness: {
101
+ type: import("./element/types").RoundnessType;
102
+ value?: number | undefined;
103
+ } | null;
104
+ backgroundColor: string;
105
+ radius: number;
68
106
  };
69
107
  export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
108
+ export declare const MIN_FONT_SIZE = 1;
70
109
  export declare const DEFAULT_FONT_SIZE = 20;
71
110
  export declare const DEFAULT_FONT_FAMILY: FontFamilyValues;
72
111
  export declare const DEFAULT_TEXT_ALIGN = "left";
73
112
  export declare const DEFAULT_VERTICAL_ALIGN = "top";
74
113
  export declare const DEFAULT_VERSION = "{version}";
114
+ export declare const DEFAULT_BACKGROUND_COLOR = "#ffffff";
115
+ export declare const DEFAULT_STROKE_COLOR = "#000000";
116
+ export declare const DEFAULT_ZOOM_VALUE: NormalizedZoomValue;
75
117
  export declare const CANVAS_ONLY_ACTIONS: string[];
76
118
  export declare const GRID_SIZE = 20;
119
+ export declare const IMAGE_MIME_TYPES: {
120
+ readonly svg: "image/svg+xml";
121
+ readonly png: "image/png";
122
+ readonly jpg: "image/jpeg";
123
+ readonly gif: "image/gif";
124
+ readonly webp: "image/webp";
125
+ readonly bmp: "image/bmp";
126
+ readonly ico: "image/x-icon";
127
+ readonly avif: "image/avif";
128
+ readonly jfif: "image/jfif";
129
+ };
77
130
  export declare const MIME_TYPES: {
78
- readonly excalidraw: "application/vnd.excalidraw+json";
79
- readonly excalidrawlib: "application/vnd.excalidrawlib+json";
80
- readonly json: "application/json";
81
131
  readonly svg: "image/svg+xml";
82
- readonly "excalidraw.svg": "image/svg+xml";
83
132
  readonly png: "image/png";
84
- readonly "excalidraw.png": "image/png";
85
133
  readonly jpg: "image/jpeg";
86
134
  readonly gif: "image/gif";
87
135
  readonly webp: "image/webp";
88
136
  readonly bmp: "image/bmp";
89
137
  readonly ico: "image/x-icon";
138
+ readonly avif: "image/avif";
139
+ readonly jfif: "image/jfif";
140
+ readonly json: "application/json";
141
+ readonly excalidraw: "application/vnd.excalidraw+json";
142
+ readonly excalidrawlib: "application/vnd.excalidrawlib+json";
143
+ readonly "excalidraw.svg": "image/svg+xml";
144
+ readonly "excalidraw.png": "image/png";
90
145
  readonly binary: "application/octet-stream";
91
146
  };
147
+ export declare const EXPORT_IMAGE_TYPES: {
148
+ readonly png: "png";
149
+ readonly svg: "svg";
150
+ readonly clipboard: "clipboard";
151
+ };
92
152
  export declare const EXPORT_DATA_TYPES: {
93
153
  readonly excalidraw: "excalidraw";
94
154
  readonly excalidrawClipboard: "excalidraw/clipboard";
95
155
  readonly excalidrawLibrary: "excalidrawlib";
156
+ readonly excalidrawClipboardWithAPI: "excalidraw-api/clipboard";
96
157
  };
97
158
  export declare const EXPORT_SOURCE: string;
98
159
  export declare const IMAGE_RENDER_TIMEOUT = 500;
@@ -106,11 +167,6 @@ export declare const MIN_ZOOM = 0.1;
106
167
  export declare const HYPERLINK_TOOLTIP_DELAY = 300;
107
168
  export declare const IDLE_THRESHOLD = 60000;
108
169
  export declare const ACTIVE_THRESHOLD = 3000;
109
- export declare const MODES: {
110
- VIEW: string;
111
- ZEN: string;
112
- GRID: string;
113
- };
114
170
  export declare const THEME_FILTER: any;
115
171
  export declare const URL_QUERY_KEYS: {
116
172
  readonly addLibrary: "addLibrary";
@@ -129,7 +185,6 @@ export declare const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
129
185
  export declare const EXPORT_SCALES: number[];
130
186
  export declare const DEFAULT_EXPORT_PADDING = 10;
131
187
  export declare const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 1440;
132
- export declare const ALLOWED_IMAGE_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/svg+xml", "image/gif", "image/webp", "image/bmp", "image/x-icon"];
133
188
  export declare const MAX_ALLOWED_FILE_BYTES: number;
134
189
  export declare const SVG_NS = "http://www.w3.org/2000/svg";
135
190
  export declare const ENCRYPTION_KEY_BITS = 128;
@@ -138,6 +193,8 @@ export declare const VERSIONS: {
138
193
  readonly excalidrawLibrary: 2;
139
194
  };
140
195
  export declare const BOUND_TEXT_PADDING = 5;
196
+ export declare const ARROW_LABEL_WIDTH_FRACTION = 0.7;
197
+ export declare const ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO = 11;
141
198
  export declare const VERTICAL_ALIGN: {
142
199
  TOP: string;
143
200
  MIDDLE: string;
@@ -149,9 +206,39 @@ export declare const TEXT_ALIGN: {
149
206
  RIGHT: string;
150
207
  };
151
208
  export declare const ELEMENT_READY_TO_ERASE_OPACITY = 20;
152
- export declare const COOKIES: {
153
- readonly AUTH_STATE_COOKIE: "excplus-auth";
209
+ export declare const DEFAULT_PROPORTIONAL_RADIUS = 0.25;
210
+ export declare const DEFAULT_ADAPTIVE_RADIUS = 32;
211
+ export declare const ROUNDNESS: {
212
+ readonly LEGACY: 1;
213
+ readonly PROPORTIONAL_RADIUS: 2;
214
+ readonly ADAPTIVE_RADIUS: 3;
154
215
  };
155
216
  /** key containt id of precedeing elemnt id we use in reconciliation during
156
217
  * collaboration */
157
218
  export declare const PRECEDING_ELEMENT_KEY = "__precedingElement__";
219
+ export declare const ROUGHNESS: {
220
+ readonly architect: 0;
221
+ readonly artist: 1;
222
+ readonly cartoonist: 2;
223
+ };
224
+ export declare const STROKE_WIDTH: {
225
+ readonly thin: 1;
226
+ readonly bold: 2;
227
+ readonly extraBold: 4;
228
+ };
229
+ export declare const DEFAULT_ELEMENT_PROPS: {
230
+ strokeColor: ExcalidrawElement["strokeColor"];
231
+ backgroundColor: ExcalidrawElement["backgroundColor"];
232
+ fillStyle: ExcalidrawElement["fillStyle"];
233
+ strokeWidth: ExcalidrawElement["strokeWidth"];
234
+ strokeStyle: ExcalidrawElement["strokeStyle"];
235
+ roughness: ExcalidrawElement["roughness"];
236
+ opacity: ExcalidrawElement["opacity"];
237
+ locked: ExcalidrawElement["locked"];
238
+ };
239
+ export declare const LIBRARY_SIDEBAR_TAB = "library";
240
+ export declare const DEFAULT_SIDEBAR: {
241
+ readonly name: "default";
242
+ readonly defaultTab: "library";
243
+ };
244
+ export declare const LIBRARY_DISABLED_TYPES: Set<"embeddable" | "image">;
@@ -0,0 +1,19 @@
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
+ OverwriteConfirmDialogTunnel: Tunnel;
14
+ jotaiScope: symbol;
15
+ };
16
+ export declare const TunnelsContext: React.Context<TunnelsContextValue>;
17
+ export declare const useTunnels: () => TunnelsContextValue;
18
+ export declare const useInitializeTunnels: () => TunnelsContextValue;
19
+ 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;
@@ -0,0 +1,5 @@
1
+ import { AppState } from "./types";
2
+ export declare const resetCursor: (interactiveCanvas: HTMLCanvasElement | null) => void;
3
+ export declare const setCursor: (interactiveCanvas: HTMLCanvasElement | null, cursor: string) => void;
4
+ export declare const setEraserCursor: (interactiveCanvas: HTMLCanvasElement | null, theme: AppState["theme"]) => void;
5
+ export declare const setCursorForShape: (interactiveCanvas: HTMLCanvasElement | null, appState: Pick<AppState, "activeTool" | "theme">) => void;
@@ -1,6 +1,7 @@
1
- import { ALLOWED_IMAGE_MIME_TYPES, MIME_TYPES } from "../constants";
1
+ import { IMAGE_MIME_TYPES, MIME_TYPES } from "../constants";
2
2
  import { ExcalidrawElement, FileId } from "../element/types";
3
3
  import { AppState, DataURL, LibraryItem } from "../types";
4
+ import { ValueOf } from "../utility-types";
4
5
  import { FileSystemHandle } from "./filesystem";
5
6
  import { ImportedLibraryData } from "./types";
6
7
  export declare const getMimeType: (blob: Blob | string) => string;
@@ -8,7 +9,7 @@ export declare const getFileHandleType: (handle: FileSystemHandle | null) => str
8
9
  export declare const isImageFileHandleType: (type: string | null) => type is "svg" | "png";
9
10
  export declare const isImageFileHandle: (handle: FileSystemHandle | null) => boolean;
10
11
  export declare const isSupportedImageFile: (blob: Blob | null | undefined) => blob is Blob & {
11
- type: (typeof ALLOWED_IMAGE_MIME_TYPES)[number];
12
+ type: ValueOf<typeof IMAGE_MIME_TYPES>;
12
13
  };
13
14
  export declare const loadSceneOrLibraryFromBlob: (blob: Blob | File, localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null, fileHandle?: FileSystemHandle | null) => Promise<{
14
15
  type: "application/vnd.excalidraw+json";
@@ -20,7 +21,7 @@ export declare const loadSceneOrLibraryFromBlob: (blob: Blob | File, localAppSta
20
21
  export declare const loadFromBlob: (blob: Blob, localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | null, fileHandle?: FileSystemHandle | null) => Promise<import("./restore").RestoredDataState>;
21
22
  export declare const parseLibraryJSON: (json: string, defaultStatus?: LibraryItem["status"]) => LibraryItem[];
22
23
  export declare const loadLibraryFromBlob: (blob: Blob, defaultStatus?: LibraryItem["status"]) => Promise<LibraryItem[]>;
23
- export declare const canvasToBlob: (canvas: HTMLCanvasElement) => Promise<Blob>;
24
+ export declare const canvasToBlob: (canvas: HTMLCanvasElement | Promise<HTMLCanvasElement>) => Promise<Blob>;
24
25
  /** generates SHA-1 digest from supplied file (if not supported, falls back
25
26
  to a 40-char base64 random id) */
26
27
  export declare const generateIdFromFile: (file: File) => Promise<FileId>;
@@ -34,6 +35,7 @@ export declare const resizeImageFile: (file: File, opts: {
34
35
  export declare const SVGStringToFile: (SVGString: string, filename?: string) => File & {
35
36
  type: typeof MIME_TYPES.svg;
36
37
  };
38
+ export declare const ImageURLToFile: (imageUrl: string, filename?: string) => Promise<File | undefined>;
37
39
  export declare const getFileFromEvent: (event: React.DragEvent<HTMLDivElement>) => Promise<{
38
40
  file: File | null;
39
41
  fileHandle: FileSystemHandle | null;
@@ -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,5 +1,6 @@
1
1
  import { FileSystemHandle, supported as nativeFileSystemSupported } from "browser-fs-access";
2
- declare type FILE_EXTENSION = "gif" | "jpg" | "png" | "excalidraw.png" | "svg" | "excalidraw.svg" | "json" | "excalidraw" | "excalidrawlib";
2
+ import { MIME_TYPES } from "../constants";
3
+ type FILE_EXTENSION = Exclude<keyof typeof MIME_TYPES, "binary">;
3
4
  export declare const fileOpen: <M extends boolean | undefined = false>(opts: {
4
5
  extensions?: FILE_EXTENSION[] | undefined;
5
6
  description: string;
@@ -4,7 +4,7 @@ import { AppState, BinaryFiles } from "../types";
4
4
  import { FileSystemHandle } from "./filesystem";
5
5
  export { loadFromBlob } from "./blob";
6
6
  export { loadFromJSON, saveAsJSON } from "./json";
7
- export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, }: {
7
+ export declare const exportAsImage: (type: Omit<ExportType, "backend">, elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, }: {
8
8
  exportBackground: boolean;
9
9
  exportPadding?: number | undefined;
10
10
  viewBackgroundColor: 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,15 +1,21 @@
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;
10
10
  };
11
- export declare const restoreElements: (elements: ImportedDataState["elements"], localElements: readonly ExcalidrawElement[] | null | undefined, refreshDimensions?: boolean) => ExcalidrawElement[];
11
+ export declare const restoreElements: (elements: ImportedDataState["elements"], localElements: readonly ExcalidrawElement[] | null | undefined, opts?: {
12
+ refreshDimensions?: boolean;
13
+ repairBindings?: boolean;
14
+ } | undefined) => ExcalidrawElement[];
12
15
  export declare const restoreAppState: (appState: ImportedDataState["appState"], localAppState: Partial<AppState> | null | undefined) => RestoredAppState;
13
- export declare const restore: (data: Pick<ImportedDataState, "appState" | "elements" | "files"> | null, localAppState: Partial<AppState> | null | undefined, localElements: readonly ExcalidrawElement[] | null | undefined) => RestoredDataState;
16
+ export declare const restore: (data: Pick<ImportedDataState, "appState" | "elements" | "files"> | null, localAppState: Partial<AppState> | null | undefined, localElements: readonly ExcalidrawElement[] | null | undefined, elementsConfig?: {
17
+ refreshDimensions?: boolean;
18
+ repairBindings?: boolean;
19
+ }) => RestoredDataState;
14
20
  export declare const restoreLibraryItems: (libraryItems: ImportedDataState["libraryItems"], defaultStatus: LibraryItem["status"]) => LibraryItem[];
15
21
  export {};
@@ -0,0 +1,73 @@
1
+ import { ElementConstructorOpts } from "../element/newElement";
2
+ import { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawEmbeddableElement, ExcalidrawFrameElement, ExcalidrawFreeDrawElement, ExcalidrawGenericElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawSelectionElement, ExcalidrawTextElement, FileId, FontFamilyValues, TextAlign, VerticalAlign } from "../element/types";
3
+ import { MarkOptional } from "../utility-types";
4
+ export type ValidLinearElement = {
5
+ type: "arrow" | "line";
6
+ x: number;
7
+ y: number;
8
+ label?: {
9
+ text: string;
10
+ fontSize?: number;
11
+ fontFamily?: FontFamilyValues;
12
+ textAlign?: TextAlign;
13
+ verticalAlign?: VerticalAlign;
14
+ } & MarkOptional<ElementConstructorOpts, "x" | "y">;
15
+ end?: (({
16
+ type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
17
+ id?: ExcalidrawGenericElement["id"];
18
+ } | {
19
+ id: ExcalidrawGenericElement["id"];
20
+ type?: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
21
+ }) | (({
22
+ type: "text";
23
+ text: string;
24
+ } | {
25
+ type?: "text";
26
+ id: ExcalidrawTextElement["id"];
27
+ text: string;
28
+ }) & Partial<ExcalidrawTextElement>)) & MarkOptional<ElementConstructorOpts, "x" | "y">;
29
+ start?: (({
30
+ type: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
31
+ id?: ExcalidrawGenericElement["id"];
32
+ } | {
33
+ id: ExcalidrawGenericElement["id"];
34
+ type?: Exclude<ExcalidrawBindableElement["type"], "image" | "text" | "frame" | "embeddable">;
35
+ }) | (({
36
+ type: "text";
37
+ text: string;
38
+ } | {
39
+ type?: "text";
40
+ id: ExcalidrawTextElement["id"];
41
+ text: string;
42
+ }) & Partial<ExcalidrawTextElement>)) & MarkOptional<ElementConstructorOpts, "x" | "y">;
43
+ } & Partial<ExcalidrawLinearElement>;
44
+ export type ValidContainer = {
45
+ type: Exclude<ExcalidrawGenericElement["type"], "selection">;
46
+ id?: ExcalidrawGenericElement["id"];
47
+ label?: {
48
+ text: string;
49
+ fontSize?: number;
50
+ fontFamily?: FontFamilyValues;
51
+ textAlign?: TextAlign;
52
+ verticalAlign?: VerticalAlign;
53
+ } & MarkOptional<ElementConstructorOpts, "x" | "y">;
54
+ } & ElementConstructorOpts;
55
+ export type ExcalidrawElementSkeleton = Extract<Exclude<ExcalidrawElement, ExcalidrawSelectionElement>, ExcalidrawEmbeddableElement | ExcalidrawFreeDrawElement | ExcalidrawFrameElement> | ({
56
+ type: Extract<ExcalidrawLinearElement["type"], "line">;
57
+ x: number;
58
+ y: number;
59
+ } & Partial<ExcalidrawLinearElement>) | ValidContainer | ValidLinearElement | ({
60
+ type: "text";
61
+ text: string;
62
+ x: number;
63
+ y: number;
64
+ id?: ExcalidrawTextElement["id"];
65
+ } & Partial<ExcalidrawTextElement>) | ({
66
+ type: Extract<ExcalidrawImageElement["type"], "image">;
67
+ x: number;
68
+ y: number;
69
+ fileId: FileId;
70
+ } & Partial<ExcalidrawImageElement>);
71
+ export declare const convertToExcalidrawElements: (elementsSkeleton: ExcalidrawElementSkeleton[] | null, opts?: {
72
+ regenerateIds: boolean;
73
+ }) => ExcalidrawElement[];
@@ -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;
@@ -0,0 +1,7 @@
1
+ export declare const normalizeLink: (link: string) => string;
2
+ export declare const isLocalLink: (link: string | null) => boolean;
3
+ /**
4
+ * Returns URL sanitized and safe for usage in places such as
5
+ * iframe's src attribute or <a> href attributes.
6
+ */
7
+ export declare const toValidURL: (link: string) => string;