@tscircuit/core 0.0.1140 → 0.0.1142

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.
Files changed (2) hide show
  1. package/dist/index.js +249 -61
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -3885,6 +3885,64 @@ var getViaDiameterDefaultsWithOverrides = (overrides, pcbStyle) => {
3885
3885
  };
3886
3886
  };
3887
3887
 
3888
+ // lib/components/primitive-components/Port/areAllPcbPrimitivesOverlapping.ts
3889
+ var areAllPcbPrimitivesOverlapping = (pcbPrimitives) => {
3890
+ if (pcbPrimitives.length <= 1) return true;
3891
+ const bounds = pcbPrimitives.map((p) => {
3892
+ const circuitBounds = p._getPcbCircuitJsonBounds();
3893
+ return {
3894
+ left: circuitBounds.bounds.left,
3895
+ right: circuitBounds.bounds.right,
3896
+ top: circuitBounds.bounds.top,
3897
+ bottom: circuitBounds.bounds.bottom
3898
+ };
3899
+ });
3900
+ const overlaps = Array(bounds.length).fill(false).map(() => Array(bounds.length).fill(false));
3901
+ for (let i = 0; i < bounds.length; i++) {
3902
+ for (let j = i + 1; j < bounds.length; j++) {
3903
+ const a = bounds[i];
3904
+ const b = bounds[j];
3905
+ overlaps[i][j] = overlaps[j][i] = !(a.right < b.left || a.left > b.right || a.bottom > b.top || a.top < b.bottom);
3906
+ }
3907
+ }
3908
+ const visited = /* @__PURE__ */ new Set();
3909
+ const dfs = (node) => {
3910
+ visited.add(node);
3911
+ for (let i = 0; i < bounds.length; i++) {
3912
+ if (overlaps[node][i] && !visited.has(i)) {
3913
+ dfs(i);
3914
+ }
3915
+ }
3916
+ };
3917
+ dfs(0);
3918
+ return visited.size === bounds.length;
3919
+ };
3920
+
3921
+ // lib/components/primitive-components/Trace/getPcbSelectorErrorForTracePort.ts
3922
+ function formatPcbPrimitiveForError(component) {
3923
+ const portHints = component._parsedProps?.portHints ?? [];
3924
+ const aliases = portHints.filter(Boolean);
3925
+ if (aliases.length > 0) {
3926
+ return `<${component.lowercaseComponentName}(${aliases.map((alias) => `.${alias}`).join(", ")}) />`;
3927
+ }
3928
+ return `<${component.lowercaseComponentName} />`;
3929
+ }
3930
+ function getPcbSelectorErrorForTracePort(selector, port) {
3931
+ if (port.pcb_port_id) return null;
3932
+ const pcbMatches = port.matchedComponents.filter((c) => c.isPcbPrimitive);
3933
+ const parentName = port.getParentNormalComponent()?.props.name ?? port.parent?.props.name ?? "unknown";
3934
+ const rawPinSelectors = Array.from(
3935
+ new Set(
3936
+ port.getNameAndAliases().filter((alias) => /^pin\d+$/.test(alias)).map((alias) => `${parentName}.${alias}`)
3937
+ )
3938
+ );
3939
+ if (pcbMatches.length > 1 && !areAllPcbPrimitivesOverlapping(pcbMatches)) {
3940
+ const suggestion = rawPinSelectors.length > 0 ? ` Use a raw pin selector like ${rawPinSelectors.map((s) => `"${s}"`).join(" or ")}.` : "";
3941
+ return `Trace selector "${selector}" resolved to "${parentName}.${port.props.name}", but that target maps to multiple non-overlapping PCB pads: ${pcbMatches.map((c) => formatPcbPrimitiveForError(c)).join(", ")}.${suggestion}`;
3942
+ }
3943
+ return null;
3944
+ }
3945
+
3888
3946
  // lib/components/primitive-components/Trace/Trace_doInitialPcbTraceRender.ts
