@dwelle/excalidraw 0.5.0-8cb033d → 0.5.0-90f2d4e
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/{chunk-C6WW3IWU.js → chunk-BIYCCCC4.js} +14 -4
- package/dist/dev/chunk-BIYCCCC4.js.map +7 -0
- package/dist/dev/chunk-QW2KPMGE.js +7 -0
- package/dist/dev/chunk-QW2KPMGE.js.map +7 -0
- package/dist/dev/{chunk-2LNRWI74.js → chunk-VPDGV5DO.js} +9679 -8756
- package/dist/dev/chunk-VPDGV5DO.js.map +7 -0
- package/dist/dev/data/{image-7QZI7GM4.js → image-RC4Z3PZK.js} +3 -3
- package/dist/dev/index.css +695 -506
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +4223 -2821
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/locales/{en-VFJV7E2V.js → en-XLJO5VTH.js} +2 -2
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/chunk-DUG5AXRR.js +33 -0
- package/dist/prod/chunk-M2OFWNPH.js +7 -0
- package/dist/prod/{chunk-O65DDAOS.js → chunk-SPUFWQ3U.js} +4 -4
- package/dist/prod/data/image-W7J67QSB.js +1 -0
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +20 -20
- package/dist/prod/locales/{en-UUHXMMMY.js → en-DMU2KFKH.js} +1 -1
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/common/src/constants.d.ts +38 -6
- package/dist/types/common/src/utils.d.ts +6 -5
- package/dist/types/element/src/Scene.d.ts +7 -3
- package/dist/types/element/src/align.d.ts +2 -1
- package/dist/types/element/src/binding.d.ts +10 -7
- package/dist/types/element/src/bounds.d.ts +12 -4
- package/dist/types/element/src/collision.d.ts +18 -12
- package/dist/types/element/src/cropElement.d.ts +1 -1
- package/dist/types/element/src/delta.d.ts +41 -9
- package/dist/types/element/src/distance.d.ts +2 -2
- package/dist/types/element/src/distribute.d.ts +2 -1
- package/dist/types/element/src/fractionalIndex.d.ts +8 -2
- package/dist/types/element/src/frame.d.ts +2 -2
- package/dist/types/element/src/groups.d.ts +1 -0
- package/dist/types/element/src/index.d.ts +2 -3
- package/dist/types/element/src/linearElementEditor.d.ts +13 -15
- package/dist/types/element/src/mutateElement.d.ts +1 -1
- package/dist/types/element/src/newElement.d.ts +2 -1
- package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
- package/dist/types/element/src/renderElement.d.ts +4 -1
- package/dist/types/element/src/resizeElements.d.ts +1 -0
- package/dist/types/element/src/selection.d.ts +1 -1
- package/dist/types/element/src/shape.d.ts +42 -0
- package/dist/types/element/src/sizeHelpers.d.ts +2 -1
- package/dist/types/element/src/store.d.ts +19 -9
- package/dist/types/element/src/textElement.d.ts +1 -1
- package/dist/types/element/src/transformHandles.d.ts +4 -4
- package/dist/types/element/src/typeChecks.d.ts +15 -1
- package/dist/types/element/src/types.d.ts +8 -3
- package/dist/types/element/src/utils.d.ts +16 -6
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +15 -18
- package/dist/types/excalidraw/actions/actionAlign.d.ts +8 -8
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +10 -12
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +158 -170
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +38 -42
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +5 -6
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +21 -23
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +4 -5
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +12 -14
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +5 -6
- package/dist/types/excalidraw/actions/actionExport.d.ts +130 -139
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +61 -22
- package/dist/types/excalidraw/actions/actionFlip.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionFrame.d.ts +70 -74
- package/dist/types/excalidraw/actions/actionGroup.d.ts +16 -18
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +532 -9
- package/dist/types/excalidraw/actions/actionLink.d.ts +6 -7
- package/dist/types/excalidraw/actions/actionMenu.d.ts +16 -19
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +10 -12
- package/dist/types/excalidraw/actions/actionProperties.d.ts +107 -105
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +8 -9
- package/dist/types/excalidraw/actions/actionStyles.d.ts +9 -10
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +7 -8
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +7 -8
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +6 -7
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +7 -8
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +7 -8
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +7 -8
- package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -8
- package/dist/types/excalidraw/actions/index.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +2 -1
- package/dist/types/excalidraw/appState.d.ts +21 -20
- package/dist/types/excalidraw/clipboard.d.ts +64 -1
- package/dist/types/excalidraw/components/Actions.d.ts +8 -5
- package/dist/types/excalidraw/components/App.d.ts +21 -27
- package/dist/types/excalidraw/components/ButtonIcon.d.ts +1 -0
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +2 -1
- package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
- package/dist/types/excalidraw/components/Ellipsify.d.ts +4 -0
- package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +2 -1
- package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
- package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
- package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -0
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +11 -1
- package/dist/types/excalidraw/components/TextField.d.ts +1 -0
- package/dist/types/excalidraw/components/icons.d.ts +7 -0
- package/dist/types/excalidraw/components/shapes.d.ts +129 -1
- package/dist/types/excalidraw/data/blob.d.ts +4 -8
- package/dist/types/excalidraw/data/reconcile.d.ts +1 -0
- package/dist/types/excalidraw/data/restore.d.ts +6 -1
- package/dist/types/excalidraw/data/types.d.ts +4 -1
- package/dist/types/excalidraw/eraser/index.d.ts +0 -2
- package/dist/types/excalidraw/history.d.ts +21 -5
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
- package/dist/types/excalidraw/index.d.ts +2 -1
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -1
- package/dist/types/excalidraw/renderer/helpers.d.ts +4 -4
- package/dist/types/excalidraw/renderer/staticScene.d.ts +4 -1
- package/dist/types/excalidraw/scene/Renderer.d.ts +0 -1
- package/dist/types/excalidraw/types.d.ts +12 -9
- package/dist/types/math/src/angle.d.ts +2 -0
- package/dist/types/math/src/constants.d.ts +3 -0
- package/dist/types/math/src/curve.d.ts +32 -0
- package/dist/types/math/src/index.d.ts +1 -0
- package/dist/types/math/src/point.d.ts +1 -1
- package/dist/types/math/src/rectangle.d.ts +2 -0
- package/dist/types/math/src/segment.d.ts +1 -0
- package/dist/types/math/src/vector.d.ts +4 -2
- package/history.ts +107 -44
- package/package.json +9 -9
- package/dist/dev/chunk-2LNRWI74.js.map +0 -7
- package/dist/dev/chunk-C6WW3IWU.js.map +0 -7
- package/dist/dev/chunk-NR24AOHB.js +0 -7
- package/dist/dev/chunk-NR24AOHB.js.map +0 -7
- package/dist/prod/chunk-JUZ2P6ZK.js +0 -33
- package/dist/prod/chunk-ZSOIT5RG.js +0 -7
- package/dist/prod/data/image-RPTD4VCP.js +0 -1
- package/dist/types/element/src/Shape.d.ts +0 -17
- package/dist/types/element/src/ShapeCache.d.ts +0 -25
- package/dist/types/element/src/shapes.d.ts +0 -23
- package/dist/types/excalidraw/visualdebug.d.ts +0 -41
- package/dist/types/utils/src/collision.d.ts +0 -8
- /package/dist/dev/data/{image-7QZI7GM4.js.map → image-RC4Z3PZK.js.map} +0 -0
- /package/dist/dev/locales/{en-VFJV7E2V.js.map → en-XLJO5VTH.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A,B,C,D,E,F,G,H,I,J,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-
|
|
1
|
+
import{A,B,C,D,E,F,G,H,I,J,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-SPUFWQ3U.js";import"../chunk-SRAX5OIU.js";export{f as alerts,e as buttons,l as canvasError,s as clearCanvasDialog,C as colorPicker,A as colors,I as commandPalette,v as confirmDialog,J as default,i as element,b as elementLink,x as encrypted,p as errorDialog,m as errorSplash,g as errors,q as exportDialog,G as fontList,j as headings,r as helpDialog,k as hints,w as imageExportDialog,a as labels,c as library,E as mermaid,D as overwriteConfirm,t as publishDialog,u as publishSuccessDialog,F as quickSearch,o as roomDialog,d as search,n as shareDialog,y as stats,z as toast,h as toolBar,H as userList,B as welcomeScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"./chunk-LS7FJGPW.js";import"./chunk-
|
|
1
|
+
import{a,b,c,d}from"./chunk-LS7FJGPW.js";import"./chunk-M2OFWNPH.js";import"./chunk-SRAX5OIU.js";export{a as Commands,b as subsetToBase64,c as subsetToBinary,d as toBase64};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r,c as t}from"./chunk-LS7FJGPW.js";import"./chunk-
|
|
1
|
+
import{a as r,c as t}from"./chunk-LS7FJGPW.js";import"./chunk-M2OFWNPH.js";import"./chunk-SRAX5OIU.js";var s=import.meta.url?new URL(import.meta.url):void 0;typeof window>"u"&&typeof self<"u"&&(self.onmessage=async e=>{switch(e.data.command){case r.Subset:let a=await t(e.data.arrayBuffer,e.data.codePoints);self.postMessage(a,{transfer:[a]});break}});export{s as WorkerUrl};
|
|
@@ -8,10 +8,12 @@ export declare const isChrome: boolean;
|
|
|
8
8
|
export declare const isSafari: boolean;
|
|
9
9
|
export declare const isIOS: boolean;
|
|
10
10
|
export declare const isBrave: () => boolean;
|
|
11
|
+
export declare const isMobile: boolean;
|
|
11
12
|
export declare const supportsResizeObserver: boolean;
|
|
12
13
|
export declare const APP_NAME = "Excalidraw";
|
|
13
14
|
export declare const TEXT_AUTOWRAP_THRESHOLD = 36;
|
|
14
15
|
export declare const DRAGGING_THRESHOLD = 10;
|
|
16
|
+
export declare const MINIMUM_ARROW_SIZE = 20;
|
|
15
17
|
export declare const LINE_CONFIRM_THRESHOLD = 8;
|
|
16
18
|
export declare const ELEMENT_SHIFT_TRANSLATE_AMOUNT = 5;
|
|
17
19
|
export declare const ELEMENT_TRANSLATE_AMOUNT = 1;
|
|
@@ -85,10 +87,12 @@ export declare const ENV: {
|
|
|
85
87
|
PRODUCTION: string;
|
|
86
88
|
};
|
|
87
89
|
export declare const CLASSES: {
|
|
90
|
+
SIDEBAR: string;
|
|
88
91
|
SHAPE_ACTIONS_MENU: string;
|
|
89
92
|
ZOOM_ACTIONS: string;
|
|
90
93
|
SEARCH_MENU_INPUT_WRAPPER: string;
|
|
91
94
|
CONVERT_ELEMENT_TYPE_POPUP: string;
|
|
95
|
+
SHAPE_ACTIONS_THEME_SCOPE: string;
|
|
92
96
|
};
|
|
93
97
|
export declare const CJK_HAND_DRAWN_FALLBACK_FONT = "Xiaolai";
|
|
94
98
|
export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
|
|
@@ -111,10 +115,19 @@ export declare const FONT_FAMILY: {
|
|
|
111
115
|
"Liberation Sans": number;
|
|
112
116
|
Assistant: number;
|
|
113
117
|
};
|
|
118
|
+
export declare const SANS_SERIF_GENERIC_FONT = "sans-serif";
|
|
119
|
+
export declare const MONOSPACE_GENERIC_FONT = "monospace";
|
|
120
|
+
export declare const FONT_FAMILY_GENERIC_FALLBACKS: {
|
|
121
|
+
"sans-serif": number;
|
|
122
|
+
monospace: number;
|
|
123
|
+
};
|
|
114
124
|
export declare const FONT_FAMILY_FALLBACKS: {
|
|
115
|
-
Xiaolai: number;
|
|
116
125
|
"Segoe UI Emoji": number;
|
|
126
|
+
"sans-serif": number;
|
|
127
|
+
monospace: number;
|
|
128
|
+
Xiaolai: number;
|
|
117
129
|
};
|
|
130
|
+
export declare function getGenericFontFamilyFallback(fontFamily: number): keyof typeof FONT_FAMILY_GENERIC_FALLBACKS;
|
|
118
131
|
export declare const getFontFamilyFallbacks: (fontFamily: number) => Array<keyof typeof FONT_FAMILY_FALLBACKS>;
|
|
119
132
|
export declare const THEME: {
|
|
120
133
|
readonly LIGHT: "light";
|
|
@@ -167,6 +180,14 @@ export declare const IMAGE_MIME_TYPES: {
|
|
|
167
180
|
readonly avif: "image/avif";
|
|
168
181
|
readonly jfif: "image/jfif";
|
|
169
182
|
};
|
|
183
|
+
export declare const STRING_MIME_TYPES: {
|
|
184
|
+
readonly text: "text/plain";
|
|
185
|
+
readonly html: "text/html";
|
|
186
|
+
readonly json: "application/json";
|
|
187
|
+
readonly excalidraw: "application/vnd.excalidraw+json";
|
|
188
|
+
readonly excalidrawlib: "application/vnd.excalidrawlib+json";
|
|
189
|
+
readonly excalidrawlibIds: "application/vnd.excalidrawlib.ids+json";
|
|
190
|
+
};
|
|
170
191
|
export declare const MIME_TYPES: {
|
|
171
192
|
readonly svg: "image/svg+xml";
|
|
172
193
|
readonly png: "image/png";
|
|
@@ -177,14 +198,15 @@ export declare const MIME_TYPES: {
|
|
|
177
198
|
readonly ico: "image/x-icon";
|
|
178
199
|
readonly avif: "image/avif";
|
|
179
200
|
readonly jfif: "image/jfif";
|
|
201
|
+
readonly "excalidraw.svg": "image/svg+xml";
|
|
202
|
+
readonly "excalidraw.png": "image/png";
|
|
203
|
+
readonly binary: "application/octet-stream";
|
|
180
204
|
readonly text: "text/plain";
|
|
181
205
|
readonly html: "text/html";
|
|
182
206
|
readonly json: "application/json";
|
|
183
207
|
readonly excalidraw: "application/vnd.excalidraw+json";
|
|
184
208
|
readonly excalidrawlib: "application/vnd.excalidrawlib+json";
|
|
185
|
-
readonly
|
|
186
|
-
readonly "excalidraw.png": "image/png";
|
|
187
|
-
readonly binary: "application/octet-stream";
|
|
209
|
+
readonly excalidrawlibIds: "application/vnd.excalidrawlib.ids+json";
|
|
188
210
|
};
|
|
189
211
|
export declare const ALLOWED_PASTE_MIME_TYPES: readonly ["text/plain", "text/html", ...("image/svg+xml" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/bmp" | "image/x-icon" | "image/avif" | "image/jfif")[]];
|
|
190
212
|
export declare const EXPORT_IMAGE_TYPES: {
|
|
@@ -219,9 +241,12 @@ export declare const URL_HASH_KEYS: {
|
|
|
219
241
|
readonly addLibrary: "addLibrary";
|
|
220
242
|
};
|
|
221
243
|
export declare const DEFAULT_UI_OPTIONS: AppProps["UIOptions"];
|
|
222
|
-
export declare const
|
|
244
|
+
export declare const MQ_MAX_MOBILE = 800;
|
|
223
245
|
export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
|
|
224
246
|
export declare const MQ_MAX_HEIGHT_LANDSCAPE = 500;
|
|
247
|
+
export declare const MQ_MIN_TABLET: number;
|
|
248
|
+
export declare const MQ_MAX_TABLET = 1400;
|
|
249
|
+
export declare const MQ_MIN_WIDTH_DESKTOP = 1440;
|
|
225
250
|
export declare const MQ_RIGHT_SIDEBAR_MIN_WIDTH = 1229;
|
|
226
251
|
export declare const LIBRARY_SIDEBAR_WIDTH = 302;
|
|
227
252
|
export declare const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
|
|
@@ -283,7 +308,7 @@ export declare const DEFAULT_SIDEBAR: {
|
|
|
283
308
|
readonly name: "default";
|
|
284
309
|
readonly defaultTab: "library";
|
|
285
310
|
};
|
|
286
|
-
export declare const LIBRARY_DISABLED_TYPES: Set<"embeddable" | "
|
|
311
|
+
export declare const LIBRARY_DISABLED_TYPES: Set<"embeddable" | "iframe" | "image">;
|
|
287
312
|
export declare const TOOL_TYPE: {
|
|
288
313
|
readonly selection: "selection";
|
|
289
314
|
readonly lasso: "lasso";
|
|
@@ -329,3 +354,10 @@ export declare enum UserIdleState {
|
|
|
329
354
|
AWAY = "away",
|
|
330
355
|
IDLE = "idle"
|
|
331
356
|
}
|
|
357
|
+
/**
|
|
358
|
+
* distance at which we merge points instead of adding a new merge-point
|
|
359
|
+
* when converting a line to a polygon (merge currently means overlaping
|
|
360
|
+
* the start and end points)
|
|
361
|
+
*/
|
|
362
|
+
export declare const LINE_POLYGON_POINT_MERGE_DISTANCE = 20;
|
|
363
|
+
export declare const DOUBLE_TAP_POSITION_THRESHOLD = 35;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ExcalidrawBindableElement, FontFamilyValues, FontString, ExcalidrawElement } from "@excalidraw/element/types";
|
|
1
|
+
import type { ExcalidrawBindableElement, FontFamilyValues, FontString } from "@excalidraw/element/types";
|
|
3
2
|
import type { ActiveTool, AppState, ToolType, UnsubscribeCallback, Zoom } from "@excalidraw/excalidraw/types";
|
|
4
3
|
import type { MaybePromise } from "./utility-types";
|
|
5
4
|
import type { EVENT } from "./constants";
|
|
@@ -7,9 +6,9 @@ export declare const setDateTimeForTests: (dateTime: string) => void;
|
|
|
7
6
|
export declare const getDateTime: () => string;
|
|
8
7
|
export declare const capitalizeString: (str: string) => string;
|
|
9
8
|
export declare const isToolIcon: (target: Element | EventTarget | null) => target is HTMLElement;
|
|
10
|
-
export declare const isInputLike: (target: Element | EventTarget | null) => target is
|
|
9
|
+
export declare const isInputLike: (target: Element | EventTarget | null) => target is HTMLBRElement | HTMLDivElement | HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
11
10
|
export declare const isInteractive: (target: Element | EventTarget | null) => boolean;
|
|
12
|
-
export declare const isWritableElement: (target: Element | EventTarget | null) => target is
|
|
11
|
+
export declare const isWritableElement: (target: Element | EventTarget | null) => target is HTMLBRElement | HTMLDivElement | HTMLInputElement | HTMLTextAreaElement;
|
|
13
12
|
export declare const getFontFamilyString: ({ fontFamily, }: {
|
|
14
13
|
fontFamily: FontFamilyValues;
|
|
15
14
|
}) => string;
|
|
@@ -18,6 +17,8 @@ export declare const getFontString: ({ fontSize, fontFamily, }: {
|
|
|
18
17
|
fontSize: number;
|
|
19
18
|
fontFamily: FontFamilyValues;
|
|
20
19
|
}) => FontString;
|
|
20
|
+
/** executes callback in the frame that's after the current one */
|
|
21
|
+
export declare const nextAnimationFrame: (cb: () => any) => Promise<void>;
|
|
21
22
|
export declare const debounce: <T extends any[]>(fn: (...args: T) => void, timeout: number) => {
|
|
22
23
|
(...args: T): void;
|
|
23
24
|
flush(): void;
|
|
@@ -261,9 +262,9 @@ export declare const safelyParseJSON: (json: string) => Record<string, any> | nu
|
|
|
261
262
|
*/
|
|
262
263
|
export declare const escapeDoubleQuotes: (str: string) => string;
|
|
263
264
|
export declare const castArray: <T>(value: T | T[]) => T[];
|
|
264
|
-
export declare const elementCenterPoint: (element: ExcalidrawElement, xOffset?: number, yOffset?: number) => GlobalPoint;
|
|
265
265
|
/** hack for Array.isArray type guard not working with readonly value[] */
|
|
266
266
|
export declare const isReadonlyArray: (value?: any) => value is readonly any[];
|
|
267
267
|
export declare const sizeOf: (value: readonly unknown[] | Readonly<Map<string, unknown>> | Readonly<Record<string, unknown>> | ReadonlySet<unknown>) => number;
|
|
268
268
|
export declare const reduceToCommonValue: <T, R = T>(collection: ReadonlySet<T> | readonly T[], getValue?: ((item: T) => R) | undefined) => R | null;
|
|
269
|
+
export declare const isMobileOrTablet: () => boolean;
|
|
269
270
|
export {};
|
|
@@ -27,7 +27,9 @@ export declare class Scene {
|
|
|
27
27
|
getElementsMapIncludingDeleted(): Map<string, Ordered<ExcalidrawElement>> & import("@excalidraw/common/utility-types").MakeBrand<"SceneElementsMap">;
|
|
28
28
|
getNonDeletedElements(): readonly Ordered<NonDeletedExcalidrawElement>[];
|
|
29
29
|
getFramesIncludingDeleted(): readonly ExcalidrawFrameLikeElement[];
|
|
30
|
-
constructor(elements?: ElementsMapOrArray | null
|
|
30
|
+
constructor(elements?: ElementsMapOrArray | null, options?: {
|
|
31
|
+
skipValidation?: true;
|
|
32
|
+
});
|
|
31
33
|
getSelectedElements(opts: {
|
|
32
34
|
selectedElementIds: AppState["selectedElementIds"];
|
|
33
35
|
/**
|
|
@@ -55,7 +57,9 @@ export declare class Scene {
|
|
|
55
57
|
* @returns whether a change was made
|
|
56
58
|
*/
|
|
57
59
|
mapElements(iteratee: (element: ExcalidrawElement) => ExcalidrawElement): boolean;
|
|
58
|
-
replaceAllElements(nextElements: ElementsMapOrArray
|
|
60
|
+
replaceAllElements(nextElements: ElementsMapOrArray, options?: {
|
|
61
|
+
skipValidation?: true;
|
|
62
|
+
}): void;
|
|
59
63
|
triggerUpdate(): void;
|
|
60
64
|
onUpdate(cb: SceneStateCallback): SceneStateCallbackRemover;
|
|
61
65
|
destroy(): void;
|
|
@@ -66,7 +70,7 @@ export declare class Scene {
|
|
|
66
70
|
getElementIndex(elementId: string): number;
|
|
67
71
|
getContainerElement: (element: (ExcalidrawElement & {
|
|
68
72
|
containerId: ExcalidrawElement["id"] | null;
|
|
69
|
-
}) | null) => import("@excalidraw/element/types").
|
|
73
|
+
}) | null) => import("@excalidraw/element/types").ExcalidrawLinearElement | import("@excalidraw/element/types").ExcalidrawSelectionElement | import("@excalidraw/element/types").ExcalidrawRectangleElement | import("@excalidraw/element/types").ExcalidrawDiamondElement | import("@excalidraw/element/types").ExcalidrawEllipseElement | import("@excalidraw/element/types").ExcalidrawEmbeddableElement | import("@excalidraw/element/types").ExcalidrawIframeElement | import("@excalidraw/element/types").ExcalidrawImageElement | import("@excalidraw/element/types").ExcalidrawFrameElement | import("@excalidraw/element/types").ExcalidrawMagicFrameElement | import("@excalidraw/element/types").ExcalidrawTextElement | import("@excalidraw/element/types").ExcalidrawFreeDrawElement | null;
|
|
70
74
|
getElementsFromId: (id: string) => ExcalidrawElement[];
|
|
71
75
|
mutateElement<TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, options?: {
|
|
72
76
|
informMutation: boolean;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { AppState } from "@excalidraw/excalidraw/types";
|
|
1
2
|
import type { Scene } from "./Scene";
|
|
2
3
|
import type { ExcalidrawElement } from "./types";
|
|
3
4
|
export interface Alignment {
|
|
4
5
|
position: "start" | "center" | "end";
|
|
5
6
|
axis: "x" | "y";
|
|
6
7
|
}
|
|
7
|
-
export declare const alignElements: (selectedElements: ExcalidrawElement[], alignment: Alignment, scene: Scene) => ExcalidrawElement[];
|
|
8
|
+
export declare const alignElements: (selectedElements: ExcalidrawElement[], alignment: Alignment, scene: Scene, appState: Readonly<AppState>) => ExcalidrawElement[];
|
|
@@ -16,10 +16,13 @@ export declare const shouldEnableBindingForPointerEvent: (event: React.PointerEv
|
|
|
16
16
|
export declare const isBindingEnabled: (appState: AppState) => boolean;
|
|
17
17
|
export declare const FIXED_BINDING_DISTANCE = 5;
|
|
18
18
|
export declare const BINDING_HIGHLIGHT_THICKNESS = 10;
|
|
19
|
-
export declare const BINDING_HIGHLIGHT_OFFSET = 4;
|
|
20
19
|
export declare const bindOrUnbindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, startBindingElement: ExcalidrawBindableElement | null | "keep", endBindingElement: ExcalidrawBindableElement | null | "keep", scene: Scene) => void;
|
|
21
20
|
export declare const bindOrUnbindLinearElements: (selectedElements: NonDeleted<ExcalidrawLinearElement>[], isBindingEnabled: boolean, draggingPoints: readonly number[] | null, scene: Scene, zoom?: AppState["zoom"]) => void;
|
|
22
21
|
export declare const getSuggestedBindingsForArrows: (selectedElements: NonDeleted<ExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, zoom: AppState["zoom"]) => SuggestedBinding[];
|
|
22
|
+
export declare const maybeSuggestBindingsForLinearElementAtCoords: (linearElement: NonDeleted<ExcalidrawLinearElement>, pointerCoords: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
}[], scene: Scene, zoom: AppState["zoom"], oppositeBindingBoundElement?: ExcalidrawBindableElement | null) => ExcalidrawBindableElement[];
|
|
23
26
|
export declare const maybeBindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, appState: AppState, pointerCoords: {
|
|
24
27
|
x: number;
|
|
25
28
|
y: number;
|
|
@@ -46,11 +49,11 @@ export declare const updateBindings: (latestElement: ExcalidrawElement, scene: S
|
|
|
46
49
|
};
|
|
47
50
|
zoom?: AppState["zoom"];
|
|
48
51
|
}) => void;
|
|
49
|
-
export declare const getHeadingForElbowArrowSnap: (p: Readonly<GlobalPoint>, otherPoint: Readonly<GlobalPoint>, bindableElement: ExcalidrawBindableElement | undefined | null, aabb: Bounds | undefined | null, origPoint: GlobalPoint, zoom?: AppState["zoom"]) => Heading;
|
|
50
|
-
export declare const bindPointToSnapToElementOutline: (arrow: ExcalidrawElbowArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end") => GlobalPoint;
|
|
51
|
-
export declare const avoidRectangularCorner: (element: ExcalidrawBindableElement, p: GlobalPoint) => GlobalPoint;
|
|
52
|
-
export declare const snapToMid: (element: ExcalidrawBindableElement, p: GlobalPoint, tolerance?: number) => GlobalPoint;
|
|
53
|
-
export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end") => {
|
|
52
|
+
export declare const getHeadingForElbowArrowSnap: (p: Readonly<GlobalPoint>, otherPoint: Readonly<GlobalPoint>, bindableElement: ExcalidrawBindableElement | undefined | null, aabb: Bounds | undefined | null, origPoint: GlobalPoint, elementsMap: ElementsMap, zoom?: AppState["zoom"]) => Heading;
|
|
53
|
+
export declare const bindPointToSnapToElementOutline: (arrow: ExcalidrawElbowArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap) => GlobalPoint;
|
|
54
|
+
export declare const avoidRectangularCorner: (element: ExcalidrawBindableElement, elementsMap: ElementsMap, p: GlobalPoint) => GlobalPoint;
|
|
55
|
+
export declare const snapToMid: (element: ExcalidrawBindableElement, elementsMap: ElementsMap, p: GlobalPoint, tolerance?: number) => GlobalPoint;
|
|
56
|
+
export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", elementsMap: ElementsMap) => {
|
|
54
57
|
fixedPoint: FixedPoint;
|
|
55
58
|
};
|
|
56
59
|
export declare const fixDuplicatedBindingsAfterDuplication: (duplicatedElements: ExcalidrawElement[], origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicateElementsMap: NonDeletedSceneElementsMap) => void;
|
|
@@ -101,7 +104,7 @@ export declare class BindableElement {
|
|
|
101
104
|
*/
|
|
102
105
|
static rebindAffected: (elements: ElementsMap, bindableElement: ExcalidrawElement | undefined, updateElementWith: (affected: ExcalidrawElement, updates: ElementUpdate<ExcalidrawElement>) => void) => void;
|
|
103
106
|
}
|
|
104
|
-
export declare const getGlobalFixedPointForBindableElement: (fixedPointRatio: [number, number], element: ExcalidrawBindableElement) => GlobalPoint;
|
|
107
|
+
export declare const getGlobalFixedPointForBindableElement: (fixedPointRatio: [number, number], element: ExcalidrawBindableElement, elementsMap: ElementsMap) => GlobalPoint;
|
|
105
108
|
export declare const getGlobalFixedPoints: (arrow: ExcalidrawElbowArrowElement, elementsMap: ElementsMap) => [GlobalPoint, GlobalPoint];
|
|
106
109
|
export declare const getArrowLocalFixedPoints: (arrow: ExcalidrawElbowArrowElement, elementsMap: ElementsMap) => LocalPoint[];
|
|
107
110
|
export declare const normalizeFixedPoint: <T extends FixedPoint | null>(fixedPoint: T) => T extends null ? null : FixedPoint;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Degrees, GlobalPoint, LineSegment } from "@excalidraw/math";
|
|
1
|
+
import type { Degrees, GlobalPoint, LineSegment, LocalPoint } from "@excalidraw/math";
|
|
2
2
|
import type { AppState } from "@excalidraw/excalidraw/types";
|
|
3
3
|
import type { Drawable, Op } from "roughjs/bin/core";
|
|
4
4
|
import type { Arrowhead, ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawFreeDrawElement, ExcalidrawLinearElement, NonDeleted } from "./types";
|
|
@@ -26,7 +26,8 @@ export type SceneBounds = readonly [
|
|
|
26
26
|
];
|
|
27
27
|
export declare class ElementBounds {
|
|
28
28
|
private static boundsCache;
|
|
29
|
-
static
|
|
29
|
+
private static nonRotatedBoundsCache;
|
|
30
|
+
static getBounds(element: ExcalidrawElement, elementsMap: ElementsMap, nonRotated?: boolean): Bounds;
|
|
30
31
|
private static calculateBounds;
|
|
31
32
|
}
|
|
32
33
|
export declare const getElementAbsoluteCoords: (element: ExcalidrawElement, elementsMap: ElementsMap, includeBoundText?: boolean) => [number, number, number, number, number, number];
|
|
@@ -43,6 +44,7 @@ export declare const getElementLineSegments: (element: ExcalidrawElement, elemen
|
|
|
43
44
|
*/
|
|
44
45
|
export declare const getRectangleBoxAbsoluteCoords: (boxSceneCoords: RectangleBox) => number[];
|
|
45
46
|
export declare const getDiamondPoints: (element: ExcalidrawElement) => number[];
|
|
47
|
+
export declare const getCubicBezierCurveBound: (p0: GlobalPoint, p1: GlobalPoint, p2: GlobalPoint, p3: GlobalPoint) => Bounds;
|
|
46
48
|
export declare const getMinMaxXYFromCurvePathOps: (ops: Op[], transformXY?: ((p: GlobalPoint) => GlobalPoint) | undefined) => Bounds;
|
|
47
49
|
export declare const getBoundsFromPoints: (points: ExcalidrawFreeDrawElement["points"]) => Bounds;
|
|
48
50
|
/** @returns number in pixels */
|
|
@@ -50,7 +52,7 @@ export declare const getArrowheadSize: (arrowhead: Arrowhead) => number;
|
|
|
50
52
|
/** @returns number in degrees */
|
|
51
53
|
export declare const getArrowheadAngle: (arrowhead: Arrowhead) => Degrees;
|
|
52
54
|
export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead) => number[] | null;
|
|
53
|
-
export declare const getElementBounds: (element: ExcalidrawElement, elementsMap: ElementsMap) => Bounds;
|
|
55
|
+
export declare const getElementBounds: (element: ExcalidrawElement, elementsMap: ElementsMap, nonRotated?: boolean) => Bounds;
|
|
54
56
|
export declare const getCommonBounds: (elements: ElementsMapOrArray, elementsMap?: ElementsMap) => Bounds;
|
|
55
57
|
export declare const getDraggedElementsBounds: (elements: ExcalidrawElement[], dragOffset: {
|
|
56
58
|
x: number;
|
|
@@ -72,10 +74,16 @@ export interface BoundingBox {
|
|
|
72
74
|
width: number;
|
|
73
75
|
height: number;
|
|
74
76
|
}
|
|
75
|
-
export declare const getCommonBoundingBox: (elements: ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[]) => BoundingBox;
|
|
77
|
+
export declare const getCommonBoundingBox: (elements: readonly ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[]) => BoundingBox;
|
|
76
78
|
/**
|
|
77
79
|
* returns scene coords of user's editor viewport (visible canvas area) bounds
|
|
78
80
|
*/
|
|
79
81
|
export declare const getVisibleSceneBounds: ({ scrollX, scrollY, width, height, zoom, }: AppState) => SceneBounds;
|
|
80
82
|
export declare const getCenterForBounds: (bounds: Bounds) => GlobalPoint;
|
|
83
|
+
/**
|
|
84
|
+
* Get the axis-aligned bounding box for a given element
|
|
85
|
+
*/
|
|
86
|
+
export declare const aabbForElement: (element: Readonly<ExcalidrawElement>, elementsMap: ElementsMap, offset?: [number, number, number, number]) => Bounds;
|
|
87
|
+
export declare const pointInsideBounds: <P extends GlobalPoint | LocalPoint>(p: P, bounds: Bounds) => boolean;
|
|
81
88
|
export declare const doBoundsIntersect: (bounds1: Bounds | null, bounds2: Bounds | null) => boolean;
|
|
89
|
+
export declare const elementCenterPoint: (element: ExcalidrawElement, elementsMap: ElementsMap, xOffset?: number, yOffset?: number) => GlobalPoint;
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { GlobalPoint, LineSegment, LocalPoint } from "@excalidraw/math";
|
|
1
|
+
import type { GlobalPoint, LineSegment } from "@excalidraw/math";
|
|
3
2
|
import type { FrameNameBounds } from "@excalidraw/excalidraw/types";
|
|
4
3
|
import type { ElementsMap, ExcalidrawElement } from "./types";
|
|
5
4
|
export declare const shouldTestInside: (element: ExcalidrawElement) => boolean;
|
|
6
|
-
export type HitTestArgs
|
|
7
|
-
|
|
8
|
-
y: number;
|
|
5
|
+
export type HitTestArgs = {
|
|
6
|
+
point: GlobalPoint;
|
|
9
7
|
element: ExcalidrawElement;
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
threshold: number;
|
|
9
|
+
elementsMap: ElementsMap;
|
|
12
10
|
frameNameBound?: FrameNameBounds | null;
|
|
13
11
|
};
|
|
14
|
-
export declare const hitElementItself:
|
|
15
|
-
export declare const hitElementBoundingBox: (
|
|
16
|
-
export declare const hitElementBoundingBoxOnly:
|
|
17
|
-
export declare const hitElementBoundText:
|
|
12
|
+
export declare const hitElementItself: ({ point, element, threshold, elementsMap, frameNameBound, }: HitTestArgs) => boolean;
|
|
13
|
+
export declare const hitElementBoundingBox: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap, tolerance?: number) => boolean;
|
|
14
|
+
export declare const hitElementBoundingBoxOnly: (hitArgs: HitTestArgs, elementsMap: ElementsMap) => boolean;
|
|
15
|
+
export declare const hitElementBoundText: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap) => boolean;
|
|
18
16
|
/**
|
|
19
17
|
* Intersect a line with an element for binding test
|
|
20
18
|
*
|
|
@@ -23,4 +21,12 @@ export declare const hitElementBoundText: <Point extends GlobalPoint | LocalPoin
|
|
|
23
21
|
* @param offset
|
|
24
22
|
* @returns
|
|
25
23
|
*/
|
|
26
|
-
export declare const intersectElementWithLineSegment: (element: ExcalidrawElement, line: LineSegment<GlobalPoint>, offset?: number) => GlobalPoint[];
|
|
24
|
+
export declare const intersectElementWithLineSegment: (element: ExcalidrawElement, elementsMap: ElementsMap, line: LineSegment<GlobalPoint>, offset?: number, onlyFirst?: boolean) => GlobalPoint[];
|
|
25
|
+
/**
|
|
26
|
+
* Check if the given point is considered inside the element's border
|
|
27
|
+
*
|
|
28
|
+
* @param point
|
|
29
|
+
* @param element
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
export declare const isPointInElement: (point: GlobalPoint, element: ExcalidrawElement, elementsMap: ElementsMap) => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TransformHandleType } from "./transformHandles";
|
|
2
2
|
import type { ElementsMap, ExcalidrawImageElement, ImageCrop } from "./types";
|
|
3
3
|
export declare const MINIMAL_CROP_SIZE = 10;
|
|
4
|
-
export declare const cropElement: (element: ExcalidrawImageElement, transformHandle: TransformHandleType, naturalWidth: number, naturalHeight: number, pointerX: number, pointerY: number, widthAspectRatio?: number) => {
|
|
4
|
+
export declare const cropElement: (element: ExcalidrawImageElement, elementsMap: ElementsMap, transformHandle: TransformHandleType, naturalWidth: number, naturalHeight: number, pointerX: number, pointerY: number, widthAspectRatio?: number) => {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
7
7
|
width: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExcalidrawElement, Ordered, OrderedExcalidrawElement, SceneElementsMap } from "@excalidraw/element/types";
|
|
2
2
|
import type { DTO, ValueOf } from "@excalidraw/common/utility-types";
|
|
3
3
|
import type { AppState, ObservedAppState } from "@excalidraw/excalidraw/types";
|
|
4
|
-
import
|
|
4
|
+
import { StoreSnapshot } from "./store";
|
|
5
5
|
/**
|
|
6
6
|
* Represents the difference between two objects of the same type.
|
|
7
7
|
*
|
|
@@ -15,7 +15,7 @@ export declare class Delta<T> {
|
|
|
15
15
|
readonly deleted: Partial<T>;
|
|
16
16
|
readonly inserted: Partial<T>;
|
|
17
17
|
private constructor();
|
|
18
|
-
static create<T>(deleted: Partial<T>, inserted: Partial<T>, modifier?: (delta: Partial<T
|
|
18
|
+
static create<T>(deleted: Partial<T>, inserted: Partial<T>, modifier?: (delta: Partial<T>, partialType: "deleted" | "inserted") => Partial<T>, modifierOptions?: "deleted" | "inserted" | "both"): Delta<T>;
|
|
19
19
|
/**
|
|
20
20
|
* Calculates the delta between two objects.
|
|
21
21
|
*
|
|
@@ -29,12 +29,16 @@ export declare class Delta<T> {
|
|
|
29
29
|
}>(prevObject: T, nextObject: T, modifier?: (partial: Partial<T>) => Partial<T>, postProcess?: (deleted: Partial<T>, inserted: Partial<T>) => [Partial<T>, Partial<T>]): Delta<T>;
|
|
30
30
|
static empty(): Delta<unknown>;
|
|
31
31
|
static isEmpty<T>(delta: Delta<T>): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Merges two deltas into a new one.
|
|
34
|
+
*/
|
|
35
|
+
static merge<T>(delta1: Delta<T>, delta2: Delta<T>, delta3?: Delta<T>): Delta<T>;
|
|
32
36
|
/**
|
|
33
37
|
* Merges deleted and inserted object partials.
|
|
34
38
|
*/
|
|
35
39
|
static mergeObjects<T extends {
|
|
36
40
|
[key: string]: unknown;
|
|
37
|
-
}>(prev: T, added: T, removed
|
|
41
|
+
}>(prev: T, added: T, removed?: T): T;
|
|
38
42
|
/**
|
|
39
43
|
* Merges deleted and inserted array partials.
|
|
40
44
|
*/
|
|
@@ -55,6 +59,14 @@ export declare class Delta<T> {
|
|
|
55
59
|
* Compares if object2 contains any different value compared to the object1.
|
|
56
60
|
*/
|
|
57
61
|
static isRightDifferent<T extends {}>(object1: T, object2: T, skipShallowCompare?: boolean): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Compares if shared properties of object1 and object2 contain any different value (aka inner join).
|
|
64
|
+
*/
|
|
65
|
+
static isInnerDifferent<T extends {}>(object1: T, object2: T, skipShallowCompare?: boolean): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Compares if any properties of object1 and object2 contain any different value (aka full join).
|
|
68
|
+
*/
|
|
69
|
+
static isDifferent<T extends {}>(object1: T, object2: T, skipShallowCompare?: boolean): boolean;
|
|
58
70
|
/**
|
|
59
71
|
* Returns sorted object1 keys that have distinct values.
|
|
60
72
|
*/
|
|
@@ -63,6 +75,14 @@ export declare class Delta<T> {
|
|
|
63
75
|
* Returns sorted object2 keys that have distinct values.
|
|
64
76
|
*/
|
|
65
77
|
static getRightDifferences<T extends {}>(object1: T, object2: T, skipShallowCompare?: boolean): string[];
|
|
78
|
+
/**
|
|
79
|
+
* Returns sorted keys of shared object1 and object2 properties that have distinct values (aka inner join).
|
|
80
|
+
*/
|
|
81
|
+
static getInnerDifferences<T extends {}>(object1: T, object2: T, skipShallowCompare?: boolean): string[];
|
|
82
|
+
/**
|
|
83
|
+
* Returns sorted keys that have distinct values between object1 and object2 (aka full join).
|
|
84
|
+
*/
|
|
85
|
+
static getDifferences<T extends {}>(object1: T, object2: T, skipShallowCompare?: boolean): string[];
|
|
66
86
|
/**
|
|
67
87
|
* Iterator comparing values of object properties based on the passed joining strategy.
|
|
68
88
|
*
|
|
@@ -86,18 +106,24 @@ export interface DeltaContainer<T> {
|
|
|
86
106
|
* @returns a tuple of the next object `T` with applied `Delta`s, and `boolean`, indicating whether the applied deltas resulted in a visible change.
|
|
87
107
|
*/
|
|
88
108
|
applyTo(previous: T, ...options: unknown[]): [T, boolean];
|
|
109
|
+
/**
|
|
110
|
+
* Squashes the current delta with the given one.
|
|
111
|
+
*/
|
|
112
|
+
squash(delta: DeltaContainer<T>): this;
|
|
89
113
|
/**
|
|
90
114
|
* Checks whether all `Delta`s are empty.
|
|
91
115
|
*/
|
|
92
116
|
isEmpty(): boolean;
|
|
93
117
|
}
|
|
94
118
|
export declare class AppStateDelta implements DeltaContainer<AppState> {
|
|
95
|
-
|
|
119
|
+
delta: Delta<ObservedAppState>;
|
|
96
120
|
private constructor();
|
|
121
|
+
static create(delta: Delta<ObservedAppState>): AppStateDelta;
|
|
97
122
|
static calculate<T extends ObservedAppState>(prevAppState: T, nextAppState: T): AppStateDelta;
|
|
98
123
|
static restore(appStateDeltaDTO: DTO<AppStateDelta>): AppStateDelta;
|
|
99
124
|
static empty(): AppStateDelta;
|
|
100
125
|
inverse(): AppStateDelta;
|
|
126
|
+
squash(delta: AppStateDelta): this;
|
|
101
127
|
applyTo(appState: AppState, nextElements: SceneElementsMap): [AppState, boolean];
|
|
102
128
|
isEmpty(): boolean;
|
|
103
129
|
/**
|
|
@@ -106,7 +132,6 @@ export declare class AppStateDelta implements DeltaContainer<AppState> {
|
|
|
106
132
|
* @returns `true` if a visible change is found, `false` otherwise.
|
|
107
133
|
*/
|
|
108
134
|
private filterInvisibleChanges;
|
|
109
|
-
private static convertToAppStateKey;
|
|
110
135
|
private static filterSelectedElements;
|
|
111
136
|
private static filterSelectedGroups;
|
|
112
137
|
private static stripElementsProps;
|
|
@@ -118,7 +143,10 @@ export declare class AppStateDelta implements DeltaContainer<AppState> {
|
|
|
118
143
|
private static postProcess;
|
|
119
144
|
private static orderAppStateKeys;
|
|
120
145
|
}
|
|
121
|
-
type ElementPartial<
|
|
146
|
+
type ElementPartial<TElement extends ExcalidrawElement = ExcalidrawElement> = Omit<Partial<Ordered<TElement>>, "id" | "updated" | "seed">;
|
|
147
|
+
export type ApplyToOptions = {
|
|
148
|
+
excludedProperties?: Set<keyof ElementPartial>;
|
|
149
|
+
};
|
|
122
150
|
/**
|
|
123
151
|
* Elements change is a low level primitive to capture a change between two sets of elements.
|
|
124
152
|
* It does so by encapsulating forward and backward `Delta`s, allowing to time-travel in both directions.
|
|
@@ -135,6 +163,8 @@ export declare class ElementsDelta implements DeltaContainer<SceneElementsMap> {
|
|
|
135
163
|
private static satisfiesAddition;
|
|
136
164
|
private static satisfiesRemoval;
|
|
137
165
|
private static satisfiesUpdate;
|
|
166
|
+
private static satisfiesCommmonInvariants;
|
|
167
|
+
private static satisfiesUniqueInvariants;
|
|
138
168
|
private static validate;
|
|
139
169
|
/**
|
|
140
170
|
* Calculates the `Delta`s between the previous and next set of elements.
|
|
@@ -151,12 +181,13 @@ export declare class ElementsDelta implements DeltaContainer<SceneElementsMap> {
|
|
|
151
181
|
/**
|
|
152
182
|
* Update delta/s based on the existing elements.
|
|
153
183
|
*
|
|
154
|
-
* @param
|
|
184
|
+
* @param nextElements current elements
|
|
155
185
|
* @param modifierOptions defines which of the delta (`deleted` or `inserted`) will be updated
|
|
156
186
|
* @returns new instance with modified delta/s
|
|
157
187
|
*/
|
|
158
|
-
applyLatestChanges(
|
|
159
|
-
applyTo(elements: SceneElementsMap,
|
|
188
|
+
applyLatestChanges(prevElements: SceneElementsMap, nextElements: SceneElementsMap, modifierOptions?: "deleted" | "inserted"): ElementsDelta;
|
|
189
|
+
applyTo(elements: SceneElementsMap, snapshot?: StoreSnapshot["elements"], options?: ApplyToOptions): [SceneElementsMap, boolean];
|
|
190
|
+
squash(delta: ElementsDelta): this;
|
|
160
191
|
private static createApplier;
|
|
161
192
|
private static createGetter;
|
|
162
193
|
private static applyDelta;
|
|
@@ -183,6 +214,7 @@ export declare class ElementsDelta implements DeltaContainer<SceneElementsMap> {
|
|
|
183
214
|
* should be rebound (if possible) with the current element ~ bindings should be bidirectional.
|
|
184
215
|
*/
|
|
185
216
|
private static rebindAffected;
|
|
217
|
+
static redrawElements(nextElements: SceneElementsMap, changedElements: Map<string, OrderedExcalidrawElement>): SceneElementsMap;
|
|
186
218
|
private static redrawTextBoundingBoxes;
|
|
187
219
|
private static redrawBoundArrows;
|
|
188
220
|
private static reorderElements;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { GlobalPoint } from "@excalidraw/math";
|
|
2
|
-
import type {
|
|
3
|
-
export declare const
|
|
2
|
+
import type { ElementsMap, ExcalidrawElement } from "./types";
|
|
3
|
+
export declare const distanceToElement: (element: ExcalidrawElement, elementsMap: ElementsMap, p: GlobalPoint) => number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { AppState } from "@excalidraw/excalidraw/types";
|
|
1
2
|
import type { ElementsMap, ExcalidrawElement } from "./types";
|
|
2
3
|
export interface Distribution {
|
|
3
4
|
space: "between";
|
|
4
5
|
axis: "x" | "y";
|
|
5
6
|
}
|
|
6
|
-
export declare const distributeElements: (selectedElements: ExcalidrawElement[], elementsMap: ElementsMap, distribution: Distribution) => ExcalidrawElement[];
|
|
7
|
+
export declare const distributeElements: (selectedElements: ExcalidrawElement[], elementsMap: ElementsMap, distribution: Distribution, appState: Readonly<AppState>) => ExcalidrawElement[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ElementsMap, ExcalidrawElement, OrderedExcalidrawElement } from "./types";
|
|
1
|
+
import type { ElementsMap, ExcalidrawElement, OrderedExcalidrawElement, SceneElementsMap } from "./types";
|
|
2
2
|
export declare class InvalidFractionalIndexError extends Error {
|
|
3
3
|
code: "ELEMENT_HAS_INVALID_INDEX";
|
|
4
4
|
}
|
|
@@ -44,8 +44,14 @@ export declare const orderByFractionalIndex: (elements: OrderedExcalidrawElement
|
|
|
44
44
|
*/
|
|
45
45
|
export declare const syncMovedIndices: (elements: readonly ExcalidrawElement[], movedElements: ElementsMap) => OrderedExcalidrawElement[];
|
|
46
46
|
/**
|
|
47
|
-
* Synchronizes all invalid fractional indices
|
|
47
|
+
* Synchronizes all invalid fractional indices within the array order by mutating elements in the passed array.
|
|
48
48
|
*
|
|
49
49
|
* WARN: in edge cases it could modify the elements which were not moved, as it's impossible to guess the actually moved elements from the elements array itself.
|
|
50
50
|
*/
|
|
51
51
|
export declare const syncInvalidIndices: (elements: readonly ExcalidrawElement[]) => OrderedExcalidrawElement[];
|
|
52
|
+
/**
|
|
53
|
+
* Synchronizes all invalid fractional indices within the array order by creating new instances of elements with corrected indices.
|
|
54
|
+
*
|
|
55
|
+
* WARN: in edge cases it could modify the elements which were not moved, as it's impossible to guess the actually moved elements from the elements array itself.
|
|
56
|
+
*/
|
|
57
|
+
export declare const syncInvalidIndicesImmutable: (elements: readonly ExcalidrawElement[]) => SceneElementsMap | undefined;
|
|
@@ -31,8 +31,8 @@ export declare const getFrameLikeElements: (allElements: ExcalidrawElementsInclu
|
|
|
31
31
|
*/
|
|
32
32
|
export declare const getRootElements: (allElements: ExcalidrawElementsIncludingDeleted) => ExcalidrawElement[];
|
|
33
33
|
export declare const getElementsInResizingFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, appState: AppState, elementsMap: ElementsMap) => ExcalidrawElement[];
|
|
34
|
-
export declare const getElementsInNewFrame: (elements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => (import("./types").
|
|
35
|
-
export declare const omitPartialGroups: (elements: ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, allElementsMap: ElementsMap) => (import("./types").
|
|
34
|
+
export declare const getElementsInNewFrame: (elements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap) => (import("./types").ExcalidrawLinearElement | import("./types").ExcalidrawSelectionElement | import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawEmbeddableElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawTextElement | import("./types").ExcalidrawFreeDrawElement)[];
|
|
35
|
+
export declare const omitPartialGroups: (elements: ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, allElementsMap: ElementsMap) => (import("./types").ExcalidrawLinearElement | import("./types").ExcalidrawSelectionElement | import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawEmbeddableElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawTextElement | import("./types").ExcalidrawFreeDrawElement)[];
|
|
36
36
|
export declare const getContainingFrame: (element: ExcalidrawElement, elementsMap: ElementsMap) => ExcalidrawFrameLikeElement | null;
|
|
37
37
|
/** */
|
|
38
38
|
export declare const filterElementsEligibleAsFrameChildren: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => ExcalidrawElement[];
|
|
@@ -31,3 +31,4 @@ export declare const getNonDeletedGroupIds: (elements: ElementsMap) => Set<strin
|
|
|
31
31
|
export declare const elementsAreInSameGroup: (elements: readonly ExcalidrawElement[]) => boolean;
|
|
32
32
|
export declare const isInGroup: (element: NonDeletedExcalidrawElement) => boolean;
|
|
33
33
|
export declare const getNewGroupIdsForDuplication: (groupIds: ExcalidrawElement["groupIds"], editingGroupId: AppState["editingGroupId"], mapper: (groupId: GroupId) => GroupId) => string[];
|
|
34
|
+
export declare const getSelectedElementsByGroup: (selectedElements: ExcalidrawElement[], elementsMap: ElementsMap, appState: Readonly<AppState>) => ExcalidrawElement[][];
|
|
@@ -38,14 +38,13 @@ export * from "./image";
|
|
|
38
38
|
export * from "./linearElementEditor";
|
|
39
39
|
export * from "./mutateElement";
|
|
40
40
|
export * from "./newElement";
|
|
41
|
+
export * from "./positionElementsOnGrid";
|
|
41
42
|
export * from "./renderElement";
|
|
42
43
|
export * from "./resizeElements";
|
|
43
44
|
export * from "./resizeTest";
|
|
44
45
|
export * from "./Scene";
|
|
45
46
|
export * from "./selection";
|
|
46
|
-
export * from "./
|
|
47
|
-
export * from "./ShapeCache";
|
|
48
|
-
export * from "./shapes";
|
|
47
|
+
export * from "./shape";
|
|
49
48
|
export * from "./showSelectedShapeActions";
|
|
50
49
|
export * from "./sizeHelpers";
|
|
51
50
|
export * from "./sortElements";
|