@tscircuit/core 0.0.124 → 0.0.126

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 +22 -4
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -43,6 +43,7 @@ __export(components_exports, {
43
43
  // lib/components/base-components/NormalComponent.ts
44
44
  import { fp } from "@tscircuit/footprinter";
45
45
  import { point3, rotation } from "circuit-json";
46
+ import Debug2 from "debug";
46
47
 
47
48
  // lib/fiber/create-instance-from-react-element.ts
48
49
  import ReactReconciler from "react-reconciler";
@@ -1477,7 +1478,8 @@ var Port = class extends PrimitiveComponent {
1477
1478
  };
1478
1479
  }
1479
1480
  constructor(props, opts = {}) {
1480
- if (!props.name && props.pinNumber) props.name = `pin${props.pinNumber}`;
1481
+ if (!props.name && props.pinNumber !== void 0)
1482
+ props.name = `pin${props.pinNumber}`;
1481
1483
  if (!props.name) {
1482
1484
  throw new Error("Port must have a name or a pinNumber");
1483
1485
  }
@@ -1903,7 +1905,6 @@ var Footprint = class extends PrimitiveComponent {
1903
1905
  };
1904
1906
 
1905
1907
  // lib/components/base-components/NormalComponent.ts
1906
- import Debug2 from "debug";
1907
1908
  var debug2 = Debug2("tscircuit:core");
1908
1909
  var rotation3 = z4.object({
1909
1910
  x: rotation,
@@ -1954,6 +1955,23 @@ var NormalComponent = class extends PrimitiveComponent {
1954
1955
  }
1955
1956
  }
1956
1957
  }
1958
+ const sides = ["left", "right", "top", "bottom"];
1959
+ let pinNum = 1;
1960
+ for (const side of sides) {
1961
+ const size = schPortArrangement[`${side}Size`];
1962
+ for (let i = 0; i < size; i++) {
1963
+ portsToCreate.push(
1964
+ new Port(
1965
+ {
1966
+ pinNumber: pinNum++
1967
+ },
1968
+ {
1969
+ originDescription: `schPortArrangement:${side}`
1970
+ }
1971
+ )
1972
+ );
1973
+ }
1974
+ }
1957
1975
  }
1958
1976
  const pinLabels = this._parsedProps.pinLabels;
1959
1977
  if (pinLabels) {
@@ -3537,14 +3555,14 @@ var Chip = class extends NormalComponent {
3537
3555
  doInitialSchematicComponentRender() {
3538
3556
  const { db } = this.root;
3539
3557
  const { _parsedProps: props } = this;
3540
- const ports = this.children.filter((child) => child instanceof Port);
3558
+ const pinCount = (props.schPortArrangement?.leftSize ?? 0) + (props.schPortArrangement?.rightSize ?? 0) + (props.schPortArrangement?.topSize ?? 0) + (props.schPortArrangement?.bottomSize ?? 0);
3541
3559
  const pinSpacing = props.schPinSpacing ?? 0.2;
3542
3560
  const dimensions = getAllDimensionsForSchematicBox({
3543
3561
  schWidth: props.schWidth,
3544
3562
  schHeight: props.schHeight,
3545
3563
  schPinSpacing: pinSpacing,
3546
3564
  schPinStyle: props.schPinStyle,
3547
- pinCount: ports.length,
3565
+ pinCount,
3548
3566
  // @ts-ignore there's a subtley in the definition difference with
3549
3567
  // leftSide/rightSide/topSide/bottomSide in how the direction is defined
3550
3568
  // that doesn't really matter
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.124",
4
+ "version": "0.0.126",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -43,7 +43,7 @@
43
43
  "@tscircuit/soup-util": "^0.0.33",
44
44
  "circuit-json": "^0.0.86",
45
45
  "circuit-json-to-connectivity-map": "^0.0.17",
46
- "circuit-to-svg": "0.0.41",
46
+ "circuit-to-svg": "0.0.43",
47
47
  "nanoid": "^5.0.7",
48
48
  "performance-now": "^2.1.0",
49
49
  "react": "^18.3.1",