@tscircuit/core 0.0.730 → 0.0.732

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.js CHANGED
@@ -1816,6 +1816,9 @@ var SmtPad = class extends PrimitiveComponent2 {
1816
1816
  const maxY = Math.max(...ys);
1817
1817
  return { width: maxX - minX, height: maxY - minY };
1818
1818
  }
1819
+ if (props.shape === "pill") {
1820
+ return { width: props.width, height: props.height };
1821
+ }
1819
1822
  throw new Error(
1820
1823
  `getPcbSize for shape "${props.shape}" not implemented for ${this.componentName}`
1821
1824
  );
@@ -1949,6 +1952,23 @@ var SmtPad = class extends PrimitiveComponent2 {
1949
1952
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
1950
1953
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
1951
1954
  });
1955
+ } else if (props.shape === "pill") {
1956
+ pcb_smtpad = db.pcb_smtpad.insert({
1957
+ pcb_component_id,
1958
+ pcb_port_id: this.matchedPort?.pcb_port_id,
1959
+ // port likely isn't matched
1960
+ layer: maybeFlipLayer(props.layer ?? "top"),
1961
+ shape: "pill",
1962
+ x: position.x,
1963
+ y: position.y,
1964
+ radius: props.radius,
1965
+ height: props.height,
1966
+ width: props.width,
1967
+ port_hints: props.portHints.map((ph) => ph.toString()),
1968
+ is_covered_with_solder_mask: props.coveredWithSolderMask ?? false,
1969
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
1970
+ pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
1971
+ });
1952
1972
  }
1953
1973
  if (pcb_smtpad) {
1954
1974
  this.pcb_smtpad_id = pcb_smtpad.pcb_smtpad_id;
@@ -2030,6 +2050,21 @@ var SmtPad = class extends PrimitiveComponent2 {
2030
2050
  height: maxY - minY
2031
2051
  };
2032
2052
  }
2053
+ if (smtpad.shape === "pill") {
2054
+ const halfWidth = smtpad.width / 2;
2055
+ const halfHeight = smtpad.height / 2;
2056
+ return {
2057
+ center: { x: smtpad.x, y: smtpad.y },
2058
+ bounds: {
2059
+ left: smtpad.x - halfWidth,
2060
+ top: smtpad.y - halfHeight,
2061
+ right: smtpad.x + halfWidth,
2062
+ bottom: smtpad.y + halfHeight
2063
+ },
2064
+ width: smtpad.width,
2065
+ height: smtpad.height
2066
+ };
2067
+ }
2033
2068
  throw new Error(
2034
2069
  `circuitJson bounds calculation not implemented for shape "${smtpad.shape}"`
2035
2070
  );
@@ -3260,6 +3295,23 @@ var Port = class extends PrimitiveComponent2 {
3260
3295
  ])
3261
3296
  );
3262
3297
  }
3298
+ _getMatchingPinAttributes() {
3299
+ const pinAttributes = this.parent?._parsedProps?.pinAttributes;
3300
+ if (!pinAttributes) return [];
3301
+ const matches = [];
3302
+ for (const alias of this.getNameAndAliases()) {
3303
+ const attributes = pinAttributes[alias];
3304
+ if (attributes) {
3305
+ matches.push(attributes);
3306
+ }
3307
+ }
3308
+ return matches;
3309
+ }
3310
+ _shouldIncludeInBoardPinout() {
3311
+ return this._getMatchingPinAttributes().some(
3312
+ (attributes) => attributes.includeInBoardPinout === true
3313
+ );
3314
+ }
3263
3315
  isMatchingPort(port) {
3264
3316
  return this.isMatchingAnyOf(port.getNameAndAliases());
3265
3317
  }
@@ -3335,11 +3387,13 @@ var Port = class extends PrimitiveComponent2 {
3335
3387
  }
