@q9labsai/chalk-whiteboard 4.1.14 → 4.1.16
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/{chunk-GCF4VS3K.js → chunk-F4B4ANIZ.js} +25 -2
- package/dist/collab/camera.d.ts +8 -0
- package/dist/collab/engine.d.ts +3 -4
- package/dist/collab/index.js +1 -1
- package/dist/embedded/chalk-whiteboard/asset-manifest.json +2 -2
- package/dist/embedded/chalk-whiteboard/renderer.js +581 -581
- package/dist/embedded/index.js +3 -0
- package/dist/embedded/renderer-viewport.d.ts +11 -0
- package/dist/{engine-G43PIN76.js → engine-5XZHDUXG.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
// src/collab/engine.ts
|
|
2
2
|
import { CaptureUpdateAction as CaptureUpdateAction2, hashElementsVersion, reconcileElements, restoreElements } from "@excalidraw/excalidraw";
|
|
3
3
|
|
|
4
|
+
// src/collab/camera.ts
|
|
5
|
+
function getWhiteboardCamera(appState) {
|
|
6
|
+
return {
|
|
7
|
+
scrollX: appState.scrollX,
|
|
8
|
+
scrollY: appState.scrollY,
|
|
9
|
+
zoom: appState.zoom
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function withLocalWhiteboardCamera(sharedAppState, localAppState) {
|
|
13
|
+
return {
|
|
14
|
+
viewBackgroundColor: sharedAppState?.viewBackgroundColor ?? localAppState.viewBackgroundColor,
|
|
15
|
+
...getWhiteboardCamera(localAppState)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
4
19
|
// src/collab/files.ts
|
|
5
20
|
import { CaptureUpdateAction, MIME_TYPES, newElementWith } from "@excalidraw/excalidraw";
|
|
6
21
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
@@ -651,6 +666,7 @@ var ExcalidrawCollabEngine = class {
|
|
|
651
666
|
}
|
|
652
667
|
applyRemoteElements(args) {
|
|
653
668
|
const remoteSceneId = args.sceneId;
|
|
669
|
+
const replacingScene = this.sceneId !== null && remoteSceneId !== this.sceneId;
|
|
654
670
|
if (!this.sceneId) {
|
|
655
671
|
this.sceneId = remoteSceneId;
|
|
656
672
|
} else if (args.isSnapshot) {
|
|
@@ -669,9 +685,16 @@ var ExcalidrawCollabEngine = class {
|
|
|
669
685
|
return;
|
|
670
686
|
}
|
|
671
687
|
}
|
|
688
|
+
if (replacingScene) {
|
|
689
|
+
if (this.changeDebounce !== null) clearTimeout(this.changeDebounce);
|
|
690
|
+
this.changeDebounce = null;
|
|
691
|
+
this.dirtyDuringSubmission = false;
|
|
692
|
+
this.sceneGeneration = null;
|
|
693
|
+
}
|
|
672
694
|
if (args.sceneGeneration) this.sceneGeneration = args.sceneGeneration;
|
|
673
695
|
const excalidrawAPI = this.opts.excalidrawAPI;
|
|
674
|
-
|
|
696
|
+
if (replacingScene) excalidrawAPI.history.clear();
|
|
697
|
+
const local = replacingScene ? [] : excalidrawAPI.getSceneElementsIncludingDeleted();
|
|
675
698
|
const remoteElements = args.remoteElements;
|
|
676
699
|
const restoredRemote = restoreElements(remoteElements, local);
|
|
677
700
|
const remoteForReconcile = toReconcileRemoteElements(restoredRemote);
|
|
@@ -683,7 +706,7 @@ var ExcalidrawCollabEngine = class {
|
|
|
683
706
|
}
|
|
684
707
|
excalidrawAPI.updateScene({
|
|
685
708
|
elements: reconciled,
|
|
686
|
-
appState: args.appState,
|
|
709
|
+
appState: withLocalWhiteboardCamera(args.appState, excalidrawAPI.getAppState()),
|
|
687
710
|
captureUpdate: CaptureUpdateAction2.NEVER
|
|
688
711
|
});
|
|
689
712
|
this.filesSync.handleRemoteScene(reconciled);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AppState } from "./types.js";
|
|
2
|
+
export type WhiteboardCamera = Pick<AppState, "scrollX" | "scrollY" | "zoom">;
|
|
3
|
+
export type SharedWhiteboardAppState = {
|
|
4
|
+
readonly viewBackgroundColor?: string;
|
|
5
|
+
};
|
|
6
|
+
export type WhiteboardViewportAppState = Pick<AppState, "scrollX" | "scrollY" | "zoom" | "viewBackgroundColor">;
|
|
7
|
+
export declare function getWhiteboardCamera(appState: WhiteboardCamera): WhiteboardCamera;
|
|
8
|
+
export declare function withLocalWhiteboardCamera(sharedAppState: SharedWhiteboardAppState | undefined, localAppState: WhiteboardViewportAppState): WhiteboardViewportAppState;
|
package/dist/collab/engine.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SharedWhiteboardAppState } from "./camera.js";
|
|
1
2
|
import type { WhiteboardFileSyncState, WhiteboardFileTransferOptions } from "./files.js";
|
|
2
3
|
import type { AppState, BinaryFiles, ExcalidrawImperativeAPI, OrderedExcalidrawElement } from "./types.js";
|
|
3
4
|
import { type WhiteboardCommit, type WhiteboardWireElement } from "./wire.js";
|
|
@@ -7,9 +8,7 @@ export type WhiteboardCollaborationEvent = {
|
|
|
7
8
|
readonly revision: string;
|
|
8
9
|
readonly sceneGeneration?: string;
|
|
9
10
|
readonly elements: readonly WhiteboardWireElement[];
|
|
10
|
-
readonly appState?:
|
|
11
|
-
readonly viewBackgroundColor?: string;
|
|
12
|
-
};
|
|
11
|
+
readonly appState?: SharedWhiteboardAppState;
|
|
13
12
|
} | {
|
|
14
13
|
readonly type: "update";
|
|
15
14
|
readonly sceneId: string;
|
|
@@ -92,7 +91,7 @@ export declare class ExcalidrawCollabEngine {
|
|
|
92
91
|
sceneId: string;
|
|
93
92
|
sceneGeneration?: string;
|
|
94
93
|
elements: readonly WhiteboardWireElement[];
|
|
95
|
-
appState?:
|
|
94
|
+
appState?: SharedWhiteboardAppState;
|
|
96
95
|
}): void;
|
|
97
96
|
private flushNow;
|
|
98
97
|
private flushOnDispose;
|
package/dist/collab/index.js
CHANGED
|
@@ -1216,8 +1216,8 @@
|
|
|
1216
1216
|
},
|
|
1217
1217
|
{
|
|
1218
1218
|
"path": "renderer.js",
|
|
1219
|
-
"bytes":
|
|
1220
|
-
"sha256": "
|
|
1219
|
+
"bytes": 8501481,
|
|
1220
|
+
"sha256": "0c4c6df489516442d98fb69d33d1129d762ba3404a2eaf6f3e7fd7ea391cb6d9"
|
|
1221
1221
|
},
|
|
1222
1222
|
{
|
|
1223
1223
|
"path": "THIRD_PARTY_NOTICES.json",
|