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

canvas-confetti

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

canvas-confetti - npm Package Compare versions

Comparing version

to
1.2.0

15

dist/confetti.browser.js

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

// canvas-confetti v1.1.3 built on 2020-03-30T22:23:12.516Z
// canvas-confetti v1.2.0 built on 2020-04-03T22:26:09.865Z
!(function (window, module) {

@@ -191,3 +191,5 @@ // source content

'#ff36ff'
]
],
// probably should be true, but back-compat
disableForReducedMotion: false
};

@@ -406,2 +408,3 @@

var allowResize = !!prop(globalOpts || {}, 'resize');
var globalDisableForReducedMotion = prop(globalOpts, 'disableForReducedMotion', Boolean);
var shouldUseWorker = canUseWorker && !!prop(globalOpts || {}, 'useWorker');

@@ -411,2 +414,3 @@ var worker = shouldUseWorker ? getWorker() : null;

var initialized = (canvas && worker) ? !!canvas.__confetti_initialized : false;
var preferLessMotion = typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion)').matches;
var animationObj;

@@ -461,4 +465,11 @@

function fire(options) {
var disableForReducedMotion = globalDisableForReducedMotion || prop(options, 'disableForReducedMotion', Boolean);
var zIndex = prop(options, 'zIndex', Number);
if (disableForReducedMotion && preferLessMotion) {
return promise(function (resolve) {
resolve();
});
}
if (isLibCanvas && animationObj) {

@@ -465,0 +476,0 @@ // use existing canvas from in-progress animation

2

package.json
{
"name": "canvas-confetti",
"version": "1.1.3",
"version": "1.2.0",
"description": "performant confetti animation in the browser",

@@ -5,0 +5,0 @@ "main": "src/confetti.js",

@@ -33,3 +33,3 @@ # 🎊 canvas confetti 🎊

```html
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.1.3/dist/confetti.browser.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.2.0/dist/confetti.browser.min.js"></script>
```

@@ -39,2 +39,6 @@

## Reduced Motion
Thank you for joining me in this very important message about motion on your website. See, [not everyone likes it, and some actually prefer no motion](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion). They have [ways to tell us about it](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion) and we should listen. While I don't want to go as far as tell you not to have confetti on your page just yet, I do want to make it easy for you to respect what your users want. There is a `disableForReducedMotion` option you can use so that users that have trouble with chaotic animations don't need to struggle on your website. This is disabled by default, but I am considering changing that in a future major release. If you have strong feelings about this, [please let me know](https://github.com/catdad/canvas-confetti/issues/new). For now, please confetti responsibly.
## API

@@ -73,2 +77,3 @@

- `zIndex` _Integer (default: 100)_: The confetti should be on top, after all. But if you have a crazy high page, you can set it even higher.
- `disableForReducedMotion` _Boolean (default: false)_: Disables confetti entirely for users that [prefer reduced motion](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion). The `confetti()` promise will resolve immediately in this case.

@@ -86,2 +91,3 @@ ### `confetti.create(canvas, [globalOptions])` → `function`

* `useWorker` _Boolean (default: false)_: Whether to use an asynchronous web worker to render the confetti animation, whenever possible. This is turned off by default, meaning that the animation will always execute on the main thread. If turned on and the browser supports it, the animation will execute off of the main thread so that it is not blocking any other work your page needs to do. Using this option will also modify the canvas, but more on that directly below -- do read it. If it is not supported by the browser, this value will be ignored.
* `disableForReducedMotion` _Boolean (default: false)_: Disables confetti entirely for users that [prefer reduced motion](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion). When set to true, use of this confetti instance will always respect a user's request for reduced motion and disable confetti for them.

@@ -88,0 +94,0 @@ _**Important: If you use `useWorker: true`, I own your canvas now. It's mine now and I can do whatever I want with it (don't worry... I'll just put confetti inside it, I promise). You must not try to use the canvas in any way (other than I guess removing it from the DOM), as it will throw an error. When using workers for rendering, control of the canvas must be transfered to the web worker, preventing any usage of that canvas on the main thread. If you must manipulate the canvas in any way, do not use this option.**_

@@ -188,3 +188,5 @@ (function main(global, module, isWorker, workerSize) {

'#ff36ff'
]
],
// probably should be true, but back-compat
disableForReducedMotion: false
};

@@ -403,2 +405,3 @@

var allowResize = !!prop(globalOpts || {}, 'resize');
var globalDisableForReducedMotion = prop(globalOpts, 'disableForReducedMotion', Boolean);
var shouldUseWorker = canUseWorker && !!prop(globalOpts || {}, 'useWorker');

@@ -408,2 +411,3 @@ var worker = shouldUseWorker ? getWorker() : null;

var initialized = (canvas && worker) ? !!canvas.__confetti_initialized : false;
var preferLessMotion = typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion)').matches;
var animationObj;

@@ -458,4 +462,11 @@

function fire(options) {
var disableForReducedMotion = globalDisableForReducedMotion || prop(options, 'disableForReducedMotion', Boolean);
var zIndex = prop(options, 'zIndex', Number);
if (disableForReducedMotion && preferLessMotion) {
return promise(function (resolve) {
resolve();
});
}
if (isLibCanvas && animationObj) {

@@ -462,0 +473,0 @@ // use existing canvas from in-progress animation

Sorry, the diff of this file is not supported yet