react-confetti-boom
Advanced tools
Comparing version 1.1.0 to 1.1.2
@@ -1,2 +0,2 @@ | ||
/// <reference types="react" /> | ||
import { ReactElement } from 'react'; | ||
type Props = { | ||
@@ -21,4 +21,4 @@ mode?: 'boom'; | ||
}; | ||
declare function Confetti(props: Props): JSX.Element; | ||
declare function Confetti(props: Props): ReactElement; | ||
export default Confetti; | ||
export type { Props as ConfettiProps }; |
import React, { useRef, useCallback, useEffect } from 'react'; | ||
function styleInject(css, ref) { | ||
if ( ref === void 0 ) ref = {}; | ||
var insertAt = ref.insertAt; | ||
if (!css || typeof document === 'undefined') { return; } | ||
var head = document.head || document.getElementsByTagName('head')[0]; | ||
var style = document.createElement('style'); | ||
style.type = 'text/css'; | ||
if (insertAt === 'top') { | ||
if (head.firstChild) { | ||
head.insertBefore(style, head.firstChild); | ||
} else { | ||
head.appendChild(style); | ||
} | ||
} else { | ||
head.appendChild(style); | ||
} | ||
if (style.styleSheet) { | ||
style.styleSheet.cssText = css; | ||
} else { | ||
style.appendChild(document.createTextNode(css)); | ||
} | ||
} | ||
var css_248z = ".index-module_canvas__H2w7d {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n pointer-events: none;\n}"; | ||
var styles = {"canvas":"index-module_canvas__H2w7d"}; | ||
styleInject(css_248z); | ||
var randomNumBetween = function (min, max) { | ||
@@ -100,33 +131,2 @@ return Math.random() * (max - min) + min; | ||
function styleInject(css, ref) { | ||
if ( ref === void 0 ) ref = {}; | ||
var insertAt = ref.insertAt; | ||
if (!css || typeof document === 'undefined') { return; } | ||
var head = document.head || document.getElementsByTagName('head')[0]; | ||
var style = document.createElement('style'); | ||
style.type = 'text/css'; | ||
if (insertAt === 'top') { | ||
if (head.firstChild) { | ||
head.insertBefore(style, head.firstChild); | ||
} else { | ||
head.appendChild(style); | ||
} | ||
} else { | ||
head.appendChild(style); | ||
} | ||
if (style.styleSheet) { | ||
style.styleSheet.cssText = css; | ||
} else { | ||
style.appendChild(document.createTextNode(css)); | ||
} | ||
} | ||
var css_248z = ".index-module_canvas__H2w7d {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n pointer-events: none;\n}"; | ||
var styles = {"canvas":"index-module_canvas__H2w7d"}; | ||
styleInject(css_248z); | ||
var FPS = 60; | ||
@@ -145,3 +145,3 @@ var INTERVAL = 1000 / FPS; | ||
// boom or common props | ||
var _e = props.mode === 'boom' ? props : { | ||
var _e = props.mode === 'boom' || props.mode === undefined ? props : { | ||
effectInterval: 1, | ||
@@ -148,0 +148,0 @@ effectCount: Infinity |
@@ -5,2 +5,33 @@ 'use strict'; | ||
function styleInject(css, ref) { | ||
if ( ref === void 0 ) ref = {}; | ||
var insertAt = ref.insertAt; | ||
if (!css || typeof document === 'undefined') { return; } | ||
var head = document.head || document.getElementsByTagName('head')[0]; | ||
var style = document.createElement('style'); | ||
style.type = 'text/css'; | ||
if (insertAt === 'top') { | ||
if (head.firstChild) { | ||
head.insertBefore(style, head.firstChild); | ||
} else { | ||
head.appendChild(style); | ||
} | ||
} else { | ||
head.appendChild(style); | ||
} | ||
if (style.styleSheet) { | ||
style.styleSheet.cssText = css; | ||
} else { | ||
style.appendChild(document.createTextNode(css)); | ||
} | ||
} | ||
var css_248z = ".index-module_canvas__H2w7d {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n pointer-events: none;\n}"; | ||
var styles = {"canvas":"index-module_canvas__H2w7d"}; | ||
styleInject(css_248z); | ||
var randomNumBetween = function (min, max) { | ||
@@ -103,33 +134,2 @@ return Math.random() * (max - min) + min; | ||
function styleInject(css, ref) { | ||
if ( ref === void 0 ) ref = {}; | ||
var insertAt = ref.insertAt; | ||
if (!css || typeof document === 'undefined') { return; } | ||
var head = document.head || document.getElementsByTagName('head')[0]; | ||
var style = document.createElement('style'); | ||
style.type = 'text/css'; | ||
if (insertAt === 'top') { | ||
if (head.firstChild) { | ||
head.insertBefore(style, head.firstChild); | ||
} else { | ||
head.appendChild(style); | ||
} | ||
} else { | ||
head.appendChild(style); | ||
} | ||
if (style.styleSheet) { | ||
style.styleSheet.cssText = css; | ||
} else { | ||
style.appendChild(document.createTextNode(css)); | ||
} | ||
} | ||
var css_248z = ".index-module_canvas__H2w7d {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n pointer-events: none;\n}"; | ||
var styles = {"canvas":"index-module_canvas__H2w7d"}; | ||
styleInject(css_248z); | ||
var FPS = 60; | ||
@@ -148,3 +148,3 @@ var INTERVAL = 1000 / FPS; | ||
// boom or common props | ||
var _e = props.mode === 'boom' ? props : { | ||
var _e = props.mode === 'boom' || props.mode === undefined ? props : { | ||
effectInterval: 1, | ||
@@ -151,0 +151,0 @@ effectCount: Infinity |
{ | ||
"name": "react-confetti-boom", | ||
"version": "1.1.0", | ||
"version": "1.1.2", | ||
"description": "A customizable React confetti explosion component for celebrations and special events", | ||
@@ -5,0 +5,0 @@ "author": "almond-bongbong <bal.dongdongdong@gmail.com>", |
@@ -53,5 +53,2 @@ # React Confetti Boom π - Celebrate With Style! | ||
<details> | ||
<summary>And much more!</summary> | ||
| Name | Type | Default | Description | | ||
@@ -72,4 +69,2 @@ | -------------- | ---------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------- | | ||
</details> | ||
## π Example Usage | ||
@@ -76,0 +71,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
31792
89