@tscircuit/footprinter 0.0.202 → 0.0.204

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
@@ -377,6 +377,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
377
377
  nosquareplating: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
378
378
  nopinlabels: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
379
379
  doublesidedpinlabel: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
380
+ backsidelabel: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
380
381
  }, "strip", z.ZodTypeAny, {
381
382
  fn: string;
382
383
  num_pins: number;
@@ -392,6 +393,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
392
393
  nosquareplating: boolean;
393
394
  nopinlabels: boolean;
394
395
  doublesidedpinlabel: boolean;
396
+ backsidelabel: boolean;
395
397
  male?: boolean | undefined;
396
398
  female?: boolean | undefined;
397
399
  }, {
@@ -411,6 +413,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
411
413
  nosquareplating?: boolean | undefined;
412
414
  nopinlabels?: boolean | undefined;
413
415
  doublesidedpinlabel?: boolean | undefined;
416
+ backsidelabel?: boolean | undefined;
414
417
  }>, {
415
418
  pinlabelAnchorSide: "top" | "bottom" | "left" | "right";
416
419
  male: boolean;
@@ -429,6 +432,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
429
432
  nosquareplating: boolean;
430
433
  nopinlabels: boolean;
431
434
  doublesidedpinlabel: boolean;
435
+ backsidelabel: boolean;
432
436
  }, {
433
437
  fn: string;
434
438
  num_pins?: number | undefined;
@@ -446,6 +450,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
446
450
  nosquareplating?: boolean | undefined;
447
451
  nopinlabels?: boolean | undefined;
448
452
  doublesidedpinlabel?: boolean | undefined;
453
+ backsidelabel?: boolean | undefined;
449
454
  }>, {
450
455
  pinlabelAnchorSide: "top" | "bottom" | "left" | "right";
451
456
  male: boolean;
@@ -464,6 +469,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
464
469
  nosquareplating: boolean;
465
470
  nopinlabels: boolean;
466
471
  doublesidedpinlabel: boolean;
472
+ backsidelabel: boolean;
467
473
  }, {
468
474
  fn: string;
469
475
  num_pins?: number | undefined;
@@ -481,6 +487,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
481
487
  nosquareplating?: boolean | undefined;
482
488
  nopinlabels?: boolean | undefined;
483
489
  doublesidedpinlabel?: boolean | undefined;
490
+ backsidelabel?: boolean | undefined;
484
491
  }>, z.ZodEffects<z.ZodObject<{
485
492
  fn: z.ZodString;
486
493
  cc: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -1011,6 +1018,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
1011
1018
  imperial: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
1012
1019
  w: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
1013
1020
  h: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
1021
+ textbottom: z.ZodOptional<z.ZodBoolean>;
1014
1022
  }, "strip", z.ZodTypeAny, {
1015
1023
  tht: boolean;
1016
1024
  w?: number | undefined;
@@ -1020,6 +1028,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
1020
1028
  metric?: number | undefined;
1021
1029
  imperial?: number | undefined;
1022
1030
  h?: number | undefined;
1031
+ textbottom?: boolean | undefined;
1023
1032
  }, {
1024
1033
  tht: boolean;
1025
1034
  w?: string | number | undefined;
@@ -1029,6 +1038,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
1029
1038
  metric?: string | number | undefined;
1030
1039
  imperial?: string | number | undefined;
1031
1040
  h?: string | number | undefined;
1041
+ textbottom?: boolean | undefined;
1032
1042
  }>, z.ZodObject<{
1033
1043
  w: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
1034
1044
  h: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
@@ -1141,7 +1151,7 @@ declare const footprintSizes: StandardSize[];
1141
1151
  type FootprinterParamsBuilder<K extends string> = {
1142
1152
  [P in K | "params" | "soup" | "circuitJson"]: P extends "params" | "soup" | "circuitJson" ? Footprinter[P] : (v?: number | string | boolean) => FootprinterParamsBuilder<K>;
1143
1153
  };
1144
- type CommonPassiveOptionKey = "metric" | "imperial" | "tht" | "p" | "pw" | "ph" | "w" | "h";
1154
+ type CommonPassiveOptionKey = "metric" | "imperial" | "tht" | "p" | "pw" | "ph" | "w" | "h" | "textbottom";
1145
1155
  type Footprinter = {
1146
1156
  dip: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p" | "id" | "od" | "wide" | "narrow">;
1147
1157
  cap: () => FootprinterParamsBuilder<CommonPassiveOptionKey>;
@@ -1158,7 +1168,7 @@ type Footprinter = {
1158
1168
  ssop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p">;
1159
1169
  tssop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p">;
1160
1170
  dfn: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p">;
1161
- pinrow: (num_pins?: number) => FootprinterParamsBuilder<"p" | "id" | "od" | "male" | "female" | "rows" | "pinlabeltextalignleft" | "pinlabeltextaligncenter" | "pinlabeltextalignright" | "pinlabelverticallyinverted" | "pinlabelorthogonal" | "nosquareplating" | "nopinlabels" | "doublesidedpinlabel">;
1171
+ pinrow: (num_pins?: number) => FootprinterParamsBuilder<"p" | "id" | "od" | "male" | "female" | "rows" | "pinlabeltextalignleft" | "pinlabeltextaligncenter" | "pinlabeltextalignright" | "pinlabelverticallyinverted" | "pinlabelorthogonal" | "nosquareplating" | "nopinlabels" | "doublesidedpinlabel" | "backsidelabel">;
1162
1172
  axial: () => FootprinterParamsBuilder<"p" | "id" | "od">;
1163
1173
  hc49: () => FootprinterParamsBuilder<"p" | "id" | "od" | "w" | "h">;
1164
1174
  to220: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
package/dist/index.js CHANGED
@@ -386,10 +386,11 @@ var passive_def = z2.object({
386
386
  metric: distance.optional(),
387
387
  imperial: distance.optional(),
388
388
  w: length.optional(),
389
- h: length.optional()
389
+ h: length.optional(),
390
+ textbottom: z2.boolean().optional()
390
391
  });
391
392
  var passive = (params) => {
392
- let { tht, p, pw, ph, metric, imperial, w, h } = params;
393
+ let { tht, p, pw, ph, metric, imperial, w, h, textbottom } = params;
393
394
  if (typeof w === "string") w = mm2(w);
394
395
  if (typeof h === "string") h = mm2(h);
395
396
  if (typeof p === "string") p = mm2(p);
@@ -426,7 +427,8 @@ var passive = (params) => {
426
427
  stroke_width: 0.1,
427
428
  pcb_silkscreen_path_id: ""
428
429
  };
429
- const silkscreenRefText = silkscreenRef(0, ph / 2 + 0.9, 0.2);
430
+ const textY = textbottom ? -ph / 2 - 0.9 : ph / 2 + 0.9;
431
+ const silkscreenRefText = silkscreenRef(0, textY, 0.2);
430
432
  if (tht) {
431
433
  return [
432
434
  platedhole(1, -p / 2, 0, pw, pw * 1 / 0.8),
@@ -1659,7 +1661,10 @@ var pinrow_def = z12.object({
1659
1661
  pinlabelorthogonal: z12.boolean().optional().default(false),
1660
1662
  nosquareplating: z12.boolean().optional().default(false).describe("do not use rectangular pad for pin 1"),
1661
1663
  nopinlabels: z12.boolean().optional().default(false).describe("omit silkscreen pin labels"),
1662
- doublesidedpinlabel: z12.boolean().optional().default(false).describe("add silkscreen pins in top and bottom layers")
1664
+ doublesidedpinlabel: z12.boolean().optional().default(false).describe("add silkscreen pins in top and bottom layers"),
1665
+ backsidelabel: z12.boolean().optional().default(false).describe(
1666
+ "place the silkscreen reference text on the bottom layer instead of top"
1667
+ )
1663
1668
  }).transform((data) => {
1664
1669
  const pinlabelAnchorSide = determinePinlabelAnchorSide(data);
1665
1670
  return {
@@ -1691,7 +1696,8 @@ var pinrow = (raw_params) => {
1691
1696
  pinlabeltextalignleft,
1692
1697
  pinlabeltextalignright,
1693
1698
  nopinlabels,
1694
- doublesidedpinlabel
1699
+ doublesidedpinlabel,
1700
+ backsidelabel
1695
1701
  } = parameters;
1696
1702
  let pinlabelTextAlign = "center";
1697
1703
  if (pinlabeltextalignleft) pinlabelTextAlign = "left";
@@ -1736,19 +1742,35 @@ var pinrow = (raw_params) => {
1736
1742
  anchorSide: pinlabelAnchorSide
1737
1743
  });
1738
1744
  if (!nopinlabels) {
1739
- holes.push(
1740
- silkscreenPin({
1741
- fs: od / 5,
1742
- pn: pinNumber,
1743
- anchor_x,
1744
- anchor_y,
1745
- anchorplacement: pinlabelAnchorSide,
1746
- textalign: pinlabelTextAlign,
1747
- orthogonal: pinlabelorthogonal,
1748
- verticallyinverted: pinlabelverticallyinverted,
1749
- layer: "top"
1750
- })
1751
- );
1745
+ if (!backsidelabel) {
1746
+ holes.push(
1747
+ silkscreenPin({
1748
+ fs: od / 5,
1749
+ pn: pinNumber,
1750
+ anchor_x,
1751
+ anchor_y,
1752
+ anchorplacement: pinlabelAnchorSide,
1753
+ textalign: pinlabelTextAlign,
1754
+ orthogonal: pinlabelorthogonal,
1755
+ verticallyinverted: pinlabelverticallyinverted,
1756
+ layer: "top"
1757
+ })
1758
+ );
1759
+ } else {
1760
+ holes.push(
1761
+ silkscreenPin({
1762
+ fs: od / 5,
1763
+ pn: pinNumber,
1764
+ anchor_x,
1765
+ anchor_y,
1766
+ anchorplacement: pinlabelAnchorSide,
1767
+ textalign: pinlabelTextAlign,
1768
+ orthogonal: pinlabelorthogonal,
1769
+ verticallyinverted: pinlabelverticallyinverted,
1770
+ layer: "bottom"
1771
+ })
1772
+ );
1773
+ }
1752
1774
  if (doublesidedpinlabel) {
1753
1775
  holes.push(
1754
1776
  silkscreenPin({
@@ -6973,7 +6995,7 @@ var string2 = (def) => {
6973
6995
  const m = s.match(/([a-z]+)([\(\d\.\+\?].*)?/);
6974
6996
  const [_, fn, v] = m ?? [];
6975
6997
  if (v?.includes("?")) return null;
6976
- return { fn: m?.[1], v: m?.[2] };
6998
+ return { fn, v: m?.[2] };
6977
6999
  }).filter(isNotNull);
6978
7000
  for (const { fn, v } of def_parts) {
6979
7001
  fp2 = fp2[fn](v);