easter-egg-quest 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,67 @@
1
+ import type { ResolvedConfig, NarrativeScript } from './types';
2
+ /**
3
+ * GameController — orchestrates the entire Easter Egg Quest experience.
4
+ *
5
+ * Manages the lifecycle: initialization → hidden entry → 3 stages → finale → results.
6
+ * Coordinates between renderers, input tracker, stage logic, and scoring.
7
+ */
8
+ export declare class GameController {
9
+ private config;
10
+ private script;
11
+ private bus;
12
+ private fsm;
13
+ private input;
14
+ private scoring;
15
+ private persistence;
16
+ private hiddenEntry;
17
+ private narrative;
18
+ private hud;
19
+ private shrine;
20
+ private threeRenderer;
21
+ private fallbackRenderer;
22
+ private overlay;
23
+ private results;
24
+ private eggRenderer;
25
+ private activeStage;
26
+ private pageReactor;
27
+ private _lastPageReactTime;
28
+ private _lastReactProgress;
29
+ private pageBreather;
30
+ private state;
31
+ private _updateRaf;
32
+ private _running;
33
+ private _destroyed;
34
+ private _onPageHide;
35
+ constructor(config: ResolvedConfig, script: NarrativeScript);
36
+ init(): Promise<void>;
37
+ pause(): void;
38
+ resume(): void;
39
+ restart(): Promise<void>;
40
+ destroy(): void;
41
+ private _handlePageClose;
42
+ private _onTransition;
43
+ private _saveCheckpoint;
44
+ private _resumeFromCheckpoint;
45
+ private _startEntry;
46
+ private _onEntryFound;
47
+ private _tremorStyle;
48
+ private _tremorClass;
49
+ private _startAnticipationTremor;
50
+ private _stopAnticipationTremor;
51
+ private _startStage1;
52
+ private _startStage2;
53
+ private _startStage3;
54
+ private _startGameLoop;
55
+ private _lastFrameTime;
56
+ private _gameLoop;
57
+ private _handleEggReveal;
58
+ private _handleStageSuccess;
59
+ private _onShrineEggClick;
60
+ private _onEggLongPressCollect;
61
+ private _handleStageProgress;
62
+ private _startFinale;
63
+ private _showResults;
64
+ private _initEggRenderer;
65
+ private _cleanup;
66
+ private _wait;
67
+ }
@@ -0,0 +1,5 @@
1
+ import type { EasterEggQuestConfig, ResolvedConfig, NarrativeScript } from './types';
2
+ export declare const DANGEROUS_KEYWORDS: string[];
3
+ export declare const DEFAULT_EXCLUDE_SELECTORS: string[];
4
+ export declare function resolveConfig(raw?: EasterEggQuestConfig): ResolvedConfig;
5
+ export declare function resolveNarrative(overrides?: Partial<NarrativeScript>): NarrativeScript;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Minimal typed event bus for internal library communication.
3
+ * Not exposed to integrators — they use config.callbacks instead.
4
+ */
5
+ export declare class EventBus {
6
+ private listeners;
7
+ on(event: string, fn: (...args: any[]) => void): void;
8
+ off(event: string, fn: (...args: any[]) => void): void;
9
+ emit(event: string, ...args: any[]): void;
10
+ clear(): void;
11
+ }
@@ -0,0 +1,22 @@
1
+ import type { GameStage } from '../types';
2
+ /**
3
+ * Finite state machine governing the game's stage progression.
4
+ * Transitions are strictly defined — invalid transitions are rejected.
5
+ */
6
+ type TransitionCallback = (from: GameStage, to: GameStage) => void;
7
+ export declare class StateMachine {
8
+ private _state;
9
+ private _onTransition;
10
+ get state(): GameStage;
11
+ /** Register a callback invoked on every valid transition. */
12
+ onTransition(cb: TransitionCallback): void;
13
+ /** Attempt a transition. Returns true if valid, false otherwise. */
14
+ transitionTo(next: GameStage): boolean;
15
+ /** Force-reset to idle (used for restart / destroy). */
16
+ reset(): void;
17
+ /** Force state to a specific value (used for resuming from checkpoint). */
18
+ forceState(state: GameStage): void;
19
+ /** Human-readable label for the current stage. */
20
+ get label(): string;
21
+ }
22
+ export {};
@@ -0,0 +1,43 @@
1
+ import type { NarrativeScript, ResolvedConfig } from "../types";
2
+ /**
3
+ * Stage 0: Hidden Entry system.
4
+ *
5
+ * Two strategies, randomly chosen:
6
+ * 1. "Possess" — picks an existing safe element and enchants it with shimmer
7
+ * 2. "Disguise" — injects a camouflaged fake element styled to look like
8
+ * a neighboring button/link/nav item on the page
9
+ *
10
+ * Escalating narrative hints guide the user toward noticing it.
11
+ * Clicking triggers the game.
12
+ */
13
+ export declare class HiddenEntry {
14
+ private config;
15
+ private script;
16
+ private onFound;
17
+ private targetElement;
18
+ private hintTimers;
19
+ private hintIndex;
20
+ private hintContainer;
21
+ private shimmerStyle;
22
+ private clickHandler;
23
+ private fallbackButton;
24
+ private _injectedElement;
25
+ private _destroyed;
26
+ constructor(config: ResolvedConfig, script: NarrativeScript, onFound: () => void);
27
+ start(): void;
28
+ cleanup(): void;
29
+ private _possessElement;
30
+ private _injectIntoExisting;
31
+ /**
32
+ * Try to insert the trigger span between words inside a text node.
33
+ * Picks a random word boundary in the element's first direct text node.
34
+ * Returns true if inserted without layout shift.
35
+ */
36
+ private _tryInsertBetweenWords;
37
+ private _attachToElement;
38
+ private _startHintEscalation;
39
+ private _showHint;
40
+ private _createHintContainer;
41
+ private _injectShimmerStyles;
42
+ private _createFallbackEntry;
43
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Easter Egg Quest — Public API
3
+ *
4
+ * This is the main entry point for both npm and CDN usage.
5
+ *
6
+ * npm:
7
+ * import { EasterEggQuest } from 'easter-egg-quest';
8
+ * EasterEggQuest.init({ ... });
9
+ *
10
+ * CDN:
11
+ * <script src="easter-egg-quest.umd.js"></script>
12
+ * <script> EasterEggQuest.init({ ... }); </script>
13
+ */
14
+ import type { EasterEggQuestConfig, FinalScore, LeaderboardAdapter, LeaderboardEntry } from './types';
15
+ export declare const EasterEggQuest: {
16
+ /**
17
+ * Initialize and start the Easter Egg Quest experience.
18
+ * Safe to call multiple times — destroys any previous instance first.
19
+ */
20
+ init(config?: EasterEggQuestConfig): Promise<void>;
21
+ /** Pause the game. */
22
+ pause(): void;
23
+ /** Resume the game. */
24
+ resume(): void;
25
+ /** Restart from the beginning. */
26
+ restart(): Promise<void>;
27
+ /** Destroy the instance, remove all overlays, restore DOM. */
28
+ destroy(): void;
29
+ };
30
+ export type { EasterEggQuestConfig, FinalScore, LeaderboardAdapter, LeaderboardEntry, };
@@ -0,0 +1,55 @@
1
+ import type { InputSnapshot, MovementPhase } from '../types';
2
+ /**
3
+ * Tracks all user input — mouse, touch, keyboard, scroll — and provides
4
+ * a real-time snapshot plus movement-phase history for rhythm analysis.
5
+ *
6
+ * Designed to be non-intrusive: uses passive listeners and never
7
+ * prevents default on host-page events.
8
+ */
9
+ export declare class InputTracker {
10
+ private _snapshot;
11
+ /** Completed move/still phases for rhythm analysis. */
12
+ private _phases;
13
+ /** Current phase tracking. */
14
+ private _currentPhaseType;
15
+ private _currentPhaseStart;
16
+ /** Movement velocity tracking. */
17
+ private _prevX;
18
+ private _prevY;
19
+ private _prevMoveTs;
20
+ /** How long without movement before we consider user "still". */
21
+ private readonly STILL_THRESHOLD_MS;
22
+ /** Minimum phase duration to record (ignore micro-jitter). */
23
+ private readonly MIN_PHASE_MS;
24
+ /** Timer for detecting stillness transitions. */
25
+ private _stillTimer;
26
+ /** Bound handlers (for clean removal). */
27
+ private _handlers;
28
+ private _active;
29
+ get snapshot(): InputSnapshot;
30
+ get phases(): MovementPhase[];
31
+ /** How long the user has been continuously still (ms). Returns 0 if moving. */
32
+ get stillDuration(): number;
33
+ /** How long the user has been continuously moving (ms). Returns 0 if still. */
34
+ get moveDuration(): number;
35
+ /** Time since any recorded activity. */
36
+ get timeSinceLastActivity(): number;
37
+ start(): void;
38
+ stop(): void;
39
+ /** Reset phase history (e.g., between stages). */
40
+ resetPhases(): void;
41
+ resetCounts(): void;
42
+ /** Page hidden/visible — reset stillness so off-tab time doesn't count. */
43
+ private _onVisibilityChange;
44
+ /** Window blur (alt-tab, click outside) — same reset. */
45
+ private _onWindowBlur;
46
+ private _onPointerMove;
47
+ private _onTouchMove;
48
+ private _onClick;
49
+ private _onActivity;
50
+ private _onScroll;
51
+ private _onKeyDown;
52
+ private _registerMove;
53
+ private _becomeStill;
54
+ private _completePhase;
55
+ }
@@ -0,0 +1,7 @@
1
+ import type { NarrativeScript } from '../types';
2
+ /**
3
+ * Default narrative script. All lines are in English.
4
+ * Every array is sequenced: lines are shown one after another with pauses.
5
+ * Integrators can override any key via config.narrative.
6
+ */
7
+ export declare const DEFAULT_SCRIPT: NarrativeScript;
@@ -0,0 +1,27 @@
1
+ import type { ResolvedConfig } from '../types';
2
+ /**
3
+ * FallbackRenderer — CSS-based 2D egg rendering when Three.js is unavailable.
4
+ *
5
+ * Uses CSS gradients, pseudo-elements, and transforms to create stylized
6
+ * egg shapes with animations. Not as premium as Three.js but graceful.
7
+ */
8
+ export declare class FallbackRenderer {
9
+ private config;
10
+ private host;
11
+ private shadow;
12
+ private container;
13
+ private eggs;
14
+ private _finaleActive;
15
+ constructor(config: ResolvedConfig);
16
+ init(): Promise<boolean>;
17
+ startRenderLoop(): void;
18
+ stopRenderLoop(): void;
19
+ revealEgg(index: number): void;
20
+ collectEgg(index: number): void;
21
+ addTrail(x: number, y: number, _velocity: number): void;
22
+ startFinale(): void;
23
+ setBreathIntensity(_intensity: number): void;
24
+ setOverlayIntensity(_progress: number): void;
25
+ destroy(): void;
26
+ private _getStyles;
27
+ }
@@ -0,0 +1,28 @@
1
+ import type { ResolvedConfig, GameState } from '../types';
2
+ /**
3
+ * Minimal HUD showing eggs found, elapsed time, and current stage.
4
+ * Rendered inside a Shadow DOM host for style isolation.
5
+ */
6
+ export declare class HUDRenderer {
7
+ private config;
8
+ private host;
9
+ private shadow;
10
+ private eggsEl;
11
+ private timeEl;
12
+ private stageEl;
13
+ private _timerInterval;
14
+ private _startTime;
15
+ private _paused;
16
+ private _pauseOffset;
17
+ constructor(config: ResolvedConfig);
18
+ mount(): void;
19
+ startTimer(): void;
20
+ pause(): void;
21
+ resume(): void;
22
+ /** Update displayed values. */
23
+ update(state: GameState, stageLabel: string): void;
24
+ /** Briefly flash an egg-found notification. */
25
+ flashEggFound(index: number): void;
26
+ destroy(): void;
27
+ private _getStyles;
28
+ }
@@ -0,0 +1,29 @@
1
+ import type { ResolvedConfig } from '../types';
2
+ /**
3
+ * Renders poetic narrative text as floating, fading overlays.
4
+ *
5
+ * Text appears by fading in with a slight blur resolve and gentle upward drift.
6
+ * Each new line replaces the previous after a graceful transition.
7
+ * All elements are injected into a Shadow DOM host to isolate styles.
8
+ */
9
+ export declare class NarrativeRenderer {
10
+ private config;
11
+ private host;
12
+ private shadow;
13
+ private container;
14
+ private currentLine;
15
+ private clearTimer;
16
+ constructor(config: ResolvedConfig);
17
+ mount(): void;
18
+ /** Show a single narrative line. Fades in, replaces any previous line. */
19
+ showLine(text: string, className?: string): void;
20
+ /** Show a sequence of lines with pauses. */
21
+ showSequence(lines: string[], pauseMs?: number): Promise<void>;
22
+ /** Show a celebratory line with golden styling. */
23
+ showCelebration(text: string): void;
24
+ /** Clear current narrative text. */
25
+ clear(): void;
26
+ /** Remove all DOM. */
27
+ destroy(): void;
28
+ private _getStyles;
29
+ }
@@ -0,0 +1,20 @@
1
+ import type { ResolvedConfig } from '../types';
2
+ /**
3
+ * OverlayManager — manages the semi-transparent backdrop layer
4
+ * that sits between the host site and the game UI. Controls dim,
5
+ * blur, and vignette effects during gameplay.
6
+ */
7
+ export declare class OverlayManager {
8
+ private config;
9
+ private overlay;
10
+ private _visible;
11
+ constructor(config: ResolvedConfig);
12
+ mount(): void;
13
+ /** Fade in the overlay. */
14
+ show(): void;
15
+ /** Adjust overlay intensity for visual softening (0–1). */
16
+ setIntensity(progress: number): void;
17
+ /** Fade out the overlay. */
18
+ hide(): void;
19
+ destroy(): void;
20
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * PageBreather — guides the user to find a move/pause rhythm.
3
+ *
4
+ * A vignette overlay pulses on its own steady cycle (~6s):
5
+ * - "move" half: vignette fades away (bright = move!)
6
+ * - "pause" half: vignette darkens edges (dark = be still!)
7
+ *
8
+ * When the user syncs with the rhythm, the effect intensifies as positive feedback
9
+ * and `inSync` becomes true (checked via `isInSync()`).
10
+ */
11
+ export declare class PageBreather {
12
+ private _active;
13
+ private _intensity;
14
+ private _targetIntensity;
15
+ private _rafId;
16
+ private _overlay;
17
+ private _startTime;
18
+ private _isUserMoving;
19
+ private _inSync;
20
+ /** Full breath cycle duration in ms (move half + pause half). */
21
+ private readonly CYCLE_MS;
22
+ start(): void;
23
+ update(accuracy: number, isMoving: boolean): void;
24
+ /** Whether the user is currently in sync with the breathing rhythm. */
25
+ isInSync(): boolean;
26
+ stop(): void;
27
+ destroy(): void;
28
+ private _tick;
29
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * PageReactor — subtly animates real page elements as positive feedback.
3
+ *
4
+ * When the user is on the right track (progress increasing), nearby page
5
+ * elements react with gentle pulses, glows, and lifts — creating the feeling
6
+ * that the world around them is responding.
7
+ */
8
+ export declare class PageReactor {
9
+ private _styleEl;
10
+ private _reactClass;
11
+ constructor();
12
+ /** Trigger a reaction wave on 2-4 random visible page elements. */
13
+ react(): void;
14
+ destroy(): void;
15
+ private _findCandidates;
16
+ private _pickRandom;
17
+ private _injectStyles;
18
+ }
@@ -0,0 +1,41 @@
1
+ import type { ResolvedConfig } from '../types';
2
+ import type { FinalScore } from '../types';
3
+ /**
4
+ * ResultsRenderer — premium results card with type-accurate egg tray.
5
+ * Eggs match their 3D counterparts: silver (polka dots), gold (ornate), festive (enamel).
6
+ * Unfound eggs shown as elegant dashed outlines.
7
+ */
8
+ export declare class ResultsRenderer {
9
+ private config;
10
+ private host;
11
+ private shadow;
12
+ private _onFinish;
13
+ /** Egg type palettes matching ThreeRenderer textures. */
14
+ private static readonly EGG_PALETTES;
15
+ constructor(config: ResolvedConfig);
16
+ show(score: FinalScore, onFinish: () => void): void;
17
+ destroy(): void;
18
+ private _buildContent;
19
+ private _makeRand;
20
+ /** Draw a type-accurate egg on canvas. eggIdx: 0=silver, 1=gold, 2=festive. */
21
+ private _drawTypedEgg2D;
22
+ /** Egg path helper — builds egg-shaped path. */
23
+ private _eggPath;
24
+ /** Dashed or solid egg outline. */
25
+ private _drawEggOutline;
26
+ /** Specular highlight on top-left of egg. */
27
+ private _drawSpecular;
28
+ /** Silver egg — cool chrome gradient with white polka dots and metallic sheen. */
29
+ private _paintSilverEgg;
30
+ /** Gold egg — warm yellow gradient, horizontal ornate bands, diamond lattice. */
31
+ private _paintGoldEgg;
32
+ /** Festive Fabergé egg — seeded enamel bands + golden dividers + gem dots. */
33
+ private _paintFestiveEgg;
34
+ private _copyShareImage;
35
+ private _downloadBlob;
36
+ private _renderCard;
37
+ private _roundRect;
38
+ private _flashButton;
39
+ private _escapeHtml;
40
+ private _getStyles;
41
+ }
@@ -0,0 +1,32 @@
1
+ import type { ResolvedConfig } from '../types';
2
+ /**
3
+ * Shrine / Trophy area — shows 3 egg slots.
4
+ * Found eggs appear filled, uncollected ones show as outline placeholders.
5
+ * Active (just-found) egg can pulse before click-to-continue.
6
+ *
7
+ * Rendered inside a Shadow DOM host for style isolation.
8
+ */
9
+ export declare class ShrineRenderer {
10
+ private config;
11
+ private host;
12
+ private shadow;
13
+ private slots;
14
+ private _activeSlot;
15
+ private _onEggClick;
16
+ constructor(config: ResolvedConfig);
17
+ mount(onEggClick: (index: number) => void): void;
18
+ /** Fade in the shrine. Call after entry is found. */
19
+ show(): void;
20
+ /** Mark an egg slot as found (filled). */
21
+ fillSlot(index: number): void;
22
+ /** Activate a slot for click-to-continue (pulsing). */
23
+ activateSlot(index: number): void;
24
+ /** Deactivate the active slot. */
25
+ deactivateSlot(index: number): void;
26
+ /** Animate all eggs leaving the shrine (for finale). */
27
+ hideAll(): void;
28
+ /** Show all slots again (for reset). */
29
+ reset(): void;
30
+ destroy(): void;
31
+ private _getStyles;
32
+ }
@@ -0,0 +1,147 @@
1
+ import type { ResolvedConfig } from '../types';
2
+ /**
3
+ * Three.js-based 3D Easter egg renderer — premium, wow-factor edition.
4
+ *
5
+ * Each egg is a unique, beautiful Easter egg with decorative ornaments,
6
+ * premium PBR materials, and increasingly elaborate ornamentation.
7
+ *
8
+ * - Egg 1: Polished silver with chrome shader reflections — elegant & pure
9
+ * - Egg 2: Rich 24k gold with baroque shader patterns — opulent & warm
10
+ * - Egg 3: Royal Fabergé with multicolor enamel & gem shader — ultimate prize
11
+ *
12
+ * Features:
13
+ * - Spectacular reveal animations with particle bursts
14
+ * - User can drag/rotate the won egg interactively
15
+ * - Long-press on egg to collect it (hold-to-absorb with visual ring)
16
+ * - Ambient progress particles for stage feedback
17
+ */
18
+ export declare class ThreeRenderer {
19
+ private config;
20
+ private canvas;
21
+ private THREE;
22
+ private renderer;
23
+ private scene;
24
+ private camera;
25
+ private eggs;
26
+ private eggBodies;
27
+ private lights;
28
+ private _raf;
29
+ private _running;
30
+ private _reducedMotion;
31
+ private _clock;
32
+ private _eggStates;
33
+ private _finaleActive;
34
+ private _finaleT;
35
+ private _greetingOverlay;
36
+ private _trailParticles;
37
+ private _ambientParticles;
38
+ private _revealParticles;
39
+ private _disposed;
40
+ private _interactiveEgg;
41
+ private _isDragging;
42
+ private _dragStartX;
43
+ private _dragStartY;
44
+ private _dragRotX;
45
+ private _dragRotY;
46
+ private _dragMoved;
47
+ private _longPressStartTime;
48
+ private _longPressActive;
49
+ private _holdProgress;
50
+ private _holdRing;
51
+ private _holdShockwave;
52
+ private _miniEggs;
53
+ private _collectLight;
54
+ private _onCollectEgg;
55
+ private _vortexParticles;
56
+ private _emberParticles;
57
+ private _collectFlashOpacity;
58
+ private _collectShake;
59
+ private _collectCamBaseZ;
60
+ constructor(config: ResolvedConfig);
61
+ /** Set callback for when user completes long-press collect. */
62
+ onCollectEgg(cb: (index: number) => void): void;
63
+ init(): Promise<boolean>;
64
+ startRenderLoop(): void;
65
+ stopRenderLoop(): void;
66
+ /** Make an egg interactively draggable. */
67
+ enableInteraction(index: number): void;
68
+ /** Disable drag interaction. */
69
+ disableInteraction(): void;
70
+ /** Trigger spectacular egg reveal. */
71
+ revealEgg(index: number): void;
72
+ /** Collect egg — hide immediately (mini-egg burst already happened during hold). */
73
+ collectEgg(index: number): void;
74
+ /** Reset renderer state for game restart (preserves WebGL context). */
75
+ resetForRestart(): void;
76
+ /** Add a luminous motion trail at screen coordinates. */
77
+ addTrail(x: number, y: number, velocity: number): void;
78
+ /** Spawn gentle ambient particles to show stage progress. */
79
+ showProgressParticles(progress: number): void;
80
+ /** Start the finale composition. */
81
+ startFinale(): void;
82
+ /** Re-draw the festive (3rd) egg texture with a specific seed for uniqueness. */
83
+ setFestiveEggSeed(seed: number): void;
84
+ setBreathIntensity(intensity: number): void;
85
+ setOverlayIntensity(_progress: number): void;
86
+ destroy(): void;
87
+ private _setupLights;
88
+ private _setupEnvironment;
89
+ private _createEggs;
90
+ /** Create a tiny egg-shaped geometry (same squash as main eggs, lower poly). */
91
+ private _createMiniEggGeo;
92
+ /** Create a minimalist randomly-decorated mini egg material. */
93
+ /** Create a decorated mini egg material — pastel base with visible patterns. */
94
+ private _createMiniEggMat;
95
+ private _createEggGeometry;
96
+ /** Silver polka-dot color map */
97
+ private _drawSilverPolkaDots;
98
+ /** Silver roughness map (dots are more rough = less shiny) */
99
+ private _drawSilverRoughness;
100
+ /** Gold color map with ornamental scrollwork */
101
+ private _drawGoldPattern;
102
+ /** Gold roughness map */
103
+ private _drawGoldRoughness;
104
+ /** Festive Fabergé color map — randomized enamel bands + golden dividers */
105
+ private _drawFestivePattern;
106
+ /** Festive roughness map */
107
+ private _drawFestiveRoughness;
108
+ private _createHoldRing;
109
+ private _spawnRevealBurst;
110
+ /** Spawn golden energy vortex particles that orbit and spiral inward. */
111
+ private _spawnVortex;
112
+ /** Spawn upward-drifting golden ember particles after implosion. */
113
+ private _spawnEmbers;
114
+ /** Update vortex particles — orbit, spiral inward, fade in then out. */
115
+ private _updateVortexParticles;
116
+ /** Update ember particles — drift up, sway, flicker, fade. */
117
+ private _updateEmberParticles;
118
+ private _onPointerDown;
119
+ private _onPointerMove;
120
+ private _onPointerUp;
121
+ /** Prevent scroll when pointer is over the interactive egg. */
122
+ private _onWheel;
123
+ /** Prevent click from reaching elements behind the egg. */
124
+ private _onClickCapture;
125
+ /** Block mousedown from reaching elements behind the egg (browsers fire both pointer + mouse events). */
126
+ private _onMouseDownCapture;
127
+ /** Block mouseup from reaching elements behind the egg. */
128
+ private _onMouseUpCapture;
129
+ /** Block touch events from reaching elements behind the egg. */
130
+ private _onTouchStartCapture;
131
+ /** Block touch move events during egg interaction. */
132
+ private _onTouchMoveCapture;
133
+ private _cancelLongPress;
134
+ private _worldToScreen;
135
+ private _screenToWorld;
136
+ private _animate;
137
+ private _updateEggs;
138
+ private _updateHoldRing;
139
+ /** Spawn a burst of shards flying outward from the collected egg, in the egg's own colour. */
140
+ private _spawnMiniEggBurst;
141
+ private _updateMiniEggs;
142
+ private _updateFinale;
143
+ private _updateTrails;
144
+ private _updateAmbientParticles;
145
+ private _updateRevealParticles;
146
+ private _onResize;
147
+ }
@@ -0,0 +1,26 @@
1
+ import type { FinalScore, GameStage } from '../types';
2
+ /**
3
+ * Local persistence layer using localStorage.
4
+ * Stores past scores and best times.
5
+ */
6
+ export declare class Persistence {
7
+ private _enabled;
8
+ constructor(enabled: boolean);
9
+ saveScore(score: FinalScore): void;
10
+ getBestTime(): number | null;
11
+ getScoreCount(): number;
12
+ getLastScore(): (FinalScore & {
13
+ date: string;
14
+ }) | null;
15
+ clearScores(): void;
16
+ private _loadAll;
17
+ saveProgress(data: ProgressCheckpoint): void;
18
+ loadProgress(): ProgressCheckpoint | null;
19
+ clearProgress(): void;
20
+ }
21
+ export interface ProgressCheckpoint {
22
+ stage: GameStage;
23
+ eggsFound: number;
24
+ eggsState: [boolean, boolean, boolean];
25
+ savedAt: number;
26
+ }