@zsviczian/excalidraw 0.18.0-5 → 0.18.0-50

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 (188) hide show
  1. package/dist/excalidraw.development.js +745 -503
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/dist/excalidraw.production.min.js.LICENSE.txt +0 -2
  4. package/dist/styles.development.css +1062 -429
  5. package/dist/styles.production.css +26 -22
  6. package/package.json +14 -3
  7. package/types/common/src/commonObsidianUtils.d.ts +13 -0
  8. package/types/common/src/constants.d.ts +42 -18
  9. package/types/common/src/editorInterface.d.ts +35 -0
  10. package/types/{excalidraw → common/src}/emitter.d.ts +1 -1
  11. package/types/common/src/font-metadata.d.ts +4 -2
  12. package/types/common/src/index.d.ts +2 -0
  13. package/types/common/src/utility-types.d.ts +5 -0
  14. package/types/common/src/utils.d.ts +20 -5
  15. package/types/{excalidraw/scene → element/src}/Scene.d.ts +16 -15
  16. package/types/element/src/align.d.ts +4 -3
  17. package/types/element/src/binding.d.ts +27 -17
  18. package/types/element/src/bounds.d.ts +14 -6
  19. package/types/element/src/collision.d.ts +18 -12
  20. package/types/element/src/cropElement.d.ts +1 -1
  21. package/types/{excalidraw/change.d.ts → element/src/delta.d.ts} +77 -40
  22. package/types/element/src/distance.d.ts +2 -2
  23. package/types/element/src/distribute.d.ts +2 -1
  24. package/types/element/src/dragElements.d.ts +3 -2
  25. package/types/element/src/duplicate.d.ts +10 -13
  26. package/types/element/src/elbowArrow.d.ts +1 -1
  27. package/types/element/src/flowchart.d.ts +3 -2
  28. package/types/element/src/fractionalIndex.d.ts +9 -3
  29. package/types/element/src/frame.d.ts +5 -4
  30. package/types/element/src/groups.d.ts +1 -0
  31. package/types/element/src/index.d.ts +44 -2
  32. package/types/element/src/linearElementEditor.d.ts +23 -36
  33. package/types/element/src/mutateElement.d.ts +11 -3
  34. package/types/element/src/newElement.d.ts +6 -4
  35. package/types/element/src/positionElementsOnGrid.d.ts +2 -0
  36. package/types/element/src/renderElement.d.ts +4 -1
  37. package/types/element/src/resizeElements.d.ts +6 -5
  38. package/types/element/src/resizeTest.d.ts +5 -4
  39. package/types/element/src/selection.d.ts +11 -5
  40. package/types/element/src/shape.d.ts +42 -0
  41. package/types/element/src/sizeHelpers.d.ts +2 -2
  42. package/types/element/src/store.d.ts +237 -0
  43. package/types/element/src/textElement.d.ts +5 -3
  44. package/types/element/src/transformHandles.d.ts +5 -4
  45. package/types/element/src/typeChecks.d.ts +19 -1
  46. package/types/element/src/types.d.ts +25 -2
  47. package/types/element/src/utils.d.ts +16 -6
  48. package/types/element/src/zindex.d.ts +1 -1
  49. package/types/excalidraw/actions/actionAddToLibrary.d.ts +75 -54
  50. package/types/excalidraw/actions/actionBoundText.d.ts +50 -36
  51. package/types/excalidraw/actions/actionCanvas.d.ts +388 -282
  52. package/types/excalidraw/actions/actionClipboard.d.ts +151 -107
  53. package/types/excalidraw/actions/actionCropEditor.d.ts +25 -18
  54. package/types/excalidraw/actions/actionDeleteSelected.d.ts +77 -55
  55. package/types/excalidraw/actions/actionDuplicateSelection.d.ts +1 -1
  56. package/types/excalidraw/actions/actionElementLink.d.ts +25 -18
  57. package/types/excalidraw/actions/actionElementLock.d.ts +65 -52
  58. package/types/excalidraw/actions/actionEmbeddable.d.ts +25 -18
  59. package/types/excalidraw/actions/actionExport.d.ts +237 -174
  60. package/types/excalidraw/actions/actionFinalize.d.ts +307 -43
  61. package/types/excalidraw/actions/actionFrame.d.ts +157 -120
  62. package/types/excalidraw/actions/actionGroup.d.ts +50 -36
  63. package/types/excalidraw/actions/actionHistory.d.ts +1 -2
  64. package/types/excalidraw/actions/actionLinearEditor.d.ts +563 -20
  65. package/types/excalidraw/actions/actionLink.d.ts +23 -16
  66. package/types/excalidraw/actions/actionMenu.d.ts +25 -456
  67. package/types/excalidraw/actions/actionNavigate.d.ts +49 -35
  68. package/types/excalidraw/actions/actionProperties.d.ts +629 -273
  69. package/types/excalidraw/actions/actionSelectAll.d.ts +25 -18
  70. package/types/excalidraw/actions/actionStyles.d.ts +25 -18
  71. package/types/excalidraw/actions/actionToggleGridMode.d.ts +25 -18
  72. package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +25 -18
  73. package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +25 -223
  74. package/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
  75. package/types/excalidraw/actions/actionToggleStats.d.ts +25 -18
  76. package/types/excalidraw/actions/actionToggleViewMode.d.ts +25 -18
  77. package/types/excalidraw/actions/actionToggleZenMode.d.ts +26 -19
  78. package/types/excalidraw/actions/actionTrayMenu.d.ts +226 -0
  79. package/types/excalidraw/actions/index.d.ts +4 -2
  80. package/types/excalidraw/actions/types.d.ts +4 -3
  81. package/types/excalidraw/appState.d.ts +24 -10
  82. package/types/excalidraw/clipboard.d.ts +68 -5
  83. package/types/excalidraw/components/Actions.d.ts +20 -7
  84. package/types/excalidraw/components/App.d.ts +63 -38
  85. package/types/excalidraw/components/ButtonIcon.d.ts +1 -0
  86. package/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -1
  87. package/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +5 -1
  88. package/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +1 -1
  89. package/types/excalidraw/components/ColorPicker/Picker.d.ts +4 -3
  90. package/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +3 -3
  91. package/types/excalidraw/components/ColorPicker/ShadeList.d.ts +3 -2
  92. package/types/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
  93. package/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
  94. package/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +1 -1
  95. package/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
  96. package/types/excalidraw/components/ConvertElementTypePopup.d.ts +23 -0
  97. package/types/excalidraw/components/ElementLinkDialog.d.ts +4 -3
  98. package/types/excalidraw/components/Ellipsify.d.ts +3 -0
  99. package/types/excalidraw/components/ExcalidrawLogo.d.ts +1 -1
  100. package/types/excalidraw/components/FixedSideContainer.d.ts +2 -1
  101. package/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
  102. package/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
  103. package/types/excalidraw/components/HintViewer.d.ts +4 -3
  104. package/types/excalidraw/components/InlineIcon.d.ts +3 -1
  105. package/types/excalidraw/components/LayerUI.d.ts +2 -1
  106. package/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
  107. package/types/excalidraw/components/MobileMenu.d.ts +4 -5
  108. package/types/excalidraw/components/MobileToolBar.d.ts +10 -0
  109. package/types/excalidraw/components/Popover.d.ts +2 -1
  110. package/types/excalidraw/components/PropertiesPopover.d.ts +1 -0
  111. package/types/excalidraw/components/{ButtonIconSelect.d.ts → RadioSelection.d.ts} +1 -1
  112. package/types/excalidraw/components/Range.d.ts +3 -3
  113. package/types/excalidraw/components/Section.d.ts +1 -0
  114. package/types/excalidraw/components/Stats/Angle.d.ts +1 -1
  115. package/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
  116. package/types/excalidraw/components/Stats/CanvasGridSize.d.ts +1 -1
  117. package/types/excalidraw/components/Stats/Collapsible.d.ts +2 -1
  118. package/types/excalidraw/components/Stats/Dimension.d.ts +1 -1
  119. package/types/excalidraw/components/Stats/DragInput.d.ts +12 -2
  120. package/types/excalidraw/components/Stats/FontSize.d.ts +1 -1
  121. package/types/excalidraw/components/Stats/MultiAngle.d.ts +1 -1
  122. package/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -1
  123. package/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -1
  124. package/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -1
  125. package/types/excalidraw/components/Stats/Position.d.ts +1 -1
  126. package/types/excalidraw/components/Stats/utils.d.ts +4 -11
  127. package/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +1 -2
  128. package/types/excalidraw/components/TextField.d.ts +1 -0
  129. package/types/excalidraw/components/ToolPopover.d.ts +25 -0
  130. package/types/excalidraw/components/TrayMenu.d.ts +26 -0
  131. package/types/excalidraw/components/UnlockPopup.d.ts +8 -0
  132. package/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +4 -2
  133. package/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +4 -2
  134. package/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +2 -1
  135. package/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
  136. package/types/excalidraw/components/hyperlink/helpers.d.ts +2 -1
  137. package/types/excalidraw/components/icons.d.ts +13 -0
  138. package/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +14 -1
  139. package/types/excalidraw/components/main-menu/MainMenu.d.ts +0 -3
  140. package/types/excalidraw/components/shapes.d.ts +115 -5
  141. package/types/excalidraw/data/blob.d.ts +3 -7
  142. package/types/excalidraw/data/reconcile.d.ts +1 -0
  143. package/types/excalidraw/data/restore.d.ts +6 -1
  144. package/types/excalidraw/data/transform.d.ts +1 -1
  145. package/types/excalidraw/data/types.d.ts +4 -1
  146. package/types/excalidraw/editor-jotai.d.ts +6 -6
  147. package/types/excalidraw/eraser/index.d.ts +12 -0
  148. package/types/excalidraw/fonts/Fonts.d.ts +1 -1
  149. package/types/excalidraw/history.d.ts +30 -22
  150. package/types/excalidraw/hooks/useEmitter.d.ts +1 -1
  151. package/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
  152. package/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
  153. package/types/excalidraw/index.d.ts +15 -14
  154. package/types/excalidraw/lasso/index.d.ts +1 -0
  155. package/types/excalidraw/lasso/utils.d.ts +3 -3
  156. package/types/excalidraw/obsidianUtils.d.ts +22 -4
  157. package/types/excalidraw/renderer/helpers.d.ts +7 -2
  158. package/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
  159. package/types/excalidraw/renderer/staticScene.d.ts +4 -1
  160. package/types/excalidraw/scene/Renderer.d.ts +1 -2
  161. package/types/excalidraw/scene/index.d.ts +2 -2
  162. package/types/excalidraw/scene/scrollbars.d.ts +2 -3
  163. package/types/excalidraw/scene/types.d.ts +5 -3
  164. package/types/excalidraw/shortcut.d.ts +1 -0
  165. package/types/excalidraw/snapping.d.ts +2 -2
  166. package/types/excalidraw/types.d.ts +68 -30
  167. package/types/excalidraw/webpack.dev.config.d.ts +2 -0
  168. package/types/excalidraw/webpack.prod.config.d.ts +2 -0
  169. package/types/excalidraw/wysiwyg/textWysiwyg.d.ts +3 -1
  170. package/types/math/src/angle.d.ts +2 -0
  171. package/types/math/src/constants.d.ts +3 -0
  172. package/types/math/src/curve.d.ts +34 -0
  173. package/types/math/src/index.d.ts +1 -0
  174. package/types/math/src/point.d.ts +1 -1
  175. package/types/math/src/rectangle.d.ts +2 -0
  176. package/types/math/src/segment.d.ts +1 -0
  177. package/types/math/src/types.d.ts +1 -0
  178. package/types/math/src/vector.d.ts +8 -2
  179. package/types/utils/src/bbox.d.ts +1 -1
  180. package/types/utils/src/index.d.ts +1 -1
  181. package/types/utils/src/withinBounds.d.ts +1 -1
  182. package/types/element/src/Shape.d.ts +0 -17
  183. package/types/element/src/ShapeCache.d.ts +0 -25
  184. package/types/element/src/shapes.d.ts +0 -23
  185. package/types/excalidraw/components/ButtonSelect.d.ts +0 -9
  186. package/types/excalidraw/store.d.ts +0 -129
  187. package/types/excalidraw/visualdebug.d.ts +0 -41
  188. package/types/utils/src/collision.d.ts +0 -8
