react-jsbox
Advanced tools
Comparing version 1.0.6 to 1.1.0
{ | ||
"name": "react-jsbox", | ||
"version": "1.0.6", | ||
"version": "1.1.0", | ||
"description": "A custom React renderer for writing JSBox apps in React.", | ||
@@ -27,15 +27,15 @@ "keywords": [ | ||
"devDependencies": { | ||
"@babel/core": "^7.10.2", | ||
"@babel/core": "^7.10.3", | ||
"@babel/plugin-proposal-class-properties": "^7.10.1", | ||
"@babel/plugin-proposal-decorators": "^7.10.1", | ||
"@babel/plugin-transform-runtime": "^7.10.1", | ||
"@babel/preset-env": "^7.10.2", | ||
"@babel/plugin-proposal-decorators": "^7.10.3", | ||
"@babel/plugin-transform-runtime": "^7.10.3", | ||
"@babel/preset-env": "^7.10.3", | ||
"@babel/preset-react": "^7.10.1", | ||
"@babel/runtime": "^7.10.2", | ||
"@babel/runtime": "^7.10.3", | ||
"babel-eslint": "^10.1.0", | ||
"babel-plugin-annotate-pure-calls": "^0.4.0", | ||
"babel-preset-minify": "^0.5.1", | ||
"eslint": "^7.2.0", | ||
"eslint": "^7.3.1", | ||
"eslint-plugin-babel": "^5.3.0", | ||
"eslint-plugin-import": "^2.20.2", | ||
"eslint-plugin-import": "^2.21.2", | ||
"eslint-plugin-jsbox": "^0.1.1", | ||
@@ -45,3 +45,3 @@ "eslint-plugin-react-hooks": "^4.0.4", | ||
"react": "^16.13.1", | ||
"rollup": "^2.14.0", | ||
"rollup": "^2.18.0", | ||
"rollup-plugin-babel": "^4.4.0", | ||
@@ -48,0 +48,0 @@ "rollup-plugin-cleanup": "^3.1.1", |
export default class View { | ||
constructor(type, props) { | ||
const { layout, events } = props | ||
const { layout, events, animate } = props | ||
this._element = $ui.create({ | ||
@@ -10,2 +10,3 @@ type, | ||
}) | ||
this._animate = animate | ||
} | ||
@@ -15,2 +16,4 @@ | ||
_animate = null | ||
get element() { | ||
@@ -36,2 +39,17 @@ return this._element | ||
const element = this.element | ||
if (this._animate) { | ||
const { duration = 0.4, damping = 0, velocity = 0, options = 0, completion = () => { } } = this._animate | ||
return $ui.animate({ | ||
duration, | ||
animation() { | ||
Object.keys(updatePayload).forEach(prop => { | ||
element[prop] = updatePayload[prop] | ||
}) | ||
}, | ||
damping, | ||
velocity, | ||
options, | ||
completion | ||
}) | ||
} | ||
Object.keys(updatePayload).forEach(prop => { | ||
@@ -38,0 +56,0 @@ element[prop] = updatePayload[prop] |
Sorry, the diff of this file is too big to display
109118
713