circuit-to-svg 0.0.227 → 0.0.228
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 +10 -2
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -312,9 +312,17 @@ interface SimulationTransientVoltageGraphElement {
|
|
|
312
312
|
end_time_ms: number;
|
|
313
313
|
name?: string;
|
|
314
314
|
}
|
|
315
|
-
|
|
315
|
+
interface SimulationVoltageProbeElement {
|
|
316
|
+
type: "simulation_voltage_probe";
|
|
317
|
+
simulation_voltage_probe_id: string;
|
|
318
|
+
name: string;
|
|
319
|
+
source_port_id?: string;
|
|
320
|
+
source_net_id?: string;
|
|
321
|
+
}
|
|
322
|
+
type CircuitJsonWithSimulation = AnyCircuitElement | SimulationExperimentElement | SimulationTransientVoltageGraphElement | SimulationVoltageProbeElement;
|
|
316
323
|
declare function isSimulationTransientVoltageGraph(value: CircuitJsonWithSimulation): value is SimulationTransientVoltageGraphElement;
|
|
317
324
|
declare function isSimulationExperiment(value: CircuitJsonWithSimulation): value is SimulationExperimentElement;
|
|
325
|
+
declare function isSimulationVoltageProbe(value: CircuitJsonWithSimulation): value is SimulationVoltageProbeElement;
|
|
318
326
|
|
|
319
327
|
interface ConvertSchematicSimulationParams {
|
|
320
328
|
circuitJson: CircuitJsonWithSimulation[];
|
|
@@ -356,4 +364,4 @@ declare const createSvgObjectsForSchComponentPortHovers: ({ component, transform
|
|
|
356
364
|
circuitJson: AnyCircuitElement[];
|
|
357
365
|
}) => INode[];
|
|
358
366
|
|
|
359
|
-
export { type AssemblySvgContext, CIRCUIT_TO_SVG_VERSION, type CircuitJsonWithSimulation, type ColorMap, type ColorOverrides, type ExperimentType, type PcbColorMap, type PcbColorOverrides, type PcbContext, type PinoutLabel, type PinoutSvgContext, type SimulationExperimentElement, type SimulationTransientVoltageGraphElement, circuitJsonToPcbSvg, circuitJsonToSchematicSvg, convertCircuitJsonToAssemblySvg, convertCircuitJsonToPcbSvg, convertCircuitJsonToPinoutSvg, convertCircuitJsonToSchematicSimulationSvg, convertCircuitJsonToSchematicSvg, convertCircuitJsonToSimulationGraphSvg, convertCircuitJsonToSolderPasteMask, createSvgObjectsForSchComponentPortHovers, getSoftwareUsedString, isSimulationExperiment, isSimulationTransientVoltageGraph };
|
|
367
|
+
export { type AssemblySvgContext, CIRCUIT_TO_SVG_VERSION, type CircuitJsonWithSimulation, type ColorMap, type ColorOverrides, type ExperimentType, type PcbColorMap, type PcbColorOverrides, type PcbContext, type PinoutLabel, type PinoutSvgContext, type SimulationExperimentElement, type SimulationTransientVoltageGraphElement, type SimulationVoltageProbeElement, circuitJsonToPcbSvg, circuitJsonToSchematicSvg, convertCircuitJsonToAssemblySvg, convertCircuitJsonToPcbSvg, convertCircuitJsonToPinoutSvg, convertCircuitJsonToSchematicSimulationSvg, convertCircuitJsonToSchematicSvg, convertCircuitJsonToSimulationGraphSvg, convertCircuitJsonToSolderPasteMask, createSvgObjectsForSchComponentPortHovers, getSoftwareUsedString, isSimulationExperiment, isSimulationTransientVoltageGraph, isSimulationVoltageProbe };
|
package/dist/index.js
CHANGED
|
@@ -1897,7 +1897,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
1897
1897
|
var package_default = {
|
|
1898
1898
|
name: "circuit-to-svg",
|
|
1899
1899
|
type: "module",
|
|
1900
|
-
version: "0.0.
|
|
1900
|
+
version: "0.0.227",
|
|
1901
1901
|
description: "Convert Circuit JSON to SVG",
|
|
1902
1902
|
main: "dist/index.js",
|
|
1903
1903
|
files: [
|
|
@@ -8336,6 +8336,9 @@ function isSimulationTransientVoltageGraph(value) {
|
|
|
8336
8336
|
function isSimulationExperiment(value) {
|
|
8337
8337
|
return value?.type === "simulation_experiment";
|
|
8338
8338
|
}
|
|
8339
|
+
function isSimulationVoltageProbe(value) {
|
|
8340
|
+
return value?.type === "simulation_voltage_probe";
|
|
8341
|
+
}
|
|
8339
8342
|
|
|
8340
8343
|
// lib/sim/convert-circuit-json-to-simulation-graph-svg.ts
|
|
8341
8344
|
var DEFAULT_WIDTH = 1200;
|
|
@@ -8362,7 +8365,7 @@ function convertCircuitJsonToSimulationGraphSvg({
|
|
|
8362
8365
|
`No simulation_transient_voltage_graph elements found for simulation_experiment_id "${simulation_experiment_id}"`
|
|
8363
8366
|
);
|
|
8364
8367
|
}
|
|
8365
|
-
const preparedGraphs = prepareSimulationGraphs(graphs);
|
|
8368
|
+
const preparedGraphs = prepareSimulationGraphs(graphs, circuitJson);
|
|
8366
8369
|
const allPoints = preparedGraphs.flatMap((entry) => entry.points);
|
|
8367
8370
|
if (allPoints.length === 0) {
|
|
8368
8371
|
throw new Error(
|
|
@@ -8438,13 +8441,19 @@ function convertCircuitJsonToSimulationGraphSvg({
|
|
|
8438
8441
|
);
|
|
8439
8442
|
return stringify5(svgObject);
|
|
8440
8443
|
}
|
|
8441
|
-
function prepareSimulationGraphs(graphs) {
|
|
8444
|
+
function prepareSimulationGraphs(graphs, circuitJson) {
|
|
8442
8445
|
const palette = Array.isArray(colorMap.palette) ? colorMap.palette : [];
|
|
8446
|
+
const voltageProbes = circuitJson.filter(isSimulationVoltageProbe);
|
|
8447
|
+
const probeIdToName = /* @__PURE__ */ new Map();
|
|
8448
|
+
for (const probe of voltageProbes) {
|
|
8449
|
+
probeIdToName.set(probe.simulation_voltage_probe_id, probe.name);
|
|
8450
|
+
}
|
|
8443
8451
|
return graphs.map((graph, index) => {
|
|
8444
8452
|
const points = createGraphPoints(graph);
|
|
8445
8453
|
const paletteColor = palette.length > 0 ? palette[index % palette.length] : FALLBACK_LINE_COLOR;
|
|
8446
8454
|
const color = paletteColor ?? FALLBACK_LINE_COLOR;
|
|
8447
|
-
const
|
|
8455
|
+
const probeName = graph.schematic_voltage_probe_id ? probeIdToName.get(graph.schematic_voltage_probe_id) : void 0;
|
|
8456
|
+
const label = graph.name || probeName || (graph.schematic_voltage_probe_id ? `Probe ${graph.schematic_voltage_probe_id}` : graph.simulation_transient_voltage_graph_id);
|
|
8448
8457
|
return { graph, points, color, label };
|
|
8449
8458
|
}).filter((entry) => entry.points.length > 0);
|
|
8450
8459
|
}
|
|
@@ -9261,6 +9270,7 @@ export {
|
|
|
9261
9270
|
createSvgObjectsForSchComponentPortHovers,
|
|
9262
9271
|
getSoftwareUsedString,
|
|
9263
9272
|
isSimulationExperiment,
|
|
9264
|
-
isSimulationTransientVoltageGraph
|
|
9273
|
+
isSimulationTransientVoltageGraph,
|
|
9274
|
+
isSimulationVoltageProbe
|
|
9265
9275
|
};
|
|
9266
9276
|
//# sourceMappingURL=index.js.map
|