@zsviczian/excalidraw 0.17.6-2 → 0.17.6-21

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 (138) hide show
  1. package/dist/excalidraw.development.js +13000 -1495
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/dist/excalidraw.production.min.js.LICENSE.txt +21 -1
  4. package/dist/styles.development.css +425 -347
  5. package/dist/styles.production.css +3 -2
  6. package/package.json +2 -3
  7. package/types/excalidraw/actions/actionAddToLibrary.d.ts +24 -0
  8. package/types/excalidraw/actions/actionBoundText.d.ts +16 -0
  9. package/types/excalidraw/actions/actionCanvas.d.ts +112 -0
  10. package/types/excalidraw/actions/actionClipboard.d.ts +48 -0
  11. package/types/excalidraw/actions/actionCropEditor.d.ts +222 -0
  12. package/types/excalidraw/actions/actionDeleteSelected.d.ts +24 -0
  13. package/types/excalidraw/actions/actionElementLink.d.ts +244 -0
  14. package/types/excalidraw/actions/actionElementLock.d.ts +16 -0
  15. package/types/excalidraw/actions/actionExport.d.ts +69 -0
  16. package/types/excalidraw/actions/actionFinalize.d.ts +16 -0
  17. package/types/excalidraw/actions/actionFrame.d.ts +32 -0
  18. package/types/excalidraw/actions/actionGroup.d.ts +16 -0
  19. package/types/excalidraw/actions/actionLinearEditor.d.ts +8 -0
  20. package/types/excalidraw/actions/actionLink.d.ts +9 -1
  21. package/types/excalidraw/actions/actionMenu.d.ts +21 -0
  22. package/types/excalidraw/actions/actionNavigate.d.ts +16 -0
  23. package/types/excalidraw/actions/actionProperties.d.ts +120 -0
  24. package/types/excalidraw/actions/actionSelectAll.d.ts +8 -0
  25. package/types/excalidraw/actions/actionStyles.d.ts +8 -0
  26. package/types/excalidraw/actions/actionToggleGridMode.d.ts +8 -0
  27. package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +8 -0
  28. package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +13 -0
  29. package/types/excalidraw/actions/actionToggleStats.d.ts +8 -0
  30. package/types/excalidraw/actions/actionToggleViewMode.d.ts +8 -0
  31. package/types/excalidraw/actions/actionToggleZenMode.d.ts +8 -0
  32. package/types/excalidraw/actions/index.d.ts +1 -0
  33. package/types/excalidraw/actions/types.d.ts +1 -1
  34. package/types/excalidraw/change.d.ts +2 -2
  35. package/types/excalidraw/clipboard.d.ts +27 -5
  36. package/types/excalidraw/components/App.d.ts +20 -5
  37. package/types/excalidraw/components/ElementLinkDialog.d.ts +11 -0
  38. package/types/excalidraw/components/LayerUI.d.ts +2 -1
  39. package/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +1 -7
  40. package/types/excalidraw/components/TTDDialog/MermaidToExcalidrawLib.d.ts +9 -0
  41. package/types/excalidraw/components/TTDDialog/common.d.ts +2 -2
  42. package/types/excalidraw/components/hyperlink/Hyperlink.d.ts +1 -1
  43. package/types/excalidraw/components/hyperlink/helpers.d.ts +1 -0
  44. package/types/excalidraw/components/icons.d.ts +2 -0
  45. package/types/excalidraw/constants.d.ts +5 -1
  46. package/types/excalidraw/data/blob.d.ts +4 -0
  47. package/types/excalidraw/data/encode.d.ts +6 -5
  48. package/types/excalidraw/data/image.d.ts +2 -2
  49. package/types/excalidraw/dist/excalidraw.production.min.d.ts +3 -1
  50. package/types/excalidraw/element/binding.d.ts +1 -1
  51. package/types/excalidraw/element/cropElement.d.ts +14 -0
  52. package/types/excalidraw/element/elementLink.d.ts +13 -0
  53. package/types/excalidraw/element/embeddable.d.ts +8 -0
  54. package/types/excalidraw/element/image.d.ts +1 -1
  55. package/types/excalidraw/element/newElement.d.ts +1 -0
  56. package/types/excalidraw/element/textElement.d.ts +14 -4
  57. package/types/excalidraw/element/textWrapping.d.ts +13 -0
  58. package/types/excalidraw/element/transformHandles.d.ts +1 -1
  59. package/types/excalidraw/element/types.d.ts +10 -0
  60. package/types/excalidraw/errors.d.ts +7 -0
  61. package/types/excalidraw/fonts/{woff2/Cascadia → Cascadia}/index.d.ts +1 -1
  62. package/types/excalidraw/fonts/ComicShanns/index.d.ts +2 -0
  63. package/types/excalidraw/fonts/{woff2/Emoji → Emoji}/index.d.ts +1 -1
  64. package/types/excalidraw/fonts/ExcalidrawFontFace.d.ts +2 -8
  65. package/types/excalidraw/fonts/{woff2/Excalifont → Excalifont}/index.d.ts +1 -1
  66. package/types/excalidraw/fonts/Fonts.d.ts +117 -0
  67. package/types/excalidraw/fonts/{woff2/Helvetica → Helvetica}/index.d.ts +1 -1
  68. package/types/excalidraw/fonts/{woff2/Liberation → Liberation}/index.d.ts +1 -1
  69. package/types/excalidraw/fonts/{woff2/Lilita → Lilita}/index.d.ts +1 -1
  70. package/types/excalidraw/fonts/{woff2/Nunito → Nunito}/index.d.ts +1 -1
  71. package/types/excalidraw/fonts/{woff2/Virgil → Virgil}/index.d.ts +1 -1
  72. package/types/excalidraw/fonts/{woff2/Xiaolai → Xiaolai}/index.d.ts +1 -1
  73. package/types/excalidraw/fonts/index.d.ts +1 -87
  74. package/types/excalidraw/index.d.ts +2 -1
  75. package/types/excalidraw/keys.d.ts +107 -0
  76. package/types/excalidraw/obsidianUtils.d.ts +5 -3
  77. package/types/excalidraw/renderer/renderElement.d.ts +3 -2
  78. package/types/excalidraw/scene/Scene.d.ts +1 -0
  79. package/types/excalidraw/scene/comparisons.d.ts +1 -0
  80. package/types/excalidraw/scene/export.d.ts +1 -0
  81. package/types/excalidraw/scene/types.d.ts +7 -0
  82. package/types/excalidraw/types.d.ts +24 -2
  83. package/types/math/utils.d.ts +1 -0
  84. package/types/math/vector.d.ts +4 -0
  85. package/types/utils/export.d.ts +5 -3
  86. package/dist/excalidraw-assets/CascadiaCode-Regular.woff2 +0 -0
  87. package/dist/excalidraw-assets/ComicShanns-Regular.woff2 +0 -0
  88. package/dist/excalidraw-assets/Excalifont-Regular.woff2 +0 -0
  89. package/dist/excalidraw-assets/LiberationSans-Regular.woff2 +0 -0
  90. package/dist/excalidraw-assets/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYE98RXi4EwSsbg.woff2 +0 -0
  91. package/dist/excalidraw-assets/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYEF8RXi4EwQ.woff2 +0 -0
  92. package/dist/excalidraw-assets/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTA3j6zbXWjgevT5.woff2 +0 -0
  93. package/dist/excalidraw-assets/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTQ3j6zbXWjgeg.woff2 +0 -0
  94. package/dist/excalidraw-assets/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTk3j6zbXWjgevT5.woff2 +0 -0
  95. package/dist/excalidraw-assets/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTo3j6zbXWjgevT5.woff2 +0 -0
  96. package/dist/excalidraw-assets/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTs3j6zbXWjgevT5.woff2 +0 -0
  97. package/dist/excalidraw-assets/Virgil-Regular.woff2 +0 -0
  98. package/dist/excalidraw-assets-dev/CascadiaCode-Regular.woff2 +0 -0
  99. package/dist/excalidraw-assets-dev/ComicShanns-Regular.woff2 +0 -0
  100. package/dist/excalidraw-assets-dev/Excalifont-Regular.woff2 +0 -0
  101. package/dist/excalidraw-assets-dev/LiberationSans-Regular.woff2 +0 -0
  102. package/dist/excalidraw-assets-dev/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYE98RXi4EwSsbg.woff2 +0 -0
  103. package/dist/excalidraw-assets-dev/Lilita-Regular-i7dPIFZ9Zz-WBtRtedDbYEF8RXi4EwQ.woff2 +0 -0
  104. package/dist/excalidraw-assets-dev/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTA3j6zbXWjgevT5.woff2 +0 -0
  105. package/dist/excalidraw-assets-dev/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTQ3j6zbXWjgeg.woff2 +0 -0
  106. package/dist/excalidraw-assets-dev/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTk3j6zbXWjgevT5.woff2 +0 -0
  107. package/dist/excalidraw-assets-dev/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTo3j6zbXWjgevT5.woff2 +0 -0
  108. package/dist/excalidraw-assets-dev/Nunito-Regular-XRXI3I6Li01BKofiOc5wtlZ2di8HDIkhdTs3j6zbXWjgevT5.woff2 +0 -0
  109. package/dist/excalidraw-assets-dev/Virgil-Regular.woff2 +0 -0
  110. package/types/excalidraw/components/MagicSettings.d.ts +0 -8
  111. package/types/excalidraw/components/Stats.d.ts +0 -11
  112. package/types/excalidraw/data/magic.d.ts +0 -23
  113. package/types/excalidraw/fonts/ExcalidrawFont.d.ts +0 -37
  114. package/types/excalidraw/fonts/wasm/hb-subset.bindings.d.ts +0 -45
  115. package/types/excalidraw/fonts/wasm/hb-subset.loader.d.ts +0 -5
  116. package/types/excalidraw/fonts/wasm/hb-subset.wasm.d.ts +0 -2
  117. package/types/excalidraw/fonts/wasm/woff2.bindings.d.ts +0 -31
  118. package/types/excalidraw/fonts/wasm/woff2.loader.d.ts +0 -6
  119. package/types/excalidraw/fonts/wasm/woff2.wasm.d.ts +0 -2
  120. package/types/excalidraw/fonts/woff2/Comic/index.d.ts +0 -2
  121. package/types/excalidraw/ga.d.ts +0 -63
  122. package/types/excalidraw/gadirections.d.ts +0 -8
  123. package/types/excalidraw/galines.d.ts +0 -22
  124. package/types/excalidraw/gapoints.d.ts +0 -7
  125. package/types/excalidraw/gatransforms.d.ts +0 -10
  126. package/types/excalidraw/math.d.ts +0 -79
  127. package/types/excalidraw/scene/Fonts.d.ts +0 -19
  128. package/types/utils/geometry/geometry.d.ts +0 -89
  129. /package/types/excalidraw/fonts/{metadata.d.ts → FontMetadata.d.ts} +0 -0
  130. /package/types/excalidraw/{fonts/wasm/hb-subset-bindings.d.ts → subset/harfbuzz/harfbuzz-bindings.d.ts} +0 -0
  131. /package/types/excalidraw/{fonts/wasm/hb-subset-loader.d.ts → subset/harfbuzz/harfbuzz-loader.d.ts} +0 -0
  132. /package/types/excalidraw/{fonts/wasm/hb-subset-wasm.d.ts → subset/harfbuzz/harfbuzz-wasm.d.ts} +0 -0
  133. /package/types/excalidraw/{fonts/subset → subset}/subset-main.d.ts +0 -0
  134. /package/types/excalidraw/{fonts/subset → subset}/subset-shared.chunk.d.ts +0 -0
  135. /package/types/excalidraw/{fonts/subset → subset}/subset-worker.chunk.d.ts +0 -0
  136. /package/types/excalidraw/{fonts/wasm → subset/woff2}/woff2-bindings.d.ts +0 -0
  137. /package/types/excalidraw/{fonts/wasm → subset/woff2}/woff2-loader.d.ts +0 -0
  138. /package/types/excalidraw/{fonts/wasm → subset/woff2}/woff2-wasm.d.ts +0 -0
