jupyterlab-emrys
Version:
A computational environment for Jupyter. Powered by Emrys
177 lines (176 loc) • 4.49 kB
TypeScript
import 'codemirror/mode/meta';
import { IContents, IKernel } from 'jupyter-js-services';
import { IChangedArgs } from 'phosphor-properties';
import { ISignal } from 'phosphor-signaling';
import { Widget } from 'phosphor-widget';
import { IDocumentModel, IWidgetFactory, IDocumentContext, IModelFactory } from './index';
/**
* The default implementation of a document model.
*/
export declare class DocumentModel implements IDocumentModel {
/**
* Construct a new document model.
*/
constructor(languagePreference?: string);
/**
* Get whether the model factory has been disposed.
*/
isDisposed: boolean;
/**
* A signal emitted when the document content changes.
*/
contentChanged: ISignal<IDocumentModel, void>;
/**
* A signal emitted when the document state changes.
*/
stateChanged: ISignal<IDocumentModel, IChangedArgs<any>>;
/**
* The dirty state of the document.
*/
dirty: boolean;
/**
* The read only state of the document.
*/
readOnly: boolean;
/**
* The default kernel name of the document.
*
* #### Notes
* This is a read-only property.
*/
defaultKernelName: string;
/**
* The default kernel language of the document.
*
* #### Notes
* This is a read-only property.
*/
defaultKernelLanguage: string;
/**
* Dispose of the resources held by the document manager.
*/
dispose(): void;
/**
* Serialize the model to a string.
*/
toString(): string;
/**
* Deserialize the model from a string.
*
* #### Notes
* Should emit a [contentChanged] signal.
*/
fromString(value: string): void;
/**
* Serialize the model to JSON.
*/
toJSON(): any;
/**
* Deserialize the model from JSON.
*
* #### Notes
* Should emit a [contentChanged] signal.
*/
fromJSON(value: any): void;
private _text;
private _defaultLang;
private _dirty;
private _readOnly;
private _isDisposed;
}
/**
* An implementation of a model factory for text files.
*/
export declare class TextModelFactory implements IModelFactory {
/**
* The name of the model type.
*
* #### Notes
* This is a read-only property.
*/
name: string;
/**
* The type of the file.
*
* #### Notes
* This is a read-only property.
*/
fileType: IContents.FileType;
/**
* The format of the file.
*
* This is a read-only property.
*/
fileFormat: IContents.FileFormat;
/**
* Get whether the model factory has been disposed.
*/
isDisposed: boolean;
/**
* Dispose of the resources held by the model factory.
*/
dispose(): void;
/**
* Create a new model.
*
* @param languagePreference - An optional kernel language preference.
*
* @returns A new document model.
*/
createNew(languagePreference?: string): IDocumentModel;
/**
* Get the preferred kernel language given an extension.
*/
preferredLanguage(ext: string): string;
private _isDisposed;
}
/**
* An implementation of a model factory for base64 files.
*/
export declare class Base64ModelFactory extends TextModelFactory {
/**
* The name of the model type.
*
* #### Notes
* This is a read-only property.
*/
name: string;
/**
* The type of the file.
*
* #### Notes
* This is a read-only property.
*/
fileType: IContents.FileType;
/**
* The format of the file.
*
* This is a read-only property.
*/
fileFormat: IContents.FileFormat;
}
/**
* The default implemetation of a widget factory.
*/
export declare abstract class ABCWidgetFactory<T extends Widget, U extends IDocumentModel> implements IWidgetFactory<T, U> {
/**
* A signal emitted when a widget is created.
*/
widgetCreated: ISignal<IWidgetFactory<T, U>, T>;
/**
* Get whether the model factory has been disposed.
*/
isDisposed: boolean;
/**
* Dispose of the resources held by the document manager.
*/
dispose(): void;
/**
* Create a new widget given a document model and a context.
*
* #### Notes
* It should emit the [widgetCreated] signal with the new widget.
*/
abstract createNew(context: IDocumentContext<U>, kernel?: IKernel.IModel): T;
private _isDisposed;
}