festive-effects 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.
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Union type of all supported festival effects
3
+ */
4
+ export type FestivalType = 'christmas' | 'newyear' | 'valentine' | 'easter' | 'halloween' | 'thanksgiving' | 'diwali' | 'chinesenewyear' | 'holi' | 'eid' | 'stpatricks' | 'independence';
5
+ /**
6
+ * Array of all valid festival types for validation
7
+ */
8
+ export declare const FESTIVAL_TYPES: FestivalType[];
9
+ /**
10
+ * Intensity levels for particle effects
11
+ */
12
+ export type IntensityLevel = 'low' | 'medium' | 'high';
13
+ /**
14
+ * Props for the main FestiveEffects component
15
+ */
16
+ export interface FestiveEffectsProps {
17
+ /** The festival effect to display */
18
+ festival: FestivalType;
19
+ /** Intensity of the effect (particle count) */
20
+ intensity?: IntensityLevel;
21
+ /** Duration in milliseconds before effect stops */
22
+ duration?: number;
23
+ /** CSS z-index for the overlay */
24
+ zIndex?: number;
25
+ /** Whether to respect prefers-reduced-motion setting */
26
+ respectReducedMotion?: boolean;
27
+ /** Custom colors to override default festival colors */
28
+ colors?: string[];
29
+ }
30
+ /**
31
+ * Settings for each intensity level
32
+ */
33
+ export interface IntensitySettings {
34
+ /** Multiplier for base particle count */
35
+ particleMultiplier: number;
36
+ /** Maximum number of particles allowed */
37
+ maxParticles: number;
38
+ }
39
+ /**
40
+ * Physics configuration for particle animations
41
+ */
42
+ export interface PhysicsConfig {
43
+ /** Base animation speed */
44
+ speed: number;
45
+ /** Horizontal drift amount in pixels */
46
+ drift: number;
47
+ /** Rotation amount in degrees */
48
+ rotation: number;
49
+ /** Min/max scale range */
50
+ scale: [number, number];
51
+ }
52
+ /**
53
+ * All particle types available for effects
54
+ */
55
+ export type ParticleType = 'snowflake' | 'firework' | 'confetti' | 'spark' | 'heart' | 'egg' | 'flower' | 'bat' | 'pumpkin' | 'spider' | 'leaf' | 'diya' | 'rangoli' | 'lantern' | 'dragon' | 'color-splash' | 'moon' | 'star' | 'shamrock' | 'rainbow';
56
+ /**
57
+ * Animation types for particle effects
58
+ */
59
+ export type AnimationType = 'fall' | 'rise' | 'explode' | 'float' | 'scatter';
60
+ /**
61
+ * Configuration for a festival effect
62
+ */
63
+ export interface FestivalConfig {
64
+ /** Base number of particles before intensity multiplier */
65
+ baseParticleCount: number;
66
+ /** Color palette for the effect */
67
+ colors: string[];
68
+ /** Types of particles used in this effect */
69
+ particleTypes: ParticleType[];
70
+ /** Primary animation type */
71
+ animationType: AnimationType;
72
+ /** Physics settings for animations */
73
+ physics: PhysicsConfig;
74
+ }
75
+ /**
76
+ * Viewport dimensions
77
+ */
78
+ export interface Viewport {
79
+ width: number;
80
+ height: number;
81
+ }
82
+ /**
83
+ * Data for a single particle instance
84
+ */
85
+ export interface ParticleData {
86
+ /** Unique identifier */
87
+ id: string;
88
+ /** Initial X position */
89
+ x: number;
90
+ /** Initial Y position */
91
+ y: number;
92
+ /** Particle size in pixels */
93
+ size: number;
94
+ /** Particle color */
95
+ color: string;
96
+ /** Type of particle shape */
97
+ type: ParticleType;
98
+ /** Animation delay in seconds */
99
+ delay: number;
100
+ /** Animation duration in seconds */
101
+ duration: number;
102
+ /** Additional custom properties for animation */
103
+ custom: Record<string, unknown>;
104
+ }
105
+ /**
106
+ * Framer Motion animation configuration
107
+ */
108
+ export interface AnimationConfig {
109
+ /** Animation target values */
110
+ animate: {
111
+ x?: number | number[];
112
+ y?: number | number[];
113
+ rotate?: number | number[];
114
+ scale?: number | number[];
115
+ opacity?: number | number[];
116
+ };
117
+ /** Transition settings */
118
+ transition: {
119
+ duration: number;
120
+ ease?: string | number[];
121
+ repeat?: number;
122
+ repeatType?: 'loop' | 'reverse' | 'mirror';
123
+ delay?: number;
124
+ };
125
+ }
126
+ /**
127
+ * Props for individual particle components
128
+ */
129
+ export interface ParticleProps {
130
+ /** Unique identifier */
131
+ id: string;
132
+ /** Initial X position */
133
+ initialX: number;
134
+ /** Initial Y position */
135
+ initialY: number;
136
+ /** Particle size */
137
+ size: number;
138
+ /** Particle color */
139
+ color: string;
140
+ /** Type of particle */
141
+ type: ParticleType;
142
+ /** Animation configuration */
143
+ animationConfig: AnimationConfig;
144
+ }
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "festive-effects",
3
+ "version": "1.0.0",
4
+ "description": "A React component library for festival-themed visual effects using Framer Motion",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.esm.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.esm.js",
13
+ "require": "./dist/index.js"
14
+ }
15
+ },
16
+ "sideEffects": false,
17
+ "files": [
18
+ "dist",
19
+ "README.md"
20
+ ],
21
+ "scripts": {
22
+ "build": "rollup -c",
23
+ "dev": "rollup -c -w",
24
+ "test": "jest",
25
+ "test:coverage": "jest --coverage",
26
+ "lint": "eslint src --ext .ts,.tsx",
27
+ "prepublishOnly": "npm run build"
28
+ },
29
+ "keywords": [
30
+ "react",
31
+ "festive",
32
+ "effects",
33
+ "animations",
34
+ "framer-motion",
35
+ "christmas",
36
+ "halloween",
37
+ "diwali",
38
+ "particles",
39
+ "celebration",
40
+ "holiday",
41
+ "visual-effects",
42
+ "overlay"
43
+ ],
44
+ "author": "",
45
+ "license": "MIT",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": ""
49
+ },
50
+ "bugs": {
51
+ "url": ""
52
+ },
53
+ "homepage": "",
54
+ "peerDependencies": {
55
+ "react": ">=17.0.0 <20.0.0",
56
+ "react-dom": ">=17.0.0 <20.0.0",
57
+ "framer-motion": ">=10.0.0 <12.0.0"
58
+ },
59
+ "peerDependenciesMeta": {
60
+ "react-dom": {
61
+ "optional": false
62
+ }
63
+ },
64
+ "devDependencies": {
65
+ "@rollup/plugin-commonjs": "^25.0.7",
66
+ "@rollup/plugin-node-resolve": "^15.2.3",
67
+ "@rollup/plugin-typescript": "^11.1.6",
68
+ "@testing-library/jest-dom": "^6.4.2",
69
+ "@testing-library/react": "^14.2.1",
70
+ "@types/jest": "^29.5.12",
71
+ "@types/react": "^18.2.64",
72
+ "@types/react-dom": "^18.2.21",
73
+ "fast-check": "^3.15.1",
74
+ "framer-motion": "^11.0.8",
75
+ "jest": "^29.7.0",
76
+ "jest-environment-jsdom": "^29.7.0",
77
+ "react": "^18.2.0",
78
+ "react-dom": "^18.2.0",
79
+ "rollup": "^4.12.1",
80
+ "rollup-plugin-dts": "^6.1.0",
81
+ "rollup-plugin-peer-deps-external": "^2.2.4",
82
+ "ts-jest": "^29.1.2",
83
+ "typescript": "^5.4.2"
84
+ }
85
+ }