@tscircuit/core 0.0.502 → 0.0.503

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
@@ -4976,6 +4976,7 @@ declare class Jumper<PinLabels extends string = never> extends NormalComponent<t
4976
4976
 
4977
4977
  declare class SolderJumper<PinLabels extends string = never> extends NormalComponent<typeof solderjumperProps, PinLabels> {
4978
4978
  schematicDimensions: SchematicBoxDimensions | null;
4979
+ _getPinNumberFromBridgedPinName(pinName: string): number | null;
4979
4980
  get defaultInternallyConnectedPinNames(): string[][];
4980
4981
  get config(): {
4981
4982
  schematicSymbolName: string;
package/dist/index.js CHANGED
@@ -8690,27 +8690,42 @@ var Jumper = class extends NormalComponent {
8690
8690
  import { solderjumperProps } from "@tscircuit/props";
8691
8691
  var SolderJumper = class extends NormalComponent {
8692
8692
  schematicDimensions = null;
8693
+ _getPinNumberFromBridgedPinName(pinName) {
8694
+ const port = this.selectOne(`port.${pinName}`, {
8695
+ type: "port"
8696
+ });
8697
+ return port?._parsedProps.pinNumber ?? null;
8698
+ }
8693
8699
  get defaultInternallyConnectedPinNames() {
8694
8700
  return this._parsedProps.bridgedPins ?? [];
8695
8701
  }
8696
8702
  get config() {
8697
- let resolvedPinCount = this.props.pinCount;
8703
+ const props = this._parsedProps ?? this.props;
8704
+ let resolvedPinCount = props.pinCount;
8698
8705
  if (!resolvedPinCount) {
8699
- const nums = (this.props.bridgedPins ?? []).flat().map((p) => {
8700
- if (typeof p === "number") return p;
8701
- if (p.startsWith("pin")) return Number(p.slice(3));
8702
- return Number(p);
8703
- }).filter((n) => !Number.isNaN(n));
8704
- const maxPin = nums.length > 0 ? Math.max(...nums) : 0;
8705
- if (maxPin === 2 || maxPin === 3) {
8706
- resolvedPinCount = maxPin;
8706
+ const nums = (props.bridgedPins ?? []).flat().map((p_str) => this._getPinNumberFromBridgedPinName(p_str)).filter((n) => n !== null);
8707
+ const maxPinFromBridged = nums.length > 0 ? Math.max(...nums) : 0;
8708
+ const pinCountFromLabels = props.pinLabels ? Object.keys(props.pinLabels).length : 0;
8709
+ const finalPinCount = Math.max(maxPinFromBridged, pinCountFromLabels);
8710
+ if (finalPinCount === 2 || finalPinCount === 3) {
8711
+ resolvedPinCount = finalPinCount;
8707
8712
  }
8708
8713
  }
8709
8714
  let symbolName = "";
8710
- if (resolvedPinCount) symbolName += `solderjumper${resolvedPinCount}`;
8711
- if (Array.isArray(this.props.bridgedPins) && this.props.bridgedPins.length > 0) {
8712
- const pins = Array.from(new Set(this.props.bridgedPins.flat())).sort().join("");
8713
- symbolName += `_bridged${pins}`;
8715
+ if (resolvedPinCount) {
8716
+ symbolName += `solderjumper${resolvedPinCount}`;
8717
+ } else {
8718
+ symbolName = "solderjumper";
8719
+ }
8720
+ if (Array.isArray(props.bridgedPins) && props.bridgedPins.length > 0) {
8721
+ const pinNumbers = Array.from(
8722
+ new Set(
8723
+ props.bridgedPins.flat().map((pinName) => this._getPinNumberFromBridgedPinName(pinName)).filter((n) => n !== null)
8724
+ )
8725
+ ).sort((a, b) => a - b);
8726
+ if (pinNumbers.length > 0) {
8727
+ symbolName += `_bridged${pinNumbers.join("")}`;
8728
+ }
8714
8729
  }
8715
8730
  return {
8716
8731
  schematicSymbolName: symbolName,
@@ -10390,7 +10405,7 @@ import { identity as identity4 } from "transformation-matrix";
10390
10405
  var package_default = {
10391
10406
  name: "@tscircuit/core",
10392
10407
  type: "module",
10393
- version: "0.0.501",
10408
+ version: "0.0.502",
10394
10409
  types: "dist/index.d.ts",
10395
10410
  main: "dist/index.js",
10396
10411
  module: "dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.502",
4
+ "version": "0.0.503",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",