@tscircuit/core 0.0.621 → 0.0.622

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 +16 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7964,7 +7964,7 @@ function rotateDirection(direction, degrees) {
7964
7964
  const newIndex = (currentIndex + steps) % 4;
7965
7965
  return directions[newIndex < 0 ? newIndex + 4 : newIndex];
7966
7966
  }
7967
- function convertTreeToInputProblem(tree, db) {
7967
+ function convertTreeToInputProblem(tree, db, group) {
7968
7968
  const problem = {
7969
7969
  chipMap: {},
7970
7970
  chipPinMap: {},
@@ -7983,15 +7983,24 @@ function convertTreeToInputProblem(tree, db) {
7983
7983
  source_component_id: child.sourceComponent.source_component_id
7984
7984
  });
7985
7985
  if (!schematicComponent) return;
7986
+ const component = group.children.find(
7987
+ (groupChild) => groupChild.source_component_id === child.sourceComponent?.source_component_id
7988
+ );
7989
+ let availableRotations = [0, 90, 180, 270];
7990
+ if (component?._parsedProps?.schOrientation) {
7991
+ availableRotations = [0];
7992
+ }
7993
+ if (component?._parsedProps?.schRotation !== void 0) {
7994
+ availableRotations = [0];
7995
+ }
7986
7996
  problem.chipMap[chipId] = {
7987
7997
  chipId,
7988
7998
  pins: [],
7989
7999
  size: {
7990
8000
  x: schematicComponent.size?.width || 1,
7991
8001
  y: schematicComponent.size?.height || 1
7992
- }
7993
- // TODO determine availableRotations based on the component._parsedProps.schOrientation and component._parsedProps.schRotation (if explicitly defined)
7994
- // availableRotations: [0, 90, 180, 270]
8002
+ },
8003
+ availableRotations
7995
8004
  };
7996
8005
  const ports = db.schematic_port.list({
7997
8006
  schematic_component_id: schematicComponent.schematic_component_id
@@ -8098,8 +8107,9 @@ function Group_doInitialSchematicLayoutMatchPack(group) {
8098
8107
  const tree = getCircuitJsonTree(db.toArray(), {
8099
8108
  source_group_id: group.source_group_id
8100
8109
  });
8110
+ if (tree.childNodes.length <= 1) return;
8101
8111
  debug5("Converting circuit tree to InputProblem...");
8102
- const inputProblem = convertTreeToInputProblem(tree, db);
8112
+ const inputProblem = convertTreeToInputProblem(tree, db, group);
8103
8113
  debug5("InputProblem:", JSON.stringify(inputProblem, null, 2));
8104
8114
  const solver = new LayoutPipelineSolver(inputProblem);
8105
8115
  debug5("Starting LayoutPipelineSolver...");
@@ -12045,7 +12055,7 @@ import { identity as identity5 } from "transformation-matrix";
12045
12055
  var package_default = {
12046
12056
  name: "@tscircuit/core",
12047
12057
  type: "module",
12048
- version: "0.0.620",
12058
+ version: "0.0.621",
12049
12059
  types: "dist/index.d.ts",
12050
12060
  main: "dist/index.js",
12051
12061
  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.621",
4
+ "version": "0.0.622",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",