From f1689462c110cc7f07e85731934063395736bd11 Mon Sep 17 00:00:00 2001 From: Marcel Mraz Date: Mon, 22 Apr 2024 16:27:57 +0100 Subject: [PATCH] feat: export reconciliation (#7917) --- excalidraw-app/App.tsx | 6 ++---- excalidraw-app/collab/Collab.tsx | 4 ++-- excalidraw-app/data/firebase.ts | 6 ++---- packages/excalidraw/index.tsx | 2 ++ 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/excalidraw-app/App.tsx b/excalidraw-app/App.tsx index f3517f12c300..abbc8396a5b8 100644 --- a/excalidraw-app/App.tsx +++ b/excalidraw-app/App.tsx @@ -27,6 +27,7 @@ import { TTDDialog, TTDDialogTrigger, StoreAction, + reconcileElements, } from "../packages/excalidraw"; import { AppState, @@ -107,10 +108,7 @@ import { OverwriteConfirmDialog } from "../packages/excalidraw/components/Overwr import Trans from "../packages/excalidraw/components/Trans"; import { ShareDialog, shareDialogStateAtom } from "./share/ShareDialog"; import CollabError, { collabErrorIndicatorAtom } from "./collab/CollabError"; -import { - RemoteExcalidrawElement, - reconcileElements, -} from "../packages/excalidraw/data/reconcile"; +import type { RemoteExcalidrawElement } from "../packages/excalidraw/data/reconcile"; import { CommandPalette, DEFAULT_CATEGORIES, diff --git a/excalidraw-app/collab/Collab.tsx b/excalidraw-app/collab/Collab.tsx index 56467a1b5398..273c10c965a8 100644 --- a/excalidraw-app/collab/Collab.tsx +++ b/excalidraw-app/collab/Collab.tsx @@ -17,6 +17,7 @@ import { getSceneVersion, restoreElements, zoomToFitBounds, + reconcileElements, } from "../../packages/excalidraw"; import { Collaborator, Gesture } from "../../packages/excalidraw/types"; import { @@ -80,10 +81,9 @@ import { Mutable, ValueOf } from "../../packages/excalidraw/utility-types"; import { getVisibleSceneBounds } from "../../packages/excalidraw/element/bounds"; import { withBatchedUpdates } from "../../packages/excalidraw/reactUtils"; import { collabErrorIndicatorAtom } from "./CollabError"; -import { +import type { ReconciledExcalidrawElement, RemoteExcalidrawElement, - reconcileElements, } from "../../packages/excalidraw/data/reconcile"; export const collabAPIAtom = atom(null); diff --git a/excalidraw-app/data/firebase.ts b/excalidraw-app/data/firebase.ts index b0777d6d9d11..84a82f344e41 100644 --- a/excalidraw-app/data/firebase.ts +++ b/excalidraw-app/data/firebase.ts @@ -1,3 +1,4 @@ +import { reconcileElements } from "../../packages/excalidraw"; import { ExcalidrawElement, FileId, @@ -22,10 +23,7 @@ import { MIME_TYPES } from "../../packages/excalidraw/constants"; import { getSyncableElements, SyncableExcalidrawElement } from "."; import { ResolutionType } from "../../packages/excalidraw/utility-types"; import type { Socket } from "socket.io-client"; -import { - RemoteExcalidrawElement, - reconcileElements, -} from "../../packages/excalidraw/data/reconcile"; +import type { RemoteExcalidrawElement } from "../../packages/excalidraw/data/reconcile"; // private // ----------------------------------------------------------------------------- diff --git a/packages/excalidraw/index.tsx b/packages/excalidraw/index.tsx index 25d82a2a8db6..b9fd96acfe45 100644 --- a/packages/excalidraw/index.tsx +++ b/packages/excalidraw/index.tsx @@ -220,6 +220,8 @@ export { restoreLibraryItems, } from "./data/restore"; +export { reconcileElements } from "./data/reconcile"; + export { exportToCanvas, exportToBlob,