@tscircuit/footprinter 0.0.354 → 0.0.356
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 +64 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1568,6 +1568,8 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
1568
1568
|
faceup: z.ZodOptional<z.ZodBoolean>;
|
|
1569
1569
|
nosilkscreen: z.ZodOptional<z.ZodBoolean>;
|
|
1570
1570
|
} & {
|
|
1571
|
+
fn: z.ZodOptional<z.ZodString>;
|
|
1572
|
+
string: z.ZodOptional<z.ZodString>;
|
|
1571
1573
|
tht: z.ZodBoolean;
|
|
1572
1574
|
p: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
1573
1575
|
pw: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
@@ -1579,10 +1581,12 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
1579
1581
|
textbottom: z.ZodOptional<z.ZodBoolean>;
|
|
1580
1582
|
}, "strip", z.ZodTypeAny, {
|
|
1581
1583
|
tht: boolean;
|
|
1584
|
+
string?: string | undefined;
|
|
1582
1585
|
norefdes?: boolean | undefined;
|
|
1583
1586
|
invert?: boolean | undefined;
|
|
1584
1587
|
faceup?: boolean | undefined;
|
|
1585
1588
|
nosilkscreen?: boolean | undefined;
|
|
1589
|
+
fn?: string | undefined;
|
|
1586
1590
|
w?: number | undefined;
|
|
1587
1591
|
p?: number | undefined;
|
|
1588
1592
|
pw?: number | undefined;
|
|
@@ -1593,10 +1597,12 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
1593
1597
|
textbottom?: boolean | undefined;
|
|
1594
1598
|
}, {
|
|
1595
1599
|
tht: boolean;
|
|
1600
|
+
string?: string | undefined;
|
|
1596
1601
|
norefdes?: boolean | undefined;
|
|
1597
1602
|
invert?: boolean | undefined;
|
|
1598
1603
|
faceup?: boolean | undefined;
|
|
1599
1604
|
nosilkscreen?: boolean | undefined;
|
|
1605
|
+
fn?: string | undefined;
|
|
1600
1606
|
w?: string | number | undefined;
|
|
1601
1607
|
p?: string | number | undefined;
|
|
1602
1608
|
pw?: string | number | undefined;
|
package/dist/index.js
CHANGED
|
@@ -603,6 +603,8 @@ var createCourtyardRect = (width, height) => ({
|
|
|
603
603
|
layer: "top"
|
|
604
604
|
});
|
|
605
605
|
var passive_def = base_def.extend({
|
|
606
|
+
fn: z3.string().optional(),
|
|
607
|
+
string: z3.string().optional(),
|
|
606
608
|
tht: z3.boolean(),
|
|
607
609
|
p: length.optional(),
|
|
608
610
|
pw: length.optional(),
|
|
@@ -614,7 +616,19 @@ var passive_def = base_def.extend({
|
|
|
614
616
|
textbottom: z3.boolean().optional()
|
|
615
617
|
});
|
|
616
618
|
var passive = (params) => {
|
|
617
|
-
let {
|
|
619
|
+
let {
|
|
620
|
+
fn,
|
|
621
|
+
tht,
|
|
622
|
+
p,
|
|
623
|
+
pw,
|
|
624
|
+
ph,
|
|
625
|
+
metric,
|
|
626
|
+
imperial,
|
|
627
|
+
w,
|
|
628
|
+
h,
|
|
629
|
+
textbottom,
|
|
630
|
+
string: footprintString
|
|
631
|
+
} = params;
|
|
618
632
|
if (typeof w === "string") w = mm3(w);
|
|
619
633
|
if (typeof h === "string") h = mm3(h);
|
|
620
634
|
if (typeof p === "string") p = mm3(p);
|
|
@@ -638,19 +652,52 @@ var passive = (params) => {
|
|
|
638
652
|
if (p === void 0 || pw === void 0 || ph === void 0) {
|
|
639
653
|
throw new Error("Could not determine required pad dimensions (p, pw, ph)");
|
|
640
654
|
}
|
|
641
|
-
const
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
{
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
655
|
+
const lineLength = (p - pw) * 0.6;
|
|
656
|
+
const lineY = ph / 2 + 0.06;
|
|
657
|
+
let silkscreenLines = [];
|
|
658
|
+
const usesNonPolarized0402ResistorSilkscreen = fn === "res" && typeof footprintString === "string" && /^res0402(?:_|$)/i.test(footprintString);
|
|
659
|
+
if (usesNonPolarized0402ResistorSilkscreen) {
|
|
660
|
+
silkscreenLines = [
|
|
661
|
+
{
|
|
662
|
+
type: "pcb_silkscreen_path",
|
|
663
|
+
layer: "top",
|
|
664
|
+
pcb_component_id: "",
|
|
665
|
+
route: [
|
|
666
|
+
{ x: -lineLength / 2, y: lineY },
|
|
667
|
+
{ x: lineLength / 2, y: lineY }
|
|
668
|
+
],
|
|
669
|
+
stroke_width: 0.12,
|
|
670
|
+
pcb_silkscreen_path_id: ""
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
type: "pcb_silkscreen_path",
|
|
674
|
+
layer: "top",
|
|
675
|
+
pcb_component_id: "",
|
|
676
|
+
route: [
|
|
677
|
+
{ x: -lineLength / 2, y: -lineY },
|
|
678
|
+
{ x: lineLength / 2, y: -lineY }
|
|
679
|
+
],
|
|
680
|
+
stroke_width: 0.12,
|
|
681
|
+
pcb_silkscreen_path_id: ""
|
|
682
|
+
}
|
|
683
|
+
];
|
|
684
|
+
} else {
|
|
685
|
+
silkscreenLines = [
|
|
686
|
+
{
|
|
687
|
+
type: "pcb_silkscreen_path",
|
|
688
|
+
layer: "top",
|
|
689
|
+
pcb_component_id: "",
|
|
690
|
+
route: [
|
|
691
|
+
{ x: p / 2, y: ph / 2 + 0.4 },
|
|
692
|
+
{ x: -p / 2 - pw / 2 - 0.2, y: ph / 2 + 0.4 },
|
|
693
|
+
{ x: -p / 2 - pw / 2 - 0.2, y: -ph / 2 - 0.4 },
|
|
694
|
+
{ x: p / 2, y: -ph / 2 - 0.4 }
|
|
695
|
+
],
|
|
696
|
+
stroke_width: 0.1,
|
|
697
|
+
pcb_silkscreen_path_id: ""
|
|
698
|
+
}
|
|
699
|
+
];
|
|
700
|
+
}
|
|
654
701
|
const textY = textbottom ? -ph / 2 - 0.9 : ph / 2 + 0.9;
|
|
655
702
|
const silkscreenRefText = silkscreenRef(0, textY, 0.2);
|
|
656
703
|
const courtyard = sz?.courtyard_width_mm && sz.courtyard_height_mm ? createCourtyardRect(sz.courtyard_width_mm, sz.courtyard_height_mm) : null;
|
|
@@ -658,7 +705,7 @@ var passive = (params) => {
|
|
|
658
705
|
return [
|
|
659
706
|
platedhole(1, -p / 2, 0, pw, pw * 1 / 0.8),
|
|
660
707
|
platedhole(2, p / 2, 0, pw, pw * 1 / 0.8),
|
|
661
|
-
|
|
708
|
+
...silkscreenLines,
|
|
662
709
|
silkscreenRefText,
|
|
663
710
|
...courtyard ? [courtyard] : []
|
|
664
711
|
];
|
|
@@ -666,7 +713,7 @@ var passive = (params) => {
|
|
|
666
713
|
return [
|
|
667
714
|
rectpad(["1", "left"], -p / 2, 0, pw, ph),
|
|
668
715
|
rectpad(["2", "right"], p / 2, 0, pw, ph),
|
|
669
|
-
|
|
716
|
+
...silkscreenLines,
|
|
670
717
|
silkscreenRefText,
|
|
671
718
|
...courtyard ? [courtyard] : []
|
|
672
719
|
];
|
|
@@ -11154,7 +11201,7 @@ var footprinter = () => {
|
|
|
11154
11201
|
} else {
|
|
11155
11202
|
target[prop] = true;
|
|
11156
11203
|
target.fn = prop;
|
|
11157
|
-
if (prop === "res" || prop === "cap") {
|
|
11204
|
+
if (prop === "res" || prop === "cap" || prop === "led" || prop === "diode") {
|
|
11158
11205
|
if (v) {
|
|
11159
11206
|
if (typeof v === "string" && v.includes("_metric")) {
|
|
11160
11207
|
target.metric = v.split("_metric")[0];
|