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