@@ -1,14 +1,14 @@
1
- import { atom, createStore, type PrimitiveAtom } from "jotai";
1
+ import { atom, createStore, type PrimitiveAtom, type WritableAtom } from "jotai";
2
2
  import { createIsolation } from "jotai-scope";
3
- export { atom, PrimitiveAtom };
3
+ export { atom, PrimitiveAtom, WritableAtom };
4
4
  export declare const useAtom: typeof import("jotai").useAtom, useSetAtom: typeof import("jotai").useSetAtom, useAtomValue: typeof import("jotai").useAtomValue, useStore: (options?: {
5
5
  store?: {
6
6
  get: <Value>(atom: import("jotai").Atom<Value>) => Value;
7
- set: <Value_1, Args extends unknown[], Result>(atom: import("jotai").WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
7
+ set: <Value_1, Args extends unknown[], Result>(atom: WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
8
8
  sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
9
9
  } | ({
10
10
  get: <Value_2>(atom: import("jotai").Atom<Value_2>) => Value_2;
11
- set: <Value_1_1, Args_1 extends unknown[], Result_1>(atom: import("jotai").WritableAtom<Value_1_1, Args_1, Result_1>, ...args: Args_1) => Result_1;
11
+ set: <Value_1_1, Args_1 extends unknown[], Result_1>(atom: WritableAtom<Value_1_1, Args_1, Result_1>, ...args: Args_1) => Result_1;
12
12
  sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
13
13
  } & {
14
14
  dev4_get_internal_weak_map: () => WeakMap<import("jotai").Atom<unknown>, {
@@ -29,11 +29,11 @@ export declare const useAtom: typeof import("jotai").useAtom, useSetAtom: typeof
29
29
  }) | undefined;
30
30
  } | undefined) => {
31
31
  get: <Value_3>(atom: import("jotai").Atom<Value_3>) => Value_3;
32
- set: <Value_1_2, Args_2 extends unknown[], Result_2>(atom: import("jotai").WritableAtom<Value_1_2, Args_2, Result_2>, ...args: Args_2) => Result_2;
32
+ set: <Value_1_2, Args_2 extends unknown[], Result_2>(atom: WritableAtom<Value_1_2, Args_2, Result_2>, ...args: Args_2) => Result_2;
33
33
  sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
34
34
  } | ({
35
35
  get: <Value_4>(atom: import("jotai").Atom<Value_4>) => Value_4;
36
- set: <Value_1_3, Args_3 extends unknown[], Result_3>(atom: import("jotai").WritableAtom<Value_1_3, Args_3, Result_3>, ...args: Args_3) => Result_3;
36
+ set: <Value_1_3, Args_3 extends unknown[], Result_3>(atom: WritableAtom<Value_1_3, Args_3, Result_3>, ...args: Args_3) => Result_3;
37
37
  sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
38
38
  } & {
39
39
  dev4_get_internal_weak_map: () => WeakMap<import("jotai").Atom<unknown>, {
@@ -0,0 +1,12 @@
1
+ import { AnimatedTrail } from "../animated-trail";
2
+ import type { AnimationFrameHandler } from "../animation-frame-handler";
3
+ import type App from "../components/App";
4
+ export declare class EraserTrail extends AnimatedTrail {
5
+ private elementsToErase;
6
+ private groupsToErase;
7
+ constructor(animationFrameHandler: AnimationFrameHandler, app: App);
8
+ startPath(x: number, y: number): void;
9
+ addPointToPath(x: number, y: number, restore?: boolean): string[];
10
+ private updateElementsToBeErased;
11
+ endPath(): void;
12
+ }
@@ -1,7 +1,7 @@
1
1
  import { type FontMetadata } from "@excalidraw/common";
2
2
  import type { ExcalidrawElement, ExcalidrawTextElement } from "@excalidraw/element/types";
3
+ import type { Scene } from "@excalidraw/element";
3
4
  import { ExcalidrawFontFace } from "./ExcalidrawFontFace";
4
- import type Scene from "../scene/Scene";
5
5
  export declare class Fonts {
6
6
  static readonly loadedFontsCache: Set<string>;
7
7
  private static _registered;
@@ -1,40 +1,48 @@
1
+ import { Emitter } from "@excalidraw/common";
2
+ import { StoreDelta } from "@excalidraw/element";
3
+ import type { StoreSnapshot, Store } from "@excalidraw/element";
1
4
  import type { SceneElementsMap } from "@excalidraw/element/types";
2
- import { Emitter } from "./emitter";
3
- import type { AppStateChange, ElementsChange } from "./change";
4
- import type { Snapshot } from "./store";
5
5
  import type { AppState } from "./types";
6
+ export declare class HistoryDelta extends StoreDelta {
7
+ /**
8
+ * Apply the delta to the passed elements and appState, does not modify the snapshot.
9
+ */
10
+ applyTo(elements: SceneElementsMap, appState: AppState, snapshot: StoreSnapshot): [SceneElementsMap, AppState, boolean];
11
+ /**
12
+ * Overriding once to avoid type casting everywhere.
13
+ */
14
+ static calculate(prevSnapshot: StoreSnapshot, nextSnapshot: StoreSnapshot): HistoryDelta;
15
+ /**
16
+ * Overriding once to avoid type casting everywhere.
17
+ */
18
+ static inverse(delta: StoreDelta): HistoryDelta;
19
+ /**
20
+ * Overriding once to avoid type casting everywhere.
21
+ */
22
+ static applyLatestChanges(delta: StoreDelta, prevElements: SceneElementsMap, nextElements: SceneElementsMap, modifierOptions?: "deleted" | "inserted"): HistoryDelta;
23
+ }
6
24
  export declare class HistoryChangedEvent {
7
25
  readonly isUndoStackEmpty: boolean;
8
26
  readonly isRedoStackEmpty: boolean;
9
27
  constructor(isUndoStackEmpty?: boolean, isRedoStackEmpty?: boolean);
10
28
  }
11
29
  export declare class History {
30
+ private readonly store;
12
31
  readonly onHistoryChangedEmitter: Emitter<[HistoryChangedEvent]>;
13
- private readonly undoStack;
14
- private readonly redoStack;
32
+ readonly undoStack: HistoryDelta[];
33
+ readonly redoStack: HistoryDelta[];
15
34
  get isUndoStackEmpty(): boolean;
16
35
  get isRedoStackEmpty(): boolean;
36
+ constructor(store: Store);
17
37
  clear(): void;
18
38
  /**
19
- * Record a local change which will go into the history
39
+ * Record a non-empty local durable increment, which will go into the undo stack..
40
+ * Do not re-record history entries, which were already pushed to undo / redo stack, as part of history action.
20
41
  */
21
- record(elementsChange: ElementsChange, appStateChange: AppStateChange): void;
22
- undo(elements: SceneElementsMap, appState: AppState, snapshot: Readonly<Snapshot>): void | [SceneElementsMap, AppState];
23
- redo(elements: SceneElementsMap, appState: AppState, snapshot: Readonly<Snapshot>): void | [SceneElementsMap, AppState];
42
+ record(delta: StoreDelta): void;
43
+ undo(elements: SceneElementsMap, appState: AppState): void | [SceneElementsMap, AppState];
44
+ redo(elements: SceneElementsMap, appState: AppState): void | [SceneElementsMap, AppState];
24
45
  private perform;
25
46
  private static pop;
26
47
  private static push;
27
48
  }
28
- export declare class HistoryEntry {
29
- readonly appStateChange: AppStateChange;
30
- readonly elementsChange: ElementsChange;
31
- private constructor();
32
- static create(appStateChange: AppStateChange, elementsChange: ElementsChange): HistoryEntry;
33
- inverse(): HistoryEntry;
34
- applyTo(elements: SceneElementsMap, appState: AppState, snapshot: Readonly<Snapshot>): [SceneElementsMap, AppState, boolean];
35
- /**
36
- * Apply latest (remote) changes to the history entry, creates new instance of `HistoryEntry`.
37
- */
38
- applyLatestChanges(elements: SceneElementsMap): HistoryEntry;
39
- isEmpty(): boolean;
40
- }
@@ -1,2 +1,2 @@
1
- import type { Emitter } from "../emitter";
1
+ import type { Emitter } from "@excalidraw/common";
2
2
  export declare const useEmitter: <TEvent extends unknown>(emitter: Emitter<[TEvent]>, initialState: TEvent) => TEvent;
@@ -3,7 +3,7 @@ export type SvgCache = Map<LibraryItem["id"], SVGSVGElement>;
3
3
  export declare const libraryItemSvgsCache: import("jotai/vanilla/atom").PrimitiveAtom<SvgCache> & {
4
4
  init: SvgCache;
5
5
  };
6
- export declare const useLibraryItemSvg: (id: LibraryItem["id"] | null, elements: LibraryItem["elements"] | undefined, svgCache: SvgCache) => SVGSVGElement | undefined;
6
+ export declare const useLibraryItemSvg: (id: LibraryItem["id"] | null, elements: LibraryItem["elements"] | undefined, svgCache: SvgCache, ref: React.RefObject<HTMLDivElement | null>) => SVGSVGElement | undefined;
7
7
  export declare const useLibraryCache: () => {
8
8
  clearLibraryCache: () => void;
9
9
  deleteItemsFromLibraryCache: (items: LibraryItem["id"][]) => void;
@@ -0,0 +1,14 @@
1
+ export type CaretPosition = {
2
+ start: number;
3
+ end: number;
4
+ };
5
+ export declare const saveCaretPosition: () => CaretPosition | null;
6
+ export declare const restoreCaretPosition: (position: CaretPosition | null) => void;
7
+ export declare const withCaretPositionPreservation: (callback: () => void, isCompactMode: boolean, isEditingText: boolean, onPreventClose?: () => void) => void;
8
+ export declare const useTextEditorFocus: () => {
9
+ saveCaretPosition: () => void;
10
+ restoreCaretPosition: () => void;
11
+ clearSavedPosition: () => void;
12
+ hasSavedPosition: boolean;
13
+ };
14
+ export declare const temporarilyDisableTextEditorBlur: (duration?: number) => void;
@@ -9,10 +9,10 @@ import "./fonts/fonts.css";
9
9
  import type { ExcalidrawProps } from "./types";
10
10
  export declare const Excalidraw: React.MemoExoticComponent<(props: ExcalidrawProps) => import("react/jsx-runtime").JSX.Element>;
11
11
  export { getSceneVersion, hashElementsVersion, hashString, getNonDeletedElements, } from "@excalidraw/element";
12
- export { getTextFromElements } from "@excalidraw/element/textElement";
13
- export { isInvisiblySmallElement } from "@excalidraw/element/sizeHelpers";
12
+ export { getTextFromElements } from "@excalidraw/element";
13
+ export { isInvisiblySmallElement } from "@excalidraw/element";
14
14
  export { defaultLang, useI18n, languages } from "./i18n";
15
- export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "./data/restore";
15
+ export { restore, restoreAppState, restoreElement, restoreElements, restoreLibraryItems, } from "./data/restore";
16
16
  export { reconcileElements } from "./data/reconcile";
17
17
  export { exportToCanvas, exportToBlob, exportToSvg, exportToClipboard, } from "@excalidraw/utils/export";
18
18
  export { getCommonBoundingBox } from "@excalidraw/element/bounds";
@@ -24,25 +24,26 @@ export { getLineHeight } from "@excalidraw/common";
24
24
  export { getFontString, getFontFamilyString } from "@excalidraw/common";
25
25
  export { getBoundTextMaxWidth } from "@excalidraw/element/textElement";
26
26
  export { mermaidToExcalidraw } from "./components/TTDDialog/MermaidToExcalidrawLib";
27
- export { destroyObsidianUtils, registerLocalFont, getFontFamilies, registerFontsInCSS, getCSSFontDefinition, loadSceneFonts, getSharedMermaidInstance, loadMermaid, intersectElementWithLine, } from "../excalidraw/obsidianUtils";
27
+ export { destroyObsidianUtils, registerLocalFont, getFontMetrics, getFontFamilies, registerFontsInCSS, getCSSFontDefinition, loadSceneFonts, getSharedMermaidInstance, loadMermaid, intersectElementWithLine, } from "../excalidraw/obsidianUtils";
28
28
  export { refreshTextDimensions } from "@excalidraw/element/newElement";
29
+ export { syncMovedIndices, syncInvalidIndices } from "@excalidraw/element";
29
30
  export { getContainerElement } from "@excalidraw/element/textElement";
30
31
  export { serializeAsJSON, serializeLibraryAsJSON } from "./data/json";
31
32
  export { loadFromBlob, loadSceneOrLibraryFromBlob, loadLibraryFromBlob, } from "./data/blob";
32
- export { getFreeDrawSvgPath } from "@excalidraw/element/renderElement";
33
+ export { getFreeDrawSvgPath } from "@excalidraw/element";
33
34
  export { mergeLibraryItems, getLibraryItemsHash } from "./data/library";
34
- export { isLinearElement } from "@excalidraw/element/typeChecks";
35
- export { FONT_FAMILY, THEME, MIME_TYPES, ROUNDNESS, DEFAULT_LASER_COLOR, UserIdleState, normalizeLink, } from "@excalidraw/common";
36
- export { mutateElement, newElementWith, bumpVersion, } from "@excalidraw/element/mutateElement";
37
- export { CaptureUpdateAction } from "./store";
35
+ export { isLinearElement } from "@excalidraw/element";
36
+ export { FONT_FAMILY, THEME, MIME_TYPES, ROUNDNESS, DEFAULT_LASER_COLOR, UserIdleState, normalizeLink, sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, getFormFactor, safelyParseJSON, } from "@excalidraw/common";
37
+ export { mutateElement, newElementWith, bumpVersion, } from "@excalidraw/element";
38
+ export { CaptureUpdateAction } from "@excalidraw/element";
38
39
  export { parseLibraryTokensFromUrl, useHandleLibrary } from "./data/library";
39
- export { sceneCoordsToViewportCoords, viewportCoordsToSceneCoords, safelyParseJSON, } from "@excalidraw/common";
40
40
  export { getEmbedLink } from "@excalidraw/element/embeddable";
41
41
  export { Sidebar } from "./components/Sidebar/Sidebar";
42
42
  export { Button } from "./components/Button";
43
43
  export { Footer };
44
44
  export { MainMenu };
45
- export { useDevice } from "./components/App";
45
+ export { Ellipsify } from "./components/Ellipsify";
46
+ export { useEditorInterface, useStylesPanelMode } from "./components/App";
46
47
  export { WelcomeScreen };
47
48
  export { LiveCollaborationTrigger };
48
49
  export { Stats } from "./components/Stats";
@@ -51,9 +52,9 @@ export { TTDDialog } from "./components/TTDDialog/TTDDialog";
51
52
  export { TTDDialogTrigger } from "./components/TTDDialog/TTDDialogTrigger";
52
53
  export { zoomToFitBounds } from "./actions/actionCanvas";
53
54
  export { convertToExcalidrawElements } from "./data/transform";
54
- export { getCommonBounds, getVisibleSceneBounds, } from "@excalidraw/element/bounds";
55
+ export { getCommonBounds, getVisibleSceneBounds } from "@excalidraw/element";
55
56
  export { elementsOverlappingBBox, isElementInsideBBox, elementPartiallyOverlapsWithOrContainsBBox, } from "@excalidraw/utils/withinBounds";
56
57
  export { DiagramToCodePlugin } from "./components/DiagramToCodePlugin/DiagramToCodePlugin";
57
58
  export { getDataURL } from "./data/blob";
58
- export { isElementLink } from "@excalidraw/element/elementLink";
59
- export { setCustomTextMetricsProvider } from "@excalidraw/element/textMeasurements";
59
+ export { isElementLink } from "@excalidraw/element";
60
+ export { setCustomTextMetricsProvider } from "@excalidraw/element";
@@ -5,6 +5,7 @@ export declare class LassoTrail extends AnimatedTrail {
5
5
  private intersectedElements;
6
6
  private enclosedElements;
7
7
  private elementsSegments;
8
+ private canvasTranslate;
8
9
  private keepPreviousSelection;
9
10
  constructor(animationFrameHandler: AnimationFrameHandler, app: App);
10
11
  startPath(x: number, y: number, keepPreviousSelection?: boolean): void;
@@ -1,9 +1,9 @@
1
- import type { GlobalPoint, LineSegment } from "@excalidraw/math/types";
2
- import type { ExcalidrawElement } from "@excalidraw/element/types";
3
- export type ElementsSegmentsMap = Map<string, LineSegment<GlobalPoint>[]>;
1
+ import type { ElementsSegmentsMap, GlobalPoint } from "@excalidraw/math/types";
2
+ import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
4
3
  export declare const getLassoSelectedElementIds: (input: {
5
4
  lassoPath: GlobalPoint[];
6
5
  elements: readonly ExcalidrawElement[];
6
+ elementsMap: ElementsMap;
7
7
  elementsSegments: ElementsSegmentsMap;
8
8
  intersectedElements: Set<ExcalidrawElement["id"]>;
9
9
  enclosedElements: Set<ExcalidrawElement["id"]>;
@@ -1,19 +1,28 @@
1
- import { GlobalPoint } from "@excalidraw/math/types";
2
- import type { MermaidToExcalidrawLibProps } from "./components/TTDDialog/common";
3
- import type { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
1
+ import { type GlobalPoint } from "@excalidraw/math/types";
4
2
  import type { FontMetadata } from "@excalidraw/common";
5
- import type { AppState } from "./types";
3
+ import type { ElementsMap, ExcalidrawElement, ExcalidrawTextElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
4
+ import type { AppClassProperties, AppState } from "./types";
5
+ import type { MermaidToExcalidrawLibProps } from "./components/TTDDialog/common";
6
6
  export declare let hostPlugin: any;
7
7
  export declare function destroyObsidianUtils(): void;
8
8
  export declare function initializeObsidianUtils(): void;
9
9
  export declare function getAreaLimit(): any;
10
10
  export declare function getWidthHeightLimit(): any;
11
11
  export declare function allowDoubleTapEraser(): any;
12
+ export declare function isPanWithRightMouseEnabled(): boolean;
12
13
  export declare function getMaxZoom(): number;
13
14
  export declare function isExcaliBrainView(): any;
14
15
  export declare function getExcalidrawContentEl(): HTMLElement;
15
16
  export declare function hideFreedrawPenmodeCursor(): boolean;
16
17
  export declare function getOpenAIDefaultVisionModel(): any;
18
+ export declare function getFontMetrics(fontFamily: ExcalidrawTextElement["fontFamily"], fontSize?: number): {
19
+ unitsPerEm: number;
20
+ ascender: number;
21
+ descender: number;
22
+ lineHeight: number;
23
+ baseline: number;
24
+ fontString: string;
25
+ };
17
26
  export declare function registerLocalFont(fontMetrics: FontMetadata & {
18
27
  name: string;
19
28
  }, uri: string): void;
@@ -26,3 +35,12 @@ export declare function isTouchInPenMode(appState: AppState, event: React.Pointe
26
35
  export declare function getSharedMermaidInstance(): Promise<MermaidToExcalidrawLibProps>;
27
36
  export declare function loadMermaid(): Promise<MermaidToExcalidrawLibProps>;
28
37
  export declare const intersectElementWithLine: (element: ExcalidrawElement, a: GlobalPoint, b: GlobalPoint, gap: number | undefined, elementsMap: ElementsMap) => GlobalPoint[] | undefined;
38
+ export declare const disableDoubleClickTextEditing: () => any;
39
+ export declare const getZoomStep: () => any;
40
+ export declare const getZoomMin: () => any;
41
+ export declare const getZoomMax: () => any;
42
+ export declare const runAction: (action: string) => void;
43
+ export declare const t2: (key: string) => string;
44
+ export declare const shouldDisableZoom: (appState: AppState) => boolean;
45
+ export declare const isFullPanelMode: (app: AppClassProperties) => boolean;
46
+ export declare const isContextMenuDisabled: () => boolean;
@@ -1,6 +1,7 @@
1
+ import type { ElementsMap, ExcalidrawDiamondElement, ExcalidrawRectanguloidElement } from "@excalidraw/element/types";
1
2
  import type { StaticCanvasRenderConfig } from "../scene/types";
2
- import type { StaticCanvasAppState, AppState } from "../types";
3
- export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke?: boolean) => void;
3
+ import type { AppState, StaticCanvasAppState } from "../types";
4
+ export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke: boolean, fill?: boolean) => void;
4
5
  export declare const getNormalizedCanvasDimensions: (canvas: HTMLCanvasElement, scale: number) => [number, number];
5
6
  export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normalizedHeight, theme, isExporting, viewBackgroundColor, }: {
6
7
  canvas: HTMLCanvasElement;
@@ -11,3 +12,7 @@ export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normali
11
12
  isExporting?: boolean | undefined;
12
13
  viewBackgroundColor?: string | null | undefined;
13
14
  }) => CanvasRenderingContext2D;
15
+ export declare const drawHighlightForRectWithRotation: (context: CanvasRenderingContext2D, element: ExcalidrawRectanguloidElement, elementsMap: ElementsMap, padding: number) => void;
16
+ export declare const strokeEllipseWithRotation: (context: CanvasRenderingContext2D, width: number, height: number, cx: number, cy: number, angle: number) => void;
17
+ export declare const strokeRectWithRotation: (context: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, cx: number, cy: number, angle: number, fill?: boolean, radius?: number) => void;
18
+ export declare const drawHighlightForDiamondWithRotation: (context: CanvasRenderingContext2D, padding: number, element: ExcalidrawDiamondElement, elementsMap: ElementsMap) => void;
@@ -9,7 +9,7 @@ export declare const renderInteractiveSceneThrottled: {
9
9
  * Interactive scene is the ui-canvas where we render bounding boxes, selections
10
10
  * and other ui stuff.
11
11
  */
12
- export declare const renderInteractiveScene: <U extends ({ canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, device, }: InteractiveSceneRenderConfig) => {
12
+ export declare const renderInteractiveScene: <U extends ({ canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, editorInterface, }: InteractiveSceneRenderConfig) => {
13
13
  atLeastOneVisibleElement: boolean;
14
14
  elementsMap: RenderableElementsMap;
15
15
  scrollBars?: undefined;
@@ -1,4 +1,7 @@
1
- import type { StaticSceneRenderConfig } from "../scene/types";
1
+ import type { ExcalidrawFrameLikeElement } from "@excalidraw/element/types";
2
+ import type { StaticCanvasRenderConfig, StaticSceneRenderConfig } from "../scene/types";
3
+ import type { StaticCanvasAppState } from "../types";
4
+ export declare const frameClip: (frame: ExcalidrawFrameLikeElement, context: CanvasRenderingContext2D, renderConfig: StaticCanvasRenderConfig, appState: StaticCanvasAppState) => void;
2
5
  /** throttled to animation framerate */
3
6
  export declare const renderStaticSceneThrottled: {
4
7
  (config: StaticSceneRenderConfig): void;
@@ -1,5 +1,5 @@
1
1
  import type { ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
2
- import type Scene from "./Scene";
2
+ import type { Scene } from "@excalidraw/element";
3
3
  import type { AppState } from "../types";
4
4
  export declare class Renderer {
5
5
  private scene;
@@ -16,7 +16,6 @@ export declare class Renderer {
16
16
  /** note: first render of newElement will always bust the cache
17
17
  * (we'd have to prefilter elements outside of this function) */
18
18
  newElementId: ExcalidrawElement["id"] | undefined;
19
- pendingImageElementId: AppState["pendingImageElementId"];
20
19
  sceneNonce: ReturnType<InstanceType<typeof Scene>["getSceneNonce"]>;
21
20
  }) => {
22
21
  elementsMap: Map<string, NonDeletedExcalidrawElement> & import("@excalidraw/common/utility-types").MakeBrand<"NonDeletedElementsMap"> & import("@excalidraw/common/utility-types").MakeBrand<"RenderableElementsMap">;
@@ -1,4 +1,4 @@
1
- export { isSomeElementSelected, getElementsWithinSelection, getCommonAttributeOfSelectedElements, getSelectedElements, getTargetElements, } from "@excalidraw/element/selection";
1
+ export { isSomeElementSelected, getElementsWithinSelection, getSelectedElements, getTargetElements, } from "@excalidraw/element";
2
2
  export { calculateScrollCenter } from "./scroll";
3
- export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads, canChangeRoundness, } from "@excalidraw/element/comparisons";
3
+ export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads, canChangeRoundness, } from "@excalidraw/element";
4
4
  export { getNormalizedZoom, getNormalizedGridSize, getNormalizedGridStep, } from "./normalize";
@@ -1,10 +1,9 @@
1
- import type { ExcalidrawElement } from "@excalidraw/element/types";
2
1
  import type { InteractiveCanvasAppState } from "../types";
3
- import type { ScrollBars } from "./types";
2
+ import type { RenderableElementsMap, ScrollBars } from "./types";
4
3
  export declare const SCROLLBAR_MARGIN = 4;
5
4
  export declare const SCROLLBAR_WIDTH = 6;
6
5
  export declare const SCROLLBAR_COLOR = "rgba(128,128,128,0.3)";
7
- export declare const getScrollBars: (elements: readonly ExcalidrawElement[], viewportWidth: number, viewportHeight: number, appState: InteractiveCanvasAppState) => ScrollBars;
6
+ export declare const getScrollBars: (elements: RenderableElementsMap, viewportWidth: number, viewportHeight: number, appState: InteractiveCanvasAppState) => ScrollBars;
8
7
  export declare const isOverScrollBars: (scrollBars: ScrollBars, x: number, y: number) => {
9
8
  isOverEither: boolean;
10
9
  isOverHorizontal: boolean;
@@ -1,7 +1,7 @@
1
- import type { UserIdleState } from "@excalidraw/common";
1
+ import type { UserIdleState, EditorInterface } from "@excalidraw/common";
2
2
  import type { ExcalidrawElement, NonDeletedElementsMap, NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
3
3
  import type { MakeBrand } from "@excalidraw/common/utility-types";
4
- import type { AppClassProperties, AppState, EmbedsValidationStatus, ElementsPendingErasure, InteractiveCanvasAppState, StaticCanvasAppState, SocketId, Device, PendingExcalidrawElements } from "../types";
4
+ import type { AppClassProperties, AppState, EmbedsValidationStatus, ElementsPendingErasure, InteractiveCanvasAppState, StaticCanvasAppState, SocketId, PendingExcalidrawElements } from "../types";
5
5
  import type { RoughCanvas } from "roughjs/bin/canvas";
6
6
  import type { Drawable } from "roughjs/bin/core";
7
7
  export type RenderableElementsMap = NonDeletedElementsMap & MakeBrand<"RenderableElementsMap">;
@@ -71,7 +71,7 @@ export type InteractiveSceneRenderConfig = {
71
71
  scale: number;
72
72
  appState: InteractiveCanvasAppState;
73
73
  renderConfig: InteractiveCanvasRenderConfig;
74
- device: Device;
74
+ editorInterface: EditorInterface;
75
75
  callback: (data: RenderInteractiveSceneCallback) => void;
76
76
  };
77
77
  export type NewElementSceneRenderConfig = {
@@ -95,12 +95,14 @@ export type ScrollBars = {
95
95
  y: number;
96
96
  width: number;
97
97
  height: number;
98
+ deltaMultiplier: number;
98
99
  } | null;
99
100
  vertical: {
100
101
  x: number;
101
102
  y: number;
102
103
  width: number;
103
104
  height: number;
105
+ deltaMultiplier: number;
104
106
  } | null;
105
107
  };
106
108
  export type ElementShape = Drawable | Drawable[] | null;
@@ -0,0 +1 @@
1
+ export declare const getShortcutKey: (shortcut: string) => string;
@@ -1,7 +1,7 @@
1
1
  import { type GlobalPoint } from "@excalidraw/math";
2
2
  import type { InclusiveRange } from "@excalidraw/math";
3
- import type { Bounds } from "@excalidraw/element/bounds";
4
- import type { MaybeTransformHandleType } from "@excalidraw/element/transformHandles";
3
+ import type { Bounds } from "@excalidraw/element";
4
+ import type { MaybeTransformHandleType } from "@excalidraw/element";
5
5
  import type { ElementsMap, ExcalidrawElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
6
6
  import type { AppClassProperties, AppState, KeyboardModifiersObject } from "./types";
7
7
  export declare const getSnapDistance: (zoomValue: number) => number;