jscad-electronics 0.0.138 → 0.0.140

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,271 @@ 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
+
4780
5045
  // lib/Footprinter3d.tsx
4781
5046
  var Footprinter3d = ({ footprint }) => {
4782
5047
  let normalizedFootprint = footprint;
@@ -4958,6 +5223,26 @@ var Footprinter3d = ({ footprint }) => {
4958
5223
  return /* @__PURE__ */ jsx(JSTZH1_5mm, { numPins: fpJson.num_pins });
4959
5224
  }
4960
5225
  break;
5226
+ case "fpc":
5227
+ return /* @__PURE__ */ jsx(
5228
+ FPC,
5229
+ {
5230
+ pinCount: fpJson.num_pins,
5231
+ pitch: fpJson.p,
5232
+ padWidth: fpJson.pw,
5233
+ padLength: fpJson.pl,
5234
+ staggered: fpJson.staggered,
5235
+ reverse: fpJson.reverse,
5236
+ rowPitch: fpJson.py,
5237
+ topPadLength: fpJson.toppl,
5238
+ bottomPadLength: fpJson.bottompl,
5239
+ mountPadPitchX: fpJson.mpx,
5240
+ mountPadOffsetY: fpJson.mpy,
5241
+ mountTop: fpJson.mounttop,
5242
+ mountPadWidth: fpJson.mpw,
5243
+ mountPadLength: fpJson.mpl
5244
+ }
5245
+ );
4961
5246
  case "soic":
4962
5247
  return /* @__PURE__ */ jsx(
4963
5248
  SOIC,