jscad-electronics 0.0.158 → 0.0.159

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/vanilla.js CHANGED
@@ -184,7 +184,7 @@ var ExtrudedPads = ({
184
184
  };
185
185
 
186
186
  // lib/Footprinter3d.tsx
187
- import { fp as fp5 } from "@tscircuit/footprinter";
187
+ import { fp as fp6 } from "@tscircuit/footprinter";
188
188
  import { mp } from "@tscircuit/modelprinter";
189
189
 
190
190
  // lib/ChipBody.tsx
@@ -5169,6 +5169,135 @@ var JSTPH2_0mm = ({
5169
5169
  ] });
5170
5170
  };
5171
5171
 
5172
+ // lib/JSTXH2_5mm.tsx
5173
+ import { fp as fp2 } from "@tscircuit/footprinter";
5174
+ var JSTXH2_5mm = ({
5175
+ numPins = 4,
5176
+ showPins = true,
5177
+ showFootprint = true,
5178
+ bodyColor = "#f8fafc",
5179
+ // Natural white PA 66 nylon housing per spec
5180
+ pinColor = "#635959"
5181
+ // Tin-plated metallic gray posts
5182
+ }) => {
5183
+ const pitch = 2.5;
5184
+ const bodyHeight = 7;
5185
+ const bodyDepth = 5.75;
5186
+ const wallThickness = 0.85;
5187
+ const floorThickness = 1.65;
5188
+ const hollowHeight = bodyHeight - floorThickness;
5189
+ const pinLength = 8.75;
5190
+ const bodyWidth = (numPins - 1) * pitch + 4.9;
5191
+ const startX = -((numPins - 1) * pitch) / 2;
5192
+ const keySlotWidth = 0.8;
5193
+ const keySlotDepth = wallThickness + 0.2;
5194
+ const keySlotHeight = 3.5;
5195
+ const keySlotX = bodyWidth / 2 - 1.3;
5196
+ const lockNotchWidth = Math.min(
5197
+ bodyWidth - 3.4,
5198
+ Math.max(3, (numPins - 1) * pitch * 0.4 + 2.2)
5199
+ );
5200
+ const lockNotchHeight = 2.4;
5201
+ return /* @__PURE__ */ jsxs(Fragment2, { children: [
5202
+ /* @__PURE__ */ jsx(Translate, { offset: [0, 0, bodyHeight / 2], children: /* @__PURE__ */ jsx(Colorize, { color: bodyColor, children: /* @__PURE__ */ jsxs(Subtract, { children: [
5203
+ /* @__PURE__ */ jsx(Cuboid, { size: [bodyWidth, bodyDepth, bodyHeight] }),
5204
+ /* @__PURE__ */ jsx(Translate, { offset: [0, 0, (bodyHeight - hollowHeight) / 2 + 0.1], children: /* @__PURE__ */ jsx(
5205
+ Cuboid,
5206
+ {
5207
+ size: [
5208
+ bodyWidth - wallThickness * 2,
5209
+ bodyDepth - wallThickness * 2,
5210
+ hollowHeight + 0.2
5211
+ ]
5212
+ }
5213
+ ) }),
5214
+ /* @__PURE__ */ jsx(
5215
+ Translate,
5216
+ {
5217
+ offset: [
5218
+ 0,
5219
+ -bodyDepth / 2 + wallThickness / 2,
5220
+ bodyHeight / 2 - lockNotchHeight / 2 + 0.1
5221
+ ],
5222
+ children: /* @__PURE__ */ jsx(
5223
+ Cuboid,
5224
+ {
5225
+ size: [
5226
+ lockNotchWidth,
5227
+ wallThickness + 0.2,
5228
+ lockNotchHeight + 0.2
5229
+ ]
5230
+ }
5231
+ )
5232
+ }
5233
+ ),
5234
+ /* @__PURE__ */ jsx(
5235
+ Translate,
5236
+ {
5237
+ offset: [
5238
+ -keySlotX,
5239
+ -bodyDepth / 2 + wallThickness / 2,
5240
+ bodyHeight / 2 - keySlotHeight / 2 + 0.1
5241
+ ],
5242
+ children: /* @__PURE__ */ jsx(
5243
+ Cuboid,
5244
+ {
5245
+ size: [keySlotWidth, keySlotDepth, keySlotHeight + 0.2]
5246
+ }
5247
+ )
5248
+ }
5249
+ ),
5250
+ /* @__PURE__ */ jsx(
5251
+ Translate,
5252
+ {
5253
+ offset: [
5254
+ keySlotX,
5255
+ -bodyDepth / 2 + wallThickness / 2,
5256
+ bodyHeight / 2 - keySlotHeight / 2 + 0.1
5257
+ ],
5258
+ children: /* @__PURE__ */ jsx(
5259
+ Cuboid,
5260
+ {
5261
+ size: [keySlotWidth, keySlotDepth, keySlotHeight + 0.2]
5262
+ }
5263
+ )
5264
+ }
5265
+ ),
5266
+ Array.from({ length: numPins }).map((_, i) => /* @__PURE__ */ jsx(
5267
+ Translate,
5268
+ {
5269
+ offset: [
5270
+ startX + i * pitch,
5271
+ -bodyDepth / 2 + 0.3,
5272
+ -bodyHeight / 2 + 0.25
5273
+ ],
5274
+ children: /* @__PURE__ */ jsx(Cuboid, { size: [1, 0.8, 0.5] })
5275
+ },
5276
+ `vent_${i}`
5277
+ ))
5278
+ ] }) }) }),
5279
+ showPins && Array.from({ length: numPins }).map((_, i) => /* @__PURE__ */ jsx(Colorize, { color: pinColor, children: /* @__PURE__ */ jsx(Translate, { offset: [startX + i * pitch, 0, pinLength / 2 - 3.4], children: /* @__PURE__ */ jsx(Cuboid, { size: [0.64, 0.64, pinLength] }) }) }, i)),
5280
+ showFootprint && (() => {
5281
+ try {
5282
+ const circuitJson = fp2.string(`jst${numPins}_xh`).circuitJson();
5283
+ const platedHoles = circuitJson.filter(
5284
+ (e) => e.type === "pcb_plated_hole"
5285
+ );
5286
+ return platedHoles.map((hole, i) => /* @__PURE__ */ jsx(
5287
+ FootprintPlatedHole,
5288
+ {
5289
+ hole,
5290
+ isPin1: i === 0
5291
+ },
5292
+ `footprint_${i}`
5293
+ ));
5294
+ } catch {
5295
+ return null;
5296
+ }
5297
+ })()
5298
+ ] });
5299
+ };
5300
+
5172
5301
  // lib/Crystal.tsx
