@excalidraw/math 0.18.0-5fffc47 → 0.18.0-60b2758

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 (231) hide show
  1. package/dist/dev/index.js +3 -3
  2. package/dist/dev/index.js.map +2 -2
  3. package/dist/prod/index.js +1 -1
  4. package/dist/types/common/debug.d.ts +21 -0
  5. package/dist/types/common/src/bounds.d.ts +10 -0
  6. package/dist/types/common/src/colors.d.ts +59 -39
  7. package/dist/types/common/src/constants.d.ts +19 -27
  8. package/dist/types/common/src/editorInterface.d.ts +34 -0
  9. package/dist/types/common/src/font-metadata.d.ts +1 -3
  10. package/dist/types/common/src/index.d.ts +3 -0
  11. package/dist/types/common/src/keys.d.ts +1 -1
  12. package/dist/types/common/src/utility-types.d.ts +0 -1
  13. package/dist/types/common/src/utils.d.ts +50 -39
  14. package/dist/types/element/src/Scene.d.ts +3 -3
  15. package/dist/types/element/src/arrows/focus.d.ts +27 -0
  16. package/dist/types/element/src/arrows/helpers.d.ts +5 -0
  17. package/dist/types/element/src/binding.d.ts +66 -46
  18. package/dist/types/element/src/bounds.d.ts +2 -10
  19. package/dist/types/element/src/collision.d.ts +7 -2
  20. package/dist/types/element/src/comparisons.d.ts +7 -7
  21. package/dist/types/element/src/distribute.d.ts +2 -1
  22. package/dist/types/element/src/dragElements.d.ts +3 -3
  23. package/dist/types/element/src/duplicate.d.ts +3 -3
  24. package/dist/types/element/src/fractionalIndex.d.ts +2 -2
  25. package/dist/types/element/src/frame.d.ts +5 -1
  26. package/dist/types/element/src/heading.d.ts +2 -1
  27. package/dist/types/element/src/image.d.ts +1 -11
  28. package/dist/types/element/src/index.d.ts +3 -3
  29. package/dist/types/element/src/linearElementEditor.d.ts +18 -20
  30. package/dist/types/element/src/mutateElement.d.ts +3 -1
  31. package/dist/types/element/src/newElement.d.ts +6 -6
  32. package/dist/types/element/src/renderElement.d.ts +1 -7
  33. package/dist/types/element/src/resizeElements.d.ts +10 -10
  34. package/dist/types/element/src/resizeTest.d.ts +6 -5
  35. package/dist/types/element/src/selection.d.ts +3 -7
  36. package/dist/types/element/src/shape.d.ts +8 -7
  37. package/dist/types/element/src/textMeasurements.d.ts +1 -3
  38. package/dist/types/{excalidraw/data → element/src}/transform.d.ts +3 -3
  39. package/dist/types/element/src/transformHandles.d.ts +8 -27
  40. package/dist/types/element/src/typeChecks.d.ts +4 -7
  41. package/dist/types/element/src/types.d.ts +8 -12
  42. package/dist/types/element/src/utils.d.ts +8 -3
  43. package/dist/types/element/src/zindex.d.ts +7 -1
  44. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +141 -202
  45. package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -7
  46. package/dist/types/excalidraw/actions/actionBoundText.d.ts +71 -112
  47. package/dist/types/excalidraw/actions/actionCanvas.d.ts +424 -858
  48. package/dist/types/excalidraw/actions/actionClipboard.d.ts +105 -907
  49. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +34 -55
  50. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +115 -180
  51. package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
  52. package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +3 -4
  53. package/dist/types/excalidraw/actions/actionElementLink.d.ts +44 -71
  54. package/dist/types/excalidraw/actions/actionElementLock.d.ts +70 -111
  55. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +50 -71
  56. package/dist/types/excalidraw/actions/actionExport.d.ts +153 -1166
  57. package/dist/types/excalidraw/actions/actionFinalize.d.ts +10 -404
  58. package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -3
  59. package/dist/types/excalidraw/actions/actionFrame.d.ts +221 -340
  60. package/dist/types/excalidraw/actions/actionGroup.d.ts +74 -123
  61. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +126 -185
  62. package/dist/types/excalidraw/actions/actionLink.d.ts +51 -72
  63. package/dist/types/excalidraw/actions/actionMenu.d.ts +38 -65
  64. package/dist/types/excalidraw/actions/actionNavigate.d.ts +18 -369
  65. package/dist/types/excalidraw/actions/actionProperties.d.ts +131 -2576
  66. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +37 -62
  67. package/dist/types/excalidraw/actions/actionStyles.d.ts +34 -55
  68. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
  69. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +50 -71
  70. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +50 -71
  71. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +38 -65
  72. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
  73. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +49 -70
  74. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +50 -71
  75. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +50 -71
  76. package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -9
  77. package/dist/types/excalidraw/actions/register.d.ts +2 -2
  78. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  79. package/dist/types/excalidraw/actions/types.d.ts +3 -3
  80. package/dist/types/excalidraw/appState.d.ts +20 -20
  81. package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -0
  82. package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
  83. package/dist/types/excalidraw/charts/charts.helpers.d.ts +32 -0
  84. package/dist/types/excalidraw/charts/charts.line.d.ts +2 -0
  85. package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
  86. package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -0
  87. package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
  88. package/dist/types/excalidraw/charts/index.d.ts +7 -0
  89. package/dist/types/excalidraw/clipboard.d.ts +11 -35
  90. package/dist/types/excalidraw/components/Actions.d.ts +5 -2
  91. package/dist/types/excalidraw/components/App.d.ts +68 -60
  92. package/dist/types/excalidraw/components/Card.d.ts +1 -3
  93. package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -4
  94. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +0 -2
  95. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +0 -1
  96. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +0 -1
  97. package/dist/types/excalidraw/components/CommandPalette/types.d.ts +2 -4
  98. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -2
  99. package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
  100. package/dist/types/excalidraw/components/DefaultSidebar.d.ts +9 -13
  101. package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +1 -1
  102. package/dist/types/excalidraw/components/Ellipsify.d.ts +1 -2
  103. package/dist/types/excalidraw/components/ErrorDialog.d.ts +1 -1
  104. package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -1
  105. package/dist/types/excalidraw/components/EyeDropper.d.ts +0 -1
  106. package/dist/types/excalidraw/components/FilledButton.d.ts +2 -1
  107. package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +0 -1
  108. package/dist/types/excalidraw/components/HelpDialog.d.ts +1 -1
  109. package/dist/types/excalidraw/components/HintViewer.d.ts +4 -3
  110. package/dist/types/excalidraw/components/InlineIcon.d.ts +2 -2
  111. package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -1
  112. package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -2
  113. package/dist/types/excalidraw/components/LibraryUnit.d.ts +2 -3
  114. package/dist/types/excalidraw/components/LoadingMessage.d.ts +0 -1
  115. package/dist/types/excalidraw/components/MobileMenu.d.ts +1 -1
  116. package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -1
  117. package/dist/types/excalidraw/components/Modal.d.ts +0 -1
  118. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +1 -1
  119. package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
  120. package/dist/types/excalidraw/components/Popover.d.ts +2 -1
  121. package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -1
  122. package/dist/types/excalidraw/components/RadioGroup.d.ts +0 -1
  123. package/dist/types/excalidraw/components/RadioSelection.d.ts +4 -4
  124. package/dist/types/excalidraw/components/ScrollableList.d.ts +0 -1
  125. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +15 -21
  126. package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +1 -1
  127. package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -2
  128. package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -2
  129. package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +1 -2
  130. package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +1 -2
  131. package/dist/types/excalidraw/components/Spinner.d.ts +4 -4
  132. package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +0 -1
  133. package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +0 -1
  134. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +0 -1
  135. package/dist/types/excalidraw/components/Stats/index.d.ts +7 -8
  136. package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
  137. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatHistoryMenu.d.ts +15 -0
  138. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +23 -0
  139. package/dist/types/excalidraw/components/TTDDialog/Chat/ChatMessage.d.ts +14 -0
  140. package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +27 -0
  141. package/dist/types/excalidraw/components/TTDDialog/Chat/index.d.ts +3 -0
  142. package/dist/types/excalidraw/components/TTDDialog/Chat/useChatAgent.d.ts +8 -0
  143. package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +3 -2
  144. package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +13 -0
  145. package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +12 -29
  146. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +2 -2
  147. package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +13 -9
  148. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +1 -2
  149. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +1 -2
  150. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +1 -2
  151. package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -1
  152. package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +9 -0
  153. package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
  154. package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +9 -0
  155. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +16 -16
  156. package/dist/types/excalidraw/components/TTDDialog/hooks/useChatManagement.d.ts +13 -0
  157. package/dist/types/excalidraw/components/TTDDialog/hooks/useMermaidRenderer.d.ts +14 -0
  158. package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +7 -0
  159. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +95 -0
  160. package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +22 -0
  161. package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +24 -0
  162. package/dist/types/excalidraw/components/TTDDialog/utils/chat.d.ts +10 -0
  163. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidValidation.d.ts +1 -0
  164. package/dist/types/excalidraw/components/Toast.d.ts +3 -3
  165. package/dist/types/excalidraw/components/Trans.d.ts +2 -2
  166. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +6 -3
  167. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +48 -38
  168. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +7 -6
  169. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +3 -3
  170. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +13 -22
  171. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
  172. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +5 -4
  173. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +0 -1
  174. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -2
  175. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +6 -6
  176. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
  177. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
  178. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
  179. package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuTrigger.d.ts +3 -4
  180. package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +2 -2
  181. package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
  182. package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +1 -1
  183. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +1 -1
  184. package/dist/types/excalidraw/components/icons.d.ts +27 -13
  185. package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +4 -3
  186. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +17 -2
  187. package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +39 -35
  188. package/dist/types/excalidraw/components/shapes.d.ts +74 -1
  189. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +6 -6
  190. package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +15 -16
  191. package/dist/types/excalidraw/data/blob.d.ts +319 -3
  192. package/dist/types/excalidraw/data/encode.d.ts +4 -4
  193. package/dist/types/excalidraw/data/encryption.d.ts +5 -5
  194. package/dist/types/excalidraw/data/filesystem.d.ts +2 -2
  195. package/dist/types/excalidraw/data/index.d.ts +3 -3
  196. package/dist/types/excalidraw/data/json.d.ts +158 -2
  197. package/dist/types/excalidraw/data/library.d.ts +24 -9
  198. package/dist/types/excalidraw/data/restore.d.ts +25 -10
  199. package/dist/types/excalidraw/editor-jotai.d.ts +11 -11
  200. package/dist/types/excalidraw/errors.d.ts +14 -0
  201. package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +4 -3
  202. package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -2
  203. package/dist/types/excalidraw/i18n.d.ts +2 -2
  204. package/dist/types/excalidraw/index.d.ts +8 -7
  205. package/dist/types/excalidraw/renderer/animation.d.ts +12 -0
  206. package/dist/types/excalidraw/renderer/helpers.d.ts +6 -8
  207. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +8 -14
  208. package/dist/types/excalidraw/scene/Renderer.d.ts +5 -2
  209. package/dist/types/excalidraw/scene/export.d.ts +2 -2
  210. package/dist/types/excalidraw/scene/scroll.d.ts +1 -6
  211. package/dist/types/excalidraw/scene/types.d.ts +22 -5
  212. package/dist/types/excalidraw/shortcut.d.ts +1 -0
  213. package/dist/types/excalidraw/snapping.d.ts +5 -5
  214. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +1 -1
  215. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +1 -1
  216. package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +1 -1
  217. package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +2 -2
  218. package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +1 -1
  219. package/dist/types/excalidraw/types.d.ts +34 -29
  220. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +2 -2
  221. package/dist/types/math/src/point.d.ts +6 -1
  222. package/dist/types/math/src/polygon.d.ts +2 -2
  223. package/dist/types/math/src/range.d.ts +1 -3
  224. package/dist/types/math/src/segment.d.ts +3 -3
  225. package/dist/types/math/src/types.d.ts +25 -1
  226. package/dist/types/utils/src/bbox.d.ts +1 -1
  227. package/dist/types/utils/src/export.d.ts +5 -5
  228. package/dist/types/utils/src/shape.d.ts +6 -6
  229. package/dist/types/utils/src/withinBounds.d.ts +2 -2
  230. package/package.json +2 -2
  231. package/dist/types/excalidraw/charts.d.ts +0 -27
