celebrate-js 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +170 -0
- package/dist/index.cjs +625 -0
- package/dist/index.d.cts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +599 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License Copyright (c) 2025 akshaywritescode
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted,
|
|
4
|
+
free of charge, to any person obtaining a copy of this software and associated
|
|
5
|
+
documentation files (the "Software"), to deal in the Software without
|
|
6
|
+
restriction, including without limitation the rights to use, copy, modify, merge,
|
|
7
|
+
publish, distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to the
|
|
9
|
+
following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice
|
|
12
|
+
(including the next paragraph) shall be included in all copies or substantial
|
|
13
|
+
portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
16
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
|
|
18
|
+
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
19
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
20
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# celebrate-js 🎉
|
|
2
|
+
|
|
3
|
+
A lightweight, zero-dependency JavaScript library to add beautiful celebration effects to your website — confetti, fireworks, balloons, emoji rain, and more.
|
|
4
|
+
|
|
5
|
+
Perfect for success screens, onboarding, achievements, or fun UI moments.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- Multiple celebration effects
|
|
12
|
+
- Customizable colors 🎨
|
|
13
|
+
- Lightweight and fast
|
|
14
|
+
- Simple API
|
|
15
|
+
- Tree-shakable
|
|
16
|
+
- TypeScript support
|
|
17
|
+
- Optional reduced-motion support
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install celebrate-js
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
or
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
yarn add celebrate-js
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
import { celebrate } from "celebrate-js";
|
|
39
|
+
|
|
40
|
+
// Default effect (confetti)
|
|
41
|
+
celebrate();
|
|
42
|
+
|
|
43
|
+
// Specific effects
|
|
44
|
+
celebrate.confetti();
|
|
45
|
+
celebrate.fireworks({ count: 6 });
|
|
46
|
+
celebrate.balloons({ particleCount: 20 });
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Custom Colors
|
|
52
|
+
|
|
53
|
+
You can customize colors for supported effects by passing a `colors` array.
|
|
54
|
+
|
|
55
|
+
Example:
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
celebrate.confetti({
|
|
59
|
+
colors: ["#ff1744", "#2979ff", "#00e676"],
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Supported effects:
|
|
64
|
+
|
|
65
|
+
- confetti
|
|
66
|
+
- balloons
|
|
67
|
+
- popper
|
|
68
|
+
- fireworks
|
|
69
|
+
- stars
|
|
70
|
+
|
|
71
|
+
Color behavior:
|
|
72
|
+
|
|
73
|
+
- Confetti → per particle
|
|
74
|
+
- Balloons → per balloon
|
|
75
|
+
- Fireworks → per burst
|
|
76
|
+
- Popper → per particle
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Available Effects
|
|
81
|
+
|
|
82
|
+
- confetti
|
|
83
|
+
- balloons
|
|
84
|
+
- popper
|
|
85
|
+
- fireworks
|
|
86
|
+
- bubbles
|
|
87
|
+
- emojis
|
|
88
|
+
- stars
|
|
89
|
+
- snowfall
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## API
|
|
94
|
+
|
|
95
|
+
### celebrate(options?)
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
celebrate({
|
|
99
|
+
effect: "confetti",
|
|
100
|
+
duration: 5000,
|
|
101
|
+
particleCount: 100,
|
|
102
|
+
colors: ["#ff0", "#0ff"],
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Effect Shortcuts
|
|
109
|
+
|
|
110
|
+
```js
|
|
111
|
+
celebrate.confetti(options);
|
|
112
|
+
celebrate.balloons(options);
|
|
113
|
+
celebrate.popper(options);
|
|
114
|
+
celebrate.fireworks(options);
|
|
115
|
+
celebrate.bubbles(options);
|
|
116
|
+
celebrate.emojis(options);
|
|
117
|
+
celebrate.stars(options);
|
|
118
|
+
celebrate.snowfall(options);
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Options
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
type CelebrateOptions = {
|
|
127
|
+
effect?: "confetti" | "balloons" | "popper" | "fireworks" | "bubbles" | "emojis" | "stars" | "snowfall";
|
|
128
|
+
duration?: number;
|
|
129
|
+
particleCount?: number;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Colors used by supported effects (confetti, balloons, fireworks, popper, stars)
|
|
133
|
+
*/
|
|
134
|
+
colors?: string[];
|
|
135
|
+
|
|
136
|
+
respectReducedMotion?: boolean;
|
|
137
|
+
|
|
138
|
+
// Fireworks only
|
|
139
|
+
count?: number;
|
|
140
|
+
interval?: number;
|
|
141
|
+
|
|
142
|
+
// Emoji rain only
|
|
143
|
+
emojis?: string[];
|
|
144
|
+
};
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Reduced Motion
|
|
150
|
+
|
|
151
|
+
If `respectReducedMotion` is enabled and the user has `prefers-reduced-motion` set,
|
|
152
|
+
animations will be skipped.
|
|
153
|
+
|
|
154
|
+
```js
|
|
155
|
+
celebrate({
|
|
156
|
+
respectReducedMotion: true
|
|
157
|
+
});
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Demo
|
|
163
|
+
|
|
164
|
+
A demo is available in the repository under the `demo/` directory.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
MIT © Akshay Yadav
|