Browse Source

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

* build: enable consistent type imports eslint rule

* change to warn

* fix the warning in example and excalidraw-app

* fix packages

* enable type annotations and throw error for the rule
Aakansha Doshi 1 năm trước cách đây
mục cha
commit
1ed53b153c
100 tập tin đã thay đổi với 276 bổ sung273 xóa
  1. 2 1
      .eslintrc.json
  2. 1 1
      examples/excalidraw/components/App.tsx
  3. 1 1
      examples/excalidraw/components/MobileFooter.tsx
  4. 1 1
      examples/excalidraw/utils.ts
  5. 7 10
      excalidraw-app/App.tsx
  6. 2 2
      excalidraw-app/CustomStats.tsx
  7. 9 7
      excalidraw-app/collab/Collab.tsx
  8. 5 5
      excalidraw-app/collab/Portal.tsx
  9. 1 1
      excalidraw-app/components/AppMainMenu.tsx
  10. 2 2
      excalidraw-app/components/ExportToExcalidrawPlus.tsx
  11. 1 1
      excalidraw-app/components/GitHubCorner.tsx
  12. 2 2
      excalidraw-app/data/FileManager.ts
  13. 5 5
      excalidraw-app/data/LocalData.ts
  14. 6 5
      excalidraw-app/data/firebase.ts
  15. 6 6
      excalidraw-app/data/index.ts
  16. 2 2
      excalidraw-app/data/localStorage.ts
  17. 2 1
      excalidraw-app/share/ShareDialog.tsx
  18. 1 1
      excalidraw-app/useHandleAppTheme.ts
  19. 4 3
      packages/excalidraw/actions/actionAlign.tsx
  20. 3 3
      packages/excalidraw/actions/actionBoundText.tsx
  21. 3 3
      packages/excalidraw/actions/actionCanvas.tsx
  22. 2 2
      packages/excalidraw/actions/actionDeleteSelected.tsx
  23. 4 3
      packages/excalidraw/actions/actionDistribute.tsx
  24. 3 3
      packages/excalidraw/actions/actionDuplicateSelection.tsx
  25. 1 1
      packages/excalidraw/actions/actionElementLock.ts
  26. 1 1
      packages/excalidraw/actions/actionExport.tsx
  27. 1 1
      packages/excalidraw/actions/actionFinalize.tsx
  28. 2 2
      packages/excalidraw/actions/actionFlip.ts
  29. 2 2
      packages/excalidraw/actions/actionFrame.ts
  30. 2 2
      packages/excalidraw/actions/actionGroup.tsx
  31. 7 5
      packages/excalidraw/actions/actionHistory.tsx
  32. 1 1
      packages/excalidraw/actions/actionLinearEditor.tsx
  33. 2 2
      packages/excalidraw/actions/actionNavigate.tsx
  34. 2 2
      packages/excalidraw/actions/actionProperties.tsx
  35. 1 1
      packages/excalidraw/actions/actionSelectAll.ts
  36. 1 1
      packages/excalidraw/actions/actionStyles.ts
  37. 1 1
      packages/excalidraw/actions/actionToggleGridMode.tsx
  38. 6 3
      packages/excalidraw/actions/manager.tsx
  39. 1 1
      packages/excalidraw/actions/register.ts
  40. 2 2
      packages/excalidraw/actions/shortcuts.ts
  41. 8 5
      packages/excalidraw/actions/types.ts
  42. 3 2
      packages/excalidraw/align.ts
  43. 4 3
      packages/excalidraw/animated-trail.ts
  44. 1 1
      packages/excalidraw/appState.ts
  45. 6 10
      packages/excalidraw/change.ts
  46. 2 6
      packages/excalidraw/charts.test.ts
  47. 1 1
      packages/excalidraw/charts.ts
  48. 3 3
      packages/excalidraw/clients.ts
  49. 4 3
      packages/excalidraw/clipboard.ts
  50. 1 1
      packages/excalidraw/colors.ts
  51. 3 3
      packages/excalidraw/components/Actions.tsx
  52. 23 25
      packages/excalidraw/components/App.tsx
  53. 2 4
      packages/excalidraw/components/ColorPicker/ColorInput.tsx
  54. 6 7
      packages/excalidraw/components/ColorPicker/ColorPicker.tsx
  55. 3 3
      packages/excalidraw/components/ColorPicker/Picker.tsx
  56. 3 2
      packages/excalidraw/components/ColorPicker/PickerColorList.tsx
  57. 1 1
      packages/excalidraw/components/ColorPicker/PickerHeading.tsx
  58. 1 1
      packages/excalidraw/components/ColorPicker/ShadeList.tsx
  59. 1 1
      packages/excalidraw/components/ColorPicker/TopPicks.tsx
  60. 3 6
      packages/excalidraw/components/ColorPicker/colorPickerUtils.ts
  61. 4 5
      packages/excalidraw/components/ColorPicker/keyboardNavHandlers.ts
  62. 8 9
      packages/excalidraw/components/CommandPalette/CommandPalette.tsx
  63. 1 1
      packages/excalidraw/components/CommandPalette/defaultCommandPaletteItems.ts
  64. 3 3
      packages/excalidraw/components/CommandPalette/types.ts
  65. 2 1
      packages/excalidraw/components/ConfirmDialog.tsx
  66. 6 7
      packages/excalidraw/components/ContextMenu.tsx
  67. 1 1
      packages/excalidraw/components/DarkModeToggle.tsx
  68. 2 2
      packages/excalidraw/components/DefaultSidebar.tsx
  69. 1 1
      packages/excalidraw/components/DialogActionButton.tsx
  70. 2 2
      packages/excalidraw/components/EyeDropper.tsx
  71. 1 1
      packages/excalidraw/components/FollowMode/FollowMode.tsx
  72. 1 1
      packages/excalidraw/components/HintViewer.tsx
  73. 1 1
      packages/excalidraw/components/ImageExportDialog.tsx
  74. 3 2
      packages/excalidraw/components/InitializeApp.tsx
  75. 3 3
      packages/excalidraw/components/JSONExportDialog.tsx
  76. 1 1
      packages/excalidraw/components/LaserPointerButton.tsx
  77. 5 4
      packages/excalidraw/components/LayerUI.tsx
  78. 4 3
      packages/excalidraw/components/LibraryMenu.tsx
  79. 1 1
      packages/excalidraw/components/LibraryMenuBrowseButton.tsx
  80. 1 1
      packages/excalidraw/components/LibraryMenuControlButtons.tsx
  81. 3 2
      packages/excalidraw/components/LibraryMenuHeaderContent.tsx
  82. 1 1
      packages/excalidraw/components/LibraryMenuItems.tsx
  83. 5 4
      packages/excalidraw/components/LibraryMenuSection.tsx
  84. 3 2
      packages/excalidraw/components/LibraryUnit.tsx
  85. 1 1
      packages/excalidraw/components/LoadingMessage.tsx
  86. 1 1
      packages/excalidraw/components/LockButton.tsx
  87. 1 1
      packages/excalidraw/components/MagicButton.tsx
  88. 3 3
      packages/excalidraw/components/MobileMenu.tsx
  89. 1 1
      packages/excalidraw/components/Modal.tsx
  90. 1 1
      packages/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.ts
  91. 4 3
      packages/excalidraw/components/PasteChartDialog.tsx
  92. 1 1
      packages/excalidraw/components/PenModeButton.tsx
  93. 4 3
      packages/excalidraw/components/PublishLibrary.tsx
  94. 1 1
      packages/excalidraw/components/SVGLayer.tsx
  95. 2 5
      packages/excalidraw/components/Sidebar/Sidebar.tsx
  96. 1 1
      packages/excalidraw/components/Sidebar/SidebarTab.tsx
  97. 1 1
      packages/excalidraw/components/Sidebar/SidebarTabTrigger.tsx
  98. 1 1
      packages/excalidraw/components/Sidebar/SidebarTrigger.tsx
  99. 1 1
      packages/excalidraw/components/Sidebar/common.ts
  100. 2 2
      packages/excalidraw/components/Stats.tsx

+ 2 - 1
.eslintrc.json

@@ -2,6 +2,7 @@
   "extends": ["@excalidraw/eslint-config", "react-app"],
   "extends": ["@excalidraw/eslint-config", "react-app"],
   "rules": {
   "rules": {
     "import/no-anonymous-default-export": "off",
     "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" }]
   }
   }
 }
 }

+ 1 - 1
examples/excalidraw/components/App.tsx

@@ -12,9 +12,9 @@ import type * as TExcalidraw from "@excalidraw/excalidraw";
 
 
 import { nanoid } from "nanoid";
 import { nanoid } from "nanoid";
 
 
