@tscircuit/core 0.0.618 → 0.0.620

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.d.ts CHANGED
@@ -1126,6 +1126,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
1126
1126
  _getSchematicLayoutMode(): "match-adapt" | "flex" | "grid" | "relative";
1127
1127
  doInitialSchematicLayout(): void;
1128
1128
  _doInitialSchematicLayoutMatchAdapt(): void;
1129
+ _doInitialSchematicLayoutMatchpack(): void;
1129
1130
  _doInitialSchematicLayoutGrid(): void;
1130
1131
  _getPcbLayoutMode(): "grid" | "flex" | "match-adapt" | "pack" | "none";
1131
1132
  doInitialPcbLayout(): void;
package/dist/index.js CHANGED
@@ -7184,7 +7184,7 @@ var CapacityMeshAutorouter = class {
7184
7184
 
7185
7185
  // lib/components/primitive-components/Group/Group.ts
7186
7186
  import "circuit-json";
7187
- import Debug7 from "debug";
7187
+ import Debug8 from "debug";
7188
7188
  import "zod";
7189
7189
 
7190
7190
  // lib/components/primitive-components/TraceHint.ts
@@ -7944,6 +7944,295 @@ function Group_doInitialSchematicLayoutMatchAdapt(group) {
7944
7944
  }
7945
7945
  }
7946
7946
 
