mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Fx imports and most tests
This commit is contained in:
parent
ddac2e969a
commit
40ff1b08ae
70 changed files with 335 additions and 305 deletions
|
@ -1,6 +1,6 @@
|
|||
import oc from "open-color";
|
||||
|
||||
import type { Merge } from "@excalidraw/common/utility-types";
|
||||
import type { Merge } from "./utility-types";
|
||||
|
||||
// FIXME can't put to utils.ts rn because of circular dependency
|
||||
const pick = <R extends Record<string, any>, K extends readonly (keyof R)[]>(
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { FONT_FAMILY, FONT_FAMILY_FALLBACKS } from "@excalidraw/common";
|
||||
|
||||
import type {
|
||||
ExcalidrawTextElement,
|
||||
FontFamilyValues,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { FONT_FAMILY, FONT_FAMILY_FALLBACKS } from ".";
|
||||
|
||||
/**
|
||||
* Encapsulates font metrics with additional font metadata.
|
||||
* */
|
||||
|
|
|
@ -2,6 +2,7 @@ export * from "./binary-heap";
|
|||
export * from "./colors";
|
||||
export * from "./constants";
|
||||
export * from "./font-metadata";
|
||||
export * from "./queue";
|
||||
export * from "./keys";
|
||||
export * from "./points";
|
||||
export * from "./promise-pool";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type { ValueOf } from "@excalidraw/common/utility-types";
|
||||
|
||||
import { isDarwin } from "./constants";
|
||||
|
||||
import type { ValueOf } from "./utility-types";
|
||||
|
||||
export const CODES = {
|
||||
EQUAL: "Equal",
|
||||
MINUS: "Minus",
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { promiseTry, resolvablePromise } from "@excalidraw/common";
|
||||
import { promiseTry, resolvablePromise } from ".";
|
||||
|
||||
import type { ResolvablePromise } from "@excalidraw/common";
|
||||
import type { ResolvablePromise } from ".";
|
||||
|
||||
import type { MaybePromise } from "@excalidraw/common/utility-types";
|
||||
import type { MaybePromise } from "./utility-types";
|
||||
|
||||
type Job<T, TArgs extends unknown[]> = (...args: TArgs) => MaybePromise<T>;
|
||||
|
||||
|
|
|
@ -14,11 +14,6 @@ import type {
|
|||
Zoom,
|
||||
} from "@excalidraw/excalidraw/types";
|
||||
|
||||
import type {
|
||||
MaybePromise,
|
||||
ResolutionType,
|
||||
} from "@excalidraw/common/utility-types";
|
||||
|
||||
import { COLOR_PALETTE } from "./colors";
|
||||
import {
|
||||
DEFAULT_VERSION,
|
||||
|
@ -28,6 +23,8 @@ import {
|
|||
WINDOWS_EMOJI_FALLBACK_FONT,
|
||||
} from "./constants";
|
||||
|
||||
import type { MaybePromise, ResolutionType } from "./utility-types";
|
||||
|
||||
import type { EVENT } from "./constants";
|
||||
|
||||
let mockDateTime: string | null = null;
|
||||
|
|
|
@ -2,18 +2,25 @@ import { simplify } from "points-on-curve";
|
|||
|
||||
import { pointFrom, pointDistance, type LocalPoint } from "@excalidraw/math";
|
||||
import { ROUGHNESS, isTransparent, assertNever } from "@excalidraw/common";
|
||||
import { getDiamondPoints, getArrowheadPoints } from "@excalidraw/element";
|
||||
import { headingForPointIsHorizontal } from "@excalidraw/element/heading";
|
||||
import { getCornerRadius, isPathALoop } from "@excalidraw/element/shapes";
|
||||
|
||||
import type { Mutable } from "@excalidraw/common/utility-types";
|
||||
|
||||
import type { EmbedsValidationStatus } from "@excalidraw/excalidraw/types";
|
||||
import type { ElementShapes } from "@excalidraw/excalidraw/scene/types";
|
||||
|
||||
import {
|
||||
isElbowArrow,
|
||||
isEmbeddableElement,
|
||||
isIframeElement,
|
||||
isIframeLikeElement,
|
||||
isLinearElement,
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
} from "./typeChecks";
|
||||
import { getCornerRadius, isPathALoop } from "./shapes";
|
||||
import { headingForPointIsHorizontal } from "./heading";
|
||||
|
||||
import type { Mutable } from "@excalidraw/common/utility-types";
|
||||
import { canChangeRoundness } from "./comparisons";
|
||||
import { generateFreeDrawShape } from "./renderElement";
|
||||
import { getArrowheadPoints, getDiamondPoints } from "./bounds";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
|
@ -21,13 +28,7 @@ import type {
|
|||
ExcalidrawSelectionElement,
|
||||
ExcalidrawLinearElement,
|
||||
Arrowhead,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import type { EmbedsValidationStatus } from "@excalidraw/excalidraw/types";
|
||||
import type { ElementShapes } from "@excalidraw/excalidraw/scene/types";
|
||||
|
||||
import { canChangeRoundness } from "./comparisons";
|
||||
import { generateFreeDrawShape } from "./renderElement";
|
||||
} from "./types";
|
||||
|
||||
import type { Drawable, Options } from "roughjs/bin/core";
|
||||
import type { RoughGenerator } from "roughjs/bin/generator";
|
||||
|
|
|
@ -2,11 +2,6 @@ import { RoughGenerator } from "roughjs/bin/generator";
|
|||
|
||||
import { COLOR_PALETTE } from "@excalidraw/common";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawSelectionElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import type {
|
||||
AppState,
|
||||
EmbedsValidationStatus,
|
||||
|
@ -20,6 +15,8 @@ import { _generateElementShape } from "./Shape";
|
|||
|
||||
import { elementWithCanvasCache } from "./renderElement";
|
||||
|
||||
import type { ExcalidrawElement, ExcalidrawSelectionElement } from "./types";
|
||||
|
||||
import type { Drawable } from "roughjs/bin/core";
|
||||
|
||||
export class ShapeCache {
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
import { updateBoundElements } from "@excalidraw/element/binding";
|
||||
import { getCommonBoundingBox } from "@excalidraw/element/bounds";
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
|
||||
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 "@excalidraw/excalidraw/scene/Scene";
|
||||
|
||||
import { updateBoundElements } from "./binding";
|
||||
import { getCommonBoundingBox } from "./bounds";
|
||||
import { mutateElement } from "./mutateElement";
|
||||
import { getMaximumGroups } from "./groups";
|
||||
|
||||
import type { BoundingBox } from "./bounds";
|
||||
import type { ElementsMap, ExcalidrawElement } from "./types";
|
||||
|
||||
export interface Alignment {
|
||||
position: "start" | "center" | "end";
|
||||
axis: "x" | "y";
|
||||
|
|
|
@ -24,12 +24,6 @@ import {
|
|||
PRECISION,
|
||||
} from "@excalidraw/math";
|
||||
|
||||
import {
|
||||
aabbForElement,
|
||||
getElementShape,
|
||||
pointInsideBounds,
|
||||
} from "@excalidraw/element";
|
||||
|
||||
import { isPointOnShape } from "@excalidraw/utils/collision";
|
||||
|
||||
import type { LocalPoint, Radians } from "@excalidraw/math";
|
||||
|
@ -70,6 +64,8 @@ import {
|
|||
isTextElement,
|
||||
} from "./typeChecks";
|
||||
|
||||
import { aabbForElement, getElementShape, pointInsideBounds } from "./shapes";
|
||||
|
||||
import type { Bounds } from "./bounds";
|
||||
import type { ElementUpdate } from "./mutateElement";
|
||||
import type {
|
||||
|
|
|
@ -12,8 +12,6 @@ import {
|
|||
} from "@excalidraw/math";
|
||||
|
||||
import { getCurvePathOps } from "@excalidraw/utils/geometry/shape";
|
||||
import { generateRoughOptions } from "@excalidraw/element/Shape";
|
||||
import { ShapeCache } from "@excalidraw/element/ShapeCache";
|
||||
|
||||
import type {
|
||||
Degrees,
|
||||
|
@ -27,6 +25,8 @@ import type { AppState } from "@excalidraw/excalidraw/types";
|
|||
|
||||
import type { Mutable } from "@excalidraw/common/utility-types";
|
||||
|
||||
import { ShapeCache } from "./ShapeCache";
|
||||
import { generateRoughOptions } from "./Shape";
|
||||
import { LinearElementEditor } from "./linearElementEditor";
|
||||
import { getBoundTextElement, getContainerElement } from "./textElement";
|
||||
import {
|
||||
|
|
|
@ -18,8 +18,6 @@ import {
|
|||
import { isPointInShape, isPointOnShape } from "@excalidraw/utils/collision";
|
||||
import { getPolygonShape } from "@excalidraw/utils/geometry/shape";
|
||||
|
||||
import { getBoundTextShape, isPathALoop } from "@excalidraw/element/shapes";
|
||||
|
||||
import type {
|
||||
GlobalPoint,
|
||||
LineSegment,
|
||||
|
@ -32,6 +30,7 @@ import type { GeometricShape } from "@excalidraw/utils/geometry/shape";
|
|||
|
||||
import type { FrameNameBounds } from "@excalidraw/excalidraw/types";
|
||||
|
||||
import { getBoundTextShape, isPathALoop } from "./shapes";
|
||||
import { getElementBounds } from "./bounds";
|
||||
import {
|
||||
hasBoundTextElement,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { getCommonBoundingBox } from "@excalidraw/element/bounds";
|
||||
import { newElementWith } from "@excalidraw/element/mutateElement";
|
||||
import { getCommonBoundingBox } from "./bounds";
|
||||
import { newElementWith } from "./mutateElement";
|
||||
|
||||
import { getMaximumGroups } from "@excalidraw/element/groups";
|
||||
import { getMaximumGroups } from "./groups";
|
||||
|
||||
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
||||
import type { ElementsMap, ExcalidrawElement } from "./types";
|
||||
|
||||
export interface Distribution {
|
||||
space: "between";
|
||||
|
|
|
@ -21,8 +21,6 @@ import {
|
|||
getSizeFromPoints,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { aabbForElement, pointInsideBounds } from "@excalidraw/element";
|
||||
|
||||
import type { AppState } from "@excalidraw/excalidraw/types";
|
||||
|
||||
import {
|
||||
|
@ -54,6 +52,8 @@ import {
|
|||
type SceneElementsMap,
|
||||
} from "./types";
|
||||
|
||||
import { aabbForElement, pointInsideBounds } from "./shapes";
|
||||
|
||||
import type { Bounds } from "./bounds";
|
||||
import type { Heading } from "./heading";
|
||||
import type {
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
import { ELEMENT_LINK_KEY, normalizeLink } from "@excalidraw/common";
|
||||
|
||||
import type { AppProps, AppState } from "@excalidraw/excalidraw/types";
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { elementsAreInSameGroup } from "./groups";
|
||||
|
||||
import type { ExcalidrawElement } from "./types";
|
||||
|
||||
export const defaultGetElementLinkFromSelection: Exclude<
|
||||
AppProps["generateLinkForSelection"],
|
||||
undefined
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
import {
|
||||
elementOverlapsWithFrame,
|
||||
elementsAreInFrameBounds,
|
||||
} from "@excalidraw/element";
|
||||
import { KEYS, invariant, toBrandedType } from "@excalidraw/common";
|
||||
import { aabbForElement } from "@excalidraw/element";
|
||||
|
||||
import { pointFrom, type LocalPoint } from "@excalidraw/math";
|
||||
|
||||
|
@ -26,6 +21,8 @@ import {
|
|||
import { LinearElementEditor } from "./linearElementEditor";
|
||||
import { mutateElement } from "./mutateElement";
|
||||
import { newArrowElement, newElement } from "./newElement";
|
||||
import { aabbForElement } from "./shapes";
|
||||
import { elementsAreInFrameBounds, elementOverlapsWithFrame } from "./frame";
|
||||
import {
|
||||
isBindableElement,
|
||||
isElbowArrow,
|
||||
|
|
|
@ -2,15 +2,15 @@ import { generateNKeysBetween } from "fractional-indexing";
|
|||
|
||||
import { arrayToMap } from "@excalidraw/common";
|
||||
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
import { getBoundTextElement } from "@excalidraw/element/textElement";
|
||||
import { hasBoundTextElement } from "@excalidraw/element/typeChecks";
|
||||
import { mutateElement } from "./mutateElement";
|
||||
import { getBoundTextElement } from "./textElement";
|
||||
import { hasBoundTextElement } from "./typeChecks";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
FractionalIndex,
|
||||
OrderedExcalidrawElement,
|
||||
} from "@excalidraw/element/types";
|
||||
} from "./types";
|
||||
|
||||
export class InvalidFractionalIndexError extends Error {
|
||||
public code = "ELEMENT_HAS_INVALID_INDEX" as const;
|
||||
|
|
|
@ -5,17 +5,6 @@ import {
|
|||
elementsOverlappingBBox,
|
||||
} from "@excalidraw/utils";
|
||||
|
||||
import { getElementAbsoluteCoords, isTextElement } from "@excalidraw/element";
|
||||
|
||||
import type {
|
||||
ElementsMap,
|
||||
ElementsMapOrArray,
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFrameLikeElement,
|
||||
NonDeleted,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import type { ExcalidrawElementsIncludingDeleted } from "@excalidraw/excalidraw/scene/Scene";
|
||||
|
||||
import type {
|
||||
|
@ -29,10 +18,27 @@ import type { ReadonlySetLike } from "@excalidraw/common/utility-types";
|
|||
import { getElementsWithinSelection, getSelectedElements } from "./selection";
|
||||
import { getElementsInGroup, selectGroupsFromGivenElements } from "./groups";
|
||||
|
||||
import { getElementLineSegments, getCommonBounds } from "./bounds";
|
||||
import {
|
||||
getElementLineSegments,
|
||||
getCommonBounds,
|
||||
getElementAbsoluteCoords,
|
||||
} from "./bounds";
|
||||
import { mutateElement } from "./mutateElement";
|
||||
import { getBoundTextElement, getContainerElement } from "./textElement";
|
||||
import { isFrameElement, isFrameLikeElement } from "./typeChecks";
|
||||
import {
|
||||
isFrameElement,
|
||||
isFrameLikeElement,
|
||||
isTextElement,
|
||||
} from "./typeChecks";
|
||||
|
||||
import type {
|
||||
ElementsMap,
|
||||
ElementsMapOrArray,
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFrameLikeElement,
|
||||
NonDeleted,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "./types";
|
||||
|
||||
// --------------------------- Frame State ------------------------------------
|
||||
export const bindElementsToFramesAfterDuplication = (
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
import { getBoundTextElement } from "@excalidraw/element/textElement";
|
||||
import type {
|
||||
AppClassProperties,
|
||||
AppState,
|
||||
InteractiveCanvasAppState,
|
||||
} from "@excalidraw/excalidraw/types";
|
||||
import type { Mutable } from "@excalidraw/common/utility-types";
|
||||
|
||||
import { getBoundTextElement } from "./textElement";
|
||||
|
||||
import { makeNextSelectedElementIds, getSelectedElements } from "./selection";
|
||||
|
||||
import type {
|
||||
GroupId,
|
||||
|
@ -7,16 +16,7 @@ import type {
|
|||
NonDeletedExcalidrawElement,
|
||||
ElementsMapOrArray,
|
||||
ElementsMap,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import type {
|
||||
AppClassProperties,
|
||||
AppState,
|
||||
InteractiveCanvasAppState,
|
||||
} from "@excalidraw/excalidraw/types";
|
||||
import type { Mutable } from "@excalidraw/common/utility-types";
|
||||
|
||||
import { makeNextSelectedElementIds, getSelectedElements } from "./selection";
|
||||
} from "./types";
|
||||
|
||||
export const selectGroup = (
|
||||
groupId: GroupId,
|
||||
|
|
|
@ -7,20 +7,6 @@ import type {
|
|||
NonDeleted,
|
||||
} from "./types";
|
||||
|
||||
export * from "./bounds";
|
||||
export * from "./dragElements";
|
||||
export * from "./frame";
|
||||
export * from "./mutateElement";
|
||||
export * from "./newElement";
|
||||
export * from "./resizeElements";
|
||||
export * from "./resizeTest";
|
||||
export * from "./shapes";
|
||||
export * from "./showSelectedShapeActions";
|
||||
export * from "./textElement";
|
||||
export * from "./typeChecks";
|
||||
export * from "./transformHandles";
|
||||
export * from "./sizeHelpers";
|
||||
|
||||
/**
|
||||
* @deprecated unsafe, use hashElementsVersion instead
|
||||
*/
|
||||
|
|
|
@ -20,14 +20,6 @@ import {
|
|||
tupleToCoors,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
getBezierCurveLength,
|
||||
getBezierXY,
|
||||
getControlPointsForBezierCurve,
|
||||
isPathALoop,
|
||||
mapIntervalToBezierT,
|
||||
} from "@excalidraw/element";
|
||||
|
||||
import type { Store } from "@excalidraw/excalidraw/store";
|
||||
|
||||
import type { Radians } from "@excalidraw/math";
|
||||
|
@ -50,7 +42,11 @@ import {
|
|||
getHoveredElementForBinding,
|
||||
isBindingEnabled,
|
||||
} from "./binding";
|
||||
import { getElementPointsCoords, getMinMaxXYFromCurvePathOps } from "./bounds";
|
||||
import {
|
||||
getElementAbsoluteCoords,
|
||||
getElementPointsCoords,
|
||||
getMinMaxXYFromCurvePathOps,
|
||||
} from "./bounds";
|
||||
import { headingIsHorizontal, vectorToHeading } from "./heading";
|
||||
import { mutateElement } from "./mutateElement";
|
||||
import { getBoundTextElement, handleBindTextResize } from "./textElement";
|
||||
|
@ -62,7 +58,15 @@ import {
|
|||
|
||||
import { ShapeCache } from "./ShapeCache";
|
||||
|
||||
import { getElementAbsoluteCoords, getLockedLinearCursorAlignSize } from "./";
|
||||
import {
|
||||
isPathALoop,
|
||||
getBezierCurveLength,
|
||||
getControlPointsForBezierCurve,
|
||||
mapIntervalToBezierT,
|
||||
getBezierXY,
|
||||
} from "./shapes";
|
||||
|
||||
import { getLockedLinearCursorAlignSize } from "./sizeHelpers";
|
||||
|
||||
import type { Bounds } from "./bounds";
|
||||
import type {
|
||||
|
|
|
@ -25,15 +25,16 @@ import type {
|
|||
Mutable,
|
||||
} from "@excalidraw/common/utility-types";
|
||||
|
||||
import { getResizedElementAbsoluteCoords } from "./bounds";
|
||||
import {
|
||||
getElementAbsoluteCoords,
|
||||
getResizedElementAbsoluteCoords,
|
||||
} from "./bounds";
|
||||
import { bumpVersion, newElementWith } from "./mutateElement";
|
||||
import { getBoundTextMaxWidth } from "./textElement";
|
||||
import { normalizeText, measureText } from "./textMeasurements";
|
||||
import { wrapText } from "./textWrapping";
|
||||
import { getNewGroupIdsForDuplication } from "./groups";
|
||||
|
||||
import { getElementAbsoluteCoords } from ".";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawImageElement,
|
||||
|
|
|
@ -15,41 +15,6 @@ import {
|
|||
isRTL,
|
||||
getVerticalOffset,
|
||||
} from "@excalidraw/common";
|
||||
import { getElementAbsoluteCoords } from "@excalidraw/element/bounds";
|
||||
import { getUncroppedImageElement } from "@excalidraw/element/cropElement";
|
||||
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
import {
|
||||
getBoundTextElement,
|
||||
getContainerCoords,
|
||||
getContainerElement,
|
||||
getBoundTextMaxHeight,
|
||||
getBoundTextMaxWidth,
|
||||
} from "@excalidraw/element/textElement";
|
||||
import { getLineHeightInPx } from "@excalidraw/element/textMeasurements";
|
||||
import {
|
||||
isTextElement,
|
||||
isLinearElement,
|
||||
isFreeDrawElement,
|
||||
isInitializedImageElement,
|
||||
isArrowElement,
|
||||
hasBoundTextElement,
|
||||
isMagicFrameElement,
|
||||
isImageElement,
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
import { getContainingFrame } from "@excalidraw/element/frame";
|
||||
import { getCornerRadius } from "@excalidraw/element/shapes";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawTextElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
ExcalidrawFreeDrawElement,
|
||||
ExcalidrawImageElement,
|
||||
ExcalidrawTextElementWithContainer,
|
||||
ExcalidrawFrameLikeElement,
|
||||
NonDeletedSceneElementsMap,
|
||||
ElementsMap,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import type {
|
||||
AppState,
|
||||
|
@ -67,8 +32,44 @@ import type {
|
|||
InteractiveCanvasRenderConfig,
|
||||
} from "@excalidraw/excalidraw/scene/types";
|
||||
|
||||
import { getElementAbsoluteCoords } from "./bounds";
|
||||
import { getUncroppedImageElement } from "./cropElement";
|
||||
import { LinearElementEditor } from "./linearElementEditor";
|
||||
import {
|
||||
getBoundTextElement,
|
||||
getContainerCoords,
|
||||
getContainerElement,
|
||||
getBoundTextMaxHeight,
|
||||
getBoundTextMaxWidth,
|
||||
} from "./textElement";
|
||||
import { getLineHeightInPx } from "./textMeasurements";
|
||||
import {
|
||||
isTextElement,
|
||||
isLinearElement,
|
||||
isFreeDrawElement,
|
||||
isInitializedImageElement,
|
||||
isArrowElement,
|
||||
hasBoundTextElement,
|
||||
isMagicFrameElement,
|
||||
isImageElement,
|
||||
} from "./typeChecks";
|
||||
import { getContainingFrame } from "./frame";
|
||||
import { getCornerRadius } from "./shapes";
|
||||
|
||||
import { ShapeCache } from "./ShapeCache";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawTextElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
ExcalidrawFreeDrawElement,
|
||||
ExcalidrawImageElement,
|
||||
ExcalidrawTextElementWithContainer,
|
||||
ExcalidrawFrameLikeElement,
|
||||
NonDeletedSceneElementsMap,
|
||||
ElementsMap,
|
||||
} from "./types";
|
||||
|
||||
import type { StrokeOptions } from "perfect-freehand";
|
||||
import type { RoughCanvas } from "roughjs/bin/canvas";
|
||||
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
import { isShallowEqual } from "@excalidraw/common";
|
||||
|
||||
import type {
|
||||
ElementsMap,
|
||||
ElementsMapOrArray,
|
||||
ExcalidrawElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import type {
|
||||
AppState,
|
||||
InteractiveCanvasAppState,
|
||||
|
@ -21,6 +14,13 @@ import {
|
|||
getFrameChildren,
|
||||
} from "./frame";
|
||||
|
||||
import type {
|
||||
ElementsMap,
|
||||
ElementsMapOrArray,
|
||||
ExcalidrawElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "./types";
|
||||
|
||||
/**
|
||||
* Frames and their containing elements are not to be selected at the same time.
|
||||
* Given an array of selected elements, if there are frames and their containing elements
|
||||
|
|
|
@ -32,9 +32,8 @@ import { LinearElementEditor } from "./linearElementEditor";
|
|||
import { getBoundTextElement } from "./textElement";
|
||||
import { ShapeCache } from "./ShapeCache";
|
||||
|
||||
import { getElementAbsoluteCoords } from "./";
|
||||
import { getElementAbsoluteCoords, type Bounds } from "./bounds";
|
||||
|
||||
import type { Bounds } from "./bounds";
|
||||
import type {
|
||||
ElementsMap,
|
||||
ExcalidrawElement,
|
||||
|
|
|
@ -21,9 +21,11 @@ import { LinearElementEditor } from "./linearElementEditor";
|
|||
import { mutateElement } from "./mutateElement";
|
||||
import { measureText } from "./textMeasurements";
|
||||
import { wrapText } from "./textWrapping";
|
||||
import { isBoundToContainer, isArrowElement } from "./typeChecks";
|
||||
|
||||
import { isTextElement } from "./";
|
||||
import {
|
||||
isBoundToContainer,
|
||||
isArrowElement,
|
||||
isTextElement,
|
||||
} from "./typeChecks";
|
||||
|
||||
import type { MaybeTransformHandleType } from "./transformHandles";
|
||||
import type {
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
import { isFrameLikeElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { arrayToMap, findIndex, findLastIndex } from "@excalidraw/common";
|
||||
|
||||
import { getElementsInGroup } from "@excalidraw/element/groups";
|
||||
|
||||
import { syncMovedIndices } from "@excalidraw/element/fractionalIndex";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFrameLikeElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import type { AppState } from "@excalidraw/excalidraw/types";
|
||||
|
||||
import type Scene from "@excalidraw/excalidraw/scene/Scene";
|
||||
|
||||
import { isFrameLikeElement } from "./typeChecks";
|
||||
|
||||
import { getElementsInGroup } from "./groups";
|
||||
|
||||
import { syncMovedIndices } from "./fractionalIndex";
|
||||
|
||||
import { getSelectedElements } from "./selection";
|
||||
|
||||
import type { ExcalidrawElement, ExcalidrawFrameLikeElement } from "./types";
|
||||
|
||||
const isOfTargetFrame = (element: ExcalidrawElement, frameId: string) => {
|
||||
return element.frameId === frameId || element.id === frameId;
|
||||
};
|
||||
|
|
|
@ -3,13 +3,15 @@ import { KEYS, arrayToMap } from "@excalidraw/common";
|
|||
import { pointFrom } from "@excalidraw/math";
|
||||
|
||||
import { actionWrapTextInContainer } from "@excalidraw/excalidraw/actions/actionBoundText";
|
||||
import { getTransformHandles } from "@excalidraw/element/transformHandles";
|
||||
|
||||
import { Excalidraw, isLinearElement } from "@excalidraw/excalidraw";
|
||||
|
||||
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
|
||||
import { UI, Pointer, Keyboard } from "@excalidraw/excalidraw/tests/helpers/ui";
|
||||
import { fireEvent, render } from "@excalidraw/excalidraw/tests/test-utils";
|
||||
|
||||
import { getTransformHandles } from "../src/transformHandles";
|
||||
|
||||
const { h } = window;
|
||||
|
||||
const mouse = new Pointer("mouse");
|
||||
|
|
|
@ -17,17 +17,17 @@ import {
|
|||
render,
|
||||
} from "@excalidraw/excalidraw/tests/test-utils";
|
||||
|
||||
import { bindLinearElement } from "@excalidraw/element/binding";
|
||||
|
||||
import type { LocalPoint } from "@excalidraw/math";
|
||||
|
||||
import { bindLinearElement } from "../src/binding";
|
||||
|
||||
import "../../utils/test-utils";
|
||||
|
||||
import type {
|
||||
ExcalidrawArrowElement,
|
||||
ExcalidrawBindableElement,
|
||||
ExcalidrawElbowArrowElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import "../../utils/test-utils";
|
||||
} from "../src/types";
|
||||
|
||||
const { h } = window;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
render,
|
||||
} from "@excalidraw/excalidraw/tests/test-utils";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
import type { ExcalidrawElement } from "../src/types";
|
||||
|
||||
const { h } = window;
|
||||
const mouse = new Pointer("mouse");
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
import { pointFrom } from "@excalidraw/math";
|
||||
import React from "react";
|
||||
|
||||
import { getElementPointsCoords } from "@excalidraw/element/bounds";
|
||||
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
import { resizeSingleElement } from "@excalidraw/element/resizeElements";
|
||||
import { isLinearElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { Excalidraw } from "@excalidraw/excalidraw";
|
||||
import {
|
||||
|
@ -23,12 +17,17 @@ import {
|
|||
|
||||
import type { LocalPoint } from "@excalidraw/math";
|
||||
|
||||
import type { Bounds } from "@excalidraw/element/bounds";
|
||||
import { isLinearElement } from "../src/typeChecks";
|
||||
import { resizeSingleElement } from "../src/resizeElements";
|
||||
import { LinearElementEditor } from "../src/linearElementEditor";
|
||||
import { getElementPointsCoords } from "../src/bounds";
|
||||
|
||||
import type { Bounds } from "../src/bounds";
|
||||
import type {
|
||||
ExcalidrawElbowArrowElement,
|
||||
ExcalidrawFreeDrawElement,
|
||||
ExcalidrawLinearElement,
|
||||
} from "@excalidraw/element/types";
|
||||
} from "../src/types";
|
||||
|
||||
unmountComponent();
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { getLineHeight } from "@excalidraw/common/font-metadata";
|
||||
import { getLineHeight } from "@excalidraw/common";
|
||||
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
|
||||
|
||||
import { FONT_FAMILY } from "@excalidraw/common";
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import { selectGroupsForSelectedElements } from "@excalidraw/element/groups";
|
||||
|
||||
import { reseed } from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
|
@ -20,13 +18,15 @@ import {
|
|||
unmountComponent,
|
||||
} from "@excalidraw/excalidraw/tests/test-utils";
|
||||
|
||||
import type { AppState } from "@excalidraw/excalidraw/types";
|
||||
|
||||
import { selectGroupsForSelectedElements } from "../src/groups";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFrameElement,
|
||||
ExcalidrawSelectionElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import type { AppState } from "@excalidraw/excalidraw/types";
|
||||
} from "../src/types";
|
||||
|
||||
unmountComponent();
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import {
|
|||
arrayToMap,
|
||||
getFontString,
|
||||
} from "@excalidraw/common";
|
||||
import { isTextElement, newElement } from "@excalidraw/element";
|
||||
import {
|
||||
getOriginalContainerHeightFromCache,
|
||||
resetOriginalContainerCache,
|
||||
|
@ -23,6 +22,7 @@ import {
|
|||
import {
|
||||
hasBoundTextElement,
|
||||
isTextBindableContainer,
|
||||
isTextElement,
|
||||
isUsingAdaptiveRadius,
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
|
@ -31,6 +31,8 @@ import { measureText } from "@excalidraw/element/textMeasurements";
|
|||
|
||||
import { syncMovedIndices } from "@excalidraw/element/fractionalIndex";
|
||||
|
||||
import { newElement } from "@excalidraw/element/newElement";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawLinearElement,
|
||||
|
|
|
@ -13,11 +13,9 @@ import {
|
|||
KEYS,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { getCommonBounds, getNonDeletedElements } from "@excalidraw/element";
|
||||
|
||||
import { getNonDeletedElements } from "@excalidraw/element";
|
||||
import { newElementWith } from "@excalidraw/element/mutateElement";
|
||||
|
||||
import type { SceneBounds } from "@excalidraw/element/bounds";
|
||||
import { getCommonBounds, type SceneBounds } from "@excalidraw/element/bounds";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
invariant,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { duplicateElement, getNonDeletedElements } from "@excalidraw/element";
|
||||
import { getNonDeletedElements } from "@excalidraw/element";
|
||||
|
||||
import { fixBindingsAfterDuplication } from "@excalidraw/element/binding";
|
||||
|
||||
|
@ -44,6 +44,8 @@ import {
|
|||
getSelectedElements,
|
||||
} from "@excalidraw/element/selection";
|
||||
|
||||
import { duplicateElement } from "@excalidraw/element/newElement";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { pointFrom } from "@excalidraw/math";
|
||||
|
||||
import { isInvisiblySmallElement } from "@excalidraw/element";
|
||||
import {
|
||||
maybeBindLinearElement,
|
||||
bindOrUnbindLinearElement,
|
||||
|
@ -15,6 +14,8 @@ import {
|
|||
import { KEYS, arrayToMap, updateActiveTool } from "@excalidraw/common";
|
||||
import { isPathALoop } from "@excalidraw/element/shapes";
|
||||
|
||||
import { isInvisiblySmallElement } from "@excalidraw/element/sizeHelpers";
|
||||
|
||||
import { t } from "../i18n";
|
||||
import { resetCursor } from "../cursor";
|
||||
import { done } from "../components/icons";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { getCommonBounds, getNonDeletedElements } from "@excalidraw/element";
|
||||
import { getNonDeletedElements } from "@excalidraw/element";
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
import { newFrameElement } from "@excalidraw/element/newElement";
|
||||
import { isFrameLikeElement } from "@excalidraw/element/typeChecks";
|
||||
|
@ -12,6 +12,8 @@ import { KEYS, updateActiveTool } from "@excalidraw/common";
|
|||
|
||||
import { getElementsInGroup } from "@excalidraw/element/groups";
|
||||
|
||||
import { getCommonBounds } from "@excalidraw/element/bounds";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { setCursorForShape } from "../cursor";
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import { KEYS } from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
showSelectedShapeActions,
|
||||
getNonDeletedElements,
|
||||
} from "@excalidraw/element";
|
||||
import { getNonDeletedElements } from "@excalidraw/element";
|
||||
|
||||
import { showSelectedShapeActions } from "@excalidraw/element/showSelectedShapeActions";
|
||||
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
import { HamburgerMenuIcon, HelpIconThin, palette } from "../components/icons";
|
||||
|
|
|
@ -22,11 +22,7 @@ import {
|
|||
getLineHeight,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
getNonDeletedElements,
|
||||
isTextElement,
|
||||
redrawTextBoundingBox,
|
||||
} from "@excalidraw/element";
|
||||
import { getNonDeletedElements } from "@excalidraw/element";
|
||||
|
||||
import {
|
||||
bindLinearElement,
|
||||
|
@ -43,13 +39,17 @@ import {
|
|||
newElementWith,
|
||||
} from "@excalidraw/element/mutateElement";
|
||||
|
||||
import { getBoundTextElement } from "@excalidraw/element/textElement";
|
||||
import {
|
||||
getBoundTextElement,
|
||||
redrawTextBoundingBox,
|
||||
} from "@excalidraw/element/textElement";
|
||||
|
||||
import {
|
||||
isArrowElement,
|
||||
isBoundToContainer,
|
||||
isElbowArrow,
|
||||
isLinearElement,
|
||||
isTextElement,
|
||||
isUsingAdaptiveRadius,
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { getNonDeletedElements, isTextElement } from "@excalidraw/element";
|
||||
import { getNonDeletedElements } from "@excalidraw/element";
|
||||
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
import { isLinearElement } from "@excalidraw/element/typeChecks";
|
||||
import { isLinearElement, isTextElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { KEYS } from "@excalidraw/common";
|
||||
|
||||
|
|
|
@ -7,12 +7,6 @@ import {
|
|||
getLineHeight,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
isTextElement,
|
||||
isExcalidrawElement,
|
||||
redrawTextBoundingBox,
|
||||
} from "@excalidraw/element";
|
||||
|
||||
import { newElementWith } from "@excalidraw/element/mutateElement";
|
||||
|
||||
import {
|
||||
|
@ -21,9 +15,14 @@ import {
|
|||
getDefaultRoundnessTypeForElement,
|
||||
isFrameLikeElement,
|
||||
isArrowElement,
|
||||
isExcalidrawElement,
|
||||
isTextElement,
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { getBoundTextElement } from "@excalidraw/element/textElement";
|
||||
import {
|
||||
getBoundTextElement,
|
||||
redrawTextBoundingBox,
|
||||
} from "@excalidraw/element/textElement";
|
||||
|
||||
import type { ExcalidrawTextElement } from "@excalidraw/element/types";
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { getFontString } from "@excalidraw/common";
|
||||
|
||||
import { isTextElement } from "@excalidraw/element";
|
||||
import { newElementWith } from "@excalidraw/element/mutateElement";
|
||||
import { measureText } from "@excalidraw/element/textMeasurements";
|
||||
|
||||
import { isTextElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { getSelectedElements } from "../scene";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
||||
|
|
|
@ -9,11 +9,12 @@ import {
|
|||
VERTICAL_ALIGN,
|
||||
randomId,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
newElement,
|
||||
newLinearElement,
|
||||
newTextElement,
|
||||
} from "@excalidraw/element";
|
||||
newLinearElement,
|
||||
newElement,
|
||||
} from "@excalidraw/element/newElement";
|
||||
|
||||
import type { Radians } from "@excalidraw/math";
|
||||
|
||||
|
|
|
@ -77,30 +77,9 @@ import {
|
|||
} from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
dragNewElement,
|
||||
dragSelectedElements,
|
||||
duplicateElement,
|
||||
getCommonBounds,
|
||||
getCursorForResizingElement,
|
||||
getDragOffsetXY,
|
||||
getElementWithTransformHandleType,
|
||||
getNormalizedDimensions,
|
||||
getResizeArrowDirection,
|
||||
getResizeOffsetXY,
|
||||
getLockedLinearCursorAlignSize,
|
||||
getTransformHandleTypeFromCoords,
|
||||
isInvisiblySmallElement,
|
||||
isNonDeletedElement,
|
||||
isTextElement,
|
||||
newElement,
|
||||
newLinearElement,
|
||||
newTextElement,
|
||||
newImageElement,
|
||||
transformElements,
|
||||
refreshTextDimensions,
|
||||
redrawTextBoundingBox,
|
||||
getElementAbsoluteCoords,
|
||||
} from "@excalidraw/element";
|
||||
} from "@excalidraw/element/bounds";
|
||||
|
||||
import {
|
||||
bindOrUnbindLinearElement,
|
||||
|
@ -132,6 +111,12 @@ import {
|
|||
newMagicFrameElement,
|
||||
newIframeElement,
|
||||
newArrowElement,
|
||||
duplicateElement,
|
||||
newElement,
|
||||
newImageElement,
|
||||
newLinearElement,
|
||||
newTextElement,
|
||||
refreshTextDimensions,
|
||||
} from "@excalidraw/element/newElement";
|
||||
|
||||
import {
|
||||
|
@ -154,11 +139,15 @@ import {
|
|||
isElbowArrow,
|
||||
isFlowchartNodeElement,
|
||||
isBindableElement,
|
||||
isTextElement,
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import {
|
||||
getLockedLinearCursorAlignSize,
|
||||
getNormalizedDimensions,
|
||||
isElementCompletelyInViewport,
|
||||
isElementInViewport,
|
||||
isInvisiblySmallElement,
|
||||
} from "@excalidraw/element/sizeHelpers";
|
||||
|
||||
import {
|
||||
|
@ -216,6 +205,7 @@ import {
|
|||
getContainerCenter,
|
||||
getContainerElement,
|
||||
isValidTextContainer,
|
||||
redrawTextBoundingBox,
|
||||
} from "@excalidraw/element/textElement";
|
||||
|
||||
import { shouldShowBoundingBox } from "@excalidraw/element/transformHandles";
|
||||
|
@ -295,6 +285,26 @@ import {
|
|||
makeNextSelectedElementIds,
|
||||
} from "@excalidraw/element/selection";
|
||||
|
||||
import {
|
||||
getResizeOffsetXY,
|
||||
getResizeArrowDirection,
|
||||
transformElements,
|
||||
} from "@excalidraw/element/resizeElements";
|
||||
|
||||
import {
|
||||
getCursorForResizingElement,
|
||||
getElementWithTransformHandleType,
|
||||
getTransformHandleTypeFromCoords,
|
||||
} from "@excalidraw/element/resizeTest";
|
||||
|
||||
import {
|
||||
dragNewElement,
|
||||
dragSelectedElements,
|
||||
getDragOffsetXY,
|
||||
} from "@excalidraw/element/dragElements";
|
||||
|
||||
import { isNonDeletedElement } from "@excalidraw/element";
|
||||
|
||||
import type { LocalPoint, Radians } from "@excalidraw/math";
|
||||
|
||||
import type {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { sceneCoordsToViewportCoords } from "@excalidraw/common";
|
||||
import { getElementAbsoluteCoords } from "@excalidraw/element";
|
||||
import { getElementAbsoluteCoords } from "@excalidraw/element/bounds";
|
||||
|
||||
import type {
|
||||
ElementsMap,
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
|
||||
import { showSelectedShapeActions } from "@excalidraw/element";
|
||||
import { showSelectedShapeActions } from "@excalidraw/element/showSelectedShapeActions";
|
||||
|
||||
import { ShapeCache } from "@excalidraw/element/ShapeCache";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React from "react";
|
||||
|
||||
import { showSelectedShapeActions } from "@excalidraw/element";
|
||||
import { showSelectedShapeActions } from "@excalidraw/element/showSelectedShapeActions";
|
||||
|
||||
import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@ import { Fragment, memo, useEffect, useRef, useState } from "react";
|
|||
|
||||
import { CLASSES, EVENT } from "@excalidraw/common";
|
||||
|
||||
import { isTextElement, newTextElement } from "@excalidraw/element";
|
||||
|
||||
import { isElementCompletelyInViewport } from "@excalidraw/element/sizeHelpers";
|
||||
|
||||
import { measureText } from "@excalidraw/element/textMeasurements";
|
||||
|
@ -18,6 +16,9 @@ import {
|
|||
getFontString,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { newTextElement } from "@excalidraw/element/newElement";
|
||||
import { isTextElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import type { ExcalidrawTextElement } from "@excalidraw/element/types";
|
||||
|
||||
import { atom, useAtom } from "../editor-jotai";
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
import { isTextElement, redrawTextBoundingBox } from "@excalidraw/element";
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
import { getBoundTextElement } from "@excalidraw/element/textElement";
|
||||
import { hasBoundTextElement } from "@excalidraw/element/typeChecks";
|
||||
import {
|
||||
getBoundTextElement,
|
||||
redrawTextBoundingBox,
|
||||
} from "@excalidraw/element/textElement";
|
||||
import {
|
||||
hasBoundTextElement,
|
||||
isTextElement,
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
|
|
|
@ -2,7 +2,6 @@ import { pointFrom, type GlobalPoint } from "@excalidraw/math";
|
|||
import { useMemo } from "react";
|
||||
|
||||
import { MIN_WIDTH_OR_HEIGHT } from "@excalidraw/common";
|
||||
import { getCommonBounds, isTextElement } from "@excalidraw/element";
|
||||
import { updateBoundElements } from "@excalidraw/element/binding";
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
import {
|
||||
|
@ -14,6 +13,10 @@ import {
|
|||
handleBindTextResize,
|
||||
} from "@excalidraw/element/textElement";
|
||||
|
||||
import { isTextElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { getCommonBounds } from "@excalidraw/utils";
|
||||
|
||||
import type {
|
||||
ElementsMap,
|
||||
ExcalidrawElement,
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
import { isTextElement, redrawTextBoundingBox } from "@excalidraw/element";
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
import { getBoundTextElement } from "@excalidraw/element/textElement";
|
||||
import { hasBoundTextElement } from "@excalidraw/element/typeChecks";
|
||||
import {
|
||||
getBoundTextElement,
|
||||
redrawTextBoundingBox,
|
||||
} from "@excalidraw/element/textElement";
|
||||
import {
|
||||
hasBoundTextElement,
|
||||
isTextElement,
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { isInGroup } from "@excalidraw/element/groups";
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import { pointFrom, pointRotateRads } from "@excalidraw/math";
|
||||
import { useMemo } from "react";
|
||||
|
||||
import { getCommonBounds, isTextElement } from "@excalidraw/element";
|
||||
import { isTextElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { getCommonBounds } from "@excalidraw/element/bounds";
|
||||
|
||||
import type {
|
||||
ElementsMap,
|
||||
|
|
|
@ -3,12 +3,12 @@ import { act, fireEvent, queryByTestId } from "@testing-library/react";
|
|||
import React from "react";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import { getCommonBounds, isTextElement } from "@excalidraw/element";
|
||||
|
||||
import { setDateTimeForTests, reseed } from "@excalidraw/common";
|
||||
|
||||
import { isInGroup } from "@excalidraw/element/groups";
|
||||
|
||||
import { isTextElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import type { Degrees } from "@excalidraw/math";
|
||||
|
||||
import type {
|
||||
|
@ -17,7 +17,7 @@ import type {
|
|||
ExcalidrawTextElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { Excalidraw, mutateElement } from "../..";
|
||||
import { Excalidraw, getCommonBounds, mutateElement } from "../..";
|
||||
import { actionGroup } from "../../actions";
|
||||
import { t } from "../../i18n";
|
||||
import * as StaticScene from "../../renderer/staticScene";
|
||||
|
|
|
@ -13,14 +13,13 @@ import {
|
|||
promiseTry,
|
||||
resolvablePromise,
|
||||
toValidURL,
|
||||
Queue,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { hashElementsVersion, hashString } from "@excalidraw/element";
|
||||
|
||||
import { getCommonBoundingBox } from "@excalidraw/element/bounds";
|
||||
|
||||
import { Queue } from "@excalidraw/common/queue";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import type { MaybePromise } from "@excalidraw/common/utility-types";
|
||||
|
|
|
@ -18,12 +18,7 @@ import {
|
|||
normalizeLink,
|
||||
getLineHeight,
|
||||
} from "@excalidraw/common";
|
||||
import {
|
||||
getNonDeletedElements,
|
||||
getNormalizedDimensions,
|
||||
isInvisiblySmallElement,
|
||||
refreshTextDimensions,
|
||||
} from "@excalidraw/element";
|
||||
import { getNonDeletedElements } from "@excalidraw/element";
|
||||
import { normalizeFixedPoint } from "@excalidraw/element/binding";
|
||||
import {
|
||||
updateElbowArrowPoints,
|
||||
|
@ -44,6 +39,10 @@ import {
|
|||
|
||||
import { syncInvalidIndices } from "@excalidraw/element/fractionalIndex";
|
||||
|
||||
import { refreshTextDimensions } from "@excalidraw/element/newElement";
|
||||
|
||||
import { getNormalizedDimensions } from "@excalidraw/element/sizeHelpers";
|
||||
|
||||
import type { LocalPoint, Radians } from "@excalidraw/math";
|
||||
|
||||
import type {
|
||||
|
@ -72,6 +71,8 @@ import {
|
|||
getNormalizedZoom,
|
||||
} from "../scene";
|
||||
|
||||
import { isInvisiblySmallElement } from "..";
|
||||
|
||||
import type { AppState, BinaryFiles, LibraryItem } from "../types";
|
||||
import type { ImportedDataState, LegacyAppState } from "./types";
|
||||
|
||||
|
|
|
@ -15,17 +15,14 @@ import {
|
|||
toBrandedType,
|
||||
getLineHeight,
|
||||
} from "@excalidraw/common";
|
||||
import {
|
||||
getCommonBounds,
|
||||
newElement,
|
||||
newLinearElement,
|
||||
redrawTextBoundingBox,
|
||||
} from "@excalidraw/element";
|
||||
|
||||
import { bindLinearElement } from "@excalidraw/element/binding";
|
||||
import {
|
||||
newArrowElement,
|
||||
newElement,
|
||||
newFrameElement,
|
||||
newImageElement,
|
||||
newLinearElement,
|
||||
newMagicFrameElement,
|
||||
newTextElement,
|
||||
} from "@excalidraw/element/newElement";
|
||||
|
@ -37,6 +34,8 @@ import { isArrowElement } from "@excalidraw/element/typeChecks";
|
|||
|
||||
import { syncInvalidIndices } from "@excalidraw/element/fractionalIndex";
|
||||
|
||||
import { redrawTextBoundingBox } from "@excalidraw/element/textElement";
|
||||
|
||||
import type { ElementConstructorOpts } from "@excalidraw/element/newElement";
|
||||
|
||||
import type {
|
||||
|
@ -62,6 +61,8 @@ import type {
|
|||
|
||||
import type { MarkOptional } from "@excalidraw/common/utility-types";
|
||||
|
||||
import { getCommonBounds } from "..";
|
||||
|
||||
export type ValidLinearElement = {
|
||||
type: "arrow" | "line";
|
||||
x: number;
|
||||
|
|
|
@ -5,7 +5,6 @@ import {
|
|||
WINDOWS_EMOJI_FALLBACK_FONT,
|
||||
getFontFamilyFallbacks,
|
||||
} from "@excalidraw/common";
|
||||
import { isTextElement } from "@excalidraw/element";
|
||||
import { getContainerElement } from "@excalidraw/element/textElement";
|
||||
import { charWidth } from "@excalidraw/element/textMeasurements";
|
||||
import { containsCJK } from "@excalidraw/element/textWrapping";
|
||||
|
@ -20,6 +19,8 @@ import {
|
|||
|
||||
import { ShapeCache } from "@excalidraw/element/ShapeCache";
|
||||
|
||||
import { isTextElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawTextElement,
|
||||
|
|
|
@ -215,10 +215,12 @@ export {
|
|||
getSceneVersion,
|
||||
hashElementsVersion,
|
||||
hashString,
|
||||
isInvisiblySmallElement,
|
||||
getNonDeletedElements,
|
||||
getTextFromElements,
|
||||
} from "@excalidraw/element";
|
||||
|
||||
export { getTextFromElements } from "@excalidraw/element/textElement";
|
||||
export { isInvisiblySmallElement } from "@excalidraw/element/sizeHelpers";
|
||||
|
||||
export { defaultLang, useI18n, languages } from "./i18n";
|
||||
export {
|
||||
restore,
|
||||
|
|
|
@ -14,12 +14,7 @@ import {
|
|||
invariant,
|
||||
throttleRAF,
|
||||
} from "@excalidraw/common";
|
||||
import {
|
||||
getElementAbsoluteCoords,
|
||||
getTransformHandlesFromCoords,
|
||||
getTransformHandles,
|
||||
getCommonBounds,
|
||||
} from "@excalidraw/element";
|
||||
|
||||
import {
|
||||
BINDING_HIGHLIGHT_OFFSET,
|
||||
BINDING_HIGHLIGHT_THICKNESS,
|
||||
|
@ -28,6 +23,8 @@ import {
|
|||
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
import {
|
||||
getOmitSidesForDevice,
|
||||
getTransformHandles,
|
||||
getTransformHandlesFromCoords,
|
||||
shouldShowBoundingBox,
|
||||
} from "@excalidraw/element/transformHandles";
|
||||
import {
|
||||
|
@ -49,6 +46,11 @@ import {
|
|||
selectGroupsFromGivenElements,
|
||||
} from "@excalidraw/element/groups";
|
||||
|
||||
import {
|
||||
getCommonBounds,
|
||||
getElementAbsoluteCoords,
|
||||
} from "@excalidraw/element/bounds";
|
||||
|
||||
import type {
|
||||
SuggestedBinding,
|
||||
SuggestedPointBinding,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { FRAME_STYLE, throttleRAF } from "@excalidraw/common";
|
||||
import { getElementAbsoluteCoords } from "@excalidraw/element";
|
||||
import { isElementLink } from "@excalidraw/element/elementLink";
|
||||
import { createPlaceholderEmbeddableLabel } from "@excalidraw/element/embeddable";
|
||||
import { getBoundTextElement } from "@excalidraw/element/textElement";
|
||||
|
@ -16,6 +15,8 @@ import {
|
|||
|
||||
import { renderElement } from "@excalidraw/element/renderElement";
|
||||
|
||||
import { getElementAbsoluteCoords } from "@excalidraw/element/bounds";
|
||||
|
||||
import type {
|
||||
ElementsMap,
|
||||
ExcalidrawFrameLikeElement,
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
getVerticalOffset,
|
||||
} from "@excalidraw/common";
|
||||
import { normalizeLink, toValidURL } from "@excalidraw/common";
|
||||
import { getElementAbsoluteCoords, hashString } from "@excalidraw/element";
|
||||
import { hashString } from "@excalidraw/element";
|
||||
import { getUncroppedWidthAndHeight } from "@excalidraw/element/cropElement";
|
||||
import {
|
||||
createPlaceholderEmbeddableLabel,
|
||||
|
@ -39,6 +39,8 @@ import {
|
|||
IMAGE_INVERT_FILTER,
|
||||
} from "@excalidraw/element/renderElement";
|
||||
|
||||
import { getElementAbsoluteCoords } from "@excalidraw/element/bounds";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawTextElementWithContainer,
|
||||
|
|
|
@ -15,8 +15,6 @@ import {
|
|||
toBrandedType,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { newTextElement } from "@excalidraw/element";
|
||||
|
||||
import {
|
||||
getCommonBounds,
|
||||
getElementAbsoluteCoords,
|
||||
|
@ -42,6 +40,8 @@ import { syncInvalidIndices } from "@excalidraw/element/fractionalIndex";
|
|||
|
||||
import { type Mutable } from "@excalidraw/common/utility-types";
|
||||
|
||||
import { newTextElement } from "@excalidraw/element/newElement";
|
||||
|
||||
import type { Bounds } from "@excalidraw/element/bounds";
|
||||
|
||||
import type {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import {
|
||||
getCommonBounds,
|
||||
getClosestElementBounds,
|
||||
getVisibleElements,
|
||||
} from "@excalidraw/element";
|
||||
import { getVisibleElements } from "@excalidraw/element";
|
||||
import {
|
||||
sceneCoordsToViewportCoords,
|
||||
viewportCoordsToSceneCoords,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { getClosestElementBounds } from "@excalidraw/element/bounds";
|
||||
|
||||
import { getCommonBounds } from "@excalidraw/element/bounds";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import type { AppState, Offsets, PointerCoords, Zoom } from "../types";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { getCommonBounds } from "@excalidraw/element";
|
||||
|
||||
import { getGlobalCSSVariable } from "@excalidraw/common";
|
||||
|
||||
import { getCommonBounds } from "@excalidraw/element/bounds";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { getLanguage } from "../i18n";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { ENV, isShallowEqual } from "@excalidraw/common";
|
||||
|
||||
import { deepCopyElement, newElementWith } from "@excalidraw/element";
|
||||
import { deepCopyElement } from "@excalidraw/element/newElement";
|
||||
|
||||
import type { OrderedExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
|
@ -11,6 +11,8 @@ import { AppStateChange, ElementsChange } from "./change";
|
|||
|
||||
import { Emitter } from "./emitter";
|
||||
|
||||
import { newElementWith } from ".";
|
||||
|
||||
import type { AppState, ObservedAppState } from "./types";
|
||||
|
||||
// hidden non-enumerable property for runtime checks
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import React from "react";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import { getElementBounds } from "@excalidraw/element";
|
||||
|
||||
import { getLineHeightInPx } from "@excalidraw/element/textMeasurements";
|
||||
|
||||
import { KEYS, arrayToMap, getLineHeight } from "@excalidraw/common";
|
||||
|
||||
import { getElementBounds } from "@excalidraw/element/bounds";
|
||||
|
||||
import { createPasteEvent, serializeAsClipboardJSON } from "../clipboard";
|
||||
|
||||
import { Excalidraw } from "../index";
|
||||
|
|
|
@ -3,9 +3,9 @@ import React from "react";
|
|||
import { vi } from "vitest";
|
||||
|
||||
import { ROUNDNESS, KEYS, arrayToMap, cloneJSON } from "@excalidraw/common";
|
||||
import { getElementAbsoluteCoords } from "@excalidraw/element";
|
||||
import { newLinearElement } from "@excalidraw/element";
|
||||
import { getBoundTextElementPosition } from "@excalidraw/element/textElement";
|
||||
import { getElementAbsoluteCoords } from "@excalidraw/element/bounds";
|
||||
import { newLinearElement } from "@excalidraw/element/newElement";
|
||||
|
||||
import type { LocalPoint } from "@excalidraw/math";
|
||||
|
||||
|
|
|
@ -6,16 +6,18 @@ import { pointFrom, type LocalPoint, type Radians } from "@excalidraw/math";
|
|||
|
||||
import { DEFAULT_VERTICAL_ALIGN, ROUNDNESS } from "@excalidraw/common";
|
||||
|
||||
import { newElement, newTextElement, newLinearElement } from "@excalidraw/element";
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
import {
|
||||
newArrowElement,
|
||||
newElement,
|
||||
newEmbeddableElement,
|
||||
newFrameElement,
|
||||
newFreeDrawElement,
|
||||
newIframeElement,
|
||||
newImageElement,
|
||||
newLinearElement,
|
||||
newMagicFrameElement,
|
||||
newTextElement,
|
||||
} from "@excalidraw/element/newElement";
|
||||
import { isLinearElementType } from "@excalidraw/element/typeChecks";
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
* to pure shapes
|
||||
*/
|
||||
|
||||
import { getElementAbsoluteCoords } from "@excalidraw/element";
|
||||
import { invariant } from "@excalidraw/common";
|
||||
import {
|
||||
curve,
|
||||
|
@ -35,6 +34,8 @@ import {
|
|||
} from "@excalidraw/math";
|
||||
import { pointsOnBezierCurves } from "points-on-curve";
|
||||
|
||||
import { getElementAbsoluteCoords } from "@excalidraw/element/bounds";
|
||||
|
||||
import type {
|
||||
ElementsMap,
|
||||
ExcalidrawBindableElement,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue