UNPKG

jupyterlab-emrys

Version:

A computational environment for Jupyter. Powered by Emrys

285 lines (284 loc) 7.32 kB
import { Message } from 'phosphor-messaging'; import { ISignal } from 'phosphor-signaling'; import { Widget } from 'phosphor-widget'; import { RenderMime } from '../../rendermime'; import { nbformat } from '../notebook/nbformat'; import { OutputAreaModel } from './model'; /** * An output area widget. * * #### Notes * The widget model must be set separately and can be changed * at any time. Consumers of the widget must account for a * `null` model, and may want to listen to the `modelChanged` * signal. */ export declare class OutputAreaWidget extends Widget { /** * Construct an output area widget. */ constructor(options: OutputAreaWidget.IOptions); /** * Create a mirrored output widget. */ mirror(): OutputAreaWidget; /** * A signal emitted when the widget's model changes. */ modelChanged: ISignal<OutputAreaWidget, void>; /** * A signal emitted when the widget's model is disposed. */ modelDisposed: ISignal<OutputAreaWidget, void>; /** * The model for the widget. */ model: OutputAreaModel; /** * Get the rendermime instance used by the widget. * * #### Notes * This is a read-only property. */ rendermime: RenderMime; /** * Get the renderer used by the widget. * * #### Notes * This is a read-only property. */ renderer: OutputAreaWidget.IRenderer; /** * The trusted state of the widget. */ trusted: boolean; /** * The collapsed state of the widget. */ collapsed: boolean; /** * The fixed height state of the widget. */ fixedHeight: boolean; /** * Dispose of the resources held by the widget. */ dispose(): void; /** * Get the child widget at the specified index. */ childAt(index: number): OutputWidget; /** * Get the number of child widgets. */ childCount(): number; /** * Handle `update_request` messages. */ protected onUpdateRequest(msg: Message): void; /** * Handle a new model. * * #### Notes * This method is called after the model change has been handled * internally and before the `modelChanged` signal is emitted. * The default implementation is a no-op. */ protected onModelChanged(oldValue: OutputAreaModel, newValue: OutputAreaModel): void; /** * Handle a change to the model. */ private _onModelChanged(oldValue, newValue); /** * Handle a model disposal. */ protected onModelDisposed(oldValue: OutputAreaModel, newValue: OutputAreaModel): void; private _onModelDisposed(); /** * Add a child to the layout. */ private _addChild(); /** * Remove a child from the layout. */ private _removeChild(index); /** * Update a child in the layout. */ private _updateChild(index); /** * Follow changes on the model state. */ private _onModelStateChanged(sender, args); private _trusted; private _fixedHeight; private _collapsed; private _model; private _rendermime; private _renderer; } /** * A namespace for OutputAreaWidget statics. */ export declare namespace OutputAreaWidget { /** * The options to pass to an `OutputAreaWidget`. */ interface IOptions { /** * The rendermime instance used by the widget. */ rendermime: RenderMime; /** * The output widget renderer. * * Defaults to a shared `IRenderer` instance. */ renderer?: IRenderer; } /** * An output widget renderer. */ interface IRenderer { /** * Create an output widget. * * * @returns A new widget for an output. */ createOutput(options: OutputWidget.IOptions): Widget; } /** * The default implementation of `IRenderer`. */ class Renderer implements IRenderer { /** * Create an output widget. * * * @returns A new widget for an output. */ createOutput(options: OutputWidget.IOptions): OutputWidget; } /** * The default `Renderer` instance. */ const defaultRenderer: Renderer; } /** * The gutter on the left side of the OutputWidget */ export declare class OutputGutter extends Widget { /** * Handle the DOM events for the output gutter widget. * * @param event - The DOM event sent to the widget. * * #### Notes * This method implements the DOM `EventListener` interface and is * called in response to events on the panel's DOM node. It should * not be called directly by user code. */ handleEvent(event: Event): void; /** * A message handler invoked on an `'after-attach'` message. */ protected onAfterAttach(msg: Message): void; /** * A message handler invoked on a `'before-detach'` message. */ protected onBeforeDetach(msg: Message): void; /** * Handle the `'mousedown'` event for the widget. */ private _evtMousedown(event); /** * Handle the `'mouseup'` event for the widget. */ private _evtMouseup(event); /** * Handle the `'mousemove'` event for the widget. */ private _evtMousemove(event); /** * Start a drag event. */ private _startDrag(clientX, clientY); /** * Dispose of the resources held by the widget. */ dispose(): void; private _drag; private _dragData; } /** * An output widget. */ export declare class OutputWidget extends Widget { /** * Construct a new output widget. */ constructor(options: OutputWidget.IOptions); /** * The prompt widget used by the output widget. * * #### Notes * This is a read-only property. */ prompt: Widget; /** * The rendered output used by the output widget. * * #### Notes * This is a read-only property. */ output: Widget; /** * Dispose of the resources held by the widget. */ dispose(): void; /** * Clear the widget contents. */ clear(): void; /** * Render an output. * * @param output - The kernel output message payload. * * @param trusted - Whether the output is trusted. */ render(output: OutputAreaModel.Output, trusted?: boolean): void; /** * Set the widget output. */ protected setOutput(value: Widget): void; /** * Get the mime bundle for an output. * * @params output - A kernel output message payload. * * @returns - A mime bundle for the payload. */ protected getBundle(output: nbformat.IOutput): nbformat.MimeBundle; /** * Convert a mime bundle to a mime map. */ protected convertBundle(bundle: nbformat.MimeBundle): RenderMime.MimeMap<string>; private _rendermime; private _placeholder; } /** * A namespace for OutputArea statics. */ export declare namespace OutputWidget { /** * The options to pass to an `OutputWidget`. */ interface IOptions { /** * The rendermime instance used by the widget. */ rendermime: RenderMime; } }