@tscircuit/core 0.0.1135 → 0.0.1137

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 +39 -24
  2. package/package.json +2 -2
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++;
@@ -12369,12 +12377,19 @@ var TscircuitAutorouter = class {
12369
12377
  if (this.isRouting) return;
12370
12378
  this.isRouting = true;
12371
12379
  this.cycleCount = 0;
12372
- this.runCycleAndQueueNextCycle();
12380
+ void this.runCycleAndQueueNextCycle();
12381
+ }
12382
+ async stepSolver() {
12383
+ if ("stepAsync" in this.solver && typeof this.solver.stepAsync === "function") {
12384
+ await this.solver.stepAsync();
12385
+ return;
12386
+ }
12387
+ this.solver.step();
12373
12388
  }
12374
12389
  /**
12375
12390
  * Execute the next routing step and schedule the following one if needed
12376
12391
  */
12377
- runCycleAndQueueNextCycle() {
12392
+ async runCycleAndQueueNextCycle() {
12378
12393
  if (!this.isRouting) return;
12379
12394
  try {
12380
12395
  if (this.solver.solved || this.solver.failed) {
@@ -12395,7 +12410,7 @@ var TscircuitAutorouter = class {
12395
12410
  const startTime = Date.now();
12396
12411
  const startIterations = this.solver.iterations;
12397
12412
  while (Date.now() - startTime < 250 && !this.solver.failed && !this.solver.solved) {
12398
- this.solver.step();
12413
+ await this.stepSolver();
12399
12414
  }
12400
12415
  const iterationsPerSecond = (this.solver.iterations - startIterations) / (Date.now() - startTime) * 1e3;
12401
12416
  this.cycleCount++;
@@ -12411,12 +12426,12 @@ var TscircuitAutorouter = class {
12411
12426
  });
12412
12427
  if (this.stepDelay > 0) {
12413
12428
  this.timeoutId = setTimeout(
12414
- () => this.runCycleAndQueueNextCycle(),
12429
+ () => void this.runCycleAndQueueNextCycle(),
12415
12430
  this.stepDelay
12416
12431
  );
12417
12432
  } else {
12418
12433
  this.timeoutId = setTimeout(
12419
- () => this.runCycleAndQueueNextCycle(),
12434
+ () => void this.runCycleAndQueueNextCycle(),
12420
12435
  0
12421
12436
  );
12422
12437
  }
@@ -18730,7 +18745,7 @@ import { identity as identity5 } from "transformation-matrix";
18730
18745
  var package_default = {
18731
18746
  name: "@tscircuit/core",
18732
18747
  type: "module",
18733
- version: "0.0.1134",
18748
+ version: "0.0.1136",
18734
18749
  types: "dist/index.d.ts",
18735
18750
  main: "dist/index.js",
18736
18751
  module: "dist/index.js",
@@ -18762,7 +18777,7 @@ var package_default = {
18762
18777
  "@biomejs/biome": "^1.8.3",
18763
18778
  "@resvg/resvg-js": "^2.6.2",
18764
18779
  "@tscircuit/alphabet": "0.0.25",
18765
- "@tscircuit/capacity-autorouter": "^0.0.398",
18780
+ "@tscircuit/capacity-autorouter": "^0.0.400",
18766
18781
  "@tscircuit/checks": "0.0.115",
18767
18782
  "@tscircuit/circuit-json-util": "^0.0.90",
18768
18783
  "@tscircuit/common": "^0.0.20",
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.1137",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -33,7 +33,7 @@
33
33
  "@biomejs/biome": "^1.8.3",
34
34
  "@resvg/resvg-js": "^2.6.2",
35
35
  "@tscircuit/alphabet": "0.0.25",
36
- "@tscircuit/capacity-autorouter": "^0.0.398",
36
+ "@tscircuit/capacity-autorouter": "^0.0.400",
37
37
  "@tscircuit/checks": "0.0.115",
38
38
  "@tscircuit/circuit-json-util": "^0.0.90",
39
39
  "@tscircuit/common": "^0.0.20",