@tscircuit/core 0.0.1032 → 0.0.1034

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 +33 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11240,6 +11240,7 @@ function Group_doInitialPcbCalcPlacementResolution(group) {
11240
11240
  inDegree.set(component.name, 0);
11241
11241
  }
11242
11242
  for (const [candidateName, candidate] of candidatesByName.entries()) {
11243
+ const referencedCandidateNames = /* @__PURE__ */ new Set();
11243
11244
  for (const token of candidate.refs) {
11244
11245
  const { referencePath, field } = parseComponentReferenceToken(token);
11245
11246
  if (!SUPPORTED_COMPONENT_FIELDS.has(field)) {
@@ -11254,12 +11255,15 @@ function Group_doInitialPcbCalcPlacementResolution(group) {
11254
11255
  normalComponentNameMap
11255
11256
  });
11256
11257
  if (candidatesByName.has(referencedComponentName) && referencedComponentName !== candidateName) {
11257
- inDegree.set(candidateName, (inDegree.get(candidateName) ?? 0) + 1);
11258
- if (!dependents.has(referencedComponentName)) {
11259
- dependents.set(referencedComponentName, /* @__PURE__ */ new Set());
11260
- }
11261
- dependents.get(referencedComponentName).add(candidateName);
11258
+ referencedCandidateNames.add(referencedComponentName);
11259
+ }
11260
+ }
11261
+ for (const referencedComponentName of referencedCandidateNames) {
11262
+ inDegree.set(candidateName, (inDegree.get(candidateName) ?? 0) + 1);
11263
+ if (!dependents.has(referencedComponentName)) {
11264
+ dependents.set(referencedComponentName, /* @__PURE__ */ new Set());
11262
11265
  }
11266
+ dependents.get(referencedComponentName).add(candidateName);
11263
11267
  }
11264
11268
  }
11265
11269
  const queue = [...inDegree.entries()].filter(([, degree]) => degree === 0).map(([name]) => name);
@@ -12531,7 +12535,7 @@ import { identity as identity4 } from "transformation-matrix";
12531
12535
  var package_default = {
12532
12536
  name: "@tscircuit/core",
12533
12537
  type: "module",
12534
- version: "0.0.1031",
12538
+ version: "0.0.1033",
12535
12539
  types: "dist/index.d.ts",
12536
12540
  main: "dist/index.js",
12537
12541
  module: "dist/index.js",
@@ -13463,6 +13467,21 @@ function rotateDirection(direction, degrees) {
13463
13467
  const newIndex = (currentIndex + steps) % 4;
13464
13468
  return directions[newIndex < 0 ? newIndex + 4 : newIndex];
13465
13469
  }
13470
+ function isTreeChildExplicitlyPositioned(treeChild, group) {
13471
+ if (treeChild.nodeType === "component" && treeChild.sourceComponent) {
13472
+ const component = group.children.find(
13473
+ (groupChild) => groupChild.source_component_id === treeChild.sourceComponent?.source_component_id
13474
+ );
13475
+ return component?._parsedProps?.schX !== void 0 || component?._parsedProps?.schY !== void 0;
13476
+ }
13477
+ if (treeChild.nodeType === "group" && treeChild.sourceGroup) {
13478
+ const nestedGroup = group.children.find(
13479
+ (groupChild) => groupChild.source_group_id === treeChild.sourceGroup?.source_group_id
13480
+ );
13481
+ return nestedGroup?._parsedProps?.schX !== void 0 || nestedGroup?._parsedProps?.schY !== void 0;
13482
+ }
13483
+ return false;
13484
+ }
13466
13485
  function convertTreeToInputProblem(tree, db, group) {
13467
13486
  const problem = {
13468
13487
  chipMap: {},
@@ -13478,6 +13497,12 @@ function convertTreeToInputProblem(tree, db, group) {
13478
13497
  `[${group.name}] Processing ${tree.childNodes.length} child nodes for input problem`
13479
13498
  );
13480
13499
  tree.childNodes.forEach((child, index) => {
13500
+ if (isTreeChildExplicitlyPositioned(child, group)) {
13501
+ debug6(
13502
+ `[${group.name}] Skipping explicitly positioned child ${index} from matchpack`
13503
+ );
13504
+ return;
13505
+ }
13481
13506
  debug6(
13482
13507
  `[${group.name}] Processing child ${index}: nodeType=${child.nodeType}`
13483
13508
  );
@@ -16095,6 +16120,7 @@ var Group = class extends NormalComponent3 {
16095
16120
  }
16096
16121
  _getSchematicLayoutMode() {
16097
16122
  const props = this._parsedProps;
16123
+ const schAutoLayoutEnabled = props.schAutoLayoutEnabled ?? false;
16098
16124
  if (props.schLayout?.layoutMode === "none") return "relative";
16099
16125
  if (props.schLayout?.layoutMode === "relative") return "relative";
16100
16126
  if (props.schLayout?.matchAdapt) return "match-adapt";
@@ -16113,6 +16139,7 @@ var Group = class extends NormalComponent3 {
16113
16139
  return cProps?.schX !== void 0 || cProps?.schY !== void 0;
16114
16140
  });
16115
16141
  const hasManualEdits = (props.manualEdits?.schematic_placements?.length ?? 0) > 0;
16142
+ if (schAutoLayoutEnabled && !hasManualEdits) return "match-adapt";
16116
16143
  if (!anyChildHasSchCoords && !hasManualEdits) return "match-adapt";
16117
16144
  return "relative";
16118
16145
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1032",
4
+ "version": "0.0.1034",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",