/** * This file gathers various views used when rendering the {@link NotebookPage}. * * */ import { AnyVirtualDOM, ChildrenLike, CSSAttribute, VirtualDOM } from '@youwol/rx-vdom'; import { Observable } from 'rxjs'; import { CellStatus, Output, State } from './state'; import { CodeSnippetView } from '../md-widgets'; import { CellCommonAttributes } from './notebook-page'; import { MdCellAttributes } from './md-cell-view'; import { JsCellAttributes } from './js-cell-view'; /** * Represents the view of a cell that will render once the associated cell is registered in the {@link State}. * Upon registration, this container includes one child of type {@link CellView}. */ export declare class FutureCellView implements VirtualDOM<'div'> { readonly tag = "div"; /** * Classes associated to the view. */ readonly class = "mknb-FutureCellView"; readonly children: ChildrenLike; /** * * @param params * @param params.editorView The code editor view to encapsulate. * @param params.cellId The cell unique ID. * @param params.language The language of the cell. * @param params.state The state managing the cell. * @param params.attributes The cell's attributes. * @param params.reactive$ Whether the cell is reactive (in some circumstances it is only known when running * the cell). */ constructor(params: { editorView: AnyVirtualDOM; cellId: string; language: string; state: State; cellAttributes: MdCellAttributes | JsCellAttributes; reactive$: Observable; }); } /** * Represents the view of a cell. * It includes: * * An {@link CellHeaderView | header}. * * The {@link SnippetEditorView | code editor}. * * The {@link OutputsView | outputs container}. */ export declare class CellView implements VirtualDOM<'div'> { readonly tag = "div"; readonly children: ChildrenLike; /** * Classes associated to the view. */ readonly class = "mknb-CellView border-left ps-1"; readonly cellId: string; readonly state: State; readonly options: MdCellAttributes | JsCellAttributes; /** * * @param params * @param params.editorView The code editor view to encapsulate. * @param params.cellId The cell unique ID. * @param params.language The language of the cell. * @param params.state The state managing the cell. * @param params.attributes The cell's attributes. */ constructor(params: { cellId: string; language: string; editorView: AnyVirtualDOM; cellAttributes: MdCellAttributes | JsCellAttributes; reactive$: Observable; state: State; }); } /** * View that displays code snippet in edition mode. */ export declare class SnippetEditorView extends CodeSnippetView { /** * * @param params * @param params.readOnly Whether the code is read-only. * @param params.content The editor initial content. * @param params.language The language of the cell. * @param params.lineNumbers Whether to display line numbers. * @param params.onExecute The action triggered upon execution (on 'Ctrl-Enter'). */ constructor({ language, readOnly, content, lineNumbers, onExecute, }: { content: string; language: 'markdown' | 'javascript' | 'python'; readOnly: boolean; lineNumbers: boolean; onExecute: () => void; }); } /** * Represents the view of a cell's header. */ export declare class CellHeaderView implements VirtualDOM<'div'> { readonly tag = "div"; /** * Classes associated to the view. */ readonly class = "mknb-CellHeaderView"; readonly children: ChildrenLike; readonly cellId: string; readonly state: State; /** * * @param params * @param params.state Cell's owning state. * @param params.cellId Cell unique ID. */ constructor(params: { state: State; cellId: string; }); } /** * Represents the tag of a {@link CellView} (read-only or not, the language, *etc.*). */ export declare class CellTagsView implements VirtualDOM<'div'> { readonly tag = "div"; /** * Classes associated to the view. */ readonly class = "mknb-CellTagsView px-2 text-secondary d-flex align-items-center"; readonly children: ChildrenLike; /** * Style associated to the view. */ readonly style: { position: "absolute"; top: string; right: string; }; /** * * @param params * @param params.cellStatus$ Current cell status. * @param params.reactive$ Whether the cell is reactive. * @param params.language Cell's owning state. * @param params.attributes Cell attributes. */ constructor(params: { cellStatus$: Observable; reactive$: Observable; language: string; cellAttributes: CellCommonAttributes; }); } /** * Display mode for {@link DeportedOutputsView | deported outputs}. */ export type OutputMode = 'normal' | 'fullscreen'; /** * Represents the output view of a cell (when using *e.g.* the `display` function). */ export declare class OutputsView implements VirtualDOM<'div'> { readonly tag = "div"; /** * Classes associated to the view. */ readonly class: string; readonly children: ChildrenLike; readonly output$: Observable; readonly style: CSSAttribute; /** * * @param params * @param params.output$ Observable over the outputs to display. * @param params.style Style to apply to this element. * @param params.classList Classes added to this element. */ constructor(params: { output$: Observable; style?: CSSAttribute; classList?: string; }); }