canvu-react 0.3.10 → 0.3.12
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/asset-hydration-3Iv5xHxM.d.cts +27 -0
- package/dist/asset-hydration-BEG21hMp.d.ts +27 -0
- package/dist/chatbot.d.cts +2 -2
- package/dist/chatbot.d.ts +2 -2
- package/dist/index.cjs +469 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +468 -9
- package/dist/index.js.map +1 -1
- package/dist/native.cjs +645 -704
- package/dist/native.cjs.map +1 -1
- package/dist/native.js +645 -704
- package/dist/native.js.map +1 -1
- package/dist/react.cjs +354 -137
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +9 -16
- package/dist/react.d.ts +9 -16
- package/dist/react.js +354 -138
- package/dist/react.js.map +1 -1
- package/dist/realtime.cjs +566 -55
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +40 -5
- package/dist/realtime.d.ts +40 -5
- package/dist/realtime.js +566 -56
- package/dist/realtime.js.map +1 -1
- package/dist/{shape-builders-DxPoOecg.d.cts → shape-builders-DFudWDFI.d.cts} +111 -1
- package/dist/{shape-builders-DTYvub8W.d.ts → shape-builders-ENwnK-zT.d.ts} +111 -1
- package/dist/{types-DgEArHkA.d.ts → types-BtAJFS_-.d.ts} +1 -0
- package/dist/{types-BtLGGw0r.d.cts → types-CTyASYIm.d.cts} +2 -105
- package/dist/{types-B58i5k-u.d.cts → types-DNwjgs5U.d.cts} +1 -0
- package/dist/{types-ChnTSRSe.d.ts → types-UvUy2Eed.d.ts} +2 -105
- package/package.json +1 -1
package/dist/realtime.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { P as PlacementPreview,
|
|
2
|
-
export {
|
|
1
|
+
import { P as PlacementPreview, R as RemotePresenceMarkupStroke, O as RemotePresencePeer, Q as RemotePresenceCamera, S as RealtimeConnectionState, D as VectorViewportHandle, V as VectorToolDefinition, E as VectorViewportProps, C as CanvasPlugin, d as CanvasPluginRenderContext } from './types-CTyASYIm.cjs';
|
|
2
|
+
export { T as PresenceOverlayRenderContext } from './types-CTyASYIm.cjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { C as Camera2D } from './camera-BwQjm5oh.cjs';
|
|
5
5
|
import { V as VectorSceneItem, R as Rect } from './types-CB0TZZuk.cjs';
|
|
6
6
|
import { ReactNode, RefObject } from 'react';
|
|
7
|
-
import { a as VectorCanvasRemoteAdapter } from './types-
|
|
8
|
-
import './shape-builders-
|
|
7
|
+
import { a as VectorCanvasRemoteAdapter } from './types-DNwjgs5U.cjs';
|
|
8
|
+
import './shape-builders-DFudWDFI.cjs';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Maps a local {@link PlacementPreview} stroke to {@link RemotePresenceMarkupStroke} for broadcasting.
|
|
@@ -222,14 +222,27 @@ type BindViewportPresenceOptions = {
|
|
|
222
222
|
activeTool?: string;
|
|
223
223
|
viewportRef?: RefObject<VectorViewportHandle | null>;
|
|
224
224
|
};
|
|
225
|
+
type RealtimeSyncState = "connected" | "reconnecting" | "offline" | "conflicted";
|
|
226
|
+
type RealtimeDocumentConflict = {
|
|
227
|
+
readonly serverRevision: number;
|
|
228
|
+
readonly serverItems: VectorSceneItem[];
|
|
229
|
+
readonly localItems: VectorSceneItem[];
|
|
230
|
+
};
|
|
225
231
|
type UseRealtimeSessionResult = {
|
|
226
232
|
connection: RealtimeConnectionInfo;
|
|
227
233
|
sessionPeers: RealtimeSessionPeer[];
|
|
228
234
|
remotePresence: RealtimeSessionPeer[];
|
|
229
235
|
remoteAdapter: VectorCanvasRemoteAdapter;
|
|
230
236
|
document: RealtimeDocumentSnapshot | null;
|
|
237
|
+
hasLocalOfflineDraft: boolean;
|
|
238
|
+
hasPendingDocumentSync: boolean;
|
|
239
|
+
syncState: RealtimeSyncState;
|
|
240
|
+
conflict: RealtimeDocumentConflict | null;
|
|
231
241
|
bindViewportPresence: (options?: BindViewportPresenceOptions) => RealtimeViewportPresenceBindings;
|
|
232
242
|
syncViewportPresence: (options?: BindViewportPresenceOptions) => boolean;
|
|
243
|
+
resolveConflict: (action: "keep-local" | "use-server") => void;
|
|
244
|
+
clearLocalDraft: () => void;
|
|
245
|
+
flushDocumentSync: () => Promise<void>;
|
|
233
246
|
disconnect: () => void;
|
|
234
247
|
reconnectNow: () => void;
|
|
235
248
|
};
|
|
@@ -312,6 +325,28 @@ type RealtimeSessionPluginOptions = RealtimeSessionPanelProps;
|
|
|
312
325
|
*/
|
|
313
326
|
declare function realtimeSessionPlugin(options: RealtimeSessionPluginOptions): CanvasPlugin;
|
|
314
327
|
|
|
328
|
+
type UseRealtimeCanvasDocumentOptions = {
|
|
329
|
+
session: Pick<UseRealtimeSessionResult, "connection" | "document" | "remoteAdapter" | "hasLocalOfflineDraft" | "hasPendingDocumentSync" | "syncState" | "conflict" | "resolveConflict" | "clearLocalDraft" | "flushDocumentSync"> | null;
|
|
330
|
+
items: readonly VectorSceneItem[];
|
|
331
|
+
onItemsChange?: (nextItems: VectorSceneItem[]) => void;
|
|
332
|
+
normalizeItems?: (nextItems: readonly VectorSceneItem[]) => VectorSceneItem[];
|
|
333
|
+
hydrateItems?: (nextItems: readonly VectorSceneItem[]) => Promise<VectorSceneItem[]>;
|
|
334
|
+
enabled?: boolean;
|
|
335
|
+
};
|
|
336
|
+
type UseRealtimeCanvasDocumentResult = {
|
|
337
|
+
items: readonly VectorSceneItem[];
|
|
338
|
+
onItemsChange?: (nextItems: VectorSceneItem[]) => void;
|
|
339
|
+
loading: boolean;
|
|
340
|
+
saving: boolean;
|
|
341
|
+
hasLocalOfflineDraft: boolean;
|
|
342
|
+
syncState: RealtimeSyncState;
|
|
343
|
+
conflict: RealtimeDocumentConflict | null;
|
|
344
|
+
resolveConflict: (action: "keep-local" | "use-server") => void;
|
|
345
|
+
clearLocalDraft: () => void;
|
|
346
|
+
flush: () => Promise<void>;
|
|
347
|
+
};
|
|
348
|
+
declare function useRealtimeCanvasDocument(options: UseRealtimeCanvasDocumentOptions): UseRealtimeCanvasDocumentResult;
|
|
349
|
+
|
|
315
350
|
type UseRealtimePeerFollowOptions = {
|
|
316
351
|
viewportRef: RefObject<VectorViewportHandle | null>;
|
|
317
352
|
sessionPeers: RealtimeSessionPeer[];
|
|
@@ -320,4 +355,4 @@ type UseRealtimePeerFollowOptions = {
|
|
|
320
355
|
};
|
|
321
356
|
declare function useRealtimePeerFollow(options: UseRealtimePeerFollowOptions): void;
|
|
322
357
|
|
|
323
|
-
export { PresenceRemoteLayer, type PresenceRemoteLayerProps, REALTIME_COMMENT_TOOL, type RealtimeClientMessage, type RealtimeCollaborationPluginOptions, type RealtimeCommentData, type RealtimeCommentsAuthor, RealtimeCommentsOverlay, type RealtimeCommentsOverlayProps, type RealtimeCommentsPluginOptions, type RealtimeCommentsViewportBindings, type RealtimeConnectionInfo, RealtimeConnectionState, type RealtimeDocumentSnapshot, type RealtimePresencePayload, type RealtimeServerMessage, RealtimeSessionPanel, type RealtimeSessionPanelProps, type RealtimeSessionPeer, type RealtimeSessionPluginOptions, type RealtimeViewportPresenceBindings, RemotePresenceCamera, RemotePresenceMarkupStroke, RemotePresencePeer, type UseRealtimeCommentsOptions, type UseRealtimeCommentsResult, type UseRealtimePeerFollowOptions, type UseRealtimeSessionOptions, type UseRealtimeSessionResult, createRealtimeCommentAvatarDataUrl, createRealtimeCommentDraftItem, createRealtimeCommentItem, defaultPresenceColorForId, getRealtimeCommentData, isRealtimeCommentDraftItem, isRealtimeCommentItem, parseRealtimeClientMessage, parseRealtimeServerMessage, realtimeCollaborationPlugin, realtimeCommentsPlugin, realtimeSessionPlugin, remoteMarkupStrokeFromPlacementPreview, useRealtimeComments, useRealtimePeerFollow, useRealtimeSession, withRealtimeCommentTool };
|
|
358
|
+
export { PresenceRemoteLayer, type PresenceRemoteLayerProps, REALTIME_COMMENT_TOOL, type RealtimeClientMessage, type RealtimeCollaborationPluginOptions, type RealtimeCommentData, type RealtimeCommentsAuthor, RealtimeCommentsOverlay, type RealtimeCommentsOverlayProps, type RealtimeCommentsPluginOptions, type RealtimeCommentsViewportBindings, type RealtimeConnectionInfo, RealtimeConnectionState, type RealtimeDocumentConflict, type RealtimeDocumentSnapshot, type RealtimePresencePayload, type RealtimeServerMessage, RealtimeSessionPanel, type RealtimeSessionPanelProps, type RealtimeSessionPeer, type RealtimeSessionPluginOptions, type RealtimeSyncState, type RealtimeViewportPresenceBindings, RemotePresenceCamera, RemotePresenceMarkupStroke, RemotePresencePeer, type UseRealtimeCanvasDocumentResult, type UseRealtimeCommentsOptions, type UseRealtimeCommentsResult, type UseRealtimePeerFollowOptions, type UseRealtimeSessionOptions, type UseRealtimeSessionResult, createRealtimeCommentAvatarDataUrl, createRealtimeCommentDraftItem, createRealtimeCommentItem, defaultPresenceColorForId, getRealtimeCommentData, isRealtimeCommentDraftItem, isRealtimeCommentItem, parseRealtimeClientMessage, parseRealtimeServerMessage, realtimeCollaborationPlugin, realtimeCommentsPlugin, realtimeSessionPlugin, remoteMarkupStrokeFromPlacementPreview, useRealtimeCanvasDocument, useRealtimeComments, useRealtimePeerFollow, useRealtimeSession, withRealtimeCommentTool };
|
package/dist/realtime.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { P as PlacementPreview,
|
|
2
|
-
export {
|
|
1
|
+
import { P as PlacementPreview, R as RemotePresenceMarkupStroke, O as RemotePresencePeer, Q as RemotePresenceCamera, S as RealtimeConnectionState, D as VectorViewportHandle, V as VectorToolDefinition, E as VectorViewportProps, C as CanvasPlugin, d as CanvasPluginRenderContext } from './types-UvUy2Eed.js';
|
|
2
|
+
export { T as PresenceOverlayRenderContext } from './types-UvUy2Eed.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { C as Camera2D } from './camera-KwCYYPhm.js';
|
|
5
5
|
import { V as VectorSceneItem, R as Rect } from './types-CB0TZZuk.js';
|
|
6
6
|
import { ReactNode, RefObject } from 'react';
|
|
7
|
-
import { a as VectorCanvasRemoteAdapter } from './types-
|
|
8
|
-
import './shape-builders-
|
|
7
|
+
import { a as VectorCanvasRemoteAdapter } from './types-BtAJFS_-.js';
|
|
8
|
+
import './shape-builders-ENwnK-zT.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Maps a local {@link PlacementPreview} stroke to {@link RemotePresenceMarkupStroke} for broadcasting.
|
|
@@ -222,14 +222,27 @@ type BindViewportPresenceOptions = {
|
|
|
222
222
|
activeTool?: string;
|
|
223
223
|
viewportRef?: RefObject<VectorViewportHandle | null>;
|
|
224
224
|
};
|
|
225
|
+
type RealtimeSyncState = "connected" | "reconnecting" | "offline" | "conflicted";
|
|
226
|
+
type RealtimeDocumentConflict = {
|
|
227
|
+
readonly serverRevision: number;
|
|
228
|
+
readonly serverItems: VectorSceneItem[];
|
|
229
|
+
readonly localItems: VectorSceneItem[];
|
|
230
|
+
};
|
|
225
231
|
type UseRealtimeSessionResult = {
|
|
226
232
|
connection: RealtimeConnectionInfo;
|
|
227
233
|
sessionPeers: RealtimeSessionPeer[];
|
|
228
234
|
remotePresence: RealtimeSessionPeer[];
|
|
229
235
|
remoteAdapter: VectorCanvasRemoteAdapter;
|
|
230
236
|
document: RealtimeDocumentSnapshot | null;
|
|
237
|
+
hasLocalOfflineDraft: boolean;
|
|
238
|
+
hasPendingDocumentSync: boolean;
|
|
239
|
+
syncState: RealtimeSyncState;
|
|
240
|
+
conflict: RealtimeDocumentConflict | null;
|
|
231
241
|
bindViewportPresence: (options?: BindViewportPresenceOptions) => RealtimeViewportPresenceBindings;
|
|
232
242
|
syncViewportPresence: (options?: BindViewportPresenceOptions) => boolean;
|
|
243
|
+
resolveConflict: (action: "keep-local" | "use-server") => void;
|
|
244
|
+
clearLocalDraft: () => void;
|
|
245
|
+
flushDocumentSync: () => Promise<void>;
|
|
233
246
|
disconnect: () => void;
|
|
234
247
|
reconnectNow: () => void;
|
|
235
248
|
};
|
|
@@ -312,6 +325,28 @@ type RealtimeSessionPluginOptions = RealtimeSessionPanelProps;
|
|
|
312
325
|
*/
|
|
313
326
|
declare function realtimeSessionPlugin(options: RealtimeSessionPluginOptions): CanvasPlugin;
|
|
314
327
|
|
|
328
|
+
type UseRealtimeCanvasDocumentOptions = {
|
|
329
|
+
session: Pick<UseRealtimeSessionResult, "connection" | "document" | "remoteAdapter" | "hasLocalOfflineDraft" | "hasPendingDocumentSync" | "syncState" | "conflict" | "resolveConflict" | "clearLocalDraft" | "flushDocumentSync"> | null;
|
|
330
|
+
items: readonly VectorSceneItem[];
|
|
331
|
+
onItemsChange?: (nextItems: VectorSceneItem[]) => void;
|
|
332
|
+
normalizeItems?: (nextItems: readonly VectorSceneItem[]) => VectorSceneItem[];
|
|
333
|
+
hydrateItems?: (nextItems: readonly VectorSceneItem[]) => Promise<VectorSceneItem[]>;
|
|
334
|
+
enabled?: boolean;
|
|
335
|
+
};
|
|
336
|
+
type UseRealtimeCanvasDocumentResult = {
|
|
337
|
+
items: readonly VectorSceneItem[];
|
|
338
|
+
onItemsChange?: (nextItems: VectorSceneItem[]) => void;
|
|
339
|
+
loading: boolean;
|
|
340
|
+
saving: boolean;
|
|
341
|
+
hasLocalOfflineDraft: boolean;
|
|
342
|
+
syncState: RealtimeSyncState;
|
|
343
|
+
conflict: RealtimeDocumentConflict | null;
|
|
344
|
+
resolveConflict: (action: "keep-local" | "use-server") => void;
|
|
345
|
+
clearLocalDraft: () => void;
|
|
346
|
+
flush: () => Promise<void>;
|
|
347
|
+
};
|
|
348
|
+
declare function useRealtimeCanvasDocument(options: UseRealtimeCanvasDocumentOptions): UseRealtimeCanvasDocumentResult;
|
|
349
|
+
|
|
315
350
|
type UseRealtimePeerFollowOptions = {
|
|
316
351
|
viewportRef: RefObject<VectorViewportHandle | null>;
|
|
317
352
|
sessionPeers: RealtimeSessionPeer[];
|
|
@@ -320,4 +355,4 @@ type UseRealtimePeerFollowOptions = {
|
|
|
320
355
|
};
|
|
321
356
|
declare function useRealtimePeerFollow(options: UseRealtimePeerFollowOptions): void;
|
|
322
357
|
|
|
323
|
-
export { PresenceRemoteLayer, type PresenceRemoteLayerProps, REALTIME_COMMENT_TOOL, type RealtimeClientMessage, type RealtimeCollaborationPluginOptions, type RealtimeCommentData, type RealtimeCommentsAuthor, RealtimeCommentsOverlay, type RealtimeCommentsOverlayProps, type RealtimeCommentsPluginOptions, type RealtimeCommentsViewportBindings, type RealtimeConnectionInfo, RealtimeConnectionState, type RealtimeDocumentSnapshot, type RealtimePresencePayload, type RealtimeServerMessage, RealtimeSessionPanel, type RealtimeSessionPanelProps, type RealtimeSessionPeer, type RealtimeSessionPluginOptions, type RealtimeViewportPresenceBindings, RemotePresenceCamera, RemotePresenceMarkupStroke, RemotePresencePeer, type UseRealtimeCommentsOptions, type UseRealtimeCommentsResult, type UseRealtimePeerFollowOptions, type UseRealtimeSessionOptions, type UseRealtimeSessionResult, createRealtimeCommentAvatarDataUrl, createRealtimeCommentDraftItem, createRealtimeCommentItem, defaultPresenceColorForId, getRealtimeCommentData, isRealtimeCommentDraftItem, isRealtimeCommentItem, parseRealtimeClientMessage, parseRealtimeServerMessage, realtimeCollaborationPlugin, realtimeCommentsPlugin, realtimeSessionPlugin, remoteMarkupStrokeFromPlacementPreview, useRealtimeComments, useRealtimePeerFollow, useRealtimeSession, withRealtimeCommentTool };
|
|
358
|
+
export { PresenceRemoteLayer, type PresenceRemoteLayerProps, REALTIME_COMMENT_TOOL, type RealtimeClientMessage, type RealtimeCollaborationPluginOptions, type RealtimeCommentData, type RealtimeCommentsAuthor, RealtimeCommentsOverlay, type RealtimeCommentsOverlayProps, type RealtimeCommentsPluginOptions, type RealtimeCommentsViewportBindings, type RealtimeConnectionInfo, RealtimeConnectionState, type RealtimeDocumentConflict, type RealtimeDocumentSnapshot, type RealtimePresencePayload, type RealtimeServerMessage, RealtimeSessionPanel, type RealtimeSessionPanelProps, type RealtimeSessionPeer, type RealtimeSessionPluginOptions, type RealtimeSyncState, type RealtimeViewportPresenceBindings, RemotePresenceCamera, RemotePresenceMarkupStroke, RemotePresencePeer, type UseRealtimeCanvasDocumentResult, type UseRealtimeCommentsOptions, type UseRealtimeCommentsResult, type UseRealtimePeerFollowOptions, type UseRealtimeSessionOptions, type UseRealtimeSessionResult, createRealtimeCommentAvatarDataUrl, createRealtimeCommentDraftItem, createRealtimeCommentItem, defaultPresenceColorForId, getRealtimeCommentData, isRealtimeCommentDraftItem, isRealtimeCommentItem, parseRealtimeClientMessage, parseRealtimeServerMessage, realtimeCollaborationPlugin, realtimeCommentsPlugin, realtimeSessionPlugin, remoteMarkupStrokeFromPlacementPreview, useRealtimeCanvasDocument, useRealtimeComments, useRealtimePeerFollow, useRealtimeSession, withRealtimeCommentTool };
|