import { IInputs } from './inputs/inputs'; import { ClientState } from './socketClient'; import { IDecoder } from './decoder'; import { Vim } from './vim'; import { ILoadRequest } from './loadRequest'; import { ILogger } from './logger'; import { IViewport } from './viewport'; import { ColorManager } from './colorManager'; import { ICamera } from './camera'; import { RpcSafeClient } from './rpcSafeClient'; import { ISimpleEvent } from 'ste-simple-events'; import { IReadonlyVimCollection } from './vimCollection'; import { IRenderer } from './renderer'; export declare const DEFAULT_LOCAL_ULTRA_SERVER_URL = "ws://localhost:8123"; export declare const INVALID_HANDLE = 4294967295; /** * The main Viewer class responsible for managing VIM files, * handling connections, and coordinating various components like the camera, decoder, and inputs. */ export declare class Viewer { private readonly _decoder; private readonly _socketClient; private readonly _input; private readonly _logger; private readonly _canvas; private readonly _renderer; private readonly _viewport; private readonly _camera; private readonly _selection; private readonly _vims; private _disposed; /** * The camera API for controlling camera movements and settings. */ get camera(): ICamera; /** * The RPC client for making remote procedure calls. */ readonly rpc: RpcSafeClient; /** * The input API for handling user input events. */ get inputs(): IInputs; get vims(): IReadonlyVimCollection; /** * The viewport API for managing the rendering viewport. */ get viewport(): IViewport; get renderer(): IRenderer; get decoder(): IDecoder; /** * API to create, manage, and destroy colors. */ readonly colors: ColorManager; /** * Gets the current URL to which the viewer is connected. * @returns The URL as a string, or undefined if not connected. */ get serverUrl(): string | undefined; /** * Event that is triggered when the viewer's connection status changes. * @returns An event that emits the current ClientStatus. */ get onStateChanged(): ISimpleEvent; /** * Gets the current connection status of the viewer. * @returns The current ClientStatus. */ get state(): ClientState; /** * Creates a Viewer instance with a new canvas element appended to the given parent element. * @param parent - The parent HTML element to which the canvas will be appended. * @param logger - Optional logger for logging messages. * @returns A new instance of the Viewer class. */ static createWithCanvas(parent: HTMLElement, logger?: ILogger): Viewer; /** * Constructs a new Viewer instance. * @param canvas - The HTML canvas element for rendering. * @param logger - Optional logger for logging messages. */ constructor(canvas: HTMLCanvasElement, logger?: ILogger); /** * Handles connection logic when the viewer connects to the server. * Initializes components and checks for API version compatibility. */ private onConnect; private checkAPIVersion; /** * Handles disconnection logic when the viewer disconnects from the server. * Cleans up resources and stops tracking. */ private onDisconnect; /** * Connects to a VIM Ultra server. * @param url - The server URL to connect to. Defaults to 'ws://localhost:8123'. * @returns A promise that resolves when the connection is established. */ connect(url?: string): Promise; /** * Disconnects from the current VIM Ultra server. */ disconnect(): void; /** * Requests the server to load the given URL or file path. * @param path - The path or URL to the VIM file. * @returns A load request object that can be used to wait for the load to complete. */ loadVim(path: string): ILoadRequest; /** * Unloads the given VIM from the viewer. * @param vim - The VIM instance to unload. */ unloadVim(vim: Vim): void; /** * Clears all loaded VIMs from the viewer. */ clearVims(): void; /** * Disposes all resources used by the viewer and disconnects from the server. */ dispose(): void; }