@tscircuit/core 0.0.581 → 0.0.583
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 +44 -21
- 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
|
|
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
|
|
8295
|
+
const debug6 = Debug7("tscircuit:core:_hasTracesToRoute");
|
|
8287
8296
|
const traces = this.selectAll("trace");
|
|
8288
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
8416
|
-
|
|
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
|
-
|
|
8457
|
+
debug6(`[${this.getString()}] local autorouting complete`);
|
|
8442
8458
|
resolve(event.traces);
|
|
8443
8459
|
});
|
|
8444
8460
|
autorouter.on("error", (event) => {
|
|
8445
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
8521
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
8559
|
+
debug6(
|
|
8544
8560
|
`[${this.getString()}] updating PCB traces from ${this._asyncAutoroutingResult.output_pcb_traces.length} traces`
|
|
8545
8561
|
);
|
|
8546
8562
|
this._updatePcbTraceRenderFromPcbTraces();
|
|
@@ -8622,12 +8638,19 @@ var Group = class extends NormalComponent {
|
|
|
8622
8638
|
}
|
|
8623
8639
|
_getSchematicLayoutMode() {
|
|
8624
8640
|
const props = this._parsedProps;
|
|
8641
|
+
if (props.schLayout?.layoutMode === "none") return "none";
|
|
8625
8642
|
if (props.schLayout?.matchAdapt) return "match-adapt";
|
|
8626
8643
|
if (props.schLayout?.flex) return "flex";
|
|
8627
8644
|
if (props.schLayout?.grid) return "grid";
|
|
8628
8645
|
if (props.matchAdapt) return "match-adapt";
|
|
8629
8646
|
if (props.flex) return "flex";
|
|
8630
8647
|
if (props.grid) return "grid";
|
|
8648
|
+
const anyChildHasSchCoords = this.children.some((child) => {
|
|
8649
|
+
const cProps = child._parsedProps;
|
|
8650
|
+
return cProps?.schX !== void 0 || cProps?.schY !== void 0;
|
|
8651
|
+
});
|
|
8652
|
+
const hasManualEdits = (props.manualEdits?.schematic_placements?.length ?? 0) > 0;
|
|
8653
|
+
if (!anyChildHasSchCoords && !hasManualEdits) return "match-adapt";
|
|
8631
8654
|
return "none";
|
|
8632
8655
|
}
|
|
8633
8656
|
doInitialSchematicLayout() {
|
|
@@ -11116,7 +11139,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
11116
11139
|
var package_default = {
|
|
11117
11140
|
name: "@tscircuit/core",
|
|
11118
11141
|
type: "module",
|
|
11119
|
-
version: "0.0.
|
|
11142
|
+
version: "0.0.582",
|
|
11120
11143
|
types: "dist/index.d.ts",
|
|
11121
11144
|
main: "dist/index.js",
|
|
11122
11145
|
module: "dist/index.js",
|
|
@@ -11139,7 +11162,7 @@ var package_default = {
|
|
|
11139
11162
|
},
|
|
11140
11163
|
devDependencies: {
|
|
11141
11164
|
"@biomejs/biome": "^1.8.3",
|
|
11142
|
-
"@tscircuit/capacity-autorouter": "^0.0.
|
|
11165
|
+
"@tscircuit/capacity-autorouter": "^0.0.100",
|
|
11143
11166
|
"@tscircuit/checks": "^0.0.56",
|
|
11144
11167
|
"@tscircuit/circuit-json-flex": "^0.0.1",
|
|
11145
11168
|
"@tscircuit/circuit-json-util": "^0.0.51",
|
|
@@ -11202,7 +11225,7 @@ var package_default = {
|
|
|
11202
11225
|
dependencies: {
|
|
11203
11226
|
"@flatten-js/core": "^1.6.2",
|
|
11204
11227
|
"@lume/kiwi": "^0.4.3",
|
|
11205
|
-
"calculate-packing": "0.0.
|
|
11228
|
+
"calculate-packing": "0.0.5",
|
|
11206
11229
|
"css-select": "5.1.0",
|
|
11207
11230
|
"format-si-unit": "^0.0.3",
|
|
11208
11231
|
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.
|
|
4
|
+
"version": "0.0.583",
|
|
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.
|
|
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.
|
|
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",
|