easyeda 0.0.314 → 0.0.315
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/browser/index.js +47 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +47 -2
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +48 -3
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -3528,7 +3528,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
|
|
|
3528
3528
|
var package_default = {
|
|
3529
3529
|
name: "easyeda",
|
|
3530
3530
|
type: "module",
|
|
3531
|
-
version: "0.0.
|
|
3531
|
+
version: "0.0.314",
|
|
3532
3532
|
files: [
|
|
3533
3533
|
"dist"
|
|
3534
3534
|
],
|
|
@@ -11280,6 +11280,37 @@ var generateFootprintTsx = (circuitJson, options = {}) => {
|
|
|
11280
11280
|
`.trim();
|
|
11281
11281
|
};
|
|
11282
11282
|
|
|
11283
|
+
// lib/websafe/convert-to-typescript-component/infer-pin-attributes.ts
|
|
11284
|
+
var POWER_PIN_LABEL = /^(?:VCC|VDD|VIN|VDDA)\d*$/;
|
|
11285
|
+
var GROUND_PIN_LABEL = /^(?:GND|VSS|PGND|AGND)\d*$/;
|
|
11286
|
+
var NO_CONNECT_PIN_LABEL = /^NC\d*$/;
|
|
11287
|
+
var getAttributeKind = (label) => {
|
|
11288
|
+
const normalizedLabel = label.trim().toUpperCase();
|
|
11289
|
+
if (POWER_PIN_LABEL.test(normalizedLabel)) return "power";
|
|
11290
|
+
if (GROUND_PIN_LABEL.test(normalizedLabel)) return "ground";
|
|
11291
|
+
if (NO_CONNECT_PIN_LABEL.test(normalizedLabel)) return "no-connect";
|
|
11292
|
+
return void 0;
|
|
11293
|
+
};
|
|
11294
|
+
var inferPinAttributes = (pinLabels) => {
|
|
11295
|
+
const pinAttributes = {};
|
|
11296
|
+
for (const [pinName, labels] of Object.entries(pinLabels)) {
|
|
11297
|
+
const labelList = typeof labels === "string" ? [labels] : labels;
|
|
11298
|
+
const inferredKinds = labelList.map(getAttributeKind);
|
|
11299
|
+
if (inferredKinds.some((kind) => kind === void 0)) continue;
|
|
11300
|
+
const attributeKinds = new Set(inferredKinds);
|
|
11301
|
+
if (attributeKinds.size !== 1) continue;
|
|
11302
|
+
const [attributeKind] = attributeKinds;
|
|
11303
|
+
if (attributeKind === "power") {
|
|
11304
|
+
pinAttributes[pinName] = { requiresPower: true };
|
|
11305
|
+
} else if (attributeKind === "ground") {
|
|
11306
|
+
pinAttributes[pinName] = { requiresGround: true };
|
|
11307
|
+
} else if (attributeKind === "no-connect") {
|
|
11308
|
+
pinAttributes[pinName] = { doNotConnect: true };
|
|
11309
|
+
}
|
|
11310
|
+
}
|
|
11311
|
+
return pinAttributes;
|
|
11312
|
+
};
|
|
11313
|
+
|
|
11283
11314
|
// lib/websafe/convert-to-typescript-component/generate-typescript-component.ts
|
|
11284
11315
|
var generateTypescriptComponent = ({
|
|
11285
11316
|
pinLabels,
|
|
@@ -11315,6 +11346,20 @@ var generateTypescriptComponent = ({
|
|
|
11315
11346
|
})
|
|
11316
11347
|
);
|
|
11317
11348
|
const pinLabelsString = Object.entries(simplifiedPinLabels).map(([pin, labels]) => ` ${pin}: ${JSON.stringify(labels)}`).join(",\n");
|
|
11349
|
+
const inferredPinAttributes = componentType === "chip" ? inferPinAttributes(simplifiedPinLabels) : {};
|
|
11350
|
+
const pinAttributesString = Object.entries(inferredPinAttributes).map(([pin, attributes]) => {
|
|
11351
|
+
const attributesString = Object.entries(attributes).map(
|
|
11352
|
+
([attributeName, value]) => `${attributeName}: ${JSON.stringify(value)}`
|
|
11353
|
+
).join(", ");
|
|
11354
|
+
return ` ${pin}: {${attributesString}}`;
|
|
11355
|
+
}).join(",\n");
|
|
11356
|
+
const pinAttributesBlock = pinAttributesString ? `const pinAttributes = {
|
|
11357
|
+
${pinAttributesString}
|
|
11358
|
+
} as const
|
|
11359
|
+
|
|
11360
|
+
` : "";
|
|
11361
|
+
const pinAttributesProp = pinAttributesString ? ` pinAttributes={pinAttributes}
|
|
11362
|
+
` : "";
|
|
11318
11363
|
const polarizedPinLabelsString = Object.entries(polarizedPinLabels ?? {}).map(([pin, labels]) => ` ${pin}: ${JSON.stringify(labels)}`).join(",\n");
|
|
11319
11364
|
const polarizedPinLabelsBlock = polarizedPinLabels ? `const pinLabels = {
|
|
11320
11365
|
${polarizedPinLabelsString}
|
|
@@ -11566,11 +11611,11 @@ const pinLabels = {
|
|
|
11566
11611
|
${pinLabelsString}
|
|
11567
11612
|
} as const
|
|
11568
11613
|
|
|
11569
|
-
export const ${componentName} = (props: ChipProps<typeof pinLabels>) => {
|
|
11614
|
+
${pinAttributesBlock}export const ${componentName} = (props: ChipProps<typeof pinLabels>) => {
|
|
11570
11615
|
return (
|
|
11571
11616
|
<chip
|
|
11572
11617
|
pinLabels={pinLabels}
|
|
11573
|
-
${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
11618
|
+
${pinAttributesProp}${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
11574
11619
|
manufacturerPartNumber="${manufacturerPartNumber}"
|
|
11575
11620
|
footprint={${footprintTsx}}
|
|
11576
11621
|
${objUrl || stepUrl ? `cadModel={{
|