circuit-to-svg 0.0.443 → 0.0.445
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 +78 -18
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1450,6 +1450,7 @@ function createSvgObjectsFromPcbTraceClearanceError(error, circuitJson, ctx) {
|
|
|
1450
1450
|
}
|
|
1451
1451
|
|
|
1452
1452
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-fabrication-note-path.ts
|
|
1453
|
+
import Color from "color";
|
|
1453
1454
|
import { applyToPoint as applyToPoint9 } from "transformation-matrix";
|
|
1454
1455
|
function createSvgObjectsFromPcbFabricationNotePath(fabNotePath, ctx) {
|
|
1455
1456
|
const { transform } = ctx;
|
|
@@ -1463,15 +1464,28 @@ function createSvgObjectsFromPcbFabricationNotePath(fabNotePath, ctx) {
|
|
|
1463
1464
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
1464
1465
|
}).join(" ") + (repeatsFirstPoint || fabNotePath.is_filled ? " Z" : "");
|
|
1465
1466
|
const color = fabNotePath.color || "rgba(255,255,255,0.5)";
|
|
1467
|
+
let paint = color;
|
|
1468
|
+
let opacity;
|
|
1469
|
+
if (fabNotePath.is_filled && fabNotePath.has_stroke !== false && fabNotePath.stroke_width > 0) {
|
|
1470
|
+
try {
|
|
1471
|
+
const parsedColor = Color(color);
|
|
1472
|
+
if (parsedColor.alpha() < 1) {
|
|
1473
|
+
paint = parsedColor.alpha(1).rgb().string();
|
|
1474
|
+
opacity = parsedColor.alpha().toString();
|
|
1475
|
+
}
|
|
1476
|
+
} catch {
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1466
1479
|
return [
|
|
1467
1480
|
{
|
|
1468
1481
|
name: "path",
|
|
1469
1482
|
type: "element",
|
|
1470
1483
|
attributes: {
|
|
1471
1484
|
class: "pcb-fabrication-note-path",
|
|
1472
|
-
stroke: fabNotePath.has_stroke === false ? "none" :
|
|
1473
|
-
fill: fabNotePath.is_filled ?
|
|
1485
|
+
stroke: fabNotePath.has_stroke === false ? "none" : paint,
|
|
1486
|
+
fill: fabNotePath.is_filled ? paint : "none",
|
|
1474
1487
|
d: path,
|
|
1488
|
+
...opacity === void 0 ? {} : { opacity },
|
|
1475
1489
|
"stroke-width": (fabNotePath.stroke_width * Math.abs(transform.a)).toString(),
|
|
1476
1490
|
"data-pcb-component-id": fabNotePath.pcb_component_id,
|
|
1477
1491
|
"data-pcb-fabrication-note-path-id": fabNotePath.pcb_fabrication_note_path_id,
|
|
@@ -5452,6 +5466,7 @@ function normalize3(x, y) {
|
|
|
5452
5466
|
}
|
|
5453
5467
|
|
|
5454
5468
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-via.ts
|
|
5469
|
+
import Color2 from "color";
|
|
5455
5470
|
import { applyToPoint as applyToPoint32 } from "transformation-matrix";
|
|
5456
5471
|
|
|
5457
5472
|
// lib/pcb/svg-object-fns/create-soldermask-overlay-element.ts
|
|
@@ -5541,20 +5556,62 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
|
5541
5556
|
]
|
|
5542
5557
|
};
|
|
5543
5558
|
if (showSolderMask && isTented) {
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5559
|
+
let maskPaint = colorMap2.soldermaskWithCopperUnderneath[layer];
|
|
5560
|
+
let holePaint;
|
|
5561
|
+
let maskOpacity = 1;
|
|
5562
|
+
try {
|
|
5563
|
+
const maskColor = Color2(maskPaint);
|
|
5564
|
+
maskOpacity = maskColor.alpha();
|
|
5565
|
+
maskPaint = maskColor.alpha(1).rgb().string();
|
|
5566
|
+
holePaint = Color2.rgb(
|
|
5567
|
+
maskColor.red() / 2,
|
|
5568
|
+
maskColor.green() / 2,
|
|
5569
|
+
maskColor.blue() / 2
|
|
5570
|
+
).string();
|
|
5571
|
+
} catch {
|
|
5572
|
+
}
|
|
5573
|
+
const tentingOverlay = {
|
|
5574
|
+
name: "g",
|
|
5575
|
+
type: "element",
|
|
5576
|
+
value: "",
|
|
5577
|
+
attributes: {
|
|
5578
|
+
class: "pcb-via-tenting",
|
|
5579
|
+
"data-type": "pcb_soldermask",
|
|
5580
|
+
"data-pcb-layer": layer,
|
|
5581
|
+
opacity: maskOpacity.toString()
|
|
5582
|
+
},
|
|
5583
|
+
children: [
|
|
5584
|
+
createSoldermaskOverlayElement({
|
|
5585
|
+
elementType: "circle",
|
|
5586
|
+
shapeAttributes: {
|
|
5587
|
+
cx: x.toString(),
|
|
5588
|
+
cy: y.toString(),
|
|
5589
|
+
r: outerRadius.toString()
|
|
5590
|
+
},
|
|
5591
|
+
layer,
|
|
5592
|
+
fillColor: maskPaint,
|
|
5593
|
+
fillOpacity: "1",
|
|
5594
|
+
className: "pcb-via-tenting-ring"
|
|
5595
|
+
})
|
|
5596
|
+
]
|
|
5597
|
+
};
|
|
5598
|
+
if (holePaint !== void 0) {
|
|
5599
|
+
tentingOverlay.children.push(
|
|
5600
|
+
createSoldermaskOverlayElement({
|
|
5601
|
+
elementType: "circle",
|
|
5602
|
+
shapeAttributes: {
|
|
5603
|
+
cx: x.toString(),
|
|
5604
|
+
cy: y.toString(),
|
|
5605
|
+
r: innerRadius.toString()
|
|
5606
|
+
},
|
|
5607
|
+
layer,
|
|
5608
|
+
fillColor: holePaint,
|
|
5609
|
+
fillOpacity: "1",
|
|
5610
|
+
className: "pcb-via-tenting-hole"
|
|
5611
|
+
})
|
|
5612
|
+
);
|
|
5613
|
+
}
|
|
5614
|
+
via.children.push(tentingOverlay);
|
|
5558
5615
|
}
|
|
5559
5616
|
return [via];
|
|
5560
5617
|
}
|
|
@@ -8518,7 +8575,7 @@ var package_default = {
|
|
|
8518
8575
|
engines: {
|
|
8519
8576
|
node: "24.x"
|
|
8520
8577
|
},
|
|
8521
|
-
version: "0.0.
|
|
8578
|
+
version: "0.0.444",
|
|
8522
8579
|
repository: {
|
|
8523
8580
|
type: "git",
|
|
8524
8581
|
url: "https://github.com/tscircuit/circuit-to-svg.git"
|
|
@@ -8576,6 +8633,7 @@ var package_default = {
|
|
|
8576
8633
|
"@types/node": "^22.5.5",
|
|
8577
8634
|
"bun-types": "^1.1.40",
|
|
8578
8635
|
"calculate-elbow": "0.0.12",
|
|
8636
|
+
color: "^5.0.3",
|
|
8579
8637
|
debug: "^4.4.3",
|
|
8580
8638
|
"svg-path-commander": "^2.1.11",
|
|
8581
8639
|
svgson: "^5.3.1",
|
|
@@ -8598,7 +8656,9 @@ function createSoldermaskOpeningMasks({
|
|
|
8598
8656
|
(object) => object.attributes["data-pcb-layer"] === layer && (object.attributes.class === "pcb-pad" || object.attributes.class === "pcb-pad-exposed" || object.attributes["data-type"] === "pcb_soldermask_opening")
|
|
8599
8657
|
);
|
|
8600
8658
|
if (openings.length === 0) return null;
|
|
8601
|
-
const tenting = objects.filter((object) => object.attributes["data-type"] === "pcb_via").flatMap((object) => object.children).filter(
|
|
8659
|
+
const tenting = objects.filter((object) => object.attributes["data-type"] === "pcb_via").flatMap((object) => object.children).filter(
|
|
8660
|
+
(object) => object.attributes.class === "pcb-via-tenting" || object.attributes.class === "pcb-via-tenting-hole"
|
|
8661
|
+
);
|
|
8602
8662
|
const pours = objects.filter(
|
|
8603
8663
|
(object) => showSolderMask && object.attributes["data-pcb-layer"] === layer && (object.attributes["data-type"] === "pcb_copper_pour" || object.attributes.class === "pcb-soldermask-covered-pour")
|
|
8604
8664
|
);
|