3889
3947
  var portToObjective = (port) => {
3890
3948
  const portPosition = port._getGlobalPcbPositionAfterLayout();
@@ -3928,10 +3986,12 @@ function Trace_doInitialPcbTraceRender(trace) {
3928
3986
  }
3929
3987
  let allPortsFound;
3930
3988
  let ports;
3989
+ let portsWithSelectors;
3931
3990
  try {
3932
3991
  const connectedPorts = trace._findConnectedPorts();
3933
3992
  allPortsFound = connectedPorts.allPortsFound;
3934
3993
  ports = connectedPorts.ports ?? [];
3994
+ portsWithSelectors = connectedPorts.portsWithSelectors ?? [];
3935
3995
  } catch (error) {
3936
3996
  if (error instanceof TraceConnectionError) {
3937
3997
  db.source_trace_not_connected_error.insert({
@@ -3945,6 +4005,20 @@ function Trace_doInitialPcbTraceRender(trace) {
3945
4005
  }
3946
4006
  const portsConnectedOnPcbViaNet = [];
3947
4007
  if (!allPortsFound) return;
4008
+ const pcbSelectorError = portsWithSelectors.map(
4009
+ ({ selector, port }) => getPcbSelectorErrorForTracePort(selector, port)
4010
+ ).find(Boolean);
4011
+ if (pcbSelectorError) {
4012
+ db.pcb_trace_error.insert({
4013
+ error_type: "pcb_trace_error",
4014
+ source_trace_id: trace.source_trace_id,
4015
+ message: pcbSelectorError,
4016
+ pcb_trace_id: trace.pcb_trace_id,
4017
+ pcb_component_ids: [],
4018
+ pcb_port_ids: ports.map((p) => p.pcb_port_id).filter(Boolean)
4019
+ });
4020
+ return;
4021
+ }
3948
4022
  const portsWithoutMatchedPcbPrimitive = [];
3949
4023
  for (const port of ports) {
3950
4024
  if (!port._hasMatchedPcbPrimitive()) {
@@ -4368,6 +4442,20 @@ function Trace_doInitialPcbManualTraceRender(trace) {
4368
4442
  throw error;
4369
4443
  }
4370
4444
  if (!allPortsFound) return;
4445
+ const pcbSelectorError = portsWithSelectors.map(
4446
+ ({ selector, port }) => getPcbSelectorErrorForTracePort(selector, port)
4447
+ ).find(Boolean);
4448
+ if (pcbSelectorError) {
4449
+ db.pcb_trace_error.insert({
4450
+ error_type: "pcb_trace_error",
4451
+ source_trace_id: trace.source_trace_id,
4452
+ message: pcbSelectorError,
4453
+ pcb_trace_id: trace.pcb_trace_id,
4454
+ pcb_component_ids: [],
4455
+ pcb_port_ids: ports.map((p) => p.pcb_port_id).filter(Boolean)
4456
+ });
4457
+ return;
4458
+ }
4371
4459
  const portsWithoutMatchedPcbPrimitive = [];
4372
4460
  for (const port of ports) {
4373
4461
  if (!port._hasMatchedPcbPrimitive()) {
@@ -4491,6 +4579,18 @@ function Trace_doInitialPcbManualTraceRender(trace) {
4491
4579
  });
4492
4580
  continue;
4493
4581
  }
4582
+ const pcbTargetError = getPcbSelectorErrorForTracePort(pt, resolvedPort);
4583
+ if (pcbTargetError) {
4584
+ db.pcb_trace_error.insert({
4585
+ error_type: "pcb_trace_error",
4586
+ source_trace_id: trace.source_trace_id,
4587
+ message: pcbTargetError,
4588
+ pcb_trace_id: trace.pcb_trace_id,
4589
+ pcb_component_ids: [],
4590
+ pcb_port_ids: []
4591
+ });
4592
+ return;
4593
+ }
4494
4594
  const portPos = resolvedPort._getGlobalPcbPositionAfterLayout();
4495
4595
  coordinates = { x: portPos.x, y: portPos.y };
4496
4596
  isGlobalPosition = true;
@@ -5262,14 +5362,27 @@ var createInstanceFromReactElement = (reactElm) => {
5262
5362
  import "circuit-json";
5263
5363
  import "zod";
5264
5364
 
5365
+ // lib/utils/schematic/getPinNumberFromPinLabelsKey.ts
5366
+ var PIN_LABELS_KEY_RE = /^(?:pin)?(\d+)$/;
5367
+ var getPinNumberFromPinLabelsKey = (pinKey) => {
5368
+ const match = pinKey.match(PIN_LABELS_KEY_RE);
5369
+ if (!match) return null;
5370
+ return Number.parseInt(match[1], 10);
5371
+ };
5372
+
5265
5373
  // lib/utils/schematic/parsePinNumberFromLabelsOrThrow.ts
5266
5374
  var parsePinNumberFromLabelsOrThrow = (pinNumberOrLabel, pinLabels) => {
5267
5375
  if (typeof pinNumberOrLabel === "number") {
5268
5376
  return pinNumberOrLabel;
5269
5377
  }
5378
+ const directPinNumber = getPinNumberFromPinLabelsKey(pinNumberOrLabel);
5379
+ if (directPinNumber !== null) {
5380
+ return directPinNumber;
5381
+ }
5270
5382
  if (pinNumberOrLabel.startsWith("pin")) {
5271
- const pinNumber = Number(pinNumberOrLabel.slice(3));
5272
- return pinNumber;
5383
+ throw new Error(
5384
+ `Invalid pinLabels key "${pinNumberOrLabel}". Expected "pin\${number}" (e.g. pin1, pin2).`
5385
+ );
5273
5386
  }
5274
5387
  if (!pinLabels) {
5275
5388
  throw new Error(
@@ -5279,7 +5392,13 @@ var parsePinNumberFromLabelsOrThrow = (pinNumberOrLabel, pinLabels) => {
5279
5392
  for (const pinNumberKey in pinLabels) {
5280
5393
  const aliases = Array.isArray(pinLabels[pinNumberKey]) ? pinLabels[pinNumberKey] : [pinLabels[pinNumberKey]];
5281
5394
  if (aliases.includes(pinNumberOrLabel)) {
5282
- return Number(pinNumberKey.replace("pin", ""));
5395
+ const pinNumber = getPinNumberFromPinLabelsKey(pinNumberKey);
5396
+ if (pinNumber === null) {
5397
+ throw new Error(
5398
+ `Invalid pinLabels key "${pinNumberKey}". Expected "pin\${number}" (e.g. pin1, pin2).`
5399
+ );
5400
+ }
5401
+ return pinNumber;
5283
5402
  }
5284
5403
  }
5285
5404
  throw new Error(
@@ -8360,39 +8479,6 @@ import "schematic-symbols";
8360
8479
  import { applyToPoint as applyToPoint16, compose as compose4, translate as translate3 } from "transformation-matrix";
8361
8480
  import { z as z7 } from "zod";
8362
8481
 
8363
- // lib/components/primitive-components/Port/areAllPcbPrimitivesOverlapping.ts
8364
- var areAllPcbPrimitivesOverlapping = (pcbPrimitives) => {
8365
- if (pcbPrimitives.length <= 1) return true;
8366
- const bounds = pcbPrimitives.map((p) => {
8367
- const circuitBounds = p._getPcbCircuitJsonBounds();
8368
- return {
8369
- left: circuitBounds.bounds.left,
8370
- right: circuitBounds.bounds.right,
8371
- top: circuitBounds.bounds.top,
8372
- bottom: circuitBounds.bounds.bottom
8373
- };
8374
- });
8375
- const overlaps = Array(bounds.length).fill(false).map(() => Array(bounds.length).fill(false));
8376
- for (let i = 0; i < bounds.length; i++) {
8377
- for (let j = i + 1; j < bounds.length; j++) {
8378
- const a = bounds[i];
8379
- const b = bounds[j];
8380
- overlaps[i][j] = overlaps[j][i] = !(a.right < b.left || a.left > b.right || a.bottom > b.top || a.top < b.bottom);
8381
- }
8382
- }
8383
- const visited = /* @__PURE__ */ new Set();
8384
- const dfs = (node) => {
8385
- visited.add(node);
8386
- for (let i = 0; i < bounds.length; i++) {
8387
- if (overlaps[node][i] && !visited.has(i)) {
8388
- dfs(i);
8389
- }
8390
- }
8391
- };
8392
- dfs(0);
8393
- return visited.size === bounds.length;
8394
- };
8395
-
8396
8482
  // lib/components/primitive-components/Port/getCenterOfPcbPrimitives.ts
8397
8483
  var getCenterOfPcbPrimitives = (pcbPrimitives) => {
8398
8484
  if (pcbPrimitives.length === 0) {
@@ -10384,6 +10470,21 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
10384
10470
  invalidPinLabelsMessages = messages;
10385
10471
  }
10386
10472
  super(filteredProps);
10473
+ if (filteredProps.pinLabels && !Array.isArray(filteredProps.pinLabels)) {
10474
+ const invalidPinKey = Object.keys(filteredProps.pinLabels).find(
10475
+ (pinKey) => getPinNumberFromPinLabelsKey(pinKey) === null
10476
+ );
10477
+ if (invalidPinKey) {
10478
+ throw new InvalidProps(this.lowercaseComponentName, this.props, {
10479
+ _errors: [],
10480
+ pinLabels: {
10481
+ _errors: [
10482
+ `Invalid pinLabels key "${invalidPinKey}". Expected "pin\${number}" (e.g. pin1, pin2).`
10483
+ ]
10484
+ }
10485
+ });
10486
+ }
10487
+ }
10387
10488
  this._invalidPinLabelMessages = invalidPinLabelsMessages;
10388
10489
  this._addChildrenFromStringFootprint();
10389
10490
  this.initPorts();
@@ -10476,21 +10577,26 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
10476
10577
  }
10477
10578
  const pinLabels = this._parsedProps.pinLabels;
10478
10579
  if (pinLabels) {
10479
- for (let [pinNumber, label] of Object.entries(pinLabels)) {
10480
- pinNumber = pinNumber.replace("pin", "");
10580
+ for (const [pinKey, label] of Object.entries(pinLabels)) {
10581
+ const pinNumber = getPinNumberFromPinLabelsKey(pinKey);
10582
+ if (pinNumber === null) {
10583
+ throw new Error(
10584
+ `Invalid pinLabels key "${pinKey}". Expected "pin\${number}" (e.g. pin1, pin2).`
10585
+ );
10586
+ }
10481
10587
  let existingPort = portsToCreate.find(
10482
- (p) => p._parsedProps.pinNumber === Number(pinNumber)
10588
+ (p) => p._parsedProps.pinNumber === pinNumber
10483
10589
  );
10484
10590
  const primaryLabel = Array.isArray(label) ? label[0] : label;
10485
10591
  const otherLabels = Array.isArray(label) ? label.slice(1) : [];
10486
10592
  if (!existingPort) {
10487
10593
  existingPort = new Port(
10488
10594
  {
10489
- pinNumber: parseInt(pinNumber),
10595
+ pinNumber,
10490
10596
  name: primaryLabel,
10491
10597
  aliases: [
10492
10598
  ...otherLabels,
10493
- ...opts.additionalAliases?.[`pin${parseInt(pinNumber)}`] ?? []
10599
+ ...opts.additionalAliases?.[`pin${pinNumber}`] ?? []
10494
10600
  ]
10495
10601
  },
10496
10602
  {
@@ -11274,7 +11380,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
11274
11380
  if (Array.isArray(pinLabels)) {
11275
11381
  return pinLabels.length;
11276
11382
  }
11277
- const pinNumbers = Object.keys(pinLabels).map((k) => k.startsWith("pin") ? parseInt(k.slice(3)) : parseInt(k)).filter((n) => !Number.isNaN(n));
11383
+ const pinNumbers = Object.keys(pinLabels).map((k) => getPinNumberFromPinLabelsKey(k)).filter((n) => n !== null && !Number.isNaN(n));
11278
11384
  if (pinNumbers.length > 0) {
11279
11385
  return Math.max(...pinNumbers);
11280
11386
  }
@@ -11903,6 +12009,32 @@ var inflateFootprintComponent = (pcbElm, inflatorContext) => {
11903
12009
  return footprint;
11904
12010
  };
11905
12011
 
12012
+ // lib/components/primitive-components/Group/Subcircuit/inflators/getInflatedPcbPlacement.ts
12013
+ var getInflatedPcbPlacement = ({
12014
+ pcbComponent,
12015
+ sourceGroupId,
12016
+ inflatorContext
12017
+ }) => {
12018
+ if (!pcbComponent?.center) {
12019
+ return { pcbX: void 0, pcbY: void 0 };
12020
+ }
12021
+ if (sourceGroupId) {
12022
+ const parentPcbGroup = inflatorContext.injectionDb.pcb_group.getWhere({
12023
+ source_group_id: sourceGroupId
12024
+ });
12025
+ if (parentPcbGroup?.anchor_position) {
12026
+ return {
12027
+ pcbX: pcbComponent.center.x - parentPcbGroup.anchor_position.x,
12028
+ pcbY: pcbComponent.center.y - parentPcbGroup.anchor_position.y
12029
+ };
12030
+ }
12031
+ }
12032
+ return {
12033
+ pcbX: pcbComponent.center.x,
12034
+ pcbY: pcbComponent.center.y
12035
+ };
12036
+ };
12037
+
11906
12038
  // lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceCapacitor.ts
11907
12039
  function inflateSourceCapacitor(sourceElm, inflatorContext) {
11908
12040
  const { injectionDb, subcircuit, groupsMap } = inflatorContext;
@@ -11912,12 +12044,17 @@ function inflateSourceCapacitor(sourceElm, inflatorContext) {
11912
12044
  const cadElm = injectionDb.cad_component.getWhere({
11913
12045
  source_component_id: sourceElm.source_component_id
11914
12046
  });
12047
+ const { pcbX, pcbY } = getInflatedPcbPlacement({
12048
+ pcbComponent: pcbElm,
12049
+ sourceGroupId: sourceElm.source_group_id,
12050
+ inflatorContext
12051
+ });
11915
12052
  const capacitor = new Capacitor({
11916
12053
  name: sourceElm.name,
11917
12054
  capacitance: sourceElm.capacitance,
11918
12055
  layer: pcbElm?.layer,
11919
- pcbX: pcbElm?.center?.x,
11920
- pcbY: pcbElm?.center?.y,
12056
+ pcbX,
12057
+ pcbY,
11921
12058
  pcbRotation: pcbElm?.rotation,
11922
12059
  doNotPlace: pcbElm?.do_not_place,
11923
12060
  obstructsWithinBounds: pcbElm?.obstructs_within_bounds
@@ -12150,6 +12287,11 @@ var inflateSourceChip = (sourceElm, inflatorContext) => {
12150
12287
  inflatorContext
12151
12288
  );
12152
12289
  const footprinterString = cadElm?.footprinter_string ?? null;
12290
+ const { pcbX, pcbY } = getInflatedPcbPlacement({
12291
+ pcbComponent: pcbElm,
12292
+ sourceGroupId: sourceElm.source_group_id,
12293
+ inflatorContext
12294
+ });
12153
12295
  const chip = new Chip({
12154
12296
  name: sourceElm.name,
12155
12297
  manufacturerPartNumber: sourceElm.manufacturer_part_number,
@@ -12161,8 +12303,8 @@ var inflateSourceChip = (sourceElm, inflatorContext) => {
12161
12303
  schX: schematicElm?.center?.x,
12162
12304
  schY: schematicElm?.center?.y,
12163
12305
  layer: pcbElm?.layer,
12164
- pcbX: pcbElm?.center?.x,
12165
- pcbY: pcbElm?.center?.y,
12306
+ pcbX,
12307
+ pcbY,
12166
12308
  pcbRotation: pcbElm?.rotation,
12167
12309
  doNotPlace: pcbElm?.do_not_place,
12168
12310
  obstructsWithinBounds: pcbElm?.obstructs_within_bounds,
@@ -12243,11 +12385,16 @@ function inflateSourceDiode(sourceElm, inflatorContext) {
12243
12385
  const cadElm = injectionDb.cad_component.getWhere({
12244
12386
  source_component_id: sourceElm.source_component_id
12245
12387
  });
12388
+ const { pcbX, pcbY } = getInflatedPcbPlacement({
12389
+ pcbComponent: pcbElm,
12390
+ sourceGroupId: sourceElm.source_group_id,
12391
+ inflatorContext
12392
+ });
12246
12393
  const diode = new Diode({
12247
12394
  name: sourceElm.name,
12248
12395
  layer: pcbElm?.layer,
12249
- pcbX: pcbElm?.center?.x,
12250
- pcbY: pcbElm?.center?.y,
12396
+ pcbX,
12397
+ pcbY,
12251
12398
  pcbRotation: pcbElm?.rotation,
12252
12399
  doNotPlace: pcbElm?.do_not_place,
12253
12400
  obstructsWithinBounds: pcbElm?.obstructs_within_bounds
@@ -18195,10 +18342,31 @@ var Group6 = class extends NormalComponent3 {
18195
18342
 
18196
18343
  // lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceGroup.ts
18197
18344
  function inflateSourceGroup(sourceGroup, inflatorContext) {
18198
- const { subcircuit, groupsMap } = inflatorContext;
18199
- const group = new Group6({
18200
- name: sourceGroup.name ?? `inflated_group_${sourceGroup.source_group_id}`
18345
+ const { injectionDb, subcircuit, groupsMap } = inflatorContext;
18346
+ const pcbGroup = injectionDb.pcb_group.getWhere({
18347
+ source_group_id: sourceGroup.source_group_id
18201
18348
  });
18349
+ const groupProps2 = {
18350
+ name: sourceGroup.name ?? `inflated_group_${sourceGroup.source_group_id}`
18351
+ };
18352
+ if (pcbGroup?.position_mode === "relative_to_group_anchor" && pcbGroup.anchor_position) {
18353
+ let baseAnchor = { x: 0, y: 0 };
18354
+ if (sourceGroup.parent_source_group_id) {
18355
+ const parentPcbGroup = injectionDb.pcb_group.getWhere({
18356
+ source_group_id: sourceGroup.parent_source_group_id
18357
+ });
18358
+ if (parentPcbGroup?.anchor_position) {
18359
+ baseAnchor = parentPcbGroup.anchor_position;
18360
+ }
18361
+ }
18362
+ groupProps2.pcbX = pcbGroup.anchor_position.x - baseAnchor.x;
18363
+ groupProps2.pcbY = pcbGroup.anchor_position.y - baseAnchor.y;
18364
+ }
18365
+ if (pcbGroup?.anchor_alignment) {
18366
+ groupProps2.pcbAnchorAlignment = pcbGroup.anchor_alignment;
18367
+ }
18368
+ const group = new Group6(groupProps2);
18369
+ group._isInflatedFromCircuitJson = true;
18202
18370
  group.source_group_id = sourceGroup.source_group_id;
18203
18371
  if (groupsMap) {
18204
18372
  groupsMap.set(sourceGroup.source_group_id, group);
@@ -18261,12 +18429,17 @@ function inflateSourceInductor(sourceElm, inflatorContext) {
18261
18429
  const cadElm = injectionDb.cad_component.getWhere({
18262
18430
  source_component_id: sourceElm.source_component_id
18263
18431
  });
18432
+ const { pcbX, pcbY } = getInflatedPcbPlacement({
18433
+ pcbComponent: pcbElm,
18434
+ sourceGroupId: sourceElm.source_group_id,
18435
+ inflatorContext
18436
+ });
18264
18437
  const inductor = new Inductor({
18265
18438
  name: sourceElm.name,
18266
18439
  inductance: sourceElm.inductance,
18267
18440
  layer: pcbElm?.layer,
18268
- pcbX: pcbElm?.center?.x,
18269
- pcbY: pcbElm?.center?.y,
18441
+ pcbX,
18442
+ pcbY,
18270
18443
  pcbRotation: pcbElm?.rotation,
18271
18444
  doNotPlace: pcbElm?.do_not_place,
18272
18445
  obstructsWithinBounds: pcbElm?.obstructs_within_bounds
@@ -18395,11 +18568,16 @@ function inflateSourcePushButton(sourceElm, inflatorContext) {
18395
18568
  const cadElm = injectionDb.cad_component.getWhere({
18396
18569
  source_component_id: sourceElm.source_component_id
18397
18570
  });
18571
+ const { pcbX, pcbY } = getInflatedPcbPlacement({
18572
+ pcbComponent: pcbElm,
18573
+ sourceGroupId: sourceElm.source_group_id,
18574
+ inflatorContext
18575
+ });
18398
18576
  const pushButton = new PushButton({
18399
18577
  name: sourceElm.name,
18400
18578
  layer: pcbElm?.layer,
18401
- pcbX: pcbElm?.center?.x,
18402
- pcbY: pcbElm?.center?.y,
18579
+ pcbX,
18580
+ pcbY,
18403
18581
  pcbRotation: pcbElm?.rotation,
18404
18582
  doNotPlace: pcbElm?.do_not_place,
18405
18583
  obstructsWithinBounds: pcbElm?.obstructs_within_bounds
@@ -18511,12 +18689,17 @@ function inflateSourceResistor(sourceElm, inflatorContext) {
18511
18689
  const cadElm = injectionDb.cad_component.getWhere({
18512
18690
  source_component_id: sourceElm.source_component_id
18513
18691
  });
18692
+ const { pcbX, pcbY } = getInflatedPcbPlacement({
18693
+ pcbComponent: pcbElm,
18694
+ sourceGroupId: sourceElm.source_group_id,
18695
+ inflatorContext
18696
+ });
18514
18697
  const resistor = new Resistor({
18515
18698
  name: sourceElm.name,
18516
18699
  resistance: sourceElm.resistance,
18517
18700
  layer: pcbElm?.layer,
18518
- pcbX: pcbElm?.center?.x,
18519
- pcbY: pcbElm?.center?.y,
18701
+ pcbX,
18702
+ pcbY,
18520
18703
  pcbRotation: pcbElm?.rotation,
18521
18704
  doNotPlace: pcbElm?.do_not_place,
18522
18705
  obstructsWithinBounds: pcbElm?.obstructs_within_bounds
@@ -18702,12 +18885,17 @@ function inflateSourceTransistor(sourceElm, inflatorContext) {
18702
18885
  const cadElm = injectionDb.cad_component.getWhere({
18703
18886
  source_component_id: sourceElm.source_component_id
18704
18887
  });
18888
+ const { pcbX, pcbY } = getInflatedPcbPlacement({
18889
+ pcbComponent: pcbElm,
18890
+ sourceGroupId: sourceElm.source_group_id,
18891
+ inflatorContext
18892
+ });
18705
18893
  const transistor = new Transistor({
18706
18894
  name: sourceElm.name,
18707
18895
  type: sourceElm.transistor_type,
18708
18896
  layer: pcbElm?.layer,
18709
- pcbX: pcbElm?.center?.x,
18710
- pcbY: pcbElm?.center?.y,
18897
+ pcbX,
18898
+ pcbY,
18711
18899
  pcbRotation: pcbElm?.rotation,
18712
18900
  doNotPlace: pcbElm?.do_not_place,
18713
18901
  obstructsWithinBounds: pcbElm?.obstructs_within_bounds
@@ -18849,7 +19037,7 @@ import { identity as identity5 } from "transformation-matrix";
18849
19037
  var package_default = {
18850
19038
  name: "@tscircuit/core",
18851
19039
  type: "module",
18852
- version: "0.0.1139",
19040
+ version: "0.0.1141",
18853
19041
  types: "dist/index.d.ts",
18854
19042
  main: "dist/index.js",
18855
19043
  module: "dist/index.js",
@@ -18886,7 +19074,7 @@ var package_default = {
18886
19074
  "@tscircuit/circuit-json-util": "^0.0.90",
18887
19075
  "@tscircuit/common": "^0.0.20",
18888
19076
  "@tscircuit/copper-pour-solver": "^0.0.20",
18889
- "@tscircuit/footprinter": "^0.0.336",
19077
+ "@tscircuit/footprinter": "^0.0.338",
18890
19078
  "@tscircuit/infer-cable-insertion-point": "^0.0.2",
18891
19079
  "@tscircuit/infgrid-ijump-astar": "^0.0.35",
18892
19080
  "@tscircuit/log-soup": "^1.0.2",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1140",
4
+ "version": "0.0.1142",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -38,7 +38,7 @@
38
38
  "@tscircuit/circuit-json-util": "^0.0.90",
39
39
  "@tscircuit/common": "^0.0.20",
40
40
  "@tscircuit/copper-pour-solver": "^0.0.20",
41
- "@tscircuit/footprinter": "^0.0.336",
41
+ "@tscircuit/footprinter": "^0.0.338",
42
42
  "@tscircuit/infer-cable-insertion-point": "^0.0.2",
43
43
  "@tscircuit/infgrid-ijump-astar": "^0.0.35",
44
44
  "@tscircuit/log-soup": "^1.0.2",