Compare commits
31 Commits
v13.0.0-45
...
v13.0.0-55
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29760cfe53 | ||
|
|
941a22b257 | ||
|
|
4aa41b98a9 | ||
|
|
079de07eff | ||
|
|
54453e87fa | ||
|
|
1b0e3659c3 | ||
|
|
641f426339 | ||
|
|
fcbca65d8f | ||
|
|
5f8ae0dd43 | ||
|
|
de14fe0f3e | ||
|
|
5e4b071693 | ||
|
|
937de2c59f | ||
|
|
f1f1bff901 | ||
|
|
4855b2d590 | ||
|
|
908ce31e2f | ||
|
|
e4d4c23f0b | ||
|
|
fc500a8247 | ||
|
|
4b84541d76 | ||
|
|
a3ab42c157 | ||
|
|
bbd3317d62 | ||
|
|
5d3922cb64 | ||
|
|
a81a2cd553 | ||
|
|
c0d24bdba4 | ||
|
|
40e913e9c5 | ||
|
|
94f6a0fd9c | ||
|
|
41a88dbc43 | ||
|
|
1d4f283955 | ||
|
|
fc3a4c376c | ||
|
|
acb0affa33 | ||
|
|
0b510b64a3 | ||
|
|
c8f0cf5556 |
13
README.md
13
README.md
@@ -64,6 +64,19 @@ missing modules.
|
|||||||
<script src="./bower_components/yjs/y.js"></script>
|
<script src="./bower_components/yjs/y.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### CDN
|
||||||
|
```
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/yjs@12/src/y.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/y-array@10/dist/y-array.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/y-websockets-client@8/dist/y-websockets-client.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/y-memory@8/dist/y-memory.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/y-array@10/dist/y-array.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/y-map@10/dist/y-map.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/y-text@9/dist/y-text.js"></script>
|
||||||
|
// ..
|
||||||
|
// do the same for all modules you want to use
|
||||||
|
```
|
||||||
|
|
||||||
### Npm
|
### Npm
|
||||||
```
|
```
|
||||||
npm install --save yjs % add all y-* modules you want to use
|
npm install --save yjs % add all y-* modules you want to use
|
||||||
|
|||||||
@@ -24,7 +24,8 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div id="aceContainer"></div>
|
<div id="aceContainer"></div>
|
||||||
<script src="../bower_components/yjs/y.js"></script>
|
<script src="../../y.js"></script>
|
||||||
|
<script src='../../../y-websockets-client/y-websockets-client.js'></script>
|
||||||
<script src="../bower_components/ace-builds/src/ace.js"></script>
|
<script src="../bower_components/ace-builds/src/ace.js"></script>
|
||||||
|
|
||||||
<script src="./index.js"></script>
|
<script src="./index.js"></script>
|
||||||
|
|||||||
@@ -1,24 +1,17 @@
|
|||||||
/* global Y, ace */
|
/* global Y, ace */
|
||||||
|
|
||||||
Y({
|
let y = new Y('ace-example', {
|
||||||
db: {
|
|
||||||
name: 'memory'
|
|
||||||
},
|
|
||||||
connector: {
|
connector: {
|
||||||
name: 'websockets-client',
|
name: 'websockets-client',
|
||||||
room: 'ace-example'
|
url: 'http://127.0.0.1:1234'
|
||||||
},
|
|
||||||
sourceDir: '/bower_components',
|
|
||||||
share: {
|
|
||||||
ace: 'Text' // y.share.textarea is of type Y.Text
|
|
||||||
}
|
}
|
||||||
}).then(function (y) {
|
|
||||||
window.yAce = y
|
|
||||||
|
|
||||||
// bind the textarea to a shared text element
|
|
||||||
var editor = ace.edit('aceContainer')
|
|
||||||
editor.setTheme('ace/theme/chrome')
|
|
||||||
editor.getSession().setMode('ace/mode/javascript')
|
|
||||||
|
|
||||||
y.share.ace.bindAce(editor)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
window.yAce = y
|
||||||
|
|
||||||
|
// bind the textarea to a shared text element
|
||||||
|
var editor = ace.edit('aceContainer')
|
||||||
|
editor.setTheme('ace/theme/chrome')
|
||||||
|
editor.getSession().setMode('ace/mode/javascript')
|
||||||
|
|
||||||
|
y.define('ace', Y.Text).bindAce(editor)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<input type="submit" value="Send">
|
<input type="submit" value="Send">
|
||||||
</form>
|
</form>
|
||||||
<script src="../../y.js"></script>
|
<script src="../../y.js"></script>
|
||||||
<script src="../../../y-websockets-client/dist/y-websockets-client.js"></script>
|
<script src='../../../y-websockets-client/y-websockets-client.js'></script>
|
||||||
<script src="./index.js"></script>
|
<script src="./index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
/* global Y */
|
/* global Y */
|
||||||
|
|
||||||
// initialize a shared object. This function call returns a promise!
|
let y = new Y('chat-example', {
|
||||||
var y = new Y({
|
|
||||||
connector: {
|
connector: {
|
||||||
name: 'websockets-client',
|
name: 'websockets-client',
|
||||||
room: 'chat-example'
|
url: 'http://127.0.0.1:1234'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -23,6 +22,7 @@ function appendMessage (message, position) {
|
|||||||
p.appendChild(document.createTextNode(message.message))
|
p.appendChild(document.createTextNode(message.message))
|
||||||
chatcontainer.insertBefore(p, chatcontainer.children[position] || null)
|
chatcontainer.insertBefore(p, chatcontainer.children[position] || null)
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function makes sure that only 7 messages exist in the chat history.
|
// This function makes sure that only 7 messages exist in the chat history.
|
||||||
// The rest is deleted
|
// The rest is deleted
|
||||||
function cleanupChat () {
|
function cleanupChat () {
|
||||||
@@ -30,23 +30,17 @@ function cleanupChat () {
|
|||||||
chatprotocol.delete(0, chatprotocol.length - 7)
|
chatprotocol.delete(0, chatprotocol.length - 7)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cleanupChat()
|
||||||
|
|
||||||
// Insert the initial content
|
// Insert the initial content
|
||||||
chatprotocol.toArray().forEach(appendMessage)
|
chatprotocol.toArray().forEach(appendMessage)
|
||||||
cleanupChat()
|
|
||||||
|
|
||||||
// whenever content changes, make sure to reflect the changes in the DOM
|
// whenever content changes, make sure to reflect the changes in the DOM
|
||||||
chatprotocol.observe(function (event) {
|
chatprotocol.observe(function (event) {
|
||||||
if (event.type === 'insert') {
|
|
||||||
for (let i = 0; i < event.length; i++) {
|
|
||||||
appendMessage(event.values[i], event.index + i)
|
|
||||||
}
|
|
||||||
} else if (event.type === 'delete') {
|
|
||||||
for (let i = 0; i < event.length; i++) {
|
|
||||||
chatcontainer.children[event.index].remove()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// concurrent insertions may result in a history > 7, so cleanup here
|
// concurrent insertions may result in a history > 7, so cleanup here
|
||||||
cleanupChat()
|
cleanupChat()
|
||||||
|
chatcontainer.innerHTML = ''
|
||||||
|
chatprotocol.toArray().forEach(appendMessage)
|
||||||
})
|
})
|
||||||
document.querySelector('#chatform').onsubmit = function (event) {
|
document.querySelector('#chatform').onsubmit = function (event) {
|
||||||
// the form is submitted
|
// the form is submitted
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="codeMirrorContainer"></div>
|
<div id="codeMirrorContainer"></div>
|
||||||
|
|
||||||
<script src="../bower_components/yjs/y.js"></script>
|
<script src="../../y.js"></script>
|
||||||
|
<script src='../../../y-websockets-client/y-websockets-client.js'></script>
|
||||||
<script src="../bower_components/codemirror/lib/codemirror.js"></script>
|
<script src="../bower_components/codemirror/lib/codemirror.js"></script>
|
||||||
<script src="../bower_components/codemirror/mode/javascript/javascript.js"></script>
|
<script src="../bower_components/codemirror/mode/javascript/javascript.js"></script>
|
||||||
<link rel="stylesheet" href="../bower_components/codemirror/lib/codemirror.css">
|
<link rel="stylesheet" href="../bower_components/codemirror/lib/codemirror.css">
|
||||||
|
|||||||
@@ -1,24 +1,16 @@
|
|||||||
/* global Y, CodeMirror */
|
/* global Y, CodeMirror */
|
||||||
|
|
||||||
// initialize a shared object. This function call returns a promise!
|
let y = new Y('codemirror-example', {
|
||||||
Y({
|
|
||||||
db: {
|
|
||||||
name: 'memory'
|
|
||||||
},
|
|
||||||
connector: {
|
connector: {
|
||||||
name: 'websockets-client',
|
name: 'websockets-client',
|
||||||
room: 'codemirror-example'
|
url: 'http://127.0.0.1:1234'
|
||||||
},
|
|
||||||
sourceDir: '/bower_components',
|
|
||||||
share: {
|
|
||||||
codemirror: 'Text' // y.share.codemirror is of type Y.Text
|
|
||||||
}
|
}
|
||||||
}).then(function (y) {
|
|
||||||
window.yCodeMirror = y
|
|
||||||
|
|
||||||
var editor = CodeMirror(document.querySelector('#codeMirrorContainer'), {
|
|
||||||
mode: 'javascript',
|
|
||||||
lineNumbers: true
|
|
||||||
})
|
|
||||||
y.share.codemirror.bindCodeMirror(editor)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
window.yCodeMirror = y
|
||||||
|
|
||||||
|
var editor = CodeMirror(document.querySelector('#codeMirrorContainer'), {
|
||||||
|
mode: 'javascript',
|
||||||
|
lineNumbers: true
|
||||||
|
})
|
||||||
|
y.define('codemirror', Y.Text).bindCodeMirror(editor)
|
||||||
|
|||||||
@@ -12,7 +12,8 @@
|
|||||||
</style>
|
</style>
|
||||||
<button type="button" id="clearDrawingCanvas">Clear Drawing</button>
|
<button type="button" id="clearDrawingCanvas">Clear Drawing</button>
|
||||||
<svg id="drawingCanvas" viewbox="0 0 100 100" width="100%"></svg>
|
<svg id="drawingCanvas" viewbox="0 0 100 100" width="100%"></svg>
|
||||||
<script src="../yjs-dist.js"></script>
|
<script src="../../y.js"></script>
|
||||||
|
<script src='../../../y-websockets-client/y-websockets-client.js'></script>
|
||||||
<script src="../bower_components/d3/d3.min.js"></script>
|
<script src="../bower_components/d3/d3.min.js"></script>
|
||||||
<script src="./index.js"></script>
|
<script src="./index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
/* globals Y, d3 */
|
/* globals Y, d3 */
|
||||||
|
|
||||||
let y = new Y({
|
let y = new Y('drawing-example', {
|
||||||
connector: {
|
connector: {
|
||||||
name: 'websockets-client',
|
name: 'websockets-client',
|
||||||
url: 'http://127.0.0.1:1234',
|
url: 'http://127.0.0.1:1234'
|
||||||
room: 'drawing-example'
|
|
||||||
// maxBufferLength: 100
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
</head>
|
</head>
|
||||||
<script src="../yjs-dist.js"></script>
|
<script src="../../y.js"></script>
|
||||||
|
<script src='../../../y-websockets-client/y-websockets-client.js'></script>
|
||||||
<script src="../bower_components/d3/d3.min.js"></script>
|
<script src="../bower_components/d3/d3.min.js"></script>
|
||||||
<script src="./index.js"></script>
|
<script src="./index.js"></script>
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -107,15 +107,13 @@ Y.XmlHook.addHook('magic-drawing', {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// initialize a shared object. This function call returns a promise!
|
let y = new Y('html-editor-drawing-hook-example', {
|
||||||
let y = new Y({
|
|
||||||
connector: {
|
connector: {
|
||||||
name: 'websockets-client',
|
name: 'websockets-client',
|
||||||
url: 'http://127.0.0.1:1234',
|
url: 'http://127.0.0.1:1234'
|
||||||
room: 'html-editor-example6'
|
|
||||||
// maxBufferLength: 100
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
window.yXml = y
|
window.yXml = y
|
||||||
window.yXmlType = y.define('xml', Y.XmlFragment)
|
window.yXmlType = y.define('xml', Y.XmlFragment)
|
||||||
window.undoManager = new Y.utils.UndoManager(window.yXmlType, {
|
window.undoManager = new Y.utils.UndoManager(window.yXmlType, {
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
</head>
|
</head>
|
||||||
<script src="../yjs-dist.js"></script>
|
<script src="../../y.js"></script>
|
||||||
|
<script src='../../../y-websockets-client/y-websockets-client.js'></script>
|
||||||
<script src="./index.js"></script>
|
<script src="./index.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body contenteditable="true">
|
<body contenteditable="true">
|
||||||
|
|||||||
@@ -4,25 +4,21 @@ window.onload = function () {
|
|||||||
window.yXmlType.bindToDom(document.body)
|
window.yXmlType.bindToDom(document.body)
|
||||||
}
|
}
|
||||||
|
|
||||||
let persistence = null // new Y.IndexedDBPersistence()
|
let y = new Y('htmleditor', {
|
||||||
|
|
||||||
// initialize a shared object. This function call returns a promise!
|
|
||||||
let y = new Y({
|
|
||||||
connector: {
|
connector: {
|
||||||
name: 'websockets-client',
|
name: 'websockets-client',
|
||||||
url: 'http://127.0.0.1:1234',
|
url: 'http://127.0.0.1:1234'
|
||||||
room: 'x'
|
|
||||||
// maxBufferLength: 100
|
|
||||||
}
|
}
|
||||||
}, persistence)
|
})
|
||||||
window.yXml = y
|
|
||||||
|
window.y = y
|
||||||
window.yXmlType = y.define('xml', Y.XmlFragment)
|
window.yXmlType = y.define('xml', Y.XmlFragment)
|
||||||
window.undoManager = new Y.utils.UndoManager(window.yXmlType, {
|
window.undoManager = new Y.utils.UndoManager(window.yXmlType, {
|
||||||
captureTimeout: 500
|
captureTimeout: 500
|
||||||
})
|
})
|
||||||
|
|
||||||
document.onkeydown = function interceptUndoRedo (e) {
|
document.onkeydown = function interceptUndoRedo (e) {
|
||||||
if (e.keyCode === 90 && e.metaKey) {
|
if (e.keyCode === 90 && (e.metaKey || e.ctrlKey)) {
|
||||||
if (!e.shiftKey) {
|
if (!e.shiftKey) {
|
||||||
window.undoManager.undo()
|
window.undoManager.undo()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -16,6 +16,9 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script type="module" src="./index.js"></script>
|
<script src="../../y.js"></script>
|
||||||
|
<script src='../../../y-websockets-client/y-websockets-client.js'></script>
|
||||||
|
<script src='../../../y-indexeddb/y-indexeddb.js'></script>
|
||||||
|
<script src="./index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,24 +1,19 @@
|
|||||||
/* global Y, CodeMirror */
|
/* global Y, CodeMirror */
|
||||||
|
|
||||||
// initialize a shared object. This function call returns a promise!
|
const persistence = new Y.IndexedDB()
|
||||||
Y({
|
const connector = {
|
||||||
db: {
|
|
||||||
name: 'memory'
|
|
||||||
},
|
|
||||||
connector: {
|
connector: {
|
||||||
name: 'websockets-client',
|
name: 'websockets-client',
|
||||||
room: 'codemirror-example'
|
room: 'codemirror-example'
|
||||||
},
|
|
||||||
sourceDir: '/bower_components',
|
|
||||||
share: {
|
|
||||||
codemirror: 'Text' // y.share.codemirror is of type Y.Text
|
|
||||||
}
|
}
|
||||||
}).then(function (y) {
|
}
|
||||||
window.yCodeMirror = y
|
|
||||||
|
|
||||||
var editor = CodeMirror(document.querySelector('#codeMirrorContainer'), {
|
const y = new Y('codemirror-example', connector, persistence)
|
||||||
mode: 'javascript',
|
window.yCodeMirror = y
|
||||||
lineNumbers: true
|
|
||||||
})
|
var editor = CodeMirror(document.querySelector('#codeMirrorContainer'), {
|
||||||
y.share.codemirror.bindCodeMirror(editor)
|
mode: 'javascript',
|
||||||
|
lineNumbers: true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
y.define('codemirror', Y.Text).bindCodeMirror(editor)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
.one {
|
.one {
|
||||||
grid-column: 1 ;
|
grid-column: 1 ;
|
||||||
}
|
}
|
||||||
.two {
|
.two {
|
||||||
grid-column: 2;
|
grid-column: 2;
|
||||||
}
|
}
|
||||||
.three {
|
.three {
|
||||||
@@ -49,10 +49,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="../../y.js"></script>
|
<script src="../../y.js"></script>
|
||||||
<script src="../../../y-array/y-array.js"></script>
|
<script src='../../../y-websockets-client/y-websockets-client.js'></script>
|
||||||
<script src="../../../y-text/dist/y-text.js"></script>
|
|
||||||
<script src="../../../y-memory/y-memory.js"></script>
|
|
||||||
<script src="../../../y-websockets-client/y-websockets-client.js"></script>
|
|
||||||
<script src="./index.js"></script>
|
<script src="./index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,64 +1,38 @@
|
|||||||
/* global Y */
|
/* global Y */
|
||||||
|
|
||||||
Y({
|
function bindYjsInstance (y, suffix) {
|
||||||
db: {
|
y.define('textarea', Y.Text).bind(document.getElementById('textarea' + suffix))
|
||||||
name: 'memory'
|
|
||||||
},
|
|
||||||
connector: {
|
|
||||||
name: 'websockets-client',
|
|
||||||
room: 'Textarea-example',
|
|
||||||
url: 'https://yjs-v13.herokuapp.com/'
|
|
||||||
},
|
|
||||||
share: {
|
|
||||||
textarea: 'Text'
|
|
||||||
}
|
|
||||||
}).then(function (y) {
|
|
||||||
window.y1 = y
|
|
||||||
y.share.textarea.bind(document.getElementById('textarea1'))
|
|
||||||
})
|
|
||||||
|
|
||||||
Y({
|
|
||||||
db: {
|
|
||||||
name: 'memory'
|
|
||||||
},
|
|
||||||
connector: {
|
|
||||||
name: 'websockets-client',
|
|
||||||
room: 'Textarea-example',
|
|
||||||
url: 'https://yjs-v13-second.herokuapp.com/'
|
|
||||||
},
|
|
||||||
share: {
|
|
||||||
textarea: 'Text'
|
|
||||||
}
|
|
||||||
}).then(function (y) {
|
|
||||||
window.y2 = y
|
|
||||||
y.share.textarea.bind(document.getElementById('textarea2'))
|
|
||||||
y.connector.socket.on('connection', function () {
|
y.connector.socket.on('connection', function () {
|
||||||
document.getElementById('container2').removeAttribute('disconnected')
|
document.getElementById('container' + suffix).removeAttribute('disconnected')
|
||||||
})
|
})
|
||||||
y.connector.socket.on('disconnect', function () {
|
y.connector.socket.on('disconnect', function () {
|
||||||
document.getElementById('container2').setAttribute('disconnected', true)
|
document.getElementById('container' + suffix).setAttribute('disconnected', true)
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
|
|
||||||
Y({
|
let y1 = new Y('infinite-example', {
|
||||||
db: {
|
|
||||||
name: 'memory'
|
|
||||||
},
|
|
||||||
connector: {
|
connector: {
|
||||||
name: 'websockets-client',
|
name: 'websockets-client',
|
||||||
room: 'Textarea-example',
|
url: 'http://127.0.0.1:1234'
|
||||||
url: 'https://yjs-v13-third.herokuapp.com/'
|
|
||||||
},
|
|
||||||
share: {
|
|
||||||
textarea: 'Text'
|
|
||||||
}
|
}
|
||||||
}).then(function (y) {
|
|
||||||
window.y3 = y
|
|
||||||
y.share.textarea.bind(document.getElementById('textarea3'))
|
|
||||||
y.connector.socket.on('connection', function () {
|
|
||||||
document.getElementById('container3').removeAttribute('disconnected')
|
|
||||||
})
|
|
||||||
y.connector.socket.on('disconnect', function () {
|
|
||||||
document.getElementById('container3').setAttribute('disconnected', true)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
window.y1 = y1
|
||||||
|
bindYjsInstance(y1, '1')
|
||||||
|
|
||||||
|
let y2 = new Y('infinite-example', {
|
||||||
|
connector: {
|
||||||
|
name: 'websockets-client',
|
||||||
|
url: 'http://127.0.0.1:1234'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
window.y2 = y2
|
||||||
|
bindYjsInstance(y2, '2')
|
||||||
|
|
||||||
|
let y3 = new Y('infinite-example', {
|
||||||
|
connector: {
|
||||||
|
name: 'websockets-client',
|
||||||
|
url: 'http://127.0.0.1:1234'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
window.y3 = y3
|
||||||
|
bindYjsInstance(y1, '3')
|
||||||
|
|||||||
@@ -17,9 +17,7 @@
|
|||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
<script src="../../y.js"></script>
|
<script src="../../y.js"></script>
|
||||||
<script src="../../../y-map/dist/y-map.js"></script>
|
<script src='../../../y-websockets-client/y-websockets-client.js'></script>
|
||||||
<script src="../../../y-memory/y-memory.js"></script>
|
|
||||||
<script src="../../../y-websockets-client/y-websockets-client.js"></script>
|
|
||||||
<script src="../bower_components/d3/d3.js"></script>
|
<script src="../bower_components/d3/d3.js"></script>
|
||||||
<script src="./index.js"></script>
|
<script src="./index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,74 +1,67 @@
|
|||||||
/* @flow */
|
|
||||||
/* global Y, d3 */
|
/* global Y, d3 */
|
||||||
|
|
||||||
// initialize a shared object. This function call returns a promise!
|
let y = new Y('jigsaw-example', {
|
||||||
Y({
|
|
||||||
db: {
|
|
||||||
name: 'memory'
|
|
||||||
},
|
|
||||||
connector: {
|
connector: {
|
||||||
name: 'websockets-client',
|
name: 'websockets-client',
|
||||||
room: 'Puzzle-example',
|
url: 'http://127.0.0.1:1234'
|
||||||
url: 'http://localhost:1234'
|
|
||||||
},
|
|
||||||
share: {
|
|
||||||
piece1: 'Map',
|
|
||||||
piece2: 'Map',
|
|
||||||
piece3: 'Map',
|
|
||||||
piece4: 'Map'
|
|
||||||
}
|
}
|
||||||
}).then(function (y) {
|
})
|
||||||
window.yJigsaw = y
|
|
||||||
var origin // mouse start position - translation of piece
|
|
||||||
var drag = d3.behavior.drag()
|
|
||||||
.on('dragstart', function (params) {
|
|
||||||
// get the translation of the element
|
|
||||||
var translation = d3
|
|
||||||
.select(this)
|
|
||||||
.attr('transform')
|
|
||||||
.slice(10, -1)
|
|
||||||
.split(',')
|
|
||||||
.map(Number)
|
|
||||||
// mouse coordinates
|
|
||||||
var mouse = d3.mouse(this.parentNode)
|
|
||||||
origin = {
|
|
||||||
x: mouse[0] - translation[0],
|
|
||||||
y: mouse[1] - translation[1]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.on('drag', function () {
|
|
||||||
var mouse = d3.mouse(this.parentNode)
|
|
||||||
var x = mouse[0] - origin.x // =^= mouse - mouse at dragstart + translation at dragstart
|
|
||||||
var y = mouse[1] - origin.y
|
|
||||||
d3.select(this).attr('transform', 'translate(' + x + ',' + y + ')')
|
|
||||||
})
|
|
||||||
.on('dragend', function (piece, i) {
|
|
||||||
// save the current translation of the puzzle piece
|
|
||||||
var mouse = d3.mouse(this.parentNode)
|
|
||||||
var x = mouse[0] - origin.x
|
|
||||||
var y = mouse[1] - origin.y
|
|
||||||
piece.set('translation', {x: x, y: y})
|
|
||||||
})
|
|
||||||
|
|
||||||
var data = [y.share.piece1, y.share.piece2, y.share.piece3, y.share.piece4]
|
let jigsaw = y.define('jigsaw', Y.Map)
|
||||||
var pieces = d3.select(document.querySelector('#puzzle-example')).selectAll('path').data(data)
|
window.yJigsaw = y
|
||||||
|
|
||||||
pieces
|
var origin // mouse start position - translation of piece
|
||||||
.classed('draggable', true)
|
var drag = d3.behavior.drag()
|
||||||
.attr('transform', function (piece) {
|
.on('dragstart', function (params) {
|
||||||
var translation = piece.get('translation') || {x: 0, y: 0}
|
// get the translation of the element
|
||||||
return 'translate(' + translation.x + ',' + translation.y + ')'
|
var translation = d3
|
||||||
}).call(drag)
|
.select(this)
|
||||||
|
.attr('transform')
|
||||||
|
.slice(10, -1)
|
||||||
|
.split(',')
|
||||||
|
.map(Number)
|
||||||
|
// mouse coordinates
|
||||||
|
var mouse = d3.mouse(this.parentNode)
|
||||||
|
origin = {
|
||||||
|
x: mouse[0] - translation[0],
|
||||||
|
y: mouse[1] - translation[1]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.on('drag', function () {
|
||||||
|
var mouse = d3.mouse(this.parentNode)
|
||||||
|
var x = mouse[0] - origin.x // =^= mouse - mouse at dragstart + translation at dragstart
|
||||||
|
var y = mouse[1] - origin.y
|
||||||
|
d3.select(this).attr('transform', 'translate(' + x + ',' + y + ')')
|
||||||
|
})
|
||||||
|
.on('dragend', function (piece, i) {
|
||||||
|
// save the current translation of the puzzle piece
|
||||||
|
var mouse = d3.mouse(this.parentNode)
|
||||||
|
var x = mouse[0] - origin.x
|
||||||
|
var y = mouse[1] - origin.y
|
||||||
|
jigsaw.set(piece, {x: x, y: y})
|
||||||
|
})
|
||||||
|
|
||||||
data.forEach(function (piece) {
|
var data = ['piece1', 'piece2', 'piece3', 'piece4']
|
||||||
piece.observe(function () {
|
var pieces = d3.select(document.querySelector('#puzzle-example')).selectAll('path').data(data)
|
||||||
// whenever a property of a piece changes, update the translation of the pieces
|
|
||||||
pieces
|
pieces
|
||||||
.transition()
|
.classed('draggable', true)
|
||||||
.attr('transform', function (piece) {
|
.attr('transform', function (piece) {
|
||||||
var translation = piece.get('translation') || {x: 0, y: 0}
|
var translation = piece.get('translation') || {x: 0, y: 0}
|
||||||
return 'translate(' + translation.x + ',' + translation.y + ')'
|
return 'translate(' + translation.x + ',' + translation.y + ')'
|
||||||
})
|
}).call(drag)
|
||||||
})
|
|
||||||
|
data.forEach(function (piece) {
|
||||||
|
jigsaw.observe(function () {
|
||||||
|
// whenever a property of a piece changes, update the translation of the pieces
|
||||||
|
pieces
|
||||||
|
.transition()
|
||||||
|
.attr('transform', function (piece) {
|
||||||
|
var translation = piece.get(piece)
|
||||||
|
if (translation == null || typeof translation.x !== 'number' || typeof translation.y !== 'number') {
|
||||||
|
translation = { x: 0, y: 0 }
|
||||||
|
}
|
||||||
|
return 'translate(' + translation.x + ',' + translation.y + ')'
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script src="../bower_components/yjs/y.js"></script>
|
<script src="../../y.js"></script>
|
||||||
<script src="../bower_components/y-websockets-client/y-websockets-client.js"></script>
|
<script src='../../../y-websockets-client/y-websockets-client.js'></script>
|
||||||
<script src="../node_modules/monaco-editor/min/vs/loader.js"></script>
|
<script src="../node_modules/monaco-editor/min/vs/loader.js"></script>
|
||||||
<script src="./index.js"></script>
|
<script src="./index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -2,29 +2,21 @@
|
|||||||
|
|
||||||
require.config({ paths: { 'vs': '../node_modules/monaco-editor/min/vs' } })
|
require.config({ paths: { 'vs': '../node_modules/monaco-editor/min/vs' } })
|
||||||
|
|
||||||
require(['vs/editor/editor.main'], function () {
|
let y = new Y('monaco-example', {
|
||||||
// Initialize a shared object. This function call returns a promise!
|
connector: {
|
||||||
Y({
|
name: 'websockets-client',
|
||||||
db: {
|
url: 'http://127.0.0.1:1234'
|
||||||
name: 'memory'
|
}
|
||||||
},
|
})
|
||||||
connector: {
|
|
||||||
name: 'websockets-client',
|
require(['vs/editor/editor.main'], function () {
|
||||||
room: 'monaco-example'
|
window.yMonaco = y
|
||||||
},
|
|
||||||
sourceDir: '/bower_components',
|
// Create Monaco editor
|
||||||
share: {
|
var editor = monaco.editor.create(document.getElementById('monacoContainer'), {
|
||||||
monaco: 'Text' // y.share.monaco is of type Y.Text
|
language: 'javascript'
|
||||||
}
|
})
|
||||||
}).then(function (y) {
|
|
||||||
window.yMonaco = y
|
// Bind to y.share.monaco
|
||||||
|
y.define('monaco', Y.Text).bindMonaco(editor)
|
||||||
// Create Monaco editor
|
|
||||||
var editor = monaco.editor.create(document.getElementById('monacoContainer'), {
|
|
||||||
language: 'javascript'
|
|
||||||
})
|
|
||||||
|
|
||||||
// Bind to y.share.monaco
|
|
||||||
y.share.monaco.bindMonaco(editor)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -26,10 +26,7 @@
|
|||||||
<script src="../bower_components/quill/dist/quill.js"></script>
|
<script src="../bower_components/quill/dist/quill.js"></script>
|
||||||
-->
|
-->
|
||||||
<script src="../../y.js"></script>
|
<script src="../../y.js"></script>
|
||||||
<script src="../../../y-array/y-array.js"></script>
|
<script src='../../../y-websockets-client/y-websockets-client.js'></script>
|
||||||
<script src="../../../y-richtext/dist/y-richtext.js"></script>
|
|
||||||
<script src="../../../y-memory/y-memory.js"></script>
|
|
||||||
<script src="../../../y-websockets-client/y-websockets-client.js"></script>
|
|
||||||
<script src="./index.js"></script>
|
<script src="./index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
<textarea style="width:80%;" rows=40 id="textfield" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
|
<textarea style="width:80%;" rows=40 autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
|
||||||
<script src="../../y.js"></script>
|
<script src="../../y.js"></script>
|
||||||
<script src="../../../y-array/y-array.js"></script>
|
<script src='../../../y-websockets-client/y-websockets-client.js'></script>
|
||||||
<script src="../../../y-text/y-text.js"></script>
|
|
||||||
<script src="../../../y-websockets-client/y-websockets-client.js"></script>
|
|
||||||
<script src="./index.js"></script>
|
<script src="./index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,23 +1,15 @@
|
|||||||
/* global Y */
|
/* global Y */
|
||||||
|
|
||||||
// initialize a shared object. This function call returns a promise!
|
let y = new Y('textarea-example', {
|
||||||
Y({
|
|
||||||
db: {
|
|
||||||
name: 'memory'
|
|
||||||
},
|
|
||||||
connector: {
|
connector: {
|
||||||
name: 'websockets-client',
|
name: 'websockets-client',
|
||||||
room: 'Textarea-example2',
|
url: 'http://127.0.0.1:1234'
|
||||||
// url: '//localhost:1234',
|
}
|
||||||
url: 'https://yjs-v13.herokuapp.com/'
|
|
||||||
},
|
|
||||||
share: {
|
|
||||||
textarea: 'Text'
|
|
||||||
},
|
|
||||||
timeout: 5000 // reject if no connection was established within 5 seconds
|
|
||||||
}).then(function (y) {
|
|
||||||
window.yTextarea = y
|
|
||||||
|
|
||||||
// bind the textarea to a shared text element
|
|
||||||
y.share.textarea.bind(document.getElementById('textfield'))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
window.yTextarea = y
|
||||||
|
|
||||||
|
// bind the textarea to a shared text element
|
||||||
|
let type = y.define('textarea', Y.Text)
|
||||||
|
let textarea = document.querySelector('textarea')
|
||||||
|
window.binding = new Y.TextareaBinding(type, textarea)
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
</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 y-xml. 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="../yjs-dist.js"></script>
|
<script src="../../y.js"></script>
|
||||||
|
<script src='../../../y-websockets-client/y-websockets-client.js'></script>
|
||||||
<script src="./index.js"></script>
|
<script src="./index.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -1,23 +1,13 @@
|
|||||||
/* global Y */
|
/* global Y */
|
||||||
|
|
||||||
// initialize a shared object. This function call returns a promise!
|
let y = new Y('xml-example', {
|
||||||
Y({
|
|
||||||
db: {
|
|
||||||
name: 'memory'
|
|
||||||
},
|
|
||||||
connector: {
|
connector: {
|
||||||
name: 'websockets-client',
|
name: 'websockets-client',
|
||||||
// url: 'http://127.0.0.1:1234',
|
url: 'http://127.0.0.1:1234'
|
||||||
url: 'http://192.168.178.81:1234',
|
|
||||||
room: 'Xml-example'
|
|
||||||
},
|
|
||||||
sourceDir: '/bower_components',
|
|
||||||
share: {
|
|
||||||
xml: 'Xml("p")' // y.share.xml is of type Y.Xml with tagname "p"
|
|
||||||
}
|
}
|
||||||
}).then(function (y) {
|
|
||||||
window.yXml = y
|
|
||||||
// bind xml type to a dom, and put it in body
|
|
||||||
window.sharedDom = y.share.xml.getDom()
|
|
||||||
document.body.appendChild(window.sharedDom)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
window.yXml = y
|
||||||
|
// bind xml type to a dom, and put it in body
|
||||||
|
window.sharedDom = y.define('xml', Y.XmlElement).getDom()
|
||||||
|
document.body.appendChild(window.sharedDom)
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
import Y from '../src/Y.js'
|
import Y from '../src/Y.js'
|
||||||
import yWebsocketsClient from '../../y-websockets-client/src/y-websockets-client.js'
|
import yWebsocketsClient from '../../y-websockets-client/src/y-websockets-client.js'
|
||||||
import IndexedDBPersistence from '../../y-indexeddb/src/y-indexeddb.js'
|
import extendYIndexedDBPersistence from '../../y-indexeddb/src/y-indexeddb.js'
|
||||||
|
|
||||||
Y.extend(yWebsocketsClient)
|
Y.extend(yWebsocketsClient)
|
||||||
Y.IndexedDBPersistence = IndexedDBPersistence
|
extendYIndexedDBPersistence(Y)
|
||||||
|
|
||||||
export default Y
|
export default Y
|
||||||
|
|||||||
914
package-lock.json
generated
914
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yjs",
|
"name": "yjs",
|
||||||
"version": "13.0.0-45",
|
"version": "13.0.0-55",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -1039,6 +1039,7 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"anymatch": "1.3.0",
|
"anymatch": "1.3.0",
|
||||||
"async-each": "1.0.1",
|
"async-each": "1.0.1",
|
||||||
|
"fsevents": "1.1.3",
|
||||||
"glob-parent": "2.0.0",
|
"glob-parent": "2.0.0",
|
||||||
"inherits": "2.0.3",
|
"inherits": "2.0.3",
|
||||||
"is-binary-path": "1.0.1",
|
"is-binary-path": "1.0.1",
|
||||||
@@ -1990,6 +1991,910 @@
|
|||||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"fsevents": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.3.tgz",
|
||||||
|
"integrity": "sha512-WIr7iDkdmdbxu/Gh6eKEZJL6KPE74/5MEsf2whTOFNxbIoIixogroLdKYqB6FDav4Wavh/lZdzzd3b2KxIXC5Q==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"nan": "2.8.0",
|
||||||
|
"node-pre-gyp": "0.6.39"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"abbrev": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"ajv": {
|
||||||
|
"version": "4.11.8",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"co": "4.6.0",
|
||||||
|
"json-stable-stringify": "1.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ansi-regex": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"aproba": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"are-we-there-yet": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"delegates": "1.0.0",
|
||||||
|
"readable-stream": "2.2.9"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"asn1": {
|
||||||
|
"version": "0.2.3",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"assert-plus": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"asynckit": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"aws-sign2": {
|
||||||
|
"version": "0.6.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"aws4": {
|
||||||
|
"version": "1.6.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"balanced-match": {
|
||||||
|
"version": "0.4.2",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"bcrypt-pbkdf": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"tweetnacl": "0.14.5"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"block-stream": {
|
||||||
|
"version": "0.0.9",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"inherits": "2.0.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"boom": {
|
||||||
|
"version": "2.10.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"hoek": "2.16.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"brace-expansion": {
|
||||||
|
"version": "1.1.7",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"balanced-match": "0.4.2",
|
||||||
|
"concat-map": "0.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"buffer-shims": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"caseless": {
|
||||||
|
"version": "0.12.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"co": {
|
||||||
|
"version": "4.6.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"code-point-at": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"combined-stream": {
|
||||||
|
"version": "1.0.5",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"delayed-stream": "1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"concat-map": {
|
||||||
|
"version": "0.0.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"console-control-strings": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"core-util-is": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"cryptiles": {
|
||||||
|
"version": "2.0.5",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"boom": "2.10.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dashdash": {
|
||||||
|
"version": "1.14.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"assert-plus": "1.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"assert-plus": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"debug": {
|
||||||
|
"version": "2.6.8",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"ms": "2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"deep-extend": {
|
||||||
|
"version": "0.4.2",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"delayed-stream": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"delegates": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"detect-libc": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"ecc-jsbn": {
|
||||||
|
"version": "0.1.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"jsbn": "0.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extend": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"extsprintf": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"forever-agent": {
|
||||||
|
"version": "0.6.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"form-data": {
|
||||||
|
"version": "2.1.4",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"asynckit": "0.4.0",
|
||||||
|
"combined-stream": "1.0.5",
|
||||||
|
"mime-types": "2.1.15"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"fs.realpath": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"fstream": {
|
||||||
|
"version": "1.0.11",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"graceful-fs": "4.1.11",
|
||||||
|
"inherits": "2.0.3",
|
||||||
|
"mkdirp": "0.5.1",
|
||||||
|
"rimraf": "2.6.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"fstream-ignore": {
|
||||||
|
"version": "1.0.5",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"fstream": "1.0.11",
|
||||||
|
"inherits": "2.0.3",
|
||||||
|
"minimatch": "3.0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gauge": {
|
||||||
|
"version": "2.7.4",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"aproba": "1.1.1",
|
||||||
|
"console-control-strings": "1.1.0",
|
||||||
|
"has-unicode": "2.0.1",
|
||||||
|
"object-assign": "4.1.1",
|
||||||
|
"signal-exit": "3.0.2",
|
||||||
|
"string-width": "1.0.2",
|
||||||
|
"strip-ansi": "3.0.1",
|
||||||
|
"wide-align": "1.1.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"getpass": {
|
||||||
|
"version": "0.1.7",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"assert-plus": "1.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"assert-plus": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"glob": {
|
||||||
|
"version": "7.1.2",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"fs.realpath": "1.0.0",
|
||||||
|
"inflight": "1.0.6",
|
||||||
|
"inherits": "2.0.3",
|
||||||
|
"minimatch": "3.0.4",
|
||||||
|
"once": "1.4.0",
|
||||||
|
"path-is-absolute": "1.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"graceful-fs": {
|
||||||
|
"version": "4.1.11",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"har-schema": {
|
||||||
|
"version": "1.0.5",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"har-validator": {
|
||||||
|
"version": "4.2.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"ajv": "4.11.8",
|
||||||
|
"har-schema": "1.0.5"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"has-unicode": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"hawk": {
|
||||||
|
"version": "3.1.3",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"boom": "2.10.1",
|
||||||
|
"cryptiles": "2.0.5",
|
||||||
|
"hoek": "2.16.3",
|
||||||
|
"sntp": "1.0.9"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"hoek": {
|
||||||
|
"version": "2.16.3",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"http-signature": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"assert-plus": "0.2.0",
|
||||||
|
"jsprim": "1.4.0",
|
||||||
|
"sshpk": "1.13.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"inflight": {
|
||||||
|
"version": "1.0.6",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"once": "1.4.0",
|
||||||
|
"wrappy": "1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"inherits": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"ini": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"is-fullwidth-code-point": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"number-is-nan": "1.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"is-typedarray": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"isarray": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"isstream": {
|
||||||
|
"version": "0.1.2",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"jodid25519": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"jsbn": "0.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"jsbn": {
|
||||||
|
"version": "0.1.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"json-schema": {
|
||||||
|
"version": "0.2.3",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"json-stable-stringify": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"jsonify": "0.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"json-stringify-safe": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"jsonify": {
|
||||||
|
"version": "0.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"jsprim": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"assert-plus": "1.0.0",
|
||||||
|
"extsprintf": "1.0.2",
|
||||||
|
"json-schema": "0.2.3",
|
||||||
|
"verror": "1.3.6"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"assert-plus": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mime-db": {
|
||||||
|
"version": "1.27.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"mime-types": {
|
||||||
|
"version": "2.1.15",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"mime-db": "1.27.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"minimatch": {
|
||||||
|
"version": "3.0.4",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"brace-expansion": "1.1.7"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"minimist": {
|
||||||
|
"version": "0.0.8",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"mkdirp": {
|
||||||
|
"version": "0.5.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"minimist": "0.0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ms": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"node-pre-gyp": {
|
||||||
|
"version": "0.6.39",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"detect-libc": "1.0.2",
|
||||||
|
"hawk": "3.1.3",
|
||||||
|
"mkdirp": "0.5.1",
|
||||||
|
"nopt": "4.0.1",
|
||||||
|
"npmlog": "4.1.0",
|
||||||
|
"rc": "1.2.1",
|
||||||
|
"request": "2.81.0",
|
||||||
|
"rimraf": "2.6.1",
|
||||||
|
"semver": "5.3.0",
|
||||||
|
"tar": "2.2.1",
|
||||||
|
"tar-pack": "3.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nopt": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"abbrev": "1.1.0",
|
||||||
|
"osenv": "0.1.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"npmlog": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"are-we-there-yet": "1.1.4",
|
||||||
|
"console-control-strings": "1.1.0",
|
||||||
|
"gauge": "2.7.4",
|
||||||
|
"set-blocking": "2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"number-is-nan": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"oauth-sign": {
|
||||||
|
"version": "0.8.2",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"object-assign": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"once": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"wrappy": "1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"os-homedir": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"os-tmpdir": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"osenv": {
|
||||||
|
"version": "0.1.4",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"os-homedir": "1.0.2",
|
||||||
|
"os-tmpdir": "1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"path-is-absolute": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"performance-now": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"process-nextick-args": {
|
||||||
|
"version": "1.0.7",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"punycode": {
|
||||||
|
"version": "1.4.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"qs": {
|
||||||
|
"version": "6.4.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"rc": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"deep-extend": "0.4.2",
|
||||||
|
"ini": "1.3.4",
|
||||||
|
"minimist": "1.2.0",
|
||||||
|
"strip-json-comments": "2.0.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"minimist": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"readable-stream": {
|
||||||
|
"version": "2.2.9",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"buffer-shims": "1.0.0",
|
||||||
|
"core-util-is": "1.0.2",
|
||||||
|
"inherits": "2.0.3",
|
||||||
|
"isarray": "1.0.0",
|
||||||
|
"process-nextick-args": "1.0.7",
|
||||||
|
"string_decoder": "1.0.1",
|
||||||
|
"util-deprecate": "1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"request": {
|
||||||
|
"version": "2.81.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"aws-sign2": "0.6.0",
|
||||||
|
"aws4": "1.6.0",
|
||||||
|
"caseless": "0.12.0",
|
||||||
|
"combined-stream": "1.0.5",
|
||||||
|
"extend": "3.0.1",
|
||||||
|
"forever-agent": "0.6.1",
|
||||||
|
"form-data": "2.1.4",
|
||||||
|
"har-validator": "4.2.1",
|
||||||
|
"hawk": "3.1.3",
|
||||||
|
"http-signature": "1.1.1",
|
||||||
|
"is-typedarray": "1.0.0",
|
||||||
|
"isstream": "0.1.2",
|
||||||
|
"json-stringify-safe": "5.0.1",
|
||||||
|
"mime-types": "2.1.15",
|
||||||
|
"oauth-sign": "0.8.2",
|
||||||
|
"performance-now": "0.2.0",
|
||||||
|
"qs": "6.4.0",
|
||||||
|
"safe-buffer": "5.0.1",
|
||||||
|
"stringstream": "0.0.5",
|
||||||
|
"tough-cookie": "2.3.2",
|
||||||
|
"tunnel-agent": "0.6.0",
|
||||||
|
"uuid": "3.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rimraf": {
|
||||||
|
"version": "2.6.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"glob": "7.1.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"safe-buffer": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"semver": {
|
||||||
|
"version": "5.3.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"set-blocking": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"signal-exit": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"sntp": {
|
||||||
|
"version": "1.0.9",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"hoek": "2.16.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sshpk": {
|
||||||
|
"version": "1.13.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"asn1": "0.2.3",
|
||||||
|
"assert-plus": "1.0.0",
|
||||||
|
"bcrypt-pbkdf": "1.0.1",
|
||||||
|
"dashdash": "1.14.1",
|
||||||
|
"ecc-jsbn": "0.1.1",
|
||||||
|
"getpass": "0.1.7",
|
||||||
|
"jodid25519": "1.0.2",
|
||||||
|
"jsbn": "0.1.1",
|
||||||
|
"tweetnacl": "0.14.5"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"assert-plus": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"string-width": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"code-point-at": "1.1.0",
|
||||||
|
"is-fullwidth-code-point": "1.0.0",
|
||||||
|
"strip-ansi": "3.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"string_decoder": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"safe-buffer": "5.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"stringstream": {
|
||||||
|
"version": "0.0.5",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"strip-ansi": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"ansi-regex": "2.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"strip-json-comments": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"tar": {
|
||||||
|
"version": "2.2.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"block-stream": "0.0.9",
|
||||||
|
"fstream": "1.0.11",
|
||||||
|
"inherits": "2.0.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tar-pack": {
|
||||||
|
"version": "3.4.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"debug": "2.6.8",
|
||||||
|
"fstream": "1.0.11",
|
||||||
|
"fstream-ignore": "1.0.5",
|
||||||
|
"once": "1.4.0",
|
||||||
|
"readable-stream": "2.2.9",
|
||||||
|
"rimraf": "2.6.1",
|
||||||
|
"tar": "2.2.1",
|
||||||
|
"uid-number": "0.0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tough-cookie": {
|
||||||
|
"version": "2.3.2",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"punycode": "1.4.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tunnel-agent": {
|
||||||
|
"version": "0.6.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"safe-buffer": "5.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tweetnacl": {
|
||||||
|
"version": "0.14.5",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"uid-number": {
|
||||||
|
"version": "0.0.6",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"util-deprecate": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"uuid": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"verror": {
|
||||||
|
"version": "1.3.6",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"extsprintf": "1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"wide-align": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
|
"requires": {
|
||||||
|
"string-width": "1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"wrappy": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"function-bind": {
|
"function-bind": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.0.tgz",
|
||||||
@@ -2938,6 +3843,13 @@
|
|||||||
"integrity": "sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA=",
|
"integrity": "sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"nan": {
|
||||||
|
"version": "2.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/nan/-/nan-2.8.0.tgz",
|
||||||
|
"integrity": "sha1-7XFfP+neArV6XmJS2QqWZ14fCFo=",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"natural-compare": {
|
"natural-compare": {
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yjs",
|
"name": "yjs",
|
||||||
"version": "13.0.0-45",
|
"version": "13.0.0-55",
|
||||||
"description": "A framework for real-time p2p shared editing on any data",
|
"description": "A framework for real-time p2p shared editing on any data",
|
||||||
"main": "./y.node.js",
|
"main": "./y.node.js",
|
||||||
"browser": "./y.js",
|
"browser": "./y.js",
|
||||||
|
|||||||
14
src/Binding/Binding.js
Normal file
14
src/Binding/Binding.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
import { createMutualExclude } from '../Util/mutualExclude.js'
|
||||||
|
|
||||||
|
export default class Binding {
|
||||||
|
constructor (type, target) {
|
||||||
|
this.type = type
|
||||||
|
this.target = target
|
||||||
|
this._mutualExclude = createMutualExclude()
|
||||||
|
}
|
||||||
|
destroy () {
|
||||||
|
this.type = null
|
||||||
|
this.target = null
|
||||||
|
}
|
||||||
|
}
|
||||||
0
src/Binding/DomBinding.js
Normal file
0
src/Binding/DomBinding.js
Normal file
45
src/Binding/TextareaBinding.js
Normal file
45
src/Binding/TextareaBinding.js
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
import Binding from './Binding.js'
|
||||||
|
import simpleDiff from '../Util/simpleDiff.js'
|
||||||
|
import { getRelativePosition, fromRelativePosition } from '../Util/relativePosition.js'
|
||||||
|
|
||||||
|
function typeObserver () {
|
||||||
|
this._mutualExclude(() => {
|
||||||
|
const textarea = this.target
|
||||||
|
const textType = this.type
|
||||||
|
const relativeStart = getRelativePosition(textType, textarea.selectionStart)
|
||||||
|
const relativeEnd = getRelativePosition(textType, textarea.selectionEnd)
|
||||||
|
textarea.value = textType.toString()
|
||||||
|
const start = fromRelativePosition(textType._y, relativeStart)
|
||||||
|
const end = fromRelativePosition(textType._y, relativeEnd)
|
||||||
|
textarea.setSelectionRange(start, end)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function domObserver () {
|
||||||
|
this._mutualExclude(() => {
|
||||||
|
let diff = simpleDiff(this.type.toString(), this.target.value)
|
||||||
|
this.type.delete(diff.pos, diff.remove)
|
||||||
|
this.type.insert(diff.pos, diff.insert)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class TextareaBinding extends Binding {
|
||||||
|
constructor (textType, domTextarea) {
|
||||||
|
// Binding handles textType as this.type and domTextarea as this.target
|
||||||
|
super(textType, domTextarea)
|
||||||
|
// set initial value
|
||||||
|
domTextarea.value = textType.toString()
|
||||||
|
// Observers are handled by this class
|
||||||
|
this._typeObserver = typeObserver.bind(this)
|
||||||
|
this._domObserver = domObserver.bind(this)
|
||||||
|
textType.observe(this._typeObserver)
|
||||||
|
domTextarea.addEventListener('input', this._domObserver)
|
||||||
|
}
|
||||||
|
destroy () {
|
||||||
|
// Remove everything that is handled by this class
|
||||||
|
this.type.unobserve(this._typeObserver)
|
||||||
|
this.target.unobserve(this._domObserver)
|
||||||
|
super.destroy()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,8 +4,10 @@ import { readDeleteSet, writeDeleteSet } from './deleteSet.js'
|
|||||||
import BinaryEncoder from '../Binary/Encoder.js'
|
import BinaryEncoder from '../Binary/Encoder.js'
|
||||||
|
|
||||||
export function fromBinary (y, decoder) {
|
export function fromBinary (y, decoder) {
|
||||||
integrateRemoteStructs(y, decoder)
|
y.transact(function () {
|
||||||
readDeleteSet(y, decoder)
|
integrateRemoteStructs(y, decoder)
|
||||||
|
readDeleteSet(y, decoder)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toBinary (y) {
|
export function toBinary (y) {
|
||||||
|
|||||||
@@ -17,40 +17,63 @@ export default class AbstractPersistence {
|
|||||||
constructor (opts) {
|
constructor (opts) {
|
||||||
this.opts = opts
|
this.opts = opts
|
||||||
this.ys = new Map()
|
this.ys = new Map()
|
||||||
this.mutualExclude = createMutualExclude()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_init (y) {
|
_init (y) {
|
||||||
let cnf = this.ys.get(y)
|
let cnf = this.ys.get(y)
|
||||||
if (cnf === undefined) {
|
if (cnf === undefined) {
|
||||||
cnf = getFreshCnf()
|
cnf = getFreshCnf()
|
||||||
|
cnf.mutualExclude = createMutualExclude()
|
||||||
this.ys.set(y, cnf)
|
this.ys.set(y, cnf)
|
||||||
this.init(y)
|
return this.init(y).then(() => {
|
||||||
y.on('afterTransaction', (y, transaction) => {
|
y.on('afterTransaction', (y, transaction) => {
|
||||||
let cnf = this.ys.get(y)
|
let cnf = this.ys.get(y)
|
||||||
if (cnf.len > 0) {
|
if (cnf.len > 0) {
|
||||||
cnf.buffer.setUint32(0, cnf.len)
|
cnf.buffer.setUint32(0, cnf.len)
|
||||||
this.saveUpdate(y, cnf.buffer.createBuffer(), transaction)
|
this.saveUpdate(y, cnf.buffer.createBuffer(), transaction)
|
||||||
let _cnf = getFreshCnf()
|
let _cnf = getFreshCnf()
|
||||||
for (let key in _cnf) {
|
for (let key in _cnf) {
|
||||||
cnf[key] = _cnf[key]
|
cnf[key] = _cnf[key]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
return this.retrieve(y)
|
||||||
|
}).then(function () {
|
||||||
|
return Promise.resolve(cnf)
|
||||||
})
|
})
|
||||||
}
|
} else {
|
||||||
return this.retrieve(y).then(function () {
|
|
||||||
return Promise.resolve(cnf)
|
return Promise.resolve(cnf)
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit (y) {
|
deinit (y) {
|
||||||
this.ys.delete(y)
|
this.ys.delete(y)
|
||||||
|
y.persistence = null
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy () {
|
destroy () {
|
||||||
this.ys = null
|
this.ys = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all persisted data that belongs to a room.
|
||||||
|
* Automatically destroys all Yjs all Yjs instances that persist to
|
||||||
|
* the room. If `destroyYjsInstances = false` the persistence functionality
|
||||||
|
* will be removed from the Yjs instances.
|
||||||
|
*
|
||||||
|
* ** Must be overwritten! **
|
||||||
|
*/
|
||||||
|
removePersistedData (room, destroyYjsInstances = true) {
|
||||||
|
this.ys.forEach((cnf, y) => {
|
||||||
|
if (y.room === room) {
|
||||||
|
if (destroyYjsInstances) {
|
||||||
|
y.destroy()
|
||||||
|
} else {
|
||||||
|
this.deinit(y)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/* overwrite */
|
/* overwrite */
|
||||||
saveUpdate (buffer) {
|
saveUpdate (buffer) {
|
||||||
}
|
}
|
||||||
@@ -62,7 +85,7 @@ export default class AbstractPersistence {
|
|||||||
saveStruct (y, struct) {
|
saveStruct (y, struct) {
|
||||||
let cnf = this.ys.get(y)
|
let cnf = this.ys.get(y)
|
||||||
if (cnf !== undefined) {
|
if (cnf !== undefined) {
|
||||||
this.mutualExclude(function () {
|
cnf.mutualExclude(function () {
|
||||||
struct._toBinary(cnf.buffer)
|
struct._toBinary(cnf.buffer)
|
||||||
cnf.len++
|
cnf.len++
|
||||||
})
|
})
|
||||||
@@ -71,21 +94,24 @@ export default class AbstractPersistence {
|
|||||||
|
|
||||||
/* overwrite */
|
/* overwrite */
|
||||||
retrieve (y, model, updates) {
|
retrieve (y, model, updates) {
|
||||||
this.mutualExclude(function () {
|
let cnf = this.ys.get(y)
|
||||||
y.transact(function () {
|
if (cnf !== undefined) {
|
||||||
if (model != null) {
|
cnf.mutualExclude(function () {
|
||||||
fromBinary(y, new BinaryDecoder(new Uint8Array(model)))
|
y.transact(function () {
|
||||||
y._setContentReady()
|
if (model != null) {
|
||||||
}
|
fromBinary(y, new BinaryDecoder(new Uint8Array(model)))
|
||||||
if (updates != null) {
|
|
||||||
for (let i = 0; i < updates.length; i++) {
|
|
||||||
integrateRemoteStructs(y, new BinaryDecoder(new Uint8Array(updates[i])))
|
|
||||||
y._setContentReady()
|
|
||||||
}
|
}
|
||||||
}
|
if (updates != null) {
|
||||||
|
for (let i = 0; i < updates.length; i++) {
|
||||||
|
integrateRemoteStructs(y, new BinaryDecoder(new Uint8Array(updates[i])))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
y.emit('persistenceReady')
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* overwrite */
|
/* overwrite */
|
||||||
persist (y) {
|
persist (y) {
|
||||||
return toBinary(y).createBuffer()
|
return toBinary(y).createBuffer()
|
||||||
|
|||||||
@@ -51,20 +51,57 @@ export default class Item {
|
|||||||
this._parent = null
|
this._parent = null
|
||||||
this._parentSub = null
|
this._parentSub = null
|
||||||
this._deleted = false
|
this._deleted = false
|
||||||
|
this._redone = null
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Copy the effect of struct
|
* Create a operation with the same effect (without position effect)
|
||||||
*/
|
*/
|
||||||
_copy () {
|
_copy () {
|
||||||
let struct = new this.constructor()
|
return new this.constructor()
|
||||||
struct._origin = this._left
|
}
|
||||||
struct._left = this._left
|
/**
|
||||||
struct._right = this
|
* Redo the effect of this operation.
|
||||||
struct._right_origin = this
|
*/
|
||||||
struct._parent = this._parent
|
_redo (y) {
|
||||||
|
if (this._redone !== null) {
|
||||||
|
return this._redone
|
||||||
|
}
|
||||||
|
let struct = this._copy()
|
||||||
|
let left = this._left
|
||||||
|
let right = this
|
||||||
|
let parent = this._parent
|
||||||
|
// make sure that parent is redone
|
||||||
|
if (parent._deleted === true && parent._redone === null) {
|
||||||
|
parent._redo(y)
|
||||||
|
}
|
||||||
|
if (parent._redone !== null) {
|
||||||
|
parent = parent._redone
|
||||||
|
// find next cloned items
|
||||||
|
while (left !== null) {
|
||||||
|
if (left._redone !== null && left._redone._parent === parent) {
|
||||||
|
left = left._redone
|
||||||
|
break
|
||||||
|
}
|
||||||
|
left = left._left
|
||||||
|
}
|
||||||
|
while (right !== null) {
|
||||||
|
if (right._redone !== null && right._redone._parent === parent) {
|
||||||
|
right = right._redone
|
||||||
|
}
|
||||||
|
right = right._right
|
||||||
|
}
|
||||||
|
}
|
||||||
|
struct._origin = left
|
||||||
|
struct._left = left
|
||||||
|
struct._right = right
|
||||||
|
struct._right_origin = right
|
||||||
|
struct._parent = parent
|
||||||
struct._parentSub = this._parentSub
|
struct._parentSub = this._parentSub
|
||||||
|
struct._integrate(y)
|
||||||
|
this._redone = struct
|
||||||
return struct
|
return struct
|
||||||
}
|
}
|
||||||
|
|
||||||
get _lastId () {
|
get _lastId () {
|
||||||
return new ID(this._id.user, this._id.clock + this._length - 1)
|
return new ID(this._id.user, this._id.clock + this._length - 1)
|
||||||
}
|
}
|
||||||
@@ -90,11 +127,15 @@ export default class Item {
|
|||||||
if (!this._deleted) {
|
if (!this._deleted) {
|
||||||
this._deleted = true
|
this._deleted = true
|
||||||
y.ds.markDeleted(this._id, this._length)
|
y.ds.markDeleted(this._id, this._length)
|
||||||
|
let del = new Delete()
|
||||||
|
del._targetID = this._id
|
||||||
|
del._length = this._length
|
||||||
if (createDelete) {
|
if (createDelete) {
|
||||||
let del = new Delete()
|
// broadcast and persists Delete
|
||||||
del._targetID = this._id
|
|
||||||
del._length = this._length
|
|
||||||
del._integrate(y, true)
|
del._integrate(y, true)
|
||||||
|
} else if (y.persistence !== null) {
|
||||||
|
// only persist Delete
|
||||||
|
y.persistence.saveStruct(y, del)
|
||||||
}
|
}
|
||||||
transactionTypeChanged(y, this._parent, this._parentSub)
|
transactionTypeChanged(y, this._parent, this._parentSub)
|
||||||
y._transaction.deletedStructs.add(this)
|
y._transaction.deletedStructs.add(this)
|
||||||
@@ -113,9 +154,11 @@ export default class Item {
|
|||||||
* - Check if this is struct deleted
|
* - Check if this is struct deleted
|
||||||
*/
|
*/
|
||||||
_integrate (y) {
|
_integrate (y) {
|
||||||
|
y._transaction.newTypes.add(this)
|
||||||
const parent = this._parent
|
const parent = this._parent
|
||||||
const selfID = this._id
|
const selfID = this._id
|
||||||
const userState = selfID === null ? 0 : y.ss.getState(selfID.user)
|
const user = selfID === null ? y.userID : selfID.user
|
||||||
|
const userState = y.ss.getState(user)
|
||||||
if (selfID === null) {
|
if (selfID === null) {
|
||||||
this._id = y.ss.getNextID(this._length)
|
this._id = y.ss.getNextID(this._length)
|
||||||
} else if (selfID.user === RootFakeUserID) {
|
} else if (selfID.user === RootFakeUserID) {
|
||||||
|
|||||||
@@ -79,39 +79,6 @@ export default class Type extends Item {
|
|||||||
type = type._parent
|
type = type._parent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_copy (undeleteChildren) {
|
|
||||||
let copy = super._copy()
|
|
||||||
let map = new Map()
|
|
||||||
copy._map = map
|
|
||||||
for (let [key, value] of this._map) {
|
|
||||||
if (undeleteChildren.has(value) || !value.deleted) {
|
|
||||||
let _item = value._copy(undeleteChildren)
|
|
||||||
_item._parent = copy
|
|
||||||
map.set(key, value._copy(undeleteChildren))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let prevUndeleted = null
|
|
||||||
copy._start = null
|
|
||||||
let item = this._start
|
|
||||||
while (item !== null) {
|
|
||||||
if (undeleteChildren.has(item) || !item.deleted) {
|
|
||||||
let _item = item._copy(undeleteChildren)
|
|
||||||
_item._left = prevUndeleted
|
|
||||||
_item._origin = prevUndeleted
|
|
||||||
_item._right = null
|
|
||||||
_item._right_origin = null
|
|
||||||
_item._parent = copy
|
|
||||||
if (prevUndeleted === null) {
|
|
||||||
copy._start = _item
|
|
||||||
} else {
|
|
||||||
prevUndeleted._right = _item
|
|
||||||
}
|
|
||||||
prevUndeleted = _item
|
|
||||||
}
|
|
||||||
item = item._right
|
|
||||||
}
|
|
||||||
return copy
|
|
||||||
}
|
|
||||||
_transact (f) {
|
_transact (f) {
|
||||||
const y = this._y
|
const y = this._y
|
||||||
if (y !== null) {
|
if (y !== null) {
|
||||||
@@ -133,7 +100,6 @@ export default class Type extends Item {
|
|||||||
this._deepEventHandler.removeEventListener(f)
|
this._deepEventHandler.removeEventListener(f)
|
||||||
}
|
}
|
||||||
_integrate (y) {
|
_integrate (y) {
|
||||||
y._transaction.newTypes.add(this)
|
|
||||||
super._integrate(y)
|
super._integrate(y)
|
||||||
this._y = y
|
this._y = y
|
||||||
// when integrating children we must make sure to
|
// when integrating children we must make sure to
|
||||||
|
|||||||
@@ -9,17 +9,21 @@ class YArrayEvent extends YEvent {
|
|||||||
super(yarray)
|
super(yarray)
|
||||||
this.remote = remote
|
this.remote = remote
|
||||||
this._transaction = transaction
|
this._transaction = transaction
|
||||||
|
this._addedElements = null
|
||||||
}
|
}
|
||||||
get addedElements () {
|
get addedElements () {
|
||||||
const target = this.target
|
if (this._addedElements === null) {
|
||||||
const transaction = this._transaction
|
const target = this.target
|
||||||
const addedElements = new Set()
|
const transaction = this._transaction
|
||||||
transaction.newTypes.forEach(function (type) {
|
const addedElements = new Set()
|
||||||
if (type._parent === target && !transaction.deletedStructs.has(type)) {
|
transaction.newTypes.forEach(function (type) {
|
||||||
addedElements.add(type)
|
if (type._parent === target && !transaction.deletedStructs.has(type)) {
|
||||||
}
|
addedElements.add(type)
|
||||||
})
|
}
|
||||||
return addedElements
|
})
|
||||||
|
this._addedElements = addedElements
|
||||||
|
}
|
||||||
|
return this._addedElements
|
||||||
}
|
}
|
||||||
get removedElements () {
|
get removedElements () {
|
||||||
const target = this.target
|
const target = this.target
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ export default class YXmlElement extends YXmlFragment {
|
|||||||
super()
|
super()
|
||||||
this.nodeName = null
|
this.nodeName = null
|
||||||
this._scrollElement = null
|
this._scrollElement = null
|
||||||
|
if (typeof arg2 === 'function') {
|
||||||
|
this._domFilter = arg2
|
||||||
|
}
|
||||||
if (typeof arg1 === 'string') {
|
if (typeof arg1 === 'string') {
|
||||||
this.nodeName = arg1.toUpperCase()
|
this.nodeName = arg1.toUpperCase()
|
||||||
} else if (arg1 != null && arg1.nodeType != null && arg1.nodeType === arg1.ELEMENT_NODE) {
|
} else if (arg1 != null && arg1.nodeType != null && arg1.nodeType === arg1.ELEMENT_NODE) {
|
||||||
@@ -16,12 +19,9 @@ export default class YXmlElement extends YXmlFragment {
|
|||||||
} else {
|
} else {
|
||||||
this.nodeName = 'UNDEFINED'
|
this.nodeName = 'UNDEFINED'
|
||||||
}
|
}
|
||||||
if (typeof arg2 === 'function') {
|
|
||||||
this._domFilter = arg2
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_copy (undeleteChildren) {
|
_copy () {
|
||||||
let struct = super._copy(undeleteChildren)
|
let struct = super._copy()
|
||||||
struct.nodeName = this.nodeName
|
struct.nodeName = this.nodeName
|
||||||
return struct
|
return struct
|
||||||
}
|
}
|
||||||
@@ -36,9 +36,10 @@ export default class YXmlElement extends YXmlFragment {
|
|||||||
let attributes = new Map()
|
let attributes = new Map()
|
||||||
for (let i = 0; i < dom.attributes.length; i++) {
|
for (let i = 0; i < dom.attributes.length; i++) {
|
||||||
let attr = dom.attributes[i]
|
let attr = dom.attributes[i]
|
||||||
attributes.set(attr.name, attr.value)
|
// get attribute via getAttribute for custom element support (some write something different in attr.value)
|
||||||
|
attributes.set(attr.name, dom.getAttribute(attr.name))
|
||||||
}
|
}
|
||||||
attributes = this._domFilter(dom, attributes)
|
attributes = this._domFilter(dom.nodeName, attributes)
|
||||||
attributes.forEach((value, name) => {
|
attributes.forEach((value, name) => {
|
||||||
this.setAttribute(name, value)
|
this.setAttribute(name, value)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -152,18 +152,20 @@ export default class YXmlFragment extends YArray {
|
|||||||
attributes.set(key, attrs[key])
|
attributes.set(key, attrs[key])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let result = this._domFilter(this.nodeName, new Map(attributes))
|
this._y.transact(() => {
|
||||||
if (result === null) {
|
let result = this._domFilter(this.nodeName, new Map(attributes))
|
||||||
this._delete(this._y)
|
if (result === null) {
|
||||||
} else {
|
this._delete(this._y)
|
||||||
attributes.forEach((value, key) => {
|
} else {
|
||||||
if (!result.has(key)) {
|
attributes.forEach((value, key) => {
|
||||||
this.removeAttribute(key)
|
if (!result.has(key)) {
|
||||||
}
|
this.removeAttribute(key)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.forEach(xml => {
|
||||||
|
xml.setDomFilter(f)
|
||||||
})
|
})
|
||||||
}
|
|
||||||
this.forEach(xml => {
|
|
||||||
xml.setDomFilter(f)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
_callObserver (transaction, parentSubs, remote) {
|
_callObserver (transaction, parentSubs, remote) {
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ export default class YXmlHook extends YMap {
|
|||||||
getHook(hookName).fillType(dom, this)
|
getHook(hookName).fillType(dom, this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_copy () {
|
||||||
|
const struct = super._copy()
|
||||||
|
struct.hookName = this.hookName
|
||||||
|
return struct
|
||||||
|
}
|
||||||
getDom (_document) {
|
getDom (_document) {
|
||||||
_document = _document || document
|
_document = _document || document
|
||||||
if (this._dom === null) {
|
if (this._dom === null) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
export default class NamedEventHandler {
|
export default class NamedEventHandler {
|
||||||
constructor () {
|
constructor () {
|
||||||
this._eventListener = new Map()
|
this._eventListener = new Map()
|
||||||
|
this._stateListener = new Map()
|
||||||
}
|
}
|
||||||
_getListener (name) {
|
_getListener (name) {
|
||||||
let listeners = this._eventListener.get(name)
|
let listeners = this._eventListener.get(name)
|
||||||
@@ -21,6 +22,20 @@ export default class NamedEventHandler {
|
|||||||
let listeners = this._getListener(name)
|
let listeners = this._getListener(name)
|
||||||
listeners.on.add(f)
|
listeners.on.add(f)
|
||||||
}
|
}
|
||||||
|
_initStateListener (name) {
|
||||||
|
let state = this._stateListener.get(name)
|
||||||
|
if (state === undefined) {
|
||||||
|
state = {}
|
||||||
|
state.promise = new Promise(function (resolve) {
|
||||||
|
state.resolve = resolve
|
||||||
|
})
|
||||||
|
this._stateListener.set(name, state)
|
||||||
|
}
|
||||||
|
return state
|
||||||
|
}
|
||||||
|
when (name) {
|
||||||
|
return this._initStateListener(name).promise
|
||||||
|
}
|
||||||
off (name, f) {
|
off (name, f) {
|
||||||
if (name == null || f == null) {
|
if (name == null || f == null) {
|
||||||
throw new Error('You must specify event name and function!')
|
throw new Error('You must specify event name and function!')
|
||||||
@@ -32,6 +47,7 @@ export default class NamedEventHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
emit (name, ...args) {
|
emit (name, ...args) {
|
||||||
|
this._initStateListener(name).resolve()
|
||||||
const listener = this._eventListener.get(name)
|
const listener = this._eventListener.get(name)
|
||||||
if (listener !== undefined) {
|
if (listener !== undefined) {
|
||||||
listener.on.forEach(f => f.apply(null, args))
|
listener.on.forEach(f => f.apply(null, args))
|
||||||
|
|||||||
@@ -4,11 +4,12 @@ class ReverseOperation {
|
|||||||
constructor (y, transaction) {
|
constructor (y, transaction) {
|
||||||
this.created = new Date()
|
this.created = new Date()
|
||||||
const beforeState = transaction.beforeState
|
const beforeState = transaction.beforeState
|
||||||
this.toState = new ID(y.userID, y.ss.getState(y.userID) - 1)
|
|
||||||
if (beforeState.has(y.userID)) {
|
if (beforeState.has(y.userID)) {
|
||||||
|
this.toState = new ID(y.userID, y.ss.getState(y.userID) - 1)
|
||||||
this.fromState = new ID(y.userID, beforeState.get(y.userID))
|
this.fromState = new ID(y.userID, beforeState.get(y.userID))
|
||||||
} else {
|
} else {
|
||||||
this.fromState = this.toState
|
this.toState = null
|
||||||
|
this.fromState = null
|
||||||
}
|
}
|
||||||
this.deletedStructs = transaction.deletedStructs
|
this.deletedStructs = transaction.deletedStructs
|
||||||
}
|
}
|
||||||
@@ -30,28 +31,32 @@ function applyReverseOperation (y, scope, reverseBuffer) {
|
|||||||
while (!performedUndo && reverseBuffer.length > 0) {
|
while (!performedUndo && reverseBuffer.length > 0) {
|
||||||
let undoOp = reverseBuffer.pop()
|
let undoOp = reverseBuffer.pop()
|
||||||
// make sure that it is possible to iterate {from}-{to}
|
// make sure that it is possible to iterate {from}-{to}
|
||||||
y.os.getItemCleanStart(undoOp.fromState)
|
if (undoOp.fromState !== null) {
|
||||||
y.os.getItemCleanEnd(undoOp.toState)
|
y.os.getItemCleanStart(undoOp.fromState)
|
||||||
y.os.iterate(undoOp.fromState, undoOp.toState, op => {
|
y.os.getItemCleanEnd(undoOp.toState)
|
||||||
if (!op._deleted && isStructInScope(y, op, scope)) {
|
y.os.iterate(undoOp.fromState, undoOp.toState, op => {
|
||||||
performedUndo = true
|
while (op._deleted && op._redone !== null) {
|
||||||
op._delete(y)
|
op = op._redone
|
||||||
}
|
}
|
||||||
})
|
if (op._deleted === false && isStructInScope(y, op, scope)) {
|
||||||
|
performedUndo = true
|
||||||
|
op._delete(y)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
for (let op of undoOp.deletedStructs) {
|
for (let op of undoOp.deletedStructs) {
|
||||||
if (
|
if (
|
||||||
isStructInScope(y, op, scope) &&
|
isStructInScope(y, op, scope) &&
|
||||||
op._parent !== y &&
|
op._parent !== y &&
|
||||||
!op._parent._deleted &&
|
|
||||||
(
|
(
|
||||||
op._parent._id.user !== y.userID ||
|
op._id.user !== y.userID ||
|
||||||
op._parent._id.clock < undoOp.fromState.clock ||
|
undoOp.fromState === null ||
|
||||||
op._parent._id.clock > undoOp.fromState.clock
|
op._id.clock < undoOp.fromState.clock ||
|
||||||
|
op._id.clock > undoOp.toState.clock
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
performedUndo = true
|
performedUndo = true
|
||||||
op = op._copy(undoOp.deletedStructs)
|
op._redo(y)
|
||||||
op._integrate(y)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,6 +73,7 @@ export default class UndoManager {
|
|||||||
this._scope = scope
|
this._scope = scope
|
||||||
this._undoing = false
|
this._undoing = false
|
||||||
this._redoing = false
|
this._redoing = false
|
||||||
|
this._lastTransactionWasUndo = false
|
||||||
const y = scope._y
|
const y = scope._y
|
||||||
this.y = y
|
this.y = y
|
||||||
y.on('afterTransaction', (y, transaction, remote) => {
|
y.on('afterTransaction', (y, transaction, remote) => {
|
||||||
@@ -75,17 +81,29 @@ export default class UndoManager {
|
|||||||
let reverseOperation = new ReverseOperation(y, transaction)
|
let reverseOperation = new ReverseOperation(y, transaction)
|
||||||
if (!this._undoing) {
|
if (!this._undoing) {
|
||||||
let lastUndoOp = this._undoBuffer.length > 0 ? this._undoBuffer[this._undoBuffer.length - 1] : null
|
let lastUndoOp = this._undoBuffer.length > 0 ? this._undoBuffer[this._undoBuffer.length - 1] : null
|
||||||
if (lastUndoOp !== null && reverseOperation.created - lastUndoOp.created <= options.captureTimeout) {
|
if (
|
||||||
|
this._redoing === false &&
|
||||||
|
this._lastTransactionWasUndo === false &&
|
||||||
|
lastUndoOp !== null &&
|
||||||
|
reverseOperation.created - lastUndoOp.created <= options.captureTimeout
|
||||||
|
) {
|
||||||
lastUndoOp.created = reverseOperation.created
|
lastUndoOp.created = reverseOperation.created
|
||||||
lastUndoOp.toState = reverseOperation.toState
|
if (reverseOperation.toState !== null) {
|
||||||
|
lastUndoOp.toState = reverseOperation.toState
|
||||||
|
if (lastUndoOp.fromState === null) {
|
||||||
|
lastUndoOp.fromState = reverseOperation.fromState
|
||||||
|
}
|
||||||
|
}
|
||||||
reverseOperation.deletedStructs.forEach(lastUndoOp.deletedStructs.add, lastUndoOp.deletedStructs)
|
reverseOperation.deletedStructs.forEach(lastUndoOp.deletedStructs.add, lastUndoOp.deletedStructs)
|
||||||
} else {
|
} else {
|
||||||
|
this._lastTransactionWasUndo = false
|
||||||
this._undoBuffer.push(reverseOperation)
|
this._undoBuffer.push(reverseOperation)
|
||||||
}
|
}
|
||||||
if (!this._redoing) {
|
if (!this._redoing) {
|
||||||
this._redoBuffer = []
|
this._redoBuffer = []
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
this._lastTransactionWasUndo = true
|
||||||
this._redoBuffer.push(reverseOperation)
|
this._redoBuffer.push(reverseOperation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
21
src/Y.js
21
src/Y.js
@@ -5,6 +5,7 @@ import { generateUserID } from './Util/generateUserID.js'
|
|||||||
import RootID from './Util/RootID.js'
|
import RootID from './Util/RootID.js'
|
||||||
import NamedEventHandler from './Util/NamedEventHandler.js'
|
import NamedEventHandler from './Util/NamedEventHandler.js'
|
||||||
import UndoManager from './Util/UndoManager.js'
|
import UndoManager from './Util/UndoManager.js'
|
||||||
|
import { integrateRemoteStructs } from './MessageHandler/integrateRemoteStructs.js'
|
||||||
|
|
||||||
import { messageToString, messageToRoomname } from './MessageHandler/messageToString.js'
|
import { messageToString, messageToRoomname } from './MessageHandler/messageToString.js'
|
||||||
|
|
||||||
@@ -21,6 +22,10 @@ import { addStruct as addType } from './Util/structReferences.js'
|
|||||||
import debug from 'debug'
|
import debug from 'debug'
|
||||||
import Transaction from './Transaction.js'
|
import Transaction from './Transaction.js'
|
||||||
|
|
||||||
|
import TextareaBinding from './Binding/TextareaBinding.js'
|
||||||
|
|
||||||
|
import { toBinary, fromBinary } from './MessageHandler/binaryEncode.js'
|
||||||
|
|
||||||
export default class Y extends NamedEventHandler {
|
export default class Y extends NamedEventHandler {
|
||||||
constructor (room, opts, persistence) {
|
constructor (room, opts, persistence) {
|
||||||
super()
|
super()
|
||||||
@@ -61,6 +66,15 @@ export default class Y extends NamedEventHandler {
|
|||||||
this.emit('content')
|
this.emit('content')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
whenContentReady () {
|
||||||
|
if (this._contentReady) {
|
||||||
|
return Promise.resolve()
|
||||||
|
} else {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
this.once('content', resolve)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
_beforeChange () {}
|
_beforeChange () {}
|
||||||
transact (f, remote = false) {
|
transact (f, remote = false) {
|
||||||
let initialCall = this._transaction === null
|
let initialCall = this._transaction === null
|
||||||
@@ -187,12 +201,17 @@ Y.XmlFragment = YXmlFragment
|
|||||||
Y.XmlText = YXmlText
|
Y.XmlText = YXmlText
|
||||||
Y.XmlHook = YXmlHook
|
Y.XmlHook = YXmlHook
|
||||||
|
|
||||||
|
Y.TextareaBinding = TextareaBinding
|
||||||
|
|
||||||
Y.utils = {
|
Y.utils = {
|
||||||
BinaryDecoder,
|
BinaryDecoder,
|
||||||
UndoManager,
|
UndoManager,
|
||||||
getRelativePosition,
|
getRelativePosition,
|
||||||
fromRelativePosition,
|
fromRelativePosition,
|
||||||
addType
|
addType,
|
||||||
|
integrateRemoteStructs,
|
||||||
|
toBinary,
|
||||||
|
fromBinary
|
||||||
}
|
}
|
||||||
|
|
||||||
Y.debug = debug
|
Y.debug = debug
|
||||||
|
|||||||
1
y.node.js.map
Normal file
1
y.node.js.map
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user