@excalidraw/excalidraw 0.18.0-6d870b1c8 → 0.18.0-7b8a5f54c
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-D5WIFFIO.js → chunk-CRKRRBMD.js} +23 -24
- package/dist/dev/{chunk-D5WIFFIO.js.map → chunk-CRKRRBMD.js.map} +2 -2
- package/dist/dev/data/{image-WMAXQLTI.js → image-IWGLHPIX.js} +2 -2
- package/dist/dev/index.js +74 -39
- package/dist/dev/index.js.map +3 -3
- package/dist/prod/{chunk-KK52DCS3.js → chunk-HHV2PJKY.js} +3 -3
- package/dist/prod/data/{image-U3WTNYT7.js → image-4SM4COIL.js} +1 -1
- package/dist/prod/index.js +17 -17
- package/dist/types/element/src/Scene.d.ts +6 -2
- package/dist/types/element/src/delta.d.ts +4 -2
- package/dist/types/element/src/store.d.ts +5 -1
- package/dist/types/excalidraw/components/App.d.ts +4 -3
- package/dist/types/excalidraw/data/restore.d.ts +3 -3
- package/dist/types/excalidraw/types.d.ts +1 -0
- package/history.ts +1 -1
- package/package.json +4 -4
- /package/dist/dev/data/{image-WMAXQLTI.js.map → image-IWGLHPIX.js.map} +0 -0
|
@@ -27,7 +27,9 @@ export declare class Scene {
|
|
|
27
27
|
getElementsMapIncludingDeleted(): Map<string, Ordered<ExcalidrawElement>> & import("@excalidraw/common/utility-types").MakeBrand<"SceneElementsMap">;
|
|
28
28
|
getNonDeletedElements(): readonly Ordered<NonDeletedExcalidrawElement>[];
|
|
29
29
|
getFramesIncludingDeleted(): readonly ExcalidrawFrameLikeElement[];
|
|
30
|
-
constructor(elements?: ElementsMapOrArray | null
|
|
30
|
+
constructor(elements?: ElementsMapOrArray | null, options?: {
|
|
31
|
+
skipValidation?: true;
|
|
32
|
+
});
|
|
31
33
|
getSelectedElements(opts: {
|
|
32
34
|
selectedElementIds: AppState["selectedElementIds"];
|
|
33
35
|
/**
|
|
@@ -55,7 +57,9 @@ export declare class Scene {
|
|
|
55
57
|
* @returns whether a change was made
|
|
56
58
|
*/
|
|
57
59
|
mapElements(iteratee: (element: ExcalidrawElement) => ExcalidrawElement): boolean;
|
|
58
|
-
replaceAllElements(nextElements: ElementsMapOrArray
|
|
60
|
+
replaceAllElements(nextElements: ElementsMapOrArray, options?: {
|
|
61
|
+
skipValidation?: true;
|
|
62
|
+
}): void;
|
|
59
63
|
triggerUpdate(): void;
|
|
60
64
|
onUpdate(cb: SceneStateCallback): SceneStateCallbackRemover;
|
|
61
65
|
destroy(): void;
|
|
@@ -105,7 +105,7 @@ export interface DeltaContainer<T> {
|
|
|
105
105
|
*
|
|
106
106
|
* @returns a tuple of the next object `T` with applied `Delta`s, and `boolean`, indicating whether the applied deltas resulted in a visible change.
|
|
107
107
|
*/
|
|
108
|
-
applyTo(previous: T, ...options: unknown[]): [T, boolean];
|
|
108
|
+
applyTo(previous: T, ...options: unknown[]): [T, boolean, ...unknown[]];
|
|
109
109
|
/**
|
|
110
110
|
* Squashes the current delta with the given one.
|
|
111
111
|
*/
|
|
@@ -118,6 +118,7 @@ export interface DeltaContainer<T> {
|
|
|
118
118
|
export declare class AppStateDelta implements DeltaContainer<AppState> {
|
|
119
119
|
delta: Delta<ObservedAppState>;
|
|
120
120
|
private constructor();
|
|
121
|
+
static create(delta: Delta<ObservedAppState>): AppStateDelta;
|
|
121
122
|
static calculate<T extends ObservedAppState>(prevAppState: T, nextAppState: T): AppStateDelta;
|
|
122
123
|
static restore(appStateDeltaDTO: DTO<AppStateDelta>): AppStateDelta;
|
|
123
124
|
static empty(): AppStateDelta;
|
|
@@ -144,7 +145,7 @@ export declare class AppStateDelta implements DeltaContainer<AppState> {
|
|
|
144
145
|
}
|
|
145
146
|
type ElementPartial<TElement extends ExcalidrawElement = ExcalidrawElement> = Omit<Partial<Ordered<TElement>>, "id" | "updated" | "seed">;
|
|
146
147
|
export type ApplyToOptions = {
|
|
147
|
-
excludedProperties
|
|
148
|
+
excludedProperties?: Set<keyof ElementPartial>;
|
|
148
149
|
};
|
|
149
150
|
/**
|
|
150
151
|
* Elements change is a low level primitive to capture a change between two sets of elements.
|
|
@@ -212,6 +213,7 @@ export declare class ElementsDelta implements DeltaContainer<SceneElementsMap> {
|
|
|
212
213
|
* should be rebound (if possible) with the current element ~ bindings should be bidirectional.
|
|
213
214
|
*/
|
|
214
215
|
private static rebindAffected;
|
|
216
|
+
static redrawElements(nextElements: SceneElementsMap, changedElements: Map<string, OrderedExcalidrawElement>): SceneElementsMap;
|
|
215
217
|
private static redrawTextBoundingBoxes;
|
|
216
218
|
private static redrawBoundArrows;
|
|
217
219
|
private static reorderElements;
|
|
@@ -169,7 +169,11 @@ export declare class StoreDelta {
|
|
|
169
169
|
/**
|
|
170
170
|
* Parse and load the delta from the remote payload.
|
|
171
171
|
*/
|
|
172
|
-
static load({ id, elements: { added, removed, updated }, }: DTO<StoreDelta>): StoreDelta;
|
|
172
|
+
static load({ id, elements: { added, removed, updated }, appState: { delta: appStateDelta }, }: DTO<StoreDelta>): StoreDelta;
|
|
173
|
+
/**
|
|
174
|
+
* Squash the passed delta into the current instance.
|
|
175
|
+
*/
|
|
176
|
+
squash(delta: StoreDelta): this;
|
|
173
177
|
/**
|
|
174
178
|
* Inverse store delta, creates new instance of `StoreDelta`.
|
|
175
179
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type EXPORT_IMAGE_TYPES, Emitter } from "@excalidraw/common";
|
|
3
|
-
import { LinearElementEditor, FlowChartCreator, Scene, Store, type ElementUpdate } from "@excalidraw/element";
|
|
4
|
-
import type { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered } from "@excalidraw/element/types";
|
|
3
|
+
import { LinearElementEditor, FlowChartCreator, Scene, Store, type ElementUpdate, StoreDelta, ApplyToOptions } from "@excalidraw/element";
|
|
4
|
+
import type { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, OrderedExcalidrawElement, SceneElementsMap } from "@excalidraw/element/types";
|
|
5
5
|
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
6
6
|
import { ActionManager } from "../actions/manager";
|
|
7
7
|
import { AnimationFrameHandler } from "../animation-frame-handler";
|
|
@@ -265,7 +265,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
265
265
|
private toggleOverscrollBehavior;
|
|
266
266
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
267
267
|
focusContainer: AppClassProperties["focusContainer"];
|
|
268
|
-
getSceneElementsIncludingDeleted: () => readonly
|
|
268
|
+
getSceneElementsIncludingDeleted: () => readonly OrderedExcalidrawElement[];
|
|
269
269
|
getSceneElementsMapIncludingDeleted: () => Map<string, Ordered<ExcalidrawElement>> & import("@excalidraw/common/utility-types").MakeBrand<"SceneElementsMap">;
|
|
270
270
|
getSceneElements: () => readonly Ordered<NonDeletedExcalidrawElement>[];
|
|
271
271
|
onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
@@ -397,6 +397,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
397
397
|
*/
|
|
398
398
|
captureUpdate?: SceneData["captureUpdate"];
|
|
399
399
|
}) => void;
|
|
400
|
+
applyDeltas: (deltas: StoreDelta[], options?: ApplyToOptions) => [SceneElementsMap, AppState, boolean];
|
|
400
401
|
mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
|
|
401
402
|
private triggerRender;
|
|
402
403
|
/**
|
|
@@ -9,18 +9,18 @@ export type RestoredDataState = {
|
|
|
9
9
|
files: BinaryFiles;
|
|
10
10
|
};
|
|
11
11
|
export declare const restoreElement: (element: Exclude<ExcalidrawElement, ExcalidrawSelectionElement>, opts?: {
|
|
12
|
-
|
|
12
|
+
deleteInvisibleElements?: boolean;
|
|
13
13
|
}) => ExcalidrawLinearElement | import("@excalidraw/element/types").ExcalidrawRectangleElement | import("@excalidraw/element/types").ExcalidrawDiamondElement | import("@excalidraw/element/types").ExcalidrawEllipseElement | import("@excalidraw/element/types").ExcalidrawEmbeddableElement | import("@excalidraw/element/types").ExcalidrawIframeElement | import("@excalidraw/element/types").ExcalidrawImageElement | import("@excalidraw/element/types").ExcalidrawFrameElement | import("@excalidraw/element/types").ExcalidrawMagicFrameElement | ExcalidrawTextElement | import("@excalidraw/element/types").ExcalidrawFreeDrawElement | ExcalidrawArrowElement | null;
|
|
14
14
|
export declare const restoreElements: (elements: ImportedDataState["elements"], localElements: readonly ExcalidrawElement[] | null | undefined, opts?: {
|
|
15
15
|
refreshDimensions?: boolean;
|
|
16
16
|
repairBindings?: boolean;
|
|
17
|
-
|
|
17
|
+
deleteInvisibleElements?: boolean;
|
|
18
18
|
} | undefined) => OrderedExcalidrawElement[];
|
|
19
19
|
export declare const restoreAppState: (appState: ImportedDataState["appState"], localAppState: Partial<AppState> | null | undefined) => RestoredAppState;
|
|
20
20
|
export declare const restore: (data: Pick<ImportedDataState, "appState" | "elements" | "files"> | null, localAppState: Partial<AppState> | null | undefined, localElements: readonly ExcalidrawElement[] | null | undefined, elementsConfig?: {
|
|
21
21
|
refreshDimensions?: boolean;
|
|
22
22
|
repairBindings?: boolean;
|
|
23
|
-
|
|
23
|
+
deleteInvisibleElements?: boolean;
|
|
24
24
|
}) => RestoredDataState;
|
|
25
25
|
export declare const restoreLibraryItems: (libraryItems: ImportedDataState["libraryItems"], defaultStatus: LibraryItem["status"]) => LibraryItem[];
|
|
26
26
|
export {};
|
|
@@ -618,6 +618,7 @@ export type PointerDownState = Readonly<{
|
|
|
618
618
|
export type UnsubscribeCallback = () => void;
|
|
619
619
|
export interface ExcalidrawImperativeAPI {
|
|
620
620
|
updateScene: InstanceType<typeof App>["updateScene"];
|
|
621
|
+
applyDeltas: InstanceType<typeof App>["applyDeltas"];
|
|
621
622
|
mutateElement: InstanceType<typeof App>["mutateElement"];
|
|
622
623
|
updateLibrary: InstanceType<typeof Library>["updateLibrary"];
|
|
623
624
|
resetScene: InstanceType<typeof App>["resetScene"];
|
package/history.ts
CHANGED
|
@@ -175,7 +175,7 @@ export class History {
|
|
|
175
175
|
let nextAppState = appState;
|
|
176
176
|
let containsVisibleChange = false;
|
|
177
177
|
|
|
178
|
-
// iterate through the history entries in case
|
|
178
|
+
// iterate through the history entries in case they result in no visible changes
|
|
179
179
|
while (historyDelta) {
|
|
180
180
|
try {
|
|
181
181
|
[nextElements, nextAppState, containsVisibleChange] =
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@excalidraw/excalidraw",
|
|
3
|
-
"version": "0.18.0-
|
|
3
|
+
"version": "0.18.0-7b8a5f54c",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/types/excalidraw/index.d.ts",
|
|
6
6
|
"main": "./dist/prod/index.js",
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@braintree/sanitize-url": "6.0.2",
|
|
82
|
-
"@excalidraw/common": "0.18.0-
|
|
83
|
-
"@excalidraw/element": "0.18.0-
|
|
84
|
-
"@excalidraw/math": "0.18.0-
|
|
82
|
+
"@excalidraw/common": "0.18.0-7b8a5f54c",
|
|
83
|
+
"@excalidraw/element": "0.18.0-7b8a5f54c",
|
|
84
|
+
"@excalidraw/math": "0.18.0-7b8a5f54c",
|
|
85
85
|
"@excalidraw/laser-pointer": "1.3.1",
|
|
86
86
|
"@excalidraw/mermaid-to-excalidraw": "1.1.2",
|
|
87
87
|
"@excalidraw/random-username": "1.1.0",
|
|
File without changes
|