@tscircuit/core 0.0.1437 → 0.0.1439
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 +2 -0
- package/dist/index.js +101 -59
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -2135,10 +2135,12 @@ declare class Port extends PrimitiveComponent<typeof portProps> {
|
|
|
2135
2135
|
* Return traces that are explicitly connected to this port (not via a net)
|
|
2136
2136
|
*/
|
|
2137
2137
|
_getDirectlyConnectedTraces(): Trace[];
|
|
2138
|
+
doInitialCreateTracesFromProps(): void;
|
|
2138
2139
|
doInitialSourceRender(): void;
|
|
2139
2140
|
doInitialSourceParentAttachment(): void;
|
|
2140
2141
|
doInitialPcbPortRender(): void;
|
|
2141
2142
|
updatePcbPortRender(): void;
|
|
2143
|
+
doInitialPcbPortAttachment(): void;
|
|
2142
2144
|
/**
|
|
2143
2145
|
* Get the best display label for this port based on port_hints
|
|
2144
2146
|
* Filters out generic patterns and applies showPinAliases logic
|
package/dist/index.js
CHANGED
|
@@ -3664,25 +3664,29 @@ function getPcbSelectorErrorForTracePort(selector, port) {
|
|
|
3664
3664
|
const siblingPorts = (parentNormalComponent?.children ?? []).filter(
|
|
3665
3665
|
(child) => child.componentName === "Port" && child.isMatchingAnyOf([selectorToken])
|
|
3666
3666
|
);
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
const rawPinSelectors2 = Array.from(
|
|
3673
|
-
new Set(
|
|
3674
|
-
siblingPorts.flatMap(
|
|
3675
|
-
(siblingPort) => siblingPort.getNameAndAliases().filter((alias) => /^pin\d+$/.test(alias)).map((alias) => `${parentName}.${alias}`)
|
|
3676
|
-
)
|
|
3667
|
+
if (siblingPorts.length > 1) {
|
|
3668
|
+
const internallyConnectedGroups = parentNormalComponent?._getInternallyConnectedPins?.() ?? [];
|
|
3669
|
+
const matchingPortsAreInternallyConnected = internallyConnectedGroups.some(
|
|
3670
|
+
(group) => siblingPorts.every(
|
|
3671
|
+
(siblingPort) => group.includes(siblingPort)
|
|
3677
3672
|
)
|
|
3678
3673
|
);
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3674
|
+
if (!matchingPortsAreInternallyConnected) {
|
|
3675
|
+
const rawPinSelectors2 = Array.from(
|
|
3676
|
+
new Set(
|
|
3677
|
+
siblingPorts.flatMap(
|
|
3678
|
+
(siblingPort) => siblingPort.getNameAndAliases().filter((alias) => /^pin\d+$/.test(alias)).map((alias) => `${parentName}.${alias}`)
|
|
3679
|
+
)
|
|
3680
|
+
)
|
|
3681
|
+
);
|
|
3682
|
+
const suggestion = rawPinSelectors2.length > 0 ? ` Use a raw pin selector like ${rawPinSelectors2.map((s) => `"${s}"`).join(" or ")}.` : "";
|
|
3683
|
+
const siblingPcbMatches = siblingPorts.flatMap(
|
|
3684
|
+
(siblingPort) => siblingPort.matchedComponents.filter(
|
|
3685
|
+
(component) => component.isPcbPrimitive
|
|
3686
|
+
)
|
|
3687
|
+
);
|
|
3688
|
+
return `Trace selector "${selector}" resolved to "${parentName}.${port.props.name}", but alias "${selectorToken}" matches multiple PCB pads: ${siblingPcbMatches.map((component) => formatPcbPrimitiveForError(component)).join(", ")}.${suggestion}`;
|
|
3689
|
+
}
|
|
3686
3690
|
}
|
|
3687
3691
|
}
|
|
3688
3692
|
if (port.pcb_port_id) return null;
|
|
@@ -9558,6 +9562,62 @@ var applyPinAttributesToSourcePort = (sourcePortProps, attributes) => {
|
|
|
9558
9562
|
}
|
|
9559
9563
|
};
|
|
9560
9564
|
|
|
9565
|
+
// lib/components/primitive-components/Port/Port_doInitialCreateTracesFromProps.ts
|
|
9566
|
+
var getConnectionTargets = (target) => {
|
|
9567
|
+
if (!target) return [];
|
|
9568
|
+
return typeof target === "string" ? [target] : [...target];
|
|
9569
|
+
};
|
|
9570
|
+
function Port_doInitialCreateTracesFromProps(port) {
|
|
9571
|
+
if (!port.isGroupPort()) return;
|
|
9572
|
+
const connectsTo = port._parsedProps.connectsTo;
|
|
9573
|
+
if (!connectsTo) return;
|
|
9574
|
+
const parent = port.parent;
|
|
9575
|
+
if (!parent) return;
|
|
9576
|
+
const parentConnections = parent._parsedProps?.connections;
|
|
9577
|
+
const connectionIsCreatedByParent = Object.keys(parentConnections ?? {}).some(
|
|
9578
|
+
(pinName) => port.isMatchingAnyOf([pinName])
|
|
9579
|
+
);
|
|
9580
|
+
if (connectionIsCreatedByParent) return;
|
|
9581
|
+
const parentName = parent.name;
|
|
9582
|
+
const portName = port.name;
|
|
9583
|
+
if (!parentName || !portName) return;
|
|
9584
|
+
const from = `.${parentName} > .${portName}`;
|
|
9585
|
+
for (const target of getConnectionTargets(connectsTo)) {
|
|
9586
|
+
const traceAlreadyExists = parent.children.some((child) => {
|
|
9587
|
+
if (!(child instanceof Trace3)) return false;
|
|
9588
|
+
const traceProps2 = child._parsedProps;
|
|
9589
|
+
if (!("from" in traceProps2) || !("to" in traceProps2)) return false;
|
|
9590
|
+
return traceProps2.from === from && traceProps2.to === target || traceProps2.from === target && traceProps2.to === from;
|
|
9591
|
+
});
|
|
9592
|
+
if (traceAlreadyExists) continue;
|
|
9593
|
+
parent.add(new Trace3({ from, to: target }));
|
|
9594
|
+
}
|
|
9595
|
+
}
|
|
9596
|
+
|
|
9597
|
+
// lib/components/primitive-components/Port/Port_tryRenderGroupPcbPort.ts
|
|
9598
|
+
function Port_tryRenderGroupPcbPort(port) {
|
|
9599
|
+
if (port.root?.pcbDisabled) return false;
|
|
9600
|
+
if (port.pcb_port_id) return true;
|
|
9601
|
+
const { db } = port.root;
|
|
9602
|
+
const connectedPort = port._getConnectedPortsFromConnectsTo()[0];
|
|
9603
|
+
if (!connectedPort?.pcb_port_id) return false;
|
|
9604
|
+
const connectedPcbPort = db.pcb_port.get(connectedPort.pcb_port_id);
|
|
9605
|
+
if (!connectedPcbPort) return false;
|
|
9606
|
+
const subcircuit = port.getSubcircuit();
|
|
9607
|
+
const pcbPort = db.pcb_port.insert({
|
|
9608
|
+
pcb_component_id: void 0,
|
|
9609
|
+
layers: connectedPort.getAvailablePcbLayers(),
|
|
9610
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
9611
|
+
pcb_group_id: port.getGroup()?.pcb_group_id ?? void 0,
|
|
9612
|
+
x: connectedPcbPort.x,
|
|
9613
|
+
y: connectedPcbPort.y,
|
|
9614
|
+
source_port_id: port.source_port_id,
|
|
9615
|
+
is_board_pinout: false
|
|
9616
|
+
});
|
|
9617
|
+
port.pcb_port_id = pcbPort.pcb_port_id;
|
|
9618
|
+
return true;
|
|
9619
|
+
}
|
|
9620
|
+
|
|
9561
9621
|
// lib/components/primitive-components/Port/Port.ts
|
|
9562
9622
|
var Port = class extends PrimitiveComponent2 {
|
|
9563
9623
|
source_port_id = null;
|
|
@@ -9827,6 +9887,9 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
9827
9887
|
const connectedTraces = allSubcircuitTraces.filter((trace) => !trace._couldNotFindPort).filter((trace) => trace._isExplicitlyConnectedToPort(this));
|
|
9828
9888
|
return connectedTraces;
|
|
9829
9889
|
}
|
|
9890
|
+
doInitialCreateTracesFromProps() {
|
|
9891
|
+
Port_doInitialCreateTracesFromProps(this);
|
|
9892
|
+
}
|
|
9830
9893
|
doInitialSourceRender() {
|
|
9831
9894
|
const { db } = this.root;
|
|
9832
9895
|
const { _parsedProps: props } = this;
|
|
@@ -9876,27 +9939,7 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
9876
9939
|
const { db } = this.root;
|
|
9877
9940
|
const { matchedComponents } = this;
|
|
9878
9941
|
if (this.isGroupPort()) {
|
|
9879
|
-
|
|
9880
|
-
if (connectedPorts.length === 0) {
|
|
9881
|
-
return;
|
|
9882
|
-
}
|
|
9883
|
-
const connectedPort = connectedPorts[0];
|
|
9884
|
-
if (!connectedPort.pcb_port_id) {
|
|
9885
|
-
return;
|
|
9886
|
-
}
|
|
9887
|
-
const connectedPcbPort = db.pcb_port.get(connectedPort.pcb_port_id);
|
|
9888
|
-
const matchCenter2 = { x: connectedPcbPort.x, y: connectedPcbPort.y };
|
|
9889
|
-
const subcircuit = this.getSubcircuit();
|
|
9890
|
-
const pcb_port = db.pcb_port.insert({
|
|
9891
|
-
pcb_component_id: void 0,
|
|
9892
|
-
layers: connectedPort.getAvailablePcbLayers(),
|
|
9893
|
-
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
9894
|
-
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
|
|
9895
|
-
...matchCenter2,
|
|
9896
|
-
source_port_id: this.source_port_id,
|
|
9897
|
-
is_board_pinout: false
|
|
9898
|
-
});
|
|
9899
|
-
this.pcb_port_id = pcb_port.pcb_port_id;
|
|
9942
|
+
Port_tryRenderGroupPcbPort(this);
|
|
9900
9943
|
return;
|
|
9901
9944
|
}
|
|
9902
9945
|
const parentNormalComponent = this.getParentNormalComponent();
|
|
@@ -9956,23 +9999,7 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
9956
9999
|
const { db } = this.root;
|
|
9957
10000
|
if (this.pcb_port_id) return;
|
|
9958
10001
|
if (this.isGroupPort()) {
|
|
9959
|
-
|
|
9960
|
-
if (connectedPorts.length === 0) return;
|
|
9961
|
-
const connectedPort = connectedPorts[0];
|
|
9962
|
-
if (!connectedPort.pcb_port_id) return;
|
|
9963
|
-
const connectedPcbPort = db.pcb_port.get(connectedPort.pcb_port_id);
|
|
9964
|
-
const matchCenter2 = { x: connectedPcbPort.x, y: connectedPcbPort.y };
|
|
9965
|
-
const subcircuit2 = this.getSubcircuit();
|
|
9966
|
-
const pcb_port2 = db.pcb_port.insert({
|
|
9967
|
-
pcb_component_id: void 0,
|
|
9968
|
-
layers: connectedPort.getAvailablePcbLayers(),
|
|
9969
|
-
subcircuit_id: subcircuit2?.subcircuit_id ?? void 0,
|
|
9970
|
-
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
|
|
9971
|
-
...matchCenter2,
|
|
9972
|
-
source_port_id: this.source_port_id,
|
|
9973
|
-
is_board_pinout: false
|
|
9974
|
-
});
|
|
9975
|
-
this.pcb_port_id = pcb_port2.pcb_port_id;
|
|
10002
|
+
Port_tryRenderGroupPcbPort(this);
|
|
9976
10003
|
return;
|
|
9977
10004
|
}
|
|
9978
10005
|
const pcbMatches = this.matchedComponents.filter((c) => c.isPcbPrimitive);
|
|
@@ -10006,6 +10033,10 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
10006
10033
|
});
|
|
10007
10034
|
this.pcb_port_id = pcb_port.pcb_port_id;
|
|
10008
10035
|
}
|
|
10036
|
+
doInitialPcbPortAttachment() {
|
|
10037
|
+
if (!this.isGroupPort() || this.pcb_port_id) return;
|
|
10038
|
+
Port_tryRenderGroupPcbPort(this);
|
|
10039
|
+
}
|
|
10009
10040
|
/**
|
|
10010
10041
|
* Get the best display label for this port based on port_hints
|
|
10011
10042
|
* Filters out generic patterns and applies showPinAliases logic
|
|
@@ -21526,7 +21557,7 @@ var getSourcePortNetLabelText = (db, sourcePortId) => {
|
|
|
21526
21557
|
if (!sourceComponent?.name || !sourcePort.name) return void 0;
|
|
21527
21558
|
return `${sourceComponent.name}_${sourcePort.name}`;
|
|
21528
21559
|
};
|
|
21529
|
-
var
|
|
21560
|
+
var getDirectCrossSubcircuitConnectedSourcePortId = (db, sourcePortId) => {
|
|
21530
21561
|
const sourcePort = db.source_port.get(sourcePortId);
|
|
21531
21562
|
if (!sourcePort) return void 0;
|
|
21532
21563
|
for (const sourceTrace of db.source_trace.list()) {
|
|
@@ -21541,9 +21572,17 @@ var getDirectCrossSubcircuitConnectionLabelText = (db, sourcePortId) => {
|
|
|
21541
21572
|
const otherSourcePort = db.source_port.get(otherSourcePortId);
|
|
21542
21573
|
if (!otherSourcePort) continue;
|
|
21543
21574
|
if (otherSourcePort.subcircuit_id === sourcePort.subcircuit_id) continue;
|
|
21544
|
-
return
|
|
21575
|
+
return otherSourcePortId;
|
|
21545
21576
|
}
|
|
21546
21577
|
};
|
|
21578
|
+
var getDirectCrossSubcircuitConnectionLabelText = (db, sourcePortId) => {
|
|
21579
|
+
const otherSourcePortId = getDirectCrossSubcircuitConnectedSourcePortId(
|
|
21580
|
+
db,
|
|
21581
|
+
sourcePortId
|
|
21582
|
+
);
|
|
21583
|
+
if (!otherSourcePortId) return void 0;
|
|
21584
|
+
return getSourcePortNetLabelText(db, otherSourcePortId);
|
|
21585
|
+
};
|
|
21547
21586
|
var insertNetLabelsForPortsMissingTrace = ({
|
|
21548
21587
|
allSourceAndSchematicPortIdsInScope,
|
|
21549
21588
|
group,
|
|
@@ -21560,6 +21599,9 @@ var insertNetLabelsForPortsMissingTrace = ({
|
|
|
21560
21599
|
const srcPortId = schPortIdToSourcePortId.get(schOrSrcPortId);
|
|
21561
21600
|
if (!srcPortId) continue;
|
|
21562
21601
|
const sourcePort = db.source_port.get(srcPortId);
|
|
21602
|
+
if (group._parsedProps.showAsSchematicBox && sourcePort?.subcircuit_id === group.subcircuit_id && !sourcePort.source_component_id && getDirectCrossSubcircuitConnectedSourcePortId(db, srcPortId)) {
|
|
21603
|
+
continue;
|
|
21604
|
+
}
|
|
21563
21605
|
const connKey = sourcePort?.subcircuit_connectivity_map_key;
|
|
21564
21606
|
if (!connKey) continue;
|
|
21565
21607
|
const sourceNet = connKeyToSourceNet.get(connKey);
|
|
@@ -22515,7 +22557,7 @@ function Group_getRoutingPhasePlans(group) {
|
|
|
22515
22557
|
var package_default = {
|
|
22516
22558
|
name: "@tscircuit/core",
|
|
22517
22559
|
type: "module",
|
|
22518
|
-
version: "0.0.
|
|
22560
|
+
version: "0.0.1438",
|
|
22519
22561
|
types: "dist/index.d.ts",
|
|
22520
22562
|
main: "dist/index.js",
|
|
22521
22563
|
module: "dist/index.js",
|
|
@@ -22548,7 +22590,7 @@ var package_default = {
|
|
|
22548
22590
|
"@resvg/resvg-js": "^2.6.2",
|
|
22549
22591
|
"@tscircuit/alphabet": "0.0.25",
|
|
22550
22592
|
"@tscircuit/breakout-point-solver": "github:tscircuit/breakout-point-solver#bac9629",
|
|
22551
|
-
"@tscircuit/capacity-autorouter": "^0.0.
|
|
22593
|
+
"@tscircuit/capacity-autorouter": "^0.0.670",
|
|
22552
22594
|
"@tscircuit/checks": "0.0.142",
|
|
22553
22595
|
"@tscircuit/circuit-json-util": "^0.0.97",
|
|
22554
22596
|
"@tscircuit/common": "^0.0.20",
|
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.1439",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@resvg/resvg-js": "^2.6.2",
|
|
35
35
|
"@tscircuit/alphabet": "0.0.25",
|
|
36
36
|
"@tscircuit/breakout-point-solver": "github:tscircuit/breakout-point-solver#bac9629",
|
|
37
|
-
"@tscircuit/capacity-autorouter": "^0.0.
|
|
37
|
+
"@tscircuit/capacity-autorouter": "^0.0.670",
|
|
38
38
|
"@tscircuit/checks": "0.0.142",
|
|
39
39
|
"@tscircuit/circuit-json-util": "^0.0.97",
|
|
40
40
|
"@tscircuit/common": "^0.0.20",
|