refactor: separate elements logic into a standalone package (#9285)

This commit is contained in:
Marcel Mraz
2025-03-26 15:24:59 +01:00
committed by GitHub
parent a18f059188
commit 432a46ef9e
372 changed files with 3463 additions and 2463 deletions
+27 -17
View File
@@ -1,24 +1,41 @@
import clsx from "clsx";
import { useState } from "react";
import { actionToggleZenMode } from "../actions";
import {
CLASSES,
KEYS,
capitalizeString,
isTransparent,
} from "@excalidraw/common";
import { KEYS } from "../keys";
import { CLASSES } from "../constants";
import { alignActionsPredicate } from "../actions/actionAlign";
import { trackEvent } from "../analytics";
import { useTunnels } from "../context/tunnels";
import {
shouldAllowVerticalAlign,
suppportsHorizontalAlign,
} from "../element/textElement";
} from "@excalidraw/element/textElement";
import {
hasBoundTextElement,
isElbowArrow,
isImageElement,
isLinearElement,
isTextElement,
} from "../element/typeChecks";
} from "@excalidraw/element/typeChecks";
import { hasStrokeColor, toolIsArrow } from "@excalidraw/element/comparisons";
import type {
ExcalidrawElement,
ExcalidrawElementType,
NonDeletedElementsMap,
NonDeletedSceneElementsMap,
} from "@excalidraw/element/types";
import { actionToggleZenMode } from "../actions";
import { alignActionsPredicate } from "../actions/actionAlign";
import { trackEvent } from "../analytics";
import { useTunnels } from "../context/tunnels";
import { t } from "../i18n";
import {
canChangeRoundness,
@@ -28,9 +45,8 @@ import {
hasStrokeStyle,
hasStrokeWidth,
} from "../scene";
import { hasStrokeColor, toolIsArrow } from "../scene/comparisons";
import { SHAPES } from "../shapes";
import { capitalizeString, isTransparent } from "../utils";
import { SHAPES } from "./shapes";
import "./Actions.scss";
@@ -48,12 +64,6 @@ import {
MagicIcon,
} from "./icons";
import type {
ExcalidrawElement,
ExcalidrawElementType,
NonDeletedElementsMap,
NonDeletedSceneElementsMap,
} from "../element/types";
import type { AppClassProperties, AppProps, UIAppState, Zoom } from "../types";
import type { ActionManager } from "../actions/manager";