/** * @typedef {{ * insert?: string[] * insertAt?: number * delete?: string[] * deleteAt?: number * format?: Record * formatAt?: number * }} Attribution */ /** * @type {s.Schema} */ export const $attribution: s.Schema; /** * @typedef {{ [key: string]: any }} FormattingAttributes */ /** * @typedef {{ * type: 'delta', * name?: string, * attrs?: { [Key in string|number]: DeltaAttrOpJSON }, * children?: Array * }} DeltaJSON */ /** * @typedef {{ type: 'insert', insert: string|Array, format?: { [key: string]: any }, attribution?: Attribution } | { delete: number } | { type: 'retain', retain: number, format?: { [key:string]: any }, attribution?: Attribution } | { type: 'modify', value: object }} DeltaListOpJSON */ /** * @typedef {{ type: 'insert', value: any, prevValue?: any, attribution?: Attribution } | { type: 'delete', prevValue?: any, attribution?: Attribution } | { type: 'modify', value: DeltaJSON }} DeltaAttrOpJSON */ /** * @typedef {TextOp|InsertOp|DeleteOp|RetainOp|ModifyOp} ChildrenOpAny */ /** * @typedef {SetAttrOp|DeleteAttrOp|ModifyAttrOp} AttrOpAny */ /** * @typedef {ChildrenOpAny|AttrOpAny} _OpAny */ /** * @type {s.Schema} */ export const $deltaMapChangeJson: s.Schema; export class TextOp extends list.ListNode { /** * @param {string} insert * @param {FormattingAttributes|null} format * @param {Attribution?} attribution */ constructor(insert: string, format: FormattingAttributes | null, attribution: Attribution | null); /** * @readonly * @type {string} */ readonly insert: string; /** * @readonly * @type {FormattingAttributes|null} */ readonly format: FormattingAttributes | null; attribution: Attribution | null; /** * @type {string?} */ _fingerprint: string | null; get $type(): s.Schema; /** * @param {string} newVal */ _updateInsert(newVal: string): void; /** * @return {'insert'} */ get type(): "insert"; get length(): number; get fingerprint(): string; /** * Remove a part of the operation (similar to Array.splice) * * @param {number} offset * @param {number} len */ _splice(offset: number, len: number): this; /** * @return {DeltaListOpJSON} */ toJSON(): DeltaListOpJSON; /** * @return {TextOp} */ clone(start?: number, end?: number): TextOp; /** * @param {TextOp} other */ [equalityTrait.EqualityTraitSymbol](other: TextOp): boolean; } /** * @template {any} ArrayContent */ export class InsertOp extends list.ListNode { /** * @param {Array} insert * @param {FormattingAttributes|null} format * @param {Attribution?} attribution */ constructor(insert: Array, format: FormattingAttributes | null, attribution: Attribution | null); /** * @readonly * @type {Array} */ readonly insert: Array; /** * @readonly * @type {FormattingAttributes?} */ readonly format: FormattingAttributes | null; /** * @readonly * @type {Attribution?} */ readonly attribution: Attribution | null; /** * @type {string?} */ _fingerprint: string | null; get $type(): s.Schema>; /** * @param {ArrayContent} newVal */ _updateInsert(newVal: ArrayContent): void; /** * @return {'insert'} */ get type(): "insert"; get length(): number; /** * @param {number} i * @return {Extract} */ _modValue(i: number): Extract; get fingerprint(): string; /** * Remove a part of the operation (similar to Array.splice) * * @param {number} offset * @param {number} len */ _splice(offset: number, len: number): this; /** * @return {DeltaListOpJSON} */ toJSON(): DeltaListOpJSON; /** * @return {InsertOp} */ clone(start?: number, end?: number): InsertOp; /** * @param {InsertOp} other */ [equalityTrait.EqualityTraitSymbol](other: InsertOp): boolean; } /** * @template {DeltaConf} [DConf={}] */ export class DeleteOp extends list.ListNode { /** * @param {number} len */ constructor(len: number); delete: number; /** * @type {Delta?} */ prevValue: Delta | null; /** * @type {string|null} */ _fingerprint: string | null; get $type(): s.Schema>; /** * @return {'delete'} */ get type(): "delete"; get length(): number; get fingerprint(): string; /** * Remove a part of the operation (similar to Array.splice) * * @param {number} _offset * @param {number} len */ _splice(_offset: number, len: number): this; /** * @return {DeltaListOpJSON} */ toJSON(): DeltaListOpJSON; /** * @param {number} start * @param {number} end * @return {DeleteOp} */ clone(start?: number, end?: number): DeleteOp; /** * @param {DeleteOp} other */ [equalityTrait.EqualityTraitSymbol](other: DeleteOp): boolean; } export class RetainOp extends list.ListNode { /** * @param {number} retain * @param {FormattingAttributes|null} format * @param {Attribution?} attribution */ constructor(retain: number, format: FormattingAttributes | null, attribution: Attribution | null); /** * @readonly * @type {number} */ readonly retain: number; /** * @readonly * @type {FormattingAttributes?} */ readonly format: FormattingAttributes | null; /** * @readonly * @type {Attribution?} */ readonly attribution: Attribution | null; /** * @type {string|null} */ _fingerprint: string | null; get $type(): s.Schema; /** * @return {'retain'} */ get type(): "retain"; get length(): number; get fingerprint(): string; /** * Remove a part of the operation (similar to Array.splice) * * @param {number} _offset * @param {number} len */ _splice(_offset: number, len: number): this; /** * @return {DeltaListOpJSON} */ toJSON(): DeltaListOpJSON; clone(start?: number, end?: number): RetainOp; /** * @param {RetainOp} other */ [equalityTrait.EqualityTraitSymbol](other: RetainOp): boolean; } /** * Delta that can be applied on a YType Embed * * @template {Delta} [DTypes=DeltaAny] */ export class ModifyOp extends list.ListNode { /** * @param {DTypes} delta * @param {FormattingAttributes|null} format * @param {Attribution?} attribution */ constructor(delta: DTypes, format: FormattingAttributes | null, attribution: Attribution | null); /** * @readonly * @type {DTypes} */ readonly value: DTypes; /** * @readonly * @type {FormattingAttributes?} */ readonly format: FormattingAttributes | null; /** * @readonly * @type {Attribution?} */ readonly attribution: Attribution | null; /** * @type {string|null} */ _fingerprint: string | null; get $type(): s.Schema>; /** * @return {'modify'} */ get type(): "modify"; get length(): number; /** * @type {DeltaBuilderAny} */ get _modValue(): DeltaBuilderAny; get fingerprint(): string; /** * Remove a part of the operation (similar to Array.splice) * * @param {number} _offset * @param {number} _len */ _splice(_offset: number, _len: number): this; /** * @return {DeltaListOpJSON} */ toJSON(): DeltaListOpJSON; /** * @return {ModifyOp} */ clone(): ModifyOp; /** * @param {ModifyOp} other */ [equalityTrait.EqualityTraitSymbol](other: ModifyOp): boolean; } /** * @template {any} [V=any] * @template {string|number} [K=any] */ export class SetAttrOp { /** * @param {K} key * @param {V} value * @param {V|undefined} prevValue * @param {Attribution?} attribution */ constructor(key: K, value: V, prevValue: V | undefined, attribution: Attribution | null); /** * @readonly * @type {K} */ readonly key: K; /** * @readonly * @type {V} */ readonly value: V; /** * @readonly * @type {V|undefined} */ readonly prevValue: V | undefined; /** * @readonly * @type {Attribution?} */ readonly attribution: Attribution | null; /** * @type {string|null} */ _fingerprint: string | null; get $type(): s.Schema>; /** * @return {'insert'} */ get type(): "insert"; /** * @type {DeltaBuilderAny} */ get _modValue(): DeltaBuilderAny; get fingerprint(): string; toJSON(): { type: "insert"; value: DeltaJSON | V; } & (({ attribution: Attribution; } | { attribution?: undefined; }) & ({ prevValue: V & ({} | null); } | { prevValue?: undefined; })); /** * @return {SetAttrOp} */ clone(): SetAttrOp; /** * @param {SetAttrOp} other */ [equalityTrait.EqualityTraitSymbol](other: SetAttrOp): boolean; } /** * @template [V=any] * @template {string|number} [K=string|number] */ export class DeleteAttrOp { /** * @param {K} key * @param {V|undefined} prevValue * @param {Attribution?} attribution */ constructor(key: K, prevValue: V | undefined, attribution: Attribution | null); /** * @type {K} */ key: K; /** * @type {V|undefined} */ prevValue: V | undefined; attribution: Attribution | null; /** * @type {string|null} */ _fingerprint: string | null; get $type(): s.Schema>; /** * @type {'delete'} */ get type(): "delete"; get value(): undefined; get fingerprint(): string; /** * @return {DeltaAttrOpJSON} */ toJSON(): DeltaAttrOpJSON; clone(): DeleteAttrOp; /** * @param {DeleteAttrOp} other */ [equalityTrait.EqualityTraitSymbol](other: DeleteAttrOp): boolean; } /** * @template {DeltaAny} [Modifier=DeltaAny] * @template {string|number} [K=string] */ export class ModifyAttrOp { /** * @param {K} key * @param {Modifier} delta */ constructor(key: K, delta: Modifier); /** * @readonly * @type {K} */ readonly key: K; /** * @readonly * @type {Modifier} */ readonly value: Modifier; /** * @type {string|null} */ _fingerprint: string | null; get $type(): s.Schema>; /** * @type {'modify'} */ get type(): "modify"; get fingerprint(): string; /** * @return {DeltaBuilder} */ get _modValue(): DeltaBuilder; /** * @return {DeltaAttrOpJSON} */ toJSON(): DeltaAttrOpJSON; /** * @return {ModifyAttrOp} */ clone(): ModifyAttrOp; /** * @param {ModifyAttrOp} other */ [equalityTrait.EqualityTraitSymbol](other: ModifyAttrOp): boolean; } export const $insertOp: s.Schema>; export const $modifyOp: s.Schema; export const $textOp: s.Schema; export const $deleteOp: s.Schema>; export const $retainOp: s.Schema; export const $anyOp: s.Schema | DeleteOp | ModifyOp>; export const $setAttrOp: s.Schema>; export const $modifyAttrOp: s.Schema>; export const $deleteAttrOp: s.Schema>; export const $anyAttrOp: s.Schema | DeleteAttrOp | ModifyAttrOp>; export function $setAttrOpWith($content: s.Schema): s.Schema>; export function $insertOpWith($content: s.Schema): s.Schema>; export function $modifyOpWith($content: s.Schema): s.Schema>; export function $modifyAttrOpWith($content: s.Schema): s.Schema>; /** * @template {DeltaConf} [DConf={}] * @extends {DeltaData< * DeltaConfGetName, * DeltaConfGetAttrs, * DeltaConfGetChildren, * DConf extends {text:true} ? true : false * >} */ export class Delta extends DeltaData, import("../ts.js").TypeIsAny, DeltaConfGetChildren, DConf extends { text: true; } ? true : false> { /** * @param {string?} name * @param {s.Schema>?} $schema */ constructor(name: string | null, $schema: s.Schema> | null); get $type(): s.Schema; /** * @type {string} */ get fingerprint(): string; isEmpty(): boolean; /** * @return {DeltaJSON} */ toJSON(): DeltaJSON; /** * @param {Delta} other * @return {boolean} */ equals(other: Delta): boolean; /** * Mark this delta as done and perform some cleanup (e.g. remove appended retains without * formats&attributions). In the future, there might be additional merge operations that can be * performed to result in smaller deltas. Set `markAsDone=false` to only perform the cleanup. * * @return {Delta} */ done(markAsDone?: boolean): Delta; [fingerprintTrait.FingerprintTraitSymbol](): string; /** * @param {any} other * @return {boolean} */ [equalityTrait.EqualityTraitSymbol](other: any): boolean; } export function slice(d: Delta, start?: number, end?: number, currNode?: ChildrenOpAny | null): DeltaBuilder; export function clone(d: D): D extends Delta ? DeltaBuilder : never; /** * @template {DeltaConf} [DConf={}] * @extends {Delta} */ export class DeltaBuilder extends Delta { /** * @param {string?} name * @param {s.Schema>?} $schema */ constructor(name: string | null, $schema: s.Schema> | null); /** * @type {FormattingAttributes?} */ usedAttributes: FormattingAttributes | null; /** * @type {Attribution?} */ usedAttribution: Attribution | null; /** * @param {Attribution?} attribution */ useAttribution(attribution: Attribution | null): this; /** * @param {FormattingAttributes?} attributes * @return {this} */ useAttributes(attributes: FormattingAttributes | null): this; /** * @param {string} name * @param {any} value */ updateUsedAttributes(name: string, value: any): this; /** * @template {keyof Attribution} NAME * @param {NAME} name * @param {Attribution[NAME]?} value */ updateUsedAttribution(name: NAME, value: Attribution[NAME] | null): this; /** * @template {(DConf extends {fixed:true} ? never : (Array|string)) | (DeltaConfGetChildren extends infer Children ? (Children extends never ? never : Array) : never) | DeltaConfGetText} NewContent * @param {NewContent} insert * @param {FormattingAttributes?} [formatting] * @param {Attribution?} [attribution] * @return {DeltaBuilder extends never ? {} : { * children: Exclude[number]|DeltaConfGetChildren * }) & (Extract extends never ? {} : { text: true })>>} */ insert | string)) | (DeltaConfGetChildren extends infer Children_1 ? (Children_1 extends never ? never : Array) : never) | DeltaConfGetText>(insert: NewContent, formatting?: FormattingAttributes | null, attribution?: Attribution | null): DeltaBuilder extends never ? {} : { children: Exclude[number] | DeltaConfGetChildren; }) & (Extract extends never ? {} : { text: true; })>>; /** * @template {Extract,Delta>} NewContent * @param {NewContent} modify * @param {FormattingAttributes?} formatting * @param {Attribution?} attribution * @return {DeltaBuilder|NewContent}>>} */ modify, Delta>>(modify: NewContent, formatting?: FormattingAttributes | null, attribution?: Attribution | null): DeltaBuilder | NewContent; }>>; /** * @param {number} len * @param {FormattingAttributes?} [format] * @param {Attribution?} [attribution] */ retain(len: number, format?: FormattingAttributes | null, attribution?: Attribution | null): this; /** * @param {number} len */ delete(len: number): this; /** * @template {keyof DeltaConfGetAllowedAttrs} Key * @template {DeltaConfGetAllowedAttrs[Key]} Val * @param {Key} key * @param {Val} val * @param {Attribution?} attribution * @param {Val|undefined} [prevValue] * @return {DeltaBuilder,Key,Val>}>>} */ setAttr, Val extends DeltaConfGetAllowedAttrs[Key]>(key: Key, val: Val, attribution?: Attribution | null, prevValue?: Val | undefined): DeltaBuilder, Key, Val>; }>>; /** * @template {DeltaConfGetAllowedAttrs} NewAttrs * @param {NewAttrs} attrs * @param {Attribution?} attribution * @return {DeltaBuilder,NewAttrs> } * >> * } */ setAttrs>(attrs: NewAttrs, attribution?: Attribution | null): DeltaBuilder, NewAttrs>; }>>; /** * @template {keyof DeltaConfGetAllowedAttrs} Key * @param {Key} key * @param {Attribution?} attribution * @param {any} [prevValue] * @return {DeltaBuilder,Key,never> * }>>} */ deleteAttr>(key: Key, attribution?: Attribution | null, prevValue?: any): DeltaBuilder, Key, never>; }>>; /** * @template {DeltaConfGetAllowedAttrs extends infer As ? { [K in keyof As]: Extract extends never ? never : K }[keyof As] : never} Key * @template {Extract[Key],DeltaAny>} D * @param {Key} key * @param {D} modify * @return {DeltaBuilder,Key,D>}>>} */ modifyAttr extends infer As ? { [K in keyof As]: Extract extends never ? never : K; }[keyof As] : never, D extends Extract[Key], DeltaAny>>(key: Key, modify: D): DeltaBuilder, Key, D>; }>>; /** * @param {Delta} other */ apply(other: Delta): this; /** * @param {DeltaAny} other * @param {boolean} priority */ rebase(other: DeltaAny, priority: boolean): this; /** * Same as doing `delta.rebase(other.inverse())`, without creating a temporary delta. * * @param {DeltaAny} other * @param {boolean} priority */ rebaseOnInverse(other: DeltaAny, priority: boolean): this; /** * Append child ops from one op to the other. * * delta.create().insert('a').append(delta.create().insert('b')) // => insert "ab" * * @todo on fixed deltas this should not extend * * @template {DeltaConf} OtherDeltaConf * @param {Delta} other * @return {DeltaBuilder extends never ? {} : { children: DeltaConfGetChildren | DeltaConfGetChildren }) * & (DeltaConfGetText extends string ? { text: true } : never) * >>} */ append(other: Delta): DeltaBuilder extends never ? {} : { children: DeltaConfGetChildren | DeltaConfGetChildren; }) & (DeltaConfGetText extends string ? { text: true; } : never)>>; } /** * @template {DeltaConf} DConf * @extends {s.Schema>} */ export class $Delta extends s.Schema> { /** * @param {s.Schema} $name * @param {s.Schema} $attrs * @param {s.Schema} $children * @param {any} hasText * @param {any} recursiveChildren * @param {s.Schema<{[K:string]:any}>} $formats */ constructor($name: s.Schema, $attrs: s.Schema, $children: s.Schema, hasText: any, recursiveChildren: any, $formats: s.Schema<{ [K: string]: any; }>); /** * @type {{ * $name: s.Schema>, * $attrs: s.Schema>, * $children: s.Schema>, * hasText: DeltaConfGetText * recursiveChildren: DeltaConfGetRecursiveChildren, * $formats: s.Schema<{[K:string]:any}> * }} */ shape: { $name: s.Schema>; $attrs: s.Schema>; $children: s.Schema>; hasText: DeltaConfGetText; recursiveChildren: DeltaConfGetRecursiveChildren; $formats: s.Schema<{ [K: string]: any; }>; }; } export function $delta | string | Array = s.Schema, AttrsSchema extends s.Schema<{ [key: string | number]: any; }> | { [key: string | number]: any; } = s.Schema<{}>, ChildrenSchema extends unknown = s.Schema, HasText extends boolean = false, RecursiveChildren extends boolean = false, Formats extends { [k: string]: any; } = { [k: string]: any; }>({ name, attrs, children, text, formats, recursiveChildren: recursive }: { name?: NodeNameSchema | null | undefined; attrs?: AttrsSchema | null | undefined; children?: ChildrenSchema | null | undefined; text?: HasText | undefined; formats?: Formats | undefined; recursiveChildren?: RecursiveChildren | undefined; }): [s.Unwrap>, s.Unwrap>, s.Unwrap>] extends [infer NodeName_1, infer Attrs_1, infer Children_1] ? s.Schema> : never; export const $$delta: s.Schema<$Delta>; export function _$delta | string | Array = s.Schema, AttrsSchema extends s.Schema<{ [key: string | number]: any; }> | { [key: string | number]: any; } = s.Schema<{}>, ChildrenSchema extends unknown = s.Schema, HasText extends boolean = false, Recursive extends boolean = false>({ name, attrs, children, text, recursive }: { name?: NodeNameSchema | null | undefined; attrs?: AttrsSchema | null | undefined; children?: ChildrenSchema | null | undefined; text?: HasText | undefined; recursive?: Recursive | undefined; }): [s.Unwrap>, s.Unwrap>, s.Unwrap>] extends [infer NodeName_1, infer Attrs_1, infer Children_1] ? s.Schema : never), HasText extends true ? string : never>> : never; export const $deltaAny: s.Schema; export const $deltaBuilderAny: s.Schema; export function mergeAttrs(a: T | null, b: T | null): T | null; export function mergeDeltas(a: D, b: D): D; export function random(gen: prng.PRNG, $d: s.Schema>): DeltaBuilder; /** * @overload * @return {DeltaBuilder<{}>} */ export function create(): DeltaBuilder<{}>; /** * @template {string} NodeName * @overload * @param {NodeName} nodeName * @return {DeltaBuilder<{ name: NodeName }>} */ export function create(nodeName: NodeName): DeltaBuilder<{ name: NodeName; }>; /** * @template {string} NodeName * @template {s.Schema} Schema * @overload * @param {NodeName} nodeName * @param {Schema} schema * @return {Schema extends s.Schema> ? DeltaBuilder> : never} */ export function create>(nodeName: NodeName, schema: Schema): Schema extends s.Schema> ? DeltaBuilder> : never; /** * @template {s.Schema} Schema * @overload * @param {Schema} schema * @return {Schema extends s.Schema> ? DeltaBuilder> : never} */ export function create>(schema: Schema): Schema extends s.Schema> ? DeltaBuilder> : never; /** * @template {string|null} NodeName * @template {{[k:string|number]:any}|null} Attrs * @template {Array|string} [Children=never] * @overload * @param {NodeName} nodeName * @param {Attrs} attrs * @param {Children} [children] * @return {DeltaBuilder<{ * name: NodeName, * attrs: Attrs extends null ? {} : Attrs, * children: Extract> extends Array ? (unknown extends Ac ? never : Ac) : never, * text: Extract extends never ? false : true * }>} */ export function create | string = never>(nodeName: NodeName, attrs: Attrs, children?: Children | undefined): DeltaBuilder<{ name: NodeName; attrs: Attrs extends null ? {} : Attrs; children: Extract> extends Array ? (unknown extends Ac ? never : Ac) : never; text: Extract extends never ? false : true; }>; export function diff(d1: Delta, d2: NoInfer>): DeltaBuilder; export type Attribution = { insert?: string[]; insertAt?: number; delete?: string[]; deleteAt?: number; format?: Record; formatAt?: number; }; export type FormattingAttributes = { [key: string]: any; }; export type DeltaJSON = { type: "delta"; name?: string; attrs?: { [Key in string | number]: DeltaAttrOpJSON; }; children?: Array; }; export type DeltaListOpJSON = { type: "insert"; insert: string | Array; format?: { [key: string]: any; }; attribution?: Attribution; } | { delete: number; } | { type: "retain"; retain: number; format?: { [key: string]: any; }; attribution?: Attribution; } | { type: "modify"; value: object; }; export type DeltaAttrOpJSON = { type: "insert"; value: any; prevValue?: any; attribution?: Attribution; } | { type: "delete"; prevValue?: any; attribution?: Attribution; } | { type: "modify"; value: DeltaJSON; }; export type ChildrenOpAny = TextOp | InsertOp | DeleteOp | RetainOp | ModifyOp; export type AttrOpAny = SetAttrOp | DeleteAttrOp | ModifyAttrOp; export type _OpAny = ChildrenOpAny | AttrOpAny; export type AddToAttrs = { [K in (Key | keyof Attrs_1)]: (unknown extends Attrs_1[K] ? never : Attrs_1[K]) | (Key extends K ? Val : never); }; export type MergeAttrs = { [K in (keyof NewAttrs | keyof Attrs_1)]: (unknown extends Attrs_1[K] ? never : Attrs_1[K]) | (unknown extends NewAttrs[K] ? never : NewAttrs[K]); }; export type DeltaAny = Delta; export type DeltaBuilderAny = DeltaBuilder; export type DeltaConf = { name?: string | undefined; children?: fingerprintTrait.Fingerprintable; text?: boolean | undefined; attrs?: { [K: string]: fingerprintTrait.Fingerprintable; [K: number]: fingerprintTrait.Fingerprintable; } | undefined; fixed?: boolean | undefined; recursiveChildren?: boolean | undefined; recursiveAttrs?: boolean | undefined; }; export type DeltaConfGetName = DConf extends { name: infer Name; } ? (unknown extends Name ? any : (Exclude)) : any; export type DeltaConfGetChildren = (DConf extends { children: infer Children_1; } ? (unknown extends Children_1 ? any : Children_1) : never) | (DConf extends { recursiveChildren: true; } ? Delta : never); export type DeltaConfGetAllowedChildren = DConf extends { fixed: true; } ? DeltaConfGetChildren : any; export type DeltaConfGetText = 0 extends (1 & DConf) ? string : (DConf extends { text: true; } ? string : never); export type DeltaConfGetAttrs = import("../ts.js").TypeIsAny; export type DeltaConfGetAllowedAttrs = DConf extends { fixed: true; } ? DeltaConfGetAttrs : { [K: string | number]: any; }; export type DeltaConfGetFixed = 0 extends (1 & DConf) ? true : (DConf extends { fixed: true; } ? true : false); export type DeltaConfGetRecursiveChildren = DConf extends { recursiveChildren: true; } ? true : false; export type DeltaConfigGetRecursiveAttrs = DConf extends { recursiveAttrs: true; } ? true : false; /** * Transform Delta(Builder) to a normal delta. */ export type _SanifyDelta = V extends never ? never : (import("../ts.js").TypeIsAny ? Delta : V>); export type PrettifyDeltaConf = import("../ts.js").Prettify<{ [K in keyof DConf]: K extends "attrs" ? import("../ts.js").Prettify<{ [KA in keyof DConf[K]]: _SanifyDelta; }, 1> : (K extends "children" ? _SanifyDelta : DConf[K]); }, 1>; export type DeltaConfOverwrite = import("../ts.js").TypeIsAny>; export type qq = string extends never ? true : false; import * as s from '../schema.js'; import * as list from '../list.js'; import * as equalityTrait from '../trait/equality.js'; import * as fingerprintTrait from '../trait/fingerprint.js'; /** * @template {{[Key in string|number]: any}} Attrs * @template {string|number} Key * @template {any} Val * @typedef {{ [K in (Key | keyof Attrs)]: (unknown extends Attrs[K] ? never : Attrs[K]) | (Key extends K ? Val : never) }} AddToAttrs */ /** * @template {{[Key in string|number|symbol]: any}} Attrs * @template {{[Key in string|number|symbol]: any}} NewAttrs * @typedef {{ [K in (keyof NewAttrs | keyof Attrs)]: (unknown extends Attrs[K] ? never : Attrs[K]) | (unknown extends NewAttrs[K] ? never : NewAttrs[K]) }} MergeAttrs */ /** * @typedef {Delta} DeltaAny */ /** * @typedef {DeltaBuilder} DeltaBuilderAny */ /** * @typedef {object} DeltaConf * @property {string} [DeltaConf.name] * @property {fingerprintTrait.Fingerprintable} [DeltaConf.children=never] * @property {boolean} [DeltaConf.text=never] * @property {{[K:string|number]:fingerprintTrait.Fingerprintable}} [DeltaConf.attrs={}] * @property {boolean} [DeltaConf.fixed=never] * @property {boolean} [DeltaConf.recursiveChildren=false] * @property {boolean} [DeltaConf.recursiveAttrs=false] */ /** * @template {DeltaConf} DConf * @typedef {DConf extends {name:infer Name} ? (unknown extends Name ? any : (Exclude)) : any} DeltaConfGetName */ /** * @template {DeltaConf} DConf * @typedef {(DConf extends {children:infer Children} ? (unknown extends Children ? any : Children) : never) | (DConf extends {recursiveChildren:true} ? Delta : never)} DeltaConfGetChildren */ /** * @template {DeltaConf} DConf * @typedef {DConf extends {fixed:true} ? DeltaConfGetChildren : any } DeltaConfGetAllowedChildren */ /** * @template {DeltaConf} DConf * @typedef {0 extends (1 & DConf) ? string : (DConf extends {text:true} ? string : never)} DeltaConfGetText */ /** * @template {DeltaConf} DConf * @typedef {import('../ts.js').TypeIsAny} DeltaConfGetAttrs */ /** * @template {DeltaConf} DConf * @typedef {DConf extends {fixed:true} ? DeltaConfGetAttrs : {[K:string|number]:any}} DeltaConfGetAllowedAttrs */ /** * @template {DeltaConf} DConf * @typedef {0 extends (1 & DConf) ? true : (DConf extends { fixed: true } ? true : false)} DeltaConfGetFixed */ /** * @template {DeltaConf} DConf * @typedef {DConf extends {recursiveChildren:true} ? true : false} DeltaConfGetRecursiveChildren */ /** * @template {DeltaConf} DConf * @typedef {DConf extends {recursiveAttrs:true} ? true : false} DeltaConfigGetRecursiveAttrs */ /** * Transform Delta(Builder) to a normal delta. * * @template V * @typedef {V extends never ? never : (import('../ts.js').TypeIsAny ? Delta : V>)} _SanifyDelta */ /** * @template {DeltaConf} DConf * @typedef {import('../ts.js').Prettify<{[K in keyof DConf]: K extends 'attrs' ? import('../ts.js').Prettify<{ [KA in keyof DConf[K]]: _SanifyDelta },1> : (K extends 'children' ? _SanifyDelta : DConf[K]) }, 1>} PrettifyDeltaConf */ /** * @template {DeltaConf} D1 * @template {DeltaConf} D2 * @typedef {import('../ts.js').TypeIsAny>} DeltaConfOverwrite */ /** * @template {string} Name * @template {{[K in string|number]:any}} Attrs * @template Children * @template {boolean} Text */ declare class DeltaData { /** * @param {string?} name * @param {s.Schema>?} $schema */ constructor(name: string | null, $schema: s.Schema> | null); name: Name; $schema: s.Schema> | null; /** * @type {{ [K in keyof Attrs]?: K extends string|number ? (SetAttrOp|DeleteAttrOp|(Attrs[K] extends never ? never : (Attrs[K] extends Delta ? ModifyAttrOp,K> : never))) : never } * & { [Symbol.iterator]: () => Iterator<{ [K in keyof Attrs]: K extends string|number ? (SetAttrOp|DeleteAttrOp|(Attrs[K] extends never ? never : (Delta extends Attrs[K] ? ModifyAttrOp,K> : never))) : never }[keyof Attrs]> } * } */ attrs: { [K in keyof Attrs]?: K extends string | number ? (SetAttrOp | DeleteAttrOp | (Attrs[K] extends never ? never : (Attrs[K] extends Delta ? ModifyAttrOp, K> : never))) : never; } & { [Symbol.iterator]: () => Iterator<{ [K in keyof Attrs]: K extends string | number ? (SetAttrOp | DeleteAttrOp | (Attrs[K] extends never ? never : (Delta extends Attrs[K] ? ModifyAttrOp, K> : never))) : never; }[keyof Attrs]>; }; /** * @type {list.List< * | (Text extends true ? (RetainOp|TextOp|DeleteOp) : never) * | (RetainOp|InsertOp|DeleteOp|(Delta extends Children ? ModifyOp> : never)) * >} */ children: list.List<(Text extends true ? (RetainOp | TextOp | DeleteOp) : never) | (RetainOp | InsertOp | DeleteOp | (Delta extends Children ? ModifyOp> : never))>; childCnt: number; /** * @type {any} */ origin: any; /** * @type {string|null} */ _fingerprint: string | null; isDone: boolean; } import * as prng from '../prng.js'; export {}; //# sourceMappingURL=delta.d.ts.map