@tscircuit/core 0.0.1181 → 0.0.1183

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 CHANGED
@@ -46,6 +46,8 @@ type SimplifiedPcbTrace = {
46
46
  y: number;
47
47
  to_layer: string;
48
48
  from_layer: string;
49
+ via_diameter?: number;
50
+ via_hole_diameter?: number;
49
51
  } | {
50
52
  route_type: "jumper";
51
53
  start: {
@@ -94,6 +96,12 @@ interface SimpleRouteJson {
94
96
  layerCount: number;
95
97
  minTraceWidth: number;
96
98
  nominalTraceWidth?: number;
99
+ /** @deprecated Use `min_via_pad_diameter` / `minViaPadDiameter` instead. */
100
+ minViaDiameter?: number;
101
+ minViaHoleDiameter?: number;
102
+ minViaPadDiameter?: number;
103
+ min_via_hole_diameter?: number;
104
+ min_via_pad_diameter?: number;
97
105
  obstacles: Obstacle[];
98
106
  connections: Array<SimpleRouteConnection>;
99
107
  bounds: {
package/dist/index.js CHANGED
@@ -13938,6 +13938,11 @@ var getSimpleRouteJsonFromCircuitJson = ({
13938
13938
  // subcircuit
13939
13939
  layerCount: board?.num_layers ?? 2,
13940
13940
  minTraceWidth,
13941
+ minViaDiameter: board?.min_via_pad_diameter,
13942
+ minViaHoleDiameter: board?.min_via_hole_diameter,
13943
+ minViaPadDiameter: board?.min_via_pad_diameter,
13944
+ min_via_hole_diameter: board?.min_via_hole_diameter,
13945
+ min_via_pad_diameter: board?.min_via_pad_diameter,
13941
13946
  nominalTraceWidth,
13942
13947
  outline: board?.outline?.map((point6) => ({ ...point6 }))
13943
13948
  },
@@ -17462,22 +17467,23 @@ var getSpiceyEngine = () => {
17462
17467
 
17463
17468
  // lib/utils/simulation/getSimulationColorForId.ts
17464
17469
  var SIMULATION_COLOR_PALETTE = [
17465
- "rgb(132, 0, 0)",
17466
- "rgb(194, 194, 0)",
17467
- "rgb(194, 0, 194)",
17468
- "rgb(194, 0, 0)",
17469
- "rgb(0, 132, 132)",
17470
- "rgb(0, 132, 0)",
17470
+ // Start with the colors users most commonly expect from circuit sims.
17471
+ "rgb(0, 150, 0)",
17472
+ "rgb(0, 0, 220)",
17473
+ "rgb(220, 0, 0)",
17474
+ "rgb(0, 160, 160)",
17475
+ "rgb(180, 0, 180)",
17476
+ "rgb(170, 140, 0)",
17477
+ "rgb(220, 120, 0)",
17478
+ "rgb(128, 128, 128)",
17479
+ "rgb(100, 0, 180)",
17480
+ "rgb(140, 70, 0)",
17481
+ "rgb(220, 80, 120)",
17482
+ "rgb(0, 120, 220)",
17483
+ "rgb(0, 120, 120)",
17484
+ "rgb(120, 0, 0)",
17471
17485
  "rgb(0, 0, 132)",
17472
- "rgb(132, 132, 132)",
17473
- "rgb(132, 0, 132)",
17474
- "rgb(194, 194, 194)",
17475
- "rgb(132, 0, 132)",
17476
- "rgb(132, 0, 0)",
17477
- "rgb(132, 132, 0)",
17478
- "rgb(194, 194, 194)",
17479
- "rgb(0, 0, 132)",
17480
- "rgb(0, 132, 0)"
17486
+ "rgb(80, 80, 80)"
17481
17487
  ];
17482
17488
  var idToColorMap = /* @__PURE__ */ new Map();
17483
17489
  var colorIndex = 0;
@@ -17496,6 +17502,20 @@ function resetSimulationColorState() {
17496
17502
  colorIndex = 0;
17497
17503
  }
17498
17504
 
17505
+ // lib/utils/simulation/get-transient-voltage-graph-names-from-spice-netlist.ts
17506
+ function getTransientVoltageGraphNamesFromSpiceNetlist(spiceNetlist) {
17507
+ const graphNames = [];
17508
+ for (const printStatement of spiceNetlist.printStatements) {
17509
+ const match = printStatement.match(/^\.PRINT\s+TRAN\s+(.+)$/i);
17510
+ if (!match) continue;
17511
+ for (const voltageExpression of match[1].match(/V\(([^)]+)\)/g) ?? []) {
17512
+ const nodeList = voltageExpression.slice(2, -1);
17513
+ graphNames.push(nodeList.replace(",", "-"));
17514
+ }
17515
+ }
17516
+ return graphNames;
17517
+ }
17518
+
17499
17519
  // lib/components/primitive-components/Group/Group_doInitialSimulationSpiceEngineRender.ts
17500
17520
  var debug10 = Debug12("tscircuit:core:Group_doInitialSimulationSpiceEngineRender");
17501
17521
  function Group_doInitialSimulationSpiceEngineRender(group) {
@@ -17522,6 +17542,32 @@ ${spiceString}`);
17522
17542
  debug10(`Failed to convert circuit JSON to SPICE: ${error}`);
17523
17543
  return;
17524
17544
  }
17545
+ const graphNameToProbe = /* @__PURE__ */ new Map();
17546
+ for (const probe of voltageProbes) {
17547
+ if (probe.finalProbeName) {
17548
+ graphNameToProbe.set(probe.finalProbeName, probe);
17549
+ }
17550
+ }
17551
+ const voltageProbesById = new Map(
17552
+ voltageProbes.filter((probe) => probe.simulation_voltage_probe_id).map((probe) => [probe.simulation_voltage_probe_id, probe])
17553
+ );
17554
+ const orderedSimulationProbes = root.db.simulation_voltage_probe.list().filter((probe) => voltageProbesById.has(probe.simulation_voltage_probe_id));
17555
+ const graphNamesFromNetlist = getTransientVoltageGraphNamesFromSpiceNetlist(spiceNetlist);
17556
+ if (graphNamesFromNetlist.length === orderedSimulationProbes.length) {
17557
+ for (const [index, simulationProbe] of orderedSimulationProbes.entries()) {
17558
+ const probe = voltageProbesById.get(
17559
+ simulationProbe.simulation_voltage_probe_id
17560
+ );
17561
+ const graphName = graphNamesFromNetlist[index];
17562
+ if (probe && graphName) {
17563
+ graphNameToProbe.set(graphName, probe);
17564
+ }
17565
+ }
17566
+ } else {
17567
+ debug10(
17568
+ `Skipping probe-to-graph order mapping because counts differ: probes=${orderedSimulationProbes.length} graphNames=${graphNamesFromNetlist.length}`
17569
+ );
17570
+ }
17525
17571
  for (const analogSim of analogSims) {
17526
17572
  const engineName = analogSim._parsedProps.spiceEngine ?? "spicey";
17527
17573
  const spiceEngine = spiceEngineMap[engineName];
@@ -17551,9 +17597,7 @@ ${spiceString}`);
17551
17597
  for (const element of result.simulationResultCircuitJson) {
17552
17598
  if (element.type === "simulation_transient_voltage_graph") {
17553
17599
  element.simulation_experiment_id = simulationExperiment.simulation_experiment_id;
17554
- const probeMatch = voltageProbes.find(
17555
- (p) => p.finalProbeName === element.name
17556
- );
17600
+ const probeMatch = element.name ? graphNameToProbe.get(element.name) : void 0;
17557
17601
  if (probeMatch) element.color = probeMatch.color;
17558
17602
  }
17559
17603
  const elementType = element.type;
@@ -18785,6 +18829,9 @@ var Group6 = class extends NormalComponent3 {
18785
18829
  const { db } = this.root;
18786
18830
  const pcbStyle = this.getInheritedMergedProperty("pcbStyle");
18787
18831
  const { holeDiameter, padDiameter } = getViaDiameterDefaults(pcbStyle);
18832
+ const board = db.pcb_board.list()[0];
18833
+ const routedViaHoleDiameter = board?.min_via_hole_diameter ?? holeDiameter;
18834
+ const routedViaPadDiameter = board?.min_via_pad_diameter ?? padDiameter;
18788
18835
  if (output_jumpers && output_jumpers.length > 0) {
18789
18836
  insertAutoplacedJumpers({
18790
18837
  db,
@@ -18820,12 +18867,13 @@ var Group6 = class extends NormalComponent3 {
18820
18867
  if (pcb_trace.type === "pcb_trace") {
18821
18868
  for (const point6 of pcb_trace.route) {
18822
18869
  if (point6.route_type === "via") {
18870
+ const routedViaPoint = point6;
18823
18871
  db.pcb_via.insert({
18824
18872
  pcb_trace_id: pcb_trace.pcb_trace_id,
18825
18873
  x: point6.x,
18826
18874
  y: point6.y,
18827
- hole_diameter: holeDiameter,
18828
- outer_diameter: padDiameter,
18875
+ hole_diameter: routedViaPoint.via_hole_diameter ?? routedViaPoint.hole_diameter ?? routedViaHoleDiameter,
18876
+ outer_diameter: routedViaPoint.via_diameter ?? routedViaPoint.outer_diameter ?? routedViaPadDiameter,
18829
18877
  layers: [
18830
18878
  point6.from_layer,
18831
18879
  point6.to_layer
@@ -19872,7 +19920,7 @@ import { identity as identity5 } from "transformation-matrix";
19872
19920
  var package_default = {
19873
19921
  name: "@tscircuit/core",
19874
19922
  type: "module",
19875
- version: "0.0.1180",
19923
+ version: "0.0.1182",
19876
19924
  types: "dist/index.d.ts",
19877
19925
  main: "dist/index.js",
19878
19926
  module: "dist/index.js",
@@ -19904,7 +19952,7 @@ var package_default = {
19904
19952
  "@biomejs/biome": "^1.8.3",
19905
19953
  "@resvg/resvg-js": "^2.6.2",
19906
19954
  "@tscircuit/alphabet": "0.0.25",
19907
- "@tscircuit/capacity-autorouter": "^0.0.434",
19955
+ "@tscircuit/capacity-autorouter": "^0.0.447",
19908
19956
  "@tscircuit/checks": "0.0.120",
19909
19957
  "@tscircuit/circuit-json-util": "^0.0.93",
19910
19958
  "@tscircuit/common": "^0.0.20",
@@ -19938,7 +19986,7 @@ var package_default = {
19938
19986
  "circuit-json-to-gltf": "^0.0.91",
19939
19987
  "circuit-json-to-simple-3d": "^0.0.9",
19940
19988
  "circuit-json-to-spice": "^0.0.34",
19941
- "circuit-to-svg": "^0.0.343",
19989
+ "circuit-to-svg": "^0.0.345",
19942
19990
  concurrently: "^9.1.2",
19943
19991
  "connectivity-map": "^1.0.0",
19944
19992
  debug: "^4.3.6",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1181",
4
+ "version": "0.0.1183",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -33,7 +33,7 @@
33
33
  "@biomejs/biome": "^1.8.3",
34
34
  "@resvg/resvg-js": "^2.6.2",
35
35
  "@tscircuit/alphabet": "0.0.25",
36
- "@tscircuit/capacity-autorouter": "^0.0.434",
36
+ "@tscircuit/capacity-autorouter": "^0.0.447",
37
37
  "@tscircuit/checks": "0.0.120",
38
38
  "@tscircuit/circuit-json-util": "^0.0.93",
39
39
  "@tscircuit/common": "^0.0.20",
@@ -67,7 +67,7 @@
67
67
  "circuit-json-to-gltf": "^0.0.91",
68
68
  "circuit-json-to-simple-3d": "^0.0.9",
69
69
  "circuit-json-to-spice": "^0.0.34",
70
- "circuit-to-svg": "^0.0.343",
70
+ "circuit-to-svg": "^0.0.345",
71
71
  "concurrently": "^9.1.2",
72
72
  "connectivity-map": "^1.0.0",
73
73
  "debug": "^4.3.6",