Move align, distribute, zindex to element package

This commit is contained in:
Marcel Mraz 2025-03-18 20:17:40 +01:00
parent a3fef45365
commit e7a0a7e0b7
No known key found for this signature in database
GPG key ID: 4EBD6E62DC830CD2
8 changed files with 46 additions and 36 deletions

View file

@ -7,7 +7,7 @@ import { getMaximumGroups } from "@excalidraw/element/groups";
import type { BoundingBox } from "@excalidraw/element/bounds";
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
import type Scene from "./scene/Scene";
import type Scene from "@excalidraw/excalidraw/scene/Scene";
export interface Alignment {
position: "start" | "center" | "end";

View file

@ -6,15 +6,16 @@ import { getElementsInGroup } from "@excalidraw/element/groups";
import { syncMovedIndices } from "@excalidraw/element/fractionalIndex";
import { getSelectedElements } from "@excalidraw/excalidraw/scene";
import type {
ExcalidrawElement,
ExcalidrawFrameLikeElement,
} from "@excalidraw/element/types";
import { getSelectedElements } from "./scene";
import Scene from "./scene/Scene";
import type { AppState } from "@excalidraw/excalidraw/types";
import type { AppState } from "./types";
import Scene from "../../excalidraw/scene/Scene";
const isOfTargetFrame = (element: ExcalidrawElement, frameId: string) => {
return element.frameId === frameId || element.id === frameId;

View file

@ -1,5 +1,3 @@
import React from "react";
import { KEYS } from "@excalidraw/common";
import {
@ -10,13 +8,17 @@ import {
actionAlignBottom,
actionAlignLeft,
actionAlignRight,
} from "../actions";
import { defaultLang, setLanguage } from "../i18n";
import { Excalidraw } from "../index";
} from "@excalidraw/excalidraw/actions";
import { defaultLang, setLanguage } from "@excalidraw/excalidraw/i18n";
import { Excalidraw } from "@excalidraw/excalidraw";
import { API } from "./helpers/api";
import { UI, Pointer, Keyboard } from "./helpers/ui";
import { act, unmountComponent, render } from "./test-utils";
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
import { UI, Pointer, Keyboard } from "@excalidraw/excalidraw/tests/helpers/ui";
import {
act,
unmountComponent,
render,
} from "@excalidraw/excalidraw/tests/test-utils";
const mouse = new Pointer("mouse");

View file

@ -1,29 +1,32 @@
import React from "react";
import { selectGroupsForSelectedElements } from "@excalidraw/element/groups";
import { reseed } from "@excalidraw/common";
import type {
ExcalidrawElement,
ExcalidrawFrameElement,
ExcalidrawSelectionElement,
} from "@excalidraw/element/types";
import {
actionSendBackward,
actionBringForward,
actionBringToFront,
actionSendToBack,
actionDuplicateSelection,
} from "../actions";
} from "@excalidraw/excalidraw/actions";
import { Excalidraw } from "../index";
import { Excalidraw } from "@excalidraw/excalidraw";
import { API } from "./helpers/api";
import { act, getCloneByOrigId, render, unmountComponent } from "./test-utils";
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
import {
act,
getCloneByOrigId,
render,
unmountComponent,
} from "@excalidraw/excalidraw/tests/test-utils";
import type { AppState } from "../types";
import type {
ExcalidrawElement,
ExcalidrawFrameElement,
ExcalidrawSelectionElement,
} from "@excalidraw/element/types";
import type { AppState } from "@excalidraw/excalidraw/types";
unmountComponent();

View file

@ -6,9 +6,12 @@ import { updateFrameMembershipOfSelectedElements } from "@excalidraw/element/fra
import { KEYS, arrayToMap, getShortcutKey } from "@excalidraw/common";
import { alignElements } from "@excalidraw/element/align";
import type { ExcalidrawElement } from "@excalidraw/element/types";
import { alignElements } from "../align";
import type { Alignment } from "@excalidraw/element/align";
import { ToolButton } from "../components/ToolButton";
import {
AlignBottomIcon,
@ -26,7 +29,6 @@ import { CaptureUpdateAction } from "../store";
import { register } from "./register";
import type { Alignment } from "../align";
import type { AppClassProperties, AppState, UIAppState } from "../types";
export const alignActionsPredicate = (

View file

@ -6,14 +6,17 @@ import { CODES, KEYS, arrayToMap, getShortcutKey } from "@excalidraw/common";
import { updateFrameMembershipOfSelectedElements } from "@excalidraw/element/frame";
import { distributeElements } from "@excalidraw/element/distribute";
import type { ExcalidrawElement } from "@excalidraw/element/types";
import type { Distribution } from "@excalidraw/element/distribute";
import { ToolButton } from "../components/ToolButton";
import {
DistributeHorizontallyIcon,
DistributeVerticallyIcon,
} from "../components/icons";
import { distributeElements } from "../distribute";
import { t } from "../i18n";
@ -22,8 +25,6 @@ import { CaptureUpdateAction } from "../store";
import { register } from "./register";
import type { Distribution } from "../distribute";
import type { AppClassProperties, AppState } from "../types";
const enableActionGroup = (appState: AppState, app: AppClassProperties) => {

View file

@ -1,5 +1,12 @@
import { KEYS, CODES, getShortcutKey, isDarwin } from "@excalidraw/common";
import {
moveOneLeft,
moveOneRight,
moveAllLeft,
moveAllRight,
} from "@excalidraw/element/zindex";
import {
BringForwardIcon,
BringToFrontIcon,
@ -8,12 +15,6 @@ import {
} from "../components/icons";
import { t } from "../i18n";
import { CaptureUpdateAction } from "../store";
import {
moveOneLeft,
moveOneRight,
moveAllLeft,
moveAllRight,
} from "../zindex";
import { register } from "./register";