circuit-to-svg 0.0.241 → 0.0.243
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 +6 -33
- package/dist/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyCircuitElement, PcbPort, SchematicComponent } from 'circuit-json';
|
|
1
|
+
import { AnyCircuitElement, PcbPort, SimulationExperiment, SimulationTransientVoltageGraph, SimulationVoltageProbe, SchematicComponent } from 'circuit-json';
|
|
2
2
|
import { Matrix } from 'transformation-matrix';
|
|
3
3
|
import { INode } from 'svgson';
|
|
4
4
|
|
|
@@ -302,37 +302,10 @@ declare function convertCircuitJsonToSchematicSvg(circuitJson: AnyCircuitElement
|
|
|
302
302
|
*/
|
|
303
303
|
declare const circuitJsonToSchematicSvg: typeof convertCircuitJsonToSchematicSvg;
|
|
304
304
|
|
|
305
|
-
type
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
name: string;
|
|
310
|
-
experiment_type: ExperimentType;
|
|
311
|
-
}
|
|
312
|
-
interface SimulationTransientVoltageGraphElement {
|
|
313
|
-
type: "simulation_transient_voltage_graph";
|
|
314
|
-
simulation_transient_voltage_graph_id: string;
|
|
315
|
-
simulation_experiment_id: string;
|
|
316
|
-
timestamps_ms?: number[];
|
|
317
|
-
voltage_levels: number[];
|
|
318
|
-
schematic_voltage_probe_id?: string;
|
|
319
|
-
subcircuit_connecivity_map_key?: string;
|
|
320
|
-
time_per_step: number;
|
|
321
|
-
start_time_ms: number;
|
|
322
|
-
end_time_ms: number;
|
|
323
|
-
name?: string;
|
|
324
|
-
}
|
|
325
|
-
interface SimulationVoltageProbeElement {
|
|
326
|
-
type: "simulation_voltage_probe";
|
|
327
|
-
simulation_voltage_probe_id: string;
|
|
328
|
-
name: string;
|
|
329
|
-
source_port_id?: string;
|
|
330
|
-
source_net_id?: string;
|
|
331
|
-
}
|
|
332
|
-
type CircuitJsonWithSimulation = AnyCircuitElement | SimulationExperimentElement | SimulationTransientVoltageGraphElement | SimulationVoltageProbeElement;
|
|
333
|
-
declare function isSimulationTransientVoltageGraph(value: CircuitJsonWithSimulation): value is SimulationTransientVoltageGraphElement;
|
|
334
|
-
declare function isSimulationExperiment(value: CircuitJsonWithSimulation): value is SimulationExperimentElement;
|
|
335
|
-
declare function isSimulationVoltageProbe(value: CircuitJsonWithSimulation): value is SimulationVoltageProbeElement;
|
|
305
|
+
type CircuitJsonWithSimulation = AnyCircuitElement | SimulationExperiment | SimulationTransientVoltageGraph | SimulationVoltageProbe;
|
|
306
|
+
declare function isSimulationTransientVoltageGraph(value: CircuitJsonWithSimulation): value is SimulationTransientVoltageGraph;
|
|
307
|
+
declare function isSimulationExperiment(value: CircuitJsonWithSimulation): value is SimulationExperiment;
|
|
308
|
+
declare function isSimulationVoltageProbe(value: CircuitJsonWithSimulation): value is SimulationVoltageProbe;
|
|
336
309
|
|
|
337
310
|
interface ConvertSchematicSimulationParams {
|
|
338
311
|
circuitJson: CircuitJsonWithSimulation[];
|
|
@@ -374,4 +347,4 @@ declare const createSvgObjectsForSchComponentPortHovers: ({ component, transform
|
|
|
374
347
|
circuitJson: AnyCircuitElement[];
|
|
375
348
|
}) => INode[];
|
|
376
349
|
|
|
377
|
-
export { type AssemblySvgContext, CIRCUIT_TO_SVG_VERSION, type CircuitJsonWithSimulation, type ColorMap, type ColorOverrides, type
|
|
350
|
+
export { type AssemblySvgContext, CIRCUIT_TO_SVG_VERSION, type CircuitJsonWithSimulation, type ColorMap, type ColorOverrides, type PcbColorMap, type PcbColorOverrides, type PcbContext, type PinoutLabel, type PinoutSvgContext, circuitJsonToPcbSvg, circuitJsonToSchematicSvg, convertCircuitJsonToAssemblySvg, convertCircuitJsonToPcbSvg, convertCircuitJsonToPinoutSvg, convertCircuitJsonToSchematicSimulationSvg, convertCircuitJsonToSchematicSvg, convertCircuitJsonToSimulationGraphSvg, convertCircuitJsonToSolderPasteMask, createSvgObjectsForSchComponentPortHovers, getSoftwareUsedString, isSimulationExperiment, isSimulationTransientVoltageGraph, isSimulationVoltageProbe };
|
package/dist/index.js
CHANGED
|
@@ -3174,7 +3174,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
3174
3174
|
var package_default = {
|
|
3175
3175
|
name: "circuit-to-svg",
|
|
3176
3176
|
type: "module",
|
|
3177
|
-
version: "0.0.
|
|
3177
|
+
version: "0.0.242",
|
|
3178
3178
|
description: "Convert Circuit JSON to SVG",
|
|
3179
3179
|
main: "dist/index.js",
|
|
3180
3180
|
files: [
|
|
@@ -3198,7 +3198,7 @@ var package_default = {
|
|
|
3198
3198
|
"bun-match-svg": "^0.0.12",
|
|
3199
3199
|
esbuild: "^0.20.2",
|
|
3200
3200
|
"performance-now": "^2.1.0",
|
|
3201
|
-
"circuit-json": "^0.0.
|
|
3201
|
+
"circuit-json": "^0.0.281",
|
|
3202
3202
|
react: "19.1.0",
|
|
3203
3203
|
"react-cosmos": "7.0.0",
|
|
3204
3204
|
"react-cosmos-plugin-vite": "7.0.0",
|
|
@@ -9569,14 +9569,17 @@ function prepareSimulationGraphs(graphs, circuitJson) {
|
|
|
9569
9569
|
const voltageProbes = circuitJson.filter(isSimulationVoltageProbe);
|
|
9570
9570
|
const probeIdToName = /* @__PURE__ */ new Map();
|
|
9571
9571
|
for (const probe of voltageProbes) {
|
|
9572
|
-
|
|
9572
|
+
if (probe.name && probe.simulation_voltage_probe_id) {
|
|
9573
|
+
probeIdToName.set(probe.simulation_voltage_probe_id, probe.name);
|
|
9574
|
+
}
|
|
9573
9575
|
}
|
|
9574
9576
|
return graphs.map((graph, index) => {
|
|
9575
9577
|
const points = createGraphPoints(graph);
|
|
9576
9578
|
const paletteColor = palette.length > 0 ? palette[index % palette.length] : FALLBACK_LINE_COLOR;
|
|
9577
9579
|
const color = paletteColor ?? FALLBACK_LINE_COLOR;
|
|
9578
|
-
const
|
|
9579
|
-
const
|
|
9580
|
+
const probeId = graph.simulation_voltage_probe_id ?? graph.schematic_voltage_probe_id;
|
|
9581
|
+
const probeName = probeId ? probeIdToName.get(probeId) : void 0;
|
|
9582
|
+
const label = probeName ? `V(${probeName})` : graph.name || (probeId ? `Probe ${probeId}` : graph.simulation_transient_voltage_graph_id);
|
|
9580
9583
|
return { graph, points, color, label };
|
|
9581
9584
|
}).filter((entry) => entry.points.length > 0);
|
|
9582
9585
|
}
|
|
@@ -9921,8 +9924,8 @@ function createDataGroup(graphs, clipPathId, scaleX, scaleY) {
|
|
|
9921
9924
|
if (entry.graph.schematic_voltage_probe_id) {
|
|
9922
9925
|
baseAttributes["data-schematic-voltage-probe-id"] = entry.graph.schematic_voltage_probe_id;
|
|
9923
9926
|
}
|
|
9924
|
-
if (entry.graph.
|
|
9925
|
-
baseAttributes["data-subcircuit-connectivity-map-key"] = entry.graph.
|
|
9927
|
+
if (entry.graph.subcircuit_connectivity_map_key) {
|
|
9928
|
+
baseAttributes["data-subcircuit-connectivity-map-key"] = entry.graph.subcircuit_connectivity_map_key;
|
|
9926
9929
|
}
|
|
9927
9930
|
const pointElements2 = entry.points.map((point) => {
|
|
9928
9931
|
const cx = formatNumber(scaleX(point.timeMs));
|