@oxog/react-check 1.1.5 → 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 +510 -32
- 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
package/dist/index.js
CHANGED
|
@@ -755,12 +755,10 @@ var init_browser = __esm({
|
|
|
755
755
|
this.page = pages[0] ?? await this.browser.newPage();
|
|
756
756
|
this.setupPageHandlers();
|
|
757
757
|
if (this.injectionScript) {
|
|
758
|
+
logger3.debug("Injecting ReactCheck script into page...");
|
|
758
759
|
await this.page.evaluateOnNewDocument(this.injectionScript);
|
|
760
|
+
logger3.debug("Injection script registered");
|
|
759
761
|
}
|
|
760
|
-
const wsPort = this.options.wsPort;
|
|
761
|
-
await this.page.evaluateOnNewDocument(`
|
|
762
|
-
window.__REACTCHECK_PORT__ = ${wsPort};
|
|
763
|
-
`);
|
|
764
762
|
this.emit("launched", void 0);
|
|
765
763
|
logger3.info("Browser launched");
|
|
766
764
|
await this.navigate(this.options.url);
|
|
@@ -2391,9 +2389,17 @@ function getComponentName(fiber) {
|
|
|
2391
2389
|
case FiberTag.IncompleteClassComponent:
|
|
2392
2390
|
return getTypeName(type) || "Anonymous";
|
|
2393
2391
|
case FiberTag.ForwardRef:
|
|
2394
|
-
if (type && typeof type === "object"
|
|
2395
|
-
const
|
|
2396
|
-
|
|
2392
|
+
if (type && typeof type === "object") {
|
|
2393
|
+
const typeObj = type;
|
|
2394
|
+
if (typeObj.displayName) {
|
|
2395
|
+
return typeObj.displayName;
|
|
2396
|
+
}
|
|
2397
|
+
if ("render" in typeObj && typeObj.render) {
|
|
2398
|
+
const renderName = getTypeName(typeObj.render);
|
|
2399
|
+
if (renderName && renderName !== "Anonymous") {
|
|
2400
|
+
return renderName;
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2397
2403
|
}
|
|
2398
2404
|
return "ForwardRef";
|
|
2399
2405
|
case FiberTag.MemoComponent:
|
|
@@ -4570,46 +4576,47 @@ init_event_emitter();
|
|
|
4570
4576
|
var DEFAULT_CONFIG2 = {
|
|
4571
4577
|
enabled: true,
|
|
4572
4578
|
highlightRenders: true,
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
showToolbar: true
|
|
4579
|
+
showToolbar: true,
|
|
4580
|
+
highlightDuration: 2e3
|
|
4576
4581
|
};
|
|
4577
4582
|
var SEVERITY_COLORS = {
|
|
4578
4583
|
critical: "#ef4444",
|
|
4579
|
-
warning: "#
|
|
4584
|
+
warning: "#f97316",
|
|
4580
4585
|
info: "#3b82f6",
|
|
4581
4586
|
healthy: "#22c55e",
|
|
4582
4587
|
unnecessary: "#6b7280"
|
|
4583
4588
|
};
|
|
4584
|
-
var
|
|
4585
|
-
slow: 1e3,
|
|
4586
|
-
fast: 300,
|
|
4587
|
-
off: 0
|
|
4588
|
-
};
|
|
4589
|
-
var FLASH_COLORS = {
|
|
4590
|
-
critical: "rgba(239, 68, 68, 0.35)",
|
|
4591
|
-
warning: "rgba(234, 179, 8, 0.3)",
|
|
4592
|
-
info: "rgba(59, 130, 246, 0.25)",
|
|
4593
|
-
healthy: "rgba(34, 197, 94, 0.2)",
|
|
4594
|
-
unnecessary: "rgba(107, 114, 128, 0.15)"
|
|
4595
|
-
};
|
|
4596
|
-
var Overlay = class {
|
|
4589
|
+
var Overlay = class _Overlay {
|
|
4597
4590
|
/** Shadow root for isolation */
|
|
4598
4591
|
shadowRoot = null;
|
|
4599
4592
|
/** Host element */
|
|
4600
4593
|
host = null;
|
|
4601
4594
|
/** Overlay configuration */
|
|
4602
4595
|
config;
|
|
4603
|
-
/**
|
|
4604
|
-
|
|
4605
|
-
/**
|
|
4606
|
-
|
|
4607
|
-
/** Render counts for badges */
|
|
4608
|
-
renderCounts = /* @__PURE__ */ new Map();
|
|
4596
|
+
/** Tracked components (deduplication) */
|
|
4597
|
+
trackedComponents = /* @__PURE__ */ new Map();
|
|
4598
|
+
/** Render chains */
|
|
4599
|
+
renderChains = [];
|
|
4609
4600
|
/** Toolbar element */
|
|
4610
4601
|
toolbar = null;
|
|
4611
4602
|
/** Whether overlay is visible */
|
|
4612
4603
|
visible = true;
|
|
4604
|
+
/** Whether panel is collapsed to icon */
|
|
4605
|
+
collapsed = false;
|
|
4606
|
+
/** Total render count */
|
|
4607
|
+
totalRenders = 0;
|
|
4608
|
+
/** FPS value */
|
|
4609
|
+
fps = 60;
|
|
4610
|
+
/** Scan start time */
|
|
4611
|
+
startTime = Date.now();
|
|
4612
|
+
/** Fade timeout handles */
|
|
4613
|
+
fadeTimeouts = /* @__PURE__ */ new Map();
|
|
4614
|
+
/** Bound scroll handler for cleanup */
|
|
4615
|
+
scrollHandler = null;
|
|
4616
|
+
/** Scroll update pending flag (for throttling) */
|
|
4617
|
+
scrollUpdatePending = false;
|
|
4618
|
+
/** Stats update interval */
|
|
4619
|
+
statsInterval = null;
|
|
4613
4620
|
/**
|
|
4614
4621
|
* Create a new overlay
|
|
4615
4622
|
* @param config - Overlay configuration
|
|
@@ -4617,10 +4624,22 @@ var Overlay = class {
|
|
|
4617
4624
|
constructor(config = {}) {
|
|
4618
4625
|
this.config = { ...DEFAULT_CONFIG2, ...config };
|
|
4619
4626
|
}
|
|
4627
|
+
/** Retry count for init */
|
|
4628
|
+
initRetryCount = 0;
|
|
4620
4629
|
/**
|
|
4621
4630
|
* Initialize the overlay
|
|
4622
4631
|
*/
|
|
4623
4632
|
init() {
|
|
4633
|
+
if (this.host) {
|
|
4634
|
+
return;
|
|
4635
|
+
}
|
|
4636
|
+
if (!document.body) {
|
|
4637
|
+
if (this.initRetryCount < 10) {
|
|
4638
|
+
this.initRetryCount++;
|
|
4639
|
+
setTimeout(() => this.init(), 100);
|
|
4640
|
+
}
|
|
4641
|
+
return;
|
|
4642
|
+
}
|
|
4624
4643
|
this.host = document.createElement("div");
|
|
4625
4644
|
this.host.id = "reactcheck-overlay-host";
|
|
4626
4645
|
this.host.style.cssText = `
|
|
@@ -4638,14 +4657,31 @@ var Overlay = class {
|
|
|
4638
4657
|
this.createToolbar();
|
|
4639
4658
|
}
|
|
4640
4659
|
document.body.appendChild(this.host);
|
|
4660
|
+
this.scrollHandler = () => this.onScroll();
|
|
4661
|
+
window.addEventListener("scroll", this.scrollHandler, { passive: true, capture: true });
|
|
4662
|
+
window.addEventListener("resize", this.scrollHandler, { passive: true });
|
|
4663
|
+
this.statsInterval = setInterval(() => this.updateStats(), 500);
|
|
4664
|
+
console.log("[ReactCheck] Overlay initialized");
|
|
4641
4665
|
}
|
|
4642
4666
|
/**
|
|
4643
4667
|
* Destroy the overlay
|
|
4644
4668
|
*/
|
|
4645
4669
|
destroy() {
|
|
4646
|
-
this.
|
|
4647
|
-
|
|
4648
|
-
|
|
4670
|
+
if (this.statsInterval) {
|
|
4671
|
+
clearInterval(this.statsInterval);
|
|
4672
|
+
this.statsInterval = null;
|
|
4673
|
+
}
|
|
4674
|
+
if (this.scrollHandler) {
|
|
4675
|
+
window.removeEventListener("scroll", this.scrollHandler, { capture: true });
|
|
4676
|
+
window.removeEventListener("resize", this.scrollHandler);
|
|
4677
|
+
this.scrollHandler = null;
|
|
4678
|
+
}
|
|
4679
|
+
for (const timeout of this.fadeTimeouts.values()) {
|
|
4680
|
+
clearTimeout(timeout);
|
|
4681
|
+
}
|
|
4682
|
+
this.fadeTimeouts.clear();
|
|
4683
|
+
this.trackedComponents.clear();
|
|
4684
|
+
this.renderChains = [];
|
|
4649
4685
|
if (this.host) {
|
|
4650
4686
|
this.host.remove();
|
|
4651
4687
|
this.host = null;
|
|
@@ -4653,6 +4689,34 @@ var Overlay = class {
|
|
|
4653
4689
|
this.shadowRoot = null;
|
|
4654
4690
|
this.toolbar = null;
|
|
4655
4691
|
}
|
|
4692
|
+
/**
|
|
4693
|
+
* Handle scroll/resize events - update all highlight positions
|
|
4694
|
+
*/
|
|
4695
|
+
onScroll() {
|
|
4696
|
+
if (this.scrollUpdatePending) return;
|
|
4697
|
+
this.scrollUpdatePending = true;
|
|
4698
|
+
requestAnimationFrame(() => {
|
|
4699
|
+
this.updateAllPositions();
|
|
4700
|
+
this.scrollUpdatePending = false;
|
|
4701
|
+
});
|
|
4702
|
+
}
|
|
4703
|
+
/**
|
|
4704
|
+
* Update positions of all tracked highlights
|
|
4705
|
+
*/
|
|
4706
|
+
updateAllPositions() {
|
|
4707
|
+
for (const tracked of this.trackedComponents.values()) {
|
|
4708
|
+
const rect = tracked.element.getBoundingClientRect();
|
|
4709
|
+
if (rect.width === 0 || rect.height === 0) {
|
|
4710
|
+
tracked.highlightEl.style.display = "none";
|
|
4711
|
+
continue;
|
|
4712
|
+
}
|
|
4713
|
+
tracked.highlightEl.style.display = this.config.highlightRenders ? "block" : "none";
|
|
4714
|
+
tracked.highlightEl.style.left = `${rect.left}px`;
|
|
4715
|
+
tracked.highlightEl.style.top = `${rect.top}px`;
|
|
4716
|
+
tracked.highlightEl.style.width = `${rect.width}px`;
|
|
4717
|
+
tracked.highlightEl.style.height = `${rect.height}px`;
|
|
4718
|
+
}
|
|
4719
|
+
}
|
|
4656
4720
|
/**
|
|
4657
4721
|
* Inject CSS styles into shadow DOM
|
|
4658
4722
|
*/
|
|
@@ -4662,249 +4726,796 @@ var Overlay = class {
|
|
|
4662
4726
|
style.textContent = `
|
|
4663
4727
|
* {
|
|
4664
4728
|
box-sizing: border-box;
|
|
4729
|
+
margin: 0;
|
|
4730
|
+
padding: 0;
|
|
4731
|
+
}
|
|
4732
|
+
|
|
4733
|
+
/* Ensure all interactive elements are clickable */
|
|
4734
|
+
button, input, .toggle, .tab, .action-btn, .component-item, .panel-btn {
|
|
4735
|
+
pointer-events: auto !important;
|
|
4736
|
+
cursor: pointer;
|
|
4665
4737
|
}
|
|
4666
4738
|
|
|
4667
|
-
|
|
4739
|
+
/* Highlight styles */
|
|
4740
|
+
.highlight-container {
|
|
4668
4741
|
position: fixed;
|
|
4669
4742
|
pointer-events: none;
|
|
4670
|
-
border-width: 2px;
|
|
4671
|
-
border-style: solid;
|
|
4672
4743
|
z-index: 1;
|
|
4673
|
-
animation: highlight-pulse 0.5s ease-out;
|
|
4674
4744
|
}
|
|
4675
4745
|
|
|
4676
|
-
.highlight
|
|
4677
|
-
|
|
4746
|
+
.highlight-border {
|
|
4747
|
+
position: absolute;
|
|
4748
|
+
inset: 0;
|
|
4749
|
+
border: 2px solid currentColor;
|
|
4750
|
+
border-radius: 4px;
|
|
4678
4751
|
transition: opacity 0.3s ease-out;
|
|
4679
4752
|
}
|
|
4680
4753
|
|
|
4681
|
-
.
|
|
4682
|
-
|
|
4683
|
-
pointer-events: none;
|
|
4684
|
-
z-index: 0;
|
|
4685
|
-
animation: flash-pulse 0.4s ease-out forwards;
|
|
4686
|
-
border-radius: 4px;
|
|
4754
|
+
.highlight-container.fade .highlight-border {
|
|
4755
|
+
opacity: 0.3;
|
|
4687
4756
|
}
|
|
4688
4757
|
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
opacity: 0;
|
|
4700
|
-
transform: scale(1);
|
|
4701
|
-
}
|
|
4758
|
+
.label {
|
|
4759
|
+
position: absolute;
|
|
4760
|
+
font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
|
|
4761
|
+
font-size: 11px;
|
|
4762
|
+
font-weight: 600;
|
|
4763
|
+
padding: 2px 6px;
|
|
4764
|
+
border-radius: 3px;
|
|
4765
|
+
color: white;
|
|
4766
|
+
white-space: nowrap;
|
|
4767
|
+
line-height: 1.2;
|
|
4702
4768
|
}
|
|
4703
4769
|
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
box-shadow: 0 0 0 0 currentColor;
|
|
4708
|
-
}
|
|
4709
|
-
30% {
|
|
4710
|
-
opacity: 1;
|
|
4711
|
-
box-shadow: 0 0 8px 2px currentColor;
|
|
4712
|
-
}
|
|
4713
|
-
100% {
|
|
4714
|
-
opacity: 1;
|
|
4715
|
-
box-shadow: 0 0 0 0 transparent;
|
|
4716
|
-
}
|
|
4770
|
+
.label-name {
|
|
4771
|
+
top: -20px;
|
|
4772
|
+
left: 0;
|
|
4717
4773
|
}
|
|
4718
4774
|
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
opacity: 0;
|
|
4723
|
-
}
|
|
4724
|
-
50% {
|
|
4725
|
-
transform: scale(1.1);
|
|
4726
|
-
}
|
|
4727
|
-
100% {
|
|
4728
|
-
transform: scale(1);
|
|
4729
|
-
opacity: 1;
|
|
4730
|
-
}
|
|
4775
|
+
.label-count {
|
|
4776
|
+
top: -20px;
|
|
4777
|
+
right: 0;
|
|
4731
4778
|
}
|
|
4732
4779
|
|
|
4733
|
-
.
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
pointer-events: none;
|
|
4742
|
-
z-index: 2;
|
|
4743
|
-
white-space: nowrap;
|
|
4780
|
+
.label-count.bump {
|
|
4781
|
+
animation: bump 0.2s ease-out;
|
|
4782
|
+
}
|
|
4783
|
+
|
|
4784
|
+
@keyframes bump {
|
|
4785
|
+
0% { transform: scale(1); }
|
|
4786
|
+
50% { transform: scale(1.2); }
|
|
4787
|
+
100% { transform: scale(1); }
|
|
4744
4788
|
}
|
|
4745
4789
|
|
|
4746
|
-
|
|
4790
|
+
/* Panel styles */
|
|
4791
|
+
.panel {
|
|
4747
4792
|
position: fixed;
|
|
4748
|
-
top:
|
|
4749
|
-
right:
|
|
4750
|
-
background: rgba(
|
|
4751
|
-
border
|
|
4752
|
-
|
|
4793
|
+
top: 12px;
|
|
4794
|
+
right: 12px;
|
|
4795
|
+
background: linear-gradient(135deg, rgba(17, 17, 23, 0.98) 0%, rgba(12, 12, 18, 0.98) 100%);
|
|
4796
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
4797
|
+
border-radius: 12px;
|
|
4753
4798
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
4754
4799
|
font-size: 12px;
|
|
4755
|
-
color:
|
|
4800
|
+
color: #e5e7eb;
|
|
4756
4801
|
pointer-events: auto;
|
|
4757
4802
|
z-index: 10;
|
|
4758
|
-
cursor: move;
|
|
4759
4803
|
user-select: none;
|
|
4804
|
+
width: 320px;
|
|
4805
|
+
max-height: 480px;
|
|
4806
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
|
|
4807
|
+
backdrop-filter: blur(12px);
|
|
4808
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
4809
|
+
overflow: hidden;
|
|
4810
|
+
}
|
|
4811
|
+
|
|
4812
|
+
.panel.collapsed {
|
|
4813
|
+
width: 48px;
|
|
4814
|
+
height: 48px;
|
|
4815
|
+
border-radius: 50%;
|
|
4816
|
+
cursor: pointer;
|
|
4817
|
+
display: flex;
|
|
4818
|
+
align-items: center;
|
|
4819
|
+
justify-content: center;
|
|
4820
|
+
}
|
|
4821
|
+
|
|
4822
|
+
.panel.collapsed:hover {
|
|
4823
|
+
transform: scale(1.08);
|
|
4824
|
+
box-shadow: 0 8px 32px rgba(34, 197, 94, 0.3);
|
|
4825
|
+
}
|
|
4826
|
+
|
|
4827
|
+
.panel.collapsed .panel-content {
|
|
4828
|
+
display: none;
|
|
4829
|
+
}
|
|
4830
|
+
|
|
4831
|
+
.panel-icon {
|
|
4832
|
+
display: none;
|
|
4833
|
+
width: 28px;
|
|
4834
|
+
height: 28px;
|
|
4835
|
+
fill: #22c55e;
|
|
4836
|
+
filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.5));
|
|
4760
4837
|
}
|
|
4761
4838
|
|
|
4762
|
-
.
|
|
4839
|
+
.panel.collapsed .panel-icon {
|
|
4840
|
+
display: block;
|
|
4841
|
+
}
|
|
4842
|
+
|
|
4843
|
+
.panel-content {
|
|
4844
|
+
display: flex;
|
|
4845
|
+
flex-direction: column;
|
|
4846
|
+
pointer-events: auto;
|
|
4847
|
+
}
|
|
4848
|
+
|
|
4849
|
+
/* Header */
|
|
4850
|
+
.panel-header {
|
|
4763
4851
|
display: flex;
|
|
4764
4852
|
align-items: center;
|
|
4765
4853
|
justify-content: space-between;
|
|
4766
|
-
|
|
4854
|
+
padding: 12px 14px;
|
|
4855
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
|
4856
|
+
cursor: move;
|
|
4857
|
+
background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
|
|
4767
4858
|
}
|
|
4768
4859
|
|
|
4769
|
-
.
|
|
4770
|
-
|
|
4771
|
-
|
|
4860
|
+
.panel-brand {
|
|
4861
|
+
display: flex;
|
|
4862
|
+
align-items: center;
|
|
4863
|
+
gap: 8px;
|
|
4772
4864
|
}
|
|
4773
4865
|
|
|
4774
|
-
.
|
|
4775
|
-
|
|
4866
|
+
.panel-logo {
|
|
4867
|
+
width: 20px;
|
|
4868
|
+
height: 20px;
|
|
4869
|
+
fill: #22c55e;
|
|
4870
|
+
}
|
|
4871
|
+
|
|
4872
|
+
.panel-title {
|
|
4873
|
+
font-weight: 700;
|
|
4874
|
+
font-size: 13px;
|
|
4875
|
+
background: linear-gradient(135deg, #22c55e 0%, #4ade80 100%);
|
|
4876
|
+
-webkit-background-clip: text;
|
|
4877
|
+
-webkit-text-fill-color: transparent;
|
|
4878
|
+
background-clip: text;
|
|
4879
|
+
}
|
|
4880
|
+
|
|
4881
|
+
.panel-status {
|
|
4882
|
+
display: flex;
|
|
4883
|
+
align-items: center;
|
|
4884
|
+
gap: 6px;
|
|
4885
|
+
font-size: 10px;
|
|
4886
|
+
color: #6b7280;
|
|
4887
|
+
}
|
|
4888
|
+
|
|
4889
|
+
.status-dot {
|
|
4890
|
+
width: 6px;
|
|
4891
|
+
height: 6px;
|
|
4892
|
+
border-radius: 50%;
|
|
4893
|
+
background: #22c55e;
|
|
4894
|
+
box-shadow: 0 0 8px #22c55e;
|
|
4895
|
+
animation: pulse 2s infinite;
|
|
4896
|
+
}
|
|
4897
|
+
|
|
4898
|
+
@keyframes pulse {
|
|
4899
|
+
0%, 100% { opacity: 1; }
|
|
4900
|
+
50% { opacity: 0.5; }
|
|
4901
|
+
}
|
|
4902
|
+
|
|
4903
|
+
.panel-actions {
|
|
4904
|
+
display: flex;
|
|
4905
|
+
gap: 4px;
|
|
4906
|
+
}
|
|
4907
|
+
|
|
4908
|
+
.panel-btn {
|
|
4909
|
+
background: rgba(255, 255, 255, 0.05);
|
|
4776
4910
|
border: none;
|
|
4911
|
+
border-radius: 6px;
|
|
4777
4912
|
color: #9ca3af;
|
|
4913
|
+
width: 28px;
|
|
4914
|
+
height: 28px;
|
|
4778
4915
|
cursor: pointer;
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4916
|
+
display: flex;
|
|
4917
|
+
align-items: center;
|
|
4918
|
+
justify-content: center;
|
|
4919
|
+
transition: all 0.15s;
|
|
4782
4920
|
}
|
|
4783
4921
|
|
|
4784
|
-
.
|
|
4922
|
+
.panel-btn:hover {
|
|
4923
|
+
background: rgba(255, 255, 255, 0.1);
|
|
4785
4924
|
color: white;
|
|
4786
4925
|
}
|
|
4787
4926
|
|
|
4788
|
-
.
|
|
4927
|
+
.panel-btn svg {
|
|
4928
|
+
width: 14px;
|
|
4929
|
+
height: 14px;
|
|
4930
|
+
fill: currentColor;
|
|
4931
|
+
}
|
|
4932
|
+
|
|
4933
|
+
/* Tabs */
|
|
4934
|
+
.panel-tabs {
|
|
4935
|
+
display: flex;
|
|
4936
|
+
padding: 0 8px;
|
|
4937
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
|
4938
|
+
background: rgba(0, 0, 0, 0.2);
|
|
4939
|
+
}
|
|
4940
|
+
|
|
4941
|
+
.tab {
|
|
4942
|
+
flex: 1;
|
|
4943
|
+
padding: 10px 8px;
|
|
4944
|
+
background: none;
|
|
4945
|
+
border: none;
|
|
4946
|
+
color: #6b7280;
|
|
4947
|
+
font-size: 11px;
|
|
4948
|
+
font-weight: 500;
|
|
4949
|
+
cursor: pointer;
|
|
4950
|
+
transition: all 0.15s;
|
|
4951
|
+
position: relative;
|
|
4952
|
+
display: flex;
|
|
4953
|
+
flex-direction: column;
|
|
4954
|
+
align-items: center;
|
|
4955
|
+
gap: 4px;
|
|
4956
|
+
}
|
|
4957
|
+
|
|
4958
|
+
.tab svg {
|
|
4959
|
+
width: 16px;
|
|
4960
|
+
height: 16px;
|
|
4961
|
+
fill: currentColor;
|
|
4962
|
+
opacity: 0.7;
|
|
4963
|
+
}
|
|
4964
|
+
|
|
4965
|
+
.tab:hover {
|
|
4966
|
+
color: #d1d5db;
|
|
4967
|
+
}
|
|
4968
|
+
|
|
4969
|
+
.tab.active {
|
|
4970
|
+
color: #22c55e;
|
|
4971
|
+
}
|
|
4972
|
+
|
|
4973
|
+
.tab.active svg {
|
|
4974
|
+
opacity: 1;
|
|
4975
|
+
}
|
|
4976
|
+
|
|
4977
|
+
.tab.active::after {
|
|
4978
|
+
content: '';
|
|
4979
|
+
position: absolute;
|
|
4980
|
+
bottom: 0;
|
|
4981
|
+
left: 50%;
|
|
4982
|
+
transform: translateX(-50%);
|
|
4983
|
+
width: 24px;
|
|
4984
|
+
height: 2px;
|
|
4985
|
+
background: linear-gradient(90deg, #22c55e, #4ade80);
|
|
4986
|
+
border-radius: 2px;
|
|
4987
|
+
}
|
|
4988
|
+
|
|
4989
|
+
/* Tab content */
|
|
4990
|
+
.tab-content {
|
|
4991
|
+
display: none;
|
|
4992
|
+
padding: 12px;
|
|
4993
|
+
overflow-y: auto;
|
|
4994
|
+
max-height: 340px;
|
|
4995
|
+
pointer-events: auto;
|
|
4996
|
+
}
|
|
4997
|
+
|
|
4998
|
+
.tab-content.active {
|
|
4999
|
+
display: block;
|
|
5000
|
+
}
|
|
5001
|
+
|
|
5002
|
+
.tab-content::-webkit-scrollbar {
|
|
5003
|
+
width: 4px;
|
|
5004
|
+
}
|
|
5005
|
+
|
|
5006
|
+
.tab-content::-webkit-scrollbar-track {
|
|
5007
|
+
background: transparent;
|
|
5008
|
+
}
|
|
5009
|
+
|
|
5010
|
+
.tab-content::-webkit-scrollbar-thumb {
|
|
5011
|
+
background: rgba(255, 255, 255, 0.1);
|
|
5012
|
+
border-radius: 2px;
|
|
5013
|
+
}
|
|
5014
|
+
|
|
5015
|
+
/* Overview tab */
|
|
5016
|
+
.stats-grid {
|
|
4789
5017
|
display: grid;
|
|
4790
5018
|
grid-template-columns: repeat(2, 1fr);
|
|
4791
5019
|
gap: 8px;
|
|
5020
|
+
margin-bottom: 12px;
|
|
4792
5021
|
}
|
|
4793
5022
|
|
|
4794
|
-
.stat {
|
|
5023
|
+
.stat-card {
|
|
5024
|
+
background: rgba(255, 255, 255, 0.03);
|
|
5025
|
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
5026
|
+
border-radius: 8px;
|
|
5027
|
+
padding: 12px;
|
|
4795
5028
|
text-align: center;
|
|
4796
5029
|
}
|
|
4797
5030
|
|
|
5031
|
+
.stat-card.wide {
|
|
5032
|
+
grid-column: span 2;
|
|
5033
|
+
}
|
|
5034
|
+
|
|
4798
5035
|
.stat-value {
|
|
4799
|
-
font-size:
|
|
4800
|
-
font-weight:
|
|
5036
|
+
font-size: 24px;
|
|
5037
|
+
font-weight: 700;
|
|
5038
|
+
font-family: ui-monospace, monospace;
|
|
5039
|
+
line-height: 1;
|
|
5040
|
+
margin-bottom: 4px;
|
|
4801
5041
|
}
|
|
4802
5042
|
|
|
4803
5043
|
.stat-label {
|
|
4804
5044
|
font-size: 10px;
|
|
4805
|
-
color: #
|
|
5045
|
+
color: #6b7280;
|
|
4806
5046
|
text-transform: uppercase;
|
|
5047
|
+
letter-spacing: 0.5px;
|
|
4807
5048
|
}
|
|
4808
5049
|
|
|
4809
|
-
.stat-critical .stat-value { color: #ef4444; }
|
|
4810
|
-
.stat-warning .stat-value { color: #
|
|
4811
|
-
.stat-healthy .stat-value { color: #22c55e; }
|
|
5050
|
+
.stat-card.critical .stat-value { color: #ef4444; }
|
|
5051
|
+
.stat-card.warning .stat-value { color: #f97316; }
|
|
5052
|
+
.stat-card.healthy .stat-value { color: #22c55e; }
|
|
5053
|
+
.stat-card.info .stat-value { color: #3b82f6; }
|
|
4812
5054
|
|
|
4813
|
-
.
|
|
5055
|
+
.fps-bar {
|
|
5056
|
+
height: 4px;
|
|
5057
|
+
background: rgba(255, 255, 255, 0.1);
|
|
5058
|
+
border-radius: 2px;
|
|
4814
5059
|
margin-top: 8px;
|
|
5060
|
+
overflow: hidden;
|
|
5061
|
+
}
|
|
5062
|
+
|
|
5063
|
+
.fps-bar-fill {
|
|
5064
|
+
height: 100%;
|
|
5065
|
+
border-radius: 2px;
|
|
5066
|
+
transition: width 0.3s, background 0.3s;
|
|
5067
|
+
}
|
|
5068
|
+
|
|
5069
|
+
.quick-actions {
|
|
4815
5070
|
display: flex;
|
|
4816
|
-
gap:
|
|
5071
|
+
gap: 8px;
|
|
5072
|
+
margin-top: 12px;
|
|
5073
|
+
}
|
|
5074
|
+
|
|
5075
|
+
.action-btn {
|
|
5076
|
+
flex: 1;
|
|
5077
|
+
padding: 10px;
|
|
5078
|
+
background: rgba(255, 255, 255, 0.05);
|
|
5079
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
5080
|
+
border-radius: 8px;
|
|
5081
|
+
color: #d1d5db;
|
|
5082
|
+
font-size: 11px;
|
|
5083
|
+
font-weight: 500;
|
|
5084
|
+
cursor: pointer;
|
|
5085
|
+
transition: all 0.15s;
|
|
5086
|
+
display: flex;
|
|
5087
|
+
align-items: center;
|
|
5088
|
+
justify-content: center;
|
|
5089
|
+
gap: 6px;
|
|
4817
5090
|
}
|
|
4818
5091
|
|
|
4819
|
-
.
|
|
5092
|
+
.action-btn:hover {
|
|
4820
5093
|
background: rgba(255, 255, 255, 0.1);
|
|
4821
|
-
border:
|
|
5094
|
+
border-color: rgba(255, 255, 255, 0.15);
|
|
5095
|
+
}
|
|
5096
|
+
|
|
5097
|
+
.action-btn.active {
|
|
5098
|
+
background: rgba(34, 197, 94, 0.15);
|
|
5099
|
+
border-color: rgba(34, 197, 94, 0.3);
|
|
5100
|
+
color: #22c55e;
|
|
5101
|
+
}
|
|
5102
|
+
|
|
5103
|
+
.action-btn svg {
|
|
5104
|
+
width: 14px;
|
|
5105
|
+
height: 14px;
|
|
5106
|
+
fill: currentColor;
|
|
5107
|
+
}
|
|
5108
|
+
|
|
5109
|
+
/* Components tab */
|
|
5110
|
+
.component-list {
|
|
5111
|
+
display: flex;
|
|
5112
|
+
flex-direction: column;
|
|
5113
|
+
gap: 6px;
|
|
5114
|
+
}
|
|
5115
|
+
|
|
5116
|
+
.component-item {
|
|
5117
|
+
display: flex;
|
|
5118
|
+
align-items: center;
|
|
5119
|
+
padding: 10px;
|
|
5120
|
+
background: rgba(255, 255, 255, 0.02);
|
|
5121
|
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
5122
|
+
border-radius: 8px;
|
|
5123
|
+
cursor: pointer;
|
|
5124
|
+
transition: all 0.15s;
|
|
5125
|
+
}
|
|
5126
|
+
|
|
5127
|
+
.component-item:hover {
|
|
5128
|
+
background: rgba(255, 255, 255, 0.05);
|
|
5129
|
+
border-color: rgba(255, 255, 255, 0.1);
|
|
5130
|
+
}
|
|
5131
|
+
|
|
5132
|
+
.component-severity {
|
|
5133
|
+
width: 4px;
|
|
5134
|
+
height: 32px;
|
|
5135
|
+
border-radius: 2px;
|
|
5136
|
+
margin-right: 10px;
|
|
5137
|
+
}
|
|
5138
|
+
|
|
5139
|
+
.component-info {
|
|
5140
|
+
flex: 1;
|
|
5141
|
+
min-width: 0;
|
|
5142
|
+
}
|
|
5143
|
+
|
|
5144
|
+
.component-name {
|
|
5145
|
+
font-weight: 600;
|
|
5146
|
+
font-size: 12px;
|
|
5147
|
+
color: #e5e7eb;
|
|
5148
|
+
white-space: nowrap;
|
|
5149
|
+
overflow: hidden;
|
|
5150
|
+
text-overflow: ellipsis;
|
|
5151
|
+
}
|
|
5152
|
+
|
|
5153
|
+
.component-meta {
|
|
5154
|
+
font-size: 10px;
|
|
5155
|
+
color: #6b7280;
|
|
5156
|
+
margin-top: 2px;
|
|
5157
|
+
}
|
|
5158
|
+
|
|
5159
|
+
.component-count {
|
|
5160
|
+
font-family: ui-monospace, monospace;
|
|
5161
|
+
font-size: 14px;
|
|
5162
|
+
font-weight: 700;
|
|
5163
|
+
padding: 4px 10px;
|
|
5164
|
+
border-radius: 6px;
|
|
5165
|
+
background: rgba(255, 255, 255, 0.05);
|
|
5166
|
+
}
|
|
5167
|
+
|
|
5168
|
+
.empty-state {
|
|
5169
|
+
text-align: center;
|
|
5170
|
+
padding: 32px 16px;
|
|
5171
|
+
color: #6b7280;
|
|
5172
|
+
}
|
|
5173
|
+
|
|
5174
|
+
.empty-state svg {
|
|
5175
|
+
width: 40px;
|
|
5176
|
+
height: 40px;
|
|
5177
|
+
fill: currentColor;
|
|
5178
|
+
opacity: 0.3;
|
|
5179
|
+
margin-bottom: 12px;
|
|
5180
|
+
}
|
|
5181
|
+
|
|
5182
|
+
/* Chains tab */
|
|
5183
|
+
.chain-item {
|
|
5184
|
+
padding: 12px;
|
|
5185
|
+
background: rgba(255, 255, 255, 0.02);
|
|
5186
|
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
5187
|
+
border-radius: 8px;
|
|
5188
|
+
margin-bottom: 8px;
|
|
5189
|
+
}
|
|
5190
|
+
|
|
5191
|
+
.chain-header {
|
|
5192
|
+
display: flex;
|
|
5193
|
+
align-items: center;
|
|
5194
|
+
justify-content: space-between;
|
|
5195
|
+
margin-bottom: 8px;
|
|
5196
|
+
}
|
|
5197
|
+
|
|
5198
|
+
.chain-trigger {
|
|
5199
|
+
font-weight: 600;
|
|
5200
|
+
color: #f97316;
|
|
5201
|
+
}
|
|
5202
|
+
|
|
5203
|
+
.chain-count {
|
|
5204
|
+
font-size: 10px;
|
|
5205
|
+
color: #6b7280;
|
|
5206
|
+
background: rgba(255, 255, 255, 0.05);
|
|
5207
|
+
padding: 2px 8px;
|
|
4822
5208
|
border-radius: 4px;
|
|
4823
|
-
|
|
5209
|
+
}
|
|
5210
|
+
|
|
5211
|
+
.chain-flow {
|
|
5212
|
+
display: flex;
|
|
5213
|
+
flex-wrap: wrap;
|
|
5214
|
+
align-items: center;
|
|
5215
|
+
gap: 4px;
|
|
5216
|
+
font-size: 11px;
|
|
5217
|
+
}
|
|
5218
|
+
|
|
5219
|
+
.chain-node {
|
|
4824
5220
|
padding: 4px 8px;
|
|
5221
|
+
background: rgba(255, 255, 255, 0.05);
|
|
5222
|
+
border-radius: 4px;
|
|
5223
|
+
color: #d1d5db;
|
|
5224
|
+
}
|
|
5225
|
+
|
|
5226
|
+
.chain-arrow {
|
|
5227
|
+
color: #6b7280;
|
|
5228
|
+
}
|
|
5229
|
+
|
|
5230
|
+
/* Settings tab */
|
|
5231
|
+
.setting-group {
|
|
5232
|
+
margin-bottom: 16px;
|
|
5233
|
+
}
|
|
5234
|
+
|
|
5235
|
+
.setting-label {
|
|
5236
|
+
font-size: 11px;
|
|
5237
|
+
font-weight: 500;
|
|
5238
|
+
color: #9ca3af;
|
|
5239
|
+
margin-bottom: 8px;
|
|
5240
|
+
text-transform: uppercase;
|
|
5241
|
+
letter-spacing: 0.5px;
|
|
5242
|
+
}
|
|
5243
|
+
|
|
5244
|
+
.setting-row {
|
|
5245
|
+
display: flex;
|
|
5246
|
+
align-items: center;
|
|
5247
|
+
justify-content: space-between;
|
|
5248
|
+
padding: 10px 12px;
|
|
5249
|
+
background: rgba(255, 255, 255, 0.02);
|
|
5250
|
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
5251
|
+
border-radius: 8px;
|
|
5252
|
+
margin-bottom: 6px;
|
|
5253
|
+
}
|
|
5254
|
+
|
|
5255
|
+
.setting-name {
|
|
5256
|
+
font-size: 12px;
|
|
5257
|
+
color: #e5e7eb;
|
|
5258
|
+
}
|
|
5259
|
+
|
|
5260
|
+
.setting-desc {
|
|
4825
5261
|
font-size: 10px;
|
|
5262
|
+
color: #6b7280;
|
|
5263
|
+
margin-top: 2px;
|
|
5264
|
+
}
|
|
5265
|
+
|
|
5266
|
+
/* Toggle switch */
|
|
5267
|
+
.toggle {
|
|
5268
|
+
position: relative;
|
|
5269
|
+
width: 40px;
|
|
5270
|
+
height: 22px;
|
|
5271
|
+
background: rgba(255, 255, 255, 0.1);
|
|
5272
|
+
border-radius: 11px;
|
|
4826
5273
|
cursor: pointer;
|
|
5274
|
+
transition: background 0.2s;
|
|
5275
|
+
}
|
|
5276
|
+
|
|
5277
|
+
.toggle.active {
|
|
5278
|
+
background: #22c55e;
|
|
5279
|
+
}
|
|
5280
|
+
|
|
5281
|
+
.toggle::after {
|
|
5282
|
+
content: '';
|
|
5283
|
+
position: absolute;
|
|
5284
|
+
top: 3px;
|
|
5285
|
+
left: 3px;
|
|
5286
|
+
width: 16px;
|
|
5287
|
+
height: 16px;
|
|
5288
|
+
background: white;
|
|
5289
|
+
border-radius: 50%;
|
|
5290
|
+
transition: transform 0.2s;
|
|
5291
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
5292
|
+
}
|
|
5293
|
+
|
|
5294
|
+
.toggle.active::after {
|
|
5295
|
+
transform: translateX(18px);
|
|
5296
|
+
}
|
|
5297
|
+
|
|
5298
|
+
/* Range slider */
|
|
5299
|
+
.range-container {
|
|
5300
|
+
display: flex;
|
|
5301
|
+
align-items: center;
|
|
5302
|
+
gap: 12px;
|
|
5303
|
+
}
|
|
5304
|
+
|
|
5305
|
+
.range-value {
|
|
5306
|
+
font-family: ui-monospace, monospace;
|
|
5307
|
+
font-size: 12px;
|
|
5308
|
+
color: #22c55e;
|
|
5309
|
+
min-width: 40px;
|
|
5310
|
+
text-align: right;
|
|
4827
5311
|
}
|
|
4828
5312
|
|
|
4829
|
-
|
|
4830
|
-
|
|
5313
|
+
input[type="range"] {
|
|
5314
|
+
flex: 1;
|
|
5315
|
+
height: 4px;
|
|
5316
|
+
-webkit-appearance: none;
|
|
5317
|
+
background: rgba(255, 255, 255, 0.1);
|
|
5318
|
+
border-radius: 2px;
|
|
5319
|
+
outline: none;
|
|
4831
5320
|
}
|
|
4832
5321
|
|
|
4833
|
-
|
|
4834
|
-
|
|
5322
|
+
input[type="range"]::-webkit-slider-thumb {
|
|
5323
|
+
-webkit-appearance: none;
|
|
5324
|
+
width: 14px;
|
|
5325
|
+
height: 14px;
|
|
5326
|
+
background: #22c55e;
|
|
5327
|
+
border-radius: 50%;
|
|
5328
|
+
cursor: pointer;
|
|
5329
|
+
box-shadow: 0 2px 6px rgba(34, 197, 94, 0.4);
|
|
4835
5330
|
}
|
|
4836
5331
|
`;
|
|
4837
5332
|
this.shadowRoot.appendChild(style);
|
|
4838
5333
|
}
|
|
4839
5334
|
/**
|
|
4840
|
-
* Create the floating
|
|
5335
|
+
* Create the floating panel
|
|
4841
5336
|
*/
|
|
4842
5337
|
createToolbar() {
|
|
4843
5338
|
if (!this.shadowRoot) return;
|
|
4844
5339
|
this.toolbar = document.createElement("div");
|
|
4845
|
-
this.toolbar.className = "
|
|
5340
|
+
this.toolbar.className = "panel";
|
|
4846
5341
|
this.toolbar.innerHTML = `
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
<
|
|
4850
|
-
</
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
5342
|
+
<!-- Collapsed icon -->
|
|
5343
|
+
<svg class="panel-icon" viewBox="0 0 24 24">
|
|
5344
|
+
<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"/>
|
|
5345
|
+
</svg>
|
|
5346
|
+
|
|
5347
|
+
<div class="panel-content">
|
|
5348
|
+
<!-- Header -->
|
|
5349
|
+
<div class="panel-header">
|
|
5350
|
+
<div class="panel-brand">
|
|
5351
|
+
<svg class="panel-logo" viewBox="0 0 24 24">
|
|
5352
|
+
<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"/>
|
|
5353
|
+
</svg>
|
|
5354
|
+
<span class="panel-title">ReactCheck</span>
|
|
5355
|
+
</div>
|
|
5356
|
+
<div class="panel-status">
|
|
5357
|
+
<span class="status-dot"></span>
|
|
5358
|
+
<span id="rc-duration">0:00</span>
|
|
5359
|
+
</div>
|
|
5360
|
+
<div class="panel-actions">
|
|
5361
|
+
<button class="panel-btn" id="rc-collapse" title="Minimize">
|
|
5362
|
+
<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>
|
|
5363
|
+
</button>
|
|
5364
|
+
</div>
|
|
5365
|
+
</div>
|
|
5366
|
+
|
|
5367
|
+
<!-- Tabs -->
|
|
5368
|
+
<div class="panel-tabs">
|
|
5369
|
+
<button class="tab active" data-tab="overview">
|
|
5370
|
+
<svg viewBox="0 0 24 24"><path d="M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"/></svg>
|
|
5371
|
+
Overview
|
|
5372
|
+
</button>
|
|
5373
|
+
<button class="tab" data-tab="components">
|
|
5374
|
+
<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>
|
|
5375
|
+
Components
|
|
5376
|
+
</button>
|
|
5377
|
+
<button class="tab" data-tab="chains">
|
|
5378
|
+
<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>
|
|
5379
|
+
Chains
|
|
5380
|
+
</button>
|
|
5381
|
+
<button class="tab" data-tab="settings">
|
|
5382
|
+
<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>
|
|
5383
|
+
Settings
|
|
5384
|
+
</button>
|
|
4855
5385
|
</div>
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
5386
|
+
|
|
5387
|
+
<!-- Overview Tab -->
|
|
5388
|
+
<div class="tab-content active" data-content="overview">
|
|
5389
|
+
<div class="stats-grid">
|
|
5390
|
+
<div class="stat-card critical">
|
|
5391
|
+
<div class="stat-value" id="rc-critical">0</div>
|
|
5392
|
+
<div class="stat-label">Critical</div>
|
|
5393
|
+
</div>
|
|
5394
|
+
<div class="stat-card warning">
|
|
5395
|
+
<div class="stat-value" id="rc-warning">0</div>
|
|
5396
|
+
<div class="stat-label">Warning</div>
|
|
5397
|
+
</div>
|
|
5398
|
+
<div class="stat-card healthy">
|
|
5399
|
+
<div class="stat-value" id="rc-healthy">0</div>
|
|
5400
|
+
<div class="stat-label">Healthy</div>
|
|
5401
|
+
</div>
|
|
5402
|
+
<div class="stat-card info">
|
|
5403
|
+
<div class="stat-value" id="rc-renders">0</div>
|
|
5404
|
+
<div class="stat-label">Renders</div>
|
|
5405
|
+
</div>
|
|
5406
|
+
<div class="stat-card wide">
|
|
5407
|
+
<div class="stat-value" id="rc-fps">60</div>
|
|
5408
|
+
<div class="stat-label">FPS</div>
|
|
5409
|
+
<div class="fps-bar">
|
|
5410
|
+
<div class="fps-bar-fill" id="rc-fps-bar" style="width: 100%; background: #22c55e;"></div>
|
|
5411
|
+
</div>
|
|
5412
|
+
</div>
|
|
5413
|
+
</div>
|
|
5414
|
+
|
|
5415
|
+
<div class="quick-actions">
|
|
5416
|
+
<button class="action-btn active" id="rc-toggle-highlights">
|
|
5417
|
+
<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>
|
|
5418
|
+
Highlights
|
|
5419
|
+
</button>
|
|
5420
|
+
<button class="action-btn" id="rc-clear">
|
|
5421
|
+
<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>
|
|
5422
|
+
Clear
|
|
5423
|
+
</button>
|
|
5424
|
+
</div>
|
|
4859
5425
|
</div>
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
5426
|
+
|
|
5427
|
+
<!-- Components Tab -->
|
|
5428
|
+
<div class="tab-content" data-content="components">
|
|
5429
|
+
<div class="component-list" id="rc-component-list">
|
|
5430
|
+
<div class="empty-state">
|
|
5431
|
+
<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>
|
|
5432
|
+
<div>No components rendered yet</div>
|
|
5433
|
+
</div>
|
|
5434
|
+
</div>
|
|
4863
5435
|
</div>
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
5436
|
+
|
|
5437
|
+
<!-- Chains Tab -->
|
|
5438
|
+
<div class="tab-content" data-content="chains">
|
|
5439
|
+
<div id="rc-chain-list">
|
|
5440
|
+
<div class="empty-state">
|
|
5441
|
+
<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>
|
|
5442
|
+
<div>No render chains detected</div>
|
|
5443
|
+
</div>
|
|
5444
|
+
</div>
|
|
5445
|
+
</div>
|
|
5446
|
+
|
|
5447
|
+
<!-- Settings Tab -->
|
|
5448
|
+
<div class="tab-content" data-content="settings">
|
|
5449
|
+
<div class="setting-group">
|
|
5450
|
+
<div class="setting-label">Display</div>
|
|
5451
|
+
<div class="setting-row">
|
|
5452
|
+
<div>
|
|
5453
|
+
<div class="setting-name">Show Highlights</div>
|
|
5454
|
+
<div class="setting-desc">Outline rendered components</div>
|
|
5455
|
+
</div>
|
|
5456
|
+
<div class="toggle active" id="rc-setting-highlights"></div>
|
|
5457
|
+
</div>
|
|
5458
|
+
</div>
|
|
5459
|
+
|
|
5460
|
+
<div class="setting-group">
|
|
5461
|
+
<div class="setting-label">Timing</div>
|
|
5462
|
+
<div class="setting-row">
|
|
5463
|
+
<div>
|
|
5464
|
+
<div class="setting-name">Highlight Duration</div>
|
|
5465
|
+
<div class="setting-desc">How long highlights stay visible</div>
|
|
5466
|
+
</div>
|
|
5467
|
+
<div class="range-container">
|
|
5468
|
+
<input type="range" id="rc-setting-duration" min="500" max="10000" step="500" value="2000">
|
|
5469
|
+
<span class="range-value" id="rc-duration-value">2s</span>
|
|
5470
|
+
</div>
|
|
5471
|
+
</div>
|
|
5472
|
+
</div>
|
|
5473
|
+
|
|
5474
|
+
<div class="setting-group">
|
|
5475
|
+
<div class="setting-label">About</div>
|
|
5476
|
+
<div class="setting-row" style="flex-direction: column; align-items: flex-start; gap: 4px;">
|
|
5477
|
+
<div class="setting-name">ReactCheck v1.1.6</div>
|
|
5478
|
+
<div class="setting-desc">React performance scanner</div>
|
|
5479
|
+
</div>
|
|
5480
|
+
</div>
|
|
4867
5481
|
</div>
|
|
4868
|
-
</div>
|
|
4869
|
-
<div class="toolbar-controls">
|
|
4870
|
-
<button class="toolbar-btn active" id="rc-highlights">Highlights</button>
|
|
4871
|
-
<button class="toolbar-btn active" id="rc-badges">Badges</button>
|
|
4872
|
-
<button class="toolbar-btn" id="rc-clear">Clear</button>
|
|
4873
5482
|
</div>
|
|
4874
5483
|
`;
|
|
5484
|
+
this.shadowRoot.appendChild(this.toolbar);
|
|
4875
5485
|
this.setupToolbarEvents();
|
|
4876
5486
|
this.makeDraggable(this.toolbar);
|
|
4877
|
-
this.shadowRoot.appendChild(this.toolbar);
|
|
4878
5487
|
}
|
|
4879
5488
|
/**
|
|
4880
5489
|
* Set up toolbar event listeners
|
|
4881
5490
|
*/
|
|
4882
5491
|
setupToolbarEvents() {
|
|
4883
5492
|
if (!this.toolbar || !this.shadowRoot) return;
|
|
4884
|
-
const
|
|
4885
|
-
if (
|
|
4886
|
-
|
|
4887
|
-
|
|
5493
|
+
const collapseBtn = this.shadowRoot.getElementById("rc-collapse");
|
|
5494
|
+
if (collapseBtn) {
|
|
5495
|
+
collapseBtn.addEventListener("click", (e) => {
|
|
5496
|
+
e.stopPropagation();
|
|
5497
|
+
this.toggleCollapse();
|
|
4888
5498
|
});
|
|
4889
5499
|
}
|
|
4890
|
-
|
|
5500
|
+
this.toolbar.addEventListener("click", (e) => {
|
|
5501
|
+
const target = e.target;
|
|
5502
|
+
if (this.collapsed && (target === this.toolbar || target.closest(".panel-icon"))) {
|
|
5503
|
+
this.toggleCollapse();
|
|
5504
|
+
}
|
|
5505
|
+
});
|
|
5506
|
+
const tabs = this.toolbar.querySelectorAll(".tab");
|
|
5507
|
+
tabs.forEach((tab) => {
|
|
5508
|
+
tab.addEventListener("click", () => {
|
|
5509
|
+
const tabName = tab.getAttribute("data-tab");
|
|
5510
|
+
this.switchTab(tabName);
|
|
5511
|
+
});
|
|
5512
|
+
});
|
|
5513
|
+
const highlightsBtn = this.shadowRoot.getElementById("rc-toggle-highlights");
|
|
4891
5514
|
if (highlightsBtn) {
|
|
4892
5515
|
highlightsBtn.addEventListener("click", () => {
|
|
4893
5516
|
this.config.highlightRenders = !this.config.highlightRenders;
|
|
4894
5517
|
highlightsBtn.classList.toggle("active", this.config.highlightRenders);
|
|
4895
|
-
|
|
4896
|
-
this.clearHighlights();
|
|
4897
|
-
}
|
|
4898
|
-
});
|
|
4899
|
-
}
|
|
4900
|
-
const badgesBtn = this.shadowRoot.getElementById("rc-badges");
|
|
4901
|
-
if (badgesBtn) {
|
|
4902
|
-
badgesBtn.addEventListener("click", () => {
|
|
4903
|
-
this.config.showBadges = !this.config.showBadges;
|
|
4904
|
-
badgesBtn.classList.toggle("active", this.config.showBadges);
|
|
4905
|
-
if (!this.config.showBadges) {
|
|
4906
|
-
this.clearBadges();
|
|
4907
|
-
}
|
|
5518
|
+
this.updateHighlightsVisibility();
|
|
4908
5519
|
});
|
|
4909
5520
|
}
|
|
4910
5521
|
const clearBtn = this.shadowRoot.getElementById("rc-clear");
|
|
@@ -4913,10 +5524,65 @@ var Overlay = class {
|
|
|
4913
5524
|
this.clear();
|
|
4914
5525
|
});
|
|
4915
5526
|
}
|
|
5527
|
+
const settingHighlights = this.shadowRoot.getElementById("rc-setting-highlights");
|
|
5528
|
+
if (settingHighlights) {
|
|
5529
|
+
settingHighlights.addEventListener("click", () => {
|
|
5530
|
+
this.config.highlightRenders = !this.config.highlightRenders;
|
|
5531
|
+
settingHighlights.classList.toggle("active", this.config.highlightRenders);
|
|
5532
|
+
highlightsBtn?.classList.toggle("active", this.config.highlightRenders);
|
|
5533
|
+
this.updateHighlightsVisibility();
|
|
5534
|
+
});
|
|
5535
|
+
}
|
|
5536
|
+
const durationSlider = this.shadowRoot.getElementById("rc-setting-duration");
|
|
5537
|
+
const durationValue = this.shadowRoot.getElementById("rc-duration-value");
|
|
5538
|
+
if (durationSlider && durationValue) {
|
|
5539
|
+
durationSlider.addEventListener("input", () => {
|
|
5540
|
+
const value = parseInt(durationSlider.value, 10);
|
|
5541
|
+
this.config.highlightDuration = value;
|
|
5542
|
+
durationValue.textContent = value >= 1e3 ? `${value / 1e3}s` : `${value}ms`;
|
|
5543
|
+
});
|
|
5544
|
+
}
|
|
5545
|
+
}
|
|
5546
|
+
/**
|
|
5547
|
+
* Toggle collapse state
|
|
5548
|
+
*/
|
|
5549
|
+
toggleCollapse() {
|
|
5550
|
+
this.collapsed = !this.collapsed;
|
|
5551
|
+
if (this.toolbar) {
|
|
5552
|
+
this.toolbar.classList.toggle("collapsed", this.collapsed);
|
|
5553
|
+
}
|
|
5554
|
+
}
|
|
5555
|
+
/**
|
|
5556
|
+
* Switch active tab
|
|
5557
|
+
*/
|
|
5558
|
+
switchTab(tabName) {
|
|
5559
|
+
if (!this.toolbar) return;
|
|
5560
|
+
const tabs = this.toolbar.querySelectorAll(".tab");
|
|
5561
|
+
tabs.forEach((tab) => {
|
|
5562
|
+
const isActive = tab.getAttribute("data-tab") === tabName;
|
|
5563
|
+
tab.classList.toggle("active", isActive);
|
|
5564
|
+
});
|
|
5565
|
+
const contents = this.toolbar.querySelectorAll(".tab-content");
|
|
5566
|
+
contents.forEach((content) => {
|
|
5567
|
+
const isActive = content.getAttribute("data-content") === tabName;
|
|
5568
|
+
content.classList.toggle("active", isActive);
|
|
5569
|
+
});
|
|
5570
|
+
if (tabName === "components") {
|
|
5571
|
+
this.updateComponentList();
|
|
5572
|
+
} else if (tabName === "chains") {
|
|
5573
|
+
this.updateChainList();
|
|
5574
|
+
}
|
|
5575
|
+
}
|
|
5576
|
+
/**
|
|
5577
|
+
* Update highlights visibility
|
|
5578
|
+
*/
|
|
5579
|
+
updateHighlightsVisibility() {
|
|
5580
|
+
for (const tracked of this.trackedComponents.values()) {
|
|
5581
|
+
tracked.highlightEl.style.display = this.config.highlightRenders ? "block" : "none";
|
|
5582
|
+
}
|
|
4916
5583
|
}
|
|
4917
5584
|
/**
|
|
4918
5585
|
* Make an element draggable
|
|
4919
|
-
* @param element - Element to make draggable
|
|
4920
5586
|
*/
|
|
4921
5587
|
makeDraggable(element) {
|
|
4922
5588
|
let isDragging = false;
|
|
@@ -4924,11 +5590,14 @@ var Overlay = class {
|
|
|
4924
5590
|
let startY = 0;
|
|
4925
5591
|
let initialX = 0;
|
|
4926
5592
|
let initialY = 0;
|
|
4927
|
-
element.
|
|
4928
|
-
|
|
5593
|
+
const header = element.querySelector(".panel-header");
|
|
5594
|
+
if (!header) return;
|
|
5595
|
+
header.addEventListener("mousedown", (e) => {
|
|
5596
|
+
const mouseEvent = e;
|
|
5597
|
+
if (mouseEvent.target.closest(".panel-btn")) return;
|
|
4929
5598
|
isDragging = true;
|
|
4930
|
-
startX =
|
|
4931
|
-
startY =
|
|
5599
|
+
startX = mouseEvent.clientX;
|
|
5600
|
+
startY = mouseEvent.clientY;
|
|
4932
5601
|
initialX = element.offsetLeft;
|
|
4933
5602
|
initialY = element.offsetTop;
|
|
4934
5603
|
});
|
|
@@ -4944,120 +5613,187 @@ var Overlay = class {
|
|
|
4944
5613
|
isDragging = false;
|
|
4945
5614
|
});
|
|
4946
5615
|
}
|
|
4947
|
-
/**
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
5616
|
+
/** Maximum number of highlights to show at once */
|
|
5617
|
+
static MAX_HIGHLIGHTS = 50;
|
|
5618
|
+
/** Component names to skip (generic/internal) */
|
|
5619
|
+
static SKIP_COMPONENTS = /* @__PURE__ */ new Set([
|
|
5620
|
+
"ForwardRef",
|
|
5621
|
+
"Anonymous",
|
|
5622
|
+
"Unknown",
|
|
5623
|
+
"Fragment",
|
|
5624
|
+
"Suspense",
|
|
5625
|
+
"Context.Provider",
|
|
5626
|
+
"Context.Consumer",
|
|
5627
|
+
"Profiler",
|
|
5628
|
+
"Root",
|
|
5629
|
+
"#text"
|
|
5630
|
+
]);
|
|
5631
|
+
/**
|
|
5632
|
+
* Highlight a component render
|
|
4951
5633
|
*/
|
|
4952
5634
|
highlight(render, element) {
|
|
4953
|
-
if (!this.
|
|
5635
|
+
if (!this.shadowRoot || !this.visible) return;
|
|
5636
|
+
if (_Overlay.SKIP_COMPONENTS.has(render.componentName)) {
|
|
5637
|
+
return;
|
|
5638
|
+
}
|
|
4954
5639
|
const rect = element.getBoundingClientRect();
|
|
4955
5640
|
if (rect.width === 0 || rect.height === 0) return;
|
|
5641
|
+
if (this.trackedComponents.size >= _Overlay.MAX_HIGHLIGHTS && !this.trackedComponents.has(render.componentName)) {
|
|
5642
|
+
const oldest = this.getOldestTrackedComponent();
|
|
5643
|
+
if (oldest) {
|
|
5644
|
+
this.removeHighlight(oldest);
|
|
5645
|
+
}
|
|
5646
|
+
}
|
|
5647
|
+
this.totalRenders++;
|
|
4956
5648
|
const severity = this.getSeverity(render);
|
|
4957
|
-
const
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
setTimeout(() => {
|
|
4986
|
-
highlight?.classList.add("fade");
|
|
4987
|
-
}, duration);
|
|
5649
|
+
const color = SEVERITY_COLORS[severity];
|
|
5650
|
+
let tracked = this.trackedComponents.get(render.componentName);
|
|
5651
|
+
if (tracked) {
|
|
5652
|
+
tracked.count++;
|
|
5653
|
+
tracked.element = element;
|
|
5654
|
+
tracked.lastRender = Date.now();
|
|
5655
|
+
tracked.severity = severity;
|
|
5656
|
+
tracked.renderTimes.push(render.renderTime);
|
|
5657
|
+
if (tracked.renderTimes.length > 100) tracked.renderTimes.shift();
|
|
5658
|
+
this.updateHighlightPosition(tracked, rect, color);
|
|
5659
|
+
const countLabel2 = tracked.highlightEl.querySelector(".label-count");
|
|
5660
|
+
if (countLabel2) {
|
|
5661
|
+
countLabel2.classList.remove("bump");
|
|
5662
|
+
void countLabel2.offsetWidth;
|
|
5663
|
+
countLabel2.classList.add("bump");
|
|
5664
|
+
}
|
|
5665
|
+
} else {
|
|
5666
|
+
const container = this.createHighlightElement(render.componentName, rect, color);
|
|
5667
|
+
tracked = {
|
|
5668
|
+
element,
|
|
5669
|
+
highlightEl: container,
|
|
5670
|
+
lastRender: Date.now(),
|
|
5671
|
+
count: 1,
|
|
5672
|
+
severity,
|
|
5673
|
+
renderTimes: [render.renderTime]
|
|
5674
|
+
};
|
|
5675
|
+
this.trackedComponents.set(render.componentName, tracked);
|
|
5676
|
+
this.shadowRoot.appendChild(container);
|
|
4988
5677
|
}
|
|
4989
|
-
|
|
4990
|
-
|
|
5678
|
+
const countLabel = tracked.highlightEl.querySelector(".label-count");
|
|
5679
|
+
if (countLabel) {
|
|
5680
|
+
countLabel.textContent = `\xD7${tracked.count}`;
|
|
4991
5681
|
}
|
|
4992
|
-
this.
|
|
5682
|
+
this.updateHighlightColor(tracked.highlightEl, color);
|
|
5683
|
+
this.resetFadeTimeout(render.componentName, tracked);
|
|
4993
5684
|
}
|
|
4994
5685
|
/**
|
|
4995
|
-
*
|
|
4996
|
-
* @param rect - Element bounding rectangle
|
|
4997
|
-
* @param color - Flash color
|
|
5686
|
+
* Add a render chain
|
|
4998
5687
|
*/
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5688
|
+
addChain(chain) {
|
|
5689
|
+
this.renderChains.unshift(chain);
|
|
5690
|
+
if (this.renderChains.length > 50) {
|
|
5691
|
+
this.renderChains.pop();
|
|
5692
|
+
}
|
|
5693
|
+
}
|
|
5694
|
+
/**
|
|
5695
|
+
* Update FPS value
|
|
5696
|
+
*/
|
|
5697
|
+
updateFps(fps) {
|
|
5698
|
+
this.fps = fps;
|
|
5699
|
+
}
|
|
5700
|
+
/**
|
|
5701
|
+
* Create a highlight element
|
|
5702
|
+
*/
|
|
5703
|
+
createHighlightElement(name, rect, color) {
|
|
5704
|
+
const container = document.createElement("div");
|
|
5705
|
+
container.className = "highlight-container";
|
|
5706
|
+
container.style.cssText = `
|
|
5004
5707
|
left: ${rect.left}px;
|
|
5005
5708
|
top: ${rect.top}px;
|
|
5006
5709
|
width: ${rect.width}px;
|
|
5007
5710
|
height: ${rect.height}px;
|
|
5008
|
-
|
|
5711
|
+
color: ${color};
|
|
5712
|
+
display: ${this.config.highlightRenders ? "block" : "none"};
|
|
5009
5713
|
`;
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5714
|
+
const border = document.createElement("div");
|
|
5715
|
+
border.className = "highlight-border";
|
|
5716
|
+
container.appendChild(border);
|
|
5717
|
+
const nameLabel = document.createElement("div");
|
|
5718
|
+
nameLabel.className = "label label-name";
|
|
5719
|
+
nameLabel.style.background = color;
|
|
5720
|
+
nameLabel.textContent = name;
|
|
5721
|
+
container.appendChild(nameLabel);
|
|
5722
|
+
const countLabel = document.createElement("div");
|
|
5723
|
+
countLabel.className = "label label-count";
|
|
5724
|
+
countLabel.style.background = color;
|
|
5725
|
+
countLabel.textContent = "\xD71";
|
|
5726
|
+
container.appendChild(countLabel);
|
|
5727
|
+
return container;
|
|
5728
|
+
}
|
|
5729
|
+
/**
|
|
5730
|
+
* Update highlight position
|
|
5731
|
+
*/
|
|
5732
|
+
updateHighlightPosition(tracked, rect, color) {
|
|
5733
|
+
tracked.highlightEl.style.left = `${rect.left}px`;
|
|
5734
|
+
tracked.highlightEl.style.top = `${rect.top}px`;
|
|
5735
|
+
tracked.highlightEl.style.width = `${rect.width}px`;
|
|
5736
|
+
tracked.highlightEl.style.height = `${rect.height}px`;
|
|
5737
|
+
tracked.highlightEl.style.color = color;
|
|
5738
|
+
tracked.highlightEl.classList.remove("fade");
|
|
5739
|
+
}
|
|
5740
|
+
/**
|
|
5741
|
+
* Update highlight color
|
|
5742
|
+
*/
|
|
5743
|
+
updateHighlightColor(container, color) {
|
|
5744
|
+
container.style.color = color;
|
|
5745
|
+
const labels = container.querySelectorAll(".label");
|
|
5746
|
+
labels.forEach((label) => {
|
|
5747
|
+
label.style.background = color;
|
|
5748
|
+
});
|
|
5014
5749
|
}
|
|
5015
5750
|
/**
|
|
5016
|
-
*
|
|
5017
|
-
* @param render - Render information
|
|
5018
|
-
* @param rect - Bounding rectangle
|
|
5019
|
-
* @param color - Badge color
|
|
5751
|
+
* Reset fade timeout
|
|
5020
5752
|
*/
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
if (
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
this.
|
|
5031
|
-
|
|
5032
|
-
const isNewBadge = !this.badges.has(render.componentName);
|
|
5033
|
-
badge.textContent = `${render.componentName}: ${count}`;
|
|
5034
|
-
badge.style.cssText = `
|
|
5035
|
-
position: fixed;
|
|
5036
|
-
left: ${rect.left}px;
|
|
5037
|
-
top: ${Math.max(0, rect.top - 20)}px;
|
|
5038
|
-
background: ${color};
|
|
5039
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
5040
|
-
font-size: 10px;
|
|
5041
|
-
font-weight: bold;
|
|
5042
|
-
padding: 2px 6px;
|
|
5043
|
-
border-radius: 4px;
|
|
5044
|
-
color: white;
|
|
5045
|
-
pointer-events: none;
|
|
5046
|
-
z-index: 2;
|
|
5047
|
-
white-space: nowrap;
|
|
5048
|
-
${isNewBadge ? "animation: badge-pop 0.3s ease-out;" : ""}
|
|
5049
|
-
`;
|
|
5050
|
-
if (!isNewBadge) {
|
|
5051
|
-
badge.style.transform = "scale(1.15)";
|
|
5052
|
-
setTimeout(() => {
|
|
5053
|
-
if (badge) badge.style.transform = "scale(1)";
|
|
5054
|
-
}, 150);
|
|
5753
|
+
resetFadeTimeout(name, tracked) {
|
|
5754
|
+
const existing = this.fadeTimeouts.get(name);
|
|
5755
|
+
if (existing) {
|
|
5756
|
+
clearTimeout(existing);
|
|
5757
|
+
}
|
|
5758
|
+
if (this.config.highlightDuration > 0) {
|
|
5759
|
+
const timeout = setTimeout(() => {
|
|
5760
|
+
tracked.highlightEl.classList.add("fade");
|
|
5761
|
+
this.fadeTimeouts.delete(name);
|
|
5762
|
+
}, this.config.highlightDuration);
|
|
5763
|
+
this.fadeTimeouts.set(name, timeout);
|
|
5055
5764
|
}
|
|
5056
5765
|
}
|
|
5057
5766
|
/**
|
|
5058
|
-
* Get
|
|
5059
|
-
|
|
5060
|
-
|
|
5767
|
+
* Get the oldest tracked component by last render time
|
|
5768
|
+
*/
|
|
5769
|
+
getOldestTrackedComponent() {
|
|
5770
|
+
let oldest = null;
|
|
5771
|
+
let oldestTime = Infinity;
|
|
5772
|
+
for (const [name, tracked] of this.trackedComponents) {
|
|
5773
|
+
if (tracked.lastRender < oldestTime) {
|
|
5774
|
+
oldestTime = tracked.lastRender;
|
|
5775
|
+
oldest = name;
|
|
5776
|
+
}
|
|
5777
|
+
}
|
|
5778
|
+
return oldest;
|
|
5779
|
+
}
|
|
5780
|
+
/**
|
|
5781
|
+
* Remove a highlight by component name
|
|
5782
|
+
*/
|
|
5783
|
+
removeHighlight(name) {
|
|
5784
|
+
const tracked = this.trackedComponents.get(name);
|
|
5785
|
+
if (tracked) {
|
|
5786
|
+
tracked.highlightEl.remove();
|
|
5787
|
+
this.trackedComponents.delete(name);
|
|
5788
|
+
const timeout = this.fadeTimeouts.get(name);
|
|
5789
|
+
if (timeout) {
|
|
5790
|
+
clearTimeout(timeout);
|
|
5791
|
+
this.fadeTimeouts.delete(name);
|
|
5792
|
+
}
|
|
5793
|
+
}
|
|
5794
|
+
}
|
|
5795
|
+
/**
|
|
5796
|
+
* Get severity level
|
|
5061
5797
|
*/
|
|
5062
5798
|
getSeverity(render) {
|
|
5063
5799
|
if (!render.necessary) return "unnecessary";
|
|
@@ -5066,66 +5802,145 @@ var Overlay = class {
|
|
|
5066
5802
|
return "healthy";
|
|
5067
5803
|
}
|
|
5068
5804
|
/**
|
|
5069
|
-
* Record a render event
|
|
5070
|
-
* @param render - Render information
|
|
5805
|
+
* Record a render event
|
|
5071
5806
|
*/
|
|
5072
5807
|
recordRender(render) {
|
|
5073
|
-
const
|
|
5074
|
-
|
|
5808
|
+
const tracked = this.trackedComponents.get(render.componentName);
|
|
5809
|
+
if (tracked) {
|
|
5810
|
+
tracked.count++;
|
|
5811
|
+
tracked.lastRender = Date.now();
|
|
5812
|
+
tracked.severity = this.getSeverity(render);
|
|
5813
|
+
const countLabel = tracked.highlightEl.querySelector(".label-count");
|
|
5814
|
+
if (countLabel) {
|
|
5815
|
+
countLabel.textContent = `\xD7${tracked.count}`;
|
|
5816
|
+
}
|
|
5817
|
+
}
|
|
5075
5818
|
this.totalRenders++;
|
|
5076
|
-
this.updateStats();
|
|
5077
5819
|
}
|
|
5078
|
-
/** Total render count */
|
|
5079
|
-
totalRenders = 0;
|
|
5080
5820
|
/**
|
|
5081
|
-
* Update
|
|
5821
|
+
* Update all stats
|
|
5082
5822
|
*/
|
|
5083
5823
|
updateStats() {
|
|
5084
5824
|
if (!this.shadowRoot) return;
|
|
5085
5825
|
let critical = 0;
|
|
5086
5826
|
let warning = 0;
|
|
5087
5827
|
let healthy = 0;
|
|
5088
|
-
for (const
|
|
5089
|
-
if (count > 50) critical++;
|
|
5090
|
-
else if (count > 20) warning++;
|
|
5828
|
+
for (const tracked of this.trackedComponents.values()) {
|
|
5829
|
+
if (tracked.count > 50) critical++;
|
|
5830
|
+
else if (tracked.count > 20) warning++;
|
|
5091
5831
|
else healthy++;
|
|
5092
5832
|
}
|
|
5093
5833
|
const criticalEl = this.shadowRoot.getElementById("rc-critical");
|
|
5094
5834
|
const warningEl = this.shadowRoot.getElementById("rc-warning");
|
|
5095
5835
|
const healthyEl = this.shadowRoot.getElementById("rc-healthy");
|
|
5096
5836
|
const rendersEl = this.shadowRoot.getElementById("rc-renders");
|
|
5837
|
+
const fpsEl = this.shadowRoot.getElementById("rc-fps");
|
|
5838
|
+
const fpsBar = this.shadowRoot.getElementById("rc-fps-bar");
|
|
5839
|
+
const durationEl = this.shadowRoot.getElementById("rc-duration");
|
|
5097
5840
|
if (criticalEl) criticalEl.textContent = String(critical);
|
|
5098
5841
|
if (warningEl) warningEl.textContent = String(warning);
|
|
5099
5842
|
if (healthyEl) healthyEl.textContent = String(healthy);
|
|
5100
5843
|
if (rendersEl) rendersEl.textContent = String(this.totalRenders);
|
|
5844
|
+
if (fpsEl) fpsEl.textContent = String(Math.round(this.fps));
|
|
5845
|
+
if (fpsBar) {
|
|
5846
|
+
const percent = Math.min(100, this.fps / 60 * 100);
|
|
5847
|
+
fpsBar.style.width = `${percent}%`;
|
|
5848
|
+
if (this.fps >= 50) {
|
|
5849
|
+
fpsBar.style.background = "#22c55e";
|
|
5850
|
+
} else if (this.fps >= 30) {
|
|
5851
|
+
fpsBar.style.background = "#f97316";
|
|
5852
|
+
} else {
|
|
5853
|
+
fpsBar.style.background = "#ef4444";
|
|
5854
|
+
}
|
|
5855
|
+
}
|
|
5856
|
+
if (durationEl) {
|
|
5857
|
+
const elapsed = Math.floor((Date.now() - this.startTime) / 1e3);
|
|
5858
|
+
const mins = Math.floor(elapsed / 60);
|
|
5859
|
+
const secs = elapsed % 60;
|
|
5860
|
+
durationEl.textContent = `${mins}:${secs.toString().padStart(2, "0")}`;
|
|
5861
|
+
}
|
|
5101
5862
|
}
|
|
5102
5863
|
/**
|
|
5103
|
-
*
|
|
5864
|
+
* Update component list in Components tab
|
|
5104
5865
|
*/
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5866
|
+
updateComponentList() {
|
|
5867
|
+
if (!this.shadowRoot) return;
|
|
5868
|
+
const list = this.shadowRoot.getElementById("rc-component-list");
|
|
5869
|
+
if (!list) return;
|
|
5870
|
+
const components = Array.from(this.trackedComponents.entries()).sort((a, b) => b[1].count - a[1].count);
|
|
5871
|
+
if (components.length === 0) {
|
|
5872
|
+
list.innerHTML = `
|
|
5873
|
+
<div class="empty-state">
|
|
5874
|
+
<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>
|
|
5875
|
+
<div>No components rendered yet</div>
|
|
5876
|
+
</div>
|
|
5877
|
+
`;
|
|
5878
|
+
return;
|
|
5108
5879
|
}
|
|
5109
|
-
|
|
5880
|
+
list.innerHTML = components.map(([name, tracked]) => {
|
|
5881
|
+
const color = SEVERITY_COLORS[tracked.severity];
|
|
5882
|
+
const avgTime = tracked.renderTimes.length > 0 ? (tracked.renderTimes.reduce((a, b) => a + b, 0) / tracked.renderTimes.length).toFixed(1) : "0";
|
|
5883
|
+
const timeSince = Math.floor((Date.now() - tracked.lastRender) / 1e3);
|
|
5884
|
+
const timeStr = timeSince < 60 ? `${timeSince}s ago` : `${Math.floor(timeSince / 60)}m ago`;
|
|
5885
|
+
return `
|
|
5886
|
+
<div class="component-item">
|
|
5887
|
+
<div class="component-severity" style="background: ${color}"></div>
|
|
5888
|
+
<div class="component-info">
|
|
5889
|
+
<div class="component-name">${name}</div>
|
|
5890
|
+
<div class="component-meta">${avgTime}ms avg \xB7 ${timeStr}</div>
|
|
5891
|
+
</div>
|
|
5892
|
+
<div class="component-count" style="color: ${color}">${tracked.count}</div>
|
|
5893
|
+
</div>
|
|
5894
|
+
`;
|
|
5895
|
+
}).join("");
|
|
5110
5896
|
}
|
|
5111
5897
|
/**
|
|
5112
|
-
*
|
|
5898
|
+
* Update chain list in Chains tab
|
|
5113
5899
|
*/
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5900
|
+
updateChainList() {
|
|
5901
|
+
if (!this.shadowRoot) return;
|
|
5902
|
+
const list = this.shadowRoot.getElementById("rc-chain-list");
|
|
5903
|
+
if (!list) return;
|
|
5904
|
+
if (this.renderChains.length === 0) {
|
|
5905
|
+
list.innerHTML = `
|
|
5906
|
+
<div class="empty-state">
|
|
5907
|
+
<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>
|
|
5908
|
+
<div>No render chains detected</div>
|
|
5909
|
+
</div>
|
|
5910
|
+
`;
|
|
5911
|
+
return;
|
|
5117
5912
|
}
|
|
5118
|
-
this.
|
|
5913
|
+
list.innerHTML = this.renderChains.slice(0, 10).map((chain) => {
|
|
5914
|
+
const flow = chain.chain.map((c) => `<span class="chain-node">${c}</span>`).join('<span class="chain-arrow">\u2192</span>');
|
|
5915
|
+
return `
|
|
5916
|
+
<div class="chain-item">
|
|
5917
|
+
<div class="chain-header">
|
|
5918
|
+
<span class="chain-trigger">${chain.trigger}</span>
|
|
5919
|
+
<span class="chain-count">${chain.chain.length} components</span>
|
|
5920
|
+
</div>
|
|
5921
|
+
<div class="chain-flow">${flow}</div>
|
|
5922
|
+
</div>
|
|
5923
|
+
`;
|
|
5924
|
+
}).join("");
|
|
5119
5925
|
}
|
|
5120
5926
|
/**
|
|
5121
5927
|
* Clear all visualizations
|
|
5122
5928
|
*/
|
|
5123
5929
|
clear() {
|
|
5124
|
-
this.
|
|
5125
|
-
|
|
5126
|
-
|
|
5930
|
+
for (const timeout of this.fadeTimeouts.values()) {
|
|
5931
|
+
clearTimeout(timeout);
|
|
5932
|
+
}
|
|
5933
|
+
this.fadeTimeouts.clear();
|
|
5934
|
+
for (const tracked of this.trackedComponents.values()) {
|
|
5935
|
+
tracked.highlightEl.remove();
|
|
5936
|
+
}
|
|
5937
|
+
this.trackedComponents.clear();
|
|
5938
|
+
this.renderChains = [];
|
|
5127
5939
|
this.totalRenders = 0;
|
|
5940
|
+
this.startTime = Date.now();
|
|
5128
5941
|
this.updateStats();
|
|
5942
|
+
this.updateComponentList();
|
|
5943
|
+
this.updateChainList();
|
|
5129
5944
|
}
|
|
5130
5945
|
/**
|
|
5131
5946
|
* Show the overlay
|
|
@@ -5157,18 +5972,26 @@ var Overlay = class {
|
|
|
5157
5972
|
}
|
|
5158
5973
|
/**
|
|
5159
5974
|
* Update configuration
|
|
5160
|
-
* @param config - Partial configuration
|
|
5161
5975
|
*/
|
|
5162
5976
|
configure(config) {
|
|
5163
5977
|
this.config = { ...this.config, ...config };
|
|
5164
5978
|
}
|
|
5165
5979
|
/**
|
|
5166
5980
|
* Check if overlay is visible
|
|
5167
|
-
* @returns true if visible
|
|
5168
5981
|
*/
|
|
5169
5982
|
isVisible() {
|
|
5170
5983
|
return this.visible;
|
|
5171
5984
|
}
|
|
5985
|
+
/**
|
|
5986
|
+
* Get render counts
|
|
5987
|
+
*/
|
|
5988
|
+
getRenderCounts() {
|
|
5989
|
+
const counts = /* @__PURE__ */ new Map();
|
|
5990
|
+
for (const [name, tracked] of this.trackedComponents) {
|
|
5991
|
+
counts.set(name, tracked.count);
|
|
5992
|
+
}
|
|
5993
|
+
return counts;
|
|
5994
|
+
}
|
|
5172
5995
|
};
|
|
5173
5996
|
|
|
5174
5997
|
// src/browser/scanner.ts
|
|
@@ -5243,8 +6066,6 @@ var BrowserScanner = class extends EventEmitter {
|
|
|
5243
6066
|
this.overlay = new Overlay({
|
|
5244
6067
|
enabled: true,
|
|
5245
6068
|
highlightRenders: this.config.highlightRenders ?? true,
|
|
5246
|
-
animationSpeed: this.config.animationSpeed ?? "fast",
|
|
5247
|
-
showBadges: true,
|
|
5248
6069
|
showToolbar: true
|
|
5249
6070
|
});
|
|
5250
6071
|
this.overlay.init();
|
|
@@ -5524,7 +6345,6 @@ var ReactCheckInjector = class {
|
|
|
5524
6345
|
this.overlay = new Overlay({
|
|
5525
6346
|
enabled: true,
|
|
5526
6347
|
highlightRenders: true,
|
|
5527
|
-
showBadges: true,
|
|
5528
6348
|
showToolbar: true
|
|
5529
6349
|
});
|
|
5530
6350
|
}
|
|
@@ -5681,9 +6501,6 @@ var ReactCheckInjector = class {
|
|
|
5681
6501
|
if (config.highlightRenders !== void 0) {
|
|
5682
6502
|
this.overlay.configure({ highlightRenders: config.highlightRenders });
|
|
5683
6503
|
}
|
|
5684
|
-
if (config.animationSpeed !== void 0) {
|
|
5685
|
-
this.overlay.configure({ animationSpeed: config.animationSpeed });
|
|
5686
|
-
}
|
|
5687
6504
|
}
|
|
5688
6505
|
/** Message queue for messages sent before connection */
|
|
5689
6506
|
messageQueue = [];
|
|
@@ -5725,6 +6542,10 @@ var ReactCheckInjector = class {
|
|
|
5725
6542
|
}
|
|
5726
6543
|
};
|
|
5727
6544
|
(function() {
|
|
6545
|
+
const currentUrl = window.location.href;
|
|
6546
|
+
if (currentUrl === "about:blank" || currentUrl.startsWith("chrome://") || currentUrl.startsWith("chrome-extension://") || currentUrl.startsWith("devtools://")) {
|
|
6547
|
+
return;
|
|
6548
|
+
}
|
|
5728
6549
|
const win = window;
|
|
5729
6550
|
if (win.__REACTCHECK_INJECTED__) {
|
|
5730
6551
|
return;
|