import { IDisposable } from '@phosphor/disposable'; import { Message } from '@phosphor/messaging'; import { ISignal } from '@phosphor/signaling'; import { Widget } from '@phosphor/widgets'; import { VirtualNode } from '@phosphor/virtualdom'; /** * An interface for a model to be used with vdom rendering. */ export interface IVDomModel extends IDisposable { /** * A signal emited when any model state changes. */ readonly stateChanged: ISignal; } /** * Concrete implementation of IVDomModel. */ export declare class VDomModel implements IVDomModel { /** * A signal emitted when any model state changes. */ readonly stateChanged: ISignal; /** * Test whether the model is disposed. */ readonly isDisposed: boolean; /** * Dispose the model. */ dispose(): void; /** * Trigger a change signal. */ protected triggerChange(): void; private _isDisposed; private _stateChanged; } /** * Phosphor widget that encodes best practices for VDOM based rendering. */ export declare abstract class VDomWidget extends Widget { /** * A signal emited when the model changes. */ readonly modelChanged: ISignal; /** * Get the current model. */ /** * Set the model and fire changed signals. */ model: T; /** * Dispose this widget. */ dispose(): void; /** * Called to update the state of the widget. * * The default implementation of this method triggers * VDOM based rendering by calling the this.render() method. */ protected onUpdateRequest(msg: Message): void; /** * Render the content of this widget using the virtial DOM. * * This method will be called anytime the widget needs to be rendered, * which includes layout triggered rendering and all model changes. * * Subclasses should define this method and use the current model state * in this.model and return a phosphor VirtualNode or VirtualNode[] using the phosphor * VDOM API. */ protected abstract render(): VirtualNode | VirtualNode[]; private _model; private _modelChanged; }