@tscircuit/core 0.0.525 → 0.0.527
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 +75 -15
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4720,6 +4720,34 @@ var getObstaclesFromCircuitJson = (soup, connMap) => {
|
|
|
4720
4720
|
return obstacles;
|
|
4721
4721
|
};
|
|
4722
4722
|
|
|
4723
|
+
// lib/utils/schematic/computeSchematicNetLabelCenter.ts
|
|
4724
|
+
var computeSchematicNetLabelCenter = ({
|
|
4725
|
+
anchor_position,
|
|
4726
|
+
anchor_side,
|
|
4727
|
+
text,
|
|
4728
|
+
font_size = 0.18
|
|
4729
|
+
}) => {
|
|
4730
|
+
const charWidth = 0.1 * (font_size / 0.18);
|
|
4731
|
+
const width = text.length * charWidth;
|
|
4732
|
+
const height = font_size;
|
|
4733
|
+
const center = { ...anchor_position };
|
|
4734
|
+
switch (anchor_side) {
|
|
4735
|
+
case "right":
|
|
4736
|
+
center.x -= width / 2;
|
|
4737
|
+
break;
|
|
4738
|
+
case "left":
|
|
4739
|
+
center.x += width / 2;
|
|
4740
|
+
break;
|
|
4741
|
+
case "top":
|
|
4742
|
+
center.y -= height / 2;
|
|
4743
|
+
break;
|
|
4744
|
+
case "bottom":
|
|
4745
|
+
center.y += height / 2;
|
|
4746
|
+
break;
|
|
4747
|
+
}
|
|
4748
|
+
return center;
|
|
4749
|
+
};
|
|
4750
|
+
|
|
4723
4751
|
// lib/components/primitive-components/Trace/Trace.ts
|
|
4724
4752
|
var portToObjective = (port) => {
|
|
4725
4753
|
const portPosition = port._getGlobalPcbPositionAfterLayout();
|
|
@@ -5287,21 +5315,31 @@ var Trace2 = class extends PrimitiveComponent2 {
|
|
|
5287
5315
|
existingToNetLabel.text = `${netLabelText} / ${existingToNetLabel.text}`;
|
|
5288
5316
|
}
|
|
5289
5317
|
if (!existingToNetLabel) {
|
|
5318
|
+
const toSide = getEnteringEdgeFromDirection(toPort.facingDirection) ?? "bottom";
|
|
5290
5319
|
db.schematic_net_label.insert({
|
|
5291
5320
|
text: this.props.schDisplayLabel ?? pinFullName,
|
|
5292
5321
|
source_net_id: toPort.source_port_id,
|
|
5293
5322
|
anchor_position: toAnchorPos,
|
|
5294
|
-
center:
|
|
5295
|
-
|
|
5323
|
+
center: computeSchematicNetLabelCenter({
|
|
5324
|
+
anchor_position: toAnchorPos,
|
|
5325
|
+
anchor_side: toSide,
|
|
5326
|
+
text: this.props.schDisplayLabel ?? pinFullName
|
|
5327
|
+
}),
|
|
5328
|
+
anchor_side: toSide
|
|
5296
5329
|
});
|
|
5297
5330
|
}
|
|
5298
5331
|
if (!existingFromNetLabel) {
|
|
5332
|
+
const fromSide = getEnteringEdgeFromDirection(fromPort.facingDirection) ?? "bottom";
|
|
5299
5333
|
db.schematic_net_label.insert({
|
|
5300
5334
|
text: this.props.schDisplayLabel ?? pinFullName,
|
|
5301
5335
|
source_net_id: fromPort.source_port_id,
|
|
5302
5336
|
anchor_position: fromAnchorPos,
|
|
5303
|
-
center:
|
|
5304
|
-
|
|
5337
|
+
center: computeSchematicNetLabelCenter({
|
|
5338
|
+
anchor_position: fromAnchorPos,
|
|
5339
|
+
anchor_side: fromSide,
|
|
5340
|
+
text: this.props.schDisplayLabel ?? pinFullName
|
|
5341
|
+
}),
|
|
5342
|
+
anchor_side: fromSide
|
|
5305
5343
|
});
|
|
5306
5344
|
}
|
|
5307
5345
|
}
|
|
@@ -5398,22 +5436,31 @@ var Trace2 = class extends PrimitiveComponent2 {
|
|
|
5398
5436
|
return;
|
|
5399
5437
|
}
|
|
5400
5438
|
if (this.props.schDisplayLabel) {
|
|
5439
|
+
const side2 = getEnteringEdgeFromDirection(port.facingDirection) ?? "bottom";
|
|
5401
5440
|
db.schematic_net_label.insert({
|
|
5402
5441
|
text: this.props.schDisplayLabel,
|
|
5403
5442
|
source_net_id: net.source_net_id,
|
|
5404
5443
|
anchor_position: anchorPos,
|
|
5405
|
-
center:
|
|
5406
|
-
|
|
5444
|
+
center: computeSchematicNetLabelCenter({
|
|
5445
|
+
anchor_position: anchorPos,
|
|
5446
|
+
anchor_side: side2,
|
|
5447
|
+
text: this.props.schDisplayLabel
|
|
5448
|
+
}),
|
|
5449
|
+
anchor_side: side2
|
|
5407
5450
|
});
|
|
5408
5451
|
return;
|
|
5409
5452
|
}
|
|
5453
|
+
const side = getEnteringEdgeFromDirection(port.facingDirection) ?? "bottom";
|
|
5410
5454
|
const netLabel = db.schematic_net_label.insert({
|
|
5411
5455
|
text: net._parsedProps.name,
|
|
5412
5456
|
source_net_id: net.source_net_id,
|
|
5413
5457
|
anchor_position: anchorPos,
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5458
|
+
center: computeSchematicNetLabelCenter({
|
|
5459
|
+
anchor_position: anchorPos,
|
|
5460
|
+
anchor_side: side,
|
|
5461
|
+
text: net._parsedProps.name
|
|
5462
|
+
}),
|
|
5463
|
+
anchor_side: side
|
|
5417
5464
|
});
|
|
5418
5465
|
return;
|
|
5419
5466
|
}
|
|
@@ -7334,7 +7381,11 @@ function Group_doInitialSchematicLayoutMatchAdapt(group) {
|
|
|
7334
7381
|
text: nl.netId,
|
|
7335
7382
|
source_net_id: srcNet?.source_net_id,
|
|
7336
7383
|
anchor_position: { x: nl.x, y: nl.y },
|
|
7337
|
-
center: {
|
|
7384
|
+
center: computeSchematicNetLabelCenter({
|
|
7385
|
+
anchor_position: { x: nl.x, y: nl.y },
|
|
7386
|
+
anchor_side: nl.anchorPosition,
|
|
7387
|
+
text: nl.netId
|
|
7388
|
+
}),
|
|
7338
7389
|
anchor_side: nl.anchorPosition
|
|
7339
7390
|
});
|
|
7340
7391
|
}
|
|
@@ -7958,11 +8009,15 @@ var Group = class extends NormalComponent {
|
|
|
7958
8009
|
const debug4 = Debug5("tscircuit:core:_runLocalAutorouting");
|
|
7959
8010
|
debug4(`[${this.getString()}] starting local autorouting`);
|
|
7960
8011
|
const autorouterConfig = this._getAutorouterConfig();
|
|
7961
|
-
const
|
|
8012
|
+
const sourceTraceIdsToRoute = this.selectAll("trace").filter((t) => !t.pcb_trace_id).map((t) => t.source_trace_id);
|
|
8013
|
+
const { simpleRouteJson } = getSimpleRouteJsonFromCircuitJson({
|
|
7962
8014
|
db,
|
|
7963
8015
|
minTraceWidth: this.props.autorouter?.minTraceWidth ?? 0.15,
|
|
7964
8016
|
subcircuit_id: this.subcircuit_id
|
|
7965
8017
|
});
|
|
8018
|
+
simpleRouteJson.connections = simpleRouteJson.connections.filter(
|
|
8019
|
+
(conn) => sourceTraceIdsToRoute.includes(conn.name)
|
|
8020
|
+
);
|
|
7966
8021
|
this.root?.emit("autorouting:start", {
|
|
7967
8022
|
subcircuit_id: this.subcircuit_id,
|
|
7968
8023
|
componentDisplayName: this.getString(),
|
|
@@ -9448,12 +9503,17 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
9448
9503
|
const net = this.getSubcircuit().selectOne(
|
|
9449
9504
|
`net.${this._getNetName()}`
|
|
9450
9505
|
);
|
|
9506
|
+
const anchorSide = props.anchorSide ?? "right";
|
|
9507
|
+
const center = computeSchematicNetLabelCenter({
|
|
9508
|
+
anchor_position: anchorPos,
|
|
9509
|
+
anchor_side: anchorSide,
|
|
9510
|
+
text: props.net
|
|
9511
|
+
});
|
|
9451
9512
|
const netLabel = db.schematic_net_label.insert({
|
|
9452
9513
|
text: props.net,
|
|
9453
9514
|
source_net_id: net.source_net_id,
|
|
9454
9515
|
anchor_position: anchorPos,
|
|
9455
|
-
|
|
9456
|
-
center: anchorPos,
|
|
9516
|
+
center,
|
|
9457
9517
|
anchor_side: this._getAnchorSide()
|
|
9458
9518
|
});
|
|
9459
9519
|
this.source_net_label_id = netLabel.source_net_id;
|
|
@@ -10598,7 +10658,7 @@ import { identity as identity4 } from "transformation-matrix";
|
|
|
10598
10658
|
var package_default = {
|
|
10599
10659
|
name: "@tscircuit/core",
|
|
10600
10660
|
type: "module",
|
|
10601
|
-
version: "0.0.
|
|
10661
|
+
version: "0.0.526",
|
|
10602
10662
|
types: "dist/index.d.ts",
|
|
10603
10663
|
main: "dist/index.js",
|
|
10604
10664
|
module: "dist/index.js",
|
|
@@ -10639,7 +10699,7 @@ var package_default = {
|
|
|
10639
10699
|
"@types/react": "^19.0.1",
|
|
10640
10700
|
"@types/react-dom": "^19.0.2",
|
|
10641
10701
|
"@types/react-reconciler": "^0.28.9",
|
|
10642
|
-
"bun-match-svg": "0.0.
|
|
10702
|
+
"bun-match-svg": "0.0.11",
|
|
10643
10703
|
"chokidar-cli": "^3.0.0",
|
|
10644
10704
|
"circuit-json": "^0.0.212",
|
|
10645
10705
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
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.527",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@types/react": "^19.0.1",
|
|
43
43
|
"@types/react-dom": "^19.0.2",
|
|
44
44
|
"@types/react-reconciler": "^0.28.9",
|
|
45
|
-
"bun-match-svg": "0.0.
|
|
45
|
+
"bun-match-svg": "0.0.11",
|
|
46
46
|
"chokidar-cli": "^3.0.0",
|
|
47
47
|
"circuit-json": "^0.0.212",
|
|
48
48
|
"circuit-json-to-connectivity-map": "^0.0.22",
|