UNPKG

alinea

Version:
27 lines (26 loc) 1.11 kB
import type { LinkResolver } from 'alinea/core/db/LinkResolver'; import * as Y from 'yjs'; import type { Label } from '../Label.js'; import type { Shape } from '../Shape.js'; export type RecordMutator<T> = { set: <K extends keyof T>(k: K, v: T[K]) => void; }; export declare class RecordShape<T = {}> implements Shape<T, RecordMutator<T>> { label: Label; shapes: Record<string, Shape>; initialValue?: T | undefined; constructor(label: Label, shapes: Record<string, Shape>, initialValue?: T | undefined); concat<X>(that: RecordShape<X> | undefined): RecordShape<T & X>; create(): T; toY(value: T): Y.Map<unknown>; fromY(map: Y.Map<any>): T; applyY(value: T, map: Y.Doc | Y.Map<any>, key: string): undefined; init(parent: Y.Map<any>, key: string): void; watch(parent: Y.Map<any>, key: string): (fun: () => void) => () => any; mutator(parent: Y.Map<any>, key: string): { set: <K extends keyof T>(k: K, v: T[K]) => void; }; applyLinks(value: T, loader: LinkResolver): Promise<void>; toV1(value: any): T; searchableText(value: T): string; }