easyeda 0.0.277 → 0.0.279

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/main.cjs CHANGED
@@ -3513,7 +3513,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
3513
3513
  var package_default = {
3514
3514
  name: "easyeda",
3515
3515
  type: "module",
3516
- version: "0.0.276",
3516
+ version: "0.0.278",
3517
3517
  files: [
3518
3518
  "dist"
3519
3519
  ],
@@ -9200,6 +9200,9 @@ var mil2mm = (mil) => {
9200
9200
  return mm(mil);
9201
9201
  };
9202
9202
 
9203
+ // lib/constants.ts
9204
+ var DEFAULT_PCB_THICKNESS_MM = 1.6;
9205
+
9203
9206
  // lib/math/arc-utils.ts
9204
9207
  function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag, sweepFlag) {
9205
9208
  const start = { x: startX, y: startY };
@@ -9248,6 +9251,173 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
9248
9251
  // lib/utils/easyeda-unit-to-mm.ts
9249
9252
  var mil10ToMm = (value) => value * 10 * 0.0254;
9250
9253
 
9254
+ // lib/utils/get-polarized-pin-metadata.ts
9255
+ var getPinLabelValues = (labels) => {
9256
+ if (typeof labels === "string") return [labels];
9257
+ return [...labels];
9258
+ };
9259
+ var stripEasyEdaPolarityHintDecoration = (label) => label.toLowerCase().replace(/[^a-z0-9+-]/g, "");
9260
+ var getPinKeySortValue = (pinKey) => {
9261
+ const match = /^pin(\d+)$/i.exec(pinKey);
9262
+ return match ? Number(match[1]) : Number.MAX_SAFE_INTEGER;
9263
+ };
9264
+ var getPolarizedPinMetadata = (pinLabels) => {
9265
+ const labelsByPin = Object.entries(pinLabels).map(([pin, labels]) => ({
9266
+ pin,
9267
+ labels: getPinLabelValues(labels).map(stripEasyEdaPolarityHintDecoration)
9268
+ }));
9269
+ const anodePin = labelsByPin.find(
9270
+ ({ labels }) => labels.some((label) => ["a", "anode", "pos", "+"].includes(label))
9271
+ )?.pin;
9272
+ const cathodePin = labelsByPin.find(
9273
+ ({ labels }) => labels.some((label) => ["c", "k", "cathode", "neg", "-"].includes(label))
9274
+ )?.pin;
9275
+ if (!anodePin || !cathodePin || anodePin === cathodePin) return void 0;
9276
+ const polarizedPinEntries = [
9277
+ [anodePin, ["anode", "pos"]],
9278
+ [cathodePin, ["cathode", "neg"]]
9279
+ ].sort(
9280
+ ([pinA], [pinB]) => getPinKeySortValue(pinA) - getPinKeySortValue(pinB)
9281
+ );
9282
+ return {
9283
+ portHintsMap: Object.fromEntries(
9284
+ polarizedPinEntries.map(([pin, labels]) => [pin, [pin, ...labels]])
9285
+ ),
9286
+ pinLabels: Object.fromEntries(polarizedPinEntries)
9287
+ };
9288
+ };
9289
+
9290
+ // lib/utils/normalize-pin-labels.ts
9291
+ var normalizePinLabels = (inputPinLabels) => {
9292
+ const uniqueInputPinLabels = inputPinLabels.map((labels) => [
9293
+ ...new Set(labels)
9294
+ ]);
9295
+ const result = uniqueInputPinLabels.map(() => []);
9296
+ const desiredNumbers = uniqueInputPinLabels.map(() => null);
9297
+ for (let i = 0; i < uniqueInputPinLabels.length; i++) {
9298
+ for (const label of uniqueInputPinLabels[i]) {
9299
+ if (/^\d+$/.test(label)) {
9300
+ desiredNumbers[i] = Number.parseInt(label);
9301
+ break;
9302
+ }
9303
+ }
9304
+ }
9305
+ let highestPinNumber = 0;
9306
+ const acceptedDesiredNumbers = /* @__PURE__ */ new Set();
9307
+ for (let i = 0; i < desiredNumbers.length; i++) {
9308
+ const desiredNumber = desiredNumbers[i];
9309
+ if (desiredNumber === null || desiredNumber < 1) continue;
9310
+ if (!acceptedDesiredNumbers.has(desiredNumber)) {
9311
+ acceptedDesiredNumbers.add(desiredNumber);
9312
+ result[i].push(`pin${desiredNumber}`);
9313
+ highestPinNumber = Math.max(highestPinNumber, desiredNumber);
9314
+ continue;
9315
+ }
9316
+ let existingAltCount = 0;
9317
+ for (const label of result[i]) {
9318
+ if (label.startsWith(`pin${desiredNumber}_alt`)) {
9319
+ existingAltCount += 1;
9320
+ }
9321
+ }
9322
+ result[i].push(`pin${desiredNumber}_alt${existingAltCount + 1}`);
9323
+ }
9324
+ for (let i = 0; i < result.length; i++) {
9325
+ const firstLabel = result[i][0];
9326
+ if (firstLabel?.includes("_alt")) {
9327
+ highestPinNumber += 1;
9328
+ result[i].unshift(`pin${highestPinNumber}`);
9329
+ }
9330
+ }
9331
+ for (let i = 0; i < result.length; i++) {
9332
+ if (result[i].length === 0) {
9333
+ highestPinNumber += 1;
9334
+ result[i].push(`pin${highestPinNumber}`);
9335
+ }
9336
+ }
9337
+ const totalLabelCounts = {};
9338
+ for (const inputLabels of uniqueInputPinLabels) {
9339
+ for (const label of inputLabels) {
9340
+ if (/^\d+$/.test(label)) continue;
9341
+ totalLabelCounts[label] = (totalLabelCounts[label] ?? 0) + 1;
9342
+ }
9343
+ }
9344
+ const incrementalLabelCounts = {};
9345
+ for (let i = 0; i < uniqueInputPinLabels.length; i++) {
9346
+ for (const label of uniqueInputPinLabels[i]) {
9347
+ if (/^\d+$/.test(label)) continue;
9348
+ if (totalLabelCounts[label] === 1) {
9349
+ result[i].push(label);
9350
+ } else {
9351
+ incrementalLabelCounts[label] = (incrementalLabelCounts[label] ?? 0) + 1;
9352
+ result[i].push(`${label}${incrementalLabelCounts[label]}`);
9353
+ }
9354
+ }
9355
+ }
9356
+ return result;
9357
+ };
9358
+
9359
+ // lib/utils/normalize-symbol-name.ts
9360
+ var normalizeSymbolName = (name) => {
9361
+ const trimmedName = name.trim();
9362
+ if (trimmedName === "+") return "_POS";
9363
+ if (trimmedName === "-") return "_NEG";
9364
+ return trimmedName;
9365
+ };
9366
+
9367
+ // lib/websafe/convert-to-typescript-component/category-value-contains-diode.ts
9368
+ var categoryValueContainsDiode = (value) => {
9369
+ if (typeof value === "string") {
9370
+ return /(^|[^a-z])diodes?([^a-z]|$)/i.test(value);
9371
+ }
9372
+ if (Array.isArray(value)) {
9373
+ return value.some(categoryValueContainsDiode);
9374
+ }
9375
+ if (value && typeof value === "object") {
9376
+ return Object.values(value).some(categoryValueContainsDiode);
9377
+ }
9378
+ return false;
9379
+ };
9380
+
9381
+ // lib/websafe/convert-to-typescript-component/is-diode-category-component.ts
9382
+ var isDiodeCategoryComponent = (betterEasy) => {
9383
+ const cPara = betterEasy.dataStr.head.c_para;
9384
+ return [
9385
+ betterEasy.tags,
9386
+ cPara.category,
9387
+ cPara.Category,
9388
+ cPara["LCSC Category"],
9389
+ cPara["JLCPCB Category"],
9390
+ betterEasy.category
9391
+ ].some(categoryValueContainsDiode);
9392
+ };
9393
+
9394
+ // lib/websafe/convert-to-typescript-component/category-value-contains-led.ts
9395
+ var categoryValueContainsLed = (value) => {
9396
+ if (typeof value === "string") {
9397
+ return /(^|[^a-z])leds?([^a-z]|$)/i.test(value) || /light[-\s]?emitting\s+diodes?/i.test(value);
9398
+ }
9399
+ if (Array.isArray(value)) {
9400
+ return value.some(categoryValueContainsLed);
9401
+ }
9402
+ if (value && typeof value === "object") {
9403
+ return Object.values(value).some(categoryValueContainsLed);
9404
+ }
9405
+ return false;
9406
+ };
9407
+
9408
+ // lib/websafe/convert-to-typescript-component/is-led-category-component.ts
9409
+ var isLedCategoryComponent = (betterEasy) => {
9410
+ const cPara = betterEasy.dataStr.head.c_para;
9411
+ return [
9412
+ betterEasy.tags,
9413
+ cPara.category,
9414
+ cPara.Category,
9415
+ cPara["LCSC Category"],
9416
+ cPara["JLCPCB Category"],
9417
+ betterEasy.category
9418
+ ].some(categoryValueContainsLed);
9419
+ };
9420
+
9251
9421
  // node_modules/@tscircuit/math-utils/dist/chunk-3WCUPG5S.js
9252
9422
  var getBoundsCenter = (bounds) => ({
9253
9423
  x: (bounds.minX + bounds.maxX) / 2,
@@ -9384,86 +9554,6 @@ var getCadSvgNodeZOffsetMm = (easyEdaJson) => {
9384
9554
  };
9385
9555
  var getCadSvgNodeModelUuid = (easyEdaJson) => getCadSvgNode(easyEdaJson)?.svgData.attrs?.uuid ?? null;
9386
9556
 
9387
- // lib/utils/normalize-pin-labels.ts
9388
- var normalizePinLabels = (inputPinLabels) => {
9389
- const uniqueInputPinLabels = inputPinLabels.map((labels) => [
9390
- ...new Set(labels)
9391
- ]);
9392
- const result = uniqueInputPinLabels.map(() => []);
9393
- const desiredNumbers = uniqueInputPinLabels.map(() => null);
9394
- for (let i = 0; i < uniqueInputPinLabels.length; i++) {
9395
- for (const label of uniqueInputPinLabels[i]) {
9396
- if (/^\d+$/.test(label)) {
9397
- desiredNumbers[i] = Number.parseInt(label);
9398
- break;
9399
- }
9400
- }
9401
- }
9402
- let highestPinNumber = 0;
9403
- const acceptedDesiredNumbers = /* @__PURE__ */ new Set();
9404
- for (let i = 0; i < desiredNumbers.length; i++) {
9405
- const desiredNumber = desiredNumbers[i];
9406
- if (desiredNumber === null || desiredNumber < 1) continue;
9407
- if (!acceptedDesiredNumbers.has(desiredNumber)) {
9408
- acceptedDesiredNumbers.add(desiredNumber);
9409
- result[i].push(`pin${desiredNumber}`);
9410
- highestPinNumber = Math.max(highestPinNumber, desiredNumber);
9411
- continue;
9412
- }
9413
- let existingAltCount = 0;
9414
- for (const label of result[i]) {
9415
- if (label.startsWith(`pin${desiredNumber}_alt`)) {
9416
- existingAltCount += 1;
9417
- }
9418
- }
9419
- result[i].push(`pin${desiredNumber}_alt${existingAltCount + 1}`);
9420
- }
9421
- for (let i = 0; i < result.length; i++) {
9422
- const firstLabel = result[i][0];
9423
- if (firstLabel?.includes("_alt")) {
9424
- highestPinNumber += 1;
9425
- result[i].unshift(`pin${highestPinNumber}`);
9426
- }
9427
- }
9428
- for (let i = 0; i < result.length; i++) {
9429
- if (result[i].length === 0) {
9430
- highestPinNumber += 1;
9431
- result[i].push(`pin${highestPinNumber}`);
9432
- }
9433
- }
9434
- const totalLabelCounts = {};
9435
- for (const inputLabels of uniqueInputPinLabels) {
9436
- for (const label of inputLabels) {
9437
- if (/^\d+$/.test(label)) continue;
9438
- totalLabelCounts[label] = (totalLabelCounts[label] ?? 0) + 1;
9439
- }
9440
- }
9441
- const incrementalLabelCounts = {};
9442
- for (let i = 0; i < uniqueInputPinLabels.length; i++) {
9443
- for (const label of uniqueInputPinLabels[i]) {
9444
- if (/^\d+$/.test(label)) continue;
9445
- if (totalLabelCounts[label] === 1) {
9446
- result[i].push(label);
9447
- } else {
9448
- incrementalLabelCounts[label] = (incrementalLabelCounts[label] ?? 0) + 1;
9449
- result[i].push(`${label}${incrementalLabelCounts[label]}`);
9450
- }
9451
- }
9452
- }
9453
- return result;
9454
- };
9455
-
9456
- // lib/utils/normalize-symbol-name.ts
9457
- var normalizeSymbolName = (name) => {
9458
- const trimmedName = name.trim();
9459
- if (trimmedName === "+") return "_POS";
9460
- if (trimmedName === "-") return "_NEG";
9461
- return trimmedName;
9462
- };
9463
-
9464
- // lib/constants.ts
9465
- var DEFAULT_PCB_THICKNESS_MM = 1.6;
9466
-
9467
9557
  // lib/convert-easyeda-json-to-tscircuit-soup-json.ts
9468
9558
  var EASYEDA_STEP_MODEL_URL = "https://modules.easyeda.com/qAxj6KHrDKw4blvCG8QJPs7Y";
9469
9559
  var EASYEDA_OBJ_MODEL_URL = "https://modules.easyeda.com/3dmodel";
@@ -9669,11 +9759,20 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
9669
9759
  return labels;
9670
9760
  });
9671
9761
  const normalizedPinLabels = normalizePinLabels(pinLabelSets);
9762
+ const normalizedPinLabelsByPin = Object.fromEntries(
9763
+ normalizedPinLabels.map((labels) => {
9764
+ const pin = labels.find((label) => /^pin\d+$/i.test(label));
9765
+ return [pin, labels.filter((label) => label !== pin)];
9766
+ })
9767
+ );
9768
+ const polarizedPinMetadata = pads.length === 2 && (isDiodeCategoryComponent(easyEdaJson) || isLedCategoryComponent(easyEdaJson)) ? getPolarizedPinMetadata(normalizedPinLabelsByPin) : void 0;
9672
9769
  pads.forEach((pad, index) => {
9673
9770
  const portHints = normalizedPinLabels[index];
9674
9771
  const pinNumber = Number.parseInt(
9675
9772
  portHints.find((hint) => hint.match(/pin\d+/)).replace("pin", "")
9676
9773
  );
9774
+ const canonicalPinName = `pin${pinNumber}`;
9775
+ const pcbPortHints = polarizedPinMetadata?.portHintsMap[canonicalPinName] ?? [canonicalPinName];
9677
9776
  circuitElements.push({
9678
9777
  type: "source_port",
9679
9778
  source_port_id: `source_port_${index + 1}`,
@@ -9690,7 +9789,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
9690
9789
  x: mil2mm(pad.center.x),
9691
9790
  y: mil2mm(pad.center.y),
9692
9791
  layers: ["top"],
9693
- port_hints: [`pin${pinNumber}`],
9792
+ port_hints: pcbPortHints,
9694
9793
  pcb_component_id: "pcb_component_1",
9695
9794
  pcb_port_id: `pcb_port_${index + 1}`
9696
9795
  };
@@ -9802,7 +9901,7 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
9802
9901
  radius: Math.min(mil2mm(pad.width), mil2mm(pad.height)) / 2
9803
9902
  },
9804
9903
  layer: "top",
9805
- port_hints: [`pin${pinNumber}`],
9904
+ port_hints: pcbPortHints,
9806
9905
  pcb_component_id: "pcb_component_1",
9807
9906
  pcb_port_id: `pcb_port_${index + 1}`
9808
9907
  });
@@ -10070,7 +10169,7 @@ var import_zod181 = require("zod");
10070
10169
  var import_zod179 = require("zod");
10071
10170
  var safeNumber = (defaultValue = 0) => import_zod179.z.union([import_zod179.z.number(), import_zod179.z.string()]).transform((val) => {
10072
10171
  const num = Number(val);
10073
- return isNaN(num) ? defaultValue : num;
10172
+ return Number.isNaN(num) ? defaultValue : num;
10074
10173
  }).default(defaultValue);
10075
10174
  var tenthmil = import_zod179.z.union([import_zod179.z.number(), import_zod179.z.string()]).optional().transform(
10076
10175
  (n) => typeof n === "string" && n.endsWith("mil") ? n : `${Number.parseFloat(n) * 10}mil`
@@ -10217,6 +10316,7 @@ var ShapeItemSchema = import_zod179.z.object({
10217
10316
  }
10218
10317
  case "PAD": {
10219
10318
  const [padShape, ...params] = shape.data.split("~");
10319
+ const rawPadNumber = params[6];
10220
10320
  const [
10221
10321
  centerX,
10222
10322
  centerY,
@@ -10224,10 +10324,11 @@ var ShapeItemSchema = import_zod179.z.object({
10224
10324
  height,
10225
10325
  layermask,
10226
10326
  net,
10227
- number,
10327
+ numericPadNumber,
10228
10328
  holeRadius,
10229
10329
  ...rest
10230
10330
  ] = params.map((p) => Number.isNaN(Number(p)) ? p : Number(p));
10331
+ const padNumber = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(rawPadNumber) ? numericPadNumber : rawPadNumber;
10231
10332
  const center = { x: centerX, y: centerY };
10232
10333
  let points;
10233
10334
  if (padShape === "RECT" || padShape === "POLYGON") {
@@ -10243,7 +10344,7 @@ var ShapeItemSchema = import_zod179.z.object({
10243
10344
  height,
10244
10345
  layermask,
10245
10346
  net,
10246
- number,
10347
+ number: padNumber,
10247
10348
  holeRadius,
10248
10349
  points,
10249
10350
  rotation: rotation2,
@@ -10695,7 +10796,7 @@ var OwnerSchema = import_zod181.z.object({
10695
10796
  });
10696
10797
  var HeadSchema = import_zod181.z.object({
10697
10798
  docType: import_zod181.z.preprocess((val) => val == null ? val : String(val), import_zod181.z.string()),
10698
- editorVersion: import_zod181.z.string(),
10799
+ editorVersion: import_zod181.z.string().default(""),
10699
10800
  c_para: import_zod181.z.record(import_zod181.z.string(), import_zod181.z.string().nullable()),
10700
10801
  x: import_zod181.z.number(),
10701
10802
  y: import_zod181.z.number(),
@@ -10708,7 +10809,7 @@ var HeadSchema = import_zod181.z.object({
10708
10809
  }, import_zod181.z.number()),
10709
10810
  importFlag: import_zod181.z.number().optional(),
10710
10811
  c_spiceCmd: import_zod181.z.any().optional(),
10711
- hasIdFlag: import_zod181.z.boolean()
10812
+ hasIdFlag: import_zod181.z.boolean().default(false)
10712
10813
  });
10713
10814
  var BBoxSchema = import_zod181.z.object({
10714
10815
  x: import_zod181.z.number(),
@@ -10733,9 +10834,17 @@ var DataStrSchema = import_zod181.z.object({
10733
10834
  head: HeadSchema,
10734
10835
  canvas: import_zod181.z.string(),
10735
10836
  shape: import_zod181.z.array(SingleLetterShapeSchema),
10736
- BBox: BBoxSchema,
10737
- colors: import_zod181.z.union([import_zod181.z.array(import_zod181.z.string()), import_zod181.z.record(import_zod181.z.string())])
10738
- });
10837
+ BBox: BBoxSchema.optional(),
10838
+ colors: import_zod181.z.union([import_zod181.z.array(import_zod181.z.string()), import_zod181.z.record(import_zod181.z.string())]).default([])
10839
+ }).transform((data) => ({
10840
+ ...data,
10841
+ BBox: data.BBox ?? {
10842
+ x: data.head.x,
10843
+ y: data.head.y,
10844
+ width: 0,
10845
+ height: 0
10846
+ }
10847
+ }));
10739
10848
  var PackageDetailDataStrSchema = import_zod181.z.object({
10740
10849
  head: HeadSchema,
10741
10850
  canvas: import_zod181.z.string(),
@@ -10930,7 +11039,7 @@ var getEasyEdaCadModelPlacement = async (easyEdaJson, { fetch: fetch2 = globalTh
10930
11039
  // lib/websafe/generate-footprint-tsx.ts
10931
11040
  var mapPortHints = (portHints, portHintsMap) => {
10932
11041
  if (!portHintsMap || !portHints) return portHints;
10933
- return portHints.flatMap((hint) => portHintsMap[hint] ?? [hint]);
11042
+ return [...new Set(portHints.flatMap((hint) => portHintsMap[hint] ?? [hint]))];
10934
11043
  };
10935
11044
  var generateFootprintTsx = (circuitJson, options = {}) => {
10936
11045
  const holes = su(circuitJson).pcb_hole.list();
@@ -11024,40 +11133,6 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
11024
11133
  };
11025
11134
 
11026
11135
  // lib/websafe/convert-to-typescript-component/generate-typescript-component.ts
11027
- var getPinLabelValues = (labels) => {
11028
- if (typeof labels === "string") return [labels];
11029
- return [...labels];
11030
- };
11031
- var stripEasyEdaPolarityHintDecoration = (label) => label.toLowerCase().replace(/[^a-z0-9+-]/g, "");
11032
- var getPinKeySortValue = (pinKey) => {
11033
- const match = /^pin(\d+)$/i.exec(pinKey);
11034
- return match ? Number(match[1]) : Number.MAX_SAFE_INTEGER;
11035
- };
11036
- var getPolarizedPinMetadata = (pinLabels) => {
11037
- const labelsByPin = Object.entries(pinLabels ?? {}).map(([pin, labels]) => ({
11038
- pin,
11039
- labels: getPinLabelValues(labels).map(stripEasyEdaPolarityHintDecoration)
11040
- }));
11041
- const anodePin = labelsByPin.find(
11042
- ({ labels }) => labels.some((label) => ["a", "anode", "pos", "+"].includes(label))
11043
- )?.pin;
11044
- const cathodePin = labelsByPin.find(
11045
- ({ labels }) => labels.some((label) => ["c", "k", "cathode", "neg", "-"].includes(label))
11046
- )?.pin;
11047
- if (!anodePin || !cathodePin) return void 0;
11048
- const polarizedPinEntries = [
11049
- [anodePin, ["anode", "pos"]],
11050
- [cathodePin, ["cathode", "neg"]]
11051
- ].sort(
11052
- ([pinA], [pinB]) => getPinKeySortValue(pinA) - getPinKeySortValue(pinB)
11053
- );
11054
- return {
11055
- portHintsMap: Object.fromEntries(
11056
- polarizedPinEntries.map(([pin, labels]) => [pin, [pin, ...labels]])
11057
- ),
11058
- pinLabels: Object.fromEntries(polarizedPinEntries)
11059
- };
11060
- };
11061
11136
  var generateTypescriptComponent = ({
11062
11137
  pinLabels,
11063
11138
  componentName,
@@ -11227,60 +11302,6 @@ ${cadModelLines}
11227
11302
  `.trim();
11228
11303
  };
11229
11304
 
11230
- // lib/websafe/convert-to-typescript-component/category-value-contains-diode.ts
11231
- var categoryValueContainsDiode = (value) => {
11232
- if (typeof value === "string") {
11233
- return /(^|[^a-z])diodes?([^a-z]|$)/i.test(value);
11234
- }
11235
- if (Array.isArray(value)) {
11236
- return value.some(categoryValueContainsDiode);
11237
- }
11238
- if (value && typeof value === "object") {
11239
- return Object.values(value).some(categoryValueContainsDiode);
11240
- }
11241
- return false;
11242
- };
11243
-
11244
- // lib/websafe/convert-to-typescript-component/is-diode-category-component.ts
11245
- var isDiodeCategoryComponent = (betterEasy) => {
11246
- const cPara = betterEasy.dataStr.head.c_para;
11247
- return [
11248
- betterEasy.tags,
11249
- cPara.category,
11250
- cPara.Category,
11251
- cPara["LCSC Category"],
11252
- cPara["JLCPCB Category"],
11253
- betterEasy.category
11254
- ].some(categoryValueContainsDiode);
11255
- };
11256
-
11257
- // lib/websafe/convert-to-typescript-component/category-value-contains-led.ts
11258
- var categoryValueContainsLed = (value) => {
11259
- if (typeof value === "string") {
11260
- return /(^|[^a-z])leds?([^a-z]|$)/i.test(value) || /light[-\s]?emitting\s+diodes?/i.test(value);
11261
- }
11262
- if (Array.isArray(value)) {
11263
- return value.some(categoryValueContainsLed);
11264
- }
11265
- if (value && typeof value === "object") {
11266
- return Object.values(value).some(categoryValueContainsLed);
11267
- }
11268
- return false;
11269
- };
11270
-
11271
- // lib/websafe/convert-to-typescript-component/is-led-category-component.ts
11272
- var isLedCategoryComponent = (betterEasy) => {
11273
- const cPara = betterEasy.dataStr.head.c_para;
11274
- return [
11275
- betterEasy.tags,
11276
- cPara.category,
11277
- cPara.Category,
11278
- cPara["LCSC Category"],
11279
- cPara["JLCPCB Category"],
11280
- betterEasy.category
11281
- ].some(categoryValueContainsLed);
11282
- };
11283
-
11284
11305
  // lib/websafe/convert-to-typescript-component/category-value-contains-pushbutton.ts
11285
11306
  var categoryValueContainsPushbutton = (value) => {
11286
11307
  if (typeof value === "string") {