@tscircuit/core 0.0.1283 → 0.0.1284
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 +3 -0
- package/dist/index.js +49 -13
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2315,6 +2315,8 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
|
|
|
2315
2315
|
_asyncAutoroutingResult: {
|
|
2316
2316
|
output_simple_route_json?: SimpleRouteJson;
|
|
2317
2317
|
output_pcb_traces?: (PcbTrace$1 | PcbVia$1)[];
|
|
2318
|
+
pcb_trace_ids_to_be_replaced?: string[];
|
|
2319
|
+
input_simple_route_json?: SimpleRouteJson;
|
|
2318
2320
|
output_jumpers?: Array<{
|
|
2319
2321
|
jumper_footprint: string;
|
|
2320
2322
|
center: {
|
|
@@ -73223,6 +73225,7 @@ declare class BaseBreakoutPoint<TProps extends ZodType = typeof baseBreakoutPoin
|
|
|
73223
73225
|
pcb_breakout_point_id: string | null;
|
|
73224
73226
|
matchedPort: Port | null;
|
|
73225
73227
|
matchedNet: Net | null;
|
|
73228
|
+
matchedSourceTraceId: string | null;
|
|
73226
73229
|
isPcbPrimitive: boolean;
|
|
73227
73230
|
_getSourceTraceIdForPort(port: Port): string | undefined;
|
|
73228
73231
|
_getSourceNetIdForPort(port: Port): string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -14572,7 +14572,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
14572
14572
|
};
|
|
14573
14573
|
}
|
|
14574
14574
|
const routedTraceIds = new Set(
|
|
14575
|
-
db.pcb_trace.list().map((t) => t.source_trace_id).filter((id) => Boolean(id))
|
|
14575
|
+
db.pcb_trace.list().filter((t) => !subcircuit_id || t.subcircuit_id === subcircuit_id).map((t) => t.source_trace_id).filter((id) => Boolean(id))
|
|
14576
14576
|
);
|
|
14577
14577
|
const sourcePortIdToBreakoutPoint = /* @__PURE__ */ new Map();
|
|
14578
14578
|
for (const bp of breakoutPoints) {
|
|
@@ -14705,6 +14705,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
14705
14705
|
if (bp.subcircuit_id === subcircuit_id) {
|
|
14706
14706
|
connectionsFromBreakoutPoints.push({
|
|
14707
14707
|
name: bpSourcePortId,
|
|
14708
|
+
source_trace_id: bp.source_trace_id,
|
|
14708
14709
|
pointsToConnect: [portPt, pt]
|
|
14709
14710
|
});
|
|
14710
14711
|
continue;
|
|
@@ -19477,11 +19478,12 @@ function addPossibleReplacementSourceTraceId(sourceTraceIds, value) {
|
|
|
19477
19478
|
}
|
|
19478
19479
|
function deleteExistingPcbTracesReplacedBy({
|
|
19479
19480
|
group,
|
|
19480
|
-
outputPcbTraces
|
|
19481
|
+
outputPcbTraces,
|
|
19482
|
+
pcbTraceIdsToReplace = []
|
|
19481
19483
|
}) {
|
|
19482
19484
|
const db = group.root?.db;
|
|
19483
19485
|
if (!db) return;
|
|
19484
|
-
const replacementPcbTraceIds =
|
|
19486
|
+
const replacementPcbTraceIds = new Set(pcbTraceIdsToReplace);
|
|
19485
19487
|
const replacementSourceTraceIds = /* @__PURE__ */ new Set();
|
|
19486
19488
|
for (const trace of outputPcbTraces) {
|
|
19487
19489
|
if (trace.type !== "pcb_trace") continue;
|
|
@@ -19505,7 +19507,7 @@ function deleteExistingPcbTracesReplacedBy({
|
|
|
19505
19507
|
}
|
|
19506
19508
|
const tracesToDelete = getExistingPcbTracesForReroute(group).filter(
|
|
19507
19509
|
(trace) => replacementPcbTraceIds.has(trace.pcb_trace_id) || Boolean(
|
|
19508
|
-
trace.source_trace_id && replacementSourceTraceIds.has(trace.source_trace_id)
|
|
19510
|
+
trace.source_trace_id && trace.subcircuit_id === group.subcircuit_id && replacementSourceTraceIds.has(trace.source_trace_id)
|
|
19509
19511
|
)
|
|
19510
19512
|
);
|
|
19511
19513
|
if (tracesToDelete.length === 0) return;
|
|
@@ -20157,6 +20159,7 @@ var Group5 = class extends NormalComponent3 {
|
|
|
20157
20159
|
const hasPhasedAutorouting = Group_hasPhasedAutorouting(routingPhasePlans);
|
|
20158
20160
|
const outputTraces = [];
|
|
20159
20161
|
const outputJumpers = [];
|
|
20162
|
+
const pcbTraceIdsToDelete = /* @__PURE__ */ new Set();
|
|
20160
20163
|
const existingRerouteSeedTraces = getExistingSimplifiedPcbTracesForReroute(this);
|
|
20161
20164
|
const traceMatchesRoutingPhase = (trace, routingPhasePlan) => {
|
|
20162
20165
|
const connectionName = trace.connection_name ?? trace.pcb_trace_id;
|
|
@@ -20329,6 +20332,11 @@ var Group5 = class extends NormalComponent3 {
|
|
|
20329
20332
|
outputJumpers.push(...solver.getOutputJumpers() || []);
|
|
20330
20333
|
}
|
|
20331
20334
|
if (isRegionReroutePhase && rerouteOriginalSrj) {
|
|
20335
|
+
for (const trace of rerouteOriginalSrj.traces ?? []) {
|
|
20336
|
+
if (trace.type === "pcb_trace") {
|
|
20337
|
+
pcbTraceIdsToDelete.add(trace.pcb_trace_id);
|
|
20338
|
+
}
|
|
20339
|
+
}
|
|
20332
20340
|
const reconnectedSrj = reconnectReroutedSimpleRouteJsonRegion(
|
|
20333
20341
|
rerouteOriginalSrj,
|
|
20334
20342
|
{
|
|
@@ -20375,7 +20383,9 @@ var Group5 = class extends NormalComponent3 {
|
|
|
20375
20383
|
}
|
|
20376
20384
|
this._asyncAutoroutingResult = {
|
|
20377
20385
|
output_pcb_traces: outputTraces,
|
|
20378
|
-
output_jumpers: outputJumpers
|
|
20386
|
+
output_jumpers: outputJumpers,
|
|
20387
|
+
pcb_trace_ids_to_be_replaced: [...pcbTraceIdsToDelete],
|
|
20388
|
+
input_simple_route_json: baseSimpleRouteJson
|
|
20379
20389
|
};
|
|
20380
20390
|
this._markDirty("PcbTraceRender");
|
|
20381
20391
|
}
|
|
@@ -20474,7 +20484,12 @@ var Group5 = class extends NormalComponent3 {
|
|
|
20474
20484
|
}
|
|
20475
20485
|
}
|
|
20476
20486
|
_updatePcbTraceRenderFromPcbTraces() {
|
|
20477
|
-
const {
|
|
20487
|
+
const {
|
|
20488
|
+
output_pcb_traces,
|
|
20489
|
+
output_jumpers,
|
|
20490
|
+
pcb_trace_ids_to_be_replaced,
|
|
20491
|
+
input_simple_route_json
|
|
20492
|
+
} = this._asyncAutoroutingResult;
|
|
20478
20493
|
if (!output_pcb_traces) return;
|
|
20479
20494
|
const { db } = this.root;
|
|
20480
20495
|
const pcbStyle = this.getInheritedMergedProperty("pcbStyle");
|
|
@@ -20491,12 +20506,26 @@ var Group5 = class extends NormalComponent3 {
|
|
|
20491
20506
|
}
|
|
20492
20507
|
deleteExistingPcbTracesReplacedBy({
|
|
20493
20508
|
group: this,
|
|
20494
|
-
outputPcbTraces: output_pcb_traces
|
|
20495
|
-
|
|
20509
|
+
outputPcbTraces: output_pcb_traces,
|
|
20510
|
+
pcbTraceIdsToReplace: pcb_trace_ids_to_be_replaced
|
|
20511
|
+
});
|
|
20512
|
+
const sourceTraceIdByConnectionName = /* @__PURE__ */ new Map();
|
|
20513
|
+
for (const connection of input_simple_route_json?.connections ?? []) {
|
|
20514
|
+
if (connection.source_trace_id) {
|
|
20515
|
+
sourceTraceIdByConnectionName.set(
|
|
20516
|
+
connection.name,
|
|
20517
|
+
connection.source_trace_id
|
|
20518
|
+
);
|
|
20519
|
+
}
|
|
20520
|
+
}
|
|
20496
20521
|
for (const pcb_trace of output_pcb_traces) {
|
|
20497
20522
|
if (pcb_trace.type !== "pcb_trace") continue;
|
|
20523
|
+
const inputConnectionSourceTraceId = sourceTraceIdByConnectionName.get(
|
|
20524
|
+
pcb_trace.connection_name
|
|
20525
|
+
);
|
|
20498
20526
|
const possibleSourceTraceIds = [
|
|
20499
20527
|
...getSourceTraceIdsFromRerouteName(pcb_trace.source_trace_id),
|
|
20528
|
+
...inputConnectionSourceTraceId ? [inputConnectionSourceTraceId] : [],
|
|
20500
20529
|
...getSourceTraceIdsFromRerouteName(pcb_trace.connection_name),
|
|
20501
20530
|
...getSourceTraceIdsFromRerouteName(
|
|
20502
20531
|
pcb_trace.rootConnectionName
|
|
@@ -20515,7 +20544,7 @@ var Group5 = class extends NormalComponent3 {
|
|
|
20515
20544
|
} else {
|
|
20516
20545
|
delete pcb_trace.source_trace_id;
|
|
20517
20546
|
}
|
|
20518
|
-
pcb_trace.subcircuit_id ??=
|
|
20547
|
+
pcb_trace.subcircuit_id ??= this.subcircuit_id;
|
|
20519
20548
|
const cjRoute = pcb_trace.route.map((point6) => {
|
|
20520
20549
|
if (point6.route_type !== "through_obstacle") return point6;
|
|
20521
20550
|
return {
|
|
@@ -21867,7 +21896,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
21867
21896
|
var package_default = {
|
|
21868
21897
|
name: "@tscircuit/core",
|
|
21869
21898
|
type: "module",
|
|
21870
|
-
version: "0.0.
|
|
21899
|
+
version: "0.0.1283",
|
|
21871
21900
|
types: "dist/index.d.ts",
|
|
21872
21901
|
main: "dist/index.js",
|
|
21873
21902
|
module: "dist/index.js",
|
|
@@ -25604,6 +25633,7 @@ var BaseBreakoutPoint = class extends PrimitiveComponent2 {
|
|
|
25604
25633
|
pcb_breakout_point_id = null;
|
|
25605
25634
|
matchedPort = null;
|
|
25606
25635
|
matchedNet = null;
|
|
25636
|
+
matchedSourceTraceId = null;
|
|
25607
25637
|
isPcbPrimitive = true;
|
|
25608
25638
|
_getSourceTraceIdForPort(port) {
|
|
25609
25639
|
const { db } = this.root;
|
|
@@ -25627,7 +25657,7 @@ var BaseBreakoutPoint = class extends PrimitiveComponent2 {
|
|
|
25627
25657
|
pcb_group_id: group.pcb_group_id,
|
|
25628
25658
|
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
25629
25659
|
source_port_id: this.matchedPort?.source_port_id ?? void 0,
|
|
25630
|
-
source_trace_id: this.matchedPort ? this._getSourceTraceIdForPort(this.matchedPort) : void 0,
|
|
25660
|
+
source_trace_id: this.matchedPort ? this.matchedSourceTraceId ?? this._getSourceTraceIdForPort(this.matchedPort) : void 0,
|
|
25631
25661
|
source_net_id: this.matchedNet ? this.matchedNet.source_net_id : this.matchedPort ? this._getSourceNetIdForPort(this.matchedPort) : void 0,
|
|
25632
25662
|
x: position.x,
|
|
25633
25663
|
y: position.y
|
|
@@ -25651,10 +25681,14 @@ var BaseBreakoutPoint = class extends PrimitiveComponent2 {
|
|
|
25651
25681
|
_setPositionFromLayout(newCenter) {
|
|
25652
25682
|
const { db } = this.root;
|
|
25653
25683
|
if (!this.pcb_breakout_point_id) return;
|
|
25654
|
-
|
|
25684
|
+
const updatedProperties = {
|
|
25655
25685
|
x: newCenter.x,
|
|
25656
25686
|
y: newCenter.y
|
|
25657
|
-
}
|
|
25687
|
+
};
|
|
25688
|
+
if (this.matchedSourceTraceId) {
|
|
25689
|
+
updatedProperties.source_trace_id = this.matchedSourceTraceId;
|
|
25690
|
+
}
|
|
25691
|
+
db.pcb_breakout_point.update(this.pcb_breakout_point_id, updatedProperties);
|
|
25658
25692
|
}
|
|
25659
25693
|
_moveCircuitJsonElements({
|
|
25660
25694
|
deltaX,
|
|
@@ -25859,6 +25893,7 @@ var Breakout = class extends Group5 {
|
|
|
25859
25893
|
autoPlacedPorts.add(port);
|
|
25860
25894
|
const breakoutPoint = new AutoplacedBreakoutPoint({});
|
|
25861
25895
|
breakoutPoint.matchedPort = port;
|
|
25896
|
+
breakoutPoint.matchedSourceTraceId = trace.source_trace_id;
|
|
25862
25897
|
this.add(breakoutPoint);
|
|
25863
25898
|
}
|
|
25864
25899
|
}
|
|
@@ -25878,6 +25913,7 @@ var Breakout = class extends Group5 {
|
|
|
25878
25913
|
(child) => child.matchedPort?.source_port_id === solvedPoint.sourcePortId
|
|
25879
25914
|
);
|
|
25880
25915
|
if (matchingBreakoutPoint) {
|
|
25916
|
+
matchingBreakoutPoint.matchedSourceTraceId = solvedPoint.sourceTraceId;
|
|
25881
25917
|
matchingBreakoutPoint._setPositionFromLayout({
|
|
25882
25918
|
x: solvedPoint.x,
|
|
25883
25919
|
y: solvedPoint.y
|