jscad-electronics 0.0.157 → 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/index.d.ts +10 -1
- package/dist/index.js +508 -364
- package/dist/index.js.map +1 -1
- package/dist/vanilla.js +148 -8
- package/dist/vanilla.js.map +1 -1
- package/package.json +2 -2
package/dist/vanilla.js
CHANGED
|
@@ -52,6 +52,10 @@ var FootprintPad = ({
|
|
|
52
52
|
if (pad.shape === "rect") {
|
|
53
53
|
return /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Translate, { offset: [pad.x, pad.y, -5e-3], children: /* @__PURE__ */ jsx(Cuboid, { size: [pad.width, pad.height, PAD_THICKNESS] }) }) });
|
|
54
54
|
}
|
|
55
|
+
if (pad.shape === "circle") {
|
|
56
|
+
const radius = pad.radius ?? pad.r ?? 0.25;
|
|
57
|
+
return /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Translate, { offset: [pad.x, pad.y, -5e-3], children: /* @__PURE__ */ jsx(Cylinder, { radius, height: PAD_THICKNESS }) }) });
|
|
58
|
+
}
|
|
55
59
|
if (pad.shape === "polygon") {
|
|
56
60
|
const points = (pad.points ?? []).map(
|
|
57
61
|
({ x, y }) => [x, y]
|
|
@@ -180,7 +184,7 @@ var ExtrudedPads = ({
|
|
|
180
184
|
};
|
|
181
185
|
|
|
182
186
|
// lib/Footprinter3d.tsx
|
|
183
|
-
import { fp as
|
|
187
|
+
import { fp as fp6 } from "@tscircuit/footprinter";
|
|
184
188
|
import { mp } from "@tscircuit/modelprinter";
|
|
185
189
|
|
|
186
190
|
// lib/ChipBody.tsx
|
|
@@ -5165,6 +5169,135 @@ var JSTPH2_0mm = ({
|
|
|
5165
5169
|
] });
|
|
5166
5170
|
};
|
|
5167
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
|
+
|
|
5168
5301
|
// lib/Crystal.tsx
|
|
5169
5302
|
var getTerminalPoints = ([centerX, centerY], width10, length, chamfer, isPinOne) => {
|
|
5170
5303
|
const xDirection = Math.sign(centerX);
|
|
@@ -5642,9 +5775,9 @@ var SmdPinHeader = ({
|
|
|
5642
5775
|
import { mm } from "@tscircuit/mm";
|
|
5643
5776
|
|
|
5644
5777
|
// lib/utils/getPlatedHoleCenters.ts
|
|
5645
|
-
import { fp as
|
|
5778
|
+
import { fp as fp3 } from "@tscircuit/footprinter";
|
|
5646
5779
|
var getPlatedHoleCenters = (footprint) => {
|
|
5647
|
-
const elements =
|
|
5780
|
+
const elements = fp3.string(footprint).circuitJson();
|
|
5648
5781
|
return elements.filter(
|
|
5649
5782
|
(element) => element.type === "pcb_plated_hole" && Number.isFinite(element.x) && Number.isFinite(element.y)
|
|
5650
5783
|
).map((element) => ({
|
|
@@ -5655,9 +5788,9 @@ var getPlatedHoleCenters = (footprint) => {
|
|
|
5655
5788
|
};
|
|
5656
5789
|
|
|
5657
5790
|
// lib/utils/getSmtPadRects.ts
|
|
5658
|
-
import { fp as
|
|
5791
|
+
import { fp as fp4 } from "@tscircuit/footprinter";
|
|
5659
5792
|
var getSmtPadRects = (footprint) => {
|
|
5660
|
-
const elements =
|
|
5793
|
+
const elements = fp4.string(footprint).circuitJson();
|
|
5661
5794
|
return elements.filter(
|
|
5662
5795
|
(element) => element.type === "pcb_smtpad" && element.shape === "rect" && Number.isFinite(element.x) && Number.isFinite(element.y)
|
|
5663
5796
|
).map((element) => ({
|
|
@@ -6413,7 +6546,7 @@ var SOT563 = ({ fullWidth = 1.94, fullLength: fullLength10 = 1.6 }) => {
|
|
|
6413
6546
|
};
|
|
6414
6547
|
|
|
6415
6548
|
// lib/BGA.tsx
|
|
6416
|
-
import { fp as
|
|
6549
|
+
import { fp as fp5 } from "@tscircuit/footprinter";
|
|
6417
6550
|
var BGA = ({
|
|
6418
6551
|
packageWidth = 10,
|
|
6419
6552
|
packageLength = 10,
|
|
@@ -6429,7 +6562,7 @@ var BGA = ({
|
|
|
6429
6562
|
const bodyHeight = packageHeight - standoffHeight;
|
|
6430
6563
|
const bodyOffset = standoffHeight + bodyHeight / 2;
|
|
6431
6564
|
const ballOffset = Math.max(standoffHeight / 2, ballDiameter / 2);
|
|
6432
|
-
const ballsSoup = footprintString ?
|
|
6565
|
+
const ballsSoup = footprintString ? fp5.string(footprintString).circuitJson() : null;
|
|
6433
6566
|
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
6434
6567
|
/* @__PURE__ */ jsx(Translate, { z: bodyOffset, children: /* @__PURE__ */ jsx(Colorize, { color: "#555", children: /* @__PURE__ */ jsx(Cuboid, { size: [packageWidth, packageLength, bodyHeight] }) }) }),
|
|
6435
6568
|
!footprintString && Array.from({ length: ballRows * ballColumns }).map((_, index) => {
|
|
@@ -7020,8 +7153,12 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
7020
7153
|
const pinMatch = footprint.match(/jstph2_0mm(\d+)?/);
|
|
7021
7154
|
const numPins = pinMatch && pinMatch[1] ? pinMatch[1] : "2";
|
|
7022
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`;
|
|
7023
7160
|
}
|
|
7024
|
-
const fpJson =
|
|
7161
|
+
const fpJson = fp6.string(normalizedFootprint).json();
|
|
7025
7162
|
const colorMatch = footprint.match(/_color\(([^)]+)\)/);
|
|
7026
7163
|
const color = colorMatch ? colorMatch[1] : void 0;
|
|
7027
7164
|
const dim = (value, fallback) => {
|
|
@@ -7263,6 +7400,9 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
7263
7400
|
if (fpJson.ph) {
|
|
7264
7401
|
return /* @__PURE__ */ jsx(JSTPH2_0mm, { numPins: fpJson.num_pins });
|
|
7265
7402
|
}
|
|
7403
|
+
if (fpJson.xh) {
|
|
7404
|
+
return /* @__PURE__ */ jsx(JSTXH2_5mm, { numPins: fpJson.num_pins });
|
|
7405
|
+
}
|
|
7266
7406
|
break;
|
|
7267
7407
|
case "fpc":
|
|
7268
7408
|
return /* @__PURE__ */ jsx(
|