@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
@@ -0,0 +1,19 @@
1
+ import { ExcalidrawElement } from "../../element/types";
2
+ import { AppState } from "../../types";
3
+ import { ColorPickerType } from "./colorPickerUtils";
4
+ import { ColorTuple, ColorPaletteCustom } from "../../colors";
5
+ import "./ColorPicker.scss";
6
+ export declare const getColor: (color: string) => string | null;
7
+ interface ColorPickerProps {
8
+ type: ColorPickerType;
9
+ color: string;
10
+ onChange: (color: string) => void;
11
+ label: string;
12
+ elements: readonly ExcalidrawElement[];
13
+ appState: AppState;
14
+ palette?: ColorPaletteCustom | null;
15
+ topPicks?: ColorTuple;
16
+ updateData: (formData?: any) => void;
17
+ }
18
+ export declare const ColorPicker: ({ type, color, onChange, label, elements, palette, topPicks, updateData, appState, }: ColorPickerProps) => JSX.Element;
19
+ export {};
@@ -0,0 +1,8 @@
1
+ interface CustomColorListProps {
2
+ colors: string[];
3
+ color: string;
4
+ onChange: (color: string) => void;
5
+ label: string;
6
+ }
7
+ export declare const CustomColorList: ({ colors, color, onChange, label, }: CustomColorListProps) => JSX.Element;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ interface HotkeyLabelProps {
2
+ color: string;
3
+ keyLabel: string | number;
4
+ isCustomColor?: boolean;
5
+ isShade?: boolean;
6
+ }
7
+ declare const HotkeyLabel: ({ color, keyLabel, isCustomColor, isShade, }: HotkeyLabelProps) => JSX.Element;
8
+ export default HotkeyLabel;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { ExcalidrawElement } from "../../element/types";
3
+ import { ColorPickerType } from "./colorPickerUtils";
4
+ import { ColorPaletteCustom } from "../../colors";
5
+ interface PickerProps {
6
+ color: string;
7
+ onChange: (color: string) => void;
8
+ label: string;
9
+ type: ColorPickerType;
10
+ elements: readonly ExcalidrawElement[];
11
+ palette: ColorPaletteCustom;
12
+ updateData: (formData?: any) => void;
13
+ children?: React.ReactNode;
14
+ onEyeDropperToggle: (force?: boolean) => void;
15
+ onEscape: (event: React.KeyboardEvent | KeyboardEvent) => void;
16
+ }
17
+ export declare const Picker: ({ color, onChange, label, type, elements, palette, updateData, children, onEyeDropperToggle, onEscape, }: PickerProps) => JSX.Element;
18
+ export {};
@@ -0,0 +1,10 @@
1
+ import { ColorPaletteCustom } from "../../colors";
2
+ interface PickerColorListProps {
3
+ palette: ColorPaletteCustom;
4
+ color: string;
5
+ onChange: (color: string) => void;
6
+ label: string;
7
+ activeShade: number;
8
+ }
9
+ declare const PickerColorList: ({ palette, color, onChange, label, activeShade, }: PickerColorListProps) => JSX.Element;
10
+ export default PickerColorList;
@@ -0,0 +1,5 @@
1
+ import { ReactNode } from "react";
2
+ declare const PickerHeading: ({ children }: {
3
+ children: ReactNode;
4
+ }) => JSX.Element;
5
+ export default PickerHeading;
@@ -0,0 +1,8 @@
1
+ import { ColorPaletteCustom } from "../../colors";
2
+ interface ShadeListProps {
3
+ hex: string;
4
+ onChange: (color: string) => void;
5
+ palette: ColorPaletteCustom;
6
+ }
7
+ export declare const ShadeList: ({ hex, onChange, palette }: ShadeListProps) => JSX.Element;
8
+ export {};
@@ -0,0 +1,9 @@
1
+ import { ColorPickerType } from "./colorPickerUtils";
2
+ interface TopPicksProps {
3
+ onChange: (color: string) => void;
4
+ type: ColorPickerType;
5
+ activeColor: string;
6
+ topPicks?: readonly string[];
7
+ }
8
+ export declare const TopPicks: ({ onChange, type, activeColor, topPicks, }: TopPicksProps) => JSX.Element | null;
9
+ export {};
@@ -0,0 +1,21 @@
1
+ import { ExcalidrawElement } from "../../element/types";
2
+ import { ColorPickerColor, ColorPaletteCustom } from "../../colors";
3
+ export declare const getColorNameAndShadeFromColor: ({ palette, color, }: {
4
+ palette: ColorPaletteCustom;
5
+ color: string;
6
+ }) => {
7
+ colorName: ColorPickerColor;
8
+ shade: number | null;
9
+ } | null;
10
+ export declare const colorPickerHotkeyBindings: string[];
11
+ export declare const isCustomColor: ({ color, palette, }: {
12
+ color: string;
13
+ palette: ColorPaletteCustom;
14
+ }) => boolean;
15
+ export declare const getMostUsedCustomColors: (elements: readonly ExcalidrawElement[], type: "elementBackground" | "elementStroke", palette: ColorPaletteCustom) => string[];
16
+ export type ActiveColorPickerSectionAtomType = "custom" | "baseColors" | "shades" | "hex" | null;
17
+ export declare const activeColorPickerSectionAtom: import("jotai").PrimitiveAtom<ActiveColorPickerSectionAtomType> & {
18
+ init: ActiveColorPickerSectionAtomType;
19
+ };
20
+ export declare const getContrastYIQ: (bgHex: string, isCustomColor: boolean) => "white" | "black";
21
+ export type ColorPickerType = "canvasBackground" | "elementBackground" | "elementStroke";
@@ -0,0 +1,20 @@
1
+ import { ColorPaletteCustom } from "../../colors";
2
+ import { ActiveColorPickerSectionAtomType } from "./colorPickerUtils";
3
+ interface ColorPickerKeyNavHandlerProps {
4
+ event: React.KeyboardEvent;
5
+ activeColorPickerSection: ActiveColorPickerSectionAtomType;
6
+ palette: ColorPaletteCustom;
7
+ color: string;
8
+ onChange: (color: string) => void;
9
+ customColors: string[];
10
+ setActiveColorPickerSection: (update: React.SetStateAction<ActiveColorPickerSectionAtomType>) => void;
11
+ updateData: (formData?: any) => void;
12
+ activeShade: number;
13
+ onEyeDropperToggle: (force?: boolean) => void;
14
+ onEscape: (event: React.KeyboardEvent | KeyboardEvent) => void;
15
+ }
16
+ /**
17
+ * @returns true if the event was handled
18
+ */
19
+ export declare const colorPickerKeyNavHandler: ({ event, activeColorPickerSection, palette, color, onChange, customColors, setActiveColorPickerSection, updateData, activeShade, onEyeDropperToggle, onEscape, }: ColorPickerKeyNavHandlerProps) => boolean;
20
+ export {};
@@ -1,28 +1,15 @@
1
1
  import "./ContextMenu.scss";
