easyeda 0.0.280 → 0.0.281
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 +13 -15
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +13 -15
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +14 -16
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -3513,7 +3513,7 @@ var import_promises = __toESM(require("fs/promises"), 1);
|
|
|
3513
3513
|
var package_default = {
|
|
3514
3514
|
name: "easyeda",
|
|
3515
3515
|
type: "module",
|
|
3516
|
-
version: "0.0.
|
|
3516
|
+
version: "0.0.280",
|
|
3517
3517
|
files: [
|
|
3518
3518
|
"dist"
|
|
3519
3519
|
],
|
|
@@ -11366,10 +11366,11 @@ var isSwitchCategoryComponent = (betterEasy) => {
|
|
|
11366
11366
|
|
|
11367
11367
|
// lib/websafe/convert-to-typescript-component/generate-symbol-tsx.ts
|
|
11368
11368
|
var round = (value) => Number(value.toFixed(6));
|
|
11369
|
-
var
|
|
11369
|
+
var EASYEDA_SCHEMATIC_UNIT_TO_TSCIRCUIT_UNIT = 0.02;
|
|
11370
|
+
var toSchematicUnits = (value) => round(value * EASYEDA_SCHEMATIC_UNIT_TO_TSCIRCUIT_UNIT);
|
|
11370
11371
|
var getPointTransformer = (origin) => (point2) => ({
|
|
11371
|
-
x:
|
|
11372
|
-
y:
|
|
11372
|
+
x: toSchematicUnits(point2.x - origin.x),
|
|
11373
|
+
y: toSchematicUnits(origin.y - point2.y)
|
|
11373
11374
|
});
|
|
11374
11375
|
var formatNumber = (value) => String(round(value));
|
|
11375
11376
|
var SVG_PATH_COMMAND_PARAMETER_COUNTS = {
|
|
@@ -11474,8 +11475,8 @@ var transformSvgPath = (pathData, origin) => {
|
|
|
11474
11475
|
output.push(
|
|
11475
11476
|
[
|
|
11476
11477
|
"A",
|
|
11477
|
-
formatNumber(
|
|
11478
|
-
formatNumber(
|
|
11478
|
+
formatNumber(toSchematicUnits(Math.abs(values[0]))),
|
|
11479
|
+
formatNumber(toSchematicUnits(Math.abs(values[1]))),
|
|
11479
11480
|
formatNumber(-values[2]),
|
|
11480
11481
|
String(values[3]),
|
|
11481
11482
|
String(values[4] === 0 ? 1 : 0),
|
|
@@ -11499,15 +11500,12 @@ var getPinDirection = (rotation2) => {
|
|
|
11499
11500
|
var getPinStemLength = (path) => {
|
|
11500
11501
|
const segment = path.match(/[hHvV]\s*(-?(?:\d*\.\d+|\d+\.?))/);
|
|
11501
11502
|
if (!segment) return void 0;
|
|
11502
|
-
return
|
|
11503
|
+
return toSchematicUnits(Math.abs(Number(segment[1])));
|
|
11503
11504
|
};
|
|
11504
|
-
var
|
|
11505
|
+
var getTextFontSize = (fontSize) => {
|
|
11505
11506
|
const numericFontSize = Number.parseFloat(fontSize);
|
|
11506
|
-
if (!Number.isFinite(numericFontSize)) return
|
|
11507
|
-
|
|
11508
|
-
return round(numericFontSize * 25.4 / 72);
|
|
11509
|
-
}
|
|
11510
|
-
return toMillimeters(numericFontSize);
|
|
11507
|
+
if (!Number.isFinite(numericFontSize)) return 0.2;
|
|
11508
|
+
return toSchematicUnits(numericFontSize);
|
|
11511
11509
|
};
|
|
11512
11510
|
var getTextAnchor = (alignment) => {
|
|
11513
11511
|
if (alignment === "L") return "left";
|
|
@@ -11585,11 +11583,11 @@ var generateShapeTsx = ({
|
|
|
11585
11583
|
x: shape.position.x + shape.width / 2,
|
|
11586
11584
|
y: shape.position.y + shape.height / 2
|
|
11587
11585
|
});
|
|
11588
|
-
return `<schematicrect schX={${center.x}} schY={${center.y}} width={${
|
|
11586
|
+
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)}` : ""} />`;
|
|
11589
11587
|
}
|
|
11590
11588
|
if (shape.type === "ELLIPSE") {
|
|
11591
11589
|
const center = transformPoint(shape.center);
|
|
11592
|
-
return `<schematiccircle center={{ x: ${center.x}, y: ${center.y} }} radius={${
|
|
11590
|
+
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)}` : ""} />`;
|
|
11593
11591
|
}
|
|
11594
11592
|
if (shape.type === "POLYLINE" || shape.type === "POLYGON") {
|
|
11595
11593
|
const isPolygon = shape.type === "POLYGON";
|
|
@@ -11610,7 +11608,7 @@ var generateShapeTsx = ({
|
|
|
11610
11608
|
if (shape.type === "TEXT") {
|
|
11611
11609
|
if (shape.visibility !== "1") return void 0;
|
|
11612
11610
|
const position2 = transformPoint({ x: shape.x, y: shape.y });
|
|
11613
|
-
return `<schematictext schX={${position2.x}} schY={${position2.y}} text=${JSON.stringify(shape.content)} fontSize={${
|
|
11611
|
+
return `<schematictext schX={${position2.x}} schY={${position2.y}} text=${JSON.stringify(shape.content)} fontSize={${getTextFontSize(shape.fontSize)}} anchor=${JSON.stringify(getTextAnchor(shape.alignment))} color=${JSON.stringify(shape.fontColor)} schRotation={${round(-shape.rotation)}} />`;
|
|
11614
11612
|
}
|
|
11615
11613
|
if (shape.type === "PIN" && portMetadata) {
|
|
11616
11614
|
const position2 = transformPoint({ x: shape.x, y: shape.y });
|