diff --git a/excalidraw-app/App.tsx b/excalidraw-app/App.tsx index cd1f4cb5b..7dd92fd6b 100644 --- a/excalidraw-app/App.tsx +++ b/excalidraw-app/App.tsx @@ -71,7 +71,7 @@ import type { ExcalidrawInitialDataState, UIAppState, } from "@excalidraw/excalidraw/types"; -import type { ResolutionType } from "@excalidraw/excalidraw/utility-types"; +import type { ResolutionType } from "@excalidraw/common/utility-types"; import type { ResolvablePromise } from "@excalidraw/common"; import CustomStats from "./CustomStats"; diff --git a/excalidraw-app/collab/Collab.tsx b/excalidraw-app/collab/Collab.tsx index c23a0f474..fc4d08554 100644 --- a/excalidraw-app/collab/Collab.tsx +++ b/excalidraw-app/collab/Collab.tsx @@ -49,7 +49,7 @@ import type { Collaborator, Gesture, } from "@excalidraw/excalidraw/types"; -import type { Mutable, ValueOf } from "@excalidraw/excalidraw/utility-types"; +import type { Mutable, ValueOf } from "@excalidraw/common/utility-types"; import { appJotaiStore, atom } from "../app-jotai"; import { diff --git a/excalidraw-app/data/LocalData.ts b/excalidraw-app/data/LocalData.ts index 3ff2692d9..97ac559d3 100644 --- a/excalidraw-app/data/LocalData.ts +++ b/excalidraw-app/data/LocalData.ts @@ -32,7 +32,7 @@ import type { BinaryFileData, BinaryFiles, } from "@excalidraw/excalidraw/types"; -import type { MaybePromise } from "@excalidraw/excalidraw/utility-types"; +import type { MaybePromise } from "@excalidraw/common/utility-types"; import { SAVE_TO_LOCAL_STORAGE_TIMEOUT, STORAGE_KEYS } from "../app_constants"; diff --git a/excalidraw-app/data/index.ts b/excalidraw-app/data/index.ts index 3964b27d2..7bb0f9d8d 100644 --- a/excalidraw-app/data/index.ts +++ b/excalidraw-app/data/index.ts @@ -28,7 +28,7 @@ import type { BinaryFiles, SocketId, } from "@excalidraw/excalidraw/types"; -import type { MakeBrand } from "@excalidraw/excalidraw/utility-types"; +import type { MakeBrand } from "@excalidraw/common/utility-types"; import { DELETED_ELEMENT_TIMEOUT, diff --git a/packages/common/src/colors.ts b/packages/common/src/colors.ts index 2e943f1b0..42d7bc710 100644 --- a/packages/common/src/colors.ts +++ b/packages/common/src/colors.ts @@ -1,6 +1,6 @@ import oc from "open-color"; -import type { Merge } from "@excalidraw/excalidraw/utility-types"; +import type { Merge } from "@excalidraw/common/utility-types"; // FIXME can't put to utils.ts rn because of circular dependency const pick = , K extends readonly (keyof R)[]>( diff --git a/packages/common/src/keys.ts b/packages/common/src/keys.ts index 1600518c7..255d986fd 100644 --- a/packages/common/src/keys.ts +++ b/packages/common/src/keys.ts @@ -1,4 +1,4 @@ -import type { ValueOf } from "@excalidraw/excalidraw/utility-types"; +import type { ValueOf } from "@excalidraw/common/utility-types"; import { isDarwin } from "./constants"; diff --git a/packages/excalidraw/utility-types.ts b/packages/common/src/utility-types.ts similarity index 100% rename from packages/excalidraw/utility-types.ts rename to packages/common/src/utility-types.ts diff --git a/packages/common/src/utils.ts b/packages/common/src/utils.ts index f7e4dcae9..177dc26b6 100644 --- a/packages/common/src/utils.ts +++ b/packages/common/src/utils.ts @@ -21,7 +21,7 @@ import type { import type { MaybePromise, ResolutionType, -} from "@excalidraw/excalidraw/utility-types"; +} from "@excalidraw/common/utility-types"; import { COLOR_PALETTE } from "./colors"; import { diff --git a/packages/element/src/Shape.ts b/packages/element/src/Shape.ts index dc82d6586..3f84fe28b 100644 --- a/packages/element/src/Shape.ts +++ b/packages/element/src/Shape.ts @@ -13,7 +13,7 @@ import { isLinearElement, } from "@excalidraw/element/typeChecks"; -import type { Mutable } from "@excalidraw/excalidraw/utility-types"; +import type { Mutable } from "@excalidraw/common/utility-types"; import type { ExcalidrawElement, diff --git a/packages/element/src/bounds.ts b/packages/element/src/bounds.ts index ff967ddbe..ccc8b7b4a 100644 --- a/packages/element/src/bounds.ts +++ b/packages/element/src/bounds.ts @@ -25,7 +25,7 @@ import type { import type { AppState } from "@excalidraw/excalidraw/types"; -import type { Mutable } from "@excalidraw/excalidraw/utility-types"; +import type { Mutable } from "@excalidraw/common/utility-types"; import { LinearElementEditor } from "./linearElementEditor"; import { getBoundTextElement, getContainerElement } from "./textElement"; diff --git a/packages/element/src/embeddable.ts b/packages/element/src/embeddable.ts index 16ac97f65..e6d6b4af3 100644 --- a/packages/element/src/embeddable.ts +++ b/packages/element/src/embeddable.ts @@ -6,7 +6,7 @@ import { } from "@excalidraw/common"; import type { ExcalidrawProps } from "@excalidraw/excalidraw/types"; -import type { MarkRequired } from "@excalidraw/excalidraw/utility-types"; +import type { MarkRequired } from "@excalidraw/common/utility-types"; import { newTextElement } from "./newElement"; import { wrapText } from "./textWrapping"; diff --git a/packages/element/src/frame.ts b/packages/element/src/frame.ts index 1b8983e07..93db14823 100644 --- a/packages/element/src/frame.ts +++ b/packages/element/src/frame.ts @@ -29,7 +29,7 @@ import type { StaticCanvasAppState, } from "@excalidraw/excalidraw/types"; -import type { ReadonlySetLike } from "@excalidraw/excalidraw/utility-types"; +import type { ReadonlySetLike } from "@excalidraw/common/utility-types"; import { getElementsInGroup, selectGroupsFromGivenElements } from "./groups"; diff --git a/packages/element/src/groups.ts b/packages/element/src/groups.ts index 0d0c62b4e..ffa8dfcfd 100644 --- a/packages/element/src/groups.ts +++ b/packages/element/src/groups.ts @@ -17,7 +17,7 @@ import type { AppState, InteractiveCanvasAppState, } from "@excalidraw/excalidraw/types"; -import type { Mutable } from "@excalidraw/excalidraw/utility-types"; +import type { Mutable } from "@excalidraw/common/utility-types"; export const selectGroup = ( groupId: GroupId, diff --git a/packages/element/src/linearElementEditor.ts b/packages/element/src/linearElementEditor.ts index 8a4e0c856..72e068a14 100644 --- a/packages/element/src/linearElementEditor.ts +++ b/packages/element/src/linearElementEditor.ts @@ -43,7 +43,7 @@ import type { Zoom, } from "@excalidraw/excalidraw/types"; -import type { Mutable } from "@excalidraw/excalidraw/utility-types"; +import type { Mutable } from "@excalidraw/common/utility-types"; import { bindOrUnbindLinearElement, diff --git a/packages/element/src/mutateElement.ts b/packages/element/src/mutateElement.ts index 35fda4fbc..7de80ef43 100644 --- a/packages/element/src/mutateElement.ts +++ b/packages/element/src/mutateElement.ts @@ -10,7 +10,7 @@ import Scene from "@excalidraw/excalidraw/scene/Scene"; import type { Radians } from "@excalidraw/math"; -import type { Mutable } from "@excalidraw/excalidraw/utility-types"; +import type { Mutable } from "@excalidraw/common/utility-types"; import { ShapeCache } from "./ShapeCache"; diff --git a/packages/element/src/newElement.ts b/packages/element/src/newElement.ts index 3fc5634b7..92e6991d8 100644 --- a/packages/element/src/newElement.ts +++ b/packages/element/src/newElement.ts @@ -25,7 +25,7 @@ import type { MarkOptional, Merge, Mutable, -} from "@excalidraw/excalidraw/utility-types"; +} from "@excalidraw/common/utility-types"; import { getResizedElementAbsoluteCoords } from "./bounds"; import { bumpVersion, newElementWith } from "./mutateElement"; diff --git a/packages/element/src/resizeElements.ts b/packages/element/src/resizeElements.ts index b69edb837..24d851c4c 100644 --- a/packages/element/src/resizeElements.ts +++ b/packages/element/src/resizeElements.ts @@ -22,7 +22,7 @@ import type Scene from "@excalidraw/excalidraw/scene/Scene"; import type { PointerDownState } from "@excalidraw/excalidraw/types"; -import type { Mutable } from "@excalidraw/excalidraw/utility-types"; +import type { Mutable } from "@excalidraw/common/utility-types"; import { getArrowLocalFixedPoints, updateBoundElements } from "./binding"; import { diff --git a/packages/element/src/textElement.ts b/packages/element/src/textElement.ts index 1f132a3dd..f2e0ae7a3 100644 --- a/packages/element/src/textElement.ts +++ b/packages/element/src/textElement.ts @@ -11,7 +11,7 @@ import { import type { AppState } from "@excalidraw/excalidraw/types"; -import type { ExtractSetType } from "@excalidraw/excalidraw/utility-types"; +import type { ExtractSetType } from "@excalidraw/common/utility-types"; import { resetOriginalContainerCache, diff --git a/packages/element/src/typeChecks.ts b/packages/element/src/typeChecks.ts index 4e7030e2d..54619726d 100644 --- a/packages/element/src/typeChecks.ts +++ b/packages/element/src/typeChecks.ts @@ -2,7 +2,7 @@ import { ROUNDNESS, assertNever } from "@excalidraw/common"; import type { ElementOrToolType } from "@excalidraw/excalidraw/types"; -import type { MarkNonNullable } from "@excalidraw/excalidraw/utility-types"; +import type { MarkNonNullable } from "@excalidraw/common/utility-types"; import type { Bounds } from "./bounds"; import type { diff --git a/packages/element/src/types.ts b/packages/element/src/types.ts index 1066e7a5d..3b40135d5 100644 --- a/packages/element/src/types.ts +++ b/packages/element/src/types.ts @@ -13,7 +13,7 @@ import type { MarkNonNullable, Merge, ValueOf, -} from "@excalidraw/excalidraw/utility-types"; +} from "@excalidraw/common/utility-types"; export type ChartType = "bar" | "line"; export type FillStyle = "hachure" | "cross-hatch" | "solid" | "zigzag"; diff --git a/packages/excalidraw/actions/actionBoundText.tsx b/packages/excalidraw/actions/actionBoundText.tsx index a9625b9bb..dda0c527e 100644 --- a/packages/excalidraw/actions/actionBoundText.tsx +++ b/packages/excalidraw/actions/actionBoundText.tsx @@ -38,12 +38,13 @@ import type { ExcalidrawTextElement, } from "@excalidraw/element/types"; +import type { Mutable } from "@excalidraw/common/utility-types"; + import { CaptureUpdateAction } from "../store"; import { register } from "./register"; import type { AppState } from "../types"; -import type { Mutable } from "../utility-types"; export const actionUnbindText = register({ name: "unbindText", diff --git a/packages/excalidraw/actions/shortcuts.ts b/packages/excalidraw/actions/shortcuts.ts index 8de465128..1a13f1703 100644 --- a/packages/excalidraw/actions/shortcuts.ts +++ b/packages/excalidraw/actions/shortcuts.ts @@ -1,8 +1,9 @@ import { isDarwin, getShortcutKey } from "@excalidraw/common"; +import type { SubtypeOf } from "@excalidraw/common/utility-types"; + import { t } from "../i18n"; -import type { SubtypeOf } from "../utility-types"; import type { ActionName } from "./types"; export type ShortcutName = diff --git a/packages/excalidraw/change.ts b/packages/excalidraw/change.ts index 9028d237b..1f9e9106d 100644 --- a/packages/excalidraw/change.ts +++ b/packages/excalidraw/change.ts @@ -51,6 +51,8 @@ import type { SceneElementsMap, } from "@excalidraw/element/types"; +import type { SubtypeOf, ValueOf } from "@excalidraw/common/utility-types"; + import { getObservedAppState } from "./store"; import type { @@ -59,7 +61,6 @@ import type { ObservedElementsAppState, ObservedStandaloneAppState, } from "./types"; -import type { SubtypeOf, ValueOf } from "./utility-types"; /** * Represents the difference between two objects of the same type. diff --git a/packages/excalidraw/components/App.tsx b/packages/excalidraw/components/App.tsx index 5f4372a66..1ce4d678d 100644 --- a/packages/excalidraw/components/App.tsx +++ b/packages/excalidraw/components/App.tsx @@ -316,6 +316,8 @@ import type { ExcalidrawArrowElement, } from "@excalidraw/element/types"; +import type { ValueOf } from "@excalidraw/common/utility-types"; + import { actionAddToLibrary, actionBringForward, @@ -515,7 +517,6 @@ import type { NullableGridSize, Offsets, } from "../types"; -import type { ValueOf } from "../utility-types"; import type { RoughCanvas } from "roughjs/bin/canvas"; import type { Action, ActionResult } from "../actions/types"; diff --git a/packages/excalidraw/components/ColorPicker/keyboardNavHandlers.ts b/packages/excalidraw/components/ColorPicker/keyboardNavHandlers.ts index 287f850ca..3e27229bc 100644 --- a/packages/excalidraw/components/ColorPicker/keyboardNavHandlers.ts +++ b/packages/excalidraw/components/ColorPicker/keyboardNavHandlers.ts @@ -6,13 +6,14 @@ import type { ColorPaletteCustom, } from "@excalidraw/common"; +import type { ValueOf } from "@excalidraw/common/utility-types"; + import { colorPickerHotkeyBindings, getColorNameAndShadeFromColor, } from "./colorPickerUtils"; import type { ActiveColorPickerSectionAtomType } from "./colorPickerUtils"; -import type { ValueOf } from "../../utility-types"; const arrowHandler = ( eventKey: string, diff --git a/packages/excalidraw/components/CommandPalette/CommandPalette.tsx b/packages/excalidraw/components/CommandPalette/CommandPalette.tsx index 0d1442e29..4391759d9 100644 --- a/packages/excalidraw/components/CommandPalette/CommandPalette.tsx +++ b/packages/excalidraw/components/CommandPalette/CommandPalette.tsx @@ -11,6 +11,8 @@ import { isWritableElement, } from "@excalidraw/common"; +import type { MarkRequired } from "@excalidraw/common/utility-types"; + import { actionClearCanvas, actionLink, @@ -61,7 +63,6 @@ import "./CommandPalette.scss"; import type { CommandPaletteItem } from "./types"; import type { AppProps, AppState, UIAppState } from "../../types"; -import type { MarkRequired } from "../../utility-types"; import type { ShortcutName } from "../../actions/shortcuts"; import type { TranslationKeys } from "../../i18n"; import type { Action } from "../../actions/types"; diff --git a/packages/excalidraw/components/DefaultSidebar.tsx b/packages/excalidraw/components/DefaultSidebar.tsx index c0eff5e3e..4f1aa91e8 100644 --- a/packages/excalidraw/components/DefaultSidebar.tsx +++ b/packages/excalidraw/components/DefaultSidebar.tsx @@ -7,6 +7,8 @@ import { composeEventHandlers, } from "@excalidraw/common"; +import type { MarkOptional, Merge } from "@excalidraw/common/utility-types"; + import { useTunnels } from "../context/tunnels"; import { useUIAppState } from "../context/ui-appState"; @@ -19,7 +21,6 @@ import { Sidebar } from "./Sidebar/Sidebar"; import { withInternalFallback } from "./hoc/withInternalFallback"; import { LibraryIcon, searchIcon } from "./icons"; -import type { MarkOptional, Merge } from "../utility-types"; import type { SidebarProps, SidebarTriggerProps } from "./Sidebar/common"; const DefaultSidebarTrigger = withInternalFallback( diff --git a/packages/excalidraw/components/FontPicker/FontPickerList.tsx b/packages/excalidraw/components/FontPicker/FontPickerList.tsx index fe86da0e9..e24f4700c 100644 --- a/packages/excalidraw/components/FontPicker/FontPickerList.tsx +++ b/packages/excalidraw/components/FontPicker/FontPickerList.tsx @@ -11,6 +11,8 @@ import { type FontFamilyValues } from "@excalidraw/element/types"; import { arrayToList, debounce, getFontFamilyString } from "@excalidraw/common"; +import type { ValueOf } from "@excalidraw/common/utility-types"; + import { Fonts } from "../../fonts"; import { t } from "../../i18n"; import { useApp, useAppProps, useExcalidrawContainer } from "../App"; @@ -26,7 +28,6 @@ import { FontFamilyNormalIcon } from "../icons"; import { fontPickerKeyHandler } from "./keyboardNavHandlers"; -import type { ValueOf } from "../../utility-types"; import type { JSX } from "react"; export interface FontDescriptor { diff --git a/packages/excalidraw/components/UserList.tsx b/packages/excalidraw/components/UserList.tsx index d609e474c..811289329 100644 --- a/packages/excalidraw/components/UserList.tsx +++ b/packages/excalidraw/components/UserList.tsx @@ -4,6 +4,8 @@ import React, { useLayoutEffect } from "react"; import { supportsResizeObserver, isShallowEqual } from "@excalidraw/common"; +import type { MarkRequired } from "@excalidraw/common/utility-types"; + import { t } from "../i18n"; import { useExcalidrawActionManager } from "./App"; @@ -16,7 +18,6 @@ import "./UserList.scss"; import type { ActionManager } from "../actions/manager"; import type { Collaborator, SocketId } from "../types"; -import type { MarkRequired } from "../utility-types"; export type GoToCollaboratorComponentProps = { socketId: SocketId; diff --git a/packages/excalidraw/components/dropdownMenu/DropdownMenuItem.tsx b/packages/excalidraw/components/dropdownMenu/DropdownMenuItem.tsx index 7a3bde0bd..59c5dd2f8 100644 --- a/packages/excalidraw/components/dropdownMenu/DropdownMenuItem.tsx +++ b/packages/excalidraw/components/dropdownMenu/DropdownMenuItem.tsx @@ -2,6 +2,8 @@ import React, { useEffect, useRef } from "react"; import { THEME } from "@excalidraw/common"; +import type { ValueOf } from "@excalidraw/common/utility-types"; + import { useExcalidrawAppState } from "../App"; import MenuItemContent from "./DropdownMenuItemContent"; @@ -10,7 +12,6 @@ import { useHandleDropdownMenuItemClick, } from "./common"; -import type { ValueOf } from "../../utility-types"; import type { JSX } from "react"; const DropdownMenuItem = ({ diff --git a/packages/excalidraw/data/blob.ts b/packages/excalidraw/data/blob.ts index fdfdfd6a8..740e87837 100644 --- a/packages/excalidraw/data/blob.ts +++ b/packages/excalidraw/data/blob.ts @@ -11,6 +11,8 @@ import { clearElementsForExport } from "@excalidraw/element"; import type { ExcalidrawElement, FileId } from "@excalidraw/element/types"; +import type { ValueOf } from "@excalidraw/common/utility-types"; + import { cleanAppStateForExport } from "../appState"; import { CanvasError, ImageSceneDataError } from "../errors"; @@ -25,7 +27,6 @@ import { restore, restoreLibraryItems } from "./restore"; import type { FileSystemHandle } from "./filesystem"; import type { AppState, DataURL, LibraryItem } from "../types"; -import type { ValueOf } from "../utility-types"; import type { ImportedLibraryData } from "./types"; const parseFileContents = async (blob: Blob | File): Promise => { diff --git a/packages/excalidraw/data/library.ts b/packages/excalidraw/data/library.ts index fa5e8a8ce..d5db0b063 100644 --- a/packages/excalidraw/data/library.ts +++ b/packages/excalidraw/data/library.ts @@ -21,6 +21,8 @@ import { getCommonBoundingBox } from "@excalidraw/element/bounds"; import type { ExcalidrawElement } from "@excalidraw/element/types"; +import type { MaybePromise } from "@excalidraw/common/utility-types"; + import { atom, editorJotaiStore } from "../editor-jotai"; import { Emitter } from "../emitter"; @@ -41,7 +43,6 @@ import type { LibraryItemsSource, LibraryItems_anyVersion, } from "../types"; -import type { MaybePromise } from "../utility-types"; /** * format: hostname or hostname/pathname diff --git a/packages/excalidraw/data/reconcile.ts b/packages/excalidraw/data/reconcile.ts index fb27b2845..dd0501995 100644 --- a/packages/excalidraw/data/reconcile.ts +++ b/packages/excalidraw/data/reconcile.ts @@ -10,8 +10,9 @@ import { import type { OrderedExcalidrawElement } from "@excalidraw/element/types"; +import type { MakeBrand } from "@excalidraw/common/utility-types"; + import type { AppState } from "../types"; -import type { MakeBrand } from "../utility-types"; export type ReconciledExcalidrawElement = OrderedExcalidrawElement & MakeBrand<"ReconciledElement">; diff --git a/packages/excalidraw/data/restore.ts b/packages/excalidraw/data/restore.ts index 0fa02001a..5f383b463 100644 --- a/packages/excalidraw/data/restore.ts +++ b/packages/excalidraw/data/restore.ts @@ -61,6 +61,8 @@ import type { StrokeRoundness, } from "@excalidraw/element/types"; +import type { MarkOptional, Mutable } from "@excalidraw/common/utility-types"; + import { getDefaultAppState } from "../appState"; import { getLineHeight } from "../fonts/FontMetadata"; @@ -71,7 +73,6 @@ import { } from "../scene"; import type { AppState, BinaryFiles, LibraryItem } from "../types"; -import type { MarkOptional, Mutable } from "../utility-types"; import type { ImportedDataState, LegacyAppState } from "./types"; type RestoredAppState = Omit< diff --git a/packages/excalidraw/data/transform.ts b/packages/excalidraw/data/transform.ts index ee54732a6..267ce8a2f 100644 --- a/packages/excalidraw/data/transform.ts +++ b/packages/excalidraw/data/transform.ts @@ -59,9 +59,9 @@ import type { VerticalAlign, } from "@excalidraw/element/types"; -import { getLineHeight } from "../fonts/FontMetadata"; +import type { MarkOptional } from "@excalidraw/common/utility-types"; -import type { MarkOptional } from "../utility-types"; +import { getLineHeight } from "../fonts/FontMetadata"; export type ValidLinearElement = { type: "arrow" | "line"; diff --git a/packages/excalidraw/fonts/Fonts.ts b/packages/excalidraw/fonts/Fonts.ts index fcc4e7642..70eb13280 100644 --- a/packages/excalidraw/fonts/Fonts.ts +++ b/packages/excalidraw/fonts/Fonts.ts @@ -19,6 +19,8 @@ import type { ExcalidrawTextElement, } from "@excalidraw/element/types"; +import type { ValueOf } from "@excalidraw/common/utility-types"; + import { CascadiaFontFaces } from "./Cascadia"; import { ComicShannsFontFaces } from "./ComicShanns"; import { EmojiFontFaces } from "./Emoji"; @@ -33,7 +35,6 @@ import { VirgilFontFaces } from "./Virgil"; import { XiaolaiFontFaces } from "./Xiaolai"; import type Scene from "../scene/Scene"; -import type { ValueOf } from "../utility-types"; export class Fonts { // it's ok to track fonts across multiple instances only once, so let's use diff --git a/packages/excalidraw/i18n.ts b/packages/excalidraw/i18n.ts index 47bae5979..83a9e3ee9 100644 --- a/packages/excalidraw/i18n.ts +++ b/packages/excalidraw/i18n.ts @@ -1,9 +1,9 @@ +import type { NestedKeyOf } from "@excalidraw/common/utility-types"; + import { useAtomValue, editorJotaiStore, atom } from "./editor-jotai"; import fallbackLangData from "./locales/en.json"; import percentages from "./locales/percentages.json"; -import type { NestedKeyOf } from "./utility-types"; - const COMPLETION_THRESHOLD = 85; export interface Language { diff --git a/packages/excalidraw/package.json b/packages/excalidraw/package.json index 9570233c0..9bf1ee223 100644 --- a/packages/excalidraw/package.json +++ b/packages/excalidraw/package.json @@ -77,12 +77,10 @@ "lodash.debounce": "4.0.8", "nanoid": "3.3.3", "pako": "2.0.3", - "perfect-freehand": "1.2.0", "pica": "7.1.1", "png-chunk-text": "1.0.0", "png-chunks-encode": "1.0.0", "png-chunks-extract": "1.0.0", - "points-on-curve": "1.0.1", "pwacompat": "2.0.17", "roughjs": "4.6.4", "sass": "1.51.0", diff --git a/packages/excalidraw/queue.ts b/packages/excalidraw/queue.ts index 387bd2d70..85edb6e64 100644 --- a/packages/excalidraw/queue.ts +++ b/packages/excalidraw/queue.ts @@ -2,7 +2,7 @@ import { promiseTry, resolvablePromise } from "@excalidraw/common"; import type { ResolvablePromise } from "@excalidraw/common"; -import type { MaybePromise } from "./utility-types"; +import type { MaybePromise } from "@excalidraw/common/utility-types"; type Job = (...args: TArgs) => MaybePromise; diff --git a/packages/excalidraw/scene/Scene.ts b/packages/excalidraw/scene/Scene.ts index 5a325be08..dc35ecf7d 100644 --- a/packages/excalidraw/scene/Scene.ts +++ b/packages/excalidraw/scene/Scene.ts @@ -30,10 +30,11 @@ import type { Ordered, } from "@excalidraw/element/types"; +import type { Assert, SameType } from "@excalidraw/common/utility-types"; + import { getSelectedElements } from "./selection"; import type { AppState } from "../types"; -import type { Assert, SameType } from "../utility-types"; type ElementIdKey = InstanceType["elementId"]; type ElementKey = ExcalidrawElement | ElementIdKey; diff --git a/packages/excalidraw/scene/export.ts b/packages/excalidraw/scene/export.ts index 14da66a8e..9d08f23ec 100644 --- a/packages/excalidraw/scene/export.ts +++ b/packages/excalidraw/scene/export.ts @@ -40,6 +40,8 @@ import { import { syncInvalidIndices } from "@excalidraw/element/fractionalIndex"; +import { type Mutable } from "@excalidraw/common/utility-types"; + import type { Bounds } from "@excalidraw/element/bounds"; import type { @@ -58,7 +60,6 @@ import { Fonts } from "../fonts"; import { renderStaticScene } from "../renderer/staticScene"; import { renderSceneToSvg } from "../renderer/staticSvgScene"; -import { type Mutable } from "../utility-types"; import type { RenderableElementsMap } from "./types"; diff --git a/packages/excalidraw/scene/types.ts b/packages/excalidraw/scene/types.ts index 814540dfc..08b05a57d 100644 --- a/packages/excalidraw/scene/types.ts +++ b/packages/excalidraw/scene/types.ts @@ -6,6 +6,8 @@ import type { NonDeletedSceneElementsMap, } from "@excalidraw/element/types"; +import type { MakeBrand } from "@excalidraw/common/utility-types"; + import type { AppClassProperties, AppState, @@ -17,7 +19,6 @@ import type { Device, PendingExcalidrawElements, } from "../types"; -import type { MakeBrand } from "../utility-types"; import type { RoughCanvas } from "roughjs/bin/canvas"; import type { Drawable } from "roughjs/bin/core"; diff --git a/packages/excalidraw/store.ts b/packages/excalidraw/store.ts index d1f3f1d3e..48820eac5 100644 --- a/packages/excalidraw/store.ts +++ b/packages/excalidraw/store.ts @@ -4,13 +4,14 @@ import { deepCopyElement, newElementWith } from "@excalidraw/element"; import type { OrderedExcalidrawElement } from "@excalidraw/element/types"; +import type { ValueOf } from "@excalidraw/common/utility-types"; + import { getDefaultAppState } from "./appState"; import { AppStateChange, ElementsChange } from "./change"; import { Emitter } from "./emitter"; import type { AppState, ObservedAppState } from "./types"; -import type { ValueOf } from "./utility-types"; // hidden non-enumerable property for runtime checks const hiddenObservedAppStateProp = "__observedAppState"; diff --git a/packages/excalidraw/tests/helpers/api.ts b/packages/excalidraw/tests/helpers/api.ts index fc2c581ba..9118ce37b 100644 --- a/packages/excalidraw/tests/helpers/api.ts +++ b/packages/excalidraw/tests/helpers/api.ts @@ -22,6 +22,8 @@ import { isLinearElementType } from "@excalidraw/element/typeChecks"; import { getSelectedElements } from "@excalidraw/excalidraw/scene/selection"; import { assertNever } from "@excalidraw/common"; +import { selectGroupsForSelectedElements } from "@excalidraw/element/groups"; + import type { ExcalidrawElement, ExcalidrawGenericElement, @@ -38,7 +40,8 @@ import type { FixedSegment, } from "@excalidraw/element/types"; -import { selectGroupsForSelectedElements } from "../../groups"; +import type { Mutable } from "@excalidraw/common/utility-types"; + import { getMimeType } from "../../data/blob"; import { createTestHook } from "../../components/App"; import { getDefaultAppState } from "../../appState"; @@ -47,7 +50,7 @@ import { GlobalTestState, createEvent, fireEvent, act } from "../test-utils"; import type { Action } from "../../actions/types"; import type App from "../../components/App"; import type { AppState } from "../../types"; -import type { Mutable } from "../../utility-types"; + const readFile = util.promisify(fs.readFile); // so that window.h is available when App.tsx is not imported as well. diff --git a/packages/excalidraw/tests/test-utils.ts b/packages/excalidraw/tests/test-utils.ts index 40d03ff67..e2f3229ae 100644 --- a/packages/excalidraw/tests/test-utils.ts +++ b/packages/excalidraw/tests/test-utils.ts @@ -13,6 +13,8 @@ import { ORIG_ID, arrayToMap } from "@excalidraw/common"; import type { ExcalidrawElement } from "@excalidraw/element/types"; +import type { AllPossibleKeys } from "@excalidraw/common/utility-types"; + import { STORAGE_KEYS } from "../../../excalidraw-app/app_constants"; import { getSelectedElements } from "../scene/selection"; @@ -23,8 +25,6 @@ import type { RenderResult, RenderOptions } from "@testing-library/react"; import type { ImportedDataState } from "../data/types"; -import type { AllPossibleKeys } from "../utility-types"; - export { cleanup as unmountComponent }; const customQueries = { diff --git a/packages/excalidraw/types.ts b/packages/excalidraw/types.ts index 635829e32..31ce332f8 100644 --- a/packages/excalidraw/types.ts +++ b/packages/excalidraw/types.ts @@ -36,6 +36,13 @@ import type { ExcalidrawNonSelectionElement, } from "@excalidraw/element/types"; +import type { + Merge, + MaybePromise, + ValueOf, + MakeBrand, +} from "@excalidraw/common/utility-types"; + import type { Action } from "./actions/types"; import type { Spreadsheet } from "./charts"; import type { ClipboardData } from "./clipboard"; @@ -44,7 +51,6 @@ import type Library from "./data/library"; import type { FileSystemHandle } from "./data/filesystem"; import type { ContextMenuItems } from "./components/ContextMenu"; import type { SnapLine } from "./snapping"; -import type { Merge, MaybePromise, ValueOf, MakeBrand } from "./utility-types"; import type { CaptureUpdateActionType } from "./store"; import type { ImportedDataState } from "./data/types";