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.6.12 to 13.6.13

6

dist/src/utils/AbstractConnector.d.ts

@@ -7,5 +7,5 @@ /**

*
* @extends {Observable<any>}
* @extends {ObservableV2<any>}
*/
export class AbstractConnector extends Observable<any> {
export class AbstractConnector extends ObservableV2<any> {
/**

@@ -19,4 +19,4 @@ * @param {Doc} ydoc

}
import { Observable } from "lib0/observable";
import { ObservableV2 } from "lib0/observable";
import { Doc } from "./Doc.js";
//# sourceMappingURL=AbstractConnector.d.ts.map

@@ -13,6 +13,21 @@ export const generateNewClientId: typeof random.uint32;

/**
* @typedef {Object} DocEvents
* @property {function(Doc):void} DocEvents.destroy
* @property {function(Doc):void} DocEvents.load
* @property {function(boolean, Doc):void} DocEvents.sync
* @property {function(Uint8Array, any, Doc, Transaction):void} DocEvents.update
* @property {function(Uint8Array, any, Doc, Transaction):void} DocEvents.updateV2
* @property {function(Doc):void} DocEvents.beforeAllTransactions
* @property {function(Transaction, Doc):void} DocEvents.beforeTransaction
* @property {function(Transaction, Doc):void} DocEvents.beforeObserverCalls
* @property {function(Transaction, Doc):void} DocEvents.afterTransaction
* @property {function(Transaction, Doc):void} DocEvents.afterTransactionCleanup
* @property {function(Doc, Array<Transaction>):void} DocEvents.afterAllTransactions
* @property {function({ loaded: Set<Doc>, added: Set<Doc>, removed: Set<Doc> }, Doc, Transaction):void} DocEvents.subdocs
*/
/**
* A Yjs instance handles the state of shared data.
* @extends Observable<string>
* @extends ObservableV2<DocEvents>
*/
export class Doc extends Observable<string> {
export class Doc extends ObservableV2<DocEvents> {
/**

@@ -174,7 +189,2 @@ * @param {DocOpts} opts configuration

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

@@ -211,4 +221,22 @@ export type DocOpts = {

};
export type DocEvents = {
destroy: (arg0: Doc) => void;
load: (arg0: Doc) => void;
sync: (arg0: boolean, arg1: Doc) => void;
update: (arg0: Uint8Array, arg1: any, arg2: Doc, arg3: Transaction) => void;
updateV2: (arg0: Uint8Array, arg1: any, arg2: Doc, arg3: Transaction) => void;
beforeAllTransactions: (arg0: Doc) => void;
beforeTransaction: (arg0: Transaction, arg1: Doc) => void;
beforeObserverCalls: (arg0: Transaction, arg1: Doc) => void;
afterTransaction: (arg0: Transaction, arg1: Doc) => void;
afterTransactionCleanup: (arg0: Transaction, arg1: Doc) => void;
afterAllTransactions: (arg0: Doc, arg1: Array<Transaction>) => void;
subdocs: (arg0: {
loaded: Set<Doc>;
added: Set<Doc>;
removed: Set<Doc>;
}, arg1: Doc, arg2: Transaction) => void;
};
import * as random from "lib0/random";
import { Observable } from "lib0/observable";
import { ObservableV2 } from "lib0/observable";
import { Item } from "../structs/Item.js";

@@ -215,0 +243,0 @@ import { AbstractType } from "../types/AbstractType.js";

@@ -27,2 +27,9 @@ export class StackItem {

/**
* @typedef {Object} StackItemEvent
* @property {StackItem} StackItemEvent.stackItem
* @property {any} StackItemEvent.origin
* @property {'undo'|'redo'} StackItemEvent.type
* @property {Map<AbstractType<YEvent<any>>,Array<YEvent<any>>>} StackItemEvent.changedParentTypes
*/
/**
* Fires 'stack-item-added' event when a stack item was added to either the undo- or

@@ -34,5 +41,13 @@ * the redo-stack. You may store additional stack information via the

*
* @extends {Observable<'stack-item-added'|'stack-item-popped'|'stack-cleared'|'stack-item-updated'>}
* @extends {ObservableV2<{'stack-item-added':function(StackItemEvent, UndoManager):void, 'stack-item-popped': function(StackItemEvent, UndoManager):void, 'stack-cleared': function({ undoStackCleared: boolean, redoStackCleared: boolean }):void, 'stack-item-updated': function(StackItemEvent, UndoManager):void }>}
*/
export class UndoManager extends Observable<"stack-item-added" | "stack-item-popped" | "stack-cleared" | "stack-item-updated"> {
export class UndoManager extends ObservableV2<{
'stack-item-added': (arg0: StackItemEvent, arg1: UndoManager) => void;
'stack-item-popped': (arg0: StackItemEvent, arg1: UndoManager) => void;
'stack-cleared': (arg0: {
undoStackCleared: boolean;
redoStackCleared: boolean;
}) => void;
'stack-item-updated': (arg0: StackItemEvent, arg1: UndoManager) => void;
}> {
/**

@@ -66,2 +81,8 @@ * @param {AbstractType<any>|Array<AbstractType<any>>} typeScope Accepts either a single type, or an array of types

redoing: boolean;
/**
* The currently popped stack item if UndoManager.undoing or UndoManager.redoing
*
* @type {StackItem|null}
*/
currStackItem: StackItem | null;
lastChange: number;

@@ -156,4 +177,10 @@ ignoreRemoteMapChanges: boolean;

};
export type StackItemEvent = {
stackItem: StackItem;
origin: any;
type: 'undo' | 'redo';
changedParentTypes: Map<AbstractType<YEvent<any>>, Array<YEvent<any>>>;
};
import { DeleteSet } from "./DeleteSet.js";
import { Observable } from "lib0/observable";
import { ObservableV2 } from "lib0/observable";
import { AbstractType } from "../types/AbstractType.js";

@@ -163,2 +190,3 @@ import { Doc } from "./Doc.js";

import { Transaction } from "./Transaction.js";
import { YEvent } from "./YEvent.js";
//# sourceMappingURL=UndoManager.d.ts.map
{
"name": "yjs",
"version": "13.6.12",
"version": "13.6.13",
"description": "Shared Editing Library",

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

"scripts": {
"clean": "rm -rf dist docs",
"test": "npm run dist && node ./dist/tests.cjs --repetition-time 50",
"test-extensive": "npm run lint && npm run dist && node ./dist/tests.cjs --production --repetition-time 10000",
"dist": "rm -rf dist && rollup -c && tsc",
"dist": "npm run clean && rollup -c && tsc",
"watch": "rollup -wc",

@@ -20,0 +21,0 @@ "lint": "markdownlint README.md && standard && tsc",

@@ -229,2 +229,6 @@

</dd>
<dt><a href="https://github.com/podraven/y-fire">y-fire</a></dt>
<dd>
A database and connection provider for Yjs based on Firestore.
</dd>
</dl>

@@ -882,3 +886,3 @@

Yjs implements two update formats. By default you are using the V1 update format.
You can opt-in into the V2 update format wich provides much better compression.
You can opt-in into the V2 update format which provides much better compression.
It is not yet used by all providers. However, you can already use it if

@@ -885,0 +889,0 @@ you are building your own provider. All below functions are available with the

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

import { Observable } from 'lib0/observable'
import { ObservableV2 } from 'lib0/observable'

@@ -13,5 +13,5 @@ import {

*
* @extends {Observable<any>}
* @extends {ObservableV2<any>}
*/
export class AbstractConnector extends Observable {
export class AbstractConnector extends ObservableV2 {
/**

@@ -18,0 +18,0 @@ * @param {Doc} ydoc

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

import { Observable } from 'lib0/observable'
import { ObservableV2 } from 'lib0/observable'
import * as random from 'lib0/random'

@@ -38,6 +38,22 @@ import * as map from 'lib0/map'

/**
* @typedef {Object} DocEvents
* @property {function(Doc):void} DocEvents.destroy
* @property {function(Doc):void} DocEvents.load
* @property {function(boolean, Doc):void} DocEvents.sync
* @property {function(Uint8Array, any, Doc, Transaction):void} DocEvents.update
* @property {function(Uint8Array, any, Doc, Transaction):void} DocEvents.updateV2
* @property {function(Doc):void} DocEvents.beforeAllTransactions
* @property {function(Transaction, Doc):void} DocEvents.beforeTransaction
* @property {function(Transaction, Doc):void} DocEvents.beforeObserverCalls
* @property {function(Transaction, Doc):void} DocEvents.afterTransaction
* @property {function(Transaction, Doc):void} DocEvents.afterTransactionCleanup
* @property {function(Doc, Array<Transaction>):void} DocEvents.afterAllTransactions
* @property {function({ loaded: Set<Doc>, added: Set<Doc>, removed: Set<Doc> }, Doc, Transaction):void} DocEvents.subdocs
*/
/**
* A Yjs instance handles the state of shared data.
* @extends Observable<string>
* @extends ObservableV2<DocEvents>
*/
export class Doc extends Observable {
export class Doc extends ObservableV2 {
/**

@@ -120,3 +136,3 @@ * @param {DocOpts} opts configuration

if (this.isSynced && !this.isLoaded) {
this.emit('load', [])
this.emit('load', [this])
}

@@ -327,22 +343,7 @@ })

}
this.emit('destroyed', [true])
// @ts-ignore
this.emit('destroyed', [true]) // DEPRECATED!
this.emit('destroy', [this])
super.destroy()
}
/**
* @param {string} eventName
* @param {function(...any):any} f
*/
on (eventName, f) {
super.on(eventName, f)
}
/**
* @param {string} eventName
* @param {function} f
*/
off (eventName, f) {
super.off(eventName, f)
}
}

@@ -13,3 +13,3 @@ import {

addToDeleteSet,
Transaction, Doc, Item, GC, DeleteSet, AbstractType // eslint-disable-line
YEvent, Transaction, Doc, Item, GC, DeleteSet, AbstractType // eslint-disable-line
} from '../internals.js'

@@ -20,3 +20,3 @@

import * as logging from 'lib0/logging'
import { Observable } from 'lib0/observable'
import { ObservableV2 } from 'lib0/observable'

@@ -53,3 +53,3 @@ export class StackItem {

* @param {Array<StackItem>} stack
* @param {string} eventType
* @param {'undo'|'redo'} eventType
* @return {StackItem?}

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

/**
* Whether a change happened
* @type {StackItem?}
*/
let result = null
/**
* Keep a reference to the transaction so we can fire the event with the changedParentTypes

@@ -72,3 +67,3 @@ * @type {any}

transact(doc, transaction => {
while (stack.length > 0 && result === null) {
while (stack.length > 0 && undoManager.currStackItem === null) {
const store = doc.store

@@ -121,3 +116,3 @@ const stackItem = /** @type {StackItem} */ (stack.pop())

}
result = performedChange ? stackItem : null
undoManager.currStackItem = performedChange ? stackItem : null
}

@@ -132,7 +127,8 @@ transaction.changed.forEach((subProps, type) => {

}, undoManager)
if (result != null) {
if (undoManager.currStackItem != null) {
const changedParentTypes = _tr.changedParentTypes
undoManager.emit('stack-item-popped', [{ stackItem: result, type: eventType, changedParentTypes }, undoManager])
undoManager.emit('stack-item-popped', [{ stackItem: undoManager.currStackItem, type: eventType, changedParentTypes, origin: undoManager }, undoManager])
undoManager.currStackItem = null
}
return result
return undoManager.currStackItem
}

@@ -154,2 +150,10 @@

/**
* @typedef {Object} StackItemEvent
* @property {StackItem} StackItemEvent.stackItem
* @property {any} StackItemEvent.origin
* @property {'undo'|'redo'} StackItemEvent.type
* @property {Map<AbstractType<YEvent<any>>,Array<YEvent<any>>>} StackItemEvent.changedParentTypes
*/
/**
* Fires 'stack-item-added' event when a stack item was added to either the undo- or

@@ -161,5 +165,5 @@ * the redo-stack. You may store additional stack information via the

*
* @extends {Observable<'stack-item-added'|'stack-item-popped'|'stack-cleared'|'stack-item-updated'>}
* @extends {ObservableV2<{'stack-item-added':function(StackItemEvent, UndoManager):void, 'stack-item-popped': function(StackItemEvent, UndoManager):void, 'stack-cleared': function({ undoStackCleared: boolean, redoStackCleared: boolean }):void, 'stack-item-updated': function(StackItemEvent, UndoManager):void }>}
*/
export class UndoManager extends Observable {
export class UndoManager extends ObservableV2 {
/**

@@ -203,2 +207,8 @@ * @param {AbstractType<any>|Array<AbstractType<any>>} typeScope Accepts either a single type, or an array of types

this.redoing = false
/**
* The currently popped stack item if UndoManager.undoing or UndoManager.redoing
*
* @type {StackItem|null}
*/
this.currStackItem = null
this.lastChange = 0

@@ -257,2 +267,5 @@ this.ignoreRemoteMapChanges = ignoreRemoteMapChanges

})
/**
* @type {[StackItemEvent, UndoManager]}
*/
const changeEvent = [{ stackItem: stack[stack.length - 1], origin: transaction.origin, type: undoing ? 'redo' : 'undo', changedParentTypes: transaction.changedParentTypes }, this]

@@ -259,0 +272,0 @@ if (didAdd) {

@@ -37,3 +37,3 @@ import * as t from 'lib0/testing'

logUpdate: Y.logUpdate,
updateEventName: 'update',
updateEventName: /** @type {'update'} */ ('update'),
diffUpdate: Y.diffUpdate

@@ -47,3 +47,3 @@ }

logUpdate: Y.logUpdateV2,
updateEventName: 'updateV2',
updateEventName: /** @type {'updateV2'} */ ('updateV2'),
diffUpdate: Y.diffUpdateV2

@@ -50,0 +50,0 @@ }

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

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