@tscircuit/pcb-viewer 1.11.363 → 1.11.364
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/dist/index.js +112 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12429,6 +12429,9 @@ var ErrorOverlay = ({
|
|
|
12429
12429
|
const traceErrors = elements.filter(
|
|
12430
12430
|
(el) => el.type === "pcb_trace_error"
|
|
12431
12431
|
);
|
|
12432
|
+
const viaClearanceErrors = elements.filter(
|
|
12433
|
+
(el) => el.type === "pcb_via_clearance_error"
|
|
12434
|
+
);
|
|
12432
12435
|
const componentErrors = elements.filter(
|
|
12433
12436
|
(el) => el.type === "pcb_trace_error" && el.message?.includes("Multiple components found with name")
|
|
12434
12437
|
);
|
|
@@ -12445,7 +12448,7 @@ var ErrorOverlay = ({
|
|
|
12445
12448
|
const port1 = pcb_port_ids?.[0] ? portsMap.get(pcb_port_ids[0]) : void 0;
|
|
12446
12449
|
const port2 = pcb_port_ids?.[1] ? portsMap.get(pcb_port_ids[1]) : void 0;
|
|
12447
12450
|
const trace = elements ? su(elements).pcb_trace.get(pcb_trace_id) : void 0;
|
|
12448
|
-
const errorId = el.pcb_trace_error_id
|
|
12451
|
+
const errorId = el.pcb_trace_error_id;
|
|
12449
12452
|
const isHighlighted = hoveredErrorId === errorId;
|
|
12450
12453
|
if (port1 && port2) {
|
|
12451
12454
|
const screenPort1 = applyToPoint11(transform, {
|
|
@@ -12459,12 +12462,12 @@ var ErrorOverlay = ({
|
|
|
12459
12462
|
if (!isShowingDRCErrors) {
|
|
12460
12463
|
return null;
|
|
12461
12464
|
}
|
|
12462
|
-
const canLineBeDrawn = !(isNaN(screenPort1.x) || isNaN(screenPort1.y) || isNaN(screenPort2.x) || isNaN(screenPort2.y));
|
|
12465
|
+
const canLineBeDrawn = !(Number.isNaN(screenPort1.x) || Number.isNaN(screenPort1.y) || Number.isNaN(screenPort2.x) || Number.isNaN(screenPort2.y));
|
|
12463
12466
|
const errorCenter = {
|
|
12464
12467
|
x: (screenPort1.x + screenPort2.x) / 2,
|
|
12465
12468
|
y: (screenPort1.y + screenPort2.y) / 2
|
|
12466
12469
|
};
|
|
12467
|
-
if (isNaN(errorCenter.x) || isNaN(errorCenter.y)) {
|
|
12470
|
+
if (Number.isNaN(errorCenter.x) || Number.isNaN(errorCenter.y)) {
|
|
12468
12471
|
return null;
|
|
12469
12472
|
}
|
|
12470
12473
|
const popupPosition = getPopupPosition(errorCenter, containerRef);
|
|
@@ -12551,7 +12554,8 @@ var ErrorOverlay = ({
|
|
|
12551
12554
|
const screenPoints = trace.route.map(
|
|
12552
12555
|
(pt) => applyToPoint11(transform, { x: pt.x, y: pt.y })
|
|
12553
12556
|
);
|
|
12554
|
-
if (screenPoints.some((pt) => isNaN(pt.x) || isNaN(pt.y)))
|
|
12557
|
+
if (screenPoints.some((pt) => Number.isNaN(pt.x) || Number.isNaN(pt.y)))
|
|
12558
|
+
return null;
|
|
12555
12559
|
const mid = Math.floor(screenPoints.length / 2);
|
|
12556
12560
|
const errorCenter = screenPoints[mid];
|
|
12557
12561
|
const popupPosition = getPopupPosition(errorCenter, containerRef);
|
|
@@ -12634,6 +12638,98 @@ var ErrorOverlay = ({
|
|
|
12634
12638
|
}
|
|
12635
12639
|
return null;
|
|
12636
12640
|
}),
|
|
12641
|
+
viaClearanceErrors.map((el, index) => {
|
|
12642
|
+
if (!el.pcb_center) return null;
|
|
12643
|
+
const errorId = el.pcb_via_ids;
|
|
12644
|
+
const isHighlighted = hoveredErrorId === errorId[0];
|
|
12645
|
+
if (!isHighlighted && !isShowingDRCErrors) return null;
|
|
12646
|
+
const errorCenter = applyToPoint11(transform, {
|
|
12647
|
+
x: el.pcb_center.x,
|
|
12648
|
+
y: el.pcb_center.y
|
|
12649
|
+
});
|
|
12650
|
+
if (Number.isNaN(errorCenter.x) || Number.isNaN(errorCenter.y))
|
|
12651
|
+
return null;
|
|
12652
|
+
const popupPosition = getPopupPosition(
|
|
12653
|
+
{ x: errorCenter.x, y: errorCenter.y },
|
|
12654
|
+
containerRef
|
|
12655
|
+
);
|
|
12656
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
12657
|
+
/* @__PURE__ */ jsx10(
|
|
12658
|
+
RouteSVG,
|
|
12659
|
+
{
|
|
12660
|
+
points: [],
|
|
12661
|
+
errorCenter,
|
|
12662
|
+
isHighlighted
|
|
12663
|
+
}
|
|
12664
|
+
),
|
|
12665
|
+
/* @__PURE__ */ jsx10(
|
|
12666
|
+
"div",
|
|
12667
|
+
{
|
|
12668
|
+
style: {
|
|
12669
|
+
position: "absolute",
|
|
12670
|
+
left: errorCenter.x - 15,
|
|
12671
|
+
top: errorCenter.y - 15,
|
|
12672
|
+
width: 30,
|
|
12673
|
+
height: 30,
|
|
12674
|
+
zIndex: zIndexMap.errorOverlay + 5,
|
|
12675
|
+
cursor: "pointer",
|
|
12676
|
+
borderRadius: "50%"
|
|
12677
|
+
},
|
|
12678
|
+
onMouseEnter: (e) => {
|
|
12679
|
+
const popup = e.currentTarget.nextElementSibling;
|
|
12680
|
+
if (popup) {
|
|
12681
|
+
const msg = popup.querySelector(
|
|
12682
|
+
".error-message"
|
|
12683
|
+
);
|
|
12684
|
+
if (msg) msg.style.opacity = "1";
|
|
12685
|
+
}
|
|
12686
|
+
},
|
|
12687
|
+
onMouseLeave: (e) => {
|
|
12688
|
+
if (!isHighlighted) {
|
|
12689
|
+
const popup = e.currentTarget.nextElementSibling;
|
|
12690
|
+
if (popup) {
|
|
12691
|
+
const msg = popup.querySelector(
|
|
12692
|
+
".error-message"
|
|
12693
|
+
);
|
|
12694
|
+
if (msg) msg.style.opacity = "0";
|
|
12695
|
+
}
|
|
12696
|
+
}
|
|
12697
|
+
}
|
|
12698
|
+
}
|
|
12699
|
+
),
|
|
12700
|
+
/* @__PURE__ */ jsx10(
|
|
12701
|
+
"div",
|
|
12702
|
+
{
|
|
12703
|
+
style: {
|
|
12704
|
+
position: "absolute",
|
|
12705
|
+
zIndex: isHighlighted ? zIndexMap.errorOverlay + 10 : zIndexMap.errorOverlay + 1,
|
|
12706
|
+
left: popupPosition.left,
|
|
12707
|
+
top: popupPosition.top,
|
|
12708
|
+
color: isHighlighted ? "#ff4444" : "red",
|
|
12709
|
+
textAlign: "center",
|
|
12710
|
+
fontFamily: "sans-serif",
|
|
12711
|
+
fontSize: 12,
|
|
12712
|
+
display: "flex",
|
|
12713
|
+
flexDirection: "column",
|
|
12714
|
+
alignItems: "center",
|
|
12715
|
+
pointerEvents: "none",
|
|
12716
|
+
transform: popupPosition.transform
|
|
12717
|
+
},
|
|
12718
|
+
children: /* @__PURE__ */ jsx10(
|
|
12719
|
+
"div",
|
|
12720
|
+
{
|
|
12721
|
+
className: `error-message ${errorMessageStyles}`,
|
|
12722
|
+
style: {
|
|
12723
|
+
opacity: isHighlighted ? 1 : 0,
|
|
12724
|
+
border: `1px solid ${isHighlighted ? "#ff4444" : "red"}`
|
|
12725
|
+
},
|
|
12726
|
+
children: el.message
|
|
12727
|
+
}
|
|
12728
|
+
)
|
|
12729
|
+
}
|
|
12730
|
+
)
|
|
12731
|
+
] }, errorId[0]);
|
|
12732
|
+
}),
|
|
12637
12733
|
componentErrors.map((el, index) => {
|
|
12638
12734
|
const componentName = el.component_name || el.message?.match(/name "([^"]+)"/)?.[1];
|
|
12639
12735
|
if (!componentName) return null;
|
|
@@ -12642,7 +12738,7 @@ var ErrorOverlay = ({
|
|
|
12642
12738
|
(src) => src.type === "source_component" && src.source_component_id === comp.source_component_id && src.name === componentName
|
|
12643
12739
|
)
|
|
12644
12740
|
) || [];
|
|
12645
|
-
const errorId = el.
|
|
12741
|
+
const errorId = el.error_id;
|
|
12646
12742
|
const isHighlighted = hoveredErrorId === errorId;
|
|
12647
12743
|
if (!isHighlighted && !isShowingDRCErrors) return null;
|
|
12648
12744
|
return components.map((comp, compIndex) => {
|
|
@@ -12657,7 +12753,8 @@ var ErrorOverlay = ({
|
|
|
12657
12753
|
center = pcbComp.center || { x: 0, y: 0 };
|
|
12658
12754
|
}
|
|
12659
12755
|
const screenCenter = applyToPoint11(transform, center);
|
|
12660
|
-
if (isNaN(screenCenter.x) || isNaN(screenCenter.y))
|
|
12756
|
+
if (Number.isNaN(screenCenter.x) || Number.isNaN(screenCenter.y))
|
|
12757
|
+
return null;
|
|
12661
12758
|
const scale6 = Math.abs(transform.a);
|
|
12662
12759
|
const baseRadius = 0.5;
|
|
12663
12760
|
const minRadius = 8;
|
|
@@ -12767,7 +12864,7 @@ var ErrorOverlay = ({
|
|
|
12767
12864
|
)
|
|
12768
12865
|
}
|
|
12769
12866
|
)
|
|
12770
|
-
] },
|
|
12867
|
+
] }, errorId);
|
|
12771
12868
|
});
|
|
12772
12869
|
})
|
|
12773
12870
|
] });
|
|
@@ -14368,7 +14465,7 @@ import { css as css3 } from "@emotion/css";
|
|
|
14368
14465
|
// package.json
|
|
14369
14466
|
var package_default = {
|
|
14370
14467
|
name: "@tscircuit/pcb-viewer",
|
|
14371
|
-
version: "1.11.
|
|
14468
|
+
version: "1.11.363",
|
|
14372
14469
|
main: "dist/index.js",
|
|
14373
14470
|
type: "module",
|
|
14374
14471
|
repository: "tscircuit/pcb-viewer",
|
|
@@ -14616,12 +14713,6 @@ var ToolbarErrorDropdown = ({
|
|
|
14616
14713
|
[elements]
|
|
14617
14714
|
);
|
|
14618
14715
|
const errorCount = errorElements.length;
|
|
14619
|
-
const getErrorId = useCallback8(
|
|
14620
|
-
(error, index) => {
|
|
14621
|
-
return error.pcb_trace_error_id || `error_${index}_${error.error_type}_${error.message?.slice(0, 20)}`;
|
|
14622
|
-
},
|
|
14623
|
-
[]
|
|
14624
|
-
);
|
|
14625
14716
|
const groupedErrorElements = useMemo7(() => {
|
|
14626
14717
|
const groups = /* @__PURE__ */ new Map();
|
|
14627
14718
|
errorElements.forEach((error, index) => {
|
|
@@ -14630,7 +14721,7 @@ var ToolbarErrorDropdown = ({
|
|
|
14630
14721
|
existingGroup.push({
|
|
14631
14722
|
error,
|
|
14632
14723
|
index,
|
|
14633
|
-
errorId:
|
|
14724
|
+
errorId: error.pcb_trace_error_id
|
|
14634
14725
|
});
|
|
14635
14726
|
groups.set(errorType, existingGroup);
|
|
14636
14727
|
});
|
|
@@ -14638,7 +14729,7 @@ var ToolbarErrorDropdown = ({
|
|
|
14638
14729
|
errorType,
|
|
14639
14730
|
errors
|
|
14640
14731
|
}));
|
|
14641
|
-
}, [errorElements
|
|
14732
|
+
}, [errorElements]);
|
|
14642
14733
|
const toggleErrorGroup = useCallback8((errorType) => {
|
|
14643
14734
|
setCollapsedErrorGroups((prev) => {
|
|
14644
14735
|
const next = new Set(prev);
|
|
@@ -15577,9 +15668,8 @@ var CanvasElementsRenderer = (props) => {
|
|
|
15577
15668
|
const errorElements = elements.filter(
|
|
15578
15669
|
(el) => el.type.includes("error")
|
|
15579
15670
|
);
|
|
15580
|
-
const hoveredError = errorElements.find((el
|
|
15581
|
-
|
|
15582
|
-
return errorId === hoveredErrorId;
|
|
15671
|
+
const hoveredError = errorElements.find((el) => {
|
|
15672
|
+
return el.error_id === hoveredErrorId;
|
|
15583
15673
|
});
|
|
15584
15674
|
if (!hoveredError) return [];
|
|
15585
15675
|
const relatedIds = [];
|
|
@@ -15589,6 +15679,9 @@ var CanvasElementsRenderer = (props) => {
|
|
|
15589
15679
|
if (hoveredError.pcb_port_ids) {
|
|
15590
15680
|
relatedIds.push(...hoveredError.pcb_port_ids);
|
|
15591
15681
|
}
|
|
15682
|
+
if (hoveredError.pcb_via_ids) {
|
|
15683
|
+
relatedIds.push(...hoveredError.pcb_via_ids);
|
|
15684
|
+
}
|
|
15592
15685
|
return relatedIds;
|
|
15593
15686
|
}, [hoveredErrorId, elements]);
|
|
15594
15687
|
const primitives = useMemo8(() => {
|