@excalidraw/common 0.18.0-b2b2815 → 0.18.0-b55c9ee

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 (251) hide show
  1. package/dist/dev/index.js +239 -104
  2. package/dist/dev/index.js.map +3 -3
  3. package/dist/prod/index.js +3 -3
  4. package/dist/types/common/src/colors.d.ts +23 -1
  5. package/dist/types/common/src/constants.d.ts +70 -7
  6. package/dist/types/common/src/keys.d.ts +6 -0
  7. package/dist/types/common/src/points.d.ts +1 -1
  8. package/dist/types/common/src/random.d.ts +7 -0
  9. package/dist/types/common/src/utils.d.ts +13 -44
  10. package/dist/types/element/src/Scene.d.ts +2 -2
  11. package/dist/types/element/src/align.d.ts +5 -2
  12. package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
  13. package/dist/types/element/src/arrows/focus.d.ts +5 -2
  14. package/dist/types/element/src/binding.d.ts +90 -13
  15. package/dist/types/element/src/bounds.d.ts +28 -7
  16. package/dist/types/element/src/bucketFill.d.ts +110 -0
  17. package/dist/types/element/src/collision.d.ts +21 -5
  18. package/dist/types/element/src/comparisons.d.ts +8 -5
  19. package/dist/types/element/src/convertToShape.d.ts +23 -0
  20. package/dist/types/element/src/cropElement.d.ts +36 -4
  21. package/dist/types/element/src/delta.d.ts +30 -2
  22. package/dist/types/element/src/distribute.d.ts +5 -2
  23. package/dist/types/element/src/dragElements.d.ts +34 -2
  24. package/dist/types/element/src/duplicate.d.ts +63 -3
  25. package/dist/types/element/src/elbowArrow.d.ts +5 -0
  26. package/dist/types/element/src/embeddable.d.ts +3 -2
  27. package/dist/types/element/src/flowchart.d.ts +9 -11
  28. package/dist/types/element/src/fractionalIndex.d.ts +2 -2
  29. package/dist/types/element/src/frame.d.ts +25 -7
  30. package/dist/types/element/src/groups.d.ts +10 -15
  31. package/dist/types/element/src/image.d.ts +5 -2
  32. package/dist/types/element/src/index.d.ts +7 -1
  33. package/dist/types/element/src/linearElementEditor.d.ts +31 -11
  34. package/dist/types/element/src/listMarker.d.ts +39 -0
  35. package/dist/types/element/src/mutateElement.d.ts +1 -1
  36. package/dist/types/element/src/newElement.d.ts +55 -3
  37. package/dist/types/element/src/renderElement.d.ts +31 -7
  38. package/dist/types/element/src/renderEnvironment.d.ts +66 -0
  39. package/dist/types/element/src/resizeElements.d.ts +14 -4
  40. package/dist/types/element/src/selection.d.ts +7 -13
  41. package/dist/types/element/src/shape.d.ts +29 -1
  42. package/dist/types/element/src/sizeHelpers.d.ts +6 -0
  43. package/dist/types/element/src/sortElements.d.ts +10 -0
  44. package/dist/types/element/src/stickyNote.d.ts +191 -0
  45. package/dist/types/element/src/textElement.d.ts +22 -10
  46. package/dist/types/element/src/textMeasurements.d.ts +15 -11
  47. package/dist/types/element/src/textWrapping.d.ts +3 -2
  48. package/dist/types/element/src/transform.d.ts +31 -8
  49. package/dist/types/element/src/typeChecks.d.ts +28 -27
  50. package/dist/types/element/src/types.d.ts +43 -7
  51. package/dist/types/element/src/utils.d.ts +15 -4
  52. package/dist/types/element/src/zindex.d.ts +2 -2
  53. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +95 -15
  54. package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
  55. package/dist/types/excalidraw/actions/actionBoundText.d.ts +78 -202
  56. package/dist/types/excalidraw/actions/actionCanvas.d.ts +299 -939
  57. package/dist/types/excalidraw/actions/actionClipboard.d.ts +66 -10
  58. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +33 -5
  59. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -518
  60. package/dist/types/excalidraw/actions/actionDeselect.d.ts +33 -5
  61. package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
  62. package/dist/types/excalidraw/actions/actionElementLink.d.ts +33 -5
  63. package/dist/types/excalidraw/actions/actionElementLock.d.ts +67 -11
  64. package/dist/types/excalidraw/actions/actionExport.d.ts +74 -18
  65. package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
  66. package/dist/types/excalidraw/actions/actionFrame.d.ts +129 -648
  67. package/dist/types/excalidraw/actions/actionGroup.d.ts +81 -25
  68. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +88 -8
  69. package/dist/types/excalidraw/actions/actionLink.d.ts +34 -6
  70. package/dist/types/excalidraw/actions/actionMenu.d.ts +33 -5
  71. package/dist/types/excalidraw/actions/actionProperties.d.ts +104 -32
  72. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +38 -10
  73. package/dist/types/excalidraw/actions/actionStyles.d.ts +30 -6
  74. package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +452 -6
  75. package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +34 -6
  76. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +37 -10
  77. package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +34 -6
  78. package/dist/types/excalidraw/actions/actionToggleMinimap.d.ts +205 -0
  79. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +34 -6
  80. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +37 -10
  81. package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
  82. package/dist/types/excalidraw/actions/{actionEmbeddable.d.ts → actionToggleShowHints.d.ts} +49 -18
  83. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +34 -6
  84. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +35 -7
  85. package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
  86. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +34 -6
  87. package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
  88. package/dist/types/excalidraw/actions/index.d.ts +4 -2
  89. package/dist/types/excalidraw/actions/manager.d.ts +1 -0
  90. package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
  91. package/dist/types/excalidraw/actions/types.d.ts +8 -4
  92. package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
  93. package/dist/types/excalidraw/appState.d.ts +36 -12
  94. package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -1
  95. package/dist/types/excalidraw/charts/charts.helpers.d.ts +6 -5
  96. package/dist/types/excalidraw/charts/charts.line.d.ts +2 -1
  97. package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -1
  98. package/dist/types/excalidraw/charts/index.d.ts +2 -1
  99. package/dist/types/excalidraw/components/Actions.d.ts +26 -13
  100. package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
  101. package/dist/types/excalidraw/components/App.arrowText.d.ts +70 -0
  102. package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
  103. package/dist/types/excalidraw/components/App.clipboard.d.ts +59 -0
  104. package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
  105. package/dist/types/excalidraw/components/App.d.ts +329 -114
  106. package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
  107. package/dist/types/excalidraw/components/App.duplicate.d.ts +101 -0
  108. package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
  109. package/dist/types/excalidraw/components/App.host.d.ts +102 -0
  110. package/dist/types/excalidraw/components/App.modifiers.d.ts +38 -0
  111. package/dist/types/excalidraw/components/App.pan.d.ts +62 -0
  112. package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
  113. package/dist/types/excalidraw/components/App.selectionTool.d.ts +94 -0
  114. package/dist/types/excalidraw/components/App.text.d.ts +194 -0
  115. package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
  116. package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
  117. package/dist/types/excalidraw/components/App.viewport.d.ts +133 -0
  118. package/dist/types/excalidraw/components/App.wheel.d.ts +30 -0
  119. package/dist/types/excalidraw/components/App.wrap.d.ts +39 -0
  120. package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -3
  121. package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
  122. package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +5 -1
  123. package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +9 -2
  124. package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +4 -2
  125. package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
  126. package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
  127. package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
  128. package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -1
  129. package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
  130. package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +4 -3
  131. package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
  132. package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
  133. package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
  134. package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +4 -1
  135. package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
  136. package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
  137. package/dist/types/excalidraw/components/IconButton.d.ts +48 -0
  138. package/dist/types/excalidraw/components/Island.d.ts +7 -0
  139. package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
  140. package/dist/types/excalidraw/components/LayerUI.d.ts +5 -2
  141. package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
  142. package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +6 -2
  143. package/dist/types/excalidraw/components/LibraryUnit.d.ts +7 -2
  144. package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
  145. package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
  146. package/dist/types/excalidraw/components/Minimap/Minimap.d.ts +15 -0
  147. package/dist/types/excalidraw/components/Minimap/MinimapAnnouncementDot.d.ts +10 -0
  148. package/dist/types/excalidraw/components/Minimap/minimap-controller.chunk.d.ts +90 -0
  149. package/dist/types/excalidraw/components/Minimap/minimap-shared.chunk.d.ts +122 -0
  150. package/dist/types/excalidraw/components/Minimap/minimap-worker.chunk.d.ts +12 -0
  151. package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
  152. package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
  153. package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
  154. package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
  155. package/dist/types/excalidraw/components/Popover.d.ts +1 -3
  156. package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
  157. package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
  158. package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
  159. package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
  160. package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
  161. package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
  162. package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -2
  163. package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
  164. package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
  165. package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
  166. package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
  167. package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -2
  168. package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +2 -1
  169. package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +4 -4
  170. package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +5 -2
  171. package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +5 -2
  172. package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +2 -1
  173. package/dist/types/excalidraw/components/TTDDialog/common.d.ts +4 -1
  174. package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +3 -2
  175. package/dist/types/excalidraw/components/TTDDialog/types.d.ts +14 -1
  176. package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +3 -3
  177. package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +16 -0
  178. package/dist/types/excalidraw/components/Toast.d.ts +12 -1
  179. package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
  180. package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
  181. package/dist/types/excalidraw/components/Tools.d.ts +151 -0
  182. package/dist/types/excalidraw/components/Tooltip.d.ts +26 -2
  183. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
  184. package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
  185. package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
  186. package/dist/types/excalidraw/components/UserList.d.ts +3 -2
  187. package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
  188. package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -1
  189. package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +2 -0
  190. package/dist/types/excalidraw/components/footer/Footer.d.ts +5 -1
  191. package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
  192. package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +15 -4
  193. package/dist/types/excalidraw/components/icons.d.ts +8 -1
  194. package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +10 -4
  195. package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
  196. package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
  197. package/dist/types/excalidraw/data/EditorLocalStorage.d.ts +8 -4
  198. package/dist/types/excalidraw/data/blob.d.ts +82 -26
  199. package/dist/types/excalidraw/data/index.d.ts +7 -7
  200. package/dist/types/excalidraw/data/json.d.ts +47 -19
  201. package/dist/types/excalidraw/data/library.d.ts +1 -1
  202. package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
  203. package/dist/types/excalidraw/eraser/index.d.ts +2 -3
  204. package/dist/types/excalidraw/fonts/Fonts.d.ts +12 -8
  205. package/dist/types/excalidraw/history.d.ts +10 -4
  206. package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
  207. package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
  208. package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
  209. package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
  210. package/dist/types/excalidraw/lasso/index.d.ts +2 -3
  211. package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
  212. package/dist/types/excalidraw/mermaid.d.ts +7 -0
  213. package/dist/types/excalidraw/reactUtils.d.ts +1 -1
  214. package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
  215. package/dist/types/excalidraw/renderer/animation.d.ts +15 -4
  216. package/dist/types/excalidraw/renderer/helpers.d.ts +25 -0
  217. package/dist/types/excalidraw/renderer/interactiveScene.d.ts +2 -4
  218. package/dist/types/excalidraw/renderer/staticScene.d.ts +11 -6
  219. package/dist/types/excalidraw/scene/Renderer.d.ts +76 -13
  220. package/dist/types/excalidraw/scene/export.d.ts +344 -21
  221. package/dist/types/excalidraw/scene/index.d.ts +2 -2
  222. package/dist/types/excalidraw/scene/types.d.ts +30 -5
  223. package/dist/types/excalidraw/snapping.d.ts +7 -7
  224. package/dist/types/excalidraw/types.d.ts +608 -28
  225. package/dist/types/excalidraw/viewport.d.ts +307 -0
  226. package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +13 -3
  227. package/dist/types/laser-pointer/src/index.d.ts +2 -0
  228. package/dist/types/laser-pointer/src/math.d.ts +16 -0
  229. package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
  230. package/dist/types/laser-pointer/src/state.d.ts +36 -0
  231. package/dist/types/math/src/curve.d.ts +19 -12
  232. package/dist/types/math/src/index.d.ts +1 -0
  233. package/dist/types/math/src/pca.d.ts +79 -0
  234. package/dist/types/math/src/point.d.ts +1 -0
  235. package/dist/types/math/src/polygon.d.ts +25 -1
  236. package/dist/types/math/src/segment.d.ts +6 -0
  237. package/dist/types/utils/src/index.d.ts +4 -3
  238. package/dist/types/utils/src/shape.d.ts +2 -2
  239. package/package.json +1 -1
  240. package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
  241. package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
  242. package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
  243. package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -10
  244. package/dist/types/excalidraw/components/ToolButton.d.ts +0 -49
  245. package/dist/types/excalidraw/components/shapes.d.ts +0 -270
  246. package/dist/types/excalidraw/cursor.d.ts +0 -5
  247. package/dist/types/excalidraw/scene/scroll.d.ts +0 -18
  248. package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
  249. package/dist/types/utils/src/bbox.d.ts +0 -9
  250. package/dist/types/utils/src/export.d.ts +0 -35
  251. package/dist/types/utils/src/withinBounds.d.ts +0 -19
