Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

build: enable consistent type imports eslint rule (#7992)

Aakansha Doshi1ed53b153cd0
diff --git a/.eslintrc.json b/.eslintrc.json
index fbb12f59d4..86d5c2990c 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -2,6 +2,7 @@
"extends": ["@excalidraw/eslint-config", "react-app"],
"rules": {
"import/no-anonymous-default-export": "off",
- "no-restricted-globals": "off"
+ "no-restricted-globals": "off",
+ "@typescript-eslint/consistent-type-imports": ["error", { "prefer": "type-imports", "disallowTypeAnnotations": false, "fixStyle": "separate-type-imports" }]
}
}
diff --git a/examples/excalidraw/components/App.tsx b/examples/excalidraw/components/App.tsx
index eea0da6caf..3b553a4539 100644
--- a/examples/excalidraw/components/App.tsx
+++ b/examples/excalidraw/components/App.tsx
@@ -12,9 +12,9 @@ import type * as TExcalidraw from "@excalidraw/excalidraw";
import { nanoid } from "nanoid";
+import type { ResolvablePromise } from "../utils";
import {
resolvablePromise,
- ResolvablePromise,
distance2d,
fileOpen,
withBatchedUpdates,
diff --git a/examples/excalidraw/components/MobileFooter.tsx b/examples/excalidraw/components/MobileFooter.tsx
index 7ab62b918d..e008e1f30a 100644
--- a/examples/excalidraw/components/MobileFooter.tsx
+++ b/examples/excalidraw/components/MobileFooter.tsx
@@ -1,4 +1,4 @@
-import { ExcalidrawImperativeAPI } from "@excalidraw/excalidraw/dist/excalidraw/types";
+import type { ExcalidrawImperativeAPI } from "@excalidraw/excalidraw/dist/excalidraw/types";
import CustomFooter from "./CustomFooter";
import type * as TExcalidraw from "@excalidraw/excalidraw";
diff --git a/examples/excalidraw/utils.ts b/examples/excalidraw/utils.ts
index 822be29b78..ab754aeb18 100644
--- a/examples/excalidraw/utils.ts
+++ b/examples/excalidraw/utils.ts
@@ -1,6 +1,6 @@
import { unstable_batchedUpdates } from "react-dom";
import { fileOpen as _fileOpen } from "browser-fs-access";
-import type { MIME_TYPES } from "@excalidraw/excalidraw";
+import { MIME_TYPES } from "@excalidraw/excalidraw";
import { AbortError } from "../../packages/excalidraw/errors";
type FILE_EXTENSION = Exclude<keyof typeof MIME_TYPES, "binary">;
diff --git a/excalidraw-app/App.tsx b/excalidraw-app/App.tsx
index abbc8396a5..25fcbd69de 100644
--- a/excalidraw-app/App.tsx
+++ b/excalidraw-app/App.tsx
@@ -13,7 +13,7 @@ import {
VERSION_TIMEOUT,
} from "../packages/excalidraw/constants";
import { loadFromBlob } from "../packages/excalidraw/data/blob";
-import {
+import type {
FileId,
NonDeletedExcalidrawElement,
OrderedExcalidrawElement,
@@ -29,20 +29,20 @@ import {
StoreAction,
reconcileElements,
} from "../packages/excalidraw";
-import {
+import type {
AppState,
ExcalidrawImperativeAPI,
BinaryFiles,
ExcalidrawInitialDataState,
UIAppState,
} from "../packages/excalidraw/types";
+import type { ResolvablePromise } from "../packages/excalidraw/utils";
import {
debounce,
getVersion,
getFrame,
isTestEnv,
preventUnload,
- ResolvablePromise,
resolvablePromise,
isRunningInIframe,
} from "../packages/excalidraw/utils";
@@ -52,8 +52,8 @@ import {
STORAGE_KEYS,
SYNC_BROWSER_TABS_TIMEOUT,
} from "./app_constants";
+import type { CollabAPI } from "./collab/Collab";
import Collab, {
- CollabAPI,
collabAPIAtom,
isCollaboratingAtom,
isOfflineAtom,
@@ -69,11 +69,8 @@ import {
importUsernameFromLocalStorage,
} from "./data/localStorage";
import CustomStats from "./CustomStats";
-import {
- restore,
- restoreAppState,
- RestoredDataState,
-} from "../packages/excalidraw/data/restore";
+import type { RestoredDataState } from "../packages/excalidraw/data/restore";
+import { restore, restoreAppState } from "../packages/excalidraw/data/restore";
import {
ExportToExcalidrawPlus,
exportToExcalidrawPlus,
@@ -101,7 +98,7 @@ import { useAtomWithInitialValue } from "../packages/excalidraw/jotai";
import { appJotaiStore } from "./app-jotai";
import "./index.scss";
-import { ResolutionType } from "../packages/excalidraw/utility-types";
+import type { ResolutionType } from "../packages/excalidraw/utility-types";
import { ShareableLinkDialog } from "../packages/excalidraw/components/ShareableLinkDialog";
import { openConfirmModal } from "../packages/excalidraw/components/OverwriteConfirm/OverwriteConfirmState";
import { OverwriteConfirmDialog } from "../packages/excalidraw/components/OverwriteConfirm/OverwriteConfirm";
diff --git a/excalidraw-app/CustomStats.tsx b/excalidraw-app/CustomStats.tsx
index f2ce80f21b..f609096b9e 100644
--- a/excalidraw-app/CustomStats.tsx
+++ b/excalidraw-app/CustomStats.tsx
@@ -7,8 +7,8 @@ import {
import { DEFAULT_VERSION } from "../packages/excalidraw/constants";
import { t } from "../packages/excalidraw/i18n";
import { copyTextToSystemClipboard } from "../packages/excalidraw/clipboard";
-import { NonDeletedExcalidrawElement } from "../packages/excalidraw/element/types";
-import { UIAppState } from "../packages/excalidraw/types";
+import type { NonDeletedExcalidrawElement } from "../packages/excalidraw/element/types";
+import type { UIAppState } from "../packages/excalidraw/types";
type StorageSizes = { scene: number; total: number };
diff --git a/excalidraw-app/collab/Collab.tsx b/excalidraw-app/collab/Collab.tsx
index 273c10c965..7059a67c5a 100644
--- a/excalidraw-app/collab/Collab.tsx
+++ b/excalidraw-app/collab/Collab.tsx
@@ -1,13 +1,13 @@
import throttle from "lodash.throttle";
import { PureComponent } from "react";
-import {
+import type {
ExcalidrawImperativeAPI,
SocketId,
} from "../../packages/excalidraw/types";
import { ErrorDialog } from "../../packages/excalidraw/components/ErrorDialog";
import { APP_NAME, ENV, EVENT } from "../../packages/excalidraw/constants";
-import { ImportedDataState } from "../../packages/excalidraw/data/types";
-import {
+import type { ImportedDataState } from "../../packages/excalidraw/data/types";
+import type {
ExcalidrawElement,
InitializedExcalidrawImageElement,
OrderedExcalidrawElement,
@@ -19,7 +19,7 @@ import {
zoomToFitBounds,
reconcileElements,
} from "../../packages/excalidraw";
-import { Collaborator, Gesture } from "../../packages/excalidraw/types";
+import type { Collaborator, Gesture } from "../../packages/excalidraw/types";
import {
assertNever,
preventUnload,
@@ -36,12 +36,14 @@ import {
SYNC_FULL_SCENE_INTERVAL_MS,
WS_EVENTS,
} from "../app_constants";
+import type {
+ SocketUpdateDataSource,
+ SyncableExcalidrawElement,
+} from "../data";
import {
generateCollaborationLinkData,
getCollaborationLink,
getSyncableElements,
- SocketUpdateDataSource,
- SyncableExcalidrawElement,
} from "../data";
import {
isSavedToFirebase,
@@ -77,7 +79,7 @@ import { resetBrowserStateVersions } from "../data/tabSync";
import { LocalData } from "../data/LocalData";
import { atom } from "jotai";
import { appJotaiStore } from "../app-jotai";
-import { Mutable, ValueOf } from "../../packages/excalidraw/utility-types";
+import type { Mutable, ValueOf } from "../../packages/excalidraw/utility-types";
import { getVisibleSceneBounds } from "../../packages/excalidraw/element/bounds";
import { withBatchedUpdates } from "../../packages/excalidraw/reactUtils";
import { collabErrorIndicatorAtom } from "./CollabError";
diff --git a/excalidraw-app/collab/Portal.tsx b/excalidraw-app/collab/Portal.tsx
index 356100974d..e9a4b5bf00 100644
--- a/excalidraw-app/collab/Portal.tsx
+++ b/excalidraw-app/collab/Portal.tsx
@@ -1,15 +1,15 @@
-import {
- isSyncableElement,
+import type {
SocketUpdateData,
SocketUpdateDataSource,
SyncableExcalidrawElement,
} from "../data";
+import { isSyncableElement } from "../data";
-import { TCollabClass } from "./Collab";
+import type { TCollabClass } from "./Collab";
-import { OrderedExcalidrawElement } from "../../packages/excalidraw/element/types";
+import type { OrderedExcalidrawElement } from "../../packages/excalidraw/element/types";
import { WS_EVENTS, FILE_UPLOAD_TIMEOUT, WS_SUBTYPES } from "../app_constants";
-import {
+import type {
OnUserFollowedPayload,
SocketId,
UserIdleState,
diff --git a/excalidraw-app/components/AppMainMenu.tsx b/excalidraw-app/components/AppMainMenu.tsx
index d90fa5b233..03c789b400 100644
--- a/excalidraw-app/components/AppMainMenu.tsx
+++ b/excalidraw-app/components/AppMainMenu.tsx
@@ -3,7 +3,7 @@ import {
loginIcon,
ExcalLogo,
} from "../../packages/excalidraw/components/icons";
-import { Theme } from "../../packages/excalidraw/element/types";
+import type { Theme } from "../../packages/excalidraw/element/types";
import { MainMenu } from "../../packages/excalidraw/index";
import { isExcalidrawPlusSignedUser } from "../app_constants";
import { LanguageList } from "./LanguageList";
diff --git a/excalidraw-app/components/ExportToExcalidrawPlus.tsx b/excalidraw-app/components/ExportToExcalidrawPlus.tsx
index bfbb4a5565..1ba82a0c7f 100644
--- a/excalidraw-app/components/ExportToExcalidrawPlus.tsx
+++ b/excalidraw-app/components/ExportToExcalidrawPlus.tsx
@@ -3,11 +3,11 @@ import { Card } from "../../packages/excalidraw/components/Card";
import { ToolButton } from "../../packages/excalidraw/components/ToolButton";
import { serializeAsJSON } from "../../packages/excalidraw/data/json";
import { loadFirebaseStorage, saveFilesToFirebase } from "../data/firebase";
-import {
+import type {
FileId,
NonDeletedExcalidrawElement,
} from "../../packages/excalidraw/element/types";
-import {
+import type {
AppState,
BinaryFileData,
BinaryFiles,
diff --git a/excalidraw-app/components/GitHubCorner.tsx b/excalidraw-app/components/GitHubCorner.tsx
index ad343a8998..38a7ec8960 100644
--- a/excalidraw-app/components/GitHubCorner.tsx
+++ b/excalidraw-app/components/GitHubCorner.tsx
@@ -1,7 +1,7 @@
import oc from "open-color";
import React from "react";
import { THEME } from "../../packages/excalidraw/constants";
-import { Theme } from "../../packages/excalidraw/element/types";
+import type { Theme } from "../../packages/excalidraw/element/types";
// https://github.com/tholman/github-corners
export const GitHubCorner = React.memo(
diff --git a/excalidraw-app/data/FileManager.ts b/excalidraw-app/data/FileManager.ts
index 3b9672e116..e9b460247e 100644
--- a/excalidraw-app/data/FileManager.ts
+++ b/excalidraw-app/data/FileManager.ts
@@ -2,14 +2,14 @@ import { StoreAction } from "../../packages/excalidraw";
import { compressData } from "../../packages/excalidraw/data/encode";
import { newElementWith } from "../../packages/excalidraw/element/mutateElement";
import { isInitializedImageElement } from "../../packages/excalidraw/element/typeChecks";
-import {
+import type {
ExcalidrawElement,
ExcalidrawImageElement,
FileId,
InitializedExcalidrawImageElement,
} from "../../packages/excalidraw/element/types";
import { t } from "../../packages/excalidraw/i18n";
-import {
+import type {
BinaryFileData,
BinaryFileMetadata,
ExcalidrawImperativeAPI,
diff --git a/excalidraw-app/data/LocalData.ts b/excalidraw-app/data/LocalData.ts
index 9d19e073b2..468126b2bb 100644
--- a/excalidraw-app/data/LocalData.ts
+++ b/excalidraw-app/data/LocalData.ts
@@ -20,19 +20,19 @@ import {
get,
} from "idb-keyval";
import { clearAppStateForLocalStorage } from "../../packages/excalidraw/appState";
-import { LibraryPersistedData } from "../../packages/excalidraw/data/library";
-import { ImportedDataState } from "../../packages/excalidraw/data/types";
+import type { LibraryPersistedData } from "../../packages/excalidraw/data/library";
+import type { ImportedDataState } from "../../packages/excalidraw/data/types";
import { clearElementsForLocalStorage } from "../../packages/excalidraw/element";
-import {
+import type {
ExcalidrawElement,
FileId,
} from "../../packages/excalidraw/element/types";
-import {
+import type {
AppState,
BinaryFileData,
BinaryFiles,
} from "../../packages/excalidraw/types";
-import { MaybePromise } from "../../packages/excalidraw/utility-types";
+import type { MaybePromise } from "../../packages/excalidraw/utility-types";
import { debounce } from "../../packages/excalidraw/utils";
import { SAVE_TO_LOCAL_STORAGE_TIMEOUT, STORAGE_KEYS } from "../app_constants";
import { FileManager } from "./FileManager";
diff --git a/excalidraw-app/data/firebase.ts b/excalidraw-app/data/firebase.ts
index 84a82f344e..c73018acf8 100644
--- a/excalidraw-app/data/firebase.ts
+++ b/excalidraw-app/data/firebase.ts
@@ -1,13 +1,13 @@
import { reconcileElements } from "../../packages/excalidraw";
-import {
+import type {
ExcalidrawElement,
FileId,
OrderedExcalidrawElement,
} from "../../packages/excalidraw/element/types";
import { getSceneVersion } from "../../packages/excalidraw/element";
-import Portal from "../collab/Portal";
+import type Portal from "../collab/Portal";
import { restoreElements } from "../../packages/excalidraw/data/restore";
-import {
+import type {
AppState,
BinaryFileData,
BinaryFileMetadata,
@@ -20,8 +20,9 @@ import {
decryptData,
} from "../../packages/excalidraw/data/encryption";
import { MIME_TYPES } from "../../packages/excalidraw/constants";
-import { getSyncableElements, SyncableExcalidrawElement } from ".";
-import { ResolutionType } from "../../packages/excalidraw/utility-types";
+import type { SyncableExcalidrawElement } from ".";
+import { getSyncableElements } from ".";
+import type { ResolutionType } from "../../packages/excalidraw/utility-types";
import type { Socket } from "socket.io-client";
import type { RemoteExcalidrawElement } from "../../packages/excalidraw/data/reconcile";
diff --git a/excalidraw-app/data/index.ts b/excalidraw-app/data/index.ts
index ac037d66c9..ba7df82b29 100644
--- a/excalidraw-app/data/index.ts
+++ b/excalidraw-app/data/index.ts
@@ -9,30 +9,30 @@ import {
} from "../../packages/excalidraw/data/encryption";
import { serializeAsJSON } from "../../packages/excalidraw/data/json";
import { restore } from "../../packages/excalidraw/data/restore";
-import { ImportedDataState } from "../../packages/excalidraw/data/types";
-import { SceneBounds } from "../../packages/excalidraw/element/bounds";
+import type { ImportedDataState } from "../../packages/excalidraw/data/types";
+import type { SceneBounds } from "../../packages/excalidraw/element/bounds";
import { isInvisiblySmallElement } from "../../packages/excalidraw/element/sizeHelpers";
import { isInitializedImageElement } from "../../packages/excalidraw/element/typeChecks";
-import {
+import type {
ExcalidrawElement,
FileId,
OrderedExcalidrawElement,
} from "../../packages/excalidraw/element/types";
import { t } from "../../packages/excalidraw/i18n";
-import {
+import type {
AppState,
BinaryFileData,
BinaryFiles,
SocketId,
UserIdleState,
} from "../../packages/excalidraw/types";
-import { MakeBrand } from "../../packages/excalidraw/utility-types";
+import type { MakeBrand } from "../../packages/excalidraw/utility-types";
import { bytesToHexString } from "../../packages/excalidraw/utils";
+import type { WS_SUBTYPES } from "../app_constants";
import {
DELETED_ELEMENT_TIMEOUT,
FILE_UPLOAD_MAX_BYTES,
ROOM_ID_BYTES,
- WS_SUBTYPES,
} from "../app_constants";
import { encodeFilesForUpload } from "./FileManager";
import { saveFilesToFirebase } from "./firebase";
diff --git a/excalidraw-app/data/localStorage.ts b/excalidraw-app/data/localStorage.ts
index 0a6a160813..1a282e0473 100644
--- a/excalidraw-app/data/localStorage.ts
+++ b/excalidraw-app/data/localStorage.ts
@@ -1,5 +1,5 @@
-import { ExcalidrawElement } from "../../packages/excalidraw/element/types";
-import { AppState } from "../../packages/excalidraw/types";
+import type { ExcalidrawElement } from "../../packages/excalidraw/element/types";
+import type { AppState } from "../../packages/excalidraw/types";
import {
clearAppStateForLocalStorage,
getDefaultAppState,
diff --git a/excalidraw-app/share/ShareDialog.tsx b/excalidraw-app/share/ShareDialog.tsx
index 61df3a35f1..6511eec127 100644
--- a/excalidraw-app/share/ShareDialog.tsx
+++ b/excalidraw-app/share/ShareDialog.tsx
@@ -18,7 +18,8 @@ import {
} from "../../packages/excalidraw/components/icons";
import { TextField } from "../../packages/excalidraw/components/TextField";
import { FilledButton } from "../../packages/excalidraw/components/FilledButton";
-import { activeRoomLinkAtom, CollabAPI } from "../collab/Collab";
+import type { CollabAPI } from "../collab/Collab";
+import { activeRoomLinkAtom } from "../collab/Collab";
import { atom, useAtom, useAtomValue } from "jotai";
import "./ShareDialog.scss";
diff --git a/excalidraw-app/useHandleAppTheme.ts b/excalidraw-app/useHandleAppTheme.ts
index 184f5d7560..7dc45431ea 100644
--- a/excalidraw-app/useHandleAppTheme.ts
+++ b/excalidraw-app/useHandleAppTheme.ts
@@ -2,7 +2,7 @@ import { atom, useAtom } from "jotai";
import { useEffect, useLayoutEffect, useState } from "react";
import { THEME } from "../packages/excalidraw";
import { EVENT } from "../packages/excalidraw/constants";
-import { Theme } from "../packages/excalidraw/element/types";
+import type { Theme } from "../packages/excalidraw/element/types";
import { CODES, KEYS } from "../packages/excalidraw/keys";
import { STORAGE_KEYS } from "./app_constants";
diff --git a/packages/excalidraw/actions/actionAlign.tsx b/packages/excalidraw/actions/actionAlign.tsx
index 179b3e1381..6ebf6b7e7c 100644
--- a/packages/excalidraw/actions/actionAlign.tsx
+++ b/packages/excalidraw/actions/actionAlign.tsx
@@ -1,4 +1,5 @@
-import { alignElements, Alignment } from "../align";
+import type { Alignment } from "../align";
+import { alignElements } from "../align";
import {
AlignBottomIcon,
AlignLeftIcon,
@@ -10,13 +11,13 @@ import {
import { ToolButton } from "../components/ToolButton";
import { getNonDeletedElements } from "../element";
import { isFrameLikeElement } from "../element/typeChecks";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
import { updateFrameMembershipOfSelectedElements } from "../frame";
import { t } from "../i18n";
import { KEYS } from "../keys";
import { isSomeElementSelected } from "../scene";
import { StoreAction } from "../store";
-import { AppClassProperties, AppState, UIAppState } from "../types";
+import type { AppClassProperties, AppState, UIAppState } from "../types";
import { arrayToMap, getShortcutKey } from "../utils";
import { register } from "./register";
diff --git a/packages/excalidraw/actions/actionBoundText.tsx b/packages/excalidraw/actions/actionBoundText.tsx
index 7d04b1afa7..f3d93fcf15 100644
--- a/packages/excalidraw/actions/actionBoundText.tsx
+++ b/packages/excalidraw/actions/actionBoundText.tsx
@@ -23,14 +23,14 @@ import {
isTextBindableContainer,
isUsingAdaptiveRadius,
} from "../element/typeChecks";
-import {
+import type {
ExcalidrawElement,
ExcalidrawLinearElement,
ExcalidrawTextContainer,
ExcalidrawTextElement,
} from "../element/types";
-import { AppState } from "../types";
-import { Mutable } from "../utility-types";
+import type { AppState } from "../types";
+import type { Mutable } from "../utility-types";
import { arrayToMap, getFontString } from "../utils";
import { register } from "./register";
import { syncMovedIndices } from "../fractionalIndex";
diff --git a/packages/excalidraw/actions/actionCanvas.tsx b/packages/excalidraw/actions/actionCanvas.tsx
index 0503e50f75..9a3026703c 100644
--- a/packages/excalidraw/actions/actionCanvas.tsx
+++ b/packages/excalidraw/actions/actionCanvas.tsx
@@ -18,13 +18,13 @@ import {
ZOOM_STEP,
} from "../constants";
import { getCommonBounds, getNonDeletedElements } from "../element";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
import { t } from "../i18n";
import { CODES, KEYS } from "../keys";
import { getNormalizedZoom } from "../scene";
import { centerScrollOn } from "../scene/scroll";
import { getStateForZoom } from "../scene/zoom";
-import { AppState, NormalizedZoomValue } from "../types";
+import type { AppState, NormalizedZoomValue } from "../types";
import { getShortcutKey, updateActiveTool } from "../utils";
import { register } from "./register";
import { Tooltip } from "../components/Tooltip";
@@ -35,7 +35,7 @@ import {
isHandToolActive,
} from "../appState";
import { DEFAULT_CANVAS_BACKGROUND_PICKS } from "../colors";
-import { SceneBounds } from "../element/bounds";
+import type { SceneBounds } from "../element/bounds";
import { setCursor } from "../cursor";
import { StoreAction } from "../store";
diff --git a/packages/excalidraw/actions/actionDeleteSelected.tsx b/packages/excalidraw/actions/actionDeleteSelected.tsx
index 4ab6fa4115..311d889707 100644
--- a/packages/excalidraw/actions/actionDeleteSelected.tsx
+++ b/packages/excalidraw/actions/actionDeleteSelected.tsx
@@ -4,8 +4,8 @@ import { ToolButton } from "../components/ToolButton";
import { t } from "../i18n";
import { register } from "./register";
import { getNonDeletedElements } from "../element";
-import { ExcalidrawElement } from "../element/types";
-import { AppState } from "../types";
+import type { ExcalidrawElement } from "../element/types";
+import type { AppState } from "../types";
import { newElementWith } from "../element/mutateElement";
import { getElementsInGroup } from "../groups";
import { LinearElementEditor } from "../element/linearElementEditor";
diff --git a/packages/excalidraw/actions/actionDistribute.tsx b/packages/excalidraw/actions/actionDistribute.tsx
index 522fbb305b..4b4166a7e2 100644
--- a/packages/excalidraw/actions/actionDistribute.tsx
+++ b/packages/excalidraw/actions/actionDistribute.tsx
@@ -3,16 +3,17 @@ import {
DistributeVerticallyIcon,
} from "../components/icons";
import { ToolButton } from "../components/ToolButton";
-import { distributeElements, Distribution } from "../distribute";
+import type { Distribution } from "../distribute";
+import { distributeElements } from "../distribute";
import { getNonDeletedElements } from "../element";
import { isFrameLikeElement } from "../element/typeChecks";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
import { updateFrameMembershipOfSelectedElements } from "../frame";
import { t } from "../i18n";
import { CODES, KEYS } from "../keys";
import { isSomeElementSelected } from "../scene";
import { StoreAction } from "../store";
-import { AppClassProperties, AppState } from "../types";
+import type { AppClassProperties, AppState } from "../types";
import { arrayToMap, getShortcutKey } from "../utils";
import { register } from "./register";
diff --git a/packages/excalidraw/actions/actionDuplicateSelection.tsx b/packages/excalidraw/actions/actionDuplicateSelection.tsx
index 0b4957f592..44c26e226a 100644
--- a/packages/excalidraw/actions/actionDuplicateSelection.tsx
+++ b/packages/excalidraw/actions/actionDuplicateSelection.tsx
@@ -1,6 +1,6 @@
import { KEYS } from "../keys";
import { register } from "./register";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
import { duplicateElement, getNonDeletedElements } from "../element";
import { isSomeElementSelected } from "../scene";
import { ToolButton } from "../components/ToolButton";
@@ -12,9 +12,9 @@ import {
getSelectedGroupForElement,
getElementsInGroup,
} from "../groups";
-import { AppState } from "../types";
+import type { AppState } from "../types";
import { fixBindingsAfterDuplication } from "../element/binding";
-import { ActionResult } from "./types";
+import type { ActionResult } from "./types";
import { GRID_SIZE } from "../constants";
import {
bindTextToShapeAfterDuplication,
diff --git a/packages/excalidraw/actions/actionElementLock.ts b/packages/excalidraw/actions/actionElementLock.ts
index 83600871eb..5e5a91f5d8 100644
--- a/packages/excalidraw/actions/actionElementLock.ts
+++ b/packages/excalidraw/actions/actionElementLock.ts
@@ -1,7 +1,7 @@
import { LockedIcon, UnlockedIcon } from "../components/icons";
import { newElementWith } from "../element/mutateElement";
import { isFrameLikeElement } from "../element/typeChecks";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
import { KEYS } from "../keys";
import { getSelectedElements } from "../scene";
import { StoreAction } from "../store";
diff --git a/packages/excalidraw/actions/actionExport.tsx b/packages/excalidraw/actions/actionExport.tsx
index 7b767ecb82..224edf4739 100644
--- a/packages/excalidraw/actions/actionExport.tsx
+++ b/packages/excalidraw/actions/actionExport.tsx
@@ -16,7 +16,7 @@ import { getSelectedElements, isSomeElementSelected } from "../scene";
import { getNonDeletedElements } from "../element";
import { isImageFileHandle } from "../data/blob";
import { nativeFileSystemSupported } from "../data/filesystem";
-import { Theme } from "../element/types";
+import type { Theme } from "../element/types";
import "../components/ToolIcon.scss";
import { StoreAction } from "../store";
diff --git a/packages/excalidraw/actions/actionFinalize.tsx b/packages/excalidraw/actions/actionFinalize.tsx
index e4b0861a6d..9661154f76 100644
--- a/packages/excalidraw/actions/actionFinalize.tsx
+++ b/packages/excalidraw/actions/actionFinalize.tsx
@@ -13,7 +13,7 @@ import {
bindOrUnbindLinearElement,
} from "../element/binding";
import { isBindingElement, isLinearElement } from "../element/typeChecks";
-import { AppState } from "../types";
+import type { AppState } from "../types";
import { resetCursor } from "../cursor";
import { StoreAction } from "../store";
diff --git a/packages/excalidraw/actions/actionFlip.ts b/packages/excalidraw/actions/actionFlip.ts
index e767ca0b0e..0aab7f903c 100644
--- a/packages/excalidraw/actions/actionFlip.ts
+++ b/packages/excalidraw/actions/actionFlip.ts
@@ -1,13 +1,13 @@
import { register } from "./register";
import { getSelectedElements } from "../scene";
import { getNonDeletedElements } from "../element";
-import {
+import type {
ExcalidrawElement,
NonDeleted,
NonDeletedSceneElementsMap,
} from "../element/types";
import { resizeMultipleElements } from "../element/resizeElements";
-import { AppClassProperties, AppState } from "../types";
+import type { AppClassProperties, AppState } from "../types";
import { arrayToMap } from "../utils";
import { CODES, KEYS } from "../keys";
import { getCommonBoundingBox } from "../element/bounds";
diff --git a/packages/excalidraw/actions/actionFrame.ts b/packages/excalidraw/actions/actionFrame.ts
index 3471ed5b57..ffed9197ac 100644
--- a/packages/excalidraw/actions/actionFrame.ts
+++ b/packages/excalidraw/actions/actionFrame.ts
@@ -1,9 +1,9 @@
import { getNonDeletedElements } from "../element";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
import { removeAllElementsFromFrame } from "../frame";
import { getFrameChildren } from "../frame";
import { KEYS } from "../keys";
-import { AppClassProperties, AppState, UIAppState } from "../types";
+import type { AppClassProperties, AppState, UIAppState } from "../types";
import { updateActiveTool } from "../utils";
import { setCursorForShape } from "../cursor";
import { register } from "./register";
diff --git a/packages/excalidraw/actions/actionGroup.tsx b/packages/excalidraw/actions/actionGroup.tsx
index 51f49cceab..6a6e735b7d 100644
--- a/packages/excalidraw/actions/actionGroup.tsx
+++ b/packages/excalidraw/actions/actionGroup.tsx
@@ -17,12 +17,12 @@ import {
import { getNonDeletedElements } from "../element";
import { randomId } from "../random";
import { ToolButton } from "../components/ToolButton";
-import {
+import type {
ExcalidrawElement,
ExcalidrawTextElement,
OrderedExcalidrawElement,
} from "../element/types";
-import { AppClassProperties, AppState } from "../types";
+import type { AppClassProperties, AppState } from "../types";
import { isBoundToContainer } from "../element/typeChecks";
import {
getElementsInResizingFrame,
diff --git a/packages/excalidraw/actions/actionHistory.tsx b/packages/excalidraw/actions/actionHistory.tsx
index 23767bda8e..7b4a67f283 100644
--- a/packages/excalidraw/actions/actionHistory.tsx
+++ b/packages/excalidraw/actions/actionHistory.tsx
@@ -1,14 +1,16 @@
-import { Action, ActionResult } from "./types";
+import type { Action, ActionResult } from "./types";
import { UndoIcon, RedoIcon } from "../components/icons";
import { ToolButton } from "../components/ToolButton";
import { t } from "../i18n";
-import { History, HistoryChangedEvent } from "../history";
-import { AppState } from "../types";
+import type { History } from "../history";
+import { HistoryChangedEvent } from "../history";
+import type { AppState } from "../types";
import { KEYS } from "../keys";
import { arrayToMap } from "../utils";
import { isWindows } from "../constants";
-import { SceneElementsMap } from "../element/types";
-import { Store, StoreAction } from "../store";
+import type { SceneElementsMap } from "../element/types";
+import type { Store } from "../store";
+import { StoreAction } from "../store";
import { useEmitter } from "../hooks/useEmitter";
const writeData = (
diff --git a/packages/excalidraw/actions/actionLinearEditor.tsx b/packages/excalidraw/actions/actionLinearEditor.tsx
index bc5d96cc8b..12f00c2483 100644
--- a/packages/excalidraw/actions/actionLinearEditor.tsx
+++ b/packages/excalidraw/actions/actionLinearEditor.tsx
@@ -1,7 +1,7 @@
import { DEFAULT_CATEGORIES } from "../components/CommandPalette/CommandPalette";
import { LinearElementEditor } from "../element/linearElementEditor";
import { isLinearElement } from "../element/typeChecks";
-import { ExcalidrawLinearElement } from "../element/types";
+import type { ExcalidrawLinearElement } from "../element/types";
import { StoreAction } from "../store";
import { register } from "./register";
import { ToolButton } from "../components/ToolButton";
diff --git a/packages/excalidraw/actions/actionNavigate.tsx b/packages/excalidraw/actions/actionNavigate.tsx
index 9e401f4e2e..c577e975f7 100644
--- a/packages/excalidraw/actions/actionNavigate.tsx
+++ b/packages/excalidraw/actions/actionNavigate.tsx
@@ -1,6 +1,6 @@
import { getClientColor } from "../clients";
import { Avatar } from "../components/Avatar";
-import { GoToCollaboratorComponentProps } from "../components/UserList";
+import type { GoToCollaboratorComponentProps } from "../components/UserList";
import {
eyeIcon,
microphoneIcon,
@@ -8,7 +8,7 @@ import {
} from "../components/icons";
import { t } from "../i18n";
import { StoreAction } from "../store";
-import { Collaborator } from "../types";
+import type { Collaborator } from "../types";
import { register } from "./register";
import clsx from "clsx";
diff --git a/packages/excalidraw/actions/actionProperties.tsx b/packages/excalidraw/actions/actionProperties.tsx
index 8ff2b40e73..b26e12de0d 100644
--- a/packages/excalidraw/actions/actionProperties.tsx
+++ b/packages/excalidraw/actions/actionProperties.tsx
@@ -1,4 +1,4 @@
-import { AppClassProperties, AppState, Primitive } from "../types";
+import type { AppClassProperties, AppState, Primitive } from "../types";
import {
DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE,
DEFAULT_ELEMENT_BACKGROUND_PICKS,
@@ -74,7 +74,7 @@ import {
isLinearElement,
isUsingAdaptiveRadius,
} from "../element/typeChecks";
-import {
+import type {
Arrowhead,
ExcalidrawElement,
ExcalidrawLinearElement,
diff --git a/packages/excalidraw/actions/actionSelectAll.ts b/packages/excalidraw/actions/actionSelectAll.ts
index 7cc7a0e28f..e95c5251a4 100644
--- a/packages/excalidraw/actions/actionSelectAll.ts
+++ b/packages/excalidraw/actions/actionSelectAll.ts
@@ -2,7 +2,7 @@ import { KEYS } from "../keys";
import { register } from "./register";
import { selectGroupsForSelectedElements } from "../groups";
import { getNonDeletedElements, isTextElement } from "../element";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
import { isLinearElement } from "../element/typeChecks";
import { LinearElementEditor } from "../element/linearElementEditor";
import { excludeElementsInFramesFromSelection } from "../scene/selection";
diff --git a/packages/excalidraw/actions/actionStyles.ts b/packages/excalidraw/actions/actionStyles.ts
index fa8c6b9a31..9483476f82 100644
--- a/packages/excalidraw/actions/actionStyles.ts
+++ b/packages/excalidraw/actions/actionStyles.ts
@@ -24,7 +24,7 @@ import {
isArrowElement,
} from "../element/typeChecks";
import { getSelectedElements } from "../scene";
-import { ExcalidrawTextElement } from "../element/types";
+import type { ExcalidrawTextElement } from "../element/types";
import { paintIcon } from "../components/icons";
import { StoreAction } from "../store";
diff --git a/packages/excalidraw/actions/actionToggleGridMode.tsx b/packages/excalidraw/actions/actionToggleGridMode.tsx
index da5ab6b440..529489382e 100644
--- a/packages/excalidraw/actions/actionToggleGridMode.tsx
+++ b/packages/excalidraw/actions/actionToggleGridMode.tsx
@@ -1,7 +1,7 @@
import { CODES, KEYS } from "../keys";
import { register } from "./register";
import { GRID_SIZE } from "../constants";
-import { AppState } from "../types";
+import type { AppState } from "../types";
import { gridIcon } from "../components/icons";
import { StoreAction } from "../store";
diff --git a/packages/excalidraw/actions/manager.tsx b/packages/excalidraw/actions/manager.tsx
index b5e36e855f..f378438004 100644
--- a/packages/excalidraw/actions/manager.tsx
+++ b/packages/excalidraw/actions/manager.tsx
@@ -1,5 +1,5 @@
import React from "react";
-import {
+import type {
Action,
UpdaterFn,
ActionName,
@@ -7,8 +7,11 @@ import {
PanelComponentProps,
ActionSource,
} from "./types";
-import { ExcalidrawElement, OrderedExcalidrawElement } from "../element/types";
-import { AppClassProperties, AppState } from "../types";
+import type {
+ ExcalidrawElement,
+ OrderedExcalidrawElement,
+} from "../element/types";
+import type { AppClassProperties, AppState } from "../types";
import { trackEvent } from "../analytics";
import { isPromiseLike } from "../utils";
diff --git a/packages/excalidraw/actions/register.ts b/packages/excalidraw/actions/register.ts
index ccc9cdbf98..7c841e3aee 100644
--- a/packages/excalidraw/actions/register.ts
+++ b/packages/excalidraw/actions/register.ts
@@ -1,4 +1,4 @@
-import { Action } from "./types";
+import type { Action } from "./types";
export let actions: readonly Action[] = [];
diff --git a/packages/excalidraw/actions/shortcuts.ts b/packages/excalidraw/actions/shortcuts.ts
index 3f1be97d59..a5c3bad66c 100644
--- a/packages/excalidraw/actions/shortcuts.ts
+++ b/packages/excalidraw/actions/shortcuts.ts
@@ -1,8 +1,8 @@
import { isDarwin } from "../constants";
import { t } from "../i18n";
-import { SubtypeOf } from "../utility-types";
+import type { SubtypeOf } from "../utility-types";
import { getShortcutKey } from "../utils";
-import { ActionName } from "./types";
+import type { ActionName } from "./types";
export type ShortcutName =
| SubtypeOf<
diff --git a/packages/excalidraw/actions/types.ts b/packages/excalidraw/actions/types.ts
index d662fdb940..401fe7432d 100644
--- a/packages/excalidraw/actions/types.ts
+++ b/packages/excalidraw/actions/types.ts
@@ -1,14 +1,17 @@
-import React from "react";
-import { ExcalidrawElement, OrderedExcalidrawElement } from "../element/types";
-import {
+import type React from "react";
+import type {
+ ExcalidrawElement,
+ OrderedExcalidrawElement,
+} from "../element/types";
+import type {
AppClassProperties,
AppState,
ExcalidrawProps,
BinaryFiles,
UIAppState,
} from "../types";
-import { MarkOptional } from "../utility-types";
-import { StoreActionType } from "../store";
+import type { MarkOptional } from "../utility-types";
+import type { StoreActionType } from "../store";
export type ActionSource =
| "ui"
diff --git a/packages/excalidraw/align.ts b/packages/excalidraw/align.ts
index 90ecabb117..5abebea21e 100644
--- a/packages/excalidraw/align.ts
+++ b/packages/excalidraw/align.ts
@@ -1,6 +1,7 @@
-import { ElementsMap, ExcalidrawElement } from "./element/types";
+import type { ElementsMap, ExcalidrawElement } from "./element/types";
import { newElementWith } from "./element/mutateElement";
-import { BoundingBox, getCommonBoundingBox } from "./element/bounds";
+import type { BoundingBox } from "./element/bounds";
+import { getCommonBoundingBox } from "./element/bounds";
import { getMaximumGroups } from "./groups";
export interface Alignment {
diff --git a/packages/excalidraw/animated-trail.ts b/packages/excalidraw/animated-trail.ts
index de5fd08fde..97a0054614 100644
--- a/packages/excalidraw/animated-trail.ts
+++ b/packages/excalidraw/animated-trail.ts
@@ -1,6 +1,7 @@
-import { LaserPointer, LaserPointerOptions } from "@excalidraw/laser-pointer";
-import { AnimationFrameHandler } from "./animation-frame-handler";
-import { AppState } from "./types";
+import type { LaserPointerOptions } from "@excalidraw/laser-pointer";
+import { LaserPointer } from "@excalidraw/laser-pointer";
+import type { AnimationFrameHandler } from "./animation-frame-handler";
+import type { AppState } from "./types";
import { getSvgPathFromStroke, sceneCoordsToViewportCoords } from "./utils";
import type App from "./components/App";
import { SVG_NS } from "./constants";
diff --git a/packages/excalidraw/appState.ts b/packages/excalidraw/appState.ts
index a0ab233c9e..b6fdb45e64 100644
--- a/packages/excalidraw/appState.ts
+++ b/packages/excalidraw/appState.ts
@@ -7,7 +7,7 @@ import {
EXPORT_SCALES,
THEME,
} from "./constants";
-import { AppState, NormalizedZoomValue } from "./types";
+import type { AppState, NormalizedZoomValue } from "./types";
const defaultExportScale = EXPORT_SCALES.includes(devicePixelRatio)
? devicePixelRatio
diff --git a/packages/excalidraw/change.ts b/packages/excalidraw/change.ts
index b8c88f54f7..8774cfdb93 100644
--- a/packages/excalidraw/change.ts
+++ b/packages/excalidraw/change.ts
@@ -1,18 +1,14 @@
import { ENV } from "./constants";
+import type { BindableProp, BindingProp } from "./element/binding";
import {
BoundElement,
BindableElement,
- BindableProp,
- BindingProp,
bindingProperties,
updateBoundElements,
} from "./element/binding";
import { LinearElementEditor } from "./element/linearElementEditor";
-import {
- ElementUpdate,
- mutateElement,
- newElementWith,
-} from "./element/mutateElement";
+import type { ElementUpdate } from "./element/mutateElement";
+import { mutateElement, newElementWith } from "./element/mutateElement";
import {
getBoundTextElementId,
redrawTextBoundingBox,
@@ -23,7 +19,7 @@ import {
isBoundToContainer,
isTextElement,
} from "./element/typeChecks";
-import {
+import type {
ExcalidrawElement,
ExcalidrawLinearElement,
ExcalidrawTextElement,
@@ -34,13 +30,13 @@ import {
import { orderByFractionalIndex, syncMovedIndices } from "./fractionalIndex";
import { getNonDeletedGroupIds } from "./groups";
import { getObservedAppState } from "./store";
-import {
+import type {
AppState,
ObservedAppState,
ObservedElementsAppState,
ObservedStandaloneAppState,
} from "./types";
-import { SubtypeOf, ValueOf } from "./utility-types";
+import type { SubtypeOf, ValueOf } from "./utility-types";
import {
arrayToMap,
arrayToObject,
diff --git a/packages/excalidraw/charts.test.ts b/packages/excalidraw/charts.test.ts
index 5c2cce708a..fcd8823a94 100644
--- a/packages/excalidraw/charts.test.ts
+++ b/packages/excalidraw/charts.test.ts
@@ -1,9 +1,5 @@
-import {
- Spreadsheet,
- tryParseCells,
- tryParseNumber,
- VALID_SPREADSHEET,
-} from "./charts";
+import type { Spreadsheet } from "./charts";
+import { tryParseCells, tryParseNumber, VALID_SPREADSHEET } from "./charts";
describe("charts", () => {
describe("tryParseNumber", () => {
diff --git a/packages/excalidraw/charts.ts b/packages/excalidraw/charts.ts
index 32be94620f..62fe938860 100644
--- a/packages/excalidraw/charts.ts
+++ b/packages/excalidraw/charts.ts
@@ -9,7 +9,7 @@ import {
VERTICAL_ALIGN,
} from "./constants";
import { newElement, newLinearElement, newTextElement } from "./element";
-import { NonDeletedExcalidrawElement } from "./element/types";
+import type { NonDeletedExcalidrawElement } from "./element/types";
import { randomId } from "./random";
export type ChartElements = readonly NonDeletedExcalidrawElement[];
diff --git a/packages/excalidraw/clients.ts b/packages/excalidraw/clients.ts
index 439080bd51..afff1eeb64 100644
--- a/packages/excalidraw/clients.ts
+++ b/packages/excalidraw/clients.ts
@@ -5,13 +5,13 @@ import {
THEME,
} from "./constants";
import { roundRect } from "./renderer/roundRect";
-import { InteractiveCanvasRenderConfig } from "./scene/types";
-import {
+import type { InteractiveCanvasRenderConfig } from "./scene/types";
+import type {
Collaborator,
InteractiveCanvasAppState,
SocketId,
- UserIdleState,
} from "./types";
+import { UserIdleState } from "./types";
function hashToInteger(id: string) {
let hash = 0;
diff --git a/packages/excalidraw/clipboard.ts b/packages/excalidraw/clipboard.ts
index e24961c647..b53b59caec 100644
--- a/packages/excalidraw/clipboard.ts
+++ b/packages/excalidraw/clipboard.ts
@@ -1,9 +1,10 @@
-import {
+import type {
ExcalidrawElement,
NonDeletedExcalidrawElement,
} from "./element/types";
-import { BinaryFiles } from "./types";
-import { tryParseSpreadsheet, Spreadsheet, VALID_SPREADSHEET } from "./charts";
+import type { BinaryFiles } from "./types";
+import type { Spreadsheet } from "./charts";
+import { tryParseSpreadsheet, VALID_SPREADSHEET } from "./charts";
import {
ALLOWED_PASTE_MIME_TYPES,
EXPORT_DATA_TYPES,
diff --git a/packages/excalidraw/colors.ts b/packages/excalidraw/colors.ts
index 905e6cd3f2..e4cd67a94a 100644
--- a/packages/excalidraw/colors.ts
+++ b/packages/excalidraw/colors.ts
@@ -1,5 +1,5 @@
import oc from "open-color";
-import { Merge } from "./utility-types";
+import type { Merge } from "./utility-types";
// FIXME can't put to utils.ts rn because of circular dependency
const pick = <R extends Record<string, any>, K extends readonly (keyof R)[]>(
diff --git a/packages/excalidraw/components/Actions.tsx b/packages/excalidraw/components/Actions.tsx
index dfec5f4713..9604afdecd 100644
--- a/packages/excalidraw/components/Actions.tsx
+++ b/packages/excalidraw/components/Actions.tsx
@@ -1,6 +1,6 @@
import { useState } from "react";
-import { ActionManager } from "../actions/manager";
-import {
+import type { ActionManager } from "../actions/manager";
+import type {
ExcalidrawElement,
ExcalidrawElementType,
NonDeletedElementsMap,
@@ -17,7 +17,7 @@ import {
hasStrokeWidth,
} from "../scene";
import { SHAPES } from "../shapes";
-import { AppClassProperties, AppProps, UIAppState, Zoom } from "../types";
+import type { AppClassProperties, AppProps, UIAppState, Zoom } from "../types";
import { capitalizeString, isTransparent } from "../utils";
import Stack from "./Stack";
import { ToolButton } from "./ToolButton";
diff --git a/packages/excalidraw/components/App.tsx b/packages/excalidraw/components/App.tsx
index 5a08f1fe56..b461d4d167 100644
--- a/packages/excalidraw/components/App.tsx
+++ b/packages/excalidraw/components/App.tsx
@@ -1,7 +1,7 @@
import React, { useContext } from "react";
import { flushSync } from "react-dom";
-import { RoughCanvas } from "roughjs/bin/canvas";
+import type { RoughCanvas } from "roughjs/bin/canvas";
import rough from "roughjs/bin/rough";
import clsx from "clsx";
import { nanoid } from "nanoid";
@@ -39,18 +39,16 @@ import {
import { createRedoAction, createUndoAction } from "../actions/actionHistory";
import { ActionManager } from "../actions/manager";
import { actions } from "../actions/register";
-import { Action, ActionResult } from "../actions/types";
+import type { Action, ActionResult } from "../actions/types";
import { trackEvent } from "../analytics";
import {
getDefaultAppState,
isEraserActive,
isHandToolActive,
} from "../appState";
-import {
- PastedMixedContent,
- copyTextToSystemClipboard,
- parseClipboard,
-} from "../clipboard";
+import type { PastedMixedContent } from "../clipboard";
+import { copyTextToSystemClipboard, parseClipboard } from "../clipboard";
+import type { EXPORT_IMAGE_TYPES } from "../constants";
import {
APP_NAME,
CURSOR_TYPE,
@@ -62,7 +60,6 @@ import {
ENV,
EVENT,
FRAME_STYLE,
- EXPORT_IMAGE_TYPES,
GRID_SIZE,
IMAGE_MIME_TYPES,
IMAGE_RENDER_TIMEOUT,
@@ -92,7 +89,8 @@ import {
supportsResizeObserver,
DEFAULT_COLLISION_THRESHOLD,
} from "../constants";
-import { ExportedElements, exportCanvas, loadFromBlob } from "../data";
+import type { ExportedElements } from "../data";
+import { exportCanvas, loadFromBlob } from "../data";
import Library, { distributeLibraryItemsOnSquareGrid } from "../data/library";
import { restore, restoreElements } from "../data/restore";
import {
@@ -163,7 +161,7 @@ import {
isMagicFrameElement,
isTextBindableContainer,
} from "../element/typeChecks";
-import {
+import type {
ExcalidrawBindableElement,
ExcalidrawElement,
ExcalidrawFreeDrawElement,
@@ -220,11 +218,14 @@ import {
isSomeElementSelected,
} from "../scene";
import Scene from "../scene/Scene";
-import { RenderInteractiveSceneCallback, ScrollBars } from "../scene/types";
+import type {
+ RenderInteractiveSceneCallback,
+ ScrollBars,
+} from "../scene/types";
import { getStateForZoom } from "../scene/zoom";
import { findShapeByKey } from "../shapes";
+import type { GeometricShape } from "../../utils/geometry/shape";
import {
- GeometricShape,
getClosedCurveShape,
getCurveShape,
getEllipseShape,
@@ -233,7 +234,7 @@ import {
getSelectionBoxShape,
} from "../../utils/geometry/shape";
import { isPointInShape } from "../../utils/collision";
-import {
+import type {
AppClassProperties,
AppProps,
AppState,
@@ -291,11 +292,8 @@ import {
maybeParseEmbedSrc,
getEmbedLink,
} from "../element/embeddable";
-import {
- ContextMenu,
- ContextMenuItems,
- CONTEXT_MENU_SEPARATOR,
-} from "./ContextMenu";
+import type { ContextMenuItems } from "./ContextMenu";
+import { ContextMenu, CONTEXT_MENU_SEPARATOR } from "./ContextMenu";
import LayerUI from "./LayerUI";
import { Toast } from "./Toast";
import { actionToggleViewMode } from "../actions/actionToggleViewMode";
@@ -320,7 +318,8 @@ import {
updateImageCache as _updateImageCache,
} from "../element/image";
import throttle from "lodash.throttle";
-import { fileOpen, FileSystemHandle } from "../data/filesystem";
+import type { FileSystemHandle } from "../data/filesystem";
+import { fileOpen } from "../data/filesystem";
import {
bindTextToShapeAfterDuplication,
getApproxMinLineHeight,
@@ -386,11 +385,9 @@ import {
import { actionWrapTextInContainer } from "../actions/actionBoundText";
import BraveMeasureTextError from "./BraveMeasureTextError";
import { activeEyeDropperAtom } from "./EyeDropper";
-import {
- ExcalidrawElementSkeleton,
- convertToExcalidrawElements,
-} from "../data/transform";
-import { ValueOf } from "../utility-types";
+import type { ExcalidrawElementSkeleton } from "../data/transform";
+import { convertToExcalidrawElements } from "../data/transform";
+import type { ValueOf } from "../utility-types";
import { isSidebarDockedAtom } from "./Sidebar/Sidebar";
import { StaticCanvas, InteractiveCanvas } from "./canvases";
import { Renderer } from "../scene/Renderer";
@@ -404,7 +401,8 @@ import {
} from "../cursor";
import { Emitter } from "../emitter";
import { ElementCanvasButtons } from "../element/ElementCanvasButtons";
-import { MagicCacheData, diagramToHTML } from "../data/magic";
+import type { MagicCacheData } from "../data/magic";
+import { diagramToHTML } from "../data/magic";
import { exportToBlob } from "../../utils/export";
import { COLOR_PALETTE } from "../colors";
import { ElementCanvasButton } from "./MagicButton";
diff --git a/packages/excalidraw/components/ColorPicker/ColorInput.tsx b/packages/excalidraw/components/ColorPicker/ColorInput.tsx
index c4321999f3..7e77e06ffc 100644
--- a/packages/excalidraw/components/ColorPicker/ColorInput.tsx
+++ b/packages/excalidraw/components/ColorPicker/ColorInput.tsx
@@ -1,10 +1,8 @@
import { useCallback, useEffect, useRef, useState } from "react";
import { getColor } from "./ColorPicker";
import { useAtom } from "jotai";
-import {
- ColorPickerType,
- activeColorPickerSectionAtom,
-} from "./colorPickerUtils";
+import type { ColorPickerType } from "./colorPickerUtils";
+import { activeColorPickerSectionAtom } from "./colorPickerUtils";
import { eyeDropperIcon } from "../icons";
import { jotaiScope } from "../../jotai";
import { KEYS } from "../../keys";
diff --git a/packages/excalidraw/components/ColorPicker/ColorPicker.tsx b/packages/excalidraw/components/ColorPicker/ColorPicker.tsx
index 83e8abce79..beb4ed7aa0 100644
--- a/packages/excalidraw/components/ColorPicker/ColorPicker.tsx
+++ b/packages/excalidraw/components/ColorPicker/ColorPicker.tsx
@@ -1,16 +1,15 @@
import { isInteractive, isTransparent, isWritableElement } from "../../utils";
-import { ExcalidrawElement } from "../../element/types";
-import { AppState } from "../../types";
+import type { ExcalidrawElement } from "../../element/types";
+import type { AppState } from "../../types";
import { TopPicks } from "./TopPicks";
import { Picker } from "./Picker";
import * as Popover from "@radix-ui/react-popover";
import { useAtom } from "jotai";
-import {
- activeColorPickerSectionAtom,
- ColorPickerType,
-} from "./colorPickerUtils";
+import type { ColorPickerType } from "./colorPickerUtils";
+import { activeColorPickerSectionAtom } from "./colorPickerUtils";
import { useDevice, useExcalidrawContainer } from "../App";
-import { ColorTuple, COLOR_PALETTE, ColorPaletteCustom } from "../../colors";
+import type { ColorTuple, ColorPaletteCustom } from "../../colors";
+import { COLOR_PALETTE } from "../../colors";
import PickerHeading from "./PickerHeading";
import { t } from "../../i18n";
import clsx from "clsx";
diff --git a/packages/excalidraw/components/ColorPicker/Picker.tsx b/packages/excalidraw/components/ColorPicker/Picker.tsx
index a2e17526cf..31d53cac3b 100644
--- a/packages/excalidraw/components/ColorPicker/Picker.tsx
+++ b/packages/excalidraw/components/ColorPicker/Picker.tsx
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from "react";
import { t } from "../../i18n";
-import { ExcalidrawElement } from "../../element/types";
+import type { ExcalidrawElement } from "../../element/types";
import { ShadeList } from "./ShadeList";
import PickerColorList from "./PickerColorList";
@@ -9,15 +9,15 @@ import { useAtom } from "jotai";
import { CustomColorList } from "./CustomColorList";
import { colorPickerKeyNavHandler } from "./keyboardNavHandlers";
import PickerHeading from "./PickerHeading";
+import type { ColorPickerType } from "./colorPickerUtils";
import {
- ColorPickerType,
activeColorPickerSectionAtom,
getColorNameAndShadeFromColor,
getMostUsedCustomColors,
isCustomColor,
} from "./colorPickerUtils";
+import type { ColorPaletteCustom } from "../../colors";
import {
- ColorPaletteCustom,
DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX,
DEFAULT_ELEMENT_STROKE_COLOR_INDEX,
} from "../../colors";
diff --git a/packages/excalidraw/components/ColorPicker/PickerColorList.tsx b/packages/excalidraw/components/ColorPicker/PickerColorList.tsx
index 40f4bbeb01..406209a8e7 100644
--- a/packages/excalidraw/components/ColorPicker/PickerColorList.tsx
+++ b/packages/excalidraw/components/ColorPicker/PickerColorList.tsx
@@ -7,8 +7,9 @@ import {
getColorNameAndShadeFromColor,
} from "./colorPickerUtils";
import HotkeyLabel from "./HotkeyLabel";
-import { ColorPaletteCustom } from "../../colors";
-import { TranslationKeys, t } from "../../i18n";
+import type { ColorPaletteCustom } from "../../colors";
+import type { TranslationKeys } from "../../i18n";
+import { t } from "../../i18n";
interface PickerColorListProps {
palette: ColorPaletteCustom;
diff --git a/packages/excalidraw/components/ColorPicker/PickerHeading.tsx b/packages/excalidraw/components/ColorPicker/PickerHeading.tsx
index 0437313669..3999a49b43 100644
--- a/packages/excalidraw/components/ColorPicker/PickerHeading.tsx
+++ b/packages/excalidraw/components/ColorPicker/PickerHeading.tsx
@@ -1,4 +1,4 @@
-import { ReactNode } from "react";
+import type { ReactNode } from "react";
const PickerHeading = ({ children }: { children: ReactNode }) => (
<div className="color-picker__heading">{children}</div>
diff --git a/packages/excalidraw/components/ColorPicker/ShadeList.tsx b/packages/excalidraw/components/ColorPicker/ShadeList.tsx
index 81ddaab243..292457cbc1 100644
--- a/packages/excalidraw/components/ColorPicker/ShadeList.tsx
+++ b/packages/excalidraw/components/ColorPicker/ShadeList.tsx
@@ -7,7 +7,7 @@ import {
} from "./colorPickerUtils";
import HotkeyLabel from "./HotkeyLabel";
import { t } from "../../i18n";
-import { ColorPaletteCustom } from "../../colors";
+import type { ColorPaletteCustom } from "../../colors";
interface ShadeListProps {
hex: string;
diff --git a/packages/excalidraw/components/ColorPicker/TopPicks.tsx b/packages/excalidraw/components/ColorPicker/TopPicks.tsx
index 34adbdf495..5c69d1e43d 100644
--- a/packages/excalidraw/components/ColorPicker/TopPicks.tsx
+++ b/packages/excalidraw/components/ColorPicker/TopPicks.tsx
@@ -1,5 +1,5 @@
import clsx from "clsx";
-import { ColorPickerType } from "./colorPickerUtils";
+import type { ColorPickerType } from "./colorPickerUtils";
import {
DEFAULT_CANVAS_BACKGROUND_PICKS,
DEFAULT_ELEMENT_BACKGROUND_PICKS,
diff --git a/packages/excalidraw/components/ColorPicker/colorPickerUtils.ts b/packages/excalidraw/components/ColorPicker/colorPickerUtils.ts
index 37e5c88a67..311f5eba90 100644
--- a/packages/excalidraw/components/ColorPicker/colorPickerUtils.ts
+++ b/packages/excalidraw/components/ColorPicker/colorPickerUtils.ts
@@ -1,10 +1,7 @@
-import { ExcalidrawElement } from "../../element/types";
+import type { ExcalidrawElement } from "../../element/types";
import { atom } from "jotai";
-import {
- ColorPickerColor,
- ColorPaletteCustom,
- MAX_CUSTOM_COLORS_USED_IN_CANVAS,
-} from "../../colors";
+import type { ColorPickerColor, ColorPaletteCustom } from "../../colors";
+import { MAX_CUSTOM_COLORS_USED_IN_CANVAS } from "../../colors";
export const getColorNameAndShadeFromColor = ({
palette,
diff --git a/packages/excalidraw/components/ColorPicker/keyboardNavHandlers.ts b/packages/excalidraw/components/ColorPicker/keyboardNavHandlers.ts
index 95ee7beeb5..7767692edf 100644
--- a/packages/excalidraw/components/ColorPicker/keyboardNavHandlers.ts
+++ b/packages/excalidraw/components/ColorPicker/keyboardNavHandlers.ts
@@ -1,14 +1,13 @@
import { KEYS } from "../../keys";
-import {
+import type {
ColorPickerColor,
ColorPalette,
ColorPaletteCustom,
- COLORS_PER_ROW,
- COLOR_PALETTE,
} from "../../colors";
-import { ValueOf } from "../../utility-types";
+import { COLORS_PER_ROW, COLOR_PALETTE } from "../../colors";
+import type { ValueOf } from "../../utility-types";
+import type { ActiveColorPickerSectionAtomType } from "./colorPickerUtils";
import {
- ActiveColorPickerSectionAtomType,
colorPickerHotkeyBindings,
getColorNameAndShadeFromColor,
} from "./colorPickerUtils";
diff --git a/packages/excalidraw/components/CommandPalette/CommandPalette.tsx b/packages/excalidraw/components/CommandPalette/CommandPalette.tsx
index 9f49adc2fa..4147ca0853 100644
--- a/packages/excalidraw/components/CommandPalette/CommandPalette.tsx
+++ b/packages/excalidraw/components/CommandPalette/CommandPalette.tsx
@@ -10,12 +10,11 @@ import { Dialog } from "../Dialog";
import { TextField } from "../TextField";
import clsx from "clsx";
import { getSelectedElements } from "../../scene";
-import { Action } from "../../actions/types";
-import { TranslationKeys, t } from "../../i18n";
-import {
- ShortcutName,
- getShortcutFromShortcutName,
-} from "../../actions/shortcuts";
+import type { Action } from "../../actions/types";
+import type { TranslationKeys } from "../../i18n";
+import { t } from "../../i18n";
+import type { ShortcutName } from "../../actions/shortcuts";
+import { getShortcutFromShortcutName } from "../../actions/shortcuts";
import { DEFAULT_SIDEBAR, EVENT } from "../../constants";
import {
LockedIcon,
@@ -31,7 +30,7 @@ import {
} from "../icons";
import fuzzy from "fuzzy";
import { useUIAppState } from "../../context/ui-appState";
-import { AppProps, AppState, UIAppState } from "../../types";
+import type { AppProps, AppState, UIAppState } from "../../types";
import {
capitalizeString,
getShortcutKey,
@@ -39,7 +38,7 @@ import {
} from "../../utils";
import { atom, useAtom } from "jotai";
import { deburr } from "../../deburr";
-import { MarkRequired } from "../../utility-types";
+import type { MarkRequired } from "../../utility-types";
import { InlineIcon } from "../InlineIcon";
import { SHAPES } from "../../shapes";
import { canChangeBackgroundColor, canChangeStrokeColor } from "../Actions";
@@ -47,7 +46,7 @@ import { useStableCallback } from "../../hooks/useStableCallback";
import { actionClearCanvas, actionLink } from "../../actions";
import { jotaiStore } from "../../jotai";
import { activeConfirmDialogAtom } from "../ActiveConfirmDialog";
-import { CommandPaletteItem } from "./types";
+import type { CommandPaletteItem } from "./types";
import * as defaultItems from "./defaultCommandPaletteItems";
import { trackEvent } from "../../analytics";
import { useStable } from "../../hooks/useStable";
diff --git a/packages/excalidraw/components/CommandPalette/defaultCommandPaletteItems.ts b/packages/excalidraw/components/CommandPalette/defaultCommandPaletteItems.ts
index 831a585ae0..dea14ff262 100644
--- a/packages/excalidraw/components/CommandPalette/defaultCommandPaletteItems.ts
+++ b/packages/excalidraw/components/CommandPalette/defaultCommandPaletteItems.ts
@@ -1,5 +1,5 @@
import { actionToggleTheme } from "../../actions";
-import { CommandPaletteItem } from "./types";
+import type { CommandPaletteItem } from "./types";
export const toggleTheme: CommandPaletteItem = {
...actionToggleTheme,
diff --git a/packages/excalidraw/components/CommandPalette/types.ts b/packages/excalidraw/components/CommandPalette/types.ts
index 59e306d2d6..957d699273 100644
--- a/packages/excalidraw/components/CommandPalette/types.ts
+++ b/packages/excalidraw/components/CommandPalette/types.ts
@@ -1,6 +1,6 @@
-import { ActionManager } from "../../actions/manager";
-import { Action } from "../../actions/types";
-import { UIAppState } from "../../types";
+import type { ActionManager } from "../../actions/manager";
+import type { Action } from "../../actions/types";
+import type { UIAppState } from "../../types";
export type CommandPaletteItem = {
label: string;
diff --git a/packages/excalidraw/components/ConfirmDialog.tsx b/packages/excalidraw/components/ConfirmDialog.tsx
index 9061fefa07..2bda72e2c0 100644
--- a/packages/excalidraw/components/ConfirmDialog.tsx
+++ b/packages/excalidraw/components/ConfirmDialog.tsx
@@ -1,5 +1,6 @@
import { t } from "../i18n";
-import { Dialog, DialogProps } from "./Dialog";
+import type { DialogProps } from "./Dialog";
+import { Dialog } from "./Dialog";
import "./ConfirmDialog.scss";
import DialogActionButton from "./DialogActionButton";
diff --git a/packages/excalidraw/components/ContextMenu.tsx b/packages/excalidraw/components/ContextMenu.tsx
index 23959a990b..7353c56c66 100644
--- a/packages/excalidraw/components/ContextMenu.tsx
+++ b/packages/excalidraw/components/ContextMenu.tsx
@@ -1,14 +1,13 @@
import clsx from "clsx";
import { Popover } from "./Popover";
-import { t, TranslationKeys } from "../i18n";
+import type { TranslationKeys } from "../i18n";
+import { t } from "../i18n";
import "./ContextMenu.scss";
-import {
- getShortcutFromShortcutName,
- ShortcutName,
-} from "../actions/shortcuts";
-import { Action } from "../actions/types";
-import { ActionManager } from "../actions/manager";
+import type { ShortcutName } from "../actions/shortcuts";
+import { getShortcutFromShortcutName } from "../actions/shortcuts";
+import type { Action } from "../actions/types";
+import type { ActionManager } from "../actions/manager";
import { useExcalidrawAppState, useExcalidrawElements } from "./App";
import React from "react";
diff --git a/packages/excalidraw/components/DarkModeToggle.tsx b/packages/excalidraw/components/DarkModeToggle.tsx
index 5ac8235c8d..6292ba5eda 100644
--- a/packages/excalidraw/components/DarkModeToggle.tsx
+++ b/packages/excalidraw/components/DarkModeToggle.tsx
@@ -3,7 +3,7 @@ import "./ToolIcon.scss";
import { t } from "../i18n";
import { ToolButton } from "./ToolButton";
import { THEME } from "../constants";
-import { Theme } from "../element/types";
+import type { Theme } from "../element/types";
// We chose to use only explicit toggle and not a third option for system value,
// but this could be added in the future.
diff --git a/packages/excalidraw/components/DefaultSidebar.tsx b/packages/excalidraw/components/DefaultSidebar.tsx
index 48a78faac8..78b03007f8 100644
--- a/packages/excalidraw/components/DefaultSidebar.tsx
+++ b/packages/excalidraw/components/DefaultSidebar.tsx
@@ -3,12 +3,12 @@ import { DEFAULT_SIDEBAR, LIBRARY_SIDEBAR_TAB } from "../constants";
import { useTunnels } from "../context/tunnels";
import { useUIAppState } from "../context/ui-appState";
import { t } from "../i18n";
-import { MarkOptional, Merge } from "../utility-types";
+import type { MarkOptional, Merge } from "../utility-types";
import { composeEventHandlers } from "../utils";
import { useExcalidrawSetAppState } from "./App";
import { withInternalFallback } from "./hoc/withInternalFallback";
import { LibraryMenu } from "./LibraryMenu";
-import { SidebarProps, SidebarTriggerProps } from "./Sidebar/common";
+import type { SidebarProps, SidebarTriggerProps } from "./Sidebar/common";
import { Sidebar } from "./Sidebar/Sidebar";
const DefaultSidebarTrigger = withInternalFallback(
diff --git a/packages/excalidraw/components/DialogActionButton.tsx b/packages/excalidraw/components/DialogActionButton.tsx
index 17f202362d..0c4f9d5894 100644
--- a/packages/excalidraw/components/DialogActionButton.tsx
+++ b/packages/excalidraw/components/DialogActionButton.tsx
@@ -1,5 +1,5 @@
import clsx from "clsx";
-import { ReactNode } from "react";
+import type { ReactNode } from "react";
import "./DialogActionButton.scss";
import Spinner from "./Spinner";
diff --git a/packages/excalidraw/components/EyeDropper.tsx b/packages/excalidraw/components/EyeDropper.tsx
index 9cc3f90f7c..f076976627 100644
--- a/packages/excalidraw/components/EyeDropper.tsx
+++ b/packages/excalidraw/components/EyeDropper.tsx
@@ -12,8 +12,8 @@ import { useApp, useExcalidrawContainer, useExcalidrawElements } from "./App";
import { useStable } from "../hooks/useStable";
import "./EyeDropper.scss";
-import { ColorPickerType } from "./ColorPicker/colorPickerUtils";
-import { ExcalidrawElement } from "../element/types";
+import type { ColorPickerType } from "./ColorPicker/colorPickerUtils";
+import type { ExcalidrawElement } from "../element/types";
export type EyeDropperProperties = {
keepOpenOnAlt: boolean;
diff --git a/packages/excalidraw/components/FollowMode/FollowMode.tsx b/packages/excalidraw/components/FollowMode/FollowMode.tsx
index dc1746ca85..302f9d73e4 100644
--- a/packages/excalidraw/components/FollowMode/FollowMode.tsx
+++ b/packages/excalidraw/components/FollowMode/FollowMode.tsx
@@ -1,4 +1,4 @@
-import { UserToFollow } from "../../types";
+import type { UserToFollow } from "../../types";
import { CloseIcon } from "../icons";
import "./FollowMode.scss";
diff --git a/packages/excalidraw/components/HintViewer.tsx b/packages/excalidraw/components/HintViewer.tsx
index 908530efbe..160fcc180d 100644
--- a/packages/excalidraw/components/HintViewer.tsx
+++ b/packages/excalidraw/components/HintViewer.tsx
@@ -1,5 +1,5 @@
import { t } from "../i18n";
-import { AppClassProperties, Device, UIAppState } from "../types";
+import type { AppClassProperties, Device, UIAppState } from "../types";
import {
isImageElement,
isLinearElement,
diff --git a/packages/excalidraw/components/ImageExportDialog.tsx b/packages/excalidraw/components/ImageExportDialog.tsx
index 73c9a0def6..0c95d603ed 100644
--- a/packages/excalidraw/components/ImageExportDialog.tsx
+++ b/packages/excalidraw/components/ImageExportDialog.tsx
@@ -20,7 +20,7 @@ import {
import { canvasToBlob } from "../data/blob";
import { nativeFileSystemSupported } from "../data/filesystem";
-import { NonDeletedExcalidrawElement } from "../element/types";
+import type { NonDeletedExcalidrawElement } from "../element/types";
import { t } from "../i18n";
import { isSomeElementSelected } from "../scene";
import { exportToCanvas } from "../../utils/export";
diff --git a/packages/excalidraw/components/InitializeApp.tsx b/packages/excalidraw/components/InitializeApp.tsx
index af4961fa1d..41f90ceeba 100644
--- a/packages/excalidraw/components/InitializeApp.tsx
+++ b/packages/excalidraw/components/InitializeApp.tsx
@@ -1,8 +1,9 @@
import React, { useEffect, useState } from "react";
import { LoadingMessage } from "./LoadingMessage";
-import { defaultLang, Language, languages, setLanguage } from "../i18n";
-import { Theme } from "../element/types";
+import type { Language } from "../i18n";
+import { defaultLang, languages, setLanguage } from "../i18n";
+import type { Theme } from "../element/types";
interface Props {
langCode: Language["code"];
diff --git a/packages/excalidraw/components/JSONExportDialog.tsx b/packages/excalidraw/components/JSONExportDialog.tsx
index 95f4117fcb..527ad57463 100644
--- a/packages/excalidraw/components/JSONExportDialog.tsx
+++ b/packages/excalidraw/components/JSONExportDialog.tsx
@@ -1,8 +1,8 @@
import React from "react";
-import { NonDeletedExcalidrawElement } from "../element/types";
+import type { NonDeletedExcalidrawElement } from "../element/types";
import { t } from "../i18n";
-import { ExportOpts, BinaryFiles, UIAppState } from "../types";
+import type { ExportOpts, BinaryFiles, UIAppState } from "../types";
import { Dialog } from "./Dialog";
import { exportToFileIcon, LinkIcon } from "./icons";
import { ToolButton } from "./ToolButton";
@@ -12,7 +12,7 @@ import { Card } from "./Card";
import "./ExportDialog.scss";
import { nativeFileSystemSupported } from "../data/filesystem";
import { trackEvent } from "../analytics";
-import { ActionManager } from "../actions/manager";
+import type { ActionManager } from "../actions/manager";
import { getFrame } from "../utils";
export type ExportCB = (
diff --git a/packages/excalidraw/components/LaserPointerButton.tsx b/packages/excalidraw/components/LaserPointerButton.tsx
index ae3cfb31aa..35470f6e75 100644
--- a/packages/excalidraw/components/LaserPointerButton.tsx
+++ b/packages/excalidraw/components/LaserPointerButton.tsx
@@ -1,7 +1,7 @@
import "./ToolIcon.scss";
import clsx from "clsx";
-import { ToolButtonSize } from "./ToolButton";
+import type { ToolButtonSize } from "./ToolButton";
import { laserPointerToolIcon } from "./icons";
type LaserPointerIconProps = {
diff --git a/packages/excalidraw/components/LayerUI.tsx b/packages/excalidraw/components/LayerUI.tsx
index eb80271389..dd34f433bf 100644
--- a/packages/excalidraw/components/LayerUI.tsx
+++ b/packages/excalidraw/components/LayerUI.tsx
@@ -1,6 +1,6 @@
import clsx from "clsx";
import React from "react";
-import { ActionManager } from "../actions/manager";
+import type { ActionManager } from "../actions/manager";
import {
CLASSES,
DEFAULT_SIDEBAR,
@@ -8,10 +8,11 @@ import {
TOOL_TYPE,
} from "../constants";
import { showSelectedShapeActions } from "../element";
-import { NonDeletedExcalidrawElement } from "../element/types";
-import { Language, t } from "../i18n";
+import type { NonDeletedExcalidrawElement } from "../element/types";
+import type { Language } from "../i18n";
+import { t } from "../i18n";
import { calculateScrollCenter } from "../scene";
-import {
+import type {
AppProps,
AppState,
ExcalidrawProps,
diff --git a/packages/excalidraw/components/LibraryMenu.tsx b/packages/excalidraw/components/LibraryMenu.tsx
index 71e20ff337..6192c7e711 100644
--- a/packages/excalidraw/components/LibraryMenu.tsx
+++ b/packages/excalidraw/components/LibraryMenu.tsx
@@ -1,11 +1,12 @@
import React, { useState, useCallback, useMemo, useRef } from "react";
-import Library, {
+import type Library from "../data/library";
+import {
distributeLibraryItemsOnSquareGrid,
libraryItemsAtom,
} from "../data/library";
import { t } from "../i18n";
import { randomId } from "../random";
-import {
+import type {
LibraryItems,
LibraryItem,
ExcalidrawProps,
@@ -28,7 +29,7 @@ import { useUIAppState } from "../context/ui-appState";
import "./LibraryMenu.scss";
import { LibraryMenuControlButtons } from "./LibraryMenuControlButtons";
import { isShallowEqual } from "../utils";
-import { NonDeletedExcalidrawElement } from "../element/types";
+import type { NonDeletedExcalidrawElement } from "../element/types";
import { LIBRARY_DISABLED_TYPES } from "../constants";
export const isLibraryMenuOpenAtom = atom(false);
diff --git a/packages/excalidraw/components/LibraryMenuBrowseButton.tsx b/packages/excalidraw/components/LibraryMenuBrowseButton.tsx
index ab8fa03051..43fbedd77c 100644
--- a/packages/excalidraw/components/LibraryMenuBrowseButton.tsx
+++ b/packages/excalidraw/components/LibraryMenuBrowseButton.tsx
@@ -1,6 +1,6 @@
import { VERSIONS } from "../constants";
import { t } from "../i18n";
-import { ExcalidrawProps, UIAppState } from "../types";
+import type { ExcalidrawProps, UIAppState } from "../types";
const LibraryMenuBrowseButton = ({
theme,
diff --git a/packages/excalidraw/components/LibraryMenuControlButtons.tsx b/packages/excalidraw/components/LibraryMenuControlButtons.tsx
index 86ac1b635e..b467ca39cd 100644
--- a/packages/excalidraw/components/LibraryMenuControlButtons.tsx
+++ b/packages/excalidraw/components/LibraryMenuControlButtons.tsx
@@ -1,4 +1,4 @@
-import { ExcalidrawProps, UIAppState } from "../types";
+import type { ExcalidrawProps, UIAppState } from "../types";
import LibraryMenuBrowseButton from "./LibraryMenuBrowseButton";
import clsx from "clsx";
diff --git a/packages/excalidraw/components/LibraryMenuHeaderContent.tsx b/packages/excalidraw/components/LibraryMenuHeaderContent.tsx
index 56c8fe6d0c..e26507803d 100644
--- a/packages/excalidraw/components/LibraryMenuHeaderContent.tsx
+++ b/packages/excalidraw/components/LibraryMenuHeaderContent.tsx
@@ -2,10 +2,11 @@ import { useCallback, useState } from "react";
import { t } from "../i18n";
import Trans from "./Trans";
import { jotaiScope } from "../jotai";
-import { LibraryItem, LibraryItems, UIAppState } from "../types";
+import type { LibraryItem, LibraryItems, UIAppState } from "../types";
import { useApp, useExcalidrawSetAppState } from "./App";
import { saveLibraryAsJSON } from "../data/json";
-import Library, { libraryItemsAtom } from "../data/library";
+import type Library from "../data/library";
+import { libraryItemsAtom } from "../data/library";
import {
DotsIcon,
ExportIcon,
diff --git a/packages/excalidraw/components/LibraryMenuItems.tsx b/packages/excalidraw/components/LibraryMenuItems.tsx
index ff88e537ca..aa2c3e68e6 100644
--- a/packages/excalidraw/components/LibraryMenuItems.tsx
+++ b/packages/excalidraw/components/LibraryMenuItems.tsx
@@ -7,7 +7,7 @@ import React, {
} from "react";
import { serializeLibraryAsJSON } from "../data/json";
import { t } from "../i18n";
-import {
+import type {
ExcalidrawProps,
LibraryItem,
LibraryItems,
diff --git a/packages/excalidraw/components/LibraryMenuSection.tsx b/packages/excalidraw/components/LibraryMenuSection.tsx
index 0e10470fc9..b07d6b1ccd 100644
--- a/packages/excalidraw/components/LibraryMenuSection.tsx
+++ b/packages/excalidraw/components/LibraryMenuSection.tsx
@@ -1,8 +1,9 @@
-import React, { memo, ReactNode, useEffect, useState } from "react";
+import type { ReactNode } from "react";
+import React, { memo, useEffect, useState } from "react";
import { EmptyLibraryUnit, LibraryUnit } from "./LibraryUnit";
-import { LibraryItem } from "../types";
-import { ExcalidrawElement, NonDeleted } from "../element/types";
-import { SvgCache } from "../hooks/useLibraryItemSvg";
+import type { LibraryItem } from "../types";
+import type { ExcalidrawElement, NonDeleted } from "../element/types";
+import type { SvgCache } from "../hooks/useLibraryItemSvg";
import { useTransition } from "../hooks/useTransition";
type LibraryOrPendingItem = (
diff --git a/packages/excalidraw/components/LibraryUnit.tsx b/packages/excalidraw/components/LibraryUnit.tsx
index 42fb29149c..71e1a00f53 100644
--- a/packages/excalidraw/components/LibraryUnit.tsx
+++ b/packages/excalidraw/components/LibraryUnit.tsx
@@ -1,11 +1,12 @@
import clsx from "clsx";
import { memo, useEffect, useRef, useState } from "react";
import { useDevice } from "./App";
-import { LibraryItem } from "../types";
+import type { LibraryItem } from "../types";
import "./LibraryUnit.scss";
import { CheckboxItem } from "./CheckboxItem";
import { PlusIcon } from "./icons";
-import { SvgCache, useLibraryItemSvg } from "../hooks/useLibraryItemSvg";
+import type { SvgCache } from "../hooks/useLibraryItemSvg";
+import { useLibraryItemSvg } from "../hooks/useLibraryItemSvg";
export const LibraryUnit = memo(
({
diff --git a/packages/excalidraw/components/LoadingMessage.tsx b/packages/excalidraw/components/LoadingMessage.tsx
index 124396151e..b007252576 100644
--- a/packages/excalidraw/components/LoadingMessage.tsx
+++ b/packages/excalidraw/components/LoadingMessage.tsx
@@ -3,7 +3,7 @@ import { useState, useEffect } from "react";
import Spinner from "./Spinner";
import clsx from "clsx";
import { THEME } from "../constants";
-import { Theme } from "../element/types";
+import type { Theme } from "../element/types";
export const LoadingMessage: React.FC<{ delay?: number; theme?: Theme }> = ({
delay,
diff --git a/packages/excalidraw/components/LockButton.tsx b/packages/excalidraw/components/LockButton.tsx
index a039a57794..f7913d12d9 100644
--- a/packages/excalidraw/components/LockButton.tsx
+++ b/packages/excalidraw/components/LockButton.tsx
@@ -1,7 +1,7 @@
import "./ToolIcon.scss";
import clsx from "clsx";
-import { ToolButtonSize } from "./ToolButton";
+import type { ToolButtonSize } from "./ToolButton";
import { LockedIcon, UnlockedIcon } from "./icons";
type LockIconProps = {
diff --git a/packages/excalidraw/components/MagicButton.tsx b/packages/excalidraw/components/MagicButton.tsx
index b8aad5bfd6..2a7e834eb1 100644
--- a/packages/excalidraw/components/MagicButton.tsx
+++ b/packages/excalidraw/components/MagicButton.tsx
@@ -1,7 +1,7 @@
import "./ToolIcon.scss";
import clsx from "clsx";
-import { ToolButtonSize } from "./ToolButton";
+import type { ToolButtonSize } from "./ToolButton";
const DEFAULT_SIZE: ToolButtonSize = "small";
diff --git a/packages/excalidraw/components/MobileMenu.tsx b/packages/excalidraw/components/MobileMenu.tsx
index 98f85a9aca..a243e80279 100644
--- a/packages/excalidraw/components/MobileMenu.tsx
+++ b/packages/excalidraw/components/MobileMenu.tsx
@@ -1,5 +1,5 @@
import React from "react";
-import {
+import type {
AppClassProperties,
AppProps,
AppState,
@@ -7,11 +7,11 @@ import {
ExcalidrawProps,
UIAppState,
} from "../types";
-import { ActionManager } from "../actions/manager";
+import type { ActionManager } from "../actions/manager";
import { t } from "../i18n";
import Stack from "./Stack";
import { showSelectedShapeActions } from "../element";
-import { NonDeletedExcalidrawElement } from "../element/types";
+import type { NonDeletedExcalidrawElement } from "../element/types";
import { FixedSideContainer } from "./FixedSideContainer";
import { Island } from "./Island";
import { HintViewer } from "./HintViewer";
diff --git a/packages/excalidraw/components/Modal.tsx b/packages/excalidraw/components/Modal.tsx
index d27f41a22e..e8fff195b0 100644
--- a/packages/excalidraw/components/Modal.tsx
+++ b/packages/excalidraw/components/Modal.tsx
@@ -3,7 +3,7 @@ import "./Modal.scss";
import { createPortal } from "react-dom";
import clsx from "clsx";
import { KEYS } from "../keys";
-import { AppState } from "../types";
+import type { AppState } from "../types";
import { useCreatePortalContainer } from "../hooks/useCreatePortalContainer";
import { useRef } from "react";
diff --git a/packages/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.ts b/packages/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.ts
index 99060ccfd2..9236a588b0 100644
--- a/packages/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.ts
+++ b/packages/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.ts
@@ -1,6 +1,6 @@
import { atom } from "jotai";
import { jotaiStore } from "../../jotai";
-import React from "react";
+import type React from "react";
export type OverwriteConfirmState =
| {
diff --git a/packages/excalidraw/components/PasteChartDialog.tsx b/packages/excalidraw/components/PasteChartDialog.tsx
index 17cd7121e2..f1ee643e44 100644
--- a/packages/excalidraw/components/PasteChartDialog.tsx
+++ b/packages/excalidraw/components/PasteChartDialog.tsx
@@ -1,11 +1,12 @@
import oc from "open-color";
import React, { useLayoutEffect, useRef, useState } from "react";
import { trackEvent } from "../analytics";
-import { ChartElements, renderSpreadsheet, Spreadsheet } from "../charts";
-import { ChartType } from "../element/types";
+import type { ChartElements, Spreadsheet } from "../charts";
+import { renderSpreadsheet } from "../charts";
+import type { ChartType } from "../element/types";
import { t } from "../i18n";
import { exportToSvg } from "../scene/export";
-import { UIAppState } from "../types";
+import type { UIAppState } from "../types";
import { useApp } from "./App";
import { Dialog } from "./Dialog";
diff --git a/packages/excalidraw/components/PenModeButton.tsx b/packages/excalidraw/components/PenModeButton.tsx
index 7c61d18a2b..ca5ceb2b63 100644
--- a/packages/excalidraw/components/PenModeButton.tsx
+++ b/packages/excalidraw/components/PenModeButton.tsx
@@ -1,7 +1,7 @@
import "./ToolIcon.scss";
import clsx from "clsx";
-import { ToolButtonSize } from "./ToolButton";
+import type { ToolButtonSize } from "./ToolButton";
import { PenModeIcon } from "./icons";
type PenModeIconProps = {
diff --git a/packages/excalidraw/components/PublishLibrary.tsx b/packages/excalidraw/components/PublishLibrary.tsx
index 51e14febcc..d1cbe63d11 100644
--- a/packages/excalidraw/components/PublishLibrary.tsx
+++ b/packages/excalidraw/components/PublishLibrary.tsx
@@ -1,11 +1,12 @@
-import { ReactNode, useCallback, useEffect, useRef, useState } from "react";
+import type { ReactNode } from "react";
+import { useCallback, useEffect, useRef, useState } from "react";
import OpenColor from "open-color";
import { Dialog } from "./Dialog";
import { t } from "../i18n";
import Trans from "./Trans";
-import { LibraryItems, LibraryItem, UIAppState } from "../types";
+import type { LibraryItems, LibraryItem, UIAppState } from "../types";
import { exportToCanvas, exportToSvg } from "../../utils/export";
import {
EDITOR_LS_KEYS,
@@ -14,7 +15,7 @@ import {
MIME_TYPES,
VERSIONS,
} from "../constants";
-import { ExportedLibraryData } from "../data/types";
+import type { ExportedLibraryData } from "../data/types";
import { canvasToBlob, resizeImageFile } from "../data/blob";
import { chunk } from "../utils";
import DialogActionButton from "./DialogActionButton";
diff --git a/packages/excalidraw/components/SVGLayer.tsx b/packages/excalidraw/components/SVGLayer.tsx
index feaebaf94a..667b89ab7e 100644
--- a/packages/excalidraw/components/SVGLayer.tsx
+++ b/packages/excalidraw/components/SVGLayer.tsx
@@ -1,5 +1,5 @@
import { useEffect, useRef } from "react";
-import { Trail } from "../animated-trail";
+import type { Trail } from "../animated-trail";
import "./SVGLayer.scss";
diff --git a/packages/excalidraw/components/Sidebar/Sidebar.tsx b/packages/excalidraw/components/Sidebar/Sidebar.tsx
index ae75f570f1..efa6ccbe3d 100644
--- a/packages/excalidraw/components/Sidebar/Sidebar.tsx
+++ b/packages/excalidraw/components/Sidebar/Sidebar.tsx
@@ -10,11 +10,8 @@ import React, {
import { Island } from "../Island";
import { atom, useSetAtom } from "jotai";
import { jotaiScope } from "../../jotai";
-import {
- SidebarPropsContext,
- SidebarProps,
- SidebarPropsContextValue,
-} from "./common";
+import type { SidebarProps, SidebarPropsContextValue } from "./common";
+import { SidebarPropsContext } from "./common";
import { SidebarHeader } from "./SidebarHeader";
import clsx from "clsx";
import { useDevice, useExcalidrawSetAppState } from "../App";
diff --git a/packages/excalidraw/components/Sidebar/SidebarTab.tsx b/packages/excalidraw/components/Sidebar/SidebarTab.tsx
index f7eacc1b19..6fddab0d69 100644
--- a/packages/excalidraw/components/Sidebar/SidebarTab.tsx
+++ b/packages/excalidraw/components/Sidebar/SidebarTab.tsx
@@ -1,5 +1,5 @@
import * as RadixTabs from "@radix-ui/react-tabs";
-import { SidebarTabName } from "../../types";
+import type { SidebarTabName } from "../../types";
export const SidebarTab = ({
tab,
diff --git a/packages/excalidraw/components/Sidebar/SidebarTabTrigger.tsx b/packages/excalidraw/components/Sidebar/SidebarTabTrigger.tsx
index cf25f70249..8509ef23d9 100644
--- a/packages/excalidraw/components/Sidebar/SidebarTabTrigger.tsx
+++ b/packages/excalidraw/components/Sidebar/SidebarTabTrigger.tsx
@@ -1,5 +1,5 @@
import * as RadixTabs from "@radix-ui/react-tabs";
-import { SidebarTabName } from "../../types";
+import type { SidebarTabName } from "../../types";
export const SidebarTabTrigger = ({
children,
diff --git a/packages/excalidraw/components/Sidebar/SidebarTrigger.tsx b/packages/excalidraw/components/Sidebar/SidebarTrigger.tsx
index 889156eba6..a26e52d239 100644
--- a/packages/excalidraw/components/Sidebar/SidebarTrigger.tsx
+++ b/packages/excalidraw/components/Sidebar/SidebarTrigger.tsx
@@ -1,5 +1,5 @@
import { useExcalidrawSetAppState } from "../App";
-import { SidebarTriggerProps } from "./common";
+import type { SidebarTriggerProps } from "./common";
import { useUIAppState } from "../../context/ui-appState";
import clsx from "clsx";
diff --git a/packages/excalidraw/components/Sidebar/common.ts b/packages/excalidraw/components/Sidebar/common.ts
index c7161bd17d..05493d44be 100644
--- a/packages/excalidraw/components/Sidebar/common.ts
+++ b/packages/excalidraw/components/Sidebar/common.ts
@@ -1,5 +1,5 @@
import React from "react";
-import { AppState, SidebarName, SidebarTabName } from "../../types";
+import type { AppState, SidebarName, SidebarTabName } from "../../types";
export type SidebarTriggerProps = {
name: SidebarName;
diff --git a/packages/excalidraw/components/Stats.tsx b/packages/excalidraw/components/Stats.tsx
index eb2b93e7ed..a7326f3241 100644
--- a/packages/excalidraw/components/Stats.tsx
+++ b/packages/excalidraw/components/Stats.tsx
@@ -1,9 +1,9 @@
import React from "react";
import { getCommonBounds } from "../element/bounds";
-import { NonDeletedExcalidrawElement } from "../element/types";
+import type { NonDeletedExcalidrawElement } from "../element/types";
import { t } from "../i18n";
import { getTargetElements } from "../scene";
-import { ExcalidrawProps, UIAppState } from "../types";
+import type { ExcalidrawProps, UIAppState } from "../types";
import { CloseIcon } from "./icons";
import { Island } from "./Island";
import "./Stats.scss";
diff --git a/packages/excalidraw/components/TTDDialog/MermaidToExcalidraw.tsx b/packages/excalidraw/components/TTDDialog/MermaidToExcalidraw.tsx
index c6c8f1f1cc..83fb91d0ef 100644
--- a/packages/excalidraw/components/TTDDialog/MermaidToExcalidraw.tsx
+++ b/packages/excalidraw/components/TTDDialog/MermaidToExcalidraw.tsx
@@ -1,13 +1,13 @@
import { useState, useRef, useEffect, useDeferredValue } from "react";
-import { BinaryFiles } from "../../types";
+import type { BinaryFiles } from "../../types";
import { useApp } from "../App";
-import { NonDeletedExcalidrawElement } from "../../element/types";
+import type { NonDeletedExcalidrawElement } from "../../element/types";
import { ArrowRightIcon } from "../icons";
import "./MermaidToExcalidraw.scss";
import { t } from "../../i18n";
import Trans from "../Trans";
+import type { MermaidToExcalidrawLibProps } from "./common";
import {
- MermaidToExcalidrawLibProps,
convertMermaidToExcalidraw,
insertToEditor,
saveMermaidDataToStorage,
diff --git a/packages/excalidraw/components/TTDDialog/TTDDialog.tsx b/packages/excalidraw/components/TTDDialog/TTDDialog.tsx
index 1c9c4b28d2..d6192b295c 100644
--- a/packages/excalidraw/components/TTDDialog/TTDDialog.tsx
+++ b/packages/excalidraw/components/TTDDialog/TTDDialog.tsx
@@ -2,7 +2,8 @@ import { Dialog } from "../Dialog";
import { useApp, useExcalidrawSetAppState } from "../App";
import MermaidToExcalidraw from "./MermaidToExcalidraw";
import TTDDialogTabs from "./TTDDialogTabs";
-import { ChangeEventHandler, useEffect, useRef, useState } from "react";
+import type { ChangeEventHandler } from "react";
+import { useEffect, useRef, useState } from "react";
import { useUIAppState } from "../../context/ui-appState";
import { withInternalFallback } from "../hoc/withInternalFallback";
import { TTDDialogTabTriggers } from "./TTDDialogTabTriggers";
@@ -13,14 +14,14 @@ import { TTDDialogInput } from "./TTDDialogInput";
import { TTDDialogOutput } from "./TTDDialogOutput";
import { TTDDialogPanel } from "./TTDDialogPanel";
import { TTDDialogPanels } from "./TTDDialogPanels";
+import type { MermaidToExcalidrawLibProps } from "./common";
import {
- MermaidToExcalidrawLibProps,
convertMermaidToExcalidraw,
insertToEditor,
saveMermaidDataToStorage,
} from "./common";
-import { NonDeletedExcalidrawElement } from "../../element/types";
-import { BinaryFiles } from "../../types";
+import type { NonDeletedExcalidrawElement } from "../../element/types";
+import type { BinaryFiles } from "../../types";
import { ArrowRightIcon } from "../icons";
import "./TTDDialog.scss";
diff --git a/packages/excalidraw/components/TTDDialog/TTDDialogInput.tsx b/packages/excalidraw/components/TTDDialog/TTDDialogInput.tsx
index 8ac464f970..e11d0dc3f1 100644
--- a/packages/excalidraw/components/TTDDialog/TTDDialogInput.tsx
+++ b/packages/excalidraw/components/TTDDialog/TTDDialogInput.tsx
@@ -1,4 +1,5 @@
-import { ChangeEventHandler, useEffect, useRef } from "react";
+import type { ChangeEventHandler } from "react";
+import { useEffect, useRef } from "react";
import { EVENT } from "../../constants";
import { KEYS } from "../../keys";
diff --git a/packages/excalidraw/components/TTDDialog/TTDDialogPanel.tsx b/packages/excalidraw/components/TTDDialog/TTDDialogPanel.tsx
index 5c7fba6da9..0a78e4969d 100644
--- a/packages/excalidraw/components/TTDDialog/TTDDialogPanel.tsx
+++ b/packages/excalidraw/components/TTDDialog/TTDDialogPanel.tsx
@@ -1,4 +1,4 @@
-import { ReactNode } from "react";
+import type { ReactNode } from "react";
import { Button } from "../Button";
import clsx from "clsx";
import Spinner from "../Spinner";
diff --git a/packages/excalidraw/components/TTDDialog/TTDDialogPanels.tsx b/packages/excalidraw/components/TTDDialog/TTDDialogPanels.tsx
index 00e5734269..0e5e2b5bd5 100644
--- a/packages/excalidraw/components/TTDDialog/TTDDialogPanels.tsx
+++ b/packages/excalidraw/components/TTDDialog/TTDDialogPanels.tsx
@@ -1,4 +1,4 @@
-import { ReactNode } from "react";
+import type { ReactNode } from "react";
export const TTDDialogPanels = ({ children }: { children: ReactNode }) => {
return <div className="ttd-dialog-panels">{children}</div>;
diff --git a/packages/excalidraw/components/TTDDialog/TTDDialogTabs.tsx b/packages/excalidraw/components/TTDDialog/TTDDialogTabs.tsx
index 324f4e5345..30add91e59 100644
--- a/packages/excalidraw/components/TTDDialog/TTDDialogTabs.tsx
+++ b/packages/excalidraw/components/TTDDialog/TTDDialogTabs.tsx
@@ -1,5 +1,6 @@
import * as RadixTabs from "@radix-ui/react-tabs";
-import { ReactNode, useRef } from "react";
+import type { ReactNode } from "react";
+import { useRef } from "react";
import { useExcalidrawSetAppState } from "../App";
import { isMemberOf } from "../../utils";
diff --git a/packages/excalidraw/components/TTDDialog/TTDDialogTrigger.tsx b/packages/excalidraw/components/TTDDialog/TTDDialogTrigger.tsx
index 05bc303d9e..033fa8b6cf 100644
--- a/packages/excalidraw/components/TTDDialog/TTDDialogTrigger.tsx
+++ b/packages/excalidraw/components/TTDDialog/TTDDialogTrigger.tsx
@@ -1,4 +1,4 @@
-import { ReactNode } from "react";
+import type { ReactNode } from "react";
import { useTunnels } from "../../context/tunnels";
import DropdownMenu from "../dropdownMenu/DropdownMenu";
import { useExcalidrawSetAppState } from "../App";
diff --git a/packages/excalidraw/components/TTDDialog/common.ts b/packages/excalidraw/components/TTDDialog/common.ts
index 2389b841ea..07135afcfd 100644
--- a/packages/excalidraw/components/TTDDialog/common.ts
+++ b/packages/excalidraw/components/TTDDialog/common.ts
@@ -1,13 +1,13 @@
-import { MermaidOptions } from "@excalidraw/mermaid-to-excalidraw";
-import { MermaidToExcalidrawResult } from "@excalidraw/mermaid-to-excalidraw/dist/interfaces";
+import type { MermaidOptions } from "@excalidraw/mermaid-to-excalidraw";
+import type { MermaidToExcalidrawResult } from "@excalidraw/mermaid-to-excalidraw/dist/interfaces";
import {
DEFAULT_EXPORT_PADDING,
DEFAULT_FONT_SIZE,
EDITOR_LS_KEYS,
} from "../../constants";
import { convertToExcalidrawElements, exportToCanvas } from "../../index";
-import { NonDeletedExcalidrawElement } from "../../element/types";
-import { AppClassProperties, BinaryFiles } from "../../types";
+import type { NonDeletedExcalidrawElement } from "../../element/types";
+import type { AppClassProperties, BinaryFiles } from "../../types";
import { canvasToBlob } from "../../data/blob";
import { EditorLocalStorage } from "../../data/EditorLocalStorage";
import { t } from "../../i18n";
diff --git a/packages/excalidraw/components/TextField.tsx b/packages/excalidraw/components/TextField.tsx
index 44a7c25ff3..463ea2c2d4 100644
--- a/packages/excalidraw/components/TextField.tsx
+++ b/packages/excalidraw/components/TextField.tsx
@@ -1,8 +1,8 @@
+import type { KeyboardEvent } from "react";
import {
forwardRef,
useRef,
useImperativeHandle,
- KeyboardEvent,
useLayoutEffect,
useState,
} from "react";
diff --git a/packages/excalidraw/components/Toast.tsx b/packages/excalidraw/components/Toast.tsx
index 2f0852a5d1..d99c9f648d 100644
--- a/packages/excalidraw/components/Toast.tsx
+++ b/packages/excalidraw/components/Toast.tsx
@@ -1,4 +1,5 @@
-import { CSSProperties, useCallback, useEffect, useRef } from "react";
+import type { CSSProperties } from "react";
+import { useCallback, useEffect, useRef } from "react";
import { CloseIcon } from "./icons";
import "./Toast.scss";
import { ToolButton } from "./ToolButton";
diff --git a/packages/excalidraw/components/ToolButton.tsx b/packages/excalidraw/components/ToolButton.tsx
index e6d14ba08a..30014d4b14 100644
--- a/packages/excalidraw/components/ToolButton.tsx
+++ b/packages/excalidraw/components/ToolButton.tsx
@@ -1,11 +1,12 @@
import "./ToolIcon.scss";
-import React, { CSSProperties, useEffect, useRef, useState } from "react";
+import type { CSSProperties } from "react";
+import React, { useEffect, useRef, useState } from "react";
import clsx from "clsx";
import { useExcalidrawContainer } from "./App";
import { AbortError } from "../errors";
import Spinner from "./Spinner";
-import { PointerType } from "../element/types";
+import type { PointerType } from "../element/types";
import { isPromiseLike } from "../utils";
export type ToolButtonSize = "small" | "medium";
diff --git a/packages/excalidraw/components/Trans.test.tsx b/packages/excalidraw/components/Trans.test.tsx
index 0c67863514..df8ec526ea 100644
--- a/packages/excalidraw/components/Trans.test.tsx
+++ b/packages/excalidraw/components/Trans.test.tsx
@@ -3,7 +3,7 @@ import { render } from "@testing-library/react";
import fallbackLangData from "../locales/en.json";
import Trans from "./Trans";
-import { TranslationKeys } from "../i18n";
+import type { TranslationKeys } from "../i18n";
describe("Test <Trans/>", () => {
it("should translate the the strings correctly", () => {
diff --git a/packages/excalidraw/components/Trans.tsx b/packages/excalidraw/components/Trans.tsx
index f9318ca2bd..0cb0f78cb8 100644
--- a/packages/excalidraw/components/Trans.tsx
+++ b/packages/excalidraw/components/Trans.tsx
@@ -1,6 +1,7 @@
import React from "react";
-import { TranslationKeys, useI18n } from "../i18n";
+import type { TranslationKeys } from "../i18n";
+import { useI18n } from "../i18n";
// Used for splitting i18nKey into tokens in Trans component
// Example:
diff --git a/packages/excalidraw/components/UserList.tsx b/packages/excalidraw/components/UserList.tsx
index ced759333f..52ab73205a 100644
--- a/packages/excalidraw/components/UserList.tsx
+++ b/packages/excalidraw/components/UserList.tsx
@@ -2,10 +2,10 @@ import "./UserList.scss";
import React, { useLayoutEffect } from "react";
import clsx from "clsx";
-import { Collaborator, SocketId } from "../types";
+import type { Collaborator, SocketId } from "../types";
import { Tooltip } from "./Tooltip";
import { useExcalidrawActionManager } from "./App";
-import { ActionManager } from "../actions/manager";
+import type { ActionManager } from "../actions/manager";
import * as Popover from "@radix-ui/react-popover";
import { Island } from "./Island";
@@ -13,7 +13,7 @@ import { searchIcon } from "./icons";
import { t } from "../i18n";
import { isShallowEqual } from "../utils";
import { supportsResizeObserver } from "../constants";
-import { MarkRequired } from "../utility-types";
+import type { MarkRequired } from "../utility-types";
export type GoToCollaboratorComponentProps = {
socketId: SocketId;
diff --git a/packages/excalidraw/components/canvases/StaticCanvas.tsx b/packages/excalidraw/components/canvases/StaticCanvas.tsx
index f5cc3dfe59..ef54bf33f3 100644
--- a/packages/excalidraw/components/canvases/StaticCanvas.tsx
+++ b/packages/excalidraw/components/canvases/StaticCanvas.tsx
@@ -1,5 +1,5 @@
import React, { useEffect, useRef } from "react";
-import { RoughCanvas } from "roughjs/bin/canvas";
+import type { RoughCanvas } from "roughjs/bin/canvas";
import { renderStaticScene } from "../../renderer/staticScene";
import { isShallowEqual } from "../../utils";
import type { AppState, StaticCanvasAppState } from "../../types";
diff --git a/packages/excalidraw/components/footer/Footer.tsx b/packages/excalidraw/components/footer/Footer.tsx
index 85844aad6d..ccbe9eaee7 100644
--- a/packages/excalidraw/components/footer/Footer.tsx
+++ b/packages/excalidraw/components/footer/Footer.tsx
@@ -1,6 +1,6 @@
import clsx from "clsx";
import { actionShortcuts } from "../../actions";
-import { ActionManager } from "../../actions/manager";
+import type { ActionManager } from "../../actions/manager";
import {
ExitZenModeAction,
FinalizeAction,
@@ -12,7 +12,7 @@ import { useTunnels } from "../../context/tunnels";
import { HelpButton } from "../HelpButton";
import { Section } from "../Section";
import Stack from "../Stack";
-import { UIAppState } from "../../types";
+import type { UIAppState } from "../../types";
const Footer = ({
appState,
diff --git a/packages/excalidraw/components/hyperlink/Hyperlink.tsx b/packages/excalidraw/components/hyperlink/Hyperlink.tsx
index 932673ff15..9ee2239a88 100644
--- a/packages/excalidraw/components/hyperlink/Hyperlink.tsx
+++ b/packages/excalidraw/components/hyperlink/Hyperlink.tsx
@@ -1,4 +1,4 @@
-import { AppState, ExcalidrawProps, Point, UIAppState } from "../../types";
+import type { AppState, ExcalidrawProps, Point, UIAppState } from "../../types";
import {
sceneCoordsToViewportCoords,
viewportCoordsToSceneCoords,
@@ -6,7 +6,7 @@ import {
} from "../../utils";
import { getEmbedLink, embeddableURLValidator } from "../../element/embeddable";
import { mutateElement } from "../../element/mutateElement";
-import {
+import type {
ElementsMap,
ExcalidrawEmbeddableElement,
NonDeletedExcalidrawElement,
diff --git a/packages/excalidraw/components/hyperlink/helpers.ts b/packages/excalidraw/components/hyperlink/helpers.ts
index 92b8e3cd4f..88dc916ef5 100644
--- a/packages/excalidraw/components/hyperlink/helpers.ts
+++ b/packages/excalidraw/components/hyperlink/helpers.ts
@@ -1,10 +1,14 @@
import { MIME_TYPES } from "../../constants";
-import { Bounds, getElementAbsoluteCoords } from "../../element/bounds";
+import type { Bounds } from "../../element/bounds";
+import { getElementAbsoluteCoords } from "../../element/bounds";
import { hitElementBoundingBox } from "../../element/collision";
-import { ElementsMap, NonDeletedExcalidrawElement } from "../../element/types";
+import type {
+ ElementsMap,
+ NonDeletedExcalidrawElement,
+} from "../../element/types";
import { rotate } from "../../math";
import { DEFAULT_LINK_SIZE } from "../../renderer/renderElement";
-import { AppState, Point, UIAppState } from "../../types";
+import type { AppState, Point, UIAppState } from "../../types";
export const EXTERNAL_LINK_IMG = document.createElement("img");
EXTERNAL_LINK_IMG.src = `data:${MIME_TYPES.svg}, ${encodeURIComponent(
diff --git a/packages/excalidraw/components/icons.tsx b/packages/excalidraw/components/icons.tsx
index 3f9af9d08a..5b19a74a49 100644
--- a/packages/excalidraw/components/icons.tsx
+++ b/packages/excalidraw/components/icons.tsx
@@ -10,7 +10,7 @@ import React from "react";
import oc from "open-color";
import clsx from "clsx";
-import { Theme } from "../element/types";
+import type { Theme } from "../element/types";
import { THEME } from "../constants";
export const iconFillColor = (theme: Theme) => "var(--icon-fill-color)";
diff --git a/packages/excalidraw/constants.ts b/packages/excalidraw/constants.ts
index 1ef1d5e097..2af6ffa122 100644
--- a/packages/excalidraw/constants.ts
+++ b/packages/excalidraw/constants.ts
@@ -1,6 +1,6 @@
import cssVariables from "./css/variables.module.scss";
-import { AppProps } from "./types";
-import { ExcalidrawElement, FontFamilyValues } from "./element/types";
+import type { AppProps } from "./types";
+import type { ExcalidrawElement, FontFamilyValues } from "./element/types";
import { COLOR_PALETTE } from "./colors";
export const isDarwin = /Mac|iPod|iPhone|iPad/.test(navigator.platform);
export const isWindows = /^Win/.test(navigator.platform);
diff --git a/packages/excalidraw/context/ui-appState.ts b/packages/excalidraw/context/ui-appState.ts
index d276f18c8d..f94ce28c36 100644
--- a/packages/excalidraw/context/ui-appState.ts
+++ b/packages/excalidraw/context/ui-appState.ts
@@ -1,5 +1,5 @@
import React from "react";
-import { UIAppState } from "../types";
+import type { UIAppState } from "../types";
export const UIAppStateContext = React.createContext<UIAppState>(null!);
export const useUIAppState = () => React.useContext(UIAppStateContext);
diff --git a/packages/excalidraw/cursor.ts b/packages/excalidraw/cursor.ts
index 0d5fd2c3cd..759b7a4aec 100644
--- a/packages/excalidraw/cursor.ts
+++ b/packages/excalidraw/cursor.ts
@@ -1,6 +1,6 @@
import { CURSOR_TYPE, MIME_TYPES, THEME } from "./constants";
import OpenColor from "open-color";
-import { AppState, DataURL } from "./types";
+import type { AppState, DataURL } from "./types";
import { isHandToolActive, isEraserActive } from "./appState";
const laserPointerCursorSVG_tag = `<svg viewBox="0 0 24 24" stroke-width="1" width="28" height="28" xmlns="http://www.w3.org/2000/svg">`;
diff --git a/packages/excalidraw/data/EditorLocalStorage.ts b/packages/excalidraw/data/EditorLocalStorage.ts
index b149d5406c..bb6eeb478a 100644
--- a/packages/excalidraw/data/EditorLocalStorage.ts
+++ b/packages/excalidraw/data/EditorLocalStorage.ts
@@ -1,5 +1,5 @@
-import { EDITOR_LS_KEYS } from "../constants";
-import { JSONValue } from "../types";
+import type { EDITOR_LS_KEYS } from "../constants";
+import type { JSONValue } from "../types";
export class EditorLocalStorage {
static has(key: typeof EDITOR_LS_KEYS[keyof typeof EDITOR_LS_KEYS]) {
diff --git a/packages/excalidraw/data/blob.ts b/packages/excalidraw/data/blob.ts
index 527f1c0ea8..1eb1e1bedc 100644
--- a/packages/excalidraw/data/blob.ts
+++ b/packages/excalidraw/data/blob.ts
@@ -2,16 +2,17 @@ import { nanoid } from "nanoid";
import { cleanAppStateForExport } from "../appState";
import { IMAGE_MIME_TYPES, MIME_TYPES } from "../constants";
import { clearElementsForExport } from "../element";
-import { ExcalidrawElement, FileId } from "../element/types";
+import type { ExcalidrawElement, FileId } from "../element/types";
import { CanvasError, ImageSceneDataError } from "../errors";
import { calculateScrollCenter } from "../scene";
-import { AppState, DataURL, LibraryItem } from "../types";
-import { ValueOf } from "../utility-types";
+import type { AppState, DataURL, LibraryItem } from "../types";
+import type { ValueOf } from "../utility-types";
import { bytesToHexString, isPromiseLike } from "../utils";
-import { FileSystemHandle, nativeFileSystemSupported } from "./filesystem";
+import type { FileSystemHandle } from "./filesystem";
+import { nativeFileSystemSupported } from "./filesystem";
import { isValidExcalidrawData, isValidLibrary } from "./json";
import { restore, restoreLibraryItems } from "./restore";
-import { ImportedLibraryData } from "./types";
+import type { ImportedLibraryData } from "./types";
const parseFileContents = async (blob: Blob | File) => {
let contents: string;
diff --git a/packages/excalidraw/data/filesystem.ts b/packages/excalidraw/data/filesystem.ts
index 11f64d23e5..89a18c299b 100644
--- a/packages/excalidraw/data/filesystem.ts
+++ b/packages/excalidraw/data/filesystem.ts
@@ -1,7 +1,7 @@
+import type { FileSystemHandle } from "browser-fs-access";
import {
fileOpen as _fileOpen,
fileSave as _fileSave,
- FileSystemHandle,
supported as nativeFileSystemSupported,
} from "browser-fs-access";
import { EVENT, MIME_TYPES } from "../constants";
diff --git a/packages/excalidraw/data/index.ts b/packages/excalidraw/data/index.ts
index 3d0555e107..9aae145358 100644
--- a/packages/excalidraw/data/index.ts
+++ b/packages/excalidraw/data/index.ts
@@ -10,7 +10,7 @@ import {
} from "../constants";
import { getNonDeletedElements } from "../element";
import { isFrameLikeElement } from "../element/typeChecks";
-import {
+import type {
ExcalidrawElement,
ExcalidrawFrameLikeElement,
NonDeletedExcalidrawElement,
@@ -18,11 +18,12 @@ import {
import { t } from "../i18n";
import { isSomeElementSelected, getSelectedElements } from "../scene";
import { exportToCanvas, exportToSvg } from "../scene/export";
-import { ExportType } from "../scene/types";
-import { AppState, BinaryFiles } from "../types";
+import type { ExportType } from "../scene/types";
+import type { AppState, BinaryFiles } from "../types";
import { cloneJSON } from "../utils";
import { canvasToBlob } from "./blob";
-import { fileSave, FileSystemHandle } from "./filesystem";
+import type { FileSystemHandle } from "./filesystem";
+import { fileSave } from "./filesystem";
import { serializeAsJSON } from "./json";
import { getElementsOverlappingFrame } from "../frame";
diff --git a/packages/excalidraw/data/json.ts b/packages/excalidraw/data/json.ts
index 94dddf2888..1270fd1b46 100644
--- a/packages/excalidraw/data/json.ts
+++ b/packages/excalidraw/data/json.ts
@@ -8,11 +8,11 @@ import {
VERSIONS,
} from "../constants";
import { clearElementsForDatabase, clearElementsForExport } from "../element";
-import { ExcalidrawElement } from "../element/types";
-import { AppState, BinaryFiles, LibraryItems } from "../types";
+import type { ExcalidrawElement } from "../element/types";
+import type { AppState, BinaryFiles, LibraryItems } from "../types";
import { isImageFileHandle, loadFromBlob, normalizeFile } from "./blob";
-import {
+import type {
ExportedDataState,
ImportedDataState,
ExportedLibraryData,
diff --git a/packages/excalidraw/data/library.ts b/packages/excalidraw/data/library.ts
index 5e1af6c226..fe5eb8a557 100644
--- a/packages/excalidraw/data/library.ts
+++ b/packages/excalidraw/data/library.ts
@@ -1,5 +1,5 @@
import { loadLibraryFromBlob } from "./blob";
-import {
+import type {
LibraryItems,
LibraryItem,
ExcalidrawImperativeAPI,
@@ -10,7 +10,7 @@ import { restoreLibraryItems } from "./restore";
import type App from "../components/App";
import { atom } from "jotai";
import { jotaiStore } from "../jotai";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
import { getCommonBoundingBox } from "../element/bounds";
import { AbortError } from "../errors";
import { t } from "../i18n";
@@ -31,7 +31,7 @@ import {
promiseTry,
resolvablePromise,
} from "../utils";
-import { MaybePromise } from "../utility-types";
+import type { MaybePromise } from "../utility-types";
import { Emitter } from "../emitter";
import { Queue } from "../queue";
import { hashElementsVersion, hashString } from "../element";
diff --git a/packages/excalidraw/data/magic.ts b/packages/excalidraw/data/magic.ts
index 024e2b116a..883a3bdb90 100644
--- a/packages/excalidraw/data/magic.ts
+++ b/packages/excalidraw/data/magic.ts
@@ -1,7 +1,7 @@
import { THEME } from "../constants";
-import { Theme } from "../element/types";
-import { DataURL } from "../types";
-import { OpenAIInput, OpenAIOutput } from "./ai/types";
+import type { Theme } from "../element/types";
+import type { DataURL } from "../types";
+import type { OpenAIInput, OpenAIOutput } from "./ai/types";
export type MagicCacheData =
| {
diff --git a/packages/excalidraw/data/reconcile.ts b/packages/excalidraw/data/reconcile.ts
index 221dd04607..ea32c81623 100644
--- a/packages/excalidraw/data/reconcile.ts
+++ b/packages/excalidraw/data/reconcile.ts
@@ -1,7 +1,7 @@
-import { OrderedExcalidrawElement } from "../element/types";
+import type { OrderedExcalidrawElement } from "../element/types";
import { orderByFractionalIndex, syncInvalidIndices } from "../fractionalIndex";
-import { AppState } from "../types";
-import { MakeBrand } from "../utility-types";
+import type { AppState } from "../types";
+import type { MakeBrand } from "../utility-types";
import { arrayToMap } from "../utils";
export type ReconciledExcalidrawElement = OrderedExcalidrawElement &
diff --git a/packages/excalidraw/data/resave.ts b/packages/excalidraw/data/resave.ts
index c73890e229..624918425e 100644
--- a/packages/excalidraw/data/resave.ts
+++ b/packages/excalidraw/data/resave.ts
@@ -1,5 +1,5 @@
-import { ExcalidrawElement } from "../element/types";
-import { AppState, BinaryFiles } from "../types";
+import type { ExcalidrawElement } from "../element/types";
+import type { AppState, BinaryFiles } from "../types";
import { exportCanvas, prepareElementsForExport } from ".";
import { getFileHandleType, isImageFileHandleType } from "./blob";
diff --git a/packages/excalidraw/data/restore.ts b/packages/excalidraw/data/restore.ts
index b288cdf693..e935931554 100644
--- a/packages/excalidraw/data/restore.ts
+++ b/packages/excalidraw/data/restore.ts
@@ -1,4 +1,4 @@
-import {
+import type {
ExcalidrawElement,
ExcalidrawElementType,
ExcalidrawSelectionElement,
@@ -8,13 +8,13 @@ import {
PointBinding,
StrokeRoundness,
} from "../element/types";
-import {
+import type {
AppState,
BinaryFiles,
LibraryItem,
NormalizedZoomValue,
} from "../types";
-import { ImportedDataState, LegacyAppState } from "./types";
+import type { ImportedDataState, LegacyAppState } from "./types";
import {
getNonDeletedElements,
getNormalizedDimensions,
@@ -37,7 +37,7 @@ import { LinearElementEditor } from "../element/linearElementEditor";
import { bumpVersion } from "../element/mutateElement";
import { getUpdatedTimestamp, updateActiveTool } from "../utils";
import { arrayToMap } from "../utils";
-import { MarkOptional, Mutable } from "../utility-types";
+import type { MarkOptional, Mutable } from "../utility-types";
import {
detectLineHeight,
getContainerElement,
diff --git a/packages/excalidraw/data/transform.test.ts b/packages/excalidraw/data/transform.test.ts
index 4d58fbac62..c7b03ca8aa 100644
--- a/packages/excalidraw/data/transform.test.ts
+++ b/packages/excalidraw/data/transform.test.ts
@@ -1,9 +1,7 @@
import { vi } from "vitest";
-import {
- ExcalidrawElementSkeleton,
- convertToExcalidrawElements,
-} from "./transform";
-import { ExcalidrawArrowElement } from "../element/types";
+import type { ExcalidrawElementSkeleton } from "./transform";
+import { convertToExcalidrawElements } from "./transform";
+import type { ExcalidrawArrowElement } from "../element/types";
const opts = { regenerateIds: false };
diff --git a/packages/excalidraw/data/transform.ts b/packages/excalidraw/data/transform.ts
index 79f9af9628..e93f58502a 100644
--- a/packages/excalidraw/data/transform.ts
+++ b/packages/excalidraw/data/transform.ts
@@ -11,8 +11,8 @@ import {
redrawTextBoundingBox,
} from "../element";
import { bindLinearElement } from "../element/binding";
+import type { ElementConstructorOpts } from "../element/newElement";
import {
- ElementConstructorOpts,
newFrameElement,
newImageElement,
newMagicFrameElement,
@@ -23,7 +23,7 @@ import {
measureText,
normalizeText,
} from "../element/textElement";
-import {
+import type {
ElementsMap,
ExcalidrawArrowElement,
ExcalidrawBindableElement,
@@ -43,7 +43,7 @@ import {
TextAlign,
VerticalAlign,
} from "../element/types";
-import { MarkOptional } from "../utility-types";
+import type { MarkOptional } from "../utility-types";
import {
arrayToMap,
assertNever,
diff --git a/packages/excalidraw/data/types.ts b/packages/excalidraw/data/types.ts
index 69112b6b6c..f5f5535a5e 100644
--- a/packages/excalidraw/data/types.ts
+++ b/packages/excalidraw/data/types.ts
@@ -1,12 +1,12 @@
-import { ExcalidrawElement } from "../element/types";
-import {
+import type { ExcalidrawElement } from "../element/types";
+import type {
AppState,
BinaryFiles,
LibraryItems,
LibraryItems_anyVersion,
} from "../types";
import type { cleanAppStateForExport } from "../appState";
-import { VERSIONS } from "../constants";
+import type { VERSIONS } from "../constants";
export interface ExportedDataState {
type: string;
diff --git a/packages/excalidraw/element/ElementCanvasButtons.tsx b/packages/excalidraw/element/ElementCanvasButtons.tsx
index 0fc7621fda..cc42dd1bab 100644
--- a/packages/excalidraw/element/ElementCanvasButtons.tsx
+++ b/packages/excalidraw/element/ElementCanvasButtons.tsx
@@ -1,6 +1,6 @@
-import { AppState } from "../types";
+import type { AppState } from "../types";
import { sceneCoordsToViewportCoords } from "../utils";
-import { ElementsMap, NonDeletedExcalidrawElement } from "./types";
+import type { ElementsMap, NonDeletedExcalidrawElement } from "./types";
import { getElementAbsoluteCoords } from ".";
import { useExcalidrawAppState } from "../components/App";
diff --git a/packages/excalidraw/element/binding.ts b/packages/excalidraw/element/binding.ts
index a2ecc16786..6b14051295 100644
--- a/packages/excalidraw/element/binding.ts
+++ b/packages/excalidraw/element/binding.ts
@@ -4,7 +4,7 @@ import * as GADirection from "../gadirections";
import * as GALine from "../galines";
import * as GATransform from "../gatransforms";
-import {
+import type {
ExcalidrawBindableElement,
ExcalidrawElement,
ExcalidrawRectangleElement,
@@ -25,7 +25,7 @@ import {
} from "./types";
import { getElementAbsoluteCoords } from "./bounds";
-import { AppClassProperties, AppState, Point } from "../types";
+import type { AppClassProperties, AppState, Point } from "../types";
import { isPointOnShape } from "../../utils/collision";
import { getElementAtPosition } from "../scene";
import {
@@ -36,7 +36,8 @@ import {
isLinearElement,
isTextElement,
} from "./typeChecks";
-import { ElementUpdate, mutateElement } from "./mutateElement";
+import type { ElementUpdate } from "./mutateElement";
+import { mutateElement } from "./mutateElement";
import Scene from "../scene/Scene";
import { LinearElementEditor } from "./linearElementEditor";
import { arrayToMap, tupleToCoors } from "../utils";
diff --git a/packages/excalidraw/element/bounds.test.ts b/packages/excalidraw/element/bounds.test.ts
index e495343f76..3d9a4840d4 100644
--- a/packages/excalidraw/element/bounds.test.ts
+++ b/packages/excalidraw/element/bounds.test.ts
@@ -1,7 +1,7 @@
import { ROUNDNESS } from "../constants";
import { arrayToMap } from "../utils";
import { getElementAbsoluteCoords, getElementBounds } from "./bounds";
-import { ExcalidrawElement, ExcalidrawLinearElement } from "./types";
+import type { ExcalidrawElement, ExcalidrawLinearElement } from "./types";
const _ce = ({
x,
diff --git a/packages/excalidraw/element/bounds.ts b/packages/excalidraw/element/bounds.ts
index 6d98087bae..bd633680df 100644
--- a/packages/excalidraw/element/bounds.ts
+++ b/packages/excalidraw/element/bounds.ts
@@ -1,4 +1,4 @@
-import {
+import type {
ExcalidrawElement,
ExcalidrawLinearElement,
Arrowhead,
@@ -9,8 +9,8 @@ import {
} from "./types";
import { distance2d, rotate, rotatePoint } from "../math";
import rough from "roughjs/bin/rough";
-import { Drawable, Op } from "roughjs/bin/core";
-import { AppState, Point } from "../types";
+import type { Drawable, Op } from "roughjs/bin/core";
+import type { AppState, Point } from "../types";
import { generateRoughOptions } from "../scene/Shape";
import {
isArrowElement,
@@ -22,7 +22,7 @@ import {
import { rescalePoints } from "../points";
import { getBoundTextElement, getContainerElement } from "./textElement";
import { LinearElementEditor } from "./linearElementEditor";
-import { Mutable } from "../utility-types";
+import type { Mutable } from "../utility-types";
import { ShapeCache } from "../scene/ShapeCache";
import { arrayToMap } from "../utils";
diff --git a/packages/excalidraw/element/collision.ts b/packages/excalidraw/element/collision.ts
index 51769a8b0a..704c245564 100644
--- a/packages/excalidraw/element/collision.ts
+++ b/packages/excalidraw/element/collision.ts
@@ -1,18 +1,15 @@
import { isPathALoop, isPointWithinBounds } from "../math";
-import {
+import type {
ElementsMap,
ExcalidrawElement,
ExcalidrawRectangleElement,
} from "./types";
import { getElementBounds } from "./bounds";
-import { FrameNameBounds } from "../types";
-import {
- Polygon,
- GeometricShape,
- getPolygonShape,
-} from "../../utils/geometry/shape";
+import type { FrameNameBounds } from "../types";
+import type { Polygon, GeometricShape } from "../../utils/geometry/shape";
+import { getPolygonShape } from "../../utils/geometry/shape";
import { isPointInShape, isPointOnShape } from "../../utils/collision";
import { isTransparent } from "../utils";
import {
diff --git a/packages/excalidraw/element/containerCache.ts b/packages/excalidraw/element/containerCache.ts
index c744f6c8e5..432cd4e318 100644
--- a/packages/excalidraw/element/containerCache.ts
+++ b/packages/excalidraw/element/containerCache.ts
@@ -1,4 +1,4 @@
-import { ExcalidrawTextContainer } from "./types";
+import type { ExcalidrawTextContainer } from "./types";
export const originalContainerCache: {
[id: ExcalidrawTextContainer["id"]]:
diff --git a/packages/excalidraw/element/dragElements.ts b/packages/excalidraw/element/dragElements.ts
index 5121f52bd5..b109528631 100644
--- a/packages/excalidraw/element/dragElements.ts
+++ b/packages/excalidraw/element/dragElements.ts
@@ -1,12 +1,13 @@
import { updateBoundElements } from "./binding";
-import { Bounds, getCommonBounds } from "./bounds";
+import type { Bounds } from "./bounds";
+import { getCommonBounds } from "./bounds";
import { mutateElement } from "./mutateElement";
import { getPerfectElementSize } from "./sizeHelpers";
-import { NonDeletedExcalidrawElement } from "./types";
-import { AppState, PointerDownState } from "../types";
+import type { NonDeletedExcalidrawElement } from "./types";
+import type { AppState, PointerDownState } from "../types";
import { getBoundTextElement } from "./textElement";
import { getGridPoint } from "../math";
-import Scene from "../scene/Scene";
+import type Scene from "../scene/Scene";
import { isArrowElement, isFrameLikeElement } from "./typeChecks";
export const dragSelectedElements = (
diff --git a/packages/excalidraw/element/embeddable.ts b/packages/excalidraw/element/embeddable.ts
index df9128165f..e262c79337 100644
--- a/packages/excalidraw/element/embeddable.ts
+++ b/packages/excalidraw/element/embeddable.ts
@@ -1,18 +1,18 @@
import { register } from "../actions/register";
import { FONT_FAMILY, VERTICAL_ALIGN } from "../constants";
-import { ExcalidrawProps } from "../types";
+import type { ExcalidrawProps } from "../types";
import { getFontString, updateActiveTool } from "../utils";
import { setCursorForShape } from "../cursor";
import { newTextElement } from "./newElement";
import { wrapText } from "./textElement";
import { isIframeElement } from "./typeChecks";
-import {
+import type {
ExcalidrawElement,
ExcalidrawIframeLikeElement,
IframeData,
} from "./types";
import { sanitizeHTMLAttribute } from "../data/url";
-import { MarkRequired } from "../utility-types";
+import type { MarkRequired } from "../utility-types";
import { StoreAction } from "../store";
type IframeDataWithSandbox = MarkRequired<IframeData, "sandbox">;
diff --git a/packages/excalidraw/element/image.ts b/packages/excalidraw/element/image.ts
index ad94c51e03..33c585269c 100644
--- a/packages/excalidraw/element/image.ts
+++ b/packages/excalidraw/element/image.ts
@@ -3,9 +3,9 @@
// -----------------------------------------------------------------------------
import { MIME_TYPES, SVG_NS } from "../constants";
-import { AppClassProperties, DataURL, BinaryFiles } from "../types";
+import type { AppClassProperties, DataURL, BinaryFiles } from "../types";
import { isInitializedImageElement } from "./typeChecks";
-import {
+import type {
ExcalidrawElement,
FileId,
InitializedExcalidrawImageElement,
diff --git a/packages/excalidraw/element/index.ts b/packages/excalidraw/element/index.ts
index e7d699dae3..b9c203a369 100644
--- a/packages/excalidraw/element/index.ts
+++ b/packages/excalidraw/element/index.ts
@@ -1,4 +1,4 @@
-import {
+import type {
ExcalidrawElement,
NonDeletedExcalidrawElement,
NonDeleted,
diff --git a/packages/excalidraw/element/linearElementEditor.ts b/packages/excalidraw/element/linearElementEditor.ts
index d6bdc53e0f..48b33d150b 100644
--- a/packages/excalidraw/element/linearElementEditor.ts
+++ b/packages/excalidraw/element/linearElementEditor.ts
@@ -1,4 +1,4 @@
-import {
+import type {
NonDeleted,
ExcalidrawLinearElement,
ExcalidrawElement,
@@ -22,13 +22,13 @@ import {
arePointsEqual,
} from "../math";
import { getElementAbsoluteCoords, getLockedLinearCursorAlignSize } from ".";
+import type { Bounds } from "./bounds";
import {
- Bounds,
getCurvePathOps,
getElementPointsCoords,
getMinMaxXYFromCurvePathOps,
} from "./bounds";
-import {
+import type {
Point,
AppState,
PointerCoords,
@@ -47,9 +47,9 @@ import { isBindingElement } from "./typeChecks";
import { KEYS, shouldRotateWithDiscreteAngle } from "../keys";
import { getBoundTextElement, handleBindTextResize } from "./textElement";
import { DRAGGING_THRESHOLD } from "../constants";
-import { Mutable } from "../utility-types";
+import type { Mutable } from "../utility-types";
import { ShapeCache } from "../scene/ShapeCache";
-import { Store } from "../store";
+import type { Store } from "../store";
const editorMidPointsCache: {
version: number | null;
diff --git a/packages/excalidraw/element/mutateElement.ts b/packages/excalidraw/element/mutateElement.ts
index a44f5e74a1..6bff903846 100644
--- a/packages/excalidraw/element/mutateElement.ts
+++ b/packages/excalidraw/element/mutateElement.ts
@@ -1,10 +1,10 @@
-import { ExcalidrawElement } from "./types";
+import type { ExcalidrawElement } from "./types";
import Scene from "../scene/Scene";
import { getSizeFromPoints } from "../points";
import { randomInteger } from "../random";
-import { Point } from "../types";
+import type { Point } from "../types";
import { getUpdatedTimestamp } from "../utils";
-import { Mutable } from "../utility-types";
+import type { Mutable } from "../utility-types";
import { ShapeCache } from "../scene/ShapeCache";
export type ElementUpdate<TElement extends ExcalidrawElement> = Omit<
diff --git a/packages/excalidraw/element/newElement.test.ts b/packages/excalidraw/element/newElement.test.ts
index 19761231bd..3aa5a6ba31 100644
--- a/packages/excalidraw/element/newElement.test.ts
+++ b/packages/excalidraw/element/newElement.test.ts
@@ -3,7 +3,7 @@ import { mutateElement } from "./mutateElement";
import { API } from "../tests/helpers/api";
import { FONT_FAMILY, ROUNDNESS } from "../constants";
import { isPrimitive } from "../utils";
-import { ExcalidrawLinearElement } from "./types";
+import type { ExcalidrawLinearElement } from "./types";
const assertCloneObjects = (source: any, clone: any) => {
for (const key in clone) {
diff --git a/packages/excalidraw/element/newElement.ts b/packages/excalidraw/element/newElement.ts
index 34dec0adb3..bdee048e8c 100644
--- a/packages/excalidraw/element/newElement.ts
+++ b/packages/excalidraw/element/newElement.ts
@@ -1,4 +1,4 @@
-import {
+import type {
ExcalidrawElement,
ExcalidrawImageElement,
ExcalidrawTextElement,
@@ -27,7 +27,7 @@ import {
import { randomInteger, randomId } from "../random";
import { bumpVersion, newElementWith } from "./mutateElement";
import { getNewGroupIdsForDuplication } from "../groups";
-import { AppState } from "../types";
+import type { AppState } from "../types";
import { getElementAbsoluteCoords } from ".";
import { adjustXYWithRotation } from "../math";
import { getResizedElementAbsoluteCoords } from "./bounds";
@@ -46,7 +46,7 @@ import {
DEFAULT_VERTICAL_ALIGN,
VERTICAL_ALIGN,
} from "../constants";
-import { MarkOptional, Merge, Mutable } from "../utility-types";
+import type { MarkOptional, Merge, Mutable } from "../utility-types";
export type ElementConstructorOpts = MarkOptional<
Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">,
diff --git a/packages/excalidraw/element/resizeElements.ts b/packages/excalidraw/element/resizeElements.ts
index 4601223f24..db2f496251 100644
--- a/packages/excalidraw/element/resizeElements.ts
+++ b/packages/excalidraw/element/resizeElements.ts
@@ -2,7 +2,7 @@ import { MIN_FONT_SIZE, SHIFT_LOCKING_ANGLE } from "../constants";
import { rescalePoints } from "../points";
import { rotate, centerPoint, rotatePoint } from "../math";
-import {
+import type {
ExcalidrawLinearElement,
ExcalidrawTextElement,
NonDeletedExcalidrawElement,
@@ -31,11 +31,11 @@ import {
import { mutateElement } from "./mutateElement";
import { getFontString } from "../utils";
import { updateBoundElements } from "./binding";
-import {
+import type {
MaybeTransformHandleType,
TransformHandleDirection,
} from "./transformHandles";
-import { Point, PointerDownState } from "../types";
+import type { Point, PointerDownState } from "../types";
import Scene from "../scene/Scene";
import {
getApproxMinLineWidth,
diff --git a/packages/excalidraw/element/resizeTest.ts b/packages/excalidraw/element/resizeTest.ts
index 0ff65aca0a..3fea7d9607 100644
--- a/packages/excalidraw/element/resizeTest.ts
+++ b/packages/excalidraw/element/resizeTest.ts
@@ -1,28 +1,31 @@
-import {
+import type {
ExcalidrawElement,
PointerType,
NonDeletedExcalidrawElement,
ElementsMap,
} from "./types";
-import {
- getTransformHandlesFromCoords,
- getTransformHandles,
+import type {
TransformHandleType,
TransformHandle,
MaybeTransformHandleType,
+} from "./transformHandles";
+import {
+ getTransformHandlesFromCoords,
+ getTransformHandles,
getOmitSidesForDevice,
canResizeFromSides,
} from "./transformHandles";
-import { AppState, Device, Zoom } from "../types";
-import { Bounds, getElementAbsoluteCoords } from "./bounds";
+import type { AppState, Device, Zoom } from "../types";
+import type { Bounds } from "./bounds";
+import { getElementAbsoluteCoords } from "./bounds";
import { SIDE_RESIZING_THRESHOLD } from "../constants";
import {
angleToDegrees,
pointOnLine,
pointRotate,
} from "../../utils/geometry/geometry";
-import { Line, Point } from "../../utils/geometry/shape";
+import type { Line, Point } from "../../utils/geometry/shape";
import { isLinearElement } from "./typeChecks";
const isInsideTransformHandle = (
diff --git a/packages/excalidraw/element/showSelectedShapeActions.ts b/packages/excalidraw/element/showSelectedShapeActions.ts
index 1fd47f6834..c464e69cf3 100644
--- a/packages/excalidraw/element/showSelectedShapeActions.ts
+++ b/packages/excalidraw/element/showSelectedShapeActions.ts
@@ -1,6 +1,6 @@
-import { NonDeletedExcalidrawElement } from "./types";
+import type { NonDeletedExcalidrawElement } from "./types";
import { getSelectedElements } from "../scene";
-import { UIAppState } from "../types";
+import type { UIAppState } from "../types";
export const showSelectedShapeActions = (
appState: UIAppState,
diff --git a/packages/excalidraw/element/sizeHelpers.ts b/packages/excalidraw/element/sizeHelpers.ts
index 187f84d181..382cd5c3be 100644
--- a/packages/excalidraw/element/sizeHelpers.ts
+++ b/packages/excalidraw/element/sizeHelpers.ts
@@ -1,8 +1,8 @@
-import { ElementsMap, ExcalidrawElement } from "./types";
+import type { ElementsMap, ExcalidrawElement } from "./types";
import { mutateElement } from "./mutateElement";
import { isFreeDrawElement, isLinearElement } from "./typeChecks";
import { SHIFT_LOCKING_ANGLE } from "../constants";
-import { AppState, Zoom } from "../types";
+import type { AppState, Zoom } from "../types";
import { getElementBounds } from "./bounds";
import { viewportCoordsToSceneCoords } from "../utils";
diff --git a/packages/excalidraw/element/sortElements.test.ts b/packages/excalidraw/element/sortElements.test.ts
index 35cf560efd..a7b78e8eaa 100644
--- a/packages/excalidraw/element/sortElements.test.ts
+++ b/packages/excalidraw/element/sortElements.test.ts
@@ -1,7 +1,7 @@
import { API } from "../tests/helpers/api";
import { mutateElement } from "./mutateElement";
import { normalizeElementOrder } from "./sortElements";
-import { ExcalidrawElement } from "./types";
+import type { ExcalidrawElement } from "./types";
const assertOrder = (
elements: readonly ExcalidrawElement[],
diff --git a/packages/excalidraw/element/sortElements.ts b/packages/excalidraw/element/sortElements.ts
index 3c91fc0408..bb758370ad 100644
--- a/packages/excalidraw/element/sortElements.ts
+++ b/packages/excalidraw/element/sortElements.ts
@@ -1,5 +1,5 @@
import { arrayToMapWithIndex } from "../utils";
-import { ExcalidrawElement } from "./types";
+import type { ExcalidrawElement } from "./types";
const normalizeGroupElementOrder = (elements: readonly ExcalidrawElement[]) => {
const origElements: ExcalidrawElement[] = elements.slice();
diff --git a/packages/excalidraw/element/textElement.test.ts b/packages/excalidraw/element/textElement.test.ts
index 2f3a2dcc75..bc8186a852 100644
--- a/packages/excalidraw/element/textElement.test.ts
+++ b/packages/excalidraw/element/textElement.test.ts
@@ -11,7 +11,7 @@ import {
getDefaultLineHeight,
parseTokens,
} from "./textElement";
-import { ExcalidrawTextElementWithContainer, FontString } from "./types";
+import type { ExcalidrawTextElementWithContainer, FontString } from "./types";
describe("Test wrapText", () => {
const font = "20px Cascadia, width: Segoe UI Emoji" as FontString;
diff --git a/packages/excalidraw/element/textElement.ts b/packages/excalidraw/element/textElement.ts
index b7b6cf65a2..a81fe9cec2 100644
--- a/packages/excalidraw/element/textElement.ts
+++ b/packages/excalidraw/element/textElement.ts
@@ -1,5 +1,5 @@
import { getFontString, arrayToMap, isTestEnv, normalizeEOL } from "../utils";
-import {
+import type {
ElementsMap,
ExcalidrawElement,
ExcalidrawElementType,
@@ -21,16 +21,16 @@ import {
TEXT_ALIGN,
VERTICAL_ALIGN,
} from "../constants";
-import { MaybeTransformHandleType } from "./transformHandles";
+import type { MaybeTransformHandleType } from "./transformHandles";
import { isTextElement } from ".";
import { isBoundToContainer, isArrowElement } from "./typeChecks";
import { LinearElementEditor } from "./linearElementEditor";
-import { AppState } from "../types";
+import type { AppState } from "../types";
import {
resetOriginalContainerCache,
updateOriginalContainerCache,
} from "./containerCache";
-import { ExtractSetType, MakeBrand } from "../utility-types";
+import type { ExtractSetType, MakeBrand } from "../utility-types";
export const normalizeText = (text: string) => {
return (
diff --git a/packages/excalidraw/element/textWysiwyg.test.tsx b/packages/excalidraw/element/textWysiwyg.test.tsx
index 2d38b82131..78849376d6 100644
--- a/packages/excalidraw/element/textWysiwyg.test.tsx
+++ b/packages/excalidraw/element/textWysiwyg.test.tsx
@@ -11,7 +11,7 @@ import {
import { queryByText } from "@testing-library/react";
import { FONT_FAMILY, TEXT_ALIGN, VERTICAL_ALIGN } from "../constants";
-import {
+import type {
ExcalidrawTextElement,
ExcalidrawTextElementWithContainer,
} from "./types";
diff --git a/packages/excalidraw/element/textWysiwyg.tsx b/packages/excalidraw/element/textWysiwyg.tsx
index 7dfdbc6158..bfcea23480 100644
--- a/packages/excalidraw/element/textWysiwyg.tsx
+++ b/packages/excalidraw/element/textWysiwyg.tsx
@@ -12,13 +12,13 @@ import {
isTextElement,
} from "./typeChecks";
import { CLASSES } from "../constants";
-import {
+import type {
ExcalidrawElement,
ExcalidrawLinearElement,
ExcalidrawTextElementWithContainer,
ExcalidrawTextElement,
} from "./types";
-import { AppState } from "../types";
+import type { AppState } from "../types";
import { bumpVersion, mutateElement } from "./mutateElement";
import {
getBoundTextElementId,
@@ -39,7 +39,7 @@ import {
actionIncreaseFontSize,
} from "../actions/actionProperties";
import { actionZoomIn, actionZoomOut } from "../actions/actionCanvas";
-import App from "../components/App";
+import type App from "../components/App";
import { LinearElementEditor } from "./linearElementEditor";
import { parseClipboard } from "../clipboard";
import {
diff --git a/packages/excalidraw/element/transformHandles.ts b/packages/excalidraw/element/transformHandles.ts
index a1a55f52de..a72dcf78a4 100644
--- a/packages/excalidraw/element/transformHandles.ts
+++ b/packages/excalidraw/element/transformHandles.ts
@@ -1,13 +1,14 @@
-import {
+import type {
ElementsMap,
ExcalidrawElement,
NonDeletedExcalidrawElement,
PointerType,
} from "./types";
-import { Bounds, getElementAbsoluteCoords } from "./bounds";
+import type { Bounds } from "./bounds";
+import { getElementAbsoluteCoords } from "./bounds";
import { rotate } from "../math";
-import { Device, InteractiveCanvasAppState, Zoom } from "../types";
+import type { Device, InteractiveCanvasAppState, Zoom } from "../types";
import { isTextElement } from ".";
import { isFrameLikeElement, isLinearElement } from "./typeChecks";
import {
diff --git a/packages/excalidraw/element/typeChecks.ts b/packages/excalidraw/element/typeChecks.ts
index a84798c93b..e7dea3cef6 100644
--- a/packages/excalidraw/element/typeChecks.ts
+++ b/packages/excalidraw/element/typeChecks.ts
@@ -1,8 +1,8 @@
import { ROUNDNESS } from "../constants";
-import { ElementOrToolType } from "../types";
-import { MarkNonNullable } from "../utility-types";
+import type { ElementOrToolType } from "../types";
+import type { MarkNonNullable } from "../utility-types";
import { assertNever } from "../utils";
-import {
+import type {
ExcalidrawElement,
ExcalidrawTextElement,
ExcalidrawEmbeddableElement,
diff --git a/packages/excalidraw/element/types.ts b/packages/excalidraw/element/types.ts
index 262747a3f5..6b7ac57b4b 100644
--- a/packages/excalidraw/element/types.ts
+++ b/packages/excalidraw/element/types.ts
@@ -1,13 +1,13 @@
-import { Point } from "../types";
-import {
+import type { Point } from "../types";
+import type {
FONT_FAMILY,
ROUNDNESS,
TEXT_ALIGN,
THEME,
VERTICAL_ALIGN,
} from "../constants";
-import { MakeBrand, MarkNonNullable, ValueOf } from "../utility-types";
-import { MagicCacheData } from "../data/magic";
+import type { MakeBrand, MarkNonNullable, ValueOf } from "../utility-types";
+import type { MagicCacheData } from "../data/magic";
export type ChartType = "bar" | "line";
export type FillStyle = "hachure" | "cross-hatch" | "solid" | "zigzag";
diff --git a/packages/excalidraw/emitter.ts b/packages/excalidraw/emitter.ts
index 98e97ad463..938269728e 100644
--- a/packages/excalidraw/emitter.ts
+++ b/packages/excalidraw/emitter.ts
@@ -1,4 +1,4 @@
-import { UnsubscribeCallback } from "./types";
+import type { UnsubscribeCallback } from "./types";
type Subscriber<T extends any[]> = (...payload: T) => void;
diff --git a/packages/excalidraw/fractionalIndex.ts b/packages/excalidraw/fractionalIndex.ts
index ccda1d365d..618500439f 100644
--- a/packages/excalidraw/fractionalIndex.ts
+++ b/packages/excalidraw/fractionalIndex.ts
@@ -1,6 +1,6 @@
import { generateNKeysBetween } from "fractional-indexing";
import { mutateElement } from "./element/mutateElement";
-import {
+import type {
ExcalidrawElement,
FractionalIndex,
OrderedExcalidrawElement,
diff --git a/packages/excalidraw/frame.test.tsx b/packages/excalidraw/frame.test.tsx
index e37b28b218..d9e0c5e3e9 100644
--- a/packages/excalidraw/frame.test.tsx
+++ b/packages/excalidraw/frame.test.tsx
@@ -1,4 +1,4 @@
-import { ExcalidrawElement } from "./element/types";
+import type { ExcalidrawElement } from "./element/types";
import { convertToExcalidrawElements, Excalidraw } from "./index";
import { API } from "./tests/helpers/api";
import { Keyboard, Pointer } from "./tests/helpers/ui";
diff --git a/packages/excalidraw/frame.ts b/packages/excalidraw/frame.ts
index c2e7aa1626..f02ac521d4 100644
--- a/packages/excalidraw/frame.ts
+++ b/packages/excalidraw/frame.ts
@@ -3,7 +3,7 @@ import {
getElementAbsoluteCoords,
isTextElement,
} from "./element";
-import {
+import type {
ElementsMap,
ElementsMapOrArray,
ExcalidrawElement,
@@ -18,14 +18,18 @@ import {
} from "./element/textElement";
import { arrayToMap } from "./utils";
import { mutateElement } from "./element/mutateElement";
-import { AppClassProperties, AppState, StaticCanvasAppState } from "./types";
+import type {
+ AppClassProperties,
+ AppState,
+ StaticCanvasAppState,
+} from "./types";
import { getElementsWithinSelection, getSelectedElements } from "./scene";
import { getElementsInGroup, selectGroupsFromGivenElements } from "./groups";
import type { ExcalidrawElementsIncludingDeleted } from "./scene/Scene";
import { getElementLineSegments } from "./element/bounds";
import { doLineSegmentsIntersect, elementsOverlappingBBox } from "../utils/";
import { isFrameElement, isFrameLikeElement } from "./element/typeChecks";
-import { ReadonlySetLike } from "./utility-types";
+import type { ReadonlySetLike } from "./utility-types";
// --------------------------- Frame State ------------------------------------
export const bindElementsToFramesAfterDuplication = (
diff --git a/packages/excalidraw/gadirections.ts b/packages/excalidraw/gadirections.ts
index ad026c173f..2f631fa6ab 100644
--- a/packages/excalidraw/gadirections.ts
+++ b/packages/excalidraw/gadirections.ts
@@ -1,5 +1,5 @@
import * as GA from "./ga";
-import { Line, Direction, Point } from "./ga";
+import type { Line, Direction, Point } from "./ga";
/**
* A direction is stored as an array `[0, 0, 0, 0, y, x, 0, 0]` representing
diff --git a/packages/excalidraw/galines.ts b/packages/excalidraw/galines.ts
index 28bc197fe9..f5058ce690 100644
--- a/packages/excalidraw/galines.ts
+++ b/packages/excalidraw/galines.ts
@@ -1,5 +1,5 @@
import * as GA from "./ga";
-import { Line, Point } from "./ga";
+import type { Line, Point } from "./ga";
/**
* A line is stored as an array `[0, c, a, b, 0, 0, 0, 0]` representing:
diff --git a/packages/excalidraw/gapoints.ts b/packages/excalidraw/gapoints.ts
index 25ad6079fc..909e8ffe6b 100644
--- a/packages/excalidraw/gapoints.ts
+++ b/packages/excalidraw/gapoints.ts
@@ -1,6 +1,7 @@
import * as GA from "./ga";
import * as GALine from "./galines";
-import { Point, Line, join } from "./ga";
+import type { Point, Line } from "./ga";
+import { join } from "./ga";
export const from = ([x, y]: readonly [number, number]): Point => [
0,
diff --git a/packages/excalidraw/gatransforms.ts b/packages/excalidraw/gatransforms.ts
index ca57434e27..2301d979ef 100644
--- a/packages/excalidraw/gatransforms.ts
+++ b/packages/excalidraw/gatransforms.ts
@@ -1,5 +1,5 @@
import * as GA from "./ga";
-import { Line, Direction, Point, Transform } from "./ga";
+import type { Line, Direction, Point, Transform } from "./ga";
import * as GADirection from "./gadirections";
/**
diff --git a/packages/excalidraw/gesture.ts b/packages/excalidraw/gesture.ts
index 4592338bfb..8ffa6d2bbc 100644
--- a/packages/excalidraw/gesture.ts
+++ b/packages/excalidraw/gesture.ts
@@ -1,4 +1,4 @@
-import { PointerCoords } from "./types";
+import type { PointerCoords } from "./types";
export const getCenter = (pointers: Map<number, PointerCoords>) => {
const allCoords = Array.from(pointers.values());
diff --git a/packages/excalidraw/global.d.ts b/packages/excalidraw/global.d.ts
index 49e5eac1cc..4aeb8c4289 100644
--- a/packages/excalidraw/global.d.ts
+++ b/packages/excalidraw/global.d.ts
@@ -71,7 +71,7 @@ interface Uint8Array {
// https://github.com/nodeca/image-blob-reduce/issues/23#issuecomment-783271848
declare module "image-blob-reduce" {
- import { PicaResizeOptions, Pica } from "pica";
+ import type { PicaResizeOptions, Pica } from "pica";
namespace ImageBlobReduce {
interface ImageBlobReduce {
toBlob(file: File, options: ImageBlobReduceOptions): Promise<Blob>;
diff --git a/packages/excalidraw/groups.ts b/packages/excalidraw/groups.ts
index 30db09be40..73a6e0f87d 100644
--- a/packages/excalidraw/groups.ts
+++ b/packages/excalidraw/groups.ts
@@ -1,4 +1,4 @@
-import {
+import type {
GroupId,
ExcalidrawElement,
NonDeleted,
@@ -6,7 +6,7 @@ import {
ElementsMapOrArray,
ElementsMap,
} from "./element/types";
-import {
+import type {
AppClassProperties,
AppState,
InteractiveCanvasAppState,
@@ -14,7 +14,7 @@ import {
import { getSelectedElements } from "./scene";
import { getBoundTextElement } from "./element/textElement";
import { makeNextSelectedElementIds } from "./scene/selection";
-import { Mutable } from "./utility-types";
+import type { Mutable } from "./utility-types";
export const selectGroup = (
groupId: GroupId,
diff --git a/packages/excalidraw/history.ts b/packages/excalidraw/history.ts
index cf9ed70851..daed2a3940 100644
--- a/packages/excalidraw/history.ts
+++ b/packages/excalidraw/history.ts
@@ -1,8 +1,8 @@
-import { AppStateChange, ElementsChange } from "./change";
-import { SceneElementsMap } from "./element/types";
+import type { AppStateChange, ElementsChange } from "./change";
+import type { SceneElementsMap } from "./element/types";
import { Emitter } from "./emitter";
-import { Snapshot } from "./store";
-import { AppState } from "./types";
+import type { Snapshot } from "./store";
+import type { AppState } from "./types";
type HistoryStack = HistoryEntry[];
diff --git a/packages/excalidraw/hooks/useEmitter.ts b/packages/excalidraw/hooks/useEmitter.ts
index fe6e3cfb07..27b94bc91c 100644
--- a/packages/excalidraw/hooks/useEmitter.ts
+++ b/packages/excalidraw/hooks/useEmitter.ts
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
-import { Emitter } from "../emitter";
+import type { Emitter } from "../emitter";
export const useEmitter = <TEvent extends unknown>(
emitter: Emitter<[TEvent]>,
diff --git a/packages/excalidraw/hooks/useLibraryItemSvg.ts b/packages/excalidraw/hooks/useLibraryItemSvg.ts
index ac40140b48..1a32678b45 100644
--- a/packages/excalidraw/hooks/useLibraryItemSvg.ts
+++ b/packages/excalidraw/hooks/useLibraryItemSvg.ts
@@ -3,7 +3,7 @@ import { useEffect, useState } from "react";
import { COLOR_PALETTE } from "../colors";
import { jotaiScope } from "../jotai";
import { exportToSvg } from "../../utils/export";
-import { LibraryItem } from "../types";
+import type { LibraryItem } from "../types";
export type SvgCache = Map<LibraryItem["id"], SVGSVGElement>;
diff --git a/packages/excalidraw/i18n.ts b/packages/excalidraw/i18n.ts
index a014b33b80..10373ef56a 100644
--- a/packages/excalidraw/i18n.ts
+++ b/packages/excalidraw/i18n.ts
@@ -2,7 +2,7 @@ import fallbackLangData from "./locales/en.json";
import percentages from "./locales/percentages.json";
import { jotaiScope, jotaiStore } from "./jotai";
import { atom, useAtomValue } from "jotai";
-import { NestedKeyOf } from "./utility-types";
+import type { NestedKeyOf } from "./utility-types";
const COMPLETION_THRESHOLD = 85;
diff --git a/packages/excalidraw/index.tsx b/packages/excalidraw/index.tsx
index b9fd96acfe..98dd9d8ebc 100644
--- a/packages/excalidraw/index.tsx
+++ b/packages/excalidraw/index.tsx
@@ -8,7 +8,7 @@ import "./css/styles.scss";
import "../../public/fonts/fonts.css";
import polyfill from "./polyfill";
-import { AppProps, ExcalidrawProps } from "./types";
+import type { AppProps, ExcalidrawProps } from "./types";
import { defaultLang } from "./i18n";
import { DEFAULT_UI_OPTIONS } from "./constants";
import { Provider } from "jotai";
diff --git a/packages/excalidraw/jotai.ts b/packages/excalidraw/jotai.ts
index 85ab66b333..4151884255 100644
--- a/packages/excalidraw/jotai.ts
+++ b/packages/excalidraw/jotai.ts
@@ -1,4 +1,5 @@
-import { PrimitiveAtom, unstable_createStore, useAtom } from "jotai";
+import type { PrimitiveAtom } from "jotai";
+import { unstable_createStore, useAtom } from "jotai";
import { useLayoutEffect } from "react";
export const jotaiScope = Symbol();
diff --git a/packages/excalidraw/laser-trails.ts b/packages/excalidraw/laser-trails.ts
index e2ef258b0e..b7733baedf 100644
--- a/packages/excalidraw/laser-trails.ts
+++ b/packages/excalidraw/laser-trails.ts
@@ -1,8 +1,9 @@
-import { LaserPointerOptions } from "@excalidraw/laser-pointer";
-import { AnimatedTrail, Trail } from "./animated-trail";
-import { AnimationFrameHandler } from "./animation-frame-handler";
+import type { LaserPointerOptions } from "@excalidraw/laser-pointer";
+import type { Trail } from "./animated-trail";
+import { AnimatedTrail } from "./animated-trail";
+import type { AnimationFrameHandler } from "./animation-frame-handler";
import type App from "./components/App";
-import { SocketId } from "./types";
+import type { SocketId } from "./types";
import { easeOut } from "./utils";
import { getClientColor } from "./clients";
import { DEFAULT_LASER_COLOR } from "./constants";
diff --git a/packages/excalidraw/math.ts b/packages/excalidraw/math.ts
index 8c0fb0ebd5..50b1cbf07a 100644
--- a/packages/excalidraw/math.ts
+++ b/packages/excalidraw/math.ts
@@ -1,17 +1,17 @@
-import { NormalizedZoomValue, Point, Zoom } from "./types";
+import type { NormalizedZoomValue, Point, Zoom } from "./types";
import {
DEFAULT_ADAPTIVE_RADIUS,
LINE_CONFIRM_THRESHOLD,
DEFAULT_PROPORTIONAL_RADIUS,
ROUNDNESS,
} from "./constants";
-import {
+import type {
ExcalidrawElement,
ExcalidrawLinearElement,
NonDeleted,
} from "./element/types";
import { getCurvePathOps } from "./element/bounds";
-import { Mutable } from "./utility-types";
+import type { Mutable } from "./utility-types";
import { ShapeCache } from "./scene/ShapeCache";
export const rotate = (
diff --git a/packages/excalidraw/points.ts b/packages/excalidraw/points.ts
index 84aea9277b..e7ff2c47ae 100644
--- a/packages/excalidraw/points.ts
+++ b/packages/excalidraw/points.ts
@@ -1,4 +1,4 @@
-import { Point } from "./types";
+import type { Point } from "./types";
export const getSizeFromPoints = (points: readonly Point[]) => {
const xs = points.map((point) => point[0]);
diff --git a/packages/excalidraw/queue.ts b/packages/excalidraw/queue.ts
index 408e945baa..9cac2c5e9a 100644
--- a/packages/excalidraw/queue.ts
+++ b/packages/excalidraw/queue.ts
@@ -1,5 +1,6 @@
-import { MaybePromise } from "./utility-types";
-import { promiseTry, ResolvablePromise, resolvablePromise } from "./utils";
+import type { MaybePromise } from "./utility-types";
+import type { ResolvablePromise } from "./utils";
+import { promiseTry, resolvablePromise } from "./utils";
type Job<T, TArgs extends unknown[]> = (...args: TArgs) => MaybePromise<T>;
diff --git a/packages/excalidraw/renderer/helpers.ts b/packages/excalidraw/renderer/helpers.ts
index 8ac7433249..90f40099f0 100644
--- a/packages/excalidraw/renderer/helpers.ts
+++ b/packages/excalidraw/renderer/helpers.ts
@@ -1,6 +1,6 @@
-import { StaticCanvasAppState, AppState } from "../types";
+import type { StaticCanvasAppState, AppState } from "../types";
-import { StaticCanvasRenderConfig } from "../scene/types";
+import type { StaticCanvasRenderConfig } from "../scene/types";
import { THEME, THEME_FILTER } from "../constants";
diff --git a/packages/excalidraw/renderer/interactiveScene.ts b/packages/excalidraw/renderer/interactiveScene.ts
index f47b2a05b1..22d756bf42 100644
--- a/packages/excalidraw/renderer/interactiveScene.ts
+++ b/packages/excalidraw/renderer/interactiveScene.ts
@@ -21,23 +21,25 @@ import {
getElementsInGroup,
selectGroupsFromGivenElements,
} from "../groups";
+import type {
+ TransformHandles,
+ TransformHandleType,
+} from "../element/transformHandles";
import {
getOmitSidesForDevice,
shouldShowBoundingBox,
- TransformHandles,
- TransformHandleType,
} from "../element/transformHandles";
import { arrayToMap, throttleRAF } from "../utils";
-import { InteractiveCanvasAppState, Point } from "../types";
+import type { InteractiveCanvasAppState, Point } from "../types";
import { DEFAULT_TRANSFORM_HANDLE_SPACING, FRAME_STYLE } from "../constants";
import { renderSnaps } from "../renderer/renderSnaps";
-import {
- maxBindingGap,
+import type {
SuggestedBinding,
SuggestedPointBinding,
} from "../element/binding";
+import { maxBindingGap } from "../element/binding";
import { LinearElementEditor } from "../element/linearElementEditor";
import {
bootstrapCanvas,
@@ -46,7 +48,7 @@ import {
} from "./helpers";
import oc from "open-color";
import { isFrameLikeElement, isLinearElement } from "../element/typeChecks";
-import {
+import type {
ElementsMap,
ExcalidrawBindableElement,
ExcalidrawElement,
@@ -55,7 +57,7 @@ import {
GroupId,
NonDeleted,
} from "../element/types";
-import {
+import type {
InteractiveCanvasRenderConfig,
InteractiveSceneRenderConfig,
RenderableElementsMap,
diff --git a/packages/excalidraw/renderer/renderElement.ts b/packages/excalidraw/renderer/renderElement.ts
index 7a00eab995..8914b83a9c 100644
--- a/packages/excalidraw/renderer/renderElement.ts
+++ b/packages/excalidraw/renderer/renderElement.ts
@@ -1,4 +1,4 @@
-import {
+import type {
ExcalidrawElement,
ExcalidrawTextElement,
NonDeletedExcalidrawElement,
@@ -21,14 +21,14 @@ import {
import { getElementAbsoluteCoords } from "../element/bounds";
import type { RoughCanvas } from "roughjs/bin/canvas";
-import {
+import type {
StaticCanvasRenderConfig,
RenderableElementsMap,
} from "../scene/types";
import { distance, getFontString, isRTL } from "../utils";
import { getCornerRadius, isRightAngle } from "../math";
import rough from "roughjs/bin/rough";
-import {
+import type {
AppState,
StaticCanvasAppState,
Zoom,
@@ -43,7 +43,8 @@ import {
MIME_TYPES,
THEME,
} from "../constants";
-import { getStroke, StrokeOptions } from "perfect-freehand";
+import type { StrokeOptions } from "perfect-freehand";
+import { getStroke } from "perfect-freehand";
import {
getBoundTextElement,
getContainerCoords,
diff --git a/packages/excalidraw/renderer/renderSnaps.ts b/packages/excalidraw/renderer/renderSnaps.ts
index 79775b37d3..190a72904f 100644
--- a/packages/excalidraw/renderer/renderSnaps.ts
+++ b/packages/excalidraw/renderer/renderSnaps.ts
@@ -1,6 +1,6 @@
import { THEME } from "../constants";
-import { PointSnapLine, PointerSnapLine } from "../snapping";
-import { InteractiveCanvasAppState, Point } from "../types";
+import type { PointSnapLine, PointerSnapLine } from "../snapping";
+import type { InteractiveCanvasAppState, Point } from "../types";
const SNAP_COLOR_LIGHT = "#ff6b6b";
const SNAP_COLOR_DARK = "#ff0000";
diff --git a/packages/excalidraw/renderer/staticScene.ts b/packages/excalidraw/renderer/staticScene.ts
index b7dcdd59aa..ff90e5e855 100644
--- a/packages/excalidraw/renderer/staticScene.ts
+++ b/packages/excalidraw/renderer/staticScene.ts
@@ -13,13 +13,13 @@ import {
} from "../element/typeChecks";
import { renderElement } from "../renderer/renderElement";
import { createPlaceholderEmbeddableLabel } from "../element/embeddable";
-import { StaticCanvasAppState, Zoom } from "../types";
-import {
+import type { StaticCanvasAppState, Zoom } from "../types";
+import type {
ElementsMap,
ExcalidrawFrameLikeElement,
NonDeletedExcalidrawElement,
} from "../element/types";
-import {
+import type {
StaticCanvasRenderConfig,
StaticSceneRenderConfig,
} from "../scene/types";
diff --git a/packages/excalidraw/renderer/staticSvgScene.ts b/packages/excalidraw/renderer/staticSvgScene.ts
index 4758fb07cb..0c2bd919a8 100644
--- a/packages/excalidraw/renderer/staticSvgScene.ts
+++ b/packages/excalidraw/renderer/staticSvgScene.ts
@@ -1,5 +1,5 @@
-import { Drawable } from "roughjs/bin/core";
-import { RoughSVG } from "roughjs/bin/svg";
+import type { Drawable } from "roughjs/bin/core";
+import type { RoughSVG } from "roughjs/bin/svg";
import {
FRAME_STYLE,
MAX_DECIMALS_FOR_SVG_EXPORT,
@@ -25,7 +25,7 @@ import {
isInitializedImageElement,
isTextElement,
} from "../element/typeChecks";
-import {
+import type {
ExcalidrawElement,
ExcalidrawTextElementWithContainer,
NonDeletedExcalidrawElement,
@@ -33,8 +33,8 @@ import {
import { getContainingFrame } from "../frame";
import { getCornerRadius, isPathALoop } from "../math";
import { ShapeCache } from "../scene/ShapeCache";
-import { RenderableElementsMap, SVGRenderConfig } from "../scene/types";
-import { AppState, BinaryFiles } from "../types";
+import type { RenderableElementsMap, SVGRenderConfig } from "../scene/types";
+import type { AppState, BinaryFiles } from "../types";
import { getFontFamilyString, isRTL, isTestEnv } from "../utils";
import { getFreeDrawSvgPath, IMAGE_INVERT_FILTER } from "./renderElement";
diff --git a/packages/excalidraw/scene/Fonts.ts b/packages/excalidraw/scene/Fonts.ts
index 6691e90be2..c2f0c38aed 100644
--- a/packages/excalidraw/scene/Fonts.ts
+++ b/packages/excalidraw/scene/Fonts.ts
@@ -2,7 +2,10 @@ import { isTextElement, refreshTextDimensions } from "../element";
import { newElementWith } from "../element/mutateElement";
import { getContainerElement } from "../element/textElement";
import { isBoundToContainer } from "../element/typeChecks";
-import { ExcalidrawElement, ExcalidrawTextElement } from "../element/types";
+import type {
+ ExcalidrawElement,
+ ExcalidrawTextElement,
+} from "../element/types";
import { getFontString } from "../utils";
import type Scene from "./Scene";
import { ShapeCache } from "./ShapeCache";
diff --git a/packages/excalidraw/scene/Renderer.ts b/packages/excalidraw/scene/Renderer.ts
index 7970f8c1cf..754bb7d76a 100644
--- a/packages/excalidraw/scene/Renderer.ts
+++ b/packages/excalidraw/scene/Renderer.ts
@@ -1,16 +1,16 @@
import { isElementInViewport } from "../element/sizeHelpers";
import { isImageElement } from "../element/typeChecks";
-import {
+import type {
NonDeletedElementsMap,
NonDeletedExcalidrawElement,
} from "../element/types";
import { renderInteractiveSceneThrottled } from "../renderer/interactiveScene";
import { renderStaticSceneThrottled } from "../renderer/staticScene";
-import { AppState } from "../types";
+import type { AppState } from "../types";
import { memoize, toBrandedType } from "../utils";
-import Scene from "./Scene";
-import { RenderableElementsMap } from "./types";
+import type Scene from "./Scene";
+import type { RenderableElementsMap } from "./types";
export class Renderer {
private scene: Scene;
diff --git a/packages/excalidraw/scene/Scene.ts b/packages/excalidraw/scene/Scene.ts
index 98d9fda28a..2e46d77f55 100644
--- a/packages/excalidraw/scene/Scene.ts
+++ b/packages/excalidraw/scene/Scene.ts
@@ -1,4 +1,4 @@
-import {
+import type {
ExcalidrawElement,
NonDeletedExcalidrawElement,
NonDeleted,
@@ -10,11 +10,11 @@ import {
Ordered,
} from "../element/types";
import { isNonDeletedElement } from "../element";
-import { LinearElementEditor } from "../element/linearElementEditor";
+import type { LinearElementEditor } from "../element/linearElementEditor";
import { isFrameLikeElement } from "../element/typeChecks";
import { getSelectedElements } from "./selection";
-import { AppState } from "../types";
-import { Assert, SameType } from "../utility-types";
+import type { AppState } from "../types";
+import type { Assert, SameType } from "../utility-types";
import { randomInteger } from "../random";
import {
syncInvalidIndices,
diff --git a/packages/excalidraw/scene/Shape.ts b/packages/excalidraw/scene/Shape.ts
index 1d43aef71c..ccebe867e0 100644
--- a/packages/excalidraw/scene/Shape.ts
+++ b/packages/excalidraw/scene/Shape.ts
@@ -21,7 +21,7 @@ import {
isLinearElement,
} from "../element/typeChecks";
import { canChangeRoundness } from "./comparisons";
-import { EmbedsValidationStatus } from "../types";
+import type { EmbedsValidationStatus } from "../types";
const getDashArrayDashed = (strokeWidth: number) => [8, 8 + strokeWidth];
diff --git a/packages/excalidraw/scene/ShapeCache.ts b/packages/excalidraw/scene/ShapeCache.ts
index 3bca88e850..39d388a7bf 100644
--- a/packages/excalidraw/scene/ShapeCache.ts
+++ b/packages/excalidraw/scene/ShapeCache.ts
@@ -1,14 +1,14 @@
-import { Drawable } from "roughjs/bin/core";
+import type { Drawable } from "roughjs/bin/core";
import { RoughGenerator } from "roughjs/bin/generator";
-import {
+import type {
ExcalidrawElement,
ExcalidrawSelectionElement,
} from "../element/types";
import { elementWithCanvasCache } from "../renderer/renderElement";
import { _generateElementShape } from "./Shape";
-import { ElementShape, ElementShapes } from "./types";
+import type { ElementShape, ElementShapes } from "./types";
import { COLOR_PALETTE } from "../colors";
-import { AppState, EmbedsValidationStatus } from "../types";
+import type { AppState, EmbedsValidationStatus } from "../types";
export class ShapeCache {
private static rg = new RoughGenerator();
diff --git a/packages/excalidraw/scene/comparisons.ts b/packages/excalidraw/scene/comparisons.ts
index cb14d5810b..d46897eb59 100644
--- a/packages/excalidraw/scene/comparisons.ts
+++ b/packages/excalidraw/scene/comparisons.ts
@@ -1,9 +1,9 @@
import { isIframeElement } from "../element/typeChecks";
-import {
+import type {
ExcalidrawIframeElement,
NonDeletedExcalidrawElement,
} from "../element/types";
-import { ElementOrToolType } from "../types";
+import type { ElementOrToolType } from "../types";
export const hasBackground = (type: ElementOrToolType) =>
type === "rectangle" ||
diff --git a/packages/excalidraw/scene/export.ts b/packages/excalidraw/scene/export.ts
index 446578c22c..c00a8968fa 100644
--- a/packages/excalidraw/scene/export.ts
+++ b/packages/excalidraw/scene/export.ts
@@ -1,19 +1,16 @@
import rough from "roughjs/bin/rough";
-import {
+import type {
ExcalidrawElement,
ExcalidrawFrameLikeElement,
ExcalidrawTextElement,
NonDeletedExcalidrawElement,
NonDeletedSceneElementsMap,
} from "../element/types";
-import {
- Bounds,
- getCommonBounds,
- getElementAbsoluteCoords,
-} from "../element/bounds";
+import type { Bounds } from "../element/bounds";
+import { getCommonBounds, getElementAbsoluteCoords } from "../element/bounds";
import { renderSceneToSvg } from "../renderer/staticSvgScene";
import { arrayToMap, distance, getFontString, toBrandedType } from "../utils";
-import { AppState, BinaryFiles } from "../types";
+import type { AppState, BinaryFiles } from "../types";
import {
DEFAULT_EXPORT_PADDING,
FONT_FAMILY,
@@ -35,10 +32,10 @@ import {
getRootElements,
} from "../frame";
import { newTextElement } from "../element";
-import { Mutable } from "../utility-types";
+import type { Mutable } from "../utility-types";
import { newElementWith } from "../element/mutateElement";
import { isFrameElement, isFrameLikeElement } from "../element/typeChecks";
-import { RenderableElementsMap } from "./types";
+import type { RenderableElementsMap } from "./types";
import { syncInvalidIndices } from "../fractionalIndex";
import { renderStaticScene } from "../renderer/staticScene";
diff --git a/packages/excalidraw/scene/scroll.ts b/packages/excalidraw/scene/scroll.ts
index b5b8176e13..f3d6ac0147 100644
--- a/packages/excalidraw/scene/scroll.ts
+++ b/packages/excalidraw/scene/scroll.ts
@@ -1,5 +1,5 @@
-import { AppState, PointerCoords, Zoom } from "../types";
-import { ExcalidrawElement } from "../element/types";
+import type { AppState, PointerCoords, Zoom } from "../types";
+import type { ExcalidrawElement } from "../element/types";
import {
getCommonBounds,
getClosestElementBounds,
diff --git a/packages/excalidraw/scene/scrollbars.ts b/packages/excalidraw/scene/scrollbars.ts
index 0e0e6d0abd..70f7033fbd 100644
--- a/packages/excalidraw/scene/scrollbars.ts
+++ b/packages/excalidraw/scene/scrollbars.ts
@@ -1,9 +1,9 @@
import { getCommonBounds } from "../element";
-import { InteractiveCanvasAppState } from "../types";
-import { ScrollBars } from "./types";
+import type { InteractiveCanvasAppState } from "../types";
+import type { ScrollBars } from "./types";
import { getGlobalCSSVariable } from "../utils";
import { getLanguage } from "../i18n";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
export const SCROLLBAR_MARGIN = 4;
export const SCROLLBAR_WIDTH = 6;
diff --git a/packages/excalidraw/scene/selection.ts b/packages/excalidraw/scene/selection.ts
index deec19406e..547416c72d 100644
--- a/packages/excalidraw/scene/selection.ts
+++ b/packages/excalidraw/scene/selection.ts
@@ -1,11 +1,11 @@
-import {
+import type {
ElementsMap,
ElementsMapOrArray,
ExcalidrawElement,
NonDeletedExcalidrawElement,
} from "../element/types";
import { getElementAbsoluteCoords, getElementBounds } from "../element";
-import { AppState, InteractiveCanvasAppState } from "../types";
+import type { AppState, InteractiveCanvasAppState } from "../types";
import { isBoundToContainer, isFrameLikeElement } from "../element/typeChecks";
import {
elementOverlapsWithFrame,
diff --git a/packages/excalidraw/scene/types.ts b/packages/excalidraw/scene/types.ts
index f6563695dc..532e8b89cb 100644
--- a/packages/excalidraw/scene/types.ts
+++ b/packages/excalidraw/scene/types.ts
@@ -1,13 +1,13 @@
import type { RoughCanvas } from "roughjs/bin/canvas";
-import { Drawable } from "roughjs/bin/core";
-import {
+import type { Drawable } from "roughjs/bin/core";
+import type {
ExcalidrawElement,
ExcalidrawTextElement,
NonDeletedElementsMap,
NonDeletedExcalidrawElement,
NonDeletedSceneElementsMap,
} from "../element/types";
-import {
+import type {
AppClassProperties,
AppState,
EmbedsValidationStatus,
@@ -18,7 +18,7 @@ import {
UserIdleState,
Device,
} from "../types";
-import { MakeBrand } from "../utility-types";
+import type { MakeBrand } from "../utility-types";
export type RenderableElementsMap = NonDeletedElementsMap &
MakeBrand<"RenderableElementsMap">;
diff --git a/packages/excalidraw/scene/zoom.ts b/packages/excalidraw/scene/zoom.ts
index 59b6afe141..7551dd3193 100644
--- a/packages/excalidraw/scene/zoom.ts
+++ b/packages/excalidraw/scene/zoom.ts
@@ -1,5 +1,5 @@
import { MIN_ZOOM } from "../constants";
-import { AppState, NormalizedZoomValue } from "../types";
+import type { AppState, NormalizedZoomValue } from "../types";
export const getNormalizedZoom = (zoom: number): NormalizedZoomValue => {
return Math.max(MIN_ZOOM, Math.min(zoom, 30)) as NormalizedZoomValue;
diff --git a/packages/excalidraw/snapping.ts b/packages/excalidraw/snapping.ts
index bc83d0057a..2052ccdc9d 100644
--- a/packages/excalidraw/snapping.ts
+++ b/packages/excalidraw/snapping.ts
@@ -1,13 +1,13 @@
import { TOOL_TYPE } from "./constants";
+import type { Bounds } from "./element/bounds";
import {
- Bounds,
getCommonBounds,
getDraggedElementsBounds,
getElementAbsoluteCoords,
} from "./element/bounds";
-import { MaybeTransformHandleType } from "./element/transformHandles";
+import type { MaybeTransformHandleType } from "./element/transformHandles";
import { isBoundToContainer, isFrameLikeElement } from "./element/typeChecks";
-import {
+import type {
ElementsMap,
ExcalidrawElement,
NonDeletedExcalidrawElement,
@@ -19,7 +19,7 @@ import {
getSelectedElements,
getVisibleAndNonSelectedElements,
} from "./scene/selection";
-import { AppState, KeyboardModifiersObject, Point } from "./types";
+import type { AppState, KeyboardModifiersObject, Point } from "./types";
const SNAP_DISTANCE = 8;
diff --git a/packages/excalidraw/store.ts b/packages/excalidraw/store.ts
index 8200eab8c6..62223a8b50 100644
--- a/packages/excalidraw/store.ts
+++ b/packages/excalidraw/store.ts
@@ -3,9 +3,9 @@ import { AppStateChange, ElementsChange } from "./change";
import { ENV } from "./constants";
import { newElementWith } from "./element/mutateElement";
import { deepCopyElement } from "./element/newElement";
-import { OrderedExcalidrawElement } from "./element/types";
+import type { OrderedExcalidrawElement } from "./element/types";
import { Emitter } from "./emitter";
-import { AppState, ObservedAppState } from "./types";
+import type { AppState, ObservedAppState } from "./types";
import { isShallowEqual } from "./utils";
// hidden non-enumerable property for runtime checks
diff --git a/packages/excalidraw/tests/appState.test.tsx b/packages/excalidraw/tests/appState.test.tsx
index dae248ae8a..251cd3cbc0 100644
--- a/packages/excalidraw/tests/appState.test.tsx
+++ b/packages/excalidraw/tests/appState.test.tsx
@@ -5,7 +5,7 @@ import { API } from "./helpers/api";
import { getDefaultAppState } from "../appState";
import { EXPORT_DATA_TYPES, MIME_TYPES } from "../constants";
import { Pointer, UI } from "./helpers/ui";
-import { ExcalidrawTextElement } from "../element/types";
+import type { ExcalidrawTextElement } from "../element/types";
const { h } = window;
diff --git a/packages/excalidraw/tests/clipboard.test.tsx b/packages/excalidraw/tests/clipboard.test.tsx
index 1a6fe47bed..4d4717063e 100644
--- a/packages/excalidraw/tests/clipboard.test.tsx
+++ b/packages/excalidraw/tests/clipboard.test.tsx
@@ -9,7 +9,7 @@ import {
getLineHeightInPx,
} from "../element/textElement";
import { getElementBounds } from "../element";
-import { NormalizedZoomValue } from "../types";
+import type { NormalizedZoomValue } from "../types";
import { API } from "./helpers/api";
import { createPasteEvent, serializeAsClipboardJSON } from "../clipboard";
import { arrayToMap } from "../utils";
diff --git a/packages/excalidraw/tests/contextmenu.test.tsx b/packages/excalidraw/tests/contextmenu.test.tsx
index 89ad68f739..9a9bb50afa 100644
--- a/packages/excalidraw/tests/contextmenu.test.tsx
+++ b/packages/excalidraw/tests/contextmenu.test.tsx
@@ -16,7 +16,7 @@ import * as StaticScene from "../renderer/staticScene";
import { reseed } from "../random";
import { UI, Pointer, Keyboard } from "./helpers/ui";
import { KEYS } from "../keys";
-import { ShortcutName } from "../actions/shortcuts";
+import type { ShortcutName } from "../actions/shortcuts";
import { copiedStyles } from "../actions/actionStyles";
import { API } from "./helpers/api";
import { setDateTimeForTests } from "../utils";
diff --git a/packages/excalidraw/tests/data/reconcile.test.ts b/packages/excalidraw/tests/data/reconcile.test.ts
index a6912699fd..9770a79d8d 100644
--- a/packages/excalidraw/tests/data/reconcile.test.ts
+++ b/packages/excalidraw/tests/data/reconcile.test.ts
@@ -1,14 +1,12 @@
-import {
- RemoteExcalidrawElement,
- reconcileElements,
-} from "../../data/reconcile";
-import {
+import type { RemoteExcalidrawElement } from "../../data/reconcile";
+import { reconcileElements } from "../../data/reconcile";
+import type {
ExcalidrawElement,
OrderedExcalidrawElement,
} from "../../element/types";
import { syncInvalidIndices } from "../../fractionalIndex";
import { randomInteger } from "../../random";
-import { AppState } from "../../types";
+import type { AppState } from "../../types";
import { cloneJSON } from "../../utils";
type Id = string;
diff --git a/packages/excalidraw/tests/data/restore.test.ts b/packages/excalidraw/tests/data/restore.test.ts
index 973a1ee1d9..ef1e3198ba 100644
--- a/packages/excalidraw/tests/data/restore.test.ts
+++ b/packages/excalidraw/tests/data/restore.test.ts
@@ -1,5 +1,5 @@
import * as restore from "../../data/restore";
-import {
+import type {
ExcalidrawElement,
ExcalidrawFreeDrawElement,
ExcalidrawLinearElement,
@@ -8,8 +8,8 @@ import {
import * as sizeHelpers from "../../element/sizeHelpers";
import { API } from "../helpers/api";
import { getDefaultAppState } from "../../appState";
-import { ImportedDataState } from "../../data/types";
-import { NormalizedZoomValue } from "../../types";
+import type { ImportedDataState } from "../../data/types";
+import type { NormalizedZoomValue } from "../../types";
import { DEFAULT_SIDEBAR, FONT_FAMILY, ROUNDNESS } from "../../constants";
import { newElementWith } from "../../element/mutateElement";
import { vi } from "vitest";
diff --git a/packages/excalidraw/tests/dragCreate.test.tsx b/packages/excalidraw/tests/dragCreate.test.tsx
index 7bde27b1c6..933c96ef7c 100644
--- a/packages/excalidraw/tests/dragCreate.test.tsx
+++ b/packages/excalidraw/tests/dragCreate.test.tsx
@@ -9,7 +9,7 @@ import {
mockBoundingClientRect,
restoreOriginalGetBoundingClientRect,
} from "./test-utils";
-import { ExcalidrawLinearElement } from "../element/types";
+import type { ExcalidrawLinearElement } from "../element/types";
import { reseed } from "../random";
import { vi } from "vitest";
diff --git a/packages/excalidraw/tests/export.test.tsx b/packages/excalidraw/tests/export.test.tsx
index 4e4c7b76c5..3c299fbd1a 100644
--- a/packages/excalidraw/tests/export.test.tsx
+++ b/packages/excalidraw/tests/export.test.tsx
@@ -8,7 +8,7 @@ import {
} from "../data/image";
import { serializeAsJSON } from "../data/json";
import { exportToSvg } from "../scene/export";
-import { FileId } from "../element/types";
+import type { FileId } from "../element/types";
import { getDataURL } from "../data/blob";
import { getDefaultAppState } from "../appState";
diff --git a/packages/excalidraw/tests/fixtures/elementFixture.ts b/packages/excalidraw/tests/fixtures/elementFixture.ts
index a22cfd45de..a56da84a96 100644
--- a/packages/excalidraw/tests/fixtures/elementFixture.ts
+++ b/packages/excalidraw/tests/fixtures/elementFixture.ts
@@ -1,4 +1,4 @@
-import { ExcalidrawElement } from "../../element/types";
+import type { ExcalidrawElement } from "../../element/types";
const elementBase: Omit<ExcalidrawElement, "type"> = {
id: "vWrqOAfkind2qcm7LDAGZ",
diff --git a/packages/excalidraw/tests/flip.test.tsx b/packages/excalidraw/tests/flip.test.tsx
index b51e12f26b..621c31bdf8 100644
--- a/packages/excalidraw/tests/flip.test.tsx
+++ b/packages/excalidraw/tests/flip.test.tsx
@@ -10,7 +10,7 @@ import { UI, Pointer, Keyboard } from "./helpers/ui";
import { API } from "./helpers/api";
import { actionFlipHorizontal, actionFlipVertical } from "../actions";
import { getElementAbsoluteCoords } from "../element";
-import {
+import type {
ExcalidrawElement,
ExcalidrawImageElement,
ExcalidrawLinearElement,
@@ -20,7 +20,7 @@ import {
import { newLinearElement } from "../element";
import { Excalidraw } from "../index";
import { mutateElement } from "../element/mutateElement";
-import { NormalizedZoomValue } from "../types";
+import type { NormalizedZoomValue } from "../types";
import { ROUNDNESS } from "../constants";
import { vi } from "vitest";
import * as blob from "../data/blob";
diff --git a/packages/excalidraw/tests/fractionalIndex.test.ts b/packages/excalidraw/tests/fractionalIndex.test.ts
index b4d19aadcf..2875fd0fbd 100644
--- a/packages/excalidraw/tests/fractionalIndex.test.ts
+++ b/packages/excalidraw/tests/fractionalIndex.test.ts
@@ -7,7 +7,7 @@ import {
import { API } from "./helpers/api";
import { arrayToMap } from "../utils";
import { InvalidFractionalIndexError } from "../errors";
-import { ExcalidrawElement, FractionalIndex } from "../element/types";
+import type { ExcalidrawElement, FractionalIndex } from "../element/types";
import { deepCopyElement } from "../element/newElement";
import { generateKeyBetween } from "fractional-indexing";
diff --git a/packages/excalidraw/tests/helpers/api.ts b/packages/excalidraw/tests/helpers/api.ts
index 4b54fad591..f44d780407 100644
--- a/packages/excalidraw/tests/helpers/api.ts
+++ b/packages/excalidraw/tests/helpers/api.ts
@@ -1,4 +1,4 @@
-import {
+import type {
ExcalidrawElement,
ExcalidrawGenericElement,
ExcalidrawTextElement,
@@ -26,10 +26,10 @@ import {
newImageElement,
newMagicFrameElement,
} from "../../element/newElement";
-import { Point } from "../../types";
+import type { Point } from "../../types";
import { getSelectedElements } from "../../scene/selection";
import { isLinearElementType } from "../../element/typeChecks";
-import { Mutable } from "../../utility-types";
+import type { Mutable } from "../../utility-types";
import { assertNever } from "../../utils";
import { createTestHook } from "../../components/App";
diff --git a/packages/excalidraw/tests/helpers/ui.ts b/packages/excalidraw/tests/helpers/ui.ts
index 558bf9b4d6..217510dcf8 100644
--- a/packages/excalidraw/tests/helpers/ui.ts
+++ b/packages/excalidraw/tests/helpers/ui.ts
@@ -10,12 +10,12 @@ import type {
ExcalidrawTextContainer,
ExcalidrawTextElementWithContainer,
} from "../../element/types";
+import type { TransformHandleType } from "../../element/transformHandles";
import {
getTransformHandles,
getTransformHandlesFromCoords,
OMIT_SIDES_FOR_FRAME,
OMIT_SIDES_FOR_MULTIPLE_ELEMENTS,
- TransformHandleType,
type TransformHandle,
type TransformHandleDirection,
} from "../../element/transformHandles";
diff --git a/packages/excalidraw/tests/history.test.tsx b/packages/excalidraw/tests/history.test.tsx
index e8fa06aa03..453401a950 100644
--- a/packages/excalidraw/tests/history.test.tsx
+++ b/packages/excalidraw/tests/history.test.tsx
@@ -13,7 +13,7 @@ import { getDefaultAppState } from "../appState";
import { fireEvent, waitFor } from "@testing-library/react";
import { createUndoAction, createRedoAction } from "../actions/actionHistory";
import { EXPORT_DATA_TYPES, MIME_TYPES } from "../constants";
-import { AppState, ExcalidrawImperativeAPI } from "../types";
+import type { AppState, ExcalidrawImperativeAPI } from "../types";
import { arrayToMap, resolvablePromise } from "../utils";
import {
COLOR_PALETTE,
@@ -22,7 +22,7 @@ import {
} from "../colors";
import { KEYS } from "../keys";
import { newElementWith } from "../element/mutateElement";
-import {
+import type {
ExcalidrawFrameElement,
ExcalidrawGenericElement,
ExcalidrawLinearElement,
diff --git a/packages/excalidraw/tests/library.test.tsx b/packages/excalidraw/tests/library.test.tsx
index 79fc5088c5..9d8fd9dc9e 100644
--- a/packages/excalidraw/tests/library.test.tsx
+++ b/packages/excalidraw/tests/library.test.tsx
@@ -5,11 +5,11 @@ import { queryByTestId } from "@testing-library/react";
import { Excalidraw } from "../index";
import { API } from "./helpers/api";
import { MIME_TYPES } from "../constants";
-import { LibraryItem, LibraryItems } from "../types";
+import type { LibraryItem, LibraryItems } from "../types";
import { UI } from "./helpers/ui";
import { serializeLibraryAsJSON } from "../data/json";
import { distributeLibraryItemsOnSquareGrid } from "../data/library";
-import { ExcalidrawGenericElement } from "../element/types";
+import type { ExcalidrawGenericElement } from "../element/types";
import { getCommonBoundingBox } from "../element/bounds";
import { parseLibraryJSON } from "../data/blob";
diff --git a/packages/excalidraw/tests/linearElementEditor.test.tsx b/packages/excalidraw/tests/linearElementEditor.test.tsx
index 01adc3cb3f..f2337bee2e 100644
--- a/packages/excalidraw/tests/linearElementEditor.test.tsx
+++ b/packages/excalidraw/tests/linearElementEditor.test.tsx
@@ -1,5 +1,5 @@
import ReactDOM from "react-dom";
-import {
+import type {
ExcalidrawElement,
ExcalidrawLinearElement,
ExcalidrawTextElementWithContainer,
@@ -14,7 +14,7 @@ import * as InteractiveCanvas from "../renderer/interactiveScene";
import { Keyboard, Pointer, UI } from "./helpers/ui";
import { screen, render, fireEvent, GlobalTestState } from "./test-utils";
import { API } from "../tests/helpers/api";
-import { Point } from "../types";
+import type { Point } from "../types";
import { KEYS } from "../keys";
import { LinearElementEditor } from "../element/linearElementEditor";
import { queryByTestId, queryByText } from "@testing-library/react";
diff --git a/packages/excalidraw/tests/move.test.tsx b/packages/excalidraw/tests/move.test.tsx
index dfa365d325..6e0ef90274 100644
--- a/packages/excalidraw/tests/move.test.tsx
+++ b/packages/excalidraw/tests/move.test.tsx
@@ -5,7 +5,7 @@ import * as StaticScene from "../renderer/staticScene";
import * as InteractiveCanvas from "../renderer/interactiveScene";
import { reseed } from "../random";
import { bindOrUnbindLinearElement } from "../element/binding";
-import {
+import type {
ExcalidrawLinearElement,
NonDeleted,
ExcalidrawRectangleElement,
diff --git a/packages/excalidraw/tests/multiPointCreate.test.tsx b/packages/excalidraw/tests/multiPointCreate.test.tsx
index bc8c7843d4..0bfa4f1477 100644
--- a/packages/excalidraw/tests/multiPointCreate.test.tsx
+++ b/packages/excalidraw/tests/multiPointCreate.test.tsx
@@ -9,7 +9,7 @@ import { Excalidraw } from "../index";
import * as StaticScene from "../renderer/staticScene";
import * as InteractiveCanvas from "../renderer/interactiveScene";
import { KEYS } from "../keys";
-import { ExcalidrawLinearElement } from "../element/types";
+import type { ExcalidrawLinearElement } from "../element/types";
import { reseed } from "../random";
import { vi } from "vitest";
diff --git a/packages/excalidraw/tests/packages/events.test.tsx b/packages/excalidraw/tests/packages/events.test.tsx
index 3d57c343fa..09c734f280 100644
--- a/packages/excalidraw/tests/packages/events.test.tsx
+++ b/packages/excalidraw/tests/packages/events.test.tsx
@@ -1,6 +1,6 @@
import { vi } from "vitest";
import { Excalidraw, StoreAction } from "../../index";
-import { ExcalidrawImperativeAPI } from "../../types";
+import type { ExcalidrawImperativeAPI } from "../../types";
import { resolvablePromise } from "../../utils";
import { render } from "../test-utils";
import { Pointer } from "../helpers/ui";
diff --git a/packages/excalidraw/tests/queries/toolQueries.ts b/packages/excalidraw/tests/queries/toolQueries.ts
index a6a378e7ec..df0afa1178 100644
--- a/packages/excalidraw/tests/queries/toolQueries.ts
+++ b/packages/excalidraw/tests/queries/toolQueries.ts
@@ -1,5 +1,5 @@
import { queries, buildQueries } from "@testing-library/react";
-import { ToolType } from "../../types";
+import type { ToolType } from "../../types";
import { TOOL_TYPE } from "../../constants";
const _getAllByToolName = (container: HTMLElement, tool: ToolType | "lock") => {
diff --git a/packages/excalidraw/tests/regressionTests.test.tsx b/packages/excalidraw/tests/regressionTests.test.tsx
index 6b0d913f77..0c9c4a826d 100644
--- a/packages/excalidraw/tests/regressionTests.test.tsx
+++ b/packages/excalidraw/tests/regressionTests.test.tsx
@@ -1,5 +1,5 @@
import ReactDOM from "react-dom";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
import { CODES, KEYS } from "../keys";
import { Excalidraw } from "../index";
import { reseed } from "../random";
diff --git a/packages/excalidraw/tests/resize.test.tsx b/packages/excalidraw/tests/resize.test.tsx
index 3673acfa98..2112031812 100644
--- a/packages/excalidraw/tests/resize.test.tsx
+++ b/packages/excalidraw/tests/resize.test.tsx
@@ -7,7 +7,8 @@ import type {
ExcalidrawLinearElement,
} from "../element/types";
import type { Point } from "../types";
-import { Bounds, getElementPointsCoords } from "../element/bounds";
+import type { Bounds } from "../element/bounds";
+import { getElementPointsCoords } from "../element/bounds";
import { Excalidraw } from "../index";
import { API } from "./helpers/api";
import { KEYS } from "../keys";
diff --git a/packages/excalidraw/tests/scene/export.test.ts b/packages/excalidraw/tests/scene/export.test.ts
index d5695fd5d9..cdae82e942 100644
--- a/packages/excalidraw/tests/scene/export.test.ts
+++ b/packages/excalidraw/tests/scene/export.test.ts
@@ -1,4 +1,4 @@
-import { NonDeletedExcalidrawElement } from "../../element/types";
+import type { NonDeletedExcalidrawElement } from "../../element/types";
import * as exportUtils from "../../scene/export";
import {
diamondFixture,
diff --git a/packages/excalidraw/tests/test-utils.ts b/packages/excalidraw/tests/test-utils.ts
index 032615be72..c1e8af40f5 100644
--- a/packages/excalidraw/tests/test-utils.ts
+++ b/packages/excalidraw/tests/test-utils.ts
@@ -1,21 +1,15 @@
import "pepjs";
-import {
- render,
- queries,
- RenderResult,
- RenderOptions,
- waitFor,
- fireEvent,
-} from "@testing-library/react";
+import type { RenderResult, RenderOptions } from "@testing-library/react";
+import { render, queries, waitFor, fireEvent } from "@testing-library/react";
import * as toolQueries from "./queries/toolQueries";
-import { ImportedDataState } from "../data/types";
+import type { ImportedDataState } from "../data/types";
import { STORAGE_KEYS } from "../../../excalidraw-app/app_constants";
-import { SceneData } from "../types";
+import type { SceneData } from "../types";
import { getSelectedElements } from "../scene/selection";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
import { UI } from "./helpers/ui";
const customQueries = {
diff --git a/packages/excalidraw/tests/tool.test.tsx b/packages/excalidraw/tests/tool.test.tsx
index ff7d99db1a..f1c91899f3 100644
--- a/packages/excalidraw/tests/tool.test.tsx
+++ b/packages/excalidraw/tests/tool.test.tsx
@@ -1,5 +1,5 @@
import { Excalidraw } from "../index";
-import { ExcalidrawImperativeAPI } from "../types";
+import type { ExcalidrawImperativeAPI } from "../types";
import { resolvablePromise } from "../utils";
import { render } from "./test-utils";
import { Pointer } from "./helpers/ui";
diff --git a/packages/excalidraw/tests/zindex.test.tsx b/packages/excalidraw/tests/zindex.test.tsx
index b1d3302ce5..09f47d4667 100644
--- a/packages/excalidraw/tests/zindex.test.tsx
+++ b/packages/excalidraw/tests/zindex.test.tsx
@@ -9,10 +9,10 @@ import {
actionSendToBack,
actionDuplicateSelection,
} from "../actions";
-import { AppState } from "../types";
+import type { AppState } from "../types";
import { API } from "./helpers/api";
import { selectGroupsForSelectedElements } from "../groups";
-import {
+import type {
ExcalidrawElement,
ExcalidrawFrameElement,
ExcalidrawSelectionElement,
diff --git a/packages/excalidraw/types.ts b/packages/excalidraw/types.ts
index 6ce687a139..a9cc47d974 100644
--- a/packages/excalidraw/types.ts
+++ b/packages/excalidraw/types.ts
@@ -1,5 +1,5 @@
-import React from "react";
-import {
+import type React from "react";
+import type {
PointerType,
ExcalidrawLinearElement,
NonDeletedExcalidrawElement,
@@ -22,25 +22,25 @@ import {
ExcalidrawIframeLikeElement,
OrderedExcalidrawElement,
} from "./element/types";
-import { Action } from "./actions/types";
-import { Point as RoughPoint } from "roughjs/bin/geometry";
-import { LinearElementEditor } from "./element/linearElementEditor";
-import { SuggestedBinding } from "./element/binding";
-import { ImportedDataState } from "./data/types";
+import type { Action } from "./actions/types";
+import type { Point as RoughPoint } from "roughjs/bin/geometry";
+import type { LinearElementEditor } from "./element/linearElementEditor";
+import type { SuggestedBinding } from "./element/binding";
+import type { ImportedDataState } from "./data/types";
import type App from "./components/App";
import type { throttleRAF } from "./utils";
-import { Spreadsheet } from "./charts";
-import { Language } from "./i18n";
-import { ClipboardData } from "./clipboard";
-import { isOverScrollBars } from "./scene/scrollbars";
-import { MaybeTransformHandleType } from "./element/transformHandles";
-import Library from "./data/library";
+import type { Spreadsheet } from "./charts";
+import type { Language } from "./i18n";
+import type { ClipboardData } from "./clipboard";
+import type { isOverScrollBars } from "./scene/scrollbars";
+import type { MaybeTransformHandleType } from "./element/transformHandles";
+import type Library from "./data/library";
import type { FileSystemHandle } from "./data/filesystem";
import type { IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
-import { ContextMenuItems } from "./components/ContextMenu";
-import { SnapLine } from "./snapping";
-import { Merge, MaybePromise, ValueOf } from "./utility-types";
-import { StoreActionType } from "./store";
+import type { ContextMenuItems } from "./components/ContextMenu";
+import type { SnapLine } from "./snapping";
+import type { Merge, MaybePromise, ValueOf } from "./utility-types";
+import type { StoreActionType } from "./store";
export type Point = Readonly<RoughPoint>;
diff --git a/packages/excalidraw/utils.ts b/packages/excalidraw/utils.ts
index 203a8c3f04..d723a59666 100644
--- a/packages/excalidraw/utils.ts
+++ b/packages/excalidraw/utils.ts
@@ -1,20 +1,20 @@
import { COLOR_PALETTE } from "./colors";
+import type { EVENT } from "./constants";
import {
DEFAULT_VERSION,
- EVENT,
FONT_FAMILY,
isDarwin,
WINDOWS_EMOJI_FALLBACK_FONT,
} from "./constants";
-import { FontFamilyValues, FontString } from "./element/types";
-import {
+import type { FontFamilyValues, FontString } from "./element/types";
+import type {
ActiveTool,
AppState,
ToolType,
UnsubscribeCallback,
Zoom,
} from "./types";
-import { MaybePromise, ResolutionType } from "./utility-types";
+import type { MaybePromise, ResolutionType } from "./utility-types";
let mockDateTime: string | null = null;
diff --git a/packages/excalidraw/zindex.ts b/packages/excalidraw/zindex.ts
index 8b66ab6714..f82fe13a62 100644
--- a/packages/excalidraw/zindex.ts
+++ b/packages/excalidraw/zindex.ts
@@ -1,10 +1,13 @@
import { isFrameLikeElement } from "./element/typeChecks";
-import { ExcalidrawElement, ExcalidrawFrameLikeElement } from "./element/types";
+import type {
+ ExcalidrawElement,
+ ExcalidrawFrameLikeElement,
+} from "./element/types";
import { syncMovedIndices } from "./fractionalIndex";
import { getElementsInGroup } from "./groups";
import { getSelectedElements } from "./scene";
import Scene from "./scene/Scene";
-import { AppState } from "./types";
+import type { AppState } from "./types";
import { arrayToMap, findIndex, findLastIndex } from "./utils";
const isOfTargetFrame = (element: ExcalidrawElement, frameId: string) => {
diff --git a/packages/utils/bbox.ts b/packages/utils/bbox.ts
index 5fc6192df2..e662a5a8c6 100644
--- a/packages/utils/bbox.ts
+++ b/packages/utils/bbox.ts
@@ -1,5 +1,5 @@
-import { Bounds } from "../excalidraw/element/bounds";
-import { Point } from "../excalidraw/types";
+import type { Bounds } from "../excalidraw/element/bounds";
+import type { Point } from "../excalidraw/types";
export type LineSegment = [Point, Point];
diff --git a/packages/utils/collision.ts b/packages/utils/collision.ts
index 777ba962ad..e369753996 100644
--- a/packages/utils/collision.ts
+++ b/packages/utils/collision.ts
@@ -1,4 +1,4 @@
-import { Point, Polygon, GeometricShape } from "./geometry/shape";
+import type { Point, Polygon, GeometricShape } from "./geometry/shape";
import {
pointInEllipse,
pointInPolygon,
diff --git a/packages/utils/export.ts b/packages/utils/export.ts
index 5bdddba4f2..cc812d7c48 100644
--- a/packages/utils/export.ts
+++ b/packages/utils/export.ts
@@ -3,8 +3,8 @@ import {
exportToSvg as _exportToSvg,
} from "../excalidraw/scene/export";
import { getDefaultAppState } from "../excalidraw/appState";
-import { AppState, BinaryFiles } from "../excalidraw/types";
-import {
+import type { AppState, BinaryFiles } from "../excalidraw/types";
+import type {
ExcalidrawElement,
ExcalidrawFrameLikeElement,
NonDeleted,
diff --git a/packages/utils/geometry/geometry.test.ts b/packages/utils/geometry/geometry.test.ts
index a0103deee1..0a75aae532 100644
--- a/packages/utils/geometry/geometry.test.ts
+++ b/packages/utils/geometry/geometry.test.ts
@@ -12,7 +12,7 @@ import {
pointRightofLine,
pointRotate,
} from "./geometry";
-import { Curve, Ellipse, Line, Point, Polygon, Polyline } from "./shape";
+import type { Curve, Ellipse, Line, Point, Polygon, Polyline } from "./shape";
describe("point and line", () => {
const line: Line = [
diff --git a/packages/utils/geometry/geometry.ts b/packages/utils/geometry/geometry.ts
index 000f33a239..4216fe0eb2 100644
--- a/packages/utils/geometry/geometry.ts
+++ b/packages/utils/geometry/geometry.ts
@@ -1,5 +1,5 @@
import { distance2d } from "../../excalidraw/math";
-import {
+import type {
Point,
Line,
Polygon,
diff --git a/packages/utils/geometry/shape.ts b/packages/utils/geometry/shape.ts
index 53ab9ff8e2..d14456ea44 100644
--- a/packages/utils/geometry/shape.ts
+++ b/packages/utils/geometry/shape.ts
@@ -13,7 +13,7 @@
*/
import { getElementAbsoluteCoords } from "../../excalidraw/element";
-import {
+import type {
ElementsMap,
ExcalidrawDiamondElement,
ExcalidrawElement,
diff --git a/packages/utils/utils.unmocked.test.ts b/packages/utils/utils.unmocked.test.ts
index ae2fce8b7d..ca47278556 100644
--- a/packages/utils/utils.unmocked.test.ts
+++ b/packages/utils/utils.unmocked.test.ts
@@ -1,5 +1,5 @@
import { decodePngMetadata, decodeSvgMetadata } from "../excalidraw/data/image";
-import { ImportedDataState } from "../excalidraw/data/types";
+import type { ImportedDataState } from "../excalidraw/data/types";
import * as utils from "../utils";
import { API } from "../excalidraw/tests/helpers/api";
diff --git a/packages/utils/withinBounds.test.ts b/packages/utils/withinBounds.test.ts
index 43bf5d6e8d..d0cc5e339e 100644
--- a/packages/utils/withinBounds.test.ts
+++ b/packages/utils/withinBounds.test.ts
@@ -1,4 +1,4 @@
-import { Bounds } from "../excalidraw/element/bounds";
+import type { Bounds } from "../excalidraw/element/bounds";
import { API } from "../excalidraw/tests/helpers/api";
import {
elementPartiallyOverlapsWithOrContainsBBox,
diff --git a/packages/utils/withinBounds.ts b/packages/utils/withinBounds.ts
index 6a380d9c31..02d3162432 100644
--- a/packages/utils/withinBounds.ts
+++ b/packages/utils/withinBounds.ts
@@ -13,7 +13,8 @@ import {
} from "../excalidraw/element/typeChecks";
import { isValueInRange, rotatePoint } from "../excalidraw/math";
import type { Point } from "../excalidraw/types";
-import { Bounds, getElementBounds } from "../excalidraw/element/bounds";
+import type { Bounds } from "../excalidraw/element/bounds";
+import { getElementBounds } from "../excalidraw/element/bounds";
import { arrayToMap } from "../excalidraw/utils";
type Element = NonDeletedExcalidrawElement;