react-confetti-burst 1.0.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 +303 -0
- package/dist/cjs/components.d.ts +219 -0
- package/dist/cjs/components.d.ts.map +1 -0
- package/dist/cjs/components.js +341 -0
- package/dist/cjs/components.js.map +1 -0
- package/dist/cjs/confetti-engine.d.ts +122 -0
- package/dist/cjs/confetti-engine.d.ts.map +1 -0
- package/dist/cjs/confetti-engine.js +589 -0
- package/dist/cjs/confetti-engine.js.map +1 -0
- package/dist/cjs/confetti.d.ts +50 -0
- package/dist/cjs/confetti.d.ts.map +1 -0
- package/dist/cjs/confetti.js +446 -0
- package/dist/cjs/confetti.js.map +1 -0
- package/dist/cjs/constants.d.ts +147 -0
- package/dist/cjs/constants.d.ts.map +1 -0
- package/dist/cjs/constants.js +609 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/hooks.d.ts +94 -0
- package/dist/cjs/hooks.d.ts.map +1 -0
- package/dist/cjs/hooks.js +225 -0
- package/dist/cjs/hooks.js.map +1 -0
- package/dist/cjs/index.d.ts +34 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +180 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/particle.d.ts +50 -0
- package/dist/cjs/particle.d.ts.map +1 -0
- package/dist/cjs/particle.js +475 -0
- package/dist/cjs/particle.js.map +1 -0
- package/dist/cjs/shapes.d.ts +190 -0
- package/dist/cjs/shapes.d.ts.map +1 -0
- package/dist/cjs/shapes.js +272 -0
- package/dist/cjs/shapes.js.map +1 -0
- package/dist/cjs/types.d.ts +720 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +25 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/utils.d.ts +90 -0
- package/dist/cjs/utils.d.ts.map +1 -0
- package/dist/cjs/utils.js +330 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/esm/components.js +334 -0
- package/dist/esm/components.js.map +1 -0
- package/dist/esm/confetti-engine.js +581 -0
- package/dist/esm/confetti-engine.js.map +1 -0
- package/dist/esm/confetti.js +443 -0
- package/dist/esm/confetti.js.map +1 -0
- package/dist/esm/constants.js +605 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/hooks.js +218 -0
- package/dist/esm/hooks.js.map +1 -0
- package/dist/esm/index.js +146 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/particle.js +465 -0
- package/dist/esm/particle.js.map +1 -0
- package/dist/esm/shapes.js +265 -0
- package/dist/esm/shapes.js.map +1 -0
- package/dist/esm/types.js +24 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils.js +309 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/types/components.d.ts +219 -0
- package/dist/types/components.d.ts.map +1 -0
- package/dist/types/confetti-engine.d.ts +122 -0
- package/dist/types/confetti-engine.d.ts.map +1 -0
- package/dist/types/confetti.d.ts +50 -0
- package/dist/types/confetti.d.ts.map +1 -0
- package/dist/types/constants.d.ts +147 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/hooks.d.ts +94 -0
- package/dist/types/hooks.d.ts.map +1 -0
- package/dist/types/index.d.ts +34 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/particle.d.ts +50 -0
- package/dist/types/particle.d.ts.map +1 -0
- package/dist/types/shapes.d.ts +190 -0
- package/dist/types/shapes.d.ts.map +1 -0
- package/dist/types/types.d.ts +720 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/utils.d.ts +90 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React hooks for confetti animations
|
|
3
|
+
*
|
|
4
|
+
* Provides convenient React hooks for triggering confetti bursts
|
|
5
|
+
* with proper lifecycle management and cleanup.
|
|
6
|
+
*/
|
|
7
|
+
import type { ConfettiBurstOptions, BurstOrigin, ExplosionHandle, UseConfettiReturn } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* Main hook for triggering confetti animations
|
|
10
|
+
*
|
|
11
|
+
* @returns Object with fire functions and state
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* const { fire, isActive } = useConfetti();
|
|
16
|
+
*
|
|
17
|
+
* const handleClick = (e) => {
|
|
18
|
+
* fire({ x: e.clientX, y: e.clientY });
|
|
19
|
+
* };
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function useConfetti(): UseConfettiReturn;
|
|
23
|
+
/**
|
|
24
|
+
* Hook for confetti triggered by a ref element
|
|
25
|
+
*
|
|
26
|
+
* @param options - Confetti configuration options
|
|
27
|
+
* @returns Ref to attach to trigger element and fire function
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* const { ref, fire } = useConfettiTrigger();
|
|
32
|
+
*
|
|
33
|
+
* return (
|
|
34
|
+
* <button ref={ref} onClick={fire}>
|
|
35
|
+
* Celebrate!
|
|
36
|
+
* </button>
|
|
37
|
+
* );
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function useConfettiTrigger<T extends HTMLElement = HTMLElement>(options?: ConfettiBurstOptions): {
|
|
41
|
+
ref: React.RefObject<T>;
|
|
42
|
+
fire: () => ExplosionHandle | null;
|
|
43
|
+
isActive: boolean;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Hook for auto-firing confetti when a condition becomes true
|
|
47
|
+
*
|
|
48
|
+
* @param condition - When true, fires confetti
|
|
49
|
+
* @param origin - Origin point for the burst
|
|
50
|
+
* @param options - Confetti configuration options
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* const [isComplete, setIsComplete] = useState(false);
|
|
55
|
+
*
|
|
56
|
+
* useConfettiOnCondition(isComplete, { x: 500, y: 300 });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function useConfettiOnCondition(condition: boolean, origin: BurstOrigin, options?: ConfettiBurstOptions): void;
|
|
60
|
+
/**
|
|
61
|
+
* Hook for sequencing multiple confetti bursts
|
|
62
|
+
*
|
|
63
|
+
* @param bursts - Array of burst configurations with delays
|
|
64
|
+
* @returns Start function and active state
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```tsx
|
|
68
|
+
* const { start, isActive } = useConfettiSequence([
|
|
69
|
+
* { origin: { x: 100, y: 100 }, delay: 0 },
|
|
70
|
+
* { origin: { x: 300, y: 100 }, delay: 200 },
|
|
71
|
+
* { origin: { x: 500, y: 100 }, delay: 400 },
|
|
72
|
+
* ]);
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function useConfettiSequence(bursts: Array<{
|
|
76
|
+
origin: BurstOrigin;
|
|
77
|
+
options?: ConfettiBurstOptions;
|
|
78
|
+
delay: number;
|
|
79
|
+
}>): {
|
|
80
|
+
start: () => void;
|
|
81
|
+
isActive: boolean;
|
|
82
|
+
cancel: () => void;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Hook for viewport-centered confetti
|
|
86
|
+
*
|
|
87
|
+
* @param options - Confetti configuration options
|
|
88
|
+
* @returns Fire function for center-screen confetti
|
|
89
|
+
*/
|
|
90
|
+
export declare function useConfettiCenter(options?: ConfettiBurstOptions): {
|
|
91
|
+
fire: () => ExplosionHandle;
|
|
92
|
+
isActive: boolean;
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAOjB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,IAAI,iBAAiB,CAmG/C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EACpE,OAAO,CAAC,EAAE,oBAAoB,GAC7B;IACD,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC;IACnC,QAAQ,EAAE,OAAO,CAAC;CACnB,CASA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,WAAW,EACnB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,IAAI,CAiBN;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,GACD;IACD,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CA6BA;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG;IACjE,IAAI,EAAE,MAAM,eAAe,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAeA"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* React hooks for confetti animations
|
|
4
|
+
*
|
|
5
|
+
* Provides convenient React hooks for triggering confetti bursts
|
|
6
|
+
* with proper lifecycle management and cleanup.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.useConfetti = useConfetti;
|
|
10
|
+
exports.useConfettiTrigger = useConfettiTrigger;
|
|
11
|
+
exports.useConfettiOnCondition = useConfettiOnCondition;
|
|
12
|
+
exports.useConfettiSequence = useConfettiSequence;
|
|
13
|
+
exports.useConfettiCenter = useConfettiCenter;
|
|
14
|
+
const react_1 = require("react");
|
|
15
|
+
const confetti_engine_1 = require("./confetti-engine");
|
|
16
|
+
/**
|
|
17
|
+
* Main hook for triggering confetti animations
|
|
18
|
+
*
|
|
19
|
+
* @returns Object with fire functions and state
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* const { fire, isActive } = useConfetti();
|
|
24
|
+
*
|
|
25
|
+
* const handleClick = (e) => {
|
|
26
|
+
* fire({ x: e.clientX, y: e.clientY });
|
|
27
|
+
* };
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
function useConfetti() {
|
|
31
|
+
const [isActive, setIsActive] = (0, react_1.useState)(false);
|
|
32
|
+
const activeHandles = (0, react_1.useRef)(new Set());
|
|
33
|
+
// Cleanup on unmount
|
|
34
|
+
(0, react_1.useEffect)(() => {
|
|
35
|
+
return () => {
|
|
36
|
+
activeHandles.current.forEach(handle => handle.stop());
|
|
37
|
+
activeHandles.current.clear();
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
/**
|
|
41
|
+
* Fires confetti from a point
|
|
42
|
+
*/
|
|
43
|
+
const fire = (0, react_1.useCallback)((origin, options) => {
|
|
44
|
+
const handle = (0, confetti_engine_1.createConfettiExplosion)(origin, options);
|
|
45
|
+
activeHandles.current.add(handle);
|
|
46
|
+
setIsActive(true);
|
|
47
|
+
handle.promise.then(() => {
|
|
48
|
+
activeHandles.current.delete(handle);
|
|
49
|
+
if (activeHandles.current.size === 0) {
|
|
50
|
+
setIsActive(false);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return handle;
|
|
54
|
+
}, []);
|
|
55
|
+
/**
|
|
56
|
+
* Fires confetti from an element's center
|
|
57
|
+
*/
|
|
58
|
+
const fireFromElementCallback = (0, react_1.useCallback)((element, options) => {
|
|
59
|
+
if (!element)
|
|
60
|
+
return null;
|
|
61
|
+
const handle = (0, confetti_engine_1.fireFromElement)(element, options);
|
|
62
|
+
if (handle) {
|
|
63
|
+
activeHandles.current.add(handle);
|
|
64
|
+
setIsActive(true);
|
|
65
|
+
handle.promise.then(() => {
|
|
66
|
+
activeHandles.current.delete(handle);
|
|
67
|
+
if (activeHandles.current.size === 0) {
|
|
68
|
+
setIsActive(false);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return handle;
|
|
73
|
+
}, []);
|
|
74
|
+
/**
|
|
75
|
+
* Stops all active animations
|
|
76
|
+
*/
|
|
77
|
+
const stopAll = (0, react_1.useCallback)(() => {
|
|
78
|
+
activeHandles.current.forEach(handle => handle.stop());
|
|
79
|
+
activeHandles.current.clear();
|
|
80
|
+
setIsActive(false);
|
|
81
|
+
}, []);
|
|
82
|
+
/**
|
|
83
|
+
* Pauses all active animations
|
|
84
|
+
*/
|
|
85
|
+
const pauseAll = (0, react_1.useCallback)(() => {
|
|
86
|
+
activeHandles.current.forEach(handle => handle.pause());
|
|
87
|
+
}, []);
|
|
88
|
+
/**
|
|
89
|
+
* Resumes all paused animations
|
|
90
|
+
*/
|
|
91
|
+
const resumeAll = (0, react_1.useCallback)(() => {
|
|
92
|
+
activeHandles.current.forEach(handle => handle.resume());
|
|
93
|
+
}, []);
|
|
94
|
+
/**
|
|
95
|
+
* Gets the currently active handles
|
|
96
|
+
*/
|
|
97
|
+
const getActiveHandles = (0, react_1.useCallback)(() => {
|
|
98
|
+
return Array.from(activeHandles.current);
|
|
99
|
+
}, []);
|
|
100
|
+
return {
|
|
101
|
+
fire,
|
|
102
|
+
fireFromElement: fireFromElementCallback,
|
|
103
|
+
isActive,
|
|
104
|
+
stopAll,
|
|
105
|
+
pauseAll,
|
|
106
|
+
resumeAll,
|
|
107
|
+
getActiveHandles,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Hook for confetti triggered by a ref element
|
|
112
|
+
*
|
|
113
|
+
* @param options - Confetti configuration options
|
|
114
|
+
* @returns Ref to attach to trigger element and fire function
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```tsx
|
|
118
|
+
* const { ref, fire } = useConfettiTrigger();
|
|
119
|
+
*
|
|
120
|
+
* return (
|
|
121
|
+
* <button ref={ref} onClick={fire}>
|
|
122
|
+
* Celebrate!
|
|
123
|
+
* </button>
|
|
124
|
+
* );
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
function useConfettiTrigger(options) {
|
|
128
|
+
const ref = (0, react_1.useRef)(null);
|
|
129
|
+
const { fireFromElement: fireFromEl, isActive } = useConfetti();
|
|
130
|
+
const fire = (0, react_1.useCallback)(() => {
|
|
131
|
+
return fireFromEl(ref.current, options);
|
|
132
|
+
}, [fireFromEl, options]);
|
|
133
|
+
return { ref, fire, isActive };
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Hook for auto-firing confetti when a condition becomes true
|
|
137
|
+
*
|
|
138
|
+
* @param condition - When true, fires confetti
|
|
139
|
+
* @param origin - Origin point for the burst
|
|
140
|
+
* @param options - Confetti configuration options
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```tsx
|
|
144
|
+
* const [isComplete, setIsComplete] = useState(false);
|
|
145
|
+
*
|
|
146
|
+
* useConfettiOnCondition(isComplete, { x: 500, y: 300 });
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
function useConfettiOnCondition(condition, origin, options) {
|
|
150
|
+
const hasFired = (0, react_1.useRef)(false);
|
|
151
|
+
const { fire } = useConfetti();
|
|
152
|
+
(0, react_1.useEffect)(() => {
|
|
153
|
+
if (condition && !hasFired.current) {
|
|
154
|
+
hasFired.current = true;
|
|
155
|
+
fire(origin, options);
|
|
156
|
+
}
|
|
157
|
+
}, [condition, fire, origin, options]);
|
|
158
|
+
// Reset when condition becomes false
|
|
159
|
+
(0, react_1.useEffect)(() => {
|
|
160
|
+
if (!condition) {
|
|
161
|
+
hasFired.current = false;
|
|
162
|
+
}
|
|
163
|
+
}, [condition]);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Hook for sequencing multiple confetti bursts
|
|
167
|
+
*
|
|
168
|
+
* @param bursts - Array of burst configurations with delays
|
|
169
|
+
* @returns Start function and active state
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```tsx
|
|
173
|
+
* const { start, isActive } = useConfettiSequence([
|
|
174
|
+
* { origin: { x: 100, y: 100 }, delay: 0 },
|
|
175
|
+
* { origin: { x: 300, y: 100 }, delay: 200 },
|
|
176
|
+
* { origin: { x: 500, y: 100 }, delay: 400 },
|
|
177
|
+
* ]);
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
function useConfettiSequence(bursts) {
|
|
181
|
+
const { fire, isActive, stopAll } = useConfetti();
|
|
182
|
+
const timeouts = (0, react_1.useRef)([]);
|
|
183
|
+
const cancel = (0, react_1.useCallback)(() => {
|
|
184
|
+
timeouts.current.forEach(id => clearTimeout(id));
|
|
185
|
+
timeouts.current = [];
|
|
186
|
+
stopAll();
|
|
187
|
+
}, [stopAll]);
|
|
188
|
+
const start = (0, react_1.useCallback)(() => {
|
|
189
|
+
cancel(); // Clear any existing sequence
|
|
190
|
+
bursts.forEach(({ origin, options, delay }) => {
|
|
191
|
+
const timeoutId = window.setTimeout(() => {
|
|
192
|
+
fire(origin, options);
|
|
193
|
+
}, delay);
|
|
194
|
+
timeouts.current.push(timeoutId);
|
|
195
|
+
});
|
|
196
|
+
}, [bursts, fire, cancel]);
|
|
197
|
+
// Cleanup on unmount
|
|
198
|
+
(0, react_1.useEffect)(() => {
|
|
199
|
+
return () => {
|
|
200
|
+
timeouts.current.forEach(id => clearTimeout(id));
|
|
201
|
+
};
|
|
202
|
+
}, []);
|
|
203
|
+
return { start, isActive, cancel };
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Hook for viewport-centered confetti
|
|
207
|
+
*
|
|
208
|
+
* @param options - Confetti configuration options
|
|
209
|
+
* @returns Fire function for center-screen confetti
|
|
210
|
+
*/
|
|
211
|
+
function useConfettiCenter(options) {
|
|
212
|
+
const { fire: baseFire, isActive } = useConfetti();
|
|
213
|
+
const fire = (0, react_1.useCallback)(() => {
|
|
214
|
+
const centerOrigin = {
|
|
215
|
+
x: window.innerWidth / 2,
|
|
216
|
+
y: window.innerHeight / 2,
|
|
217
|
+
};
|
|
218
|
+
return baseFire(centerOrigin, {
|
|
219
|
+
...options,
|
|
220
|
+
direction: { direction: 'radial' },
|
|
221
|
+
});
|
|
222
|
+
}, [baseFire, options]);
|
|
223
|
+
return { fire, isActive };
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/hooks.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AA8BH,kCAmGC;AAmBD,gDAeC;AAgBD,wDAqBC;AAiBD,kDAuCC;AAQD,8CAkBC;AAxRD,iCAAiE;AASjE,uDAG2B;AAE3B;;;;;;;;;;;;;GAaG;AACH,SAAgB,WAAW;IACzB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAChD,MAAM,aAAa,GAAG,IAAA,cAAM,EAAuB,IAAI,GAAG,EAAE,CAAC,CAAC;IAE9D,qBAAqB;IACrB,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,OAAO,GAAG,EAAE;YACV,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YACvD,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QAChC,CAAC,CAAC;IACJ,CA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gB;YAChC,CAAC,EAAE,MAAM,CAAC,UAAU,GAAG,CAAC;YACxB,CAAC,EAAE,MAAM,CAAC,WAAW,GAAG,CAAC;SAC1B,CAAC;QACF,OAAO,QAAQ,CAAC,YAAY,EAAE;YAC5B,GAAG,OAAO;YACV,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE;SACnC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IAExB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-confetti-burst
|
|
3
|
+
*
|
|
4
|
+
* A high-performance, zero-dependency React confetti component
|
|
5
|
+
* with directional bursts using the native Canvas API.
|
|
6
|
+
* Exceeds the feature set of both react-confetti and canvas-confetti.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* ============================================================================
|
|
12
|
+
* FEATURE RELEASE FLAGS
|
|
13
|
+
* ============================================================================
|
|
14
|
+
*
|
|
15
|
+
* Uncomment features as they are released:
|
|
16
|
+
*
|
|
17
|
+
* v1.0.0 - Basic Usage (ConfettiButton, useConfetti, basic confetti())
|
|
18
|
+
* v1.1.0 - React Hooks (useConfettiTrigger, useConfettiSequence, useConfettiCenter)
|
|
19
|
+
* v1.2.0 - Built-in Presets (16 presets)
|
|
20
|
+
* v1.3.0 - canvas-confetti API (confetti.create, confetti.reset)
|
|
21
|
+
* v1.4.0 - Custom Shapes (shapeFromPath, shapeFromText, shapesFromEmoji)
|
|
22
|
+
* v1.5.0 - Advanced Effects (trails, glow, fireworks, continuous mode)
|
|
23
|
+
* v1.6.0 - Full Feature Set
|
|
24
|
+
*
|
|
25
|
+
* ============================================================================
|
|
26
|
+
*/
|
|
27
|
+
export type { Point, Vector2D, RGBAColor, GradientColor, ColorInput, ParticleShape, BurstDirection, EasingFunction, EasingPreset, PhysicsConfig, DirectionConfig, ParticleConfig, ConfettiBurstConfig, ConfettiBurstOptions, BurstOrigin, ParticleState, AnimationState, CanvasContext, ExplosionHandle, UseConfettiReturn, ConfettiBurstProps, ConfettiButtonProps, } from './types';
|
|
28
|
+
export { DEFAULT_COLORS, DEFAULT_PHYSICS, DEFAULT_DIRECTION, DEFAULT_PARTICLE, DEFAULT_CONFIG, DIRECTION_ANGLES, EASING_FUNCTIONS, COLOR_PALETTES, } from './constants';
|
|
29
|
+
export { ConfettiEngine, createConfettiExplosion, fireFromElement, getActiveAnimationCount, forceCleanup, } from './confetti-engine';
|
|
30
|
+
export { useConfetti, } from './hooks';
|
|
31
|
+
export { ConfettiBurst, ConfettiButton, } from './components';
|
|
32
|
+
export { parseColor, rgbaToString, randomInRange, randomInt, randomFromArray, clamp, lerp, degToRad, radToDeg, getDirectionAngle, getElementCenter, mergeConfig, isBrowser, } from './utils';
|
|
33
|
+
export { confetti, confetti as default } from './confetti';
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;GAgBG;AAOH,YAAY,EAEV,KAAK,EACL,QAAQ,EACR,SAAS,EACT,aAAa,EACb,UAAU,EACV,aAAa,EACb,cAAc,EACd,cAAc,EACd,YAAY,EAGZ,aAAa,EACb,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EAGX,aAAa,EACb,cAAc,EACd,aAAa,EAGb,eAAe,EACf,iBAAiB,EAGjB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,GACf,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,eAAe,EACf,uBAAuB,EACvB,YAAY,GACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,WAAW,GACZ,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,aAAa,EACb,cAAc,GACf,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,UAAU,EACV,YAAY,EACZ,aAAa,EACb,SAAS,EACT,eAAe,EACf,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,SAAS,GACV,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,QAAQ,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* react-confetti-burst
|
|
4
|
+
*
|
|
5
|
+
* A high-performance, zero-dependency React confetti component
|
|
6
|
+
* with directional bursts using the native Canvas API.
|
|
7
|
+
* Exceeds the feature set of both react-confetti and canvas-confetti.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.default = exports.confetti = exports.isBrowser = exports.mergeConfig = exports.getElementCenter = exports.getDirectionAngle = exports.radToDeg = exports.degToRad = exports.lerp = exports.clamp = exports.randomFromArray = exports.randomInt = exports.randomInRange = exports.rgbaToString = exports.parseColor = exports.ConfettiButton = exports.ConfettiBurst = exports.useConfetti = exports.forceCleanup = exports.getActiveAnimationCount = exports.fireFromElement = exports.createConfettiExplosion = exports.ConfettiEngine = exports.COLOR_PALETTES = exports.EASING_FUNCTIONS = exports.DIRECTION_ANGLES = exports.DEFAULT_CONFIG = exports.DEFAULT_PARTICLE = exports.DEFAULT_DIRECTION = exports.DEFAULT_PHYSICS = exports.DEFAULT_COLORS = void 0;
|
|
13
|
+
// Basic Constants
|
|
14
|
+
var constants_1 = require("./constants");
|
|
15
|
+
Object.defineProperty(exports, "DEFAULT_COLORS", { enumerable: true, get: function () { return constants_1.DEFAULT_COLORS; } });
|
|
16
|
+
Object.defineProperty(exports, "DEFAULT_PHYSICS", { enumerable: true, get: function () { return constants_1.DEFAULT_PHYSICS; } });
|
|
17
|
+
Object.defineProperty(exports, "DEFAULT_DIRECTION", { enumerable: true, get: function () { return constants_1.DEFAULT_DIRECTION; } });
|
|
18
|
+
Object.defineProperty(exports, "DEFAULT_PARTICLE", { enumerable: true, get: function () { return constants_1.DEFAULT_PARTICLE; } });
|
|
19
|
+
Object.defineProperty(exports, "DEFAULT_CONFIG", { enumerable: true, get: function () { return constants_1.DEFAULT_CONFIG; } });
|
|
20
|
+
Object.defineProperty(exports, "DIRECTION_ANGLES", { enumerable: true, get: function () { return constants_1.DIRECTION_ANGLES; } });
|
|
21
|
+
Object.defineProperty(exports, "EASING_FUNCTIONS", { enumerable: true, get: function () { return constants_1.EASING_FUNCTIONS; } });
|
|
22
|
+
Object.defineProperty(exports, "COLOR_PALETTES", { enumerable: true, get: function () { return constants_1.COLOR_PALETTES; } });
|
|
23
|
+
// Core engine (Basic)
|
|
24
|
+
var confetti_engine_1 = require("./confetti-engine");
|
|
25
|
+
Object.defineProperty(exports, "ConfettiEngine", { enumerable: true, get: function () { return confetti_engine_1.ConfettiEngine; } });
|
|
26
|
+
Object.defineProperty(exports, "createConfettiExplosion", { enumerable: true, get: function () { return confetti_engine_1.createConfettiExplosion; } });
|
|
27
|
+
Object.defineProperty(exports, "fireFromElement", { enumerable: true, get: function () { return confetti_engine_1.fireFromElement; } });
|
|
28
|
+
Object.defineProperty(exports, "getActiveAnimationCount", { enumerable: true, get: function () { return confetti_engine_1.getActiveAnimationCount; } });
|
|
29
|
+
Object.defineProperty(exports, "forceCleanup", { enumerable: true, get: function () { return confetti_engine_1.forceCleanup; } });
|
|
30
|
+
// Basic React hooks
|
|
31
|
+
var hooks_1 = require("./hooks");
|
|
32
|
+
Object.defineProperty(exports, "useConfetti", { enumerable: true, get: function () { return hooks_1.useConfetti; } });
|
|
33
|
+
// Basic React components
|
|
34
|
+
var components_1 = require("./components");
|
|
35
|
+
Object.defineProperty(exports, "ConfettiBurst", { enumerable: true, get: function () { return components_1.ConfettiBurst; } });
|
|
36
|
+
Object.defineProperty(exports, "ConfettiButton", { enumerable: true, get: function () { return components_1.ConfettiButton; } });
|
|
37
|
+
// Basic Utility functions
|
|
38
|
+
var utils_1 = require("./utils");
|
|
39
|
+
Object.defineProperty(exports, "parseColor", { enumerable: true, get: function () { return utils_1.parseColor; } });
|
|
40
|
+
Object.defineProperty(exports, "rgbaToString", { enumerable: true, get: function () { return utils_1.rgbaToString; } });
|
|
41
|
+
Object.defineProperty(exports, "randomInRange", { enumerable: true, get: function () { return utils_1.randomInRange; } });
|
|
42
|
+
Object.defineProperty(exports, "randomInt", { enumerable: true, get: function () { return utils_1.randomInt; } });
|
|
43
|
+
Object.defineProperty(exports, "randomFromArray", { enumerable: true, get: function () { return utils_1.randomFromArray; } });
|
|
44
|
+
Object.defineProperty(exports, "clamp", { enumerable: true, get: function () { return utils_1.clamp; } });
|
|
45
|
+
Object.defineProperty(exports, "lerp", { enumerable: true, get: function () { return utils_1.lerp; } });
|
|
46
|
+
Object.defineProperty(exports, "degToRad", { enumerable: true, get: function () { return utils_1.degToRad; } });
|
|
47
|
+
Object.defineProperty(exports, "radToDeg", { enumerable: true, get: function () { return utils_1.radToDeg; } });
|
|
48
|
+
Object.defineProperty(exports, "getDirectionAngle", { enumerable: true, get: function () { return utils_1.getDirectionAngle; } });
|
|
49
|
+
Object.defineProperty(exports, "getElementCenter", { enumerable: true, get: function () { return utils_1.getElementCenter; } });
|
|
50
|
+
Object.defineProperty(exports, "mergeConfig", { enumerable: true, get: function () { return utils_1.mergeConfig; } });
|
|
51
|
+
Object.defineProperty(exports, "isBrowser", { enumerable: true, get: function () { return utils_1.isBrowser; } });
|
|
52
|
+
// Basic Functional API
|
|
53
|
+
var confetti_1 = require("./confetti");
|
|
54
|
+
Object.defineProperty(exports, "confetti", { enumerable: true, get: function () { return confetti_1.confetti; } });
|
|
55
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return confetti_1.confetti; } });
|
|
56
|
+
// ============================================================================
|
|
57
|
+
// v1.1.0 - REACT HOOKS (Uncomment when releasing)
|
|
58
|
+
// ============================================================================
|
|
59
|
+
/*
|
|
60
|
+
export {
|
|
61
|
+
useConfettiTrigger,
|
|
62
|
+
useConfettiOnCondition,
|
|
63
|
+
useConfettiSequence,
|
|
64
|
+
useConfettiCenter,
|
|
65
|
+
} from './hooks';
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
ConfettiTrigger,
|
|
69
|
+
} from './components';
|
|
70
|
+
|
|
71
|
+
export type { ConfettiTriggerHandle } from './components';
|
|
72
|
+
*/
|
|
73
|
+
// ============================================================================
|
|
74
|
+
// v1.2.0 - BUILT-IN PRESETS (Uncomment when releasing)
|
|
75
|
+
// ============================================================================
|
|
76
|
+
/*
|
|
77
|
+
export type {
|
|
78
|
+
PresetName,
|
|
79
|
+
PresetConfig,
|
|
80
|
+
} from './types';
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
PRESETS,
|
|
84
|
+
getPreset,
|
|
85
|
+
} from './constants';
|
|
86
|
+
*/
|
|
87
|
+
// ============================================================================
|
|
88
|
+
// v1.3.0 - CANVAS-CONFETTI API (Uncomment when releasing)
|
|
89
|
+
// ============================================================================
|
|
90
|
+
/*
|
|
91
|
+
export type {
|
|
92
|
+
NormalizedOrigin,
|
|
93
|
+
AccessibilityConfig,
|
|
94
|
+
CanvasConfettiOptions,
|
|
95
|
+
ConfettiCreateOptions,
|
|
96
|
+
CanvasConfig,
|
|
97
|
+
ConfettiProps,
|
|
98
|
+
} from './types';
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
DEFAULT_CANVAS,
|
|
102
|
+
DEFAULT_ACCESSIBILITY,
|
|
103
|
+
} from './constants';
|
|
104
|
+
|
|
105
|
+
export {
|
|
106
|
+
ConfettiOnMount,
|
|
107
|
+
ConfettiCannon,
|
|
108
|
+
Confetti,
|
|
109
|
+
} from './components';
|
|
110
|
+
|
|
111
|
+
export type { ConfettiComponentProps } from './components';
|
|
112
|
+
*/
|
|
113
|
+
// ============================================================================
|
|
114
|
+
// v1.4.0 - CUSTOM SHAPES (Uncomment when releasing)
|
|
115
|
+
// ============================================================================
|
|
116
|
+
/*
|
|
117
|
+
export type {
|
|
118
|
+
DrawContext,
|
|
119
|
+
CustomDrawFunction,
|
|
120
|
+
PathShape,
|
|
121
|
+
TextShape,
|
|
122
|
+
CustomShape,
|
|
123
|
+
ShapeInput,
|
|
124
|
+
PathBounds,
|
|
125
|
+
} from './types';
|
|
126
|
+
|
|
127
|
+
export {
|
|
128
|
+
EMOJI_SETS,
|
|
129
|
+
} from './constants';
|
|
130
|
+
|
|
131
|
+
export {
|
|
132
|
+
shapeFromPath,
|
|
133
|
+
shapeFromText,
|
|
134
|
+
shapeFromImage,
|
|
135
|
+
shapesFromEmoji,
|
|
136
|
+
pathShapes,
|
|
137
|
+
emojiShapes,
|
|
138
|
+
} from './shapes';
|
|
139
|
+
|
|
140
|
+
export type {
|
|
141
|
+
ShapeFromPathOptions,
|
|
142
|
+
ShapeFromTextOptions,
|
|
143
|
+
} from './shapes';
|
|
144
|
+
*/
|
|
145
|
+
// ============================================================================
|
|
146
|
+
// v1.5.0 - ADVANCED EFFECTS (Uncomment when releasing)
|
|
147
|
+
// ============================================================================
|
|
148
|
+
/*
|
|
149
|
+
export type {
|
|
150
|
+
EffectMode,
|
|
151
|
+
SpawnArea,
|
|
152
|
+
TrailConfig,
|
|
153
|
+
GlowConfig,
|
|
154
|
+
ImageParticle,
|
|
155
|
+
ContinuousConfig,
|
|
156
|
+
FireworkConfig,
|
|
157
|
+
} from './types';
|
|
158
|
+
|
|
159
|
+
export {
|
|
160
|
+
DEFAULT_TRAIL,
|
|
161
|
+
DEFAULT_GLOW,
|
|
162
|
+
DEFAULT_CONTINUOUS,
|
|
163
|
+
DEFAULT_FIREWORK,
|
|
164
|
+
} from './constants';
|
|
165
|
+
*/
|
|
166
|
+
// ============================================================================
|
|
167
|
+
// v1.6.0 - PARTICLE UTILITIES (Uncomment when releasing)
|
|
168
|
+
// ============================================================================
|
|
169
|
+
/*
|
|
170
|
+
export {
|
|
171
|
+
createParticle,
|
|
172
|
+
updateParticle,
|
|
173
|
+
renderParticle,
|
|
174
|
+
areAllParticlesInactive,
|
|
175
|
+
countActiveParticles,
|
|
176
|
+
loadImage,
|
|
177
|
+
clearImageCache,
|
|
178
|
+
} from './particle';
|
|
179
|
+
*/
|
|
180
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AA2DH,kBAAkB;AAClB,yCASqB;AARnB,2GAAA,cAAc,OAAA;AACd,4GAAA,eAAe,OAAA;AACf,8GAAA,iBAAiB,OAAA;AACjB,6GAAA,gBAAgB,OAAA;AAChB,2GAAA,cAAc,OAAA;AACd,6GAAA,gBAAgB,OAAA;AAChB,6GAAA,gBAAgB,OAAA;AAChB,2GAAA,cAAc,OAAA;AAGhB,sBAAsB;AACtB,qDAM2B;AALzB,iHAAA,cAAc,OAAA;AACd,0HAAA,uBAAuB,OAAA;AACvB,kHAAA,eAAe,OAAA;AACf,0HAAA,uBAAuB,OAAA;AACvB,+GAAA,YAAY,OAAA;AAGd,oBAAoB;AACpB,iCAEiB;AADf,oGAAA,WAAW,OAAA;AAGb,yBAAyB;AACzB,2CAGsB;AAFpB,2GAAA,aAAa,OAAA;AACb,4GAAA,cAAc,OAAA;AAGhB,0BAA0B;AAC1B,iCAciB;AAbf,mGAAA,UAAU,OAAA;AACV,qGAAA,YAAY,OAAA;AACZ,sGAAA,aAAa,OAAA;AACb,kGAAA,SAAS,OAAA;AACT,wGAAA,eAAe,OAAA;AACf,8FAAA,KAAK,OAAA;AACL,6FAAA,IAAI,OAAA;AACJ,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,0GAAA,iBAAiB,OAAA;AACjB,yGAAA,gBAAgB,OAAA;AAChB,oGAAA,WAAW,OAAA;AACX,kGAAA,SAAS,OAAA;AAGX,uBAAuB;AACvB,uCAA2D;AAAlD,oGAAA,QAAQ,OAAA;AAAE,mGAAA,QAAQ,OAAW;AAEtC,+EAA+E;AAC/E,kDAAkD;AAClD,+EAA+E;AAE/E;;;;;;;;;;;;;EAaE;AAEF,+EAA+E;AAC/E,uDAAuD;AACvD,+EAA+E;AAE/E;;;;;;;;;;EAUE;AAEF,+EAA+E;AAC/E,0DAA0D;AAC1D,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;EAsBE;AAEF,+EAA+E;AAC/E,oDAAoD;AACpD,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BE;AAEF,+EAA+E;AAC/E,uDAAuD;AACvD,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;EAiBE;AAEF,+EAA+E;AAC/E,yDAAyD;AACzD,+EAA+E;AAE/E;;;;;;;;;;EAUE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Particle class for confetti animation
|
|
3
|
+
*
|
|
4
|
+
* Represents a single confetti particle with all physics properties
|
|
5
|
+
* and methods for updating and rendering.
|
|
6
|
+
*/
|
|
7
|
+
import type { ParticleState, ParticleShape, PhysicsConfig, ImageParticle, TrailConfig, GlowConfig, ColorInput, CustomDrawFunction } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* Loads an image and caches it
|
|
10
|
+
*/
|
|
11
|
+
export declare function loadImage(src: string): Promise<HTMLImageElement>;
|
|
12
|
+
/**
|
|
13
|
+
* Clears the image cache
|
|
14
|
+
*/
|
|
15
|
+
export declare function clearImageCache(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new particle state object
|
|
18
|
+
*/
|
|
19
|
+
export declare function createParticle(x: number, y: number, angle: number, velocity: number, colors: readonly ColorInput[], shapes: readonly ParticleShape[], sizeRange: readonly [number, number], opacityRange: readonly [number, number], lifespan: number, rotationSpeed: number, options?: {
|
|
20
|
+
images?: readonly ImageParticle[];
|
|
21
|
+
tiltRange?: readonly [number, number];
|
|
22
|
+
spinSpeedRange?: readonly [number, number];
|
|
23
|
+
depth3D?: number;
|
|
24
|
+
}): ParticleState;
|
|
25
|
+
/**
|
|
26
|
+
* Updates a particle's physics state
|
|
27
|
+
*/
|
|
28
|
+
export declare function updateParticle(particle: ParticleState, deltaTime: number, physics: PhysicsConfig, fadeOut: boolean, scaleDown: boolean, trailConfig?: Partial<TrailConfig>, canvasHeight?: number): void;
|
|
29
|
+
/**
|
|
30
|
+
* Renders a particle to a canvas context
|
|
31
|
+
*/
|
|
32
|
+
export declare function renderParticle(ctx: CanvasRenderingContext2D, particle: ParticleState, options?: {
|
|
33
|
+
trailConfig?: Partial<TrailConfig>;
|
|
34
|
+
glowConfig?: Partial<GlowConfig>;
|
|
35
|
+
customDraw?: CustomDrawFunction;
|
|
36
|
+
elapsed?: number;
|
|
37
|
+
}): void;
|
|
38
|
+
/**
|
|
39
|
+
* Checks if all particles in an array are inactive
|
|
40
|
+
*/
|
|
41
|
+
export declare function areAllParticlesInactive(particles: readonly ParticleState[]): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Counts active particles
|
|
44
|
+
*/
|
|
45
|
+
export declare function countActiveParticles(particles: readonly ParticleState[]): number;
|
|
46
|
+
/**
|
|
47
|
+
* Resets the particle ID counter (useful for testing)
|
|
48
|
+
*/
|
|
49
|
+
export declare function resetParticleIdCounter(): void;
|
|
50
|
+
//# sourceMappingURL=particle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"particle.d.ts","sourceRoot":"","sources":["../../src/particle.ts"],"names":[],"mapp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