7947
+ // lib/components/primitive-components/Group/Group_doInitialSchematicLayoutMatchPack.ts
7948
+ import {
7949
+ getCircuitJsonTree
7950
+ } from "@tscircuit/circuit-json-util";
7951
+ import { LayoutPipelineSolver } from "@tscircuit/matchpack";
7952
+ import Debug6 from "debug";
7953
+ var debug5 = Debug6("Group_doInitialSchematicLayoutMatchpack");
7954
+ function rotateDirection(direction, degrees) {
7955
+ const directions = [
7956
+ "up",
7957
+ "right",
7958
+ "down",
7959
+ "left"
7960
+ ];
7961
+ const currentIndex = directions.indexOf(direction);
7962
+ if (currentIndex === -1) return direction;
7963
+ const steps = Math.round(degrees / 90);
7964
+ const newIndex = (currentIndex + steps) % 4;
7965
+ return directions[newIndex < 0 ? newIndex + 4 : newIndex];
7966
+ }
7967
+ function convertTreeToInputProblem(tree, db) {
7968
+ const problem = {
7969
+ chipMap: {},
7970
+ chipPinMap: {},
7971
+ groupMap: {},
7972
+ groupPinMap: {},
7973
+ netMap: {},
7974
+ pinStrongConnMap: {},
7975
+ netConnMap: {},
7976
+ chipGap: 0.4,
7977
+ partitionGap: 1.2
7978
+ };
7979
+ tree.childNodes.forEach((child, index) => {
7980
+ if (child.nodeType === "component" && child.sourceComponent) {
7981
+ const chipId = child.sourceComponent.name || `chip_${index}`;
7982
+ const schematicComponent = db.schematic_component.getWhere({
7983
+ source_component_id: child.sourceComponent.source_component_id
7984
+ });
7985
+ if (!schematicComponent) return;
7986
+ problem.chipMap[chipId] = {
7987
+ chipId,
7988
+ pins: [],
7989
+ size: {
7990
+ x: schematicComponent.size?.width || 1,
7991
+ 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]
7995
+ };
7996
+ const ports = db.schematic_port.list({
7997
+ schematic_component_id: schematicComponent.schematic_component_id
7998
+ });
7999
+ for (const port of ports) {
8000
+ const sourcePort = db.source_port.get(port.source_port_id);
8001
+ if (!sourcePort) continue;
8002
+ const pinId = `${chipId}.${sourcePort.pin_number || sourcePort.name || port.schematic_port_id}`;
8003
+ problem.chipMap[chipId].pins.push(pinId);
8004
+ let side = "y+";
8005
+ switch (port.facing_direction) {
8006
+ case "up":
8007
+ side = "y+";
8008
+ break;
8009
+ case "down":
8010
+ side = "y-";
8011
+ break;
8012
+ case "left":
8013
+ side = "x-";
8014
+ break;
8015
+ case "right":
8016
+ side = "x+";
8017
+ break;
8018
+ }
8019
+ problem.chipPinMap[pinId] = {
8020
+ pinId,
8021
+ offset: {
8022
+ x: (port.center?.x || 0) - (schematicComponent.center.x || 0),
8023
+ y: (port.center?.y || 0) - (schematicComponent.center.y || 0)
8024
+ },
8025
+ side
8026
+ };
8027
+ }
8028
+ } else if (child.nodeType === "group" && child.sourceGroup) {
8029
+ const groupId = child.sourceGroup.name || `group_${index}`;
8030
+ const schematicGroup = db.schematic_group?.getWhere?.({
8031
+ source_group_id: child.sourceGroup.source_group_id
8032
+ });
8033
+ if (schematicGroup) {
8034
+ problem.chipMap[groupId] = {
8035
+ chipId: groupId,
8036
+ pins: [],
8037
+ size: {
8038
+ x: schematicGroup.size?.width || 2,
8039
+ y: schematicGroup.size?.height || 2
8040
+ }
8041
+ };
8042
+ }
8043
+ }
8044
+ });
8045
+ const sourceTraces = db.source_trace.list();
8046
+ const sourceNets = db.source_net.list();
8047
+ for (const net of sourceNets) {
8048
+ problem.netMap[net.name || net.source_net_id] = {
8049
+ netId: net.name || net.source_net_id
8050
+ };
8051
+ }
8052
+ for (const trace of sourceTraces) {
8053
+ const connectedPorts = trace.connected_source_port_ids || [];
8054
+ const connectedNets = trace.connected_source_net_ids || [];
8055
+ const relevantPins = [];
8056
+ for (const portId of connectedPorts) {
8057
+ const sourcePort = db.source_port.get(portId);
8058
+ if (!sourcePort) continue;
8059
+ for (const [chipId, chip] of Object.entries(problem.chipMap)) {
8060
+ const chipSourceComponent = tree.childNodes.find(
8061
+ (n) => n.sourceComponent?.name === chipId
8062
+ )?.sourceComponent;
8063
+ if (chipSourceComponent) {
8064
+ const isPortInComponent = db.source_port.list({
8065
+ source_component_id: chipSourceComponent.source_component_id
8066
+ }).some((p) => p.source_port_id === portId);
8067
+ if (isPortInComponent) {
8068
+ const pinNumber = sourcePort.pin_number || sourcePort.name;
8069
+ const expectedPinId = `${chipId}.${pinNumber}`;
8070
+ if (chip.pins.includes(expectedPinId)) {
8071
+ relevantPins.push(expectedPinId);
8072
+ } else {
8073
+ debug5(
8074
+ `Warning: Could not find pin ${expectedPinId} in chip ${chipId}`
8075
+ );
8076
+ }
8077
+ }
8078
+ }
8079
+ }
8080
+ }
8081
+ if (relevantPins.length === 2 && connectedNets.length === 0) {
8082
+ const [pin1, pin2] = relevantPins;
8083
+ problem.pinStrongConnMap[`${pin1}-${pin2}`] = true;
8084
+ problem.pinStrongConnMap[`${pin2}-${pin1}`] = true;
8085
+ }
8086
+ for (const pinId of relevantPins) {
8087
+ for (const netId of connectedNets) {
8088
+ const net = db.source_net.get(netId);
8089
+ const netName = net?.name || netId;
8090
+ problem.netConnMap[`${pinId}-${netName}`] = true;
8091
+ }
8092
+ }
8093
+ }
8094
+ return problem;
8095
+ }
8096
+ function Group_doInitialSchematicLayoutMatchPack(group) {
8097
+ const { db } = group.root;
8098
+ const tree = getCircuitJsonTree(db.toArray(), {
8099
+ source_group_id: group.source_group_id
8100
+ });
8101
+ debug5("Converting circuit tree to InputProblem...");
8102
+ const inputProblem = convertTreeToInputProblem(tree, db);
8103
+ debug5("InputProblem:", JSON.stringify(inputProblem, null, 2));
8104
+ const solver = new LayoutPipelineSolver(inputProblem);
8105
+ debug5("Starting LayoutPipelineSolver...");
8106
+ if (debug5.enabled && global.debugGraphics) {
8107
+ const initialViz = solver.visualize();
8108
+ global.debugGraphics.push({
8109
+ ...initialViz,
8110
+ title: `matchpack-initial-${group.name}`
8111
+ });
8112
+ }
8113
+ solver.solve();
8114
+ debug5(`Solver completed in ${solver.iterations} iterations`);
8115
+ debug5(`Solved: ${solver.solved}, Failed: ${solver.failed}`);
8116
+ if (solver.failed) {
8117
+ debug5(`Solver failed with error: ${solver.error}`);
8118
+ throw new Error(`Matchpack layout solver failed: ${solver.error}`);
8119
+ }
8120
+ const outputLayout = solver.getOutputLayout();
8121
+ debug5("OutputLayout:", JSON.stringify(outputLayout, null, 2));
8122
+ if (debug5.enabled && global.debugGraphics) {
8123
+ const finalViz = solver.visualize();
8124
+ global.debugGraphics.push({
8125
+ ...finalViz,
8126
+ title: `matchpack-final-${group.name}`
8127
+ });
8128
+ }
8129
+ const overlaps = solver.checkForOverlaps(outputLayout);
8130
+ if (overlaps.length > 0) {
8131
+ debug5(`Warning: Found ${overlaps.length} overlapping components:`);
8132
+ for (const overlap of overlaps) {
8133
+ debug5(
8134
+ ` ${overlap.chip1} overlaps ${overlap.chip2} (area: ${overlap.overlapArea})`
8135
+ );
8136
+ }
8137
+ }
8138
+ const groupOffset = group._getGlobalSchematicPositionBeforeLayout();
8139
+ debug5(`Group offset: x=${groupOffset.x}, y=${groupOffset.y}`);
8140
+ for (const [chipId, placement] of Object.entries(
8141
+ outputLayout.chipPlacements
8142
+ )) {
8143
+ const treeNode = tree.childNodes.find((child) => {
8144
+ if (child.nodeType === "component" && child.sourceComponent) {
8145
+ return child.sourceComponent.name === chipId;
8146
+ }
8147
+ if (child.nodeType === "group" && child.sourceGroup) {
8148
+ return child.sourceGroup.name === chipId;
8149
+ }
8150
+ return false;
8151
+ });
8152
+ if (!treeNode) {
8153
+ debug5(`Warning: No tree node found for chip: ${chipId}`);
8154
+ continue;
8155
+ }
8156
+ const newCenter = {
8157
+ x: placement.x + groupOffset.x,
8158
+ y: placement.y + groupOffset.y
8159
+ };
8160
+ if (treeNode.nodeType === "component" && treeNode.sourceComponent) {
8161
+ const schematicComponent = db.schematic_component.getWhere({
8162
+ source_component_id: treeNode.sourceComponent.source_component_id
8163
+ });
8164
+ if (schematicComponent) {
8165
+ debug5(`Moving component ${chipId} to (${newCenter.x}, ${newCenter.y})`);
8166
+ const ports = db.schematic_port.list({
8167
+ schematic_component_id: schematicComponent.schematic_component_id
8168
+ });
8169
+ const texts = db.schematic_text.list({
8170
+ schematic_component_id: schematicComponent.schematic_component_id
8171
+ });
8172
+ const positionDelta = {
8173
+ x: newCenter.x - schematicComponent.center.x,
8174
+ y: newCenter.y - schematicComponent.center.y
8175
+ };
8176
+ for (const port of ports) {
8177
+ port.center.x += positionDelta.x;
8178
+ port.center.y += positionDelta.y;
8179
+ }
8180
+ for (const text of texts) {
8181
+ text.position.x += positionDelta.x;
8182
+ text.position.y += positionDelta.y;
8183
+ }
8184
+ schematicComponent.center = newCenter;
8185
+ if (placement.ccwRotationDegrees !== 0) {
8186
+ debug5(
8187
+ `Component ${chipId} has rotation: ${placement.ccwRotationDegrees}\xB0`
8188
+ );
8189
+ const angleRad = placement.ccwRotationDegrees * Math.PI / 180;
8190
+ const cos = Math.cos(angleRad);
8191
+ const sin = Math.sin(angleRad);
8192
+ for (const port of ports) {
8193
+ const dx = port.center.x - newCenter.x;
8194
+ const dy = port.center.y - newCenter.y;
8195
+ const rotatedDx = dx * cos - dy * sin;
8196
+ const rotatedDy = dx * sin + dy * cos;
8197
+ port.center.x = newCenter.x + rotatedDx;
8198
+ port.center.y = newCenter.y + rotatedDy;
8199
+ const originalDirection = port.facing_direction || "right";
8200
+ port.facing_direction = rotateDirection(
8201
+ originalDirection,
8202
+ placement.ccwRotationDegrees
8203
+ );
8204
+ }
8205
+ for (const text of texts) {
8206
+ const dx = text.position.x - newCenter.x;
8207
+ const dy = text.position.y - newCenter.y;
8208
+ const rotatedDx = dx * cos - dy * sin;
8209
+ const rotatedDy = dx * sin + dy * cos;
8210
+ text.position.x = newCenter.x + rotatedDx;
8211
+ text.position.y = newCenter.y + rotatedDy;
8212
+ }
8213
+ if (schematicComponent.symbol_name) {
8214
+ const schematicSymbolDirection = schematicComponent.symbol_name.match(/_(right|left|up|down)$/);
8215
+ if (schematicSymbolDirection) {
8216
+ schematicComponent.symbol_name = schematicComponent.symbol_name.replace(
8217
+ schematicSymbolDirection[0],
8218
+ `_${rotateDirection(schematicSymbolDirection[1], placement.ccwRotationDegrees)}`
8219
+ );
8220
+ }
8221
+ }
8222
+ }
8223
+ }
8224
+ } else if (treeNode.nodeType === "group" && treeNode.sourceGroup) {
8225
+ const schematicGroup = db.schematic_group?.getWhere?.({
8226
+ source_group_id: treeNode.sourceGroup.source_group_id
8227
+ });
8228
+ if (schematicGroup) {
8229
+ debug5(`Moving group ${chipId} to (${newCenter.x}, ${newCenter.y})`);
8230
+ }
8231
+ }
8232
+ }
8233
+ debug5("Matchpack layout completed successfully");
8234
+ }
8235
+
7947
8236
  // lib/components/primitive-components/Group/Group_doInitialSourceAddConnectivityMapKey.ts
