@excalidraw/element 0.18.0-063e025 → 0.18.0-1acf66e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/index.js +3951 -3199
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +12 -12
- package/dist/types/common/src/constants.d.ts +2 -0
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/utils.d.ts +1 -1
- package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
- package/dist/types/element/src/arrows/focus.d.ts +5 -2
- package/dist/types/element/src/binding.d.ts +12 -3
- package/dist/types/element/src/comparisons.d.ts +4 -4
- package/dist/types/element/src/convertToShape.d.ts +23 -0
- package/dist/types/element/src/dragElements.d.ts +27 -0
- package/dist/types/element/src/flowchart.d.ts +6 -6
- package/dist/types/element/src/groups.d.ts +1 -1
- package/dist/types/element/src/index.d.ts +2 -0
- package/dist/types/element/src/linearElementEditor.d.ts +7 -0
- package/dist/types/element/src/newElement.d.ts +13 -0
- package/dist/types/element/src/selection.d.ts +1 -1
- package/dist/types/element/src/textElement.d.ts +6 -3
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +15 -3
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +10 -2
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +99 -565
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +10 -2
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +16 -3
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +2 -1
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +10 -2
- package/dist/types/excalidraw/actions/actionExport.d.ts +12 -4
- package/dist/types/excalidraw/actions/actionFrame.d.ts +15 -178
- package/dist/types/excalidraw/actions/actionGroup.d.ts +10 -2
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +6 -1
- package/dist/types/excalidraw/actions/actionLink.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionMenu.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionProperties.d.ts +10 -2
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionStyles.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +6 -2
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +5 -1
- package/dist/types/excalidraw/actions/index.d.ts +0 -1
- package/dist/types/excalidraw/actions/manager.d.ts +1 -0
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +5 -1
- package/dist/types/excalidraw/appState.d.ts +4 -4
- package/dist/types/excalidraw/components/Actions.d.ts +16 -10
- package/dist/types/excalidraw/components/App.arrowText.d.ts +72 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +31 -0
- package/dist/types/excalidraw/components/App.d.ts +322 -76
- package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
- package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +73 -0
- package/dist/types/excalidraw/components/{ToolButton.d.ts → IconButton.d.ts} +16 -19
- package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
- package/dist/types/excalidraw/components/LayerUI.d.ts +4 -2
- package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
- package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
- package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
- package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
- package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
- package/dist/types/excalidraw/components/Popover.d.ts +1 -3
- package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
- package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
- package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
- package/dist/types/excalidraw/components/Tools.d.ts +145 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +2 -0
- package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
- package/dist/types/excalidraw/components/icons.d.ts +1 -1
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +1 -1
- package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
- package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
- package/dist/types/excalidraw/data/blob.d.ts +14 -6
- package/dist/types/excalidraw/data/json.d.ts +7 -3
- package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
- package/dist/types/excalidraw/scene/types.d.ts +3 -0
- package/dist/types/excalidraw/types.d.ts +199 -13
- package/dist/types/excalidraw/viewport.d.ts +20 -64
- package/dist/types/laser-pointer/src/state.d.ts +1 -0
- package/dist/types/math/src/index.d.ts +1 -0
- package/dist/types/math/src/pca.d.ts +79 -0
- package/dist/types/math/src/polygon.d.ts +25 -1
- package/package.json +4 -4
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -173
- package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -10
- package/dist/types/excalidraw/components/shapes.d.ts +0 -270
- package/dist/types/excalidraw/cursor.d.ts +0 -5
- package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
|
@@ -262,6 +262,7 @@ export declare const TEXT_ALIGN: {
|
|
|
262
262
|
RIGHT: string;
|
|
263
263
|
};
|
|
264
264
|
export declare const ELEMENT_READY_TO_ERASE_OPACITY = 20;
|
|
265
|
+
export declare const ELEMENT_PENDING_DRAW_SHAPE_OPACITY = 70;
|
|
265
266
|
export declare const DEFAULT_PROPORTIONAL_RADIUS = 0.25;
|
|
266
267
|
export declare const DEFAULT_ADAPTIVE_RADIUS = 32;
|
|
267
268
|
export declare const ROUNDNESS: {
|
|
@@ -314,6 +315,7 @@ export declare const TOOL_TYPE: {
|
|
|
314
315
|
readonly magicframe: "magicframe";
|
|
315
316
|
readonly embeddable: "embeddable";
|
|
316
317
|
readonly laser: "laser";
|
|
318
|
+
readonly autoshape: "autoshape";
|
|
317
319
|
};
|
|
318
320
|
export declare const EDITOR_LS_KEYS: {
|
|
319
321
|
readonly OAI_API_KEY: "excalidraw-oai-api-key";
|
|
@@ -6,4 +6,4 @@ export declare const getSizeFromPoints: (points: readonly (GlobalPoint | LocalPo
|
|
|
6
6
|
};
|
|
7
7
|
/** @arg dimension, 0 for rescaling only x, 1 for y */
|
|
8
8
|
export declare const rescalePoints: <Point extends GlobalPoint | LocalPoint>(dimension: 0 | 1, newSize: number, points: readonly Point[], normalize: boolean) => Point[];
|
|
9
|
-
export declare const getGridPoint: (x: number, y: number, gridSize: NullableGridSize) =>
|
|
9
|
+
export declare const getGridPoint: (x: number, y: number, gridSize: NullableGridSize) => GlobalPoint;
|
|
@@ -51,7 +51,7 @@ export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">,
|
|
|
51
51
|
locked?: boolean;
|
|
52
52
|
fromSelection?: boolean;
|
|
53
53
|
}) & {
|
|
54
|
-
|
|
54
|
+
lastActiveTool?: ActiveTool | null;
|
|
55
55
|
}) => AppState["activeTool"];
|
|
56
56
|
export declare const isFullScreen: () => boolean;
|
|
57
57
|
export declare const allowFullScreen: () => Promise<void>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { GlobalPoint } from "@excalidraw/math";
|
|
2
|
+
import type { AppState } from "@excalidraw/excalidraw/types";
|
|
3
|
+
import type { ElementsMap, ExcalidrawArrowElement, ExcalidrawTextElement, FixedPoint, NonDeleted, NonDeletedExcalidrawElement, TextAlign, VerticalAlign } from "./types";
|
|
4
|
+
export type ArrowEndpoint = {
|
|
5
|
+
arrow: NonDeleted<ExcalidrawArrowElement>;
|
|
6
|
+
startOrEnd: "start" | "end";
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Finds a free (unbound) arrow endpoint under the cursor, front-most first.
|
|
10
|
+
* Used by the text tool to offer creating a text label anchored to the tip of
|
|
11
|
+
* an arrow.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getUnboundArrowEndpointAtPoint: (scenePointer: GlobalPoint, elements: readonly NonDeletedExcalidrawElement[], elementsMap: ElementsMap, zoom: AppState["zoom"]) => ArrowEndpoint | null;
|
|
14
|
+
/**
|
|
15
|
+
* Describes how a text element should be created so that it reads as a label
|
|
16
|
+
* for the given arrow endpoint.
|
|
17
|
+
*
|
|
18
|
+
* The arrow is treated as fixed: rather than routing the arrow to the text, we
|
|
19
|
+
* pick the side of the text the arrow should attach to (the one it already
|
|
20
|
+
* points at), and place the text so that side's midpoint lands on the existing
|
|
21
|
+
* endpoint. The alignment returned pins that same midpoint while the text is
|
|
22
|
+
* typed, so the arrow doesn't swing around during editing.
|
|
23
|
+
*/
|
|
24
|
+
export declare const getTextBindingForArrowEndpoint: (arrow: NonDeleted<ExcalidrawArrowElement>, startOrEnd: "start" | "end", elementsMap: ElementsMap,
|
|
25
|
+
/**
|
|
26
|
+
* stroke width the text will be created with — the binding gap is derived
|
|
27
|
+
* from the *bind target*, so using the arrow's would offset the anchor by
|
|
28
|
+
* half the difference between the two
|
|
29
|
+
*/
|
|
30
|
+
targetStrokeWidth: number) => {
|
|
31
|
+
/** the text-local ratio the arrow binds to (a side midpoint) */
|
|
32
|
+
fixedPoint: FixedPoint;
|
|
33
|
+
textAlign: TextAlign;
|
|
34
|
+
verticalAlign: VerticalAlign;
|
|
35
|
+
/** scene position the text's bound side midpoint should sit at */
|
|
36
|
+
anchor: GlobalPoint;
|
|
37
|
+
} | null;
|
|
38
|
+
/**
|
|
39
|
+
* Whether an arrow endpoint is bound to this text — i.e. the text serves as an
|
|
40
|
+
* arrow-endpoint label. Checked on the arrows' own bindings: the text's
|
|
41
|
+
* `boundElements` only says an arrow relates to it, while the binding on the
|
|
42
|
+
* arrow is the authoritative side of the relationship.
|
|
43
|
+
*/
|
|
44
|
+
export declare const isEndpointBoundText: (text: ExcalidrawTextElement, elementsMap: ElementsMap) => boolean;
|
|
45
|
+
/** the anchor a text bound to an arrow endpoint grows away from */
|
|
46
|
+
export declare const getEndpointBoundTextDragAnchor: (newElement: ExcalidrawTextElement) => {
|
|
47
|
+
anchorRatio: number;
|
|
48
|
+
anchorX: number;
|
|
49
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type GlobalPoint } from "@excalidraw/math";
|
|
2
2
|
import type { AppState, NullableGridSize } from "@excalidraw/excalidraw/types";
|
|
3
3
|
import { LinearElementEditor } from "../linearElementEditor";
|
|
4
|
-
import type { ElementsMap, ExcalidrawArrowElement, ExcalidrawBindableElement, NonDeletedSceneElementsMap } from "../types";
|
|
4
|
+
import type { ElementsMap, ExcalidrawArrowElement, ExcalidrawBindableElement, FixedPointBinding, NonDeletedSceneElementsMap } from "../types";
|
|
5
5
|
import type { Scene } from "../Scene";
|
|
6
6
|
export declare const isFocusPointVisible: (focusPoint: GlobalPoint, arrow: ExcalidrawArrowElement, bindableElement: ExcalidrawBindableElement, elementsMap: ElementsMap, appState: {
|
|
7
7
|
isBindingEnabled: AppState["isBindingEnabled"];
|
|
@@ -22,6 +22,9 @@ export declare const handleFocusPointPointerDown: (arrow: ExcalidrawArrowElement
|
|
|
22
22
|
x: number;
|
|
23
23
|
y: number;
|
|
24
24
|
};
|
|
25
|
+
arrowOtherEndpointInitialBinding: FixedPointBinding | null;
|
|
26
|
+
};
|
|
27
|
+
export declare const handleFocusPointPointerUp: (linearElementEditor: LinearElementEditor, scene: Scene) => {
|
|
28
|
+
arrowOtherEndpointInitialBinding: null;
|
|
25
29
|
};
|
|
26
|
-
export declare const handleFocusPointPointerUp: (linearElementEditor: LinearElementEditor, scene: Scene) => void;
|
|
27
30
|
export declare const handleFocusPointHover: (arrow: ExcalidrawArrowElement, scenePointerX: number, scenePointerY: number, scene: Scene, appState: AppState) => "start" | "end" | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type GlobalPoint } from "@excalidraw/math";
|
|
2
2
|
import type { LineSegment, LocalPoint } from "@excalidraw/math";
|
|
3
|
-
import type { AppState } from "@excalidraw/excalidraw/types";
|
|
3
|
+
import type { AppState, NullableGridSize } from "@excalidraw/excalidraw/types";
|
|
4
4
|
import type { Bounds } from "@excalidraw/common";
|
|
5
5
|
import { type Heading } from "./heading";
|
|
6
6
|
import type { Scene } from "./Scene";
|
|
@@ -28,7 +28,7 @@ export declare const BASE_BINDING_GAP = 5;
|
|
|
28
28
|
export declare const BASE_BINDING_GAP_ELBOW = 5;
|
|
29
29
|
export declare const BASE_ARROW_MIN_LENGTH = 10;
|
|
30
30
|
export declare const FOCUS_POINT_SIZE: number;
|
|
31
|
-
export declare const getBindingGap: (bindTarget: ExcalidrawBindableElement, opts: Pick<ExcalidrawArrowElement, "elbowed">) => number;
|
|
31
|
+
export declare const getBindingGap: (bindTarget: Pick<ExcalidrawBindableElement, "strokeWidth">, opts: Pick<ExcalidrawArrowElement, "elbowed">) => number;
|
|
32
32
|
export declare const maxBindingDistance_simple: (zoom?: AppState["zoom"]) => number;
|
|
33
33
|
export declare const isBindingEnabled: (appState: {
|
|
34
34
|
isBindingEnabled: AppState["isBindingEnabled"];
|
|
@@ -38,6 +38,7 @@ export declare const bindOrUnbindBindingElement: (arrow: NonDeleted<ExcalidrawAr
|
|
|
38
38
|
altKey?: boolean;
|
|
39
39
|
angleLocked?: boolean;
|
|
40
40
|
initialBinding?: boolean;
|
|
41
|
+
gridSize?: NullableGridSize;
|
|
41
42
|
}) => {
|
|
42
43
|
start: BindingStrategy;
|
|
43
44
|
end: BindingStrategy;
|
|
@@ -49,12 +50,13 @@ export declare const getBindingStrategyForDraggingBindingElementEndpoints: (arro
|
|
|
49
50
|
finalize?: boolean;
|
|
50
51
|
initialBinding?: boolean;
|
|
51
52
|
zoom?: AppState["zoom"];
|
|
53
|
+
gridSize?: NullableGridSize;
|
|
52
54
|
}) => {
|
|
53
55
|
start: BindingStrategy;
|
|
54
56
|
end: BindingStrategy;
|
|
55
57
|
};
|
|
56
58
|
export declare const bindOrUnbindBindingElements: (selectedArrows: NonDeleted<ExcalidrawArrowElement>[], scene: Scene, appState: AppState) => void;
|
|
57
|
-
export declare const bindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, hoveredElement: NonDeleted<ExcalidrawBindableElement>, mode: BindMode, startOrEnd: "start" | "end", scene: Scene, focusPoint?: GlobalPoint, shouldSnapToOutline?: boolean) => void;
|
|
59
|
+
export declare const bindBindingElement: (arrow: NonDeleted<ExcalidrawArrowElement>, hoveredElement: NonDeleted<ExcalidrawBindableElement>, mode: BindMode, startOrEnd: "start" | "end", scene: Scene, focusPoint?: GlobalPoint, shouldSnapToOutline?: boolean, isMidpointSnappingEnabled?: boolean) => void;
|
|
58
60
|
export declare const unbindBindingElement: (arrow: ExcalidrawArrowElement, startOrEnd: "start" | "end", scene: Scene) => ExcalidrawBindableElement["id"] | null;
|
|
59
61
|
export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, scene: Scene, options?: {
|
|
60
62
|
simultaneouslyUpdated?: readonly NonDeletedExcalidrawElement[];
|
|
@@ -127,3 +129,10 @@ export declare const getArrowLocalFixedPoints: (arrow: ExcalidrawElbowArrowEleme
|
|
|
127
129
|
export declare const isFixedPoint: (fixedPoint: any) => fixedPoint is FixedPointBinding["fixedPoint"];
|
|
128
130
|
export declare const normalizeFixedPoint: <T extends FixedPoint>(fixedPoint: T) => FixedPoint;
|
|
129
131
|
export declare const getBindingSideMidPoint: (binding: FixedPointBinding, elementsMap: ElementsMap) => GlobalPoint | LocalPoint | null;
|
|
132
|
+
/**
|
|
133
|
+
* Binds an arrow endpoint to an explicit fixed point on a bindable element,
|
|
134
|
+
* bypassing the "derive the ratio from where the endpoint currently is"
|
|
135
|
+
* strategy used when dragging. Needed when the binding target is placed to fit
|
|
136
|
+
* the arrow rather than the other way round.
|
|
137
|
+
*/
|
|
138
|
+
export declare const bindBindingElementToFixedPoint: (arrow: NonDeleted<ExcalidrawArrowElement>, bindableElement: NonDeleted<ExcalidrawBindableElement>, startOrEnd: "start" | "end", fixedPoint: FixedPoint, scene: Scene) => void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ElementOrToolType } from "@excalidraw/excalidraw/types";
|
|
2
|
-
export declare const hasBackground: (type: ElementOrToolType) => type is "line" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw";
|
|
3
|
-
export declare const hasStrokeColor: (type: ElementOrToolType) => type is "line" | "arrow" | "text" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "freedraw";
|
|
4
|
-
export declare const hasStrokeWidth: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw";
|
|
5
|
-
export declare const hasStrokeStyle: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe";
|
|
2
|
+
export declare const hasBackground: (type: ElementOrToolType) => type is "line" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw" | "autoshape";
|
|
3
|
+
export declare const hasStrokeColor: (type: ElementOrToolType) => type is "line" | "arrow" | "text" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "freedraw" | "autoshape";
|
|
4
|
+
export declare const hasStrokeWidth: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "freedraw" | "autoshape";
|
|
5
|
+
export declare const hasStrokeStyle: (type: ElementOrToolType) => type is "line" | "arrow" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "iframe" | "autoshape";
|
|
6
6
|
export declare const hasFreedrawMode: (type: ElementOrToolType) => type is "freedraw";
|
|
7
7
|
export declare const canChangeRoundness: (type: ElementOrToolType) => type is "line" | "rectangle" | "diamond" | "embeddable" | "iframe" | "image";
|
|
8
8
|
export declare const toolIsArrow: (type: ElementOrToolType) => type is "arrow";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { App, AppState } from "@excalidraw/excalidraw/types";
|
|
2
|
+
import type { LocalPoint, GlobalPoint } from "@excalidraw/math";
|
|
3
|
+
import type { Bounds } from "@excalidraw/common";
|
|
4
|
+
import type { ExcalidrawArrowElement, ExcalidrawDiamondElement, ExcalidrawElement, ExcalidrawEllipseElement, ExcalidrawFreeDrawElement, ExcalidrawFrameLikeElement, ExcalidrawRectangleElement, ElementsMap, NonDeleted, ExcalidrawLineElement } from "@excalidraw/element/types";
|
|
5
|
+
declare global {
|
|
6
|
+
interface Window {
|
|
7
|
+
LAST_POINTS?: readonly GlobalPoint[];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
type NonDeletedRecognizedShapeElement = NonDeleted<ExcalidrawRectangleElement | ExcalidrawEllipseElement | ExcalidrawDiamondElement | ExcalidrawArrowElement | ExcalidrawLineElement | ExcalidrawFreeDrawElement>;
|
|
11
|
+
type Shape = NonDeletedRecognizedShapeElement["type"];
|
|
12
|
+
interface ShapeRecognitionResult<P extends LocalPoint | GlobalPoint> {
|
|
13
|
+
type: Shape;
|
|
14
|
+
points: readonly P[];
|
|
15
|
+
boundingBox: Bounds;
|
|
16
|
+
}
|
|
17
|
+
export declare const recognizeShape: <P extends LocalPoint | GlobalPoint>(points: P[], previousElement: ExcalidrawElement | null, zoom?: number) => ShapeRecognitionResult<P>;
|
|
18
|
+
export declare const convertToShape: (points: GlobalPoint[], appState: AppState, elementsMap: ElementsMap, previousElement: ExcalidrawElement | null, frames?: readonly ExcalidrawFrameLikeElement[]) => NonDeletedRecognizedShapeElement | undefined;
|
|
19
|
+
export declare const convertToShapeHandlePointerMoveFromPointerDown: (app: App, pointerCoords: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
}) => boolean;
|
|
23
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AppState, NormalizedZoomValue, NullableGridSize, PointerDownState } from "@excalidraw/excalidraw/types";
|
|
2
2
|
import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
3
3
|
import type { Scene } from "./Scene";
|
|
4
|
+
import type { ExcalidrawTextElement } from "./types";
|
|
4
5
|
export declare const dragSelectedElements: (pointerDownState: PointerDownState, _selectedElements: NonDeletedExcalidrawElement[], offset: {
|
|
5
6
|
x: number;
|
|
6
7
|
y: number;
|
|
@@ -9,6 +10,32 @@ export declare const dragSelectedElements: (pointerDownState: PointerDownState,
|
|
|
9
10
|
y: number;
|
|
10
11
|
}, gridSize: NullableGridSize) => void;
|
|
11
12
|
export declare const getDragOffsetXY: (selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
|
|
13
|
+
/**
|
|
14
|
+
* Sizes a text element as it is dragged out.
|
|
15
|
+
*
|
|
16
|
+
* A dragged text pins one point and grows away from it; `anchorRatio` says
|
|
17
|
+
* where along the box that point sits — 0 for its left edge, 1 for its right,
|
|
18
|
+
* 0.5 for its centre.
|
|
19
|
+
*
|
|
20
|
+
* A free text pins the point the drag started from and takes the ratio from
|
|
21
|
+
* the drag direction, so it can be pulled either way. A text bound to an arrow
|
|
22
|
+
* endpoint instead pins whatever the binding placed it against and takes the
|
|
23
|
+
* ratio from its alignment — which is also what keeps it from growing back
|
|
24
|
+
* over the arrow, since dragging that way makes no progress rather than
|
|
25
|
+
* flipping the box around.
|
|
26
|
+
*/
|
|
27
|
+
export declare const dragNewTextElement: ({ newElement, anchorX, anchorRatio, pointerX, nextY, zoom, scene, informMutation, }: {
|
|
28
|
+
newElement: ExcalidrawTextElement;
|
|
29
|
+
anchorX: number;
|
|
30
|
+
/** 0 = anchored by its left edge, 1 = by its right, 0.5 = by its centre */
|
|
31
|
+
anchorRatio: number;
|
|
32
|
+
pointerX: number;
|
|
33
|
+
/** free text re-tops itself to the drag origin; a bound one must not move */
|
|
34
|
+
nextY?: number;
|
|
35
|
+
zoom: NormalizedZoomValue;
|
|
36
|
+
scene: Scene;
|
|
37
|
+
informMutation?: boolean;
|
|
38
|
+
}) => void;
|
|
12
39
|
export declare const dragNewElement: ({ newElement, elementType, originX, originY, x, y, width, height, shouldMaintainAspectRatio, shouldResizeFromCenter, zoom, scene, widthAspectRatio, originOffset, informMutation, }: {
|
|
13
40
|
newElement: NonDeletedExcalidrawElement;
|
|
14
41
|
elementType: AppState["activeTool"]["type"];
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { AppState, PendingExcalidrawElements } from "@excalidraw/excalidraw/types";
|
|
2
|
-
import { type NonDeleted, type ElementsMap, type
|
|
2
|
+
import { type NonDeleted, type ElementsMap, type ExcalidrawElement, type ExcalidrawFlowchartNodeElement } from "./types";
|
|
3
3
|
import type { Scene } from "./Scene";
|
|
4
|
-
type LinkDirection = "up" | "right" | "down" | "left";
|
|
5
|
-
export declare const getLinkDirectionFromKey: (key: string) => LinkDirection;
|
|
6
|
-
export declare const getPredecessors: (node: ExcalidrawBindableElement, elementsMap: ElementsMap, direction: LinkDirection) => ExcalidrawBindableElement[];
|
|
7
|
-
export declare const addNewNodes: (startNode: NonDeleted<ExcalidrawFlowchartNodeElement>, appState: AppState, direction: LinkDirection, scene: Scene, numberOfNodes: number) => NonDeletedExcalidrawElement[];
|
|
4
|
+
export type LinkDirection = "up" | "right" | "down" | "left";
|
|
8
5
|
export declare class FlowChartNavigator {
|
|
9
6
|
isExploring: boolean;
|
|
10
7
|
private sameLevelNodes;
|
|
@@ -13,14 +10,17 @@ export declare class FlowChartNavigator {
|
|
|
13
10
|
private visitedNodes;
|
|
14
11
|
clear(): void;
|
|
15
12
|
exploreByDirection(element: ExcalidrawElement, elementsMap: ElementsMap, direction: LinkDirection): ExcalidrawElement["id"] | null;
|
|
13
|
+
private static getNodeRelatives;
|
|
14
|
+
private static getSuccessors;
|
|
15
|
+
private static getPredecessors;
|
|
16
16
|
}
|
|
17
17
|
export declare class FlowChartCreator {
|
|
18
18
|
isCreatingChart: boolean;
|
|
19
19
|
private numberOfNodes;
|
|
20
20
|
private direction;
|
|
21
|
+
private clusterCrossStart;
|
|
21
22
|
pendingNodes: PendingExcalidrawElements | null;
|
|
22
23
|
createNodes(startNode: NonDeleted<ExcalidrawFlowchartNodeElement>, appState: AppState, direction: LinkDirection, scene: Scene): void;
|
|
23
24
|
clear(): void;
|
|
24
25
|
}
|
|
25
26
|
export declare const isNodeInFlowchart: (element: ExcalidrawFlowchartNodeElement, elementsMap: ElementsMap) => boolean;
|
|
26
|
-
export {};
|
|
@@ -31,4 +31,4 @@ export declare const getNonDeletedGroupIds: (elements: ElementsMap) => Set<strin
|
|
|
31
31
|
export declare const elementsAreInSameGroup: (elements: readonly ExcalidrawElement[]) => boolean;
|
|
32
32
|
export declare const isInGroup: (element: ExcalidrawElement) => boolean;
|
|
33
33
|
export declare const getNewGroupIdsForDuplication: (groupIds: ExcalidrawElement["groupIds"], editingGroupId: AppState["editingGroupId"], mapper: (groupId: GroupId) => GroupId) => string[];
|
|
34
|
-
export declare const getSelectedElementsByGroup: (selectedElements:
|
|
34
|
+
export declare const getSelectedElementsByGroup: (selectedElements: NonDeletedExcalidrawElement[], elementsMap: ElementsMap, appState: Readonly<Pick<AppState, "selectedGroupIds" | "editingGroupId">>) => NonDeletedExcalidrawElement[][];
|
|
@@ -12,6 +12,7 @@ export declare const isNonDeletedElement: <T extends ExcalidrawElement>(element:
|
|
|
12
12
|
export declare const getVisibleElements: (elements: readonly ExcalidrawElement[]) => readonly NonDeletedExcalidrawElement[];
|
|
13
13
|
export declare const getNonDeletedElements: <T extends ExcalidrawElement>(elements: readonly T[]) => readonly NonDeleted<T>[];
|
|
14
14
|
export * from "./align";
|
|
15
|
+
export * from "./arrowEndpointText";
|
|
15
16
|
export * from "./binding";
|
|
16
17
|
export * from "./bounds";
|
|
17
18
|
export * from "./collision";
|
|
@@ -57,3 +58,4 @@ export * from "./utils";
|
|
|
57
58
|
export * from "./zindex";
|
|
58
59
|
export * from "./arrows/helpers";
|
|
59
60
|
export * from "./arrowheads";
|
|
61
|
+
export * from "./convertToShape";
|
|
@@ -22,6 +22,7 @@ export declare class LinearElementEditor {
|
|
|
22
22
|
};
|
|
23
23
|
arrowStartIsInside: boolean;
|
|
24
24
|
altFocusPoint: Readonly<GlobalPoint> | null;
|
|
25
|
+
arrowOtherEndpointInitialBinding: FixedPointBinding | null;
|
|
25
26
|
}>;
|
|
26
27
|
/** whether you're dragging a point */
|
|
27
28
|
readonly isDragging: boolean;
|
|
@@ -107,6 +108,12 @@ export declare class LinearElementEditor {
|
|
|
107
108
|
} | undefined;
|
|
108
109
|
private static _updatePoints;
|
|
109
110
|
private static _getShiftLockedDelta;
|
|
111
|
+
/**
|
|
112
|
+
* The point a bound text label is centered on — the middle of the linear
|
|
113
|
+
* element, whether that's an actual point or the midpoint of the middle
|
|
114
|
+
* segment.
|
|
115
|
+
*/
|
|
116
|
+
static getBoundTextElementCenter: (element: ExcalidrawLinearElement, elementsMap: ElementsMap) => GlobalPoint;
|
|
110
117
|
static getBoundTextElementPosition: (element: ExcalidrawLinearElement, boundTextElement: ExcalidrawTextElementWithContainer, elementsMap: ElementsMap) => {
|
|
111
118
|
x: number;
|
|
112
119
|
y: number;
|
|
@@ -16,6 +16,19 @@ export declare const newFrameElement: (opts: {
|
|
|
16
16
|
export declare const newMagicFrameElement: (opts: {
|
|
17
17
|
name?: string;
|
|
18
18
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawMagicFrameElement>;
|
|
19
|
+
/**
|
|
20
|
+
* The point of the text box its alignment pins, as ratios of width/height.
|
|
21
|
+
*
|
|
22
|
+
* This is the point that stays put as the text grows — see the sides passed to
|
|
23
|
+
* `adjustXYWithRotation` in `getAdjustedDimensions`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const getTextAnchorRatios: (opts: {
|
|
26
|
+
textAlign: ExcalidrawTextElement["textAlign"];
|
|
27
|
+
verticalAlign: ExcalidrawTextElement["verticalAlign"];
|
|
28
|
+
}) => {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
};
|
|
19
32
|
export declare const newTextElement: (opts: {
|
|
20
33
|
text: string;
|
|
21
34
|
originalText?: string;
|
|
@@ -18,7 +18,7 @@ export declare const getSelectedElements: (elements: ElementsMapOrArray, appStat
|
|
|
18
18
|
includeBoundTextElement?: boolean;
|
|
19
19
|
includeElementsInFrames?: boolean;
|
|
20
20
|
}) => NonDeletedExcalidrawElement[];
|
|
21
|
-
export declare const getTargetElements: (elements: ElementsMapOrArray, appState: Pick<AppState, "selectedElementIds" | "editingTextElement" | "newElement">) => NonDeletedExcalidrawElement[] | import("./types").ExcalidrawTextElement[];
|
|
21
|
+
export declare const getTargetElements: (elements: ElementsMapOrArray, appState: Pick<AppState, "selectedElementIds" | "editingTextElement" | "newElement" | "activeTool">) => NonDeletedExcalidrawElement[] | import("./types").ExcalidrawTextElement[];
|
|
22
22
|
/**
|
|
23
23
|
* returns prevState's selectedElementids if no change from previous, so as to
|
|
24
24
|
* retain reference identity for memoization
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { type Radians } from "@excalidraw/math";
|
|
2
|
-
import type { AppState } from "@excalidraw/excalidraw/types";
|
|
3
2
|
import type { ExtractSetType } from "@excalidraw/common/utility-types";
|
|
4
3
|
import type { Scene } from "./Scene";
|
|
5
4
|
import type { MaybeTransformHandleType } from "./transformHandles";
|
|
6
5
|
import type { ElementsMap, ExcalidrawElement, ExcalidrawElementType, ExcalidrawTextContainer, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, NonDeleted } from "./types";
|
|
7
6
|
export declare const redrawTextBoundingBox: (textElement: ExcalidrawTextElement, container: ExcalidrawElement | null, scene: Scene) => void;
|
|
8
|
-
export declare const handleBindTextResize: (container: ExcalidrawElement, scene: Scene, transformHandleType: MaybeTransformHandleType, shouldMaintainAspectRatio?: boolean) => void;
|
|
7
|
+
export declare const handleBindTextResize: (container: ExcalidrawElement, scene: Scene, transformHandleType: MaybeTransformHandleType, shouldMaintainAspectRatio?: boolean, shouldResizeFromCenter?: boolean) => void;
|
|
9
8
|
export declare const computeBoundTextPosition: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer, elementsMap: ElementsMap) => {
|
|
10
9
|
x: number;
|
|
11
10
|
y: number;
|
|
@@ -13,7 +12,11 @@ export declare const computeBoundTextPosition: (container: ExcalidrawElement, bo
|
|
|
13
12
|
export declare const getBoundTextElementId: (container: ExcalidrawElement | null) => string | null;
|
|
14
13
|
export declare const getBoundTextElement: (element: ExcalidrawElement | null, elementsMap: ElementsMap) => NonDeleted<ExcalidrawTextElementWithContainer> | null;
|
|
15
14
|
export declare const getContainerElement: <T extends ExcalidrawTextElement, R extends ExcalidrawTextContainer>(element: T | null, elementsMap: ElementsMap) => R | null;
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* The point a text bound to this container centers on — and, for arrows, the
|
|
17
|
+
* point the text tool snaps a new label to.
|
|
18
|
+
*/
|
|
19
|
+
export declare const getContainerCenter: (container: ExcalidrawElement, elementsMap: ElementsMap) => {
|
|
17
20
|
x: number;
|
|
18
21
|
y: number;
|
|
19
22
|
};
|
|
@@ -33,6 +33,10 @@ export declare const actionAddToLibrary: {
|
|
|
33
33
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
34
34
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
35
35
|
} | null;
|
|
36
|
+
hoveredArrowTextAnchor: {
|
|
37
|
+
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
38
|
+
anchor: "start" | "end" | "label";
|
|
39
|
+
} | null;
|
|
36
40
|
frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
37
41
|
frameRendering: {
|
|
38
42
|
enabled: boolean;
|
|
@@ -40,7 +44,7 @@ export declare const actionAddToLibrary: {
|
|
|
40
44
|
outline: boolean;
|
|
41
45
|
clip: boolean;
|
|
42
46
|
};
|
|
43
|
-
editingFrame:
|
|
47
|
+
editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
|
|
44
48
|
elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
|
|
45
49
|
editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
|
|
46
50
|
activeTool: {
|
|
@@ -189,6 +193,10 @@ export declare const actionAddToLibrary: {
|
|
|
189
193
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
190
194
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
191
195
|
} | null;
|
|
196
|
+
hoveredArrowTextAnchor: {
|
|
197
|
+
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
198
|
+
anchor: "start" | "end" | "label";
|
|
199
|
+
} | null;
|
|
192
200
|
frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
193
201
|
frameRendering: {
|
|
194
202
|
enabled: boolean;
|
|
@@ -196,7 +204,7 @@ export declare const actionAddToLibrary: {
|
|
|
196
204
|
outline: boolean;
|
|
197
205
|
clip: boolean;
|
|
198
206
|
};
|
|
199
|
-
editingFrame:
|
|
207
|
+
editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
|
|
200
208
|
elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
|
|
201
209
|
editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
|
|
202
210
|
activeTool: {
|
|
@@ -350,6 +358,10 @@ export declare const actionAddToLibrary: {
|
|
|
350
358
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
351
359
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
352
360
|
} | null;
|
|
361
|
+
hoveredArrowTextAnchor: {
|
|
362
|
+
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
363
|
+
anchor: "start" | "end" | "label";
|
|
364
|
+
} | null;
|
|
353
365
|
frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
354
366
|
frameRendering: {
|
|
355
367
|
enabled: boolean;
|
|
@@ -357,7 +369,7 @@ export declare const actionAddToLibrary: {
|
|
|
357
369
|
outline: boolean;
|
|
358
370
|
clip: boolean;
|
|
359
371
|
};
|
|
360
|
-
editingFrame:
|
|
372
|
+
editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
|
|
361
373
|
elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
|
|
362
374
|
editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
|
|
363
375
|
activeTool: {
|
|
@@ -53,6 +53,10 @@ export declare const actionBindText: {
|
|
|
53
53
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
54
54
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
55
55
|
} | null;
|
|
56
|
+
hoveredArrowTextAnchor: {
|
|
57
|
+
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
58
|
+
anchor: "start" | "end" | "label";
|
|
59
|
+
} | null;
|
|
56
60
|
frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
57
61
|
frameRendering: {
|
|
58
62
|
enabled: boolean;
|
|
@@ -60,7 +64,7 @@ export declare const actionBindText: {
|
|
|
60
64
|
outline: boolean;
|
|
61
65
|
clip: boolean;
|
|
62
66
|
};
|
|
63
|
-
editingFrame:
|
|
67
|
+
editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
|
|
64
68
|
elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
|
|
65
69
|
editingTextElement: ExcalidrawTextElement | null;
|
|
66
70
|
activeTool: {
|
|
@@ -226,6 +230,10 @@ export declare const actionWrapTextInContainer: {
|
|
|
226
230
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
227
231
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
228
232
|
} | null;
|
|
233
|
+
hoveredArrowTextAnchor: {
|
|
234
|
+
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
235
|
+
anchor: "start" | "end" | "label";
|
|
236
|
+
} | null;
|
|
229
237
|
frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
230
238
|
frameRendering: {
|
|
231
239
|
enabled: boolean;
|
|
@@ -233,7 +241,7 @@ export declare const actionWrapTextInContainer: {
|
|
|
233
241
|
outline: boolean;
|
|
234
242
|
clip: boolean;
|
|
235
243
|
};
|
|
236
|
-
editingFrame:
|
|
244
|
+
editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
|
|
237
245
|
elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
|
|
238
246
|
editingTextElement: ExcalidrawTextElement | null;
|
|
239
247
|
activeTool: {
|