@tscircuit/core 0.0.300 → 0.0.302

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
@@ -473,7 +473,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
473
473
  } | undefined;
474
474
  }>, "many">>;
475
475
  schDisplayLabel: z.ZodOptional<z.ZodString>;
476
- maxLength: z.ZodOptional<z.ZodNumber>;
476
+ maxLength: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
477
477
  }, {
478
478
  path: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<{
479
479
  getPortSelector: () => string;
@@ -519,7 +519,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
519
519
  } | undefined;
520
520
  }[] | undefined;
521
521
  schDisplayLabel?: string | undefined;
522
- maxLength?: number | undefined;
522
+ maxLength?: string | number | undefined;
523
523
  }>, z.ZodObject<z.objectUtil.extendShape<{
524
524
  key: z.ZodOptional<z.ZodString>;
525
525
  thickness: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
@@ -563,7 +563,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
563
563
  } | undefined;
564
564
  }>, "many">>;
565
565
  schDisplayLabel: z.ZodOptional<z.ZodString>;
566
- maxLength: z.ZodOptional<z.ZodNumber>;
566
+ maxLength: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
567
567
  }, {
568
568
  from: z.ZodUnion<[z.ZodString, z.ZodType<{
569
569
  getPortSelector: () => string;
@@ -620,7 +620,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
620
620
  } | undefined;
621
621
  }[] | undefined;
622
622
  schDisplayLabel?: string | undefined;
623
- maxLength?: number | undefined;
623
+ maxLength?: string | number | undefined;
624
624
  }>]>;
625
625
  componentName: string;
626
626
  };
@@ -1188,16 +1188,19 @@ declare class Board extends Group<typeof boardProps> {
1188
1188
  serverUrl: z.ZodOptional<z.ZodString>;
1189
1189
  inputFormat: z.ZodOptional<z.ZodEnum<["simplified", "circuit-json"]>>;
1190
1190
  serverMode: z.ZodOptional<z.ZodEnum<["job", "solve-endpoint"]>>;
1191
+ serverCacheEnabled: z.ZodOptional<z.ZodBoolean>;
1191
1192
  cache: z.ZodOptional<z.ZodType<_tscircuit_props.PcbRouteCache, z.ZodTypeDef, _tscircuit_props.PcbRouteCache>>;
1192
1193
  }, "strip", z.ZodTypeAny, {
1193
1194
  serverUrl?: string | undefined;
1194
1195
  inputFormat?: "simplified" | "circuit-json" | undefined;
1195
1196
  serverMode?: "job" | "solve-endpoint" | undefined;
1197
+ serverCacheEnabled?: boolean | undefined;
1196
1198
  cache?: _tscircuit_props.PcbRouteCache | undefined;
1197
1199
  }, {
1198
1200
  serverUrl?: string | undefined;
1199
1201
  inputFormat?: "simplified" | "circuit-json" | undefined;
1200
1202
  serverMode?: "job" | "solve-endpoint" | undefined;
1203
+ serverCacheEnabled?: boolean | undefined;
1201
1204
  cache?: _tscircuit_props.PcbRouteCache | undefined;
1202
1205
  }>, z.ZodLiteral<"sequential-trace">, z.ZodLiteral<"subcircuit">, z.ZodLiteral<"auto">, z.ZodLiteral<"auto-local">, z.ZodLiteral<"auto-cloud">]>>;
