react-native-confetti-reanimated 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 +22 -0
- package/README.md +277 -0
- package/lib/commonjs/ConfettiCanvas.js +89 -0
- package/lib/commonjs/ConfettiCanvas.js.map +1 -0
- package/lib/commonjs/ConfettiParticle.js +116 -0
- package/lib/commonjs/ConfettiParticle.js.map +1 -0
- package/lib/commonjs/index.js +27 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/presets.js +146 -0
- package/lib/commonjs/presets.js.map +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/useConfetti.js +27 -0
- package/lib/commonjs/useConfetti.js.map +1 -0
- package/lib/commonjs/utils.js +125 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/module/ConfettiCanvas.js +84 -0
- package/lib/module/ConfettiCanvas.js.map +1 -0
- package/lib/module/ConfettiParticle.js +110 -0
- package/lib/module/ConfettiParticle.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/presets.js +142 -0
- package/lib/module/presets.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/useConfetti.js +22 -0
- package/lib/module/useConfetti.js.map +1 -0
- package/lib/module/utils.js +116 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/typescript/ConfettiCanvas.d.ts +20 -0
- package/lib/typescript/ConfettiCanvas.d.ts.map +1 -0
- package/lib/typescript/ConfettiParticle.d.ts +10 -0
- package/lib/typescript/ConfettiParticle.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +6 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/presets.d.ts +52 -0
- package/lib/typescript/presets.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +118 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/useConfetti.d.ts +11 -0
- package/lib/typescript/useConfetti.d.ts.map +1 -0
- package/lib/typescript/utils.d.ts +24 -0
- package/lib/typescript/utils.d.ts.map +1 -0
- package/package.json +78 -0
- package/src/ConfettiCanvas.tsx +121 -0
- package/src/ConfettiParticle.tsx +141 -0
- package/src/index.tsx +6 -0
- package/src/presets.ts +126 -0
- package/src/types.ts +137 -0
- package/src/useConfetti.ts +25 -0
- package/src/utils.ts +135 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Predefined confetti presets for common use cases
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Basic celebration with confetti from the center
|
|
9
|
+
*/
|
|
10
|
+
export const celebration = {
|
|
11
|
+
particleCount: 100,
|
|
12
|
+
spread: 70,
|
|
13
|
+
origin: {
|
|
14
|
+
y: 0.6
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Fireworks effect
|
|
20
|
+
*/
|
|
21
|
+
export const fireworks = {
|
|
22
|
+
particleCount: 150,
|
|
23
|
+
spread: 360,
|
|
24
|
+
startVelocity: 30,
|
|
25
|
+
decay: 0.94,
|
|
26
|
+
scalar: 1.2
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Confetti from the bottom
|
|
31
|
+
*/
|
|
32
|
+
export const bottomCannon = {
|
|
33
|
+
particleCount: 50,
|
|
34
|
+
angle: 60,
|
|
35
|
+
spread: 55,
|
|
36
|
+
origin: {
|
|
37
|
+
y: 0.8,
|
|
38
|
+
x: 0.5
|
|
39
|
+
},
|
|
40
|
+
startVelocity: 55
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Confetti from left side
|
|
45
|
+
*/
|
|
46
|
+
export const leftCannon = {
|
|
47
|
+
particleCount: 50,
|
|
48
|
+
angle: 45,
|
|
49
|
+
spread: 55,
|
|
50
|
+
origin: {
|
|
51
|
+
x: 0,
|
|
52
|
+
y: 0.6
|
|
53
|
+
},
|
|
54
|
+
startVelocity: 55
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Confetti from right side
|
|
59
|
+
*/
|
|
60
|
+
export const rightCannon = {
|
|
61
|
+
particleCount: 50,
|
|
62
|
+
angle: 135,
|
|
63
|
+
spread: 55,
|
|
64
|
+
origin: {
|
|
65
|
+
x: 1,
|
|
66
|
+
y: 0.6
|
|
67
|
+
},
|
|
68
|
+
startVelocity: 55
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Realistic looking confetti
|
|
73
|
+
*/
|
|
74
|
+
export const realistic = {
|
|
75
|
+
particleCount: 200,
|
|
76
|
+
spread: 160,
|
|
77
|
+
origin: {
|
|
78
|
+
y: 0.5
|
|
79
|
+
},
|
|
80
|
+
startVelocity: 35,
|
|
81
|
+
gravity: 1.5,
|
|
82
|
+
drift: 1,
|
|
83
|
+
tilt: true,
|
|
84
|
+
shapes: ['square', 'circle', 'triangle'],
|
|
85
|
+
scalar: 0.8
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Snow effect
|
|
90
|
+
*/
|
|
91
|
+
export const snow = {
|
|
92
|
+
particleCount: 100,
|
|
93
|
+
spread: 180,
|
|
94
|
+
origin: {
|
|
95
|
+
y: -0.1
|
|
96
|
+
},
|
|
97
|
+
startVelocity: 0,
|
|
98
|
+
gravity: 0.3,
|
|
99
|
+
drift: 1,
|
|
100
|
+
colors: ['#ffffff', '#e8f4ff', '#c9e5ff'],
|
|
101
|
+
shapes: ['circle'],
|
|
102
|
+
scalar: 0.6,
|
|
103
|
+
angle: 270
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Stars effect
|
|
108
|
+
*/
|
|
109
|
+
export const stars = {
|
|
110
|
+
particleCount: 50,
|
|
111
|
+
spread: 360,
|
|
112
|
+
startVelocity: 20,
|
|
113
|
+
decay: 0.95,
|
|
114
|
+
gravity: 0.5,
|
|
115
|
+
colors: ['#FFD700', '#FFA500', '#FFFF00'],
|
|
116
|
+
shapes: ['circle'],
|
|
117
|
+
scalar: 0.5
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* School pride (custom colors)
|
|
122
|
+
*/
|
|
123
|
+
export const schoolPride = {
|
|
124
|
+
particleCount: 100,
|
|
125
|
+
spread: 160,
|
|
126
|
+
origin: {
|
|
127
|
+
y: 0.6
|
|
128
|
+
},
|
|
129
|
+
colors: ['#bb0000', '#ffffff']
|
|
130
|
+
};
|
|
131
|
+
export const presets = {
|
|
132
|
+
celebration,
|
|
133
|
+
fireworks,
|
|
134
|
+
bottomCannon,
|
|
135
|
+
leftCannon,
|
|
136
|
+
rightCannon,
|
|
137
|
+
realistic,
|
|
138
|
+
snow,
|
|
139
|
+
stars,
|
|
140
|
+
schoolPride
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=presets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["celebration","particleCount","spread","origin","y","fireworks","startVelocity","decay","scalar","bottomCannon","angle","x","leftCannon","rightCannon","realistic","gravity","drift","tilt","shapes","snow","colors","stars","schoolPride","presets"],"sourceRoot":"../../src","sources":["presets.ts"],"mappings":";;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,MAAMA,WAA2B,GAAG;EACzCC,aAAa,EAAE,GAAG;EAClBC,MAAM,EAAE,EAAE;EACVC,MAAM,EAAE;IAAEC,CAAC,EAAE;EAAI;AACnB,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,SAAyB,GAAG;EACvCJ,aAAa,EAAE,GAAG;EAClBC,MAAM,EAAE,GAAG;EACXI,aAAa,EAAE,EAAE;EACjBC,KAAK,EAAE,IAAI;EACXC,MA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,OAAO,EAAE,GAAG;EACZC,KAAK,EAAE,CAAC;EACRI,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;EACzCF,MAAM,EAAE,CAAC,QAAQ,CAAC;EAClBV,MAAM,EAAE,GAAG;EACXE,KAAK,EAAE;AACT,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMW,KAAqB,GAAG;EACnCpB,aAAa,EAAE,EAAE;EACjBC,MAAM,EAAE,GAAG;EACXI,aAAa,EAAE,EAAE;EACjBC,KAAK,EAAE,IAAI;EACXQ,OAAO,EAAE,GAAG;EACZK,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;EACzCF,MAAM,EAAE,CAAC,QAAQ,CAAC;EAClBV,MAAM,EAAE;AACV,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMc,WAA2B,GAAG;EACzCrB,aAAa,EAAE,GAAG;EAClBC,MAAM,EAAE,GAAG;EACXC,MAAM,EAAE;IAAEC,CAAC,EAAE;EAAI,CAAC;EAClBgB,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS;AAC/B,CAAC;AAED,OAAO,MAAMG,OAAO,GAAG;EACrBvB,WAAW;EACXK,SAAS;EACTI,YAAY;EACZG,UAAU;EACVC,WAAW;EACXC,SAAS;EACTK,IAAI;EACJE,KAAK;EACLC;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useRef, useCallback } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* Hook to use confetti imperatively
|
|
6
|
+
* Returns a ref to pass to ConfettiCanvas and a fire function
|
|
7
|
+
*/
|
|
8
|
+
export const useConfetti = () => {
|
|
9
|
+
const confettiRef = useRef(null);
|
|
10
|
+
const fire = useCallback(config => {
|
|
11
|
+
return confettiRef.current?.(config);
|
|
12
|
+
}, []);
|
|
13
|
+
const reset = useCallback(() => {
|
|
14
|
+
confettiRef.current?.reset();
|
|
15
|
+
}, []);
|
|
16
|
+
return {
|
|
17
|
+
confettiRef,
|
|
18
|
+
fire,
|
|
19
|
+
reset
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=useConfetti.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useRef","useCallback","useConfetti","confettiRef","fire","config","current","reset"],"sourceRoot":"../../src","sources":["useConfetti.ts"],"mappings":";;AAAA,SAASA,MAAM,EAAEC,WAAW,QAAQ,OAAO;AAG3C;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAGA,CAAA,KAAM;EAC/B,MAAMC,WAAW,GAAGH,MAAM,CAAkB,IAAI,CAAC;EAEjD,MAAMI,IAAI,GAAGH,WAAW,CAAEI,MAAuB,IAAK;IACpD,OAAOF,WAAW,CAACG,OAAO,GAAGD,MAAM,CAAC;EACtC,CAAC,EAAE,EAAE,CAAC;EAEN,MAAME,KAAK,GAAGN,WAAW,CAAC,MAAM;IAC9BE,WAAW,CAACG,OAAO,EAAEC,KAAK,CAAC,CAAC;EAC9B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACLJ,WAAW;IACXC,IAAI;IACJG;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_COLORS = ['#26ccff', '#a25afd', '#ff5e7e', '#88ff5a', '#fcff42', '#ffa62d', '#ff36ff'];
|
|
4
|
+
export const DEFAULT_CONFIG = {
|
|
5
|
+
particleCount: 50,
|
|
6
|
+
angle: 90,
|
|
7
|
+
spread: 45,
|
|
8
|
+
startVelocity: 45,
|
|
9
|
+
decay: 0.9,
|
|
10
|
+
gravity: 1,
|
|
11
|
+
drift: 0,
|
|
12
|
+
duration: 3000,
|
|
13
|
+
colors: DEFAULT_COLORS,
|
|
14
|
+
scalar: 1,
|
|
15
|
+
origin: {
|
|
16
|
+
x: 0.5,
|
|
17
|
+
y: 0.5
|
|
18
|
+
},
|
|
19
|
+
shapes: ['square', 'circle'],
|
|
20
|
+
tilt: true,
|
|
21
|
+
tiltAngleIncrement: 10,
|
|
22
|
+
tickDuration: 200,
|
|
23
|
+
disableForReducedMotion: false,
|
|
24
|
+
usePerformanceMode: false
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Convert degrees to radians
|
|
29
|
+
*/
|
|
30
|
+
export const degreesToRadians = degrees => {
|
|
31
|
+
return degrees * Math.PI / 180;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Generate a random number between min and max
|
|
36
|
+
*/
|
|
37
|
+
export const randomRange = (min, max) => {
|
|
38
|
+
return Math.random() * (max - min) + min;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Pick a random item from an array
|
|
43
|
+
*/
|
|
44
|
+
export const randomFromArray = arr => {
|
|
45
|
+
const item = arr[Math.floor(Math.random() * arr.length)];
|
|
46
|
+
if (item === undefined) {
|
|
47
|
+
throw new Error('Array is empty');
|
|
48
|
+
}
|
|
49
|
+
return item;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Create initial confetti particles
|
|
54
|
+
*/
|
|
55
|
+
export const createConfettiParticles = (config, screenWidth, screenHeight) => {
|
|
56
|
+
const particles = [];
|
|
57
|
+
const angleInRadians = degreesToRadians(config.angle);
|
|
58
|
+
const spreadInRadians = degreesToRadians(config.spread);
|
|
59
|
+
for (let i = 0; i < config.particleCount; i++) {
|
|
60
|
+
const angle = angleInRadians + randomRange(-spreadInRadians / 2, spreadInRadians / 2);
|
|
61
|
+
const velocity = config.startVelocity * (0.5 + Math.random() * 0.5);
|
|
62
|
+
const particle = {
|
|
63
|
+
id: `confetti-${i}-${Date.now()}`,
|
|
64
|
+
color: randomFromArray(config.colors),
|
|
65
|
+
shape: randomFromArray(config.shapes),
|
|
66
|
+
x: (config.origin.x ?? 0.5) * screenWidth,
|
|
67
|
+
y: (config.origin.y ?? 0.5) * screenHeight,
|
|
68
|
+
size: (5 + Math.random() * 5) * config.scalar,
|
|
69
|
+
velocity: {
|
|
70
|
+
x: Math.cos(angle) * velocity,
|
|
71
|
+
y: Math.sin(angle) * velocity
|
|
72
|
+
},
|
|
73
|
+
rotation: Math.random() * 360,
|
|
74
|
+
rotationVelocity: randomRange(-10, 10),
|
|
75
|
+
tiltAngle: config.tilt ? Math.random() * config.tiltAngleIncrement : 0,
|
|
76
|
+
opacity: 1
|
|
77
|
+
};
|
|
78
|
+
particles.push(particle);
|
|
79
|
+
}
|
|
80
|
+
return particles;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Update a confetti particle's position
|
|
85
|
+
*/
|
|
86
|
+
export const updateParticle = (particle, config, deltaTime) => {
|
|
87
|
+
const dt = deltaTime / 16; // Normalize to 60fps
|
|
88
|
+
|
|
89
|
+
// Apply gravity
|
|
90
|
+
const newVelocityY = particle.velocity.y - config.gravity * dt;
|
|
91
|
+
|
|
92
|
+
// Apply drift
|
|
93
|
+
const newVelocityX = particle.velocity.x + config.drift * dt;
|
|
94
|
+
|
|
95
|
+
// Update position
|
|
96
|
+
const newX = particle.x + newVelocityX * dt;
|
|
97
|
+
const newY = particle.y - newVelocityY * dt;
|
|
98
|
+
|
|
99
|
+
// Update rotation
|
|
100
|
+
const newRotation = particle.rotation + particle.rotationVelocity * dt;
|
|
101
|
+
|
|
102
|
+
// Apply decay to opacity
|
|
103
|
+
const newOpacity = particle.opacity * Math.pow(config.decay, dt);
|
|
104
|
+
return {
|
|
105
|
+
...particle,
|
|
106
|
+
x: newX,
|
|
107
|
+
y: newY,
|
|
108
|
+
velocity: {
|
|
109
|
+
x: newVelocityX,
|
|
110
|
+
y: newVelocityY
|
|
111
|
+
},
|
|
112
|
+
rotation: newRotation,
|
|
113
|
+
opacity: newOpacity
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DEFAULT_COLORS","DEFAULT_CONFIG","particleCount","angle","spread","startVelocity","decay","gravity","drift","duration","colors","scalar","origin","x","y","shapes","tilt","tiltAngleIncrement","tickDuration","disableForReducedMotion","usePerformanceMode","degreesToRadians","degrees","Math","PI","randomRange","min","max","random","randomFromArray","arr","item","floor","length","undefined","Error","createConfettiParticles","config","screenWidth","screenHeight","particles","angleInRadians","spreadInRadians","i","velocity","particle","id","Date","now","color","shape","size","cos","sin","rotation","rotationVelocity","tiltAngle","opacity","push","updateParticle","deltaTime","dt","newVelocityY","newVelocityX","newX","newY","newRotation","newOpacity","pow"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;AAEA,OAAO,MAAMA,cAAc,GAAG,CAC5B,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,CACV;AAED,OAAO,MAAMC,cAAwC,GAAG;EACtDC,aAAa,EAAE,EAAE;EACjBC,KAAK,EAAE,EAAE;EACTC,MAAM,EAAE,EAAE;EACVC,aAAa,EAAE,EAAE;EACjBC,KAAK,EAAE,GAAG;EACVC,OAAO,EAAE,CAAC;EACVC,KAAK,EAAE,CAAC;EACRC,QAAQ,EAAE,IAAI;EACdC,MAAM,EAAEV,cAAc;EACtBW,MAAM,EAAE,CAAC;EACTC,MAAM,EAAE;IAAEC,CAAC,EAAE,GAAG;IAAEC,CAAC,EAAE;EAAI,CAAC;EAC1BC,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;EAC5BC,IAAI,EAAE,IAAI;EACVC,kBAAkB,EAAE,EAAE;EACtBC,YAAY,EAAE,GAAG;EACjBC,uBAAuB,EAAE,KAAK;EAC9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AAC;;EAE3B;EACA,MAAME,YAAY,GAAGjB,QAAQ,CAACD,QAAQ,CAAC9B,CAAC,GAAGuB,MAAM,CAAC9B,OAAO,GAAGsD,EAAE;;EAE9D;EACA,MAAME,YAAY,GAAGlB,QAAQ,CAACD,QAAQ,CAAC/B,CAAC,GAAGwB,MAAM,CAAC7B,KAAK,GAAGqD,EAAE;;EAE5D;EACA,MAAMG,IAAI,GAAGnB,QAAQ,CAAChC,CAAC,GAAGkD,YAAY,GAAGF,EAAE;EAC3C,MAAMI,IAAI,GAAGpB,QAAQ,CAAC/B,CAAC,GAAGgD,YAAY,GAAGD,EAAE;;EAE3C;EACA,MAAMK,WAAW,GAAGrB,QAAQ,CAACS,QAAQ,GAAGT,QAAQ,CAACU,gBAAgB,GAAGM,EAAE;;EAEtE;EACA,MAAMM,UAAU,GAAGtB,QAAQ,CAACY,OAAO,GAAGlC,IAAI,CAAC6C,GAAG,CAAC/B,MAAM,CAAC/B,KAAK,EAAEuD,EAAE,CAAC;EAEhE,OAAO;IACL,GAAGhB,QAAQ;IACXhC,CAAC,EAAEmD,IAAI;IACPlD,CAAC,EAAEmD,IAAI;IACPrB,QAAQ,EAAE;MACR/B,CAAC,EAAEkD,YAAY;MACfjD,CAAC,EAAEgD;IACL,CAAC;IACDR,QAAQ,EAAEY,WAAW;IACrBT,OAAO,EAAEU;EACX,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ConfettiMethods } from './types';
|
|
3
|
+
export interface ConfettiCanvasProps {
|
|
4
|
+
/**
|
|
5
|
+
* Style for the confetti container
|
|
6
|
+
*/
|
|
7
|
+
containerStyle?: any;
|
|
8
|
+
/**
|
|
9
|
+
* Z-index for the confetti container
|
|
10
|
+
* @default 1000
|
|
11
|
+
*/
|
|
12
|
+
zIndex?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Whether confetti should be allowed to go outside of safe area
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
fullScreen?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const ConfettiCanvas: React.ForwardRefExoticComponent<ConfettiCanvasProps & React.RefAttributes<ConfettiMethods>>;
|
|
20
|
+
//# sourceMappingURL=ConfettiCanvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfettiCanvas.d.ts","sourceRoot":"","sources":["../../src/ConfettiCanvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAE1E,OAAO,KAAK,EAAkB,eAAe,EAAE,MAAM,SAAS,CAAC;AAK/D,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,cAAc,CAAC,EAAE,GAAG,CAAC;IAErB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,cAAc,6FA6E1B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ConfettiParticle as ConfettiParticleType } from './types';
|
|
3
|
+
interface Props {
|
|
4
|
+
particle: ConfettiParticleType;
|
|
5
|
+
duration: number;
|
|
6
|
+
onComplete?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const ConfettiParticle: React.FC<Props>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=ConfettiParticle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfettiParticle.d.ts","sourceRoot":"","sources":["../../src/ConfettiParticle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AASzC,OAAO,KAAK,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAExE,UAAU,KAAK;IACb,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAmG5C,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ConfettiCanvas } from './ConfettiCanvas';
|
|
2
|
+
export { useConfetti } from './useConfetti';
|
|
3
|
+
export { presets } from './presets';
|
|
4
|
+
export type { ConfettiConfig, ConfettiMethods, ConfettiParticle } from './types';
|
|
5
|
+
export type { ConfettiCanvasProps } from './ConfettiCanvas';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACjF,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ConfettiConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Predefined confetti presets for common use cases
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Basic celebration with confetti from the center
|
|
7
|
+
*/
|
|
8
|
+
export declare const celebration: ConfettiConfig;
|
|
9
|
+
/**
|
|
10
|
+
* Fireworks effect
|
|
11
|
+
*/
|
|
12
|
+
export declare const fireworks: ConfettiConfig;
|
|
13
|
+
/**
|
|
14
|
+
* Confetti from the bottom
|
|
15
|
+
*/
|
|
16
|
+
export declare const bottomCannon: ConfettiConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Confetti from left side
|
|
19
|
+
*/
|
|
20
|
+
export declare const leftCannon: ConfettiConfig;
|
|
21
|
+
/**
|
|
22
|
+
* Confetti from right side
|
|
23
|
+
*/
|
|
24
|
+
export declare const rightCannon: ConfettiConfig;
|
|
25
|
+
/**
|
|
26
|
+
* Realistic looking confetti
|
|
27
|
+
*/
|
|
28
|
+
export declare const realistic: ConfettiConfig;
|
|
29
|
+
/**
|
|
30
|
+
* Snow effect
|
|
31
|
+
*/
|
|
32
|
+
export declare const snow: ConfettiConfig;
|
|
33
|
+
/**
|
|
34
|
+
* Stars effect
|
|
35
|
+
*/
|
|
36
|
+
export declare const stars: ConfettiConfig;
|
|
37
|
+
/**
|
|
38
|
+
* School pride (custom colors)
|
|
39
|
+
*/
|
|
40
|
+
export declare const schoolPride: ConfettiConfig;
|
|
41
|
+
export declare const presets: {
|
|
42
|
+
celebration: ConfettiConfig;
|
|
43
|
+
fireworks: ConfettiConfig;
|
|
44
|
+
bottomCannon: ConfettiConfig;
|
|
45
|
+
leftCannon: ConfettiConfig;
|
|
46
|
+
rightCannon: ConfettiConfig;
|
|
47
|
+
realistic: ConfettiConfig;
|
|
48
|
+
snow: ConfettiConfig;
|
|
49
|
+
stars: ConfettiConfig;
|
|
50
|
+
schoolPride: ConfettiConfig;
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=presets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,cAIzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,cAMvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,cAM1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,cAMxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,cAMzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,cAUvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,IAAI,EAAE,cAWlB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,cASnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,cAKzB,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;CAUnB,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export interface ConfettiConfig {
|
|
2
|
+
/**
|
|
3
|
+
* The number of confetti pieces to launch
|
|
4
|
+
* @default 50
|
|
5
|
+
*/
|
|
6
|
+
particleCount?: number;
|
|
7
|
+
/**
|
|
8
|
+
* The angle in degrees at which to launch the confetti
|
|
9
|
+
* @default 90
|
|
10
|
+
*/
|
|
11
|
+
angle?: number;
|
|
12
|
+
/**
|
|
13
|
+
* How far the confetti can spread from the origin
|
|
14
|
+
* @default 45
|
|
15
|
+
*/
|
|
16
|
+
spread?: number;
|
|
17
|
+
/**
|
|
18
|
+
* The starting velocity of the confetti
|
|
19
|
+
* @default 45
|
|
20
|
+
*/
|
|
21
|
+
startVelocity?: number;
|
|
22
|
+
/**
|
|
23
|
+
* How fast the confetti decays
|
|
24
|
+
* @default 0.9
|
|
25
|
+
*/
|
|
26
|
+
decay?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Gravity to apply to the confetti
|
|
29
|
+
* @default 1
|
|
30
|
+
*/
|
|
31
|
+
gravity?: number;
|
|
32
|
+
/**
|
|
33
|
+
* How much to the side the confetti will drift
|
|
34
|
+
* @default 0
|
|
35
|
+
*/
|
|
36
|
+
drift?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Time in milliseconds to run the confetti animation
|
|
39
|
+
* @default 3000
|
|
40
|
+
*/
|
|
41
|
+
duration?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Array of color strings, in any format (hex, rgb, hsl)
|
|
44
|
+
* @default ['#26ccff', '#a25afd', '#ff5e7e', '#88ff5a', '#fcff42', '#ffa62d', '#ff36ff']
|
|
45
|
+
*/
|
|
46
|
+
colors?: string[];
|
|
47
|
+
/**
|
|
48
|
+
* Scale of the confetti particles
|
|
49
|
+
* @default 1
|
|
50
|
+
*/
|
|
51
|
+
scalar?: number;
|
|
52
|
+
/**
|
|
53
|
+
* The x position on the screen where confetti will originate (0-1)
|
|
54
|
+
* 0 is left edge, 0.5 is center, 1 is right edge
|
|
55
|
+
* @default 0.5
|
|
56
|
+
*/
|
|
57
|
+
origin?: {
|
|
58
|
+
x?: number;
|
|
59
|
+
y?: number;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Shapes for confetti
|
|
63
|
+
* @default ['square', 'circle']
|
|
64
|
+
*/
|
|
65
|
+
shapes?: Array<'square' | 'circle' | 'triangle'>;
|
|
66
|
+
/**
|
|
67
|
+
* Whether the confetti should be affected by tilt
|
|
68
|
+
* @default true
|
|
69
|
+
*/
|
|
70
|
+
tilt?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Max angle for tilt
|
|
73
|
+
* @default 10
|
|
74
|
+
*/
|
|
75
|
+
tiltAngleIncrement?: number;
|
|
76
|
+
/**
|
|
77
|
+
* The number of times the confetti will move
|
|
78
|
+
* @default 200
|
|
79
|
+
*/
|
|
80
|
+
tickDuration?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Disable physics
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
disableForReducedMotion?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Use performance mode (fewer updates)
|
|
88
|
+
* @default false
|
|
89
|
+
*/
|
|
90
|
+
usePerformanceMode?: boolean;
|
|
91
|
+
}
|
|
92
|
+
export interface ConfettiParticle {
|
|
93
|
+
id: string;
|
|
94
|
+
color: string;
|
|
95
|
+
shape: 'square' | 'circle' | 'triangle';
|
|
96
|
+
x: number;
|
|
97
|
+
y: number;
|
|
98
|
+
size: number;
|
|
99
|
+
velocity: {
|
|
100
|
+
x: number;
|
|
101
|
+
y: number;
|
|
102
|
+
};
|
|
103
|
+
rotation: number;
|
|
104
|
+
rotationVelocity: number;
|
|
105
|
+
tiltAngle: number;
|
|
106
|
+
opacity: number;
|
|
107
|
+
}
|
|
108
|
+
export interface ConfettiMethods {
|
|
109
|
+
/**
|
|
110
|
+
* Fire confetti with the given configuration
|
|
111
|
+
*/
|
|
112
|
+
(config?: ConfettiConfig): Promise<null>;
|
|
113
|
+
/**
|
|
114
|
+
* Reset confetti
|
|
115
|
+
*/
|
|
116
|
+
reset: () => void;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,MAAM,CAAC,EAAE;QACP,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;KACZ,CAAC;IAEF;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC,CAAC;IAEjD;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;IACxC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE;QACR,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;OAEG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ConfettiConfig, ConfettiMethods } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to use confetti imperatively
|
|
4
|
+
* Returns a ref to pass to ConfettiCanvas and a fire function
|
|
5
|
+
*/
|
|
6
|
+
export declare const useConfetti: () => {
|
|
7
|
+
confettiRef: import("react").RefObject<ConfettiMethods>;
|
|
8
|
+
fire: (config?: ConfettiConfig) => Promise<null> | undefined;
|
|
9
|
+
reset: () => void;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=useConfetti.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConfetti.d.ts","sourceRoot":"","sources":["../../src/useConfetti.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,WAAW;;oBAGa,cAAc;;CAalD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ConfettiConfig, ConfettiParticle } from './types';
|
|
2
|
+
export declare const DEFAULT_COLORS: string[];
|
|
3
|
+
export declare const DEFAULT_CONFIG: Required<ConfettiConfig>;
|
|
4
|
+
/**
|
|
5
|
+
* Convert degrees to radians
|
|
6
|
+
*/
|
|
7
|
+
export declare const degreesToRadians: (degrees: number) => number;
|
|
8
|
+
/**
|
|
9
|
+
* Generate a random number between min and max
|
|
10
|
+
*/
|
|
11
|
+
export declare const randomRange: (min: number, max: number) => number;
|
|
12
|
+
/**
|
|
13
|
+
* Pick a random item from an array
|
|
14
|
+
*/
|
|
15
|
+
export declare const randomFromArray: <T>(arr: T[]) => T;
|
|
16
|
+
/**
|
|
17
|
+
* Create initial confetti particles
|
|
18
|
+
*/
|
|
19
|
+
export declare const createConfettiParticles: (config: Required<ConfettiConfig>, screenWidth: number, screenHeight: number) => ConfettiParticle[];
|
|
20
|
+
/**
|
|
21
|
+
* Update a confetti particle's position
|
|
22
|
+
*/
|
|
23
|
+
export declare const updateParticle: (particle: ConfettiParticle, config: Required<ConfettiConfig>, deltaTime: number) => ConfettiParticle;
|
|
24
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhE,eAAO,MAAM,cAAc,UAQ1B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,cAAc,CAkBnD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,MAAM,KAAG,MAElD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,KAAK,MAAM,KAAG,MAEtD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,KAAK,CAAC,EAAE,KAAG,CAM7C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAClC,QAAQ,QAAQ,CAAC,cAAc,CAAC,EAChC,aAAa,MAAM,EACnB,cAAc,MAAM,KACnB,gBAAgB,EA8BlB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GACzB,UAAU,gBAAgB,EAC1B,QAAQ,QAAQ,CAAC,cAAc,CAAC,EAChC,WAAW,MAAM,KAChB,gBA8BF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-confetti-reanimated",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A high-performance confetti component for React Native using Reanimated 4, compatible with Expo",
|
|
5
|
+
"main": "lib/commonjs/index.js",
|
|
6
|
+
"module": "lib/module/index.js",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "src/index.tsx",
|
|
9
|
+
"source": "src/index.tsx",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"lib",
|
|
13
|
+
"!**/__tests__",
|
|
14
|
+
"!**/__fixtures__",
|
|
15
|
+
"!**/__mocks__"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"typescript": "tsc --noEmit",
|
|
19
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
20
|
+
"prepare": "bob build",
|
|
21
|
+
"example": "cd example && npm start"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"react-native",
|
|
25
|
+
"confetti",
|
|
26
|
+
"reanimated",
|
|
27
|
+
"reanimated4",
|
|
28
|
+
"worklets",
|
|
29
|
+
"expo",
|
|
30
|
+
"animation",
|
|
31
|
+
"celebration",
|
|
32
|
+
"particles"
|
|
33
|
+
],
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/andydev271/react-native-confetti-reanimated.git"
|
|
37
|
+
},
|
|
38
|
+
"author": "Andy A <ar.anandan@yahoo.com>",
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/andydev271/react-native-confetti-reanimated/issues"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/andydev271/react-native-confetti-reanimated#readme",
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"react": "*",
|
|
46
|
+
"react-native": "*",
|
|
47
|
+
"react-native-reanimated": ">=4.0.0",
|
|
48
|
+
"react-native-worklets": ">=0.5.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@react-native-community/eslint-config": "^3.2.0",
|
|
52
|
+
"@types/react": "~18.2.0",
|
|
53
|
+
"@types/react-native": "^0.72.0",
|
|
54
|
+
"eslint": "^8.51.0",
|
|
55
|
+
"prettier": "^3.0.3",
|
|
56
|
+
"react": "18.2.0",
|
|
57
|
+
"react-native": "0.74.0",
|
|
58
|
+
"react-native-builder-bob": "^0.30.0",
|
|
59
|
+
"react-native-reanimated": "^4.0.0",
|
|
60
|
+
"react-native-worklets": "^0.5.0",
|
|
61
|
+
"typescript": "^5.3.0"
|
|
62
|
+
},
|
|
63
|
+
"react-native-builder-bob": {
|
|
64
|
+
"source": "src",
|
|
65
|
+
"output": "lib",
|
|
66
|
+
"targets": [
|
|
67
|
+
"commonjs",
|
|
68
|
+
"module",
|
|
69
|
+
[
|
|
70
|
+
"typescript",
|
|
71
|
+
{
|
|
72
|
+
"project": "tsconfig.build.json"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|