import { Model, ObjApi } from '../../../../json-crdt/model'; import type { Range } from '../../../../json-crdt-extensions/peritext/rga/Range'; import type { ToolbarSliceBehavior, ValidationResult } from '../types'; import type { SliceBehavior } from '../../../../json-crdt-extensions/peritext/registry/SliceBehavior'; import type { ObjNode } from '../../../../json-crdt/nodes'; import type { ToolbarState } from '.'; import type { Slice } from '../../../../json-crdt-extensions/peritext/slice/Slice'; export interface FormattingBase, R extends Range> { behavior: B; range: R; } export interface FormattingWithConfig { conf(): ObjApi | undefined; } export interface ToolbarFormatting = Range, Node extends ObjNode = ObjNode> extends FormattingBase, FormattingWithConfig { } export declare abstract class EditableFormatting = Range, Node extends ObjNode = ObjNode> implements ToolbarFormatting { readonly behavior: ToolbarSliceBehavior; readonly range: R; readonly state: ToolbarState; constructor(behavior: ToolbarSliceBehavior, range: R, state: ToolbarState); conf(): ObjApi | undefined; validate(): ValidationResult; } /** * Formatting is a specific application of known formatting option to a range of * text. Formatting is composed of a specific {@link Slice} which stores the * state (location, data) of the formatting and a {@link ToolbarSliceBehavior} * which defines the formatting behavior. */ export declare class SavedFormatting extends EditableFormatting, Node> { /** * @returns Unique key for this formatting. This is the hash of the slice. * This is used to identify the formatting in the UI. */ key(): number; conf(): ObjApi | undefined; } /** * New formatting which is being created. Once created, it will be promoted to * a {@link SavedFormatting} instance. */ export declare class NewFormatting extends EditableFormatting, Node> { readonly behavior: ToolbarSliceBehavior; readonly range: Range; readonly state: ToolbarState; readonly model: Model>; constructor(behavior: ToolbarSliceBehavior, range: Range, state: ToolbarState); conf(): ObjApi | undefined; readonly save: () => void; }