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