@excalidraw/element 0.18.0-abeeaeb → 0.18.0-afa3a65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/index.js +4889 -3737
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +12 -12
- package/dist/types/common/src/colors.d.ts +8 -0
- package/dist/types/common/src/constants.d.ts +44 -0
- package/dist/types/common/src/keys.d.ts +2 -0
- package/dist/types/common/src/random.d.ts +7 -0
- package/dist/types/element/src/Scene.d.ts +1 -1
- package/dist/types/element/src/comparisons.d.ts +5 -3
- package/dist/types/element/src/delta.d.ts +23 -1
- package/dist/types/element/src/flowchart.d.ts +5 -1
- package/dist/types/element/src/frame.d.ts +2 -2
- package/dist/types/element/src/index.d.ts +1 -0
- package/dist/types/element/src/linearElementEditor.d.ts +10 -0
- package/dist/types/element/src/mutateElement.d.ts +1 -1
- package/dist/types/element/src/newElement.d.ts +24 -2
- package/dist/types/element/src/sizeHelpers.d.ts +6 -0
- package/dist/types/element/src/stickyNote.d.ts +183 -0
- package/dist/types/element/src/textElement.d.ts +2 -1
- package/dist/types/element/src/transform.d.ts +25 -6
- package/dist/types/element/src/typeChecks.d.ts +3 -2
- package/dist/types/element/src/types.d.ts +35 -6
- package/dist/types/element/src/utils.d.ts +7 -3
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +12 -0
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +8 -0
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +28 -0
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +8 -0
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +4 -0
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +13 -1
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +4 -0
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +4 -0
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +8 -0
- package/dist/types/excalidraw/actions/actionExport.d.ts +8 -0
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionFrame.d.ts +63 -1
- package/dist/types/excalidraw/actions/actionGroup.d.ts +8 -0
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +55 -1
- package/dist/types/excalidraw/actions/actionLink.d.ts +4 -0
- package/dist/types/excalidraw/actions/actionMenu.d.ts +4 -0
- package/dist/types/excalidraw/actions/actionProperties.d.ts +18 -6
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +4 -0
- package/dist/types/excalidraw/actions/actionStyles.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +4 -0
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +4 -0
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +4 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +4 -0
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +4 -0
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +4 -0
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +4 -0
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +4 -0
- package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
- package/dist/types/excalidraw/appState.d.ts +4 -0
- package/dist/types/excalidraw/components/App.arrowText.d.ts +40 -8
- package/dist/types/excalidraw/components/App.cursor.d.ts +8 -0
- package/dist/types/excalidraw/components/App.d.ts +92 -6
- package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
- package/dist/types/excalidraw/components/IconButton.d.ts +2 -0
- package/dist/types/excalidraw/components/Tools.d.ts +7 -2
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +2 -0
- package/dist/types/excalidraw/components/icons.d.ts +1 -0
- package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +2 -2
- package/dist/types/excalidraw/data/blob.d.ts +8 -0
- package/dist/types/excalidraw/data/json.d.ts +4 -0
- package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -2
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
- package/dist/types/excalidraw/renderer/helpers.d.ts +25 -0
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
- package/dist/types/excalidraw/scene/Renderer.d.ts +50 -1
- package/dist/types/excalidraw/scene/index.d.ts +1 -1
- package/dist/types/excalidraw/scene/types.d.ts +1 -0
- package/dist/types/excalidraw/types.d.ts +30 -2
- package/dist/types/excalidraw/viewport.d.ts +4 -0
- package/dist/types/math/src/curve.d.ts +19 -12
- package/dist/types/math/src/segment.d.ts +6 -0
- package/dist/types/utils/src/export.d.ts +1 -0
- package/dist/types/utils/src/shape.d.ts +2 -2
- package/package.json +4 -4
|
@@ -15,7 +15,8 @@ export declare class Fonts {
|
|
|
15
15
|
fontFaces: ExcalidrawFontFace[];
|
|
16
16
|
}>;
|
|
17
17
|
private readonly scene;
|
|
18
|
-
|
|
18
|
+
private readonly ownerDocument;
|
|
19
|
+
constructor(scene: Scene, ownerDocument?: Document);
|
|
19
20
|
/**
|
|
20
21
|
* Get all the font families for the given scene.
|
|
21
22
|
*/
|
|
@@ -36,7 +37,7 @@ export declare class Fonts {
|
|
|
36
37
|
/**
|
|
37
38
|
* Load font faces for passed elements - use when the scene is unavailable (i.e. export).
|
|
38
39
|
*/
|
|
39
|
-
static loadElementsFonts: (elements: readonly ExcalidrawElement[]) => Promise<FontFace[]>;
|
|
40
|
+
static loadElementsFonts: (elements: readonly ExcalidrawElement[], ownerDocument?: Document) => Promise<FontFace[]>;
|
|
40
41
|
/**
|
|
41
42
|
* Generate CSS @font-face declarations for the given elements.
|
|
42
43
|
*/
|
|
@@ -2,13 +2,13 @@ export type CaretPosition = {
|
|
|
2
2
|
start: number;
|
|
3
3
|
end: number;
|
|
4
4
|
};
|
|
5
|
-
export declare const saveCaretPosition: () => CaretPosition | null;
|
|
6
|
-
export declare const restoreCaretPosition: (position: CaretPosition | null) => void;
|
|
7
|
-
export declare const withCaretPositionPreservation: (callback: () => void, isCompactMode: boolean, isEditingText: boolean, onPreventClose?: () => void) => void;
|
|
8
|
-
export declare const useTextEditorFocus: () => {
|
|
5
|
+
export declare const saveCaretPosition: (ownerDocument?: Document) => CaretPosition | null;
|
|
6
|
+
export declare const restoreCaretPosition: (position: CaretPosition | null, ownerDocument?: Document) => void;
|
|
7
|
+
export declare const withCaretPositionPreservation: (callback: () => void, isCompactMode: boolean, isEditingText: boolean, onPreventClose?: () => void, ownerDocument?: Document) => void;
|
|
8
|
+
export declare const useTextEditorFocus: (ownerDocument?: Document) => {
|
|
9
9
|
saveCaretPosition: () => void;
|
|
10
10
|
restoreCaretPosition: () => void;
|
|
11
11
|
clearSavedPosition: () => void;
|
|
12
12
|
hasSavedPosition: boolean;
|
|
13
13
|
};
|
|
14
|
-
export declare const temporarilyDisableTextEditorBlur: (duration?: number) => void;
|
|
14
|
+
export declare const temporarilyDisableTextEditorBlur: (ownerDocument?: Document, duration?: number) => void;
|
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
import type { StaticCanvasRenderConfig } from "../scene/types";
|
|
2
2
|
import type { AppState, StaticCanvasAppState } from "../types";
|
|
3
|
+
export declare const DEFAULT_SELECTION_COLOR = "#6965db";
|
|
4
|
+
/**
|
|
5
|
+
* Returns the theme's selection color (`--color-selection`), read from the
|
|
6
|
+
* computed style of any element inside the editor container so that host
|
|
7
|
+
* overrides are respected. Falls back to the default when unavailable.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getSelectionColor: (element: Element | null | undefined) => string;
|
|
3
10
|
export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke: boolean, fill?: boolean) => void;
|
|
11
|
+
/**
|
|
12
|
+
* The scroll the renderers draw at: the real one, rounded to whole device
|
|
13
|
+
* pixels. Panning writes a fractional scroll (pointer delta ÷ zoom), and an
|
|
14
|
+
* element's cached bitmap blitted at a fractional device offset gets
|
|
15
|
+
* resampled — so as the fraction drifts under a pan, every element pulses
|
|
16
|
+
* between crisp and soft. A whole-pixel scroll moves the scene the way a
|
|
17
|
+
* browser scrolls a page: each element keeps its own, constant sub-pixel
|
|
18
|
+
* phase and a pan never changes how anything is filtered. The difference
|
|
19
|
+
* stays under half a device pixel, so hit-testing and DOM overlays keep
|
|
20
|
+
* using the real scroll. Identity when nothing needs to change.
|
|
21
|
+
*/
|
|
22
|
+
export declare const snapScrollToDevicePixels: <T extends {
|
|
23
|
+
scrollX: number;
|
|
24
|
+
scrollY: number;
|
|
25
|
+
zoom: {
|
|
26
|
+
value: number;
|
|
27
|
+
};
|
|
28
|
+
}>(appState: T, scale: number) => T;
|
|
4
29
|
export declare const getNormalizedCanvasDimensions: (canvas: HTMLCanvasElement, scale: number) => [number, number];
|
|
5
30
|
export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normalizedHeight, theme, isExporting, viewBackgroundColor, }: {
|
|
6
31
|
canvas: HTMLCanvasElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getScrollBars } from "../scene/scrollbars";
|
|
2
2
|
import type { InteractiveSceneRenderConfig } from "../scene/types";
|
|
3
|
-
declare const _renderInteractiveScene: ({ app, canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, editorInterface, animationState, deltaTime, }: InteractiveSceneRenderConfig) => {
|
|
3
|
+
declare const _renderInteractiveScene: ({ app, canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState: unsnappedAppState, renderConfig, editorInterface, animationState, deltaTime, }: InteractiveSceneRenderConfig) => {
|
|
4
4
|
scrollBars?: ReturnType<typeof getScrollBars>;
|
|
5
5
|
animationState?: typeof animationState;
|
|
6
6
|
};
|
|
@@ -53,6 +53,7 @@ export declare class Renderer {
|
|
|
53
53
|
frameId: string | null;
|
|
54
54
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
55
55
|
updated: number;
|
|
56
|
+
created: number | null;
|
|
56
57
|
link: string | null;
|
|
57
58
|
locked: boolean;
|
|
58
59
|
customData?: Record<string, any>;
|
|
@@ -92,6 +93,7 @@ export declare class Renderer {
|
|
|
92
93
|
frameId: string | null;
|
|
93
94
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
94
95
|
updated: number;
|
|
96
|
+
created: number | null;
|
|
95
97
|
link: string | null;
|
|
96
98
|
locked: boolean;
|
|
97
99
|
customData?: Record<string, any>;
|
|
@@ -126,6 +128,43 @@ export declare class Renderer {
|
|
|
126
128
|
frameId: string | null;
|
|
127
129
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
128
130
|
updated: number;
|
|
131
|
+
created: number | null;
|
|
132
|
+
link: string | null;
|
|
133
|
+
locked: boolean;
|
|
134
|
+
customData?: Record<string, any>;
|
|
135
|
+
}> & Readonly<{
|
|
136
|
+
type: "stickynote";
|
|
137
|
+
baseHeight: number;
|
|
138
|
+
}> & {
|
|
139
|
+
isDeleted: false;
|
|
140
|
+
}) | (Readonly<{
|
|
141
|
+
id: string;
|
|
142
|
+
x: number;
|
|
143
|
+
y: number;
|
|
144
|
+
strokeColor: string;
|
|
145
|
+
backgroundColor: string;
|
|
146
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
147
|
+
strokeWidth: number;
|
|
148
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
149
|
+
roundness: null | {
|
|
150
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
151
|
+
value?: number;
|
|
152
|
+
};
|
|
153
|
+
roughness: number;
|
|
154
|
+
opacity: number;
|
|
155
|
+
width: number;
|
|
156
|
+
height: number;
|
|
157
|
+
angle: import("@excalidraw/math").Radians;
|
|
158
|
+
seed: number;
|
|
159
|
+
version: number;
|
|
160
|
+
versionNonce: number;
|
|
161
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
162
|
+
isDeleted: boolean;
|
|
163
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
164
|
+
frameId: string | null;
|
|
165
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
166
|
+
updated: number;
|
|
167
|
+
created: number | null;
|
|
129
168
|
link: string | null;
|
|
130
169
|
locked: boolean;
|
|
131
170
|
customData?: Record<string, any>;
|
|
@@ -160,6 +199,7 @@ export declare class Renderer {
|
|
|
160
199
|
frameId: string | null;
|
|
161
200
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
162
201
|
updated: number;
|
|
202
|
+
created: number | null;
|
|
163
203
|
link: string | null;
|
|
164
204
|
locked: boolean;
|
|
165
205
|
customData?: Record<string, any>;
|
|
@@ -194,6 +234,7 @@ export declare class Renderer {
|
|
|
194
234
|
frameId: string | null;
|
|
195
235
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
196
236
|
updated: number;
|
|
237
|
+
created: number | null;
|
|
197
238
|
link: string | null;
|
|
198
239
|
locked: boolean;
|
|
199
240
|
customData?: Record<string, any>;
|
|
@@ -228,6 +269,7 @@ export declare class Renderer {
|
|
|
228
269
|
frameId: string | null;
|
|
229
270
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
230
271
|
updated: number;
|
|
272
|
+
created: number | null;
|
|
231
273
|
link: string | null;
|
|
232
274
|
locked: boolean;
|
|
233
275
|
customData?: Record<string, any>;
|
|
@@ -265,6 +307,7 @@ export declare class Renderer {
|
|
|
265
307
|
frameId: string | null;
|
|
266
308
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
267
309
|
updated: number;
|
|
310
|
+
created: number | null;
|
|
268
311
|
link: string | null;
|
|
269
312
|
locked: boolean;
|
|
270
313
|
customData?: Record<string, any>;
|
|
@@ -303,6 +346,7 @@ export declare class Renderer {
|
|
|
303
346
|
frameId: string | null;
|
|
304
347
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
305
348
|
updated: number;
|
|
349
|
+
created: number | null;
|
|
306
350
|
link: string | null;
|
|
307
351
|
locked: boolean;
|
|
308
352
|
customData?: Record<string, any>;
|
|
@@ -338,6 +382,7 @@ export declare class Renderer {
|
|
|
338
382
|
frameId: string | null;
|
|
339
383
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
340
384
|
updated: number;
|
|
385
|
+
created: number | null;
|
|
341
386
|
link: string | null;
|
|
342
387
|
locked: boolean;
|
|
343
388
|
customData?: Record<string, any>;
|
|
@@ -373,6 +418,7 @@ export declare class Renderer {
|
|
|
373
418
|
frameId: string | null;
|
|
374
419
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
375
420
|
updated: number;
|
|
421
|
+
created: number | null;
|
|
376
422
|
link: string | null;
|
|
377
423
|
locked: boolean;
|
|
378
424
|
customData?: Record<string, any>;
|
|
@@ -380,15 +426,17 @@ export declare class Renderer {
|
|
|
380
426
|
type: "text";
|
|
381
427
|
fontSize: number;
|
|
382
428
|
fontFamily: import("@excalidraw/element/types").FontFamilyValues;
|
|
429
|
+
baseFontSize: number | null;
|
|
383
430
|
text: string;
|
|
384
431
|
textAlign: import("@excalidraw/element/types").TextAlign;
|
|
385
432
|
verticalAlign: import("@excalidraw/element/types").VerticalAlign;
|
|
386
|
-
containerId: import("@excalidraw/element/types").
|
|
433
|
+
containerId: import("@excalidraw/element/types").ExcalidrawTextContainer["id"] | null;
|
|
387
434
|
originalText: string;
|
|
388
435
|
autoResize: boolean;
|
|
389
436
|
lineHeight: number & {
|
|
390
437
|
_brand: "unitlessLineHeight";
|
|
391
438
|
};
|
|
439
|
+
labelPosition?: number | null;
|
|
392
440
|
}> & {
|
|
393
441
|
isDeleted: false;
|
|
394
442
|
}) | (Readonly<{
|
|
@@ -418,6 +466,7 @@ export declare class Renderer {
|
|
|
418
466
|
frameId: string | null;
|
|
419
467
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
420
468
|
updated: number;
|
|
469
|
+
created: number | null;
|
|
421
470
|
link: string | null;
|
|
422
471
|
locked: boolean;
|
|
423
472
|
customData?: Record<string, any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { isSomeElementSelected, getElementsWithinSelection, getSelectedElements, getTargetElements, } from "@excalidraw/element";
|
|
2
2
|
export { getScrollToContentState } from "../viewport";
|
|
3
|
-
export { hasBackground, hasStrokeWidth, hasStrokeStyle, hasFreedrawMode, canHaveArrowheads, canChangeRoundness, } from "@excalidraw/element";
|
|
3
|
+
export { hasBackground, hasFillStyle, hasRoughness, hasStrokeWidth, hasStrokeStyle, hasFreedrawMode, canHaveArrowheads, canChangeRoundness, } from "@excalidraw/element";
|
|
4
4
|
export { getNormalizedZoom, getNormalizedGridSize, getNormalizedGridStep, } from "./normalize";
|
|
@@ -85,7 +85,7 @@ export type BinaryFileData = {
|
|
|
85
85
|
};
|
|
86
86
|
export type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
|
|
87
87
|
export type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
|
|
88
|
-
export type ToolType = "selection" | "lasso" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "magicframe" | "embeddable" | "laser" | "autoshape" | "bucketfill";
|
|
88
|
+
export type ToolType = "selection" | "lasso" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "magicframe" | "stickynote" | "embeddable" | "laser" | "autoshape" | "bucketfill";
|
|
89
89
|
export type ElementOrToolType = ExcalidrawElementType | ToolType | "custom";
|
|
90
90
|
export type ActiveTool = {
|
|
91
91
|
type: ToolType;
|
|
@@ -308,6 +308,8 @@ export interface AppState {
|
|
|
308
308
|
exportWithDarkMode: boolean;
|
|
309
309
|
exportScale: number;
|
|
310
310
|
currentItemStrokeColor: string;
|
|
311
|
+
currentItemStickynoteStrokeColor: string;
|
|
312
|
+
currentItemStickynoteBackgroundColor: string;
|
|
311
313
|
currentItemBackgroundColor: string;
|
|
312
314
|
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
313
315
|
currentItemStrokeWidthKey: StrokeWidthKey;
|
|
@@ -438,6 +440,9 @@ export interface AppState {
|
|
|
438
440
|
* even though both drive `currentItemBackgroundColor` (its defaults and
|
|
439
441
|
* use case differ — no transparent) */
|
|
440
442
|
bucketFill: readonly string[] | null;
|
|
443
|
+
/** sticky notes are their own color domain (own defaults, own picks) */
|
|
444
|
+
stickyNoteStroke: readonly string[] | null;
|
|
445
|
+
stickyNoteBackground: readonly string[] | null;
|
|
441
446
|
};
|
|
442
447
|
}
|
|
443
448
|
export type SearchMatch = {
|
|
@@ -632,6 +637,16 @@ export type UIConfig = {
|
|
|
632
637
|
};
|
|
633
638
|
export interface ExcalidrawProps {
|
|
634
639
|
className?: string;
|
|
640
|
+
/**
|
|
641
|
+
* Document that owns Excalidraw's mounted DOM.
|
|
642
|
+
*
|
|
643
|
+
* Set only when it differs from the global `document`, such as when code
|
|
644
|
+
* executing in a parent window mounts Excalidraw into an iframe document.
|
|
645
|
+
* The value must remain stable for the editor's lifetime.
|
|
646
|
+
*
|
|
647
|
+
* @default document
|
|
648
|
+
*/
|
|
649
|
+
ownerDocument?: Document;
|
|
635
650
|
onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
|
|
636
651
|
onThemeChange?: (theme: Theme | "system") => void;
|
|
637
652
|
/**
|
|
@@ -821,7 +836,8 @@ export interface ExcalidrawProps {
|
|
|
821
836
|
}) => MaybePromise<void> | AsyncGenerator<OnExportProgress, void>;
|
|
822
837
|
}
|
|
823
838
|
export type SceneData = {
|
|
824
|
-
|
|
839
|
+
/** Expects normalized elements; restore imported data before updating the scene. */
|
|
840
|
+
elements?: readonly ExcalidrawElement[] | null;
|
|
825
841
|
appState?: ImportedDataState["appState"];
|
|
826
842
|
collaborators?: Map<SocketId, Collaborator>;
|
|
827
843
|
captureUpdate?: CaptureUpdateActionType;
|
|
@@ -881,6 +897,8 @@ export type AppProps = Merge<ExcalidrawProps, {
|
|
|
881
897
|
export type AppClassProperties = {
|
|
882
898
|
props: AppProps;
|
|
883
899
|
state: AppState;
|
|
900
|
+
readonly ownerDocument: Document;
|
|
901
|
+
readonly ownerWindow: Window & typeof globalThis;
|
|
884
902
|
api: App["api"];
|
|
885
903
|
sessionExportThemeOverride: App["sessionExportThemeOverride"];
|
|
886
904
|
interactiveCanvas: HTMLCanvasElement | null;
|
|
@@ -914,8 +932,11 @@ export type AppClassProperties = {
|
|
|
914
932
|
dismissLinearEditor: App["dismissLinearEditor"];
|
|
915
933
|
flowchart: App["flowchart"];
|
|
916
934
|
drawShape: App["drawShape"];
|
|
935
|
+
arrowText: App["arrowText"];
|
|
917
936
|
cursor: App["cursor"];
|
|
918
937
|
bucketFill: App["bucketFill"];
|
|
938
|
+
toolDrag: App["toolDrag"];
|
|
939
|
+
activeResizeHandle: App["activeResizeHandle"];
|
|
919
940
|
isToolLocked: App["isToolLocked"];
|
|
920
941
|
getEffectiveGridSize: App["getEffectiveGridSize"];
|
|
921
942
|
setPlugins: App["setPlugins"];
|
|
@@ -970,6 +991,7 @@ export type PointerDownState = Readonly<{
|
|
|
970
991
|
wasAddedToSelection: boolean;
|
|
971
992
|
hasBeenDuplicated: boolean;
|
|
972
993
|
hasHitCommonBoundingBoxOfSelectedElements: boolean;
|
|
994
|
+
arrowLabel: boolean;
|
|
973
995
|
};
|
|
974
996
|
withCmdOrCtrl: boolean;
|
|
975
997
|
drag: {
|
|
@@ -1077,6 +1099,12 @@ export type NullableGridSize = (AppState["gridSize"] & MakeBrand<"NullableGridSi
|
|
|
1077
1099
|
export type GenerateDiagramToCode = (props: {
|
|
1078
1100
|
frame: NonDeleted<ExcalidrawMagicFrameElement>;
|
|
1079
1101
|
children: readonly NonDeletedExcalidrawElement[];
|
|
1102
|
+
/**
|
|
1103
|
+
* Optional streaming hook. Call with the accumulated response text as it
|
|
1104
|
+
* streams in so the editor can progressively render the partial HTML
|
|
1105
|
+
* inside the generated frame.
|
|
1106
|
+
*/
|
|
1107
|
+
onPartial?: (html: string) => void;
|
|
1080
1108
|
}) => MaybePromise<{
|
|
1081
1109
|
html: string;
|
|
1082
1110
|
}>;
|
|
@@ -142,6 +142,8 @@ export declare const zoomToFitBounds: ({ bounds, appState, canvasOffsets, fit, m
|
|
|
142
142
|
exportWithDarkMode: boolean;
|
|
143
143
|
exportScale: number;
|
|
144
144
|
currentItemStrokeColor: string;
|
|
145
|
+
currentItemStickynoteStrokeColor: string;
|
|
146
|
+
currentItemStickynoteBackgroundColor: string;
|
|
145
147
|
currentItemBackgroundColor: string;
|
|
146
148
|
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
147
149
|
currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
|
|
@@ -248,6 +250,8 @@ export declare const zoomToFitBounds: ({ bounds, appState, canvasOffsets, fit, m
|
|
|
248
250
|
elementStroke: readonly string[] | null;
|
|
249
251
|
elementBackground: readonly string[] | null;
|
|
250
252
|
bucketFill: readonly string[] | null;
|
|
253
|
+
stickyNoteStroke: readonly string[] | null;
|
|
254
|
+
stickyNoteBackground: readonly string[] | null;
|
|
251
255
|
};
|
|
252
256
|
};
|
|
253
257
|
captureUpdate: "EVENTUALLY";
|
|
@@ -16,20 +16,25 @@ export declare function curveIntersectLineSegment<Point extends GlobalPoint | Lo
|
|
|
16
16
|
tolerance?: number;
|
|
17
17
|
iterLimit?: number;
|
|
18
18
|
}): Point[];
|
|
19
|
+
/**
|
|
20
|
+
* Finds the parameter on the Bezier curve whose point is closest to another
|
|
21
|
+
* point
|
|
22
|
+
*
|
|
23
|
+
* @param c The curve to test
|
|
24
|
+
* @param p The point to measure from
|
|
25
|
+
* @param tolerance The width of the search window under which the bisection
|
|
26
|
+
* stops refining the parameter
|
|
27
|
+
*/
|
|
28
|
+
export declare function curveClosestParameter<Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, p: Point, tolerance?: number): number;
|
|
19
29
|
/**
|
|
20
30
|
* Finds the closest point on the Bezier curve from another point
|
|
21
31
|
*
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
24
|
-
* @param
|
|
25
|
-
*
|
|
26
|
-
* @param P2
|
|
27
|
-
* @param P3
|
|
28
|
-
* @param tolerance
|
|
29
|
-
* @param maxLevel
|
|
30
|
-
* @returns
|
|
32
|
+
* @param c The curve to test
|
|
33
|
+
* @param p The point to measure from
|
|
34
|
+
* @param tolerance The width of the search window under which the bisection
|
|
35
|
+
* stops refining the parameter
|
|
31
36
|
*/
|
|
32
|
-
export declare function curveClosestPoint<Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, p: Point, tolerance?: number): Point
|
|
37
|
+
export declare function curveClosestPoint<Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, p: Point, tolerance?: number): Point;
|
|
33
38
|
/**
|
|
34
39
|
* Determines the distance between a point and the closest point on the
|
|
35
40
|
* Bezier curve.
|
|
@@ -37,7 +42,7 @@ export declare function curveClosestPoint<Point extends GlobalPoint | LocalPoint
|
|
|
37
42
|
* @param c The curve to test
|
|
38
43
|
* @param p The point to measure from
|
|
39
44
|
*/
|
|
40
|
-
export declare function curvePointDistance<Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, p: Point): number;
|
|
45
|
+
export declare function curvePointDistance<Point extends GlobalPoint | LocalPoint>(c: Curve<Point>, p: Point, tolerance?: number): number;
|
|
41
46
|
/**
|
|
42
47
|
* Determines if the parameter is a Curve
|
|
43
48
|
*/
|
|
@@ -74,4 +79,6 @@ export declare function curveLengthAtParameter<P extends GlobalPoint | LocalPoin
|
|
|
74
79
|
* @param percent A value between 0 and 1 representing the percentage of the curve's length
|
|
75
80
|
* @returns The point at the specified percentage of curve length
|
|
76
81
|
*/
|
|
77
|
-
export declare function curvePointAtLength<P extends GlobalPoint | LocalPoint>(c: Curve<P>, percent: number
|
|
82
|
+
export declare function curvePointAtLength<P extends GlobalPoint | LocalPoint>(c: Curve<P>, percent: number,
|
|
83
|
+
/** pass the curve's total length when already known to skip recomputing it */
|
|
84
|
+
totalLength?: number): P;
|
|
@@ -29,6 +29,11 @@ export declare const lineSegmentRotate: <Point extends LocalPoint | GlobalPoint>
|
|
|
29
29
|
export declare const segmentsIntersectAt: <Point extends GlobalPoint | LocalPoint>(a: Readonly<LineSegment<Point>>, b: Readonly<LineSegment<Point>>) => Point | null;
|
|
30
30
|
export declare const pointOnLineSegment: <Point extends LocalPoint | GlobalPoint>(point: Point, line: LineSegment<Point>, threshold?: number) => boolean;
|
|
31
31
|
export declare const distanceToLineSegment: <Point extends LocalPoint | GlobalPoint>(point: Point, line: LineSegment<Point>) => number;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the point at parameter `t` along the segment, where `t = 0` is the
|
|
34
|
+
* segment's start and `t = 1` its end. Not clamped.
|
|
35
|
+
*/
|
|
36
|
+
export declare function lineSegmentPointAt<Point extends GlobalPoint | LocalPoint>(line: LineSegment<Point>, t: number): Point;
|
|
32
37
|
/**
|
|
33
38
|
* Returns the intersection point of a segment and a line
|
|
34
39
|
*
|
|
@@ -38,3 +43,4 @@ export declare const distanceToLineSegment: <Point extends LocalPoint | GlobalPo
|
|
|
38
43
|
*/
|
|
39
44
|
export declare function lineSegmentIntersectionPoints<Point extends GlobalPoint | LocalPoint>(l: LineSegment<Point>, s: LineSegment<Point>, threshold?: number): Point | null;
|
|
40
45
|
export declare function lineSegmentsDistance<Point extends GlobalPoint | LocalPoint>(s1: LineSegment<Point>, s2: LineSegment<Point>): number;
|
|
46
|
+
export declare function lineSegmentClosestParameter<Point extends GlobalPoint | LocalPoint>(point: Point, line: LineSegment<Point>): number;
|
|
@@ -3,6 +3,7 @@ import type { ExcalidrawFrameLikeElement, NonDeleted, NonDeletedExcalidrawElemen
|
|
|
3
3
|
import type { AppState, BinaryFiles } from "@excalidraw/excalidraw/types";
|
|
4
4
|
export { MIME_TYPES };
|
|
5
5
|
type ExportOpts = {
|
|
6
|
+
/** restored before exporting */
|
|
6
7
|
elements: readonly NonDeletedExcalidrawElement[];
|
|
7
8
|
appState?: Partial<Omit<AppState, "offsetTop" | "offsetLeft">>;
|
|
8
9
|
files: BinaryFiles | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type GlobalPoint, type LocalPoint } from "@excalidraw/math";
|
|
2
|
-
import type { ElementsMap, ExcalidrawBindableElement, ExcalidrawDiamondElement, ExcalidrawElement, ExcalidrawEllipseElement, ExcalidrawEmbeddableElement, ExcalidrawFrameLikeElement, ExcalidrawFreeDrawElement, ExcalidrawIframeElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawRectangleElement, ExcalidrawSelectionElement, ExcalidrawTextElement } from "@excalidraw/element/types";
|
|
2
|
+
import type { ElementsMap, ExcalidrawBindableElement, ExcalidrawDiamondElement, ExcalidrawElement, ExcalidrawEllipseElement, ExcalidrawEmbeddableElement, ExcalidrawFrameLikeElement, ExcalidrawFreeDrawElement, ExcalidrawIframeElement, ExcalidrawImageElement, ExcalidrawLinearElement, ExcalidrawRectangleElement, ExcalidrawSelectionElement, ExcalidrawStickyNoteElement, ExcalidrawTextElement } from "@excalidraw/element/types";
|
|
3
3
|
import type { Curve, LineSegment, Polygon, Radians } from "@excalidraw/math";
|
|
4
4
|
import type { Drawable, Op } from "roughjs/bin/core";
|
|
5
5
|
export type Polyline<Point extends GlobalPoint | LocalPoint> = LineSegment<Point>[];
|
|
@@ -29,7 +29,7 @@ export type GeometricShape<Point extends GlobalPoint | LocalPoint> = {
|
|
|
29
29
|
type: "polycurve";
|
|
30
30
|
data: Polycurve<Point>;
|
|
31
31
|
};
|
|
32
|
-
type RectangularElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawFrameLikeElement | ExcalidrawEmbeddableElement | ExcalidrawImageElement | ExcalidrawIframeElement | ExcalidrawTextElement | ExcalidrawSelectionElement;
|
|
32
|
+
type RectangularElement = ExcalidrawRectangleElement | ExcalidrawStickyNoteElement | ExcalidrawDiamondElement | ExcalidrawFrameLikeElement | ExcalidrawEmbeddableElement | ExcalidrawImageElement | ExcalidrawIframeElement | ExcalidrawTextElement | ExcalidrawSelectionElement;
|
|
33
33
|
export declare const getPolygonShape: <Point extends GlobalPoint | LocalPoint>(element: RectangularElement) => GeometricShape<Point>;
|
|
34
34
|
export declare const getSelectionBoxShape: <Point extends GlobalPoint | LocalPoint>(element: ExcalidrawElement, elementsMap: ElementsMap, padding?: number) => GeometricShape<Point>;
|
|
35
35
|
export declare const getEllipseShape: <Point extends GlobalPoint | LocalPoint>(element: ExcalidrawEllipseElement) => GeometricShape<Point>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@excalidraw/element",
|
|
3
|
-
"version": "0.18.0-
|
|
3
|
+
"version": "0.18.0-afa3a65",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/types/element/src/index.d.ts",
|
|
6
6
|
"main": "./dist/prod/index.js",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@excalidraw/common": "0.18.0-
|
|
67
|
-
"@excalidraw/math": "0.18.0-
|
|
68
|
-
"@excalidraw/fractional-indexing": "0.18.0-
|
|
66
|
+
"@excalidraw/common": "0.18.0-afa3a65",
|
|
67
|
+
"@excalidraw/math": "0.18.0-afa3a65",
|
|
68
|
+
"@excalidraw/fractional-indexing": "0.18.0-afa3a65"
|
|
69
69
|
}
|
|
70
70
|
}
|