@excalidraw/element 0.18.0-b16b6f8fd → 0.18.0-c65b684e9

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.
@@ -29,6 +29,10 @@ export declare class Delta<T> {
29
29
  }>(prevObject: T, nextObject: T, modifier?: (partial: Partial<T>) => Partial<T>, postProcess?: (deleted: Partial<T>, inserted: Partial<T>) => [Partial<T>, Partial<T>]): Delta<T>;
30
30
  static empty(): Delta<unknown>;
31
31
  static isEmpty<T>(delta: Delta<T>): boolean;
32
+ /**
33
+ * Merges two deltas into a new one.
34
+ */
35
+ static merge<T>(delta1: Delta<T>, delta2: Delta<T>): Delta<T>;
32
36
  /**
33
37
  * Merges deleted and inserted object partials.
34
38
  */
@@ -102,18 +106,23 @@ export interface DeltaContainer<T> {
102
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.
103
107
  */
104
108
  applyTo(previous: T, ...options: unknown[]): [T, boolean];
109
+ /**
110
+ * Squashes the current delta with the given one.
111
+ */
112
+ squash(delta: DeltaContainer<T>): this;
105
113
  /**
106
114
  * Checks whether all `Delta`s are empty.
107
115
  */
108
116
  isEmpty(): boolean;
109
117
  }
110
118
  export declare class AppStateDelta implements DeltaContainer<AppState> {
111
- readonly delta: Delta<ObservedAppState>;
119
+ delta: Delta<ObservedAppState>;
112
120
  private constructor();
113
121
  static calculate<T extends ObservedAppState>(prevAppState: T, nextAppState: T): AppStateDelta;
114
122
  static restore(appStateDeltaDTO: DTO<AppStateDelta>): AppStateDelta;
115
123
  static empty(): AppStateDelta;
116
124
  inverse(): AppStateDelta;
125
+ squash(delta: AppStateDelta): this;
117
126
  applyTo(appState: AppState, nextElements: SceneElementsMap): [AppState, boolean];
118
127
  isEmpty(): boolean;
119
128
  /**
@@ -177,6 +186,7 @@ export declare class ElementsDelta implements DeltaContainer<SceneElementsMap> {
177
186
  */
178
187
  applyLatestChanges(prevElements: SceneElementsMap, nextElements: SceneElementsMap, modifierOptions?: "deleted" | "inserted"): ElementsDelta;
179
188
  applyTo(elements: SceneElementsMap, snapshot?: StoreSnapshot["elements"], options?: ApplyToOptions): [SceneElementsMap, boolean];
189
+ squash(delta: ElementsDelta): this;
180
190
  private static createApplier;
181
191
  private static createGetter;
182
192
  private static applyDelta;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excalidraw/element",
3
- "version": "0.18.0-b16b6f8fd",
3
+ "version": "0.18.0-c65b684e9",
4
4
  "type": "module",
5
5
  "types": "./dist/types/element/src/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -57,7 +57,7 @@
57
57
  "build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
58
58
  },
59
59
  "dependencies": {
60
- "@excalidraw/common": "0.18.0-b16b6f8fd",
61
- "@excalidraw/math": "0.18.0-b16b6f8fd"
60
+ "@excalidraw/common": "0.18.0-c65b684e9",
61
+ "@excalidraw/math": "0.18.0-c65b684e9"
62
62
  }
63
63
  }