UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

61 lines (60 loc) 1.76 kB
import { type ITimestampStruct } from '../../../json-crdt-patch/clock'; import { AbstractRga, type Chunk } from '../rga/AbstractRga'; import type { JsonNode } from '..'; /** * @ignore * @category CRDT Node */ export declare class StrChunk implements Chunk<string> { readonly id: ITimestampStruct; span: number; del: boolean; data: string; len: number; p: StrChunk | undefined; l: StrChunk | undefined; r: StrChunk | undefined; p2: StrChunk | undefined; l2: StrChunk | undefined; r2: StrChunk | undefined; s: StrChunk | undefined; constructor(id: ITimestampStruct, span: number, str: string); merge(str: string): void; split(ticks: number): StrChunk; delete(): void; /** * - `id`, `span`, `len`, `del`, `data`: copied, set by constructor * - `p`, `l`, `r`, `p2`, `l2`, `r2`, `s`: not copied, set when inserted into RGA */ clone(): StrChunk; view(): string; } /** * Represents the `str` type in JSON CRDT. The `str` type is a RGA (Replicated * Growable Array) of UTF-16 code units. * * @category CRDT Node */ export declare class StrNode<T extends string = string> extends AbstractRga<string> implements JsonNode<string> { /** @ignore */ children(): void; /** @ignore */ child(): undefined; /** @ignore */ container(): JsonNode | undefined; /** @ignore */ private _view; view(): T; /** @ignore */ api: undefined | unknown; /** @ignore */ parent: JsonNode | undefined; name(): string; /** @ignore */ clone(): StrNode<T>; /** @ignore */ createChunk(id: ITimestampStruct, str: string | undefined): StrChunk; /** @ignore */ protected onChange(): void; protected toStringName(): string; }