@q9labsai/chalk-whiteboard 4.1.16 → 5.0.0

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.
@@ -51,13 +51,17 @@ export declare class ExcalidrawCollabEngine {
51
51
  private sceneId;
52
52
  private sceneGeneration;
53
53
  private canDraw;
54
- private lastBroadcastedOrReceivedElementsHash;
54
+ private storedImageFileIds;
55
55
  private broadcastedElementVersions;
56
+ private rejectedElementVersions;
57
+ private deferredRemoteElements;
56
58
  private submissionInFlight;
57
59
  private dirtyDuringSubmission;
58
60
  private disposed;
59
61
  private changeDebounce;
60
- private fullSyncTimer;
62
+ private changeDebounceDeadline;
63
+ private submissionRetryTimer;
64
+ private submissionRetries;
61
65
  private readonly filesSync;
62
66
  private readonly presence;
63
67
  private readonly unsubPointerUp;
@@ -66,7 +70,7 @@ export declare class ExcalidrawCollabEngine {
66
70
  setCanDraw(next: boolean): void;
67
71
  clear(): Promise<WhiteboardCommit>;
68
72
  dispose(): void;
69
- handleChange(_elements: readonly OrderedExcalidrawElement[], _appState: AppState, files: BinaryFiles): void;
73
+ handleChange(_elements: readonly OrderedExcalidrawElement[], _appState: AppState, _files: BinaryFiles): void;
70
74
  handlePointerUpdate(payload: {
71
75
  pointer: {
72
76
  x: number;
@@ -93,13 +97,18 @@ export declare class ExcalidrawCollabEngine {
93
97
  elements: readonly WhiteboardWireElement[];
94
98
  appState?: SharedWhiteboardAppState;
95
99
  }): void;
100
+ private stripUnstoredImages;
96
101
  private flushNow;
97
102
  private flushOnDispose;
98
- private scheduleFullSync;
99
- private sendFullSync;
103
+ private isUnsubmitted;
104
+ private applyDeferredRemoteElements;
105
+ private clearChangeDebounce;
106
+ private resetSubmissionRetries;
107
+ private scheduleSubmissionRetry;
100
108
  private submissionContext;
101
109
  private submit;
102
110
  private submitFinalUpdate;
111
+ private toSubmissionElements;
103
112
  private applyRemoteElements;
104
113
  private requestSnapshot;
105
114
  }
@@ -1,23 +1,13 @@
1
- import type { BinaryFiles, ExcalidrawImperativeAPI, OrderedExcalidrawElement } from "./types.js";
2
- import type { WhiteboardUploadInstructions } from "./wire.js";
3
- export type WhiteboardFileSyncPhase = "idle" | "uploading" | "awaiting_remote_upload" | "downloading" | "error";
1
+ import type { ExcalidrawImperativeAPI, OrderedExcalidrawElement } from "./types.js";
2
+ export type WhiteboardFileSyncPhase = "idle" | "awaiting_remote_upload" | "downloading" | "error";
4
3
  export interface WhiteboardFileSyncState {
5
4
  phase: WhiteboardFileSyncPhase;
6
- uploading: number;
7
- uploadQueued: number;
8
5
  remotePendingUploads: number;
9
6
  downloading: number;
10
7
  downloadQueued: number;
11
8
  lastErrorAtMs: number | null;
12
9
  }
13
10
  export interface WhiteboardFileTransfer {
14
- readonly upload: (input: {
15
- readonly fileId: string;
16
- readonly mimeType: string;
17
- readonly byteLength: number;
18
- readonly sha256: string;
19
- readonly dataURL: string;
20
- }) => Promise<void>;
21
11
  readonly download: (fileId: string) => Promise<{
22
12
  readonly mimeType: string;
23
13
  readonly dataURL: string;
@@ -25,40 +15,26 @@ export interface WhiteboardFileTransfer {
25
15
  }
26
16
  export interface WhiteboardFileTransferOptions {
27
17
  fileTransfer?: WhiteboardFileTransfer;
28
- initiateUpload?: (input: {
29
- fileId: string;
30
- mimeType: string;
31
- byteLength: number;
32
- sha256: string;
33
- }) => Promise<WhiteboardUploadInstructions>;
34
- finalizeUpload?: (uploadId: string) => Promise<void>;
35
18
  presignDownload?: (fileId: string) => Promise<{
36
19
  downloadUrl: string;
37
20
  }>;
38
21
  }
39
22
  interface WhiteboardFilesSyncOptions extends WhiteboardFileTransferOptions {
40
23
  excalidrawAPI: ExcalidrawImperativeAPI;
41
- uploadThrottleMs?: number;
42
24
  downloadThrottleMs?: number;
43
25
  onStateChange?: (state: WhiteboardFileSyncState) => void;
44
26
  }
45
27
  export declare class WhiteboardFilesSync {
46
28
  private readonly opts;
47
- private uploadTimer;
48
29
  private downloadTimer;
49
- private uploadQueue;
50
30
  private downloadQueue;
51
- private uploading;
52
31
  private downloading;
53
32
  constructor(opts: WhiteboardFilesSyncOptions);
54
33
  private remotePendingUploads;
55
34
  private lastErrorAtMs;
56
- handleLocalScene(elementsAll: readonly OrderedExcalidrawElement[], files: BinaryFiles): void;
57
35
  handleRemoteScene(elementsAll: readonly OrderedExcalidrawElement[]): void;
58
36
  dispose(): void;
59
- private scheduleUpload;
60
37
  private scheduleDownload;
61
- private processNextUpload;
62
38
  private processNextDownload;
63
39
  private emitState;
64
40
  }
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  mergeWhiteboardElements
3
- } from "../chunk-4XG2ABSP.js";
3
+ } from "../chunk-W4FLPXAX.js";
4
4
  import {
5
5
  ExcalidrawCollabEngine,
6
6
  fromWireElement,
7
7
  isWireElement,
8
8
  toWireElement
9
- } from "../chunk-F4B4ANIZ.js";
9
+ } from "../chunk-6ZV7GBAC.js";
10
10
  export {
11
11
  ExcalidrawCollabEngine,
12
12
  fromWireElement,
@@ -0,0 +1,6 @@
1
+ type OrderedElement = {
2
+ readonly index: string | null;
3
+ readonly id: string;
4
+ };
5
+ export declare function compareElementOrder(left: OrderedElement, right: OrderedElement): number;
6
+ export {};
@@ -1,2 +1,4 @@
1
1
  import type { OrderedExcalidrawElement } from "./types.js";
2
2
  export declare const filterSyncableElements: (elements: readonly OrderedExcalidrawElement[]) => OrderedExcalidrawElement[];
3
+ export declare const remoteImageFileIds: (elements: readonly OrderedExcalidrawElement[]) => string[];
4
+ export declare const retainStoredImages: (elements: readonly OrderedExcalidrawElement[], storedFileIds: ReadonlySet<string>) => OrderedExcalidrawElement[];
@@ -1,4 +1,5 @@
1
1
  import type { OrderedExcalidrawElement } from "./types.js";
2
+ export declare const ELEMENT_ENCODED_BYTES_LIMIT: number;
2
3
  export type WhiteboardJsonValue = null | boolean | number | string | readonly WhiteboardJsonValue[] | {
3
4
  readonly [key: string]: WhiteboardJsonValue;
4
5
  };
@@ -25,5 +26,10 @@ export interface WhiteboardUploadInstructions {
25
26
  readonly expiresAt: string;
26
27
  }
27
28
  export declare function toWireElement(element: OrderedExcalidrawElement): WhiteboardWireElement;
29
+ /**
30
+ * The element as the engine submits it. It equals `toWireElement` while the element fits the size that Sync stores.
31
+ * A larger element gets its points rounded and, when that is not enough, thinned. Throws when no copy fits.
32
+ */
33
+ export declare function toFittedWireElement(element: OrderedExcalidrawElement): WhiteboardWireElement;
28
34
  export declare function fromWireElement(element: WhiteboardWireElement): OrderedExcalidrawElement;
29
35
  export declare function isWireElement(value: unknown): value is WhiteboardWireElement;
@@ -1216,8 +1216,8 @@
1216
1216
  },
1217
1217
  {
1218
1218
  "path": "renderer.js",
1219
- "bytes": 8501481,
1220
- "sha256": "0c4c6df489516442d98fb69d33d1129d762ba3404a2eaf6f3e7fd7ea391cb6d9"
1219
+ "bytes": 8497928,
1220
+ "sha256": "7f754073f20cee4b3adceb40731faf75d94849f6ce01a0b2e30fdad10867a5d9"
1221
1221
  },
1222
1222
  {
1223
1223
  "path": "THIRD_PARTY_NOTICES.json",