circuit-to-svg 0.0.269 → 0.0.270
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 +19 -14
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3963,7 +3963,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
3963
3963
|
var package_default = {
|
|
3964
3964
|
name: "circuit-to-svg",
|
|
3965
3965
|
type: "module",
|
|
3966
|
-
version: "0.0.
|
|
3966
|
+
version: "0.0.269",
|
|
3967
3967
|
description: "Convert Circuit JSON to SVG",
|
|
3968
3968
|
main: "dist/index.js",
|
|
3969
3969
|
files: [
|
|
@@ -3987,7 +3987,7 @@ var package_default = {
|
|
|
3987
3987
|
"bun-match-svg": "^0.0.12",
|
|
3988
3988
|
esbuild: "^0.20.2",
|
|
3989
3989
|
"performance-now": "^2.1.0",
|
|
3990
|
-
"circuit-json": "^0.0.
|
|
3990
|
+
"circuit-json": "^0.0.315",
|
|
3991
3991
|
react: "19.1.0",
|
|
3992
3992
|
"react-cosmos": "7.0.0",
|
|
3993
3993
|
"react-cosmos-plugin-vite": "7.0.0",
|
|
@@ -8900,6 +8900,7 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
8900
8900
|
probe.position.x,
|
|
8901
8901
|
probe.position.y
|
|
8902
8902
|
]);
|
|
8903
|
+
const probeColor = probe.color ?? colorMap2.schematic.reference;
|
|
8903
8904
|
const arrowLength = Math.abs(transform.a) * 0.6;
|
|
8904
8905
|
const arrowWidth = Math.abs(transform.a) * 0.28;
|
|
8905
8906
|
const baseX = screenX + arrowLength * Math.cos(-50 * Math.PI / 180);
|
|
@@ -8974,8 +8975,8 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
8974
8975
|
type: "element",
|
|
8975
8976
|
attributes: {
|
|
8976
8977
|
d: arrowPath,
|
|
8977
|
-
stroke:
|
|
8978
|
-
fill:
|
|
8978
|
+
stroke: probeColor,
|
|
8979
|
+
fill: probeColor,
|
|
8979
8980
|
"stroke-width": `${getSchStrokeSize(transform)}px`
|
|
8980
8981
|
},
|
|
8981
8982
|
value: "",
|
|
@@ -8988,7 +8989,7 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
8988
8989
|
attributes: {
|
|
8989
8990
|
x,
|
|
8990
8991
|
y: baseY.toString(),
|
|
8991
|
-
fill:
|
|
8992
|
+
fill: probeColor,
|
|
8992
8993
|
"text-anchor": "start",
|
|
8993
8994
|
"dominant-baseline": "middle",
|
|
8994
8995
|
"font-family": "sans-serif",
|
|
@@ -10554,19 +10555,23 @@ function convertCircuitJsonToSimulationGraphSvg({
|
|
|
10554
10555
|
function prepareSimulationGraphs(graphs, circuitJson) {
|
|
10555
10556
|
const palette = Array.isArray(colorMap.palette) ? colorMap.palette : [];
|
|
10556
10557
|
const voltageProbes = circuitJson.filter(isSimulationVoltageProbe);
|
|
10557
|
-
const
|
|
10558
|
+
const sourceComponentIdToProbeName = /* @__PURE__ */ new Map();
|
|
10559
|
+
const sourceComponentIdToProbeColor = /* @__PURE__ */ new Map();
|
|
10558
10560
|
for (const probe of voltageProbes) {
|
|
10559
|
-
if (probe.name && probe.
|
|
10560
|
-
|
|
10561
|
+
if (probe.name && probe.source_component_id) {
|
|
10562
|
+
sourceComponentIdToProbeName.set(probe.source_component_id, probe.name);
|
|
10563
|
+
}
|
|
10564
|
+
if (probe.color && probe.source_component_id) {
|
|
10565
|
+
sourceComponentIdToProbeColor.set(probe.source_component_id, probe.color);
|
|
10561
10566
|
}
|
|
10562
10567
|
}
|
|
10563
10568
|
return graphs.map((graph, index) => {
|
|
10564
10569
|
const points = createGraphPoints(graph);
|
|
10565
10570
|
const paletteColor = palette.length > 0 ? palette[index % palette.length] : FALLBACK_LINE_COLOR;
|
|
10566
|
-
const
|
|
10567
|
-
const
|
|
10568
|
-
const probeName =
|
|
10569
|
-
const label = probeName ? `V(${probeName})` : graph.name || (
|
|
10571
|
+
const probeColor = graph.source_component_id ? sourceComponentIdToProbeColor.get(graph.source_component_id) : void 0;
|
|
10572
|
+
const color = graph.color ?? probeColor ?? paletteColor ?? FALLBACK_LINE_COLOR;
|
|
10573
|
+
const probeName = graph.source_component_id ? sourceComponentIdToProbeName.get(graph.source_component_id) : void 0;
|
|
10574
|
+
const label = probeName ? `V(${probeName})` : graph.name || (graph.source_component_id ? `Probe ${graph.source_component_id}` : graph.simulation_transient_voltage_graph_id);
|
|
10570
10575
|
return { graph, points, color, label };
|
|
10571
10576
|
}).filter((entry) => entry.points.length > 0);
|
|
10572
10577
|
}
|
|
@@ -10950,8 +10955,8 @@ function createDataGroup(graphs, clipPathId, scaleX, scaleY) {
|
|
|
10950
10955
|
"clip-path": `url(#${clipPathId})`,
|
|
10951
10956
|
"data-simulation-transient-voltage-graph-id": entry.graph.simulation_transient_voltage_graph_id
|
|
10952
10957
|
};
|
|
10953
|
-
if (entry.graph.
|
|
10954
|
-
baseAttributes["data-
|
|
10958
|
+
if (entry.graph.source_component_id) {
|
|
10959
|
+
baseAttributes["data-source-component-id"] = entry.graph.source_component_id;
|
|
10955
10960
|
}
|
|
10956
10961
|
if (entry.graph.subcircuit_connectivity_map_key) {
|
|
10957
10962
|
baseAttributes["data-subcircuit-connectivity-map-key"] = entry.graph.subcircuit_connectivity_map_key;
|