@tscircuit/schematic-viewer 2.0.105 → 2.0.107
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 +10 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1468,6 +1468,10 @@ var priorityKeys = [
|
|
|
1468
1468
|
"power_rating",
|
|
1469
1469
|
"manufacturer_part_number"
|
|
1470
1470
|
];
|
|
1471
|
+
var displayKeyAliases = {
|
|
1472
|
+
current_rating_amps: "display_current_rating",
|
|
1473
|
+
voltage_rating_volts: "display_voltage_rating"
|
|
1474
|
+
};
|
|
1471
1475
|
var supplierPartNumberUrls = {
|
|
1472
1476
|
jlcpcb: (partNumber) => `https://jlcpcb.com/partdetail/${encodeURIComponent(partNumber)}`,
|
|
1473
1477
|
lcsc: (partNumber) => `https://www.lcsc.com/product-detail/${encodeURIComponent(partNumber)}.html`
|
|
@@ -1483,7 +1487,8 @@ var getKeyPriority = (key) => {
|
|
|
1483
1487
|
};
|
|
1484
1488
|
var formatComponentValue = (sourceComponent, key, value) => {
|
|
1485
1489
|
if (key === "name") return String(value);
|
|
1486
|
-
const
|
|
1490
|
+
const sourceComponentFields = sourceComponent;
|
|
1491
|
+
const displayValue = sourceComponentFields[`display_${key}`] ?? sourceComponentFields[displayKeyAliases[key]];
|
|
1487
1492
|
if (typeof displayValue === "string" && displayValue.trim()) {
|
|
1488
1493
|
const propValue = key === "resistance" ? displayValue.replace(/Ω$/, "") : displayValue;
|
|
1489
1494
|
return JSON.stringify(propValue);
|
|
@@ -1492,7 +1497,9 @@ var formatComponentValue = (sourceComponent, key, value) => {
|
|
|
1492
1497
|
};
|
|
1493
1498
|
var getSourceComponentInfoEntries = (sourceComponent) => Object.entries(sourceComponent).filter(([key, value]) => {
|
|
1494
1499
|
if (hiddenSourceComponentKeys.has(key)) return false;
|
|
1495
|
-
if (key.startsWith("display_") && key.slice("display_".length) in sourceComponent)
|
|
1500
|
+
if (key.startsWith("display_") && (key.slice("display_".length) in sourceComponent || Object.entries(displayKeyAliases).some(
|
|
1501
|
+
([sourceKey, displayKey]) => displayKey === key && sourceKey in sourceComponent
|
|
1502
|
+
))) {
|
|
1496
1503
|
return false;
|
|
1497
1504
|
}
|
|
1498
1505
|
return value !== void 0 && value !== null && value !== "";
|
|
@@ -3304,7 +3311,7 @@ import { useMemo as useMemo5 } from "react";
|
|
|
3304
3311
|
// package.json
|
|
3305
3312
|
var package_default = {
|
|
3306
3313
|
name: "@tscircuit/schematic-viewer",
|
|
3307
|
-
version: "2.0.
|
|
3314
|
+
version: "2.0.106",
|
|
3308
3315
|
repository: {
|
|
3309
3316
|
type: "git",
|
|
3310
3317
|
url: "https://github.com/tscircuit/schematic-viewer"
|