@sc4rfurryx/proteusjs
Version:
The Modern Web Development Framework for Accessible, Responsive, and High-Performance Applications. Intelligent container queries, fluid typography, WCAG compliance, and performance optimization.
83 lines (81 loc) • 2.54 kB
TypeScript
/**
* @sc4rfurryx/proteusjs/perf
* Performance guardrails and CWV-friendly patterns
*
* @version 2.0.0
* @author sc4rfurry
* @license MIT
*/
interface SpeculationOptions {
prerender?: string[];
prefetch?: string[];
sameOriginOnly?: boolean;
}
interface ContentVisibilityOptions {
containIntrinsicSize?: string;
}
/**
* Apply content-visibility for performance optimization
*/
declare function contentVisibility(selector: string | Element, mode?: 'auto' | 'hidden', opts?: ContentVisibilityOptions): void;
/**
* Set fetch priority for resources
*/
declare function fetchPriority(selector: string | Element, priority: 'high' | 'low' | 'auto'): void;
/**
* Set up speculation rules for prerendering and prefetching
*/
declare function speculate(opts: SpeculationOptions): void;
/**
* Yield to browser using scheduler.yield or postTask when available
*/
declare function yieldToBrowser(): Promise<void>;
/**
* Optimize images with loading and decoding hints
*/
declare function optimizeImages(selector?: string | Element): void;
/**
* Preload critical resources
*/
declare function preloadCritical(resources: Array<{
href: string;
as: string;
type?: string;
}>): void;
/**
* Measure and report Core Web Vitals
*/
declare function measureCWV(): Promise<{
lcp?: number;
fid?: number;
cls?: number;
}>;
declare const boost: {
contentVisibility: typeof contentVisibility;
fetchPriority: typeof fetchPriority;
speculate: typeof speculate;
yieldToBrowser: typeof yieldToBrowser;
optimizeImages: typeof optimizeImages;
preloadCritical: typeof preloadCritical;
measureCWV: typeof measureCWV;
};
declare const _default: {
contentVisibility: typeof contentVisibility;
fetchPriority: typeof fetchPriority;
speculate: typeof speculate;
yieldToBrowser: typeof yieldToBrowser;
optimizeImages: typeof optimizeImages;
preloadCritical: typeof preloadCritical;
measureCWV: typeof measureCWV;
boost: {
contentVisibility: typeof contentVisibility;
fetchPriority: typeof fetchPriority;
speculate: typeof speculate;
yieldToBrowser: typeof yieldToBrowser;
optimizeImages: typeof optimizeImages;
preloadCritical: typeof preloadCritical;
measureCWV: typeof measureCWV;
};
};
export { boost, contentVisibility, _default as default, fetchPriority, measureCWV, optimizeImages, preloadCritical, speculate, yieldToBrowser };
export type { ContentVisibilityOptions, SpeculationOptions };