easyeda 0.0.354 → 0.0.356
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 +21 -4
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +22 -5
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -1078,7 +1078,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
|
|
|
1078
1078
|
var package_default = {
|
|
1079
1079
|
name: "easyeda",
|
|
1080
1080
|
type: "module",
|
|
1081
|
-
version: "0.0.
|
|
1081
|
+
version: "0.0.355",
|
|
1082
1082
|
files: [
|
|
1083
1083
|
"dist"
|
|
1084
1084
|
],
|
|
@@ -10080,6 +10080,7 @@ var generateTypescriptComponent = ({
|
|
|
10080
10080
|
supplierPartNumbers,
|
|
10081
10081
|
manufacturerPartNumber,
|
|
10082
10082
|
componentType = "chip",
|
|
10083
|
+
isPolarizedCapacitor = false,
|
|
10083
10084
|
capacitance: capacitance2,
|
|
10084
10085
|
resistance: resistance2,
|
|
10085
10086
|
inductance: inductance2,
|
|
@@ -10129,10 +10130,10 @@ ${polarizedPinLabelsString}
|
|
|
10129
10130
|
` : "";
|
|
10130
10131
|
const polarizedPinLabelsProp = polarizedPinLabels ? ` pinLabels={pinLabels}
|
|
10131
10132
|
` : "";
|
|
10132
|
-
const
|
|
10133
|
-
const capacitorPolarizedPinLabelsBlock =
|
|
10134
|
-
const capacitorPolarizedPinLabelsProp =
|
|
10135
|
-
const polarizedProp =
|
|
10133
|
+
const shouldGeneratePolarizedCapacitor = componentType === "capacitor" && circuitJson.filter((item) => item.type === "source_port").length === 2 && (isPolarizedCapacitor || polarizedPinMetadata !== void 0);
|
|
10134
|
+
const capacitorPolarizedPinLabelsBlock = shouldGeneratePolarizedCapacitor ? polarizedPinLabelsBlock : "";
|
|
10135
|
+
const capacitorPolarizedPinLabelsProp = shouldGeneratePolarizedCapacitor ? polarizedPinLabelsProp : "";
|
|
10136
|
+
const polarizedProp = shouldGeneratePolarizedCapacitor ? ` polarized
|
|
10136
10137
|
` : "";
|
|
10137
10138
|
const symbolProp = symbolTsx ? ` symbol={
|
|
10138
10139
|
${symbolTsx.split("\n").map((line) => ` ${line}`).join("\n")}
|
|
@@ -10409,6 +10410,21 @@ var isCapacitorComponent = (betterEasy) => {
|
|
|
10409
10410
|
const value = componentParameters.Value;
|
|
10410
10411
|
return prefix?.toUpperCase() === "C?" && normalizeCapacitanceValue(value) !== void 0;
|
|
10411
10412
|
};
|
|
10413
|
+
var polarizedCapacitorMetadataPattern = /(?:aluminum|aluminium|tantalum|electrolytic|supercapacitor|polarized)/i;
|
|
10414
|
+
var isPolarizedCapacitorComponent = (betterEasy) => {
|
|
10415
|
+
if (!isCapacitorComponent(betterEasy)) return false;
|
|
10416
|
+
const pins = betterEasy.dataStr.shape.filter((shape) => shape.type === "PIN");
|
|
10417
|
+
if (pins.length !== 2) return false;
|
|
10418
|
+
const metadata = [
|
|
10419
|
+
betterEasy.title,
|
|
10420
|
+
betterEasy.description,
|
|
10421
|
+
...betterEasy.tags ?? [],
|
|
10422
|
+
betterEasy.category,
|
|
10423
|
+
betterEasy.dataStr.head.c_para.name,
|
|
10424
|
+
betterEasy.dataStr.head.c_para.package
|
|
10425
|
+
].filter((value) => typeof value === "string").join(" ");
|
|
10426
|
+
return polarizedCapacitorMetadataPattern.test(metadata) || betterEasy.dataStr.shape.some((shape) => shape.type === "ARC");
|
|
10427
|
+
};
|
|
10412
10428
|
|
|
10413
10429
|
// lib/websafe/convert-to-typescript-component/is-crystal-component.ts
|
|
10414
10430
|
var frequencyPattern = /^\d+(?:\.\d+)?\s*(?:Hz|kHz|MHz|GHz)$/i;
|
|
@@ -10686,6 +10702,7 @@ var convertBetterEasyToTsx = async ({
|
|
|
10686
10702
|
circuitJson,
|
|
10687
10703
|
supplierPartNumbers,
|
|
10688
10704
|
componentType,
|
|
10705
|
+
isPolarizedCapacitor: isPolarizedCapacitorComponent(betterEasy),
|
|
10689
10706
|
capacitance: capacitance2,
|
|
10690
10707
|
resistance: resistance2,
|
|
10691
10708
|
inductance: inductance2,
|