@tscircuit/core 0.0.63 → 0.0.65

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
@@ -3773,7 +3773,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
3773
3773
  }>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
3774
3774
  name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
3775
3775
  }>>;
3776
- }, "pcbRotation" | "layer">, {
3776
+ }, "layer" | "pcbRotation">, {
3777
3777
  name: zod.ZodOptional<zod.ZodString>;
3778
3778
  shape: zod.ZodLiteral<"circle">;
3779
3779
  holeDiameter: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
@@ -3808,7 +3808,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
3808
3808
  }>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
3809
3809
  name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
3810
3810
  }>>;
3811
- }, "pcbRotation" | "layer">, {
3811
+ }, "layer" | "pcbRotation">, {
3812
3812
  name: zod.ZodOptional<zod.ZodString>;
3813
3813
  shape: zod.ZodLiteral<"oval">;
3814
3814
  outerWidth: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
package/dist/index.js CHANGED
@@ -2532,14 +2532,15 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
2532
2532
  const bLayer = "layers" in b && b.layers.length === 1 ? b.layers[0] : dominantLayer ?? "top";
2533
2533
  const pcbPortA = "pcb_port_id" in a ? a.pcb_port_id : null;
2534
2534
  const pcbPortB = "pcb_port_id" in b ? b.pcb_port_id : null;
2535
+ const minTraceWidth = this.getSubcircuit()._parsedProps.minTraceWidth ?? 0.16;
2535
2536
  const ijump = new MultilayerIjump({
2536
- OBSTACLE_MARGIN: 0.3,
2537
+ OBSTACLE_MARGIN: minTraceWidth * 2,
2537
2538
  // isRemovePathLoopsEnabled: true,
2538
- optimizeWithGoalBoxes: false,
2539
- // Boolean(pcbPortA && pcbPortB),
2539
+ optimizeWithGoalBoxes: Boolean(pcbPortA && pcbPortB),
2540
2540
  connMap,
2541
2541
  input: {
2542
2542
  obstacles,
2543
+ minTraceWidth,
2543
2544
  connections: [
2544
2545
  {
2545
2546
  name: this.source_trace_id,
@@ -2590,7 +2591,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
2590
2591
  const [trace] = traces;
2591
2592
  if (dominantLayer) {
2592
2593
  trace.route = trace.route.map((p) => {
2593
- if (p.route_type === "wire") {
2594
+ if (p.route_type === "wire" && !p.layer) {
2594
2595
  p.layer = dominantLayer;
2595
2596
  }
2596
2597
  return p;
@@ -2654,6 +2655,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
2654
2655
  }
2655
2656
  const bounds = computeObstacleBounds(obstacles);
2656
2657
  const simpleRouteJsonInput = {
2658
+ minTraceWidth: 0.1,
2657
2659
  obstacles,
2658
2660
  connections: [connection],
2659
2661
  bounds,
@@ -3445,10 +3447,9 @@ var FabricationNotePath = class extends PrimitiveComponent {
3445
3447
  y: transformedPosition.y
3446
3448
  };
3447
3449
  }),
3448
- stroke_width: props.strokeWidth ?? 0.1,
3449
- fabrication_note_path_id: `fabrication_note_${Math.random().toString()}`
3450
+ stroke_width: props.strokeWidth ?? 0.1
3450
3451
  });
3451
- this.fabrication_note_path_id = fabrication_note_path.fabrication_note_path_id;
3452
+ this.fabrication_note_path_id = fabrication_note_path.pcb_fabrication_note_path_id;
3452
3453
  }
3453
3454
  };
3454
3455
 
@@ -3524,7 +3525,7 @@ var Circuit = class {
3524
3525
  "${e.message}"`
3525
3526
  );
3526
3527
  });
3527
- return circuitToSvg.circuitJsonToPcbSvg(this.getSoup());
3528
+ return circuitToSvg.circuitJsonToPcbSvg(this.getCircuitJson());
3528
3529
  }
3529
3530
  async preview(previewNameOrOpts) {
3530
3531
  const previewOpts = typeof previewNameOrOpts === "object" ? previewNameOrOpts : { previewName: previewNameOrOpts };
package/lib/Project.ts CHANGED
@@ -86,7 +86,7 @@ export class Circuit {
86
86
  )
87
87
  })
88
88
 
89
- return circuitToSvg.circuitJsonToPcbSvg(this.getSoup())
89
+ return circuitToSvg.circuitJsonToPcbSvg(this.getCircuitJson())
90
90
  }
91
91
 
92
92
  async preview(
@@ -42,10 +42,9 @@ export class FabricationNotePath extends PrimitiveComponent<
42
42
  }
43
43
  }),
44
44
  stroke_width: props.strokeWidth ?? 0.1,
45
- fabrication_note_path_id: `fabrication_note_${Math.random().toString()}`,
46
45
  })
47
46
 
48
47
  this.fabrication_note_path_id =
49
- fabrication_note_path.fabrication_note_path_id
48
+ fabrication_note_path.pcb_fabrication_note_path_id
50
49
  }
51
50
  }
@@ -450,13 +450,17 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
450
450
  const pcbPortA = "pcb_port_id" in a ? a.pcb_port_id : null
451
451
  const pcbPortB = "pcb_port_id" in b ? b.pcb_port_id : null
452
452
 
453
+ const minTraceWidth =
454
+ this.getSubcircuit()._parsedProps.minTraceWidth ?? 0.16
455
+
453
456
  const ijump = new MultilayerIjump({
454
- OBSTACLE_MARGIN: 0.3,
457
+ OBSTACLE_MARGIN: minTraceWidth * 2,
455
458
  // isRemovePathLoopsEnabled: true,
456
- optimizeWithGoalBoxes: false, // Boolean(pcbPortA && pcbPortB),
459
+ optimizeWithGoalBoxes: Boolean(pcbPortA && pcbPortB),
457
460
  connMap,
458
461
  input: {
459
462
  obstacles,
463
+ minTraceWidth,
460
464
  connections: [
461
465
  {
462
466
  name: this.source_trace_id!,
@@ -504,15 +508,13 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
504
508
  })
505
509
  return
506
510
  }
507
- // TODO ijump returns multiple traces for some reason
508
511
  const [trace] = traces as PCBTrace[]
509
- // TODO ijump always returns on top layer and has no multilayer support
510
- // https://github.com/tscircuit/autorouting-dataset/issues/35
511
- // For now, we'll move the trace to whatever layer the first point
512
- // specifies we should have "via'd" to
512
+
513
+ // If the autorouter didn't specify a layer, use the dominant layer
514
+ // Some of the single-layer autorouters don't add the layer property
513
515
  if (dominantLayer) {
514
516
  trace.route = trace.route.map((p) => {
515
- if (p.route_type === "wire") {
517
+ if (p.route_type === "wire" && !p.layer) {
516
518
  p.layer = dominantLayer
517
519
  }
518
520
  return p
@@ -589,6 +591,7 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
589
591
  const bounds = computeObstacleBounds(obstacles)
590
592
 
591
593
  const simpleRouteJsonInput: SimpleRouteJson = {
594
+ minTraceWidth: 0.1,
592
595
  obstacles,
593
596
  connections: [connection],
594
597
  bounds,
@@ -35,6 +35,7 @@ export interface SimpleRouteConnection {
35
35
 
36
36
  export interface SimpleRouteJson {
37
37
  layerCount: number
38
+ minTraceWidth: number
38
39
  obstacles: Obstacle[]
39
40
  connections: Array<SimpleRouteConnection>
40
41
  bounds: { minX: number; maxX: number; minY: number; maxY: number }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tscircuit/core",
3
3
  "module": "index.ts",
4
4
  "type": "module",
5
- "version": "0.0.63",
5
+ "version": "0.0.65",
6
6
  "types": "dist/index.d.ts",
7
7
  "main": "dist/index.js",
8
8
  "files": [
@@ -23,7 +23,7 @@
23
23
  "@types/react": "^18.3.3",
24
24
  "@types/react-reconciler": "^0.28.8",
25
25
  "bun-match-svg": "0.0.2",
26
- "circuit-to-svg": "^0.0.28",
26
+ "circuit-to-svg": "^0.0.32",
27
27
  "debug": "^4.3.6",
28
28
  "howfat": "^0.3.8",
29
29
  "looks-same": "^9.0.1",
@@ -35,11 +35,11 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@lume/kiwi": "^0.4.3",
38
- "@tscircuit/infgrid-ijump-astar": "^0.0.18",
38
+ "@tscircuit/infgrid-ijump-astar": "^0.0.20",
39
39
  "@tscircuit/math-utils": "^0.0.4",
40
40
  "@tscircuit/props": "^0.0.63",
41
- "@tscircuit/soup": "^0.0.69",
42
- "@tscircuit/soup-util": "^0.0.26",
41
+ "@tscircuit/soup": "^0.0.71",
42
+ "@tscircuit/soup-util": "^0.0.27",
43
43
  "circuit-json-to-connectivity-map": "^0.0.15",
44
44
  "footprinter": "^0.0.44",
45
45
  "nanoid": "^5.0.7",