import { type ReactNode, type FC } from 'react'; /** * Script loading strategies */ export declare enum ScriptStrategy { /** * Load script immediately without waiting */ EAGER = "eager", /** * Load script after initial page load */ LAZY = "lazy", /** * Load script just before it's needed (on viewport visibility) */ VIEWPORT = "viewport", /** * Load script after idle (requestIdleCallback) */ IDLE = "idle", /** * Load script after a delay (for lower priority scripts) */ DELAYED = "delayed", /** * Load script before interactive (Next.js compatibility) */ BEFORE_INTERACTIVE = "beforeInteractive", /** * Load script after interactive (Next.js compatibility) */ AFTER_INTERACTIVE = "afterInteractive", /** * Load script after page load event (Next.js compatibility) */ AFTER_LOAD = "afterLoad" } /** * Available script types */ export type ScriptType = 'application/javascript' | 'module' | 'importmap' | 'text/javascript' | string; /** * Script component props */ export interface ScriptProps { /** * Script source URL */ src?: string; /** * Inline script content if not using src */ content?: string; /** * React children as an alternative to content */ children?: string | React.ReactNode; /** * Script loading strategy * @default ScriptStrategy.AFTER_INTERACTIVE */ strategy?: ScriptStrategy | `${ScriptStrategy}`; /** * Delay in milliseconds (when using DELAYED strategy) * @default 2000 */ delayValue?: number; /** * Script type attribute * @default 'text/javascript' */ type?: ScriptType; /** * Called when the script has successfully loaded */ onLoad?: (e?: Event) => void; /** * Called when the script has failed to load */ onError?: (error: Error) => void; /** * Script ID attribute */ id?: string; /** * Whether the script should be loaded asynchronously */ async?: boolean; /** * Whether script execution should be deferred */ defer?: boolean; /** * Integrity hash for subresource integrity */ integrity?: string; /** * CrossOrigin attribute */ crossOrigin?: 'anonymous' | 'use-credentials'; /** * Fallback content to render if script loading fails or browser has JavaScript disabled */ fallback?: ReactNode; /** * Any additional data attributes to add to the script tag */ dataAttributes?: Record; /** * Next.js compatibility - a boolean that executes the script in the current browsing context */ 'data-nscript'?: 'beforeInteractive' | 'afterInteractive' | 'lazyOnload' | 'worker'; /** * Next.js compatibility - don't load script in some cases */ dangerouslyDisableScript?: boolean; } /** * Script component for efficiently loading JavaScript in React applications * * API compatible with Next.js's Script component * * @example * ```tsx * // Basic usage * * ``` */ export declare const Script: FC; export default Script;