@tscircuit/core 0.0.158 → 0.0.160
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 +0 -1
- package/dist/index.js +32 -12
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2532,6 +2532,7 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
2532
2532
|
}
|
|
2533
2533
|
_doInitialSchematicComponentRenderWithSymbol() {
|
|
2534
2534
|
const { db } = this.root;
|
|
2535
|
+
const { _parsedProps: props } = this;
|
|
2535
2536
|
const base_symbol_name = this.config.schematicSymbolName;
|
|
2536
2537
|
const symbol_name_horz = `${base_symbol_name}_horz`;
|
|
2537
2538
|
let symbol_name;
|
|
@@ -2550,8 +2551,8 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
2550
2551
|
const symbol = symbols2[symbol_name];
|
|
2551
2552
|
if (symbol) {
|
|
2552
2553
|
const schematic_component2 = db.schematic_component.insert({
|
|
2553
|
-
center: { x:
|
|
2554
|
-
rotation:
|
|
2554
|
+
center: { x: props.schX ?? 0, y: props.schY ?? 0 },
|
|
2555
|
+
rotation: props.schRotation ?? 0,
|
|
2555
2556
|
size: symbol.size,
|
|
2556
2557
|
source_component_id: this.source_component_id,
|
|
2557
2558
|
symbol_name,
|
|
@@ -3593,6 +3594,16 @@ var createSchematicTraceJunctions = ({
|
|
|
3593
3594
|
});
|
|
3594
3595
|
};
|
|
3595
3596
|
|
|
3597
|
+
// lib/utils/schematic/getEnteringEdgeFromDirection.ts
|
|
3598
|
+
var getEnteringEdgeFromDirection = (direction) => {
|
|
3599
|
+
return {
|
|
3600
|
+
up: "bottom",
|
|
3601
|
+
down: "top",
|
|
3602
|
+
left: "right",
|
|
3603
|
+
right: "left"
|
|
3604
|
+
}[direction] ?? null;
|
|
3605
|
+
};
|
|
3606
|
+
|
|
3596
3607
|
// lib/components/primitive-components/Trace/Trace.ts
|
|
3597
3608
|
var portToObjective = (port) => {
|
|
3598
3609
|
const portPosition = port._getGlobalPcbPositionAfterLayout();
|
|
@@ -4003,6 +4014,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
4003
4014
|
const { _parsedProps: props, parent } = this;
|
|
4004
4015
|
if (!parent) throw new Error("Trace has no parent");
|
|
4005
4016
|
const { allPortsFound, portsWithSelectors: connectedPorts } = this._findConnectedPorts();
|
|
4017
|
+
const { netsWithSelectors } = this._findConnectedNets();
|
|
4006
4018
|
if (!allPortsFound) return;
|
|
4007
4019
|
const obstacles = [];
|
|
4008
4020
|
const connection = {
|
|
@@ -4037,6 +4049,20 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
4037
4049
|
schematic_port_id: port.schematic_port_id ?? void 0,
|
|
4038
4050
|
facingDirection: port.facingDirection
|
|
4039
4051
|
}));
|
|
4052
|
+
const isPortAndNetConnection = portsWithPosition.length === 1 && netsWithSelectors.length === 1;
|
|
4053
|
+
if (isPortAndNetConnection) {
|
|
4054
|
+
const net = netsWithSelectors[0].net;
|
|
4055
|
+
const { port, position: anchorPos } = portsWithPosition[0];
|
|
4056
|
+
const netLabel = db.schematic_net_label.insert({
|
|
4057
|
+
text: net._parsedProps.name,
|
|
4058
|
+
source_net_id: net.source_net_id,
|
|
4059
|
+
anchor_position: anchorPos,
|
|
4060
|
+
// TODO compute the center based on the text size
|
|
4061
|
+
center: anchorPos,
|
|
4062
|
+
anchor_side: getEnteringEdgeFromDirection(port.facingDirection) ?? "bottom"
|
|
4063
|
+
});
|
|
4064
|
+
return;
|
|
4065
|
+
}
|
|
4040
4066
|
if (portsWithPosition.length < 2) {
|
|
4041
4067
|
return;
|
|
4042
4068
|
}
|
|
@@ -4545,22 +4571,16 @@ var NetAlias = class extends PrimitiveComponent {
|
|
|
4545
4571
|
zodProps: netAliasProps
|
|
4546
4572
|
};
|
|
4547
4573
|
}
|
|
4548
|
-
initPorts() {
|
|
4549
|
-
this.add(
|
|
4550
|
-
new Port({
|
|
4551
|
-
name: "pin1",
|
|
4552
|
-
pinNumber: 1,
|
|
4553
|
-
aliases: ["anode", "pos", "left"]
|
|
4554
|
-
})
|
|
4555
|
-
);
|
|
4556
|
-
}
|
|
4557
4574
|
doInitialSchematicComponentRender() {
|
|
4558
4575
|
const { db } = this.root;
|
|
4559
4576
|
const { _parsedProps: props } = this;
|
|
4577
|
+
const anchorPos = { x: props.schX ?? 0, y: props.schY ?? 0 };
|
|
4560
4578
|
const netAlias = db.schematic_net_label.insert({
|
|
4561
4579
|
text: props.net,
|
|
4562
4580
|
source_net_id: props.net,
|
|
4563
|
-
|
|
4581
|
+
anchor_position: anchorPos,
|
|
4582
|
+
// TODO compute the center based on the text size
|
|
4583
|
+
center: anchorPos,
|
|
4564
4584
|
anchor_side: "bottom"
|
|
4565
4585
|
});
|
|
4566
4586
|
this.source_net_alias_id = netAlias.source_net_id;
|
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.160",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"@tscircuit/props": "^0.0.86",
|
|
44
44
|
"@tscircuit/schematic-autolayout": "^0.0.5",
|
|
45
45
|
"@tscircuit/soup-util": "^0.0.33",
|
|
46
|
-
"circuit-json": "^0.0.
|
|
46
|
+
"circuit-json": "^0.0.99",
|
|
47
47
|
"circuit-json-to-connectivity-map": "^0.0.17",
|
|
48
|
-
"circuit-to-svg": "^0.0.
|
|
48
|
+
"circuit-to-svg": "^0.0.67",
|
|
49
49
|
"format-si-unit": "^0.0.2",
|
|
50
50
|
"nanoid": "^5.0.7",
|
|
51
51
|
"performance-now": "^2.1.0",
|