@@ -0,0 +1,2 @@
1
+ import type { ChartElements, Spreadsheet } from "./charts.types";
2
+ export declare const renderBarChart: (spreadsheet: Spreadsheet, x: number, y: number, colorSeed?: number) => ChartElements;
@@ -0,0 +1,48 @@
1
+ import type { Radians } from "@excalidraw/math";
2
+ export declare const CARTESIAN_BASE_SLOT_WIDTH = 44;
3
+ export declare const CARTESIAN_BAR_SLOT_EXTRA_PER_SERIES = 22;
4
+ export declare const CARTESIAN_BAR_SLOT_EXTRA_MAX = 66;
5
+ export declare const CARTESIAN_LINE_SLOT_WIDTH = 48;
6
+ export declare const CARTESIAN_GAP = 14;
7
+ export declare const CARTESIAN_BAR_HEIGHT = 304;
8
+ export declare const CARTESIAN_LINE_HEIGHT = 320;
9
+ export declare const CARTESIAN_LABEL_ROTATION: Radians;
10
+ export declare const CARTESIAN_LABEL_MIN_WIDTH = 28;
11
+ export declare const CARTESIAN_LABEL_SLOT_PADDING = 4;
12
+ export declare const CARTESIAN_LABEL_AXIS_CLEARANCE = 2;
13
+ export declare const CARTESIAN_LABEL_MAX_WIDTH_BUFFER = 10;
14
+ export declare const CARTESIAN_LABEL_ROTATED_WIDTH_BUFFER = 10;
15
+ export declare const CARTESIAN_LABEL_OVERFLOW_PREFERENCE_BUFFER = 8;
16
+ export declare const BAR_GAP = 12;
17
+ export declare const BAR_HEIGHT = 256;
18
+ export declare const GRID_OPACITY = 10;
19
+ export declare const RADAR_GRID_LEVELS = 4;
20
+ export declare const RADAR_LABEL_OFFSET: number;
21
+ export declare const RADAR_PADDING: number;
22
+ export declare const RADAR_SINGLE_SERIES_LOG_SCALE_THRESHOLD = 100;
23
+ export declare const RADAR_AXIS_LABEL_MAX_WIDTH = 140;
24
+ export declare const RADAR_AXIS_LABEL_ALIGNMENT_THRESHOLD = 0.35;
25
+ export declare const RADAR_AXIS_LABEL_CLEARANCE: number;
26
+ export declare const RADAR_LEGEND_SWATCH_SIZE = 20;
27
+ export declare const RADAR_LEGEND_ITEM_GAP: number;
28
+ export declare const RADAR_LEGEND_TEXT_GAP = 12;
29
+ export declare const commonProps: {
30
+ readonly fillStyle: "hachure";
31
+ readonly fontFamily: number;
32
+ readonly fontSize: 20;
33
+ readonly opacity: 100;
34
+ readonly roughness: 1;
35
+ readonly strokeColor: "#1e1e1e";
36
+ readonly roundness: null;
37
+ readonly strokeStyle: "solid";
38
+ readonly strokeWidth: 1;
39
+ readonly verticalAlign: string;
40
+ readonly locked: false;
41
+ };
42
+ export type CartesianChartType = "bar" | "line";
43
+ export type CartesianChartLayout = {
44
+ slotWidth: number;
45
+ gap: number;
46
+ chartHeight: number;
47
+ xLabelMaxWidth: number;
48
+ };
@@ -0,0 +1,32 @@
1
+ import { getFontString } from "@excalidraw/common";
2
+ import type { ChartType } from "@excalidraw/element/types";
3
+ import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
4
+ import { type CartesianChartLayout, type CartesianChartType } from "./charts.constants";
5
+ import type { ChartElements, Spreadsheet, SpreadsheetSeries } from "./charts.types";
6
+ export declare const isSpreadsheetValidForChartType: (spreadsheet: Spreadsheet | null, chartType: ChartType) => boolean;
7
+ export declare const getCartesianChartLayout: (chartType: CartesianChartType, seriesCount: number) => CartesianChartLayout;
8
+ export declare const getChartDimensions: (spreadsheet: Spreadsheet, layout: CartesianChartLayout) => {
9
+ chartWidth: number;
10
+ chartHeight: number;
11
+ };
12
+ export declare const getRadarDimensions: () => {
13
+ chartWidth: number;
14
+ chartHeight: number;
15
+ };
16
+ export declare const getSeriesColors: (seriesCount: number, colorOffset: number) => readonly string[];
17
+ export declare const getColorOffset: (colorSeed?: number) => number;
18
+ export declare const getBackgroundColor: (colorOffset: number) => "#fff5f5" | "#ffc9c9" | "#ff8787" | "#fa5252" | "#e03131" | "#fff0f6" | "#fcc2d7" | "#f783ac" | "#e64980" | "#c2255c" | "#f8f0fc" | "#eebefa" | "#da77f2" | "#be4bdb" | "#9c36b5" | "#f3f0ff" | "#d0bfff" | "#9775fa" | "#7950f2" | "#6741d9" | "#e7f5ff" | "#a5d8ff" | "#4dabf7" | "#228be6" | "#1971c2" | "#e3fafc" | "#99e9f2" | "#3bc9db" | "#15aabf" | "#0c8599" | "#e6fcf5" | "#96f2d7" | "#38d9a9" | "#12b886" | "#099268" | "#ebfbee" | "#b2f2bb" | "#69db7c" | "#40c057" | "#2f9e44" | "#fff9db" | "#ffec99" | "#ffd43b" | "#fab005" | "#f08c00" | "#fff4e6" | "#ffd8a8" | "#ffa94d" | "#fd7e14" | "#e8590c";
19
+ export declare const getRadarValueScale: (series: SpreadsheetSeries[], _labelsLength: number) => {
20
+ renderSteps: boolean;
21
+ normalize: (value: number, _axisIndex: number) => number;
22
+ };
23
+ export declare const getRadarDisplayText: (text: string, fontString: ReturnType<typeof getFontString>, maxWidth: number) => string;
24
+ export declare const createRadarAxisLabels: (labels: readonly string[], angles: readonly number[], centerX: number, centerY: number, radius: number, backgroundColor: string) => {
25
+ axisLabels: ChartElements;
26
+ axisLabelTopY: number;
27
+ axisLabelBottomY: number;
28
+ };
29
+ export declare const createSeriesLegend: (series: SpreadsheetSeries[], seriesColors: readonly string[], centerX: number, minLegendTopY: number, fallbackLegendY: number, backgroundColor: string) => ChartElements;
30
+ export declare const getRotatedTextElementBottom: (element: NonDeletedExcalidrawElement) => number;
31
+ export declare const chartXLabels: (spreadsheet: Spreadsheet, x: number, y: number, backgroundColor: string, layout: CartesianChartLayout) => ChartElements;
32
+ export declare const chartBaseElements: (spreadsheet: Spreadsheet, x: number, y: number, backgroundColor: string, layout: CartesianChartLayout, maxValue?: number, debug?: boolean) => ChartElements;
@@ -0,0 +1,2 @@
1
+ import type { ChartElements, Spreadsheet } from "./charts.types";
2
+ export declare const renderLineChart: (spreadsheet: Spreadsheet, x: number, y: number, colorSeed?: number) => ChartElements;
@@ -0,0 +1,10 @@
1
+ import { type ParseSpreadsheetResult } from "./charts.types";
2
+ /**
3
+ * @private exported for testing
4
+ */
5
+ export declare const tryParseNumber: (s: string) => number | null;
6
+ /**
7
+ * @private exported for testing
8
+ */
9
+ export declare const tryParseCells: (cells: string[][]) => ParseSpreadsheetResult;
10
+ export declare const tryParseSpreadsheet: (text: string) => ParseSpreadsheetResult;
@@ -0,0 +1,2 @@
1
+ import type { ChartElements, Spreadsheet } from "./charts.types";
2
+ export declare const renderRadarChart: (spreadsheet: Spreadsheet, x: number, y: number, colorSeed?: number) => ChartElements | null;
@@ -0,0 +1,18 @@
1
+ import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
+ export type ChartElements = readonly NonDeletedExcalidrawElement[];
3
+ export interface Spreadsheet {
4
+ title: string | null;
5
+ labels: string[] | null;
6
+ series: SpreadsheetSeries[];
7
+ }
8
+ export interface SpreadsheetSeries {
9
+ title: string | null;
10
+ values: number[];
11
+ }
12
+ export type ParseSpreadsheetResult = {
13
+ ok: false;
14
+ reason: string;
15
+ } | {
16
+ ok: true;
17
+ data: Spreadsheet;
18
+ };
@@ -0,0 +1,7 @@
1
+ import type { ChartType } from "@excalidraw/element/types";
2
+ import { tryParseCells, tryParseNumber, tryParseSpreadsheet } from "./charts.parse";
3
+ import type { ChartElements, Spreadsheet } from "./charts.types";
4
+ export { type ParseSpreadsheetResult, type Spreadsheet, type SpreadsheetSeries, type ChartElements, } from "./charts.types";
5
+ export { isSpreadsheetValidForChartType } from "./charts.helpers";
6
+ export { tryParseCells, tryParseNumber, tryParseSpreadsheet };
7
+ export declare const renderSpreadsheet: (chartType: ChartType, spreadsheet: Spreadsheet, x: number, y: number, colorSeed?: number) => ChartElements | null;
@@ -3,14 +3,12 @@ import type { ValueOf } from "@excalidraw/common/utility-types";
3
3
  import type { IMAGE_MIME_TYPES, STRING_MIME_TYPES } from "@excalidraw/common";
