easyeda 0.0.315 → 0.0.316
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 +32 -10
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +32 -10
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +33 -11
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6267,14 +6267,32 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
6267
6267
|
if (pin) labels.push(normalizeSymbolName(pin.label));
|
|
6268
6268
|
return labels;
|
|
6269
6269
|
});
|
|
6270
|
-
const
|
|
6270
|
+
const padNumberKeys = pads.map((pad, index) => {
|
|
6271
|
+
const padNumber = String(pad.number ?? "").trim();
|
|
6272
|
+
return padNumber ? `number:${padNumber}` : `index:${index}`;
|
|
6273
|
+
});
|
|
6274
|
+
const uniquePinLabelSets = [];
|
|
6275
|
+
const uniquePinIndexByKey = /* @__PURE__ */ new Map();
|
|
6276
|
+
const uniquePinIndexByPad = padNumberKeys.map((key, padIndex) => {
|
|
6277
|
+
const existingIndex = uniquePinIndexByKey.get(key);
|
|
6278
|
+
if (existingIndex !== void 0) return existingIndex;
|
|
6279
|
+
const uniquePinIndex = uniquePinLabelSets.length;
|
|
6280
|
+
uniquePinIndexByKey.set(key, uniquePinIndex);
|
|
6281
|
+
uniquePinLabelSets.push(pinLabelSets[padIndex]);
|
|
6282
|
+
return uniquePinIndex;
|
|
6283
|
+
});
|
|
6284
|
+
const normalizedUniquePinLabels = normalizePinLabels(uniquePinLabelSets);
|
|
6285
|
+
const normalizedPinLabels = uniquePinIndexByPad.map(
|
|
6286
|
+
(uniquePinIndex) => normalizedUniquePinLabels[uniquePinIndex]
|
|
6287
|
+
);
|
|
6271
6288
|
const normalizedPinLabelsByPin = Object.fromEntries(
|
|
6272
|
-
|
|
6289
|
+
normalizedUniquePinLabels.map((labels) => {
|
|
6273
6290
|
const pin = labels.find((label) => /^pin\d+$/i.test(label));
|
|
6274
6291
|
return [pin, labels.filter((label) => label !== pin)];
|
|
6275
6292
|
})
|
|
6276
6293
|
);
|
|
6277
6294
|
const polarizedPinMetadata = pads.length === 2 && (isDiodeCategoryComponent(easyEdaJson) || isLedCategoryComponent(easyEdaJson)) ? getPolarizedPinMetadata(normalizedPinLabelsByPin) : void 0;
|
|
6295
|
+
const emittedSourcePinIndexes = /* @__PURE__ */ new Set();
|
|
6278
6296
|
pads.forEach((pad, index) => {
|
|
6279
6297
|
const portHints = normalizedPinLabels[index];
|
|
6280
6298
|
const pinNumber = Number.parseInt(
|
|
@@ -6282,14 +6300,18 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
6282
6300
|
);
|
|
6283
6301
|
const canonicalPinName = `pin${pinNumber}`;
|
|
6284
6302
|
const pcbPortHints = polarizedPinMetadata?.portHintsMap[canonicalPinName] ?? [canonicalPinName];
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6303
|
+
const uniquePinIndex = uniquePinIndexByPad[index];
|
|
6304
|
+
if (!emittedSourcePinIndexes.has(uniquePinIndex)) {
|
|
6305
|
+
emittedSourcePinIndexes.add(uniquePinIndex);
|
|
6306
|
+
circuitElements.push({
|
|
6307
|
+
type: "source_port",
|
|
6308
|
+
source_port_id: `source_port_${index + 1}`,
|
|
6309
|
+
source_component_id: "source_component_1",
|
|
6310
|
+
name: `pin${pinNumber}`,
|
|
6311
|
+
pin_number: pinNumber,
|
|
6312
|
+
port_hints: portHints.filter((hint) => hint !== `pin${pinNumber}`)
|
|
6313
|
+
});
|
|
6314
|
+
}
|
|
6293
6315
|
if (pad.holeRadius !== void 0 && mil2mm(pad.holeRadius) !== 0) {
|
|
6294
6316
|
const platedHoleId = pad.shape === "RECT" && pad.rotation !== void 0 ? `pcb_plated_hole_${index + 1}_rot${pad.rotation}` : `pcb_plated_hole_${index + 1}`;
|
|
6295
6317
|
const commonPlatedHoleProps = {
|