Comparing version 0.2.1 to 0.4.0
@@ -8,3 +8,3 @@ { | ||
"description": "High performance implementation of the Yjs CRDT", | ||
"version": "0.2.1", | ||
"version": "0.4.0", | ||
"license": "MIT", | ||
@@ -11,0 +11,0 @@ "repository": { |
294
ywasm.d.ts
@@ -210,5 +210,5 @@ /* tslint:disable */ | ||
* @param {Function} f | ||
* @returns {YObserver} | ||
* @returns {YArrayObserver} | ||
*/ | ||
observe(f: Function): YObserver; | ||
observe(f: Function): YArrayObserver; | ||
/** | ||
@@ -230,3 +230,30 @@ * Returns a number of elements stored within this instance of `YArray`. | ||
/** | ||
* Event generated by `YArray.observe` method. Emitted during transaction commit phase. | ||
*/ | ||
export class YArrayEvent { | ||
free(): void; | ||
/** | ||
* Returns an array of keys and indexes creating a path from root type down to current instance | ||
* of shared type (accessible via `target` getter). | ||
* @returns {any} | ||
*/ | ||
path(): any; | ||
/** | ||
* Returns a list of text changes made over corresponding `YArray` collection within | ||
* bounds of current transaction. These changes follow a format: | ||
* | ||
* - { insert: any[] } | ||
* - { delete: number } | ||
* - { retain: number } | ||
* @returns {any} | ||
*/ | ||
readonly delta: any; | ||
/** | ||
* Returns a current shared type instance, that current event changes refer to. | ||
* @returns {any} | ||
*/ | ||
readonly target: any; | ||
} | ||
/** | ||
*/ | ||
export class YArrayIterator { | ||
@@ -240,2 +267,7 @@ free(): void; | ||
/** | ||
*/ | ||
export class YArrayObserver { | ||
free(): void; | ||
} | ||
/** | ||
* A ywasm document type. Documents are most important units of collaborative resources management. | ||
@@ -373,36 +405,2 @@ * All shared collections live within a scope of their corresponding documents. All updates are | ||
/** | ||
* An event send to shared type's callbacks subscribed via `observe` methods. It's triggered once | ||
* transaction is being committed. | ||
*/ | ||
export class YEvent { | ||
free(): void; | ||
/** | ||
* Returns an array of keys and indexes creating a path from root type down to current instance | ||
* of shared type (accessible via `target` getter). | ||
* @returns {any} | ||
*/ | ||
path(): any; | ||
/** | ||
* Returns collection of all changes done over an array component of a current shared data | ||
* type (which can be accessed via `target` property). These changes are usually done in result | ||
* of operations done on `YArray` and `YText`/`XmlText` types, but also whenever `XmlElement` | ||
* children nodes list is modified. | ||
* @returns {any} | ||
*/ | ||
readonly delta: any; | ||
/** | ||
* Returns all changes done upon map component of a current shared data type (which can be | ||
* accessed via `target`) within a bounds of corresponding transaction `txn`. These | ||
* changes are done in result of operations made on `YMap` data type or attribute changes of | ||
* `YXmlElement` and `YXmlText` types. | ||
* @returns {any} | ||
*/ | ||
readonly keys: any; | ||
/** | ||
* Returns a current shared type instance, that current event changes refer to. | ||
* @returns {any} | ||
*/ | ||
readonly target: any; | ||
} | ||
/** | ||
* Collection used to store key-value entries in an unordered manner. Keys are always represented | ||
@@ -496,5 +494,5 @@ * as UTF-8 strings. Values can be any value type supported by Yrs: JSON-like primitives as well as | ||
* @param {Function} f | ||
* @returns {YObserver} | ||
* @returns {YMapObserver} | ||
*/ | ||
observe(f: Function): YObserver; | ||
observe(f: Function): YMapObserver; | ||
/** | ||
@@ -511,3 +509,28 @@ * Returns true if this is a preliminary instance of `YMap`. | ||
/** | ||
* Event generated by `YMap.observe` method. Emitted during transaction commit phase. | ||
*/ | ||
export class YMapEvent { | ||
free(): void; | ||
/** | ||
* Returns an array of keys and indexes creating a path from root type down to current instance | ||
* of shared type (accessible via `target` getter). | ||
* @returns {any} | ||
*/ | ||
path(): any; | ||
/** | ||
* Returns a list of key-value changes made over corresponding `YMap` collection within | ||
* bounds of current transaction. These changes follow a format: | ||
* | ||
* - { action: 'add'|'update'|'delete', oldValue: any|undefined, newValue: any|undefined } | ||
* @returns {any} | ||
*/ | ||
readonly keys: any; | ||
/** | ||
* Returns a current shared type instance, that current event changes refer to. | ||
* @returns {any} | ||
*/ | ||
readonly target: any; | ||
} | ||
/** | ||
*/ | ||
export class YMapIterator { | ||
@@ -522,3 +545,3 @@ free(): void; | ||
*/ | ||
export class YObserver { | ||
export class YMapObserver { | ||
free(): void; | ||
@@ -567,13 +590,45 @@ } | ||
* Inserts a given `chunk` of text into this `YText` instance, starting at a given `index`. | ||
* | ||
* Optional object with defined `attributes` will be used to wrap provided text `chunk` | ||
* with a formatting blocks.`attributes` are only supported for a `YText` instance which | ||
* already has been integrated into document store. | ||
* @param {YTransaction} txn | ||
* @param {number} index | ||
* @param {string} chunk | ||
* @param {any} attributes | ||
*/ | ||
insert(txn: YTransaction, index: number, chunk: string): void; | ||
insert(txn: YTransaction, index: number, chunk: string, attributes: any): void; | ||
/** | ||
* Inserts a given `embed` object into this `YText` instance, starting at a given `index`. | ||
* | ||
* Optional object with defined `attributes` will be used to wrap provided `embed` | ||
* with a formatting blocks.`attributes` are only supported for a `YText` instance which | ||
* already has been integrated into document store. | ||
* @param {YTransaction} txn | ||
* @param {number} index | ||
* @param {any} embed | ||
* @param {any} attributes | ||
*/ | ||
insertEmbed(txn: YTransaction, index: number, embed: any, attributes: any): void; | ||
/** | ||
* Wraps an existing piece of text within a range described by `index`-`length` parameters with | ||
* formatting blocks containing provided `attributes` metadata. This method only works for | ||
* `YText` instances that already have been integrated into document store. | ||
* @param {YTransaction} txn | ||
* @param {number} index | ||
* @param {number} length | ||
* @param {any} attributes | ||
*/ | ||
format(txn: YTransaction, index: number, length: number, attributes: any): void; | ||
/** | ||
* Appends a given `chunk` of text at the end of current `YText` instance. | ||
* | ||
* Optional object with defined `attributes` will be used to wrap provided text `chunk` | ||
* with a formatting blocks.`attributes` are only supported for a `YText` instance which | ||
* already has been integrated into document store. | ||
* @param {YTransaction} txn | ||
* @param {string} chunk | ||
* @param {any} attributes | ||
*/ | ||
push(txn: YTransaction, chunk: string): void; | ||
push(txn: YTransaction, chunk: string, attributes: any): void; | ||
/** | ||
@@ -592,5 +647,5 @@ * Deletes a specified range of of characters, starting at a given `index`. | ||
* @param {Function} f | ||
* @returns {YObserver} | ||
* @returns {YTextObserver} | ||
*/ | ||
observe(f: Function): YObserver; | ||
observe(f: Function): YTextObserver; | ||
/** | ||
@@ -613,2 +668,34 @@ * Returns length of an underlying string stored in this `YText` instance, | ||
/** | ||
* Event generated by `YYText.observe` method. Emitted during transaction commit phase. | ||
*/ | ||
export class YTextEvent { | ||
free(): void; | ||
/** | ||
* Returns an array of keys and indexes creating a path from root type down to current instance | ||
* of shared type (accessible via `target` getter). | ||
* @returns {any} | ||
*/ | ||
path(): any; | ||
/** | ||
* Returns a list of text changes made over corresponding `YText` collection within | ||
* bounds of current transaction. These changes follow a format: | ||
* | ||
* - { insert: string, attributes: any|undefined } | ||
* - { delete: number } | ||
* - { retain: number, attributes: any|undefined } | ||
* @returns {any} | ||
*/ | ||
readonly delta: any; | ||
/** | ||
* Returns a current shared type instance, that current event changes refer to. | ||
* @returns {any} | ||
*/ | ||
readonly target: any; | ||
} | ||
/** | ||
*/ | ||
export class YTextObserver { | ||
free(): void; | ||
} | ||
/** | ||
* A transaction that serves as a proxy to document block store. Ywasm shared data types execute | ||
@@ -951,5 +1038,5 @@ * their operations in a context of a given transaction. Each document can have only one active | ||
* @param {Function} f | ||
* @returns {YObserver} | ||
* @returns {YXmlObserver} | ||
*/ | ||
observe(f: Function): YObserver; | ||
observe(f: Function): YXmlObserver; | ||
/** | ||
@@ -962,2 +1049,42 @@ * Returns a tag name of this XML node. | ||
/** | ||
* Event generated by `YXmlElement.observe` method. Emitted during transaction commit phase. | ||
*/ | ||
export class YXmlEvent { | ||
free(): void; | ||
/** | ||
* Returns an array of keys and indexes creating a path from root type down to current instance | ||
* of shared type (accessible via `target` getter). | ||
* @returns {any} | ||
*/ | ||
path(): any; | ||
/** | ||
* Returns a list of XML child node changes made over corresponding `YXmlElement` collection | ||
* within bounds of current transaction. These changes follow a format: | ||
* | ||
* - { insert: (YXmlText|YXmlElement)[] } | ||
* - { delete: number } | ||
* - { retain: number } | ||
* @returns {any} | ||
*/ | ||
readonly delta: any; | ||
/** | ||
* Returns a list of attribute changes made over corresponding `YXmlText` collection within | ||
* bounds of current transaction. These changes follow a format: | ||
* | ||
* - { action: 'add'|'update'|'delete', oldValue: string|undefined, newValue: string|undefined } | ||
* @returns {any} | ||
*/ | ||
readonly keys: any; | ||
/** | ||
* Returns a current shared type instance, that current event changes refer to. | ||
* @returns {any} | ||
*/ | ||
readonly target: any; | ||
} | ||
/** | ||
*/ | ||
export class YXmlObserver { | ||
free(): void; | ||
} | ||
/** | ||
* A shared data type used for collaborative text editing, that can be used in a context of | ||
@@ -984,13 +1111,42 @@ * `YXmlElement` nodee. It enables multiple users to add and remove chunks of text in efficient | ||
* Inserts a given `chunk` of text into this `YXmlText` instance, starting at a given `index`. | ||
* | ||
* Optional object with defined `attributes` will be used to wrap provided text `chunk` | ||
* with a formatting blocks. | ||
* @param {YTransaction} txn | ||
* @param {number} index | ||
* @param {string} chunk | ||
* @param {any} attrs | ||
*/ | ||
insert(txn: YTransaction, index: number, chunk: string): void; | ||
insert(txn: YTransaction, index: number, chunk: string, attrs: any): void; | ||
/** | ||
* Formats text within bounds specified by `index` and `len` with a given formatting | ||
* attributes. | ||
* @param {YTransaction} txn | ||
* @param {number} index | ||
* @param {number} len | ||
* @param {any} attrs | ||
*/ | ||
format(txn: YTransaction, index: number, len: number, attrs: any): void; | ||
/** | ||
* Inserts a given `embed` object into this `YXmlText` instance, starting at a given `index`. | ||
* | ||
* Optional object with defined `attributes` will be used to wrap provided `embed` | ||
* with a formatting blocks.`attributes` are only supported for a `YXmlText` instance which | ||
* already has been integrated into document store. | ||
* @param {YTransaction} txn | ||
* @param {number} index | ||
* @param {any} embed | ||
* @param {any} attributes | ||
*/ | ||
insertEmbed(txn: YTransaction, index: number, embed: any, attributes: any): void; | ||
/** | ||
* Appends a given `chunk` of text at the end of `YXmlText` instance. | ||
* | ||
* Optional object with defined `attributes` will be used to wrap provided text `chunk` | ||
* with a formatting blocks. | ||
* @param {YTransaction} txn | ||
* @param {string} chunk | ||
* @param {any} attrs | ||
*/ | ||
push(txn: YTransaction, chunk: string): void; | ||
push(txn: YTransaction, chunk: string, attrs: any): void; | ||
/** | ||
@@ -1066,5 +1222,5 @@ * Deletes a specified range of of characters, starting at a given `index`. | ||
* @param {Function} f | ||
* @returns {YObserver} | ||
* @returns {YXmlTextObserver} | ||
*/ | ||
observe(f: Function): YObserver; | ||
observe(f: Function): YXmlTextObserver; | ||
/** | ||
@@ -1078,3 +1234,43 @@ * Returns length of an underlying string stored in this `YXmlText` instance, | ||
/** | ||
* Event generated by `YXmlText.observe` method. Emitted during transaction commit phase. | ||
*/ | ||
export class YXmlTextEvent { | ||
free(): void; | ||
/** | ||
* Returns an array of keys and indexes creating a path from root type down to current instance | ||
* of shared type (accessible via `target` getter). | ||
* @returns {any} | ||
*/ | ||
path(): any; | ||
/** | ||
* Returns a list of text changes made over corresponding `YXmlText` collection within | ||
* bounds of current transaction. These changes follow a format: | ||
* | ||
* - { insert: string, attributes: any|undefined } | ||
* - { delete: number } | ||
* - { retain: number, attributes: any|undefined } | ||
* @returns {any} | ||
*/ | ||
readonly delta: any; | ||
/** | ||
* Returns a list of attribute changes made over corresponding `YXmlText` collection within | ||
* bounds of current transaction. These changes follow a format: | ||
* | ||
* - { action: 'add'|'update'|'delete', oldValue: string|undefined, newValue: string|undefined } | ||
* @returns {any} | ||
*/ | ||
readonly keys: any; | ||
/** | ||
* Returns a current shared type instance, that current event changes refer to. | ||
* @returns {any} | ||
*/ | ||
readonly target: any; | ||
} | ||
/** | ||
*/ | ||
export class YXmlTextObserver { | ||
free(): void; | ||
} | ||
/** | ||
*/ | ||
export class YXmlTreeWalker { | ||
@@ -1081,0 +1277,0 @@ free(): void; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
709067
3863