/** * Event that describes the changes on a YArray * @template T * @extends YEvent> */ export class YArrayEvent extends YEvent> { constructor(target: YArray, transaction: Transaction); } /** * A shared Array implementation. * @template T * @extends AbstractType> * @implements {Iterable} */ export class YArray extends AbstractType> implements Iterable { /** * Construct a new YArray containing the specified items. * @template {Object|Array|number|null|string|Uint8Array} T * @param {Array} items * @return {YArray} */ static from(items: T_1[]): YArray; /** * @type {Array?} * @private */ private _prelimContent; /** * @type {Array} */ _searchMarker: Array; /** * Integrate this type into the Yjs instance. * * * Save this struct in the os * * This type is sent to other client * * Observer functions are fired * * @param {Doc} y The Yjs instance * @param {Item} item */ _integrate(y: Doc, item: Item): void; /** * @return {YArray} */ _copy(): YArray; /** * Makes a copy of this data type that can be included somewhere else. * * Note that the content is only readable _after_ it has been included somewhere in the Ydoc. * * @return {YArray} */ clone(): YArray; get length(): number; /** * Inserts new content at an index. * * Important: This function expects an array of content. Not just a content * object. The reason for this "weirdness" is that inserting several elements * is very efficient when it is done as a single operation. * * @example * // Insert character 'a' at position 0 * yarray.insert(0, ['a']) * // Insert numbers 1, 2 at position 1 * yarray.insert(1, [1, 2]) * * @param {number} index The index to insert content at. * @param {Array} content The array of content */ insert(index: number, content: Array): void; /** * Appends content to this YArray. * * @param {Array} content Array of content to append. * * @todo Use the following implementation in all types. */ push(content: Array): void; /** * Prepends content to this YArray. * * @param {Array} content Array of content to prepend. */ unshift(content: Array): void; /** * Deletes elements starting from an index. * * @param {number} index Index at which to start deleting elements * @param {number} length The number of elements to remove. Defaults to 1. */ delete(index: number, length?: number): void; /** * Returns the i-th element from a YArray. * * @param {number} index The index of the element to return from the YArray * @return {T} */ get(index: number): T; /** * Transforms this YArray to a JavaScript Array. * * @return {Array} */ toArray(): Array; /** * Returns a portion of this YArray into a JavaScript Array selected * from start to end (end not included). * * @param {number} [start] * @param {number} [end] * @return {Array} */ slice(start?: number | undefined, end?: number | undefined): Array; /** * Transforms this Shared Type to a JSON object. * * @return {Array} */ toJSON(): Array; /** * Returns an Array with the result of calling a provided function on every * element of this YArray. * * @template M * @param {function(T,number,YArray):M} f Function that produces an element of the new Array * @return {Array} A new array with each element being the result of the * callback function */ map(f: (arg0: T, arg1: number, arg2: YArray) => M): M[]; /** * Executes a provided function once on every element of this YArray. * * @param {function(T,number,YArray):void} f A function to execute on every element of this YArray. */ forEach(f: (arg0: T, arg1: number, arg2: YArray) => void): void; /** * @return {IterableIterator} */ [Symbol.iterator](): IterableIterator; } export function readYArray(_decoder: UpdateDecoderV1 | UpdateDecoderV2): YArray; import { YEvent } from "../utils/YEvent.js"; import { Transaction } from "../utils/Transaction.js"; import { AbstractType } from "./AbstractType.js"; import { ArraySearchMarker } from "./AbstractType.js"; import { Doc } from "../utils/Doc.js"; import { Item } from "../structs/Item.js"; import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js"; import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js"; //# sourceMappingURL=YArray.d.ts.map