@zsviczian/excalidraw 0.18.0-52 → 0.18.0-54

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 (69) hide show
  1. package/dist/excalidraw.development.js +81 -59
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/package.json +2 -2
  4. package/types/common/src/commonObsidianUtils.d.ts +6 -0
  5. package/types/common/src/constants.d.ts +2 -0
  6. package/types/common/src/editorInterface.d.ts +1 -1
  7. package/types/common/src/index.d.ts +2 -0
  8. package/types/common/src/utils.d.ts +7 -2
  9. package/types/common/src/visualdebug.d.ts +41 -0
  10. package/types/element/src/binding.d.ts +55 -44
  11. package/types/element/src/collision.d.ts +6 -2
  12. package/types/element/src/index.d.ts +0 -3
  13. package/types/element/src/linearElementEditor.d.ts +15 -18
  14. package/types/element/src/renderElement.d.ts +1 -1
  15. package/types/element/src/typeChecks.d.ts +2 -3
  16. package/types/element/src/types.d.ts +7 -11
  17. package/types/element/src/utils.d.ts +2 -1
  18. package/types/element/src/zindex.d.ts +7 -1
  19. package/types/excalidraw/actions/actionAddToLibrary.d.ts +16 -7
  20. package/types/excalidraw/actions/actionAlign.d.ts +6 -6
  21. package/types/excalidraw/actions/actionBoundText.d.ts +13 -7
  22. package/types/excalidraw/actions/actionCanvas.d.ts +91 -286
  23. package/types/excalidraw/actions/actionClipboard.d.ts +34 -941
  24. package/types/excalidraw/actions/actionCropEditor.d.ts +6 -3
  25. package/types/excalidraw/actions/actionDeleteSelected.d.ts +23 -16
  26. package/types/excalidraw/actions/actionDistribute.d.ts +2 -2
  27. package/types/excalidraw/actions/actionDuplicateSelection.d.ts +1 -1
  28. package/types/excalidraw/actions/actionElementLink.d.ts +4 -3
  29. package/types/excalidraw/actions/actionElementLock.d.ts +11 -5
  30. package/types/excalidraw/actions/actionEmbeddable.d.ts +6 -3
  31. package/types/excalidraw/actions/actionExport.d.ts +43 -1149
  32. package/types/excalidraw/actions/actionFinalize.d.ts +10 -688
  33. package/types/excalidraw/actions/actionFlip.d.ts +2 -2
  34. package/types/excalidraw/actions/actionFrame.d.ts +26 -16
  35. package/types/excalidraw/actions/actionGroup.d.ts +12 -6
  36. package/types/excalidraw/actions/actionLinearEditor.d.ts +15 -16
  37. package/types/excalidraw/actions/actionLink.d.ts +5 -2
  38. package/types/excalidraw/actions/actionMenu.d.ts +3 -2
  39. package/types/excalidraw/actions/actionNavigate.d.ts +21 -445
  40. package/types/excalidraw/actions/actionProperties.d.ts +79 -2968
  41. package/types/excalidraw/actions/actionSelectAll.d.ts +6 -3
  42. package/types/excalidraw/actions/actionStyles.d.ts +7 -4
  43. package/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
  44. package/types/excalidraw/actions/actionToggleGridMode.d.ts +5 -2
  45. package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +5 -2
  46. package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +3 -2
  47. package/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
  48. package/types/excalidraw/actions/actionToggleStats.d.ts +5 -2
  49. package/types/excalidraw/actions/actionToggleViewMode.d.ts +6 -3
  50. package/types/excalidraw/actions/actionToggleZenMode.d.ts +5 -2
  51. package/types/excalidraw/actions/actionTrayMenu.d.ts +5 -2
  52. package/types/excalidraw/actions/actionZindex.d.ts +2 -2
  53. package/types/excalidraw/actions/manager.d.ts +1 -1
  54. package/types/excalidraw/actions/register.d.ts +1 -1
  55. package/types/excalidraw/actions/types.d.ts +3 -3
  56. package/types/excalidraw/appState.d.ts +4 -3
  57. package/types/excalidraw/components/App.d.ts +7 -3
  58. package/types/excalidraw/components/CommandPalette/types.d.ts +1 -2
  59. package/types/excalidraw/components/Stats/utils.d.ts +1 -1
  60. package/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +4 -2
  61. package/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +1 -1
  62. package/types/excalidraw/data/restore.d.ts +3 -3
  63. package/types/excalidraw/index.d.ts +3 -3
  64. package/types/excalidraw/obsidianUtils.d.ts +0 -5
  65. package/types/excalidraw/renderer/animation.d.ts +12 -0
  66. package/types/excalidraw/renderer/helpers.d.ts +1 -5
  67. package/types/excalidraw/renderer/interactiveScene.d.ts +5 -13
  68. package/types/excalidraw/scene/types.d.ts +12 -0
  69. package/types/excalidraw/types.d.ts +15 -5
