@tscircuit/footprinter 0.0.355 → 0.0.357

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 CHANGED
@@ -11,6 +11,11 @@ type StandardSize = {
11
11
  w_mm_min: number;
12
12
  courtyard_width_mm?: number;
13
13
  courtyard_height_mm?: number;
14
+ nonpolarizedSilkscreen?: {
15
+ line_half_length_mm?: number;
16
+ line_y_mm?: number;
17
+ stroke_width_mm?: number;
18
+ };
14
19
  };
15
20
  declare const footprintSizes: StandardSize[];
16
21
 
@@ -1578,6 +1583,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
1578
1583
  imperial: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
1579
1584
  w: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
1580
1585
  h: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
1586
+ nonpolarized: z.ZodOptional<z.ZodBoolean>;
1581
1587
  textbottom: z.ZodOptional<z.ZodBoolean>;
1582
1588
  }, "strip", z.ZodTypeAny, {
1583
1589
  tht: boolean;
@@ -1594,6 +1600,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
1594
1600
  metric?: number | undefined;
1595
1601
  imperial?: number | undefined;
1596
1602
  h?: number | undefined;
1603
+ nonpolarized?: boolean | undefined;
1597
1604
  textbottom?: boolean | undefined;
1598
1605
  }, {
1599
1606
  tht: boolean;
@@ -1610,6 +1617,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
1610
1617
  metric?: string | number | undefined;
1611
1618
  imperial?: string | number | undefined;
1612
1619
  h?: string | number | undefined;
1620
+ nonpolarized?: boolean | undefined;
1613
1621
  textbottom?: boolean | undefined;
1614
1622
  }>, z.ZodObject<{
1615
1623
  norefdes: z.ZodOptional<z.ZodBoolean>;
@@ -1747,7 +1755,7 @@ type BaseOptionKey = "origin" | "norefdes" | "invert" | "faceup" | "nosilkscreen
1747
1755
  type FootprinterParamsBuilder<K extends string> = {
1748
1756
  [P in K | BaseOptionKey | "params" | "soup" | "circuitJson"]: P extends "params" | "soup" | "circuitJson" ? Footprinter[P] : (v?: number | string | boolean) => FootprinterParamsBuilder<K>;
1749
1757
  };
1750
- type CommonPassiveOptionKey = "metric" | "imperial" | "tht" | "p" | "pw" | "ph" | "w" | "h" | "textbottom";
1758
+ type CommonPassiveOptionKey = "metric" | "imperial" | "tht" | "p" | "pw" | "ph" | "w" | "h" | "nonpolarized" | "textbottom";
1751
1759
  type Footprinter = {
1752
1760
  dip: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p" | "id" | "od" | "wide" | "narrow">;
1753
1761
  cap: () => FootprinterParamsBuilder<CommonPassiveOptionKey>;
package/dist/index.js CHANGED
@@ -498,7 +498,12 @@ var footprintSizes = [
498
498
  w_mm_min: 5.4,
499
499
  h_mm_min: 3.4,
500
500
  courtyard_width_mm: 5.9,
501
- courtyard_height_mm: 3.9
501
+ courtyard_height_mm: 3.9,
502
+ nonpolarizedSilkscreen: {
503
+ line_half_length_mm: 1.386252,
504
+ line_y_mm: 1.71,
505
+ stroke_width_mm: 0.12
506
+ }
502
507
  },
503
508
  {
504
509
  imperial: "0201",
@@ -520,7 +525,12 @@ var footprintSizes = [
520
525
  w_mm_min: 1.56,
521
526
  h_mm_min: 0.64,
522
527
  courtyard_width_mm: 1.86,
523
- courtyard_height_mm: 0.94
528
+ courtyard_height_mm: 0.94,
529
+ nonpolarizedSilkscreen: {
530
+ line_half_length_mm: 0.153641,
531
+ line_y_mm: 0.38,
532
+ stroke_width_mm: 0.12
533
+ }
524
534
  },
525
535
  {
526
536
  imperial: "0603",
@@ -531,7 +541,12 @@ var footprintSizes = [
531
541
  w_mm_min: 2.45,
532
542
  h_mm_min: 0.95,
533
543
  courtyard_width_mm: 2.96,
534
- courtyard_height_mm: 1.46
544
+ courtyard_height_mm: 1.46,
545
+ nonpolarizedSilkscreen: {
546
+ line_half_length_mm: 0.237258,
547
+ line_y_mm: 0.5225,
548
+ stroke_width_mm: 0.12
549
+ }
535
550
  },
536
551
  {
537
552
  imperial: "0805",
@@ -542,7 +557,12 @@ var footprintSizes = [
542
557
  w_mm_min: 2.8499999999999996,
543
558
  h_mm_min: 1.4,
544
559
  courtyard_width_mm: 3.36,
545
- courtyard_height_mm: 1.9
560
+ courtyard_height_mm: 1.9,
561
+ nonpolarizedSilkscreen: {
562
+ line_half_length_mm: 0.227064,
563
+ line_y_mm: 0.735,
564
+ stroke_width_mm: 0.12
565
+ }
546
566
  },
547
567
  {
548
568
  imperial: "1206",
@@ -553,7 +573,12 @@ var footprintSizes = [
553
573
  w_mm_min: 4.05,
554
574
  h_mm_min: 1.75,
555
575
  courtyard_width_mm: 4.56,
556
- courtyard_height_mm: 2.26
576
+ courtyard_height_mm: 2.26,
577
+ nonpolarizedSilkscreen: {
578
+ line_half_length_mm: 0.727064,
579
+ line_y_mm: 0.91,
580
+ stroke_width_mm: 0.12
581
+ }
557
582
  },
558
583
  {
559
584
  imperial: "1210",
@@ -564,7 +589,12 @@ var footprintSizes = [
564
589
  w_mm_min: 4.05,
565
590
  h_mm_min: 2.65,
566
591
  courtyard_width_mm: 4.56,
567
- courtyard_height_mm: 3.16
592
+ courtyard_height_mm: 3.16,
593
+ nonpolarizedSilkscreen: {
594
+ line_half_length_mm: 0.723737,
595
+ line_y_mm: 1.355,
596
+ stroke_width_mm: 0.12
597
+ }
568
598
  },
569
599
  {
570
600
  imperial: "2010",
@@ -575,7 +605,12 @@ var footprintSizes = [
575
605
  w_mm_min: 5.85,
576
606
  h_mm_min: 2.65,
577
607
  courtyard_width_mm: 6.36,
578
- courtyard_height_mm: 3.16
608
+ courtyard_height_mm: 3.16,
609
+ nonpolarizedSilkscreen: {
610
+ line_half_length_mm: 1.527064,
611
+ line_y_mm: 1.36,
612
+ stroke_width_mm: 0.12
613
+ }
579
614
  },
580
615
  {
581
616
  imperial: "2512",
@@ -586,7 +621,12 @@ var footprintSizes = [
586
621
  w_mm_min: 7.15,
587
622
  h_mm_min: 3.35,
588
623
  courtyard_width_mm: 7.66,
589
- courtyard_height_mm: 3.86
624
+ courtyard_height_mm: 3.86,
625
+ nonpolarizedSilkscreen: {
626
+ line_half_length_mm: 2.177064,
627
+ line_y_mm: 1.71,
628
+ stroke_width_mm: 0.12
629
+ }
590
630
  }
591
631
  ];
592
632
  var metricMap = Object.fromEntries(footprintSizes.map((s) => [s.metric, s]));
@@ -613,6 +653,7 @@ var passive_def = base_def.extend({
613
653
  imperial: distance.optional(),
614
654
  w: length.optional(),
615
655
  h: length.optional(),
656
+ nonpolarized: z3.boolean().optional(),
616
657
  textbottom: z3.boolean().optional()
617
658
  });
618
659
  var passive = (params) => {
@@ -626,6 +667,7 @@ var passive = (params) => {
626
667
  imperial,
627
668
  w,
628
669
  h,
670
+ nonpolarized,
629
671
  textbottom,
630
672
  string: footprintString
631
673
  } = params;
@@ -652,21 +694,24 @@ var passive = (params) => {
652
694
  if (p === void 0 || pw === void 0 || ph === void 0) {
653
695
  throw new Error("Could not determine required pad dimensions (p, pw, ph)");
654
696
  }
655
- const lineLength = (p - pw) * 0.6;
656
- const lineY = ph / 2 + 0.06;
657
697
  let silkscreenLines = [];
658
- const usesNonPolarized0402ResistorSilkscreen = fn === "res" && typeof footprintString === "string" && /^res0402(?:_|$)/i.test(footprintString);
659
- if (usesNonPolarized0402ResistorSilkscreen) {
698
+ const nonpolarizedSilkscreen = fn === "res" && (nonpolarized === true || typeof footprintString !== "string" || /^res(?:\d{4}|\d{5})(?:_|$)/i.test(footprintString)) ? sz?.nonpolarizedSilkscreen : void 0;
699
+ if (nonpolarizedSilkscreen?.stroke_width_mm) {
700
+ const {
701
+ line_half_length_mm = 0,
702
+ line_y_mm = 0,
703
+ stroke_width_mm
704
+ } = nonpolarizedSilkscreen;
660
705
  silkscreenLines = [
661
706
  {
662
707
  type: "pcb_silkscreen_path",
663
708
  layer: "top",
664
709
  pcb_component_id: "",
665
710
  route: [
666
- { x: -lineLength / 2, y: lineY },
667
- { x: lineLength / 2, y: lineY }
711
+ { x: -line_half_length_mm, y: line_y_mm },
712
+ { x: line_half_length_mm, y: line_y_mm }
668
713
  ],
669
- stroke_width: 0.12,
714
+ stroke_width: stroke_width_mm,
670
715
  pcb_silkscreen_path_id: ""
671
716
  },
672
717
  {
@@ -674,10 +719,10 @@ var passive = (params) => {
674
719
  layer: "top",
675
720
  pcb_component_id: "",
676
721
  route: [
677
- { x: -lineLength / 2, y: -lineY },
678
- { x: lineLength / 2, y: -lineY }
722
+ { x: -line_half_length_mm, y: -line_y_mm },
723
+ { x: line_half_length_mm, y: -line_y_mm }
679
724
  ],
680
- stroke_width: 0.12,
725
+ stroke_width: stroke_width_mm,
681
726
  pcb_silkscreen_path_id: ""
682
727
  }
683
728
  ];
@@ -11201,7 +11246,7 @@ var footprinter = () => {
11201
11246
  } else {
11202
11247
  target[prop] = true;
11203
11248
  target.fn = prop;
11204
- if (prop === "res" || prop === "cap") {
11249
+ if (prop === "res" || prop === "cap" || prop === "led" || prop === "diode") {
11205
11250
  if (v) {
11206
11251
  if (typeof v === "string" && v.includes("_metric")) {
11207
11252
  target.metric = v.split("_metric")[0];