@oxog/react-check 1.1.6 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +115 -1
- package/README.md +149 -51
- package/dist/browser-inject.global.js +705 -158
- package/dist/chain.cjs +8 -531
- package/dist/chain.cjs.map +1 -1
- package/dist/chain.d.cts +2 -2
- package/dist/chain.d.ts +2 -2
- package/dist/chain.js +2 -533
- package/dist/chain.js.map +1 -1
- package/dist/chunk-27R56V2S.js +473 -0
- package/dist/chunk-27R56V2S.js.map +1 -0
- package/dist/chunk-3K2AER5M.cjs +356 -0
- package/dist/chunk-3K2AER5M.cjs.map +1 -0
- package/dist/chunk-7R4KKJTW.cjs +255 -0
- package/dist/chunk-7R4KKJTW.cjs.map +1 -0
- package/dist/chunk-7YYMP3PP.js +723 -0
- package/dist/chunk-7YYMP3PP.js.map +1 -0
- package/dist/chunk-DWM55ACO.cjs +294 -0
- package/dist/chunk-DWM55ACO.cjs.map +1 -0
- package/dist/chunk-G7YVIPS7.cjs +475 -0
- package/dist/chunk-G7YVIPS7.cjs.map +1 -0
- package/dist/chunk-GE2ZX7I7.cjs +727 -0
- package/dist/chunk-GE2ZX7I7.cjs.map +1 -0
- package/dist/chunk-GS7T56RP.cjs +9 -0
- package/dist/chunk-GS7T56RP.cjs.map +1 -0
- package/dist/chunk-IM6OG2IC.js +338 -0
- package/dist/chunk-IM6OG2IC.js.map +1 -0
- package/dist/chunk-RQYHXWUC.js +292 -0
- package/dist/chunk-RQYHXWUC.js.map +1 -0
- package/dist/chunk-WLN7ZVO4.js +253 -0
- package/dist/chunk-WLN7ZVO4.js.map +1 -0
- package/dist/cli.js +1443 -207
- package/dist/cli.js.map +1 -1
- package/dist/detect.cjs +22 -324
- package/dist/detect.cjs.map +1 -1
- package/dist/detect.d.cts +8 -2
- package/dist/detect.d.ts +8 -2
- package/dist/detect.js +1 -324
- package/dist/detect.js.map +1 -1
- package/dist/{event-emitter-CxKUDo9q.d.cts → event-emitter-BVYUPYLd.d.cts} +3 -2
- package/dist/{event-emitter-CxKUDo9q.d.ts → event-emitter-BVYUPYLd.d.ts} +3 -2
- package/dist/fix.cjs +6 -715
- package/dist/fix.cjs.map +1 -1
- package/dist/fix.d.cts +2 -2
- package/dist/fix.d.ts +2 -2
- package/dist/fix.js +2 -719
- package/dist/fix.js.map +1 -1
- package/dist/index.cjs +2380 -3308
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +255 -88
- package/dist/index.d.ts +255 -88
- package/dist/index.js +2289 -3290
- package/dist/index.js.map +1 -1
- package/dist/{scanner-CTBraprQ.d.ts → scanner-D0mBQGTx.d.ts} +23 -3
- package/dist/{scanner-5j2LEM-q.d.cts → scanner-DUBgwztZ.d.cts} +23 -3
- package/dist/scanner.cjs +8 -1652
- package/dist/scanner.cjs.map +1 -1
- package/dist/scanner.d.cts +3 -3
- package/dist/scanner.d.ts +3 -3
- package/dist/scanner.js +4 -1656
- package/dist/scanner.js.map +1 -1
- package/dist/{types-xAXT9cir.d.cts → types-BZ3OeZ-5.d.cts} +28 -10
- package/dist/{types-xAXT9cir.d.ts → types-BZ3OeZ-5.d.ts} +28 -10
- package/package.json +20 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
(function(){'use strict';var M=Object.defineProperty;var z=(r,e,t)=>e in r?M(r,e,{enumerable:true,configurable:true,writable:true,value:t}):r[e]=t;var l=(r,e,t)=>z(r,typeof e!="symbol"?e+"":e,t);var v=class{constructor(){l(this,"_listeners",new Map);l(this,"_onceListeners",new Map);l(this,"maxListeners",0);}on(e,t){let n=this._listeners.get(e);return n||(n=new Set,this._listeners.set(e,n)),this.maxListeners>0&&n.size>=this.maxListeners&&console.warn(`Warning: Possible EventEmitter memory leak detected. ${n.size+1} listeners added for event "${String(e)}". Use setMaxListeners() to increase limit.`),n.add(t),this}addListener(e,t){return this.on(e,t)}once(e,t){let n=this._onceListeners.get(e);return n||(n=new Set,this._onceListeners.set(e,n)),n.add(t),this}off(e,t){let n=this._listeners.get(e);n&&(n.delete(t),n.size===0&&this._listeners.delete(e));let i=this._onceListeners.get(e);return i&&(i.delete(t),i.size===0&&this._onceListeners.delete(e)),this}removeListener(e,t){return this.off(e,t)}removeAllListeners(e){return e!==void 0?(this._listeners.delete(e),this._onceListeners.delete(e)):(this._listeners.clear(),this._onceListeners.clear()),this}emit(e,t){let n=false,i=this._listeners.get(e);if(i)for(let s of i)try{s(t),n=!0;}catch(a){if(e!=="error")this.emit("error",a);else throw a}let o=this._onceListeners.get(e);if(o){let s=Array.from(o);this._onceListeners.delete(e);for(let a of s)try{a(t),n=!0;}catch(c){if(e!=="error")this.emit("error",c);else throw c}}return n}getListeners(e){let t=this._listeners.get(e),n=this._onceListeners.get(e),i=[];return t&&i.push(...Array.from(t)),n&&i.push(...Array.from(n)),i}listenerCount(e){let t=this._listeners.get(e)?.size??0,n=this._onceListeners.get(e)?.size??0;return t+n}eventNames(){let e=new Set;for(let t of this._listeners.keys())e.add(t);for(let t of this._onceListeners.keys())e.add(t);return Array.from(e)}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}prependListener(e,t){let n=this._listeners.get(e);if(!n)return this.on(e,t);let i=Array.from(n);return i.unshift(t),this._listeners.set(e,new Set(i)),this}prependOnceListener(e,t){let n=this._onceListeners.get(e);if(!n)return this.once(e,t);let i=Array.from(n);return i.unshift(t),this._onceListeners.set(e,new Set(i)),this}waitFor(e,t){return new Promise((n,i)=>{let o,s=a=>{o&&clearTimeout(o),n(a);};this.once(e,s),t!==void 0&&t>0&&(o=setTimeout(()=>{this.off(e,s),i(new Error(`Timeout waiting for event "${String(e)}"`));},t));})}};var d={FunctionComponent:0,ClassComponent:1,HostRoot:3,HostComponent:5,HostText:6,Fragment:7,ContextConsumer:9,ContextProvider:10,ForwardRef:11,Profiler:12,SuspenseComponent:13,MemoComponent:14,SimpleMemoComponent:15,LazyComponent:16,IncompleteClassComponent:17};function b(r){if(!r)return "Unknown";let{type:e,tag:t}=r;switch(t){case d.FunctionComponent:case d.ClassComponent:case d.SimpleMemoComponent:case d.IncompleteClassComponent:return f(e)||"Anonymous";case d.ForwardRef:if(e&&typeof e=="object"){let n=e;if(n.displayName)return n.displayName;if("render"in n&&n.render){let i=f(n.render);if(i&&i!=="Anonymous")return i}}return "ForwardRef";case d.MemoComponent:if(e&&typeof e=="object"&&"type"in e){let n=e.type;return `Memo(${f(n)||"Anonymous"})`}return "Memo";case d.LazyComponent:return "Lazy";case d.ContextConsumer:return "Context.Consumer";case d.ContextProvider:return "Context.Provider";case d.SuspenseComponent:return "Suspense";case d.Fragment:return "Fragment";case d.Profiler:return "Profiler";case d.HostRoot:return "Root";case d.HostComponent:return typeof e=="string"?e:"HostComponent";case d.HostText:return "#text";default:return f(e)||"Unknown"}}function f(r){if(r!=null){if(typeof r=="string")return r;if(typeof r=="function")return r.displayName??r.name??void 0;if(typeof r=="object"){let e=r;return e.displayName??e.name??void 0}}}function k(r){let{tag:e}=r;return e===d.FunctionComponent||e===d.ClassComponent||e===d.MemoComponent||e===d.SimpleMemoComponent||e===d.ForwardRef||e===d.LazyComponent}var C=1;function T(r){let e=r.alternate;if(!e)return true;switch(r.tag){case d.FunctionComponent:case d.ClassComponent:case d.ContextConsumer:case d.ForwardRef:case d.MemoComponent:case d.SimpleMemoComponent:return ((r.flags??r.effectTag??0)&C)===C;default:return e.memoizedProps!==r.memoizedProps||e.memoizedState!==r.memoizedState}}function _(r,e){if(r===e)return [];if(!r||!e)return Object.keys(e??r??{});let t=[],n=new Set([...Object.keys(r),...Object.keys(e)]);for(let i of n)i!=="children"&&r[i]!==e[i]&&t.push(i);return t}function R(r,e,t,n){let i=b(r),o=r.actualDuration??0,s=t?_(t,r.memoizedProps):void 0,a=s&&s.length>0,c=n!==r.memoizedState,p={componentName:i,renderCount:1,renderTime:o,phase:e,necessary:e==="mount"||a||c,timestamp:Date.now()};return s!==void 0&&(p.changedProps=s),c&&(p.changedState=["state"]),p}function x(r){return String(r).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var O={enabled:true,highlightRenders:true,showToolbar:true,highlightDuration:2e3},E={critical:"#ef4444",warning:"#f97316",info:"#3b82f6",healthy:"#22c55e",unnecessary:"#6b7280"},g=class g{constructor(e={}){l(this,"shadowRoot",null);l(this,"host",null);l(this,"config");l(this,"trackedComponents",new Map);l(this,"renderChains",[]);l(this,"toolbar",null);l(this,"visible",true);l(this,"collapsed",false);l(this,"totalRenders",0);l(this,"fps",60);l(this,"startTime",Date.now());l(this,"fadeTimeouts",new Map);l(this,"scrollHandler",null);l(this,"scrollUpdatePending",false);l(this,"statsInterval",null);l(this,"initRetryCount",0);l(this,"initRetryTimer",null);l(this,"documentListeners",null);this.config={...O,...e};}init(){if(!this.host){if(!document.body){this.initRetryCount<10&&this.initRetryTimer===null&&(this.initRetryCount++,this.initRetryTimer=setTimeout(()=>{this.initRetryTimer=null,this.init();},100));return}this.host=document.createElement("div"),this.host.id="reactcheck-overlay-host",this.host.style.cssText=`
|
|
2
2
|
position: fixed;
|
|
3
3
|
top: 0;
|
|
4
4
|
left: 0;
|
|
@@ -6,239 +6,786 @@ var ReactCheckInjector=(function(exports){'use strict';var C=Object.defineProper
|
|
|
6
6
|
height: 100%;
|
|
7
7
|
pointer-events: none;
|
|
8
8
|
z-index: 2147483647;
|
|
9
|
-
`,this.shadowRoot=this.host.attachShadow({mode:"closed"}),this.injectStyles(),this.config.showToolbar&&this.createToolbar(),document.body.appendChild(this.host);}destroy(){this.
|
|
9
|
+
`,this.shadowRoot=this.host.attachShadow({mode:"closed"}),this.injectStyles(),this.config.showToolbar&&this.createToolbar(),document.body.appendChild(this.host),this.scrollHandler=()=>this.onScroll(),window.addEventListener("scroll",this.scrollHandler,{passive:true,capture:true}),window.addEventListener("resize",this.scrollHandler,{passive:true}),this.statsInterval=setInterval(()=>this.updateStats(),500),console.log("[ReactCheck] Overlay initialized");}}destroy(){this.initRetryTimer!==null&&(clearTimeout(this.initRetryTimer),this.initRetryTimer=null),this.documentListeners&&(this.documentListeners.abort(),this.documentListeners=null),this.statsInterval&&(clearInterval(this.statsInterval),this.statsInterval=null),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,{capture:true}),window.removeEventListener("resize",this.scrollHandler),this.scrollHandler=null);for(let e of this.fadeTimeouts.values())clearTimeout(e);this.fadeTimeouts.clear(),this.trackedComponents.clear(),this.renderChains=[],this.host&&(this.host.remove(),this.host=null),this.shadowRoot=null,this.toolbar=null;}onScroll(){this.scrollUpdatePending||(this.scrollUpdatePending=true,requestAnimationFrame(()=>{this.updateAllPositions(),this.scrollUpdatePending=false;}));}updateAllPositions(){for(let e of this.trackedComponents.values()){let t=e.element.getBoundingClientRect();if(t.width===0||t.height===0){e.highlightEl.style.display="none";continue}e.highlightEl.style.display=this.config.highlightRenders?"block":"none",e.highlightEl.style.left=`${t.left}px`,e.highlightEl.style.top=`${t.top}px`,e.highlightEl.style.width=`${t.width}px`,e.highlightEl.style.height=`${t.height}px`;}}injectStyles(){if(!this.shadowRoot)return;let e=document.createElement("style");e.textContent=`
|
|
10
10
|
* {
|
|
11
11
|
box-sizing: border-box;
|
|
12
|
+
margin: 0;
|
|
13
|
+
padding: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* Ensure all interactive elements are clickable */
|
|
17
|
+
button, input, .toggle, .tab, .action-btn, .component-item, .panel-btn {
|
|
18
|
+
pointer-events: auto !important;
|
|
19
|
+
cursor: pointer;
|
|
12
20
|
}
|
|
13
21
|
|
|
14
|
-
|
|
22
|
+
/* Highlight styles */
|
|
23
|
+
.highlight-container {
|
|
15
24
|
position: fixed;
|
|
16
25
|
pointer-events: none;
|
|
17
|
-
border-width: 2px;
|
|
18
|
-
border-style: solid;
|
|
19
26
|
z-index: 1;
|
|
20
|
-
animation: highlight-pulse 0.5s ease-out;
|
|
21
27
|
}
|
|
22
28
|
|
|
23
|
-
.highlight
|
|
24
|
-
|
|
29
|
+
.highlight-border {
|
|
30
|
+
position: absolute;
|
|
31
|
+
inset: 0;
|
|
32
|
+
border: 2px solid currentColor;
|
|
33
|
+
border-radius: 4px;
|
|
25
34
|
transition: opacity 0.3s ease-out;
|
|
26
35
|
}
|
|
27
36
|
|
|
28
|
-
.
|
|
29
|
-
|
|
30
|
-
pointer-events: none;
|
|
31
|
-
z-index: 0;
|
|
32
|
-
animation: flash-pulse 0.4s ease-out forwards;
|
|
33
|
-
border-radius: 4px;
|
|
37
|
+
.highlight-container.fade .highlight-border {
|
|
38
|
+
opacity: 0.3;
|
|
34
39
|
}
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
50% {
|
|
42
|
-
opacity: 0.8;
|
|
43
|
-
transform: scale(1.02);
|
|
44
|
-
}
|
|
45
|
-
100% {
|
|
46
|
-
opacity: 0;
|
|
47
|
-
transform: scale(1);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
@keyframes highlight-pulse {
|
|
52
|
-
0% {
|
|
53
|
-
opacity: 0;
|
|
54
|
-
box-shadow: 0 0 0 0 currentColor;
|
|
55
|
-
}
|
|
56
|
-
30% {
|
|
57
|
-
opacity: 1;
|
|
58
|
-
box-shadow: 0 0 8px 2px currentColor;
|
|
59
|
-
}
|
|
60
|
-
100% {
|
|
61
|
-
opacity: 1;
|
|
62
|
-
box-shadow: 0 0 0 0 transparent;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
@keyframes badge-pop {
|
|
67
|
-
0% {
|
|
68
|
-
transform: scale(0.8);
|
|
69
|
-
opacity: 0;
|
|
70
|
-
}
|
|
71
|
-
50% {
|
|
72
|
-
transform: scale(1.1);
|
|
73
|
-
}
|
|
74
|
-
100% {
|
|
75
|
-
transform: scale(1);
|
|
76
|
-
opacity: 1;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.badge {
|
|
81
|
-
position: fixed;
|
|
82
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
83
|
-
font-size: 10px;
|
|
84
|
-
font-weight: bold;
|
|
41
|
+
.label {
|
|
42
|
+
position: absolute;
|
|
43
|
+
font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
|
|
44
|
+
font-size: 11px;
|
|
45
|
+
font-weight: 600;
|
|
85
46
|
padding: 2px 6px;
|
|
86
|
-
border-radius:
|
|
47
|
+
border-radius: 3px;
|
|
87
48
|
color: white;
|
|
88
|
-
pointer-events: none;
|
|
89
|
-
z-index: 2;
|
|
90
49
|
white-space: nowrap;
|
|
50
|
+
line-height: 1.2;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.label-name {
|
|
54
|
+
top: -20px;
|
|
55
|
+
left: 0;
|
|
91
56
|
}
|
|
92
57
|
|
|
93
|
-
.
|
|
58
|
+
.label-count {
|
|
59
|
+
top: -20px;
|
|
60
|
+
right: 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.label-count.bump {
|
|
64
|
+
animation: bump 0.2s ease-out;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@keyframes bump {
|
|
68
|
+
0% { transform: scale(1); }
|
|
69
|
+
50% { transform: scale(1.2); }
|
|
70
|
+
100% { transform: scale(1); }
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Panel styles */
|
|
74
|
+
.panel {
|
|
94
75
|
position: fixed;
|
|
95
|
-
top:
|
|
96
|
-
right:
|
|
97
|
-
background: rgba(
|
|
98
|
-
border
|
|
99
|
-
|
|
76
|
+
top: 12px;
|
|
77
|
+
right: 12px;
|
|
78
|
+
background: linear-gradient(135deg, rgba(17, 17, 23, 0.98) 0%, rgba(12, 12, 18, 0.98) 100%);
|
|
79
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
80
|
+
border-radius: 12px;
|
|
100
81
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
101
82
|
font-size: 12px;
|
|
102
|
-
color:
|
|
83
|
+
color: #e5e7eb;
|
|
103
84
|
pointer-events: auto;
|
|
104
85
|
z-index: 10;
|
|
105
|
-
cursor: move;
|
|
106
86
|
user-select: none;
|
|
87
|
+
width: 320px;
|
|
88
|
+
max-height: 480px;
|
|
89
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
|
|
90
|
+
backdrop-filter: blur(12px);
|
|
91
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
92
|
+
overflow: hidden;
|
|
107
93
|
}
|
|
108
94
|
|
|
109
|
-
.
|
|
95
|
+
.panel.collapsed {
|
|
96
|
+
width: 48px;
|
|
97
|
+
height: 48px;
|
|
98
|
+
border-radius: 50%;
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
justify-content: center;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.panel.collapsed:hover {
|
|
106
|
+
transform: scale(1.08);
|
|
107
|
+
box-shadow: 0 8px 32px rgba(34, 197, 94, 0.3);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.panel.collapsed .panel-content {
|
|
111
|
+
display: none;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.panel-icon {
|
|
115
|
+
display: none;
|
|
116
|
+
width: 28px;
|
|
117
|
+
height: 28px;
|
|
118
|
+
fill: #22c55e;
|
|
119
|
+
filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.5));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.panel.collapsed .panel-icon {
|
|
123
|
+
display: block;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.panel-content {
|
|
127
|
+
display: flex;
|
|
128
|
+
flex-direction: column;
|
|
129
|
+
pointer-events: auto;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* Header */
|
|
133
|
+
.panel-header {
|
|
110
134
|
display: flex;
|
|
111
135
|
align-items: center;
|
|
112
136
|
justify-content: space-between;
|
|
113
|
-
|
|
137
|
+
padding: 12px 14px;
|
|
138
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
|
139
|
+
cursor: move;
|
|
140
|
+
background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
|
|
114
141
|
}
|
|
115
142
|
|
|
116
|
-
.
|
|
117
|
-
|
|
118
|
-
|
|
143
|
+
.panel-brand {
|
|
144
|
+
display: flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
gap: 8px;
|
|
119
147
|
}
|
|
120
148
|
|
|
121
|
-
.
|
|
122
|
-
|
|
149
|
+
.panel-logo {
|
|
150
|
+
width: 20px;
|
|
151
|
+
height: 20px;
|
|
152
|
+
fill: #22c55e;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.panel-title {
|
|
156
|
+
font-weight: 700;
|
|
157
|
+
font-size: 13px;
|
|
158
|
+
background: linear-gradient(135deg, #22c55e 0%, #4ade80 100%);
|
|
159
|
+
-webkit-background-clip: text;
|
|
160
|
+
-webkit-text-fill-color: transparent;
|
|
161
|
+
background-clip: text;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.panel-status {
|
|
165
|
+
display: flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
gap: 6px;
|
|
168
|
+
font-size: 10px;
|
|
169
|
+
color: #6b7280;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.status-dot {
|
|
173
|
+
width: 6px;
|
|
174
|
+
height: 6px;
|
|
175
|
+
border-radius: 50%;
|
|
176
|
+
background: #22c55e;
|
|
177
|
+
box-shadow: 0 0 8px #22c55e;
|
|
178
|
+
animation: pulse 2s infinite;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
@keyframes pulse {
|
|
182
|
+
0%, 100% { opacity: 1; }
|
|
183
|
+
50% { opacity: 0.5; }
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.panel-actions {
|
|
187
|
+
display: flex;
|
|
188
|
+
gap: 4px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.panel-btn {
|
|
192
|
+
background: rgba(255, 255, 255, 0.05);
|
|
123
193
|
border: none;
|
|
194
|
+
border-radius: 6px;
|
|
124
195
|
color: #9ca3af;
|
|
196
|
+
width: 28px;
|
|
197
|
+
height: 28px;
|
|
125
198
|
cursor: pointer;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
199
|
+
display: flex;
|
|
200
|
+
align-items: center;
|
|
201
|
+
justify-content: center;
|
|
202
|
+
transition: all 0.15s;
|
|
129
203
|
}
|
|
130
204
|
|
|
131
|
-
.
|
|
205
|
+
.panel-btn:hover {
|
|
206
|
+
background: rgba(255, 255, 255, 0.1);
|
|
132
207
|
color: white;
|
|
133
208
|
}
|
|
134
209
|
|
|
135
|
-
.
|
|
210
|
+
.panel-btn svg {
|
|
211
|
+
width: 14px;
|
|
212
|
+
height: 14px;
|
|
213
|
+
fill: currentColor;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* Tabs */
|
|
217
|
+
.panel-tabs {
|
|
218
|
+
display: flex;
|
|
219
|
+
padding: 0 8px;
|
|
220
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
|
221
|
+
background: rgba(0, 0, 0, 0.2);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.tab {
|
|
225
|
+
flex: 1;
|
|
226
|
+
padding: 10px 8px;
|
|
227
|
+
background: none;
|
|
228
|
+
border: none;
|
|
229
|
+
color: #6b7280;
|
|
230
|
+
font-size: 11px;
|
|
231
|
+
font-weight: 500;
|
|
232
|
+
cursor: pointer;
|
|
233
|
+
transition: all 0.15s;
|
|
234
|
+
position: relative;
|
|
235
|
+
display: flex;
|
|
236
|
+
flex-direction: column;
|
|
237
|
+
align-items: center;
|
|
238
|
+
gap: 4px;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.tab svg {
|
|
242
|
+
width: 16px;
|
|
243
|
+
height: 16px;
|
|
244
|
+
fill: currentColor;
|
|
245
|
+
opacity: 0.7;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.tab:hover {
|
|
249
|
+
color: #d1d5db;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.tab.active {
|
|
253
|
+
color: #22c55e;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.tab.active svg {
|
|
257
|
+
opacity: 1;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.tab.active::after {
|
|
261
|
+
content: '';
|
|
262
|
+
position: absolute;
|
|
263
|
+
bottom: 0;
|
|
264
|
+
left: 50%;
|
|
265
|
+
transform: translateX(-50%);
|
|
266
|
+
width: 24px;
|
|
267
|
+
height: 2px;
|
|
268
|
+
background: linear-gradient(90deg, #22c55e, #4ade80);
|
|
269
|
+
border-radius: 2px;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/* Tab content */
|
|
273
|
+
.tab-content {
|
|
274
|
+
display: none;
|
|
275
|
+
padding: 12px;
|
|
276
|
+
overflow-y: auto;
|
|
277
|
+
max-height: 340px;
|
|
278
|
+
pointer-events: auto;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.tab-content.active {
|
|
282
|
+
display: block;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.tab-content::-webkit-scrollbar {
|
|
286
|
+
width: 4px;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.tab-content::-webkit-scrollbar-track {
|
|
290
|
+
background: transparent;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.tab-content::-webkit-scrollbar-thumb {
|
|
294
|
+
background: rgba(255, 255, 255, 0.1);
|
|
295
|
+
border-radius: 2px;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/* Overview tab */
|
|
299
|
+
.stats-grid {
|
|
136
300
|
display: grid;
|
|
137
301
|
grid-template-columns: repeat(2, 1fr);
|
|
138
302
|
gap: 8px;
|
|
303
|
+
margin-bottom: 12px;
|
|
139
304
|
}
|
|
140
305
|
|
|
141
|
-
.stat {
|
|
306
|
+
.stat-card {
|
|
307
|
+
background: rgba(255, 255, 255, 0.03);
|
|
308
|
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
309
|
+
border-radius: 8px;
|
|
310
|
+
padding: 12px;
|
|
142
311
|
text-align: center;
|
|
143
312
|
}
|
|
144
313
|
|
|
314
|
+
.stat-card.wide {
|
|
315
|
+
grid-column: span 2;
|
|
316
|
+
}
|
|
317
|
+
|
|
145
318
|
.stat-value {
|
|
146
|
-
font-size:
|
|
147
|
-
font-weight:
|
|
319
|
+
font-size: 24px;
|
|
320
|
+
font-weight: 700;
|
|
321
|
+
font-family: ui-monospace, monospace;
|
|
322
|
+
line-height: 1;
|
|
323
|
+
margin-bottom: 4px;
|
|
148
324
|
}
|
|
149
325
|
|
|
150
326
|
.stat-label {
|
|
151
327
|
font-size: 10px;
|
|
152
|
-
color: #
|
|
328
|
+
color: #6b7280;
|
|
153
329
|
text-transform: uppercase;
|
|
330
|
+
letter-spacing: 0.5px;
|
|
154
331
|
}
|
|
155
332
|
|
|
156
|
-
.stat-critical .stat-value { color: #ef4444; }
|
|
157
|
-
.stat-warning .stat-value { color: #
|
|
158
|
-
.stat-healthy .stat-value { color: #22c55e; }
|
|
333
|
+
.stat-card.critical .stat-value { color: #ef4444; }
|
|
334
|
+
.stat-card.warning .stat-value { color: #f97316; }
|
|
335
|
+
.stat-card.healthy .stat-value { color: #22c55e; }
|
|
336
|
+
.stat-card.info .stat-value { color: #3b82f6; }
|
|
159
337
|
|
|
160
|
-
.
|
|
338
|
+
.fps-bar {
|
|
339
|
+
height: 4px;
|
|
340
|
+
background: rgba(255, 255, 255, 0.1);
|
|
341
|
+
border-radius: 2px;
|
|
161
342
|
margin-top: 8px;
|
|
343
|
+
overflow: hidden;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.fps-bar-fill {
|
|
347
|
+
height: 100%;
|
|
348
|
+
border-radius: 2px;
|
|
349
|
+
transition: width 0.3s, background 0.3s;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.quick-actions {
|
|
162
353
|
display: flex;
|
|
163
|
-
gap:
|
|
354
|
+
gap: 8px;
|
|
355
|
+
margin-top: 12px;
|
|
164
356
|
}
|
|
165
357
|
|
|
166
|
-
.
|
|
358
|
+
.action-btn {
|
|
359
|
+
flex: 1;
|
|
360
|
+
padding: 10px;
|
|
361
|
+
background: rgba(255, 255, 255, 0.05);
|
|
362
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
363
|
+
border-radius: 8px;
|
|
364
|
+
color: #d1d5db;
|
|
365
|
+
font-size: 11px;
|
|
366
|
+
font-weight: 500;
|
|
367
|
+
cursor: pointer;
|
|
368
|
+
transition: all 0.15s;
|
|
369
|
+
display: flex;
|
|
370
|
+
align-items: center;
|
|
371
|
+
justify-content: center;
|
|
372
|
+
gap: 6px;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.action-btn:hover {
|
|
167
376
|
background: rgba(255, 255, 255, 0.1);
|
|
168
|
-
border:
|
|
377
|
+
border-color: rgba(255, 255, 255, 0.15);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.action-btn.active {
|
|
381
|
+
background: rgba(34, 197, 94, 0.15);
|
|
382
|
+
border-color: rgba(34, 197, 94, 0.3);
|
|
383
|
+
color: #22c55e;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.action-btn svg {
|
|
387
|
+
width: 14px;
|
|
388
|
+
height: 14px;
|
|
389
|
+
fill: currentColor;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/* Components tab */
|
|
393
|
+
.component-list {
|
|
394
|
+
display: flex;
|
|
395
|
+
flex-direction: column;
|
|
396
|
+
gap: 6px;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.component-item {
|
|
400
|
+
display: flex;
|
|
401
|
+
align-items: center;
|
|
402
|
+
padding: 10px;
|
|
403
|
+
background: rgba(255, 255, 255, 0.02);
|
|
404
|
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
405
|
+
border-radius: 8px;
|
|
406
|
+
cursor: pointer;
|
|
407
|
+
transition: all 0.15s;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.component-item:hover {
|
|
411
|
+
background: rgba(255, 255, 255, 0.05);
|
|
412
|
+
border-color: rgba(255, 255, 255, 0.1);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.component-severity {
|
|
416
|
+
width: 4px;
|
|
417
|
+
height: 32px;
|
|
418
|
+
border-radius: 2px;
|
|
419
|
+
margin-right: 10px;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.component-info {
|
|
423
|
+
flex: 1;
|
|
424
|
+
min-width: 0;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.component-name {
|
|
428
|
+
font-weight: 600;
|
|
429
|
+
font-size: 12px;
|
|
430
|
+
color: #e5e7eb;
|
|
431
|
+
white-space: nowrap;
|
|
432
|
+
overflow: hidden;
|
|
433
|
+
text-overflow: ellipsis;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.component-meta {
|
|
437
|
+
font-size: 10px;
|
|
438
|
+
color: #6b7280;
|
|
439
|
+
margin-top: 2px;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.component-count {
|
|
443
|
+
font-family: ui-monospace, monospace;
|
|
444
|
+
font-size: 14px;
|
|
445
|
+
font-weight: 700;
|
|
446
|
+
padding: 4px 10px;
|
|
447
|
+
border-radius: 6px;
|
|
448
|
+
background: rgba(255, 255, 255, 0.05);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.empty-state {
|
|
452
|
+
text-align: center;
|
|
453
|
+
padding: 32px 16px;
|
|
454
|
+
color: #6b7280;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.empty-state svg {
|
|
458
|
+
width: 40px;
|
|
459
|
+
height: 40px;
|
|
460
|
+
fill: currentColor;
|
|
461
|
+
opacity: 0.3;
|
|
462
|
+
margin-bottom: 12px;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/* Chains tab */
|
|
466
|
+
.chain-item {
|
|
467
|
+
padding: 12px;
|
|
468
|
+
background: rgba(255, 255, 255, 0.02);
|
|
469
|
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
470
|
+
border-radius: 8px;
|
|
471
|
+
margin-bottom: 8px;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.chain-header {
|
|
475
|
+
display: flex;
|
|
476
|
+
align-items: center;
|
|
477
|
+
justify-content: space-between;
|
|
478
|
+
margin-bottom: 8px;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.chain-trigger {
|
|
482
|
+
font-weight: 600;
|
|
483
|
+
color: #f97316;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.chain-count {
|
|
487
|
+
font-size: 10px;
|
|
488
|
+
color: #6b7280;
|
|
489
|
+
background: rgba(255, 255, 255, 0.05);
|
|
490
|
+
padding: 2px 8px;
|
|
169
491
|
border-radius: 4px;
|
|
170
|
-
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.chain-flow {
|
|
495
|
+
display: flex;
|
|
496
|
+
flex-wrap: wrap;
|
|
497
|
+
align-items: center;
|
|
498
|
+
gap: 4px;
|
|
499
|
+
font-size: 11px;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.chain-node {
|
|
171
503
|
padding: 4px 8px;
|
|
504
|
+
background: rgba(255, 255, 255, 0.05);
|
|
505
|
+
border-radius: 4px;
|
|
506
|
+
color: #d1d5db;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.chain-arrow {
|
|
510
|
+
color: #6b7280;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/* Settings tab */
|
|
514
|
+
.setting-group {
|
|
515
|
+
margin-bottom: 16px;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
.setting-label {
|
|
519
|
+
font-size: 11px;
|
|
520
|
+
font-weight: 500;
|
|
521
|
+
color: #9ca3af;
|
|
522
|
+
margin-bottom: 8px;
|
|
523
|
+
text-transform: uppercase;
|
|
524
|
+
letter-spacing: 0.5px;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.setting-row {
|
|
528
|
+
display: flex;
|
|
529
|
+
align-items: center;
|
|
530
|
+
justify-content: space-between;
|
|
531
|
+
padding: 10px 12px;
|
|
532
|
+
background: rgba(255, 255, 255, 0.02);
|
|
533
|
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
534
|
+
border-radius: 8px;
|
|
535
|
+
margin-bottom: 6px;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.setting-name {
|
|
539
|
+
font-size: 12px;
|
|
540
|
+
color: #e5e7eb;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.setting-desc {
|
|
172
544
|
font-size: 10px;
|
|
545
|
+
color: #6b7280;
|
|
546
|
+
margin-top: 2px;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/* Toggle switch */
|
|
550
|
+
.toggle {
|
|
551
|
+
position: relative;
|
|
552
|
+
width: 40px;
|
|
553
|
+
height: 22px;
|
|
554
|
+
background: rgba(255, 255, 255, 0.1);
|
|
555
|
+
border-radius: 11px;
|
|
173
556
|
cursor: pointer;
|
|
557
|
+
transition: background 0.2s;
|
|
174
558
|
}
|
|
175
559
|
|
|
176
|
-
.
|
|
177
|
-
background:
|
|
560
|
+
.toggle.active {
|
|
561
|
+
background: #22c55e;
|
|
178
562
|
}
|
|
179
563
|
|
|
180
|
-
.
|
|
181
|
-
|
|
564
|
+
.toggle::after {
|
|
565
|
+
content: '';
|
|
566
|
+
position: absolute;
|
|
567
|
+
top: 3px;
|
|
568
|
+
left: 3px;
|
|
569
|
+
width: 16px;
|
|
570
|
+
height: 16px;
|
|
571
|
+
background: white;
|
|
572
|
+
border-radius: 50%;
|
|
573
|
+
transition: transform 0.2s;
|
|
574
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
182
575
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
576
|
+
|
|
577
|
+
.toggle.active::after {
|
|
578
|
+
transform: translateX(18px);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/* Range slider */
|
|
582
|
+
.range-container {
|
|
583
|
+
display: flex;
|
|
584
|
+
align-items: center;
|
|
585
|
+
gap: 12px;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
.range-value {
|
|
589
|
+
font-family: ui-monospace, monospace;
|
|
590
|
+
font-size: 12px;
|
|
591
|
+
color: #22c55e;
|
|
592
|
+
min-width: 40px;
|
|
593
|
+
text-align: right;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
input[type="range"] {
|
|
597
|
+
flex: 1;
|
|
598
|
+
height: 4px;
|
|
599
|
+
-webkit-appearance: none;
|
|
600
|
+
background: rgba(255, 255, 255, 0.1);
|
|
601
|
+
border-radius: 2px;
|
|
602
|
+
outline: none;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
input[type="range"]::-webkit-slider-thumb {
|
|
606
|
+
-webkit-appearance: none;
|
|
607
|
+
width: 14px;
|
|
608
|
+
height: 14px;
|
|
609
|
+
background: #22c55e;
|
|
610
|
+
border-radius: 50%;
|
|
611
|
+
cursor: pointer;
|
|
612
|
+
box-shadow: 0 2px 6px rgba(34, 197, 94, 0.4);
|
|
613
|
+
}
|
|
614
|
+
`,this.shadowRoot.appendChild(e);}createToolbar(){this.shadowRoot&&(this.toolbar=document.createElement("div"),this.toolbar.className="panel",this.toolbar.innerHTML=`
|
|
615
|
+
<!-- Collapsed icon -->
|
|
616
|
+
<svg class="panel-icon" viewBox="0 0 24 24">
|
|
617
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/>
|
|
618
|
+
</svg>
|
|
619
|
+
|
|
620
|
+
<div class="panel-content">
|
|
621
|
+
<!-- Header -->
|
|
622
|
+
<div class="panel-header">
|
|
623
|
+
<div class="panel-brand">
|
|
624
|
+
<svg class="panel-logo" viewBox="0 0 24 24">
|
|
625
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/>
|
|
626
|
+
</svg>
|
|
627
|
+
<span class="panel-title">ReactCheck</span>
|
|
628
|
+
</div>
|
|
629
|
+
<div class="panel-status">
|
|
630
|
+
<span class="status-dot"></span>
|
|
631
|
+
<span id="rc-duration">0:00</span>
|
|
632
|
+
</div>
|
|
633
|
+
<div class="panel-actions">
|
|
634
|
+
<button class="panel-btn" id="rc-collapse" title="Minimize">
|
|
635
|
+
<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>
|
|
636
|
+
</button>
|
|
637
|
+
</div>
|
|
638
|
+
</div>
|
|
639
|
+
|
|
640
|
+
<!-- Tabs -->
|
|
641
|
+
<div class="panel-tabs">
|
|
642
|
+
<button class="tab active" data-tab="overview">
|
|
643
|
+
<svg viewBox="0 0 24 24"><path d="M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"/></svg>
|
|
644
|
+
Overview
|
|
645
|
+
</button>
|
|
646
|
+
<button class="tab" data-tab="components">
|
|
647
|
+
<svg viewBox="0 0 24 24"><path d="M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"/></svg>
|
|
648
|
+
Components
|
|
649
|
+
</button>
|
|
650
|
+
<button class="tab" data-tab="chains">
|
|
651
|
+
<svg viewBox="0 0 24 24"><path d="M17 7h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.43-.98 2.63-2.31 2.98l1.46 1.46C20.88 15.61 22 13.95 22 12c0-2.76-2.24-5-5-5zm-1 4h-2.19l2 2H16zM2 4.27l3.11 3.11C3.29 8.12 2 9.91 2 12c0 2.76 2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1 0-1.59 1.21-2.9 2.76-3.07L8.73 11H8v2h2.73L13 15.27V17h1.73l4.01 4.01 1.41-1.41L3.41 2.86 2 4.27z"/></svg>
|
|
652
|
+
Chains
|
|
653
|
+
</button>
|
|
654
|
+
<button class="tab" data-tab="settings">
|
|
655
|
+
<svg viewBox="0 0 24 24"><path d="M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/></svg>
|
|
656
|
+
Settings
|
|
657
|
+
</button>
|
|
658
|
+
</div>
|
|
659
|
+
|
|
660
|
+
<!-- Overview Tab -->
|
|
661
|
+
<div class="tab-content active" data-content="overview">
|
|
662
|
+
<div class="stats-grid">
|
|
663
|
+
<div class="stat-card critical">
|
|
664
|
+
<div class="stat-value" id="rc-critical">0</div>
|
|
665
|
+
<div class="stat-label">Critical</div>
|
|
666
|
+
</div>
|
|
667
|
+
<div class="stat-card warning">
|
|
668
|
+
<div class="stat-value" id="rc-warning">0</div>
|
|
669
|
+
<div class="stat-label">Warning</div>
|
|
670
|
+
</div>
|
|
671
|
+
<div class="stat-card healthy">
|
|
672
|
+
<div class="stat-value" id="rc-healthy">0</div>
|
|
673
|
+
<div class="stat-label">Healthy</div>
|
|
674
|
+
</div>
|
|
675
|
+
<div class="stat-card info">
|
|
676
|
+
<div class="stat-value" id="rc-renders">0</div>
|
|
677
|
+
<div class="stat-label">Renders</div>
|
|
678
|
+
</div>
|
|
679
|
+
<div class="stat-card wide">
|
|
680
|
+
<div class="stat-value" id="rc-fps">60</div>
|
|
681
|
+
<div class="stat-label">FPS</div>
|
|
682
|
+
<div class="fps-bar">
|
|
683
|
+
<div class="fps-bar-fill" id="rc-fps-bar" style="width: 100%; background: #22c55e;"></div>
|
|
684
|
+
</div>
|
|
685
|
+
</div>
|
|
686
|
+
</div>
|
|
687
|
+
|
|
688
|
+
<div class="quick-actions">
|
|
689
|
+
<button class="action-btn active" id="rc-toggle-highlights">
|
|
690
|
+
<svg viewBox="0 0 24 24"><path d="M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7z"/></svg>
|
|
691
|
+
Highlights
|
|
692
|
+
</button>
|
|
693
|
+
<button class="action-btn" id="rc-clear">
|
|
694
|
+
<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
|
|
695
|
+
Clear
|
|
696
|
+
</button>
|
|
697
|
+
</div>
|
|
192
698
|
</div>
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
699
|
+
|
|
700
|
+
<!-- Components Tab -->
|
|
701
|
+
<div class="tab-content" data-content="components">
|
|
702
|
+
<div class="component-list" id="rc-component-list">
|
|
703
|
+
<div class="empty-state">
|
|
704
|
+
<svg viewBox="0 0 24 24"><path d="M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"/></svg>
|
|
705
|
+
<div>No components rendered yet</div>
|
|
706
|
+
</div>
|
|
707
|
+
</div>
|
|
196
708
|
</div>
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
709
|
+
|
|
710
|
+
<!-- Chains Tab -->
|
|
711
|
+
<div class="tab-content" data-content="chains">
|
|
712
|
+
<div id="rc-chain-list">
|
|
713
|
+
<div class="empty-state">
|
|
714
|
+
<svg viewBox="0 0 24 24"><path d="M17 7h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.43-.98 2.63-2.31 2.98l1.46 1.46C20.88 15.61 22 13.95 22 12c0-2.76-2.24-5-5-5z"/></svg>
|
|
715
|
+
<div>No render chains detected</div>
|
|
716
|
+
</div>
|
|
717
|
+
</div>
|
|
200
718
|
</div>
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
719
|
+
|
|
720
|
+
<!-- Settings Tab -->
|
|
721
|
+
<div class="tab-content" data-content="settings">
|
|
722
|
+
<div class="setting-group">
|
|
723
|
+
<div class="setting-label">Display</div>
|
|
724
|
+
<div class="setting-row">
|
|
725
|
+
<div>
|
|
726
|
+
<div class="setting-name">Show Highlights</div>
|
|
727
|
+
<div class="setting-desc">Outline rendered components</div>
|
|
728
|
+
</div>
|
|
729
|
+
<div class="toggle active" id="rc-setting-highlights"></div>
|
|
730
|
+
</div>
|
|
731
|
+
</div>
|
|
732
|
+
|
|
733
|
+
<div class="setting-group">
|
|
734
|
+
<div class="setting-label">Timing</div>
|
|
735
|
+
<div class="setting-row">
|
|
736
|
+
<div>
|
|
737
|
+
<div class="setting-name">Highlight Duration</div>
|
|
738
|
+
<div class="setting-desc">How long highlights stay visible</div>
|
|
739
|
+
</div>
|
|
740
|
+
<div class="range-container">
|
|
741
|
+
<input type="range" id="rc-setting-duration" min="500" max="10000" step="500" value="2000">
|
|
742
|
+
<span class="range-value" id="rc-duration-value">2s</span>
|
|
743
|
+
</div>
|
|
744
|
+
</div>
|
|
745
|
+
</div>
|
|
746
|
+
|
|
747
|
+
<div class="setting-group">
|
|
748
|
+
<div class="setting-label">About</div>
|
|
749
|
+
<div class="setting-row" style="flex-direction: column; align-items: flex-start; gap: 4px;">
|
|
750
|
+
<div class="setting-name">ReactCheck v1.1.6</div>
|
|
751
|
+
<div class="setting-desc">React performance scanner</div>
|
|
752
|
+
</div>
|
|
753
|
+
</div>
|
|
204
754
|
</div>
|
|
205
755
|
</div>
|
|
206
|
-
|
|
207
|
-
<button class="toolbar-btn active" id="rc-highlights">Highlights</button>
|
|
208
|
-
<button class="toolbar-btn active" id="rc-badges">Badges</button>
|
|
209
|
-
<button class="toolbar-btn" id="rc-clear">Clear</button>
|
|
210
|
-
</div>
|
|
211
|
-
`,this.setupToolbarEvents(),this.makeDraggable(this.toolbar),this.shadowRoot.appendChild(this.toolbar));}setupToolbarEvents(){if(!this.toolbar||!this.shadowRoot)return;let e=this.toolbar.querySelector(".toolbar-close");e&&e.addEventListener("click",()=>{this.hide();});let t=this.shadowRoot.getElementById("rc-highlights");t&&t.addEventListener("click",()=>{this.config.highlightRenders=!this.config.highlightRenders,t.classList.toggle("active",this.config.highlightRenders),this.config.highlightRenders||this.clearHighlights();});let n=this.shadowRoot.getElementById("rc-badges");n&&n.addEventListener("click",()=>{this.config.showBadges=!this.config.showBadges,n.classList.toggle("active",this.config.showBadges),this.config.showBadges||this.clearBadges();});let o=this.shadowRoot.getElementById("rc-clear");o&&o.addEventListener("click",()=>{this.clear();});}makeDraggable(e){let t=false,n=0,o=0,r=0,a=0;e.addEventListener("mousedown",s=>{s.target.tagName!=="BUTTON"&&(t=true,n=s.clientX,o=s.clientY,r=e.offsetLeft,a=e.offsetTop);}),document.addEventListener("mousemove",s=>{if(!t)return;let c=s.clientX-n,u=s.clientY-o;e.style.left=`${r+c}px`,e.style.top=`${a+u}px`,e.style.right="auto";}),document.addEventListener("mouseup",()=>{t=false;});}highlight(e,t){if(!this.config.highlightRenders||!this.shadowRoot||!this.visible)return;let n=t.getBoundingClientRect();if(n.width===0||n.height===0)return;let o=this.getSeverity(e),r=T[o],a=L[o];this.createFlashOverlay(n,a);let s=this.highlights.get(e.componentName);s||(s=document.createElement("div"),s.className="highlight",this.shadowRoot.appendChild(s),this.highlights.set(e.componentName,s)),s.style.animation="none",s.offsetHeight,s.style.animation="",s.style.cssText=`
|
|
212
|
-
position: fixed;
|
|
213
|
-
left: ${n.left}px;
|
|
214
|
-
top: ${n.top}px;
|
|
215
|
-
width: ${n.width}px;
|
|
216
|
-
height: ${n.height}px;
|
|
217
|
-
border: 2px solid ${r};
|
|
218
|
-
color: ${r};
|
|
219
|
-
pointer-events: none;
|
|
220
|
-
z-index: 1;
|
|
221
|
-
animation: highlight-pulse 0.5s ease-out;
|
|
222
|
-
`,s.classList.remove("fade");let c=E[this.config.animationSpeed];c>0&&setTimeout(()=>{s?.classList.add("fade");},c),this.config.showBadges&&this.updateBadge(e,n,r),this.updateStats();}createFlashOverlay(e,t){if(!this.shadowRoot)return;let n=document.createElement("div");n.className="flash-overlay",n.style.cssText=`
|
|
223
|
-
left: ${e.left}px;
|
|
224
|
-
top: ${e.top}px;
|
|
225
|
-
width: ${e.width}px;
|
|
226
|
-
height: ${e.height}px;
|
|
227
|
-
background: ${t};
|
|
228
|
-
`,this.shadowRoot.appendChild(n),setTimeout(()=>{n.remove();},500);}updateBadge(e,t,n){if(!this.shadowRoot)return;let o=(this.renderCounts.get(e.componentName)??0)+1;this.renderCounts.set(e.componentName,o);let r=this.badges.get(e.componentName);r||(r=document.createElement("div"),r.className="badge",this.shadowRoot.appendChild(r),this.badges.set(e.componentName,r));let a=!this.badges.has(e.componentName);r.textContent=`${e.componentName}: ${o}`,r.style.cssText=`
|
|
229
|
-
position: fixed;
|
|
756
|
+
`,this.shadowRoot.appendChild(this.toolbar),this.setupToolbarEvents(),this.makeDraggable(this.toolbar));}setupToolbarEvents(){if(!this.toolbar||!this.shadowRoot)return;let e=this.shadowRoot.getElementById("rc-collapse");e&&e.addEventListener("click",c=>{c.stopPropagation(),this.toggleCollapse();}),this.toolbar.addEventListener("click",c=>{let h=c.target;this.collapsed&&(h===this.toolbar||h.closest(".panel-icon"))&&this.toggleCollapse();}),this.toolbar.querySelectorAll(".tab").forEach(c=>{c.addEventListener("click",()=>{let h=c.getAttribute("data-tab");this.switchTab(h);});});let n=this.shadowRoot.getElementById("rc-toggle-highlights");n&&n.addEventListener("click",()=>{this.config.highlightRenders=!this.config.highlightRenders,n.classList.toggle("active",this.config.highlightRenders),this.updateHighlightsVisibility();});let i=this.shadowRoot.getElementById("rc-clear");i&&i.addEventListener("click",()=>{this.clear();});let o=this.shadowRoot.getElementById("rc-setting-highlights");o&&o.addEventListener("click",()=>{this.config.highlightRenders=!this.config.highlightRenders,o.classList.toggle("active",this.config.highlightRenders),n?.classList.toggle("active",this.config.highlightRenders),this.updateHighlightsVisibility();});let s=this.shadowRoot.getElementById("rc-setting-duration"),a=this.shadowRoot.getElementById("rc-duration-value");s&&a&&s.addEventListener("input",()=>{let c=parseInt(s.value,10);this.config.highlightDuration=c,a.textContent=c>=1e3?`${c/1e3}s`:`${c}ms`;});}toggleCollapse(){this.collapsed=!this.collapsed,this.toolbar&&this.toolbar.classList.toggle("collapsed",this.collapsed);}switchTab(e){if(!this.toolbar)return;this.toolbar.querySelectorAll(".tab").forEach(i=>{let o=i.getAttribute("data-tab")===e;i.classList.toggle("active",o);}),this.toolbar.querySelectorAll(".tab-content").forEach(i=>{let o=i.getAttribute("data-content")===e;i.classList.toggle("active",o);}),e==="components"?this.updateComponentList():e==="chains"&&this.updateChainList();}updateHighlightsVisibility(){for(let e of this.trackedComponents.values())e.highlightEl.style.display=this.config.highlightRenders?"block":"none";}makeDraggable(e){let t=false,n=0,i=0,o=0,s=0,a=e.querySelector(".panel-header");if(!a)return;a.addEventListener("mousedown",h=>{let p=h;p.target.closest(".panel-btn")||(t=true,n=p.clientX,i=p.clientY,o=e.offsetLeft,s=e.offsetTop);}),this.documentListeners??(this.documentListeners=new AbortController);let{signal:c}=this.documentListeners;document.addEventListener("mousemove",h=>{if(!t)return;let p=h.clientX-n,u=h.clientY-i;e.style.left=`${o+p}px`,e.style.top=`${s+u}px`,e.style.right="auto";},{signal:c}),document.addEventListener("mouseup",()=>{t=false;},{signal:c});}highlight(e,t){if(!this.shadowRoot||!this.visible||g.SKIP_COMPONENTS.has(e.componentName))return;let n=t.getBoundingClientRect();if(n.width===0||n.height===0)return;if(this.trackedComponents.size>=g.MAX_HIGHLIGHTS&&!this.trackedComponents.has(e.componentName)){let c=this.getOldestTrackedComponent();c&&this.removeHighlight(c);}this.totalRenders++;let i=this.getSeverity(e),o=E[i],s=this.trackedComponents.get(e.componentName);if(s){s.count++,s.element=t,s.lastRender=Date.now(),s.severity=i,s.renderTimes.push(e.renderTime),s.renderTimes.length>100&&s.renderTimes.shift(),this.updateHighlightPosition(s,n,o);let c=s.highlightEl.querySelector(".label-count");c&&(c.classList.remove("bump"),c.offsetWidth,c.classList.add("bump"));}else {let c=this.createHighlightElement(e.componentName,n,o);s={element:t,highlightEl:c,lastRender:Date.now(),count:1,severity:i,renderTimes:[e.renderTime]},this.trackedComponents.set(e.componentName,s),this.shadowRoot.appendChild(c);}let a=s.highlightEl.querySelector(".label-count");a&&(a.textContent=`\xD7${s.count}`),this.updateHighlightColor(s.highlightEl,o),this.resetFadeTimeout(e.componentName,s);}addChain(e){this.renderChains.unshift(e),this.renderChains.length>50&&this.renderChains.pop();}updateFps(e){this.fps=e;}createHighlightElement(e,t,n){let i=document.createElement("div");i.className="highlight-container",i.style.cssText=`
|
|
230
757
|
left: ${t.left}px;
|
|
231
|
-
top: ${
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
758
|
+
top: ${t.top}px;
|
|
759
|
+
width: ${t.width}px;
|
|
760
|
+
height: ${t.height}px;
|
|
761
|
+
color: ${n};
|
|
762
|
+
display: ${this.config.highlightRenders?"block":"none"};
|
|
763
|
+
`;let o=document.createElement("div");o.className="highlight-border",i.appendChild(o);let s=document.createElement("div");s.className="label label-name",s.style.background=n,s.textContent=e,i.appendChild(s);let a=document.createElement("div");return a.className="label label-count",a.style.background=n,a.textContent="\xD71",i.appendChild(a),i}updateHighlightPosition(e,t,n){e.highlightEl.style.left=`${t.left}px`,e.highlightEl.style.top=`${t.top}px`,e.highlightEl.style.width=`${t.width}px`,e.highlightEl.style.height=`${t.height}px`,e.highlightEl.style.color=n,e.highlightEl.classList.remove("fade");}updateHighlightColor(e,t){e.style.color=t,e.querySelectorAll(".label").forEach(i=>{i.style.background=t;});}resetFadeTimeout(e,t){let n=this.fadeTimeouts.get(e);if(n&&clearTimeout(n),this.config.highlightDuration>0){let i=setTimeout(()=>{t.highlightEl.classList.add("fade"),this.fadeTimeouts.delete(e);},this.config.highlightDuration);this.fadeTimeouts.set(e,i);}}getOldestTrackedComponent(){let e=null,t=1/0;for(let[n,i]of this.trackedComponents)i.lastRender<t&&(t=i.lastRender,e=n);return e}removeHighlight(e){let t=this.trackedComponents.get(e);if(t){t.highlightEl.remove(),this.trackedComponents.delete(e);let n=this.fadeTimeouts.get(e);n&&(clearTimeout(n),this.fadeTimeouts.delete(e));}}getSeverity(e){return e.necessary?e.renderCount>50?"critical":e.renderCount>20?"warning":"healthy":"unnecessary"}recordRender(e){let t=this.trackedComponents.get(e.componentName);if(t){t.count++,t.lastRender=Date.now(),t.severity=this.getSeverity(e);let n=t.highlightEl.querySelector(".label-count");n&&(n.textContent=`\xD7${t.count}`);}this.totalRenders++;}updateStats(){if(!this.shadowRoot)return;let e=0,t=0,n=0;for(let u of this.trackedComponents.values())u.count>50?e++:u.count>20?t++:n++;let i=this.shadowRoot.getElementById("rc-critical"),o=this.shadowRoot.getElementById("rc-warning"),s=this.shadowRoot.getElementById("rc-healthy"),a=this.shadowRoot.getElementById("rc-renders"),c=this.shadowRoot.getElementById("rc-fps"),h=this.shadowRoot.getElementById("rc-fps-bar"),p=this.shadowRoot.getElementById("rc-duration");if(i&&(i.textContent=String(e)),o&&(o.textContent=String(t)),s&&(s.textContent=String(n)),a&&(a.textContent=String(this.totalRenders)),c&&(c.textContent=String(Math.round(this.fps))),h){let u=Math.min(100,this.fps/60*100);h.style.width=`${u}%`,this.fps>=50?h.style.background="#22c55e":this.fps>=30?h.style.background="#f97316":h.style.background="#ef4444";}if(p){let u=Math.floor((Date.now()-this.startTime)/1e3),H=Math.floor(u/60),F=u%60;p.textContent=`${H}:${F.toString().padStart(2,"0")}`;}}updateComponentList(){if(!this.shadowRoot)return;let e=this.shadowRoot.getElementById("rc-component-list");if(!e)return;let t=Array.from(this.trackedComponents.entries()).sort((n,i)=>i[1].count-n[1].count);if(t.length===0){e.innerHTML=`
|
|
764
|
+
<div class="empty-state">
|
|
765
|
+
<svg viewBox="0 0 24 24"><path d="M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"/></svg>
|
|
766
|
+
<div>No components rendered yet</div>
|
|
767
|
+
</div>
|
|
768
|
+
`;return}e.innerHTML=t.map(([n,i])=>{let o=E[i.severity],s=i.renderTimes.length>0?(i.renderTimes.reduce((h,p)=>h+p,0)/i.renderTimes.length).toFixed(1):"0",a=Math.floor((Date.now()-i.lastRender)/1e3),c=a<60?`${a}s ago`:`${Math.floor(a/60)}m ago`;return `
|
|
769
|
+
<div class="component-item">
|
|
770
|
+
<div class="component-severity" style="background: ${o}"></div>
|
|
771
|
+
<div class="component-info">
|
|
772
|
+
<div class="component-name">${x(n)}</div>
|
|
773
|
+
<div class="component-meta">${s}ms avg \xB7 ${c}</div>
|
|
774
|
+
</div>
|
|
775
|
+
<div class="component-count" style="color: ${o}">${i.count}</div>
|
|
776
|
+
</div>
|
|
777
|
+
`}).join("");}updateChainList(){if(!this.shadowRoot)return;let e=this.shadowRoot.getElementById("rc-chain-list");if(e){if(this.renderChains.length===0){e.innerHTML=`
|
|
778
|
+
<div class="empty-state">
|
|
779
|
+
<svg viewBox="0 0 24 24"><path d="M17 7h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1 0 1.43-.98 2.63-2.31 2.98l1.46 1.46C20.88 15.61 22 13.95 22 12c0-2.76-2.24-5-5-5z"/></svg>
|
|
780
|
+
<div>No render chains detected</div>
|
|
781
|
+
</div>
|
|
782
|
+
`;return}e.innerHTML=this.renderChains.slice(0,10).map(t=>{let n=t.chain.map(i=>`<span class="chain-node">${x(i)}</span>`).join('<span class="chain-arrow">\u2192</span>');return `
|
|
783
|
+
<div class="chain-item">
|
|
784
|
+
<div class="chain-header">
|
|
785
|
+
<span class="chain-trigger">${x(t.trigger)}</span>
|
|
786
|
+
<span class="chain-count">${t.chain.length} components</span>
|
|
787
|
+
</div>
|
|
788
|
+
<div class="chain-flow">${n}</div>
|
|
789
|
+
</div>
|
|
790
|
+
`}).join("");}}clear(){for(let e of this.fadeTimeouts.values())clearTimeout(e);this.fadeTimeouts.clear();for(let e of this.trackedComponents.values())e.highlightEl.remove();this.trackedComponents.clear(),this.renderChains=[],this.totalRenders=0,this.startTime=Date.now(),this.updateStats(),this.updateComponentList(),this.updateChainList();}show(){this.host&&(this.host.style.display="block",this.visible=true);}hide(){this.host&&(this.host.style.display="none",this.visible=false);}toggle(){this.visible?this.hide():this.show();}configure(e){this.config={...this.config,...e};}isVisible(){return this.visible}getRenderCounts(){let e=new Map;for(let[t,n]of this.trackedComponents)e.set(t,n.count);return e}};l(g,"MAX_HIGHLIGHTS",50),l(g,"SKIP_COMPONENTS",new Set(["ForwardRef","Anonymous","Unknown","Fragment","Suspense","Context.Provider","Context.Consumer","Profiler","Root","#text"]));var m=g;function L(r,e){let t="",n="";for(let i of e)i==="*"&&n==="*"||(n=i,i==="*"?t+=".*":i==="?"?t+=".":t+=i.replace(/[.+^${}()|[\]\\]/g,"\\$&"));return new RegExp(`^${t}$`).test(r)}var N={trackUnnecessary:true,fpsThreshold:30,highlightRenders:true,animationSpeed:"fast"},y=class extends v{constructor(t={},n){super();l(this,"config");l(this,"running",false);l(this,"reactVersion","unknown");l(this,"renderCounts",new Map);l(this,"originalOnCommitFiberRoot",null);l(this,"win");l(this,"overlay",null);this.config={...N,...t},this.win=n??(typeof window<"u"?window:{});}getDOMElement(t){if(typeof Element>"u")return null;if(t.stateNode instanceof Element)return t.stateNode;let n=t.child;for(;n;){if(n.stateNode instanceof Element)return n.stateNode;if(n.child)n=n.child;else if(n.sibling)n=n.sibling;else {let i=n.return;for(;i&&i!==t&&!i.sibling;)i=i.return;n=i&&i!==t?i.sibling:null;}}return null}enableOverlay(){this.overlay||(this.overlay=new m({enabled:true,highlightRenders:this.config.highlightRenders??true,showToolbar:true}),this.overlay.init());}disableOverlay(){this.overlay&&(this.overlay.destroy(),this.overlay=null);}getOverlay(){return this.overlay}start(){if(!this.running)try{this.hookIntoReact(),this.running=!0;}catch(t){this.emit("error",t instanceof Error?t:new Error(String(t)));}}stop(){this.running&&(this.unhookFromReact(),this.disableOverlay(),this.running=false);}reset(){this.renderCounts.clear();}hookIntoReact(){let t=this.win.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t){this.installHook();return}let n=t.onCommitFiberRoot;this.originalOnCommitFiberRoot=n,t.onCommitFiberRoot=(i,o,s)=>{n.call(t,i,o,s),this.running&&this.processCommit(o.current);},this.reactVersion=this.detectReactVersion(t),this.emit("ready",{reactVersion:this.reactVersion});}installHook(){let t={renderers:new Map,supportsFiber:true,inject:n=>{let i=t.renderers.size+1;return t.renderers.set(i,n),i},onCommitFiberRoot:(n,i,o)=>{this.running&&this.processCommit(i.current);},onCommitFiberUnmount:()=>{}};this.win.__REACT_DEVTOOLS_GLOBAL_HOOK__=t,this.emit("ready",{reactVersion:"unknown (hook installed)"});}unhookFromReact(){let t=this.win.__REACT_DEVTOOLS_GLOBAL_HOOK__;t&&this.originalOnCommitFiberRoot&&(t.onCommitFiberRoot=this.originalOnCommitFiberRoot,this.originalOnCommitFiberRoot=null);}detectReactVersion(t){if(t.renderers.size===0)return "unknown";let n=t.renderers.values().next().value;return n&&typeof n=="object"&&"version"in n?String(n.version):"unknown"}processCommit(t){let n=[{fiber:t,parent:null}];for(;n.length>0;){let i=n.pop();if(!i)continue;let{fiber:o}=i,s=i.parent;o.sibling&&n.push({fiber:o.sibling,parent:i.parent}),k(o)&&(o.tag!==d.MemoComponent&&T(o)&&this.processFiber(o,s),s=b(o));let a=o.alternate;a&&o!==t&&o.child===a.child||o.child&&n.push({fiber:o.child,parent:s});}}processFiber(t,n){let i=b(t);if(this.shouldFilterComponent(i))return;let o=t.alternate??null,a=R(t,o?"update":"mount",o?o.memoizedProps??{}:null,o?o.memoizedState:void 0),h=(this.renderCounts.get(i)??0)+1;this.renderCounts.set(i,h),a.renderCount=h;let p=this.getDOMElement(t);this.overlay&&this.config.highlightRenders&&(p?this.overlay.highlight(a,p):this.overlay.recordRender(a)),this.emit("render",{render:a,element:p});}shouldFilterComponent(t){if(t.startsWith("__")||t==="Fragment"||t==="Suspense"||t==="Profiler")return true;let{include:n,exclude:i}=this.config;return !!(n&&n.length>0&&!n.some(s=>this.matchPattern(t,s))||i&&i.length>0&&i.some(s=>this.matchPattern(t,s)))}matchPattern(t,n){return L(t,n)}getConfig(){return {...this.config}}configure(t){this.config={...this.config,...t};}isRunning(){return this.running}getReactVersion(){return this.reactVersion}getRenderCount(t){return this.renderCounts.get(t)??0}getAllRenderCounts(){return new Map(this.renderCounts)}};var I=5e3,A=500,D=2e3,w=class{constructor(e){l(this,"scanner");l(this,"overlay");l(this,"ws",null);l(this,"wsPort");l(this,"reconnectTimeout",null);l(this,"initialized",false);l(this,"destroyed",false);l(this,"paused",false);l(this,"pendingCommits",[]);l(this,"messageQueue",[]);l(this,"rafHandle",null);l(this,"restoreHook",null);l(this,"win");this.win=e??window,this.wsPort=this.win.__REACTCHECK_PORT__??3099,this.scanner=new y({trackUnnecessary:true,highlightRenders:true,animationSpeed:"fast"},this.win),this.overlay=new m({enabled:true,highlightRenders:true,showToolbar:true});}handleCommit(e){if(!(this.destroyed||this.paused||!e?.current)){if(!this.initialized){this.pendingCommits.length>=A&&this.pendingCommits.shift(),this.pendingCommits.push(e.current);return}this.scanner.processCommit(e.current);}}init(){if(this.initialized||this.destroyed)return;this.initialized=true,this.overlay.init(),this.setupScannerEvents(),this.connect();let e=this.pendingCommits;this.pendingCommits=[];for(let t of e)this.scanner.processCommit(t);this.startFpsMeasurement(),console.log("[ReactCheck] Initialized");}setupScannerEvents(){this.scanner.on("render",({render:e,element:t})=>{this.send({type:"render",payload:e}),this.overlay.recordRender(e),t&&this.overlay.highlight(e,t);}),this.scanner.on("ready",e=>{this.send({type:"ready",payload:e});}),this.scanner.on("error",e=>{this.send({type:"error",payload:{message:e.message,code:"SCANNER_ERROR"}});});}startFpsMeasurement(){let e=this.win.requestAnimationFrame;if(typeof e!="function")return;let t=0,n=Date.now(),i=()=>{if(this.destroyed)return;t++;let o=Date.now(),s=o-n;if(s>=1e3){let a=Math.round(t*1e3/s);t=0,n=o,this.overlay.updateFps(a),this.paused||this.send({type:"fps",payload:a});}this.rafHandle=e.call(this.win,i);};this.rafHandle=e.call(this.win,i);}connect(){if(!this.destroyed){this.ws&&(this.detachSocket(this.ws),this.ws.close(),this.ws=null);try{let e=new WebSocket(`ws://localhost:${this.wsPort}`);this.ws=e,e.onopen=()=>{console.log("[ReactCheck] Connected to CLI"),this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.send({type:"ready",payload:{reactVersion:this.scanner.getReactVersion()}}),this.flushMessageQueue();},e.onmessage=t=>{try{let n=JSON.parse(t.data);this.handleMessage(n);}catch(n){console.warn("[ReactCheck] Invalid message:",n);}},e.onerror=t=>{console.warn("[ReactCheck] WebSocket error:",t);},e.onclose=()=>{console.log("[ReactCheck] Disconnected from CLI"),this.scheduleReconnect();};}catch(e){console.warn("[ReactCheck] Failed to connect:",e),this.scheduleReconnect();}}}detachSocket(e){e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null;}scheduleReconnect(){this.reconnectTimeout||this.destroyed||(this.reconnectTimeout=setTimeout(()=>{this.reconnectTimeout=null,!this.destroyed&&(console.log("[ReactCheck] Attempting to reconnect..."),this.connect());},D));}handleMessage(e){switch(e.type){case "start":this.paused=false,this.overlay.show();break;case "stop":this.paused=true;break;case "reset":this.scanner.reset(),this.overlay.clear();break;case "config":this.handleConfig(e.payload);break;case "highlight":break;case "toggle-overlay":this.handleToggleOverlay(e.payload.enabled);break}}handleToggleOverlay(e){e?(this.overlay.show(),this.overlay.configure({highlightRenders:true}),console.log("[ReactCheck] Overlay enabled")):(this.overlay.hide(),this.overlay.configure({highlightRenders:false}),console.log("[ReactCheck] Overlay disabled"));}isOverlayEnabled(){return this.overlay.isVisible()}toggleOverlay(){let e=!this.overlay.isVisible();this.handleToggleOverlay(e);}handleConfig(e){this.scanner.configure(e),e.highlightRenders!==void 0&&this.overlay.configure({highlightRenders:e.highlightRenders});}send(e){this.destroyed||(this.ws&&this.ws.readyState===WebSocket.OPEN?this.ws.send(JSON.stringify(e)):(this.messageQueue.length>=I&&this.messageQueue.shift(),this.messageQueue.push(e)));}flushMessageQueue(){if(this.ws&&this.ws.readyState===WebSocket.OPEN&&this.messageQueue.length>0){for(let e of this.messageQueue)this.ws.send(JSON.stringify(e));this.messageQueue=[];}}setHookRestorer(e){this.restoreHook=e;}destroy(){if(!this.destroyed){if(this.destroyed=true,this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.rafHandle!==null){let e=this.win.cancelAnimationFrame;typeof e=="function"&&e.call(this.win,this.rafHandle),this.rafHandle=null;}this.ws&&(this.detachSocket(this.ws),this.ws.close(),this.ws=null),this.restoreHook&&(this.restoreHook(),this.restoreHook=null),this.pendingCommits=[],this.messageQueue=[],this.scanner.stop(),this.scanner.removeAllListeners(),this.overlay.destroy(),this.initialized=false;}}};function S(r){let e=r.location.href;if(e==="about:blank"||e.startsWith("chrome://")||e.startsWith("chrome-extension://")||e.startsWith("devtools://")||r.__REACTCHECK_INJECTED__)return null;r.__REACTCHECK_INJECTED__=true;let t=new w(r),n=r.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(n){let o=n.onCommitFiberRoot;n.onCommitFiberRoot=(s,a,c)=>{o.call(n,s,a,c),t.handleCommit(a);},t.setHookRestorer(()=>{n.onCommitFiberRoot=o;}),console.log("[ReactCheck] Wrapped existing DevTools hook");}else {let o={renderers:new Map,supportsFiber:true,inject(s){let a=o.renderers.size+1;return o.renderers.set(a,s),a},onCommitFiberRoot(s,a){t.handleCommit(a);},onCommitFiberUnmount(){}};r.__REACT_DEVTOOLS_GLOBAL_HOOK__=o,t.setHookRestorer(()=>{o.onCommitFiberRoot=()=>{};}),console.log("[ReactCheck] DevTools hook installed");}let i=r.document;return i.readyState==="loading"?i.addEventListener("DOMContentLoaded",()=>{t.init();},{once:true}):t.init(),r.__REACTCHECK__=t,t}typeof window<"u"&&typeof document<"u"&&S(window);
|
|
791
|
+
})();
|