@dwelle/excalidraw 0.5.0-ef89e88 → 0.5.0-efddbb7
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 +81 -0
- package/README.md +111 -14
- package/dist/dev/{chunk-UPL5GSGP.js → chunk-AVAC6BVM.js} +11 -2
- package/dist/dev/chunk-AVAC6BVM.js.map +7 -0
- package/dist/dev/{chunk-VLJRILK3.js → chunk-OKDHCI5V.js} +1844 -1440
- package/dist/dev/chunk-OKDHCI5V.js.map +7 -0
- package/dist/dev/{chunk-H5SL5I5R.js → chunk-UEBEBUE2.js} +2 -2
- package/dist/dev/components/TTDDialog/{CodeMirrorEditor-65RQRK4A.js → CodeMirrorEditor-2YIEAZU7.js} +2 -2
- package/dist/dev/data/{image-JR54FB4B.js → image-O7OJXMIJ.js} +3 -3
- package/dist/dev/index.css +85 -43
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +2939 -2010
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/locales/{en-IZ5JJCQN.js → en-XVKSJYG2.js} +4 -2
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/chunk-5EYFVTC7.js +34 -0
- package/dist/prod/{chunk-MYTKOPOQ.js → chunk-T6UH5ZKV.js} +5 -5
- package/dist/prod/{chunk-B47HEJUH.js → chunk-Y6NXDCR7.js} +1 -1
- package/dist/prod/components/TTDDialog/{CodeMirrorEditor-B64TEOC3.js → CodeMirrorEditor-JV2LT6ZS.js} +1 -1
- package/dist/prod/data/image-XRO5552B.js +1 -0
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +28 -28
- package/dist/prod/locales/en-BNQNBQ43.js +1 -0
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/common/src/appEventBus.d.ts +27 -0
- package/dist/types/common/src/index.d.ts +2 -0
- package/dist/types/common/src/utils.d.ts +1 -3
- package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
- package/dist/types/element/src/Scene.d.ts +5 -3
- package/dist/types/element/src/bounds.d.ts +4 -2
- package/dist/types/element/src/duplicate.d.ts +1 -0
- package/dist/types/element/src/frame.d.ts +7 -6
- package/dist/types/element/src/linearElementEditor.d.ts +2 -2
- package/dist/types/element/src/selection.d.ts +2 -2
- package/dist/types/element/src/shape.d.ts +1 -1
- package/dist/types/element/src/typeChecks.d.ts +1 -0
- package/dist/types/element/src/utils.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +8 -8
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +30 -30
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +9 -9
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +160 -0
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionExport.d.ts +48 -323
- package/dist/types/excalidraw/actions/actionFrame.d.ts +12 -12
- package/dist/types/excalidraw/actions/actionGroup.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionLink.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionMenu.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionProperties.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionStyles.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +3 -3
- package/dist/types/excalidraw/actions/index.d.ts +1 -0
- package/dist/types/excalidraw/actions/types.d.ts +1 -1
- package/dist/types/excalidraw/appState.d.ts +1 -0
- package/dist/types/excalidraw/clipboard.d.ts +2 -3
- package/dist/types/excalidraw/components/App.d.ts +41 -10
- package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +1 -1
- package/dist/types/excalidraw/components/Toast.d.ts +8 -4
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +1 -1
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +1 -0
- package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -1
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +1 -0
- package/dist/types/excalidraw/components/shapes.d.ts +7 -0
- package/dist/types/excalidraw/data/blob.d.ts +13 -14
- package/dist/types/excalidraw/data/filesystem.d.ts +3 -5
- package/dist/types/excalidraw/data/index.d.ts +2 -3
- package/dist/types/excalidraw/data/json.d.ts +21 -13
- package/dist/types/excalidraw/data/resave.d.ts +7 -2
- package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
- package/dist/types/excalidraw/index.d.ts +23 -3
- package/dist/types/excalidraw/scene/Renderer.d.ts +425 -19
- package/dist/types/excalidraw/types.d.ts +76 -5
- package/dist/types/fractional-indexing/src/index.d.ts +29 -0
- package/dist/types/math/src/constants.d.ts +0 -1
- package/dist/types/math/src/curve.d.ts +4 -1
- package/package.json +4 -5
- package/dist/dev/chunk-UPL5GSGP.js.map +0 -7
- package/dist/dev/chunk-VLJRILK3.js.map +0 -7
- package/dist/prod/chunk-ZTGTHG3M.js +0 -34
- package/dist/prod/data/image-I4FBW6ZT.js +0 -1
- package/dist/prod/locales/en-4R6EP6SP.js +0 -1
- package/dist/types/utils/src/index.d.ts +0 -4
- /package/dist/dev/{chunk-H5SL5I5R.js.map → chunk-UEBEBUE2.js.map} +0 -0
- /package/dist/dev/components/TTDDialog/{CodeMirrorEditor-65RQRK4A.js.map → CodeMirrorEditor-2YIEAZU7.js.map} +0 -0
- /package/dist/dev/data/{image-JR54FB4B.js.map → image-O7OJXMIJ.js.map} +0 -0
- /package/dist/dev/locales/{en-IZ5JJCQN.js.map → en-XVKSJYG2.js.map} +0 -0
|
@@ -1,30 +1,436 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
2
2
|
import type { Scene } from "@excalidraw/element";
|
|
3
3
|
import type { RenderableElementsMap } from "./types";
|
|
4
4
|
import type { AppState } from "../types";
|
|
5
|
+
type GetRenderableElementsOpts = {
|
|
6
|
+
zoom: AppState["zoom"];
|
|
7
|
+
offsetLeft: AppState["offsetLeft"];
|
|
8
|
+
offsetTop: AppState["offsetTop"];
|
|
9
|
+
scrollX: AppState["scrollX"];
|
|
10
|
+
scrollY: AppState["scrollY"];
|
|
11
|
+
height: AppState["height"];
|
|
12
|
+
width: AppState["width"];
|
|
13
|
+
editingTextElement: AppState["editingTextElement"];
|
|
14
|
+
newElement: AppState["newElement"];
|
|
15
|
+
selectedElements: readonly NonDeletedExcalidrawElement[];
|
|
16
|
+
selectedElementsAreBeingDragged: AppState["selectedElementsAreBeingDragged"];
|
|
17
|
+
frameToHighlight: AppState["frameToHighlight"];
|
|
18
|
+
};
|
|
5
19
|
export declare class Renderer {
|
|
6
20
|
private scene;
|
|
7
21
|
constructor(scene: Scene);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
offsetTop: AppState["offsetTop"];
|
|
14
|
-
scrollX: AppState["scrollX"];
|
|
15
|
-
scrollY: AppState["scrollY"];
|
|
16
|
-
height: AppState["height"];
|
|
17
|
-
width: AppState["width"];
|
|
18
|
-
editingTextElement: AppState["editingTextElement"];
|
|
19
|
-
/** note: first render of newElement will always bust the cache
|
|
20
|
-
* (we'd have to prefilter elements outside of this function) */
|
|
21
|
-
newElementId: ExcalidrawElement["id"] | undefined;
|
|
22
|
-
sceneNonce: ReturnType<InstanceType<typeof Scene>["getSceneNonce"]>;
|
|
23
|
-
}) => {
|
|
22
|
+
private getVisibleCanvasElements;
|
|
23
|
+
private getRenderableElementsMap;
|
|
24
|
+
private sortSelectedElementsIntoHighlightedFrame;
|
|
25
|
+
private _getRenderableElements;
|
|
26
|
+
getRenderableElements: (opts: GetRenderableElementsOpts) => {
|
|
24
27
|
elementsMap: RenderableElementsMap;
|
|
25
28
|
visibleElements: readonly NonDeletedExcalidrawElement[];
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
newElementCanvasElement: (Readonly<{
|
|
30
|
+
id: string;
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
strokeColor: string;
|
|
34
|
+
backgroundColor: string;
|
|
35
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
36
|
+
strokeWidth: number;
|
|
37
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
38
|
+
roundness: null | {
|
|
39
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
40
|
+
value?: number;
|
|
41
|
+
};
|
|
42
|
+
roughness: number;
|
|
43
|
+
opacity: number;
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
angle: import("@excalidraw/math").Radians;
|
|
47
|
+
seed: number;
|
|
48
|
+
version: number;
|
|
49
|
+
versionNonce: number;
|
|
50
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
51
|
+
isDeleted: boolean;
|
|
52
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
53
|
+
frameId: string | null;
|
|
54
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
55
|
+
updated: number;
|
|
56
|
+
link: string | null;
|
|
57
|
+
locked: boolean;
|
|
58
|
+
customData?: Record<string, any>;
|
|
59
|
+
}> & Readonly<{
|
|
60
|
+
type: "line" | "arrow";
|
|
61
|
+
points: readonly import("@excalidraw/math").LocalPoint[];
|
|
62
|
+
startBinding: import("@excalidraw/element/types").FixedPointBinding | null;
|
|
63
|
+
endBinding: import("@excalidraw/element/types").FixedPointBinding | null;
|
|
64
|
+
startArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
65
|
+
endArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
66
|
+
}> & {
|
|
67
|
+
isDeleted: boolean;
|
|
68
|
+
}) | (Readonly<{
|
|
69
|
+
id: string;
|
|
70
|
+
x: number;
|
|
71
|
+
y: number;
|
|
72
|
+
strokeColor: string;
|
|
73
|
+
backgroundColor: string;
|
|
74
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
75
|
+
strokeWidth: number;
|
|
76
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
77
|
+
roundness: null | {
|
|
78
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
79
|
+
value?: number;
|
|
80
|
+
};
|
|
81
|
+
roughness: number;
|
|
82
|
+
opacity: number;
|
|
83
|
+
width: number;
|
|
84
|
+
height: number;
|
|
85
|
+
angle: import("@excalidraw/math").Radians;
|
|
86
|
+
seed: number;
|
|
87
|
+
version: number;
|
|
88
|
+
versionNonce: number;
|
|
89
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
90
|
+
isDeleted: boolean;
|
|
91
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
92
|
+
frameId: string | null;
|
|
93
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
94
|
+
updated: number;
|
|
95
|
+
link: string | null;
|
|
96
|
+
locked: boolean;
|
|
97
|
+
customData?: Record<string, any>;
|
|
98
|
+
}> & {
|
|
99
|
+
type: "rectangle";
|
|
100
|
+
} & {
|
|
101
|
+
isDeleted: boolean;
|
|
102
|
+
}) | (Readonly<{
|
|
103
|
+
id: string;
|
|
104
|
+
x: number;
|
|
105
|
+
y: number;
|
|
106
|
+
strokeColor: string;
|
|
107
|
+
backgroundColor: string;
|
|
108
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
109
|
+
strokeWidth: number;
|
|
110
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
111
|
+
roundness: null | {
|
|
112
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
113
|
+
value?: number;
|
|
114
|
+
};
|
|
115
|
+
roughness: number;
|
|
116
|
+
opacity: number;
|
|
117
|
+
width: number;
|
|
118
|
+
height: number;
|
|
119
|
+
angle: import("@excalidraw/math").Radians;
|
|
120
|
+
seed: number;
|
|
121
|
+
version: number;
|
|
122
|
+
versionNonce: number;
|
|
123
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
124
|
+
isDeleted: boolean;
|
|
125
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
126
|
+
frameId: string | null;
|
|
127
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
128
|
+
updated: number;
|
|
129
|
+
link: string | null;
|
|
130
|
+
locked: boolean;
|
|
131
|
+
customData?: Record<string, any>;
|
|
132
|
+
}> & {
|
|
133
|
+
type: "diamond";
|
|
134
|
+
} & {
|
|
135
|
+
isDeleted: boolean;
|
|
136
|
+
}) | (Readonly<{
|
|
137
|
+
id: string;
|
|
138
|
+
x: number;
|
|
139
|
+
y: number;
|
|
140
|
+
strokeColor: string;
|
|
141
|
+
backgroundColor: string;
|
|
142
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
143
|
+
strokeWidth: number;
|
|
144
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
145
|
+
roundness: null | {
|
|
146
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
147
|
+
value?: number;
|
|
148
|
+
};
|
|
149
|
+
roughness: number;
|
|
150
|
+
opacity: number;
|
|
151
|
+
width: number;
|
|
152
|
+
height: number;
|
|
153
|
+
angle: import("@excalidraw/math").Radians;
|
|
154
|
+
seed: number;
|
|
155
|
+
version: number;
|
|
156
|
+
versionNonce: number;
|
|
157
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
158
|
+
isDeleted: boolean;
|
|
159
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
160
|
+
frameId: string | null;
|
|
161
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
162
|
+
updated: number;
|
|
163
|
+
link: string | null;
|
|
164
|
+
locked: boolean;
|
|
165
|
+
customData?: Record<string, any>;
|
|
166
|
+
}> & {
|
|
167
|
+
type: "ellipse";
|
|
168
|
+
} & {
|
|
169
|
+
isDeleted: boolean;
|
|
170
|
+
}) | (Readonly<{
|
|
171
|
+
id: string;
|
|
172
|
+
x: number;
|
|
173
|
+
y: number;
|
|
174
|
+
strokeColor: string;
|
|
175
|
+
backgroundColor: string;
|
|
176
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
177
|
+
strokeWidth: number;
|
|
178
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
179
|
+
roundness: null | {
|
|
180
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
181
|
+
value?: number;
|
|
182
|
+
};
|
|
183
|
+
roughness: number;
|
|
184
|
+
opacity: number;
|
|
185
|
+
width: number;
|
|
186
|
+
height: number;
|
|
187
|
+
angle: import("@excalidraw/math").Radians;
|
|
188
|
+
seed: number;
|
|
189
|
+
version: number;
|
|
190
|
+
versionNonce: number;
|
|
191
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
192
|
+
isDeleted: boolean;
|
|
193
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
194
|
+
frameId: string | null;
|
|
195
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
196
|
+
updated: number;
|
|
197
|
+
link: string | null;
|
|
198
|
+
locked: boolean;
|
|
199
|
+
customData?: Record<string, any>;
|
|
200
|
+
}> & Readonly<{
|
|
201
|
+
type: "embeddable";
|
|
202
|
+
}> & {
|
|
203
|
+
isDeleted: boolean;
|
|
204
|
+
}) | (Readonly<{
|
|
205
|
+
id: string;
|
|
206
|
+
x: number;
|
|
207
|
+
y: number;
|
|
208
|
+
strokeColor: string;
|
|
209
|
+
backgroundColor: string;
|
|
210
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
211
|
+
strokeWidth: number;
|
|
212
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
213
|
+
roundness: null | {
|
|
214
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
215
|
+
value?: number;
|
|
216
|
+
};
|
|
217
|
+
roughness: number;
|
|
218
|
+
opacity: number;
|
|
219
|
+
width: number;
|
|
220
|
+
height: number;
|
|
221
|
+
angle: import("@excalidraw/math").Radians;
|
|
222
|
+
seed: number;
|
|
223
|
+
version: number;
|
|
224
|
+
versionNonce: number;
|
|
225
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
226
|
+
isDeleted: boolean;
|
|
227
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
228
|
+
frameId: string | null;
|
|
229
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
230
|
+
updated: number;
|
|
231
|
+
link: string | null;
|
|
232
|
+
locked: boolean;
|
|
233
|
+
customData?: Record<string, any>;
|
|
234
|
+
}> & Readonly<{
|
|
235
|
+
type: "iframe";
|
|
236
|
+
customData?: {
|
|
237
|
+
generationData?: import("@excalidraw/element/types").MagicGenerationData;
|
|
238
|
+
};
|
|
239
|
+
}> & {
|
|
240
|
+
isDeleted: boolean;
|
|
241
|
+
}) | (Readonly<{
|
|
242
|
+
id: string;
|
|
243
|
+
x: number;
|
|
244
|
+
y: number;
|
|
245
|
+
strokeColor: string;
|
|
246
|
+
backgroundColor: string;
|
|
247
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
248
|
+
strokeWidth: number;
|
|
249
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
250
|
+
roundness: null | {
|
|
251
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
252
|
+
value?: number;
|
|
253
|
+
};
|
|
254
|
+
roughness: number;
|
|
255
|
+
opacity: number;
|
|
256
|
+
width: number;
|
|
257
|
+
height: number;
|
|
258
|
+
angle: import("@excalidraw/math").Radians;
|
|
259
|
+
seed: number;
|
|
260
|
+
version: number;
|
|
261
|
+
versionNonce: number;
|
|
262
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
263
|
+
isDeleted: boolean;
|
|
264
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
265
|
+
frameId: string | null;
|
|
266
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
267
|
+
updated: number;
|
|
268
|
+
link: string | null;
|
|
269
|
+
locked: boolean;
|
|
270
|
+
customData?: Record<string, any>;
|
|
271
|
+
}> & Readonly<{
|
|
272
|
+
type: "image";
|
|
273
|
+
fileId: import("@excalidraw/element/types").FileId | null;
|
|
274
|
+
status: "pending" | "saved" | "error";
|
|
275
|
+
scale: [number, number];
|
|
276
|
+
crop: import("@excalidraw/element/types").ImageCrop | null;
|
|
277
|
+
}> & {
|
|
278
|
+
isDeleted: boolean;
|
|
279
|
+
}) | (Readonly<{
|
|
280
|
+
id: string;
|
|
281
|
+
x: number;
|
|
282
|
+
y: number;
|
|
283
|
+
strokeColor: string;
|
|
284
|
+
backgroundColor: string;
|
|
285
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
286
|
+
strokeWidth: number;
|
|
287
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
288
|
+
roundness: null | {
|
|
289
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
290
|
+
value?: number;
|
|
291
|
+
};
|
|
292
|
+
roughness: number;
|
|
293
|
+
opacity: number;
|
|
294
|
+
width: number;
|
|
295
|
+
height: number;
|
|
296
|
+
angle: import("@excalidraw/math").Radians;
|
|
297
|
+
seed: number;
|
|
298
|
+
version: number;
|
|
299
|
+
versionNonce: number;
|
|
300
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
301
|
+
isDeleted: boolean;
|
|
302
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
303
|
+
frameId: string | null;
|
|
304
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
305
|
+
updated: number;
|
|
306
|
+
link: string | null;
|
|
307
|
+
locked: boolean;
|
|
308
|
+
customData?: Record<string, any>;
|
|
309
|
+
}> & {
|
|
310
|
+
type: "frame";
|
|
311
|
+
name: string | null;
|
|
312
|
+
} & {
|
|
313
|
+
isDeleted: boolean;
|
|
314
|
+
}) | (Readonly<{
|
|
315
|
+
id: string;
|
|
316
|
+
x: number;
|
|
317
|
+
y: number;
|
|
318
|
+
strokeColor: string;
|
|
319
|
+
backgroundColor: string;
|
|
320
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
321
|
+
strokeWidth: number;
|
|
322
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
323
|
+
roundness: null | {
|
|
324
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
325
|
+
value?: number;
|
|
326
|
+
};
|
|
327
|
+
roughness: number;
|
|
328
|
+
opacity: number;
|
|
329
|
+
width: number;
|
|
330
|
+
height: number;
|
|
331
|
+
angle: import("@excalidraw/math").Radians;
|
|
332
|
+
seed: number;
|
|
333
|
+
version: number;
|
|
334
|
+
versionNonce: number;
|
|
335
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
336
|
+
isDeleted: boolean;
|
|
337
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
338
|
+
frameId: string | null;
|
|
339
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
340
|
+
updated: number;
|
|
341
|
+
link: string | null;
|
|
342
|
+
locked: boolean;
|
|
343
|
+
customData?: Record<string, any>;
|
|
344
|
+
}> & {
|
|
345
|
+
type: "magicframe";
|
|
346
|
+
name: string | null;
|
|
347
|
+
} & {
|
|
348
|
+
isDeleted: boolean;
|
|
349
|
+
}) | (Readonly<{
|
|
350
|
+
id: string;
|
|
351
|
+
x: number;
|
|
352
|
+
y: number;
|
|
353
|
+
strokeColor: string;
|
|
354
|
+
backgroundColor: string;
|
|
355
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
356
|
+
strokeWidth: number;
|
|
357
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
358
|
+
roundness: null | {
|
|
359
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
360
|
+
value?: number;
|
|
361
|
+
};
|
|
362
|
+
roughness: number;
|
|
363
|
+
opacity: number;
|
|
364
|
+
width: number;
|
|
365
|
+
height: number;
|
|
366
|
+
angle: import("@excalidraw/math").Radians;
|
|
367
|
+
seed: number;
|
|
368
|
+
version: number;
|
|
369
|
+
versionNonce: number;
|
|
370
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
371
|
+
isDeleted: boolean;
|
|
372
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
373
|
+
frameId: string | null;
|
|
374
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
375
|
+
updated: number;
|
|
376
|
+
link: string | null;
|
|
377
|
+
locked: boolean;
|
|
378
|
+
customData?: Record<string, any>;
|
|
379
|
+
}> & Readonly<{
|
|
380
|
+
type: "text";
|
|
381
|
+
fontSize: number;
|
|
382
|
+
fontFamily: import("@excalidraw/element/types").FontFamilyValues;
|
|
383
|
+
text: string;
|
|
384
|
+
textAlign: import("@excalidraw/element/types").TextAlign;
|
|
385
|
+
verticalAlign: import("@excalidraw/element/types").VerticalAlign;
|
|
386
|
+
containerId: import("@excalidraw/element/types").ExcalidrawGenericElement["id"] | null;
|
|
387
|
+
originalText: string;
|
|
388
|
+
autoResize: boolean;
|
|
389
|
+
lineHeight: number & {
|
|
390
|
+
_brand: "unitlessLineHeight";
|
|
391
|
+
};
|
|
392
|
+
}> & {
|
|
393
|
+
isDeleted: boolean;
|
|
394
|
+
}) | (Readonly<{
|
|
395
|
+
id: string;
|
|
396
|
+
x: number;
|
|
397
|
+
y: number;
|
|
398
|
+
strokeColor: string;
|
|
399
|
+
backgroundColor: string;
|
|
400
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
401
|
+
strokeWidth: number;
|
|
402
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
403
|
+
roundness: null | {
|
|
404
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
405
|
+
value?: number;
|
|
406
|
+
};
|
|
407
|
+
roughness: number;
|
|
408
|
+
opacity: number;
|
|
409
|
+
width: number;
|
|
410
|
+
height: number;
|
|
411
|
+
angle: import("@excalidraw/math").Radians;
|
|
412
|
+
seed: number;
|
|
413
|
+
version: number;
|
|
414
|
+
versionNonce: number;
|
|
415
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
416
|
+
isDeleted: boolean;
|
|
417
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
418
|
+
frameId: string | null;
|
|
419
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
420
|
+
updated: number;
|
|
421
|
+
link: string | null;
|
|
422
|
+
locked: boolean;
|
|
423
|
+
customData?: Record<string, any>;
|
|
424
|
+
}> & Readonly<{
|
|
425
|
+
type: "freedraw";
|
|
426
|
+
points: readonly import("@excalidraw/math").LocalPoint[];
|
|
427
|
+
pressures: readonly number[];
|
|
428
|
+
simulatePressure: boolean;
|
|
429
|
+
}> & {
|
|
430
|
+
isDeleted: boolean;
|
|
431
|
+
}) | null;
|
|
432
|
+
canvasNonce: string;
|
|
28
433
|
};
|
|
29
434
|
destroy(): void;
|
|
30
435
|
}
|
|
436
|
+
export {};
|
|
@@ -10,7 +10,6 @@ import type { Spreadsheet } from "./charts";
|
|
|
10
10
|
import type { ClipboardData } from "./clipboard";
|
|
11
11
|
import type App from "./components/App";
|
|
12
12
|
import type Library from "./data/library";
|
|
13
|
-
import type { FileSystemHandle } from "./data/filesystem";
|
|
14
13
|
import type { ContextMenuItems } from "./components/ContextMenu";
|
|
15
14
|
import type { SnapLine } from "./snapping";
|
|
16
15
|
import type { ImportedDataState } from "./data/types";
|
|
@@ -171,6 +170,7 @@ export type ObservedElementsAppState = {
|
|
|
171
170
|
lockedMultiSelections: AppState["lockedMultiSelections"];
|
|
172
171
|
activeLockedId: AppState["activeLockedId"];
|
|
173
172
|
};
|
|
173
|
+
export type BoxSelectionMode = "contain" | "overlap";
|
|
174
174
|
export interface AppState {
|
|
175
175
|
contextMenu: {
|
|
176
176
|
items: ContextMenuItems;
|
|
@@ -209,11 +209,16 @@ export interface AppState {
|
|
|
209
209
|
* `bindingPreference` and keyboard modifiers (ctrl/alt)
|
|
210
210
|
*/
|
|
211
211
|
isBindingEnabled: boolean;
|
|
212
|
+
/** user box selection preference; defaults to "contain" when unset */
|
|
213
|
+
boxSelectionMode: BoxSelectionMode;
|
|
212
214
|
/** user arrow binding preference */
|
|
213
215
|
bindingPreference: "enabled" | "disabled";
|
|
214
216
|
/** user preference whether arrow snap to midpoints while binding */
|
|
215
217
|
isMidpointSnappingEnabled: boolean;
|
|
216
|
-
|
|
218
|
+
/**
|
|
219
|
+
* The bindable element the UI highlights for the user when an arrow is
|
|
220
|
+
* dragged or otherwise its endpoint being close to said element.
|
|
221
|
+
*/
|
|
217
222
|
suggestedBinding: {
|
|
218
223
|
element: NonDeleted<ExcalidrawBindableElement>;
|
|
219
224
|
midPoint?: GlobalPoint;
|
|
@@ -318,7 +323,7 @@ export interface AppState {
|
|
|
318
323
|
selectedElementsAreBeingDragged: boolean;
|
|
319
324
|
shouldCacheIgnoreZoom: boolean;
|
|
320
325
|
toast: {
|
|
321
|
-
message:
|
|
326
|
+
message: React.ReactNode;
|
|
322
327
|
closable?: boolean;
|
|
323
328
|
duration?: number;
|
|
324
329
|
} | null;
|
|
@@ -340,7 +345,7 @@ export interface AppState {
|
|
|
340
345
|
height: number;
|
|
341
346
|
offsetTop: number;
|
|
342
347
|
offsetLeft: number;
|
|
343
|
-
fileHandle:
|
|
348
|
+
fileHandle: FileSystemFileHandle | null;
|
|
344
349
|
collaborators: Map<SocketId, Collaborator>;
|
|
345
350
|
stats: {
|
|
346
351
|
open: boolean;
|
|
@@ -386,7 +391,7 @@ export type SearchMatch = {
|
|
|
386
391
|
showOnCanvas: boolean;
|
|
387
392
|
}[];
|
|
388
393
|
};
|
|
389
|
-
export type UIAppState = Omit<AppState, "
|
|
394
|
+
export type UIAppState = Omit<AppState, "cursorButton" | "scrollX" | "scrollY">;
|
|
390
395
|
export type NormalizedZoomValue = number & {
|
|
391
396
|
_brand: "normalizedZoom";
|
|
392
397
|
};
|
|
@@ -436,12 +441,38 @@ export type OnUserFollowedPayload = {
|
|
|
436
441
|
userToFollow: UserToFollow;
|
|
437
442
|
action: "FOLLOW" | "UNFOLLOW";
|
|
438
443
|
};
|
|
444
|
+
export type OnExportProgress = {
|
|
445
|
+
type: "progress";
|
|
446
|
+
message?: React.ReactNode;
|
|
447
|
+
/** 0-1 range */
|
|
448
|
+
progress?: number;
|
|
449
|
+
};
|
|
439
450
|
export interface ExcalidrawProps {
|
|
440
451
|
id?: string | null;
|
|
441
452
|
className?: string;
|
|
442
453
|
onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles, id?: string | null) => void;
|
|
454
|
+
/**
|
|
455
|
+
* note: only subscribes if the props.onIncrement is defined on initial render
|
|
456
|
+
*/
|
|
443
457
|
onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
|
|
444
458
|
initialData?: (() => MaybePromise<ExcalidrawInitialDataState | null>) | MaybePromise<ExcalidrawInitialDataState | null>;
|
|
459
|
+
/**
|
|
460
|
+
* Invoked as soon as the Excalidraw API is available
|
|
461
|
+
* NOTE editor is not yet mounted, and state is not yet initialized
|
|
462
|
+
*/
|
|
463
|
+
onExcalidrawAPI?: (api: ExcalidrawImperativeAPI | null) => void;
|
|
464
|
+
/**
|
|
465
|
+
* Invoked once the editor root is mounted.
|
|
466
|
+
*/
|
|
467
|
+
onMount?: (payload: ExcalidrawMountPayload) => void;
|
|
468
|
+
/**
|
|
469
|
+
* Invoked when the editor root is unmounted.
|
|
470
|
+
*/
|
|
471
|
+
onUnmount?: () => void;
|
|
472
|
+
/**
|
|
473
|
+
* Invoked once the initial scene is loaded.
|
|
474
|
+
*/
|
|
475
|
+
onInitialize?: (api: ExcalidrawImperativeAPI) => void;
|
|
445
476
|
excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
|
|
446
477
|
user?: {
|
|
447
478
|
name?: string | null;
|
|
@@ -503,6 +534,29 @@ export interface ExcalidrawProps {
|
|
|
503
534
|
aiEnabled?: boolean;
|
|
504
535
|
showDeprecatedFonts?: boolean;
|
|
505
536
|
renderScrollbars?: boolean;
|
|
537
|
+
/**
|
|
538
|
+
* Called before exporting to a file.
|
|
539
|
+
*
|
|
540
|
+
* Allows the host app to intercept and delay saving until async operations
|
|
541
|
+
* (e.g., images are loaded) complete.
|
|
542
|
+
*
|
|
543
|
+
* If Promise/AsyncGenerator is returned, a progress toast will be shown
|
|
544
|
+
* until the operation completes. Generator can yield progress updates.
|
|
545
|
+
*/
|
|
546
|
+
onExport?: (
|
|
547
|
+
/** type of export. Currently we only call for JSON exports or
|
|
548
|
+
* JSON-embedded PNG (which is also identified as `json` type here)*/
|
|
549
|
+
type: "json", data: {
|
|
550
|
+
elements: readonly ExcalidrawElement[];
|
|
551
|
+
appState: AppState;
|
|
552
|
+
files: BinaryFiles;
|
|
553
|
+
}, options: {
|
|
554
|
+
/** signal that gets aborted if user cancels the export (e.g. closes
|
|
555
|
+
* the native file picker dialog). In that case, you can either
|
|
556
|
+
* return immediately, or throw AbortError.
|
|
557
|
+
*/
|
|
558
|
+
signal: AbortSignal;
|
|
559
|
+
}) => MaybePromise<void> | AsyncGenerator<OnExportProgress, void>;
|
|
506
560
|
interactive?: boolean;
|
|
507
561
|
ui?: boolean;
|
|
508
562
|
activeTool?: {
|
|
@@ -563,6 +617,7 @@ export type AppProps = Merge<ExcalidrawProps, {
|
|
|
563
617
|
export type AppClassProperties = {
|
|
564
618
|
props: AppProps;
|
|
565
619
|
state: AppState;
|
|
620
|
+
api: App["api"];
|
|
566
621
|
setSessionExportThemeOverride: App["setSessionExportThemeOverride"];
|
|
567
622
|
interactiveCanvas: HTMLCanvasElement | null;
|
|
568
623
|
/** static canvas */
|
|
@@ -604,8 +659,11 @@ export type AppClassProperties = {
|
|
|
604
659
|
onPointerUpEmitter: App["onPointerUpEmitter"];
|
|
605
660
|
updateEditorAtom: App["updateEditorAtom"];
|
|
606
661
|
onPointerDownEmitter: App["onPointerDownEmitter"];
|
|
662
|
+
onEvent: App["onEvent"];
|
|
663
|
+
onStateChange: App["onStateChange"];
|
|
607
664
|
lastPointerMoveCoords: App["lastPointerMoveCoords"];
|
|
608
665
|
bindModeHandler: App["bindModeHandler"];
|
|
666
|
+
setAppState: App["setAppState"];
|
|
609
667
|
};
|
|
610
668
|
export type PointerDownState = Readonly<{
|
|
611
669
|
origin: Readonly<{
|
|
@@ -666,7 +724,18 @@ export type PointerDownState = Readonly<{
|
|
|
666
724
|
};
|
|
667
725
|
}>;
|
|
668
726
|
export type UnsubscribeCallback = () => void;
|
|
727
|
+
export type ExcalidrawMountPayload = {
|
|
728
|
+
excalidrawAPI: ExcalidrawImperativeAPI;
|
|
729
|
+
container: HTMLDivElement | null;
|
|
730
|
+
};
|
|
731
|
+
export type ExcalidrawImperativeAPIEventMap = {
|
|
732
|
+
"editor:mount": [payload: ExcalidrawMountPayload];
|
|
733
|
+
"editor:initialize": [api: ExcalidrawImperativeAPI];
|
|
734
|
+
"editor:unmount": [];
|
|
735
|
+
};
|
|
669
736
|
export interface ExcalidrawImperativeAPI {
|
|
737
|
+
/** Whether the editor has been unmounted and the API is no longer usable. */
|
|
738
|
+
isDestroyed: boolean;
|
|
670
739
|
updateScene: InstanceType<typeof App>["updateScene"];
|
|
671
740
|
applyDeltas: InstanceType<typeof App>["applyDeltas"];
|
|
672
741
|
mutateElement: InstanceType<typeof App>["mutateElement"];
|
|
@@ -705,6 +774,8 @@ export interface ExcalidrawImperativeAPI {
|
|
|
705
774
|
onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
|
|
706
775
|
onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
|
|
707
776
|
onUserFollow: (callback: (payload: OnUserFollowedPayload) => void) => UnsubscribeCallback;
|
|
777
|
+
onStateChange: InstanceType<typeof App>["onStateChange"];
|
|
778
|
+
onEvent: InstanceType<typeof App>["onEvent"];
|
|
708
779
|
setScrollConstraints: InstanceType<typeof App>["setScrollConstraints"];
|
|
709
780
|
}
|
|
710
781
|
export type FrameNameBounds = {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const BASE_62_DIGITS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
2
|
+
/**
|
|
3
|
+
* @param {string} key
|
|
4
|
+
* @param {string} digits
|
|
5
|
+
* @return {void}
|
|
6
|
+
*/
|
|
7
|
+
export declare function validateOrderKey(key: string, digits?: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* @param {string | null | undefined} a
|
|
10
|
+
* @param {string | null | undefined} b
|
|
11
|
+
* @param {string=} digits
|
|
12
|
+
* @return {string}
|
|
13
|
+
*/
|
|
14
|
+
export declare function generateKeyBetween(a: string | null | undefined, b: string | null | undefined, digits?: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* same preconditions as generateKeysBetween.
|
|
17
|
+
* n >= 0.
|
|
18
|
+
* Returns an array of n distinct keys in sorted order.
|
|
19
|
+
* If a and b are both null, returns [a0, a1, ...]
|
|
20
|
+
* If one or the other is null, returns consecutive "integer"
|
|
21
|
+
* keys. Otherwise, returns relatively short keys between
|
|
22
|
+
* a and b.
|
|
23
|
+
* @param {string | null | undefined} a
|
|
24
|
+
* @param {string | null | undefined} b
|
|
25
|
+
* @param {number} n
|
|
26
|
+
* @param {string} digits
|
|
27
|
+
* @return {string[]}
|
|
28
|
+
*/
|
|
29
|
+
export declare function generateNKeysBetween(a: string | null | undefined, b: string | null | undefined, n: number, digits?: string): string[];
|
|
@@ -12,7 +12,10 @@ export declare const bezierEquation: <Point extends GlobalPoint | LocalPoint>(c:
|
|
|
12
12
|
/**
|
|
13
13
|
* Computes the intersection between a cubic spline and a line segment.
|
|
14
14
|
*/
|
|
15
|
-
export declare function curveIntersectLineSegment<Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, l: LineSegment<Point
|
|
15
|
+
export declare function curveIntersectLineSegment<Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, l: LineSegment<Point>, opts?: {
|
|
16
|
+
tolerance?: number;
|
|
17
|
+
iterLimit?: number;
|
|
18
|
+
}): Point[];
|
|
16
19
|
/**
|
|
17
20
|
* Finds the closest point on the Bezier curve from another point
|
|
18
21
|
*
|