@tscircuit/core 0.0.1935 → 0.0.1937

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
@@ -108279,12 +108279,12 @@ declare const pcbViaProps: z.ZodObject<{
108279
108279
  }>>;
108280
108280
  schRelative: z.ZodOptional<z.ZodBoolean>;
108281
108281
  pcbRelative: z.ZodOptional<z.ZodBoolean>;
108282
+ tented: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodBoolean, z.ZodEnum<["both_sides", "top_and_bottom_tented", "top_tented", "bottom_tented", "exposed"]>]>, "top_and_bottom_tented" | "top_tented" | "bottom_tented" | "exposed", boolean | "top_and_bottom_tented" | "top_tented" | "bottom_tented" | "exposed" | "both_sides">>;
108282
108283
  isTented: z.ZodOptional<z.ZodBoolean>;
108283
108284
  tentedOnTop: z.ZodOptional<z.ZodBoolean>;
108284
108285
  tentedOnBottom: z.ZodOptional<z.ZodBoolean>;
108285
108286
  outerDiameter: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
108286
108287
  netIsAssignable: z.ZodOptional<z.ZodBoolean>;
108287
- tented: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodBoolean, z.ZodEnum<["both_sides", "top_and_bottom_tented", "top_tented", "bottom_tented", "exposed"]>]>, "top_and_bottom_tented" | "top_tented" | "bottom_tented" | "exposed", boolean | "both_sides" | "top_and_bottom_tented" | "top_tented" | "bottom_tented" | "exposed">>;
108288
108288
  }, "strip", z.ZodTypeAny, {
108289
108289
  symbol?: _tscircuit_props.SymbolProp | undefined;
108290
108290
  fromLayer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8" | undefined;
@@ -108340,12 +108340,12 @@ declare const pcbViaProps: z.ZodObject<{
108340
108340
  } | undefined;
108341
108341
  schRelative?: boolean | undefined;
108342
108342
  pcbRelative?: boolean | undefined;
108343
+ tented?: "top_and_bottom_tented" | "top_tented" | "bottom_tented" | "exposed" | undefined;
108343
108344
  isTented?: boolean | undefined;
108344
108345
  tentedOnTop?: boolean | undefined;
108345
108346
  tentedOnBottom?: boolean | undefined;
108346
108347
  outerDiameter?: number | undefined;
108347
108348
  netIsAssignable?: boolean | undefined;
108348
- tented?: "top_and_bottom_tented" | "top_tented" | "bottom_tented" | "exposed" | undefined;
108349
108349
  }, {
108350
108350
  symbol?: _tscircuit_props.SymbolProp | undefined;
108351
108351
  fromLayer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8" | {
@@ -108409,12 +108409,12 @@ declare const pcbViaProps: z.ZodObject<{
108409
108409
  } | undefined;
108410
108410
  schRelative?: boolean | undefined;
108411
108411
  pcbRelative?: boolean | undefined;
108412
+ tented?: boolean | "top_and_bottom_tented" | "top_tented" | "bottom_tented" | "exposed" | "both_sides" | undefined;
108412
108413
  isTented?: boolean | undefined;
108413
108414
  tentedOnTop?: boolean | undefined;
108414
108415
  tentedOnBottom?: boolean | undefined;
108415
108416
  outerDiameter?: string | number | undefined;
108416
108417
  netIsAssignable?: boolean | undefined;
108417
- tented?: boolean | "both_sides" | "top_and_bottom_tented" | "top_tented" | "bottom_tented" | "exposed" | undefined;
108418
108418
  }>;
108419
108419
  declare class PcbVia extends PrimitiveComponent<typeof pcbViaProps> {
108420
108420
  pcb_via_id: string | null;
@@ -108539,12 +108539,12 @@ declare class PcbVia extends PrimitiveComponent<typeof pcbViaProps> {
108539
108539
  }>>;
108540
108540
  schRelative: z.ZodOptional<z.ZodBoolean>;
108541
108541
  pcbRelative: z.ZodOptional<z.ZodBoolean>;
108542
+ tented: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodBoolean, z.ZodEnum<["both_sides", "top_and_bottom_tented", "top_tented", "bottom_tented", "exposed"]>]>, "top_and_bottom_tented" | "top_tented" | "bottom_tented" | "exposed", boolean | "top_and_bottom_tented" | "top_tented" | "bottom_tented" | "exposed" | "both_sides">>;
108542
108543
  isTented: z.ZodOptional<z.ZodBoolean>;
