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/index.js
CHANGED
|
@@ -18947,13 +18947,36 @@ var isPolarizedCapacitorComponent = (betterEasy) => {
|
|
|
18947
18947
|
return polarizedCapacitorMetadataPattern.test(metadata) || betterEasy.dataStr.shape.some((shape) => shape.type === "ARC");
|
|
18948
18948
|
};
|
|
18949
18949
|
|
|
18950
|
+
// lib/websafe/convert-to-typescript-component/category-value-contains-crystal.ts
|
|
18951
|
+
var categoryValueContainsCrystal = (value) => {
|
|
18952
|
+
if (typeof value === "string") {
|
|
18953
|
+
return /^crystals?$/i.test(value.trim());
|
|
18954
|
+
}
|
|
18955
|
+
if (Array.isArray(value)) {
|
|
18956
|
+
return value.some(categoryValueContainsCrystal);
|
|
18957
|
+
}
|
|
18958
|
+
if (value && typeof value === "object") {
|
|
18959
|
+
return Object.values(value).some(categoryValueContainsCrystal);
|
|
18960
|
+
}
|
|
18961
|
+
return false;
|
|
18962
|
+
};
|
|
18963
|
+
|
|
18950
18964
|
// lib/websafe/convert-to-typescript-component/is-crystal-component.ts
|
|
18951
18965
|
var frequencyPattern = /^\d+(?:\.\d+)?\s*(?:Hz|kHz|MHz|GHz)$/i;
|
|
18952
18966
|
var isCrystalComponent = (betterEasy) => {
|
|
18953
18967
|
const componentParameters = betterEasy.dataStr.head.c_para;
|
|
18954
18968
|
const packageName = componentParameters.package;
|
|
18955
18969
|
const value = componentParameters.Value;
|
|
18956
|
-
|
|
18970
|
+
const hasCrystalCategory = [
|
|
18971
|
+
betterEasy.tags,
|
|
18972
|
+
componentParameters.category,
|
|
18973
|
+
componentParameters.Category,
|
|
18974
|
+
componentParameters["LCSC Category"],
|
|
18975
|
+
componentParameters["JLCPCB Category"],
|
|
18976
|
+
betterEasy.category
|
|
18977
|
+
].some(categoryValueContainsCrystal);
|
|
18978
|
+
const hasCrystalPackageAndPrefix = componentParameters.pre === "X?" && packageName?.toUpperCase().startsWith("CRYSTAL-") === true;
|
|
18979
|
+
return (hasCrystalCategory || hasCrystalPackageAndPrefix) && typeof value === "string" && frequencyPattern.test(value.trim());
|
|
18957
18980
|
};
|
|
18958
18981
|
|
|
18959
18982
|
// lib/websafe/convert-to-typescript-component/is-dip-switch-category-component.ts
|
|
@@ -19118,7 +19141,9 @@ var getGeneratedComponentType = (betterEasy, pinCount) => {
|
|
|
19118
19141
|
if (isCapacitorComponent(betterEasy)) return "capacitor";
|
|
19119
19142
|
if (isResistorComponent(betterEasy) && pinCount === 2) return "resistor";
|
|
19120
19143
|
if (isInductorComponent(betterEasy) && pinCount === 2) return "inductor";
|
|
19121
|
-
if (isCrystalComponent(betterEasy))
|
|
19144
|
+
if (isCrystalComponent(betterEasy) && (pinCount === 2 || pinCount === 4)) {
|
|
19145
|
+
return "crystal";
|
|
19146
|
+
}
|
|
19122
19147
|
if (isMicroUsbConnectorComponent(betterEasy)) return "connector";
|
|
19123
19148
|
return "chip";
|
|
19124
19149
|
};
|