@tscircuit/core 0.0.501 → 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
@@ -7560,11 +7560,13 @@ var Group = class extends NormalComponent {
7560
7560
  name: this._parsedProps.name,
7561
7561
  is_subcircuit: this.isSubcircuit
7562
7562
  });
7563
- this.subcircuit_id = `subcircuit_${source_group.source_group_id}`;
7564
7563
  this.source_group_id = source_group.source_group_id;
7565
- db.source_group.update(source_group.source_group_id, {
7566
- subcircuit_id: this.subcircuit_id
7567
- });
7564
+ if (this.isSubcircuit) {
7565
+ this.subcircuit_id = `subcircuit_${source_group.source_group_id}`;
7566
+ db.source_group.update(source_group.source_group_id, {
7567
+ subcircuit_id: this.subcircuit_id
7568
+ });
7569
+ }
7568
7570
  }
7569
7571
  doInitialSourceRender() {
7570
7572
  const { db } = this.root;
@@ -8688,27 +8690,42 @@ var Jumper = class extends NormalComponent {
8688
8690
  import { solderjumperProps } from "@tscircuit/props";
8689
8691
  var SolderJumper = class extends NormalComponent {
8690
8692
  schematicDimensions = null;
8693
+ _getPinNumberFromBridgedPinName(pinName) {
8694
+ const port = this.selectOne(`port.${pinName}`, {
8695
+ type: "port"
8696
+ });
8697
+ return port?._parsedProps.pinNumber ?? null;
8698
+ }
8691
8699
  get defaultInternallyConnectedPinNames() {
8692
8700
  return this._parsedProps.bridgedPins ?? [];
8693
8701
  }
8694
8702
  get config() {
8695
- let resolvedPinCount = this.props.pinCount;
8703
+ const props = this._parsedProps ?? this.props;
8704
+ let resolvedPinCount = props.pinCount;
8696
8705
  if (!resolvedPinCount) {
8697
- const nums = (this.props.bridgedPins ?? []).flat().map((p) => {
8698
- if (typeof p === "number") return p;
8699
- if (p.startsWith("pin")) return Number(p.slice(3));
8700
- return Number(p);
8701
- }).filter((n) => !Number.isNaN(n));
8702
- const maxPin = nums.length > 0 ? Math.max(...nums) : 0;
8703
- if (maxPin === 2 || maxPin === 3) {
8704
- 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;
8705
8712
  }
8706
8713
  }
8707
8714
  let symbolName = "";
8708
- if (resolvedPinCount) symbolName += `solderjumper${resolvedPinCount}`;
8709
- if (Array.isArray(this.props.bridgedPins) && this.props.bridgedPins.length > 0) {
8710
- const pins = Array.from(new Set(this.props.bridgedPins.flat())).sort().join("");
8711
- 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
+ }
8712
8729
  }
8713
8730
  return {
8714
8731
  schematicSymbolName: symbolName,
@@ -10388,7 +10405,7 @@ import { identity as identity4 } from "transformation-matrix";
10388
10405
  var package_default = {
10389
10406
  name: "@tscircuit/core",
10390
10407
  type: "module",
10391
- version: "0.0.500",
10408
+ version: "0.0.502",
10392
10409
  types: "dist/index.d.ts",
10393
10410
  main: "dist/index.js",
10394
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.501",
4
+ "version": "0.0.503",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",