108543
108544
  tentedOnTop: z.ZodOptional<z.ZodBoolean>;
108544
108545
  tentedOnBottom: z.ZodOptional<z.ZodBoolean>;
108545
108546
  outerDiameter: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
108546
108547
  netIsAssignable: z.ZodOptional<z.ZodBoolean>;
108547
- tented: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodBoolean, z.ZodEnum<["both_sides", "top_and_bottom_tented", "top_tented", "bottom_tented", "exposed"]>]>, "top_and_bottom_tented" | "top_tented" | "bottom_tented" | "exposed", boolean | "both_sides" | "top_and_bottom_tented" | "top_tented" | "bottom_tented" | "exposed">>;
108548
108548
  }, "strip", z.ZodTypeAny, {
108549
108549
  symbol?: _tscircuit_props.SymbolProp | undefined;
108550
108550
  fromLayer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8" | undefined;
@@ -108600,12 +108600,12 @@ declare class PcbVia extends PrimitiveComponent<typeof pcbViaProps> {
108600
108600
  } | undefined;
108601
108601
  schRelative?: boolean | undefined;
108602
108602
  pcbRelative?: boolean | undefined;
108603
+ tented?: "top_and_bottom_tented" | "top_tented" | "bottom_tented" | "exposed" | undefined;
108603
108604
  isTented?: boolean | undefined;
108604
108605
  tentedOnTop?: boolean | undefined;
108605
108606
  tentedOnBottom?: boolean | undefined;
108606
108607
  outerDiameter?: number | undefined;
108607
108608
  netIsAssignable?: boolean | undefined;
108608
- tented?: "top_and_bottom_tented" | "top_tented" | "bottom_tented" | "exposed" | undefined;
108609
108609
  }, {
108610
108610
  symbol?: _tscircuit_props.SymbolProp | undefined;
108611
108611
  fromLayer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | "inner7" | "inner8" | {
@@ -108669,12 +108669,12 @@ declare class PcbVia extends PrimitiveComponent<typeof pcbViaProps> {
108669
108669
  } | undefined;
108670
108670
  schRelative?: boolean | undefined;
108671
108671
  pcbRelative?: boolean | undefined;
108672
+ tented?: boolean | "top_and_bottom_tented" | "top_tented" | "bottom_tented" | "exposed" | "both_sides" | undefined;
108672
108673
  isTented?: boolean | undefined;
108673
108674
  tentedOnTop?: boolean | undefined;
108674
108675
  tentedOnBottom?: boolean | undefined;
108675
108676
  outerDiameter?: string | number | undefined;
108676
108677
  netIsAssignable?: boolean | undefined;
108677
- tented?: boolean | "both_sides" | "top_and_bottom_tented" | "top_tented" | "bottom_tented" | "exposed" | undefined;
108678
108678
  }>;
108679
108679
  };
108680
108680
  private _getLayers;
package/dist/index.js CHANGED
@@ -3667,6 +3667,15 @@ var getViaDiameterDefaultsWithOverrides = (overrides, pcbStyle) => {
3667
3667
  };
3668
3668
  };
3669
3669
 
3670
+ // lib/utils/getViaTenting.ts
3671
+ var getViaTenting = (tented) => {
3672
+ if (tented === void 0) return {};
3673
+ return {
3674
+ tented_on_top: tented === "top_tented" || tented === "top_and_bottom_tented",
3675
+ tented_on_bottom: tented === "bottom_tented" || tented === "top_and_bottom_tented"
3676
+ };
3677
+ };
3678
+
3670
3679
  // lib/components/primitive-components/Via.ts
3671
3680
  import "zod";
3672
3681
 
