jscad-electronics 0.0.141 → 0.0.143
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 +50 -1
- package/dist/index.js +456 -93
- package/dist/index.js.map +1 -1
- package/dist/vanilla.js +344 -2
- package/dist/vanilla.js.map +1 -1
- package/package.json +2 -2
package/dist/vanilla.js
CHANGED
|
@@ -5114,6 +5114,322 @@ var SmdPinHeader = ({
|
|
|
5114
5114
|
}) });
|
|
5115
5115
|
};
|
|
5116
5116
|
|
|
5117
|
+
// lib/Led5050.tsx
|
|
5118
|
+
var Led5050 = ({
|
|
5119
|
+
color = "#ffff00",
|
|
5120
|
+
bodyColor = "#ffffff",
|
|
5121
|
+
leadColor = "#dedede"
|
|
5122
|
+
}) => {
|
|
5123
|
+
const bodySize = 5;
|
|
5124
|
+
const leadSpan = 5.4;
|
|
5125
|
+
const bodyBottom = 0.2;
|
|
5126
|
+
const bodyHeight = 1.3;
|
|
5127
|
+
const bodyTop = bodyBottom + bodyHeight;
|
|
5128
|
+
const leadLength = 1.4;
|
|
5129
|
+
const leadWidth = 1;
|
|
5130
|
+
const leadThickness = 0.2;
|
|
5131
|
+
const leadCenterX = leadSpan / 2 - leadLength / 2;
|
|
5132
|
+
const lensRadius = 2;
|
|
5133
|
+
const lensHeight = 0.25;
|
|
5134
|
+
const lensTop = 1.55;
|
|
5135
|
+
const cornerCutDepth = 0.3;
|
|
5136
|
+
const leadYPositions = [-1.7, 0, 1.7];
|
|
5137
|
+
const leadSides = [-1, 1];
|
|
5138
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
5139
|
+
leadYPositions.flatMap(
|
|
5140
|
+
(y) => leadSides.map((side) => /* @__PURE__ */ jsx(
|
|
5141
|
+
Cuboid,
|
|
5142
|
+
{
|
|
5143
|
+
color: leadColor,
|
|
5144
|
+
size: [leadLength, leadWidth, leadThickness],
|
|
5145
|
+
center: [side * leadCenterX, y, leadThickness / 2]
|
|
5146
|
+
},
|
|
5147
|
+
`${side}-${y}`
|
|
5148
|
+
))
|
|
5149
|
+
),
|
|
5150
|
+
/* @__PURE__ */ jsx(Colorize, { color: bodyColor, children: /* @__PURE__ */ jsxs(Subtract, { children: [
|
|
5151
|
+
/* @__PURE__ */ jsx(
|
|
5152
|
+
ChipBody,
|
|
5153
|
+
{
|
|
5154
|
+
width: bodySize,
|
|
5155
|
+
length: bodySize,
|
|
5156
|
+
height: bodyHeight,
|
|
5157
|
+
heightAboveSurface: bodyBottom,
|
|
5158
|
+
center: { x: 0, y: 0, z: 0 },
|
|
5159
|
+
color: bodyColor,
|
|
5160
|
+
taperRatio: 0.036,
|
|
5161
|
+
straightHeightRatio: 0.01,
|
|
5162
|
+
includeNotch: false
|
|
5163
|
+
}
|
|
5164
|
+
),
|
|
5165
|
+
/* @__PURE__ */ jsx(
|
|
5166
|
+
Cylinder,
|
|
5167
|
+
{
|
|
5168
|
+
radius: lensRadius,
|
|
5169
|
+
height: lensHeight,
|
|
5170
|
+
center: [0, 0, bodyTop - lensHeight / 2]
|
|
5171
|
+
}
|
|
5172
|
+
),
|
|
5173
|
+
/* @__PURE__ */ jsx(
|
|
5174
|
+
Translate,
|
|
5175
|
+
{
|
|
5176
|
+
offset: [
|
|
5177
|
+
-bodySize / 2,
|
|
5178
|
+
bodySize / 2,
|
|
5179
|
+
bodyTop - cornerCutDepth / 2 + 5e-3
|
|
5180
|
+
],
|
|
5181
|
+
children: /* @__PURE__ */ jsx(Rotate, { rotation: [0, 0, Math.PI / 4], children: /* @__PURE__ */ jsx(Cuboid, { size: [0.9, 0.9, cornerCutDepth + 0.01] }) })
|
|
5182
|
+
}
|
|
5183
|
+
)
|
|
5184
|
+
] }) }),
|
|
5185
|
+
/* @__PURE__ */ jsx(
|
|
5186
|
+
Cylinder,
|
|
5187
|
+
{
|
|
5188
|
+
color,
|
|
5189
|
+
radius: lensRadius,
|
|
5190
|
+
height: lensHeight,
|
|
5191
|
+
center: [0, 0, lensTop - lensHeight / 2]
|
|
5192
|
+
}
|
|
5193
|
+
)
|
|
5194
|
+
] });
|
|
5195
|
+
};
|
|
5196
|
+
|
|
5197
|
+
// lib/RJ45.tsx
|
|
5198
|
+
var range2 = (length) => Array.from({ length }, (_, index) => index);
|
|
5199
|
+
var RJ45 = ({
|
|
5200
|
+
bodyWidth = 16.26,
|
|
5201
|
+
bodyDepth = 15.88,
|
|
5202
|
+
bodyHeight = 13.5,
|
|
5203
|
+
bodyCenterY = -0.96,
|
|
5204
|
+
ledPins = false,
|
|
5205
|
+
firstPinLeft = false,
|
|
5206
|
+
firstPinTop = false,
|
|
5207
|
+
signalPitch = 1.02,
|
|
5208
|
+
signalRowPitch = 1.78,
|
|
5209
|
+
signalHoleDiameter = 0.9144,
|
|
5210
|
+
shieldPinX = 8.13,
|
|
5211
|
+
shieldPinY = 0.13,
|
|
5212
|
+
shieldHoleDiameter = 1.8,
|
|
5213
|
+
locatorHoleX = 6.35,
|
|
5214
|
+
locatorHoleY = -3.43,
|
|
5215
|
+
locatorHoleDiameter = 3.25,
|
|
5216
|
+
ledPinX = 4.57,
|
|
5217
|
+
ledPinPitch = 2.29,
|
|
5218
|
+
ledPinY = 5.7,
|
|
5219
|
+
openingDirection,
|
|
5220
|
+
shellColor = "#b7bdc2",
|
|
5221
|
+
housingColor = "#20242a",
|
|
5222
|
+
contactColor = "#d6a928"
|
|
5223
|
+
}) => {
|
|
5224
|
+
const frontDirection = openingDirection ?? (bodyCenterY > 0 ? 1 : -1);
|
|
5225
|
+
const frontY = bodyCenterY + frontDirection * bodyDepth / 2;
|
|
5226
|
+
const shellThickness = Math.min(0.38, bodyWidth * 0.024);
|
|
5227
|
+
const openingWidth = Math.max(bodyWidth - 2.5, bodyWidth * 0.72);
|
|
5228
|
+
const openingHeight = Math.min(bodyHeight - 2.4, 9.6);
|
|
5229
|
+
const openingCenterZ = 1.3 + openingHeight / 2;
|
|
5230
|
+
const cavityDepth = Math.min(4.4, bodyDepth * 0.34);
|
|
5231
|
+
const cavityCenterY = frontY - frontDirection * cavityDepth / 2;
|
|
5232
|
+
const backWallY = frontY - frontDirection * (cavityDepth + shellThickness * 0.7);
|
|
5233
|
+
const signalLeadRadius = Math.max(
|
|
5234
|
+
0.22,
|
|
5235
|
+
Math.min(signalHoleDiameter * 0.36, 0.38)
|
|
5236
|
+
);
|
|
5237
|
+
const signalPinPositions = range2(8).map((index) => {
|
|
5238
|
+
const defaultX = (3.5 - index) * signalPitch;
|
|
5239
|
+
const defaultY = index % 2 === 0 ? -signalRowPitch / 2 : signalRowPitch / 2;
|
|
5240
|
+
return {
|
|
5241
|
+
x: firstPinLeft ? -defaultX : defaultX,
|
|
5242
|
+
y: firstPinTop ? -defaultY : defaultY
|
|
5243
|
+
};
|
|
5244
|
+
});
|
|
5245
|
+
const ledPinPositions = [
|
|
5246
|
+
-ledPinX - ledPinPitch,
|
|
5247
|
+
-ledPinX,
|
|
5248
|
+
ledPinX,
|
|
5249
|
+
ledPinX + ledPinPitch
|
|
5250
|
+
];
|
|
5251
|
+
const contactPitch = openingWidth / 10;
|
|
5252
|
+
const contactY = frontY - frontDirection * Math.max(cavityDepth * 0.48, 1.2);
|
|
5253
|
+
const contactZ = openingCenterZ + openingHeight * 0.18;
|
|
5254
|
+
const frontLipY = frontY + frontDirection * shellThickness * 0.2;
|
|
5255
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
5256
|
+
/* @__PURE__ */ jsxs(Colorize, { color: shellColor, children: [
|
|
5257
|
+
/* @__PURE__ */ jsxs(Subtract, { children: [
|
|
5258
|
+
/* @__PURE__ */ jsx(
|
|
5259
|
+
Cuboid,
|
|
5260
|
+
{
|
|
5261
|
+
center: [0, bodyCenterY, bodyHeight / 2],
|
|
5262
|
+
size: [bodyWidth, bodyDepth, bodyHeight]
|
|
5263
|
+
}
|
|
5264
|
+
),
|
|
5265
|
+
/* @__PURE__ */ jsx(
|
|
5266
|
+
Cuboid,
|
|
5267
|
+
{
|
|
5268
|
+
center: [0, cavityCenterY, openingCenterZ],
|
|
5269
|
+
size: [
|
|
5270
|
+
openingWidth,
|
|
5271
|
+
cavityDepth + shellThickness * 2,
|
|
5272
|
+
openingHeight
|
|
5273
|
+
]
|
|
5274
|
+
}
|
|
5275
|
+
)
|
|
5276
|
+
] }),
|
|
5277
|
+
/* @__PURE__ */ jsx(
|
|
5278
|
+
Cuboid,
|
|
5279
|
+
{
|
|
5280
|
+
center: [0, frontLipY, 0.72],
|
|
5281
|
+
size: [openingWidth + 0.5, shellThickness * 1.25, 1.05]
|
|
5282
|
+
}
|
|
5283
|
+
),
|
|
5284
|
+
[-1, 1].map((direction) => /* @__PURE__ */ jsx(
|
|
5285
|
+
Cuboid,
|
|
5286
|
+
{
|
|
5287
|
+
center: [direction * shieldPinX, shieldPinY, 0.25],
|
|
5288
|
+
size: [
|
|
5289
|
+
Math.max(shieldHoleDiameter * 0.46, 0.65),
|
|
5290
|
+
Math.max(shieldHoleDiameter * 0.72, 1.1),
|
|
5291
|
+
3.4
|
|
5292
|
+
]
|
|
5293
|
+
},
|
|
5294
|
+
`shield-tab:${direction}`
|
|
5295
|
+
)),
|
|
5296
|
+
[-1, 1].map((direction) => /* @__PURE__ */ jsx(
|
|
5297
|
+
Cuboid,
|
|
5298
|
+
{
|
|
5299
|
+
center: [
|
|
5300
|
+
direction * bodyWidth * 0.24,
|
|
5301
|
+
bodyCenterY - frontDirection * bodyDepth * 0.08,
|
|
5302
|
+
bodyHeight + 0.04
|
|
5303
|
+
],
|
|
5304
|
+
size: [bodyWidth * 0.22, bodyDepth * 0.42, 0.1]
|
|
5305
|
+
},
|
|
5306
|
+
`top-seam:${direction}`
|
|
5307
|
+
))
|
|
5308
|
+
] }),
|
|
5309
|
+
/* @__PURE__ */ jsxs(Colorize, { color: housingColor, children: [
|
|
5310
|
+
/* @__PURE__ */ jsxs(Subtract, { children: [
|
|
5311
|
+
/* @__PURE__ */ jsx(
|
|
5312
|
+
RoundedCuboid,
|
|
5313
|
+
{
|
|
5314
|
+
center: [0, cavityCenterY, openingCenterZ],
|
|
5315
|
+
size: [
|
|
5316
|
+
openingWidth - 0.2,
|
|
5317
|
+
cavityDepth + shellThickness * 0.5,
|
|
5318
|
+
openingHeight - 0.2
|
|
5319
|
+
],
|
|
5320
|
+
roundRadius: 0.22
|
|
5321
|
+
}
|
|
5322
|
+
),
|
|
5323
|
+
/* @__PURE__ */ jsx(
|
|
5324
|
+
Cuboid,
|
|
5325
|
+
{
|
|
5326
|
+
center: [
|
|
5327
|
+
0,
|
|
5328
|
+
cavityCenterY - frontDirection * shellThickness * 0.2,
|
|
5329
|
+
openingCenterZ - 0.05
|
|
5330
|
+
],
|
|
5331
|
+
size: [
|
|
5332
|
+
openingWidth - 1.25,
|
|
5333
|
+
cavityDepth + shellThickness,
|
|
5334
|
+
openingHeight - 1.35
|
|
5335
|
+
]
|
|
5336
|
+
}
|
|
5337
|
+
)
|
|
5338
|
+
] }),
|
|
5339
|
+
/* @__PURE__ */ jsx(
|
|
5340
|
+
Cuboid,
|
|
5341
|
+
{
|
|
5342
|
+
center: [0, backWallY, openingCenterZ],
|
|
5343
|
+
size: [openingWidth - 1.15, shellThickness, openingHeight - 1.25]
|
|
5344
|
+
}
|
|
5345
|
+
),
|
|
5346
|
+
/* @__PURE__ */ jsx(
|
|
5347
|
+
RoundedCuboid,
|
|
5348
|
+
{
|
|
5349
|
+
center: [0, frontY - frontDirection * cavityDepth * 0.28, 1.55],
|
|
5350
|
+
size: [openingWidth - 2.6, cavityDepth * 0.5, 1.15],
|
|
5351
|
+
roundRadius: 0.16
|
|
5352
|
+
}
|
|
5353
|
+
),
|
|
5354
|
+
[-1, 1].map((direction) => /* @__PURE__ */ jsx(
|
|
5355
|
+
Cylinder,
|
|
5356
|
+
{
|
|
5357
|
+
center: [direction * locatorHoleX, locatorHoleY, -0.25],
|
|
5358
|
+
radius: Math.max(locatorHoleDiameter * 0.41, 0.65),
|
|
5359
|
+
height: 2.7
|
|
5360
|
+
},
|
|
5361
|
+
`locator:${direction}`
|
|
5362
|
+
))
|
|
5363
|
+
] }),
|
|
5364
|
+
/* @__PURE__ */ jsxs(Colorize, { color: contactColor, children: [
|
|
5365
|
+
signalPinPositions.map(({ x, y }, index) => /* @__PURE__ */ jsx(
|
|
5366
|
+
Cylinder,
|
|
5367
|
+
{
|
|
5368
|
+
center: [x, y, 0.15],
|
|
5369
|
+
radius: signalLeadRadius,
|
|
5370
|
+
height: 3.1
|
|
5371
|
+
},
|
|
5372
|
+
`signal-lead:${index}`
|
|
5373
|
+
)),
|
|
5374
|
+
range2(8).map((index) => /* @__PURE__ */ jsx(
|
|
5375
|
+
Translate,
|
|
5376
|
+
{
|
|
5377
|
+
offset: [
|
|
5378
|
+
(index - 3.5) * contactPitch,
|
|
5379
|
+
contactY,
|
|
5380
|
+
contactZ + (index % 2 === 0 ? 0.03 : -0.03)
|
|
5381
|
+
],
|
|
5382
|
+
children: /* @__PURE__ */ jsx(Rotate, { rotation: [frontDirection * 0.2, 0, 0], children: /* @__PURE__ */ jsx(
|
|
5383
|
+
RoundedCuboid,
|
|
5384
|
+
{
|
|
5385
|
+
size: [Math.max(contactPitch * 0.28, 0.28), 3.25, 0.16],
|
|
5386
|
+
roundRadius: 0.05
|
|
5387
|
+
}
|
|
5388
|
+
) })
|
|
5389
|
+
},
|
|
5390
|
+
`socket-contact:${index}`
|
|
5391
|
+
)),
|
|
5392
|
+
ledPins && ledPinPositions.map((x, index) => /* @__PURE__ */ jsx(
|
|
5393
|
+
Cylinder,
|
|
5394
|
+
{
|
|
5395
|
+
center: [x, ledPinY, 0.15],
|
|
5396
|
+
radius: signalLeadRadius,
|
|
5397
|
+
height: 3.1
|
|
5398
|
+
},
|
|
5399
|
+
`led-lead:${index}`
|
|
5400
|
+
))
|
|
5401
|
+
] }),
|
|
5402
|
+
ledPins && /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
5403
|
+
/* @__PURE__ */ jsx(
|
|
5404
|
+
RoundedCuboid,
|
|
5405
|
+
{
|
|
5406
|
+
color: "#73b744",
|
|
5407
|
+
center: [
|
|
5408
|
+
-bodyWidth / 2 + 2.05,
|
|
5409
|
+
frontY + frontDirection * shellThickness * 0.35,
|
|
5410
|
+
bodyHeight - 2.05
|
|
5411
|
+
],
|
|
5412
|
+
size: [2.15, shellThickness * 1.55, 1.45],
|
|
5413
|
+
roundRadius: 0.18
|
|
5414
|
+
}
|
|
5415
|
+
),
|
|
5416
|
+
/* @__PURE__ */ jsx(
|
|
5417
|
+
RoundedCuboid,
|
|
5418
|
+
{
|
|
5419
|
+
color: "#e0aa35",
|
|
5420
|
+
center: [
|
|
5421
|
+
bodyWidth / 2 - 2.05,
|
|
5422
|
+
frontY + frontDirection * shellThickness * 0.35,
|
|
5423
|
+
bodyHeight - 2.05
|
|
5424
|
+
],
|
|
5425
|
+
size: [2.15, shellThickness * 1.55, 1.45],
|
|
5426
|
+
roundRadius: 0.18
|
|
5427
|
+
}
|
|
5428
|
+
)
|
|
5429
|
+
] })
|
|
5430
|
+
] });
|
|
5431
|
+
};
|
|
5432
|
+
|
|
5117
5433
|
// lib/Footprinter3d.tsx
|
|
5118
5434
|
var Footprinter3d = ({ footprint }) => {
|
|
5119
5435
|
let normalizedFootprint = footprint;
|
|
@@ -5123,6 +5439,8 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
5123
5439
|
normalizedFootprint = `zh${numPins}`;
|
|
5124
5440
|
}
|
|
5125
5441
|
const fpJson = fp2.string(normalizedFootprint).json();
|
|
5442
|
+
const colorMatch = footprint.match(/_color\(([^)]+)\)/);
|
|
5443
|
+
const color = colorMatch ? colorMatch[1] : void 0;
|
|
5126
5444
|
switch (fpJson.fn) {
|
|
5127
5445
|
case "dip":
|
|
5128
5446
|
return /* @__PURE__ */ jsx(Dip, { numPins: fpJson.num_pins, pitch: fpJson.p, bodyWidth: fpJson.w });
|
|
@@ -5248,6 +5566,8 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
5248
5566
|
bodyWidth: fpJson.bh
|
|
5249
5567
|
}
|
|
5250
5568
|
);
|
|
5569
|
+
case "led5050":
|
|
5570
|
+
return /* @__PURE__ */ jsx(Led5050, { color });
|
|
5251
5571
|
case "cap": {
|
|
5252
5572
|
switch (fpJson.imperial) {
|
|
5253
5573
|
case "0402":
|
|
@@ -5324,6 +5644,30 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
5324
5644
|
mountPadLength: fpJson.mpl
|
|
5325
5645
|
}
|
|
5326
5646
|
);
|
|
5647
|
+
case "rj45":
|
|
5648
|
+
return /* @__PURE__ */ jsx(
|
|
5649
|
+
RJ45,
|
|
5650
|
+
{
|
|
5651
|
+
bodyWidth: fpJson.w,
|
|
5652
|
+
bodyDepth: fpJson.h,
|
|
5653
|
+
bodyCenterY: fpJson.bodyy,
|
|
5654
|
+
ledPins: fpJson.ledpins || fpJson.num_pins === 14,
|
|
5655
|
+
firstPinLeft: fpJson.firstpinleft,
|
|
5656
|
+
firstPinTop: fpJson.firstpintop,
|
|
5657
|
+
signalPitch: fpJson.p,
|
|
5658
|
+
signalRowPitch: fpJson.py,
|
|
5659
|
+
signalHoleDiameter: fpJson.id,
|
|
5660
|
+
shieldPinX: fpJson.shieldx,
|
|
5661
|
+
shieldPinY: fpJson.shieldy,
|
|
5662
|
+
shieldHoleDiameter: fpJson.shieldid,
|
|
5663
|
+
locatorHoleX: fpJson.holex,
|
|
5664
|
+
locatorHoleY: fpJson.holey,
|
|
5665
|
+
locatorHoleDiameter: fpJson.holed,
|
|
5666
|
+
ledPinX: fpJson.ledx,
|
|
5667
|
+
ledPinPitch: fpJson.ledp,
|
|
5668
|
+
ledPinY: fpJson.ledy
|
|
5669
|
+
}
|
|
5670
|
+
);
|
|
5327
5671
|
case "soic":
|
|
5328
5672
|
return /* @__PURE__ */ jsx(
|
|
5329
5673
|
SOIC,
|
|
@@ -5446,8 +5790,6 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
5446
5790
|
);
|
|
5447
5791
|
}
|
|
5448
5792
|
}
|
|
5449
|
-
const colorMatch = footprint.match(/_color\(([^)]+)\)/);
|
|
5450
|
-
const color = colorMatch ? colorMatch[1] : void 0;
|
|
5451
5793
|
switch (fpJson.imperial) {
|
|
5452
5794
|
case "0402":
|
|
5453
5795
|
return /* @__PURE__ */ jsx(A0402, { color });
|