@tscircuit/footprinter 0.0.169 → 0.0.170
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 +91 -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
|
+
pinlabelverticallyinverted: boolean;
|
|
381
382
|
pinlabelorthogonal: boolean;
|
|
382
383
|
rows: number;
|
|
383
|
-
|
|
384
|
-
pinlabelbottom: boolean;
|
|
385
|
-
pinlabelleft: boolean;
|
|
386
|
-
pinlabelright: boolean;
|
|
384
|
+
pinlabeltextaligncenter: 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;
|
|
398
|
+
pinlabelverticallyinverted?: boolean | undefined;
|
|
399
399
|
pinlabelorthogonal?: boolean | undefined;
|
|
400
400
|
rows?: string | number | undefined;
|
|
401
|
-
|
|
402
|
-
pinlabelbottom?: boolean | undefined;
|
|
403
|
-
pinlabelleft?: boolean | undefined;
|
|
404
|
-
pinlabelright?: boolean | undefined;
|
|
401
|
+
pinlabeltextaligncenter?: 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;
|
|
414
|
+
pinlabelverticallyinverted: boolean;
|
|
416
415
|
pinlabelorthogonal: boolean;
|
|
417
416
|
rows: number;
|
|
418
|
-
|
|
419
|
-
pinlabelbottom: boolean;
|
|
420
|
-
pinlabelleft: boolean;
|
|
421
|
-
pinlabelright: boolean;
|
|
417
|
+
pinlabeltextaligncenter: 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;
|
|
429
|
+
pinlabelverticallyinverted?: boolean | undefined;
|
|
432
430
|
pinlabelorthogonal?: boolean | undefined;
|
|
433
431
|
rows?: string | number | undefined;
|
|
434
|
-
|
|
435
|
-
pinlabelbottom?: boolean | undefined;
|
|
436
|
-
pinlabelleft?: boolean | undefined;
|
|
437
|
-
pinlabelright?: boolean | undefined;
|
|
432
|
+
pinlabeltextaligncenter?: 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;
|
|
445
|
+
pinlabelverticallyinverted: boolean;
|
|
449
446
|
pinlabelorthogonal: boolean;
|
|
450
447
|
rows: number;
|
|
451
|
-
|
|
452
|
-
pinlabelbottom: boolean;
|
|
453
|
-
pinlabelleft: boolean;
|
|
454
|
-
pinlabelright: boolean;
|
|
448
|
+
pinlabeltextaligncenter: 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;
|
|
460
|
+
pinlabelverticallyinverted?: boolean | undefined;
|
|
465
461
|
pinlabelorthogonal?: boolean | undefined;
|
|
466
462
|
rows?: string | number | undefined;
|
|
467
|
-
|
|
468
|
-
pinlabelbottom?: boolean | undefined;
|
|
469
|
-
pinlabelleft?: boolean | undefined;
|
|
470
|
-
pinlabelright?: boolean | undefined;
|
|
463
|
+
pinlabeltextaligncenter?: 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,32 @@ 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
|
+
anchor_alignment = "center_left";
|
|
1583
|
+
}
|
|
1584
|
+
if (textalign === "right") {
|
|
1585
|
+
anchor_alignment = "center_right";
|
|
1590
1586
|
}
|
|
1591
|
-
const anchor_alignment = fullyExplicitAlignmentMap[pinlabelposition][ccw_rotation];
|
|
1592
1587
|
return {
|
|
1593
1588
|
type: "pcb_silkscreen_text",
|
|
1594
1589
|
pcb_silkscreen_text_id: "silkscreen_text_1",
|
|
@@ -1605,6 +1600,50 @@ var silkscreenPin = ({
|
|
|
1605
1600
|
|
|
1606
1601
|
// src/fn/pinrow.ts
|
|
1607
1602
|
import "@tscircuit/mm";
|
|
1603
|
+
|
|
1604
|
+
// src/helpers/determine-pin-label-anchor-side.ts
|
|
1605
|
+
function determinePinlabelAnchorSide({
|
|
1606
|
+
pinlabeltextalignleft,
|
|
1607
|
+
pinlabeltextalignright,
|
|
1608
|
+
pinlabelverticallyinverted,
|
|
1609
|
+
pinlabelorthogonal
|
|
1610
|
+
}) {
|
|
1611
|
+
let pinlabelAnchorSide = "top";
|
|
1612
|
+
if (pinlabelorthogonal && pinlabelverticallyinverted) {
|
|
1613
|
+
pinlabelAnchorSide = "left";
|
|
1614
|
+
} else if (pinlabelorthogonal) {
|
|
1615
|
+
pinlabelAnchorSide = "right";
|
|
1616
|
+
} else if (pinlabelverticallyinverted) {
|
|
1617
|
+
pinlabelAnchorSide = "bottom";
|
|
1618
|
+
} else {
|
|
1619
|
+
pinlabelAnchorSide = "top";
|
|
1620
|
+
}
|
|
1621
|
+
if (pinlabeltextalignleft) {
|
|
1622
|
+
if (pinlabelorthogonal && pinlabelverticallyinverted) {
|
|
1623
|
+
pinlabelAnchorSide = "top";
|
|
1624
|
+
} else if (pinlabelorthogonal) {
|
|
1625
|
+
pinlabelAnchorSide = "bottom";
|
|
1626
|
+
} else if (pinlabelverticallyinverted) {
|
|
1627
|
+
pinlabelAnchorSide = "left";
|
|
1628
|
+
} else {
|
|
1629
|
+
pinlabelAnchorSide = "right";
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
if (pinlabeltextalignright) {
|
|
1633
|
+
if (pinlabelorthogonal && pinlabelverticallyinverted) {
|
|
1634
|
+
pinlabelAnchorSide = "bottom";
|
|
1635
|
+
} else if (pinlabelorthogonal) {
|
|
1636
|
+
pinlabelAnchorSide = "top";
|
|
1637
|
+
} else if (pinlabelverticallyinverted) {
|
|
1638
|
+
pinlabelAnchorSide = "right";
|
|
1639
|
+
} else {
|
|
1640
|
+
pinlabelAnchorSide = "left";
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
return pinlabelAnchorSide;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
// src/fn/pinrow.ts
|
|
1608
1647
|
var pinrow_def = z11.object({
|
|
1609
1648
|
fn: z11.string(),
|
|
1610
1649
|
num_pins: z11.number().optional().default(6),
|
|
@@ -1614,35 +1653,17 @@ var pinrow_def = z11.object({
|
|
|
1614
1653
|
od: length5.default("1.5mm").describe("outer diameter"),
|
|
1615
1654
|
male: z11.boolean().optional().describe("for male pin headers"),
|
|
1616
1655
|
female: z11.boolean().optional().describe("for female pin headers"),
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
pinlabelparallel: z11.boolean().optional().default(false),
|
|
1656
|
+
pinlabeltextalignleft: z11.boolean().optional().default(false),
|
|
1657
|
+
pinlabeltextaligncenter: z11.boolean().optional().default(false),
|
|
1658
|
+
pinlabeltextalignright: z11.boolean().optional().default(false),
|
|
1659
|
+
pinlabelverticallyinverted: z11.boolean().optional().default(false),
|
|
1622
1660
|
pinlabelorthogonal: z11.boolean().optional().default(false),
|
|
1623
1661
|
nosquareplating: z11.boolean().optional().default(false).describe("do not use rectangular pad for pin 1")
|
|
1624
1662
|
}).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
|
-
}
|
|
1663
|
+
const pinlabelAnchorSide = determinePinlabelAnchorSide(data);
|
|
1643
1664
|
return {
|
|
1644
1665
|
...data,
|
|
1645
|
-
|
|
1666
|
+
pinlabelAnchorSide,
|
|
1646
1667
|
male: data.male ?? (data.female ? false : true),
|
|
1647
1668
|
female: data.female ?? false
|
|
1648
1669
|
};
|
|
@@ -1663,36 +1684,41 @@ var pinrow = (raw_params) => {
|
|
|
1663
1684
|
od,
|
|
1664
1685
|
rows,
|
|
1665
1686
|
num_pins,
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
pinlabelorthogonal
|
|
1687
|
+
pinlabelAnchorSide,
|
|
1688
|
+
pinlabelverticallyinverted,
|
|
1689
|
+
pinlabelorthogonal,
|
|
1690
|
+
pinlabeltextalignleft,
|
|
1691
|
+
pinlabeltextalignright
|
|
1669
1692
|
} = parameters;
|
|
1693
|
+
let pinlabelTextAlign = "center";
|
|
1694
|
+
if (pinlabeltextalignleft)
|
|
1695
|
+
pinlabelTextAlign = "left";
|
|
1696
|
+
else if (pinlabeltextalignright)
|
|
1697
|
+
pinlabelTextAlign = "right";
|
|
1670
1698
|
const holes = [];
|
|
1671
1699
|
const numPinsPerRow = Math.ceil(num_pins / rows);
|
|
1672
1700
|
const ySpacing = -p;
|
|
1673
|
-
const calculateAnchorPosition = (
|
|
1701
|
+
const calculateAnchorPosition = ({
|
|
1702
|
+
xoff,
|
|
1703
|
+
yoff,
|
|
1704
|
+
od: od2,
|
|
1705
|
+
anchorSide
|
|
1706
|
+
}) => {
|
|
1674
1707
|
let dx = 0, dy = 0;
|
|
1675
1708
|
const offset = od2 * 0.75;
|
|
1676
|
-
switch (
|
|
1709
|
+
switch (anchorSide) {
|
|
1677
1710
|
case "right":
|
|
1678
1711
|
dx = offset;
|
|
1679
|
-
dy = 0;
|
|
1680
1712
|
break;
|
|
1681
1713
|
case "top":
|
|
1682
|
-
dx = 0;
|
|
1683
1714
|
dy = offset;
|
|
1684
1715
|
break;
|
|
1685
1716
|
case "bottom":
|
|
1686
|
-
dx = 0;
|
|
1687
1717
|
dy = -offset;
|
|
1688
1718
|
break;
|
|
1689
1719
|
case "left":
|
|
1690
1720
|
dx = -offset;
|
|
1691
|
-
dy = 0;
|
|
1692
1721
|
break;
|
|
1693
|
-
default:
|
|
1694
|
-
dx = 0;
|
|
1695
|
-
dy = 0;
|
|
1696
1722
|
}
|
|
1697
1723
|
return { anchor_x: xoff + dx, anchor_y: yoff + dy };
|
|
1698
1724
|
};
|
|
@@ -1702,21 +1728,22 @@ var pinrow = (raw_params) => {
|
|
|
1702
1728
|
} else {
|
|
1703
1729
|
holes.push(platedhole(pinNumber, xoff, yoff, id, od));
|
|
1704
1730
|
}
|
|
1705
|
-
const { anchor_x, anchor_y } = calculateAnchorPosition(
|
|
1731
|
+
const { anchor_x, anchor_y } = calculateAnchorPosition({
|
|
1706
1732
|
xoff,
|
|
1707
1733
|
yoff,
|
|
1708
1734
|
od,
|
|
1709
|
-
|
|
1710
|
-
);
|
|
1735
|
+
anchorSide: pinlabelAnchorSide
|
|
1736
|
+
});
|
|
1711
1737
|
holes.push(
|
|
1712
1738
|
silkscreenPin({
|
|
1713
1739
|
fs: od / 5,
|
|
1714
1740
|
pn: pinNumber,
|
|
1715
1741
|
anchor_x,
|
|
1716
1742
|
anchor_y,
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
pinlabelorthogonal
|
|
1743
|
+
anchorplacement: pinlabelAnchorSide,
|
|
1744
|
+
textalign: pinlabelTextAlign,
|
|
1745
|
+
orthogonal: pinlabelorthogonal,
|
|
1746
|
+
verticallyinverted: pinlabelverticallyinverted
|
|
1720
1747
|
})
|
|
1721
1748
|
);
|
|
1722
1749
|
};
|