@tscircuit/core 0.0.873 → 0.0.874
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 +6 -0
- package/dist/index.js +53 -4
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -660,6 +660,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
|
|
|
660
660
|
x: string | number;
|
|
661
661
|
y: string | number;
|
|
662
662
|
}>, z.ZodString]>, "many">>;
|
|
663
|
+
pcbStraightLine: z.ZodOptional<z.ZodBoolean>;
|
|
663
664
|
schDisplayLabel: z.ZodOptional<z.ZodString>;
|
|
664
665
|
schStroke: z.ZodOptional<z.ZodString>;
|
|
665
666
|
highlightColor: z.ZodOptional<z.ZodString>;
|
|
@@ -695,6 +696,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
|
|
|
695
696
|
x: number;
|
|
696
697
|
y: number;
|
|
697
698
|
})[] | undefined;
|
|
699
|
+
pcbStraightLine?: boolean | undefined;
|
|
698
700
|
schDisplayLabel?: string | undefined;
|
|
699
701
|
schStroke?: string | undefined;
|
|
700
702
|
}, {
|
|
@@ -724,6 +726,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
|
|
|
724
726
|
x: string | number;
|
|
725
727
|
y: string | number;
|
|
726
728
|
})[] | undefined;
|
|
729
|
+
pcbStraightLine?: boolean | undefined;
|
|
727
730
|
schDisplayLabel?: string | undefined;
|
|
728
731
|
schStroke?: string | undefined;
|
|
729
732
|
}>, z.ZodObject<{
|
|
@@ -780,6 +783,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
|
|
|
780
783
|
x: string | number;
|
|
781
784
|
y: string | number;
|
|
782
785
|
}>, z.ZodString]>, "many">>;
|
|
786
|
+
pcbStraightLine: z.ZodOptional<z.ZodBoolean>;
|
|
783
787
|
schDisplayLabel: z.ZodOptional<z.ZodString>;
|
|
784
788
|
schStroke: z.ZodOptional<z.ZodString>;
|
|
785
789
|
highlightColor: z.ZodOptional<z.ZodString>;
|
|
@@ -823,6 +827,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
|
|
|
823
827
|
x: number;
|
|
824
828
|
y: number;
|
|
825
829
|
})[] | undefined;
|
|
830
|
+
pcbStraightLine?: boolean | undefined;
|
|
826
831
|
schDisplayLabel?: string | undefined;
|
|
827
832
|
schStroke?: string | undefined;
|
|
828
833
|
}, {
|
|
@@ -855,6 +860,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
|
|
|
855
860
|
x: string | number;
|
|
856
861
|
y: string | number;
|
|
857
862
|
})[] | undefined;
|
|
863
|
+
pcbStraightLine?: boolean | undefined;
|
|
858
864
|
schDisplayLabel?: string | undefined;
|
|
859
865
|
schStroke?: string | undefined;
|
|
860
866
|
}>]>;
|
package/dist/index.js
CHANGED
|
@@ -6457,6 +6457,9 @@ function Trace_doInitialPcbTraceRender(trace) {
|
|
|
6457
6457
|
if (props.pcbPath && props.pcbPath.length > 0) {
|
|
6458
6458
|
return;
|
|
6459
6459
|
}
|
|
6460
|
+
if (props.pcbStraightLine) {
|
|
6461
|
+
return;
|
|
6462
|
+
}
|
|
6460
6463
|
if (!subcircuit._shouldUseTraceByTraceRouting()) {
|
|
6461
6464
|
return;
|
|
6462
6465
|
}
|
|
@@ -6718,7 +6721,9 @@ function Trace_doInitialPcbManualTraceRender(trace) {
|
|
|
6718
6721
|
const { db } = trace.root;
|
|
6719
6722
|
const { _parsedProps: props } = trace;
|
|
6720
6723
|
const subcircuit = trace.getSubcircuit();
|
|
6721
|
-
|
|
6724
|
+
const hasPcbPath = props.pcbPath !== void 0;
|
|
6725
|
+
const wantsStraightLine = Boolean(props.pcbStraightLine);
|
|
6726
|
+
if (!hasPcbPath && !wantsStraightLine) return;
|
|
6722
6727
|
const { allPortsFound, ports, portsWithSelectors } = trace._findConnectedPorts();
|
|
6723
6728
|
if (!allPortsFound) return;
|
|
6724
6729
|
const portsWithoutMatchedPcbPrimitive = [];
|
|
@@ -6738,6 +6743,51 @@ function Trace_doInitialPcbManualTraceRender(trace) {
|
|
|
6738
6743
|
});
|
|
6739
6744
|
return;
|
|
6740
6745
|
}
|
|
6746
|
+
const width = trace._getExplicitTraceThickness() ?? trace.getSubcircuit()._parsedProps.minTraceWidth ?? 0.16;
|
|
6747
|
+
if (wantsStraightLine && !hasPcbPath) {
|
|
6748
|
+
if (!ports || ports.length < 2) {
|
|
6749
|
+
trace.renderError("pcbStraightLine requires exactly two connected ports");
|
|
6750
|
+
return;
|
|
6751
|
+
}
|
|
6752
|
+
const [startPort, endPort] = ports;
|
|
6753
|
+
const startLayers = startPort.getAvailablePcbLayers();
|
|
6754
|
+
const endLayers = endPort.getAvailablePcbLayers();
|
|
6755
|
+
const sharedLayer = startLayers.find((layer3) => endLayers.includes(layer3));
|
|
6756
|
+
const layer2 = sharedLayer ?? startLayers[0] ?? endLayers[0] ?? "top";
|
|
6757
|
+
const startPos = startPort._getGlobalPcbPositionAfterLayout();
|
|
6758
|
+
const endPos = endPort._getGlobalPcbPositionAfterLayout();
|
|
6759
|
+
const route2 = [
|
|
6760
|
+
{
|
|
6761
|
+
route_type: "wire",
|
|
6762
|
+
x: startPos.x,
|
|
6763
|
+
y: startPos.y,
|
|
6764
|
+
width,
|
|
6765
|
+
layer: layer2,
|
|
6766
|
+
start_pcb_port_id: startPort.pcb_port_id
|
|
6767
|
+
},
|
|
6768
|
+
{
|
|
6769
|
+
route_type: "wire",
|
|
6770
|
+
x: endPos.x,
|
|
6771
|
+
y: endPos.y,
|
|
6772
|
+
width,
|
|
6773
|
+
layer: layer2,
|
|
6774
|
+
end_pcb_port_id: endPort.pcb_port_id
|
|
6775
|
+
}
|
|
6776
|
+
];
|
|
6777
|
+
const traceLength2 = getTraceLength(route2);
|
|
6778
|
+
const pcb_trace2 = db.pcb_trace.insert({
|
|
6779
|
+
route: route2,
|
|
6780
|
+
source_trace_id: trace.source_trace_id,
|
|
6781
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
6782
|
+
pcb_group_id: trace.getGroup()?.pcb_group_id ?? void 0,
|
|
6783
|
+
trace_length: traceLength2
|
|
6784
|
+
});
|
|
6785
|
+
trace._portsRoutedOnPcb = ports;
|
|
6786
|
+
trace.pcb_trace_id = pcb_trace2.pcb_trace_id;
|
|
6787
|
+
trace._insertErrorIfTraceIsOutsideBoard(route2, ports);
|
|
6788
|
+
return;
|
|
6789
|
+
}
|
|
6790
|
+
if (!props.pcbPath) return;
|
|
6741
6791
|
let anchorPort;
|
|
6742
6792
|
if (props.pcbPathRelativeTo) {
|
|
6743
6793
|
anchorPort = portsWithSelectors.find(
|
|
@@ -6752,7 +6802,6 @@ function Trace_doInitialPcbManualTraceRender(trace) {
|
|
|
6752
6802
|
}
|
|
6753
6803
|
const otherPort = ports.find((p) => p !== anchorPort) ?? ports[1];
|
|
6754
6804
|
const layer = anchorPort.getAvailablePcbLayers()[0] || "top";
|
|
6755
|
-
const width = trace._getExplicitTraceThickness() ?? trace.getSubcircuit()._parsedProps.minTraceWidth ?? 0.16;
|
|
6756
6805
|
const anchorPos = anchorPort._getGlobalPcbPositionAfterLayout();
|
|
6757
6806
|
const otherPos = otherPort._getGlobalPcbPositionAfterLayout();
|
|
6758
6807
|
const route = [];
|
|
@@ -18528,7 +18577,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
18528
18577
|
var package_default = {
|
|
18529
18578
|
name: "@tscircuit/core",
|
|
18530
18579
|
type: "module",
|
|
18531
|
-
version: "0.0.
|
|
18580
|
+
version: "0.0.873",
|
|
18532
18581
|
types: "dist/index.d.ts",
|
|
18533
18582
|
main: "dist/index.js",
|
|
18534
18583
|
module: "dist/index.js",
|
|
@@ -18572,7 +18621,7 @@ var package_default = {
|
|
|
18572
18621
|
"@tscircuit/math-utils": "^0.0.29",
|
|
18573
18622
|
"@tscircuit/miniflex": "^0.0.4",
|
|
18574
18623
|
"@tscircuit/ngspice-spice-engine": "^0.0.3",
|
|
18575
|
-
"@tscircuit/props": "^0.0.
|
|
18624
|
+
"@tscircuit/props": "^0.0.410",
|
|
18576
18625
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
18577
18626
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
18578
18627
|
"@tscircuit/schematic-trace-solver": "^v0.0.45",
|
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.874",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@tscircuit/math-utils": "^0.0.29",
|
|
46
46
|
"@tscircuit/miniflex": "^0.0.4",
|
|
47
47
|
"@tscircuit/ngspice-spice-engine": "^0.0.3",
|
|
48
|
-
"@tscircuit/props": "^0.0.
|
|
48
|
+
"@tscircuit/props": "^0.0.410",
|
|
49
49
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
50
50
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
51
51
|
"@tscircuit/schematic-trace-solver": "^v0.0.45",
|