@tscircuit/core 0.0.545 → 0.0.546

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 +17 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6272,7 +6272,22 @@ var NormalComponent = class extends PrimitiveComponent2 {
6272
6272
  const pinCountFromSchematicPortArrangement = this._getPinCountFromSchematicPortArrangement();
6273
6273
  return pinCountFromSchematicPortArrangement;
6274
6274
  }
6275
- return this.getPortsFromFootprint().length;
6275
+ const portsFromFootprint = this.getPortsFromFootprint();
6276
+ if (portsFromFootprint.length > 0) {
6277
+ return portsFromFootprint.length;
6278
+ }
6279
+ const { pinLabels } = this._parsedProps;
6280
+ if (pinLabels) {
6281
+ if (Array.isArray(pinLabels)) {
6282
+ return pinLabels.length;
6283
+ }
6284
+ const pinNumbers = Object.keys(pinLabels).map((k) => k.startsWith("pin") ? parseInt(k.slice(3)) : parseInt(k)).filter((n) => !Number.isNaN(n));
6285
+ if (pinNumbers.length > 0) {
6286
+ return Math.max(...pinNumbers);
6287
+ }
6288
+ return Object.keys(pinLabels).length;
6289
+ }
6290
+ return 0;
6276
6291
  }
6277
6292
  /**
6278
6293
  * Override the schematic port arrangement if you want to customize where pins
@@ -10681,7 +10696,7 @@ import { identity as identity4 } from "transformation-matrix";
10681
10696
  var package_default = {
10682
10697
  name: "@tscircuit/core",
10683
10698
  type: "module",
10684
- version: "0.0.544",
10699
+ version: "0.0.545",
10685
10700
  types: "dist/index.d.ts",
10686
10701
  main: "dist/index.js",
10687
10702
  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.545",
4
+ "version": "0.0.546",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",