jscad-electronics 0.0.139 → 0.0.141

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
@@ -4777,6 +4777,343 @@ var JSTZH1_5mm = ({
4777
4777
  ] });
4778
4778
  };
4779
4779
 
4780
+ // lib/FPC.tsx
4781
+ var HOUSING_COLOR = "#303339";
4782
+ var HOUSING_SHADOW = "#1f2227";
4783
+ var ACTUATOR_COLOR = "#eee8d8";
4784
+ var ACTUATOR_HIGHLIGHT = "#f8f3e7";
4785
+ var TIN_COLOR = "#b7bdc2";
4786
+ var TIN_HIGHLIGHT = "#d2d6d9";
4787
+ var HOLD_DOWN_COLOR = "#767d82";
4788
+ var HOLD_DOWN_HIGHLIGHT = "#9ba1a5";
4789
+ var FPC = ({
4790
+ pinCount = 12,
4791
+ pitch = 0.5,
4792
+ padWidth = 0.3,
4793
+ padLength = 1.25,
4794
+ staggered = false,
4795
+ reverse = false,
4796
+ rowPitch = 2.4,
4797
+ topPadLength = padLength,
4798
+ bottomPadLength = padLength,
4799
+ mountPadPitchX,
4800
+ mountPadOffsetY = 2.575,
4801
+ mountTop = false,
4802
+ mountPadWidth = 2,
4803
+ mountPadLength = 2.5
4804
+ }) => {
4805
+ const contactSpan = Math.max((pinCount - 1) * pitch, pitch);
4806
+ const contactStartX = -contactSpan / 2;
4807
+ const resolvedMountPitch = mountPadPitchX ?? contactSpan + (staggered ? 3.5 : 3.38);
4808
+ const mountY = mountPadOffsetY === 0 ? 0 : (mountTop ? 1 : -1) * mountPadOffsetY;
4809
+ const contactRows = Array.from({ length: pinCount }, (_, index) => {
4810
+ const isUpperRow = staggered && index % 2 === 1 !== reverse;
4811
+ const y = staggered ? isUpperRow ? rowPitch / 2 : -rowPitch / 2 : 0;
4812
+ const length = isUpperRow ? topPadLength : bottomPadLength;
4813
+ return {
4814
+ index,
4815
+ x: contactStartX + index * pitch,
4816
+ y,
4817
+ length
4818
+ };
4819
+ });
4820
+ const contactMaxY = Math.max(
4821
+ ...contactRows.map((contact) => contact.y + contact.length / 2)
4822
+ );
4823
+ const contactMinY = Math.min(
4824
+ ...contactRows.map((contact) => contact.y - contact.length / 2)
4825
+ );
4826
+ const mountingMinY = mountY - mountPadLength / 2;
4827
+ const mountingMaxY = mountY + mountPadLength / 2;
4828
+ const signalSideY = mountTop ? contactMinY : contactMaxY;
4829
+ const cableSideY = mountTop ? Math.max(mountingMaxY, contactMaxY) + 0.67 : Math.min(mountingMinY, contactMinY) - 0.67;
4830
+ const directionToSignal = mountTop ? -1 : 1;
4831
+ const housingSignalY = signalSideY - directionToSignal * Math.max(padLength * 0.86, 1.05);
4832
+ const housingCableY = cableSideY + directionToSignal * 0.22;
4833
+ const housingDepth = Math.abs(housingSignalY - housingCableY);
4834
+ const housingCenterY = (housingSignalY + housingCableY) / 2;
4835
+ const cableEdgeY = housingCableY - directionToSignal * 0.01;
4836
+ const bodyWidth = Math.max(
4837
+ contactSpan + 4.9,
4838
+ resolvedMountPitch + mountPadWidth * 0.76
4839
+ );
4840
+ const openingWidth = Math.min(bodyWidth - 2.3, contactSpan + 1.1);
4841
+ const housingBaseHeight = 0.3;
4842
+ const housingHeight = 1.42;
4843
+ const overallHeight = 2;
4844
+ const throatDepth = Math.min(0.92, housingDepth * 0.28);
4845
+ const throatCenterY = cableEdgeY + directionToSignal * (throatDepth / 2 - 0.04);
4846
+ const throatHeight = 1.6;
4847
+ const throatCenterZ = 1.1;
4848
+ const actuatorDepth = Math.max(housingDepth - 0.78, 1.5);
4849
+ const actuatorCenterY = cableEdgeY + directionToSignal * (actuatorDepth / 2 + 0.68);
4850
+ const actuatorWidth = bodyWidth - 0.72;
4851
+ const actuatorHeight = 0.34;
4852
+ const actuatorCenterZ = overallHeight - actuatorHeight / 2;
4853
+ const hingeY = cableEdgeY + directionToSignal * Math.min(0.68, housingDepth * 0.22);
4854
+ const hingeZ = 1.48;
4855
+ const terminalWidth = Math.max(padWidth * 0.82, 0.15);
4856
+ const terminalOuterY = signalSideY;
4857
+ const terminalLength = Math.abs(terminalOuterY - housingSignalY);
4858
+ const terminalCenterY = (terminalOuterY + housingSignalY) / 2;
4859
+ const springLength = Math.max(throatDepth * 0.8, 0.5);
4860
+ const springCenterY = cableEdgeY + directionToSignal * (springLength / 2 + 0.08);
4861
+ const endClipX = resolvedMountPitch / 2;
4862
+ const clipHeight = 0.75;
4863
+ const clipWallX = bodyWidth / 2 - 0.04;
4864
+ const clipCapX = bodyWidth / 2 - 0.23;
4865
+ const sideBossX = bodyWidth / 2 - 0.32;
4866
+ const sideBossWidth = 0.68;
4867
+ return /* @__PURE__ */ jsxs(Fragment2, { children: [
4868
+ [-1, 1].map((direction) => /* @__PURE__ */ jsx(
4869
+ Cuboid,
4870
+ {
4871
+ color: TIN_COLOR,
4872
+ center: [direction * endClipX, mountY, 0.07],
4873
+ size: [mountPadWidth, mountPadLength, 0.14]
4874
+ },
4875
+ `mount-pad:${direction}`
4876
+ )),
4877
+ contactRows.map((contact) => /* @__PURE__ */ jsx(
4878
+ Cuboid,
4879
+ {
4880
+ color: TIN_COLOR,
4881
+ center: [contact.x, terminalCenterY, 0.065],
4882
+ size: [terminalWidth, terminalLength, 0.13]
4883
+ },
4884
+ `terminal:${contact.index}`
4885
+ )),
4886
+ /* @__PURE__ */ jsx(
4887
+ RoundedCuboid,
4888
+ {
4889
+ color: HOUSING_SHADOW,
4890
+ center: [0, housingCenterY, housingBaseHeight / 2],
4891
+ size: [bodyWidth, housingDepth, housingBaseHeight],
4892
+ roundRadius: 0.1
4893
+ }
4894
+ ),
4895
+ /* @__PURE__ */ jsx(Colorize, { color: HOUSING_COLOR, children: /* @__PURE__ */ jsxs(Subtract, { children: [
4896
+ /* @__PURE__ */ jsx(
4897
+ RoundedCuboid,
4898
+ {
4899
+ center: [0, housingCenterY, housingBaseHeight + housingHeight / 2],
4900
+ size: [bodyWidth - 0.2, housingDepth - 0.12, housingHeight],
4901
+ roundRadius: 0.14
4902
+ }
4903
+ ),
4904
+ /* @__PURE__ */ jsx(
4905
+ Cuboid,
4906
+ {
4907
+ center: [0, throatCenterY, throatCenterZ],
4908
+ size: [openingWidth, throatDepth, throatHeight]
4909
+ }
4910
+ ),
4911
+ /* @__PURE__ */ jsx(
4912
+ Cuboid,
4913
+ {
4914
+ center: [0, actuatorCenterY, overallHeight - actuatorHeight * 0.72],
4915
+ size: [actuatorWidth - 0.32, actuatorDepth - 0.16, actuatorHeight]
4916
+ }
4917
+ )
4918
+ ] }) }),
4919
+ contactRows.map((contact) => /* @__PURE__ */ jsx(
4920
+ RoundedCuboid,
4921
+ {
4922
+ color: TIN_HIGHLIGHT,
4923
+ center: [contact.x, springCenterY, housingBaseHeight + 0.82],
4924
+ size: [terminalWidth * 0.82, springLength, 0.14],
4925
+ roundRadius: 0.035
4926
+ },
4927
+ `spring:${contact.index}`
4928
+ )),
4929
+ contactRows.map((contact) => /* @__PURE__ */ jsx(
4930
+ Cuboid,
4931
+ {
4932
+ color: TIN_COLOR,
4933
+ center: [
4934
+ contact.x,
4935
+ housingSignalY - directionToSignal * 0.03,
4936
+ housingBaseHeight + 0.32
4937
+ ],
4938
+ size: [terminalWidth, 0.13, 0.62]
4939
+ },
4940
+ `terminal-rise:${contact.index}`
4941
+ )),
4942
+ /* @__PURE__ */ jsx(
4943
+ Cuboid,
4944
+ {
4945
+ color: HOUSING_SHADOW,
4946
+ center: [
4947
+ 0,
4948
+ cableEdgeY + directionToSignal * 0.1,
4949
+ housingBaseHeight + 0.71
4950
+ ],
4951
+ size: [openingWidth + 0.18, 0.16, 0.8]
4952
+ }
4953
+ ),
4954
+ /* @__PURE__ */ jsx(
4955
+ RoundedCuboid,
4956
+ {
4957
+ color: ACTUATOR_COLOR,
4958
+ center: [0, actuatorCenterY, actuatorCenterZ],
4959
+ size: [actuatorWidth, actuatorDepth, actuatorHeight],
4960
+ roundRadius: 0.11
4961
+ }
4962
+ ),
4963
+ /* @__PURE__ */ jsx(
4964
+ Cuboid,
4965
+ {
4966
+ color: ACTUATOR_HIGHLIGHT,
4967
+ center: [
4968
+ 0,
4969
+ actuatorCenterY - directionToSignal * (actuatorDepth / 2 - 0.12),
4970
+ overallHeight - 0.035
4971
+ ],
4972
+ size: [actuatorWidth - 0.36, 0.24, 0.07]
4973
+ }
4974
+ ),
4975
+ [-1, 1].map((direction) => /* @__PURE__ */ jsx(
4976
+ RoundedCuboid,
4977
+ {
4978
+ color: ACTUATOR_COLOR,
4979
+ center: [direction * sideBossX, hingeY, hingeZ],
4980
+ size: [sideBossWidth, 0.92, 0.72],
4981
+ roundRadius: 0.1
4982
+ },
4983
+ `actuator-ear:${direction}`
4984
+ )),
4985
+ [-1, 1].map((direction) => /* @__PURE__ */ jsx(
4986
+ Translate,
4987
+ {
4988
+ x: direction * sideBossX,
4989
+ y: hingeY,
4990
+ z: hingeZ,
4991
+ children: /* @__PURE__ */ jsx(Rotate, { rotation: [0, Math.PI / 2, 0], children: /* @__PURE__ */ jsx(
4992
+ Cylinder,
4993
+ {
4994
+ color: ACTUATOR_HIGHLIGHT,
4995
+ height: sideBossWidth + 0.12,
4996
+ radius: 0.24
4997
+ }
4998
+ ) })
4999
+ },
5000
+ `hinge:${direction}`
5001
+ )),
5002
+ [-1, 1].map((direction) => /* @__PURE__ */ jsx(
5003
+ RoundedCuboid,
5004
+ {
5005
+ color: HOLD_DOWN_COLOR,
5006
+ center: [direction * clipWallX, mountY, clipHeight / 2],
5007
+ size: [0.17, Math.min(mountPadLength * 0.3, 0.7), clipHeight],
5008
+ roundRadius: 0.04
5009
+ },
5010
+ `hold-down-wall:${direction}`
5011
+ )),
5012
+ [-1, 1].map((direction) => /* @__PURE__ */ jsx(
5013
+ RoundedCuboid,
5014
+ {
5015
+ color: HOLD_DOWN_HIGHLIGHT,
5016
+ center: [direction * clipCapX, mountY, clipHeight - 0.05],
5017
+ size: [0.42, Math.min(mountPadLength * 0.3, 0.7), 0.1],
5018
+ roundRadius: 0.035
5019
+ },
5020
+ `hold-down-cap:${direction}`
5021
+ )),
5022
+ /* @__PURE__ */ jsx(
5023
+ Cuboid,
5024
+ {
5025
+ color: HOUSING_SHADOW,
5026
+ center: [0, housingCenterY, 0.025],
5027
+ size: [openingWidth + 0.7, housingDepth * 0.58, 0.05]
5028
+ }
5029
+ ),
5030
+ /* @__PURE__ */ jsx(
5031
+ Cuboid,
5032
+ {
5033
+ color: HOUSING_SHADOW,
5034
+ center: [
5035
+ 0,
5036
+ housingSignalY - directionToSignal * 0.06,
5037
+ housingBaseHeight + 0.82
5038
+ ],
5039
+ size: [openingWidth + 0.4, 0.15, 0.92]
5040
+ }
5041
+ )
5042
+ ] });
5043
+ };
5044
+
5045
+ // lib/SmdPinHeader.tsx
5046
+ var SmdPinHeader = ({
5047
+ numberOfPins,
5048
+ pitch = 2.54,
5049
+ pinThickness = 0.64,
5050
+ bodyWidth = 2.5,
5051
+ bodyHeight = 2.54,
5052
+ standoffHeight = 1.27,
5053
+ matingPinLength = 5.8,
5054
+ tailSpan = 5.08
5055
+ }) => {
5056
+ const xStart = -((numberOfPins - 1) * pitch) / 2;
5057
+ const bodyTop = standoffHeight + bodyHeight;
5058
+ const tailLength = tailSpan / 2;
5059
+ const tipChamferHeight = pinThickness * 0.35;
5060
+ return /* @__PURE__ */ jsx(Fragment2, { children: Array.from({ length: numberOfPins }, (_, index) => {
5061
+ const x = xStart + index * pitch;
5062
+ const tailDirection = index % 2 === 0 ? 1 : -1;
5063
+ const postBodyLength = matingPinLength - tipChamferHeight;
5064
+ const verticalTailLength = standoffHeight - pinThickness / 2;
5065
+ return /* @__PURE__ */ jsxs(Translate, { x, children: [
5066
+ /* @__PURE__ */ jsx(
5067
+ Cuboid,
5068
+ {
5069
+ color: "#222",
5070
+ size: [pitch, bodyWidth, bodyHeight],
5071
+ center: [0, 0, standoffHeight + bodyHeight / 2]
5072
+ }
5073
+ ),
5074
+ /* @__PURE__ */ jsxs(Colorize, { color: "#d4af37", children: [
5075
+ /* @__PURE__ */ jsx(
5076
+ Cuboid,
5077
+ {
5078
+ size: [pinThickness, tailLength, pinThickness],
5079
+ center: [0, tailDirection * (tailLength / 2), pinThickness / 2]
5080
+ }
5081
+ ),
5082
+ /* @__PURE__ */ jsx(
5083
+ Cuboid,
5084
+ {
5085
+ size: [pinThickness, pinThickness, verticalTailLength],
5086
+ center: [0, 0, pinThickness / 2 + verticalTailLength / 2]
5087
+ }
5088
+ ),
5089
+ /* @__PURE__ */ jsx(
5090
+ Cuboid,
5091
+ {
5092
+ size: [pinThickness, pinThickness, postBodyLength],
5093
+ center: [0, 0, bodyTop + postBodyLength / 2]
5094
+ }
5095
+ ),
5096
+ /* @__PURE__ */ jsxs(Hull, { children: [
5097
+ /* @__PURE__ */ jsx(
5098
+ Cuboid,
5099
+ {
5100
+ size: [pinThickness, pinThickness, 0.01],
5101
+ center: [0, 0, bodyTop + postBodyLength]
5102
+ }
5103
+ ),
5104
+ /* @__PURE__ */ jsx(
5105
+ Cuboid,
5106
+ {
5107
+ size: [pinThickness * 0.65, pinThickness * 0.65, 0.01],
5108
+ center: [0, 0, bodyTop + matingPinLength]
5109
+ }
5110
+ )
5111
+ ] })
5112
+ ] })
5113
+ ] }, index);
5114
+ }) });
5115
+ };
5116
+
4780
5117
  // lib/Footprinter3d.tsx
4781
5118
  var Footprinter3d = ({ footprint }) => {
4782
5119
  let normalizedFootprint = footprint;
@@ -4902,6 +5239,15 @@ var Footprinter3d = ({ footprint }) => {
4902
5239
  }
4903
5240
  );
4904
5241
  }
5242
+ case "smdpinheader":
5243
+ return /* @__PURE__ */ jsx(
5244
+ SmdPinHeader,
5245
+ {
5246
+ numberOfPins: fpJson.num_pins,
5247
+ pitch: fpJson.p,
5248
+ bodyWidth: fpJson.bh
5249
+ }
5250
+ );
4905
5251
  case "cap": {
4906
5252
  switch (fpJson.imperial) {
4907
5253
  case "0402":
@@ -4958,6 +5304,26 @@ var Footprinter3d = ({ footprint }) => {
4958
5304
  return /* @__PURE__ */ jsx(JSTZH1_5mm, { numPins: fpJson.num_pins });
4959
5305
  }
4960
5306
  break;
5307
+ case "fpc":
5308
+ return /* @__PURE__ */ jsx(
5309
+ FPC,
5310
+ {
5311
+ pinCount: fpJson.num_pins,
5312
+ pitch: fpJson.p,
5313
+ padWidth: fpJson.pw,
5314
+ padLength: fpJson.pl,
5315
+ staggered: fpJson.staggered,
5316
+ reverse: fpJson.reverse,
5317
+ rowPitch: fpJson.py,
5318
+ topPadLength: fpJson.toppl,
5319
+ bottomPadLength: fpJson.bottompl,
5320
+ mountPadPitchX: fpJson.mpx,
5321
+ mountPadOffsetY: fpJson.mpy,
5322
+ mountTop: fpJson.mounttop,
5323
+ mountPadWidth: fpJson.mpw,
5324
+ mountPadLength: fpJson.mpl
5325
+ }
5326
+ );
4961
5327
  case "soic":
4962
5328
  return /* @__PURE__ */ jsx(
4963
5329
  SOIC,