@@ -0,0 +1,12 @@
1
+ export type Animation<R extends object> = (params: {
2
+ deltaTime: number;
3
+ state?: R;
4
+ }) => R | null | undefined;
5
+ export declare class AnimationController {
6
+ private static isRunning;
7
+ private static animations;
8
+ static start<R extends object>(key: string, animation: Animation<R>): void;
9
+ private static tick;
10
+ static running(key: string): boolean;
11
+ static cancel(key: string): void;
12
+ }
@@ -1,4 +1,3 @@
1
- import type { ElementsMap, ExcalidrawDiamondElement, ExcalidrawRectanguloidElement } from "@excalidraw/element/types";
2
1
  import type { StaticCanvasRenderConfig } from "../scene/types";
3
2
  import type { AppState, StaticCanvasAppState } from "../types";
4
3
  export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke: boolean, fill?: boolean) => void;
@@ -12,7 +11,4 @@ export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normali
12
11
  isExporting?: boolean | undefined;
13
12
  viewBackgroundColor?: string | null | undefined;
14
13
  }) => 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;
14
+ export declare const strokeRectWithRotation_simple: (context: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, cx: number, cy: number, angle: number, fill?: boolean, radius?: number) => void;
@@ -1,20 +1,12 @@
1
+ import { getScrollBars } from "../scene/scrollbars";
1
2
  import type { InteractiveSceneRenderConfig, RenderableElementsMap } from "../scene/types";
2
- /** throttled to animation framerate */
3
- export declare const renderInteractiveSceneThrottled: {
4
- (config: InteractiveSceneRenderConfig): void;
5
- flush(): void;
6
- cancel(): void;
7
- };
8
3
  /**
9
4
  * Interactive scene is the ui-canvas where we render bounding boxes, selections
10
5
  * and other ui stuff.
11
6
  */
12
- export declare const renderInteractiveScene: <U extends ({ canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, editorInterface, }: InteractiveSceneRenderConfig) => {
7
+ export declare const renderInteractiveScene: <U extends ({ app, canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, editorInterface, animationState, deltaTime, }: InteractiveSceneRenderConfig) => {
8
+ scrollBars?: import("../scene/types").ScrollBars | undefined;
13
9
  atLeastOneVisibleElement: boolean;
14
10
  elementsMap: RenderableElementsMap;
15
- scrollBars?: undefined;
16
- } | {
17
- scrollBars: import("../scene/types").ScrollBars | undefined;
18
- atLeastOneVisibleElement: boolean;
19
- elementsMap: RenderableElementsMap;
20
- }, T extends boolean = false>(renderConfig: InteractiveSceneRenderConfig, throttle?: T | undefined) => T extends true ? void : ReturnType<U>;
11
+ animationState?: import("../scene/types").InteractiveSceneRenderAnimationState | undefined;
12
+ }>(renderConfig: InteractiveSceneRenderConfig) => ReturnType<U>;
@@ -45,6 +45,10 @@ export type InteractiveCanvasRenderConfig = {
45
45
  remotePointerUsernames: Map<SocketId, string>;
46
46
  remotePointerButton: Map<SocketId, string | undefined>;
47
47
  selectionColor: string;
48
+ lastViewportPosition: {
49
+ x: number;
50
+ y: number;
51
+ };
48
52
  renderScrollbars?: boolean;
49
53
  };
50
54
  export type RenderInteractiveSceneCallback = {
@@ -62,7 +66,13 @@ export type StaticSceneRenderConfig = {
62
66
  appState: StaticCanvasAppState;
63
67
  renderConfig: StaticCanvasRenderConfig;
64
68
  };
69
+ export type InteractiveSceneRenderAnimationState = {
70
+ bindingHighlight: {
71
+ runtime: number;
72
+ } | undefined;
73
+ };
65
74
  export type InteractiveSceneRenderConfig = {
75
+ app: AppClassProperties;
66
76
  canvas: HTMLCanvasElement | null;
67
77
  elementsMap: RenderableElementsMap;
68
78
  visibleElements: readonly NonDeletedExcalidrawElement[];
@@ -73,6 +83,8 @@ export type InteractiveSceneRenderConfig = {
73
83
  renderConfig: InteractiveCanvasRenderConfig;
74
84
  editorInterface: EditorInterface;
75
85
  callback: (data: RenderInteractiveSceneCallback) => void;
86
+ animationState?: InteractiveSceneRenderAnimationState;
87
+ deltaTime: number;
76
88
  };
77
89
  export type NewElementSceneRenderConfig = {
78
90
  canvas: HTMLCanvasElement | null;
@@ -1,8 +1,7 @@
1
1
  import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, ColorPaletteCustom, EditorInterface } from "@excalidraw/common";
2
- import type { SuggestedBinding } from "@excalidraw/element";
3
2
  import type { LinearElementEditor } from "@excalidraw/element";
4
3
  import type { MaybeTransformHandleType } from "@excalidraw/element";
5
- import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement } from "@excalidraw/element/types";
4
+ import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, BindMode } from "@excalidraw/element/types";
6
5
  import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
