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/index.js
CHANGED
|
@@ -9175,6 +9175,7 @@ var generateTypescriptComponent = ({
|
|
|
9175
9175
|
supplierPartNumbers,
|
|
9176
9176
|
manufacturerPartNumber,
|
|
9177
9177
|
componentType = "chip",
|
|
9178
|
+
isPolarizedCapacitor = false,
|
|
9178
9179
|
capacitance: capacitance2,
|
|
9179
9180
|
resistance: resistance2,
|
|
9180
9181
|
inductance: inductance2,
|
|
@@ -9224,10 +9225,10 @@ ${polarizedPinLabelsString}
|
|
|
9224
9225
|
` : "";
|
|
9225
9226
|
const polarizedPinLabelsProp = polarizedPinLabels ? ` pinLabels={pinLabels}
|
|
9226
9227
|
` : "";
|
|
9227
|
-
const
|
|
9228
|
-
const capacitorPolarizedPinLabelsBlock =
|
|
9229
|
-
const capacitorPolarizedPinLabelsProp =
|
|
9230
|
-
const polarizedProp =
|
|
9228
|
+
const shouldGeneratePolarizedCapacitor = componentType === "capacitor" && circuitJson.filter((item) => item.type === "source_port").length === 2 && (isPolarizedCapacitor || polarizedPinMetadata !== void 0);
|
|
9229
|
+
const capacitorPolarizedPinLabelsBlock = shouldGeneratePolarizedCapacitor ? polarizedPinLabelsBlock : "";
|
|
9230
|
+
const capacitorPolarizedPinLabelsProp = shouldGeneratePolarizedCapacitor ? polarizedPinLabelsProp : "";
|
|
9231
|
+
const polarizedProp = shouldGeneratePolarizedCapacitor ? ` polarized
|
|
9231
9232
|
` : "";
|
|
9232
9233
|
const symbolProp = symbolTsx ? ` symbol={
|
|
9233
9234
|
${symbolTsx.split("\n").map((line) => ` ${line}`).join("\n")}
|
|
@@ -9504,6 +9505,21 @@ var isCapacitorComponent = (betterEasy) => {
|
|
|
9504
9505
|
const value = componentParameters.Value;
|
|
9505
9506
|
return prefix?.toUpperCase() === "C?" && normalizeCapacitanceValue(value) !== void 0;
|
|
9506
9507
|
};
|
|
9508
|
+
var polarizedCapacitorMetadataPattern = /(?:aluminum|aluminium|tantalum|electrolytic|supercapacitor|polarized)/i;
|
|
9509
|
+
var isPolarizedCapacitorComponent = (betterEasy) => {
|
|
9510
|
+
if (!isCapacitorComponent(betterEasy)) return false;
|
|
9511
|
+
const pins = betterEasy.dataStr.shape.filter((shape) => shape.type === "PIN");
|
|
9512
|
+
if (pins.length !== 2) return false;
|
|
9513
|
+
const metadata = [
|
|
9514
|
+
betterEasy.title,
|
|
9515
|
+
betterEasy.description,
|
|
9516
|
+
...betterEasy.tags ?? [],
|
|
9517
|
+
betterEasy.category,
|
|
9518
|
+
betterEasy.dataStr.head.c_para.name,
|
|
9519
|
+
betterEasy.dataStr.head.c_para.package
|
|
9520
|
+
].filter((value) => typeof value === "string").join(" ");
|
|
9521
|
+
return polarizedCapacitorMetadataPattern.test(metadata) || betterEasy.dataStr.shape.some((shape) => shape.type === "ARC");
|
|
9522
|
+
};
|
|
9507
9523
|
|
|
9508
9524
|
// lib/websafe/convert-to-typescript-component/is-crystal-component.ts
|
|
9509
9525
|
var frequencyPattern = /^\d+(?:\.\d+)?\s*(?:Hz|kHz|MHz|GHz)$/i;
|
|
@@ -9781,6 +9797,7 @@ var convertBetterEasyToTsx = async ({
|
|
|
9781
9797
|
circuitJson,
|
|
9782
9798
|
supplierPartNumbers,
|
|
9783
9799
|
componentType,
|
|
9800
|
+
isPolarizedCapacitor: isPolarizedCapacitorComponent(betterEasy),
|
|
9784
9801
|
capacitance: capacitance2,
|
|
9785
9802
|
resistance: resistance2,
|
|
9786
9803
|
inductance: inductance2,
|