@tscircuit/core 0.0.56 → 0.0.58

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
@@ -789,6 +789,7 @@ declare class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
789
789
  height: number;
790
790
  };
791
791
  doInitialPortMatching(): void;
792
+ getAvailablePcbLayers(): string[];
792
793
  doInitialPcbPrimitiveRender(): void;
793
794
  doInitialPcbPortAttachment(): void;
794
795
  _getPcbCircuitJsonBounds(): {
@@ -3837,6 +3838,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
3837
3838
  portHints?: (string | number)[] | undefined;
3838
3839
  }>]>;
3839
3840
  };
3841
+ getAvailablePcbLayers(): string[];
3840
3842
  getPcbSize(): {
3841
3843
  width: number;
3842
3844
  height: number;
package/dist/index.js CHANGED
@@ -879,7 +879,7 @@ var Port = class extends PrimitiveComponent {
879
879
  if ("_getPcbCircuitJsonBounds" in pcbMatch) {
880
880
  const pcb_port = db.pcb_port.insert({
881
881
  pcb_component_id: this.parent?.pcb_component_id,
882
- layers: ["top"],
882
+ layers: this.getAvailablePcbLayers(),
883
883
  ...pcbMatch._getPcbCircuitJsonBounds().center,
884
884
  source_port_id: this.source_port_id
885
885
  });
@@ -1129,6 +1129,9 @@ var SmtPad = class extends PrimitiveComponent {
1129
1129
  }
1130
1130
  }
1131
1131
  }
1132
+ getAvailablePcbLayers() {
1133
+ return this.props.layer ? [this.props.layer] : [];
1134
+ }
1132
1135
  doInitialPcbPrimitiveRender() {
1133
1136
  const { db } = this.root;
1134
1137
  const { _parsedProps: props } = this;
@@ -1269,6 +1272,9 @@ var PlatedHole = class extends PrimitiveComponent {
1269
1272
  zodProps: platedHoleProps
1270
1273
  };
1271
1274
  }
1275
+ getAvailablePcbLayers() {
1276
+ return ["top", "inner1", "inner2", "bottom"];
1277
+ }
1272
1278
  getPcbSize() {
1273
1279
  const { _parsedProps: props } = this;
1274
1280
  if (props.shape === "circle") {
@@ -2075,6 +2081,7 @@ import "zod";
2075
2081
  // lib/components/primitive-components/Trace.ts
2076
2082
  import { traceProps } from "@tscircuit/props";
2077
2083
  import {
2084
+ MultilayerIjump,
2078
2085
  IJumpAutorouter,
2079
2086
  getObstaclesFromSoup
2080
2087
  } from "@tscircuit/infgrid-ijump-astar";
@@ -2505,8 +2512,10 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
2505
2512
  for (const [a, b] of pairs(orderedRoutePoints)) {
2506
2513
  const dominantLayer = "via_to_layer" in a ? a.via_to_layer : null;
2507
2514
  const BOUNDS_MARGIN = 2;
2508
- const ijump = new IJumpAutorouter({
2515
+ const ijump = new MultilayerIjump({
2509
2516
  OBSTACLE_MARGIN: 0.3,
2517
+ isRemovePathLoopsEnabled: true,
2518
+ layerCount: 2,
2510
2519
  input: {
2511
2520
  obstacles,
2512
2521
  connections: [
@@ -14,6 +14,11 @@ export class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
14
14
  }
15
15
  }
16
16
 
17
+ getAvailablePcbLayers(): string[] {
18
+ // TODO use project layerCount
19
+ return ["top", "inner1", "inner2", "bottom"]
20
+ }
21
+
17
22
  getPcbSize(): { width: number; height: number } {
18
23
  const { _parsedProps: props } = this
19
24
  if (props.shape === "circle") {
@@ -189,7 +189,7 @@ export class Port extends PrimitiveComponent<typeof portProps> {
189
189
  if ("_getPcbCircuitJsonBounds" in pcbMatch) {
190
190
  const pcb_port = db.pcb_port.insert({
191
191
  pcb_component_id: this.parent?.pcb_component_id!,
192
- layers: ["top"],
192
+ layers: this.getAvailablePcbLayers(),
193
193
 
194
194
  ...pcbMatch._getPcbCircuitJsonBounds().center,
195
195
 
@@ -2,7 +2,7 @@ import { PrimitiveComponent } from "../base-components/PrimitiveComponent"
2
2
  import { smtPadProps } from "@tscircuit/props"
3
3
  import type { Port } from "./Port"
4
4
  import type { RenderPhaseFn } from "../base-components/Renderable"
5
- import type { PCBSMTPad } from "@tscircuit/soup"
5
+ import type { LayerRef, PCBSMTPad } from "@tscircuit/soup"
6
6
  import { decomposeTSR } from "transformation-matrix"
7
7
 
8
8
  export class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
@@ -49,6 +49,10 @@ export class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
49
49
  }
50
50
  }
51
51
 
52
+ getAvailablePcbLayers(): string[] {
53
+ return this.props.layer ? [this.props.layer as LayerRef] : []
54
+ }
55
+
52
56
  doInitialPcbPrimitiveRender(): void {
53
57
  const { db } = this.root!
54
58
  const { _parsedProps: props } = this
@@ -2,6 +2,7 @@ import { traceProps } from "@tscircuit/props"
2
2
  import { PrimitiveComponent } from "../base-components/PrimitiveComponent"
3
3
  import type { Port } from "./Port"
4
4
  import {
5
+ MultilayerIjump,
5
6
  IJumpAutorouter,
6
7
  autoroute,
7
8
  getObstaclesFromSoup,
@@ -418,8 +419,10 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
418
419
  "via_to_layer" in a ? (a.via_to_layer as LayerRef) : null
419
420
  const BOUNDS_MARGIN = 2 //mm
420
421
 
421
- const ijump = new IJumpAutorouter({
422
+ const ijump = new MultilayerIjump({
422
423
  OBSTACLE_MARGIN: 0.3,
424
+ isRemovePathLoopsEnabled: true,
425
+ layerCount: 2,
423
426
  input: {
424
427
  obstacles,
425
428
  connections: [
@@ -1,13 +1,22 @@
1
1
  export type SimplifiedPcbTrace = {
2
2
  type: "pcb_trace"
3
3
  pcb_trace_id: string
4
- route: Array<{
5
- route_type: "wire" | "via"
6
- x: number
7
- y: number
8
- width: number
9
- layer: string
10
- }>
4
+ route: Array<
5
+ | {
6
+ route_type: "wire"
7
+ x: number
8
+ y: number
9
+ width: number
10
+ layer: string
11
+ }
12
+ | {
13
+ route_type: "via"
14
+ x: number
15
+ y: number
16
+ to_layer: string
17
+ from_layer: string
18
+ }
19
+ >
11
20
  }
12
21
  export type Obstacle = {
13
22
  // TODO include ovals
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.56",
5
+ "version": "0.0.58",
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.22",
26
+ "circuit-to-svg": "^0.0.28",
27
27
  "debug": "^4.3.6",
28
28
  "howfat": "^0.3.8",
29
29
  "looks-same": "^9.0.1",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@lume/kiwi": "^0.4.3",
37
- "@tscircuit/infgrid-ijump-astar": "^0.0.13",
37
+ "@tscircuit/infgrid-ijump-astar": "^0.0.15",
38
38
  "@tscircuit/props": "^0.0.62",
39
39
  "@tscircuit/soup": "^0.0.67",
40
40
  "@tscircuit/soup-util": "^0.0.23",