import { DataModel } from './data-model.js'; import { Catalog, ComponentApi } from '../catalog/types.js'; import { SurfaceComponentsModel } from './surface-components-model.js'; import { EventSource } from '../common/events.js'; import { A2uiClientAction } from '../schema/client-to-server.js'; /** A function that listens for actions emitted from a surface. */ export type ActionListener = (action: A2uiClientAction) => void | Promise; /** * The state model for a single UI surface. * * A surface is the root container for a set of components and their associated data. * It coordinates data binding, component state, and action dispatching. * * @template T The concrete type of the ComponentApi from the catalog. */ export declare class SurfaceModel { readonly id: string; readonly catalog: Catalog; readonly theme: any; readonly sendDataModel: boolean; /** The data model for this surface. */ readonly dataModel: DataModel; /** The collection of component models for this surface. */ readonly componentsModel: SurfaceComponentsModel; private readonly _onAction; private readonly _onError; /** Fires whenever an action is dispatched from this surface. */ readonly onAction: EventSource; /** Fires whenever an error occurs on this surface. */ readonly onError: EventSource; /** * Creates a new surface model. * * @param id The unique identifier for this surface. * @param catalog The component catalog used by this surface. * @param theme The theme to apply to this surface. * @param sendDataModel If true, the client will send the full data model. */ constructor(id: string, catalog: Catalog, theme?: any, sendDataModel?: boolean); /** * Dispatches an action from this surface to listeners. * * @param payload The action payload (name and context) to dispatch. * @param sourceComponentId The ID of the component that triggered the action. */ dispatchAction(payload: any, sourceComponentId: string): Promise; /** * Dispatches an error from this surface to listeners. * * @param error The error object to dispatch, conforming to client_to_server schema. */ dispatchError(error: { code: string; message: string; [key: string]: any; }): Promise; /** * Disposes of the surface and its resources. */ dispose(): void; } //# sourceMappingURL=surface-model.d.ts.map