Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

yjs

Package Overview
Dependencies
Maintainers
1
Versions
286
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yjs - npm Package Compare versions

Comparing version 13.5.27 to 13.5.28

2

dist/src/index.d.ts

@@ -1,1 +0,1 @@

export { Doc, Transaction, YArray as Array, YMap as Map, YText as Text, YXmlText as XmlText, YXmlHook as XmlHook, YXmlElement as XmlElement, YXmlFragment as XmlFragment, YXmlEvent, YMapEvent, YArrayEvent, YTextEvent, YEvent, Item, AbstractStruct, GC, ContentBinary, ContentDeleted, ContentEmbed, ContentFormat, ContentJSON, ContentAny, ContentString, ContentType, AbstractType, getTypeChildren, createRelativePositionFromTypeIndex, createRelativePositionFromJSON, createAbsolutePositionFromRelativePosition, compareRelativePositions, AbsolutePosition, RelativePosition, ID, createID, compareIDs, getState, Snapshot, createSnapshot, createDeleteSet, createDeleteSetFromStructStore, cleanupYTextFormatting, snapshot, emptySnapshot, findRootTypeKey, findIndexSS, getItem, typeListToArraySnapshot, typeMapGetSnapshot, createDocFromSnapshot, iterateDeletedStructs, applyUpdate, applyUpdateV2, readUpdate, readUpdateV2, encodeStateAsUpdate, encodeStateAsUpdateV2, encodeStateVector, UndoManager, decodeSnapshot, encodeSnapshot, decodeSnapshotV2, encodeSnapshotV2, decodeStateVector, logUpdate, logUpdateV2, relativePositionToJSON, isDeleted, isParentOf, equalSnapshots, PermanentUserData, tryGc, transact, AbstractConnector, logType, mergeUpdates, mergeUpdatesV2, parseUpdateMeta, parseUpdateMetaV2, encodeStateVectorFromUpdate, encodeStateVectorFromUpdateV2, encodeRelativePosition, decodeRelativePosition, diffUpdate, diffUpdateV2, convertUpdateFormatV1ToV2, convertUpdateFormatV2ToV1 } from "./internals.js";
export { Doc, Transaction, YArray as Array, YMap as Map, YText as Text, YXmlText as XmlText, YXmlHook as XmlHook, YXmlElement as XmlElement, YXmlFragment as XmlFragment, YXmlEvent, YMapEvent, YArrayEvent, YTextEvent, YEvent, Item, AbstractStruct, GC, ContentBinary, ContentDeleted, ContentEmbed, ContentFormat, ContentJSON, ContentAny, ContentString, ContentType, AbstractType, getTypeChildren, createRelativePositionFromTypeIndex, createRelativePositionFromJSON, createAbsolutePositionFromRelativePosition, compareRelativePositions, AbsolutePosition, RelativePosition, ID, createID, compareIDs, getState, Snapshot, createSnapshot, createDeleteSet, createDeleteSetFromStructStore, cleanupYTextFormatting, snapshot, emptySnapshot, findRootTypeKey, findIndexSS, getItem, typeListToArraySnapshot, typeMapGetSnapshot, createDocFromSnapshot, iterateDeletedStructs, applyUpdate, applyUpdateV2, readUpdate, readUpdateV2, encodeStateAsUpdate, encodeStateAsUpdateV2, encodeStateVector, UndoManager, decodeSnapshot, encodeSnapshot, decodeSnapshotV2, encodeSnapshotV2, decodeStateVector, logUpdate, logUpdateV2, decodeUpdate, decodeUpdateV2, relativePositionToJSON, isDeleted, isParentOf, equalSnapshots, PermanentUserData, tryGc, transact, AbstractConnector, logType, mergeUpdates, mergeUpdatesV2, parseUpdateMeta, parseUpdateMetaV2, encodeStateVectorFromUpdate, encodeStateVectorFromUpdateV2, encodeRelativePosition, decodeRelativePosition, diffUpdate, diffUpdateV2, convertUpdateFormatV1ToV2, convertUpdateFormatV2ToV1 } from "./internals.js";

