@tscircuit/core 0.0.600 → 0.0.602

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
@@ -557,6 +557,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
557
557
  _portsRoutedOnPcb: Port[];
558
558
  subcircuit_connectivity_map_key: string | null;
559
559
  _traceConnectionHash: string | null;
560
+ _couldNotFindPort?: boolean;
560
561
  constructor(props: z.input<typeof traceProps>);
561
562
  get config(): {
562
563
  zodProps: z.ZodUnion<[z.ZodObject<{
@@ -1150,6 +1151,8 @@ declare class Board extends Group<typeof boardProps> {
1150
1151
  pcbGridTemplateColumns: zod.ZodOptional<zod.ZodString>;
1151
1152
  pcbGridTemplate: zod.ZodOptional<zod.ZodString>;
1152
1153
  pcbGridGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
1154
+ pcbGridRowGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
1155
+ pcbGridColumnGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
1153
1156
  pcbFlex: zod.ZodOptional<zod.ZodUnion<[zod.ZodBoolean, zod.ZodString]>>;
1154
1157
  pcbFlexDirection: zod.ZodOptional<zod.ZodEnum<["row", "column"]>>;
1155
1158
  pcbAlignItems: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch"]>>;
@@ -1171,6 +1174,8 @@ declare class Board extends Group<typeof boardProps> {
1171
1174
  gridTemplateColumns: zod.ZodOptional<zod.ZodString>;
1172
1175
  gridTemplate: zod.ZodOptional<zod.ZodString>;
1173
1176
  gridGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
1177
+ gridRowGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
1178
+ gridColumnGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
1174
1179
  flex: zod.ZodOptional<zod.ZodUnion<[zod.ZodBoolean, zod.ZodString]>>;
1175
1180
  flexDirection: zod.ZodOptional<zod.ZodEnum<["row", "column"]>>;
1176
1181
  alignItems: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch"]>>;
@@ -1203,6 +1208,8 @@ declare class Board extends Group<typeof boardProps> {
1203
1208
  gridTemplateColumns?: string | undefined;
1204
1209
  gridTemplate?: string | undefined;
1205
1210
  gridGap?: string | number | undefined;
1211
+ gridRowGap?: string | number | undefined;
1212
+ gridColumnGap?: string | number | undefined;
1206
1213
  flexDirection?: "row" | "column" | undefined;
1207
1214
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1208
1215
  justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
@@ -1234,6 +1241,8 @@ declare class Board extends Group<typeof boardProps> {
1234
1241
  gridTemplateColumns?: string | undefined;
1235
1242
  gridTemplate?: string | undefined;
1236
1243
  gridGap?: string | number | undefined;
1244
+ gridRowGap?: string | number | undefined;
1245
+ gridColumnGap?: string | number | undefined;
1237
1246
  flexDirection?: "row" | "column" | undefined;
1238
1247
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1239
1248
  justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
@@ -1265,6 +1274,8 @@ declare class Board extends Group<typeof boardProps> {
1265
1274
  gridTemplateColumns: zod.ZodOptional<zod.ZodString>;
1266
1275
  gridTemplate: zod.ZodOptional<zod.ZodString>;
1267
1276
  gridGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
1277
+ gridRowGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
1278
+ gridColumnGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
1268
1279
  flex: zod.ZodOptional<zod.ZodUnion<[zod.ZodBoolean, zod.ZodString]>>;
1269
1280
  flexDirection: zod.ZodOptional<zod.ZodEnum<["row", "column"]>>;
1270
1281
  alignItems: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch"]>>;
@@ -1297,6 +1308,8 @@ declare class Board extends Group<typeof boardProps> {
1297
1308
  gridTemplateColumns?: string | undefined;
1298
1309
  gridTemplate?: string | undefined;
1299
1310
  gridGap?: string | number | undefined;
1311
+ gridRowGap?: string | number | undefined;
1312
+ gridColumnGap?: string | number | undefined;
1300
1313
  flexDirection?: "row" | "column" | undefined;
1301
1314
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1302
1315
  justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
@@ -1328,6 +1341,8 @@ declare class Board extends Group<typeof boardProps> {
1328
1341
  gridTemplateColumns?: string | undefined;
1329
1342
  gridTemplate?: string | undefined;
1330
1343
  gridGap?: string | number | undefined;
1344
+ gridRowGap?: string | number | undefined;
1345
+ gridColumnGap?: string | number | undefined;
1331
1346
  flexDirection?: "row" | "column" | undefined;
1332
1347
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1333
1348
  justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
@@ -1388,6 +1403,8 @@ declare class Board extends Group<typeof boardProps> {
1388
1403
  gridTemplateColumns: zod.ZodOptional<zod.ZodString>;
1389
1404
  gridTemplate: zod.ZodOptional<zod.ZodString>;
1390
1405
  gridGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
1406
+ gridRowGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
1407
+ gridColumnGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
1391
1408
  flexDirection: zod.ZodOptional<zod.ZodEnum<["row", "column"]>>;
1392
1409
  alignItems: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch"]>>;
1393
1410
  justifyContent: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch", "space-between", "space-around", "space-evenly"]>>;
@@ -1665,6 +1682,8 @@ declare class Board extends Group<typeof boardProps> {
1665
1682
  gridTemplateColumns?: string | undefined;
1666
1683
  gridTemplate?: string | undefined;
1667
1684
  gridGap?: string | number | undefined;
1685
+ gridRowGap?: string | number | undefined;
1686
+ gridColumnGap?: string | number | undefined;
1668
1687
  flexDirection?: "row" | "column" | undefined;
1669
1688
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1670
1689
  justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
@@ -1701,6 +1720,8 @@ declare class Board extends Group<typeof boardProps> {
1701
1720
  gridTemplateColumns?: string | undefined;
1702
1721
  gridTemplate?: string | undefined;
1703
1722
  gridGap?: string | number | undefined;
1723
+ gridRowGap?: string | number | undefined;
1724
+ gridColumnGap?: string | number | undefined;
1704
1725
  flexDirection?: "row" | "column" | undefined;
1705
1726
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1706
1727
  justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
@@ -1733,6 +1754,8 @@ declare class Board extends Group<typeof boardProps> {
1733
1754
  gridTemplateColumns?: string | undefined;
1734
1755
  gridTemplate?: string | undefined;
1735
1756
  gridGap?: string | number | undefined;
1757
+ gridRowGap?: string | number | undefined;
1758
+ gridColumnGap?: string | number | undefined;
1736
1759
  flexDirection?: "row" | "column" | undefined;
1737
1760
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1738
1761
  justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
@@ -1776,6 +1799,8 @@ declare class Board extends Group<typeof boardProps> {
1776
1799
  pcbGridTemplateColumns?: string | undefined;
1777
1800
  pcbGridTemplate?: string | undefined;
1778
1801
  pcbGridGap?: string | number | undefined;
1802
+ pcbGridRowGap?: string | number | undefined;
1803
+ pcbGridColumnGap?: string | number | undefined;
1779
1804
  pcbFlex?: string | boolean | undefined;
1780
1805
  pcbFlexDirection?: "row" | "column" | undefined;
1781
1806
  pcbAlignItems?: "center" | "start" | "end" | "stretch" | undefined;
@@ -1866,6 +1891,8 @@ declare class Board extends Group<typeof boardProps> {
1866
1891
  gridTemplateColumns?: string | undefined;
1867
1892
  gridTemplate?: string | undefined;
1868
1893
  gridGap?: string | number | undefined;
1894
+ gridRowGap?: string | number | undefined;
1895
+ gridColumnGap?: string | number | undefined;
1869
1896
  flexDirection?: "row" | "column" | undefined;
1870
1897
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1871
1898
  justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
@@ -1902,6 +1929,8 @@ declare class Board extends Group<typeof boardProps> {
1902
1929
  gridTemplateColumns?: string | undefined;
1903
1930
  gridTemplate?: string | undefined;
1904
1931
  gridGap?: string | number | undefined;
1932
+ gridRowGap?: string | number | undefined;
1933
+ gridColumnGap?: string | number | undefined;
1905
1934
  flexDirection?: "row" | "column" | undefined;
1906
1935
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1907
1936
  justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
@@ -1934,6 +1963,8 @@ declare class Board extends Group<typeof boardProps> {
1934
1963
  gridTemplateColumns?: string | undefined;
1935
1964
  gridTemplate?: string | undefined;
1936
1965
  gridGap?: string | number | undefined;
1966
+ gridRowGap?: string | number | undefined;
1967
+ gridColumnGap?: string | number | undefined;
1937
1968
  flexDirection?: "row" | "column" | undefined;
1938
1969
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1939
1970
  justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
@@ -1977,6 +2008,8 @@ declare class Board extends Group<typeof boardProps> {
1977
2008
  pcbGridTemplateColumns?: string | undefined;
1978
2009
  pcbGridTemplate?: string | undefined;
1979
2010
  pcbGridGap?: string | number | undefined;
2011
+ pcbGridRowGap?: string | number | undefined;
2012
+ pcbGridColumnGap?: string | number | undefined;
1980
2013
  pcbFlex?: string | boolean | undefined;
1981
2014
  pcbFlexDirection?: "row" | "column" | undefined;
1982
2015
  pcbAlignItems?: "center" | "start" | "end" | "stretch" | undefined;
@@ -8190,10 +8223,11 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
8190
8223
  }>>;
8191
8224
  pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
8192
8225
  relative: zod.ZodOptional<zod.ZodBoolean>;
8193
- }, "layer" | "pcbRotation"> & {
8226
+ }, "layer"> & {
8194
8227
  name: zod.ZodOptional<zod.ZodString>;
8195
8228
  connectsTo: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodArray<zod.ZodString, "many">]>>;
8196
8229
  shape: zod.ZodLiteral<"pill">;
8230
+ rectPad: zod.ZodOptional<zod.ZodBoolean>;
8197
8231
  outerWidth: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
8198
8232
  outerHeight: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
8199
8233
  holeWidth: zod.ZodEffects<zod.ZodType<string | number, zod.ZodTypeDef, string | number>, number | undefined, string | number>;
@@ -8207,6 +8241,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
8207
8241
  outerHeight: number;
8208
8242
  pcbX?: number | undefined;
8209
8243
  pcbY?: number | undefined;
8244
+ pcbRotation?: number | undefined;
8210
8245
  pcbRelative?: boolean | undefined;
8211
8246
  relative?: boolean | undefined;
8212
8247
  name?: string | undefined;
@@ -8216,6 +8251,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
8216
8251
  holeHeight?: number | undefined;
8217
8252
  innerWidth?: number | undefined;
8218
8253
  innerHeight?: number | undefined;
8254
+ rectPad?: boolean | undefined;
8219
8255
  }, {
8220
8256
  shape: "pill";
8221
8257
  outerWidth: string | number;
@@ -8224,6 +8260,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
8224
8260
  holeHeight: string | number;
8225
8261
  pcbX?: string | number | undefined;
8226
8262
  pcbY?: string | number | undefined;
8263
+ pcbRotation?: string | number | undefined;
8227
8264
  pcbRelative?: boolean | undefined;
8228
8265
  relative?: boolean | undefined;
8229
8266
  name?: string | undefined;
@@ -8231,6 +8268,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
8231
8268
  portHints?: (string | number)[] | undefined;
8232
8269
  innerWidth?: string | number | undefined;
8233
8270
  innerHeight?: string | number | undefined;
8271
+ rectPad?: boolean | undefined;
8234
8272
  }>, zod.ZodObject<Omit<{
8235
8273
  pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
8236
8274
  pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
@@ -8372,6 +8410,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
8372
8410
  outerHeight: number;
8373
8411
  pcbX?: number | undefined;
8374
8412
  pcbY?: number | undefined;
8413
+ pcbRotation?: number | undefined;
8375
8414
  pcbRelative?: boolean | undefined;
8376
8415
  relative?: boolean | undefined;
8377
8416
  name?: string | undefined;
@@ -8381,6 +8420,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
8381
8420
  holeHeight?: number | undefined;
8382
8421
  innerWidth?: number | undefined;
8383
8422
  innerHeight?: number | undefined;
8423
+ rectPad?: boolean | undefined;
8384
8424
  } | {
8385
8425
  shape: "circular_hole_with_rect_pad";
8386
8426
  holeDiameter: number;
@@ -8444,6 +8484,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
8444
8484
  holeHeight: string | number;
8445
8485
  pcbX?: string | number | undefined;
8446
8486
  pcbY?: string | number | undefined;
8487
+ pcbRotation?: string | number | undefined;
8447
8488
  pcbRelative?: boolean | undefined;
8448
8489
  relative?: boolean | undefined;
8449
8490
  name?: string | undefined;
@@ -8451,6 +8492,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
8451
8492
  portHints?: (string | number)[] | undefined;
8452
8493
  innerWidth?: string | number | undefined;
8453
8494
  innerHeight?: string | number | undefined;
8495
+ rectPad?: boolean | undefined;
8454
8496
  } | {
8455
8497
  shape: "circular_hole_with_rect_pad";
8456
8498
  holeDiameter: string | number;
@@ -10535,6 +10577,7 @@ declare class PinHeader extends NormalComponent<typeof pinHeaderProps> {
10535
10577
  showSilkscreenPinLabels: zod.ZodOptional<zod.ZodBoolean>;
10536
10578
  pcbPinLabels: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodString>>;
10537
10579
  doubleRow: zod.ZodOptional<zod.ZodBoolean>;
10580
+ rightAngle: zod.ZodOptional<zod.ZodBoolean>;
10538
10581
  holeDiameter: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
10539
10582
  platedDiameter: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
10540
10583
  pinLabels: zod.ZodOptional<zod.ZodArray<zod.ZodString, "many">>;
@@ -10799,6 +10842,7 @@ declare class PinHeader extends NormalComponent<typeof pinHeaderProps> {
10799
10842
  schFacingDirection?: "up" | "down" | "left" | "right" | undefined;
10800
10843
  showSilkscreenPinLabels?: boolean | undefined;
10801
10844
  doubleRow?: boolean | undefined;
10845
+ rightAngle?: boolean | undefined;
10802
10846
  platedDiameter?: number | undefined;
10803
10847
  facingDirection?: "left" | "right" | undefined;
10804
10848
  }, {
@@ -10931,6 +10975,7 @@ declare class PinHeader extends NormalComponent<typeof pinHeaderProps> {
10931
10975
  schFacingDirection?: "up" | "down" | "left" | "right" | undefined;
10932
10976
  showSilkscreenPinLabels?: boolean | undefined;
10933
10977
  doubleRow?: boolean | undefined;
10978
+ rightAngle?: boolean | undefined;
10934
10979
  platedDiameter?: string | number | undefined;
10935
10980
  facingDirection?: "left" | "right" | undefined;
10936
10981
  }>;
package/dist/index.js CHANGED
@@ -2233,6 +2233,31 @@ var PlatedHole = class extends PrimitiveComponent2 {
2233
2233
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
2234
2234
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
2235
2235
  });
2236
+ } else if (props.shape === "pill" && props.rectPad) {
2237
+ const pcb_plated_hole = db.pcb_plated_hole.insert({
2238
+ pcb_component_id,
2239
+ pcb_port_id: this.matchedPort?.pcb_port_id,
2240
+ outer_width: props.outerWidth,
2241
+ outer_height: props.outerHeight,
2242
+ hole_width: props.holeWidth,
2243
+ hole_height: props.holeHeight,
2244
+ shape: "rotated_pill_hole_with_rect_pad",
2245
+ type: "pcb_plated_hole",
2246
+ port_hints: this.getNameAndAliases(),
2247
+ pcb_plated_hole_id: this.pcb_plated_hole_id,
2248
+ x: position.x,
2249
+ y: position.y,
2250
+ layers: ["top", "bottom"],
2251
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
2252
+ pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
2253
+ hole_shape: "rotated_pill",
2254
+ pad_shape: "rect",
2255
+ hole_ccw_rotation: props.pcbRotation ?? 0,
2256
+ rect_ccw_rotation: props.pcbRotation ?? 0,
2257
+ rect_pad_width: props.outerWidth,
2258
+ rect_pad_height: props.outerHeight
2259
+ });
2260
+ this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
2236
2261
  } else if (props.shape === "pill" || props.shape === "oval") {
2237
2262
  const pcb_plated_hole = db.pcb_plated_hole.insert({
2238
2263
  pcb_component_id,
@@ -5002,13 +5027,45 @@ var convertFacingDirectionToElbowDirection = (facingDirection) => {
5002
5027
  }
5003
5028
  };
5004
5029
 
5030
+ // lib/errors/AutorouterError.ts
5031
+ import packageJson from "@tscircuit/capacity-autorouter/package.json" with { type: "json" };
5032
+ var autorouterVersion = packageJson.version ?? "unknown";
5033
+ var AutorouterError = class extends Error {
5034
+ constructor(message) {
5035
+ super(`${message} (capacity-autorouter@${autorouterVersion})`);
5036
+ this.name = "AutorouterError";
5037
+ }
5038
+ };
5039
+
5040
+ // lib/errors/TraceConnectionError.ts
5041
+ var TraceConnectionError = class extends Error {
5042
+ constructor(errorData) {
5043
+ super(errorData.message);
5044
+ this.errorData = errorData;
5045
+ this.name = "TraceConnectionError";
5046
+ }
5047
+ };
5048
+
5005
5049
  // lib/components/primitive-components/Trace/Trace_doInitialSchematicTraceRender.ts
5006
5050
  var Trace_doInitialSchematicTraceRender = (trace) => {
5051
+ if (trace._couldNotFindPort) return;
5007
5052
  if (trace.root?.schematicDisabled) return;
5008
5053
  const { db } = trace.root;
5009
5054
  const { _parsedProps: props, parent } = trace;
5010
5055
  if (!parent) throw new Error("Trace has no parent");
5011
- const { allPortsFound, portsWithSelectors: connectedPorts } = trace._findConnectedPorts();
5056
+ let allPortsFound;
5057
+ let connectedPorts;
5058
+ try {
5059
+ const result = trace._findConnectedPorts();
5060
+ allPortsFound = result.allPortsFound;
5061
+ connectedPorts = result.portsWithSelectors ?? [];
5062
+ } catch (error) {
5063
+ if (error instanceof TraceConnectionError) {
5064
+ db.source_trace_not_connected.insert(error.errorData);
5065
+ return;
5066
+ }
5067
+ throw error;
5068
+ }
5012
5069
  const { netsWithSelectors } = trace._findConnectedNets();
5013
5070
  if (!allPortsFound) return;
5014
5071
  const portIds = connectedPorts.map((p) => p.port.schematic_port_id).sort();
@@ -5707,7 +5764,6 @@ function Trace__doInitialSchematicTraceRenderWithDisplayLabel(trace) {
5707
5764
 
5708
5765
  // lib/components/primitive-components/Trace/Trace__findConnectedPorts.ts
5709
5766
  function Trace__findConnectedPorts(trace) {
5710
- const { db } = trace.root;
5711
5767
  const { _parsedProps: props, parent } = trace;
5712
5768
  if (!parent) throw new Error("Trace has no parent");
5713
5769
  const portSelectors = trace.getTracePortPathSelectors();
@@ -5733,33 +5789,44 @@ function Trace__findConnectedPorts(trace) {
5733
5789
  targetComponent = trace.getSubcircuit().selectOne(`.${parentSelector}`);
5734
5790
  }
5735
5791
  if (!targetComponent) {
5736
- if (parentSelector) {
5737
- trace.renderError(
5738
- `Could not find port for selector "${selector}". Component "${parentSelector}" not found`
5739
- );
5740
- } else {
5741
- trace.renderError(`Could not find port for selector "${selector}"`);
5742
- }
5743
- } else {
5744
- const ports = targetComponent.children.filter(
5745
- (c) => c.componentName === "Port"
5746
- );
5747
- const portLabel = portToken.includes(".") ? portToken.split(".").pop() ?? "" : portToken;
5748
- const portNames = ports.flatMap((c) => c.getNameAndAliases());
5749
- const hasCustomLabels = portNames.some((n) => !/^(pin\d+|\d+)$/.test(n));
5750
- const labelList = Array.from(new Set(portNames)).join(", ");
5751
- let detail;
5752
- if (ports.length === 0) {
5753
- detail = "It has no ports";
5754
- } else if (!hasCustomLabels) {
5755
- detail = `It has ${ports.length} pins and no pinLabels (consider adding pinLabels)`;
5756
- } else {
5757
- detail = `It has [${labelList}]`;
5758
- }
5759
- trace.renderError(
5760
- `Could not find port for selector "${selector}". Component "${targetComponent.props.name ?? parentSelector}" found, but does not have pin "${portLabel}". ${detail}`
5761
- );
5792
+ const errorMessage2 = parentSelector ? `Could not find port for selector "${selector}". Component "${parentSelector}" not found` : `Could not find port for selector "${selector}"`;
5793
+ const subcircuit2 = trace.getSubcircuit();
5794
+ const sourceGroup2 = subcircuit2.getGroup();
5795
+ throw new TraceConnectionError({
5796
+ error_type: "source_trace_not_connected",
5797
+ message: errorMessage2,
5798
+ subcircuit_id: subcircuit2.subcircuit_id ?? void 0,
5799
+ source_group_id: sourceGroup2?.source_group_id ?? void 0,
5800
+ source_trace_id: trace.source_trace_id ?? void 0,
5801
+ selectors_not_found: [selector]
5802
+ });
5762
5803
  }
5804
+ const ports = targetComponent.children.filter(
5805
+ (c) => c.componentName === "Port"
5806
+ );
5807
+ const portLabel = portToken.includes(".") ? portToken.split(".").pop() ?? "" : portToken;
5808
+ const portNames = ports.flatMap((c) => c.getNameAndAliases());
5809
+ const hasCustomLabels = portNames.some((n) => !/^(pin\d+|\d+)$/.test(n));
5810
+ const labelList = Array.from(new Set(portNames)).join(", ");
5811
+ let detail;
5812
+ if (ports.length === 0) {
5813
+ detail = "It has no ports";
5814
+ } else if (!hasCustomLabels) {
5815
+ detail = `It has ${ports.length} pins and no pinLabels (consider adding pinLabels)`;
5816
+ } else {
5817
+ detail = `It has [${labelList}]`;
5818
+ }
5819
+ const errorMessage = `Could not find port for selector "${selector}". Component "${targetComponent.props.name ?? parentSelector}" found, but does not have pin "${portLabel}". ${detail}`;
5820
+ const subcircuit = trace.getSubcircuit();
5821
+ const sourceGroup = subcircuit.getGroup();
5822
+ throw new TraceConnectionError({
5823
+ error_type: "source_trace_not_connected",
5824
+ message: errorMessage,
5825
+ subcircuit_id: subcircuit.subcircuit_id ?? void 0,
5826
+ source_group_id: sourceGroup?.source_group_id ?? void 0,
5827
+ source_trace_id: trace.source_trace_id ?? void 0,
5828
+ selectors_not_found: [selector]
5829
+ });
5763
5830
  }
5764
5831
  }
5765
5832
  if (portsWithSelectors.some((p) => !p.port)) {
@@ -5780,6 +5847,7 @@ var Trace3 = class extends PrimitiveComponent2 {
5780
5847
  _portsRoutedOnPcb;
5781
5848
  subcircuit_connectivity_map_key = null;
5782
5849
  _traceConnectionHash = null;
5850
+ _couldNotFindPort;
5783
5851
  constructor(props) {
5784
5852
  super(props);
5785
5853
  this._portsRoutedOnPcb = [];
@@ -5896,7 +5964,20 @@ var Trace3 = class extends PrimitiveComponent2 {
5896
5964
  this.renderError("Trace has no parent");
5897
5965
  return;
5898
5966
  }
5899
- const { allPortsFound, portsWithSelectors: ports } = this._findConnectedPorts();
5967
+ let allPortsFound;
5968
+ let ports;
5969
+ try {
5970
+ const result = this._findConnectedPorts();
5971
+ allPortsFound = result.allPortsFound;
5972
+ ports = result.portsWithSelectors ?? [];
5973
+ } catch (error) {
5974
+ if (error instanceof TraceConnectionError) {
5975
+ db.source_trace_not_connected.insert(error.errorData);
5976
+ this._couldNotFindPort = true;
5977
+ return;
5978
+ }
5979
+ throw error;
5980
+ }
5900
5981
  if (!allPortsFound) return;
5901
5982
  this._traceConnectionHash = this._computeTraceConnectionHash();
5902
5983
  const existingTraces = db.source_trace.list();
@@ -6839,18 +6920,6 @@ import {
6839
6920
 
6840
6921
  // lib/utils/autorouting/CapacityMeshAutorouter.ts
6841
6922
  import { CapacityMeshSolver } from "@tscircuit/capacity-autorouter";
6842
-
6843
- // lib/errors/AutorouterError.ts
6844
- import packageJson from "@tscircuit/capacity-autorouter/package.json" with { type: "json" };
6845
- var autorouterVersion = packageJson.version ?? "unknown";
6846
- var AutorouterError = class extends Error {
6847
- constructor(message) {
6848
- super(`${message} (capacity-autorouter@${autorouterVersion})`);
6849
- this.name = "AutorouterError";
6850
- }
6851
- };
6852
-
6853
- // lib/utils/autorouting/CapacityMeshAutorouter.ts
6854
6923
  var CapacityMeshAutorouter = class {
6855
6924
  input;
6856
6925
  isRouting = false;
@@ -11268,7 +11337,7 @@ import { identity as identity5 } from "transformation-matrix";
11268
11337
  var package_default = {
11269
11338
  name: "@tscircuit/core",
11270
11339
  type: "module",
11271
- version: "0.0.599",
11340
+ version: "0.0.601",
11272
11341
  types: "dist/index.d.ts",
11273
11342
  main: "dist/index.js",
11274
11343
  module: "dist/index.js",
@@ -11299,7 +11368,7 @@ var package_default = {
11299
11368
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
11300
11369
  "@tscircuit/log-soup": "^1.0.2",
11301
11370
  "@tscircuit/math-utils": "^0.0.18",
11302
- "@tscircuit/props": "^0.0.271",
11371
+ "@tscircuit/props": "^0.0.274",
11303
11372
  "@tscircuit/schematic-autolayout": "^0.0.6",
11304
11373
  "@tscircuit/schematic-corpus": "^0.0.110",
11305
11374
  "@tscircuit/schematic-match-adapt": "^0.0.16",
@@ -11313,11 +11382,11 @@ var package_default = {
11313
11382
  "bun-match-svg": "0.0.12",
11314
11383
  "calculate-elbow": "^0.0.5",
11315
11384
  "chokidar-cli": "^3.0.0",
11316
- "circuit-json": "^0.0.221",
11385
+ "circuit-json": "^0.0.224",
11317
11386
  "circuit-json-to-bpc": "^0.0.13",
11318
11387
  "circuit-json-to-connectivity-map": "^0.0.22",
11319
11388
  "circuit-json-to-simple-3d": "^0.0.2",
11320
- "circuit-to-svg": "^0.0.172",
11389
+ "circuit-to-svg": "^0.0.174",
11321
11390
  concurrently: "^9.1.2",
11322
11391
  debug: "^4.3.6",
11323
11392
  "graphics-debug": "^0.0.60",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.600",
4
+ "version": "0.0.602",
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
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
33
33
  "@tscircuit/log-soup": "^1.0.2",
34
34
  "@tscircuit/math-utils": "^0.0.18",
35
- "@tscircuit/props": "^0.0.271",
35
+ "@tscircuit/props": "^0.0.274",
36
36
  "@tscircuit/schematic-autolayout": "^0.0.6",
37
37
  "@tscircuit/schematic-corpus": "^0.0.110",
38
38
  "@tscircuit/schematic-match-adapt": "^0.0.16",
@@ -46,11 +46,11 @@
46
46
  "bun-match-svg": "0.0.12",
47
47
  "calculate-elbow": "^0.0.5",
48
48
  "chokidar-cli": "^3.0.0",
49
- "circuit-json": "^0.0.221",
49
+ "circuit-json": "^0.0.224",
50
50
  "circuit-json-to-bpc": "^0.0.13",
51
51
  "circuit-json-to-connectivity-map": "^0.0.22",
52
52
  "circuit-json-to-simple-3d": "^0.0.2",
53
- "circuit-to-svg": "^0.0.172",
53
+ "circuit-to-svg": "^0.0.174",
54
54
  "concurrently": "^9.1.2",
55
55
  "debug": "^4.3.6",
56
56
  "graphics-debug": "^0.0.60",