UNPKG

guida.js

Version:

A modern, lightweight onboarding library with spotlight highlighting and smooth animations

136 lines (134 loc) 3.14 kB
import { OnboardingConfig, OnboardingStep, OnboardingEvents } from './types'; /** * Onboarding library with spotlight highlighting */ export declare class Guida { private config; private state; private eventListeners; constructor(config: OnboardingConfig); /** * Merge user config with defaults */ private mergeConfig; /** * Initialize the onboarding system */ private init; /** * Inject default styles into the document */ private injectStyles; /** * Start the onboarding flow */ start(): void; /** * Create the overlay and backdrop elements */ private createOverlay; /** * Show a specific step */ private showStep; /** * Highlight an element with spotlight effect */ private highlightElement; /** * Update the clip-path for the backdrop to create spotlight effect with border radius */ private updateClipPath; /** * Create a rounded spotlight effect using SVG mask for proper rounded corners */ private createRoundedSpotlight; /** * Setup resize handler to update clip-path on window resize */ private setupResizeHandler; /** * Show tooltip for the current step */ private showTooltip; /** * Setup event listeners for tooltip buttons */ private setupTooltipEvents; /** * Setup interaction handling for the current step */ private setupStepInteraction; /** * Move to the next step */ nextStep(): void; /** * Move to the previous step */ previousStep(): void; /** * Go to a specific step */ goToStep(stepIndex: number): void; /** * Hide the tooltip */ private hideTooltip; /** * Complete the onboarding flow */ complete(): void; /** * Show completion message */ private showCompletionMessage; /** * Close the onboarding flow */ close(): void; /** * Clean up all onboarding elements and listeners */ private cleanup; /** * Clear all highlights and reset backdrop */ private clearHighlights; /** * Mark onboarding as completed in localStorage */ private markAsCompleted; /** * Check if onboarding has been completed */ isCompleted(): boolean; /** * Reset onboarding (remove completion flag) */ reset(): void; /** * Restart the onboarding flow */ restart(): void; /** * Get current step information */ getCurrentStep(): { index: number; step: OnboardingStep | null; }; /** * Check if onboarding is currently active */ isActive(): boolean; /** * Add event listener */ on<K extends keyof OnboardingEvents>(event: K, callback: (data: OnboardingEvents[K]) => void): void; /** * Remove event listener */ off<K extends keyof OnboardingEvents>(event: K, callback: (data: OnboardingEvents[K]) => void): void; /** * Emit event to all listeners */ private emit; }