UNPKG

jupyterlab-emrys

Version:

A computational environment for Jupyter. Powered by Emrys

157 lines (156 loc) 4.16 kB
import { ISession } from 'jupyter-js-services'; import { Message } from 'phosphor-messaging'; import { Widget } from 'phosphor-widget'; import { InspectionHandler } from '../inspector'; import { nbformat } from '../notebook'; import { CodeCellWidget, RawCellWidget } from '../notebook/cells'; import { EdgeLocation, CellEditorWidget } from '../notebook/cells/editor'; import { CompletionWidget } from '../notebook/completion'; import { RenderMime } from '../rendermime'; /** * A widget containing a Jupyter console. */ export declare class ConsoleWidget extends Widget { /** * Construct a console widget. */ constructor(options: ConsoleWidget.IOptions); /** * Get the inspection handler used by the console. * * #### Notes * This is a read-only property. */ inspectionHandler: InspectionHandler; prompt: CodeCellWidget; /** * Get the session used by the console. * * #### Notes * This is a read-only property. */ session: ISession; /** * Dispose of the resources held by the widget. */ dispose(): void; /** * Execute the current prompt. */ execute(): Promise<void>; /** * Clear the code cells. */ clear(): void; /** * Dismiss the completion widget for a console. */ dismissCompletion(): void; /** * Serialize the output. */ serialize(): nbformat.ICodeCell[]; /** * Handle the DOM events for the 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 dock panel's node. It should * not be called directly by user code. */ handleEvent(event: Event): void; /** * Handle `after_attach` messages for the widget. */ protected onAfterAttach(msg: Message): void; /** * Handle `before_detach` messages for the widget. */ protected onBeforeDetach(msg: Message): void; /** * Handle an edge requested signal. */ protected onEdgeRequest(editor: CellEditorWidget, location: EdgeLocation): void; /** * Handle `update_request` messages. */ protected onUpdateRequest(msg: Message): void; /** * Initialize the banner and mimetype. */ protected initialize(): void; /** * Make a new prompt. */ protected newPrompt(): void; /** * Update the console based on the kernel info. */ private _handleInfo(info); private _completion; private _completionHandler; private _inspectionHandler; private _mimetype; private _rendermime; private _renderer; private _history; private _session; } /** * A namespace for ConsoleWidget statics. */ export declare namespace ConsoleWidget { /** * The initialization options for a console widget. */ interface IOptions { /** * The completion widget for a console widget. */ completion?: CompletionWidget; /** * The mime renderer for the console widget. */ rendermime: RenderMime; /** * The renderer for a console widget. */ renderer?: IRenderer; /** * The session for the console widget. */ session: ISession; } /** * A renderer for completion widget nodes. */ interface IRenderer { /** * Create a new banner widget. */ createBanner(): RawCellWidget; /** * Create a new prompt widget. */ createPrompt(rendermime: RenderMime): CodeCellWidget; } /** * The default implementation of an `IRenderer`. */ class Renderer implements IRenderer { /** * Create a new banner widget. */ createBanner(): RawCellWidget; /** * Create a new prompt widget. */ createPrompt(rendermime: RenderMime): CodeCellWidget; } /** * The default `IRenderer` instance. */ const defaultRenderer: Renderer; }