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.34 to 13.5.35

6

dist/src/types/YMap.d.ts

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

/**
* @return {IterableIterator<MapType>}
* Returns an Iterator of [key, value] pairs
*
* @return {IterableIterator<any>}
*/
[Symbol.iterator](): IterableIterator<MapType>;
[Symbol.iterator](): IterableIterator<any>;
}

@@ -126,0 +128,0 @@ export function readYMap(decoder: UpdateDecoderV1 | UpdateDecoderV2): YMap<any>;

@@ -218,2 +218,8 @@ /**

slice(start?: number | undefined, end?: number | undefined): Array<YXmlElement | YXmlText>;
/**
* Executes a provided function on once on overy child element.
*
* @param {function(YXmlElement|YXmlText,number, typeof this):void} f A function to execute on every element of this YArray.
*/
forEach(f: (arg0: YXmlElement | YXmlText, arg1: number, arg2: YXmlFragment) => void): void;
}

@@ -220,0 +226,0 @@ export function readYXmlFragment(decoder: UpdateDecoderV1 | UpdateDecoderV2): YXmlFragment;

{
"name": "yjs",
"version": "13.5.34",
"version": "13.5.35",
"description": "Shared Editing Library",

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

@@ -23,12 +23,12 @@

:construction_worker_woman: If you are looking for professional (paid) support to
build collaborative or distributed applications ping us at
<yjs@tag1consulting.com>. Otherwise you can find help on our
[discussion board](https://discuss.yjs.dev).
:construction_worker_woman: If you are looking for professional support, please
consider supporting this project via a "support contract" on
[GitHub Sponsors](https://github.com/sponsors/dmonad). I will attend your issues
quicker and we can discuss questions and problems in regular video conferences.
Otherwise you can find help on our community [discussion board](https://discuss.yjs.dev).
## Sponsorship
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)
Please contribute to the project financially - especially if your company relies
on Yjs. [![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)

@@ -53,2 +53,3 @@ ## Who is using Yjs

* [BlockSurvey](https://blocksurvey.io) End-to-end encryption for your forms/surveys.
* [Skiff](https://skiff.org/) Private, decentralized workspace.

@@ -795,2 +796,17 @@ ## Table of Contents

When working with collaborative documents, we often need to work with positions.
Positions may represent cursor locations, selection ranges, or even assign a
comment to a range of text. Normal index-positions (expressed as integers) are
not convenient to use because the index-range is invalidated as soon as a remote
change manipulates the document. Relative positions give you a powerful API to
express positions.
A relative position is fixated to an element in the shared document and is not
affected by remote changes. I.e. given the document `"a|c"`, the relative
position is attached to `c`. When a remote user modifies the document by
inserting a character before the cursor, the cursor will stay attached to the
character `c`. `insert(1, 'x')("a|c") = "ax|c"`. When the relative position is
set to the end of the document, it will stay attached to the end of the
document.
#### Example: Transform to RelativePosition and back

@@ -830,10 +846,31 @@

<dl>
<b><code>Y.createRelativePositionFromTypeIndex(Uint8Array|Y.Type, number)</code></b>
<dd></dd>
<b><code>Y.createAbsolutePositionFromRelativePosition(RelativePosition, Y.Doc)</code></b>
<dd></dd>
<b><code>Y.encodeRelativePosition(RelativePosition):Uint8Array</code></b>
<dd></dd>
<b><code>
Y.createRelativePositionFromTypeIndex(type:Uint8Array|Y.Type, index: number
[, assoc=0])
</code></b>
<dd>
Create a relative position fixated to the i-th element in any sequence-like
shared type (if <code>assoc >= 0</code>). By default, the position associates
with the character that comes after the specified index position. If
<code>assoc < 0</code>, then the relative position associates with the character
before the specified index position.
</dd>
<b><code>
Y.createAbsolutePositionFromRelativePosition(RelativePosition, Y.Doc):
{ type: Y.AbstractType, index: number, assoc: number } | null
</code></b>
<dd>
Create an absolute position from a relative position. If the relative position
cannot be referenced, or the type is deleted, then the result is null.
</dd>
<b><code>
Y.encodeRelativePosition(RelativePosition):Uint8Array
</code></b>
<dd>
Encode a relative position to an Uint8Array. Binary data is the preferred
encoding format for document updates. If you prefer JSON encoding, you can
simply JSON.stringify / JSON.parse the relative position instead.
</dd>
<b><code>Y.decodeRelativePosition(Uint8Array):RelativePosition</code></b>
<dd></dd>
<dd>Decode a binary-encoded relative position to a RelativePositon object.</dd>
</dl>

@@ -840,0 +877,0 @@

@@ -183,3 +183,5 @@

/**
* @return {IterableIterator<MapType>}
* Returns an Iterator of [key, value] pairs
*
* @return {IterableIterator<any>}
*/

@@ -186,0 +188,0 @@ [Symbol.iterator] () {

@@ -408,2 +408,11 @@ /**

/**
* Executes a provided function on once on overy child element.
*
* @param {function(YXmlElement|YXmlText,number, typeof this):void} f A function to execute on every element of this YArray.
*/
forEach (f) {
typeListForEach(this, f)
}
/**
* Transform the properties of this type to binary and write it to an

@@ -410,0 +419,0 @@ * BinaryEncoder.

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

import * as object from 'lib0/object'
import * as map from 'lib0/map'
import * as Y from '../src/index.js'

@@ -93,4 +94,4 @@ export * from '../src/index.js'

broadcastMessage(this, encoding.toUint8Array(encoder))
this.updates.push(update)
}
this.updates.push(update)
})

@@ -138,8 +139,3 @@ this.connect()

_receive (message, remoteClient) {
let messages = this.receiving.get(remoteClient)
if (messages === undefined) {
messages = []
this.receiving.set(remoteClient, messages)
}
messages.push(message)
map.setIfUndefined(this.receiving, remoteClient, () => []).push(message)
}

@@ -208,13 +204,2 @@ }

}
{
// If update message, add the received message to the list of received messages
const decoder = decoding.createDecoder(m)
const messageType = decoding.readVarUint(decoder)
switch (messageType) {
case syncProtocol.messageYjsUpdate:
case syncProtocol.messageYjsSyncStep2:
receiver.updates.push(decoding.readVarUint8Array(decoder))
break
}
}
return true

@@ -221,0 +206,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

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