restructer and move to esdoc
This commit is contained in:
parent
a9b610479d
commit
bbc207aaa6
@ -1,43 +0,0 @@
|
|||||||
toc:
|
|
||||||
- Y
|
|
||||||
- name: Shared Types
|
|
||||||
description: |
|
|
||||||
Types provide an abstraction over the shared data.
|
|
||||||
Shared types can be edited concurrently by peers.
|
|
||||||
- Type
|
|
||||||
- YArray
|
|
||||||
- YMap
|
|
||||||
- YText
|
|
||||||
- YXmlElement
|
|
||||||
- YXmlFragment
|
|
||||||
- YXmlHook
|
|
||||||
- YXmlText
|
|
||||||
- name: Bindings
|
|
||||||
description: |
|
|
||||||
A binding handles data binding from a Yjs type to
|
|
||||||
a data object
|
|
||||||
- Binding
|
|
||||||
- DomBinding
|
|
||||||
- QuillBinding
|
|
||||||
- TextareaBinding
|
|
||||||
- name: Events
|
|
||||||
description: |
|
|
||||||
Events describe changes on shared types.
|
|
||||||
- YArrayEvent
|
|
||||||
- YEvent
|
|
||||||
- YMapEvent
|
|
||||||
- YTextEvent
|
|
||||||
- YXmlEvent
|
|
||||||
- name: Binary Encoding
|
|
||||||
description: |
|
|
||||||
Yjs efficiently encodes the Yjs model to a binary format.
|
|
||||||
This section describes utility functions for binary encoding and decoding.
|
|
||||||
- BinaryEncoder
|
|
||||||
- BinaryDecoder
|
|
||||||
- toBinary
|
|
||||||
- fromBinary
|
|
||||||
- name: Relative Position
|
|
||||||
- RelativePosition
|
|
||||||
- fromRelativePosition
|
|
||||||
- getRelativePosition
|
|
||||||
- name: Utility
|
|
@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
</head>
|
</head>
|
||||||
<!-- jquery is not required for y-xml. It is just here for convenience, and to test batch operations. -->
|
<!-- jquery is not required for YXml. It is just here for convenience, and to test batch operations. -->
|
||||||
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
||||||
<script src="../../y.js"></script>
|
<script src="../../y.js"></script>
|
||||||
<script src='../../../y-websockets-client/y-websockets-client.js'></script>
|
<script src='../../../y-websockets-client/y-websockets-client.js'></script>
|
||||||
@ -24,14 +24,16 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var commands = document.querySelectorAll(".command");
|
/* global $ */
|
||||||
Array.prototype.forEach.call(document.querySelectorAll('.command'), function (command) {
|
var commands = document.querySelectorAll('.command')
|
||||||
var execute = function(){
|
Array.prototype.forEach.call(commands, function (command) {
|
||||||
eval(command.querySelector("input").value);
|
var execute = function () {
|
||||||
|
// eslint-disable-next-line no-eval
|
||||||
|
eval(command.querySelector('input').value)
|
||||||
}
|
}
|
||||||
command.querySelector("button").onclick = execute
|
command.querySelector('button').onclick = execute
|
||||||
$(command.querySelector("input")).keyup(function (e) {
|
$(command.querySelector('input')).keyup(function (e) {
|
||||||
if (e.keyCode == 13) {
|
if (e.keyCode === 13) {
|
||||||
execute()
|
execute()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
"test": "npm run lint",
|
"test": "npm run lint",
|
||||||
"debug": "concurrently 'rollup -wc rollup.test.js' 'cutest-serve y.test.js -o'",
|
"debug": "concurrently 'rollup -wc rollup.test.js' 'cutest-serve y.test.js -o'",
|
||||||
"lint": "standard && documentation lint src/**",
|
"lint": "standard && documentation lint src/**",
|
||||||
"docs": "documentation build src/** -f html -o docs",
|
"docs": "esdocs",
|
||||||
"serve-docs": "documentation serve src/**",
|
"serve-docs": "npm run docs && serve ./docs/",
|
||||||
"dist": "rollup -c rollup.browser.js; rollup -c rollup.node.js",
|
"dist": "rollup -c rollup.browser.js; rollup -c rollup.node.js",
|
||||||
"watch": "concurrently 'rollup -wc rollup.browser.js' 'rollup -wc rollup.node.js'",
|
"watch": "concurrently 'rollup -wc rollup.browser.js' 'rollup -wc rollup.node.js'",
|
||||||
"postversion": "npm run dist",
|
"postversion": "npm run dist",
|
||||||
|
@ -5,7 +5,7 @@ import commonjs from 'rollup-plugin-commonjs'
|
|||||||
var pkg = require('./package.json')
|
var pkg = require('./package.json')
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
input: 'src/Y.js',
|
input: 'src/Y.dist.js',
|
||||||
name: 'Y',
|
name: 'Y',
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
output: {
|
output: {
|
||||||
@ -20,7 +20,7 @@ export default {
|
|||||||
}),
|
}),
|
||||||
commonjs(),
|
commonjs(),
|
||||||
babel(),
|
babel(),
|
||||||
/*uglify({
|
uglify({
|
||||||
mangle: {
|
mangle: {
|
||||||
except: ['YMap', 'Y', 'YArray', 'YText', 'YXmlHook', 'YXmlFragment', 'YXmlElement', 'YXmlEvent', 'YXmlText', 'YEvent', 'YArrayEvent', 'YMapEvent', 'Type', 'Delete', 'ItemJSON', 'ItemString', 'Item']
|
except: ['YMap', 'Y', 'YArray', 'YText', 'YXmlHook', 'YXmlFragment', 'YXmlElement', 'YXmlEvent', 'YXmlText', 'YEvent', 'YArrayEvent', 'YMapEvent', 'Type', 'Delete', 'ItemJSON', 'ItemString', 'Item']
|
||||||
},
|
},
|
||||||
@ -34,7 +34,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})*/
|
})
|
||||||
],
|
],
|
||||||
banner: `
|
banner: `
|
||||||
/**
|
/**
|
||||||
|
@ -3,7 +3,7 @@ import commonjs from 'rollup-plugin-commonjs'
|
|||||||
var pkg = require('./package.json')
|
var pkg = require('./package.json')
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
input: 'src/y-dist.cjs.js',
|
input: 'src/Y.dist.js',
|
||||||
nameame: 'Y',
|
nameame: 'Y',
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
output: {
|
output: {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import BinaryEncoder from './Binary/Encoder.js'
|
import BinaryEncoder from './Util/Binary/Encoder.js'
|
||||||
import BinaryDecoder from './Binary/Decoder.js'
|
import BinaryDecoder from './Util/Binary/Decoder.js'
|
||||||
|
|
||||||
import { sendSyncStep1, readSyncStep1 } from './MessageHandler/syncStep1.js'
|
import { sendSyncStep1, readSyncStep1 } from './MessageHandler/syncStep1.js'
|
||||||
import { readSyncStep2 } from './MessageHandler/syncStep2.js'
|
import { readSyncStep2 } from './MessageHandler/syncStep2.js'
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import { writeStructs } from './syncStep1.js'
|
import { writeStructs } from './syncStep1.js'
|
||||||
import { integrateRemoteStructs } from './integrateRemoteStructs.js'
|
import { integrateRemoteStructs } from './integrateRemoteStructs.js'
|
||||||
import { readDeleteSet, writeDeleteSet } from './deleteSet.js'
|
import { readDeleteSet, writeDeleteSet } from './deleteSet.js'
|
||||||
import BinaryEncoder from '../Binary/Encoder.js'
|
import BinaryEncoder from '../Util/Binary/Encoder.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the Decoder and fill the Yjs instance with data in the decoder.
|
* Read the Decoder and fill the Yjs instance with data in the decoder.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { deleteItemRange } from '../Struct/Delete.js'
|
import { deleteItemRange } from '../Struct/Delete.js'
|
||||||
import ID from '../Util/ID.js'
|
import ID from '../Util/ID/ID.js.js'
|
||||||
|
|
||||||
export function stringifyDeleteSet (y, decoder, strBuilder) {
|
export function stringifyDeleteSet (y, decoder, strBuilder) {
|
||||||
let dsLength = decoder.readUint32()
|
let dsLength = decoder.readUint32()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { getStruct } from '../Util/structReferences.js'
|
import { getStruct } from '../Util/structReferences.js'
|
||||||
import BinaryDecoder from '../Binary/Decoder.js'
|
import BinaryDecoder from '../Util/Binary/Decoder.js'
|
||||||
import { logID } from './messageToString.js'
|
import { logID } from './messageToString.js'
|
||||||
|
|
||||||
class MissingEntry {
|
class MissingEntry {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import BinaryDecoder from '../Binary/Decoder.js'
|
import BinaryDecoder from '../Util/Binary/Decoder.js'
|
||||||
import { stringifyStructs } from './integrateRemoteStructs.js'
|
import { stringifyStructs } from './integrateRemoteStructs.js'
|
||||||
import { stringifySyncStep1 } from './syncStep1.js'
|
import { stringifySyncStep1 } from './syncStep1.js'
|
||||||
import { stringifySyncStep2 } from './syncStep2.js'
|
import { stringifySyncStep2 } from './syncStep2.js'
|
||||||
import ID from '../Util/ID.js'
|
import ID from '../Util/ID/ID.js.js'
|
||||||
import RootID from '../Util/RootID.js'
|
import RootID from '../Util/ID/RootID.js.js'
|
||||||
import Y from '../Y.js'
|
import Y from '../Y.js'
|
||||||
|
|
||||||
export function messageToString ([y, buffer]) {
|
export function messageToString ([y, buffer]) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import BinaryEncoder from '../Binary/Encoder.js'
|
import BinaryEncoder from '../Util/Binary/Encoder.js'
|
||||||
import { readStateSet, writeStateSet } from './stateSet.js'
|
import { readStateSet, writeStateSet } from './stateSet.js'
|
||||||
import { writeDeleteSet } from './deleteSet.js'
|
import { writeDeleteSet } from './deleteSet.js'
|
||||||
import ID from '../Util/ID.js'
|
import ID from '../Util/ID/ID.js.js'
|
||||||
import { RootFakeUserID } from '../Util/RootID.js'
|
import { RootFakeUserID } from '../Util/ID/RootID.js.js'
|
||||||
|
|
||||||
export function stringifySyncStep1 (y, decoder, strBuilder) {
|
export function stringifySyncStep1 (y, decoder, strBuilder) {
|
||||||
let auth = decoder.readVarString()
|
let auth = decoder.readVarString()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import BinaryEncoder from './Binary/Encoder.js'
|
import BinaryEncoder from './Util/Binary/Encoder.js'
|
||||||
import BinaryDecoder from './Binary/Decoder.js'
|
import BinaryDecoder from './Util/Binary/Decoder.js'
|
||||||
import { toBinary, fromBinary } from './MessageHandler/binaryEncode.js'
|
import { toBinary, fromBinary } from './MessageHandler/binaryEncode.js'
|
||||||
import { integrateRemoteStructs } from './MessageHandler/integrateRemoteStructs.js'
|
import { integrateRemoteStructs } from './MessageHandler/integrateRemoteStructs.js'
|
||||||
import { createMutualExclude } from './Util/mutualExclude.js'
|
import { createMutualExclude } from './Util/mutualExclude.js'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Tree from '../Util/Tree.js'
|
import Tree from '../Util/Tree.js'
|
||||||
import ID from '../Util/ID.js'
|
import ID from '../Util/ID/ID.js.js'
|
||||||
|
|
||||||
class DSNode {
|
class DSNode {
|
||||||
constructor (id, len, gc) {
|
constructor (id, len, gc) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Tree from '../Util/Tree.js'
|
import Tree from '../Util/Tree.js'
|
||||||
import RootID from '../Util/RootID.js'
|
import RootID from '../Util/ID/RootID.js.js'
|
||||||
import { getStruct } from '../Util/structReferences.js'
|
import { getStruct } from '../Util/structReferences.js'
|
||||||
import { logID } from '../MessageHandler/messageToString.js'
|
import { logID } from '../MessageHandler/messageToString.js'
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import ID from '../Util/ID.js'
|
import ID from '../Util/ID/ID.js.js'
|
||||||
|
|
||||||
export default class StateStore {
|
export default class StateStore {
|
||||||
constructor (y) {
|
constructor (y) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { getReference } from '../Util/structReferences.js'
|
import { getReference } from '../Util/structReferences.js'
|
||||||
import ID from '../Util/ID.js'
|
import ID from '../Util/ID/ID.js.js'
|
||||||
import { logID } from '../MessageHandler/messageToString.js'
|
import { logID } from '../MessageHandler/messageToString.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { getReference } from '../Util/structReferences.js'
|
import { getReference } from '../Util/structReferences.js'
|
||||||
import ID from '../Util/ID.js'
|
import ID from '../Util/ID/ID.js.js'
|
||||||
import { RootFakeUserID } from '../Util/RootID.js'
|
import { RootFakeUserID } from '../Util/ID/RootID.js.js'
|
||||||
import Delete from './Delete.js'
|
import Delete from './Delete.js'
|
||||||
import { transactionTypeChanged } from '../Transaction.js'
|
import { transactionTypeChanged } from '../Transaction.js'
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Item from './Item.js'
|
import Item from './Item.js'
|
||||||
import EventHandler from '../Util/EventHandler.js'
|
import EventHandler from '../Util/EventHandler.js'
|
||||||
import ID from '../Util/ID.js'
|
import ID from '../Util/ID/ID.js.js'
|
||||||
|
|
||||||
// restructure children as if they were inserted one after another
|
// restructure children as if they were inserted one after another
|
||||||
function integrateChildren (y, start) {
|
function integrateChildren (y, start) {
|
||||||
@ -47,11 +47,11 @@ export default class Type extends Item {
|
|||||||
* Compute the path from this type to the specified target.
|
* Compute the path from this type to the specified target.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* It should be accessible via `this.get(result[0]).get(result[1])..``
|
* It should be accessible via `this.get(result[0]).get(result[1])..`
|
||||||
* const path = type.getPathTo(child)
|
* const path = type.getPathTo(child)
|
||||||
* // assuming `type instanceof YArray`
|
* // assuming `type instanceof YArray`
|
||||||
* console.log(path) // might look like => [2, 'key1']
|
* console.log(path) // might look like => [2, 'key1']
|
||||||
* child === type.get(path[0]).get(path[1])
|
* child === type.get(path[0]).get(path[1])
|
||||||
*
|
*
|
||||||
* @param {YType} type Type target
|
* @param {YType} type Type target
|
||||||
* @return {Array<string>} Path to the target
|
* @return {Array<string>} Path to the target
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { defaultDomFilter } from './utils.js'
|
import { defaultDomFilter } from './utils.js'
|
||||||
|
|
||||||
import YMap from '../YMap.js'
|
import YMap from '../YMap.js'
|
||||||
import { YXmlFragment } from './y-xml.js'
|
import { YXmlFragment } from './YXml.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An YXmlElement imitates the behavior of a
|
* An YXmlElement imitates the behavior of a
|
||||||
@ -161,8 +161,8 @@ export default class YXmlElement extends YXmlFragment {
|
|||||||
*
|
*
|
||||||
* @param {String} attributeName The attribute name that is to be removed.
|
* @param {String} attributeName The attribute name that is to be removed.
|
||||||
*/
|
*/
|
||||||
removeAttribute () {
|
removeAttribute (attributeName) {
|
||||||
return YMap.prototype.delete.apply(this, arguments)
|
return YMap.prototype.delete.call(this, attributeName)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -171,8 +171,8 @@ export default class YXmlElement extends YXmlFragment {
|
|||||||
* @param {String} attributeName The attribute name that is to be set.
|
* @param {String} attributeName The attribute name that is to be set.
|
||||||
* @param {String} attributeValue The attribute value that is to be set.
|
* @param {String} attributeValue The attribute value that is to be set.
|
||||||
*/
|
*/
|
||||||
setAttribute () {
|
setAttribute (attributeName, attributeValue) {
|
||||||
return YMap.prototype.set.apply(this, arguments)
|
return YMap.prototype.set.call(this, attributeName, attributeValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -182,8 +182,8 @@ export default class YXmlElement extends YXmlFragment {
|
|||||||
* queried value.
|
* queried value.
|
||||||
* @return {String} The queried attribute value
|
* @return {String} The queried attribute value
|
||||||
*/
|
*/
|
||||||
getAttribute () {
|
getAttribute (attributeName) {
|
||||||
return YMap.prototype.get.apply(this, arguments)
|
return YMap.prototype.get.call(this, attributeName)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -5,7 +5,7 @@ import { beforeTransactionSelectionFixer, afterTransactionSelectionFixer } from
|
|||||||
|
|
||||||
import YArray from '../YArray.js'
|
import YArray from '../YArray.js'
|
||||||
import YXmlEvent from './YXmlEvent.js'
|
import YXmlEvent from './YXmlEvent.js'
|
||||||
import { YXmlText, YXmlHook } from './y-xml'
|
import { YXmlText, YXmlHook } from './YXml.js'
|
||||||
import { logID } from '../../MessageHandler/messageToString.js'
|
import { logID } from '../../MessageHandler/messageToString.js'
|
||||||
import diff from '../../Util/simpleDiff.js'
|
import diff from '../../Util/simpleDiff.js'
|
||||||
|
|
||||||
@ -303,6 +303,7 @@ export default class YXmlFragment extends YArray {
|
|||||||
* inserted after this node. Set null to insert at
|
* inserted after this node. Set null to insert at
|
||||||
* the beginning.
|
* the beginning.
|
||||||
* @param {Array<Element>} doms The Dom elements to insert.
|
* @param {Array<Element>} doms The Dom elements to insert.
|
||||||
|
* @param {?Document} _document Optional. Provide the global document object.
|
||||||
* @return {Array<YXmlElement>} The YxmlElements that are inserted.
|
* @return {Array<YXmlElement>} The YxmlElements that are inserted.
|
||||||
*/
|
*/
|
||||||
insertDomElementsAfter (prev, doms, _document) {
|
insertDomElementsAfter (prev, doms, _document) {
|
||||||
@ -318,6 +319,7 @@ export default class YXmlFragment extends YArray {
|
|||||||
*
|
*
|
||||||
* @param {Integer} index The position to insert elements at.
|
* @param {Integer} index The position to insert elements at.
|
||||||
* @param {Array<Element>} doms The Dom elements to insert.
|
* @param {Array<Element>} doms The Dom elements to insert.
|
||||||
|
* @param {?Document} _document Optional. Provide the global document object.
|
||||||
* @return {Array<YXmlElement>} The YxmlElements that are inserted.
|
* @return {Array<YXmlElement>} The YxmlElements that are inserted.
|
||||||
*/
|
*/
|
||||||
insertDomElements (index, doms, _document) {
|
insertDomElements (index, doms, _document) {
|
||||||
@ -339,6 +341,7 @@ export default class YXmlFragment extends YArray {
|
|||||||
* the children of this YXml Type.
|
* the children of this YXml Type.
|
||||||
*
|
*
|
||||||
* @param {Element} dom The Dom Element that should be bound to this Type.
|
* @param {Element} dom The Dom Element that should be bound to this Type.
|
||||||
|
* @param {?Document} _document Optional. Provide the global document object.
|
||||||
*/
|
*/
|
||||||
bindToDom (dom, _document) {
|
bindToDom (dom, _document) {
|
||||||
if (this._dom != null) {
|
if (this._dom != null) {
|
@ -1,4 +1,4 @@
|
|||||||
import { YXmlText, YXmlHook } from './y-xml.js'
|
import { YXmlText, YXmlHook } from './YXml.js'
|
||||||
|
|
||||||
export function defaultDomFilter (node, attributes) {
|
export function defaultDomFilter (node, attributes) {
|
||||||
return attributes
|
return attributes
|
@ -1,17 +1,23 @@
|
|||||||
import ID from '../Util/ID.js'
|
import ID from '../Util/ID/ID.js.js'
|
||||||
import { default as RootID, RootFakeUserID } from '../Util/RootID.js'
|
import { default as RootID, RootFakeUserID } from '../Util/ID/RootID.js.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A BinaryDecoder handles the decoding of an ArrayBuffer
|
* A BinaryDecoder handles the decoding of an ArrayBuffer.
|
||||||
*/
|
*/
|
||||||
export default class BinaryDecoder {
|
export default class BinaryDecoder {
|
||||||
/**
|
/**
|
||||||
* @param {Uint8Array|Buffer} buffer The binary data that this instance decodes
|
* @param {Uint8Array|Buffer} buffer The binary data that this instance
|
||||||
|
* decodes.
|
||||||
*/
|
*/
|
||||||
constructor (buffer) {
|
constructor (buffer) {
|
||||||
if (buffer instanceof ArrayBuffer) {
|
if (buffer instanceof ArrayBuffer) {
|
||||||
this.uint8arr = new Uint8Array(buffer)
|
this.uint8arr = new Uint8Array(buffer)
|
||||||
} else if (buffer instanceof Uint8Array || (typeof Buffer !== 'undefined' && buffer instanceof Buffer)) {
|
} else if (
|
||||||
|
buffer instanceof Uint8Array ||
|
||||||
|
(
|
||||||
|
typeof Buffer !== 'undefined' && buffer instanceof Buffer
|
||||||
|
)
|
||||||
|
) {
|
||||||
this.uint8arr = buffer
|
this.uint8arr = buffer
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Expected an ArrayBuffer or Uint8Array!')
|
throw new Error('Expected an ArrayBuffer or Uint8Array!')
|
||||||
@ -20,8 +26,8 @@ export default class BinaryDecoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clone this decoder instance
|
* Clone this decoder instance.
|
||||||
* Optionally set a new position parameter
|
* Optionally set a new position parameter.
|
||||||
*/
|
*/
|
||||||
clone (newPos = this.pos) {
|
clone (newPos = this.pos) {
|
||||||
let decoder = new BinaryDecoder(this.uint8arr)
|
let decoder = new BinaryDecoder(this.uint8arr)
|
||||||
@ -30,30 +36,30 @@ export default class BinaryDecoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of bytes
|
* Number of bytes.
|
||||||
*/
|
*/
|
||||||
get length () {
|
get length () {
|
||||||
return this.uint8arr.length
|
return this.uint8arr.length
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skip one byte, jump to the next position
|
* Skip one byte, jump to the next position.
|
||||||
*/
|
*/
|
||||||
skip8 () {
|
skip8 () {
|
||||||
this.pos++
|
this.pos++
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read one byte as unsigned integer
|
* Read one byte as unsigned integer.
|
||||||
*/
|
*/
|
||||||
readUint8 () {
|
readUint8 () {
|
||||||
return this.uint8arr[this.pos++]
|
return this.uint8arr[this.pos++]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read 4 bytes as unsigned integer
|
* Read 4 bytes as unsigned integer.
|
||||||
*
|
*
|
||||||
* @return number An unsigned integer
|
* @return {number} An unsigned integer.
|
||||||
*/
|
*/
|
||||||
readUint32 () {
|
readUint32 () {
|
||||||
let uint =
|
let uint =
|
||||||
@ -66,22 +72,22 @@ export default class BinaryDecoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Look ahead without incrementing position
|
* Look ahead without incrementing position.
|
||||||
* to the next byte and read it as unsigned integer
|
* to the next byte and read it as unsigned integer.
|
||||||
*
|
*
|
||||||
* @return number An unsigned integer
|
* @return {number} An unsigned integer.
|
||||||
*/
|
*/
|
||||||
peekUint8 () {
|
peekUint8 () {
|
||||||
return this.uint8arr[this.pos]
|
return this.uint8arr[this.pos]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read unsigned integer (32bit) with variable length
|
* Read unsigned integer (32bit) with variable length.
|
||||||
* 1/8th of the storage is used as encoding overhead
|
* 1/8th of the storage is used as encoding overhead.
|
||||||
* * numbers < 2^7 is stored in one byte
|
* * numbers < 2^7 is stored in one byte.
|
||||||
* * numbers < 2^14 is stored in two bytes
|
* * numbers < 2^14 is stored in two bytes.
|
||||||
*
|
*
|
||||||
* @return number An unsigned integer
|
* @return {number} An unsigned integer.
|
||||||
*/
|
*/
|
||||||
readVarUint () {
|
readVarUint () {
|
||||||
let num = 0
|
let num = 0
|
||||||
@ -103,7 +109,7 @@ export default class BinaryDecoder {
|
|||||||
* Read string of variable length
|
* Read string of variable length
|
||||||
* * varUint is used to store the length of the string
|
* * varUint is used to store the length of the string
|
||||||
*
|
*
|
||||||
* @return string
|
* @return {String} The read String.
|
||||||
*/
|
*/
|
||||||
readVarString () {
|
readVarString () {
|
||||||
let len = this.readVarUint()
|
let len = this.readVarUint()
|
||||||
@ -114,6 +120,7 @@ export default class BinaryDecoder {
|
|||||||
let encodedString = bytes.map(b => String.fromCodePoint(b)).join('')
|
let encodedString = bytes.map(b => String.fromCodePoint(b)).join('')
|
||||||
return decodeURIComponent(escape(encodedString))
|
return decodeURIComponent(escape(encodedString))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Look ahead and read varString without incrementing position
|
* Look ahead and read varString without incrementing position
|
||||||
*/
|
*/
|
||||||
@ -123,10 +130,11 @@ export default class BinaryDecoder {
|
|||||||
this.pos = pos
|
this.pos = pos
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read ID
|
* Read ID.
|
||||||
* * If first varUint read is 0xFFFFFF a RootID is returned
|
* * If first varUint read is 0xFFFFFF a RootID is returned.
|
||||||
* * Otherwise an ID is returned
|
* * Otherwise an ID is returned.
|
||||||
*
|
*
|
||||||
* @return ID
|
* @return ID
|
||||||
*/
|
*/
|
@ -1,10 +1,10 @@
|
|||||||
import { RootFakeUserID } from '../Util/RootID.js'
|
import { RootFakeUserID } from '../Util/ID/RootID.js.js'
|
||||||
|
|
||||||
const bits7 = 0b1111111
|
const bits7 = 0b1111111
|
||||||
const bits8 = 0b11111111
|
const bits8 = 0b11111111
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A BinaryEncoder handles the encoding to an ArrayBuffer
|
* A BinaryEncoder handles the encoding to an ArrayBuffer.
|
||||||
*/
|
*/
|
||||||
export default class BinaryEncoder {
|
export default class BinaryEncoder {
|
||||||
constructor () {
|
constructor () {
|
||||||
@ -13,7 +13,7 @@ export default class BinaryEncoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current length of the encoded data
|
* The current length of the encoded data.
|
||||||
*/
|
*/
|
||||||
get length () {
|
get length () {
|
||||||
return this.data.length
|
return this.data.length
|
||||||
@ -27,46 +27,46 @@ export default class BinaryEncoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an ArrayBuffer
|
* Create an ArrayBuffer.
|
||||||
*
|
*
|
||||||
* @return {Uint8Array}
|
* @return {Uint8Array} A Uint8Array that represents the written data.
|
||||||
*/
|
*/
|
||||||
createBuffer () {
|
createBuffer () {
|
||||||
return Uint8Array.from(this.data).buffer
|
return Uint8Array.from(this.data).buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write one byte as an unsigned integer
|
* Write one byte as an unsigned integer.
|
||||||
*
|
*
|
||||||
* @param {number} num The number that is to be encoded
|
* @param {number} num The number that is to be encoded.
|
||||||
*/
|
*/
|
||||||
writeUint8 (num) {
|
writeUint8 (num) {
|
||||||
this.data.push(num & bits8)
|
this.data.push(num & bits8)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write one byte as an unsigned Integer at a specific location
|
* Write one byte as an unsigned Integer at a specific location.
|
||||||
*
|
*
|
||||||
* @param {number} pos The location where the data will be written
|
* @param {number} pos The location where the data will be written.
|
||||||
* @param {number} num The number that is to
|
* @param {number} num The number that is to be encoded.
|
||||||
*/
|
*/
|
||||||
setUint8 (pos, num) {
|
setUint8 (pos, num) {
|
||||||
this.data[pos] = num & bits8
|
this.data[pos] = num & bits8
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write two bytes as an unsigned integer
|
* Write two bytes as an unsigned integer.
|
||||||
*
|
*
|
||||||
* @param {number} pos The number that is to be encoded
|
* @param {number} num The number that is to be encoded.
|
||||||
*/
|
*/
|
||||||
writeUint16 (num) {
|
writeUint16 (num) {
|
||||||
this.data.push(num & bits8, (num >>> 8) & bits8)
|
this.data.push(num & bits8, (num >>> 8) & bits8)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Write two bytes as an unsigned integer at a specific location
|
* Write two bytes as an unsigned integer at a specific location.
|
||||||
*
|
*
|
||||||
* @param {number} pos The location where the data will be written
|
* @param {number} pos The location where the data will be written.
|
||||||
* @param {number} num The number that is to
|
* @param {number} num The number that is to be encoded.
|
||||||
*/
|
*/
|
||||||
setUint16 (pos, num) {
|
setUint16 (pos, num) {
|
||||||
this.data[pos] = num & bits8
|
this.data[pos] = num & bits8
|
||||||
@ -76,7 +76,7 @@ export default class BinaryEncoder {
|
|||||||
/**
|
/**
|
||||||
* Write two bytes as an unsigned integer
|
* Write two bytes as an unsigned integer
|
||||||
*
|
*
|
||||||
* @param {number} pos The number that is to be encoded
|
* @param {number} num The number that is to be encoded.
|
||||||
*/
|
*/
|
||||||
writeUint32 (num) {
|
writeUint32 (num) {
|
||||||
for (let i = 0; i < 4; i++) {
|
for (let i = 0; i < 4; i++) {
|
||||||
@ -86,10 +86,10 @@ export default class BinaryEncoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write two bytes as an unsigned integer at a specific location
|
* Write two bytes as an unsigned integer at a specific location.
|
||||||
*
|
*
|
||||||
* @param {number} pos The location where the data will be written
|
* @param {number} pos The location where the data will be written.
|
||||||
* @param {number} num The number that is to
|
* @param {number} num The number that is to be encoded.
|
||||||
*/
|
*/
|
||||||
setUint32 (pos, num) {
|
setUint32 (pos, num) {
|
||||||
for (let i = 0; i < 4; i++) {
|
for (let i = 0; i < 4; i++) {
|
||||||
@ -99,9 +99,9 @@ export default class BinaryEncoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a variable length unsigned integer
|
* Write a variable length unsigned integer.
|
||||||
*
|
*
|
||||||
* @param {number} pos The number that is to be encoded
|
* @param {number} num The number that is to be encoded.
|
||||||
*/
|
*/
|
||||||
writeVarUint (num) {
|
writeVarUint (num) {
|
||||||
while (num >= 0b10000000) {
|
while (num >= 0b10000000) {
|
||||||
@ -114,7 +114,7 @@ export default class BinaryEncoder {
|
|||||||
/**
|
/**
|
||||||
* Write a variable length string.
|
* Write a variable length string.
|
||||||
*
|
*
|
||||||
* @param {number} pos The number that is to be encoded
|
* @param {String} str The string that is to be encoded.
|
||||||
*/
|
*/
|
||||||
writeVarString (str) {
|
writeVarString (str) {
|
||||||
let encodedString = unescape(encodeURIComponent(str))
|
let encodedString = unescape(encodeURIComponent(str))
|
||||||
@ -127,9 +127,9 @@ export default class BinaryEncoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write an ID at the current position
|
* Write an ID at the current position.
|
||||||
*
|
*
|
||||||
* @param {ID} id
|
* @param {ID} id The ID that is to be written.
|
||||||
*/
|
*/
|
||||||
writeID (id) {
|
writeID (id) {
|
||||||
const user = id.user
|
const user = id.user
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
export default class ID {
|
export default class ID {
|
||||||
constructor (user, clock) {
|
constructor (user, clock) {
|
||||||
this.user = user
|
this.user = user // TODO: rename to client
|
||||||
this.clock = clock
|
this.clock = clock
|
||||||
}
|
}
|
||||||
clone () {
|
clone () {
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
import ID from '../Util/ID.js'
|
import ID from '../Util/ID/ID.js.js'
|
||||||
import ItemJSON from '../Struct/ItemJSON.js'
|
import ItemJSON from '../Struct/ItemJSON.js'
|
||||||
import ItemString from '../Struct/ItemString.js'
|
import ItemString from '../Struct/ItemString.js'
|
||||||
|
|
||||||
|
@ -1,4 +1,32 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* A SimpleDiff describes a change on a String.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* console.log(a) // the old value
|
||||||
|
* console.log(b) // the updated value
|
||||||
|
* // Apply changes of diff (pseudocode)
|
||||||
|
* a.remove(diff.pos, diff.remove) // Remove `diff.remove` characters
|
||||||
|
* a.insert(diff.pos, diff.insert) // Insert `diff.insert`
|
||||||
|
* a === b // values match
|
||||||
|
*
|
||||||
|
* @typedef {Object} SimpleDiff
|
||||||
|
* @property {NaturalNumber} pos The index where changes were applied
|
||||||
|
* @property {NaturalNumber} delete The number of characters to delete starting
|
||||||
|
* at `index`.
|
||||||
|
* @property {String} insert The new text to insert at `index` after applying
|
||||||
|
* `delete`
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a diff between two strings. This diff implementation is intentionally
|
||||||
|
* not very smart.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
* @param {String} a The old version of the string
|
||||||
|
* @param {String} b The updated version of the string
|
||||||
|
* @return {SimpleDiff} The diff description.
|
||||||
|
*/
|
||||||
export default function simpleDiff (a, b) {
|
export default function simpleDiff (a, b) {
|
||||||
let left = 0 // number of same characters counting from left
|
let left = 0 // number of same characters counting from left
|
||||||
let right = 0 // number of same characters counting from right
|
let right = 0 // number of same characters counting from right
|
||||||
@ -12,7 +40,7 @@ export default function simpleDiff (a, b) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
pos: left,
|
pos: left, // TODO: rename to index (also in type above)
|
||||||
remove: a.length - left - right,
|
remove: a.length - left - right,
|
||||||
insert: b.slice(left, b.length - right)
|
insert: b.slice(left, b.length - right)
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import YArray from '../Type/YArray.js'
|
import YArray from '../Types/YArray/YArray.js'
|
||||||
import YMap from '../Type/YMap.js'
|
import YMap from '../Types/YMap/YMap.js'
|
||||||
import YText from '../Type/YText.js'
|
import YText from '../Types/YText/YText.js'
|
||||||
import { YXmlFragment, YXmlElement, YXmlText, YXmlHook } from '../Type/y-xml/y-xml.js'
|
import { YXmlFragment, YXmlElement, YXmlText, YXmlHook } from '../Types/YXml/YXml.js'
|
||||||
|
|
||||||
import Delete from '../Struct/Delete.js'
|
import Delete from '../Struct/Delete.js'
|
||||||
import ItemJSON from '../Struct/ItemJSON.js'
|
import ItemJSON from '../Struct/ItemJSON.js'
|
||||||
@ -12,7 +12,7 @@ import ItemEmbed from '../Struct/ItemEmbed.js'
|
|||||||
const structs = new Map()
|
const structs = new Map()
|
||||||
const references = new Map()
|
const references = new Map()
|
||||||
|
|
||||||
export function addStruct (reference, structConstructor) {
|
export function registerStruct (reference, structConstructor) {
|
||||||
structs.set(reference, structConstructor)
|
structs.set(reference, structConstructor)
|
||||||
references.set(structConstructor, reference)
|
references.set(structConstructor, reference)
|
||||||
}
|
}
|
||||||
@ -21,21 +21,21 @@ export function getStruct (reference) {
|
|||||||
return structs.get(reference)
|
return structs.get(reference)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getReference (typeConstructor) {
|
export function getStructReference (typeConstructor) {
|
||||||
return references.get(typeConstructor)
|
return references.get(typeConstructor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: reorder (Item* should have low numbers)
|
// TODO: reorder (Item* should have low numbers)
|
||||||
addStruct(0, ItemJSON)
|
registerStruct(0, ItemJSON)
|
||||||
addStruct(1, ItemString)
|
registerStruct(1, ItemString)
|
||||||
addStruct(10, ItemFormat)
|
registerStruct(10, ItemFormat)
|
||||||
addStruct(11, ItemEmbed)
|
registerStruct(11, ItemEmbed)
|
||||||
addStruct(2, Delete)
|
registerStruct(2, Delete)
|
||||||
|
|
||||||
addStruct(3, YArray)
|
registerStruct(3, YArray)
|
||||||
addStruct(4, YMap)
|
registerStruct(4, YMap)
|
||||||
addStruct(5, YText)
|
registerStruct(5, YText)
|
||||||
addStruct(6, YXmlFragment)
|
registerStruct(6, YXmlFragment)
|
||||||
addStruct(7, YXmlElement)
|
registerStruct(7, YXmlElement)
|
||||||
addStruct(8, YXmlText)
|
registerStruct(8, YXmlText)
|
||||||
addStruct(9, YXmlHook)
|
registerStruct(9, YXmlHook)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
import YMap from '../Type/YMap'
|
import YMap from '../Types/YMap'
|
||||||
import YArray from '../Type/YArray'
|
import YArray from '../Types/YArray'
|
||||||
|
|
||||||
export function writeObjectToYMap (object, type) {
|
export function writeObjectToYMap (object, type) {
|
||||||
for (var key in object) {
|
for (var key in object) {
|
||||||
|
51
src/Y.dist.js
Normal file
51
src/Y.dist.js
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
|
||||||
|
import Y from './Y.js'
|
||||||
|
import UndoManager from './Util/UndoManager.js'
|
||||||
|
import { integrateRemoteStructs } from './MessageHandler/integrateRemoteStructs.js'
|
||||||
|
|
||||||
|
import { messageToString, messageToRoomname } from './MessageHandler/messageToString.js'
|
||||||
|
|
||||||
|
import Connector from './Connector.js'
|
||||||
|
import Persistence from './Persistence.js'
|
||||||
|
import YArray from './Types/YArray/YArray.js'
|
||||||
|
import YMap from './Types/YMap/YMap.js'
|
||||||
|
import YText from './Types/YText/YText.js'
|
||||||
|
import { YXmlFragment, YXmlElement, YXmlText, YXmlHook } from './Types/YXml/YXml.js'
|
||||||
|
import BinaryDecoder from './Util/Binary/Decoder.js'
|
||||||
|
import { getRelativePosition, fromRelativePosition } from './Util/relativePosition.js'
|
||||||
|
import { registerStruct } from './Util/structReferences.js'
|
||||||
|
import TextareaBinding from './Bindings/TextareaBinding.js'
|
||||||
|
import QuillBinding from './Bindings/QuillBinding.js'
|
||||||
|
import { toBinary, fromBinary } from './MessageHandler/binaryEncode.js'
|
||||||
|
|
||||||
|
import debug from 'debug'
|
||||||
|
|
||||||
|
// TODO: The following assignments should be moved to yjs-dist
|
||||||
|
Y.AbstractConnector = Connector
|
||||||
|
Y.AbstractPersistence = Persistence
|
||||||
|
Y.Array = YArray
|
||||||
|
Y.Map = YMap
|
||||||
|
Y.Text = YText
|
||||||
|
Y.XmlElement = YXmlElement
|
||||||
|
Y.XmlFragment = YXmlFragment
|
||||||
|
Y.XmlText = YXmlText
|
||||||
|
Y.XmlHook = YXmlHook
|
||||||
|
|
||||||
|
Y.TextareaBinding = TextareaBinding
|
||||||
|
Y.QuillBinding = QuillBinding
|
||||||
|
|
||||||
|
Y.utils = {
|
||||||
|
BinaryDecoder,
|
||||||
|
UndoManager,
|
||||||
|
getRelativePosition,
|
||||||
|
fromRelativePosition,
|
||||||
|
registerStruct,
|
||||||
|
integrateRemoteStructs,
|
||||||
|
toBinary,
|
||||||
|
fromBinary
|
||||||
|
}
|
||||||
|
|
||||||
|
Y.debug = debug
|
||||||
|
debug.formatters.Y = messageToString
|
||||||
|
debug.formatters.y = messageToRoomname
|
||||||
|
export default Y
|
68
src/Y.js
68
src/Y.js
@ -2,30 +2,15 @@ import DeleteStore from './Store/DeleteStore.js'
|
|||||||
import OperationStore from './Store/OperationStore.js'
|
import OperationStore from './Store/OperationStore.js'
|
||||||
import StateStore from './Store/StateStore.js'
|
import StateStore from './Store/StateStore.js'
|
||||||
import { generateUserID } from './Util/generateUserID.js'
|
import { generateUserID } from './Util/generateUserID.js'
|
||||||
import RootID from './Util/RootID.js'
|
import RootID from './Util/ID/RootID.js.js'
|
||||||
import NamedEventHandler from './Util/NamedEventHandler.js'
|
import NamedEventHandler from './Util/NamedEventHandler.js'
|
||||||
import UndoManager from './Util/UndoManager.js'
|
|
||||||
import { integrateRemoteStructs } from './MessageHandler/integrateRemoteStructs.js'
|
|
||||||
|
|
||||||
import { messageToString, messageToRoomname } from './MessageHandler/messageToString.js'
|
|
||||||
|
|
||||||
import Connector from './Connector.js'
|
|
||||||
import Persistence from './Persistence.js'
|
|
||||||
import YArray from './Type/YArray.js'
|
|
||||||
import YMap from './Type/YMap.js'
|
|
||||||
import YText from './Type/YText.js'
|
|
||||||
import { YXmlFragment, YXmlElement, YXmlText, YXmlHook } from './Type/y-xml/y-xml.js'
|
|
||||||
import BinaryDecoder from './Binary/Decoder.js'
|
|
||||||
import { getRelativePosition, fromRelativePosition } from './Util/relativePosition.js'
|
|
||||||
import { addStruct as addType } from './Util/structReferences.js'
|
|
||||||
|
|
||||||
import debug from 'debug'
|
|
||||||
import Transaction from './Transaction.js'
|
import Transaction from './Transaction.js'
|
||||||
|
|
||||||
import TextareaBinding from './Binding/TextareaBinding.js'
|
/**
|
||||||
import QuillBinding from './Binding/QuillBinding.js'
|
* A positive natural number including zero: 0, 1, 2, ..
|
||||||
|
*
|
||||||
import { toBinary, fromBinary } from './MessageHandler/binaryEncode.js'
|
* @typedef {number} NaturalNumber
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Anything that can be encoded with `JSON.stringify` and can be decoded with
|
* Anything that can be encoded with `JSON.stringify` and can be decoded with
|
||||||
@ -116,6 +101,9 @@ export default class Y extends NamedEventHandler {
|
|||||||
* other peers.
|
* other peers.
|
||||||
*
|
*
|
||||||
* @param {Function} f The function that should be executed as a transaction
|
* @param {Function} f The function that should be executed as a transaction
|
||||||
|
* @param {?Boolean} remote Optional. Whether this transaction is initiated by
|
||||||
|
* a remote peer. This should not be set manually!
|
||||||
|
* Defaults to false.
|
||||||
*/
|
*/
|
||||||
transact (f, remote = false) {
|
transact (f, remote = false) {
|
||||||
let initialCall = this._transaction === null
|
let initialCall = this._transaction === null
|
||||||
@ -276,15 +264,6 @@ export default class Y extends NamedEventHandler {
|
|||||||
this.ds = null
|
this.ds = null
|
||||||
this.ss = null
|
this.ss = null
|
||||||
}
|
}
|
||||||
|
|
||||||
whenSynced () {
|
|
||||||
// TODO: remove this method
|
|
||||||
return new Promise(resolve => {
|
|
||||||
this.once('synced', () => {
|
|
||||||
resolve()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Y.extend = function extendYjs () {
|
Y.extend = function extendYjs () {
|
||||||
@ -297,32 +276,3 @@ Y.extend = function extendYjs () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: The following assignments should be moved to yjs-dist
|
|
||||||
Y.AbstractConnector = Connector
|
|
||||||
Y.AbstractPersistence = Persistence
|
|
||||||
Y.Array = YArray
|
|
||||||
Y.Map = YMap
|
|
||||||
Y.Text = YText
|
|
||||||
Y.XmlElement = YXmlElement
|
|
||||||
Y.XmlFragment = YXmlFragment
|
|
||||||
Y.XmlText = YXmlText
|
|
||||||
Y.XmlHook = YXmlHook
|
|
||||||
|
|
||||||
Y.TextareaBinding = TextareaBinding
|
|
||||||
Y.QuillBinding = QuillBinding
|
|
||||||
|
|
||||||
Y.utils = {
|
|
||||||
BinaryDecoder,
|
|
||||||
UndoManager,
|
|
||||||
getRelativePosition,
|
|
||||||
fromRelativePosition,
|
|
||||||
addType,
|
|
||||||
integrateRemoteStructs,
|
|
||||||
toBinary,
|
|
||||||
fromBinary
|
|
||||||
}
|
|
||||||
|
|
||||||
Y.debug = debug
|
|
||||||
debug.formatters.Y = messageToString
|
|
||||||
debug.formatters.y = messageToRoomname
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
|
|
||||||
import Y from './Y.js'
|
|
||||||
export default Y
|
|
@ -1,6 +1,6 @@
|
|||||||
import { test } from '../node_modules/cutest/cutest.mjs'
|
import { test } from '../node_modules/cutest/cutest.mjs'
|
||||||
import BinaryEncoder from '../src/Binary/Encoder.js'
|
import BinaryEncoder from '../src/Util/Binary/Encoder.js'
|
||||||
import BinaryDecoder from '../src/Binary/Decoder.js'
|
import BinaryDecoder from '../src/Util/Binary/Decoder.js'
|
||||||
import { generateUserID } from '../src/Util/generateUserID.js'
|
import { generateUserID } from '../src/Util/generateUserID.js'
|
||||||
import Chance from 'chance'
|
import Chance from 'chance'
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import RedBlackTree from '../src/Util/Tree.js'
|
import RedBlackTree from '../src/Util/Tree.js'
|
||||||
import ID from '../src/Util/ID.js'
|
import ID from '../src/Util/ID/ID.js.js'
|
||||||
import Chance from 'chance'
|
import Chance from 'chance'
|
||||||
import { test, proxyConsole } from 'cutest'
|
import { test, proxyConsole } from 'cutest'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user