@zsviczian/excalidraw 0.10.0-obsidian-19 → 0.10.0-obsidian-20
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/excalidraw.development.js +61 -40
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +4 -4
- package/types/actions/actionCanvas.d.ts +1 -1
- package/types/appState.d.ts +1 -1
- package/types/components/App.d.ts +1 -1
- package/types/components/Card.d.ts +1 -1
- package/types/components/LayerUI.d.ts +2 -1
- package/types/components/LibraryButton.d.ts +1 -0
- package/types/components/LockButton.d.ts +1 -0
- package/types/constants.d.ts +1 -0
- package/types/element/collision.d.ts +1 -0
- package/types/element/dragElements.d.ts +1 -2
- package/types/element/linearElementEditor.d.ts +133 -9
- package/types/element/newElement.d.ts +7 -5
- package/types/element/textElement.d.ts +22 -1
- package/types/element/textWysiwyg.d.ts +1 -0
- package/types/element/typeChecks.d.ts +4 -1
- package/types/element/types.d.ts +10 -2
- package/types/scene/comparisons.d.ts +1 -1
- package/types/scene/selection.d.ts +1 -1
- package/types/shapes.d.ts +1 -1
- package/types/types.d.ts +4 -0
- package/types/utils.d.ts +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zsviczian/excalidraw",
|
|
3
|
-
"version": "0.10.0-obsidian-
|
|
3
|
+
"version": "0.10.0-obsidian-20",
|
|
4
4
|
"main": "main.js",
|
|
5
5
|
"types": "types/packages/excalidraw/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
"css-loader": "6.5.1",
|
|
60
60
|
"mini-css-extract-plugin": "2.4.5",
|
|
61
61
|
"postcss-loader": "6.2.1",
|
|
62
|
-
"sass-loader": "12.
|
|
62
|
+
"sass-loader": "12.4.0",
|
|
63
63
|
"terser-webpack-plugin": "5.2.5",
|
|
64
64
|
"ts-loader": "9.2.6",
|
|
65
|
-
"typescript": "4.5.
|
|
66
|
-
"webpack": "5.
|
|
65
|
+
"typescript": "4.5.3",
|
|
66
|
+
"webpack": "5.65.0",
|
|
67
67
|
"webpack-bundle-analyzer": "4.5.0",
|
|
68
68
|
"webpack-cli": "4.9.1"
|
|
69
69
|
},
|
|
@@ -27,7 +27,7 @@ export declare const zoomToFitElements: (elements: readonly ExcalidrawElement[],
|
|
|
27
27
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
28
28
|
editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
|
|
29
29
|
editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
|
|
30
|
-
elementType: "line" | "
|
|
30
|
+
elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw";
|
|
31
31
|
elementLocked: boolean;
|
|
32
32
|
exportBackground: boolean;
|
|
33
33
|
exportEmbedScene: boolean;
|
package/types/appState.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
14
14
|
shouldCacheIgnoreZoom?: boolean | undefined;
|
|
15
15
|
theme?: string | undefined;
|
|
16
16
|
name?: string | undefined;
|
|
17
|
-
elementType?: "line" | "
|
|
17
|
+
elementType?: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | undefined;
|
|
18
18
|
elementLocked?: boolean | undefined;
|
|
19
19
|
exportBackground?: boolean | undefined;
|
|
20
20
|
exportEmbedScene?: boolean | undefined;
|
|
@@ -141,7 +141,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
141
141
|
private scheduleImageRefresh;
|
|
142
142
|
private updateBindingEnabledOnPointerMove;
|
|
143
143
|
private maybeSuggestBindingAtCursor;
|
|
144
|
-
private
|
|
144
|
+
private maybeSuggestBindingsForLinearElementAtCoords;
|
|
145
145
|
private maybeSuggestBindingForAll;
|
|
146
146
|
private clearSelection;
|
|
147
147
|
private handleCanvasRef;
|
|
@@ -3,8 +3,9 @@ import { ActionManager } from "../actions/manager";
|
|
|
3
3
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
4
4
|
import { Language } from "../i18n";
|
|
5
5
|
import { AppProps, AppState, ExcalidrawProps, BinaryFiles } from "../types";
|
|
6
|
-
import "./LayerUI.scss";
|
|
7
6
|
import Library from "../data/library";
|
|
7
|
+
import "./LayerUI.scss";
|
|
8
|
+
import "./Toolbar.scss";
|
|
8
9
|
interface LayerUIProps {
|
|
9
10
|
actionManager: ActionManager;
|
|
10
11
|
appState: AppState;
|
package/types/constants.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Point } from "../types";
|
|
|
4
4
|
import { AppState } from "../types";
|
|
5
5
|
export declare const hitTest: (element: NonDeletedExcalidrawElement, appState: AppState, x: number, y: number) => boolean;
|
|
6
6
|
export declare const isHittingElementBoundingBoxWithoutHittingElement: (element: NonDeletedExcalidrawElement, appState: AppState, x: number, y: number) => boolean;
|
|
7
|
+
export declare const isHittingElementNotConsideringBoundingBox: (element: NonDeletedExcalidrawElement, appState: AppState, point: readonly [number, number]) => boolean;
|
|
7
8
|
export declare const bindingBorderTest: (element: NonDeleted<ExcalidrawBindableElement>, { x, y }: {
|
|
8
9
|
x: number;
|
|
9
10
|
y: number;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SHAPES } from "../shapes";
|
|
2
|
-
import Scene from "../scene/Scene";
|
|
3
2
|
import { NonDeletedExcalidrawElement } from "./types";
|
|
4
3
|
import { PointerDownState } from "../types";
|
|
5
|
-
export declare const dragSelectedElements: (pointerDownState: PointerDownState, selectedElements: NonDeletedExcalidrawElement[], pointerX: number, pointerY: number,
|
|
4
|
+
export declare const dragSelectedElements: (pointerDownState: PointerDownState, selectedElements: NonDeletedExcalidrawElement[], pointerX: number, pointerY: number, lockDirection?: boolean, distanceX?: number, distanceY?: number) => void;
|
|
6
5
|
export declare const getDragOffsetXY: (selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
|
|
7
6
|
export declare const dragNewElement: (draggingElement: NonDeletedExcalidrawElement, elementType: typeof SHAPES[number]["value"], originX: number, originY: number, x: number, y: number, width: number, height: number, shouldMaintainAspectRatio: boolean, shouldResizeFromCenter: boolean, widthAspectRatio?: number | null | undefined) => void;
|
|
@@ -7,14 +7,20 @@ export declare class LinearElementEditor {
|
|
|
7
7
|
elementId: ExcalidrawElement["id"] & {
|
|
8
8
|
_brand: "excalidrawLinearElementId";
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
/** indices */
|
|
11
|
+
selectedPointsIndices: readonly number[] | null;
|
|
12
|
+
pointerDownState: Readonly<{
|
|
13
|
+
prevSelectedPointsIndices: readonly number[] | null;
|
|
14
|
+
/** index */
|
|
15
|
+
lastClickedPoint: number;
|
|
16
|
+
}>;
|
|
11
17
|
/** whether you're dragging a point */
|
|
12
18
|
isDragging: boolean;
|
|
13
19
|
lastUncommittedPoint: Point | null;
|
|
14
|
-
pointerOffset: {
|
|
20
|
+
pointerOffset: Readonly<{
|
|
15
21
|
x: number;
|
|
16
22
|
y: number;
|
|
17
|
-
}
|
|
23
|
+
}>;
|
|
18
24
|
startBindingElement: ExcalidrawBindableElement | null | "keep";
|
|
19
25
|
endBindingElement: ExcalidrawBindableElement | null | "keep";
|
|
20
26
|
constructor(element: NonDeleted<ExcalidrawLinearElement>, scene: Scene);
|
|
@@ -24,8 +30,12 @@ export declare class LinearElementEditor {
|
|
|
24
30
|
* statically guarantee this method returns an ExcalidrawLinearElement)
|
|
25
31
|
*/
|
|
26
32
|
static getElement(id: InstanceType<typeof LinearElementEditor>["elementId"]): NonDeleted<ExcalidrawLinearElement> | null;
|
|
33
|
+
static handleBoxSelection(event: PointerEvent, appState: AppState, setState: React.Component<any, AppState>["setState"]): false | undefined;
|
|
27
34
|
/** @returns whether point was dragged */
|
|
28
|
-
static handlePointDragging(appState: AppState, setState: React.Component<any, AppState>["setState"], scenePointerX: number, scenePointerY: number, maybeSuggestBinding: (element: NonDeleted<ExcalidrawLinearElement>,
|
|
35
|
+
static handlePointDragging(appState: AppState, setState: React.Component<any, AppState>["setState"], scenePointerX: number, scenePointerY: number, maybeSuggestBinding: (element: NonDeleted<ExcalidrawLinearElement>, pointSceneCoords: {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
}[]) => void): boolean;
|
|
29
39
|
static handlePointerUp(event: PointerEvent, editingLinearElement: LinearElementEditor, appState: AppState): LinearElementEditor;
|
|
30
40
|
static handlePointerDown(event: React.PointerEvent<HTMLCanvasElement>, appState: AppState, setState: React.Component<any, AppState>["setState"], history: History, scenePointer: {
|
|
31
41
|
x: number;
|
|
@@ -35,6 +45,9 @@ export declare class LinearElementEditor {
|
|
|
35
45
|
hitElement: NonDeleted<ExcalidrawElement> | null;
|
|
36
46
|
};
|
|
37
47
|
static handlePointerMove(event: React.PointerEvent<HTMLCanvasElement>, scenePointerX: number, scenePointerY: number, editingLinearElement: LinearElementEditor, gridSize: number | null): LinearElementEditor;
|
|
48
|
+
/** scene coords */
|
|
49
|
+
static getPointGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, point: Point): readonly [number, number];
|
|
50
|
+
/** scene coords */
|
|
38
51
|
static getPointsGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>): number[][];
|
|
39
52
|
static getPointAtIndexGlobalCoordinates(element: NonDeleted<ExcalidrawLinearElement>, indexMaybeFromEnd: number): Point;
|
|
40
53
|
static pointFromAbsoluteCoords(element: NonDeleted<ExcalidrawLinearElement>, absoluteCoords: Point): Point;
|
|
@@ -51,12 +64,123 @@ export declare class LinearElementEditor {
|
|
|
51
64
|
y: number;
|
|
52
65
|
};
|
|
53
66
|
static normalizePoints(element: NonDeleted<ExcalidrawLinearElement>): void;
|
|
54
|
-
static
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
67
|
+
static duplicateSelectedPoints(appState: AppState): false | {
|
|
68
|
+
appState: {
|
|
69
|
+
editingLinearElement: {
|
|
70
|
+
selectedPointsIndices: number[];
|
|
71
|
+
elementId: string & {
|
|
72
|
+
_brand: "excalidrawLinearElementId";
|
|
73
|
+
};
|
|
74
|
+
pointerDownState: Readonly<{
|
|
75
|
+
prevSelectedPointsIndices: readonly number[] | null;
|
|
76
|
+
/** index */
|
|
77
|
+
lastClickedPoint: number;
|
|
78
|
+
}>;
|
|
79
|
+
/** whether you're dragging a point */
|
|
80
|
+
isDragging: boolean;
|
|
81
|
+
lastUncommittedPoint: readonly [number, number] | null;
|
|
82
|
+
pointerOffset: Readonly<{
|
|
83
|
+
x: number;
|
|
84
|
+
y: number;
|
|
85
|
+
}>;
|
|
86
|
+
startBindingElement: ExcalidrawBindableElement | "keep" | null;
|
|
87
|
+
endBindingElement: ExcalidrawBindableElement | "keep" | null;
|
|
88
|
+
};
|
|
89
|
+
isLoading: boolean;
|
|
90
|
+
errorMessage: string | null;
|
|
91
|
+
draggingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
92
|
+
resizingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
93
|
+
multiElement: NonDeleted<ExcalidrawLinearElement> | null;
|
|
94
|
+
selectionElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
95
|
+
isBindingEnabled: boolean;
|
|
96
|
+
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
97
|
+
suggestedBindings: import("./binding").SuggestedBinding[];
|
|
98
|
+
editingElement: import("./types").NonDeletedExcalidrawElement | null;
|
|
99
|
+
elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw";
|
|
100
|
+
elementLocked: boolean;
|
|
101
|
+
exportBackground: boolean;
|
|
102
|
+
exportEmbedScene: boolean;
|
|
103
|
+
exportWithDarkMode: boolean;
|
|
104
|
+
exportScale: number;
|
|
105
|
+
currentItemStrokeColor: string;
|
|
106
|
+
currentItemBackgroundColor: string;
|
|
107
|
+
currentItemFillStyle: import("./types").FillStyle;
|
|
108
|
+
currentItemStrokeWidth: number;
|
|
109
|
+
currentItemStrokeStyle: import("./types").StrokeStyle;
|
|
110
|
+
currentItemRoughness: number;
|
|
111
|
+
currentItemOpacity: number;
|
|
112
|
+
currentItemFontFamily: number;
|
|
113
|
+
currentItemFontSize: number;
|
|
114
|
+
currentItemTextAlign: import("./types").TextAlign;
|
|
115
|
+
currentItemStrokeSharpness: import("./types").StrokeSharpness;
|
|
116
|
+
currentItemStartArrowhead: import("./types").Arrowhead | null;
|
|
117
|
+
currentItemEndArrowhead: import("./types").Arrowhead | null;
|
|
118
|
+
currentItemLinearStrokeSharpness: import("./types").StrokeSharpness;
|
|
119
|
+
viewBackgroundColor: string;
|
|
120
|
+
scrollX: number;
|
|
121
|
+
scrollY: number;
|
|
122
|
+
cursorButton: "up" | "down";
|
|
123
|
+
scrolledOutside: boolean;
|
|
124
|
+
name: string;
|
|
125
|
+
isResizing: boolean;
|
|
126
|
+
isRotating: boolean;
|
|
127
|
+
zoom: Readonly<{
|
|
128
|
+
value: import("../types").NormalizedZoomValue;
|
|
129
|
+
translation: Readonly<{
|
|
130
|
+
x: number;
|
|
131
|
+
y: number;
|
|
132
|
+
}>;
|
|
133
|
+
}>;
|
|
134
|
+
openMenu: "canvas" | "shape" | null;
|
|
135
|
+
openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
|
|
136
|
+
lastPointerDownWith: import("./types").PointerType;
|
|
137
|
+
selectedElementIds: {
|
|
138
|
+
[id: string]: boolean;
|
|
139
|
+
};
|
|
140
|
+
previousSelectedElementIds: {
|
|
141
|
+
[id: string]: boolean;
|
|
142
|
+
};
|
|
143
|
+
shouldCacheIgnoreZoom: boolean;
|
|
144
|
+
showHelpDialog: boolean;
|
|
145
|
+
toastMessage: string | null;
|
|
146
|
+
zenModeEnabled: boolean;
|
|
147
|
+
theme: string;
|
|
148
|
+
gridSize: number | null;
|
|
149
|
+
viewModeEnabled: boolean;
|
|
150
|
+
selectedGroupIds: {
|
|
151
|
+
[groupId: string]: boolean;
|
|
152
|
+
};
|
|
153
|
+
editingGroupId: string | null;
|
|
154
|
+
width: number;
|
|
155
|
+
height: number;
|
|
156
|
+
offsetTop: number;
|
|
157
|
+
offsetLeft: number;
|
|
158
|
+
isLibraryOpen: boolean;
|
|
159
|
+
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
160
|
+
collaborators: Map<string, import("../types").Collaborator>;
|
|
161
|
+
showStats: boolean;
|
|
162
|
+
currentChartType: import("./types").ChartType;
|
|
163
|
+
pasteDialog: {
|
|
164
|
+
shown: false;
|
|
165
|
+
data: null;
|
|
166
|
+
} | {
|
|
167
|
+
shown: true;
|
|
168
|
+
data: import("../charts").Spreadsheet;
|
|
169
|
+
};
|
|
170
|
+
pendingImageElement: NonDeleted<import("./types").ExcalidrawImageElement> | null;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, pointIndices: readonly number[]): void;
|
|
174
|
+
static addPoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
|
|
175
|
+
point: Point;
|
|
176
|
+
}[]): void;
|
|
177
|
+
static movePoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
|
|
178
|
+
index: number;
|
|
179
|
+
point: Point;
|
|
180
|
+
isDragging?: boolean;
|
|
181
|
+
}[], otherUpdates?: {
|
|
59
182
|
startBinding?: PointBinding;
|
|
60
183
|
endBinding?: PointBinding;
|
|
61
184
|
}): void;
|
|
185
|
+
private static _updatePoints;
|
|
62
186
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues } from "../element/types";
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawRectangleElement } from "../element/types";
|
|
2
2
|
import { AppState } from "../types";
|
|
3
|
-
declare type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "
|
|
3
|
+
declare type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "boundElements" | "seed" | "version" | "versionNonce">;
|
|
4
4
|
export declare const newElement: (opts: {
|
|
5
5
|
type: ExcalidrawGenericElement["type"];
|
|
6
6
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawGenericElement>;
|
|
@@ -11,12 +11,14 @@ export declare const newTextElement: (opts: {
|
|
|
11
11
|
fontFamily: FontFamilyValues;
|
|
12
12
|
textAlign: TextAlign;
|
|
13
13
|
verticalAlign: VerticalAlign;
|
|
14
|
+
containerId?: ExcalidrawRectangleElement["id"];
|
|
14
15
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
|
|
15
|
-
export declare const updateTextElement: (element: ExcalidrawTextElement, { text,
|
|
16
|
+
export declare const updateTextElement: (element: ExcalidrawTextElement, { text, isDeleted, originalText, rawText, }: {
|
|
16
17
|
text: string;
|
|
17
|
-
rawText?: string | undefined;
|
|
18
18
|
isDeleted?: boolean | undefined;
|
|
19
|
-
|
|
19
|
+
originalText: string;
|
|
20
|
+
rawText?: string | undefined;
|
|
21
|
+
}, updateDimensions: boolean) => ExcalidrawTextElement;
|
|
20
22
|
export declare const newFreeDrawElement: (opts: {
|
|
21
23
|
type: "freedraw";
|
|
22
24
|
points?: ExcalidrawFreeDrawElement["points"];
|
|
@@ -1,2 +1,23 @@
|
|
|
1
|
-
import { ExcalidrawTextElement } from "./types";
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawTextElement, FontString, NonDeletedExcalidrawElement } from "./types";
|
|
2
|
+
import { MaybeTransformHandleType } from "./transformHandles";
|
|
2
3
|
export declare const redrawTextBoundingBox: (element: ExcalidrawTextElement) => void;
|
|
4
|
+
export declare const bindTextToShapeAfterDuplication: (sceneElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
5
|
+
export declare const handleBindTextResize: (elements: readonly NonDeletedExcalidrawElement[], transformHandleType: MaybeTransformHandleType) => void;
|
|
6
|
+
export declare const measureText: (text: string, font: FontString, maxWidth?: number | null | undefined) => {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
baseline: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const getApproxLineHeight: (font: FontString) => number;
|
|
12
|
+
export declare const wrapText: (text: string, font: FontString, containerWidth: number) => string;
|
|
13
|
+
export declare const charWidth: {
|
|
14
|
+
calculate: (char: string, font: FontString) => number;
|
|
15
|
+
updateCache: (char: string, font: FontString) => void;
|
|
16
|
+
clearCacheforFont: (font: FontString) => void;
|
|
17
|
+
getCache: (font: FontString) => number[];
|
|
18
|
+
};
|
|
19
|
+
export declare const getApproxMinLineWidth: (font: FontString) => number;
|
|
20
|
+
export declare const getApproxMinLineHeight: (font: FontString) => number;
|
|
21
|
+
export declare const getMinCharWidth: (font: FontString) => number;
|
|
22
|
+
export declare const getApproxCharsToFitInWidth: (font: FontString, width: number) => number;
|
|
23
|
+
export declare const getBoundTextElementId: (container: ExcalidrawElement | null) => string | undefined;
|
|
@@ -7,6 +7,7 @@ export declare const textWysiwyg: ({ id, appState, onChange, onSubmit, getViewpo
|
|
|
7
7
|
onSubmit: (data: {
|
|
8
8
|
text: string;
|
|
9
9
|
viaKeyboard: boolean;
|
|
10
|
+
originalText: string;
|
|
10
11
|
}) => void;
|
|
11
12
|
getViewportCoords: (x: number, y: number) => [number, number];
|
|
12
13
|
element: ExcalidrawElement;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawGenericElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement } from "./types";
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawGenericElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer } from "./types";
|
|
2
2
|
export declare const isGenericElement: (element: ExcalidrawElement | null) => element is ExcalidrawGenericElement;
|
|
3
3
|
export declare const isInitializedImageElement: (element: ExcalidrawElement | null) => element is InitializedExcalidrawImageElement;
|
|
4
4
|
export declare const isImageElement: (element: ExcalidrawElement | null) => element is ExcalidrawImageElement;
|
|
@@ -10,4 +10,7 @@ export declare const isLinearElementType: (elementType: ExcalidrawElement["type"
|
|
|
10
10
|
export declare const isBindingElement: (element?: ExcalidrawElement | null | undefined) => element is ExcalidrawLinearElement;
|
|
11
11
|
export declare const isBindingElementType: (elementType: ExcalidrawElement["type"]) => boolean;
|
|
12
12
|
export declare const isBindableElement: (element: ExcalidrawElement | null) => element is ExcalidrawBindableElement;
|
|
13
|
+
export declare const isTextBindableContainer: (element: ExcalidrawElement | null) => boolean;
|
|
13
14
|
export declare const isExcalidrawElement: (element: any) => boolean;
|
|
15
|
+
export declare const hasBoundTextElement: (element: ExcalidrawElement | null) => element is ExcalidrawBindableElement;
|
|
16
|
+
export declare const isBoundToContainer: (element: ExcalidrawElement | null) => element is ExcalidrawTextElementWithContainer;
|
package/types/element/types.d.ts
CHANGED
|
@@ -43,8 +43,11 @@ declare type _ExcalidrawElementBase = Readonly<{
|
|
|
43
43
|
/** List of groups the element belongs to.
|
|
44
44
|
Ordered from deepest to shallowest. */
|
|
45
45
|
groupIds: readonly GroupId[];
|
|
46
|
-
/**
|
|
47
|
-
|
|
46
|
+
/** other elements that are bound to this element */
|
|
47
|
+
boundElements: readonly Readonly<{
|
|
48
|
+
id: ExcalidrawLinearElement["id"];
|
|
49
|
+
type: "arrow" | "text";
|
|
50
|
+
}>[] | null;
|
|
48
51
|
/** epoch (ms) timestamp of last element update */
|
|
49
52
|
updated: number;
|
|
50
53
|
}>;
|
|
@@ -92,8 +95,13 @@ export declare type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
|
|
|
92
95
|
baseline: number;
|
|
93
96
|
textAlign: TextAlign;
|
|
94
97
|
verticalAlign: VerticalAlign;
|
|
98
|
+
containerId: ExcalidrawGenericElement["id"] | null;
|
|
99
|
+
originalText: string;
|
|
95
100
|
}>;
|
|
96
101
|
export declare type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement;
|
|
102
|
+
export declare type ExcalidrawTextElementWithContainer = {
|
|
103
|
+
containerId: ExcalidrawGenericElement["id"];
|
|
104
|
+
} & ExcalidrawTextElement;
|
|
97
105
|
export declare type PointBinding = {
|
|
98
106
|
elementId: ExcalidrawBindableElement["id"];
|
|
99
107
|
focus: number;
|
|
@@ -8,4 +8,4 @@ export declare const hasText: (type: string) => boolean;
|
|
|
8
8
|
export declare const canHaveArrowheads: (type: string) => boolean;
|
|
9
9
|
export declare const getElementAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement | null;
|
|
10
10
|
export declare const getElementsAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement[];
|
|
11
|
-
export declare const getElementContainingPosition: (elements: readonly ExcalidrawElement[], x: number, y: number) => ExcalidrawElement | null;
|
|
11
|
+
export declare const getElementContainingPosition: (elements: readonly ExcalidrawElement[], x: number, y: number, excludedType?: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | undefined) => ExcalidrawElement | null;
|
|
@@ -7,5 +7,5 @@ export declare const isSomeElementSelected: (elements: readonly NonDeletedExcali
|
|
|
7
7
|
* elements. If elements don't share the same value, returns `null`.
|
|
8
8
|
*/
|
|
9
9
|
export declare const getCommonAttributeOfSelectedElements: <T>(elements: readonly NonDeletedExcalidrawElement[], appState: AppState, getAttribute: (element: ExcalidrawElement) => T) => T | null;
|
|
10
|
-
export declare const getSelectedElements: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => NonDeletedExcalidrawElement[];
|
|
10
|
+
export declare const getSelectedElements: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, includeBoundTextElement?: boolean) => NonDeletedExcalidrawElement[];
|
|
11
11
|
export declare const getTargetElements: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => NonDeletedExcalidrawElement[];
|
package/types/shapes.d.ts
CHANGED
|
@@ -36,4 +36,4 @@ export declare const SHAPES: readonly [{
|
|
|
36
36
|
readonly value: "image";
|
|
37
37
|
readonly key: null;
|
|
38
38
|
}];
|
|
39
|
-
export declare const findShapeByKey: (key: string) => "line" | "
|
|
39
|
+
export declare const findShapeByKey: (key: string) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | null;
|
package/types/types.d.ts
CHANGED
|
@@ -290,6 +290,7 @@ export declare type PointerDownState = Readonly<{
|
|
|
290
290
|
wasAddedToSelection: boolean;
|
|
291
291
|
hasBeenDuplicated: boolean;
|
|
292
292
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
293
|
+
hasHitElementInside: boolean;
|
|
293
294
|
};
|
|
294
295
|
withCmdOrCtrl: boolean;
|
|
295
296
|
drag: {
|
|
@@ -305,6 +306,9 @@ export declare type PointerDownState = Readonly<{
|
|
|
305
306
|
onKeyDown: null | ((event: KeyboardEvent) => void);
|
|
306
307
|
onKeyUp: null | ((event: KeyboardEvent) => void);
|
|
307
308
|
};
|
|
309
|
+
boxSelection: {
|
|
310
|
+
hasOccurred: boolean;
|
|
311
|
+
};
|
|
308
312
|
}>;
|
|
309
313
|
export declare type ExcalidrawImperativeAPI = {
|
|
310
314
|
updateScene: InstanceType<typeof App>["updateScene"];
|
package/types/utils.d.ts
CHANGED
|
@@ -14,11 +14,6 @@ export declare const getFontString: ({ fontSize, fontFamily, }: {
|
|
|
14
14
|
fontSize: number;
|
|
15
15
|
fontFamily: FontFamilyValues;
|
|
16
16
|
}) => FontString;
|
|
17
|
-
export declare const measureText: (text: string, font: FontString) => {
|
|
18
|
-
width: number;
|
|
19
|
-
height: number;
|
|
20
|
-
baseline: number;
|
|
21
|
-
};
|
|
22
17
|
export declare const debounce: <T extends any[]>(fn: (...args: T) => void, timeout: number) => {
|
|
23
18
|
(...args: T): void;
|
|
24
19
|
flush(): void;
|