7
6
  import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
8
7
  import type { Action } from "./actions/types";
@@ -129,6 +128,7 @@ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
129
128
  frameColor: AppState["frameColor"];
130
129
  currentHoveredFontFamily: AppState["currentHoveredFontFamily"];
131
130
  hoveredElementIds: AppState["hoveredElementIds"];
131
+ suggestedBinding: AppState["suggestedBinding"];
132
132
  croppingElementId: AppState["croppingElementId"];
133
133
  }>;
134
134
  export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
@@ -137,8 +137,9 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
137
137
  selectedGroupIds: AppState["selectedGroupIds"];
138
138
  selectedLinearElement: AppState["selectedLinearElement"];
139
139
  multiElement: AppState["multiElement"];
140
+ newElement: AppState["newElement"];
140
141
  isBindingEnabled: AppState["isBindingEnabled"];
141
- suggestedBindings: AppState["suggestedBindings"];
142
+ suggestedBinding: AppState["suggestedBinding"];
142
143
  isRotating: AppState["isRotating"];
143
144
  elementsToHighlight: AppState["elementsToHighlight"];
144
145
  collaborators: AppState["collaborators"];
@@ -152,6 +153,11 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
152
153
  croppingElementId: AppState["croppingElementId"];
153
154
  searchMatches: AppState["searchMatches"];
154
155
  activeLockedId: AppState["activeLockedId"];
156
+ hoveredElementIds: AppState["hoveredElementIds"];
157
+ frameRendering: AppState["frameRendering"];
158
+ frameColor: AppState["frameColor"];
159
+ shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
160
+ exportScale: AppState["exportScale"];
155
161
  }>;
156
162
  export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
157
163
  export type ObservedStandaloneAppState = {
@@ -205,7 +211,7 @@ export interface AppState {
205
211
  selectionElement: NonDeletedExcalidrawElement | null;
206
212
  isBindingEnabled: boolean;
207
213
  startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
208
- suggestedBindings: SuggestedBinding[];
214
+ suggestedBinding: NonDeleted<ExcalidrawBindableElement> | null;
209
215
  frameToHighlight: NonDeleted<ExcalidrawFrameLikeElement> | null;
210
216
  frameRendering: {
211
217
  enabled: boolean;
@@ -278,6 +284,8 @@ export interface AppState {
278
284
  tab: "text-to-diagram" | "mermaid";
279
285
  } | {
280
286
  name: "commandPalette";
287
+ } | {
288
+ name: "settings";
281
289
  } | {
282
290
  name: "elementLinkSelector";
283
291
  sourceElementId: ExcalidrawElement["id"];
@@ -401,6 +409,7 @@ export interface AppState {
401
409
  lockedMultiSelections: {
402
410
  [groupId: string]: true;
403
411
  };
412
+ bindMode: BindMode;
404
413
  }
405
414
  export type SearchMatch = {
406
415
  id: string;
@@ -413,7 +422,7 @@ export type SearchMatch = {
413
422
  showOnCanvas: boolean;
414
423
  }[];
415
424
  };
416
- export type UIAppState = Omit<AppState, "suggestedBindings" | "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
425
+ export type UIAppState = Omit<AppState, "suggestedBinding" | "startBoundElement" | "cursorButton" | "scrollX" | "scrollY">;
417
426
  export type NormalizedZoomValue = number & {
418
427
  _brand: "normalizedZoom";
419
428
  };
@@ -632,6 +641,7 @@ export type AppClassProperties = {
632
641
  onPointerUpEmitter: App["onPointerUpEmitter"];
633
642
  updateEditorAtom: App["updateEditorAtom"];
634
643
  onPointerDownEmitter: App["onPointerDownEmitter"];
644
+ bindModeHandler: App["bindModeHandler"];
635
645
  };
636
646
  export type PointerDownState = Readonly<{
637
647
  origin: Readonly<{