UNPKG

@y/y

Version:

Shared Editing Library

94 lines • 3.26 kB
/** * @template {DeltaConf} DConf * YEvent describes the changes on a YType. */ export class YEvent<DConf extends DeltaConf> { /** * @param {YType<DConf>} target The changed type. * @param {Transaction} transaction * @param {Set<any>?} subs The keys that changed */ constructor(target: YType<DConf>, transaction: Transaction, subs: Set<any> | null); /** * The type on which this event was created on. * @type {YType<DConf>} */ target: YType<DConf>; /** * The current target on which the observe callback is called. * @type {YType<any>} */ currentTarget: YType<any>; /** * The transaction that triggered this event. * @type {Transaction} */ transaction: Transaction; /** * @type {Delta<import('../ytype.js').DeltaConfDeltaToYType<DConf>>|null} */ _delta: Delta<import("../ytype.js").DeltaConfDeltaToYType<DConf>> | null; /** * @type {Delta<DConf>|null} */ _deltaDeep: Delta<DConf> | null; /** * Whether the children changed. * @type {Boolean} * @private */ private childListChanged; /** * Set of all changed attributes. * @type {Set<string>} */ keysChanged: Set<string>; /** * Check if a struct is deleted by this event. * * In contrast to change.deleted, this method also returns true if the struct was added and then deleted. * * @param {AbstractStruct} struct * @return {boolean} */ deletes(struct: AbstractStruct): boolean; /** * Check if a struct is added by this event. * * In contrast to change.deleted, this method also returns true if the struct was added and then deleted. * * @param {AbstractStruct} struct * @return {boolean} */ adds(struct: AbstractStruct): boolean; /** * @template {boolean} [Deep=false] * @param {AbstractAttributionManager} am * @param {object} [opts] * @param {Deep} [opts.deep] * @return {Deep extends true ? Delta<DConf> : Delta<import('../ytype.js').DeltaConfDeltaToYType<DConf>>} The Delta representation of this type. * * @public */ public getDelta<Deep extends boolean = false>(am?: AbstractAttributionManager, { deep }?: { deep?: Deep | undefined; }): Deep extends true ? Delta<DConf> : Delta<import("../ytype.js").DeltaConfDeltaToYType<DConf>>; /** * Compute the changes in the delta format. * A {@link https://quilljs.com/docs/delta/|Quill Delta}) that represents the changes on the document. * * @type {Delta<import('../ytype.js').DeltaConfDeltaToYType<DConf>>} The Delta representation of this type. * @public */ public get delta(): Delta<import("../ytype.js").DeltaConfDeltaToYType<DConf>>; /** * Compute the changes in the delta format. * A {@link https://quilljs.com/docs/delta/|Quill Delta}) that represents the changes on the document. * * @type {Delta<DConf>} The Delta representation of this type. * @public */ public get deltaDeep(): Delta<DConf>; } export function getPathTo(parent: YType, child: YType, am?: AbstractAttributionManager): Array<string | number>; //# sourceMappingURL=YEvent.d.ts.map