7948
8237
  import { ConnectivityMap as ConnectivityMap2 } from "circuit-json-to-connectivity-map";
7949
8238
  function Group_doInitialSourceAddConnectivityMapKey(group) {
@@ -8299,6 +8588,7 @@ function getPresetAutoroutingConfig(autorouterConfig) {
8299
8588
  };
8300
8589
  }
8301
8590
  const preset = typeof autorouterConfig === "object" ? autorouterConfig.preset : autorouterConfig;
8591
+ const providedConfig = typeof autorouterConfig === "object" ? autorouterConfig : {};
8302
8592
  switch (preset) {
8303
8593
  case "auto-local":
8304
8594
  return {
@@ -8315,14 +8605,20 @@ function getPresetAutoroutingConfig(autorouterConfig) {
8315
8605
  local: true,
8316
8606
  groupMode: "subcircuit"
8317
8607
  };
8318
- case "auto-cloud":
8608
+ case "auto-cloud": {
8609
+ const {
8610
+ preset: _preset,
8611
+ local: _local,
8612
+ groupMode: _groupMode,
8613
+ ...rest
8614
+ } = providedConfig;
8319
8615
  return {
8320
8616
  local: false,
8321
8617
  groupMode: "subcircuit",
8322
- serverUrl: defaults.serverUrl,
8323
- serverMode: defaults.serverMode,
8324
- serverCacheEnabled: true
8618
+ ...defaults,
8619
+ ...rest
8325
8620
  };
8621
+ }
8326
8622
  default:
8327
8623
  return {
8328
8624
  local: true,
@@ -8344,8 +8640,8 @@ import {
8344
8640
  transformPCBElements as transformPCBElements2
8345
8641
  } from "@tscircuit/circuit-json-util";
8346
8642
  import { translate as translate6, rotate as rotate2, compose as compose4 } from "transformation-matrix";
8347
- import Debug6 from "debug";
8348
- var debug5 = Debug6("Group_doInitialPcbLayoutPack");
8643
+ import Debug7 from "debug";
8644
+ var debug6 = Debug7("Group_doInitialPcbLayoutPack");
8349
8645
  var Group_doInitialPcbLayoutPack = (group) => {
8350
8646
  const { db } = group.root;
8351
8647
  const { _parsedProps: props } = group;
@@ -8365,12 +8661,13 @@ var Group_doInitialPcbLayoutPack = (group) => {
8365
8661
  source_group_id: group.source_group_id
8366
8662
  })
8367
8663
  ),
8664
+ // @ts-expect-error we're missing some pack order strategies
8368
8665
  orderStrategy: packOrderStrategy ?? "largest_to_smallest",
8369
- placementStrategy: packPlacementStrategy ?? "shortest_connection_along_outline",
8666
+ placementStrategy: packPlacementStrategy ?? "minimum_sum_squared_distance_to_network",
8370
8667
  minGap: gapMm
8371
8668
  };
8372
8669
  const packOutput = pack(packInput);
8373
- if (debug5.enabled) {
8670
+ if (debug6.enabled) {
8374
8671
  const graphics = getGraphicsFromPackOutput(packOutput);
8375
8672
  graphics.title = `packOutput-${group.name}`;
8376
8673
  global.debugGraphics?.push(graphics);
@@ -8383,7 +8680,7 @@ var Group_doInitialPcbLayoutPack = (group) => {
8383
8680
  const transformMatrix2 = compose4(
8384
8681
  group._computePcbGlobalTransformBeforeLayout(),
8385
8682
  translate6(center.x, center.y),
8386
- rotate2(ccwRotationOffset || 0),
8683
+ rotate2((ccwRotationOffset || 0) * Math.PI / 180),
8387
8684
  translate6(-originalCenter2.x, -originalCenter2.y)
8388
8685
  );
8389
8686
  const related = db.toArray().filter(
@@ -8409,7 +8706,7 @@ var Group_doInitialPcbLayoutPack = (group) => {
8409
8706
 
8410
8707
  // lib/components/primitive-components/Group/Group_doInitialPcbLayoutFlex.ts
8411
8708
  import {
8412
- getCircuitJsonTree,
8709
+ getCircuitJsonTree as getCircuitJsonTree2,
8413
8710
  repositionPcbComponentTo,
8414
8711
  repositionPcbGroupTo,
8415
8712
  getMinimumFlexContainer
@@ -8443,7 +8740,7 @@ var getSizeOfTreeNodeChild = (db, child) => {
8443
8740
  var Group_doInitialPcbLayoutFlex = (group) => {
8444
8741
  const { db } = group.root;
8445
8742
  const { _parsedProps: props } = group;
8446
- const tree = getCircuitJsonTree(db.toArray(), {
8743
+ const tree = getCircuitJsonTree2(db.toArray(), {
8447
8744
  source_group_id: group.source_group_id
8448
8745
  });
8449
8746
  const rawJustify = props.pcbJustifyContent ?? props.justifyContent;
@@ -8739,20 +9036,20 @@ var Group = class extends NormalComponent {
8739
9036
  return false;
8740
9037
  }
8741
9038
  _hasTracesToRoute() {
8742
- const debug6 = Debug7("tscircuit:core:_hasTracesToRoute");
9039
+ const debug7 = Debug8("tscircuit:core:_hasTracesToRoute");
8743
9040
  const traces = this.selectAll("trace");
8744
- debug6(`[${this.getString()}] has ${traces.length} traces to route`);
9041
+ debug7(`[${this.getString()}] has ${traces.length} traces to route`);
8745
9042
  return traces.length > 0;
8746
9043
  }
8747
9044
  async _runEffectMakeHttpAutoroutingRequest() {
8748
9045
  const { db } = this.root;
8749
- const debug6 = Debug7("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");
9046
+ const debug7 = Debug8("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");
8750
9047
  const props = this._parsedProps;
8751
9048
  const autorouterConfig = this._getAutorouterConfig();
8752
9049
  const serverUrl = autorouterConfig.serverUrl;
8753
9050
  const serverMode = autorouterConfig.serverMode;
8754
9051
  const fetchWithDebug = (url, options) => {
8755
- debug6("fetching", url);
9052
+ debug7("fetching", url);
8756
9053
  if (options.headers) {
8757
9054
  options.headers["Tscircuit-Core-Version"] = this.root?.getCoreVersion();
8758
9055
  }
@@ -8868,15 +9165,15 @@ var Group = class extends NormalComponent {
8868
9165
  async _runLocalAutorouting() {
8869
9166
  const { db } = this.root;
8870
9167
  const props = this._parsedProps;
8871
- const debug6 = Debug7("tscircuit:core:_runLocalAutorouting");
8872
- debug6(`[${this.getString()}] starting local autorouting`);
9168
+ const debug7 = Debug8("tscircuit:core:_runLocalAutorouting");
9169
+ debug7(`[${this.getString()}] starting local autorouting`);
8873
9170
  const autorouterConfig = this._getAutorouterConfig();
8874
9171
  const { simpleRouteJson } = getSimpleRouteJsonFromCircuitJson({
8875
9172
  db,
8876
9173
  minTraceWidth: this.props.autorouter?.minTraceWidth ?? 0.15,
8877
9174
  subcircuit_id: this.subcircuit_id
8878
9175
  });
8879
- if (debug6.enabled) {
9176
+ if (debug7.enabled) {
8880
9177
  const graphicsObject = convertSrjToGraphicsObject(
8881
9178
  simpleRouteJson
8882
9179
  );
@@ -8901,11 +9198,11 @@ var Group = class extends NormalComponent {
8901
9198
  const routingPromise = new Promise(
8902
9199
  (resolve, reject) => {
8903
9200
  autorouter.on("complete", (event) => {
8904
- debug6(`[${this.getString()}] local autorouting complete`);
9201
+ debug7(`[${this.getString()}] local autorouting complete`);
8905
9202
  resolve(event.traces);
8906
9203
  });
8907
9204
  autorouter.on("error", (event) => {
8908
- debug6(
9205
+ debug7(
8909
9206
  `[${this.getString()}] local autorouting error: ${event.error.message}`
8910
9207
  );
8911
9208
  reject(event.error);
@@ -8962,30 +9259,30 @@ var Group = class extends NormalComponent {
8962
9259
  }
8963
9260
  }
8964
9261
  doInitialPcbTraceRender() {
8965
- const debug6 = Debug7("tscircuit:core:doInitialPcbTraceRender");
9262
+ const debug7 = Debug8("tscircuit:core:doInitialPcbTraceRender");
8966
9263
  if (!this.isSubcircuit) return;
8967
9264
  if (this.root?.pcbDisabled) return;
8968
9265
  if (this.getInheritedProperty("routingDisabled")) return;
8969
9266
  if (this._shouldUseTraceByTraceRouting()) return;
8970
9267
  if (!this._areChildSubcircuitsRouted()) {
8971
- debug6(
9268
+ debug7(
8972
9269
  `[${this.getString()}] child subcircuits are not routed, skipping async autorouting until subcircuits routed`
8973
9270
  );
8974
9271
  return;
8975
9272
  }
8976
- debug6(
9273
+ debug7(
8977
9274
  `[${this.getString()}] no child subcircuits to wait for, initiating async routing`
8978
9275
  );
8979
9276
  if (!this._hasTracesToRoute()) return;
8980
9277
  this._startAsyncAutorouting();
8981
9278
  }
8982
9279
  updatePcbTraceRender() {
8983
- const debug6 = Debug7("tscircuit:core:updatePcbTraceRender");
8984
- debug6(`[${this.getString()}] updating...`);
9280
+ const debug7 = Debug8("tscircuit:core:updatePcbTraceRender");
9281
+ debug7(`[${this.getString()}] updating...`);
8985
9282
  if (!this.isSubcircuit) return;
8986
9283
  if (this._shouldRouteAsync() && this._hasTracesToRoute() && !this._hasStartedAsyncAutorouting) {
8987
9284
  if (this._areChildSubcircuitsRouted()) {
8988
- debug6(
9285
+ debug7(
8989
9286
  `[${this.getString()}] child subcircuits are now routed, starting async autorouting`
8990
9287
  );
8991
9288
  this._startAsyncAutorouting();
@@ -8996,14 +9293,14 @@ var Group = class extends NormalComponent {
8996
9293
  if (this._shouldUseTraceByTraceRouting()) return;
8997
9294
  const { db } = this.root;
8998
9295
  if (this._asyncAutoroutingResult.output_simple_route_json) {
8999
- debug6(
9296
+ debug7(
9000
9297
  `[${this.getString()}] updating PCB traces from simple route json (${this._asyncAutoroutingResult.output_simple_route_json.traces?.length} traces)`
9001
9298
  );
9002
9299
  this._updatePcbTraceRenderFromSimpleRouteJson();
9003
9300
  return;
9004
9301
  }
9005
9302
  if (this._asyncAutoroutingResult.output_pcb_traces) {
9006
- debug6(
9303
+ debug7(
9007
9304
  `[${this.getString()}] updating PCB traces from ${this._asyncAutoroutingResult.output_pcb_traces.length} traces`
9008
9305
  );
9009
9306
  this._updatePcbTraceRenderFromPcbTraces();
@@ -9109,7 +9406,7 @@ var Group = class extends NormalComponent {
9109
9406
  const props = this._parsedProps;
9110
9407
  const schematicLayoutMode = this._getSchematicLayoutMode();
9111
9408
  if (schematicLayoutMode === "match-adapt") {
9112
- this._doInitialSchematicLayoutMatchAdapt();
9409
+ this._doInitialSchematicLayoutMatchpack();
9113
9410
  }
9114
9411
  if (schematicLayoutMode === "grid") {
9115
9412
  this._doInitialSchematicLayoutGrid();
@@ -9119,6 +9416,9 @@ var Group = class extends NormalComponent {
9119
9416
  _doInitialSchematicLayoutMatchAdapt() {
9120
9417
  Group_doInitialSchematicLayoutMatchAdapt(this);
9121
9418
  }
9419
+ _doInitialSchematicLayoutMatchpack() {
9420
+ Group_doInitialSchematicLayoutMatchPack(this);
9421
+ }
9122
9422
  _doInitialSchematicLayoutGrid() {
9123
9423
  Group_doInitialSchematicLayoutGrid(this);
9124
9424
  }
@@ -11745,7 +12045,7 @@ import { identity as identity5 } from "transformation-matrix";
11745
12045
  var package_default = {
11746
12046
  name: "@tscircuit/core",
11747
12047
  type: "module",
11748
- version: "0.0.617",
12048
+ version: "0.0.619",
11749
12049
  types: "dist/index.d.ts",
11750
12050
  main: "dist/index.js",
11751
12051
  module: "dist/index.js",
@@ -11807,7 +12107,8 @@ var package_default = {
11807
12107
  "react-dom": "^19.1.0",
11808
12108
  "schematic-symbols": "^0.0.180",
11809
12109
  "ts-expect": "^1.3.0",
11810
- tsup: "^8.2.4"
12110
+ tsup: "^8.2.4",
12111
+ "@tscircuit/matchpack": "^0.0.3"
11811
12112
  },
11812
12113
  peerDependencies: {
11813
12114
  "@tscircuit/capacity-autorouter": "*",
@@ -11822,6 +12123,7 @@ var package_default = {
11822
12123
  "@tscircuit/schematic-corpus": "*",
11823
12124
  "circuit-json-to-bpc": "*",
11824
12125
  "bpc-graph": "*",
12126
+ "@tscircuit/matchpack": "*",
11825
12127
  "circuit-json": "*",
11826
12128
  "circuit-json-to-connectivity-map": "*",
11827
12129
  "schematic-symbols": "*",
@@ -11830,7 +12132,7 @@ var package_default = {
11830
12132
  dependencies: {
11831
12133
  "@flatten-js/core": "^1.6.2",
11832
12134
  "@lume/kiwi": "^0.4.3",
11833
- "calculate-packing": "0.0.9",
12135
+ "calculate-packing": "0.0.17",
11834
12136
  "css-select": "5.1.0",
11835
12137
  "format-si-unit": "^0.0.3",
11836
12138
  nanoid: "^5.0.7",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.618",
4
+ "version": "0.0.620",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -63,7 +63,8 @@
63
63
  "react-dom": "^19.1.0",
64
64
  "schematic-symbols": "^0.0.180",
65
65
  "ts-expect": "^1.3.0",
66
- "tsup": "^8.2.4"
66
+ "tsup": "^8.2.4",
67
+ "@tscircuit/matchpack": "^0.0.3"
67
68
  },
68
69
  "peerDependencies": {
69
70
  "@tscircuit/capacity-autorouter": "*",
@@ -78,6 +79,7 @@
78
79
  "@tscircuit/schematic-corpus": "*",
79
80
  "circuit-json-to-bpc": "*",
80
81
  "bpc-graph": "*",
82
+ "@tscircuit/matchpack": "*",
81
83
  "circuit-json": "*",
82
84
  "circuit-json-to-connectivity-map": "*",
83
85
  "schematic-symbols": "*",
@@ -86,7 +88,7 @@
86
88
  "dependencies": {
87
89
  "@flatten-js/core": "^1.6.2",
88
90
  "@lume/kiwi": "^0.4.3",
89
- "calculate-packing": "0.0.9",
91
+ "calculate-packing": "0.0.17",
90
92
  "css-select": "5.1.0",
91
93
  "format-si-unit": "^0.0.3",
92
94
  "nanoid": "^5.0.7",