easyeda 0.0.355 → 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/browser/index.js
CHANGED
|
@@ -12802,6 +12802,7 @@ var generateTypescriptComponent = ({
|
|
|
12802
12802
|
supplierPartNumbers,
|
|
12803
12803
|
manufacturerPartNumber,
|
|
12804
12804
|
componentType = "chip",
|
|
12805
|
+
isPolarizedCapacitor = false,
|
|
12805
12806
|
capacitance: capacitance2,
|
|
12806
12807
|
resistance: resistance2,
|
|
12807
12808
|
inductance: inductance2,
|
|
@@ -12851,10 +12852,10 @@ ${polarizedPinLabelsString}
|
|
|
12851
12852
|
` : "";
|
|
12852
12853
|
const polarizedPinLabelsProp = polarizedPinLabels ? ` pinLabels={pinLabels}
|
|
12853
12854
|
` : "";
|
|
12854
|
-
const
|
|
12855
|
-
const capacitorPolarizedPinLabelsBlock =
|
|
12856
|
-
const capacitorPolarizedPinLabelsProp =
|
|
12857
|
-
const polarizedProp =
|
|
12855
|
+
const shouldGeneratePolarizedCapacitor = componentType === "capacitor" && circuitJson.filter((item) => item.type === "source_port").length === 2 && (isPolarizedCapacitor || polarizedPinMetadata !== void 0);
|
|
12856
|
+
const capacitorPolarizedPinLabelsBlock = shouldGeneratePolarizedCapacitor ? polarizedPinLabelsBlock : "";
|
|
12857
|
+
const capacitorPolarizedPinLabelsProp = shouldGeneratePolarizedCapacitor ? polarizedPinLabelsProp : "";
|
|
12858
|
+
const polarizedProp = shouldGeneratePolarizedCapacitor ? ` polarized
|
|
12858
12859
|
` : "";
|
|
12859
12860
|
const symbolProp = symbolTsx ? ` symbol={
|
|
12860
12861
|
${symbolTsx.split("\n").map((line) => ` ${line}`).join("\n")}
|
|
@@ -13131,6 +13132,21 @@ var isCapacitorComponent = (betterEasy) => {
|
|
|
13131
13132
|
const value = componentParameters.Value;
|
|
13132
13133
|
return prefix?.toUpperCase() === "C?" && normalizeCapacitanceValue(value) !== void 0;
|
|
13133
13134
|
};
|
|
13135
|
+
var polarizedCapacitorMetadataPattern = /(?:aluminum|aluminium|tantalum|electrolytic|supercapacitor|polarized)/i;
|
|
13136
|
+
var isPolarizedCapacitorComponent = (betterEasy) => {
|
|
13137
|
+
if (!isCapacitorComponent(betterEasy)) return false;
|
|
13138
|
+
const pins = betterEasy.dataStr.shape.filter((shape) => shape.type === "PIN");
|
|
13139
|
+
if (pins.length !== 2) return false;
|
|
13140
|
+
const metadata = [
|
|
13141
|
+
betterEasy.title,
|
|
13142
|
+
betterEasy.description,
|
|
13143
|
+
...betterEasy.tags ?? [],
|
|
13144
|
+
betterEasy.category,
|
|
13145
|
+
betterEasy.dataStr.head.c_para.name,
|
|
13146
|
+
betterEasy.dataStr.head.c_para.package
|
|
13147
|
+
].filter((value) => typeof value === "string").join(" ");
|
|
13148
|
+
return polarizedCapacitorMetadataPattern.test(metadata) || betterEasy.dataStr.shape.some((shape) => shape.type === "ARC");
|
|
13149
|
+
};
|
|
13134
13150
|
|
|
13135
13151
|
// lib/websafe/convert-to-typescript-component/is-crystal-component.ts
|
|
13136
13152
|
var frequencyPattern = /^\d+(?:\.\d+)?\s*(?:Hz|kHz|MHz|GHz)$/i;
|
|
@@ -13408,6 +13424,7 @@ var convertBetterEasyToTsx = async ({
|
|
|
13408
13424
|
circuitJson,
|
|
13409
13425
|
supplierPartNumbers,
|
|
13410
13426
|
componentType,
|
|
13427
|
+
isPolarizedCapacitor: isPolarizedCapacitorComponent(betterEasy),
|
|
13411
13428
|
capacitance: capacitance2,
|
|
13412
13429
|
resistance: resistance2,
|
|
13413
13430
|
inductance: inductance2,
|