1203
1206
  }>, {
@@ -1264,6 +1267,7 @@ declare class Board extends Group<typeof boardProps> {
1264
1267
  serverUrl?: string | undefined;
1265
1268
  inputFormat?: "simplified" | "circuit-json" | undefined;
1266
1269
  serverMode?: "job" | "solve-endpoint" | undefined;
1270
+ serverCacheEnabled?: boolean | undefined;
1267
1271
  cache?: _tscircuit_props.PcbRouteCache | undefined;
1268
1272
  } | undefined;
1269
1273
  schAutoLayoutEnabled?: boolean | undefined;
@@ -1330,6 +1334,7 @@ declare class Board extends Group<typeof boardProps> {
1330
1334
  serverUrl?: string | undefined;
1331
1335
  inputFormat?: "simplified" | "circuit-json" | undefined;
1332
1336
  serverMode?: "job" | "solve-endpoint" | undefined;
1337
+ serverCacheEnabled?: boolean | undefined;
1333
1338
  cache?: _tscircuit_props.PcbRouteCache | undefined;
1334
1339
  } | undefined;
1335
1340
  schAutoLayoutEnabled?: boolean | undefined;
@@ -6828,6 +6833,7 @@ declare class PinHeader extends NormalComponent<typeof pinHeaderProps> {
6828
6833
  }>, {
6829
6834
  pinCount: zod.ZodNumber;
6830
6835
  pitch: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
6836
+ schFacingDirection: zod.ZodOptional<zod.ZodEnum<["up", "down", "left", "right"]>>;
6831
6837
  gender: zod.ZodDefault<zod.ZodOptional<zod.ZodEnum<["male", "female"]>>>;
6832
6838
  showSilkscreenPinLabels: zod.ZodOptional<zod.ZodBoolean>;
6833
6839
  doubleRow: zod.ZodOptional<zod.ZodBoolean>;
@@ -6907,6 +6913,7 @@ declare class PinHeader extends NormalComponent<typeof pinHeaderProps> {
6907
6913
  pinLabels?: string[] | undefined;
6908
6914
  holeDiameter?: number | undefined;
6909
6915
  pitch?: number | undefined;
6916
+ schFacingDirection?: "up" | "down" | "left" | "right" | undefined;
6910
6917
  showSilkscreenPinLabels?: boolean | undefined;
6911
6918
  doubleRow?: boolean | undefined;
6912
6919
  platedDiameter?: number | undefined;
@@ -6984,6 +6991,7 @@ declare class PinHeader extends NormalComponent<typeof pinHeaderProps> {
6984
6991
  pinLabels?: string[] | undefined;
6985
6992
  holeDiameter?: string | number | undefined;
6986
6993
  pitch?: string | number | undefined;
6994
+ schFacingDirection?: "up" | "down" | "left" | "right" | undefined;
6987
6995
  gender?: "male" | "female" | undefined;
6988
6996
  showSilkscreenPinLabels?: boolean | undefined;
6989
6997
  doubleRow?: boolean | undefined;
@@ -9308,10 +9316,10 @@ declare class Transistor extends NormalComponent<typeof transistorProps> {
9308
9316
  children: zod.ZodOptional<zod.ZodAny>;
9309
9317
  symbolName: zod.ZodOptional<zod.ZodString>;
9310
9318
  }>, {
9311
- transistorType: zod.ZodEnum<["npn", "pnp"]>;
9319
+ type: zod.ZodEnum<["npn", "pnp", "bjt", "jfet", "mosfet"]>;
9312
9320
  }>, "strip", zod.ZodTypeAny, {
9321
+ type: "npn" | "pnp" | "bjt" | "jfet" | "mosfet";
9313
9322
  name: string;
9314
- transistorType: "npn" | "pnp";
9315
9323
  pcbX?: number | undefined;
9316
9324
  pcbY?: number | undefined;
9317
9325
  pcbRotation?: number | undefined;
@@ -9378,8 +9386,8 @@ declare class Transistor extends NormalComponent<typeof transistorProps> {
9378
9386
  children?: any;
9379
9387
  symbolName?: string | undefined;
9380
9388
  }, {
9389
+ type: "npn" | "pnp" | "bjt" | "jfet" | "mosfet";
9381
9390
  name: string;
9382
- transistorType: "npn" | "pnp";
9383
9391
  pcbX?: string | number | undefined;
9384
9392
  pcbY?: string | number | undefined;
9385
9393
  pcbRotation?: string | number | undefined;
package/dist/index.js CHANGED
@@ -2028,9 +2028,15 @@ var Port = class extends PrimitiveComponent {
2028
2028
  }
2029
2029
  _getGlobalPcbPositionBeforeLayout() {
2030
2030
  const matchedPcbElm = this.matchedComponents.find((c) => c.isPcbPrimitive);
2031
+ const parentComponent = this.parent;
2032
+ if (parentComponent && !parentComponent.props.footprint) {
2033
+ throw new Error(
2034
+ `${parentComponent.componentName} "${parentComponent.props.name}" does not have a footprint. Add a footprint prop, e.g. <${parentComponent.componentName.toLowerCase()} footprint="..." />`
2035
+ );
2036
+ }
2031
2037
  if (!matchedPcbElm) {
2032
2038
  throw new Error(
2033
- `Port ${this} has no matched pcb component, can't get global pcb position`
2039
+ `Port ${this} has no matching PCB primitives. This often means the footprint's pads lack matching port hints.`
2034
2040
  );
2035
2041
  }
2036
2042
  return matchedPcbElm?._getGlobalPcbPositionBeforeLayout() ?? { x: 0, y: 0 };
@@ -3558,7 +3564,9 @@ import { boardProps } from "@tscircuit/props";
3558
3564
  import { identity as identity3 } from "transformation-matrix";
3559
3565
 
3560
3566
  // lib/components/primitive-components/Group/Group.ts
3561
- import { groupProps } from "@tscircuit/props";
3567
+ import {
3568
+ groupProps
3569
+ } from "@tscircuit/props";
3562
3570
  import * as SAL from "@tscircuit/schematic-autolayout";
3563
3571
  import "circuit-json";
3564
3572
  import { ConnectivityMap } from "circuit-json-to-connectivity-map";
@@ -3806,8 +3814,14 @@ var Group = class extends NormalComponent {
3806
3814
  async _runEffectMakeHttpAutoroutingRequest() {
3807
3815
  const debug4 = Debug5("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");
3808
3816
  const props = this._parsedProps;
3809
- const serverUrl = props.autorouter?.serverUrl ?? "https://registry-api.tscircuit.com";
3810
- const serverMode = props.autorouter?.serverMode ?? "job";
3817
+ const autoroutingOptions = {
3818
+ serverUrl: "https://registry-api.tscircuit.com",
3819
+ serverMode: "job",
3820
+ serverCacheEnabled: props.autorouter?.serverCachingEnabled ?? false,
3821
+ ...typeof props.autorouter === "object" ? props.autorouter : {}
3822
+ };
3823
+ const serverUrl = autoroutingOptions.serverUrl;
3824
+ const serverMode = autoroutingOptions.serverMode;
3811
3825
  const fetchWithDebug = (url, options) => {
3812
3826
  debug4("fetching", url);
3813
3827
  return fetch(url, options);
@@ -3858,7 +3872,8 @@ var Group = class extends NormalComponent {
3858
3872
  provider: "freerouting",
3859
3873
  autostart: true,
3860
3874
  display_name: this.root?.name,
3861
- subcircuit_id: this.subcircuit_id
3875
+ subcircuit_id: this.subcircuit_id,
3876
+ server_cache_enabled: autoroutingOptions.serverCacheEnabled
3862
3877
  }),
3863
3878
  headers: { "Content-Type": "application/json" }
3864
3879
  }
@@ -6478,7 +6493,7 @@ var Crystal = class extends NormalComponent {
6478
6493
  import { transistorProps } from "@tscircuit/props";
6479
6494
  var Transistor = class extends NormalComponent {
6480
6495
  get config() {
6481
- const baseSymbolName = this.props.transistorType === "npn" ? "npn_bipolar_transistor" : "pnp_bipolar_transistor";
6496
+ const baseSymbolName = this.props.type === "npn" ? "npn_bipolar_transistor" : "pnp_bipolar_transistor";
6482
6497
  return {
6483
6498
  componentName: "Transistor",
6484
6499
  schematicSymbolName: baseSymbolName,
@@ -6492,7 +6507,7 @@ var Transistor = class extends NormalComponent {
6492
6507
  const source_component = db.source_component.insert({
6493
6508
  ftype: "simple_transistor",
6494
6509
  name: props.name,
6495
- transistor_type: props.transistorType
6510
+ transistor_type: props.type
6496
6511
  });
6497
6512
  this.source_component_id = source_component.source_component_id;
6498
6513
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.300",
4
+ "version": "0.0.302",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -54,7 +54,7 @@
54
54
  "@tscircuit/footprinter": "^0.0.97",
55
55
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
56
56
  "@tscircuit/math-utils": "^0.0.9",
57
- "@tscircuit/props": "^0.0.137",
57
+ "@tscircuit/props": "^0.0.142",
58
58
  "@tscircuit/schematic-autolayout": "^0.0.6",
59
59
  "@tscircuit/soup-util": "^0.0.41",
60
60
  "circuit-json": "^0.0.135",