3336
3388
  if (matchCenter) {
3337
3389
  const subcircuit = this.getSubcircuit();
3390
+ const isBoardPinout = this._shouldIncludeInBoardPinout();
3338
3391
  const pcb_port = db.pcb_port.insert({
3339
3392
  pcb_component_id: this.parent?.pcb_component_id,
3340
3393
  layers: this.getAvailablePcbLayers(),
3341
3394
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
3342
3395
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
3396
+ ...isBoardPinout ? { is_board_pinout: true } : {},
3343
3397
  ...matchCenter,
3344
3398
  source_port_id: this.source_port_id
3345
3399
  });
@@ -3371,11 +3425,13 @@ var Port = class extends PrimitiveComponent2 {
3371
3425
  }
3372
3426
  if (!matchCenter) return;
3373
3427
  const subcircuit = this.getSubcircuit();
3428
+ const isBoardPinout = this._shouldIncludeInBoardPinout();
3374
3429
  const pcb_port = db.pcb_port.insert({
3375
3430
  pcb_component_id: this.parent?.pcb_component_id,
3376
3431
  layers: this.getAvailablePcbLayers(),
3377
3432
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
3378
3433
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
3434
+ ...isBoardPinout ? { is_board_pinout: true } : {},
3379
3435
  ...matchCenter,
3380
3436
  source_port_id: this.source_port_id
3381
3437
  });
@@ -3430,7 +3486,6 @@ var Port = class extends PrimitiveComponent2 {
3430
3486
  } else if (labelHints.length > 0) {
3431
3487
  bestDisplayPinLabel = labelHints[0];
3432
3488
  }
3433
- const pinAttributes = this.parent?._parsedProps?.pinAttributes;
3434
3489
  const schematicPortInsertProps = {
3435
3490
  type: "schematic_port",
3436
3491
  schematic_component_id: this.parent?.schematic_component_id,
@@ -3444,17 +3499,12 @@ var Port = class extends PrimitiveComponent2 {
3444
3499
  display_pin_label: bestDisplayPinLabel,
3445
3500
  is_connected: false
3446
3501
  };
3447
- if (pinAttributes) {
3448
- for (const alias of this.getNameAndAliases()) {
3449
- if (pinAttributes[alias]) {
3450
- const attributes = pinAttributes[alias];
3451
- if (attributes.requiresPower) {
3452
- schematicPortInsertProps.has_input_arrow = true;
3453
- }
3454
- if (attributes.providesPower) {
3455
- schematicPortInsertProps.has_output_arrow = true;
3456
- }
3457
- }
3502
+ for (const attributes of this._getMatchingPinAttributes()) {
3503
+ if (attributes.requiresPower) {
3504
+ schematicPortInsertProps.has_input_arrow = true;
3505
+ }
3506
+ if (attributes.providesPower) {
3507
+ schematicPortInsertProps.has_output_arrow = true;
3458
3508
  }
3459
3509
  }
3460
3510
  const schematic_port = db.schematic_port.insert(schematicPortInsertProps);
@@ -8175,6 +8225,7 @@ var applySchematicEditEventsToManualEditsFile = ({
8175
8225
  schematic_component_id
8176
8226
  );
8177
8227
  if (!schematic_component2) continue;
8228
+ if (!schematic_component2.source_component_id) continue;
8178
8229
  const source_component = su2(circuitJson).source_component.get(
8179
8230
  schematic_component2.source_component_id
8180
8231
  );
@@ -15248,7 +15299,7 @@ import { identity as identity6 } from "transformation-matrix";
15248
15299
  var package_default = {
15249
15300
  name: "@tscircuit/core",
15250
15301
  type: "module",
15251
- version: "0.0.729",
15302
+ version: "0.0.731",
15252
15303
  types: "dist/index.d.ts",
15253
15304
  main: "dist/index.js",
15254
15305
  module: "dist/index.js",
@@ -15287,7 +15338,7 @@ var package_default = {
15287
15338
  "@tscircuit/matchpack": "^0.0.16",
15288
15339
  "@tscircuit/math-utils": "^0.0.21",
15289
15340
  "@tscircuit/miniflex": "^0.0.4",
15290
- "@tscircuit/props": "0.0.324",
15341
+ "@tscircuit/props": "0.0.326",
15291
15342
  "@tscircuit/schematic-autolayout": "^0.0.6",
15292
15343
  "@tscircuit/schematic-match-adapt": "^0.0.16",
15293
15344
  "@tscircuit/schematic-trace-solver": "^0.0.37",
@@ -15301,7 +15352,7 @@ var package_default = {
15301
15352
  "bun-match-svg": "0.0.12",
15302
15353
  "calculate-elbow": "^0.0.12",
15303
15354
  "chokidar-cli": "^3.0.0",
15304
- "circuit-json": "^0.0.253",
15355
+ "circuit-json": "^0.0.255",
15305
15356
  "circuit-json-to-bpc": "^0.0.13",
15306
15357
  "circuit-json-to-connectivity-map": "^0.0.22",
15307
15358
  "circuit-json-to-simple-3d": "^0.0.8",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.730",
4
+ "version": "0.0.732",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -40,7 +40,7 @@
40
40
  "@tscircuit/matchpack": "^0.0.16",
41
41
  "@tscircuit/math-utils": "^0.0.21",
42
42
  "@tscircuit/miniflex": "^0.0.4",
43
- "@tscircuit/props": "0.0.324",
43
+ "@tscircuit/props": "0.0.326",
44
44
  "@tscircuit/schematic-autolayout": "^0.0.6",
45
45
  "@tscircuit/schematic-match-adapt": "^0.0.16",
46
46
  "@tscircuit/schematic-trace-solver": "^0.0.37",
@@ -54,7 +54,7 @@
54
54
  "bun-match-svg": "0.0.12",
55
55
  "calculate-elbow": "^0.0.12",
56
56
  "chokidar-cli": "^3.0.0",
57
- "circuit-json": "^0.0.253",
57
+ "circuit-json": "^0.0.255",
58
58
  "circuit-json-to-bpc": "^0.0.13",
59
59
  "circuit-json-to-connectivity-map": "^0.0.22",
60
60
  "circuit-json-to-simple-3d": "^0.0.8",