@@ -18,5 +18,5 @@ /**

/**
* @param {AbstractType<YEvent>} type
* @param {AbstractType<any>} type
*/
constructor(type: AbstractType<YEvent>);
constructor(type: AbstractType<any>);
/**

@@ -84,2 +84,1 @@ * @type {AbstractType<any>}

import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js";
import { YEvent } from "../utils/YEvent.js";

@@ -8,2 +8,12 @@ export const structGCRefNumber: 0;

/**
* @param {GC} right
* @return {boolean}
*/
mergeWith(right: GC): boolean;
/**
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
* @param {number} offset
*/
write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number): void;
/**
* @param {Transaction} transaction

@@ -16,3 +26,5 @@ * @param {StructStore} store

import { AbstractStruct } from "./AbstractStruct.js";
import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js";
import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js";
import { Transaction } from "../utils/Transaction.js";
import { StructStore } from "../utils/StructStore.js";

@@ -86,2 +86,8 @@ export function followRedone(store: StructStore, id: ID): {

get countable(): boolean;
set deleted(arg: boolean);
/**
* Whether this item was deleted or not.
* @type {Boolean}
*/
get deleted(): boolean;
markDeleted(): void;

@@ -109,2 +115,9 @@ /**

/**
* Try to merge two items
*
* @param {Item} right
* @return {boolean}
*/
mergeWith(right: Item): boolean;
/**
* Mark this Item as deleted.

@@ -120,2 +133,12 @@ *

gc(store: StructStore, parentGCd: boolean): void;
/**
* Transform the properties of this type to binary and write it to an
* BinaryEncoder.
*
* This is called when this Item is sent to a remote peer.
*
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
* @param {number} offset
*/
write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number): void;
}

@@ -194,5 +217,5 @@ export function readItemContent(decoder: UpdateDecoderV1 | UpdateDecoderV2, info: number): AbstractContent;

import { AbstractType } from "../types/AbstractType.js";
import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js";
import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js";
import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js";
import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js";
import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js";
import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js";

@@ -8,2 +8,12 @@ export const structSkipRefNumber: 10;

