@oxog/react-check 1.1.6 → 1.2.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 +29 -1
- package/README.md +9 -3
- package/dist/browser-inject.global.js +705 -158
- package/dist/chain.d.cts +1 -1
- package/dist/chain.d.ts +1 -1
- package/dist/cli.js +493 -28
- package/dist/cli.js.map +1 -1
- package/dist/detect.d.cts +1 -1
- package/dist/detect.d.ts +1 -1
- package/dist/fix.d.cts +1 -1
- package/dist/fix.d.ts +1 -1
- package/dist/index.cjs +1124 -303
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +94 -43
- package/dist/index.d.ts +94 -43
- package/dist/index.js +1124 -303
- package/dist/index.js.map +1 -1
- package/dist/{scanner-CTBraprQ.d.ts → scanner-Cc2187fH.d.ts} +1 -1
- package/dist/{scanner-5j2LEM-q.d.cts → scanner-S7BtVIpW.d.cts} +1 -1
- package/dist/scanner.d.cts +2 -2
- package/dist/scanner.d.ts +2 -2
- package/dist/{types-xAXT9cir.d.cts → types-DuZyBVVV.d.cts} +1 -1
- package/dist/{types-xAXT9cir.d.ts → types-DuZyBVVV.d.ts} +1 -1
- package/package.json +7 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ReactCheckInjector=(function(exports){'use strict';var
|
|
1
|
+
var ReactCheckInjector=(function(exports){'use strict';var E=Object.defineProperty;var L=(c,e,t)=>e in c?E(c,e,{enumerable:true,configurable:true,writable:true,value:t}):c[e]=t;var l=(c,e,t)=>L(c,typeof e!="symbol"?e+"":e,t);var m=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 o of i)try{o(t),n=!0;}catch(r){if(e!=="error")this.emit("error",r);else throw r}let a=this._onceListeners.get(e);if(a){let o=Array.from(a);this._onceListeners.delete(e);for(let r of o)try{r(t),n=!0;}catch(s){if(e!=="error")this.emit("error",s);else throw s}}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 a,o=r=>{a&&clearTimeout(a),n(r);};this.once(e,o),t!==void 0&&t>0&&(a=setTimeout(()=>{this.off(e,o),i(new Error(`Timeout waiting for event "${String(e)}"`));},t));})}};var h={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(c){if(!c)return "Unknown";let{type:e,tag:t}=c;switch(t){case h.FunctionComponent:case h.ClassComponent:case h.SimpleMemoComponent:case h.IncompleteClassComponent:return f(e)||"Anonymous";case h.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 h.MemoComponent:if(e&&typeof e=="object"&&"type"in e){let n=e.type;return `Memo(${f(n)||"Anonymous"})`}return "Memo";case h.LazyComponent:return "Lazy";case h.ContextConsumer:return "Context.Consumer";case h.ContextProvider:return "Context.Provider";case h.SuspenseComponent:return "Suspense";case h.Fragment:return "Fragment";case h.Profiler:return "Profiler";case h.HostRoot:return "Root";case h.HostComponent:return typeof e=="string"?e:"HostComponent";case h.HostText:return "#text";default:return f(e)||"Unknown"}}function f(c){if(c!=null){if(typeof c=="string")return c;if(typeof c=="function")return c.displayName??c.name??void 0;if(typeof c=="object"){let e=c;return e.displayName??e.name??void 0}}}function x(c){let{tag:e}=c;return e===h.FunctionComponent||e===h.ClassComponent||e===h.MemoComponent||e===h.SimpleMemoComponent||e===h.ForwardRef||e===h.LazyComponent}function S(c,e){if(c===e)return [];if(!c||!e)return Object.keys(e??c??{});let t=[],n=new Set([...Object.keys(c),...Object.keys(e)]);for(let i of n)i!=="children"&&c[i]!==e[i]&&t.push(i);return t}function C(c,e,t,n){let i=b(c),a=c.actualDuration??0,o=t?S(t,c.memoizedProps):void 0,r=o&&o.length>0,s=n!==c.memoizedState,p={componentName:i,renderCount:1,renderTime:a,phase:e,necessary:e==="mount"||r||s,timestamp:Date.now()};return o!==void 0&&(p.changedProps=o),s&&(p.changedState=["state"]),p}var _={enabled:true,highlightRenders:true,showToolbar:true,highlightDuration:2e3},k={critical:"#ef4444",warning:"#f97316",info:"#3b82f6",healthy:"#22c55e",unnecessary:"#6b7280"},u=class u{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);this.config={..._,...e};}init(){if(!this.host){if(!document.body){this.initRetryCount<10&&(this.initRetryCount++,setTimeout(()=>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.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",s=>{s.stopPropagation(),this.toggleCollapse();}),this.toolbar.addEventListener("click",s=>{let d=s.target;this.collapsed&&(d===this.toolbar||d.closest(".panel-icon"))&&this.toggleCollapse();}),this.toolbar.querySelectorAll(".tab").forEach(s=>{s.addEventListener("click",()=>{let d=s.getAttribute("data-tab");this.switchTab(d);});});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 a=this.shadowRoot.getElementById("rc-setting-highlights");a&&a.addEventListener("click",()=>{this.config.highlightRenders=!this.config.highlightRenders,a.classList.toggle("active",this.config.highlightRenders),n?.classList.toggle("active",this.config.highlightRenders),this.updateHighlightsVisibility();});let o=this.shadowRoot.getElementById("rc-setting-duration"),r=this.shadowRoot.getElementById("rc-duration-value");o&&r&&o.addEventListener("input",()=>{let s=parseInt(o.value,10);this.config.highlightDuration=s,r.textContent=s>=1e3?`${s/1e3}s`:`${s}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 a=i.getAttribute("data-tab")===e;i.classList.toggle("active",a);}),this.toolbar.querySelectorAll(".tab-content").forEach(i=>{let a=i.getAttribute("data-content")===e;i.classList.toggle("active",a);}),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,a=0,o=0,r=e.querySelector(".panel-header");r&&(r.addEventListener("mousedown",s=>{let d=s;d.target.closest(".panel-btn")||(t=true,n=d.clientX,i=d.clientY,a=e.offsetLeft,o=e.offsetTop);}),document.addEventListener("mousemove",s=>{if(!t)return;let d=s.clientX-n,p=s.clientY-i;e.style.left=`${a+d}px`,e.style.top=`${o+p}px`,e.style.right="auto";}),document.addEventListener("mouseup",()=>{t=false;}));}highlight(e,t){if(!this.shadowRoot||!this.visible||u.SKIP_COMPONENTS.has(e.componentName))return;let n=t.getBoundingClientRect();if(n.width===0||n.height===0)return;if(this.trackedComponents.size>=u.MAX_HIGHLIGHTS&&!this.trackedComponents.has(e.componentName)){let s=this.getOldestTrackedComponent();s&&this.removeHighlight(s);}this.totalRenders++;let i=this.getSeverity(e),a=k[i],o=this.trackedComponents.get(e.componentName);if(o){o.count++,o.element=t,o.lastRender=Date.now(),o.severity=i,o.renderTimes.push(e.renderTime),o.renderTimes.length>100&&o.renderTimes.shift(),this.updateHighlightPosition(o,n,a);let s=o.highlightEl.querySelector(".label-count");s&&(s.classList.remove("bump"),s.offsetWidth,s.classList.add("bump"));}else {let s=this.createHighlightElement(e.componentName,n,a);o={element:t,highlightEl:s,lastRender:Date.now(),count:1,severity:i,renderTimes:[e.renderTime]},this.trackedComponents.set(e.componentName,o),this.shadowRoot.appendChild(s);}let r=o.highlightEl.querySelector(".label-count");r&&(r.textContent=`\xD7${o.count}`),this.updateHighlightColor(o.highlightEl,a),this.resetFadeTimeout(e.componentName,o);}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 a=document.createElement("div");a.className="highlight-border",i.appendChild(a);let o=document.createElement("div");o.className="label label-name",o.style.background=n,o.textContent=e,i.appendChild(o);let r=document.createElement("div");return r.className="label label-count",r.style.background=n,r.textContent="\xD71",i.appendChild(r),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 g of this.trackedComponents.values())g.count>50?e++:g.count>20?t++:n++;let i=this.shadowRoot.getElementById("rc-critical"),a=this.shadowRoot.getElementById("rc-warning"),o=this.shadowRoot.getElementById("rc-healthy"),r=this.shadowRoot.getElementById("rc-renders"),s=this.shadowRoot.getElementById("rc-fps"),d=this.shadowRoot.getElementById("rc-fps-bar"),p=this.shadowRoot.getElementById("rc-duration");if(i&&(i.textContent=String(e)),a&&(a.textContent=String(t)),o&&(o.textContent=String(n)),r&&(r.textContent=String(this.totalRenders)),s&&(s.textContent=String(Math.round(this.fps))),d){let g=Math.min(100,this.fps/60*100);d.style.width=`${g}%`,this.fps>=50?d.style.background="#22c55e":this.fps>=30?d.style.background="#f97316":d.style.background="#ef4444";}if(p){let g=Math.floor((Date.now()-this.startTime)/1e3),T=Math.floor(g/60),R=g%60;p.textContent=`${T}:${R.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 a=k[i.severity],o=i.renderTimes.length>0?(i.renderTimes.reduce((d,p)=>d+p,0)/i.renderTimes.length).toFixed(1):"0",r=Math.floor((Date.now()-i.lastRender)/1e3),s=r<60?`${r}s ago`:`${Math.floor(r/60)}m ago`;return `
|
|
769
|
+
<div class="component-item">
|
|
770
|
+
<div class="component-severity" style="background: ${a}"></div>
|
|
771
|
+
<div class="component-info">
|
|
772
|
+
<div class="component-name">${n}</div>
|
|
773
|
+
<div class="component-meta">${o}ms avg \xB7 ${s}</div>
|
|
774
|
+
</div>
|
|
775
|
+
<div class="component-count" style="color: ${a}">${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">${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">${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(u,"MAX_HIGHLIGHTS",50),l(u,"SKIP_COMPONENTS",new Set(["ForwardRef","Anonymous","Unknown","Fragment","Suspense","Context.Provider","Context.Consumer","Profiler","Root","#text"]));var v=u;var H={trackUnnecessary:true,fpsThreshold:30,highlightRenders:true,animationSpeed:"fast"},y=class extends m{constructor(t={},n){super();l(this,"config");l(this,"running",false);l(this,"reactVersion","unknown");l(this,"prevFiberStates",new WeakMap);l(this,"renderCounts",new Map);l(this,"originalOnCommitFiberRoot",null);l(this,"win");l(this,"overlay",null);this.config={...H,...t},this.win=n??(typeof window<"u"?window:{});}getDOMElement(t){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 v({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(),this.prevFiberStates=new WeakMap;}hookIntoReact(){let t=this.win.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t){this.installHook();return}this.originalOnCommitFiberRoot=t.onCommitFiberRoot.bind(t),t.onCommitFiberRoot=(n,i,a)=>{this.originalOnCommitFiberRoot&&this.originalOnCommitFiberRoot(n,i,a),this.processCommit(i.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,a)=>{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){this.walkFiber(t,null);}walkFiber(t,n){t&&(x(t)&&(this.processFiber(t,n),n=b(t)),this.walkFiber(t.child,n),this.walkFiber(t.sibling,n));}processFiber(t,n){let i=b(t);if(this.shouldFilterComponent(i))return;let a=this.prevFiberStates.get(t),r=C(t,a?"update":"mount",a?.props,a?.state),d=(this.renderCounts.get(i)??0)+1;this.renderCounts.set(i,d),r.renderCount=d,this.prevFiberStates.set(t,{props:t.memoizedProps,state:t.memoizedState});let p=this.getDOMElement(t);this.overlay&&this.config.highlightRenders&&(p?this.overlay.highlight(r,p):this.overlay.recordRender(r)),this.emit("render",{render:r,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(o=>this.matchPattern(t,o))||i&&i.length>0&&i.some(o=>this.matchPattern(t,o)))}matchPattern(t,n){let i=n.replace(/\*/g,".*").replace(/\?/g,".");try{return new RegExp(`^${i}$`).test(t)}catch{return false}}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 w=class{constructor(){l(this,"scanner");l(this,"overlay");l(this,"ws",null);l(this,"wsPort");l(this,"reconnectTimeout",null);l(this,"initialized",false);l(this,"messageQueue",[]);let e=window;this.wsPort=e.__REACTCHECK_PORT__??3099,this.scanner=new y({trackUnnecessary:true,highlightRenders:true,animationSpeed:"fast"},e),this.overlay=new v({enabled:true,highlightRenders:true,showToolbar:true});}init(){if(this.initialized)return;this.initialized=true,this.overlay.init(),this.setupScannerEvents(),this.connect();let e=this._markHookReady;e&&e(),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"}});});}connect(){this.ws&&this.ws.close();try{this.ws=new WebSocket(`ws://localhost:${this.wsPort}`),this.ws.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();},this.ws.onmessage=e=>{try{let t=JSON.parse(e.data);this.handleMessage(t);}catch(t){console.warn("[ReactCheck] Invalid message:",t);}},this.ws.onerror=e=>{console.warn("[ReactCheck] WebSocket error:",e);},this.ws.onclose=()=>{console.log("[ReactCheck] Disconnected from CLI"),this.scheduleReconnect();};}catch(e){console.warn("[ReactCheck] Failed to connect:",e),this.scheduleReconnect();}}scheduleReconnect(){this.reconnectTimeout||(this.reconnectTimeout=setTimeout(()=>{this.reconnectTimeout=null,console.log("[ReactCheck] Attempting to reconnect..."),this.connect();},2e3));}handleMessage(e){switch(e.type){case "start":this.scanner.start(),this.overlay.show();break;case "stop":this.scanner.stop();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.ws&&this.ws.readyState===WebSocket.OPEN?this.ws.send(JSON.stringify(e)):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=[];}}destroy(){this.reconnectTimeout&&clearTimeout(this.reconnectTimeout),this.ws&&this.ws.close(),this.scanner.stop(),this.overlay.destroy(),this.initialized=false;}};(function(){let c=window.location.href;if(c==="about:blank"||c.startsWith("chrome://")||c.startsWith("chrome-extension://")||c.startsWith("devtools://"))return;let e=window;if(e.__REACTCHECK_INJECTED__)return;e.__REACTCHECK_INJECTED__=true;let t=new w,n=[],i=false,a=r=>{if(i){let s=t.scanner;if(s){let d=r.current;s.processCommit(d);}}else n.push({rendererID:0,root:r});},o=()=>{i=true;let r=t.scanner;if(r){for(let{root:s}of n)r.processCommit(s.current);n.length=0;}};if(e.__REACT_DEVTOOLS_GLOBAL_HOOK__){let r=e.__REACT_DEVTOOLS_GLOBAL_HOOK__,s=r.onCommitFiberRoot.bind(r);r.onCommitFiberRoot=(d,p,g)=>{s(d,p,g),a(p);},console.log("[ReactCheck] Wrapped existing DevTools hook");}else {let r={renderers:new Map,supportsFiber:true,inject:function(s){let d=this.renderers.size+1;return this.renderers.set(d,s),d},onCommitFiberRoot:function(s,d){a(d);},onCommitFiberUnmount:function(){}};e.__REACT_DEVTOOLS_GLOBAL_HOOK__=r,console.log("[ReactCheck] DevTools hook installed");}t._markHookReady=()=>{o();},document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{t.init();}):t.init(),window.__REACTCHECK__=t;})();
|
|
791
|
+
exports.BrowserScanner=y;exports.Overlay=v;exports.ReactCheckInjector=w;return exports;})({});
|