easyeda 0.0.384 → 0.0.385
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/browser/index.js +27 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +27 -2
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +28 -3
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -22528,13 +22528,36 @@ var isPolarizedCapacitorComponent = (betterEasy) => {
|
|
|
22528
22528
|
return polarizedCapacitorMetadataPattern.test(metadata) || betterEasy.dataStr.shape.some((shape) => shape.type === "ARC");
|
|
22529
22529
|
};
|
|
22530
22530
|
|
|
22531
|
+
// lib/websafe/convert-to-typescript-component/category-value-contains-crystal.ts
|
|
22532
|
+
var categoryValueContainsCrystal = (value) => {
|
|
22533
|
+
if (typeof value === "string") {
|
|
22534
|
+
return /^crystals?$/i.test(value.trim());
|
|
22535
|
+
}
|
|
22536
|
+
if (Array.isArray(value)) {
|
|
22537
|
+
return value.some(categoryValueContainsCrystal);
|
|
22538
|
+
}
|
|
22539
|
+
if (value && typeof value === "object") {
|
|
22540
|
+
return Object.values(value).some(categoryValueContainsCrystal);
|
|
22541
|
+
}
|
|
22542
|
+
return false;
|
|
22543
|
+
};
|
|
22544
|
+
|
|
22531
22545
|
// lib/websafe/convert-to-typescript-component/is-crystal-component.ts
|
|
22532
22546
|
var frequencyPattern = /^\d+(?:\.\d+)?\s*(?:Hz|kHz|MHz|GHz)$/i;
|
|
22533
22547
|
var isCrystalComponent = (betterEasy) => {
|
|
22534
22548
|
const componentParameters = betterEasy.dataStr.head.c_para;
|
|
22535
22549
|
const packageName = componentParameters.package;
|
|
22536
22550
|
const value = componentParameters.Value;
|
|
22537
|
-
|
|
22551
|
+
const hasCrystalCategory = [
|
|
22552
|
+
betterEasy.tags,
|
|
22553
|
+
componentParameters.category,
|
|
22554
|
+
componentParameters.Category,
|
|
22555
|
+
componentParameters["LCSC Category"],
|
|
22556
|
+
componentParameters["JLCPCB Category"],
|
|
22557
|
+
betterEasy.category
|
|
22558
|
+
].some(categoryValueContainsCrystal);
|
|
22559
|
+
const hasCrystalPackageAndPrefix = componentParameters.pre === "X?" && packageName?.toUpperCase().startsWith("CRYSTAL-") === true;
|
|
22560
|
+
return (hasCrystalCategory || hasCrystalPackageAndPrefix) && typeof value === "string" && frequencyPattern.test(value.trim());
|
|
22538
22561
|
};
|
|
22539
22562
|
|
|
22540
22563
|
// lib/websafe/convert-to-typescript-component/is-dip-switch-category-component.ts
|
|
@@ -22699,7 +22722,9 @@ var getGeneratedComponentType = (betterEasy, pinCount) => {
|
|
|
22699
22722
|
if (isCapacitorComponent(betterEasy)) return "capacitor";
|
|
22700
22723
|
if (isResistorComponent(betterEasy) && pinCount === 2) return "resistor";
|
|
22701
22724
|
if (isInductorComponent(betterEasy) && pinCount === 2) return "inductor";
|
|
22702
|
-
if (isCrystalComponent(betterEasy))
|
|
22725
|
+
if (isCrystalComponent(betterEasy) && (pinCount === 2 || pinCount === 4)) {
|
|
22726
|
+
return "crystal";
|
|
22727
|
+
}
|
|
22703
22728
|
if (isMicroUsbConnectorComponent(betterEasy)) return "connector";
|
|
22704
22729
|
return "chip";
|
|
22705
22730
|
};
|