import { ChildrenLike, VirtualDOM } from '@youwol/rx-vdom'; import { CodeSnippetView } from '../md-widgets'; import { BehaviorSubject, Observable } from 'rxjs'; import { CellTrait, ExecArgs, Scope, State } from './state'; import { CellCommonAttributes } from './notebook-page'; /** * All attributes available for a python cell are the common ones for now. */ export type PyCellAttributes = CellCommonAttributes; /** * * Represents the execution side of a Python cell within a {@link NotebookPage}. * * This implementation does not provide the views (editor, outputs), it is used as it is when loading separated notebook * pages to retrieve exported symbols. * However, this implementation is typically inherited from {@link PyCellView} to provide the regular views of * a python cell. */ export declare class PyCellExecutor implements CellTrait { /** * Cell ID. */ readonly cellId: string; /** * Emit when the cell is invalidated. */ readonly invalidated$: Observable; /** * State manager, owned by the parent {@link NotebookPage}. */ readonly state: State; /** * The provided attributes. */ readonly cellAttributes: PyCellAttributes; /** * Observable over the source content of the cell. */ readonly content$: BehaviorSubject; constructor(params: { cellId: string; content$: BehaviorSubject; state: State; cellAttributes: PyCellAttributes; }); /** * Execute the cell. See {@link executePy}. * * @param args See {@link ExecArgs}. */ execute(args: ExecArgs): Promise; } /** * * Represents a Python cell (running in browser) within a {@link NotebookPage}. * * They are typically included from a DOM definition with tag name `py-cell` in MarkDown content, * see {@link PyCellView.FromDom}. */ export declare class PyCellView extends PyCellExecutor implements VirtualDOM<'div'> { readonly tag = "div"; /** * Classes associated with the view. */ readonly class = "mknb-PyCellView"; readonly children: ChildrenLike; /** * The encapsulated code editor view. */ readonly editorView: CodeSnippetView; /** * Defines the methods to retrieve constructor's arguments from the DOM element `py-cell` within * MarkDown content. * * * Be mindful of the conversion from `camelCase` to `kebab-case`. * */ static readonly FromDomAttributes: { cellId: (e: HTMLElement) => string; content: (e: HTMLElement) => string; readOnly: (e: HTMLElement) => boolean; lineNumber: (e: HTMLElement) => boolean; }; /** * Initialize an instance of {@link PyCellView} from a DOM element `py-cell` in MarkDown content * (the parameter `state` is automatically provided). * * * The static property {@link PyCellView.FromDomAttributes | FromDomAttributes} * defines the mapping between the DOM element and the constructor's attributes. * * * @param _p * @param _p.elem The DOM element. * @param _p.state The page state. */ static FromDom({ elem, state }: { elem: HTMLElement; state: State; }): PyCellView; /** * Initialize a new instance. * * @param params * @param params.cellId The cell's ID. * @param params.content The cell's content. * @param params.state The page's state. * @param params.cellAttributes Cell's attributes. */ constructor(params: { cellId: string; content: string; state: State; cellAttributes: PyCellAttributes; }); }