@myoc/excalidraw 0.18.16 → 0.18.17
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-3HLOFB5F.js → chunk-FQEIAL75.js} +14723 -9831
- package/dist/dev/chunk-FQEIAL75.js.map +7 -0
- package/dist/dev/{chunk-PEI7EPYO.js → chunk-KJKC5BJI.js} +10 -4
- package/dist/dev/chunk-KJKC5BJI.js.map +7 -0
- package/dist/dev/{chunk-QQGTICP4.js → chunk-XL2I4W52.js} +2 -2
- package/dist/dev/data/{image-XPEIZ6XQ.js → image-WMF622SS.js} +3 -3
- package/dist/dev/index.css +69 -22
- package/dist/dev/index.css.map +3 -3
- package/dist/dev/index.js +3099 -6535
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/locales/{en-R455UJTM.js → en-UQFCZXHO.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-7HNFGNL7.js → chunk-5JAQX5EH.js} +1 -1
- package/dist/prod/{chunk-KZWZ7WHC.js → chunk-EJLAYNAE.js} +4 -4
- package/dist/prod/chunk-LSNMPGNI.js +33 -0
- package/dist/prod/data/image-Z433FUMH.js +1 -0
- package/dist/prod/index.css +1 -1
- package/dist/prod/index.js +17 -16
- package/dist/prod/locales/{en-YWERZJD6.js → en-7EHYHCIL.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 +3 -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 +16 -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/arrange.d.ts +2 -1
- package/dist/types/element/src/binding.d.ts +18 -10
- package/dist/types/element/src/bounds.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/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 +4 -3
- package/dist/types/element/src/index.d.ts +45 -2
- package/dist/types/element/src/linearElementEditor.d.ts +14 -18
- package/dist/types/element/src/mutateElement.d.ts +10 -2
- package/dist/types/element/src/newElement.d.ts +3 -3
- package/dist/types/element/src/resizeElements.d.ts +4 -4
- package/dist/types/element/src/selection.d.ts +1 -6
- package/dist/types/element/src/shapes.d.ts +1 -1
- package/dist/types/element/src/sizeHelpers.d.ts +0 -1
- package/dist/types/element/src/store.d.ts +227 -0
- package/dist/types/element/src/textElement.d.ts +4 -3
- package/dist/types/element/src/typeChecks.d.ts +5 -1
- package/dist/types/element/src/types.d.ts +8 -0
- package/dist/types/element/src/zindex.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +27 -45
- package/dist/types/excalidraw/actions/actionAlign.d.ts +8 -8
- package/dist/types/excalidraw/actions/actionArrange.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +18 -30
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +127 -199
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +56 -92
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +9 -15
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +25 -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 +9 -15
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +20 -32
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +9 -15
- package/dist/types/excalidraw/actions/actionExport.d.ts +175 -229
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +16 -28
- package/dist/types/excalidraw/actions/actionFlip.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionFrame.d.ts +80 -104
- package/dist/types/excalidraw/actions/actionGroup.d.ts +24 -36
- package/dist/types/excalidraw/actions/actionHistory.d.ts +1 -2
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +8 -14
- package/dist/types/excalidraw/actions/actionLink.d.ts +9 -15
- package/dist/types/excalidraw/actions/actionMenu.d.ts +27 -45
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +17 -29
- package/dist/types/excalidraw/actions/actionProperties.d.ts +123 -213
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +11 -17
- package/dist/types/excalidraw/actions/actionSmartZoom.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionStyles.d.ts +13 -19
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +11 -17
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +11 -17
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +11 -198
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +19 -0
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +11 -17
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +11 -17
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +11 -17
- package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -8
- package/dist/types/excalidraw/actions/types.d.ts +3 -3
- package/dist/types/excalidraw/appState.d.ts +30 -30
- package/dist/types/excalidraw/components/App.d.ts +13 -8
- 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/dropdownMenu/common.d.ts +1 -1
- 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 +1 -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/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/renderer/helpers.d.ts +6 -1
- package/dist/types/excalidraw/scene/Renderer.d.ts +1 -1
- package/dist/types/excalidraw/scene/index.d.ts +2 -2
- package/dist/types/excalidraw/snapping.d.ts +2 -2
- package/dist/types/excalidraw/types.d.ts +15 -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/curve.d.ts +2 -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 +4 -4
- package/dist/dev/chunk-3HLOFB5F.js.map +0 -7
- package/dist/dev/chunk-PEI7EPYO.js.map +0 -7
- package/dist/prod/chunk-KKQVTSHB.js +0 -33
- package/dist/prod/data/image-QD7FUQED.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/{chunk-QQGTICP4.js.map → chunk-XL2I4W52.js.map} +0 -0
- /package/dist/dev/data/{image-XPEIZ6XQ.js.map → image-WMF622SS.js.map} +0 -0
- /package/dist/dev/locales/{en-R455UJTM.js.map → en-UQFCZXHO.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-EJLAYNAE.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-5JAQX5EH.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-5JAQX5EH.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};
|
|
@@ -88,6 +88,7 @@ export declare const CLASSES: {
|
|
|
88
88
|
SHAPE_ACTIONS_MENU: string;
|
|
89
89
|
ZOOM_ACTIONS: string;
|
|
90
90
|
SEARCH_MENU_INPUT_WRAPPER: string;
|
|
91
|
+
CONVERT_ELEMENT_TYPE_POPUP: string;
|
|
91
92
|
};
|
|
92
93
|
export declare const CJK_HAND_DRAWN_FALLBACK_FONT = "Xiaolai";
|
|
93
94
|
export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
|
|
@@ -108,6 +109,7 @@ export declare const FONT_FAMILY: {
|
|
|
108
109
|
"Lilita One": number;
|
|
109
110
|
"Comic Shanns": number;
|
|
110
111
|
"Liberation Sans": number;
|
|
112
|
+
Assistant: number;
|
|
111
113
|
};
|
|
112
114
|
export declare const FONT_FAMILY_FALLBACKS: {
|
|
113
115
|
Xiaolai: number;
|
|
@@ -194,7 +196,7 @@ export declare const EXPORT_DATA_TYPES: {
|
|
|
194
196
|
readonly excalidrawLibrary: "excalidrawlib";
|
|
195
197
|
readonly excalidrawClipboardWithAPI: "excalidraw-api/clipboard";
|
|
196
198
|
};
|
|
197
|
-
export declare const
|
|
199
|
+
export declare const getExportSource: () => string;
|
|
198
200
|
export declare const IMAGE_RENDER_TIMEOUT = 500;
|
|
199
201
|
export declare const TAP_TWICE_TIMEOUT = 300;
|
|
200
202
|
export declare const TOUCH_CTX_MENU_TIMEOUT = 500;
|
|
@@ -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;
|
|
@@ -7,9 +7,9 @@ export declare const setDateTimeForTests: (dateTime: string) => void;
|
|
|
7
7
|
export declare const getDateTime: () => string;
|
|
8
8
|
export declare const capitalizeString: (str: string) => string;
|
|
9
9
|
export declare const isToolIcon: (target: Element | EventTarget | null) => target is HTMLElement;
|
|
10
|
-
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;
|
|
11
11
|
export declare const isInteractive: (target: Element | EventTarget | null) => boolean;
|
|
12
|
-
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;
|
|
13
13
|
export declare const getFontFamilyString: ({ fontFamily, }: {
|
|
14
14
|
fontFamily: FontFamilyValues;
|
|
15
15
|
}) => string;
|
|
@@ -138,6 +138,8 @@ export declare const tupleToCoors: (xyTuple: readonly [number, number]) => {
|
|
|
138
138
|
export declare const muteFSAbortError: (error?: Error) => void;
|
|
139
139
|
export declare const findIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
|
|
140
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;
|
|
141
143
|
export declare const isTransparent: (color: string) => boolean;
|
|
142
144
|
export declare const isBindingFallthroughEnabled: (el: ExcalidrawBindableElement) => boolean;
|
|
143
145
|
export type ResolvablePromise<T> = Promise<T> & {
|
|
@@ -178,6 +180,15 @@ export type Node<T> = T & {
|
|
|
178
180
|
* Creates a circular doubly linked list by adding `prev` and `next` props to the existing array nodes.
|
|
179
181
|
*/
|
|
180
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[];
|
|
181
192
|
export declare const isTestEnv: () => boolean;
|
|
182
193
|
export declare const isDevEnv: () => boolean;
|
|
183
194
|
export declare const isProdEnv: () => boolean;
|
|
@@ -187,7 +198,7 @@ export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) =
|
|
|
187
198
|
}>;
|
|
188
199
|
export declare const updateObject: <T extends Record<string, any>>(obj: T, updates: Partial<T>) => T;
|
|
189
200
|
export declare const isPrimitive: (val: any) => boolean;
|
|
190
|
-
export declare const getFrame: () => "
|
|
201
|
+
export declare const getFrame: () => "top" | "iframe";
|
|
191
202
|
export declare const isRunningInIframe: () => boolean;
|
|
192
203
|
export declare const isPromiseLike: (value: any) => value is Promise<any>;
|
|
193
204
|
export declare const queryFocusableElements: (container: HTMLElement | null) => HTMLElement[];
|
|
@@ -253,5 +264,6 @@ export declare const castArray: <T>(value: T | T[]) => T[];
|
|
|
253
264
|
export declare const elementCenterPoint: (element: ExcalidrawElement, xOffset?: number, yOffset?: number) => GlobalPoint;
|
|
254
265
|
/** hack for Array.isArray type guard not working with readonly value[] */
|
|
255
266
|
export declare const isReadonlyArray: (value?: any) => value is readonly any[];
|
|
256
|
-
export declare const sizeOf: (value: readonly
|
|
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;
|
|
257
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,3 +1,4 @@
|
|
|
1
|
+
import type { Scene } from "./Scene";
|
|
1
2
|
import type { ElementsMap, ExcalidrawElement, ArrangeAlgorithms } from "./types";
|
|
2
|
-
declare const arrangeElements: (selectedElements: ExcalidrawElement[], elementsMap: ElementsMap, algorithm: ArrangeAlgorithms, gap: number) => ExcalidrawElement[];
|
|
3
|
+
declare const arrangeElements: (scene: Scene, selectedElements: ExcalidrawElement[], elementsMap: ElementsMap, algorithm: ArrangeAlgorithms, gap: number) => ExcalidrawElement[];
|
|
3
4
|
export { arrangeElements };
|
|
@@ -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,32 +17,40 @@ 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
56
|
export declare const fixDuplicatedBindingsAfterDuplication: (duplicatedElements: ExcalidrawElement[], origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>, duplicateElementsMap: NonDeletedSceneElementsMap) => void;
|
|
@@ -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, ElementsMapOrArray } 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;
|
|
@@ -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;
|
|
@@ -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
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ExcalidrawElementsIncludingDeleted } from "@excalidraw/excalidraw/scene/Scene";
|
|
2
1
|
import type { AppClassProperties, AppState, StaticCanvasAppState } from "@excalidraw/excalidraw/types";
|
|
3
2
|
import type { ReadonlySetLike } from "@excalidraw/common/utility-types";
|
|
3
|
+
import type { ExcalidrawElementsIncludingDeleted } from "./Scene";
|
|
4
4
|
import type { ElementsMap, ElementsMapOrArray, ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeleted, NonDeletedExcalidrawElement } from "./types";
|
|
5
5
|
export declare const bindElementsToFramesAfterDuplication: (nextElements: readonly ExcalidrawElement[], origElements: readonly ExcalidrawElement[], origIdToDuplicateId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
6
6
|
export declare function isElementIntersectingFrame(element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement, elementsMap: ElementsMap): boolean;
|
|
@@ -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").ExcalidrawSelectionElement | import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawTextElement | import("./types").ExcalidrawLinearElement | import("./types").ExcalidrawFreeDrawElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawEmbeddableElement)[];
|
|
35
|
+
export declare const omitPartialGroups: (elements: ExcalidrawElement[], frame: ExcalidrawFrameLikeElement, allElementsMap: ElementsMap) => (import("./types").ExcalidrawSelectionElement | import("./types").ExcalidrawRectangleElement | import("./types").ExcalidrawDiamondElement | import("./types").ExcalidrawEllipseElement | import("./types").ExcalidrawTextElement | import("./types").ExcalidrawLinearElement | import("./types").ExcalidrawFreeDrawElement | import("./types").ExcalidrawImageElement | import("./types").ExcalidrawFrameElement | import("./types").ExcalidrawMagicFrameElement | import("./types").ExcalidrawIframeElement | import("./types").ExcalidrawEmbeddableElement)[];
|
|
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[];
|
|
@@ -64,6 +64,7 @@ export declare const isElementInFrame: (element: ExcalidrawElement, allElementsM
|
|
|
64
64
|
checkedGroups?: Map<string, boolean>;
|
|
65
65
|
}) => boolean;
|
|
66
66
|
export declare const shouldApplyFrameClip: (element: ExcalidrawElement, frame: ExcalidrawFrameLikeElement, appState: StaticCanvasAppState, elementsMap: ElementsMap, checkedGroups?: Map<string, boolean>) => boolean;
|
|
67
|
+
export declare const getDefaultFrameName: (element: ExcalidrawFrameLikeElement) => "Frame" | "AI Frame";
|
|
67
68
|
export declare const getFrameLikeTitle: (element: ExcalidrawFrameLikeElement) => string;
|
|
68
69
|
export declare const getElementsOverlappingFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameLikeElement) => NonDeletedExcalidrawElement[];
|
|
69
70
|
export declare const frameAndChildrenSelectedTogether: (selectedElements: readonly ExcalidrawElement[]) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted } from "./types";
|
|
1
|
+
import type { ExcalidrawElement, NonDeletedExcalidrawElement, NonDeleted, ElementsMapOrArray } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* @deprecated unsafe, use hashElementsVersion instead
|
|
4
4
|
*/
|
|
@@ -6,7 +6,7 @@ export declare const getSceneVersion: (elements: readonly ExcalidrawElement[]) =
|
|
|
6
6
|
/**
|
|
7
7
|
* Hashes elements' versionNonce (using djb2 algo). Order of elements matters.
|
|
8
8
|
*/
|
|
9
|
-
export declare const hashElementsVersion: (elements:
|
|
9
|
+
export declare const hashElementsVersion: (elements: ElementsMapOrArray) => number;
|
|
10
10
|
export declare const hashString: (s: string) => number;
|
|
11
11
|
export declare const getVisibleElements: (elements: readonly ExcalidrawElement[]) => readonly NonDeletedExcalidrawElement[];
|
|
12
12
|
export declare const getNonDeletedElements: <T extends ExcalidrawElement>(elements: readonly T[]) => readonly NonDeleted<T>[];
|
|
@@ -14,3 +14,46 @@ export declare const isNonDeletedElement: <T extends ExcalidrawElement>(element:
|
|
|
14
14
|
export declare const clearElementsForDatabase: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
15
15
|
export declare const clearElementsForExport: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
16
16
|
export declare const clearElementsForLocalStorage: (elements: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
17
|
+
export * from "./align";
|
|
18
|
+
export * from "./binding";
|
|
19
|
+
export * from "./bounds";
|
|
20
|
+
export * from "./collision";
|
|
21
|
+
export * from "./comparisons";
|
|
22
|
+
export * from "./containerCache";
|
|
23
|
+
export * from "./cropElement";
|
|
24
|
+
export * from "./delta";
|
|
25
|
+
export * from "./distance";
|
|
26
|
+
export * from "./distribute";
|
|
27
|
+
export * from "./dragElements";
|
|
28
|
+
export * from "./duplicate";
|
|
29
|
+
export * from "./elbowArrow";
|
|
30
|
+
export * from "./elementLink";
|
|
31
|
+
export * from "./embeddable";
|
|
32
|
+
export * from "./flowchart";
|
|
33
|
+
export * from "./fractionalIndex";
|
|
34
|
+
export * from "./frame";
|
|
35
|
+
export * from "./groups";
|
|
36
|
+
export * from "./heading";
|
|
37
|
+
export * from "./image";
|
|
38
|
+
export * from "./linearElementEditor";
|
|
39
|
+
export * from "./mutateElement";
|
|
40
|
+
export * from "./newElement";
|
|
41
|
+
export * from "./renderElement";
|
|
42
|
+
export * from "./resizeElements";
|
|
43
|
+
export * from "./resizeTest";
|
|
44
|
+
export * from "./Scene";
|
|
45
|
+
export * from "./selection";
|
|
46
|
+
export * from "./Shape";
|
|
47
|
+
export * from "./ShapeCache";
|
|
48
|
+
export * from "./shapes";
|
|
49
|
+
export * from "./showSelectedShapeActions";
|
|
50
|
+
export * from "./sizeHelpers";
|
|
51
|
+
export * from "./sortElements";
|
|
52
|
+
export * from "./store";
|
|
53
|
+
export * from "./textElement";
|
|
54
|
+
export * from "./textMeasurements";
|
|
55
|
+
export * from "./textWrapping";
|
|
56
|
+
export * from "./transformHandles";
|
|
57
|
+
export * from "./typeChecks";
|
|
58
|
+
export * from "./utils";
|
|
59
|
+
export * from "./zindex";
|