@@ -4991,9 +5000,11 @@ var Via = class extends PrimitiveComponent2 {
4991
5000
  const position = this._getGlobalPcbPositionBeforeLayout();
4992
5001
  const subcircuit = this.getSubcircuit();
4993
5002
  const connectedNetOrTrace = this._getConnectedNetOrTrace();
5003
+ const { isFlipped } = this._getPcbPrimitiveFlippedHelpers();
5004
+ const viaTenting = getViaTenting(this._parsedProps.tented);
4994
5005
  const sourceTraceId = this.source_trace_id ?? (connectedNetOrTrace instanceof Net ? void 0 : connectedNetOrTrace?.source_trace_id);
4995
5006
  const sourceNetId = !sourceTraceId && connectedNetOrTrace instanceof Net ? connectedNetOrTrace.source_net_id : void 0;
4996
- const pcb_via3 = db.pcb_via.insert({
5007
+ const pcb_via4 = db.pcb_via.insert({
4997
5008
  x: position.x,
4998
5009
  y: position.y,
4999
5010
  hole_diameter: holeDiameter,
@@ -5005,10 +5016,12 @@ var Via = class extends PrimitiveComponent2 {
5005
5016
  subcircuit_connectivity_map_key: this.subcircuit_connectivity_map_key ?? void 0,
5006
5017
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
5007
5018
  net_is_assignable: this._parsedProps.netIsAssignable ?? void 0,
5019
+ tented_on_top: isFlipped ? viaTenting.tented_on_bottom : viaTenting.tented_on_top,
5020
+ tented_on_bottom: isFlipped ? viaTenting.tented_on_top : viaTenting.tented_on_bottom,
5008
5021
  ...sourceTraceId ? { source_trace_id: sourceTraceId } : {},
5009
5022
  ...sourceNetId ? { source_net_id: sourceNetId } : {}
5010
5023
  });
5011
- this.pcb_via_id = pcb_via3.pcb_via_id;
5024
+ this.pcb_via_id = pcb_via4.pcb_via_id;
5012
5025
  }
5013
5026
  };
5014
5027
 
@@ -5527,7 +5540,9 @@ function Trace_doInitialPcbManualTraceRender(trace) {
5527
5540
  ...restOfPoint,
5528
5541
  ...transformedPoint,
5529
5542
  from_layer: maybeFlipLayer(point6.from_layer),
5530
- to_layer: maybeFlipLayer(point6.to_layer)
5543
+ to_layer: maybeFlipLayer(point6.to_layer),
5544
+ tented_on_top: isFlipped ? point6.tented_on_bottom : point6.tented_on_top,
5545
+ tented_on_bottom: isFlipped ? point6.tented_on_top : point6.tented_on_bottom
5531
5546
  };
5532
5547
  }
5533
5548
  return {
@@ -5583,8 +5598,8 @@ function Trace_doInitialPcbManualTraceRender(trace) {
5583
5598
  net_is_assignable: inflatedPcbVia?.net_is_assignable,
5584
5599
  net_assigned: inflatedPcbVia?.net_assigned,
5585
5600
  // Use the same footprint flip as the route and via layers above.
5586
- tented_on_top: isFlipped ? inflatedPcbVia?.tented_on_bottom : inflatedPcbVia?.tented_on_top,
5587
- tented_on_bottom: isFlipped ? inflatedPcbVia?.tented_on_top : inflatedPcbVia?.tented_on_bottom
5601
+ tented_on_top: (isFlipped ? inflatedPcbVia?.tented_on_bottom : inflatedPcbVia?.tented_on_top) ?? point6.tented_on_top,
5602
+ tented_on_bottom: (isFlipped ? inflatedPcbVia?.tented_on_top : inflatedPcbVia?.tented_on_bottom) ?? point6.tented_on_bottom
5588
5603
  });
5589
5604
  }
5590
5605
  }
