export interface PresenceUser { name?: string; color?: string; } export interface CursorRenderOpts { /** Milliseconds after which the name label is faded (default 3000). */ fadeAfterMs?: number; /** Milliseconds of inactivity after which the caret is dimmed (default 30000). */ dimAfterMs?: number; /** Milliseconds of inactivity after which the selection highlight is hidden * and the caret is dimmed (default 60000). */ hideAfterMs?: number; } /** Factory that produces a cursor DOM element for a given peer. */ export type CursorRenderer = (peerId: string, user: PresenceUser | undefined, opts: CursorRenderOpts) => HTMLElement; /** Factory that returns a CSS class name for a selection decoration. */ export type SelectionRenderer = (peerId: string, user?: PresenceUser) => string; /** Which horizontal edge the label is anchored to. */ export type LabelSide = 'left' | 'right'; /** Adjust the label's CSS inline styles so it stays inside the viewport. */ export declare const positionLabel: (label: HTMLElement, isFirstLine: boolean, side: LabelSide) => void; /** * Default cursor renderer — a colored caret line with a floating name label. * All lifecycle stages (blink, label fade, dim, disappear) are driven by CSS * animations so no JS timers are needed. The element is designed to be cached * and reused by {@link CursorManager} across decoration rebuilds. */ export declare const renderCursor: CursorRenderer; /** * Manages cached cursor DOM elements keyed by remote peer id. * * By caching elements we ensure: * * 1. CSS animations survive Monaco content widget updates (the same * `HTMLElement` is returned each time). * 2. When a remote cursor moves, the lifecycle animation is restarted so the * cursor re-appears at full opacity and the label is re-shown. * 3. No JS timers need to be managed — everything is CSS-driven. */ export declare class CursorManager { private cache; getOrCreate(processId: string, offset: number, lineHeight: number, isFirstLine: boolean, side: LabelSide, user: PresenceUser | undefined, opts: CursorRenderOpts, receivedAt: number, renderFn: CursorRenderer): HTMLElement; prune(activeIds: Set): void; destroy(): void; /** Set explicit pixel height on the container and bar so the caret is * visible inside a Monaco content widget (which has no inherent height). */ private applySizing; /** Restart all CSS animations on a cached cursor so it re-appears at full * opacity with the label visible — called when the remote cursor moves. */ private resetLifecycle; } /** * Default selection renderer — dynamically injects a `