@tscircuit/core 0.0.587 → 0.0.588

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
@@ -271,6 +271,7 @@ interface ISubcircuit extends PrimitiveComponent {
271
271
  _shouldUseTraceByTraceRouting(): boolean;
272
272
  _parsedProps: z.infer<typeof subcircuitGroupProps>;
273
273
  _getAutorouterConfig(): AutorouterConfig;
274
+ _getSubcircuitLayerCount(): number;
274
275
  subcircuit_id: string | null;
275
276
  }
276
277
 
@@ -1095,6 +1096,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
1095
1096
  maxY: number;
1096
1097
  };
1097
1098
  _getAutorouterConfig(): AutorouterConfig;
1099
+ _getSubcircuitLayerCount(): number;
1098
1100
  /**
1099
1101
  * Trace-by-trace autorouting is where each trace routes itself in a well-known
1100
1102
  * order. It's the most deterministic way to autoroute, because a new trace
@@ -2003,7 +2005,8 @@ declare class Board extends Group<typeof boardProps> {
2003
2005
  /**
2004
2006
  * Get all available layers for the board
2005
2007
  */
2006
- get allLayers(): string[];
2008
+ get allLayers(): readonly ["top", "bottom", "inner1", "inner2"] | readonly ["top", "bottom"];
2009
+ _getSubcircuitLayerCount(): number;
2007
2010
  doInitialPcbBoardAutoSize(): void;
2008
2011
  /**
2009
2012
  * Update the board information silkscreen text if platform config is set and
package/dist/index.js CHANGED
@@ -5505,7 +5505,7 @@ function Trace_doInitialPcbTraceRender(trace) {
5505
5505
  ]
5506
5506
  }
5507
5507
  ],
5508
- layerCount: 2,
5508
+ layerCount: trace.getSubcircuit()._getSubcircuitLayerCount(),
5509
5509
  bounds: {
5510
5510
  minX: Math.min(a.x, b.x) - BOUNDS_MARGIN,
5511
5511
  maxX: Math.max(a.x, b.x) + BOUNDS_MARGIN,
@@ -7500,7 +7500,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
7500
7500
  connections: allConns,
7501
7501
  // TODO add traces so that we don't run into things routed by another
7502
7502
  // subcircuit
7503
- layerCount: 2,
7503
+ layerCount: board?.num_layers ?? 2,
7504
7504
  minTraceWidth
7505
7505
  },
7506
7506
  connMap
@@ -8802,6 +8802,10 @@ var Group = class extends NormalComponent {
8802
8802
  const autorouter = this._parsedProps.autorouter || this.getInheritedProperty("autorouter");
8803
8803
  return getPresetAutoroutingConfig(autorouter);
8804
8804
  }
8805
+ _getSubcircuitLayerCount() {
8806
+ const layers = this.getInheritedProperty("layers");
8807
+ return typeof layers === "number" ? layers : 2;
8808
+ }
8805
8809
  /**
8806
8810
  * Trace-by-trace autorouting is where each trace routes itself in a well-known
8807
8811
  * order. It's the most deterministic way to autoroute, because a new trace
@@ -8891,7 +8895,14 @@ var Board = class extends Group {
8891
8895
  * Get all available layers for the board
8892
8896
  */
8893
8897
  get allLayers() {
8894
- return ["top", "bottom", "inner1", "inner2"];
8898
+ const layerCount = this._parsedProps.layers ?? 2;
8899
+ if (layerCount === 4) {
8900
+ return ["top", "bottom", "inner1", "inner2"];
8901
+ }
8902
+ return ["top", "bottom"];
8903
+ }
8904
+ _getSubcircuitLayerCount() {
8905
+ return this._parsedProps.layers ?? 2;
8895
8906
  }
8896
8907
  doInitialPcbBoardAutoSize() {
8897
8908
  if (this.root?.pcbDisabled) return;
@@ -11170,7 +11181,7 @@ import { identity as identity5 } from "transformation-matrix";
11170
11181
  var package_default = {
11171
11182
  name: "@tscircuit/core",
11172
11183
  type: "module",
11173
- version: "0.0.586",
11184
+ version: "0.0.587",
11174
11185
  types: "dist/index.d.ts",
11175
11186
  main: "dist/index.js",
11176
11187
  module: "dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.587",
4
+ "version": "0.0.588",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",