@tscircuit/footprinter 0.0.297 → 0.0.299

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
@@ -502,14 +502,13 @@ var passive = (params) => {
502
502
  silkscreenLine,
503
503
  silkscreenRefText
504
504
  ];
505
- } else {
506
- return [
507
- rectpad(["1", "left"], -p / 2, 0, pw, ph),
508
- rectpad(["2", "right"], p / 2, 0, pw, ph),
509
- silkscreenLine,
510
- silkscreenRefText
511
- ];
512
505
  }
506
+ return [
507
+ rectpad(["1", "left"], -p / 2, 0, pw, ph),
508
+ rectpad(["2", "right"], p / 2, 0, pw, ph),
509
+ silkscreenLine,
510
+ silkscreenRefText
511
+ ];
513
512
  };
514
513
 
515
514
  // src/fn/diode.ts
@@ -795,7 +794,7 @@ var getArrayCount = (parameters) => {
795
794
  return Number.isNaN(parsed) ? void 0 : parsed;
796
795
  }
797
796
  if (typeof parameters.imperial === "string") {
798
- const match = parameters.imperial.match(/(?:array|x)(2|4)$/);
797
+ const match = parameters.imperial.match(/x(2|4)$/);
799
798
  const count = match?.[1];
800
799
  if (count) {
801
800
  return Number.parseInt(count, 10);
@@ -806,7 +805,7 @@ var getArrayCount = (parameters) => {
806
805
  var getImperialBase = (imperial) => {
807
806
  if (!imperial) return void 0;
808
807
  const imperialString = typeof imperial === "number" ? `${imperial}` : imperial;
809
- return imperialString.split("_")[0];
808
+ return imperialString.split(/[_x]/)[0];
810
809
  };
811
810
  var res = (rawParameters) => {
812
811
  const arrayCount = getArrayCount(rawParameters);
@@ -8387,10 +8386,10 @@ var applyOrigin = (elements, origin) => {
8387
8386
  (el) => el.type === "pcb_smtpad" || el.type === "pcb_plated_hole" || el.type === "pcb_thtpad"
8388
8387
  );
8389
8388
  if (pads.length === 0) return elements;
8390
- let minX = Infinity;
8391
- let maxX = -Infinity;
8392
- let minY = Infinity;
8393
- let maxY = -Infinity;
8389
+ let minX = Number.POSITIVE_INFINITY;
8390
+ let maxX = Number.NEGATIVE_INFINITY;
8391
+ let minY = Number.POSITIVE_INFINITY;
8392
+ let maxY = Number.NEGATIVE_INFINITY;
8394
8393
  const updateBounds = (x, y, w = 0, h = 0) => {
8395
8394
  const left = x - w / 2;
8396
8395
  const right = x + w / 2;
@@ -8445,11 +8444,12 @@ var applyOrigin = (elements, origin) => {
8445
8444
  dx = maxX;
8446
8445
  dy = (minY + maxY) / 2;
8447
8446
  break;
8448
- case "pin1":
8447
+ case "pin1": {
8449
8448
  const pin1 = pads.find((p) => p.port_hints?.[0] === "1") || pads[0];
8450
8449
  dx = pin1.x;
8451
8450
  dy = pin1.y;
8452
8451
  break;
8452
+ }
8453
8453
  }
8454
8454
  if (dx === 0 && dy === 0) return elements;
8455
8455
  for (const el of elements) {
@@ -8498,7 +8498,7 @@ var applyNoSilkscreen = (elements, parameters) => {
8498
8498
  // src/footprinter.ts
8499
8499
  var string2 = (def) => {
8500
8500
  let fp2 = footprinter();
8501
- const modifiedDef = def.replace(/^((?:\d{4}|\d{5}))(?=$|_)/, "res$1");
8501
+ const modifiedDef = def.replace(/^((?:\d{4}|\d{5}))(?=$|_|x)/, "res$1");
8502
8502
  const def_parts = modifiedDef.split(/_(?!metric)/).map((s) => {
8503
8503
  const m = s.match(/([a-zA-Z]+)([\(\d\.\+\?].*)?/);
8504
8504
  if (!m) return null;