easyeda 0.0.337 → 0.0.338
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 +32 -6
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +32 -6
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +33 -7
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -1026,7 +1026,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
|
|
|
1026
1026
|
var package_default = {
|
|
1027
1027
|
name: "easyeda",
|
|
1028
1028
|
type: "module",
|
|
1029
|
-
version: "0.0.
|
|
1029
|
+
version: "0.0.337",
|
|
1030
1030
|
files: [
|
|
1031
1031
|
"dist"
|
|
1032
1032
|
],
|
|
@@ -9390,11 +9390,11 @@ var generateShapeTsx = ({
|
|
|
9390
9390
|
x: shape.position.x + shape.width / 2,
|
|
9391
9391
|
y: shape.position.y + shape.height / 2
|
|
9392
9392
|
});
|
|
9393
|
-
return `<schematicrect schX={${center.x}} schY={${center.y}} width={${toSchematicUnits(shape.width)}} height={${toSchematicUnits(shape.height)}} color=${JSON.stringify(shape.color)}${shape.fillColor && shape.fillColor !== "none" ? ` isFilled fillColor=${JSON.stringify(shape.fillColor)}` : ""} />`;
|
|
9393
|
+
return `<schematicrect schX={${center.x}} schY={${center.y}} width={${toSchematicUnits(shape.width)}} height={${toSchematicUnits(shape.height)}} strokeWidth={${toSchematicUnits(shape.lineWidth)}} color=${JSON.stringify(shape.color)}${shape.fillColor && shape.fillColor !== "none" ? ` isFilled fillColor=${JSON.stringify(shape.fillColor)}` : ""} />`;
|
|
9394
9394
|
}
|
|
9395
9395
|
if (shape.type === "ELLIPSE") {
|
|
9396
9396
|
const center = transformPoint(shape.center);
|
|
9397
|
-
return `<schematiccircle center={{ x: ${center.x}, y: ${center.y} }} radius={${toSchematicUnits(Math.max(shape.radiusX, shape.radiusY))}} color=${JSON.stringify(shape.color)}${shape.fillColor && shape.fillColor !== "none" ? ` isFilled fillColor=${JSON.stringify(shape.fillColor)}` : ""} />`;
|
|
9397
|
+
return `<schematiccircle center={{ x: ${center.x}, y: ${center.y} }} radius={${toSchematicUnits(Math.max(shape.radiusX, shape.radiusY))}} strokeWidth={${toSchematicUnits(shape.lineWidth)}} color=${JSON.stringify(shape.color)}${shape.fillColor && shape.fillColor !== "none" ? ` isFilled fillColor=${JSON.stringify(shape.fillColor)}` : ""} />`;
|
|
9398
9398
|
}
|
|
9399
9399
|
if (shape.type === "POLYLINE" || shape.type === "POLYGON") {
|
|
9400
9400
|
const isPolygon = shape.type === "POLYGON";
|
|
@@ -9706,7 +9706,8 @@ var generateTypescriptComponent = ({
|
|
|
9706
9706
|
crystalFrequency,
|
|
9707
9707
|
crystalPinVariant,
|
|
9708
9708
|
symbolTsx,
|
|
9709
|
-
schPinArrangement
|
|
9709
|
+
schPinArrangement,
|
|
9710
|
+
useSymbolPortsOnly = false
|
|
9710
9711
|
}) => {
|
|
9711
9712
|
const safePinLabels = pinLabels ?? {};
|
|
9712
9713
|
const polarizedPinMetadata = getPolarizedPinMetadata(safePinLabels);
|
|
@@ -10001,8 +10002,7 @@ ${pinLabelsString}
|
|
|
10001
10002
|
${pinAttributesBlock}export const ${componentName} = (props: ChipProps<typeof pinLabels>) => {
|
|
10002
10003
|
return (
|
|
10003
10004
|
<chip
|
|
10004
|
-
pinLabels={pinLabels}
|
|
10005
|
-
${pinAttributesProp}${symbolProp}${schPinArrangementProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
10005
|
+
${useSymbolPortsOnly ? "" : " pinLabels={pinLabels}\n"}${pinAttributesProp}${symbolProp}${schPinArrangementProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
10006
10006
|
manufacturerPartNumber="${manufacturerPartNumber}"
|
|
10007
10007
|
footprint={${footprintTsx}}
|
|
10008
10008
|
${objUrl || stepUrl ? `cadModel={{
|
|
@@ -10039,6 +10039,29 @@ var isCrystalComponent = (betterEasy) => {
|
|
|
10039
10039
|
return componentParameters.pre === "X?" && packageName?.toUpperCase().startsWith("CRYSTAL-") === true && typeof value === "string" && frequencyPattern.test(value.trim());
|
|
10040
10040
|
};
|
|
10041
10041
|
|
|
10042
|
+
// lib/websafe/convert-to-typescript-component/is-dip-switch-category-component.ts
|
|
10043
|
+
var categoryValueContainsDipSwitch = (value) => {
|
|
10044
|
+
if (typeof value === "string") {
|
|
10045
|
+
return /\bdip\s+switch(?:es)?\b/i.test(value);
|
|
10046
|
+
}
|
|
10047
|
+
if (Array.isArray(value)) return value.some(categoryValueContainsDipSwitch);
|
|
10048
|
+
if (value && typeof value === "object") {
|
|
10049
|
+
return Object.values(value).some(categoryValueContainsDipSwitch);
|
|
10050
|
+
}
|
|
10051
|
+
return false;
|
|
10052
|
+
};
|
|
10053
|
+
var isDipSwitchCategoryComponent = (betterEasy) => {
|
|
10054
|
+
const cPara = betterEasy.dataStr.head.c_para;
|
|
10055
|
+
return [
|
|
10056
|
+
betterEasy.tags,
|
|
10057
|
+
cPara.category,
|
|
10058
|
+
cPara.Category,
|
|
10059
|
+
cPara["LCSC Category"],
|
|
10060
|
+
cPara["JLCPCB Category"],
|
|
10061
|
+
betterEasy.category
|
|
10062
|
+
].some(categoryValueContainsDipSwitch);
|
|
10063
|
+
};
|
|
10064
|
+
|
|
10042
10065
|
// lib/websafe/convert-to-typescript-component/is-inductor-component.ts
|
|
10043
10066
|
var inductancePattern = /^\d+(?:\.\d+)?\s*(?:pH|nH|uH|µH|mH|H)$/i;
|
|
10044
10067
|
var isInductorComponent = (betterEasy) => {
|
|
@@ -10162,6 +10185,7 @@ var getGeneratedComponentType = (betterEasy, pinCount) => {
|
|
|
10162
10185
|
if (isLedCategoryComponent(betterEasy) && pinCount === 2) return "led";
|
|
10163
10186
|
if (isDiodeCategoryComponent(betterEasy) && pinCount === 2) return "diode";
|
|
10164
10187
|
if (isPushbuttonCategoryComponent(betterEasy)) return "pushbutton";
|
|
10188
|
+
if (isDipSwitchCategoryComponent(betterEasy)) return "chip";
|
|
10165
10189
|
if (isSwitchCategoryComponent(betterEasy)) return "switch";
|
|
10166
10190
|
if (isCapacitorComponent(betterEasy)) return "capacitor";
|
|
10167
10191
|
if (isResistorComponent(betterEasy) && pinCount === 2) return "resistor";
|
|
@@ -10260,6 +10284,7 @@ var convertBetterEasyToTsx = async ({
|
|
|
10260
10284
|
betterEasy,
|
|
10261
10285
|
sourcePorts.length
|
|
10262
10286
|
);
|
|
10287
|
+
const isDipSwitch = isDipSwitchCategoryComponent(betterEasy);
|
|
10263
10288
|
const inductance2 = componentType === "inductor" ? betterEasy.dataStr.head.c_para.Value?.trim() : void 0;
|
|
10264
10289
|
const capacitance2 = componentType === "capacitor" ? normalizeCapacitanceValue(betterEasy.dataStr.head.c_para.Value) : void 0;
|
|
10265
10290
|
const resistance2 = componentType === "resistor" ? normalizeResistorValue(betterEasy.dataStr.head.c_para.Value) : void 0;
|
|
@@ -10287,7 +10312,8 @@ var convertBetterEasyToTsx = async ({
|
|
|
10287
10312
|
crystalFrequency,
|
|
10288
10313
|
crystalPinVariant,
|
|
10289
10314
|
symbolTsx,
|
|
10290
|
-
schPinArrangement
|
|
10315
|
+
schPinArrangement,
|
|
10316
|
+
useSymbolPortsOnly: isDipSwitch && Boolean(symbolTsx)
|
|
10291
10317
|
});
|
|
10292
10318
|
};
|
|
10293
10319
|
var checkModelObjUrlValidity = async (url) => {
|