/** * Tiny SVG-based blur placeholder for next/image. * * Generates a small, inline base64-encoded SVG that next/image displays while * the real image loads. This eliminates layout shift (CLS) and provides a smooth * visual transition without needing to pre-compute per-image blur hashes. * * Usage: * */ const SHIMMER_SVG = ` `.trim(); const STATIC_BLUR_SVG = ` `.trim(); function toBase64(str: string): string { if (typeof window === 'undefined') { return Buffer.from(str).toString('base64'); } return btoa(str); } /** * Animated shimmer blur placeholder (for listing thumbnails). * Shows a shimmer animation while the image loads. */ export function shimmerBlurDataURL(): string { return `data:image/svg+xml;base64,${toBase64(SHIMMER_SVG)}`; } /** * Static grey blur placeholder (for small thumbnails like table rows). * Lightweight, no animation. */ export function staticBlurDataURL(): string { return `data:image/svg+xml;base64,${toBase64(STATIC_BLUR_SVG)}`; }