/**
* @param {Skip} right
* @return {boolean}
*/
mergeWith(right: Skip): boolean;
/**
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
* @param {number} offset
*/
write(encoder: UpdateEncoderV1 | UpdateEncoderV2, offset: number): void;
/**
* @param {Transaction} transaction

@@ -16,3 +26,5 @@ * @param {StructStore} store

import { AbstractStruct } from "./AbstractStruct.js";
import { UpdateEncoderV1 } from "../utils/UpdateEncoder.js";
import { UpdateEncoderV2 } from "../utils/UpdateEncoder.js";
import { Transaction } from "../utils/Transaction.js";
import { StructStore } from "../utils/StructStore.js";

@@ -44,5 +44,5 @@ export class ArraySearchMarker {

* Deep event handlers
* @type {EventHandler<Array<YEvent>,Transaction>}
* @type {EventHandler<Array<YEvent<any>>,Transaction>}
*/
_dEH: EventHandler<Array<YEvent>, Transaction>;
_dEH: EventHandler<Array<YEvent<any>>, Transaction>;
/**

@@ -100,5 +100,5 @@ * @type {null | Array<ArraySearchMarker>}

*
* @param {function(Array<YEvent>,Transaction):void} f Observer function
* @param {function(Array<YEvent<any>>,Transaction):void} f Observer function
*/
observeDeep(f: (arg0: Array<YEvent>, arg1: Transaction) => void): void;
observeDeep(f: (arg0: Array<YEvent<any>>, arg1: Transaction) => void): void;
/**

@@ -113,5 +113,5 @@ * Unregister an observer function.

*
* @param {function(Array<YEvent>,Transaction):void} f Observer function
* @param {function(Array<YEvent<any>>,Transaction):void} f Observer function
*/
unobserveDeep(f: (arg0: Array<YEvent>, arg1: Transaction) => void): void;
unobserveDeep(f: (arg0: Array<YEvent<any>>, arg1: Transaction) => void): void;
/**

@@ -118,0 +118,0 @@ * @abstract

/**
* Event that describes the changes on a YArray
* @template T
* @extends YEvent<YArray<T>>
*/
export class YArrayEvent<T> extends YEvent {
export class YArrayEvent<T> extends YEvent<YArray<T>> {
/**

@@ -32,2 +33,22 @@ * @param {YArray<T>} yarray The changed type

private _prelimContent;
/**
* @type {Array<ArraySearchMarker>}
*/
_searchMarker: Array<ArraySearchMarker>;
/**
* 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;
_copy(): YArray<any>;
/**
* @return {YArray<T>}
*/
clone(): YArray<T>;
get length(): number;

@@ -94,2 +115,8 @@ /**

/**
* Transforms this Shared Type to a JSON object.
*
* @return {Array<any>}
*/
toJSON(): Array<any>;
/**
* Returns an Array with the result of calling a provided function on every

@@ -119,3 +146,6 @@ * element of this YArray.

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";
/**
* @template T
* @extends YEvent<YMap<T>>
* Event that describes the changes on a YMap.
*/
export class YMapEvent<T> extends YEvent {
export class YMapEvent<T> extends YEvent<YMap<T>> {
/**

@@ -33,2 +34,26 @@ * @param {YMap<T>} ymap The YArray that changed.

/**
* 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;
_copy(): YMap<any>;
/**
* @return {YMap<MapType>}
*/
clone(): YMap<MapType>;
/**
* Transforms this Shared Type to a JSON object.
*
* @return {Object<string,any>}
*/
toJSON(): {
[x: string]: any;
};
/**
* Returns the size of the YMap (count of key/value pairs)

@@ -105,3 +130,5 @@ *

import { AbstractType } 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";

@@ -45,5 +45,6 @@ export class ItemTextListPosition {

/**
* @extends YEvent<YText>
* Event that describes the changes on a YText type.
*/
export class YTextEvent extends YEvent {
export class YTextEvent extends YEvent<YText> {
/**

@@ -66,2 +67,18 @@ * @param {YText} ytext

keysChanged: Set<string>;
/**
* Compute the changes in the delta format.
* A {@link https://quilljs.com/docs/delta/|Quill Delta}) that represents the changes on the document.
*
* @type {Array<{insert?:string|object|AbstractType<any>, delete?:number, retain?:number, attributes?: Object<string,any>}>}
*
* @public
*/
public get delta(): {
insert?: string | object | AbstractType<any> | undefined;
delete?: number | undefined;
retain?: number | undefined;
attributes?: {
[x: string]: any;
} | undefined;
}[];
}

@@ -88,2 +105,6 @@ /**

/**
* @type {Array<ArraySearchMarker>}
*/
_searchMarker: Array<ArraySearchMarker>;
/**
* Number of characters of this text type.

@@ -95,2 +116,19 @@ *

/**
* @param {Doc} y
* @param {Item} item
*/
_integrate(y: Doc, item: Item): void;
_copy(): YText;
/**
* @return {YText}
*/
clone(): YText;
/**
* Returns the unformatted string representation of this YText type.
*
* @return {string}
* @public
*/
public toJSON(): string;
/**
* Apply a {@link Delta} on this shared YText type.

@@ -215,4 +253,6 @@ *

import { YEvent } from "../utils/YEvent.js";
import { AbstractType } from "./AbstractType.js";
import { Transaction } from "../utils/Transaction.js";
import { AbstractType } from "./AbstractType.js";
import { ArraySearchMarker } from "./AbstractType.js";
import { Doc } from "../utils/Doc.js";
import { Snapshot } from "../utils/Snapshot.js";

@@ -219,0 +259,0 @@ import { ID } from "../utils/ID.js";

@@ -24,2 +24,12 @@ /**

/**
* Creates an Item with the same effect as this Item (without position effect)
*
* @return {YXmlElement}
*/
_copy(): YXmlElement;
/**
* @return {YXmlElement}
*/
clone(): YXmlElement;
/**
* Removes an attribute from this YXmlElement.

@@ -26,0 +36,0 @@ *

/**
* @extends YEvent<YXmlElement|YXmlText|YXmlFragment>
* An Event that describes changes on a YXml Element or Yxml Fragment
*/
export class YXmlEvent extends YEvent {
export class YXmlEvent extends YEvent<YXmlFragment | YXmlElement | YXmlText> {
/**

@@ -25,6 +26,6 @@ * @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created.

}
import { YEvent } from "../utils/YEvent.js";
import { YXmlFragment } from "./YXmlFragment.js";
import { YXmlElement } from "./YXmlElement.js";
import { YXmlText } from "./YXmlText.js";
import { YXmlFragment } from "./YXmlFragment.js";
import { YEvent } from "../utils/YEvent.js";
import { Transaction } from "../utils/Transaction.js";

@@ -71,2 +71,18 @@ /**

get firstChild(): YXmlElement | YXmlText | null;
/**
* 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;
_copy(): YXmlFragment;
/**
* @return {YXmlFragment}
*/
clone(): YXmlFragment;
get length(): number;

@@ -120,2 +136,6 @@ /**

/**
* @return {string}
*/
toJSON(): string;
/**
* Creates a Dom Element that mirrors this YXmlElement.

@@ -204,3 +224,3 @@ *

* Define the elements to which a set of CSS queries apply.
* {@link https ://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors|CSS_Selectors}
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors|CSS_Selectors}
*/

@@ -218,3 +238,4 @@ export type CSS_Selector = string;

import { YXmlEvent } from "./YXmlEvent.js";
import { Doc } from "../utils/Doc.js";
import { UpdateDecoderV1 } from "../utils/UpdateDecoder.js";
import { UpdateDecoderV2 } from "../utils/UpdateDecoder.js";

@@ -16,2 +16,10 @@ /**

/**
* Creates an Item with the same effect as this Item (without position effect)
*/
_copy(): YXmlHook;
/**
* @return {YXmlHook}
*/
clone(): YXmlHook;
/**
* Creates a Dom Element that mirrors this YXmlElement.

@@ -18,0 +26,0 @@ *

@@ -14,3 +14,8 @@ /**

get prevSibling(): YXmlElement | YXmlText | null;
_copy(): YXmlText;
/**
* @return {YXmlText}
*/
clone(): YXmlText;
/**
* Creates a Dom Element that mirrors this YXmlText.

@@ -33,2 +38,3 @@ *

} | undefined, binding?: any): Text;
toString(): any;
}

@@ -35,0 +41,0 @@ export function readYXmlText(decoder: UpdateDecoderV1 | UpdateDecoderV2): YXmlText;

@@ -27,5 +27,5 @@ export const generateNewClientId: typeof random.uint32;

/**
* @type {Map<string, AbstractType<YEvent>>}
* @type {Map<string, AbstractType<YEvent<any>>>}
*/
share: Map<string, AbstractType<YEvent>>;
share: Map<string, AbstractType<YEvent<any>>>;
store: StructStore;

@@ -144,2 +144,7 @@ /**

};
/**
* @param {string} eventName
* @param {function(...any):any} f
*/
on(eventName: string, f: (...args: any[]) => any): void;
}

@@ -146,0 +151,0 @@ export type DocOpts = {

@@ -24,8 +24,3 @@ export class StructStore {

export function find(store: StructStore, id: ID): GC | Item;
/**
* Expects that id is actually in store. This function throws or is an infinite loop otherwise.
* @private
* @function
*/
export const getItem: (arg0: StructStore, arg1: ID) => Item;
export function getItem(arg0: StructStore, arg1: ID): Item;
export function findIndexCleanStart(transaction: Transaction, structs: Array<Item | GC>, clock: number): number;

@@ -32,0 +27,0 @@ export function getItemCleanStart(transaction: Transaction, id: ID): Item;

@@ -56,11 +56,11 @@ /**

* Maps from type to parentSubs (`item.parentSub = null` for YArray)
* @type {Map<AbstractType<YEvent>,Set<String|null>>}
* @type {Map<AbstractType<YEvent<any>>,Set<String|null>>}
*/
changed: Map<AbstractType<YEvent>, Set<string | null>>;
changed: Map<AbstractType<YEvent<any>>, Set<string | null>>;
/**
* Stores the events for the types that observe also child elements.
* It is mainly used by `observeDeep`.
* @type {Map<AbstractType<YEvent>,Array<YEvent>>}
* @type {Map<AbstractType<YEvent<any>>,Array<YEvent<any>>>}
*/
changedParentTypes: Map<AbstractType<YEvent>, Array<YEvent>>;
changedParentTypes: Map<AbstractType<YEvent<any>>, Array<YEvent<any>>>;
/**

@@ -99,3 +99,3 @@ * @type {Array<AbstractStruct>}

export function nextID(transaction: Transaction): import("./ID.js").ID;
export function addChangedTypeToTransaction(transaction: Transaction, type: AbstractType<YEvent>, parentSub: string | null): void;
export function addChangedTypeToTransaction(transaction: Transaction, type: AbstractType<YEvent<any>>, parentSub: string | null): void;
export function tryGc(ds: DeleteSet, store: StructStore, gcFilter: (arg0: Item) => boolean): void;

@@ -102,0 +102,0 @@ export function transact(doc: Doc, f: (arg0: Transaction) => void, origin?: any, local?: boolean): void;

@@ -21,2 +21,10 @@ export class LazyStructReader {

export function logUpdateV2(update: Uint8Array, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2 | undefined): void;
export function decodeUpdate(update: Uint8Array): {
structs: (GC | Item | Skip)[];
ds: import("./DeleteSet.js").DeleteSet;
};
export function decodeUpdateV2(update: Uint8Array, YDecoder?: typeof UpdateDecoderV1 | typeof UpdateDecoderV2 | undefined): {
structs: (GC | Item | Skip)[];
ds: import("./DeleteSet.js").DeleteSet;
};
export class LazyStructWriter {

@@ -23,0 +31,0 @@ /**

/**
* @template {AbstractType<any>} T
* YEvent describes the changes on a YType.
*/
export class YEvent {
export class YEvent<T extends AbstractType<any>> {
/**
* @param {AbstractType<any>} target The changed type.
* @param {T} target The changed type.
* @param {Transaction} transaction
*/
constructor(target: AbstractType<any>, transaction: Transaction);
constructor(target: T, transaction: Transaction);
/**
* The type on which this event was created on.
* @type {AbstractType<any>}
* @type {T}
*/
target: AbstractType<any>;
target: T;
/**

@@ -16,0 +17,0 @@ * The current target on which the observe callback is called.

{
"name": "yjs",
"version": "13.5.27",
"version": "13.5.28",
"description": "Shared Editing Library",

@@ -5,0 +5,0 @@ "main": "./dist/yjs.cjs",

@@ -28,26 +28,12 @@

## Sponsors
## Sponsorship
I'm currently looking for sponsors that allow me to be less dependent on
contracting work. These awesome backers already fund further development of
Yjs:
Please contribute to the project financially if your company relies on Yjs.
Support the project and receive more attention on your tickets.
[![Become a Sponsor](https://img.shields.io/static/v1?label=Become%20a%20Sponsor&message=%E2%9D%A4&logo=GitHub&style=flat&color=d42f2d)](https://github.com/sponsors/dmonad)
[![davidhq](https://github.com/davidhq.png?size=60)](https://github.com/davidhq)
[![Ifiok Jr.](https://github.com/ifiokjr.png?size=60)](https://github.com/ifiokjr)
[![Burke Libbey](https://github.com/burke.png?size=60)](https://github.com/burke)
[![Beni Cherniavsky-Paskin](https://github.com/cben.png?size=60)](https://github.com/cben)
[![Tom Moor](https://github.com/tommoor.png?size=60)](https://github.com/tommoor)
[![Michael Meyers](https://github.com/michaelemeyers.png?size=60)](https://github.com/michaelemeyers)
[![Cristiano Benjamin](https://github.com/csbenjamin.png?size=60)](https://github.com/csbenjamin)
[![Braden](https://github.com/AdventureBeard.png?size=60)](https://github.com/AdventureBeard)
[![nimbuswebinc](https://nimbusweb.me/new-style-img/note-icon.svg)](https://github.com/nimbuswebinc)
[![JourneyApps](https://github.com/journeyapps.png?size=60)](https://github.com/journeyapps)
[![Adam Brunnmeier](https://github.com/adabru.png?size=60)](https://github.com/adabru)
[![Nathanael Anderson](https://github.com/NathanaelA.png?size=60)](https://github.com/NathanaelA)
[<img src="https://room.sh/img/icons/android-chrome-192x192.png" height="60px" />](https://room.sh/)
Sponsorship also comes with special perks! [![Become a Sponsor](https://img.shields.io/static/v1?label=Become%20a%20Sponsor&message=%E2%9D%A4&logo=GitHub&style=flat&color=d42f2d)](https://github.com/sponsors/dmonad)
## Who is using Yjs
* [PRSM](https://prsm.uk/) Collaborative mind-mapping and system visualisation. *[(source)](https://github.com/micrology/prsm)*
* [Dynaboard](https://dynaboard.com/) Build web apps collaboratively. :star2:
* [Serenity Notes](https://www.serenity.re/en/notes) End-to-end encrypted

@@ -64,3 +50,3 @@ collaborative notes app.

* [Pluxbox RadioManager](https://getradiomanager.com/) A web-based app to
collaboratively organize radio broadcasts.
collaboratively organize radio broadcasts. :star:
* [Alldone](https://alldone.app/) A next-gen project management and

@@ -67,0 +53,0 @@ collaboration platform.

@@ -70,2 +70,4 @@ /** eslint-env browser */

logUpdateV2,
decodeUpdate,
decodeUpdateV2,
relativePositionToJSON,

@@ -72,0 +74,0 @@ isDeleted,

@@ -42,3 +42,3 @@

/**
* @param {AbstractType<YEvent>} type
* @param {AbstractType<any>} type
*/

@@ -45,0 +45,0 @@ constructor (type) {

@@ -281,3 +281,3 @@

* Deep event handlers
* @type {EventHandler<Array<YEvent>,Transaction>}
* @type {EventHandler<Array<YEvent<any>>,Transaction>}
*/

@@ -368,3 +368,3 @@ this._dEH = createEventHandler()

*
* @param {function(Array<YEvent>,Transaction):void} f Observer function
* @param {function(Array<YEvent<any>>,Transaction):void} f Observer function
*/

@@ -387,3 +387,3 @@ observeDeep (f) {

*
* @param {function(Array<YEvent>,Transaction):void} f Observer function
* @param {function(Array<YEvent<any>>,Transaction):void} f Observer function
*/

@@ -390,0 +390,0 @@ unobserveDeep (f) {

@@ -26,2 +26,3 @@ /**

* @template T
* @extends YEvent<YArray<T>>
*/

@@ -28,0 +29,0 @@ export class YArrayEvent extends YEvent {

@@ -24,2 +24,3 @@

* @template T
* @extends YEvent<YMap<T>>
* Event that describes the changes on a YMap.

@@ -26,0 +27,0 @@ */

@@ -294,3 +294,4 @@

// delete all formats with attributes[format.key] != null
while (length > 0 && currPos.right !== null) {
// also check the attributes after the first non-format as we do not want to insert redundant negated attributes there
while (currPos.right !== null && (length > 0 || currPos.right.content.constructor === ContentFormat)) {
if (!currPos.right.deleted) {

@@ -515,2 +516,3 @@ switch (currPos.right.content.constructor) {

/**
* @extends YEvent<YText>
* Event that describes the changes on a YText type.

@@ -517,0 +519,0 @@ */

@@ -8,2 +8,3 @@

/**
* @extends YEvent<YXmlElement|YXmlText|YXmlFragment>
* An Event that describes changes on a YXml Element or Yxml Fragment

@@ -10,0 +11,0 @@ */

@@ -51,3 +51,3 @@ /**

/**
* @type {Map<string, AbstractType<YEvent>>}
* @type {Map<string, AbstractType<YEvent<any>>>}
*/

@@ -54,0 +54,0 @@ this.share = new Map()

@@ -78,3 +78,3 @@

* Maps from type to parentSubs (`item.parentSub = null` for YArray)
* @type {Map<AbstractType<YEvent>,Set<String|null>>}
* @type {Map<AbstractType<YEvent<any>>,Set<String|null>>}
*/

@@ -85,3 +85,3 @@ this.changed = new Map()

* It is mainly used by `observeDeep`.
* @type {Map<AbstractType<YEvent>,Array<YEvent>>}
* @type {Map<AbstractType<YEvent<any>>,Array<YEvent<any>>>}
*/

@@ -153,3 +153,3 @@ this.changedParentTypes = new Map()

* @param {Transaction} transaction
* @param {AbstractType<YEvent>} type
* @param {AbstractType<YEvent<any>>} type
* @param {string|null} parentSub

@@ -156,0 +156,0 @@ */

@@ -115,2 +115,26 @@

/**
* @param {Uint8Array} update
*
*/
export const decodeUpdate = (update) => decodeUpdateV2(update, UpdateDecoderV1)
/**
* @param {Uint8Array} update
* @param {typeof UpdateDecoderV2 | typeof UpdateDecoderV1} [YDecoder]
*
*/
export const decodeUpdateV2 = (update, YDecoder = UpdateDecoderV2) => {
const structs = []
const updateDecoder = new UpdateDecoderV1(decoding.createDecoder(update))
const lazyDecoder = new LazyStructReader(updateDecoder, false)
for (let curr = lazyDecoder.curr; curr !== null; curr = lazyDecoder.next()) {
structs.push(curr)
}
return {
structs,
ds: readDeleteSet(updateDecoder)
}
}
export class LazyStructWriter {

@@ -117,0 +141,0 @@ /**

@@ -11,2 +11,3 @@

/**
* @template {AbstractType<any>} T
* YEvent describes the changes on a YType.

@@ -16,3 +17,3 @@ */

/**
* @param {AbstractType<any>} target The changed type.
* @param {T} target The changed type.
* @param {Transaction} transaction

@@ -23,3 +24,3 @@ */

* The type on which this event was created on.
* @type {AbstractType<any>}
* @type {T}
*/

@@ -26,0 +27,0 @@ this.target = target

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc