@tscircuit/core 0.0.1496 → 0.0.1498

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 -13
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -18783,7 +18783,7 @@ var isDescendantGroup = (db, groupId, ancestorId) => {
18783
18783
  if (!group || !group.parent_source_group_id) return false;
18784
18784
  return isDescendantGroup(db, group.parent_source_group_id, ancestorId);
18785
18785
  };
18786
- var applyPackOutput = (group, packOutput, clusterMap) => {
18786
+ var applyPackOutput = (group, packOutput, clusterMap, initialPackOutput) => {
18787
18787
  const { db } = group.root;
18788
18788
  for (const packedComponent of packOutput.components) {
18789
18789
  const { center, componentId, ccwRotationOffset, ccwRotationDegrees } = packedComponent;
@@ -18858,7 +18858,10 @@ var applyPackOutput = (group, packOutput, clusterMap) => {
18858
18858
  }
18859
18859
  const pcbGroup = db.pcb_group.list().find((g) => g.source_group_id === componentId);
18860
18860
  if (!pcbGroup) continue;
18861
- const originalCenter = pcbGroup.center;
18861
+ const initialPackedComponent = initialPackOutput.components.find(
18862
+ (component) => component.componentId === componentId
18863
+ );
18864
+ const originalCenter = initialPackedComponent?.center ?? pcbGroup.center;
18862
18865
  const rotationDegrees = ccwRotationDegrees ?? ccwRotationOffset ?? 0;
18863
18866
  const transformMatrix = compose6(
18864
18867
  group._computePcbGlobalTransformBeforeLayout(),
@@ -19001,15 +19004,17 @@ var Group_doInitialPcbLayoutPack = (group) => {
19001
19004
  maxY: heightMm / 2
19002
19005
  };
19003
19006
  }
19007
+ const initialPackOutput = convertCircuitJsonToPackOutput(
19008
+ filteredCircuitJson,
19009
+ {
19010
+ source_group_id: group.source_group_id,
19011
+ // shouldAddInnerObstacles: true,
19012
+ chipMarginsMap,
19013
+ staticPcbComponentIds: Array.from(staticPcbComponentIds)
19014
+ }
19015
+ );
19004
19016
  const packInput = {
19005
- ...convertPackOutputToPackInput(
19006
- convertCircuitJsonToPackOutput(filteredCircuitJson, {
19007
- source_group_id: group.source_group_id,
19008
- // shouldAddInnerObstacles: true,
19009
- chipMarginsMap,
19010
- staticPcbComponentIds: Array.from(staticPcbComponentIds)
19011
- })
19012
- ),
19017
+ ...convertPackOutputToPackInput(initialPackOutput),
19013
19018
  // @ts-expect-error calculate-packing is missing some supported strategies
19014
19019
  packOrderStrategy: packOrderStrategy ?? "largest_to_smallest",
19015
19020
  packPlacementStrategy: packPlacementStrategy ?? "minimum_sum_squared_distance_to_network",
@@ -19058,7 +19063,7 @@ var Group_doInitialPcbLayoutPack = (group) => {
19058
19063
  graphics.title = `packOutput-${group.name}`;
19059
19064
  global.debugGraphics?.push(graphics);
19060
19065
  }
19061
- applyPackOutput(group, packOutput, clusterMap);
19066
+ applyPackOutput(group, packOutput, clusterMap, initialPackOutput);
19062
19067
  group.root?.emit("packing:end", {
19063
19068
  subcircuit_id: group.subcircuit_id,
19064
19069
  componentDisplayName: group.getString()
@@ -20184,6 +20189,8 @@ function convertTreeToMatchPackInputProblem(tree, db, group, opts = {}) {
20184
20189
  chipGap: problem.chipGap
20185
20190
  }),
20186
20191
  isCapacitor: child.sourceComponent.ftype === "simple_capacitor",
20192
+ isCrystal: child.sourceComponent.ftype === "simple_crystal",
20193
+ isResistor: child.sourceComponent.ftype === "simple_resistor",
20187
20194
  availableRotations,
20188
20195
  ...explicitlyPositioned && {
20189
20196
  fixedPosition: {
@@ -23395,7 +23402,7 @@ function Group_getRoutingPhasePlans(group) {
23395
23402
  var package_default = {
23396
23403
  name: "@tscircuit/core",
23397
23404
  type: "module",
23398
- version: "0.0.1495",
23405
+ version: "0.0.1497",
23399
23406
  types: "dist/index.d.ts",
23400
23407
  main: "dist/index.js",
23401
23408
  module: "dist/index.js",
@@ -23442,7 +23449,7 @@ var package_default = {
23442
23449
  "@tscircuit/jlcpcb-manufacturing-specs": "git+https://github.com/tscircuit/jlcpcb-manufacturing-specs#e08af159db01a37db007e33f0a7268d0e4a279a5",
23443
23450
  "@tscircuit/krt-wasm": "^0.1.1",
23444
23451
  "@tscircuit/log-soup": "^1.0.2",
23445
- "@tscircuit/matchpack": "^0.0.43",
23452
+ "@tscircuit/matchpack": "^0.0.46",
23446
23453
  "@tscircuit/math-utils": "^0.0.36",
23447
23454
  "@tscircuit/miniflex": "^0.0.4",
23448
23455
  "@tscircuit/ngspice-spice-engine": "^0.0.19",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1496",
4
+ "version": "0.0.1498",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -48,7 +48,7 @@
48
48
  "@tscircuit/jlcpcb-manufacturing-specs": "git+https://github.com/tscircuit/jlcpcb-manufacturing-specs#e08af159db01a37db007e33f0a7268d0e4a279a5",
49
49
  "@tscircuit/krt-wasm": "^0.1.1",
50
50
  "@tscircuit/log-soup": "^1.0.2",
51
- "@tscircuit/matchpack": "^0.0.43",
51
+ "@tscircuit/matchpack": "^0.0.46",
52
52
  "@tscircuit/math-utils": "^0.0.36",
53
53
  "@tscircuit/miniflex": "^0.0.4",
54
54
  "@tscircuit/ngspice-spice-engine": "^0.0.19",