New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

confetti-react

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

confetti-react - npm Package Compare versions

Comparing version 2.4.3 to 2.4.4

dist/CircleClass.d.ts

946

dist/confetti-react.min.js

@@ -1,2 +0,944 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.ConfettiReact=e(require("react")):t.ConfettiReact=e(t.React)}("undefined"!=typeof self?self:this,function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(e,n){e.exports=t},function(t,e,n){"use strict";var r={linear:function(t,e,n,r){return(n-e)*t/r+e},easeInQuad:function(t,e,n,r){return(n-e)*(t/=r)*t+e},easeOutQuad:function(t,e,n,r){return-(n-e)*(t/=r)*(t-2)+e},easeInOutQuad:function(t,e,n,r){var i=n-e;return(t/=r/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,n,r){return(n-e)*(t/=r)*t*t+e},easeOutCubic:function(t,e,n,r){return(n-e)*((t=t/r-1)*t*t+1)+e},easeInOutCubic:function(t,e,n,r){var i=n-e;return(t/=r/2)<1?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e},easeInQuart:function(t,e,n,r){return(n-e)*(t/=r)*t*t*t+e},easeOutQuart:function(t,e,n,r){return-(n-e)*((t=t/r-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,n,r){var i=n-e;return(t/=r/2)<1?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e},easeInQuint:function(t,e,n,r){return(n-e)*(t/=r)*t*t*t*t+e},easeOutQuint:function(t,e,n,r){return(n-e)*((t=t/r-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,n,r){var i=n-e;return(t/=r/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e},easeInSine:function(t,e,n,r){var i=n-e;return-i*Math.cos(t/r*(Math.PI/2))+i+e},easeOutSine:function(t,e,n,r){return(n-e)*Math.sin(t/r*(Math.PI/2))+e},easeInOutSine:function(t,e,n,r){return-(n-e)/2*(Math.cos(Math.PI*t/r)-1)+e},easeInExpo:function(t,e,n,r){return 0==t?e:(n-e)*Math.pow(2,10*(t/r-1))+e},easeOutExpo:function(t,e,n,r){var i=n-e;return t==r?e+i:i*(1-Math.pow(2,-10*t/r))+e},easeInOutExpo:function(t,e,n,r){var i=n-e;return 0===t?e:t===r?e+i:(t/=r/2)<1?i/2*Math.pow(2,10*(t-1))+e:i/2*(2-Math.pow(2,-10*--t))+e},easeInCirc:function(t,e,n,r){return-(n-e)*(Math.sqrt(1-(t/=r)*t)-1)+e},easeOutCirc:function(t,e,n,r){return(n-e)*Math.sqrt(1-(t=t/r-1)*t)+e},easeInOutCirc:function(t,e,n,r){var i=n-e;return(t/=r/2)<1?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e},easeInElastic:function(t,e,n,r){var i,o,a,c=n-e;return a=1.70158,0===t?e:1==(t/=r)?e+c:((o=0)||(o=.3*r),(i=c)<Math.abs(c)?(i=c,a=o/4):a=o/(2*Math.PI)*Math.asin(c/i),-i*Math.pow(2,10*(t-=1))*Math.sin((t*r-a)*(2*Math.PI)/o)+e)},easeOutElastic:function(t,e,n,r){var i,o,a,c=n-e;return a=1.70158,0===t?e:1==(t/=r)?e+c:((o=0)||(o=.3*r),(i=c)<Math.abs(c)?(i=c,a=o/4):a=o/(2*Math.PI)*Math.asin(c/i),i*Math.pow(2,-10*t)*Math.sin((t*r-a)*(2*Math.PI)/o)+c+e)},easeInOutElastic:function(t,e,n,r){var i,o,a,c=n-e;return a=1.70158,0===t?e:2==(t/=r/2)?e+c:((o=0)||(o=r*(.3*1.5)),(i=c)<Math.abs(c)?(i=c,a=o/4):a=o/(2*Math.PI)*Math.asin(c/i),t<1?i*Math.pow(2,10*(t-=1))*Math.sin((t*r-a)*(2*Math.PI)/o)*-.5+e:i*Math.pow(2,-10*(t-=1))*Math.sin((t*r-a)*(2*Math.PI)/o)*.5+c+e)},easeInBack:function(t,e,n,r,i){return void 0===i&&(i=1.70158),(n-e)*(t/=r)*t*((i+1)*t-i)+e},easeOutBack:function(t,e,n,r,i){return void 0===i&&(i=1.70158),(n-e)*((t=t/r-1)*t*((i+1)*t+i)+1)+e},easeInOutBack:function(t,e,n,r,i){var o=n-e;return void 0===i&&(i=1.70158),(t/=r/2)<1?o/2*(t*t*((1+(i*=1.525))*t-i))+e:o/2*((t-=2)*t*((1+(i*=1.525))*t+i)+2)+e},easeInBounce:function(t,e,n,i){var o=n-e;return o-r.easeOutBounce(i-t,0,o,i)+e},easeOutBounce:function(t,e,n,r){var i=n-e;return(t/=r)<1/2.75?i*(7.5625*t*t)+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e},easeInOutBounce:function(t,e,n,i){var o=n-e;return t<i/2?.5*r.easeInBounce(2*t,0,o,i)+e:.5*r.easeOutBounce(2*t-i,0,o,i)+.5*o+e}};t.exports=r},function(t,e,n){t.exports=n(3)},function(t,e,n){"use strict";n.r(e);var r,i,o=n(0),a=n.n(o),c=n(1),s=n.n(c);function u(t,e){return t+Math.random()*(e-t)}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}!function(t){t[t.Circle=0]="Circle",t[t.Square=1]="Square",t[t.Strip=2]="Strip"}(r||(r={})),function(t){t[t.Positive=1]="Positive",t[t.Negative=-1]="Negative"}(i||(i={}));var l=function(){function t(e,n,r,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),h(this,"context",void 0),h(this,"radius",void 0),h(this,"x",void 0),h(this,"y",void 0),h(this,"w",void 0),h(this,"h",void 0),h(this,"vx",void 0),h(this,"vy",void 0),h(this,"shape",void 0),h(this,"angle",void 0),h(this,"angularSpin",void 0),h(this,"color",void 0),h(this,"rotateY",void 0),h(this,"rotationDirection",void 0),h(this,"getOptions",void 0),this.getOptions=n;var a,c,s=this.getOptions(),f=s.colors,l=s.initialVelocityX,p=s.initialVelocityY;this.context=e,this.x=r,this.y=o,this.w=u(5,20),this.h=u(5,20),this.radius=u(5,10),this.vx=u(-l,l),this.vy=u(-p,0),this.shape=(a=0,c=2,Math.floor(a+Math.random()*(c-a+1))),this.angle=u(0,360)*Math.PI/180,this.angularSpin=u(-.2,.2),this.color=f[Math.floor(Math.random()*f.length)],this.rotateY=u(0,1),this.rotationDirection=u(0,1)?i.Positive:i.Negative}var e,n,o;return e=t,(n=[{key:"update",value:function(){var t=this.getOptions(),e=t.gravity,n=t.wind,o=t.friction,a=t.opacity,c=t.drawShape;this.x+=this.vx,this.y+=this.vy,this.vy+=e,this.vx+=n,this.vx*=o,this.vy*=o,this.rotateY>=1&&this.rotationDirection===i.Positive?this.rotationDirection=i.Negative:this.rotateY<=-1&&this.rotationDirection===i.Negative&&(this.rotationDirection=i.Positive);var s=.1*this.rotationDirection;if(this.rotateY+=s,this.angle+=this.angularSpin,this.context.save(),this.context.translate(this.x,this.y),this.context.rotate(this.angle),this.context.scale(1,this.rotateY),this.context.rotate(this.angle),this.context.beginPath(),this.context.fillStyle=this.color,this.context.strokeStyle=this.color,this.context.globalAlpha=a,this.context.lineCap="round",this.context.lineWidth=2,c&&"function"==typeof c)c.call(this,this.context);else switch(this.shape){case r.Circle:this.context.beginPath(),this.context.arc(0,0,this.radius,0,2*Math.PI),this.context.fill();break;case r.Square:this.context.fillRect(-this.w/2,-this.h/2,this.w,this.h);break;case r.Strip:this.context.fillRect(-this.w/6,-this.h/2,this.w/3,this.h);break;default:throw new Error("Unknown type in Particle.ts")}this.context.closePath(),this.context.restore()}}])&&f(e.prototype,n),o&&f(e,o),t}();function p(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var v=function t(e,n){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),p(this,"canvas",void 0),p(this,"context",void 0),p(this,"getOptions",void 0),p(this,"x",0),p(this,"y",0),p(this,"w",0),p(this,"h",0),p(this,"lastNumberOfPieces",0),p(this,"tweenInitTime",Date.now()),p(this,"particles",[]),p(this,"particlesGenerated",0),p(this,"removeParticleAt",function(t){r.particles.splice(t,1)}),p(this,"getParticle",function(){var t=u(r.x,r.w+r.x),e=u(r.y,r.h+r.y);return new l(r.context,r.getOptions,t,e)}),p(this,"animate",function(){var t=r.canvas,e=r.context,n=r.particlesGenerated,i=r.lastNumberOfPieces,o=r.getOptions(),a=o.run,c=o.recycle,s=o.numberOfPieces,u=o.debug,f=o.tweenFunction,h=o.tweenDuration;if(!a)return!1;var l=r.particles.length,p=c?l:n,v=Date.now();if(p<s){i!==s&&(r.tweenInitTime=v,r.lastNumberOfPieces=s);for(var y=r.tweenInitTime,d=f(v-y>h?h:Math.max(0,v-y),p,s,h),b=Math.round(d-p),g=0;g<b;g+=1)r.particles.push(r.getParticle());r.particlesGenerated+=b}return u&&(e.font="12px sans-serif",e.fillStyle="#333",e.textAlign="right",e.fillText("Particles: ".concat(l),t.width-10,t.height-20)),r.particles.forEach(function(e,n){e.update(),(e.y>t.height||e.y<-100||e.x>t.width+100||e.x<-100)&&(c&&p<=s?r.particles[n]=r.getParticle():r.removeParticleAt(n))}),l>0||p<s}),this.canvas=e;var i=this.canvas.getContext("2d");if(!i)throw new Error("Could not get canvas context");this.context=i,this.getOptions=n};function y(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function d(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function b(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var g={width:"undefined"!=typeof window?window.innerWidth:300,height:"undefined"!=typeof window?window.innerHeight:200,numberOfPieces:200,friction:.99,wind:0,gravity:.1,initialVelocityX:4,initialVelocityY:10,colors:["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4CAF50","#8BC34A","#CDDC39","#FFEB3B","#FFC107","#FF9800","#FF5722","#795548"],opacity:1,debug:!1,tweenFunction:s.a.easeInOutQuad,tweenDuration:5e3,recycle:!0,run:!0},O=function(){function t(e,n){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),b(this,"canvas",void 0),b(this,"context",void 0),b(this,"_options",void 0),b(this,"generator",void 0),b(this,"rafId",void 0),b(this,"setOptionsWithDefaults",function(t){var e={confettiSource:{x:0,y:0,w:r.canvas.width,h:0}};r._options=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?y(n,!0).forEach(function(e){b(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):y(n).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}({},e,{},g,{},t),Object.assign(r,t.confettiSource)}),b(this,"update",function(){var t=r.options,e=t.run,n=t.onConfettiComplete,i=r.canvas,o=r.context;e&&(o.fillStyle="white",o.clearRect(0,0,i.width,i.height)),r.generator.animate()?r.rafId=requestAnimationFrame(r.update):(n&&"function"==typeof n&&r.generator.particlesGenerated>0&&n.call(r,r),r._options.run=!1)}),b(this,"reset",function(){r.generator&&r.generator.particlesGenerated>0&&(r.generator.particlesGenerated=0,r.generator.particles=[],r.generator.lastNumberOfPieces=0)}),b(this,"stop",function(){r.options={run:!1},r.rafId&&(cancelAnimationFrame(r.rafId),r.rafId=void 0)}),this.canvas=e;var i=this.canvas.getContext("2d");if(!i)throw new Error("Could not get canvas context");this.context=i,this.generator=new v(this.canvas,function(){return r.options}),this.options=n,this.update()}var e,n,r;return e=t,(n=[{key:"options",get:function(){return this._options},set:function(t){var e=this._options&&this._options.run,n=this._options&&this._options.recycle;this.setOptionsWithDefaults(t),this.generator&&(Object.assign(this.generator,this.options.confettiSource),"boolean"==typeof t.recycle&&t.recycle&&!1===n&&(this.generator.lastNumberOfPieces=this.generator.particles.length)),"boolean"==typeof t.run&&t.run&&!1===e&&this.update()}}])&&d(e.prototype,n),r&&d(e,r),t}();function w(t){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function m(){return(m=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function x(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function P(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?x(n,!0).forEach(function(e){E(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):x(n).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function j(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{r||null==c.return||c.return()}finally{if(i)throw o}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function M(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function I(t){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function S(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function C(t,e){return(C=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function E(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function D(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}n.d(e,"ConfettiReact",function(){return R});var _=a.a.createRef();function k(t){var e={},n={},r=[].concat(D(Object.keys(g)),["confettiSource","drawShape","onConfettiComplete"]),i=["canvasRef"];return Object.keys(t).forEach(function(o){var a=t[o];r.includes(o)?e[o]=a:i.includes(o)?i[o]=a:n[o]=a}),[e,n,{}]}var A=function(t){function e(t){var n,r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var i=arguments.length,o=new Array(i>1?i-1:0),c=1;c<i;c++)o[c-1]=arguments[c];return r=function(t,e){return!e||"object"!==w(e)&&"function"!=typeof e?S(t):e}(this,(n=I(e)).call.apply(n,[this,t].concat(o))),E(S(r),"canvas",a.a.createRef()),E(S(r),"confetti",void 0),r.canvas=t.canvasRef||_,r}var n,r,i;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&C(t,e)}(e,o["Component"]),n=e,(r=[{key:"componentDidMount",value:function(){if(this.canvas.current){var t=k(this.props)[0];this.confetti=new O(this.canvas.current,t)}}},{key:"componentDidUpdate",value:function(){var t=k(this.props)[0];this.confetti&&(this.confetti.options=t)}},{key:"componentWillUnmount",value:function(){this.confetti&&this.confetti.stop(),this.confetti=void 0}},{key:"render",value:function(){var t=j(k(this.props),2),e=t[0],n=t[1],r=P({zIndex:2,position:"absolute",pointerEvents:"none",top:0,left:0,bottom:0,right:0},n.style);return a.a.createElement("canvas",m({width:e.width,height:e.height,ref:this.canvas},n,{style:r}))}}])&&M(n.prototype,r),i&&M(n,i),e}();E(A,"defaultProps",P({},g)),E(A,"displayName","ConfettiReact");var R=a.a.forwardRef(function(t,e){return a.a.createElement(A,m({canvasRef:_},t))});e.default=R}]).default});
//# sourceMappingURL=confetti-react.min.js.map
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var React = require('react');
var React__default = _interopDefault(React);
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
return arr2;
}
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _iterableToArrayLimit(arr, i) {
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
return;
}
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
// t: current time, b: beginning value, _c: final value, d: total duration
var tweenFunctions = {
linear: function(t, b, _c, d) {
var c = _c - b;
return c * t / d + b;
},
easeInQuad: function(t, b, _c, d) {
var c = _c - b;
return c * (t /= d) * t + b;
},
easeOutQuad: function(t, b, _c, d) {
var c = _c - b;
return -c * (t /= d) * (t - 2) + b;
},
easeInOutQuad: function(t, b, _c, d) {
var c = _c - b;
if ((t /= d / 2) < 1) {
return c / 2 * t * t + b;
} else {
return -c / 2 * ((--t) * (t - 2) - 1) + b;
}
},
easeInCubic: function(t, b, _c, d) {
var c = _c - b;
return c * (t /= d) * t * t + b;
},
easeOutCubic: function(t, b, _c, d) {
var c = _c - b;
return c * ((t = t / d - 1) * t * t + 1) + b;
},
easeInOutCubic: function(t, b, _c, d) {
var c = _c - b;
if ((t /= d / 2) < 1) {
return c / 2 * t * t * t + b;
} else {
return c / 2 * ((t -= 2) * t * t + 2) + b;
}
},
easeInQuart: function(t, b, _c, d) {
var c = _c - b;
return c * (t /= d) * t * t * t + b;
},
easeOutQuart: function(t, b, _c, d) {
var c = _c - b;
return -c * ((t = t / d - 1) * t * t * t - 1) + b;
},
easeInOutQuart: function(t, b, _c, d) {
var c = _c - b;
if ((t /= d / 2) < 1) {
return c / 2 * t * t * t * t + b;
} else {
return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
}
},
easeInQuint: function(t, b, _c, d) {
var c = _c - b;
return c * (t /= d) * t * t * t * t + b;
},
easeOutQuint: function(t, b, _c, d) {
var c = _c - b;
return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
},
easeInOutQuint: function(t, b, _c, d) {
var c = _c - b;
if ((t /= d / 2) < 1) {
return c / 2 * t * t * t * t * t + b;
} else {
return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
}
},
easeInSine: function(t, b, _c, d) {
var c = _c - b;
return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
},
easeOutSine: function(t, b, _c, d) {
var c = _c - b;
return c * Math.sin(t / d * (Math.PI / 2)) + b;
},
easeInOutSine: function(t, b, _c, d) {
var c = _c - b;
return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
},
easeInExpo: function(t, b, _c, d) {
var c = _c - b;
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
},
easeOutExpo: function(t, b, _c, d) {
var c = _c - b;
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
easeInOutExpo: function(t, b, _c, d) {
var c = _c - b;
if (t === 0) {
return b;
}
if (t === d) {
return b + c;
}
if ((t /= d / 2) < 1) {
return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
} else {
return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
}
},
easeInCirc: function(t, b, _c, d) {
var c = _c - b;
return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
},
easeOutCirc: function(t, b, _c, d) {
var c = _c - b;
return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
},
easeInOutCirc: function(t, b, _c, d) {
var c = _c - b;
if ((t /= d / 2) < 1) {
return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
} else {
return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
}
},
easeInElastic: function(t, b, _c, d) {
var c = _c - b;
var a, p, s;
s = 1.70158;
p = 0;
a = c;
if (t === 0) {
return b;
} else if ((t /= d) === 1) {
return b + c;
}
if (!p) {
p = d * 0.3;
}
if (a < Math.abs(c)) {
a = c;
s = p / 4;
} else {
s = p / (2 * Math.PI) * Math.asin(c / a);
}
return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
},
easeOutElastic: function(t, b, _c, d) {
var c = _c - b;
var a, p, s;
s = 1.70158;
p = 0;
a = c;
if (t === 0) {
return b;
} else if ((t /= d) === 1) {
return b + c;
}
if (!p) {
p = d * 0.3;
}
if (a < Math.abs(c)) {
a = c;
s = p / 4;
} else {
s = p / (2 * Math.PI) * Math.asin(c / a);
}
return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
},
easeInOutElastic: function(t, b, _c, d) {
var c = _c - b;
var a, p, s;
s = 1.70158;
p = 0;
a = c;
if (t === 0) {
return b;
} else if ((t /= d / 2) === 2) {
return b + c;
}
if (!p) {
p = d * (0.3 * 1.5);
}
if (a < Math.abs(c)) {
a = c;
s = p / 4;
} else {
s = p / (2 * Math.PI) * Math.asin(c / a);
}
if (t < 1) {
return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
} else {
return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * 0.5 + c + b;
}
},
easeInBack: function(t, b, _c, d, s) {
var c = _c - b;
if (s === void 0) {
s = 1.70158;
}
return c * (t /= d) * t * ((s + 1) * t - s) + b;
},
easeOutBack: function(t, b, _c, d, s) {
var c = _c - b;
if (s === void 0) {
s = 1.70158;
}
return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
},
easeInOutBack: function(t, b, _c, d, s) {
var c = _c - b;
if (s === void 0) {
s = 1.70158;
}
if ((t /= d / 2) < 1) {
return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b;
} else {
return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;
}
},
easeInBounce: function(t, b, _c, d) {
var c = _c - b;
var v;
v = tweenFunctions.easeOutBounce(d - t, 0, c, d);
return c - v + b;
},
easeOutBounce: function(t, b, _c, d) {
var c = _c - b;
if ((t /= d) < 1 / 2.75) {
return c * (7.5625 * t * t) + b;
} else if (t < 2 / 2.75) {
return c * (7.5625 * (t -= 1.5 / 2.75) * t + 0.75) + b;
} else if (t < 2.5 / 2.75) {
return c * (7.5625 * (t -= 2.25 / 2.75) * t + 0.9375) + b;
} else {
return c * (7.5625 * (t -= 2.625 / 2.75) * t + 0.984375) + b;
}
},
easeInOutBounce: function(t, b, _c, d) {
var c = _c - b;
var v;
if (t < d / 2) {
v = tweenFunctions.easeInBounce(t * 2, 0, c, d);
return v * 0.5 + b;
} else {
v = tweenFunctions.easeOutBounce(t * 2 - d, 0, c, d);
return v * 0.5 + c * 0.5 + b;
}
}
};
var tweenFunctions_1 = tweenFunctions;
function degreesToRads(degrees) {
return degrees * Math.PI / 180;
}
function randomRange(min, max) {
return min + Math.random() * (max - min);
}
function randomInt(min, max) {
return Math.floor(min + Math.random() * (max - min + 1));
}
var ParticleShape;
(function (ParticleShape) {
ParticleShape[ParticleShape["Circle"] = 0] = "Circle";
ParticleShape[ParticleShape["Square"] = 1] = "Square";
ParticleShape[ParticleShape["Strip"] = 2] = "Strip";
})(ParticleShape || (ParticleShape = {}));
var RotationDirection;
(function (RotationDirection) {
RotationDirection[RotationDirection["Positive"] = 1] = "Positive";
RotationDirection[RotationDirection["Negative"] = -1] = "Negative";
})(RotationDirection || (RotationDirection = {}));
var Particle = /*#__PURE__*/function () {
function Particle(context, getOptions, x, y) {
_classCallCheck(this, Particle);
this.context = void 0;
this.radius = void 0;
this.x = void 0;
this.y = void 0;
this.w = void 0;
this.h = void 0;
this.vx = void 0;
this.vy = void 0;
this.shape = void 0;
this.angle = void 0;
this.angularSpin = void 0;
this.color = void 0;
this.rotateY = void 0;
this.rotationDirection = void 0;
this.getOptions = void 0;
this.getOptions = getOptions;
var _this$getOptions = this.getOptions(),
colors = _this$getOptions.colors,
initialVelocityX = _this$getOptions.initialVelocityX,
initialVelocityY = _this$getOptions.initialVelocityY;
this.context = context;
this.x = x;
this.y = y;
this.w = randomRange(5, 20);
this.h = randomRange(5, 20);
this.radius = randomRange(5, 10);
this.vx = randomRange(-initialVelocityX, initialVelocityX);
this.vy = randomRange(-initialVelocityY, 0);
this.shape = randomInt(0, 2);
this.angle = degreesToRads(randomRange(0, 360));
this.angularSpin = randomRange(-0.2, 0.2);
this.color = colors[Math.floor(Math.random() * colors.length)];
this.rotateY = randomRange(0, 1);
this.rotationDirection = randomRange(0, 1) ? RotationDirection.Positive : RotationDirection.Negative;
}
_createClass(Particle, [{
key: "update",
value: function update() {
var _this$getOptions2 = this.getOptions(),
gravity = _this$getOptions2.gravity,
wind = _this$getOptions2.wind,
friction = _this$getOptions2.friction,
opacity = _this$getOptions2.opacity,
drawShape = _this$getOptions2.drawShape;
this.x += this.vx;
this.y += this.vy;
this.vy += gravity;
this.vx += wind;
this.vx *= friction;
this.vy *= friction;
if (this.rotateY >= 1 && this.rotationDirection === RotationDirection.Positive) {
this.rotationDirection = RotationDirection.Negative;
} else if (this.rotateY <= -1 && this.rotationDirection === RotationDirection.Negative) {
this.rotationDirection = RotationDirection.Positive;
}
var rotateDelta = 0.1 * this.rotationDirection;
this.rotateY += rotateDelta;
this.angle += this.angularSpin;
this.context.save();
this.context.translate(this.x, this.y);
this.context.rotate(this.angle);
this.context.scale(1, this.rotateY);
this.context.rotate(this.angle);
this.context.beginPath();
this.context.fillStyle = this.color;
this.context.strokeStyle = this.color;
this.context.globalAlpha = opacity;
this.context.lineCap = 'round';
this.context.lineWidth = 2;
if (drawShape && typeof drawShape === 'function') {
drawShape.call(this, this.context);
} else {
switch (this.shape) {
case ParticleShape.Circle:
{
this.context.beginPath();
this.context.arc(0, 0, this.radius, 0, 2 * Math.PI);
this.context.fill();
break;
}
case ParticleShape.Square:
{
this.context.fillRect(-this.w / 2, -this.h / 2, this.w, this.h);
break;
}
case ParticleShape.Strip:
{
this.context.fillRect(-this.w / 6, -this.h / 2, this.w / 3, this.h);
break;
}
default:
{
throw new Error('Unknown type in Particle.ts');
}
}
}
this.context.closePath();
this.context.restore();
}
}]);
return Particle;
}();
var ParticleGeneratorClass = function ParticleGeneratorClass(_canvas, getOptions) {
var _this = this;
_classCallCheck(this, ParticleGeneratorClass);
this.canvas = void 0;
this.context = void 0;
this.getOptions = void 0;
this.x = 0;
this.y = 0;
this.w = 0;
this.h = 0;
this.lastNumberOfPieces = 0;
this.tweenInitTime = Date.now();
this.particles = [];
this.particlesGenerated = 0;
this.removeParticleAt = function (i) {
_this.particles.splice(i, 1);
};
this.getParticle = function () {
var newParticleX = randomRange(_this.x, _this.w + _this.x);
var newParticleY = randomRange(_this.y, _this.h + _this.y);
return new Particle(_this.context, _this.getOptions, newParticleX, newParticleY);
};
this.animate = function () {
var canvas = _this.canvas,
context = _this.context,
particlesGenerated = _this.particlesGenerated,
lastNumberOfPieces = _this.lastNumberOfPieces;
var _this$getOptions = _this.getOptions(),
run = _this$getOptions.run,
recycle = _this$getOptions.recycle,
numberOfPieces = _this$getOptions.numberOfPieces,
debug = _this$getOptions.debug,
tweenFunction = _this$getOptions.tweenFunction,
tweenDuration = _this$getOptions.tweenDuration;
if (!run) {
return false;
}
var nP = _this.particles.length;
var activeCount = recycle ? nP : particlesGenerated;
var now = Date.now(); // Initial population
if (activeCount < numberOfPieces) {
// Use the numberOfPieces prop as a key to reset the easing timing
if (lastNumberOfPieces !== numberOfPieces) {
_this.tweenInitTime = now;
_this.lastNumberOfPieces = numberOfPieces;
}
var tweenInitTime = _this.tweenInitTime; // Add more than one piece per loop, otherwise the number of pieces would
// be limitted by the RAF framerate
var progressTime = now - tweenInitTime > tweenDuration ? tweenDuration : Math.max(0, now - tweenInitTime);
var tweenedVal = tweenFunction(progressTime, activeCount, numberOfPieces, tweenDuration);
var numToAdd = Math.round(tweenedVal - activeCount);
for (var i = 0; i < numToAdd; i += 1) {
_this.particles.push(_this.getParticle());
}
_this.particlesGenerated += numToAdd;
}
if (debug) {
// Draw debug text
context.font = '12px sans-serif';
context.fillStyle = '#333';
context.textAlign = 'right';
context.fillText("Particles: ".concat(nP), canvas.width - 10, canvas.height - 20);
} // Maintain the population
_this.particles.forEach(function (p, i) {
// Update each particle's position
p.update(); // Prune the off-canvas particles
if (p.y > canvas.height || p.y < -100 || p.x > canvas.width + 100 || p.x < -100) {
if (recycle && activeCount <= numberOfPieces) {
// Replace the particle with a brand new one
_this.particles[i] = _this.getParticle();
} else {
_this.removeParticleAt(i);
}
}
});
return nP > 0 || activeCount < numberOfPieces;
};
this.canvas = _canvas;
var ctx = this.canvas.getContext('2d');
if (!ctx) {
throw new Error('Could not get canvas context');
}
this.context = ctx;
this.getOptions = getOptions;
};
var confettiDefaults = {
width: typeof window !== 'undefined' ? window.innerWidth : 300,
height: typeof window !== 'undefined' ? window.innerHeight : 200,
numberOfPieces: 200,
friction: 0.99,
wind: 0,
gravity: 0.1,
initialVelocityX: 4,
initialVelocityY: 10,
colors: ['#f44336', '#e91e63', '#9c27b0', '#673ab7', '#3f51b5', '#2196f3', '#03a9f4', '#00bcd4', '#009688', '#4CAF50', '#8BC34A', '#CDDC39', '#FFEB3B', '#FFC107', '#FF9800', '#FF5722', '#795548'],
opacity: 1.0,
debug: false,
tweenFunction: tweenFunctions_1.easeInOutQuad,
tweenDuration: 5000,
recycle: true,
run: true
};
var Confetti = /*#__PURE__*/function () {
function Confetti(_canvas, _opts) {
var _this = this;
_classCallCheck(this, Confetti);
this.canvas = void 0;
this.context = void 0;
this._options = void 0;
this.generator = void 0;
this.rafId = void 0;
this.setOptionsWithDefaults = function (opts) {
var computedConfettiDefaults = {
confettiSource: {
x: 0,
y: 0,
w: _this.canvas.width,
h: 0
}
};
_this._options = _objectSpread2({}, computedConfettiDefaults, {}, confettiDefaults, {}, opts);
Object.assign(_this, opts.confettiSource);
};
this.update = function () {
var _this$options = _this.options,
run = _this$options.run,
onConfettiComplete = _this$options.onConfettiComplete,
canvas = _this.canvas,
context = _this.context;
if (run) {
context.fillStyle = 'white';
context.clearRect(0, 0, canvas.width, canvas.height);
}
if (_this.generator.animate()) {
_this.rafId = requestAnimationFrame(_this.update);
} else {
if (onConfettiComplete && typeof onConfettiComplete === 'function' && _this.generator.particlesGenerated > 0) {
onConfettiComplete.call(_this, _this);
}
_this._options.run = false;
}
};
this.reset = function () {
if (_this.generator && _this.generator.particlesGenerated > 0) {
_this.generator.particlesGenerated = 0;
_this.generator.particles = [];
_this.generator.lastNumberOfPieces = 0;
}
};
this.stop = function () {
_this.options = {
run: false
};
if (_this.rafId) {
cancelAnimationFrame(_this.rafId);
_this.rafId = undefined;
}
};
this.canvas = _canvas;
var ctx = this.canvas.getContext('2d');
if (!ctx) {
throw new Error('Could not get canvas context');
}
this.context = ctx;
this.generator = new ParticleGeneratorClass(this.canvas, function () {
return _this.options;
});
this.options = _opts;
this.update();
}
_createClass(Confetti, [{
key: "options",
get: function get() {
return this._options;
},
set: function set(opts) {
var lastRunState = this._options && this._options.run;
var lastRecycleState = this._options && this._options.recycle;
this.setOptionsWithDefaults(opts);
if (this.generator) {
Object.assign(this.generator, this.options.confettiSource);
if (typeof opts.recycle === 'boolean' && opts.recycle && lastRecycleState === false) {
this.generator.lastNumberOfPieces = this.generator.particles.length;
}
}
if (typeof opts.run === 'boolean' && opts.run && lastRunState === false) {
this.update();
}
}
}]);
return Confetti;
}();
var ref = React__default.createRef();
function extractCanvasProps(props) {
var confettiOptions = {};
var refs = {};
var rest = {};
var confettiOptionKeys = [].concat(_toConsumableArray(Object.keys(confettiDefaults)), ['confettiSource', 'drawShape', 'onConfettiComplete']);
var refProps = ['canvasRef'];
Object.keys(props).forEach(function (prop) {
var val = props[prop];
if (confettiOptionKeys.includes(prop)) {
confettiOptions[prop] = val;
} else if (refProps.includes(prop)) {
refProps[prop] = val;
} else {
rest[prop] = val;
}
});
return [confettiOptions, rest, refs];
}
var ConfettiReactInternal = /*#__PURE__*/function (_Component) {
_inherits(ConfettiReactInternal, _Component);
function ConfettiReactInternal(props) {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, ConfettiReactInternal);
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
rest[_key - 1] = arguments[_key];
}
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(ConfettiReactInternal)).call.apply(_getPrototypeOf2, [this, props].concat(rest)));
_this.canvas = React__default.createRef();
_this.confetti = void 0;
_this.canvas = props.canvasRef || ref;
return _this;
}
_createClass(ConfettiReactInternal, [{
key: "componentDidMount",
value: function componentDidMount() {
if (this.canvas.current) {
var opts = extractCanvasProps(this.props)[0];
this.confetti = new Confetti(this.canvas.current, opts);
}
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate() {
var confettiOptions = extractCanvasProps(this.props)[0];
if (this.confetti) {
this.confetti.options = confettiOptions;
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
if (this.confetti) {
this.confetti.stop();
}
this.confetti = undefined;
}
}, {
key: "render",
value: function render() {
var _extractCanvasProps = extractCanvasProps(this.props),
_extractCanvasProps2 = _slicedToArray(_extractCanvasProps, 2),
confettiOptions = _extractCanvasProps2[0],
passedProps = _extractCanvasProps2[1];
var canvasStyles = _objectSpread2({
zIndex: 2,
position: 'absolute',
pointerEvents: 'none',
top: 0,
left: 0,
bottom: 0,
right: 0
}, passedProps.style);
return React__default.createElement("canvas", _extends({
width: confettiOptions.width,
height: confettiOptions.height,
ref: this.canvas
}, passedProps, {
style: canvasStyles
}));
}
}]);
return ConfettiReactInternal;
}(React.Component); // eslint-disable-next-line react/display-name
ConfettiReactInternal.defaultProps = _objectSpread2({}, confettiDefaults);
ConfettiReactInternal.displayName = 'ConfettiReact';
var Index = React__default.forwardRef(function (props, _ref) {
return React__default.createElement(ConfettiReactInternal, _extends({
canvasRef: ref
}, props));
});
exports.Index = Index;
exports.default = Index;
//# sourceMappingURL=confetti-react.min.js.map

77

package.json
{
"name": "confetti-react",
"version": "2.4.3",
"version": "2.4.4",
"description": "React component to draw confetti for your party.",
"browser": "dist/formsy-react.umd.js",
"main": "dist/confetti-react.min.js",
"types": "dist/types/ConfettiReact.d.ts",
"module": "dist/confetti-react.esm.js",
"types": "dist/index.d.ts",
"repository": {

@@ -26,23 +28,18 @@ "type": "git",

"LICENSE.md",
"dist/",
"index.js"
"dist"
],
"scripts": {
"build": "yarn build-types && yarn build-transpile && yarn build-bundle",
"build-bundle": "webpack",
"build-storybook": "build-storybook -s ./.storybook/public",
"build-transpile": "babel src --out-dir dist --extensions \".ts\"",
"build-types": "tsc",
"clean": "git clean -xfd dist/",
"cleanall": "git clean -xfd .",
"commit": "git-cz",
"build": "npm run build:clean && npm run build:types && npm run build:js",
"build:clean": "rm -r dist/* || true",
"build:js": "rollup -c",
"build:types": "tsc --emitDeclarationOnly",
"deploy": "np",
"develop": "start-storybook -p 3000",
"docs:build": "build-storybook -s ./.storybook/public",
"docs:watch": "start-storybook -p 3000",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,md}\"",
"lint": "eslint . --ext .js --ext .ts --ext .tsx",
"prebuild": "yarn clean",
"prepare": "yarn run lint",
"lint": "eslint .",
"prepare": "npm run lint",
"semantic-release": "semantic-release",
"test": "tsc; yarn run lint",
"watch": "webpack --watch"
"test": "tsc; npm run lint",
"version": "npm run build && git add dist"
},

@@ -53,23 +50,13 @@ "peerDependencies": {

"dependencies": {
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"babelrc-rollup": "^3.0.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-peer-deps-external": "^2.2.2",
"tween-functions": "^1.2.0"
},
"devDependencies": {
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-object-rest-spread": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.3.3",
"@semantic-release/changelog": "^3.0.2",
"@semantic-release/commit-analyzer": "^6.1.0",
"@semantic-release/git": "^7.0.8",
"@semantic-release/github": "^5.2.10",
"@semantic-release/npm": "^5.1.4",
"@semantic-release/release-notes-generator": "^7.1.4",
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.7",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/preset-env": "^7.8.7",
"@babel/preset-react": "^7.8.3",
"@babel/preset-typescript": "^7.8.3",
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"@storybook/addon-actions": "^5.1.10",

@@ -84,9 +71,7 @@ "@storybook/addon-info": "^5.1.10",

"@storybook/theming": "^5.3.17",
"@types/react": "^16.8.24",
"@types/react": "^16.9.23",
"@typescript-eslint/eslint-plugin": "^2.23.0",
"@typescript-eslint/parser": "^2.23.0",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.5",
"commitizen": "^4.0.3",
"cz-conventional-changelog": "^3.0.2",
"babelrc-rollup": "^3.0.0",
"eslint": "^6.8.0",

@@ -97,8 +82,7 @@ "eslint-config-airbnb": "^18.1.0",

"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-node": "^9.0.1",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react-hooks": "^1.0.1",
"nodemon": "^1.18.10",
"eslint-plugin-react-hooks": "^2.5.0",
"np": "^5.0.0",

@@ -112,6 +96,5 @@ "prettier": "^1.19.1",

"rollup": "^2.0.6",
"semantic-release": "^15.13.19",
"typescript": "^3.3.3333",
"webpack": "^4.39.1",
"webpack-cli": "^3.3.6"
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-peer-deps-external": "^2.2.2",
"typescript": "^3.3.3333"
},

@@ -118,0 +101,0 @@ "config": {

# confetti-react
Confetti without the cleanup. [Demo](http://alampros.github.io/confetti-react/)
Confetti without the cleanup. [Demo](http://rkuykendall.github.io/confetti-react/)

@@ -14,4 +14,4 @@ [![Build Status](https://travis-ci.org/rkuykendall/confetti-react.svg?branch=master)](https://travis-ci.org/rkuykendall/confetti-react)

[1]: http://alampros.github.com/confetti-react
[2]: http://alampros.github.io/confetti-react/confetti-demo-anim.gif 'demo gif'
[1]: http://rkuykendall.github.com/confetti-react
[2]: http://rkuykendall.github.io/confetti-react/confetti-demo-anim.gif 'demo gif'

@@ -18,0 +18,0 @@ ## Install

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc