easyeda 0.0.291 → 0.0.293
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 +39 -4
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +39 -4
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +40 -5
- 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.292",
|
|
3532
3532
|
files: [
|
|
3533
3533
|
"dist"
|
|
3534
3534
|
],
|
|
@@ -11351,6 +11351,30 @@ ${cadModelLines}
|
|
|
11351
11351
|
/>
|
|
11352
11352
|
)
|
|
11353
11353
|
}
|
|
11354
|
+
`.trim();
|
|
11355
|
+
}
|
|
11356
|
+
if (componentType === "connector") {
|
|
11357
|
+
return `
|
|
11358
|
+
import type { ConnectorProps } from "@tscircuit/props"
|
|
11359
|
+
|
|
11360
|
+
const pinLabels = {
|
|
11361
|
+
${pinLabelsString}
|
|
11362
|
+
} as const
|
|
11363
|
+
|
|
11364
|
+
export const ${componentName} = (props: ConnectorProps) => {
|
|
11365
|
+
return (
|
|
11366
|
+
<connector
|
|
11367
|
+
pinLabels={pinLabels}
|
|
11368
|
+
supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
11369
|
+
manufacturerPartNumber="${manufacturerPartNumber}"
|
|
11370
|
+
footprint={${footprintTsx}}
|
|
11371
|
+
${objUrl || stepUrl ? `cadModel={{
|
|
11372
|
+
${cadModelLines}
|
|
11373
|
+
}}` : ""}
|
|
11374
|
+
{...props}
|
|
11375
|
+
/>
|
|
11376
|
+
)
|
|
11377
|
+
}
|
|
11354
11378
|
`.trim();
|
|
11355
11379
|
}
|
|
11356
11380
|
return `
|
|
@@ -11395,6 +11419,12 @@ var isInductorComponent = (betterEasy) => {
|
|
|
11395
11419
|
return packageName?.toUpperCase().startsWith("IND-") === true && typeof value === "string" && inductancePattern.test(value.trim());
|
|
11396
11420
|
};
|
|
11397
11421
|
|
|
11422
|
+
// lib/websafe/convert-to-typescript-component/is-micro-usb-connector-component.ts
|
|
11423
|
+
var isMicroUsbConnectorComponent = (betterEasy) => {
|
|
11424
|
+
const componentParameters = betterEasy.dataStr.head.c_para;
|
|
11425
|
+
return componentParameters.pre === "USB?" && componentParameters.package?.toUpperCase().startsWith("MICRO-USB-") === true;
|
|
11426
|
+
};
|
|
11427
|
+
|
|
11398
11428
|
// lib/websafe/convert-to-typescript-component/category-value-contains-pushbutton.ts
|
|
11399
11429
|
var categoryValueContainsPushbutton = (value) => {
|
|
11400
11430
|
if (typeof value === "string") {
|
|
@@ -11758,13 +11788,14 @@ var hasNonBoxSchematicSymbol = (easyEdaJson) => {
|
|
|
11758
11788
|
};
|
|
11759
11789
|
|
|
11760
11790
|
// lib/websafe/convert-to-typescript-component/index.tsx
|
|
11761
|
-
var getGeneratedComponentType = (betterEasy) => {
|
|
11791
|
+
var getGeneratedComponentType = (betterEasy, pinCount) => {
|
|
11762
11792
|
if (isLedCategoryComponent(betterEasy)) return "led";
|
|
11763
|
-
if (isDiodeCategoryComponent(betterEasy)) return "diode";
|
|
11793
|
+
if (isDiodeCategoryComponent(betterEasy) && pinCount === 2) return "diode";
|
|
11764
11794
|
if (isPushbuttonCategoryComponent(betterEasy)) return "pushbutton";
|
|
11765
11795
|
if (isSwitchCategoryComponent(betterEasy)) return "switch";
|
|
11766
11796
|
if (isInductorComponent(betterEasy)) return "inductor";
|
|
11767
11797
|
if (isCrystalComponent(betterEasy)) return "crystal";
|
|
11798
|
+
if (isMicroUsbConnectorComponent(betterEasy)) return "connector";
|
|
11768
11799
|
return "chip";
|
|
11769
11800
|
};
|
|
11770
11801
|
var convertRawEasyToTsx = async ({ rawEasy }) => {
|
|
@@ -11829,11 +11860,15 @@ var convertBetterEasyToTsx = async ({
|
|
|
11829
11860
|
const supplierPartNumbers = {
|
|
11830
11861
|
jlcpcb: [betterEasy.lcsc.number]
|
|
11831
11862
|
};
|
|
11832
|
-
const componentType = getGeneratedComponentType(
|
|
11863
|
+
const componentType = getGeneratedComponentType(
|
|
11864
|
+
betterEasy,
|
|
11865
|
+
sourcePorts.length
|
|
11866
|
+
);
|
|
11833
11867
|
const inductance2 = componentType === "inductor" ? betterEasy.dataStr.head.c_para.Value?.trim() : void 0;
|
|
11834
11868
|
const crystalFrequency = componentType === "crystal" ? betterEasy.dataStr.head.c_para.Value?.trim() : void 0;
|
|
11835
11869
|
const crystalPinVariant = componentType !== "crystal" ? void 0 : sourcePorts.length === 4 ? "four_pin" : sourcePorts.length === 2 ? "two_pin" : void 0;
|
|
11836
|
-
const
|
|
11870
|
+
const isMultiPinDiode = isDiodeCategoryComponent(betterEasy) && sourcePorts.length !== 2;
|
|
11871
|
+
const symbolTsx = componentType === "chip" && !isMultiPinDiode && hasNonBoxSchematicSymbol(betterEasy) ? generateSymbolTsx(betterEasy, circuitJson) : void 0;
|
|
11837
11872
|
return generateTypescriptComponent({
|
|
11838
11873
|
componentName,
|
|
11839
11874
|
manufacturerPartNumber,
|