@tscircuit/core 0.0.619 → 0.0.621
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 +1 -0
- package/dist/index.js +324 -29
- package/package.json +5 -3
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
|
|
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) {
|
|
@@ -8351,8 +8640,8 @@ import {
|
|
|
8351
8640
|
transformPCBElements as transformPCBElements2
|
|
8352
8641
|
} from "@tscircuit/circuit-json-util";
|
|
8353
8642
|
import { translate as translate6, rotate as rotate2, compose as compose4 } from "transformation-matrix";
|
|
8354
|
-
import
|
|
8355
|
-
var
|
|
8643
|
+
import Debug7 from "debug";
|
|
8644
|
+
var debug6 = Debug7("Group_doInitialPcbLayoutPack");
|
|
8356
8645
|
var Group_doInitialPcbLayoutPack = (group) => {
|
|
8357
8646
|
const { db } = group.root;
|
|
8358
8647
|
const { _parsedProps: props } = group;
|
|
@@ -8372,12 +8661,13 @@ var Group_doInitialPcbLayoutPack = (group) => {
|
|
|
8372
8661
|
source_group_id: group.source_group_id
|
|
8373
8662
|
})
|
|
8374
8663
|
),
|
|
8664
|
+
// @ts-expect-error we're missing some pack order strategies
|
|
8375
8665
|
orderStrategy: packOrderStrategy ?? "largest_to_smallest",
|
|
8376
|
-
placementStrategy: packPlacementStrategy ?? "
|
|
8666
|
+
placementStrategy: packPlacementStrategy ?? "minimum_sum_squared_distance_to_network",
|
|
8377
8667
|
minGap: gapMm
|
|
8378
8668
|
};
|
|
8379
8669
|
const packOutput = pack(packInput);
|
|
8380
|
-
if (
|
|
8670
|
+
if (debug6.enabled) {
|
|
8381
8671
|
const graphics = getGraphicsFromPackOutput(packOutput);
|
|
8382
8672
|
graphics.title = `packOutput-${group.name}`;
|
|
8383
8673
|
global.debugGraphics?.push(graphics);
|
|
@@ -8390,7 +8680,7 @@ var Group_doInitialPcbLayoutPack = (group) => {
|
|
|
8390
8680
|
const transformMatrix2 = compose4(
|
|
8391
8681
|
group._computePcbGlobalTransformBeforeLayout(),
|
|
8392
8682
|
translate6(center.x, center.y),
|
|
8393
|
-
rotate2(ccwRotationOffset || 0),
|
|
8683
|
+
rotate2((ccwRotationOffset || 0) * Math.PI / 180),
|
|
8394
8684
|
translate6(-originalCenter2.x, -originalCenter2.y)
|
|
8395
8685
|
);
|
|
8396
8686
|
const related = db.toArray().filter(
|
|
@@ -8416,7 +8706,7 @@ var Group_doInitialPcbLayoutPack = (group) => {
|
|
|
8416
8706
|
|
|
8417
8707
|
// lib/components/primitive-components/Group/Group_doInitialPcbLayoutFlex.ts
|
|
8418
8708
|
import {
|
|
8419
|
-
getCircuitJsonTree,
|
|
8709
|
+
getCircuitJsonTree as getCircuitJsonTree2,
|
|
8420
8710
|
repositionPcbComponentTo,
|
|
8421
8711
|
repositionPcbGroupTo,
|
|
8422
8712
|
getMinimumFlexContainer
|
|
@@ -8450,7 +8740,7 @@ var getSizeOfTreeNodeChild = (db, child) => {
|
|
|
8450
8740
|
var Group_doInitialPcbLayoutFlex = (group) => {
|
|
8451
8741
|
const { db } = group.root;
|
|
8452
8742
|
const { _parsedProps: props } = group;
|
|
8453
|
-
const tree =
|
|
8743
|
+
const tree = getCircuitJsonTree2(db.toArray(), {
|
|
8454
8744
|
source_group_id: group.source_group_id
|
|
8455
8745
|
});
|
|
8456
8746
|
const rawJustify = props.pcbJustifyContent ?? props.justifyContent;
|
|
@@ -8746,20 +9036,20 @@ var Group = class extends NormalComponent {
|
|
|
8746
9036
|
return false;
|
|
8747
9037
|
}
|
|
8748
9038
|
_hasTracesToRoute() {
|
|
8749
|
-
const
|
|
9039
|
+
const debug7 = Debug8("tscircuit:core:_hasTracesToRoute");
|
|
8750
9040
|
const traces = this.selectAll("trace");
|
|
8751
|
-
|
|
9041
|
+
debug7(`[${this.getString()}] has ${traces.length} traces to route`);
|
|
8752
9042
|
return traces.length > 0;
|
|
8753
9043
|
}
|
|
8754
9044
|
async _runEffectMakeHttpAutoroutingRequest() {
|
|
8755
9045
|
const { db } = this.root;
|
|
8756
|
-
const
|
|
9046
|
+
const debug7 = Debug8("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");
|
|
8757
9047
|
const props = this._parsedProps;
|
|
8758
9048
|
const autorouterConfig = this._getAutorouterConfig();
|
|
8759
9049
|
const serverUrl = autorouterConfig.serverUrl;
|
|
8760
9050
|
const serverMode = autorouterConfig.serverMode;
|
|
8761
9051
|
const fetchWithDebug = (url, options) => {
|
|
8762
|
-
|
|
9052
|
+
debug7("fetching", url);
|
|
8763
9053
|
if (options.headers) {
|
|
8764
9054
|
options.headers["Tscircuit-Core-Version"] = this.root?.getCoreVersion();
|
|
8765
9055
|
}
|
|
@@ -8875,15 +9165,15 @@ var Group = class extends NormalComponent {
|
|
|
8875
9165
|
async _runLocalAutorouting() {
|
|
8876
9166
|
const { db } = this.root;
|
|
8877
9167
|
const props = this._parsedProps;
|
|
8878
|
-
const
|
|
8879
|
-
|
|
9168
|
+
const debug7 = Debug8("tscircuit:core:_runLocalAutorouting");
|
|
9169
|
+
debug7(`[${this.getString()}] starting local autorouting`);
|
|
8880
9170
|
const autorouterConfig = this._getAutorouterConfig();
|
|
8881
9171
|
const { simpleRouteJson } = getSimpleRouteJsonFromCircuitJson({
|
|
8882
9172
|
db,
|
|
8883
9173
|
minTraceWidth: this.props.autorouter?.minTraceWidth ?? 0.15,
|
|
8884
9174
|
subcircuit_id: this.subcircuit_id
|
|
8885
9175
|
});
|
|
8886
|
-
if (
|
|
9176
|
+
if (debug7.enabled) {
|
|
8887
9177
|
const graphicsObject = convertSrjToGraphicsObject(
|
|
8888
9178
|
simpleRouteJson
|
|
8889
9179
|
);
|
|
@@ -8908,11 +9198,11 @@ var Group = class extends NormalComponent {
|
|
|
8908
9198
|
const routingPromise = new Promise(
|
|
8909
9199
|
(resolve, reject) => {
|
|
8910
9200
|
autorouter.on("complete", (event) => {
|
|
8911
|
-
|
|
9201
|
+
debug7(`[${this.getString()}] local autorouting complete`);
|
|
8912
9202
|
resolve(event.traces);
|
|
8913
9203
|
});
|
|
8914
9204
|
autorouter.on("error", (event) => {
|
|
8915
|
-
|
|
9205
|
+
debug7(
|
|
8916
9206
|
`[${this.getString()}] local autorouting error: ${event.error.message}`
|
|
8917
9207
|
);
|
|
8918
9208
|
reject(event.error);
|
|
@@ -8969,30 +9259,30 @@ var Group = class extends NormalComponent {
|
|
|
8969
9259
|
}
|
|
8970
9260
|
}
|
|
8971
9261
|
doInitialPcbTraceRender() {
|
|
8972
|
-
const
|
|
9262
|
+
const debug7 = Debug8("tscircuit:core:doInitialPcbTraceRender");
|
|
8973
9263
|
if (!this.isSubcircuit) return;
|
|
8974
9264
|
if (this.root?.pcbDisabled) return;
|
|
8975
9265
|
if (this.getInheritedProperty("routingDisabled")) return;
|
|
8976
9266
|
if (this._shouldUseTraceByTraceRouting()) return;
|
|
8977
9267
|
if (!this._areChildSubcircuitsRouted()) {
|
|
8978
|
-
|
|
9268
|
+
debug7(
|
|
8979
9269
|
`[${this.getString()}] child subcircuits are not routed, skipping async autorouting until subcircuits routed`
|
|
8980
9270
|
);
|
|
8981
9271
|
return;
|
|
8982
9272
|
}
|
|
8983
|
-
|
|
9273
|
+
debug7(
|
|
8984
9274
|
`[${this.getString()}] no child subcircuits to wait for, initiating async routing`
|
|
8985
9275
|
);
|
|
8986
9276
|
if (!this._hasTracesToRoute()) return;
|
|
8987
9277
|
this._startAsyncAutorouting();
|
|
8988
9278
|
}
|
|
8989
9279
|
updatePcbTraceRender() {
|
|
8990
|
-
const
|
|
8991
|
-
|
|
9280
|
+
const debug7 = Debug8("tscircuit:core:updatePcbTraceRender");
|
|
9281
|
+
debug7(`[${this.getString()}] updating...`);
|
|
8992
9282
|
if (!this.isSubcircuit) return;
|
|
8993
9283
|
if (this._shouldRouteAsync() && this._hasTracesToRoute() && !this._hasStartedAsyncAutorouting) {
|
|
8994
9284
|
if (this._areChildSubcircuitsRouted()) {
|
|
8995
|
-
|
|
9285
|
+
debug7(
|
|
8996
9286
|
`[${this.getString()}] child subcircuits are now routed, starting async autorouting`
|
|
8997
9287
|
);
|
|
8998
9288
|
this._startAsyncAutorouting();
|
|
@@ -9003,14 +9293,14 @@ var Group = class extends NormalComponent {
|
|
|
9003
9293
|
if (this._shouldUseTraceByTraceRouting()) return;
|
|
9004
9294
|
const { db } = this.root;
|
|
9005
9295
|
if (this._asyncAutoroutingResult.output_simple_route_json) {
|
|
9006
|
-
|
|
9296
|
+
debug7(
|
|
9007
9297
|
`[${this.getString()}] updating PCB traces from simple route json (${this._asyncAutoroutingResult.output_simple_route_json.traces?.length} traces)`
|
|
9008
9298
|
);
|
|
9009
9299
|
this._updatePcbTraceRenderFromSimpleRouteJson();
|
|
9010
9300
|
return;
|
|
9011
9301
|
}
|
|
9012
9302
|
if (this._asyncAutoroutingResult.output_pcb_traces) {
|
|
9013
|
-
|
|
9303
|
+
debug7(
|
|
9014
9304
|
`[${this.getString()}] updating PCB traces from ${this._asyncAutoroutingResult.output_pcb_traces.length} traces`
|
|
9015
9305
|
);
|
|
9016
9306
|
this._updatePcbTraceRenderFromPcbTraces();
|
|
@@ -9116,7 +9406,7 @@ var Group = class extends NormalComponent {
|
|
|
9116
9406
|
const props = this._parsedProps;
|
|
9117
9407
|
const schematicLayoutMode = this._getSchematicLayoutMode();
|
|
9118
9408
|
if (schematicLayoutMode === "match-adapt") {
|
|
9119
|
-
this.
|
|
9409
|
+
this._doInitialSchematicLayoutMatchpack();
|
|
9120
9410
|
}
|
|
9121
9411
|
if (schematicLayoutMode === "grid") {
|
|
9122
9412
|
this._doInitialSchematicLayoutGrid();
|
|
@@ -9126,6 +9416,9 @@ var Group = class extends NormalComponent {
|
|
|
9126
9416
|
_doInitialSchematicLayoutMatchAdapt() {
|
|
9127
9417
|
Group_doInitialSchematicLayoutMatchAdapt(this);
|
|
9128
9418
|
}
|
|
9419
|
+
_doInitialSchematicLayoutMatchpack() {
|
|
9420
|
+
Group_doInitialSchematicLayoutMatchPack(this);
|
|
9421
|
+
}
|
|
9129
9422
|
_doInitialSchematicLayoutGrid() {
|
|
9130
9423
|
Group_doInitialSchematicLayoutGrid(this);
|
|
9131
9424
|
}
|
|
@@ -11752,7 +12045,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
11752
12045
|
var package_default = {
|
|
11753
12046
|
name: "@tscircuit/core",
|
|
11754
12047
|
type: "module",
|
|
11755
|
-
version: "0.0.
|
|
12048
|
+
version: "0.0.620",
|
|
11756
12049
|
types: "dist/index.d.ts",
|
|
11757
12050
|
main: "dist/index.js",
|
|
11758
12051
|
module: "dist/index.js",
|
|
@@ -11814,7 +12107,8 @@ var package_default = {
|
|
|
11814
12107
|
"react-dom": "^19.1.0",
|
|
11815
12108
|
"schematic-symbols": "^0.0.180",
|
|
11816
12109
|
"ts-expect": "^1.3.0",
|
|
11817
|
-
tsup: "^8.2.4"
|
|
12110
|
+
tsup: "^8.2.4",
|
|
12111
|
+
"@tscircuit/matchpack": "^0.0.4"
|
|
11818
12112
|
},
|
|
11819
12113
|
peerDependencies: {
|
|
11820
12114
|
"@tscircuit/capacity-autorouter": "*",
|
|
@@ -11829,6 +12123,7 @@ var package_default = {
|
|
|
11829
12123
|
"@tscircuit/schematic-corpus": "*",
|
|
11830
12124
|
"circuit-json-to-bpc": "*",
|
|
11831
12125
|
"bpc-graph": "*",
|
|
12126
|
+
"@tscircuit/matchpack": "*",
|
|
11832
12127
|
"circuit-json": "*",
|
|
11833
12128
|
"circuit-json-to-connectivity-map": "*",
|
|
11834
12129
|
"schematic-symbols": "*",
|
|
@@ -11837,7 +12132,7 @@ var package_default = {
|
|
|
11837
12132
|
dependencies: {
|
|
11838
12133
|
"@flatten-js/core": "^1.6.2",
|
|
11839
12134
|
"@lume/kiwi": "^0.4.3",
|
|
11840
|
-
"calculate-packing": "0.0.
|
|
12135
|
+
"calculate-packing": "0.0.17",
|
|
11841
12136
|
"css-select": "5.1.0",
|
|
11842
12137
|
"format-si-unit": "^0.0.3",
|
|
11843
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.
|
|
4
|
+
"version": "0.0.621",
|
|
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.4"
|
|
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.
|
|
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",
|