/** * @license * Copyright 2024 Nuraly, Laabidi Aymen * SPDX-License-Identifier: MIT */ import { BaseCanvasController } from './base.controller.js'; import type { CanvasOperationType, CollaborationState, CollaborationUser, NodeLock, RemoteCursor } from '../interfaces/collaboration.interface.js'; /** * CollaborationController manages real-time collaboration via Socket.IO. * Uses the LumenJS page socket (path `/__nk_socketio/`, namespace * `/nk`). Wire format: all server→client traffic arrives on the * single `nk:data` event carrying `{ event, data }`; client→server uses * `nk:` which the server binds via `on('', …)`. */ export declare class CollaborationController extends BaseCanvasController { private socket; private staleCursorInterval; private keepaliveInterval; private lastCursorBroadcast; private cursorThrottleTimer; private myUserId; private state; private opCounter; private myHeldLocks; /** * Connect via the LumenJS page socket. * @param canvasId workflow/whiteboard id (for local state tracking only) * @param namespace LumenJS namespace, e.g. `/nk/apps/workflows/` * @param userId current user id (used to identify ownership of locks) */ connect(canvasId: string, namespace: string, userId: string): void; disconnect(): void; hostDisconnected(): void; private handleWireMessage; broadcastCursorMove(x: number, y: number): void; private emitCursorMove; broadcastSelectionChange(elementIds: string[]): void; broadcastTypingStart(elementId: string): void; broadcastTypingStop(elementId: string): void; broadcastOperation(type: CanvasOperationType, elementId: string, data: Record): void; /** Acquire an edit lock for a node. Server broadcasts lock:state on grant. */ acquireLock(nodeId: string): void; /** Release a lock this user holds. */ releaseLock(nodeId: string): void; /** Whether a remote user is currently editing this node. */ getRemoteLock(nodeId: string): NodeLock | null; private ensureKeepalive; private handleLockState; private handleOperationReceived; private applyRemoteOperation; getState(): CollaborationState; isConnected(): boolean; getUsers(): CollaborationUser[]; getCursors(): RemoteCursor[]; isElementSelectedByRemote(elementId: string): { userId: string; color: string; username: string; } | null; isElementBeingTypedByRemote(elementId: string): { userId: string; username: string; color: string; } | null; private cleanStaleCursors; } //# sourceMappingURL=collaboration.controller.d.ts.map