/** * Loro → ProseMirror. * * Read-only, and free of any `loro-crdt` value import: containers are narrowed * through their own `kind()` method rather than `instanceof`, so this module * runs unchanged in a browser, in workerd, and in a test — which is what lets * the projection step in a `DocDO` reuse it without deciding which wasm build a * browser binding wants. */ import type { Mark, Node as PmNode, Schema } from 'prosemirror-model'; import type { ContainerID, LoroDoc, LoroList, LoroMap, LoroText } from 'loro-crdt'; import { LoroPmMapping, type LoroKind } from './types.js'; /** A node container: `{ nodeName, attributes?, children? }`. */ export type LoroNodeMap = LoroMap>; /** A node's child list — text runs and nested node containers, in order. */ export type LoroChildList = LoroList; /** * Narrow an unknown list/map value to a container kind, without importing a * Loro build. Every container exposes a literal-returning `kind()`; a plain * value does not. */ export declare function kindOf(value: unknown): LoroKind | null; /** The container id of any container, without importing a Loro build. */ export declare function containerIdOf(container: object): ContainerID; /** ProseMirror marks from one delta run's Loro styles. */ export declare function marksFromAttributes(schema: Schema, attributes: Record | undefined): readonly Mark[]; /** Loro styles for one ProseMirror text node's marks. */ export declare function attributesFromMarks(marks: readonly Mark[]): Record; /** The ProseMirror text nodes one `LoroText` run projects to. */ export declare function pmTextsFromLoro(schema: Schema, text: LoroText): PmNode[]; /** * Project one node container to a ProseMirror node. * * Returns the **cached** node for any container the mapping still holds, which * is what makes an unchanged subtree reference-equal across rebuilds. Callers * that want a fresh read pass a fresh mapping. */ export declare function pmNodeFromLoro(schema: Schema, container: LoroNodeMap, mapping: LoroPmMapping): PmNode; /** * The whole `pm_doc` for a Loro document. * * An untouched Loro document projects to the schema's empty document rather * than throwing — that is the state a brand new node is in before the editor * has written anything into it. */ export declare function pmDocFromLoro(schema: Schema, doc: LoroDoc, mapping?: LoroPmMapping): PmNode; //# sourceMappingURL=convert.d.ts.map