@tscircuit/footprinter 0.0.310 → 0.0.312

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.js CHANGED
@@ -87,6 +87,7 @@ __export(fn_exports, {
87
87
  to92s: () => to92s,
88
88
  tqfp: () => tqfp,
89
89
  tssop: () => tssop,
90
+ vson: () => vson,
90
91
  vssop: () => vssop
91
92
  });
92
93
 
@@ -5217,14 +5218,14 @@ var sot89_3 = (parameters) => {
5217
5218
  const pads = [];
5218
5219
  const padGap = Number.parseFloat(parameters.p);
5219
5220
  const padWidth = Number.parseFloat(parameters.pw);
5220
- const length61 = Number.parseFloat(parameters.w);
5221
+ const length62 = Number.parseFloat(parameters.w);
5221
5222
  const padHeight = Number.parseFloat(parameters.pl);
5222
5223
  const centerExtra = 0.175;
5223
5224
  const outerPadXShift = (padHeight - (padHeight + centerExtra)) / 2;
5224
5225
  pads.push(
5225
- rectpad(1, -length61 / 2 + outerPadXShift, padGap, padHeight, padWidth),
5226
- rectpad(2, -length61 / 2, 0, padHeight + centerExtra, padWidth),
5227
- rectpad(3, -length61 / 2 + outerPadXShift, -padGap, padHeight, padWidth)
5226
+ rectpad(1, -length62 / 2 + outerPadXShift, padGap, padHeight, padWidth),
5227
+ rectpad(2, -length62 / 2, 0, padHeight + centerExtra, padWidth),
5228
+ rectpad(3, -length62 / 2 + outerPadXShift, -padGap, padHeight, padWidth)
5228
5229
  );
5229
5230
  const silkscreenRefText = silkscreenRef(0, 0, 0.3);
5230
5231
  const width = Number.parseFloat(parameters.w) / 2 - 1;
@@ -5264,7 +5265,7 @@ var sot89_5 = (parameters) => {
5264
5265
  const pads = [];
5265
5266
  const padGap = Number.parseFloat(parameters.p);
5266
5267
  const padWidth = Number.parseFloat(parameters.pw);
5267
- const length61 = Number.parseFloat(parameters.w);
5268
+ const length62 = Number.parseFloat(parameters.w);
5268
5269
  pads.push(
5269
5270
  rectpad(1, -1.85, -1.5, 1.5, 0.7),
5270
5271
  rectpad(2, -1.85, 1.5, 1.5, 0.7),
@@ -7256,13 +7257,131 @@ var getSonPadCoord = (num_pins, pn, w, p) => {
7256
7257
  };
7257
7258
  };
7258
7259
 
7260
+ // src/fn/vson.ts
7261
+ import { z as z67 } from "zod";
7262
+ import { length as length54, distance as distance3 } from "circuit-json";
7263
+ var vson_def = base_def.extend({
7264
+ fn: z67.string(),
7265
+ num_pins: z67.number().optional().default(8),
7266
+ p: distance3.describe("pitch (distance between center of each pin)"),
7267
+ w: length54.describe("width between vertical rows of pins"),
7268
+ grid: dim2d.describe("width and height of the border of the footprint"),
7269
+ ep: dim2d.default("0x0mm").describe("width and height of the central exposed thermal pad"),
7270
+ epx: length54.default("0mm").describe("x offset of the center of the central exposed thermal pad"),
7271
+ pinw: length54.describe("width of the pin pads"),
7272
+ pinh: length54.describe("height of the pin pads")
7273
+ });
7274
+ var vson = (raw_params) => {
7275
+ const parameters = vson_def.parse(raw_params);
7276
+ const { num_pins, p, w, grid, ep, epx, pinw, pinh } = parameters;
7277
+ if (num_pins % 2 !== 0) {
7278
+ throw new Error("invalid number of pins");
7279
+ }
7280
+ const pads = [];
7281
+ for (let i = 0; i < num_pins; i++) {
7282
+ const { pinX, pinY } = getCcwVsonCoords({
7283
+ pinCount: num_pins,
7284
+ pinIndex: i,
7285
+ width: w,
7286
+ pitch: p
7287
+ });
7288
+ pads.push(rectpad(i + 1, pinX, pinY, pinw, pinh));
7289
+ }
7290
+ if (ep.x > 0 && ep.y > 0) {
7291
+ pads.push(rectpad(parameters.num_pins + 1, epx, 0, ep.x, ep.y));
7292
+ }
7293
+ const silkscreenPaths = getSilkscreenPaths(grid);
7294
+ const silkscreenRefText = silkscreenRef(
7295
+ 0,
7296
+ grid.y / 2 + p,
7297
+ grid.y / 6
7298
+ );
7299
+ return {
7300
+ circuitJson: [...pads, ...silkscreenPaths, silkscreenRefText],
7301
+ parameters
7302
+ };
7303
+ };
7304
+ var getCcwVsonCoords = (params) => {
7305
+ let pinY = 0;
7306
+ let pinX = 0;
7307
+ const centerY = (params.pinCount / 2 - 1) * params.pitch / 2;
7308
+ const pinHalf = params.pinCount / 2;
7309
+ if (params.pinIndex + 1 <= pinHalf) {
7310
+ pinY = params.pitch * params.pinIndex - centerY;
7311
+ pinX = 0 - params.width / 2;
7312
+ } else {
7313
+ pinY = params.pitch * (params.pinCount - params.pinIndex - 1) - centerY;
7314
+ pinX = params.width / 2;
7315
+ }
7316
+ return { pinX, pinY };
7317
+ };
7318
+ var getSilkscreenPaths = (grid) => {
7319
+ const borderMargin = 0.1;
7320
+ const cornerLine = grid.y / 30;
7321
+ const silkscreenPaths = [
7322
+ // top silkscreen path
7323
+ {
7324
+ layer: "top",
7325
+ pcb_component_id: "",
7326
+ pcb_silkscreen_path_id: "",
7327
+ type: "pcb_silkscreen_path",
7328
+ route: [
7329
+ {
7330
+ x: -grid.x / 2 - borderMargin,
7331
+ y: grid.y / 2 + borderMargin - cornerLine
7332
+ },
7333
+ {
7334
+ x: -grid.x / 2 - borderMargin,
7335
+ y: grid.y / 2 + borderMargin
7336
+ },
7337
+ {
7338
+ x: grid.x / 2 + borderMargin,
7339
+ y: grid.y / 2 + borderMargin
7340
+ },
7341
+ {
7342
+ x: grid.x / 2 + borderMargin,
7343
+ y: grid.y / 2 + borderMargin - cornerLine
7344
+ }
7345
+ ],
7346
+ stroke_width: grid.y / 30
7347
+ },
7348
+ // bottom silkscreen path
7349
+ {
7350
+ layer: "top",
7351
+ pcb_component_id: "",
7352
+ pcb_silkscreen_path_id: "",
7353
+ type: "pcb_silkscreen_path",
7354
+ route: [
7355
+ {
7356
+ x: -grid.x / 2 - borderMargin,
7357
+ y: -grid.y / 2 - borderMargin + cornerLine
7358
+ },
7359
+ {
7360
+ x: -grid.x / 2 - borderMargin,
7361
+ y: -grid.y / 2 - borderMargin
7362
+ },
7363
+ {
7364
+ x: grid.x / 2 + borderMargin,
7365
+ y: -grid.y / 2 - borderMargin
7366
+ },
7367
+ {
7368
+ x: grid.x / 2 + borderMargin,
7369
+ y: -grid.y / 2 - borderMargin + cornerLine
7370
+ }
7371
+ ],
7372
+ stroke_width: grid.y / 30
7373
+ }
7374
+ ];
7375
+ return silkscreenPaths;
7376
+ };
7377
+
7259
7378
  // src/fn/solderjumper.ts
7260
- import { length as length54 } from "circuit-json";
7379
+ import { length as length55 } from "circuit-json";
7261
7380
  var solderjumper = (params) => {
7262
7381
  const { num_pins, bridged, p = 2.54, pw = 1.5, ph = 1.5 } = params;
7263
- const padSpacing7 = length54.parse(p);
7264
- const padWidth = length54.parse(pw);
7265
- const padHeight = length54.parse(ph);
7382
+ const padSpacing7 = length55.parse(p);
7383
+ const padWidth = length55.parse(pw);
7384
+ const padHeight = length55.parse(ph);
7266
7385
  const traceWidth = Math.min(padHeight / 4, 0.5);
7267
7386
  const pads = [];
7268
7387
  for (let i = 0; i < num_pins; i++) {
@@ -7350,34 +7469,34 @@ var solderjumper = (params) => {
7350
7469
  };
7351
7470
 
7352
7471
  // src/fn/sot457.ts
7353
- import { z as z67 } from "zod";
7472
+ import { z as z68 } from "zod";
7354
7473
  var commonSchema = {
7355
- fn: z67.literal("sot457"),
7356
- num_pins: z67.literal(6).default(6),
7357
- pillh: z67.string().default("0.45mm"),
7358
- pillw: z67.string().default("1.45mm"),
7359
- pl: z67.string(),
7360
- pw: z67.string(),
7361
- p: z67.string(),
7362
- wave: z67.boolean().optional(),
7363
- reflow: z67.boolean().optional()
7474
+ fn: z68.literal("sot457"),
7475
+ num_pins: z68.literal(6).default(6),
7476
+ pillh: z68.string().default("0.45mm"),
7477
+ pillw: z68.string().default("1.45mm"),
7478
+ pl: z68.string(),
7479
+ pw: z68.string(),
7480
+ p: z68.string(),
7481
+ wave: z68.boolean().optional(),
7482
+ reflow: z68.boolean().optional()
7364
7483
  };
7365
7484
  var sot457DefSchema = base_def.extend({
7366
7485
  ...commonSchema,
7367
- h: z67.string().default("2.5mm"),
7368
- w: z67.string().default("2.7mm"),
7369
- pl: z67.string().default("0.8mm"),
7370
- pw: z67.string().default("0.55mm"),
7371
- p: z67.string().default("0.95mm")
7486
+ h: z68.string().default("2.5mm"),
7487
+ w: z68.string().default("2.7mm"),
7488
+ pl: z68.string().default("0.8mm"),
7489
+ pw: z68.string().default("0.55mm"),
7490
+ p: z68.string().default("0.95mm")
7372
7491
  });
7373
7492
  var sot457WaveSchema = base_def.extend({
7374
7493
  ...commonSchema,
7375
- h: z67.string().default("3mm"),
7376
- w: z67.string().default("4mm"),
7377
- pillr: z67.string().default("0.225mm"),
7378
- pl: z67.string().default("1.45mm"),
7379
- pw: z67.string().default("1.5mm"),
7380
- p: z67.string().default("1.475mm")
7494
+ h: z68.string().default("3mm"),
7495
+ w: z68.string().default("4mm"),
7496
+ pillr: z68.string().default("0.225mm"),
7497
+ pl: z68.string().default("1.45mm"),
7498
+ pw: z68.string().default("1.5mm"),
7499
+ p: z68.string().default("1.475mm")
7381
7500
  }).transform((data) => ({
7382
7501
  ...data,
7383
7502
  wave: data.wave ?? (data.reflow === void 0 ? true : !data.reflow),
@@ -7516,25 +7635,25 @@ var sot457 = (rawParams) => {
7516
7635
  };
7517
7636
 
7518
7637
  // src/fn/sot963.ts
7519
- import { z as z68 } from "zod";
7520
- import { length as length55 } from "circuit-json";
7638
+ import { z as z69 } from "zod";
7639
+ import { length as length56 } from "circuit-json";
7521
7640
  var sot963_def = base_def.extend({
7522
- fn: z68.string(),
7523
- num_pins: z68.literal(6).default(6),
7524
- w: z68.string().default("1.1mm"),
7525
- h: z68.string().default("1.45mm"),
7526
- p: z68.string().default("0.35mm"),
7527
- pl: z68.string().default("0.2mm"),
7528
- pw: z68.string().default("0.2mm"),
7529
- string: z68.string().optional()
7641
+ fn: z69.string(),
7642
+ num_pins: z69.literal(6).default(6),
7643
+ w: z69.string().default("1.1mm"),
7644
+ h: z69.string().default("1.45mm"),
7645
+ p: z69.string().default("0.35mm"),
7646
+ pl: z69.string().default("0.2mm"),
7647
+ pw: z69.string().default("0.2mm"),
7648
+ string: z69.string().optional()
7530
7649
  });
7531
7650
  var sot963 = (raw_params) => {
7532
7651
  const parameters = sot963_def.parse({ ...raw_params, fn: "sot963" });
7533
- const w = length55.parse(parameters.w);
7534
- const h = length55.parse(parameters.h);
7535
- const p = length55.parse(parameters.p);
7536
- const pl = length55.parse(parameters.pl);
7537
- const pw = length55.parse(parameters.pw);
7652
+ const w = length56.parse(parameters.w);
7653
+ const h = length56.parse(parameters.h);
7654
+ const p = length56.parse(parameters.p);
7655
+ const pl = length56.parse(parameters.pl);
7656
+ const pw = length56.parse(parameters.pw);
7538
7657
  const pads = [];
7539
7658
  for (let i = 0; i < 6; i++) {
7540
7659
  const { x, y } = getSot963PadCoord(i + 1, w, p, pl);
@@ -7597,19 +7716,19 @@ var getSot963PadCoord = (pn, w, p, pl) => {
7597
7716
  };
7598
7717
 
7599
7718
  // src/fn/potentiometer.ts
7600
- import { z as z69 } from "zod";
7719
+ import { z as z70 } from "zod";
7601
7720
  var potentiometer_def = base_def.extend({
7602
- fn: z69.string(),
7603
- num_pins: z69.union([z69.literal(3), z69.literal(2)]).default(3),
7604
- p: z69.string().default("3.8mm"),
7605
- id: z69.string().default("1.25mm"),
7606
- od: z69.string().default("2.35mm"),
7607
- ca: z69.string().default("14mm").describe(
7721
+ fn: z70.string(),
7722
+ num_pins: z70.union([z70.literal(3), z70.literal(2)]).default(3),
7723
+ p: z70.string().default("3.8mm"),
7724
+ id: z70.string().default("1.25mm"),
7725
+ od: z70.string().default("2.35mm"),
7726
+ ca: z70.string().default("14mm").describe(
7608
7727
  "Caliper axis (width or diameter of the potentiometer body or adjustment knob)"
7609
7728
  ),
7610
- w: z69.string().default("5.35mm"),
7611
- h: z69.string().default("4mm"),
7612
- string: z69.string().optional()
7729
+ w: z70.string().default("5.35mm"),
7730
+ h: z70.string().default("4mm"),
7731
+ string: z70.string().optional()
7613
7732
  });
7614
7733
  var potentiometer_acp = (parameters) => {
7615
7734
  const { p, id, od, h, ca } = parameters;
@@ -7676,15 +7795,15 @@ var potentiometer = (raw_params) => {
7676
7795
 
7677
7796
  // src/fn/electrolytic.ts
7678
7797
  import {
7679
- length as length56
7798
+ length as length57
7680
7799
  } from "circuit-json";
7681
- import { z as z70 } from "zod";
7800
+ import { z as z71 } from "zod";
7682
7801
  var electrolytic_def = base_def.extend({
7683
- fn: z70.string(),
7684
- p: length56.optional().default("7.5mm"),
7685
- id: length56.optional().default("1mm"),
7686
- od: length56.optional().default("2mm"),
7687
- d: length56.optional().default("10.5mm")
7802
+ fn: z71.string(),
7803
+ p: length57.optional().default("7.5mm"),
7804
+ id: length57.optional().default("1mm"),
7805
+ od: length57.optional().default("2mm"),
7806
+ d: length57.optional().default("10.5mm")
7688
7807
  });
7689
7808
  var generate_circle_arcs = (centerX, centerY, radius, cut, cutHeight) => {
7690
7809
  const topArc = [];
@@ -7791,22 +7910,22 @@ var electrolytic = (raw_params) => {
7791
7910
  };
7792
7911
 
7793
7912
  // src/fn/smbf.ts
7794
- import { z as z71 } from "zod";
7795
- import { length as length57 } from "circuit-json";
7913
+ import { z as z72 } from "zod";
7914
+ import { length as length58 } from "circuit-json";
7796
7915
  var smbf_def = base_def.extend({
7797
- fn: z71.string(),
7798
- num_pins: z71.literal(2).default(2),
7799
- w: z71.string().default("6.5mm"),
7800
- h: z71.string().default("3mm"),
7801
- pl: z71.string().default("1.75mm"),
7802
- pw: z71.string().default("2.40mm"),
7803
- p: z71.string().default("4.75mm")
7916
+ fn: z72.string(),
7917
+ num_pins: z72.literal(2).default(2),
7918
+ w: z72.string().default("6.5mm"),
7919
+ h: z72.string().default("3mm"),
7920
+ pl: z72.string().default("1.75mm"),
7921
+ pw: z72.string().default("2.40mm"),
7922
+ p: z72.string().default("4.75mm")
7804
7923
  });
7805
7924
  var smbf = (raw_params) => {
7806
7925
  const parameters = smbf_def.parse(raw_params);
7807
7926
  const silkscreenRefText = silkscreenRef(
7808
7927
  0,
7809
- length57.parse(parameters.h) - 0.5,
7928
+ length58.parse(parameters.h) - 0.5,
7810
7929
  0.3
7811
7930
  );
7812
7931
  const silkscreenLine = {
@@ -7815,20 +7934,20 @@ var smbf = (raw_params) => {
7815
7934
  pcb_component_id: "",
7816
7935
  route: [
7817
7936
  {
7818
- x: length57.parse(parameters.p) / 2,
7819
- y: length57.parse(parameters.h) / 2
7937
+ x: length58.parse(parameters.p) / 2,
7938
+ y: length58.parse(parameters.h) / 2
7820
7939
  },
7821
7940
  {
7822
- x: -length57.parse(parameters.w) / 2 - 0.3,
7823
- y: length57.parse(parameters.h) / 2
7941
+ x: -length58.parse(parameters.w) / 2 - 0.3,
7942
+ y: length58.parse(parameters.h) / 2
7824
7943
  },
7825
7944
  {
7826
- x: -length57.parse(parameters.w) / 2 - 0.3,
7827
- y: -length57.parse(parameters.h) / 2
7945
+ x: -length58.parse(parameters.w) / 2 - 0.3,
7946
+ y: -length58.parse(parameters.h) / 2
7828
7947
  },
7829
7948
  {
7830
- x: length57.parse(parameters.p) / 2,
7831
- y: -length57.parse(parameters.h) / 2
7949
+ x: length58.parse(parameters.p) / 2,
7950
+ y: -length58.parse(parameters.h) / 2
7832
7951
  }
7833
7952
  ],
7834
7953
  stroke_width: 0.1,
@@ -7870,16 +7989,16 @@ var smbfWithoutParsing = (parameters) => {
7870
7989
  };
7871
7990
 
7872
7991
  // src/fn/sot323.ts
7873
- import { z as z72 } from "zod";
7992
+ import { z as z73 } from "zod";
7874
7993
  var sot323_def = base_def.extend({
7875
- fn: z72.string(),
7876
- num_pins: z72.number().default(3),
7877
- w: z72.string().default("2.45mm"),
7878
- h: z72.string().default("2.40mm"),
7879
- pl: z72.string().default("0.92mm"),
7880
- pw: z72.string().default("0.45mm"),
7881
- p: z72.string().default("0.891mm"),
7882
- string: z72.string().optional()
7994
+ fn: z73.string(),
7995
+ num_pins: z73.number().default(3),
7996
+ w: z73.string().default("2.45mm"),
7997
+ h: z73.string().default("2.40mm"),
7998
+ pl: z73.string().default("0.92mm"),
7999
+ pw: z73.string().default("0.45mm"),
8000
+ p: z73.string().default("0.891mm"),
8001
+ string: z73.string().optional()
7883
8002
  });
7884
8003
  var sot323 = (raw_params) => {
7885
8004
  const match = raw_params.string?.match(/^sot323_(\d+)/);
@@ -7967,30 +8086,30 @@ var sot323_3 = (parameters) => {
7967
8086
  };
7968
8087
 
7969
8088
  // src/fn/smtpad.ts
7970
- import { z as z73 } from "zod";
7971
- import { length as length58 } from "circuit-json";
8089
+ import { z as z74 } from "zod";
8090
+ import { length as length59 } from "circuit-json";
7972
8091
  import { mm as mm14 } from "@tscircuit/mm";
7973
8092
  var smtpad_def = base_def.extend({
7974
- fn: z73.string(),
7975
- circle: z73.boolean().optional(),
7976
- rect: z73.boolean().optional(),
7977
- square: z73.boolean().optional(),
7978
- pill: z73.boolean().optional(),
7979
- d: length58.optional(),
7980
- pd: length58.optional(),
7981
- diameter: length58.optional(),
7982
- r: length58.optional(),
7983
- pr: length58.optional(),
7984
- radius: length58.optional(),
7985
- w: length58.optional(),
7986
- pw: length58.optional(),
7987
- width: length58.optional(),
7988
- h: length58.optional(),
7989
- ph: length58.optional(),
7990
- height: length58.optional(),
7991
- s: length58.optional(),
7992
- size: length58.optional(),
7993
- string: z73.string().optional()
8093
+ fn: z74.string(),
8094
+ circle: z74.boolean().optional(),
8095
+ rect: z74.boolean().optional(),
8096
+ square: z74.boolean().optional(),
8097
+ pill: z74.boolean().optional(),
8098
+ d: length59.optional(),
8099
+ pd: length59.optional(),
8100
+ diameter: length59.optional(),
8101
+ r: length59.optional(),
8102
+ pr: length59.optional(),
8103
+ radius: length59.optional(),
8104
+ w: length59.optional(),
8105
+ pw: length59.optional(),
8106
+ width: length59.optional(),
8107
+ h: length59.optional(),
8108
+ ph: length59.optional(),
8109
+ height: length59.optional(),
8110
+ s: length59.optional(),
8111
+ size: length59.optional(),
8112
+ string: z74.string().optional()
7994
8113
  }).transform((v) => {
7995
8114
  let shape = "rect";
7996
8115
  if (v.circle) shape = "circle";
@@ -8056,18 +8175,18 @@ var smtpad = (raw_params) => {
8056
8175
  };
8057
8176
 
8058
8177
  // src/fn/platedhole.ts
8059
- import { z as z74 } from "zod";
8060
- import { length as length59 } from "circuit-json";
8178
+ import { z as z75 } from "zod";
8179
+ import { length as length60 } from "circuit-json";
8061
8180
  import { mm as mm15 } from "@tscircuit/mm";
8062
8181
  var platedhole_def = base_def.extend({
8063
- fn: z74.string(),
8064
- d: length59.optional(),
8065
- hd: length59.optional(),
8066
- r: length59.optional(),
8067
- hr: length59.optional(),
8068
- pd: length59.optional(),
8069
- pr: length59.optional(),
8070
- squarepad: z74.boolean().optional().default(false)
8182
+ fn: z75.string(),
8183
+ d: length60.optional(),
8184
+ hd: length60.optional(),
8185
+ r: length60.optional(),
8186
+ hr: length60.optional(),
8187
+ pd: length60.optional(),
8188
+ pr: length60.optional(),
8189
+ squarepad: z75.boolean().optional().default(false)
8071
8190
  }).transform((v) => {
8072
8191
  let holeD;
8073
8192
  if (v.d !== void 0) holeD = mm15(v.d);
@@ -8106,14 +8225,14 @@ var platedhole2 = (raw_params) => {
8106
8225
  };
8107
8226
 
8108
8227
  // src/fn/sot.ts
8109
- import { z as z75 } from "zod";
8228
+ import { z as z76 } from "zod";
8110
8229
  var sot_def = base_def.extend({
8111
- fn: z75.string(),
8112
- num_pins: z75.literal(6).default(6),
8113
- h: z75.string().default("1.6mm"),
8114
- pl: z75.string().default("1mm"),
8115
- pw: z75.string().default("0.7mm"),
8116
- p: z75.string().default("0.95mm")
8230
+ fn: z76.string(),
8231
+ num_pins: z76.literal(6).default(6),
8232
+ h: z76.string().default("1.6mm"),
8233
+ pl: z76.string().default("1mm"),
8234
+ pw: z76.string().default("0.7mm"),
8235
+ p: z76.string().default("0.95mm")
8117
8236
  });
8118
8237
  var sot = (raw_params) => {
8119
8238
  const parameters = sot_def.parse(raw_params);
@@ -8230,16 +8349,16 @@ var sotWithoutParsing = (parameters) => {
8230
8349
  };
8231
8350
 
8232
8351
  // src/fn/sot343.ts
8233
- import { z as z76 } from "zod";
8352
+ import { z as z77 } from "zod";
8234
8353
  var sot343_def = base_def.extend({
8235
- fn: z76.string(),
8236
- num_pins: z76.number().default(4),
8237
- w: z76.string().default("3.2mm"),
8238
- h: z76.string().default("2.6mm"),
8239
- pl: z76.string().default("1.05mm"),
8240
- pw: z76.string().default("0.45mm"),
8241
- p: z76.string().default("0.55mm"),
8242
- string: z76.string().optional()
8354
+ fn: z77.string(),
8355
+ num_pins: z77.number().default(4),
8356
+ w: z77.string().default("3.2mm"),
8357
+ h: z77.string().default("2.6mm"),
8358
+ pl: z77.string().default("1.05mm"),
8359
+ pw: z77.string().default("0.45mm"),
8360
+ p: z77.string().default("0.55mm"),
8361
+ string: z77.string().optional()
8243
8362
  });
8244
8363
  var sot343 = (raw_params) => {
8245
8364
  const match = raw_params.string?.match(/^sot343_(\d+)/);
@@ -8334,9 +8453,9 @@ var sot343_4 = (parameters) => {
8334
8453
  };
8335
8454
 
8336
8455
  // src/fn/m2host.ts
8337
- import { z as z77 } from "zod";
8456
+ import { z as z78 } from "zod";
8338
8457
  var m2host_def = base_def.extend({
8339
- fn: z77.string()
8458
+ fn: z78.string()
8340
8459
  });
8341
8460
  var m2host = (raw_params) => {
8342
8461
  const parameters = m2host_def.parse(raw_params);
@@ -8440,42 +8559,42 @@ var m2host = (raw_params) => {
8440
8559
  };
8441
8560
 
8442
8561
  // src/fn/mountedpcbmodule.ts
8443
- import { length as length60 } from "circuit-json";
8444
- import { z as z78 } from "zod";
8562
+ import { length as length61 } from "circuit-json";
8563
+ import { z as z79 } from "zod";
8445
8564
  var mountedpcbmodule_def = base_def.extend({
8446
- fn: z78.string(),
8447
- numPins: z78.number().optional().default(0),
8448
- rows: z78.union([z78.string(), z78.number()]).transform((val) => Number(val)).optional().default(1).describe("number of rows"),
8449
- p: length60.default("2.54mm").describe("pitch"),
8450
- id: length60.default("1.0mm").describe("inner diameter"),
8451
- od: length60.default("1.5mm").describe("outer diameter"),
8452
- male: z78.boolean().optional().describe("the module uses male headers"),
8453
- nopin: z78.boolean().optional().default(false).describe("omit pins rendering"),
8454
- female: z78.boolean().optional().describe("the module uses female headers"),
8455
- smd: z78.boolean().optional().describe("surface mount device"),
8456
- pinlabeltextalignleft: z78.boolean().optional().default(false),
8457
- pinlabeltextaligncenter: z78.boolean().optional().default(false),
8458
- pinlabeltextalignright: z78.boolean().optional().default(false),
8459
- pinlabelverticallyinverted: z78.boolean().optional().default(false),
8460
- pinlabelorthogonal: z78.boolean().optional().default(false),
8461
- nopinlabels: z78.boolean().optional().default(false).describe("omit silkscreen pin labels"),
8462
- doublesidedpinlabel: z78.boolean().optional().default(false).describe("add silkscreen pins in top and bottom layers"),
8463
- bottomsidepinlabel: z78.boolean().optional().default(false).describe(
8565
+ fn: z79.string(),
8566
+ numPins: z79.number().optional().default(0),
8567
+ rows: z79.union([z79.string(), z79.number()]).transform((val) => Number(val)).optional().default(1).describe("number of rows"),
8568
+ p: length61.default("2.54mm").describe("pitch"),
8569
+ id: length61.default("1.0mm").describe("inner diameter"),
8570
+ od: length61.default("1.5mm").describe("outer diameter"),
8571
+ male: z79.boolean().optional().describe("the module uses male headers"),
8572
+ nopin: z79.boolean().optional().default(false).describe("omit pins rendering"),
8573
+ female: z79.boolean().optional().describe("the module uses female headers"),
8574
+ smd: z79.boolean().optional().describe("surface mount device"),
8575
+ pinlabeltextalignleft: z79.boolean().optional().default(false),
8576
+ pinlabeltextaligncenter: z79.boolean().optional().default(false),
8577
+ pinlabeltextalignright: z79.boolean().optional().default(false),
8578
+ pinlabelverticallyinverted: z79.boolean().optional().default(false),
8579
+ pinlabelorthogonal: z79.boolean().optional().default(false),
8580
+ nopinlabels: z79.boolean().optional().default(false).describe("omit silkscreen pin labels"),
8581
+ doublesidedpinlabel: z79.boolean().optional().default(false).describe("add silkscreen pins in top and bottom layers"),
8582
+ bottomsidepinlabel: z79.boolean().optional().default(false).describe(
8464
8583
  "place the silkscreen reference text on the bottom layer instead of top"
8465
8584
  ),
8466
- pinRowSide: z78.enum(["left", "right", "top", "bottom"]).optional().default("left"),
8467
- pinrowleft: z78.boolean().optional().default(false),
8468
- pinrowright: z78.boolean().optional().default(false),
8469
- pinrowtop: z78.boolean().optional().default(false),
8470
- pinrowbottom: z78.boolean().optional().default(false),
8471
- pinrowleftpins: z78.union([z78.string(), z78.number()]).transform((val) => Number(val)).optional(),
8472
- pinrowrightpins: z78.union([z78.string(), z78.number()]).transform((val) => Number(val)).optional(),
8473
- pinrowtoppins: z78.union([z78.string(), z78.number()]).transform((val) => Number(val)).optional(),
8474
- pinrowbottompins: z78.union([z78.string(), z78.number()]).transform((val) => Number(val)).optional(),
8475
- width: length60.optional(),
8476
- height: length60.optional(),
8477
- pinRowHoleEdgeToEdgeDist: length60.default("2mm"),
8478
- holes: z78.union([z78.string(), z78.array(z78.string())]).optional().transform((val) => {
8585
+ pinRowSide: z79.enum(["left", "right", "top", "bottom"]).optional().default("left"),
8586
+ pinrowleft: z79.boolean().optional().default(false),
8587
+ pinrowright: z79.boolean().optional().default(false),
8588
+ pinrowtop: z79.boolean().optional().default(false),
8589
+ pinrowbottom: z79.boolean().optional().default(false),
8590
+ pinrowleftpins: z79.union([z79.string(), z79.number()]).transform((val) => Number(val)).optional(),
8591
+ pinrowrightpins: z79.union([z79.string(), z79.number()]).transform((val) => Number(val)).optional(),
8592
+ pinrowtoppins: z79.union([z79.string(), z79.number()]).transform((val) => Number(val)).optional(),
8593
+ pinrowbottompins: z79.union([z79.string(), z79.number()]).transform((val) => Number(val)).optional(),
8594
+ width: length61.optional(),
8595
+ height: length61.optional(),
8596
+ pinRowHoleEdgeToEdgeDist: length61.default("2mm"),
8597
+ holes: z79.union([z79.string(), z79.array(z79.string())]).optional().transform((val) => {
8479
8598
  if (!val) return val;
8480
8599
  if (Array.isArray(val)) return val;
8481
8600
  if (val.startsWith("(") && val.endsWith(")")) {
@@ -8483,19 +8602,23 @@ var mountedpcbmodule_def = base_def.extend({
8483
8602
  }
8484
8603
  return [val];
8485
8604
  }),
8486
- holeXDist: length60.optional(),
8487
- holeYDist: length60.optional(),
8488
- holeInset: length60.default("1mm"),
8489
- pinrow: z78.union([z78.string(), z78.number()]).optional(),
8490
- usbposition: z78.enum(["left", "right", "top", "bottom"]).optional().default("left"),
8491
- usbleft: z78.boolean().optional().default(false),
8492
- usbtop: z78.boolean().optional().default(false),
8493
- usbright: z78.boolean().optional().default(false),
8494
- usbbottom: z78.boolean().optional().default(false),
8495
- usbtype: z78.enum(["micro", "c"]).optional(),
8496
- usbmicro: z78.boolean().optional().default(false),
8497
- usbc: z78.boolean().optional().default(false),
8498
- screen: z78.boolean().optional().default(false).describe("add silkscreen outline for screen/display area")
8605
+ holeXDist: length61.optional(),
8606
+ holeYDist: length61.optional(),
8607
+ holeInset: length61.default("1mm"),
8608
+ pinrow: z79.union([z79.string(), z79.number()]).optional(),
8609
+ usbposition: z79.enum(["left", "right", "top", "bottom"]).optional().default("left"),
8610
+ usbleft: z79.boolean().optional().default(false),
8611
+ usbtop: z79.boolean().optional().default(false),
8612
+ usbright: z79.boolean().optional().default(false),
8613
+ usbbottom: z79.boolean().optional().default(false),
8614
+ usbtype: z79.enum(["micro", "c"]).optional(),
8615
+ usbmicro: z79.boolean().optional().default(false),
8616
+ usbc: z79.boolean().optional().default(false),
8617
+ screen: z79.boolean().optional().default(false).describe("add silkscreen outline for screen/display area"),
8618
+ screenwidth: length61.optional(),
8619
+ screenheight: length61.optional(),
8620
+ screencenteroffsetx: length61.optional(),
8621
+ screencenteroffsety: length61.optional()
8499
8622
  }).transform((data) => {
8500
8623
  const pinlabelAnchorSide = determinePinlabelAnchorSide(data);
8501
8624
  let pinRowSide = data.pinRowSide;
@@ -8559,6 +8682,12 @@ var mountedpcbmodule_def = base_def.extend({
8559
8682
  calculatedWidth = 10;
8560
8683
  calculatedHeight = 10;
8561
8684
  }
8685
+ const finalWidth = data.width ?? calculatedWidth;
8686
+ const finalHeight = data.height ?? calculatedHeight;
8687
+ const screenWidth = data.screenwidth ?? finalWidth * 0.95;
8688
+ const screenHeight = data.screenheight ?? finalHeight * 0.95;
8689
+ const screenCenterOffsetX = data.screencenteroffsetx ?? 0;
8690
+ const screenCenterOffsetY = data.screencenteroffsety ?? 0;
8562
8691
  return {
8563
8692
  ...data,
8564
8693
  pinlabelAnchorSide,
@@ -8567,8 +8696,12 @@ var mountedpcbmodule_def = base_def.extend({
8567
8696
  usbtype,
8568
8697
  male: data.male ?? !data.female,
8569
8698
  female: data.female ?? false,
8570
- width: data.width ?? calculatedWidth,
8571
- height: data.height ?? calculatedHeight,
8699
+ width: finalWidth,
8700
+ height: finalHeight,
8701
+ screenwidth: screenWidth,
8702
+ screenheight: screenHeight,
8703
+ screencenteroffsetx: screenCenterOffsetX,
8704
+ screencenteroffsety: screenCenterOffsetY,
8572
8705
  pinrowleftpins: sidePinCounts.left,
8573
8706
  pinrowrightpins: sidePinCounts.right,
8574
8707
  pinrowtoppins: sidePinCounts.top,
@@ -8577,7 +8710,7 @@ var mountedpcbmodule_def = base_def.extend({
8577
8710
  }).superRefine((data, ctx) => {
8578
8711
  if (data.male && data.female) {
8579
8712
  ctx.addIssue({
8580
- code: z78.ZodIssueCode.custom,
8713
+ code: z79.ZodIssueCode.custom,
8581
8714
  message: "'male' and 'female' cannot both be true; it should be male or female.",
8582
8715
  path: ["male", "female"]
8583
8716
  });
@@ -8613,7 +8746,11 @@ var mountedpcbmodule = (raw_params) => {
8613
8746
  pinrowbottompins,
8614
8747
  usbposition,
8615
8748
  usbtype,
8616
- screen
8749
+ screen,
8750
+ screenwidth,
8751
+ screenheight,
8752
+ screencenteroffsetx,
8753
+ screencenteroffsety
8617
8754
  } = parameters;
8618
8755
  let pinlabelTextAlign = "center";
8619
8756
  if (pinlabeltextalignleft) pinlabelTextAlign = "left";
@@ -8894,12 +9031,16 @@ var mountedpcbmodule = (raw_params) => {
8894
9031
  elements.push(silkscreenpath(usbRect, { stroke_width: 0.1, layer: "top" }));
8895
9032
  }
8896
9033
  if (screen) {
9034
+ const halfScreenWidth = screenwidth / 2;
9035
+ const halfScreenHeight = screenheight / 2;
9036
+ const centerX = screencenteroffsetx;
9037
+ const centerY = screencenteroffsety;
8897
9038
  const screenOutline = [
8898
- { x: -width * 0.475, y: -height * 0.475 },
8899
- { x: width * 0.475, y: -height * 0.475 },
8900
- { x: width * 0.475, y: height * 0.475 },
8901
- { x: -width * 0.475, y: height * 0.475 },
8902
- { x: -width * 0.475, y: -height * 0.475 }
9039
+ { x: -halfScreenWidth + centerX, y: -halfScreenHeight + centerY },
9040
+ { x: halfScreenWidth + centerX, y: -halfScreenHeight + centerY },
9041
+ { x: halfScreenWidth + centerX, y: halfScreenHeight + centerY },
9042
+ { x: -halfScreenWidth + centerX, y: halfScreenHeight + centerY },
9043
+ { x: -halfScreenWidth + centerX, y: -halfScreenHeight + centerY }
8903
9044
  ];
8904
9045
  elements.push(
8905
9046
  silkscreenpath(screenOutline, { stroke_width: 0.05, layer: "top" })
@@ -8912,16 +9053,16 @@ var mountedpcbmodule = (raw_params) => {
8912
9053
  };
8913
9054
 
8914
9055
  // src/fn/to92l.ts
8915
- import { z as z79 } from "zod";
9056
+ import { z as z80 } from "zod";
8916
9057
  var to92l_def = base_def.extend({
8917
- fn: z79.string(),
8918
- num_pins: z79.number().default(3),
8919
- inline: z79.boolean().default(false),
8920
- p: z79.string().default("1.27mm"),
8921
- id: z79.string().default("0.75mm"),
8922
- od: z79.string().default("1.3mm"),
8923
- w: z79.string().default("4.8mm"),
8924
- h: z79.string().default("4.0mm")
9058
+ fn: z80.string(),
9059
+ num_pins: z80.number().default(3),
9060
+ inline: z80.boolean().default(false),
9061
+ p: z80.string().default("1.27mm"),
9062
+ id: z80.string().default("0.75mm"),
9063
+ od: z80.string().default("1.3mm"),
9064
+ w: z80.string().default("4.8mm"),
9065
+ h: z80.string().default("4.0mm")
8925
9066
  });
8926
9067
  var to92l = (raw_params) => {
8927
9068
  const parameters = to92l_def.parse(raw_params);