@@ -14,7 +14,7 @@ export type ActionResult = {
14
14
  type ActionFn = (elements: readonly OrderedExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
15
15
  export type UpdaterFn = (res: ActionResult) => void;
16
16
  export type ActionFilterFn = (action: Action) => void;
17
- export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "createContainerFromText" | "wrapTextInContainer" | "toggleLaserPointerTool" | "commandPalette" | "autoResize" | "elementStats" | "searchMenu";
17
+ export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "objectsSnapMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "toggleEraserTool" | "toggleHandTool" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "setFrameAsActiveTool" | "setEmbeddableAsActiveTool" | "createContainerFromText" | "wrapTextInContainer" | "toggleLaserPointerTool" | "commandPalette" | "autoResize" | "elementStats" | "searchMenu" | "copyElementLink" | "linkToElement" | "cropEditor";
18
18
  export type PanelComponentProps = {
19
19
  elements: readonly ExcalidrawElement[];
20
20
  appState: AppState;
@@ -1,5 +1,5 @@
1
1
  import type { ElementUpdate } from "./element/mutateElement";
2
- import type { OrderedExcalidrawElement, SceneElementsMap } from "./element/types";
2
+ import type { ExcalidrawElement, Ordered, OrderedExcalidrawElement, SceneElementsMap } from "./element/types";
3
3
  import type { AppState, ObservedAppState } from "./types";
4
4
  import type { ValueOf } from "./utility-types";
5
5
  /**
@@ -116,7 +116,7 @@ export declare class AppStateChange implements Change<AppState> {
116
116
  private static stripElementsProps;
117
117
  private static stripStandaloneProps;
118
118
  }
119
- type ElementPartial = Omit<ElementUpdate<OrderedExcalidrawElement>, "seed">;
119
+ type ElementPartial<T extends ExcalidrawElement = ExcalidrawElement> = Omit<ElementUpdate<Ordered<T>>, "seed">;
120
120
  /**
121
121
  * Elements change is a low level primitive to capture a change between two sets of elements.
122
122
  * It does so by encapsulating forward and backward `Delta`s, allowing to time-travel in both directions.
@@ -21,8 +21,17 @@ export declare const probablySupportsClipboardWriteText: boolean;
21
21
  export declare const probablySupportsClipboardBlob: boolean;
22
22
  export declare const createPasteEvent: ({ types, files, }: {
23
23
  types?: {
24
- "text/html"?: string | undefined;
25
- "text/plain"?: string | undefined;
24
+ "text/plain"?: string | File | undefined;
25
+ "text/html"?: string | File | undefined;
26
+ "image/svg+xml"?: string | File | undefined;
27
+ "image/png"?: string | File | undefined;
28
+ "image/jpeg"?: string | File | undefined;
29
+ "image/gif"?: string | File | undefined;
30
+ "image/webp"?: string | File | undefined;
31
+ "image/bmp"?: string | File | undefined;
32
+ "image/x-icon"?: string | File | undefined;
33
+ "image/avif"?: string | File | undefined;
34
+ "image/jfif"?: string | File | undefined;
26
35
  } | undefined;
27
36
  files?: File[] | undefined;
28
37
  }) => ClipboardEvent;
@@ -31,12 +40,25 @@ export declare const serializeAsClipboardJSON: ({ elements, files, }: {
31
40
  files: BinaryFiles | null;
32
41
  }) => string;
33
42
  export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], files: BinaryFiles | null, clipboardEvent?: ClipboardEvent | null) => Promise<void>;
43
+ /**
44
+ * Reads OS clipboard programmatically. May not work on all browsers.
45
+ * Will prompt user for permission if not granted.
46
+ */
34
47
  export declare const readSystemClipboard: () => Promise<{
35
- "text/html"?: string | undefined;
36
- "text/plain"?: string | undefined;
48
+ "text/plain"?: string | File | undefined;
49
+ "text/html"?: string | File | undefined;
50
+ "image/svg+xml"?: string | File | undefined;
51
+ "image/png"?: string | File | undefined;
52
+ "image/jpeg"?: string | File | undefined;
53
+ "image/gif"?: string | File | undefined;
54
+ "image/webp"?: string | File | undefined;
55
+ "image/bmp"?: string | File | undefined;
56
+ "image/x-icon"?: string | File | undefined;
57
+ "image/avif"?: string | File | undefined;
58
+ "image/jfif"?: string | File | undefined;
37
59
  }>;
38
60
  /**
39
- * Attempts to parse clipboard. Prefers system clipboard.
61
+ * Attempts to parse clipboard event.
40
62
  */
41
63
  export declare const parseClipboard: (event: ClipboardEvent, isPlainPaste?: boolean) => Promise<ClipboardData>;
42
64
  export declare const copyBlobToClipboardAsPng: (blob: Blob | Promise<Blob>) => Promise<void>;
@@ -5,7 +5,7 @@ import type { ActionResult } from "../actions/types";
5
5
  import { type EXPORT_IMAGE_TYPES } from "../constants";
6
6
  import type { ExportedElements } from "../data";
7
7
  import { LinearElementEditor } from "../element/linearElementEditor";
8
- import type { ExcalidrawElement, ExcalidrawLinearElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered } from "../element/types";
8
+ import type { ExcalidrawElement, ExcalidrawLinearElement, NonDeleted, InitializedExcalidrawImageElement, ExcalidrawImageElement, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered } from "../element/types";
9
9
  import { History } from "../history";
10
10
  import Scene from "../scene/Scene";
11
11
  import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, GenerateDiagramToCode, NullableGridSize, Offsets } from "../types";
@@ -86,6 +86,10 @@ declare class App extends React.Component<AppProps, AppState> {
86
86
  lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
87
87
  lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
88
88
  lastPointerMoveEvent: PointerEvent | null;
89
+ lastPointerMoveCoords: {
90
+ x: number;
91
+ y: number;
92
+ } | null;
89
93
  lastViewportPosition: {
90
94
  x: number;
91
95
  y: number;
@@ -328,7 +332,7 @@ declare class App extends React.Component<AppProps, AppState> {
328
332
  */
329
333
  zoomCanvas: (value: number) => void;
330
334
  private cancelInProgressAnimation;
331
- scrollToContent: (target?: ExcalidrawElement | readonly ExcalidrawElement[], opts?: ({
335
+ scrollToContent: (target?: string | ExcalidrawElement | readonly ExcalidrawElement[], opts?: ({
332
336
  fitToContent?: boolean;
333
337
  fitToViewport?: never;
334
338
  viewportZoomFactor?: number;
@@ -352,6 +356,10 @@ declare class App extends React.Component<AppProps, AppState> {
352
356
  /** use when changing scrollX/scrollY/zoom based on user interaction */
353
357
  private translateCanvas;
354
358
  zoomToFit: (target?: readonly ExcalidrawElement[], maxZoom?: number, margin?: number) => void;
359
+ getColorAtScenePoint: ({ sceneX, sceneY }: {
360
+ sceneX: number;
361
+ sceneY: number;
362
+ }) => string | null;
355
363
  startLineEditor: (el: ExcalidrawLinearElement, selectedPointsIndices?: number[] | null) => void;
356
364
  updateContainerSize: (containers: NonDeletedExcalidrawElement[]) => void;
357
365
  setToast: (toast: {
@@ -360,7 +368,10 @@ declare class App extends React.Component<AppProps, AppState> {
360
368
  duration?: number;
361
369
  } | null) => void;
362
370
  restoreFileFromShare: () => Promise<void>;
363
- /** adds supplied files to existing files in the appState */
371
+ /**
372
+ * adds supplied files to existing files in the appState.
373
+ * NOTE if file already exists in editor state, the file data is not updated
374
+ * */
364
375
  addFiles: ExcalidrawImperativeAPI["addFiles"];
365
376
  setMobileModeAllowed: ExcalidrawImperativeAPI["setMobileModeAllowed"];
366
377
  private debounceClearHighlightSearchResults;
@@ -369,6 +380,7 @@ declare class App extends React.Component<AppProps, AppState> {
369
380
  bringForward: ExcalidrawImperativeAPI["bringForward"];
370
381
  sendToBack: ExcalidrawImperativeAPI["sendToBack"];
371
382
  sendBackward: ExcalidrawImperativeAPI["sendBackward"];
383
+ private addMissingFiles;
372
384
  updateScene: <K extends keyof AppState>(sceneData: {
373
385
  elements?: SceneData["elements"];
374
386
  appState?: Pick<AppState, K> | null | undefined;
@@ -426,6 +438,8 @@ declare class App extends React.Component<AppProps, AppState> {
426
438
  private getTextBindableContainerAtPosition;
427
439
  private startTextEditing;
428
440
  private debounceDoubleClickTimestamp;
441
+ private startImageCropping;
442
+ private finishImageCropping;
429
443
  private handleCanvasDoubleClick;
430
444
  private getElementLinkAtPosition;
431
445
  private redirectToLink;
@@ -486,10 +500,10 @@ declare class App extends React.Component<AppProps, AppState> {
486
500
  /**
487
501
  * inserts image into elements array and rerenders
488
502
  */
489
- private insertImageElement;
503
+ insertImageElement: (imageElement: ExcalidrawImageElement, imageFile: File, showCursorImagePreview?: boolean) => Promise<NonDeleted<InitializedExcalidrawImageElement> | null | undefined>;
490
504
  private setImagePreviewCursor;
491
505
  private onImageAction;
492
- private initializeImageDimensions;
506
+ initializeImageDimensions: (imageElement: ExcalidrawImageElement, forceNaturalSize?: boolean) => void;
493
507
  /** updates image cache, refreshing updated elements and/or setting status
494
508
  to error for images that fail during <img> element creation */
495
509
  private updateImageCache;
@@ -508,6 +522,7 @@ declare class App extends React.Component<AppProps, AppState> {
508
522
  loadFileToCanvas: (file: File, fileHandle: FileSystemHandle | null) => Promise<void>;
509
523
  private handleCanvasContextMenu;
510
524
  private maybeDragNewGenericElement;
525
+ private maybeHandleCrop;
511
526
  private maybeHandleResize;
512
527
  private getContextMenuItems;
513
528
  private handleWheel;
@@ -0,0 +1,11 @@
1
+ import type { AppProps, UIAppState } from "../types";
2
+ import type { ElementsMap, ExcalidrawElement } from "../element/types";
3
+ import "./ElementLinkDialog.scss";
4
+ declare const ElementLinkDialog: ({ sourceElementId, onClose, elementsMap, appState, generateLinkForSelection, }: {
5
+ sourceElementId: ExcalidrawElement["id"];
6
+ elementsMap: ElementsMap;
7
+ appState: UIAppState;
8
+ onClose?: (() => void) | undefined;
9
+ generateLinkForSelection: AppProps["generateLinkForSelection"];
10
+ }) => JSX.Element;
11
+ export default ElementLinkDialog;
@@ -25,6 +25,7 @@ interface LayerUIProps {
25
25
  children?: React.ReactNode;
26
26
  app: AppClassProperties;
27
27
  isCollaborating: boolean;
28
+ generateLinkForSelection?: AppProps["generateLinkForSelection"];
28
29
  }
29
- declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onExportImage, renderWelcomeScreen, children, app, isCollaborating, }: LayerUIProps) => JSX.Element>;
30
+ declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onExportImage, renderWelcomeScreen, children, app, isCollaborating, generateLinkForSelection, }: LayerUIProps) => JSX.Element>;
30
31
  export default _default;
@@ -1,14 +1,8 @@
1
- import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "../../element/types";
1
+ import type { NonDeletedExcalidrawElement } from "../../element/types";
2
2
  import "./MermaidToExcalidraw.scss";
3
3
  import type { MermaidToExcalidrawLibProps } from "./common";
4
- import type { MermaidOptions } from "@zsviczian/mermaid-to-excalidraw";
5
4
  declare const MermaidToExcalidraw: ({ mermaidToExcalidrawLib, selectedElements, }: {
6
5
  mermaidToExcalidrawLib: MermaidToExcalidrawLibProps;
7
6
  selectedElements: readonly NonDeletedExcalidrawElement[];
8
7
  }) => JSX.Element;
9
8
  export default MermaidToExcalidraw;
10
- export declare const mermaidToExcalidraw: (mermaidDefinition: string, opts?: MermaidOptions, forceSVG?: boolean) => Promise<{
11
- elements?: ExcalidrawElement[];
12
- files?: any;
13
- error?: string;
14
- } | undefined>;
@@ -0,0 +1,9 @@
1
+ import { MermaidConfig } from "@zsviczian/mermaid-to-excalidraw";
2
+ import { ExcalidrawElement } from "../../element/types";
3
+ import { MermaidToExcalidrawLibProps } from "./common";
4
+ export declare const loadMermaidToExcalidrawLib: () => Promise<MermaidToExcalidrawLibProps>;
5
+ export declare const mermaidToExcalidraw: (mermaidDefinition: string, opts: MermaidConfig, forceSVG?: boolean) => Promise<{
6
+ elements?: ExcalidrawElement[];
7
+ files?: any;
8
+ error?: string;
9
+ } | undefined>;
@@ -1,11 +1,11 @@
1
- import type { MermaidOptions } from "@zsviczian/mermaid-to-excalidraw";
1
+ import type { MermaidConfig } from "@zsviczian/mermaid-to-excalidraw";
2
2
  import type { MermaidToExcalidrawResult } from "@zsviczian/mermaid-to-excalidraw/dist/interfaces";
3
3
  import type { NonDeletedExcalidrawElement } from "../../element/types";
4
4
  import type { AppClassProperties, BinaryFiles } from "../../types";
5
5
  export interface MermaidToExcalidrawLibProps {
6
6
  loaded: boolean;
7
7
  api: Promise<{
8
- parseMermaidToExcalidraw: (definition: string, options: MermaidOptions) => Promise<MermaidToExcalidrawResult>;
8
+ parseMermaidToExcalidraw: (definition: string, config?: MermaidConfig, forceSVG?: boolean) => Promise<MermaidToExcalidrawResult>;
9
9
  }>;
10
10
  }
11
11
  interface ConvertMermaidToExcalidrawFormatProps {
@@ -13,6 +13,6 @@ export declare const Hyperlink: ({ element, elementsMap, setAppState, onLinkOpen
13
13
  } | null) => void;
14
14
  updateEmbedValidationStatus: (element: ExcalidrawEmbeddableElement, status: boolean) => void;
15
15
  }) => JSX.Element | null;
16
- export declare const getContextMenuLabel: (elements: readonly NonDeletedExcalidrawElement[], appState: UIAppState) => "labels.link.editEmbed" | "labels.link.edit" | "labels.link.createEmbed" | "labels.link.create";
16
+ export declare const getContextMenuLabel: (elements: readonly NonDeletedExcalidrawElement[], appState: UIAppState) => "labels.link.editEmbed" | "labels.link.edit" | "labels.link.create";
17
17
  export declare const showHyperlinkTooltip: (element: NonDeletedExcalidrawElement, appState: AppState, elementsMap: ElementsMap) => void;
18
18
  export declare const hideHyperlinkToolip: () => void;
@@ -3,6 +3,7 @@ import type { Bounds } from "../../element/bounds";
3
3
  import type { ElementsMap, NonDeletedExcalidrawElement } from "../../element/types";
4
4
  import type { AppState, UIAppState } from "../../types";
5
5
  export declare const EXTERNAL_LINK_IMG: HTMLImageElement;
6
+ export declare const ELEMENT_LINK_IMG: HTMLImageElement;
6
7
  export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: Radians, appState: Pick<UIAppState, "zoom">) => Bounds;
7
8
  export declare const isPointHittingLinkIcon: (element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, appState: AppState, [x, y]: GlobalPoint) => boolean;
8
9
  export declare const isPointHittingLink: (element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, appState: AppState, [x, y]: GlobalPoint, isMobile: boolean) => boolean;
@@ -209,4 +209,6 @@ export declare const roundArrowIcon: JSX.Element;
209
209
  export declare const collapseDownIcon: JSX.Element;
210
210
  export declare const collapseUpIcon: JSX.Element;
211
211
  export declare const upIcon: JSX.Element;
212
+ export declare const cropIcon: JSX.Element;
213
+ export declare const elementLinkIcon: JSX.Element;
212
214
  export {};
@@ -164,7 +164,6 @@ export declare const IMAGE_MIME_TYPES: {
164
164
  readonly avif: "image/avif";
165
165
  readonly jfif: "image/jfif";
166
166
  };
167
- export declare const ALLOWED_PASTE_MIME_TYPES: readonly ["text/plain", "text/html"];
168
167
  export declare const MIME_TYPES: {
169
168
  readonly svg: "image/svg+xml";
170
169
  readonly png: "image/png";
@@ -175,6 +174,8 @@ export declare const MIME_TYPES: {
175
174
  readonly ico: "image/x-icon";
176
175
  readonly avif: "image/avif";
177
176
  readonly jfif: "image/jfif";
177
+ readonly text: "text/plain";
178
+ readonly html: "text/html";
178
179
  readonly json: "application/json";
179
180
  readonly excalidraw: "application/vnd.excalidraw+json";
180
181
  readonly excalidrawlib: "application/vnd.excalidrawlib+json";
@@ -182,6 +183,7 @@ export declare const MIME_TYPES: {
182
183
  readonly "excalidraw.png": "image/png";
183
184
  readonly binary: "application/octet-stream";
184
185
  };
186
+ export declare const ALLOWED_PASTE_MIME_TYPES: readonly ["text/plain", "text/html", ...("image/svg+xml" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/bmp" | "image/x-icon" | "image/avif" | "image/jfif")[]];
185
187
  export declare const EXPORT_IMAGE_TYPES: {
186
188
  readonly png: "png";
187
189
  readonly svg: "svg";
@@ -320,3 +322,5 @@ export declare const MIN_WIDTH_OR_HEIGHT = 1;
320
322
  export declare const ARROW_TYPE: {
321
323
  [T in AppState["currentItemArrowType"]]: T;
322
324
  };
325
+ export declare const DEFAULT_REDUCED_GLOBAL_ALPHA = 0.3;
326
+ export declare const ELEMENT_LINK_KEY = "element";
@@ -8,6 +8,7 @@ export declare const getMimeType: (blob: Blob | string) => string;
8
8
  export declare const getFileHandleType: (handle: FileSystemHandle | null) => string | null;
9
9
  export declare const isImageFileHandleType: (type: string | null) => type is "png" | "svg";
10
10
  export declare const isImageFileHandle: (handle: FileSystemHandle | null) => boolean;
11
+ export declare const isSupportedImageFileType: (type: string | null | undefined) => boolean;
11
12
  export declare const isSupportedImageFile: (blob: Blob | null | undefined) => blob is Blob & {
12
13
  type: ValueOf<typeof IMAGE_MIME_TYPES>;
13
14
  };
@@ -25,8 +26,11 @@ export declare const canvasToBlob: (canvas: HTMLCanvasElement | Promise<HTMLCanv
25
26
  /** generates SHA-1 digest from supplied file (if not supported, falls back
26
27
  to a 40-char base64 random id) */
27
28
  export declare const generateIdFromFile: (file: File) => Promise<FileId>;
29
+ /** async. For sync variant, use getDataURL_sync */
28
30
  export declare const getDataURL: (file: Blob | File) => Promise<DataURL>;
31
+ export declare const getDataURL_sync: (data: string | Uint8Array | ArrayBuffer, mimeType: ValueOf<typeof MIME_TYPES>) => DataURL;
29
32
  export declare const dataURLToFile: (dataURL: DataURL, filename?: string) => File;
33
+ export declare const dataURLToString: (dataURL: DataURL) => string;
30
34
  export declare const resizeImageFile: (file: File, opts: {
31
35
  /** undefined indicates auto */
32
36
  outputType?: (typeof MIME_TYPES)["jpg"];
@@ -1,11 +1,12 @@
1
- export declare const toByteString: (data: string | Uint8Array | ArrayBuffer) => Promise<string>;
1
+ export declare const toByteString: (data: string | Uint8Array | ArrayBuffer) => string;
2
2
  /**
3
3
  * @param isByteString set to true if already byte string to prevent bloat
4
4
  * due to reencoding
5
5
  */
6
- export declare const stringToBase64: (str: string, isByteString?: boolean) => Promise<string>;
7
- export declare const base64ToString: (base64: string, isByteString?: boolean) => Promise<string>;
6
+ export declare const stringToBase64: (str: string, isByteString?: boolean) => string;
7
+ export declare const base64ToString: (base64: string, isByteString?: boolean) => string;
8
8
  export declare const base64ToArrayBuffer: (base64: string) => ArrayBuffer;
9
+ export declare const base64urlToString: (str: string) => string;
9
10
  type EncodedData = {
10
11
  encoded: string;
11
12
  encoding: "bstring";
@@ -21,8 +22,8 @@ export declare const encode: ({ text, compress, }: {
21
22
  text: string;
22
23
  /** defaults to `true`. If compression fails, falls back to bstring alone. */
23
24
  compress?: boolean | undefined;
24
- }) => Promise<EncodedData>;
25
- export declare const decode: (data: EncodedData) => Promise<string>;
25
+ }) => EncodedData;
26
+ export declare const decode: (data: EncodedData) => string;
26
27
  /**
27
28
  * The returned buffer has following format:
28
29
  * `[]` refers to a buffers wrapper (see `concatBuffers`)
@@ -9,7 +9,7 @@ export declare const encodePngMetadata: ({ blob, metadata, }: {
9
9
  export declare const decodePngMetadata: (blob: Blob) => Promise<string>;
10
10
  export declare const encodeSvgMetadata: ({ text }: {
11
11
  text: string;
12
- }) => Promise<string>;
12
+ }) => string;
13
13
  export declare const decodeSvgMetadata: ({ svg }: {
14
14
  svg: string;
15
- }) => Promise<string>;
15
+ }) => string;
@@ -1 +1,3 @@
1
- export const ExcalidrawLib: {};
1
+ declare const _exports: any;
2
+ export = _exports;
3
+ export const ExcalidrawLib: any;
@@ -30,7 +30,7 @@ export declare const getHoveredElementForBinding: (pointerCoords: {
30
30
  }, elements: readonly NonDeletedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap, fullShape?: boolean) => NonDeleted<ExcalidrawBindableElement> | null;
31
31
  export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap, options?: {
32
32
  simultaneouslyUpdated?: readonly ExcalidrawElement[];
33
- oldSize?: {
33
+ newSize?: {
34
34
  width: number;
35
35
  height: number;
36
36
  };
@@ -0,0 +1,14 @@
1
+ import type { TransformHandleType } from "./transformHandles";
2
+ import type { ElementsMap, ExcalidrawImageElement, ImageCrop } from "./types";
3
+ export declare const cropElement: (element: ExcalidrawImageElement, transformHandle: TransformHandleType, naturalWidth: number, naturalHeight: number, pointerX: number, pointerY: number, widthAspectRatio?: number) => {
4
+ x: number;
5
+ y: number;
6
+ width: number;
7
+ height: number;
8
+ crop: ImageCrop | null;
9
+ };
10
+ export declare const getUncroppedImageElement: (element: ExcalidrawImageElement, elementsMap: ElementsMap) => ExcalidrawImageElement;
11
+ export declare const getUncroppedWidthAndHeight: (element: ExcalidrawImageElement) => {
12
+ width: number;
13
+ height: number;
14
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Create and link between shapes.
3
+ */
4
+ import type { AppProps, AppState } from "../types";
5
+ import type { ExcalidrawElement } from "./types";
6
+ export declare const defaultGetElementLinkFromSelection: Exclude<AppProps["generateLinkForSelection"], undefined>;
7
+ export declare const getLinkIdAndTypeFromSelection: (selectedElements: ExcalidrawElement[], appState: AppState) => {
8
+ id: string;
9
+ type: "element" | "group";
10
+ } | null;
11
+ export declare const canCreateLinkFromElements: (selectedElements: ExcalidrawElement[]) => boolean;
12
+ export declare const isElementLink: (url: string) => boolean;
13
+ export declare const parseElementLinkFromURL: (url: string) => string | null;
@@ -94,12 +94,18 @@ export declare const actionSetEmbeddableAsActiveTool: {
94
94
  tab: "mermaid" | "text-to-diagram";
95
95
  } | {
96
96
  name: "commandPalette";
97
+ } | {
98
+ name: "elementLinkSelector";
99
+ sourceElementId: string;
97
100
  } | null;
98
101
  defaultSidebarDockedPreference: boolean;
99
102
  lastPointerDownWith: import("./types").PointerType;
100
103
  selectedElementIds: Readonly<{
101
104
  [id: string]: true;
102
105
  }>;
106
+ hoveredElementIds: Readonly<{
107
+ [id: string]: true;
108
+ }>;
103
109
  previousSelectedElementIds: {
104
110
  [id: string]: true;
105
111
  };
@@ -200,6 +206,8 @@ export declare const actionSetEmbeddableAsActiveTool: {
200
206
  objectsSnapModeEnabled: boolean;
201
207
  userToFollow: import("../types").UserToFollow | null;
202
208
  followedBy: Set<import("../types").SocketId>;
209
+ isCropping: boolean;
210
+ croppingElementId: string | null;
203
211
  searchMatches: readonly {
204
212
  id: string;
205
213
  focus: boolean;
@@ -29,4 +29,4 @@ export declare const updateImageCache: ({ fileIds, files, imageCache, }: {
29
29
  }>;
30
30
  export declare const getInitializedImageElements: (elements: readonly ExcalidrawElement[]) => InitializedExcalidrawImageElement[];
31
31
  export declare const isHTMLSVGElement: (node: Node | null) => node is SVGElement;
32
- export declare const normalizeSVG: (SVGString: string) => Promise<string>;
32
+ export declare const normalizeSVG: (SVGString: string) => string;
@@ -58,6 +58,7 @@ export declare const newImageElement: (opts: {
58
58
  status?: ExcalidrawImageElement["status"];
59
59
  fileId?: ExcalidrawImageElement["fileId"];
60
60
  scale?: ExcalidrawImageElement["scale"];
61
+ crop?: ExcalidrawImageElement["crop"];
61
62
  } & ElementConstructorOpts) => NonDeleted<ExcalidrawImageElement>;
62
63
  /**
63
64
  * Clones ExcalidrawElement data structure. Does not regenerate id, nonce, or
@@ -2,8 +2,6 @@ import type { ElementsMap, ExcalidrawElement, ExcalidrawElementType, ExcalidrawT
2
2
  import type { MaybeTransformHandleType } from "./transformHandles";
3
3
  import type { AppState } from "../types";
4
4
  import type { ExtractSetType } from "../utility-types";
5
- export declare const containsCJK: (text: string) => boolean;
6
- export declare const containsEmoji: (text: string) => boolean;
7
5
  export declare const normalizeText: (text: string) => string;
8
6
  export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null, elementsMap: ElementsMap, informMutation?: boolean) => void;
9
7
  export declare const bindTextToShapeAfterDuplication: (newElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
@@ -29,10 +27,22 @@ export declare const detectLineHeight: (textElement: ExcalidrawTextElement) => n
29
27
  */
30
28
  export declare const getLineHeightInPx: (fontSize: ExcalidrawTextElement["fontSize"], lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
31
29
  export declare const getApproxMinLineHeight: (fontSize: ExcalidrawTextElement["fontSize"], lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
30
+ /**
31
+ * @param forceAdvanceWidth use to force retrieve the "advance width" ~ `metrics.width`, instead of the actual boundind box width.
32
+ *
33
+ * > The advance width is the distance between the glyph's initial pen position and the next glyph's initial pen position.
34
+ *
35
+ * We need to use the advance width as that's the closest thing to the browser wrapping algo, hence using it for:
36
+ * - text wrapping
37
+ * - wysiwyg editor (+padding)
38
+ *
39
+ * Everything else should be based on the actual bounding box width.
40
+ *
41
+ * `Math.ceil` of the final width adds additional buffer which stabilizes slight wrapping incosistencies.
42
+ */
43
+ export declare const getLineWidth: (text: string, font: FontString, forceAdvanceWidth?: true) => number;
32
44
  export declare const getTextWidth: (text: string, font: FontString, forceAdvanceWidth?: true) => number;
33
45
  export declare const getTextHeight: (text: string, fontSize: number, lineHeight: ExcalidrawTextElement["lineHeight"]) => number;
34
- export declare const parseTokens: (line: string) => string[];
35
- export declare const wrapText: (text: string, font: FontString, maxWidth: number) => string;
36
46
  export declare const charWidth: {
37
47
  calculate: (char: string, font: FontString) => number;
38
48
  getCache: (font: FontString) => number[];
@@ -0,0 +1,13 @@
1
+ import type { FontString } from "./types";
2
+ /**
3
+ * Test if a given text contains any CJK characters (including symbols, punctuation, etc,).
4
+ */
5
+ export declare const containsCJK: (text: string) => boolean;
6
+ /**
7
+ * Breaks the line into the tokens based on the found line break opporutnities.
8
+ */
9
+ export declare const parseTokens: (line: string) => string[];
10
+ /**
11
+ * Wraps the original text into the lines based on the given width.
12
+ */
13
+ export declare const wrapText: (text: string, font: FontString, maxWidth: number) => string;
@@ -40,7 +40,7 @@ export declare const getTransformHandlesFromCoords: ([x1, y1, x2, y2, cx, cy]: [
40
40
  sw?: boolean | undefined;
41
41
  se?: boolean | undefined;
42
42
  rotation?: boolean | undefined;
43
- }, margin?: number) => TransformHandles;
43
+ }, margin?: number, spacing?: number) => TransformHandles;
44
44
  export declare const getTransformHandles: (element: ExcalidrawElement, zoom: Zoom, elementsMap: ElementsMap, pointerType?: PointerType, omitSides?: {
45
45
  e?: boolean | undefined;
46
46
  s?: boolean | undefined;
@@ -120,6 +120,14 @@ export type IframeData = ({
120
120
  type: "document";
121
121
  srcdoc: (theme: Theme) => string;
122
122
  }));
123
+ export type ImageCrop = {
124
+ x: number;
125
+ y: number;
126
+ width: number;
127
+ height: number;
128
+ naturalWidth: number;
129
+ naturalHeight: number;
130
+ };
123
131
  export type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
124
132
  type: "image";
125
133
  fileId: FileId | null;
@@ -127,6 +135,8 @@ export type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
127
135
  status: "pending" | "saved" | "error";
128
136
  /** X and Y scale factors <-1, 1>, used for image axis flipping */
129
137
  scale: [number, number];
138
+ /** whether an element is cropped */
139
+ crop: ImageCrop | null;
130
140
  }>;
131
141
  export type InitializedExcalidrawImageElement = MarkNonNullable<ExcalidrawImageElement, "fileId">;
132
142
  export type ExcalidrawFrameElement = _ExcalidrawElementBase & {
@@ -22,4 +22,11 @@ export declare class WorkerInTheMainChunkError extends Error {
22
22
  code: WorkerErrorCodes;
23
23
  constructor(message?: string, code?: WorkerErrorCodes);
24
24
  }
25
+ /**
26
+ * Use this for generic, handled errors, so you can check against them
27
+ * and rethrow if needed
28
+ */
29
+ export declare class ExcalidrawError extends Error {
30
+ constructor(message: string);
31
+ }
25
32
  export {};
@@ -1,2 +1,2 @@
1
- import { type ExcalidrawFontFaceDescriptor } from "../..";
1
+ import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
2
2
  export declare const CascadiaFontFaces: ExcalidrawFontFaceDescriptor[];
@@ -0,0 +1,2 @@
1
+ import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
2
+ export declare const ComicShannsFontFaces: ExcalidrawFontFaceDescriptor[];
@@ -1,2 +1,2 @@
1
- import { type ExcalidrawFontFaceDescriptor } from "../..";
1
+ import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
2
2
  export declare const EmojiFontFaces: ExcalidrawFontFaceDescriptor[];
@@ -1,11 +1,5 @@
1
1
  type DataURL = string;
2
- export interface IExcalidrawFontFace {
3
- urls: URL[] | DataURL[];
4
- fontFace: FontFace;
5
- toCSS(characters: string, codePoints: Array<number>): Promise<string> | undefined;
6
- getContentLegacy(): Promise<string>;
7
- }
8
- export declare class ExcalidrawFontFace implements IExcalidrawFontFace {
2
+ export declare class ExcalidrawFontFace {
9
3
  readonly urls: URL[] | DataURL[];
10
4
  readonly fontFace: FontFace;
11
5
  private static readonly UNPKG_FALLBACK_URL;
@@ -15,7 +9,7 @@ export declare class ExcalidrawFontFace implements IExcalidrawFontFace {
15
9
  *
16
10
  * Retrieves `undefined` otherwise.
17
11
  */
18
- toCSS(characters: string, codePoints: Array<number>): Promise<string> | undefined;
12
+ toCSS(characters: string): Promise<string> | undefined;
19
13
  /**
20
14
  * Tries to fetch woff2 content, based on the registered urls (from first to last, treated as fallbacks).
21
15
  *
@@ -1,2 +1,2 @@
1
- import { type ExcalidrawFontFaceDescriptor } from "../..";
1
+ import { type ExcalidrawFontFaceDescriptor } from "../Fonts";
2
2
  export declare const ExcalifontFontFaces: ExcalidrawFontFaceDescriptor[];