partycles 0.1.0 → 0.3.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/README.md +143 -5
- package/dist/animations/animations/aurora.d.ts +8 -0
- package/dist/animations/animations/aurora.d.ts.map +1 -0
- package/dist/animations/animations/balloons.d.ts +8 -0
- package/dist/animations/animations/balloons.d.ts.map +1 -0
- package/dist/animations/animations/coins.d.ts +8 -0
- package/dist/animations/animations/coins.d.ts.map +1 -0
- package/dist/animations/animations/emoji.d.ts +19 -0
- package/dist/animations/animations/emoji.d.ts.map +1 -0
- package/dist/animations/animations/fireflies.d.ts +8 -0
- package/dist/animations/animations/fireflies.d.ts.map +1 -0
- package/dist/animations/animations/galaxy.d.ts +8 -0
- package/dist/animations/animations/galaxy.d.ts.map +1 -0
- package/dist/animations/animations/index.d.ts.map +1 -1
- package/dist/animations/animations/lightning.d.ts +8 -0
- package/dist/animations/animations/lightning.d.ts.map +1 -0
- package/dist/animations/animations/music.d.ts +8 -0
- package/dist/animations/animations/music.d.ts.map +1 -0
- package/dist/animations/animations/paint.d.ts +8 -0
- package/dist/animations/animations/paint.d.ts.map +1 -0
- package/dist/animations/animations/petals.d.ts +8 -0
- package/dist/animations/animations/petals.d.ts.map +1 -0
- package/dist/animations/animations/snow.d.ts +8 -0
- package/dist/animations/animations/snow.d.ts.map +1 -0
- package/dist/animations/aurora.d.ts +8 -0
- package/dist/animations/aurora.d.ts.map +1 -0
- package/dist/animations/balloons.d.ts +8 -0
- package/dist/animations/balloons.d.ts.map +1 -0
- package/dist/animations/bubbles.esm.js +3 -3
- package/dist/animations/bubbles.esm.js.map +1 -1
- package/dist/animations/bubbles.js +3 -3
- package/dist/animations/bubbles.js.map +1 -1
- package/dist/animations/coins.d.ts +8 -0
- package/dist/animations/coins.d.ts.map +1 -0
- package/dist/animations/confetti.esm.js +1 -1
- package/dist/animations/confetti.esm.js.map +1 -1
- package/dist/animations/confetti.js +1 -1
- package/dist/animations/confetti.js.map +1 -1
- package/dist/animations/emoji.d.ts +19 -0
- package/dist/animations/emoji.d.ts.map +1 -0
- package/dist/animations/emoji.esm.js +58 -0
- package/dist/animations/emoji.esm.js.map +1 -0
- package/dist/animations/emoji.js +62 -0
- package/dist/animations/emoji.js.map +1 -0
- package/dist/animations/fireflies.d.ts +8 -0
- package/dist/animations/fireflies.d.ts.map +1 -0
- package/dist/animations/fireworks.esm.js +1 -1
- package/dist/animations/fireworks.esm.js.map +1 -1
- package/dist/animations/fireworks.js +1 -1
- package/dist/animations/fireworks.js.map +1 -1
- package/dist/animations/galaxy.d.ts +8 -0
- package/dist/animations/galaxy.d.ts.map +1 -0
- package/dist/animations/hearts.esm.js +1 -1
- package/dist/animations/hearts.esm.js.map +1 -1
- package/dist/animations/hearts.js +1 -1
- package/dist/animations/hearts.js.map +1 -1
- package/dist/animations/index.d.ts +1 -0
- package/dist/animations/index.d.ts.map +1 -1
- package/dist/animations/lightning.d.ts +8 -0
- package/dist/animations/lightning.d.ts.map +1 -0
- package/dist/animations/music.d.ts +8 -0
- package/dist/animations/music.d.ts.map +1 -0
- package/dist/animations/paint.d.ts +8 -0
- package/dist/animations/paint.d.ts.map +1 -0
- package/dist/animations/petals.d.ts +8 -0
- package/dist/animations/petals.d.ts.map +1 -0
- package/dist/animations/snow.d.ts +8 -0
- package/dist/animations/snow.d.ts.map +1 -0
- package/dist/animations/snow.esm.js +48 -0
- package/dist/animations/snow.esm.js.map +1 -0
- package/dist/animations/snow.js +51 -0
- package/dist/animations/snow.js.map +1 -0
- package/dist/animations/sparkles.esm.js +1 -1
- package/dist/animations/sparkles.esm.js.map +1 -1
- package/dist/animations/sparkles.js +1 -1
- package/dist/animations/sparkles.js.map +1 -1
- package/dist/animations/stars.esm.js +1 -1
- package/dist/animations/stars.esm.js.map +1 -1
- package/dist/animations/stars.js +1 -1
- package/dist/animations/stars.js.map +1 -1
- package/dist/animations/types.d.ts +1 -1
- package/dist/animations/types.d.ts.map +1 -1
- package/dist/animations/useReward.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +769 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +769 -9
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/useReward.d.ts.map +1 -1
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sparkles.js","sources":["../../src/utils.ts","../../src/animations/sparkles.tsx"],"sourcesContent":["import { Particle } from './types';\n\nexport const randomInRange = (min: number, max: number): number => {\n return Math.random() * (max - min) + min;\n};\n\nexport const degreesToRadians = (degrees: number): number => {\n return (degrees * Math.PI) / 180;\n};\n\nexport const generateId = (): string => {\n return Math.random().toString(36).substring(2, 9);\n};\n\nexport const getRandomColor = (colors: string[]): string => {\n return colors[Math.floor(Math.random() * colors.length)] || colors[0];\n};\n\nexport const createParticleStyle = (\n particle: Particle,\n containerRect: DOMRect\n): React.CSSProperties => {\n return {\n position: 'absolute',\n left: `${particle.x - containerRect.left}px`,\n top: `${particle.y - containerRect.top}px`,\n transform: `rotate(${particle.rotation}deg)`,\n opacity: particle.opacity,\n pointerEvents: 'none',\n transition: 'none',\n willChange: 'transform, opacity',\n };\n};","import React from 'react';\nimport { AnimationConfig, Particle } from '../types';\nimport { randomInRange, generateId } from '../utils';\n\nexport const createSparkleParticles = (\n origin: { x: number; y: number },\n config: AnimationConfig\n): Particle[] => {\n const {\n particleCount = 35,\n spread = 120,\n startVelocity =
|
1
|
+
{"version":3,"file":"sparkles.js","sources":["../../src/utils.ts","../../src/animations/sparkles.tsx"],"sourcesContent":["import { Particle } from './types';\n\nexport const randomInRange = (min: number, max: number): number => {\n return Math.random() * (max - min) + min;\n};\n\nexport const degreesToRadians = (degrees: number): number => {\n return (degrees * Math.PI) / 180;\n};\n\nexport const generateId = (): string => {\n return Math.random().toString(36).substring(2, 9);\n};\n\nexport const getRandomColor = (colors: string[]): string => {\n return colors[Math.floor(Math.random() * colors.length)] || colors[0];\n};\n\nexport const createParticleStyle = (\n particle: Particle,\n containerRect: DOMRect\n): React.CSSProperties => {\n return {\n position: 'absolute',\n left: `${particle.x - containerRect.left}px`,\n top: `${particle.y - containerRect.top}px`,\n transform: `rotate(${particle.rotation}deg)`,\n opacity: particle.opacity,\n pointerEvents: 'none',\n transition: 'none',\n willChange: 'transform, opacity',\n };\n};","import React from 'react';\nimport { AnimationConfig, Particle } from '../types';\nimport { randomInRange, generateId } from '../utils';\n\nexport const createSparkleParticles = (\n origin: { x: number; y: number },\n config: AnimationConfig\n): Particle[] => {\n const {\n particleCount = 35,\n spread = 120,\n startVelocity = 15,\n elementSize = 25,\n colors = ['#FFD700', '#FFFFFF']\n } = config;\n\n const particles: Particle[] = [];\n\n for (let i = 0; i < particleCount; i++) {\n const velocityScale = startVelocity / 45; // Scale based on default\n particles.push({\n id: generateId(),\n x: origin.x + randomInRange(-spread, spread),\n y: origin.y + randomInRange(-spread, spread),\n vx: randomInRange(-3, 3) * velocityScale,\n vy: randomInRange(-3, 3) * velocityScale,\n life: config.lifetime || 120,\n opacity: 0,\n size: randomInRange(elementSize * 0.4, elementSize * 1.2),\n rotation: randomInRange(0, 360),\n color: colors[Math.floor(Math.random() * colors.length)] || colors[0],\n });\n }\n\n return particles;\n};\n\nexport const renderSparkleParticle = (particle: Particle): React.ReactNode => {\n const scale = particle.opacity;\n \n return (\n <svg\n key={particle.id}\n width={particle.size}\n height={particle.size}\n viewBox=\"0 0 24 24\"\n style={{\n transform: `scale(${scale}) rotate(${particle.rotation}deg)`,\n filter: 'drop-shadow(0 0 6px rgba(255, 215, 0, 0.8))',\n }}\n >\n <path\n d=\"M12 0L14.59 8.41L23 11L14.59 13.59L12 22L9.41 13.59L1 11L9.41 8.41L12 0Z\"\n fill={particle.color}\n />\n </svg>\n );\n};"],"names":[],"mappings":";;;;AAEO,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,GAAW,KAAY;AA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AG,CAAC;YAC/B,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC;AACtE,SAAA,CAAC;;AAGJ,IAAA,OAAO,SAAS;AAClB;AAEa,MAAA,qBAAqB,GAAG,CAAC,QAAkB,KAAqB;AAC3E,IAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO;IAE9B,QACE,KACE,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,GAAG,EAAE,QAAQ,CAAC,EAAE,EAChB,KAAK,EAAE,QAAQ,CAAC,IAAI,EACpB,MAAM,EAAE,QAAQ,CAAC,IAAI,EACrB,OAAO,EAAC,WAAW,EACnB,KAAK,EAAE;AACL,YAAA,SAAS,EAAE,CAAS,MAAA,EAAA,KAAK,YAAY,QAAQ,CAAC,QAAQ,CAAM,IAAA,CAAA;AAC5D,YAAA,MAAM,EAAE,6CAA6C;AACtD,SAAA,EAAA;AAED,QAAA,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EACE,CAAC,EAAC,0EAA0E,EAC5E,IAAI,EAAE,QAAQ,CAAC,KAAK,EAAA,CACpB,CACE;AAEV;;;;;"}
|
@@ -9,7 +9,7 @@ const generateId = () => {
|
|
9
9
|
|
10
10
|
const starColors = ['#FFD700', '#FFA500', '#FF6347', '#FFE4B5'];
|
11
11
|
const createStarParticles = (origin, config) => {
|
12
|
-
const { particleCount = 40, startVelocity =
|
12
|
+
const { particleCount = 40, startVelocity = 18, colors = starColors, elementSize = 30 } = config;
|
13
13
|
const particles = [];
|
14
14
|
for (let i = 0; i < particleCount; i++) {
|
15
15
|
const angle = randomInRange(0, 360);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stars.esm.js","sources":["../../src/utils.ts","../../src/animations/stars.tsx"],"sourcesContent":["import { Particle } from './types';\n\nexport const randomInRange = (min: number, max: number): number => {\n return Math.random() * (max - min) + min;\n};\n\nexport const degreesToRadians = (degrees: number): number => {\n return (degrees * Math.PI) / 180;\n};\n\nexport const generateId = (): string => {\n return Math.random().toString(36).substring(2, 9);\n};\n\nexport const getRandomColor = (colors: string[]): string => {\n return colors[Math.floor(Math.random() * colors.length)] || colors[0];\n};\n\nexport const createParticleStyle = (\n particle: Particle,\n containerRect: DOMRect\n): React.CSSProperties => {\n return {\n position: 'absolute',\n left: `${particle.x - containerRect.left}px`,\n top: `${particle.y - containerRect.top}px`,\n transform: `rotate(${particle.rotation}deg)`,\n opacity: particle.opacity,\n pointerEvents: 'none',\n transition: 'none',\n willChange: 'transform, opacity',\n };\n};","import React from 'react';\nimport { AnimationConfig, Particle } from '../types';\nimport { randomInRange, generateId } from '../utils';\n\nconst starColors = ['#FFD700', '#FFA500', '#FF6347', '#FFE4B5'];\n\nexport const createStarParticles = (\n origin: { x: number; y: number },\n config: AnimationConfig\n): Particle[] => {\n const {\n particleCount = 40,\n startVelocity =
|
1
|
+
{"version":3,"file":"stars.esm.js","sources":["../../src/utils.ts","../../src/animations/stars.tsx"],"sourcesContent":["import { Particle } from './types';\n\nexport const randomInRange = (min: number, max: number): number => {\n return Math.random() * (max - min) + min;\n};\n\nexport const degreesToRadians = (degrees: number): number => {\n return (degrees * Math.PI) / 180;\n};\n\nexport const generateId = (): string => {\n return Math.random().toString(36).substring(2, 9);\n};\n\nexport const getRandomColor = (colors: string[]): string => {\n return colors[Math.floor(Math.random() * colors.length)] || colors[0];\n};\n\nexport const createParticleStyle = (\n particle: Particle,\n containerRect: DOMRect\n): React.CSSProperties => {\n return {\n position: 'absolute',\n left: `${particle.x - containerRect.left}px`,\n top: `${particle.y - containerRect.top}px`,\n transform: `rotate(${particle.rotation}deg)`,\n opacity: particle.opacity,\n pointerEvents: 'none',\n transition: 'none',\n willChange: 'transform, opacity',\n };\n};","import React from 'react';\nimport { AnimationConfig, Particle } from '../types';\nimport { randomInRange, generateId } from '../utils';\n\nconst starColors = ['#FFD700', '#FFA500', '#FF6347', '#FFE4B5'];\n\nexport const createStarParticles = (\n origin: { x: number; y: number },\n config: AnimationConfig\n): Particle[] => {\n const {\n particleCount = 40,\n startVelocity = 18,\n colors = starColors,\n elementSize = 30\n } = config;\n\n const particles: Particle[] = [];\n\n for (let i = 0; i < particleCount; i++) {\n const angle = randomInRange(0, 360);\n const velocity = randomInRange(startVelocity * 0.5, startVelocity);\n\n particles.push({\n id: generateId(),\n x: origin.x,\n y: origin.y,\n vx: Math.cos((angle * Math.PI) / 180) * velocity,\n vy: Math.sin((angle * Math.PI) / 180) * velocity - 15,\n life: config.lifetime || 150,\n opacity: 1,\n size: randomInRange(elementSize * 0.5, elementSize * 1.3),\n rotation: randomInRange(0, 360),\n color: colors[Math.floor(Math.random() * colors.length)] || colors[0],\n });\n }\n\n return particles;\n};\n\nexport const renderStarParticle = (particle: Particle): React.ReactNode => {\n return (\n <svg\n key={particle.id}\n width={particle.size}\n height={particle.size}\n viewBox=\"0 0 24 24\"\n fill={particle.color}\n style={{\n filter: `drop-shadow(0 0 ${particle.size * 0.2}px ${particle.color})`,\n }}\n >\n <path d=\"M12,17.27L18.18,21L16.54,13.97L22,9.24L14.81,8.62L12,2L9.19,8.62L2,9.24L7.45,13.97L5.82,21L12,17.27Z\" />\n </svg>\n );\n};"],"names":[],"mappings":";;AAEO,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,GAAW,KAAY;AAChE,IAAA,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG;AAC1C,CAAC;AAMM,MAAM,UAAU,GAAG,MAAa;AACrC,IAAA,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;AACnD,CAAC;;ACRD,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;MAElD,mBAAmB,GAAG,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AAG,CAAC,QAAkB,KAAqB;AACxE,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACE,GAAG,EAAE,QAAQ,CAAC,EAAE,EAChB,KAAK,EAAE,QAAQ,CAAC,IAAI,EACpB,MAAM,EAAE,QAAQ,CAAC,IAAI,EACrB,OAAO,EAAC,WAAW,EACnB,IAAI,EAAE,QAAQ,CAAC,KAAK,EACpB,KAAK,EAAE;YACL,MAAM,EAAE,CAAmB,gBAAA,EAAA,QAAQ,CAAC,IAAI,GAAG,GAAG,CAAM,GAAA,EAAA,QAAQ,CAAC,KAAK,CAAG,CAAA,CAAA;AACtE,SAAA,EAAA;AAED,QAAA,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAM,CAAC,EAAC,sGAAsG,EAAG,CAAA,CAC7G;AAEV;;;;"}
|
package/dist/animations/stars.js
CHANGED
@@ -11,7 +11,7 @@ const generateId = () => {
|
|
11
11
|
|
12
12
|
const starColors = ['#FFD700', '#FFA500', '#FF6347', '#FFE4B5'];
|
13
13
|
const createStarParticles = (origin, config) => {
|
14
|
-
const { particleCount = 40, startVelocity =
|
14
|
+
const { particleCount = 40, startVelocity = 18, colors = starColors, elementSize = 30 } = config;
|
15
15
|
const particles = [];
|
16
16
|
for (let i = 0; i < particleCount; i++) {
|
17
17
|
const angle = randomInRange(0, 360);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stars.js","sources":["../../src/utils.ts","../../src/animations/stars.tsx"],"sourcesContent":["import { Particle } from './types';\n\nexport const randomInRange = (min: number, max: number): number => {\n return Math.random() * (max - min) + min;\n};\n\nexport const degreesToRadians = (degrees: number): number => {\n return (degrees * Math.PI) / 180;\n};\n\nexport const generateId = (): string => {\n return Math.random().toString(36).substring(2, 9);\n};\n\nexport const getRandomColor = (colors: string[]): string => {\n return colors[Math.floor(Math.random() * colors.length)] || colors[0];\n};\n\nexport const createParticleStyle = (\n particle: Particle,\n containerRect: DOMRect\n): React.CSSProperties => {\n return {\n position: 'absolute',\n left: `${particle.x - containerRect.left}px`,\n top: `${particle.y - containerRect.top}px`,\n transform: `rotate(${particle.rotation}deg)`,\n opacity: particle.opacity,\n pointerEvents: 'none',\n transition: 'none',\n willChange: 'transform, opacity',\n };\n};","import React from 'react';\nimport { AnimationConfig, Particle } from '../types';\nimport { randomInRange, generateId } from '../utils';\n\nconst starColors = ['#FFD700', '#FFA500', '#FF6347', '#FFE4B5'];\n\nexport const createStarParticles = (\n origin: { x: number; y: number },\n config: AnimationConfig\n): Particle[] => {\n const {\n particleCount = 40,\n startVelocity =
|
1
|
+
{"version":3,"file":"stars.js","sources":["../../src/utils.ts","../../src/animations/stars.tsx"],"sourcesContent":["import { Particle } from './types';\n\nexport const randomInRange = (min: number, max: number): number => {\n return Math.random() * (max - min) + min;\n};\n\nexport const degreesToRadians = (degrees: number): number => {\n return (degrees * Math.PI) / 180;\n};\n\nexport const generateId = (): string => {\n return Math.random().toString(36).substring(2, 9);\n};\n\nexport const getRandomColor = (colors: string[]): string => {\n return colors[Math.floor(Math.random() * colors.length)] || colors[0];\n};\n\nexport const createParticleStyle = (\n particle: Particle,\n containerRect: DOMRect\n): React.CSSProperties => {\n return {\n position: 'absolute',\n left: `${particle.x - containerRect.left}px`,\n top: `${particle.y - containerRect.top}px`,\n transform: `rotate(${particle.rotation}deg)`,\n opacity: particle.opacity,\n pointerEvents: 'none',\n transition: 'none',\n willChange: 'transform, opacity',\n };\n};","import React from 'react';\nimport { AnimationConfig, Particle } from '../types';\nimport { randomInRange, generateId } from '../utils';\n\nconst starColors = ['#FFD700', '#FFA500', '#FF6347', '#FFE4B5'];\n\nexport const createStarParticles = (\n origin: { x: number; y: number },\n config: AnimationConfig\n): Particle[] => {\n const {\n particleCount = 40,\n startVelocity = 18,\n colors = starColors,\n elementSize = 30\n } = config;\n\n const particles: Particle[] = [];\n\n for (let i = 0; i < particleCount; i++) {\n const angle = randomInRange(0, 360);\n const velocity = randomInRange(startVelocity * 0.5, startVelocity);\n\n particles.push({\n id: generateId(),\n x: origin.x,\n y: origin.y,\n vx: Math.cos((angle * Math.PI) / 180) * velocity,\n vy: Math.sin((angle * Math.PI) / 180) * velocity - 15,\n life: config.lifetime || 150,\n opacity: 1,\n size: randomInRange(elementSize * 0.5, elementSize * 1.3),\n rotation: randomInRange(0, 360),\n color: colors[Math.floor(Math.random() * colors.length)] || colors[0],\n });\n }\n\n return particles;\n};\n\nexport const renderStarParticle = (particle: Particle): React.ReactNode => {\n return (\n <svg\n key={particle.id}\n width={particle.size}\n height={particle.size}\n viewBox=\"0 0 24 24\"\n fill={particle.color}\n style={{\n filter: `drop-shadow(0 0 ${particle.size * 0.2}px ${particle.color})`,\n }}\n >\n <path d=\"M12,17.27L18.18,21L16.54,13.97L22,9.24L14.81,8.62L12,2L9.19,8.62L2,9.24L7.45,13.97L5.82,21L12,17.27Z\" />\n </svg>\n );\n};"],"names":[],"mappings":";;;;AAEO,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,GAAW,KAAY;AAChE,IAAA,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG;AAC1C,CAAC;AAMM,MAAM,UAAU,GAAG,MAAa;AACrC,IAAA,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;AACnD,CAAC;;ACRD,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;MAElD,mBAAmB,GAAG,CACjC,MAAgC,EAChC,MAAuB,KACT;AACd,IAAA,MAAM,EACJ,aAAa,GAAG,EAAE,EAClB,aAAa,GAAG,EAAE,EAClB,MAAM,GAAG,UAAU,EACnB,WAAW,GAAG,EAAE,EACjB,GAAG,MAAM;IAEV,MAAM,SAAS,GAAe,EAAE;AAEhC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,a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,KAAK,EAAE;YACL,MAAM,EAAE,CAAmB,gBAAA,EAAA,QAAQ,CAAC,IAAI,GAAG,GAAG,CAAM,GAAA,EAAA,QAAQ,CAAC,KAAK,CAAG,CAAA,CAAA;AACtE,SAAA,EAAA;AAED,QAAA,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAM,CAAC,EAAC,sGAAsG,EAAG,CAAA,CAC7G;AAEV;;;;;"}
|
@@ -26,7 +26,7 @@ export interface AnimationConfig {
|
|
26
26
|
friction?: number;
|
27
27
|
};
|
28
28
|
}
|
29
|
-
export type AnimationType = 'confetti' | 'sparkles' | 'fireworks' | 'hearts' | 'stars' | 'bubbles';
|
29
|
+
export type AnimationType = 'confetti' | 'sparkles' | 'fireworks' | 'hearts' | 'stars' | 'bubbles' | 'snow' | 'emoji' | 'coins' | 'lightning' | 'petals' | 'aurora' | 'fireflies' | 'paint' | 'music' | 'balloons' | 'galaxy';
|
30
30
|
export interface UseRewardConfig extends AnimationConfig {
|
31
31
|
animationType: AnimationType;
|
32
32
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAA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,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,UAAU,GACV,WAAW,GACX,QAAQ,GACR,OAAO,GACP,SAAS,GACT,MAAM,GACN,OAAO,GACP,OAAO,GACP,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,WAAW,GACX,OAAO,GACP,OAAO,GACP,UAAU,GACV,QAAQ,CAAC;AAEb,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,aAAa,EAAE,aAAa,CAAC;CAC9B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useReward.d.ts","sourceRoot":"","sources":["../src/useReward.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAY,MAAM,SAAS,CAAC;AAInE,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,SAAS,GACpB,WAAW,MAAM,EACjB,eAAe,aAAa,EAC5B,SAAS,eAAe,KACvB,
|
1
|
+
{"version":3,"file":"useReward.d.ts","sourceRoot":"","sources":["../src/useReward.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAY,MAAM,SAAS,CAAC;AAInE,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,SAAS,GACpB,WAAW,MAAM,EACjB,eAAe,aAAa,EAC5B,SAAS,eAAe,KACvB,eAkJF,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|