@tscircuit/schematic-viewer 2.0.93 → 2.0.94
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 +48 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1090,6 +1090,20 @@ import {
|
|
|
1090
1090
|
getPcbElementsWithinBounds
|
|
1091
1091
|
} from "@tscircuit/circuit-json-util";
|
|
1092
1092
|
import { gzipSync, strToU8 } from "fflate";
|
|
1093
|
+
var getComponentWarnings = (circuitJson, schematicComponent, pcbComponent) => circuitJson.filter((element) => {
|
|
1094
|
+
if (!element.type.endsWith("_warning")) return false;
|
|
1095
|
+
const warning = element;
|
|
1096
|
+
const references = [
|
|
1097
|
+
["source_component", schematicComponent.source_component_id],
|
|
1098
|
+
["schematic_component", schematicComponent.schematic_component_id],
|
|
1099
|
+
["pcb_component", pcbComponent?.pcb_component_id]
|
|
1100
|
+
];
|
|
1101
|
+
return references.some(([type, id]) => {
|
|
1102
|
+
if (!id) return false;
|
|
1103
|
+
const ids = warning[`${type}_ids`];
|
|
1104
|
+
return warning[`${type}_id`] === id || Array.isArray(ids) && ids.includes(id) || warning.schematic_element_type === type && warning.schematic_element_id === id;
|
|
1105
|
+
});
|
|
1106
|
+
});
|
|
1093
1107
|
var hiddenSourceComponentKeys = /* @__PURE__ */ new Set([
|
|
1094
1108
|
"type",
|
|
1095
1109
|
"source_component_id",
|
|
@@ -1198,7 +1212,12 @@ var getSchematicComponentDetails = (circuitJson, schematicComponentId) => {
|
|
|
1198
1212
|
pcbComponent,
|
|
1199
1213
|
footprinterString,
|
|
1200
1214
|
footprintPreviewCircuitJson: footprintPreview?.circuitJson,
|
|
1201
|
-
footprintPreviewViewBox: footprintPreview?.viewBox
|
|
1215
|
+
footprintPreviewViewBox: footprintPreview?.viewBox,
|
|
1216
|
+
warnings: getComponentWarnings(
|
|
1217
|
+
circuitJson,
|
|
1218
|
+
schematicComponent,
|
|
1219
|
+
pcbComponent
|
|
1220
|
+
)
|
|
1202
1221
|
};
|
|
1203
1222
|
};
|
|
1204
1223
|
var PCB_PREVIEW_PADDING_MM = 2;
|
|
@@ -1433,6 +1452,7 @@ var detailLabelStyle = {
|
|
|
1433
1452
|
};
|
|
1434
1453
|
var SchematicComponentDetailsTooltip = ({
|
|
1435
1454
|
sourceComponent,
|
|
1455
|
+
warnings = [],
|
|
1436
1456
|
footprinterString,
|
|
1437
1457
|
footprintPreviewCircuitJson,
|
|
1438
1458
|
footprintPreviewViewBox,
|
|
@@ -1567,6 +1587,31 @@ var SchematicComponentDetailsTooltip = ({
|
|
|
1567
1587
|
]
|
|
1568
1588
|
}
|
|
1569
1589
|
),
|
|
1590
|
+
warnings.length > 0 && /* @__PURE__ */ jsxs2(
|
|
1591
|
+
"section",
|
|
1592
|
+
{
|
|
1593
|
+
"aria-label": "Component warnings",
|
|
1594
|
+
style: {
|
|
1595
|
+
margin: "0 8px 8px",
|
|
1596
|
+
padding: "8px",
|
|
1597
|
+
border: "1px solid #fcd34d",
|
|
1598
|
+
borderRadius: "4px",
|
|
1599
|
+
backgroundColor: "#fffbeb",
|
|
1600
|
+
color: "#92400e",
|
|
1601
|
+
fontSize: "12px",
|
|
1602
|
+
lineHeight: 1.45,
|
|
1603
|
+
overflowWrap: "anywhere"
|
|
1604
|
+
},
|
|
1605
|
+
children: [
|
|
1606
|
+
/* @__PURE__ */ jsxs2("strong", { children: [
|
|
1607
|
+
"Warnings (",
|
|
1608
|
+
warnings.length,
|
|
1609
|
+
")"
|
|
1610
|
+
] }),
|
|
1611
|
+
/* @__PURE__ */ jsx3("ul", { style: { margin: "4px 0 0", paddingLeft: "18px" }, children: warnings.map((warning, index) => /* @__PURE__ */ jsx3("li", { children: warning.message }, `${warning.type}-${index}`)) })
|
|
1612
|
+
]
|
|
1613
|
+
}
|
|
1614
|
+
),
|
|
1570
1615
|
footprintPreviewUrl && /* @__PURE__ */ jsx3("div", { style: { padding: "0 4px 4px" }, children: /* @__PURE__ */ jsx3(
|
|
1571
1616
|
"div",
|
|
1572
1617
|
{
|
|
@@ -2723,7 +2768,7 @@ import { useMemo as useMemo5 } from "react";
|
|
|
2723
2768
|
// package.json
|
|
2724
2769
|
var package_default = {
|
|
2725
2770
|
name: "@tscircuit/schematic-viewer",
|
|
2726
|
-
version: "2.0.
|
|
2771
|
+
version: "2.0.93",
|
|
2727
2772
|
repository: {
|
|
2728
2773
|
type: "git",
|
|
2729
2774
|
url: "https://github.com/tscircuit/schematic-viewer"
|
|
@@ -3565,6 +3610,7 @@ var SchematicViewer = ({
|
|
|
3565
3610
|
SchematicComponentDetailsTooltip,
|
|
3566
3611
|
{
|
|
3567
3612
|
sourceComponent: selectedComponentDetails.sourceComponent,
|
|
3613
|
+
warnings: selectedComponentDetails.warnings,
|
|
3568
3614
|
footprinterString: selectedComponentDetails.footprinterString,
|
|
3569
3615
|
footprintPreviewCircuitJson: selectedComponentDetails.footprintPreviewCircuitJson,
|
|
3570
3616
|
footprintPreviewViewBox: selectedComponentDetails.footprintPreviewViewBox,
|