@tscircuit/core 0.0.581 → 0.0.582

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 +37 -21
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -6951,7 +6951,7 @@ var CapacityMeshAutorouter = class {
6951
6951
 
6952
6952
  // lib/components/primitive-components/Group/Group.ts
6953
6953
  import "circuit-json";
6954
- import Debug6 from "debug";
6954
+ import Debug7 from "debug";
6955
6955
  import "zod";
6956
6956
 
6957
6957
  // lib/components/primitive-components/TraceHint.ts
@@ -8058,11 +8058,14 @@ import { buildSubtree as buildSubtree2 } from "@tscircuit/circuit-json-util";
8058
8058
  import {
8059
8059
  pack,
8060
8060
  convertCircuitJsonToPackOutput,
8061
- convertPackOutputToPackInput
8061
+ convertPackOutputToPackInput,
8062
+ getGraphicsFromPackOutput
8062
8063
  } from "calculate-packing";
8063
8064
  import { length } from "circuit-json";
8064
8065
  import { transformPCBElements as transformPCBElements2 } from "@tscircuit/circuit-json-util";
8065
8066
  import { translate as translate6 } from "transformation-matrix";
8067
+ import Debug6 from "debug";
8068
+ var debug5 = Debug6("Group_doInitialPcbLayoutPack");
8066
8069
  var sub = (a, b) => ({
8067
8070
  x: a.x - b.x,
8068
8071
  y: a.y - b.y
@@ -8084,6 +8087,11 @@ var Group_doInitialPcbLayoutPack = (group) => {
8084
8087
  minGap: gapMm
8085
8088
  };
8086
8089
  const packOutput = pack(packInput);
8090
+ if (debug5.enabled) {
8091
+ const graphics = getGraphicsFromPackOutput(packOutput);
8092
+ graphics.title = "packOutput";
8093
+ global.debugGraphics?.push(graphics);
8094
+ }
8087
8095
  for (const packedComponent of packOutput.components) {
8088
8096
  const { center, componentId, pads, ccwRotationOffset } = packedComponent;
8089
8097
  const component = db.pcb_component.get(componentId);
@@ -8132,6 +8140,7 @@ var Group_doInitialPcbLayoutFlex = (group) => {
8132
8140
  };
8133
8141
 
8134
8142
  // lib/components/primitive-components/Group/Group.ts
8143
+ import { convertSrjToGraphicsObject } from "@tscircuit/capacity-autorouter";
8135
8144
  var Group = class extends NormalComponent {
8136
8145
  pcb_group_id = null;
8137
8146
  schematic_group_id = null;
@@ -8283,20 +8292,20 @@ var Group = class extends NormalComponent {
8283
8292
  return false;
8284
8293
  }
8285
8294
  _hasTracesToRoute() {
8286
- const debug5 = Debug6("tscircuit:core:_hasTracesToRoute");
8295
+ const debug6 = Debug7("tscircuit:core:_hasTracesToRoute");
8287
8296
  const traces = this.selectAll("trace");
8288
- debug5(`[${this.getString()}] has ${traces.length} traces to route`);
8297
+ debug6(`[${this.getString()}] has ${traces.length} traces to route`);
8289
8298
  return traces.length > 0;
8290
8299
  }
8291
8300
  async _runEffectMakeHttpAutoroutingRequest() {
8292
8301
  const { db } = this.root;
8293
- const debug5 = Debug6("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");
8302
+ const debug6 = Debug7("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");
8294
8303
  const props = this._parsedProps;
8295
8304
  const autorouterConfig = this._getAutorouterConfig();
8296
8305
  const serverUrl = autorouterConfig.serverUrl;
8297
8306
  const serverMode = autorouterConfig.serverMode;
8298
8307
  const fetchWithDebug = (url, options) => {
8299
- debug5("fetching", url);
8308
+ debug6("fetching", url);
8300
8309
  if (options.headers) {
8301
8310
  options.headers["Tscircuit-Core-Version"] = this.root?.getCoreVersion();
8302
8311
  }
@@ -8412,14 +8421,21 @@ var Group = class extends NormalComponent {
8412
8421
  async _runLocalAutorouting() {
8413
8422
  const { db } = this.root;
8414
8423
  const props = this._parsedProps;
8415
- const debug5 = Debug6("tscircuit:core:_runLocalAutorouting");
8416
- debug5(`[${this.getString()}] starting local autorouting`);
8424
+ const debug6 = Debug7("tscircuit:core:_runLocalAutorouting");
8425
+ debug6(`[${this.getString()}] starting local autorouting`);
8417
8426
  const autorouterConfig = this._getAutorouterConfig();
8418
8427
  const { simpleRouteJson } = getSimpleRouteJsonFromCircuitJson({
8419
8428
  db,
8420
8429
  minTraceWidth: this.props.autorouter?.minTraceWidth ?? 0.15,
8421
8430
  subcircuit_id: this.subcircuit_id
8422
8431
  });
8432
+ if (debug6.enabled) {
8433
+ const graphicsObject = convertSrjToGraphicsObject(
8434
+ simpleRouteJson
8435
+ );
8436
+ graphicsObject.title = `autorouting-${this.props.name}`;
8437
+ global.debugGraphics?.push(graphicsObject);
8438
+ }
8423
8439
  this.root?.emit("autorouting:start", {
8424
8440
  subcircuit_id: this.subcircuit_id,
8425
8441
  componentDisplayName: this.getString(),
@@ -8438,11 +8454,11 @@ var Group = class extends NormalComponent {
8438
8454
  const routingPromise = new Promise(
8439
8455
  (resolve, reject) => {
8440
8456
  autorouter.on("complete", (event) => {
8441
- debug5(`[${this.getString()}] local autorouting complete`);
8457
+ debug6(`[${this.getString()}] local autorouting complete`);
8442
8458
  resolve(event.traces);
8443
8459
  });
8444
8460
  autorouter.on("error", (event) => {
8445
- debug5(
8461
+ debug6(
8446
8462
  `[${this.getString()}] local autorouting error: ${event.error.message}`
8447
8463
  );
8448
8464
  reject(event.error);
@@ -8499,30 +8515,30 @@ var Group = class extends NormalComponent {
8499
8515
  }
8500
8516
  }
8501
8517
  doInitialPcbTraceRender() {
8502
- const debug5 = Debug6("tscircuit:core:doInitialPcbTraceRender");
8518
+ const debug6 = Debug7("tscircuit:core:doInitialPcbTraceRender");
8503
8519
  if (!this.isSubcircuit) return;
8504
8520
  if (this.root?.pcbDisabled) return;
8505
8521
  if (this.getInheritedProperty("routingDisabled")) return;
8506
8522
  if (this._shouldUseTraceByTraceRouting()) return;
8507
8523
  if (!this._areChildSubcircuitsRouted()) {
8508
- debug5(
8524
+ debug6(
8509
8525
  `[${this.getString()}] child subcircuits are not routed, skipping async autorouting until subcircuits routed`
8510
8526
  );
8511
8527
  return;
8512
8528
  }
8513
- debug5(
8529
+ debug6(
8514
8530
  `[${this.getString()}] no child subcircuits to wait for, initiating async routing`
8515
8531
  );
8516
8532
  if (!this._hasTracesToRoute()) return;
8517
8533
  this._startAsyncAutorouting();
8518
8534
  }
8519
8535
  updatePcbTraceRender() {
8520
- const debug5 = Debug6("tscircuit:core:updatePcbTraceRender");
8521
- debug5(`[${this.getString()}] updating...`);
8536
+ const debug6 = Debug7("tscircuit:core:updatePcbTraceRender");
8537
+ debug6(`[${this.getString()}] updating...`);
8522
8538
  if (!this.isSubcircuit) return;
8523
8539
  if (this._shouldRouteAsync() && this._hasTracesToRoute() && !this._hasStartedAsyncAutorouting) {
8524
8540
  if (this._areChildSubcircuitsRouted()) {
8525
- debug5(
8541
+ debug6(
8526
8542
  `[${this.getString()}] child subcircuits are now routed, starting async autorouting`
8527
8543
  );
8528
8544
  this._startAsyncAutorouting();
@@ -8533,14 +8549,14 @@ var Group = class extends NormalComponent {
8533
8549
  if (this._shouldUseTraceByTraceRouting()) return;
8534
8550
  const { db } = this.root;
8535
8551
  if (this._asyncAutoroutingResult.output_simple_route_json) {
8536
- debug5(
8552
+ debug6(
8537
8553
  `[${this.getString()}] updating PCB traces from simple route json (${this._asyncAutoroutingResult.output_simple_route_json.traces?.length} traces)`
8538
8554
  );
8539
8555
  this._updatePcbTraceRenderFromSimpleRouteJson();
8540
8556
  return;
8541
8557
  }
8542
8558
  if (this._asyncAutoroutingResult.output_pcb_traces) {
8543
- debug5(
8559
+ debug6(
8544
8560
  `[${this.getString()}] updating PCB traces from ${this._asyncAutoroutingResult.output_pcb_traces.length} traces`
8545
8561
  );
8546
8562
  this._updatePcbTraceRenderFromPcbTraces();
@@ -11116,7 +11132,7 @@ import { identity as identity5 } from "transformation-matrix";
11116
11132
  var package_default = {
11117
11133
  name: "@tscircuit/core",
11118
11134
  type: "module",
11119
- version: "0.0.580",
11135
+ version: "0.0.581",
11120
11136
  types: "dist/index.d.ts",
11121
11137
  main: "dist/index.js",
11122
11138
  module: "dist/index.js",
@@ -11139,7 +11155,7 @@ var package_default = {
11139
11155
  },
11140
11156
  devDependencies: {
11141
11157
  "@biomejs/biome": "^1.8.3",
11142
- "@tscircuit/capacity-autorouter": "^0.0.93",
11158
+ "@tscircuit/capacity-autorouter": "^0.0.100",
11143
11159
  "@tscircuit/checks": "^0.0.56",
11144
11160
  "@tscircuit/circuit-json-flex": "^0.0.1",
11145
11161
  "@tscircuit/circuit-json-util": "^0.0.51",
@@ -11202,7 +11218,7 @@ var package_default = {
11202
11218
  dependencies: {
11203
11219
  "@flatten-js/core": "^1.6.2",
11204
11220
  "@lume/kiwi": "^0.4.3",
11205
- "calculate-packing": "0.0.3",
11221
+ "calculate-packing": "0.0.5",
11206
11222
  "css-select": "5.1.0",
11207
11223
  "format-si-unit": "^0.0.3",
11208
11224
  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.581",
4
+ "version": "0.0.582",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@biomejs/biome": "^1.8.3",
27
- "@tscircuit/capacity-autorouter": "^0.0.93",
27
+ "@tscircuit/capacity-autorouter": "^0.0.100",
28
28
  "@tscircuit/checks": "^0.0.56",
29
29
  "@tscircuit/circuit-json-flex": "^0.0.1",
30
30
  "@tscircuit/circuit-json-util": "^0.0.51",
@@ -87,7 +87,7 @@
87
87
  "dependencies": {
88
88
  "@flatten-js/core": "^1.6.2",
89
89
  "@lume/kiwi": "^0.4.3",
90
- "calculate-packing": "0.0.3",
90
+ "calculate-packing": "0.0.5",
91
91
  "css-select": "5.1.0",
92
92
  "format-si-unit": "^0.0.3",
93
93
  "nanoid": "^5.0.7",