@tscircuit/footprinter 0.0.170 → 0.0.172

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
@@ -378,10 +378,10 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
378
378
  od: number;
379
379
  pinlabeltextalignleft: boolean;
380
380
  pinlabeltextalignright: boolean;
381
- pinlabelverticallyinverted: boolean;
382
381
  pinlabelorthogonal: boolean;
383
382
  rows: number;
384
383
  pinlabeltextaligncenter: boolean;
384
+ pinlabelverticallyinverted: boolean;
385
385
  nosquareplating: boolean;
386
386
  male?: boolean | undefined;
387
387
  female?: boolean | undefined;
@@ -395,10 +395,10 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
395
395
  female?: boolean | undefined;
396
396
  pinlabeltextalignleft?: boolean | undefined;
397
397
  pinlabeltextalignright?: boolean | undefined;
398
- pinlabelverticallyinverted?: boolean | undefined;
399
398
  pinlabelorthogonal?: boolean | undefined;
400
399
  rows?: string | number | undefined;
401
400
  pinlabeltextaligncenter?: boolean | undefined;
401
+ pinlabelverticallyinverted?: boolean | undefined;
402
402
  nosquareplating?: boolean | undefined;
403
403
  }>, {
404
404
  pinlabelAnchorSide: "top" | "bottom" | "left" | "right";
@@ -411,10 +411,10 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
411
411
  od: number;
412
412
  pinlabeltextalignleft: boolean;
413
413
  pinlabeltextalignright: boolean;
414
- pinlabelverticallyinverted: boolean;
415
414
  pinlabelorthogonal: boolean;
416
415
  rows: number;
417
416
  pinlabeltextaligncenter: boolean;
417
+ pinlabelverticallyinverted: boolean;
418
418
  nosquareplating: boolean;
419
419
  }, {
420
420
  fn: string;
@@ -426,10 +426,10 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
426
426
  female?: boolean | undefined;
427
427
  pinlabeltextalignleft?: boolean | undefined;
428
428
  pinlabeltextalignright?: boolean | undefined;
429
- pinlabelverticallyinverted?: boolean | undefined;
430
429
  pinlabelorthogonal?: boolean | undefined;
431
430
  rows?: string | number | undefined;
432
431
  pinlabeltextaligncenter?: boolean | undefined;
432
+ pinlabelverticallyinverted?: boolean | undefined;
433
433
  nosquareplating?: boolean | undefined;
434
434
  }>, {
435
435
  pinlabelAnchorSide: "top" | "bottom" | "left" | "right";
@@ -442,10 +442,10 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
442
442
  od: number;
443
443
  pinlabeltextalignleft: boolean;
444
444
  pinlabeltextalignright: boolean;
445
- pinlabelverticallyinverted: boolean;
446
445
  pinlabelorthogonal: boolean;
447
446
  rows: number;
448
447
  pinlabeltextaligncenter: boolean;
448
+ pinlabelverticallyinverted: boolean;
449
449
  nosquareplating: boolean;
450
450
  }, {
451
451
  fn: string;
@@ -457,10 +457,10 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
457
457
  female?: boolean | undefined;
458
458
  pinlabeltextalignleft?: boolean | undefined;
459
459
  pinlabeltextalignright?: boolean | undefined;
460
- pinlabelverticallyinverted?: boolean | undefined;
461
460
  pinlabelorthogonal?: boolean | undefined;
462
461
  rows?: string | number | undefined;
463
462
  pinlabeltextaligncenter?: boolean | undefined;
463
+ pinlabelverticallyinverted?: boolean | undefined;
464
464
  nosquareplating?: boolean | undefined;
465
465
  }>, z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<{
466
466
  fn: z.ZodString;
@@ -1060,6 +1060,7 @@ type Footprinter = {
1060
1060
  sot563: () => FootprinterParamsBuilder<"w" | "p" | "pl" | "pw">;
1061
1061
  sot723: () => FootprinterParamsBuilder<"w" | "h" | "pl" | "pw">;
1062
1062
  sot23: () => FootprinterParamsBuilder<"w" | "h" | "pl" | "pw">;
1063
+ sot323: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1063
1064
  sot89: () => FootprinterParamsBuilder<"w" | "p" | "pl" | "pw" | "h">;
1064
1065
  sod323w: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1065
1066
  smc: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pw" | "pl">;
package/dist/index.js CHANGED
@@ -61,6 +61,7 @@ __export(fn_exports, {
61
61
  sot223: () => sot223,
62
62
  sot23: () => sot23,
63
63
  sot23w: () => sot23w,
64
+ sot323: () => sot323,
64
65
  sot363: () => sot363,
65
66
  sot457: () => sot457,
66
67
  sot563: () => sot563,
@@ -1579,10 +1580,16 @@ var silkscreenPin = ({
1579
1580
  }
1580
1581
  let anchor_alignment = "center";
1581
1582
  if (textalign === "left") {
1582
- anchor_alignment = "center_left";
1583
+ if (verticallyinverted)
1584
+ anchor_alignment = "center_right";
1585
+ else
1586
+ anchor_alignment = "center_left";
1583
1587
  }
1584
1588
  if (textalign === "right") {
1585
- anchor_alignment = "center_right";
1589
+ if (verticallyinverted)
1590
+ anchor_alignment = "center_left";
1591
+ else
1592
+ anchor_alignment = "center_right";
1586
1593
  }
1587
1594
  return {
1588
1595
  type: "pcb_silkscreen_text",
@@ -1605,37 +1612,24 @@ import "@tscircuit/mm";
1605
1612
  function determinePinlabelAnchorSide({
1606
1613
  pinlabeltextalignleft,
1607
1614
  pinlabeltextalignright,
1608
- pinlabelverticallyinverted,
1609
1615
  pinlabelorthogonal
1610
1616
  }) {
1611
1617
  let pinlabelAnchorSide = "top";
1612
- if (pinlabelorthogonal && pinlabelverticallyinverted) {
1618
+ if (pinlabelorthogonal) {
1613
1619
  pinlabelAnchorSide = "left";
1614
- } else if (pinlabelorthogonal) {
1615
- pinlabelAnchorSide = "right";
1616
- } else if (pinlabelverticallyinverted) {
1617
- pinlabelAnchorSide = "bottom";
1618
1620
  } else {
1619
1621
  pinlabelAnchorSide = "top";
1620
1622
  }
1621
1623
  if (pinlabeltextalignleft) {
1622
- if (pinlabelorthogonal && pinlabelverticallyinverted) {
1623
- pinlabelAnchorSide = "top";
1624
- } else if (pinlabelorthogonal) {
1624
+ if (pinlabelorthogonal) {
1625
1625
  pinlabelAnchorSide = "bottom";
1626
- } else if (pinlabelverticallyinverted) {
1627
- pinlabelAnchorSide = "left";
1628
1626
  } else {
1629
1627
  pinlabelAnchorSide = "right";
1630
1628
  }
1631
1629
  }
1632
1630
  if (pinlabeltextalignright) {
1633
- if (pinlabelorthogonal && pinlabelverticallyinverted) {
1634
- pinlabelAnchorSide = "bottom";
1635
- } else if (pinlabelorthogonal) {
1631
+ if (pinlabelorthogonal) {
1636
1632
  pinlabelAnchorSide = "top";
1637
- } else if (pinlabelverticallyinverted) {
1638
- pinlabelAnchorSide = "right";
1639
1633
  } else {
1640
1634
  pinlabelAnchorSide = "left";
1641
1635
  }
@@ -6439,6 +6433,103 @@ var electrolytic = (raw_params) => {
6439
6433
  };
6440
6434
  };
6441
6435
 
6436
+ // src/fn/sot323.ts
6437
+ import { z as z56 } from "zod";
6438
+ var sot323_def = z56.object({
6439
+ fn: z56.string(),
6440
+ num_pins: z56.number().default(3),
6441
+ w: z56.string().default("2.45mm"),
6442
+ h: z56.string().default("2.40mm"),
6443
+ pl: z56.string().default("0.45mm"),
6444
+ pw: z56.string().default("0.70mm"),
6445
+ p: z56.string().default("1mm"),
6446
+ string: z56.string().optional()
6447
+ });
6448
+ var sot323 = (raw_params) => {
6449
+ const match = raw_params.string?.match(/^sot323_(\d+)/);
6450
+ const numPins = match ? Number.parseInt(match[1], 3) : 3;
6451
+ const parameters = sot323_def.parse({
6452
+ ...raw_params,
6453
+ num_pins: numPins
6454
+ });
6455
+ if (parameters.num_pins === 3) {
6456
+ return {
6457
+ circuitJson: sot323_3(parameters),
6458
+ parameters
6459
+ };
6460
+ }
6461
+ throw new Error("Invalid number of pins");
6462
+ };
6463
+ var getCcwSot323Coords = (parameters) => {
6464
+ const { pn, w, h, pl, p } = parameters;
6465
+ if (pn === 1) {
6466
+ return { x: -p, y: 0.65 };
6467
+ }
6468
+ if (pn === 2) {
6469
+ return { x: -p, y: -0.65 };
6470
+ }
6471
+ return { x: p, y: 0 };
6472
+ };
6473
+ var sot323_3 = (parameters) => {
6474
+ const pads = [];
6475
+ for (let i = 0; i < parameters.num_pins; i++) {
6476
+ const { x, y } = getCcwSot323Coords({
6477
+ num_pins: parameters.num_pins,
6478
+ pn: i + 1,
6479
+ w: Number.parseFloat(parameters.w),
6480
+ h: Number.parseFloat(parameters.h),
6481
+ pl: Number.parseFloat(parameters.pl),
6482
+ p: Number.parseFloat(parameters.p)
6483
+ });
6484
+ pads.push(
6485
+ rectpad(
6486
+ i + 1,
6487
+ x,
6488
+ y,
6489
+ Number.parseFloat(parameters.pl),
6490
+ Number.parseFloat(parameters.pw)
6491
+ )
6492
+ );
6493
+ }
6494
+ const silkscreenRefText = silkscreenRef(
6495
+ 0,
6496
+ Number.parseInt(parameters.h) / 2 + 1,
6497
+ 0.3
6498
+ );
6499
+ const width = Number.parseFloat(parameters.w) / 2 - Number.parseFloat(parameters.pl);
6500
+ const height = Number.parseFloat(parameters.h) / 2;
6501
+ const silkscreenPath1 = {
6502
+ layer: "top",
6503
+ pcb_component_id: "",
6504
+ pcb_silkscreen_path_id: "silkscreen_path_1",
6505
+ route: [
6506
+ { x: -width, y: height + 0.3 },
6507
+ { x: width, y: height + 0.3 },
6508
+ { x: width, y: height / 2 }
6509
+ ],
6510
+ type: "pcb_silkscreen_path",
6511
+ stroke_width: 0.1
6512
+ };
6513
+ const silkscreenPath2 = {
6514
+ layer: "top",
6515
+ pcb_component_id: "",
6516
+ pcb_silkscreen_path_id: "silkscreen_path_2",
6517
+ route: [
6518
+ { x: -width, y: -height - 0.3 },
6519
+ { x: width, y: -height - 0.3 },
6520
+ { x: width, y: -height / 2 }
6521
+ ],
6522
+ type: "pcb_silkscreen_path",
6523
+ stroke_width: 0.1
6524
+ };
6525
+ return [
6526
+ ...pads,
6527
+ silkscreenPath1,
6528
+ silkscreenPath2,
6529
+ silkscreenRefText
6530
+ ];
6531
+ };
6532
+
6442
6533
  // src/helpers/is-not-null.ts
6443
6534
  function isNotNull(value) {
6444
6535
  return value !== null;