import { default as React, ReactNode } from 'react';
import { StreamBoundaryProps } from './types';
/**
* Default placeholder component for streaming boundaries.
*
* @description
* A minimal placeholder with CSS animation that matches
* the skeleton pattern used throughout the application.
*/
declare function DefaultPlaceholder(): React.ReactElement;
/**
* Fallback component for non-streaming environments.
*
* @description
* Renders when streaming is not supported, providing
* a graceful degradation path.
*/
interface NonStreamingFallbackProps {
children: ReactNode;
fallback?: ReactNode;
}
declare function NonStreamingFallback({ children, fallback, }: NonStreamingFallbackProps): React.ReactElement;
/**
* StreamBoundary Component
*
* @description
* Defines a streaming boundary within the React component tree.
* Content within a StreamBoundary can be streamed independently
* from the rest of the page, enabling progressive HTML delivery.
*
* Key features:
* - Priority-based streaming (critical, high, normal, low)
* - Configurable defer timing for non-critical content
* - Placeholder rendering during stream
* - Fallback for non-streaming environments
* - Integration with React Suspense
* - Automatic cleanup on unmount
*
* Performance considerations:
* - Use `priority="critical"` for above-the-fold content
* - Use `deferMs` to stagger non-critical content
* - Provide appropriately-sized placeholders to prevent CLS
* - Keep streaming boundaries reasonably sized
*
* @example
* ```tsx
* // Navigation - stream immediately
*
*
*
*
* // Hero section - high priority
* }
* onStreamComplete={() => analytics.track('hero_loaded')}
* >
*
*
*
* // Sidebar - normal priority, slightly deferred
* }
* >
*
*
*
* // Footer - low priority, significantly deferred
* }
* >
*
*
* ```
*/
declare function StreamBoundaryComponent({ id, children, priority, deferMs, timeoutMs, placeholder, fallback, ssr, onStreamStart, onStreamComplete, onStreamError, className, testId, }: StreamBoundaryProps): React.ReactElement;
/**
* Memoized StreamBoundary to prevent unnecessary re-renders.
*
* @description
* The component is memoized with a custom comparison function
* that checks for meaningful prop changes.
*/
export declare const StreamBoundary: React.MemoExoticComponent;
/**
* CriticalStreamBoundary - Pre-configured for critical content.
*
* @description
* A specialized StreamBoundary with critical priority,
* no defer, and SSR enabled by default.
*
* @example
* ```tsx
*
*
*
* ```
*/
export declare function CriticalStreamBoundary({ priority, deferMs, ssr, ...props }: StreamBoundaryProps): React.ReactElement;
export declare namespace CriticalStreamBoundary {
var displayName: string;
}
/**
* DeferredStreamBoundary - Pre-configured for deferred content.
*
* @description
* A specialized StreamBoundary with low priority and
* automatic deferral, ideal for below-the-fold content.
*
* @example
* ```tsx
*
* ```
*/
export declare function DeferredStreamBoundary({ priority, deferMs, ...props }: StreamBoundaryProps): React.ReactElement;
export declare namespace DeferredStreamBoundary {
var displayName: string;
}
/**
* ConditionalStreamBoundary - Only streams when condition is met.
*
* @description
* Renders children without streaming when condition is false,
* enables streaming when condition becomes true.
*
* @example
* ```tsx
* }
* >
*
*
* ```
*/
export interface ConditionalStreamBoundaryProps extends StreamBoundaryProps {
/** Condition that must be true to enable streaming */
condition: boolean;
}
export declare function ConditionalStreamBoundary({ condition, children, fallback, ...props }: ConditionalStreamBoundaryProps): React.ReactElement;
export declare namespace ConditionalStreamBoundary {
var displayName: string;
}
/**
* Creates script content for client-side boundary activation.
*
* @description
* Generates inline JavaScript that will be executed on the client
* to activate streaming for a boundary after SSR.
*
* @param boundaryId - The boundary ID to activate
* @param nonce - Optional CSP nonce
* @returns Script element content
*
* @example
* ```tsx
* // In SSR context
* const activationScript = createBoundaryActivationScript('hero', nonce);
* // Inject into HTML
* ```
*/
export declare function createBoundaryActivationScript(boundaryId: string, nonce?: string): string;
/**
* Creates HTML comment marker for stream boundary.
*
* @description
* Used during SSR to mark stream boundary locations in HTML.
* The client-side hydration process uses these markers to
* identify and activate boundaries.
*
* @param boundaryId - The boundary ID
* @param type - Marker type ('start' or 'end')
* @returns HTML comment string
*/
export declare function createBoundaryMarker(boundaryId: string, type: 'start' | 'end'): string;
export { DefaultPlaceholder, NonStreamingFallback };