+import type { ResolvablePromise } from "../utils";
 import {
 import {
   resolvablePromise,
   resolvablePromise,
-  ResolvablePromise,
   distance2d,
   distance2d,
   fileOpen,
   fileOpen,
   withBatchedUpdates,
   withBatchedUpdates,

+ 1 - 1
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 CustomFooter from "./CustomFooter";
 import type * as TExcalidraw from "@excalidraw/excalidraw";
 import type * as TExcalidraw from "@excalidraw/excalidraw";
 
 

+ 1 - 1
examples/excalidraw/utils.ts

@@ -1,6 +1,6 @@
 import { unstable_batchedUpdates } from "react-dom";
 import { unstable_batchedUpdates } from "react-dom";
 import { fileOpen as _fileOpen } from "browser-fs-access";
 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";
 import { AbortError } from "../../packages/excalidraw/errors";
 
 
 type FILE_EXTENSION = Exclude<keyof typeof MIME_TYPES, "binary">;
 type FILE_EXTENSION = Exclude<keyof typeof MIME_TYPES, "binary">;

+ 7 - 10
excalidraw-app/App.tsx

@@ -13,7 +13,7 @@ import {
   VERSION_TIMEOUT,
   VERSION_TIMEOUT,
 } from "../packages/excalidraw/constants";
 } from "../packages/excalidraw/constants";
 import { loadFromBlob } from "../packages/excalidraw/data/blob";
 import { loadFromBlob } from "../packages/excalidraw/data/blob";
-import {
+import type {
   FileId,
   FileId,
   NonDeletedExcalidrawElement,
   NonDeletedExcalidrawElement,
   OrderedExcalidrawElement,
   OrderedExcalidrawElement,
@@ -29,20 +29,20 @@ import {
   StoreAction,
   StoreAction,
   reconcileElements,
   reconcileElements,
 } from "../packages/excalidraw";
 } from "../packages/excalidraw";
-import {
+import type {
   AppState,
   AppState,
   ExcalidrawImperativeAPI,
   ExcalidrawImperativeAPI,
   BinaryFiles,
   BinaryFiles,
   ExcalidrawInitialDataState,
   ExcalidrawInitialDataState,
   UIAppState,
   UIAppState,
 } from "../packages/excalidraw/types";
 } from "../packages/excalidraw/types";
+import type { ResolvablePromise } from "../packages/excalidraw/utils";
 import {
 import {
   debounce,
   debounce,
   getVersion,
   getVersion,
   getFrame,
   getFrame,
   isTestEnv,
   isTestEnv,
   preventUnload,
   preventUnload,
-  ResolvablePromise,
   resolvablePromise,
   resolvablePromise,
   isRunningInIframe,
   isRunningInIframe,
 } from "../packages/excalidraw/utils";
 } from "../packages/excalidraw/utils";
@@ -52,8 +52,8 @@ import {
   STORAGE_KEYS,
   STORAGE_KEYS,
   SYNC_BROWSER_TABS_TIMEOUT,
   SYNC_BROWSER_TABS_TIMEOUT,
 } from "./app_constants";
 } from "./app_constants";
+import type { CollabAPI } from "./collab/Collab";
 import Collab, {
 import Collab, {
-  CollabAPI,
   collabAPIAtom,
   collabAPIAtom,
   isCollaboratingAtom,
   isCollaboratingAtom,
   isOfflineAtom,
   isOfflineAtom,
@@ -69,11 +69,8 @@ import {
   importUsernameFromLocalStorage,
   importUsernameFromLocalStorage,
 } from "./data/localStorage";
 } from "./data/localStorage";
 import CustomStats from "./CustomStats";
 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 {
 import {
   ExportToExcalidrawPlus,
   ExportToExcalidrawPlus,
   exportToExcalidrawPlus,
   exportToExcalidrawPlus,
@@ -101,7 +98,7 @@ import { useAtomWithInitialValue } from "../packages/excalidraw/jotai";
 import { appJotaiStore } from "./app-jotai";
 import { appJotaiStore } from "./app-jotai";
 
 
 import "./index.scss";
 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 { ShareableLinkDialog } from "../packages/excalidraw/components/ShareableLinkDialog";
 import { openConfirmModal } from "../packages/excalidraw/components/OverwriteConfirm/OverwriteConfirmState";
 import { openConfirmModal } from "../packages/excalidraw/components/OverwriteConfirm/OverwriteConfirmState";
 import { OverwriteConfirmDialog } from "../packages/excalidraw/components/OverwriteConfirm/OverwriteConfirm";
 import { OverwriteConfirmDialog } from "../packages/excalidraw/components/OverwriteConfirm/OverwriteConfirm";

+ 2 - 2
excalidraw-app/CustomStats.tsx

@@ -7,8 +7,8 @@ import {
 import { DEFAULT_VERSION } from "../packages/excalidraw/constants";
 import { DEFAULT_VERSION } from "../packages/excalidraw/constants";
 import { t } from "../packages/excalidraw/i18n";
 import { t } from "../packages/excalidraw/i18n";
 import { copyTextToSystemClipboard } from "../packages/excalidraw/clipboard";
 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 };
 type StorageSizes = { scene: number; total: number };
 
 

+ 9 - 7
excalidraw-app/collab/Collab.tsx

@@ -1,13 +1,13 @@
 import throttle from "lodash.throttle";
 import throttle from "lodash.throttle";
 import { PureComponent } from "react";
 import { PureComponent } from "react";
-import {
+import type {
   ExcalidrawImperativeAPI,
   ExcalidrawImperativeAPI,
   SocketId,
   SocketId,
 } from "../../packages/excalidraw/types";
 } from "../../packages/excalidraw/types";
 import { ErrorDialog } from "../../packages/excalidraw/components/ErrorDialog";
 import { ErrorDialog } from "../../packages/excalidraw/components/ErrorDialog";
 import { APP_NAME, ENV, EVENT } from "../../packages/excalidraw/constants";
 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,
   ExcalidrawElement,
   InitializedExcalidrawImageElement,
   InitializedExcalidrawImageElement,
   OrderedExcalidrawElement,
   OrderedExcalidrawElement,
@@ -19,7 +19,7 @@ import {
   zoomToFitBounds,
   zoomToFitBounds,
   reconcileElements,
   reconcileElements,
 } from "../../packages/excalidraw";
 } from "../../packages/excalidraw";
-import { Collaborator, Gesture } from "../../packages/excalidraw/types";
+import type { Collaborator, Gesture } from "../../packages/excalidraw/types";
 import {
 import {
   assertNever,
   assertNever,
   preventUnload,
   preventUnload,
@@ -36,12 +36,14 @@ import {
   SYNC_FULL_SCENE_INTERVAL_MS,
   SYNC_FULL_SCENE_INTERVAL_MS,
   WS_EVENTS,
   WS_EVENTS,
 } from "../app_constants";
 } from "../app_constants";
+import type {
+  SocketUpdateDataSource,
+  SyncableExcalidrawElement,
+} from "../data";
 import {
 import {
   generateCollaborationLinkData,
   generateCollaborationLinkData,
   getCollaborationLink,
   getCollaborationLink,
   getSyncableElements,
   getSyncableElements,
-  SocketUpdateDataSource,
-  SyncableExcalidrawElement,
 } from "../data";
 } from "../data";
 import {
 import {
   isSavedToFirebase,
   isSavedToFirebase,
@@ -77,7 +79,7 @@ import { resetBrowserStateVersions } from "../data/tabSync";
 import { LocalData } from "../data/LocalData";
 import { LocalData } from "../data/LocalData";
 import { atom } from "jotai";
 import { atom } from "jotai";
 import { appJotaiStore } from "../app-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 { getVisibleSceneBounds } from "../../packages/excalidraw/element/bounds";
 import { withBatchedUpdates } from "../../packages/excalidraw/reactUtils";
 import { withBatchedUpdates } from "../../packages/excalidraw/reactUtils";
 import { collabErrorIndicatorAtom } from "./CollabError";
 import { collabErrorIndicatorAtom } from "./CollabError";

+ 5 - 5
excalidraw-app/collab/Portal.tsx

@@ -1,15 +1,15 @@
-import {
-  isSyncableElement,
+import type {
   SocketUpdateData,
   SocketUpdateData,
   SocketUpdateDataSource,
   SocketUpdateDataSource,
   SyncableExcalidrawElement,
   SyncableExcalidrawElement,
 } from "../data";
 } 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 { WS_EVENTS, FILE_UPLOAD_TIMEOUT, WS_SUBTYPES } from "../app_constants";
-import {
+import type {
   OnUserFollowedPayload,
   OnUserFollowedPayload,
   SocketId,
   SocketId,
   UserIdleState,
   UserIdleState,

+ 1 - 1
excalidraw-app/components/AppMainMenu.tsx

@@ -3,7 +3,7 @@ import {
   loginIcon,
   loginIcon,
   ExcalLogo,
   ExcalLogo,
 } from "../../packages/excalidraw/components/icons";
 } 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 { MainMenu } from "../../packages/excalidraw/index";
 import { isExcalidrawPlusSignedUser } from "../app_constants";
 import { isExcalidrawPlusSignedUser } from "../app_constants";
 import { LanguageList } from "./LanguageList";
 import { LanguageList } from "./LanguageList";

+ 2 - 2
excalidraw-app/components/ExportToExcalidrawPlus.tsx

@@ -3,11 +3,11 @@ import { Card } from "../../packages/excalidraw/components/Card";
 import { ToolButton } from "../../packages/excalidraw/components/ToolButton";
 import { ToolButton } from "../../packages/excalidraw/components/ToolButton";
 import { serializeAsJSON } from "../../packages/excalidraw/data/json";
 import { serializeAsJSON } from "../../packages/excalidraw/data/json";
 import { loadFirebaseStorage, saveFilesToFirebase } from "../data/firebase";
 import { loadFirebaseStorage, saveFilesToFirebase } from "../data/firebase";
-import {
+import type {
   FileId,
   FileId,
   NonDeletedExcalidrawElement,
   NonDeletedExcalidrawElement,
 } from "../../packages/excalidraw/element/types";
 } from "../../packages/excalidraw/element/types";
-import {
+import type {
   AppState,
   AppState,
   BinaryFileData,
   BinaryFileData,
   BinaryFiles,
   BinaryFiles,

+ 1 - 1
excalidraw-app/components/GitHubCorner.tsx

@@ -1,7 +1,7 @@
 import oc from "open-color";
 import oc from "open-color";
 import React from "react";
 import React from "react";
 import { THEME } from "../../packages/excalidraw/constants";
 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
 // https://github.com/tholman/github-corners
 export const GitHubCorner = React.memo(
 export const GitHubCorner = React.memo(

+ 2 - 2
excalidraw-app/data/FileManager.ts

@@ -2,14 +2,14 @@ import { StoreAction } from "../../packages/excalidraw";
 import { compressData } from "../../packages/excalidraw/data/encode";
 import { compressData } from "../../packages/excalidraw/data/encode";
 import { newElementWith } from "../../packages/excalidraw/element/mutateElement";
 import { newElementWith } from "../../packages/excalidraw/element/mutateElement";
 import { isInitializedImageElement } from "../../packages/excalidraw/element/typeChecks";
 import { isInitializedImageElement } from "../../packages/excalidraw/element/typeChecks";
-import {
+import type {
   ExcalidrawElement,
   ExcalidrawElement,
   ExcalidrawImageElement,
   ExcalidrawImageElement,
   FileId,
   FileId,
   InitializedExcalidrawImageElement,
   InitializedExcalidrawImageElement,
 } from "../../packages/excalidraw/element/types";
 } from "../../packages/excalidraw/element/types";
 import { t } from "../../packages/excalidraw/i18n";
 import { t } from "../../packages/excalidraw/i18n";
-import {
+import type {
   BinaryFileData,
   BinaryFileData,
   BinaryFileMetadata,
   BinaryFileMetadata,
   ExcalidrawImperativeAPI,
   ExcalidrawImperativeAPI,

+ 5 - 5
excalidraw-app/data/LocalData.ts

@@ -20,19 +20,19 @@ import {
   get,
   get,
 } from "idb-keyval";
 } from "idb-keyval";
 import { clearAppStateForLocalStorage } from "../../packages/excalidraw/appState";
 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 { clearElementsForLocalStorage } from "../../packages/excalidraw/element";
-import {
+import type {
   ExcalidrawElement,
   ExcalidrawElement,
   FileId,
   FileId,
 } from "../../packages/excalidraw/element/types";
 } from "../../packages/excalidraw/element/types";
-import {
+import type {
   AppState,
   AppState,
   BinaryFileData,
   BinaryFileData,
   BinaryFiles,
   BinaryFiles,
 } from "../../packages/excalidraw/types";
 } 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 { debounce } from "../../packages/excalidraw/utils";
 import { SAVE_TO_LOCAL_STORAGE_TIMEOUT, STORAGE_KEYS } from "../app_constants";
 import { SAVE_TO_LOCAL_STORAGE_TIMEOUT, STORAGE_KEYS } from "../app_constants";
 import { FileManager } from "./FileManager";
 import { FileManager } from "./FileManager";

+ 6 - 5
excalidraw-app/data/firebase.ts

@@ -1,13 +1,13 @@
 import { reconcileElements } from "../../packages/excalidraw";
 import { reconcileElements } from "../../packages/excalidraw";
-import {
+import type {
   ExcalidrawElement,
   ExcalidrawElement,
   FileId,
   FileId,
   OrderedExcalidrawElement,
   OrderedExcalidrawElement,
 } from "../../packages/excalidraw/element/types";
 } from "../../packages/excalidraw/element/types";
 import { getSceneVersion } from "../../packages/excalidraw/element";
 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 { restoreElements } from "../../packages/excalidraw/data/restore";
-import {
+import type {
   AppState,
   AppState,
   BinaryFileData,
   BinaryFileData,
   BinaryFileMetadata,
   BinaryFileMetadata,
@@ -20,8 +20,9 @@ import {
   decryptData,
   decryptData,
 } from "../../packages/excalidraw/data/encryption";
 } from "../../packages/excalidraw/data/encryption";
 import { MIME_TYPES } from "../../packages/excalidraw/constants";
 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 { Socket } from "socket.io-client";
 import type { RemoteExcalidrawElement } from "../../packages/excalidraw/data/reconcile";
 import type { RemoteExcalidrawElement } from "../../packages/excalidraw/data/reconcile";
 
 

+ 6 - 6
excalidraw-app/data/index.ts

@@ -9,30 +9,30 @@ import {
 } from "../../packages/excalidraw/data/encryption";
 } from "../../packages/excalidraw/data/encryption";
 import { serializeAsJSON } from "../../packages/excalidraw/data/json";
 import { serializeAsJSON } from "../../packages/excalidraw/data/json";
 import { restore } from "../../packages/excalidraw/data/restore";
 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 { isInvisiblySmallElement } from "../../packages/excalidraw/element/sizeHelpers";
 import { isInitializedImageElement } from "../../packages/excalidraw/element/typeChecks";
 import { isInitializedImageElement } from "../../packages/excalidraw/element/typeChecks";
-import {
+import type {
   ExcalidrawElement,
   ExcalidrawElement,
   FileId,
   FileId,
   OrderedExcalidrawElement,
   OrderedExcalidrawElement,
 } from "../../packages/excalidraw/element/types";
 } from "../../packages/excalidraw/element/types";
 import { t } from "../../packages/excalidraw/i18n";
 import { t } from "../../packages/excalidraw/i18n";
-import {
+import type {
   AppState,
   AppState,
   BinaryFileData,
   BinaryFileData,
   BinaryFiles,
   BinaryFiles,
   SocketId,
   SocketId,
   UserIdleState,
   UserIdleState,
 } from "../../packages/excalidraw/types";
 } 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 { bytesToHexString } from "../../packages/excalidraw/utils";
+import type { WS_SUBTYPES } from "../app_constants";
 import {
 import {
   DELETED_ELEMENT_TIMEOUT,
   DELETED_ELEMENT_TIMEOUT,
   FILE_UPLOAD_MAX_BYTES,
   FILE_UPLOAD_MAX_BYTES,
   ROOM_ID_BYTES,
   ROOM_ID_BYTES,
-  WS_SUBTYPES,
 } from "../app_constants";
 } from "../app_constants";
 import { encodeFilesForUpload } from "./FileManager";
 import { encodeFilesForUpload } from "./FileManager";
 import { saveFilesToFirebase } from "./firebase";
 import { saveFilesToFirebase } from "./firebase";

+ 2 - 2
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 {
 import {
   clearAppStateForLocalStorage,
   clearAppStateForLocalStorage,
   getDefaultAppState,
   getDefaultAppState,

+ 2 - 1
excalidraw-app/share/ShareDialog.tsx

@@ -18,7 +18,8 @@ import {
 } from "../../packages/excalidraw/components/icons";
 } from "../../packages/excalidraw/components/icons";
 import { TextField } from "../../packages/excalidraw/components/TextField";
 import { TextField } from "../../packages/excalidraw/components/TextField";
 import { FilledButton } from "../../packages/excalidraw/components/FilledButton";
 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 { atom, useAtom, useAtomValue } from "jotai";
 
 
 import "./ShareDialog.scss";
 import "./ShareDialog.scss";

+ 1 - 1
excalidraw-app/useHandleAppTheme.ts

@@ -2,7 +2,7 @@ import { atom, useAtom } from "jotai";
 import { useEffect, useLayoutEffect, useState } from "react";
 import { useEffect, useLayoutEffect, useState } from "react";
 import { THEME } from "../packages/excalidraw";
 import { THEME } from "../packages/excalidraw";
 import { EVENT } from "../packages/excalidraw/constants";
 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 { CODES, KEYS } from "../packages/excalidraw/keys";
 import { STORAGE_KEYS } from "./app_constants";
 import { STORAGE_KEYS } from "./app_constants";
 
 

+ 4 - 3
packages/excalidraw/actions/actionAlign.tsx

@@ -1,4 +1,5 @@
-import { alignElements, Alignment } from "../align";
+import type { Alignment } from "../align";
+import { alignElements } from "../align";
 import {
 import {
   AlignBottomIcon,
   AlignBottomIcon,
   AlignLeftIcon,
   AlignLeftIcon,
@@ -10,13 +11,13 @@ import {
 import { ToolButton } from "../components/ToolButton";
 import { ToolButton } from "../components/ToolButton";
 import { getNonDeletedElements } from "../element";
 import { getNonDeletedElements } from "../element";
 import { isFrameLikeElement } from "../element/typeChecks";
 import { isFrameLikeElement } from "../element/typeChecks";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
 import { updateFrameMembershipOfSelectedElements } from "../frame";
 import { updateFrameMembershipOfSelectedElements } from "../frame";
 import { t } from "../i18n";
 import { t } from "../i18n";
 import { KEYS } from "../keys";
 import { KEYS } from "../keys";
 import { isSomeElementSelected } from "../scene";
 import { isSomeElementSelected } from "../scene";
 import { StoreAction } from "../store";
 import { StoreAction } from "../store";
-import { AppClassProperties, AppState, UIAppState } from "../types";
+import type { AppClassProperties, AppState, UIAppState } from "../types";
 import { arrayToMap, getShortcutKey } from "../utils";
 import { arrayToMap, getShortcutKey } from "../utils";
 import { register } from "./register";
 import { register } from "./register";
 
 

+ 3 - 3
packages/excalidraw/actions/actionBoundText.tsx

@@ -23,14 +23,14 @@ import {
   isTextBindableContainer,
   isTextBindableContainer,
   isUsingAdaptiveRadius,
   isUsingAdaptiveRadius,
 } from "../element/typeChecks";
 } from "../element/typeChecks";
-import {
+import type {
   ExcalidrawElement,
   ExcalidrawElement,
   ExcalidrawLinearElement,
   ExcalidrawLinearElement,
   ExcalidrawTextContainer,
   ExcalidrawTextContainer,
   ExcalidrawTextElement,
   ExcalidrawTextElement,
 } from "../element/types";
 } 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 { arrayToMap, getFontString } from "../utils";
 import { register } from "./register";
 import { register } from "./register";
 import { syncMovedIndices } from "../fractionalIndex";
 import { syncMovedIndices } from "../fractionalIndex";

+ 3 - 3
packages/excalidraw/actions/actionCanvas.tsx

@@ -18,13 +18,13 @@ import {
   ZOOM_STEP,
   ZOOM_STEP,
 } from "../constants";
 } from "../constants";
 import { getCommonBounds, getNonDeletedElements } from "../element";
 import { getCommonBounds, getNonDeletedElements } from "../element";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
 import { t } from "../i18n";
 import { t } from "../i18n";
 import { CODES, KEYS } from "../keys";
 import { CODES, KEYS } from "../keys";
 import { getNormalizedZoom } from "../scene";
 import { getNormalizedZoom } from "../scene";
 import { centerScrollOn } from "../scene/scroll";
 import { centerScrollOn } from "../scene/scroll";
 import { getStateForZoom } from "../scene/zoom";
 import { getStateForZoom } from "../scene/zoom";
-import { AppState, NormalizedZoomValue } from "../types";
+import type { AppState, NormalizedZoomValue } from "../types";
 import { getShortcutKey, updateActiveTool } from "../utils";
 import { getShortcutKey, updateActiveTool } from "../utils";
 import { register } from "./register";
 import { register } from "./register";
 import { Tooltip } from "../components/Tooltip";
 import { Tooltip } from "../components/Tooltip";
@@ -35,7 +35,7 @@ import {
   isHandToolActive,
   isHandToolActive,
 } from "../appState";
 } from "../appState";
 import { DEFAULT_CANVAS_BACKGROUND_PICKS } from "../colors";
 import { DEFAULT_CANVAS_BACKGROUND_PICKS } from "../colors";
-import { SceneBounds } from "../element/bounds";
+import type { SceneBounds } from "../element/bounds";
 import { setCursor } from "../cursor";
 import { setCursor } from "../cursor";
 import { StoreAction } from "../store";
 import { StoreAction } from "../store";
 
 

+ 2 - 2
packages/excalidraw/actions/actionDeleteSelected.tsx

@@ -4,8 +4,8 @@ import { ToolButton } from "../components/ToolButton";
 import { t } from "../i18n";
 import { t } from "../i18n";
 import { register } from "./register";
 import { register } from "./register";
 import { getNonDeletedElements } from "../element";
 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 { newElementWith } from "../element/mutateElement";
 import { getElementsInGroup } from "../groups";
 import { getElementsInGroup } from "../groups";
 import { LinearElementEditor } from "../element/linearElementEditor";
 import { LinearElementEditor } from "../element/linearElementEditor";

+ 4 - 3
packages/excalidraw/actions/actionDistribute.tsx

@@ -3,16 +3,17 @@ import {
   DistributeVerticallyIcon,
   DistributeVerticallyIcon,
 } from "../components/icons";
 } from "../components/icons";
 import { ToolButton } from "../components/ToolButton";
 import { ToolButton } from "../components/ToolButton";
-import { distributeElements, Distribution } from "../distribute";
+import type { Distribution } from "../distribute";
+import { distributeElements } from "../distribute";
 import { getNonDeletedElements } from "../element";
 import { getNonDeletedElements } from "../element";
 import { isFrameLikeElement } from "../element/typeChecks";
 import { isFrameLikeElement } from "../element/typeChecks";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
 import { updateFrameMembershipOfSelectedElements } from "../frame";
 import { updateFrameMembershipOfSelectedElements } from "../frame";
 import { t } from "../i18n";
 import { t } from "../i18n";
 import { CODES, KEYS } from "../keys";
 import { CODES, KEYS } from "../keys";
 import { isSomeElementSelected } from "../scene";
 import { isSomeElementSelected } from "../scene";
 import { StoreAction } from "../store";
 import { StoreAction } from "../store";
-import { AppClassProperties, AppState } from "../types";
+import type { AppClassProperties, AppState } from "../types";
 import { arrayToMap, getShortcutKey } from "../utils";
 import { arrayToMap, getShortcutKey } from "../utils";
 import { register } from "./register";
 import { register } from "./register";
 
 

+ 3 - 3
packages/excalidraw/actions/actionDuplicateSelection.tsx

@@ -1,6 +1,6 @@
 import { KEYS } from "../keys";
 import { KEYS } from "../keys";
 import { register } from "./register";
 import { register } from "./register";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
 import { duplicateElement, getNonDeletedElements } from "../element";
 import { duplicateElement, getNonDeletedElements } from "../element";
 import { isSomeElementSelected } from "../scene";
 import { isSomeElementSelected } from "../scene";
 import { ToolButton } from "../components/ToolButton";
 import { ToolButton } from "../components/ToolButton";
@@ -12,9 +12,9 @@ import {
   getSelectedGroupForElement,
   getSelectedGroupForElement,
   getElementsInGroup,
   getElementsInGroup,
 } from "../groups";
 } from "../groups";
-import { AppState } from "../types";
+import type { AppState } from "../types";
 import { fixBindingsAfterDuplication } from "../element/binding";
 import { fixBindingsAfterDuplication } from "../element/binding";
-import { ActionResult } from "./types";
+import type { ActionResult } from "./types";
 import { GRID_SIZE } from "../constants";
 import { GRID_SIZE } from "../constants";
 import {
 import {
   bindTextToShapeAfterDuplication,
   bindTextToShapeAfterDuplication,

+ 1 - 1
packages/excalidraw/actions/actionElementLock.ts

@@ -1,7 +1,7 @@
 import { LockedIcon, UnlockedIcon } from "../components/icons";
 import { LockedIcon, UnlockedIcon } from "../components/icons";
 import { newElementWith } from "../element/mutateElement";
 import { newElementWith } from "../element/mutateElement";
 import { isFrameLikeElement } from "../element/typeChecks";
 import { isFrameLikeElement } from "../element/typeChecks";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
 import { KEYS } from "../keys";
 import { KEYS } from "../keys";
 import { getSelectedElements } from "../scene";
 import { getSelectedElements } from "../scene";
 import { StoreAction } from "../store";
 import { StoreAction } from "../store";

+ 1 - 1
packages/excalidraw/actions/actionExport.tsx

@@ -16,7 +16,7 @@ import { getSelectedElements, isSomeElementSelected } from "../scene";
 import { getNonDeletedElements } from "../element";
 import { getNonDeletedElements } from "../element";
 import { isImageFileHandle } from "../data/blob";
 import { isImageFileHandle } from "../data/blob";
 import { nativeFileSystemSupported } from "../data/filesystem";
 import { nativeFileSystemSupported } from "../data/filesystem";
-import { Theme } from "../element/types";
+import type { Theme } from "../element/types";
 
 
 import "../components/ToolIcon.scss";
 import "../components/ToolIcon.scss";
 import { StoreAction } from "../store";
 import { StoreAction } from "../store";

+ 1 - 1
packages/excalidraw/actions/actionFinalize.tsx

@@ -13,7 +13,7 @@ import {
   bindOrUnbindLinearElement,
   bindOrUnbindLinearElement,
 } from "../element/binding";
 } from "../element/binding";
 import { isBindingElement, isLinearElement } from "../element/typeChecks";
 import { isBindingElement, isLinearElement } from "../element/typeChecks";
-import { AppState } from "../types";
+import type { AppState } from "../types";
 import { resetCursor } from "../cursor";
 import { resetCursor } from "../cursor";
 import { StoreAction } from "../store";
 import { StoreAction } from "../store";
 
 

+ 2 - 2
packages/excalidraw/actions/actionFlip.ts

@@ -1,13 +1,13 @@
 import { register } from "./register";
 import { register } from "./register";
 import { getSelectedElements } from "../scene";
 import { getSelectedElements } from "../scene";
 import { getNonDeletedElements } from "../element";
 import { getNonDeletedElements } from "../element";
-import {
+import type {
   ExcalidrawElement,
   ExcalidrawElement,
   NonDeleted,
   NonDeleted,
   NonDeletedSceneElementsMap,
   NonDeletedSceneElementsMap,
 } from "../element/types";
 } from "../element/types";
 import { resizeMultipleElements } from "../element/resizeElements";
 import { resizeMultipleElements } from "../element/resizeElements";
-import { AppClassProperties, AppState } from "../types";
+import type { AppClassProperties, AppState } from "../types";
 import { arrayToMap } from "../utils";
 import { arrayToMap } from "../utils";
 import { CODES, KEYS } from "../keys";
 import { CODES, KEYS } from "../keys";
 import { getCommonBoundingBox } from "../element/bounds";
 import { getCommonBoundingBox } from "../element/bounds";

+ 2 - 2
packages/excalidraw/actions/actionFrame.ts

@@ -1,9 +1,9 @@
 import { getNonDeletedElements } from "../element";
 import { getNonDeletedElements } from "../element";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
 import { removeAllElementsFromFrame } from "../frame";
 import { removeAllElementsFromFrame } from "../frame";
 import { getFrameChildren } from "../frame";
 import { getFrameChildren } from "../frame";
 import { KEYS } from "../keys";
 import { KEYS } from "../keys";
-import { AppClassProperties, AppState, UIAppState } from "../types";
+import type { AppClassProperties, AppState, UIAppState } from "../types";
 import { updateActiveTool } from "../utils";
 import { updateActiveTool } from "../utils";
 import { setCursorForShape } from "../cursor";
 import { setCursorForShape } from "../cursor";
 import { register } from "./register";
 import { register } from "./register";

+ 2 - 2
packages/excalidraw/actions/actionGroup.tsx

@@ -17,12 +17,12 @@ import {
 import { getNonDeletedElements } from "../element";
 import { getNonDeletedElements } from "../element";
 import { randomId } from "../random";
 import { randomId } from "../random";
 import { ToolButton } from "../components/ToolButton";
 import { ToolButton } from "../components/ToolButton";
-import {
+import type {
   ExcalidrawElement,
   ExcalidrawElement,
   ExcalidrawTextElement,
   ExcalidrawTextElement,
   OrderedExcalidrawElement,
   OrderedExcalidrawElement,
 } from "../element/types";
 } from "../element/types";
-import { AppClassProperties, AppState } from "../types";
+import type { AppClassProperties, AppState } from "../types";
 import { isBoundToContainer } from "../element/typeChecks";
 import { isBoundToContainer } from "../element/typeChecks";
 import {
 import {
   getElementsInResizingFrame,
   getElementsInResizingFrame,

+ 7 - 5
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 { UndoIcon, RedoIcon } from "../components/icons";
 import { ToolButton } from "../components/ToolButton";
 import { ToolButton } from "../components/ToolButton";
 import { t } from "../i18n";
 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 { KEYS } from "../keys";
 import { arrayToMap } from "../utils";
 import { arrayToMap } from "../utils";
 import { isWindows } from "../constants";
 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";
 import { useEmitter } from "../hooks/useEmitter";
 
 
 const writeData = (
 const writeData = (

+ 1 - 1
packages/excalidraw/actions/actionLinearEditor.tsx

@@ -1,7 +1,7 @@
 import { DEFAULT_CATEGORIES } from "../components/CommandPalette/CommandPalette";
 import { DEFAULT_CATEGORIES } from "../components/CommandPalette/CommandPalette";
 import { LinearElementEditor } from "../element/linearElementEditor";
 import { LinearElementEditor } from "../element/linearElementEditor";
 import { isLinearElement } from "../element/typeChecks";
 import { isLinearElement } from "../element/typeChecks";
-import { ExcalidrawLinearElement } from "../element/types";
+import type { ExcalidrawLinearElement } from "../element/types";
 import { StoreAction } from "../store";
 import { StoreAction } from "../store";
 import { register } from "./register";
 import { register } from "./register";
 import { ToolButton } from "../components/ToolButton";
 import { ToolButton } from "../components/ToolButton";

+ 2 - 2
packages/excalidraw/actions/actionNavigate.tsx

@@ -1,6 +1,6 @@
 import { getClientColor } from "../clients";
 import { getClientColor } from "../clients";
 import { Avatar } from "../components/Avatar";
 import { Avatar } from "../components/Avatar";
-import { GoToCollaboratorComponentProps } from "../components/UserList";
+import type { GoToCollaboratorComponentProps } from "../components/UserList";
 import {
 import {
   eyeIcon,
   eyeIcon,
   microphoneIcon,
   microphoneIcon,
@@ -8,7 +8,7 @@ import {
 } from "../components/icons";
 } from "../components/icons";
 import { t } from "../i18n";
 import { t } from "../i18n";
 import { StoreAction } from "../store";
 import { StoreAction } from "../store";
-import { Collaborator } from "../types";
+import type { Collaborator } from "../types";
 import { register } from "./register";
 import { register } from "./register";
 import clsx from "clsx";
 import clsx from "clsx";
 
 

+ 2 - 2
packages/excalidraw/actions/actionProperties.tsx

@@ -1,4 +1,4 @@
-import { AppClassProperties, AppState, Primitive } from "../types";
+import type { AppClassProperties, AppState, Primitive } from "../types";
 import {
 import {
   DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE,
   DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE,
   DEFAULT_ELEMENT_BACKGROUND_PICKS,
   DEFAULT_ELEMENT_BACKGROUND_PICKS,
@@ -74,7 +74,7 @@ import {
   isLinearElement,
   isLinearElement,
   isUsingAdaptiveRadius,
   isUsingAdaptiveRadius,
 } from "../element/typeChecks";
 } from "../element/typeChecks";
-import {
+import type {
   Arrowhead,
   Arrowhead,
   ExcalidrawElement,
   ExcalidrawElement,
   ExcalidrawLinearElement,
   ExcalidrawLinearElement,

+ 1 - 1
packages/excalidraw/actions/actionSelectAll.ts

@@ -2,7 +2,7 @@ import { KEYS } from "../keys";
 import { register } from "./register";
 import { register } from "./register";
 import { selectGroupsForSelectedElements } from "../groups";
 import { selectGroupsForSelectedElements } from "../groups";
 import { getNonDeletedElements, isTextElement } from "../element";
 import { getNonDeletedElements, isTextElement } from "../element";
-import { ExcalidrawElement } from "../element/types";
+import type { ExcalidrawElement } from "../element/types";
 import { isLinearElement } from "../element/typeChecks";
 import { isLinearElement } from "../element/typeChecks";
 import { LinearElementEditor } from "../element/linearElementEditor";
 import { LinearElementEditor } from "../element/linearElementEditor";
 import { excludeElementsInFramesFromSelection } from "../scene/selection";
 import { excludeElementsInFramesFromSelection } from "../scene/selection";

+ 1 - 1
packages/excalidraw/actions/actionStyles.ts

@@ -24,7 +24,7 @@ import {
   isArrowElement,
   isArrowElement,
 } from "../element/typeChecks";
 } from "../element/typeChecks";
 import { getSelectedElements } from "../scene";
 import { getSelectedElements } from "../scene";
-import { ExcalidrawTextElement } from "../element/types";
+import type { ExcalidrawTextElement } from "../element/types";
 import { paintIcon } from "../components/icons";
 import { paintIcon } from "../components/icons";
 import { StoreAction } from "../store";
 import { StoreAction } from "../store";
 
 

+ 1 - 1
packages/excalidraw/actions/actionToggleGridMode.tsx

@@ -1,7 +1,7 @@
 import { CODES, KEYS } from "../keys";
 import { CODES, KEYS } from "../keys";
 import { register } from "./register";
 import { register } from "./register";
 import { GRID_SIZE } from "../constants";
 import { GRID_SIZE } from "../constants";
-import { AppState } from "../types";
+import type { AppState } from "../types";
 import { gridIcon } from "../components/icons";
 import { gridIcon } from "../components/icons";
 import { StoreAction } from "../store";
 import { StoreAction } from "../store";
 
 

+ 6 - 3
packages/excalidraw/actions/manager.tsx

@@ -1,5 +1,5 @@
 import React from "react";
 import React from "react";
-import {
+import type {
   Action,
   Action,
   UpdaterFn,
   UpdaterFn,
   ActionName,
   ActionName,
@@ -7,8 +7,11 @@ import {
   PanelComponentProps,
   PanelComponentProps,
   ActionSource,
   ActionSource,
 } from "./types";
 } 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 { trackEvent } from "../analytics";
 import { isPromiseLike } from "../utils";
 import { isPromiseLike } from "../utils";
 
 

+ 1 - 1
packages/excalidraw/actions/register.ts

@@ -1,4 +1,4 @@
-import { Action } from "./types";
+import type { Action } from "./types";
 
 
 export let actions: readonly Action[] = [];
 export let actions: readonly Action[] = [];
 
 

+ 2 - 2
packages/excalidraw/actions/shortcuts.ts

@@ -1,8 +1,8 @@
 import { isDarwin } from "../constants";
 import { isDarwin } from "../constants";
 import { t } from "../i18n";
 import { t } from "../i18n";
-import { SubtypeOf } from "../utility-types";
+import type { SubtypeOf } from "../utility-types";
 import { getShortcutKey } from "../utils";
 import { getShortcutKey } from "../utils";
-import { ActionName } from "./types";
+import type { ActionName } from "./types";
 
 
 export type ShortcutName =
 export type ShortcutName =
   | SubtypeOf<
   | SubtypeOf<

+ 8 - 5
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,
   AppClassProperties,
   AppState,
   AppState,
   ExcalidrawProps,
   ExcalidrawProps,
   BinaryFiles,
   BinaryFiles,
   UIAppState,
   UIAppState,
 } from "../types";
 } 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 =
 export type ActionSource =
   | "ui"
   | "ui"

+ 3 - 2
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 { 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";
 import { getMaximumGroups } from "./groups";
 
 
 export interface Alignment {
 export interface Alignment {

+ 4 - 3
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 { getSvgPathFromStroke, sceneCoordsToViewportCoords } from "./utils";
 import type App from "./components/App";
 import type App from "./components/App";
 import { SVG_NS } from "./constants";
 import { SVG_NS } from "./constants";

+ 1 - 1
packages/excalidraw/appState.ts

@@ -7,7 +7,7 @@ import {
   EXPORT_SCALES,
   EXPORT_SCALES,
   THEME,
   THEME,
 } from "./constants";
 } from "./constants";
-import { AppState, NormalizedZoomValue } from "./types";
+import type { AppState, NormalizedZoomValue } from "./types";
 
 
 const defaultExportScale = EXPORT_SCALES.includes(devicePixelRatio)
 const defaultExportScale = EXPORT_SCALES.includes(devicePixelRatio)
   ? devicePixelRatio
   ? devicePixelRatio

+ 6 - 10
packages/excalidraw/change.ts

@@ -1,18 +1,14 @@
 import { ENV } from "./constants";
 import { ENV } from "./constants";
+import type { BindableProp, BindingProp } from "./element/binding";
 import {
 import {
   BoundElement,
   BoundElement,
   BindableElement,
   BindableElement,
-  BindableProp,
-  BindingProp,
   bindingProperties,
   bindingProperties,
   updateBoundElements,
   updateBoundElements,
 } from "./element/binding";
 } from "./element/binding";
 import { LinearElementEditor } from "./element/linearElementEditor";
 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 {
 import {
   getBoundTextElementId,
   getBoundTextElementId,
   redrawTextBoundingBox,
   redrawTextBoundingBox,
@@ -23,7 +19,7 @@ import {
   isBoundToContainer,
   isBoundToContainer,
   isTextElement,
   isTextElement,
 } from "./element/typeChecks";
 } from "./element/typeChecks";
-import {
+import type {
   ExcalidrawElement,
   ExcalidrawElement,
   ExcalidrawLinearElement,
   ExcalidrawLinearElement,
   ExcalidrawTextElement,
   ExcalidrawTextElement,
@@ -34,13 +30,13 @@ import {
 import { orderByFractionalIndex, syncMovedIndices } from "./fractionalIndex";
 import { orderByFractionalIndex, syncMovedIndices } from "./fractionalIndex";
 import { getNonDeletedGroupIds } from "./groups";
 import { getNonDeletedGroupIds } from "./groups";
 import { getObservedAppState } from "./store";
 import { getObservedAppState } from "./store";
-import {
+import type {
   AppState,
   AppState,
   ObservedAppState,
   ObservedAppState,
   ObservedElementsAppState,
   ObservedElementsAppState,
   ObservedStandaloneAppState,
   ObservedStandaloneAppState,
 } from "./types";
 } from "./types";
-import { SubtypeOf, ValueOf } from "./utility-types";
+import type { SubtypeOf, ValueOf } from "./utility-types";
 import {
 import {
   arrayToMap,
   arrayToMap,
   arrayToObject,
   arrayToObject,

+ 2 - 6
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("charts", () => {
   describe("tryParseNumber", () => {
   describe("tryParseNumber", () => {

+ 1 - 1
packages/excalidraw/charts.ts

@@ -9,7 +9,7 @@ import {
   VERTICAL_ALIGN,
   VERTICAL_ALIGN,
 } from "./constants";
 } from "./constants";
 import { newElement, newLinearElement, newTextElement } from "./element";
 import { newElement, newLinearElement, newTextElement } from "./element";
-import { NonDeletedExcalidrawElement } from "./element/types";
+import type { NonDeletedExcalidrawElement } from "./element/types";
 import { randomId } from "./random";
 import { randomId } from "./random";
 
 
 export type ChartElements = readonly NonDeletedExcalidrawElement[];
 export type ChartElements = readonly NonDeletedExcalidrawElement[];

+ 3 - 3
packages/excalidraw/clients.ts

@@ -5,13 +5,13 @@ import {
   THEME,
   THEME,
 } from "./constants";
 } from "./constants";
 import { roundRect } from "./renderer/roundRect";
 import { roundRect } from "./renderer/roundRect";
-import { InteractiveCanvasRenderConfig } from "./scene/types";
-import {
+import type { InteractiveCanvasRenderConfig } from "./scene/types";
+import type {
   Collaborator,
   Collaborator,
   InteractiveCanvasAppState,
   InteractiveCanvasAppState,
   SocketId,
   SocketId,
-  UserIdleState,
 } from "./types";
 } from "./types";
+import { UserIdleState } from "./types";
 
 
 function hashToInteger(id: string) {
 function hashToInteger(id: string) {
   let hash = 0;
   let hash = 0;

+ 4 - 3
packages/excalidraw/clipboard.ts

@@ -1,9 +1,10 @@
-import {
+import type {
   ExcalidrawElement,
   ExcalidrawElement,
   NonDeletedExcalidrawElement,
   NonDeletedExcalidrawElement,
 } from "./element/types";
 } 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 {
 import {
   ALLOWED_PASTE_MIME_TYPES,
   ALLOWED_PASTE_MIME_TYPES,
   EXPORT_DATA_TYPES,
   EXPORT_DATA_TYPES,

+ 1 - 1
packages/excalidraw/colors.ts

@@ -1,5 +1,5 @@
 import oc from "open-color";
 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
 // FIXME can't put to utils.ts rn because of circular dependency
 const pick = <R extends Record<string, any>, K extends readonly (keyof R)[]>(
 const pick = <R extends Record<string, any>, K extends readonly (keyof R)[]>(

+ 3 - 3
packages/excalidraw/components/Actions.tsx

@@ -1,6 +1,6 @@
 import { useState } from "react";
 import { useState } from "react";
-import { ActionManager } from "../actions/manager";
-import {
+import type { ActionManager } from "../actions/manager";
+import type {
   ExcalidrawElement,
   ExcalidrawElement,
   ExcalidrawElementType,
   ExcalidrawElementType,
   NonDeletedElementsMap,
   NonDeletedElementsMap,
@@ -17,7 +17,7 @@ import {
   hasStrokeWidth,
   hasStrokeWidth,
 } from "../scene";
 } from "../scene";
 import { SHAPES } from "../shapes";
 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 { capitalizeString, isTransparent } from "../utils";
 import Stack from "./Stack";
 import Stack from "./Stack";
 import { ToolButton } from "./ToolButton";
 import { ToolButton } from "./ToolButton";

+ 23 - 25
packages/excalidraw/components/App.tsx

@@ -1,7 +1,7 @@
 import React, { useContext } from "react";
 import React, { useContext } from "react";
 import { flushSync } from "react-dom";
 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 rough from "roughjs/bin/rough";
 import clsx from "clsx";
 import clsx from "clsx";
 import { nanoid } from "nanoid";
 import { nanoid } from "nanoid";
@@ -39,18 +39,16 @@ import {
 import { createRedoAction, createUndoAction } from "../actions/actionHistory";
 import { createRedoAction, createUndoAction } from "../actions/actionHistory";
 import { ActionManager } from "../actions/manager";
 import { ActionManager } from "../actions/manager";
 import { actions } from "../actions/register";
 import { actions } from "../actions/register";
-import { Action, ActionResult } from "../actions/types";
+import type { Action, ActionResult } from "../actions/types";
 import { trackEvent } from "../analytics";
 import { trackEvent } from "../analytics";
 import {
 import {
   getDefaultAppState,
   getDefaultAppState,
   isEraserActive,
   isEraserActive,
   isHandToolActive,
   isHandToolActive,
 } from "../appState";
 } 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 {
 import {
   APP_NAME,
   APP_NAME,
   CURSOR_TYPE,
   CURSOR_TYPE,
@@ -62,7 +60,6 @@ import {
   ENV,
   ENV,
   EVENT,
   EVENT,
   FRAME_STYLE,
   FRAME_STYLE,
-  EXPORT_IMAGE_TYPES,
   GRID_SIZE,
   GRID_SIZE,
   IMAGE_MIME_TYPES,
   IMAGE_MIME_TYPES,
   IMAGE_RENDER_TIMEOUT,
   IMAGE_RENDER_TIMEOUT,
@@ -92,7 +89,8 @@ import {
   supportsResizeObserver,
   supportsResizeObserver,
   DEFAULT_COLLISION_THRESHOLD,
   DEFAULT_COLLISION_THRESHOLD,
 } from "../constants";
 } 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 Library, { distributeLibraryItemsOnSquareGrid } from "../data/library";
 import { restore, restoreElements } from "../data/restore";
 import { restore, restoreElements } from "../data/restore";
 import {
 import {
@@ -163,7 +161,7 @@ import {
   isMagicFrameElement,
   isMagicFrameElement,
   isTextBindableContainer,
   isTextBindableContainer,
 } from "../element/typeChecks";
 } from "../element/typeChecks";
-import {
+import type {
   ExcalidrawBindableElement,
   ExcalidrawBindableElement,
   ExcalidrawElement,
   ExcalidrawElement,
   ExcalidrawFreeDrawElement,
   ExcalidrawFreeDrawElement,
@@ -220,11 +218,14 @@ import {
   isSomeElementSelected,
   isSomeElementSelected,
 } from "../scene";
 } from "../scene";
 import Scene from "../scene/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 { getStateForZoom } from "../scene/zoom";
 import { findShapeByKey } from "../shapes";
 import { findShapeByKey } from "../shapes";
+import type { GeometricShape } from "../../utils/geometry/shape";
 import {
 import {
-  GeometricShape,
   getClosedCurveShape,
   getClosedCurveShape,
   getCurveShape,
   getCurveShape,
   getEllipseShape,
   getEllipseShape,
@@ -233,7 +234,7 @@ import {
   getSelectionBoxShape,
   getSelectionBoxShape,
 } from "../../utils/geometry/shape";
 } from "../../utils/geometry/shape";
 import { isPointInShape } from "../../utils/collision";
 import { isPointInShape } from "../../utils/collision";
-import {
+import type {
   AppClassProperties,
   AppClassProperties,
   AppProps,
   AppProps,
   AppState,
   AppState,
@@ -291,11 +292,8 @@ import {
   maybeParseEmbedSrc,
   maybeParseEmbedSrc,
   getEmbedLink,
   getEmbedLink,
 } from "../element/embeddable";
 } 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 LayerUI from "./LayerUI";
 import { Toast } from "./Toast";
 import { Toast } from "./Toast";
 import { actionToggleViewMode } from "../actions/actionToggleViewMode";
 import { actionToggleViewMode } from "../actions/actionToggleViewMode";
@@ -320,7 +318,8 @@ import {
   updateImageCache as _updateImageCache,
   updateImageCache as _updateImageCache,
 } from "../element/image";
 } from "../element/image";
 import throttle from "lodash.throttle";
 import throttle from "lodash.throttle";
-import { fileOpen, FileSystemHandle } from "../data/filesystem";
+import type { FileSystemHandle } from "../data/filesystem";
+import { fileOpen } from "../data/filesystem";
 import {
 import {
   bindTextToShapeAfterDuplication,
   bindTextToShapeAfterDuplication,
   getApproxMinLineHeight,
   getApproxMinLineHeight,
@@ -386,11 +385,9 @@ import {
 import { actionWrapTextInContainer } from "../actions/actionBoundText";
 import { actionWrapTextInContainer } from "../actions/actionBoundText";
 import BraveMeasureTextError from "./BraveMeasureTextError";
 import BraveMeasureTextError from "./BraveMeasureTextError";
 import { activeEyeDropperAtom } from "./EyeDropper";
 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 { isSidebarDockedAtom } from "./Sidebar/Sidebar";
 import { StaticCanvas, InteractiveCanvas } from "./canvases";
 import { StaticCanvas, InteractiveCanvas } from "./canvases";
 import { Renderer } from "../scene/Renderer";
 import { Renderer } from "../scene/Renderer";
@@ -404,7 +401,8 @@ import {
 } from "../cursor";
 } from "../cursor";
 import { Emitter } from "../emitter";
 import { Emitter } from "../emitter";
 import { ElementCanvasButtons } from "../element/ElementCanvasButtons";
 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 { exportToBlob } from "../../utils/export";
 import { COLOR_PALETTE } from "../colors";
 import { COLOR_PALETTE } from "../colors";
 import { ElementCanvasButton } from "./MagicButton";
 import { ElementCanvasButton } from "./MagicButton";

+ 2 - 4
packages/excalidraw/components/ColorPicker/ColorInput.tsx

@@ -1,10 +1,8 @@
 import { useCallback, useEffect, useRef, useState } from "react";
 import { useCallback, useEffect, useRef, useState } from "react";
 import { getColor } from "./ColorPicker";
 import { getColor } from "./ColorPicker";
 import { useAtom } from "jotai";
 import { useAtom } from "jotai";
-import {
-  ColorPickerType,
-  activeColorPickerSectionAtom,
-} from "./colorPickerUtils";
+import type { ColorPickerType } from "./colorPickerUtils";
+import { activeColorPickerSectionAtom } from "./colorPickerUtils";
 import { eyeDropperIcon } from "../icons";
 import { eyeDropperIcon } from "../icons";
 import { jotaiScope } from "../../jotai";
 import { jotaiScope } from "../../jotai";
 import { KEYS } from "../../keys";
 import { KEYS } from "../../keys";

+ 6 - 7
packages/excalidraw/components/ColorPicker/ColorPicker.tsx

@@ -1,16 +1,15 @@
 import { isInteractive, isTransparent, isWritableElement } from "../../utils";
 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 { TopPicks } from "./TopPicks";
 import { Picker } from "./Picker";
 import { Picker } from "./Picker";
 import * as Popover from "@radix-ui/react-popover";
 import * as Popover from "@radix-ui/react-popover";
 import { useAtom } from "jotai";
 import { useAtom } from "jotai";
-import {
-  activeColorPickerSectionAtom,
-  ColorPickerType,
-} from "./colorPickerUtils";
+import type { ColorPickerType } from "./colorPickerUtils";
+import { activeColorPickerSectionAtom } from "./colorPickerUtils";
 import { useDevice, useExcalidrawContainer } from "../App";
 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 PickerHeading from "./PickerHeading";
 import { t } from "../../i18n";
 import { t } from "../../i18n";
 import clsx from "clsx";
 import clsx from "clsx";

+ 3 - 3
packages/excalidraw/components/ColorPicker/Picker.tsx

@@ -1,7 +1,7 @@
 import React, { useEffect, useState } from "react";
 import React, { useEffect, useState } from "react";
 import { t } from "../../i18n";
 import { t } from "../../i18n";
 
 
-import { ExcalidrawElement } from "../../element/types";
+import type { ExcalidrawElement } from "../../element/types";
 import { ShadeList } from "./ShadeList";
 import { ShadeList } from "./ShadeList";
 
 
 import PickerColorList from "./PickerColorList";
 import PickerColorList from "./PickerColorList";
@@ -9,15 +9,15 @@ import { useAtom } from "jotai";
 import { CustomColorList } from "./CustomColorList";
 import { CustomColorList } from "./CustomColorList";
 import { colorPickerKeyNavHandler } from "./keyboardNavHandlers";
 import { colorPickerKeyNavHandler } from "./keyboardNavHandlers";
 import PickerHeading from "./PickerHeading";
 import PickerHeading from "./PickerHeading";
+import type { ColorPickerType } from "./colorPickerUtils";
 import {
 import {
-  ColorPickerType,
   activeColorPickerSectionAtom,
   activeColorPickerSectionAtom,
   getColorNameAndShadeFromColor,
   getColorNameAndShadeFromColor,
   getMostUsedCustomColors,
   getMostUsedCustomColors,
   isCustomColor,
   isCustomColor,
 } from "./colorPickerUtils";
 } from "./colorPickerUtils";
+import type { ColorPaletteCustom } from "../../colors";
 import {
 import {
-  ColorPaletteCustom,
   DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX,
   DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX,
   DEFAULT_ELEMENT_STROKE_COLOR_INDEX,
   DEFAULT_ELEMENT_STROKE_COLOR_INDEX,
 } from "../../colors";
 } from "../../colors";

+ 3 - 2
packages/excalidraw/components/ColorPicker/PickerColorList.tsx

@@ -7,8 +7,9 @@ import {
   getColorNameAndShadeFromColor,
   getColorNameAndShadeFromColor,
 } from "./colorPickerUtils";
 } from "./colorPickerUtils";
 import HotkeyLabel from "./HotkeyLabel";
 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 {
 interface PickerColorListProps {
   palette: ColorPaletteCustom;
   palette: ColorPaletteCustom;

+ 1 - 1
packages/excalidraw/components/ColorPicker/PickerHeading.tsx

@@ -1,4 +1,4 @@
-import { ReactNode } from "react";
+import type { ReactNode } from "react";
 
 
 const PickerHeading = ({ children }: { children: ReactNode }) => (
 const PickerHeading = ({ children }: { children: ReactNode }) => (
   <div className="color-picker__heading">{children}</div>
   <div className="color-picker__heading">{children}</div>

+ 1 - 1
packages/excalidraw/components/ColorPicker/ShadeList.tsx

@@ -7,7 +7,7 @@ import {
 } from "./colorPickerUtils";
 } from "./colorPickerUtils";
 import HotkeyLabel from "./HotkeyLabel";
 import HotkeyLabel from "./HotkeyLabel";
 import { t } from "../../i18n";
 import { t } from "../../i18n";
-import { ColorPaletteCustom } from "../../colors";
+import type { ColorPaletteCustom } from "../../colors";
 
 
 interface ShadeListProps {
 interface ShadeListProps {
   hex: string;
   hex: string;

+ 1 - 1
packages/excalidraw/components/ColorPicker/TopPicks.tsx

@@ -1,5 +1,5 @@
 import clsx from "clsx";
 import clsx from "clsx";
-import { ColorPickerType } from "./colorPickerUtils";
+import type { ColorPickerType } from "./colorPickerUtils";
 import {
 import {
   DEFAULT_CANVAS_BACKGROUND_PICKS,
   DEFAULT_CANVAS_BACKGROUND_PICKS,
   DEFAULT_ELEMENT_BACKGROUND_PICKS,
   DEFAULT_ELEMENT_BACKGROUND_PICKS,

+ 3 - 6
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 { 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 = ({
 export const getColorNameAndShadeFromColor = ({
   palette,
   palette,

+ 4 - 5
packages/excalidraw/components/ColorPicker/keyboardNavHandlers.ts

@@ -1,14 +1,13 @@
 import { KEYS } from "../../keys";
 import { KEYS } from "../../keys";
-import {
+import type {
   ColorPickerColor,
   ColorPickerColor,
   ColorPalette,
   ColorPalette,
   ColorPaletteCustom,
   ColorPaletteCustom,
-  COLORS_PER_ROW,
-  COLOR_PALETTE,
 } from "../../colors";
 } 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 {
 import {
-  ActiveColorPickerSectionAtomType,
   colorPickerHotkeyBindings,
   colorPickerHotkeyBindings,
   getColorNameAndShadeFromColor,
   getColorNameAndShadeFromColor,
 } from "./colorPickerUtils";
 } from "./colorPickerUtils";

+ 8 - 9
packages/excalidraw/components/CommandPalette/CommandPalette.tsx

@@ -10,12 +10,11 @@ import { Dialog } from "../Dialog";
 import { TextField } from "../TextField";
 import { TextField } from "../TextField";
 import clsx from "clsx";
 import clsx from "clsx";
 import { getSelectedElements } from "../../scene";
 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 { DEFAULT_SIDEBAR, EVENT } from "../../constants";
 import {
 import {
   LockedIcon,
   LockedIcon,
@@ -31,7 +30,7 @@ import {
 } from "../icons";
 } from "../icons";
 import fuzzy from "fuzzy";
 import fuzzy from "fuzzy";
 import { useUIAppState } from "../../context/ui-appState";
 import { useUIAppState } from "../../context/ui-appState";
-import { AppProps, AppState, UIAppState } from "../../types";
+import type { AppProps, AppState, UIAppState } from "../../types";
 import {
 import {
   capitalizeString,
   capitalizeString,
   getShortcutKey,
   getShortcutKey,
@@ -39,7 +38,7 @@ import {
 } from "../../utils";
 } from "../../utils";
 import { atom, useAtom } from "jotai";
 import { atom, useAtom } from "jotai";
 import { deburr } from "../../deburr";
 import { deburr } from "../../deburr";
-import { MarkRequired } from "../../utility-types";
+import type { MarkRequired } from "../../utility-types";
 import { InlineIcon } from "../InlineIcon";
 import { InlineIcon } from "../InlineIcon";
 import { SHAPES } from "../../shapes";
 import { SHAPES } from "../../shapes";
 import { canChangeBackgroundColor, canChangeStrokeColor } from "../Actions";
 import { canChangeBackgroundColor, canChangeStrokeColor } from "../Actions";
@@ -47,7 +46,7 @@ import { useStableCallback } from "../../hooks/useStableCallback";
 import { actionClearCanvas, actionLink } from "../../actions";
 import { actionClearCanvas, actionLink } from "../../actions";
 import { jotaiStore } from "../../jotai";
 import { jotaiStore } from "../../jotai";
 import { activeConfirmDialogAtom } from "../ActiveConfirmDialog";
 import { activeConfirmDialogAtom } from "../ActiveConfirmDialog";
-import { CommandPaletteItem } from "./types";
+import type { CommandPaletteItem } from "./types";
 import * as defaultItems from "./defaultCommandPaletteItems";
 import * as defaultItems from "./defaultCommandPaletteItems";
 import { trackEvent } from "../../analytics";
 import { trackEvent } from "../../analytics";
 import { useStable } from "../../hooks/useStable";
 import { useStable } from "../../hooks/useStable";

+ 1 - 1
packages/excalidraw/components/CommandPalette/defaultCommandPaletteItems.ts

@@ -1,5 +1,5 @@
 import { actionToggleTheme } from "../../actions";
 import { actionToggleTheme } from "../../actions";
-import { CommandPaletteItem } from "./types";
+import type { CommandPaletteItem } from "./types";
 
 
 export const toggleTheme: CommandPaletteItem = {
 export const toggleTheme: CommandPaletteItem = {
   ...actionToggleTheme,
   ...actionToggleTheme,

+ 3 - 3
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 = {
 export type CommandPaletteItem = {
   label: string;
   label: string;

+ 2 - 1
packages/excalidraw/components/ConfirmDialog.tsx

@@ -1,5 +1,6 @@
 import { t } from "../i18n";
 import { t } from "../i18n";
-import { Dialog, DialogProps } from "./Dialog";
+import type { DialogProps } from "./Dialog";
+import { Dialog } from "./Dialog";
 
 
 import "./ConfirmDialog.scss";
 import "./ConfirmDialog.scss";
 import DialogActionButton from "./DialogActionButton";
 import DialogActionButton from "./DialogActionButton";

+ 6 - 7
packages/excalidraw/components/ContextMenu.tsx

@@ -1,14 +1,13 @@
 import clsx from "clsx";
 import clsx from "clsx";
 import { Popover } from "./Popover";
 import { Popover } from "./Popover";
-import { t, TranslationKeys } from "../i18n";
+import type { TranslationKeys } from "../i18n";
+import { t } from "../i18n";
 
 
 import "./ContextMenu.scss";
 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 { useExcalidrawAppState, useExcalidrawElements } from "./App";
 import React from "react";
 import React from "react";
 
 

+ 1 - 1
packages/excalidraw/components/DarkModeToggle.tsx

@@ -3,7 +3,7 @@ import "./ToolIcon.scss";
 import { t } from "../i18n";
 import { t } from "../i18n";
 import { ToolButton } from "./ToolButton";
 import { ToolButton } from "./ToolButton";
 import { THEME } from "../constants";
 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,
 // We chose to use only explicit toggle and not a third option for system value,
 // but this could be added in the future.
 // but this could be added in the future.

+ 2 - 2
packages/excalidraw/components/DefaultSidebar.tsx

@@ -3,12 +3,12 @@ import { DEFAULT_SIDEBAR, LIBRARY_SIDEBAR_TAB } from "../constants";
 import { useTunnels } from "../context/tunnels";
 import { useTunnels } from "../context/tunnels";
 import { useUIAppState } from "../context/ui-appState";
 import { useUIAppState } from "../context/ui-appState";
 import { t } from "../i18n";
 import { t } from "../i18n";
-import { MarkOptional, Merge } from "../utility-types";
+import type { MarkOptional, Merge } from "../utility-types";
 import { composeEventHandlers } from "../utils";
 import { composeEventHandlers } from "../utils";
 import { useExcalidrawSetAppState } from "./App";
 import { useExcalidrawSetAppState } from "./App";
 import { withInternalFallback } from "./hoc/withInternalFallback";
 import { withInternalFallback } from "./hoc/withInternalFallback";
 import { LibraryMenu } from "./LibraryMenu";
 import { LibraryMenu } from "./LibraryMenu";
-import { SidebarProps, SidebarTriggerProps } from "./Sidebar/common";
+import type { SidebarProps, SidebarTriggerProps } from "./Sidebar/common";
 import { Sidebar } from "./Sidebar/Sidebar";
 import { Sidebar } from "./Sidebar/Sidebar";
 
 
 const DefaultSidebarTrigger = withInternalFallback(
 const DefaultSidebarTrigger = withInternalFallback(

+ 1 - 1
packages/excalidraw/components/DialogActionButton.tsx

@@ -1,5 +1,5 @@
 import clsx from "clsx";
 import clsx from "clsx";
-import { ReactNode } from "react";
+import type { ReactNode } from "react";
 import "./DialogActionButton.scss";
 import "./DialogActionButton.scss";
 import Spinner from "./Spinner";
 import Spinner from "./Spinner";
 
 

+ 2 - 2
packages/excalidraw/components/EyeDropper.tsx

@@ -12,8 +12,8 @@ import { useApp, useExcalidrawContainer, useExcalidrawElements } from "./App";
 import { useStable } from "../hooks/useStable";
 import { useStable } from "../hooks/useStable";
 
 
 import "./EyeDropper.scss";
 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 = {
 export type EyeDropperProperties = {
   keepOpenOnAlt: boolean;
   keepOpenOnAlt: boolean;

+ 1 - 1
packages/excalidraw/components/FollowMode/FollowMode.tsx

@@ -1,4 +1,4 @@
-import { UserToFollow } from "../../types";
+import type { UserToFollow } from "../../types";
 import { CloseIcon } from "../icons";
 import { CloseIcon } from "../icons";
 import "./FollowMode.scss";
 import "./FollowMode.scss";
 
 

+ 1 - 1
packages/excalidraw/components/HintViewer.tsx

@@ -1,5 +1,5 @@
 import { t } from "../i18n";
 import { t } from "../i18n";
-import { AppClassProperties, Device, UIAppState } from "../types";
+import type { AppClassProperties, Device, UIAppState } from "../types";
 import {
 import {
   isImageElement,
   isImageElement,
   isLinearElement,
   isLinearElement,

+ 1 - 1
packages/excalidraw/components/ImageExportDialog.tsx

@@ -20,7 +20,7 @@ import {
 
 
 import { canvasToBlob } from "../data/blob";
 import { canvasToBlob } from "../data/blob";
 import { nativeFileSystemSupported } from "../data/filesystem";
 import { nativeFileSystemSupported } from "../data/filesystem";
-import { NonDeletedExcalidrawElement } from "../element/types";
+import type { NonDeletedExcalidrawElement } from "../element/types";
 import { t } from "../i18n";
 import { t } from "../i18n";
 import { isSomeElementSelected } from "../scene";
 import { isSomeElementSelected } from "../scene";
 import { exportToCanvas } from "../../utils/export";
 import { exportToCanvas } from "../../utils/export";

+ 3 - 2
packages/excalidraw/components/InitializeApp.tsx

@@ -1,8 +1,9 @@
 import React, { useEffect, useState } from "react";
 import React, { useEffect, useState } from "react";
 
 
 import { LoadingMessage } from "./LoadingMessage";
 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 {
 interface Props {
   langCode: Language["code"];
   langCode: Language["code"];

+ 3 - 3
packages/excalidraw/components/JSONExportDialog.tsx

@@ -1,8 +1,8 @@
 import React from "react";
 import React from "react";
-import { NonDeletedExcalidrawElement } from "../element/types";
+import type { NonDeletedExcalidrawElement } from "../element/types";
 import { t } from "../i18n";
 import { t } from "../i18n";
 
 
-import { ExportOpts, BinaryFiles, UIAppState } from "../types";
+import type { ExportOpts, BinaryFiles, UIAppState } from "../types";
 import { Dialog } from "./Dialog";
 import { Dialog } from "./Dialog";
 import { exportToFileIcon, LinkIcon } from "./icons";
 import { exportToFileIcon, LinkIcon } from "./icons";
 import { ToolButton } from "./ToolButton";
 import { ToolButton } from "./ToolButton";
@@ -12,7 +12,7 @@ import { Card } from "./Card";
 import "./ExportDialog.scss";
 import "./ExportDialog.scss";
 import { nativeFileSystemSupported } from "../data/filesystem";
 import { nativeFileSystemSupported } from "../data/filesystem";
 import { trackEvent } from "../analytics";
 import { trackEvent } from "../analytics";
-import { ActionManager } from "../actions/manager";
+import type { ActionManager } from "../actions/manager";
 import { getFrame } from "../utils";
 import { getFrame } from "../utils";
 
 
 export type ExportCB = (
 export type ExportCB = (

+ 1 - 1
packages/excalidraw/components/LaserPointerButton.tsx

@@ -1,7 +1,7 @@
 import "./ToolIcon.scss";
 import "./ToolIcon.scss";
 
 
 import clsx from "clsx";
 import clsx from "clsx";
-import { ToolButtonSize } from "./ToolButton";
+import type { ToolButtonSize } from "./ToolButton";
 import { laserPointerToolIcon } from "./icons";
 import { laserPointerToolIcon } from "./icons";
 
 
 type LaserPointerIconProps = {
 type LaserPointerIconProps = {

+ 5 - 4
packages/excalidraw/components/LayerUI.tsx

@@ -1,6 +1,6 @@
 import clsx from "clsx";
 import clsx from "clsx";
 import React from "react";
 import React from "react";
-import { ActionManager } from "../actions/manager";
+import type { ActionManager } from "../actions/manager";
 import {
 import {
   CLASSES,
   CLASSES,
   DEFAULT_SIDEBAR,
   DEFAULT_SIDEBAR,
@@ -8,10 +8,11 @@ import {
   TOOL_TYPE,
   TOOL_TYPE,
 } from "../constants";
 } from "../constants";
 import { showSelectedShapeActions } from "../element";
 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 { calculateScrollCenter } from "../scene";
-import {
+import type {
   AppProps,
   AppProps,
   AppState,
   AppState,
   ExcalidrawProps,
   ExcalidrawProps,

+ 4 - 3
packages/excalidraw/components/LibraryMenu.tsx

@@ -1,11 +1,12 @@
 import React, { useState, useCallback, useMemo, useRef } from "react";
 import React, { useState, useCallback, useMemo, useRef } from "react";
-import Library, {
+import type Library from "../data/library";
+import {
   distributeLibraryItemsOnSquareGrid,
   distributeLibraryItemsOnSquareGrid,
   libraryItemsAtom,
   libraryItemsAtom,
 } from "../data/library";
 } from "../data/library";
 import { t } from "../i18n";
 import { t } from "../i18n";
 import { randomId } from "../random";
 import { randomId } from "../random";
-import {
+import type {
   LibraryItems,
   LibraryItems,
   LibraryItem,
   LibraryItem,
   ExcalidrawProps,
   ExcalidrawProps,
@@ -28,7 +29,7 @@ import { useUIAppState } from "../context/ui-appState";
 import "./LibraryMenu.scss";
 import "./LibraryMenu.scss";
 import { LibraryMenuControlButtons } from "./LibraryMenuControlButtons";
 import { LibraryMenuControlButtons } from "./LibraryMenuControlButtons";
 import { isShallowEqual } from "../utils";
 import { isShallowEqual } from "../utils";
-import { NonDeletedExcalidrawElement } from "../element/types";
+import type { NonDeletedExcalidrawElement } from "../element/types";
 import { LIBRARY_DISABLED_TYPES } from "../constants";
 import { LIBRARY_DISABLED_TYPES } from "../constants";
 
 
 export const isLibraryMenuOpenAtom = atom(false);
 export const isLibraryMenuOpenAtom = atom(false);

+ 1 - 1
packages/excalidraw/components/LibraryMenuBrowseButton.tsx

@@ -1,6 +1,6 @@
 import { VERSIONS } from "../constants";
 import { VERSIONS } from "../constants";
 import { t } from "../i18n";
 import { t } from "../i18n";
-import { ExcalidrawProps, UIAppState } from "../types";
+import type { ExcalidrawProps, UIAppState } from "../types";
 
 
 const LibraryMenuBrowseButton = ({
 const LibraryMenuBrowseButton = ({
   theme,
   theme,

+ 1 - 1
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 LibraryMenuBrowseButton from "./LibraryMenuBrowseButton";
 import clsx from "clsx";
 import clsx from "clsx";
 
 

+ 3 - 2
packages/excalidraw/components/LibraryMenuHeaderContent.tsx

@@ -2,10 +2,11 @@ import { useCallback, useState } from "react";
 import { t } from "../i18n";
 import { t } from "../i18n";
 import Trans from "./Trans";
 import Trans from "./Trans";
 import { jotaiScope } from "../jotai";
 import { jotaiScope } from "../jotai";
-import { LibraryItem, LibraryItems, UIAppState } from "../types";
+import type { LibraryItem, LibraryItems, UIAppState } from "../types";
 import { useApp, useExcalidrawSetAppState } from "./App";
 import { useApp, useExcalidrawSetAppState } from "./App";
 import { saveLibraryAsJSON } from "../data/json";
 import { saveLibraryAsJSON } from "../data/json";
-import Library, { libraryItemsAtom } from "../data/library";
+import type Library from "../data/library";
+import { libraryItemsAtom } from "../data/library";
 import {
 import {
   DotsIcon,
   DotsIcon,
   ExportIcon,
   ExportIcon,

+ 1 - 1
packages/excalidraw/components/LibraryMenuItems.tsx

@@ -7,7 +7,7 @@ import React, {
 } from "react";
 } from "react";
 import { serializeLibraryAsJSON } from "../data/json";
 import { serializeLibraryAsJSON } from "../data/json";
 import { t } from "../i18n";
 import { t } from "../i18n";
-import {
+import type {
   ExcalidrawProps,
   ExcalidrawProps,
   LibraryItem,
   LibraryItem,
   LibraryItems,
   LibraryItems,

+ 5 - 4
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 { 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";
 import { useTransition } from "../hooks/useTransition";
 
 
 type LibraryOrPendingItem = (
 type LibraryOrPendingItem = (

+ 3 - 2
packages/excalidraw/components/LibraryUnit.tsx

@@ -1,11 +1,12 @@
 import clsx from "clsx";
 import clsx from "clsx";
 import { memo, useEffect, useRef, useState } from "react";
 import { memo, useEffect, useRef, useState } from "react";
 import { useDevice } from "./App";
 import { useDevice } from "./App";
-import { LibraryItem } from "../types";
+import type { LibraryItem } from "../types";
 import "./LibraryUnit.scss";
 import "./LibraryUnit.scss";
 import { CheckboxItem } from "./CheckboxItem";
 import { CheckboxItem } from "./CheckboxItem";
 import { PlusIcon } from "./icons";
 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(
 export const LibraryUnit = memo(
   ({
   ({

+ 1 - 1
packages/excalidraw/components/LoadingMessage.tsx

@@ -3,7 +3,7 @@ import { useState, useEffect } from "react";
 import Spinner from "./Spinner";
 import Spinner from "./Spinner";
 import clsx from "clsx";
 import clsx from "clsx";
 import { THEME } from "../constants";
 import { THEME } from "../constants";
-import { Theme } from "../element/types";
+import type { Theme } from "../element/types";
 
 
 export const LoadingMessage: React.FC<{ delay?: number; theme?: Theme }> = ({
 export const LoadingMessage: React.FC<{ delay?: number; theme?: Theme }> = ({
   delay,
   delay,

+ 1 - 1
packages/excalidraw/components/LockButton.tsx

@@ -1,7 +1,7 @@
 import "./ToolIcon.scss";
 import "./ToolIcon.scss";
 
 
 import clsx from "clsx";
 import clsx from "clsx";
-import { ToolButtonSize } from "./ToolButton";
+import type { ToolButtonSize } from "./ToolButton";
 import { LockedIcon, UnlockedIcon } from "./icons";
 import { LockedIcon, UnlockedIcon } from "./icons";
 
 
 type LockIconProps = {
 type LockIconProps = {

+ 1 - 1
packages/excalidraw/components/MagicButton.tsx

@@ -1,7 +1,7 @@
 import "./ToolIcon.scss";
 import "./ToolIcon.scss";
 
 
 import clsx from "clsx";
 import clsx from "clsx";
-import { ToolButtonSize } from "./ToolButton";
+import type { ToolButtonSize } from "./ToolButton";
 
 
 const DEFAULT_SIZE: ToolButtonSize = "small";
 const DEFAULT_SIZE: ToolButtonSize = "small";
 
 

+ 3 - 3
packages/excalidraw/components/MobileMenu.tsx

@@ -1,5 +1,5 @@
 import React from "react";
 import React from "react";
-import {
+import type {
   AppClassProperties,
   AppClassProperties,
   AppProps,
   AppProps,
   AppState,
   AppState,
@@ -7,11 +7,11 @@ import {
   ExcalidrawProps,
   ExcalidrawProps,
   UIAppState,
   UIAppState,
 } from "../types";
 } from "../types";
-import { ActionManager } from "../actions/manager";
+import type { ActionManager } from "../actions/manager";
 import { t } from "../i18n";
 import { t } from "../i18n";
 import Stack from "./Stack";
 import Stack from "./Stack";
 import { showSelectedShapeActions } from "../element";
 import { showSelectedShapeActions } from "../element";
-import { NonDeletedExcalidrawElement } from "../element/types";
+import type { NonDeletedExcalidrawElement } from "../element/types";
 import { FixedSideContainer } from "./FixedSideContainer";
 import { FixedSideContainer } from "./FixedSideContainer";
 import { Island } from "./Island";
 import { Island } from "./Island";
 import { HintViewer } from "./HintViewer";
 import { HintViewer } from "./HintViewer";

+ 1 - 1
packages/excalidraw/components/Modal.tsx

@@ -3,7 +3,7 @@ import "./Modal.scss";
 import { createPortal } from "react-dom";
 import { createPortal } from "react-dom";
 import clsx from "clsx";
 import clsx from "clsx";
 import { KEYS } from "../keys";
 import { KEYS } from "../keys";
-import { AppState } from "../types";
+import type { AppState } from "../types";
 import { useCreatePortalContainer } from "../hooks/useCreatePortalContainer";
 import { useCreatePortalContainer } from "../hooks/useCreatePortalContainer";
 import { useRef } from "react";
 import { useRef } from "react";
 
 

+ 1 - 1
packages/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.ts

@@ -1,6 +1,6 @@
 import { atom } from "jotai";
 import { atom } from "jotai";
 import { jotaiStore } from "../../jotai";
 import { jotaiStore } from "../../jotai";
-import React from "react";
+import type React from "react";
 
 
 export type OverwriteConfirmState =
 export type OverwriteConfirmState =
   | {
   | {

+ 4 - 3
packages/excalidraw/components/PasteChartDialog.tsx

@@ -1,11 +1,12 @@
 import oc from "open-color";
 import oc from "open-color";
 import React, { useLayoutEffect, useRef, useState } from "react";
 import React, { useLayoutEffect, useRef, useState } from "react";
 import { trackEvent } from "../analytics";
 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 { t } from "../i18n";
 import { exportToSvg } from "../scene/export";
 import { exportToSvg } from "../scene/export";
-import { UIAppState } from "../types";
+import type { UIAppState } from "../types";
 import { useApp } from "./App";
 import { useApp } from "./App";
 import { Dialog } from "./Dialog";
 import { Dialog } from "./Dialog";
 
 

+ 1 - 1
packages/excalidraw/components/PenModeButton.tsx

@@ -1,7 +1,7 @@
 import "./ToolIcon.scss";
 import "./ToolIcon.scss";
 
 
 import clsx from "clsx";
 import clsx from "clsx";
-import { ToolButtonSize } from "./ToolButton";
+import type { ToolButtonSize } from "./ToolButton";
 import { PenModeIcon } from "./icons";
 import { PenModeIcon } from "./icons";
 
 
 type PenModeIconProps = {
 type PenModeIconProps = {

+ 4 - 3
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 OpenColor from "open-color";
 
 
 import { Dialog } from "./Dialog";
 import { Dialog } from "./Dialog";
 import { t } from "../i18n";
 import { t } from "../i18n";
 import Trans from "./Trans";
 import Trans from "./Trans";
 
 
-import { LibraryItems, LibraryItem, UIAppState } from "../types";
+import type { LibraryItems, LibraryItem, UIAppState } from "../types";
 import { exportToCanvas, exportToSvg } from "../../utils/export";
 import { exportToCanvas, exportToSvg } from "../../utils/export";
 import {
 import {
   EDITOR_LS_KEYS,
   EDITOR_LS_KEYS,
@@ -14,7 +15,7 @@ import {
   MIME_TYPES,
   MIME_TYPES,
   VERSIONS,
   VERSIONS,
 } from "../constants";
 } from "../constants";
-import { ExportedLibraryData } from "../data/types";
+import type { ExportedLibraryData } from "../data/types";
 import { canvasToBlob, resizeImageFile } from "../data/blob";
 import { canvasToBlob, resizeImageFile } from "../data/blob";
 import { chunk } from "../utils";
 import { chunk } from "../utils";
 import DialogActionButton from "./DialogActionButton";
 import DialogActionButton from "./DialogActionButton";

+ 1 - 1
packages/excalidraw/components/SVGLayer.tsx

@@ -1,5 +1,5 @@
 import { useEffect, useRef } from "react";
 import { useEffect, useRef } from "react";
-import { Trail } from "../animated-trail";
+import type { Trail } from "../animated-trail";
 
 
 import "./SVGLayer.scss";
 import "./SVGLayer.scss";
 
 

+ 2 - 5
packages/excalidraw/components/Sidebar/Sidebar.tsx

@@ -10,11 +10,8 @@ import React, {
 import { Island } from "../Island";
 import { Island } from "../Island";
 import { atom, useSetAtom } from "jotai";
 import { atom, useSetAtom } from "jotai";
 import { jotaiScope } 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 { SidebarHeader } from "./SidebarHeader";
 import clsx from "clsx";
 import clsx from "clsx";
 import { useDevice, useExcalidrawSetAppState } from "../App";
 import { useDevice, useExcalidrawSetAppState } from "../App";

+ 1 - 1
packages/excalidraw/components/Sidebar/SidebarTab.tsx

@@ -1,5 +1,5 @@
 import * as RadixTabs from "@radix-ui/react-tabs";
 import * as RadixTabs from "@radix-ui/react-tabs";
-import { SidebarTabName } from "../../types";
+import type { SidebarTabName } from "../../types";
 
 
 export const SidebarTab = ({
 export const SidebarTab = ({
   tab,
   tab,

+ 1 - 1
packages/excalidraw/components/Sidebar/SidebarTabTrigger.tsx

@@ -1,5 +1,5 @@
 import * as RadixTabs from "@radix-ui/react-tabs";
 import * as RadixTabs from "@radix-ui/react-tabs";
-import { SidebarTabName } from "../../types";
+import type { SidebarTabName } from "../../types";
 
 
 export const SidebarTabTrigger = ({
 export const SidebarTabTrigger = ({
   children,
   children,

+ 1 - 1
packages/excalidraw/components/Sidebar/SidebarTrigger.tsx

@@ -1,5 +1,5 @@
 import { useExcalidrawSetAppState } from "../App";
 import { useExcalidrawSetAppState } from "../App";
-import { SidebarTriggerProps } from "./common";
+import type { SidebarTriggerProps } from "./common";
 import { useUIAppState } from "../../context/ui-appState";
 import { useUIAppState } from "../../context/ui-appState";
 import clsx from "clsx";
 import clsx from "clsx";
 
 

+ 1 - 1
packages/excalidraw/components/Sidebar/common.ts

@@ -1,5 +1,5 @@
 import React from "react";
 import React from "react";
-import { AppState, SidebarName, SidebarTabName } from "../../types";
+import type { AppState, SidebarName, SidebarTabName } from "../../types";
 
 
 export type SidebarTriggerProps = {
 export type SidebarTriggerProps = {
   name: SidebarName;
   name: SidebarName;

+ 2 - 2
packages/excalidraw/components/Stats.tsx

@@ -1,9 +1,9 @@
 import React from "react";
 import React from "react";
 import { getCommonBounds } from "../element/bounds";
 import { getCommonBounds } from "../element/bounds";
-import { NonDeletedExcalidrawElement } from "../element/types";
+import type { NonDeletedExcalidrawElement } from "../element/types";
 import { t } from "../i18n";
 import { t } from "../i18n";
 import { getTargetElements } from "../scene";
 import { getTargetElements } from "../scene";
-import { ExcalidrawProps, UIAppState } from "../types";
+import type { ExcalidrawProps, UIAppState } from "../types";
 import { CloseIcon } from "./icons";
 import { CloseIcon } from "./icons";
 import { Island } from "./Island";
 import { Island } from "./Island";
 import "./Stats.scss";
 import "./Stats.scss";

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác