easyeda 0.0.47 → 0.0.49

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.
@@ -2110,12 +2110,33 @@ var parsePolygon = (str) => {
2110
2110
  };
2111
2111
  };
2112
2112
  var PolygonShapeSchema = z60.string().startsWith("PG~").transform(parsePolygon).pipe(PolygonShapeOutputSchema);
2113
+ var PathShapeOutputSchema = z60.object({
2114
+ type: z60.literal("PATH"),
2115
+ pathData: z60.string(),
2116
+ fillColor: z60.string(),
2117
+ strokeWidth: z60.number(),
2118
+ strokeColor: z60.string(),
2119
+ id: z60.string()
2120
+ });
2121
+ var parsePath = (str) => {
2122
+ const [, pathData, fillColor, strokeWidth, strokeColor, , id] = str.split("~");
2123
+ return {
2124
+ type: "PATH",
2125
+ pathData,
2126
+ fillColor,
2127
+ strokeWidth: Number(strokeWidth),
2128
+ strokeColor,
2129
+ id
2130
+ };
2131
+ };
2132
+ var PathShapeSchema = z60.string().startsWith("PT~").transform(parsePath).pipe(PathShapeOutputSchema);
2113
2133
  var SingleLetterShapeSchema = z60.string().transform((x) => {
2114
2134
  if (x.startsWith("R~")) return RectangleShapeSchema.parse(x);
2115
2135
  if (x.startsWith("E~")) return EllipseShapeSchema.parse(x);
2116
2136
  if (x.startsWith("P~")) return PinShapeSchema.parse(x);
2117
2137
  if (x.startsWith("PL~")) return PolylineShapeSchema.parse(x);
2118
2138
  if (x.startsWith("PG~")) return PolygonShapeSchema.parse(x);
2139
+ if (x.startsWith("PT~")) return PathShapeSchema.parse(x);
2119
2140
  throw new Error(`Invalid shape type: ${x}`);
2120
2141
  }).pipe(
2121
2142
  z60.union([
@@ -2123,7 +2144,8 @@ var SingleLetterShapeSchema = z60.string().transform((x) => {
2123
2144
  EllipseShapeOutputSchema,
2124
2145
  PinShapeOutputSchema,
2125
2146
  PolylineShapeOutputSchema,
2126
- PolygonShapeOutputSchema
2147
+ PolygonShapeOutputSchema,
2148
+ PathShapeOutputSchema
2127
2149
  ])
2128
2150
  );
2129
2151
 
@@ -2320,7 +2342,8 @@ var soupTypescriptComponentTemplate = ({
2320
2342
  componentName,
2321
2343
  schPinArrangement,
2322
2344
  objUrl,
2323
- circuitJson
2345
+ circuitJson,
2346
+ supplierPartNumbers
2324
2347
  }) => {
2325
2348
  const footprintTsx = generateFootprintTsx(circuitJson);
2326
2349
  return `
@@ -2338,7 +2361,6 @@ export const ${componentName} = (props: Props) => {
2338
2361
  return (
2339
2362
  <chip
2340
2363
  {...props}
2341
- footprint={${footprintTsx}}
2342
2364
  ${objUrl ? `cadModel={{
2343
2365
  objUrl: "${objUrl}",
2344
2366
  rotationOffset: { x: 0, y: 0, z: 0 },
@@ -2347,6 +2369,8 @@ export const ${componentName} = (props: Props) => {
2347
2369
  pinLabels={pinLabels}
2348
2370
  schPinSpacing={0.75}
2349
2371
  schPortArrangement={${JSON.stringify(schPinArrangement, null, " ")}}
2372
+ supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
2373
+ footprint={${footprintTsx}}
2350
2374
  />
2351
2375
  )
2352
2376
  }
@@ -2384,11 +2408,13 @@ var convertBetterEasyToTsx = async ({
2384
2408
  const pn = normalizeManufacturerPartNumber(rawPn);
2385
2409
  const [cad_component2] = su_default(circuitJson).cad_component.list();
2386
2410
  const pinLabels = {};
2387
- betterEasy.dataStr.shape.filter((shape) => shape.type === "PIN").forEach((pin) => {
2388
- const isPinLabelNumeric = /^\d+$/.test(pin.label);
2389
- const label = isPinLabelNumeric ? `pin${pin.label}` : pin.label;
2390
- pinLabels[pin.pinNumber.toString()] = label;
2391
- });
2411
+ for (const shape of betterEasy.dataStr.shape) {
2412
+ if (shape.type === "PIN") {
2413
+ const isPinLabelNumeric = /^\d+$/.test(shape.label);
2414
+ const label = isPinLabelNumeric ? `pin${shape.label}` : shape.label;
2415
+ pinLabels[shape.pinNumber.toString()] = label;
2416
+ }
2417
+ }
2392
2418
  const pins = betterEasy.dataStr.shape.filter((shape) => shape.type === "PIN");
2393
2419
  const leftPins = pins.filter((pin) => pin.rotation === 180);
2394
2420
  const rightPins = pins.filter((pin) => pin.rotation === 0);
@@ -2411,12 +2437,16 @@ var convertBetterEasyToTsx = async ({
2411
2437
  modelObjUrl = cad_component2.model_obj_url;
2412
2438
  }
2413
2439
  }
2440
+ const supplierPartNumbers = {
2441
+ lcsc: [betterEasy.lcsc.number]
2442
+ };
2414
2443
  return soupTypescriptComponentTemplate({
2415
2444
  componentName: pn,
2416
2445
  pinLabels,
2417
2446
  schPinArrangement,
2418
2447
  objUrl: modelObjUrl,
2419
- circuitJson
2448
+ circuitJson,
2449
+ supplierPartNumbers
2420
2450
  });
2421
2451
  };
2422
2452
  var checkModelObjUrlValidity = async (url) => {
@@ -2520,4 +2550,4 @@ export {
2520
2550
  convertRawEasyToTsx,
2521
2551
  convertEasyEdaJsonToVariousFormats
2522
2552
  };
2523
- //# sourceMappingURL=chunk-V2ZVHWAI.js.map
2553
+ //# sourceMappingURL=chunk-GRJJDG5A.js.map