@tscircuit/core 0.0.467 → 0.0.469
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 -1
- package/dist/index.js +54 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -14557,7 +14557,8 @@ type CommonNetNames = "VCC" | "GND" | "VDD" | "PWR" | "V5" | "V3_3" | "VIN" | "S
|
|
|
14557
14557
|
type TransistorSel = Record<`Q${Nums40}`, Record<TransistorPinNames, string>>;
|
|
14558
14558
|
type JumperSel = Record<`J${Nums40}` | `CN${Nums40}`, Record<PinNumbers100 | CommonPinNames, string> & ChipFnSel>;
|
|
14559
14559
|
type ChipSel = Record<`U${Nums40}`, Record<CommonPinNames, string> & ChipFnSel>;
|
|
14560
|
-
type
|
|
14560
|
+
type NetSelFn<N extends string = CommonNetNames> = (<N2 extends string>() => Record<N | N2, string>) & Record<N, string>;
|
|
14561
|
+
type NetSel<N extends string = CommonNetNames> = Record<"net", NetSelFn<N>>;
|
|
14561
14562
|
type ExplicitModuleSel = Record<"subcircuit" | "module" | "group", Record<`S${Nums40}` | `M${Nums40}` | `G${Nums40}`, SelWithoutSubcircuit>>;
|
|
14562
14563
|
type GenericConnectionsAndSelectorsSel = Record<string, <CMP_FN extends (props: any) => any>(component: CMP_FN) => CMP_FN extends (props: infer P) => any ? P extends {
|
|
14563
14564
|
connections: infer CN;
|
package/dist/index.js
CHANGED
|
@@ -1661,6 +1661,16 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
1661
1661
|
if (props.shape === "rect") {
|
|
1662
1662
|
return { width: props.width, height: props.height };
|
|
1663
1663
|
}
|
|
1664
|
+
if (props.shape === "polygon") {
|
|
1665
|
+
const points = props.points;
|
|
1666
|
+
const xs = points.map((p) => p.x);
|
|
1667
|
+
const ys = points.map((p) => p.y);
|
|
1668
|
+
const minX = Math.min(...xs);
|
|
1669
|
+
const maxX = Math.max(...xs);
|
|
1670
|
+
const minY = Math.min(...ys);
|
|
1671
|
+
const maxY = Math.max(...ys);
|
|
1672
|
+
return { width: maxX - minX, height: maxY - minY };
|
|
1673
|
+
}
|
|
1664
1674
|
throw new Error(
|
|
1665
1675
|
`getPcbSize for shape "${props.shape}" not implemented for ${this.componentName}`
|
|
1666
1676
|
);
|
|
@@ -1704,7 +1714,6 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
1704
1714
|
// port likely isn't matched
|
|
1705
1715
|
layer: maybeFlipLayer(props.layer ?? "top"),
|
|
1706
1716
|
shape: "circle",
|
|
1707
|
-
// @ts-ignore: no idea why this is triggering
|
|
1708
1717
|
radius: props.radius,
|
|
1709
1718
|
port_hints: props.portHints.map((ph) => ph.toString()),
|
|
1710
1719
|
x: position.x,
|
|
@@ -1714,7 +1723,6 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
1714
1723
|
db.pcb_solder_paste.insert({
|
|
1715
1724
|
layer: pcb_smtpad.layer,
|
|
1716
1725
|
shape: "circle",
|
|
1717
|
-
// @ts-ignore: no idea why this is triggering
|
|
1718
1726
|
radius: pcb_smtpad.radius * 0.7,
|
|
1719
1727
|
x: pcb_smtpad.x,
|
|
1720
1728
|
y: pcb_smtpad.y,
|
|
@@ -1754,7 +1762,6 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
1754
1762
|
db.pcb_solder_paste.insert({
|
|
1755
1763
|
layer: maybeFlipLayer(props.layer ?? "top"),
|
|
1756
1764
|
shape: "rect",
|
|
1757
|
-
// @ts-ignore: no idea why this is triggering
|
|
1758
1765
|
width: pcb_smtpad.width * 0.7,
|
|
1759
1766
|
height: pcb_smtpad.height * 0.7,
|
|
1760
1767
|
x: pcb_smtpad.x,
|
|
@@ -1768,7 +1775,6 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
1768
1775
|
db.pcb_solder_paste.insert({
|
|
1769
1776
|
layer: maybeFlipLayer(props.layer ?? "top"),
|
|
1770
1777
|
shape: "rotated_rect",
|
|
1771
|
-
// @ts-ignore: no idea why this is triggering
|
|
1772
1778
|
width: pcb_smtpad.width * 0.7,
|
|
1773
1779
|
height: pcb_smtpad.height * 0.7,
|
|
1774
1780
|
x: pcb_smtpad.x,
|
|
@@ -1779,6 +1785,21 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
1779
1785
|
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
1780
1786
|
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
1781
1787
|
});
|
|
1788
|
+
} else if (props.shape === "polygon") {
|
|
1789
|
+
pcb_smtpad = db.pcb_smtpad.insert({
|
|
1790
|
+
pcb_component_id,
|
|
1791
|
+
pcb_port_id: this.matchedPort?.pcb_port_id,
|
|
1792
|
+
// port likely isn't matched
|
|
1793
|
+
layer: maybeFlipLayer(props.layer ?? "top"),
|
|
1794
|
+
shape: "polygon",
|
|
1795
|
+
points: props.points.map((p) => ({
|
|
1796
|
+
x: p.x + position.x,
|
|
1797
|
+
y: p.y + position.y
|
|
1798
|
+
})),
|
|
1799
|
+
port_hints: props.portHints.map((ph) => ph.toString()),
|
|
1800
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
1801
|
+
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
1802
|
+
});
|
|
1782
1803
|
}
|
|
1783
1804
|
if (pcb_smtpad) {
|
|
1784
1805
|
this.pcb_smtpad_id = pcb_smtpad.pcb_smtpad_id;
|
|
@@ -1840,6 +1861,26 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
1840
1861
|
height: smtpad.radius * 2
|
|
1841
1862
|
};
|
|
1842
1863
|
}
|
|
1864
|
+
if (smtpad.shape === "polygon") {
|
|
1865
|
+
const points = smtpad.points;
|
|
1866
|
+
const xs = points.map((p) => p.x);
|
|
1867
|
+
const ys = points.map((p) => p.y);
|
|
1868
|
+
const minX = Math.min(...xs);
|
|
1869
|
+
const maxX = Math.max(...xs);
|
|
1870
|
+
const minY = Math.min(...ys);
|
|
1871
|
+
const maxY = Math.max(...ys);
|
|
1872
|
+
return {
|
|
1873
|
+
center: { x: (minX + maxX) / 2, y: (minY + maxY) / 2 },
|
|
1874
|
+
bounds: {
|
|
1875
|
+
left: minX,
|
|
1876
|
+
top: maxY,
|
|
1877
|
+
right: maxX,
|
|
1878
|
+
bottom: minY
|
|
1879
|
+
},
|
|
1880
|
+
width: maxX - minX,
|
|
1881
|
+
height: maxY - minY
|
|
1882
|
+
};
|
|
1883
|
+
}
|
|
1843
1884
|
throw new Error(
|
|
1844
1885
|
`circuitJson bounds calculation not implemented for shape "${smtpad.shape}"`
|
|
1845
1886
|
);
|
|
@@ -9796,7 +9837,7 @@ import { identity as identity4 } from "transformation-matrix";
|
|
|
9796
9837
|
var package_default = {
|
|
9797
9838
|
name: "@tscircuit/core",
|
|
9798
9839
|
type: "module",
|
|
9799
|
-
version: "0.0.
|
|
9840
|
+
version: "0.0.468",
|
|
9800
9841
|
types: "dist/index.d.ts",
|
|
9801
9842
|
main: "dist/index.js",
|
|
9802
9843
|
module: "dist/index.js",
|
|
@@ -10228,6 +10269,14 @@ var sel = new Proxy(
|
|
|
10228
10269
|
// - sel.U1(({ selectors: { U1: { GND: "GND", VCC: "VCC" } } }) => ...)
|
|
10229
10270
|
// - sel.U1(({ connections: { GND: "GND", VCC: "VCC" } }) => ...)
|
|
10230
10271
|
apply: (target, _2, args) => {
|
|
10272
|
+
if (prop1 === "net") {
|
|
10273
|
+
return new Proxy(
|
|
10274
|
+
{},
|
|
10275
|
+
{
|
|
10276
|
+
get: (_3, netName) => `net.${netName}`
|
|
10277
|
+
}
|
|
10278
|
+
);
|
|
10279
|
+
}
|
|
10231
10280
|
return new Proxy(
|
|
10232
10281
|
{},
|
|
10233
10282
|
{
|