easyeda 0.0.42 → 0.0.44

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.
@@ -1285,6 +1285,183 @@ var transformPCBElements = (elms, matrix) => {
1285
1285
  }
1286
1286
  return transformedElms;
1287
1287
  };
1288
+ function stringHash(str) {
1289
+ let hash = 0;
1290
+ if (str.length == 0)
1291
+ return hash;
1292
+ for (var i = 0; i < str.length; i++) {
1293
+ var char = str.charCodeAt(i);
1294
+ hash = (hash << 5) - hash + char;
1295
+ hash = hash & hash;
1296
+ }
1297
+ return Math.abs(hash);
1298
+ }
1299
+ var nice_color_palettes = [
1300
+ ["#69d2e7", "#a7dbd8", "#e0e4cc", "#f38630", "#fa6900"],
1301
+ ["#fe4365", "#fc9d9a", "#f9cdad", "#c8c8a9", "#83af9b"],
1302
+ ["#ecd078", "#d95b43", "#c02942", "#542437", "#53777a"],
1303
+ ["#556270", "#4ecdc4", "#c7f464", "#ff6b6b", "#c44d58"],
1304
+ ["#774f38", "#e08e79", "#f1d4af", "#ece5ce", "#c5e0dc"],
1305
+ ["#e8ddcb", "#cdb380", "#036564", "#033649", "#031634"],
1306
+ ["#490a3d", "#bd1550", "#e97f02", "#f8ca00", "#8a9b0f"],
1307
+ ["#594f4f", "#547980", "#45ada8", "#9de0ad", "#e5fcc2"],
1308
+ ["#00a0b0", "#6a4a3c", "#cc333f", "#eb6841", "#edc951"],
1309
+ ["#e94e77", "#d68189", "#c6a49a", "#c6e5d9", "#f4ead5"],
1310
+ ["#3fb8af", "#7fc7af", "#dad8a7", "#ff9e9d", "#ff3d7f"],
1311
+ ["#d9ceb2", "#948c75", "#d5ded9", "#7a6a53", "#99b2b7"],
1312
+ ["#ffffff", "#cbe86b", "#f2e9e1", "#1c140d", "#cbe86b"],
1313
+ ["#efffcd", "#dce9be", "#555152", "#2e2633", "#99173c"],
1314
+ ["#343838", "#005f6b", "#008c9e", "#00b4cc", "#00dffc"],
1315
+ ["#413e4a", "#73626e", "#b38184", "#f0b49e", "#f7e4be"],
1316
+ ["#ff4e50", "#fc913a", "#f9d423", "#ede574", "#e1f5c4"],
1317
+ ["#99b898", "#fecea8", "#ff847c", "#e84a5f", "#2a363b"],
1318
+ ["#655643", "#80bca3", "#f6f7bd", "#e6ac27", "#bf4d28"],
1319
+ ["#00a8c6", "#40c0cb", "#f9f2e7", "#aee239", "#8fbe00"],
1320
+ ["#351330", "#424254", "#64908a", "#e8caa4", "#cc2a41"],
1321
+ ["#554236", "#f77825", "#d3ce3d", "#f1efa5", "#60b99a"],
1322
+ ["#5d4157", "#838689", "#a8caba", "#cad7b2", "#ebe3aa"],
1323
+ ["#8c2318", "#5e8c6a", "#88a65e", "#bfb35a", "#f2c45a"],
1324
+ ["#fad089", "#ff9c5b", "#f5634a", "#ed303c", "#3b8183"],
1325
+ ["#ff4242", "#f4fad2", "#d4ee5e", "#e1edb9", "#f0f2eb"],
1326
+ ["#f8b195", "#f67280", "#c06c84", "#6c5b7b", "#355c7d"],
1327
+ ["#d1e751", "#ffffff", "#000000", "#4dbce9", "#26ade4"],
1328
+ ["#1b676b", "#519548", "#88c425", "#bef202", "#eafde6"],
1329
+ ["#5e412f", "#fcebb6", "#78c0a8", "#f07818", "#f0a830"],
1330
+ ["#bcbdac", "#cfbe27", "#f27435", "#f02475", "#3b2d38"],
1331
+ ["#452632", "#91204d", "#e4844a", "#e8bf56", "#e2f7ce"],
1332
+ ["#eee6ab", "#c5bc8e", "#696758", "#45484b", "#36393b"],
1333
+ ["#f0d8a8", "#3d1c00", "#86b8b1", "#f2d694", "#fa2a00"],
1334
+ ["#2a044a", "#0b2e59", "#0d6759", "#7ab317", "#a0c55f"],
1335
+ ["#f04155", "#ff823a", "#f2f26f", "#fff7bd", "#95cfb7"],
1336
+ ["#b9d7d9", "#668284", "#2a2829", "#493736", "#7b3b3b"],
1337
+ ["#bbbb88", "#ccc68d", "#eedd99", "#eec290", "#eeaa88"],
1338
+ ["#b3cc57", "#ecf081", "#ffbe40", "#ef746f", "#ab3e5b"],
1339
+ ["#a3a948", "#edb92e", "#f85931", "#ce1836", "#009989"],
1340
+ ["#300030", "#480048", "#601848", "#c04848", "#f07241"],
1341
+ ["#67917a", "#170409", "#b8af03", "#ccbf82", "#e33258"],
1342
+ ["#aab3ab", "#c4cbb7", "#ebefc9", "#eee0b7", "#e8caaf"],
1343
+ ["#e8d5b7", "#0e2430", "#fc3a51", "#f5b349", "#e8d5b9"],
1344
+ ["#ab526b", "#bca297", "#c5ceae", "#f0e2a4", "#f4ebc3"],
1345
+ ["#607848", "#789048", "#c0d860", "#f0f0d8", "#604848"],
1346
+ ["#b6d8c0", "#c8d9bf", "#dadabd", "#ecdbbc", "#fedcba"],
1347
+ ["#a8e6ce", "#dcedc2", "#ffd3b5", "#ffaaa6", "#ff8c94"],
1348
+ ["#3e4147", "#fffedf", "#dfba69", "#5a2e2e", "#2a2c31"],
1349
+ ["#fc354c", "#29221f", "#13747d", "#0abfbc", "#fcf7c5"],
1350
+ ["#cc0c39", "#e6781e", "#c8cf02", "#f8fcc1", "#1693a7"],
1351
+ ["#1c2130", "#028f76", "#b3e099", "#ffeaad", "#d14334"],
1352
+ ["#a7c5bd", "#e5ddcb", "#eb7b59", "#cf4647", "#524656"],
1353
+ ["#dad6ca", "#1bb0ce", "#4f8699", "#6a5e72", "#563444"],
1354
+ ["#5c323e", "#a82743", "#e15e32", "#c0d23e", "#e5f04c"],
1355
+ ["#edebe6", "#d6e1c7", "#94c7b6", "#403b33", "#d3643b"],
1356
+ ["#fdf1cc", "#c6d6b8", "#987f69", "#e3ad40", "#fcd036"],
1357
+ ["#230f2b", "#f21d41", "#ebebbc", "#bce3c5", "#82b3ae"],
1358
+ ["#b9d3b0", "#81bda4", "#b28774", "#f88f79", "#f6aa93"],
1359
+ ["#3a111c", "#574951", "#83988e", "#bcdea5", "#e6f9bc"],
1360
+ ["#5e3929", "#cd8c52", "#b7d1a3", "#dee8be", "#fcf7d3"],
1361
+ ["#1c0113", "#6b0103", "#a30006", "#c21a01", "#f03c02"],
1362
+ ["#000000", "#9f111b", "#b11623", "#292c37", "#cccccc"],
1363
+ ["#382f32", "#ffeaf2", "#fcd9e5", "#fbc5d8", "#f1396d"],
1364
+ ["#e3dfba", "#c8d6bf", "#93ccc6", "#6cbdb5", "#1a1f1e"],
1365
+ ["#f6f6f6", "#e8e8e8", "#333333", "#990100", "#b90504"],
1366
+ ["#1b325f", "#9cc4e4", "#e9f2f9", "#3a89c9", "#f26c4f"],
1367
+ ["#a1dbb2", "#fee5ad", "#faca66", "#f7a541", "#f45d4c"],
1368
+ ["#c1b398", "#605951", "#fbeec2", "#61a6ab", "#accec0"],
1369
+ ["#5e9fa3", "#dcd1b4", "#fab87f", "#f87e7b", "#b05574"],
1370
+ ["#951f2b", "#f5f4d7", "#e0dfb1", "#a5a36c", "#535233"],
1371
+ ["#8dccad", "#988864", "#fea6a2", "#f9d6ac", "#ffe9af"],
1372
+ ["#2d2d29", "#215a6d", "#3ca2a2", "#92c7a3", "#dfece6"],
1373
+ ["#413d3d", "#040004", "#c8ff00", "#fa023c", "#4b000f"],
1374
+ ["#eff3cd", "#b2d5ba", "#61ada0", "#248f8d", "#605063"],
1375
+ ["#ffefd3", "#fffee4", "#d0ecea", "#9fd6d2", "#8b7a5e"],
1376
+ ["#cfffdd", "#b4dec1", "#5c5863", "#a85163", "#ff1f4c"],
1377
+ ["#9dc9ac", "#fffec7", "#f56218", "#ff9d2e", "#919167"],
1378
+ ["#4e395d", "#827085", "#8ebe94", "#ccfc8e", "#dc5b3e"],
1379
+ ["#a8a7a7", "#cc527a", "#e8175d", "#474747", "#363636"],
1380
+ ["#f8edd1", "#d88a8a", "#474843", "#9d9d93", "#c5cfc6"],
1381
+ ["#046d8b", "#309292", "#2fb8ac", "#93a42a", "#ecbe13"],
1382
+ ["#f38a8a", "#55443d", "#a0cab5", "#cde9ca", "#f1edd0"],
1383
+ ["#a70267", "#f10c49", "#fb6b41", "#f6d86b", "#339194"],
1384
+ ["#ff003c", "#ff8a00", "#fabe28", "#88c100", "#00c176"],
1385
+ ["#ffedbf", "#f7803c", "#f54828", "#2e0d23", "#f8e4c1"],
1386
+ ["#4e4d4a", "#353432", "#94ba65", "#2790b0", "#2b4e72"],
1387
+ ["#0ca5b0", "#4e3f30", "#fefeeb", "#f8f4e4", "#a5b3aa"],
1388
+ ["#4d3b3b", "#de6262", "#ffb88c", "#ffd0b3", "#f5e0d3"],
1389
+ ["#fffbb7", "#a6f6af", "#66b6ab", "#5b7c8d", "#4f2958"],
1390
+ ["#edf6ee", "#d1c089", "#b3204d", "#412e28", "#151101"],
1391
+ ["#9d7e79", "#ccac95", "#9a947c", "#748b83", "#5b756c"],
1392
+ ["#fcfef5", "#e9ffe1", "#cdcfb7", "#d6e6c3", "#fafbe3"],
1393
+ ["#9cddc8", "#bfd8ad", "#ddd9ab", "#f7af63", "#633d2e"],
1394
+ ["#30261c", "#403831", "#36544f", "#1f5f61", "#0b8185"],
1395
+ ["#aaff00", "#ffaa00", "#ff00aa", "#aa00ff", "#00aaff"],
1396
+ ["#d1313d", "#e5625c", "#f9bf76", "#8eb2c5", "#615375"],
1397
+ ["#ffe181", "#eee9e5", "#fad3b2", "#ffba7f", "#ff9c97"],
1398
+ ["#73c8a9", "#dee1b6", "#e1b866", "#bd5532", "#373b44"],
1399
+ ["#805841", "#dcf7f3", "#fffcdd", "#ffd8d8", "#f5a2a2"]
1400
+ ];
1401
+ var getDebugLayoutObject = (lo) => {
1402
+ let {
1403
+ x,
1404
+ y,
1405
+ width,
1406
+ height
1407
+ } = {
1408
+ ...lo,
1409
+ ...lo.size,
1410
+ ...lo.center,
1411
+ ...lo.position
1412
+ };
1413
+ if (lo.x1 !== void 0 && lo.x2 !== void 0 && lo.y1 !== void 0 && lo.y2 !== void 0) {
1414
+ x = (lo.x1 + lo.x2) / 2;
1415
+ y = (lo.y1 + lo.y2) / 2;
1416
+ width = Math.abs(lo.x1 - lo.x2);
1417
+ height = Math.abs(lo.y1 - lo.y2);
1418
+ }
1419
+ const title = lo.text || lo.name || lo.source?.text || lo.source?.name || "?";
1420
+ const content = lo;
1421
+ if (x === void 0 || y === void 0)
1422
+ return null;
1423
+ if (width === void 0) {
1424
+ if ("outer_diameter" in lo) {
1425
+ width = lo.outer_diameter;
1426
+ height = lo.outer_diameter;
1427
+ }
1428
+ }
1429
+ if (width === void 0 || height === void 0) {
1430
+ width = 0.1;
1431
+ height = 0.1;
1432
+ }
1433
+ return {
1434
+ x,
1435
+ y,
1436
+ width,
1437
+ height,
1438
+ title,
1439
+ content,
1440
+ bg_color: nice_color_palettes[stringHash(lo.type || title) % nice_color_palettes.length]?.[4] ?? "#f00"
1441
+ };
1442
+ };
1443
+ var isTruthy = (value) => Boolean(value);
1444
+ var findBoundsAndCenter = (elements) => {
1445
+ const debugObjects = elements.filter((elm) => elm.type.startsWith("pcb_")).concat(
1446
+ elements.filter((elm) => elm.type === "pcb_trace").flatMap((elm) => elm.route)
1447
+ ).map((elm) => getDebugLayoutObject(elm)).filter(isTruthy);
1448
+ if (debugObjects.length === 0)
1449
+ return { center: { x: 0, y: 0 }, width: 0, height: 0 };
1450
+ let minX = debugObjects[0].x - debugObjects[0].width / 2;
1451
+ let maxX = debugObjects[0].x + debugObjects[0].width / 2;
1452
+ let minY = debugObjects[0].y - debugObjects[0].height / 2;
1453
+ let maxY = debugObjects[0].y + debugObjects[0].height / 2;
1454
+ for (const obj of debugObjects.slice(1)) {
1455
+ minX = Math.min(minX, obj.x - obj.width / 2);
1456
+ maxX = Math.max(maxX, obj.x + obj.width / 2);
1457
+ minY = Math.min(minY, obj.y - obj.height / 2);
1458
+ maxY = Math.max(maxY, obj.y + obj.height / 2);
1459
+ }
1460
+ const width = maxX - minX;
1461
+ const height = maxY - minY;
1462
+ const center = { x: minX + width / 2, y: minY + height / 2 };
1463
+ return { center, width, height };
1464
+ };
1288
1465
 
