alinea
Version:
Headless git-based CMS
21 lines (20 loc) • 846 B
TypeScript
import type * as Y from 'yjs';
import type { Label } from '../Label.js';
import type { Shape } from '../Shape.js';
export type ScalarMutator<T> = (value: T) => void;
export declare class ScalarShape<T> implements Shape<T, ScalarMutator<T>> {
label: Label;
initialValue?: T | undefined;
searchable?: boolean | undefined;
constructor(label: Label, initialValue?: T | undefined, searchable?: boolean | undefined);
create(): T;
toY(value: T): T;
toV1(value: any): T;
fromY(yValue: any): any;
applyY(value: T, parent: Y.Map<any>, key: string): void;
init(parent: Y.Map<any>, key: string): void;
watch(parent: Y.Map<any>, key: string): (fun: () => void) => () => void;
mutator(parent: Y.Map<any>, key: string): (value: T) => void;
applyLinks(): Promise<void>;
searchableText(value: T): string;
}