@tscircuit/core 0.0.1079 → 0.0.1081

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 +20 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -371,7 +371,8 @@ var asyncPhaseDependencies = {
371
371
  CadModelRender: ["PcbFootprintStringRender"],
372
372
  PartsEngineRender: ["PcbFootprintStringRender"],
373
373
  PcbComponentAnchorAlignment: ["PcbFootprintStringRender"],
374
- PcbCalcPlacementResolution: ["PcbFootprintStringRender"]
374
+ PcbCalcPlacementResolution: ["PcbFootprintStringRender"],
375
+ SourceTraceRender: ["PcbFootprintStringRender"]
375
376
  };
376
377
  var globalRenderCounter = 0;
377
378
  var globalAsyncEffectCounter = 0;
@@ -4437,9 +4438,22 @@ function Trace__findConnectedPorts(trace) {
4437
4438
  const { _parsedProps: props, parent } = trace;
4438
4439
  if (!parent) throw new Error("Trace has no parent");
4439
4440
  const portSelectors = trace.getTracePortPathSelectors();
4441
+ const resolveImplicitSinglePort = (selector) => {
4442
+ const hasExplicitPortToken = selector.lastIndexOf(".") > selector.lastIndexOf(" ");
4443
+ if (hasExplicitPortToken) return null;
4444
+ let targetComponent = trace.getSubcircuit().selectOne(selector);
4445
+ if (!targetComponent && !/[.#\[]/.test(selector)) {
4446
+ targetComponent = trace.getSubcircuit().selectOne(`.${selector}`);
4447
+ }
4448
+ if (!targetComponent) return null;
4449
+ const ports = targetComponent.children.filter(
4450
+ (c) => c.componentName === "Port"
4451
+ );
4452
+ return ports.length === 1 ? ports[0] : null;
4453
+ };
4440
4454
  const portsWithSelectors = portSelectors.map((selector) => ({
4441
4455
  selector,
4442
- port: trace.getSubcircuit().selectOne(selector, { type: "port" }) ?? null
4456
+ port: trace.getSubcircuit().selectOne(selector, { type: "port" }) ?? resolveImplicitSinglePort(selector)
4443
4457
  }));
4444
4458
  for (const { selector, port } of portsWithSelectors) {
4445
4459
  if (!port) {
@@ -10595,7 +10609,9 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
10595
10609
  }
10596
10610
  getPortsFromFootprint(opts) {
10597
10611
  let { footprint } = this.props;
10598
- if (!footprint || isValidElement(footprint)) {
10612
+ if (typeof footprint === "string" && parseLibraryFootprintRef(footprint) && this.children.some((c) => c.componentName === "Footprint")) {
10613
+ footprint = this.children.find((c) => c.componentName === "Footprint");
10614
+ } else if (!footprint || isValidElement(footprint)) {
10599
10615
  footprint = this.children.find((c) => c.componentName === "Footprint");
10600
10616
  }
10601
10617
  if (typeof footprint === "string") {
@@ -18118,7 +18134,7 @@ import { identity as identity5 } from "transformation-matrix";
18118
18134
  var package_default = {
18119
18135
  name: "@tscircuit/core",
18120
18136
  type: "module",
18121
- version: "0.0.1078",
18137
+ version: "0.0.1080",
18122
18138
  types: "dist/index.d.ts",
18123
18139
  main: "dist/index.js",
18124
18140
  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.1079",
4
+ "version": "0.0.1081",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",