@tscircuit/parts-engine 0.0.28 → 0.0.30

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.js CHANGED
@@ -11415,6 +11415,32 @@ var getFetchWithEasyEdaProxy = ({
11415
11415
  };
11416
11416
  };
11417
11417
 
11418
+ // lib/jlc-parts-engine/get-jst-connector-search-config.ts
11419
+ var jstConnectorSearchConfigByStandard = {
11420
+ jst_sh: {
11421
+ pitchMm: 1,
11422
+ compatibleReferenceSeries: ["SH", "SR/SZ"]
11423
+ },
11424
+ jst_gh: { pitchMm: 1.25, compatibleReferenceSeries: ["GH"] },
11425
+ jst_zh: { pitchMm: 1.5, compatibleReferenceSeries: ["ZH"] },
11426
+ jst_ph: { pitchMm: 2, compatibleReferenceSeries: ["PH"] },
11427
+ jst_xh: { pitchMm: 2.5, compatibleReferenceSeries: ["XH"] },
11428
+ jst_vh: { pitchMm: 3.96, compatibleReferenceSeries: ["VH"] }
11429
+ };
11430
+ var getJstConnectorSearchConfig = (standard) => {
11431
+ if (!standard || !(standard in jstConnectorSearchConfigByStandard)) {
11432
+ return void 0;
11433
+ }
11434
+ return jstConnectorSearchConfigByStandard[standard];
11435
+ };
11436
+ var hasPcbPins = (attributes) => {
11437
+ if (typeof attributes === "string") {
11438
+ return attributes.includes('"Pins Structure"');
11439
+ }
11440
+ return Boolean(attributes && Object.hasOwn(attributes, "Pins Structure"));
11441
+ };
11442
+ var isCompatiblePcbMountJstConnector = (connector, compatibleReferenceSeries) => compatibleReferenceSeries.includes(connector.reference_series ?? "") && hasPcbPins(connector.attributes);
11443
+
11418
11444
  // lib/jlc-parts-engine/get-pin-header-search-params.ts
11419
11445
  var parseMillimeters = (value) => {
11420
11446
  if (typeof value === "number" && Number.isFinite(value)) return value;
@@ -11624,6 +11650,24 @@ var JlcPcbPartsEngine = class {
11624
11650
  return {
11625
11651
  jlcpcb: withBasicPartPreference(usb_c_connectors).map((c) => `C${c.lcsc}`).slice(0, 3)
11626
11652
  };
11653
+ } else if (sourceComponent.type === "source_component" && sourceComponent.ftype === "simple_connector") {
11654
+ const searchConfig = getJstConnectorSearchConfig(sourceComponent.standard);
11655
+ if (!searchConfig || !sourceComponent.pin_count) {
11656
+ return {};
11657
+ }
11658
+ const { jst_connectors } = await getJlcPartsCached("jst_connectors", {
11659
+ pitch_mm: searchConfig.pitchMm,
11660
+ num_pins: sourceComponent.pin_count
11661
+ });
11662
+ const compatiblePcbMountConnectors = jst_connectors?.filter(
11663
+ (connector) => isCompatiblePcbMountJstConnector(
11664
+ connector,
11665
+ searchConfig.compatibleReferenceSeries
11666
+ )
11667
+ );
11668
+ return {
11669
+ jlcpcb: withBasicPartPreference(compatiblePcbMountConnectors).map((connector) => `C${connector.lcsc}`).slice(0, 3)
11670
+ };
11627
11671
  }
11628
11672
  return {};
11629
11673
  }