@tscircuit/core 0.0.87 → 0.0.89

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
@@ -1,7 +1,6 @@
1
1
  import * as zod from 'zod';
2
2
  import { ZodType, z } from 'zod';
3
- import { AnySoupElement, PCBTraceError, PCBPlacementError, AnySourceComponent, RouteHintPoint } from '@tscircuit/soup';
4
- import { LayerRef } from 'circuit-json';
3
+ import { LayerRef, AnyCircuitElement, PCBTraceError, PCBPlacementError, AnySourceComponent, RouteHintPoint } from 'circuit-json';
5
4
  import { SoupUtilObjects } from '@tscircuit/soup-util';
6
5
  import { ReactElement } from 'react';
7
6
  import { Matrix } from 'transformation-matrix';
@@ -27,8 +26,8 @@ declare class Circuit {
27
26
  };
28
27
  _guessRootComponent(): void;
29
28
  render(): void;
30
- getSoup(): AnySoupElement[];
31
- getCircuitJson(): AnySoupElement[];
29
+ getSoup(): AnyCircuitElement[];
30
+ getCircuitJson(): AnyCircuitElement[];
32
31
  getSvg(options: {
33
32
  view: "pcb";
34
33
  layer?: string;
package/dist/index.js CHANGED
@@ -542,7 +542,7 @@ var PrimitiveComponent = class extends Renderable {
542
542
  if (typeof message === "string") {
543
543
  return super.renderError(message);
544
544
  }
545
- this.root?.db.pcb_error.insert(message);
545
+ this.root?.db.pcb_placement_error.insert(message);
546
546
  }
547
547
  getString() {
548
548
  const { lowercaseComponentName: cname, _parsedProps: props, parent } = this;
@@ -1401,7 +1401,7 @@ var PlatedHole = class extends PrimitiveComponent {
1401
1401
  const pcb_plated_hole = db.pcb_plated_hole.insert({
1402
1402
  pcb_component_id,
1403
1403
  pcb_port_id: this.matchedPort?.pcb_port_id,
1404
- // @ts-ignore - some issue with @tscircuit/soup union type
1404
+ // @ts-ignore - some issue with circuit-json union type
1405
1405
  outer_diameter: props.outerDiameter,
1406
1406
  hole_diameter: props.holeDiameter,
1407
1407
  shape: "circle",
@@ -1674,6 +1674,7 @@ var Net = class extends PrimitiveComponent {
1674
1674
  ]
1675
1675
  }
1676
1676
  ])
1677
+ // Remove as any when autorouting-dataset has been updated
1677
1678
  );
1678
1679
  const trace = solution[0];
1679
1680
  if (!trace) {
@@ -2196,6 +2197,8 @@ var Board = class extends Group {
2196
2197
  }
2197
2198
  const pcb_board = db.pcb_board.insert({
2198
2199
  center: { x: props.pcbX, y: props.pcbY },
2200
+ thickness: this.boardThickness,
2201
+ num_layers: this.allLayers.length,
2199
2202
  width: props.width,
2200
2203
  height: props.height,
2201
2204
  outline: props.outline
@@ -2630,11 +2633,13 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
2630
2633
  );
2631
2634
  const [obstacles, errGettingObstacles] = tryNow(
2632
2635
  () => getObstaclesFromSoup(this.root.db.toArray())
2636
+ // Remove as any when autorouting-dataset gets updated
2633
2637
  );
2634
2638
  if (errGettingObstacles) {
2635
2639
  this.renderError({
2636
- type: "pcb_error",
2640
+ type: "pcb_trace_error",
2637
2641
  error_type: "pcb_trace_error",
2642
+ pcb_trace_error_id: this.pcb_trace_id,
2638
2643
  message: `Error getting obstacles for autorouting: ${errGettingObstacles.message}`,
2639
2644
  source_trace_id: this.source_trace_id,
2640
2645
  center: { x: 0, y: 0 },
@@ -2711,10 +2716,11 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
2711
2716
  traces = ijump.solveAndMapToTraces();
2712
2717
  } catch (e) {
2713
2718
  this.renderError({
2714
- type: "pcb_error",
2719
+ type: "pcb_trace_error",
2720
+ pcb_trace_error_id: this.source_trace_id,
2715
2721
  error_type: "pcb_trace_error",
2716
2722
  message: `error solving route: ${e.message}`,
2717
- source_trace_id: this.source_trace_id,
2723
+ source_trace_id: this.pcb_trace_id,
2718
2724
  center: { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 },
2719
2725
  pcb_port_ids: ports.map((p) => p.pcb_port_id),
2720
2726
  pcb_trace_id: this.pcb_trace_id,
@@ -2724,8 +2730,9 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
2724
2730
  if (!traces) return;
2725
2731
  if (traces.length === 0) {
2726
2732
  this.renderError({
2727
- type: "pcb_error",
2733
+ type: "pcb_trace_error",
2728
2734
  error_type: "pcb_trace_error",
2735
+ pcb_trace_error_id: this.pcb_trace_id,
2729
2736
  message: `Could not find a route for ${this}`,
2730
2737
  source_trace_id: this.source_trace_id,
2731
2738
  center: { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 },
@@ -2754,9 +2761,16 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
2754
2761
  routes.push(trace.route);
2755
2762
  }
2756
2763
  const mergedRoute = mergeRoutes(routes);
2764
+ const pcb_trace = db.pcb_trace.insert({
2765
+ route: mergedRoute,
2766
+ source_trace_id: this.source_trace_id
2767
+ });
2768
+ this._portsRoutedOnPcb = ports;
2769
+ this.pcb_trace_id = pcb_trace.pcb_trace_id;
2757
2770
  for (const point of mergedRoute) {
2758
2771
  if (point.route_type === "via") {
2759
2772
  db.pcb_via.insert({
2773
+ pcb_trace_id: pcb_trace.pcb_trace_id,
2760
2774
  x: point.x,
2761
2775
  y: point.y,
2762
2776
  hole_diameter: 0.3,
@@ -2767,12 +2781,6 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
2767
2781
  });
2768
2782
  }
2769
2783
  }
2770
- const pcb_trace = db.pcb_trace.insert({
2771
- route: mergedRoute,
2772
- source_trace_id: this.source_trace_id
2773
- });
2774
- this._portsRoutedOnPcb = ports;
2775
- this.pcb_trace_id = pcb_trace.pcb_trace_id;
2776
2784
  }
2777
2785
  doInitialSchematicTraceRender() {
2778
2786
  const { db } = this.root;
@@ -2986,7 +2994,7 @@ var Capacitor = class extends NormalComponent {
2986
2994
  import { chipProps } from "@tscircuit/props";
2987
2995
 
2988
2996
  // lib/utils/schematic/getAllDimensionsForSchematicBox.ts
2989
- import "@tscircuit/soup";
2997
+ import "circuit-json";
2990
2998
 
2991
2999
  // lib/utils/schematic/getSizeOfSidesFromPortArrangement.ts
2992
3000
  var hasExplicitPinMapping = (pa) => {
@@ -3254,7 +3262,7 @@ var underscorifyPortArrangement = (portArrangement) => {
3254
3262
  };
3255
3263
 
3256
3264
  // lib/soup/underscorifyPinStyles.ts
3257
- import "@tscircuit/soup";
3265
+ import "circuit-json";
3258
3266
  import "zod";
3259
3267
  var underscorifyPinStyles = (pinStyles) => {
3260
3268
  if (!pinStyles) return void 0;
@@ -3719,7 +3727,7 @@ var Circuit = class {
3719
3727
  "${e.message}"`
3720
3728
  );
3721
3729
  });
3722
- return circuitToSvg.circuitJsonToPcbSvg(this.getCircuitJson());
3730
+ return circuitToSvg.convertCircuitJsonToPcbSvg(this.getCircuitJson());
3723
3731
  }
3724
3732
  async preview(previewNameOrOpts) {
3725
3733
  const previewOpts = typeof previewNameOrOpts === "object" ? previewNameOrOpts : { previewName: previewNameOrOpts };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.87",
4
+ "version": "0.0.89",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "@types/react": "^18.3.3",
22
22
  "@types/react-reconciler": "^0.28.8",
23
23
  "bun-match-svg": "0.0.2",
24
- "circuit-to-svg": "^0.0.36",
24
+ "circuit-to-svg": "^0.0.37",
25
25
  "debug": "^4.3.6",
26
26
  "howfat": "^0.3.8",
27
27
  "looks-same": "^9.0.1",
@@ -35,10 +35,9 @@
35
35
  "@tscircuit/infgrid-ijump-astar": "^0.0.21",
36
36
  "@tscircuit/math-utils": "^0.0.4",
37
37
  "@tscircuit/props": "^0.0.65",
38
- "@tscircuit/soup": "^0.0.73",
39
- "@tscircuit/soup-util": "^0.0.28",
40
- "circuit-json": "^0.0.77",
41
- "circuit-json-to-connectivity-map": "^0.0.15",
38
+ "@tscircuit/soup-util": "^0.0.31",
39
+ "circuit-json": "^0.0.82",
40
+ "circuit-json-to-connectivity-map": "^0.0.17",
42
41
  "footprinter": "^0.0.44",
43
42
  "nanoid": "^5.0.7",
44
43
  "performance-now": "^2.1.0",