1289
1466
  // lib/convert-easyeda-json-to-tscircuit-soup-json.ts
1290
1467
  import { compose, scale, translate } from "transformation-matrix";
@@ -1382,11 +1559,11 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
1382
1559
  name: "U1",
1383
1560
  ftype: "simple_bug",
1384
1561
  width: 0,
1385
- // TODO compute width
1562
+ // we update this at the end
1386
1563
  height: 0,
1387
- // TODO compute height
1564
+ // we update this at the end
1388
1565
  rotation: 0,
1389
- center: { x: centerOffset.x, y: centerOffset.y },
1566
+ center: { x: 0, y: 0 },
1390
1567
  layer: "top"
1391
1568
  });
1392
1569
  soupElements.push(source_component, pcb_component2);
@@ -1475,9 +1652,14 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
1475
1652
  );
1476
1653
  }
1477
1654
  if (shouldRecenter) {
1655
+ const bounds = findBoundsAndCenter(
1656
+ // exclude the pcb_component because it's center is currently incorrect,
1657
+ // we set it to (0,0)
1658
+ soupElements.filter((e) => e.type !== "pcb_component")
1659
+ );
1478
1660
  transformPCBElements(
1479
1661
  soupElements,
1480
- compose(translate(-centerOffset.x, centerOffset.y), scale(1, -1))
1662
+ compose(translate(-bounds.center.x, bounds.center.y))
1481
1663
  );
1482
1664
  }
