@dwelle/excalidraw 0.3.26 → 0.3.30
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/CHANGELOG.md +8 -4
- package/README_NEXT.md +25 -0
- package/dist/excalidraw-assets/{vendor-64ea3ed78bc76a895e61.js → vendor-8698157b56eb5e0ee549.js} +2 -2
- package/dist/excalidraw-assets/{vendor-64ea3ed78bc76a895e61.js.LICENSE.txt → vendor-8698157b56eb5e0ee549.js.LICENSE.txt} +0 -2
- package/dist/excalidraw-assets-dev/{image-469d5bd946743969995a.js → image-e50a452aa26d28419e39.js} +0 -0
- package/dist/excalidraw-assets-dev/{vendor-a449655791956f151f51.js → vendor-1bc8ceaafd8623c96dd4.js} +0 -66
- package/dist/excalidraw.development.js +71 -94
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +4 -5
- 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 +134 -9
- package/types/element/newElement.d.ts +6 -4
- 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/packages/excalidraw/dist/excalidraw-assets/vendor-8698157b56eb5e0ee549.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/image-e50a452aa26d28419e39.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/vendor-1bc8ceaafd8623c96dd4.d.ts +0 -0
- package/types/packages/excalidraw/webpack.dev.config.d.ts +5 -7
- package/types/packages/excalidraw/webpack.prod.config.d.ts +5 -7
- 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 +5 -0
- package/types/utils.d.ts +0 -5
- package/dist/0adeb55dfbca17fad22e.woff2 +0 -1
- package/dist/be42d56e500bdd14ae50.woff2 +0 -1
- package/dist/d9454a7bea9e32f0c282.woff2 +0 -1
- package/dist/edf7912ad1921efb0e5c.woff2 +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dwelle/excalidraw",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.30",
|
|
4
4
|
"main": "main.js",
|
|
5
5
|
"types": "types/packages/excalidraw/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -50,14 +50,13 @@
|
|
|
50
50
|
"babel-plugin-transform-class-properties": "6.24.1",
|
|
51
51
|
"cross-env": "7.0.3",
|
|
52
52
|
"css-loader": "6.5.1",
|
|
53
|
-
"file-loader": "6.2.0",
|
|
54
53
|
"mini-css-extract-plugin": "2.4.5",
|
|
55
54
|
"postcss-loader": "6.2.1",
|
|
56
|
-
"sass-loader": "12.
|
|
55
|
+
"sass-loader": "12.4.0",
|
|
57
56
|
"terser-webpack-plugin": "5.2.5",
|
|
58
57
|
"ts-loader": "9.2.6",
|
|
59
|
-
"typescript": "4.5.
|
|
60
|
-
"webpack": "5.
|
|
58
|
+
"typescript": "4.5.3",
|
|
59
|
+
"webpack": "5.65.0",
|
|
61
60
|
"webpack-bundle-analyzer": "4.5.0",
|
|
62
61
|
"webpack-cli": "4.9.1"
|
|
63
62
|
},
|
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;
|
|
@@ -140,7 +140,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
140
140
|
private scheduleImageRefresh;
|
|
141
141
|
private updateBindingEnabledOnPointerMove;
|
|
142
142
|
private maybeSuggestBindingAtCursor;
|
|
143
|
-
private
|
|
143
|
+
private maybeSuggestBindingsForLinearElementAtCoords;
|
|
144
144
|
private maybeSuggestBindingForAll;
|
|
145
145
|
private clearSelection;
|
|
146
146
|
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
|
onHomeButtonClick?: () => void;
|
|
10
11
|
actionManager: ActionManager;
|
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,124 @@ 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
|
+
/** @returns whether point was dragged */
|
|
150
|
+
viewModeEnabled: boolean;
|
|
151
|
+
selectedGroupIds: {
|
|
152
|
+
[groupId: string]: boolean;
|
|
153
|
+
};
|
|
154
|
+
editingGroupId: string | null;
|
|
155
|
+
width: number;
|
|
156
|
+
height: number;
|
|
157
|
+
offsetTop: number;
|
|
158
|
+
offsetLeft: number;
|
|
159
|
+
isLibraryOpen: boolean;
|
|
160
|
+
fileHandle: import("browser-fs-access").FileSystemHandle | null;
|
|
161
|
+
collaborators: Map<string, import("../types").Collaborator>;
|
|
162
|
+
showStats: boolean;
|
|
163
|
+
currentChartType: import("./types").ChartType;
|
|
164
|
+
pasteDialog: {
|
|
165
|
+
shown: false;
|
|
166
|
+
data: null;
|
|
167
|
+
} | {
|
|
168
|
+
shown: true;
|
|
169
|
+
data: import("../charts").Spreadsheet;
|
|
170
|
+
};
|
|
171
|
+
pendingImageElement: NonDeleted<import("./types").ExcalidrawImageElement> | null;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, pointIndices: readonly number[]): void;
|
|
175
|
+
static addPoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
|
|
176
|
+
point: Point;
|
|
177
|
+
}[]): void;
|
|
178
|
+
static movePoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
|
|
179
|
+
index: number;
|
|
180
|
+
point: Point;
|
|
181
|
+
isDragging?: boolean;
|
|
182
|
+
}[], otherUpdates?: {
|
|
59
183
|
startBinding?: PointBinding;
|
|
60
184
|
endBinding?: PointBinding;
|
|
61
185
|
}): void;
|
|
186
|
+
private static _updatePoints;
|
|
62
187
|
}
|
|
@@ -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>;
|
|
@@ -10,11 +10,13 @@ export declare const newTextElement: (opts: {
|
|
|
10
10
|
fontFamily: FontFamilyValues;
|
|
11
11
|
textAlign: TextAlign;
|
|
12
12
|
verticalAlign: VerticalAlign;
|
|
13
|
+
containerId?: ExcalidrawRectangleElement["id"];
|
|
13
14
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawTextElement>;
|
|
14
|
-
export declare const updateTextElement: (element: ExcalidrawTextElement, { text, isDeleted }: {
|
|
15
|
+
export declare const updateTextElement: (element: ExcalidrawTextElement, { text, isDeleted, originalText, }: {
|
|
15
16
|
text: string;
|
|
16
17
|
isDeleted?: boolean | undefined;
|
|
17
|
-
|
|
18
|
+
originalText: string;
|
|
19
|
+
}, updateDimensions: boolean) => ExcalidrawTextElement;
|
|
18
20
|
export declare const newFreeDrawElement: (opts: {
|
|
19
21
|
type: "freedraw";
|
|
20
22
|
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
|
}>;
|
|
@@ -91,8 +94,13 @@ export declare type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
|
|
|
91
94
|
baseline: number;
|
|
92
95
|
textAlign: TextAlign;
|
|
93
96
|
verticalAlign: VerticalAlign;
|
|
97
|
+
containerId: ExcalidrawGenericElement["id"] | null;
|
|
98
|
+
originalText: string;
|
|
94
99
|
}>;
|
|
95
100
|
export declare type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement;
|
|
101
|
+
export declare type ExcalidrawTextElementWithContainer = {
|
|
102
|
+
containerId: ExcalidrawGenericElement["id"];
|
|
103
|
+
} & ExcalidrawTextElement;
|
|
96
104
|
export declare type PointBinding = {
|
|
97
105
|
elementId: ExcalidrawBindableElement["id"];
|
|
98
106
|
focus: number;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -11,6 +11,7 @@ export namespace output {
|
|
|
11
11
|
const libraryTarget: string;
|
|
12
12
|
const filename: string;
|
|
13
13
|
const chunkFilename: string;
|
|
14
|
+
const assetModuleFilename: string;
|
|
14
15
|
const publicPath: string;
|
|
15
16
|
}
|
|
16
17
|
export namespace resolve {
|
|
@@ -31,6 +32,7 @@ export namespace module {
|
|
|
31
32
|
};
|
|
32
33
|
};
|
|
33
34
|
})[];
|
|
35
|
+
type?: undefined;
|
|
34
36
|
} | {
|
|
35
37
|
test: RegExp;
|
|
36
38
|
exclude: RegExp;
|
|
@@ -41,16 +43,12 @@ export namespace module {
|
|
|
41
43
|
configFile: string;
|
|
42
44
|
};
|
|
43
45
|
}[];
|
|
46
|
+
type?: undefined;
|
|
44
47
|
} | {
|
|
45
48
|
test: RegExp;
|
|
46
|
-
|
|
47
|
-
loader: string;
|
|
48
|
-
options: {
|
|
49
|
-
name: string;
|
|
50
|
-
outputPath: string;
|
|
51
|
-
};
|
|
52
|
-
}[];
|
|
49
|
+
type: string;
|
|
53
50
|
exclude?: undefined;
|
|
51
|
+
use?: undefined;
|
|
54
52
|
})[];
|
|
55
53
|
}
|
|
56
54
|
export namespace optimization {
|
|
@@ -9,6 +9,7 @@ export namespace output {
|
|
|
9
9
|
const libraryTarget: string;
|
|
10
10
|
const filename: string;
|
|
11
11
|
const chunkFilename: string;
|
|
12
|
+
const assetModuleFilename: string;
|
|
12
13
|
const publicPath: string;
|
|
13
14
|
}
|
|
14
15
|
export namespace resolve {
|
|
@@ -29,6 +30,7 @@ export namespace module {
|
|
|
29
30
|
};
|
|
30
31
|
};
|
|
31
32
|
})[];
|
|
33
|
+
type?: undefined;
|
|
32
34
|
} | {
|
|
33
35
|
test: RegExp;
|
|
34
36
|
exclude: RegExp;
|
|
@@ -51,16 +53,12 @@ export namespace module {
|
|
|
51
53
|
configFile?: undefined;
|
|
52
54
|
};
|
|
53
55
|
})[];
|
|
56
|
+
type?: undefined;
|
|
54
57
|
} | {
|
|
55
58
|
test: RegExp;
|
|
56
|
-
|
|
57
|
-
loader: string;
|
|
58
|
-
options: {
|
|
59
|
-
name: string;
|
|
60
|
-
outputPath: string;
|
|
61
|
-
};
|
|
62
|
-
}[];
|
|
59
|
+
type: string;
|
|
63
60
|
exclude?: undefined;
|
|
61
|
+
use?: undefined;
|
|
64
62
|
})[];
|
|
65
63
|
}
|
|
66
64
|
export namespace optimization {
|
|
@@ -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
|
@@ -294,6 +294,7 @@ export declare type PointerDownState = Readonly<{
|
|
|
294
294
|
wasAddedToSelection: boolean;
|
|
295
295
|
hasBeenDuplicated: boolean;
|
|
296
296
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
297
|
+
hasHitElementInside: boolean;
|
|
297
298
|
};
|
|
298
299
|
withCmdOrCtrl: boolean;
|
|
299
300
|
drag: {
|
|
@@ -309,6 +310,9 @@ export declare type PointerDownState = Readonly<{
|
|
|
309
310
|
onKeyDown: null | ((event: KeyboardEvent) => void);
|
|
310
311
|
onKeyUp: null | ((event: KeyboardEvent) => void);
|
|
311
312
|
};
|
|
313
|
+
boxSelection: {
|
|
314
|
+
hasOccurred: boolean;
|
|
315
|
+
};
|
|
312
316
|
}>;
|
|
313
317
|
export declare type ExcalidrawImperativeAPI = {
|
|
314
318
|
updateScene: InstanceType<typeof App>["updateScene"];
|
|
@@ -328,5 +332,6 @@ export declare type ExcalidrawImperativeAPI = {
|
|
|
328
332
|
readyPromise: ResolvablePromise<ExcalidrawImperativeAPI>;
|
|
329
333
|
ready: true;
|
|
330
334
|
id: string;
|
|
335
|
+
app: InstanceType<typeof App>;
|
|
331
336
|
};
|
|
332
337
|
export {};
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default __webpack_public_path__ + "excalidraw-assets/Cascadia.woff2";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default __webpack_public_path__ + "excalidraw-assets-dev/Virgil.woff2";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default __webpack_public_path__ + "excalidraw-assets/Virgil.woff2";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default __webpack_public_path__ + "excalidraw-assets-dev/Cascadia.woff2";
|