mjs nodejs support

This commit is contained in:
Kevin Jahns
2018-11-25 22:39:30 +01:00
parent e4a5f2caec
commit c12d00b227
122 changed files with 669 additions and 503 deletions

View File

@@ -2,13 +2,13 @@
* @module types
*/
import { Type } from '../structs/Type.js'
import { ItemJSON } from '../structs/ItemJSON.js'
import { ItemString } from '../structs/ItemString.js'
import { stringifyItemID, logItemHelper } from '../protocols/syncProtocol.js'
import { YEvent } from '../utils/YEvent.js'
import { Transaction } from '../utils/Transaction.js' // eslint-disable-line
import { Item } from '../structs/Item.js' // eslint-disable-line
import { Type } from '../structs/Type.mjs'
import { ItemJSON } from '../structs/ItemJSON.mjs'
import { ItemString } from '../structs/ItemString.mjs'
import { stringifyItemID, logItemHelper } from '../protocols/syncProtocol.mjs'
import { YEvent } from '../utils/YEvent.mjs'
import { Transaction } from '../utils/Transaction.mjs' // eslint-disable-line
import { Item } from '../structs/Item.mjs' // eslint-disable-line
/**
* Event that describes the changes on a YArray
@@ -73,8 +73,9 @@ export class YArrayEvent extends YEvent {
*/
export class YArray extends Type {
/**
* @private
* Creates YArray Event and calls observers.
*
* @private
*/
_callObserver (transaction, parentSubs, remote) {
this._callEventHandler(transaction, new YArrayEvent(this, remote, transaction))
@@ -243,9 +244,9 @@ export class YArray extends Type {
}
/**
* @private
* Inserts content after an element container.
*
* @private
* @param {Item} left The element container to use as a reference.
* @param {Array} content The Array of content to insert (see {@see insert})
*/

View File

@@ -2,11 +2,11 @@
* @module types
*/
import { Item } from '../structs/Item.js'
import { Type } from '../structs/Type.js'
import { ItemJSON } from '../structs/ItemJSON.js'
import { logItemHelper } from '../protocols/syncProtocol.js'
import { YEvent } from '../utils/YEvent.js'
import { Item } from '../structs/Item.mjs'
import { Type } from '../structs/Type.mjs'
import { ItemJSON } from '../structs/ItemJSON.mjs'
import { logItemHelper } from '../protocols/syncProtocol.mjs'
import { YEvent } from '../utils/YEvent.mjs'
/**
* Event that describes the changes on a YMap.
@@ -29,8 +29,9 @@ export class YMapEvent extends YEvent {
*/
export class YMap extends Type {
/**
* @private
* Creates YMap Event and calls observers.
*
* @private
*/
_callObserver (transaction, parentSubs, remote) {
this._callEventHandler(transaction, new YMapEvent(this, parentSubs, remote))

View File

@@ -2,11 +2,11 @@
* @module types
*/
import { ItemEmbed } from '../structs/ItemEmbed.js'
import { ItemString } from '../structs/ItemString.js'
import { ItemFormat } from '../structs/ItemFormat.js'
import { logItemHelper } from '../protocols/syncProtocol.js'
import { YArrayEvent, YArray } from './YArray.js'
import { ItemEmbed } from '../structs/ItemEmbed.mjs'
import { ItemString } from '../structs/ItemString.mjs'
import { ItemFormat } from '../structs/ItemFormat.mjs'
import { logItemHelper } from '../protocols/syncProtocol.mjs'
import { YArrayEvent, YArray } from './YArray.mjs'
/**
* @private
@@ -464,7 +464,7 @@ class YTextEvent extends YArrayEvent {
*/
export class YText extends YArray {
/**
* @param {String} string The initial value of the YText.
* @param {String} [string] The initial value of the YText.
*/
constructor (string) {
super()
@@ -477,8 +477,9 @@ export class YText extends YArray {
}
/**
* @private
* Creates YMap Event and calls observers.
*
* @private
*/
_callObserver (transaction, parentSubs, remote) {
this._callEventHandler(transaction, new YTextEvent(this, remote, transaction))

View File

@@ -2,16 +2,16 @@
* @module types
*/
import { YMap } from './YMap.js'
import { createAssociation } from '../bindings/dom/util.js'
import * as encoding from '../lib/encoding.js'
import * as decoding from '../lib/decoding.js'
import { Y } from '../utils/Y.js' // eslint-disable-line
import { DomBinding } from '../bindings/dom/DomBinding.js' // eslint-disable-line
import { YXmlTreeWalker } from './YXmlTreeWalker.js'
import { YArray } from './YArray.js'
import { YXmlEvent } from './YXmlEvent.js'
import { logItemHelper } from '../protocols/syncProtocol.js'
import { YMap } from './YMap.mjs'
import { createAssociation } from '../bindings/dom/util.mjs'
import * as encoding from '../lib/encoding.mjs'
import * as decoding from '../lib/decoding.mjs'
import { Y } from '../utils/Y.mjs' // eslint-disable-line
import { DomBinding } from '../bindings/dom/DomBinding.mjs' // eslint-disable-line
import { YXmlTreeWalker } from './YXmlTreeWalker.mjs'
import { YArray } from './YArray.mjs'
import { YXmlEvent } from './YXmlEvent.mjs'
import { logItemHelper } from '../protocols/syncProtocol.mjs'
/**
* Dom filter function.
@@ -182,8 +182,9 @@ export class YXmlElement extends YXmlFragment {
}
/**
* @private
* Creates an Item with the same effect as this Item (without position effect)
*
* @private
*/
_copy () {
let struct = super._copy()
@@ -192,11 +193,11 @@ export class YXmlElement extends YXmlFragment {
}
/**
* @private
* Read the next Item in a Decoder and fill this Item with the read data.
*
* This is called when data is received from a remote peer.
*
* @private
* @param {Y} y The Yjs instance that this Item belongs to.
* @param {decoding.Decoder} decoder The decoder object to read data from.
*/
@@ -212,9 +213,8 @@ export class YXmlElement extends YXmlFragment {
*
* This is called when this Item is sent to a remote peer.
*
* @param {encoding.Encoder} encoder The encoder to write data to.
*
* @private
* @param {encoding.Encoder} encoder The encoder to write data to.
*/
_toBinary (encoder) {
super._toBinary(encoder)
@@ -231,9 +231,8 @@ export class YXmlElement extends YXmlFragment {
* * Checks for nodeName
* * Sets domFilter
*
* @param {Y} y The Yjs instance
*
* @private
* @param {Y} y The Yjs instance
*/
_integrate (y) {
if (this.nodeName === null) {

View File

@@ -2,10 +2,10 @@
* @module types
*/
import { YEvent } from '../utils/YEvent.js'
import { YEvent } from '../utils/YEvent.mjs'
import { Type } from '../structs/Type.js' // eslint-disable-line
import { Transaction } from '../utils/Transaction.js' // eslint-disable-line
import { Type } from '../structs/Type.mjs' // eslint-disable-line
import { Transaction } from '../utils/Transaction.mjs' // eslint-disable-line
/**
* An Event that describes changes on a YXml Element or Yxml Fragment

View File

@@ -2,13 +2,13 @@
* @module types
*/
import { YMap } from './YMap.js'
import { createAssociation } from '../bindings/dom/util.js'
import * as encoding from '../lib/encoding.js'
import * as decoding from '../lib/decoding.js'
import { YMap } from './YMap.mjs'
import { createAssociation } from '../bindings/dom/util.mjs'
import * as encoding from '../lib/encoding.mjs'
import * as decoding from '../lib/decoding.mjs'
import { DomBinding } from '../bindings/dom/DomBinding.js' // eslint-disable-line
import { Y } from '../utils/Y.js' // eslint-disable-line
import { DomBinding } from '../bindings/dom/DomBinding.mjs' // eslint-disable-line
import { Y } from '../utils/Y.mjs' // eslint-disable-line
/**
* You can manage binding to a custom type with YXmlHook.

View File

@@ -2,10 +2,10 @@
* @module types
*/
import { YText } from './YText.js'
import { createAssociation } from '../bindings/dom/util.js'
import { Y } from '../index.js' // eslint-disable-line
import { DomBinding } from '../bindings/dom/DomBinding.js' // eslint-disable-line
import { YText } from './YText.mjs'
import { createAssociation } from '../bindings/dom/util.mjs'
import { Y } from '../utils/Y.mjs' // eslint-disable-line
import { DomBinding } from '../bindings/dom/DomBinding.mjs' // eslint-disable-line
/**
* Represents text in a Dom Element. In the future this type will also handle

View File

@@ -2,7 +2,7 @@
* @module types
*/
import { YXmlElement, YXmlFragment } from './YXmlElement.js' // eslint-disable-line
import { YXmlElement, YXmlFragment } from './YXmlElement.mjs' // eslint-disable-line
/**
* Define the elements to which a set of CSS queries apply.