2
2
  import { Action } from "../actions/types";
3
3
  import { ActionManager } from "../actions/manager";
4
- import { AppState } from "../types";
5
- import { NonDeletedExcalidrawElement } from "../element/types";
6
- export declare type ContextMenuOption = "separator" | Action;
7
- declare type ContextMenuProps = {
8
- options: ContextMenuOption[];
9
- onCloseRequest?(): void;
4
+ import React from "react";
5
+ export type ContextMenuItem = typeof CONTEXT_MENU_SEPARATOR | Action;
6
+ export type ContextMenuItems = (ContextMenuItem | false | null | undefined)[];
7
+ type ContextMenuProps = {
8
+ actionManager: ActionManager;
9
+ items: ContextMenuItems;
10
10
  top: number;
11
11
  left: number;
12
- actionManager: ActionManager;
13
- appState: Readonly<AppState>;
14
- elements: readonly NonDeletedExcalidrawElement[];
15
- };
16
- declare type ContextMenuParams = {
17
- options: (ContextMenuOption | false | null | undefined)[];
18
- top: ContextMenuProps["top"];
19
- left: ContextMenuProps["left"];
20
- actionManager: ContextMenuProps["actionManager"];
21
- appState: Readonly<AppState>;
22
- container: HTMLElement;
23
- elements: readonly NonDeletedExcalidrawElement[];
24
- };
25
- declare const _default: {
26
- push(params: ContextMenuParams): void;
27
12
  };
28
- export default _default;
13
+ export declare const CONTEXT_MENU_SEPARATOR = "separator";
14
+ export declare const ContextMenu: React.MemoExoticComponent<({ actionManager, items, top, left }: ContextMenuProps) => JSX.Element>;
15
+ export {};
@@ -0,0 +1,29 @@
1
+ import { MarkOptional } from "../utility-types";
2
+ import { SidebarProps, SidebarTriggerProps } from "./Sidebar/common";
3
+ export declare const DefaultSidebar: import("react").FC<Omit<MarkOptional<Omit<{
4
+ name: string;
5
+ children: import("react").ReactNode;
6
+ onStateChange?: ((state: {
7
+ name: string;
8
+ tab?: string | undefined;
9
+ } | null) => void) | undefined;
10
+ onDock?: ((docked: boolean) => void) | undefined;
11
+ docked?: boolean | undefined;
12
+ className?: string | undefined;
13
+ __fallback?: boolean | undefined;
14
+ }, "name">, "children">, "onDock"> & {
15
+ /** pass `false` to disable docking */
16
+ onDock?: SidebarProps["onDock"] | false;
17
+ } & {
18
+ __fallback?: boolean | undefined;
19
+ }> & {
20
+ Trigger: import("react").FC<Omit<SidebarTriggerProps, "name"> & import("react").HTMLAttributes<HTMLDivElement> & {
21
+ __fallback?: boolean | undefined;
22
+ }>;
23
+ TabTriggers: {
24
+ ({ children, ...rest }: {
25
+ children: React.ReactNode;
26
+ } & import("react").HTMLAttributes<HTMLDivElement>): JSX.Element;
27
+ displayName: string;
28
+ };
29
+ };
@@ -1,14 +1,13 @@
1
1
  import React from "react";
2
2
  import "./Dialog.scss";
3
- import { AppState } from "../types";
3
+ export type DialogSize = number | "small" | "regular" | "wide" | undefined;
4
4
  export interface DialogProps {
5
5
  children: React.ReactNode;
6
6
  className?: string;
7
- small?: boolean;
7
+ size?: DialogSize;
8
8
  onCloseRequest(): void;
9
- title: React.ReactNode;
9
+ title: React.ReactNode | false;
10
10
  autofocus?: boolean;
11
- theme?: AppState["theme"];
12
11
  closeOnClickOutside?: boolean;
13
12
  }
14
13
  export declare const Dialog: (props: DialogProps) => JSX.Element;
@@ -1,4 +1,5 @@
1
- export declare const ErrorDialog: ({ message, onClose, }: {
2
- message: string;
1
+ import React from "react";
2
+ export declare const ErrorDialog: ({ children, onClose, }: {
3
+ children?: React.ReactNode;
3
4
  onClose?: (() => void) | undefined;
4
5
  }) => JSX.Element;
@@ -0,0 +1,15 @@
1
+ import "./ExcalidrawLogo.scss";
2
+ type LogoSize = "xs" | "small" | "normal" | "large" | "custom";
3
+ interface LogoProps {
4
+ size?: LogoSize;
5
+ withText?: boolean;
6
+ style?: React.CSSProperties;
7
+ /**
8
+ * If true, the logo will not be wrapped in a Link component.
9
+ * The link prop will be ignored as well.
10
+ * It will merely be a plain div.
11
+ */
12
+ isNotLink?: boolean;
13
+ }
14
+ export declare const ExcalidrawLogo: ({ style, size, withText, }: LogoProps) => JSX.Element;
15
+ export {};
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import "./EyeDropper.scss";
3
+ import { ColorPickerType } from "./ColorPicker/colorPickerUtils";
4
+ import { ExcalidrawElement } from "../element/types";
5
+ export type EyeDropperProperties = {
6
+ keepOpenOnAlt: boolean;
7
+ swapPreviewOnAlt?: boolean;
8
+ /** called when user picks color (on pointerup) */
9
+ onSelect: (color: string, event: PointerEvent) => void;
10
+ /**
11
+ * property of selected elements to update live when alt-dragging.
12
+ * Supply `null` if not applicable (e.g. updating the canvas bg instead of
13
+ * elements)
14
+ **/
15
+ colorPickerType: ColorPickerType;
16
+ };
17
+ export declare const activeEyeDropperAtom: import("jotai").PrimitiveAtom<EyeDropperProperties | null> & {
18
+ init: EyeDropperProperties | null;
19
+ };
20
+ export declare const EyeDropper: React.FC<{
21
+ onCancel: () => void;
22
+ onSelect: EyeDropperProperties["onSelect"];
23
+ /** called when color changes, on pointerdown for preview */
24
+ onChange: (type: ColorPickerType, color: string, selectedElements: ExcalidrawElement[], event: {
25
+ altKey: boolean;
26
+ }) => void;
27
+ colorPickerType: EyeDropperProperties["colorPickerType"];
28
+ }>;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import "./FilledButton.scss";
3
+ export type ButtonVariant = "filled" | "outlined" | "icon";
4
+ export type ButtonColor = "primary" | "danger" | "warning" | "muted";
5
+ export type ButtonSize = "medium" | "large";
6
+ export type FilledButtonProps = {
7
+ label: string;
8
+ children?: React.ReactNode;
9
+ onClick?: () => void;
10
+ variant?: ButtonVariant;
11
+ color?: ButtonColor;
12
+ size?: ButtonSize;
13
+ className?: string;
14
+ fullWidth?: boolean;
15
+ startIcon?: React.ReactNode;
16
+ };
17
+ export declare const FilledButton: React.ForwardRefExoticComponent<FilledButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -1,6 +1,6 @@
1
1
  import "./FixedSideContainer.scss";
2
2
  import React from "react";
3
- declare type FixedSideContainerProps = {
3
+ type FixedSideContainerProps = {
4
4
  children: React.ReactNode;
5
5
  side: "top" | "left" | "right";
6
6
  className?: string;
@@ -0,0 +1,10 @@
1
+ import "./ToolIcon.scss";
2
+ type LockIconProps = {
3
+ title?: string;
4
+ name?: string;
5
+ checked: boolean;
6
+ onChange?(): void;
7
+ isMobile?: boolean;
8
+ };
9
+ export declare const HandButton: (props: LockIconProps) => JSX.Element;
10
+ export {};
@@ -1,5 +1,4 @@
1
- declare type HelpButtonProps = {
2
- title?: string;
1
+ type HelpButtonProps = {
3
2
  name?: string;
4
3
  id?: string;
5
4
  onClick?(): void;
@@ -1,11 +1,10 @@
1
- import { NonDeletedExcalidrawElement } from "../element/types";
1
+ import { AppClassProperties, Device, UIAppState } from "../types";
2
2
  import "./HintViewer.scss";
3
- import { AppState, Device } from "../types";
4
3
  interface HintViewerProps {
5
- appState: AppState;
6
- elements: readonly NonDeletedExcalidrawElement[];
4
+ appState: UIAppState;
7
5
  isMobile: boolean;
8
6
  device: Device;
7
+ app: AppClassProperties;
9
8
  }
10
- export declare const HintViewer: ({ appState, elements, isMobile, device, }: HintViewerProps) => JSX.Element | null;
9
+ export declare const HintViewer: ({ appState, isMobile, device, app, }: HintViewerProps) => JSX.Element | null;
11
10
  export {};
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import "./LibraryButton.scss";
2
+ import "./HomeButton.scss";
3
3
  export declare const HomeButton: React.FC<{
4
4
  onHomeButtonClick: () => void;
5
5
  }>;
@@ -1,18 +1,13 @@
1
- import React from "react";
1
+ import type { ActionManager } from "../actions/manager";
2
+ import type { AppClassProperties, BinaryFiles, UIAppState } from "../types";
2
3
  import { NonDeletedExcalidrawElement } from "../element/types";
3
- import { AppState, BinaryFiles } from "../types";
4
- import "./ExportDialog.scss";
5
- import { ActionManager } from "../actions/manager";
4
+ import "./ImageExportDialog.scss";
6
5
  export declare const ErrorCanvasPreview: () => JSX.Element;
7
- export declare type ExportCB = (elements: readonly NonDeletedExcalidrawElement[], scale?: number) => void;
8
- export declare const ImageExportDialog: ({ elements, appState, setAppState, files, exportPadding, actionManager, onExportToPng, onExportToSvg, onExportToClipboard, }: {
9
- appState: AppState;
10
- setAppState: React.Component<any, AppState>["setState"];
6
+ export declare const ImageExportDialog: ({ elements, appState, files, actionManager, onExportImage, onCloseRequest, }: {
7
+ appState: UIAppState;
11
8
  elements: readonly NonDeletedExcalidrawElement[];
12
9
  files: BinaryFiles;
13
- exportPadding?: number | undefined;
14
10
  actionManager: ActionManager;
15
- onExportToPng: ExportCB;
16
- onExportToSvg: ExportCB;
17
- onExportToClipboard: ExportCB;
18
- }) => JSX.Element;
11
+ onExportImage: AppClassProperties["onExportImage"];
12
+ onCloseRequest: () => void;
13
+ }) => JSX.Element | null;
@@ -1,6 +1,6 @@
1
1
  import "./Island.scss";
2
2
  import React from "react";
3
- declare type IslandProps = {
3
+ type IslandProps = {
4
4
  children: React.ReactNode;
5
5
  padding?: number;
6
6
  className?: string | boolean;
@@ -1,13 +1,15 @@
1
+ import React from "react";
1
2
  import { NonDeletedExcalidrawElement } from "../element/types";
2
- import { AppState, ExportOpts, BinaryFiles } from "../types";
3
+ import { ExportOpts, BinaryFiles, UIAppState } from "../types";
3
4
  import "./ExportDialog.scss";
4
5
  import { ActionManager } from "../actions/manager";
5
- export declare type ExportCB = (elements: readonly NonDeletedExcalidrawElement[], scale?: number) => void;
6
- export declare const JSONExportDialog: ({ elements, appState, files, actionManager, exportOpts, canvas, }: {
6
+ export type ExportCB = (elements: readonly NonDeletedExcalidrawElement[], scale?: number) => void;
7
+ export declare const JSONExportDialog: ({ elements, appState, files, actionManager, exportOpts, canvas, setAppState, }: {
7
8
  elements: readonly NonDeletedExcalidrawElement[];
8
- appState: AppState;
9
+ appState: UIAppState;
9
10
  files: BinaryFiles;
10
11
  actionManager: ActionManager;
11
12
  exportOpts: ExportOpts;
12
- canvas: HTMLCanvasElement | null;
13
+ canvas: HTMLCanvasElement;
14
+ setAppState: React.Component<any, UIAppState>["setState"];
13
15
  }) => JSX.Element;
@@ -0,0 +1,28 @@
1
+ import { LaserPointer } from "@excalidraw/laser-pointer";
2
+ import App from "../App";
3
+ declare global {
4
+ interface Window {
5
+ LPM: LaserPathManager;
6
+ }
7
+ }
8
+ export declare class LaserPathManager {
9
+ private app;
10
+ private ownState;
11
+ private collaboratorsState;
12
+ private rafId;
13
+ private isDrawing;
14
+ private container;
15
+ constructor(app: App);
16
+ destroy(): void;
17
+ startPath(x: number, y: number): void;
18
+ addPointToPath(x: number, y: number): void;
19
+ endPath(): void;
20
+ private updatePath;
21
+ private isRunning;
22
+ start(svg?: SVGSVGElement): void;
23
+ stop(): void;
24
+ loop(): void;
25
+ draw(path: LaserPointer): string;
26
+ updateCollabolatorsState(): void;
27
+ update(): void;
28
+ }
@@ -0,0 +1,10 @@
1
+ import "../ToolIcon.scss";
2
+ type LaserPointerIconProps = {
3
+ title?: string;
4
+ name?: string;
5
+ checked: boolean;
6
+ onChange?(): void;
7
+ isMobile?: boolean;
8
+ };
9
+ export declare const LaserPointerButton: (props: LaserPointerIconProps) => JSX.Element;
10
+ export {};
@@ -0,0 +1,7 @@
1
+ import { LaserPathManager } from "./LaserPathManager";
2
+ import "./LaserToolOverlay.scss";
3
+ type LaserToolOverlayProps = {
4
+ manager: LaserPathManager;
5
+ };
6
+ export declare const LaserToolOverlay: ({ manager }: LaserToolOverlayProps) => JSX.Element;
7
+ export {};
@@ -1,40 +1,32 @@
1
1
  import React from "react";
2
2
  import { ActionManager } from "../actions/manager";
3
- import { NonDeletedExcalidrawElement, Theme } from "../element/types";
3
+ import { NonDeletedExcalidrawElement } from "../element/types";
4
4
  import { Language } from "../i18n";
5
- import { AppProps, AppState, ExcalidrawProps, BinaryFiles } from "../types";
6
- import Library from "../data/library";
5
+ import { AppProps, AppState, ExcalidrawProps, BinaryFiles, UIAppState, AppClassProperties } from "../types";
7
6
  import "./LayerUI.scss";
8
7
  import "./Toolbar.scss";
9
8
  interface LayerUIProps {
10
9
  actionManager: ActionManager;
11
- appState: AppState;
10
+ appState: UIAppState;
12
11
  files: BinaryFiles;
13
- canvas: HTMLCanvasElement | null;
12
+ canvas: HTMLCanvasElement;
14
13
  setAppState: React.Component<any, AppState>["setState"];
15
14
  elements: readonly NonDeletedExcalidrawElement[];
16
- onCollabButtonClick?: () => void;
17
15
  onLockToggle: () => void;
16
+ onHandToolToggle: () => void;
18
17
  onPenModeToggle: () => void;
19
- onInsertElements: (elements: readonly NonDeletedExcalidrawElement[]) => void;
20
18
  showExitZenModeBtn: boolean;
21
19
  langCode: Language["code"];
22
- isCollaborating: boolean;
23
20
  renderTopRightUI?: ExcalidrawProps["renderTopRightUI"];
24
- renderCustomFooter?: ExcalidrawProps["renderFooter"];
25
21
  renderCustomStats?: ExcalidrawProps["renderCustomStats"];
26
- renderCustomSidebar?: ExcalidrawProps["renderSidebar"];
27
- libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
28
22
  UIOptions: AppProps["UIOptions"];
29
- focusContainer: () => void;
30
- library: Library;
31
- id: string;
32
- onImageAction: (data: {
33
- insertOnCanvasDirectly: boolean;
34
- }) => void;
23
+ onExportImage: AppClassProperties["onExportImage"];
35
24
  renderWelcomeScreen: boolean;
36
25
  onHomeButtonClick: () => void;
37
- onThemeToggle: (theme: Theme) => void;
26
+ children?: React.ReactNode;
27
+ app: AppClassProperties;
28
+ isCollaborating: boolean;
29
+ uiDisabled: boolean;
38
30
  }
39
- declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onCollabButtonClick, onLockToggle, onPenModeToggle, onInsertElements, showExitZenModeBtn, isCollaborating, renderTopRightUI, renderCustomFooter, renderCustomStats, renderCustomSidebar, libraryReturnUrl, UIOptions, focusContainer, library, id, onImageAction, renderWelcomeScreen, onHomeButtonClick, onThemeToggle, }: LayerUIProps) => JSX.Element>;
31
+ declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onExportImage, renderWelcomeScreen, onHomeButtonClick, children, app, isCollaborating, uiDisabled, }: LayerUIProps) => JSX.Element | null>;
40
32
  export default _default;
@@ -1,25 +1,24 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import Library from "../data/library";
3
- import { LibraryItems, LibraryItem, AppState, ExcalidrawProps } from "../types";
3
+ import { LibraryItems, LibraryItem, ExcalidrawProps, UIAppState } from "../types";
4
4
  import "./LibraryMenu.scss";
5
- import { NonDeletedExcalidrawElement } from "../element/types";
6
- export declare const LibraryMenuContent: ({ onInsertLibraryItems, pendingElements, onAddToLibrary, setAppState, libraryReturnUrl, library, id, appState, selectedItems, onSelectItems, }: {
5
+ export declare const isLibraryMenuOpenAtom: import("jotai").PrimitiveAtom<boolean> & {
6
+ init: boolean;
7
+ };
8
+ export declare const LibraryMenuContent: ({ onInsertLibraryItems, pendingElements, onAddToLibrary, setAppState, libraryReturnUrl, library, id, theme, selectedItems, onSelectItems, }: {
7
9
  pendingElements: LibraryItem["elements"];
8
10
  onInsertLibraryItems: (libraryItems: LibraryItems) => void;
9
11
  onAddToLibrary: () => void;
10
- setAppState: React.Component<any, AppState>["setState"];
12
+ setAppState: React.Component<any, UIAppState>["setState"];
11
13
  libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
12
14
  library: Library;
13
15
  id: string;
14
- appState: AppState;
16
+ theme: UIAppState["theme"];
15
17
  selectedItems: LibraryItem["id"][];
16
18
  onSelectItems: (id: LibraryItem["id"][]) => void;
17
19
  }) => JSX.Element;
18
- export declare const LibraryMenu: React.FC<{
19
- appState: AppState;
20
- onInsertElements: (elements: readonly NonDeletedExcalidrawElement[]) => void;
21
- libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
22
- focusContainer: () => void;
23
- library: Library;
24
- id: string;
25
- }>;
20
+ /**
21
+ * This component is meant to be rendered inside <Sidebar.Tab/> inside our
22
+ * <DefaultSidebar/> or host apps Sidebar components.
23
+ */
24
+ export declare const LibraryMenu: () => JSX.Element;
@@ -1,7 +1,7 @@
1
- import { AppState, ExcalidrawProps } from "../types";
1
+ import { ExcalidrawProps, UIAppState } from "../types";
2
2
  declare const LibraryMenuBrowseButton: ({ theme, id, libraryReturnUrl, }: {
3
3
  libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
4
- theme: AppState["theme"];
4
+ theme: UIAppState["theme"];
5
5
  id: string;
6
6
  }) => JSX.Element;
7
7
  export default LibraryMenuBrowseButton;
@@ -0,0 +1,9 @@
1
+ import { ExcalidrawProps, UIAppState } from "../types";
2
+ export declare const LibraryMenuControlButtons: ({ libraryReturnUrl, theme, id, style, children, className, }: {
3
+ libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
4
+ theme: UIAppState["theme"];
5
+ id: string;
6
+ style: React.CSSProperties;
7
+ children?: React.ReactNode;
8
+ className?: string | undefined;
9
+ }) => JSX.Element;
@@ -1,12 +1,17 @@
1
- import React from "react";
1
+ import { LibraryItem, UIAppState } from "../types";
2
2
  import Library from "../data/library";
3
- import { AppState, LibraryItem } from "../types";
4
- export declare const LibraryMenuHeader: React.FC<{
5
- setAppState: React.Component<any, AppState>["setState"];
3
+ export declare const LibraryDropdownMenuButton: React.FC<{
4
+ setAppState: React.Component<any, UIAppState>["setState"];
6
5
  selectedItems: LibraryItem["id"][];
7
6
  library: Library;
8
7
  onRemoveFromLibrary: () => void;
9
8
  resetLibrary: () => void;
10
9
  onSelectItems: (items: LibraryItem["id"][]) => void;
11
- appState: AppState;
10
+ appState: UIAppState;
11
+ className?: string;
12
12
  }>;
13
+ export declare const LibraryDropdownMenu: ({ selectedItems, onSelectItems, className, }: {
14
+ selectedItems: LibraryItem["id"][];
15
+ onSelectItems: (id: LibraryItem["id"][]) => void;
16
+ className?: string | undefined;
17
+ }) => JSX.Element;
@@ -1,15 +1,14 @@
1
- import { AppState, ExcalidrawProps, LibraryItem, LibraryItems } from "../types";
1
+ import { ExcalidrawProps, LibraryItem, LibraryItems, UIAppState } from "../types";
2
2
  import "./LibraryMenuItems.scss";
3
- declare const LibraryMenuItems: ({ isLoading, libraryItems, onAddToLibrary, onInsertLibraryItems, pendingElements, selectedItems, onSelectItems, theme, id, libraryReturnUrl, }: {
3
+ export default function LibraryMenuItems({ isLoading, libraryItems, onAddToLibrary, onInsertLibraryItems, pendingElements, theme, id, libraryReturnUrl, onSelectItems, selectedItems, }: {
4
4
  isLoading: boolean;
5
5
  libraryItems: LibraryItems;
6
6
  pendingElements: LibraryItem["elements"];
7
7
  onInsertLibraryItems: (libraryItems: LibraryItems) => void;
8
8
  onAddToLibrary: (elements: LibraryItem["elements"]) => void;
9
- selectedItems: LibraryItem["id"][];
10
- onSelectItems: (id: LibraryItem["id"][]) => void;
11
9
  libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
12
- theme: AppState["theme"];
10
+ theme: UIAppState["theme"];
13
11
  id: string;
14
- }) => JSX.Element;
15
- export default LibraryMenuItems;
12
+ selectedItems: LibraryItem["id"][];
13
+ onSelectItems: (id: LibraryItem["id"][]) => void;
14
+ }): JSX.Element;