4
4
  import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
5
5
  import type { FileSystemHandle } from "./data/filesystem";
6
- import type { Spreadsheet } from "./charts";
7
6
  import type { BinaryFiles } from "./types";
8
7
  export type PastedMixedContent = {
9
8
  type: "text" | "imageUrl";
10
9
  value: string;
11
10
  }[];
12
11
  export interface ClipboardData {
13
- spreadsheet?: Spreadsheet;
14
12
  elements?: readonly ExcalidrawElement[];
15
13
  files?: BinaryFiles;
16
14
  text?: string;
@@ -23,26 +21,16 @@ export declare const probablySupportsClipboardReadText: boolean;
23
21
  export declare const probablySupportsClipboardWriteText: boolean;
24
22
  export declare const probablySupportsClipboardBlob: boolean;
25
23
  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;
24
+ types?: { [key in AllowedPasteMimeTypes]?: string | File; };
25
+ files?: File[];
40
26
  }) => ClipboardEvent;
41
27
  export declare const serializeAsClipboardJSON: ({ elements, files, }: {
42
28
  elements: readonly NonDeletedExcalidrawElement[];
43
29
  files: BinaryFiles | null;
44
30
  }) => string;
45
- export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], files: BinaryFiles | null, clipboardEvent?: ClipboardEvent | null) => Promise<void>;
31
+ export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], files: BinaryFiles | null,
32
+ /** supply if available to make the operation more certain to succeed */
33
+ clipboardEvent?: ClipboardEvent | null) => Promise<void>;
46
34
  /**
47
35
  * Reads OS clipboard programmatically. May not work on all browsers.
48
36
  * Will prompt user for permission if not granted.
@@ -86,7 +74,7 @@ type ParsedDataTransferItemType<T extends AllowedParsedDataTransferItem["type"]>
86
74
  export type ParsedDataTransferFile = Extract<AllowedParsedDataTransferItem, {
87
75
  kind: "file";
88
76
  }>;
89
- type ParsedDataTranferList = ParsedDataTransferItem[] & {
77
+ export type ParsedDataTranferList = ParsedDataTransferItem[] & {
90
78
  /**
91
79
  * Only allows filtering by known `string` data types, since `file`
92
80
  * types can have multiple items of the same type (e.g. multiple image files)
@@ -101,29 +89,17 @@ type ParsedDataTranferList = ParsedDataTransferItem[] & {
101
89
  getData: typeof getDataTransferItemData;
102
90
  getFiles: typeof getDataTransferFiles;
103
91
  };
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;
92
+ declare const findDataTransferItemType: <T extends ValueOf<typeof STRING_MIME_TYPES>>(this: ParsedDataTranferList, type: T) => ParsedDataTransferItemType<T> | null;
93
+ declare const getDataTransferItemData: <T extends ValueOf<typeof STRING_MIME_TYPES>>(this: ParsedDataTranferList, type: T) => ParsedDataTransferItemType<ValueOf<typeof STRING_MIME_TYPES>>["value"] | null;
120
94
  declare const getDataTransferFiles: (this: ParsedDataTranferList) => ParsedDataTransferFile[];
95
+ /** @returns list of MIME types, synchronously */
96
+ export declare const parseDataTransferEventMimeTypes: (event: ClipboardEvent | DragEvent | React.DragEvent<HTMLDivElement>) => Set<string>;
121
97
  export declare const parseDataTransferEvent: (event: ClipboardEvent | DragEvent | React.DragEvent<HTMLDivElement>) => Promise<ParsedDataTranferList>;