@@ -1,5 +1,4 @@
1
- import { type AnimationFrameHandler } from "../animation-frame-handler";
2
- import { AnimatedTrail } from "../animated-trail";
1
+ import { AnimatedTrail } from "../animatedTrail";
3
2
  import type App from "../components/App";
4
3
  export declare class LassoTrail extends AnimatedTrail {
5
4
  private intersectedElements;
@@ -7,7 +6,7 @@ export declare class LassoTrail extends AnimatedTrail {
7
6
  private elementsSegments;
8
7
  private canvasTranslate;
9
8
  private keepPreviousSelection;
10
- constructor(animationFrameHandler: AnimationFrameHandler, app: App);
9
+ constructor(app: App);
11
10
  startPath(x: number, y: number, keepPreviousSelection?: boolean): void;
12
11
  selectElementsFromIds: (ids: string[]) => void;
13
12
  addPointToPath: (x: number, y: number, keepPreviousSelection?: boolean) => void;
@@ -1,5 +1,6 @@
1
1
  import type { ElementsSegmentsMap, GlobalPoint } from "@excalidraw/math/types";
2
2
  import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
3
+ import type { BoxSelectionMode } from "../types";
3
4
  export declare const getLassoSelectedElementIds: (input: {
4
5
  lassoPath: GlobalPoint[];
5
6
  elements: readonly ExcalidrawElement[];
@@ -8,6 +9,7 @@ export declare const getLassoSelectedElementIds: (input: {
8
9
  intersectedElements: Set<ExcalidrawElement["id"]>;
9
10
  enclosedElements: Set<ExcalidrawElement["id"]>;
10
11
  simplifyDistance?: number;
12
+ mode?: BoxSelectionMode;
11
13
  }) => {
12
14
  selectedElementIds: string[];
13
15
  };
@@ -1,2 +1,9 @@
1
+ import type { MermaidConfig } from "@excalidraw/mermaid-to-excalidraw";
2
+ /**
3
+ * How Mermaid diagrams are converted: flowchart edges as elbow arrows, which
4
+ * are easier to edit (unless the definition sets its own curve in its front
5
+ * matter or `%%{init}%%`).
6
+ */
7
+ export declare const MERMAID_TO_EXCALIDRAW_CONFIG: MermaidConfig;
1
8
  /** heuristically checks whether the text may be a mermaid diagram definition */
2
9
  export declare const isMaybeMermaidDefinition: (text: string) => boolean;
@@ -6,7 +6,7 @@ export declare const withBatchedUpdates: <TFunction extends ((event: any) => voi
6
6
  * barches React state updates and throttles the calls to a single call per
7
7
  * animation frame
8
8
  */
9
- export declare const withBatchedUpdatesThrottled: <TFunction extends ((event: any) => void) | (() => void)>(func: Parameters<TFunction>["length"] extends 0 | 1 ? TFunction : never) => {
9
+ export declare const withBatchedUpdatesThrottled: <TFunction extends ((event: any) => void) | (() => void)>(func: Parameters<TFunction>["length"] extends 0 | 1 ? TFunction : never, ownerWindow?: Window) => {
10
10
  (...args: Parameters<TFunction>): void;
11
11
  flush(): void;
12
12
  cancel(): void;
@@ -0,0 +1,9 @@
1
+ import type { ElementRenderOffsets, ElementRenderOverrides } from "./types";
2
+ /** Validate and copy before publishing, so a rejected snapshot changes nothing. */
3
+ export declare const copyElementRenderOverrides: (overrides: ElementRenderOverrides | null) => ElementRenderOverrides;
4
+ /**
5
+ * Extracts the offsets of a snapshot, returning `previous` when they are the
6
+ * same. Visibility is memoized on this map's identity, so a snapshot that only
7
+ * changes opacities (a fade) never re-runs viewport geometry.
8
+ */
9
+ export declare const getElementRenderOffsets: (overrides: ElementRenderOverrides, previous: ElementRenderOffsets) => ElementRenderOffsets;
@@ -1,12 +1,23 @@
1
+ /** String keys are shared process-wide; symbols are created per owning
2
+ * instance, which lets concurrent instances run the same named animation
3
+ * independently. */
4
+ export type AnimationKey = string | symbol;
1
5
  export type Animation<R extends object> = (params: {
2
6
  deltaTime: number;
3
7
  state?: R;
4
8
  }) => R | null | undefined;
9
+ export type AnimationScheduler = Pick<Window, "requestAnimationFrame" | "cancelAnimationFrame" | "setTimeout" | "clearTimeout">;
5
10
  export declare class AnimationController {
6
- private static isRunning;
11
+ private static scheduledFrames;
7
12
  private static animations;
8
- static start<R extends object>(key: string, animation: Animation<R>): void;
13
+ private static readonly schedulerCleanups;
14
+ static start<R extends object>(key: AnimationKey, animation: Animation<R>, scheduler?: AnimationScheduler): void;
15
+ private static scheduleNextFrame;
16
+ private static cancelScheduledFrame;
17
+ private static cancelScheduledFrameIfIdle;
18
+ private static registerSchedulerCleanup;
9
19
  private static tick;
10
- static running(key: string): boolean;
11
- static cancel(key: string): void;
20
+ static running(key: AnimationKey): boolean;
21
+ static cancel(key: AnimationKey): void;
22
+ static reset(): void;
12
23
  }
@@ -1,6 +1,31 @@
1
1
  import type { StaticCanvasRenderConfig } from "../scene/types";
2
2
  import type { AppState, StaticCanvasAppState } from "../types";
3
+ export declare const DEFAULT_SELECTION_COLOR = "#6965db";
4
+ /**
5
+ * Returns the theme's selection color (`--color-selection`), read from the
6
+ * computed style of any element inside the editor container so that host
7
+ * overrides are respected. Falls back to the default when unavailable.
8
+ */
9
+ export declare const getSelectionColor: (element: Element | null | undefined) => string;
3
10
  export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke: boolean, fill?: boolean) => void;
11
+ /**
12
+ * The scroll the renderers draw at: the real one, rounded to whole device
13
+ * pixels. Panning writes a fractional scroll (pointer delta ÷ zoom), and an
14
+ * element's cached bitmap blitted at a fractional device offset gets
15
+ * resampled — so as the fraction drifts under a pan, every element pulses
16
+ * between crisp and soft. A whole-pixel scroll moves the scene the way a
17
+ * browser scrolls a page: each element keeps its own, constant sub-pixel
18
+ * phase and a pan never changes how anything is filtered. The difference
19
+ * stays under half a device pixel, so hit-testing and DOM overlays keep
20
+ * using the real scroll. Identity when nothing needs to change.
21
+ */
22
+ export declare const snapScrollToDevicePixels: <T extends {
23
+ scrollX: number;
24
+ scrollY: number;
25
+ zoom: {
26
+ value: number;
27
+ };
28
+ }>(appState: T, scale: number) => T;
4
29
  export declare const getNormalizedCanvasDimensions: (canvas: HTMLCanvasElement, scale: number) => [number, number];
5
30
  export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normalizedHeight, theme, isExporting, viewBackgroundColor, }: {
6
31
  canvas: HTMLCanvasElement;
@@ -1,9 +1,7 @@
1
1
  import { getScrollBars } from "../scene/scrollbars";
2
- import type { InteractiveSceneRenderConfig, RenderableElementsMap } from "../scene/types";
3
- declare const _renderInteractiveScene: ({ app, canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, editorInterface, animationState, deltaTime, }: InteractiveSceneRenderConfig) => {
2
+ import type { InteractiveSceneRenderConfig } from "../scene/types";
3
+ declare const _renderInteractiveScene: ({ app, canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState: unsnappedAppState, renderConfig, editorInterface, animationState, deltaTime, }: InteractiveSceneRenderConfig) => {
4
4
  scrollBars?: ReturnType<typeof getScrollBars>;
5
- atLeastOneVisibleElement: boolean;
6
- elementsMap: RenderableElementsMap;
7
5
  animationState?: typeof animationState;
8
6
  };
9
7
  /**
@@ -2,12 +2,17 @@ import type { ExcalidrawFrameLikeElement } from "@excalidraw/element/types";
2
2
  import type { StaticCanvasRenderConfig, StaticSceneRenderConfig } from "../scene/types";
3
3
  import type { StaticCanvasAppState } from "../types";
4
4
  export declare const frameClip: (frame: ExcalidrawFrameLikeElement, context: CanvasRenderingContext2D, renderConfig: StaticCanvasRenderConfig, appState: StaticCanvasAppState) => void;
5
- /** throttled to animation framerate */
6
- export declare const renderStaticSceneThrottled: {
7
- (config: StaticSceneRenderConfig): void;
8
- flush(): void;
9
- cancel(): void;
10
- };
5
+ /**
6
+ * Throttled to animation framerate, one throttle per canvas. A shared
7
+ * throttle drops all but the last caller's pending frame when multiple
8
+ * editors render in the same frame, and a module-realm scheduler would run
9
+ * popout renders on the main window's rAF, which freezes while that window
10
+ * is hidden.
11
+ */
12
+ export declare const renderStaticSceneThrottled: (config: StaticSceneRenderConfig) => void;
13
+ /** Drops the canvas' pending frame; the throttle itself is dropped with the
14
+ * canvas. */
15
+ export declare const cancelStaticSceneThrottle: (canvas: HTMLCanvasElement) => void;
11
16
  /**
12
17
  * Static scene is the non-ui canvas where we render elements.
13
18
  */
@@ -1,7 +1,7 @@
1
1
  import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { Scene } from "@excalidraw/element";
3
3
  import type { RenderableElementsMap } from "./types";
4
- import type { AppState } from "../types";
4
+ import type { AppState, ElementRenderOffsets } from "../types";
5
5
  type GetRenderableElementsOpts = {
6
6
  zoom: AppState["zoom"];
7
7
  offsetLeft: AppState["offsetLeft"];
@@ -19,6 +19,19 @@ type GetRenderableElementsOpts = {
19
19
  export declare class Renderer {
20
20
  private scene;
21
21
  constructor(scene: Scene);
22
+ /**
23
+ * Adjusts the document-visible set for render-override translations: an
24
+ * element leaves it when its offset moves it out of view and enters it when
25
+ * its offset brings it in; everything else keeps its document visibility.
26
+ * Only translated elements go through viewport geometry. The result is
27
+ * memoized on the offsets' identity so that opacity-only snapshots don't
28
+ * reach it at all.
29
+ */
30
+ getVisibleElementsWithRenderOffsets(visibleElements: readonly NonDeletedExcalidrawElement[], elementsMap: RenderableElementsMap, appState: AppState, offsets: ElementRenderOffsets): readonly NonDeletedExcalidrawElement[];
31
+ private _getVisibleElementsWithRenderOffsets;
32
+ /** the document-visible elements as a set, cached per visible array */
33
+ private visibleSets;
34
+ private getVisibleSet;
22
35
  private getVisibleCanvasElements;
23
36
  private getRenderableElementsMap;
24
37
  private sortSelectedElementsIntoHighlightedFrame;
@@ -53,6 +66,7 @@ export declare class Renderer {
53
66
  frameId: string | null;
54
67
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
55
68
  updated: number;
69
+ created: number | null;
56
70
  link: string | null;
57
71
  locked: boolean;
58
72
  customData?: Record<string, any>;
@@ -64,7 +78,7 @@ export declare class Renderer {
64
78
  startArrowhead: import("@excalidraw/element/types").Arrowhead | null;
65
79
  endArrowhead: import("@excalidraw/element/types").Arrowhead | null;
66
80
  }> & {
67
- isDeleted: boolean;
81
+ isDeleted: false;
68
82
  }) | (Readonly<{
69
83
  id: string;
70
84
  x: number;
@@ -92,13 +106,50 @@ export declare class Renderer {
92
106
  frameId: string | null;
93
107
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
94
108
  updated: number;
109
+ created: number | null;
95
110
  link: string | null;
96
111
  locked: boolean;
97
112
  customData?: Record<string, any>;
98
113
  }> & {
99
114
  type: "rectangle";
100
115
  } & {
116
+ isDeleted: false;
117
+ }) | (Readonly<{
118
+ id: string;
119
+ x: number;
120
+ y: number;
121
+ strokeColor: string;
122
+ backgroundColor: string;
123
+ fillStyle: import("@excalidraw/element/types").FillStyle;
124
+ strokeWidth: number;
125
+ strokeStyle: import("@excalidraw/element/types").StrokeStyle;
126
+ roundness: null | {
127
+ type: import("@excalidraw/element/types").RoundnessType;
128
+ value?: number;
129
+ };
130
+ roughness: number;
131
+ opacity: number;
132
+ width: number;
133
+ height: number;
134
+ angle: import("@excalidraw/math").Radians;
135
+ seed: number;
136
+ version: number;
137
+ versionNonce: number;
138
+ index: import("@excalidraw/element/types").FractionalIndex | null;
101
139
  isDeleted: boolean;
140
+ groupIds: readonly import("@excalidraw/element/types").GroupId[];
141
+ frameId: string | null;
142
+ boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
143
+ updated: number;
144
+ created: number | null;
145
+ link: string | null;
146
+ locked: boolean;
147
+ customData?: Record<string, any>;
148
+ }> & Readonly<{
149
+ type: "stickynote";
150
+ baseHeight: number;
151
+ }> & {
152
+ isDeleted: false;
102
153
  }) | (Readonly<{
103
154
  id: string;
104
155
  x: number;
@@ -126,13 +177,14 @@ export declare class Renderer {
126
177
  frameId: string | null;
127
178
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
128
179
  updated: number;
180
+ created: number | null;
129
181
  link: string | null;
130
182
  locked: boolean;
131
183
  customData?: Record<string, any>;
132
184
  }> & {
133
185
  type: "diamond";
134
186
  } & {
135
- isDeleted: boolean;
187
+ isDeleted: false;
136
188
  }) | (Readonly<{
137
189
  id: string;
138
190
  x: number;
@@ -160,13 +212,14 @@ export declare class Renderer {
160
212
  frameId: string | null;
161
213
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
162
214
  updated: number;
215
+ created: number | null;
163
216
  link: string | null;
164
217
  locked: boolean;
165
218
  customData?: Record<string, any>;
166
219
  }> & {
167
220
  type: "ellipse";
168
221
  } & {
169
- isDeleted: boolean;
222
+ isDeleted: false;
170
223
  }) | (Readonly<{
171
224
  id: string;
172
225
  x: number;
@@ -194,13 +247,14 @@ export declare class Renderer {
194
247
  frameId: string | null;
195
248
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
196
249
  updated: number;
250
+ created: number | null;
197
251
  link: string | null;
198
252
  locked: boolean;
199
253
  customData?: Record<string, any>;
200
254
  }> & Readonly<{
201
255
  type: "embeddable";
202
256
  }> & {
203
- isDeleted: boolean;
257
+ isDeleted: false;
204
258
  }) | (Readonly<{
205
259
  id: string;
206
260
  x: number;
@@ -228,6 +282,7 @@ export declare class Renderer {
228
282
  frameId: string | null;
229
283
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
230
284
  updated: number;
285
+ created: number | null;
231
286
  link: string | null;
232
287
  locked: boolean;
233
288
  customData?: Record<string, any>;
@@ -237,7 +292,7 @@ export declare class Renderer {
237
292
  generationData?: import("@excalidraw/element/types").MagicGenerationData;
238
293
  };
239
294
  }> & {
240
- isDeleted: boolean;
295
+ isDeleted: false;
241
296
  }) | (Readonly<{
242
297
  id: string;
243
298
  x: number;
@@ -265,6 +320,7 @@ export declare class Renderer {
265
320
  frameId: string | null;
266
321
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
267
322
  updated: number;
323
+ created: number | null;
268
324
  link: string | null;
269
325
  locked: boolean;
270
326
  customData?: Record<string, any>;
@@ -275,7 +331,7 @@ export declare class Renderer {
275
331
  scale: [number, number];
276
332
  crop: import("@excalidraw/element/types").ImageCrop | null;
277
333
  }> & {
278
- isDeleted: boolean;
334
+ isDeleted: false;
279
335
  }) | (Readonly<{
280
336
  id: string;
281
337
  x: number;
@@ -303,6 +359,7 @@ export declare class Renderer {
303
359
  frameId: string | null;
304
360
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
305
361
  updated: number;
362
+ created: number | null;
306
363
  link: string | null;
307
364
  locked: boolean;
308
365
  customData?: Record<string, any>;
@@ -310,7 +367,7 @@ export declare class Renderer {
310
367
  type: "frame";
311
368
  name: string | null;
312
369
  } & {
313
- isDeleted: boolean;
370
+ isDeleted: false;
314
371
  }) | (Readonly<{
315
372
  id: string;
316
373
  x: number;
@@ -338,6 +395,7 @@ export declare class Renderer {
338
395
  frameId: string | null;
339
396
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
340
397
  updated: number;
398
+ created: number | null;
341
399
  link: string | null;
342
400
  locked: boolean;
343
401
  customData?: Record<string, any>;
@@ -345,7 +403,7 @@ export declare class Renderer {
345
403
  type: "magicframe";
346
404
  name: string | null;
347
405
  } & {
348
- isDeleted: boolean;
406
+ isDeleted: false;
349
407
  }) | (Readonly<{
350
408
  id: string;
351
409
  x: number;
@@ -373,6 +431,7 @@ export declare class Renderer {
373
431
  frameId: string | null;
374
432
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
375
433
  updated: number;
434
+ created: number | null;
376
435
  link: string | null;
377
436
  locked: boolean;
378
437
  customData?: Record<string, any>;
@@ -380,17 +439,19 @@ export declare class Renderer {
380
439
  type: "text";
381
440
  fontSize: number;
382
441
  fontFamily: import("@excalidraw/element/types").FontFamilyValues;
442
+ baseFontSize: number | null;
383
443
  text: string;
384
444
  textAlign: import("@excalidraw/element/types").TextAlign;
385
445
  verticalAlign: import("@excalidraw/element/types").VerticalAlign;
386
- containerId: import("@excalidraw/element/types").ExcalidrawGenericElement["id"] | null;
446
+ containerId: import("@excalidraw/element/types").ExcalidrawTextContainer["id"] | null;
387
447
  originalText: string;
388
448
  autoResize: boolean;
389
449
  lineHeight: number & {
390
450
  _brand: "unitlessLineHeight";
391
451
  };
452
+ labelPosition?: number | null;
392
453
  }> & {
393
- isDeleted: boolean;
454
+ isDeleted: false;
394
455
  }) | (Readonly<{
395
456
  id: string;
396
457
  x: number;
@@ -418,6 +479,7 @@ export declare class Renderer {
418
479
  frameId: string | null;
419
480
  boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
420
481
  updated: number;
482
+ created: number | null;
421
483
  link: string | null;
422
484
  locked: boolean;
423
485
  customData?: Record<string, any>;
@@ -426,11 +488,12 @@ export declare class Renderer {
426
488
  points: readonly import("@excalidraw/math").LocalPoint[];
427
489
  pressures: readonly number[];
428
490
  simulatePressure: boolean;
491
+ strokeOptions: import("@excalidraw/element/types").StrokeOptions;
429
492
  }> & {
430
- isDeleted: boolean;
493
+ isDeleted: false;
431
494
  }) | null;
432
495
  canvasNonce: string;
433
496
  };
434
- destroy(): void;
497
+ destroy(staticCanvas: HTMLCanvasElement): void;
435
498
  }
436
499
  export {};