@tscircuit/footprinter 0.0.42 → 0.0.44

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.cjs CHANGED
@@ -217,8 +217,8 @@ var require_lodash10 = __commonJS({
217
217
  if (typeof end == "undefined") {
218
218
  end = array ? array.length : 0;
219
219
  }
220
- var index = -1, length5 = end - start || 0, result = Array(length5 < 0 ? 0 : length5);
221
- while (++index < length5) {
220
+ var index = -1, length6 = end - start || 0, result = Array(length6 < 0 ? 0 : length6);
221
+ while (++index < length6) {
222
222
  result[index] = array[start + index];
223
223
  }
224
224
  return result;
@@ -451,8 +451,8 @@ var require_lodash18 = __commonJS({
451
451
  if (!objectTypes[typeof iterable])
452
452
  return result;
453
453
  callback = callback && typeof thisArg == "undefined" ? callback : baseCreateCallback(callback, thisArg, 3);
454
- var ownIndex = -1, ownProps = objectTypes[typeof iterable] && keys(iterable), length5 = ownProps ? ownProps.length : 0;
455
- while (++ownIndex < length5) {
454
+ var ownIndex = -1, ownProps = objectTypes[typeof iterable] && keys(iterable), length6 = ownProps ? ownProps.length : 0;
455
+ while (++ownIndex < length6) {
456
456
  index = ownProps[ownIndex];
457
457
  if (callback(iterable[index], index, collection) === false)
458
458
  return result;
@@ -470,10 +470,10 @@ var require_lodash19 = __commonJS({
470
470
  var baseCreateCallback = require_lodash17();
471
471
  var forOwn = require_lodash18();
472
472
  function forEach(collection, callback, thisArg) {
473
- var index = -1, length5 = collection ? collection.length : 0;
473
+ var index = -1, length6 = collection ? collection.length : 0;
474
474
  callback = callback && typeof thisArg == "undefined" ? callback : baseCreateCallback(callback, thisArg, 3);
475
- if (typeof length5 == "number") {
476
- while (++index < length5) {
475
+ if (typeof length6 == "number") {
476
+ while (++index < length6) {
477
477
  if (callback(collection[index], index, collection) === false) {
478
478
  break;
479
479
  }
@@ -2568,7 +2568,7 @@ var require_dist = __commonJS({
2568
2568
  inductance: () => inductance,
2569
2569
  layer_ref: () => layer_ref,
2570
2570
  layer_string: () => layer_string,
2571
- length: () => length5,
2571
+ length: () => length6,
2572
2572
  pcb_board: () => pcb_board,
2573
2573
  pcb_component: () => pcb_component,
2574
2574
  pcb_hole: () => pcb_hole,
@@ -2705,16 +2705,16 @@ var require_dist = __commonJS({
2705
2705
  };
2706
2706
  }
2707
2707
  };
2708
- var import_zod8 = require("zod");
2709
- var resistance = import_zod8.z.string().or(import_zod8.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
2710
- var capacitance = import_zod8.z.string().or(import_zod8.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
2711
- var inductance = import_zod8.z.string().or(import_zod8.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
2712
- var voltage = import_zod8.z.string().or(import_zod8.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
2713
- var length5 = import_zod8.z.string().or(import_zod8.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
2714
- var distance2 = length5;
2715
- var current = import_zod8.z.string().or(import_zod8.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
2716
- var time = import_zod8.z.string().or(import_zod8.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
2717
- var rotation = import_zod8.z.string().or(import_zod8.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
2708
+ var import_zod10 = require("zod");
2709
+ var resistance = import_zod10.z.string().or(import_zod10.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
2710
+ var capacitance = import_zod10.z.string().or(import_zod10.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
2711
+ var inductance = import_zod10.z.string().or(import_zod10.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
2712
+ var voltage = import_zod10.z.string().or(import_zod10.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
2713
+ var length6 = import_zod10.z.string().or(import_zod10.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
2714
+ var distance2 = length6;
2715
+ var current = import_zod10.z.string().or(import_zod10.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
2716
+ var time = import_zod10.z.string().or(import_zod10.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
2717
+ var rotation = import_zod10.z.string().or(import_zod10.z.number()).transform((v) => parseAndConvertSiUnit(v).value);
2718
2718
  var import_zod22 = require("zod");
2719
2719
  var point = import_zod22.z.object({
2720
2720
  x: distance2,
@@ -2758,13 +2758,13 @@ var require_dist = __commonJS({
2758
2758
  var source_simple_diode = source_component_base.extend({
2759
2759
  ftype: import_zod82.z.literal("simple_diode")
2760
2760
  });
2761
- var import_zod9 = require("zod");
2761
+ var import_zod92 = require("zod");
2762
2762
  var source_simple_ground = source_component_base.extend({
2763
- ftype: import_zod9.z.literal("simple_ground")
2763
+ ftype: import_zod92.z.literal("simple_ground")
2764
2764
  });
2765
- var import_zod10 = require("zod");
2765
+ var import_zod102 = require("zod");
2766
2766
  var source_simple_bug = source_component_base.extend({
2767
- ftype: import_zod10.z.literal("simple_bug")
2767
+ ftype: import_zod102.z.literal("simple_bug")
2768
2768
  });
2769
2769
  var import_zod11 = require("zod");
2770
2770
  var source_simple_inductor = source_component_base.extend({
@@ -2989,8 +2989,8 @@ var require_dist = __commonJS({
2989
2989
  center: point,
2990
2990
  layer: layer_ref,
2991
2991
  rotation,
2992
- width: length5,
2993
- height: length5
2992
+ width: length6,
2993
+ height: length6
2994
2994
  }).describe("Defines a component on the PCB");
2995
2995
  var import_zod322 = require("zod");
2996
2996
  var pcb_hole = import_zod322.z.object({
@@ -3121,8 +3121,8 @@ var require_dist = __commonJS({
3121
3121
  var import_zod41 = require("zod");
3122
3122
  var pcb_board = import_zod41.z.object({
3123
3123
  type: import_zod41.z.literal("pcb_board"),
3124
- width: length5,
3125
- height: length5,
3124
+ width: length6,
3125
+ height: length6,
3126
3126
  center: point
3127
3127
  }).describe("Defines the board outline of the PCB");
3128
3128
  var import_zod422 = require("zod");
@@ -3230,6 +3230,7 @@ __export(fn_exports, {
3230
3230
  dip: () => dip,
3231
3231
  led: () => led,
3232
3232
  mlp: () => mlp,
3233
+ pinrow: () => pinrow,
3233
3234
  qfn: () => qfn,
3234
3235
  qfp: () => qfp,
3235
3236
  quad: () => quad,
@@ -3693,6 +3694,9 @@ var extendSoicDef = (newDefaults) => import_zod5.z.object({
3693
3694
  });
3694
3695
  var soic_def = extendSoicDef({});
3695
3696
  var getCcwSoicCoords = (params) => {
3697
+ if (params.widthincludeslegs !== void 0) {
3698
+ params.legsoutside = !params.widthincludeslegs;
3699
+ }
3696
3700
  const { num_pins, pn, w, p, pl, legsoutside } = params;
3697
3701
  const ph = num_pins / 2;
3698
3702
  const isLeft = pn <= ph;
@@ -4110,10 +4114,100 @@ var sot236 = (params) => {
4110
4114
  return soicWithoutParsing(sot236_def.parse({ ...params, num_pins: 6 }));
4111
4115
  };
4112
4116
 
4117
+ // src/fn/dfn.ts
4118
+ var import_zod8 = require("zod");
4119
+
4120
+ // src/helpers/corner.ts
4121
+ var CORNERS = [
4122
+ { name: "top-left", dx: -1, dy: 1 },
4123
+ { name: "top-right", dx: 1, dy: 1 },
4124
+ { name: "bottom-left", dx: -1, dy: -1 },
4125
+ { name: "bottom-right", dx: 1, dy: -1 }
4126
+ ];
4127
+
4113
4128
  // src/fn/dfn.ts
4114
4129
  var dfn_def = extendSoicDef({});
4115
4130
  var dfn = (raw_params) => {
4116
- return soicWithoutParsing(dfn_def.parse(raw_params));
4131
+ const params = dfn_def.parse(raw_params);
4132
+ const pads = [];
4133
+ for (let i = 0; i < params.num_pins; i++) {
4134
+ const { x, y } = getCcwSoicCoords({
4135
+ num_pins: params.num_pins,
4136
+ pn: i + 1,
4137
+ w: params.w,
4138
+ p: params.p ?? 1.27,
4139
+ pl: params.pl,
4140
+ widthincludeslegs: true
4141
+ });
4142
+ pads.push(rectpad(i + 1, x, y, params.pl ?? "1mm", params.pw ?? "0.6mm"));
4143
+ }
4144
+ const m = Math.min(1, params.p / 2);
4145
+ const sw = params.w + m;
4146
+ const sh = (params.num_pins / 2 - 1) * params.p + params.pw + m;
4147
+ const silkscreenPaths = [];
4148
+ for (const corner of CORNERS) {
4149
+ const { dx, dy } = corner;
4150
+ silkscreenPaths.push({
4151
+ layer: "top",
4152
+ pcb_component_id: "",
4153
+ pcb_silkscreen_path_id: "",
4154
+ route: [
4155
+ { x: dx * sw / 2 - dx * params.p, y: dy * sh / 2 },
4156
+ { x: dx * sw / 2, y: dy * sh / 2 },
4157
+ { x: dx * sw / 2, y: dy * sh / 2 - dy * params.p }
4158
+ ],
4159
+ type: "pcb_silkscreen_path"
4160
+ });
4161
+ }
4162
+ const as = params.p / 4;
4163
+ const atx = -sw / 2 - as / 2;
4164
+ const aty = sh / 2 - params.p / 2;
4165
+ silkscreenPaths.push({
4166
+ layer: "top",
4167
+ pcb_component_id: "",
4168
+ pcb_silkscreen_path_id: "",
4169
+ type: "pcb_silkscreen_path",
4170
+ route: [
4171
+ {
4172
+ x: atx,
4173
+ y: aty
4174
+ },
4175
+ {
4176
+ x: atx - as,
4177
+ y: aty + as
4178
+ },
4179
+ {
4180
+ x: atx - as,
4181
+ y: aty - as
4182
+ },
4183
+ {
4184
+ x: atx,
4185
+ y: aty
4186
+ }
4187
+ ]
4188
+ });
4189
+ return [...pads, ...silkscreenPaths];
4190
+ };
4191
+
4192
+ // src/fn/pinrow.ts
4193
+ var import_zod9 = require("zod");
4194
+ var import_soup5 = __toESM(require_dist(), 1);
4195
+ var pinrow_def = import_zod9.z.object({
4196
+ num_pins: import_zod9.z.number(),
4197
+ p: import_soup5.length.default("0.1in").describe("pitch"),
4198
+ id: import_soup5.length.default("1.0mm").describe("inner diameter"),
4199
+ od: import_soup5.length.default("1.2mm").describe("outer diameter")
4200
+ });
4201
+ var pinrow = (raw_params) => {
4202
+ const params = pinrow_def.parse(raw_params);
4203
+ const { p, id, od } = params;
4204
+ const holes = [];
4205
+ const ns = params.num_pins - 1;
4206
+ const xoff = -(ns / 2) * p;
4207
+ for (let i = 0; i < params.num_pins; i++) {
4208
+ holes.push(platedhole(i + 1, xoff + i * p, 0, id, od));
4209
+ }
4210
+ return holes;
4117
4211
  };
4118
4212
 
4119
4213
  // src/helpers/is-not-null.ts