@tscircuit/core 0.0.1290 → 0.0.1292

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
@@ -43471,6 +43471,10 @@ declare class Interconnect extends NormalComponent<typeof interconnectProps> {
43471
43471
 
43472
43472
  declare class SolderJumper<PinLabels extends string = never> extends NormalComponent<typeof solderjumperProps, PinLabels> {
43473
43473
  schematicDimensions: SchematicBoxDimensions | null;
43474
+ private _getPinCountFromFootprintString;
43475
+ private _getPinNumberFromBridgedPinsProp;
43476
+ private _getBridgedPinNumbersForFootprint;
43477
+ resolveFootprint(): any;
43474
43478
  _getPinNumberFromBridgedPinName(pinName: string): number | null;
43475
43479
  get defaultInternallyConnectedPinNames(): string[][];
43476
43480
  get config(): {
package/dist/index.js CHANGED
@@ -22237,7 +22237,7 @@ import { identity as identity5 } from "transformation-matrix";
22237
22237
  var package_default = {
22238
22238
  name: "@tscircuit/core",
22239
22239
  type: "module",
22240
- version: "0.0.1289",
22240
+ version: "0.0.1291",
22241
22241
  types: "dist/index.d.ts",
22242
22242
  main: "dist/index.js",
22243
22243
  module: "dist/index.js",
@@ -22271,7 +22271,7 @@ var package_default = {
22271
22271
  "@tscircuit/alphabet": "0.0.25",
22272
22272
  "@tscircuit/breakout-point-solver": "github:tscircuit/breakout-point-solver#bac9629",
22273
22273
  "@tscircuit/capacity-autorouter": "^0.0.529",
22274
- "@tscircuit/checks": "0.0.136",
22274
+ "@tscircuit/checks": "0.0.137",
22275
22275
  "@tscircuit/circuit-json-util": "^0.0.95",
22276
22276
  "@tscircuit/common": "^0.0.20",
22277
22277
  "@tscircuit/copper-pour-solver": "^0.0.29",
@@ -24456,6 +24456,59 @@ var Interconnect = class extends NormalComponent3 {
24456
24456
  import { solderjumperProps } from "@tscircuit/props";
24457
24457
  var SolderJumper = class extends NormalComponent3 {
24458
24458
  schematicDimensions = null;
24459
+ _getPinCountFromFootprintString(footprint) {
24460
+ const match = footprint.match(/^solderjumper([23])(?:_|$)/);
24461
+ if (!match) return null;
24462
+ return Number(match[1]);
24463
+ }
24464
+ // Used during footprint resolution before ports can be selected.
24465
+ _getPinNumberFromBridgedPinsProp(pinName) {
24466
+ const numericPinMatch = pinName.match(/^(?:pin)?(\d+)$/i);
24467
+ if (numericPinMatch) return Number(numericPinMatch[1]);
24468
+ const pinLabels = this._parsedProps.pinLabels ?? this.props.pinLabels;
24469
+ if (Array.isArray(pinLabels)) {
24470
+ const labelIndex = pinLabels.findIndex((label) => label === pinName);
24471
+ return labelIndex >= 0 ? labelIndex + 1 : null;
24472
+ }
24473
+ if (pinLabels && typeof pinLabels === "object") {
24474
+ for (const [pinKey, labelOrLabels] of Object.entries(pinLabels)) {
24475
+ const labels = Array.isArray(labelOrLabels) ? labelOrLabels : [labelOrLabels];
24476
+ if (!labels.includes(pinName)) continue;
24477
+ const pinNumberMatch = pinKey.match(/^(?:pin)?(\d+)$/i);
24478
+ return pinNumberMatch ? Number(pinNumberMatch[1]) : null;
24479
+ }
24480
+ }
24481
+ return null;
24482
+ }
24483
+ _getBridgedPinNumbersForFootprint(pinCount) {
24484
+ const props = this._parsedProps ?? this.props;
24485
+ if (Array.isArray(props.bridgedPins) && props.bridgedPins.length > 0) {
24486
+ return Array.from(
24487
+ new Set(
24488
+ props.bridgedPins.flat().map(
24489
+ (pinName) => this._getPinNumberFromBridgedPinsProp(pinName)
24490
+ ).filter(
24491
+ (pinNumber) => pinNumber !== null && pinNumber >= 1 && pinNumber <= pinCount
24492
+ )
24493
+ )
24494
+ ).sort((a, b) => a - b);
24495
+ }
24496
+ if (!props.bridged) return [];
24497
+ return Array.from({ length: pinCount }, (_, index) => index + 1);
24498
+ }
24499
+ resolveFootprint() {
24500
+ const footprint = super.resolveFootprint();
24501
+ if (typeof footprint !== "string") return footprint;
24502
+ const pinCount = this._getPinCountFromFootprintString(footprint);
24503
+ if (!pinCount) return footprint;
24504
+ if (/_bridged\d+/.test(footprint)) return footprint;
24505
+ const bridgedPinNumbers = this._getBridgedPinNumbersForFootprint(pinCount);
24506
+ if (bridgedPinNumbers.length === 0) return footprint;
24507
+ return footprint.replace(
24508
+ /^solderjumper[23]/,
24509
+ `solderjumper${pinCount}_bridged${bridgedPinNumbers.join("")}`
24510
+ );
24511
+ }
24459
24512
  _getPinNumberFromBridgedPinName(pinName) {
24460
24513
  const port = this.selectOne(`port.${pinName}`, {
24461
24514
  type: "port"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1290",
4
+ "version": "0.0.1292",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -35,7 +35,7 @@
35
35
  "@tscircuit/alphabet": "0.0.25",
36
36
  "@tscircuit/breakout-point-solver": "github:tscircuit/breakout-point-solver#bac9629",
37
37
  "@tscircuit/capacity-autorouter": "^0.0.529",
38
- "@tscircuit/checks": "0.0.136",
38
+ "@tscircuit/checks": "0.0.137",
39
39
  "@tscircuit/circuit-json-util": "^0.0.95",
40
40
  "@tscircuit/common": "^0.0.20",
41
41
  "@tscircuit/copper-pour-solver": "^0.0.29",