feat: update

This commit is contained in:
cudr 2019-10-19 23:29:09 +03:00
parent 20c44d369f
commit 65bb9b134d
9 changed files with 34 additions and 16 deletions

View File

@ -22,7 +22,7 @@
}
},
"lint-staged": {
"*.{js,jsx,ts,tsx,json,babelrc}": [
"*.{js,jsx,ts,tsx,babelrc}": [
"yarn run format",
"git add"
]

View File

@ -1,6 +1,6 @@
{
"name": "@slate-collaborative/backend",
"version": "0.0.1",
"version": "0.0.2",
"files": [
"lib"
],
@ -25,7 +25,7 @@
"watch": "yarn build:js -w"
},
"dependencies": {
"@slate-collaborative/bridge": "^0.0.1",
"@slate-collaborative/bridge": "^0.0.2",
"automerge": "^0.12.1",
"lodash": "^4.17.15",
"socket.io": "^2.2.0",

View File

@ -1,5 +1,15 @@
{
"presets": ["@babel/env", "@babel/typescript"],
"presets": [
[
"@babel/preset-env",
{
"targets": {
"esmodules": false
}
}
],
"@babel/typescript"
],
"plugins": [
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread"

View File

@ -1,6 +1,6 @@
{
"name": "@slate-collaborative/bridge",
"version": "0.0.1",
"version": "0.0.2",
"files": [
"lib"
],

View File

@ -17,7 +17,7 @@ const opType: any = {
// set_value: setValue
}
export const applyOperation = (doc: SyncDoc, op: Operation): SyncDoc => {
const applyOperation = (doc: SyncDoc, op: Operation): SyncDoc => {
try {
const applyOp = opType[op.type]
@ -34,5 +34,7 @@ export const applyOperation = (doc: SyncDoc, op: Operation): SyncDoc => {
}
}
export const applySlateOps = (doc: SyncDoc, operations: Operations) =>
const applySlateOps = (doc: SyncDoc, operations: Operations) =>
operations.reduce(applyOperation, doc)
export { applyOperation, applySlateOps }

View File

@ -1,7 +1,7 @@
import toSync from './toSync'
import hexGen from './hexGen'
export const toJS = node => {
const toJS = node => {
try {
return JSON.parse(JSON.stringify(node))
} catch (e) {
@ -10,8 +10,8 @@ export const toJS = node => {
}
}
export const cloneNode = node => toSync(toJS(node))
const cloneNode = node => toSync(toJS(node))
const toSlatePath = path => (path ? path.filter(d => Number.isInteger(d)) : [])
export { toSync, toSlatePath, hexGen }
export { toSync, toJS, toSlatePath, hexGen, cloneNode }

View File

@ -1,6 +1,6 @@
{
"name": "@slate-collaborative/client",
"version": "0.0.1",
"version": "0.0.2",
"files": [
"lib"
],
@ -25,7 +25,7 @@
},
"dependencies": {
"@babel/preset-react": "^7.0.0",
"@slate-collaborative/bridge": "^0.0.1",
"@slate-collaborative/bridge": "^0.0.2",
"automerge": "^0.12.1",
"immutable": "^4.0.0-rc.12",
"react": "^16.9.0",

View File

@ -5,8 +5,8 @@
"dependencies": {
"@emotion/core": "^10.0.17",
"@emotion/styled": "^10.0.17",
"@slate-collaborative/backend": "0.0.1",
"@slate-collaborative/client": "0.0.1",
"@slate-collaborative/backend": "0.0.2",
"@slate-collaborative/client": "0.0.2",
"@types/faker": "^4.1.5",
"@types/jest": "24.0.18",
"@types/node": "12.7.5",

View File

@ -1,9 +1,15 @@
{
"include": ["src/**/*"],
"include": [
"src/**/*"
],
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"baseUrl": "src",
"jsx": "react",
"allowJs": true,