@jupyterlab/cells

  • Version 4.2.3
  • Published
  • 406 kB
  • 28 dependencies
  • BSD-3-Clause license

Install

npm i @jupyterlab/cells
yarn add @jupyterlab/cells
pnpm add @jupyterlab/cells

Overview

cells

Index

Variables

Functions

Classes

Interfaces

Namespaces

Variables

variable SELECTED_HIGHLIGHT_CLASS

const SELECTED_HIGHLIGHT_CLASS: string;
  • Class applied on highlighted search matches

Functions

function createCellSearchProvider

createCellSearchProvider: (cell: Cell<ICellModel>) => CellSearchProvider;
  • Factory to create a cell search provider

    Parameter cell

    Cell widget

    Returns

    Cell search provider

function isCodeCellModel

isCodeCellModel: (model: ICellModel) => model is ICodeCellModel;

    function isMarkdownCellModel

    isMarkdownCellModel: (model: ICellModel) => model is IMarkdownCellModel;

      function isRawCellModel

      isRawCellModel: (model: ICellModel) => model is IRawCellModel;

        Classes

        class AttachmentsCell

        abstract class AttachmentsCell<T extends IAttachmentsCellModel> extends Cell<T> {}
        • AttachmentsCell - A base class for a cell widget that allows attachments to be drag/drop'd or pasted onto it

        method getEditorOptions

        protected getEditorOptions: () => InputArea.IOptions['editorOptions'];
        • Get the editor options at initialization.

          Returns

          Editor options

        method handleEvent

        handleEvent: (event: Event) => void;
        • Handle the DOM events for the widget.

          Parameter 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 notebook panel's node. It should not be called directly by user code.

        method onAfterAttach

        protected onAfterAttach: (msg: Message) => void;
        • Handle after-attach messages for the widget.

        method onBeforeDetach

        protected onBeforeDetach: (msg: Message) => void;
        • A message handler invoked on a 'before-detach' message

        method updateCellSourceWithAttachment

        protected abstract updateCellSourceWithAttachment: (
        attachmentName: string,
        URI?: string
        ) => void;
        • Modify the cell source to include a reference to the attachment.

        class AttachmentsCellModel

        abstract class AttachmentsCellModel extends CellModel {}
        • A base implementation for cell models with attachments.

        constructor

        constructor(options: AttachmentsCellModel.IOptions<ISharedCell>);
        • Construct a new cell with optional attachments.

        property attachments

        readonly attachments: IAttachmentsModel;
        • Get the attachments of the model.

        method dispose

        dispose: () => void;
        • Dispose of the resources held by the model.

        method toJSON

        toJSON: () => nbformat.IRawCell | nbformat.IMarkdownCell;
        • Serialize the model to JSON.

        class Cell

        class Cell<T extends ICellModel = ICellModel> extends Widget {}
        • A base cell widget.

        constructor

        constructor(options: Cell.IOptions<T>);
        • Construct a new base cell widget.

        property contentFactory

        readonly contentFactory: Cell.IContentFactory;
        • The content factory used by the widget.

        property displayChanged

        readonly displayChanged: ISignal<this, void>;
        • Signal to indicate that widget has changed visibly (in size, in type, etc)

        property editor

        readonly editor: any;
        • Get the CodeEditor used by the cell.

        property editorConfig

        readonly editorConfig: Record<string, any>;
        • Editor configuration

        property editorWidget

        readonly editorWidget: any;
        • Get the CodeEditorWrapper used by the cell.

        property headings

        readonly headings: Cell.IHeading[];
        • Cell headings

        property inputArea

        readonly inputArea: InputArea;
        • Get the input area for the cell.

        property inputHidden

        inputHidden: boolean;
        • The view state of input being hidden.

        property inViewport

        inViewport: boolean;
        • Whether the cell is in viewport or not.

          #### Notes This property is managed by the windowed container which holds the cell. When a cell is not in a windowed container, it always returns false, but this may change in the future major version.

        property inViewportChanged

        readonly inViewportChanged: ISignal<Cell<ICellModel>, boolean>;
        • Will emit true just after the node is attached to the DOM Will emit false just before the node is detached of the DOM

        property model

        readonly model: ICellModel;
        • Get the model used by the cell.

        property placeholder

        placeholder: boolean;
        • Whether the cell is a placeholder not yet fully rendered or not.

        property prompt

        protected prompt: string;

          property promptNode

          readonly promptNode: HTMLElement;
          • Get the prompt node used by the cell.

          property readOnly

          readOnly: boolean;
          • The read only state of the cell.

          property ready

          readonly ready: Promise<void>;
          • A promise that resolves when the widget renders for the first time.

          property scrollRequested

          readonly scrollRequested: ISignal<Cell<ICellModel>, Cell.IScrollRequest>;
          • Signal emitted when cell requests scrolling to its element.

          property syncCollapse

          syncCollapse: boolean;
          • Whether to sync the collapse state to the cell model.

          property syncEditable

          syncEditable: boolean;
          • Whether to sync the editable state to the cell model.

          property translator

          protected translator: ITranslator;

            method clone

            clone: () => Cell<T>;
            • Clone the cell, using the same model.

            method dispose

            dispose: () => void;
            • Dispose of the resources held by the widget.

            method getEditorOptions

            protected getEditorOptions: () => InputArea.IOptions['editorOptions'];
            • Get the editor options at initialization.

              Returns

              Editor options

            method handleInputHidden

            protected handleInputHidden: (value: boolean) => void;
            • Handle the input being hidden.

              #### Notes This is called by the inputHidden setter so that subclasses can perform actions upon the input being hidden without accessing private state.

            method initializeDOM

            protected initializeDOM: () => void;
            • Create children widgets.

            method initializeState

            initializeState: () => this;
            • Initialize view state from model.

              #### Notes Should be called after construction. For convenience, returns this, so it can be chained in the construction, like new Foo().initializeState();

            method isPlaceholder

            isPlaceholder: () => boolean;
            • Whether the cell is a placeholder that defer rendering

              #### Notes You can wait for the promise Cell.ready to wait for the cell to be rendered.

            method loadCollapseState

            loadCollapseState: () => void;
            • Revert view collapse state from model.

            method loadEditableState

            loadEditableState: () => void;
            • Load view editable state from model.

            method onActivateRequest

            protected onActivateRequest: (msg: Message) => void;
            • Handle 'activate-request' messages.

            method onAfterAttach

            protected onAfterAttach: (msg: Message) => void;
            • Handle after-attach messages.

            method onBeforeAttach

            protected onBeforeAttach: (msg: Message) => void;
            • Handle before-attach messages.

            method onContentChanged

            protected onContentChanged: () => void;

              method onMetadataChanged

              protected onMetadataChanged: (model: CellModel, args: IMapChange) => void;
              • Handle changes in the metadata.

              method onResize

              protected onResize: (msg: Widget.ResizeMessage) => void;
              • Handle resize messages.

              method onUpdateRequest

              protected onUpdateRequest: (msg: Message) => void;
              • Handle update-request messages.

              method saveCollapseState

              saveCollapseState: () => void;
              • Save view collapse state to model

              method saveEditableState

              saveEditableState: () => void;
              • Save view editable state to model

              method setPrompt

              setPrompt: (value: string) => void;
              • Set the prompt for the widget.

              method updateEditorConfig

              updateEditorConfig: (v: Record<string, any>) => void;
              • Update the editor configuration with the partial provided dictionary.

                Parameter v

                Partial editor configuration

              class CellFooter

              class CellFooter extends Widget implements ICellFooter {}
              • Default implementation of a cell footer.

              constructor

              constructor();
              • Construct a new cell footer.

              class CellHeader

              class CellHeader extends Widget implements ICellHeader {}
              • Default implementation of a cell header.

              constructor

              constructor();
              • Construct a new cell header.

              class CellModel

              abstract class CellModel extends CodeEditor.Model implements ICellModel {}
              • An implementation of the cell model.

              constructor

              constructor(options?: CellModel.IOptions<ISharedCell>);

                property contentChanged

                readonly contentChanged: Signal<this, void>;
                • A signal emitted when the state of the model changes.

                property id

                readonly id: string;
                • The id for the cell.

                property metadata

                readonly metadata: Omit<nbformat.IBaseCellMetadata, 'trusted'>;
                • The metadata associated with the cell.

                property metadataChanged

                readonly metadataChanged: ISignal<ICellModel, IMapChange>;
                • Signal emitted when cell metadata changes.

                property sharedModel

                readonly sharedModel: ISharedCell;

                  property stateChanged

                  readonly stateChanged: Signal<
                  this,
                  IChangedArgs<any, any, 'trusted' | 'isDirty' | 'executionCount'>
                  >;
                  • A signal emitted when a model state changes.

                  property trusted

                  trusted: boolean;
                  • The trusted state of the model.

                  property type

                  readonly type: nbformat.CellType;
                  • The type of cell.

                  method deleteMetadata

                  deleteMetadata: (key: string) => any;
                  • Delete a metadata

                    Parameter key

                    Metadata key

                  method dispose

                  dispose: () => void;
                  • Dispose of the resources held by the model.

                  method getMetadata

                  getMetadata: (key: string) => any;
                  • Get a metadata

                    ### Notes This returns a copy of the key value.

                    Parameter key

                    Metadata key

                  method onGenericChange

                  protected onGenericChange: () => void;
                  • Handle a change to the observable value.

                  method onTrustedChanged

                  onTrustedChanged: (
                  trusted: CellModel,
                  args: ObservableValue.IChangedArgs
                  ) => void;
                  • Handle a change to the trusted state.

                    The default implementation is a no-op.

                  method setMetadata

                  setMetadata: (key: string, value: any) => void;
                  • Set a metadata

                    Parameter key

                    Metadata key

                    Parameter value

                    Metadata value

                  method toJSON

                  toJSON: () => nbformat.ICell;
                  • Serialize the model to JSON.

                  class CellSearchProvider

                  class CellSearchProvider
                  extends EditorSearchProvider<ICellModel>
                  implements IBaseSearchProvider {}
                  • Search provider for cells.

                  constructor

                  constructor(cell: Cell<ICellModel>);

                    property cell

                    protected cell: Cell<ICellModel>;

                      property editor

                      readonly editor: any;
                      • Text editor

                      property model

                      readonly model: ICellModel;
                      • Editor content model

                      class CodeCell

                      class CodeCell extends Cell<ICodeCellModel> {}
                      • A widget for a code cell.

                      constructor

                      constructor(options: CodeCell.IOptions);
                      • Construct a code cell widget.

                      property headings

                      readonly headings: Cell.IHeading[];

                        property maxNumberOutputs

                        protected maxNumberOutputs: number;
                        • Maximum number of outputs to display.

                        property outputArea

                        readonly outputArea: OutputArea;
                        • Get the output area for the cell.

                        property outputHidden

                        outputHidden: boolean;
                        • The view state of output being collapsed.

                        property outputsScrolled

                        outputsScrolled: boolean;
                        • Whether the output is in a scrolled state?

                        property syncScrolled

                        syncScrolled: boolean;
                        • Whether to sync the scrolled state to the cell model.

                        method clone

                        clone: () => CodeCell;
                        • Clone the cell, using the same model.

                        method cloneOutputArea

                        cloneOutputArea: () => OutputArea;
                        • Clone the OutputArea alone, returning a simplified output area, using the same model.

                        method dispose

                        dispose: () => void;
                        • Dispose of the resources used by the widget.

                        method getOutputPlaceholderText

                        protected getOutputPlaceholderText: () => string | undefined;

                          method handleInputHidden

                          protected handleInputHidden: (value: boolean) => void;
                          • Handle the input being hidden.

                            #### Notes This method is called by the case cell implementation and is subclasses here so the code cell can watch to see when input is hidden without accessing private state.

                          method initializeDOM

                          protected initializeDOM: () => void;
                          • Create children widgets.

                          method initializeState

                          initializeState: () => this;
                          • Initialize view state from model.

                            #### Notes Should be called after construction. For convenience, returns this, so it can be chained in the construction, like new Foo().initializeState();

                          method loadCollapseState

                          loadCollapseState: () => void;
                          • Revert view collapse state from model.

                            We consider the collapsed metadata key as the source of truth for outputs being hidden.

                          method loadScrolledState

                          loadScrolledState: () => void;
                          • Revert view collapse state from model.

                          method onMetadataChanged

                          protected onMetadataChanged: (model: CellModel, args: IMapChange) => void;
                          • Handle changes in the metadata.

                          method onOutputChanged

                          protected onOutputChanged: () => void;
                          • Callback on output changes

                          method onStateChanged

                          protected onStateChanged: (model: ICellModel, args: IChangedArgs<any>) => void;
                          • Handle changes in the model.

                          method saveCollapseState

                          saveCollapseState: () => void;
                          • Save view collapse state to model

                          method saveScrolledState

                          saveScrolledState: () => void;
                          • Save view collapse state to model

                          method updatePromptOverlayIcon

                          updatePromptOverlayIcon: () => void;
                          • Update the Prompt Overlay Icon

                          class CodeCellLayout

                          class CodeCellLayout extends PanelLayout {}
                          • Code cell layout

                            It will not detached the output area when the cell is detached.

                          method onAfterDetach

                          protected onAfterDetach: (msg: Message) => void;
                          • A message handler invoked on an 'after-detach' message.

                            #### Notes The default implementation of this method forwards the message to all widgets. It assumes all widget nodes are attached to the parent widget node.

                            This may be reimplemented by subclasses as needed.

                          method onBeforeAttach

                          protected onBeforeAttach: (msg: Message) => void;
                          • A message handler invoked on a 'before-attach' message.

                            #### Notes The default implementation of this method forwards the message to all widgets. It assumes all widget nodes are attached to the parent widget node.

                            This may be reimplemented by subclasses as needed.

                          class CodeCellModel

                          class CodeCellModel extends CellModel implements ICodeCellModel {}
                          • An implementation of a code cell Model.

                          constructor

                          constructor(options?: CodeCellModel.IOptions);
                          • Construct a new code cell with optional original cell content.

                          property executionCount

                          executionCount: nbformat.ExecutionCount;
                          • The execution count of the cell.

                          property isDirty

                          isDirty: boolean;
                          • Whether the cell is dirty or not.

                            A cell is dirty if it is output is not empty and does not result of the input code execution.

                          property outputs

                          readonly outputs: IOutputAreaModel;
                          • The cell outputs.

                          property sharedModel

                          readonly sharedModel: ISharedCodeCell;

                            property type

                            readonly type: string;
                            • The type of the cell.

                            method clearExecution

                            clearExecution: () => void;

                              method dispose

                              dispose: () => void;
                              • Dispose of the resources held by the model.

                              method onOutputsChange

                              protected onOutputsChange: (
                              sender: IOutputAreaModel,
                              event: IOutputAreaModel.ChangedArgs
                              ) => void;
                              • Handle a change to the cell outputs modelDB and reflect it in the shared model.

                              method onTrustedChanged

                              onTrustedChanged: (
                              trusted: CellModel,
                              args: ObservableValue.IChangedArgs
                              ) => void;
                              • Handle a change to the trusted state.

                              method toJSON

                              toJSON: () => nbformat.ICodeCell;
                              • Serialize the model to JSON.

                              class Collapser

                              abstract class Collapser extends ReactWidget {}
                              • Abstract collapser base class.

                                ### Notes A collapser is a visible div to the left of a cell's input/output that a user can click on to collapse the input/output.

                              constructor

                              constructor();
                              • Construct a new collapser.

                              property collapsed

                              readonly collapsed: boolean;
                              • Is the input/output of the parent collapsed.

                              method handleClick

                              protected abstract handleClick: (e: React.MouseEvent<HTMLDivElement>) => void;
                              • Handle the click event.

                              method render

                              protected render: () => React.ReactElement<any>;
                              • Render the collapser with the virtual DOM.

                              class InputArea

                              class InputArea extends Widget {}
                              • An input area widget, which hosts a prompt and an editor widget.

                              constructor

                              constructor(options: InputArea.IOptions);
                              • Construct an input area widget.

                              property contentFactory

                              readonly contentFactory: InputArea.IContentFactory;
                              • The content factory used by the widget.

                              property editor

                              readonly editor: CodeEditor.IEditor;
                              • Get the CodeEditor used by the cell.

                              property editorWidget

                              readonly editorWidget: CodeEditorWrapper;
                              • Get the CodeEditorWrapper used by the cell.

                              property model

                              readonly model: ICellModel;
                              • The model used by the widget.

                              property promptNode

                              readonly promptNode: HTMLElement;
                              • Get the prompt node used by the cell.

                              property renderedInput

                              readonly renderedInput: Widget;
                              • Get the rendered input area widget, if any.

                              method dispose

                              dispose: () => void;
                              • Dispose of the resources held by the widget.

                              method renderInput

                              renderInput: (widget: Widget) => void;
                              • Render an input instead of the text editor.

                              method setPrompt

                              setPrompt: (value: string) => void;
                              • Set the prompt of the input area.

                              method showEditor

                              showEditor: () => void;
                              • Show the text editor.

                              class InputCollapser

                              class InputCollapser extends Collapser {}
                              • A collapser subclass to collapse a cell's input area.

                              constructor

                              constructor();
                              • Construct a new input collapser.

                              property collapsed

                              readonly collapsed: boolean;
                              • Is the cell's input collapsed?

                              method handleClick

                              protected handleClick: (e: React.MouseEvent<HTMLDivElement>) => void;
                              • Handle a click event for the user to collapse the cell's input.

                              class InputPlaceholder

                              class InputPlaceholder extends Placeholder {}
                              • The input placeholder class.

                              constructor

                              constructor(options: IPlaceholderOptions);
                              • Construct a new input placeholder.

                              class InputPrompt

                              class InputPrompt extends Widget implements IInputPrompt {}
                              • The default input prompt implementation.

                              constructor

                              constructor();

                                property executionCount

                                executionCount: string;
                                • The execution count for the prompt.

                                class MarkdownCell

                                class MarkdownCell extends AttachmentsCell<IMarkdownCellModel> {}
                                • A widget for a Markdown cell.

                                  #### Notes Things get complicated if we want the rendered text to update any time the text changes, the text editor model changes, or the input area model changes. We don't support automatically updating the rendered text in all of these cases.

                                constructor

                                constructor(options: MarkdownCell.IOptions);
                                • Construct a Markdown cell widget.

                                property headingCollapsed

                                headingCollapsed: boolean;
                                • Whether the heading is collapsed or not.

                                property headingCollapsedChanged

                                readonly headingCollapsedChanged: ISignal<MarkdownCell, boolean>;
                                • Signal emitted when the cell collapsed state changes.

                                property headingInfo

                                readonly headingInfo: { text: string; level: number };
                                • Text that represents the highest heading (i.e. lowest level) if cell is a heading. Returns empty string if not a heading.

                                property headings

                                readonly headings: Cell.IHeading[];

                                  property numberChildNodes

                                  numberChildNodes: number;
                                  • Number of collapsed sub cells.

                                  property rendered

                                  rendered: boolean;
                                  • Whether the cell is rendered.

                                  property renderedChanged

                                  readonly renderedChanged: ISignal<MarkdownCell, boolean>;
                                  • Signal emitted when the markdown cell rendered state changes

                                  property renderer

                                  readonly renderer: IRenderMime.IRenderer;
                                  • Renderer

                                  property showEditorForReadOnly

                                  showEditorForReadOnly: boolean;

                                    method clone

                                    clone: () => MarkdownCell;
                                    • Clone the cell, using the same model.

                                    method dispose

                                    dispose: () => void;
                                    • Dispose of the resources held by the widget.

                                    method initializeDOM

                                    protected initializeDOM: () => void;
                                    • Create children widgets.

                                    method maybeCreateCollapseButton

                                    protected maybeCreateCollapseButton: () => void;

                                      method maybeCreateOrUpdateExpandButton

                                      protected maybeCreateOrUpdateExpandButton: () => void;
                                      • Create, update or remove the hidden cells button. Note that the actual visibility is controlled in Static Notebook by toggling jp-mod-showHiddenCellsButton class.

                                      method onContentChanged

                                      protected onContentChanged: () => void;
                                      • Callback on content changed

                                      method onUpdateRequest

                                      protected onUpdateRequest: (msg: Message) => void;

                                        method renderCollapseButtons

                                        protected renderCollapseButtons: (widget: Widget) => void;
                                        • Render the collapse button for heading cells, and for collapsed heading cells render the "expand hidden cells" button.

                                        method renderInput

                                        protected renderInput: (widget: Widget) => void;
                                        • Render an input instead of the text editor.

                                        method showEditor

                                        protected showEditor: () => void;
                                        • Show the text editor instead of rendered input.

                                        method updateCellSourceWithAttachment

                                        protected updateCellSourceWithAttachment: (
                                        attachmentName: string,
                                        URI?: string
                                        ) => void;
                                        • Modify the cell source to include a reference to the attachment.

                                        class MarkdownCellModel

                                        class MarkdownCellModel extends AttachmentsCellModel {}
                                        • An implementation of a markdown cell model.

                                        constructor

                                        constructor(
                                        options?: Omit<
                                        AttachmentsCellModel.IOptions<ISharedMarkdownCell>,
                                        'cell_type'
                                        >
                                        );
                                        • Construct a markdown cell model from optional shared model.

                                        property type

                                        readonly type: string;
                                        • The type of the cell.

                                        method toJSON

                                        toJSON: () => nbformat.IMarkdownCell;
                                        • Serialize the model to JSON.

                                        class OutputCollapser

                                        class OutputCollapser extends Collapser {}
                                        • A collapser subclass to collapse a cell's output area.

                                        constructor

                                        constructor();
                                        • Construct a new output collapser.

                                        property collapsed

                                        readonly collapsed: boolean;
                                        • Is the cell's output collapsed?

                                        method handleClick

                                        protected handleClick: (e: React.MouseEvent<HTMLDivElement>) => void;
                                        • Handle a click event for the user to collapse the cell's output.

                                        class OutputPlaceholder

                                        class OutputPlaceholder extends Placeholder {}
                                        • The output placeholder class.

                                        constructor

                                        constructor(options: IPlaceholderOptions);
                                        • Construct a new output placeholder.

                                        class Placeholder

                                        class Placeholder extends Widget {}
                                        • An base class for placeholders

                                          ### Notes A placeholder is the element that is shown when input/output is hidden.

                                        constructor

                                        constructor(options: IPlaceholderOptions);
                                        • Construct a new placeholder.

                                        property text

                                        text: string;

                                          method onAfterAttach

                                          protected onAfterAttach: (msg: Message) => void;

                                            method onBeforeDetach

                                            protected onBeforeDetach: (msg: Message) => void;

                                              class RawCell

                                              class RawCell extends Cell<IRawCellModel> {}
                                              • A widget for a raw cell.

                                              constructor

                                              constructor(options: RawCell.IOptions);
                                              • Construct a raw cell widget.

                                              method clone

                                              clone: () => RawCell;
                                              • Clone the cell, using the same model.

                                              class RawCellModel

                                              class RawCellModel extends AttachmentsCellModel {}
                                              • An implementation of a raw cell model.

                                              constructor

                                              constructor(
                                              options?: Omit<AttachmentsCellModel.IOptions<ISharedRawCell>, 'cell_type'>
                                              );
                                              • Construct a raw cell model from optional shared model.

                                              property type

                                              readonly type: string;
                                              • The type of the cell.

                                              method toJSON

                                              toJSON: () => nbformat.IRawCell;
                                              • Serialize the model to JSON.

                                              Interfaces

                                              interface IAttachmentsCellModel

                                              interface IAttachmentsCellModel extends ICellModel {}
                                              • The definition of a model cell object for a cell with attachments.

                                              property attachments

                                              readonly attachments: IAttachmentsModel;
                                              • The cell attachments

                                              interface ICellFooter

                                              interface ICellFooter extends Widget {}
                                              • The interface for a cell footer.

                                              interface ICellHeader

                                              interface ICellHeader extends Widget {}
                                              • The interface for a cell header.

                                              interface ICellModel

                                              interface ICellModel extends CodeEditor.IModel {}
                                              • The definition of a model object for a cell.

                                              property contentChanged

                                              readonly contentChanged: ISignal<ICellModel, void>;
                                              • A signal emitted when the content of the model changes.

                                              property id

                                              readonly id: string;
                                              • A unique identifier for the cell.

                                              property metadata

                                              readonly metadata: Omit<nbformat.IBaseCellMetadata, 'trusted'>;
                                              • The metadata associated with the cell.

                                                ### Notes This is a copy of the metadata. Changing a part of it won't affect the model. As this returns a copy of all metadata, it is advised to use getMetadata to speed up the process of getting a single key.

                                              property metadataChanged

                                              readonly metadataChanged: ISignal<ICellModel, IMapChange>;
                                              • Signal emitted when cell metadata changes.

                                              property sharedModel

                                              readonly sharedModel: ISharedCell;
                                              • The cell shared model.

                                              property stateChanged

                                              readonly stateChanged: ISignal<ICellModel, IChangedArgs<boolean, boolean, any>>;
                                              • A signal emitted when a model state changes.

                                              property trusted

                                              trusted: boolean;
                                              • Whether the cell is trusted.

                                              property type

                                              readonly type: nbformat.CellType;
                                              • The type of the cell.

                                              method deleteMetadata

                                              deleteMetadata: (key: string) => void;
                                              • Delete a metadata.

                                                Parameter key

                                                Metadata key

                                              method getMetadata

                                              getMetadata: (key: string) => any;
                                              • Get a metadata

                                                ### Notes This returns a copy of the key value.

                                                Parameter key

                                                Metadata key

                                              method setMetadata

                                              setMetadata: (key: string, value: any) => void;
                                              • Set a metadata

                                                Parameter key

                                                Metadata key

                                                Parameter value

                                                Metadata value

                                              method toJSON

                                              toJSON: () => nbformat.ICell;
                                              • Serialize the model to JSON.

                                              interface ICodeCellModel

                                              interface ICodeCellModel extends ICellModel {}
                                              • The definition of a code cell.

                                              property executionCount

                                              executionCount: nbformat.ExecutionCount;
                                              • The code cell's prompt number. Will be null if the cell has not been run.

                                              property isDirty

                                              readonly isDirty: boolean;
                                              • Whether the code cell has been edited since the last run.

                                              property outputs

                                              readonly outputs: IOutputAreaModel;
                                              • The cell outputs.

                                              property sharedModel

                                              readonly sharedModel: ISharedCodeCell;
                                              • The code cell shared model

                                              property type

                                              readonly type: 'code';
                                              • The type of the cell.

                                                #### Notes This is a read-only property.

                                              method clearExecution

                                              clearExecution: () => void;
                                              • Clear execution, outputs, and related metadata

                                              method toJSON

                                              toJSON: () => nbformat.ICodeCell;
                                              • Serialize the model to JSON.

                                              interface IInputPrompt

                                              interface IInputPrompt extends Widget {}
                                              • The interface for the input prompt.

                                              property executionCount

                                              executionCount: string | null;
                                              • The execution count of the prompt.

                                              interface IMarkdownCellModel

                                              interface IMarkdownCellModel extends IAttachmentsCellModel {}
                                              • The definition of a markdown cell.

                                              property type

                                              readonly type: 'markdown';
                                              • The type of the cell.

                                              method toJSON

                                              toJSON: () => nbformat.IMarkdownCell;
                                              • Serialize the model to JSON.

                                              interface IPlaceholderOptions

                                              interface IPlaceholderOptions {}
                                              • Placeholder widget options

                                              property callback

                                              callback: (e: MouseEvent) => void;
                                              • Ellipsis button callback

                                              property promptClass

                                              promptClass?: string;
                                              • Prompt element CSS class

                                              property text

                                              text?: string;
                                              • Text to include with the placeholder

                                              property translator

                                              translator?: ITranslator;
                                              • Translator object

                                              interface IRawCellModel

                                              interface IRawCellModel extends IAttachmentsCellModel {}
                                              • The definition of a raw cell.

                                              property type

                                              readonly type: 'raw';
                                              • The type of the cell.

                                              method toJSON

                                              toJSON: () => nbformat.IRawCell;
                                              • Serialize the model to JSON.

                                              Namespaces

                                              namespace AttachmentsCellModel

                                              namespace AttachmentsCellModel {}
                                              • The namespace for AttachmentsCellModel statics.

                                              variable defaultContentFactory

                                              const defaultContentFactory: ContentFactory;
                                              • The shared ContentFactory instance.

                                              class ContentFactory

                                              class ContentFactory implements IContentFactory {}
                                              • The default implementation of an IContentFactory.

                                              method createAttachmentsModel

                                              createAttachmentsModel: (
                                              options: IAttachmentsModel.IOptions
                                              ) => IAttachmentsModel;
                                              • Create an attachments model.

                                              interface IContentFactory

                                              interface IContentFactory {}
                                              • A factory for creating code cell model content.

                                              method createAttachmentsModel

                                              createAttachmentsModel: (
                                              options: IAttachmentsModel.IOptions
                                              ) => IAttachmentsModel;
                                              • Create an output area.

                                              interface IOptions

                                              interface IOptions<T extends ISharedCell> extends CellModel.IOptions<T> {}
                                              • The options used to initialize a AttachmentsCellModel.

                                              property contentFactory

                                              contentFactory?: IContentFactory;
                                              • The factory for attachment model creation.

                                              namespace Cell

                                              namespace Cell {}
                                              • The namespace for the Cell class statics.

                                              class ContentFactory

                                              class ContentFactory implements IContentFactory {}
                                              • The default implementation of an IContentFactory.

                                                This includes a CodeMirror editor factory to make it easy to use out of the box.

                                              constructor

                                              constructor(options: ContentFactory.IOptions);
                                              • Create a content factory for a cell.

                                              property editorFactory

                                              readonly editorFactory: CodeEditor.Factory;
                                              • The readonly editor factory that create code editors

                                              method createCellFooter

                                              createCellFooter: () => ICellFooter;
                                              • Create a new cell footer for the parent widget.

                                              method createCellHeader

                                              createCellHeader: () => ICellHeader;
                                              • Create a new cell header for the parent widget.

                                              method createInputPrompt

                                              createInputPrompt: () => IInputPrompt;
                                              • Create an input prompt.

                                              method createOutputPrompt

                                              createOutputPrompt: () => IOutputPrompt;
                                              • Create the output prompt for the widget.

                                              method createStdin

                                              createStdin: (options: Stdin.IOptions) => IStdin;
                                              • Create an stdin widget.

                                              interface IContentFactory

                                              interface IContentFactory
                                              extends OutputArea.IContentFactory,
                                              InputArea.IContentFactory {}
                                              • The factory object for customizable cell children.

                                                This is used to allow users of cells to customize child content.

                                                This inherits from OutputArea.IContentFactory to avoid needless nesting and provide a single factory object for all notebook/cell/outputarea related widgets.

                                              method createCellFooter

                                              createCellFooter: () => ICellFooter;
                                              • Create a new cell header for the parent widget.

                                              method createCellHeader

                                              createCellHeader: () => ICellHeader;
                                              • Create a new cell header for the parent widget.

                                              interface IHeading

                                              interface IHeading {}
                                              • Cell heading

                                              property level

                                              level: number;
                                              • HTML heading level.

                                              property outputIndex

                                              outputIndex?: number;
                                              • Index of the output containing the heading

                                              property text

                                              text: string;
                                              • Heading text.

                                              property type

                                              type: HeadingType;
                                              • Type of heading

                                              interface IOptions

                                              interface IOptions<T extends ICellModel> {}
                                              • An options object for initializing a cell widget.

                                              property contentFactory

                                              contentFactory: IContentFactory;
                                              • The factory object for customizable cell children.

                                              property editorConfig

                                              editorConfig?: Record<string, any>;
                                              • The configuration options for the text editor widget.

                                              property editorExtensions

                                              editorExtensions?: Extension[];
                                              • Editor extensions to be added.

                                              property inputHistoryScope

                                              inputHistoryScope?: 'global' | 'session';
                                              • Whether to split stdin line history by kernel session or keep globally accessible.

                                              property layout

                                              layout?: PanelLayout;
                                              • Cell widget layout.

                                              property maxNumberOutputs

                                              maxNumberOutputs?: number;
                                              • The maximum number of output items to display in cell output.

                                              property model

                                              model: T;
                                              • The model used by the cell.

                                              property placeholder

                                              placeholder?: boolean;
                                              • Whether this cell is a placeholder for future rendering.

                                              property translator

                                              translator?: ITranslator;
                                              • The application language translator.

                                              interface IScrollRequest

                                              interface IScrollRequest {}
                                              • Value of the signal emitted by cell on editor scroll request.

                                              property defaultPrevented

                                              defaultPrevented: boolean;
                                              • Whether the default scrolling was prevented due to the cell being out of viewport.

                                              property scrollWithinCell

                                              scrollWithinCell: (options: { scroller: HTMLElement }) => void;
                                              • Scrolls to the target cell part, fulfilling the scroll request.

                                                ### Notes This method is intended for use by windowed containers that require the cell to be first scrolled into the viewport to then enable proper scrolling within cell.

                                              enum HeadingType

                                              enum HeadingType {
                                              HTML = 0,
                                              Markdown = 1,
                                              }
                                              • Type of headings

                                              member HTML

                                              HTML = 0
                                              • Heading from HTML output

                                              member Markdown

                                              Markdown = 1
                                              • Heading from Markdown cell or Markdown output

                                              namespace Cell.ContentFactory

                                              namespace Cell.ContentFactory {}
                                              • A namespace for cell content factory.

                                              interface IOptions

                                              interface IOptions {}
                                              • Options for the content factory.

                                              property editorFactory

                                              editorFactory: CodeEditor.Factory;
                                              • The editor factory used by the content factory.

                                              namespace CellDragUtils

                                              namespace CellDragUtils {}

                                                function createCellDragImage

                                                createCellDragImage: (
                                                activeCell: Cell,
                                                selectedCells: nbformat.ICell[]
                                                ) => HTMLElement;
                                                • Create an image for the cell(s) to be dragged

                                                  Parameter activeCell

                                                  The cell from where the drag event is triggered

                                                  Parameter selectedCells

                                                  The cells to be dragged

                                                function detectTargetArea

                                                detectTargetArea: (cell: Cell, target: HTMLElement) => ICellTargetArea;
                                                • Detect which part of the cell triggered the MouseEvent

                                                  Parameter cell

                                                  The cell which contains the MouseEvent's target

                                                  Parameter target

                                                  The DOM node which triggered the MouseEvent

                                                function findCell

                                                findCell: (
                                                node: HTMLElement,
                                                cells: Iterable<Cell>,
                                                isCellNode: (node: HTMLElement) => boolean
                                                ) => number;
                                                • Find the cell index containing the target html element. This function traces up the DOM hierarchy to find the root cell node. Then find the corresponding child and select it.

                                                  Parameter node

                                                  the cell node or a child of the cell node.

                                                  Parameter cells

                                                  an iterable of Cells

                                                  Parameter isCellNode

                                                  a function that takes in a node and checks if it is a cell node.

                                                  Returns

                                                  index of the cell we're looking for. Returns -1 if the cell is not founds

                                                function shouldStartDrag

                                                shouldStartDrag: (
                                                prevX: number,
                                                prevY: number,
                                                nextX: number,
                                                nextY: number
                                                ) => boolean;
                                                • Detect if a drag event should be started. This is down if the mouse is moved beyond a certain distance (DRAG_THRESHOLD).

                                                  Parameter prevX

                                                  X Coordinate of the mouse pointer during the mousedown event

                                                  Parameter prevY

                                                  Y Coordinate of the mouse pointer during the mousedown event

                                                  Parameter nextX

                                                  Current X Coordinate of the mouse pointer

                                                  Parameter nextY

                                                  Current Y Coordinate of the mouse pointer

                                                type ICellTargetArea

                                                type ICellTargetArea = 'input' | 'prompt' | 'cell' | 'unknown';

                                                  namespace CellModel

                                                  namespace CellModel {}
                                                  • The namespace for CellModel statics.

                                                  interface IOptions

                                                  interface IOptions<T extends ISharedCell> {}
                                                  • The options used to initialize a CellModel.

                                                  property cell_type

                                                  cell_type?: string;
                                                  • The cell type

                                                  property id

                                                  id?: string;
                                                  • A unique identifier for the model.

                                                  property sharedModel

                                                  sharedModel?: T;
                                                  • The cell shared model.

                                                  property trusted

                                                  trusted?: boolean;
                                                  • Whether the cell is trusted or not.

                                                  namespace CodeCell

                                                  namespace CodeCell {}
                                                  • The namespace for the CodeCell class statics.

                                                  function execute

                                                  execute: (
                                                  cell: CodeCell,
                                                  sessionContext: ISessionContext,
                                                  metadata?: JSONObject
                                                  ) => Promise<KernelMessage.IExecuteReplyMsg | void>;
                                                  • Execute a cell given a client session.

                                                  interface IOptions

                                                  interface IOptions extends Cell.IOptions<ICodeCellModel> {}
                                                  • An options object for initializing a base cell widget.

                                                  property layout

                                                  layout?: CodeCellLayout;
                                                  • Code cell layout.

                                                  property rendermime

                                                  rendermime: IRenderMimeRegistry;
                                                  • The mime renderer for the cell widget.

                                                  namespace CodeCellModel

                                                  namespace CodeCellModel {}
                                                  • The namespace for CodeCellModel statics.

                                                  variable defaultContentFactory

                                                  const defaultContentFactory: ContentFactory;
                                                  • The shared ContentFactory instance.

                                                  class ContentFactory

                                                  class ContentFactory implements IContentFactory {}
                                                  • The default implementation of an IContentFactory.

                                                  method createOutputArea

                                                  createOutputArea: (options: IOutputAreaModel.IOptions) => IOutputAreaModel;
                                                  • Create an output area.

                                                  interface IContentFactory

                                                  interface IContentFactory {}
                                                  • A factory for creating code cell model content.

                                                  method createOutputArea

                                                  createOutputArea: (options: IOutputAreaModel.IOptions) => IOutputAreaModel;
                                                  • Create an output area.

                                                  interface IOptions

                                                  interface IOptions extends Omit<CellModel.IOptions<ISharedCodeCell>, 'cell_type'> {}
                                                  • The options used to initialize a CodeCellModel.

                                                  property contentFactory

                                                  contentFactory?: IContentFactory;
                                                  • The factory for output area model creation.

                                                  namespace InputArea

                                                  namespace InputArea {}
                                                  • A namespace for InputArea statics.

                                                  class ContentFactory

                                                  class ContentFactory implements IContentFactory {}
                                                  • Default implementation of IContentFactory.

                                                    This defaults to using an editorFactory based on CodeMirror.

                                                  constructor

                                                  constructor(options: ContentFactory.IOptions);
                                                  • Construct a ContentFactory.

                                                  property editorFactory

                                                  readonly editorFactory: CodeEditor.Factory;
                                                  • Return the CodeEditor.Factory being used.

                                                  method createInputPrompt

                                                  createInputPrompt: () => IInputPrompt;
                                                  • Create an input prompt.

                                                  interface IContentFactory

                                                  interface IContentFactory {}
                                                  • An input area widget content factory.

                                                    The content factory is used to create children in a way that can be customized.

                                                  property editorFactory

                                                  readonly editorFactory: CodeEditor.Factory;
                                                  • The editor factory we need to include in CodeEditorWrapper.IOptions.

                                                    This is a separate readonly attribute rather than a factory method as we need to pass it around.

                                                  method createInputPrompt

                                                  createInputPrompt: () => IInputPrompt;
                                                  • Create an input prompt.

                                                  interface IOptions

                                                  interface IOptions {}
                                                  • The options used to create an InputArea.

                                                  property contentFactory

                                                  contentFactory: IContentFactory;
                                                  • The content factory used by the widget to create children.

                                                  property editorOptions

                                                  editorOptions?: Omit<CodeEditor.IOptions, 'host' | 'model'>;
                                                  • Editor options

                                                  property model

                                                  model: ICellModel;
                                                  • The model used by the widget.

                                                  namespace InputArea.ContentFactory

                                                  namespace InputArea.ContentFactory {}
                                                  • A namespace for the input area content factory.

                                                  interface IOptions

                                                  interface IOptions {}
                                                  • Options for the content factory.

                                                  property editorFactory

                                                  editorFactory: CodeEditor.Factory;
                                                  • The editor factory used by the content factory.

                                                    If this is not passed, a default CodeMirror editor factory will be used.

                                                  namespace MarkdownCell

                                                  namespace MarkdownCell {}
                                                  • The namespace for the CodeCell class statics.

                                                  variable defaultShowEditorForReadOnlyMarkdown

                                                  const defaultShowEditorForReadOnlyMarkdown: boolean;
                                                  • Default value for showEditorForReadOnlyMarkdown.

                                                  interface IOptions

                                                  interface IOptions extends Cell.IOptions<IMarkdownCellModel> {}
                                                  • An options object for initializing a base cell widget.

                                                  property rendermime

                                                  rendermime: IRenderMimeRegistry;
                                                  • The mime renderer for the cell widget.

                                                  property showEditorForReadOnlyMarkdown

                                                  showEditorForReadOnlyMarkdown?: boolean;
                                                  • Show editor for read-only Markdown cells.

                                                  namespace RawCell

                                                  namespace RawCell {}
                                                  • The namespace for the RawCell class statics.

                                                  interface IOptions

                                                  interface IOptions extends Cell.IOptions<IRawCellModel> {}
                                                  • An options object for initializing a base cell widget.

                                                  Package Files (9)

                                                  Dependencies (28)

                                                  Dev Dependencies (6)

                                                  Peer Dependencies (0)

                                                  No peer dependencies.

                                                  Badge

                                                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@jupyterlab/cells.

                                                  • Markdown
                                                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@jupyterlab/cells)
                                                  • HTML
                                                    <a href="https://www.jsdocs.io/package/@jupyterlab/cells"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>