@excalidraw/common 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 +9 -5
- package/dist/dev/index.js.map +2 -2
- package/dist/prod/index.js +3 -3
- 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 +15 -7
- 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 +5 -5
- 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 +20 -12
- package/dist/types/excalidraw/data/json.d.ts +10 -6
- 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 +1 -1
- 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
|
@@ -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: {
|