@tscircuit/core 0.0.87 → 0.0.88

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) {
@@ -2630,11 +2631,13 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
2630
2631
  );
2631
2632
  const [obstacles, errGettingObstacles] = tryNow(
2632
2633
  () => getObstaclesFromSoup(this.root.db.toArray())
2634
+ // Remove as any when autorouting-dataset gets updated
2633
2635
  );
2634
2636
  if (errGettingObstacles) {
2635
2637
  this.renderError({
2636
- type: "pcb_error",
2638
+ type: "pcb_trace_error",
2637
2639
  error_type: "pcb_trace_error",
2640
+ pcb_trace_error_id: this.pcb_trace_id,
2638
2641
  message: `Error getting obstacles for autorouting: ${errGettingObstacles.message}`,
2639
2642
  source_trace_id: this.source_trace_id,
2640
2643
  center: { x: 0, y: 0 },
@@ -2711,10 +2714,11 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
2711
2714
  traces = ijump.solveAndMapToTraces();
2712
2715
  } catch (e) {
2713
2716
  this.renderError({
2714
- type: "pcb_error",
2717
+ type: "pcb_trace_error",
2718
+ pcb_trace_error_id: this.source_trace_id,
2715
2719
  error_type: "pcb_trace_error",
2716
2720
  message: `error solving route: ${e.message}`,
2717
- source_trace_id: this.source_trace_id,
2721
+ source_trace_id: this.pcb_trace_id,
2718
2722
  center: { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 },
2719
2723
  pcb_port_ids: ports.map((p) => p.pcb_port_id),
2720
2724
  pcb_trace_id: this.pcb_trace_id,
@@ -2724,8 +2728,9 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
2724
2728
  if (!traces) return;
2725
2729
  if (traces.length === 0) {
2726
2730
  this.renderError({
2727
- type: "pcb_error",
2731
+ type: "pcb_trace_error",
2728
2732
  error_type: "pcb_trace_error",
2733
+ pcb_trace_error_id: this.pcb_trace_id,
2729
2734
  message: `Could not find a route for ${this}`,
2730
2735
  source_trace_id: this.source_trace_id,
2731
2736
  center: { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 },
@@ -2754,9 +2759,16 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
2754
2759
  routes.push(trace.route);
2755
2760
  }
2756
2761
  const mergedRoute = mergeRoutes(routes);
2762
+ const pcb_trace = db.pcb_trace.insert({
2763
+ route: mergedRoute,
2764
+ source_trace_id: this.source_trace_id
2765
+ });
2766
+ this._portsRoutedOnPcb = ports;
2767
+ this.pcb_trace_id = pcb_trace.pcb_trace_id;
2757
2768
  for (const point of mergedRoute) {
2758
2769
  if (point.route_type === "via") {
2759
2770
  db.pcb_via.insert({
2771
+ pcb_trace_id: pcb_trace.pcb_trace_id,
2760
2772
  x: point.x,
2761
2773
  y: point.y,
2762
2774
  hole_diameter: 0.3,
@@ -2767,12 +2779,6 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
2767
2779
  });
2768
2780
  }
2769
2781
  }
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
2782
  }
2777
2783
  doInitialSchematicTraceRender() {
2778
2784
  const { db } = this.root;
@@ -2986,7 +2992,7 @@ var Capacitor = class extends NormalComponent {
2986
2992
  import { chipProps } from "@tscircuit/props";
2987
2993
 
2988
2994
  // lib/utils/schematic/getAllDimensionsForSchematicBox.ts
2989
- import "@tscircuit/soup";
2995
+ import "circuit-json";
2990
2996
 
2991
2997
  // lib/utils/schematic/getSizeOfSidesFromPortArrangement.ts
2992
2998
  var hasExplicitPinMapping = (pa) => {
@@ -3254,7 +3260,7 @@ var underscorifyPortArrangement = (portArrangement) => {
3254
3260
  };
3255
3261
 
3256
3262
  // lib/soup/underscorifyPinStyles.ts
3257
- import "@tscircuit/soup";
3263
+ import "circuit-json";
3258
3264
  import "zod";
3259
3265
  var underscorifyPinStyles = (pinStyles) => {
3260
3266
  if (!pinStyles) return void 0;
@@ -3719,7 +3725,7 @@ var Circuit = class {
3719
3725
  "${e.message}"`
3720
3726
  );
3721
3727
  });
3722
- return circuitToSvg.circuitJsonToPcbSvg(this.getCircuitJson());
3728
+ return circuitToSvg.convertCircuitJsonToPcbSvg(this.getCircuitJson());
3723
3729
  }
3724
3730
  async preview(previewNameOrOpts) {
3725
3731
  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.88",
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
+ "circuit-json": "^0.0.78",
39
+ "@tscircuit/soup-util": "^0.0.31",
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",