@tscircuit/core 0.0.840 → 0.0.841

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
@@ -139,6 +139,7 @@ type Obstacle = {
139
139
  width: number;
140
140
  height: number;
141
141
  connectedTo: string[];
142
+ netIsAssignable?: boolean;
142
143
  };
143
144
  interface SimpleRouteConnection {
144
145
  name: string;
@@ -1304,6 +1305,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
1304
1305
  maxY: number;
1305
1306
  };
1306
1307
  _getAutorouterConfig(): AutorouterConfig;
1308
+ _isLaserPrefabAutorouter(autorouterConfig?: AutorouterConfig): boolean;
1307
1309
  _getSubcircuitLayerCount(): number;
1308
1310
  /**
1309
1311
  * Trace-by-trace autorouting is where each trace routes itself in a well-known
@@ -24505,6 +24507,7 @@ declare class Via extends PrimitiveComponent<typeof viaProps> {
24505
24507
  holeDiameter: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
24506
24508
  outerDiameter: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
24507
24509
  connectsTo: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
24510
+ netIsAssignable: z.ZodOptional<z.ZodBoolean>;
24508
24511
  }, "strip", z.ZodTypeAny, {
24509
24512
  holeDiameter: number;
24510
24513
  outerDiameter: number;
@@ -24548,6 +24551,7 @@ declare class Via extends PrimitiveComponent<typeof viaProps> {
24548
24551
  schRelative?: boolean | undefined;
24549
24552
  name?: string | undefined;
24550
24553
  connectsTo?: string | string[] | undefined;
24554
+ netIsAssignable?: boolean | undefined;
24551
24555
  }, {
24552
24556
  holeDiameter: string | number;
24553
24557
  outerDiameter: string | number;
@@ -24597,6 +24601,7 @@ declare class Via extends PrimitiveComponent<typeof viaProps> {
24597
24601
  schRelative?: boolean | undefined;
24598
24602
  name?: string | undefined;
24599
24603
  connectsTo?: string | string[] | undefined;
24604
+ netIsAssignable?: boolean | undefined;
24600
24605
  }>;
24601
24606
  };
24602
24607
  getAvailablePcbLayers(): string[];
package/dist/index.js CHANGED
@@ -5447,6 +5447,9 @@ var getObstaclesFromCircuitJson = (soup, connMap) => {
5447
5447
  );
5448
5448
  obstacles.push(...traceObstacles);
5449
5449
  } else if (element.type === "pcb_via") {
5450
+ const netIsAssignable = Boolean(
5451
+ element.net_is_assignable ?? element.netIsAssignable
5452
+ );
5450
5453
  obstacles.push({
5451
5454
  type: "rect",
5452
5455
  layers: element.layers,
@@ -5457,7 +5460,8 @@ var getObstaclesFromCircuitJson = (soup, connMap) => {
5457
5460
  connectedTo: [],
5458
5461
  // TODO we can associate source_ports with this via
5459
5462
  width: element.outer_diameter,
5460
- height: element.outer_diameter
5463
+ height: element.outer_diameter,
5464
+ netIsAssignable: netIsAssignable || void 0
5461
5465
  });
5462
5466
  }
5463
5467
  }
@@ -8843,7 +8847,7 @@ import {
8843
8847
  } from "@tscircuit/props";
8844
8848
 
8845
8849
  // lib/utils/autorouting/CapacityMeshAutorouter.ts
8846
- import { AutoroutingPipelineSolver } from "@tscircuit/capacity-autorouter";
8850
+ import * as CapacityAutorouter from "@tscircuit/capacity-autorouter";
8847
8851
  var CapacityMeshAutorouter = class {
8848
8852
  input;
8849
8853
  isRouting = false;
@@ -8858,8 +8862,18 @@ var CapacityMeshAutorouter = class {
8858
8862
  timeoutId;
8859
8863
  constructor(input, options = {}) {
8860
8864
  this.input = input;
8861
- const { capacityDepth, targetMinCapacity, stepDelay = 0 } = options;
8862
- this.solver = new AutoroutingPipelineSolver(input, {
8865
+ const {
8866
+ capacityDepth,
8867
+ targetMinCapacity,
8868
+ stepDelay = 0,
8869
+ useAssignableViaSolver = false
8870
+ } = options;
8871
+ const {
8872
+ AutoroutingPipelineSolver,
8873
+ AssignableViaAutoroutingPipelineSolver
8874
+ } = CapacityAutorouter;
8875
+ const SolverClass = useAssignableViaSolver ? AssignableViaAutoroutingPipelineSolver : AutoroutingPipelineSolver;
8876
+ this.solver = new SolverClass(input, {
8863
8877
  capacityDepth,
8864
8878
  targetMinCapacity,
8865
8879
  cacheProvider: null
@@ -11072,6 +11086,20 @@ function getPresetAutoroutingConfig(autorouterConfig) {
11072
11086
  ...rest
11073
11087
  };
11074
11088
  }
11089
+ case "laser-prefab": {
11090
+ const {
11091
+ preset: _preset,
11092
+ local: _local,
11093
+ groupMode: _groupMode,
11094
+ ...rest
11095
+ } = providedConfig;
11096
+ return {
11097
+ local: true,
11098
+ groupMode: "subcircuit",
11099
+ preset: "laser_prefab",
11100
+ ...rest
11101
+ };
11102
+ }
11075
11103
  default:
11076
11104
  return {
11077
11105
  local: true,
@@ -13188,6 +13216,7 @@ var Group6 = class extends NormalComponent3 {
13188
13216
  const debug11 = Debug13("tscircuit:core:_runLocalAutorouting");
13189
13217
  debug11(`[${this.getString()}] starting local autorouting`);
13190
13218
  const autorouterConfig = this._getAutorouterConfig();
13219
+ const isLaserPrefabPreset = this._isLaserPrefabAutorouter(autorouterConfig);
13191
13220
  const { simpleRouteJson } = getSimpleRouteJsonFromCircuitJson({
13192
13221
  db,
13193
13222
  minTraceWidth: this.props.autorouter?.minTraceWidth ?? 0.15,
@@ -13219,7 +13248,8 @@ var Group6 = class extends NormalComponent3 {
13219
13248
  autorouter = new CapacityMeshAutorouter(simpleRouteJson, {
13220
13249
  // Optional configuration parameters
13221
13250
  capacityDepth: this.props.autorouter?.capacityDepth,
13222
- targetMinCapacity: this.props.autorouter?.targetMinCapacity
13251
+ targetMinCapacity: this.props.autorouter?.targetMinCapacity,
13252
+ useAssignableViaSolver: isLaserPrefabPreset
13223
13253
  });
13224
13254
  }
13225
13255
  const routingPromise = new Promise(
@@ -13578,6 +13608,18 @@ var Group6 = class extends NormalComponent3 {
13578
13608
  const autorouter = this._parsedProps.autorouter || this.getInheritedProperty("autorouter");
13579
13609
  return getPresetAutoroutingConfig(autorouter);
13580
13610
  }
13611
+ _isLaserPrefabAutorouter(autorouterConfig = this._getAutorouterConfig()) {
13612
+ const autorouterProp = this.props.autorouter;
13613
+ const normalize = (value) => value?.replace(/-/g, "_") ?? value;
13614
+ if (autorouterConfig.preset === "laser_prefab") return true;
13615
+ if (typeof autorouterProp === "string") {
13616
+ return normalize(autorouterProp) === "laser_prefab";
13617
+ }
13618
+ if (typeof autorouterProp === "object" && autorouterProp) {
13619
+ return normalize(autorouterProp.preset) === "laser_prefab";
13620
+ }
13621
+ return false;
13622
+ }
13581
13623
  _getSubcircuitLayerCount() {
13582
13624
  const layers = this.getInheritedProperty("layers");
13583
13625
  return typeof layers === "number" ? layers : 2;
@@ -16253,7 +16295,8 @@ var Via = class extends PrimitiveComponent2 {
16253
16295
  from_layer: props.fromLayer || "bottom",
16254
16296
  to_layer: props.toLayer || "top",
16255
16297
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
16256
- pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
16298
+ pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
16299
+ net_is_assignable: props.netIsAssignable ?? void 0
16257
16300
  });
16258
16301
  this.pcb_via_id = pcb_via.pcb_via_id;
16259
16302
  }
@@ -17706,7 +17749,7 @@ import { identity as identity6 } from "transformation-matrix";
17706
17749
  var package_default = {
17707
17750
  name: "@tscircuit/core",
17708
17751
  type: "module",
17709
- version: "0.0.839",
17752
+ version: "0.0.840",
17710
17753
  types: "dist/index.d.ts",
17711
17754
  main: "dist/index.js",
17712
17755
  module: "dist/index.js",
@@ -17737,7 +17780,7 @@ var package_default = {
17737
17780
  devDependencies: {
17738
17781
  "@biomejs/biome": "^1.8.3",
17739
17782
  "@resvg/resvg-js": "^2.6.2",
17740
- "@tscircuit/capacity-autorouter": "^0.0.132",
17783
+ "@tscircuit/capacity-autorouter": "^0.0.140",
17741
17784
  "@tscircuit/checks": "^0.0.85",
17742
17785
  "@tscircuit/circuit-json-util": "^0.0.72",
17743
17786
  "@tscircuit/common": "^0.0.14",
@@ -17749,7 +17792,7 @@ var package_default = {
17749
17792
  "@tscircuit/math-utils": "^0.0.29",
17750
17793
  "@tscircuit/miniflex": "^0.0.4",
17751
17794
  "@tscircuit/ngspice-spice-engine": "^0.0.2",
17752
- "@tscircuit/props": "^0.0.387",
17795
+ "@tscircuit/props": "^0.0.390",
17753
17796
  "@tscircuit/schematic-autolayout": "^0.0.6",
17754
17797
  "@tscircuit/schematic-match-adapt": "^0.0.16",
17755
17798
  "@tscircuit/schematic-trace-solver": "^0.0.43",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.840",
4
+ "version": "0.0.841",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -32,7 +32,7 @@
32
32
  "devDependencies": {
33
33
  "@biomejs/biome": "^1.8.3",
34
34
  "@resvg/resvg-js": "^2.6.2",
35
- "@tscircuit/capacity-autorouter": "^0.0.132",
35
+ "@tscircuit/capacity-autorouter": "^0.0.140",
36
36
  "@tscircuit/checks": "^0.0.85",
37
37
  "@tscircuit/circuit-json-util": "^0.0.72",
38
38
  "@tscircuit/common": "^0.0.14",
@@ -44,7 +44,7 @@
44
44
  "@tscircuit/math-utils": "^0.0.29",
45
45
  "@tscircuit/miniflex": "^0.0.4",
46
46
  "@tscircuit/ngspice-spice-engine": "^0.0.2",
47
- "@tscircuit/props": "^0.0.387",
47
+ "@tscircuit/props": "^0.0.390",
48
48
  "@tscircuit/schematic-autolayout": "^0.0.6",
49
49
  "@tscircuit/schematic-match-adapt": "^0.0.16",
50
50
  "@tscircuit/schematic-trace-solver": "^0.0.43",