/** * PhysicsConfettiEngine - Advanced physics-driven confetti using hexgrid-3d math * * This engine creates genuinely clever confetti effects: * - Fluid dynamics: Particles follow Navier-Stokes flow, swirling naturally * - Attractors: Particles orbit around celebration points * - Flow fields: Streamlines create artistic motion patterns * - Emergence: Complex behavior from simple rules * - Biometric sync: Optional heart-rate driven pulse effects * * Uses the math infrastructure from hexgrid-3d for real physics simulation. */ /** Configuration for physics celebration effects */ interface PhysicsCelebrationConfig { /** Celebration type - determines behavior */ type: PhysicsCelebrationType; /** Origin point (normalized 0-1) */ origin?: { x: number; y: number; }; /** Number of particles */ count?: number; /** Color palette */ colors?: string[]; /** Intensity multiplier (0-1) */ intensity?: number; /** Optional heart rate for biometric sync */ heartRate?: number; /** Emotion context for color/behavior adaptation */ emotionContext?: { valence: number; arousal: number; dominantEmotion?: string; }; } /** Physics-based celebration types */ type PhysicsCelebrationType = 'vortex' | 'supernova' | 'aurora' | 'resonance' | 'orbit' | 'cascade' | 'emergence' | 'harmony' | 'helix' | 'bloom' | 'constellation' | 'nebula'; /** Default brand colors */ declare const BRAND_COLORS: { emerald: string[]; teal: string[]; gold: string[]; rose: string[]; purple: string[]; sky: string[]; }; /** * PhysicsConfettiEngine - The brain behind clever celebrations */ declare class PhysicsConfettiEngine { private canvas; private ctx; private particles; private attractors; private fluid; private flowField; private animationId; private time; private particleIdCounter; private enabled; private prefersReducedMotion; private gravity; private drag; private fluidInfluence; private trailLength; constructor(); /** Initialize the canvas overlay */ private initCanvas; /** Initialize fluid simulation */ private initFluidSim; /** Handle window resize */ private resize; /** Enable or disable the engine */ setEnabled(enabled: boolean): void; /** Check if enabled */ isEnabled(): boolean; /** * Trigger a physics-based celebration! */ celebrate(config: PhysicsCelebrationConfig): void; /** Vortex - Spiral particles pulling inward like a galaxy */ private createVortex; /** Supernova - Explosive burst with fluid shockwave */ private createSupernova; /** Aurora - Flowing northern lights ribbons */ private createAurora; /** Resonance - Heart-rate synced pulsing particles */ private createResonance; /** Orbit - Multiple bodies with orbiting particles */ private createOrbit; /** Cascade - Fluid waterfall effect */ private createCascade; /** Emergence - Particles following flow field streamlines */ private createEmergence; /** Harmony - Lissajous pattern attractors */ private createHarmony; /** Helix - DNA-like double helix spiral */ private createHelix; /** Bloom - Flower-like unfolding pattern */ private createBloom; /** Constellation - Particles that form and connect with lines */ private createConstellation; /** Nebula - Gas cloud effect with density variations */ private createNebula; /** Add a new particle */ private addParticle; /** Update particle physics */ private updateParticle; /** Render all particles */ private render; /** Draw a single particle */ private drawParticle; /** Draw a star shape */ private drawStar; /** Draw a heart shape */ private drawHeart; /** Draw a hexagon shape */ private drawHexagon; /** Draw a spiral shape */ private drawSpiral; /** Draw lines connecting nearby particles (for constellation effect) */ private drawConstellationLines; /** Main animation loop */ private animate; /** Get color palette for an emotion */ private getColorsForEmotion; /** Clear all particles and effects */ clear(): void; /** Destroy the engine */ destroy(): void; } declare function getPhysicsConfettiEngine(): PhysicsConfettiEngine | null; /** Legacy export for backwards compatibility */ declare const physicsConfettiEngine: PhysicsConfettiEngine | null; /** * ConfettiService - Luxury visual celebrations with particle effects * * Two rendering engines: * 1. canvas-confetti: Classic confetti with simple physics (fallback) * 2. PhysicsConfettiEngine: Advanced fluid dynamics, attractors, flow fields * * Uses the hexgrid-3d math library for genuinely clever physics simulations. */ interface ConfettiOptions { particleCount?: number; angle?: number; spread?: number; startVelocity?: number; decay?: number; gravity?: number; drift?: number; ticks?: number; origin?: { x?: number; y?: number; }; colors?: string[]; shapes?: ('square' | 'circle' | 'star' | Shape)[]; scalar?: number; zIndex?: number; disableForReducedMotion?: boolean; } interface Shape { type: 'path' | 'text'; } type ConfettiType = 'burst' | 'shower' | 'fireworks' | 'sparkles' | 'stars' | 'hearts' | 'achievement' | 'streak' | 'milestone' | 'levelUp' | 'welcome' | 'premium' | 'vortex' | 'supernova' | 'aurora' | 'resonance' | 'orbit' | 'cascade' | 'emergence' | 'harmony' | 'helix' | 'bloom' | 'constellation' | 'nebula'; declare class ConfettiServiceClass { private enabled; private prefersReducedMotion; private preferPhysics; constructor(); /** * Enable or disable confetti globally */ setEnabled(enabled: boolean): void; /** * Enable or disable physics engine preference * When disabled, only canvas-confetti is used */ setPreferPhysics(prefer: boolean): void; /** * Check if confetti is enabled */ isEnabled(): boolean; /** * Check if physics engine is available and preferred */ isPhysicsEnabled(): boolean; /** * Trigger a confetti celebration */ celebrate(type: ConfettiType): void; /** * Trigger a physics-based celebration with full configuration */ celebratePhysics(config: PhysicsCelebrationConfig): void; /** * Trigger emotion-aware celebration * Automatically selects the best celebration type and colors based on emotion context */ celebrateEmotion(config: { emotion: string; intensity?: number; valence?: number; arousal?: number; heartRate?: number; }): void; /** * Fire custom confetti with full options */ custom(options: ConfettiOptions): void; /** * Fire confetti from a specific element's position */ fromElement(element: HTMLElement, type?: ConfettiType): void; /** * Clear all confetti (both engines) */ reset(): void; /** Quick celebration burst */ burst(): void; /** Confetti shower */ shower(): void; /** Fireworks display */ fireworks(): void; /** Gentle sparkles */ sparkles(): void; /** Star celebration */ stars(): void; /** Heart celebration */ hearts(): void; /** Grand achievement celebration */ achievement(): void; /** Streak celebration */ streak(): void; /** Milestone celebration */ milestone(): void; /** Level up celebration */ levelUp(): void; /** Welcome celebration */ welcome(): void; /** Premium upgrade celebration */ premium(): void; /** Spiral vortex pulling particles inward (fluid dynamics) */ vortex(): void; /** Explosive burst with fluid shockwave */ supernova(): void; /** Flowing northern lights ribbons */ aurora(): void; /** Heart-rate synced pulsing particles */ resonance(heartRate?: number): void; /** Multiple orbital attractors */ orbit(): void; /** Fluid waterfall effect */ cascade(): void; /** Particles following flow field */ emergence(): void; /** Lissajous pattern attractors */ harmony(): void; /** DNA-like double helix spiral */ helix(): void; /** Flower-like unfolding pattern */ bloom(): void; /** Particles forming and connecting */ constellation(): void; /** Gas cloud effect with density */ nebula(): void; } declare const ConfettiService: ConfettiServiceClass; /** * HapticService - Luxury haptic feedback using the Web Vibration API * * Provides tactile feedback patterns for different user interactions and celebrations. * Falls back gracefully on devices that don't support vibration. * * @see https://developer.mozilla.org/en-US/docs/Web/API/Vibration_API */ type HapticPattern = 'tap' | 'doubleTap' | 'success' | 'celebration' | 'milestone' | 'streak' | 'warning' | 'error' | 'heartbeat' | 'breatheIn' | 'breatheOut' | 'selection' | 'notification' | 'unlock' | 'levelUp'; type HapticIntensity = 'light' | 'medium' | 'strong'; declare class HapticServiceClass { private enabled; private supported; constructor(); /** * Check if haptic feedback is available on this device */ isSupported(): boolean; /** * Enable or disable haptic feedback globally */ setEnabled(enabled: boolean): void; /** * Check if haptic feedback is currently enabled */ isEnabled(): boolean; /** * Apply intensity multiplier to a pattern */ private applyIntensity; /** * Trigger a haptic pattern */ vibrate(pattern: HapticPattern, intensity?: HapticIntensity): boolean; /** * Trigger a custom vibration pattern */ vibrateCustom(pattern: number | number[]): boolean; /** * Stop any ongoing vibration */ stop(): boolean; /** Light tap for button presses */ tap(intensity?: HapticIntensity): boolean; /** Selection feedback */ select(intensity?: HapticIntensity): boolean; /** Success feedback - task completed */ success(intensity?: HapticIntensity): boolean; /** Celebration - major achievement */ celebrate(intensity?: HapticIntensity): boolean; /** Milestone reached */ milestone(intensity?: HapticIntensity): boolean; /** Streak continuation */ streak(intensity?: HapticIntensity): boolean; /** Warning feedback */ warn(intensity?: HapticIntensity): boolean; /** Error feedback */ error(intensity?: HapticIntensity): boolean; /** Notification received */ notify(intensity?: HapticIntensity): boolean; /** Feature unlocked */ unlock(intensity?: HapticIntensity): boolean; /** Level up / upgrade */ levelUp(intensity?: HapticIntensity): boolean; /** Calming heartbeat for relaxation */ heartbeat(intensity?: HapticIntensity): boolean; /** Breathing exercise - inhale */ breatheIn(intensity?: HapticIntensity): boolean; /** Breathing exercise - exhale */ breatheOut(intensity?: HapticIntensity): boolean; /** * Breathing cycle - vibrates in sync with breath timing * @param inhaleMs - Duration of inhale in milliseconds * @param holdMs - Duration of hold in milliseconds * @param exhaleMs - Duration of exhale in milliseconds */ breathingCycle(inhaleMs: number, holdMs: number, exhaleMs: number): void; } declare const HapticService: HapticServiceClass; /** * SoundService - Luxury audio feedback for celebrations and interactions * * Uses Web Audio API to generate pleasant tones. * Designed for emotional wellness - sounds are calming, satisfying, and non-jarring. */ type SoundType = 'tap' | 'success' | 'celebration' | 'milestone' | 'streak' | 'levelUp' | 'unlock' | 'notification' | 'complete' | 'breatheIn' | 'breatheOut' | 'heartbeat' | 'error' | 'warning'; type SoundConfig = { frequencies: number[]; durations: number[]; type: OscillatorType; volume: number; delay?: number[]; envelope?: { attack: number; decay: number; sustain: number; release: number; }; }; declare class SoundServiceClass { private audioContext; private enabled; private volume; private supported; constructor(); /** * Initialize audio context (must be called after user interaction) */ private getAudioContext; /** * Check if sound is supported */ isSupported(): boolean; /** * Enable or disable sound globally */ setEnabled(enabled: boolean): void; /** * Check if sound is enabled */ isEnabled(): boolean; /** * Set master volume (0-1) */ setVolume(volume: number): void; /** * Get current master volume */ getVolume(): number; /** * Play a note with envelope */ private playNote; /** * Play a sound by type */ play(type: SoundType): void; /** Soft tap sound */ tap(): void; /** Success chime */ success(): void; /** Celebration fanfare */ celebrate(): void; /** Milestone achievement */ milestone(): void; /** Streak sound */ streak(): void; /** Level up sound */ levelUp(): void; /** Unlock sound */ unlock(): void; /** Notification sound */ notify(): void; /** Complete sound */ complete(): void; /** Breathing - inhale */ breatheIn(): void; /** Breathing - exhale */ breatheOut(): void; /** Heartbeat */ heartbeat(): void; /** Error sound */ error(): void; /** Warning sound */ warn(): void; /** * Play a custom frequency pattern */ playCustom(frequencies: number[], durations: number[], options?: Partial): void; } declare const SoundService: SoundServiceClass; /** * CelebrationService - Unified orchestrator for luxury celebrations * * Combines confetti, sound, and haptic feedback for immersive celebrations. * Designed for emotional wellness - celebrations feel rewarding, not overwhelming. */ type CelebrationType = 'tap' | 'success' | 'complete' | 'achievement' | 'milestone' | 'streak' | 'streakMilestone' | 'levelUp' | 'unlock' | 'premium' | 'welcome' | 'breathingComplete' | 'journalSaved' | 'reflectionComplete' | 'dailyCheckIn' | 'weeklyReview' | 'error' | 'warning' | 'radiance'; interface CelebrationConfig { confetti?: ConfettiType | null; sound?: SoundType | null; haptic?: HapticPattern | null; hapticIntensity?: HapticIntensity; delay?: number; } declare class CelebrationServiceClass { private initialized; constructor(); /** * Load user preferences from localStorage */ private loadPreferences; /** * Save user preferences to localStorage */ private savePreferences; /** * Trigger a celebration by type */ celebrate(type: CelebrationType): void; /** * Trigger a custom celebration */ custom(config: CelebrationConfig): void; /** * Celebrate a streak milestone */ celebrateStreak(days: number): void; /** * Enable/disable sound effects */ setSoundEnabled(enabled: boolean): void; /** * Enable/disable haptic feedback */ setHapticEnabled(enabled: boolean): void; /** * Enable/disable confetti */ setConfettiEnabled(enabled: boolean): void; /** * Set master volume (0-1) */ setVolume(volume: number): void; /** * Get current settings */ getSettings(): { soundEnabled: boolean; hapticEnabled: boolean; confettiEnabled: boolean; volume: number; hapticSupported: boolean; soundSupported: boolean; }; /** * Enable all celebration features */ enableAll(): void; /** * Disable all celebration features */ disableAll(): void; /** Light tap feedback */ tap(): void; /** Success feedback */ success(): void; /** Completion celebration */ complete(): void; /** Achievement unlocked */ achievement(): void; /** Milestone reached */ milestone(): void; /** Level up celebration */ levelUp(): void; /** Feature unlocked */ unlock(): void; /** Premium upgrade celebration */ premium(): void; /** Welcome celebration */ welcome(): void; /** Error feedback */ error(): void; /** Warning feedback */ warning(): void; /** * Ultimate Radiance celebration - multi-phase sequence for Golden Ticket acceptance * Phase 1 (0-2s): Supernova explosion with strong haptic * Phase 2 (2-5s): Aurora flowing ribbons * Phase 3 (5-8s): Constellation pattern forming radiance symbol * * @param onPhaseChange - Optional callback for UI to sync with phases */ celebrateRadiance(onPhaseChange?: (phase: number, name: string) => void): void; /** Radiance / Hall of Fame induction celebration */ radiance(): void; } declare const CelebrationService: CelebrationServiceClass; export { BRAND_COLORS, type CelebrationConfig, CelebrationService, type CelebrationType, ConfettiService, type ConfettiType, type HapticIntensity, type HapticPattern, HapticService, type PhysicsCelebrationConfig, type PhysicsCelebrationType, PhysicsConfettiEngine, SoundService, type SoundType, getPhysicsConfettiEngine, physicsConfettiEngine };