altium-to-circuit-json 0.0.98 → 0.0.99

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/index.js CHANGED
@@ -3392,7 +3392,15 @@ function convertComponentPin({
3392
3392
  }
3393
3393
 
3394
3394
  // lib/schematic/components/convertMarkedCapacitorBody.ts
3395
- import { AltiumSchLabelRecord } from "altiumts";
3395
+ import {
3396
+ AltiumSchArcRecord as AltiumSchArcRecord2,
3397
+ AltiumSchDesignatorRecord,
3398
+ AltiumSchEllipticalArcRecord as AltiumSchEllipticalArcRecord2,
3399
+ AltiumSchLabelRecord,
3400
+ AltiumSchLineRecord as AltiumSchLineRecord2,
3401
+ AltiumSchParameterRecord,
3402
+ AltiumSchPolylineRecord as AltiumSchPolylineRecord2
3403
+ } from "altiumts";
3396
3404
 
3397
3405
  // lib/schematic/components/convertOwnedCustomComponentBody.ts
3398
3406
  import {
@@ -3549,12 +3557,30 @@ function convertMarkedCapacitorBody({
3549
3557
  records,
3550
3558
  symbolSelection
3551
3559
  }, context) {
3552
- if (!symbolSelection?.name.startsWith("capacitor_") || symbolSelection.name.startsWith("capacitor_polarized_") || !records.some(
3560
+ const hasCurvedPlate = records.some(
3561
+ (record) => record instanceof AltiumSchArcRecord2 || record instanceof AltiumSchEllipticalArcRecord2
3562
+ ) && records.some(
3563
+ (record) => record instanceof AltiumSchLineRecord2 || record instanceof AltiumSchPolylineRecord2
3564
+ );
3565
+ if (!symbolSelection?.name.startsWith("capacitor_") || symbolSelection.name.startsWith("capacitor_polarized_") || !hasCurvedPlate && !records.some(
3553
3566
  (record) => record instanceof AltiumSchLabelRecord && !record.getBoolean("ISHIDDEN") && record.text?.trim() === "+"
3554
3567
  )) {
3555
3568
  return void 0;
3556
3569
  }
3557
- return convertOwnedCustomComponentBody({ identity, records }, context);
3570
+ const body = convertOwnedCustomComponentBody({ identity, records }, context);
3571
+ if (!body) return void 0;
3572
+ const componentLabelIds = new Set(
3573
+ records.flatMap((record) => {
3574
+ if (!(record instanceof AltiumSchDesignatorRecord) && !(record instanceof AltiumSchParameterRecord && ["comment", "value"].includes(record.name?.toLowerCase() ?? ""))) {
3575
+ return [];
3576
+ }
3577
+ const index = context.document.records.indexOf(record);
3578
+ return index >= 0 ? [`schematic_text_altium_${index}`] : [];
3579
+ })
3580
+ );
3581
+ return body.map(
3582
+ (element) => element.type === "schematic_text" && componentLabelIds.has(element.schematic_text_id) ? { ...element, color: "#0f0f0f" } : element
3583
+ );
3558
3584
  }
3559
3585
 
3560
3586
  // lib/schematic/components/normalizeLogicGatePinName.ts
@@ -4117,18 +4143,18 @@ function createSourceComponent({
4117
4143
  }
4118
4144
 
4119
4145
  // lib/schematic/components/findOwnedDesignator.ts
4120
- import { AltiumSchDesignatorRecord } from "altiumts";
4146
+ import { AltiumSchDesignatorRecord as AltiumSchDesignatorRecord2 } from "altiumts";
4121
4147
  function findOwnedDesignator(records) {
4122
4148
  return records.find(
4123
- (record) => record instanceof AltiumSchDesignatorRecord && record.getDecoded("NAME")?.toLowerCase() === "designator"
4149
+ (record) => record instanceof AltiumSchDesignatorRecord2 && record.getDecoded("NAME")?.toLowerCase() === "designator"
4124
4150
  )?.text;
4125
4151
  }
4126
4152
 
4127
4153
  // lib/schematic/components/findOwnedParameterText.ts
4128
- import { AltiumSchParameterRecord } from "altiumts";
4154
+ import { AltiumSchParameterRecord as AltiumSchParameterRecord2 } from "altiumts";
4129
4155
  function findOwnedParameterText(records, name) {
4130
4156
  return records.find(
4131
- (record) => record instanceof AltiumSchParameterRecord && record.name?.toLowerCase() === name.toLowerCase()
4157
+ (record) => record instanceof AltiumSchParameterRecord2 && record.name?.toLowerCase() === name.toLowerCase()
4132
4158
  )?.text;
4133
4159
  }
4134
4160