@tscircuit/footprinter 0.0.131 → 0.0.133

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
@@ -355,24 +355,62 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
355
355
  pw?: string | number | undefined;
356
356
  pl?: string | number | undefined;
357
357
  legsoutside?: boolean | undefined;
358
- }>, z.ZodObject<{
358
+ }>, z.ZodEffects<z.ZodEffects<z.ZodObject<{
359
359
  fn: z.ZodString;
360
360
  num_pins: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
361
361
  p: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
362
362
  id: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
363
363
  od: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
364
+ male: z.ZodOptional<z.ZodBoolean>;
365
+ female: z.ZodOptional<z.ZodBoolean>;
364
366
  }, "strip", z.ZodTypeAny, {
365
367
  fn: string;
366
368
  num_pins: number;
367
369
  p: number;
368
370
  id: number;
369
371
  od: number;
372
+ male?: boolean | undefined;
373
+ female?: boolean | undefined;
374
+ }, {
375
+ fn: string;
376
+ num_pins?: number | undefined;
377
+ p?: string | number | undefined;
378
+ id?: string | number | undefined;
379
+ od?: string | number | undefined;
380
+ male?: boolean | undefined;
381
+ female?: boolean | undefined;
382
+ }>, {
383
+ male: boolean;
384
+ female: boolean;
385
+ fn: string;
386
+ num_pins: number;
387
+ p: number;
388
+ id: number;
389
+ od: number;
390
+ }, {
391
+ fn: string;
392
+ num_pins?: number | undefined;
393
+ p?: string | number | undefined;
394
+ id?: string | number | undefined;
395
+ od?: string | number | undefined;
396
+ male?: boolean | undefined;
397
+ female?: boolean | undefined;
398
+ }>, {
399
+ male: boolean;
400
+ female: boolean;
401
+ fn: string;
402
+ num_pins: number;
403
+ p: number;
404
+ id: number;
405
+ od: number;
370
406
  }, {
371
407
  fn: string;
372
408
  num_pins?: number | undefined;
373
409
  p?: string | number | undefined;
374
410
  id?: string | number | undefined;
375
411
  od?: string | number | undefined;
412
+ male?: boolean | undefined;
413
+ female?: boolean | undefined;
376
414
  }>, z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<{
377
415
  fn: z.ZodString;
378
416
  cc: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -996,7 +1034,7 @@ type Footprinter = {
996
1034
  ssop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p">;
997
1035
  tssop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p">;
998
1036
  dfn: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p">;
999
- pinrow: (num_pins?: number) => FootprinterParamsBuilder<"p" | "id" | "od">;
1037
+ pinrow: (num_pins?: number) => FootprinterParamsBuilder<"p" | "id" | "od" | "male" | "female">;
1000
1038
  axial: () => FootprinterParamsBuilder<"p" | "id" | "od">;
1001
1039
  hc49: () => FootprinterParamsBuilder<"p" | "id" | "od" | "w" | "h">;
1002
1040
  to220: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
package/dist/index.js CHANGED
@@ -1315,7 +1315,24 @@ var pinrow_def = z11.object({
1315
1315
  num_pins: z11.number().optional().default(6),
1316
1316
  p: length5.default("0.1in").describe("pitch"),
1317
1317
  id: length5.default("1.0mm").describe("inner diameter"),
1318
- od: length5.default("1.5mm").describe("outer diameter")
1318
+ od: length5.default("1.5mm").describe("outer diameter"),
1319
+ male: z11.boolean().optional().describe("for male pin headers"),
1320
+ female: z11.boolean().optional().describe("for female pin headers")
1321
+ }).transform((data) => ({
1322
+ ...data,
1323
+ male: data.male ?? (data.female ? false : true),
1324
+ // Auto-set male if not explicitly provided
1325
+ female: data.female ?? false
1326
+ // Default female to false if not provided
1327
+ })).superRefine((data, ctx) => {
1328
+ if (data.male && data.female) {
1329
+ ctx.addIssue({
1330
+ code: z11.ZodIssueCode.custom,
1331
+ message: "'male' and 'female' cannot both be true it should be male or female.",
1332
+ //Error message if male and female are both true
1333
+ path: ["male", "female"]
1334
+ });
1335
+ }
1319
1336
  });
1320
1337
  var pinrow = (raw_params) => {
1321
1338
  const parameters = pinrow_def.parse(raw_params);
@@ -3437,26 +3454,19 @@ import {
3437
3454
  } from "circuit-json";
3438
3455
  import { z as z32 } from "zod";
3439
3456
  var to220_def = z32.object({
3440
- fn: z32.string().default("to220_3").refine((val) => /^to220_\d+$/.test(val), {
3441
- message: "Invalid format. Expected 'to220_N' where N is the number of pins."
3442
- }),
3457
+ fn: z32.string(),
3443
3458
  p: length25.optional().default("5.0mm"),
3444
3459
  id: length25.optional().default("1.0mm"),
3445
3460
  od: length25.optional().default("1.9mm"),
3446
3461
  w: length25.optional().default("13mm"),
3447
- h: length25.optional().default("7mm")
3448
- }).transform((a) => {
3449
- const match = a.fn.match(/^to220_(\d+)$/);
3450
- const numPins = match ? parseInt(match[1], 10) : 3;
3451
- return {
3452
- ...a,
3453
- numPins,
3454
- fn: "to220"
3455
- };
3462
+ h: length25.optional().default("7mm"),
3463
+ num_pins: z32.number().optional(),
3464
+ string: z32.string().optional()
3456
3465
  });
3457
3466
  var to220 = (raw_params) => {
3458
3467
  const parameters = to220_def.parse(raw_params);
3459
- const { fn, id, od, w, h, numPins } = parameters;
3468
+ const { fn, id, od, w, h, string: string2 } = parameters;
3469
+ const numPins = Number.parseInt(string2?.split("_")[1] ?? "3");
3460
3470
  const holeY = -1;
3461
3471
  const halfWidth = w / 2;
3462
3472
  const halfHeight = h / 2;