@y/y
Version:
Shared Editing Library
144 lines • 6.33 kB
TypeScript
/**
* @implements AbstractAttributionManager
*
* @extends {ObservableV2<{change:(idset:IdSet,origin:any,local:boolean)=>void}>}
*/
export class TwosetAttributionManager extends ObservableV2<{
change: (idset: IdSet, origin: any, local: boolean) => void;
}> implements AbstractAttributionManager {
/**
* @param {IdMap<any>} inserts
* @param {IdMap<any>} deletes
*/
constructor(inserts: IdMap<any>, deletes: IdMap<any>);
inserts: import("./ids.js").IdMap<any>;
deletes: import("./ids.js").IdMap<any>;
get $type(): import("lib0/schema").Schema<import("./attribution-manager-helpers.js").AbstractAttributionManager>;
/**
* @param {Array<AttributedContent<any>>} contents - where to write the result
* @param {number} client
* @param {number} clock
* @param {boolean} deleted
* @param {AbstractContent} content
* @param {0|1|2} shouldRender - whether this should render or just result in a `retain` operation
*/
readContent(contents: Array<AttributedContent<any>>, client: number, clock: number, deleted: boolean, content: AbstractContent, shouldRender: 0 | 1 | 2): void;
/**
* @param {Item} item
* @return {number}
*/
contentLength(item: Item): number;
}
export class Attributions {
inserts: import("./ids.js").IdMap<any>;
deletes: import("./ids.js").IdMap<any>;
}
/**
* @implements AbstractAttributionManager
*
* @extends {ObservableV2<{change:(idset:IdSet,origin:any,local:boolean)=>void}>}
*/
export class DiffAttributionManager extends ObservableV2<{
change: (idset: IdSet, origin: any, local: boolean) => void;
}> implements AbstractAttributionManager {
/**
* @param {Doc} prevDoc
* @param {Doc} nextDoc
* @param {Object} [options] - options for the attribution manager
* @param {Attributions?} [options.attrs] - the attributes to apply to the diff
*/
constructor(prevDoc: Doc, nextDoc: Doc, { attrs }?: {
attrs?: Attributions | null | undefined;
});
inserts: import("./ids.js").IdMap<any>;
deletes: import("./ids.js").IdMap<any>;
_prevDoc: import("./Doc.js").Doc;
_prevDocStore: import("./StructStore.js").StructStore;
_nextDoc: import("./Doc.js").Doc;
_nextBOH: (arg0: Transaction, arg1: import("./Doc.js").Doc) => void;
_prevBOH: (arg0: Transaction, arg1: import("./Doc.js").Doc) => void;
_prevUpdateListener: (arg0: Uint8Array<ArrayBuffer>, arg1: any, arg2: import("./Doc.js").Doc, arg3: Transaction) => void;
_ndUpdateListener: (arg0: Uint8Array<ArrayBuffer>, arg1: any, arg2: import("./Doc.js").Doc, arg3: Transaction) => void;
_afterTrListener: (arg0: Transaction, arg1: import("./Doc.js").Doc) => void;
suggestionMode: boolean;
/**
* Optionally limit origins that may sync changes to the main doc if suggestion-mode is
* disabled.
*
* @type {Array<any>?}
*/
suggestionOrigins: Array<any> | null;
_destroyHandler: (arg0: import("./Doc.js").Doc) => void;
get $type(): import("lib0/schema").Schema<import("./attribution-manager-helpers.js").AbstractAttributionManager>;
acceptAllChanges(): void;
rejectAllChanges(): void;
/**
* @param {ID} start
* @param {ID} end
*/
acceptChanges(start: ID, end?: ID): void;
/**
* @param {ID} start
* @param {ID} end
*/
rejectChanges(start: ID, end?: ID): void;
/**
* @param {Array<AttributedContent<any>>} contents - where to write the result
* @param {number} client
* @param {number} clock
* @param {boolean} deleted
* @param {AbstractContent} _content
* @param {0|1|2} shouldRender - whether this should render or just result in a `retain` operation
*/
readContent(contents: Array<AttributedContent<any>>, client: number, clock: number, deleted: boolean, _content: AbstractContent, shouldRender: 0 | 1 | 2): void;
/**
* @param {Item} item
* @return {number}
*/
contentLength(item: Item): number;
}
export function createAttributionManagerFromDiff(prevDoc: Doc, nextDoc: Doc, options?: {
attrs?: import("./meta.js").ContentMap | null | undefined;
}): DiffAttributionManager;
/**
* Intended for projects that used the v13 snapshot feature. With this AttributionManager you can
* read content similar to the previous snapshot api. Requires that `ydoc.gc` is turned off.
*
* @implements AbstractAttributionManager
*
* @extends {ObservableV2<{change:(idset:IdSet,origin:any,local:boolean)=>void}>}
*/
export class SnapshotAttributionManager extends ObservableV2<{
change: (idset: IdSet, origin: any, local: boolean) => void;
}> implements AbstractAttributionManager {
/**
* @param {Snapshot} prevSnapshot
* @param {Snapshot} nextSnapshot
* @param {Object} [options] - options for the attribution manager
* @param {Array<ContentAttribute>} [options.attrs] - the attributes to apply to the diff
*/
constructor(prevSnapshot: Snapshot, nextSnapshot: Snapshot);
prevSnapshot: import("./Snapshot.js").Snapshot;
nextSnapshot: import("./Snapshot.js").Snapshot;
attrs: import("./ids.js").IdMap<any>;
get $type(): import("lib0/schema").Schema<import("./attribution-manager-helpers.js").AbstractAttributionManager>;
/**
* @param {Array<AttributedContent<any>>} contents - where to write the result
* @param {number} client
* @param {number} clock
* @param {boolean} _deleted
* @param {AbstractContent} content
* @param {0|1|2} shouldRender - whether this should render or just result in a `retain` operation
*/
readContent(contents: Array<AttributedContent<any>>, client: number, clock: number, _deleted: boolean, content: AbstractContent, shouldRender: 0 | 1 | 2): void;
/**
* @param {Item} item
* @return {number}
*/
contentLength(item: Item): number;
}
export function createAttributionManagerFromSnapshots(prevSnapshot: Snapshot, nextSnapshot?: Snapshot): SnapshotAttributionManager;
import { ObservableV2 } from 'lib0/observable';
import { AttributedContent } from './attribution-manager-helpers.js';
export { noAttributionsManager, NoAttributionsManager, AbstractAttributionManager, $attributionManager } from "./attribution-manager-helpers.js";
//# sourceMappingURL=AttributionManager.d.ts.map