import { ChildrenLike, VirtualDOM } from '@youwol/rx-vdom'; import { CodeSnippetView } from '../md-widgets'; import { CellCommonAttributes } from './notebook-page'; import { CellTrait, ExecArgs, Scope, State } from './state'; import { BehaviorSubject, Observable } from 'rxjs'; import type { MdParsingOptions } from '../markdown'; import { DisplayFactory } from './display-utils'; /** * All attributes available for a Markdown cell are the common ones for now. */ export type MdCellAttributes = CellCommonAttributes; export declare class InlinedCode implements VirtualDOM<'div'> { readonly tag = "div"; readonly style: { display: "inline-block"; }; readonly src: string; readonly displayFactory: DisplayFactory; readonly scope: Scope; readonly children: ChildrenLike; readonly invalidated$: Observable; constructor(params: { src: string; scope: Scope; displayFactory: DisplayFactory; invalidated$: Observable; }); } /** * * Represents a MarkDown cell within a {@link NotebookPage}. * * They are typically included from a DOM definition with tag name `md-cell` in MarkDown content, * see {@link MdCellView.FromDom}. */ export declare class MdCellView implements VirtualDOM<'div'>, CellTrait { readonly tag = "div"; /** * Classes associated with the view. */ readonly class = "mknb-MdCellView"; readonly children: ChildrenLike; /** * Cell's ID. */ readonly cellId: string; /** * Cell's Attributes. */ readonly cellAttributes: MdCellAttributes; /** * State manager, owned by the parent {@link NotebookPage}. */ readonly state: State; /** * Encapsulated editor view. */ readonly editorView: CodeSnippetView; /** * Observable over the source content of the cell. */ readonly content$: BehaviorSubject; /** * Options for parsing MarkDown code. */ readonly parserOptions: MdParsingOptions; /** * Emit when the cell is invalidated. */ readonly invalidated$: Observable; /** * Defines the methods to retrieve constructor's arguments from the DOM element `md-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 MdCellView} from a DOM element `md-cell` in MarkDown content * (the parameter `state` & `parserOptions` are automatically provided). * * * The static property {@link MdCellView.FromDomAttributes | FromDomAttributes} * defines the mapping between the DOM element and the constructor's attributes. * * * @param _p * @param _p.elem The DOM element. * @param _p.parserOptions MarkDown parsing options. * @param _p.state The page state. */ static FromDom({ elem, parserOptions, state, }: { elem: HTMLElement; parserOptions: MdParsingOptions; state: State; }): MdCellView; /** * 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.parserOptions MarkDown parsing options. * @param params.cellAttributes Cell's attributes. */ constructor(params: { cellId: string; content: string; state: State; parserOptions: MdParsingOptions; cellAttributes: MdCellAttributes; }); /** * Execute the cell. Because markdown cell can include other cells, this function own a dedicated {@link State}). * * @param args See {@link ExecArgs}. */ execute({ scope, owningState, cellId, src, displayFactory, output$, }: ExecArgs): Promise; }