react-canvas-confetti
Advanced tools
Comparing version
@@ -46,2 +46,17 @@ "use strict"; | ||
}; | ||
var DEFAULT_STYLE = { | ||
position: "fixed", | ||
pointerEvents: "none", | ||
width: "100%", | ||
height: "100%", | ||
zIndex: -1, | ||
top: 0, | ||
left: 0, | ||
}; | ||
function getFinalStyle(style, className) { | ||
if (!style && !className) { | ||
return DEFAULT_STYLE; | ||
} | ||
return style; | ||
} | ||
function ReactCanvasConfetti(_a) { | ||
@@ -62,4 +77,4 @@ var style = _a.style, className = _a.className, width = _a.width, height = _a.height, globalOptions = _a.globalOptions, onInit = _a.onInit; | ||
}, []); | ||
return (react_1.default.createElement("canvas", { ref: canvasRef, style: style, className: className, width: width, height: height })); | ||
return (react_1.default.createElement("canvas", { ref: canvasRef, style: getFinalStyle(style, className), className: className, width: width, height: height })); | ||
} | ||
exports.default = ReactCanvasConfetti; |
{ | ||
"name": "react-canvas-confetti", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "React component for canvas-confetti library", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -41,10 +41,4 @@ # [react-canvas-confetti](https://ulitcos.github.io/react-canvas-confetti/) | ||
const canvasStyles = { | ||
position: "fixed", | ||
width: "100%", | ||
height: "100%", | ||
}; | ||
function Example() { | ||
return <Fireworks autorun={{ speed: 3 }} style={canvasStyles} />; | ||
return <Fireworks autorun={{ speed: 3 }} />; | ||
} | ||
@@ -59,3 +53,3 @@ | ||
#### Conductor Instance [TConductorInstance] | ||
#### Conductor Instance | ||
@@ -83,3 +77,3 @@ The preset working can be controlled manually using the `Conductor instance`. This object allows you to start and stop animations on demand. Conductor can be accessed in the `onInit` callback. The interface of the object is shown below: | ||
#### Canvas-confetti instance: [TCanvasConfettiInstance] | ||
#### Canvas-confetti instance | ||
@@ -86,0 +80,0 @@ [Confetti object](https://github.com/catdad/canvas-confetti?tab=readme-ov-file#confettioptions-object--promisenull), which will be received as a result of calling the [function create](https://github.com/catdad/canvas-confetti?tab=readme-ov-file#confetticreatecanvas-globaloptions--function). Gives you full control to create your own animations. Confetti can be accessed in the `onInit` callback. The interface can be viewed [here](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/canvas-confetti/index.d.ts#L173) |
Sorry, the diff of this file is not supported yet
46633
1.1%1089
2.83%123
-4.65%