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.
@@ -10130,14 +10130,32 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
10130
10130
  if (pin) labels.push(normalizeSymbolName(pin.label));
10131
10131
  return labels;
10132
10132
  });
10133
- const normalizedPinLabels = normalizePinLabels(pinLabelSets);
10133
+ const padNumberKeys = pads.map((pad, index) => {
10134
+ const padNumber = String(pad.number ?? "").trim();
10135
+ return padNumber ? `number:${padNumber}` : `index:${index}`;
10136
+ });
10137
+ const uniquePinLabelSets = [];
10138
+ const uniquePinIndexByKey = /* @__PURE__ */ new Map();
10139
+ const uniquePinIndexByPad = padNumberKeys.map((key, padIndex) => {
10140
+ const existingIndex = uniquePinIndexByKey.get(key);
10141
+ if (existingIndex !== void 0) return existingIndex;
10142
+ const uniquePinIndex = uniquePinLabelSets.length;
10143
+ uniquePinIndexByKey.set(key, uniquePinIndex);
10144
+ uniquePinLabelSets.push(pinLabelSets[padIndex]);
10145
+ return uniquePinIndex;
10146
+ });
10147
+ const normalizedUniquePinLabels = normalizePinLabels(uniquePinLabelSets);
10148
+ const normalizedPinLabels = uniquePinIndexByPad.map(
10149
+ (uniquePinIndex) => normalizedUniquePinLabels[uniquePinIndex]
10150
+ );
10134
10151
  const normalizedPinLabelsByPin = Object.fromEntries(
10135
- normalizedPinLabels.map((labels) => {
10152
+ normalizedUniquePinLabels.map((labels) => {
10136
10153
  const pin = labels.find((label) => /^pin\d+$/i.test(label));
10137
10154
  return [pin, labels.filter((label) => label !== pin)];
10138
10155
  })
10139
10156
  );
10140
10157
  const polarizedPinMetadata = pads.length === 2 && (isDiodeCategoryComponent(easyEdaJson) || isLedCategoryComponent(easyEdaJson)) ? getPolarizedPinMetadata(normalizedPinLabelsByPin) : void 0;
10158
+ const emittedSourcePinIndexes = /* @__PURE__ */ new Set();
10141
10159
  pads.forEach((pad, index) => {
10142
10160
  const portHints = normalizedPinLabels[index];
10143
10161
  const pinNumber = Number.parseInt(
@@ -10145,14 +10163,18 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
10145
10163
  );
10146
10164
  const canonicalPinName = `pin${pinNumber}`;
10147
10165
  const pcbPortHints = polarizedPinMetadata?.portHintsMap[canonicalPinName] ?? [canonicalPinName];
10148
- circuitElements.push({
10149
- type: "source_port",
10150
- source_port_id: `source_port_${index + 1}`,
10151
- source_component_id: "source_component_1",
10152
- name: `pin${pinNumber}`,
10153
- pin_number: pinNumber,
10154
- port_hints: portHints.filter((hint) => hint !== `pin${pinNumber}`)
10155
- });
10166
+ const uniquePinIndex = uniquePinIndexByPad[index];
10167
+ if (!emittedSourcePinIndexes.has(uniquePinIndex)) {
10168
+ emittedSourcePinIndexes.add(uniquePinIndex);
10169
+ circuitElements.push({
10170
+ type: "source_port",
10171
+ source_port_id: `source_port_${index + 1}`,
10172
+ source_component_id: "source_component_1",
10173
+ name: `pin${pinNumber}`,
10174
+ pin_number: pinNumber,
10175
+ port_hints: portHints.filter((hint) => hint !== `pin${pinNumber}`)
10176
+ });
10177
+ }
10156
10178
  if (pad.holeRadius !== void 0 && mil2mm(pad.holeRadius) !== 0) {
10157
10179
  const platedHoleId = pad.shape === "RECT" && pad.rotation !== void 0 ? `pcb_plated_hole_${index + 1}_rot${pad.rotation}` : `pcb_plated_hole_${index + 1}`;
10158
10180
  const commonPlatedHoleProps = {