@tscircuit/core 0.0.1135 → 0.0.1136

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 +26 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10540,13 +10540,17 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
10540
10540
  const portsFromFootprint = this.getPortsFromFootprint(opts);
10541
10541
  const existingPorts = this._getAllPortsFromChildren();
10542
10542
  for (const port of portsFromFootprint) {
10543
- const alreadyInPortsToCreate = portsToCreate.some(
10543
+ const matchingPort = existingPorts.find(
10544
10544
  (p) => p.isMatchingAnyOf(port.getNameAndAliases())
10545
- );
10546
- const alreadyInExistingPorts = existingPorts.some(
10545
+ ) ?? portsToCreate.find(
10547
10546
  (p) => p.isMatchingAnyOf(port.getNameAndAliases())
10548
10547
  );
10549
- if (!alreadyInPortsToCreate && !alreadyInExistingPorts) {
10548
+ if (matchingPort) {
10549
+ const mergedAliases = port.getNameAndAliases().filter(
10550
+ (alias) => !matchingPort.getNameAndAliases().includes(alias)
10551
+ );
10552
+ matchingPort.externallyAddedAliases.push(...mergedAliases);
10553
+ } else {
10550
10554
  portsToCreate.push(port);
10551
10555
  }
10552
10556
  }
@@ -10677,16 +10681,20 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
10677
10681
  */
10678
10682
  doInitialSourceParentAttachment() {
10679
10683
  const { db } = this.root;
10680
- const internallyConnectedPorts = this._getInternallyConnectedPins();
10681
- for (const ports of internallyConnectedPorts) {
10682
- const sourcePortIds = ports.map((port) => port.source_port_id).filter((id) => id !== null);
10683
- if (sourcePortIds.length >= 2) {
10684
- db.source_component_internal_connection.insert({
10685
- source_component_id: this.source_component_id,
10686
- subcircuit_id: this.getSubcircuit()?.subcircuit_id,
10687
- source_port_ids: sourcePortIds
10688
- });
10689
- }
10684
+ const internallyConnectedSourcePortIds = this._getInternallyConnectedPins().map(
10685
+ (ports) => ports.map((port) => port.source_port_id).filter((id) => id !== null)
10686
+ ).filter((sourcePortIds) => sourcePortIds.length >= 2);
10687
+ if (this.source_component_id && internallyConnectedSourcePortIds.length > 0) {
10688
+ db.source_component.update(this.source_component_id, {
10689
+ internally_connected_source_port_ids: internallyConnectedSourcePortIds
10690
+ });
10691
+ }
10692
+ for (const sourcePortIds of internallyConnectedSourcePortIds) {
10693
+ db.source_component_internal_connection.insert({
10694
+ source_component_id: this.source_component_id,
10695
+ subcircuit_id: this.getSubcircuit()?.subcircuit_id,
10696
+ source_port_ids: sourcePortIds
10697
+ });
10690
10698
  }
10691
10699
  }
10692
10700
  /**
@@ -11160,10 +11168,10 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
11160
11168
  );
11161
11169
  if (filteredPortHints.length === 0) continue;
11162
11170
  let portHintsList = filteredPortHints;
11163
- const hasPinPrefix = portHintsList.some(
11164
- (hint) => hint.startsWith("pin")
11171
+ const hasPinIdentifier = portHintsList.some(
11172
+ (hint) => hint.startsWith("pin") || /^(?:pin)?\d+$/.test(hint)
11165
11173
  );
11166
- if (!hasPinPrefix) {
11174
+ if (!hasPinIdentifier) {
11167
11175
  portHintsList = [...portHintsList, `pin${pinNumber}`];
11168
11176
  }
11169
11177
  pinNumber++;
@@ -18730,7 +18738,7 @@ import { identity as identity5 } from "transformation-matrix";
18730
18738
  var package_default = {
18731
18739
  name: "@tscircuit/core",
18732
18740
  type: "module",
18733
- version: "0.0.1134",
18741
+ version: "0.0.1135",
18734
18742
  types: "dist/index.d.ts",
18735
18743
  main: "dist/index.js",
18736
18744
  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.1135",
4
+ "version": "0.0.1136",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",