5173
5302
  var getTerminalPoints = ([centerX, centerY], width10, length, chamfer, isPinOne) => {
5174
5303
  const xDirection = Math.sign(centerX);
@@ -5646,9 +5775,9 @@ var SmdPinHeader = ({
5646
5775
  import { mm } from "@tscircuit/mm";
5647
5776
 
5648
5777
  // lib/utils/getPlatedHoleCenters.ts
5649
- import { fp as fp2 } from "@tscircuit/footprinter";
5778
+ import { fp as fp3 } from "@tscircuit/footprinter";
5650
5779
  var getPlatedHoleCenters = (footprint) => {
5651
- const elements = fp2.string(footprint).circuitJson();
5780
+ const elements = fp3.string(footprint).circuitJson();
5652
5781
  return elements.filter(
5653
5782
  (element) => element.type === "pcb_plated_hole" && Number.isFinite(element.x) && Number.isFinite(element.y)
5654
5783
  ).map((element) => ({
@@ -5659,9 +5788,9 @@ var getPlatedHoleCenters = (footprint) => {
5659
5788
  };
5660
5789
 
5661
5790
  // lib/utils/getSmtPadRects.ts
5662
- import { fp as fp3 } from "@tscircuit/footprinter";
5791
+ import { fp as fp4 } from "@tscircuit/footprinter";
5663
5792
  var getSmtPadRects = (footprint) => {
5664
- const elements = fp3.string(footprint).circuitJson();
5793
+ const elements = fp4.string(footprint).circuitJson();
5665
5794
  return elements.filter(
5666
5795
  (element) => element.type === "pcb_smtpad" && element.shape === "rect" && Number.isFinite(element.x) && Number.isFinite(element.y)
5667
5796
  ).map((element) => ({
@@ -6417,7 +6546,7 @@ var SOT563 = ({ fullWidth = 1.94, fullLength: fullLength10 = 1.6 }) => {
6417
6546
  };
6418
6547
 
6419
6548
  // lib/BGA.tsx
6420
- import { fp as fp4 } from "@tscircuit/footprinter";
6549
+ import { fp as fp5 } from "@tscircuit/footprinter";
6421
6550
  var BGA = ({
6422
6551
  packageWidth = 10,
6423
6552
  packageLength = 10,
@@ -6433,7 +6562,7 @@ var BGA = ({
6433
6562
  const bodyHeight = packageHeight - standoffHeight;
6434
6563
  const bodyOffset = standoffHeight + bodyHeight / 2;
6435
6564
  const ballOffset = Math.max(standoffHeight / 2, ballDiameter / 2);
6436
- const ballsSoup = footprintString ? fp4.string(footprintString).circuitJson() : null;
6565
+ const ballsSoup = footprintString ? fp5.string(footprintString).circuitJson() : null;
6437
6566
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
6438
6567
  /* @__PURE__ */ jsx(Translate, { z: bodyOffset, children: /* @__PURE__ */ jsx(Colorize, { color: "#555", children: /* @__PURE__ */ jsx(Cuboid, { size: [packageWidth, packageLength, bodyHeight] }) }) }),
6439
6568
  !footprintString && Array.from({ length: ballRows * ballColumns }).map((_, index) => {
@@ -7024,8 +7153,12 @@ var Footprinter3d = ({ footprint }) => {
7024
7153
  const pinMatch = footprint.match(/jstph2_0mm(\d+)?/);
7025
7154
  const numPins = pinMatch && pinMatch[1] ? pinMatch[1] : "2";
7026
7155
  normalizedFootprint = `jst${numPins}_ph`;
7156
+ } else if (footprint.startsWith("jstxh2_5mm")) {
7157
+ const pinMatch = footprint.match(/jstxh2_5mm(\d+)?/);
7158
+ const numPins = pinMatch && pinMatch[1] ? pinMatch[1] : "2";
7159
+ normalizedFootprint = `jst${numPins}_xh`;
7027
7160
  }
7028
- const fpJson = fp5.string(normalizedFootprint).json();
7161
+ const fpJson = fp6.string(normalizedFootprint).json();
7029
7162
  const colorMatch = footprint.match(/_color\(([^)]+)\)/);
7030
7163
  const color = colorMatch ? colorMatch[1] : void 0;
7031
7164
  const dim = (value, fallback) => {
@@ -7267,6 +7400,9 @@ var Footprinter3d = ({ footprint }) => {
7267
7400
  if (fpJson.ph) {
7268
7401
  return /* @__PURE__ */ jsx(JSTPH2_0mm, { numPins: fpJson.num_pins });
7269
7402
  }
7403
+ if (fpJson.xh) {
7404
+ return /* @__PURE__ */ jsx(JSTXH2_5mm, { numPins: fpJson.num_pins });
7405
+ }
7270
7406
  break;
7271
7407
  case "fpc":
7272
7408
  return /* @__PURE__ */ jsx(