svelte-confetti-explosion 0.0.7 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -281,6 +281,7 @@ function confettiStyles(node, { degree }) {
281
281
  height: 0;
282
282
  overflow: visible;
283
283
  position: relative;
284
+ transform: translate3d(var(--x, 0), var(--y, 0), 0);
284
285
  z-index: 1200;
285
286
  }
286
287
 
package/README.md CHANGED
@@ -14,7 +14,7 @@ Let's party 🎊🎊 with Svelte! svelte-confetti-explosion allows you to show a
14
14
 
15
15
  [Try it in Svelte REPL](https://svelte.dev/repl/4e41a080739a4427a1f2c98b7f5d4b24?version=3.44.2)
16
16
 
17
- # Installing
17
+ ## Installing
18
18
 
19
19
  ```bash
20
20
  # pnpm
@@ -27,7 +27,7 @@ npm install svelte-confetti-explosion
27
27
  yarn add svelte-confetti-explosion
28
28
  ```
29
29
 
30
- # Usage
30
+ ## Usage
31
31
 
32
32
  Basic usage:
33
33
 
@@ -45,11 +45,11 @@ Customizing behavior with options:
45
45
  <ConfettiExplosion particleCount={200} force={0.3} />
46
46
  ```
47
47
 
48
- # Options
48
+ ## Props
49
49
 
50
50
  There's tons of options available for this package. All of them are already documented within the code itself, so you'll never have to leave the code editor.
51
51
 
52
- ## particleCount
52
+ ### particleCount
53
53
 
54
54
  Number of confetti particles to create.
55
55
 
@@ -63,7 +63,7 @@ Number of confetti particles to create.
63
63
  <ConfettiExplosion particleCount={200} />
64
64
  ```
65
65
 
66
- ## particleSize
66
+ ### particleSize
67
67
 
68
68
  Size of the confetti particles in pixels
69
69
 
@@ -77,7 +77,7 @@ Size of the confetti particles in pixels
77
77
  <ConfettiExplosion particleSize={20} />
78
78
  ```
79
79
 
80
- ## duration
80
+ ### duration
81
81
 
82
82
  Duration of the animation in milliseconds
83
83
 
@@ -91,7 +91,7 @@ Duration of the animation in milliseconds
91
91
  <ConfettiExplosion duration={5000} />
92
92
  ```
93
93
 
94
- ## colors
94
+ ### colors
95
95
 
96
96
  Colors to use for the confetti particles. Pass string array of colors. Can use hex colors, named colors, CSS Variables, literally anything valid in plain CSS.
97
97
 
@@ -105,7 +105,7 @@ Colors to use for the confetti particles. Pass string array of colors. Can use h
105
105
  <ConfettiExplosion colors={['var(--yellow)', 'var(--red)', '#2E3191', '#41BBC7']} />
106
106
  ```
107
107
 
108
- ## force
108
+ ### force
109
109
 
110
110
  Force of the confetti particles. Between 0 and 1. 0 is no force, 1 is maximum force. Will error out if you pass a value outside of this range.
111
111
 
@@ -119,7 +119,7 @@ Force of the confetti particles. Between 0 and 1. 0 is no force, 1 is maximum fo
119
119
  <ConfettiExplosion force={0.3} />
120
120
  ```
121
121
 
122
- ## stageHeight
122
+ ### stageHeight
123
123
 
124
124
  Height of the stage in pixels. Confetti will only fall within this height.
125
125
 
@@ -133,7 +133,7 @@ Height of the stage in pixels. Confetti will only fall within this height.
133
133
  <ConfettiExplosion stageHeight={500} />
134
134
  ```
135
135
 
136
- ## stageWidth
136
+ ### stageWidth
137
137
 
138
138
  Width of the stage in pixels. Confetti will only fall within this width.
139
139
 
@@ -147,7 +147,7 @@ Width of the stage in pixels. Confetti will only fall within this width.
147
147
  <ConfettiExplosion stageWidth={500} />
148
148
  ```
149
149
 
150
- ## shouldDestroyAfterDone
150
+ ### shouldDestroyAfterDone
151
151
 
152
152
  Whether or not destroy all confetti nodes after the `duration` period has passed. By default it destroys all nodes, to free up memory.
153
153
 
@@ -161,12 +161,27 @@ Whether or not destroy all confetti nodes after the `duration` period has passed
161
161
  <ConfettiExplosion shouldDestroyAfterDone={false} />
162
162
  ```
163
163
 
164
- # Performance
164
+ ## Style Props
165
+
166
+ You can specify two style props on the component: `--x` and `--y`. These will shift the confetti particles on the x and y axis. by how much you specify, These can be in `px`, `em`, `rem`, `vh`, `vw`, literally any valid CSS unit.
167
+
168
+ **USAGE:**
169
+
170
+ ```svelte
171
+ <ConfettiExplosion --x="10px" --y="10px" />
172
+ ```
173
+
174
+ ## Performance
165
175
 
166
176
  This library functions by creating 2 DOM nodes for every single confetti. By default, if the `particlesCount` is set to 150, it will create 300 nodes. This is a lot of nodes. For most devices, these many nodes are not a big issue, but I recommend checking your target devices' performance if you choose to go with a higher number, like 400 or 500.
167
177
 
168
178
  Also, after the specified `duration`, all the confetti DOM nodes will be destroyed. This is to free up memory. If you wish to keep them around, set `shouldDestroyAfterDone` to `false`.
169
179
 
170
- # License
180
+ ## License
171
181
 
172
182
  MIT License
183
+ © [Puru Vijay](https://twitter.com/puruvjdev)
184
+
185
+ ```
186
+
187
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-confetti-explosion",
3
- "version": "0.0.7",
3
+ "version": "0.1.0",
4
4
  "description": "Confetti explosion in Svelte 🎉🎊",
5
5
  "author": "Puru Vijay",
6
6
  "license": "MIT",
@@ -25,22 +25,7 @@
25
25
  "tiny",
26
26
  "performant"
27
27
  ],
28
- "devDependencies": {
29
- "@sveltejs/kit": "^1.0.0-next.197",
30
- "prettier": "^2.4.1",
31
- "prettier-plugin-svelte": "^2.5.0",
32
- "sass": "^1.43.4",
33
- "svelte": "^3.44.2",
34
- "svelte-check": "^2.2.10",
35
- "svelte-preprocess": "^4.9.8",
36
- "svelte2tsx": "^0.4.10",
37
- "tslib": "^2.3.1",
38
- "typescript": "^4.5.2"
39
- },
40
28
  "type": "module",
41
- "dependencies": {
42
- "svelte-confetti-explosion": "0.0.5"
43
- },
44
29
  "exports": {
45
30
  "./package.json": "./package.json",
46
31
  "./ConfettiExplosion.svelte": "./ConfettiExplosion.svelte",