@tscircuit/footprinter 0.0.138 → 0.0.139
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 +8 -1
- package/dist/index.js +38 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -358,6 +358,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
358
358
|
}>, z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
359
359
|
fn: z.ZodString;
|
|
360
360
|
num_pins: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
361
|
+
rows: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>>;
|
|
361
362
|
p: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
362
363
|
id: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
363
364
|
od: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
@@ -369,6 +370,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
369
370
|
p: number;
|
|
370
371
|
id: number;
|
|
371
372
|
od: number;
|
|
373
|
+
rows: number;
|
|
372
374
|
male?: boolean | undefined;
|
|
373
375
|
female?: boolean | undefined;
|
|
374
376
|
}, {
|
|
@@ -377,6 +379,7 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
377
379
|
p?: string | number | undefined;
|
|
378
380
|
id?: string | number | undefined;
|
|
379
381
|
od?: string | number | undefined;
|
|
382
|
+
rows?: string | number | undefined;
|
|
380
383
|
male?: boolean | undefined;
|
|
381
384
|
female?: boolean | undefined;
|
|
382
385
|
}>, {
|
|
@@ -387,12 +390,14 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
387
390
|
p: number;
|
|
388
391
|
id: number;
|
|
389
392
|
od: number;
|
|
393
|
+
rows: number;
|
|
390
394
|
}, {
|
|
391
395
|
fn: string;
|
|
392
396
|
num_pins?: number | undefined;
|
|
393
397
|
p?: string | number | undefined;
|
|
394
398
|
id?: string | number | undefined;
|
|
395
399
|
od?: string | number | undefined;
|
|
400
|
+
rows?: string | number | undefined;
|
|
396
401
|
male?: boolean | undefined;
|
|
397
402
|
female?: boolean | undefined;
|
|
398
403
|
}>, {
|
|
@@ -403,12 +408,14 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
403
408
|
p: number;
|
|
404
409
|
id: number;
|
|
405
410
|
od: number;
|
|
411
|
+
rows: number;
|
|
406
412
|
}, {
|
|
407
413
|
fn: string;
|
|
408
414
|
num_pins?: number | undefined;
|
|
409
415
|
p?: string | number | undefined;
|
|
410
416
|
id?: string | number | undefined;
|
|
411
417
|
od?: string | number | undefined;
|
|
418
|
+
rows?: string | number | undefined;
|
|
412
419
|
male?: boolean | undefined;
|
|
413
420
|
female?: boolean | undefined;
|
|
414
421
|
}>, z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<{
|
|
@@ -1000,7 +1007,7 @@ type Footprinter = {
|
|
|
1000
1007
|
ssop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p">;
|
|
1001
1008
|
tssop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p">;
|
|
1002
1009
|
dfn: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p">;
|
|
1003
|
-
pinrow: (num_pins?: number) => FootprinterParamsBuilder<"p" | "id" | "od" | "male" | "female">;
|
|
1010
|
+
pinrow: (num_pins?: number) => FootprinterParamsBuilder<"p" | "id" | "od" | "male" | "female" | "rows">;
|
|
1004
1011
|
axial: () => FootprinterParamsBuilder<"p" | "id" | "od">;
|
|
1005
1012
|
hc49: () => FootprinterParamsBuilder<"p" | "id" | "od" | "w" | "h">;
|
|
1006
1013
|
to220: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
|
package/dist/index.js
CHANGED
|
@@ -1436,6 +1436,7 @@ import { length as length5 } from "circuit-json";
|
|
|
1436
1436
|
var pinrow_def = z11.object({
|
|
1437
1437
|
fn: z11.string(),
|
|
1438
1438
|
num_pins: z11.number().optional().default(6),
|
|
1439
|
+
rows: z11.union([z11.string(), z11.number()]).transform((val) => Number(val)).optional().default(1).describe("number of rows"),
|
|
1439
1440
|
p: length5.default("0.1in").describe("pitch"),
|
|
1440
1441
|
id: length5.default("1.0mm").describe("inner diameter"),
|
|
1441
1442
|
od: length5.default("1.5mm").describe("outer diameter"),
|
|
@@ -1444,29 +1445,56 @@ var pinrow_def = z11.object({
|
|
|
1444
1445
|
}).transform((data) => ({
|
|
1445
1446
|
...data,
|
|
1446
1447
|
male: data.male ?? (data.female ? false : true),
|
|
1447
|
-
// Auto-set male if not explicitly provided
|
|
1448
1448
|
female: data.female ?? false
|
|
1449
|
-
// Default female to false if not provided
|
|
1450
1449
|
})).superRefine((data, ctx) => {
|
|
1451
1450
|
if (data.male && data.female) {
|
|
1452
1451
|
ctx.addIssue({
|
|
1453
1452
|
code: z11.ZodIssueCode.custom,
|
|
1454
|
-
message: "'male' and 'female' cannot both be true it should be male or female.",
|
|
1455
|
-
//Error message if male and female are both true
|
|
1453
|
+
message: "'male' and 'female' cannot both be true; it should be male or female.",
|
|
1456
1454
|
path: ["male", "female"]
|
|
1457
1455
|
});
|
|
1458
1456
|
}
|
|
1459
1457
|
});
|
|
1460
1458
|
var pinrow = (raw_params) => {
|
|
1461
1459
|
const parameters = pinrow_def.parse(raw_params);
|
|
1462
|
-
const { p, id, od } = parameters;
|
|
1460
|
+
const { p, id, od, rows } = parameters;
|
|
1463
1461
|
const holes = [];
|
|
1464
|
-
const
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1462
|
+
const num_pins = parameters.num_pins;
|
|
1463
|
+
if (rows > 1) {
|
|
1464
|
+
const num_pins_per_row = Math.ceil(num_pins / rows);
|
|
1465
|
+
const ySpacing = p;
|
|
1466
|
+
for (let row = 0; row < rows; row++) {
|
|
1467
|
+
const yoff = row * ySpacing;
|
|
1468
|
+
const startPin = row * num_pins_per_row;
|
|
1469
|
+
for (let pinIndex = 0; pinIndex < num_pins_per_row; pinIndex++) {
|
|
1470
|
+
const pinNumber = startPin + pinIndex + 1;
|
|
1471
|
+
if (pinNumber > num_pins)
|
|
1472
|
+
break;
|
|
1473
|
+
const xoff = pinIndex * p;
|
|
1474
|
+
holes.push(platedhole(pinNumber, xoff, yoff, id, od));
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
} else {
|
|
1478
|
+
const num_spaces = num_pins - 1;
|
|
1479
|
+
const xoff = -(num_spaces / 2) * p;
|
|
1480
|
+
for (let i = 0; i < num_pins; i++) {
|
|
1481
|
+
holes.push(platedhole(i + 1, xoff + i * p, 0, id, od));
|
|
1482
|
+
}
|
|
1468
1483
|
}
|
|
1469
|
-
|
|
1484
|
+
if (rows === 1) {
|
|
1485
|
+
const silkscreenRefText2 = silkscreenRef(0, rows * p, 0.5);
|
|
1486
|
+
return {
|
|
1487
|
+
circuitJson: [...holes, silkscreenRefText2],
|
|
1488
|
+
parameters
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1491
|
+
const silkscreenRefText = silkscreenRef(
|
|
1492
|
+
(num_pins / rows - 1) * p / 2,
|
|
1493
|
+
// Center the silkscreen horizontally
|
|
1494
|
+
rows * p,
|
|
1495
|
+
// Keep it at the top vertically
|
|
1496
|
+
0.5
|
|
1497
|
+
);
|
|
1470
1498
|
return {
|
|
1471
1499
|
circuitJson: [...holes, silkscreenRefText],
|
|
1472
1500
|
parameters
|