@excalidraw/excalidraw 0.18.0-6fc8502 → 0.18.0-864353b
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-X3RYHLJU.js → chunk-7YMZV3TY.js} +14 -4
- package/dist/dev/chunk-7YMZV3TY.js.map +7 -0
- package/dist/dev/chunk-BBNNHA7I.js +7 -0
- package/dist/dev/chunk-BBNNHA7I.js.map +7 -0
- package/dist/dev/{chunk-KYBDXI6F.js → chunk-LL55DS44.js} +15037 -10099
- package/dist/dev/chunk-LL55DS44.js.map +7 -0
- package/dist/dev/data/{image-NKFINVKH.js → image-OFYK7EOY.js} +3 -3
- package/dist/dev/index.css +100 -22
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +3531 -6486
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/locales/{en-CKWC2GMK.js → en-KIY5SGI3.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-F44EGBV2.js +33 -0
- package/dist/prod/{chunk-IUH5AXLB.js → chunk-OUULIERA.js} +4 -4
- package/dist/prod/chunk-UH6Q3EIV.js +7 -0
- package/dist/prod/data/image-CUOH64HE.js +1 -0
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +18 -17
- package/dist/prod/locales/{en-SBO6ZHT2.js → en-GCLCIHXH.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 +11 -1
- package/dist/types/{excalidraw → common/src}/emitter.d.ts +1 -1
- package/dist/types/common/src/font-metadata.d.ts +4 -2
- package/dist/types/common/src/index.d.ts +1 -0
- package/dist/types/common/src/utility-types.d.ts +5 -0
- package/dist/types/common/src/utils.d.ts +22 -4
- package/dist/types/{excalidraw/scene → element/src}/Scene.d.ts +11 -14
- package/dist/types/element/src/ShapeCache.d.ts +1 -1
- package/dist/types/element/src/align.d.ts +3 -3
- package/dist/types/element/src/binding.d.ts +19 -12
- package/dist/types/element/src/bounds.d.ts +2 -2
- package/dist/types/element/src/collision.d.ts +1 -1
- package/dist/types/{excalidraw/change.d.ts → element/src/delta.d.ts} +40 -35
- package/dist/types/element/src/dragElements.d.ts +3 -2
- package/dist/types/element/src/duplicate.d.ts +10 -13
- package/dist/types/element/src/elbowArrow.d.ts +1 -1
- package/dist/types/element/src/flowchart.d.ts +3 -2
- package/dist/types/element/src/fractionalIndex.d.ts +2 -2
- package/dist/types/element/src/frame.d.ts +5 -4
- package/dist/types/element/src/index.d.ts +45 -2
- package/dist/types/element/src/linearElementEditor.d.ts +20 -31
- package/dist/types/element/src/mutateElement.d.ts +10 -2
- package/dist/types/element/src/newElement.d.ts +4 -3
- package/dist/types/element/src/resizeElements.d.ts +4 -4
- package/dist/types/element/src/selection.d.ts +11 -5
- package/dist/types/element/src/shapes.d.ts +5 -1
- package/dist/types/element/src/sizeHelpers.d.ts +2 -2
- package/dist/types/element/src/store.d.ts +227 -0
- package/dist/types/element/src/textElement.d.ts +5 -3
- 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 +14 -1
- package/dist/types/element/src/zindex.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +39 -45
- package/dist/types/excalidraw/actions/actionAlign.d.ts +8 -8
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +26 -30
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +262 -288
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +81 -92
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +13 -15
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +38 -43
- 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 +13 -15
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +41 -46
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +13 -15
- package/dist/types/excalidraw/actions/actionExport.d.ts +210 -228
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +72 -36
- package/dist/types/excalidraw/actions/actionFlip.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionFrame.d.ts +96 -104
- package/dist/types/excalidraw/actions/actionGroup.d.ts +32 -36
- package/dist/types/excalidraw/actions/actionHistory.d.ts +1 -2
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +505 -14
- package/dist/types/excalidraw/actions/actionLink.d.ts +13 -15
- package/dist/types/excalidraw/actions/actionMenu.d.ts +39 -45
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +25 -29
- package/dist/types/excalidraw/actions/actionProperties.d.ts +192 -214
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +15 -17
- package/dist/types/excalidraw/actions/actionStyles.d.ts +17 -19
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +15 -17
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +15 -17
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +15 -190
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +15 -17
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +15 -17
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +15 -17
- package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -8
- package/dist/types/excalidraw/actions/types.d.ts +4 -3
- package/dist/types/excalidraw/appState.d.ts +38 -29
- package/dist/types/excalidraw/components/App.d.ts +24 -11
- package/dist/types/excalidraw/components/ButtonIcon.d.ts +1 -0
- package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -1
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +5 -1
- package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +1 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -3
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -3
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -2
- package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +1 -1
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +1 -1
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +23 -0
- package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +4 -3
- package/dist/types/excalidraw/components/{ButtonIconSelect.d.ts → RadioSelection.d.ts} +1 -1
- package/dist/types/excalidraw/components/Range.d.ts +3 -3
- package/dist/types/excalidraw/components/Stats/Angle.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +2 -1
- package/dist/types/excalidraw/components/Stats/Dimension.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/FontSize.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/MultiFontSize.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/Position.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -11
- package/dist/types/excalidraw/components/UnlockPopup.d.ts +8 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +1 -0
- package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -1
- package/dist/types/excalidraw/components/icons.d.ts +3 -0
- package/dist/types/excalidraw/components/shapes.d.ts +1 -1
- package/dist/types/excalidraw/data/blob.d.ts +1 -1
- package/dist/types/excalidraw/data/transform.d.ts +1 -1
- package/dist/types/excalidraw/editor-jotai.d.ts +6 -6
- package/dist/types/excalidraw/eraser/index.d.ts +14 -0
- package/dist/types/excalidraw/fonts/Fonts.d.ts +1 -1
- package/dist/types/excalidraw/history.d.ts +14 -22
- package/dist/types/excalidraw/hooks/useEmitter.d.ts +1 -1
- package/dist/types/excalidraw/index.d.ts +9 -9
- package/dist/types/excalidraw/lasso/index.d.ts +1 -0
- package/dist/types/excalidraw/lasso/utils.d.ts +1 -2
- package/dist/types/excalidraw/renderer/helpers.d.ts +7 -2
- package/dist/types/excalidraw/scene/Renderer.d.ts +1 -1
- package/dist/types/excalidraw/scene/index.d.ts +2 -2
- package/dist/types/excalidraw/scene/scrollbars.d.ts +2 -3
- package/dist/types/excalidraw/scene/types.d.ts +2 -0
- package/dist/types/excalidraw/snapping.d.ts +2 -2
- package/dist/types/excalidraw/types.d.ts +28 -6
- package/dist/types/excalidraw/visualdebug.d.ts +1 -1
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +3 -1
- package/dist/types/math/src/angle.d.ts +2 -0
- package/dist/types/math/src/curve.d.ts +2 -0
- package/dist/types/math/src/point.d.ts +1 -1
- package/dist/types/math/src/types.d.ts +1 -0
- package/dist/types/math/src/vector.d.ts +4 -0
- package/dist/types/utils/src/bbox.d.ts +1 -1
- package/dist/types/utils/src/index.d.ts +1 -1
- package/dist/types/utils/src/withinBounds.d.ts +1 -1
- package/history.ts +68 -94
- package/package.json +3 -3
- package/dist/dev/chunk-H7XJ5UVD.js +0 -7
- package/dist/dev/chunk-H7XJ5UVD.js.map +0 -7
- package/dist/dev/chunk-KYBDXI6F.js.map +0 -7
- package/dist/dev/chunk-X3RYHLJU.js.map +0 -7
- package/dist/prod/chunk-CAN5RS4P.js +0 -31
- package/dist/prod/chunk-KJYFYP64.js +0 -7
- package/dist/prod/data/image-5XD47O4X.js +0 -1
- package/dist/types/excalidraw/components/ButtonSelect.d.ts +0 -9
- package/dist/types/excalidraw/store.d.ts +0 -129
- /package/dist/dev/data/{image-NKFINVKH.js.map → image-OFYK7EOY.js.map} +0 -0
- /package/dist/dev/locales/{en-CKWC2GMK.js.map → en-KIY5SGI3.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-OUULIERA.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-UH6Q3EIV.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-UH6Q3EIV.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};
|
|
@@ -82,11 +82,13 @@ export declare const YOUTUBE_STATES: {
|
|
|
82
82
|
export declare const ENV: {
|
|
83
83
|
TEST: string;
|
|
84
84
|
DEVELOPMENT: string;
|
|
85
|
+
PRODUCTION: string;
|
|
85
86
|
};
|
|
86
87
|
export declare const CLASSES: {
|
|
87
88
|
SHAPE_ACTIONS_MENU: string;
|
|
88
89
|
ZOOM_ACTIONS: string;
|
|
89
90
|
SEARCH_MENU_INPUT_WRAPPER: string;
|
|
91
|
+
CONVERT_ELEMENT_TYPE_POPUP: string;
|
|
90
92
|
};
|
|
91
93
|
export declare const CJK_HAND_DRAWN_FALLBACK_FONT = "Xiaolai";
|
|
92
94
|
export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
|
|
@@ -107,6 +109,7 @@ export declare const FONT_FAMILY: {
|
|
|
107
109
|
"Lilita One": number;
|
|
108
110
|
"Comic Shanns": number;
|
|
109
111
|
"Liberation Sans": number;
|
|
112
|
+
Assistant: number;
|
|
110
113
|
};
|
|
111
114
|
export declare const FONT_FAMILY_FALLBACKS: {
|
|
112
115
|
Xiaolai: number;
|
|
@@ -193,7 +196,7 @@ export declare const EXPORT_DATA_TYPES: {
|
|
|
193
196
|
readonly excalidrawLibrary: "excalidrawlib";
|
|
194
197
|
readonly excalidrawClipboardWithAPI: "excalidraw-api/clipboard";
|
|
195
198
|
};
|
|
196
|
-
export declare const
|
|
199
|
+
export declare const getExportSource: () => string;
|
|
197
200
|
export declare const IMAGE_RENDER_TIMEOUT = 500;
|
|
198
201
|
export declare const TAP_TWICE_TIMEOUT = 300;
|
|
199
202
|
export declare const TOUCH_CTX_MENU_TIMEOUT = 500;
|
|
@@ -224,6 +227,7 @@ export declare const DEFAULT_EXPORT_PADDING = 10;
|
|
|
224
227
|
export declare const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 1440;
|
|
225
228
|
export declare const MAX_ALLOWED_FILE_BYTES: number;
|
|
226
229
|
export declare const SVG_NS = "http://www.w3.org/2000/svg";
|
|
230
|
+
export declare const SVG_DOCUMENT_PREAMBLE = "<?xml version=\"1.0\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n";
|
|
227
231
|
export declare const ENCRYPTION_KEY_BITS = 128;
|
|
228
232
|
export declare const VERSIONS: {
|
|
229
233
|
readonly excalidraw: 2;
|
|
@@ -322,3 +326,9 @@ export declare enum UserIdleState {
|
|
|
322
326
|
AWAY = "away",
|
|
323
327
|
IDLE = "idle"
|
|
324
328
|
}
|
|
329
|
+
/**
|
|
330
|
+
* distance at which we merge points instead of adding a new merge-point
|
|
331
|
+
* when converting a line to a polygon (merge currently means overlaping
|
|
332
|
+
* the start and end points)
|
|
333
|
+
*/
|
|
334
|
+
export declare const LINE_POLYGON_POINT_MERGE_DISTANCE = 20;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UnsubscribeCallback } from "
|
|
1
|
+
import type { UnsubscribeCallback } from "@excalidraw/excalidraw/types";
|
|
2
2
|
type Subscriber<T extends any[]> = (...payload: T) => void;
|
|
3
3
|
export declare class Emitter<T extends any[] = []> {
|
|
4
4
|
subscribers: Subscriber<T>[];
|
|
@@ -16,8 +16,10 @@ export interface FontMetadata {
|
|
|
16
16
|
};
|
|
17
17
|
/** flag to indicate a deprecated font */
|
|
18
18
|
deprecated?: true;
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* whether this is a font that users can use (= shown in font picker)
|
|
21
|
+
*/
|
|
22
|
+
private?: true;
|
|
21
23
|
/** flag to indiccate a local-only font */
|
|
22
24
|
local?: true;
|
|
23
25
|
/** flag to indicate a fallback font */
|
|
@@ -31,3 +31,8 @@ export type MakeBrand<T extends string> = {
|
|
|
31
31
|
/** Maybe just promise or already fulfilled one! */
|
|
32
32
|
export type MaybePromise<T> = T | Promise<T>;
|
|
33
33
|
export type AllPossibleKeys<T> = T extends any ? keyof T : never;
|
|
34
|
+
/** Strip all the methods or functions from a type */
|
|
35
|
+
export type DTO<T> = {
|
|
36
|
+
[K in keyof T as T[K] extends Function ? never : K]: T[K];
|
|
37
|
+
};
|
|
38
|
+
export type MapEntry<M extends Map<any, any>> = M extends Map<infer K, infer V> ? [K, V] : never;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type GlobalPoint } from "@excalidraw/math";
|
|
2
|
+
import type { ExcalidrawBindableElement, FontFamilyValues, FontString, ExcalidrawElement } from "@excalidraw/element/types";
|
|
2
3
|
import type { ActiveTool, AppState, ToolType, UnsubscribeCallback, Zoom } from "@excalidraw/excalidraw/types";
|
|
3
4
|
import type { MaybePromise } from "./utility-types";
|
|
4
5
|
import type { EVENT } from "./constants";
|
|
@@ -6,9 +7,9 @@ export declare const setDateTimeForTests: (dateTime: string) => void;
|
|
|
6
7
|
export declare const getDateTime: () => string;
|
|
7
8
|
export declare const capitalizeString: (str: string) => string;
|
|
8
9
|
export declare const isToolIcon: (target: Element | EventTarget | null) => target is HTMLElement;
|
|
9
|
-
export declare const isInputLike: (target: Element | EventTarget | null) => target is
|
|
10
|
+
export declare const isInputLike: (target: Element | EventTarget | null) => target is HTMLInputElement | HTMLSelectElement | HTMLBRElement | HTMLDivElement | HTMLTextAreaElement;
|
|
10
11
|
export declare const isInteractive: (target: Element | EventTarget | null) => boolean;
|
|
11
|
-
export declare const isWritableElement: (target: Element | EventTarget | null) => target is
|
|
12
|
+
export declare const isWritableElement: (target: Element | EventTarget | null) => target is HTMLInputElement | HTMLBRElement | HTMLDivElement | HTMLTextAreaElement;
|
|
12
13
|
export declare const getFontFamilyString: ({ fontFamily, }: {
|
|
13
14
|
fontFamily: FontFamilyValues;
|
|
14
15
|
}) => string;
|
|
@@ -137,6 +138,8 @@ export declare const tupleToCoors: (xyTuple: readonly [number, number]) => {
|
|
|
137
138
|
export declare const muteFSAbortError: (error?: Error) => void;
|
|
138
139
|
export declare const findIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
|
|
139
140
|
export declare const findLastIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
|
|
141
|
+
/** returns the first non-null mapped value */
|
|
142
|
+
export declare const mapFind: <T, K>(collection: readonly T[], iteratee: (value: T, index: number) => K | null | undefined) => K | undefined;
|
|
140
143
|
export declare const isTransparent: (color: string) => boolean;
|
|
141
144
|
export declare const isBindingFallthroughEnabled: (el: ExcalidrawBindableElement) => boolean;
|
|
142
145
|
export type ResolvablePromise<T> = Promise<T> & {
|
|
@@ -177,15 +180,25 @@ export type Node<T> = T & {
|
|
|
177
180
|
* Creates a circular doubly linked list by adding `prev` and `next` props to the existing array nodes.
|
|
178
181
|
*/
|
|
179
182
|
export declare const arrayToList: <T>(array: readonly T[]) => Node<T>[];
|
|
183
|
+
/**
|
|
184
|
+
* Converts a readonly array or map into an iterable.
|
|
185
|
+
* Useful for avoiding entry allocations when iterating object / map on each iteration.
|
|
186
|
+
*/
|
|
187
|
+
export declare const toIterable: <T>(values: ReadonlyMap<string, T> | readonly T[]) => Iterable<T>;
|
|
188
|
+
/**
|
|
189
|
+
* Converts a readonly array or map into an array.
|
|
190
|
+
*/
|
|
191
|
+
export declare const toArray: <T>(values: ReadonlyMap<string, T> | readonly T[]) => T[];
|
|
180
192
|
export declare const isTestEnv: () => boolean;
|
|
181
193
|
export declare const isDevEnv: () => boolean;
|
|
194
|
+
export declare const isProdEnv: () => boolean;
|
|
182
195
|
export declare const isServerEnv: () => boolean;
|
|
183
196
|
export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) => CustomEvent<{
|
|
184
197
|
nativeEvent: T;
|
|
185
198
|
}>;
|
|
186
199
|
export declare const updateObject: <T extends Record<string, any>>(obj: T, updates: Partial<T>) => T;
|
|
187
200
|
export declare const isPrimitive: (val: any) => boolean;
|
|
188
|
-
export declare const getFrame: () => "
|
|
201
|
+
export declare const getFrame: () => "top" | "iframe";
|
|
189
202
|
export declare const isRunningInIframe: () => boolean;
|
|
190
203
|
export declare const isPromiseLike: (value: any) => value is Promise<any>;
|
|
191
204
|
export declare const queryFocusableElements: (container: HTMLElement | null) => HTMLElement[];
|
|
@@ -248,4 +261,9 @@ export declare const safelyParseJSON: (json: string) => Record<string, any> | nu
|
|
|
248
261
|
*/
|
|
249
262
|
export declare const escapeDoubleQuotes: (str: string) => string;
|
|
250
263
|
export declare const castArray: <T>(value: T | T[]) => T[];
|
|
264
|
+
export declare const elementCenterPoint: (element: ExcalidrawElement, xOffset?: number, yOffset?: number) => GlobalPoint;
|
|
265
|
+
/** hack for Array.isArray type guard not working with readonly value[] */
|
|
266
|
+
export declare const isReadonlyArray: (value?: any) => value is readonly any[];
|
|
267
|
+
export declare const sizeOf: (value: readonly unknown[] | Readonly<Map<string, unknown>> | Readonly<Record<string, unknown>> | ReadonlySet<unknown>) => number;
|
|
268
|
+
export declare const reduceToCommonValue: <T, R = T>(collection: ReadonlySet<T> | readonly T[], getValue?: ((item: T) => R) | undefined) => R | null;
|
|
251
269
|
export {};
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ElementUpdate } from "@excalidraw/element";
|
|
2
2
|
import type { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ExcalidrawFrameLikeElement, ElementsMapOrArray, OrderedExcalidrawElement, Ordered } from "@excalidraw/element/types";
|
|
3
|
-
import type {
|
|
4
|
-
type
|
|
5
|
-
type ElementKey = ExcalidrawElement | ElementIdKey;
|
|
3
|
+
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
4
|
+
import type { AppState } from "../../excalidraw/types";
|
|
6
5
|
type SceneStateCallback = () => void;
|
|
7
6
|
type SceneStateCallbackRemover = () => void;
|
|
8
7
|
export type ExcalidrawElementsIncludingDeleted = readonly ExcalidrawElement[];
|
|
9
|
-
declare class Scene {
|
|
10
|
-
private static sceneMapByElement;
|
|
11
|
-
private static sceneMapById;
|
|
12
|
-
static mapElementToScene(elementKey: ElementKey, scene: Scene): void;
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated pass down `app.scene` and use it directly
|
|
15
|
-
*/
|
|
16
|
-
static getScene(elementKey: ElementKey): Scene | null;
|
|
8
|
+
export declare class Scene {
|
|
17
9
|
private callbacks;
|
|
18
10
|
private nonDeletedElements;
|
|
19
11
|
private nonDeletedElementsMap;
|
|
@@ -35,6 +27,7 @@ declare class Scene {
|
|
|
35
27
|
getElementsMapIncludingDeleted(): Map<string, Ordered<ExcalidrawElement>> & import("@excalidraw/common/utility-types").MakeBrand<"SceneElementsMap">;
|
|
36
28
|
getNonDeletedElements(): readonly Ordered<NonDeletedExcalidrawElement>[];
|
|
37
29
|
getFramesIncludingDeleted(): readonly ExcalidrawFrameLikeElement[];
|
|
30
|
+
constructor(elements?: ElementsMapOrArray | null);
|
|
38
31
|
getSelectedElements(opts: {
|
|
39
32
|
selectedElementIds: AppState["selectedElementIds"];
|
|
40
33
|
/**
|
|
@@ -73,7 +66,11 @@ declare class Scene {
|
|
|
73
66
|
getElementIndex(elementId: string): number;
|
|
74
67
|
getContainerElement: (element: (ExcalidrawElement & {
|
|
75
68
|
containerId: ExcalidrawElement["id"] | null;
|
|
76
|
-
}) | null) => import("@excalidraw/element/types").
|
|
69
|
+
}) | null) => import("@excalidraw/element/types").ExcalidrawSelectionElement | import("@excalidraw/element/types").ExcalidrawRectangleElement | import("@excalidraw/element/types").ExcalidrawDiamondElement | import("@excalidraw/element/types").ExcalidrawEllipseElement | import("@excalidraw/element/types").ExcalidrawTextElement | import("@excalidraw/element/types").ExcalidrawLinearElement | import("@excalidraw/element/types").ExcalidrawFreeDrawElement | import("@excalidraw/element/types").ExcalidrawImageElement | import("@excalidraw/element/types").ExcalidrawFrameElement | import("@excalidraw/element/types").ExcalidrawMagicFrameElement | import("@excalidraw/element/types").ExcalidrawIframeElement | import("@excalidraw/element/types").ExcalidrawEmbeddableElement | null;
|
|
77
70
|
getElementsFromId: (id: string) => ExcalidrawElement[];
|
|
71
|
+
mutateElement<TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, options?: {
|
|
72
|
+
informMutation: boolean;
|
|
73
|
+
isDragging: boolean;
|
|
74
|
+
}): TElement;
|
|
78
75
|
}
|
|
79
|
-
export
|
|
76
|
+
export {};
|
|
@@ -17,7 +17,7 @@ export declare class ShapeCache {
|
|
|
17
17
|
* Generates & caches shape for element if not already cached, otherwise
|
|
18
18
|
* returns cached shape.
|
|
19
19
|
*/
|
|
20
|
-
static generateElementShape: <T extends import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").
|
|
20
|
+
static generateElementShape: <T extends import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawTextElement | import("./types").ExcalidrawLinearElement | import("./types").ExcalidrawArrowElement | import("./types").ExcalidrawFreeDrawElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawEmbeddableElement>(element: T, renderConfig: {
|
|
21
21
|
isExporting: boolean;
|
|
22
22
|
canvasBackgroundColor: AppState["viewBackgroundColor"];
|
|
23
23
|
embedsValidationStatus: EmbedsValidationStatus;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type Scene from "
|
|
2
|
-
import type {
|
|
1
|
+
import type { Scene } from "./Scene";
|
|
2
|
+
import type { ExcalidrawElement } from "./types";
|
|
3
3
|
export interface Alignment {
|
|
4
4
|
position: "start" | "center" | "end";
|
|
5
5
|
axis: "x" | "y";
|
|
6
6
|
}
|
|
7
|
-
export declare const alignElements: (selectedElements: ExcalidrawElement[],
|
|
7
|
+
export declare const alignElements: (selectedElements: ExcalidrawElement[], alignment: Alignment, scene: Scene) => ExcalidrawElement[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type GlobalPoint } from "@excalidraw/math";
|
|
2
2
|
import type { LocalPoint } from "@excalidraw/math";
|
|
3
|
-
import type Scene from "@excalidraw/excalidraw/scene/Scene";
|
|
4
3
|
import type { AppState } from "@excalidraw/excalidraw/types";
|
|
5
4
|
import { type Heading } from "./heading";
|
|
5
|
+
import type { Scene } from "./Scene";
|
|
6
6
|
import type { Bounds } from "./bounds";
|
|
7
7
|
import type { ElementUpdate } from "./mutateElement";
|
|
8
|
-
import type { ExcalidrawBindableElement, ExcalidrawElement, NonDeleted, ExcalidrawLinearElement, NonDeletedExcalidrawElement, ElementsMap, NonDeletedSceneElementsMap,
|
|
8
|
+
import type { ExcalidrawBindableElement, ExcalidrawElement, NonDeleted, ExcalidrawLinearElement, NonDeletedExcalidrawElement, ElementsMap, NonDeletedSceneElementsMap, ExcalidrawElbowArrowElement, FixedPoint } from "./types";
|
|
9
9
|
export type SuggestedBinding = NonDeleted<ExcalidrawBindableElement> | SuggestedPointBinding;
|
|
10
10
|
export type SuggestedPointBinding = [
|
|
11
11
|
NonDeleted<ExcalidrawLinearElement>,
|
|
@@ -17,36 +17,43 @@ 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
19
|
export declare const BINDING_HIGHLIGHT_OFFSET = 4;
|
|
20
|
-
export declare const bindOrUnbindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, startBindingElement: ExcalidrawBindableElement | null | "keep", endBindingElement: ExcalidrawBindableElement | null | "keep",
|
|
21
|
-
export declare const bindOrUnbindLinearElements: (selectedElements: NonDeleted<ExcalidrawLinearElement>[],
|
|
20
|
+
export declare const bindOrUnbindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, startBindingElement: ExcalidrawBindableElement | null | "keep", endBindingElement: ExcalidrawBindableElement | null | "keep", scene: Scene) => void;
|
|
21
|
+
export declare const bindOrUnbindLinearElements: (selectedElements: NonDeleted<ExcalidrawLinearElement>[], isBindingEnabled: boolean, draggingPoints: readonly number[] | null, scene: Scene, zoom?: AppState["zoom"]) => void;
|
|
22
22
|
export declare const getSuggestedBindingsForArrows: (selectedElements: NonDeleted<ExcalidrawElement>[], elementsMap: NonDeletedSceneElementsMap, zoom: AppState["zoom"]) => SuggestedBinding[];
|
|
23
23
|
export declare const maybeBindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, appState: AppState, pointerCoords: {
|
|
24
24
|
x: number;
|
|
25
25
|
y: number;
|
|
26
|
-
},
|
|
27
|
-
export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end",
|
|
26
|
+
}, scene: Scene) => void;
|
|
27
|
+
export declare const bindLinearElement: (linearElement: NonDeleted<ExcalidrawLinearElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end", scene: Scene) => void;
|
|
28
28
|
export declare const isLinearElementSimpleAndAlreadyBound: (linearElement: NonDeleted<ExcalidrawLinearElement>, alreadyBoundToId: ExcalidrawBindableElement["id"] | undefined, bindableElement: ExcalidrawBindableElement) => boolean;
|
|
29
29
|
export declare const getHoveredElementForBinding: (pointerCoords: {
|
|
30
30
|
x: number;
|
|
31
31
|
y: number;
|
|
32
32
|
}, elements: readonly NonDeletedExcalidrawElement[], elementsMap: NonDeletedSceneElementsMap, zoom?: AppState["zoom"], fullShape?: boolean, considerAllElements?: boolean) => NonDeleted<ExcalidrawBindableElement> | null;
|
|
33
|
-
export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement,
|
|
33
|
+
export declare const updateBoundElements: (changedElement: NonDeletedExcalidrawElement, scene: Scene, options?: {
|
|
34
34
|
simultaneouslyUpdated?: readonly ExcalidrawElement[];
|
|
35
35
|
newSize?: {
|
|
36
36
|
width: number;
|
|
37
37
|
height: number;
|
|
38
38
|
};
|
|
39
|
-
changedElements?: Map<string,
|
|
39
|
+
changedElements?: Map<string, ExcalidrawElement>;
|
|
40
40
|
}) => void;
|
|
41
|
-
export declare const
|
|
41
|
+
export declare const updateBindings: (latestElement: ExcalidrawElement, scene: Scene, options?: {
|
|
42
|
+
simultaneouslyUpdated?: readonly ExcalidrawElement[];
|
|
43
|
+
newSize?: {
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
};
|
|
47
|
+
zoom?: AppState["zoom"];
|
|
48
|
+
}) => 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;
|
|
42
50
|
export declare const bindPointToSnapToElementOutline: (arrow: ExcalidrawElbowArrowElement, bindableElement: ExcalidrawBindableElement, startOrEnd: "start" | "end") => GlobalPoint;
|
|
43
51
|
export declare const avoidRectangularCorner: (element: ExcalidrawBindableElement, p: GlobalPoint) => GlobalPoint;
|
|
44
52
|
export declare const snapToMid: (element: ExcalidrawBindableElement, p: GlobalPoint, tolerance?: number) => GlobalPoint;
|
|
45
|
-
export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end"
|
|
53
|
+
export declare const calculateFixedPointForElbowArrowBinding: (linearElement: NonDeleted<ExcalidrawElbowArrowElement>, hoveredElement: ExcalidrawBindableElement, startOrEnd: "start" | "end") => {
|
|
46
54
|
fixedPoint: FixedPoint;
|
|
47
55
|
};
|
|
48
|
-
export declare const fixDuplicatedBindingsAfterDuplication: (
|
|
49
|
-
export declare const fixReversedBindings: (originalElements: Map<string, ExcalidrawElement>, elementsWithClones: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
56
|
+
export declare const fixDuplicatedBindingsAfterDuplication: (duplicatedElements: ExcalidrawElement[], origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicateElementsMap: NonDeletedSceneElementsMap) => void;
|
|
50
57
|
export declare const fixBindingsAfterDeletion: (sceneElements: readonly ExcalidrawElement[], deletedElements: readonly ExcalidrawElement[]) => void;
|
|
51
58
|
export declare const bindingBorderTest: (element: NonDeleted<ExcalidrawBindableElement>, { x, y }: {
|
|
52
59
|
x: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Degrees, GlobalPoint, LineSegment } from "@excalidraw/math";
|
|
2
2
|
import type { AppState } from "@excalidraw/excalidraw/types";
|
|
3
|
-
import type { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead, ExcalidrawFreeDrawElement, NonDeleted, ElementsMap } from "./types";
|
|
4
3
|
import type { Drawable, Op } from "roughjs/bin/core";
|
|
4
|
+
import type { Arrowhead, ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawFreeDrawElement, ExcalidrawLinearElement, NonDeleted } from "./types";
|
|
5
5
|
export type RectangleBox = {
|
|
6
6
|
x: number;
|
|
7
7
|
y: number;
|
|
@@ -51,7 +51,7 @@ export declare const getArrowheadSize: (arrowhead: Arrowhead) => number;
|
|
|
51
51
|
export declare const getArrowheadAngle: (arrowhead: Arrowhead) => Degrees;
|
|
52
52
|
export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead) => number[] | null;
|
|
53
53
|
export declare const getElementBounds: (element: ExcalidrawElement, elementsMap: ElementsMap) => Bounds;
|
|
54
|
-
export declare const getCommonBounds: (elements:
|
|
54
|
+
export declare const getCommonBounds: (elements: ElementsMapOrArray, elementsMap?: ElementsMap) => Bounds;
|
|
55
55
|
export declare const getDraggedElementsBounds: (elements: ExcalidrawElement[], dragOffset: {
|
|
56
56
|
x: number;
|
|
57
57
|
y: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { type GeometricShape } from "@excalidraw/utils/shape";
|
|
1
2
|
import type { GlobalPoint, LineSegment, LocalPoint } from "@excalidraw/math";
|
|
2
|
-
import type { GeometricShape } from "@excalidraw/utils/shape";
|
|
3
3
|
import type { FrameNameBounds } from "@excalidraw/excalidraw/types";
|
|
4
4
|
import type { ElementsMap, ExcalidrawElement } from "./types";
|
|
5
5
|
export declare const shouldTestInside: (element: ExcalidrawElement) => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ElementUpdate } from "@excalidraw/element/mutateElement";
|
|
2
1
|
import type { ExcalidrawElement, Ordered, OrderedExcalidrawElement, SceneElementsMap } from "@excalidraw/element/types";
|
|
3
|
-
import type { ValueOf } from "@excalidraw/common/utility-types";
|
|
4
|
-
import type { AppState, ObservedAppState } from "
|
|
2
|
+
import type { DTO, ValueOf } from "@excalidraw/common/utility-types";
|
|
3
|
+
import type { AppState, ObservedAppState } from "@excalidraw/excalidraw/types";
|
|
4
|
+
import type { ElementUpdate } from "./mutateElement";
|
|
5
5
|
/**
|
|
6
6
|
* Represents the difference between two objects of the same type.
|
|
7
7
|
*
|
|
@@ -11,7 +11,7 @@ import type { AppState, ObservedAppState } from "./types";
|
|
|
11
11
|
*
|
|
12
12
|
* Keeping it as pure object (without transient state, side-effects, etc.), so we won't have to instantiate it on load.
|
|
13
13
|
*/
|
|
14
|
-
declare class Delta<T> {
|
|
14
|
+
export declare class Delta<T> {
|
|
15
15
|
readonly deleted: Partial<T>;
|
|
16
16
|
readonly inserted: Partial<T>;
|
|
17
17
|
private constructor();
|
|
@@ -56,11 +56,11 @@ declare class Delta<T> {
|
|
|
56
56
|
*/
|
|
57
57
|
static isRightDifferent<T extends {}>(object1: T, object2: T, skipShallowCompare?: boolean): boolean;
|
|
58
58
|
/**
|
|
59
|
-
* Returns
|
|
59
|
+
* Returns sorted object1 keys that have distinct values.
|
|
60
60
|
*/
|
|
61
61
|
static getLeftDifferences<T extends {}>(object1: T, object2: T, skipShallowCompare?: boolean): string[];
|
|
62
62
|
/**
|
|
63
|
-
* Returns
|
|
63
|
+
* Returns sorted object2 keys that have distinct values.
|
|
64
64
|
*/
|
|
65
65
|
static getRightDifferences<T extends {}>(object1: T, object2: T, skipShallowCompare?: boolean): string[];
|
|
66
66
|
/**
|
|
@@ -73,37 +73,33 @@ declare class Delta<T> {
|
|
|
73
73
|
private static distinctKeysIterator;
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
|
-
* Encapsulates
|
|
76
|
+
* Encapsulates a set of application-level `Delta`s.
|
|
77
77
|
*/
|
|
78
|
-
interface
|
|
78
|
+
export interface DeltaContainer<T> {
|
|
79
79
|
/**
|
|
80
|
-
* Inverses the `Delta`s
|
|
80
|
+
* Inverses the `Delta`s while creating a new `DeltaContainer` instance.
|
|
81
81
|
*/
|
|
82
|
-
inverse():
|
|
82
|
+
inverse(): DeltaContainer<T>;
|
|
83
83
|
/**
|
|
84
|
-
* Applies the `
|
|
84
|
+
* Applies the `Delta`s to the previous object.
|
|
85
85
|
*
|
|
86
|
-
* @returns a tuple of the next object `T` with applied
|
|
86
|
+
* @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
87
|
*/
|
|
88
88
|
applyTo(previous: T, ...options: unknown[]): [T, boolean];
|
|
89
89
|
/**
|
|
90
|
-
* Checks whether
|
|
90
|
+
* Checks whether all `Delta`s are empty.
|
|
91
91
|
*/
|
|
92
92
|
isEmpty(): boolean;
|
|
93
93
|
}
|
|
94
|
-
export declare class
|
|
95
|
-
|
|
94
|
+
export declare class AppStateDelta implements DeltaContainer<AppState> {
|
|
95
|
+
readonly delta: Delta<ObservedAppState>;
|
|
96
96
|
private constructor();
|
|
97
|
-
static calculate<T extends ObservedAppState>(prevAppState: T, nextAppState: T):
|
|
98
|
-
static
|
|
99
|
-
|
|
97
|
+
static calculate<T extends ObservedAppState>(prevAppState: T, nextAppState: T): AppStateDelta;
|
|
98
|
+
static restore(appStateDeltaDTO: DTO<AppStateDelta>): AppStateDelta;
|
|
99
|
+
static empty(): AppStateDelta;
|
|
100
|
+
inverse(): AppStateDelta;
|
|
100
101
|
applyTo(appState: AppState, nextElements: SceneElementsMap): [AppState, boolean];
|
|
101
102
|
isEmpty(): boolean;
|
|
102
|
-
/**
|
|
103
|
-
* It is necessary to post process the partials in case of reference values,
|
|
104
|
-
* for which we need to calculate the real diff between `deleted` and `inserted`.
|
|
105
|
-
*/
|
|
106
|
-
private static postProcess;
|
|
107
103
|
/**
|
|
108
104
|
* Mutates `nextAppState` be filtering out state related to deleted elements.
|
|
109
105
|
*
|
|
@@ -115,20 +111,27 @@ export declare class AppStateChange implements Change<AppState> {
|
|
|
115
111
|
private static filterSelectedGroups;
|
|
116
112
|
private static stripElementsProps;
|
|
117
113
|
private static stripStandaloneProps;
|
|
114
|
+
/**
|
|
115
|
+
* It is necessary to post process the partials in case of reference values,
|
|
116
|
+
* for which we need to calculate the real diff between `deleted` and `inserted`.
|
|
117
|
+
*/
|
|
118
|
+
private static postProcess;
|
|
119
|
+
private static orderAppStateKeys;
|
|
118
120
|
}
|
|
119
121
|
type ElementPartial<T extends ExcalidrawElement = ExcalidrawElement> = Omit<ElementUpdate<Ordered<T>>, "seed">;
|
|
120
122
|
/**
|
|
121
123
|
* Elements change is a low level primitive to capture a change between two sets of elements.
|
|
122
124
|
* It does so by encapsulating forward and backward `Delta`s, allowing to time-travel in both directions.
|
|
123
125
|
*/
|
|
124
|
-
export declare class
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
export declare class ElementsDelta implements DeltaContainer<SceneElementsMap> {
|
|
127
|
+
readonly added: Record<string, Delta<ElementPartial>>;
|
|
128
|
+
readonly removed: Record<string, Delta<ElementPartial>>;
|
|
129
|
+
readonly updated: Record<string, Delta<ElementPartial>>;
|
|
128
130
|
private constructor();
|
|
129
|
-
static create(added:
|
|
131
|
+
static create(added: Record<string, Delta<ElementPartial>>, removed: Record<string, Delta<ElementPartial>>, updated: Record<string, Delta<ElementPartial>>, options?: {
|
|
130
132
|
shouldRedistribute: boolean;
|
|
131
|
-
}):
|
|
133
|
+
}): ElementsDelta;
|
|
134
|
+
static restore(elementsDeltaDTO: DTO<ElementsDelta>): ElementsDelta;
|
|
132
135
|
private static satisfiesAddition;
|
|
133
136
|
private static satisfiesRemoval;
|
|
134
137
|
private static satisfiesUpdate;
|
|
@@ -139,11 +142,11 @@ export declare class ElementsChange implements Change<SceneElementsMap> {
|
|
|
139
142
|
* @param prevElements - Map representing the previous state of elements.
|
|
140
143
|
* @param nextElements - Map representing the next state of elements.
|
|
141
144
|
*
|
|
142
|
-
* @returns `
|
|
145
|
+
* @returns `ElementsDelta` instance representing the `Delta` changes between the two sets of elements.
|
|
143
146
|
*/
|
|
144
|
-
static calculate<T extends OrderedExcalidrawElement>(prevElements: Map<string, T>, nextElements: Map<string, T>):
|
|
145
|
-
static empty():
|
|
146
|
-
inverse():
|
|
147
|
+
static calculate<T extends OrderedExcalidrawElement>(prevElements: Map<string, T>, nextElements: Map<string, T>): ElementsDelta;
|
|
148
|
+
static empty(): ElementsDelta;
|
|
149
|
+
inverse(): ElementsDelta;
|
|
147
150
|
isEmpty(): boolean;
|
|
148
151
|
/**
|
|
149
152
|
* Update delta/s based on the existing elements.
|
|
@@ -152,8 +155,8 @@ export declare class ElementsChange implements Change<SceneElementsMap> {
|
|
|
152
155
|
* @param modifierOptions defines which of the delta (`deleted` or `inserted`) will be updated
|
|
153
156
|
* @returns new instance with modified delta/s
|
|
154
157
|
*/
|
|
155
|
-
applyLatestChanges(elements: SceneElementsMap):
|
|
156
|
-
applyTo(elements: SceneElementsMap,
|
|
158
|
+
applyLatestChanges(elements: SceneElementsMap, modifierOptions: "deleted" | "inserted"): ElementsDelta;
|
|
159
|
+
applyTo(elements: SceneElementsMap, elementsSnapshot: Map<string, OrderedExcalidrawElement>): [SceneElementsMap, boolean];
|
|
157
160
|
private static createApplier;
|
|
158
161
|
private static createGetter;
|
|
159
162
|
private static applyDelta;
|
|
@@ -165,6 +168,8 @@ export declare class ElementsChange implements Change<SceneElementsMap> {
|
|
|
165
168
|
* Resolves conflicts for all previously added, removed and updated elements.
|
|
166
169
|
* Updates the previous deltas with all the changes after conflict resolution.
|
|
167
170
|
*
|
|
171
|
+
* // TODO: revisit since some bound arrows seem to be often redrawn incorrectly
|
|
172
|
+
*
|
|
168
173
|
* @returns all elements affected by the conflict resolution
|
|
169
174
|
*/
|
|
170
175
|
private resolveConflicts;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AppState, NormalizedZoomValue, NullableGridSize, PointerDownState } from "@excalidraw/excalidraw/types";
|
|
2
|
-
import type Scene from "@excalidraw/excalidraw/scene/Scene";
|
|
3
2
|
import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
3
|
+
import type { Scene } from "./Scene";
|
|
4
4
|
export declare const dragSelectedElements: (pointerDownState: PointerDownState, _selectedElements: NonDeletedExcalidrawElement[], offset: {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
@@ -9,7 +9,7 @@ export declare const dragSelectedElements: (pointerDownState: PointerDownState,
|
|
|
9
9
|
y: number;
|
|
10
10
|
}, gridSize: NullableGridSize) => void;
|
|
11
11
|
export declare const getDragOffsetXY: (selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
|
|
12
|
-
export declare const dragNewElement: ({ newElement, elementType, originX, originY, x, y, width, height, shouldMaintainAspectRatio, shouldResizeFromCenter, zoom, widthAspectRatio, originOffset, informMutation, }: {
|
|
12
|
+
export declare const dragNewElement: ({ newElement, elementType, originX, originY, x, y, width, height, shouldMaintainAspectRatio, shouldResizeFromCenter, zoom, scene, widthAspectRatio, originOffset, informMutation, }: {
|
|
13
13
|
newElement: NonDeletedExcalidrawElement;
|
|
14
14
|
elementType: AppState["activeTool"]["type"];
|
|
15
15
|
originX: number;
|
|
@@ -21,6 +21,7 @@ export declare const dragNewElement: ({ newElement, elementType, originX, origin
|
|
|
21
21
|
shouldMaintainAspectRatio: boolean;
|
|
22
22
|
shouldResizeFromCenter: boolean;
|
|
23
23
|
zoom: NormalizedZoomValue;
|
|
24
|
+
scene: Scene;
|
|
24
25
|
/** whether to keep given aspect ratio when `isResizeWithSidesSameLength` is
|
|
25
26
|
true */
|
|
26
27
|
widthAspectRatio?: number | null | undefined;
|
|
@@ -13,13 +13,16 @@ import type { ExcalidrawElement, GroupId } from "./types";
|
|
|
13
13
|
* multiple elements at once, share this map
|
|
14
14
|
* amongst all of them
|
|
15
15
|
* @param element Element to duplicate
|
|
16
|
-
* @param overrides Any element properties to override
|
|
17
16
|
*/
|
|
18
|
-
export declare const duplicateElement: <TElement extends ExcalidrawElement>(editingGroupId: AppState["editingGroupId"], groupIdMapForOperation: Map<GroupId, GroupId>, element: TElement,
|
|
17
|
+
export declare const duplicateElement: <TElement extends ExcalidrawElement>(editingGroupId: AppState["editingGroupId"], groupIdMapForOperation: Map<GroupId, GroupId>, element: TElement, randomizeSeed?: boolean) => Readonly<TElement>;
|
|
19
18
|
export declare const duplicateElements: (opts: {
|
|
20
19
|
elements: readonly ExcalidrawElement[];
|
|
21
20
|
randomizeSeed?: boolean | undefined;
|
|
22
|
-
overrides?: ((
|
|
21
|
+
overrides?: ((data: {
|
|
22
|
+
duplicateElement: ExcalidrawElement;
|
|
23
|
+
origElement: ExcalidrawElement;
|
|
24
|
+
origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>;
|
|
25
|
+
}) => Partial<ExcalidrawElement>) | undefined;
|
|
23
26
|
} & ({
|
|
24
27
|
/**
|
|
25
28
|
* Duplicates all elements in array.
|
|
@@ -42,17 +45,11 @@ export declare const duplicateElements: (opts: {
|
|
|
42
45
|
editingGroupId: AppState["editingGroupId"];
|
|
43
46
|
selectedGroupIds: AppState["selectedGroupIds"];
|
|
44
47
|
};
|
|
45
|
-
/**
|
|
46
|
-
* If true, duplicated elements are inserted _before_ specified
|
|
47
|
-
* elements. Case: alt-dragging elements to duplicate them.
|
|
48
|
-
*
|
|
49
|
-
* TODO: remove this once (if) we stop replacing the original element
|
|
50
|
-
* with the duplicated one in the scene array.
|
|
51
|
-
*/
|
|
52
|
-
reverseOrder: boolean;
|
|
53
48
|
})) => {
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
duplicatedElements: ExcalidrawElement[];
|
|
50
|
+
duplicateElementsMap: Map<string, ExcalidrawElement>;
|
|
51
|
+
elementsWithDuplicates: ExcalidrawElement[];
|
|
52
|
+
origIdToDuplicateId: Map<string, string>;
|
|
56
53
|
};
|
|
57
54
|
/**
|
|
58
55
|
* Clones ExcalidrawElement data structure. Does not regenerate id, nonce, or
|
|
@@ -8,7 +8,7 @@ export declare const BASE_PADDING = 40;
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const updateElbowArrowPoints: (arrow: Readonly<ExcalidrawElbowArrowElement>, elementsMap: NonDeletedSceneElementsMap, updates: {
|
|
10
10
|
points?: readonly LocalPoint[];
|
|
11
|
-
fixedSegments?: FixedSegment[] | null;
|
|
11
|
+
fixedSegments?: readonly FixedSegment[] | null;
|
|
12
12
|
startBinding?: FixedPointBinding | null;
|
|
13
13
|
endBinding?: FixedPointBinding | null;
|
|
14
14
|
}, options?: {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { AppState, PendingExcalidrawElements } from "@excalidraw/excalidraw/types";
|
|
2
2
|
import { type ElementsMap, type ExcalidrawBindableElement, type ExcalidrawElement, type ExcalidrawFlowchartNodeElement } from "./types";
|
|
3
|
+
import type { Scene } from "./Scene";
|
|
3
4
|
type LinkDirection = "up" | "right" | "down" | "left";
|
|
4
5
|
export declare const getLinkDirectionFromKey: (key: string) => LinkDirection;
|
|
5
6
|
export declare const getPredecessors: (node: ExcalidrawBindableElement, elementsMap: ElementsMap, direction: LinkDirection) => ExcalidrawBindableElement[];
|
|
6
|
-
export declare const addNewNodes: (startNode: ExcalidrawFlowchartNodeElement,
|
|
7
|
+
export declare const addNewNodes: (startNode: ExcalidrawFlowchartNodeElement, appState: AppState, direction: LinkDirection, scene: Scene, numberOfNodes: number) => ExcalidrawElement[];
|
|
7
8
|
export declare class FlowChartNavigator {
|
|
8
9
|
isExploring: boolean;
|
|
9
10
|
private sameLevelNodes;
|
|
@@ -18,7 +19,7 @@ export declare class FlowChartCreator {
|
|
|
18
19
|
private numberOfNodes;
|
|
19
20
|
private direction;
|
|
20
21
|
pendingNodes: PendingExcalidrawElements | null;
|
|
21
|
-
createNodes(startNode: ExcalidrawFlowchartNodeElement,
|
|
22
|
+
createNodes(startNode: ExcalidrawFlowchartNodeElement, appState: AppState, direction: LinkDirection, scene: Scene): void;
|
|
22
23
|
clear(): void;
|
|
23
24
|
}
|
|
24
25
|
export declare const isNodeInFlowchart: (element: ExcalidrawFlowchartNodeElement, elementsMap: ElementsMap) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExcalidrawElement, OrderedExcalidrawElement } from "./types";
|
|
1
|
+
import type { ElementsMap, ExcalidrawElement, OrderedExcalidrawElement } from "./types";
|
|
2
2
|
export declare class InvalidFractionalIndexError extends Error {
|
|
3
3
|
code: "ELEMENT_HAS_INVALID_INDEX";
|
|
4
4
|
}
|
|
@@ -42,7 +42,7 @@ export declare const orderByFractionalIndex: (elements: OrderedExcalidrawElement
|
|
|
42
42
|
* Synchronizes invalid fractional indices of moved elements with the array order by mutating passed elements.
|
|
43
43
|
* If the synchronization fails or the result is invalid, it fallbacks to `syncInvalidIndices`.
|
|
44
44
|
*/
|
|
45
|
-
export declare const syncMovedIndices: (elements: readonly ExcalidrawElement[], movedElements:
|
|
45
|
+
export declare const syncMovedIndices: (elements: readonly ExcalidrawElement[], movedElements: ElementsMap) => OrderedExcalidrawElement[];
|
|
46
46
|
/**
|
|
47
47
|
* Synchronizes all invalid fractional indices with the array order by mutating passed elements.
|
|
48
48
|
*
|