1483
1665
  return soupElements;
@@ -2080,43 +2262,54 @@ var EasyEdaJsonSchema = z61.object({
2080
2262
 
2081
2263
  // lib/generate-footprint-tsx.ts
2082
2264
  import "zod";
2083
- import { mm as mm3 } from "@tscircuit/mm";
2084
- var generateFootprintTsx = (easyEdaJson) => {
2085
- const pads = easyEdaJson.packageDetail.dataStr.shape.filter(
2086
- (shape) => shape.type === "PAD"
2087
- );
2088
- const centerOffset = computeCenterOffset(easyEdaJson);
2089
- const centerX = centerOffset.x;
2090
- const centerY = centerOffset.y;
2091
- const footprintElements = pads.map((pad) => {
2092
- const { center, width, height, holeRadius, number } = pad;
2093
- const isPlatedHole = holeRadius !== void 0 && mm3(holeRadius) > 0;
2094
- const normalizedX = mm3(center.x) - centerX;
2095
- const normalizedY = mm3(center.y) - centerY;
2096
- if (isPlatedHole) {
2097
- return `
2098
- <platedhole
2099
- pcbX="${normalizedX.toFixed(2)}mm"
2100
- pcbY="${normalizedY.toFixed(2)}mm"
2101
- hole_diameter="${mm3(holeRadius) * 2}mm"
2102
- outer_diameter="${mm3(width)}mm"
2103
- portHints={["${number}"]}
2104
- />`.replace(/\n/, "");
2105
- } else {
2106
- return `
2107
- <smtpad
2108
- pcbX="${normalizedX.toFixed(2)}mm"
2109
- pcbY="${normalizedY.toFixed(2)}mm"
2110
- width="${mm3(width)}mm"
2111
- height="${mm3(height)}mm"
2112
- shape="rect"
2113
- portHints={["${number}"]}
2114
- />`.replace(/\n/, "");
2265
+ import { mmStr } from "@tscircuit/mm";
2266
+ var generateFootprintTsx = (circuitJson) => {
2267
+ const holes = su_default(circuitJson).pcb_hole.list();
2268
+ const platedHoles = su_default(circuitJson).pcb_plated_hole.list();
2269
+ const smtPads = su_default(circuitJson).pcb_smtpad.list();
2270
+ const silkscreenPaths = su_default(circuitJson).pcb_silkscreen_path.list();
2271
+ const elementStrings = [];
2272
+ for (const hole of holes) {
2273
+ if (hole.hole_shape === "circle") {
2274
+ elementStrings.push(
2275
+ `<hole pcbX="${mmStr(hole.x)}" pcbY="${mmStr(hole.y)}" diameter="${mmStr(hole.hole_diameter)}" />`
2276
+ );
2277
+ } else if (hole.hole_shape === "oval") {
2278
+ console.warn("Unhandled oval hole in conversion (needs implementation)");
2115
2279
  }
2116
- });
2280
+ }
2281
+ for (const platedHole of platedHoles) {
2282
+ if (platedHole.shape === "oval") {
2283
+ elementStrings.push(
2284
+ `<platedhole portHints={${JSON.stringify(platedHole.port_hints)}} pcbX="${mmStr(platedHole.x)}" pcbY="${mmStr(platedHole.y)}" diameter="${mmStr(platedHole.hole_width)}" height="${mmStr(platedHole.hole_height)}" shape="oval" />`
2285
+ );
2286
+ } else if (platedHole.shape === "circle") {
2287
+ elementStrings.push(
2288
+ `<platedhole portHints={${JSON.stringify(platedHole.port_hints)}} pcbX="${mmStr(platedHole.x)}" pcbY="${mmStr(platedHole.y)}" diameter="${mmStr(platedHole.hole_diameter)}" shape="circle" />`
2289
+ );
2290
+ } else if (platedHole.shape === "pill") {
2291
+ console.warn("Unhandled pill hole in conversion (needs implementation)");
2292
+ }
2293
+ }
2294
+ for (const smtPad of smtPads) {
2295
+ if (smtPad.shape === "circle") {
2296
+ elementStrings.push(
2297
+ `<smtpad portHints={${JSON.stringify(smtPad.port_hints)}} pcbX="${mmStr(smtPad.x)}" pcbY="${mmStr(smtPad.y)}" radius="${mmStr(smtPad.radius)}" shape="circle" />`
2298
+ );
2299
+ } else if (smtPad.shape === "rect") {
2300
+ elementStrings.push(
2301
+ `<smtpad portHints={${JSON.stringify(smtPad.port_hints)}} pcbX="${mmStr(smtPad.x)}" pcbY="${mmStr(smtPad.y)}" width="${mmStr(smtPad.width)}" height="${mmStr(smtPad.height)}" shape="rect" />`
2302
+ );
2303
+ }
2304
+ }
2305
+ for (const silkscreenPath of silkscreenPaths) {
2306
+ elementStrings.push(
2307
+ `<silkscreenpath route={${JSON.stringify(silkscreenPath.route)}} />`
2308
+ );
2309
+ }
2117
2310
  return `
2118
2311
  <footprint>
2119
- ${footprintElements.join("\n")}
2312
+ ${elementStrings.join("\n")}
2120
2313
  </footprint>
2121
2314
  `.trim();
2122
2315
  };
@@ -2127,9 +2320,9 @@ var soupTypescriptComponentTemplate = ({
2127
2320
  componentName,
2128
2321
  schPinArrangement,
2129
2322
  objUrl,
2130
- easyEdaJson
2323
+ circuitJson
2131
2324
  }) => {
2132
- const footprintTsx = generateFootprintTsx(easyEdaJson);
2325
+ const footprintTsx = generateFootprintTsx(circuitJson);
2133
2326
  return `
2134
2327
  import { createUseComponent } from "@tscircuit/core"
2135
2328
  import type { CommonLayoutProps } from "@tscircuit/props"
@@ -2147,7 +2340,8 @@ export const ${componentName} = (props: Props) => {
2147
2340
  {...props}
2148
2341
  footprint={${footprintTsx}}
2149
2342
  ${objUrl ? `cadModel={{
2150
- objUrl: "${objUrl}"
2343
+ objUrl: "${objUrl}",
2344
+ rotationOffset: { x: 0, y: 0, z: 0 }
2151
2345
  }}` : ""}
2152
2346
  pinLabels={pinLabels}
2153
2347
  schPinSpacing={0.75}
@@ -2171,31 +2365,30 @@ function normalizeManufacturerPartNumber(partNumber) {
2171
2365
  }
2172
2366
 
2173
2367
  // lib/convert-to-typescript-component/index.tsx
2174
- var convertRawEasyEdaToTs = async (rawEasy) => {
2175
- const easyeda = EasyEdaJsonSchema.parse(rawEasy);
2176
- const soup = convertEasyEdaJsonToTscircuitSoupJson(easyeda, {
2177
- useModelCdn: true
2178
- });
2179
- const result = await convertToTypescriptComponent({
2180
- easyeda,
2181
- soup
2368
+ var convertRawEasyToTsx = async (rawEasy) => {
2369
+ const betterEasy = EasyEdaJsonSchema.parse(rawEasy);
2370
+ const result = await convertBetterEasyToTsx({
2371
+ betterEasy
2182
2372
  });
2183
2373
  return result;
2184
2374
  };
2185
- var convertToTypescriptComponent = async ({
2186
- soup,
2187
- easyeda: easyEdaJson
2375
+ var convertBetterEasyToTsx = async ({
2376
+ betterEasy
2188
2377
  }) => {
2189
- const rawPn = easyEdaJson.dataStr.head.c_para["Manufacturer Part"];
2378
+ const circuitJson = convertEasyEdaJsonToCircuitJson(betterEasy, {
2379
+ useModelCdn: true,
2380
+ shouldRecenter: true
2381
+ });
2382
+ const rawPn = betterEasy.dataStr.head.c_para["Manufacturer Part"];
2190
2383
  const pn = normalizeManufacturerPartNumber(rawPn);
2191
- const [cad_component2] = su_default(soup).cad_component.list();
2384
+ const [cad_component2] = su_default(circuitJson).cad_component.list();
2192
2385
  const pinLabels = {};
2193
- easyEdaJson.dataStr.shape.filter((shape) => shape.type === "PIN").forEach((pin) => {
2386
+ betterEasy.dataStr.shape.filter((shape) => shape.type === "PIN").forEach((pin) => {
2194
2387
  const isPinLabelNumeric = /^\d+$/.test(pin.label);
2195
2388
  const label = isPinLabelNumeric ? `pin${pin.label}` : pin.label;
2196
2389
  pinLabels[pin.pinNumber.toString()] = label;
2197
2390
  });
2198
- const pins = easyEdaJson.dataStr.shape.filter((shape) => shape.type === "PIN");
2391
+ const pins = betterEasy.dataStr.shape.filter((shape) => shape.type === "PIN");
2199
2392
  const leftPins = pins.filter((pin) => pin.rotation === 180);
2200
2393
  const rightPins = pins.filter((pin) => pin.rotation === 0);
2201
2394
  const schPinArrangement = {
@@ -2222,7 +2415,7 @@ var convertToTypescriptComponent = async ({
2222
2415
  pinLabels,
2223
2416
  schPinArrangement,
2224
2417
  objUrl: modelObjUrl,
2225
- easyEdaJson
2418
+ circuitJson
2226
2419
  });
2227
2420
  };
2228
2421
  var checkModelObjUrlValidity = async (url) => {
@@ -2292,7 +2485,7 @@ var convertEasyEdaJsonToVariousFormats = async ({
2292
2485
  `[${jlcpcbPartNumberOrFilepath}] Saved better EasyEDA JSON: ${outputFilename}`
2293
2486
  );
2294
2487
  } else if (outputFilename.endsWith(".tsx") || outputFilename.endsWith(".ts")) {
2295
- const tsComp = await convertRawEasyEdaToTs(rawEasyEdaJson);
2488
+ const tsComp = await convertRawEasyToTsx(rawEasyEdaJson);
2296
2489
  await fs.writeFile(outputFilename, tsComp);
2297
2490
  console.log(
2298
2491
  `[${jlcpcbPartNumberOrFilepath}] Saved TypeScript component: ${outputFilename}`
@@ -2323,7 +2516,7 @@ export {
2323
2516
  PackageDetailSchema,
2324
2517
  EasyEdaJsonSchema,
2325
2518
  normalizeManufacturerPartNumber,
2326
- convertRawEasyEdaToTs,
2519
+ convertRawEasyToTsx,
2327
2520
  convertEasyEdaJsonToVariousFormats
2328
2521
  };
2329
- //# sourceMappingURL=chunk-XV5WFS5P.js.map
2522
+ //# sourceMappingURL=chunk-NFQCYU34.js.map