@tscircuit/core 0.0.708 → 0.0.709

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.
package/dist/index.js CHANGED
@@ -8582,12 +8582,22 @@ function convertTreeToInputProblem(tree, db, group) {
8582
8582
  if (component?._parsedProps?.schRotation !== void 0) {
8583
8583
  availableRotations = [0];
8584
8584
  }
8585
+ const marginLeft = component?._parsedProps?.schMarginLeft ?? component?._parsedProps?.schMarginX ?? 0;
8586
+ const marginRight = component?._parsedProps?.schMarginRight ?? component?._parsedProps?.schMarginX ?? 0;
8587
+ let marginTop = component?._parsedProps?.schMarginTop ?? component?._parsedProps?.schMarginY ?? 0;
8588
+ let marginBottom = component?._parsedProps?.schMarginBottom ?? component?._parsedProps?.schMarginY ?? 0;
8589
+ if (component?.config.shouldRenderAsSchematicBox) {
8590
+ marginTop += 0.4;
8591
+ marginBottom += 0.4;
8592
+ }
8593
+ const marginXShift = (marginRight - marginLeft) / 2;
8594
+ const marginYShift = (marginTop - marginBottom) / 2;
8585
8595
  problem.chipMap[chipId] = {
8586
8596
  chipId,
8587
8597
  pins: [],
8588
8598
  size: {
8589
- x: schematicComponent.size?.width || 1,
8590
- y: schematicComponent.size?.height || 1
8599
+ x: (schematicComponent.size?.width || 1) + marginLeft + marginRight,
8600
+ y: (schematicComponent.size?.height || 1) + marginTop + marginBottom
8591
8601
  },
8592
8602
  availableRotations
8593
8603
  };
@@ -8603,8 +8613,8 @@ function convertTreeToInputProblem(tree, db, group) {
8603
8613
  problem.chipPinMap[pinId] = {
8604
8614
  pinId,
8605
8615
  offset: {
8606
- x: (port.center?.x || 0) - (schematicComponent.center.x || 0),
8607
- y: (port.center?.y || 0) - (schematicComponent.center.y || 0)
8616
+ x: (port.center?.x || 0) - (schematicComponent.center.x || 0) + marginXShift,
8617
+ y: (port.center?.y || 0) - (schematicComponent.center.y || 0) + marginYShift
8608
8618
  },
8609
8619
  side
8610
8620
  };
@@ -8615,6 +8625,9 @@ function convertTreeToInputProblem(tree, db, group) {
8615
8625
  const schematicGroup = db.schematic_group?.getWhere?.({
8616
8626
  source_group_id: child.sourceGroup.source_group_id
8617
8627
  });
8628
+ const groupInstance = group.children.find(
8629
+ (groupChild) => groupChild.source_group_id === child.sourceGroup?.source_group_id
8630
+ );
8618
8631
  debug5(
8619
8632
  `[${group.name}] Found schematic_group for ${groupId}:`,
8620
8633
  schematicGroup
@@ -8644,8 +8657,14 @@ function convertTreeToInputProblem(tree, db, group) {
8644
8657
  maxY = Math.max(maxY, comp.center.y + halfHeight);
8645
8658
  }
8646
8659
  }
8647
- const groupWidth = hasValidBounds ? maxX - minX : 2;
8648
- const groupHeight = hasValidBounds ? maxY - minY : 2;
8660
+ const marginLeft = groupInstance?._parsedProps?.schMarginLeft ?? groupInstance?._parsedProps?.schMarginX ?? 0;
8661
+ const marginRight = groupInstance?._parsedProps?.schMarginRight ?? groupInstance?._parsedProps?.schMarginX ?? 0;
8662
+ const marginTop = groupInstance?._parsedProps?.schMarginTop ?? groupInstance?._parsedProps?.schMarginY ?? 0;
8663
+ const marginBottom = groupInstance?._parsedProps?.schMarginBottom ?? groupInstance?._parsedProps?.schMarginY ?? 0;
8664
+ const marginXShift = (marginRight - marginLeft) / 2;
8665
+ const marginYShift = (marginTop - marginBottom) / 2;
8666
+ const groupWidth = (hasValidBounds ? maxX - minX : 2) + marginLeft + marginRight;
8667
+ const groupHeight = (hasValidBounds ? maxY - minY : 2) + marginTop + marginBottom;
8649
8668
  debug5(
8650
8669
  `[${group.name}] Group ${groupId} computed size: ${groupWidth} x ${groupHeight}`
8651
8670
  );
@@ -8664,8 +8683,8 @@ function convertTreeToInputProblem(tree, db, group) {
8664
8683
  problem.chipPinMap[pinId] = {
8665
8684
  pinId,
8666
8685
  offset: {
8667
- x: (port.center?.x || 0) - groupCenter.x,
8668
- y: (port.center?.y || 0) - groupCenter.y
8686
+ x: (port.center?.x || 0) - groupCenter.x + marginXShift,
8687
+ y: (port.center?.y || 0) - groupCenter.y + marginYShift
8669
8688
  },
8670
8689
  side
8671
8690
  };
@@ -14623,7 +14642,7 @@ import { identity as identity6 } from "transformation-matrix";
14623
14642
  var package_default = {
14624
14643
  name: "@tscircuit/core",
14625
14644
  type: "module",
14626
- version: "0.0.707",
14645
+ version: "0.0.708",
14627
14646
  types: "dist/index.d.ts",
14628
14647
  main: "dist/index.js",
14629
14648
  module: "dist/index.js",
@@ -14662,7 +14681,7 @@ var package_default = {
14662
14681
  "@tscircuit/matchpack": "^0.0.16",
14663
14682
  "@tscircuit/math-utils": "^0.0.21",
14664
14683
  "@tscircuit/miniflex": "^0.0.4",
14665
- "@tscircuit/props": "0.0.307",
14684
+ "@tscircuit/props": "0.0.310",
14666
14685
  "@tscircuit/schematic-autolayout": "^0.0.6",
14667
14686
  "@tscircuit/schematic-match-adapt": "^0.0.16",
14668
14687
  "@tscircuit/schematic-trace-solver": "^0.0.35",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.708",
4
+ "version": "0.0.709",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -40,7 +40,7 @@
40
40
  "@tscircuit/matchpack": "^0.0.16",
41
41
  "@tscircuit/math-utils": "^0.0.21",
42
42
  "@tscircuit/miniflex": "^0.0.4",
43
- "@tscircuit/props": "0.0.307",
43
+ "@tscircuit/props": "0.0.310",
44
44
  "@tscircuit/schematic-autolayout": "^0.0.6",
45
45
  "@tscircuit/schematic-match-adapt": "^0.0.16",
46
46
  "@tscircuit/schematic-trace-solver": "^0.0.35",