@tscircuit/footprinter 0.0.169 → 0.0.171
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 +31 -38
- package/dist/index.js +84 -64
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -364,11 +364,10 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
364
364
|
od: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
365
365
|
male: z.ZodOptional<z.ZodBoolean>;
|
|
366
366
|
female: z.ZodOptional<z.ZodBoolean>;
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
pinlabelparallel: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
367
|
+
pinlabeltextalignleft: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
368
|
+
pinlabeltextaligncenter: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
369
|
+
pinlabeltextalignright: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
370
|
+
pinlabelverticallyinverted: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
372
371
|
pinlabelorthogonal: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
373
372
|
nosquareplating: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
374
373
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -377,13 +376,12 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
377
376
|
p: number;
|
|
378
377
|
id: number;
|
|
379
378
|
od: number;
|
|
380
|
-
|
|
379
|
+
pinlabeltextalignleft: boolean;
|
|
380
|
+
pinlabeltextalignright: boolean;
|
|
381
381
|
pinlabelorthogonal: boolean;
|
|
382
382
|
rows: number;
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
pinlabelleft: boolean;
|
|
386
|
-
pinlabelright: boolean;
|
|
383
|
+
pinlabeltextaligncenter: boolean;
|
|
384
|
+
pinlabelverticallyinverted: boolean;
|
|
387
385
|
nosquareplating: boolean;
|
|
388
386
|
male?: boolean | undefined;
|
|
389
387
|
female?: boolean | undefined;
|
|
@@ -395,16 +393,15 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
395
393
|
od?: string | number | undefined;
|
|
396
394
|
male?: boolean | undefined;
|
|
397
395
|
female?: boolean | undefined;
|
|
398
|
-
|
|
396
|
+
pinlabeltextalignleft?: boolean | undefined;
|
|
397
|
+
pinlabeltextalignright?: boolean | undefined;
|
|
399
398
|
pinlabelorthogonal?: boolean | undefined;
|
|
400
399
|
rows?: string | number | undefined;
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
pinlabelleft?: boolean | undefined;
|
|
404
|
-
pinlabelright?: boolean | undefined;
|
|
400
|
+
pinlabeltextaligncenter?: boolean | undefined;
|
|
401
|
+
pinlabelverticallyinverted?: boolean | undefined;
|
|
405
402
|
nosquareplating?: boolean | undefined;
|
|
406
403
|
}>, {
|
|
407
|
-
|
|
404
|
+
pinlabelAnchorSide: "top" | "bottom" | "left" | "right";
|
|
408
405
|
male: boolean;
|
|
409
406
|
female: boolean;
|
|
410
407
|
fn: string;
|
|
@@ -412,13 +409,12 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
412
409
|
p: number;
|
|
413
410
|
id: number;
|
|
414
411
|
od: number;
|
|
415
|
-
|
|
412
|
+
pinlabeltextalignleft: boolean;
|
|
413
|
+
pinlabeltextalignright: boolean;
|
|
416
414
|
pinlabelorthogonal: boolean;
|
|
417
415
|
rows: number;
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
pinlabelleft: boolean;
|
|
421
|
-
pinlabelright: boolean;
|
|
416
|
+
pinlabeltextaligncenter: boolean;
|
|
417
|
+
pinlabelverticallyinverted: boolean;
|
|
422
418
|
nosquareplating: boolean;
|
|
423
419
|
}, {
|
|
424
420
|
fn: string;
|
|
@@ -428,16 +424,15 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
428
424
|
od?: string | number | undefined;
|
|
429
425
|
male?: boolean | undefined;
|
|
430
426
|
female?: boolean | undefined;
|
|
431
|
-
|
|
427
|
+
pinlabeltextalignleft?: boolean | undefined;
|
|
428
|
+
pinlabeltextalignright?: boolean | undefined;
|
|
432
429
|
pinlabelorthogonal?: boolean | undefined;
|
|
433
430
|
rows?: string | number | undefined;
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
pinlabelleft?: boolean | undefined;
|
|
437
|
-
pinlabelright?: boolean | undefined;
|
|
431
|
+
pinlabeltextaligncenter?: boolean | undefined;
|
|
432
|
+
pinlabelverticallyinverted?: boolean | undefined;
|
|
438
433
|
nosquareplating?: boolean | undefined;
|
|
439
434
|
}>, {
|
|
440
|
-
|
|
435
|
+
pinlabelAnchorSide: "top" | "bottom" | "left" | "right";
|
|
441
436
|
male: boolean;
|
|
442
437
|
female: boolean;
|
|
443
438
|
fn: string;
|
|
@@ -445,13 +440,12 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
445
440
|
p: number;
|
|
446
441
|
id: number;
|
|
447
442
|
od: number;
|
|
448
|
-
|
|
443
|
+
pinlabeltextalignleft: boolean;
|
|
444
|
+
pinlabeltextalignright: boolean;
|
|
449
445
|
pinlabelorthogonal: boolean;
|
|
450
446
|
rows: number;
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
pinlabelleft: boolean;
|
|
454
|
-
pinlabelright: boolean;
|
|
447
|
+
pinlabeltextaligncenter: boolean;
|
|
448
|
+
pinlabelverticallyinverted: boolean;
|
|
455
449
|
nosquareplating: boolean;
|
|
456
450
|
}, {
|
|
457
451
|
fn: string;
|
|
@@ -461,13 +455,12 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
461
455
|
od?: string | number | undefined;
|
|
462
456
|
male?: boolean | undefined;
|
|
463
457
|
female?: boolean | undefined;
|
|
464
|
-
|
|
458
|
+
pinlabeltextalignleft?: boolean | undefined;
|
|
459
|
+
pinlabeltextalignright?: boolean | undefined;
|
|
465
460
|
pinlabelorthogonal?: boolean | undefined;
|
|
466
461
|
rows?: string | number | undefined;
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
pinlabelleft?: boolean | undefined;
|
|
470
|
-
pinlabelright?: boolean | undefined;
|
|
462
|
+
pinlabeltextaligncenter?: boolean | undefined;
|
|
463
|
+
pinlabelverticallyinverted?: boolean | undefined;
|
|
471
464
|
nosquareplating?: boolean | undefined;
|
|
472
465
|
}>, z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<{
|
|
473
466
|
fn: z.ZodString;
|
|
@@ -1058,7 +1051,7 @@ type Footprinter = {
|
|
|
1058
1051
|
ssop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p">;
|
|
1059
1052
|
tssop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p">;
|
|
1060
1053
|
dfn: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p">;
|
|
1061
|
-
pinrow: (num_pins?: number) => FootprinterParamsBuilder<"p" | "id" | "od" | "male" | "female" | "rows" | "
|
|
1054
|
+
pinrow: (num_pins?: number) => FootprinterParamsBuilder<"p" | "id" | "od" | "male" | "female" | "rows" | "pinlabeltextalignleft" | "pinlabeltextaligncenter" | "pinlabeltextalignright" | "pinlabelverticallyinverted" | "pinlabelorthogonal" | "nosquareplating">;
|
|
1062
1055
|
axial: () => FootprinterParamsBuilder<"p" | "id" | "od">;
|
|
1063
1056
|
hc49: () => FootprinterParamsBuilder<"p" | "id" | "od" | "w" | "h">;
|
|
1064
1057
|
to220: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
|
package/dist/index.js
CHANGED
|
@@ -1558,37 +1558,38 @@ var platedHoleWithRectPad = (pn, x, y, holeDiameter, rectPadWidth, rectPadHeight
|
|
|
1558
1558
|
};
|
|
1559
1559
|
|
|
1560
1560
|
// src/helpers/silkscreenPin.ts
|
|
1561
|
-
var fullyExplicitAlignmentMap = {
|
|
1562
|
-
top: { 0: "center", 90: "center_right", 180: "center", 270: "center_left" },
|
|
1563
|
-
bottom: {
|
|
1564
|
-
0: "center",
|
|
1565
|
-
90: "center_left",
|
|
1566
|
-
180: "center",
|
|
1567
|
-
270: "center_right"
|
|
1568
|
-
},
|
|
1569
|
-
left: { 0: "center_right", 90: "center", 180: "center_left", 270: "center" },
|
|
1570
|
-
right: { 0: "center_left", 90: "center", 180: "center_right", 270: "center" }
|
|
1571
|
-
};
|
|
1572
1561
|
var silkscreenPin = ({
|
|
1573
1562
|
fs,
|
|
1574
1563
|
pn,
|
|
1575
1564
|
anchor_x,
|
|
1576
1565
|
anchor_y,
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1566
|
+
textalign = "center",
|
|
1567
|
+
orthogonal = false,
|
|
1568
|
+
verticallyinverted = false
|
|
1580
1569
|
}) => {
|
|
1581
1570
|
let ccw_rotation = 0;
|
|
1582
|
-
if (
|
|
1583
|
-
ccw_rotation = 0;
|
|
1584
|
-
} else if (pinlabelparallel && !pinlabelorthogonal) {
|
|
1585
|
-
ccw_rotation = 90;
|
|
1586
|
-
} else if (!pinlabelparallel && pinlabelorthogonal) {
|
|
1587
|
-
ccw_rotation = 180;
|
|
1588
|
-
} else if (pinlabelparallel && pinlabelorthogonal) {
|
|
1571
|
+
if (orthogonal && verticallyinverted) {
|
|
1589
1572
|
ccw_rotation = 270;
|
|
1573
|
+
} else if (verticallyinverted) {
|
|
1574
|
+
ccw_rotation = 180;
|
|
1575
|
+
} else if (orthogonal) {
|
|
1576
|
+
ccw_rotation = 90;
|
|
1577
|
+
} else {
|
|
1578
|
+
ccw_rotation = 0;
|
|
1579
|
+
}
|
|
1580
|
+
let anchor_alignment = "center";
|
|
1581
|
+
if (textalign === "left") {
|
|
1582
|
+
if (verticallyinverted)
|
|
1583
|
+
anchor_alignment = "center_right";
|
|
1584
|
+
else
|
|
1585
|
+
anchor_alignment = "center_left";
|
|
1586
|
+
}
|
|
1587
|
+
if (textalign === "right") {
|
|
1588
|
+
if (verticallyinverted)
|
|
1589
|
+
anchor_alignment = "center_left";
|
|
1590
|
+
else
|
|
1591
|
+
anchor_alignment = "center_right";
|
|
1590
1592
|
}
|
|
1591
|
-
const anchor_alignment = fullyExplicitAlignmentMap[pinlabelposition][ccw_rotation];
|
|
1592
1593
|
return {
|
|
1593
1594
|
type: "pcb_silkscreen_text",
|
|
1594
1595
|
pcb_silkscreen_text_id: "silkscreen_text_1",
|
|
@@ -1605,6 +1606,37 @@ var silkscreenPin = ({
|
|
|
1605
1606
|
|
|
1606
1607
|
// src/fn/pinrow.ts
|
|
1607
1608
|
import "@tscircuit/mm";
|
|
1609
|
+
|
|
1610
|
+
// src/helpers/determine-pin-label-anchor-side.ts
|
|
1611
|
+
function determinePinlabelAnchorSide({
|
|
1612
|
+
pinlabeltextalignleft,
|
|
1613
|
+
pinlabeltextalignright,
|
|
1614
|
+
pinlabelorthogonal
|
|
1615
|
+
}) {
|
|
1616
|
+
let pinlabelAnchorSide = "top";
|
|
1617
|
+
if (pinlabelorthogonal) {
|
|
1618
|
+
pinlabelAnchorSide = "left";
|
|
1619
|
+
} else {
|
|
1620
|
+
pinlabelAnchorSide = "top";
|
|
1621
|
+
}
|
|
1622
|
+
if (pinlabeltextalignleft) {
|
|
1623
|
+
if (pinlabelorthogonal) {
|
|
1624
|
+
pinlabelAnchorSide = "bottom";
|
|
1625
|
+
} else {
|
|
1626
|
+
pinlabelAnchorSide = "right";
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
if (pinlabeltextalignright) {
|
|
1630
|
+
if (pinlabelorthogonal) {
|
|
1631
|
+
pinlabelAnchorSide = "top";
|
|
1632
|
+
} else {
|
|
1633
|
+
pinlabelAnchorSide = "left";
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
return pinlabelAnchorSide;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
// src/fn/pinrow.ts
|
|
1608
1640
|
var pinrow_def = z11.object({
|
|
1609
1641
|
fn: z11.string(),
|
|
1610
1642
|
num_pins: z11.number().optional().default(6),
|
|
@@ -1614,35 +1646,17 @@ var pinrow_def = z11.object({
|
|
|
1614
1646
|
od: length5.default("1.5mm").describe("outer diameter"),
|
|
1615
1647
|
male: z11.boolean().optional().describe("for male pin headers"),
|
|
1616
1648
|
female: z11.boolean().optional().describe("for female pin headers"),
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
pinlabelparallel: z11.boolean().optional().default(false),
|
|
1649
|
+
pinlabeltextalignleft: z11.boolean().optional().default(false),
|
|
1650
|
+
pinlabeltextaligncenter: z11.boolean().optional().default(false),
|
|
1651
|
+
pinlabeltextalignright: z11.boolean().optional().default(false),
|
|
1652
|
+
pinlabelverticallyinverted: z11.boolean().optional().default(false),
|
|
1622
1653
|
pinlabelorthogonal: z11.boolean().optional().default(false),
|
|
1623
1654
|
nosquareplating: z11.boolean().optional().default(false).describe("do not use rectangular pad for pin 1")
|
|
1624
1655
|
}).transform((data) => {
|
|
1625
|
-
|
|
1626
|
-
const { pinlabeltop, pinlabelbottom, pinlabelleft, pinlabelright } = data;
|
|
1627
|
-
const truePositionFlags = [];
|
|
1628
|
-
if (pinlabeltop)
|
|
1629
|
-
truePositionFlags.push("top");
|
|
1630
|
-
if (pinlabelbottom)
|
|
1631
|
-
truePositionFlags.push("bottom");
|
|
1632
|
-
if (pinlabelleft)
|
|
1633
|
-
truePositionFlags.push("left");
|
|
1634
|
-
if (pinlabelright)
|
|
1635
|
-
truePositionFlags.push("right");
|
|
1636
|
-
if (truePositionFlags.includes("top")) {
|
|
1637
|
-
resolvedPinLabelPosition = "top";
|
|
1638
|
-
} else if (truePositionFlags.length === 1) {
|
|
1639
|
-
resolvedPinLabelPosition = truePositionFlags[0];
|
|
1640
|
-
} else {
|
|
1641
|
-
resolvedPinLabelPosition = "top";
|
|
1642
|
-
}
|
|
1656
|
+
const pinlabelAnchorSide = determinePinlabelAnchorSide(data);
|
|
1643
1657
|
return {
|
|
1644
1658
|
...data,
|
|
1645
|
-
|
|
1659
|
+
pinlabelAnchorSide,
|
|
1646
1660
|
male: data.male ?? (data.female ? false : true),
|
|
1647
1661
|
female: data.female ?? false
|
|
1648
1662
|
};
|
|
@@ -1663,36 +1677,41 @@ var pinrow = (raw_params) => {
|
|
|
1663
1677
|
od,
|
|
1664
1678
|
rows,
|
|
1665
1679
|
num_pins,
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
pinlabelorthogonal
|
|
1680
|
+
pinlabelAnchorSide,
|
|
1681
|
+
pinlabelverticallyinverted,
|
|
1682
|
+
pinlabelorthogonal,
|
|
1683
|
+
pinlabeltextalignleft,
|
|
1684
|
+
pinlabeltextalignright
|
|
1669
1685
|
} = parameters;
|
|
1686
|
+
let pinlabelTextAlign = "center";
|
|
1687
|
+
if (pinlabeltextalignleft)
|
|
1688
|
+
pinlabelTextAlign = "left";
|
|
1689
|
+
else if (pinlabeltextalignright)
|
|
1690
|
+
pinlabelTextAlign = "right";
|
|
1670
1691
|
const holes = [];
|
|
1671
1692
|
const numPinsPerRow = Math.ceil(num_pins / rows);
|
|
1672
1693
|
const ySpacing = -p;
|
|
1673
|
-
const calculateAnchorPosition = (
|
|
1694
|
+
const calculateAnchorPosition = ({
|
|
1695
|
+
xoff,
|
|
1696
|
+
yoff,
|
|
1697
|
+
od: od2,
|
|
1698
|
+
anchorSide
|
|
1699
|
+
}) => {
|
|
1674
1700
|
let dx = 0, dy = 0;
|
|
1675
1701
|
const offset = od2 * 0.75;
|
|
1676
|
-
switch (
|
|
1702
|
+
switch (anchorSide) {
|
|
1677
1703
|
case "right":
|
|
1678
1704
|
dx = offset;
|
|
1679
|
-
dy = 0;
|
|
1680
1705
|
break;
|
|
1681
1706
|
case "top":
|
|
1682
|
-
dx = 0;
|
|
1683
1707
|
dy = offset;
|
|
1684
1708
|
break;
|
|
1685
1709
|
case "bottom":
|
|
1686
|
-
dx = 0;
|
|
1687
1710
|
dy = -offset;
|
|
1688
1711
|
break;
|
|
1689
1712
|
case "left":
|
|
1690
1713
|
dx = -offset;
|
|
1691
|
-
dy = 0;
|
|
1692
1714
|
break;
|
|
1693
|
-
default:
|
|
1694
|
-
dx = 0;
|
|
1695
|
-
dy = 0;
|
|
1696
1715
|
}
|
|
1697
1716
|
return { anchor_x: xoff + dx, anchor_y: yoff + dy };
|
|
1698
1717
|
};
|
|
@@ -1702,21 +1721,22 @@ var pinrow = (raw_params) => {
|
|
|
1702
1721
|
} else {
|
|
1703
1722
|
holes.push(platedhole(pinNumber, xoff, yoff, id, od));
|
|
1704
1723
|
}
|
|
1705
|
-
const { anchor_x, anchor_y } = calculateAnchorPosition(
|
|
1724
|
+
const { anchor_x, anchor_y } = calculateAnchorPosition({
|
|
1706
1725
|
xoff,
|
|
1707
1726
|
yoff,
|
|
1708
1727
|
od,
|
|
1709
|
-
|
|
1710
|
-
);
|
|
1728
|
+
anchorSide: pinlabelAnchorSide
|
|
1729
|
+
});
|
|
1711
1730
|
holes.push(
|
|
1712
1731
|
silkscreenPin({
|
|
1713
1732
|
fs: od / 5,
|
|
1714
1733
|
pn: pinNumber,
|
|
1715
1734
|
anchor_x,
|
|
1716
1735
|
anchor_y,
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
pinlabelorthogonal
|
|
1736
|
+
anchorplacement: pinlabelAnchorSide,
|
|
1737
|
+
textalign: pinlabelTextAlign,
|
|
1738
|
+
orthogonal: pinlabelorthogonal,
|
|
1739
|
+
verticallyinverted: pinlabelverticallyinverted
|
|
1720
1740
|
})
|
|
1721
1741
|
);
|
|
1722
1742
|
};
|