UNPKG

triyak-react-performance

Version:

Advanced React performance optimization toolkit - Built with modern React best practices and performance optimization techniques

60 lines 3.19 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const jsx_runtime_1 = require("react/jsx-runtime"); const TriyakPerformanceMonitor_1 = __importDefault(require("./TriyakPerformanceMonitor")); const TriyakPerformanceSuite = ({ enableAll = false, monitoring = true, recommendations = true, alerts = true, coreWebVitals = {}, bundle = {}, images = {}, memory = {}, ai = {}, children }) => { // Default configuration when enableAll is true const defaultConfig = enableAll ? { lcpThreshold: 1500, fidThreshold: 50, clsThreshold: 0.05, enableAIOptimization: true, optimizationMode: 'aggressive', monitoring: true, alerts: true, reporting: true, autoOptimize: true } : {}; // Merge custom configuration const finalConfig = { ...defaultConfig, lcpThreshold: coreWebVitals.lcp?.target || 1500, fidThreshold: coreWebVitals.fid?.target || 50, clsThreshold: coreWebVitals.cls?.target || 0.05, enableAIOptimization: ai.enabled !== false, optimizationMode: 'aggressive', monitoring: monitoring !== false, alerts: alerts !== false, reporting: recommendations !== false, autoOptimize: true }; return ((0, jsx_runtime_1.jsxs)("div", { className: "triyak-performance-suite", "data-version": "1.0.0", children: [(0, jsx_runtime_1.jsx)(TriyakPerformanceMonitor_1.default, { ...finalConfig, onPerformanceAlert: (alert) => { if (alerts) { console.warn(`Triyak Performance Alert: ${alert.metric} exceeded threshold`, alert); } }, onMetrics: (metrics) => { if (monitoring) { console.log('Triyak Performance Metrics:', metrics); } }, onReport: (report) => { if (recommendations) { console.log('Triyak Performance Report:', report); } }, children: children }), process.env.NODE_ENV === 'development' && ((0, jsx_runtime_1.jsxs)("div", { style: { position: 'fixed', bottom: '10px', right: '10px', background: '#1a1a1a', color: '#00ff00', padding: '10px', borderRadius: '5px', fontSize: '12px', zIndex: 9999, border: '1px solid #00ff00' }, children: [(0, jsx_runtime_1.jsx)("div", { children: "\uD83D\uDE80 Triyak Performance Suite Active" }), (0, jsx_runtime_1.jsxs)("div", { children: ["Monitoring: ", monitoring ? '✅' : '❌'] }), (0, jsx_runtime_1.jsxs)("div", { children: ["Alerts: ", alerts ? '✅' : '❌'] }), (0, jsx_runtime_1.jsxs)("div", { children: ["AI: ", ai.enabled !== false ? '✅' : '❌'] })] }))] })); }; exports.default = TriyakPerformanceSuite; //# sourceMappingURL=TriyakPerformanceSuite.js.map