@zsviczian/excalidraw 0.18.0-28 → 0.18.0-29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zsviczian/excalidraw",
3
- "version": "0.18.0-28",
3
+ "version": "0.18.0-29",
4
4
  "main": "main.js",
5
5
  "module": "./dist/prod/index.js",
6
6
  "types": "types/excalidraw/index.d.ts",
@@ -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
  /**
@@ -122,7 +131,6 @@ export declare class AppStateDelta implements DeltaContainer<AppState> {
122
131
  * @returns `true` if a visible change is found, `false` otherwise.
123
132
  */
124
133
  private filterInvisibleChanges;
125
- private static convertToAppStateKey;
126
134
  private static filterSelectedElements;
127
135
  private static filterSelectedGroups;
128
136
  private static stripElementsProps;
@@ -177,6 +185,7 @@ export declare class ElementsDelta implements DeltaContainer<SceneElementsMap> {
177
185
  */
178
186
  applyLatestChanges(prevElements: SceneElementsMap, nextElements: SceneElementsMap, modifierOptions?: "deleted" | "inserted"): ElementsDelta;
179
187
  applyTo(elements: SceneElementsMap, snapshot?: StoreSnapshot["elements"], options?: ApplyToOptions): [SceneElementsMap, boolean];
188
+ squash(delta: ElementsDelta): this;
180
189
  private static createApplier;
181
190
  private static createGetter;
182
191
  private static applyDelta;
@@ -106,10 +106,7 @@ declare class App extends React.Component<AppProps, AppState> {
106
106
  fromSelection: boolean;
107
107
  } & import("../types").ActiveTool, pointerDownState: Readonly<{
108
108
  origin: Readonly<{
109
- x: number; /**
110
- * Returns gridSize taking into account `gridModeEnabled`.
111
- * If disabled, returns null.
112
- */
109
+ x: number;
113
110
  y: number;
114
111
  }>;
115
112
  originInGrid: Readonly<{
@@ -178,10 +175,7 @@ declare class App extends React.Component<AppProps, AppState> {
178
175
  fromSelection: boolean;
179
176
  } & import("../types").ActiveTool, pointerDownState: Readonly<{
180
177
  origin: Readonly<{
181
- x: number; /**
182
- * Returns gridSize taking into account `gridModeEnabled`.
183
- * If disabled, returns null.
184
- */
178
+ x: number;
185
179
  y: number;
186
180
  }>;
187
181
  originInGrid: Readonly<{
@@ -3,4 +3,5 @@ import type { MakeBrand } from "@excalidraw/common/utility-types";
3
3
  import type { AppState } from "../types";
4
4
  export type ReconciledExcalidrawElement = OrderedExcalidrawElement & MakeBrand<"ReconciledElement">;
5
5
  export type RemoteExcalidrawElement = OrderedExcalidrawElement & MakeBrand<"RemoteExcalidrawElement">;
6
+ export declare const shouldDiscardRemoteElement: (localAppState: AppState, local: OrderedExcalidrawElement | undefined, remote: RemoteExcalidrawElement) => boolean;
6
7
  export declare const reconcileElements: (localElements: readonly OrderedExcalidrawElement[], remoteElements: readonly RemoteExcalidrawElement[], localAppState: AppState) => ReconciledExcalidrawElement[];
@@ -35,3 +35,6 @@ export declare function getSharedMermaidInstance(): Promise<MermaidToExcalidrawL
35
35
  export declare function loadMermaid(): Promise<MermaidToExcalidrawLibProps>;
36
36
  export declare const intersectElementWithLine: (element: ExcalidrawElement, a: GlobalPoint, b: GlobalPoint, gap: number | undefined, elementsMap: ElementsMap) => GlobalPoint[] | undefined;
37
37
  export declare const disableDoubleClickTextEditing: () => any;
38
+ export declare const getZoomStep: () => any;
39
+ export declare const getZoomMin: () => any;
40
+ export declare const getZoomMax: () => any;
@@ -162,8 +162,10 @@ export type ObservedElementsAppState = {
162
162
  editingGroupId: AppState["editingGroupId"];
163
163
  selectedElementIds: AppState["selectedElementIds"];
164
164
  selectedGroupIds: AppState["selectedGroupIds"];
165
- selectedLinearElementId: LinearElementEditor["elementId"] | null;
166
- selectedLinearElementIsEditing: boolean | null;
165
+ selectedLinearElement: {
166
+ elementId: LinearElementEditor["elementId"];
167
+ isEditing: boolean;
168
+ } | null;
167
169
  croppingElementId: AppState["croppingElementId"];
168
170
  lockedMultiSelections: AppState["lockedMultiSelections"];
169
171
  activeLockedId: AppState["activeLockedId"];