@excalidraw/excalidraw 0.18.0-dda3affcb → 0.18.0-de715913e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dev/index.js CHANGED
@@ -319,7 +319,8 @@ import {
319
319
  CaptureUpdateAction as CaptureUpdateAction37,
320
320
  hitElementBoundingBox as hitElementBoundingBox2,
321
321
  isLineElement as isLineElement7,
322
- isSimpleArrow
322
+ isSimpleArrow,
323
+ StoreDelta as StoreDelta2
323
324
  } from "@excalidraw/element";
324
325
 
325
326
  // actions/actionDeleteSelected.tsx
@@ -32476,6 +32477,21 @@ var App = class _App extends React43.Component {
32476
32477
  }
32477
32478
  }
32478
32479
  ));
32480
+ __publicField(this, "applyDeltas", (deltas, options) => {
32481
+ if (!deltas.length) {
32482
+ throw new Error("No deltas were passed in!");
32483
+ }
32484
+ const nextElements = new Map(
32485
+ this.scene.getElementsMapIncludingDeleted()
32486
+ );
32487
+ const nextAppState = { ...this.state };
32488
+ const [head, ...tail] = deltas;
32489
+ const mainDelta = StoreDelta2.load(head);
32490
+ for (const delta of tail) {
32491
+ mainDelta.squash(delta);
32492
+ }
32493
+ return StoreDelta2.applyTo(mainDelta, nextElements, nextAppState, options);
32494
+ });
32479
32495
  __publicField(this, "mutateElement", (element, updates, informMutation = true) => {
32480
32496
  return this.scene.mutateElement(element, updates, {
32481
32497
  informMutation,
@@ -35870,6 +35886,7 @@ var App = class _App extends React43.Component {
35870
35886
  if (excalidrawAPI) {
35871
35887
  const api = {
35872
35888
  updateScene: this.updateScene,
35889
+ applyDeltas: this.applyDeltas,
35873
35890
  mutateElement: this.mutateElement,
35874
35891
  updateLibrary: this.library.updateLibrary,
35875
35892
  addFiles: this.addFiles,