Comparing version 6.5.3 to 6.5.4
# CHANGELOG | ||
## 6.5.3 | ||
## 6.5.4 | ||
@@ -5,0 +5,0 @@ - Prevent react-ink from altering the accessibility tree (#64). Thanks, @Chudesnov. |
@@ -1,2 +0,2 @@ | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var a=t(require("react")),n=!1;"undefined"!=typeof window&&(n="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch);var i=n,p=function(t){return(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)},h={borderRadius:"inherit",height:"100%",left:0,position:"absolute",top:0,width:"100%"};function u(t,n,i,r){return i*((t=t/r-1)*t*t*t*t+1)+n}var r=Math.sqrt(2),s=Math.cos,c=Math.max,o=Math.min;function f(t){return o(t.duration,Date.now()-t.mouseDown)}function d(t){return 0<t.mouseUp?Date.now()-t.mouseUp:0}function e(t){var n=t.duration,i=t.radius,r=.85*u(f(t),0,i,n),o=.15*u(d(t),0,i,n),e=.02*i*s(Date.now()/n);return c(0,r+o+e)}function m(t,n,i){return i||o(.6*c(t,n))}function v(t,n){return u(d(t),n,-n,t.duration)}function w(t,n){return o(v(t,n),u(f(t),0,.3,3*t.duration))}function l(t,n,i){return o(1,e(t)/n*2/r)*(i/2-t.x)}function y(t,n,i){return o(1,e(t)/n*2/r)*(i/2-t.y)}function D(t){return e(t)/t.radius}var M=function(t){var n=t.mouseUp,i=t.duration;return!n||Date.now()-n<i};function g(t){var n,o=[],i=!1,r={each:function(t,n){for(var i=0,r=o.length;i<r;i++)t.call(n,o[i])},play:function(){i||(i=!0,r.update())},stop:function(){i=!1,cancelAnimationFrame(n)},getTotalOpacity:function(t){for(var n=0,i=0,r=o.length;i<r;i++)n+=w(o[i],t);return n},update:function(){(o=o.filter(M)).length?n=requestAnimationFrame(r.update):r.stop(),t()},add:function(t){o.push(t),r.play()},release:function(t){for(var n=o.length-1;0<=n;n--)if(!o[n].mouseUp)return o[n].mouseUp=t}};return r}function b(){for(var t=arguments,n={},i=0;i<arguments.length;i++){var r=t[i];if(r)for(var o in r)n[o]=r[o]}return n}var T=2*Math.PI,O=0,j={background:!0,className:"ink",duration:1e3,opacity:.25,recenter:!0,hasTouch:i},k=function(n){function t(t){n.apply(this,arguments),this.state={color:"transparent",density:1,height:0,store:g(this.tick.bind(this)),width:0},this.touchEvents=this.touchEvents()}return n&&(t.__proto__=n),((t.prototype=Object.create(n&&n.prototype)).constructor=t).prototype.touchEvents=function(){return this.props.hasTouch?{onTouchStart:this.t.bind(this),onTouchEnd:this.n.bind(this),onTouchCancel:this.n.bind(this)}:{onMouseDown:this.t.bind(this),onMouseUp:this.n.bind(this),onMouseLeave:this.n.bind(this)}},t.prototype.tick=function(){var t=this.state,n=t.ctx,i=t.color,r=t.density,o=t.height,e=t.width,u=t.store;n.save(),n.scale(r,r),n.clearRect(0,0,e,o),n.fillStyle=i,this.props.background&&(n.globalAlpha=u.getTotalOpacity(this.props.opacity),n.fillRect(0,0,e,o)),u.each(this.makeBlot,this),n.restore()},t.prototype.makeBlot=function(t){var n=this.state,i=n.ctx,r=n.height,o=n.width,e=t.x,u=t.y,s=t.radius;if(i.globalAlpha=v(t,this.props.opacity),i.beginPath(),this.props.recenter){var a=Math.max(r,o);e+=l(t,a,o),u+=y(t,a,r)}i.arc(e,u,s*D(t),0,T),i.closePath(),i.fill()},t.prototype.componentWillUnmount=function(){this.state.store.stop()},t.prototype.pushBlot=function(t,n,i){var r=this,o=this.canvas;o.getDOMNode&&"function"==typeof o.getDOMNode&&(o=o.getDOMNode());var e=o.getBoundingClientRect(),u=e.top,s=e.bottom,a=e.left,h=e.right,c=window.getComputedStyle(o).color,f=this.state.ctx||o.getContext("2d"),d=p(f),v=s-u,w=h-a,l=m(v,w,this.props.radius);this.setState({color:c,ctx:f,density:d,height:v,width:w},function(){r.state.store.add({duration:r.props.duration,mouseDown:t,mouseUp:0,radius:l,x:n-a,y:i-u})})},t.prototype.setCanvas=function(t){this.canvas=t},t.prototype.render=function(){var t=this.state,n=t.density,i=t.height,r=t.width,o=this.props,e=o.className,u=o.style,s=b({className:e,ref:this.setCanvas.bind(this),height:i*n,width:r*n,onDragOver:this.n.bind(this),style:b(h,u)},this.touchEvents);return a.createElement("canvas",s)},t.prototype.t=function(t){var n=t.button,i=t.ctrlKey,r=t.clientX,o=t.clientY,e=t.changedTouches,u=Date.now();if(e)for(var s=0;s<e.length;s++){var a=e[s],h=a.clientX,c=a.clientY;this.pushBlot(u,h,c)}else n!==O||i||this.pushBlot(u,r,o)},t.prototype.n=function(){this.state.store.release(Date.now())},t}(a.PureComponent);k.defaultProps=j,module.exports=k; | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}var s=t(require("react")),n=!1;"undefined"!=typeof window&&(n="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch);var i=n,p=function(t){return(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)},h={borderRadius:"inherit",height:"100%",left:0,position:"absolute",top:0,width:"100%"};function u(t,n,i,r){return i*((t=t/r-1)*t*t*t*t+1)+n}var r=Math.sqrt(2),a=Math.cos,c=Math.max,o=Math.min;function f(t){return o(t.duration,Date.now()-t.mouseDown)}function d(t){return 0<t.mouseUp?Date.now()-t.mouseUp:0}function e(t){var n=t.duration,i=t.radius,r=.85*u(f(t),0,i,n),o=.15*u(d(t),0,i,n),e=.02*i*a(Date.now()/n);return c(0,r+o+e)}function m(t,n,i){return i||o(.6*c(t,n))}function v(t,n){return u(d(t),n,-n,t.duration)}function w(t,n){return o(v(t,n),u(f(t),0,.3,3*t.duration))}function l(t,n,i){return o(1,e(t)/n*2/r)*(i/2-t.x)}function y(t,n,i){return o(1,e(t)/n*2/r)*(i/2-t.y)}function D(t){return e(t)/t.radius}var M=function(t){var n=t.mouseUp,i=t.duration;return!n||Date.now()-n<i};function g(t){var n,o=[],i=!1,r={each:function(t,n){for(var i=0,r=o.length;i<r;i++)t.call(n,o[i])},play:function(){i||(i=!0,r.update())},stop:function(){i=!1,cancelAnimationFrame(n)},getTotalOpacity:function(t){for(var n=0,i=0,r=o.length;i<r;i++)n+=w(o[i],t);return n},update:function(){(o=o.filter(M)).length?n=requestAnimationFrame(r.update):r.stop(),t()},add:function(t){o.push(t),r.play()},release:function(t){for(var n=o.length-1;0<=n;n--)if(!o[n].mouseUp)return o[n].mouseUp=t}};return r}function b(){for(var t=arguments,n={},i=0;i<arguments.length;i++){var r=t[i];if(r)for(var o in r)n[o]=r[o]}return n}var T=2*Math.PI,O=0,j={background:!0,className:"ink",duration:1e3,opacity:.25,recenter:!0,hasTouch:i},k=function(n){function t(t){n.apply(this,arguments),this.state={color:"transparent",density:1,height:0,store:g(this.tick.bind(this)),width:0},this.touchEvents=this.touchEvents()}return n&&(t.__proto__=n),((t.prototype=Object.create(n&&n.prototype)).constructor=t).prototype.touchEvents=function(){return this.props.hasTouch?{onTouchStart:this.t.bind(this),onTouchEnd:this.n.bind(this),onTouchCancel:this.n.bind(this)}:{onMouseDown:this.t.bind(this),onMouseUp:this.n.bind(this),onMouseLeave:this.n.bind(this)}},t.prototype.tick=function(){var t=this.state,n=t.ctx,i=t.color,r=t.density,o=t.height,e=t.width,u=t.store;n.save(),n.scale(r,r),n.clearRect(0,0,e,o),n.fillStyle=i,this.props.background&&(n.globalAlpha=u.getTotalOpacity(this.props.opacity),n.fillRect(0,0,e,o)),u.each(this.makeBlot,this),n.restore()},t.prototype.makeBlot=function(t){var n=this.state,i=n.ctx,r=n.height,o=n.width,e=t.x,u=t.y,a=t.radius;if(i.globalAlpha=v(t,this.props.opacity),i.beginPath(),this.props.recenter){var s=Math.max(r,o);e+=l(t,s,o),u+=y(t,s,r)}i.arc(e,u,a*D(t),0,T),i.closePath(),i.fill()},t.prototype.componentWillUnmount=function(){this.state.store.stop()},t.prototype.pushBlot=function(t,n,i){var r=this,o=this.canvas;o.getDOMNode&&"function"==typeof o.getDOMNode&&(o=o.getDOMNode());var e=o.getBoundingClientRect(),u=e.top,a=e.bottom,s=e.left,h=e.right,c=window.getComputedStyle(o).color,f=this.state.ctx||o.getContext("2d"),d=p(f),v=a-u,w=h-s,l=m(v,w,this.props.radius);this.setState({color:c,ctx:f,density:d,height:v,width:w},function(){r.state.store.add({duration:r.props.duration,mouseDown:t,mouseUp:0,radius:l,x:n-s,y:i-u})})},t.prototype.setCanvas=function(t){this.canvas=t},t.prototype.render=function(){var t=this.state,n=t.density,i=t.height,r=t.width,o=this.props,e=o.className,u=o.style,a=b({"aria-hidden":!0,className:e,ref:this.setCanvas.bind(this),height:i*n,width:r*n,onDragOver:this.n.bind(this),style:b(h,u)},this.touchEvents);return s.createElement("canvas",a)},t.prototype.t=function(t){var n=t.button,i=t.ctrlKey,r=t.clientX,o=t.clientY,e=t.changedTouches,u=Date.now();if(e)for(var a=0;a<e.length;a++){var s=e[a],h=s.clientX,c=s.clientY;this.pushBlot(u,h,c)}else n!==O||i||this.pushBlot(u,r,o)},t.prototype.n=function(){this.state.store.release(Date.now())},t}(s.PureComponent);k.defaultProps=j,module.exports=k; | ||
//# sourceMappingURL=ink.js.map |
{ | ||
"name": "react-ink", | ||
"version": "6.5.3", | ||
"version": "6.5.4", | ||
"description": "A React component for adding material design style ink.", | ||
@@ -50,2 +50,2 @@ "main": "dist/ink.js", | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
40990