122
98
  /**
123
99
  * Attempts to parse clipboard event.
124
100
  */
125
101
  export declare const parseClipboard: (dataList: ParsedDataTranferList, isPlainPaste?: boolean) => Promise<ClipboardData>;
126
102
  export declare const copyBlobToClipboardAsPng: (blob: Blob | Promise<Blob>) => Promise<void>;
127
- export declare const copyTextToSystemClipboard: (text: string | null, clipboardEvent?: ClipboardEvent | null) => Promise<void>;
103
+ export declare const copyTextToSystemClipboard: <MimeType extends ValueOf<typeof STRING_MIME_TYPES>>(text: string | { [K in MimeType]: string; } | null, clipboardEvent?: ClipboardEvent | null) => Promise<void>;
128
104
  export declare const isClipboardEvent: (event: React.SyntheticEvent | Event) => event is ClipboardEvent;
129
105
  export {};
@@ -36,9 +36,12 @@ 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
- export declare const ExitZenModeAction: ({ actionManager, showExitZenModeBtn, }: {
41
+ export declare const ExitZenModeButton: ({ actionManager, showExitZenModeBtn, }: {
42
42
  actionManager: ActionManager;
43
43
  showExitZenModeBtn: boolean;
44
44
  }) => import("react/jsx-runtime").JSX.Element;
45
+ export declare const ExitViewModeButton: ({ actionManager, }: {
46
+ actionManager: ActionManager;
47
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { type EXPORT_IMAGE_TYPES, Emitter } from "@excalidraw/common";
2
+ import { type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@excalidraw/common";
3
3
  import { LinearElementEditor, FlowChartCreator, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@excalidraw/element";
4
4
  import type { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
5
5
  import type { Mutable } from "@excalidraw/common/utility-types";
@@ -10,11 +10,12 @@ 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";
16
17
  import type { FileSystemHandle } from "../data/filesystem";
17
- import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, GenerateDiagramToCode, NullableGridSize, Offsets } from "../types";
18
+ import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, GenerateDiagramToCode, NullableGridSize, Offsets } from "../types";
18
19
  import type { RoughCanvas } from "roughjs/bin/canvas";
19
20
  import type { ActionResult } from "../actions/types";
20
21
  export declare const ExcalidrawContainerContext: React.Context<{
@@ -23,17 +24,18 @@ export declare const ExcalidrawContainerContext: React.Context<{
23
24
  }>;
24
25
  export declare const useApp: () => AppClassProperties;
25
26
  export declare const useAppProps: () => AppProps;
26
- export declare const useDevice: () => Readonly<{
27
- viewport: {
28
- isMobile: boolean;
29
- isLandscape: boolean;
30
- };
31
- editor: {
32
- isMobile: boolean;
33
- canFitSidebar: boolean;
34
- };
27
+ export declare const useEditorInterface: () => Readonly<{
28
+ formFactor: "phone" | "tablet" | "desktop";
29
+ desktopUIMode: "compact" | "full";
30
+ userAgent: Readonly<{
31
+ isMobileDevice: boolean;
32
+ platform: "ios" | "android" | "other" | "unknown";
33
+ }>;
35
34
  isTouchScreen: boolean;
35
+ canFitSidebar: boolean;
36
+ isLandscape: boolean;
36
37
  }>;
38
+ export declare const useStylesPanelMode: () => StylesPanelMode;
37
39
  export declare const useExcalidrawContainer: () => {
38
40
  container: HTMLDivElement | null;
39
41
  id: string | null;
@@ -48,14 +50,14 @@ declare class App extends React.Component<AppProps, AppState> {
48
50
  rc: RoughCanvas;
49
51
  unmounted: boolean;
50
52
  actionManager: ActionManager;
51
- device: Device;
53
+ editorInterface: EditorInterface;
54
+ private stylesPanelMode;
52
55
  private excalidrawContainerRef;
53
56
  scene: Scene;
54
57
  fonts: Fonts;
55
58
  renderer: Renderer;
56
59
  visibleElements: readonly NonDeletedExcalidrawElement[];
57
60
  private resizeObserver;
58
- private nearestScrollableContainer;
59
61
  library: AppClassProperties["library"];
60
62
  libraryItemsFromStorage: LibraryItems | undefined;
61
63
  id: string;
@@ -82,14 +84,21 @@ declare class App extends React.Component<AppProps, AppState> {
82
84
  private elementsPendingErasure;
83
85
  flowChartCreator: FlowChartCreator;
84
86
  private flowChartNavigator;
87
+ bindModeHandler: ReturnType<typeof setTimeout> | null;
85
88
  hitLinkElement?: NonDeletedExcalidrawElement;
86
89
  lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
87
90
  lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
88
91
  lastPointerMoveEvent: PointerEvent | null;
92
+ /** current frame pointer cords */
89
93
  lastPointerMoveCoords: {
90
94
  x: number;
91
95
  y: number;
92
96
  } | null;
97
+ /** previous frame pointer coords */
98
+ previousPointerMoveCoords: {
99
+ x: number;
100
+ y: number;
101
+ } | null;
93
102
  lastViewportPosition: {
94
103
  x: number;
95
104
  y: number;
@@ -112,11 +121,7 @@ declare class App extends React.Component<AppProps, AppState> {
112
121
  x: number;
113
122
  y: number;
114
123
  }>;
115
- scrollbars: {
116
- isOverEither: boolean;
117
- isOverHorizontal: boolean;
118
- isOverVertical: boolean;
119
- };
124
+ scrollbars: ReturnType<typeof isOverScrollBars>;
120
125
  lastCoords: {
121
126
  x: number;
122
127
  y: number;
@@ -129,7 +134,7 @@ declare class App extends React.Component<AppProps, AppState> {
129
134
  x: number;
130
135
  y: number;
131
136
  };
132
- arrowDirection: "end" | "origin";
137
+ arrowDirection: "origin" | "end";
133
138
  center: {
134
139
  x: number;
135
140
  y: number;
@@ -156,14 +161,10 @@ declare class App extends React.Component<AppProps, AppState> {
156
161
  blockDragging: boolean;
157
162
  };
158
163
  eventListeners: {
159
- onMove: {
160
- (...args: any[]): void;
161
- flush(): void;
162
- cancel(): void;
163
- } | null;
164
- onUp: ((event: PointerEvent) => void) | null;
165
- onKeyDown: ((event: KeyboardEvent) => void) | null;
166
- onKeyUp: ((event: KeyboardEvent) => void) | null;
164
+ onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
165
+ onUp: null | ((event: PointerEvent) => void);
166
+ onKeyDown: null | ((event: KeyboardEvent) => void);
167
+ onKeyUp: null | ((event: KeyboardEvent) => void);
167
168
  };
168
169
  boxSelection: {
169
170
  hasOccurred: boolean;
@@ -182,11 +183,7 @@ declare class App extends React.Component<AppProps, AppState> {
182
183
  x: number;
183
184
  y: number;
184
185
  }>;
185
- scrollbars: {
186
- isOverEither: boolean;
187
- isOverHorizontal: boolean;
188
- isOverVertical: boolean;
189
- };
186
+ scrollbars: ReturnType<typeof isOverScrollBars>;
190
187
  lastCoords: {
191
188
  x: number;
192
189
  y: number;
@@ -199,7 +196,7 @@ declare class App extends React.Component<AppProps, AppState> {
199
196
  x: number;
200
197
  y: number;
201
198
  };
202
- arrowDirection: "end" | "origin";
199
+ arrowDirection: "origin" | "end";
203
200
  center: {
204
201
  x: number;
205
202
  y: number;
@@ -226,14 +223,10 @@ declare class App extends React.Component<AppProps, AppState> {
226
223
  blockDragging: boolean;
227
224
  };
228
225
  eventListeners: {
229
- onMove: {
230
- (...args: any[]): void;
231
- flush(): void;
232
- cancel(): void;
233
- } | null;
234
- onUp: ((event: PointerEvent) => void) | null;
235
- onKeyDown: ((event: KeyboardEvent) => void) | null;
236
- onKeyUp: ((event: KeyboardEvent) => void) | null;
226
+ onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
227
+ onUp: null | ((event: PointerEvent) => void);
228
+ onKeyDown: null | ((event: KeyboardEvent) => void);
229
+ onKeyUp: null | ((event: KeyboardEvent) => void);
237
230
  };
238
231
  boxSelection: {
239
232
  hasOccurred: boolean;
@@ -248,6 +241,10 @@ declare class App extends React.Component<AppProps, AppState> {
248
241
  constructor(props: AppProps);
249
242
  updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
250
243
  private onWindowMessage;
244
+ private handleSkipBindMode;
245
+ private resetDelayedBindMode;
246
+ private previousHoveredBindableElement;
247
+ private handleDelayedBindModeChange;
251
248
  private cacheEmbeddableRef;
252
249
  /**
253
250
  * Returns gridSize taking into account `gridModeEnabled`.
@@ -255,7 +252,9 @@ declare class App extends React.Component<AppProps, AppState> {
255
252
  */
256
253
  getEffectiveGridSize: () => NullableGridSize;
257
254
  private getHTMLIFrameElement;
258
- private handleEmbeddableCenterClick;
255
+ private handleIframeLikeElementHover;
256
+ /** @returns true if iframe-like element click handled */
257
+ private handleIframeLikeCenterClick;
259
258
  private isIframeLikeElementCenter;
260
259
  private updateEmbedValidationStatus;
261
260
  private updateEmbeddables;
@@ -268,7 +267,7 @@ declare class App extends React.Component<AppProps, AppState> {
268
267
  render(): import("react/jsx-runtime").JSX.Element;
269
268
  focusContainer: AppClassProperties["focusContainer"];
270
269
  getSceneElementsIncludingDeleted: () => readonly import("@excalidraw/element/types").OrderedExcalidrawElement[];
271
- getSceneElementsMapIncludingDeleted: () => Map<string, Ordered<ExcalidrawElement>> & import("@excalidraw/common/utility-types").MakeBrand<"SceneElementsMap">;
270
+ getSceneElementsMapIncludingDeleted: () => SceneElementsMap;
272
271
  getSceneElements: () => readonly Ordered<NonDeletedExcalidrawElement>[];
273
272
  onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
274
273
  onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
@@ -299,10 +298,11 @@ declare class App extends React.Component<AppProps, AppState> {
299
298
  */
300
299
  private resetScene;
301
300
  private initializeScene;
302
- private isMobileBreakpoint;
303
- private isTabletBreakpoint;
304
- private refreshViewportBreakpoints;
305
- private refreshEditorBreakpoints;
301
+ private getFormFactor;
302
+ refreshEditorInterface: () => void;
303
+ private reconcileStylesPanelMode;
304
+ /** TO BE USED LATER */
305
+ private setDesktopUIMode;
306
306
  private clearImageShapeCache;
307
307
  componentDidMount(): Promise<void>;
308
308
  componentWillUnmount(): void;
@@ -336,20 +336,27 @@ declare class App extends React.Component<AppProps, AppState> {
336
336
  setAppState: React.Component<any, AppState>["setState"];
337
337
  removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
338
338
  toggleLock: (source?: "keyboard" | "ui") => void;
339
- updateFrameRendering: (opts: Partial<{
340
- enabled: boolean;
341
- name: boolean;
342
- outline: boolean;
343
- clip: boolean;
344
- }> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
339
+ updateFrameRendering: (opts: Partial<AppState["frameRendering"]> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
345
340
  togglePenMode: (force: boolean | null) => void;
346
341
  onHandToolToggle: () => void;
347
342
  /**
348
343
  * Zooms on canvas viewport center
349
344
  */
350
- zoomCanvas: (value: number) => void;
345
+ zoomCanvas: (
346
+ /**
347
+ * Decimal fraction, auto-clamped between MIN_ZOOM and MAX_ZOOM.
348
+ * 1 = 100% zoom, 2 = 200% zoom, 0.5 = 50% zoom
349
+ */
350
+ value: number) => void;
351
351
  private cancelInProgressAnimation;
352
- scrollToContent: (target?: string | ExcalidrawElement | readonly ExcalidrawElement[], opts?: ({
352
+ scrollToContent: (
353
+ /**
354
+ * target to scroll to
355
+ *
356
+ * - string - id of element or group, or url containing elementLink
357
+ * - ExcalidrawElement | ExcalidrawElement[] - element(s) objects
358
+ */
359
+ target?: string | ExcalidrawElement | readonly ExcalidrawElement[], opts?: ({
353
360
  fitToContent?: boolean;
354
361
  fitToViewport?: never;
355
362
  viewportZoomFactor?: number;
@@ -386,7 +393,7 @@ declare class App extends React.Component<AppProps, AppState> {
386
393
  private addMissingFiles;
387
394
  updateScene: <K extends keyof AppState>(sceneData: {
388
395
  elements?: SceneData["elements"];
389
- appState?: Pick<AppState, K> | null | undefined;
396
+ appState?: Pick<AppState, K> | null;
390
397
  collaborators?: SceneData["collaborators"];
391
398
  /**
392
399
  * 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.
@@ -409,8 +416,8 @@ declare class App extends React.Component<AppProps, AppState> {
409
416
  */
410
417
  toggleSidebar: ({ name, tab, force, }: {
411
418
  name: SidebarName | null;
412
- tab?: string | undefined;
413
- force?: boolean | undefined;
419
+ tab?: SidebarTabName;
420
+ force?: boolean;
414
421
  }) => boolean;
415
422
  private updateCurrentCursorPosition;
416
423
  getEditorUIOffsets: () => Offsets;
@@ -453,7 +460,7 @@ declare class App extends React.Component<AppProps, AppState> {
453
460
  private finishImageCropping;
454
461
  private handleCanvasDoubleClick;
455
462
  private getElementLinkAtPosition;
456
- private redirectToLink;
463
+ private handleElementLinkClick;
457
464
  private getTopLayerFrameAtSceneCoords;
458
465
  private handleCanvasPointerMove;
459
466
  private handleEraser;
@@ -525,7 +532,6 @@ declare class App extends React.Component<AppProps, AppState> {
525
532
  * to render new images. This is just a failsafe */
526
533
  private scheduleImageRefresh;
527
534
  private updateBindingEnabledOnPointerMove;
528
- private maybeSuggestBindingAtCursor;
529
535
  private clearSelection;
530
536
  private handleInteractiveCanvasRef;
531
537
  private insertImages;
@@ -543,6 +549,7 @@ declare class App extends React.Component<AppProps, AppState> {
543
549
  private updateDOMRect;
544
550
  refresh: () => void;
545
551
  private getCanvasOffsets;
552
+ watchState: () => void;
546
553
  private updateLanguage;
547
554
  }
548
555
  declare global {
@@ -552,6 +559,7 @@ declare global {
552
559
  elements: readonly ExcalidrawElement[];
553
560
  state: AppState;
554
561
  setState: React.Component<any, AppState>["setState"];
562
+ watchState: (prev: any, next: any) => void | undefined;
555
563
  app: InstanceType<typeof App>;
556
564
  history: History;
557
565
  store: Store;
@@ -1,7 +1,5 @@
1
- /// <reference types="react" />
2
- import OpenColor from "open-color";
3
1
  import "./Card.scss";
4
2
  export declare const Card: React.FC<{
5
- color: keyof OpenColor | "primary";
3
+ color: "primary" | "lime" | "pink";
6
4
  children?: React.ReactNode;
7
5
  }>;
@@ -1,10 +1,8 @@
1
1
  import type { ColorPickerType } from "./colorPickerUtils";
2
- interface ColorInputProps {
2
+ export declare const ColorInput: ({ color, onChange, label, colorPickerType, placeholder, }: {
3
3
  color: string;
4
4
  onChange: (color: string) => void;
5
5
  label: string;
6
6
  colorPickerType: ColorPickerType;
7
7
  placeholder?: string;
8
- }
9
- export declare const ColorInput: ({ color, onChange, label, colorPickerType, placeholder, }: ColorInputProps) => import("react/jsx-runtime").JSX.Element;
10
- export {};
8
+ }) => 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
  /**
@@ -18,7 +17,6 @@ interface ColorPickerProps {
18
17
  palette?: ColorPaletteCustom | null;
19
18
  topPicks?: ColorTuple;
20
19
  updateData: (formData?: any) => void;
21
- compactMode?: boolean;
22
20
  }
23
21
  export declare const ColorPicker: ({ type, color, onChange, label, elements, palette, topPicks, updateData, appState, }: ColorPickerProps) => import("react/jsx-runtime").JSX.Element;
24
22
  export {};
@@ -17,5 +17,4 @@ export type ActiveColorPickerSectionAtomType = "custom" | "baseColors" | "shades
17
17
  export declare const activeColorPickerSectionAtom: import("jotai/vanilla/atom").PrimitiveAtom<ActiveColorPickerSectionAtomType> & {
18
18
  init: ActiveColorPickerSectionAtomType;
19
19
  };
20
- export declare const isColorDark: (color: string, threshold?: number) => boolean;
21
20
  export type ColorPickerType = "canvasBackground" | "elementBackground" | "elementStroke";
@@ -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,7 +1,5 @@
1
- /// <reference types="react" />
2
1
  import type { ActionManager } from "../../actions/manager";
3
2
  import type { Action } from "../../actions/types";
4
- import type { UIAppState } from "../../types";
5
3
  export type CommandPaletteItem = {
6
4
  label: string;
7
5
  /** additional keywords to match against
@@ -12,11 +10,11 @@ export type CommandPaletteItem = {
12
10
  * (deburred name + keywords)
13
11
  */
14
12
  haystack?: string;
15
- icon?: React.ReactNode | ((appState: UIAppState) => React.ReactNode);
13
+ icon?: Action["icon"];
16
14
  category: string;
17
15
  order?: number;
18
16
  predicate?: boolean | Action["predicate"];
19
- shortcut?: string;
17
+ shortcut?: string | null;
20
18
  /** if false, command will not show while in view mode */
21
19
  viewMode?: boolean;
22
20
  perform: (data: {
@@ -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;