json-joy
Version:
Collection of libraries for building collaborative editing apps.
53 lines (52 loc) • 1.49 kB
TypeScript
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;
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;
name(): string;
/** @ignore */
createChunk(id: ITimestampStruct, str: string | undefined): StrChunk;
/** @ignore */
protected onChange(): void;
protected toStringName(): string;
}