circuit-to-svg 0.0.166 → 0.0.168
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.d.ts +1 -0
- package/dist/index.js +33 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1446,7 +1446,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
1446
1446
|
var package_default = {
|
|
1447
1447
|
name: "circuit-to-svg",
|
|
1448
1448
|
type: "module",
|
|
1449
|
-
version: "0.0.
|
|
1449
|
+
version: "0.0.167",
|
|
1450
1450
|
description: "Convert Circuit JSON to SVG",
|
|
1451
1451
|
main: "dist/index.js",
|
|
1452
1452
|
files: [
|
|
@@ -1477,7 +1477,7 @@ var package_default = {
|
|
|
1477
1477
|
"@tscircuit/plop": "^0.0.10",
|
|
1478
1478
|
"@types/bun": "^1.2.8",
|
|
1479
1479
|
biome: "^0.3.3",
|
|
1480
|
-
"bun-match-svg": "^0.0.
|
|
1480
|
+
"bun-match-svg": "^0.0.12",
|
|
1481
1481
|
"circuit-json": "^0.0.218",
|
|
1482
1482
|
esbuild: "^0.20.2",
|
|
1483
1483
|
"performance-now": "^2.1.0",
|
|
@@ -2902,6 +2902,7 @@ var colorMap = {
|
|
|
2902
2902
|
sheet_filename: "rgb(114, 86, 0)",
|
|
2903
2903
|
sheet_label: "rgb(0, 100, 100)",
|
|
2904
2904
|
sheet_name: "rgb(0, 100, 100)",
|
|
2905
|
+
table: "rgb(102, 102, 102)",
|
|
2905
2906
|
value: "rgb(0, 100, 100)",
|
|
2906
2907
|
wire: "rgb(0, 150, 0)",
|
|
2907
2908
|
wire_crossing: "rgb(30, 180, 30)",
|
|
@@ -4532,21 +4533,45 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
4532
4533
|
children: []
|
|
4533
4534
|
});
|
|
4534
4535
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
4536
|
+
const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM;
|
|
4537
|
+
const pinChildren = [];
|
|
4535
4538
|
if (!isConnected) {
|
|
4536
|
-
|
|
4539
|
+
pinChildren.push({
|
|
4537
4540
|
name: "circle",
|
|
4538
4541
|
type: "element",
|
|
4539
4542
|
attributes: {
|
|
4540
4543
|
class: "component-pin",
|
|
4541
4544
|
cx: screenSchPortPos.x.toString(),
|
|
4542
4545
|
cy: screenSchPortPos.y.toString(),
|
|
4543
|
-
r:
|
|
4546
|
+
r: pinRadiusPx.toString(),
|
|
4544
4547
|
"stroke-width": `${getSchStrokeSize(transform)}px`
|
|
4545
4548
|
},
|
|
4546
4549
|
value: "",
|
|
4547
4550
|
children: []
|
|
4548
4551
|
});
|
|
4549
4552
|
}
|
|
4553
|
+
pinChildren.push({
|
|
4554
|
+
name: "rect",
|
|
4555
|
+
type: "element",
|
|
4556
|
+
attributes: {
|
|
4557
|
+
x: (screenSchPortPos.x - pinRadiusPx).toString(),
|
|
4558
|
+
y: (screenSchPortPos.y - pinRadiusPx).toString(),
|
|
4559
|
+
width: (pinRadiusPx * 2).toString(),
|
|
4560
|
+
height: (pinRadiusPx * 2).toString(),
|
|
4561
|
+
opacity: "0"
|
|
4562
|
+
},
|
|
4563
|
+
value: "",
|
|
4564
|
+
children: []
|
|
4565
|
+
});
|
|
4566
|
+
svgObjects.push({
|
|
4567
|
+
name: "g",
|
|
4568
|
+
type: "element",
|
|
4569
|
+
value: "",
|
|
4570
|
+
attributes: {
|
|
4571
|
+
"data-schematic-port-id": schPort.source_port_id
|
|
4572
|
+
},
|
|
4573
|
+
children: pinChildren
|
|
4574
|
+
});
|
|
4550
4575
|
return svgObjects;
|
|
4551
4576
|
};
|
|
4552
4577
|
|
|
@@ -5641,7 +5666,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
5641
5666
|
width: (screenBottomRightX - screenTopLeftX).toString(),
|
|
5642
5667
|
height: (screenBottomRightY - screenTopLeftY).toString(),
|
|
5643
5668
|
fill: "none",
|
|
5644
|
-
stroke:
|
|
5669
|
+
stroke: colorMap2.schematic.table,
|
|
5645
5670
|
"stroke-width": borderStrokeWidth.toString()
|
|
5646
5671
|
},
|
|
5647
5672
|
children: [],
|
|
@@ -5670,7 +5695,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
5670
5695
|
y1: start.y.toString(),
|
|
5671
5696
|
x2: end.x.toString(),
|
|
5672
5697
|
y2: end.y.toString(),
|
|
5673
|
-
stroke:
|
|
5698
|
+
stroke: colorMap2.schematic.table,
|
|
5674
5699
|
"stroke-width": gridStrokeWidth.toString()
|
|
5675
5700
|
},
|
|
5676
5701
|
children: [],
|
|
@@ -5703,7 +5728,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
5703
5728
|
y1: start.y.toString(),
|
|
5704
5729
|
x2: end.x.toString(),
|
|
5705
5730
|
y2: end.y.toString(),
|
|
5706
|
-
stroke:
|
|
5731
|
+
stroke: colorMap2.schematic.table,
|
|
5707
5732
|
"stroke-width": gridStrokeWidth.toString()
|
|
5708
5733
|
},
|
|
5709
5734
|
children: [],
|
|
@@ -5761,7 +5786,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
5761
5786
|
"font-size": `${fontSize}px`,
|
|
5762
5787
|
"text-anchor": textAnchorMap[horizontal_align],
|
|
5763
5788
|
"dominant-baseline": dominantBaselineMap[vertical_align],
|
|
5764
|
-
fill: colorMap2.schematic.
|
|
5789
|
+
fill: colorMap2.schematic.table,
|
|
5765
5790
|
"font-family": "sans-serif"
|
|
5766
5791
|
},
|
|
5767
5792
|
children: [
|