@tscircuit/footprinter 0.0.87 → 0.0.88
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 +72 -69
- package/dist/index.js +64 -69
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -86,7 +86,7 @@ var silkscreenRef = (x, y, font_size) => {
|
|
|
86
86
|
var extendDipDef = (newDefaults) => z.object({
|
|
87
87
|
fn: z.string(),
|
|
88
88
|
dip: z.literal(true),
|
|
89
|
-
num_pins: z.number(),
|
|
89
|
+
num_pins: z.number().optional().default(6),
|
|
90
90
|
wide: z.boolean().optional(),
|
|
91
91
|
narrow: z.boolean().optional(),
|
|
92
92
|
w: length.optional(),
|
|
@@ -358,7 +358,7 @@ var passive = (params) => {
|
|
|
358
358
|
throw new Error("could not infer pad width");
|
|
359
359
|
if (ph === void 0)
|
|
360
360
|
throw new Error("could not infer pad width");
|
|
361
|
-
const silkscreenRefText = silkscreenRef(0,
|
|
361
|
+
const silkscreenRefText = silkscreenRef(0, 0.9, 0.2);
|
|
362
362
|
if (tht) {
|
|
363
363
|
return [
|
|
364
364
|
platedhole(1, -p / 2, 0, pw, pw * 1 / 0.8),
|
|
@@ -433,7 +433,7 @@ var function_call = z4.string().or(z4.array(z4.any())).transform((a) => {
|
|
|
433
433
|
// src/fn/bga.ts
|
|
434
434
|
var bga_def = z5.object({
|
|
435
435
|
fn: z5.string(),
|
|
436
|
-
num_pins: z5.number(),
|
|
436
|
+
num_pins: z5.number().optional().default(64),
|
|
437
437
|
grid: dim2d.optional(),
|
|
438
438
|
p: distance2.default("0.8mm"),
|
|
439
439
|
w: length3.optional(),
|
|
@@ -478,12 +478,12 @@ var bga_def = z5.object({
|
|
|
478
478
|
});
|
|
479
479
|
var bga = (raw_params) => {
|
|
480
480
|
const parameters = bga_def.parse(raw_params);
|
|
481
|
-
let { num_pins
|
|
481
|
+
let { num_pins, grid, p, w, h, ball, pad, missing } = parameters;
|
|
482
482
|
ball ??= 0.75 / 1.27 * p;
|
|
483
483
|
pad ??= ball * 0.8;
|
|
484
484
|
const pads = [];
|
|
485
485
|
const missing_pin_nums = (missing ?? []).filter((a) => typeof a === "number");
|
|
486
|
-
const num_pins_missing = grid.x * grid.y -
|
|
486
|
+
const num_pins_missing = grid.x * grid.y - num_pins;
|
|
487
487
|
if (missing.length === 0 && num_pins_missing > 0) {
|
|
488
488
|
if (Math.sqrt(num_pins_missing) % 1 === 0) {
|
|
489
489
|
missing.push("center");
|
|
@@ -504,17 +504,6 @@ var bga = (raw_params) => {
|
|
|
504
504
|
if (missing?.includes("topleft")) {
|
|
505
505
|
missing_pin_nums.push(1);
|
|
506
506
|
}
|
|
507
|
-
if (num_pins_missing !== missing_pin_nums.length) {
|
|
508
|
-
throw new Error(
|
|
509
|
-
`not able to create bga component, unable to determine missing pins (try specifying them with "missing+1+2+..."
|
|
510
|
-
|
|
511
|
-
${JSON.stringify(
|
|
512
|
-
parameters,
|
|
513
|
-
null,
|
|
514
|
-
" "
|
|
515
|
-
)}`
|
|
516
|
-
);
|
|
517
|
-
}
|
|
518
507
|
const missing_pin_nums_set = new Set(missing_pin_nums);
|
|
519
508
|
let missing_pins_passed = 0;
|
|
520
509
|
for (let y = 0; y < grid.y; y++) {
|
|
@@ -548,7 +537,7 @@ import { z as z6 } from "zod";
|
|
|
548
537
|
import { length as length4 } from "@tscircuit/soup";
|
|
549
538
|
var extendSoicDef = (newDefaults) => z6.object({
|
|
550
539
|
fn: z6.string(),
|
|
551
|
-
num_pins: z6.number(),
|
|
540
|
+
num_pins: z6.number().optional().default(8),
|
|
552
541
|
w: length4.default(length4.parse(newDefaults.w ?? "5.3mm")),
|
|
553
542
|
p: length4.default(length4.parse(newDefaults.p ?? "1.27mm")),
|
|
554
543
|
pw: length4.optional(),
|
|
@@ -570,8 +559,8 @@ var getCcwSoicCoords = (parameters) => {
|
|
|
570
559
|
if (parameters.widthincludeslegs !== void 0) {
|
|
571
560
|
parameters.legsoutside = !parameters.widthincludeslegs;
|
|
572
561
|
}
|
|
573
|
-
const { num_pins
|
|
574
|
-
const ph =
|
|
562
|
+
const { num_pins, pn, w, p, pl, legsoutside } = parameters;
|
|
563
|
+
const ph = num_pins / 2;
|
|
575
564
|
const isLeft = pn <= ph;
|
|
576
565
|
const leftPinGaps = ph - 1;
|
|
577
566
|
const gs = p;
|
|
@@ -654,13 +643,13 @@ var pin_order_specifier = z7.enum([
|
|
|
654
643
|
|
|
655
644
|
// src/helpers/get-quad-pin-map.ts
|
|
656
645
|
var getQuadPinMap = ({
|
|
657
|
-
num_pins
|
|
646
|
+
num_pins,
|
|
658
647
|
cw,
|
|
659
648
|
ccw,
|
|
660
649
|
startingpin
|
|
661
650
|
}) => {
|
|
662
651
|
const pin_map = [];
|
|
663
|
-
const pins_per_side =
|
|
652
|
+
const pins_per_side = num_pins / 4;
|
|
664
653
|
let current_position_ccw_normal = 1;
|
|
665
654
|
const sfp = {};
|
|
666
655
|
for (const specifier of startingpin ?? []) {
|
|
@@ -698,17 +687,17 @@ var getQuadPinMap = ({
|
|
|
698
687
|
current_position_ccw_normal = pins_per_side * 4;
|
|
699
688
|
}
|
|
700
689
|
pin_map.push(-1);
|
|
701
|
-
for (let i = 0; i <
|
|
690
|
+
for (let i = 0; i < num_pins; i++) {
|
|
702
691
|
pin_map[current_position_ccw_normal] = i + 1;
|
|
703
692
|
if (ccw || !cw) {
|
|
704
693
|
current_position_ccw_normal++;
|
|
705
|
-
if (current_position_ccw_normal >
|
|
694
|
+
if (current_position_ccw_normal > num_pins) {
|
|
706
695
|
current_position_ccw_normal = 1;
|
|
707
696
|
}
|
|
708
697
|
} else {
|
|
709
698
|
current_position_ccw_normal--;
|
|
710
699
|
if (current_position_ccw_normal < 1) {
|
|
711
|
-
current_position_ccw_normal =
|
|
700
|
+
current_position_ccw_normal = num_pins;
|
|
712
701
|
}
|
|
713
702
|
}
|
|
714
703
|
}
|
|
@@ -721,7 +710,7 @@ var base_quad_def = z8.object({
|
|
|
721
710
|
cc: z8.literal(true).optional(),
|
|
722
711
|
ccw: z8.literal(true).optional(),
|
|
723
712
|
startingpin: z8.string().or(z8.array(pin_order_specifier)).transform((a) => typeof a === "string" ? a.slice(1, -1).split(",") : a).pipe(z8.array(pin_order_specifier)).optional(),
|
|
724
|
-
num_pins: z8.number(),
|
|
713
|
+
num_pins: z8.number().optional().default(64),
|
|
725
714
|
w: length5.optional(),
|
|
726
715
|
h: length5.optional(),
|
|
727
716
|
p: length5.default(length5.parse("0.5mm")),
|
|
@@ -1106,7 +1095,7 @@ var sot363 = (raw_params) => {
|
|
|
1106
1095
|
import { z as z9 } from "zod";
|
|
1107
1096
|
var sot23_def = z9.object({
|
|
1108
1097
|
fn: z9.string(),
|
|
1109
|
-
num_pins: z9.
|
|
1098
|
+
num_pins: z9.literal(3).default(3),
|
|
1110
1099
|
w: z9.string().default("1.92mm"),
|
|
1111
1100
|
h: z9.string().default("2.74mm"),
|
|
1112
1101
|
pl: z9.string().default("0.8mm"),
|
|
@@ -1253,7 +1242,7 @@ import { z as z11 } from "zod";
|
|
|
1253
1242
|
import { length as length6 } from "@tscircuit/soup";
|
|
1254
1243
|
var pinrow_def = z11.object({
|
|
1255
1244
|
fn: z11.string(),
|
|
1256
|
-
num_pins: z11.number(),
|
|
1245
|
+
num_pins: z11.number().optional().default(6),
|
|
1257
1246
|
p: length6.default("0.1in").describe("pitch"),
|
|
1258
1247
|
id: length6.default("1.0mm").describe("inner diameter"),
|
|
1259
1248
|
od: length6.default("1.5mm").describe("outer diameter")
|
|
@@ -1321,10 +1310,11 @@ var ms013 = (raw_params) => {
|
|
|
1321
1310
|
};
|
|
1322
1311
|
|
|
1323
1312
|
// src/fn/sot723.ts
|
|
1313
|
+
import { length as length7 } from "@tscircuit/soup";
|
|
1324
1314
|
import { z as z12 } from "zod";
|
|
1325
1315
|
var sot723_def = z12.object({
|
|
1326
1316
|
fn: z12.string(),
|
|
1327
|
-
num_pins: z12.
|
|
1317
|
+
num_pins: z12.literal(3).default(3),
|
|
1328
1318
|
w: z12.string().default("1.2mm"),
|
|
1329
1319
|
h: z12.string().default("1.2mm"),
|
|
1330
1320
|
pl: z12.string().default("0.3mm"),
|
|
@@ -1334,9 +1324,9 @@ var sot723 = (raw_params) => {
|
|
|
1334
1324
|
const parameters = sot723_def.parse(raw_params);
|
|
1335
1325
|
const pad = sot723WithoutParsing(parameters);
|
|
1336
1326
|
const silkscreenRefText = silkscreenRef(
|
|
1337
|
-
0,
|
|
1338
|
-
|
|
1339
|
-
0.
|
|
1327
|
+
0.4,
|
|
1328
|
+
length7.parse(parameters.h),
|
|
1329
|
+
0.2
|
|
1340
1330
|
);
|
|
1341
1331
|
return {
|
|
1342
1332
|
circuitJson: [...pad, silkscreenRefText],
|
|
@@ -1378,9 +1368,10 @@ var sot723WithoutParsing = (parameters) => {
|
|
|
1378
1368
|
|
|
1379
1369
|
// src/fn/sod123.ts
|
|
1380
1370
|
import { z as z13 } from "zod";
|
|
1381
|
-
import "circuit-json";
|
|
1371
|
+
import { length as length8 } from "circuit-json";
|
|
1382
1372
|
var sod_def = z13.object({
|
|
1383
1373
|
fn: z13.string(),
|
|
1374
|
+
num_pins: z13.literal(3).default(3),
|
|
1384
1375
|
w: z13.string().default("2.36mm"),
|
|
1385
1376
|
h: z13.string().default("1.22mm"),
|
|
1386
1377
|
pl: z13.string().default("0.9mm"),
|
|
@@ -1391,7 +1382,7 @@ var sod123 = (raw_params) => {
|
|
|
1391
1382
|
const parameters = sod_def.parse(raw_params);
|
|
1392
1383
|
const silkscreenRefText = silkscreenRef(
|
|
1393
1384
|
0,
|
|
1394
|
-
|
|
1385
|
+
length8.parse(parameters.h) / 4 + 0.4,
|
|
1395
1386
|
0.3
|
|
1396
1387
|
);
|
|
1397
1388
|
return {
|
|
@@ -1411,14 +1402,14 @@ var getSodCoords = (parameters) => {
|
|
|
1411
1402
|
};
|
|
1412
1403
|
var sodWithoutParsing = (parameters) => {
|
|
1413
1404
|
const pads = [];
|
|
1414
|
-
for (let i =
|
|
1405
|
+
for (let i = 1; i <= parameters.num_pins; i++) {
|
|
1415
1406
|
const { x, y } = getSodCoords({
|
|
1416
|
-
pn: i
|
|
1407
|
+
pn: i,
|
|
1417
1408
|
pad_spacing: Number.parseFloat(parameters.pad_spacing)
|
|
1418
1409
|
});
|
|
1419
1410
|
pads.push(
|
|
1420
1411
|
rectpad(
|
|
1421
|
-
i
|
|
1412
|
+
i,
|
|
1422
1413
|
x,
|
|
1423
1414
|
y,
|
|
1424
1415
|
Number.parseFloat(parameters.pl),
|
|
@@ -1431,15 +1422,15 @@ var sodWithoutParsing = (parameters) => {
|
|
|
1431
1422
|
|
|
1432
1423
|
// src/fn/axial.ts
|
|
1433
1424
|
import {
|
|
1434
|
-
length as
|
|
1425
|
+
length as length9
|
|
1435
1426
|
} from "@tscircuit/soup";
|
|
1436
1427
|
import { z as z14 } from "zod";
|
|
1437
1428
|
var axial_def = z14.object({
|
|
1438
1429
|
fn: z14.string(),
|
|
1439
|
-
num_pins: z14.
|
|
1440
|
-
p:
|
|
1441
|
-
id:
|
|
1442
|
-
od:
|
|
1430
|
+
num_pins: z14.literal(2).default(2),
|
|
1431
|
+
p: length9.optional().default("2.54mm"),
|
|
1432
|
+
id: length9.optional().default("0.7mm"),
|
|
1433
|
+
od: length9.optional().default("1mm")
|
|
1443
1434
|
});
|
|
1444
1435
|
var axial = (raw_params) => {
|
|
1445
1436
|
const parameters = axial_def.parse(raw_params);
|
|
@@ -1487,13 +1478,17 @@ var silkscreenpath = (route, options = {}) => {
|
|
|
1487
1478
|
|
|
1488
1479
|
// src/fn/pushbutton.ts
|
|
1489
1480
|
var pushbutton_def = z15.object({
|
|
1490
|
-
fn: z15.literal("pushbutton")
|
|
1481
|
+
fn: z15.literal("pushbutton"),
|
|
1482
|
+
w: z15.literal(4.5).default(4.5),
|
|
1483
|
+
h: z15.literal(6.5).default(6.5),
|
|
1484
|
+
id: z15.literal(1).default(1),
|
|
1485
|
+
od: z15.literal(1.2).default(1.2)
|
|
1491
1486
|
});
|
|
1492
1487
|
var pushbutton = (raw_params) => {
|
|
1493
1488
|
const parameters = pushbutton_def.parse(raw_params);
|
|
1494
|
-
const width =
|
|
1495
|
-
const height =
|
|
1496
|
-
const holeDiameter =
|
|
1489
|
+
const width = parameters.w;
|
|
1490
|
+
const height = parameters.h;
|
|
1491
|
+
const holeDiameter = parameters.id;
|
|
1497
1492
|
const holes = [
|
|
1498
1493
|
platedhole(1, -width / 2, height / 2, holeDiameter, holeDiameter * 1.2),
|
|
1499
1494
|
platedhole(2, -width / 2, -height / 2, holeDiameter, holeDiameter * 1.2),
|
|
@@ -1534,21 +1529,21 @@ var pushbutton = (raw_params) => {
|
|
|
1534
1529
|
|
|
1535
1530
|
// src/fn/stampboard.ts
|
|
1536
1531
|
import {
|
|
1537
|
-
length as
|
|
1532
|
+
length as length10
|
|
1538
1533
|
} from "circuit-json";
|
|
1539
1534
|
import { z as z16 } from "zod";
|
|
1540
1535
|
var stampboard_def = z16.object({
|
|
1541
1536
|
fn: z16.string(),
|
|
1542
|
-
w:
|
|
1543
|
-
left:
|
|
1544
|
-
right:
|
|
1545
|
-
top:
|
|
1546
|
-
bottom:
|
|
1547
|
-
p:
|
|
1548
|
-
pw:
|
|
1549
|
-
pl:
|
|
1537
|
+
w: length10.default("22.58mm"),
|
|
1538
|
+
left: length10.optional().default(20),
|
|
1539
|
+
right: length10.optional().default(20),
|
|
1540
|
+
top: length10.optional(),
|
|
1541
|
+
bottom: length10.optional(),
|
|
1542
|
+
p: length10.default(length10.parse("2.54mm")),
|
|
1543
|
+
pw: length10.default(length10.parse("1.6mm")),
|
|
1544
|
+
pl: length10.default(length10.parse("2.4mm")),
|
|
1550
1545
|
innerhole: z16.boolean().default(false),
|
|
1551
|
-
innerholeedgedistance:
|
|
1546
|
+
innerholeedgedistance: length10.default(length10.parse("1.61mm"))
|
|
1552
1547
|
});
|
|
1553
1548
|
var getHeight = (parameters) => {
|
|
1554
1549
|
const params = stampboard_def.parse(parameters);
|
|
@@ -1877,21 +1872,21 @@ var stampboard = (raw_params) => {
|
|
|
1877
1872
|
|
|
1878
1873
|
// src/fn/stampreceiver.ts
|
|
1879
1874
|
import {
|
|
1880
|
-
length as
|
|
1875
|
+
length as length11
|
|
1881
1876
|
} from "circuit-json";
|
|
1882
1877
|
import { z as z17 } from "zod";
|
|
1883
1878
|
var stampreceiver_def = z17.object({
|
|
1884
1879
|
fn: z17.string(),
|
|
1885
|
-
w:
|
|
1886
|
-
left:
|
|
1887
|
-
right:
|
|
1888
|
-
top:
|
|
1889
|
-
bottom:
|
|
1890
|
-
p:
|
|
1891
|
-
pw:
|
|
1892
|
-
pl:
|
|
1880
|
+
w: length11.default("22.58mm"),
|
|
1881
|
+
left: length11.optional().default(20),
|
|
1882
|
+
right: length11.optional().default(20),
|
|
1883
|
+
top: length11.optional(),
|
|
1884
|
+
bottom: length11.optional(),
|
|
1885
|
+
p: length11.default(length11.parse("2.54mm")),
|
|
1886
|
+
pw: length11.default(length11.parse("1.6mm")),
|
|
1887
|
+
pl: length11.default(length11.parse("3.2mm")),
|
|
1893
1888
|
innerhole: z17.boolean().default(false),
|
|
1894
|
-
innerholeedgedistance:
|
|
1889
|
+
innerholeedgedistance: length11.default(length11.parse("1.61mm"))
|
|
1895
1890
|
});
|
|
1896
1891
|
var getHeight2 = (parameters) => {
|
|
1897
1892
|
const params = stampreceiver_def.parse(parameters);
|
|
@@ -2199,12 +2194,12 @@ var lqfp = (parameters) => {
|
|
|
2199
2194
|
import { z as z18 } from "zod";
|
|
2200
2195
|
var sot235_def = z18.object({
|
|
2201
2196
|
fn: z18.string(),
|
|
2197
|
+
num_pins: z18.literal(5).default(5),
|
|
2202
2198
|
h: z18.string().default("1.6mm"),
|
|
2203
2199
|
pl: z18.string().default("1mm"),
|
|
2204
2200
|
pw: z18.string().default("0.7mm"),
|
|
2205
2201
|
p: z18.string().default("0.95mm")
|
|
2206
2202
|
});
|
|
2207
|
-
var num_pins = 5;
|
|
2208
2203
|
var sot235 = (raw_params) => {
|
|
2209
2204
|
const parameters = sot235_def.parse(raw_params);
|
|
2210
2205
|
return {
|
|
@@ -2233,7 +2228,7 @@ var getCcwSot235Coords = (parameters) => {
|
|
|
2233
2228
|
};
|
|
2234
2229
|
var sot23_5WithoutParsing = (parameters) => {
|
|
2235
2230
|
const pads = [];
|
|
2236
|
-
for (let i = 1; i <= num_pins; i++) {
|
|
2231
|
+
for (let i = 1; i <= parameters.num_pins; i++) {
|
|
2237
2232
|
const { x, y } = getCcwSot235Coords({
|
|
2238
2233
|
h: Number.parseFloat(parameters.h),
|
|
2239
2234
|
p: Number.parseFloat(parameters.p),
|
|
@@ -2249,7 +2244,7 @@ var sot23_5WithoutParsing = (parameters) => {
|
|
|
2249
2244
|
)
|
|
2250
2245
|
);
|
|
2251
2246
|
}
|
|
2252
|
-
const width = (num_pins + 1) / 2 * Number.parseFloat(parameters.p);
|
|
2247
|
+
const width = (parameters.num_pins + 1) / 2 * Number.parseFloat(parameters.p);
|
|
2253
2248
|
const height = Number.parseFloat(parameters.h);
|
|
2254
2249
|
const silkscreenPath1 = {
|
|
2255
2250
|
layer: "top",
|
|
@@ -2399,7 +2394,7 @@ var footprinter = () => {
|
|
|
2399
2394
|
target.imperial = v;
|
|
2400
2395
|
}
|
|
2401
2396
|
} else {
|
|
2402
|
-
target.num_pins = Number.parseFloat(v);
|
|
2397
|
+
target.num_pins = Number.isNaN(Number.parseFloat(v)) ? void 0 : Number.parseFloat(v);
|
|
2403
2398
|
}
|
|
2404
2399
|
}
|
|
2405
2400
|
} else {
|