@@ -9351,7 +9366,7 @@ var PcbTrace = class extends PrimitiveComponent2 {
9351
9366
  const { _parsedProps: props } = this;
9352
9367
  const container = this.getPrimitiveContainer();
9353
9368
  const subcircuit = this.getSubcircuit();
9354
- const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
9369
+ const { isFlipped, maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
9355
9370
  const parentTransform = this._computePcbGlobalTransformBeforeLayout();
9356
9371
  const transformedRoute = props.route.map((point6) => {
9357
9372
  if (point6.route_type === "wire") {
@@ -9370,7 +9385,9 @@ var PcbTrace = class extends PrimitiveComponent2 {
9370
9385
  ...restOfPoint,
9371
9386
  ...transformedPoint,
9372
9387
  from_layer: maybeFlipLayer(point6.from_layer),
9373
- to_layer: maybeFlipLayer(point6.to_layer)
9388
+ to_layer: maybeFlipLayer(point6.to_layer),
9389
+ tented_on_top: isFlipped ? point6.tented_on_bottom : point6.tented_on_top,
9390
+ tented_on_bottom: isFlipped ? point6.tented_on_top : point6.tented_on_bottom
9374
9391
  };
9375
9392
  }
9376
9393
  return {
@@ -9537,10 +9554,14 @@ var PcbVia = class extends PrimitiveComponent2 {
9537
9554
  holeDiameter,
9538
9555
  outerDiameter,
9539
9556
  netIsAssignable,
9557
+ tented,
9540
9558
  isTented,
9541
9559
  tentedOnTop,
9542
9560
  tentedOnBottom
9543
9561
  } = this._parsedProps;
9562
+ const viaTenting = getViaTenting(tented);
9563
+ const topTenting = tentedOnTop ?? viaTenting.tented_on_top ?? isTented;
9564
+ const bottomTenting = tentedOnBottom ?? viaTenting.tented_on_bottom ?? isTented;
9544
9565
  const subcircuit = this.getSubcircuit();
9545
9566
  const position = this._getGlobalPcbPositionBeforeLayout();
9546
9567
  const { isFlipped, maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
@@ -9562,8 +9583,8 @@ var PcbVia = class extends PrimitiveComponent2 {
9562
9583
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
9563
9584
  net_is_assignable: netIsAssignable,
9564
9585
  // Use the same footprint flip as the via layers above.
9565
- tented_on_top: (isFlipped ? tentedOnBottom : tentedOnTop) ?? isTented,
9566
- tented_on_bottom: (isFlipped ? tentedOnTop : tentedOnBottom) ?? isTented
9586
+ tented_on_top: isFlipped ? bottomTenting : topTenting,
9587
+ tented_on_bottom: isFlipped ? topTenting : bottomTenting
9567
9588
  });
9568
9589
  this.pcb_via_id = pcbVia.pcb_via_id;
9569
9590
  }
@@ -53693,11 +53714,29 @@ var getBusSrjConnectionNamesOrThrow = ({
53693
53714
  srjConnections,
53694
53715
  bus,
53695
53716
  sourceTraceId,
53696
- traceNameOrPortSelector
53717
+ traceNameOrPortSelector,
53718
+ busSourceTraces
53697
53719
  }) => {
53698
- const matchingSrjConnections = srjConnections.filter(
53720
+ const directSrjConnections = srjConnections.filter(
53699
53721
  (srjConnection) => srjConnection.source_trace_id === sourceTraceId
53700
53722
  );
53723
+ if (directSrjConnections.length > 0) {
53724
+ return directSrjConnections.map((srjConnection) => srjConnection.name);
53725
+ }
53726
+ const sourceTrace = busSourceTraces.find(
53727
+ (trace) => trace.source_trace_id === sourceTraceId
53728
+ );
53729
+ const connectedSourceTraces = busSourceTraces.filter(
53730
+ (trace) => trace.source_trace_id === sourceTraceId || sourceTrace.subcircuit_connectivity_map_key !== void 0 && trace.subcircuit_connectivity_map_key === sourceTrace.subcircuit_connectivity_map_key
53731
+ );
53732
+ const connectedSourceNetIds = new Set(
53733
+ connectedSourceTraces.flatMap(
53734
+ (trace) => trace.connected_source_net_ids ?? []
53735
+ )
53736
+ );
53737
+ const matchingSrjConnections = srjConnections.filter(
53738
+ (srjConnection) => connectedSourceNetIds.has(srjConnection.name)
53739
+ );
53701
53740
  if (matchingSrjConnections.length === 0) {
53702
53741
  throw new Error(
53703
53742
  `Could not find an SRJ connection for "${traceNameOrPortSelector}" in bus "${bus.name}"`
@@ -53776,7 +53815,8 @@ var getBusesForSimpleRouteJson = ({
53776
53815
  srjConnections,
53777
53816
  bus,
53778
53817
  sourceTraceId,
53779
- traceNameOrPortSelector
53818
+ traceNameOrPortSelector,
53819
+ busSourceTraces
53780
53820
  });
53781
53821
  }
53782
53822
  );
@@ -63360,7 +63400,7 @@ function Group_getRoutingPhasePlans(group) {
63360
63400
  var package_default = {
63361
63401
  name: "@tscircuit/core",
63362
63402
  type: "module",
63363
- version: "0.0.1934",
63403
+ version: "0.0.1936",
63364
63404
  types: "dist/index.d.ts",
63365
63405
  main: "dist/index.js",
63366
63406
  module: "dist/index.js",
@@ -63435,7 +63475,7 @@ var package_default = {
63435
63475
  "circuit-json-to-connectivity-map": "^0.0.30",
63436
63476
  "circuit-json-to-gltf": "^0.0.128",
63437
63477
  "circuit-json-to-spice": "^0.0.45",
63438
- "circuit-to-svg": "^0.0.422",
63478
+ "circuit-to-svg": "^0.0.424",
63439
63479
  concurrently: "^9.1.2",
63440
63480
  "connectivity-map": "^1.0.0",
63441
63481
  debug: "^4.3.6",
@@ -68670,6 +68710,7 @@ function CopperPour_doInitialPcbCopperPourRender(copperPour) {
68670
68710
  }
68671
68711
 
68672
68712
  // lib/components/primitive-components/CopperPour/CopperPour_doInitialPcbViaStitchRender.ts
68713
+ import { pcb_via as pcb_via3 } from "circuit-json";
68673
68714
  var renderViaStitchingForCopperPours = (copperPour) => {
68674
68715
  const subcircuit = copperPour.getSubcircuit();
68675
68716
  if (!subcircuit.root) return;
@@ -68711,8 +68752,12 @@ var renderViaStitchingForCopperPours = (copperPour) => {
68711
68752
  throw new Error(solver.error ?? "Via stitching solver failed");
68712
68753
  }
68713
68754
  for (const pcbVia of solver.getOutput().pcbVias) {
68714
- const { pcb_via_id: _solverViaId, ...pcbViaInput } = pcbVia;
68715
- const insertedVia = db.pcb_via.insert(pcbViaInput);
68755
+ const { pcb_via_id: _solverViaId, ...pcbViaInput } = pcb_via3.parse(pcbVia);
68756
+ const insertedVia = db.pcb_via.insert({
68757
+ ...pcbViaInput,
68758
+ tented_on_top: void 0,
68759
+ tented_on_bottom: void 0
68760
+ });
68716
68761
  boardComponent?._generatedStitchingViaIds?.add(insertedVia.pcb_via_id);
68717
68762
  }
68718
68763
  };
@@ -69522,6 +69567,7 @@ var Board = class extends Group5 {
69522
69567
  const pcbBoardFromCircuitJson = circuitJsonElements?.find(
69523
69568
  (elm) => elm.type === "pcb_board"
69524
69569
  );
69570
+ const viaTenting = getViaTenting(props.defaultViaTenting);
69525
69571
  const rawProps = this.props;
69526
69572
  const resolvedIsViaInPadAllowed = rawProps.isViaInPadAllowed ?? pcbBoardFromCircuitJson?.is_via_in_pad_allowed;
69527
69573
  const resolvedAllowBlindAndBuriedVias = rawProps.allowBlindAndBuriedVias ?? pcbBoardFromCircuitJson?.allow_blind_and_buried_vias;
@@ -69579,7 +69625,10 @@ var Board = class extends Group5 {
69579
69625
  const resolvedMinViaPadDiameter = subcircuitProps2.minViaPadDiameter ?? (pcbStyle?.viaPadDiameter !== void 0 ? styledViaDimensions.padDiameter : configuredViaHoleDiameter !== void 0 ? configuredViaHoleDiameter + DEFAULT_VIA_PAD_DIAMETER_OVER_HOLE_DIAMETER_MM : jlcMinTolerances.min_via_pad_diameter);
69580
69626
  const pcb_board = db.pcb_board.insert({
69581
69627
  source_board_id: this.source_board_id,
69628
+ subcircuit_id: this.subcircuit_id ?? void 0,
69582
69629
  center,
69630
+ default_via_tented_on_top: viaTenting.tented_on_top ?? pcbBoardFromCircuitJson?.default_via_tented_on_top,
69631
+ default_via_tented_on_bottom: viaTenting.tented_on_bottom ?? pcbBoardFromCircuitJson?.default_via_tented_on_bottom,
69583
69632
  thickness: this.boardThickness,
69584
69633
  num_layers: this.allLayers.length,
69585
69634
  width: computedWidth,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1935",
4
+ "version": "0.0.1937",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -76,7 +76,7 @@
76
76
  "circuit-json-to-connectivity-map": "^0.0.30",
77
77
  "circuit-json-to-gltf": "^0.0.128",
78
78
  "circuit-json-to-spice": "^0.0.45",
79
- "circuit-to-svg": "^0.0.422",
79
+ "circuit-to-svg": "^0.0.424",
80
80
  "concurrently": "^9.1.2",
81
81
  "connectivity-map": "^1.0.0",
82
82
  "debug": "^4.3.6",